kcode-cli 1.3.17 → 1.3.18

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-manage-models-DTTVfn7C.js","assets/index-D6k9dIwV.js","assets/index-SW1-heh1.css","assets/dialog-ByhQA8CR.js","assets/dialog-select-file-BnW7C137.js","assets/datetime-D2JCa3fE.js","assets/ghostty-web-BELRRBIg.js","assets/dialog-select-mcp-C3_oPeHg.js","assets/dialog-fork-Cmp2Zg_-.js"])))=>i.map(i=>d[i]);
2
- import{f as $,o as je,$ as Ex,n as kt,q as wl,r as ze,v as ie,w as We,g as c,x as Te,y as ne,z as F,i as p,A as Ae,C as Jt,D as gr,E as ut,P as hr,G as $n,H as Rt,J as Vt,K as jt,t as I,N as Mx,O as zx,Q as Ce,R as Lx,U as oo,V as Fx,W as qe,X as vn,Y as Nr,Z as Hg,_ as gf,a0 as xl,a1 as Qe,a2 as qg,a3 as Ge,a4 as Nx,a5 as Gg,a6 as ea,a7 as $e,a8 as Rr,a9 as xt,aa as dn,F as rt,ab as cc,ac as Ie,ad as Wg,ae as it,af as nn,ag as Xg,ah as et,S as Gt,M as Xe,ai as tn,aj as Nn,ak as ir,al as zi,am as Li,an as Fi,ao as Yg,ap as Jg,aq as Ro,ar as uc,as as dc,at as fc,au as mc,av as Ni,aw as gc,ax as vr,ay as hc,az as jo,aA as li,aB as pc,aC as ta,aD as vc,aE as Qg,aF as bc,B as vt,h as bt,aG as Rx,aH as jx,aI as Ux,aJ as Uo,aK as Ot,aL as Ct,aM as Kx,aN as Mn,aO as eh,aP as Vx,aQ as th,aR as Bx,aS as Do,aT as Zx,aU as Hx,aV as ft,aW as Pr,aX as ln,a as or,aY as yc,aZ as wc,a_ as nh,d as rh,a$ as Rn,c as na,b0 as sr,b1 as Ko,b2 as qx,b3 as Os,b4 as Es,b5 as Gx,b6 as So,I as Pt,T as Et,j as _t,s as Nt,b7 as Wx,b8 as Xx,b9 as Ci,ba as yt,bb as pt,bc as ih,bd as Yx,be as jr,l as Qt,bf as oh,bg as sh,bh as Ri,b as ra,u as xc,bi as ji,bj as Ui,m as hf,k as _l,bk as Ms,bl as ah,bm as br,bn as Bn,bo as Jx,bp as _c,bq as $c,br as ms,bs as Qx,bt as Dr,bu as lh,bv as ch,bw as e_,bx as t_,by as n_,bz as Ur,bA as uh,bB as Jn,bC as pf,bD as yr,bE as Sc,bF as Ki,bG as pr,e as r_,bH as kc,bI as vf,bJ as bf,bK as i_,bL as Ii,bM as Ga,bN as o_,bO as s_,bP as a_,bQ as ia,bR as l_,bS as c_,bT as Cc,bU as $l,bV as yf,bW as u_,bX as d_,bY as f_,bZ as m_,b_ as g_,b$ as h_}from"./index-D6k9dIwV.js";import{D as Sl}from"./datetime-D2JCa3fE.js";import{D as dh}from"./dialog-ByhQA8CR.js";const Wa=Symbol("fallback");function wf(e){for(const t of e)t.dispose()}function p_(e,t,r,i={}){const n=new Map;return je(()=>wf(n.values())),()=>{const s=e()||[];return s[Ex],kt(()=>{if(!s.length)return wf(n.values()),n.clear(),i.fallback?[wl(f=>(n.set(Wa,{dispose:f}),i.fallback()))]:[];const a=new Array(s.length),l=n.get(Wa);if(!n.size||l){l?.dispose(),n.delete(Wa);for(let d=0;d<s.length;d++){const f=s[d],m=t(f,d);o(a,f,d,m)}return a}const u=new Set(n.keys());for(let d=0;d<s.length;d++){const f=s[d],m=t(f,d);u.delete(m);const h=n.get(m);h?(a[d]=h.mapped,h.setIndex?.(d),h.setItem(()=>f)):o(a,f,d,m)}for(const d of u)n.get(d)?.dispose(),n.delete(d);return a})};function o(s,a,l,u){wl(d=>{const[f,m]=ze(a),h={setItem:m,dispose:d};if(r.length>1){const[g,y]=ze(l);h.setIndex=y,h.mapped=r(f,g)}else h.mapped=r(f);n.set(u,h),s[l]=h.mapped})}}function v_(e){const{by:t}=e;return $(p_(()=>e.each,typeof t=="function"?t:r=>r[t],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function Ao(e){const t=Math.min(e.start,e.end),r=Math.max(e.start,e.end);return{startLine:t,endLine:r,startChar:0,endChar:0}}var b_=I("<div>"),oa=class{x;y;width;height;constructor(e){this.x=Math.floor(e.x),this.y=Math.floor(e.y),this.width=Math.floor(e.width),this.height=Math.floor(e.height)}get rect(){return{x:this.x,y:this.y,width:this.width,height:this.height}}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get center(){return{x:this.x+this.width*.5,y:this.y+this.height*.5}}get corners(){return{topLeft:{x:this.left,y:this.top},topRight:{x:this.right,y:this.top},bottomRight:{x:this.left,y:this.bottom},bottomLeft:{x:this.right,y:this.bottom}}}},Si=e=>{let t=new oa(e.getBoundingClientRect());const{transform:r}=getComputedStyle(e);return r&&(t=y_(t,r)),t},y_=(e,t)=>{let r,i;if(t.startsWith("matrix3d(")){const n=t.slice(9,-1).split(/, /);r=+n[12],i=+n[13]}else if(t.startsWith("matrix(")){const n=t.slice(7,-1).split(/, /);r=+n[4],i=+n[5]}else r=0,i=0;return new oa({...e,x:e.x-r,y:e.y-i})},Zn=()=>({x:0,y:0}),Ic=(e,t)=>e.x===t.x&&e.y===t.y,Xa=(e,t)=>new oa({...e,x:e.x+t.x,y:e.y+t.y}),w_=(e,t)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),x_=(e,t)=>{const r=Math.max(e.top,t.top),i=Math.max(e.left,t.left),n=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom),s=n-i,a=o-r;if(i<n&&r<o){const l=e.width*e.height,u=t.width*t.height,d=s*a;return d/(l+u-d)}return 0},Ya=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,fh=(e,t,r)=>{const i=e.transformed.center,n={distance:1/0,droppable:null};for(const o of t){const s=w_(i,o.layout.center);s<n.distance?(n.distance=s,n.droppable=o):s===n.distance&&o.id===r.activeDroppableId&&(n.droppable=o)}return n.droppable},__=(e,t,r)=>{const i=e.transformed,n={ratio:0,droppable:null};for(const o of t){const s=x_(i,o.layout);s>n.ratio?(n.ratio=s,n.droppable=o):s>0&&s===n.ratio&&o.id===r.activeDroppableId&&(n.droppable=o)}return n.droppable},mh=Rt(),gh=e=>{const t=ie({collisionDetector:__},e),[r,i]=We({draggables:{},droppables:{},sensors:{},active:{draggableId:null,get draggable(){return r.active.draggableId!==null?r.draggables[r.active.draggableId]:null},droppableId:null,get droppable(){return r.active.droppableId!==null?r.droppables[r.active.droppableId]:null},sensorId:null,get sensor(){return r.active.sensorId!==null?r.sensors[r.active.sensorId]:null},overlay:null}}),n=(A,j,P)=>{A.substring(0,A.length-1),kt(()=>r[A][j])&&i(A,j,"transformers",P.id,P)},o=(A,j,P)=>{A.substring(0,A.length-1),kt(()=>r[A][j])&&kt(()=>r[A][j].transformers[P])&&i(A,j,"transformers",P,void 0)},s=({id:A,node:j,layout:P,data:B})=>{const R=r.draggables[A],V={id:A,node:j,layout:P,data:B,_pendingCleanup:!1};let Q;if(!R)Object.defineProperties(V,{transformers:{enumerable:!0,configurable:!0,writable:!0,value:{}},transform:{enumerable:!0,configurable:!0,get:()=>{if(r.active.overlay)return Zn();const ee=Object.values(r.draggables[A].transformers);return ee.sort((oe,le)=>oe.order-le.order),ee.reduce((oe,le)=>le.callback(oe),Zn())}},transformed:{enumerable:!0,configurable:!0,get:()=>Xa(r.draggables[A].layout,r.draggables[A].transform)}});else if(r.active.draggableId===A&&!r.active.overlay){const ee={x:R.layout.x-P.x,y:R.layout.y-P.y},oe="addDraggable-existing-offset",le=R.transformers[oe],W=le?le.callback(ee):ee;Q={id:oe,order:100,callback:D=>({x:D.x+W.x,y:D.y+W.y})},T(()=>o("draggables",A,oe))}$n(()=>{i("draggables",A,V),Q&&n("draggables",A,Q)}),r.active.draggable&&_()},a=A=>{kt(()=>r.draggables[A])&&(i("draggables",A,"_pendingCleanup",!0),queueMicrotask(()=>l(A)))},l=A=>{if(r.draggables[A]?._pendingCleanup){const j=r.active.draggableId===A;$n(()=>{j&&i("active","draggableId",null),i("draggables",A,void 0)})}},u=({id:A,node:j,layout:P,data:B})=>{const R=r.droppables[A],V={id:A,node:j,layout:P,data:B,_pendingCleanup:!1};R||Object.defineProperties(V,{transformers:{enumerable:!0,configurable:!0,writable:!0,value:{}},transform:{enumerable:!0,configurable:!0,get:()=>{const Q=Object.values(r.droppables[A].transformers);return Q.sort((ee,oe)=>ee.order-oe.order),Q.reduce((ee,oe)=>oe.callback(ee),Zn())}},transformed:{enumerable:!0,configurable:!0,get:()=>Xa(r.droppables[A].layout,r.droppables[A].transform)}}),i("droppables",A,V),r.active.draggable&&_()},d=A=>{kt(()=>r.droppables[A])&&(i("droppables",A,"_pendingCleanup",!0),queueMicrotask(()=>f(A)))},f=A=>{if(r.droppables[A]?._pendingCleanup){const j=r.active.droppableId===A;$n(()=>{j&&i("active","droppableId",null),i("droppables",A,void 0)})}},m=({id:A,activators:j})=>{i("sensors",A,{id:A,activators:j,coordinates:{origin:{x:0,y:0},current:{x:0,y:0},get delta(){return{x:r.sensors[A].coordinates.current.x-r.sensors[A].coordinates.origin.x,y:r.sensors[A].coordinates.current.y-r.sensors[A].coordinates.origin.y}}}})},h=A=>{if(!kt(()=>r.sensors[A]))return;const j=r.active.sensorId===A;$n(()=>{j&&i("active","sensorId",null),i("sensors",A,void 0)})},g=({node:A,layout:j})=>{const P=r.active.overlay,B={node:A,layout:j};P||Object.defineProperties(B,{id:{enumerable:!0,configurable:!0,get:()=>r.active.draggable?.id},data:{enumerable:!0,configurable:!0,get:()=>r.active.draggable?.data},transformers:{enumerable:!0,configurable:!0,get:()=>Object.fromEntries(Object.entries(r.active.draggable?r.active.draggable.transformers:{}).filter(([R])=>R!=="addDraggable-existing-offset"))},transform:{enumerable:!0,configurable:!0,get:()=>{const R=Object.values(r.active.overlay?r.active.overlay.transformers:[]);return R.sort((V,Q)=>V.order-Q.order),R.reduce((V,Q)=>Q.callback(V),Zn())}},transformed:{enumerable:!0,configurable:!0,get:()=>r.active.overlay?Xa(r.active.overlay.layout,r.active.overlay.transform):new oa({x:0,y:0,width:0,height:0})}}),i("active","overlay",B)},y=()=>i("active","overlay",null),b=(A,j)=>{$n(()=>{i("sensors",A,"coordinates",{origin:{...j},current:{...j}}),i("active","sensorId",A)})},v=A=>{const j=r.active.sensorId;j&&i("sensors",j,"coordinates","current",{...A})},w=()=>i("active","sensorId",null),x=(A,j)=>{const P={};for(const R of Object.values(r.sensors))if(R)for(const[V,Q]of Object.entries(R.activators))P[V]??=[],P[V].push({sensor:R,activator:Q});const B={};for(const R in P){let V=R;j&&(V=`on${R}`),B[V]=Q=>{for(const{activator:ee}of P[R]){if(r.active.sensor)break;ee(Q,A)}}}return B},_=()=>{let A=!1;const j=Object.values(r.draggables),P=Object.values(r.droppables),B=r.active.overlay;return $n(()=>{const R=new WeakMap;for(const V of j)if(V){const Q=V.layout;R.has(V.node)||R.set(V.node,Si(V.node));const ee=R.get(V.node);Ya(Q,ee)||(i("draggables",V.id,"layout",ee),A=!0)}for(const V of P)if(V){const Q=V.layout;R.has(V.node)||R.set(V.node,Si(V.node));const ee=R.get(V.node);Ya(Q,ee)||(i("droppables",V.id,"layout",ee),A=!0)}if(B){const V=B.layout,Q=Si(B.node);Ya(V,Q)||(i("active","overlay","layout",Q),A=!0)}}),A},k=()=>{const A=r.active.overlay??r.active.draggable;if(A){const j=t.collisionDetector(A,Object.values(r.droppables),{activeDroppableId:r.active.droppableId}),P=j?j.id:null;r.active.droppableId!==P&&i("active","droppableId",P)}},C=A=>{const j={id:"sensorMove",order:0,callback:P=>r.active.sensor?{x:P.x+r.active.sensor.coordinates.delta.x,y:P.y+r.active.sensor.coordinates.delta.y}:P};_(),$n(()=>{i("active","draggableId",A),n("draggables",A,j)}),k()},O=()=>{const A=kt(()=>r.active.draggableId);$n(()=>{A!==null&&o("draggables",A,"sensorMove"),i("active",["draggableId","droppableId"],null)}),_()},z=A=>{ne(()=>{const j=r.active.draggable;j&&kt(()=>A({draggable:j}))})},K=A=>{ne(()=>{const j=r.active.draggable;if(j){const P=kt(()=>r.active.overlay);Object.values(P?P.transform:j.transform),kt(()=>A({draggable:j,overlay:P}))}})},J=A=>{ne(()=>{const j=r.active.draggable,P=r.active.droppable;j&&kt(()=>A({draggable:j,droppable:P,overlay:r.active.overlay}))})},T=A=>{ne(({previousDraggable:j,previousDroppable:P,previousOverlay:B})=>{const R=r.active.draggable,V=R?r.active.droppable:null,Q=R?r.active.overlay:null;return!R&&j&&kt(()=>A({draggable:j,droppable:P,overlay:B})),{previousDraggable:R,previousDroppable:V,previousOverlay:Q}},{previousDraggable:null,previousDroppable:null,previousOverlay:null})};K(()=>k()),t.onDragStart&&z(t.onDragStart),t.onDragMove&&K(t.onDragMove),t.onDragOver&&J(t.onDragOver),t.onDragEnd&&T(t.onDragEnd);const U=[r,{addTransformer:n,removeTransformer:o,addDraggable:s,removeDraggable:a,addDroppable:u,removeDroppable:d,addSensor:m,removeSensor:h,setOverlay:g,clearOverlay:y,recomputeLayouts:_,detectCollisions:k,draggableActivators:x,sensorStart:b,sensorMove:v,sensorEnd:w,dragStart:C,dragEnd:O,onDragStart:z,onDragMove:K,onDragOver:J,onDragEnd:T}];return c(mh.Provider,{value:U,get children(){return t.children}})},ci=()=>jt(mh)||null,$_=(e="pointer-sensor")=>{const[t,{addSensor:r,removeSensor:i,sensorStart:n,sensorMove:o,sensorEnd:s,dragStart:a,dragEnd:l}]=ci(),u=250,d=10;Vt(()=>{r({id:e,activators:{pointerdown:y}})}),je(()=>{i(e)});const f=()=>t.active.sensorId===e,m={x:0,y:0};let h=null,g=null;const y=(k,C)=>{k.button===0&&(document.addEventListener("pointermove",w),document.addEventListener("pointerup",x),g=C,m.x=k.clientX,m.y=k.clientY,h=window.setTimeout(v,u))},b=()=>{h&&(clearTimeout(h),h=null),document.removeEventListener("pointermove",w),document.removeEventListener("pointerup",x),document.removeEventListener("selectionchange",_)},v=()=>{t.active.sensor?f()||b():(n(e,m),a(g),_(),document.addEventListener("selectionchange",_))},w=k=>{const C={x:k.clientX,y:k.clientY};if(!t.active.sensor){const O={x:C.x-m.x,y:C.y-m.y};Math.sqrt(O.x**2+O.y**2)>d&&v()}f()&&(k.preventDefault(),o(C))},x=k=>{b(),f()&&(k.preventDefault(),l(),s())},_=()=>{window.getSelection()?.removeAllRanges()}},hh=e=>($_(),Te(()=>e.children)),sa=e=>({transform:`translate3d(${e.x}px, ${e.y}px, 0)`}),S_=(e,t={})=>{const[r,{addDraggable:i,removeDraggable:n,draggableActivators:o}]=ci(),[s,a]=ze(null);Vt(()=>{const f=s();f&&i({id:e,node:f,layout:Si(f),data:t})}),je(()=>n(e));const l=()=>r.active.draggableId===e,u=()=>r.draggables[e]?.transform||Zn();return Object.defineProperties((f,m)=>{const h=m?m():{};ne(()=>{const g=s(),y=o(e);if(g)for(const b in y)g.addEventListener(b,y[b]);je(()=>{if(g)for(const b in y)g.removeEventListener(b,y[b])})}),a(f),h.skipTransform||ne(()=>{const g=u();if(Ic(g,Zn()))f.style.removeProperty("transform");else{const y=sa(u());f.style.setProperty("transform",y.transform??null)}})},{ref:{enumerable:!0,value:a},isActiveDraggable:{enumerable:!0,get:l},dragActivators:{enumerable:!0,get:()=>o(e,!0)},transform:{enumerable:!0,get:u}})},k_=(e,t={})=>{const[r,{addDroppable:i,removeDroppable:n}]=ci(),[o,s]=ze(null);Vt(()=>{const d=o();d&&i({id:e,node:d,layout:Si(d),data:t})}),je(()=>n(e));const a=()=>r.active.droppableId===e,l=()=>r.droppables[e]?.transform||Zn();return Object.defineProperties((d,f)=>{const m=f?f():{};s(d),m.skipTransform||ne(()=>{const h=l();if(Ic(h,Zn()))d.style.removeProperty("transform");else{const g=sa(l());d.style.setProperty("transform",g.transform??null)}})},{ref:{enumerable:!0,value:s},isActiveDroppable:{enumerable:!0,get:a},transform:{enumerable:!0,get:l}})},ph=e=>{const[t,{onDragStart:r,onDragEnd:i,setOverlay:n,clearOverlay:o}]=ci();let s;r(({draggable:l})=>{n({node:l.node,layout:l.layout}),queueMicrotask(()=>{if(s){const u=Si(s),d={x:(l.layout.width-u.width)/2,y:(l.layout.height-u.height)/2};u.x+=d.x,u.y+=d.y,n({node:s,layout:u})}})}),i(()=>queueMicrotask(o));const a=()=>{const l=t.active.overlay,u=t.active.draggable;return!l||!u?{}:{position:"fixed",transition:"transform 0s",top:`${l.layout.top}px`,left:`${l.layout.left}px`,"min-width":`${u.layout.width}px`,"min-height":`${u.layout.height}px`,...sa(l.transform),...e.style}};return c(hr,{get mount(){return document.body},get children(){return c(F,{get when(){return t.active.draggable},get children(){var l=b_(),u=s;return typeof u=="function"?ut(u,l):s=l,p(l,(()=>{var d=Te(()=>typeof e.children=="function");return()=>d()?e.children(t.active.draggable):e.children})()),Ae(d=>{var f=e.class,m=a();return f!==d.e&&Jt(l,d.e=f),d.t=gr(l,m,d.t),d},{e:void 0,t:void 0}),l}})}})},C_=(e,t,r)=>{const i=e.slice();return i.splice(r,0,...i.splice(t,1)),i},vh=Rt(),bh=e=>{const[t]=ci(),[r,i]=We({initialIds:[],sortedIds:[]}),n=a=>a>=0&&a<r.initialIds.length;ne(()=>{i("initialIds",[...e.ids]),i("sortedIds",[...e.ids])}),ne(()=>{t.active.draggableId&&t.active.droppableId?kt(()=>{const a=r.sortedIds.indexOf(t.active.draggableId),l=r.initialIds.indexOf(t.active.droppableId);if(!n(a)||!n(l))i("sortedIds",[...e.ids]);else if(a!==l){const u=C_(r.sortedIds,a,l);i("sortedIds",u)}}):i("sortedIds",[...e.ids])});const s=[r,{}];return c(vh.Provider,{value:s,get children(){return e.children}})},I_=()=>jt(vh)||null,T_=(e,t)=>r=>{e(r),t(r)},yh=(e,t={})=>{const[r,{addTransformer:i,removeTransformer:n}]=ci(),[o]=I_(),s=S_(e,t),a=k_(e,t),l=T_(s.ref,a.ref),u=()=>o.initialIds.indexOf(e),d=()=>o.sortedIds.indexOf(e),f=b=>r.droppables[b]?.layout||null,m=()=>{const b=Zn(),v=u(),w=d();if(w!==v){const x=f(e),_=f(o.initialIds[w]);x&&_&&(b.x=_.x-x.x,b.y=_.y-x.y)}return b},h={id:"sortableOffset",order:100,callback:b=>{const v=m();return{x:b.x+v.x,y:b.y+v.y}}};Vt(()=>i("droppables",e,h)),je(()=>n("droppables",e,h.id));const g=()=>(e===r.active.draggableId&&!r.active.overlay?r.draggables[e]?.transform:r.droppables[e]?.transform)||Zn();return Object.defineProperties(b=>{s(b,()=>({skipTransform:!0})),a(b,()=>({skipTransform:!0})),ne(()=>{const v=g();if(Ic(v,Zn()))b.style.removeProperty("transform");else{const w=sa(g());b.style.setProperty("transform",w.transform??null)}})},{ref:{enumerable:!0,value:l},transform:{enumerable:!0,get:g},isActiveDraggable:{enumerable:!0,get:()=>s.isActiveDraggable},dragActivators:{enumerable:!0,get:()=>s.dragActivators},isActiveDroppable:{enumerable:!0,get:()=>a.isActiveDroppable}})};const D_=e=>typeof e!="object"||e===null?!1:"draggable"in e,zs=e=>{if(!D_(e))return;const t=e.draggable;if(t)return typeof t.id=="string"?t.id:void 0},A_=(e,t)=>({id:e,order:100,callback:r=>t==="x"?{...r,x:0}:{...r,y:0}}),P_=(e,t)=>()=>{const r=ci();if(!r)return null;const[,{onDragStart:i,onDragEnd:n,addTransformer:o,removeTransformer:s}]=r,a=A_(t,e),l=wl(u=>(i(d=>{const f=zs(d);f&&o("draggables",f,a)}),n(d=>{const f=zs(d);f&&s("draggables",f,a.id)}),u));return je(l),null},wh=P_("y","constrain-y-axis");function O_(e,t){const r=new ResizeObserver(e);return je(r.disconnect.bind(r)),{observe:i=>r.observe(i,t),unobserve:r.unobserve.bind(r)}}function Ti(e,t,r){const i=new WeakMap,{observe:n,unobserve:o}=O_(s=>{for(const a of s){const{contentRect:l,target:u}=a,d=Math.round(l.width),f=Math.round(l.height),m=i.get(u);(!m||m.width!==d||m.height!==f)&&(t(l,u,a),i.set(u,{width:d,height:f}))}},r);ne(s=>{const a=Mx(zx(Ce(e)));return Lx(a,s,n,o),a},[])}function xh(e){let t=e.startIndex??0;const r=e.startLevel??0,i=[],n=l=>{if(l==null)return"";const u=e.getKey??"key",d=oo(u)?l[u]:u(l);return d!=null?String(d):""},o=l=>{if(l==null)return"";const u=e.getTextValue??"textValue",d=oo(u)?l[u]:u(l);return d!=null?String(d):""},s=l=>{if(l==null)return!1;const u=e.getDisabled??"disabled";return(oo(u)?l[u]:u(l))??!1},a=l=>{if(l!=null)return oo(e.getSectionChildren)?l[e.getSectionChildren]:e.getSectionChildren?.(l)};for(const l of e.dataSource){if(oo(l)||Fx(l)){i.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:s(l),level:r,index:t}),t++;continue}if(a(l)!=null){i.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:r,index:t}),t++;const u=a(l)??[];if(u.length>0){const d=xh({dataSource:u,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:r+1});i.push(...d),t+=d.length}}else i.push({type:"item",rawValue:l,key:n(l),textValue:o(l),disabled:s(l),level:r,index:t}),t++}return i}function E_(e,t=[]){return $(()=>{const r=xh({dataSource:Ce(e.dataSource),getKey:Ce(e.getKey),getTextValue:Ce(e.getTextValue),getDisabled:Ce(e.getDisabled),getSectionChildren:Ce(e.getSectionChildren)});for(let i=0;i<t.length;i++)t[i]();return e.factory(r)})}var nr=class _h extends Set{anchorKey;currentKey;constructor(t,r,i){super(t),t instanceof _h?(this.anchorKey=r||t.anchorKey,this.currentKey=i||t.currentKey):(this.anchorKey=r,this.currentKey=i)}};function M_(e){const[t,r]=ea(e);return[()=>t()??new nr,r]}function $h(e){return Nx()?e.altKey:e.ctrlKey}function xi(e){return Gg()?e.metaKey:e.ctrlKey}function xf(e){return new nr(e)}function Sh(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function z_(e){const t=Ge({selectionMode:"none",selectionBehavior:"toggle"},e),[r,i]=ze(!1),[n,o]=ze(),s=$(()=>{const y=Ce(t.selectedKeys);return y!=null?xf(y):y}),a=$(()=>{const y=Ce(t.defaultSelectedKeys);return y!=null?xf(y):new nr}),[l,u]=M_({value:s,defaultValue:a,onChange:y=>t.onSelectionChange?.(y)}),[d,f]=ze(Ce(t.selectionBehavior)),m=()=>Ce(t.selectionMode),h=()=>Ce(t.disallowEmptySelection)??!1,g=y=>{(Ce(t.allowDuplicateSelectionEvents)||!Sh(y,l()))&&u(y)};return ne(()=>{const y=l();Ce(t.selectionBehavior)==="replace"&&d()==="toggle"&&typeof y=="object"&&y.size===0&&f("replace")}),ne(()=>{f(Ce(t.selectionBehavior)??"toggle")}),{selectionMode:m,disallowEmptySelection:h,selectionBehavior:d,setSelectionBehavior:f,isFocused:r,setFocused:i,focusedKey:n,setFocusedKey:o,selectedKeys:l,setSelectedKeys:g}}function kh(e){const[t,r]=ze(""),[i,n]=ze(-1);return{typeSelectHandlers:{onKeyDown:s=>{if(Ce(e.isDisabled))return;const a=Ce(e.keyboardDelegate),l=Ce(e.selectionManager);if(!a.getKeyForSearch)return;const u=L_(s.key);if(!u||s.ctrlKey||s.metaKey)return;u===" "&&t().trim().length>0&&(s.preventDefault(),s.stopPropagation());let d=r(m=>m+u),f=a.getKeyForSearch(d,l.focusedKey())??a.getKeyForSearch(d);f==null&&F_(d)&&(d=d[0],f=a.getKeyForSearch(d,l.focusedKey())??a.getKeyForSearch(d)),f!=null&&(l.setFocusedKey(f),e.onTypeSelect?.(f)),clearTimeout(i()),n(window.setTimeout(()=>r(""),500))}}}}function L_(e){return e.length===1||!/^[A-Z]/i.test(e)?e:""}function F_(e){return e.split("").every(t=>t===e[0])}function Ch(e,t,r){const n=ie({selectOnFocus:()=>Ce(e.selectionManager).selectionBehavior()==="replace"},e),o=()=>r?.()??t(),{direction:s}=Nr();let a={top:0,left:0};Hg(()=>Ce(n.isVirtualized)?void 0:o(),"scroll",()=>{const b=o();b&&(a={top:b.scrollTop,left:b.scrollLeft})});const{typeSelectHandlers:l}=kh({isDisabled:()=>Ce(n.disallowTypeAhead),keyboardDelegate:()=>Ce(n.keyboardDelegate),selectionManager:()=>Ce(n.selectionManager)}),u=()=>Ce(n.orientation)??"vertical",d=b=>{Qe(b,l.onKeyDown),b.altKey&&b.key==="Tab"&&b.preventDefault();const v=t();if(!v?.contains(b.target))return;const w=Ce(n.selectionManager),x=Ce(n.selectOnFocus),_=z=>{z!=null&&(w.setFocusedKey(z),b.shiftKey&&w.selectionMode()==="multiple"?w.extendSelection(z):x&&!$h(b)&&w.replaceSelection(z))},k=Ce(n.keyboardDelegate),C=Ce(n.shouldFocusWrap),O=w.focusedKey();switch(b.key){case(u()==="vertical"?"ArrowDown":"ArrowRight"):{if(k.getKeyBelow){b.preventDefault();let z;O!=null?z=k.getKeyBelow(O):z=k.getFirstKey?.(),z==null&&C&&(z=k.getFirstKey?.(O)),_(z)}break}case(u()==="vertical"?"ArrowUp":"ArrowLeft"):{if(k.getKeyAbove){b.preventDefault();let z;O!=null?z=k.getKeyAbove(O):z=k.getLastKey?.(),z==null&&C&&(z=k.getLastKey?.(O)),_(z)}break}case(u()==="vertical"?"ArrowLeft":"ArrowUp"):{if(k.getKeyLeftOf){b.preventDefault();const z=s()==="rtl";let K;O!=null?K=k.getKeyLeftOf(O):K=z?k.getFirstKey?.():k.getLastKey?.(),_(K)}break}case(u()==="vertical"?"ArrowRight":"ArrowDown"):{if(k.getKeyRightOf){b.preventDefault();const z=s()==="rtl";let K;O!=null?K=k.getKeyRightOf(O):K=z?k.getLastKey?.():k.getFirstKey?.(),_(K)}break}case"Home":if(k.getFirstKey){b.preventDefault();const z=k.getFirstKey(O,xi(b));z!=null&&(w.setFocusedKey(z),xi(b)&&b.shiftKey&&w.selectionMode()==="multiple"?w.extendSelection(z):x&&w.replaceSelection(z))}break;case"End":if(k.getLastKey){b.preventDefault();const z=k.getLastKey(O,xi(b));z!=null&&(w.setFocusedKey(z),xi(b)&&b.shiftKey&&w.selectionMode()==="multiple"?w.extendSelection(z):x&&w.replaceSelection(z))}break;case"PageDown":if(k.getKeyPageBelow&&O!=null){b.preventDefault();const z=k.getKeyPageBelow(O);_(z)}break;case"PageUp":if(k.getKeyPageAbove&&O!=null){b.preventDefault();const z=k.getKeyPageAbove(O);_(z)}break;case"a":xi(b)&&w.selectionMode()==="multiple"&&Ce(n.disallowSelectAll)!==!0&&(b.preventDefault(),w.selectAll());break;case"Escape":b.defaultPrevented||(b.preventDefault(),Ce(n.disallowEmptySelection)||w.clearSelection());break;case"Tab":if(!Ce(n.allowsTabNavigation)){if(b.shiftKey)v.focus();else{const z=qg(v,{tabbable:!0});let K,J;do J=z.lastChild(),J&&(K=J);while(J);K&&!K.contains(document.activeElement)&&vn(K)}break}}},f=b=>{const v=Ce(n.selectionManager),w=Ce(n.keyboardDelegate),x=Ce(n.selectOnFocus);if(v.isFocused()){b.currentTarget.contains(b.target)||v.setFocused(!1);return}if(b.currentTarget.contains(b.target)){if(v.setFocused(!0),v.focusedKey()==null){const _=C=>{C!=null&&(v.setFocusedKey(C),x&&v.replaceSelection(C))},k=b.relatedTarget;k&&b.currentTarget.compareDocumentPosition(k)&Node.DOCUMENT_POSITION_FOLLOWING?_(v.lastSelectedKey()??w.getLastKey?.()):_(v.firstSelectedKey()??w.getFirstKey?.())}else if(!Ce(n.isVirtualized)){const _=o();if(_){_.scrollTop=a.top,_.scrollLeft=a.left;const k=_.querySelector(`[data-key="${v.focusedKey()}"]`);k&&(vn(k),gf(_,k))}}}},m=b=>{const v=Ce(n.selectionManager);b.currentTarget.contains(b.relatedTarget)||v.setFocused(!1)},h=b=>{o()===b.target&&b.preventDefault()},g=()=>{const b=Ce(n.autoFocus);if(!b)return;const v=Ce(n.selectionManager),w=Ce(n.keyboardDelegate);let x;b==="first"&&(x=w.getFirstKey?.()),b==="last"&&(x=w.getLastKey?.());const _=v.selectedKeys();_.size&&(x=_.values().next().value),v.setFocused(!0),v.setFocusedKey(x);const k=t();k&&x==null&&!Ce(n.shouldUseVirtualFocus)&&vn(k)};return Vt(()=>{n.deferAutoFocus?setTimeout(g,0):g()}),ne(qe([o,()=>Ce(n.isVirtualized),()=>Ce(n.selectionManager).focusedKey()],b=>{const[v,w,x]=b;if(w)x&&n.scrollToKey?.(x);else if(x&&v){const _=v.querySelector(`[data-key="${x}"]`);_&&gf(v,_)}})),{tabIndex:$(()=>{if(!Ce(n.shouldUseVirtualFocus))return Ce(n.selectionManager).focusedKey()==null?0:-1}),onKeyDown:d,onMouseDown:h,onFocusIn:f,onFocusOut:m}}function Vo(e,t){const r=()=>Ce(e.selectionManager),i=()=>Ce(e.key),n=()=>Ce(e.shouldUseVirtualFocus),o=w=>{r().selectionMode()!=="none"&&(r().selectionMode()==="single"?r().isSelected(i())&&!r().disallowEmptySelection()?r().toggleSelection(i()):r().replaceSelection(i()):w?.shiftKey?r().extendSelection(i()):r().selectionBehavior()==="toggle"||xi(w)||"pointerType"in w&&w.pointerType==="touch"?r().toggleSelection(i()):r().replaceSelection(i()))},s=()=>r().isSelected(i()),a=()=>Ce(e.disabled)||r().isDisabled(i()),l=()=>!a()&&r().canSelectItem(i());let u=null;const d=w=>{l()&&(u=w.pointerType,w.pointerType==="mouse"&&w.button===0&&!Ce(e.shouldSelectOnPressUp)&&o(w))},f=w=>{l()&&w.pointerType==="mouse"&&w.button===0&&Ce(e.shouldSelectOnPressUp)&&Ce(e.allowsDifferentPressOrigin)&&o(w)},m=w=>{l()&&(Ce(e.shouldSelectOnPressUp)&&!Ce(e.allowsDifferentPressOrigin)||u!=="mouse")&&o(w)},h=w=>{!l()||!["Enter"," "].includes(w.key)||($h(w)?r().toggleSelection(i()):o(w))},g=w=>{a()&&w.preventDefault()},y=w=>{const x=t();n()||a()||!x||w.target===x&&r().setFocusedKey(i())},b=$(()=>{if(!(n()||a()))return i()===r().focusedKey()?0:-1}),v=$(()=>Ce(e.virtualized)?void 0:i());return ne(qe([t,i,n,()=>r().focusedKey(),()=>r().isFocused()],([w,x,_,k,C])=>{w&&x===k&&C&&!_&&document.activeElement!==w&&(e.focus?e.focus():vn(w))})),{isSelected:s,isDisabled:a,allowsSelection:l,tabIndex:b,dataKey:v,onPointerDown:d,onPointerUp:f,onClick:m,onKeyDown:h,onMouseDown:g,onFocus:y}}var N_=class{collection;state;constructor(e,t){this.collection=e,this.state=t}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}isFocused(){return this.state.isFocused()}setFocused(e){this.state.setFocused(e)}focusedKey(){return this.state.focusedKey()}setFocusedKey(e){(e==null||this.collection().getItem(e))&&this.state.setFocusedKey(e)}selectedKeys(){return this.state.selectedKeys()}isSelected(e){if(this.state.selectionMode()==="none")return!1;const t=this.getKey(e);return t==null?!1:this.state.selectedKeys().has(t)}isEmpty(){return this.state.selectedKeys().size===0}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every(t=>e.has(t))}firstSelectedKey(){let e;for(const t of this.state.selectedKeys()){const r=this.collection().getItem(t),i=r?.index!=null&&e?.index!=null&&r.index<e.index;(!e||i)&&(e=r)}return e?.key}lastSelectedKey(){let e;for(const t of this.state.selectedKeys()){const r=this.collection().getItem(t),i=r?.index!=null&&e?.index!=null&&r.index>e.index;(!e||i)&&(e=r)}return e?.key}extendSelection(e){if(this.selectionMode()==="none")return;if(this.selectionMode()==="single"){this.replaceSelection(e);return}const t=this.getKey(e);if(t==null)return;const r=this.state.selectedKeys(),i=r.anchorKey||t,n=new nr(r,i,t);for(const o of this.getKeyRange(i,r.currentKey||t))n.delete(o);for(const o of this.getKeyRange(t,i))this.canSelectItem(o)&&n.add(o);this.state.setSelectedKeys(n)}getKeyRange(e,t){const r=this.collection().getItem(e),i=this.collection().getItem(t);return r&&i?r.index!=null&&i.index!=null&&r.index<=i.index?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){const r=[];let i=e;for(;i!=null;){const n=this.collection().getItem(i);if(n&&n.type==="item"&&r.push(i),i===t)return r;i=this.collection().getKeyAfter(i)}return[]}getKey(e){const t=this.collection().getItem(e);return t?!t||t.type!=="item"?null:t.key:e}toggleSelection(e){if(this.selectionMode()==="none")return;if(this.selectionMode()==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}const t=this.getKey(e);if(t==null)return;const r=new nr(this.state.selectedKeys());r.has(t)?r.delete(t):this.canSelectItem(t)&&(r.add(t),r.anchorKey=t,r.currentKey=t),!(this.disallowEmptySelection()&&r.size===0)&&this.state.setSelectedKeys(r)}replaceSelection(e){if(this.selectionMode()==="none")return;const t=this.getKey(e);if(t==null)return;const r=this.canSelectItem(t)?new nr([t],t,t):new nr;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode()==="none")return;const t=new nr;for(const r of e){const i=this.getKey(r);if(i!=null&&(t.add(i),this.selectionMode()==="single"))break}this.state.setSelectedKeys(t)}selectAll(){this.selectionMode()==="multiple"&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){const e=this.state.selectedKeys();!this.disallowEmptySelection()&&e.size>0&&this.state.setSelectedKeys(new nr)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,t){this.selectionMode()!=="none"&&(this.selectionMode()==="single"?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior()==="toggle"||t&&t.pointerType==="touch"?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const t=this.selectedKeys();if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;for(const r of t)if(!e.has(r))return!1;return!0}canSelectItem(e){if(this.state.selectionMode()==="none")return!1;const t=this.collection().getItem(e);return t!=null&&!t.disabled}isDisabled(e){const t=this.collection().getItem(e);return!t||t.disabled}getAllSelectableKeys(){const e=[];return(r=>{for(;r!=null;){if(this.canSelectItem(r)){const i=this.collection().getItem(r);if(!i)continue;i.type==="item"&&e.push(r)}r=this.collection().getKeyAfter(r)}})(this.collection().getFirstKey()),e}},_f=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const i of e)this.keyMap.set(i.key,i);if(this.keyMap.size===0)return;let t,r=0;for(const[i,n]of this.keyMap)t?(t.nextKey=i,n.prevKey=t.key):(this.firstKey=i,n.prevKey=void 0),n.type==="item"&&(n.index=r++),t=n,t.nextKey=void 0;this.lastKey=t.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey}getKeyAfter(e){return this.keyMap.get(e)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const t=[...this.getKeys()];return this.getItem(t[e])}};function Bo(e){const t=z_(e),i=E_({dataSource:()=>Ce(e.dataSource),getKey:()=>Ce(e.getKey),getTextValue:()=>Ce(e.getTextValue),getDisabled:()=>Ce(e.getDisabled),getSectionChildren:()=>Ce(e.getSectionChildren),factory:o=>e.filter?new _f(e.filter(o)):new _f(o)},[()=>e.filter]),n=new N_(i,t);return xl(()=>{const o=t.focusedKey();o!=null&&!i().getItem(o)&&t.setFocusedKey(void 0)}),{collection:i,selectionManager:()=>n}}var R_=I("<option>"),j_=I("<div aria-hidden=true><input type=text style=font-size:16px><select tabindex=-1><option>");function U_(e){let t;const[r,i]=$e(e,["ref","onChange","collection","selectionManager","isOpen","isMultiple","isVirtualized","focusTrigger"]),n=Rr(),[o,s]=ze(!1),a=l=>{const u=r.collection.getItem(l);return c(F,{get when(){return u?.type==="item"},get children(){var d=R_();return d.value=l,p(d,()=>u?.textValue),Ae(()=>d.selected=r.selectionManager.isSelected(l)),d}})};return ne(qe(()=>r.selectionManager.selectedKeys(),(l,u)=>{u&&Sh(l,u)||(s(!0),t?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})))},{defer:!0})),(()=>{var l=j_(),u=l.firstChild,d=u.nextSibling;d.firstChild,u.addEventListener("focus",()=>r.focusTrigger()),d.addEventListener("change",m=>{Qe(m,r.onChange),o()||r.selectionManager.setSelectedKeys(new Set([m.target.value])),s(!1)});var f=xt(m=>t=m,r.ref);return typeof f=="function"&&ut(f,d),dn(d,ie({get multiple(){return r.isMultiple},get name(){return n.name()},get required(){return n.isRequired()},get disabled(){return n.isDisabled()},get size(){return r.collection.getSize()},get value(){return r.selectionManager.firstSelectedKey()??""}},i),!1,!0),p(d,c(F,{get when(){return r.isVirtualized},get fallback(){return c(rt,{get each(){return[...r.collection.getKeys()]},children:a})},get children(){return c(rt,{get each(){return[...r.selectionManager.selectedKeys()]},children:a})}}),null),Ae(m=>{var h=cc,g=r.selectionManager.isFocused()||r.isOpen?-1:0,y=n.isRequired(),b=n.isDisabled(),v=n.isReadOnly();return m.e=gr(l,h,m.e),g!==m.t&&Ie(u,"tabindex",m.t=g),y!==m.a&&(u.required=m.a=y),b!==m.o&&(u.disabled=m.o=b),v!==m.i&&(u.readOnly=m.i=v),m},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),l})()}var $f=new WeakMap;function K_(e){let t=$f.get(e);if(t!=null)return t;t=0;for(const r of e)r.type==="item"&&t++;return $f.set(e,t),t}var Ih=class{collection;ref;collator;constructor(e,t,r){this.collection=e,this.ref=t,this.collator=r}getKeyBelow(e){let t=this.collection().getKeyAfter(e);for(;t!=null;){const r=this.collection().getItem(t);if(r&&r.type==="item"&&!r.disabled)return t;t=this.collection().getKeyAfter(t)}}getKeyAbove(e){let t=this.collection().getKeyBefore(e);for(;t!=null;){const r=this.collection().getItem(t);if(r&&r.type==="item"&&!r.disabled)return t;t=this.collection().getKeyBefore(t)}}getFirstKey(){let e=this.collection().getFirstKey();for(;e!=null;){const t=this.collection().getItem(e);if(t&&t.type==="item"&&!t.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;e!=null;){const t=this.collection().getItem(e);if(t&&t.type==="item"&&!t.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const t=this.ref?.();let r=this.getItem(e);if(!t||!r)return;const i=Math.max(0,r.offsetTop+r.offsetHeight-t.offsetHeight);let n=e;for(;n&&r&&r.offsetTop>i;)n=this.getKeyAbove(n),r=n!=null?this.getItem(n):null;return n}getKeyPageBelow(e){const t=this.ref?.();let r=this.getItem(e);if(!t||!r)return;const i=Math.min(t.scrollHeight,r.offsetTop-r.offsetHeight+t.offsetHeight);let n=e;for(;n&&r&&r.offsetTop<i;)n=this.getKeyBelow(n),r=n!=null?this.getItem(n):null;return n}getKeyForSearch(e,t){const r=this.collator?.();if(!r)return;let i=t!=null?this.getKeyBelow(t):this.getFirstKey();for(;i!=null;){const n=this.collection().getItem(i);if(n){const o=n.textValue.slice(0,e.length);if(n.textValue&&r.compare(o,e)===0)return i}i=this.getKeyBelow(i)}}};function Tc(e,t,r){const i=Wg({usage:"search",sensitivity:"base"}),n=$(()=>{const o=Ce(e.keyboardDelegate);return o||new Ih(e.collection,t,i)});return Ch({selectionManager:()=>Ce(e.selectionManager),keyboardDelegate:n,autoFocus:()=>Ce(e.autoFocus),deferAutoFocus:()=>Ce(e.deferAutoFocus),shouldFocusWrap:()=>Ce(e.shouldFocusWrap),disallowEmptySelection:()=>Ce(e.disallowEmptySelection),selectOnFocus:()=>Ce(e.selectOnFocus),disallowTypeAhead:()=>Ce(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Ce(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Ce(e.allowsTabNavigation),isVirtualized:()=>Ce(e.isVirtualized),scrollToKey:o=>Ce(e.scrollToKey)?.(o),orientation:()=>Ce(e.orientation)},t,r)}var V_={};ir(V_,{Item:()=>aa,ItemDescription:()=>la,ItemIndicator:()=>ca,ItemLabel:()=>ua,Listbox:()=>B_,Root:()=>Ac,Section:()=>da,useListboxContext:()=>Dh});var Th=Rt();function Dh(){const e=jt(Th);if(e===void 0)throw new Error("[kobalte]: `useListboxContext` must be used within a `Listbox` component");return e}var Ah=Rt();function Dc(){const e=jt(Ah);if(e===void 0)throw new Error("[kobalte]: `useListboxItemContext` must be used within a `Listbox.Item` component");return e}function aa(e){let t;const r=Dh(),i=`${r.generateId("item")}-${nn()}`,n=Ge({id:i},e),[o,s]=$e(n,["ref","item","aria-label","aria-labelledby","aria-describedby","onPointerMove","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[a,l]=ze(),[u,d]=ze(),f=()=>r.listState().selectionManager(),m=()=>f().focusedKey()===o.item.key,h=Vo({key:()=>o.item.key,selectionManager:f,shouldSelectOnPressUp:r.shouldSelectOnPressUp,allowsDifferentPressOrigin:()=>r.shouldSelectOnPressUp()&&r.shouldFocusOnHover(),shouldUseVirtualFocus:r.shouldUseVirtualFocus,disabled:()=>o.item.disabled},()=>t),g=()=>{if(f().selectionMode()!=="none")return h.isSelected()},y=$(()=>!(Gg()&&Xg())),b=()=>y()?o["aria-label"]:void 0,v=()=>y()?a():void 0,w=()=>y()?u():void 0,x=()=>{if(!r.isVirtualized())return;const z=r.listState().collection().getItem(o.item.key)?.index;return z!=null?z+1:void 0},_=()=>{if(r.isVirtualized())return K_(r.listState().collection())},k=z=>{Qe(z,o.onPointerMove),z.pointerType==="mouse"&&!h.isDisabled()&&r.shouldFocusOnHover()&&(vn(z.currentTarget),f().setFocused(!0),f().setFocusedKey(o.item.key))},C=$(()=>({"data-disabled":h.isDisabled()?"":void 0,"data-selected":h.isSelected()?"":void 0,"data-highlighted":m()?"":void 0})),O={isSelected:h.isSelected,dataset:C,generateId:Nn(()=>s.id),registerLabelId:tn(l),registerDescriptionId:tn(d)};return c(Ah.Provider,{value:O,get children(){return c(it,ie({as:"li",ref(z){var K=xt(J=>t=J,o.ref);typeof K=="function"&&K(z)},role:"option",get tabIndex(){return h.tabIndex()},get"aria-disabled"(){return h.isDisabled()},get"aria-selected"(){return g()},get"aria-label"(){return b()},get"aria-labelledby"(){return v()},get"aria-describedby"(){return w()},get"aria-posinset"(){return x()},get"aria-setsize"(){return _()},get"data-key"(){return h.dataKey()},get onPointerDown(){return et([o.onPointerDown,h.onPointerDown])},get onPointerUp(){return et([o.onPointerUp,h.onPointerUp])},get onClick(){return et([o.onClick,h.onClick])},get onKeyDown(){return et([o.onKeyDown,h.onKeyDown])},get onMouseDown(){return et([o.onMouseDown,h.onMouseDown])},get onFocus(){return et([o.onFocus,h.onFocus])},onPointerMove:k},C,s))}})}function la(e){const t=Dc(),r=Ge({id:t.generateId("description")},e);return ne(()=>je(t.registerDescriptionId(r.id))),c(it,ie({as:"div"},()=>t.dataset(),r))}function ca(e){const t=Dc(),r=Ge({id:t.generateId("indicator")},e),[i,n]=$e(r,["forceMount"]);return c(F,{get when(){return i.forceMount||t.isSelected()},get children(){return c(it,ie({as:"div","aria-hidden":"true"},()=>t.dataset(),n))}})}function ua(e){const t=Dc(),r=Ge({id:t.generateId("label")},e);return ne(()=>je(t.registerLabelId(r.id))),c(it,ie({as:"div"},()=>t.dataset(),r))}function Ac(e){let t;const r=`listbox-${nn()}`,i=Ge({id:r,selectionMode:"single",virtualized:!1},e),[n,o]=$e(i,["ref","children","renderItem","renderSection","value","defaultValue","onChange","options","optionValue","optionTextValue","optionDisabled","optionGroupChildren","state","keyboardDelegate","autoFocus","selectionMode","shouldFocusWrap","shouldUseVirtualFocus","shouldSelectOnPressUp","shouldFocusOnHover","allowDuplicateSelectionEvents","disallowEmptySelection","selectionBehavior","selectOnFocus","disallowTypeAhead","allowsTabNavigation","virtualized","scrollToItem","scrollRef","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),s=$(()=>n.state?n.state:Bo({selectedKeys:()=>n.value,defaultSelectedKeys:()=>n.defaultValue,onSelectionChange:n.onChange,allowDuplicateSelectionEvents:()=>Ce(n.allowDuplicateSelectionEvents),disallowEmptySelection:()=>Ce(n.disallowEmptySelection),selectionBehavior:()=>Ce(n.selectionBehavior),selectionMode:()=>Ce(n.selectionMode),dataSource:()=>n.options??[],getKey:()=>n.optionValue,getTextValue:()=>n.optionTextValue,getDisabled:()=>n.optionDisabled,getSectionChildren:()=>n.optionGroupChildren})),a=Tc({selectionManager:()=>s().selectionManager(),collection:()=>s().collection(),autoFocus:()=>Ce(n.autoFocus),shouldFocusWrap:()=>Ce(n.shouldFocusWrap),keyboardDelegate:()=>n.keyboardDelegate,disallowEmptySelection:()=>Ce(n.disallowEmptySelection),selectOnFocus:()=>Ce(n.selectOnFocus),disallowTypeAhead:()=>Ce(n.disallowTypeAhead),shouldUseVirtualFocus:()=>Ce(n.shouldUseVirtualFocus),allowsTabNavigation:()=>Ce(n.allowsTabNavigation),isVirtualized:()=>n.virtualized,scrollToKey:()=>n.scrollToItem},()=>t,()=>n.scrollRef?.()),l={listState:s,generateId:Nn(()=>o.id),shouldUseVirtualFocus:()=>i.shouldUseVirtualFocus,shouldSelectOnPressUp:()=>i.shouldSelectOnPressUp,shouldFocusOnHover:()=>i.shouldFocusOnHover,isVirtualized:()=>n.virtualized};return c(Th.Provider,{value:l,get children(){return c(it,ie({as:"ul",ref(u){var d=xt(f=>t=f,n.ref);typeof d=="function"&&d(u)},role:"listbox",get tabIndex(){return a.tabIndex()},get"aria-multiselectable"(){return s().selectionManager().selectionMode()==="multiple"?!0:void 0},get onKeyDown(){return et([n.onKeyDown,a.onKeyDown])},get onMouseDown(){return et([n.onMouseDown,a.onMouseDown])},get onFocusIn(){return et([n.onFocusIn,a.onFocusIn])},get onFocusOut(){return et([n.onFocusOut,a.onFocusOut])}},o,{get children(){return c(F,{get when(){return!n.virtualized},get fallback(){return n.children?.(s().collection)},get children(){return c(v_,{get each(){return[...s().collection()]},by:"key",children:u=>c(Gt,{get children(){return[c(Xe,{get when(){return u().type==="section"},get children(){return n.renderSection?.(u())}}),c(Xe,{get when(){return u().type==="item"},get children(){return n.renderItem?.(u())}})]}})})}})}}))}})}function da(e){return c(it,ie({as:"li",role:"presentation"},e))}var B_=Object.assign(Ac,{Item:aa,ItemDescription:la,ItemIndicator:ca,ItemLabel:ua,Section:da}),Z_={};ir(Z_,{Arrow:()=>Fi,Content:()=>Oh,Description:()=>Li,ErrorMessage:()=>zi,HiddenSelect:()=>Eh,Icon:()=>Mh,Item:()=>aa,ItemDescription:()=>la,ItemIndicator:()=>ca,ItemLabel:()=>ua,Label:()=>zh,Listbox:()=>Lh,Portal:()=>Fh,Root:()=>Nh,Section:()=>da,Select:()=>zn,Trigger:()=>Rh,Value:()=>jh,useSelectContext:()=>wr});var Ph=Rt();function wr(){const e=jt(Ph);if(e===void 0)throw new Error("[kobalte]: `useSelectContext` must be used within a `Select` component");return e}function Oh(e){let t;const r=wr(),[i,n]=$e(e,["ref","style","onCloseAutoFocus","onFocusOutside"]),o=a=>{r.close()},s=a=>{i.onFocusOutside?.(a),r.isOpen()&&r.isModal()&&a.preventDefault()};return dc({isDisabled:()=>!(r.isOpen()&&r.isModal()),targets:()=>t?[t]:[]}),fc({element:()=>t??null,enabled:()=>r.contentPresent()&&r.preventScroll()}),mc({trapFocus:()=>r.isOpen()&&r.isModal(),onMountAutoFocus:a=>{a.preventDefault()},onUnmountAutoFocus:a=>{i.onCloseAutoFocus?.(a),a.defaultPrevented||(vn(r.triggerRef()),a.preventDefault())}},()=>t),c(F,{get when(){return r.contentPresent()},get children(){return c(Ni.Positioner,{get children(){return c(gc,ie({ref(a){var l=xt(u=>{r.setContentRef(u),t=u},i.ref);typeof l=="function"&&l(a)},get disableOutsidePointerEvents(){return Te(()=>!!r.isModal())()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},get style(){return vr({"--kb-select-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},i.style)},onEscapeKeyDown:o,onFocusOutside:s,get onDismiss(){return r.close}},()=>r.dataset(),n))}})}})}function Eh(e){const t=wr();return c(U_,ie({get collection(){return t.listState().collection()},get selectionManager(){return t.listState().selectionManager()},get isOpen(){return t.isOpen()},get isMultiple(){return t.isMultiple()},get isVirtualized(){return t.isVirtualized()},focusTrigger:()=>t.triggerRef()?.focus()},e))}function Mh(e){const t=wr(),r=Ge({children:"▼"},e);return c(it,ie({as:"span","aria-hidden":"true"},()=>t.dataset(),r))}function zh(e){const t=wr(),[r,i]=$e(e,["onClick"]);return c(uc,ie({as:"span",onClick:o=>{Qe(o,r.onClick),t.isDisabled()||t.triggerRef()?.focus()}},i))}function Lh(e){const t=wr(),r=Ge({id:t.generateId("listbox")},e),[i,n]=$e(r,["ref","id","onKeyDown"]);return ne(()=>je(t.registerListboxId(i.id))),c(Ac,ie({ref(s){var a=xt(t.setListboxRef,i.ref);typeof a=="function"&&a(s)},get id(){return i.id},get state(){return t.listState()},get virtualized(){return t.isVirtualized()},get autoFocus(){return t.autoFocus()},shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,get shouldFocusWrap(){return t.shouldFocusWrap()},get disallowTypeAhead(){return t.disallowTypeAhead()},get"aria-labelledby"(){return t.listboxAriaLabelledBy()},get renderItem(){return t.renderItem},get renderSection(){return t.renderSection},onKeyDown:s=>{Qe(s,i.onKeyDown),s.key==="Escape"&&s.preventDefault()}},n))}function Fh(e){const t=wr();return c(F,{get when(){return t.contentPresent()},get children(){return c(hr,e)}})}function H_(e){const t=`select-${nn()}`,r=Ge({id:t,selectionMode:"single",disallowEmptySelection:!1,closeOnSelection:e.selectionMode==="single",allowDuplicateSelectionEvents:!0,gutter:8,sameWidth:!0,modal:!1},e),[i,n,o,s]=$e(r,["itemComponent","sectionComponent","open","defaultOpen","onOpenChange","value","defaultValue","onChange","placeholder","options","optionValue","optionTextValue","optionDisabled","optionGroupChildren","keyboardDelegate","allowDuplicateSelectionEvents","disallowEmptySelection","closeOnSelection","disallowTypeAhead","shouldFocusWrap","selectionBehavior","selectionMode","virtualized","modal","preventScroll","forceMount"],["getAnchorRect","placement","gutter","shift","flip","slide","overlap","sameWidth","fitViewport","hideWhenDetached","detachedPadding","arrowPadding","overflowPadding"],hc),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),[h,g]=ze(),[y,b]=ze(),[v,w]=ze(),[x,_]=ze(),[k,C]=ze(!0),O=H=>{const Z=i.optionValue;return Z==null?String(H):String(bc(Z)?Z(H):H[Z])},z=$(()=>{const H=i.optionGroupChildren;return H==null?i.options:i.options.flatMap(Z=>Z[H]??Z)}),K=$(()=>z().map(H=>O(H))),J=H=>[...H].map(Z=>z().find(se=>O(se)===Z)).filter(Z=>Z!=null),T=jo({open:()=>i.open,defaultOpen:()=>i.defaultOpen,onOpenChange:H=>i.onOpenChange?.(H)}),M=Bo({selectedKeys:()=>i.value!=null?i.value.map(O):i.value,defaultSelectedKeys:()=>i.defaultValue!=null?i.defaultValue.map(O):i.defaultValue,onSelectionChange:H=>{i.onChange?.(J(H)),i.closeOnSelection&&R()},allowDuplicateSelectionEvents:()=>Ce(i.allowDuplicateSelectionEvents),disallowEmptySelection:()=>Ce(i.disallowEmptySelection),selectionBehavior:()=>Ce(i.selectionBehavior),selectionMode:()=>i.selectionMode,dataSource:()=>i.options??[],getKey:()=>i.optionValue,getTextValue:()=>i.optionTextValue,getDisabled:()=>i.optionDisabled,getSectionChildren:()=>i.optionGroupChildren}),U=$(()=>J(M.selectionManager().selectedKeys())),A=H=>{M.selectionManager().toggleSelection(O(H))},{present:j}=li({show:()=>i.forceMount||T.isOpen(),element:()=>y()??null}),P=()=>{const H=v();H&&vn(H)},B=H=>{if(i.options.length<=0)return;C(H),T.open();let Z=M.selectionManager().firstSelectedKey();Z==null&&(H==="first"?Z=M.collection().getFirstKey():H==="last"&&(Z=M.collection().getLastKey())),P(),M.selectionManager().setFocused(!0),M.selectionManager().setFocusedKey(Z)},R=()=>{T.close(),M.selectionManager().setFocused(!1),M.selectionManager().setFocusedKey(void 0)},V=H=>{T.isOpen()?R():B(H)},{formControlContext:Q}=pc(o);ta(h,()=>{const H=i.defaultValue?[...i.defaultValue].map(O):new nr;M.selectionManager().setSelectedKeys(H)});const ee=Wg({usage:"search",sensitivity:"base"}),oe=$(()=>{const H=Ce(i.keyboardDelegate);return H||new Ih(M.collection,void 0,ee)}),le=H=>i.itemComponent?.({item:H}),W=H=>i.sectionComponent?.({section:H});ne(qe([K],([H])=>{const se=[...M.selectionManager().selectedKeys()].filter(re=>H.includes(re));M.selectionManager().setSelectedKeys(se)},{defer:!0}));const D=$(()=>({"data-expanded":T.isOpen()?"":void 0,"data-closed":T.isOpen()?void 0:""})),te={dataset:D,isOpen:T.isOpen,isDisabled:()=>Q.isDisabled()??!1,isMultiple:()=>Ce(i.selectionMode)==="multiple",isVirtualized:()=>i.virtualized??!1,isModal:()=>i.modal??!1,preventScroll:()=>i.preventScroll??te.isModal(),disallowTypeAhead:()=>i.disallowTypeAhead??!1,shouldFocusWrap:()=>i.shouldFocusWrap??!1,selectedOptions:U,contentPresent:j,autoFocus:k,triggerRef:h,listState:()=>M,keyboardDelegate:oe,triggerId:a,valueId:u,listboxId:f,listboxAriaLabelledBy:x,setListboxAriaLabelledBy:_,setTriggerRef:g,setContentRef:b,setListboxRef:w,open:B,close:R,toggle:V,placeholder:()=>i.placeholder,renderItem:le,renderSection:W,removeOptionFromSelection:A,generateId:Nn(()=>Ce(o.id)),registerTriggerId:tn(l),registerValueId:tn(d),registerListboxId:tn(m)};return c(vc.Provider,{value:Q,get children(){return c(Ph.Provider,{value:te,get children(){return c(Ni,ie({anchorRef:h,contentRef:y},n,{get children(){return c(it,ie({as:"div",role:"group",get id(){return Ce(o.id)}},()=>Q.dataset(),D,s))}}))}})}})}function Nh(e){const[t,r]=$e(e,["value","defaultValue","onChange","multiple"]),i=$(()=>t.value!=null?t.multiple?t.value:[t.value]:t.value),n=$(()=>t.defaultValue!=null?t.multiple?t.defaultValue:[t.defaultValue]:t.defaultValue);return c(H_,ie({get value(){return i()},get defaultValue(){return n()},onChange:s=>{t.multiple?t.onChange?.(s??[]):t.onChange?.(s[0]??null)},get selectionMode(){return t.multiple?"multiple":"single"}},r))}function Rh(e){const t=Rr(),r=wr(),i=Ge({id:r.generateId("trigger")},e),[n,o,s]=$e(i,["ref","disabled","onPointerDown","onClick","onKeyDown","onFocus","onBlur"],Yg),a=()=>r.listState().selectionManager(),l=()=>r.keyboardDelegate(),u=()=>n.disabled||r.isDisabled(),{fieldProps:d}=Jg(o),{typeSelectHandlers:f}=kh({keyboardDelegate:l,selectionManager:a,onTypeSelect:w=>a().select(w)}),m=()=>[r.listboxAriaLabelledBy(),r.valueId()].filter(Boolean).join(" ")||void 0,h=w=>{Qe(w,n.onPointerDown),w.currentTarget.dataset.pointerType=w.pointerType,!u()&&w.pointerType!=="touch"&&w.button===0&&(w.preventDefault(),r.toggle(!0))},g=w=>{Qe(w,n.onClick),!u()&&w.currentTarget.dataset.pointerType==="touch"&&r.toggle(!0)},y=w=>{if(Qe(w,n.onKeyDown),!u())switch(Qe(w,f.onKeyDown),w.key){case"Enter":case" ":case"ArrowDown":w.stopPropagation(),w.preventDefault(),r.toggle("first");break;case"ArrowUp":w.stopPropagation(),w.preventDefault(),r.toggle("last");break;case"ArrowLeft":{if(w.preventDefault(),r.isMultiple())return;const x=a().firstSelectedKey(),_=x!=null?l().getKeyAbove?.(x):l().getFirstKey?.();_!=null&&a().select(_);break}case"ArrowRight":{if(w.preventDefault(),r.isMultiple())return;const x=a().firstSelectedKey(),_=x!=null?l().getKeyBelow?.(x):l().getFirstKey?.();_!=null&&a().select(_);break}}},b=w=>{Qe(w,n.onFocus),!a().isFocused()&&a().setFocused(!0)},v=w=>{Qe(w,n.onBlur),!r.isOpen()&&a().setFocused(!1)};return ne(()=>je(r.registerTriggerId(d.id()))),ne(()=>{r.setListboxAriaLabelledBy([d.ariaLabelledBy(),d.ariaLabel()&&!d.ariaLabelledBy()?d.id():null].filter(Boolean).join(" ")||void 0)}),c(Ro,ie({ref(w){var x=xt(r.setTriggerRef,n.ref);typeof x=="function"&&x(w)},get id(){return d.id()},get disabled(){return u()},"aria-haspopup":"listbox",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return Te(()=>!!r.isOpen())()?r.listboxId():void 0},get"aria-label"(){return d.ariaLabel()},get"aria-labelledby"(){return m()},get"aria-describedby"(){return d.ariaDescribedBy()},onPointerDown:h,onClick:g,onKeyDown:y,onFocus:b,onBlur:v},()=>r.dataset(),()=>t.dataset(),s))}function jh(e){const t=Rr(),r=wr(),i=Ge({id:r.generateId("value")},e),[n,o]=$e(i,["id","children"]),s=()=>r.listState().selectionManager(),a=()=>{const l=s().selectedKeys();return l.size===1&&l.has("")?!0:s().isEmpty()};return ne(()=>je(r.registerValueId(n.id))),c(it,ie({as:"span",get id(){return n.id},get"data-placeholder-shown"(){return a()?"":void 0}},()=>t.dataset(),o,{get children(){return c(F,{get when(){return!a()},get fallback(){return r.placeholder()},get children(){return c(q_,{state:{selectedOption:()=>r.selectedOptions()[0],selectedOptions:()=>r.selectedOptions(),remove:l=>r.removeOptionFromSelection(l),clear:()=>s().clearSelection()},get children(){return n.children}})}})}}))}function q_(e){const t=Qg(()=>{const r=e.children;return bc(r)?r(e.state):r});return Te(t)}var zn=Object.assign(Nh,{Arrow:Fi,Content:Oh,Description:Li,ErrorMessage:zi,HiddenSelect:Eh,Icon:Mh,Item:aa,ItemDescription:la,ItemIndicator:ca,ItemLabel:ua,Label:zh,Listbox:Lh,Portal:Fh,Section:da,Trigger:Rh,Value:jh});function G_(e,t,r){let i=n=>e(n,...t);return r===void 0?i:Object.assign(i,{lazy:r,lazyArgs:t})}function fa(e,t,r){let i=e.length-t.length;if(i===0)return e(...t);if(i===1)return G_(e,t,r);throw new Error("Wrong number of arguments")}var W_={done:!1,hasNext:!1};function kl(e,...t){let r=e,i=t.map(o=>"lazy"in o?X_(o):void 0),n=0;for(;n<t.length;){if(i[n]===void 0||!Y_(r)){let l=t[n];r=l(r),n+=1;continue}let o=[];for(let l=n;l<t.length;l++){let u=i[l];if(u===void 0||(o.push(u),u.isSingle))break}let s=[];for(let l of r)if(Uh(l,s,o))break;let{isSingle:a}=o.at(-1);r=a?s[0]:s,n+=o.length}return r}function Uh(e,t,r){if(r.length===0)return t.push(e),!1;let i=e,n=W_,o=!1;for(let[s,a]of r.entries()){let{index:l,items:u}=a;if(u.push(i),n=a(i,l,u),a.index+=1,n.hasNext){if(n.hasMany??!1){for(let d of n.next)if(Uh(d,t,r.slice(s+1)))return!0;return o}i=n.next}if(!n.hasNext)break;n.done&&(o=!0)}return n.hasNext&&t.push(i),o}function X_(e){let{lazy:t,lazyArgs:r}=e,i=t(...r);return Object.assign(i,{isSingle:t.single??!1,index:0,items:[]})}function Y_(e){return typeof e=="string"||typeof e=="object"&&e!==null&&Symbol.iterator in e}function Kh(...e){return fa(J_,e,Q_)}var J_=(e,t)=>e.map(t),Q_=e=>(t,r,i)=>({done:!1,hasNext:!0,next:e(t,r,i)});function Vh(...e){return fa(e$,e)}var e$=(e,t)=>{let r=Object.create(null);for(let i=0;i<e.length;i++){let n=e[i],o=t(n,i,e);if(o!==void 0){let s=r[o];s===void 0?r[o]=[n]:s.push(n)}}return Object.setPrototypeOf(r,Object.prototype),r};function t$(...e){return fa(n$,e,r$)}var n$=(e,t)=>e.flatMap(t),r$=e=>(t,r,i)=>{let n=e(t,r,i);return Array.isArray(n)?{done:!1,hasNext:!0,hasMany:!0,next:n}:{done:!1,hasNext:!0,next:n}};function Bh(...e){return fa(Object.entries,e)}function Zh(e){const[t,r]=$e(e,["class","classList","placeholder","options","current","value","label","groupBy","valueClass","onSelect","onHighlight","onOpenChange","children","triggerStyle","triggerVariant","triggerProps"]),i={key:void 0,cleanup:void 0},n=()=>{i.cleanup?.(),i.cleanup=void 0,i.key=void 0},o=l=>t.value?t.value(l):l,s=l=>{if(!t.onHighlight)return;if(!l){n();return}const u=o(l);i.key!==u&&(i.cleanup?.(),i.cleanup=t.onHighlight(l),i.key=u)};je(n);const a=$(()=>kl(t.options,Vh(u=>t.groupBy?t.groupBy(u):""),Bh(),Kh(([u,d])=>({category:u,options:d}))));return c(zn,ie(r,{"data-component":"select",get"data-trigger-style"(){return t.triggerVariant},get placement(){return t.triggerVariant==="settings"?"bottom-end":"bottom-start"},gutter:4,get value(){return t.current},get options(){return a()},optionValue:l=>t.value?t.value(l):l,optionTextValue:l=>t.label?t.label(l):l,optionGroupChildren:"options",get placeholder(){return t.placeholder},sectionComponent:l=>c(zn.Section,{"data-slot":"select-section",get children(){return l.section.rawValue.category}}),itemComponent:l=>c(zn.Item,ie(l,{"data-slot":"select-select-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},onPointerEnter:()=>s(l.item.rawValue),onPointerMove:()=>s(l.item.rawValue),onFocus:()=>s(l.item.rawValue),get children(){return[c(zn.ItemLabel,{"data-slot":"select-select-item-label",get children(){return Te(()=>!!t.children)()?t.children(l.item.rawValue):Te(()=>!!t.label)()?t.label(l.item.rawValue):l.item.rawValue}}),c(zn.ItemIndicator,{"data-slot":"select-select-item-indicator",get children(){return c(bt,{name:"check-small",size:"small"})}})]}})),onChange:l=>{t.onSelect?.(l??void 0),n()},onOpenChange:l=>{t.onOpenChange?.(l),l||n()},get children(){return[c(zn.Trigger,ie(()=>t.triggerProps,{get disabled(){return e.disabled},"data-slot":"select-select-trigger",as:vt,get size(){return e.size},get variant(){return e.variant},get style(){return t.triggerStyle},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return[c(zn.Value,{"data-slot":"select-select-trigger-value",get class(){return t.valueClass},children:l=>{const u=l.selectedOption()??t.current;return u?t.label?t.label(u):u:t.placeholder||""}}),c(zn.Icon,{"data-slot":"select-select-trigger-icon",get children(){return c(bt,{get name(){return t.triggerVariant==="settings"?"selector":"chevron-down"},size:"small"})}})]}})),c(zn.Portal,{get children(){return c(zn.Content,{get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},"data-component":"select-content",get"data-trigger-style"(){return t.triggerVariant},get children(){return c(zn.Listbox,{"data-slot":"select-select-content-list"})}})}})]}}))}var i$=class{collection;direction;orientation;constructor(e,t,r){this.collection=e,this.direction=t,this.orientation=r}flipDirection(){return this.direction()==="rtl"&&this.orientation()==="horizontal"}getKeyLeftOf(e){if(this.flipDirection())return this.getNextKey(e);if(this.orientation()==="horizontal")return this.getPreviousKey(e)}getKeyRightOf(e){if(this.flipDirection())return this.getPreviousKey(e);if(this.orientation()==="horizontal")return this.getNextKey(e)}getKeyAbove(e){if(this.orientation()==="vertical")return this.getPreviousKey(e)}getKeyBelow(e){if(this.orientation()==="vertical")return this.getNextKey(e)}getFirstKey(){let e=this.collection().getFirstKey();return e==null?void 0:(this.collection().getItem(e)?.disabled&&(e=this.getNextKey(e)),e)}getLastKey(){let e=this.collection().getLastKey();return e==null?void 0:(this.collection().getItem(e)?.disabled&&(e=this.getPreviousKey(e)),e)}getNextKey(e){let t=e,r;do if(t=this.collection().getKeyAfter(t)??this.collection().getFirstKey(),t==null||(r=this.collection().getItem(t),r==null))return;while(r.disabled);return t}getPreviousKey(e){let t=e,r;do if(t=this.collection().getKeyBefore(t)??this.collection().getLastKey(),t==null||(r=this.collection().getItem(t),r==null))return;while(r.disabled);return t}},Hh=Rt();function qh(){return jt(Hh)}function o$(){const e=qh();if(e===void 0)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}function Gh(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function s$(e,t){const r=t.ref();if(!r)return-1;let i=e.length;if(!i)return-1;for(;i--;){const n=e[i]?.ref();if(n&&Gh(n,r))return i+1}return 0}function a$(e){const t=e.map((i,n)=>[n,i]);let r=!1;return t.sort(([i,n],[o,s])=>{const a=n.ref(),l=s.ref();return a===l||!a||!l?0:Gh(a,l)?(i>o&&(r=!0),-1):(i<o&&(r=!0),1)}),r?t.map(([i,n])=>n):e}function Wh(e,t){const r=a$(e);e!==r&&t(r)}function l$(e){const t=e[0],r=e[e.length-1]?.ref();let i=t?.ref()?.parentElement;for(;i;){if(r&&i.contains(r))return i;i=i.parentElement}return jx(i).body}function c$(e,t){ne(()=>{const r=setTimeout(()=>{Wh(e(),t)});je(()=>clearTimeout(r))})}function u$(e,t){if(typeof IntersectionObserver!="function"){c$(e,t);return}let r=[];ne(()=>{const i=()=>{const s=!!r.length;r=e(),s&&Wh(e(),t)},n=l$(e()),o=new IntersectionObserver(i,{root:n});for(const s of e()){const a=s.ref();a&&o.observe(a)}je(()=>o.disconnect())})}function Pc(e={}){const[t,r]=Rx({value:()=>Ce(e.items),onChange:o=>e.onItemsChange?.(o)});u$(t,r);const i=o=>(r(s=>{const a=s$(s,o);return Ux(s,o,a)}),()=>{r(s=>{const a=s.filter(l=>l.ref()!==o.ref());return s.length===a.length?s:a})});return{DomCollectionProvider:o=>c(Hh.Provider,{value:{registerItem:i},get children(){return o.children}})}}function Oc(e){const t=o$(),r=Ge({shouldRegisterItem:!0},e);ne(()=>{if(!r.shouldRegisterItem)return;const i=t.registerItem(r.getItem());je(i)})}var d$={};ir(d$,{Content:()=>Yh,Indicator:()=>Jh,List:()=>Qh,Root:()=>ep,Tabs:()=>Ho,Trigger:()=>tp,useTabsContext:()=>Zo});var Xh=Rt();function Zo(){const e=jt(Xh);if(e===void 0)throw new Error("[kobalte]: `useTabsContext` must be used within a `Tabs` component");return e}function Yh(e){const[t,r]=ze(),i=Zo(),[n,o]=$e(e,["ref","id","value","forceMount"]),[s,a]=ze(0),l=()=>n.id??i.generateContentId(n.value),u=()=>i.listState().selectedKey()===n.value,{present:d}=li({show:()=>n.forceMount||u(),element:()=>t()??null});return ne(qe([()=>t(),()=>d()],([f,m])=>{if(f==null||!m)return;const h=()=>{const y=qg(f,{tabbable:!0});a(y.nextNode()?void 0:0)};h();const g=new MutationObserver(h);g.observe(f,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabindex","disabled"]}),je(()=>{g.disconnect()})})),ne(qe([()=>n.value,l],([f,m])=>{i.contentIdsMap().set(f,m)})),c(F,{get when(){return d()},get children(){return c(it,ie({as:"div",ref(f){var m=xt(r,n.ref);typeof m=="function"&&m(f)},get id(){return l()},role:"tabpanel",get tabIndex(){return s()},get"aria-labelledby"(){return i.triggerIdsMap().get(n.value)},get"data-orientation"(){return i.orientation()},get"data-selected"(){return u()?"":void 0}},o))}})}function Jh(e){const t=Zo(),[r,i]=$e(e,["style"]),[n,o]=ze({width:void 0,height:void 0}),{direction:s}=Nr(),a=()=>{const m=t.selectedTab();if(m==null)return;const h={transform:void 0,width:void 0,height:void 0},g=s()==="rtl"?-1*(m.offsetParent?.offsetWidth-m.offsetWidth-m.offsetLeft):m.offsetLeft;h.transform=t.orientation()==="vertical"?`translateY(${m.offsetTop}px)`:`translateX(${g}px)`,t.orientation()==="horizontal"?h.width=`${m.offsetWidth}px`:h.height=`${m.offsetHeight}px`,o(h)};Vt(()=>{queueMicrotask(()=>{a()})}),ne(qe([t.selectedTab,t.orientation,s],()=>{a()},{defer:!0}));const[l,u]=ze(!1);let d=null,f=null;return Uo(t.selectedTab,(m,h)=>{if(f!==h){f=h;return}u(!0),d&&clearTimeout(d),d=setTimeout(()=>{d=null,u(!1)},1),a()}),c(it,ie({as:"div",role:"presentation",get style(){return vr(n(),r.style)},get"data-orientation"(){return t.orientation()},get"data-resizing"(){return l()}},i))}function Qh(e){let t;const r=Zo(),[i,n]=$e(e,["ref","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),{direction:o}=Nr(),s=new i$(()=>r.listState().collection(),o,r.orientation),a=Ch({selectionManager:()=>r.listState().selectionManager(),keyboardDelegate:()=>s,selectOnFocus:()=>r.activationMode()==="automatic",shouldFocusWrap:!1,disallowEmptySelection:!0},()=>t);return ne(()=>{if(t==null)return;const l=t.querySelector(`[data-key="${r.listState().selectedKey()}"]`);l!=null&&r.setSelectedTab(l)}),c(it,ie({as:"div",ref(l){var u=xt(d=>t=d,i.ref);typeof u=="function"&&u(l)},role:"tablist",get"aria-orientation"(){return r.orientation()},get"data-orientation"(){return r.orientation()},get onKeyDown(){return et([i.onKeyDown,a.onKeyDown])},get onMouseDown(){return et([i.onMouseDown,a.onMouseDown])},get onFocusIn(){return et([i.onFocusIn,a.onFocusIn])},get onFocusOut(){return et([i.onFocusOut,a.onFocusOut])}},n))}function f$(e){const[t,r]=ea({value:()=>Ce(e.selectedKey),defaultValue:()=>Ce(e.defaultSelectedKey),onChange:u=>e.onSelectionChange?.(u)}),i=$(()=>{const u=t();return u!=null?[u]:[]}),[,n]=$e(e,["onSelectionChange"]),o=ie(n,{selectionMode:"single",disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:i,onSelectionChange:u=>{const d=u.values().next().value;d===t()&&e.onSelectionChange?.(d),r(d)}}),{collection:s,selectionManager:a}=Bo(o),l=$(()=>{const u=t();return u!=null?s().getItem(u):void 0});return{collection:s,selectionManager:a,selectedKey:t,setSelectedKey:r,selectedItem:l}}function ep(e){const t=`tabs-${nn()}`,r=Ge({id:t,orientation:"horizontal",activationMode:"automatic"},e),[i,n]=$e(r,["value","defaultValue","onChange","orientation","activationMode","disabled"]),[o,s]=ze([]),[a,l]=ze(),{DomCollectionProvider:u}=Pc({items:o,onItemsChange:s}),d=f$({selectedKey:()=>i.value,defaultSelectedKey:()=>i.defaultValue,onSelectionChange:y=>i.onChange?.(String(y)),dataSource:o});let f=d.selectedKey();ne(qe([()=>d.selectionManager(),()=>d.collection(),()=>d.selectedKey()],([y,b,v])=>{let w=v;if(y.isEmpty()||w==null||!b.getItem(w)){w=b.getFirstKey();let x=w!=null?b.getItem(w):void 0;for(;x?.disabled&&x.key!==b.getLastKey();)w=b.getKeyAfter(x.key),x=w!=null?b.getItem(w):void 0;x?.disabled&&w===b.getLastKey()&&(w=b.getFirstKey()),w!=null&&y.setSelectedKeys([w])}(y.focusedKey()==null||!y.isFocused()&&w!==f)&&y.setFocusedKey(w),f=w}));const m=new Map,h=new Map,g={isDisabled:()=>i.disabled??!1,orientation:()=>i.orientation,activationMode:()=>i.activationMode,triggerIdsMap:()=>m,contentIdsMap:()=>h,listState:()=>d,selectedTab:a,setSelectedTab:l,generateTriggerId:y=>`${n.id}-trigger-${y}`,generateContentId:y=>`${n.id}-content-${y}`};return c(u,{get children(){return c(Xh.Provider,{value:g,get children(){return c(it,ie({as:"div",get"data-orientation"(){return g.orientation()}},n))}})}})}function tp(e){let t;const r=Zo(),i=Ge({type:"button"},e),[n,o]=$e(i,["ref","id","value","disabled","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),s=()=>n.id??r.generateTriggerId(n.value),a=()=>r.listState().selectionManager().focusedKey()===n.value,l=()=>n.disabled||r.isDisabled(),u=()=>r.contentIdsMap().get(n.value);Oc({getItem:()=>({ref:()=>t,type:"item",key:n.value,textValue:"",disabled:l()})});const d=Vo({key:()=>n.value,selectionManager:()=>r.listState().selectionManager(),disabled:l},()=>t),f=m=>{Xg()&&vn(m.currentTarget)};return ne(qe([()=>n.value,s],([m,h])=>{r.triggerIdsMap().set(m,h)})),c(it,ie({as:"button",ref(m){var h=xt(g=>t=g,n.ref);typeof h=="function"&&h(m)},get id(){return s()},role:"tab",get tabIndex(){return Te(()=>!l())()?d.tabIndex():void 0},get disabled(){return l()},get"aria-selected"(){return d.isSelected()},get"aria-disabled"(){return l()||void 0},get"aria-controls"(){return Te(()=>!!d.isSelected())()?u():void 0},get"data-key"(){return d.dataKey()},get"data-orientation"(){return r.orientation()},get"data-selected"(){return d.isSelected()?"":void 0},get"data-highlighted"(){return a()?"":void 0},get"data-disabled"(){return l()?"":void 0},get onPointerDown(){return et([n.onPointerDown,d.onPointerDown])},get onPointerUp(){return et([n.onPointerUp,d.onPointerUp])},get onClick(){return et([n.onClick,d.onClick,f])},get onKeyDown(){return et([n.onKeyDown,d.onKeyDown])},get onMouseDown(){return et([n.onMouseDown,d.onMouseDown])},get onFocus(){return et([n.onFocus,d.onFocus])}},o))}var Ho=Object.assign(ep,{Content:Yh,Indicator:Jh,List:Qh,Trigger:tp}),m$=I("<div data-slot=tabs-trigger-wrapper>"),g$=I("<div data-slot=tabs-trigger-close-button>"),h$=I("<div data-slot=tabs-section-title>");function p$(e){const[t,r]=$e(e,["class","classList","variant","orientation"]);return c(Ho,ie(r,{get orientation(){return t.orientation},"data-component":"tabs",get"data-variant"(){return t.variant||"normal"},get"data-orientation"(){return t.orientation||"horizontal"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function v$(e){const[t,r]=$e(e,["class","classList"]);return c(Ho.List,ie(r,{"data-slot":"tabs-list",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function b$(e){const[t,r]=$e(e,["class","classList","classes","children","closeButton","hideCloseButton","onMiddleClick"]);return(()=>{var i=m$();return i.addEventListener("auxclick",n=>{n.button===1&&t.onMiddleClick&&(n.preventDefault(),t.onMiddleClick())}),i.$$mousedown=n=>{n.button===1&&t.onMiddleClick&&n.preventDefault()},p(i,c(Ho.Trigger,ie(r,{"data-slot":"tabs-trigger",get"data-value"(){return e.value},get classList(){return{[t.classes?.button??""]:t.classes?.button}},get children(){return t.children}})),null),p(i,c(F,{get when(){return t.closeButton},children:n=>(()=>{var o=g$();return p(o,n),Ae(()=>Ie(o,"data-hidden",t.hideCloseButton)),o})()}),null),Ae(n=>{var o=e.value,s={...t.classList??{},[t.class??""]:!!t.class};return o!==n.e&&Ie(i,"data-value",n.e=o),n.t=Ct(i,s,n.t),n},{e:void 0,t:void 0}),i})()}function y$(e){const[t,r]=$e(e,["class","classList","children"]);return c(Ho.Content,ie(r,{"data-slot":"tabs-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}const w$=e=>(()=>{var t=h$();return p(t,()=>e.children),t})(),Lt=Object.assign(p$,{List:v$,Trigger:b$,Content:y$,SectionTitle:w$});Ot(["mousedown"]);var Ts={exports:{}},x$=Ts.exports,Sf;function _$(){return Sf||(Sf=1,(function(e){((t,r)=>{e.exports?e.exports=r():t.fuzzysort=r()})(x$,t=>{var r=(W,D)=>{if(!W||!D)return Q;var te=g(W);P(D)||(D=h(D));var H=te.bitflags;return(H&D._bitflags)!==H?Q:b(te,D)},i=(W,D,te)=>{if(!W)return te?.all?y(D,te):V;var H=g(W),Z=H.bitflags,se=H.containsSpace,re=f(te?.threshold||0),fe=te?.limit||B,Se=0,Ne=0,ce=D.length;function ye(Pe){Se<fe?(le.add(Pe),++Se):(++Ne,Pe._score>le.peek()._score&&le.replaceTop(Pe))}if(te?.key)for(var G=te.key,we=0;we<ce;++we){var ke=D[we],ue=j(ke,G);if(ue&&(P(ue)||(ue=h(ue)),(Z&ue._bitflags)===Z)){var me=b(H,ue);me!==Q&&(me._score<re||(me.obj=ke,ye(me)))}}else if(te?.keys){var Ue=te.keys,be=Ue.length;e:for(var we=0;we<ce;++we){var ke=D[we];{for(var Be=0,E=0;E<be;++E){var G=Ue[E],ue=j(ke,G);if(!ue){U[E]=ee;continue}P(ue)||(ue=h(ue)),U[E]=ue,Be|=ue._bitflags}if((Z&Be)!==Z)continue}if(se)for(let pe=0;pe<H.spaceSearches.length;pe++)T[pe]=R;for(var E=0;E<be;++E){if(ue=U[E],ue===ee){A[E]=ee;continue}if(A[E]=b(H,ue,!1,se),A[E]===Q){A[E]=ee;continue}if(se)for(let De=0;De<H.spaceSearches.length;De++){if(M[De]>-1e3&&T[De]>R){var ae=(T[De]+M[De])/4;ae>T[De]&&(T[De]=ae)}M[De]>T[De]&&(T[De]=M[De])}}if(se){for(let pe=0;pe<H.spaceSearches.length;pe++)if(T[pe]===R)continue e}else{var de=!1;for(let pe=0;pe<be;pe++)if(A[pe]._score!==R){de=!0;break}if(!de)continue}var Ee=new l(be);for(let pe=0;pe<be;pe++)Ee[pe]=A[pe];if(se){var Re=0;for(let pe=0;pe<H.spaceSearches.length;pe++)Re+=T[pe]}else{var Re=R;for(let De=0;De<be;De++){var me=Ee[De];if(me._score>-1e3&&Re>R){var ae=(Re+me._score)/4;ae>Re&&(Re=ae)}me._score>Re&&(Re=me._score)}}if(Ee.obj=ke,Ee._score=Re,te?.scoreFn){if(Re=te.scoreFn(Ee),!Re)continue;Re=f(Re),Ee._score=Re}Re<re||ye(Ee)}}else for(var we=0;we<ce;++we){var ue=D[we];if(ue&&(P(ue)||(ue=h(ue)),(Z&ue._bitflags)===Z)){var me=b(H,ue);me!==Q&&(me._score<re||ye(me))}}if(Se===0)return V;for(var ot=new Array(Se),we=Se-1;we>=0;--we)ot[we]=le.poll();return ot.total=Se+Ne,ot},n=(W,D="<b>",te="</b>")=>{for(var H=typeof D=="function"?D:void 0,Z=W.target,se=Z.length,re=W.indexes,fe="",Se=0,Ne=0,ce=!1,ye=[],G=0;G<se;++G){var we=Z[G];if(re[Ne]===G){if(++Ne,ce||(ce=!0,H?(ye.push(fe),fe=""):fe+=D),Ne===re.length){H?(fe+=we,ye.push(H(fe,Se++)),fe="",ye.push(Z.substr(G+1))):fe+=we+te+Z.substr(G+1);break}}else ce&&(ce=!1,H?(ye.push(H(fe,Se++)),fe=""):fe+=te);fe+=we}return H?ye:fe},o=W=>{typeof W=="number"?W=""+W:typeof W!="string"&&(W="");var D=x(W);return u(W,{_targetLower:D._lower,_targetLowerCodes:D.lowerCodes,_bitflags:D.bitflags})},s=()=>{C.clear(),O.clear()};class a{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((D,te)=>D-te)}set indexes(D){return this._indexes=D}highlight(D,te){return n(this,D,te)}get score(){return d(this._score)}set score(D){this._score=f(D)}}class l extends Array{get score(){return d(this._score)}set score(D){this._score=f(D)}}var u=(W,D)=>{const te=new a;return te.target=W,te.obj=D.obj??Q,te._score=D._score??R,te._indexes=D._indexes??[],te._targetLower=D._targetLower??"",te._targetLowerCodes=D._targetLowerCodes??Q,te._nextBeginningIndexes=D._nextBeginningIndexes??Q,te._bitflags=D._bitflags??0,te},d=W=>W===R?0:W>1?W:Math.E**(((-W+1)**.04307-1)*-2),f=W=>W===0?R:W>1?W:1-Math.pow(Math.log(W)/-2+1,1/.04307),m=W=>{typeof W=="number"?W=""+W:typeof W!="string"&&(W=""),W=W.trim();var D=x(W),te=[];if(D.containsSpace){var H=W.split(/\s+/);H=[...new Set(H)];for(var Z=0;Z<H.length;Z++)if(H[Z]!==""){var se=x(H[Z]);te.push({lowerCodes:se.lowerCodes,_lower:H[Z].toLowerCase(),containsSpace:!1})}}return{lowerCodes:D.lowerCodes,_lower:D._lower,containsSpace:D.containsSpace,bitflags:D.bitflags,spaceSearches:te}},h=W=>{if(W.length>999)return o(W);var D=C.get(W);return D!==void 0||(D=o(W),C.set(W,D)),D},g=W=>{if(W.length>999)return m(W);var D=O.get(W);return D!==void 0||(D=m(W),O.set(W,D)),D},y=(W,D)=>{var te=[];te.total=W.length;var H=D?.limit||B;if(D?.key)for(var Z=0;Z<W.length;Z++){var se=W[Z],re=j(se,D.key);if(re!=Q){P(re)||(re=h(re));var fe=u(re.target,{_score:re._score,obj:se});if(te.push(fe),te.length>=H)return te}}else if(D?.keys)for(var Z=0;Z<W.length;Z++){for(var se=W[Z],Se=new l(D.keys.length),Ne=D.keys.length-1;Ne>=0;--Ne){var re=j(se,D.keys[Ne]);if(!re){Se[Ne]=ee;continue}P(re)||(re=h(re)),re._score=R,re._indexes.len=0,Se[Ne]=re}if(Se.obj=se,Se._score=R,te.push(Se),te.length>=H)return te}else for(var Z=0;Z<W.length;Z++){var re=W[Z];if(re!=Q&&(P(re)||(re=h(re)),re._score=R,re._indexes.len=0,te.push(re),te.length>=H))return te}return te},b=(W,D,te=!1,H=!1)=>{if(te===!1&&W.containsSpace)return v(W,D,H);for(var Z=W._lower,se=W.lowerCodes,re=se[0],fe=D._targetLowerCodes,Se=se.length,Ne=fe.length,we=0,ce=0,ye=0;;){var G=re===fe[ce];if(G){if(z[ye++]=ce,++we,we===Se)break;re=se[we]}if(++ce,ce>=Ne)return Q}var we=0,ke=!1,ue=0,me=D._nextBeginningIndexes;me===Q&&(me=D._nextBeginningIndexes=k(D.target)),ce=z[0]===0?0:me[z[0]-1];var Ue=0;if(ce!==Ne)for(;;)if(ce>=Ne){if(we<=0||(++Ue,Ue>200))break;--we;var be=K[--ue];ce=me[be]}else{var G=se[we]===fe[ce];if(G){if(K[ue++]=ce,++we,we===Se){ke=!0;break}++ce}else ce=me[ce]}var Be=Se<=1?-1:D._targetLower.indexOf(Z,z[0]),E=!!~Be,ae=E?Be===0||D._nextBeginningIndexes[Be-1]===Be:!1;if(E&&!ae){for(var de=0;de<me.length;de=me[de])if(!(de<=Be)){for(var Ee=0;Ee<Se&&se[Ee]===D._targetLowerCodes[de+Ee];Ee++);if(Ee===Se){Be=de,ae=!0;break}}}var Re=pe=>{for(var De=0,st=0,Je=1;Je<Se;++Je)pe[Je]-pe[Je-1]!==1&&(De-=pe[Je],++st);var Ve=pe[Se-1]-pe[0]-(Se-1);if(De-=(12+Ve)*st,pe[0]!==0&&(De-=pe[0]*pe[0]*.2),!ke)De*=1e3;else{for(var ht=1,Je=me[0];Je<Ne;Je=me[Je])++ht;ht>24&&(De*=(ht-24)*10)}return De-=(Ne-Se)/2,E&&(De/=1+Se*Se*1),ae&&(De/=1+Se*Se*1),De-=(Ne-Se)/2,De};if(ke)if(ae){for(var de=0;de<Se;++de)z[de]=Be+de;var ot=z,Pe=Re(z)}else var ot=K,Pe=Re(K);else{if(E)for(var de=0;de<Se;++de)z[de]=Be+de;var ot=z,Pe=Re(ot)}D._score=Pe;for(var de=0;de<Se;++de)D._indexes[de]=ot[de];D._indexes.len=Se;const Oe=new a;return Oe.target=D.target,Oe._score=D._score,Oe._indexes=D._indexes,Oe},v=(W,D,te)=>{for(var H=new Set,Z=0,se=Q,re=0,fe=W.spaceSearches,Se=fe.length,Ne=0,ce=()=>{for(let ae=Ne-1;ae>=0;ae--)D._nextBeginningIndexes[J[ae*2+0]]=J[ae*2+1]},ye=!1,E=0;E<Se;++E){M[E]=R;var G=fe[E];if(se=b(G,D),te){if(se===Q)continue;ye=!0}else if(se===Q)return ce(),Q;var we=E===Se-1;if(!we){var ke=se._indexes,ue=!0;for(let de=0;de<ke.len-1;de++)if(ke[de+1]-ke[de]!==1){ue=!1;break}if(ue){var me=ke[ke.len-1]+1,Ue=D._nextBeginningIndexes[me-1];for(let de=me-1;de>=0&&Ue===D._nextBeginningIndexes[de];de--)D._nextBeginningIndexes[de]=me,J[Ne*2+0]=de,J[Ne*2+1]=Ue,Ne++}}Z+=se._score/Se,M[E]=se._score/Se,se._indexes[0]<re&&(Z-=(re-se._indexes[0])*2),re=se._indexes[0];for(var be=0;be<se._indexes.len;++be)H.add(se._indexes[be])}if(te&&!ye)return Q;ce();var Be=b(W,D,!0);if(Be!==Q&&Be._score>Z){if(te)for(var E=0;E<Se;++E)M[E]=Be._score/Se;return Be}te&&(se=D),se._score=Z;var E=0;for(let ae of H)se._indexes[E++]=ae;return se._indexes.len=E,se},w=W=>W.replace(/\p{Script=Latin}+/gu,D=>D.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),x=W=>{W=w(W);for(var D=W.length,te=W.toLowerCase(),H=[],Z=0,se=!1,re=0;re<D;++re){var fe=H[re]=te.charCodeAt(re);if(fe===32){se=!0;continue}var Se=fe>=97&&fe<=122?fe-97:fe>=48&&fe<=57?26:fe<=127?30:31;Z|=1<<Se}return{lowerCodes:H,bitflags:Z,containsSpace:se,_lower:te}},_=W=>{for(var D=W.length,te=[],H=0,Z=!1,se=!1,re=0;re<D;++re){var fe=W.charCodeAt(re),Se=fe>=65&&fe<=90,Ne=Se||fe>=97&&fe<=122||fe>=48&&fe<=57,ce=Se&&!Z||!se||!Ne;Z=Se,se=Ne,ce&&(te[H++]=re)}return te},k=W=>{W=w(W);for(var D=W.length,te=_(W),H=[],Z=te[0],se=0,re=0;re<D;++re)Z>re?H[re]=Z:(Z=te[++se],H[re]=Z===void 0?D:Z);return H},C=new Map,O=new Map,z=[],K=[],J=[],T=[],M=[],U=[],A=[],j=(W,D)=>{var te=W[D];if(te!==void 0)return te;if(typeof D=="function")return D(W);var H=D;Array.isArray(D)||(H=D.split("."));for(var Z=H.length,se=-1;W&&++se<Z;)W=W[H[se]];return W},P=W=>typeof W=="object"&&typeof W._bitflags=="number",B=1/0,R=-B,V=[];V.total=0;var Q=null,ee=o(""),oe=W=>{var D=[],te=0,H={},Z=se=>{for(var re=0,fe=D[re],Se=1;Se<te;){var Ne=Se+1;re=Se,Ne<te&&D[Ne]._score<D[Se]._score&&(re=Ne),D[re-1>>1]=D[re],Se=1+(re<<1)}for(var ce=re-1>>1;re>0&&fe._score<D[ce]._score;ce=(re=ce)-1>>1)D[re]=D[ce];D[re]=fe};return H.add=(se=>{var re=te;D[te++]=se;for(var fe=re-1>>1;re>0&&se._score<D[fe]._score;fe=(re=fe)-1>>1)D[re]=D[fe];D[re]=se}),H.poll=(se=>{if(te!==0){var re=D[0];return D[0]=D[--te],Z(),re}}),H.peek=(se=>{if(te!==0)return D[0]}),H.replaceTop=(se=>{D[0]=se,Z()}),H},le=oe();return{single:r,go:i,prepare:o,cleanup:s}})})(Ts)),Ts.exports}var $$=_$();const kf=Kx($$);function S$(e){const[t,r]=ze(e.initialValue),i=()=>e.value?.()!==void 0,n=()=>i()?e.value?.():t();return[n,s=>kt(()=>{let a;return typeof s=="function"?a=s(n()):a=s,Object.is(a,n())||(i()||r(a),e.onChange?.(a)),a})]}var k$=S$,C$=e=>{const t=ie({initialActive:null,orientation:"vertical",loop:!0,textDirection:"ltr",handleTab:!0,vimMode:!1,vimKeys:{up:"k",down:"j",right:"l",left:"h"}},e),[r,i]=k$({initialValue:t.initialActive,onChange:t.onActiveChange}),n=()=>{const a=Mn(t.vimKeys);let l,u;return Mn(t.orientation)==="vertical"?(l="arrowdown",u=a.down):Mn(t.textDirection)==="ltr"?(l="arrowright",u=a.right):(l="arrowleft",u=a.left),Mn(t.vimMode)?[l,u]:[l]},o=()=>{const a=Mn(t.vimKeys);let l,u;return Mn(t.orientation)==="vertical"?(l="arrowup",u=a.up):Mn(t.textDirection)==="ltr"?(l="arrowleft",u=a.left):(l="arrowright",u=a.right),Mn(t.vimMode)?[l,u]:[l]};return{active:r,setActive:i,onKeyDown:a=>{const l=a.key.toLowerCase(),u=Mn(t.items);if(u.length===0)return;const d=u.length,f=r(),m=f!==null?u.indexOf(f):null;n().includes(l)?(a.preventDefault(),m===d-1?Mn(t.loop)&&i(()=>u[0]):i(()=>u[m!==null?m+1:0])):o().includes(l)?(a.preventDefault(),m===0?Mn(t.loop)&&i(()=>u[d-1]):i(()=>u[m!==null?m-1:d-1])):l==="home"?(a.preventDefault(),i(()=>u[0])):l==="end"?(a.preventDefault(),i(()=>u[d-1])):Mn(t.handleTab)&&m!==null&&(l==="tab"&&!a.shiftKey&&m<d-1&&(a.preventDefault(),i(()=>u[m+1])),l==="tab"&&a.shiftKey&&m>0&&(a.preventDefault(),i(()=>u[m-1])))}}},I$=C$;function Ls(e){const[t,r]=We({filter:""}),i=[],[n,{refetch:o}]=eh(()=>({filter:t.filter,items:typeof e.items=="function"?e.items(t.filter):e.items}),async({filter:m,items:h})=>{const y=(m??"").toLowerCase(),b=await Promise.resolve(h)||[];return kl(b,w=>y?!e.filterKeys&&Array.isArray(w)&&w.every(x=>typeof x=="string")?kf.go(y,w).map(x=>x.target):kf.go(y,w,{keys:e.filterKeys}).map(x=>x.obj):w,Vh(w=>e.groupBy?e.groupBy(w):""),Bh(),Kh(([w,x])=>({category:w,items:e.sortBy?x.sort(e.sortBy):x})),w=>e.sortGroupsBy?w.sort(e.sortGroupsBy):w)},{initialValue:i}),s=$(()=>kl(n.latest||[],t$(m=>m.items)));function a(){if(e.noInitialSelection)return"";if(e.current)return e.key(e.current);const m=s();return m.length===0?"":e.key(m[0])}const l=I$({items:()=>s().map(e.key),initialActive:a(),loop:!0}),u=()=>{if(e.noInitialSelection){l.setActive("");return}const m=s();m.length!==0&&l.setActive(e.key(m[0]))},d=m=>{if(m.key==="Enter"&&!m.isComposing){m.preventDefault();const h=s().findIndex(y=>e.key(y)===l.active()),g=s()[h];g&&e.onSelect?.(g,h)}else if(m.ctrlKey&&!m.metaKey&&!m.altKey&&!m.shiftKey){if(m.key==="n"||m.key==="p"){m.preventDefault();const h=new KeyboardEvent("keydown",{key:m.key==="n"?"ArrowDown":"ArrowUp",bubbles:!0});l.onKeyDown(h)}}else{if(m.altKey||m.metaKey)return;l.onKeyDown(m)}};return ne(qe(n,()=>{u()})),{grouped:n,filter:()=>t.filter,flat:s,reset:u,refetch:o,clear:()=>r("filter",""),onKeyDown:d,onInput:m=>{r("filter",m)},active:l.active,setActive:l.setActive}}function np(e){let t=!1,r,i,n;const o=()=>e.bottomThreshold??10,[s,a]=We({contentRef:void 0,scrollRef:void 0,userScrolled:!1}),l=()=>e.working()||t,u=_=>_.scrollHeight-_.clientHeight-_.scrollTop,d=_=>_.scrollHeight-_.clientHeight>1,f=_=>{n={top:Math.max(0,_.scrollHeight-_.clientHeight),time:Date.now()},i&&clearTimeout(i),i=setTimeout(()=>{n=void 0,i=void 0},1500)},m=_=>{const k=n;return k?Date.now()-k.time>1500?(n=void 0,!1):Math.abs(_.scrollTop-k.top)<2:!1},h=_=>{const k=s.scrollRef;k&&(f(k),k.scrollTop=k.scrollHeight)},g=_=>{if(!_&&!l())return;_&&s.userScrolled&&a("userScrolled",!1);const k=s.scrollRef;if(!k||!_&&s.userScrolled)return;if(u(k)<2){f(k);return}h()},y=()=>{const _=s.scrollRef;if(_){if(!d(_)){s.userScrolled&&a("userScrolled",!1);return}s.userScrolled||(a("userScrolled",!0),e.onUserInteracted?.())}},b=_=>{if(_.deltaY>=0)return;const k=s.scrollRef,O=(_.target instanceof Element?_.target:void 0)?.closest("[data-scrollable]");k&&O&&O!==k||y()},v=()=>{const _=s.scrollRef;if(_){if(!d(_)){s.userScrolled&&a("userScrolled",!1);return}if(u(_)<o()){s.userScrolled&&a("userScrolled",!1);return}if(!s.userScrolled&&m(_)){g(!1);return}y()}},w=()=>{if(!l())return;const _=window.getSelection();_&&_.toString().length>0&&y()},x=_=>{const k=e.overflowAnchor??"dynamic";if(k==="none"){_.style.overflowAnchor="none";return}if(k==="auto"){_.style.overflowAnchor="auto";return}_.style.overflowAnchor=s.userScrolled?"auto":"none"};return Uo(()=>s.contentRef,()=>{const _=s.scrollRef;if(_&&!d(_)){s.userScrolled&&a("userScrolled",!1);return}l()&&(s.userScrolled||g(!1))}),ne(qe(e.working,_=>{if(t=!1,r&&clearTimeout(r),r=void 0,_){s.userScrolled||g(!0);return}t=!0,r=setTimeout(()=>{t=!1},300)})),ne(()=>{s.userScrolled;const _=s.scrollRef;_&&x(_)}),Hg(()=>s.scrollRef,"wheel",b,{passive:!0}),je(()=>{r&&clearTimeout(r),i&&clearTimeout(i)}),{scrollRef:_=>a("scrollRef",_),contentRef:_=>a("contentRef",_),handleScroll:v,handleInteraction:w,pause:y,resume:()=>{s.userScrolled&&a("userScrolled",!1),g(!0)},scrollToBottom:()=>g(!1),forceScrollToBottom:()=>g(!0),userScrolled:()=>s.userScrolled}}const T$="/assets/android-studio-t3zZ7G0e.svg",D$="/assets/antigravity-m-mWKI7R.svg",A$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5436_78947)'%3e%3cmask%20id='mask0_5436_78947'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='4'%20y='4'%20width='32'%20height='32'%3e%3cpath%20d='M4%204H36V36H4V4Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_5436_78947)'%3e%3cpath%20d='M28.375%204H11.625C7.41383%204%204%207.41383%204%2011.625V28.375C4%2032.5862%207.41383%2036%2011.625%2036H28.375C32.5862%2036%2036%2032.5862%2036%2028.375V11.625C36%207.41383%2032.5862%204%2028.375%204Z'%20fill='black'/%3e%3c/g%3e%3cpath%20d='M29.6214%2014.2072L20.9502%209.12249C20.6718%208.95917%2020.3282%208.95917%2020.0498%209.12249L11.3786%2014.2072C11.1445%2014.3445%2011%2014.5984%2011%2014.8733V25.1267C11%2025.4012%2011.1445%2025.6555%2011.3786%2025.7928L20.0498%2030.8775C20.3282%2031.0408%2020.6718%2031.0408%2020.9502%2030.8775L29.6214%2025.7928C29.8555%2025.6555%2030%2025.4016%2030%2025.1267V14.8733C30%2014.5988%2029.8555%2014.3445%2029.6214%2014.2072ZM29.0767%2015.2843L20.706%2030.0101C20.6494%2030.1093%2020.5%2030.0688%2020.5%2029.9538V20.3115C20.5%2020.1189%2020.3986%2019.9407%2020.2342%2019.8439L12.0124%2015.0226C11.9147%2014.9651%2011.9546%2014.8134%2012.0678%2014.8134H28.8093C29.047%2014.8134%2029.1956%2015.0751%2029.0767%2015.2843Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5436_78947'%3e%3crect%20width='32'%20height='32'%20fill='white'%20transform='translate(4%204)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",P$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M16.2414%208.05369L14.955%206.65636C14.7646%206.44946%2014.5333%206.2843%2014.2757%206.17133C14.0182%206.05836%2013.7401%206.00002%2013.4588%206H4.86684C4.753%205.99995%204.64025%206.02234%204.53506%206.06589C4.42987%206.10944%204.33429%206.17329%204.25379%206.25379C4.17329%206.33429%204.10944%206.42987%204.06589%206.53506C4.02234%206.64025%203.99995%206.753%204%206.86684V12.8779L4.04302%2012.8825C4.10268%2012.6706%204.22985%2012.4839%204.40523%2012.3508C4.5806%2012.2177%204.7946%2012.1455%205.01476%2012.1451H13.189C14.3506%2012.1451%2015.4795%2011.6366%2016.1675%2010.7004C16.5166%2010.2255%2016.9726%209.83942%2017.4985%209.57327C18.0244%209.30713%2018.6056%209.16842%2019.195%209.16836H34.9852C35.2544%209.16836%2035.5125%209.27527%2035.7028%209.46557C35.8931%209.65587%2036%209.91398%2036%2010.1831V8.99058C36%208.77152%2035.913%208.56144%2035.7581%208.40654C35.6032%208.25164%2035.3931%208.16462%2035.174%208.16462H16.4953C16.4476%208.16469%2016.4004%208.15486%2016.3567%208.13577C16.313%208.11667%2016.2738%208.08873%2016.2414%208.05369Z'%20fill='url(%23paint0_linear_5437_79060)'/%3e%3cpath%20d='M16.2002%2010.3751C15.8497%2010.8375%2015.397%2011.2125%2014.8774%2011.4707C14.3579%2011.7289%2013.7855%2011.8634%2013.2053%2011.8634H5.01476C4.88147%2011.8634%204.74948%2011.8897%204.62634%2011.9407C4.5032%2011.9917%204.39132%2012.0665%204.29709%2012.1608C4.20286%2012.255%204.12812%2012.3669%204.07714%2012.4901C4.02617%2012.6133%203.99995%2012.7453%204%2012.8785V32.4302C4%2032.6993%204.10691%2032.9574%204.29722%2033.1477C4.48752%2033.338%204.74563%2033.4449%205.01476%2033.4449H34.9852C35.2544%2033.4449%2035.5125%2033.338%2035.7028%2033.1477C35.8931%2032.9574%2036%2032.6993%2036%2032.4302V9.90147C36%209.63234%2035.8931%209.37424%2035.7028%209.18393C35.5125%208.99363%2035.2544%208.88672%2034.9852%208.88672H19.195C18.6148%208.88679%2018.0425%209.0212%2017.5229%209.27942C17.0033%209.53764%2016.5506%209.91265%2016.2002%2010.3751Z'%20fill='url(%23paint1_linear_5437_79060)'/%3e%3cpath%20d='M27.7632%2023.2969H12.2368C11.7852%2023.2968%2011.3379%2023.3857%2010.9207%2023.5585C10.5034%2023.7312%2010.1242%2023.9846%209.80488%2024.3039C9.48553%2024.6233%209.23222%2025.0024%209.05943%2025.4197C8.88664%2025.8369%208.79776%2026.2842%208.79785%2026.7358V33.4448H31.2025V26.7358C31.2021%2024.8364%2029.6626%2023.2969%2027.7632%2023.2969Z'%20fill='url(%23paint2_linear_5437_79060)'/%3e%3cpath%20d='M26.5965%2029.7865H13.404C13.2154%2029.7865%2013.0345%2029.7116%2012.9012%2029.5782C12.7678%2029.4448%2012.6929%2029.264%2012.6929%2029.0754C12.6929%2028.8868%2012.7678%2028.7059%2012.9012%2028.5725C13.0345%2028.4392%2013.2154%2028.3643%2013.404%2028.3643H26.5965C26.7851%2028.3643%2026.966%2028.4392%2027.0993%2028.5725C27.2327%2028.7059%2027.3076%2028.8868%2027.3076%2029.0754C27.3076%2029.264%2027.2327%2029.4448%2027.0993%2029.5782C26.966%2029.7116%2026.7851%2029.7865%2026.5965%2029.7865Z'%20fill='%2310498A'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5437_79060'%20x1='19.7682'%20y1='9.59964'%20x2='19.2608'%20y2='6.75804'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23CE9918'/%3e%3cstop%20offset='0.5902'%20stop-color='%23DF9E00'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_5437_79060'%20x1='26.3559'%20y1='28.492'%20x2='13.062'%20y2='13.1687'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F5B509'/%3e%3cstop%20offset='1'%20stop-color='%23FECE49'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_5437_79060'%20x1='27.4873'%20y1='32.5737'%20x2='7.9015'%20y2='23.2375'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230161B2'/%3e%3cstop%20offset='1'%20stop-color='%231291DD'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",O$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAB8pJREFUeAHtWG+MXFUV/9375s3szNDturKbLpt0aZo2fvAfpEBEss2iMZJaFTBdG1BrUfGLmohWaGvaQtYYU2miJsRKTQikkhDRIKmRNcEPJGgw1hJFcetu2mJcKrPbmZ2dP++9e6/n3PtmdnbelJnlC3zobc++mXvPu+d3z/87wJVxZby9Q3RZl0T65Pnzu2f94S/Pl70tQYhBpWG0Mn3odRgSJBFIAeOnxKWBPvWvTVj66Vc2DT0ZYzB4CwDlaWN2H5tRT1QvKONJCCHxlodpE6Y1EAxI3PtefOvjvn+Mp7AGgN7vjPnxT6Yr916VScmuem4FQkjq0uDGDR5ky3ukdAQK+O+ywflFjZyU8D3iDZXaMd73m3t8eSc6gOwkWp4xZvLA76uPr0t7nunA+GZz7xkROLTFR7fx4lKEQy8qDGUFqnWjvnSr/8AOz3uYllQ3gNhztm5qF7DmUagCz92W7pm/SHTnbwMCCVTyEtefmvIOHz68SosJr3rif6VPFF/VUBHWTCP9K3uzSRukWoi/N7S9nujALRLVmoB/SZsNu/Z8sR1PAuDZcuqbkqdZloJ7tpLqME/fdSRw+xbP7uFYBJRxpFsoYqL1KH51+7oUqhFx0/+z9Wv2tONJtU/Ml/wt2tA5I6xpXKoaTAz5Tfws/XK5Q5tYM9IB2DggsFACLpb01q4Aq1U9yMcza4hcHumUxnohUINLITwum9xoQQsHkgEMU6AUFiiiA5FvZ02YWIXwKRGjlXRMlAnxnz8+Q2/J5lyD5yObPQTEEpnY6i1rGQIzPf0CKLm7d4ybZ142VIr2s3JCk+0KMAwofZGNROTIajN++jkfp394F/lbABO6OeapVoA7CKD1K3qXXMqC0DHNzL2G3ZN7kPbiAzNA48DyYaR2SFUkEkpPmJjB8CaN+tP6VAyKtVeNXUC6+eXQYCwrUWJgVqpsiVXmFfBkhtYMQgZD34U1iIFHnwwHE81LBXQHSIzaBogTIOJUyScN6xr5a7fByCyZI4LwlNXGB0eBMjGE1oR0APonmilWYGTDED40fgOW6ORUNB04uykBN6wU7cgT3QFacJHbwmB1DQ2LEW7+7h8QVuvkB9JqKiDeyQ9QcJCA0PolQWOhTQ0a1E0Kj508wRUDkjNRbEnJlpVw5og8KE93B8inUrqhM4FEQQsiO6dj9IsVhfcPZVCiZMuHcyLk6hCmz7VYNvuoIBPztlq6Q7HV6HxIqx40yJLJWel9GZ80lmRisCKWyERzo1QOaqGwuLU7mTvaZXOM24q38eiDlM4HWSuqQz+TAKj4FI082J4Mm53bil9+6sMpStLaaU6sYGdTv0kmdLLYETgwKN9oCkDZiw8aZSz10mJxa1WhzOxT38RyuL2q1Fwi1BxszVOtesv+lfEKR7LlZ7kdqleHNGOcqnusJCef13jqhSpVEthy9ctvZ7FAVSEigGaVLzfAiSZsjjMmEyd0T/cYJDbLrsqClxsCGQ5FJSk508ECY7UacLpRaAZScg9jgUlyIRE4SwirwaRWEpWETcN+YcgXm0/tobJ4jlY9ilQZr4kEnyagmqQFFJL1yFigAbf2MaVzXHPnqYum1EPmrNt17bohKwfdAXJisqdvIZlJ429Ht2Hmmf2QaQZpEjyWCBi3VGEoQXkcETl+RFqh8ol3DXo4vO97+OrkXvh90s5HBDQIXWtn9+wJoDFRowFt1OBwsYobpsoonHkKfz12o/UCqJQriy18SklbsuramZk1RIUDIZZx984vYHZmBo89dwpvFAKnZeJnHvY/awnTg4k9Qa1C3E02uhUuXEGpim3fmUN20078+WAOs6e+jqBeRCqdIQdKkeac6e2mFM45akRLxUX8aGoKd39sByZ23IGpR45jocANmW81HFKWDimH1mvamlcaU2vHkwgSX+pFpZCDbqshnP2XA2y85QGMjR/Av6fvx5mHt6Ivm0V+9Cb0Db+PTLceU4ckzs1dwOw/XyaNGtz6yc/hZ88+j6ViBTUS73lpq102g+QAo2oy/4azRMY3y10BXp3HzLlIjwqZjD3bbAgOhghj2x+C99GjqJfnUXrtNOoL/0C5UEb/wGaM3zaOz3/tQfTlcqgu17BcipDyszZ5s0VcN21s3hxcB/x9VqHPF7hmUM51BTiWff3Rl6Lh7Z4n4qLW6GpW/rpPJCysUdAMYHBsAmbjBApFhbv25vHKTGhTR40qDGvM3kc4hZg479j2i4KHoFaqkU1TIa3dfO2lx0+04Ul4pSFP3Xp/qPuNWkmrLXk2MdcyXywDvzji4y+vknY413Vwes2as5cnjevokvXZQ3W8m35hkOslXtqfSbyQCBLqNMQ3PuPtq1Yibt5sZTHkzCY0ca/eNhfFpZGeA1mNI8cDjA1zbyhsjgu0aRJXF67vV1ODMUIXpcmDNQz104WrFOnj92GqIx50HnL/tH766V+Xd2bT3pp+kWHHqFNWnrg+hXym0VkLeyOuU6WZLwi8PKesi/TRHX+ppvXRg/lnPz0qb0ePP300QZ54Jbzv+z/XP8hz9yzQc31ujE5VjrewdxIlTGbIE4/uSx25Lus9iDX+eNS6bh761cV7zpzL7y0UsbkWiKvIn7N8dV4LYOqkBdmiksua+tiInLlp08Un+1//0yO7du1qXqWvjCvjnTj+D8SthzamBKAPAAAAAElFTkSuQmCC",E$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5437_79067)'%3e%3cpath%20d='M27.395%2036C26.1435%2035.9986%2024.9203%2035.6274%2023.879%2034.933C22.8374%2035.6273%2021.6139%2035.9985%2020.362%2036C19.113%2036%2017.882%2035.625%2016.846%2034.933C15.8189%2035.6241%2014.61%2035.9954%2013.372%2036H13.334C12.4944%2036.0006%2011.6633%2035.8321%2010.8902%2035.5047C10.1171%2035.1772%209.41781%2034.6975%208.83405%2034.094C7.65642%2032.8996%206.99679%2031.2893%206.99805%2029.612V17.362C7.00005%209.995%2012.994%204%2020.362%204C27.731%204%2033.725%209.994%2033.725%2017.363V29.616C33.725%2033.009%2031.099%2035.808%2027.747%2035.991C27.63%2035.998%2027.513%2036%2027.395%2036Z'%20fill='%233551F3'/%3e%3cpath%20d='M27.395%2034.5932C26.2752%2034.5924%2025.1889%2034.2104%2024.315%2033.5102C24.1961%2033.4145%2024.0476%2033.3632%2023.895%2033.3652C23.7174%2033.367%2023.5457%2033.4291%2023.408%2033.5412C22.5392%2034.2237%2021.4668%2034.5951%2020.362%2034.5962C19.2576%2034.5949%2018.1855%2034.2234%2017.317%2033.5412C17.1835%2033.4338%2017.0174%2033.3752%2016.846%2033.3752C16.6747%2033.3752%2016.5085%2033.4338%2016.375%2033.5412C15.518%2034.2199%2014.4581%2034.5914%2013.365%2034.5962H13.332C12.6806%2034.5961%2012.0359%2034.4649%2011.4362%2034.2102C10.8366%2033.9556%2010.2945%2033.5829%209.84201%2033.1142C8.92225%2032.1822%208.40639%2030.9256%208.40601%2029.6162V17.3672C8.40601%2010.7702%2013.77%205.40723%2020.363%205.40723C26.955%205.40723%2032.319%2010.7702%2032.319%2017.3632V29.6162C32.319%2032.2612%2030.277%2034.4432%2027.669%2034.5862C27.5777%2034.5909%2027.4864%2034.5932%2027.395%2034.5932Z'%20fill='black'/%3e%3cpath%20d='M30.912%2017.3635V29.6165C30.912%2031.4925%2029.465%2033.0795%2027.592%2033.1825C26.725%2033.2323%2025.8704%2032.9582%2025.194%2032.4135C24.416%2031.7875%2023.321%2031.8155%2022.536%2032.4345C21.9163%2032.9237%2021.1495%2033.1891%2020.36%2033.1875C19.5714%2033.1889%2018.8056%2032.9235%2018.187%2032.4345C17.8057%2032.1306%2017.3326%2031.9651%2016.845%2031.9651C16.3574%2031.9651%2015.8843%2032.1306%2015.503%2032.4345C14.8904%2032.9183%2014.1336%2033.1834%2013.353%2033.1875C11.405%2033.2015%209.81299%2031.5605%209.81299%2029.6125V17.3625C9.81299%2011.5375%2014.537%206.81348%2020.363%206.81348C26.188%206.81348%2030.912%2011.5375%2030.912%2017.3635Z'%20fill='white'/%3e%3cpath%20d='M18.28%2016.4366L14.35%2014.1666C14.104%2014.0248%2013.8117%2013.9865%2013.5374%2014.06C13.2632%2014.1335%2013.0292%2014.3128%2012.887%2014.5586C12.7452%2014.8045%2012.7067%2015.0966%2012.78%2015.3709C12.8533%2015.6452%2013.0324%2015.8792%2013.278%2016.0216L15.604%2017.3646L13.278%2018.7076C13.045%2018.8559%2012.8783%2019.0886%2012.8126%2019.3569C12.7469%2019.6252%2012.7873%2019.9085%2012.9255%2020.1478C13.0636%2020.387%2013.2887%2020.5637%2013.554%2020.641C13.8192%2020.7183%2014.104%2020.6902%2014.349%2020.5626L18.281%2018.2926C18.4436%2018.1985%2018.5786%2018.0633%2018.6724%2017.9006C18.7662%2017.7379%2018.8156%2017.5534%2018.8156%2017.3656C18.8156%2017.1777%2018.7662%2016.9932%2018.6724%2016.8305C18.5786%2016.6678%2018.4436%2016.5326%2018.281%2016.4386V16.4366H18.28ZM27.182%2016.2906H22.018C21.7338%2016.2906%2021.4613%2016.4034%2021.2604%2016.6044C21.0594%2016.8053%2020.9465%2017.0779%2020.9465%2017.3621C20.9465%2017.6462%2021.0594%2017.9188%2021.2604%2018.1197C21.4613%2018.3207%2021.7338%2018.4336%2022.018%2018.4336H27.182C27.4662%2018.4336%2027.7387%2018.3207%2027.9397%2018.1197C28.1406%2017.9188%2028.2535%2017.6462%2028.2535%2017.3621C28.2535%2017.0779%2028.1406%2016.8053%2027.9397%2016.6044C27.7387%2016.4034%2027.4662%2016.2906%2027.182%2016.2906Z'%20fill='black'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5437_79067'%3e%3crect%20width='27'%20height='32'%20fill='white'%20transform='translate(7%204)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",M$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='4'%20y='4'%20width='32'%20height='32'%20rx='6.4'%20fill='url(%23paint0_linear_5437_79079)'/%3e%3crect%20x='4.80005'%20y='4.7998'%20width='30.4'%20height='30.4'%20rx='5.6'%20fill='black'/%3e%3crect%20x='7.19995'%20y='7.2002'%20width='25.6'%20height='25.6'%20rx='3.2'%20fill='%23202A2F'/%3e%3cpath%20d='M25.2454%208.85742H19.2454V20.8574H25.2454V8.85742Z'%20fill='%230EE827'%20fill-opacity='0.35'/%3e%3cpath%20d='M11.7895%2018.9218C11.4758%2018.8949%2011.1817%2018.85%2010.9072%2018.7872C10.6424%2018.7154%2010.3973%2018.6392%2010.1718%2018.5584C9.95613%2018.4776%209.76496%2018.4014%209.59829%2018.3296C9.44145%2018.2488%209.32378%2018.186%209.24536%2018.1412L9.87771%2016.9567C9.94631%2017.0016%2010.064%2017.0644%2010.2306%2017.1452C10.3973%2017.2259%2010.5836%2017.3111%2010.7895%2017.4009C11.0052%2017.4816%2011.2257%2017.5534%2011.4513%2017.6162C11.6768%2017.679%2011.8875%2017.7105%2012.0836%2017.7105C13.064%2017.7105%2013.5542%2017.3381%2013.5542%2016.5933C13.5542%2016.4138%2013.5199%2016.2658%2013.4512%2016.1492C13.3925%2016.0325%2013.2993%2015.9338%2013.1719%2015.853C13.0542%2015.7633%2012.9071%2015.687%2012.7307%2015.6242C12.564%2015.5525%2012.3729%2015.4806%2012.1571%2015.4089C11.7453%2015.2653%2011.3777%2015.1172%2011.0542%2014.9647C10.7405%2014.8032%2010.4708%2014.6237%2010.2454%2014.4263C10.0199%2014.2289%209.8483%2014.0046%209.73063%2013.7534C9.61303%2013.5021%209.5542%2013.2149%209.5542%2012.8919C9.5542%2012.6407%209.60812%2012.3984%209.71596%2012.1651C9.82379%2011.9318%209.97572%2011.7254%2010.1718%2011.546C10.3679%2011.3576%2010.6032%2011.2005%2010.8777%2011.0749C11.1522%2010.9403%2011.4562%2010.8461%2011.7895%2010.7922V8.85742H12.9954V10.7653C13.2503%2010.7922%2013.4954%2010.8326%2013.7307%2010.8865C13.966%2010.9403%2014.1767%2010.9986%2014.363%2011.0614C14.5493%2011.1242%2014.7062%2011.1871%2014.8336%2011.2499C14.9709%2011.3037%2015.0689%2011.3441%2015.1278%2011.371L14.5395%2012.4747C14.4611%2012.4388%2014.3483%2012.3939%2014.2012%2012.3401C14.064%2012.2773%2013.9072%2012.2144%2013.7307%2012.1517C13.5542%2012.0888%2013.363%2012.035%2013.1571%2011.9901C12.9513%2011.9453%2012.7454%2011.9228%2012.5395%2011.9228C12.2062%2011.9228%2011.9071%2011.9856%2011.6424%2012.1112C11.3875%2012.2279%2011.2601%2012.4298%2011.2601%2012.7169C11.2601%2012.8964%2011.2944%2013.058%2011.363%2013.2015C11.4414%2013.3361%2011.5493%2013.4573%2011.6865%2013.5649C11.8336%2013.6726%2012.0101%2013.7758%2012.2159%2013.8745C12.4316%2013.9642%2012.6768%2014.054%2012.9513%2014.1437C13.314%2014.2782%2013.6376%2014.4173%2013.9218%2014.5609C14.2062%2014.7045%2014.4463%2014.866%2014.6424%2015.0455C14.8385%2015.2249%2014.9856%2015.4313%2015.0836%2015.6646C15.1914%2015.8979%2015.2454%2016.1715%2015.2454%2016.4856C15.2454%2016.7548%2015.1964%2017.015%2015.0983%2017.2662C15.0101%2017.5175%2014.8679%2017.7508%2014.6718%2017.9661C14.4856%2018.1815%2014.2503%2018.3699%2013.966%2018.5315C13.6915%2018.684%2013.3679%2018.7962%2012.9954%2018.8679V20.8574H11.7895V18.9218Z'%20fill='%230EE827'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5437_79079'%20x1='20'%20y1='4'%20x2='20'%20y2='36'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23D4E6E8'/%3e%3cstop%20offset='1'%20stop-color='%23767573'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",z$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M34.9013%207.2002H10.604C9.83641%207.2002%209.09532%207.84723%208.91004%208.66305L4.03999%2031.3373C3.85472%2032.1532%204.33113%2032.8002%205.0987%2032.8002H29.396C30.1636%2032.8002%2030.9047%2032.1532%2031.09%2031.3373L35.96%208.69118C36.1453%207.87536%2035.6689%207.2002%2034.9013%207.2002Z'%20fill='url(%23paint0_linear_5437_79143)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M19.7489%2026.5009H25.2421C25.8826%2026.5009%2026.3999%2027.0942%2026.3999%2027.8223C26.3999%2028.5505%2025.8826%2029.1438%2025.2421%2029.1438H19.7489C19.1085%2029.1438%2018.5912%2028.5505%2018.5912%2027.8223C18.5912%2027.0942%2019.1085%2026.5009%2019.7489%2026.5009ZM23.3208%2020.6216C23.2222%2020.8374%2023.0252%2021.0531%2022.6803%2021.3228L12.4575%2029.3596C11.8909%2029.7911%2011.1027%2029.6293%2010.6593%2028.982C10.2405%2028.3347%2010.339%2027.4448%2010.881%2027.0133L20.0938%2019.7047V19.5429L14.305%2012.8006C13.837%2012.2612%2013.8862%2011.3713%2014.4035%2010.8049C14.9455%2010.2655%2015.7584%2010.2655%2016.2264%2010.8049L23.173%2018.8956C23.5917%2019.408%2023.6163%2020.1092%2023.3208%2020.6216Z'%20fill='%232C5591'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M23.2368%2020.6216C23.1387%2020.8374%2022.9426%2021.0531%2022.5993%2021.3228L12.448%2029.3596C11.8841%2029.7911%2011.0994%2029.6293%2010.6581%2028.982C10.2412%2028.3347%2010.3393%2027.4448%2010.8788%2027.0133L20.0492%2019.7047V19.5429L14.287%2012.8006C13.8212%2012.2612%2013.8702%2011.3713%2014.3851%2010.8049C14.9246%2010.2655%2015.7337%2010.2655%2016.1996%2010.8049L23.1142%2018.8956C23.5311%2019.3811%2023.5556%2020.0822%2023.2368%2020.6216ZM19.7795%2026.6357H25.2475C25.885%2026.6357%2026.3999%2027.202%2026.3999%2027.8763C26.3999%2028.5775%2025.885%2029.1168%2025.2475%2029.1168H19.7795C19.142%2029.1168%2018.6271%2028.5505%2018.6271%2027.8763C18.6271%2027.1751%2019.142%2026.6357%2019.7795%2026.6357Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5437_79143'%20x1='9.76654'%20y1='10.3425'%20x2='29.068'%20y2='26.4694'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232D4664'/%3e%3cstop%20offset='0.169'%20stop-color='%2329405B'/%3e%3cstop%20offset='0.445'%20stop-color='%231E2F43'/%3e%3cstop%20offset='0.79'%20stop-color='%230C131B'/%3e%3cstop%20offset='1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",L$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAA0RJREFUeAHtmM9PE0EUx18pJCRaugUhQkuqXgi3eqDVpJFK+g9w8Ejkohcg4I8DFynECxdEAlz0gA0nNYF4kkODRDQmNQQ8NRhjbd1FrQHankja3XFm7DbN7rQMyS7l0E+y3dmZt/u+mffednYAatSoLpZKg9s//wawRUhKJj2/90QBLNgcocJt+EyvAQo/UBwv2qkeCm7o2P/ri+3OtOuSewcpEL7quvACTsJ2PC5sJf8sPQw9Rh2dnaigwPCjw9WJJmfm0FYyNUt8Ai+f4+Ls3dEHpgnTHndG76NoXFpiaanXdnz8Gh988+rl2LO5GXrd2NgILS0tUFdXB0aSy+Vgf3+fnp/PPYFztvODn2Lx8PXuyxuldroc/BD79u5WMBD4JYnQ0NAAbrfbcHEqiqKAKIpwdHQE7U4XvI683/B3X7lZaqPzLCV+eIg4Qmtrq2niqHP8bBIdAvEpJr57dDbajj1RLCar1Wot9i8vL0MwGAQzRKpgkXbduLZDlmVg4XQ6YXFxkR6kbQZKXtalnE4gwnnBYmhoCKLRKJ3F9fV1mJ6eNlwozkkExwlU5Dzz5lgsBgMDAzA+Pg6SJEF/fz8VOjw8DMYJ1EePO8Qqq6ur0NfXR2eT4PP5wChknhArZUKs4vV6acGQczabhUgkAkbBil693kguK2xkZISeCSsrK7CwsEDDbRSs/OcWqBYFCe38/HwxxEbCSi+9QIUtkAgis1ZO2O7uLpSjq6sLeGD51gnEicq8mVSv2XDNIFIqV3E5eGepEkjmeM0cV8VmIvMILBfi00DhmkFURYFIHz3GX10VBeZ5ZrCaApUzLhAXCcdqpopVjF9xxy8WZPmMVzGqqkCOKrbZbGm1fRqzWZpS2Pehdlwn0C7YdxwOB20fHByYmpPk2alUirYF7FMQhC9aG/1iQZanfNd8gbW3a/R7NZFIQFtbm+Gfn0Sc+uFOCAQCkM/nwlw3PwqFlnp7e09t6+MG9jUxMfGUpaWe1Wm1WO75/f40zomxzc1NyGQyYAaCYIeeHi9ZpYdxhCZZNhW33/AacBBvmd3OpA896WxW/aBHFry/hkr24TTXWrT7dNSmydaUdjQ37+DmFF6tb0CNGmeUfwIH0sS3Pm7dAAAAAElFTkSuQmCC",F$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACs9JREFUeAHtWHmMVdUZ/93tvXffPjvzZpiFwswILkEpIIqMWlAWjVpBTTXGYk1tivoHWhurorVp2miiMRUaW7FWkSaS2IoLdYPUBkXBBkZRUdaZgWHWN2+767n9zrlvGJlhebX/td6bk3lz3z3n+53f9/uW84Bvr//xS/pPXm5vb1d7e3tlfMMrFAp5V2y/wl2FVazUOacCKC+dtDR275U///PU1NT5AUkLecwDH6PTRj6X/kySJRoyXOZae47seXvZ80uXfdL7Sa74UskA5Z0rdv6ipbZtVWY4RxO9b8zaqS7P81gkqct9ff0PNz428SF6xEoBKO29a/9D8WDiPpex0oB5xwyKJSXpFKuf4NJkxT2Q2ffI9KemPzwW5DgATcmmRGWy6n7bdmXmejjdcB0Gx6XhOAjODCA4S6PPbvEZQylrmLajtFaf8cDihsWJsXjG7XH7rR+/WR1JXSJDHgeeMyRuiz5bDHJMFuwxj8BkHDStSUFSJOy7tQtqXIUs0fdEpzPgQA7RirokTMrSeGpdEndndv+mOc/MWnhKBlsq2trhYhx7nA3XJWZMhtg1YVTcXQYWBSzbESN8UQjMoHeyLsLzQvTMhkWsMp2hcU0talaWwy64tJbrM8uOX19iknR29VkXj8UzDmAQAZXWIDCeP5j/lzEGmxY2LQtSUII7xFB+XQKWbMGwDKgTFXqHswmoDSo9M2HYJurvrYbTx2iODKNgiTX4Wq7jHWeDg9QQCGKMV8cCDFqkH9dl/hAL+Z8doTXaPd2Z3TnBgENsNayow+DhNByPdkWu5sPxHAx0DqHt8WY4tBEKVqR3ZuBqLgF0it4oAi3aEJq1PTShKXhSgKlUSmG26zNB9pgQOU0k11ikMcdyhNv2bexEMKkJMFa/ibJ5CRTShgg/PoxhA+WXJIg5hysXalLG7qf30lxLBJOdp7UMH5hvA8KmS+QUagrKSQGSxiROBAflFiPRSDvkpipM/nUK1VdVIDeQh605OLSlm9zpCUDfuaoR3R8fId94AlDXh0cwbcUUeCKAPBze0gdHsWhuAckL40jdXomqW5Iws46wwXXJXD/iT6vBEea4LrgrjJwBvSkgojExPYzz152N1lua8d6j2xCu1IlEhgIZVnQVkkoRGpAhhSTYg46I+lCthtfv3IyJl6dw7m+nITqV5pDK+HMzZxal4zPJySkBIBeuD5K7A5SZdtz5BdQyWcjXGWComJbADz9divU3v4xIlS42VXdOijKuJErZlAXNYDaDVq7g2Xkv4cZNV6N8WhnMQUuA1hIqdj+xn7KAJ2yMBExJDPoR7O+K/7UtG5m+LN666QNoVSrtnhYhEMZhGzf9/WrsfGU3tJAKPRZEYbAg3o3VxqGGFWx/ugPXrb0S2Z4CUHS/XhXC1gf/hUx3FpblHLMjotkpycXF3MRGJ/Jd8vTy3Oy/YscfOxCq0SATW2a/i+k3TsXBjkPk/ghiZTEkqwhchYRPX9uDyXMnIdefJ9dDMP3Zxi/x0vWvwcgbsF2nqLuv58Rx+KCOY9Apvgw/FxbILdVLyhFtoURMGbwwbOLVu99FIKrhzCVtiNWE0bKoWYCQSXtcqyzvonXJZPTvGER+yMS+jw7ANm3Un5fCrNnnQPEU5L8y0bMxDSXKN+uzy3jQ95wWIIq5yUHVZXHM+nELrGFH5DKv2BVMXtRAwUBgZA+de7sxUW+El6TkPeIhlRxj0mZSGUy8oA71C6rI+Kj7JH7PldD2k2YcerEXPRvSBFIlT53OxT0oupS0R2J0OSjH350YYn5xEe4WEny2kCFWGTJZIGsDOarTw1mPciGQHkqLxmHUijfa9XEpyzxveiJ5i8zhsBJc7Po1l7N44G89+OS5r1B/TSUSrWHqCj3kKSEf3NZJLlUwZWYjDKosufoczLwGtTzgR3q/BT1P0eqq6P94CB2kx8KggUlzGqAndSJexvCeHA6+1IdoPEzFNQiJ2zxBFJ8AYDHVMB+kFAH2vt4F6xUTA4cH0bq4GZffMY+iNQ/ToLRhuFi/4U+4ev6N8I5SlFOSk6nUvfDGWixb/n3E9Sgu/un50KsD2PyrbXj3mW2obKxAQA4gEA5RWWRQiBTZY8L22Ou4wlyDmsjmRZ9njxhdop5ajAq+a8D0KOro87K1C5DtNUSE8xEuD+Gddf9Ew2WV6OjYhe6hLpEH40Y5pk45E4NUsxf9rB0WlTxZUUQjq9cGsG7h65AMFUEliKAcQkAJUQpVMSFUh/bXWqM96MmdWIPAsXBnLq1GDbUsKdDjOq79w3wMUz4TZxKSSrIuhkcXP43LVl6EhF6G+kQTZs6ejZnnz0ZNsA5lkTJceO0M/PLspxBOhahKMDGv0G1h2YYFSDTEiB1yIFPgl1eUWOocv3CD+QALPQ4uf2IW8n0meI2KUHk7tPMIVrb9Bqs+vwOFXhPxRBwH3utBc+MkNKWa0LNrEPF4DPlBE/e9dTtWxB7Bns0HoFWqouGxqcNZ+Oxs5DtNSJ5vRzQLpeRBAW7kRZqsBVUMHchCDSg4RE3Au7/7gDpjYPmaa5HvKkBVVCQnxGAM2NADupimaRol7KRoDgY7M1j+5DK8/ej7eOPBrVj0wFw0XZqC9aVFuZSCypUFTSJPsNNoMIVU+NWLOnJHzcPkDb+v49rLFXLIWzl4IXoGG+neDO757GaYfZZY+Z3V7yPeFMZZ17SI/3e9vAddW3tx6Y/mcLOIEetPLvkLIjGdGCFO8grCwQiikSgFSxAq6U+GgqpQLRZuOePkGqS4ouOFNFqCRMnzKInKCOhBUQEk0szC+y+A2euQ6MnlE0PY8vvtiJRFBZuqqiFaFsGujV8gQVWGv5PtMzD/rjlirkx9czBCoALqMd35DQr3sUSpuMc9qQb3Y781ooeRptXjgcLIsKfSHgNwM8Ck79WBn4e0MhWPz3kRVakKfhQiMLIApNCdrCnHk1etR7RaF+WvceYEsAyFhafRRgOkPUXonNsQLf+otMyTAuQStG3LPNY8evwwQwA9DjAIjRbmqcGmVl9PBfDCdZvIqEdwVBzdNSBOa1wzRzoGiCfuzACev2UTRXxEVKcApRQNfASgMK0IEhhpkg3eso/5hWHc+W9N68Z3Jqj17RQfEhPvMtHDUdr2NemZyAwPI5POIprSRTLn7+TTJu459ANRsh5rWQ89HOScivyX6zERiYQRjcVEglYlahCKt2Cdo/Ik1ud0/+O2zxe1fx2PMhbgfuOrN66vvG1lxsmIDt77Winm/3BNStRqBaNBwS53J89nqkqaouNn14d96NuRoV8LCAhxJZPu9Agl40BAMCqe0Rxe7kRrTYPbmKDVSsv3Xjq34BSGTwnwqN1VaNPPK6tUamcwLkC+AJP8QzvzD+miH/Ek4VqZBg8ebrT7g34c/mhQ1FYBhpji7yhFhyskFS4XicBx93JBcHCkS9aR37765d7n1o/FMw4g5+nNoQ1vnhu5sHZK8KwZw84wE/zzX7Y4SO573olw7oRBbogzQu6UFQHKDyhNfC+AcZZHgImk50uf1vOqlVrsyG1dfc/BG+7ECX7hOtXPO0oiVNPwUOXqdWeEvjuDTKs8C3ItjvSFfvfF4N+OYNcTEAi+pBzT2KgxP8I5q47kWh359z9cO7Dqho5CRzdGy0PJAEeuEQtaAomwGw1p+C8uJWvYaaT5IcUsru3i2+v/+fo3XDNIGH8X+FsAAAAASUVORK5CYII=",N$="/assets/vscode-C5BXgFjm.svg",R$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAYAAADFw8lbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACSFJREFUeAHtWG2MXFUZfs+Ze+/M7uwnLNhiqd1dWknaBETS+EO0JRWllRCjjSY2EhP/GP2BMSZG40fU4A/RRIs/FA1iJNaQaAKCiiG1dGu7okVKCK6lFWrb3a3b/ZiZnY/7ca7v855zZ2d3Z5chJIQfPcnZO3vuvec87/N+X6Ir48p4aw/V6TP79+/XpVKpv2twsC+uVHzj+4oaRMbUlDG+Mr5R+SCQFxphSL38O451SrwULUap1nGKe55XNPl8V3jq1PjcxMREmZc0z9TN9UGsc09974EH7v7oRz7+8ziOBiuVCimspnx+Pk9a56hULpHHV8/zyGdwURQxeEM9vT2U8lUxjlq9xr9TynmacjmPYn4mKOT5nqLJixfGv/qlL9w5NjZW4p0Tep1ABc4Lp185UyktbDGGCdFMYCMk3/cYVMAHatI8G/UGU8EgGGwQ+MxiwjOiYpGBpgYyUbVWlfuel+P3cpQw6LBRpyiOIZR5x+br9Zmzr3xuz23v+SmfG7cDpNcASv959fy/5i7PbE6M0dg8x4wVi0W5BnlfDtRMryfAPVJaZfLJ+5kecfX5vhymPdGCh/2YWdzM5/N6cmqarhq86uBDj/zmDn4s1w6P1w78gw8/ctdseXFrsdirw7Aum3qek4nl1UqTYbYUA8XBJjECCSqXTT2fIacCMmHWUqcjrUlYxj+JSRhkwLPAvw3V6zV95969T9AaWm6HPv3Bjw7+tV6rd+dyAKIdG+59BgkI1lRTmQJQkVyzNc0swi4zWmHbEAwzSawpejloRvF7iQi8MD9vRrZuPf/0U3/650pQbdFPzy6k5y9cdCDtIyY17tCMuUzN9iC24+YVQgVBQbQQcgTI1qAZAIbdglnYumag9VrNaobfZ0Ge23nzjltWYlql+l27dg1VGw2xOwvIsiJAmAnYYsKqNknMv7UwFEexPAdHkk3ZbuMYaxYogOFZD4yLaEqAJwmcSYndY++Ao8bQNVcPU5uxCmgvjzjkDYS5VNSMMAM7SqyXyqGwS8X3ARzPJHEijHR3F+m+b32denp6RAjTVLsW54NZ9Pb10Wc/fy+VywscRXwLhMFqZjyndb4joIVCIYfNEOtgj1Aw2MmAivbBDE+Yhkq1qBFCxQz+8swMPTt+QoBmppPZJoTCFV7/2G8fpSeePkqVcllCnhU+5hAY6Y6AVuMYLisGn6YOmAMHlhEfhVXccF6vhTlDU5MX6cTxMWa1u+lkSmVhC94m1FLM9/r6B+jFF07R9Zs385pPEZuInKW06ggo25Gq1+tyEBjKvLvY00df+/IXaeyZI8JIkyU3GxzA//zMOB09fNiBW2ss3bPgVOaTrDn2CdP+La/9Vto5Rioqj5nd3/3iZ/TcP/4uQX8lSMwbt2+neqNG/554SewUNkltnlsWptLE2neSiHnBXo2JOwMaaw2LE6+MokTsD1569MhhYXat8d7b3k8zl/5nYw85QLT+QOKASSHl4mmchUTQ9tm2i2zY2oWeLIjDFjGEjRYHwQG1apXedetOOvX8Seou9pDqpCYjK4jk+9TGWQlja2T1VasMTCEuQvXKBekskyw7IfupbDLYMjxCY0f+so59LhdO0qjzAZBi3F7pGka6CqjmGtIG4kRSIDZG+ZY6la46nu9ve+eN9PbrrmMvft7l9fa22SqczVBZik0FCLQXhXFnQMEoJM3KNclOqbXZ5YctgfjQ3g/TpelpKQMzvjoZYl5uGpdUdPvotLaNKmczArhF9RaczoigxcUK3f6BD9Lfxo9zbOxfJkDrO00pW9YTF48lRhtb6GQV2GsC9TiQIlRkhYMEthWNQnYWpEcuR9B+6g9PSo3aOloBq+z/lnUU0onL/+RsV3XKKG+QIqCjSDCpZQ32SsscYemwYXYiONz48WPrhi9qZZUsCYibSrmAn1o2tOrQ6+NcLuWSXqT1clpYUlltRrQq9OzecwddujTNJrBIayCkpnBNzIqq/PyW0RtsLHUg8bdZTq4YqwK+jqLUuIKD5MW0WQAvy9s8uCqn9+2+nS789xx98lP3UBbos5grlRe/b9sWG5ex0+DgIH3iwD2cxSY4i3VZ+3TnJUmHQLkUlU7SplAuIDhUjYyO0jDPi1x0SGdpKxIO9DXavuMmmp2doQOf/gwVuK0AIyFvslSUaGkEUcah7kQ9Bo2hWN62bZtoDt3t5NSUCIPQ2BFQ3tDYQxLRNvofjPt/+GPasXWLjXmuXCt0FWj76KamrWHedPMt9MtDj8rhNS5uuL60DSHHYszWwhnaiji5oDbo7xugcqXEewVpR0C7unQD9aF2DoUaNAwb4t0nX5ygsy+/LEzhPsxDCl6Ubq6wQB1aZaYD1+NDaJ9bDk86Udu+4FkT8R7KFswoc4eGruZrCEGSjoBOT08voDMsl0q0YcNG6ufYGEWhgJifm2MWu+S3AOErF9oysbYwvyCRYrG6SF2FLnQLYkJQL0BCYHxFESvXupk+OdAw+JSrrwblqtX5joAeO3asHHAbC7uUbAHpXTOXZ0BwFKgVRo9POAUGBKBSv7psxuqTjxMAn5lOxOvQjm1nbH+Slw8WRlgtl8oI2emrZ8+cbAe0bdCanpx6lu1I3E/6d20/D8G2wM7AQL/05AAC9aI0AzCw38f9EGzO93wBxN+raH5hXp7DCIJ8M/uE8vknkW4VLUlQCNInH3v8G+0wtUsDat++fQP3H/zJbIHB2BaYPZmNXhKBtLS2T5pnVYNBsIb2o7vYLQ4C/Ye8HnLuD3xrm9K9smBQPT7v4GQ4oe+aOnauuKfgz2689pq3tQPa9vPJ6dOno9179py/YXRkXxjGCpIvsrozBvGNCQP/25kIq7776JDZIjwbawCknU3CQbNat1mUsAMNb9roDfSyJy593Xtt1fNIPnbX3od+fejQ3Zs2XisMYNMqO0mZAc/MXBa7AosDA4O2PeGXoGb0Wwg5AXt6pn5bENvjss5UshB/LSsW8umGof65+77zbZAG+k2nql8piHnw4V8d2Hnru+/1C8URPqILVepAX48EcrsL2hYjwVo78/BYnYG/lKFg37V6yETqlL08btQalXMXzp34/eN//Mr3v/vNlxwWQ29wdFpivtX2vjKujDdt/B9Vn+PpjUxyeAAAAABJRU5ErkJggg==",j$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAADQlJREFUeAHlWAtwXOV1/u5r3w/tQytpVyvLdoRlG+M4Ia4NxMZ2SELo4IRX6qEtbmEST6epoU3K0EIKZZpCmk7JNCRpaSkJEFJahhhSY9pJggfHJiHYxg2OJSzr4dV7tbvSah939z7y/XfltwyaSTLJTO7Mr6u797///f7vnPOdcy7wG35I+NUcyvbtO9Ldy5bdl2pftDHIY2JivDQ9XejPZDLPvfLK3l1vvnlgeCEL/WoAJpO+jcvfe7KnpyeqV6vw+QK44qoN6OpsR80wEAqF7ZaWNimXzT5+zz07b5/DYeOXAJDz7+d4S8LVk2eeLRbPXecN548n6UVElf1d4ebWW2o1/Y5auFXe8sF1UFUXNFWDbVtWKpWWPW73C3fd9emtfEjhMM974UUPGStXqi13/suj2nvf90nJ7Q3CsM48YV/kKduGVTVhTZdhFSZgl4uw9QoqhmV1PvOAjGoRy7uXw+P2QFEUqJoGRZbNLZs/otxy87XSPIzMeyixr/5wm/+qtU/WTxbtbBnS+6IKVjSpCKu8Kc/h4x/5vBVsy4ZRraA6nYPOUSvNoF4pQy+XoLu86P+ne+EO+hCLxWnqJprfB5fbjRXd3VY+Vxx7+OH7UmeTNB9AKfHo/j/Qlq/+93y2qj59ZQAjVQuPHNMxxnPdmkN2GhAB81LRQLPJ3LGNerUGvVIhc1XIdo3nMt0gT1azWPyTXZg8/Ar8/gBCTU0E2ox4cwInB/pw7bXXGZcsW6Nqqic7NTWhvfTSCxvnBZg+WLdyPTMYuiGC5mdzaAsrOI1rzp2rZOryqOpcZioWsjqB2Y17btkm0zY6vIRrWTiYrUKtzMDKjsB36GWUX34Cer1GE6vweLwo5KeguHwwayV8/IZtWL58pbNuMBidUs5HF//yvqclO7TysfUB6fIXC2gLqsKtnBeLh2ZrNtbHVFSIpnfGQoHAygbg4k3igir8gzMrpoRsTcJARUaz14VVUS+OFy0sG/wREl4NsiyjpuvoTKfxmZ33ohRKIZcrojg1gtdeexWlyiw6O7r/RD4foPvS1TdMztrySNlGUoAjU+CQOSSONU0K9o3XUSLQmCqhTJu7uYONzSqSHmCxT8b7OcfHuZWahYjc2NT+KWBpsgWr5CKSqTRWrLwMiZAPxpW34kAuj71yC5If345MScVoZhgfeP8Hcffdd3xDPR+g7Ap41kYMfO2njEJr7jcOP8EI/zteMOGTJAfgUr59kVdFhPQdmjRw6xIPWTUQ5vXaiBu7RwyaGziUM+AjvRNHDsH2h2DPFKFKFqTNd+CEbmHYDmBJQsbxumx95vprdv2scv0n2hLxnfMFidr+PaN+jauCZ/t0hNwSiMUZLr6IhDiggwTgI+ChkoUNZO4HI3W0hxRcGlGwoUXFnuE6JBLv5Zz/5b0Ov4wyI3XzM3+GbKWGUDiIob5+7F9+PbyhCKpqCFvaXTgwZSP71x/yptPp6MmTJ7PEUzvfxDLoT01c2BQeTzBlHUh5ZOg1XvJeG//XeKtQFqYFvp+p4aG1fswwwj+cdOGJXh390xa2LSGDx3XQ6sjOGhjf/ypa0x3UPRXmTBaDq7dCCcSoZx0wo51ILVoCpXmxE6QENyLAnbLeWUenLGRDElFhNsaKEKmniYQfkggUGLH5is2U1fDNADfzyMEy4nz65UEdFb3hr48eLiPokZxN6p4Atmeew/HMCNKpJPqydWQQRFcqBTmUgOShHgYjUCKtXKX9PMbOOQwJ4sUiank2yOLoLJliVFZr4sUMIhHQvGcbOD3GZ0x84YoAfjxmcBMSnt4UxBs0rWBcqhuwv/8s2rtXMXu4MD06gCNd1yEQiCCrRGDKPm5CobNxaC5cEBMX/GKeGrZjzpmy5TAlzNzulZGl39m8J4bYhGBrXauG+/bPIkmfDVK41n0jh23dXmdDJVcUOz1H0NPXh0XpFH5ysop4tAmSL4YyfEj5XA1riYCcJ31eCJC7FpPteoMdsSdqKupk81jWgGKdtQn+P5U3cdN7PMhzI29Rfja0aVjGQLmE4p4t2GjZ80VEl65CiOltYqAXb3d9DKYWhMWhKS6YXMeqNdzl3DLhnQDaDQZn6G/CnF5eRjWKL68dF5gbCud89nf8+Ku9RYQ1GVsZGAMELPz08Tdn8beXjcH942fw1Leeou+14wfMTqoviFk5Ah/9EpaMIufKpxg0FgqQOxHmqdUa5mWadSLX8RBrLoB4ztH3Juij3RTmYxOG85IJ6mShYMHyhfHYHTfDHWmGz+vB8//1DDLt66G6QkJr4RXJ25KoDpYjSQ2/XyhAkTXMhqyIa+FnGTIjWWc2oDNaH7sujN09VQzmTHxpUwDfOVzBvsEa/uFDAczu/jcEYjG4KCsqy6rx8Ukg0eVErKwwMGzFsYJVb7iKY94FATQbAIVpMRcIAuxs9Yx5JY5Omvwrr5VoWsmRnyf2l+BnceBRJNz7mozwvkecotTl0lCrljDZvhmqzWpHDVAT5lLo3Fqn/H7hDM7JjAAmAkWItl5tyI4Ys9MmPrU+gCpFfJzM7qQfHuW5Tmc3LBXub30KnlgbNIJTWTwODw5BX7oJJjOGSemuMT9YdaEEcPK7XbcuGiTqhQAb/mXXbEfTciUT928Ks6KxnVQndqQpQhct7PgApYR8TM2aeOiaIMr8zTIKePxfD0KLNzvmrdcqGAlfjgeviaDgbUFHawzThoIwJelzu2cQZXGRn8taCwDIIs5qTBbMUfpwyyov7mbZFaEdxS2RQVqZd6eohzEuXuLiIj9HfARqemF+/ZOIhaME12Cvvz8D39W3Y6Dkx3eOMbNoZQQ8CsYYYDdf5sUPB2qOpJ1657sAHDgdBNJctB7qr7GWU9HPKqVIk5oEWCrZTuWcL8xRSnYnczY8hYNodRnMt25omkJ3qCLr7YZf8eDJIyr+cVscO/+7jLxaR5qif3So5tSQkmWfUYd3MbFtn+WD45SMCBfyM+BWxDUEGQQJn0KtM5AnyC3L3TiUqTcaG38EJx74MJSmuGNa0RANDQ5g9e/ei/+fCSAaDOLr+6q4cY0Ho2RvjH48Rokq6tZZQXIhwIvoYMOBBfoIE/4Qgb4+oOPGy3zYdaSCo6N13H6FH1/9vyIOk4VDlJY3v/0wXMyvmqpwqDBqVUzIHTg85sZ9W9OsflyUIwubuzz40du6I1txbl6eI8NhcKEyY5qnqhmgl0l/aUTFapr5/l0FtDPZRhg8//w/08wGUmO+EkC490n2uwTnsCdjfGSUtN8IF7vVv3/JxKUtHqe5+otn89jAjLOE6/WM1hqBQRcxF6iDFthLTLPc12zJKQiErvWNG/jjTSHk2FP0ksk7P8KqmBVsuSq274Jnz6eh+GNOreewV9cxYcaheKKoS2G0JfzYtj6ICvO1iN7tV/pxYqzOIJQcIhiamGbQNXwwY50N6IKuLvU3dTuFSQfMrJAbAYEgNe7wxvV+luYq/vSbOQToj6vTGkanZqB9lynNH4bX64ab2jeaGcRgxw50LOlCrLUTb016UWbn+cJnW3CCrcEXny+I1g9Vo4ElSqBR1p0DdgLDD6jSO5rY0kvlg6yK7/pYqJEjTTgCrNMMX6JuffPVWQTIgijne6d8qO66jUwFHNOqp9irBhGJt2FkNoDjWRVeRrSP/vbQi9O4k5urM+iqIjjmeuodHw3hQI9O7Z2tv5uJoR/fuzseVa0kvyKMn6g19EkEGv0jxV0eYUCs7XQjxFxv9O9F0G05ZhX+p5CJyYlxmO+5CbrhIaMhAlHZ28hYt9iF19kCtIVlZibHmZxMNXpCRwd7mURUtmr9r3/vfDwXNu6RJeHUjqOF3NsjyPzHIsR+bwBtnS6KsX3OQ1U1jtY9l8NFefF4XM6wTAO9/ePQ13weibYU0skkK2YPDnNTXpd0Tj0q3G98oI7J/+xE+o8GEelqxvBXknF+iJo6G86FqS5/olg5/O3PNS297uH0Hw7Kz32+FcPsSb5G8wxRGgSTIu0l8l+G7A07zIkhGvHsxATyiRuglBUMDlFW6G+SVnWWrc6h41S0UhXuuj6E9piG9tsGEW4LmpW39jxIcPl3Z7BxKJGPPvGXvlU3fcHIT1mTk6a87hI3lpHJMFOe1+/B03++Bk3Mt6LPEEOwd6znbVx9+6MINCUQiiVZLHhPe5EIN9GLFRitR5ne3uitIpZQLTXULFeOPv9g7qVbH8A82fidPr8JdmOxrS8+5e64cqOkBjWRZkRa0oa/C/XI31k+v08OBPxO5hgbyZiF1G2KEb+C2YQtpCdEbPK5fcapt7FBglnV9cG9r1YP3PP7pYmfCrMa84FYyAdMFY3X8Ntb2EdnVDyyHFrU3tU32PczKxJtluPxGIplEwPHJ/wIzPgvupJEXeC3QExPV9Doe+WLAftFD6Wpqanzqi2fGI4n2u1IPGmnFi+7GfNlpl/zoXq93lQwmBR9u4rfxuPnTjEKD0h39egAAAAASUVORK5CYII=",rp="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5437_79109)'%3e%3cmask%20id='mask0_5437_79109'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='5'%20y='5'%20width='30'%20height='30'%3e%3cpath%20d='M5.6001%205.59961H34.4001V34.3996H5.6001V5.59961Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_5437_79109)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.3001%207.39961C8.0614%207.39961%207.83248%207.49443%207.6637%207.66321C7.49492%207.832%207.4001%208.06091%207.4001%208.29961V28.0996H5.6001V8.29961C5.6001%207.58352%205.88456%206.89677%206.39091%206.39042C6.89726%205.88407%207.58401%205.59961%208.3001%205.59961H32.4138C33.6165%205.59961%2034.2186%207.05371%2033.3684%207.90421L18.5166%2022.7557H22.7001V20.8996H24.5001V23.206C24.5001%2023.5641%2024.3579%2023.9074%2024.1047%2024.1606C23.8515%2024.4138%2023.5081%2024.556%2023.1501%2024.556H16.7166L13.623%2027.6496H27.6501V16.3996H29.4501V27.6496C29.4501%2028.127%2029.2605%2028.5848%2028.9229%2028.9224C28.5853%2029.26%2028.1275%2029.4496%2027.6501%2029.4496H11.823L8.673%2032.5996H31.7001C31.9388%2032.5996%2032.1677%2032.5048%2032.3365%2032.336C32.5053%2032.1672%2032.6001%2031.9383%2032.6001%2031.6996V11.8996H34.4001V31.6996C34.4001%2032.4157%2034.1156%2033.1024%2033.6093%2033.6088C33.1029%2034.1151%2032.4162%2034.3996%2031.7001%2034.3996H7.5864C6.3837%2034.3996%205.7816%2032.9455%206.6318%2032.095L21.4272%2017.2996H17.3001V19.0996H15.5001V16.8496C15.5001%2016.4916%2015.6423%2016.1482%2015.8955%2015.895C16.1487%2015.6418%2016.4921%2015.4996%2016.8501%2015.4996H23.2272L26.3772%2012.3496H12.3501V23.5996H10.5501V12.3496C10.5501%2011.8722%2010.7397%2011.4144%2011.0773%2011.0768C11.4149%2010.7393%2011.8727%2010.5496%2012.3501%2010.5496H28.1772L31.3272%207.39961H8.3001Z'%20fill='black'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5437_79109'%3e%3crect%20width='28.8'%20height='28.8'%20fill='white'%20transform='translate(5.6001%205.59961)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",U$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5437_79100)'%3e%3cmask%20id='mask0_5437_79100'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='5'%20y='5'%20width='30'%20height='30'%3e%3cpath%20d='M5.6001%205.59961H34.4001V34.3996H5.6001V5.59961Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_5437_79100)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.3001%207.39961C8.0614%207.39961%207.83248%207.49443%207.6637%207.66321C7.49492%207.832%207.4001%208.06091%207.4001%208.29961V28.0996H5.6001V8.29961C5.6001%207.58352%205.88456%206.89677%206.39091%206.39042C6.89726%205.88407%207.58401%205.59961%208.3001%205.59961H32.4138C33.6165%205.59961%2034.2186%207.05371%2033.3684%207.90421L18.5166%2022.7557H22.7001V20.8996H24.5001V23.206C24.5001%2023.5641%2024.3579%2023.9074%2024.1047%2024.1606C23.8515%2024.4138%2023.5081%2024.556%2023.1501%2024.556H16.7166L13.623%2027.6496H27.6501V16.3996H29.4501V27.6496C29.4501%2028.127%2029.2605%2028.5848%2028.9229%2028.9224C28.5853%2029.26%2028.1275%2029.4496%2027.6501%2029.4496H11.823L8.673%2032.5996H31.7001C31.9388%2032.5996%2032.1677%2032.5048%2032.3365%2032.336C32.5053%2032.1672%2032.6001%2031.9383%2032.6001%2031.6996V11.8996H34.4001V31.6996C34.4001%2032.4157%2034.1156%2033.1024%2033.6093%2033.6088C33.1029%2034.1151%2032.4162%2034.3996%2031.7001%2034.3996H7.5864C6.3837%2034.3996%205.7816%2032.9455%206.6318%2032.095L21.4272%2017.2996H17.3001V19.0996H15.5001V16.8496C15.5001%2016.4916%2015.6423%2016.1482%2015.8955%2015.895C16.1487%2015.6418%2016.4921%2015.4996%2016.8501%2015.4996H23.2272L26.3772%2012.3496H12.3501V23.5996H10.5501V12.3496C10.5501%2011.8722%2010.7397%2011.4144%2011.0773%2011.0768C11.4149%2010.7393%2011.8727%2010.5496%2012.3501%2010.5496H28.1772L31.3272%207.39961H8.3001Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5437_79100'%3e%3crect%20width='28.8'%20height='28.8'%20fill='white'%20transform='translate(5.6001%205.59961)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",K$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5436_78897)'%3e%3cpath%20d='M35.911%2020.0773C35.911%2019.7026%2035.552%2019.4866%2035.1114%2019.5939L4.79962%2027.0055C4.35812%2027.1135%204%2027.5052%204%2027.8792V35.4541C4%2035.8288%204.35812%2036.0455%204.79962%2035.9375L35.1114%2028.5266C35.552%2028.4187%2035.911%2028.0269%2035.911%2027.6523V20.0774V20.0773Z'%20fill='url(%23paint0_linear_5436_78897)'/%3e%3cpath%20d='M4%2019.8353C4%2020.21%204.35812%2020.6016%204.79962%2020.7097L35.1159%2028.1219C35.5573%2028.2299%2035.9155%2028.0133%2035.9155%2027.6393V20.0637C35.9155%2019.6897%2035.5573%2019.298%2035.1159%2019.19L4.79962%2011.7778C4.35812%2011.6699%204%2011.8858%204%2012.2603V19.8353V19.8353Z'%20fill='%23FF9800'/%3e%3cpath%20d='M35.911%204.51106C35.911%204.1365%2035.552%203.91973%2035.1114%204.02778L4.79962%2011.4387C4.35812%2011.5466%204%2011.9383%204%2012.313V19.8879C4%2020.2626%204.35812%2020.4786%204.79962%2020.3712L35.1114%2012.9596C35.552%2012.8517%2035.911%2012.46%2035.911%2012.086V4.51106Z'%20fill='%23FF9800'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5436_78897'%20x1='1762.84'%20y1='981.852'%20x2='1845.15'%20y2='624.882'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9700'/%3e%3cstop%20offset='0.53'%20stop-color='%23F48E00'/%3e%3cstop%20offset='1'%20stop-color='%23D06F00'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_5436_78897'%3e%3crect%20width='32'%20height='32'%20fill='white'%20transform='translate(4%204)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";var V$=I("<img data-component=app-icon>");const B$={vscode:N$,cursor:A$,zed:rp,"file-explorer":P$,finder:O$,terminal:L$,iterm2:M$,ghostty:E$,warp:R$,xcode:j$,"android-studio":T$,antigravity:D$,textmate:F$,powershell:z$,"sublime-text":K$},Z$={zed:{light:rp,dark:U$}},Cf=()=>typeof document!="object"?"light":document.documentElement.dataset.colorScheme==="dark"?"dark":"light",If=e=>{const[t,r]=$e(e,["id","class","classList","alt","draggable"]),[i,n]=ze(Cf());return Vt(()=>{const o=()=>n(Cf()),s=new MutationObserver(o);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),o(),je(()=>s.disconnect())}),(()=>{var o=V$();return dn(o,ie(r,{get src(){return Z$[t.id]?.[i()]??B$[t.id]},get alt(){return t.alt??""},get draggable(){return t.draggable??!1},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!1),o})()};function ip(e={}){const[t,r]=Vx({value:()=>Ce(e.isSelected),defaultValue:()=>!!Ce(e.defaultIsSelected),onChange:o=>e.onSelectedChange?.(o)});return{isSelected:t,setIsSelected:o=>{!Ce(e.isReadOnly)&&!Ce(e.isDisabled)&&r(o)},toggle:()=>{!Ce(e.isReadOnly)&&!Ce(e.isDisabled)&&r(!t())}}}var H$=Rt();function ma(){return jt(H$)}var q$=Rt();function op(){return jt(q$)}var sp=Rt();function ap(){return jt(sp)}function xr(){const e=ap();if(e===void 0)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var lp=Rt();function Ec(){const e=jt(lp);if(e===void 0)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var cp=Rt();function ar(){const e=jt(cp);if(e===void 0)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Mc(e){let t;const r=ar(),i=xr(),n=Ge({id:r.generateId(`item-${nn()}`)},e),[o,s]=$e(n,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),h=()=>i.listState().selectionManager(),g=()=>s.id,y=()=>h().focusedKey()===g(),b=()=>{o.onSelect?.(),o.closeOnSelect&&setTimeout(()=>{i.close(!0)})};Oc({getItem:()=>({ref:()=>t,type:"item",key:g(),textValue:o.textValue??f()?.textContent??t?.textContent??"",disabled:o.disabled??!1})});const v=Vo({key:g,selectionManager:h,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>o.disabled},()=>t),w=K=>{Qe(K,o.onPointerMove),K.pointerType==="mouse"&&(o.disabled?i.onItemLeave(K):(i.onItemEnter(K),K.defaultPrevented||(vn(K.currentTarget),i.listState().selectionManager().setFocused(!0),i.listState().selectionManager().setFocusedKey(g()))))},x=K=>{Qe(K,o.onPointerLeave),K.pointerType==="mouse"&&i.onItemLeave(K)},_=K=>{Qe(K,o.onPointerUp),!o.disabled&&K.button===0&&b()},k=K=>{if(Qe(K,o.onKeyDown),!K.repeat&&!o.disabled)switch(K.key){case"Enter":case" ":b();break}},C=$(()=>{if(o.indeterminate)return"mixed";if(o.checked!=null)return o.checked}),O=$(()=>({"data-indeterminate":o.indeterminate?"":void 0,"data-checked":o.checked&&!o.indeterminate?"":void 0,"data-disabled":o.disabled?"":void 0,"data-highlighted":y()?"":void 0})),z={isChecked:()=>o.checked,dataset:O,setLabelRef:m,generateId:Nn(()=>s.id),registerLabel:tn(l),registerDescription:tn(d)};return c(lp.Provider,{value:z,get children(){return c(it,ie({as:"div",ref(K){var J=xt(T=>t=T,o.ref);typeof J=="function"&&J(K)},get tabIndex(){return v.tabIndex()},get"aria-checked"(){return C()},get"aria-disabled"(){return o.disabled},get"aria-labelledby"(){return a()},get"aria-describedby"(){return u()},get"data-key"(){return v.dataKey()},get onPointerDown(){return et([o.onPointerDown,v.onPointerDown])},get onPointerUp(){return et([_,v.onPointerUp])},get onClick(){return et([o.onClick,v.onClick])},get onKeyDown(){return et([k,v.onKeyDown])},get onMouseDown(){return et([o.onMouseDown,v.onMouseDown])},get onFocus(){return et([o.onFocus,v.onFocus])},onPointerMove:w,onPointerLeave:x},O,s))}})}function up(e){const t=Ge({closeOnSelect:!1},e),[r,i]=$e(t,["checked","defaultChecked","onChange","onSelect"]),n=ip({isSelected:()=>r.checked,defaultIsSelected:()=>r.defaultChecked,onSelectedChange:s=>r.onChange?.(s),isDisabled:()=>i.disabled});return c(Mc,ie({role:"menuitemcheckbox",get checked(){return n.isSelected()},onSelect:()=>{r.onSelect?.(),n.toggle()}},i))}var Po={next:(e,t)=>e==="ltr"?t==="horizontal"?"ArrowRight":"ArrowDown":t==="horizontal"?"ArrowLeft":"ArrowUp",previous:(e,t)=>Po.next(e==="ltr"?"rtl":"ltr",t)},Tf={first:e=>e==="horizontal"?"ArrowDown":"ArrowRight",last:e=>e==="horizontal"?"ArrowUp":"ArrowLeft"};function dp(e){const t=ar(),r=xr(),i=ma(),{direction:n}=Nr(),o=Ge({id:t.generateId("trigger")},e),[s,a]=$e(o,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>t.value();i!==void 0&&(l=()=>t.value()??s.id,i.lastValue()===void 0&&i.setLastValue(l));const u=th(()=>r.triggerRef(),()=>"button"),d=$(()=>u()==="a"&&r.triggerRef()?.getAttribute("href")!=null);ne(qe(()=>i?.value(),v=>{d()&&v===l()&&r.triggerRef()?.focus()}));const f=()=>{i!==void 0?r.isOpen()?i.value()===l()&&i.closeMenu():(i.autoFocusMenu()||i.setAutoFocusMenu(!0),r.open(!1)):r.toggle(!0)},m=v=>{Qe(v,s.onPointerDown),v.currentTarget.dataset.pointerType=v.pointerType,!s.disabled&&v.pointerType!=="touch"&&v.button===0&&f()},h=v=>{Qe(v,s.onClick),s.disabled||v.currentTarget.dataset.pointerType==="touch"&&f()},g=v=>{if(Qe(v,s.onKeyDown),!s.disabled){if(d())switch(v.key){case"Enter":case" ":return}switch(v.key){case"Enter":case" ":case Tf.first(t.orientation()):v.stopPropagation(),v.preventDefault(),Bx(v.currentTarget),r.open("first"),i?.setAutoFocusMenu(!0),i?.setValue(l);break;case Tf.last(t.orientation()):v.stopPropagation(),v.preventDefault(),r.open("last");break;case Po.next(n(),t.orientation()):if(i===void 0)break;v.stopPropagation(),v.preventDefault(),i.nextMenu();break;case Po.previous(n(),t.orientation()):if(i===void 0)break;v.stopPropagation(),v.preventDefault(),i.previousMenu();break}}},y=v=>{Qe(v,s.onMouseOver),r.triggerRef()?.dataset.pointerType!=="touch"&&!s.disabled&&i!==void 0&&i.value()!==void 0&&i.setValue(l)},b=v=>{Qe(v,s.onFocus),i!==void 0&&v.currentTarget.dataset.pointerType!=="touch"&&i.setValue(l)};return ne(()=>je(r.registerTriggerId(s.id))),c(Ro,ie({ref(v){var w=xt(r.setTriggerRef,s.ref);typeof w=="function"&&w(v)},get"data-kb-menu-value-trigger"(){return t.value()},get id(){return s.id},get disabled(){return s.disabled},"aria-haspopup":"true",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return Te(()=>!!r.isOpen())()?r.contentId():void 0},get"data-highlighted"(){return l()!==void 0&&i?.value()===l()?!0:void 0},get tabIndex(){return i!==void 0?i.value()===l()||i.lastValue()===l()?0:-1:void 0},onPointerDown:m,onMouseOver:y,onClick:h,onKeyDown:g,onFocus:b,role:i!==void 0?"menuitem":void 0},()=>r.dataset(),a))}function fp(e){let t;const r=ar(),i=xr(),n=ma(),o=op(),{direction:s}=Nr(),a=Ge({id:r.generateId(`content-${nn()}`)},e),[l,u]=$e(a,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let d=0;const f=()=>i.parentMenuContext()==null&&n===void 0&&r.isModal(),m=Tc({selectionManager:i.listState().selectionManager,collection:i.listState().collection,autoFocus:i.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!i.listState().selectionManager().isFocused(),orientation:()=>r.orientation()==="horizontal"?"vertical":"horizontal"},()=>t);mc({trapFocus:()=>f()&&i.isOpen(),onMountAutoFocus:x=>{n===void 0&&l.onOpenAutoFocus?.(x)},onUnmountAutoFocus:l.onCloseAutoFocus},()=>t);const h=x=>{if(Do(x.currentTarget,x.target)&&(x.key==="Tab"&&i.isOpen()&&x.preventDefault(),n!==void 0&&x.currentTarget.getAttribute("aria-haspopup")!=="true"))switch(x.key){case Po.next(s(),r.orientation()):x.stopPropagation(),x.preventDefault(),i.close(!0),n.setAutoFocusMenu(!0),n.nextMenu();break;case Po.previous(s(),r.orientation()):if(x.currentTarget.hasAttribute("data-closed"))break;x.stopPropagation(),x.preventDefault(),i.close(!0),n.setAutoFocusMenu(!0),n.previousMenu();break}},g=x=>{l.onEscapeKeyDown?.(x),n?.setAutoFocusMenu(!1),i.close(!0)},y=x=>{l.onFocusOutside?.(x),r.isModal()&&x.preventDefault()},b=x=>{Qe(x,l.onPointerEnter),i.isOpen()&&(i.parentMenuContext()?.listState().selectionManager().setFocused(!1),i.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},v=x=>{if(Qe(x,l.onPointerMove),x.pointerType!=="mouse")return;const _=x.target,k=d!==x.clientX;Do(x.currentTarget,_)&&k&&(i.setPointerDir(x.clientX>d?"right":"left"),d=x.clientX)};ne(()=>je(i.registerContentId(l.id))),je(()=>i.setContentRef(void 0));const w={ref:xt(x=>{i.setContentRef(x),t=x},l.ref),role:"menu",get id(){return l.id},get tabIndex(){return m.tabIndex()},get"aria-labelledby"(){return i.triggerId()},onKeyDown:et([l.onKeyDown,m.onKeyDown,h]),onMouseDown:et([l.onMouseDown,m.onMouseDown]),onFocusIn:et([l.onFocusIn,m.onFocusIn]),onFocusOut:et([l.onFocusOut,m.onFocusOut]),onPointerEnter:b,onPointerMove:v,get"data-orientation"(){return r.orientation()}};return c(F,{get when(){return i.contentPresent()},get children(){return c(F,{get when(){return o===void 0||i.parentMenuContext()!=null},get fallback(){return c(it,ie({as:"div"},()=>i.dataset(),w,u))},get children(){return c(Ni.Positioner,{get children(){return c(gc,ie({get disableOutsidePointerEvents(){return Te(()=>!!f())()&&i.isOpen()},get excludedElements(){return[i.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return vr({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:g,onFocusOutside:y,get onDismiss(){return i.close}},()=>i.dataset(),w,u))}})}})}})}function G$(e){let t;const r=ar(),i=xr(),[n,o]=$e(e,["ref"]);return fc({element:()=>t??null,enabled:()=>i.contentPresent()&&r.preventScroll()}),c(fp,ie({ref(s){var a=xt(l=>{t=l},n.ref);typeof a=="function"&&a(s)}},o))}var mp=Rt();function W$(){const e=jt(mp);if(e===void 0)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}function zc(e){const t=ar(),r=Ge({id:t.generateId(`group-${nn()}`)},e),[i,n]=ze(),o={generateId:Nn(()=>r.id),registerLabelId:tn(n)};return c(mp.Provider,{value:o,get children(){return c(it,ie({as:"div",role:"group",get"aria-labelledby"(){return i()}},r))}})}function gp(e){const t=W$(),r=Ge({id:t.generateId("label")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerLabelId(i.id))),c(it,ie({as:"span",get id(){return i.id},"aria-hidden":"true"},n))}function hp(e){const t=xr(),r=Ge({children:"▼"},e);return c(it,ie({as:"span","aria-hidden":"true"},()=>t.dataset(),r))}function pp(e){return c(Mc,ie({role:"menuitem",closeOnSelect:!0},e))}function vp(e){const t=Ec(),r=Ge({id:t.generateId("description")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerDescription(i.id))),c(it,ie({as:"div",get id(){return i.id}},()=>t.dataset(),n))}function bp(e){const t=Ec(),r=Ge({id:t.generateId("indicator")},e),[i,n]=$e(r,["forceMount"]);return c(F,{get when(){return i.forceMount||t.isChecked()},get children(){return c(it,ie({as:"div"},()=>t.dataset(),n))}})}function yp(e){const t=Ec(),r=Ge({id:t.generateId("label")},e),[i,n]=$e(r,["ref","id"]);return ne(()=>je(t.registerLabel(i.id))),c(it,ie({as:"div",ref(o){var s=xt(t.setLabelRef,i.ref);typeof s=="function"&&s(o)},get id(){return i.id}},()=>t.dataset(),n))}function wp(e){const t=xr();return c(F,{get when(){return t.contentPresent()},get children(){return c(hr,e)}})}var xp=Rt();function X$(){const e=jt(xp);if(e===void 0)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}function _p(e){const r=ar().generateId(`radiogroup-${nn()}`),i=Ge({id:r},e),[n,o]=$e(i,["value","defaultValue","onChange","disabled"]),[s,a]=ea({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:u=>n.onChange?.(u)}),l={isDisabled:()=>n.disabled,isSelectedValue:u=>u===s(),setSelectedValue:u=>a(u)};return c(xp.Provider,{value:l,get children(){return c(zc,o)}})}function $p(e){const t=X$(),r=Ge({closeOnSelect:!1},e),[i,n]=$e(r,["value","onSelect"]);return c(Mc,ie({role:"menuitemradio",get checked(){return t.isSelectedValue(i.value)},onSelect:()=>{i.onSelect?.(),t.setSelectedValue(i.value)}},n))}function Y$(e,t,r){const i=e.split("-")[0],n=r.getBoundingClientRect(),o=[],s=t.clientX,a=t.clientY;switch(i){case"top":o.push([s,a+5]),o.push([n.left,n.bottom]),o.push([n.left,n.top]),o.push([n.right,n.top]),o.push([n.right,n.bottom]);break;case"right":o.push([s-5,a]),o.push([n.left,n.top]),o.push([n.right,n.top]),o.push([n.right,n.bottom]),o.push([n.left,n.bottom]);break;case"bottom":o.push([s,a-5]),o.push([n.right,n.top]),o.push([n.right,n.bottom]),o.push([n.left,n.bottom]),o.push([n.left,n.top]);break;case"left":o.push([s+5,a]),o.push([n.right,n.bottom]),o.push([n.left,n.bottom]),o.push([n.left,n.top]),o.push([n.right,n.top]);break}return o}function J$(e,t){return t?Hx([e.clientX,e.clientY],t):!1}function Sp(e){const t=ar(),r=qh(),i=ap(),n=ma(),o=op(),s=Ge({placement:t.orientation()==="horizontal"?"bottom-start":"right-start"},e),[a,l]=$e(s,["open","defaultOpen","onOpenChange"]);let u=0,d=null,f="right";const[m,h]=ze(),[g,y]=ze(),[b,v]=ze(),[w,x]=ze(),[_,k]=ze(!0),[C,O]=ze(l.placement),[z,K]=ze([]),[J,T]=ze([]),{DomCollectionProvider:M}=Pc({items:J,onItemsChange:T}),U=jo({open:()=>a.open,defaultOpen:()=>a.defaultOpen,onOpenChange:Z=>a.onOpenChange?.(Z)}),{present:A}=li({show:()=>t.forceMount()||U.isOpen(),element:()=>w()??null}),j=Bo({selectionMode:"none",dataSource:J}),P=Z=>{k(Z),U.open()},B=(Z=!1)=>{U.close(),Z&&i&&i.close(!0)},R=Z=>{k(Z),U.toggle()},V=()=>{const Z=w();Z&&(vn(Z),j.selectionManager().setFocused(!0),j.selectionManager().setFocusedKey(void 0))},Q=()=>{o!=null?setTimeout(()=>V()):V()},ee=Z=>{K(re=>[...re,Z]);const se=i?.registerNestedMenu(Z);return()=>{K(re=>Zx(re,Z)),se?.()}},oe=Z=>f===d?.side&&J$(Z,d?.area),le=Z=>{oe(Z)&&Z.preventDefault()},W=Z=>{oe(Z)||Q()},D=Z=>{oe(Z)&&Z.preventDefault()};dc({isDisabled:()=>!(i==null&&U.isOpen()&&t.isModal()),targets:()=>[w(),...z()].filter(Boolean)}),ne(()=>{const Z=w();if(!Z||!i)return;const se=i.registerNestedMenu(Z);je(()=>{se()})}),ne(()=>{i===void 0&&n?.registerMenu(t.value(),[w(),...z()])}),ne(()=>{i!==void 0||n===void 0||(n.value()===t.value()?(b()?.focus(),n.autoFocusMenu()&&P(!0)):B())}),ne(()=>{i!==void 0||n===void 0||U.isOpen()&&n.setValue(t.value())}),je(()=>{i===void 0&&n?.unregisterMenu(t.value())});const H={dataset:$(()=>({"data-expanded":U.isOpen()?"":void 0,"data-closed":U.isOpen()?void 0:""})),isOpen:U.isOpen,contentPresent:A,nestedMenus:z,currentPlacement:C,pointerGraceTimeoutId:()=>u,autoFocus:_,listState:()=>j,parentMenuContext:()=>i,triggerRef:b,contentRef:w,triggerId:m,contentId:g,setTriggerRef:v,setContentRef:x,open:P,close:B,toggle:R,focusContent:Q,onItemEnter:le,onItemLeave:W,onTriggerLeave:D,setPointerDir:Z=>f=Z,setPointerGraceTimeoutId:Z=>u=Z,setPointerGraceIntent:Z=>d=Z,registerNestedMenu:ee,registerItemToParentDomCollection:r?.registerItem,registerTriggerId:tn(h),registerContentId:tn(y)};return c(M,{get children(){return c(sp.Provider,{value:H,get children(){return c(F,{when:o===void 0,get fallback(){return l.children},get children(){return c(Ni,ie({anchorRef:b,contentRef:w,onCurrentPlacementChange:O},l))}})}})}})}function kp(e){const{direction:t}=Nr();return c(Sp,ie({get placement(){return t()==="rtl"?"left-start":"right-start"},flip:!0},e))}var Q$={close:(e,t)=>e==="ltr"?[t==="horizontal"?"ArrowLeft":"ArrowUp"]:[t==="horizontal"?"ArrowRight":"ArrowDown"]};function Cp(e){const t=xr(),r=ar(),[i,n]=$e(e,["onFocusOutside","onKeyDown"]),{direction:o}=Nr();return c(fp,ie({onOpenAutoFocus:d=>{d.preventDefault()},onCloseAutoFocus:d=>{d.preventDefault()},onFocusOutside:d=>{i.onFocusOutside?.(d);const f=d.target;Do(t.triggerRef(),f)||t.close()},onKeyDown:d=>{Qe(d,i.onKeyDown);const f=Do(d.currentTarget,d.target),m=Q$.close(o(),r.orientation()).includes(d.key),h=t.parentMenuContext()!=null;f&&m&&h&&(t.close(),vn(t.triggerRef()))}},n))}var Df=["Enter"," "],eS={open:(e,t)=>e==="ltr"?[...Df,t==="horizontal"?"ArrowRight":"ArrowDown"]:[...Df,t==="horizontal"?"ArrowLeft":"ArrowUp"]};function Ip(e){let t;const r=ar(),i=xr(),n=Ge({id:r.generateId(`sub-trigger-${nn()}`)},e),[o,s]=$e(n,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let a=null;const l=()=>{a&&window.clearTimeout(a),a=null},{direction:u}=Nr(),d=()=>o.id,f=()=>{const x=i.parentMenuContext();if(x==null)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return x.listState().selectionManager()},m=()=>i.listState().collection(),h=()=>f().focusedKey()===d(),g=Vo({key:d,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>o.disabled},()=>t),y=x=>{Qe(x,o.onClick),!i.isOpen()&&!o.disabled&&i.open(!0)},b=x=>{if(Qe(x,o.onPointerMove),x.pointerType!=="mouse")return;const _=i.parentMenuContext();if(_?.onItemEnter(x),!x.defaultPrevented){if(o.disabled){_?.onItemLeave(x);return}!i.isOpen()&&!a&&(i.parentMenuContext()?.setPointerGraceIntent(null),a=window.setTimeout(()=>{i.open(!1),l()},100)),_?.onItemEnter(x),x.defaultPrevented||(i.listState().selectionManager().isFocused()&&(i.listState().selectionManager().setFocused(!1),i.listState().selectionManager().setFocusedKey(void 0)),vn(x.currentTarget),_?.listState().selectionManager().setFocused(!0),_?.listState().selectionManager().setFocusedKey(d()))}},v=x=>{if(Qe(x,o.onPointerLeave),x.pointerType!=="mouse")return;l();const _=i.parentMenuContext(),k=i.contentRef();if(k){_?.setPointerGraceIntent({area:Y$(i.currentPlacement(),x,k),side:i.currentPlacement().split("-")[0]}),window.clearTimeout(_?.pointerGraceTimeoutId());const C=window.setTimeout(()=>{_?.setPointerGraceIntent(null)},300);_?.setPointerGraceTimeoutId(C)}else{if(_?.onTriggerLeave(x),x.defaultPrevented)return;_?.setPointerGraceIntent(null)}_?.onItemLeave(x)},w=x=>{Qe(x,o.onKeyDown),!x.repeat&&(o.disabled||eS.open(u(),r.orientation()).includes(x.key)&&(x.stopPropagation(),x.preventDefault(),f().setFocused(!1),f().setFocusedKey(void 0),i.isOpen()||i.open("first"),i.focusContent(),i.listState().selectionManager().setFocused(!0),i.listState().selectionManager().setFocusedKey(m().getFirstKey())))};return ne(()=>{if(i.registerItemToParentDomCollection==null)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");const x=i.registerItemToParentDomCollection({ref:()=>t,type:"item",key:d(),textValue:o.textValue??t?.textContent??"",disabled:o.disabled??!1});je(x)}),ne(qe(()=>i.parentMenuContext()?.pointerGraceTimeoutId(),x=>{je(()=>{window.clearTimeout(x),i.parentMenuContext()?.setPointerGraceIntent(null)})})),ne(()=>je(i.registerTriggerId(o.id))),je(()=>{l()}),c(it,ie({as:"div",ref(x){var _=xt(k=>{i.setTriggerRef(k),t=k},o.ref);typeof _=="function"&&_(x)},get id(){return o.id},role:"menuitem",get tabIndex(){return g.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return i.isOpen()},get"aria-controls"(){return Te(()=>!!i.isOpen())()?i.contentId():void 0},get"aria-disabled"(){return o.disabled},get"data-key"(){return g.dataKey()},get"data-highlighted"(){return h()?"":void 0},get"data-disabled"(){return o.disabled?"":void 0},get onPointerDown(){return et([o.onPointerDown,g.onPointerDown])},get onPointerUp(){return et([o.onPointerUp,g.onPointerUp])},get onClick(){return et([y,g.onClick])},get onKeyDown(){return et([w,g.onKeyDown])},get onMouseDown(){return et([o.onMouseDown,g.onMouseDown])},get onFocus(){return et([o.onFocus,g.onFocus])},onPointerMove:b,onPointerLeave:v},()=>i.dataset(),s))}function tS(e){const t=ma(),r=`menu-${nn()}`,i=Ge({id:r,modal:!0},e),[n,o]=$e(i,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),s=jo({open:()=>n.open,defaultOpen:()=>n.defaultOpen,onOpenChange:l=>n.onOpenChange?.(l)}),a={isModal:()=>n.modal??!0,preventScroll:()=>n.preventScroll??a.isModal(),forceMount:()=>n.forceMount??!1,generateId:Nn(()=>n.id),value:()=>n.value,orientation:()=>n.orientation??t?.orientation()??"horizontal"};return c(cp.Provider,{value:a,get children(){return c(Sp,ie({get open(){return s.isOpen()},get onOpenChange(){return s.setIsOpen}},o))}})}var nS={};ir(nS,{Root:()=>ga,Separator:()=>rS});function ga(e){let t;const r=Ge({orientation:"horizontal"},e),[i,n]=$e(r,["ref","orientation"]),o=th(()=>t,()=>"hr");return c(it,ie({as:"hr",ref(s){var a=xt(l=>t=l,i.ref);typeof a=="function"&&a(s)},get role(){return o()!=="hr"?"separator":void 0},get"aria-orientation"(){return i.orientation==="vertical"?"vertical":void 0},get"data-orientation"(){return i.orientation}},n))}var rS=ga,iS={};ir(iS,{Arrow:()=>Fi,CheckboxItem:()=>up,Content:()=>Tp,DropdownMenu:()=>Wt,Group:()=>zc,GroupLabel:()=>gp,Icon:()=>hp,Item:()=>pp,ItemDescription:()=>vp,ItemIndicator:()=>bp,ItemLabel:()=>yp,Portal:()=>wp,RadioGroup:()=>_p,RadioItem:()=>$p,Root:()=>Dp,Separator:()=>ga,Sub:()=>kp,SubContent:()=>Cp,SubTrigger:()=>Ip,Trigger:()=>dp});function Tp(e){const t=ar(),r=xr(),[i,n]=$e(e,["onCloseAutoFocus","onInteractOutside"]);let o=!1;return c(G$,ie({onCloseAutoFocus:l=>{i.onCloseAutoFocus?.(l),o||vn(r.triggerRef()),o=!1,l.preventDefault()},onInteractOutside:l=>{i.onInteractOutside?.(l),(!t.isModal()||l.detail.isContextMenu)&&(o=!0)}},n))}function Dp(e){const t=`dropdownmenu-${nn()}`,r=Ge({id:t},e);return c(tS,r)}var Wt=Object.assign(Dp,{Arrow:Fi,CheckboxItem:up,Content:Tp,Group:zc,GroupLabel:gp,Icon:hp,Item:pp,ItemDescription:vp,ItemIndicator:bp,ItemLabel:yp,Portal:wp,RadioGroup:_p,RadioItem:$p,Separator:ga,Sub:kp,SubContent:Cp,SubTrigger:Ip,Trigger:dp});function oS(e){return c(Wt,ie(e,{"data-component":"dropdown-menu"}))}function sS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Trigger,ie(r,{"data-slot":"dropdown-menu-trigger",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function aS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Icon,ie(r,{"data-slot":"dropdown-menu-icon",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function lS(e){return c(Wt.Portal,e)}function cS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Content,ie(r,{"data-component":"dropdown-menu-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function uS(e){const[t,r]=$e(e,["class","classList"]);return c(Wt.Arrow,ie(r,{"data-slot":"dropdown-menu-arrow",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function dS(e){const[t,r]=$e(e,["class","classList"]);return c(Wt.Separator,ie(r,{"data-slot":"dropdown-menu-separator",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function fS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Group,ie(r,{"data-slot":"dropdown-menu-group",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function mS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.GroupLabel,ie(r,{"data-slot":"dropdown-menu-group-label",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function gS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Item,ie(r,{"data-slot":"dropdown-menu-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function hS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.ItemLabel,ie(r,{"data-slot":"dropdown-menu-item-label",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function pS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.ItemDescription,ie(r,{"data-slot":"dropdown-menu-item-description",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function vS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.ItemIndicator,ie(r,{"data-slot":"dropdown-menu-item-indicator",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function bS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.RadioGroup,ie(r,{"data-slot":"dropdown-menu-radio-group",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function yS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.RadioItem,ie(r,{"data-slot":"dropdown-menu-radio-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function wS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.CheckboxItem,ie(r,{"data-slot":"dropdown-menu-checkbox-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function xS(e){return c(Wt.Sub,e)}function _S(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.SubTrigger,ie(r,{"data-slot":"dropdown-menu-sub-trigger",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function $S(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.SubContent,ie(r,{"data-component":"dropdown-menu-sub-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}const ct=Object.assign(oS,{Trigger:sS,Icon:aS,Portal:lS,Content:cS,Arrow:uS,Separator:dS,Group:fS,GroupLabel:mS,Item:gS,ItemLabel:hS,ItemDescription:pS,ItemIndicator:vS,RadioGroup:bS,RadioItem:yS,CheckboxItem:wS,Sub:xS,SubTrigger:_S,SubContent:$S});var SS=I("<svg>"),kS=I("<svg><rect width=3 height=3 rx=1></svg>",!1,!0,!1);const CS=new Set([1,2,4,7,8,11,13,14]),IS=new Set([0,3,12,15]),TS=Array.from({length:16},(e,t)=>({id:t,x:t%4*4,y:Math.floor(t/4)*4,delay:Math.random()*1.5,duration:1+Math.random()*1,outer:CS.has(t),corner:IS.has(t)}));function Ap(e){return(()=>{var t=SS();return dn(t,ie(e,{viewBox:"0 0 15 15","data-component":"spinner",get classList(){return{...e.classList??{},[e.class??""]:!!e.class}},fill:"currentColor"}),!0,!0),p(t,c(rt,{each:TS,children:r=>(()=>{var i=kS();return Ae(n=>{var o=r.x,s=r.y,a=r.corner?0:void 0,l=r.corner?void 0:`${r.outer?"pulse-opacity-dim":"pulse-opacity"} ${r.duration}s ease-in-out infinite`,u=r.corner?void 0:"both",d=r.corner?void 0:`${r.delay}s`;return o!==n.e&&Ie(i,"x",n.e=o),s!==n.t&&Ie(i,"y",n.t=s),a!==n.a&&ft(i,"opacity",n.a=a),l!==n.o&&ft(i,"animation",n.o=l),u!==n.i&&ft(i,"animation-fill-mode",n.i=u),d!==n.n&&ft(i,"animation-delay",n.n=d),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),i})()})),t})()}const DS=[],qo=e=>{const t=e.review??(()=>!1),r=e.hasReview??(()=>!1),i=$(()=>e.tabs().active()==="context"||e.tabs().all().includes("context")),n=$(()=>{const l=new Set;return e.tabs().all().flatMap(u=>{if(u==="context"||u==="review")return[];const d=e.pathFromTab(u)?e.normalizeTab(u):u;return l.has(d)?[]:(l.add(d),[d])})},DS,{equals:Pr}),o=$(()=>{const l=e.tabs().active();if(l==="context"||l==="review"&&t())return l;if(l&&e.pathFromTab(l))return e.normalizeTab(l);const u=n()[0];return u||(i()?"context":t()&&r()?"review":"empty")}),s=$(()=>{const l=o();if(n().includes(l))return l}),a=$(()=>{const l=o();if(l==="context")return l;if(n().includes(l))return l});return{contextOpen:i,openedTabs:n,activeTab:o,activeFileTab:s,closableTab:a}},Jr=e=>{const r=document.getElementById(`terminal-wrapper-${e}`)?.querySelector('[data-component="terminal"]');if(!(r instanceof HTMLElement))return!1;const i=r.querySelector("textarea");return i instanceof HTMLTextAreaElement?(i.focus(),!0):(r.focus(),r.dispatchEvent(typeof PointerEvent=="function"?new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0}):new MouseEvent("pointerdown",{bubbles:!0,cancelable:!0})),!0)},AS=new Set(["Alt","Control","Meta","Shift"]),PS=e=>AS.has(e.key)?!1:!(e.ctrlKey||e.metaKey||e.altKey),OS=e=>t=>{$n(()=>{e.showAllFiles();const r=e.loadFile(t),i=()=>{const n=e.tabForPath(t);e.openTab(n),e.setActive(n)};r instanceof Promise?r.then(i):i()})},ES=e=>t=>{const r=e.normalizeTab(t);e.openTab(r);const i=e.pathFromTab(r);i&&(e.loadFile(i),e.openReviewPanel(),e.setActive(r))},MS=(e,t,r)=>{const i=e.indexOf(t),n=e.indexOf(r);if(!(i===-1||n===-1||i===n))return n},Pp=()=>{const[e,t]=We({active:!1});let r;const i=()=>{r!==void 0&&(clearTimeout(r),r=void 0),t("active",!1)},n=()=>{r!==void 0&&(clearTimeout(r),r=void 0),t("active",!0)};return Vt(()=>{ln(window,"pointerup",i),ln(window,"pointercancel",i),ln(window,"blur",i)}),je(()=>{r!==void 0&&clearTimeout(r)}),{active:()=>e.active,start:n,touch(){n(),r=window.setTimeout(i,120)}}},Lc=()=>{const e=yc(),t=$(()=>`${e.dir}${e.id?"/"+e.id:""}`);return{params:e,sessionKey:t}},_r=()=>{const e=or(),{params:t,sessionKey:r}=Lc();return{params:t,sessionKey:r,tabs:$(()=>e.tabs(r)),view:$(()=>e.view(r))}};var Af=I('<div class="flex size-5 shrink-0 items-center justify-center [&amp;_[data-component=app-icon]]:size-5">'),zS=I('<div class="hidden xl:flex items-center"><div class="flex items-center"><div class="flex h-[24px] box-border items-center rounded-md border border-border-weak-base bg-surface-panel overflow-hidden">'),LS=I('<div class="relative flex items-center justify-center size-4">'),FS=I('<div class="flex items-center gap-2"><div class="flex items-center gap-1"><div class="hidden md:flex items-center gap-1 shrink-0">');const NS=["vscode","cursor","zed","textmate","antigravity","finder","terminal","iterm2","ghostty","warp","xcode","android-studio","powershell","sublime-text"],RS=[{id:"vscode",label:"session.header.open.app.vscode",icon:"vscode",openWith:"Visual Studio Code"},{id:"cursor",label:"session.header.open.app.cursor",icon:"cursor",openWith:"Cursor"},{id:"zed",label:"session.header.open.app.zed",icon:"zed",openWith:"Zed"},{id:"textmate",label:"session.header.open.app.textmate",icon:"textmate",openWith:"TextMate"},{id:"antigravity",label:"session.header.open.app.antigravity",icon:"antigravity",openWith:"Antigravity"},{id:"terminal",label:"session.header.open.app.terminal",icon:"terminal",openWith:"Terminal"},{id:"iterm2",label:"session.header.open.app.iterm2",icon:"iterm2",openWith:"iTerm"},{id:"ghostty",label:"session.header.open.app.ghostty",icon:"ghostty",openWith:"Ghostty"},{id:"warp",label:"session.header.open.app.warp",icon:"warp",openWith:"Warp"},{id:"xcode",label:"session.header.open.app.xcode",icon:"xcode",openWith:"Xcode"},{id:"android-studio",label:"session.header.open.app.androidStudio",icon:"android-studio",openWith:"Android Studio"},{id:"sublime-text",label:"session.header.open.app.sublimeText",icon:"sublime-text",openWith:"Sublime Text"}],jS=[{id:"vscode",label:"session.header.open.app.vscode",icon:"vscode",openWith:"code"},{id:"cursor",label:"session.header.open.app.cursor",icon:"cursor",openWith:"cursor"},{id:"zed",label:"session.header.open.app.zed",icon:"zed",openWith:"zed"},{id:"powershell",label:"session.header.open.app.powershell",icon:"powershell",openWith:"powershell"},{id:"sublime-text",label:"session.header.open.app.sublimeText",icon:"sublime-text",openWith:"Sublime Text"}],US=[{id:"vscode",label:"session.header.open.app.vscode",icon:"vscode",openWith:"code"},{id:"cursor",label:"session.header.open.app.cursor",icon:"cursor",openWith:"cursor"},{id:"zed",label:"session.header.open.app.zed",icon:"zed",openWith:"zed"},{id:"sublime-text",label:"session.header.open.app.sublimeText",icon:"sublime-text",openWith:"Sublime Text"}],KS=e=>{if(e.platform==="desktop"&&e.os)return e.os;if(typeof navigator!="object")return"unknown";const t=navigator.platform||navigator.userAgent;return/Mac/i.test(t)?"macos":/Win/i.test(t)?"windows":/Linux/i.test(t)?"linux":"unknown"},VS=(e,t)=>{Nt({variant:"error",title:e.t("common.requestFailed"),description:t instanceof Error?t.message:String(t)})};function BS(){const e=or(),t=wc(),r=nh(),i=rh(),n=Rn(),o=na(),s=_t(),a=sr(),l=Ko(),{params:u,view:d}=_r(),f=$(()=>qx(u.dir)??""),m=$(()=>KS(o)),[h,g]=We({finder:!0}),y=$(()=>m()==="macos"?RS:m()==="windows"?jS:US),b=$(()=>m()==="macos"?{label:"session.header.open.finder",icon:"finder"}:m()==="windows"?{label:"session.header.open.fileExplorer",icon:"file-explorer"}:{label:"session.header.open.fileManager",icon:"finder"});ne(()=>{if(o.platform!=="desktop"||!o.checkAppExists)return;const B=y();g(Object.fromEntries(B.map(R=>[R.id,void 0]))),Promise.all(B.map(R=>Promise.resolve(o.checkAppExists?.(R.openWith)).then(V=>!!V).catch(()=>!1).then(V=>[R.id,V]))).then(R=>{g(Object.fromEntries(R))})});const v=$(()=>[{id:"finder",label:s.t(b().label),icon:b().icon},...y().filter(B=>h[B.id]).map(B=>({...B,label:s.t(B.label)}))]),w=()=>{const B=!d().terminal.opened();if(d().terminal.toggle(),!B)return;const R=l.active();R&&Jr(R)},[x,_]=Os(Es.global("open.app"),We({app:"finder"})),[k,C]=We({open:!1}),[O,z]=We({app:void 0}),K=$(()=>o.platform==="desktop"&&!!o.openPath&&i.isLocal()),J=$(()=>v().find(B=>B.id===x.app)??v()[0]??{id:"finder",label:b().label,icon:b().icon}),T=$(()=>O.app!==void 0),M=$(()=>Gx(u.id?a.data.message[u.id]:void 0,a.data.agent)),U=$(()=>r.colorScheme()==="dark"?"moon":"sun"),A=B=>{v().some(R=>R.id===B)&&_("app",B)},j=B=>{if(T()||!K()||!o.openPath)return;const R=f();if(!R)return;const V=v().find(ee=>ee.id===B),Q=V&&"openWith"in V?V.openWith:void 0;z("app",B),o.openPath(R,Q).catch(ee=>VS(s,ee)).finally(()=>{z("app",void 0)})},P=$(()=>document.getElementById(So.right));return c(F,{get when(){return P()},children:B=>c(hr,{get mount(){return B()},get children(){var R=FS(),V=R.firstChild,Q=V.firstChild;return p(R,c(F,{get when(){return Te(()=>!!f())()&&K()},get children(){var ee=zS(),oe=ee.firstChild,le=oe.firstChild;return p(le,c(vt,{variant:"ghost",class:"rounded-none h-full px-0.5 border-none shadow-none disabled:!cursor-default",get classList(){return{"bg-surface-raised-base-active":T()}},onClick:()=>j(J().id),get disabled(){return T()},get"aria-label"(){return s.t("session.header.open.ariaLabel",{app:J().label})},get children(){var W=Af();return p(W,c(F,{get when(){return T()},get fallback(){return c(If,{get id(){return J().icon}})},get children(){return c(Ap,{class:"size-3.5",get style(){return{color:M()??"var(--icon-base)"}}})}})),W}}),null),p(le,c(ct,{gutter:4,placement:"bottom-end",get open(){return k.open},onOpenChange:W=>C("open",W),get children(){return[c(ct.Trigger,{as:Pt,icon:"chevron-down",variant:"ghost",get disabled(){return T()},class:"rounded-none h-full w-[20px] p-0 border-none shadow-none data-[expanded]:bg-surface-raised-base-active disabled:!cursor-default",get classList(){return{"bg-surface-raised-base-active":T()}},get"aria-label"(){return s.t("session.header.open.menu")}}),c(ct.Portal,{get children(){return c(ct.Content,{class:"[&_[data-slot=dropdown-menu-item]]:pl-1 [&_[data-slot=dropdown-menu-radio-item]]:pl-1 [&_[data-slot=dropdown-menu-radio-item]+[data-slot=dropdown-menu-radio-item]]:mt-1",get children(){return c(ct.Group,{get children(){return[c(ct.GroupLabel,{class:"!px-1 !py-1",get children(){return s.t("session.header.openIn")}}),c(ct.RadioGroup,{class:"mt-1",get value(){return J().id},onChange:W=>{NS.includes(W)&&A(W)},get children(){return c(rt,{get each(){return v()},children:W=>c(ct.RadioItem,{get value(){return W.id},get disabled(){return T()},onSelect:()=>{C("open",!1),j(W.id)},get children(){return[(()=>{var D=Af();return p(D,c(If,{get id(){return W.icon}})),D})(),c(ct.ItemLabel,{get children(){return W.label}}),c(ct.ItemIndicator,{get children(){return c(bt,{name:"check-small",size:"small",class:"text-icon-weak"})}})]}})})}})]}})}})}})]}}),null),ee}}),V),p(V,c(F,{get when(){return n.capabilities.terminal!==!1},get children(){return c(Et,{placement:"bottom",get value(){return s.t("command.terminal.toggle")},get children(){return c(vt,{variant:"ghost",class:"group/terminal-toggle titlebar-icon w-8 h-6 p-0 box-border shrink-0",onClick:w,get"aria-label"(){return s.t("command.terminal.toggle")},get"aria-expanded"(){return d().terminal.opened()},"aria-controls":"terminal-panel",get children(){return c(bt,{size:"small",get name(){return d().terminal.opened()?"terminal-active":"terminal"}})}})}})}}),Q),p(Q,c(Et,{placement:"bottom",get value(){return s.t("command.review.toggle")},get children(){return c(vt,{variant:"ghost",class:"group/review-toggle titlebar-icon w-8 h-6 p-0 box-border",onClick:()=>d().reviewPanel.toggle(),get"aria-label"(){return s.t("command.review.toggle")},get"aria-expanded"(){return d().reviewPanel.opened()},"aria-controls":"review-panel",get children(){return c(bt,{size:"small",get name(){return d().reviewPanel.opened()?"review-active":"review"}})}})}}),null),p(Q,c(Et,{placement:"bottom",get value(){return s.t("command.fileTree.toggle")},get children(){return c(vt,{variant:"ghost",class:"titlebar-icon w-8 h-6 p-0 box-border",onClick:()=>e.fileTree.toggle(),get"aria-label"(){return s.t("command.fileTree.toggle")},get"aria-expanded"(){return e.fileTree.opened()},"aria-controls":"file-tree-panel",get children(){var ee=LS();return p(ee,c(bt,{size:"small",get name(){return e.fileTree.opened()?"file-tree-active":"file-tree"},get classList(){return{"text-icon-strong":e.fileTree.opened(),"text-icon-weak":!e.fileTree.opened()}}})),ee}})}}),null),p(V,c(Et,{placement:"bottom",get value(){return s.t("sidebar.mode")},get children(){return c(vt,{variant:"ghost",class:"titlebar-icon w-8 h-6 p-0 box-border",onClick:()=>t.trigger("theme.scheme.cycle"),get"aria-label"(){return s.t("sidebar.mode")},get children(){return c(bt,{size:"small",get name(){return U()}})}})}}),null),R}})})}function bo(e,t){for(let r=e.length-1;r>=0;r-=1){const i=e[r];if(t(i,r,e))return i}}var ZS={};ir(ZS,{Collapsible:()=>ha,Content:()=>Fc,Root:()=>Nc,Trigger:()=>Rc,useCollapsibleContext:()=>Go});var Op=Rt();function Go(){const e=jt(Op);if(e===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return e}function Fc(e){const[t,r]=ze(),i=Go(),n=Ge({id:i.generateId("content")},e),[o,s]=$e(n,["ref","id","style"]),{present:a}=li({show:i.shouldMount,element:()=>t()??null}),[l,u]=ze(0),[d,f]=ze(0);let h=i.isOpen()||a();return Vt(()=>{const g=requestAnimationFrame(()=>{h=!1});je(()=>{cancelAnimationFrame(g)})}),ne(qe(a,()=>{if(!t())return;t().style.transitionDuration="0s",t().style.animationName="none";const g=t().getBoundingClientRect();u(g.height),f(g.width),h||(t().style.transitionDuration="",t().style.animationName="")})),ne(qe(i.isOpen,g=>{!g&&t()&&(t().style.transitionDuration="",t().style.animationName="")},{defer:!0})),ne(()=>je(i.registerContentId(o.id))),c(F,{get when(){return a()},get children(){return c(it,ie({as:"div",ref(g){var y=xt(r,o.ref);typeof y=="function"&&y(g)},get id(){return o.id},get style(){return vr({"--kb-collapsible-content-height":l()?`${l()}px`:void 0,"--kb-collapsible-content-width":d()?`${d()}px`:void 0},o.style)}},()=>i.dataset(),s))}})}function Nc(e){const t=`collapsible-${nn()}`,r=Ge({id:t},e),[i,n]=$e(r,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[o,s]=ze(),a=jo({open:()=>i.open,defaultOpen:()=>i.defaultOpen,onOpenChange:d=>i.onOpenChange?.(d)}),l=$(()=>({"data-expanded":a.isOpen()?"":void 0,"data-closed":a.isOpen()?void 0:"","data-disabled":i.disabled?"":void 0})),u={dataset:l,isOpen:a.isOpen,disabled:()=>i.disabled??!1,shouldMount:()=>i.forceMount||a.isOpen(),contentId:o,toggle:a.toggle,generateId:Nn(()=>n.id),registerContentId:tn(s)};return c(Op.Provider,{value:u,get children(){return c(it,ie({as:"div"},l,n))}})}function Rc(e){const t=Go(),[r,i]=$e(e,["onClick"]);return c(Ro,ie({get"aria-expanded"(){return t.isOpen()},get"aria-controls"(){return Te(()=>!!t.isOpen())()?t.contentId():void 0},get disabled(){return t.disabled()},onClick:o=>{Qe(o,r.onClick),t.toggle()}},()=>t.dataset(),i))}var ha=Object.assign(Nc,{Content:Fc,Trigger:Rc}),HS={};ir(HS,{Accordion:()=>Vi,Content:()=>zp,Header:()=>Lp,Item:()=>Np,Root:()=>Rp,Trigger:()=>jp,useAccordionContext:()=>jc});var Ep=Rt();function Mp(){const e=jt(Ep);if(e===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return e}function zp(e){const t=Mp(),r=t.generateId("content"),i=Ge({id:r},e),[n,o]=$e(i,["id","style"]);return ne(()=>je(t.registerContentId(n.id))),c(Fc,ie({role:"region",get"aria-labelledby"(){return t.triggerId()},get style(){return vr({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},n.style)}},o))}function Lp(e){const t=Go();return c(it,ie({as:"h3"},()=>t.dataset(),e))}var Fp=Rt();function jc(){const e=jt(Fp);if(e===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return e}function Np(e){const t=jc(),r=`${t.generateId("item")}-${nn()}`,i=Ge({id:r},e),[n,o]=$e(i,["value","disabled"]),[s,a]=ze(),[l,u]=ze(),d=()=>t.listState().selectionManager(),f=()=>d().isSelected(n.value),m={value:()=>n.value,triggerId:s,contentId:l,generateId:Nn(()=>o.id),registerTriggerId:tn(a),registerContentId:tn(u)};return c(Ep.Provider,{value:m,get children(){return c(Nc,ie({get open(){return f()},get disabled(){return n.disabled}},o))}})}function Rp(e){let t;const r=`accordion-${nn()}`,i=Ge({id:r,multiple:!1,collapsible:!1,shouldFocusWrap:!0},e),[n,o]=$e(i,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[s,a]=ze([]),{DomCollectionProvider:l}=Pc({items:s,onItemsChange:a}),u=Bo({selectedKeys:()=>n.value,defaultSelectedKeys:()=>n.defaultValue,onSelectionChange:m=>n.onChange?.(Array.from(m)),disallowEmptySelection:()=>!n.multiple&&!n.collapsible,selectionMode:()=>n.multiple?"multiple":"single",dataSource:s});u.selectionManager().setFocusedKey("item-1");const d=Tc({selectionManager:()=>u.selectionManager(),collection:()=>u.collection(),disallowEmptySelection:()=>u.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>n.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>t),f={listState:()=>u,generateId:Nn(()=>n.id)};return c(l,{get children(){return c(Fp.Provider,{value:f,get children(){return c(it,ie({as:"div",get id(){return n.id},ref(m){var h=xt(g=>t=g,n.ref);typeof h=="function"&&h(m)},get onKeyDown(){return et([n.onKeyDown,d.onKeyDown])},get onMouseDown(){return et([n.onMouseDown,d.onMouseDown])},get onFocusIn(){return et([n.onFocusIn])},get onFocusOut(){return et([n.onFocusOut,d.onFocusOut])}},o))}})}})}function jp(e){let t;const r=jc(),i=Mp(),n=Go(),o=i.generateId("trigger"),s=Ge({id:o},e),[a,l]=$e(s,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);Oc({getItem:()=>({ref:()=>t,type:"item",key:i.value(),textValue:"",disabled:n.disabled()})});const u=Vo({key:()=>i.value(),selectionManager:()=>r.listState().selectionManager(),disabled:()=>n.disabled(),shouldSelectOnPressUp:!0},()=>t),d=f=>{["Enter"," "].includes(f.key)&&f.preventDefault(),Qe(f,a.onKeyDown),Qe(f,u.onKeyDown)};return ne(()=>je(i.registerTriggerId(l.id))),c(Rc,ie({ref(f){var m=xt(h=>t=h,a.ref);typeof m=="function"&&m(f)},get"data-key"(){return u.dataKey()},get onPointerDown(){return et([a.onPointerDown,u.onPointerDown])},get onPointerUp(){return et([a.onPointerUp,u.onPointerUp])},get onClick(){return et([a.onClick,u.onClick])},onKeyDown:d,get onMouseDown(){return et([a.onMouseDown,u.onMouseDown])},get onFocus(){return et([a.onFocus,u.onFocus])}},l))}var Vi=Object.assign(Rp,{Content:zp,Header:Lp,Item:Np,Trigger:jp});function qS(e){const[t,r]=$e(e,["class","classList"]);return c(Vi,ie(r,{"data-component":"accordion",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function GS(e){const[t,r]=$e(e,["class","classList"]);return c(Vi.Item,ie(r,{"data-slot":"accordion-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function WS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Vi.Header,ie(r,{"data-slot":"accordion-header",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function XS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Vi.Trigger,ie(r,{"data-slot":"accordion-trigger",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function YS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Vi.Content,ie(r,{"data-slot":"accordion-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}const Kt=Object.assign(qS,{Item:GS,Header:WS,Trigger:XS,Content:YS});function Wo(e){return c(Kt.Header,{"data-component":"sticky-accordion-header",get classList(){return{...e.classList??{},[e.class??""]:!!e.class}},get children(){return e.children}})}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Up,setPrototypeOf:Pf,isFrozen:JS,getPrototypeOf:QS,getOwnPropertyDescriptor:ek}=Object;let{freeze:bn,seal:Fn,create:Cl}=Object,{apply:Il,construct:Tl}=typeof Reflect<"u"&&Reflect;bn||(bn=function(t){return t});Fn||(Fn=function(t){return t});Il||(Il=function(t,r){for(var i=arguments.length,n=new Array(i>2?i-2:0),o=2;o<i;o++)n[o-2]=arguments[o];return t.apply(r,n)});Tl||(Tl=function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return new t(...i)});const gs=yn(Array.prototype.forEach),tk=yn(Array.prototype.lastIndexOf),Of=yn(Array.prototype.pop),so=yn(Array.prototype.push),nk=yn(Array.prototype.splice),Ds=yn(String.prototype.toLowerCase),Ja=yn(String.prototype.toString),Qa=yn(String.prototype.match),ao=yn(String.prototype.replace),rk=yn(String.prototype.indexOf),ik=yn(String.prototype.trim),Vn=yn(Object.prototype.hasOwnProperty),mn=yn(RegExp.prototype.test),lo=ok(TypeError);function yn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Il(e,t,i)}}function ok(e){return function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Tl(e,r)}}function mt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ds;Pf&&Pf(e,null);let i=t.length;for(;i--;){let n=t[i];if(typeof n=="string"){const o=r(n);o!==n&&(JS(t)||(t[i]=o),n=o)}e[n]=!0}return e}function sk(e){for(let t=0;t<e.length;t++)Vn(e,t)||(e[t]=null);return e}function tr(e){const t=Cl(null);for(const[r,i]of Up(e))Vn(e,r)&&(Array.isArray(i)?t[r]=sk(i):i&&typeof i=="object"&&i.constructor===Object?t[r]=tr(i):t[r]=i);return t}function co(e,t){for(;e!==null;){const i=ek(e,t);if(i){if(i.get)return yn(i.get);if(typeof i.value=="function")return yn(i.value)}e=QS(e)}function r(){return null}return r}const Ef=bn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),el=bn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),tl=bn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ak=bn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nl=bn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),lk=bn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Mf=bn(["#text"]),zf=bn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),rl=bn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Lf=bn(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),hs=bn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ck=Fn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),uk=Fn(/<%[\w\W]*|[\w\W]*%>/gm),dk=Fn(/\$\{[\w\W]*/gm),fk=Fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),mk=Fn(/^aria-[\-\w]+$/),Kp=Fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gk=Fn(/^(?:\w+script|data):/i),hk=Fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Vp=Fn(/^html$/i),pk=Fn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ff=Object.freeze({__proto__:null,ARIA_ATTR:mk,ATTR_WHITESPACE:hk,CUSTOM_ELEMENT:pk,DATA_ATTR:fk,DOCTYPE_NAME:Vp,ERB_EXPR:uk,IS_ALLOWED_URI:Kp,IS_SCRIPT_OR_DATA:gk,MUSTACHE_EXPR:ck,TMPLIT_EXPR:dk});const uo={element:1,text:3,progressingInstruction:7,comment:8,document:9},vk=function(){return typeof window>"u"?null:window},bk=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const n="data-tt-policy-suffix";r&&r.hasAttribute(n)&&(i=r.getAttribute(n));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Nf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Bp(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vk();const t=he=>Bp(he);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==uo.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const i=r,n=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:u,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:h}=e,g=l.prototype,y=co(g,"cloneNode"),b=co(g,"remove"),v=co(g,"nextSibling"),w=co(g,"childNodes"),x=co(g,"parentNode");if(typeof s=="function"){const he=r.createElement("template");he.content&&he.content.ownerDocument&&(r=he.content.ownerDocument)}let _,k="";const{implementation:C,createNodeIterator:O,createDocumentFragment:z,getElementsByTagName:K}=r,{importNode:J}=i;let T=Nf();t.isSupported=typeof Up=="function"&&typeof x=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:U,TMPLIT_EXPR:A,DATA_ATTR:j,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:V}=Ff;let{IS_ALLOWED_URI:Q}=Ff,ee=null;const oe=mt({},[...Ef,...el,...tl,...nl,...Mf]);let le=null;const W=mt({},[...zf,...rl,...Lf,...hs]);let D=Object.seal(Cl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),te=null,H=null;const Z=Object.seal(Cl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let se=!0,re=!0,fe=!1,Se=!0,Ne=!1,ce=!0,ye=!1,G=!1,we=!1,ke=!1,ue=!1,me=!1,Ue=!0,be=!1;const Be="user-content-";let E=!0,ae=!1,de={},Ee=null;const Re=mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ot=null;const Pe=mt({},["audio","video","img","source","image","track"]);let Oe=null;const pe=mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),De="http://www.w3.org/1998/Math/MathML",st="http://www.w3.org/2000/svg",Je="http://www.w3.org/1999/xhtml";let Ve=Je,ht=!1,Mt=null;const Tt=mt({},[De,st,Je],Ja);let zt=mt({},["mi","mo","mn","ms","mtext"]),rn=mt({},["annotation-xml"]);const $r=mt({},["title","style","font","a","script"]);let Un=null;const Kn=["application/xhtml+xml","text/html"],Br="text/html";let At=null,kn=null;const Yi=r.createElement("form"),Pn=function(L){return L instanceof RegExp||L instanceof Function},lr=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(kn&&kn===L)){if((!L||typeof L!="object")&&(L={}),L=tr(L),Un=Kn.indexOf(L.PARSER_MEDIA_TYPE)===-1?Br:L.PARSER_MEDIA_TYPE,At=Un==="application/xhtml+xml"?Ja:Ds,ee=Vn(L,"ALLOWED_TAGS")?mt({},L.ALLOWED_TAGS,At):oe,le=Vn(L,"ALLOWED_ATTR")?mt({},L.ALLOWED_ATTR,At):W,Mt=Vn(L,"ALLOWED_NAMESPACES")?mt({},L.ALLOWED_NAMESPACES,Ja):Tt,Oe=Vn(L,"ADD_URI_SAFE_ATTR")?mt(tr(pe),L.ADD_URI_SAFE_ATTR,At):pe,ot=Vn(L,"ADD_DATA_URI_TAGS")?mt(tr(Pe),L.ADD_DATA_URI_TAGS,At):Pe,Ee=Vn(L,"FORBID_CONTENTS")?mt({},L.FORBID_CONTENTS,At):Re,te=Vn(L,"FORBID_TAGS")?mt({},L.FORBID_TAGS,At):tr({}),H=Vn(L,"FORBID_ATTR")?mt({},L.FORBID_ATTR,At):tr({}),de=Vn(L,"USE_PROFILES")?L.USE_PROFILES:!1,se=L.ALLOW_ARIA_ATTR!==!1,re=L.ALLOW_DATA_ATTR!==!1,fe=L.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=L.SAFE_FOR_TEMPLATES||!1,ce=L.SAFE_FOR_XML!==!1,ye=L.WHOLE_DOCUMENT||!1,ke=L.RETURN_DOM||!1,ue=L.RETURN_DOM_FRAGMENT||!1,me=L.RETURN_TRUSTED_TYPE||!1,we=L.FORCE_BODY||!1,Ue=L.SANITIZE_DOM!==!1,be=L.SANITIZE_NAMED_PROPS||!1,E=L.KEEP_CONTENT!==!1,ae=L.IN_PLACE||!1,Q=L.ALLOWED_URI_REGEXP||Kp,Ve=L.NAMESPACE||Je,zt=L.MATHML_TEXT_INTEGRATION_POINTS||zt,rn=L.HTML_INTEGRATION_POINTS||rn,D=L.CUSTOM_ELEMENT_HANDLING||{},L.CUSTOM_ELEMENT_HANDLING&&Pn(L.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=L.CUSTOM_ELEMENT_HANDLING.tagNameCheck),L.CUSTOM_ELEMENT_HANDLING&&Pn(L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(D.allowCustomizedBuiltInElements=L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(re=!1),ue&&(ke=!0),de&&(ee=mt({},Mf),le=[],de.html===!0&&(mt(ee,Ef),mt(le,zf)),de.svg===!0&&(mt(ee,el),mt(le,rl),mt(le,hs)),de.svgFilters===!0&&(mt(ee,tl),mt(le,rl),mt(le,hs)),de.mathMl===!0&&(mt(ee,nl),mt(le,Lf),mt(le,hs))),L.ADD_TAGS&&(typeof L.ADD_TAGS=="function"?Z.tagCheck=L.ADD_TAGS:(ee===oe&&(ee=tr(ee)),mt(ee,L.ADD_TAGS,At))),L.ADD_ATTR&&(typeof L.ADD_ATTR=="function"?Z.attributeCheck=L.ADD_ATTR:(le===W&&(le=tr(le)),mt(le,L.ADD_ATTR,At))),L.ADD_URI_SAFE_ATTR&&mt(Oe,L.ADD_URI_SAFE_ATTR,At),L.FORBID_CONTENTS&&(Ee===Re&&(Ee=tr(Ee)),mt(Ee,L.FORBID_CONTENTS,At)),L.ADD_FORBID_CONTENTS&&(Ee===Re&&(Ee=tr(Ee)),mt(Ee,L.ADD_FORBID_CONTENTS,At)),E&&(ee["#text"]=!0),ye&&mt(ee,["html","head","body"]),ee.table&&(mt(ee,["tbody"]),delete te.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw lo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw lo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=L.TRUSTED_TYPES_POLICY,k=_.createHTML("")}else _===void 0&&(_=bk(h,n)),_!==null&&typeof k=="string"&&(k=_.createHTML(""));bn&&bn(L),kn=L}},cr=mt({},[...el,...tl,...ak]),on=mt({},[...nl,...lk]),pi=function(L){let xe=x(L);(!xe||!xe.tagName)&&(xe={namespaceURI:Ve,tagName:"template"});const Ke=Ds(L.tagName),wt=Ds(xe.tagName);return Mt[L.namespaceURI]?L.namespaceURI===st?xe.namespaceURI===Je?Ke==="svg":xe.namespaceURI===De?Ke==="svg"&&(wt==="annotation-xml"||zt[wt]):!!cr[Ke]:L.namespaceURI===De?xe.namespaceURI===Je?Ke==="math":xe.namespaceURI===st?Ke==="math"&&rn[wt]:!!on[Ke]:L.namespaceURI===Je?xe.namespaceURI===st&&!rn[wt]||xe.namespaceURI===De&&!zt[wt]?!1:!on[Ke]&&($r[Ke]||!cr[Ke]):!!(Un==="application/xhtml+xml"&&Mt[L.namespaceURI]):!1},an=function(L){so(t.removed,{element:L});try{x(L).removeChild(L)}catch{b(L)}},On=function(L,xe){try{so(t.removed,{attribute:xe.getAttributeNode(L),from:xe})}catch{so(t.removed,{attribute:null,from:xe})}if(xe.removeAttribute(L),L==="is")if(ke||ue)try{an(xe)}catch{}else try{xe.setAttribute(L,"")}catch{}},Zr=function(L){let xe=null,Ke=null;if(we)L="<remove></remove>"+L;else{const St=Qa(L,/^[\r\n\t ]+/);Ke=St&&St[0]}Un==="application/xhtml+xml"&&Ve===Je&&(L='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+L+"</body></html>");const wt=_?_.createHTML(L):L;if(Ve===Je)try{xe=new m().parseFromString(wt,Un)}catch{}if(!xe||!xe.documentElement){xe=C.createDocument(Ve,"template",null);try{xe.documentElement.innerHTML=ht?k:wt}catch{}}const Bt=xe.body||xe.documentElement;return L&&Ke&&Bt.insertBefore(r.createTextNode(Ke),Bt.childNodes[0]||null),Ve===Je?K.call(xe,ye?"html":"body")[0]:ye?xe.documentElement:Bt},Sr=function(L){return O.call(L.ownerDocument||L,L,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Hr=function(L){return L instanceof f&&(typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||!(L.attributes instanceof d)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function")},N=function(L){return typeof a=="function"&&L instanceof a};function X(he,L,xe){gs(he,Ke=>{Ke.call(t,L,xe,kn)})}const ge=function(L){let xe=null;if(X(T.beforeSanitizeElements,L,null),Hr(L))return an(L),!0;const Ke=At(L.nodeName);if(X(T.uponSanitizeElement,L,{tagName:Ke,allowedTags:ee}),ce&&L.hasChildNodes()&&!N(L.firstElementChild)&&mn(/<[/\w!]/g,L.innerHTML)&&mn(/<[/\w!]/g,L.textContent)||L.nodeType===uo.progressingInstruction||ce&&L.nodeType===uo.comment&&mn(/<[/\w]/g,L.data))return an(L),!0;if(!(Z.tagCheck instanceof Function&&Z.tagCheck(Ke))&&(!ee[Ke]||te[Ke])){if(!te[Ke]&&at(Ke)&&(D.tagNameCheck instanceof RegExp&&mn(D.tagNameCheck,Ke)||D.tagNameCheck instanceof Function&&D.tagNameCheck(Ke)))return!1;if(E&&!Ee[Ke]){const wt=x(L)||L.parentNode,Bt=w(L)||L.childNodes;if(Bt&&wt){const St=Bt.length;for(let Zt=St-1;Zt>=0;--Zt){const En=y(Bt[Zt],!0);En.__removalCount=(L.__removalCount||0)+1,wt.insertBefore(En,v(L))}}}return an(L),!0}return L instanceof l&&!pi(L)||(Ke==="noscript"||Ke==="noembed"||Ke==="noframes")&&mn(/<\/no(script|embed|frames)/i,L.innerHTML)?(an(L),!0):(Ne&&L.nodeType===uo.text&&(xe=L.textContent,gs([M,U,A],wt=>{xe=ao(xe,wt," ")}),L.textContent!==xe&&(so(t.removed,{element:L.cloneNode()}),L.textContent=xe)),X(T.afterSanitizeElements,L,null),!1)},He=function(L,xe,Ke){if(Ue&&(xe==="id"||xe==="name")&&(Ke in r||Ke in Yi))return!1;if(!(re&&!H[xe]&&mn(j,xe))){if(!(se&&mn(P,xe))){if(!(Z.attributeCheck instanceof Function&&Z.attributeCheck(xe,L))){if(!le[xe]||H[xe]){if(!(at(L)&&(D.tagNameCheck instanceof RegExp&&mn(D.tagNameCheck,L)||D.tagNameCheck instanceof Function&&D.tagNameCheck(L))&&(D.attributeNameCheck instanceof RegExp&&mn(D.attributeNameCheck,xe)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(xe,L))||xe==="is"&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&mn(D.tagNameCheck,Ke)||D.tagNameCheck instanceof Function&&D.tagNameCheck(Ke))))return!1}else if(!Oe[xe]){if(!mn(Q,ao(Ke,R,""))){if(!((xe==="src"||xe==="xlink:href"||xe==="href")&&L!=="script"&&rk(Ke,"data:")===0&&ot[L])){if(!(fe&&!mn(B,ao(Ke,R,"")))){if(Ke)return!1}}}}}}}return!0},at=function(L){return L!=="annotation-xml"&&Qa(L,V)},$t=function(L){X(T.beforeSanitizeAttributes,L,null);const{attributes:xe}=L;if(!xe||Hr(L))return;const Ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:le,forceKeepAttr:void 0};let wt=xe.length;for(;wt--;){const Bt=xe[wt],{name:St,namespaceURI:Zt,value:En}=Bt,qr=At(St),Ji=En;let Xt=St==="value"?Ji:ik(Ji);if(Ke.attrName=qr,Ke.attrValue=Xt,Ke.keepAttr=!0,Ke.forceKeepAttr=void 0,X(T.uponSanitizeAttribute,L,Ke),Xt=Ke.attrValue,be&&(qr==="id"||qr==="name")&&(On(St,L),Xt=Be+Xt),ce&&mn(/((--!?|])>)|<\/(style|title|textarea)/i,Xt)){On(St,L);continue}if(qr==="attributename"&&Qa(Xt,"href")){On(St,L);continue}if(Ke.forceKeepAttr)continue;if(!Ke.keepAttr){On(St,L);continue}if(!Se&&mn(/\/>/i,Xt)){On(St,L);continue}Ne&&gs([M,U,A],Gr=>{Xt=ao(Xt,Gr," ")});const Qi=At(L.nodeName);if(!He(Qi,qr,Xt)){On(St,L);continue}if(_&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Zt)switch(h.getAttributeType(Qi,qr)){case"TrustedHTML":{Xt=_.createHTML(Xt);break}case"TrustedScriptURL":{Xt=_.createScriptURL(Xt);break}}if(Xt!==Ji)try{Zt?L.setAttributeNS(Zt,St,Xt):L.setAttribute(St,Xt),Hr(L)?an(L):Of(t.removed)}catch{On(St,L)}}X(T.afterSanitizeAttributes,L,null)},lt=function he(L){let xe=null;const Ke=Sr(L);for(X(T.beforeSanitizeShadowDOM,L,null);xe=Ke.nextNode();)X(T.uponSanitizeShadowNode,xe,null),ge(xe),$t(xe),xe.content instanceof o&&he(xe.content);X(T.afterSanitizeShadowDOM,L,null)};return t.sanitize=function(he){let L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},xe=null,Ke=null,wt=null,Bt=null;if(ht=!he,ht&&(he="<!-->"),typeof he!="string"&&!N(he))if(typeof he.toString=="function"){if(he=he.toString(),typeof he!="string")throw lo("dirty is not a string, aborting")}else throw lo("toString is not a function");if(!t.isSupported)return he;if(G||lr(L),t.removed=[],typeof he=="string"&&(ae=!1),ae){if(he.nodeName){const En=At(he.nodeName);if(!ee[En]||te[En])throw lo("root node is forbidden and cannot be sanitized in-place")}}else if(he instanceof a)xe=Zr("<!---->"),Ke=xe.ownerDocument.importNode(he,!0),Ke.nodeType===uo.element&&Ke.nodeName==="BODY"||Ke.nodeName==="HTML"?xe=Ke:xe.appendChild(Ke);else{if(!ke&&!Ne&&!ye&&he.indexOf("<")===-1)return _&&me?_.createHTML(he):he;if(xe=Zr(he),!xe)return ke?null:me?k:""}xe&&we&&an(xe.firstChild);const St=Sr(ae?he:xe);for(;wt=St.nextNode();)ge(wt),$t(wt),wt.content instanceof o&&lt(wt.content);if(ae)return he;if(ke){if(ue)for(Bt=z.call(xe.ownerDocument);xe.firstChild;)Bt.appendChild(xe.firstChild);else Bt=xe;return(le.shadowroot||le.shadowrootmode)&&(Bt=J.call(i,Bt,!0)),Bt}let Zt=ye?xe.outerHTML:xe.innerHTML;return ye&&ee["!doctype"]&&xe.ownerDocument&&xe.ownerDocument.doctype&&xe.ownerDocument.doctype.name&&mn(Vp,xe.ownerDocument.doctype.name)&&(Zt="<!DOCTYPE "+xe.ownerDocument.doctype.name+`>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-manage-models-DjTSA1_m.js","assets/index-D2xlzX6B.js","assets/index-SW1-heh1.css","assets/dialog-BqWGsiNr.js","assets/dialog-select-file-BItJBmej.js","assets/datetime-D2JCa3fE.js","assets/ghostty-web-BgPuLERF.js","assets/dialog-select-mcp-C_fdDDWz.js","assets/dialog-fork-Drw_HDnF.js"])))=>i.map(i=>d[i]);
2
+ import{f as $,o as je,$ as Ex,n as kt,q as wl,r as ze,v as ie,w as We,g as c,x as Te,y as ne,z as F,i as p,A as Ae,C as Jt,D as gr,E as ut,P as hr,G as $n,H as Rt,J as Vt,K as jt,t as I,N as Mx,O as zx,Q as Ce,R as Lx,U as oo,V as Fx,W as qe,X as vn,Y as Nr,Z as Hg,_ as gf,a0 as xl,a1 as Qe,a2 as qg,a3 as Ge,a4 as Nx,a5 as Gg,a6 as ea,a7 as $e,a8 as Rr,a9 as xt,aa as dn,F as rt,ab as cc,ac as Ie,ad as Wg,ae as it,af as nn,ag as Xg,ah as et,S as Gt,M as Xe,ai as tn,aj as Nn,ak as ir,al as zi,am as Li,an as Fi,ao as Yg,ap as Jg,aq as Ro,ar as uc,as as dc,at as fc,au as mc,av as Ni,aw as gc,ax as vr,ay as hc,az as jo,aA as li,aB as pc,aC as ta,aD as vc,aE as Qg,aF as bc,B as vt,h as bt,aG as Rx,aH as jx,aI as Ux,aJ as Uo,aK as Ot,aL as Ct,aM as Kx,aN as Mn,aO as eh,aP as Vx,aQ as th,aR as Bx,aS as Do,aT as Zx,aU as Hx,aV as ft,aW as Pr,aX as ln,a as or,aY as yc,aZ as wc,a_ as nh,d as rh,a$ as Rn,c as na,b0 as sr,b1 as Ko,b2 as qx,b3 as Os,b4 as Es,b5 as Gx,b6 as So,I as Pt,T as Et,j as _t,s as Nt,b7 as Wx,b8 as Xx,b9 as Ci,ba as yt,bb as pt,bc as ih,bd as Yx,be as jr,l as Qt,bf as oh,bg as sh,bh as Ri,b as ra,u as xc,bi as ji,bj as Ui,m as hf,k as _l,bk as Ms,bl as ah,bm as br,bn as Bn,bo as Jx,bp as _c,bq as $c,br as ms,bs as Qx,bt as Dr,bu as lh,bv as ch,bw as e_,bx as t_,by as n_,bz as Ur,bA as uh,bB as Jn,bC as pf,bD as yr,bE as Sc,bF as Ki,bG as pr,e as r_,bH as kc,bI as vf,bJ as bf,bK as i_,bL as Ii,bM as Ga,bN as o_,bO as s_,bP as a_,bQ as ia,bR as l_,bS as c_,bT as Cc,bU as $l,bV as yf,bW as u_,bX as d_,bY as f_,bZ as m_,b_ as g_,b$ as h_}from"./index-D2xlzX6B.js";import{D as Sl}from"./datetime-D2JCa3fE.js";import{D as dh}from"./dialog-BqWGsiNr.js";const Wa=Symbol("fallback");function wf(e){for(const t of e)t.dispose()}function p_(e,t,r,i={}){const n=new Map;return je(()=>wf(n.values())),()=>{const s=e()||[];return s[Ex],kt(()=>{if(!s.length)return wf(n.values()),n.clear(),i.fallback?[wl(f=>(n.set(Wa,{dispose:f}),i.fallback()))]:[];const a=new Array(s.length),l=n.get(Wa);if(!n.size||l){l?.dispose(),n.delete(Wa);for(let d=0;d<s.length;d++){const f=s[d],m=t(f,d);o(a,f,d,m)}return a}const u=new Set(n.keys());for(let d=0;d<s.length;d++){const f=s[d],m=t(f,d);u.delete(m);const h=n.get(m);h?(a[d]=h.mapped,h.setIndex?.(d),h.setItem(()=>f)):o(a,f,d,m)}for(const d of u)n.get(d)?.dispose(),n.delete(d);return a})};function o(s,a,l,u){wl(d=>{const[f,m]=ze(a),h={setItem:m,dispose:d};if(r.length>1){const[g,y]=ze(l);h.setIndex=y,h.mapped=r(f,g)}else h.mapped=r(f);n.set(u,h),s[l]=h.mapped})}}function v_(e){const{by:t}=e;return $(p_(()=>e.each,typeof t=="function"?t:r=>r[t],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function Ao(e){const t=Math.min(e.start,e.end),r=Math.max(e.start,e.end);return{startLine:t,endLine:r,startChar:0,endChar:0}}var b_=I("<div>"),oa=class{x;y;width;height;constructor(e){this.x=Math.floor(e.x),this.y=Math.floor(e.y),this.width=Math.floor(e.width),this.height=Math.floor(e.height)}get rect(){return{x:this.x,y:this.y,width:this.width,height:this.height}}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get center(){return{x:this.x+this.width*.5,y:this.y+this.height*.5}}get corners(){return{topLeft:{x:this.left,y:this.top},topRight:{x:this.right,y:this.top},bottomRight:{x:this.left,y:this.bottom},bottomLeft:{x:this.right,y:this.bottom}}}},Si=e=>{let t=new oa(e.getBoundingClientRect());const{transform:r}=getComputedStyle(e);return r&&(t=y_(t,r)),t},y_=(e,t)=>{let r,i;if(t.startsWith("matrix3d(")){const n=t.slice(9,-1).split(/, /);r=+n[12],i=+n[13]}else if(t.startsWith("matrix(")){const n=t.slice(7,-1).split(/, /);r=+n[4],i=+n[5]}else r=0,i=0;return new oa({...e,x:e.x-r,y:e.y-i})},Zn=()=>({x:0,y:0}),Ic=(e,t)=>e.x===t.x&&e.y===t.y,Xa=(e,t)=>new oa({...e,x:e.x+t.x,y:e.y+t.y}),w_=(e,t)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),x_=(e,t)=>{const r=Math.max(e.top,t.top),i=Math.max(e.left,t.left),n=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom),s=n-i,a=o-r;if(i<n&&r<o){const l=e.width*e.height,u=t.width*t.height,d=s*a;return d/(l+u-d)}return 0},Ya=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,fh=(e,t,r)=>{const i=e.transformed.center,n={distance:1/0,droppable:null};for(const o of t){const s=w_(i,o.layout.center);s<n.distance?(n.distance=s,n.droppable=o):s===n.distance&&o.id===r.activeDroppableId&&(n.droppable=o)}return n.droppable},__=(e,t,r)=>{const i=e.transformed,n={ratio:0,droppable:null};for(const o of t){const s=x_(i,o.layout);s>n.ratio?(n.ratio=s,n.droppable=o):s>0&&s===n.ratio&&o.id===r.activeDroppableId&&(n.droppable=o)}return n.droppable},mh=Rt(),gh=e=>{const t=ie({collisionDetector:__},e),[r,i]=We({draggables:{},droppables:{},sensors:{},active:{draggableId:null,get draggable(){return r.active.draggableId!==null?r.draggables[r.active.draggableId]:null},droppableId:null,get droppable(){return r.active.droppableId!==null?r.droppables[r.active.droppableId]:null},sensorId:null,get sensor(){return r.active.sensorId!==null?r.sensors[r.active.sensorId]:null},overlay:null}}),n=(A,j,P)=>{A.substring(0,A.length-1),kt(()=>r[A][j])&&i(A,j,"transformers",P.id,P)},o=(A,j,P)=>{A.substring(0,A.length-1),kt(()=>r[A][j])&&kt(()=>r[A][j].transformers[P])&&i(A,j,"transformers",P,void 0)},s=({id:A,node:j,layout:P,data:B})=>{const R=r.draggables[A],V={id:A,node:j,layout:P,data:B,_pendingCleanup:!1};let Q;if(!R)Object.defineProperties(V,{transformers:{enumerable:!0,configurable:!0,writable:!0,value:{}},transform:{enumerable:!0,configurable:!0,get:()=>{if(r.active.overlay)return Zn();const ee=Object.values(r.draggables[A].transformers);return ee.sort((oe,le)=>oe.order-le.order),ee.reduce((oe,le)=>le.callback(oe),Zn())}},transformed:{enumerable:!0,configurable:!0,get:()=>Xa(r.draggables[A].layout,r.draggables[A].transform)}});else if(r.active.draggableId===A&&!r.active.overlay){const ee={x:R.layout.x-P.x,y:R.layout.y-P.y},oe="addDraggable-existing-offset",le=R.transformers[oe],W=le?le.callback(ee):ee;Q={id:oe,order:100,callback:D=>({x:D.x+W.x,y:D.y+W.y})},T(()=>o("draggables",A,oe))}$n(()=>{i("draggables",A,V),Q&&n("draggables",A,Q)}),r.active.draggable&&_()},a=A=>{kt(()=>r.draggables[A])&&(i("draggables",A,"_pendingCleanup",!0),queueMicrotask(()=>l(A)))},l=A=>{if(r.draggables[A]?._pendingCleanup){const j=r.active.draggableId===A;$n(()=>{j&&i("active","draggableId",null),i("draggables",A,void 0)})}},u=({id:A,node:j,layout:P,data:B})=>{const R=r.droppables[A],V={id:A,node:j,layout:P,data:B,_pendingCleanup:!1};R||Object.defineProperties(V,{transformers:{enumerable:!0,configurable:!0,writable:!0,value:{}},transform:{enumerable:!0,configurable:!0,get:()=>{const Q=Object.values(r.droppables[A].transformers);return Q.sort((ee,oe)=>ee.order-oe.order),Q.reduce((ee,oe)=>oe.callback(ee),Zn())}},transformed:{enumerable:!0,configurable:!0,get:()=>Xa(r.droppables[A].layout,r.droppables[A].transform)}}),i("droppables",A,V),r.active.draggable&&_()},d=A=>{kt(()=>r.droppables[A])&&(i("droppables",A,"_pendingCleanup",!0),queueMicrotask(()=>f(A)))},f=A=>{if(r.droppables[A]?._pendingCleanup){const j=r.active.droppableId===A;$n(()=>{j&&i("active","droppableId",null),i("droppables",A,void 0)})}},m=({id:A,activators:j})=>{i("sensors",A,{id:A,activators:j,coordinates:{origin:{x:0,y:0},current:{x:0,y:0},get delta(){return{x:r.sensors[A].coordinates.current.x-r.sensors[A].coordinates.origin.x,y:r.sensors[A].coordinates.current.y-r.sensors[A].coordinates.origin.y}}}})},h=A=>{if(!kt(()=>r.sensors[A]))return;const j=r.active.sensorId===A;$n(()=>{j&&i("active","sensorId",null),i("sensors",A,void 0)})},g=({node:A,layout:j})=>{const P=r.active.overlay,B={node:A,layout:j};P||Object.defineProperties(B,{id:{enumerable:!0,configurable:!0,get:()=>r.active.draggable?.id},data:{enumerable:!0,configurable:!0,get:()=>r.active.draggable?.data},transformers:{enumerable:!0,configurable:!0,get:()=>Object.fromEntries(Object.entries(r.active.draggable?r.active.draggable.transformers:{}).filter(([R])=>R!=="addDraggable-existing-offset"))},transform:{enumerable:!0,configurable:!0,get:()=>{const R=Object.values(r.active.overlay?r.active.overlay.transformers:[]);return R.sort((V,Q)=>V.order-Q.order),R.reduce((V,Q)=>Q.callback(V),Zn())}},transformed:{enumerable:!0,configurable:!0,get:()=>r.active.overlay?Xa(r.active.overlay.layout,r.active.overlay.transform):new oa({x:0,y:0,width:0,height:0})}}),i("active","overlay",B)},y=()=>i("active","overlay",null),b=(A,j)=>{$n(()=>{i("sensors",A,"coordinates",{origin:{...j},current:{...j}}),i("active","sensorId",A)})},v=A=>{const j=r.active.sensorId;j&&i("sensors",j,"coordinates","current",{...A})},w=()=>i("active","sensorId",null),x=(A,j)=>{const P={};for(const R of Object.values(r.sensors))if(R)for(const[V,Q]of Object.entries(R.activators))P[V]??=[],P[V].push({sensor:R,activator:Q});const B={};for(const R in P){let V=R;j&&(V=`on${R}`),B[V]=Q=>{for(const{activator:ee}of P[R]){if(r.active.sensor)break;ee(Q,A)}}}return B},_=()=>{let A=!1;const j=Object.values(r.draggables),P=Object.values(r.droppables),B=r.active.overlay;return $n(()=>{const R=new WeakMap;for(const V of j)if(V){const Q=V.layout;R.has(V.node)||R.set(V.node,Si(V.node));const ee=R.get(V.node);Ya(Q,ee)||(i("draggables",V.id,"layout",ee),A=!0)}for(const V of P)if(V){const Q=V.layout;R.has(V.node)||R.set(V.node,Si(V.node));const ee=R.get(V.node);Ya(Q,ee)||(i("droppables",V.id,"layout",ee),A=!0)}if(B){const V=B.layout,Q=Si(B.node);Ya(V,Q)||(i("active","overlay","layout",Q),A=!0)}}),A},k=()=>{const A=r.active.overlay??r.active.draggable;if(A){const j=t.collisionDetector(A,Object.values(r.droppables),{activeDroppableId:r.active.droppableId}),P=j?j.id:null;r.active.droppableId!==P&&i("active","droppableId",P)}},C=A=>{const j={id:"sensorMove",order:0,callback:P=>r.active.sensor?{x:P.x+r.active.sensor.coordinates.delta.x,y:P.y+r.active.sensor.coordinates.delta.y}:P};_(),$n(()=>{i("active","draggableId",A),n("draggables",A,j)}),k()},O=()=>{const A=kt(()=>r.active.draggableId);$n(()=>{A!==null&&o("draggables",A,"sensorMove"),i("active",["draggableId","droppableId"],null)}),_()},z=A=>{ne(()=>{const j=r.active.draggable;j&&kt(()=>A({draggable:j}))})},K=A=>{ne(()=>{const j=r.active.draggable;if(j){const P=kt(()=>r.active.overlay);Object.values(P?P.transform:j.transform),kt(()=>A({draggable:j,overlay:P}))}})},J=A=>{ne(()=>{const j=r.active.draggable,P=r.active.droppable;j&&kt(()=>A({draggable:j,droppable:P,overlay:r.active.overlay}))})},T=A=>{ne(({previousDraggable:j,previousDroppable:P,previousOverlay:B})=>{const R=r.active.draggable,V=R?r.active.droppable:null,Q=R?r.active.overlay:null;return!R&&j&&kt(()=>A({draggable:j,droppable:P,overlay:B})),{previousDraggable:R,previousDroppable:V,previousOverlay:Q}},{previousDraggable:null,previousDroppable:null,previousOverlay:null})};K(()=>k()),t.onDragStart&&z(t.onDragStart),t.onDragMove&&K(t.onDragMove),t.onDragOver&&J(t.onDragOver),t.onDragEnd&&T(t.onDragEnd);const U=[r,{addTransformer:n,removeTransformer:o,addDraggable:s,removeDraggable:a,addDroppable:u,removeDroppable:d,addSensor:m,removeSensor:h,setOverlay:g,clearOverlay:y,recomputeLayouts:_,detectCollisions:k,draggableActivators:x,sensorStart:b,sensorMove:v,sensorEnd:w,dragStart:C,dragEnd:O,onDragStart:z,onDragMove:K,onDragOver:J,onDragEnd:T}];return c(mh.Provider,{value:U,get children(){return t.children}})},ci=()=>jt(mh)||null,$_=(e="pointer-sensor")=>{const[t,{addSensor:r,removeSensor:i,sensorStart:n,sensorMove:o,sensorEnd:s,dragStart:a,dragEnd:l}]=ci(),u=250,d=10;Vt(()=>{r({id:e,activators:{pointerdown:y}})}),je(()=>{i(e)});const f=()=>t.active.sensorId===e,m={x:0,y:0};let h=null,g=null;const y=(k,C)=>{k.button===0&&(document.addEventListener("pointermove",w),document.addEventListener("pointerup",x),g=C,m.x=k.clientX,m.y=k.clientY,h=window.setTimeout(v,u))},b=()=>{h&&(clearTimeout(h),h=null),document.removeEventListener("pointermove",w),document.removeEventListener("pointerup",x),document.removeEventListener("selectionchange",_)},v=()=>{t.active.sensor?f()||b():(n(e,m),a(g),_(),document.addEventListener("selectionchange",_))},w=k=>{const C={x:k.clientX,y:k.clientY};if(!t.active.sensor){const O={x:C.x-m.x,y:C.y-m.y};Math.sqrt(O.x**2+O.y**2)>d&&v()}f()&&(k.preventDefault(),o(C))},x=k=>{b(),f()&&(k.preventDefault(),l(),s())},_=()=>{window.getSelection()?.removeAllRanges()}},hh=e=>($_(),Te(()=>e.children)),sa=e=>({transform:`translate3d(${e.x}px, ${e.y}px, 0)`}),S_=(e,t={})=>{const[r,{addDraggable:i,removeDraggable:n,draggableActivators:o}]=ci(),[s,a]=ze(null);Vt(()=>{const f=s();f&&i({id:e,node:f,layout:Si(f),data:t})}),je(()=>n(e));const l=()=>r.active.draggableId===e,u=()=>r.draggables[e]?.transform||Zn();return Object.defineProperties((f,m)=>{const h=m?m():{};ne(()=>{const g=s(),y=o(e);if(g)for(const b in y)g.addEventListener(b,y[b]);je(()=>{if(g)for(const b in y)g.removeEventListener(b,y[b])})}),a(f),h.skipTransform||ne(()=>{const g=u();if(Ic(g,Zn()))f.style.removeProperty("transform");else{const y=sa(u());f.style.setProperty("transform",y.transform??null)}})},{ref:{enumerable:!0,value:a},isActiveDraggable:{enumerable:!0,get:l},dragActivators:{enumerable:!0,get:()=>o(e,!0)},transform:{enumerable:!0,get:u}})},k_=(e,t={})=>{const[r,{addDroppable:i,removeDroppable:n}]=ci(),[o,s]=ze(null);Vt(()=>{const d=o();d&&i({id:e,node:d,layout:Si(d),data:t})}),je(()=>n(e));const a=()=>r.active.droppableId===e,l=()=>r.droppables[e]?.transform||Zn();return Object.defineProperties((d,f)=>{const m=f?f():{};s(d),m.skipTransform||ne(()=>{const h=l();if(Ic(h,Zn()))d.style.removeProperty("transform");else{const g=sa(l());d.style.setProperty("transform",g.transform??null)}})},{ref:{enumerable:!0,value:s},isActiveDroppable:{enumerable:!0,get:a},transform:{enumerable:!0,get:l}})},ph=e=>{const[t,{onDragStart:r,onDragEnd:i,setOverlay:n,clearOverlay:o}]=ci();let s;r(({draggable:l})=>{n({node:l.node,layout:l.layout}),queueMicrotask(()=>{if(s){const u=Si(s),d={x:(l.layout.width-u.width)/2,y:(l.layout.height-u.height)/2};u.x+=d.x,u.y+=d.y,n({node:s,layout:u})}})}),i(()=>queueMicrotask(o));const a=()=>{const l=t.active.overlay,u=t.active.draggable;return!l||!u?{}:{position:"fixed",transition:"transform 0s",top:`${l.layout.top}px`,left:`${l.layout.left}px`,"min-width":`${u.layout.width}px`,"min-height":`${u.layout.height}px`,...sa(l.transform),...e.style}};return c(hr,{get mount(){return document.body},get children(){return c(F,{get when(){return t.active.draggable},get children(){var l=b_(),u=s;return typeof u=="function"?ut(u,l):s=l,p(l,(()=>{var d=Te(()=>typeof e.children=="function");return()=>d()?e.children(t.active.draggable):e.children})()),Ae(d=>{var f=e.class,m=a();return f!==d.e&&Jt(l,d.e=f),d.t=gr(l,m,d.t),d},{e:void 0,t:void 0}),l}})}})},C_=(e,t,r)=>{const i=e.slice();return i.splice(r,0,...i.splice(t,1)),i},vh=Rt(),bh=e=>{const[t]=ci(),[r,i]=We({initialIds:[],sortedIds:[]}),n=a=>a>=0&&a<r.initialIds.length;ne(()=>{i("initialIds",[...e.ids]),i("sortedIds",[...e.ids])}),ne(()=>{t.active.draggableId&&t.active.droppableId?kt(()=>{const a=r.sortedIds.indexOf(t.active.draggableId),l=r.initialIds.indexOf(t.active.droppableId);if(!n(a)||!n(l))i("sortedIds",[...e.ids]);else if(a!==l){const u=C_(r.sortedIds,a,l);i("sortedIds",u)}}):i("sortedIds",[...e.ids])});const s=[r,{}];return c(vh.Provider,{value:s,get children(){return e.children}})},I_=()=>jt(vh)||null,T_=(e,t)=>r=>{e(r),t(r)},yh=(e,t={})=>{const[r,{addTransformer:i,removeTransformer:n}]=ci(),[o]=I_(),s=S_(e,t),a=k_(e,t),l=T_(s.ref,a.ref),u=()=>o.initialIds.indexOf(e),d=()=>o.sortedIds.indexOf(e),f=b=>r.droppables[b]?.layout||null,m=()=>{const b=Zn(),v=u(),w=d();if(w!==v){const x=f(e),_=f(o.initialIds[w]);x&&_&&(b.x=_.x-x.x,b.y=_.y-x.y)}return b},h={id:"sortableOffset",order:100,callback:b=>{const v=m();return{x:b.x+v.x,y:b.y+v.y}}};Vt(()=>i("droppables",e,h)),je(()=>n("droppables",e,h.id));const g=()=>(e===r.active.draggableId&&!r.active.overlay?r.draggables[e]?.transform:r.droppables[e]?.transform)||Zn();return Object.defineProperties(b=>{s(b,()=>({skipTransform:!0})),a(b,()=>({skipTransform:!0})),ne(()=>{const v=g();if(Ic(v,Zn()))b.style.removeProperty("transform");else{const w=sa(g());b.style.setProperty("transform",w.transform??null)}})},{ref:{enumerable:!0,value:l},transform:{enumerable:!0,get:g},isActiveDraggable:{enumerable:!0,get:()=>s.isActiveDraggable},dragActivators:{enumerable:!0,get:()=>s.dragActivators},isActiveDroppable:{enumerable:!0,get:()=>a.isActiveDroppable}})};const D_=e=>typeof e!="object"||e===null?!1:"draggable"in e,zs=e=>{if(!D_(e))return;const t=e.draggable;if(t)return typeof t.id=="string"?t.id:void 0},A_=(e,t)=>({id:e,order:100,callback:r=>t==="x"?{...r,x:0}:{...r,y:0}}),P_=(e,t)=>()=>{const r=ci();if(!r)return null;const[,{onDragStart:i,onDragEnd:n,addTransformer:o,removeTransformer:s}]=r,a=A_(t,e),l=wl(u=>(i(d=>{const f=zs(d);f&&o("draggables",f,a)}),n(d=>{const f=zs(d);f&&s("draggables",f,a.id)}),u));return je(l),null},wh=P_("y","constrain-y-axis");function O_(e,t){const r=new ResizeObserver(e);return je(r.disconnect.bind(r)),{observe:i=>r.observe(i,t),unobserve:r.unobserve.bind(r)}}function Ti(e,t,r){const i=new WeakMap,{observe:n,unobserve:o}=O_(s=>{for(const a of s){const{contentRect:l,target:u}=a,d=Math.round(l.width),f=Math.round(l.height),m=i.get(u);(!m||m.width!==d||m.height!==f)&&(t(l,u,a),i.set(u,{width:d,height:f}))}},r);ne(s=>{const a=Mx(zx(Ce(e)));return Lx(a,s,n,o),a},[])}function xh(e){let t=e.startIndex??0;const r=e.startLevel??0,i=[],n=l=>{if(l==null)return"";const u=e.getKey??"key",d=oo(u)?l[u]:u(l);return d!=null?String(d):""},o=l=>{if(l==null)return"";const u=e.getTextValue??"textValue",d=oo(u)?l[u]:u(l);return d!=null?String(d):""},s=l=>{if(l==null)return!1;const u=e.getDisabled??"disabled";return(oo(u)?l[u]:u(l))??!1},a=l=>{if(l!=null)return oo(e.getSectionChildren)?l[e.getSectionChildren]:e.getSectionChildren?.(l)};for(const l of e.dataSource){if(oo(l)||Fx(l)){i.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:s(l),level:r,index:t}),t++;continue}if(a(l)!=null){i.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:r,index:t}),t++;const u=a(l)??[];if(u.length>0){const d=xh({dataSource:u,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:r+1});i.push(...d),t+=d.length}}else i.push({type:"item",rawValue:l,key:n(l),textValue:o(l),disabled:s(l),level:r,index:t}),t++}return i}function E_(e,t=[]){return $(()=>{const r=xh({dataSource:Ce(e.dataSource),getKey:Ce(e.getKey),getTextValue:Ce(e.getTextValue),getDisabled:Ce(e.getDisabled),getSectionChildren:Ce(e.getSectionChildren)});for(let i=0;i<t.length;i++)t[i]();return e.factory(r)})}var nr=class _h extends Set{anchorKey;currentKey;constructor(t,r,i){super(t),t instanceof _h?(this.anchorKey=r||t.anchorKey,this.currentKey=i||t.currentKey):(this.anchorKey=r,this.currentKey=i)}};function M_(e){const[t,r]=ea(e);return[()=>t()??new nr,r]}function $h(e){return Nx()?e.altKey:e.ctrlKey}function xi(e){return Gg()?e.metaKey:e.ctrlKey}function xf(e){return new nr(e)}function Sh(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function z_(e){const t=Ge({selectionMode:"none",selectionBehavior:"toggle"},e),[r,i]=ze(!1),[n,o]=ze(),s=$(()=>{const y=Ce(t.selectedKeys);return y!=null?xf(y):y}),a=$(()=>{const y=Ce(t.defaultSelectedKeys);return y!=null?xf(y):new nr}),[l,u]=M_({value:s,defaultValue:a,onChange:y=>t.onSelectionChange?.(y)}),[d,f]=ze(Ce(t.selectionBehavior)),m=()=>Ce(t.selectionMode),h=()=>Ce(t.disallowEmptySelection)??!1,g=y=>{(Ce(t.allowDuplicateSelectionEvents)||!Sh(y,l()))&&u(y)};return ne(()=>{const y=l();Ce(t.selectionBehavior)==="replace"&&d()==="toggle"&&typeof y=="object"&&y.size===0&&f("replace")}),ne(()=>{f(Ce(t.selectionBehavior)??"toggle")}),{selectionMode:m,disallowEmptySelection:h,selectionBehavior:d,setSelectionBehavior:f,isFocused:r,setFocused:i,focusedKey:n,setFocusedKey:o,selectedKeys:l,setSelectedKeys:g}}function kh(e){const[t,r]=ze(""),[i,n]=ze(-1);return{typeSelectHandlers:{onKeyDown:s=>{if(Ce(e.isDisabled))return;const a=Ce(e.keyboardDelegate),l=Ce(e.selectionManager);if(!a.getKeyForSearch)return;const u=L_(s.key);if(!u||s.ctrlKey||s.metaKey)return;u===" "&&t().trim().length>0&&(s.preventDefault(),s.stopPropagation());let d=r(m=>m+u),f=a.getKeyForSearch(d,l.focusedKey())??a.getKeyForSearch(d);f==null&&F_(d)&&(d=d[0],f=a.getKeyForSearch(d,l.focusedKey())??a.getKeyForSearch(d)),f!=null&&(l.setFocusedKey(f),e.onTypeSelect?.(f)),clearTimeout(i()),n(window.setTimeout(()=>r(""),500))}}}}function L_(e){return e.length===1||!/^[A-Z]/i.test(e)?e:""}function F_(e){return e.split("").every(t=>t===e[0])}function Ch(e,t,r){const n=ie({selectOnFocus:()=>Ce(e.selectionManager).selectionBehavior()==="replace"},e),o=()=>r?.()??t(),{direction:s}=Nr();let a={top:0,left:0};Hg(()=>Ce(n.isVirtualized)?void 0:o(),"scroll",()=>{const b=o();b&&(a={top:b.scrollTop,left:b.scrollLeft})});const{typeSelectHandlers:l}=kh({isDisabled:()=>Ce(n.disallowTypeAhead),keyboardDelegate:()=>Ce(n.keyboardDelegate),selectionManager:()=>Ce(n.selectionManager)}),u=()=>Ce(n.orientation)??"vertical",d=b=>{Qe(b,l.onKeyDown),b.altKey&&b.key==="Tab"&&b.preventDefault();const v=t();if(!v?.contains(b.target))return;const w=Ce(n.selectionManager),x=Ce(n.selectOnFocus),_=z=>{z!=null&&(w.setFocusedKey(z),b.shiftKey&&w.selectionMode()==="multiple"?w.extendSelection(z):x&&!$h(b)&&w.replaceSelection(z))},k=Ce(n.keyboardDelegate),C=Ce(n.shouldFocusWrap),O=w.focusedKey();switch(b.key){case(u()==="vertical"?"ArrowDown":"ArrowRight"):{if(k.getKeyBelow){b.preventDefault();let z;O!=null?z=k.getKeyBelow(O):z=k.getFirstKey?.(),z==null&&C&&(z=k.getFirstKey?.(O)),_(z)}break}case(u()==="vertical"?"ArrowUp":"ArrowLeft"):{if(k.getKeyAbove){b.preventDefault();let z;O!=null?z=k.getKeyAbove(O):z=k.getLastKey?.(),z==null&&C&&(z=k.getLastKey?.(O)),_(z)}break}case(u()==="vertical"?"ArrowLeft":"ArrowUp"):{if(k.getKeyLeftOf){b.preventDefault();const z=s()==="rtl";let K;O!=null?K=k.getKeyLeftOf(O):K=z?k.getFirstKey?.():k.getLastKey?.(),_(K)}break}case(u()==="vertical"?"ArrowRight":"ArrowDown"):{if(k.getKeyRightOf){b.preventDefault();const z=s()==="rtl";let K;O!=null?K=k.getKeyRightOf(O):K=z?k.getLastKey?.():k.getFirstKey?.(),_(K)}break}case"Home":if(k.getFirstKey){b.preventDefault();const z=k.getFirstKey(O,xi(b));z!=null&&(w.setFocusedKey(z),xi(b)&&b.shiftKey&&w.selectionMode()==="multiple"?w.extendSelection(z):x&&w.replaceSelection(z))}break;case"End":if(k.getLastKey){b.preventDefault();const z=k.getLastKey(O,xi(b));z!=null&&(w.setFocusedKey(z),xi(b)&&b.shiftKey&&w.selectionMode()==="multiple"?w.extendSelection(z):x&&w.replaceSelection(z))}break;case"PageDown":if(k.getKeyPageBelow&&O!=null){b.preventDefault();const z=k.getKeyPageBelow(O);_(z)}break;case"PageUp":if(k.getKeyPageAbove&&O!=null){b.preventDefault();const z=k.getKeyPageAbove(O);_(z)}break;case"a":xi(b)&&w.selectionMode()==="multiple"&&Ce(n.disallowSelectAll)!==!0&&(b.preventDefault(),w.selectAll());break;case"Escape":b.defaultPrevented||(b.preventDefault(),Ce(n.disallowEmptySelection)||w.clearSelection());break;case"Tab":if(!Ce(n.allowsTabNavigation)){if(b.shiftKey)v.focus();else{const z=qg(v,{tabbable:!0});let K,J;do J=z.lastChild(),J&&(K=J);while(J);K&&!K.contains(document.activeElement)&&vn(K)}break}}},f=b=>{const v=Ce(n.selectionManager),w=Ce(n.keyboardDelegate),x=Ce(n.selectOnFocus);if(v.isFocused()){b.currentTarget.contains(b.target)||v.setFocused(!1);return}if(b.currentTarget.contains(b.target)){if(v.setFocused(!0),v.focusedKey()==null){const _=C=>{C!=null&&(v.setFocusedKey(C),x&&v.replaceSelection(C))},k=b.relatedTarget;k&&b.currentTarget.compareDocumentPosition(k)&Node.DOCUMENT_POSITION_FOLLOWING?_(v.lastSelectedKey()??w.getLastKey?.()):_(v.firstSelectedKey()??w.getFirstKey?.())}else if(!Ce(n.isVirtualized)){const _=o();if(_){_.scrollTop=a.top,_.scrollLeft=a.left;const k=_.querySelector(`[data-key="${v.focusedKey()}"]`);k&&(vn(k),gf(_,k))}}}},m=b=>{const v=Ce(n.selectionManager);b.currentTarget.contains(b.relatedTarget)||v.setFocused(!1)},h=b=>{o()===b.target&&b.preventDefault()},g=()=>{const b=Ce(n.autoFocus);if(!b)return;const v=Ce(n.selectionManager),w=Ce(n.keyboardDelegate);let x;b==="first"&&(x=w.getFirstKey?.()),b==="last"&&(x=w.getLastKey?.());const _=v.selectedKeys();_.size&&(x=_.values().next().value),v.setFocused(!0),v.setFocusedKey(x);const k=t();k&&x==null&&!Ce(n.shouldUseVirtualFocus)&&vn(k)};return Vt(()=>{n.deferAutoFocus?setTimeout(g,0):g()}),ne(qe([o,()=>Ce(n.isVirtualized),()=>Ce(n.selectionManager).focusedKey()],b=>{const[v,w,x]=b;if(w)x&&n.scrollToKey?.(x);else if(x&&v){const _=v.querySelector(`[data-key="${x}"]`);_&&gf(v,_)}})),{tabIndex:$(()=>{if(!Ce(n.shouldUseVirtualFocus))return Ce(n.selectionManager).focusedKey()==null?0:-1}),onKeyDown:d,onMouseDown:h,onFocusIn:f,onFocusOut:m}}function Vo(e,t){const r=()=>Ce(e.selectionManager),i=()=>Ce(e.key),n=()=>Ce(e.shouldUseVirtualFocus),o=w=>{r().selectionMode()!=="none"&&(r().selectionMode()==="single"?r().isSelected(i())&&!r().disallowEmptySelection()?r().toggleSelection(i()):r().replaceSelection(i()):w?.shiftKey?r().extendSelection(i()):r().selectionBehavior()==="toggle"||xi(w)||"pointerType"in w&&w.pointerType==="touch"?r().toggleSelection(i()):r().replaceSelection(i()))},s=()=>r().isSelected(i()),a=()=>Ce(e.disabled)||r().isDisabled(i()),l=()=>!a()&&r().canSelectItem(i());let u=null;const d=w=>{l()&&(u=w.pointerType,w.pointerType==="mouse"&&w.button===0&&!Ce(e.shouldSelectOnPressUp)&&o(w))},f=w=>{l()&&w.pointerType==="mouse"&&w.button===0&&Ce(e.shouldSelectOnPressUp)&&Ce(e.allowsDifferentPressOrigin)&&o(w)},m=w=>{l()&&(Ce(e.shouldSelectOnPressUp)&&!Ce(e.allowsDifferentPressOrigin)||u!=="mouse")&&o(w)},h=w=>{!l()||!["Enter"," "].includes(w.key)||($h(w)?r().toggleSelection(i()):o(w))},g=w=>{a()&&w.preventDefault()},y=w=>{const x=t();n()||a()||!x||w.target===x&&r().setFocusedKey(i())},b=$(()=>{if(!(n()||a()))return i()===r().focusedKey()?0:-1}),v=$(()=>Ce(e.virtualized)?void 0:i());return ne(qe([t,i,n,()=>r().focusedKey(),()=>r().isFocused()],([w,x,_,k,C])=>{w&&x===k&&C&&!_&&document.activeElement!==w&&(e.focus?e.focus():vn(w))})),{isSelected:s,isDisabled:a,allowsSelection:l,tabIndex:b,dataKey:v,onPointerDown:d,onPointerUp:f,onClick:m,onKeyDown:h,onMouseDown:g,onFocus:y}}var N_=class{collection;state;constructor(e,t){this.collection=e,this.state=t}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}isFocused(){return this.state.isFocused()}setFocused(e){this.state.setFocused(e)}focusedKey(){return this.state.focusedKey()}setFocusedKey(e){(e==null||this.collection().getItem(e))&&this.state.setFocusedKey(e)}selectedKeys(){return this.state.selectedKeys()}isSelected(e){if(this.state.selectionMode()==="none")return!1;const t=this.getKey(e);return t==null?!1:this.state.selectedKeys().has(t)}isEmpty(){return this.state.selectedKeys().size===0}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every(t=>e.has(t))}firstSelectedKey(){let e;for(const t of this.state.selectedKeys()){const r=this.collection().getItem(t),i=r?.index!=null&&e?.index!=null&&r.index<e.index;(!e||i)&&(e=r)}return e?.key}lastSelectedKey(){let e;for(const t of this.state.selectedKeys()){const r=this.collection().getItem(t),i=r?.index!=null&&e?.index!=null&&r.index>e.index;(!e||i)&&(e=r)}return e?.key}extendSelection(e){if(this.selectionMode()==="none")return;if(this.selectionMode()==="single"){this.replaceSelection(e);return}const t=this.getKey(e);if(t==null)return;const r=this.state.selectedKeys(),i=r.anchorKey||t,n=new nr(r,i,t);for(const o of this.getKeyRange(i,r.currentKey||t))n.delete(o);for(const o of this.getKeyRange(t,i))this.canSelectItem(o)&&n.add(o);this.state.setSelectedKeys(n)}getKeyRange(e,t){const r=this.collection().getItem(e),i=this.collection().getItem(t);return r&&i?r.index!=null&&i.index!=null&&r.index<=i.index?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){const r=[];let i=e;for(;i!=null;){const n=this.collection().getItem(i);if(n&&n.type==="item"&&r.push(i),i===t)return r;i=this.collection().getKeyAfter(i)}return[]}getKey(e){const t=this.collection().getItem(e);return t?!t||t.type!=="item"?null:t.key:e}toggleSelection(e){if(this.selectionMode()==="none")return;if(this.selectionMode()==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}const t=this.getKey(e);if(t==null)return;const r=new nr(this.state.selectedKeys());r.has(t)?r.delete(t):this.canSelectItem(t)&&(r.add(t),r.anchorKey=t,r.currentKey=t),!(this.disallowEmptySelection()&&r.size===0)&&this.state.setSelectedKeys(r)}replaceSelection(e){if(this.selectionMode()==="none")return;const t=this.getKey(e);if(t==null)return;const r=this.canSelectItem(t)?new nr([t],t,t):new nr;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode()==="none")return;const t=new nr;for(const r of e){const i=this.getKey(r);if(i!=null&&(t.add(i),this.selectionMode()==="single"))break}this.state.setSelectedKeys(t)}selectAll(){this.selectionMode()==="multiple"&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){const e=this.state.selectedKeys();!this.disallowEmptySelection()&&e.size>0&&this.state.setSelectedKeys(new nr)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,t){this.selectionMode()!=="none"&&(this.selectionMode()==="single"?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior()==="toggle"||t&&t.pointerType==="touch"?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const t=this.selectedKeys();if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;for(const r of t)if(!e.has(r))return!1;return!0}canSelectItem(e){if(this.state.selectionMode()==="none")return!1;const t=this.collection().getItem(e);return t!=null&&!t.disabled}isDisabled(e){const t=this.collection().getItem(e);return!t||t.disabled}getAllSelectableKeys(){const e=[];return(r=>{for(;r!=null;){if(this.canSelectItem(r)){const i=this.collection().getItem(r);if(!i)continue;i.type==="item"&&e.push(r)}r=this.collection().getKeyAfter(r)}})(this.collection().getFirstKey()),e}},_f=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const i of e)this.keyMap.set(i.key,i);if(this.keyMap.size===0)return;let t,r=0;for(const[i,n]of this.keyMap)t?(t.nextKey=i,n.prevKey=t.key):(this.firstKey=i,n.prevKey=void 0),n.type==="item"&&(n.index=r++),t=n,t.nextKey=void 0;this.lastKey=t.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey}getKeyAfter(e){return this.keyMap.get(e)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const t=[...this.getKeys()];return this.getItem(t[e])}};function Bo(e){const t=z_(e),i=E_({dataSource:()=>Ce(e.dataSource),getKey:()=>Ce(e.getKey),getTextValue:()=>Ce(e.getTextValue),getDisabled:()=>Ce(e.getDisabled),getSectionChildren:()=>Ce(e.getSectionChildren),factory:o=>e.filter?new _f(e.filter(o)):new _f(o)},[()=>e.filter]),n=new N_(i,t);return xl(()=>{const o=t.focusedKey();o!=null&&!i().getItem(o)&&t.setFocusedKey(void 0)}),{collection:i,selectionManager:()=>n}}var R_=I("<option>"),j_=I("<div aria-hidden=true><input type=text style=font-size:16px><select tabindex=-1><option>");function U_(e){let t;const[r,i]=$e(e,["ref","onChange","collection","selectionManager","isOpen","isMultiple","isVirtualized","focusTrigger"]),n=Rr(),[o,s]=ze(!1),a=l=>{const u=r.collection.getItem(l);return c(F,{get when(){return u?.type==="item"},get children(){var d=R_();return d.value=l,p(d,()=>u?.textValue),Ae(()=>d.selected=r.selectionManager.isSelected(l)),d}})};return ne(qe(()=>r.selectionManager.selectedKeys(),(l,u)=>{u&&Sh(l,u)||(s(!0),t?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})))},{defer:!0})),(()=>{var l=j_(),u=l.firstChild,d=u.nextSibling;d.firstChild,u.addEventListener("focus",()=>r.focusTrigger()),d.addEventListener("change",m=>{Qe(m,r.onChange),o()||r.selectionManager.setSelectedKeys(new Set([m.target.value])),s(!1)});var f=xt(m=>t=m,r.ref);return typeof f=="function"&&ut(f,d),dn(d,ie({get multiple(){return r.isMultiple},get name(){return n.name()},get required(){return n.isRequired()},get disabled(){return n.isDisabled()},get size(){return r.collection.getSize()},get value(){return r.selectionManager.firstSelectedKey()??""}},i),!1,!0),p(d,c(F,{get when(){return r.isVirtualized},get fallback(){return c(rt,{get each(){return[...r.collection.getKeys()]},children:a})},get children(){return c(rt,{get each(){return[...r.selectionManager.selectedKeys()]},children:a})}}),null),Ae(m=>{var h=cc,g=r.selectionManager.isFocused()||r.isOpen?-1:0,y=n.isRequired(),b=n.isDisabled(),v=n.isReadOnly();return m.e=gr(l,h,m.e),g!==m.t&&Ie(u,"tabindex",m.t=g),y!==m.a&&(u.required=m.a=y),b!==m.o&&(u.disabled=m.o=b),v!==m.i&&(u.readOnly=m.i=v),m},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),l})()}var $f=new WeakMap;function K_(e){let t=$f.get(e);if(t!=null)return t;t=0;for(const r of e)r.type==="item"&&t++;return $f.set(e,t),t}var Ih=class{collection;ref;collator;constructor(e,t,r){this.collection=e,this.ref=t,this.collator=r}getKeyBelow(e){let t=this.collection().getKeyAfter(e);for(;t!=null;){const r=this.collection().getItem(t);if(r&&r.type==="item"&&!r.disabled)return t;t=this.collection().getKeyAfter(t)}}getKeyAbove(e){let t=this.collection().getKeyBefore(e);for(;t!=null;){const r=this.collection().getItem(t);if(r&&r.type==="item"&&!r.disabled)return t;t=this.collection().getKeyBefore(t)}}getFirstKey(){let e=this.collection().getFirstKey();for(;e!=null;){const t=this.collection().getItem(e);if(t&&t.type==="item"&&!t.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;e!=null;){const t=this.collection().getItem(e);if(t&&t.type==="item"&&!t.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const t=this.ref?.();let r=this.getItem(e);if(!t||!r)return;const i=Math.max(0,r.offsetTop+r.offsetHeight-t.offsetHeight);let n=e;for(;n&&r&&r.offsetTop>i;)n=this.getKeyAbove(n),r=n!=null?this.getItem(n):null;return n}getKeyPageBelow(e){const t=this.ref?.();let r=this.getItem(e);if(!t||!r)return;const i=Math.min(t.scrollHeight,r.offsetTop-r.offsetHeight+t.offsetHeight);let n=e;for(;n&&r&&r.offsetTop<i;)n=this.getKeyBelow(n),r=n!=null?this.getItem(n):null;return n}getKeyForSearch(e,t){const r=this.collator?.();if(!r)return;let i=t!=null?this.getKeyBelow(t):this.getFirstKey();for(;i!=null;){const n=this.collection().getItem(i);if(n){const o=n.textValue.slice(0,e.length);if(n.textValue&&r.compare(o,e)===0)return i}i=this.getKeyBelow(i)}}};function Tc(e,t,r){const i=Wg({usage:"search",sensitivity:"base"}),n=$(()=>{const o=Ce(e.keyboardDelegate);return o||new Ih(e.collection,t,i)});return Ch({selectionManager:()=>Ce(e.selectionManager),keyboardDelegate:n,autoFocus:()=>Ce(e.autoFocus),deferAutoFocus:()=>Ce(e.deferAutoFocus),shouldFocusWrap:()=>Ce(e.shouldFocusWrap),disallowEmptySelection:()=>Ce(e.disallowEmptySelection),selectOnFocus:()=>Ce(e.selectOnFocus),disallowTypeAhead:()=>Ce(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Ce(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Ce(e.allowsTabNavigation),isVirtualized:()=>Ce(e.isVirtualized),scrollToKey:o=>Ce(e.scrollToKey)?.(o),orientation:()=>Ce(e.orientation)},t,r)}var V_={};ir(V_,{Item:()=>aa,ItemDescription:()=>la,ItemIndicator:()=>ca,ItemLabel:()=>ua,Listbox:()=>B_,Root:()=>Ac,Section:()=>da,useListboxContext:()=>Dh});var Th=Rt();function Dh(){const e=jt(Th);if(e===void 0)throw new Error("[kobalte]: `useListboxContext` must be used within a `Listbox` component");return e}var Ah=Rt();function Dc(){const e=jt(Ah);if(e===void 0)throw new Error("[kobalte]: `useListboxItemContext` must be used within a `Listbox.Item` component");return e}function aa(e){let t;const r=Dh(),i=`${r.generateId("item")}-${nn()}`,n=Ge({id:i},e),[o,s]=$e(n,["ref","item","aria-label","aria-labelledby","aria-describedby","onPointerMove","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[a,l]=ze(),[u,d]=ze(),f=()=>r.listState().selectionManager(),m=()=>f().focusedKey()===o.item.key,h=Vo({key:()=>o.item.key,selectionManager:f,shouldSelectOnPressUp:r.shouldSelectOnPressUp,allowsDifferentPressOrigin:()=>r.shouldSelectOnPressUp()&&r.shouldFocusOnHover(),shouldUseVirtualFocus:r.shouldUseVirtualFocus,disabled:()=>o.item.disabled},()=>t),g=()=>{if(f().selectionMode()!=="none")return h.isSelected()},y=$(()=>!(Gg()&&Xg())),b=()=>y()?o["aria-label"]:void 0,v=()=>y()?a():void 0,w=()=>y()?u():void 0,x=()=>{if(!r.isVirtualized())return;const z=r.listState().collection().getItem(o.item.key)?.index;return z!=null?z+1:void 0},_=()=>{if(r.isVirtualized())return K_(r.listState().collection())},k=z=>{Qe(z,o.onPointerMove),z.pointerType==="mouse"&&!h.isDisabled()&&r.shouldFocusOnHover()&&(vn(z.currentTarget),f().setFocused(!0),f().setFocusedKey(o.item.key))},C=$(()=>({"data-disabled":h.isDisabled()?"":void 0,"data-selected":h.isSelected()?"":void 0,"data-highlighted":m()?"":void 0})),O={isSelected:h.isSelected,dataset:C,generateId:Nn(()=>s.id),registerLabelId:tn(l),registerDescriptionId:tn(d)};return c(Ah.Provider,{value:O,get children(){return c(it,ie({as:"li",ref(z){var K=xt(J=>t=J,o.ref);typeof K=="function"&&K(z)},role:"option",get tabIndex(){return h.tabIndex()},get"aria-disabled"(){return h.isDisabled()},get"aria-selected"(){return g()},get"aria-label"(){return b()},get"aria-labelledby"(){return v()},get"aria-describedby"(){return w()},get"aria-posinset"(){return x()},get"aria-setsize"(){return _()},get"data-key"(){return h.dataKey()},get onPointerDown(){return et([o.onPointerDown,h.onPointerDown])},get onPointerUp(){return et([o.onPointerUp,h.onPointerUp])},get onClick(){return et([o.onClick,h.onClick])},get onKeyDown(){return et([o.onKeyDown,h.onKeyDown])},get onMouseDown(){return et([o.onMouseDown,h.onMouseDown])},get onFocus(){return et([o.onFocus,h.onFocus])},onPointerMove:k},C,s))}})}function la(e){const t=Dc(),r=Ge({id:t.generateId("description")},e);return ne(()=>je(t.registerDescriptionId(r.id))),c(it,ie({as:"div"},()=>t.dataset(),r))}function ca(e){const t=Dc(),r=Ge({id:t.generateId("indicator")},e),[i,n]=$e(r,["forceMount"]);return c(F,{get when(){return i.forceMount||t.isSelected()},get children(){return c(it,ie({as:"div","aria-hidden":"true"},()=>t.dataset(),n))}})}function ua(e){const t=Dc(),r=Ge({id:t.generateId("label")},e);return ne(()=>je(t.registerLabelId(r.id))),c(it,ie({as:"div"},()=>t.dataset(),r))}function Ac(e){let t;const r=`listbox-${nn()}`,i=Ge({id:r,selectionMode:"single",virtualized:!1},e),[n,o]=$e(i,["ref","children","renderItem","renderSection","value","defaultValue","onChange","options","optionValue","optionTextValue","optionDisabled","optionGroupChildren","state","keyboardDelegate","autoFocus","selectionMode","shouldFocusWrap","shouldUseVirtualFocus","shouldSelectOnPressUp","shouldFocusOnHover","allowDuplicateSelectionEvents","disallowEmptySelection","selectionBehavior","selectOnFocus","disallowTypeAhead","allowsTabNavigation","virtualized","scrollToItem","scrollRef","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),s=$(()=>n.state?n.state:Bo({selectedKeys:()=>n.value,defaultSelectedKeys:()=>n.defaultValue,onSelectionChange:n.onChange,allowDuplicateSelectionEvents:()=>Ce(n.allowDuplicateSelectionEvents),disallowEmptySelection:()=>Ce(n.disallowEmptySelection),selectionBehavior:()=>Ce(n.selectionBehavior),selectionMode:()=>Ce(n.selectionMode),dataSource:()=>n.options??[],getKey:()=>n.optionValue,getTextValue:()=>n.optionTextValue,getDisabled:()=>n.optionDisabled,getSectionChildren:()=>n.optionGroupChildren})),a=Tc({selectionManager:()=>s().selectionManager(),collection:()=>s().collection(),autoFocus:()=>Ce(n.autoFocus),shouldFocusWrap:()=>Ce(n.shouldFocusWrap),keyboardDelegate:()=>n.keyboardDelegate,disallowEmptySelection:()=>Ce(n.disallowEmptySelection),selectOnFocus:()=>Ce(n.selectOnFocus),disallowTypeAhead:()=>Ce(n.disallowTypeAhead),shouldUseVirtualFocus:()=>Ce(n.shouldUseVirtualFocus),allowsTabNavigation:()=>Ce(n.allowsTabNavigation),isVirtualized:()=>n.virtualized,scrollToKey:()=>n.scrollToItem},()=>t,()=>n.scrollRef?.()),l={listState:s,generateId:Nn(()=>o.id),shouldUseVirtualFocus:()=>i.shouldUseVirtualFocus,shouldSelectOnPressUp:()=>i.shouldSelectOnPressUp,shouldFocusOnHover:()=>i.shouldFocusOnHover,isVirtualized:()=>n.virtualized};return c(Th.Provider,{value:l,get children(){return c(it,ie({as:"ul",ref(u){var d=xt(f=>t=f,n.ref);typeof d=="function"&&d(u)},role:"listbox",get tabIndex(){return a.tabIndex()},get"aria-multiselectable"(){return s().selectionManager().selectionMode()==="multiple"?!0:void 0},get onKeyDown(){return et([n.onKeyDown,a.onKeyDown])},get onMouseDown(){return et([n.onMouseDown,a.onMouseDown])},get onFocusIn(){return et([n.onFocusIn,a.onFocusIn])},get onFocusOut(){return et([n.onFocusOut,a.onFocusOut])}},o,{get children(){return c(F,{get when(){return!n.virtualized},get fallback(){return n.children?.(s().collection)},get children(){return c(v_,{get each(){return[...s().collection()]},by:"key",children:u=>c(Gt,{get children(){return[c(Xe,{get when(){return u().type==="section"},get children(){return n.renderSection?.(u())}}),c(Xe,{get when(){return u().type==="item"},get children(){return n.renderItem?.(u())}})]}})})}})}}))}})}function da(e){return c(it,ie({as:"li",role:"presentation"},e))}var B_=Object.assign(Ac,{Item:aa,ItemDescription:la,ItemIndicator:ca,ItemLabel:ua,Section:da}),Z_={};ir(Z_,{Arrow:()=>Fi,Content:()=>Oh,Description:()=>Li,ErrorMessage:()=>zi,HiddenSelect:()=>Eh,Icon:()=>Mh,Item:()=>aa,ItemDescription:()=>la,ItemIndicator:()=>ca,ItemLabel:()=>ua,Label:()=>zh,Listbox:()=>Lh,Portal:()=>Fh,Root:()=>Nh,Section:()=>da,Select:()=>zn,Trigger:()=>Rh,Value:()=>jh,useSelectContext:()=>wr});var Ph=Rt();function wr(){const e=jt(Ph);if(e===void 0)throw new Error("[kobalte]: `useSelectContext` must be used within a `Select` component");return e}function Oh(e){let t;const r=wr(),[i,n]=$e(e,["ref","style","onCloseAutoFocus","onFocusOutside"]),o=a=>{r.close()},s=a=>{i.onFocusOutside?.(a),r.isOpen()&&r.isModal()&&a.preventDefault()};return dc({isDisabled:()=>!(r.isOpen()&&r.isModal()),targets:()=>t?[t]:[]}),fc({element:()=>t??null,enabled:()=>r.contentPresent()&&r.preventScroll()}),mc({trapFocus:()=>r.isOpen()&&r.isModal(),onMountAutoFocus:a=>{a.preventDefault()},onUnmountAutoFocus:a=>{i.onCloseAutoFocus?.(a),a.defaultPrevented||(vn(r.triggerRef()),a.preventDefault())}},()=>t),c(F,{get when(){return r.contentPresent()},get children(){return c(Ni.Positioner,{get children(){return c(gc,ie({ref(a){var l=xt(u=>{r.setContentRef(u),t=u},i.ref);typeof l=="function"&&l(a)},get disableOutsidePointerEvents(){return Te(()=>!!r.isModal())()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},get style(){return vr({"--kb-select-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},i.style)},onEscapeKeyDown:o,onFocusOutside:s,get onDismiss(){return r.close}},()=>r.dataset(),n))}})}})}function Eh(e){const t=wr();return c(U_,ie({get collection(){return t.listState().collection()},get selectionManager(){return t.listState().selectionManager()},get isOpen(){return t.isOpen()},get isMultiple(){return t.isMultiple()},get isVirtualized(){return t.isVirtualized()},focusTrigger:()=>t.triggerRef()?.focus()},e))}function Mh(e){const t=wr(),r=Ge({children:"▼"},e);return c(it,ie({as:"span","aria-hidden":"true"},()=>t.dataset(),r))}function zh(e){const t=wr(),[r,i]=$e(e,["onClick"]);return c(uc,ie({as:"span",onClick:o=>{Qe(o,r.onClick),t.isDisabled()||t.triggerRef()?.focus()}},i))}function Lh(e){const t=wr(),r=Ge({id:t.generateId("listbox")},e),[i,n]=$e(r,["ref","id","onKeyDown"]);return ne(()=>je(t.registerListboxId(i.id))),c(Ac,ie({ref(s){var a=xt(t.setListboxRef,i.ref);typeof a=="function"&&a(s)},get id(){return i.id},get state(){return t.listState()},get virtualized(){return t.isVirtualized()},get autoFocus(){return t.autoFocus()},shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,get shouldFocusWrap(){return t.shouldFocusWrap()},get disallowTypeAhead(){return t.disallowTypeAhead()},get"aria-labelledby"(){return t.listboxAriaLabelledBy()},get renderItem(){return t.renderItem},get renderSection(){return t.renderSection},onKeyDown:s=>{Qe(s,i.onKeyDown),s.key==="Escape"&&s.preventDefault()}},n))}function Fh(e){const t=wr();return c(F,{get when(){return t.contentPresent()},get children(){return c(hr,e)}})}function H_(e){const t=`select-${nn()}`,r=Ge({id:t,selectionMode:"single",disallowEmptySelection:!1,closeOnSelection:e.selectionMode==="single",allowDuplicateSelectionEvents:!0,gutter:8,sameWidth:!0,modal:!1},e),[i,n,o,s]=$e(r,["itemComponent","sectionComponent","open","defaultOpen","onOpenChange","value","defaultValue","onChange","placeholder","options","optionValue","optionTextValue","optionDisabled","optionGroupChildren","keyboardDelegate","allowDuplicateSelectionEvents","disallowEmptySelection","closeOnSelection","disallowTypeAhead","shouldFocusWrap","selectionBehavior","selectionMode","virtualized","modal","preventScroll","forceMount"],["getAnchorRect","placement","gutter","shift","flip","slide","overlap","sameWidth","fitViewport","hideWhenDetached","detachedPadding","arrowPadding","overflowPadding"],hc),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),[h,g]=ze(),[y,b]=ze(),[v,w]=ze(),[x,_]=ze(),[k,C]=ze(!0),O=H=>{const Z=i.optionValue;return Z==null?String(H):String(bc(Z)?Z(H):H[Z])},z=$(()=>{const H=i.optionGroupChildren;return H==null?i.options:i.options.flatMap(Z=>Z[H]??Z)}),K=$(()=>z().map(H=>O(H))),J=H=>[...H].map(Z=>z().find(se=>O(se)===Z)).filter(Z=>Z!=null),T=jo({open:()=>i.open,defaultOpen:()=>i.defaultOpen,onOpenChange:H=>i.onOpenChange?.(H)}),M=Bo({selectedKeys:()=>i.value!=null?i.value.map(O):i.value,defaultSelectedKeys:()=>i.defaultValue!=null?i.defaultValue.map(O):i.defaultValue,onSelectionChange:H=>{i.onChange?.(J(H)),i.closeOnSelection&&R()},allowDuplicateSelectionEvents:()=>Ce(i.allowDuplicateSelectionEvents),disallowEmptySelection:()=>Ce(i.disallowEmptySelection),selectionBehavior:()=>Ce(i.selectionBehavior),selectionMode:()=>i.selectionMode,dataSource:()=>i.options??[],getKey:()=>i.optionValue,getTextValue:()=>i.optionTextValue,getDisabled:()=>i.optionDisabled,getSectionChildren:()=>i.optionGroupChildren}),U=$(()=>J(M.selectionManager().selectedKeys())),A=H=>{M.selectionManager().toggleSelection(O(H))},{present:j}=li({show:()=>i.forceMount||T.isOpen(),element:()=>y()??null}),P=()=>{const H=v();H&&vn(H)},B=H=>{if(i.options.length<=0)return;C(H),T.open();let Z=M.selectionManager().firstSelectedKey();Z==null&&(H==="first"?Z=M.collection().getFirstKey():H==="last"&&(Z=M.collection().getLastKey())),P(),M.selectionManager().setFocused(!0),M.selectionManager().setFocusedKey(Z)},R=()=>{T.close(),M.selectionManager().setFocused(!1),M.selectionManager().setFocusedKey(void 0)},V=H=>{T.isOpen()?R():B(H)},{formControlContext:Q}=pc(o);ta(h,()=>{const H=i.defaultValue?[...i.defaultValue].map(O):new nr;M.selectionManager().setSelectedKeys(H)});const ee=Wg({usage:"search",sensitivity:"base"}),oe=$(()=>{const H=Ce(i.keyboardDelegate);return H||new Ih(M.collection,void 0,ee)}),le=H=>i.itemComponent?.({item:H}),W=H=>i.sectionComponent?.({section:H});ne(qe([K],([H])=>{const se=[...M.selectionManager().selectedKeys()].filter(re=>H.includes(re));M.selectionManager().setSelectedKeys(se)},{defer:!0}));const D=$(()=>({"data-expanded":T.isOpen()?"":void 0,"data-closed":T.isOpen()?void 0:""})),te={dataset:D,isOpen:T.isOpen,isDisabled:()=>Q.isDisabled()??!1,isMultiple:()=>Ce(i.selectionMode)==="multiple",isVirtualized:()=>i.virtualized??!1,isModal:()=>i.modal??!1,preventScroll:()=>i.preventScroll??te.isModal(),disallowTypeAhead:()=>i.disallowTypeAhead??!1,shouldFocusWrap:()=>i.shouldFocusWrap??!1,selectedOptions:U,contentPresent:j,autoFocus:k,triggerRef:h,listState:()=>M,keyboardDelegate:oe,triggerId:a,valueId:u,listboxId:f,listboxAriaLabelledBy:x,setListboxAriaLabelledBy:_,setTriggerRef:g,setContentRef:b,setListboxRef:w,open:B,close:R,toggle:V,placeholder:()=>i.placeholder,renderItem:le,renderSection:W,removeOptionFromSelection:A,generateId:Nn(()=>Ce(o.id)),registerTriggerId:tn(l),registerValueId:tn(d),registerListboxId:tn(m)};return c(vc.Provider,{value:Q,get children(){return c(Ph.Provider,{value:te,get children(){return c(Ni,ie({anchorRef:h,contentRef:y},n,{get children(){return c(it,ie({as:"div",role:"group",get id(){return Ce(o.id)}},()=>Q.dataset(),D,s))}}))}})}})}function Nh(e){const[t,r]=$e(e,["value","defaultValue","onChange","multiple"]),i=$(()=>t.value!=null?t.multiple?t.value:[t.value]:t.value),n=$(()=>t.defaultValue!=null?t.multiple?t.defaultValue:[t.defaultValue]:t.defaultValue);return c(H_,ie({get value(){return i()},get defaultValue(){return n()},onChange:s=>{t.multiple?t.onChange?.(s??[]):t.onChange?.(s[0]??null)},get selectionMode(){return t.multiple?"multiple":"single"}},r))}function Rh(e){const t=Rr(),r=wr(),i=Ge({id:r.generateId("trigger")},e),[n,o,s]=$e(i,["ref","disabled","onPointerDown","onClick","onKeyDown","onFocus","onBlur"],Yg),a=()=>r.listState().selectionManager(),l=()=>r.keyboardDelegate(),u=()=>n.disabled||r.isDisabled(),{fieldProps:d}=Jg(o),{typeSelectHandlers:f}=kh({keyboardDelegate:l,selectionManager:a,onTypeSelect:w=>a().select(w)}),m=()=>[r.listboxAriaLabelledBy(),r.valueId()].filter(Boolean).join(" ")||void 0,h=w=>{Qe(w,n.onPointerDown),w.currentTarget.dataset.pointerType=w.pointerType,!u()&&w.pointerType!=="touch"&&w.button===0&&(w.preventDefault(),r.toggle(!0))},g=w=>{Qe(w,n.onClick),!u()&&w.currentTarget.dataset.pointerType==="touch"&&r.toggle(!0)},y=w=>{if(Qe(w,n.onKeyDown),!u())switch(Qe(w,f.onKeyDown),w.key){case"Enter":case" ":case"ArrowDown":w.stopPropagation(),w.preventDefault(),r.toggle("first");break;case"ArrowUp":w.stopPropagation(),w.preventDefault(),r.toggle("last");break;case"ArrowLeft":{if(w.preventDefault(),r.isMultiple())return;const x=a().firstSelectedKey(),_=x!=null?l().getKeyAbove?.(x):l().getFirstKey?.();_!=null&&a().select(_);break}case"ArrowRight":{if(w.preventDefault(),r.isMultiple())return;const x=a().firstSelectedKey(),_=x!=null?l().getKeyBelow?.(x):l().getFirstKey?.();_!=null&&a().select(_);break}}},b=w=>{Qe(w,n.onFocus),!a().isFocused()&&a().setFocused(!0)},v=w=>{Qe(w,n.onBlur),!r.isOpen()&&a().setFocused(!1)};return ne(()=>je(r.registerTriggerId(d.id()))),ne(()=>{r.setListboxAriaLabelledBy([d.ariaLabelledBy(),d.ariaLabel()&&!d.ariaLabelledBy()?d.id():null].filter(Boolean).join(" ")||void 0)}),c(Ro,ie({ref(w){var x=xt(r.setTriggerRef,n.ref);typeof x=="function"&&x(w)},get id(){return d.id()},get disabled(){return u()},"aria-haspopup":"listbox",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return Te(()=>!!r.isOpen())()?r.listboxId():void 0},get"aria-label"(){return d.ariaLabel()},get"aria-labelledby"(){return m()},get"aria-describedby"(){return d.ariaDescribedBy()},onPointerDown:h,onClick:g,onKeyDown:y,onFocus:b,onBlur:v},()=>r.dataset(),()=>t.dataset(),s))}function jh(e){const t=Rr(),r=wr(),i=Ge({id:r.generateId("value")},e),[n,o]=$e(i,["id","children"]),s=()=>r.listState().selectionManager(),a=()=>{const l=s().selectedKeys();return l.size===1&&l.has("")?!0:s().isEmpty()};return ne(()=>je(r.registerValueId(n.id))),c(it,ie({as:"span",get id(){return n.id},get"data-placeholder-shown"(){return a()?"":void 0}},()=>t.dataset(),o,{get children(){return c(F,{get when(){return!a()},get fallback(){return r.placeholder()},get children(){return c(q_,{state:{selectedOption:()=>r.selectedOptions()[0],selectedOptions:()=>r.selectedOptions(),remove:l=>r.removeOptionFromSelection(l),clear:()=>s().clearSelection()},get children(){return n.children}})}})}}))}function q_(e){const t=Qg(()=>{const r=e.children;return bc(r)?r(e.state):r});return Te(t)}var zn=Object.assign(Nh,{Arrow:Fi,Content:Oh,Description:Li,ErrorMessage:zi,HiddenSelect:Eh,Icon:Mh,Item:aa,ItemDescription:la,ItemIndicator:ca,ItemLabel:ua,Label:zh,Listbox:Lh,Portal:Fh,Section:da,Trigger:Rh,Value:jh});function G_(e,t,r){let i=n=>e(n,...t);return r===void 0?i:Object.assign(i,{lazy:r,lazyArgs:t})}function fa(e,t,r){let i=e.length-t.length;if(i===0)return e(...t);if(i===1)return G_(e,t,r);throw new Error("Wrong number of arguments")}var W_={done:!1,hasNext:!1};function kl(e,...t){let r=e,i=t.map(o=>"lazy"in o?X_(o):void 0),n=0;for(;n<t.length;){if(i[n]===void 0||!Y_(r)){let l=t[n];r=l(r),n+=1;continue}let o=[];for(let l=n;l<t.length;l++){let u=i[l];if(u===void 0||(o.push(u),u.isSingle))break}let s=[];for(let l of r)if(Uh(l,s,o))break;let{isSingle:a}=o.at(-1);r=a?s[0]:s,n+=o.length}return r}function Uh(e,t,r){if(r.length===0)return t.push(e),!1;let i=e,n=W_,o=!1;for(let[s,a]of r.entries()){let{index:l,items:u}=a;if(u.push(i),n=a(i,l,u),a.index+=1,n.hasNext){if(n.hasMany??!1){for(let d of n.next)if(Uh(d,t,r.slice(s+1)))return!0;return o}i=n.next}if(!n.hasNext)break;n.done&&(o=!0)}return n.hasNext&&t.push(i),o}function X_(e){let{lazy:t,lazyArgs:r}=e,i=t(...r);return Object.assign(i,{isSingle:t.single??!1,index:0,items:[]})}function Y_(e){return typeof e=="string"||typeof e=="object"&&e!==null&&Symbol.iterator in e}function Kh(...e){return fa(J_,e,Q_)}var J_=(e,t)=>e.map(t),Q_=e=>(t,r,i)=>({done:!1,hasNext:!0,next:e(t,r,i)});function Vh(...e){return fa(e$,e)}var e$=(e,t)=>{let r=Object.create(null);for(let i=0;i<e.length;i++){let n=e[i],o=t(n,i,e);if(o!==void 0){let s=r[o];s===void 0?r[o]=[n]:s.push(n)}}return Object.setPrototypeOf(r,Object.prototype),r};function t$(...e){return fa(n$,e,r$)}var n$=(e,t)=>e.flatMap(t),r$=e=>(t,r,i)=>{let n=e(t,r,i);return Array.isArray(n)?{done:!1,hasNext:!0,hasMany:!0,next:n}:{done:!1,hasNext:!0,next:n}};function Bh(...e){return fa(Object.entries,e)}function Zh(e){const[t,r]=$e(e,["class","classList","placeholder","options","current","value","label","groupBy","valueClass","onSelect","onHighlight","onOpenChange","children","triggerStyle","triggerVariant","triggerProps"]),i={key:void 0,cleanup:void 0},n=()=>{i.cleanup?.(),i.cleanup=void 0,i.key=void 0},o=l=>t.value?t.value(l):l,s=l=>{if(!t.onHighlight)return;if(!l){n();return}const u=o(l);i.key!==u&&(i.cleanup?.(),i.cleanup=t.onHighlight(l),i.key=u)};je(n);const a=$(()=>kl(t.options,Vh(u=>t.groupBy?t.groupBy(u):""),Bh(),Kh(([u,d])=>({category:u,options:d}))));return c(zn,ie(r,{"data-component":"select",get"data-trigger-style"(){return t.triggerVariant},get placement(){return t.triggerVariant==="settings"?"bottom-end":"bottom-start"},gutter:4,get value(){return t.current},get options(){return a()},optionValue:l=>t.value?t.value(l):l,optionTextValue:l=>t.label?t.label(l):l,optionGroupChildren:"options",get placeholder(){return t.placeholder},sectionComponent:l=>c(zn.Section,{"data-slot":"select-section",get children(){return l.section.rawValue.category}}),itemComponent:l=>c(zn.Item,ie(l,{"data-slot":"select-select-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},onPointerEnter:()=>s(l.item.rawValue),onPointerMove:()=>s(l.item.rawValue),onFocus:()=>s(l.item.rawValue),get children(){return[c(zn.ItemLabel,{"data-slot":"select-select-item-label",get children(){return Te(()=>!!t.children)()?t.children(l.item.rawValue):Te(()=>!!t.label)()?t.label(l.item.rawValue):l.item.rawValue}}),c(zn.ItemIndicator,{"data-slot":"select-select-item-indicator",get children(){return c(bt,{name:"check-small",size:"small"})}})]}})),onChange:l=>{t.onSelect?.(l??void 0),n()},onOpenChange:l=>{t.onOpenChange?.(l),l||n()},get children(){return[c(zn.Trigger,ie(()=>t.triggerProps,{get disabled(){return e.disabled},"data-slot":"select-select-trigger",as:vt,get size(){return e.size},get variant(){return e.variant},get style(){return t.triggerStyle},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return[c(zn.Value,{"data-slot":"select-select-trigger-value",get class(){return t.valueClass},children:l=>{const u=l.selectedOption()??t.current;return u?t.label?t.label(u):u:t.placeholder||""}}),c(zn.Icon,{"data-slot":"select-select-trigger-icon",get children(){return c(bt,{get name(){return t.triggerVariant==="settings"?"selector":"chevron-down"},size:"small"})}})]}})),c(zn.Portal,{get children(){return c(zn.Content,{get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},"data-component":"select-content",get"data-trigger-style"(){return t.triggerVariant},get children(){return c(zn.Listbox,{"data-slot":"select-select-content-list"})}})}})]}}))}var i$=class{collection;direction;orientation;constructor(e,t,r){this.collection=e,this.direction=t,this.orientation=r}flipDirection(){return this.direction()==="rtl"&&this.orientation()==="horizontal"}getKeyLeftOf(e){if(this.flipDirection())return this.getNextKey(e);if(this.orientation()==="horizontal")return this.getPreviousKey(e)}getKeyRightOf(e){if(this.flipDirection())return this.getPreviousKey(e);if(this.orientation()==="horizontal")return this.getNextKey(e)}getKeyAbove(e){if(this.orientation()==="vertical")return this.getPreviousKey(e)}getKeyBelow(e){if(this.orientation()==="vertical")return this.getNextKey(e)}getFirstKey(){let e=this.collection().getFirstKey();return e==null?void 0:(this.collection().getItem(e)?.disabled&&(e=this.getNextKey(e)),e)}getLastKey(){let e=this.collection().getLastKey();return e==null?void 0:(this.collection().getItem(e)?.disabled&&(e=this.getPreviousKey(e)),e)}getNextKey(e){let t=e,r;do if(t=this.collection().getKeyAfter(t)??this.collection().getFirstKey(),t==null||(r=this.collection().getItem(t),r==null))return;while(r.disabled);return t}getPreviousKey(e){let t=e,r;do if(t=this.collection().getKeyBefore(t)??this.collection().getLastKey(),t==null||(r=this.collection().getItem(t),r==null))return;while(r.disabled);return t}},Hh=Rt();function qh(){return jt(Hh)}function o$(){const e=qh();if(e===void 0)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}function Gh(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function s$(e,t){const r=t.ref();if(!r)return-1;let i=e.length;if(!i)return-1;for(;i--;){const n=e[i]?.ref();if(n&&Gh(n,r))return i+1}return 0}function a$(e){const t=e.map((i,n)=>[n,i]);let r=!1;return t.sort(([i,n],[o,s])=>{const a=n.ref(),l=s.ref();return a===l||!a||!l?0:Gh(a,l)?(i>o&&(r=!0),-1):(i<o&&(r=!0),1)}),r?t.map(([i,n])=>n):e}function Wh(e,t){const r=a$(e);e!==r&&t(r)}function l$(e){const t=e[0],r=e[e.length-1]?.ref();let i=t?.ref()?.parentElement;for(;i;){if(r&&i.contains(r))return i;i=i.parentElement}return jx(i).body}function c$(e,t){ne(()=>{const r=setTimeout(()=>{Wh(e(),t)});je(()=>clearTimeout(r))})}function u$(e,t){if(typeof IntersectionObserver!="function"){c$(e,t);return}let r=[];ne(()=>{const i=()=>{const s=!!r.length;r=e(),s&&Wh(e(),t)},n=l$(e()),o=new IntersectionObserver(i,{root:n});for(const s of e()){const a=s.ref();a&&o.observe(a)}je(()=>o.disconnect())})}function Pc(e={}){const[t,r]=Rx({value:()=>Ce(e.items),onChange:o=>e.onItemsChange?.(o)});u$(t,r);const i=o=>(r(s=>{const a=s$(s,o);return Ux(s,o,a)}),()=>{r(s=>{const a=s.filter(l=>l.ref()!==o.ref());return s.length===a.length?s:a})});return{DomCollectionProvider:o=>c(Hh.Provider,{value:{registerItem:i},get children(){return o.children}})}}function Oc(e){const t=o$(),r=Ge({shouldRegisterItem:!0},e);ne(()=>{if(!r.shouldRegisterItem)return;const i=t.registerItem(r.getItem());je(i)})}var d$={};ir(d$,{Content:()=>Yh,Indicator:()=>Jh,List:()=>Qh,Root:()=>ep,Tabs:()=>Ho,Trigger:()=>tp,useTabsContext:()=>Zo});var Xh=Rt();function Zo(){const e=jt(Xh);if(e===void 0)throw new Error("[kobalte]: `useTabsContext` must be used within a `Tabs` component");return e}function Yh(e){const[t,r]=ze(),i=Zo(),[n,o]=$e(e,["ref","id","value","forceMount"]),[s,a]=ze(0),l=()=>n.id??i.generateContentId(n.value),u=()=>i.listState().selectedKey()===n.value,{present:d}=li({show:()=>n.forceMount||u(),element:()=>t()??null});return ne(qe([()=>t(),()=>d()],([f,m])=>{if(f==null||!m)return;const h=()=>{const y=qg(f,{tabbable:!0});a(y.nextNode()?void 0:0)};h();const g=new MutationObserver(h);g.observe(f,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabindex","disabled"]}),je(()=>{g.disconnect()})})),ne(qe([()=>n.value,l],([f,m])=>{i.contentIdsMap().set(f,m)})),c(F,{get when(){return d()},get children(){return c(it,ie({as:"div",ref(f){var m=xt(r,n.ref);typeof m=="function"&&m(f)},get id(){return l()},role:"tabpanel",get tabIndex(){return s()},get"aria-labelledby"(){return i.triggerIdsMap().get(n.value)},get"data-orientation"(){return i.orientation()},get"data-selected"(){return u()?"":void 0}},o))}})}function Jh(e){const t=Zo(),[r,i]=$e(e,["style"]),[n,o]=ze({width:void 0,height:void 0}),{direction:s}=Nr(),a=()=>{const m=t.selectedTab();if(m==null)return;const h={transform:void 0,width:void 0,height:void 0},g=s()==="rtl"?-1*(m.offsetParent?.offsetWidth-m.offsetWidth-m.offsetLeft):m.offsetLeft;h.transform=t.orientation()==="vertical"?`translateY(${m.offsetTop}px)`:`translateX(${g}px)`,t.orientation()==="horizontal"?h.width=`${m.offsetWidth}px`:h.height=`${m.offsetHeight}px`,o(h)};Vt(()=>{queueMicrotask(()=>{a()})}),ne(qe([t.selectedTab,t.orientation,s],()=>{a()},{defer:!0}));const[l,u]=ze(!1);let d=null,f=null;return Uo(t.selectedTab,(m,h)=>{if(f!==h){f=h;return}u(!0),d&&clearTimeout(d),d=setTimeout(()=>{d=null,u(!1)},1),a()}),c(it,ie({as:"div",role:"presentation",get style(){return vr(n(),r.style)},get"data-orientation"(){return t.orientation()},get"data-resizing"(){return l()}},i))}function Qh(e){let t;const r=Zo(),[i,n]=$e(e,["ref","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),{direction:o}=Nr(),s=new i$(()=>r.listState().collection(),o,r.orientation),a=Ch({selectionManager:()=>r.listState().selectionManager(),keyboardDelegate:()=>s,selectOnFocus:()=>r.activationMode()==="automatic",shouldFocusWrap:!1,disallowEmptySelection:!0},()=>t);return ne(()=>{if(t==null)return;const l=t.querySelector(`[data-key="${r.listState().selectedKey()}"]`);l!=null&&r.setSelectedTab(l)}),c(it,ie({as:"div",ref(l){var u=xt(d=>t=d,i.ref);typeof u=="function"&&u(l)},role:"tablist",get"aria-orientation"(){return r.orientation()},get"data-orientation"(){return r.orientation()},get onKeyDown(){return et([i.onKeyDown,a.onKeyDown])},get onMouseDown(){return et([i.onMouseDown,a.onMouseDown])},get onFocusIn(){return et([i.onFocusIn,a.onFocusIn])},get onFocusOut(){return et([i.onFocusOut,a.onFocusOut])}},n))}function f$(e){const[t,r]=ea({value:()=>Ce(e.selectedKey),defaultValue:()=>Ce(e.defaultSelectedKey),onChange:u=>e.onSelectionChange?.(u)}),i=$(()=>{const u=t();return u!=null?[u]:[]}),[,n]=$e(e,["onSelectionChange"]),o=ie(n,{selectionMode:"single",disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:i,onSelectionChange:u=>{const d=u.values().next().value;d===t()&&e.onSelectionChange?.(d),r(d)}}),{collection:s,selectionManager:a}=Bo(o),l=$(()=>{const u=t();return u!=null?s().getItem(u):void 0});return{collection:s,selectionManager:a,selectedKey:t,setSelectedKey:r,selectedItem:l}}function ep(e){const t=`tabs-${nn()}`,r=Ge({id:t,orientation:"horizontal",activationMode:"automatic"},e),[i,n]=$e(r,["value","defaultValue","onChange","orientation","activationMode","disabled"]),[o,s]=ze([]),[a,l]=ze(),{DomCollectionProvider:u}=Pc({items:o,onItemsChange:s}),d=f$({selectedKey:()=>i.value,defaultSelectedKey:()=>i.defaultValue,onSelectionChange:y=>i.onChange?.(String(y)),dataSource:o});let f=d.selectedKey();ne(qe([()=>d.selectionManager(),()=>d.collection(),()=>d.selectedKey()],([y,b,v])=>{let w=v;if(y.isEmpty()||w==null||!b.getItem(w)){w=b.getFirstKey();let x=w!=null?b.getItem(w):void 0;for(;x?.disabled&&x.key!==b.getLastKey();)w=b.getKeyAfter(x.key),x=w!=null?b.getItem(w):void 0;x?.disabled&&w===b.getLastKey()&&(w=b.getFirstKey()),w!=null&&y.setSelectedKeys([w])}(y.focusedKey()==null||!y.isFocused()&&w!==f)&&y.setFocusedKey(w),f=w}));const m=new Map,h=new Map,g={isDisabled:()=>i.disabled??!1,orientation:()=>i.orientation,activationMode:()=>i.activationMode,triggerIdsMap:()=>m,contentIdsMap:()=>h,listState:()=>d,selectedTab:a,setSelectedTab:l,generateTriggerId:y=>`${n.id}-trigger-${y}`,generateContentId:y=>`${n.id}-content-${y}`};return c(u,{get children(){return c(Xh.Provider,{value:g,get children(){return c(it,ie({as:"div",get"data-orientation"(){return g.orientation()}},n))}})}})}function tp(e){let t;const r=Zo(),i=Ge({type:"button"},e),[n,o]=$e(i,["ref","id","value","disabled","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),s=()=>n.id??r.generateTriggerId(n.value),a=()=>r.listState().selectionManager().focusedKey()===n.value,l=()=>n.disabled||r.isDisabled(),u=()=>r.contentIdsMap().get(n.value);Oc({getItem:()=>({ref:()=>t,type:"item",key:n.value,textValue:"",disabled:l()})});const d=Vo({key:()=>n.value,selectionManager:()=>r.listState().selectionManager(),disabled:l},()=>t),f=m=>{Xg()&&vn(m.currentTarget)};return ne(qe([()=>n.value,s],([m,h])=>{r.triggerIdsMap().set(m,h)})),c(it,ie({as:"button",ref(m){var h=xt(g=>t=g,n.ref);typeof h=="function"&&h(m)},get id(){return s()},role:"tab",get tabIndex(){return Te(()=>!l())()?d.tabIndex():void 0},get disabled(){return l()},get"aria-selected"(){return d.isSelected()},get"aria-disabled"(){return l()||void 0},get"aria-controls"(){return Te(()=>!!d.isSelected())()?u():void 0},get"data-key"(){return d.dataKey()},get"data-orientation"(){return r.orientation()},get"data-selected"(){return d.isSelected()?"":void 0},get"data-highlighted"(){return a()?"":void 0},get"data-disabled"(){return l()?"":void 0},get onPointerDown(){return et([n.onPointerDown,d.onPointerDown])},get onPointerUp(){return et([n.onPointerUp,d.onPointerUp])},get onClick(){return et([n.onClick,d.onClick,f])},get onKeyDown(){return et([n.onKeyDown,d.onKeyDown])},get onMouseDown(){return et([n.onMouseDown,d.onMouseDown])},get onFocus(){return et([n.onFocus,d.onFocus])}},o))}var Ho=Object.assign(ep,{Content:Yh,Indicator:Jh,List:Qh,Trigger:tp}),m$=I("<div data-slot=tabs-trigger-wrapper>"),g$=I("<div data-slot=tabs-trigger-close-button>"),h$=I("<div data-slot=tabs-section-title>");function p$(e){const[t,r]=$e(e,["class","classList","variant","orientation"]);return c(Ho,ie(r,{get orientation(){return t.orientation},"data-component":"tabs",get"data-variant"(){return t.variant||"normal"},get"data-orientation"(){return t.orientation||"horizontal"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function v$(e){const[t,r]=$e(e,["class","classList"]);return c(Ho.List,ie(r,{"data-slot":"tabs-list",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function b$(e){const[t,r]=$e(e,["class","classList","classes","children","closeButton","hideCloseButton","onMiddleClick"]);return(()=>{var i=m$();return i.addEventListener("auxclick",n=>{n.button===1&&t.onMiddleClick&&(n.preventDefault(),t.onMiddleClick())}),i.$$mousedown=n=>{n.button===1&&t.onMiddleClick&&n.preventDefault()},p(i,c(Ho.Trigger,ie(r,{"data-slot":"tabs-trigger",get"data-value"(){return e.value},get classList(){return{[t.classes?.button??""]:t.classes?.button}},get children(){return t.children}})),null),p(i,c(F,{get when(){return t.closeButton},children:n=>(()=>{var o=g$();return p(o,n),Ae(()=>Ie(o,"data-hidden",t.hideCloseButton)),o})()}),null),Ae(n=>{var o=e.value,s={...t.classList??{},[t.class??""]:!!t.class};return o!==n.e&&Ie(i,"data-value",n.e=o),n.t=Ct(i,s,n.t),n},{e:void 0,t:void 0}),i})()}function y$(e){const[t,r]=$e(e,["class","classList","children"]);return c(Ho.Content,ie(r,{"data-slot":"tabs-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}const w$=e=>(()=>{var t=h$();return p(t,()=>e.children),t})(),Lt=Object.assign(p$,{List:v$,Trigger:b$,Content:y$,SectionTitle:w$});Ot(["mousedown"]);var Ts={exports:{}},x$=Ts.exports,Sf;function _$(){return Sf||(Sf=1,(function(e){((t,r)=>{e.exports?e.exports=r():t.fuzzysort=r()})(x$,t=>{var r=(W,D)=>{if(!W||!D)return Q;var te=g(W);P(D)||(D=h(D));var H=te.bitflags;return(H&D._bitflags)!==H?Q:b(te,D)},i=(W,D,te)=>{if(!W)return te?.all?y(D,te):V;var H=g(W),Z=H.bitflags,se=H.containsSpace,re=f(te?.threshold||0),fe=te?.limit||B,Se=0,Ne=0,ce=D.length;function ye(Pe){Se<fe?(le.add(Pe),++Se):(++Ne,Pe._score>le.peek()._score&&le.replaceTop(Pe))}if(te?.key)for(var G=te.key,we=0;we<ce;++we){var ke=D[we],ue=j(ke,G);if(ue&&(P(ue)||(ue=h(ue)),(Z&ue._bitflags)===Z)){var me=b(H,ue);me!==Q&&(me._score<re||(me.obj=ke,ye(me)))}}else if(te?.keys){var Ue=te.keys,be=Ue.length;e:for(var we=0;we<ce;++we){var ke=D[we];{for(var Be=0,E=0;E<be;++E){var G=Ue[E],ue=j(ke,G);if(!ue){U[E]=ee;continue}P(ue)||(ue=h(ue)),U[E]=ue,Be|=ue._bitflags}if((Z&Be)!==Z)continue}if(se)for(let pe=0;pe<H.spaceSearches.length;pe++)T[pe]=R;for(var E=0;E<be;++E){if(ue=U[E],ue===ee){A[E]=ee;continue}if(A[E]=b(H,ue,!1,se),A[E]===Q){A[E]=ee;continue}if(se)for(let De=0;De<H.spaceSearches.length;De++){if(M[De]>-1e3&&T[De]>R){var ae=(T[De]+M[De])/4;ae>T[De]&&(T[De]=ae)}M[De]>T[De]&&(T[De]=M[De])}}if(se){for(let pe=0;pe<H.spaceSearches.length;pe++)if(T[pe]===R)continue e}else{var de=!1;for(let pe=0;pe<be;pe++)if(A[pe]._score!==R){de=!0;break}if(!de)continue}var Ee=new l(be);for(let pe=0;pe<be;pe++)Ee[pe]=A[pe];if(se){var Re=0;for(let pe=0;pe<H.spaceSearches.length;pe++)Re+=T[pe]}else{var Re=R;for(let De=0;De<be;De++){var me=Ee[De];if(me._score>-1e3&&Re>R){var ae=(Re+me._score)/4;ae>Re&&(Re=ae)}me._score>Re&&(Re=me._score)}}if(Ee.obj=ke,Ee._score=Re,te?.scoreFn){if(Re=te.scoreFn(Ee),!Re)continue;Re=f(Re),Ee._score=Re}Re<re||ye(Ee)}}else for(var we=0;we<ce;++we){var ue=D[we];if(ue&&(P(ue)||(ue=h(ue)),(Z&ue._bitflags)===Z)){var me=b(H,ue);me!==Q&&(me._score<re||ye(me))}}if(Se===0)return V;for(var ot=new Array(Se),we=Se-1;we>=0;--we)ot[we]=le.poll();return ot.total=Se+Ne,ot},n=(W,D="<b>",te="</b>")=>{for(var H=typeof D=="function"?D:void 0,Z=W.target,se=Z.length,re=W.indexes,fe="",Se=0,Ne=0,ce=!1,ye=[],G=0;G<se;++G){var we=Z[G];if(re[Ne]===G){if(++Ne,ce||(ce=!0,H?(ye.push(fe),fe=""):fe+=D),Ne===re.length){H?(fe+=we,ye.push(H(fe,Se++)),fe="",ye.push(Z.substr(G+1))):fe+=we+te+Z.substr(G+1);break}}else ce&&(ce=!1,H?(ye.push(H(fe,Se++)),fe=""):fe+=te);fe+=we}return H?ye:fe},o=W=>{typeof W=="number"?W=""+W:typeof W!="string"&&(W="");var D=x(W);return u(W,{_targetLower:D._lower,_targetLowerCodes:D.lowerCodes,_bitflags:D.bitflags})},s=()=>{C.clear(),O.clear()};class a{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((D,te)=>D-te)}set indexes(D){return this._indexes=D}highlight(D,te){return n(this,D,te)}get score(){return d(this._score)}set score(D){this._score=f(D)}}class l extends Array{get score(){return d(this._score)}set score(D){this._score=f(D)}}var u=(W,D)=>{const te=new a;return te.target=W,te.obj=D.obj??Q,te._score=D._score??R,te._indexes=D._indexes??[],te._targetLower=D._targetLower??"",te._targetLowerCodes=D._targetLowerCodes??Q,te._nextBeginningIndexes=D._nextBeginningIndexes??Q,te._bitflags=D._bitflags??0,te},d=W=>W===R?0:W>1?W:Math.E**(((-W+1)**.04307-1)*-2),f=W=>W===0?R:W>1?W:1-Math.pow(Math.log(W)/-2+1,1/.04307),m=W=>{typeof W=="number"?W=""+W:typeof W!="string"&&(W=""),W=W.trim();var D=x(W),te=[];if(D.containsSpace){var H=W.split(/\s+/);H=[...new Set(H)];for(var Z=0;Z<H.length;Z++)if(H[Z]!==""){var se=x(H[Z]);te.push({lowerCodes:se.lowerCodes,_lower:H[Z].toLowerCase(),containsSpace:!1})}}return{lowerCodes:D.lowerCodes,_lower:D._lower,containsSpace:D.containsSpace,bitflags:D.bitflags,spaceSearches:te}},h=W=>{if(W.length>999)return o(W);var D=C.get(W);return D!==void 0||(D=o(W),C.set(W,D)),D},g=W=>{if(W.length>999)return m(W);var D=O.get(W);return D!==void 0||(D=m(W),O.set(W,D)),D},y=(W,D)=>{var te=[];te.total=W.length;var H=D?.limit||B;if(D?.key)for(var Z=0;Z<W.length;Z++){var se=W[Z],re=j(se,D.key);if(re!=Q){P(re)||(re=h(re));var fe=u(re.target,{_score:re._score,obj:se});if(te.push(fe),te.length>=H)return te}}else if(D?.keys)for(var Z=0;Z<W.length;Z++){for(var se=W[Z],Se=new l(D.keys.length),Ne=D.keys.length-1;Ne>=0;--Ne){var re=j(se,D.keys[Ne]);if(!re){Se[Ne]=ee;continue}P(re)||(re=h(re)),re._score=R,re._indexes.len=0,Se[Ne]=re}if(Se.obj=se,Se._score=R,te.push(Se),te.length>=H)return te}else for(var Z=0;Z<W.length;Z++){var re=W[Z];if(re!=Q&&(P(re)||(re=h(re)),re._score=R,re._indexes.len=0,te.push(re),te.length>=H))return te}return te},b=(W,D,te=!1,H=!1)=>{if(te===!1&&W.containsSpace)return v(W,D,H);for(var Z=W._lower,se=W.lowerCodes,re=se[0],fe=D._targetLowerCodes,Se=se.length,Ne=fe.length,we=0,ce=0,ye=0;;){var G=re===fe[ce];if(G){if(z[ye++]=ce,++we,we===Se)break;re=se[we]}if(++ce,ce>=Ne)return Q}var we=0,ke=!1,ue=0,me=D._nextBeginningIndexes;me===Q&&(me=D._nextBeginningIndexes=k(D.target)),ce=z[0]===0?0:me[z[0]-1];var Ue=0;if(ce!==Ne)for(;;)if(ce>=Ne){if(we<=0||(++Ue,Ue>200))break;--we;var be=K[--ue];ce=me[be]}else{var G=se[we]===fe[ce];if(G){if(K[ue++]=ce,++we,we===Se){ke=!0;break}++ce}else ce=me[ce]}var Be=Se<=1?-1:D._targetLower.indexOf(Z,z[0]),E=!!~Be,ae=E?Be===0||D._nextBeginningIndexes[Be-1]===Be:!1;if(E&&!ae){for(var de=0;de<me.length;de=me[de])if(!(de<=Be)){for(var Ee=0;Ee<Se&&se[Ee]===D._targetLowerCodes[de+Ee];Ee++);if(Ee===Se){Be=de,ae=!0;break}}}var Re=pe=>{for(var De=0,st=0,Je=1;Je<Se;++Je)pe[Je]-pe[Je-1]!==1&&(De-=pe[Je],++st);var Ve=pe[Se-1]-pe[0]-(Se-1);if(De-=(12+Ve)*st,pe[0]!==0&&(De-=pe[0]*pe[0]*.2),!ke)De*=1e3;else{for(var ht=1,Je=me[0];Je<Ne;Je=me[Je])++ht;ht>24&&(De*=(ht-24)*10)}return De-=(Ne-Se)/2,E&&(De/=1+Se*Se*1),ae&&(De/=1+Se*Se*1),De-=(Ne-Se)/2,De};if(ke)if(ae){for(var de=0;de<Se;++de)z[de]=Be+de;var ot=z,Pe=Re(z)}else var ot=K,Pe=Re(K);else{if(E)for(var de=0;de<Se;++de)z[de]=Be+de;var ot=z,Pe=Re(ot)}D._score=Pe;for(var de=0;de<Se;++de)D._indexes[de]=ot[de];D._indexes.len=Se;const Oe=new a;return Oe.target=D.target,Oe._score=D._score,Oe._indexes=D._indexes,Oe},v=(W,D,te)=>{for(var H=new Set,Z=0,se=Q,re=0,fe=W.spaceSearches,Se=fe.length,Ne=0,ce=()=>{for(let ae=Ne-1;ae>=0;ae--)D._nextBeginningIndexes[J[ae*2+0]]=J[ae*2+1]},ye=!1,E=0;E<Se;++E){M[E]=R;var G=fe[E];if(se=b(G,D),te){if(se===Q)continue;ye=!0}else if(se===Q)return ce(),Q;var we=E===Se-1;if(!we){var ke=se._indexes,ue=!0;for(let de=0;de<ke.len-1;de++)if(ke[de+1]-ke[de]!==1){ue=!1;break}if(ue){var me=ke[ke.len-1]+1,Ue=D._nextBeginningIndexes[me-1];for(let de=me-1;de>=0&&Ue===D._nextBeginningIndexes[de];de--)D._nextBeginningIndexes[de]=me,J[Ne*2+0]=de,J[Ne*2+1]=Ue,Ne++}}Z+=se._score/Se,M[E]=se._score/Se,se._indexes[0]<re&&(Z-=(re-se._indexes[0])*2),re=se._indexes[0];for(var be=0;be<se._indexes.len;++be)H.add(se._indexes[be])}if(te&&!ye)return Q;ce();var Be=b(W,D,!0);if(Be!==Q&&Be._score>Z){if(te)for(var E=0;E<Se;++E)M[E]=Be._score/Se;return Be}te&&(se=D),se._score=Z;var E=0;for(let ae of H)se._indexes[E++]=ae;return se._indexes.len=E,se},w=W=>W.replace(/\p{Script=Latin}+/gu,D=>D.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),x=W=>{W=w(W);for(var D=W.length,te=W.toLowerCase(),H=[],Z=0,se=!1,re=0;re<D;++re){var fe=H[re]=te.charCodeAt(re);if(fe===32){se=!0;continue}var Se=fe>=97&&fe<=122?fe-97:fe>=48&&fe<=57?26:fe<=127?30:31;Z|=1<<Se}return{lowerCodes:H,bitflags:Z,containsSpace:se,_lower:te}},_=W=>{for(var D=W.length,te=[],H=0,Z=!1,se=!1,re=0;re<D;++re){var fe=W.charCodeAt(re),Se=fe>=65&&fe<=90,Ne=Se||fe>=97&&fe<=122||fe>=48&&fe<=57,ce=Se&&!Z||!se||!Ne;Z=Se,se=Ne,ce&&(te[H++]=re)}return te},k=W=>{W=w(W);for(var D=W.length,te=_(W),H=[],Z=te[0],se=0,re=0;re<D;++re)Z>re?H[re]=Z:(Z=te[++se],H[re]=Z===void 0?D:Z);return H},C=new Map,O=new Map,z=[],K=[],J=[],T=[],M=[],U=[],A=[],j=(W,D)=>{var te=W[D];if(te!==void 0)return te;if(typeof D=="function")return D(W);var H=D;Array.isArray(D)||(H=D.split("."));for(var Z=H.length,se=-1;W&&++se<Z;)W=W[H[se]];return W},P=W=>typeof W=="object"&&typeof W._bitflags=="number",B=1/0,R=-B,V=[];V.total=0;var Q=null,ee=o(""),oe=W=>{var D=[],te=0,H={},Z=se=>{for(var re=0,fe=D[re],Se=1;Se<te;){var Ne=Se+1;re=Se,Ne<te&&D[Ne]._score<D[Se]._score&&(re=Ne),D[re-1>>1]=D[re],Se=1+(re<<1)}for(var ce=re-1>>1;re>0&&fe._score<D[ce]._score;ce=(re=ce)-1>>1)D[re]=D[ce];D[re]=fe};return H.add=(se=>{var re=te;D[te++]=se;for(var fe=re-1>>1;re>0&&se._score<D[fe]._score;fe=(re=fe)-1>>1)D[re]=D[fe];D[re]=se}),H.poll=(se=>{if(te!==0){var re=D[0];return D[0]=D[--te],Z(),re}}),H.peek=(se=>{if(te!==0)return D[0]}),H.replaceTop=(se=>{D[0]=se,Z()}),H},le=oe();return{single:r,go:i,prepare:o,cleanup:s}})})(Ts)),Ts.exports}var $$=_$();const kf=Kx($$);function S$(e){const[t,r]=ze(e.initialValue),i=()=>e.value?.()!==void 0,n=()=>i()?e.value?.():t();return[n,s=>kt(()=>{let a;return typeof s=="function"?a=s(n()):a=s,Object.is(a,n())||(i()||r(a),e.onChange?.(a)),a})]}var k$=S$,C$=e=>{const t=ie({initialActive:null,orientation:"vertical",loop:!0,textDirection:"ltr",handleTab:!0,vimMode:!1,vimKeys:{up:"k",down:"j",right:"l",left:"h"}},e),[r,i]=k$({initialValue:t.initialActive,onChange:t.onActiveChange}),n=()=>{const a=Mn(t.vimKeys);let l,u;return Mn(t.orientation)==="vertical"?(l="arrowdown",u=a.down):Mn(t.textDirection)==="ltr"?(l="arrowright",u=a.right):(l="arrowleft",u=a.left),Mn(t.vimMode)?[l,u]:[l]},o=()=>{const a=Mn(t.vimKeys);let l,u;return Mn(t.orientation)==="vertical"?(l="arrowup",u=a.up):Mn(t.textDirection)==="ltr"?(l="arrowleft",u=a.left):(l="arrowright",u=a.right),Mn(t.vimMode)?[l,u]:[l]};return{active:r,setActive:i,onKeyDown:a=>{const l=a.key.toLowerCase(),u=Mn(t.items);if(u.length===0)return;const d=u.length,f=r(),m=f!==null?u.indexOf(f):null;n().includes(l)?(a.preventDefault(),m===d-1?Mn(t.loop)&&i(()=>u[0]):i(()=>u[m!==null?m+1:0])):o().includes(l)?(a.preventDefault(),m===0?Mn(t.loop)&&i(()=>u[d-1]):i(()=>u[m!==null?m-1:d-1])):l==="home"?(a.preventDefault(),i(()=>u[0])):l==="end"?(a.preventDefault(),i(()=>u[d-1])):Mn(t.handleTab)&&m!==null&&(l==="tab"&&!a.shiftKey&&m<d-1&&(a.preventDefault(),i(()=>u[m+1])),l==="tab"&&a.shiftKey&&m>0&&(a.preventDefault(),i(()=>u[m-1])))}}},I$=C$;function Ls(e){const[t,r]=We({filter:""}),i=[],[n,{refetch:o}]=eh(()=>({filter:t.filter,items:typeof e.items=="function"?e.items(t.filter):e.items}),async({filter:m,items:h})=>{const y=(m??"").toLowerCase(),b=await Promise.resolve(h)||[];return kl(b,w=>y?!e.filterKeys&&Array.isArray(w)&&w.every(x=>typeof x=="string")?kf.go(y,w).map(x=>x.target):kf.go(y,w,{keys:e.filterKeys}).map(x=>x.obj):w,Vh(w=>e.groupBy?e.groupBy(w):""),Bh(),Kh(([w,x])=>({category:w,items:e.sortBy?x.sort(e.sortBy):x})),w=>e.sortGroupsBy?w.sort(e.sortGroupsBy):w)},{initialValue:i}),s=$(()=>kl(n.latest||[],t$(m=>m.items)));function a(){if(e.noInitialSelection)return"";if(e.current)return e.key(e.current);const m=s();return m.length===0?"":e.key(m[0])}const l=I$({items:()=>s().map(e.key),initialActive:a(),loop:!0}),u=()=>{if(e.noInitialSelection){l.setActive("");return}const m=s();m.length!==0&&l.setActive(e.key(m[0]))},d=m=>{if(m.key==="Enter"&&!m.isComposing){m.preventDefault();const h=s().findIndex(y=>e.key(y)===l.active()),g=s()[h];g&&e.onSelect?.(g,h)}else if(m.ctrlKey&&!m.metaKey&&!m.altKey&&!m.shiftKey){if(m.key==="n"||m.key==="p"){m.preventDefault();const h=new KeyboardEvent("keydown",{key:m.key==="n"?"ArrowDown":"ArrowUp",bubbles:!0});l.onKeyDown(h)}}else{if(m.altKey||m.metaKey)return;l.onKeyDown(m)}};return ne(qe(n,()=>{u()})),{grouped:n,filter:()=>t.filter,flat:s,reset:u,refetch:o,clear:()=>r("filter",""),onKeyDown:d,onInput:m=>{r("filter",m)},active:l.active,setActive:l.setActive}}function np(e){let t=!1,r,i,n;const o=()=>e.bottomThreshold??10,[s,a]=We({contentRef:void 0,scrollRef:void 0,userScrolled:!1}),l=()=>e.working()||t,u=_=>_.scrollHeight-_.clientHeight-_.scrollTop,d=_=>_.scrollHeight-_.clientHeight>1,f=_=>{n={top:Math.max(0,_.scrollHeight-_.clientHeight),time:Date.now()},i&&clearTimeout(i),i=setTimeout(()=>{n=void 0,i=void 0},1500)},m=_=>{const k=n;return k?Date.now()-k.time>1500?(n=void 0,!1):Math.abs(_.scrollTop-k.top)<2:!1},h=_=>{const k=s.scrollRef;k&&(f(k),k.scrollTop=k.scrollHeight)},g=_=>{if(!_&&!l())return;_&&s.userScrolled&&a("userScrolled",!1);const k=s.scrollRef;if(!k||!_&&s.userScrolled)return;if(u(k)<2){f(k);return}h()},y=()=>{const _=s.scrollRef;if(_){if(!d(_)){s.userScrolled&&a("userScrolled",!1);return}s.userScrolled||(a("userScrolled",!0),e.onUserInteracted?.())}},b=_=>{if(_.deltaY>=0)return;const k=s.scrollRef,O=(_.target instanceof Element?_.target:void 0)?.closest("[data-scrollable]");k&&O&&O!==k||y()},v=()=>{const _=s.scrollRef;if(_){if(!d(_)){s.userScrolled&&a("userScrolled",!1);return}if(u(_)<o()){s.userScrolled&&a("userScrolled",!1);return}if(!s.userScrolled&&m(_)){g(!1);return}y()}},w=()=>{if(!l())return;const _=window.getSelection();_&&_.toString().length>0&&y()},x=_=>{const k=e.overflowAnchor??"dynamic";if(k==="none"){_.style.overflowAnchor="none";return}if(k==="auto"){_.style.overflowAnchor="auto";return}_.style.overflowAnchor=s.userScrolled?"auto":"none"};return Uo(()=>s.contentRef,()=>{const _=s.scrollRef;if(_&&!d(_)){s.userScrolled&&a("userScrolled",!1);return}l()&&(s.userScrolled||g(!1))}),ne(qe(e.working,_=>{if(t=!1,r&&clearTimeout(r),r=void 0,_){s.userScrolled||g(!0);return}t=!0,r=setTimeout(()=>{t=!1},300)})),ne(()=>{s.userScrolled;const _=s.scrollRef;_&&x(_)}),Hg(()=>s.scrollRef,"wheel",b,{passive:!0}),je(()=>{r&&clearTimeout(r),i&&clearTimeout(i)}),{scrollRef:_=>a("scrollRef",_),contentRef:_=>a("contentRef",_),handleScroll:v,handleInteraction:w,pause:y,resume:()=>{s.userScrolled&&a("userScrolled",!1),g(!0)},scrollToBottom:()=>g(!1),forceScrollToBottom:()=>g(!0),userScrolled:()=>s.userScrolled}}const T$="/assets/android-studio-t3zZ7G0e.svg",D$="/assets/antigravity-m-mWKI7R.svg",A$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5436_78947)'%3e%3cmask%20id='mask0_5436_78947'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='4'%20y='4'%20width='32'%20height='32'%3e%3cpath%20d='M4%204H36V36H4V4Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_5436_78947)'%3e%3cpath%20d='M28.375%204H11.625C7.41383%204%204%207.41383%204%2011.625V28.375C4%2032.5862%207.41383%2036%2011.625%2036H28.375C32.5862%2036%2036%2032.5862%2036%2028.375V11.625C36%207.41383%2032.5862%204%2028.375%204Z'%20fill='black'/%3e%3c/g%3e%3cpath%20d='M29.6214%2014.2072L20.9502%209.12249C20.6718%208.95917%2020.3282%208.95917%2020.0498%209.12249L11.3786%2014.2072C11.1445%2014.3445%2011%2014.5984%2011%2014.8733V25.1267C11%2025.4012%2011.1445%2025.6555%2011.3786%2025.7928L20.0498%2030.8775C20.3282%2031.0408%2020.6718%2031.0408%2020.9502%2030.8775L29.6214%2025.7928C29.8555%2025.6555%2030%2025.4016%2030%2025.1267V14.8733C30%2014.5988%2029.8555%2014.3445%2029.6214%2014.2072ZM29.0767%2015.2843L20.706%2030.0101C20.6494%2030.1093%2020.5%2030.0688%2020.5%2029.9538V20.3115C20.5%2020.1189%2020.3986%2019.9407%2020.2342%2019.8439L12.0124%2015.0226C11.9147%2014.9651%2011.9546%2014.8134%2012.0678%2014.8134H28.8093C29.047%2014.8134%2029.1956%2015.0751%2029.0767%2015.2843Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5436_78947'%3e%3crect%20width='32'%20height='32'%20fill='white'%20transform='translate(4%204)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",P$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M16.2414%208.05369L14.955%206.65636C14.7646%206.44946%2014.5333%206.2843%2014.2757%206.17133C14.0182%206.05836%2013.7401%206.00002%2013.4588%206H4.86684C4.753%205.99995%204.64025%206.02234%204.53506%206.06589C4.42987%206.10944%204.33429%206.17329%204.25379%206.25379C4.17329%206.33429%204.10944%206.42987%204.06589%206.53506C4.02234%206.64025%203.99995%206.753%204%206.86684V12.8779L4.04302%2012.8825C4.10268%2012.6706%204.22985%2012.4839%204.40523%2012.3508C4.5806%2012.2177%204.7946%2012.1455%205.01476%2012.1451H13.189C14.3506%2012.1451%2015.4795%2011.6366%2016.1675%2010.7004C16.5166%2010.2255%2016.9726%209.83942%2017.4985%209.57327C18.0244%209.30713%2018.6056%209.16842%2019.195%209.16836H34.9852C35.2544%209.16836%2035.5125%209.27527%2035.7028%209.46557C35.8931%209.65587%2036%209.91398%2036%2010.1831V8.99058C36%208.77152%2035.913%208.56144%2035.7581%208.40654C35.6032%208.25164%2035.3931%208.16462%2035.174%208.16462H16.4953C16.4476%208.16469%2016.4004%208.15486%2016.3567%208.13577C16.313%208.11667%2016.2738%208.08873%2016.2414%208.05369Z'%20fill='url(%23paint0_linear_5437_79060)'/%3e%3cpath%20d='M16.2002%2010.3751C15.8497%2010.8375%2015.397%2011.2125%2014.8774%2011.4707C14.3579%2011.7289%2013.7855%2011.8634%2013.2053%2011.8634H5.01476C4.88147%2011.8634%204.74948%2011.8897%204.62634%2011.9407C4.5032%2011.9917%204.39132%2012.0665%204.29709%2012.1608C4.20286%2012.255%204.12812%2012.3669%204.07714%2012.4901C4.02617%2012.6133%203.99995%2012.7453%204%2012.8785V32.4302C4%2032.6993%204.10691%2032.9574%204.29722%2033.1477C4.48752%2033.338%204.74563%2033.4449%205.01476%2033.4449H34.9852C35.2544%2033.4449%2035.5125%2033.338%2035.7028%2033.1477C35.8931%2032.9574%2036%2032.6993%2036%2032.4302V9.90147C36%209.63234%2035.8931%209.37424%2035.7028%209.18393C35.5125%208.99363%2035.2544%208.88672%2034.9852%208.88672H19.195C18.6148%208.88679%2018.0425%209.0212%2017.5229%209.27942C17.0033%209.53764%2016.5506%209.91265%2016.2002%2010.3751Z'%20fill='url(%23paint1_linear_5437_79060)'/%3e%3cpath%20d='M27.7632%2023.2969H12.2368C11.7852%2023.2968%2011.3379%2023.3857%2010.9207%2023.5585C10.5034%2023.7312%2010.1242%2023.9846%209.80488%2024.3039C9.48553%2024.6233%209.23222%2025.0024%209.05943%2025.4197C8.88664%2025.8369%208.79776%2026.2842%208.79785%2026.7358V33.4448H31.2025V26.7358C31.2021%2024.8364%2029.6626%2023.2969%2027.7632%2023.2969Z'%20fill='url(%23paint2_linear_5437_79060)'/%3e%3cpath%20d='M26.5965%2029.7865H13.404C13.2154%2029.7865%2013.0345%2029.7116%2012.9012%2029.5782C12.7678%2029.4448%2012.6929%2029.264%2012.6929%2029.0754C12.6929%2028.8868%2012.7678%2028.7059%2012.9012%2028.5725C13.0345%2028.4392%2013.2154%2028.3643%2013.404%2028.3643H26.5965C26.7851%2028.3643%2026.966%2028.4392%2027.0993%2028.5725C27.2327%2028.7059%2027.3076%2028.8868%2027.3076%2029.0754C27.3076%2029.264%2027.2327%2029.4448%2027.0993%2029.5782C26.966%2029.7116%2026.7851%2029.7865%2026.5965%2029.7865Z'%20fill='%2310498A'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5437_79060'%20x1='19.7682'%20y1='9.59964'%20x2='19.2608'%20y2='6.75804'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23CE9918'/%3e%3cstop%20offset='0.5902'%20stop-color='%23DF9E00'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_5437_79060'%20x1='26.3559'%20y1='28.492'%20x2='13.062'%20y2='13.1687'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F5B509'/%3e%3cstop%20offset='1'%20stop-color='%23FECE49'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_5437_79060'%20x1='27.4873'%20y1='32.5737'%20x2='7.9015'%20y2='23.2375'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230161B2'/%3e%3cstop%20offset='1'%20stop-color='%231291DD'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",O$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAB8pJREFUeAHtWG+MXFUV/9375s3szNDturKbLpt0aZo2fvAfpEBEss2iMZJaFTBdG1BrUfGLmohWaGvaQtYYU2miJsRKTQikkhDRIKmRNcEPJGgw1hJFcetu2mJcKrPbmZ2dP++9e6/n3PtmdnbelJnlC3zobc++mXvPu+d3z/87wJVxZby9Q3RZl0T65Pnzu2f94S/Pl70tQYhBpWG0Mn3odRgSJBFIAeOnxKWBPvWvTVj66Vc2DT0ZYzB4CwDlaWN2H5tRT1QvKONJCCHxlodpE6Y1EAxI3PtefOvjvn+Mp7AGgN7vjPnxT6Yr916VScmuem4FQkjq0uDGDR5ky3ukdAQK+O+ywflFjZyU8D3iDZXaMd73m3t8eSc6gOwkWp4xZvLA76uPr0t7nunA+GZz7xkROLTFR7fx4lKEQy8qDGUFqnWjvnSr/8AOz3uYllQ3gNhztm5qF7DmUagCz92W7pm/SHTnbwMCCVTyEtefmvIOHz68SosJr3rif6VPFF/VUBHWTCP9K3uzSRukWoi/N7S9nujALRLVmoB/SZsNu/Z8sR1PAuDZcuqbkqdZloJ7tpLqME/fdSRw+xbP7uFYBJRxpFsoYqL1KH51+7oUqhFx0/+z9Wv2tONJtU/Ml/wt2tA5I6xpXKoaTAz5Tfws/XK5Q5tYM9IB2DggsFACLpb01q4Aq1U9yMcza4hcHumUxnohUINLITwum9xoQQsHkgEMU6AUFiiiA5FvZ02YWIXwKRGjlXRMlAnxnz8+Q2/J5lyD5yObPQTEEpnY6i1rGQIzPf0CKLm7d4ybZ142VIr2s3JCk+0KMAwofZGNROTIajN++jkfp394F/lbABO6OeapVoA7CKD1K3qXXMqC0DHNzL2G3ZN7kPbiAzNA48DyYaR2SFUkEkpPmJjB8CaN+tP6VAyKtVeNXUC6+eXQYCwrUWJgVqpsiVXmFfBkhtYMQgZD34U1iIFHnwwHE81LBXQHSIzaBogTIOJUyScN6xr5a7fByCyZI4LwlNXGB0eBMjGE1oR0APonmilWYGTDED40fgOW6ORUNB04uykBN6wU7cgT3QFacJHbwmB1DQ2LEW7+7h8QVuvkB9JqKiDeyQ9QcJCA0PolQWOhTQ0a1E0Kj508wRUDkjNRbEnJlpVw5og8KE93B8inUrqhM4FEQQsiO6dj9IsVhfcPZVCiZMuHcyLk6hCmz7VYNvuoIBPztlq6Q7HV6HxIqx40yJLJWel9GZ80lmRisCKWyERzo1QOaqGwuLU7mTvaZXOM24q38eiDlM4HWSuqQz+TAKj4FI082J4Mm53bil9+6sMpStLaaU6sYGdTv0kmdLLYETgwKN9oCkDZiw8aZSz10mJxa1WhzOxT38RyuL2q1Fwi1BxszVOtesv+lfEKR7LlZ7kdqleHNGOcqnusJCef13jqhSpVEthy9ctvZ7FAVSEigGaVLzfAiSZsjjMmEyd0T/cYJDbLrsqClxsCGQ5FJSk508ECY7UacLpRaAZScg9jgUlyIRE4SwirwaRWEpWETcN+YcgXm0/tobJ4jlY9ilQZr4kEnyagmqQFFJL1yFigAbf2MaVzXHPnqYum1EPmrNt17bohKwfdAXJisqdvIZlJ429Ht2Hmmf2QaQZpEjyWCBi3VGEoQXkcETl+RFqh8ol3DXo4vO97+OrkXvh90s5HBDQIXWtn9+wJoDFRowFt1OBwsYobpsoonHkKfz12o/UCqJQriy18SklbsuramZk1RIUDIZZx984vYHZmBo89dwpvFAKnZeJnHvY/awnTg4k9Qa1C3E02uhUuXEGpim3fmUN20078+WAOs6e+jqBeRCqdIQdKkeac6e2mFM45akRLxUX8aGoKd39sByZ23IGpR45jocANmW81HFKWDimH1mvamlcaU2vHkwgSX+pFpZCDbqshnP2XA2y85QGMjR/Av6fvx5mHt6Ivm0V+9Cb0Db+PTLceU4ckzs1dwOw/XyaNGtz6yc/hZ88+j6ViBTUS73lpq102g+QAo2oy/4azRMY3y10BXp3HzLlIjwqZjD3bbAgOhghj2x+C99GjqJfnUXrtNOoL/0C5UEb/wGaM3zaOz3/tQfTlcqgu17BcipDyszZ5s0VcN21s3hxcB/x9VqHPF7hmUM51BTiWff3Rl6Lh7Z4n4qLW6GpW/rpPJCysUdAMYHBsAmbjBApFhbv25vHKTGhTR40qDGvM3kc4hZg479j2i4KHoFaqkU1TIa3dfO2lx0+04Ul4pSFP3Xp/qPuNWkmrLXk2MdcyXywDvzji4y+vknY413Vwes2as5cnjevokvXZQ3W8m35hkOslXtqfSbyQCBLqNMQ3PuPtq1Yibt5sZTHkzCY0ca/eNhfFpZGeA1mNI8cDjA1zbyhsjgu0aRJXF67vV1ODMUIXpcmDNQz104WrFOnj92GqIx50HnL/tH766V+Xd2bT3pp+kWHHqFNWnrg+hXym0VkLeyOuU6WZLwi8PKesi/TRHX+ppvXRg/lnPz0qb0ePP300QZ54Jbzv+z/XP8hz9yzQc31ujE5VjrewdxIlTGbIE4/uSx25Lus9iDX+eNS6bh761cV7zpzL7y0UsbkWiKvIn7N8dV4LYOqkBdmiksua+tiInLlp08Un+1//0yO7du1qXqWvjCvjnTj+D8SthzamBKAPAAAAAElFTkSuQmCC",E$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5437_79067)'%3e%3cpath%20d='M27.395%2036C26.1435%2035.9986%2024.9203%2035.6274%2023.879%2034.933C22.8374%2035.6273%2021.6139%2035.9985%2020.362%2036C19.113%2036%2017.882%2035.625%2016.846%2034.933C15.8189%2035.6241%2014.61%2035.9954%2013.372%2036H13.334C12.4944%2036.0006%2011.6633%2035.8321%2010.8902%2035.5047C10.1171%2035.1772%209.41781%2034.6975%208.83405%2034.094C7.65642%2032.8996%206.99679%2031.2893%206.99805%2029.612V17.362C7.00005%209.995%2012.994%204%2020.362%204C27.731%204%2033.725%209.994%2033.725%2017.363V29.616C33.725%2033.009%2031.099%2035.808%2027.747%2035.991C27.63%2035.998%2027.513%2036%2027.395%2036Z'%20fill='%233551F3'/%3e%3cpath%20d='M27.395%2034.5932C26.2752%2034.5924%2025.1889%2034.2104%2024.315%2033.5102C24.1961%2033.4145%2024.0476%2033.3632%2023.895%2033.3652C23.7174%2033.367%2023.5457%2033.4291%2023.408%2033.5412C22.5392%2034.2237%2021.4668%2034.5951%2020.362%2034.5962C19.2576%2034.5949%2018.1855%2034.2234%2017.317%2033.5412C17.1835%2033.4338%2017.0174%2033.3752%2016.846%2033.3752C16.6747%2033.3752%2016.5085%2033.4338%2016.375%2033.5412C15.518%2034.2199%2014.4581%2034.5914%2013.365%2034.5962H13.332C12.6806%2034.5961%2012.0359%2034.4649%2011.4362%2034.2102C10.8366%2033.9556%2010.2945%2033.5829%209.84201%2033.1142C8.92225%2032.1822%208.40639%2030.9256%208.40601%2029.6162V17.3672C8.40601%2010.7702%2013.77%205.40723%2020.363%205.40723C26.955%205.40723%2032.319%2010.7702%2032.319%2017.3632V29.6162C32.319%2032.2612%2030.277%2034.4432%2027.669%2034.5862C27.5777%2034.5909%2027.4864%2034.5932%2027.395%2034.5932Z'%20fill='black'/%3e%3cpath%20d='M30.912%2017.3635V29.6165C30.912%2031.4925%2029.465%2033.0795%2027.592%2033.1825C26.725%2033.2323%2025.8704%2032.9582%2025.194%2032.4135C24.416%2031.7875%2023.321%2031.8155%2022.536%2032.4345C21.9163%2032.9237%2021.1495%2033.1891%2020.36%2033.1875C19.5714%2033.1889%2018.8056%2032.9235%2018.187%2032.4345C17.8057%2032.1306%2017.3326%2031.9651%2016.845%2031.9651C16.3574%2031.9651%2015.8843%2032.1306%2015.503%2032.4345C14.8904%2032.9183%2014.1336%2033.1834%2013.353%2033.1875C11.405%2033.2015%209.81299%2031.5605%209.81299%2029.6125V17.3625C9.81299%2011.5375%2014.537%206.81348%2020.363%206.81348C26.188%206.81348%2030.912%2011.5375%2030.912%2017.3635Z'%20fill='white'/%3e%3cpath%20d='M18.28%2016.4366L14.35%2014.1666C14.104%2014.0248%2013.8117%2013.9865%2013.5374%2014.06C13.2632%2014.1335%2013.0292%2014.3128%2012.887%2014.5586C12.7452%2014.8045%2012.7067%2015.0966%2012.78%2015.3709C12.8533%2015.6452%2013.0324%2015.8792%2013.278%2016.0216L15.604%2017.3646L13.278%2018.7076C13.045%2018.8559%2012.8783%2019.0886%2012.8126%2019.3569C12.7469%2019.6252%2012.7873%2019.9085%2012.9255%2020.1478C13.0636%2020.387%2013.2887%2020.5637%2013.554%2020.641C13.8192%2020.7183%2014.104%2020.6902%2014.349%2020.5626L18.281%2018.2926C18.4436%2018.1985%2018.5786%2018.0633%2018.6724%2017.9006C18.7662%2017.7379%2018.8156%2017.5534%2018.8156%2017.3656C18.8156%2017.1777%2018.7662%2016.9932%2018.6724%2016.8305C18.5786%2016.6678%2018.4436%2016.5326%2018.281%2016.4386V16.4366H18.28ZM27.182%2016.2906H22.018C21.7338%2016.2906%2021.4613%2016.4034%2021.2604%2016.6044C21.0594%2016.8053%2020.9465%2017.0779%2020.9465%2017.3621C20.9465%2017.6462%2021.0594%2017.9188%2021.2604%2018.1197C21.4613%2018.3207%2021.7338%2018.4336%2022.018%2018.4336H27.182C27.4662%2018.4336%2027.7387%2018.3207%2027.9397%2018.1197C28.1406%2017.9188%2028.2535%2017.6462%2028.2535%2017.3621C28.2535%2017.0779%2028.1406%2016.8053%2027.9397%2016.6044C27.7387%2016.4034%2027.4662%2016.2906%2027.182%2016.2906Z'%20fill='black'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5437_79067'%3e%3crect%20width='27'%20height='32'%20fill='white'%20transform='translate(7%204)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",M$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='4'%20y='4'%20width='32'%20height='32'%20rx='6.4'%20fill='url(%23paint0_linear_5437_79079)'/%3e%3crect%20x='4.80005'%20y='4.7998'%20width='30.4'%20height='30.4'%20rx='5.6'%20fill='black'/%3e%3crect%20x='7.19995'%20y='7.2002'%20width='25.6'%20height='25.6'%20rx='3.2'%20fill='%23202A2F'/%3e%3cpath%20d='M25.2454%208.85742H19.2454V20.8574H25.2454V8.85742Z'%20fill='%230EE827'%20fill-opacity='0.35'/%3e%3cpath%20d='M11.7895%2018.9218C11.4758%2018.8949%2011.1817%2018.85%2010.9072%2018.7872C10.6424%2018.7154%2010.3973%2018.6392%2010.1718%2018.5584C9.95613%2018.4776%209.76496%2018.4014%209.59829%2018.3296C9.44145%2018.2488%209.32378%2018.186%209.24536%2018.1412L9.87771%2016.9567C9.94631%2017.0016%2010.064%2017.0644%2010.2306%2017.1452C10.3973%2017.2259%2010.5836%2017.3111%2010.7895%2017.4009C11.0052%2017.4816%2011.2257%2017.5534%2011.4513%2017.6162C11.6768%2017.679%2011.8875%2017.7105%2012.0836%2017.7105C13.064%2017.7105%2013.5542%2017.3381%2013.5542%2016.5933C13.5542%2016.4138%2013.5199%2016.2658%2013.4512%2016.1492C13.3925%2016.0325%2013.2993%2015.9338%2013.1719%2015.853C13.0542%2015.7633%2012.9071%2015.687%2012.7307%2015.6242C12.564%2015.5525%2012.3729%2015.4806%2012.1571%2015.4089C11.7453%2015.2653%2011.3777%2015.1172%2011.0542%2014.9647C10.7405%2014.8032%2010.4708%2014.6237%2010.2454%2014.4263C10.0199%2014.2289%209.8483%2014.0046%209.73063%2013.7534C9.61303%2013.5021%209.5542%2013.2149%209.5542%2012.8919C9.5542%2012.6407%209.60812%2012.3984%209.71596%2012.1651C9.82379%2011.9318%209.97572%2011.7254%2010.1718%2011.546C10.3679%2011.3576%2010.6032%2011.2005%2010.8777%2011.0749C11.1522%2010.9403%2011.4562%2010.8461%2011.7895%2010.7922V8.85742H12.9954V10.7653C13.2503%2010.7922%2013.4954%2010.8326%2013.7307%2010.8865C13.966%2010.9403%2014.1767%2010.9986%2014.363%2011.0614C14.5493%2011.1242%2014.7062%2011.1871%2014.8336%2011.2499C14.9709%2011.3037%2015.0689%2011.3441%2015.1278%2011.371L14.5395%2012.4747C14.4611%2012.4388%2014.3483%2012.3939%2014.2012%2012.3401C14.064%2012.2773%2013.9072%2012.2144%2013.7307%2012.1517C13.5542%2012.0888%2013.363%2012.035%2013.1571%2011.9901C12.9513%2011.9453%2012.7454%2011.9228%2012.5395%2011.9228C12.2062%2011.9228%2011.9071%2011.9856%2011.6424%2012.1112C11.3875%2012.2279%2011.2601%2012.4298%2011.2601%2012.7169C11.2601%2012.8964%2011.2944%2013.058%2011.363%2013.2015C11.4414%2013.3361%2011.5493%2013.4573%2011.6865%2013.5649C11.8336%2013.6726%2012.0101%2013.7758%2012.2159%2013.8745C12.4316%2013.9642%2012.6768%2014.054%2012.9513%2014.1437C13.314%2014.2782%2013.6376%2014.4173%2013.9218%2014.5609C14.2062%2014.7045%2014.4463%2014.866%2014.6424%2015.0455C14.8385%2015.2249%2014.9856%2015.4313%2015.0836%2015.6646C15.1914%2015.8979%2015.2454%2016.1715%2015.2454%2016.4856C15.2454%2016.7548%2015.1964%2017.015%2015.0983%2017.2662C15.0101%2017.5175%2014.8679%2017.7508%2014.6718%2017.9661C14.4856%2018.1815%2014.2503%2018.3699%2013.966%2018.5315C13.6915%2018.684%2013.3679%2018.7962%2012.9954%2018.8679V20.8574H11.7895V18.9218Z'%20fill='%230EE827'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5437_79079'%20x1='20'%20y1='4'%20x2='20'%20y2='36'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23D4E6E8'/%3e%3cstop%20offset='1'%20stop-color='%23767573'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",z$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M34.9013%207.2002H10.604C9.83641%207.2002%209.09532%207.84723%208.91004%208.66305L4.03999%2031.3373C3.85472%2032.1532%204.33113%2032.8002%205.0987%2032.8002H29.396C30.1636%2032.8002%2030.9047%2032.1532%2031.09%2031.3373L35.96%208.69118C36.1453%207.87536%2035.6689%207.2002%2034.9013%207.2002Z'%20fill='url(%23paint0_linear_5437_79143)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M19.7489%2026.5009H25.2421C25.8826%2026.5009%2026.3999%2027.0942%2026.3999%2027.8223C26.3999%2028.5505%2025.8826%2029.1438%2025.2421%2029.1438H19.7489C19.1085%2029.1438%2018.5912%2028.5505%2018.5912%2027.8223C18.5912%2027.0942%2019.1085%2026.5009%2019.7489%2026.5009ZM23.3208%2020.6216C23.2222%2020.8374%2023.0252%2021.0531%2022.6803%2021.3228L12.4575%2029.3596C11.8909%2029.7911%2011.1027%2029.6293%2010.6593%2028.982C10.2405%2028.3347%2010.339%2027.4448%2010.881%2027.0133L20.0938%2019.7047V19.5429L14.305%2012.8006C13.837%2012.2612%2013.8862%2011.3713%2014.4035%2010.8049C14.9455%2010.2655%2015.7584%2010.2655%2016.2264%2010.8049L23.173%2018.8956C23.5917%2019.408%2023.6163%2020.1092%2023.3208%2020.6216Z'%20fill='%232C5591'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M23.2368%2020.6216C23.1387%2020.8374%2022.9426%2021.0531%2022.5993%2021.3228L12.448%2029.3596C11.8841%2029.7911%2011.0994%2029.6293%2010.6581%2028.982C10.2412%2028.3347%2010.3393%2027.4448%2010.8788%2027.0133L20.0492%2019.7047V19.5429L14.287%2012.8006C13.8212%2012.2612%2013.8702%2011.3713%2014.3851%2010.8049C14.9246%2010.2655%2015.7337%2010.2655%2016.1996%2010.8049L23.1142%2018.8956C23.5311%2019.3811%2023.5556%2020.0822%2023.2368%2020.6216ZM19.7795%2026.6357H25.2475C25.885%2026.6357%2026.3999%2027.202%2026.3999%2027.8763C26.3999%2028.5775%2025.885%2029.1168%2025.2475%2029.1168H19.7795C19.142%2029.1168%2018.6271%2028.5505%2018.6271%2027.8763C18.6271%2027.1751%2019.142%2026.6357%2019.7795%2026.6357Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5437_79143'%20x1='9.76654'%20y1='10.3425'%20x2='29.068'%20y2='26.4694'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232D4664'/%3e%3cstop%20offset='0.169'%20stop-color='%2329405B'/%3e%3cstop%20offset='0.445'%20stop-color='%231E2F43'/%3e%3cstop%20offset='0.79'%20stop-color='%230C131B'/%3e%3cstop%20offset='1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",L$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAA0RJREFUeAHtmM9PE0EUx18pJCRaugUhQkuqXgi3eqDVpJFK+g9w8Ejkohcg4I8DFynECxdEAlz0gA0nNYF4kkODRDQmNQQ8NRhjbd1FrQHankja3XFm7DbN7rQMyS7l0E+y3dmZt/u+mffednYAatSoLpZKg9s//wawRUhKJj2/90QBLNgcocJt+EyvAQo/UBwv2qkeCm7o2P/ri+3OtOuSewcpEL7quvACTsJ2PC5sJf8sPQw9Rh2dnaigwPCjw9WJJmfm0FYyNUt8Ai+f4+Ls3dEHpgnTHndG76NoXFpiaanXdnz8Gh988+rl2LO5GXrd2NgILS0tUFdXB0aSy+Vgf3+fnp/PPYFztvODn2Lx8PXuyxuldroc/BD79u5WMBD4JYnQ0NAAbrfbcHEqiqKAKIpwdHQE7U4XvI683/B3X7lZaqPzLCV+eIg4Qmtrq2niqHP8bBIdAvEpJr57dDbajj1RLCar1Wot9i8vL0MwGAQzRKpgkXbduLZDlmVg4XQ6YXFxkR6kbQZKXtalnE4gwnnBYmhoCKLRKJ3F9fV1mJ6eNlwozkkExwlU5Dzz5lgsBgMDAzA+Pg6SJEF/fz8VOjw8DMYJ1EePO8Qqq6ur0NfXR2eT4PP5wChknhArZUKs4vV6acGQczabhUgkAkbBil693kguK2xkZISeCSsrK7CwsEDDbRSs/OcWqBYFCe38/HwxxEbCSi+9QIUtkAgis1ZO2O7uLpSjq6sLeGD51gnEicq8mVSv2XDNIFIqV3E5eGepEkjmeM0cV8VmIvMILBfi00DhmkFURYFIHz3GX10VBeZ5ZrCaApUzLhAXCcdqpopVjF9xxy8WZPmMVzGqqkCOKrbZbGm1fRqzWZpS2Pehdlwn0C7YdxwOB20fHByYmpPk2alUirYF7FMQhC9aG/1iQZanfNd8gbW3a/R7NZFIQFtbm+Gfn0Sc+uFOCAQCkM/nwlw3PwqFlnp7e09t6+MG9jUxMfGUpaWe1Wm1WO75/f40zomxzc1NyGQyYAaCYIeeHi9ZpYdxhCZZNhW33/AacBBvmd3OpA896WxW/aBHFry/hkr24TTXWrT7dNSmydaUdjQ37+DmFF6tb0CNGmeUfwIH0sS3Pm7dAAAAAElFTkSuQmCC",F$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACs9JREFUeAHtWHmMVdUZ/93tvXffPjvzZpiFwswILkEpIIqMWlAWjVpBTTXGYk1tivoHWhurorVp2miiMRUaW7FWkSaS2IoLdYPUBkXBBkZRUdaZgWHWN2+767n9zrlvGJlhebX/td6bk3lz3z3n+53f9/uW84Bvr//xS/pPXm5vb1d7e3tlfMMrFAp5V2y/wl2FVazUOacCKC+dtDR275U///PU1NT5AUkLecwDH6PTRj6X/kySJRoyXOZae47seXvZ80uXfdL7Sa74UskA5Z0rdv6ipbZtVWY4RxO9b8zaqS7P81gkqct9ff0PNz428SF6xEoBKO29a/9D8WDiPpex0oB5xwyKJSXpFKuf4NJkxT2Q2ffI9KemPzwW5DgATcmmRGWy6n7bdmXmejjdcB0Gx6XhOAjODCA4S6PPbvEZQylrmLajtFaf8cDihsWJsXjG7XH7rR+/WR1JXSJDHgeeMyRuiz5bDHJMFuwxj8BkHDStSUFSJOy7tQtqXIUs0fdEpzPgQA7RirokTMrSeGpdEndndv+mOc/MWnhKBlsq2trhYhx7nA3XJWZMhtg1YVTcXQYWBSzbESN8UQjMoHeyLsLzQvTMhkWsMp2hcU0talaWwy64tJbrM8uOX19iknR29VkXj8UzDmAQAZXWIDCeP5j/lzEGmxY2LQtSUII7xFB+XQKWbMGwDKgTFXqHswmoDSo9M2HYJurvrYbTx2iODKNgiTX4Wq7jHWeDg9QQCGKMV8cCDFqkH9dl/hAL+Z8doTXaPd2Z3TnBgENsNayow+DhNByPdkWu5sPxHAx0DqHt8WY4tBEKVqR3ZuBqLgF0it4oAi3aEJq1PTShKXhSgKlUSmG26zNB9pgQOU0k11ikMcdyhNv2bexEMKkJMFa/ibJ5CRTShgg/PoxhA+WXJIg5hysXalLG7qf30lxLBJOdp7UMH5hvA8KmS+QUagrKSQGSxiROBAflFiPRSDvkpipM/nUK1VdVIDeQh605OLSlm9zpCUDfuaoR3R8fId94AlDXh0cwbcUUeCKAPBze0gdHsWhuAckL40jdXomqW5Iws46wwXXJXD/iT6vBEea4LrgrjJwBvSkgojExPYzz152N1lua8d6j2xCu1IlEhgIZVnQVkkoRGpAhhSTYg46I+lCthtfv3IyJl6dw7m+nITqV5pDK+HMzZxal4zPJySkBIBeuD5K7A5SZdtz5BdQyWcjXGWComJbADz9divU3v4xIlS42VXdOijKuJErZlAXNYDaDVq7g2Xkv4cZNV6N8WhnMQUuA1hIqdj+xn7KAJ2yMBExJDPoR7O+K/7UtG5m+LN666QNoVSrtnhYhEMZhGzf9/WrsfGU3tJAKPRZEYbAg3o3VxqGGFWx/ugPXrb0S2Z4CUHS/XhXC1gf/hUx3FpblHLMjotkpycXF3MRGJ/Jd8vTy3Oy/YscfOxCq0SATW2a/i+k3TsXBjkPk/ghiZTEkqwhchYRPX9uDyXMnIdefJ9dDMP3Zxi/x0vWvwcgbsF2nqLuv58Rx+KCOY9Apvgw/FxbILdVLyhFtoURMGbwwbOLVu99FIKrhzCVtiNWE0bKoWYCQSXtcqyzvonXJZPTvGER+yMS+jw7ANm3Un5fCrNnnQPEU5L8y0bMxDSXKN+uzy3jQ95wWIIq5yUHVZXHM+nELrGFH5DKv2BVMXtRAwUBgZA+de7sxUW+El6TkPeIhlRxj0mZSGUy8oA71C6rI+Kj7JH7PldD2k2YcerEXPRvSBFIlT53OxT0oupS0R2J0OSjH350YYn5xEe4WEny2kCFWGTJZIGsDOarTw1mPciGQHkqLxmHUijfa9XEpyzxveiJ5i8zhsBJc7Po1l7N44G89+OS5r1B/TSUSrWHqCj3kKSEf3NZJLlUwZWYjDKosufoczLwGtTzgR3q/BT1P0eqq6P94CB2kx8KggUlzGqAndSJexvCeHA6+1IdoPEzFNQiJ2zxBFJ8AYDHVMB+kFAH2vt4F6xUTA4cH0bq4GZffMY+iNQ/ToLRhuFi/4U+4ev6N8I5SlFOSk6nUvfDGWixb/n3E9Sgu/un50KsD2PyrbXj3mW2obKxAQA4gEA5RWWRQiBTZY8L22Ou4wlyDmsjmRZ9njxhdop5ajAq+a8D0KOro87K1C5DtNUSE8xEuD+Gddf9Ew2WV6OjYhe6hLpEH40Y5pk45E4NUsxf9rB0WlTxZUUQjq9cGsG7h65AMFUEliKAcQkAJUQpVMSFUh/bXWqM96MmdWIPAsXBnLq1GDbUsKdDjOq79w3wMUz4TZxKSSrIuhkcXP43LVl6EhF6G+kQTZs6ejZnnz0ZNsA5lkTJceO0M/PLspxBOhahKMDGv0G1h2YYFSDTEiB1yIFPgl1eUWOocv3CD+QALPQ4uf2IW8n0meI2KUHk7tPMIVrb9Bqs+vwOFXhPxRBwH3utBc+MkNKWa0LNrEPF4DPlBE/e9dTtWxB7Bns0HoFWqouGxqcNZ+Oxs5DtNSJ5vRzQLpeRBAW7kRZqsBVUMHchCDSg4RE3Au7/7gDpjYPmaa5HvKkBVVCQnxGAM2NADupimaRol7KRoDgY7M1j+5DK8/ej7eOPBrVj0wFw0XZqC9aVFuZSCypUFTSJPsNNoMIVU+NWLOnJHzcPkDb+v49rLFXLIWzl4IXoGG+neDO757GaYfZZY+Z3V7yPeFMZZ17SI/3e9vAddW3tx6Y/mcLOIEetPLvkLIjGdGCFO8grCwQiikSgFSxAq6U+GgqpQLRZuOePkGqS4ouOFNFqCRMnzKInKCOhBUQEk0szC+y+A2euQ6MnlE0PY8vvtiJRFBZuqqiFaFsGujV8gQVWGv5PtMzD/rjlirkx9czBCoALqMd35DQr3sUSpuMc9qQb3Y781ooeRptXjgcLIsKfSHgNwM8Ck79WBn4e0MhWPz3kRVakKfhQiMLIApNCdrCnHk1etR7RaF+WvceYEsAyFhafRRgOkPUXonNsQLf+otMyTAuQStG3LPNY8evwwQwA9DjAIjRbmqcGmVl9PBfDCdZvIqEdwVBzdNSBOa1wzRzoGiCfuzACev2UTRXxEVKcApRQNfASgMK0IEhhpkg3eso/5hWHc+W9N68Z3Jqj17RQfEhPvMtHDUdr2NemZyAwPI5POIprSRTLn7+TTJu459ANRsh5rWQ89HOScivyX6zERiYQRjcVEglYlahCKt2Cdo/Ik1ud0/+O2zxe1fx2PMhbgfuOrN66vvG1lxsmIDt77Winm/3BNStRqBaNBwS53J89nqkqaouNn14d96NuRoV8LCAhxJZPu9Agl40BAMCqe0Rxe7kRrTYPbmKDVSsv3Xjq34BSGTwnwqN1VaNPPK6tUamcwLkC+AJP8QzvzD+miH/Ek4VqZBg8ebrT7g34c/mhQ1FYBhpji7yhFhyskFS4XicBx93JBcHCkS9aR37765d7n1o/FMw4g5+nNoQ1vnhu5sHZK8KwZw84wE/zzX7Y4SO573olw7oRBbogzQu6UFQHKDyhNfC+AcZZHgImk50uf1vOqlVrsyG1dfc/BG+7ECX7hOtXPO0oiVNPwUOXqdWeEvjuDTKs8C3ItjvSFfvfF4N+OYNcTEAi+pBzT2KgxP8I5q47kWh359z9cO7Dqho5CRzdGy0PJAEeuEQtaAomwGw1p+C8uJWvYaaT5IcUsru3i2+v/+fo3XDNIGH8X+FsAAAAASUVORK5CYII=",N$="/assets/vscode-C5BXgFjm.svg",R$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAYAAADFw8lbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACSFJREFUeAHtWG2MXFUZfs+Ze+/M7uwnLNhiqd1dWknaBETS+EO0JRWllRCjjSY2EhP/GP2BMSZG40fU4A/RRIs/FA1iJNaQaAKCiiG1dGu7okVKCK6lFWrb3a3b/ZiZnY/7ca7v855zZ2d3Z5chJIQfPcnZO3vuvec87/N+X6Ir48p4aw/V6TP79+/XpVKpv2twsC+uVHzj+4oaRMbUlDG+Mr5R+SCQFxphSL38O451SrwULUap1nGKe55XNPl8V3jq1PjcxMREmZc0z9TN9UGsc09974EH7v7oRz7+8ziOBiuVCimspnx+Pk9a56hULpHHV8/zyGdwURQxeEM9vT2U8lUxjlq9xr9TynmacjmPYn4mKOT5nqLJixfGv/qlL9w5NjZW4p0Tep1ABc4Lp185UyktbDGGCdFMYCMk3/cYVMAHatI8G/UGU8EgGGwQ+MxiwjOiYpGBpgYyUbVWlfuel+P3cpQw6LBRpyiOIZR5x+br9Zmzr3xuz23v+SmfG7cDpNcASv959fy/5i7PbE6M0dg8x4wVi0W5BnlfDtRMryfAPVJaZfLJ+5kecfX5vhymPdGCh/2YWdzM5/N6cmqarhq86uBDj/zmDn4s1w6P1w78gw8/ctdseXFrsdirw7Aum3qek4nl1UqTYbYUA8XBJjECCSqXTT2fIacCMmHWUqcjrUlYxj+JSRhkwLPAvw3V6zV95969T9AaWm6HPv3Bjw7+tV6rd+dyAKIdG+59BgkI1lRTmQJQkVyzNc0swi4zWmHbEAwzSawpejloRvF7iQi8MD9vRrZuPf/0U3/650pQbdFPzy6k5y9cdCDtIyY17tCMuUzN9iC24+YVQgVBQbQQcgTI1qAZAIbdglnYumag9VrNaobfZ0Ge23nzjltWYlql+l27dg1VGw2xOwvIsiJAmAnYYsKqNknMv7UwFEexPAdHkk3ZbuMYaxYogOFZD4yLaEqAJwmcSYndY++Ao8bQNVcPU5uxCmgvjzjkDYS5VNSMMAM7SqyXyqGwS8X3ARzPJHEijHR3F+m+b32denp6RAjTVLsW54NZ9Pb10Wc/fy+VywscRXwLhMFqZjyndb4joIVCIYfNEOtgj1Aw2MmAivbBDE+Yhkq1qBFCxQz+8swMPTt+QoBmppPZJoTCFV7/2G8fpSeePkqVcllCnhU+5hAY6Y6AVuMYLisGn6YOmAMHlhEfhVXccF6vhTlDU5MX6cTxMWa1u+lkSmVhC94m1FLM9/r6B+jFF07R9Zs385pPEZuInKW06ggo25Gq1+tyEBjKvLvY00df+/IXaeyZI8JIkyU3GxzA//zMOB09fNiBW2ss3bPgVOaTrDn2CdP+La/9Vto5Rioqj5nd3/3iZ/TcP/4uQX8lSMwbt2+neqNG/554SewUNkltnlsWptLE2neSiHnBXo2JOwMaaw2LE6+MokTsD1569MhhYXat8d7b3k8zl/5nYw85QLT+QOKASSHl4mmchUTQ9tm2i2zY2oWeLIjDFjGEjRYHwQG1apXedetOOvX8Seou9pDqpCYjK4jk+9TGWQlja2T1VasMTCEuQvXKBekskyw7IfupbDLYMjxCY0f+so59LhdO0qjzAZBi3F7pGka6CqjmGtIG4kRSIDZG+ZY6la46nu9ve+eN9PbrrmMvft7l9fa22SqczVBZik0FCLQXhXFnQMEoJM3KNclOqbXZ5YctgfjQ3g/TpelpKQMzvjoZYl5uGpdUdPvotLaNKmczArhF9RaczoigxcUK3f6BD9Lfxo9zbOxfJkDrO00pW9YTF48lRhtb6GQV2GsC9TiQIlRkhYMEthWNQnYWpEcuR9B+6g9PSo3aOloBq+z/lnUU0onL/+RsV3XKKG+QIqCjSDCpZQ32SsscYemwYXYiONz48WPrhi9qZZUsCYibSrmAn1o2tOrQ6+NcLuWSXqT1clpYUlltRrQq9OzecwddujTNJrBIayCkpnBNzIqq/PyW0RtsLHUg8bdZTq4YqwK+jqLUuIKD5MW0WQAvy9s8uCqn9+2+nS789xx98lP3UBbos5grlRe/b9sWG5ex0+DgIH3iwD2cxSY4i3VZ+3TnJUmHQLkUlU7SplAuIDhUjYyO0jDPi1x0SGdpKxIO9DXavuMmmp2doQOf/gwVuK0AIyFvslSUaGkEUcah7kQ9Bo2hWN62bZtoDt3t5NSUCIPQ2BFQ3tDYQxLRNvofjPt/+GPasXWLjXmuXCt0FWj76KamrWHedPMt9MtDj8rhNS5uuL60DSHHYszWwhnaiji5oDbo7xugcqXEewVpR0C7unQD9aF2DoUaNAwb4t0nX5ygsy+/LEzhPsxDCl6Ubq6wQB1aZaYD1+NDaJ9bDk86Udu+4FkT8R7KFswoc4eGruZrCEGSjoBOT08voDMsl0q0YcNG6ufYGEWhgJifm2MWu+S3AOErF9oysbYwvyCRYrG6SF2FLnQLYkJQL0BCYHxFESvXupk+OdAw+JSrrwblqtX5joAeO3asHHAbC7uUbAHpXTOXZ0BwFKgVRo9POAUGBKBSv7psxuqTjxMAn5lOxOvQjm1nbH+Slw8WRlgtl8oI2emrZ8+cbAe0bdCanpx6lu1I3E/6d20/D8G2wM7AQL/05AAC9aI0AzCw38f9EGzO93wBxN+raH5hXp7DCIJ8M/uE8vknkW4VLUlQCNInH3v8G+0wtUsDat++fQP3H/zJbIHB2BaYPZmNXhKBtLS2T5pnVYNBsIb2o7vYLQ4C/Ye8HnLuD3xrm9K9smBQPT7v4GQ4oe+aOnauuKfgz2689pq3tQPa9vPJ6dOno9179py/YXRkXxjGCpIvsrozBvGNCQP/25kIq7776JDZIjwbawCknU3CQbNat1mUsAMNb9roDfSyJy593Xtt1fNIPnbX3od+fejQ3Zs2XisMYNMqO0mZAc/MXBa7AosDA4O2PeGXoGb0Wwg5AXt6pn5bENvjss5UshB/LSsW8umGof65+77zbZAG+k2nql8piHnw4V8d2Hnru+/1C8URPqILVepAX48EcrsL2hYjwVo78/BYnYG/lKFg37V6yETqlL08btQalXMXzp34/eN//Mr3v/vNlxwWQ29wdFpivtX2vjKujDdt/B9Vn+PpjUxyeAAAAABJRU5ErkJggg==",j$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAADQlJREFUeAHlWAtwXOV1/u5r3w/tQytpVyvLdoRlG+M4Ia4NxMZ2SELo4IRX6qEtbmEST6epoU3K0EIKZZpCmk7JNCRpaSkJEFJahhhSY9pJggfHJiHYxg2OJSzr4dV7tbvSah939z7y/XfltwyaSTLJTO7Mr6u797///f7vnPOdcy7wG35I+NUcyvbtO9Ldy5bdl2pftDHIY2JivDQ9XejPZDLPvfLK3l1vvnlgeCEL/WoAJpO+jcvfe7KnpyeqV6vw+QK44qoN6OpsR80wEAqF7ZaWNimXzT5+zz07b5/DYeOXAJDz7+d4S8LVk2eeLRbPXecN548n6UVElf1d4ebWW2o1/Y5auFXe8sF1UFUXNFWDbVtWKpWWPW73C3fd9emtfEjhMM974UUPGStXqi13/suj2nvf90nJ7Q3CsM48YV/kKduGVTVhTZdhFSZgl4uw9QoqhmV1PvOAjGoRy7uXw+P2QFEUqJoGRZbNLZs/otxy87XSPIzMeyixr/5wm/+qtU/WTxbtbBnS+6IKVjSpCKu8Kc/h4x/5vBVsy4ZRraA6nYPOUSvNoF4pQy+XoLu86P+ne+EO+hCLxWnqJprfB5fbjRXd3VY+Vxx7+OH7UmeTNB9AKfHo/j/Qlq/+93y2qj59ZQAjVQuPHNMxxnPdmkN2GhAB81LRQLPJ3LGNerUGvVIhc1XIdo3nMt0gT1azWPyTXZg8/Ar8/gBCTU0E2ox4cwInB/pw7bXXGZcsW6Nqqic7NTWhvfTSCxvnBZg+WLdyPTMYuiGC5mdzaAsrOI1rzp2rZOryqOpcZioWsjqB2Y17btkm0zY6vIRrWTiYrUKtzMDKjsB36GWUX34Cer1GE6vweLwo5KeguHwwayV8/IZtWL58pbNuMBidUs5HF//yvqclO7TysfUB6fIXC2gLqsKtnBeLh2ZrNtbHVFSIpnfGQoHAygbg4k3igir8gzMrpoRsTcJARUaz14VVUS+OFy0sG/wREl4NsiyjpuvoTKfxmZ33ohRKIZcrojg1gtdeexWlyiw6O7r/RD4foPvS1TdMztrySNlGUoAjU+CQOSSONU0K9o3XUSLQmCqhTJu7uYONzSqSHmCxT8b7OcfHuZWahYjc2NT+KWBpsgWr5CKSqTRWrLwMiZAPxpW34kAuj71yC5If345MScVoZhgfeP8Hcffdd3xDPR+g7Ap41kYMfO2njEJr7jcOP8EI/zteMOGTJAfgUr59kVdFhPQdmjRw6xIPWTUQ5vXaiBu7RwyaGziUM+AjvRNHDsH2h2DPFKFKFqTNd+CEbmHYDmBJQsbxumx95vprdv2scv0n2hLxnfMFidr+PaN+jauCZ/t0hNwSiMUZLr6IhDiggwTgI+ChkoUNZO4HI3W0hxRcGlGwoUXFnuE6JBLv5Zz/5b0Ov4wyI3XzM3+GbKWGUDiIob5+7F9+PbyhCKpqCFvaXTgwZSP71x/yptPp6MmTJ7PEUzvfxDLoT01c2BQeTzBlHUh5ZOg1XvJeG//XeKtQFqYFvp+p4aG1fswwwj+cdOGJXh390xa2LSGDx3XQ6sjOGhjf/ypa0x3UPRXmTBaDq7dCCcSoZx0wo51ILVoCpXmxE6QENyLAnbLeWUenLGRDElFhNsaKEKmniYQfkggUGLH5is2U1fDNADfzyMEy4nz65UEdFb3hr48eLiPokZxN6p4Atmeew/HMCNKpJPqydWQQRFcqBTmUgOShHgYjUCKtXKX9PMbOOQwJ4sUiank2yOLoLJliVFZr4sUMIhHQvGcbOD3GZ0x84YoAfjxmcBMSnt4UxBs0rWBcqhuwv/8s2rtXMXu4MD06gCNd1yEQiCCrRGDKPm5CobNxaC5cEBMX/GKeGrZjzpmy5TAlzNzulZGl39m8J4bYhGBrXauG+/bPIkmfDVK41n0jh23dXmdDJVcUOz1H0NPXh0XpFH5ysop4tAmSL4YyfEj5XA1riYCcJ31eCJC7FpPteoMdsSdqKupk81jWgGKdtQn+P5U3cdN7PMhzI29Rfja0aVjGQLmE4p4t2GjZ80VEl65CiOltYqAXb3d9DKYWhMWhKS6YXMeqNdzl3DLhnQDaDQZn6G/CnF5eRjWKL68dF5gbCud89nf8+Ku9RYQ1GVsZGAMELPz08Tdn8beXjcH942fw1Leeou+14wfMTqoviFk5Ah/9EpaMIufKpxg0FgqQOxHmqdUa5mWadSLX8RBrLoB4ztH3Juij3RTmYxOG85IJ6mShYMHyhfHYHTfDHWmGz+vB8//1DDLt66G6QkJr4RXJ25KoDpYjSQ2/XyhAkTXMhqyIa+FnGTIjWWc2oDNaH7sujN09VQzmTHxpUwDfOVzBvsEa/uFDAczu/jcEYjG4KCsqy6rx8Ukg0eVErKwwMGzFsYJVb7iKY94FATQbAIVpMRcIAuxs9Yx5JY5Omvwrr5VoWsmRnyf2l+BnceBRJNz7mozwvkecotTl0lCrljDZvhmqzWpHDVAT5lLo3Fqn/H7hDM7JjAAmAkWItl5tyI4Ys9MmPrU+gCpFfJzM7qQfHuW5Tmc3LBXub30KnlgbNIJTWTwODw5BX7oJJjOGSemuMT9YdaEEcPK7XbcuGiTqhQAb/mXXbEfTciUT928Ks6KxnVQndqQpQhct7PgApYR8TM2aeOiaIMr8zTIKePxfD0KLNzvmrdcqGAlfjgeviaDgbUFHawzThoIwJelzu2cQZXGRn8taCwDIIs5qTBbMUfpwyyov7mbZFaEdxS2RQVqZd6eohzEuXuLiIj9HfARqemF+/ZOIhaME12Cvvz8D39W3Y6Dkx3eOMbNoZQQ8CsYYYDdf5sUPB2qOpJ1657sAHDgdBNJctB7qr7GWU9HPKqVIk5oEWCrZTuWcL8xRSnYnczY8hYNodRnMt25omkJ3qCLr7YZf8eDJIyr+cVscO/+7jLxaR5qif3So5tSQkmWfUYd3MbFtn+WD45SMCBfyM+BWxDUEGQQJn0KtM5AnyC3L3TiUqTcaG38EJx74MJSmuGNa0RANDQ5g9e/ei/+fCSAaDOLr+6q4cY0Ho2RvjH48Rokq6tZZQXIhwIvoYMOBBfoIE/4Qgb4+oOPGy3zYdaSCo6N13H6FH1/9vyIOk4VDlJY3v/0wXMyvmqpwqDBqVUzIHTg85sZ9W9OsflyUIwubuzz40du6I1txbl6eI8NhcKEyY5qnqhmgl0l/aUTFapr5/l0FtDPZRhg8//w/08wGUmO+EkC490n2uwTnsCdjfGSUtN8IF7vVv3/JxKUtHqe5+otn89jAjLOE6/WM1hqBQRcxF6iDFthLTLPc12zJKQiErvWNG/jjTSHk2FP0ksk7P8KqmBVsuSq274Jnz6eh+GNOreewV9cxYcaheKKoS2G0JfzYtj6ICvO1iN7tV/pxYqzOIJQcIhiamGbQNXwwY50N6IKuLvU3dTuFSQfMrJAbAYEgNe7wxvV+luYq/vSbOQToj6vTGkanZqB9lynNH4bX64ab2jeaGcRgxw50LOlCrLUTb016UWbn+cJnW3CCrcEXny+I1g9Vo4ElSqBR1p0DdgLDD6jSO5rY0kvlg6yK7/pYqJEjTTgCrNMMX6JuffPVWQTIgijne6d8qO66jUwFHNOqp9irBhGJt2FkNoDjWRVeRrSP/vbQi9O4k5urM+iqIjjmeuodHw3hQI9O7Z2tv5uJoR/fuzseVa0kvyKMn6g19EkEGv0jxV0eYUCs7XQjxFxv9O9F0G05ZhX+p5CJyYlxmO+5CbrhIaMhAlHZ28hYt9iF19kCtIVlZibHmZxMNXpCRwd7mURUtmr9r3/vfDwXNu6RJeHUjqOF3NsjyPzHIsR+bwBtnS6KsX3OQ1U1jtY9l8NFefF4XM6wTAO9/ePQ13weibYU0skkK2YPDnNTXpd0Tj0q3G98oI7J/+xE+o8GEelqxvBXknF+iJo6G86FqS5/olg5/O3PNS297uH0Hw7Kz32+FcPsSb5G8wxRGgSTIu0l8l+G7A07zIkhGvHsxATyiRuglBUMDlFW6G+SVnWWrc6h41S0UhXuuj6E9piG9tsGEW4LmpW39jxIcPl3Z7BxKJGPPvGXvlU3fcHIT1mTk6a87hI3lpHJMFOe1+/B03++Bk3Mt6LPEEOwd6znbVx9+6MINCUQiiVZLHhPe5EIN9GLFRitR5ne3uitIpZQLTXULFeOPv9g7qVbH8A82fidPr8JdmOxrS8+5e64cqOkBjWRZkRa0oa/C/XI31k+v08OBPxO5hgbyZiF1G2KEb+C2YQtpCdEbPK5fcapt7FBglnV9cG9r1YP3PP7pYmfCrMa84FYyAdMFY3X8Ntb2EdnVDyyHFrU3tU32PczKxJtluPxGIplEwPHJ/wIzPgvupJEXeC3QExPV9Doe+WLAftFD6Wpqanzqi2fGI4n2u1IPGmnFi+7GfNlpl/zoXq93lQwmBR9u4rfxuPnTjEKD0h39egAAAAASUVORK5CYII=",rp="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5437_79109)'%3e%3cmask%20id='mask0_5437_79109'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='5'%20y='5'%20width='30'%20height='30'%3e%3cpath%20d='M5.6001%205.59961H34.4001V34.3996H5.6001V5.59961Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_5437_79109)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.3001%207.39961C8.0614%207.39961%207.83248%207.49443%207.6637%207.66321C7.49492%207.832%207.4001%208.06091%207.4001%208.29961V28.0996H5.6001V8.29961C5.6001%207.58352%205.88456%206.89677%206.39091%206.39042C6.89726%205.88407%207.58401%205.59961%208.3001%205.59961H32.4138C33.6165%205.59961%2034.2186%207.05371%2033.3684%207.90421L18.5166%2022.7557H22.7001V20.8996H24.5001V23.206C24.5001%2023.5641%2024.3579%2023.9074%2024.1047%2024.1606C23.8515%2024.4138%2023.5081%2024.556%2023.1501%2024.556H16.7166L13.623%2027.6496H27.6501V16.3996H29.4501V27.6496C29.4501%2028.127%2029.2605%2028.5848%2028.9229%2028.9224C28.5853%2029.26%2028.1275%2029.4496%2027.6501%2029.4496H11.823L8.673%2032.5996H31.7001C31.9388%2032.5996%2032.1677%2032.5048%2032.3365%2032.336C32.5053%2032.1672%2032.6001%2031.9383%2032.6001%2031.6996V11.8996H34.4001V31.6996C34.4001%2032.4157%2034.1156%2033.1024%2033.6093%2033.6088C33.1029%2034.1151%2032.4162%2034.3996%2031.7001%2034.3996H7.5864C6.3837%2034.3996%205.7816%2032.9455%206.6318%2032.095L21.4272%2017.2996H17.3001V19.0996H15.5001V16.8496C15.5001%2016.4916%2015.6423%2016.1482%2015.8955%2015.895C16.1487%2015.6418%2016.4921%2015.4996%2016.8501%2015.4996H23.2272L26.3772%2012.3496H12.3501V23.5996H10.5501V12.3496C10.5501%2011.8722%2010.7397%2011.4144%2011.0773%2011.0768C11.4149%2010.7393%2011.8727%2010.5496%2012.3501%2010.5496H28.1772L31.3272%207.39961H8.3001Z'%20fill='black'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5437_79109'%3e%3crect%20width='28.8'%20height='28.8'%20fill='white'%20transform='translate(5.6001%205.59961)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",U$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5437_79100)'%3e%3cmask%20id='mask0_5437_79100'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='5'%20y='5'%20width='30'%20height='30'%3e%3cpath%20d='M5.6001%205.59961H34.4001V34.3996H5.6001V5.59961Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_5437_79100)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.3001%207.39961C8.0614%207.39961%207.83248%207.49443%207.6637%207.66321C7.49492%207.832%207.4001%208.06091%207.4001%208.29961V28.0996H5.6001V8.29961C5.6001%207.58352%205.88456%206.89677%206.39091%206.39042C6.89726%205.88407%207.58401%205.59961%208.3001%205.59961H32.4138C33.6165%205.59961%2034.2186%207.05371%2033.3684%207.90421L18.5166%2022.7557H22.7001V20.8996H24.5001V23.206C24.5001%2023.5641%2024.3579%2023.9074%2024.1047%2024.1606C23.8515%2024.4138%2023.5081%2024.556%2023.1501%2024.556H16.7166L13.623%2027.6496H27.6501V16.3996H29.4501V27.6496C29.4501%2028.127%2029.2605%2028.5848%2028.9229%2028.9224C28.5853%2029.26%2028.1275%2029.4496%2027.6501%2029.4496H11.823L8.673%2032.5996H31.7001C31.9388%2032.5996%2032.1677%2032.5048%2032.3365%2032.336C32.5053%2032.1672%2032.6001%2031.9383%2032.6001%2031.6996V11.8996H34.4001V31.6996C34.4001%2032.4157%2034.1156%2033.1024%2033.6093%2033.6088C33.1029%2034.1151%2032.4162%2034.3996%2031.7001%2034.3996H7.5864C6.3837%2034.3996%205.7816%2032.9455%206.6318%2032.095L21.4272%2017.2996H17.3001V19.0996H15.5001V16.8496C15.5001%2016.4916%2015.6423%2016.1482%2015.8955%2015.895C16.1487%2015.6418%2016.4921%2015.4996%2016.8501%2015.4996H23.2272L26.3772%2012.3496H12.3501V23.5996H10.5501V12.3496C10.5501%2011.8722%2010.7397%2011.4144%2011.0773%2011.0768C11.4149%2010.7393%2011.8727%2010.5496%2012.3501%2010.5496H28.1772L31.3272%207.39961H8.3001Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_5437_79100'%3e%3crect%20width='28.8'%20height='28.8'%20fill='white'%20transform='translate(5.6001%205.59961)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",K$="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_5436_78897)'%3e%3cpath%20d='M35.911%2020.0773C35.911%2019.7026%2035.552%2019.4866%2035.1114%2019.5939L4.79962%2027.0055C4.35812%2027.1135%204%2027.5052%204%2027.8792V35.4541C4%2035.8288%204.35812%2036.0455%204.79962%2035.9375L35.1114%2028.5266C35.552%2028.4187%2035.911%2028.0269%2035.911%2027.6523V20.0774V20.0773Z'%20fill='url(%23paint0_linear_5436_78897)'/%3e%3cpath%20d='M4%2019.8353C4%2020.21%204.35812%2020.6016%204.79962%2020.7097L35.1159%2028.1219C35.5573%2028.2299%2035.9155%2028.0133%2035.9155%2027.6393V20.0637C35.9155%2019.6897%2035.5573%2019.298%2035.1159%2019.19L4.79962%2011.7778C4.35812%2011.6699%204%2011.8858%204%2012.2603V19.8353V19.8353Z'%20fill='%23FF9800'/%3e%3cpath%20d='M35.911%204.51106C35.911%204.1365%2035.552%203.91973%2035.1114%204.02778L4.79962%2011.4387C4.35812%2011.5466%204%2011.9383%204%2012.313V19.8879C4%2020.2626%204.35812%2020.4786%204.79962%2020.3712L35.1114%2012.9596C35.552%2012.8517%2035.911%2012.46%2035.911%2012.086V4.51106Z'%20fill='%23FF9800'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_5436_78897'%20x1='1762.84'%20y1='981.852'%20x2='1845.15'%20y2='624.882'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9700'/%3e%3cstop%20offset='0.53'%20stop-color='%23F48E00'/%3e%3cstop%20offset='1'%20stop-color='%23D06F00'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_5436_78897'%3e%3crect%20width='32'%20height='32'%20fill='white'%20transform='translate(4%204)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";var V$=I("<img data-component=app-icon>");const B$={vscode:N$,cursor:A$,zed:rp,"file-explorer":P$,finder:O$,terminal:L$,iterm2:M$,ghostty:E$,warp:R$,xcode:j$,"android-studio":T$,antigravity:D$,textmate:F$,powershell:z$,"sublime-text":K$},Z$={zed:{light:rp,dark:U$}},Cf=()=>typeof document!="object"?"light":document.documentElement.dataset.colorScheme==="dark"?"dark":"light",If=e=>{const[t,r]=$e(e,["id","class","classList","alt","draggable"]),[i,n]=ze(Cf());return Vt(()=>{const o=()=>n(Cf()),s=new MutationObserver(o);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),o(),je(()=>s.disconnect())}),(()=>{var o=V$();return dn(o,ie(r,{get src(){return Z$[t.id]?.[i()]??B$[t.id]},get alt(){return t.alt??""},get draggable(){return t.draggable??!1},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!1),o})()};function ip(e={}){const[t,r]=Vx({value:()=>Ce(e.isSelected),defaultValue:()=>!!Ce(e.defaultIsSelected),onChange:o=>e.onSelectedChange?.(o)});return{isSelected:t,setIsSelected:o=>{!Ce(e.isReadOnly)&&!Ce(e.isDisabled)&&r(o)},toggle:()=>{!Ce(e.isReadOnly)&&!Ce(e.isDisabled)&&r(!t())}}}var H$=Rt();function ma(){return jt(H$)}var q$=Rt();function op(){return jt(q$)}var sp=Rt();function ap(){return jt(sp)}function xr(){const e=ap();if(e===void 0)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var lp=Rt();function Ec(){const e=jt(lp);if(e===void 0)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var cp=Rt();function ar(){const e=jt(cp);if(e===void 0)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Mc(e){let t;const r=ar(),i=xr(),n=Ge({id:r.generateId(`item-${nn()}`)},e),[o,s]=$e(n,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),h=()=>i.listState().selectionManager(),g=()=>s.id,y=()=>h().focusedKey()===g(),b=()=>{o.onSelect?.(),o.closeOnSelect&&setTimeout(()=>{i.close(!0)})};Oc({getItem:()=>({ref:()=>t,type:"item",key:g(),textValue:o.textValue??f()?.textContent??t?.textContent??"",disabled:o.disabled??!1})});const v=Vo({key:g,selectionManager:h,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>o.disabled},()=>t),w=K=>{Qe(K,o.onPointerMove),K.pointerType==="mouse"&&(o.disabled?i.onItemLeave(K):(i.onItemEnter(K),K.defaultPrevented||(vn(K.currentTarget),i.listState().selectionManager().setFocused(!0),i.listState().selectionManager().setFocusedKey(g()))))},x=K=>{Qe(K,o.onPointerLeave),K.pointerType==="mouse"&&i.onItemLeave(K)},_=K=>{Qe(K,o.onPointerUp),!o.disabled&&K.button===0&&b()},k=K=>{if(Qe(K,o.onKeyDown),!K.repeat&&!o.disabled)switch(K.key){case"Enter":case" ":b();break}},C=$(()=>{if(o.indeterminate)return"mixed";if(o.checked!=null)return o.checked}),O=$(()=>({"data-indeterminate":o.indeterminate?"":void 0,"data-checked":o.checked&&!o.indeterminate?"":void 0,"data-disabled":o.disabled?"":void 0,"data-highlighted":y()?"":void 0})),z={isChecked:()=>o.checked,dataset:O,setLabelRef:m,generateId:Nn(()=>s.id),registerLabel:tn(l),registerDescription:tn(d)};return c(lp.Provider,{value:z,get children(){return c(it,ie({as:"div",ref(K){var J=xt(T=>t=T,o.ref);typeof J=="function"&&J(K)},get tabIndex(){return v.tabIndex()},get"aria-checked"(){return C()},get"aria-disabled"(){return o.disabled},get"aria-labelledby"(){return a()},get"aria-describedby"(){return u()},get"data-key"(){return v.dataKey()},get onPointerDown(){return et([o.onPointerDown,v.onPointerDown])},get onPointerUp(){return et([_,v.onPointerUp])},get onClick(){return et([o.onClick,v.onClick])},get onKeyDown(){return et([k,v.onKeyDown])},get onMouseDown(){return et([o.onMouseDown,v.onMouseDown])},get onFocus(){return et([o.onFocus,v.onFocus])},onPointerMove:w,onPointerLeave:x},O,s))}})}function up(e){const t=Ge({closeOnSelect:!1},e),[r,i]=$e(t,["checked","defaultChecked","onChange","onSelect"]),n=ip({isSelected:()=>r.checked,defaultIsSelected:()=>r.defaultChecked,onSelectedChange:s=>r.onChange?.(s),isDisabled:()=>i.disabled});return c(Mc,ie({role:"menuitemcheckbox",get checked(){return n.isSelected()},onSelect:()=>{r.onSelect?.(),n.toggle()}},i))}var Po={next:(e,t)=>e==="ltr"?t==="horizontal"?"ArrowRight":"ArrowDown":t==="horizontal"?"ArrowLeft":"ArrowUp",previous:(e,t)=>Po.next(e==="ltr"?"rtl":"ltr",t)},Tf={first:e=>e==="horizontal"?"ArrowDown":"ArrowRight",last:e=>e==="horizontal"?"ArrowUp":"ArrowLeft"};function dp(e){const t=ar(),r=xr(),i=ma(),{direction:n}=Nr(),o=Ge({id:t.generateId("trigger")},e),[s,a]=$e(o,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>t.value();i!==void 0&&(l=()=>t.value()??s.id,i.lastValue()===void 0&&i.setLastValue(l));const u=th(()=>r.triggerRef(),()=>"button"),d=$(()=>u()==="a"&&r.triggerRef()?.getAttribute("href")!=null);ne(qe(()=>i?.value(),v=>{d()&&v===l()&&r.triggerRef()?.focus()}));const f=()=>{i!==void 0?r.isOpen()?i.value()===l()&&i.closeMenu():(i.autoFocusMenu()||i.setAutoFocusMenu(!0),r.open(!1)):r.toggle(!0)},m=v=>{Qe(v,s.onPointerDown),v.currentTarget.dataset.pointerType=v.pointerType,!s.disabled&&v.pointerType!=="touch"&&v.button===0&&f()},h=v=>{Qe(v,s.onClick),s.disabled||v.currentTarget.dataset.pointerType==="touch"&&f()},g=v=>{if(Qe(v,s.onKeyDown),!s.disabled){if(d())switch(v.key){case"Enter":case" ":return}switch(v.key){case"Enter":case" ":case Tf.first(t.orientation()):v.stopPropagation(),v.preventDefault(),Bx(v.currentTarget),r.open("first"),i?.setAutoFocusMenu(!0),i?.setValue(l);break;case Tf.last(t.orientation()):v.stopPropagation(),v.preventDefault(),r.open("last");break;case Po.next(n(),t.orientation()):if(i===void 0)break;v.stopPropagation(),v.preventDefault(),i.nextMenu();break;case Po.previous(n(),t.orientation()):if(i===void 0)break;v.stopPropagation(),v.preventDefault(),i.previousMenu();break}}},y=v=>{Qe(v,s.onMouseOver),r.triggerRef()?.dataset.pointerType!=="touch"&&!s.disabled&&i!==void 0&&i.value()!==void 0&&i.setValue(l)},b=v=>{Qe(v,s.onFocus),i!==void 0&&v.currentTarget.dataset.pointerType!=="touch"&&i.setValue(l)};return ne(()=>je(r.registerTriggerId(s.id))),c(Ro,ie({ref(v){var w=xt(r.setTriggerRef,s.ref);typeof w=="function"&&w(v)},get"data-kb-menu-value-trigger"(){return t.value()},get id(){return s.id},get disabled(){return s.disabled},"aria-haspopup":"true",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return Te(()=>!!r.isOpen())()?r.contentId():void 0},get"data-highlighted"(){return l()!==void 0&&i?.value()===l()?!0:void 0},get tabIndex(){return i!==void 0?i.value()===l()||i.lastValue()===l()?0:-1:void 0},onPointerDown:m,onMouseOver:y,onClick:h,onKeyDown:g,onFocus:b,role:i!==void 0?"menuitem":void 0},()=>r.dataset(),a))}function fp(e){let t;const r=ar(),i=xr(),n=ma(),o=op(),{direction:s}=Nr(),a=Ge({id:r.generateId(`content-${nn()}`)},e),[l,u]=$e(a,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let d=0;const f=()=>i.parentMenuContext()==null&&n===void 0&&r.isModal(),m=Tc({selectionManager:i.listState().selectionManager,collection:i.listState().collection,autoFocus:i.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!i.listState().selectionManager().isFocused(),orientation:()=>r.orientation()==="horizontal"?"vertical":"horizontal"},()=>t);mc({trapFocus:()=>f()&&i.isOpen(),onMountAutoFocus:x=>{n===void 0&&l.onOpenAutoFocus?.(x)},onUnmountAutoFocus:l.onCloseAutoFocus},()=>t);const h=x=>{if(Do(x.currentTarget,x.target)&&(x.key==="Tab"&&i.isOpen()&&x.preventDefault(),n!==void 0&&x.currentTarget.getAttribute("aria-haspopup")!=="true"))switch(x.key){case Po.next(s(),r.orientation()):x.stopPropagation(),x.preventDefault(),i.close(!0),n.setAutoFocusMenu(!0),n.nextMenu();break;case Po.previous(s(),r.orientation()):if(x.currentTarget.hasAttribute("data-closed"))break;x.stopPropagation(),x.preventDefault(),i.close(!0),n.setAutoFocusMenu(!0),n.previousMenu();break}},g=x=>{l.onEscapeKeyDown?.(x),n?.setAutoFocusMenu(!1),i.close(!0)},y=x=>{l.onFocusOutside?.(x),r.isModal()&&x.preventDefault()},b=x=>{Qe(x,l.onPointerEnter),i.isOpen()&&(i.parentMenuContext()?.listState().selectionManager().setFocused(!1),i.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},v=x=>{if(Qe(x,l.onPointerMove),x.pointerType!=="mouse")return;const _=x.target,k=d!==x.clientX;Do(x.currentTarget,_)&&k&&(i.setPointerDir(x.clientX>d?"right":"left"),d=x.clientX)};ne(()=>je(i.registerContentId(l.id))),je(()=>i.setContentRef(void 0));const w={ref:xt(x=>{i.setContentRef(x),t=x},l.ref),role:"menu",get id(){return l.id},get tabIndex(){return m.tabIndex()},get"aria-labelledby"(){return i.triggerId()},onKeyDown:et([l.onKeyDown,m.onKeyDown,h]),onMouseDown:et([l.onMouseDown,m.onMouseDown]),onFocusIn:et([l.onFocusIn,m.onFocusIn]),onFocusOut:et([l.onFocusOut,m.onFocusOut]),onPointerEnter:b,onPointerMove:v,get"data-orientation"(){return r.orientation()}};return c(F,{get when(){return i.contentPresent()},get children(){return c(F,{get when(){return o===void 0||i.parentMenuContext()!=null},get fallback(){return c(it,ie({as:"div"},()=>i.dataset(),w,u))},get children(){return c(Ni.Positioner,{get children(){return c(gc,ie({get disableOutsidePointerEvents(){return Te(()=>!!f())()&&i.isOpen()},get excludedElements(){return[i.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return vr({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:g,onFocusOutside:y,get onDismiss(){return i.close}},()=>i.dataset(),w,u))}})}})}})}function G$(e){let t;const r=ar(),i=xr(),[n,o]=$e(e,["ref"]);return fc({element:()=>t??null,enabled:()=>i.contentPresent()&&r.preventScroll()}),c(fp,ie({ref(s){var a=xt(l=>{t=l},n.ref);typeof a=="function"&&a(s)}},o))}var mp=Rt();function W$(){const e=jt(mp);if(e===void 0)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}function zc(e){const t=ar(),r=Ge({id:t.generateId(`group-${nn()}`)},e),[i,n]=ze(),o={generateId:Nn(()=>r.id),registerLabelId:tn(n)};return c(mp.Provider,{value:o,get children(){return c(it,ie({as:"div",role:"group",get"aria-labelledby"(){return i()}},r))}})}function gp(e){const t=W$(),r=Ge({id:t.generateId("label")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerLabelId(i.id))),c(it,ie({as:"span",get id(){return i.id},"aria-hidden":"true"},n))}function hp(e){const t=xr(),r=Ge({children:"▼"},e);return c(it,ie({as:"span","aria-hidden":"true"},()=>t.dataset(),r))}function pp(e){return c(Mc,ie({role:"menuitem",closeOnSelect:!0},e))}function vp(e){const t=Ec(),r=Ge({id:t.generateId("description")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerDescription(i.id))),c(it,ie({as:"div",get id(){return i.id}},()=>t.dataset(),n))}function bp(e){const t=Ec(),r=Ge({id:t.generateId("indicator")},e),[i,n]=$e(r,["forceMount"]);return c(F,{get when(){return i.forceMount||t.isChecked()},get children(){return c(it,ie({as:"div"},()=>t.dataset(),n))}})}function yp(e){const t=Ec(),r=Ge({id:t.generateId("label")},e),[i,n]=$e(r,["ref","id"]);return ne(()=>je(t.registerLabel(i.id))),c(it,ie({as:"div",ref(o){var s=xt(t.setLabelRef,i.ref);typeof s=="function"&&s(o)},get id(){return i.id}},()=>t.dataset(),n))}function wp(e){const t=xr();return c(F,{get when(){return t.contentPresent()},get children(){return c(hr,e)}})}var xp=Rt();function X$(){const e=jt(xp);if(e===void 0)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}function _p(e){const r=ar().generateId(`radiogroup-${nn()}`),i=Ge({id:r},e),[n,o]=$e(i,["value","defaultValue","onChange","disabled"]),[s,a]=ea({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:u=>n.onChange?.(u)}),l={isDisabled:()=>n.disabled,isSelectedValue:u=>u===s(),setSelectedValue:u=>a(u)};return c(xp.Provider,{value:l,get children(){return c(zc,o)}})}function $p(e){const t=X$(),r=Ge({closeOnSelect:!1},e),[i,n]=$e(r,["value","onSelect"]);return c(Mc,ie({role:"menuitemradio",get checked(){return t.isSelectedValue(i.value)},onSelect:()=>{i.onSelect?.(),t.setSelectedValue(i.value)}},n))}function Y$(e,t,r){const i=e.split("-")[0],n=r.getBoundingClientRect(),o=[],s=t.clientX,a=t.clientY;switch(i){case"top":o.push([s,a+5]),o.push([n.left,n.bottom]),o.push([n.left,n.top]),o.push([n.right,n.top]),o.push([n.right,n.bottom]);break;case"right":o.push([s-5,a]),o.push([n.left,n.top]),o.push([n.right,n.top]),o.push([n.right,n.bottom]),o.push([n.left,n.bottom]);break;case"bottom":o.push([s,a-5]),o.push([n.right,n.top]),o.push([n.right,n.bottom]),o.push([n.left,n.bottom]),o.push([n.left,n.top]);break;case"left":o.push([s+5,a]),o.push([n.right,n.bottom]),o.push([n.left,n.bottom]),o.push([n.left,n.top]),o.push([n.right,n.top]);break}return o}function J$(e,t){return t?Hx([e.clientX,e.clientY],t):!1}function Sp(e){const t=ar(),r=qh(),i=ap(),n=ma(),o=op(),s=Ge({placement:t.orientation()==="horizontal"?"bottom-start":"right-start"},e),[a,l]=$e(s,["open","defaultOpen","onOpenChange"]);let u=0,d=null,f="right";const[m,h]=ze(),[g,y]=ze(),[b,v]=ze(),[w,x]=ze(),[_,k]=ze(!0),[C,O]=ze(l.placement),[z,K]=ze([]),[J,T]=ze([]),{DomCollectionProvider:M}=Pc({items:J,onItemsChange:T}),U=jo({open:()=>a.open,defaultOpen:()=>a.defaultOpen,onOpenChange:Z=>a.onOpenChange?.(Z)}),{present:A}=li({show:()=>t.forceMount()||U.isOpen(),element:()=>w()??null}),j=Bo({selectionMode:"none",dataSource:J}),P=Z=>{k(Z),U.open()},B=(Z=!1)=>{U.close(),Z&&i&&i.close(!0)},R=Z=>{k(Z),U.toggle()},V=()=>{const Z=w();Z&&(vn(Z),j.selectionManager().setFocused(!0),j.selectionManager().setFocusedKey(void 0))},Q=()=>{o!=null?setTimeout(()=>V()):V()},ee=Z=>{K(re=>[...re,Z]);const se=i?.registerNestedMenu(Z);return()=>{K(re=>Zx(re,Z)),se?.()}},oe=Z=>f===d?.side&&J$(Z,d?.area),le=Z=>{oe(Z)&&Z.preventDefault()},W=Z=>{oe(Z)||Q()},D=Z=>{oe(Z)&&Z.preventDefault()};dc({isDisabled:()=>!(i==null&&U.isOpen()&&t.isModal()),targets:()=>[w(),...z()].filter(Boolean)}),ne(()=>{const Z=w();if(!Z||!i)return;const se=i.registerNestedMenu(Z);je(()=>{se()})}),ne(()=>{i===void 0&&n?.registerMenu(t.value(),[w(),...z()])}),ne(()=>{i!==void 0||n===void 0||(n.value()===t.value()?(b()?.focus(),n.autoFocusMenu()&&P(!0)):B())}),ne(()=>{i!==void 0||n===void 0||U.isOpen()&&n.setValue(t.value())}),je(()=>{i===void 0&&n?.unregisterMenu(t.value())});const H={dataset:$(()=>({"data-expanded":U.isOpen()?"":void 0,"data-closed":U.isOpen()?void 0:""})),isOpen:U.isOpen,contentPresent:A,nestedMenus:z,currentPlacement:C,pointerGraceTimeoutId:()=>u,autoFocus:_,listState:()=>j,parentMenuContext:()=>i,triggerRef:b,contentRef:w,triggerId:m,contentId:g,setTriggerRef:v,setContentRef:x,open:P,close:B,toggle:R,focusContent:Q,onItemEnter:le,onItemLeave:W,onTriggerLeave:D,setPointerDir:Z=>f=Z,setPointerGraceTimeoutId:Z=>u=Z,setPointerGraceIntent:Z=>d=Z,registerNestedMenu:ee,registerItemToParentDomCollection:r?.registerItem,registerTriggerId:tn(h),registerContentId:tn(y)};return c(M,{get children(){return c(sp.Provider,{value:H,get children(){return c(F,{when:o===void 0,get fallback(){return l.children},get children(){return c(Ni,ie({anchorRef:b,contentRef:w,onCurrentPlacementChange:O},l))}})}})}})}function kp(e){const{direction:t}=Nr();return c(Sp,ie({get placement(){return t()==="rtl"?"left-start":"right-start"},flip:!0},e))}var Q$={close:(e,t)=>e==="ltr"?[t==="horizontal"?"ArrowLeft":"ArrowUp"]:[t==="horizontal"?"ArrowRight":"ArrowDown"]};function Cp(e){const t=xr(),r=ar(),[i,n]=$e(e,["onFocusOutside","onKeyDown"]),{direction:o}=Nr();return c(fp,ie({onOpenAutoFocus:d=>{d.preventDefault()},onCloseAutoFocus:d=>{d.preventDefault()},onFocusOutside:d=>{i.onFocusOutside?.(d);const f=d.target;Do(t.triggerRef(),f)||t.close()},onKeyDown:d=>{Qe(d,i.onKeyDown);const f=Do(d.currentTarget,d.target),m=Q$.close(o(),r.orientation()).includes(d.key),h=t.parentMenuContext()!=null;f&&m&&h&&(t.close(),vn(t.triggerRef()))}},n))}var Df=["Enter"," "],eS={open:(e,t)=>e==="ltr"?[...Df,t==="horizontal"?"ArrowRight":"ArrowDown"]:[...Df,t==="horizontal"?"ArrowLeft":"ArrowUp"]};function Ip(e){let t;const r=ar(),i=xr(),n=Ge({id:r.generateId(`sub-trigger-${nn()}`)},e),[o,s]=$e(n,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let a=null;const l=()=>{a&&window.clearTimeout(a),a=null},{direction:u}=Nr(),d=()=>o.id,f=()=>{const x=i.parentMenuContext();if(x==null)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return x.listState().selectionManager()},m=()=>i.listState().collection(),h=()=>f().focusedKey()===d(),g=Vo({key:d,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>o.disabled},()=>t),y=x=>{Qe(x,o.onClick),!i.isOpen()&&!o.disabled&&i.open(!0)},b=x=>{if(Qe(x,o.onPointerMove),x.pointerType!=="mouse")return;const _=i.parentMenuContext();if(_?.onItemEnter(x),!x.defaultPrevented){if(o.disabled){_?.onItemLeave(x);return}!i.isOpen()&&!a&&(i.parentMenuContext()?.setPointerGraceIntent(null),a=window.setTimeout(()=>{i.open(!1),l()},100)),_?.onItemEnter(x),x.defaultPrevented||(i.listState().selectionManager().isFocused()&&(i.listState().selectionManager().setFocused(!1),i.listState().selectionManager().setFocusedKey(void 0)),vn(x.currentTarget),_?.listState().selectionManager().setFocused(!0),_?.listState().selectionManager().setFocusedKey(d()))}},v=x=>{if(Qe(x,o.onPointerLeave),x.pointerType!=="mouse")return;l();const _=i.parentMenuContext(),k=i.contentRef();if(k){_?.setPointerGraceIntent({area:Y$(i.currentPlacement(),x,k),side:i.currentPlacement().split("-")[0]}),window.clearTimeout(_?.pointerGraceTimeoutId());const C=window.setTimeout(()=>{_?.setPointerGraceIntent(null)},300);_?.setPointerGraceTimeoutId(C)}else{if(_?.onTriggerLeave(x),x.defaultPrevented)return;_?.setPointerGraceIntent(null)}_?.onItemLeave(x)},w=x=>{Qe(x,o.onKeyDown),!x.repeat&&(o.disabled||eS.open(u(),r.orientation()).includes(x.key)&&(x.stopPropagation(),x.preventDefault(),f().setFocused(!1),f().setFocusedKey(void 0),i.isOpen()||i.open("first"),i.focusContent(),i.listState().selectionManager().setFocused(!0),i.listState().selectionManager().setFocusedKey(m().getFirstKey())))};return ne(()=>{if(i.registerItemToParentDomCollection==null)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");const x=i.registerItemToParentDomCollection({ref:()=>t,type:"item",key:d(),textValue:o.textValue??t?.textContent??"",disabled:o.disabled??!1});je(x)}),ne(qe(()=>i.parentMenuContext()?.pointerGraceTimeoutId(),x=>{je(()=>{window.clearTimeout(x),i.parentMenuContext()?.setPointerGraceIntent(null)})})),ne(()=>je(i.registerTriggerId(o.id))),je(()=>{l()}),c(it,ie({as:"div",ref(x){var _=xt(k=>{i.setTriggerRef(k),t=k},o.ref);typeof _=="function"&&_(x)},get id(){return o.id},role:"menuitem",get tabIndex(){return g.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return i.isOpen()},get"aria-controls"(){return Te(()=>!!i.isOpen())()?i.contentId():void 0},get"aria-disabled"(){return o.disabled},get"data-key"(){return g.dataKey()},get"data-highlighted"(){return h()?"":void 0},get"data-disabled"(){return o.disabled?"":void 0},get onPointerDown(){return et([o.onPointerDown,g.onPointerDown])},get onPointerUp(){return et([o.onPointerUp,g.onPointerUp])},get onClick(){return et([y,g.onClick])},get onKeyDown(){return et([w,g.onKeyDown])},get onMouseDown(){return et([o.onMouseDown,g.onMouseDown])},get onFocus(){return et([o.onFocus,g.onFocus])},onPointerMove:b,onPointerLeave:v},()=>i.dataset(),s))}function tS(e){const t=ma(),r=`menu-${nn()}`,i=Ge({id:r,modal:!0},e),[n,o]=$e(i,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),s=jo({open:()=>n.open,defaultOpen:()=>n.defaultOpen,onOpenChange:l=>n.onOpenChange?.(l)}),a={isModal:()=>n.modal??!0,preventScroll:()=>n.preventScroll??a.isModal(),forceMount:()=>n.forceMount??!1,generateId:Nn(()=>n.id),value:()=>n.value,orientation:()=>n.orientation??t?.orientation()??"horizontal"};return c(cp.Provider,{value:a,get children(){return c(Sp,ie({get open(){return s.isOpen()},get onOpenChange(){return s.setIsOpen}},o))}})}var nS={};ir(nS,{Root:()=>ga,Separator:()=>rS});function ga(e){let t;const r=Ge({orientation:"horizontal"},e),[i,n]=$e(r,["ref","orientation"]),o=th(()=>t,()=>"hr");return c(it,ie({as:"hr",ref(s){var a=xt(l=>t=l,i.ref);typeof a=="function"&&a(s)},get role(){return o()!=="hr"?"separator":void 0},get"aria-orientation"(){return i.orientation==="vertical"?"vertical":void 0},get"data-orientation"(){return i.orientation}},n))}var rS=ga,iS={};ir(iS,{Arrow:()=>Fi,CheckboxItem:()=>up,Content:()=>Tp,DropdownMenu:()=>Wt,Group:()=>zc,GroupLabel:()=>gp,Icon:()=>hp,Item:()=>pp,ItemDescription:()=>vp,ItemIndicator:()=>bp,ItemLabel:()=>yp,Portal:()=>wp,RadioGroup:()=>_p,RadioItem:()=>$p,Root:()=>Dp,Separator:()=>ga,Sub:()=>kp,SubContent:()=>Cp,SubTrigger:()=>Ip,Trigger:()=>dp});function Tp(e){const t=ar(),r=xr(),[i,n]=$e(e,["onCloseAutoFocus","onInteractOutside"]);let o=!1;return c(G$,ie({onCloseAutoFocus:l=>{i.onCloseAutoFocus?.(l),o||vn(r.triggerRef()),o=!1,l.preventDefault()},onInteractOutside:l=>{i.onInteractOutside?.(l),(!t.isModal()||l.detail.isContextMenu)&&(o=!0)}},n))}function Dp(e){const t=`dropdownmenu-${nn()}`,r=Ge({id:t},e);return c(tS,r)}var Wt=Object.assign(Dp,{Arrow:Fi,CheckboxItem:up,Content:Tp,Group:zc,GroupLabel:gp,Icon:hp,Item:pp,ItemDescription:vp,ItemIndicator:bp,ItemLabel:yp,Portal:wp,RadioGroup:_p,RadioItem:$p,Separator:ga,Sub:kp,SubContent:Cp,SubTrigger:Ip,Trigger:dp});function oS(e){return c(Wt,ie(e,{"data-component":"dropdown-menu"}))}function sS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Trigger,ie(r,{"data-slot":"dropdown-menu-trigger",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function aS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Icon,ie(r,{"data-slot":"dropdown-menu-icon",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function lS(e){return c(Wt.Portal,e)}function cS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Content,ie(r,{"data-component":"dropdown-menu-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function uS(e){const[t,r]=$e(e,["class","classList"]);return c(Wt.Arrow,ie(r,{"data-slot":"dropdown-menu-arrow",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function dS(e){const[t,r]=$e(e,["class","classList"]);return c(Wt.Separator,ie(r,{"data-slot":"dropdown-menu-separator",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function fS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Group,ie(r,{"data-slot":"dropdown-menu-group",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function mS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.GroupLabel,ie(r,{"data-slot":"dropdown-menu-group-label",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function gS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.Item,ie(r,{"data-slot":"dropdown-menu-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function hS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.ItemLabel,ie(r,{"data-slot":"dropdown-menu-item-label",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function pS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.ItemDescription,ie(r,{"data-slot":"dropdown-menu-item-description",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function vS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.ItemIndicator,ie(r,{"data-slot":"dropdown-menu-item-indicator",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function bS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.RadioGroup,ie(r,{"data-slot":"dropdown-menu-radio-group",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function yS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.RadioItem,ie(r,{"data-slot":"dropdown-menu-radio-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function wS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.CheckboxItem,ie(r,{"data-slot":"dropdown-menu-checkbox-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function xS(e){return c(Wt.Sub,e)}function _S(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.SubTrigger,ie(r,{"data-slot":"dropdown-menu-sub-trigger",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function $S(e){const[t,r]=$e(e,["class","classList","children"]);return c(Wt.SubContent,ie(r,{"data-component":"dropdown-menu-sub-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}const ct=Object.assign(oS,{Trigger:sS,Icon:aS,Portal:lS,Content:cS,Arrow:uS,Separator:dS,Group:fS,GroupLabel:mS,Item:gS,ItemLabel:hS,ItemDescription:pS,ItemIndicator:vS,RadioGroup:bS,RadioItem:yS,CheckboxItem:wS,Sub:xS,SubTrigger:_S,SubContent:$S});var SS=I("<svg>"),kS=I("<svg><rect width=3 height=3 rx=1></svg>",!1,!0,!1);const CS=new Set([1,2,4,7,8,11,13,14]),IS=new Set([0,3,12,15]),TS=Array.from({length:16},(e,t)=>({id:t,x:t%4*4,y:Math.floor(t/4)*4,delay:Math.random()*1.5,duration:1+Math.random()*1,outer:CS.has(t),corner:IS.has(t)}));function Ap(e){return(()=>{var t=SS();return dn(t,ie(e,{viewBox:"0 0 15 15","data-component":"spinner",get classList(){return{...e.classList??{},[e.class??""]:!!e.class}},fill:"currentColor"}),!0,!0),p(t,c(rt,{each:TS,children:r=>(()=>{var i=kS();return Ae(n=>{var o=r.x,s=r.y,a=r.corner?0:void 0,l=r.corner?void 0:`${r.outer?"pulse-opacity-dim":"pulse-opacity"} ${r.duration}s ease-in-out infinite`,u=r.corner?void 0:"both",d=r.corner?void 0:`${r.delay}s`;return o!==n.e&&Ie(i,"x",n.e=o),s!==n.t&&Ie(i,"y",n.t=s),a!==n.a&&ft(i,"opacity",n.a=a),l!==n.o&&ft(i,"animation",n.o=l),u!==n.i&&ft(i,"animation-fill-mode",n.i=u),d!==n.n&&ft(i,"animation-delay",n.n=d),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),i})()})),t})()}const DS=[],qo=e=>{const t=e.review??(()=>!1),r=e.hasReview??(()=>!1),i=$(()=>e.tabs().active()==="context"||e.tabs().all().includes("context")),n=$(()=>{const l=new Set;return e.tabs().all().flatMap(u=>{if(u==="context"||u==="review")return[];const d=e.pathFromTab(u)?e.normalizeTab(u):u;return l.has(d)?[]:(l.add(d),[d])})},DS,{equals:Pr}),o=$(()=>{const l=e.tabs().active();if(l==="context"||l==="review"&&t())return l;if(l&&e.pathFromTab(l))return e.normalizeTab(l);const u=n()[0];return u||(i()?"context":t()&&r()?"review":"empty")}),s=$(()=>{const l=o();if(n().includes(l))return l}),a=$(()=>{const l=o();if(l==="context")return l;if(n().includes(l))return l});return{contextOpen:i,openedTabs:n,activeTab:o,activeFileTab:s,closableTab:a}},Jr=e=>{const r=document.getElementById(`terminal-wrapper-${e}`)?.querySelector('[data-component="terminal"]');if(!(r instanceof HTMLElement))return!1;const i=r.querySelector("textarea");return i instanceof HTMLTextAreaElement?(i.focus(),!0):(r.focus(),r.dispatchEvent(typeof PointerEvent=="function"?new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0}):new MouseEvent("pointerdown",{bubbles:!0,cancelable:!0})),!0)},AS=new Set(["Alt","Control","Meta","Shift"]),PS=e=>AS.has(e.key)?!1:!(e.ctrlKey||e.metaKey||e.altKey),OS=e=>t=>{$n(()=>{e.showAllFiles();const r=e.loadFile(t),i=()=>{const n=e.tabForPath(t);e.openTab(n),e.setActive(n)};r instanceof Promise?r.then(i):i()})},ES=e=>t=>{const r=e.normalizeTab(t);e.openTab(r);const i=e.pathFromTab(r);i&&(e.loadFile(i),e.openReviewPanel(),e.setActive(r))},MS=(e,t,r)=>{const i=e.indexOf(t),n=e.indexOf(r);if(!(i===-1||n===-1||i===n))return n},Pp=()=>{const[e,t]=We({active:!1});let r;const i=()=>{r!==void 0&&(clearTimeout(r),r=void 0),t("active",!1)},n=()=>{r!==void 0&&(clearTimeout(r),r=void 0),t("active",!0)};return Vt(()=>{ln(window,"pointerup",i),ln(window,"pointercancel",i),ln(window,"blur",i)}),je(()=>{r!==void 0&&clearTimeout(r)}),{active:()=>e.active,start:n,touch(){n(),r=window.setTimeout(i,120)}}},Lc=()=>{const e=yc(),t=$(()=>`${e.dir}${e.id?"/"+e.id:""}`);return{params:e,sessionKey:t}},_r=()=>{const e=or(),{params:t,sessionKey:r}=Lc();return{params:t,sessionKey:r,tabs:$(()=>e.tabs(r)),view:$(()=>e.view(r))}};var Af=I('<div class="flex size-5 shrink-0 items-center justify-center [&amp;_[data-component=app-icon]]:size-5">'),zS=I('<div class="hidden xl:flex items-center"><div class="flex items-center"><div class="flex h-[24px] box-border items-center rounded-md border border-border-weak-base bg-surface-panel overflow-hidden">'),LS=I('<div class="relative flex items-center justify-center size-4">'),FS=I('<div class="flex items-center gap-2"><div class="flex items-center gap-1"><div class="hidden md:flex items-center gap-1 shrink-0">');const NS=["vscode","cursor","zed","textmate","antigravity","finder","terminal","iterm2","ghostty","warp","xcode","android-studio","powershell","sublime-text"],RS=[{id:"vscode",label:"session.header.open.app.vscode",icon:"vscode",openWith:"Visual Studio Code"},{id:"cursor",label:"session.header.open.app.cursor",icon:"cursor",openWith:"Cursor"},{id:"zed",label:"session.header.open.app.zed",icon:"zed",openWith:"Zed"},{id:"textmate",label:"session.header.open.app.textmate",icon:"textmate",openWith:"TextMate"},{id:"antigravity",label:"session.header.open.app.antigravity",icon:"antigravity",openWith:"Antigravity"},{id:"terminal",label:"session.header.open.app.terminal",icon:"terminal",openWith:"Terminal"},{id:"iterm2",label:"session.header.open.app.iterm2",icon:"iterm2",openWith:"iTerm"},{id:"ghostty",label:"session.header.open.app.ghostty",icon:"ghostty",openWith:"Ghostty"},{id:"warp",label:"session.header.open.app.warp",icon:"warp",openWith:"Warp"},{id:"xcode",label:"session.header.open.app.xcode",icon:"xcode",openWith:"Xcode"},{id:"android-studio",label:"session.header.open.app.androidStudio",icon:"android-studio",openWith:"Android Studio"},{id:"sublime-text",label:"session.header.open.app.sublimeText",icon:"sublime-text",openWith:"Sublime Text"}],jS=[{id:"vscode",label:"session.header.open.app.vscode",icon:"vscode",openWith:"code"},{id:"cursor",label:"session.header.open.app.cursor",icon:"cursor",openWith:"cursor"},{id:"zed",label:"session.header.open.app.zed",icon:"zed",openWith:"zed"},{id:"powershell",label:"session.header.open.app.powershell",icon:"powershell",openWith:"powershell"},{id:"sublime-text",label:"session.header.open.app.sublimeText",icon:"sublime-text",openWith:"Sublime Text"}],US=[{id:"vscode",label:"session.header.open.app.vscode",icon:"vscode",openWith:"code"},{id:"cursor",label:"session.header.open.app.cursor",icon:"cursor",openWith:"cursor"},{id:"zed",label:"session.header.open.app.zed",icon:"zed",openWith:"zed"},{id:"sublime-text",label:"session.header.open.app.sublimeText",icon:"sublime-text",openWith:"Sublime Text"}],KS=e=>{if(e.platform==="desktop"&&e.os)return e.os;if(typeof navigator!="object")return"unknown";const t=navigator.platform||navigator.userAgent;return/Mac/i.test(t)?"macos":/Win/i.test(t)?"windows":/Linux/i.test(t)?"linux":"unknown"},VS=(e,t)=>{Nt({variant:"error",title:e.t("common.requestFailed"),description:t instanceof Error?t.message:String(t)})};function BS(){const e=or(),t=wc(),r=nh(),i=rh(),n=Rn(),o=na(),s=_t(),a=sr(),l=Ko(),{params:u,view:d}=_r(),f=$(()=>qx(u.dir)??""),m=$(()=>KS(o)),[h,g]=We({finder:!0}),y=$(()=>m()==="macos"?RS:m()==="windows"?jS:US),b=$(()=>m()==="macos"?{label:"session.header.open.finder",icon:"finder"}:m()==="windows"?{label:"session.header.open.fileExplorer",icon:"file-explorer"}:{label:"session.header.open.fileManager",icon:"finder"});ne(()=>{if(o.platform!=="desktop"||!o.checkAppExists)return;const B=y();g(Object.fromEntries(B.map(R=>[R.id,void 0]))),Promise.all(B.map(R=>Promise.resolve(o.checkAppExists?.(R.openWith)).then(V=>!!V).catch(()=>!1).then(V=>[R.id,V]))).then(R=>{g(Object.fromEntries(R))})});const v=$(()=>[{id:"finder",label:s.t(b().label),icon:b().icon},...y().filter(B=>h[B.id]).map(B=>({...B,label:s.t(B.label)}))]),w=()=>{const B=!d().terminal.opened();if(d().terminal.toggle(),!B)return;const R=l.active();R&&Jr(R)},[x,_]=Os(Es.global("open.app"),We({app:"finder"})),[k,C]=We({open:!1}),[O,z]=We({app:void 0}),K=$(()=>o.platform==="desktop"&&!!o.openPath&&i.isLocal()),J=$(()=>v().find(B=>B.id===x.app)??v()[0]??{id:"finder",label:b().label,icon:b().icon}),T=$(()=>O.app!==void 0),M=$(()=>Gx(u.id?a.data.message[u.id]:void 0,a.data.agent)),U=$(()=>r.colorScheme()==="dark"?"moon":"sun"),A=B=>{v().some(R=>R.id===B)&&_("app",B)},j=B=>{if(T()||!K()||!o.openPath)return;const R=f();if(!R)return;const V=v().find(ee=>ee.id===B),Q=V&&"openWith"in V?V.openWith:void 0;z("app",B),o.openPath(R,Q).catch(ee=>VS(s,ee)).finally(()=>{z("app",void 0)})},P=$(()=>document.getElementById(So.right));return c(F,{get when(){return P()},children:B=>c(hr,{get mount(){return B()},get children(){var R=FS(),V=R.firstChild,Q=V.firstChild;return p(R,c(F,{get when(){return Te(()=>!!f())()&&K()},get children(){var ee=zS(),oe=ee.firstChild,le=oe.firstChild;return p(le,c(vt,{variant:"ghost",class:"rounded-none h-full px-0.5 border-none shadow-none disabled:!cursor-default",get classList(){return{"bg-surface-raised-base-active":T()}},onClick:()=>j(J().id),get disabled(){return T()},get"aria-label"(){return s.t("session.header.open.ariaLabel",{app:J().label})},get children(){var W=Af();return p(W,c(F,{get when(){return T()},get fallback(){return c(If,{get id(){return J().icon}})},get children(){return c(Ap,{class:"size-3.5",get style(){return{color:M()??"var(--icon-base)"}}})}})),W}}),null),p(le,c(ct,{gutter:4,placement:"bottom-end",get open(){return k.open},onOpenChange:W=>C("open",W),get children(){return[c(ct.Trigger,{as:Pt,icon:"chevron-down",variant:"ghost",get disabled(){return T()},class:"rounded-none h-full w-[20px] p-0 border-none shadow-none data-[expanded]:bg-surface-raised-base-active disabled:!cursor-default",get classList(){return{"bg-surface-raised-base-active":T()}},get"aria-label"(){return s.t("session.header.open.menu")}}),c(ct.Portal,{get children(){return c(ct.Content,{class:"[&_[data-slot=dropdown-menu-item]]:pl-1 [&_[data-slot=dropdown-menu-radio-item]]:pl-1 [&_[data-slot=dropdown-menu-radio-item]+[data-slot=dropdown-menu-radio-item]]:mt-1",get children(){return c(ct.Group,{get children(){return[c(ct.GroupLabel,{class:"!px-1 !py-1",get children(){return s.t("session.header.openIn")}}),c(ct.RadioGroup,{class:"mt-1",get value(){return J().id},onChange:W=>{NS.includes(W)&&A(W)},get children(){return c(rt,{get each(){return v()},children:W=>c(ct.RadioItem,{get value(){return W.id},get disabled(){return T()},onSelect:()=>{C("open",!1),j(W.id)},get children(){return[(()=>{var D=Af();return p(D,c(If,{get id(){return W.icon}})),D})(),c(ct.ItemLabel,{get children(){return W.label}}),c(ct.ItemIndicator,{get children(){return c(bt,{name:"check-small",size:"small",class:"text-icon-weak"})}})]}})})}})]}})}})}})]}}),null),ee}}),V),p(V,c(F,{get when(){return n.capabilities.terminal!==!1},get children(){return c(Et,{placement:"bottom",get value(){return s.t("command.terminal.toggle")},get children(){return c(vt,{variant:"ghost",class:"group/terminal-toggle titlebar-icon w-8 h-6 p-0 box-border shrink-0",onClick:w,get"aria-label"(){return s.t("command.terminal.toggle")},get"aria-expanded"(){return d().terminal.opened()},"aria-controls":"terminal-panel",get children(){return c(bt,{size:"small",get name(){return d().terminal.opened()?"terminal-active":"terminal"}})}})}})}}),Q),p(Q,c(Et,{placement:"bottom",get value(){return s.t("command.review.toggle")},get children(){return c(vt,{variant:"ghost",class:"group/review-toggle titlebar-icon w-8 h-6 p-0 box-border",onClick:()=>d().reviewPanel.toggle(),get"aria-label"(){return s.t("command.review.toggle")},get"aria-expanded"(){return d().reviewPanel.opened()},"aria-controls":"review-panel",get children(){return c(bt,{size:"small",get name(){return d().reviewPanel.opened()?"review-active":"review"}})}})}}),null),p(Q,c(Et,{placement:"bottom",get value(){return s.t("command.fileTree.toggle")},get children(){return c(vt,{variant:"ghost",class:"titlebar-icon w-8 h-6 p-0 box-border",onClick:()=>e.fileTree.toggle(),get"aria-label"(){return s.t("command.fileTree.toggle")},get"aria-expanded"(){return e.fileTree.opened()},"aria-controls":"file-tree-panel",get children(){var ee=LS();return p(ee,c(bt,{size:"small",get name(){return e.fileTree.opened()?"file-tree-active":"file-tree"},get classList(){return{"text-icon-strong":e.fileTree.opened(),"text-icon-weak":!e.fileTree.opened()}}})),ee}})}}),null),p(V,c(Et,{placement:"bottom",get value(){return s.t("sidebar.mode")},get children(){return c(vt,{variant:"ghost",class:"titlebar-icon w-8 h-6 p-0 box-border",onClick:()=>t.trigger("theme.scheme.cycle"),get"aria-label"(){return s.t("sidebar.mode")},get children(){return c(bt,{size:"small",get name(){return U()}})}})}}),null),R}})})}function bo(e,t){for(let r=e.length-1;r>=0;r-=1){const i=e[r];if(t(i,r,e))return i}}var ZS={};ir(ZS,{Collapsible:()=>ha,Content:()=>Fc,Root:()=>Nc,Trigger:()=>Rc,useCollapsibleContext:()=>Go});var Op=Rt();function Go(){const e=jt(Op);if(e===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return e}function Fc(e){const[t,r]=ze(),i=Go(),n=Ge({id:i.generateId("content")},e),[o,s]=$e(n,["ref","id","style"]),{present:a}=li({show:i.shouldMount,element:()=>t()??null}),[l,u]=ze(0),[d,f]=ze(0);let h=i.isOpen()||a();return Vt(()=>{const g=requestAnimationFrame(()=>{h=!1});je(()=>{cancelAnimationFrame(g)})}),ne(qe(a,()=>{if(!t())return;t().style.transitionDuration="0s",t().style.animationName="none";const g=t().getBoundingClientRect();u(g.height),f(g.width),h||(t().style.transitionDuration="",t().style.animationName="")})),ne(qe(i.isOpen,g=>{!g&&t()&&(t().style.transitionDuration="",t().style.animationName="")},{defer:!0})),ne(()=>je(i.registerContentId(o.id))),c(F,{get when(){return a()},get children(){return c(it,ie({as:"div",ref(g){var y=xt(r,o.ref);typeof y=="function"&&y(g)},get id(){return o.id},get style(){return vr({"--kb-collapsible-content-height":l()?`${l()}px`:void 0,"--kb-collapsible-content-width":d()?`${d()}px`:void 0},o.style)}},()=>i.dataset(),s))}})}function Nc(e){const t=`collapsible-${nn()}`,r=Ge({id:t},e),[i,n]=$e(r,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[o,s]=ze(),a=jo({open:()=>i.open,defaultOpen:()=>i.defaultOpen,onOpenChange:d=>i.onOpenChange?.(d)}),l=$(()=>({"data-expanded":a.isOpen()?"":void 0,"data-closed":a.isOpen()?void 0:"","data-disabled":i.disabled?"":void 0})),u={dataset:l,isOpen:a.isOpen,disabled:()=>i.disabled??!1,shouldMount:()=>i.forceMount||a.isOpen(),contentId:o,toggle:a.toggle,generateId:Nn(()=>n.id),registerContentId:tn(s)};return c(Op.Provider,{value:u,get children(){return c(it,ie({as:"div"},l,n))}})}function Rc(e){const t=Go(),[r,i]=$e(e,["onClick"]);return c(Ro,ie({get"aria-expanded"(){return t.isOpen()},get"aria-controls"(){return Te(()=>!!t.isOpen())()?t.contentId():void 0},get disabled(){return t.disabled()},onClick:o=>{Qe(o,r.onClick),t.toggle()}},()=>t.dataset(),i))}var ha=Object.assign(Nc,{Content:Fc,Trigger:Rc}),HS={};ir(HS,{Accordion:()=>Vi,Content:()=>zp,Header:()=>Lp,Item:()=>Np,Root:()=>Rp,Trigger:()=>jp,useAccordionContext:()=>jc});var Ep=Rt();function Mp(){const e=jt(Ep);if(e===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return e}function zp(e){const t=Mp(),r=t.generateId("content"),i=Ge({id:r},e),[n,o]=$e(i,["id","style"]);return ne(()=>je(t.registerContentId(n.id))),c(Fc,ie({role:"region",get"aria-labelledby"(){return t.triggerId()},get style(){return vr({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},n.style)}},o))}function Lp(e){const t=Go();return c(it,ie({as:"h3"},()=>t.dataset(),e))}var Fp=Rt();function jc(){const e=jt(Fp);if(e===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return e}function Np(e){const t=jc(),r=`${t.generateId("item")}-${nn()}`,i=Ge({id:r},e),[n,o]=$e(i,["value","disabled"]),[s,a]=ze(),[l,u]=ze(),d=()=>t.listState().selectionManager(),f=()=>d().isSelected(n.value),m={value:()=>n.value,triggerId:s,contentId:l,generateId:Nn(()=>o.id),registerTriggerId:tn(a),registerContentId:tn(u)};return c(Ep.Provider,{value:m,get children(){return c(Nc,ie({get open(){return f()},get disabled(){return n.disabled}},o))}})}function Rp(e){let t;const r=`accordion-${nn()}`,i=Ge({id:r,multiple:!1,collapsible:!1,shouldFocusWrap:!0},e),[n,o]=$e(i,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[s,a]=ze([]),{DomCollectionProvider:l}=Pc({items:s,onItemsChange:a}),u=Bo({selectedKeys:()=>n.value,defaultSelectedKeys:()=>n.defaultValue,onSelectionChange:m=>n.onChange?.(Array.from(m)),disallowEmptySelection:()=>!n.multiple&&!n.collapsible,selectionMode:()=>n.multiple?"multiple":"single",dataSource:s});u.selectionManager().setFocusedKey("item-1");const d=Tc({selectionManager:()=>u.selectionManager(),collection:()=>u.collection(),disallowEmptySelection:()=>u.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>n.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>t),f={listState:()=>u,generateId:Nn(()=>n.id)};return c(l,{get children(){return c(Fp.Provider,{value:f,get children(){return c(it,ie({as:"div",get id(){return n.id},ref(m){var h=xt(g=>t=g,n.ref);typeof h=="function"&&h(m)},get onKeyDown(){return et([n.onKeyDown,d.onKeyDown])},get onMouseDown(){return et([n.onMouseDown,d.onMouseDown])},get onFocusIn(){return et([n.onFocusIn])},get onFocusOut(){return et([n.onFocusOut,d.onFocusOut])}},o))}})}})}function jp(e){let t;const r=jc(),i=Mp(),n=Go(),o=i.generateId("trigger"),s=Ge({id:o},e),[a,l]=$e(s,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);Oc({getItem:()=>({ref:()=>t,type:"item",key:i.value(),textValue:"",disabled:n.disabled()})});const u=Vo({key:()=>i.value(),selectionManager:()=>r.listState().selectionManager(),disabled:()=>n.disabled(),shouldSelectOnPressUp:!0},()=>t),d=f=>{["Enter"," "].includes(f.key)&&f.preventDefault(),Qe(f,a.onKeyDown),Qe(f,u.onKeyDown)};return ne(()=>je(i.registerTriggerId(l.id))),c(Rc,ie({ref(f){var m=xt(h=>t=h,a.ref);typeof m=="function"&&m(f)},get"data-key"(){return u.dataKey()},get onPointerDown(){return et([a.onPointerDown,u.onPointerDown])},get onPointerUp(){return et([a.onPointerUp,u.onPointerUp])},get onClick(){return et([a.onClick,u.onClick])},onKeyDown:d,get onMouseDown(){return et([a.onMouseDown,u.onMouseDown])},get onFocus(){return et([a.onFocus,u.onFocus])}},l))}var Vi=Object.assign(Rp,{Content:zp,Header:Lp,Item:Np,Trigger:jp});function qS(e){const[t,r]=$e(e,["class","classList"]);return c(Vi,ie(r,{"data-component":"accordion",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function GS(e){const[t,r]=$e(e,["class","classList"]);return c(Vi.Item,ie(r,{"data-slot":"accordion-item",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}))}function WS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Vi.Header,ie(r,{"data-slot":"accordion-header",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function XS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Vi.Trigger,ie(r,{"data-slot":"accordion-trigger",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}function YS(e){const[t,r]=$e(e,["class","classList","children"]);return c(Vi.Content,ie(r,{"data-slot":"accordion-content",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get children(){return t.children}}))}const Kt=Object.assign(qS,{Item:GS,Header:WS,Trigger:XS,Content:YS});function Wo(e){return c(Kt.Header,{"data-component":"sticky-accordion-header",get classList(){return{...e.classList??{},[e.class??""]:!!e.class}},get children(){return e.children}})}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Up,setPrototypeOf:Pf,isFrozen:JS,getPrototypeOf:QS,getOwnPropertyDescriptor:ek}=Object;let{freeze:bn,seal:Fn,create:Cl}=Object,{apply:Il,construct:Tl}=typeof Reflect<"u"&&Reflect;bn||(bn=function(t){return t});Fn||(Fn=function(t){return t});Il||(Il=function(t,r){for(var i=arguments.length,n=new Array(i>2?i-2:0),o=2;o<i;o++)n[o-2]=arguments[o];return t.apply(r,n)});Tl||(Tl=function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return new t(...i)});const gs=yn(Array.prototype.forEach),tk=yn(Array.prototype.lastIndexOf),Of=yn(Array.prototype.pop),so=yn(Array.prototype.push),nk=yn(Array.prototype.splice),Ds=yn(String.prototype.toLowerCase),Ja=yn(String.prototype.toString),Qa=yn(String.prototype.match),ao=yn(String.prototype.replace),rk=yn(String.prototype.indexOf),ik=yn(String.prototype.trim),Vn=yn(Object.prototype.hasOwnProperty),mn=yn(RegExp.prototype.test),lo=ok(TypeError);function yn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return Il(e,t,i)}}function ok(e){return function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Tl(e,r)}}function mt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ds;Pf&&Pf(e,null);let i=t.length;for(;i--;){let n=t[i];if(typeof n=="string"){const o=r(n);o!==n&&(JS(t)||(t[i]=o),n=o)}e[n]=!0}return e}function sk(e){for(let t=0;t<e.length;t++)Vn(e,t)||(e[t]=null);return e}function tr(e){const t=Cl(null);for(const[r,i]of Up(e))Vn(e,r)&&(Array.isArray(i)?t[r]=sk(i):i&&typeof i=="object"&&i.constructor===Object?t[r]=tr(i):t[r]=i);return t}function co(e,t){for(;e!==null;){const i=ek(e,t);if(i){if(i.get)return yn(i.get);if(typeof i.value=="function")return yn(i.value)}e=QS(e)}function r(){return null}return r}const Ef=bn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),el=bn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),tl=bn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ak=bn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nl=bn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),lk=bn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Mf=bn(["#text"]),zf=bn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),rl=bn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Lf=bn(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),hs=bn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ck=Fn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),uk=Fn(/<%[\w\W]*|[\w\W]*%>/gm),dk=Fn(/\$\{[\w\W]*/gm),fk=Fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),mk=Fn(/^aria-[\-\w]+$/),Kp=Fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gk=Fn(/^(?:\w+script|data):/i),hk=Fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Vp=Fn(/^html$/i),pk=Fn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ff=Object.freeze({__proto__:null,ARIA_ATTR:mk,ATTR_WHITESPACE:hk,CUSTOM_ELEMENT:pk,DATA_ATTR:fk,DOCTYPE_NAME:Vp,ERB_EXPR:uk,IS_ALLOWED_URI:Kp,IS_SCRIPT_OR_DATA:gk,MUSTACHE_EXPR:ck,TMPLIT_EXPR:dk});const uo={element:1,text:3,progressingInstruction:7,comment:8,document:9},vk=function(){return typeof window>"u"?null:window},bk=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const n="data-tt-policy-suffix";r&&r.hasAttribute(n)&&(i=r.getAttribute(n));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Nf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Bp(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vk();const t=he=>Bp(he);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==uo.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const i=r,n=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:u,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:h}=e,g=l.prototype,y=co(g,"cloneNode"),b=co(g,"remove"),v=co(g,"nextSibling"),w=co(g,"childNodes"),x=co(g,"parentNode");if(typeof s=="function"){const he=r.createElement("template");he.content&&he.content.ownerDocument&&(r=he.content.ownerDocument)}let _,k="";const{implementation:C,createNodeIterator:O,createDocumentFragment:z,getElementsByTagName:K}=r,{importNode:J}=i;let T=Nf();t.isSupported=typeof Up=="function"&&typeof x=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:U,TMPLIT_EXPR:A,DATA_ATTR:j,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:V}=Ff;let{IS_ALLOWED_URI:Q}=Ff,ee=null;const oe=mt({},[...Ef,...el,...tl,...nl,...Mf]);let le=null;const W=mt({},[...zf,...rl,...Lf,...hs]);let D=Object.seal(Cl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),te=null,H=null;const Z=Object.seal(Cl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let se=!0,re=!0,fe=!1,Se=!0,Ne=!1,ce=!0,ye=!1,G=!1,we=!1,ke=!1,ue=!1,me=!1,Ue=!0,be=!1;const Be="user-content-";let E=!0,ae=!1,de={},Ee=null;const Re=mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ot=null;const Pe=mt({},["audio","video","img","source","image","track"]);let Oe=null;const pe=mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),De="http://www.w3.org/1998/Math/MathML",st="http://www.w3.org/2000/svg",Je="http://www.w3.org/1999/xhtml";let Ve=Je,ht=!1,Mt=null;const Tt=mt({},[De,st,Je],Ja);let zt=mt({},["mi","mo","mn","ms","mtext"]),rn=mt({},["annotation-xml"]);const $r=mt({},["title","style","font","a","script"]);let Un=null;const Kn=["application/xhtml+xml","text/html"],Br="text/html";let At=null,kn=null;const Yi=r.createElement("form"),Pn=function(L){return L instanceof RegExp||L instanceof Function},lr=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(kn&&kn===L)){if((!L||typeof L!="object")&&(L={}),L=tr(L),Un=Kn.indexOf(L.PARSER_MEDIA_TYPE)===-1?Br:L.PARSER_MEDIA_TYPE,At=Un==="application/xhtml+xml"?Ja:Ds,ee=Vn(L,"ALLOWED_TAGS")?mt({},L.ALLOWED_TAGS,At):oe,le=Vn(L,"ALLOWED_ATTR")?mt({},L.ALLOWED_ATTR,At):W,Mt=Vn(L,"ALLOWED_NAMESPACES")?mt({},L.ALLOWED_NAMESPACES,Ja):Tt,Oe=Vn(L,"ADD_URI_SAFE_ATTR")?mt(tr(pe),L.ADD_URI_SAFE_ATTR,At):pe,ot=Vn(L,"ADD_DATA_URI_TAGS")?mt(tr(Pe),L.ADD_DATA_URI_TAGS,At):Pe,Ee=Vn(L,"FORBID_CONTENTS")?mt({},L.FORBID_CONTENTS,At):Re,te=Vn(L,"FORBID_TAGS")?mt({},L.FORBID_TAGS,At):tr({}),H=Vn(L,"FORBID_ATTR")?mt({},L.FORBID_ATTR,At):tr({}),de=Vn(L,"USE_PROFILES")?L.USE_PROFILES:!1,se=L.ALLOW_ARIA_ATTR!==!1,re=L.ALLOW_DATA_ATTR!==!1,fe=L.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=L.SAFE_FOR_TEMPLATES||!1,ce=L.SAFE_FOR_XML!==!1,ye=L.WHOLE_DOCUMENT||!1,ke=L.RETURN_DOM||!1,ue=L.RETURN_DOM_FRAGMENT||!1,me=L.RETURN_TRUSTED_TYPE||!1,we=L.FORCE_BODY||!1,Ue=L.SANITIZE_DOM!==!1,be=L.SANITIZE_NAMED_PROPS||!1,E=L.KEEP_CONTENT!==!1,ae=L.IN_PLACE||!1,Q=L.ALLOWED_URI_REGEXP||Kp,Ve=L.NAMESPACE||Je,zt=L.MATHML_TEXT_INTEGRATION_POINTS||zt,rn=L.HTML_INTEGRATION_POINTS||rn,D=L.CUSTOM_ELEMENT_HANDLING||{},L.CUSTOM_ELEMENT_HANDLING&&Pn(L.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=L.CUSTOM_ELEMENT_HANDLING.tagNameCheck),L.CUSTOM_ELEMENT_HANDLING&&Pn(L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(D.allowCustomizedBuiltInElements=L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(re=!1),ue&&(ke=!0),de&&(ee=mt({},Mf),le=[],de.html===!0&&(mt(ee,Ef),mt(le,zf)),de.svg===!0&&(mt(ee,el),mt(le,rl),mt(le,hs)),de.svgFilters===!0&&(mt(ee,tl),mt(le,rl),mt(le,hs)),de.mathMl===!0&&(mt(ee,nl),mt(le,Lf),mt(le,hs))),L.ADD_TAGS&&(typeof L.ADD_TAGS=="function"?Z.tagCheck=L.ADD_TAGS:(ee===oe&&(ee=tr(ee)),mt(ee,L.ADD_TAGS,At))),L.ADD_ATTR&&(typeof L.ADD_ATTR=="function"?Z.attributeCheck=L.ADD_ATTR:(le===W&&(le=tr(le)),mt(le,L.ADD_ATTR,At))),L.ADD_URI_SAFE_ATTR&&mt(Oe,L.ADD_URI_SAFE_ATTR,At),L.FORBID_CONTENTS&&(Ee===Re&&(Ee=tr(Ee)),mt(Ee,L.FORBID_CONTENTS,At)),L.ADD_FORBID_CONTENTS&&(Ee===Re&&(Ee=tr(Ee)),mt(Ee,L.ADD_FORBID_CONTENTS,At)),E&&(ee["#text"]=!0),ye&&mt(ee,["html","head","body"]),ee.table&&(mt(ee,["tbody"]),delete te.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw lo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw lo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=L.TRUSTED_TYPES_POLICY,k=_.createHTML("")}else _===void 0&&(_=bk(h,n)),_!==null&&typeof k=="string"&&(k=_.createHTML(""));bn&&bn(L),kn=L}},cr=mt({},[...el,...tl,...ak]),on=mt({},[...nl,...lk]),pi=function(L){let xe=x(L);(!xe||!xe.tagName)&&(xe={namespaceURI:Ve,tagName:"template"});const Ke=Ds(L.tagName),wt=Ds(xe.tagName);return Mt[L.namespaceURI]?L.namespaceURI===st?xe.namespaceURI===Je?Ke==="svg":xe.namespaceURI===De?Ke==="svg"&&(wt==="annotation-xml"||zt[wt]):!!cr[Ke]:L.namespaceURI===De?xe.namespaceURI===Je?Ke==="math":xe.namespaceURI===st?Ke==="math"&&rn[wt]:!!on[Ke]:L.namespaceURI===Je?xe.namespaceURI===st&&!rn[wt]||xe.namespaceURI===De&&!zt[wt]?!1:!on[Ke]&&($r[Ke]||!cr[Ke]):!!(Un==="application/xhtml+xml"&&Mt[L.namespaceURI]):!1},an=function(L){so(t.removed,{element:L});try{x(L).removeChild(L)}catch{b(L)}},On=function(L,xe){try{so(t.removed,{attribute:xe.getAttributeNode(L),from:xe})}catch{so(t.removed,{attribute:null,from:xe})}if(xe.removeAttribute(L),L==="is")if(ke||ue)try{an(xe)}catch{}else try{xe.setAttribute(L,"")}catch{}},Zr=function(L){let xe=null,Ke=null;if(we)L="<remove></remove>"+L;else{const St=Qa(L,/^[\r\n\t ]+/);Ke=St&&St[0]}Un==="application/xhtml+xml"&&Ve===Je&&(L='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+L+"</body></html>");const wt=_?_.createHTML(L):L;if(Ve===Je)try{xe=new m().parseFromString(wt,Un)}catch{}if(!xe||!xe.documentElement){xe=C.createDocument(Ve,"template",null);try{xe.documentElement.innerHTML=ht?k:wt}catch{}}const Bt=xe.body||xe.documentElement;return L&&Ke&&Bt.insertBefore(r.createTextNode(Ke),Bt.childNodes[0]||null),Ve===Je?K.call(xe,ye?"html":"body")[0]:ye?xe.documentElement:Bt},Sr=function(L){return O.call(L.ownerDocument||L,L,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Hr=function(L){return L instanceof f&&(typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||!(L.attributes instanceof d)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function")},N=function(L){return typeof a=="function"&&L instanceof a};function X(he,L,xe){gs(he,Ke=>{Ke.call(t,L,xe,kn)})}const ge=function(L){let xe=null;if(X(T.beforeSanitizeElements,L,null),Hr(L))return an(L),!0;const Ke=At(L.nodeName);if(X(T.uponSanitizeElement,L,{tagName:Ke,allowedTags:ee}),ce&&L.hasChildNodes()&&!N(L.firstElementChild)&&mn(/<[/\w!]/g,L.innerHTML)&&mn(/<[/\w!]/g,L.textContent)||L.nodeType===uo.progressingInstruction||ce&&L.nodeType===uo.comment&&mn(/<[/\w]/g,L.data))return an(L),!0;if(!(Z.tagCheck instanceof Function&&Z.tagCheck(Ke))&&(!ee[Ke]||te[Ke])){if(!te[Ke]&&at(Ke)&&(D.tagNameCheck instanceof RegExp&&mn(D.tagNameCheck,Ke)||D.tagNameCheck instanceof Function&&D.tagNameCheck(Ke)))return!1;if(E&&!Ee[Ke]){const wt=x(L)||L.parentNode,Bt=w(L)||L.childNodes;if(Bt&&wt){const St=Bt.length;for(let Zt=St-1;Zt>=0;--Zt){const En=y(Bt[Zt],!0);En.__removalCount=(L.__removalCount||0)+1,wt.insertBefore(En,v(L))}}}return an(L),!0}return L instanceof l&&!pi(L)||(Ke==="noscript"||Ke==="noembed"||Ke==="noframes")&&mn(/<\/no(script|embed|frames)/i,L.innerHTML)?(an(L),!0):(Ne&&L.nodeType===uo.text&&(xe=L.textContent,gs([M,U,A],wt=>{xe=ao(xe,wt," ")}),L.textContent!==xe&&(so(t.removed,{element:L.cloneNode()}),L.textContent=xe)),X(T.afterSanitizeElements,L,null),!1)},He=function(L,xe,Ke){if(Ue&&(xe==="id"||xe==="name")&&(Ke in r||Ke in Yi))return!1;if(!(re&&!H[xe]&&mn(j,xe))){if(!(se&&mn(P,xe))){if(!(Z.attributeCheck instanceof Function&&Z.attributeCheck(xe,L))){if(!le[xe]||H[xe]){if(!(at(L)&&(D.tagNameCheck instanceof RegExp&&mn(D.tagNameCheck,L)||D.tagNameCheck instanceof Function&&D.tagNameCheck(L))&&(D.attributeNameCheck instanceof RegExp&&mn(D.attributeNameCheck,xe)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(xe,L))||xe==="is"&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&mn(D.tagNameCheck,Ke)||D.tagNameCheck instanceof Function&&D.tagNameCheck(Ke))))return!1}else if(!Oe[xe]){if(!mn(Q,ao(Ke,R,""))){if(!((xe==="src"||xe==="xlink:href"||xe==="href")&&L!=="script"&&rk(Ke,"data:")===0&&ot[L])){if(!(fe&&!mn(B,ao(Ke,R,"")))){if(Ke)return!1}}}}}}}return!0},at=function(L){return L!=="annotation-xml"&&Qa(L,V)},$t=function(L){X(T.beforeSanitizeAttributes,L,null);const{attributes:xe}=L;if(!xe||Hr(L))return;const Ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:le,forceKeepAttr:void 0};let wt=xe.length;for(;wt--;){const Bt=xe[wt],{name:St,namespaceURI:Zt,value:En}=Bt,qr=At(St),Ji=En;let Xt=St==="value"?Ji:ik(Ji);if(Ke.attrName=qr,Ke.attrValue=Xt,Ke.keepAttr=!0,Ke.forceKeepAttr=void 0,X(T.uponSanitizeAttribute,L,Ke),Xt=Ke.attrValue,be&&(qr==="id"||qr==="name")&&(On(St,L),Xt=Be+Xt),ce&&mn(/((--!?|])>)|<\/(style|title|textarea)/i,Xt)){On(St,L);continue}if(qr==="attributename"&&Qa(Xt,"href")){On(St,L);continue}if(Ke.forceKeepAttr)continue;if(!Ke.keepAttr){On(St,L);continue}if(!Se&&mn(/\/>/i,Xt)){On(St,L);continue}Ne&&gs([M,U,A],Gr=>{Xt=ao(Xt,Gr," ")});const Qi=At(L.nodeName);if(!He(Qi,qr,Xt)){On(St,L);continue}if(_&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Zt)switch(h.getAttributeType(Qi,qr)){case"TrustedHTML":{Xt=_.createHTML(Xt);break}case"TrustedScriptURL":{Xt=_.createScriptURL(Xt);break}}if(Xt!==Ji)try{Zt?L.setAttributeNS(Zt,St,Xt):L.setAttribute(St,Xt),Hr(L)?an(L):Of(t.removed)}catch{On(St,L)}}X(T.afterSanitizeAttributes,L,null)},lt=function he(L){let xe=null;const Ke=Sr(L);for(X(T.beforeSanitizeShadowDOM,L,null);xe=Ke.nextNode();)X(T.uponSanitizeShadowNode,xe,null),ge(xe),$t(xe),xe.content instanceof o&&he(xe.content);X(T.afterSanitizeShadowDOM,L,null)};return t.sanitize=function(he){let L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},xe=null,Ke=null,wt=null,Bt=null;if(ht=!he,ht&&(he="<!-->"),typeof he!="string"&&!N(he))if(typeof he.toString=="function"){if(he=he.toString(),typeof he!="string")throw lo("dirty is not a string, aborting")}else throw lo("toString is not a function");if(!t.isSupported)return he;if(G||lr(L),t.removed=[],typeof he=="string"&&(ae=!1),ae){if(he.nodeName){const En=At(he.nodeName);if(!ee[En]||te[En])throw lo("root node is forbidden and cannot be sanitized in-place")}}else if(he instanceof a)xe=Zr("<!---->"),Ke=xe.ownerDocument.importNode(he,!0),Ke.nodeType===uo.element&&Ke.nodeName==="BODY"||Ke.nodeName==="HTML"?xe=Ke:xe.appendChild(Ke);else{if(!ke&&!Ne&&!ye&&he.indexOf("<")===-1)return _&&me?_.createHTML(he):he;if(xe=Zr(he),!xe)return ke?null:me?k:""}xe&&we&&an(xe.firstChild);const St=Sr(ae?he:xe);for(;wt=St.nextNode();)ge(wt),$t(wt),wt.content instanceof o&&lt(wt.content);if(ae)return he;if(ke){if(ue)for(Bt=z.call(xe.ownerDocument);xe.firstChild;)Bt.appendChild(xe.firstChild);else Bt=xe;return(le.shadowroot||le.shadowrootmode)&&(Bt=J.call(i,Bt,!0)),Bt}let Zt=ye?xe.outerHTML:xe.innerHTML;return ye&&ee["!doctype"]&&xe.ownerDocument&&xe.ownerDocument.doctype&&xe.ownerDocument.doctype.name&&mn(Vp,xe.ownerDocument.doctype.name)&&(Zt="<!DOCTYPE "+xe.ownerDocument.doctype.name+`>
3
3
  `+Zt),Ne&&gs([M,U,A],En=>{Zt=ao(Zt,En," ")}),_&&me?_.createHTML(Zt):Zt},t.setConfig=function(){let he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lr(he),G=!0},t.clearConfig=function(){kn=null,G=!1},t.isValidAttribute=function(he,L,xe){kn||lr({});const Ke=At(he),wt=At(L);return He(Ke,wt,xe)},t.addHook=function(he,L){typeof L=="function"&&so(T[he],L)},t.removeHook=function(he,L){if(L!==void 0){const xe=tk(T[he],L);return xe===-1?void 0:nk(T[he],xe,1)[0]}return Of(T[he])},t.removeHooks=function(he){T[he]=[]},t.removeAllHooks=function(){T=Nf()},t}var Fs=Bp(),Rf=11;function yk(e,t){var r=t.attributes,i,n,o,s,a;if(!(t.nodeType===Rf||e.nodeType===Rf)){for(var l=r.length-1;l>=0;l--)i=r[l],n=i.name,o=i.namespaceURI,s=i.value,o?(n=i.localName||n,a=e.getAttributeNS(o,n),a!==s&&(i.prefix==="xmlns"&&(n=i.name),e.setAttributeNS(o,n,s))):(a=e.getAttribute(n),a!==s&&e.setAttribute(n,s));for(var u=e.attributes,d=u.length-1;d>=0;d--)i=u[d],n=i.name,o=i.namespaceURI,o?(n=i.localName||n,t.hasAttributeNS(o,n)||e.removeAttributeNS(o,n)):t.hasAttribute(n)||e.removeAttribute(n)}}var ps,wk="http://www.w3.org/1999/xhtml",pn=typeof document>"u"?void 0:document,xk=!!pn&&"content"in pn.createElement("template"),_k=!!pn&&pn.createRange&&"createContextualFragment"in pn.createRange();function $k(e){var t=pn.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function Sk(e){ps||(ps=pn.createRange(),ps.selectNode(pn.body));var t=ps.createContextualFragment(e);return t.childNodes[0]}function kk(e){var t=pn.createElement("body");return t.innerHTML=e,t.childNodes[0]}function Ck(e){return e=e.trim(),xk?$k(e):_k?Sk(e):kk(e)}function vs(e,t){var r=e.nodeName,i=t.nodeName,n,o;return r===i?!0:(n=r.charCodeAt(0),o=i.charCodeAt(0),n<=90&&o>=97?r===i.toUpperCase():o<=90&&n>=97?i===r.toUpperCase():!1)}function Ik(e,t){return!t||t===wk?pn.createElement(e):pn.createElementNS(t,e)}function Tk(e,t){for(var r=e.firstChild;r;){var i=r.nextSibling;t.appendChild(r),r=i}return t}function il(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var jf={OPTION:function(e,t){var r=e.parentNode;if(r){var i=r.nodeName.toUpperCase();i==="OPTGROUP"&&(r=r.parentNode,i=r&&r.nodeName.toUpperCase()),i==="SELECT"&&!r.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}il(e,t,"selected")},INPUT:function(e,t){il(e,t,"checked"),il(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var i=e.firstChild;if(i){var n=i.nodeValue;if(n==r||!r&&n==e.placeholder)return;i.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r=-1,i=0,n=e.firstChild,o,s;n;)if(s=n.nodeName&&n.nodeName.toUpperCase(),s==="OPTGROUP")o=n,n=o.firstChild,n||(n=o.nextSibling,o=null);else{if(s==="OPTION"){if(n.hasAttribute("selected")){r=i;break}i++}n=n.nextSibling,!n&&o&&(n=o.nextSibling,o=null)}e.selectedIndex=r}}},fo=1,Uf=11,Kf=3,Vf=8;function kr(){}function Dk(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function Ak(e){return function(r,i,n){if(n||(n={}),typeof i=="string")if(r.nodeName==="#document"||r.nodeName==="HTML"){var o=i;i=pn.createElement("html"),i.innerHTML=o}else if(r.nodeName==="BODY"){var s=i;i=pn.createElement("html"),i.innerHTML=s;var a=i.querySelector("body");a&&(i=a)}else i=Ck(i);else i.nodeType===Uf&&(i=i.firstElementChild);var l=n.getNodeKey||Dk,u=n.onBeforeNodeAdded||kr,d=n.onNodeAdded||kr,f=n.onBeforeElUpdated||kr,m=n.onElUpdated||kr,h=n.onBeforeNodeDiscarded||kr,g=n.onNodeDiscarded||kr,y=n.onBeforeElChildrenUpdated||kr,b=n.skipFromChildren||kr,v=n.addChild||function(V,Q){return V.appendChild(Q)},w=n.childrenOnly===!0,x=Object.create(null),_=[];function k(V){_.push(V)}function C(V,Q){if(V.nodeType===fo)for(var ee=V.firstChild;ee;){var oe=void 0;Q&&(oe=l(ee))?k(oe):(g(ee),ee.firstChild&&C(ee,Q)),ee=ee.nextSibling}}function O(V,Q,ee){h(V)!==!1&&(Q&&Q.removeChild(V),g(V),C(V,ee))}function z(V){if(V.nodeType===fo||V.nodeType===Uf)for(var Q=V.firstChild;Q;){var ee=l(Q);ee&&(x[ee]=Q),z(Q),Q=Q.nextSibling}}z(r);function K(V){d(V);for(var Q=V.firstChild;Q;){var ee=Q.nextSibling,oe=l(Q);if(oe){var le=x[oe];le&&vs(Q,le)?(Q.parentNode.replaceChild(le,Q),T(le,Q)):K(Q)}else K(Q);Q=ee}}function J(V,Q,ee){for(;Q;){var oe=Q.nextSibling;(ee=l(Q))?k(ee):O(Q,V,!0),Q=oe}}function T(V,Q,ee){var oe=l(Q);if(oe&&delete x[oe],!ee){var le=f(V,Q);if(le===!1||(le instanceof HTMLElement&&(V=le,z(V)),e(V,Q),m(V),y(V,Q)===!1))return}V.nodeName!=="TEXTAREA"?M(V,Q):jf.TEXTAREA(V,Q)}function M(V,Q){var ee=b(V,Q),oe=Q.firstChild,le=V.firstChild,W,D,te,H,Z;e:for(;oe;){for(H=oe.nextSibling,W=l(oe);!ee&&le;){if(te=le.nextSibling,oe.isSameNode&&oe.isSameNode(le)){oe=H,le=te;continue e}D=l(le);var se=le.nodeType,re=void 0;if(se===oe.nodeType&&(se===fo?(W?W!==D&&((Z=x[W])?te===Z?re=!1:(V.insertBefore(Z,le),D?k(D):O(le,V,!0),le=Z,D=l(le)):re=!1):D&&(re=!1),re=re!==!1&&vs(le,oe),re&&T(le,oe)):(se===Kf||se==Vf)&&(re=!0,le.nodeValue!==oe.nodeValue&&(le.nodeValue=oe.nodeValue))),re){oe=H,le=te;continue e}D?k(D):O(le,V,!0),le=te}if(W&&(Z=x[W])&&vs(Z,oe))ee||v(V,Z),T(Z,oe);else{var fe=u(oe);fe!==!1&&(fe&&(oe=fe),oe.actualize&&(oe=oe.actualize(V.ownerDocument||pn)),v(V,oe),K(oe))}oe=H,le=te}J(V,le,D);var Se=jf[V.nodeName];Se&&Se(V,Q)}var U=r,A=U.nodeType,j=i.nodeType;if(!w){if(A===fo)j===fo?vs(r,i)||(g(r),U=Tk(r,Ik(i.nodeName,i.namespaceURI))):U=i;else if(A===Kf||A===Vf){if(j===A)return U.nodeValue!==i.nodeValue&&(U.nodeValue=i.nodeValue),U;U=i}}if(U===i)g(r);else{if(i.isSameNode&&i.isSameNode(U))return;if(T(U,i,w),_)for(var P=0,B=_.length;P<B;P++){var R=x[_[P]];R&&O(R,R.parentNode,!1)}}return!w&&U!==r&&r.parentNode&&(U.actualize&&(U=U.actualize(r.ownerDocument||pn)),r.parentNode.replaceChild(U,r)),U}}var Pk=Ak(yk),Ok=Object.defineProperty,Ek=Object.defineProperties,Mk=Object.getOwnPropertyDescriptors,Bf=Object.getOwnPropertySymbols,zk=Object.prototype.hasOwnProperty,Lk=Object.prototype.propertyIsEnumerable,Zf=(e,t,r)=>t in e?Ok(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zp=(e,t)=>{for(var r in t||(t={}))zk.call(t,r)&&Zf(e,r,t[r]);if(Bf)for(var r of Bf(t))Lk.call(t,r)&&Zf(e,r,t[r]);return e},Hp=(e,t)=>Ek(e,Mk(t)),wn=(e,t)=>{let r=!1,i=!1;for(let n=0;n<t;n+=1){if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}if(e.substring(n,n+3)==="```"){i=!i,n+=2;continue}!i&&e[n]==="`"&&(r=!r)}return r||i},Fk=(e,t)=>{let r=e.substring(t,t+3)==="```",i=t>0&&e.substring(t-1,t+2)==="```",n=t>1&&e.substring(t-2,t+1)==="```";return r||i||n},Nk=e=>{let t=0;for(let r=0;r<e.length;r+=1){if(e[r]==="\\"&&r+1<e.length&&e[r+1]==="`"){r+=1;continue}e[r]==="`"&&!Fk(e,r)&&(t+=1)}return t},Or=(e,t)=>{let r=!1,i=!1,n=-1;for(let o=0;o<e.length;o+=1){if(e[o]==="\\"&&o+1<e.length&&e[o+1]==="`"){o+=1;continue}if(e.substring(o,o+3)==="```"){i=!i,o+=2;continue}if(!i&&e[o]==="`")if(r){if(n<t&&t<o)return!0;r=!1,n=-1}else r=!0,n=o}return!1},Rk=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,jk=e=>!e||typeof e!="string"||!e.includes(">")?e:e.replace(Rk,(t,r,i,n)=>wn(e,n)?t:`${r}\\>${i}`),Uk=/(\*\*)([^*]*\*?)$/,Kk=/(__)([^_]*?)$/,Vk=/(\*\*\*)([^*]*?)$/,Bk=/(\*)([^*]*?)$/,Zk=/(_)([^_]*?)$/,Hk=/(`)([^`]*?)$/,qk=/(~~)([^~]*?)$/,ui=/^[\s_~*`]*$/,qp=/^[\s]*[-*+][\s]+$/,Gk=/[\p{L}\p{N}_]/u,Wk=/^```[^`\n]*```?$/,Xk=/^\*{4,}$/,Yk=/(__)([^_]+)_$/,Jk=/(~~)([^~]+)~$/,Hf=/~~/g,Er=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:Gk.test(e)},Qk=(e,t)=>{let r=1;for(let i=t-1;i>=0;i-=1)if(e[i]==="]")r+=1;else if(e[i]==="["&&(r-=1,r===0))return i;return-1},Gp=(e,t)=>{let r=1;for(let i=t+1;i<e.length;i+=1)if(e[i]==="[")r+=1;else if(e[i]==="]"&&(r-=1,r===0))return i;return-1},pa=(e,t)=>{let r=!1,i=!1;for(let n=0;n<e.length&&n<t;n+=1){if(e[n]==="\\"&&e[n+1]==="$"){n+=1;continue}e[n]==="$"&&(e[n+1]==="$"?(i=!i,n+=1,r=!1):i||(r=!r))}return r||i},eC=(e,t)=>{for(let r=t;r<e.length;r+=1){if(e[r]===")")return!0;if(e[r]===`
4
4
  `)return!1}return!1},Wp=(e,t)=>{for(let r=t-1;r>=0;r-=1){if(e[r]===")")return!1;if(e[r]==="(")return r>0&&e[r-1]==="]"?eC(e,t):!1;if(e[r]===`
5
5
  `)return!1}return!1},tC=(e,t)=>{for(let r=t-1;r>=0;r-=1){if(e[r]===">")return!1;if(e[r]==="<"){let i=r+1<e.length?e[r+1]:"";return i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="/"}if(e[r]===`
@@ -48,7 +48,7 @@ $$`:`${e}$$`},CC=e=>$C(e)%2===0?e:kC(e),IC=e=>SC(e)%2===1?`${e}$`:e,TC=(e,t,r)=>
48
48
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of this.seen.entries()){const f=d[1];if(t===d[0]){s(d);continue}if(i.external){const h=i.external.registry.get(d[0])?.id;if(t!==d[0]&&h){s(d);continue}}if(this.metadataRegistry.get(d[0])?.id){s(d);continue}if(f.cycle){s(d);continue}if(f.count>1&&i.reused==="ref"){s(d);continue}}const a=(d,f)=>{const m=this.seen.get(d),h=m.def??m.schema,g={...h};if(m.ref===null)return;const y=m.ref;if(m.ref=null,y){a(y,f);const b=this.seen.get(y).schema;b.$ref&&(f.target==="draft-7"||f.target==="draft-4"||f.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(b)):(Object.assign(h,b),Object.assign(h,g))}m.isParent||this.override({zodSchema:d,jsonSchema:h,path:m.path??[]})};for(const d of[...this.seen.entries()].reverse())a(d[0],{target:this.target});const l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?l.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),i.external?.uri){const d=i.external.registry.get(t)?.id;if(!d)throw new Error("Schema is missing an `id` property");l.$id=i.external.uri(d)}Object.assign(l,n.def);const u=i.external?.defs??{};for(const d of this.seen.entries()){const f=d[1];f.def&&f.defId&&(u[f.defId]=f.def)}i.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?l.$defs=u:l.definitions=u);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}function My(e,t){if(e instanceof gu){const i=new El(t),n={};for(const a of e._idmap.entries()){const[l,u]=a;i.process(u)}const o={},s={registry:e,uri:t?.uri,defs:n};for(const a of e._idmap.entries()){const[l,u]=a;o[l]=i.emit(u,{...t,external:s})}if(Object.keys(n).length>0){const a=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[a]:n}}return{schemas:o}}const r=new El(t);return r.process(e),r.emit(e,t)}function Yt(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;switch(n.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Yt(n.element,r);case"object":{for(const o in n.shape)if(Yt(n.shape[o],r))return!0;return!1}case"union":{for(const o of n.options)if(Yt(o,r))return!0;return!1}case"intersection":return Yt(n.left,r)||Yt(n.right,r);case"tuple":{for(const o of n.items)if(Yt(o,r))return!0;return!!(n.rest&&Yt(n.rest,r))}case"record":return Yt(n.keyType,r)||Yt(n.valueType,r);case"map":return Yt(n.keyType,r)||Yt(n.valueType,r);case"set":return Yt(n.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Yt(n.innerType,r);case"lazy":return Yt(n.getter(),r);case"default":return Yt(n.innerType,r);case"prefault":return Yt(n.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Yt(n.in,r)||Yt(n.out,r);case"success":return!1;case"catch":return!1;case"function":return!1}throw new Error(`Unknown schema type: ${n.type}`)}const W3=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),X3=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:sb,$ZodArray:db,$ZodAsyncError:ri,$ZodBase64:G0,$ZodBase64URL:X0,$ZodBigInt:uu,$ZodBigIntFormat:nb,$ZodBoolean:cu,$ZodCIDRv4:H0,$ZodCIDRv6:q0,$ZodCUID:z0,$ZodCUID2:L0,$ZodCatch:Pb,$ZodCheck:Ut,$ZodCheckBigIntFormat:d0,$ZodCheckEndsWith:$0,$ZodCheckGreaterThan:su,$ZodCheckIncludes:x0,$ZodCheckLengthEquals:v0,$ZodCheckLessThan:ou,$ZodCheckLowerCase:y0,$ZodCheckMaxLength:h0,$ZodCheckMaxSize:f0,$ZodCheckMimeType:k0,$ZodCheckMinLength:p0,$ZodCheckMinSize:m0,$ZodCheckMultipleOf:c0,$ZodCheckNumberFormat:u0,$ZodCheckOverwrite:C0,$ZodCheckProperty:S0,$ZodCheckRegex:b0,$ZodCheckSizeEquals:g0,$ZodCheckStartsWith:_0,$ZodCheckStringFormat:rs,$ZodCheckUpperCase:w0,$ZodCodec:mu,$ZodCustom:Rb,$ZodCustomStringFormat:eb,$ZodDate:ub,$ZodDefault:Ib,$ZodDiscriminatedUnion:pb,$ZodE164:Y0,$ZodEmail:P0,$ZodEmoji:E0,$ZodEncodeError:ba,$ZodEnum:xb,$ZodError:Zc,$ZodFile:$b,$ZodFunction:Lb,$ZodGUID:D0,$ZodIPv4:B0,$ZodIPv6:Z0,$ZodISODate:U0,$ZodISODateTime:j0,$ZodISODuration:V0,$ZodISOTime:K0,$ZodIntersection:vb,$ZodJWT:Q0,$ZodKSUID:R0,$ZodLazy:Nb,$ZodLiteral:_b,$ZodMap:yb,$ZodNaN:Ob,$ZodNanoID:M0,$ZodNever:lb,$ZodNonOptional:Db,$ZodNull:ob,$ZodNullable:Cb,$ZodNumber:lu,$ZodNumberFormat:tb,$ZodObject:gb,$ZodObjectJIT:hb,$ZodOptional:kb,$ZodPipe:Eb,$ZodPrefault:Tb,$ZodPromise:Fb,$ZodReadonly:Mb,$ZodRealError:Dn,$ZodRecord:bb,$ZodRegistry:gu,$ZodSet:wb,$ZodString:is,$ZodStringFormat:It,$ZodSuccess:Ab,$ZodSymbol:rb,$ZodTemplateLiteral:zb,$ZodTransform:Sb,$ZodTuple:fu,$ZodType:nt,$ZodULID:F0,$ZodURL:O0,$ZodUUID:A0,$ZodUndefined:ib,$ZodUnion:du,$ZodUnknown:ab,$ZodVoid:cb,$ZodXID:N0,$brand:sv,$constructor:Y,$input:Zb,$output:Bb,Doc:I0,JSONSchema:W3,JSONSchemaGenerator:El,NEVER:ov,TimePrecision:Gb,_any:hy,_array:Iy,_base64:Ou,_base64url:Eu,_bigint:ly,_boolean:sy,_catch:V3,_check:Oy,_cidrv4:Au,_cidrv6:Pu,_coercedBigint:cy,_coercedBoolean:ay,_coercedDate:wy,_coercedNumber:ey,_coercedString:qb,_cuid:$u,_cuid2:Su,_custom:Dy,_date:yy,_decode:Wc,_decodeAsync:Yc,_default:j3,_discriminatedUnion:T3,_e164:Mu,_email:pu,_emoji:xu,_encode:Gc,_encodeAsync:Xc,_endsWith:Ku,_enum:M3,_file:Ty,_float32:ny,_float64:ry,_gt:ai,_gte:In,_guid:Ks,_includes:ju,_int:ty,_int32:iy,_int64:uy,_intersection:D3,_ipv4:Tu,_ipv6:Du,_isoDate:Xb,_isoDateTime:Wb,_isoDuration:Jb,_isoTime:Yb,_jwt:zu,_ksuid:Iu,_lazy:q3,_length:Ia,_literal:L3,_lowercase:Nu,_lt:si,_lte:Gn,_map:O3,_max:Gn,_maxLength:Ca,_maxSize:ka,_mime:Vu,_min:In,_minLength:Oi,_minSize:Eo,_multipleOf:Oo,_nan:xy,_nanoid:_u,_nativeEnum:z3,_negative:$y,_never:vy,_nonnegative:ky,_nonoptional:U3,_nonpositive:Sy,_normalize:Bu,_null:gy,_nullable:R3,_number:Qb,_optional:N3,_overwrite:mi,_parse:Yo,_parseAsync:Jo,_pipe:B3,_positive:_y,_promise:G3,_property:Cy,_readonly:Z3,_record:P3,_refine:Ay,_regex:Fu,_safeDecode:Qc,_safeDecodeAsync:tu,_safeEncode:Jc,_safeEncodeAsync:eu,_safeParse:Qo,_safeParseAsync:es,_set:E3,_size:Lu,_startsWith:Uu,_string:Hb,_stringFormat:os,_stringbool:Ey,_success:K3,_superRefine:Py,_symbol:fy,_templateLiteral:H3,_toLowerCase:Hu,_toUpperCase:qu,_transform:F3,_trim:Zu,_tuple:A3,_uint32:oy,_uint64:dy,_ulid:ku,_undefined:my,_union:I3,_unknown:py,_uppercase:Ru,_url:Sa,_uuid:vu,_uuidv4:bu,_uuidv6:yu,_uuidv7:wu,_void:by,_xid:Cu,clone:jn,config:xn,decode:dT,decodeAsync:mT,encode:uT,encodeAsync:fT,flattenError:Hc,formatError:qc,globalConfig:Ns,globalRegistry:ei,isValidBase64:au,isValidBase64URL:W0,isValidJWT:J0,locales:Vb,parse:Al,parseAsync:Pl,prettifyError:Cv,regexes:iu,registry:hu,safeDecode:hT,safeDecodeAsync:vT,safeEncode:gT,safeEncodeAsync:pT,safeParse:Iv,safeParseAsync:Tv,toDotPath:kv,toJSONSchema:My,treeifyError:Sv,util:_v,version:T0},Symbol.toStringTag,{value:"Module"})),Gu=Y("ZodISODateTime",(e,t)=>{j0.init(e,t),Dt.init(e,t)});function zy(e){return Wb(Gu,e)}const Wu=Y("ZodISODate",(e,t)=>{U0.init(e,t),Dt.init(e,t)});function Ly(e){return Xb(Wu,e)}const Xu=Y("ZodISOTime",(e,t)=>{K0.init(e,t),Dt.init(e,t)});function Fy(e){return Yb(Xu,e)}const Yu=Y("ZodISODuration",(e,t)=>{V0.init(e,t),Dt.init(e,t)});function Ny(e){return Jb(Yu,e)}const Y3=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:Wu,ZodISODateTime:Gu,ZodISODuration:Yu,ZodISOTime:Xu,date:Ly,datetime:zy,duration:Ny,time:Fy},Symbol.toStringTag,{value:"Module"})),Ry=(e,t)=>{Zc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>qc(e,r)},flatten:{value:r=>Hc(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Rs,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Rs,2)}},isEmpty:{get(){return e.issues.length===0}}})},J3=Y("ZodError",Ry),An=Y("ZodError",Ry,{Parent:Error}),jy=Yo(An),Uy=Jo(An),Ky=Qo(An),Vy=es(An),By=Gc(An),Zy=Wc(An),Hy=Xc(An),qy=Yc(An),Gy=Jc(An),Wy=Qc(An),Xy=eu(An),Yy=tu(An),dt=Y("ZodType",(e,t)=>(nt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(r,i)=>jn(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.parse=(r,i)=>jy(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Ky(e,r,i),e.parseAsync=async(r,i)=>Uy(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Vy(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>By(e,r,i),e.decode=(r,i)=>Zy(e,r,i),e.encodeAsync=async(r,i)=>Hy(e,r,i),e.decodeAsync=async(r,i)=>qy(e,r,i),e.safeEncode=(r,i)=>Gy(e,r,i),e.safeDecode=(r,i)=>Wy(e,r,i),e.safeEncodeAsync=async(r,i)=>Xy(e,r,i),e.safeDecodeAsync=async(r,i)=>Yy(e,r,i),e.refine=(r,i)=>e.check(F2(r,i)),e.superRefine=r=>e.check(N2(r)),e.overwrite=r=>e.check(mi(r)),e.optional=()=>Bs(e),e.nullable=()=>Zs(e),e.nullish=()=>Bs(Zs(e)),e.nonoptional=r=>k2(e,r),e.array=()=>Ea(e),e.or=r=>yd([e,r]),e.and=r=>d2(e,r),e.transform=r=>Hs(e,_d(r)),e.default=r=>_2(e,r),e.prefault=r=>S2(e,r),e.catch=r=>T2(e,r),e.pipe=r=>Hs(e,r),e.readonly=()=>P2(e),e.describe=r=>{const i=e.clone();return ei.add(i,{description:r}),i},Object.defineProperty(e,"description",{get(){return ei.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ei.get(e);const i=e.clone();return ei.add(i,r[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Ju=Y("_ZodString",(e,t)=>{is.init(e,t),dt.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...i)=>e.check(Fu(...i)),e.includes=(...i)=>e.check(ju(...i)),e.startsWith=(...i)=>e.check(Uu(...i)),e.endsWith=(...i)=>e.check(Ku(...i)),e.min=(...i)=>e.check(Oi(...i)),e.max=(...i)=>e.check(Ca(...i)),e.length=(...i)=>e.check(Ia(...i)),e.nonempty=(...i)=>e.check(Oi(1,...i)),e.lowercase=i=>e.check(Nu(i)),e.uppercase=i=>e.check(Ru(i)),e.trim=()=>e.check(Zu()),e.normalize=(...i)=>e.check(Bu(...i)),e.toLowerCase=()=>e.check(Hu()),e.toUpperCase=()=>e.check(qu())}),Ta=Y("ZodString",(e,t)=>{is.init(e,t),Ju.init(e,t),e.email=r=>e.check(pu(Qu,r)),e.url=r=>e.check(Sa(Da,r)),e.jwt=r=>e.check(zu(gd,r)),e.emoji=r=>e.check(xu(ed,r)),e.guid=r=>e.check(Ks(Vs,r)),e.uuid=r=>e.check(vu(mr,r)),e.uuidv4=r=>e.check(bu(mr,r)),e.uuidv6=r=>e.check(yu(mr,r)),e.uuidv7=r=>e.check(wu(mr,r)),e.nanoid=r=>e.check(_u(td,r)),e.guid=r=>e.check(Ks(Vs,r)),e.cuid=r=>e.check($u(nd,r)),e.cuid2=r=>e.check(Su(rd,r)),e.ulid=r=>e.check(ku(id,r)),e.base64=r=>e.check(Ou(dd,r)),e.base64url=r=>e.check(Eu(fd,r)),e.xid=r=>e.check(Cu(od,r)),e.ksuid=r=>e.check(Iu(sd,r)),e.ipv4=r=>e.check(Tu(ad,r)),e.ipv6=r=>e.check(Du(ld,r)),e.cidrv4=r=>e.check(Au(cd,r)),e.cidrv6=r=>e.check(Pu(ud,r)),e.e164=r=>e.check(Mu(md,r)),e.datetime=r=>e.check(zy(r)),e.date=r=>e.check(Ly(r)),e.time=r=>e.check(Fy(r)),e.duration=r=>e.check(Ny(r))});function Ml(e){return Hb(Ta,e)}const Dt=Y("ZodStringFormat",(e,t)=>{It.init(e,t),Ju.init(e,t)}),Qu=Y("ZodEmail",(e,t)=>{P0.init(e,t),Dt.init(e,t)});function Q3(e){return pu(Qu,e)}const Vs=Y("ZodGUID",(e,t)=>{D0.init(e,t),Dt.init(e,t)});function eD(e){return Ks(Vs,e)}const mr=Y("ZodUUID",(e,t)=>{A0.init(e,t),Dt.init(e,t)});function tD(e){return vu(mr,e)}function nD(e){return bu(mr,e)}function rD(e){return yu(mr,e)}function iD(e){return wu(mr,e)}const Da=Y("ZodURL",(e,t)=>{O0.init(e,t),Dt.init(e,t)});function oD(e){return Sa(Da,e)}function sD(e){return Sa(Da,{protocol:/^https?$/,hostname:Zv,..._e(e)})}const ed=Y("ZodEmoji",(e,t)=>{E0.init(e,t),Dt.init(e,t)});function aD(e){return xu(ed,e)}const td=Y("ZodNanoID",(e,t)=>{M0.init(e,t),Dt.init(e,t)});function lD(e){return _u(td,e)}const nd=Y("ZodCUID",(e,t)=>{z0.init(e,t),Dt.init(e,t)});function cD(e){return $u(nd,e)}const rd=Y("ZodCUID2",(e,t)=>{L0.init(e,t),Dt.init(e,t)});function uD(e){return Su(rd,e)}const id=Y("ZodULID",(e,t)=>{F0.init(e,t),Dt.init(e,t)});function dD(e){return ku(id,e)}const od=Y("ZodXID",(e,t)=>{N0.init(e,t),Dt.init(e,t)});function fD(e){return Cu(od,e)}const sd=Y("ZodKSUID",(e,t)=>{R0.init(e,t),Dt.init(e,t)});function mD(e){return Iu(sd,e)}const ad=Y("ZodIPv4",(e,t)=>{B0.init(e,t),Dt.init(e,t)});function gD(e){return Tu(ad,e)}const ld=Y("ZodIPv6",(e,t)=>{Z0.init(e,t),Dt.init(e,t)});function hD(e){return Du(ld,e)}const cd=Y("ZodCIDRv4",(e,t)=>{H0.init(e,t),Dt.init(e,t)});function pD(e){return Au(cd,e)}const ud=Y("ZodCIDRv6",(e,t)=>{q0.init(e,t),Dt.init(e,t)});function vD(e){return Pu(ud,e)}const dd=Y("ZodBase64",(e,t)=>{G0.init(e,t),Dt.init(e,t)});function bD(e){return Ou(dd,e)}const fd=Y("ZodBase64URL",(e,t)=>{X0.init(e,t),Dt.init(e,t)});function yD(e){return Eu(fd,e)}const md=Y("ZodE164",(e,t)=>{Y0.init(e,t),Dt.init(e,t)});function wD(e){return Mu(md,e)}const gd=Y("ZodJWT",(e,t)=>{Q0.init(e,t),Dt.init(e,t)});function xD(e){return zu(gd,e)}const ss=Y("ZodCustomStringFormat",(e,t)=>{eb.init(e,t),Dt.init(e,t)});function _D(e,t,r={}){return os(ss,e,t,r)}function $D(e){return os(ss,"hostname",ru,e)}function SD(e){return os(ss,"hex",a0,e)}function kD(e,t){const r=t?.enc??"hex",i=`${e}_${r}`,n=iu[i];if(!n)throw new Error(`Unrecognized hash format: ${i}`);return os(ss,i,n,t)}const Aa=Y("ZodNumber",(e,t)=>{lu.init(e,t),dt.init(e,t),e.gt=(i,n)=>e.check(ai(i,n)),e.gte=(i,n)=>e.check(In(i,n)),e.min=(i,n)=>e.check(In(i,n)),e.lt=(i,n)=>e.check(si(i,n)),e.lte=(i,n)=>e.check(Gn(i,n)),e.max=(i,n)=>e.check(Gn(i,n)),e.int=i=>e.check(zl(i)),e.safe=i=>e.check(zl(i)),e.positive=i=>e.check(ai(0,i)),e.nonnegative=i=>e.check(In(0,i)),e.negative=i=>e.check(si(0,i)),e.nonpositive=i=>e.check(Gn(0,i)),e.multipleOf=(i,n)=>e.check(Oo(i,n)),e.step=(i,n)=>e.check(Oo(i,n)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Jy(e){return Qb(Aa,e)}const Bi=Y("ZodNumberFormat",(e,t)=>{tb.init(e,t),Aa.init(e,t)});function zl(e){return ty(Bi,e)}function CD(e){return ny(Bi,e)}function ID(e){return ry(Bi,e)}function TD(e){return iy(Bi,e)}function DD(e){return oy(Bi,e)}const Pa=Y("ZodBoolean",(e,t)=>{cu.init(e,t),dt.init(e,t)});function Qy(e){return sy(Pa,e)}const Oa=Y("ZodBigInt",(e,t)=>{uu.init(e,t),dt.init(e,t),e.gte=(i,n)=>e.check(In(i,n)),e.min=(i,n)=>e.check(In(i,n)),e.gt=(i,n)=>e.check(ai(i,n)),e.gte=(i,n)=>e.check(In(i,n)),e.min=(i,n)=>e.check(In(i,n)),e.lt=(i,n)=>e.check(si(i,n)),e.lte=(i,n)=>e.check(Gn(i,n)),e.max=(i,n)=>e.check(Gn(i,n)),e.positive=i=>e.check(ai(BigInt(0),i)),e.negative=i=>e.check(si(BigInt(0),i)),e.nonpositive=i=>e.check(Gn(BigInt(0),i)),e.nonnegative=i=>e.check(In(BigInt(0),i)),e.multipleOf=(i,n)=>e.check(Oo(i,n));const r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function AD(e){return ly(Oa,e)}const hd=Y("ZodBigIntFormat",(e,t)=>{nb.init(e,t),Oa.init(e,t)});function PD(e){return uy(hd,e)}function OD(e){return dy(hd,e)}const e2=Y("ZodSymbol",(e,t)=>{rb.init(e,t),dt.init(e,t)});function ED(e){return fy(e2,e)}const t2=Y("ZodUndefined",(e,t)=>{ib.init(e,t),dt.init(e,t)});function MD(e){return my(t2,e)}const n2=Y("ZodNull",(e,t)=>{ob.init(e,t),dt.init(e,t)});function r2(e){return gy(n2,e)}const i2=Y("ZodAny",(e,t)=>{sb.init(e,t),dt.init(e,t)});function zD(){return hy(i2)}const o2=Y("ZodUnknown",(e,t)=>{ab.init(e,t),dt.init(e,t)});function Ei(){return py(o2)}const s2=Y("ZodNever",(e,t)=>{lb.init(e,t),dt.init(e,t)});function pd(e){return vy(s2,e)}const a2=Y("ZodVoid",(e,t)=>{cb.init(e,t),dt.init(e,t)});function LD(e){return by(a2,e)}const vd=Y("ZodDate",(e,t)=>{ub.init(e,t),dt.init(e,t),e.min=(i,n)=>e.check(In(i,n)),e.max=(i,n)=>e.check(Gn(i,n));const r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function FD(e){return yy(vd,e)}const l2=Y("ZodArray",(e,t)=>{db.init(e,t),dt.init(e,t),e.element=t.element,e.min=(r,i)=>e.check(Oi(r,i)),e.nonempty=r=>e.check(Oi(1,r)),e.max=(r,i)=>e.check(Ca(r,i)),e.length=(r,i)=>e.check(Ia(r,i)),e.unwrap=()=>e.element});function Ea(e,t){return Iy(l2,e,t)}function ND(e){const t=e._zod.def.shape;return xd(Object.keys(t))}const Ma=Y("ZodObject",(e,t)=>{hb.init(e,t),dt.init(e,t),gt(e,"shape",()=>t.shape),e.keyof=()=>xd(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ei()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ei()}),e.strict=()=>e.clone({...e._zod.def,catchall:pd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>hv(e,r),e.safeExtend=r=>pv(e,r),e.merge=r=>vv(e,r),e.pick=r=>mv(e,r),e.omit=r=>gv(e,r),e.partial=(...r)=>bv($d,e,r[0]),e.required=(...r)=>yv(Sd,e,r[0])});function RD(e,t){const r={type:"object",get shape(){return er(this,"shape",e?wa(e):{}),this.shape},..._e(t)};return new Ma(r)}function jD(e,t){return new Ma({type:"object",get shape(){return er(this,"shape",wa(e)),this.shape},catchall:pd(),..._e(t)})}function UD(e,t){return new Ma({type:"object",get shape(){return er(this,"shape",wa(e)),this.shape},catchall:Ei(),..._e(t)})}const bd=Y("ZodUnion",(e,t)=>{du.init(e,t),dt.init(e,t),e.options=t.options});function yd(e,t){return new bd({type:"union",options:e,..._e(t)})}const c2=Y("ZodDiscriminatedUnion",(e,t)=>{bd.init(e,t),pb.init(e,t)});function KD(e,t,r){return new c2({type:"union",options:t,discriminator:e,..._e(r)})}const u2=Y("ZodIntersection",(e,t)=>{vb.init(e,t),dt.init(e,t)});function d2(e,t){return new u2({type:"intersection",left:e,right:t})}const f2=Y("ZodTuple",(e,t)=>{fu.init(e,t),dt.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function m2(e,t,r){const i=t instanceof nt,n=i?r:t,o=i?t:null;return new f2({type:"tuple",items:e,rest:o,..._e(n)})}const wd=Y("ZodRecord",(e,t)=>{bb.init(e,t),dt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function g2(e,t,r){return new wd({type:"record",keyType:e,valueType:t,..._e(r)})}function VD(e,t,r){const i=jn(e);return i._zod.values=void 0,new wd({type:"record",keyType:i,valueType:t,..._e(r)})}const h2=Y("ZodMap",(e,t)=>{yb.init(e,t),dt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function BD(e,t,r){return new h2({type:"map",keyType:e,valueType:t,..._e(r)})}const p2=Y("ZodSet",(e,t)=>{wb.init(e,t),dt.init(e,t),e.min=(...r)=>e.check(Eo(...r)),e.nonempty=r=>e.check(Eo(1,r)),e.max=(...r)=>e.check(ka(...r)),e.size=(...r)=>e.check(Lu(...r))});function ZD(e,t){return new p2({type:"set",valueType:e,..._e(t)})}const Mo=Y("ZodEnum",(e,t)=>{xb.init(e,t),dt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(i,n)=>{const o={};for(const s of i)if(r.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Mo({...t,checks:[],..._e(n),entries:o})},e.exclude=(i,n)=>{const o={...t.entries};for(const s of i)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Mo({...t,checks:[],..._e(n),entries:o})}});function xd(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Mo({type:"enum",entries:r,..._e(t)})}function HD(e,t){return new Mo({type:"enum",entries:e,..._e(t)})}const v2=Y("ZodLiteral",(e,t)=>{_b.init(e,t),dt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function qD(e,t){return new v2({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const b2=Y("ZodFile",(e,t)=>{$b.init(e,t),dt.init(e,t),e.min=(r,i)=>e.check(Eo(r,i)),e.max=(r,i)=>e.check(ka(r,i)),e.mime=(r,i)=>e.check(Vu(Array.isArray(r)?r:[r],i))});function GD(e){return Ty(b2,e)}const y2=Y("ZodTransform",(e,t)=>{Sb.init(e,t),dt.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new ba(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Ai(o,r.value,t));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Ai(s))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(o=>(r.value=o,r)):(r.value=n,r)}});function _d(e){return new y2({type:"transform",transform:e})}const $d=Y("ZodOptional",(e,t)=>{kb.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bs(e){return new $d({type:"optional",innerType:e})}const w2=Y("ZodNullable",(e,t)=>{Cb.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Zs(e){return new w2({type:"nullable",innerType:e})}function WD(e){return Bs(Zs(e))}const x2=Y("ZodDefault",(e,t)=>{Ib.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _2(e,t){return new x2({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():xa(t)}})}const $2=Y("ZodPrefault",(e,t)=>{Tb.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function S2(e,t){return new $2({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():xa(t)}})}const Sd=Y("ZodNonOptional",(e,t)=>{Db.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function k2(e,t){return new Sd({type:"nonoptional",innerType:e,..._e(t)})}const C2=Y("ZodSuccess",(e,t)=>{Ab.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function XD(e){return new C2({type:"success",innerType:e})}const I2=Y("ZodCatch",(e,t)=>{Pb.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function T2(e,t){return new I2({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const D2=Y("ZodNaN",(e,t)=>{Ob.init(e,t),dt.init(e,t)});function YD(e){return xy(D2,e)}const kd=Y("ZodPipe",(e,t)=>{Eb.init(e,t),dt.init(e,t),e.in=t.in,e.out=t.out});function Hs(e,t){return new kd({type:"pipe",in:e,out:t})}const Cd=Y("ZodCodec",(e,t)=>{kd.init(e,t),mu.init(e,t)});function JD(e,t,r){return new Cd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}const A2=Y("ZodReadonly",(e,t)=>{Mb.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function P2(e){return new A2({type:"readonly",innerType:e})}const O2=Y("ZodTemplateLiteral",(e,t)=>{zb.init(e,t),dt.init(e,t)});function QD(e,t){return new O2({type:"template_literal",parts:e,..._e(t)})}const E2=Y("ZodLazy",(e,t)=>{Nb.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.getter()});function M2(e){return new E2({type:"lazy",getter:e})}const z2=Y("ZodPromise",(e,t)=>{Fb.init(e,t),dt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eA(e){return new z2({type:"promise",innerType:e})}const L2=Y("ZodFunction",(e,t)=>{Lb.init(e,t),dt.init(e,t)});function _m(e){return new L2({type:"function",input:Array.isArray(e?.input)?m2(e?.input):e?.input??Ea(Ei()),output:e?.output??Ei()})}const za=Y("ZodCustom",(e,t)=>{Rb.init(e,t),dt.init(e,t)});function tA(e){const t=new Ut({check:"custom"});return t._zod.check=e,t}function nA(e,t){return Dy(za,e??(()=>!0),t)}function F2(e,t={}){return Ay(za,e,t)}function N2(e){return Py(e)}function rA(e,t={error:`Input not instance of ${e.name}`}){const r=new za({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,..._e(t)});return r._zod.bag.Class=e,r}const iA=(...e)=>Ey({Codec:Cd,Boolean:Pa,String:Ta},...e);function oA(e){const t=M2(()=>yd([Ml(e),Jy(),Qy(),r2(),Ea(t),g2(Ml(),t)]));return t}function sA(e,t){return Hs(_d(e),t)}const aA={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function lA(e){xn({customError:e})}function cA(){return xn().customError}var Ll;Ll||(Ll={});function uA(e){return qb(Ta,e)}function dA(e){return ey(Aa,e)}function fA(e){return ay(Pa,e)}function mA(e){return cy(Oa,e)}function gA(e){return wy(vd,e)}const hA=Object.freeze(Object.defineProperty({__proto__:null,bigint:mA,boolean:fA,date:gA,number:dA,string:uA},Symbol.toStringTag,{value:"Module"}));xn(jb());const pA=Object.freeze(Object.defineProperty({__proto__:null,$brand:sv,$input:Zb,$output:Bb,NEVER:ov,TimePrecision:Gb,ZodAny:i2,ZodArray:l2,ZodBase64:dd,ZodBase64URL:fd,ZodBigInt:Oa,ZodBigIntFormat:hd,ZodBoolean:Pa,ZodCIDRv4:cd,ZodCIDRv6:ud,ZodCUID:nd,ZodCUID2:rd,ZodCatch:I2,ZodCodec:Cd,ZodCustom:za,ZodCustomStringFormat:ss,ZodDate:vd,ZodDefault:x2,ZodDiscriminatedUnion:c2,ZodE164:md,ZodEmail:Qu,ZodEmoji:ed,ZodEnum:Mo,ZodError:J3,ZodFile:b2,get ZodFirstPartyTypeKind(){return Ll},ZodFunction:L2,ZodGUID:Vs,ZodIPv4:ad,ZodIPv6:ld,ZodISODate:Wu,ZodISODateTime:Gu,ZodISODuration:Yu,ZodISOTime:Xu,ZodIntersection:u2,ZodIssueCode:aA,ZodJWT:gd,ZodKSUID:sd,ZodLazy:E2,ZodLiteral:v2,ZodMap:h2,ZodNaN:D2,ZodNanoID:td,ZodNever:s2,ZodNonOptional:Sd,ZodNull:n2,ZodNullable:w2,ZodNumber:Aa,ZodNumberFormat:Bi,ZodObject:Ma,ZodOptional:$d,ZodPipe:kd,ZodPrefault:$2,ZodPromise:z2,ZodReadonly:A2,ZodRealError:An,ZodRecord:wd,ZodSet:p2,ZodString:Ta,ZodStringFormat:Dt,ZodSuccess:C2,ZodSymbol:e2,ZodTemplateLiteral:O2,ZodTransform:y2,ZodTuple:f2,ZodType:dt,ZodULID:id,ZodURL:Da,ZodUUID:mr,ZodUndefined:t2,ZodUnion:bd,ZodUnknown:o2,ZodVoid:a2,ZodXID:od,_ZodString:Ju,_default:_2,_function:_m,any:zD,array:Ea,base64:bD,base64url:yD,bigint:AD,boolean:Qy,catch:T2,check:tA,cidrv4:pD,cidrv6:vD,clone:jn,codec:JD,coerce:hA,config:xn,core:X3,cuid:cD,cuid2:uD,custom:nA,date:FD,decode:Zy,decodeAsync:qy,discriminatedUnion:KD,e164:wD,email:Q3,emoji:aD,encode:By,encodeAsync:Hy,endsWith:Ku,enum:xd,file:GD,flattenError:Hc,float32:CD,float64:ID,formatError:qc,function:_m,getErrorMap:cA,globalRegistry:ei,gt:ai,gte:In,guid:eD,hash:kD,hex:SD,hostname:$D,httpUrl:sD,includes:ju,instanceof:rA,int:zl,int32:TD,int64:PD,intersection:d2,ipv4:gD,ipv6:hD,iso:Y3,json:oA,jwt:xD,keyof:ND,ksuid:mD,lazy:M2,length:Ia,literal:qD,locales:Vb,looseObject:UD,lowercase:Nu,lt:si,lte:Gn,map:BD,maxLength:Ca,maxSize:ka,mime:Vu,minLength:Oi,minSize:Eo,multipleOf:Oo,nan:YD,nanoid:lD,nativeEnum:HD,negative:$y,never:pd,nonnegative:ky,nonoptional:k2,nonpositive:Sy,normalize:Bu,null:r2,nullable:Zs,nullish:WD,number:Jy,object:RD,optional:Bs,overwrite:mi,parse:jy,parseAsync:Uy,partialRecord:VD,pipe:Hs,positive:_y,prefault:S2,preprocess:sA,prettifyError:Cv,promise:eA,property:Cy,readonly:P2,record:g2,refine:F2,regex:Fu,regexes:iu,registry:hu,safeDecode:Wy,safeDecodeAsync:Yy,safeEncode:Gy,safeEncodeAsync:Xy,safeParse:Ky,safeParseAsync:Vy,set:ZD,setErrorMap:lA,size:Lu,startsWith:Uu,strictObject:jD,string:Ml,stringFormat:_D,stringbool:iA,success:XD,superRefine:N2,symbol:ED,templateLiteral:QD,toJSONSchema:My,toLowerCase:Hu,toUpperCase:qu,transform:_d,treeifyError:Sv,trim:Zu,tuple:m2,uint32:DD,uint64:OD,ulid:dD,undefined:MD,union:yd,unknown:Ei,uppercase:Ru,url:oD,util:_v,uuid:tD,uuidv4:nD,uuidv6:rD,uuidv7:iD,void:LD,xid:fD},Symbol.toStringTag,{value:"Module"})),qs={session:"ses",message:"msg",permission:"per",user:"usr",part:"prt",pty:"pty"},vA=26;let $m=0,al=0;var rr;(e=>{function t(n){return pA.string().startsWith(qs[n])}e.schema=t;function r(n,o){return Sm(n,!1,o)}e.ascending=r;function i(n,o){return Sm(n,!0,o)}e.descending=i})(rr||(rr={}));function Sm(e,t,r){if(!r)return bA(e,t);if(!r.startsWith(qs[e]))throw new Error(`ID ${r} does not start with ${qs[e]}`);return r}function bA(e,t,r){const i=Date.now();i!==$m&&($m=i,al=0),al+=1;let n=BigInt(i)*BigInt(4096)+BigInt(al);t&&(n=~n);const o=new Uint8Array(6);for(let s=0;s<6;s+=1)o[s]=Number(n>>BigInt(40-8*s)&BigInt(255));return qs[e]+"_"+yA(o)+wA(vA-12)}function yA(e){let t="";for(let r=0;r<e.length;r+=1)t+=e[r].toString(16).padStart(2,"0");return t}function wA(e){const t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",r=xA(e);let i="";for(let n=0;n<e;n+=1)i+=t[r[n]%62];return i}function xA(e){const t=new Uint8Array(e),r=typeof globalThis<"u"?globalThis.crypto:void 0;if(r&&typeof r.getRandomValues=="function")return r.getRandomValues(t),t;for(let i=0;i<e;i+=1)t[i]=Math.floor(Math.random()*256);return t}function _A(e){if(!e||typeof e!="object")return;const t=Number(e.startLine),r=Number(e.startChar),i=Number(e.endLine),n=Number(e.endChar);if([t,r,i,n].every(Number.isFinite))return{startLine:t,startChar:r,endLine:i,endChar:n}}function $A(e){return{kcodeComment:{path:e.path,selection:e.selection,comment:e.comment,preview:e.preview,origin:e.origin}}}function SA(e){if(!e||typeof e!="object")return;const t=e.kcodeComment;if(!t||typeof t!="object")return;const r=t.path,i=t.comment;if(typeof r!="string"||typeof i!="string")return;const n=t.preview,o=t.origin;return{path:r,selection:_A(t.selection),comment:i,preview:typeof n=="string"?n:void 0,origin:o==="review"||o==="file"?o:void 0}}function kA(e){const t=e.selection?Math.min(e.selection.startLine,e.selection.endLine):void 0,r=e.selection?Math.max(e.selection.startLine,e.selection.endLine):void 0;return`The user made the following comment regarding ${t===void 0||r===void 0?"this file":t===r?`line ${t}`:`lines ${t} through ${r}`} of ${e.path}: ${e.comment}`}function CA(e){const t=e.match(/^The user made the following comment regarding (this file|line (\d+)|lines (\d+) through (\d+)) of (.+?): ([\s\S]+)$/);if(!t)return;const r=t[2]?Number(t[2]):t[3]?Number(t[3]):void 0,i=t[2]?Number(t[2]):t[4]?Number(t[4]):void 0;return{path:t[5],selection:r!==void 0&&i!==void 0?{startLine:r,startChar:0,endLine:i,endChar:0}:void 0,comment:t[6]}}const km=(e,t)=>t.startsWith("/")||/^[A-Za-z]:[\\/]/.test(t)||/^[A-Za-z]:$/.test(t)||t.startsWith("\\\\")||t.startsWith("//")?t:`${e.replace(/[\\/]+$/,"")}/${t}`,IA=/(^|[\s([{"'])@(\S+)/g,TA=e=>Array.from(e.matchAll(IA)).flatMap(t=>{const r=(t[2]??"").replace(/[.,!?;:)}\]"']+$/,"");return r?[r]:[]}),DA=e=>e.type==="agent",Cm=e=>`Context file: ${e}`,AA=(e,t,r)=>e.type==="text"?{id:e.id,type:"text",text:e.text,synthetic:e.synthetic,ignored:e.ignored,time:e.time,metadata:e.metadata,sessionID:t,messageID:r}:{id:e.id,type:"agent",name:e.name,source:e.source,sessionID:t,messageID:r};function PA(e){const t=[{id:rr.ascending("part"),type:"text",text:e.text}],r=e.prompt.filter(DA).map(o=>({id:rr.ascending("part"),type:"agent",name:o.name,source:{value:o.content,start:o.start,end:o.end}})),i=new Set,n=e.context.flatMap(o=>{const s=km(e.sessionDirectory,o.path),a=o.comment?.trim(),l={id:rr.ascending("part"),type:"text",text:Cm(s),synthetic:!0,ignored:!0},u=[];if(i.has(s)||(i.add(s),u.push(l)),!a)return u;const d=TA(a).flatMap(f=>{const m=km(e.sessionDirectory,f);return i.has(m)?[]:(i.add(m),[{id:rr.ascending("part"),type:"text",text:Cm(m),synthetic:!0,ignored:!0}])});return[...u,{id:rr.ascending("part"),type:"text",text:kA({path:o.path,selection:o.selection,comment:a}),synthetic:!0,metadata:$A({path:o.path,selection:o.selection,comment:a,preview:o.preview,origin:o.commentOrigin})},...d]});return t.push(...n,...r),{requestParts:t,optimisticParts:t.map(o=>AA(o,e.sessionID,e.messageID))}}const OA=200;function Im(e){const t=document.createDocumentFragment();let r=0;for(const n of e)if(n===`
49
49
  `&&(r+=1,r>OA)){const o=e.endsWith(`
50
50
  `),s=o?e.slice(0,-1):e;return s&&t.appendChild(document.createTextNode(s)),o&&t.appendChild(document.createElement("br")),t}const i=e.split(`
51
- `);return i.forEach((n,o)=>{n&&t.appendChild(document.createTextNode(n)),o<i.length-1&&t.appendChild(document.createElement("br"))}),t}function R2(e){return e.nodeType===Node.ELEMENT_NODE&&e.tagName==="BR"?1:(e.textContent??"").replace(/\u200B/g,"").length}function j2(e){if(e.nodeType===Node.TEXT_NODE)return(e.textContent??"").replace(/\u200B/g,"").length;if(e.nodeType===Node.ELEMENT_NODE&&e.tagName==="BR")return 1;let t=0;for(const r of Array.from(e.childNodes))t+=j2(r);return t}function Xr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const r=t.getRangeAt(0);if(!e.contains(r.startContainer))return 0;const i=r.cloneRange();return i.selectNodeContents(e),i.setEnd(r.startContainer,r.startOffset),j2(i.cloneContents())}function Yr(e,t){let r=t,i=e.firstChild;for(;i;){const a=R2(i),l=i.nodeType===Node.TEXT_NODE,u=i.nodeType===Node.ELEMENT_NODE&&(i.dataset.type==="file"||i.dataset.type==="agent"),d=i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BR";if(l&&r<=a){const f=document.createRange(),m=window.getSelection();f.setStart(i,r),f.collapse(!0),m?.removeAllRanges(),m?.addRange(f);return}if((u||d)&&r<=a){const f=document.createRange(),m=window.getSelection();if(r===0&&f.setStartBefore(i),r>0&&u&&f.setStartAfter(i),r>0&&d){const h=i.nextSibling;h&&h.nodeType===Node.TEXT_NODE&&f.setStart(h,0),(!h||h.nodeType!==Node.TEXT_NODE)&&f.setStartAfter(i)}f.collapse(!0),m?.removeAllRanges(),m?.addRange(f);return}r-=a,i=i.nextSibling}const n=document.createRange(),o=window.getSelection(),s=e.lastChild;if(s&&s.nodeType===Node.TEXT_NODE){const a=s.textContent?s.textContent.length:0;n.setStart(s,a)}(!s||s.nodeType!==Node.TEXT_NODE)&&n.selectNodeContents(e),n.collapse(!1),o?.removeAllRanges(),o?.addRange(n)}function Tm(e,t,r,i){let n=i;const o=Array.from(e.childNodes);for(const s of o){const a=R2(s),l=s.nodeType===Node.TEXT_NODE,u=s.nodeType===Node.ELEMENT_NODE&&(s.dataset.type==="file"||s.dataset.type==="agent"),d=s.nodeType===Node.ELEMENT_NODE&&s.tagName==="BR";if(l&&n<=a){r==="start"&&t.setStart(s,n),r==="end"&&t.setEnd(s,n);return}if((u||d)&&n<=a){r==="start"&&n===0&&t.setStartBefore(s),r==="start"&&n>0&&t.setStartAfter(s),r==="end"&&n===0&&t.setEndBefore(s),r==="end"&&n>0&&t.setEndAfter(s);return}n-=a}}const EA=e=>e.map(t=>"content"in t?t.content:"").join("");async function U2(e){const t=EA(e.draft.prompt),[,r]=e.globalSync.child(e.draft.sessionDirectory),i=()=>{e.optimisticBusy&&r("session_status",e.draft.sessionID,{type:"busy"})},n=()=>{e.optimisticBusy&&r("session_status",e.draft.sessionID,{type:"idle"})},o=async()=>await e.before?.()!==!1,[s,...a]=t.split(" "),l=s?.startsWith("/")?s.slice(1):void 0;if(l&&e.sync.data.command.find(y=>y.name===l)){i();try{return await o()?(await e.client.session.command({sessionID:e.draft.sessionID,command:l,arguments:a.join(" "),agent:e.draft.agent,model:`${e.draft.model.providerID}/${e.draft.model.modelID}`,approval_mode:e.draft.mode}),!0):(n(),!1)}catch(y){throw n(),y}}const u=e.messageID??rr.ascending("message"),{requestParts:d,optimisticParts:f}=PA({prompt:e.draft.prompt,context:e.draft.context,text:t,sessionID:e.draft.sessionID,messageID:u,sessionDirectory:e.draft.sessionDirectory}),m={id:u,sessionID:e.draft.sessionID,role:"user",time:{created:Date.now()},agent:e.draft.agent,model:e.draft.model},h=()=>e.sync.session.optimistic.add({directory:e.draft.sessionDirectory,sessionID:e.draft.sessionID,message:m,parts:f}),g=()=>e.sync.session.optimistic.remove({directory:e.draft.sessionDirectory,sessionID:e.draft.sessionID,messageID:u});i(),h();try{return await o()?(await e.client.session.promptAsync({sessionID:e.draft.sessionID,agent:e.draft.agent,model:e.draft.model,messageID:u,parts:d,approval_mode:e.draft.mode}),!0):(n(),g(),!1)}catch(y){throw n(),g(),y}}function MA(e){const t=ra(),r=Rn(),i=sr(),n=xc(),o=ji(),s=Ui(),a=or(),l=_t(),u=yc(),d=v=>{if(v&&typeof v=="object"&&"data"in v){const w=v.data;if(w?.message)return w.message}return v instanceof Error?v.message:l.t("common.requestFailed")},f=async()=>{const v=u.id;if(!v)return Promise.resolve();n.todo.set(v,[]);const[,w]=n.child(r.directory);return w("todo",v,[]),e.onAbort?.(),r.client.session.abort({sessionID:v}).catch(()=>{})},m=v=>{for(const w of v)s.context.add({type:"file",path:w.path,selection:w.selection,comment:w.comment,commentID:w.commentID,commentOrigin:w.commentOrigin,preview:w.preview})},h=v=>{for(const w of v)s.context.remove(w.key)},g=()=>{for(const v of s.context.items())s.context.remove(v.key)},y=(v,w)=>{const[,x]=n.child(v);x("session",_=>{const k=Ms.search(_,w.id,O=>O.id),C=[..._];return k.found?(C[k.index]=w,C):(C.splice(k.index,0,w),C)})};return{abort:f,handleSubmit:async v=>{v.preventDefault();const w=s.current(),x=w.map(oe=>"content"in oe?oe.content:"").join(""),_=e.mode()==="shell"&&r.capabilities.shellMode!==!1?"shell":"normal";if(x.trim().length===0&&e.commentCount()===0){e.working()&&f();return}const k=o.model.current(),C=o.agent.current(),O=o.mode.current();if(!k){e.onMissingModel?.(o.model.list().length>0?"select-model":"manage-model-configs");return}if(!C){Nt({title:l.t("prompt.toast.modelAgentRequired.title"),description:l.t("prompt.toast.modelAgentRequired.description")});return}e.addToHistory(w,_),e.resetHistoryNavigation(),ko.start();const z=r.directory,K=!u.id,J=z,T=r.client;let M=e.info();if(!M&&K){const oe=await T.session.create({approval_mode:O}).then(le=>le.data??void 0).catch(le=>{Nt({title:l.t("prompt.toast.sessionCreateFailed.title"),description:d(le)})});oe&&(y(J,oe),M=oe,o.session.promote(J,M.id),a.handoff.setTabs(hf(J),M.id),t(`/${hf(J)}/session/${M.id}`))}if(!M){Nt({title:l.t("prompt.toast.promptSendFailed.title"),description:l.t("prompt.toast.promptSendFailed.description")});return}const U={modelID:k.id,providerID:k.provider.id},A=C.name,j=s.context.items().slice(),P={sessionID:M.id,sessionDirectory:J,prompt:w,context:j,agent:A,model:U,mode:O},B=()=>{s.reset(),e.setMode("normal"),e.setPopover(null)},R=()=>{s.set(w,e.promptLength(w)),e.setMode(_),e.setPopover(null),requestAnimationFrame(()=>{const oe=e.editor();oe&&(oe.focus(),Yr(oe,e.promptLength(w)),e.queueScroll())})};if(!K&&_==="normal"&&e.shouldQueue?.()){e.onQueue?.(P),g(),B();return}if(ko.submit({sessionID:M.id,directory:J}),e.onSubmit?.(),_==="shell"){B(),T.session.shell({sessionID:M.id,agent:A,model:U,command:x}).catch(oe=>{Nt({title:l.t("prompt.toast.shellSendFailed.title"),description:d(oe)}),R()});return}if(x.startsWith("/")){const[oe,...le]=x.split(" "),W=oe.slice(1);if(i.data.command.find(te=>te.name===W)){B(),T.session.command({sessionID:M.id,command:W,arguments:le.join(" "),agent:A,model:`${U.providerID}/${U.modelID}`,approval_mode:O}).catch(te=>{Nt({title:l.t("prompt.toast.commandSendFailed.title"),description:_l(te,l.t,l.t("common.requestFailed"))}),R()});return}}const V=j.filter(oe=>oe.type==="file"&&!!oe.comment?.trim()),Q=rr.ascending("message"),ee=()=>{i.session.optimistic.remove({directory:J,sessionID:M.id,messageID:Q})};h(V),B(),U2({client:T,sync:i,globalSync:n,draft:P,messageID:Q,optimisticBusy:J===z}).catch(oe=>{J===z&&i.set("session_status",M.id,{type:"idle"}),Nt({title:l.t("prompt.toast.promptSendFailed.title"),description:d(oe)}),ee(),m(V),R()})}}}function zA(e,t){e.indexOf(t)===-1&&e.push(t)}function Id(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const zr=(e,t,r)=>r>t?t:r<e?e:r;let Td=()=>{};const Lr={},K2=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function LA(e){return typeof e=="object"&&e!==null}const V2=e=>/^0[^.\s]+$/u.test(e);function B2(e){let t;return()=>(t===void 0&&(t=e()),t)}const Zi=e=>e,FA=(e,t)=>r=>t(e(r)),Dd=(...e)=>e.reduce(FA),Ad=(e,t,r)=>{const i=t-e;return i===0?1:(r-e)/i};class Z2{constructor(){this.subscriptions=[]}add(t){return zA(this.subscriptions,t),()=>Id(this.subscriptions,t)}notify(t,r,i){const n=this.subscriptions.length;if(n)if(n===1)this.subscriptions[0](t,r,i);else for(let o=0;o<n;o++){const s=this.subscriptions[o];s&&s(t,r,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ln=e=>e*1e3,qn=e=>e/1e3;function H2(e,t){return t?e*(1e3/t):0}const NA=(e,t,r)=>{const i=t-e;return((r-e)%i+i)%i+e},q2=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,RA=1e-7,jA=12;function UA(e,t,r,i,n){let o,s,a=0;do s=t+(r-t)/2,o=q2(s,i,n)-e,o>0?r=s:t=s;while(Math.abs(o)>RA&&++a<jA);return s}function as(e,t,r,i){if(e===t&&r===i)return Zi;const n=o=>UA(o,0,1,e,r);return o=>o===0||o===1?o:q2(n(o),t,i)}const G2=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,W2=e=>t=>1-e(1-t),X2=as(.33,1.53,.69,.99),Pd=W2(X2),Y2=G2(Pd),J2=e=>e>=1?1:(e*=2)<1?.5*Pd(e):.5*(2-Math.pow(2,-10*(e-1))),Od=e=>1-Math.sin(Math.acos(e)),KA=W2(Od),Q2=G2(Od),VA=as(.42,0,1,1),BA=as(0,0,.58,1),ew=as(.42,0,.58,1),tw=e=>Array.isArray(e)&&typeof e[0]!="number";function nw(e,t){return tw(e)?e[NA(0,e.length,t)]:e}const rw=e=>Array.isArray(e)&&typeof e[0]=="number",ZA={linear:Zi,easeIn:VA,easeInOut:ew,easeOut:BA,circIn:Od,circInOut:Q2,circOut:KA,backIn:Pd,backInOut:Y2,backOut:X2,anticipate:J2},HA=e=>typeof e=="string",Dm=e=>{if(rw(e)){Td(e.length===4);const[t,r,i,n]=e;return as(t,r,i,n)}else if(HA(e))return ZA[e];return e},$s=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function qA(e,t){let r=new Set,i=new Set,n=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(d){s.has(d)&&(u.schedule(d),e()),d(a)}const u={schedule:(d,f=!1,m=!1)=>{const g=m&&n?r:i;return f&&s.add(d),g.add(d),d},cancel:d=>{i.delete(d),s.delete(d)},process:d=>{if(a=d,n){o=!0;return}n=!0;const f=r;r=i,i=f,r.forEach(l),r.clear(),n=!1,o&&(o=!1,u.process(d))}};return u}const GA=40;function iw(e,t){let r=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,s=$s.reduce((x,_)=>(x[_]=qA(o),x),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:d,update:f,preRender:m,render:h,postRender:g}=s,y=()=>{const x=Lr.useManualTiming,_=x?n.timestamp:performance.now();r=!1,x||(n.delta=i?1e3/60:Math.max(Math.min(_-n.timestamp,GA),1)),n.timestamp=_,n.isProcessing=!0,a.process(n),l.process(n),u.process(n),d.process(n),f.process(n),m.process(n),h.process(n),g.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(y))},b=()=>{r=!0,i=!0,n.isProcessing||e(y)};return{schedule:$s.reduce((x,_)=>{const k=s[_];return x[_]=(C,O=!1,z=!1)=>(r||b(),k.schedule(C,O,z)),x},{}),cancel:x=>{for(let _=0;_<$s.length;_++)s[$s[_]].cancel(x)},state:n,steps:s}}const{schedule:Wn,cancel:Fl,state:Gs}=iw(typeof requestAnimationFrame<"u"?requestAnimationFrame:Zi,!0);let Ps;function WA(){Ps=void 0}const Tn={now:()=>(Ps===void 0&&Tn.set(Gs.isProcessing||Lr.useManualTiming?Gs.timestamp:performance.now()),Ps),set:e=>{Ps=e,queueMicrotask(WA)}},ow=e=>t=>typeof t=="string"&&t.startsWith(e),sw=ow("--"),XA=ow("var(--"),Ed=e=>XA(e)?YA.test(e.split("/*")[0].trim()):!1,YA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Am(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Hi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},zo={...Hi,transform:e=>zr(0,1,e)},Ss={...Hi,default:1},Co=e=>Math.round(e*1e5)/1e5,Md=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function JA(e){return e==null}const QA=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zd=(e,t)=>r=>!!(typeof r=="string"&&QA.test(r)&&r.startsWith(e)||t&&!JA(r)&&Object.prototype.hasOwnProperty.call(r,t)),aw=(e,t,r)=>i=>{if(typeof i!="string")return i;const[n,o,s,a]=i.match(Md);return{[e]:parseFloat(n),[t]:parseFloat(o),[r]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},e6=e=>zr(0,255,e),ll={...Hi,transform:e=>Math.round(e6(e))},ti={test:zd("rgb","red"),parse:aw("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:i=1})=>"rgba("+ll.transform(e)+", "+ll.transform(t)+", "+ll.transform(r)+", "+Co(zo.transform(i))+")"};function t6(e){let t="",r="",i="",n="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),i=e.substring(5,7),n=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),i=e.substring(3,4),n=e.substring(4,5),t+=t,r+=r,i+=i,n+=n),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(i,16),alpha:n?parseInt(n,16)/255:1}}const Nl={test:zd("#"),parse:t6,transform:ti.transform},ls=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ir=ls("deg"),ki=ls("%"),Ze=ls("px"),n6=ls("vh"),r6=ls("vw"),Pm={...ki,parse:e=>ki.parse(e)/100,transform:e=>ki.transform(e*100)},$i={test:zd("hsl","hue"),parse:aw("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:i=1})=>"hsla("+Math.round(e)+", "+ki.transform(Co(t))+", "+ki.transform(Co(r))+", "+Co(zo.transform(i))+")"},qt={test:e=>ti.test(e)||Nl.test(e)||$i.test(e),parse:e=>ti.test(e)?ti.parse(e):$i.test(e)?$i.parse(e):Nl.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ti.transform(e):$i.transform(e),getAnimatableNone:e=>{const t=qt.parse(e);return t.alpha=0,qt.transform(t)}},i6=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function o6(e){return isNaN(e)&&typeof e=="string"&&(e.match(Md)?.length||0)+(e.match(i6)?.length||0)>0}const lw="number",cw="color",s6="var",a6="var(",Om="${}",l6=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Mi(e){const t=e.toString(),r=[],i={color:[],number:[],var:[]},n=[];let o=0;const a=t.replace(l6,l=>(qt.test(l)?(i.color.push(o),n.push(cw),r.push(qt.parse(l))):l.startsWith(a6)?(i.var.push(o),n.push(s6),r.push(l)):(i.number.push(o),n.push(lw),r.push(parseFloat(l))),++o,Om)).split(Om);return{values:r,split:a,indexes:i,types:n}}function c6(e){return Mi(e).values}function uw({split:e,types:t}){const r=e.length;return i=>{let n="";for(let o=0;o<r;o++)if(n+=e[o],i[o]!==void 0){const s=t[o];s===lw?n+=Co(i[o]):s===cw?n+=qt.transform(i[o]):n+=i[o]}return n}}function u6(e){return uw(Mi(e))}const d6=e=>typeof e=="number"?0:qt.test(e)?qt.getAnimatableNone(e):e,f6=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:d6(e);function m6(e){const t=Mi(e);return uw(t)(t.values.map((i,n)=>f6(i,t.split[n])))}const Xn={test:o6,parse:c6,createTransformer:u6,getAnimatableNone:m6};function cl(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function g6({hue:e,saturation:t,lightness:r,alpha:i}){e/=360,t/=100,r/=100;let n=0,o=0,s=0;if(!t)n=o=s=r;else{const a=r<.5?r*(1+t):r+t-r*t,l=2*r-a;n=cl(l,a,e+1/3),o=cl(l,a,e),s=cl(l,a,e-1/3)}return{red:Math.round(n*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:i}}function Ws(e,t){return r=>r>0?t:e}const qi=(e,t,r)=>e+(t-e)*r,ul=(e,t,r)=>{const i=e*e,n=r*(t*t-i)+i;return n<0?0:Math.sqrt(n)},h6=[Nl,ti,$i],p6=e=>h6.find(t=>t.test(e));function Em(e){const t=p6(e);if(!t)return!1;let r=t.parse(e);return t===$i&&(r=g6(r)),r}const Mm=(e,t)=>{const r=Em(e),i=Em(t);if(!r||!i)return Ws(e,t);const n={...r};return o=>(n.red=ul(r.red,i.red,o),n.green=ul(r.green,i.green,o),n.blue=ul(r.blue,i.blue,o),n.alpha=qi(r.alpha,i.alpha,o),ti.transform(n))},Rl=new Set(["none","hidden"]);function v6(e,t){return Rl.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function b6(e,t){return r=>qi(e,t,r)}function Ld(e){return typeof e=="number"?b6:typeof e=="string"?Ed(e)?Ws:qt.test(e)?Mm:x6:Array.isArray(e)?dw:typeof e=="object"?qt.test(e)?Mm:y6:Ws}function dw(e,t){const r=[...e],i=r.length,n=e.map((o,s)=>Ld(o)(o,t[s]));return o=>{for(let s=0;s<i;s++)r[s]=n[s](o);return r}}function y6(e,t){const r={...e,...t},i={};for(const n in r)e[n]!==void 0&&t[n]!==void 0&&(i[n]=Ld(e[n])(e[n],t[n]));return n=>{for(const o in i)r[o]=i[o](n);return r}}function w6(e,t){const r=[],i={color:0,var:0,number:0};for(let n=0;n<t.values.length;n++){const o=t.types[n],s=e.indexes[o][i[o]],a=e.values[s]??0;r[n]=a,i[o]++}return r}const x6=(e,t)=>{const r=Xn.createTransformer(t),i=Mi(e),n=Mi(t);return i.indexes.var.length===n.indexes.var.length&&i.indexes.color.length===n.indexes.color.length&&i.indexes.number.length>=n.indexes.number.length?Rl.has(e)&&!n.values.length||Rl.has(t)&&!i.values.length?v6(e,t):Dd(dw(w6(i,n),n.values),r):Ws(e,t)};function fw(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?qi(e,t,r):Ld(e)(e,t)}const _6=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>Wn.update(t,r),stop:()=>Fl(t),now:()=>Gs.isProcessing?Gs.timestamp:Tn.now()}},mw=(e,t,r=10)=>{let i="";const n=Math.max(Math.round(t/r),2);for(let o=0;o<n;o++)i+=Math.round(e(o/(n-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Xs=2e4;function Fd(e){let t=0;const r=50;let i=e.next(t);for(;!i.done&&t<Xs;)t+=r,i=e.next(t);return t>=Xs?1/0:t}function gw(e,t=100,r){const i=r({...e,keyframes:[0,t]}),n=Math.min(Fd(i),Xs);return{type:"keyframes",ease:o=>i.next(n*o).value/t,duration:qn(n)}}const Ft={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function jl(e,t){return e*Math.sqrt(1-t*t)}const $6=12;function S6(e,t,r){let i=r;for(let n=1;n<$6;n++)i=i-e(i)/t(i);return i}const dl=.001;function k6({duration:e=Ft.duration,bounce:t=Ft.bounce,velocity:r=Ft.velocity,mass:i=Ft.mass}){let n,o,s=1-t;s=zr(Ft.minDamping,Ft.maxDamping,s),e=zr(Ft.minDuration,Ft.maxDuration,qn(e)),s<1?(n=u=>{const d=u*s,f=d*e,m=d-r,h=jl(u,s),g=Math.exp(-f);return dl-m/h*g},o=u=>{const f=u*s*e,m=f*r+r,h=Math.pow(s,2)*Math.pow(u,2)*e,g=Math.exp(-f),y=jl(Math.pow(u,2),s);return(-n(u)+dl>0?-1:1)*((m-h)*g)/y}):(n=u=>{const d=Math.exp(-u*e),f=(u-r)*e+1;return-dl+d*f},o=u=>{const d=Math.exp(-u*e),f=(r-u)*(e*e);return d*f});const a=5/e,l=S6(n,o,a);if(e=Ln(e),isNaN(l))return{stiffness:Ft.stiffness,damping:Ft.damping,duration:e};{const u=Math.pow(l,2)*i;return{stiffness:u,damping:s*2*Math.sqrt(i*u),duration:e}}}const C6=["duration","bounce"],I6=["stiffness","damping","mass"];function zm(e,t){return t.some(r=>e[r]!==void 0)}function T6(e){let t={velocity:Ft.velocity,stiffness:Ft.stiffness,damping:Ft.damping,mass:Ft.mass,isResolvedFromDuration:!1,...e};if(!zm(e,I6)&&zm(e,C6))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,i=2*Math.PI/(r*1.2),n=i*i,o=2*zr(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:Ft.mass,stiffness:n,damping:o}}else{const r=k6({...e,velocity:0});t={...t,...r,mass:Ft.mass},t.isResolvedFromDuration=!0}return t}function Lo(e=Ft.visualDuration,t=Ft.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:n}=r;const o=r.keyframes[0],s=r.keyframes[r.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:u,mass:d,duration:f,velocity:m,isResolvedFromDuration:h}=T6({...r,velocity:-qn(r.velocity||0)}),g=m||0,y=u/(2*Math.sqrt(l*d)),b=s-o,v=qn(Math.sqrt(l/d)),w=Math.abs(b)<5;i||(i=w?Ft.restSpeed.granular:Ft.restSpeed.default),n||(n=w?Ft.restDelta.granular:Ft.restDelta.default);let x,_,k,C,O,z;if(y<1)k=jl(v,y),C=(g+y*v*b)/k,x=J=>{const T=Math.exp(-y*v*J);return s-T*(C*Math.sin(k*J)+b*Math.cos(k*J))},O=y*v*C+b*k,z=y*v*b-C*k,_=J=>Math.exp(-y*v*J)*(O*Math.sin(k*J)+z*Math.cos(k*J));else if(y===1){x=T=>s-Math.exp(-v*T)*(b+(g+v*b)*T);const J=g+v*b;_=T=>Math.exp(-v*T)*(v*J*T-g)}else{const J=v*Math.sqrt(y*y-1);x=A=>{const j=Math.exp(-y*v*A),P=Math.min(J*A,300);return s-j*((g+y*v*b)*Math.sinh(P)+J*b*Math.cosh(P))/J};const T=(g+y*v*b)/J,M=y*v*T-b*J,U=y*v*b-T*J;_=A=>{const j=Math.exp(-y*v*A),P=Math.min(J*A,300);return j*(M*Math.sinh(P)+U*Math.cosh(P))}}const K={calculatedDuration:h&&f||null,velocity:J=>Ln(_(J)),next:J=>{if(!h&&y<1){const M=Math.exp(-y*v*J),U=Math.sin(k*J),A=Math.cos(k*J),j=s-M*(C*U+b*A),P=Ln(M*(O*U+z*A));return a.done=Math.abs(P)<=i&&Math.abs(s-j)<=n,a.value=a.done?s:j,a}const T=x(J);if(h)a.done=J>=f;else{const M=Ln(_(J));a.done=Math.abs(M)<=i&&Math.abs(s-T)<=n}return a.value=a.done?s:T,a},toString:()=>{const J=Math.min(Fd(K),Xs),T=mw(M=>K.next(J*M).value,J,30);return J+"ms "+T},toTransition:()=>{}};return K}Lo.applyToOptions=e=>{const t=gw(e,100,Lo);return e.ease=t.ease,e.duration=Ln(t.duration),e.type="keyframes",e};const D6=5;function hw(e,t,r){const i=Math.max(t-D6,0);return H2(r-e(i),t-i)}function Ul({keyframes:e,velocity:t=0,power:r=.8,timeConstant:i=325,bounceDamping:n=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:d}){const f=e[0],m={done:!1,value:f},h=z=>a!==void 0&&z<a||l!==void 0&&z>l,g=z=>a===void 0?l:l===void 0||Math.abs(a-z)<Math.abs(l-z)?a:l;let y=r*t;const b=f+y,v=s===void 0?b:s(b);v!==b&&(y=v-f);const w=z=>-y*Math.exp(-z/i),x=z=>v+w(z),_=z=>{const K=w(z),J=x(z);m.done=Math.abs(K)<=u,m.value=m.done?v:J};let k,C;const O=z=>{h(m.value)&&(k=z,C=Lo({keyframes:[m.value,g(m.value)],velocity:hw(x,z,m.value),damping:n,stiffness:o,restDelta:u,restSpeed:d}))};return O(0),{calculatedDuration:null,next:z=>{let K=!1;return!C&&k===void 0&&(K=!0,_(z),O(z)),k!==void 0&&z>=k?C.next(z-k):(!K&&_(z),m)}}}function A6(e,t,r){const i=[],n=r||Lr.mix||fw,o=e.length-1;for(let s=0;s<o;s++){let a=n(e[s],e[s+1]);if(t){const l=Array.isArray(t)?t[s]||Zi:t;a=Dd(l,a)}i.push(a)}return i}function P6(e,t,{clamp:r=!0,ease:i,mixer:n}={}){const o=e.length;if(Td(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=A6(t,i,n),l=a.length,u=d=>{if(s&&d<e[0])return t[0];let f=0;if(l>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const m=Ad(e[f],e[f+1],d);return a[f](m)};return r?d=>u(zr(e[0],e[o-1],d)):u}function pw(e,t){const r=e[e.length-1];for(let i=1;i<=t;i++){const n=Ad(0,t,i);e.push(qi(r,1,n))}}function vw(e){const t=[0];return pw(t,e.length-1),t}function O6(e,t){return e.map(r=>r*t)}function E6(e,t){return e.map(()=>t||ew).splice(0,e.length-1)}function Io({duration:e=300,keyframes:t,times:r,ease:i="easeInOut"}){const n=tw(i)?i.map(Dm):Dm(i),o={done:!1,value:t[0]},s=O6(r&&r.length===t.length?r:vw(t),e),a=P6(s,t,{ease:Array.isArray(n)?n:E6(t,n)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const M6=e=>e!==null;function La(e,{repeat:t,repeatType:r="loop"},i,n=1){const o=e.filter(M6),a=n<0||t&&r!=="loop"&&t%2===1?0:o.length-1;return!a||i===void 0?o[a]:i}const z6={decay:Ul,inertia:Ul,tween:Io,keyframes:Io,spring:Lo};function bw(e){typeof e.type=="string"&&(e.type=z6[e.type])}class Nd{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,r){return this.finished.then(t,r)}}const L6=e=>e/100;class Fo extends Nd{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:r}=this.options;r&&r.updatedAt!==Tn.now()&&this.tick(Tn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;bw(t);const{type:r=Io,repeat:i=0,repeatDelay:n=0,repeatType:o,velocity:s=0}=t;let{keyframes:a}=t;const l=r||Io;l!==Io&&typeof a[0]!="number"&&(this.mixKeyframes=Dd(L6,fw(a[0],a[1])),a=[0,100]);const u=l({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-s})),u.calculatedDuration===null&&(u.calculatedDuration=Fd(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+n,this.totalDuration=this.resolvedDuration*(i+1)-n,this.generator=u}updateTime(t){const r=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(t,r=!1){const{generator:i,totalDuration:n,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return i.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:m,repeatDelay:h,type:g,onUpdate:y,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-n/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const v=this.currentTime-u*(this.playbackSpeed>=0?1:-1),w=this.playbackSpeed>=0?v<0:v>n;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=n);let x=this.currentTime,_=i;if(f){const z=Math.min(this.currentTime,n)/a;let K=Math.floor(z),J=z%1;!J&&z>=1&&(J=1),J===1&&K--,K=Math.min(K,f+1),!!(K%2)&&(m==="reverse"?(J=1-J,h&&(J-=h/a)):m==="mirror"&&(_=s)),x=zr(0,1,J)*a}let k;w?(this.delayState.value=d[0],k=this.delayState):k=_.next(x),o&&!w&&(k.value=o(k.value));let{done:C}=k;!w&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return O&&g!==Ul&&(k.value=La(d,this.options,b,this.speed)),y&&y(k.value),O&&this.finish(),k}then(t,r){return this.finished.then(t,r)}get duration(){return qn(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+qn(t)}get time(){return qn(this.currentTime)}set time(t){t=Ln(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const r=this.generator.next(t).value;return hw(i=>this.generator.next(i).value,t,r)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;r&&this.driver&&this.updateTime(Tn.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=qn(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=_6,startTime:r}=this.options;this.driver||(this.driver=t(n=>this.tick(n))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=r??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Tn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function F6(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ni=e=>e*180/Math.PI,Kl=e=>{const t=ni(Math.atan2(e[1],e[0]));return Vl(t)},N6={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Kl,rotateZ:Kl,skewX:e=>ni(Math.atan(e[1])),skewY:e=>ni(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Vl=e=>(e=e%360,e<0&&(e+=360),e),Lm=Kl,Fm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Nm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),R6={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fm,scaleY:Nm,scale:e=>(Fm(e)+Nm(e))/2,rotateX:e=>Vl(ni(Math.atan2(e[6],e[5]))),rotateY:e=>Vl(ni(Math.atan2(-e[2],e[0]))),rotateZ:Lm,rotate:Lm,skewX:e=>ni(Math.atan(e[4])),skewY:e=>ni(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Bl(e){return e.includes("scale")?1:0}function Zl(e,t){if(!e||e==="none")return Bl(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,n;if(r)i=R6,n=r;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=N6,n=a}if(!n)return Bl(t);const o=i[t],s=n[1].split(",").map(U6);return typeof o=="function"?o(s):s[o]}const j6=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return Zl(r,t)};function U6(e){return parseFloat(e.trim())}const Gi=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wi=new Set(Gi),Rm=e=>e===Hi||e===Ze,K6=new Set(["x","y","z"]),V6=Gi.filter(e=>!K6.has(e));function B6(e){const t=[];return V6.forEach(r=>{const i=e.getValue(r);i!==void 0&&(t.push([r,i.get()]),i.set(r.startsWith("scale")?1:0))}),t}const Ar={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:i})=>{const n=e.max-e.min;return i==="border-box"?n:n-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:i})=>{const n=e.max-e.min;return i==="border-box"?n:n-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Zl(t,"x"),y:(e,{transform:t})=>Zl(t,"y")};Ar.translateX=Ar.x;Ar.translateY=Ar.y;const ii=new Set;let Hl=!1,ql=!1,Gl=!1;function yw(){if(ql){const e=Array.from(ii).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),r=new Map;t.forEach(i=>{const n=B6(i);n.length&&(r.set(i,n),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const n=r.get(i);n&&n.forEach(([o,s])=>{i.getValue(o)?.set(s)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}ql=!1,Hl=!1,ii.forEach(e=>e.complete(Gl)),ii.clear()}function ww(){ii.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ql=!0)})}function Z6(){Gl=!0,ww(),yw(),Gl=!1}class Rd{constructor(t,r,i,n,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=i,this.motionValue=n,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(ii.add(this),Hl||(Hl=!0,Wn.read(ww),Wn.resolveKeyframes(yw))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:i,motionValue:n}=this;if(t[0]===null){const o=n?.get(),s=t[t.length-1];if(o!==void 0)t[0]=o;else if(i&&r){const a=i.readValue(r,s);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=s),n&&o===void 0&&n.set(t[0])}F6(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ii.delete(this)}cancel(){this.state==="scheduled"&&(ii.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const H6=e=>e.startsWith("--");function xw(e,t,r){H6(t)?e.style.setProperty(t,r):e.style[t]=r}const q6={};function _w(e,t){const r=B2(e);return()=>q6[t]??r()}const G6=_w(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),$w=_w(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),xo=([e,t,r,i])=>`cubic-bezier(${e}, ${t}, ${r}, ${i})`,jm={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:xo([0,.65,.55,1]),circOut:xo([.55,0,1,.45]),backIn:xo([.31,.01,.66,-.59]),backOut:xo([.33,1.53,.69,.99])};function Sw(e,t){if(e)return typeof e=="function"?$w()?mw(e,t):"ease-out":rw(e)?xo(e):Array.isArray(e)?e.map(r=>Sw(r,t)||jm.easeOut):jm[e]}function W6(e,t,r,{delay:i=0,duration:n=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},u=void 0){const d={[t]:r};l&&(d.offset=l);const f=Sw(a,n);Array.isArray(f)&&(d.easing=f);const m={delay:i,duration:n,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return u&&(m.pseudoElement=u),e.animate(d,m)}function jd(e){return typeof e=="function"&&"applyToOptions"in e}function X6({type:e,...t}){return jd(e)&&$w()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class kw extends Nd{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:r,name:i,keyframes:n,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=t,Td(typeof t.type!="string");const u=X6(t);this.animation=W6(r,i,n,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=La(n,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(d),xw(r,i,d),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return qn(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+qn(t)}get time(){return qn(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ln(t),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:r,rangeEnd:i,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&G6()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),i&&(this.animation.rangeEnd=i),Zi):n(this)}}const Cw={anticipate:J2,backInOut:Y2,circInOut:Q2};function Y6(e){return e in Cw}function J6(e){typeof e.ease=="string"&&Y6(e.ease)&&(e.ease=Cw[e.ease])}const fl=10;class Q6 extends kw{constructor(t){J6(t),bw(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:i,onComplete:n,element:o,...s}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const a=new Fo({...s,autoplay:!1}),l=Math.max(fl,Tn.now()-this.startTime),u=zr(0,fl,l-fl),d=a.sample(l).value,{name:f}=this.options;o&&f&&xw(o,f,d),r.setWithVelocity(a.sample(Math.max(0,l-u)).value,d,u),a.stop()}}const Um=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Xn.test(e)||e==="0")&&!e.startsWith("url("));function eP(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function tP(e,t,r,i){const n=e[0];if(n===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],s=Um(n,t),a=Um(o,t);return!s||!a?!1:eP(e)||(r==="spring"||jd(r))&&i}function Wl(e){e.duration=0,e.type="keyframes"}const Iw=new Set(["opacity","clipPath","filter","transform"]),nP=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function rP(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&nP.test(e[t]))return!0;return!1}const iP=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),oP=B2(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function sP(e){const{motionValue:t,name:r,repeatDelay:i,repeatType:n,damping:o,type:s,keyframes:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return oP()&&r&&(Iw.has(r)||iP.has(r)&&rP(a))&&(r!=="transform"||!d)&&!u&&!i&&n!=="mirror"&&o!==0&&s!=="inertia"}const aP=40;class lP extends Nd{constructor({autoplay:t=!0,delay:r=0,type:i="keyframes",repeat:n=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:l,motionValue:u,element:d,...f}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Tn.now();const m={autoplay:t,delay:r,type:i,repeat:n,repeatDelay:o,repeatType:s,name:l,motionValue:u,element:d,...f},h=d?.KeyframeResolver||Rd;this.keyframeResolver=new h(a,(g,y,b)=>this.onKeyframesResolved(g,y,m,!b),l,u,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,r,i,n){this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:l,isHandoff:u,onUpdate:d}=i;this.resolvedAt=Tn.now();let f=!0;tP(t,o,s,a)||(f=!1,(Lr.instantAnimations||!l)&&d?.(La(t,i,r)),t[0]=t[t.length-1],Wl(i),i.repeat=0);const h={startTime:n?this.resolvedAt?this.resolvedAt-this.createdAt>aP?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...i,keyframes:t},g=f&&!u&&sP(h),y=h.motionValue?.owner?.current;let b;if(g)try{b=new Q6({...h,element:y})}catch{b=new Fo(h)}else b=new Fo(h);b.finished.then(()=>{this.notifyFinished()}).catch(Zi),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}get finished(){return this._animation?this.animation.finished:this._finished}then(t,r){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Z6()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class cP{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,r){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=r}attachTimeline(t){const r=this.animations.map(i=>i.attachTimeline(t));return()=>{r.forEach((i,n)=>{i&&i(),this.animations[n].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return Km(this.animations,"duration")}get iterationDuration(){return Km(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(r=>r[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Km(e,t){let r=0;for(let i=0;i<e.length;i++){const n=e[i][t];n!==null&&n>r&&(r=n)}return r}class uP extends cP{then(t,r){return this.finished.finally(t).then(()=>{})}}const dP=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fP(e){const t=dP.exec(e);if(!t)return[,];const[,r,i,n]=t;return[`--${r??i}`,n]}function Tw(e,t,r=1){const[i,n]=fP(e);if(!i)return;const o=window.getComputedStyle(t).getPropertyValue(i);if(o){const s=o.trim();return K2(s)?parseFloat(s):s}return Ed(n)?Tw(n,t,r+1):n}const mP={type:"spring",stiffness:500,damping:25,restSpeed:10},gP=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),hP={type:"keyframes",duration:.8},pP={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vP=(e,{keyframes:t})=>t.length>2?hP:Wi.has(e)?e.startsWith("scale")?gP(t[1]):mP:pP;function Dw(e,t){if(e?.inherit&&t){const{inherit:r,...i}=e;return{...t,...i}}return e}function Aw(e,t){const r=e?.[t]??e?.default??e;return r!==e?Dw(r,e):r}const bP=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function yP(e){for(const t in e)if(!bP.has(t))return!0;return!1}const Pw=(e,t,r,i={},n,o)=>s=>{const a=Aw(i,e)||{},l=a.delay||i.delay||0;let{elapsed:u=0}=i;u=u-Ln(l);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:m=>{t.set(m),a.onUpdate&&a.onUpdate(m)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:n};yP(a)||Object.assign(d,vP(e,d)),d.duration&&(d.duration=Ln(d.duration)),d.repeatDelay&&(d.repeatDelay=Ln(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Wl(d),d.delay===0&&(f=!0)),(Lr.instantAnimations||Lr.skipAnimations||n?.shouldSkipAnimations)&&(f=!0,Wl(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,f&&!o&&t.get()!==void 0){const m=La(d.keyframes,a);if(m!==void 0){Wn.update(()=>{d.onUpdate(m),d.onComplete()});return}}return a.isSync?new Fo(d):new lP(d)};function Vm(e){const t=[{},{}];return e?.values.forEach((r,i)=>{t[0][i]=r.get(),t[1][i]=r.getVelocity()}),t}function Ow(e,t,r,i){if(typeof t=="function"){const[n,o]=Vm(i);t=t(r!==void 0?r:e.custom,n,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[n,o]=Vm(i);t=t(r!==void 0?r:e.custom,n,o)}return t}function wP(e,t,r){const i=e.getProps();return Ow(i,t,i.custom,e)}const Ew=new Set(["width","height","top","left","right","bottom",...Gi]),Bm=30,xP=e=>!isNaN(parseFloat(e));class _P{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const n=Tn.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=Tn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xP(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new Z2);const i=this.events[t].add(r);return t==="change"?()=>{i(),Wn.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,r,i){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Tn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Bm)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,Bm);return H2(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Fr(e,t){return new _P(e,t)}const $P=e=>Array.isArray(e);function SP(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Fr(r))}function kP(e){return $P(e)?e[e.length-1]||0:e}function CP(e,t){const r=wP(e,t);let{transitionEnd:i={},transition:n={},...o}=r||{};o={...o,...i};for(const s in o){const a=kP(o[s]);SP(e,s,a)}}const cn=e=>!!(e&&e.getVelocity);function IP(e){return!!(cn(e)&&e.add)}function TP(e,t){const r=e.getValue("willChange");if(IP(r))return r.add(t);if(!r&&Lr.WillChange){const i=new Lr.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function Ud(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const DP="framerAppearId",AP="data-"+Ud(DP);function PP(e){return e.props[AP]}function OP({protectedKeys:e,needsAnimating:t},r){const i=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,i}function EP(e,t,{delay:r=0,transitionOverride:i,type:n}={}){let{transition:o,transitionEnd:s,...a}=t;const l=e.getDefaultTransition();o=o?Dw(o,l):l;const u=o?.reduceMotion;i&&(o=i);const d=[],f=n&&e.animationState&&e.animationState.getState()[n];for(const m in a){const h=e.getValue(m,e.latestValues[m]??null),g=a[m];if(g===void 0||f&&OP(f,m))continue;const y={delay:r,...Aw(o||{},m)},b=h.get();if(b!==void 0&&!h.isAnimating()&&!Array.isArray(g)&&g===b&&!y.velocity){Wn.update(()=>h.set(g));continue}let v=!1;if(window.MotionHandoffAnimation){const _=PP(e);if(_){const k=window.MotionHandoffAnimation(_,m,Wn);k!==null&&(y.startTime=k,v=!0)}}TP(e,m);const w=u??e.shouldReduceMotion;h.start(Pw(m,h,g,w&&Ew.has(m)?{type:!1}:y,e,v));const x=h.animation;x&&d.push(x)}if(s){const m=()=>Wn.update(()=>{s&&CP(e,s)});d.length?Promise.all(d).then(m):m()}return d}const MP={test:e=>e==="auto",parse:e=>e},Mw=e=>t=>t.test(e),zw=[Hi,Ze,ki,Ir,r6,n6,MP],Zm=e=>zw.find(Mw(e));function zP(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||V2(e):!0}const LP=new Set(["brightness","contrast","saturate","opacity"]);function FP(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=r.match(Md)||[];if(!i)return e;const n=r.replace(i,"");let o=LP.has(t)?1:0;return i!==r&&(o*=100),t+"("+o+n+")"}const NP=/\b([a-z-]*)\(.*?\)/gu,Xl={...Xn,getAnimatableNone:e=>{const t=e.match(NP);return t?t.map(FP).join(" "):e}},Yl={...Xn,getAnimatableNone:e=>{const t=Xn.parse(e);return Xn.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},Hm={...Hi,transform:Math.round},RP={rotate:Ir,rotateX:Ir,rotateY:Ir,rotateZ:Ir,scale:Ss,scaleX:Ss,scaleY:Ss,scaleZ:Ss,skew:Ir,skewX:Ir,skewY:Ir,distance:Ze,translateX:Ze,translateY:Ze,translateZ:Ze,x:Ze,y:Ze,z:Ze,perspective:Ze,transformPerspective:Ze,opacity:zo,originX:Pm,originY:Pm,originZ:Ze},Kd={borderWidth:Ze,borderTopWidth:Ze,borderRightWidth:Ze,borderBottomWidth:Ze,borderLeftWidth:Ze,borderRadius:Ze,borderTopLeftRadius:Ze,borderTopRightRadius:Ze,borderBottomRightRadius:Ze,borderBottomLeftRadius:Ze,width:Ze,maxWidth:Ze,height:Ze,maxHeight:Ze,top:Ze,right:Ze,bottom:Ze,left:Ze,inset:Ze,insetBlock:Ze,insetBlockStart:Ze,insetBlockEnd:Ze,insetInline:Ze,insetInlineStart:Ze,insetInlineEnd:Ze,padding:Ze,paddingTop:Ze,paddingRight:Ze,paddingBottom:Ze,paddingLeft:Ze,paddingBlock:Ze,paddingBlockStart:Ze,paddingBlockEnd:Ze,paddingInline:Ze,paddingInlineStart:Ze,paddingInlineEnd:Ze,margin:Ze,marginTop:Ze,marginRight:Ze,marginBottom:Ze,marginLeft:Ze,marginBlock:Ze,marginBlockStart:Ze,marginBlockEnd:Ze,marginInline:Ze,marginInlineStart:Ze,marginInlineEnd:Ze,fontSize:Ze,backgroundPositionX:Ze,backgroundPositionY:Ze,...RP,zIndex:Hm,fillOpacity:zo,strokeOpacity:zo,numOctaves:Hm},jP={...Kd,color:qt,backgroundColor:qt,outlineColor:qt,fill:qt,stroke:qt,borderColor:qt,borderTopColor:qt,borderRightColor:qt,borderBottomColor:qt,borderLeftColor:qt,filter:Xl,WebkitFilter:Xl,mask:Yl,WebkitMask:Yl},Lw=e=>jP[e],UP=new Set([Xl,Yl]);function Fw(e,t){let r=Lw(e);return UP.has(r)||(r=Xn),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const KP=new Set(["auto","none","0"]);function VP(e,t,r){let i=0,n;for(;i<e.length&&!n;){const o=e[i];typeof o=="string"&&!KP.has(o)&&Mi(o).values.length&&(n=e[i]),i++}if(n&&r)for(const o of t)e[o]=Fw(r,n)}class BP extends Rd{constructor(t,r,i,n,o){super(t,r,i,n,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:i}=this;if(!r||!r.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let f=t[d];if(typeof f=="string"&&(f=f.trim(),Ed(f))){const m=Tw(f,r.current);m!==void 0&&(t[d]=m),d===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!Ew.has(i)||t.length!==2)return;const[n,o]=t,s=Zm(n),a=Zm(o),l=Am(n),u=Am(o);if(l!==u&&Ar[i]){this.needsMeasurement=!0;return}if(s!==a)if(Rm(s)&&Rm(a))for(let d=0;d<t.length;d++){const f=t[d];typeof f=="string"&&(t[d]=parseFloat(f))}else Ar[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,i=[];for(let n=0;n<t.length;n++)(t[n]===null||zP(t[n]))&&i.push(n);i.length&&VP(t,i,r)}measureInitialState(){const{element:t,unresolvedKeyframes:r,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ar[i](t.measureViewportBox(),window.getComputedStyle(t.current)),r[0]=this.measuredOrigin;const n=r[r.length-1];n!==void 0&&t.getValue(i,n).jump(n,!1)}measureEndState(){const{element:t,name:r,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const n=t.getValue(r);n&&n.jump(this.measuredOrigin,!1);const o=i.length-1,s=i[o];i[o]=Ar[r](t.measureViewportBox(),window.getComputedStyle(t.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,l])=>{t.getValue(a).set(l)}),this.resolveNoneKeyframes()}}function ZP(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;t&&(i=t.current);const n=r?.[e]??i.querySelectorAll(e);return n?Array.from(n):[]}return Array.from(e).filter(i=>i!=null)}const Nw=(e,t)=>t&&typeof e=="number"?t.transform(e):e,{schedule:HP}=iw(queueMicrotask,!1);function Rw(e){return LA(e)&&"ownerSVGElement"in e}function qP(e){return Rw(e)&&e.tagName==="svg"}function GP(e,t,r={}){const i=e.get();let n=null,o=i,s;const a=typeof i=="string"?i.replace(/[\d.-]/g,""):void 0,l=()=>{n&&(n.stop(),n=null),e.animation=void 0},u=()=>{const f=qm(e.get()),m=qm(o);if(f===m){l();return}const h=n?n.getGeneratorVelocity():e.getVelocity();l(),n=new Fo({keyframes:[f,m],velocity:h,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:s})},d=()=>{u(),e.animation=n??void 0,e.events.animationStart?.notify(),n?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((f,m)=>{o=f,s=h=>m(ml(h,a)),Wn.postRender(d)},l),cn(t)){let f=r.skipInitialAnimation===!0;const m=t.on("change",g=>{f?(f=!1,e.jump(ml(g,a),!1)):e.set(ml(g,a))}),h=e.on("destroy",m);return()=>{m(),h()}}return l}function ml(e,t){return t?e+t:e}function qm(e){return typeof e=="number"?e:parseFloat(e)}function Gm(e,t,r){return GP(e,t,{type:"spring",...r})}const WP=[...zw,qt,Xn],XP=e=>WP.find(Mw(e)),Wm=()=>({min:0,max:0}),Vd=()=>({x:Wm(),y:Wm()}),No=new WeakMap;function YP(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function JP(e){return typeof e=="string"||Array.isArray(e)}const QP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],eO=["initial",...QP];function jw(e){return YP(e.animate)||eO.some(t=>JP(e[t]))}function tO(e){return!!(jw(e)||e.variants)}function nO(e,t,r){for(const i in t){const n=t[i],o=r[i];if(cn(n))e.addValue(i,n);else if(cn(o))e.addValue(i,Fr(n,{owner:e}));else if(o!==n)if(e.hasValue(i)){const s=e.getValue(i);s.liveStyle===!0?s.jump(n):s.hasAnimated||s.set(n)}else{const s=e.getStaticValue(i);e.addValue(i,Fr(s!==void 0?s:n,{owner:e}))}}for(const i in r)t[i]===void 0&&e.removeValue(i);return t}const Jl={current:null},Uw={current:!1},rO=typeof window<"u";function iO(){if(Uw.current=!0,!!rO)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Jl.current=e.matches;e.addEventListener("change",t),t()}else Jl.current=!1}const Xm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ym={};class Kw{scrapeMotionValuesFromProps(t,r,i){return{}}constructor({parent:t,props:r,presenceContext:i,reducedMotionConfig:n,skipAnimations:o,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Rd,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=Tn.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,Wn.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=a;this.latestValues=u,this.baseTarget={...u},this.initialValues=r.initial?{...u}:{},this.renderState=d,this.parent=t,this.props=r,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=o,this.options=l,this.blockInitialAnimation=!!s,this.isControllingVariants=jw(r),this.isVariantNode=tO(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...m}=this.scrapeMotionValuesFromProps(r,{},this);for(const h in m){const g=m[h];u[h]!==void 0&&cn(g)&&g.set(u[h])}}mount(t){if(this.hasBeenMounted)for(const r in this.initialValues)this.values.get(r)?.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=t,No.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Uw.current||iO(),this.shouldReduceMotion=Jl.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Fl(this.notifyUpdate),Fl(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const r=this.features[t];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),r.accelerate&&Iw.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:a,times:l,ease:u,duration:d}=r.accelerate,f=new kw({element:this.current,name:t,keyframes:a,times:l,ease:u,duration:Ln(d)}),m=s(f);this.valueSubscriptions.set(t,()=>{m(),f.cancel()});return}const i=Wi.has(t);i&&this.onBindTransform&&this.onBindTransform();const n=r.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&Wn.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{n(),o&&o(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ym){const r=Ym[t];if(!r)continue;const{isEnabled:i,Feature:n}=r;if(!this.features[t]&&n&&i(this.props)&&(this.features[t]=new n(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Vd()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let i=0;i<Xm.length;i++){const n=Xm[i];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const o="on"+n,s=t[o];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=nO(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const i=this.values.get(t);r!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&r!==void 0&&(i=Fr(r===null?void 0:r,{owner:this}),this.addValue(t,i)),i}readValue(t,r){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(K2(i)||V2(i))?i=parseFloat(i):!XP(i)&&Xn.test(r)&&(i=Fw(t,r)),this.setBaseTarget(t,cn(i)?i.get():i)),cn(i)?i.get():i}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const o=Ow(this.props,r,this.presenceContext?.custom);o&&(i=o[t])}if(r&&i!==void 0)return i;const n=this.getBaseTargetFromProps(this.props,t);return n!==void 0&&!cn(n)?n:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Z2),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){HP.render(this.render)}}class Vw extends Kw{constructor(){super(...arguments),this.KeyframeResolver=BP}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){const i=t.style;return i?i[r]:void 0}removeValueFromRenderState(t,{vars:r,style:i}){delete r[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;cn(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function oO({top:e,left:t,right:r,bottom:i}){return{x:{min:t,max:r},y:{min:e,max:i}}}function sO(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:i.y,right:i.x}}function aO(e,t){return oO(sO(e.getBoundingClientRect(),t))}const lO={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cO=Gi.length;function uO(e,t,r){let i="",n=!0;for(let o=0;o<cO;o++){const s=Gi[o],a=e[s];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(s.startsWith("scale")?1:0);else{const u=parseFloat(a);l=s.startsWith("scale")?u===1:u===0}if(!l||r){const u=Nw(a,Kd[s]);if(!l){n=!1;const d=lO[s]||s;i+=`${d}(${u}) `}r&&(t[s]=u)}}return i=i.trim(),r?i=r(t,n?"":i):n&&(i="none"),i}function Bw(e,t,r){const{style:i,vars:n,transformOrigin:o}=e;let s=!1,a=!1;for(const l in t){const u=t[l];if(Wi.has(l)){s=!0;continue}else if(sw(l)){n[l]=u;continue}else{const d=Nw(u,Kd[l]);l.startsWith("origin")?(a=!0,o[l]=d):i[l]=d}}if(t.transform||(s||r?i.transform=uO(t,e.transform,r):i.transform&&(i.transform="none")),a){const{originX:l="50%",originY:u="50%",originZ:d=0}=o;i.transformOrigin=`${l} ${u} ${d}`}}function Zw(e,{style:t,vars:r},i,n){const o=e.style;let s;for(s in t)o[s]=t[s];n?.applyProjectionStyles(o,i);for(s in r)o.setProperty(s,r[s])}function Jm(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ho={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ze.test(e))e=parseFloat(e);else return e;const r=Jm(e,t.target.x),i=Jm(e,t.target.y);return`${r}% ${i}%`}},dO={correct:(e,{treeScale:t,projectionDelta:r})=>{const i=e,n=Xn.parse(e);if(n.length>5)return i;const o=Xn.createTransformer(e),s=typeof n[0]!="number"?1:0,a=r.x.scale*t.x,l=r.y.scale*t.y;n[0+s]/=a,n[1+s]/=l;const u=qi(a,l,.5);return typeof n[2+s]=="number"&&(n[2+s]/=u),typeof n[3+s]=="number"&&(n[3+s]/=u),o(n)}},fO={borderRadius:{...ho,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ho,borderTopRightRadius:ho,borderBottomLeftRadius:ho,borderBottomRightRadius:ho,boxShadow:dO};function mO(e,{layout:t,layoutId:r}){return Wi.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!fO[e]||e==="opacity")}function Hw(e,t,r){const i=e.style,n=t?.style,o={};if(!i)return o;for(const s in i)(cn(i[s])||n&&cn(n[s])||mO(s,e)||r?.getValue(s)?.liveStyle!==void 0)&&(o[s]=i[s]);return o}function gO(e){return window.getComputedStyle(e)}class hO extends Vw{constructor(){super(...arguments),this.type="html",this.renderInstance=Zw}readValueFromInstance(t,r){if(Wi.has(r))return this.projection?.isProjecting?Bl(r):j6(t,r);{const i=gO(t),n=(sw(r)?i.getPropertyValue(r):i[r])||0;return typeof n=="string"?n.trim():n}}measureInstanceViewportBox(t,{transformPagePoint:r}){return aO(t,r)}build(t,r,i){Bw(t,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,r,i){return Hw(t,r,i)}}function pO(e,t){return e in t}class vO extends Kw{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,r){if(pO(r,t)){const i=t[r];if(typeof i=="string"||typeof i=="number")return i}}getBaseTargetFromProps(){}removeValueFromRenderState(t,r){delete r.output[t]}measureInstanceViewportBox(){return Vd()}build(t,r){Object.assign(t.output,r)}renderInstance(t,{output:r}){Object.assign(t,r)}sortInstanceNodePosition(){return 0}}const bO={offset:"stroke-dashoffset",array:"stroke-dasharray"},yO={offset:"strokeDashoffset",array:"strokeDasharray"};function wO(e,t,r=1,i=0,n=!0){e.pathLength=1;const o=n?bO:yO;e[o.offset]=`${-i}`,e[o.array]=`${t} ${r}`}const xO=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function _O(e,{attrX:t,attrY:r,attrScale:i,pathLength:n,pathSpacing:o=1,pathOffset:s=0,...a},l,u,d){if(Bw(e,a,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m}=e;f.transform&&(m.transform=f.transform,delete f.transform),(m.transform||f.transformOrigin)&&(m.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),m.transform&&(m.transformBox=d?.transformBox??"fill-box",delete f.transformBox);for(const h of xO)f[h]!==void 0&&(m[h]=f[h],delete f[h]);t!==void 0&&(f.x=t),r!==void 0&&(f.y=r),i!==void 0&&(f.scale=i),n!==void 0&&wO(f,n,o,s,!1)}const qw=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),$O=e=>typeof e=="string"&&e.toLowerCase()==="svg";function SO(e,t,r,i){Zw(e,t,void 0,i);for(const n in t.attrs)e.setAttribute(qw.has(n)?n:Ud(n),t.attrs[n])}function kO(e,t,r){const i=Hw(e,t,r);for(const n in e)if(cn(e[n])||cn(t[n])){const o=Gi.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;i[o]=e[n]}return i}class CO extends Vw{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Vd}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Wi.has(r)){const i=Lw(r);return i&&i.default||0}return r=qw.has(r)?r:Ud(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,i){return kO(t,r,i)}build(t,r,i){_O(t,r,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,r,i,n){SO(t,r,i,n)}mount(t){this.isSVGTag=$O(t.tagName),super.mount(t)}}function IO(e,t,r){const i=cn(e)?e:Fr(e);return i.start(Pw("",i,t,r)),i.animation}function Bd(e){return typeof e=="object"&&!Array.isArray(e)}function Gw(e,t,r,i){return e==null?[]:typeof e=="string"&&Bd(t)?ZP(e,r,i):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(n=>n!=null):[e]}function TO(e,t,r){return e*(t+1)}function Qm(e,t,r,i){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?r:t.startsWith("<")?Math.max(0,r+parseFloat(t.slice(1))):i.get(t)??e}function DO(e,t,r){for(let i=0;i<e.length;i++){const n=e[i];n.at>t&&n.at<r&&(Id(e,n),i--)}}function AO(e,t,r,i,n,o){DO(e,n,o);for(let s=0;s<t.length;s++)e.push({value:t[s],at:qi(n,o,i[s]),easing:nw(r,s)})}function PO(e,t){for(let r=0;r<e.length;r++)e[r]=e[r]/(t+1)}function OO(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const EO="easeInOut";function MO(e,{defaultTransition:t={},...r}={},i,n){const o=t.duration||.3,s=new Map,a=new Map,l={},u=new Map;let d=0,f=0,m=0;for(let h=0;h<e.length;h++){const g=e[h];if(typeof g=="string"){u.set(g,f);continue}else if(!Array.isArray(g)){u.set(g.name,Qm(f,g.at,d,u));continue}let[y,b,v={}]=g;v.at!==void 0&&(f=Qm(f,v.at,d,u));let w=0;const x=(_,k,C,O=0,z=0)=>{const K=zO(_),{delay:J=0,times:T=vw(K),type:M=t.type||"keyframes",repeat:U,repeatType:A,repeatDelay:j=0,...P}=k;let{ease:B=t.ease||"easeOut",duration:R}=k;const V=typeof J=="function"?J(O,z):J,Q=K.length,ee=jd(M)?M:n?.[M||"keyframes"];if(Q<=2&&ee){let D=100;if(Q===2&&NO(K)){const Z=K[1]-K[0];D=Math.abs(Z)}const te={...t,...P};R!==void 0&&(te.duration=Ln(R));const H=gw(te,D,ee);B=H.ease,R=H.duration}R??(R=o);const oe=f+V;T.length===1&&T[0]===0&&(T[1]=1);const le=T.length-K.length;if(le>0&&pw(T,le),K.length===1&&K.unshift(null),U){R=TO(R,U);const D=[...K],te=[...T];B=Array.isArray(B)?[...B]:[B];const H=[...B];for(let Z=0;Z<U;Z++){K.push(...D);for(let se=0;se<D.length;se++)T.push(te[se]+(Z+1)),B.push(se===0?"linear":nw(H,se-1))}PO(T,U)}const W=oe+R;AO(C,K,B,T,oe,W),w=Math.max(V+R,w),m=Math.max(W,m)};if(cn(y)){const _=eg(y,a);x(b,v,tg("default",_))}else{const _=Gw(y,b,i,l),k=_.length;for(let C=0;C<k;C++){b=b,v=v;const O=_[C],z=eg(O,a);for(const K in b)x(b[K],LO(v,K),tg(K,z),C,k)}}d=f,f+=w}return a.forEach((h,g)=>{for(const y in h){const b=h[y];b.sort(OO);const v=[],w=[],x=[];for(let O=0;O<b.length;O++){const{at:z,value:K,easing:J}=b[O];v.push(K),w.push(Ad(0,m,z)),x.push(J||"easeOut")}w[0]!==0&&(w.unshift(0),v.unshift(v[0]),x.unshift(EO)),w[w.length-1]!==1&&(w.push(1),v.push(null)),s.has(g)||s.set(g,{keyframes:{},transition:{}});const _=s.get(g);_.keyframes[y]=v;const{type:k,...C}=t;_.transition[y]={...C,duration:m,ease:x,times:w,...r}}}),s}function eg(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function tg(e,t){return t[e]||(t[e]=[]),t[e]}function zO(e){return Array.isArray(e)?e:[e]}function LO(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const FO=e=>typeof e=="number",NO=e=>e.every(FO);function RO(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},r=Rw(e)&&!qP(e)?new CO(t):new hO(t);r.mount(e),No.set(e,r)}function jO(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},r=new vO(t);r.mount(e),No.set(e,r)}function UO(e,t){return cn(e)||typeof e=="number"||typeof e=="string"&&!Bd(t)}function Ww(e,t,r,i){const n=[];if(UO(e,t))n.push(IO(e,Bd(t)&&t.default||t,r&&(r.default||r)));else{if(e==null)return n;const o=Gw(e,t,i),s=o.length;for(let a=0;a<s;a++){const l=o[a],u=l instanceof Element?RO:jO;No.has(l)||u(l);const d=No.get(l),f={...r};"delay"in f&&typeof f.delay=="function"&&(f.delay=f.delay(a,s)),n.push(...EP(d,{...t,transition:f},{}))}}return n}function KO(e,t,r){const i=[],n=e.map(s=>{if(Array.isArray(s)&&typeof s[0]=="function"){const a=s[0],l=Fr(0);return l.on("change",a),s.length===1?[l,[0,1]]:s.length===2?[l,[0,1],s[1]]:[l,s[1],s[2]]}return s});return MO(n,t,r,{spring:Lo}).forEach(({keyframes:s,transition:a},l)=>{i.push(...Ww(l,s,a))}),i}function VO(e){return Array.isArray(e)&&e.some(Array.isArray)}function BO(e={}){const{scope:t,reduceMotion:r}=e;function i(n,o,s){let a=[],l;if(VO(n)){const{onComplete:d,...f}=o||{};typeof d=="function"&&(l=d),a=KO(n,r!==void 0?{reduceMotion:r,...f}:f,t)}else{const{onComplete:d,...f}=s||{};typeof d=="function"&&(l=d),a=Ww(n,o,r!==void 0?{reduceMotion:r,...f}:f,t)}const u=new uP(a);return l&&u.finished.then(l),t&&(t.animations.push(u),u.finished.then(()=>{Id(t.animations,u)})),u}return i}const Ys=BO(),ZO=(e,t)=>e?.visualDuration===t?.visualDuration&&e?.bounce===t?.bounce&&e?.stiffness===t?.stiffness&&e?.damping===t?.damping&&e?.mass===t?.mass&&e?.velocity===t?.velocity;function Fa(e,t){const r=()=>typeof t=="function"?t():t,[i,n]=ze(e()),o=Fr(i()),s=Fr(i());let a=r(),l=Gm(s,o,a),u=s.on("change",d=>n(d));return ne(()=>{o.set(e())}),ne(()=>{if(!t)return;const d=r();ZO(a,d)||(a=d,l(),l=Gm(s,o,d),n(s.get()))}),je(()=>{u(),l(),s.destroy(),o.destroy()}),i}var Xw=I("<div>"),HO=I("<form>");function qO(e){const[t,r]=$e(e,["children","class","classList"]);return(()=>{var i=Xw();return dn(i,ie(r,{"data-dock-surface":"shell",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}function GO(e){const[t,r]=$e(e,["children","class","classList"]);return(()=>{var i=HO();return dn(i,ie(r,{"data-dock-surface":"shell",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}function Na(e){const[t,r]=$e(e,["attach","children","class","classList"]);return(()=>{var i=Xw();return dn(i,ie(r,{"data-dock-surface":"tray",get"data-dock-attach"(){return t.attach||"none"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}var WO={};ir(WO,{Anchor:()=>Jw,Arrow:()=>Fi,CloseButton:()=>Qw,Content:()=>e1,Description:()=>t1,Popover:()=>fr,Portal:()=>n1,Root:()=>r1,Title:()=>i1,Trigger:()=>o1,usePopoverContext:()=>Vr});var Yw=Rt();function Vr(){const e=jt(Yw);if(e===void 0)throw new Error("[kobalte]: `usePopoverContext` must be used within a `Popover` component");return e}function Jw(e){const t=Vr(),[r,i]=$e(e,["ref"]);return c(it,ie({as:"div",ref(n){var o=xt(t.setDefaultAnchorRef,r.ref);typeof o=="function"&&o(n)}},()=>t.dataset(),i))}function Qw(e){const t=Vr(),[r,i]=$e(e,["aria-label","onClick"]);return c(Ro,ie({get"aria-label"(){return r["aria-label"]||t.translations().dismiss},onClick:o=>{Qe(o,r.onClick),t.close()}},()=>t.dataset(),i))}function e1(e){let t;const r=Vr(),i=Ge({id:r.generateId("content")},e),[n,o]=$e(i,["ref","style","onOpenAutoFocus","onCloseAutoFocus","onPointerDownOutside","onFocusOutside","onInteractOutside"]);let s=!1,a=!1,l=!1;const u=h=>{n.onCloseAutoFocus?.(h),r.isModal()?(h.preventDefault(),s||vn(r.triggerRef())):(h.defaultPrevented||(a||vn(r.triggerRef()),h.preventDefault()),a=!1,l=!1)},d=h=>{n.onPointerDownOutside?.(h),r.isModal()&&(s=h.detail.isContextMenu)},f=h=>{n.onFocusOutside?.(h),r.isOpen()&&r.isModal()&&h.preventDefault()},m=h=>{n.onInteractOutside?.(h),!r.isModal()&&(h.defaultPrevented||(a=!0,h.detail.originalEvent.type==="pointerdown"&&(l=!0)),Do(r.triggerRef(),h.target)&&h.preventDefault(),h.detail.originalEvent.type==="focusin"&&l&&h.preventDefault())};return dc({isDisabled:()=>!(r.isOpen()&&r.isModal()),targets:()=>t?[t]:[]}),fc({element:()=>t??null,enabled:()=>r.contentPresent()&&r.preventScroll()}),mc({trapFocus:()=>r.isOpen()&&r.isModal(),onMountAutoFocus:n.onOpenAutoFocus,onUnmountAutoFocus:u},()=>t),ne(()=>je(r.registerContentId(o.id))),c(F,{get when(){return r.contentPresent()},get children(){return c(Ni.Positioner,{get children(){return c(gc,ie({ref(h){var g=xt(y=>{r.setContentRef(y),t=y},n.ref);typeof g=="function"&&g(h)},role:"dialog",tabIndex:-1,get disableOutsidePointerEvents(){return Te(()=>!!r.isOpen())()&&r.isModal()},get excludedElements(){return[r.triggerRef]},get style(){return vr({"--kb-popover-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},n.style)},get"aria-labelledby"(){return r.titleId()},get"aria-describedby"(){return r.descriptionId()},onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,get onDismiss(){return r.close}},()=>r.dataset(),o))}})}})}function t1(e){const t=Vr(),r=Ge({id:t.generateId("description")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerDescriptionId(i.id))),c(it,ie({as:"p",get id(){return i.id}},()=>t.dataset(),n))}function n1(e){const t=Vr();return c(F,{get when(){return t.contentPresent()},get children(){return c(hr,e)}})}var ng={dismiss:"Dismiss"};function r1(e){const t=`popover-${nn()}`,r=Ge({id:t,modal:!1,translations:ng},e),[i,n]=$e(r,["translations","id","open","defaultOpen","onOpenChange","modal","preventScroll","forceMount","anchorRef"]),[o,s]=ze(),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),[h,g]=ze(),[y,b]=ze(),v=jo({open:()=>i.open,defaultOpen:()=>i.defaultOpen,onOpenChange:C=>i.onOpenChange?.(C)}),w=()=>i.anchorRef?.()??o()??a(),{present:x}=li({show:()=>i.forceMount||v.isOpen(),element:()=>u()??null}),_=$(()=>({"data-expanded":v.isOpen()?"":void 0,"data-closed":v.isOpen()?void 0:""})),k={translations:()=>i.translations??ng,dataset:_,isOpen:v.isOpen,isModal:()=>i.modal??!1,preventScroll:()=>i.preventScroll??k.isModal(),contentPresent:x,triggerRef:a,contentId:f,titleId:h,descriptionId:y,setDefaultAnchorRef:s,setTriggerRef:l,setContentRef:d,close:v.close,toggle:v.toggle,generateId:Nn(()=>i.id),registerContentId:tn(m),registerTitleId:tn(g),registerDescriptionId:tn(b)};return c(Yw.Provider,{value:k,get children(){return c(Ni,ie({anchorRef:w,contentRef:u},n))}})}function i1(e){const t=Vr(),r=Ge({id:t.generateId("title")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerTitleId(i.id))),c(it,ie({as:"h2",get id(){return i.id}},()=>t.dataset(),n))}function o1(e){const t=Vr(),[r,i]=$e(e,["ref","onClick","onPointerDown"]);return c(Ro,ie({ref(s){var a=xt(t.setTriggerRef,r.ref);typeof a=="function"&&a(s)},"aria-haspopup":"dialog",get"aria-expanded"(){return t.isOpen()},get"aria-controls"(){return Te(()=>!!t.isOpen())()?t.contentId():void 0},onPointerDown:s=>{Qe(s,r.onPointerDown),s.preventDefault()},onClick:s=>{Qe(s,r.onClick),t.toggle()}},()=>t.dataset(),i))}var fr=Object.assign(r1,{Anchor:Jw,Arrow:Fi,CloseButton:Qw,Content:e1,Description:t1,Portal:n1,Title:i1,Trigger:o1}),XO=I("<span>");function YO(e){const[t,r]=$e(e,["size","class","classList","children"]);return(()=>{var i=XO();return dn(i,ie(r,{"data-component":"tag",get"data-size"(){return t.size||"normal"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}var JO=I("<div data-slot=list-item-add>"),QO=I("<div data-slot=list-header>"),rg=I("<span>"),eE=I("<span data-slot=list-filter>&quot;<!>&quot;"),tE=I("<div data-slot=list-search-wrapper><div data-slot=list-search><div data-slot=list-search-container>"),ig=I("<div data-slot=list-group><div data-slot=list-items>"),nE=I("<div data-component=list><div data-slot=list-scroll>"),rE=I("<div data-slot=list-empty-state><div data-slot=list-message>"),iE=I("<span data-slot=list-item-selected-icon>"),oE=I("<button data-slot=list-item type=button>"),sE=I("<span data-slot=list-item-active-icon>"),aE=I("<span data-slot=list-item-divider>");function og(e,t){const r=e.querySelectorAll('[data-slot="list-item"][data-key]');for(const i of r)if(i.getAttribute("data-key")===t)return i}function lE(e){const t=yt();let r;const[i,n]=We({mouseActive:!1,scrollRef:void 0,internalFilter:""}),o=()=>i.scrollRef,s=A=>n("scrollRef",A),a=()=>i.internalFilter,l=A=>n("internalFilter",A),u=(A,j,P)=>{const B=A.getBoundingClientRect(),R=j.getBoundingClientRect(),V=R.top-B.top+A.scrollTop;V+R.height,A.scrollTop+A.clientHeight;const ee=V-A.clientHeight/2+R.height/2,oe=Math.max(0,A.scrollHeight-A.clientHeight);A.scrollTop=Math.max(0,Math.min(ee,oe))},{filter:d,grouped:f,flat:m,active:h,setActive:g,onKeyDown:y,onInput:b,refetch:v}=Ls(e),w=()=>e.current?e.key(e.current):void 0,x=()=>typeof e.search=="object"?e.search:{},_=()=>x().action,k=()=>e.add,C=()=>!!k(),O=A=>A.movementX!==0||A.movementY!==0,z=(A,j)=>{const P=d();if(l(A),b(A),e.onFilter?.(A),!!j?.ref){if(P===A){v();return}queueMicrotask(()=>v())}};ne(()=>{e.filter!==void 0&&e.filter!==a()&&(l(e.filter),b(e.filter))}),ne(qe(d,()=>{o()?.scrollTo(0,0)},{defer:!0})),ne(()=>{const A=o();if(!A)return;const j=w();j&&requestAnimationFrame(()=>{const P=og(A,j);P&&u(A,P)})}),ne(()=>{const A=m();if(i.mouseActive||A.length===0)return;const j=o();if(!j)return;if(h()===e.key(A[0])){j.scrollTo(0,0);return}const P=h();if(!P)return;const B=og(j,P);B&&u(j,B)}),ne(()=>{const A=m(),j=h(),P=A.find(B=>e.key(B)===j);e.onMove?.(P)});const K=(A,j)=>{e.onSelect?.(A,j)},J=A=>{if(n("mouseActive",!1),A.key==="Escape")return;const j=m(),P=j.find(R=>e.key(R)===h()),B=P?j.indexOf(P):-1;if(e.onKeyEvent?.(A,P),!A.defaultPrevented)if(A.key==="Enter"&&!A.isComposing)A.preventDefault(),P&&K(P,B);else if(e.search){if(A.ctrlKey&&!A.metaKey&&!A.altKey&&!A.shiftKey&&(A.key==="n"||A.key==="p")){y(A);return}(A.key==="ArrowDown"||A.key==="ArrowUp")&&y(A)}else y(A)};e.ref?.({onKeyDown:J,setScrollRef:s,setFilter:A=>z(A,{ref:!0})});const T=()=>{const A=k();return A?(()=>{var j=JO();return p(j,()=>A.render()),Ae(P=>Ct(j,{[A.class??""]:!!A.class},P)),j})():null};function M(A){const[j,P]=We({stuck:!1,header:void 0});return ne(()=>{const B=o(),R=j.header;if(!B||!R)return;const V=()=>{const Q=R.getBoundingClientRect(),ee=B.getBoundingClientRect();P("stuck",Q.top<=ee.top+1&&B.scrollTop>0)};ln(B,"scroll",V,{passive:!0}),V()}),(()=>{var B=QO();return ut(R=>P("header",R),B),p(B,()=>e.groupHeader?.(A.group)??A.group.category),Ae(()=>Ie(B,"data-stuck",j.stuck)),B})()}const U=()=>{if(f.loading)return e.loadingMessage??t.t("ui.list.loading");if(e.emptyMessage)return e.emptyMessage;const A=d();if(!A)return t.t("ui.list.empty");const j=t.t("ui.list.emptyWithFilter.suffix");return[(()=>{var P=rg();return p(P,()=>t.t("ui.list.emptyWithFilter.prefix")),P})(),(()=>{var P=eE(),B=P.firstChild,R=B.nextSibling;return R.nextSibling,p(P,A,R),P})(),c(F,{when:j,get children(){var P=rg();return p(P,j),P}})]};return(()=>{var A=nE(),j=A.firstChild;return p(A,c(F,{get when(){return!!e.search},get children(){var P=tE(),B=P.firstChild,R=B.firstChild;return B.$$pointerdown=V=>{const Q=V.currentTarget;if(!(Q instanceof HTMLElement))return;const ee=Q.querySelector("input, textarea");(ee instanceof HTMLInputElement||ee instanceof HTMLTextAreaElement?ee:r)?.focus(),V.stopPropagation()},p(R,c(F,{get when(){return!x().hideIcon},get children(){return c(bt,{name:"magnifying-glass"})}}),null),p(R,c(ah,{get autofocus(){return x().autofocus},variant:"ghost","data-slot":"list-search-input",type:"text",ref:V=>{r=V},get value(){return a()},onChange:V=>z(V),onKeyDown:J,get placeholder(){return x().placeholder},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off"}),null),p(B,c(F,{get when(){return a()},get children(){return c(Pt,{icon:"circle-x",variant:"ghost",onClick:()=>{l(""),queueMicrotask(()=>r?.focus())},get"aria-label"(){return t.t("ui.list.clearFilter")}})}}),null),p(P,_,null),Ae(V=>Ct(B,{[x().class??""]:!!x().class},V)),P}}),j),ut(s,j),p(j,c(F,{get when(){return m().length>0||C()},get fallback(){return(()=>{var P=rE(),B=P.firstChild;return p(B,U),P})()},get children(){return[c(rt,{get each(){return f.latest},children:(P,B)=>{const R=()=>B()===f.latest.length-1;return(()=>{var V=ig(),Q=V.firstChild;return p(V,c(F,{get when(){return P.category},get children(){return c(M,{group:P})}}),Q),p(Q,c(rt,{get each(){return P.items},children:(ee,oe)=>{const le=(()=>{var W=oE();return W.addEventListener("mouseleave",()=>{i.mouseActive&&g(null)}),W.$$mousemove=D=>{O(D)&&(n("mouseActive",!0),g(e.key(ee)))},W.$$keydown=J,W.$$click=()=>K(ee,oe()),p(W,()=>e.children(ee),null),p(W,c(F,{get when(){return e.key(ee)===w()},get children(){var D=iE();return p(D,c(bt,{name:"check-small"})),D}}),null),p(W,c(F,{get when(){return e.activeIcon},children:D=>(()=>{var te=sE();return p(te,c(bt,{get name(){return D()}})),te})()}),null),p(W,(()=>{var D=Te(()=>!!(e.divider&&(oe()!==P.items.length-1||C()&&R())));return()=>D()&&aE()})(),null),Ae(D=>{var te=e.key(ee),H=e.key(ee)===h(),Z=e.key(ee)===w();return te!==D.e&&Ie(W,"data-key",D.e=te),H!==D.t&&Ie(W,"data-active",D.t=H),Z!==D.a&&Ie(W,"data-selected",D.a=Z),D},{e:void 0,t:void 0,a:void 0}),W})();return e.itemWrapper?e.itemWrapper(ee,le):le}}),null),p(Q,c(F,{get when(){return Te(()=>!!C())()&&R()},get children(){return T()}}),null),V})()}}),c(F,{get when(){return Te(()=>f.latest.length===0)()&&C()},get children(){var P=ig(),B=P.firstChild;return p(B,T),P}})]}})),Ae(P=>Ct(A,{[e.class??""]:!!e.class},P)),A})()}Ot(["pointerdown","click","keydown","mousemove"]);var cE=I('<div class="flex flex-col gap-1 py-1"><div class=text-13-medium></div><div class="text-12-regular text-text-invert-base"></div><div class="text-12-regular text-text-invert-base">'),uE=I('<div class="text-12-regular text-text-invert-base">');const dE=e=>{const t=_t(),r=l=>{const u=`${l.id} ${l.name}`.toLowerCase();return/claude|anthropic/.test(u)?t.t("model.provider.anthropic"):/gpt|o[1-4]|codex|openai/.test(u)?t.t("model.provider.openai"):/grok|xai/.test(u)?t.t("model.provider.xai"):/llama|meta/.test(u)?t.t("model.provider.meta"):l.provider.name},i=l=>l==="text"?t.t("model.input.text"):l==="image"?t.t("model.input.image"):l==="audio"?t.t("model.input.audio"):l==="video"?t.t("model.input.video"):l==="pdf"?t.t("model.input.pdf"):l,n=()=>{const l=[];e.latest&&l.push(t.t("model.tag.latest")),e.free&&l.push(t.t("model.tag.free"));const u=l.length?` (${l.join(", ")})`:"";return`${r(e.model)} ${e.model.name}${u}`},o=()=>{if(e.model.capabilities){const d=e.model.capabilities.input,m=["text","image","audio","video","pdf"].filter(h=>d[h]).map(h=>i(h));return m.length?m.join(", "):void 0}const l=e.model.modalities?.input;if(!l)return;const u=l.map(d=>i(d));return u.length?u.join(", "):void 0},s=()=>e.model.capabilities?e.model.capabilities.reasoning?t.t("model.tooltip.reasoning.allowed"):t.t("model.tooltip.reasoning.none"):e.model.reasoning?t.t("model.tooltip.reasoning.allowed"):t.t("model.tooltip.reasoning.none"),a=()=>t.t("model.tooltip.context",{limit:e.model.limit.context.toLocaleString()});return(()=>{var l=cE(),u=l.firstChild,d=u.nextSibling,f=d.nextSibling;return p(u,n),p(l,c(F,{get when(){return o()},children:m=>(()=>{var h=uE();return p(h,()=>t.t("model.tooltip.allows",{inputs:m()})),h})()}),d),p(d,s),p(f,a),l})()};var fE=I('<div class="order-first flex justify-end px-1 pb-1">'),mE=I("<div>"),gE=I('<div class="w-full flex items-center gap-x-2 text-13-regular"><span class=truncate>');const s1=e=>{const t=e.model??ji().model,r=_t(),i=$(()=>t.list().filter(n=>t.visible({modelID:n.id,providerID:n.provider.id})).filter(n=>e.provider?n.provider.id===e.provider:!0));return(()=>{var n=mE();return p(n,c(lE,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get emptyMessage(){return r.t("dialog.model.empty")},key:o=>`${o.provider.id}:${o.id}`,items:i,get current(){return t.current()},sortBy:(o,s)=>o.name.localeCompare(s.name),itemWrapper:(o,s)=>c(Et,{class:"w-full",placement:"right-start",gutter:12,get value(){return c(dE,{model:o,get latest(){return o.latest}})},children:s}),onSelect:o=>{t.set(o?{modelID:o.id,providerID:o.provider.id}:void 0,{recent:!0}),e.onSelect()},children:o=>(()=>{var s=gE(),a=s.firstChild;return p(a,()=>o.name),p(s,c(F,{get when(){return o.latest},get children(){return c(YO,{get children(){return r.t("model.tag.latest")}})}}),null),s})()}),null),p(n,c(F,{get when(){return e.action},get children(){var o=fE();return p(o,()=>e.action),o}}),null),Ae(()=>Jt(n,`flex flex-col flex-1 min-h-0 ${e.class??""}`)),n})()};function a1(e){const[t,r]=We({open:!1,dismiss:null}),i=br(),n=_t(),o=a=>{r("dismiss",a),r("open",!1)},s=()=>{o("manage"),Bn(()=>import("./dialog-manage-models-DTTVfn7C.js").then(a=>a.d),__vite__mapDeps([0,1,2,3])).then(a=>{i.show(()=>c(a.DialogManageModels,{}))})};return c(fr,{get open(){return t.open},onOpenChange:a=>{a&&r("dismiss",null),r("open",a)},modal:!1,get placement(){return e.placement??"top-start"},get gutter(){return e.gutter??4},get children(){return[c(fr.Trigger,ie({get as(){return e.triggerAs??"div"}},()=>e.triggerProps,{get children(){return e.children}})),c(fr.Portal,{get children(){return c(fr.Content,{class:"w-72 h-80 flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden",onEscapeKeyDown:a=>{o("escape"),a.preventDefault(),a.stopPropagation()},onPointerDownOutside:()=>o("outside"),onFocusOutside:()=>o("outside"),onCloseAutoFocus:a=>{const l=t.dismiss;l==="outside"&&a.preventDefault(),(l==="escape"||l==="select")&&(a.preventDefault(),e.onClose?.(l)),r("dismiss",null)},get children(){return[c(fr.Title,{class:"sr-only",get children(){return n.t("dialog.model.select.title")}}),c(s1,{get provider(){return e.provider},get model(){return e.model},onSelect:()=>o("select"),class:"p-1",get action(){return c(vt,{size:"small",onClick:s,get children(){return n.t("dialog.model.manage")}})}})]}})}})]}})}const hE=e=>{const t=br(),r=_t(),i=()=>{Bn(()=>import("./dialog-manage-models-DTTVfn7C.js").then(n=>n.d),__vite__mapDeps([0,1,2,3])).then(n=>{t.show(()=>c(n.DialogManageModels,{}))})};return c(dh,{get title(){return r.t("dialog.model.select.title")},get action(){return c(vt,{class:"h-7 -my-1 text-14-medium",tabIndex:-1,onClick:i,get children(){return r.t("dialog.model.manage")}})},get children(){return[c(s1,{get provider(){return e.provider},get model(){return e.model},onSelect:()=>t.close()}),c(vt,{variant:"ghost",class:"ml-3 mt-5 mb-6 text-text-base self-start",onClick:i,get children(){return r.t("dialog.model.manage")}})]}})},l1=Object.freeze(Object.defineProperty({__proto__:null,DialogSelectModel:hE,ModelSelectorPopover:a1},Symbol.toStringTag,{value:"Module"}));var pE=I("<div data-component=prompt-mode-control>"),sg=I("<span class=truncate>"),vE=I("<div data-component=prompt-model-control>"),bE=I('<div data-component=titlebar-prompt-controls class="flex min-w-0 items-center gap-1.5">'),yE=I('<div data-component=prompt-shell-status class="flex h-6 min-w-0 items-center gap-1.5 rounded-md bg-surface-base-hover px-2 text-12-medium text-text-strong"><span class=truncate>');const wE=e=>{const t=br(),r=_t(),i=ji(),n=$(()=>i.mode.list()),o=d=>r.t(`approval_mode.${d}`),s=()=>{Bn(()=>import("./dialog-manage-models-DTTVfn7C.js").then(d=>d.d),__vite__mapDeps([0,1,2,3])).then(d=>{t.show(()=>c(d.DialogManageModels,{}))})},a="min-w-0 max-w-[180px] justify-start rounded-md px-2.5 text-12-medium text-text-base gap-1.5",l="text-text-base",u={"max-width":"112px"};return(()=>{var d=bE();return p(d,c(F,{get when(){return e.inputMode!=="shell"},get fallback(){return c(Et,{placement:"bottom",gutter:4,get value(){return r.t("prompt.mode.shell.exit")},get children(){var f=yE(),m=f.firstChild;return p(f,c(bt,{name:"terminal",size:"small",class:"shrink-0"}),m),p(m,()=>r.t("prompt.mode.shell")),f}})},get children(){return[(()=>{var f=pE();return p(f,c(Et,{placement:"bottom",gutter:4,get value(){return r.t("command.mode.cycle")},get children(){return c(Zh,{size:"small",get options(){return n()},get current(){return i.mode.current()},label:o,onSelect:m=>{i.mode.set(m),e.onRestoreFocus()},class:l,valueClass:"truncate text-12-medium text-text-base",triggerStyle:u,triggerProps:{"data-action":"prompt-mode",class:"min-w-0 rounded-md"},variant:"ghost"})}})),f})(),(()=>{var f=vE();return p(f,c(F,{get when(){return i.model.list().length>0},get fallback(){return c(Et,{placement:"bottom",gutter:4,get value(){return r.t("dialog.model.manage")},get children(){return c(vt,{"data-action":"prompt-model",variant:"ghost",size:"small",class:a,onClick:s,get children(){return[(()=>{var m=sg();return p(m,()=>r.t("dialog.model.manage")),m})(),c(bt,{name:"plus-small",size:"small",class:"shrink-0"})]}})}})},get children(){return c(Et,{placement:"bottom",gutter:4,get value(){return r.t("command.model.choose")},get children(){return c(a1,{get model(){return i.model},triggerAs:vt,triggerProps:{variant:"ghost",size:"small",class:a,"data-action":"prompt-model"},placement:"bottom-start",gutter:6,get onClose(){return e.onRestoreFocus},get children(){return[(()=>{var m=sg();return p(m,()=>i.model.current()?.name??r.t("dialog.model.select.title")),m})(),c(bt,{name:"chevron-down",size:"small",class:"shrink-0"})]}})}})}})),f})()]}})),d})()},xE=8e3,_E=120;function $E(e){if(e.length>=xE)return!0;let t=0;for(const r of e)if(r===`
51
+ `);return i.forEach((n,o)=>{n&&t.appendChild(document.createTextNode(n)),o<i.length-1&&t.appendChild(document.createElement("br"))}),t}function R2(e){return e.nodeType===Node.ELEMENT_NODE&&e.tagName==="BR"?1:(e.textContent??"").replace(/\u200B/g,"").length}function j2(e){if(e.nodeType===Node.TEXT_NODE)return(e.textContent??"").replace(/\u200B/g,"").length;if(e.nodeType===Node.ELEMENT_NODE&&e.tagName==="BR")return 1;let t=0;for(const r of Array.from(e.childNodes))t+=j2(r);return t}function Xr(e){const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const r=t.getRangeAt(0);if(!e.contains(r.startContainer))return 0;const i=r.cloneRange();return i.selectNodeContents(e),i.setEnd(r.startContainer,r.startOffset),j2(i.cloneContents())}function Yr(e,t){let r=t,i=e.firstChild;for(;i;){const a=R2(i),l=i.nodeType===Node.TEXT_NODE,u=i.nodeType===Node.ELEMENT_NODE&&(i.dataset.type==="file"||i.dataset.type==="agent"),d=i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BR";if(l&&r<=a){const f=document.createRange(),m=window.getSelection();f.setStart(i,r),f.collapse(!0),m?.removeAllRanges(),m?.addRange(f);return}if((u||d)&&r<=a){const f=document.createRange(),m=window.getSelection();if(r===0&&f.setStartBefore(i),r>0&&u&&f.setStartAfter(i),r>0&&d){const h=i.nextSibling;h&&h.nodeType===Node.TEXT_NODE&&f.setStart(h,0),(!h||h.nodeType!==Node.TEXT_NODE)&&f.setStartAfter(i)}f.collapse(!0),m?.removeAllRanges(),m?.addRange(f);return}r-=a,i=i.nextSibling}const n=document.createRange(),o=window.getSelection(),s=e.lastChild;if(s&&s.nodeType===Node.TEXT_NODE){const a=s.textContent?s.textContent.length:0;n.setStart(s,a)}(!s||s.nodeType!==Node.TEXT_NODE)&&n.selectNodeContents(e),n.collapse(!1),o?.removeAllRanges(),o?.addRange(n)}function Tm(e,t,r,i){let n=i;const o=Array.from(e.childNodes);for(const s of o){const a=R2(s),l=s.nodeType===Node.TEXT_NODE,u=s.nodeType===Node.ELEMENT_NODE&&(s.dataset.type==="file"||s.dataset.type==="agent"),d=s.nodeType===Node.ELEMENT_NODE&&s.tagName==="BR";if(l&&n<=a){r==="start"&&t.setStart(s,n),r==="end"&&t.setEnd(s,n);return}if((u||d)&&n<=a){r==="start"&&n===0&&t.setStartBefore(s),r==="start"&&n>0&&t.setStartAfter(s),r==="end"&&n===0&&t.setEndBefore(s),r==="end"&&n>0&&t.setEndAfter(s);return}n-=a}}const EA=e=>e.map(t=>"content"in t?t.content:"").join("");async function U2(e){const t=EA(e.draft.prompt),[,r]=e.globalSync.child(e.draft.sessionDirectory),i=()=>{e.optimisticBusy&&r("session_status",e.draft.sessionID,{type:"busy"})},n=()=>{e.optimisticBusy&&r("session_status",e.draft.sessionID,{type:"idle"})},o=async()=>await e.before?.()!==!1,[s,...a]=t.split(" "),l=s?.startsWith("/")?s.slice(1):void 0;if(l&&e.sync.data.command.find(y=>y.name===l)){i();try{return await o()?(await e.client.session.command({sessionID:e.draft.sessionID,command:l,arguments:a.join(" "),agent:e.draft.agent,model:`${e.draft.model.providerID}/${e.draft.model.modelID}`,approval_mode:e.draft.mode}),!0):(n(),!1)}catch(y){throw n(),y}}const u=e.messageID??rr.ascending("message"),{requestParts:d,optimisticParts:f}=PA({prompt:e.draft.prompt,context:e.draft.context,text:t,sessionID:e.draft.sessionID,messageID:u,sessionDirectory:e.draft.sessionDirectory}),m={id:u,sessionID:e.draft.sessionID,role:"user",time:{created:Date.now()},agent:e.draft.agent,model:e.draft.model},h=()=>e.sync.session.optimistic.add({directory:e.draft.sessionDirectory,sessionID:e.draft.sessionID,message:m,parts:f}),g=()=>e.sync.session.optimistic.remove({directory:e.draft.sessionDirectory,sessionID:e.draft.sessionID,messageID:u});i(),h();try{return await o()?(await e.client.session.promptAsync({sessionID:e.draft.sessionID,agent:e.draft.agent,model:e.draft.model,messageID:u,parts:d,approval_mode:e.draft.mode}),!0):(n(),g(),!1)}catch(y){throw n(),g(),y}}function MA(e){const t=ra(),r=Rn(),i=sr(),n=xc(),o=ji(),s=Ui(),a=or(),l=_t(),u=yc(),d=v=>{if(v&&typeof v=="object"&&"data"in v){const w=v.data;if(w?.message)return w.message}return v instanceof Error?v.message:l.t("common.requestFailed")},f=async()=>{const v=u.id;if(!v)return Promise.resolve();n.todo.set(v,[]);const[,w]=n.child(r.directory);return w("todo",v,[]),e.onAbort?.(),r.client.session.abort({sessionID:v}).catch(()=>{})},m=v=>{for(const w of v)s.context.add({type:"file",path:w.path,selection:w.selection,comment:w.comment,commentID:w.commentID,commentOrigin:w.commentOrigin,preview:w.preview})},h=v=>{for(const w of v)s.context.remove(w.key)},g=()=>{for(const v of s.context.items())s.context.remove(v.key)},y=(v,w)=>{const[,x]=n.child(v);x("session",_=>{const k=Ms.search(_,w.id,O=>O.id),C=[..._];return k.found?(C[k.index]=w,C):(C.splice(k.index,0,w),C)})};return{abort:f,handleSubmit:async v=>{v.preventDefault();const w=s.current(),x=w.map(oe=>"content"in oe?oe.content:"").join(""),_=e.mode()==="shell"&&r.capabilities.shellMode!==!1?"shell":"normal";if(x.trim().length===0&&e.commentCount()===0){e.working()&&f();return}const k=o.model.current(),C=o.agent.current(),O=o.mode.current();if(!k){e.onMissingModel?.(o.model.list().length>0?"select-model":"manage-model-configs");return}if(!C){Nt({title:l.t("prompt.toast.modelAgentRequired.title"),description:l.t("prompt.toast.modelAgentRequired.description")});return}e.addToHistory(w,_),e.resetHistoryNavigation(),ko.start();const z=r.directory,K=!u.id,J=z,T=r.client;let M=e.info();if(!M&&K){const oe=await T.session.create({approval_mode:O}).then(le=>le.data??void 0).catch(le=>{Nt({title:l.t("prompt.toast.sessionCreateFailed.title"),description:d(le)})});oe&&(y(J,oe),M=oe,o.session.promote(J,M.id),a.handoff.setTabs(hf(J),M.id),t(`/${hf(J)}/session/${M.id}`))}if(!M){Nt({title:l.t("prompt.toast.promptSendFailed.title"),description:l.t("prompt.toast.promptSendFailed.description")});return}const U={modelID:k.id,providerID:k.provider.id},A=C.name,j=s.context.items().slice(),P={sessionID:M.id,sessionDirectory:J,prompt:w,context:j,agent:A,model:U,mode:O},B=()=>{s.reset(),e.setMode("normal"),e.setPopover(null)},R=()=>{s.set(w,e.promptLength(w)),e.setMode(_),e.setPopover(null),requestAnimationFrame(()=>{const oe=e.editor();oe&&(oe.focus(),Yr(oe,e.promptLength(w)),e.queueScroll())})};if(!K&&_==="normal"&&e.shouldQueue?.()){e.onQueue?.(P),g(),B();return}if(ko.submit({sessionID:M.id,directory:J}),e.onSubmit?.(),_==="shell"){B(),T.session.shell({sessionID:M.id,agent:A,model:U,command:x}).catch(oe=>{Nt({title:l.t("prompt.toast.shellSendFailed.title"),description:d(oe)}),R()});return}if(x.startsWith("/")){const[oe,...le]=x.split(" "),W=oe.slice(1);if(i.data.command.find(te=>te.name===W)){B(),T.session.command({sessionID:M.id,command:W,arguments:le.join(" "),agent:A,model:`${U.providerID}/${U.modelID}`,approval_mode:O}).catch(te=>{Nt({title:l.t("prompt.toast.commandSendFailed.title"),description:_l(te,l.t,l.t("common.requestFailed"))}),R()});return}}const V=j.filter(oe=>oe.type==="file"&&!!oe.comment?.trim()),Q=rr.ascending("message"),ee=()=>{i.session.optimistic.remove({directory:J,sessionID:M.id,messageID:Q})};h(V),B(),U2({client:T,sync:i,globalSync:n,draft:P,messageID:Q,optimisticBusy:J===z}).catch(oe=>{J===z&&i.set("session_status",M.id,{type:"idle"}),Nt({title:l.t("prompt.toast.promptSendFailed.title"),description:d(oe)}),ee(),m(V),R()})}}}function zA(e,t){e.indexOf(t)===-1&&e.push(t)}function Id(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const zr=(e,t,r)=>r>t?t:r<e?e:r;let Td=()=>{};const Lr={},K2=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function LA(e){return typeof e=="object"&&e!==null}const V2=e=>/^0[^.\s]+$/u.test(e);function B2(e){let t;return()=>(t===void 0&&(t=e()),t)}const Zi=e=>e,FA=(e,t)=>r=>t(e(r)),Dd=(...e)=>e.reduce(FA),Ad=(e,t,r)=>{const i=t-e;return i===0?1:(r-e)/i};class Z2{constructor(){this.subscriptions=[]}add(t){return zA(this.subscriptions,t),()=>Id(this.subscriptions,t)}notify(t,r,i){const n=this.subscriptions.length;if(n)if(n===1)this.subscriptions[0](t,r,i);else for(let o=0;o<n;o++){const s=this.subscriptions[o];s&&s(t,r,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ln=e=>e*1e3,qn=e=>e/1e3;function H2(e,t){return t?e*(1e3/t):0}const NA=(e,t,r)=>{const i=t-e;return((r-e)%i+i)%i+e},q2=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,RA=1e-7,jA=12;function UA(e,t,r,i,n){let o,s,a=0;do s=t+(r-t)/2,o=q2(s,i,n)-e,o>0?r=s:t=s;while(Math.abs(o)>RA&&++a<jA);return s}function as(e,t,r,i){if(e===t&&r===i)return Zi;const n=o=>UA(o,0,1,e,r);return o=>o===0||o===1?o:q2(n(o),t,i)}const G2=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,W2=e=>t=>1-e(1-t),X2=as(.33,1.53,.69,.99),Pd=W2(X2),Y2=G2(Pd),J2=e=>e>=1?1:(e*=2)<1?.5*Pd(e):.5*(2-Math.pow(2,-10*(e-1))),Od=e=>1-Math.sin(Math.acos(e)),KA=W2(Od),Q2=G2(Od),VA=as(.42,0,1,1),BA=as(0,0,.58,1),ew=as(.42,0,.58,1),tw=e=>Array.isArray(e)&&typeof e[0]!="number";function nw(e,t){return tw(e)?e[NA(0,e.length,t)]:e}const rw=e=>Array.isArray(e)&&typeof e[0]=="number",ZA={linear:Zi,easeIn:VA,easeInOut:ew,easeOut:BA,circIn:Od,circInOut:Q2,circOut:KA,backIn:Pd,backInOut:Y2,backOut:X2,anticipate:J2},HA=e=>typeof e=="string",Dm=e=>{if(rw(e)){Td(e.length===4);const[t,r,i,n]=e;return as(t,r,i,n)}else if(HA(e))return ZA[e];return e},$s=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function qA(e,t){let r=new Set,i=new Set,n=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(d){s.has(d)&&(u.schedule(d),e()),d(a)}const u={schedule:(d,f=!1,m=!1)=>{const g=m&&n?r:i;return f&&s.add(d),g.add(d),d},cancel:d=>{i.delete(d),s.delete(d)},process:d=>{if(a=d,n){o=!0;return}n=!0;const f=r;r=i,i=f,r.forEach(l),r.clear(),n=!1,o&&(o=!1,u.process(d))}};return u}const GA=40;function iw(e,t){let r=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,s=$s.reduce((x,_)=>(x[_]=qA(o),x),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:d,update:f,preRender:m,render:h,postRender:g}=s,y=()=>{const x=Lr.useManualTiming,_=x?n.timestamp:performance.now();r=!1,x||(n.delta=i?1e3/60:Math.max(Math.min(_-n.timestamp,GA),1)),n.timestamp=_,n.isProcessing=!0,a.process(n),l.process(n),u.process(n),d.process(n),f.process(n),m.process(n),h.process(n),g.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(y))},b=()=>{r=!0,i=!0,n.isProcessing||e(y)};return{schedule:$s.reduce((x,_)=>{const k=s[_];return x[_]=(C,O=!1,z=!1)=>(r||b(),k.schedule(C,O,z)),x},{}),cancel:x=>{for(let _=0;_<$s.length;_++)s[$s[_]].cancel(x)},state:n,steps:s}}const{schedule:Wn,cancel:Fl,state:Gs}=iw(typeof requestAnimationFrame<"u"?requestAnimationFrame:Zi,!0);let Ps;function WA(){Ps=void 0}const Tn={now:()=>(Ps===void 0&&Tn.set(Gs.isProcessing||Lr.useManualTiming?Gs.timestamp:performance.now()),Ps),set:e=>{Ps=e,queueMicrotask(WA)}},ow=e=>t=>typeof t=="string"&&t.startsWith(e),sw=ow("--"),XA=ow("var(--"),Ed=e=>XA(e)?YA.test(e.split("/*")[0].trim()):!1,YA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Am(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Hi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},zo={...Hi,transform:e=>zr(0,1,e)},Ss={...Hi,default:1},Co=e=>Math.round(e*1e5)/1e5,Md=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function JA(e){return e==null}const QA=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zd=(e,t)=>r=>!!(typeof r=="string"&&QA.test(r)&&r.startsWith(e)||t&&!JA(r)&&Object.prototype.hasOwnProperty.call(r,t)),aw=(e,t,r)=>i=>{if(typeof i!="string")return i;const[n,o,s,a]=i.match(Md);return{[e]:parseFloat(n),[t]:parseFloat(o),[r]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},e6=e=>zr(0,255,e),ll={...Hi,transform:e=>Math.round(e6(e))},ti={test:zd("rgb","red"),parse:aw("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:i=1})=>"rgba("+ll.transform(e)+", "+ll.transform(t)+", "+ll.transform(r)+", "+Co(zo.transform(i))+")"};function t6(e){let t="",r="",i="",n="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),i=e.substring(5,7),n=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),i=e.substring(3,4),n=e.substring(4,5),t+=t,r+=r,i+=i,n+=n),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(i,16),alpha:n?parseInt(n,16)/255:1}}const Nl={test:zd("#"),parse:t6,transform:ti.transform},ls=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ir=ls("deg"),ki=ls("%"),Ze=ls("px"),n6=ls("vh"),r6=ls("vw"),Pm={...ki,parse:e=>ki.parse(e)/100,transform:e=>ki.transform(e*100)},$i={test:zd("hsl","hue"),parse:aw("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:i=1})=>"hsla("+Math.round(e)+", "+ki.transform(Co(t))+", "+ki.transform(Co(r))+", "+Co(zo.transform(i))+")"},qt={test:e=>ti.test(e)||Nl.test(e)||$i.test(e),parse:e=>ti.test(e)?ti.parse(e):$i.test(e)?$i.parse(e):Nl.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ti.transform(e):$i.transform(e),getAnimatableNone:e=>{const t=qt.parse(e);return t.alpha=0,qt.transform(t)}},i6=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function o6(e){return isNaN(e)&&typeof e=="string"&&(e.match(Md)?.length||0)+(e.match(i6)?.length||0)>0}const lw="number",cw="color",s6="var",a6="var(",Om="${}",l6=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Mi(e){const t=e.toString(),r=[],i={color:[],number:[],var:[]},n=[];let o=0;const a=t.replace(l6,l=>(qt.test(l)?(i.color.push(o),n.push(cw),r.push(qt.parse(l))):l.startsWith(a6)?(i.var.push(o),n.push(s6),r.push(l)):(i.number.push(o),n.push(lw),r.push(parseFloat(l))),++o,Om)).split(Om);return{values:r,split:a,indexes:i,types:n}}function c6(e){return Mi(e).values}function uw({split:e,types:t}){const r=e.length;return i=>{let n="";for(let o=0;o<r;o++)if(n+=e[o],i[o]!==void 0){const s=t[o];s===lw?n+=Co(i[o]):s===cw?n+=qt.transform(i[o]):n+=i[o]}return n}}function u6(e){return uw(Mi(e))}const d6=e=>typeof e=="number"?0:qt.test(e)?qt.getAnimatableNone(e):e,f6=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:d6(e);function m6(e){const t=Mi(e);return uw(t)(t.values.map((i,n)=>f6(i,t.split[n])))}const Xn={test:o6,parse:c6,createTransformer:u6,getAnimatableNone:m6};function cl(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function g6({hue:e,saturation:t,lightness:r,alpha:i}){e/=360,t/=100,r/=100;let n=0,o=0,s=0;if(!t)n=o=s=r;else{const a=r<.5?r*(1+t):r+t-r*t,l=2*r-a;n=cl(l,a,e+1/3),o=cl(l,a,e),s=cl(l,a,e-1/3)}return{red:Math.round(n*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:i}}function Ws(e,t){return r=>r>0?t:e}const qi=(e,t,r)=>e+(t-e)*r,ul=(e,t,r)=>{const i=e*e,n=r*(t*t-i)+i;return n<0?0:Math.sqrt(n)},h6=[Nl,ti,$i],p6=e=>h6.find(t=>t.test(e));function Em(e){const t=p6(e);if(!t)return!1;let r=t.parse(e);return t===$i&&(r=g6(r)),r}const Mm=(e,t)=>{const r=Em(e),i=Em(t);if(!r||!i)return Ws(e,t);const n={...r};return o=>(n.red=ul(r.red,i.red,o),n.green=ul(r.green,i.green,o),n.blue=ul(r.blue,i.blue,o),n.alpha=qi(r.alpha,i.alpha,o),ti.transform(n))},Rl=new Set(["none","hidden"]);function v6(e,t){return Rl.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function b6(e,t){return r=>qi(e,t,r)}function Ld(e){return typeof e=="number"?b6:typeof e=="string"?Ed(e)?Ws:qt.test(e)?Mm:x6:Array.isArray(e)?dw:typeof e=="object"?qt.test(e)?Mm:y6:Ws}function dw(e,t){const r=[...e],i=r.length,n=e.map((o,s)=>Ld(o)(o,t[s]));return o=>{for(let s=0;s<i;s++)r[s]=n[s](o);return r}}function y6(e,t){const r={...e,...t},i={};for(const n in r)e[n]!==void 0&&t[n]!==void 0&&(i[n]=Ld(e[n])(e[n],t[n]));return n=>{for(const o in i)r[o]=i[o](n);return r}}function w6(e,t){const r=[],i={color:0,var:0,number:0};for(let n=0;n<t.values.length;n++){const o=t.types[n],s=e.indexes[o][i[o]],a=e.values[s]??0;r[n]=a,i[o]++}return r}const x6=(e,t)=>{const r=Xn.createTransformer(t),i=Mi(e),n=Mi(t);return i.indexes.var.length===n.indexes.var.length&&i.indexes.color.length===n.indexes.color.length&&i.indexes.number.length>=n.indexes.number.length?Rl.has(e)&&!n.values.length||Rl.has(t)&&!i.values.length?v6(e,t):Dd(dw(w6(i,n),n.values),r):Ws(e,t)};function fw(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?qi(e,t,r):Ld(e)(e,t)}const _6=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>Wn.update(t,r),stop:()=>Fl(t),now:()=>Gs.isProcessing?Gs.timestamp:Tn.now()}},mw=(e,t,r=10)=>{let i="";const n=Math.max(Math.round(t/r),2);for(let o=0;o<n;o++)i+=Math.round(e(o/(n-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Xs=2e4;function Fd(e){let t=0;const r=50;let i=e.next(t);for(;!i.done&&t<Xs;)t+=r,i=e.next(t);return t>=Xs?1/0:t}function gw(e,t=100,r){const i=r({...e,keyframes:[0,t]}),n=Math.min(Fd(i),Xs);return{type:"keyframes",ease:o=>i.next(n*o).value/t,duration:qn(n)}}const Ft={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function jl(e,t){return e*Math.sqrt(1-t*t)}const $6=12;function S6(e,t,r){let i=r;for(let n=1;n<$6;n++)i=i-e(i)/t(i);return i}const dl=.001;function k6({duration:e=Ft.duration,bounce:t=Ft.bounce,velocity:r=Ft.velocity,mass:i=Ft.mass}){let n,o,s=1-t;s=zr(Ft.minDamping,Ft.maxDamping,s),e=zr(Ft.minDuration,Ft.maxDuration,qn(e)),s<1?(n=u=>{const d=u*s,f=d*e,m=d-r,h=jl(u,s),g=Math.exp(-f);return dl-m/h*g},o=u=>{const f=u*s*e,m=f*r+r,h=Math.pow(s,2)*Math.pow(u,2)*e,g=Math.exp(-f),y=jl(Math.pow(u,2),s);return(-n(u)+dl>0?-1:1)*((m-h)*g)/y}):(n=u=>{const d=Math.exp(-u*e),f=(u-r)*e+1;return-dl+d*f},o=u=>{const d=Math.exp(-u*e),f=(r-u)*(e*e);return d*f});const a=5/e,l=S6(n,o,a);if(e=Ln(e),isNaN(l))return{stiffness:Ft.stiffness,damping:Ft.damping,duration:e};{const u=Math.pow(l,2)*i;return{stiffness:u,damping:s*2*Math.sqrt(i*u),duration:e}}}const C6=["duration","bounce"],I6=["stiffness","damping","mass"];function zm(e,t){return t.some(r=>e[r]!==void 0)}function T6(e){let t={velocity:Ft.velocity,stiffness:Ft.stiffness,damping:Ft.damping,mass:Ft.mass,isResolvedFromDuration:!1,...e};if(!zm(e,I6)&&zm(e,C6))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,i=2*Math.PI/(r*1.2),n=i*i,o=2*zr(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:Ft.mass,stiffness:n,damping:o}}else{const r=k6({...e,velocity:0});t={...t,...r,mass:Ft.mass},t.isResolvedFromDuration=!0}return t}function Lo(e=Ft.visualDuration,t=Ft.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:n}=r;const o=r.keyframes[0],s=r.keyframes[r.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:u,mass:d,duration:f,velocity:m,isResolvedFromDuration:h}=T6({...r,velocity:-qn(r.velocity||0)}),g=m||0,y=u/(2*Math.sqrt(l*d)),b=s-o,v=qn(Math.sqrt(l/d)),w=Math.abs(b)<5;i||(i=w?Ft.restSpeed.granular:Ft.restSpeed.default),n||(n=w?Ft.restDelta.granular:Ft.restDelta.default);let x,_,k,C,O,z;if(y<1)k=jl(v,y),C=(g+y*v*b)/k,x=J=>{const T=Math.exp(-y*v*J);return s-T*(C*Math.sin(k*J)+b*Math.cos(k*J))},O=y*v*C+b*k,z=y*v*b-C*k,_=J=>Math.exp(-y*v*J)*(O*Math.sin(k*J)+z*Math.cos(k*J));else if(y===1){x=T=>s-Math.exp(-v*T)*(b+(g+v*b)*T);const J=g+v*b;_=T=>Math.exp(-v*T)*(v*J*T-g)}else{const J=v*Math.sqrt(y*y-1);x=A=>{const j=Math.exp(-y*v*A),P=Math.min(J*A,300);return s-j*((g+y*v*b)*Math.sinh(P)+J*b*Math.cosh(P))/J};const T=(g+y*v*b)/J,M=y*v*T-b*J,U=y*v*b-T*J;_=A=>{const j=Math.exp(-y*v*A),P=Math.min(J*A,300);return j*(M*Math.sinh(P)+U*Math.cosh(P))}}const K={calculatedDuration:h&&f||null,velocity:J=>Ln(_(J)),next:J=>{if(!h&&y<1){const M=Math.exp(-y*v*J),U=Math.sin(k*J),A=Math.cos(k*J),j=s-M*(C*U+b*A),P=Ln(M*(O*U+z*A));return a.done=Math.abs(P)<=i&&Math.abs(s-j)<=n,a.value=a.done?s:j,a}const T=x(J);if(h)a.done=J>=f;else{const M=Ln(_(J));a.done=Math.abs(M)<=i&&Math.abs(s-T)<=n}return a.value=a.done?s:T,a},toString:()=>{const J=Math.min(Fd(K),Xs),T=mw(M=>K.next(J*M).value,J,30);return J+"ms "+T},toTransition:()=>{}};return K}Lo.applyToOptions=e=>{const t=gw(e,100,Lo);return e.ease=t.ease,e.duration=Ln(t.duration),e.type="keyframes",e};const D6=5;function hw(e,t,r){const i=Math.max(t-D6,0);return H2(r-e(i),t-i)}function Ul({keyframes:e,velocity:t=0,power:r=.8,timeConstant:i=325,bounceDamping:n=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:d}){const f=e[0],m={done:!1,value:f},h=z=>a!==void 0&&z<a||l!==void 0&&z>l,g=z=>a===void 0?l:l===void 0||Math.abs(a-z)<Math.abs(l-z)?a:l;let y=r*t;const b=f+y,v=s===void 0?b:s(b);v!==b&&(y=v-f);const w=z=>-y*Math.exp(-z/i),x=z=>v+w(z),_=z=>{const K=w(z),J=x(z);m.done=Math.abs(K)<=u,m.value=m.done?v:J};let k,C;const O=z=>{h(m.value)&&(k=z,C=Lo({keyframes:[m.value,g(m.value)],velocity:hw(x,z,m.value),damping:n,stiffness:o,restDelta:u,restSpeed:d}))};return O(0),{calculatedDuration:null,next:z=>{let K=!1;return!C&&k===void 0&&(K=!0,_(z),O(z)),k!==void 0&&z>=k?C.next(z-k):(!K&&_(z),m)}}}function A6(e,t,r){const i=[],n=r||Lr.mix||fw,o=e.length-1;for(let s=0;s<o;s++){let a=n(e[s],e[s+1]);if(t){const l=Array.isArray(t)?t[s]||Zi:t;a=Dd(l,a)}i.push(a)}return i}function P6(e,t,{clamp:r=!0,ease:i,mixer:n}={}){const o=e.length;if(Td(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=A6(t,i,n),l=a.length,u=d=>{if(s&&d<e[0])return t[0];let f=0;if(l>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const m=Ad(e[f],e[f+1],d);return a[f](m)};return r?d=>u(zr(e[0],e[o-1],d)):u}function pw(e,t){const r=e[e.length-1];for(let i=1;i<=t;i++){const n=Ad(0,t,i);e.push(qi(r,1,n))}}function vw(e){const t=[0];return pw(t,e.length-1),t}function O6(e,t){return e.map(r=>r*t)}function E6(e,t){return e.map(()=>t||ew).splice(0,e.length-1)}function Io({duration:e=300,keyframes:t,times:r,ease:i="easeInOut"}){const n=tw(i)?i.map(Dm):Dm(i),o={done:!1,value:t[0]},s=O6(r&&r.length===t.length?r:vw(t),e),a=P6(s,t,{ease:Array.isArray(n)?n:E6(t,n)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const M6=e=>e!==null;function La(e,{repeat:t,repeatType:r="loop"},i,n=1){const o=e.filter(M6),a=n<0||t&&r!=="loop"&&t%2===1?0:o.length-1;return!a||i===void 0?o[a]:i}const z6={decay:Ul,inertia:Ul,tween:Io,keyframes:Io,spring:Lo};function bw(e){typeof e.type=="string"&&(e.type=z6[e.type])}class Nd{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,r){return this.finished.then(t,r)}}const L6=e=>e/100;class Fo extends Nd{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:r}=this.options;r&&r.updatedAt!==Tn.now()&&this.tick(Tn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;bw(t);const{type:r=Io,repeat:i=0,repeatDelay:n=0,repeatType:o,velocity:s=0}=t;let{keyframes:a}=t;const l=r||Io;l!==Io&&typeof a[0]!="number"&&(this.mixKeyframes=Dd(L6,fw(a[0],a[1])),a=[0,100]);const u=l({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-s})),u.calculatedDuration===null&&(u.calculatedDuration=Fd(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+n,this.totalDuration=this.resolvedDuration*(i+1)-n,this.generator=u}updateTime(t){const r=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(t,r=!1){const{generator:i,totalDuration:n,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return i.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:m,repeatDelay:h,type:g,onUpdate:y,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-n/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const v=this.currentTime-u*(this.playbackSpeed>=0?1:-1),w=this.playbackSpeed>=0?v<0:v>n;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=n);let x=this.currentTime,_=i;if(f){const z=Math.min(this.currentTime,n)/a;let K=Math.floor(z),J=z%1;!J&&z>=1&&(J=1),J===1&&K--,K=Math.min(K,f+1),!!(K%2)&&(m==="reverse"?(J=1-J,h&&(J-=h/a)):m==="mirror"&&(_=s)),x=zr(0,1,J)*a}let k;w?(this.delayState.value=d[0],k=this.delayState):k=_.next(x),o&&!w&&(k.value=o(k.value));let{done:C}=k;!w&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return O&&g!==Ul&&(k.value=La(d,this.options,b,this.speed)),y&&y(k.value),O&&this.finish(),k}then(t,r){return this.finished.then(t,r)}get duration(){return qn(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+qn(t)}get time(){return qn(this.currentTime)}set time(t){t=Ln(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const r=this.generator.next(t).value;return hw(i=>this.generator.next(i).value,t,r)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;r&&this.driver&&this.updateTime(Tn.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=qn(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=_6,startTime:r}=this.options;this.driver||(this.driver=t(n=>this.tick(n))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=r??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Tn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function F6(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ni=e=>e*180/Math.PI,Kl=e=>{const t=ni(Math.atan2(e[1],e[0]));return Vl(t)},N6={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Kl,rotateZ:Kl,skewX:e=>ni(Math.atan(e[1])),skewY:e=>ni(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Vl=e=>(e=e%360,e<0&&(e+=360),e),Lm=Kl,Fm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Nm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),R6={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fm,scaleY:Nm,scale:e=>(Fm(e)+Nm(e))/2,rotateX:e=>Vl(ni(Math.atan2(e[6],e[5]))),rotateY:e=>Vl(ni(Math.atan2(-e[2],e[0]))),rotateZ:Lm,rotate:Lm,skewX:e=>ni(Math.atan(e[4])),skewY:e=>ni(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Bl(e){return e.includes("scale")?1:0}function Zl(e,t){if(!e||e==="none")return Bl(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,n;if(r)i=R6,n=r;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=N6,n=a}if(!n)return Bl(t);const o=i[t],s=n[1].split(",").map(U6);return typeof o=="function"?o(s):s[o]}const j6=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return Zl(r,t)};function U6(e){return parseFloat(e.trim())}const Gi=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wi=new Set(Gi),Rm=e=>e===Hi||e===Ze,K6=new Set(["x","y","z"]),V6=Gi.filter(e=>!K6.has(e));function B6(e){const t=[];return V6.forEach(r=>{const i=e.getValue(r);i!==void 0&&(t.push([r,i.get()]),i.set(r.startsWith("scale")?1:0))}),t}const Ar={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:i})=>{const n=e.max-e.min;return i==="border-box"?n:n-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:i})=>{const n=e.max-e.min;return i==="border-box"?n:n-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Zl(t,"x"),y:(e,{transform:t})=>Zl(t,"y")};Ar.translateX=Ar.x;Ar.translateY=Ar.y;const ii=new Set;let Hl=!1,ql=!1,Gl=!1;function yw(){if(ql){const e=Array.from(ii).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),r=new Map;t.forEach(i=>{const n=B6(i);n.length&&(r.set(i,n),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const n=r.get(i);n&&n.forEach(([o,s])=>{i.getValue(o)?.set(s)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}ql=!1,Hl=!1,ii.forEach(e=>e.complete(Gl)),ii.clear()}function ww(){ii.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ql=!0)})}function Z6(){Gl=!0,ww(),yw(),Gl=!1}class Rd{constructor(t,r,i,n,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=i,this.motionValue=n,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(ii.add(this),Hl||(Hl=!0,Wn.read(ww),Wn.resolveKeyframes(yw))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:i,motionValue:n}=this;if(t[0]===null){const o=n?.get(),s=t[t.length-1];if(o!==void 0)t[0]=o;else if(i&&r){const a=i.readValue(r,s);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=s),n&&o===void 0&&n.set(t[0])}F6(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ii.delete(this)}cancel(){this.state==="scheduled"&&(ii.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const H6=e=>e.startsWith("--");function xw(e,t,r){H6(t)?e.style.setProperty(t,r):e.style[t]=r}const q6={};function _w(e,t){const r=B2(e);return()=>q6[t]??r()}const G6=_w(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),$w=_w(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),xo=([e,t,r,i])=>`cubic-bezier(${e}, ${t}, ${r}, ${i})`,jm={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:xo([0,.65,.55,1]),circOut:xo([.55,0,1,.45]),backIn:xo([.31,.01,.66,-.59]),backOut:xo([.33,1.53,.69,.99])};function Sw(e,t){if(e)return typeof e=="function"?$w()?mw(e,t):"ease-out":rw(e)?xo(e):Array.isArray(e)?e.map(r=>Sw(r,t)||jm.easeOut):jm[e]}function W6(e,t,r,{delay:i=0,duration:n=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},u=void 0){const d={[t]:r};l&&(d.offset=l);const f=Sw(a,n);Array.isArray(f)&&(d.easing=f);const m={delay:i,duration:n,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return u&&(m.pseudoElement=u),e.animate(d,m)}function jd(e){return typeof e=="function"&&"applyToOptions"in e}function X6({type:e,...t}){return jd(e)&&$w()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class kw extends Nd{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:r,name:i,keyframes:n,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=t,Td(typeof t.type!="string");const u=X6(t);this.animation=W6(r,i,n,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=La(n,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(d),xw(r,i,d),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return qn(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+qn(t)}get time(){return qn(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ln(t),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:r,rangeEnd:i,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&G6()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),i&&(this.animation.rangeEnd=i),Zi):n(this)}}const Cw={anticipate:J2,backInOut:Y2,circInOut:Q2};function Y6(e){return e in Cw}function J6(e){typeof e.ease=="string"&&Y6(e.ease)&&(e.ease=Cw[e.ease])}const fl=10;class Q6 extends kw{constructor(t){J6(t),bw(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:i,onComplete:n,element:o,...s}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const a=new Fo({...s,autoplay:!1}),l=Math.max(fl,Tn.now()-this.startTime),u=zr(0,fl,l-fl),d=a.sample(l).value,{name:f}=this.options;o&&f&&xw(o,f,d),r.setWithVelocity(a.sample(Math.max(0,l-u)).value,d,u),a.stop()}}const Um=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Xn.test(e)||e==="0")&&!e.startsWith("url("));function eP(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function tP(e,t,r,i){const n=e[0];if(n===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],s=Um(n,t),a=Um(o,t);return!s||!a?!1:eP(e)||(r==="spring"||jd(r))&&i}function Wl(e){e.duration=0,e.type="keyframes"}const Iw=new Set(["opacity","clipPath","filter","transform"]),nP=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function rP(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&nP.test(e[t]))return!0;return!1}const iP=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),oP=B2(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function sP(e){const{motionValue:t,name:r,repeatDelay:i,repeatType:n,damping:o,type:s,keyframes:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return oP()&&r&&(Iw.has(r)||iP.has(r)&&rP(a))&&(r!=="transform"||!d)&&!u&&!i&&n!=="mirror"&&o!==0&&s!=="inertia"}const aP=40;class lP extends Nd{constructor({autoplay:t=!0,delay:r=0,type:i="keyframes",repeat:n=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:l,motionValue:u,element:d,...f}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Tn.now();const m={autoplay:t,delay:r,type:i,repeat:n,repeatDelay:o,repeatType:s,name:l,motionValue:u,element:d,...f},h=d?.KeyframeResolver||Rd;this.keyframeResolver=new h(a,(g,y,b)=>this.onKeyframesResolved(g,y,m,!b),l,u,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,r,i,n){this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:l,isHandoff:u,onUpdate:d}=i;this.resolvedAt=Tn.now();let f=!0;tP(t,o,s,a)||(f=!1,(Lr.instantAnimations||!l)&&d?.(La(t,i,r)),t[0]=t[t.length-1],Wl(i),i.repeat=0);const h={startTime:n?this.resolvedAt?this.resolvedAt-this.createdAt>aP?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...i,keyframes:t},g=f&&!u&&sP(h),y=h.motionValue?.owner?.current;let b;if(g)try{b=new Q6({...h,element:y})}catch{b=new Fo(h)}else b=new Fo(h);b.finished.then(()=>{this.notifyFinished()}).catch(Zi),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}get finished(){return this._animation?this.animation.finished:this._finished}then(t,r){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Z6()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class cP{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,r){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=r}attachTimeline(t){const r=this.animations.map(i=>i.attachTimeline(t));return()=>{r.forEach((i,n)=>{i&&i(),this.animations[n].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return Km(this.animations,"duration")}get iterationDuration(){return Km(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(r=>r[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Km(e,t){let r=0;for(let i=0;i<e.length;i++){const n=e[i][t];n!==null&&n>r&&(r=n)}return r}class uP extends cP{then(t,r){return this.finished.finally(t).then(()=>{})}}const dP=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fP(e){const t=dP.exec(e);if(!t)return[,];const[,r,i,n]=t;return[`--${r??i}`,n]}function Tw(e,t,r=1){const[i,n]=fP(e);if(!i)return;const o=window.getComputedStyle(t).getPropertyValue(i);if(o){const s=o.trim();return K2(s)?parseFloat(s):s}return Ed(n)?Tw(n,t,r+1):n}const mP={type:"spring",stiffness:500,damping:25,restSpeed:10},gP=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),hP={type:"keyframes",duration:.8},pP={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vP=(e,{keyframes:t})=>t.length>2?hP:Wi.has(e)?e.startsWith("scale")?gP(t[1]):mP:pP;function Dw(e,t){if(e?.inherit&&t){const{inherit:r,...i}=e;return{...t,...i}}return e}function Aw(e,t){const r=e?.[t]??e?.default??e;return r!==e?Dw(r,e):r}const bP=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function yP(e){for(const t in e)if(!bP.has(t))return!0;return!1}const Pw=(e,t,r,i={},n,o)=>s=>{const a=Aw(i,e)||{},l=a.delay||i.delay||0;let{elapsed:u=0}=i;u=u-Ln(l);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:m=>{t.set(m),a.onUpdate&&a.onUpdate(m)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:n};yP(a)||Object.assign(d,vP(e,d)),d.duration&&(d.duration=Ln(d.duration)),d.repeatDelay&&(d.repeatDelay=Ln(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Wl(d),d.delay===0&&(f=!0)),(Lr.instantAnimations||Lr.skipAnimations||n?.shouldSkipAnimations)&&(f=!0,Wl(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,f&&!o&&t.get()!==void 0){const m=La(d.keyframes,a);if(m!==void 0){Wn.update(()=>{d.onUpdate(m),d.onComplete()});return}}return a.isSync?new Fo(d):new lP(d)};function Vm(e){const t=[{},{}];return e?.values.forEach((r,i)=>{t[0][i]=r.get(),t[1][i]=r.getVelocity()}),t}function Ow(e,t,r,i){if(typeof t=="function"){const[n,o]=Vm(i);t=t(r!==void 0?r:e.custom,n,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[n,o]=Vm(i);t=t(r!==void 0?r:e.custom,n,o)}return t}function wP(e,t,r){const i=e.getProps();return Ow(i,t,i.custom,e)}const Ew=new Set(["width","height","top","left","right","bottom",...Gi]),Bm=30,xP=e=>!isNaN(parseFloat(e));class _P{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const n=Tn.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=Tn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xP(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new Z2);const i=this.events[t].add(r);return t==="change"?()=>{i(),Wn.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,r,i){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Tn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Bm)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,Bm);return H2(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Fr(e,t){return new _P(e,t)}const $P=e=>Array.isArray(e);function SP(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Fr(r))}function kP(e){return $P(e)?e[e.length-1]||0:e}function CP(e,t){const r=wP(e,t);let{transitionEnd:i={},transition:n={},...o}=r||{};o={...o,...i};for(const s in o){const a=kP(o[s]);SP(e,s,a)}}const cn=e=>!!(e&&e.getVelocity);function IP(e){return!!(cn(e)&&e.add)}function TP(e,t){const r=e.getValue("willChange");if(IP(r))return r.add(t);if(!r&&Lr.WillChange){const i=new Lr.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function Ud(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const DP="framerAppearId",AP="data-"+Ud(DP);function PP(e){return e.props[AP]}function OP({protectedKeys:e,needsAnimating:t},r){const i=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,i}function EP(e,t,{delay:r=0,transitionOverride:i,type:n}={}){let{transition:o,transitionEnd:s,...a}=t;const l=e.getDefaultTransition();o=o?Dw(o,l):l;const u=o?.reduceMotion;i&&(o=i);const d=[],f=n&&e.animationState&&e.animationState.getState()[n];for(const m in a){const h=e.getValue(m,e.latestValues[m]??null),g=a[m];if(g===void 0||f&&OP(f,m))continue;const y={delay:r,...Aw(o||{},m)},b=h.get();if(b!==void 0&&!h.isAnimating()&&!Array.isArray(g)&&g===b&&!y.velocity){Wn.update(()=>h.set(g));continue}let v=!1;if(window.MotionHandoffAnimation){const _=PP(e);if(_){const k=window.MotionHandoffAnimation(_,m,Wn);k!==null&&(y.startTime=k,v=!0)}}TP(e,m);const w=u??e.shouldReduceMotion;h.start(Pw(m,h,g,w&&Ew.has(m)?{type:!1}:y,e,v));const x=h.animation;x&&d.push(x)}if(s){const m=()=>Wn.update(()=>{s&&CP(e,s)});d.length?Promise.all(d).then(m):m()}return d}const MP={test:e=>e==="auto",parse:e=>e},Mw=e=>t=>t.test(e),zw=[Hi,Ze,ki,Ir,r6,n6,MP],Zm=e=>zw.find(Mw(e));function zP(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||V2(e):!0}const LP=new Set(["brightness","contrast","saturate","opacity"]);function FP(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=r.match(Md)||[];if(!i)return e;const n=r.replace(i,"");let o=LP.has(t)?1:0;return i!==r&&(o*=100),t+"("+o+n+")"}const NP=/\b([a-z-]*)\(.*?\)/gu,Xl={...Xn,getAnimatableNone:e=>{const t=e.match(NP);return t?t.map(FP).join(" "):e}},Yl={...Xn,getAnimatableNone:e=>{const t=Xn.parse(e);return Xn.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},Hm={...Hi,transform:Math.round},RP={rotate:Ir,rotateX:Ir,rotateY:Ir,rotateZ:Ir,scale:Ss,scaleX:Ss,scaleY:Ss,scaleZ:Ss,skew:Ir,skewX:Ir,skewY:Ir,distance:Ze,translateX:Ze,translateY:Ze,translateZ:Ze,x:Ze,y:Ze,z:Ze,perspective:Ze,transformPerspective:Ze,opacity:zo,originX:Pm,originY:Pm,originZ:Ze},Kd={borderWidth:Ze,borderTopWidth:Ze,borderRightWidth:Ze,borderBottomWidth:Ze,borderLeftWidth:Ze,borderRadius:Ze,borderTopLeftRadius:Ze,borderTopRightRadius:Ze,borderBottomRightRadius:Ze,borderBottomLeftRadius:Ze,width:Ze,maxWidth:Ze,height:Ze,maxHeight:Ze,top:Ze,right:Ze,bottom:Ze,left:Ze,inset:Ze,insetBlock:Ze,insetBlockStart:Ze,insetBlockEnd:Ze,insetInline:Ze,insetInlineStart:Ze,insetInlineEnd:Ze,padding:Ze,paddingTop:Ze,paddingRight:Ze,paddingBottom:Ze,paddingLeft:Ze,paddingBlock:Ze,paddingBlockStart:Ze,paddingBlockEnd:Ze,paddingInline:Ze,paddingInlineStart:Ze,paddingInlineEnd:Ze,margin:Ze,marginTop:Ze,marginRight:Ze,marginBottom:Ze,marginLeft:Ze,marginBlock:Ze,marginBlockStart:Ze,marginBlockEnd:Ze,marginInline:Ze,marginInlineStart:Ze,marginInlineEnd:Ze,fontSize:Ze,backgroundPositionX:Ze,backgroundPositionY:Ze,...RP,zIndex:Hm,fillOpacity:zo,strokeOpacity:zo,numOctaves:Hm},jP={...Kd,color:qt,backgroundColor:qt,outlineColor:qt,fill:qt,stroke:qt,borderColor:qt,borderTopColor:qt,borderRightColor:qt,borderBottomColor:qt,borderLeftColor:qt,filter:Xl,WebkitFilter:Xl,mask:Yl,WebkitMask:Yl},Lw=e=>jP[e],UP=new Set([Xl,Yl]);function Fw(e,t){let r=Lw(e);return UP.has(r)||(r=Xn),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const KP=new Set(["auto","none","0"]);function VP(e,t,r){let i=0,n;for(;i<e.length&&!n;){const o=e[i];typeof o=="string"&&!KP.has(o)&&Mi(o).values.length&&(n=e[i]),i++}if(n&&r)for(const o of t)e[o]=Fw(r,n)}class BP extends Rd{constructor(t,r,i,n,o){super(t,r,i,n,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:i}=this;if(!r||!r.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let f=t[d];if(typeof f=="string"&&(f=f.trim(),Ed(f))){const m=Tw(f,r.current);m!==void 0&&(t[d]=m),d===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!Ew.has(i)||t.length!==2)return;const[n,o]=t,s=Zm(n),a=Zm(o),l=Am(n),u=Am(o);if(l!==u&&Ar[i]){this.needsMeasurement=!0;return}if(s!==a)if(Rm(s)&&Rm(a))for(let d=0;d<t.length;d++){const f=t[d];typeof f=="string"&&(t[d]=parseFloat(f))}else Ar[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,i=[];for(let n=0;n<t.length;n++)(t[n]===null||zP(t[n]))&&i.push(n);i.length&&VP(t,i,r)}measureInitialState(){const{element:t,unresolvedKeyframes:r,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ar[i](t.measureViewportBox(),window.getComputedStyle(t.current)),r[0]=this.measuredOrigin;const n=r[r.length-1];n!==void 0&&t.getValue(i,n).jump(n,!1)}measureEndState(){const{element:t,name:r,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const n=t.getValue(r);n&&n.jump(this.measuredOrigin,!1);const o=i.length-1,s=i[o];i[o]=Ar[r](t.measureViewportBox(),window.getComputedStyle(t.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,l])=>{t.getValue(a).set(l)}),this.resolveNoneKeyframes()}}function ZP(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;t&&(i=t.current);const n=r?.[e]??i.querySelectorAll(e);return n?Array.from(n):[]}return Array.from(e).filter(i=>i!=null)}const Nw=(e,t)=>t&&typeof e=="number"?t.transform(e):e,{schedule:HP}=iw(queueMicrotask,!1);function Rw(e){return LA(e)&&"ownerSVGElement"in e}function qP(e){return Rw(e)&&e.tagName==="svg"}function GP(e,t,r={}){const i=e.get();let n=null,o=i,s;const a=typeof i=="string"?i.replace(/[\d.-]/g,""):void 0,l=()=>{n&&(n.stop(),n=null),e.animation=void 0},u=()=>{const f=qm(e.get()),m=qm(o);if(f===m){l();return}const h=n?n.getGeneratorVelocity():e.getVelocity();l(),n=new Fo({keyframes:[f,m],velocity:h,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:s})},d=()=>{u(),e.animation=n??void 0,e.events.animationStart?.notify(),n?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((f,m)=>{o=f,s=h=>m(ml(h,a)),Wn.postRender(d)},l),cn(t)){let f=r.skipInitialAnimation===!0;const m=t.on("change",g=>{f?(f=!1,e.jump(ml(g,a),!1)):e.set(ml(g,a))}),h=e.on("destroy",m);return()=>{m(),h()}}return l}function ml(e,t){return t?e+t:e}function qm(e){return typeof e=="number"?e:parseFloat(e)}function Gm(e,t,r){return GP(e,t,{type:"spring",...r})}const WP=[...zw,qt,Xn],XP=e=>WP.find(Mw(e)),Wm=()=>({min:0,max:0}),Vd=()=>({x:Wm(),y:Wm()}),No=new WeakMap;function YP(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function JP(e){return typeof e=="string"||Array.isArray(e)}const QP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],eO=["initial",...QP];function jw(e){return YP(e.animate)||eO.some(t=>JP(e[t]))}function tO(e){return!!(jw(e)||e.variants)}function nO(e,t,r){for(const i in t){const n=t[i],o=r[i];if(cn(n))e.addValue(i,n);else if(cn(o))e.addValue(i,Fr(n,{owner:e}));else if(o!==n)if(e.hasValue(i)){const s=e.getValue(i);s.liveStyle===!0?s.jump(n):s.hasAnimated||s.set(n)}else{const s=e.getStaticValue(i);e.addValue(i,Fr(s!==void 0?s:n,{owner:e}))}}for(const i in r)t[i]===void 0&&e.removeValue(i);return t}const Jl={current:null},Uw={current:!1},rO=typeof window<"u";function iO(){if(Uw.current=!0,!!rO)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Jl.current=e.matches;e.addEventListener("change",t),t()}else Jl.current=!1}const Xm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ym={};class Kw{scrapeMotionValuesFromProps(t,r,i){return{}}constructor({parent:t,props:r,presenceContext:i,reducedMotionConfig:n,skipAnimations:o,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Rd,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=Tn.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,Wn.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=a;this.latestValues=u,this.baseTarget={...u},this.initialValues=r.initial?{...u}:{},this.renderState=d,this.parent=t,this.props=r,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=o,this.options=l,this.blockInitialAnimation=!!s,this.isControllingVariants=jw(r),this.isVariantNode=tO(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...m}=this.scrapeMotionValuesFromProps(r,{},this);for(const h in m){const g=m[h];u[h]!==void 0&&cn(g)&&g.set(u[h])}}mount(t){if(this.hasBeenMounted)for(const r in this.initialValues)this.values.get(r)?.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=t,No.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Uw.current||iO(),this.shouldReduceMotion=Jl.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Fl(this.notifyUpdate),Fl(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const r=this.features[t];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),r.accelerate&&Iw.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:a,times:l,ease:u,duration:d}=r.accelerate,f=new kw({element:this.current,name:t,keyframes:a,times:l,ease:u,duration:Ln(d)}),m=s(f);this.valueSubscriptions.set(t,()=>{m(),f.cancel()});return}const i=Wi.has(t);i&&this.onBindTransform&&this.onBindTransform();const n=r.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&Wn.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{n(),o&&o(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ym){const r=Ym[t];if(!r)continue;const{isEnabled:i,Feature:n}=r;if(!this.features[t]&&n&&i(this.props)&&(this.features[t]=new n(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Vd()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let i=0;i<Xm.length;i++){const n=Xm[i];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const o="on"+n,s=t[o];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=nO(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const i=this.values.get(t);r!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&r!==void 0&&(i=Fr(r===null?void 0:r,{owner:this}),this.addValue(t,i)),i}readValue(t,r){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(K2(i)||V2(i))?i=parseFloat(i):!XP(i)&&Xn.test(r)&&(i=Fw(t,r)),this.setBaseTarget(t,cn(i)?i.get():i)),cn(i)?i.get():i}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const o=Ow(this.props,r,this.presenceContext?.custom);o&&(i=o[t])}if(r&&i!==void 0)return i;const n=this.getBaseTargetFromProps(this.props,t);return n!==void 0&&!cn(n)?n:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Z2),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){HP.render(this.render)}}class Vw extends Kw{constructor(){super(...arguments),this.KeyframeResolver=BP}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){const i=t.style;return i?i[r]:void 0}removeValueFromRenderState(t,{vars:r,style:i}){delete r[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;cn(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function oO({top:e,left:t,right:r,bottom:i}){return{x:{min:t,max:r},y:{min:e,max:i}}}function sO(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:i.y,right:i.x}}function aO(e,t){return oO(sO(e.getBoundingClientRect(),t))}const lO={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cO=Gi.length;function uO(e,t,r){let i="",n=!0;for(let o=0;o<cO;o++){const s=Gi[o],a=e[s];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(s.startsWith("scale")?1:0);else{const u=parseFloat(a);l=s.startsWith("scale")?u===1:u===0}if(!l||r){const u=Nw(a,Kd[s]);if(!l){n=!1;const d=lO[s]||s;i+=`${d}(${u}) `}r&&(t[s]=u)}}return i=i.trim(),r?i=r(t,n?"":i):n&&(i="none"),i}function Bw(e,t,r){const{style:i,vars:n,transformOrigin:o}=e;let s=!1,a=!1;for(const l in t){const u=t[l];if(Wi.has(l)){s=!0;continue}else if(sw(l)){n[l]=u;continue}else{const d=Nw(u,Kd[l]);l.startsWith("origin")?(a=!0,o[l]=d):i[l]=d}}if(t.transform||(s||r?i.transform=uO(t,e.transform,r):i.transform&&(i.transform="none")),a){const{originX:l="50%",originY:u="50%",originZ:d=0}=o;i.transformOrigin=`${l} ${u} ${d}`}}function Zw(e,{style:t,vars:r},i,n){const o=e.style;let s;for(s in t)o[s]=t[s];n?.applyProjectionStyles(o,i);for(s in r)o.setProperty(s,r[s])}function Jm(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ho={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ze.test(e))e=parseFloat(e);else return e;const r=Jm(e,t.target.x),i=Jm(e,t.target.y);return`${r}% ${i}%`}},dO={correct:(e,{treeScale:t,projectionDelta:r})=>{const i=e,n=Xn.parse(e);if(n.length>5)return i;const o=Xn.createTransformer(e),s=typeof n[0]!="number"?1:0,a=r.x.scale*t.x,l=r.y.scale*t.y;n[0+s]/=a,n[1+s]/=l;const u=qi(a,l,.5);return typeof n[2+s]=="number"&&(n[2+s]/=u),typeof n[3+s]=="number"&&(n[3+s]/=u),o(n)}},fO={borderRadius:{...ho,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ho,borderTopRightRadius:ho,borderBottomLeftRadius:ho,borderBottomRightRadius:ho,boxShadow:dO};function mO(e,{layout:t,layoutId:r}){return Wi.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!fO[e]||e==="opacity")}function Hw(e,t,r){const i=e.style,n=t?.style,o={};if(!i)return o;for(const s in i)(cn(i[s])||n&&cn(n[s])||mO(s,e)||r?.getValue(s)?.liveStyle!==void 0)&&(o[s]=i[s]);return o}function gO(e){return window.getComputedStyle(e)}class hO extends Vw{constructor(){super(...arguments),this.type="html",this.renderInstance=Zw}readValueFromInstance(t,r){if(Wi.has(r))return this.projection?.isProjecting?Bl(r):j6(t,r);{const i=gO(t),n=(sw(r)?i.getPropertyValue(r):i[r])||0;return typeof n=="string"?n.trim():n}}measureInstanceViewportBox(t,{transformPagePoint:r}){return aO(t,r)}build(t,r,i){Bw(t,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,r,i){return Hw(t,r,i)}}function pO(e,t){return e in t}class vO extends Kw{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,r){if(pO(r,t)){const i=t[r];if(typeof i=="string"||typeof i=="number")return i}}getBaseTargetFromProps(){}removeValueFromRenderState(t,r){delete r.output[t]}measureInstanceViewportBox(){return Vd()}build(t,r){Object.assign(t.output,r)}renderInstance(t,{output:r}){Object.assign(t,r)}sortInstanceNodePosition(){return 0}}const bO={offset:"stroke-dashoffset",array:"stroke-dasharray"},yO={offset:"strokeDashoffset",array:"strokeDasharray"};function wO(e,t,r=1,i=0,n=!0){e.pathLength=1;const o=n?bO:yO;e[o.offset]=`${-i}`,e[o.array]=`${t} ${r}`}const xO=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function _O(e,{attrX:t,attrY:r,attrScale:i,pathLength:n,pathSpacing:o=1,pathOffset:s=0,...a},l,u,d){if(Bw(e,a,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m}=e;f.transform&&(m.transform=f.transform,delete f.transform),(m.transform||f.transformOrigin)&&(m.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),m.transform&&(m.transformBox=d?.transformBox??"fill-box",delete f.transformBox);for(const h of xO)f[h]!==void 0&&(m[h]=f[h],delete f[h]);t!==void 0&&(f.x=t),r!==void 0&&(f.y=r),i!==void 0&&(f.scale=i),n!==void 0&&wO(f,n,o,s,!1)}const qw=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),$O=e=>typeof e=="string"&&e.toLowerCase()==="svg";function SO(e,t,r,i){Zw(e,t,void 0,i);for(const n in t.attrs)e.setAttribute(qw.has(n)?n:Ud(n),t.attrs[n])}function kO(e,t,r){const i=Hw(e,t,r);for(const n in e)if(cn(e[n])||cn(t[n])){const o=Gi.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;i[o]=e[n]}return i}class CO extends Vw{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Vd}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Wi.has(r)){const i=Lw(r);return i&&i.default||0}return r=qw.has(r)?r:Ud(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,i){return kO(t,r,i)}build(t,r,i){_O(t,r,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,r,i,n){SO(t,r,i,n)}mount(t){this.isSVGTag=$O(t.tagName),super.mount(t)}}function IO(e,t,r){const i=cn(e)?e:Fr(e);return i.start(Pw("",i,t,r)),i.animation}function Bd(e){return typeof e=="object"&&!Array.isArray(e)}function Gw(e,t,r,i){return e==null?[]:typeof e=="string"&&Bd(t)?ZP(e,r,i):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(n=>n!=null):[e]}function TO(e,t,r){return e*(t+1)}function Qm(e,t,r,i){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?r:t.startsWith("<")?Math.max(0,r+parseFloat(t.slice(1))):i.get(t)??e}function DO(e,t,r){for(let i=0;i<e.length;i++){const n=e[i];n.at>t&&n.at<r&&(Id(e,n),i--)}}function AO(e,t,r,i,n,o){DO(e,n,o);for(let s=0;s<t.length;s++)e.push({value:t[s],at:qi(n,o,i[s]),easing:nw(r,s)})}function PO(e,t){for(let r=0;r<e.length;r++)e[r]=e[r]/(t+1)}function OO(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const EO="easeInOut";function MO(e,{defaultTransition:t={},...r}={},i,n){const o=t.duration||.3,s=new Map,a=new Map,l={},u=new Map;let d=0,f=0,m=0;for(let h=0;h<e.length;h++){const g=e[h];if(typeof g=="string"){u.set(g,f);continue}else if(!Array.isArray(g)){u.set(g.name,Qm(f,g.at,d,u));continue}let[y,b,v={}]=g;v.at!==void 0&&(f=Qm(f,v.at,d,u));let w=0;const x=(_,k,C,O=0,z=0)=>{const K=zO(_),{delay:J=0,times:T=vw(K),type:M=t.type||"keyframes",repeat:U,repeatType:A,repeatDelay:j=0,...P}=k;let{ease:B=t.ease||"easeOut",duration:R}=k;const V=typeof J=="function"?J(O,z):J,Q=K.length,ee=jd(M)?M:n?.[M||"keyframes"];if(Q<=2&&ee){let D=100;if(Q===2&&NO(K)){const Z=K[1]-K[0];D=Math.abs(Z)}const te={...t,...P};R!==void 0&&(te.duration=Ln(R));const H=gw(te,D,ee);B=H.ease,R=H.duration}R??(R=o);const oe=f+V;T.length===1&&T[0]===0&&(T[1]=1);const le=T.length-K.length;if(le>0&&pw(T,le),K.length===1&&K.unshift(null),U){R=TO(R,U);const D=[...K],te=[...T];B=Array.isArray(B)?[...B]:[B];const H=[...B];for(let Z=0;Z<U;Z++){K.push(...D);for(let se=0;se<D.length;se++)T.push(te[se]+(Z+1)),B.push(se===0?"linear":nw(H,se-1))}PO(T,U)}const W=oe+R;AO(C,K,B,T,oe,W),w=Math.max(V+R,w),m=Math.max(W,m)};if(cn(y)){const _=eg(y,a);x(b,v,tg("default",_))}else{const _=Gw(y,b,i,l),k=_.length;for(let C=0;C<k;C++){b=b,v=v;const O=_[C],z=eg(O,a);for(const K in b)x(b[K],LO(v,K),tg(K,z),C,k)}}d=f,f+=w}return a.forEach((h,g)=>{for(const y in h){const b=h[y];b.sort(OO);const v=[],w=[],x=[];for(let O=0;O<b.length;O++){const{at:z,value:K,easing:J}=b[O];v.push(K),w.push(Ad(0,m,z)),x.push(J||"easeOut")}w[0]!==0&&(w.unshift(0),v.unshift(v[0]),x.unshift(EO)),w[w.length-1]!==1&&(w.push(1),v.push(null)),s.has(g)||s.set(g,{keyframes:{},transition:{}});const _=s.get(g);_.keyframes[y]=v;const{type:k,...C}=t;_.transition[y]={...C,duration:m,ease:x,times:w,...r}}}),s}function eg(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function tg(e,t){return t[e]||(t[e]=[]),t[e]}function zO(e){return Array.isArray(e)?e:[e]}function LO(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const FO=e=>typeof e=="number",NO=e=>e.every(FO);function RO(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},r=Rw(e)&&!qP(e)?new CO(t):new hO(t);r.mount(e),No.set(e,r)}function jO(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},r=new vO(t);r.mount(e),No.set(e,r)}function UO(e,t){return cn(e)||typeof e=="number"||typeof e=="string"&&!Bd(t)}function Ww(e,t,r,i){const n=[];if(UO(e,t))n.push(IO(e,Bd(t)&&t.default||t,r&&(r.default||r)));else{if(e==null)return n;const o=Gw(e,t,i),s=o.length;for(let a=0;a<s;a++){const l=o[a],u=l instanceof Element?RO:jO;No.has(l)||u(l);const d=No.get(l),f={...r};"delay"in f&&typeof f.delay=="function"&&(f.delay=f.delay(a,s)),n.push(...EP(d,{...t,transition:f},{}))}}return n}function KO(e,t,r){const i=[],n=e.map(s=>{if(Array.isArray(s)&&typeof s[0]=="function"){const a=s[0],l=Fr(0);return l.on("change",a),s.length===1?[l,[0,1]]:s.length===2?[l,[0,1],s[1]]:[l,s[1],s[2]]}return s});return MO(n,t,r,{spring:Lo}).forEach(({keyframes:s,transition:a},l)=>{i.push(...Ww(l,s,a))}),i}function VO(e){return Array.isArray(e)&&e.some(Array.isArray)}function BO(e={}){const{scope:t,reduceMotion:r}=e;function i(n,o,s){let a=[],l;if(VO(n)){const{onComplete:d,...f}=o||{};typeof d=="function"&&(l=d),a=KO(n,r!==void 0?{reduceMotion:r,...f}:f,t)}else{const{onComplete:d,...f}=s||{};typeof d=="function"&&(l=d),a=Ww(n,o,r!==void 0?{reduceMotion:r,...f}:f,t)}const u=new uP(a);return l&&u.finished.then(l),t&&(t.animations.push(u),u.finished.then(()=>{Id(t.animations,u)})),u}return i}const Ys=BO(),ZO=(e,t)=>e?.visualDuration===t?.visualDuration&&e?.bounce===t?.bounce&&e?.stiffness===t?.stiffness&&e?.damping===t?.damping&&e?.mass===t?.mass&&e?.velocity===t?.velocity;function Fa(e,t){const r=()=>typeof t=="function"?t():t,[i,n]=ze(e()),o=Fr(i()),s=Fr(i());let a=r(),l=Gm(s,o,a),u=s.on("change",d=>n(d));return ne(()=>{o.set(e())}),ne(()=>{if(!t)return;const d=r();ZO(a,d)||(a=d,l(),l=Gm(s,o,d),n(s.get()))}),je(()=>{u(),l(),s.destroy(),o.destroy()}),i}var Xw=I("<div>"),HO=I("<form>");function qO(e){const[t,r]=$e(e,["children","class","classList"]);return(()=>{var i=Xw();return dn(i,ie(r,{"data-dock-surface":"shell",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}function GO(e){const[t,r]=$e(e,["children","class","classList"]);return(()=>{var i=HO();return dn(i,ie(r,{"data-dock-surface":"shell",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}function Na(e){const[t,r]=$e(e,["attach","children","class","classList"]);return(()=>{var i=Xw();return dn(i,ie(r,{"data-dock-surface":"tray",get"data-dock-attach"(){return t.attach||"none"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}var WO={};ir(WO,{Anchor:()=>Jw,Arrow:()=>Fi,CloseButton:()=>Qw,Content:()=>e1,Description:()=>t1,Popover:()=>fr,Portal:()=>n1,Root:()=>r1,Title:()=>i1,Trigger:()=>o1,usePopoverContext:()=>Vr});var Yw=Rt();function Vr(){const e=jt(Yw);if(e===void 0)throw new Error("[kobalte]: `usePopoverContext` must be used within a `Popover` component");return e}function Jw(e){const t=Vr(),[r,i]=$e(e,["ref"]);return c(it,ie({as:"div",ref(n){var o=xt(t.setDefaultAnchorRef,r.ref);typeof o=="function"&&o(n)}},()=>t.dataset(),i))}function Qw(e){const t=Vr(),[r,i]=$e(e,["aria-label","onClick"]);return c(Ro,ie({get"aria-label"(){return r["aria-label"]||t.translations().dismiss},onClick:o=>{Qe(o,r.onClick),t.close()}},()=>t.dataset(),i))}function e1(e){let t;const r=Vr(),i=Ge({id:r.generateId("content")},e),[n,o]=$e(i,["ref","style","onOpenAutoFocus","onCloseAutoFocus","onPointerDownOutside","onFocusOutside","onInteractOutside"]);let s=!1,a=!1,l=!1;const u=h=>{n.onCloseAutoFocus?.(h),r.isModal()?(h.preventDefault(),s||vn(r.triggerRef())):(h.defaultPrevented||(a||vn(r.triggerRef()),h.preventDefault()),a=!1,l=!1)},d=h=>{n.onPointerDownOutside?.(h),r.isModal()&&(s=h.detail.isContextMenu)},f=h=>{n.onFocusOutside?.(h),r.isOpen()&&r.isModal()&&h.preventDefault()},m=h=>{n.onInteractOutside?.(h),!r.isModal()&&(h.defaultPrevented||(a=!0,h.detail.originalEvent.type==="pointerdown"&&(l=!0)),Do(r.triggerRef(),h.target)&&h.preventDefault(),h.detail.originalEvent.type==="focusin"&&l&&h.preventDefault())};return dc({isDisabled:()=>!(r.isOpen()&&r.isModal()),targets:()=>t?[t]:[]}),fc({element:()=>t??null,enabled:()=>r.contentPresent()&&r.preventScroll()}),mc({trapFocus:()=>r.isOpen()&&r.isModal(),onMountAutoFocus:n.onOpenAutoFocus,onUnmountAutoFocus:u},()=>t),ne(()=>je(r.registerContentId(o.id))),c(F,{get when(){return r.contentPresent()},get children(){return c(Ni.Positioner,{get children(){return c(gc,ie({ref(h){var g=xt(y=>{r.setContentRef(y),t=y},n.ref);typeof g=="function"&&g(h)},role:"dialog",tabIndex:-1,get disableOutsidePointerEvents(){return Te(()=>!!r.isOpen())()&&r.isModal()},get excludedElements(){return[r.triggerRef]},get style(){return vr({"--kb-popover-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},n.style)},get"aria-labelledby"(){return r.titleId()},get"aria-describedby"(){return r.descriptionId()},onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,get onDismiss(){return r.close}},()=>r.dataset(),o))}})}})}function t1(e){const t=Vr(),r=Ge({id:t.generateId("description")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerDescriptionId(i.id))),c(it,ie({as:"p",get id(){return i.id}},()=>t.dataset(),n))}function n1(e){const t=Vr();return c(F,{get when(){return t.contentPresent()},get children(){return c(hr,e)}})}var ng={dismiss:"Dismiss"};function r1(e){const t=`popover-${nn()}`,r=Ge({id:t,modal:!1,translations:ng},e),[i,n]=$e(r,["translations","id","open","defaultOpen","onOpenChange","modal","preventScroll","forceMount","anchorRef"]),[o,s]=ze(),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),[h,g]=ze(),[y,b]=ze(),v=jo({open:()=>i.open,defaultOpen:()=>i.defaultOpen,onOpenChange:C=>i.onOpenChange?.(C)}),w=()=>i.anchorRef?.()??o()??a(),{present:x}=li({show:()=>i.forceMount||v.isOpen(),element:()=>u()??null}),_=$(()=>({"data-expanded":v.isOpen()?"":void 0,"data-closed":v.isOpen()?void 0:""})),k={translations:()=>i.translations??ng,dataset:_,isOpen:v.isOpen,isModal:()=>i.modal??!1,preventScroll:()=>i.preventScroll??k.isModal(),contentPresent:x,triggerRef:a,contentId:f,titleId:h,descriptionId:y,setDefaultAnchorRef:s,setTriggerRef:l,setContentRef:d,close:v.close,toggle:v.toggle,generateId:Nn(()=>i.id),registerContentId:tn(m),registerTitleId:tn(g),registerDescriptionId:tn(b)};return c(Yw.Provider,{value:k,get children(){return c(Ni,ie({anchorRef:w,contentRef:u},n))}})}function i1(e){const t=Vr(),r=Ge({id:t.generateId("title")},e),[i,n]=$e(r,["id"]);return ne(()=>je(t.registerTitleId(i.id))),c(it,ie({as:"h2",get id(){return i.id}},()=>t.dataset(),n))}function o1(e){const t=Vr(),[r,i]=$e(e,["ref","onClick","onPointerDown"]);return c(Ro,ie({ref(s){var a=xt(t.setTriggerRef,r.ref);typeof a=="function"&&a(s)},"aria-haspopup":"dialog",get"aria-expanded"(){return t.isOpen()},get"aria-controls"(){return Te(()=>!!t.isOpen())()?t.contentId():void 0},onPointerDown:s=>{Qe(s,r.onPointerDown),s.preventDefault()},onClick:s=>{Qe(s,r.onClick),t.toggle()}},()=>t.dataset(),i))}var fr=Object.assign(r1,{Anchor:Jw,Arrow:Fi,CloseButton:Qw,Content:e1,Description:t1,Portal:n1,Title:i1,Trigger:o1}),XO=I("<span>");function YO(e){const[t,r]=$e(e,["size","class","classList","children"]);return(()=>{var i=XO();return dn(i,ie(r,{"data-component":"tag",get"data-size"(){return t.size||"normal"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}var JO=I("<div data-slot=list-item-add>"),QO=I("<div data-slot=list-header>"),rg=I("<span>"),eE=I("<span data-slot=list-filter>&quot;<!>&quot;"),tE=I("<div data-slot=list-search-wrapper><div data-slot=list-search><div data-slot=list-search-container>"),ig=I("<div data-slot=list-group><div data-slot=list-items>"),nE=I("<div data-component=list><div data-slot=list-scroll>"),rE=I("<div data-slot=list-empty-state><div data-slot=list-message>"),iE=I("<span data-slot=list-item-selected-icon>"),oE=I("<button data-slot=list-item type=button>"),sE=I("<span data-slot=list-item-active-icon>"),aE=I("<span data-slot=list-item-divider>");function og(e,t){const r=e.querySelectorAll('[data-slot="list-item"][data-key]');for(const i of r)if(i.getAttribute("data-key")===t)return i}function lE(e){const t=yt();let r;const[i,n]=We({mouseActive:!1,scrollRef:void 0,internalFilter:""}),o=()=>i.scrollRef,s=A=>n("scrollRef",A),a=()=>i.internalFilter,l=A=>n("internalFilter",A),u=(A,j,P)=>{const B=A.getBoundingClientRect(),R=j.getBoundingClientRect(),V=R.top-B.top+A.scrollTop;V+R.height,A.scrollTop+A.clientHeight;const ee=V-A.clientHeight/2+R.height/2,oe=Math.max(0,A.scrollHeight-A.clientHeight);A.scrollTop=Math.max(0,Math.min(ee,oe))},{filter:d,grouped:f,flat:m,active:h,setActive:g,onKeyDown:y,onInput:b,refetch:v}=Ls(e),w=()=>e.current?e.key(e.current):void 0,x=()=>typeof e.search=="object"?e.search:{},_=()=>x().action,k=()=>e.add,C=()=>!!k(),O=A=>A.movementX!==0||A.movementY!==0,z=(A,j)=>{const P=d();if(l(A),b(A),e.onFilter?.(A),!!j?.ref){if(P===A){v();return}queueMicrotask(()=>v())}};ne(()=>{e.filter!==void 0&&e.filter!==a()&&(l(e.filter),b(e.filter))}),ne(qe(d,()=>{o()?.scrollTo(0,0)},{defer:!0})),ne(()=>{const A=o();if(!A)return;const j=w();j&&requestAnimationFrame(()=>{const P=og(A,j);P&&u(A,P)})}),ne(()=>{const A=m();if(i.mouseActive||A.length===0)return;const j=o();if(!j)return;if(h()===e.key(A[0])){j.scrollTo(0,0);return}const P=h();if(!P)return;const B=og(j,P);B&&u(j,B)}),ne(()=>{const A=m(),j=h(),P=A.find(B=>e.key(B)===j);e.onMove?.(P)});const K=(A,j)=>{e.onSelect?.(A,j)},J=A=>{if(n("mouseActive",!1),A.key==="Escape")return;const j=m(),P=j.find(R=>e.key(R)===h()),B=P?j.indexOf(P):-1;if(e.onKeyEvent?.(A,P),!A.defaultPrevented)if(A.key==="Enter"&&!A.isComposing)A.preventDefault(),P&&K(P,B);else if(e.search){if(A.ctrlKey&&!A.metaKey&&!A.altKey&&!A.shiftKey&&(A.key==="n"||A.key==="p")){y(A);return}(A.key==="ArrowDown"||A.key==="ArrowUp")&&y(A)}else y(A)};e.ref?.({onKeyDown:J,setScrollRef:s,setFilter:A=>z(A,{ref:!0})});const T=()=>{const A=k();return A?(()=>{var j=JO();return p(j,()=>A.render()),Ae(P=>Ct(j,{[A.class??""]:!!A.class},P)),j})():null};function M(A){const[j,P]=We({stuck:!1,header:void 0});return ne(()=>{const B=o(),R=j.header;if(!B||!R)return;const V=()=>{const Q=R.getBoundingClientRect(),ee=B.getBoundingClientRect();P("stuck",Q.top<=ee.top+1&&B.scrollTop>0)};ln(B,"scroll",V,{passive:!0}),V()}),(()=>{var B=QO();return ut(R=>P("header",R),B),p(B,()=>e.groupHeader?.(A.group)??A.group.category),Ae(()=>Ie(B,"data-stuck",j.stuck)),B})()}const U=()=>{if(f.loading)return e.loadingMessage??t.t("ui.list.loading");if(e.emptyMessage)return e.emptyMessage;const A=d();if(!A)return t.t("ui.list.empty");const j=t.t("ui.list.emptyWithFilter.suffix");return[(()=>{var P=rg();return p(P,()=>t.t("ui.list.emptyWithFilter.prefix")),P})(),(()=>{var P=eE(),B=P.firstChild,R=B.nextSibling;return R.nextSibling,p(P,A,R),P})(),c(F,{when:j,get children(){var P=rg();return p(P,j),P}})]};return(()=>{var A=nE(),j=A.firstChild;return p(A,c(F,{get when(){return!!e.search},get children(){var P=tE(),B=P.firstChild,R=B.firstChild;return B.$$pointerdown=V=>{const Q=V.currentTarget;if(!(Q instanceof HTMLElement))return;const ee=Q.querySelector("input, textarea");(ee instanceof HTMLInputElement||ee instanceof HTMLTextAreaElement?ee:r)?.focus(),V.stopPropagation()},p(R,c(F,{get when(){return!x().hideIcon},get children(){return c(bt,{name:"magnifying-glass"})}}),null),p(R,c(ah,{get autofocus(){return x().autofocus},variant:"ghost","data-slot":"list-search-input",type:"text",ref:V=>{r=V},get value(){return a()},onChange:V=>z(V),onKeyDown:J,get placeholder(){return x().placeholder},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off"}),null),p(B,c(F,{get when(){return a()},get children(){return c(Pt,{icon:"circle-x",variant:"ghost",onClick:()=>{l(""),queueMicrotask(()=>r?.focus())},get"aria-label"(){return t.t("ui.list.clearFilter")}})}}),null),p(P,_,null),Ae(V=>Ct(B,{[x().class??""]:!!x().class},V)),P}}),j),ut(s,j),p(j,c(F,{get when(){return m().length>0||C()},get fallback(){return(()=>{var P=rE(),B=P.firstChild;return p(B,U),P})()},get children(){return[c(rt,{get each(){return f.latest},children:(P,B)=>{const R=()=>B()===f.latest.length-1;return(()=>{var V=ig(),Q=V.firstChild;return p(V,c(F,{get when(){return P.category},get children(){return c(M,{group:P})}}),Q),p(Q,c(rt,{get each(){return P.items},children:(ee,oe)=>{const le=(()=>{var W=oE();return W.addEventListener("mouseleave",()=>{i.mouseActive&&g(null)}),W.$$mousemove=D=>{O(D)&&(n("mouseActive",!0),g(e.key(ee)))},W.$$keydown=J,W.$$click=()=>K(ee,oe()),p(W,()=>e.children(ee),null),p(W,c(F,{get when(){return e.key(ee)===w()},get children(){var D=iE();return p(D,c(bt,{name:"check-small"})),D}}),null),p(W,c(F,{get when(){return e.activeIcon},children:D=>(()=>{var te=sE();return p(te,c(bt,{get name(){return D()}})),te})()}),null),p(W,(()=>{var D=Te(()=>!!(e.divider&&(oe()!==P.items.length-1||C()&&R())));return()=>D()&&aE()})(),null),Ae(D=>{var te=e.key(ee),H=e.key(ee)===h(),Z=e.key(ee)===w();return te!==D.e&&Ie(W,"data-key",D.e=te),H!==D.t&&Ie(W,"data-active",D.t=H),Z!==D.a&&Ie(W,"data-selected",D.a=Z),D},{e:void 0,t:void 0,a:void 0}),W})();return e.itemWrapper?e.itemWrapper(ee,le):le}}),null),p(Q,c(F,{get when(){return Te(()=>!!C())()&&R()},get children(){return T()}}),null),V})()}}),c(F,{get when(){return Te(()=>f.latest.length===0)()&&C()},get children(){var P=ig(),B=P.firstChild;return p(B,T),P}})]}})),Ae(P=>Ct(A,{[e.class??""]:!!e.class},P)),A})()}Ot(["pointerdown","click","keydown","mousemove"]);var cE=I('<div class="flex flex-col gap-1 py-1"><div class=text-13-medium></div><div class="text-12-regular text-text-invert-base"></div><div class="text-12-regular text-text-invert-base">'),uE=I('<div class="text-12-regular text-text-invert-base">');const dE=e=>{const t=_t(),r=l=>{const u=`${l.id} ${l.name}`.toLowerCase();return/claude|anthropic/.test(u)?t.t("model.provider.anthropic"):/gpt|o[1-4]|codex|openai/.test(u)?t.t("model.provider.openai"):/grok|xai/.test(u)?t.t("model.provider.xai"):/llama|meta/.test(u)?t.t("model.provider.meta"):l.provider.name},i=l=>l==="text"?t.t("model.input.text"):l==="image"?t.t("model.input.image"):l==="audio"?t.t("model.input.audio"):l==="video"?t.t("model.input.video"):l==="pdf"?t.t("model.input.pdf"):l,n=()=>{const l=[];e.latest&&l.push(t.t("model.tag.latest")),e.free&&l.push(t.t("model.tag.free"));const u=l.length?` (${l.join(", ")})`:"";return`${r(e.model)} ${e.model.name}${u}`},o=()=>{if(e.model.capabilities){const d=e.model.capabilities.input,m=["text","image","audio","video","pdf"].filter(h=>d[h]).map(h=>i(h));return m.length?m.join(", "):void 0}const l=e.model.modalities?.input;if(!l)return;const u=l.map(d=>i(d));return u.length?u.join(", "):void 0},s=()=>e.model.capabilities?e.model.capabilities.reasoning?t.t("model.tooltip.reasoning.allowed"):t.t("model.tooltip.reasoning.none"):e.model.reasoning?t.t("model.tooltip.reasoning.allowed"):t.t("model.tooltip.reasoning.none"),a=()=>t.t("model.tooltip.context",{limit:e.model.limit.context.toLocaleString()});return(()=>{var l=cE(),u=l.firstChild,d=u.nextSibling,f=d.nextSibling;return p(u,n),p(l,c(F,{get when(){return o()},children:m=>(()=>{var h=uE();return p(h,()=>t.t("model.tooltip.allows",{inputs:m()})),h})()}),d),p(d,s),p(f,a),l})()};var fE=I('<div class="order-first flex justify-end px-1 pb-1">'),mE=I("<div>"),gE=I('<div class="w-full flex items-center gap-x-2 text-13-regular"><span class=truncate>');const s1=e=>{const t=e.model??ji().model,r=_t(),i=$(()=>t.list().filter(n=>t.visible({modelID:n.id,providerID:n.provider.id})).filter(n=>e.provider?n.provider.id===e.provider:!0));return(()=>{var n=mE();return p(n,c(lE,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get emptyMessage(){return r.t("dialog.model.empty")},key:o=>`${o.provider.id}:${o.id}`,items:i,get current(){return t.current()},sortBy:(o,s)=>o.name.localeCompare(s.name),itemWrapper:(o,s)=>c(Et,{class:"w-full",placement:"right-start",gutter:12,get value(){return c(dE,{model:o,get latest(){return o.latest}})},children:s}),onSelect:o=>{t.set(o?{modelID:o.id,providerID:o.provider.id}:void 0,{recent:!0}),e.onSelect()},children:o=>(()=>{var s=gE(),a=s.firstChild;return p(a,()=>o.name),p(s,c(F,{get when(){return o.latest},get children(){return c(YO,{get children(){return r.t("model.tag.latest")}})}}),null),s})()}),null),p(n,c(F,{get when(){return e.action},get children(){var o=fE();return p(o,()=>e.action),o}}),null),Ae(()=>Jt(n,`flex flex-col flex-1 min-h-0 ${e.class??""}`)),n})()};function a1(e){const[t,r]=We({open:!1,dismiss:null}),i=br(),n=_t(),o=a=>{r("dismiss",a),r("open",!1)},s=()=>{o("manage"),Bn(()=>import("./dialog-manage-models-DjTSA1_m.js").then(a=>a.d),__vite__mapDeps([0,1,2,3])).then(a=>{i.show(()=>c(a.DialogManageModels,{}))})};return c(fr,{get open(){return t.open},onOpenChange:a=>{a&&r("dismiss",null),r("open",a)},modal:!1,get placement(){return e.placement??"top-start"},get gutter(){return e.gutter??4},get children(){return[c(fr.Trigger,ie({get as(){return e.triggerAs??"div"}},()=>e.triggerProps,{get children(){return e.children}})),c(fr.Portal,{get children(){return c(fr.Content,{class:"w-72 h-80 flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md z-50 outline-none overflow-hidden",onEscapeKeyDown:a=>{o("escape"),a.preventDefault(),a.stopPropagation()},onPointerDownOutside:()=>o("outside"),onFocusOutside:()=>o("outside"),onCloseAutoFocus:a=>{const l=t.dismiss;l==="outside"&&a.preventDefault(),(l==="escape"||l==="select")&&(a.preventDefault(),e.onClose?.(l)),r("dismiss",null)},get children(){return[c(fr.Title,{class:"sr-only",get children(){return n.t("dialog.model.select.title")}}),c(s1,{get provider(){return e.provider},get model(){return e.model},onSelect:()=>o("select"),class:"p-1",get action(){return c(vt,{size:"small",onClick:s,get children(){return n.t("dialog.model.manage")}})}})]}})}})]}})}const hE=e=>{const t=br(),r=_t(),i=()=>{Bn(()=>import("./dialog-manage-models-DjTSA1_m.js").then(n=>n.d),__vite__mapDeps([0,1,2,3])).then(n=>{t.show(()=>c(n.DialogManageModels,{}))})};return c(dh,{get title(){return r.t("dialog.model.select.title")},get action(){return c(vt,{class:"h-7 -my-1 text-14-medium",tabIndex:-1,onClick:i,get children(){return r.t("dialog.model.manage")}})},get children(){return[c(s1,{get provider(){return e.provider},get model(){return e.model},onSelect:()=>t.close()}),c(vt,{variant:"ghost",class:"ml-3 mt-5 mb-6 text-text-base self-start",onClick:i,get children(){return r.t("dialog.model.manage")}})]}})},l1=Object.freeze(Object.defineProperty({__proto__:null,DialogSelectModel:hE,ModelSelectorPopover:a1},Symbol.toStringTag,{value:"Module"}));var pE=I("<div data-component=prompt-mode-control>"),sg=I("<span class=truncate>"),vE=I("<div data-component=prompt-model-control>"),bE=I('<div data-component=titlebar-prompt-controls class="flex min-w-0 items-center gap-1.5">'),yE=I('<div data-component=prompt-shell-status class="flex h-6 min-w-0 items-center gap-1.5 rounded-md bg-surface-base-hover px-2 text-12-medium text-text-strong"><span class=truncate>');const wE=e=>{const t=br(),r=_t(),i=ji(),n=$(()=>i.mode.list()),o=d=>r.t(`approval_mode.${d}`),s=()=>{Bn(()=>import("./dialog-manage-models-DjTSA1_m.js").then(d=>d.d),__vite__mapDeps([0,1,2,3])).then(d=>{t.show(()=>c(d.DialogManageModels,{}))})},a="min-w-0 max-w-[180px] justify-start rounded-md px-2.5 text-12-medium text-text-base gap-1.5",l="text-text-base",u={"max-width":"112px"};return(()=>{var d=bE();return p(d,c(F,{get when(){return e.inputMode!=="shell"},get fallback(){return c(Et,{placement:"bottom",gutter:4,get value(){return r.t("prompt.mode.shell.exit")},get children(){var f=yE(),m=f.firstChild;return p(f,c(bt,{name:"terminal",size:"small",class:"shrink-0"}),m),p(m,()=>r.t("prompt.mode.shell")),f}})},get children(){return[(()=>{var f=pE();return p(f,c(Et,{placement:"bottom",gutter:4,get value(){return r.t("command.mode.cycle")},get children(){return c(Zh,{size:"small",get options(){return n()},get current(){return i.mode.current()},label:o,onSelect:m=>{i.mode.set(m),e.onRestoreFocus()},class:l,valueClass:"truncate text-12-medium text-text-base",triggerStyle:u,triggerProps:{"data-action":"prompt-mode",class:"min-w-0 rounded-md"},variant:"ghost"})}})),f})(),(()=>{var f=vE();return p(f,c(F,{get when(){return i.model.list().length>0},get fallback(){return c(Et,{placement:"bottom",gutter:4,get value(){return r.t("dialog.model.manage")},get children(){return c(vt,{"data-action":"prompt-model",variant:"ghost",size:"small",class:a,onClick:s,get children(){return[(()=>{var m=sg();return p(m,()=>r.t("dialog.model.manage")),m})(),c(bt,{name:"plus-small",size:"small",class:"shrink-0"})]}})}})},get children(){return c(Et,{placement:"bottom",gutter:4,get value(){return r.t("command.model.choose")},get children(){return c(a1,{get model(){return i.model},triggerAs:vt,triggerProps:{variant:"ghost",size:"small",class:a,"data-action":"prompt-model"},placement:"bottom-start",gutter:6,get onClose(){return e.onRestoreFocus},get children(){return[(()=>{var m=sg();return p(m,()=>i.model.current()?.name??r.t("dialog.model.select.title")),m})(),c(bt,{name:"chevron-down",size:"small",class:"shrink-0"})]}})}})}})),f})()]}})),d})()},xE=8e3,_E=120;function $E(e){if(e.length>=xE)return!0;let t=0;for(const r of e)if(r===`
52
52
  `&&(t+=1,t>=_E))return!0;return!1}function SE(e){return e.includes("\r")?e.replace(/\r\n?/g,`
53
53
  `):e}function kE(e){return $E(e)||e.includes(`
54
54
  `)||e.includes("\r")?"manual":"native"}function CE(e){return{handlePaste:async r=>{const i=r.clipboardData;if(!i)return;if(Array.from(i.items).flatMap(u=>{if(u.kind!=="file")return[];const d=u.getAsFile();return d?[d]:[]}).length>0){r.preventDefault(),r.stopPropagation();return}const o=i.getData("text/plain")??"";if(!o)return;r.preventDefault(),r.stopPropagation();const s=SE(o),a=()=>e.addPart({type:"text",content:s,start:0,end:0})?!0:(e.focusEditor(),e.addPart({type:"text",content:s,start:0,end:0}));if(kE(s)==="manual"){a();return}typeof document.execCommand=="function"&&document.execCommand("insertText",!1,s)||a()}}}const c1=[{type:"text",content:"",start:0,end:0}],IE=100;function TE(e){return{...e}}function DE(e){return{...e}}function AE(e){if(!e||typeof e!="object")return;const t=e;if(t.type==="text")return TE(t);if(t.type==="agent")return DE(t);if(t.type==="file"){const r=String(t.content??(typeof t.path=="string"?`@${t.path}`:""));return{type:"text",content:r,start:Number(t.start??0),end:Number(t.end??r.length)}}}function PE(e,t,r,i=!1){const n=Math.max(0,Math.min(r,t.length)),o=n===0,s=n===t.length;return i?o||s:e==="up"?n===0&&t.length===0:n===t.length}function Js(e){const t=e.flatMap(r=>{const i=AE(r);return i?[i]:[]});return t.length>0?t:c1.map(r=>({...r}))}function OE(e){return{start:e.start,end:e.end,...e.side?{side:e.side}:{},...e.endSide?{endSide:e.endSide}:{}}}function Zd(e){return e.map(t=>({...t,selection:OE(t.selection)}))}function To(e){return Array.isArray(e)?{prompt:Js(e),comments:[]}:{prompt:Js(e.prompt),comments:Zd(e.comments)}}function dr(e){return e.reduce((t,r)=>t+("content"in r?r.content.length:0),0)}function EE(e,t,r=[],i=IE){const n=t.map(l=>"content"in l?l.content:"").join("").trim(),o=r.some(l=>!!l.comment.trim());if(!n&&!o)return e;const s={prompt:Js(t),comments:Zd(r)},a=e[0];return a&&zE(a,s)?e:[s,...e].slice(0,i)}function ME(e,t){return e.path===t.path&&e.comment===t.comment&&e.origin===t.origin&&e.preview===t.preview&&e.selection.start===t.selection.start&&e.selection.end===t.selection.end&&e.selection.side===t.selection.side&&e.selection.endSide===t.selection.endSide}function zE(e,t){const r=To(e),i=To(t);if(r.prompt.length!==i.prompt.length)return!1;for(let n=0;n<r.prompt.length;n++){const o=r.prompt[n],s=i.prompt[n];if(o.type!==s.type||o.type==="text"&&o.content!==(s.type==="text"?s.content:"")||o.type==="agent"&&o.name!==(s.type==="agent"?s.name:""))return!1}if(r.comments.length!==i.comments.length)return!1;for(let n=0;n<r.comments.length;n++){const o=r.comments[n],s=i.comments[n];if(!o||!s||!ME(o,s))return!1}return!0}function LE(e){if(e.direction==="up"){if(e.entries.length===0)return{handled:!1,historyIndex:e.historyIndex,savedPrompt:e.savedPrompt};if(e.historyIndex===-1){const t=To(e.entries[0]);return{handled:!0,historyIndex:0,savedPrompt:{prompt:Js(e.currentPrompt),comments:Zd(e.currentComments)},entry:t,cursor:"start"}}if(e.historyIndex<e.entries.length-1){const t=e.historyIndex+1,r=To(e.entries[t]);return{handled:!0,historyIndex:t,savedPrompt:e.savedPrompt,entry:r,cursor:"start"}}return{handled:!1,historyIndex:e.historyIndex,savedPrompt:e.savedPrompt}}if(e.historyIndex>0){const t=e.historyIndex-1,r=To(e.entries[t]);return{handled:!0,historyIndex:t,savedPrompt:e.savedPrompt,entry:r,cursor:"end"}}return e.historyIndex===0?e.savedPrompt?{handled:!0,historyIndex:-1,savedPrompt:null,entry:e.savedPrompt,cursor:"end"}:{handled:!0,historyIndex:-1,savedPrompt:null,entry:{prompt:c1,comments:[]},cursor:"end"}:{handled:!1,historyIndex:e.historyIndex,savedPrompt:e.savedPrompt}}function u1(e){return e.getElementById(So.leftControls)??void 0}function FE(e){if(e.desktopViewport)return u1(e.document)}function NE(e){const t=e.document.body??e.document.documentElement;if(!e.enabled)return e.onMount(void 0),()=>{};const r=()=>{const n=u1(e.document);return e.onMount(n),n};if(r()||typeof MutationObserver!="function"||!t)return()=>{};const i=new MutationObserver(()=>{r()&&i.disconnect()});return i.observe(t,{childList:!0,subtree:!0}),()=>i.disconnect()}var RE=I('<div class="absolute inset-x-0 -top-2 -translate-y-full origin-bottom-left max-h-80 min-h-10 overflow-auto no-scrollbar flex flex-col p-2 rounded-[12px] bg-surface-raised-stronger-non-alpha shadow-[var(--shadow-lg-border-base)]">'),ag=I('<div class="text-text-weak px-2 py-1">'),jE=I('<button class="w-full flex items-center gap-x-2 rounded-md px-2 py-0.5"><span class="text-14-regular text-text-strong whitespace-nowrap">@'),UE=I('<span class="text-14-regular text-text-weak truncate">'),KE=I('<span class="text-11-regular text-text-subtle px-1.5 py-0.5 bg-surface-base rounded shrink-0">'),VE=I('<button><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">/');const BE=e=>c(F,{get when(){return e.popover},get children(){var t=RE();return t.$$mousedown=r=>r.preventDefault(),ut(r=>{e.popover==="slash"&&e.setSlashPopoverRef(r)},t),p(t,c(Gt,{get children(){return[c(Xe,{get when(){return e.popover==="at"},get children(){return c(F,{get when(){return e.atFlat.length>0},get fallback(){return(()=>{var r=ag();return p(r,()=>e.t("prompt.popover.emptyResults")),r})()},get children(){return c(rt,{get each(){return e.atFlat.slice(0,10)},children:r=>{const i=e.atKey(r);return(()=>{var n=jE(),o=n.firstChild;return o.firstChild,n.addEventListener("mouseenter",()=>e.setAtActive(i)),n.$$click=()=>e.onAtSelect(r),p(n,c(bt,{name:"brain",size:"small",class:"text-icon-info-active shrink-0"}),o),p(o,()=>r.name,null),Ae(()=>n.classList.toggle("bg-surface-raised-base-hover",e.atActive===i)),n})()}})}})}}),c(Xe,{get when(){return e.popover==="slash"},get children(){return c(F,{get when(){return e.slashFlat.length>0},get fallback(){return(()=>{var r=ag();return p(r,()=>e.t("prompt.popover.emptyCommands")),r})()},get children(){return c(rt,{get each(){return e.slashFlat},children:r=>(()=>{var i=VE(),n=i.firstChild,o=n.firstChild;return o.firstChild,i.addEventListener("mouseenter",()=>e.setSlashActive(r.id)),i.$$click=()=>e.onSlashSelect(r),p(o,()=>r.trigger,null),p(n,c(F,{get when(){return r.description},get children(){var s=UE();return p(s,()=>r.description),s}}),null),p(i,c(F,{get when(){return Te(()=>r.type==="custom")()&&r.source!=="command"},get children(){var s=KE();return p(s,(()=>{var a=Te(()=>r.source==="skill");return()=>a()?e.t("prompt.slash.badge.skill"):Te(()=>r.source==="mcp")()?e.t("prompt.slash.badge.mcp"):e.t("prompt.slash.badge.custom")})()),s}}),null),Ae(s=>{var a=r.id,l={"w-full flex items-center justify-between gap-4 rounded-md px-2 py-1":!0,"bg-surface-raised-base-hover":e.slashActive===r.id};return a!==s.e&&Ie(i,"data-slash-id",s.e=a),s.t=Ct(i,l,s.t),s},{e:void 0,t:void 0}),i})()})}})}})]}})),t}});Ot(["mousedown","click"]);var ZE=I('<div class="flex flex-nowrap items-start gap-2 p-2 overflow-x-auto no-scrollbar">'),HE=I('<div><div class="flex items-center gap-1.5"><div class="flex items-center text-11-regular min-w-0 font-medium"><span class="text-text-strong whitespace-nowrap">'),qE=I('<span class="flex max-w-[300px]"><span class="text-text-invert-base truncate-start [unicode-bidi:plaintext] min-w-0"></span><span class=shrink-0>'),GE=I('<span class="text-text-weak whitespace-nowrap shrink-0">'),WE=I('<div class="text-12-regular text-text-strong ml-5 pr-1 truncate">');const XE=e=>c(F,{get when(){return e.items.length>0},get children(){var t=ZE();return p(t,c(rt,{get each(){return e.items},children:r=>{const i=Ri(r.path),n=Qt(r.path),o=Jx(r.path,14),s=e.active(r);return c(Et,{get value(){return(()=>{var a=qE(),l=a.firstChild,u=l.nextSibling;return p(l,i),p(u,n),a})()},placement:"top",openDelay:2e3,get children(){var a=HE(),l=a.firstChild,u=l.firstChild,d=u.firstChild;return a.$$click=()=>e.openComment(r),p(l,c(Sn,{get node(){return{path:r.path,type:"file"}},class:"shrink-0 size-3.5"}),u),p(d,o),p(u,c(F,{get when(){return r.selection},children:f=>(()=>{var m=GE();return p(m,(()=>{var h=Te(()=>f().startLine===f().endLine);return()=>h()?`:${f().startLine}`:`:${f().startLine}-${f().endLine}`})()),m})()}),null),p(l,c(Pt,{type:"button",icon:"close-small",variant:"ghost",class:"ml-auto size-3.5 text-text-weak hover:text-text-strong transition-all",onClick:f=>{f.stopPropagation(),e.remove(r)},get"aria-label"(){return e.t("prompt.context.removeFile")}}),null),p(a,c(F,{get when(){return r.comment},children:f=>(()=>{var m=WE();return p(m,f),m})()}),null),Ae(f=>Ct(a,{"group shrink-0 flex flex-col rounded-[6px] pl-2 pr-1 py-1 max-w-[200px] h-12 cursor-default transition-all transition-transform shadow-xs-border hover:shadow-xs-border-hover":!0,"hover:bg-surface-interactive-weak":!!r.commentID&&!s,"bg-surface-interactive-hover hover:bg-surface-interactive-hover shadow-xs-border-hover":s,"bg-background-stronger":!s},f)),a}})}})),t}});Ot(["click"]);function YE(e){return e.mode==="shell"?e.t("prompt.placeholder.shell"):e.commentCount>1?e.t("prompt.placeholder.summarizeComments"):e.commentCount===1?e.t("prompt.placeholder.summarizeComment"):e.t("prompt.placeholder.simple")}var JE=I('<div class="flex items-center gap-2"><span></span><span class="text-icon-base text-12-medium text-[10px]!">'),QE=I('<div class="flex items-center gap-2"><span>'),eM=I('<div class="absolute top-0 inset-x-0 pl-3 pr-12 pt-1.5 text-14-regular text-text-weak pointer-events-none whitespace-nowrap truncate"style=padding-bottom:12px>'),tM=I('<div class=relative><div class="relative max-h-[240px] overflow-y-auto no-scrollbar"style=scroll-padding-bottom:12px><div data-component=prompt-input role=textbox aria-multiline=true contenteditable=true inputmode=text autocomplete=off style=padding-bottom:12px></div></div><div aria-hidden=true class="pointer-events-none absolute inset-x-0 bottom-0"style="height:12px;background:linear-gradient(to top, var(--surface-raised-stronger-non-alpha), transparent)"></div><div class="pointer-events-none absolute inset-y-0 right-2 flex items-center gap-2"><div class="flex items-center gap-1 pointer-events-auto">'),nM=I('<div class="relative size-full _max-h-[320px] flex flex-col gap-0">');const rM=/[^\s\u200B]/,iM=e=>{const t=Rn(),r=sr(),i=ji(),n=jr(),o=Ui(),s=or(),a=_c(),l=br(),u=wc(),d=_t(),f=na(),{params:m,tabs:h,view:g}=_r(),y=()=>t.capabilities.shellMode!==!1;let b,v,w;const x={input:!1},_=12,k=()=>{const N=v,X=window.getSelection();if(!N||!X||X.rangeCount===0)return;const ge=X.getRangeAt(0);if(!b.contains(ge.startContainer))return;const He=Xr(b),at=dr(o.current());if(He>=at){N.scrollTop=N.scrollHeight;return}const $t=ge.getClientRects().item(0)??ge.getBoundingClientRect();if(!$t.height)return;const lt=N.getBoundingClientRect(),he=$t.top-lt.top+N.scrollTop,L=$t.bottom-lt.top+N.scrollTop,xe=12;if(he<N.scrollTop+xe){N.scrollTop=Math.max(0,he-xe);return}L>N.scrollTop+N.clientHeight-_&&(N.scrollTop=L-N.clientHeight+_)},C=(N=2)=>{requestAnimationFrame(()=>{k(),N>1&&C(N-1)})},O=N=>{const X=m.id;if(!X)return!1;const ge=r.data.session_diff[X];return ge?ge.some(He=>He.file===N):!1},z=N=>{if(!N.commentID)return;const X={file:N.path,id:N.commentID};a.setActive(X);const ge=($t=6)=>{const lt=he=>{requestAnimationFrame(()=>{a.setFocus({...X}),!(he<=0)&&requestAnimationFrame(()=>{const L=a.focus();L&&(L.file!==X.file||L.id!==X.id||lt(he-1))})})};lt($t)};if(N.commentOrigin==="review"||N.commentOrigin!=="file"&&O(N.path)){g().reviewPanel.opened()||g().reviewPanel.open(),s.fileTree.setTab("changes"),h().setActive("review"),ge();return}g().reviewPanel.opened()||g().reviewPanel.open(),s.fileTree.setTab("all");const at=n.tab(N.path);h().open(at),h().setActive(at),Promise.resolve(n.load(N.path)).finally(()=>ge())},K=$(()=>m.id?r.session.get(m.id):void 0),J=$(()=>r.data.session_status[m.id??""]??{type:"idle"}),T=$(()=>J()?.type!=="idle"),[M,U]=We({popover:null,historyIndex:-1,savedPrompt:null,mode:"normal",applyingHistory:!1}),A=Fa(()=>M.mode==="normal"?1:0,{visualDuration:.2,bounce:0}),j=N=>({opacity:N,transform:`scale(${.95+N*.05})`,filter:`blur(${(1-N)*2}px)`,"pointer-events":N>.5?"auto":"none"}),P=$(()=>j(A())),B=$(()=>M.mode==="shell"?0:o.context.items().filter(N=>!!N.comment?.trim()).length),R=$(()=>o.current().map(X=>"content"in X?X.content:"").join("").trim().length===0&&B()===0),V=$(()=>T()&&R()),Q=()=>V()?(()=>{var N=JE(),X=N.firstChild,ge=X.nextSibling;return p(X,()=>d.t("prompt.action.stop")),p(ge,()=>d.t("common.key.esc")),N})():(()=>{var N=QE(),X=N.firstChild;return p(X,()=>d.t("prompt.action.send")),p(N,c(bt,{name:"enter",size:"small",class:"text-icon-base"}),null),N})(),ee=$(()=>{const N=o.context.items();return M.mode!=="shell"?N:N.filter(X=>!X.comment?.trim())}),[oe,le]=Os(Es.global("prompt-history",["prompt-history.v1"]),We({entries:[]})),[W,D]=Os(Es.global("prompt-history-shell",["prompt-history-shell.v1"]),We({entries:[]})),te=$(()=>YE({mode:M.mode,commentCount:B(),t:(N,X)=>d.t(N,X)})),H=()=>{const N=new Map(a.all().map(X=>[`${X.file}
@@ -57,7 +57,7 @@ ${X.commentID}`)?.selection:void 0)??(X.selection?{start:X.selection.startLine,e
57
57
  ${X.commentID}`)?.time??Date.now():Date.now(),origin:X.commentOrigin,preview:X.preview}]:[]})},Z=N=>{a.replace(N.map(X=>({id:X.id,file:X.path,selection:{...X.selection},comment:X.comment,time:X.time}))),o.context.replaceComments(N.map(X=>({type:"file",path:X.path,selection:Ao(X.selection),comment:X.comment,commentID:X.id,commentOrigin:X.origin,preview:X.preview})))},se=(N,X)=>{const ge=N.prompt,He=X==="start"?0:dr(ge);U("applyingHistory",!0),Z(N.comments),o.set(ge,He),requestAnimationFrame(()=>{b.focus(),Yr(b,He),U("applyingHistory",!1),C()})},re=()=>{const N=window.getSelection(),X=dr(o.current());if(!N||N.rangeCount===0)return{collapsed:!1,cursorPosition:0,textLength:X};const ge=N.anchorNode;return!ge||!b.contains(ge)?{collapsed:!1,cursorPosition:0,textLength:X}:{collapsed:N.isCollapsed,cursorPosition:Xr(b),textLength:X}},fe=()=>f.platform==="desktop"&&f.os==="macos",Se=N=>{N==="shell"&&!y()||(U("mode",N),U("popover",null),requestAnimationFrame(()=>b?.focus()))};u.register("prompt-input",()=>y()?[{id:"prompt.mode.shell",title:d.t("command.prompt.mode.shell"),category:d.t("command.category.session"),disabled:M.mode==="shell",onSelect:()=>Se("shell")},{id:"prompt.mode.normal",title:d.t("command.prompt.mode.normal"),category:d.t("command.category.session"),disabled:M.mode==="normal",onSelect:()=>Se("normal")}]:[]);const Ne=()=>U("popover",null),ce=(N=!1)=>{!N&&(M.historyIndex<0||M.applyingHistory)||(U("historyIndex",-1),U("savedPrompt",null))},ye=()=>{b.innerHTML=""},G=N=>{ye(),b.textContent=N},we=()=>{requestAnimationFrame(()=>{b.focus();const N=document.createRange(),X=window.getSelection();N.selectNodeContents(b),N.collapse(!1),X?.removeAllRanges(),X?.addRange(N)})},ke=()=>{const N=window.getSelection();return!N||N.rangeCount===0||!b.contains(N.anchorNode)?null:Xr(b)},ue=()=>{requestAnimationFrame(()=>{const N=o.cursor()??dr(o.current());b.focus(),Yr(b,N),C()})},me=$c("(min-width: 1280px)"),[Ue,be]=ze();ne(()=>{if(typeof document!="object"){be(void 0);return}const N=FE({desktopViewport:me(),document});be(N);const X=NE({enabled:me(),document,onMount:be});je(X)});const Be=N=>{const X=ke();kn(N),X!==null&&Yr(b,X)},[E,ae]=ze(!1),de=N=>N.isComposing||E()||N.keyCode===229,Ee=()=>{Ne(),ae(!1)},Re=()=>{ae(!0)},ot=()=>{ae(!1),requestAnimationFrame(()=>{E()||Pn(o.current())})},Pe=$(()=>r.data.agent.filter(N=>!N.hidden&&N.mode!=="primary").map(N=>({type:"agent",name:N.name,display:N.name}))),Oe=N=>{N&&on({type:"agent",name:N.name,content:"@"+N.name})},pe=N=>N?`agent:${N.name}`:"",{flat:De,active:st,setActive:Je,onInput:Ve,onKeyDown:ht}=Ls({items:Pe,key:pe,filterKeys:["display"],groupBy:()=>"agent",onSelect:Oe}),Mt=$(()=>{const N=u.options.filter(ge=>!ge.disabled&&!ge.id.startsWith("suggested.")&&ge.slash).map(ge=>({id:ge.id,trigger:ge.slash,title:ge.title,description:ge.description,type:"builtin"}));return[...r.data.command.map(ge=>({id:`custom.${ge.name}`,trigger:ge.name,title:ge.name,description:ge.description,type:"custom",source:ge.source})),...N]}),Tt=N=>{if(N){if(ko.select(N.id),Ne(),N.type==="custom"){const X=`/${N.trigger} `;G(X),o.set([{type:"text",content:X,start:0,end:X.length}],X.length),we();return}ye(),o.set(ms,0),u.trigger(N.id,"slash")}},{flat:zt,active:rn,setActive:$r,onInput:Un,onKeyDown:Kn}=Ls({items:Mt,key:N=>N?.id,filterKeys:["trigger","title"],onSelect:Tt}),Br=N=>{const X=document.createElement("span");return X.textContent=N.content,X.setAttribute("data-type",N.type),X.setAttribute("data-name",N.name),X.setAttribute("contenteditable","false"),X.style.userSelect="text",X.style.cursor="default",X},At=()=>Array.from(b.childNodes).every(N=>{if(N.nodeType===Node.TEXT_NODE){const ge=N.textContent??"";if(!ge.includes("​"))return!0;if(ge!=="​")return!1;const He=N.previousSibling,at=N.nextSibling;return!!(He?.nodeType===Node.ELEMENT_NODE&&He.tagName==="BR")&&!at}if(N.nodeType!==Node.ELEMENT_NODE)return!1;const X=N;return X.dataset.type==="agent"?!0:X.tagName==="BR"}),kn=N=>{ye();for(const ge of N){if(ge.type==="text"){b.appendChild(Im(ge.content));continue}ge.type==="agent"&&b.appendChild(Br(ge))}const X=b.lastChild;X?.nodeType===Node.ELEMENT_NODE&&X.tagName==="BR"&&b.appendChild(document.createTextNode("​"))};ne(()=>{const N=rn();!N||!w||requestAnimationFrame(()=>{w.querySelector(`[data-slash-id="${N}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"})})}),iv()&&(ne(()=>{ko.set({popover:M.popover,slash:{active:rn()??null,ids:zt().map(N=>N.id)}})}),je(()=>ko.clear()));const Yi=()=>{if(M.popover==="at"){const N=De();if(N.length===0)return;const X=st(),ge=N.find(He=>pe(He)===X)??N[0];Oe(ge);return}if(M.popover==="slash"){const N=zt();if(N.length===0)return;const X=rn(),ge=N.find(He=>He.id===X)??N[0];Tt(ge)}},Pn=N=>{if(x.input){if(x.input=!1,At())return;Be(N);return}const X=lr();At()&&Qx(N,X)||Be(N)};ne(qe(()=>o.current(),N=>{E()||Pn(N)}));const lr=()=>{const N=[];let X=0,ge="";const He=()=>{let he=ge;he.includes("\r")&&(he=he.replace(/\r\n?/g,`
58
58
  `)),he.includes("​")&&(he=he.replace(/\u200B/g,"")),ge="",he&&(N.push({type:"text",content:he,start:X,end:X+he.length}),X+=he.length)},at=he=>{const L=he.textContent??"";N.push({type:"agent",name:he.dataset.name,content:L,start:X,end:X+L.length}),X+=L.length},$t=he=>{if(he.nodeType===Node.TEXT_NODE){ge+=he.textContent??"";return}if(he.nodeType!==Node.ELEMENT_NODE)return;const L=he;if(L.dataset.type==="agent"){He(),at(L);return}if(L.tagName==="BR"){ge+=`
59
59
  `;return}for(const xe of Array.from(L.childNodes))$t(xe)},lt=Array.from(b.childNodes);return lt.forEach((he,L)=>{const xe=he.nodeType===Node.ELEMENT_NODE&&["DIV","P"].includes(he.tagName);$t(he),xe&&L<lt.length-1&&(ge+=`
60
- `)}),He(),N.length===0&&N.push(...ms),N},cr=()=>{const N=lr(),X=Xr(b),ge=N.length===1&&N[0]?.type==="text"?N[0].content:N.map(lt=>"content"in lt?lt.content:"").join(""),He=N.some(lt=>lt.type!=="text");if(!rM.test(ge)&&!He){Ne(),ce(),o.dirty()&&(x.input=!0,o.set(ms,0)),C();return}if(y()&&M.mode==="normal"&&!He&&ge==="!"){ye(),Ne(),ce(),U("mode","shell"),x.input=!0,o.set(ms,0),C();return}if(M.mode==="shell")Ne();else{const lt=ge.substring(0,X).match(/@(\S*)$/),he=ge.match(/^\/(\S*)$/);lt?(Ve(lt[1]),U("popover","at")):he?(Un(he[1]),U("popover","slash")):Ne()}ce(),x.input=!0,o.set(N,X),C()},on=N=>{const X=window.getSelection();if(!X)return!1;if(X.rangeCount===0||!b.contains(X.anchorNode)){b.focus();const He=o.cursor()??dr(o.current());Yr(b,He)}if(X.rangeCount===0)return!1;const ge=X.getRangeAt(0);if(!b.contains(ge.startContainer))return!1;if(N.type==="agent"){const He=Xr(b),lt=o.current().map(xe=>"content"in xe?xe.content:"").join("").substring(0,He).match(/@(\S*)$/),he=Br(N),L=document.createTextNode(" ");if(lt){const xe=lt.index??He-lt[0].length;Tm(b,ge,"start",xe),Tm(b,ge,"end",He)}ge.deleteContents(),ge.insertNode(L),ge.insertNode(he),ge.setStartAfter(L),ge.collapse(!0),X.removeAllRanges(),X.addRange(ge)}if(N.type==="text"){const He=Im(N.content),at=He.lastChild;if(ge.deleteContents(),ge.insertNode(He),at){if(at.nodeType===Node.TEXT_NODE){const $t=at.textContent??"";$t==="​"&&ge.setStart(at,0),$t!=="​"&&ge.setStart(at,$t.length)}if(at.nodeType!==Node.TEXT_NODE){const $t=at.nodeType===Node.ELEMENT_NODE&&at.tagName==="BR",lt=at.nextSibling,he=lt?.nodeType===Node.TEXT_NODE&&(lt.textContent??"")==="";if($t&&(!lt||he)){const L=lt&&he?lt:document.createTextNode("​");lt||at.parentNode?.insertBefore(L,null),L.textContent="​",ge.setStart(L,0)}else ge.setStartAfter(at)}}ge.collapse(!0),X.removeAllRanges(),X.addRange(ge)}return cr(),Ne(),!0},pi=(N,X)=>{const ge=X==="shell"?W:oe,He=X==="shell"?D:le,at=EE(ge.entries,N,X==="shell"?[]:H());at!==ge.entries&&He("entries",at)};ne(qe(()=>e.edit?.id,N=>{const X=e.edit;if(!(!N||!X)){for(const ge of o.context.items())o.context.remove(ge.key);for(const ge of X.context)o.context.add({type:ge.type,path:ge.path,selection:ge.selection,comment:ge.comment,commentID:ge.commentID,commentOrigin:ge.commentOrigin,preview:ge.preview});U("mode","normal"),U("popover",null),U("historyIndex",-1),U("savedPrompt",null),o.set(X.prompt,dr(X.prompt)),requestAnimationFrame(()=>{b.focus(),Yr(b,dr(X.prompt)),C()}),e.onEditLoaded?.()}},{defer:!0}));const an=N=>{const X=LE({direction:N,entries:M.mode==="shell"?W.entries:oe.entries,historyIndex:M.historyIndex,currentPrompt:o.current(),currentComments:H(),savedPrompt:M.savedPrompt});return X.handled?(U("historyIndex",X.historyIndex),U("savedPrompt",X.savedPrompt),se(X.entry,X.cursor),!0):!1},{handlePaste:On}=CE({focusEditor:()=>{b.focus(),Yr(b,dr(o.current()))},addPart:on}),{abort:Zr,handleSubmit:Sr}=MA({info:K,commentCount:B,mode:()=>M.mode,working:T,editor:()=>b,queueScroll:C,promptLength:dr,addToHistory:pi,resetHistoryNavigation:()=>{ce(!0)},setMode:N=>U("mode",N),setPopover:N=>U("popover",N),shouldQueue:e.shouldQueue,onQueue:e.onQueue,onAbort:e.onAbort,onMissingModel:N=>{if(N==="manage-model-configs"){Bn(()=>import("./dialog-manage-models-DTTVfn7C.js").then(X=>X.d),__vite__mapDeps([0,1,2,3])).then(X=>{l.show(()=>c(X.DialogManageModels,{}))});return}Bn(()=>Promise.resolve().then(()=>l1),void 0).then(X=>{l.show(()=>c(X.DialogSelectModel,{get model(){return i.model}}))})},onSubmit:e.onSubmit}),Hr=N=>{if(N.key==="Backspace"){const ge=window.getSelection();if(ge&&ge.isCollapsed){const He=ge.anchorNode,at=ge.anchorOffset;if(He&&He.nodeType===Node.TEXT_NODE){const $t=He.textContent??"";if(/^\u200B+$/.test($t)&&at>0){const lt=document.createRange();lt.setStart(He,0),lt.collapse(!0),ge.removeAllRanges(),ge.addRange(lt)}}}}if(y()&&N.key==="!"&&M.mode==="normal"&&Xr(b)===0){U("mode","shell"),U("popover",null),N.preventDefault();return}if(N.key==="Escape"){if(M.popover){Ne(),N.preventDefault(),N.stopPropagation();return}if(M.mode==="shell"){U("mode","normal"),N.preventDefault(),N.stopPropagation();return}if(T()){Zr(),N.preventDefault(),N.stopPropagation();return}if(fe()){b.blur(),N.preventDefault(),N.stopPropagation();return}}if(M.mode==="shell"){const{collapsed:ge,cursorPosition:He,textLength:at}=re();if(N.key==="Backspace"&&ge&&He===0&&at===0){U("mode","normal"),N.preventDefault();return}}if(N.key==="Enter"&&N.shiftKey){on({type:"text",content:`
60
+ `)}),He(),N.length===0&&N.push(...ms),N},cr=()=>{const N=lr(),X=Xr(b),ge=N.length===1&&N[0]?.type==="text"?N[0].content:N.map(lt=>"content"in lt?lt.content:"").join(""),He=N.some(lt=>lt.type!=="text");if(!rM.test(ge)&&!He){Ne(),ce(),o.dirty()&&(x.input=!0,o.set(ms,0)),C();return}if(y()&&M.mode==="normal"&&!He&&ge==="!"){ye(),Ne(),ce(),U("mode","shell"),x.input=!0,o.set(ms,0),C();return}if(M.mode==="shell")Ne();else{const lt=ge.substring(0,X).match(/@(\S*)$/),he=ge.match(/^\/(\S*)$/);lt?(Ve(lt[1]),U("popover","at")):he?(Un(he[1]),U("popover","slash")):Ne()}ce(),x.input=!0,o.set(N,X),C()},on=N=>{const X=window.getSelection();if(!X)return!1;if(X.rangeCount===0||!b.contains(X.anchorNode)){b.focus();const He=o.cursor()??dr(o.current());Yr(b,He)}if(X.rangeCount===0)return!1;const ge=X.getRangeAt(0);if(!b.contains(ge.startContainer))return!1;if(N.type==="agent"){const He=Xr(b),lt=o.current().map(xe=>"content"in xe?xe.content:"").join("").substring(0,He).match(/@(\S*)$/),he=Br(N),L=document.createTextNode(" ");if(lt){const xe=lt.index??He-lt[0].length;Tm(b,ge,"start",xe),Tm(b,ge,"end",He)}ge.deleteContents(),ge.insertNode(L),ge.insertNode(he),ge.setStartAfter(L),ge.collapse(!0),X.removeAllRanges(),X.addRange(ge)}if(N.type==="text"){const He=Im(N.content),at=He.lastChild;if(ge.deleteContents(),ge.insertNode(He),at){if(at.nodeType===Node.TEXT_NODE){const $t=at.textContent??"";$t==="​"&&ge.setStart(at,0),$t!=="​"&&ge.setStart(at,$t.length)}if(at.nodeType!==Node.TEXT_NODE){const $t=at.nodeType===Node.ELEMENT_NODE&&at.tagName==="BR",lt=at.nextSibling,he=lt?.nodeType===Node.TEXT_NODE&&(lt.textContent??"")==="";if($t&&(!lt||he)){const L=lt&&he?lt:document.createTextNode("​");lt||at.parentNode?.insertBefore(L,null),L.textContent="​",ge.setStart(L,0)}else ge.setStartAfter(at)}}ge.collapse(!0),X.removeAllRanges(),X.addRange(ge)}return cr(),Ne(),!0},pi=(N,X)=>{const ge=X==="shell"?W:oe,He=X==="shell"?D:le,at=EE(ge.entries,N,X==="shell"?[]:H());at!==ge.entries&&He("entries",at)};ne(qe(()=>e.edit?.id,N=>{const X=e.edit;if(!(!N||!X)){for(const ge of o.context.items())o.context.remove(ge.key);for(const ge of X.context)o.context.add({type:ge.type,path:ge.path,selection:ge.selection,comment:ge.comment,commentID:ge.commentID,commentOrigin:ge.commentOrigin,preview:ge.preview});U("mode","normal"),U("popover",null),U("historyIndex",-1),U("savedPrompt",null),o.set(X.prompt,dr(X.prompt)),requestAnimationFrame(()=>{b.focus(),Yr(b,dr(X.prompt)),C()}),e.onEditLoaded?.()}},{defer:!0}));const an=N=>{const X=LE({direction:N,entries:M.mode==="shell"?W.entries:oe.entries,historyIndex:M.historyIndex,currentPrompt:o.current(),currentComments:H(),savedPrompt:M.savedPrompt});return X.handled?(U("historyIndex",X.historyIndex),U("savedPrompt",X.savedPrompt),se(X.entry,X.cursor),!0):!1},{handlePaste:On}=CE({focusEditor:()=>{b.focus(),Yr(b,dr(o.current()))},addPart:on}),{abort:Zr,handleSubmit:Sr}=MA({info:K,commentCount:B,mode:()=>M.mode,working:T,editor:()=>b,queueScroll:C,promptLength:dr,addToHistory:pi,resetHistoryNavigation:()=>{ce(!0)},setMode:N=>U("mode",N),setPopover:N=>U("popover",N),shouldQueue:e.shouldQueue,onQueue:e.onQueue,onAbort:e.onAbort,onMissingModel:N=>{if(N==="manage-model-configs"){Bn(()=>import("./dialog-manage-models-DjTSA1_m.js").then(X=>X.d),__vite__mapDeps([0,1,2,3])).then(X=>{l.show(()=>c(X.DialogManageModels,{}))});return}Bn(()=>Promise.resolve().then(()=>l1),void 0).then(X=>{l.show(()=>c(X.DialogSelectModel,{get model(){return i.model}}))})},onSubmit:e.onSubmit}),Hr=N=>{if(N.key==="Backspace"){const ge=window.getSelection();if(ge&&ge.isCollapsed){const He=ge.anchorNode,at=ge.anchorOffset;if(He&&He.nodeType===Node.TEXT_NODE){const $t=He.textContent??"";if(/^\u200B+$/.test($t)&&at>0){const lt=document.createRange();lt.setStart(He,0),lt.collapse(!0),ge.removeAllRanges(),ge.addRange(lt)}}}}if(y()&&N.key==="!"&&M.mode==="normal"&&Xr(b)===0){U("mode","shell"),U("popover",null),N.preventDefault();return}if(N.key==="Escape"){if(M.popover){Ne(),N.preventDefault(),N.stopPropagation();return}if(M.mode==="shell"){U("mode","normal"),N.preventDefault(),N.stopPropagation();return}if(T()){Zr(),N.preventDefault(),N.stopPropagation();return}if(fe()){b.blur(),N.preventDefault(),N.stopPropagation();return}}if(M.mode==="shell"){const{collapsed:ge,cursorPosition:He,textLength:at}=re();if(N.key==="Backspace"&&ge&&He===0&&at===0){U("mode","normal"),N.preventDefault();return}}if(N.key==="Enter"&&N.shiftKey){on({type:"text",content:`
61
61
  `}),N.preventDefault();return}if(N.key==="Enter"&&de(N))return;const X=N.ctrlKey&&!N.metaKey&&!N.altKey&&!N.shiftKey;if(M.popover){if(N.key==="Tab"){Yi(),N.preventDefault();return}const ge=N.key==="ArrowUp"||N.key==="ArrowDown"||N.key==="Enter",He=X&&(N.key==="n"||N.key==="p");if(ge||He){if(M.popover==="at"){ht(N),N.preventDefault();return}M.popover==="slash"&&Kn(N),N.preventDefault();return}}if(X&&N.code==="KeyG"){if(M.popover){Ne(),N.preventDefault();return}T()&&(Zr(),N.preventDefault());return}if(N.key==="ArrowUp"||N.key==="ArrowDown"){if(N.altKey||N.ctrlKey||N.metaKey)return;const{collapsed:ge}=re();if(!ge)return;const He=Xr(b),at=o.current().map(lt=>"content"in lt?lt.content:"").join(""),$t=N.key==="ArrowUp"?"up":"down";if(!PE($t,at,He,M.historyIndex>=0))return;an($t)&&N.preventDefault();return}if(N.key==="Enter"&&!N.shiftKey){if(N.preventDefault(),N.repeat||T()&&o.current().map(ge=>"content"in ge?ge.content:"").join("").trim().length===0&&B()===0)return;Sr(N)}};return(()=>{var N=nM();return p(N,c(BE,{get popover(){return M.popover},setSlashPopoverRef:X=>w=X,get atFlat(){return De()},get atActive(){return st()??void 0},atKey:pe,setAtActive:Je,onAtSelect:Oe,get slashFlat(){return zt()},get slashActive(){return rn()??void 0},setSlashActive:$r,onSlashSelect:Tt,t:X=>d.t(X)}),null),p(N,c(F,{get when(){return Ue()},children:X=>c(hr,{get mount(){return X()},get children(){return c(wE,{get inputMode(){return M.mode},onRestoreFocus:ue})}})}),null),p(N,c(GO,{onSubmit:Sr,get classList(){return{"group/prompt-input":!0,"rounded-xl!":!0,"focus-within:shadow-xs-border":!0,[e.class??""]:!!e.class}},get children(){return[c(XE,{get items(){return ee()},active:X=>{const ge=a.active();return!!X.commentID&&X.commentID===ge?.id&&X.path===ge?.file},openComment:z,remove:X=>{X.commentID&&a.remove(X.path,X.commentID),o.context.remove(X.key)},t:X=>d.t(X)}),(()=>{var X=tM(),ge=X.firstChild,He=ge.firstChild,at=ge.nextSibling,$t=at.nextSibling,lt=$t.firstChild;return X.$$mousedown=he=>{const L=he.target;L instanceof HTMLElement&&(L.closest('[data-action="prompt-submit"]')||b?.focus())},ut(he=>v=he,ge),He.$$keydown=Hr,He.addEventListener("blur",Ee),He.addEventListener("compositionend",ot),He.addEventListener("compositionstart",Re),pt(He,"paste",On),He.$$input=cr,ut(he=>{b=he,e.ref?.(he)},He),p(ge,c(F,{get when(){return!o.dirty()},get children(){var he=eM();return p(he,te),Ae(()=>he.classList.toggle("font-mono!",M.mode==="shell")),he}}),null),p(lt,c(Et,{placement:"top",get inactive(){return Te(()=>!T())()&&R()},get value(){return Q()},get children(){return c(Pt,{"data-action":"prompt-submit",type:"submit",get disabled(){return M.mode!=="normal"||!T()&&R()},get tabIndex(){return M.mode==="normal"?void 0:-1},get icon(){return V()?"stop":"arrow-up"},variant:"primary",class:"size-8 rounded-full!",get classList(){return{"prompt-stop-button":V()}},get style(){return P()},get"aria-label"(){return Te(()=>!!V())()?d.t("prompt.action.stop"):d.t("prompt.action.send")}})}})),Ae(he=>{var L=te(),xe=M.mode==="normal"?"sentences":"off",Ke=M.mode==="normal"?"on":"off",wt=M.mode==="normal",Bt={"select-text":!0,"w-full pl-3 pr-12 pt-1.5 text-14-regular text-text-strong focus:outline-none whitespace-pre-wrap":!0,"[&_[data-type=agent]]:text-syntax-type":!0,"font-mono!":M.mode==="shell"};return L!==he.e&&Ie(He,"aria-label",he.e=L),xe!==he.t&&Ie(He,"autocapitalize",he.t=xe),Ke!==he.a&&Ie(He,"autocorrect",he.a=Ke),wt!==he.o&&Ie(He,"spellcheck",he.o=wt),he.i=Ct(He,Bt,he.i),he},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),X})()]}}),null),N})()};Ot(["mousedown","input","keydown"]);var lg=I("<div>"),oM=I("<div data-component=dock-prompt>");function d1(e){const t=r=>`${e.kind}-${r}`;return(()=>{var r=oM();pt(r,"keydown",e.onKeyDown,!0);var i=e.ref;return typeof i=="function"?ut(i,r):e.ref=r,p(r,c(qO,{get"data-slot"(){return t("body")},get children(){return[(()=>{var n=lg();return p(n,()=>e.header),Ae(()=>Ie(n,"data-slot",t("header"))),n})(),(()=>{var n=lg();return p(n,()=>e.children),Ae(()=>Ie(n,"data-slot",t("content"))),n})()]}}),null),p(r,c(Na,{get"data-slot"(){return t("footer")},get children(){return e.footer}}),null),Ae(n=>{var o=e.kind,s=e.placement??"dock";return o!==n.e&&Ie(r,"data-kind",n.e=o),s!==n.t&&Ie(r,"data-placement",n.t=s),n},{e:void 0,t:void 0}),r})()}Ot(["keydown"]);var cg=I("<div data-slot=permission-row><span data-slot=permission-spacer aria-hidden=true></span><div data-slot=permission-hint>"),gl=I("<div data-slot=permission-row><span data-slot=permission-spacer aria-hidden=true></span><div data-slot=permission-detail><div data-slot=permission-detail-label></div><code data-slot=permission-detail-value>"),sM=I('<div data-slot=permission-row><span data-slot=permission-spacer aria-hidden=true></span><div data-slot=permission-patterns class="whitespace-pre-wrap break-words">'),aM=I("<div data-slot=permission-row><span data-slot=permission-spacer aria-hidden=true></span><div data-slot=permission-detail><div data-slot=permission-detail-label></div><div data-slot=permission-arguments>"),lM=I("<div data-slot=permission-row><span data-slot=permission-spacer aria-hidden=true></span><div data-slot=permission-patterns>"),cM=I("<div data-slot=permission-stack>"),uM=I("<div data-slot=permission-row data-variant=header><span data-slot=permission-icon></span><div data-slot=permission-header-title>"),ug=I("<div>"),dg=I("<div data-slot=permission-footer-actions>"),dM=I("<div data-slot=permission-argument><span data-slot=permission-argument-key></span><code data-slot=permission-argument-value>"),fM=I('<code class="text-12-regular text-text-base break-all">');function Ql(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function mM(e){const t=e?.confirmation;if(!(!Ql(t)||typeof t.type!="string")){if(t.type==="plan")return{type:"plan",title:typeof t.title=="string"?t.title:void 0,plan:typeof t.plan=="string"?t.plan:void 0};if(t.type==="mode_switch")return{type:"mode_switch",title:typeof t.title=="string"?t.title:void 0,currentMode:typeof t.currentMode=="string"?t.currentMode:void 0,targetMode:typeof t.targetMode=="string"?t.targetMode:void 0,message:typeof t.message=="string"?t.message:void 0}}}function gM(e){const t=e?.toolPreview;if(!Ql(t)||typeof t.toolName!="string")return;const r=Array.isArray(t.args)?t.args.map(i=>{if(Ql(i)&&!(typeof i.key!="string"||typeof i.value!="string"))return{key:i.key,value:i.value,truncated:i.truncated===!0}}).filter(i=>i!==void 0):[];return{toolName:t.toolName,args:r}}function hM(e){const t=_t(),r=()=>mM(e.request.metadata),i=()=>{const u=r();return u?.type==="plan"?u:void 0},n=()=>{const u=r();return u?.type==="mode_switch"?u:void 0},o=()=>gM(e.request.metadata),s=()=>o()?.toolName||e.request.permission,a=u=>{if(!u)return"";const d=`approval_mode.${u}`,f=t.t(d);return f===d?u:f},l=()=>{const u=`settings.permissions.tool.${e.request.permission}.description`,d=t.t(u);return d===u?"":d};return c(d1,{kind:"permission",get header(){return(()=>{var u=uM(),d=u.firstChild,f=d.nextSibling;return p(d,c(bt,{name:"warning",size:"normal"})),p(f,()=>n()?.title||i()?.title||t.t(n()?"notification.modeSwitch.title":i()?"notification.plan.title":"notification.permission.title")),u})()},get footer(){return c(F,{get when(){return n()},get fallback(){return[ug(),(()=>{var u=dg();return p(u,c(vt,{variant:"ghost",size:"normal",onClick:()=>e.onDecide("reject"),get disabled(){return e.responding},get children(){return t.t(i()?"ui.plan.reject":"ui.permission.deny")}}),null),p(u,c(vt,{variant:"secondary",size:"normal",onClick:()=>e.onDecide("always"),get disabled(){return e.responding},get children(){return t.t(i()?"ui.plan.always":"ui.permission.allowAlways")}}),null),p(u,c(vt,{variant:"primary",size:"normal",onClick:()=>e.onDecide("once"),get disabled(){return e.responding},get children(){return t.t(i()?"ui.plan.once":"ui.permission.allowOnce")}}),null),u})()]},get children(){return[ug(),(()=>{var u=dg();return p(u,c(vt,{variant:"ghost",size:"normal",onClick:()=>e.onDecide("reject"),get disabled(){return e.responding},get children(){return t.t("ui.modeSwitch.reject")}}),null),p(u,c(vt,{variant:"primary",size:"normal",onClick:()=>e.onDecide("once"),get disabled(){return e.responding},get children(){return t.t("ui.modeSwitch.confirm")}}),null),u})()]}})},get children(){var u=cM();return p(u,c(F,{get when(){return n()?.message},get children(){var d=cg(),f=d.firstChild,m=f.nextSibling;return p(m,()=>n()?.message),d}}),null),p(u,c(F,{get when(){return n()?.currentMode},get children(){var d=gl(),f=d.firstChild,m=f.nextSibling,h=m.firstChild,g=h.nextSibling;return p(h,()=>t.t("ui.modeSwitch.current")),p(g,()=>a(n()?.currentMode)),d}}),null),p(u,c(F,{get when(){return n()?.targetMode},get children(){var d=gl(),f=d.firstChild,m=f.nextSibling,h=m.firstChild,g=h.nextSibling;return p(h,()=>t.t("ui.modeSwitch.target")),p(g,()=>a(n()?.targetMode)),d}}),null),p(u,c(F,{get when(){return i()?.plan},get children(){var d=sM(),f=d.firstChild,m=f.nextSibling;return p(m,()=>i()?.plan),d}}),null),p(u,c(F,{get when(){return s()},get children(){var d=gl(),f=d.firstChild,m=f.nextSibling,h=m.firstChild,g=h.nextSibling;return p(h,()=>t.t("ui.permission.tool")),p(g,s),d}}),null),p(u,c(F,{get when(){return o()?.args.length},get children(){var d=aM(),f=d.firstChild,m=f.nextSibling,h=m.firstChild,g=h.nextSibling;return p(h,()=>t.t("ui.permission.arguments")),p(g,c(rt,{get each(){return o()?.args??[]},children:y=>(()=>{var b=dM(),v=b.firstChild,w=v.nextSibling;return p(v,()=>y.key),p(w,()=>y.value),b})()})),d}}),null),p(u,c(F,{get when(){return l()},get children(){var d=cg(),f=d.firstChild,m=f.nextSibling;return p(m,l),d}}),null),p(u,c(F,{get when(){return e.request.patterns.length>0},get children(){var d=lM(),f=d.firstChild,m=f.nextSibling;return p(m,c(rt,{get each(){return e.request.patterns},children:h=>(()=>{var g=fM();return p(g,h),g})()})),d}}),null),u}})}var pM=I("<span data-slot=question-option-check aria-hidden=true><span data-slot=question-option-box>"),vM=I("<span data-slot=question-option-radio-dot>"),bM=I("<span data-slot=option-description>"),yM=I("<button type=button data-slot=question-option><span data-slot=question-option-main><span data-slot=option-label>"),wM=I("<div data-slot=question-review-item-header><div data-slot=question-review-item-title></div><div data-slot=question-review-item-status>"),xM=I("<form data-slot=question-option data-custom=true><span data-slot=question-option-main><span data-slot=option-label></span><textarea data-slot=question-custom-input rows=1>"),_M=I("<div><div data-slot=question-text></div><div data-slot=question-hint></div><div data-slot=question-options>"),$M=I("<button type=button data-slot=question-option data-custom=true><span data-slot=question-option-main><span data-slot=option-label></span><span data-slot=option-description>"),SM=I("<div data-slot=question-review>"),kM=I("<div data-slot=question-header-title>"),CM=I("<div data-slot=question-footer-progress>"),IM=I("<div data-slot=question-footer-actions>");const hl=new Map;function ec(e){return(()=>{var t=pM(),r=t.firstChild;return pt(t,"click",e.onClick,!0),p(r,c(F,{get when(){return e.multi},get fallback(){return vM()},get children(){return c(bt,{name:"check-small",size:"small"})}})),Ae(i=>{var n=e.multi?"checkbox":"radio",o=e.picked;return n!==i.e&&Ie(r,"data-type",i.e=n),o!==i.t&&Ie(r,"data-picked",i.t=o),i},{e:void 0,t:void 0}),t})()}function TM(e){return(()=>{var t=yM(),r=t.firstChild,i=r.firstChild;pt(t,"click",e.onClick,!0),pt(t,"focus",e.onFocus);var n=e.ref;return typeof n=="function"?ut(n,t):e.ref=t,p(t,c(ec,{get multi(){return e.multi},get picked(){return e.picked}}),r),p(i,()=>e.label),p(r,c(F,{get when(){return e.description},get children(){var o=bM();return p(o,()=>e.description),o}}),null),Ae(o=>{var s=e.picked,a=e.multi?"checkbox":"radio",l=e.picked,u=e.disabled;return s!==o.e&&Ie(t,"data-picked",o.e=s),a!==o.t&&Ie(t,"role",o.t=a),l!==o.a&&Ie(t,"aria-checked",o.a=l),u!==o.o&&(t.disabled=o.o=u),o},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}const tc=e=>{const t=Rn(),r=_t(),i=$(()=>e.request.questions),n=$(()=>i().length),o=hl.get(e.request.id),[s,a]=We({mode:o?.mode??"step",tab:o?.tab??0,answers:o?.answers??[],custom:o?.custom??[],customOn:o?.customOn??[],editing:void 0,focus:0});let l,u,d=[],f=!1,m;const h=()=>r.t("ui.messagePart.option.typeOwnAnswer"),g=()=>r.t("ui.question.custom.placeholder"),y=E=>i()[E],b=E=>y(E)?.options??[],v=E=>y(E)?.custom!==!1,w=E=>y(E)?.multiple===!0,x=E=>s.custom[E]??"",_=E=>s.customOn[E]===!0,k=E=>s.editing===E,C=E=>(s.answers[E]?.length??0)>0,O=E=>(s.answers[E]??[]).join(", ")||r.t("ui.question.review.notAnswered"),z=(E,ae)=>s.answers[E]?.includes(ae)??!1,K=$(()=>s.mode==="review"),J=$(()=>i()[s.tab]),T=$(()=>J()?.options??[]),M=$(()=>J()?.custom!==!1),U=$(()=>T().length+(M()?1:0)),A=$(()=>s.tab>=n()-1),j=$(()=>i().reduce((E,ae,de)=>E+(C(de)?1:0),0)),P=$(()=>{if(K())return r.t("session.question.progress",{current:j(),total:n()});const E=Math.min(s.tab+1,n());return r.t("session.question.progress",{current:E,total:n()})}),B=$(()=>i().every((E,ae)=>C(ae))),R=$(()=>K()?r.t("ui.messagePart.review.title"):J()?.header??""),V=()=>{if(e.placement==="inline"){l?.style.removeProperty("--question-prompt-max-height");return}if(!l)return;const E=document.querySelector(".scroll-view__viewport"),ae=E instanceof HTMLElement?E.firstElementChild:void 0,de=ae instanceof HTMLElement&&ae.classList.contains("sticky")?ae.getBoundingClientRect().bottom:0;if(!de){l.style.removeProperty("--question-prompt-max-height");return}const Ee=l.closest('[data-component="session-prompt-dock"]');if(!(Ee instanceof HTMLElement))return;const Re=Ee.getBoundingClientRect().bottom,ot=Math.max(0,Re-l.getBoundingClientRect().bottom),Oe=Math.max(240,Math.floor(Re-de-8-ot));l.style.setProperty("--question-prompt-max-height",`${Oe}px`)},Q=(E,ae=s.tab)=>Math.max(0,Math.min(b(ae).length+(v(ae)?1:0)-1,E)),ee=(E=s.tab)=>{const ae=b(E);return v(E)&&_(E)?ae.length:Math.max(0,ae.findIndex(de=>s.answers[E]?.includes(de.label)??!1))},oe=(E,ae=s.tab)=>{const de=Q(E,ae);a("focus",de),s.editing===void 0&&(m!==void 0&&cancelAnimationFrame(m),m=requestAnimationFrame(()=>{m=void 0,(v(ae)&&de===b(ae).length?u:d[de])?.focus()}))};Vt(()=>{let E;const ae=()=>{E!==void 0&&cancelAnimationFrame(E),E=requestAnimationFrame(()=>{E=void 0,V()})};ae(),ln(window,"resize",ae);const de=l?.closest('[data-component="session-prompt-dock"]'),Ee=document.querySelector(".scroll-view__viewport");Ti([de,Ee],ae),je(()=>{E!==void 0&&cancelAnimationFrame(E)}),K()||oe(ee(),s.tab)}),je(()=>{m!==void 0&&cancelAnimationFrame(m),!f&&hl.set(e.request.id,{mode:s.mode,tab:s.tab,answers:s.answers.map(E=>E?[...E]:[]),custom:s.custom.map(E=>E??""),customOn:s.customOn.map(E=>E??!1)})});const le=E=>{const ae=E instanceof Error?E.message:String(E);Nt({title:r.t("common.requestFailed"),description:ae})},W=Dr(()=>({mutationFn:E=>t.client.question.reply({requestID:e.request.id,answers:E}),onMutate:()=>{e.onSubmit()},onSuccess:()=>{f=!0,hl.delete(e.request.id)},onError:le})),D=$(()=>W.isPending),te=async E=>{D()||await W.mutateAsync(E)},H=()=>void te(i().map((E,ae)=>s.answers[ae]??[])),Z=(E,ae,de=_(E))=>{const Ee=x(E).trim(),Re=ae.trim();if(a("custom",E,ae),!!de){if(w(E)){a("answers",E,(ot=[])=>{const Pe=Ee?ot.filter(Oe=>Oe.trim()!==Ee):ot;return!Re||Pe.some(Oe=>Oe.trim()===Re)?Pe:[...Pe,Re]});return}a("answers",E,Re?[Re]:[])}},se=(E,ae,de=!1)=>{a("answers",E,[ae]),de&&a("custom",E,ae),de||a("customOn",E,!1),s.editing===E&&a("editing",void 0)},re=(E,ae)=>{a("answers",E,(de=[])=>de.includes(ae)?de.filter(Ee=>Ee!==ae):[...de,ae])},fe=E=>{if(!v(E)||D())return;if(s.mode==="step"&&E===s.tab&&a("focus",b(E).length),!w(E)){a("customOn",E,!0),a("editing",E),Z(E,x(E),!0);return}const ae=!_(E);if(a("customOn",E,ae),ae){a("editing",E),Z(E,x(E),!0);return}const de=x(E).trim();de&&a("answers",E,(Ee=[])=>Ee.filter(Re=>Re.trim()!==de)),s.editing===E&&a("editing",void 0),s.mode==="step"&&E===s.tab&&oe(b(E).length,E)},Se=E=>{!v(E)||D()||(s.mode==="step"&&E===s.tab&&a("focus",b(E).length),_(E)||a("customOn",E,!0),a("editing",E),Z(E,x(E),!0))},Ne=E=>{s.mode!=="step"||s.editing!==void 0||D()||oe(s.focus+E,s.tab)},ce=(E,ae=!0)=>{a("editing",de=>de===E?void 0:de),Z(E,x(E)),ae&&s.mode==="step"&&E===s.tab&&oe(b(E).length,E)},ye=()=>{D()||(s.editing!==void 0&&ce(s.editing,!1),B()&&H())},G=E=>{if(E.defaultPrevented)return;if((E.metaKey||E.ctrlKey)&&!E.altKey&&E.key==="Enter"){if(E.repeat)return;if(E.preventDefault(),K()){ye();return}Ue();return}if(K())return;const de=E.target instanceof HTMLElement?E.target.closest('[data-slot="question-options"]'):void 0;if(s.editing===void 0&&de instanceof HTMLElement&&!(E.altKey||E.ctrlKey||E.metaKey)){if(E.key==="ArrowDown"||E.key==="ArrowRight"){E.preventDefault(),Ne(1);return}if(E.key==="ArrowUp"||E.key==="ArrowLeft"){E.preventDefault(),Ne(-1);return}if(E.key==="Home"){E.preventDefault(),oe(0,s.tab);return}E.key==="End"&&(E.preventDefault(),oe(U()-1,s.tab))}},we=(E,ae)=>{if(D())return;if(v(E)&&ae===b(E).length){Se(E);return}const de=b(E)[ae];if(de){if(w(E)){s.editing===E&&a("editing",void 0),re(E,de.label);return}se(E,de.label)}},ke=E=>{E.style.height="0px",E.style.height=`${E.scrollHeight}px`},ue=E=>ae=>{ke(ae),k(E)&&setTimeout(()=>{s.editing===E&&(ae.focus(),ke(ae))},0)},me=(E,ae)=>{v(ae)&&(E.preventDefault(),E.stopPropagation(),fe(ae))},Ue=()=>{if(D())return;if(s.editing===s.tab&&ce(s.tab),s.tab>=n()-1){a("mode","review"),a("editing",void 0);return}const E=s.tab+1;d=[],u=void 0,a("tab",E),a("editing",void 0),oe(ee(E),E)},be=()=>{if(D())return;if(K()){a("mode","step"),a("editing",void 0),oe(ee(s.tab),s.tab);return}if(s.tab<=0)return;const E=s.tab-1;d=[],u=void 0,a("tab",E),a("editing",void 0),oe(ee(E),E)},Be=E=>{const ae=()=>E.index,de=()=>E.review===!0;return(()=>{var Ee=_M(),Re=Ee.firstChild,ot=Re.nextSibling,Pe=ot.nextSibling;return p(Ee,c(F,{get when(){return de()},get children(){var Oe=wM(),pe=Oe.firstChild,De=pe.nextSibling;return p(pe,()=>y(ae())?.header),p(De,()=>O(ae())),Ae(()=>Ie(De,"data-complete",C(ae()))),Oe}}),Re),p(Re,()=>y(ae())?.question),p(ot,(()=>{var Oe=Te(()=>!!w(ae()));return()=>Oe()?r.t("ui.question.multiHint"):r.t("ui.question.singleHint")})()),p(Pe,c(rt,{get each(){return b(ae())},children:(Oe,pe)=>c(TM,{get multi(){return w(ae())},get picked(){return z(ae(),Oe.label)},get label(){return Oe.label},get description(){return Oe.description},get disabled(){return D()},get onFocus(){return de()?void 0:()=>a("focus",pe())},onClick:()=>we(ae(),pe())})}),null),p(Pe,c(F,{get when(){return v(ae())},get children(){return c(F,{get when(){return k(ae())},get fallback(){return(()=>{var Oe=$M(),pe=Oe.firstChild,De=pe.firstChild,st=De.nextSibling;Oe.$$click=()=>Se(ae()),pt(Oe,"focus",de()?void 0:()=>a("focus",b(ae()).length));var Je=de()?void 0:Ve=>{u=Ve};return typeof Je=="function"&&ut(Je,Oe),p(Oe,c(ec,{get multi(){return w(ae())},get picked(){return _(ae())},onClick:Ve=>me(Ve,ae())}),pe),p(De,h),p(st,()=>x(ae())||g()),Ae(Ve=>{var ht=_(ae()),Mt=w(ae())?"checkbox":"radio",Tt=_(ae()),zt=D();return ht!==Ve.e&&Ie(Oe,"data-picked",Ve.e=ht),Mt!==Ve.t&&Ie(Oe,"role",Ve.t=Mt),Tt!==Ve.a&&Ie(Oe,"aria-checked",Ve.a=Tt),zt!==Ve.o&&(Oe.disabled=Ve.o=zt),Ve},{e:void 0,t:void 0,a:void 0,o:void 0}),Oe})()},get children(){var Oe=xM(),pe=Oe.firstChild,De=pe.firstChild,st=De.nextSibling;Oe.addEventListener("submit",Ve=>{Ve.preventDefault(),ce(ae())}),Oe.$$mousedown=Ve=>{if(D()){Ve.preventDefault();return}if(Ve.target instanceof HTMLTextAreaElement)return;const ht=Ve.currentTarget.querySelector('[data-slot="question-custom-input"]');ht instanceof HTMLTextAreaElement&&ht.focus()},p(Oe,c(ec,{get multi(){return w(ae())},get picked(){return _(ae())},onClick:Ve=>me(Ve,ae())}),pe),p(De,h),st.$$input=Ve=>{Z(ae(),Ve.currentTarget.value),ke(Ve.currentTarget)},st.$$keydown=Ve=>{if(Ve.key==="Escape"){Ve.preventDefault(),a("editing",ht=>ht===ae()?void 0:ht),s.mode==="step"&&ae()===s.tab&&oe(b(ae()).length,ae());return}(Ve.metaKey||Ve.ctrlKey)&&!Ve.altKey||Ve.key!=="Enter"||Ve.shiftKey||(Ve.preventDefault(),ce(ae()))};var Je=ue(ae());return typeof Je=="function"&&ut(Je,st),Ae(Ve=>{var ht=_(ae()),Mt=w(ae())?"checkbox":"radio",Tt=_(ae()),zt=g(),rn=D();return ht!==Ve.e&&Ie(Oe,"data-picked",Ve.e=ht),Mt!==Ve.t&&Ie(Oe,"role",Ve.t=Mt),Tt!==Ve.a&&Ie(Oe,"aria-checked",Ve.a=Tt),zt!==Ve.o&&Ie(st,"placeholder",Ve.o=zt),rn!==Ve.i&&(st.disabled=Ve.i=rn),Ve},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),Ae(()=>st.value=x(ae())),Oe}})}}),null),Ae(()=>Ie(Ee,"data-slot",de()?"question-review-item":"question-step")),Ee})()};return c(d1,{kind:"question",get placement(){return e.placement},ref:E=>l=E,onKeyDown:G,get header(){return(()=>{var E=kM();return p(E,R),E})()},get footer(){return[(()=>{var E=CM();return p(E,P),E})(),(()=>{var E=IM();return p(E,c(F,{get when(){return K()},get fallback(){return[c(Pt,{icon:"arrow-left",size:"large",variant:"secondary",get disabled(){return D()||s.tab<=0},onClick:be,get"aria-label"(){return r.t("ui.common.back")}}),c(Pt,{icon:"arrow-right",size:"large",get variant(){return A()?"primary":"secondary"},get disabled(){return D()},onClick:Ue,get"aria-label"(){return r.t("ui.common.next")},"aria-keyshortcuts":"Meta+Enter Control+Enter"})]},get children(){return c(vt,{variant:"primary",size:"normal",get disabled(){return D()||!B()},onClick:ye,"aria-keyshortcuts":"Meta+Enter Control+Enter",get children(){return r.t("ui.common.submit")}})}})),E})()]},get children(){return c(F,{get when(){return K()},get fallback(){return c(Be,{get index(){return s.tab}})},get children(){var E=SM();return p(E,c(rt,{get each(){return i()},children:(ae,de)=>c(Be,{get index(){return de()},review:!0})})),E}})}})};Ot(["click","mousedown","keydown","input"]);var DM=I('<span class="min-w-0 flex-1 truncate text-13-regular text-text-base cursor-default">'),AM=I('<div class="pl-3 pr-2 py-2 flex items-center gap-2"role=button tabindex=0><span class="shrink-0 text-13-medium text-text-strong cursor-default"></span><div class="ml-auto shrink-0">'),PM=I("<div class=h-5 aria-hidden=true>"),OM=I('<div class="px-3 pb-7 flex flex-col gap-1.5 max-h-42 overflow-y-auto no-scrollbar">'),EM=I('<div class="flex items-center gap-2 min-w-0 py-1"><span class="min-w-0 flex-1 truncate text-13-regular text-text-strong">');function MM(e){const t=_t(),[r,i]=We({collapsed:!1}),n=()=>i("collapsed",l=>!l),o=$(()=>e.items.length),s=$(()=>t.t(o()===1?"session.followupDock.summary.one":"session.followupDock.summary.other",{count:o()})),a=$(()=>e.items[0]?.text??"");return c(Na,{"data-component":"session-followup-dock",style:{"margin-bottom":"-0.875rem","border-bottom-left-radius":0,"border-bottom-right-radius":0},get children(){return[(()=>{var l=AM(),u=l.firstChild,d=u.nextSibling;return l.$$keydown=f=>{f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),n())},l.$$click=n,p(u,s),p(l,c(F,{get when(){return Te(()=>!!r.collapsed)()&&a()},get children(){var f=DM();return p(f,a),f}}),d),p(d,c(Pt,{get"data-collapsed"(){return r.collapsed?"true":"false"},icon:"chevron-down",size:"normal",variant:"ghost",get style(){return{transform:`rotate(${r.collapsed?180:0}deg)`}},onMouseDown:f=>{f.preventDefault(),f.stopPropagation()},onClick:f=>{f.stopPropagation(),n()},get"aria-label"(){return Te(()=>!!r.collapsed)()?t.t("session.followupDock.expand"):t.t("session.followupDock.collapse")}})),l})(),c(F,{get when(){return r.collapsed},get children(){return PM()}}),c(F,{get when(){return!r.collapsed},get children(){var l=OM();return p(l,c(rt,{get each(){return e.items},children:u=>(()=>{var d=EM(),f=d.firstChild;return p(f,()=>u.text),p(d,c(vt,{size:"small",variant:"secondary",class:"shrink-0",get disabled(){return!!e.sending},onClick:()=>e.onSend(u.id),get children(){return t.t("session.followupDock.sendNow")}}),null),p(d,c(vt,{size:"small",variant:"ghost",class:"shrink-0",get disabled(){return!!e.sending},onClick:()=>e.onEdit(u.id),get children(){return t.t("session.followupDock.edit")}}),null),d})()})),l}})]}})}Ot(["click","keydown"]);var zM=I('<span class="min-w-0 flex-1 truncate text-14-regular text-text-base cursor-default">'),LM=I('<div class="pl-3 pr-2 py-2 flex items-center gap-2"role=button tabindex=0><span class="shrink-0 text-14-regular text-text-strong cursor-default"></span><div class="ml-auto shrink-0">'),FM=I("<div class=h-5 aria-hidden=true>"),NM=I('<div class="px-3 pb-7 flex flex-col gap-1.5 max-h-42 overflow-y-auto no-scrollbar">'),RM=I('<div class="flex items-center gap-2 min-w-0 py-1"><span class="min-w-0 flex-1 truncate text-13-regular text-text-strong">');function fg(e){const t=_t(),[r,i]=We({collapsed:!0});ne(()=>{e.items.length,e.items[0]?.id,i("collapsed",!0)});const n=()=>i("collapsed",l=>!l),o=$(()=>e.items.length),s=$(()=>t.t(o()===1?"session.revertDock.summary.one":"session.revertDock.summary.other",{count:o()})),a=$(()=>e.items[0]?.text??"");return c(Na,{"data-component":"session-revert-dock",get children(){return[(()=>{var l=LM(),u=l.firstChild,d=u.nextSibling;return l.$$keydown=f=>{f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),n())},l.$$click=n,p(u,s),p(l,c(F,{get when(){return Te(()=>!!r.collapsed)()&&a()},get children(){var f=zM();return p(f,a),f}}),d),p(d,c(Pt,{get"data-collapsed"(){return r.collapsed?"true":"false"},icon:"chevron-down",size:"normal",variant:"ghost",get style(){return{transform:`rotate(${r.collapsed?180:0}deg)`}},onMouseDown:f=>{f.preventDefault(),f.stopPropagation()},onClick:f=>{f.stopPropagation(),n()},get"aria-label"(){return Te(()=>!!r.collapsed)()?t.t("session.revertDock.expand"):t.t("session.revertDock.collapse")}})),l})(),c(F,{get when(){return r.collapsed},get children(){return FM()}}),c(F,{get when(){return!r.collapsed},get children(){var l=NM();return p(l,c(rt,{get each(){return e.items},children:u=>(()=>{var d=RM(),f=d.firstChild;return p(f,()=>u.text),p(d,c(vt,{size:"small",variant:"secondary",class:"shrink-0",get disabled(){return e.disabled||!!e.restoring},onClick:()=>e.onRestore(u.id),get children(){return t.t("session.revertDock.restore")}}),null),d})()})),l}})]}})}Ot(["click","keydown"]);var jM=I('<div class="relative z-10">'),UM=I('<div data-component=session-prompt-dock class="shrink-0 w-full pb-3 flex flex-col justify-center items-center bg-background-stronger pointer-events-none"><div>'),mg=I("<div>"),KM=I('<div class="w-full min-h-32 md:min-h-40 rounded-md border border-border-weak-base bg-background-base/50 px-4 py-3 text-text-weak whitespace-pre-wrap pointer-events-none">'),gg=I("<div class=pb-2>");function VM(e){const t=Ui(),r=_t(),i=Lc(),n=$(()=>lh(i.sessionKey())?.prompt),o=()=>t.current().map(m=>m.type==="agent"?`@${m.name}`:m.content).join("").trim();ne(()=>{t.ready()&&ch(i.sessionKey(),{prompt:o()})});const[s,a]=We({ready:!1});let l,u;const d=()=>{l!==void 0&&(window.clearTimeout(l),l=void 0),u!==void 0&&(cancelAnimationFrame(u),u=void 0)};ne(()=>{i.sessionKey();const m=e.ready,h=140;d(),a("ready",!1),m&&(u=requestAnimationFrame(()=>{u=void 0,l=window.setTimeout(()=>{a("ready",!0),l=void 0},h)}))}),je(d);const f=$(()=>e.revert?.items.length?e.revert:void 0);return(()=>{var m=UM(),h=m.firstChild,g=e.setPromptDockRef;return typeof g=="function"?ut(g,m):e.setPromptDockRef=m,p(h,c(F,{get when(){return e.state.questionDockRequest()},keyed:!0,children:y=>(()=>{var b=mg();return p(b,c(tc,{request:y,get onSubmit(){return e.onResponseSubmit}})),b})()}),null),p(h,c(F,{get when(){return e.state.permissionRequest()},keyed:!0,children:y=>(()=>{var b=mg();return p(b,c(hM,{request:y,get responding(){return e.state.permissionResponding()},onDecide:v=>{e.onResponseSubmit(),e.state.decide(v)}})),b})()}),null),p(h,c(F,{get when(){return!e.state.blocked()},get children(){return c(F,{get when(){return t.ready()},get fallback(){return[c(F,{get when(){return f()},keyed:!0,children:y=>(()=>{var b=gg();return p(b,c(fg,{get items(){return y.items},get restoring(){return y.restoring},get disabled(){return y.disabled},get onRestore(){return y.onRestore}})),b})()}),(()=>{var y=KM();return p(y,()=>n()||r.t("prompt.loading")),y})()]},get children(){return[c(F,{get when(){return f()},keyed:!0,children:y=>(()=>{var b=gg();return p(b,c(fg,{get items(){return y.items},get restoring(){return y.restoring},get disabled(){return y.disabled},get onRestore(){return y.onRestore}})),b})()}),(()=>{var y=jM();return p(y,c(F,{get when(){return e.followup?.items.length},get children(){return c(MM,{get items(){return e.followup.items},get sending(){return e.followup.sending},get onSend(){return e.followup.onSend},get onEdit(){return e.followup.onEdit}})}}),null),p(y,c(iM,{ref(b){var v=e.inputRef;typeof v=="function"?v(b):e.inputRef=b},get edit(){return e.followup?.edit},get onEditLoaded(){return e.followup?.onEditLoaded},get shouldQueue(){return e.followup?.queue},get onQueue(){return e.followup?.onQueue},get onAbort(){return e.followup?.onAbort},get onSubmit(){return e.onSubmit}}),null),y})()]}})}}),null),Ae(y=>Ct(h,{"w-full px-3 pointer-events-auto":!0,"md:max-w-200 md:mx-auto 2xl:max-w-[1000px]":e.centered},y)),m})()}const BM="kcode:e2e:composer",ZM=e=>({live:e.live,todos:e.todos?.map(t=>({...t}))}),Hd=()=>typeof window>"u"?!1:window.__kcode_e2e?.composer?.enabled===!0,f1=()=>{if(!Hd())return;const e=window.__kcode_e2e?.composer;if(e)return e.sessions??={},e.sessions},HM=e=>{if(!e)return;const t=f1()?.[e]?.driver;if(t)return ZM(t)},qM=e=>{const t=r=>{if(!e)return;const i=f1();if(!i)return;const n=i[e]??{};i[e]={...n,probe:{...r,states:[...r.states]}}};return{set:t,drop(){t({mounted:!1,collapsed:!1,hidden:!0,count:0,states:[]})}}},GM=e=>e.count===0?"hide":e.live?e.done?"close":"open":"clear",hg={type:"idle"};function WM(e){const t=yc(),r=Rn(),i=sr(),n=xc(),o=_t(),s=e_(),a=$(()=>{const M=t.id;if(M)return i.data.question[M]?.[0]}),l=$(()=>{const M=t.id;if(!(!M||a()))return t_(i.data.session,i.data.question,M,U=>U.sessionID!==M)}),u=$(()=>n_(i.data.session,i.data.permission,t.id,M=>!s.autoResponds(M,r.directory))),d=$(()=>t.id?!!u()||!!a()||!!l():!1),[f,m]=We({on:!1,live:void 0,todos:void 0}),h=()=>{const M=t.id;if(!M){m({on:!1,live:void 0,todos:void 0});return}const U=HM(M);if(!U){m({on:!1,live:void 0,todos:void 0});return}m({on:!0,live:U.live,todos:U.todos?.map(A=>({...A}))})};Vt(()=>{if(!Hd())return;h(),ne(qe(()=>t.id,h,{defer:!0})),ln(window,BM,U=>{U.detail?.sessionID===t.id&&h()})});const g=$(()=>{if(f.on&&f.todos!==void 0)return f.todos;const M=t.id;return M?n.data.session_todo[M]??[]:[]}),y=$(()=>g().length>0&&g().every(M=>M.status==="completed"||M.status==="cancelled")),b=$(()=>{const M=t.id;return M?i.data.session_status[M]??hg:hg}),v=$(()=>b().type!=="idle"),w=$(()=>f.on&&f.live!==void 0?f.live:v()||d()),[x,_]=We({responding:void 0,dock:g().length>0&&w(),closing:!1,opening:!1}),k=$(()=>{const M=u();return M?x.responding===M.id:!1}),C=M=>{const U=u();U&&x.responding!==U.id&&(_("responding",U.id),r.client.permission.respond({sessionID:U.sessionID,permissionID:U.id,response:M}).catch(A=>{const j=A instanceof Error?A.message:String(A);Nt({title:o.t("common.requestFailed"),description:j})}).finally(()=>{_("responding",A=>A===U.id?void 0:A)}))};let O,z;const K=()=>400,J=()=>{O&&window.clearTimeout(O),O=window.setTimeout(()=>{_({dock:!1,closing:!1}),O=void 0},K())},T=()=>{if(f.on&&f.todos!==void 0){m("todos",[]);return}const M=t.id;M&&(n.todo.set(M,[]),i.set("todo",M,[]))};return ne(qe(()=>[g().length,y(),w()],([M,U,A])=>{z&&cancelAnimationFrame(z),z=void 0;const j=GM({count:M,done:U,live:A});if(j==="hide"){O&&window.clearTimeout(O),O=void 0,_({dock:!1,closing:!1,opening:!1});return}if(j==="clear"){O&&window.clearTimeout(O),O=void 0,T();return}if(j==="open"){O&&window.clearTimeout(O),O=void 0;const P=!x.dock||x.closing;if(_({dock:!0,closing:!1}),P){_("opening",!0),z=requestAnimationFrame(()=>{_("opening",!1),z=void 0});return}_("opening",!1);return}_({dock:!0,opening:!1,closing:!0}),O||J()})),je(()=>{O&&window.clearTimeout(O)}),je(()=>{z&&cancelAnimationFrame(z)}),{blocked:d,currentQuestionRequest:a,questionDockRequest:l,permissionRequest:u,permissionResponding:k,decide:C,todos:g,dock:()=>x.dock,closing:()=>x.closing,opening:()=>x.opening}}var XM=I("<input data-component=inline-input>");function YM(e){const[t,r]=$e(e,["class","width","style"]),i=()=>t.style?typeof t.style=="string"?t.width?`${t.style};width:${t.width}`:t.style:t.width?{...t.style,width:t.width}:t.style:{width:t.width};return(()=>{var n=XM();return dn(n,ie({get class(){return t.class},get style(){return i()}},r),!1,!1),n})()}const JM=e=>e.deltaMode===1?e.deltaY*40:e.deltaMode===2?e.deltaY*e.rootHeight:e.deltaY,QM=e=>{const t=e.scrollHeight-e.clientHeight;if(t<=1)return!0;if(!e.delta)return!1;if(e.delta<0)return e.scrollTop+e.delta<=0;const r=t-e.scrollTop;return e.delta>r};var e5=I("<svg><circle cx=8 cy=8 data-slot=progress-circle-background></circle><circle cx=8 cy=8 data-slot=progress-circle-progress>");function t5(e){const[t,r]=$e(e,["percentage","size","strokeWidth","class","classList"]),i=()=>t.size||16,n=()=>t.strokeWidth||3,s=16/2,a=()=>s-n()/2,l=$(()=>2*Math.PI*a()),u=$(()=>{const f=Math.max(0,Math.min(100,t.percentage||0))/100;return l()*(1-f)});return(()=>{var d=e5(),f=d.firstChild,m=f.nextSibling;return dn(d,ie(r,{get width(){return i()},get height(){return i()},viewBox:"0 0 16 16",fill:"none","data-component":"progress-circle",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!0,!0),Ae(h=>{var g=a(),y=n(),b=a(),v=n(),w=l().toString(),x=u();return g!==h.e&&Ie(f,"r",h.e=g),y!==h.t&&Ie(f,"stroke-width",h.t=y),b!==h.a&&Ie(m,"r",h.a=b),v!==h.o&&Ie(m,"stroke-width",h.o=v),w!==h.i&&Ie(m,"stroke-dasharray",h.i=w),x!==h.n&&Ie(m,"stroke-dashoffset",h.n=x),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),d})()}var n5=I('<div class="flex items-center justify-center">'),r5=I("<div>"),i5=I('<div class="flex items-center gap-2"><span class=text-text-invert-strong></span><span class=text-text-invert-base>'),o5=I('<div class="flex items-center gap-2"><span class=text-text-invert-strong>%</span><span class=text-text-invert-base>');function s5(e){e.view.reviewPanel.opened()||e.view.reviewPanel.open(),e.layout.fileTree.opened()&&e.layout.fileTree.tab()!=="all"&&e.layout.fileTree.setTab("all"),e.tabs.open("context"),e.tabs.setActive("context")}function m1(e){const t=sr(),r=jr(),i=or(),n=_t(),o=ih(),{params:s,tabs:a,view:l}=_r(),u=$(()=>e.variant??"button"),d=qo({tabs:a,pathFromTab:r.pathFromTab,normalizeTab:w=>w.startsWith("file://")?r.tab(w):w}),f=$(()=>s.id?t.session.get(s.id):void 0),m=$(()=>s.id?t.data.message[s.id]??[]:[]),h=$(()=>tv(f(),m(),o.all())),g=$(()=>h().context),y=()=>{if(s.id){if(d.activeTab()==="context"){a().close("context");return}s5({view:l(),layout:i,tabs:a()})}},b=()=>(()=>{var w=n5();return p(w,c(t5,{size:16,strokeWidth:2,get percentage(){return Math.min(100,g()?.usage??0)}})),w})(),v=()=>(()=>{var w=r5();return p(w,c(F,{get when(){return g()},children:x=>[(()=>{var _=i5(),k=_.firstChild,C=k.nextSibling;return p(k,()=>x().promptTokens.toLocaleString(n.intl())),p(C,()=>n.t("context.usage.tokens")),_})(),(()=>{var _=o5(),k=_.firstChild,C=k.firstChild,O=k.nextSibling;return p(k,()=>x().usage??0,C),p(O,()=>n.t("context.usage.usage")),_})()]})),w})();return c(F,{get when(){return s.id},get children(){return c(Et,{get value(){return v()},get placement(){return e.placement??"top"},get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return u()==="indicator"},get children(){return b()}}),c(Xe,{when:!0,get children(){return c(vt,{type:"button",variant:"ghost",class:"size-6",onClick:y,get"aria-label"(){return n.t("context.usage.view")},get children(){return b()}})}})]}})}})}})}var a5=I('<span data-slot=animated-number-digit><span data-slot=animated-number-strip style="--animated-number-duration:var(--tool-motion-odometer-ms, 600ms)">'),l5=I("<span data-slot=animated-number-cell>"),c5=I("<span data-component=animated-number><span data-slot=animated-number-value>");const u5=Array.from({length:30},(e,t)=>t%10);function d5(e){return(e%10+10)%10}function f5(e,t,r){return e===t?0:r>0?(t-e+10)%10:-((e-t+10)%10)}function m5(e){const[t,r]=We({step:e.value+10,animating:!1}),i=()=>t.step,n=()=>t.animating;let o=e.value;return ne(qe(()=>e.value,s=>{const a=f5(o,s,e.direction);if(o=s,!a){r("animating",!1),r("step",s+10);return}r("animating",!0),r("step",l=>l+a)},{defer:!0})),(()=>{var s=a5(),a=s.firstChild;return a.addEventListener("transitionend",()=>{r("animating",!1),r("step",l=>d5(l)+10)}),p(a,c(rt,{each:u5,children:l=>(()=>{var u=l5();return p(u,l),u})()})),Ae(l=>{var u=n()?"true":"false",d=`${i()}`;return u!==l.e&&Ie(a,"data-animating",l.e=u),d!==l.t&&ft(a,"--animated-number-offset",l.t=d),l},{e:void 0,t:void 0}),s})()}function nc(e){const t=$(()=>Number.isFinite(e.value)?Math.max(0,Math.round(e.value)):0),[r,i]=We({value:t(),direction:1}),n=()=>r.value,o=()=>r.direction;ne(qe(t,u=>{const d=n();u!==d&&(i("direction",u>d?1:-1),i("value",u))},{defer:!0}));const s=$(()=>n().toString()),a=$(()=>Array.from(s(),u=>{const d=u.charCodeAt(0)-48;return d<0||d>9?0:d}).reverse()),l=$(()=>`${a().length}ch`);return(()=>{var u=c5(),d=u.firstChild;return p(d,c(Ur,{get each(){return a()},children:f=>c(m5,{get value(){return f()},get direction(){return o()}})})),Ae(f=>{var m=e.class,h=s(),g=l();return m!==f.e&&Jt(u,f.e=m),h!==f.t&&Ie(u,"aria-label",f.t=h),g!==f.a&&ft(d,"--animated-number-width",f.a=g),f},{e:void 0,t:void 0,a:void 0}),u})()}var g5={};ir(g5,{Checkbox:()=>Tr,Control:()=>h1,Description:()=>p1,ErrorMessage:()=>v1,Indicator:()=>b1,Input:()=>y1,Label:()=>w1,Root:()=>x1,useCheckboxContext:()=>gi});var g1=Rt();function gi(){const e=jt(g1);if(e===void 0)throw new Error("[kobalte]: `useCheckboxContext` must be used within a `Checkbox` component");return e}function h1(e){const t=Rr(),r=gi(),i=Ge({id:r.generateId("control")},e),[n,o]=$e(i,["onClick","onKeyDown"]);return c(it,ie({as:"div",onClick:l=>{Qe(l,n.onClick),r.toggle(),r.inputRef()?.focus()},onKeyDown:l=>{Qe(l,n.onKeyDown),l.key===uh.Space&&(r.toggle(),r.inputRef()?.focus())}},()=>t.dataset(),()=>r.dataset(),o))}function p1(e){const t=gi();return c(Li,ie(()=>t.dataset(),e))}function v1(e){const t=gi();return c(zi,ie(()=>t.dataset(),e))}function b1(e){const t=Rr(),r=gi(),[i,n]=ze(),o=Ge({id:r.generateId("indicator")},e),[s,a]=$e(o,["ref","forceMount"]),{present:l}=li({show:()=>s.forceMount||r.indeterminate()||r.checked(),element:()=>i()??null});return c(F,{get when(){return l()},get children(){return c(it,ie({as:"div",ref(u){var d=xt(n,s.ref);typeof d=="function"&&d(u)}},()=>t.dataset(),()=>r.dataset(),a))}})}function y1(e){let t;const r=Rr(),i=gi(),n=Ge({id:i.generateId("input")},e),[o,s,a]=$e(n,["ref","style","onChange","onFocus","onBlur"],Yg),{fieldProps:l}=Jg(s),[u,d]=ze(!1),f=g=>{if(Qe(g,o.onChange),g.stopPropagation(),!u()){const y=g.target;i.setIsChecked(y.checked),y.checked=i.checked()}d(!1)},m=g=>{Qe(g,o.onFocus),i.setIsFocused(!0)},h=g=>{Qe(g,o.onBlur),i.setIsFocused(!1)};return ne(qe([()=>i.checked(),()=>i.value()],()=>{d(!0),t?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},{defer:!0})),ne(qe([()=>t,()=>i.indeterminate(),()=>i.checked()],([g,y])=>{g&&(g.indeterminate=y)})),c(it,ie({as:"input",ref(g){var y=xt(b=>{i.setInputRef(b),t=b},o.ref);typeof y=="function"&&y(g)},type:"checkbox",get id(){return l.id()},get name(){return r.name()},get value(){return i.value()},get checked(){return i.checked()},get required(){return r.isRequired()},get disabled(){return r.isDisabled()},get readonly(){return r.isReadOnly()},get style(){return vr(cc,o.style)},get"aria-label"(){return l.ariaLabel()},get"aria-labelledby"(){return l.ariaLabelledBy()},get"aria-describedby"(){return l.ariaDescribedBy()},get"aria-invalid"(){return r.validationState()==="invalid"||void 0},get"aria-required"(){return r.isRequired()},get"aria-disabled"(){return r.isDisabled()},get"aria-readonly"(){return r.isReadOnly()},onChange:f,onFocus:m,onBlur:h},()=>r.dataset(),()=>i.dataset(),a))}function w1(e){const t=gi();return c(uc,ie(()=>t.dataset(),e))}function x1(e){let t;const r=`checkbox-${nn()}`,i=Ge({value:"on",id:r},e),[n,o,s]=$e(i,["ref","children","value","checked","defaultChecked","indeterminate","onChange","onPointerDown"],hc),[a,l]=ze(),[u,d]=ze(!1),{formControlContext:f}=pc(o),m=ip({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:b=>n.onChange?.(b),isDisabled:()=>f.isDisabled(),isReadOnly:()=>f.isReadOnly()});ta(()=>t,()=>m.setIsSelected(n.defaultChecked??!1));const h=b=>{Qe(b,n.onPointerDown),u()&&b.preventDefault()},g=$(()=>({"data-checked":m.isSelected()?"":void 0,"data-indeterminate":n.indeterminate?"":void 0})),y={value:()=>n.value,dataset:g,checked:()=>m.isSelected(),indeterminate:()=>n.indeterminate??!1,inputRef:a,generateId:Nn(()=>Ce(o.id)),toggle:()=>m.toggle(),setIsChecked:b=>m.setIsSelected(b),setIsFocused:d,setInputRef:l};return c(vc.Provider,{value:f,get children(){return c(g1.Provider,{value:y,get children(){return c(it,ie({as:"div",ref(b){var v=xt(w=>t=w,n.ref);typeof v=="function"&&v(b)},role:"group",get id(){return Ce(o.id)},onPointerDown:h},()=>f.dataset(),g,s,{get children(){return c(h5,{state:y,get children(){return n.children}})}}))}})}})}function h5(e){const t=Qg(()=>{const r=e.children;return bc(r)?r(e.state):r});return Te(t)}var Tr=Object.assign(x1,{Control:h1,Description:p1,ErrorMessage:v1,Indicator:b1,Input:y1,Label:w1}),p5=I("<div data-slot=checkbox-checkbox-content>"),v5=I('<svg viewBox="0 0 12 12"fill=none width=10 height=10 xmlns=http://www.w3.org/2000/svg><path d="M3 7.17905L5.02703 8.85135L9 3.5"stroke=currentColor stroke-width=1.5 stroke-linecap=square>');function _1(e){const[t,r]=$e(e,["children","class","label","hideLabel","description","icon"]);return c(Tr,ie(r,{"data-component":"checkbox",get children(){return[c(Tr.Input,{"data-slot":"checkbox-checkbox-input"}),c(Tr.Control,{"data-slot":"checkbox-checkbox-control",get children(){return c(Tr.Indicator,{"data-slot":"checkbox-checkbox-indicator",get children(){return t.icon||v5()}})}}),(()=>{var i=p5();return p(i,c(F,{get when(){return e.children},get children(){return c(Tr.Label,{"data-slot":"checkbox-checkbox-label",get classList(){return{"sr-only":t.hideLabel}},get children(){return e.children}})}}),null),p(i,c(F,{get when(){return t.description},get children(){return c(Tr.Description,{"data-slot":"checkbox-checkbox-description",get children(){return t.description}})}}),null),p(i,c(Tr.ErrorMessage,{"data-slot":"checkbox-checkbox-error"}),null),i})()]}}))}var b5=I("<span data-component=text-reveal><span data-slot=text-reveal-track><span data-slot=text-reveal-entering></span><span data-slot=text-reveal-leaving>");const y5=(e,t)=>typeof e=="number"?`${e}px`:typeof e=="string"?e:`${t}px`,w5=(e,t)=>typeof e=="number"?`${e}ms`:typeof e=="string"?e:`${t}ms`,x5=(e,t)=>`${e??t}%`;function $1(e){const[t,r]=We({cur:e.text,old:void 0,width:"auto",ready:!1,swapping:!1}),i=()=>t.cur,n=()=>t.old,o=()=>t.width,s=()=>t.ready,a=()=>t.swapping;let l,u,d,f;const m=()=>l?.scrollWidth??0,h=()=>u?.scrollWidth??0,g=y=>{if(!(y<=0)){if(e.growOnly??!0){const b=Number.parseFloat(o());if(Number.isFinite(b)&&y<=b)return}r("width",`${y}px`)}};return ne(qe(()=>e.text,(y,b)=>{if(y!==b){if(typeof y=="string"&&typeof b=="string"&&y.startsWith(b)){r("cur",y),g(m());return}if(r("swapping",!0),r("old",b),r("cur",y),typeof requestAnimationFrame!="function"){g(Math.max(m(),h())),d?.offsetHeight,r("swapping",!1);return}f!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{g(Math.max(m(),h())),d?.offsetHeight,r("swapping",!1),f=void 0})}})),Vt(()=>{g(m());const y=typeof document<"u"?document.fonts:void 0;if(typeof requestAnimationFrame!="function"){r("ready",!0);return}if(!y){requestAnimationFrame(()=>r("ready",!0));return}y.ready.finally(()=>{g(m()),requestAnimationFrame(()=>r("ready",!0))})}),je(()=>{f===void 0||typeof cancelAnimationFrame!="function"||cancelAnimationFrame(f)}),(()=>{var y=b5(),b=y.firstChild,v=b.firstChild,w=v.nextSibling,x=d;typeof x=="function"?ut(x,y):d=y;var _=l;typeof _=="function"?ut(_,v):l=v,p(v,()=>i()??" ");var k=u;return typeof k=="function"?ut(k,w):u=w,p(w,()=>n()??" "),Ae(C=>{var O=s()?"true":"false",z=a()?"true":"false",K=e.truncate?"true":"false",J=e.class,T=e.text??"",M=w5(e.duration,450),U=x5(e.edge,17),A=y5(e.travel,0),j=e.spring??"cubic-bezier(0.34, 1.08, 0.64, 1)",P=e.springSoft??"cubic-bezier(0.34, 1, 0.64, 1)",B=e.truncate?"100%":o();return O!==C.e&&Ie(y,"data-ready",C.e=O),z!==C.t&&Ie(y,"data-swapping",C.t=z),K!==C.a&&Ie(y,"data-truncate",C.a=K),J!==C.o&&Jt(y,C.o=J),T!==C.i&&Ie(y,"aria-label",C.i=T),M!==C.n&&ft(y,"--text-reveal-duration",C.n=M),U!==C.s&&ft(y,"--text-reveal-edge",C.s=U),A!==C.h&&ft(y,"--text-reveal-travel",C.h=A),j!==C.r&&ft(y,"--text-reveal-spring",C.r=j),P!==C.d&&ft(y,"--text-reveal-spring-soft",C.d=P),B!==C.l&&ft(b,"width",C.l=B),C},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),y})()}var _5=I('<span data-component=text-strikethrough style=display:grid><span style="grid-area:1 / 1"></span><span aria-hidden=true style="grid-area:1 / 1;text-decoration:line-through;pointer-events:none">');function $5(e){const t=Fa(()=>e.active?1:0,()=>({visualDuration:e.visualDuration??.35,bounce:0}));let r,i;const[n,o]=We({textWidth:0,containerWidth:0}),s=()=>n.textWidth,a=()=>n.containerWidth,l=()=>{r&&o("textWidth",r.scrollWidth),i&&o("containerWidth",i.offsetWidth)};Vt(l),Uo(()=>i,l);const u=()=>{const m=s();return m>0?t()*m:0},d=()=>{const m=a(),h=s();return m<=0||h<=0?`inset(0 ${(1-t())*100}% 0 0)`:`inset(0 ${Math.max(0,m-u())}px 0 0)`},f=()=>{const m=u();return m<=.5?"none":`inset(0 0 0 ${m}px)`};return(()=>{var m=_5(),h=m.firstChild,g=h.nextSibling,y=i;typeof y=="function"?ut(y,m):i=m;var b=r;return typeof b=="function"?ut(b,h):r=h,p(h,()=>e.text),p(g,()=>e.text),Ae(v=>{var w=e.class,x={...e.style},_=f(),k=d();return w!==v.e&&Jt(m,v.e=w),v.t=gr(m,x,v.t),_!==v.a&&ft(h,"clip-path",v.a=_),k!==v.o&&ft(g,"clip-path",v.o=k),v},{e:void 0,t:void 0,a:void 0,o:void 0}),m})()}var S5=I('<svg viewBox="0 0 12 12"width=12 height=12 fill=currentColor xmlns=http://www.w3.org/2000/svg class=block><circle cx=6 cy=6 r=3 style=animation:var(--animate-pulse-scale);transform-origin:center;transform-box:fill-box>'),k5=I('<div><div data-action=session-todo-toggle class="pl-3 pr-2 py-2 flex items-center gap-2 overflow-visible"role=button tabindex=0><span class="text-14-regular text-text-strong cursor-default inline-flex items-baseline shrink-0 overflow-visible"style=--tool-motion-odometer-ms:600ms;--tool-motion-mask:18%;--tool-motion-mask-height:0px;--tool-motion-spring-ms:560ms;white-space:pre></span><div data-slot=session-todo-preview class="ml-1 min-w-0 overflow-hidden"style="flex:1 1 auto;max-width:100%"></div><div class=ml-auto></div></div><div data-slot=session-todo-list>'),C5=I("<span>"),I5=I('<div class=relative><div class="px-3 pb-11 flex flex-col gap-1.5 max-h-42 overflow-y-auto no-scrollbar"style=overflow-anchor:none></div><div class="pointer-events-none absolute top-0 left-0 right-0 h-4 transition-opacity duration-150"style="background:linear-gradient(to bottom, var(--background-base), transparent)">');const pg="\0done\0",vg="\0total\0";function T5(e){if(e==="in_progress")return(()=>{var t=S5();return t.firstChild,t})()}function D5(e){const t=_t(),[r,i]=We({collapsed:!1,height:320}),n=()=>i("collapsed",C=>!C),o=$(()=>e.todos.length),s=$(()=>e.todos.filter(C=>C.status==="completed").length),a=$(()=>t.t("session.todo.progress",{done:s(),total:o()})),l=$(()=>t.t("session.todo.progress",{done:pg,total:vg}).split(/(\u0000done\u0000|\u0000total\u0000)/)),u=$(()=>e.todos.find(C=>C.status==="in_progress")??e.todos.find(C=>C.status==="pending")??e.todos.filter(C=>C.status==="completed").at(-1)??e.todos[0]),d=$(()=>u()?.content??""),f=Fa(()=>r.collapsed?1:0,{visualDuration:.3,bounce:0}),m=$(()=>Math.max(0,Math.min(1,e.dockProgress))),h=$(()=>1-m()),g=$(()=>Math.max(0,Math.min(1,f()))),y=$(()=>Math.max(g(),h())),b=$(()=>y()>.98),v=$(()=>Math.max(0,Math.min(1,g()))),w=$(()=>Math.max(78,r.height)),x=Hd(),_=qM(e.sessionID);let k;return ne(()=>{const C=k;if(!C)return;const O=()=>{i("height",C.getBoundingClientRect().height)};O(),Ti(C,O)}),ne(()=>{x&&_.set({mounted:!0,collapsed:r.collapsed,hidden:r.collapsed||b(),count:e.todos.length,states:e.todos.map(C=>C.status)})}),je(()=>{x&&_.drop()}),c(Na,{"data-component":"session-todo-dock",get style(){return{"overflow-x":"visible","overflow-y":"hidden","max-height":`${Math.max(78,w()-g()*(w()-78))}px`}},get children(){var C=k5(),O=C.firstChild,z=O.firstChild,K=z.nextSibling,J=K.nextSibling,T=O.nextSibling,M=k;return typeof M=="function"?ut(M,C):k=C,O.$$keydown=U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),n())},O.$$click=n,p(z,c(Ur,{get each(){return l()},children:U=>U()===pg?c(nc,{get value(){return s()}}):U()===vg?c(nc,{get value(){return o()}}):(()=>{var A=C5();return p(A,U),A})()})),p(K,c($1,{class:"text-14-regular text-text-base cursor-default",get text(){return Te(()=>!!r.collapsed)()?d():void 0},duration:600,travel:25,edge:17,spring:"cubic-bezier(0.34, 1, 0.64, 1)",springSoft:"cubic-bezier(0.34, 1, 0.64, 1)",growOnly:!0,truncate:!0})),p(J,c(Pt,{"data-action":"session-todo-toggle-button",get"data-collapsed"(){return r.collapsed?"true":"false"},icon:"chevron-down",size:"normal",variant:"ghost",get style(){return{transform:`rotate(${v()*180}deg)`}},onMouseDown:U=>{U.preventDefault(),U.stopPropagation()},onClick:U=>{U.stopPropagation(),n()},get"aria-label"(){return Te(()=>!!r.collapsed)()?e.expandLabel:e.collapseLabel}})),p(T,c(A5,{get todos(){return e.todos}})),Ae(U=>{var A=a(),j=`${Math.max(0,Math.min(1,1-h()))}`,P=r.collapsed||b(),B=y()>.1,R=b()?"hidden":"visible",V=`${Math.max(0,Math.min(1,1-y()))}`;return A!==U.e&&Ie(z,"aria-label",U.e=A),j!==U.t&&ft(z,"opacity",U.t=j),P!==U.a&&Ie(T,"aria-hidden",U.a=P),B!==U.o&&T.classList.toggle("pointer-events-none",U.o=B),R!==U.i&&ft(T,"visibility",U.i=R),V!==U.n&&ft(T,"opacity",U.n=V),U},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),C}})}function A5(e){const[t,r]=We({stuck:!1});return(()=>{var i=I5(),n=i.firstChild,o=n.nextSibling;return n.addEventListener("scroll",s=>{r("stuck",s.currentTarget.scrollTop>0)}),p(n,c(Ur,{get each(){return e.todos},children:s=>c(_1,{readOnly:!0,get checked(){return s().status==="completed"},get indeterminate(){return s().status==="in_progress"},get"data-in-progress"(){return s().status==="in_progress"?"":void 0},get"data-state"(){return s().status},get icon(){return T5(s().status)},get style(){return{"--checkbox-align":"flex-start","--checkbox-offset":"1px",transition:"opacity 220ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))",opacity:s().status==="pending"?"0.94":"1"}},get children(){return c($5,{get active(){return s().status==="completed"||s().status==="cancelled"},get text(){return s().content},class:"text-14-regular min-w-0 break-words",get style(){return{"line-height":"var(--line-height-normal)",transition:"color 220ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1)), opacity 220ms var(--tool-motion-ease, cubic-bezier(0.22, 1, 0.36, 1))",color:s().status==="completed"||s().status==="cancelled"?"var(--text-weak)":"var(--text-strong)",opacity:s().status==="pending"?"0.92":"1"}}})}})})),Ae(s=>ft(o,"opacity",t.stuck?1:0)),i})()}Ot(["click","keydown"]);var P5=I('<div data-component=session-message-todo-dock class="pointer-events-none absolute inset-x-0 bottom-0 z-20 px-4 pb-3"><div><div class=overflow-hidden><div>');const O5=e=>Math.max(0,Math.min(1,e));function E5(e){const t=_t(),[r,i]=We({body:void 0,root:void 0,height:320}),n=Fa(()=>e.open&&!e.closing?1:0,{visualDuration:.3,bounce:0}),o=$(()=>O5(n())),s=$(()=>e.open||o()>.001),a=$(()=>Math.max(78,r.height));return ne(()=>{const l=r.body;if(!l)return;const u=()=>i("height",l.getBoundingClientRect().height);Ti(l,u),u()}),ne(()=>{const l=r.root;if(!l||!s()){e.onHeightChange?.(0);return}const u=()=>{e.onHeightChange?.(Math.ceil(l.getBoundingClientRect().height))};Ti(l,u),u()}),ne(()=>{s()||e.onHeightChange?.(0)}),je(()=>{e.onHeightChange?.(0)}),c(F,{get when(){return s()},get children(){var l=P5(),u=l.firstChild,d=u.firstChild,f=d.firstChild;return ut(m=>i("root",m),d),ut(m=>i("body",m),f),p(f,c(D5,{get sessionID(){return e.sessionID},get todos(){return e.todos},get collapseLabel(){return t.t("session.todo.collapse")},get expandLabel(){return t.t("session.todo.expand")},get dockProgress(){return o()}})),Ae(m=>{var h={"pointer-events-auto w-full":!0,"md:max-w-200 md:mx-auto 2xl:max-w-[1000px]":e.centered},g=o()<.98,y=`${a()*o()}px`;return m.e=Ct(u,h,m.e),g!==m.t&&d.classList.toggle("pointer-events-none",m.t=g),y!==m.a&&ft(d,"max-height",m.a=y),m},{e:void 0,t:void 0,a:void 0}),l}})}var S1=I("<div>");function M5(e,t){return t?e?typeof e=="string"?`${e};--card-accent:${t};`:{...e,"--card-accent":t}:{"--card-accent":t}:e}function qd(e){const[t,r]=$e(e,["variant","style","class","classList"]),i=()=>t.variant??"normal",n=()=>{const o=i();if(o==="error")return"var(--icon-critical-base)";if(o==="warning")return"var(--icon-warning-active)";if(o==="success")return"var(--icon-success-active)";if(o==="info")return"var(--icon-info-active)"};return(()=>{var o=S1();return dn(o,ie(r,{"data-component":"card",get"data-variant"(){return i()},get style(){return M5(t.style,n())},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(o,()=>e.children),o})()}function z5(e){const[t,r]=$e(e,["class","classList","children"]);return(()=>{var i=S1();return dn(i,ie(r,{"data-slot":"card-description",get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}}),!1,!0),p(i,()=>t.children),i})()}function L5({onlyFirst:e=!1}={}){const n="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(n,e?void 0:"g")}const F5=L5();function k1(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(F5,"")}var N5=I("<div data-slot=collapsible-arrow><span data-slot=collapsible-arrow-icon>");function R5(e){const[t,r]=$e(e,["class","classList","variant"]);return c(ha,ie({"data-component":"collapsible",get"data-variant"(){return t.variant||"normal"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}}},r))}function j5(e){return c(ha.Trigger,ie({"data-slot":"collapsible-trigger"},e))}function U5(e){return c(ha.Content,ie({"data-slot":"collapsible-content"},e))}function K5(e){return(()=>{var t=N5(),r=t.firstChild;return dn(t,e||{},!1,!0),p(r,c(bt,{name:"chevron-down",size:"small"})),t})()}const en=Object.assign(R5,{Arrow:K5,Trigger:j5,Content:U5});var V5=I("<span data-slot=text-shimmer-char><span data-slot=text-shimmer-char-base aria-hidden=true></span><span data-slot=text-shimmer-char-shimmer aria-hidden=true>");const hn=e=>{const t=$(()=>e.text??""),r=$(()=>e.active??!0),i=$(()=>e.offset??0),[n,o]=ze(r()),s=220;let a;return ne(()=>{if(a&&(clearTimeout(a),a=void 0),r()){o(!0);return}a=setTimeout(()=>{a=void 0,o(!1)},s)}),je(()=>{a&&clearTimeout(a)}),c(Jn,{get component(){return e.as??"span"},"data-component":"text-shimmer",get"data-active"(){return r()?"true":"false"},get class(){return e.class},get"aria-label"(){return t()},get style(){return{"--text-shimmer-swap":`${s}ms`,"--text-shimmer-index":`${i()}`}},get children(){var l=V5(),u=l.firstChild,d=u.nextSibling;return p(u,t),p(d,t),Ae(()=>Ie(d,"data-run",n()?"true":"false")),l}})};var B5=I("<button data-slot=tool-call-detail-toggle type=button>"),Z5=I("<div data-slot=tool-call-detail-block><div data-slot=tool-call-detail-header><span data-slot=tool-call-detail-title></span></div><pre data-slot=tool-call-detail-value><code>"),H5=I("<div data-component=tool-call-details>");const q5=12,G5=1200;function pl(e){return k1(e).replace(/\r\n?/g,`
62
62
  `).trim()}function W5(e){if(e==null)return;if(typeof e=="string")return pl(e)||void 0;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{const r=pl(JSON.stringify(e,null,2));if(r)return r}catch{}return pl(String(e))||void 0}function X5(e,t){const r=q5,i=G5,n=e.split(`
63
63
  `);let o=e,s=!1;return n.length>r&&(o=n.slice(0,r).join(`
@@ -66,6 +66,6 @@ ${X.commentID}`)?.time??Date.now():Date.now(),origin:X.commentOrigin,preview:X.p
66
66
  `)){const r=_o(t.replace(/^\s*(?:[-*+]\s+|\d+[.)]\s+)/,""));if(r)return $o(r)}}function C1(e){if(typeof e!="string")return;const t=e.replace(/\r\n?/g,`
67
67
  `).trim();if(!t)return;const r=t.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i);if(r?.[1]){const s=_o(r[1]);if(s)return $o(s)}const i=t.match(/^\s{0,3}#{1,6}[ \t]+(.+?)(?:[ \t]+#+[ \t]*)?$/m);if(i?.[1]){const s=_o(i[1]);if(s)return $o(s)}const n=t.match(/^([^\n]+)\n(?:=+|-+)\s*$/m);if(n?.[1]){const s=_o(n[1]);if(s)return $o(s)}const o=t.match(/^\s*(?:\*\*|__)(.+?)(?:\*\*|__)\s*$/m);if(o?.[1]){const s=_o(o[1]);if(s)return $o(s)}return Ez(t)}function Mz(e){const t=C1(e.text);return t?e.withTopic(t):e.fallback}function I1(e){return e.url.startsWith("data:")}function zz(e){return I1(e)?!1:e.source?.text?.start!==void 0&&e.source?.text?.end!==void 0}function Lz(e){return e.mime.startsWith("image/")?"image":"file"}var Fz=I("<span data-component=shell-submessage><span data-slot=shell-submessage-width><span data-slot=basic-tool-tool-subtitle><span data-slot=shell-submessage-value>"),Nz=I("<div data-component=diagnostics>"),Rz=I("<div data-slot=diagnostic><span data-slot=diagnostic-label></span><span data-slot=diagnostic-location>[<!>:<!>]</span><span data-slot=diagnostic-message>"),jz=I("<div data-component=exa-tool-output><div data-slot=exa-tool-links>"),Uz=I('<a data-slot=exa-tool-link target=_blank rel="noopener noreferrer">'),Kz=I("<a data-slot=task-child-session-link>"),ks=I("<div data-slot=task-child-session-state>"),Vz=I("<div data-slot=task-child-session-turn-label>"),Bz=I("<div data-slot=task-child-session-turn>"),Zz=I("<div data-component=task-child-session><div data-slot=task-child-session-header><div data-slot=task-child-session-heading><span data-slot=task-child-session-label></span><span data-slot=task-child-session-title></span></div><div data-slot=task-child-session-actions><span data-slot=task-child-session-status>"),Hz=I("<div data-slot=task-child-session-message>"),qz=I('<div data-component=context-tool-group-trigger><span data-slot=context-tool-group-title class="min-w-0 flex items-center gap-2 text-14-medium text-text-strong"><span data-slot=context-tool-group-label class=shrink-0></span><span data-slot=context-tool-group-summary class="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-normal text-text-base">'),Gz=I("<div data-component=context-tool-group-list>"),T1=I("<span data-slot=basic-tool-tool-subtitle>"),Wz=I("<div data-slot=context-tool-group-item><div data-component=tool-trigger><div data-slot=basic-tool-tool-trigger-content><div data-slot=basic-tool-tool-info><div data-slot=basic-tool-tool-info-structured><div data-slot=basic-tool-tool-info-main><span data-slot=basic-tool-tool-title>"),Xz=I("<span data-slot=basic-tool-tool-arg>"),Yz=I("<div data-slot=user-message-attachments>"),Jz=I("<div data-slot=user-message-body><div data-slot=user-message-text>"),Qz=I('<span data-slot=user-message-meta class="text-12-regular text-text-weak cursor-default">'),eL=I('<span data-slot=user-message-meta-sep class="text-12-regular text-text-weak cursor-default"> · '),tL=I('<span data-slot=user-message-meta-tail class="text-12-regular text-text-weak cursor-default">'),nL=I("<span data-slot=user-message-meta-wrap>"),rL=I("<div data-slot=user-message-copy-wrapper>"),iL=I("<div data-component=user-message>"),oL=I("<img data-slot=user-message-attachment-image>"),sL=I("<div data-slot=user-message-attachment>"),aL=I("<div data-slot=user-message-attachment-file><span data-slot=user-message-attachment-name>"),lL=I("<span>"),D1=I("<span data-slot=apply-patch-directory>"),A1=I("<div data-slot=apply-patch-trigger-content><div data-slot=apply-patch-file-info><div data-slot=apply-patch-file-name-container><span data-slot=apply-patch-filename></span></div></div><div data-slot=apply-patch-trigger-actions>"),cL=I("<div data-component=tool-part-wrapper>"),uL=I('<div data-component=compaction-part><div data-slot=compaction-part-divider><span data-slot=compaction-part-line></span><span data-slot=compaction-part-label class="text-12-regular text-text-weak"></span><span data-slot=compaction-part-line>'),dL=I('<span data-slot=text-part-meta class="text-12-regular text-text-weak cursor-default">'),fL=I("<div data-slot=text-part-copy-wrapper>"),mL=I("<div data-component=text-part><div data-slot=text-part-body>"),gL=I("<div data-component=reasoning-part-trigger><span data-slot=reasoning-part-title></span><span data-slot=reasoning-part-controls><span data-slot=reasoning-part-action>"),hL=I("<div data-component=reasoning-part>"),pL=I("<div data-component=tool-loaded-file><span> "),Gd=I("<div data-component=tool-output data-scrollable>"),vL=I('<a data-slot=basic-tool-tool-subtitle class="clickable subagent-link">'),P1=I('<div data-slot=basic-tool-tool-info-structured><div data-slot=basic-tool-tool-info-main><span data-slot=basic-tool-tool-title class="capitalize agent-title">'),bL=I("<div data-component=bash-output><div data-slot=bash-copy></div><div data-slot=bash-scroll data-scrollable><pre data-slot=bash-pre><code>"),yL=I("<div data-slot=basic-tool-tool-info-structured><div data-slot=basic-tool-tool-info-main><span data-slot=basic-tool-tool-title>"),wL=I("<div data-component=edit-content>"),xL=I("<div data-component=edit-tool>"),Wd=I("<span data-slot=message-part-title-filename>"),Xd=I("<div data-slot=message-part-path><span data-slot=message-part-directory>"),O1=I("<div data-component=edit-trigger><div data-slot=message-part-title-area><div data-slot=message-part-title><span data-slot=message-part-title-text></span></div></div><div data-slot=message-part-actions>"),_L=I("<div data-component=write-content>"),$L=I("<div data-component=write-tool>"),SL=I("<div data-component=write-trigger><div data-slot=message-part-title-area><div data-slot=message-part-title><span data-slot=message-part-title-text></span></div></div><div data-slot=message-part-actions>"),xg=I("<div data-component=apply-patch-file-diff>"),_g=I("<div data-component=apply-patch-tool>"),$g=I("<span data-slot=apply-patch-change data-type=added>"),Sg=I("<span data-slot=apply-patch-change data-type=removed>"),kg=I("<span data-slot=apply-patch-change data-type=modified>"),kL=I("<div data-component=todos>"),CL=I("<span data-slot=message-part-todo-content>"),IL=I("<div data-component=question-answers>"),TL=I("<div data-slot=question-answer-item><div data-slot=question-text></div><div data-slot=answer-text>");function DL(e){let t,r;return Vt(()=>{e.animate&&requestAnimationFrame(()=>{t&&Ys(t,{width:"auto"},{type:"spring",visualDuration:.25,bounce:0}),r&&Ys(r,{opacity:1,filter:"blur(0px)"},{duration:.32,ease:[.16,1,.3,1]})})}),(()=>{var i=Fz(),n=i.firstChild,o=n.firstChild,s=o.firstChild,a=t;typeof a=="function"?ut(a,n):t=n;var l=r;return typeof l=="function"?ut(l,s):r=s,p(s,()=>e.text),Ae(u=>{var d=e.animate?"0px":void 0,f=e.animate?{opacity:0,filter:"blur(2px)"}:void 0;return d!==u.e&&ft(n,"width",u.e=d),u.t=gr(s,f,u.t),u},{e:void 0,t:void 0}),i})()}function E1(e,t){return!e||!t?[]:(e[t]??[]).filter(i=>i.severity===1).slice(0,3)}function M1(e){const t=yt();return c(F,{get when(){return e.diagnostics.length>0},get children(){var r=Nz();return p(r,c(rt,{get each(){return e.diagnostics},children:i=>(()=>{var n=Rz(),o=n.firstChild,s=o.nextSibling,a=s.firstChild,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling;d.nextSibling;var f=s.nextSibling;return p(o,()=>t.t("ui.messagePart.diagnostic.error")),p(s,()=>i.range.start.line+1,l),p(s,()=>i.range.start.character+1,d),p(f,()=>i.message),n})()})),r}})}const hi={},Cg=24,AL=/[\s.,!?;:)\]]/;function PL(e){return e<=12?2:e<=48?4:e<=96?8:Math.min(24,Math.ceil(e/8))}function OL(e,t){const r=Math.min(e.length,t+PL(e.length-t)),i=Math.min(e.length,r+8);for(let n=r;n<i;n++)if(AL.test(e[n]??""))return n+1;return r}function EL(e,t){const[r,i]=ze(e());let n=e(),o;const s=()=>{o&&(clearTimeout(o),o=void 0)},a=u=>{n=u,i(u)},l=()=>{o=void 0;const u=e();if(!t?.()){a(u);return}if(!u.startsWith(n)||u.length<=n.length){a(u);return}const d=OL(u,n.length);a(u.slice(0,d)),d<u.length&&(o=setTimeout(l,Cg))};return ne(()=>{const u=e();if(!t?.()){s(),a(u);return}if(!u.startsWith(n)||u.length<n.length){s(),a(u);return}u.length===n.length||o||(o=setTimeout(l,Cg))}),je(()=>{s()}),r}function z1(e){const t=EL(()=>e.text,()=>e.streaming);return c(F,{get when(){return t()},get children(){return c(di,{get text(){return t()},get cacheKey(){return e.cacheKey},get streaming(){return e.streaming}})}})}function L1(e,t){if(!e)return"";if(!t||t==="/"||t==="\\")return e;if(e===t)return"";const r=t.includes("\\")?"\\":"/",i=t.endsWith(r)?t:t+r;return e.startsWith(i)?e.slice(t.length):e}function Yn(e){const t=yr();return L1(Ri(e),t.directory)}function F1(e,t){return t?e.t("ui.tool.agent",{type:t}):e.t("ui.tool.agent.default")}function N1(e,t={}){const r=yt();switch(e){case"read":return{icon:"glasses",title:r.t("ui.tool.read"),subtitle:t.filePath?Qt(t.filePath):void 0};case"list":return{icon:"bullet-list",title:r.t("ui.tool.list"),subtitle:t.path?Qt(t.path):void 0};case"glob":return{icon:"magnifying-glass-menu",title:r.t("ui.tool.glob"),subtitle:t.pattern};case"grep":return{icon:"magnifying-glass-menu",title:r.t("ui.tool.grep"),subtitle:t.pattern};case"websearch":return{icon:"window-cursor",title:r.t("ui.tool.websearch"),subtitle:t.query};case"codesearch":return{icon:"code",title:r.t("ui.tool.codesearch"),subtitle:t.query};case"task":{const i=typeof t.subagent_type=="string"&&t.subagent_type?t.subagent_type[0].toUpperCase()+t.subagent_type.slice(1):void 0;return{icon:"task",title:F1(r,i),subtitle:t.description}}case"bash":return{icon:"console",title:r.t("ui.tool.shell"),subtitle:t.description};case"edit":return{icon:"code-lines",title:r.t("ui.messagePart.title.edit"),subtitle:t.filePath?Qt(t.filePath):void 0};case"write":return{icon:"code-lines",title:r.t("ui.messagePart.title.write"),subtitle:t.filePath?Qt(t.filePath):void 0};case"apply_patch":return{icon:"code-lines",title:r.t("ui.tool.patch"),subtitle:t.files?.length?`${t.files.length} ${r.t(t.files.length>1?"ui.common.file.other":"ui.common.file.one")}`:void 0};case"todowrite":return{icon:"checklist",title:r.t("ui.tool.todos")};case"question":return{icon:"bubble-5",title:r.t("ui.tool.questions")};case"skill":return{icon:"brain",title:t.name||r.t("ui.tool.skill")};default:return{icon:"mcp",title:e}}}function ML(e){if(!e)return[];const t=new Set;return[...e.matchAll(/https?:\/\/[^\s<>"'`)\]]+/g)].map(r=>r[0].replace(/[),.;:!?]+$/g,"")).filter(r=>t.has(r)?!1:(t.add(r),!0))}function R1(e,t,r){if(!e)return;const i=r?.(e);if(i)return i;const n=t.indexOf("/session");if(n!==-1)return`${t.slice(0,n)}/session/${e}`}const zL=new Set(["read","glob","grep","list"]),LL=new Set(["todowrite"]);function Ig(e,t){return Array.isArray(e)?e:t}function j1(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((r,i)=>r===t[i])}function Tg(e,t){return e.messageID===t.messageID&&e.partID===t.partID}function FL(e,t){return e===t?!0:e.key!==t.key||e.type!==t.type?!1:e.type==="part"?t.type!=="part"?!1:Tg(e.ref,t.ref):t.type!=="context"||e.refs.length!==t.refs.length?!1:e.refs.every((r,i)=>Tg(r,t.refs[i]))}function U1(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((r,i)=>FL(r,t[i]))}function K1(e){const t=[];let r=-1;const i=n=>{if(r<0)return;const o=e[r],s=e[n];if(!o||!s){r=-1;return}t.push({key:`context:${o.part.id}`,type:"context",refs:e.slice(r,n+1).map(a=>({messageID:a.messageID,partID:a.part.id}))}),r=-1};return e.forEach((n,o)=>{if(Yd(n.part)){r<0&&(r=o);return}i(o-1),t.push({key:`part:${n.messageID}:${n.part.id}`,type:"part",ref:{messageID:n.messageID,partID:n.part.id}})}),i(e.length-1),t}function rc(e){return new Map(e.map(t=>[t.id,t]))}function V1(e,t=!0){return e.type==="tool"?LL.has(e.tool)?!1:e.tool==="question"?e.state.status!=="pending"&&e.state.status!=="running":!0:e.type==="text"?!!e.text?.trim():e.type==="reasoning"?t&&!!e.text?.trim():!!hi[e.type]}function NL(e,t=!1,r=!1){if(e==="bash")return t;if(e==="edit"||e==="write"||e==="apply_patch")return r}function RL(e,t=!1,r=!1){if(e.type==="tool")return NL(e.tool,t,r)}function jL(e){const t=yr(),r=[],i=[],n=$(()=>rc(e.messages)),o=$(()=>new Map(e.messages.map(l=>[l.id,rc(Ig(t.store.part?.[l.id],r))]))),s=$(()=>K1(e.messages.flatMap(l=>Ig(t.store.part?.[l.id],r).filter(u=>V1(u,e.showReasoningSummaries??!0)).map(u=>({messageID:l.id,part:u})))),[],{equals:U1}),a=$(()=>s().at(-1)?.key);return c(Ur,{get each(){return s()},children:l=>{const u=$(()=>l().type);return c(Gt,{get children(){return[c(Xe,{get when(){return u()==="context"},get children(){return(()=>{const d=$(()=>{const m=l();return m.type!=="context"?i:m.refs.map(h=>o().get(h.messageID)?.get(h.partID)).filter(h=>!!h&&Yd(h))},i,{equals:j1}),f=$(()=>e.working&&a()===l().key);return c(F,{get when(){return d().length>0},get children(){return c(q1,{get parts(){return d()},get busy(){return f()}})}})})()}}),c(Xe,{get when(){return u()==="part"},get children(){return(()=>{const d=$(()=>{const m=l();if(m.type==="part")return n().get(m.ref.messageID)}),f=$(()=>{const m=l();if(m.type==="part")return o().get(m.ref.messageID)?.get(m.ref.partID)});return c(F,{get when(){return d()},get children(){return c(F,{get when(){return f()},get children(){return c(G1,{get part(){return f()},get message(){return d()},get showAssistantCopyPartID(){return e.showAssistantCopyPartID},get turnDurationMs(){return e.turnDurationMs},get defaultOpen(){return RL(f(),e.shellToolDefaultOpen,e.editToolDefaultOpen)}})}})}})})()}})]}})}})}function Yd(e){return e.type==="tool"&&zL.has(e.tool)}function UL(e){const t=N1(e.tool,e.state.input??{});if(t.subtitle)return t.subtitle;if(e.state.status==="error")return e.state.error;if((e.state.status==="running"||e.state.status==="completed")&&e.state.title)return e.state.title;const r=e.state.input?.description;if(typeof r=="string")return r}function KL(e,t){const r=e.state.input??{},i=typeof r.path=="string"?r.path:"/",n=typeof r.filePath=="string"?r.filePath:void 0,o=typeof r.pattern=="string"?r.pattern:void 0,s=typeof r.include=="string"?r.include:void 0,a=typeof r.offset=="number"?r.offset:void 0,l=typeof r.limit=="number"?r.limit:void 0;switch(e.tool){case"read":{const u=[];return a!==void 0&&u.push("offset="+a),l!==void 0&&u.push("limit="+l),{title:t.t("ui.tool.read"),subtitle:n?Qt(n):"",args:u}}case"list":return{title:t.t("ui.tool.list"),subtitle:Yn(i)};case"glob":return{title:t.t("ui.tool.glob"),subtitle:Yn(i),args:o?["pattern="+o]:[]};case"grep":{const u=[];return o&&u.push("pattern="+o),s&&u.push("include="+s),{title:t.t("ui.tool.grep"),subtitle:Yn(i),args:u}}default:{const u=N1(e.tool,r);return{title:u.title,subtitle:u.subtitle||UL(e),args:[]}}}}function VL(e){const t=e.filter(n=>n.tool==="read").length,r=e.filter(n=>n.tool==="glob"||n.tool==="grep").length,i=e.filter(n=>n.tool==="list").length;return{read:t,search:r,list:i}}function B1(e){const t=$(()=>ML(e.output));return c(F,{get when(){return t().length>0},get children(){var r=jz(),i=r.firstChild;return p(i,c(rt,{get each(){return t()},children:n=>(()=>{var o=Uz();return o.$$click=s=>s.stopPropagation(),Ie(o,"href",n),p(o,n),o})()})),r}})}function BL(e){if(e.length===0)return[];for(let r=e.length-1;r>=0;r--)if(e[r]?.role==="user")return e.slice(r);const t=e.at(-1);return t?[t]:[]}function ZL(e,t){return t?.type==="busy"?e.t("ui.toolCall.childSession.status.busy"):t?.type==="retry"?e.t("ui.toolCall.childSession.status.retry",{attempt:t.attempt}):e.t("ui.toolCall.childSession.status.idle")}function Z1(e){const t=yr(),r=yt(),i=[],[n,o]=We({loading:!1,failed:!1,requested:""}),s=$(()=>e.open??!0),a=$(()=>t.store.session.find(g=>g.id===e.sessionID)),l=$(()=>t.store.message[e.sessionID]),u=$(()=>l()??i),d=$(()=>BL(u())),f=$(()=>t.store.session_status[e.sessionID]),m=$(()=>ZL(r,f())),h=$(()=>!!a()||l()!==void 0);return ne(()=>{const g=e.sessionID;!g||!s()||t.ensureSessionLoaded&&(a()&&l()!==void 0||n.requested!==g&&(o("loading",!0),o("failed",!1),o("requested",g),Promise.resolve(t.ensureSessionLoaded(g)).catch(()=>{n.requested===g&&o("failed",!0)}).finally(()=>{n.requested===g&&o("loading",!1)})))}),(()=>{var g=Zz(),y=g.firstChild,b=y.firstChild,v=b.firstChild,w=v.nextSibling,x=b.nextSibling,_=x.firstChild;return p(v,()=>r.t("ui.toolCall.childSession")),p(w,()=>a()?.title??e.sessionID),p(_,m),p(x,c(F,{get when(){return e.href},get children(){var k=Kz();return k.$$click=C=>C.stopPropagation(),p(k,()=>r.t("ui.toolCall.childSession.open")),Ae(()=>Ie(k,"href",e.href)),k}}),null),p(g,c(F,{get when(){return Te(()=>!!n.loading)()&&!h()},get children(){var k=ks();return p(k,()=>r.t("ui.toolCall.childSession.loading")),k}}),null),p(g,c(F,{get when(){return Te(()=>!n.loading)()&&n.failed},get children(){var k=ks();return p(k,()=>r.t("ui.toolCall.childSession.loadFailed")),k}}),null),p(g,c(F,{get when(){return Te(()=>!n.loading&&!n.failed)()&&!h()},get children(){var k=ks();return p(k,()=>r.t("ui.toolCall.childSession.notFound")),k}}),null),p(g,c(F,{get when(){return Te(()=>!n.loading&&l()!==void 0)()&&u().length===0},get children(){var k=ks();return p(k,()=>r.t("ui.toolCall.childSession.empty")),k}}),null),p(g,c(F,{get when(){return d().length>0},get children(){return[(()=>{var k=Vz();return p(k,()=>r.t("ui.toolCall.childSession.latestTurn")),k})(),(()=>{var k=Bz();return p(k,c(rt,{get each(){return d()},children:C=>(()=>{var O=Hz();return p(O,c(H1,{message:C,get parts(){return t.store.part[C.id]??[]},showAssistantCopyPartID:null})),O})()})),k})()]}}),null),Ae(()=>Ie(_,"data-status",f()?.type??"idle")),g})()}function H1(e){return c(Gt,{get children(){return[c(Xe,{get when(){return Te(()=>e.message.role==="user")()&&e.message},children:t=>c(qL,{get message(){return t()},get parts(){return e.parts},get actions(){return e.actions}})}),c(Xe,{get when(){return Te(()=>e.message.role==="assistant")()&&e.message},children:t=>c(HL,{get message(){return t()},get parts(){return e.parts},get showAssistantCopyPartID(){return e.showAssistantCopyPartID},get showReasoningSummaries(){return e.showReasoningSummaries}})})]}})}function HL(e){const t=[],r=$(()=>rc(e.parts)),i=$(()=>K1(e.parts.filter(n=>V1(n,e.showReasoningSummaries??!0)).map(n=>({messageID:e.message.id,part:n}))),[],{equals:U1});return c(Ur,{get each(){return i()},children:n=>{const o=$(()=>n().type);return c(Gt,{get children(){return[c(Xe,{get when(){return o()==="context"},get children(){return(()=>{const s=$(()=>{const a=n();return a.type!=="context"?t:a.refs.map(l=>r().get(l.partID)).filter(l=>!!l&&Yd(l))},t,{equals:j1});return c(F,{get when(){return s().length>0},get children(){return c(q1,{get parts(){return s()}})}})})()}}),c(Xe,{get when(){return o()==="part"},get children(){return(()=>{const s=$(()=>{const a=n();if(a.type==="part")return r().get(a.ref.partID)});return c(F,{get when(){return s()},get children(){return c(G1,{get part(){return s()},get message(){return e.message},get showAssistantCopyPartID(){return e.showAssistantCopyPartID}})}})})()}})]}})}})}function q1(e){const t=yt(),[r,i]=ze(!1),n=$(()=>!!e.busy||e.parts.some(s=>s.state.status==="pending"||s.state.status==="running")),o=$(()=>VL(e.parts));return c(en,{get open(){return r()},onOpenChange:i,variant:"ghost",class:"tool-collapsible",get children(){return[c(en.Trigger,{get children(){var s=qz(),a=s.firstChild,l=a.firstChild,u=l.nextSibling;return p(l,c(Oz,{get active(){return n()},get activeText(){return t.t("ui.sessionTurn.status.gatheringContext")},get doneText(){return t.t("ui.sessionTurn.status.gatheredContext")},split:!1})),p(u,c(Cz,{get items(){return[{key:"read",count:o().read,one:t.t("ui.messagePart.context.read.one"),other:t.t("ui.messagePart.context.read.other")},{key:"search",count:o().search,one:t.t("ui.messagePart.context.search.one"),other:t.t("ui.messagePart.context.search.other")},{key:"list",count:o().list,one:t.t("ui.messagePart.context.list.one"),other:t.t("ui.messagePart.context.list.other")}]},fallback:""})),p(s,c(en.Arrow,{}),null),s}}),c(en.Content,{get children(){var s=Gz();return p(s,c(Ur,{get each(){return e.parts},children:a=>{const l=$(()=>KL(a(),t)),u=$(()=>a().state.status==="pending"||a().state.status==="running");return(()=>{var d=Wz(),f=d.firstChild,m=f.firstChild,h=m.firstChild,g=h.firstChild,y=g.firstChild,b=y.firstChild;return p(b,c(hn,{get text(){return l().title},get active(){return u()}})),p(y,c(F,{get when(){return Te(()=>!u())()&&l().subtitle},get children(){var v=T1();return p(v,()=>l().subtitle),v}}),null),p(y,c(F,{get when(){return Te(()=>!u())()&&l().args?.length},get children(){return c(rt,{get each(){return l().args},children:v=>(()=>{var w=Xz();return p(w,v),w})()})}}),null),d})()}})),s}})]}})}function qL(e){const t=yr(),r=br(),i=yt(),[n,o]=We({copied:!1,busy:!1}),s=()=>n.copied,a=()=>n.busy,l=$(()=>e.parts?.find(C=>C.type==="text"&&!C.synthetic)),u=$(()=>l()?.text||""),d=$(()=>e.parts?.filter(C=>C.type==="file")??[]),f=$(()=>d().filter(I1)),m=$(()=>d().filter(zz)),h=$(()=>e.parts?.filter(C=>C.type==="agent")??[]),g=$(()=>{const C=e.message.model?.providerID,O=e.message.model?.modelID;return!C||!O?"":t.store.provider?.all?.find(K=>K.id===C)?.models?.[O]?.name??O}),y=$(()=>new Intl.DateTimeFormat(i.locale(),{timeStyle:"short"})),b=$(()=>{const C=e.message.time?.created;return typeof C!="number"?"":y().format(C)}),v=$(()=>{const C=e.message.agent;return[C?C[0]?.toUpperCase()+C.slice(1):"",g()].filter(z=>!!z).join(" · ")}),w=b,x=(C,O)=>{r.show(()=>c(yz,{src:C,alt:O}))},_=async()=>{const C=u();C&&(await navigator.clipboard.writeText(C),o("copied",!0),setTimeout(()=>o("copied",!1),2e3))},k=()=>{const C=e.actions?.revert;!C||a()||(o("busy",!0),Promise.resolve().then(()=>C({sessionID:e.message.sessionID,messageID:e.message.id})).finally(()=>o("busy",!1)))};return(()=>{var C=iL();return p(C,c(F,{get when(){return f().length>0},get children(){var O=Yz();return p(O,c(rt,{get each(){return f()},children:z=>{const K=Lz(z),J=z.filename??i.t("ui.message.attachment.alt");return(()=>{var T=sL();return T.$$click=()=>{K==="image"&&x(z.url,J)},Ie(T,"data-type",K),Ie(T,"data-clickable",K==="image"?"true":void 0),Ie(T,"title",K==="file"?J:void 0),p(T,c(F,{when:K==="image",get fallback(){return(()=>{var M=aL(),U=M.firstChild;return p(M,c(Sn,{node:{path:J,type:"file"}}),U),p(U,J),M})()},get children(){var M=oL();return Ie(M,"alt",J),Ae(()=>Ie(M,"src",z.url)),M}})),T})()}})),O}}),null),p(C,c(F,{get when(){return u()},get children(){return[(()=>{var O=Jz(),z=O.firstChild;return p(z,c(GL,{get text(){return u()},get references(){return m()},get agents(){return h()}})),O})(),(()=>{var O=rL();return p(O,c(F,{get when(){return v()||w()},get children(){var z=nL();return p(z,c(F,{get when(){return v()},get children(){var K=Qz();return p(K,v),K}}),null),p(z,c(F,{get when(){return Te(()=>!!v())()&&w()},get children(){return eL()}}),null),p(z,c(F,{get when(){return w()},get children(){var K=tL();return p(K,w),K}}),null),z}}),null),p(O,c(F,{get when(){return e.actions?.revert},get children(){return c(Et,{get value(){return i.t("ui.message.revertMessage")},placement:"top",gutter:4,get children(){return c(Pt,{icon:"reset",size:"normal",variant:"ghost",get disabled(){return!!a()},onMouseDown:z=>z.preventDefault(),onClick:z=>{z.stopPropagation(),k()},get"aria-label"(){return i.t("ui.message.revertMessage")}})}})}}),null),p(O,c(Et,{get value(){return Te(()=>!!s())()?i.t("ui.message.copied"):i.t("ui.message.copyMessage")},placement:"top",gutter:4,get children(){return c(Pt,{get icon(){return s()?"check":"copy"},size:"normal",variant:"ghost",onMouseDown:z=>z.preventDefault(),onClick:z=>{z.stopPropagation(),_()},get"aria-label"(){return Te(()=>!!s())()?i.t("ui.message.copied"):i.t("ui.message.copyMessage")}})}}),null),O})()]}}),null),C})()}function GL(e){const t=$(()=>{const r=e.text,i=[...e.references.filter(s=>s.source?.text?.start!==void 0&&s.source?.text?.end!==void 0).map(s=>({start:s.source.text.start,end:s.source.text.end,type:"file"})),...e.agents.filter(s=>s.source?.start!==void 0&&s.source?.end!==void 0).map(s=>({start:s.source.start,end:s.source.end,type:"agent"}))].sort((s,a)=>s.start-a.start),n=[];let o=0;for(const s of i)s.start<o||(s.start>o&&n.push({text:r.slice(o,s.start)}),n.push({text:r.slice(s.start,s.end),type:s.type}),o=s.end);return o<r.length&&n.push({text:r.slice(o)}),n});return c(rt,{get each(){return t()},children:r=>(()=>{var i=lL();return p(i,()=>r.text),Ae(()=>Ie(i,"data-highlight",r.type)),i})()})}function G1(e){const t=$(()=>hi[e.part.type]);return c(F,{get when(){return t()},get children(){return c(Jn,{get component(){return t()},get part(){return e.part},get message(){return e.message},get hideDetails(){return e.hideDetails},get defaultOpen(){return e.defaultOpen},get showAssistantCopyPartID(){return e.showAssistantCopyPartID},get turnDurationMs(){return e.turnDurationMs}})}})}const W1={};function WL(e){return W1[e.name]=e,e}function XL(e){return W1[e]?.render}const _n={register:WL,render:XL};function Jd(e){const t=$(()=>e.path||"tool-file");return c(Kt,{multiple:!0,"data-scope":"apply-patch",style:{"--sticky-accordion-offset":"40px"},get defaultValue(){return[t()]},get children(){return c(Kt.Item,{get value(){return t()},get children(){return[c(Wo,{get children(){return c(Kt.Trigger,{get children(){var r=A1(),i=r.firstChild,n=i.firstChild,o=n.firstChild,s=i.nextSibling;return p(i,c(Sn,{get node(){return{path:e.path,type:"file"}}}),n),p(n,c(F,{get when(){return e.path.includes("/")},get children(){var a=D1();return p(a,()=>`‪${Yn(e.path)}‬`),a}}),o),p(o,()=>Qt(e.path)),p(s,()=>e.actions,null),p(s,c(bt,{name:"chevron-grabber-vertical",size:"small"}),null),r}})}}),c(Kt.Content,{get children(){return e.children}})]}})}})}hi.tool=function(t){const r=yr(),i=()=>t.part;if(i().tool==="todowrite")return null;const n=$(()=>i().tool==="question"&&(i().state.status==="pending"||i().state.status==="running")),o={},s={},a=()=>i().state?.input??o,l=()=>i().state?.metadata??s,u=$(()=>({...l(),...i().metadata??s})),d=$(()=>i().metadata?.liveOutput),f=$(()=>{const b=i().state;return b.status==="error"?b.error:void 0}),m=$(()=>{if(i().tool!=="task")return;const b=u().sessionId;if(typeof b=="string"&&b)return b}),h=$(()=>{if(i().tool==="task")return R1(m(),Sc().pathname,r.sessionHref)}),g=$(()=>{if(i().tool!=="task")return;const b=a().description;return typeof b=="string"&&b?b:m()}),y=$(()=>_n.render(i().tool)??lz);return c(F,{get when(){return!n()},get children(){var b=cL();return p(b,c(Gt,{get children(){return[c(Xe,{get when(){return Te(()=>i().state.status==="error")()&&i().state.error},children:v=>c(hz,{get tool(){return i().tool},get error(){return v()},get defaultOpen(){return t.defaultOpen},get subtitle(){return g()},get href(){return h()},get children(){return[c(sn,{get input(){return a()},get liveOutput(){return d()},omit:["error"]}),c(F,{get when(){return Te(()=>i().tool==="task")()&&m()},get children(){return c(Z1,{get sessionID(){return m()},get href(){return h()}})}})]}})}),c(Xe,{when:!0,get children(){return c(Jn,{get component(){return y()},get input(){return a()},get tool(){return i().tool},get metadata(){return u()},get output(){return i().state.output},get liveOutput(){return d()},get error(){return f()},get status(){return i().state.status},get hideDetails(){return t.hideDetails},get defaultOpen(){return t.defaultOpen}})}})]}})),b}})};function X1(e){return(()=>{var t=uL(),r=t.firstChild,i=r.firstChild,n=i.nextSibling;return p(n,()=>e.label),t})()}hi.compaction=function(){const t=yt();return c(X1,{get label(){return t.t("ui.messagePart.compaction")}})};hi.text=function(t){const r=yr(),i=yt(),n=$(()=>new Intl.NumberFormat(i.locale())),o=()=>t.part,s=$(()=>t.message.role==="assistant"&&t.message.error?.name==="MessageAbortedError"),a=$(()=>{if(t.message.role!=="assistant")return"";const v=t.message;return r.store.provider?.all?.find(x=>x.id===v.providerID)?.models?.[v.modelID]?.name??v.modelID}),l=$(()=>{if(t.message.role!=="assistant")return"";const v=t.message,w=v.time.completed,x=typeof t.turnDurationMs=="number"?t.turnDurationMs:typeof w=="number"?w-v.time.created:-1;if(!(x>=0))return"";const _=Math.round(x/1e3);if(_<60)return i.t("ui.message.duration.seconds",{count:n().format(_)});const k=Math.floor(_/60),C=_%60;return i.t("ui.message.duration.minutesSeconds",{minutes:n().format(k),seconds:n().format(C)})}),u=$(()=>{if(t.message.role!=="assistant")return"";const v=t.message.agent;return[v?v[0]?.toUpperCase()+v.slice(1):"",a(),l(),s()?i.t("ui.message.interrupted"):""].filter(x=>!!x).join(" · ")}),d=$(()=>t.message.role==="assistant"&&typeof t.message.time.completed!="number"),f=()=>(o().text??"").trim(),m=$(()=>(r.store.part?.[t.message.id]??[]).filter(w=>w?.type==="text"&&!!w.text?.trim()).at(-1)?.id===o().id),h=$(()=>t.message.role!=="assistant"?m():t.showAssistantCopyPartID===null?!1:typeof t.showAssistantCopyPartID=="string"?t.showAssistantCopyPartID===o().id:m()),[g,y]=ze(!1),b=async()=>{const v=f();v&&(await navigator.clipboard.writeText(v),y(!0),setTimeout(()=>y(!1),2e3))};return c(F,{get when(){return f()},get children(){var v=mL(),w=v.firstChild;return p(w,c(F,{get when(){return d()},get fallback(){return c(di,{get text(){return f()},get cacheKey(){return o().id},streaming:!1})},get children(){return c(z1,{get text(){return f()},get cacheKey(){return o().id},get streaming(){return d()}})}})),p(v,c(F,{get when(){return h()},get children(){var x=fL();return p(x,c(Et,{get value(){return Te(()=>!!g())()?i.t("ui.message.copied"):i.t("ui.message.copyResponse")},placement:"top",gutter:4,get children(){return c(Pt,{get icon(){return g()?"check":"copy"},size:"normal",variant:"ghost",onMouseDown:_=>_.preventDefault(),onClick:b,get"aria-label"(){return Te(()=>!!g())()?i.t("ui.message.copied"):i.t("ui.message.copyResponse")}})}}),null),p(x,c(F,{get when(){return u()},get children(){var _=dL();return p(_,u),_}}),null),Ae(()=>Ie(x,"data-interrupted",s()?"":void 0)),x}}),null),v}})};hi.reasoning=function(t){const r=yt(),i=()=>t.part,[n,o]=ze(!1),s=$(()=>t.message.role==="assistant"&&typeof t.message.time.completed!="number"),a=()=>i().text.trim(),l=$(()=>Mz({text:a(),fallback:r.t("ui.sessionTurn.status.thinking"),withTopic:u=>r.t("ui.sessionTurn.status.thinkingWithTopic",{topic:u})}));return c(F,{get when(){return a()},get children(){return c(en,{get open(){return n()},onOpenChange:o,variant:"ghost",class:"tool-collapsible reasoning-collapsible",get children(){return[c(en.Trigger,{get children(){var u=gL(),d=u.firstChild,f=d.nextSibling,m=f.firstChild;return p(d,c(hn,{get text(){return l()},get active(){return s()}})),p(m,()=>r.t(n()?"ui.sessionTurn.steps.hide":"ui.sessionTurn.steps.show")),p(f,c(en.Arrow,{}),null),u}}),c(en.Content,{get children(){var u=hL();return p(u,c(F,{get when(){return s()},get fallback(){return c(di,{get text(){return a()},get cacheKey(){return i().id},streaming:!1})},get children(){return c(z1,{get text(){return a()},get cacheKey(){return i().id},get streaming(){return s()}})}})),u}})]}})}})};_n.register({name:"read",render(e){const t=yr(),r=yt(),i=[];e.input.offset&&i.push("offset="+e.input.offset),e.input.limit&&i.push("limit="+e.input.limit);const n=$(()=>{if(e.status!=="completed")return[];const o=e.metadata.loaded;return!o||!Array.isArray(o)?[]:o.filter(s=>typeof s=="string")});return[c(un,ie(e,{icon:"glasses",allowPendingToggle:!0,get trigger(){return{title:r.t("ui.tool.read"),subtitle:e.input.filePath?Qt(e.input.filePath):"",args:i}},get children(){return c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})}})),c(rt,{get each(){return n()},children:o=>(()=>{var s=pL(),a=s.firstChild,l=a.firstChild;return p(s,c(bt,{name:"enter",size:"small"}),a),p(a,()=>r.t("ui.tool.loaded"),l),p(a,()=>L1(o,t.directory),null),s})()})]}});_n.register({name:"list",render(e){const t=yt();return c(un,ie(e,{icon:"bullet-list",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.list"),subtitle:Yn(e.input.path||"/")}},get children(){return[c(F,{get when(){return e.output},get children(){var r=Gd();return p(r,c(di,{get text(){return e.output}})),r}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"glob",render(e){const t=yt();return c(un,ie(e,{icon:"magnifying-glass-menu",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.glob"),subtitle:Yn(e.input.path||"/"),args:e.input.pattern?["pattern="+e.input.pattern]:[]}},get children(){return[c(F,{get when(){return e.output},get children(){var r=Gd();return p(r,c(di,{get text(){return e.output}})),r}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"grep",render(e){const t=yt(),r=[];return e.input.pattern&&r.push("pattern="+e.input.pattern),e.input.include&&r.push("include="+e.input.include),c(un,ie(e,{icon:"magnifying-glass-menu",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.grep"),subtitle:Yn(e.input.path||"/"),args:r}},get children(){return[c(F,{get when(){return e.output},get children(){var i=Gd();return p(i,c(di,{get text(){return e.output}})),i}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"websearch",render(e){const t=yt(),r=$(()=>{const i=e.input.query;return typeof i!="string"?"":i});return c(un,ie(e,{icon:"window-cursor",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.websearch"),subtitle:r(),subtitleClass:"exa-tool-query"}},get children(){return[c(B1,{get output(){return e.output}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"codesearch",render(e){const t=yt(),r=$(()=>{const i=e.input.query;return typeof i!="string"?"":i});return c(un,ie(e,{icon:"code",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.codesearch"),subtitle:r(),subtitleClass:"exa-tool-query"}},get children(){return[c(B1,{get output(){return e.output}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"task",render(e){const t=yr(),r=yt(),i=Sc(),[n,o]=ze(e.defaultOpen??!1),s=()=>e.metadata.sessionId,a=$(()=>{const g=e.input.subagent_type;if(!(typeof g!="string"||!g))return g[0].toUpperCase()+g.slice(1)}),l=$(()=>F1(r,a())),u=$(()=>{const g=e.input.description;return typeof g=="string"&&g?g:s()}),d=$(()=>e.status==="pending"||e.status==="running"),f=$(()=>R1(s(),i.pathname,t.sessionHref)),m=()=>c(hn,{get text(){return l()},get active(){return d()}}),h=()=>(()=>{var g=P1(),y=g.firstChild,b=y.firstChild;return p(b,m),p(y,c(F,{get when(){return u()},get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return f()},get children(){var v=vL();return v.$$click=w=>w.stopPropagation(),p(v,u),Ae(()=>Ie(v,"href",f())),v}}),c(Xe,{when:!0,get children(){var v=T1();return p(v,u),v}})]}})}}),null),g})();return c(un,{icon:"task",get status(){return e.status},get trigger(){return h()},get hideDetails(){return e.hideDetails},get defaultOpen(){return e.defaultOpen},allowPendingToggle:!0,onOpenChange:o,get children(){return[c(F,{get when(){return s()},get children(){return c(Z1,{get sessionID(){return s()},get href(){return f()},get open(){return n()}})}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}})}});_n.register({name:"bash",render(e){const t=yt(),r=()=>e.status==="pending"||e.status==="running",i=r(),n=$(()=>{const l=e.input.command??e.metadata.command??"",u=k1(String(e.liveOutput??e.output??e.metadata.output??""));return`$ ${l}${u?`
68
68
 
69
- `+u:""}`}),[o,s]=ze(!1),a=async()=>{const l=n();l&&(await navigator.clipboard.writeText(l),s(!0),setTimeout(()=>s(!1),2e3))};return c(un,ie(e,{icon:"console",allowPendingToggle:!0,get trigger(){return(()=>{var l=yL(),u=l.firstChild,d=u.firstChild;return p(d,c(hn,{get text(){return t.t("ui.tool.shell")},get active(){return r()}})),p(u,c(F,{get when(){return Te(()=>!r())()&&e.input.description},get children(){return c(DL,{get text(){return e.input.description},animate:i})}}),null),l})()},get children(){return[(()=>{var l=bL(),u=l.firstChild,d=u.nextSibling,f=d.firstChild,m=f.firstChild;return p(u,c(Et,{get value(){return Te(()=>!!o())()?t.t("ui.message.copied"):t.t("ui.message.copy")},placement:"top",gutter:4,get children(){return c(Pt,{get icon(){return o()?"check":"copy"},size:"small",variant:"secondary",onMouseDown:h=>h.preventDefault(),onClick:a,get"aria-label"(){return Te(()=>!!o())()?t.t("ui.message.copied"):t.t("ui.message.copy")}})}})),p(m,n),l})(),c(sn,{get input(){return e.input}})]}}))}});_n.register({name:"edit",render(e){const t=yt(),r=Ki(),i=$(()=>E1(e.metadata.diagnostics,e.input.filePath)),n=$(()=>e.metadata?.filediff?.file||e.input.filePath||""),o=()=>Qt(e.input.filePath??""),s=()=>e.status==="pending"||e.status==="running";return(()=>{var a=xL();return p(a,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return(()=>{var l=O1(),u=l.firstChild,d=u.firstChild,f=d.firstChild,m=u.nextSibling;return p(f,c(hn,{get text(){return t.t("ui.messagePart.title.edit")},get active(){return s()}})),p(d,c(F,{get when(){return!s()},get children(){var h=Wd();return p(h,o),h}}),null),p(u,c(F,{get when(){return Te(()=>!s())()&&e.input.filePath?.includes("/")},get children(){var h=Xd(),g=h.firstChild;return p(g,()=>Yn(e.input.filePath)),h}}),null),p(m,c(F,{get when(){return Te(()=>!s())()&&e.metadata.filediff},get children(){return c(pr,{get changes(){return e.metadata.filediff}})}})),l})()},get children(){return[c(F,{get when(){return n()},get children(){return c(Jd,{get path(){return n()},get actions(){return c(F,{get when(){return Te(()=>!s())()&&e.metadata.filediff},get children(){return c(pr,{get changes(){return e.metadata.filediff}})}})},get children(){var l=wL();return p(l,c(Jn,{component:r,mode:"diff",get before(){return{name:e.metadata?.filediff?.file||e.input.filePath,contents:e.metadata?.filediff?.before||e.input.oldString}},get after(){return{name:e.metadata?.filediff?.file||e.input.filePath,contents:e.metadata?.filediff?.after||e.input.newString}}})),l}})}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}}),c(M1,{get diagnostics(){return i()}})]}}))),a})()}});_n.register({name:"write",render(e){const t=yt(),r=Ki(),i=$(()=>E1(e.metadata.diagnostics,e.input.filePath)),n=$(()=>e.input.filePath||""),o=()=>Qt(e.input.filePath??""),s=()=>e.status==="pending"||e.status==="running";return(()=>{var a=$L();return p(a,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return(()=>{var l=SL(),u=l.firstChild,d=u.firstChild,f=d.firstChild;return p(f,c(hn,{get text(){return t.t("ui.messagePart.title.write")},get active(){return s()}})),p(d,c(F,{get when(){return!s()},get children(){var m=Wd();return p(m,o),m}}),null),p(u,c(F,{get when(){return Te(()=>!s())()&&e.input.filePath?.includes("/")},get children(){var m=Xd(),h=m.firstChild;return p(h,()=>Yn(e.input.filePath)),m}}),null),l})()},get children(){return[c(F,{get when(){return Te(()=>!!e.input.content)()&&n()},get children(){return c(Jd,{get path(){return n()},get children(){var l=_L();return p(l,c(Jn,{component:r,mode:"text",get file(){return{name:e.input.filePath,contents:e.input.content,cacheKey:Ci(e.input.content)}},overflow:"scroll"})),l}})}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}}),c(M1,{get diagnostics(){return i()}})]}}))),a})()}});_n.register({name:"apply_patch",render(e){const t=yt(),r=Ki(),i=$(()=>e.metadata.files??[]),n=$(()=>e.status==="pending"||e.status==="running"),o=$(()=>{const d=i();if(d.length===1)return d[0]}),[s,a]=ze([]);let l=!1;ne(()=>{const d=i();d.length!==0&&(l||(l=!0,a(d.filter(f=>f.type!=="delete").map(f=>f.filePath))))});const u=$(()=>{const d=i().length;return d===0?"":`${d} ${t.t(d>1?"ui.common.file.other":"ui.common.file.one")}`});return c(F,{get when(){return o()},get fallback(){return(()=>{var d=_g();return p(d,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.patch"),subtitle:u()}},get children(){return[c(F,{get when(){return i().length>0},get children(){return c(Kt,{multiple:!0,"data-scope":"apply-patch",style:{"--sticky-accordion-offset":"40px"},get value(){return s()},onChange:f=>a(Array.isArray(f)?f:f?[f]:[]),get children(){return c(rt,{get each(){return i()},children:f=>{const m=$(()=>s().includes(f.filePath)),[h,g]=ze(!1);return ne(()=>{if(!m()){g(!1);return}requestAnimationFrame(()=>{m()&&g(!0)})}),c(Kt.Item,{get value(){return f.filePath},get"data-type"(){return f.type},get children(){return[c(Wo,{get children(){return c(Kt.Trigger,{get children(){var y=A1(),b=y.firstChild,v=b.firstChild,w=v.firstChild,x=b.nextSibling;return p(b,c(Sn,{get node(){return{path:f.relativePath,type:"file"}}}),v),p(v,c(F,{get when(){return f.relativePath.includes("/")},get children(){var _=D1();return p(_,()=>`‪${Yn(f.relativePath)}‬`),_}}),w),p(w,()=>Qt(f.relativePath)),p(x,c(Gt,{get children(){return[c(Xe,{get when(){return f.type==="add"},get children(){var _=$g();return p(_,()=>t.t("ui.patch.action.created")),_}}),c(Xe,{get when(){return f.type==="delete"},get children(){var _=Sg();return p(_,()=>t.t("ui.patch.action.deleted")),_}}),c(Xe,{get when(){return f.type==="move"},get children(){var _=kg();return p(_,()=>t.t("ui.patch.action.moved")),_}}),c(Xe,{when:!0,get children(){return c(pr,{get changes(){return{additions:f.additions,deletions:f.deletions}}})}})]}}),null),p(x,c(bt,{name:"chevron-grabber-vertical",size:"small"}),null),y}})}}),c(Kt.Content,{get children(){return c(F,{get when(){return h()},get children(){var y=xg();return p(y,c(Jn,{component:r,mode:"diff",get before(){return{name:f.filePath,contents:f.before}},get after(){return{name:f.movePath??f.filePath,contents:f.after}}})),y}})}})]}})}})}})}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))),d})()},get children(){var d=_g();return p(d,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return(()=>{var f=O1(),m=f.firstChild,h=m.firstChild,g=h.firstChild,y=m.nextSibling;return p(g,c(hn,{get text(){return t.t("ui.tool.patch")},get active(){return n()}})),p(h,c(F,{get when(){return!n()},get children(){var b=Wd();return p(b,()=>Qt(o().relativePath)),b}}),null),p(m,c(F,{get when(){return Te(()=>!n())()&&o().relativePath.includes("/")},get children(){var b=Xd(),v=b.firstChild;return p(v,()=>Yn(o().relativePath)),b}}),null),p(y,c(F,{get when(){return!n()},get children(){return c(pr,{get changes(){return{additions:o().additions,deletions:o().deletions}}})}})),f})()},get children(){return[c(Jd,{get path(){return o().relativePath},get actions(){return c(Gt,{get children(){return[c(Xe,{get when(){return o().type==="add"},get children(){var f=$g();return p(f,()=>t.t("ui.patch.action.created")),f}}),c(Xe,{get when(){return o().type==="delete"},get children(){var f=Sg();return p(f,()=>t.t("ui.patch.action.deleted")),f}}),c(Xe,{get when(){return o().type==="move"},get children(){var f=kg();return p(f,()=>t.t("ui.patch.action.moved")),f}}),c(Xe,{when:!0,get children(){return c(pr,{get changes(){return{additions:o().additions,deletions:o().deletions}}})}})]}})},get children(){var f=xg();return p(f,c(Jn,{component:r,mode:"diff",get before(){return{name:o().filePath,contents:o().before}},get after(){return{name:o().movePath??o().filePath,contents:o().after}}})),f}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))),d}})}});_n.register({name:"todowrite",render(e){const t=yt(),r=$(()=>{const n=e.metadata?.todos;if(Array.isArray(n))return n;const o=e.input.todos;return Array.isArray(o)?o:[]}),i=$(()=>{const n=r();return n.length===0?"":`${n.filter(o=>o.status==="completed").length}/${n.length}`});return c(un,ie(e,{defaultOpen:!0,icon:"checklist",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.todos"),subtitle:i()}},get children(){return[c(F,{get when(){return r().length},get children(){var n=kL();return p(n,c(rt,{get each(){return r()},children:o=>c(_1,{readOnly:!0,get checked(){return o.status==="completed"},get children(){var s=CL();return p(s,()=>o.content),Ae(()=>Ie(s,"data-completed",o.status==="completed"?"completed":void 0)),s}})})),n}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"question",render(e){const t=yt(),r=$(()=>e.input.questions??[]),i=$(()=>e.metadata.answers??[]),n=$(()=>i().length>0),o=$(()=>{const s=r().length;return s===0?"":n()?t.t("ui.question.subtitle.answered",{count:s}):`${s} ${t.t(s>1?"ui.common.question.other":"ui.common.question.one")}`});return c(un,ie(e,{icon:"bubble-5",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.questions"),subtitle:o()}},get children(){return[c(F,{get when(){return n()},get children(){var s=IL();return p(s,c(rt,{get each(){return r()},children:(a,l)=>{const u=()=>i()[l()]??[];return(()=>{var d=TL(),f=d.firstChild,m=f.nextSibling;return p(f,()=>a.question),p(m,()=>u().join(", ")||t.t("ui.question.answer.none")),d})()}})),s}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"skill",render(e){const t=yt(),r=$(()=>e.input.name||t.t("ui.tool.skill")),i=$(()=>e.status==="pending"||e.status==="running"),n=()=>c(hn,{get text(){return r()},get active(){return i()}}),o=()=>(()=>{var s=P1(),a=s.firstChild,l=a.firstChild;return p(l,n),s})();return c(un,{icon:"brain",get status(){return e.status},get trigger(){return o()},get hideDetails(){return e.hideDetails},get defaultOpen(){return e.defaultOpen},allowPendingToggle:!0,get children(){return c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})}})}});Ot(["click"]);var YL=I('<div data-slot=session-turn-retry-message class="cursor-help truncate">'),JL=I('<div class="flex items-start gap-2"><div class=min-w-0>'),QL=I("<div data-slot=session-turn-retry>"),eF=I("<div data-slot=session-turn-retry-message>"),tF=I("<div data-slot=session-turn-retry-info>");function nF(e){const t=_t(),r=$(()=>{if(e.status.type==="retry")return e.status}),[i,n]=ze(0);ne(qe(r,l=>{if(!l)return;const u=()=>{const f=r()?.next;f&&n(Math.round((f-Date.now())/1e3))};u();const d=setInterval(u,1e3);je(()=>clearInterval(d))}));const o=$(()=>{const l=r();return l?l.message.length>80?l.message.slice(0,80)+"...":l.message:""}),s=$(()=>{const l=r();return l?l.message.length>80:!1}),a=$(()=>{const l=r();if(!l)return"";const u=Math.max(0,i()),d=u>0?t.t("ui.sessionTurn.retry.inSeconds",{seconds:u}):"",m=[t.t("ui.sessionTurn.retry.retrying"),d].filter(Boolean).join(" ");return m?t.t("ui.sessionTurn.retry.attemptLine",{line:m,attempt:l.attempt}):t.t("ui.sessionTurn.retry.attempt",{attempt:l.attempt})});return c(F,{get when(){return Te(()=>!!r())()&&(e.show??!0)},get children(){var l=QL();return p(l,c(qd,{variant:"error",class:"error-card",get children(){var u=JL(),d=u.firstChild;return p(u,c(Ap,{class:"size-4 mt-0.5"}),d),p(d,c(F,{get when(){return s()},get fallback(){return(()=>{var f=eF();return p(f,o),f})()},get children(){return c(Et,{get value(){return r()?.message??""},placement:"top",get children(){var f=YL();return p(f,o),f}})}}),null),p(d,c(F,{get when(){return a()},children:f=>(()=>{var m=tF();return p(m,f),m})()}),null),u}})),l}})}var rF=I("<div data-slot=session-turn-compaction>"),iF=I("<div data-slot=session-turn-assistant-content>"),oF=I("<div data-slot=session-turn-thinking>"),sF=I("<span data-slot=session-turn-diffs-toggle>"),aF=I("<div data-slot=session-turn-diffs-more>"),lF=I("<div data-slot=session-turn-diffs data-component=session-turn-diffs-group><div data-slot=session-turn-diffs-header><span data-slot=session-turn-diffs-label> <!> </span></div><div data-component=session-turn-diffs-content>"),cF=I("<div data-slot=session-turn-message-container><div data-slot=session-turn-message-content aria-live=off>"),uF=I("<div data-component=session-turn><div data-slot=session-turn-content><div>"),dF=I("<span data-slot=session-turn-diff-directory>"),fF=I("<div data-slot=session-turn-diff-trigger><span data-slot=session-turn-diff-path><span data-slot=session-turn-diff-filename></span></span><div data-slot=session-turn-diff-meta><span data-slot=session-turn-diff-changes></span><span data-slot=session-turn-diff-chevron>"),mF=I("<div data-slot=session-turn-diff-view data-scrollable>");function Dg(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ag(e){const t=e.replace(/^Error:\s*/,"").trim(),r=l=>{try{return JSON.parse(l)}catch{return}},i=l=>{const u=r(l);return typeof u!="string"?u:r(u.trim())};let n=i(t);if(n===void 0){const l=t.indexOf("{"),u=t.lastIndexOf("}");l!==-1&&u>l&&(n=i(t.slice(l,u+1)))}if(!Dg(n))return e;const o=Dg(n.error)?n.error:void 0;if(o){const l=typeof o.type=="string"?o.type:void 0,u=typeof o.message=="string"?o.message:void 0;if(l&&u)return`${l}: ${u}`;if(u)return u;if(l)return l;const d=typeof o.code=="string"?o.code:void 0;if(d)return d}const s=typeof n.message=="string"?n.message:void 0;if(s)return s;const a=typeof n.error=="string"?n.error:void 0;return a||e}function gF(e,t){return e===t?!0:e.length!==t.length?!1:e.every((r,i)=>r===t[i])}function Cs(e,t){return Array.isArray(e)?e:t}const hF=new Set(["todowrite"]);function pF(e,t){if(e.type==="tool")return hF.has(e.tool)||e.tool==="question"&&(e.state.status==="pending"||e.state.status==="running")?void 0:"visible";if(e.type==="text")return e.text?.trim()?"visible":void 0;if(e.type==="reasoning")return t&&e.text?.trim()?"visible":void 0;if(hi[e.type])return"visible"}function vF(e){const t=yr(),r=_t(),i=Ki(),n=[],o=[],s=[],a=[],l={type:"idle"},u=$(()=>e.messages??Cs(t.store.message?.[e.sessionID],n)),d=$(()=>{const H=u()??n,Z=Ms.search(H,e.messageID,fe=>fe.id),se=Z.found?Z.index:H.findIndex(fe=>fe.id===e.messageID);if(se<0)return-1;const re=H[se];return!re||re.role!=="user"?-1:se}),f=$(()=>{const H=d();if(H<0)return;const se=(u()??n)[H];if(!(!se||se.role!=="user"))return se}),m=$(()=>typeof e.active=="boolean"?void 0:(u()??n).findLast(Z=>Z.role==="assistant"&&typeof Z.time.completed!="number")),h=$(()=>{const H=m();if(!H?.parentID)return;const Z=u()??n,se=Ms.search(Z,H.parentID,fe=>fe.id),re=se.found?Z[se.index]:Z.find(fe=>fe.id===H.parentID);if(!(!re||re.role!=="user"))return re}),g=$(()=>{if(typeof e.active=="boolean")return e.active;const H=f(),Z=h();return!H||!Z?!1:Z.id===H.id}),y=$(()=>{const H=f();return H?Cs(t.store.part?.[H.id],o):o}),b=$(()=>y().find(H=>H.type==="compaction")),v=$(()=>{const H=f()?.summary?.diffs;if(!H?.length)return a;const Z=new Set;return H.reduceRight((se,re)=>(Z.has(re.file)||(Z.add(re.file),se.push(re)),se),[]).reverse()}),w=10,x=$(()=>v().length),[_,k]=We({showAll:!1,expanded:[]}),C=()=>_.showAll,O=()=>_.expanded,z=$(()=>Math.max(0,x()-w)),K=$(()=>C()?v():v().slice(0,w)),J=()=>{te.pause(),k("showAll",!C())},T=$(()=>{const H=f();if(!H)return s;const Z=u()??n,se=d();if(se<0)return s;const re=[];for(let fe=se+1;fe<Z.length;fe++){const Se=Z[fe];if(Se){if(Se.role==="user")break;Se.role==="assistant"&&Se.parentID===H.id&&re.push(Se)}}return re},s,{equals:gF}),M=$(()=>T().some(H=>H.error?.name==="MessageAbortedError")),U=$(()=>b()?r.t("ui.messagePart.compaction"):M()?r.t("ui.message.interrupted"):""),A=$(()=>T().find(H=>H.error&&H.error.name!=="MessageAbortedError")?.error),j=$(()=>{const H=T();for(let Z=H.length-1;Z>=0;Z--){const se=H[Z];if(!se)continue;const re=Cs(t.store.part?.[se.id],o);for(let fe=re.length-1;fe>=0;fe--){const Se=re[fe];if(!(!Se||Se.type!=="text"||!Se.text?.trim()))return Se.id}}}),P=$(()=>{const H=A()?.data?.message;return typeof H=="string"?Ag(H):H==null?"":Ag(String(H))}),B=$(()=>e.status!==void 0?e.status:typeof e.active=="boolean"&&!e.active?l:t.store.session_status[e.sessionID]??l),R=$(()=>B().type!=="idle"&&g()),V=$(()=>e.showReasoningSummaries??!0),Q=$(()=>R()?null:j()??null),ee=$(()=>{const H=f()?.time.created;if(typeof H!="number")return;const Z=T().reduce((se,re)=>{const fe=re.time.completed;return typeof fe!="number"?se:se===void 0?fe:Math.max(se,fe)},void 0);if(typeof Z=="number"&&!(Z<H))return Z-H}),oe=$(()=>{let H=0,Z;const se=V();for(const re of T())for(const fe of Cs(t.store.part?.[re.id],o))if(pF(fe,se)==="visible"&&H++,fe.type==="reasoning"&&fe.text){const Se=C1(fe.text);Se&&(Z=Se)}return{visible:H,reason:Z}}),le=$(()=>oe().visible),W=$(()=>oe().reason),D=$(()=>!R()||A()||B().type==="retry"?!1:V()?le()===0:!0),te=np({working:R,onUserInteracted:e.onUserInteracted,overflowAnchor:"dynamic"});return(()=>{var H=uF(),Z=H.firstChild,se=Z.firstChild;pt(Z,"scroll",te.handleScroll);var re=te.scrollRef;return typeof re=="function"?ut(re,Z):te.scrollRef=Z,pt(se,"click",te.handleInteraction,!0),p(se,c(F,{get when(){return f()},get children(){var fe=cF(),Se=fe.firstChild,Ne=te.contentRef;return typeof Ne=="function"?ut(Ne,fe):te.contentRef=fe,p(Se,c(H1,{get message(){return f()},get parts(){return y()},get actions(){return e.actions}})),p(fe,c(F,{get when(){return U()},get children(){var ce=rF();return p(ce,c(X1,{get label(){return U()}})),ce}}),null),p(fe,c(F,{get when(){return T().length>0},get children(){var ce=iF();return p(ce,c(jL,{get messages(){return T()},get showAssistantCopyPartID(){return Q()},get turnDurationMs(){return ee()},get working(){return R()},get showReasoningSummaries(){return V()},get shellToolDefaultOpen(){return e.shellToolDefaultOpen},get editToolDefaultOpen(){return e.editToolDefaultOpen}})),Ae(()=>Ie(ce,"aria-hidden",R())),ce}}),null),p(fe,c(F,{get when(){return D()},get children(){var ce=oF();return p(ce,c(hn,{get text(){return r.t("ui.sessionTurn.status.thinking")}}),null),p(ce,c(F,{get when(){return!V()},get children(){return c($1,{get text(){return W()},class:"session-turn-thinking-heading",travel:25,duration:700})}}),null),ce}}),null),p(fe,c(nF,{get status(){return B()},get show(){return g()}}),null),p(fe,c(F,{get when(){return Te(()=>x()>0)()&&!R()},get children(){var ce=lF(),ye=ce.firstChild,G=ye.firstChild,we=G.firstChild,ke=we.nextSibling;ke.nextSibling;var ue=ye.nextSibling;return p(G,x,we),p(G,()=>r.t("ui.sessionTurn.diffs.changed"),ke),p(G,()=>r.t(x()===1?"ui.common.file.one":"ui.common.file.other"),null),p(ye,c(pr,{get changes(){return v()}}),null),p(ye,c(F,{get when(){return z()>0},get children(){var me=sF();return me.$$click=J,p(me,(()=>{var Ue=Te(()=>!!C());return()=>Ue()?r.t("ui.sessionTurn.diffs.showLess"):r.t("ui.sessionTurn.diffs.showAll")})()),me}}),null),p(ue,c(Kt,{multiple:!0,style:{"--sticky-accordion-offset":"40px"},get value(){return O()},onChange:me=>k("expanded",Array.isArray(me)?me:me?[me]:[]),get children(){return c(rt,{get each(){return K()},children:me=>{const Ue=$(()=>O().includes(me.file)),[be,Be]=ze(!1);return ne(qe(Ue,E=>{if(!E){Be(!1);return}requestAnimationFrame(()=>{Ue()&&Be(!0)})},{defer:!0})),c(Kt.Item,{get value(){return me.file},get children(){return[c(Wo,{get children(){return c(Kt.Trigger,{get children(){var E=fF(),ae=E.firstChild,de=ae.firstChild,Ee=ae.nextSibling,Re=Ee.firstChild,ot=Re.nextSibling;return p(ae,c(F,{get when(){return me.file.includes("/")},get children(){var Pe=dF();return p(Pe,()=>`‪${Ri(me.file)}‬`),Pe}}),de),p(de,()=>Qt(me.file)),p(Re,c(pr,{changes:me})),p(ot,c(bt,{name:"chevron-down",size:"small"})),E}})}}),c(Kt.Content,{get children(){return c(F,{get when(){return be()},get children(){var E=mF();return p(E,c(Jn,{component:i,mode:"diff",get before(){return{name:me.file,contents:me.before}},get after(){return{name:me.file,contents:me.after}}})),E}})}})]}})}})}}),null),p(ue,c(F,{get when(){return Te(()=>!C())()&&z()>0},get children(){var me=aF();return me.$$click=J,p(me,()=>r.t("ui.sessionTurn.diffs.more",{count:String(z())})),me}}),null),Ae(()=>Ie(ce,"data-show-all",C()||void 0)),ce}}),null),p(fe,c(F,{get when(){return A()},get children(){return c(qd,{variant:"error",class:"error-card",get children(){return P()}})}}),null),Ae(ce=>{var ye=f().id,G=e.classes?.container;return ye!==ce.e&&Ie(fe,"data-message",ce.e=ye),G!==ce.t&&Jt(fe,ce.t=G),ce},{e:void 0,t:void 0}),fe}}),null),p(se,()=>e.children,null),Ae(fe=>{var Se=e.classes?.root,Ne=e.classes?.content;return Se!==fe.e&&Jt(H,fe.e=Se),Ne!==fe.t&&Jt(Z,fe.t=Ne),fe},{e:void 0,t:void 0}),H})()}Ot(["click"]);var bF=I('<div class="flex flex-col gap-4 pl-6 pr-2.5 pb-3"><div class="flex flex-col gap-1"><span class="text-14-regular text-text-strong"></span></div><div class="flex justify-end gap-2">'),yF=I('<div class="w-full flex justify-center">'),wF=I('<div class="min-w-0 w-full"><div role=log data-slot=session-turn-list class="flex flex-col items-start justify-start transition-[margin,padding] duration-200 ease-out">'),xF=I('<div class="relative w-full h-full min-w-0"><div class="absolute left-1/2 -translate-x-1/2 bottom-6 z-[60] pointer-events-none transition-all duration-200 ease-out"><button class="pointer-events-auto size-8 flex items-center justify-center rounded-full bg-background-base border border-border-base shadow-sm text-text-base hover:bg-background-stronger transition-colors">'),_F=I('<div class="relative h-full overflow-hidden">'),$F=I('<div class="pointer-events-auto flex min-w-0 w-full items-center justify-center gap-2 px-2">'),SF=I('<h1 data-action=session-title-heading class="text-14-medium text-text-strong truncate min-w-0 w-full text-center">'),kF=I('<div class="flex flex-col gap-2"><div class="grid grid-cols-2 gap-2">'),CF=I('<div class="flex flex-col p-3"><div class="flex flex-col gap-1"><div class="text-13-medium text-text-strong"></div><div class="text-12-regular text-text-weak"></div></div><div class="mt-3 flex flex-col gap-2">'),IF=I('<div class="pointer-events-auto flex shrink-0 items-center gap-2"><div class="hidden sm:flex">'),TF=I('<div class="w-full px-4 md:px-5 pb-2"><div class="ml-auto max-w-[82%] overflow-x-auto no-scrollbar"><div class="flex w-max min-w-full justify-end gap-2">'),DF=I("<div>"),AF=I('<div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2"><div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong"><span class=truncate></span></div><div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words">'),PF=I('<span class="shrink-0 text-text-weak">'),Pg=I('<div data-component=session-inline-question class="w-full px-4 md:px-5 pt-3">');const Og=[],Eg={type:"idle"},OF=e=>e.flatMap(t=>{if(t.type!=="text"||!t.synthetic)return[];const r=SA(t.metadata)??CA(t.text);return r?[{path:r.path,comment:r.comment,selection:r.selection?{startLine:r.selection.startLine,endLine:r.selection.endLine}:void 0}]:[]}),EF=(e,t)=>{const i=(t instanceof Element?t:void 0)?.closest("[data-scrollable]");return!i||i===e||!(i instanceof HTMLElement)?e:i},Mg=e=>{const t=EF(e.root,e.target);if(t===e.root){e.onMarkScrollGesture(e.root);return}QM({delta:e.delta,scrollTop:t.scrollTop,scrollHeight:t.scrollHeight,clientHeight:t.clientHeight})&&e.onMarkScrollGesture(e.root)};function MF(e){const[t,r]=We({activeSession:"",completedSession:"",count:0}),i=$(()=>{const l=e.messages().length;if(e.turnStart()<=0||t.completedSession===e.sessionKey())return l;const u=Math.min(l,e.config.init);return t.count<=u?u:t.count>=l?l:t.count}),n=$(()=>{const l=e.messages(),u=i();return u>=l.length?l:l.slice(Math.max(0,l.length-u))});let o;const s=()=>{o!==void 0&&(cancelAnimationFrame(o),o=void 0)};ne(qe(()=>[e.sessionKey(),e.turnStart()>0,e.messages().length],([l,u,d])=>{if(s(),!(u&&d>e.config.init&&t.completedSession!==l&&t.activeSession!==l)){r({activeSession:"",count:d});return}let m=Math.min(d,e.config.init);r({activeSession:l,count:m});const h=()=>{if(e.sessionKey()!==l){o=void 0;return}const g=e.messages().length;if(m=Math.min(g,m+e.config.batch),r("count",m),m>=g){r({completedSession:l,activeSession:""}),o=void 0;return}o=requestAnimationFrame(h)};o=requestAnimationFrame(h)}));const a=$(()=>{const l=e.sessionKey();return t.activeSession===l&&t.completedSession!==l});return je(s),{messages:n,isStaging:a}}function zF(e){let t;const r=ra(),i=r_(),n=Rn(),o=sr(),s=kc(),a=br(),l=_t(),{params:u,sessionKey:d}=Lc(),f=na(),m=$(()=>e.renderedUserMessages.map(G=>G.id)),h=$(()=>u.id),g=$(()=>{const G=h();return G?o.data.message[G]??Og:Og}),y=$(()=>g().findLast(G=>G.role==="assistant"&&typeof G.time.completed!="number")),b=$(()=>{const G=h();return G?o.data.session_status[G]??Eg:Eg}),v=$(()=>{const G=y()?.parentID;if(G){const ke=g(),ue=Ms.search(ke,G,Ue=>Ue.id),me=ue.found?ke[ue.index]:ke.find(Ue=>Ue.id===G);if(me&&me.role==="user")return me.id}if(b().type!=="idle"){const ke=g();for(let ue=ke.length-1;ue>=0;ue--)if(ke[ue].role==="user")return ke[ue].id}}),w=$(()=>{const G=h();if(G)return o.session.get(G)}),x=$(()=>w()?.title),_=$(()=>vf(x())),k=$(()=>w()?.share?.url),C=$(()=>o.data.config.share!=="disabled"),O=$(()=>w()?.parentID),z=$(()=>{const G=e.inlineQuestionRequest,we=v();return!G||!we?!1:m().includes(we)}),J=MF({sessionKey:d,turnStart:()=>e.turnStart,messages:()=>e.renderedUserMessages,config:{init:1,batch:3}}),[T,M]=We({draft:"",editing:!1,menuOpen:!1,pendingRename:!1,pendingShare:!1});let U;const[A,j]=We({open:!1,dismiss:null}),[P,B]=We({todoHeight:0}),R=$(()=>document.getElementById(So.leftLeading)),V=$(()=>document.getElementById(So.center)),Q=$(()=>document.getElementById(So.right));let ee;const oe=()=>{const G=k();G&&f.openLink(G)},le=G=>{if(G&&typeof G=="object"&&"data"in G){const we=G.data;if(we?.message)return we.message}return G instanceof Error?G.message:l.t("common.requestFailed")},W=Dr(()=>({mutationFn:G=>i.client.session.share({sessionID:G,directory:n.directory}),onError:G=>{console.error("Failed to share session",G)}})),D=Dr(()=>({mutationFn:G=>i.client.session.unshare({sessionID:G,directory:n.directory}),onError:G=>{console.error("Failed to unshare session",G)}})),te=Dr(()=>({mutationFn:G=>n.client.session.update({sessionID:G.id,title:G.title}),onSuccess:(G,we)=>{o.set(bf(ke=>{const ue=ke.session.findIndex(me=>me.id===we.id);ue!==-1&&(ke.session[ue].title=we.title)})),M("editing",!1)},onError:G=>{Nt({title:l.t("common.requestFailed"),description:le(G)})}})),H=()=>{const G=h();!G||W.isPending||C()&&W.mutate(G)},Z=()=>{const G=h();!G||D.isPending||C()&&D.mutate(G)};ne(qe(d,()=>M({draft:"",editing:!1,menuOpen:!1,pendingRename:!1,pendingShare:!1}),{defer:!0}));const se=()=>{h()&&(M({editing:!0,draft:_()??""}),requestAnimationFrame(()=>{U?.focus(),U?.select()}))},re=()=>{te.isPending||M("editing",!1)},fe=()=>{const G=h();if(!G||te.isPending)return;const we=T.draft.trim();if(!we||we===(_()??"")){M("editing",!1);return}te.mutate({id:G,title:we})},Se=(G,we,ke)=>{if(u.id===G){if(we){r(`/${u.dir}/session/${we}`);return}if(ke){r(`/${u.dir}/session/${ke}`);return}r(`/${u.dir}/session`)}},Ne=async G=>{const we=o.session.get(G);if(!we)return!1;const ke=(o.data.session??[]).filter(be=>!be.parentID&&!be.time?.archived),ue=ke.findIndex(be=>be.id===G),me=ue===-1?void 0:ke[ue+1]??ke[ue-1];return await n.client.session.delete({sessionID:G}).then(be=>be.data).catch(be=>(Nt({title:l.t("session.delete.failed.title"),description:le(be)}),!1))?(o.set(bf(be=>{const Be=new Set([G]),E=new Map;for(const de of be.session){const Ee=de.parentID;if(!Ee)continue;const Re=E.get(Ee);if(Re){Re.push(de.id);continue}E.set(Ee,[de.id])}const ae=[G];for(;ae.length;){const de=ae.pop();if(!de)continue;const Ee=E.get(de);if(Ee)for(const Re of Ee)Be.has(Re)||(Be.add(Re),ae.push(Re))}be.session=be.session.filter(de=>!Be.has(de.id))})),Se(G,we.parentID,me?.id),!0):!1},ce=()=>{const G=O();G&&r(`/${u.dir}/session/${G}`)};function ye(G){const we=$(()=>vf(o.session.get(G.sessionID)?.title)??l.t("command.session.new")),ke=async()=>{await Ne(G.sessionID),a.close()};return c(dh,{get title(){return l.t("session.delete.title")},fit:!0,get children(){var ue=bF(),me=ue.firstChild,Ue=me.firstChild,be=me.nextSibling;return p(Ue,()=>l.t("session.delete.confirm",{name:we()})),p(be,c(vt,{variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return l.t("common.cancel")}}),null),p(be,c(vt,{variant:"primary",size:"large",onClick:ke,get children(){return l.t("session.delete.button")}}),null),ue}})}return c(F,{get when(){return!e.mobileChanges},get fallback(){return(()=>{var G=_F();return p(G,()=>e.mobileFallback),G})()},get children(){var G=xF(),we=G.firstChild,ke=we.firstChild;return p(G,c(F,{get when(){return R()},children:ue=>c(F,{get when(){return O()},get children(){return c(hr,{get mount(){return ue()},get children(){return c(Pt,{tabIndex:-1,icon:"arrow-left",variant:"ghost",class:"titlebar-icon rounded-md",onClick:ce,get"aria-label"(){return l.t("common.goBack")}})}})}})}),we),p(G,c(F,{get when(){return V()},children:ue=>c(F,{get when(){return _()||T.editing},get children(){return c(hr,{get mount(){return ue()},get children(){var me=$F();return p(me,c(F,{get when(){return T.editing},get fallback(){return(()=>{var Ue=SF();return Ue.$$dblclick=se,p(Ue,_),Ue})()},get children(){return c(YM,{ref:Ue=>{U=Ue},get value(){return T.draft},get disabled(){return te.isPending},class:"text-14-medium text-text-strong min-w-0 w-full rounded-[6px] text-center",style:{"--inline-input-shadow":"var(--shadow-xs-border-select)"},onInput:Ue=>M("draft",Ue.currentTarget.value),onKeyDown:Ue=>{if(Ue.stopPropagation(),Ue.key==="Enter"){Ue.preventDefault(),fe();return}Ue.key==="Escape"&&(Ue.preventDefault(),re())},onBlur:re})}})),me}})}})}),we),p(G,c(F,{get when(){return Q()},children:ue=>c(F,{get when(){return h()},get children(){return c(hr,{get mount(){return ue()},get children(){var me=IF(),Ue=me.firstChild;return p(Ue,c(m1,{placement:"bottom"})),p(me,c(ct,{gutter:4,placement:"bottom-end",get open(){return T.menuOpen},onOpenChange:be=>{M("menuOpen",be)},get children(){return[c(ct.Trigger,{as:Pt,icon:"dot-grid",variant:"ghost",class:"titlebar-icon size-6 rounded-md data-[expanded]:bg-surface-base-active",get classList(){return{"bg-surface-base-active":A.open||T.pendingShare}},"data-action":"session-more-options",get"aria-label"(){return l.t("common.moreOptions")},get"aria-expanded"(){return T.menuOpen||A.open||T.pendingShare},ref:be=>{ee=be}}),c(ct.Portal,{get children(){return c(ct.Content,{style:{"min-width":"104px"},onCloseAutoFocus:be=>{if(T.pendingRename){be.preventDefault(),M("pendingRename",!1),se();return}T.pendingShare&&(be.preventDefault(),requestAnimationFrame(()=>{j({open:!0,dismiss:null}),M("pendingShare",!1)}))},get children(){return[c(ct.Item,{onSelect:()=>{M("pendingRename",!0),M("menuOpen",!1)},get children(){return c(ct.ItemLabel,{get children(){return l.t("common.rename")}})}}),c(F,{get when(){return C()},get children(){return c(ct.Item,{onSelect:()=>{M({pendingShare:!0,menuOpen:!1})},get children(){return c(ct.ItemLabel,{get children(){return l.t("session.share.action.share")}})}})}}),c(ct.Item,{onSelect:()=>a.show(()=>c(ye,{get sessionID(){return h()}})),get children(){return c(ct.ItemLabel,{get children(){return l.t("common.delete")}})}})]}})}})]}}),null),p(me,c(fr,{get open(){return A.open},anchorRef:()=>ee,placement:"bottom-end",gutter:4,modal:!1,onOpenChange:be=>{be&&j("dismiss",null),j("open",be)},get children(){return c(fr.Portal,{get children(){return c(fr.Content,{"data-component":"popover-content",style:{"min-width":"320px"},onEscapeKeyDown:be=>{j({dismiss:"escape",open:!1}),be.preventDefault(),be.stopPropagation()},onPointerDownOutside:()=>{j({dismiss:"outside",open:!1})},onFocusOutside:()=>{j({dismiss:"outside",open:!1})},onCloseAutoFocus:be=>{A.dismiss==="outside"&&be.preventDefault(),j("dismiss",null)},get children(){var be=CF(),Be=be.firstChild,E=Be.firstChild,ae=E.nextSibling,de=Be.nextSibling;return p(E,()=>l.t("session.share.popover.title")),p(ae,(()=>{var Ee=Te(()=>!!k());return()=>Ee()?l.t("session.share.popover.description.shared"):l.t("session.share.popover.description.unshared")})()),p(de,c(F,{get when(){return k()},get fallback(){return c(vt,{size:"large",variant:"primary",class:"w-full",onClick:H,get disabled(){return W.isPending},get children(){return Te(()=>!!W.isPending)()?l.t("session.share.action.publishing"):l.t("session.share.action.publish")}})},get children(){var Ee=kF(),Re=Ee.firstChild;return p(Ee,c(ah,{get value(){return k()??""},readOnly:!0,copyable:!0,copyKind:"link",tabIndex:-1,class:"w-full"}),Re),p(Re,c(vt,{size:"large",variant:"secondary",class:"w-full shadow-none border border-border-weak-base",onClick:Z,get disabled(){return D.isPending},get children(){return Te(()=>!!D.isPending)()?l.t("session.share.action.unpublishing"):l.t("session.share.action.unpublish")}}),null),p(Re,c(vt,{size:"large",variant:"primary",class:"w-full",onClick:oe,get disabled(){return D.isPending},get children(){return l.t("session.share.action.view")}}),null),Ee}})),be}})}})}}),null),me}})}})}),we),pt(ke,"click",e.onResumeScroll,!0),p(ke,c(bt,{name:"arrow-down-to-line"})),p(G,c(va,{get viewportRef(){return e.setScrollRef},onWheel:ue=>{const me=ue.currentTarget,Ue=JM({deltaY:ue.deltaY,deltaMode:ue.deltaMode,rootHeight:me.clientHeight});Ue&&Mg({root:me,target:ue.target,delta:Ue,onMarkScrollGesture:e.onMarkScrollGesture})},onTouchStart:ue=>{t=ue.touches[0]?.clientY},onTouchMove:ue=>{const me=ue.touches[0]?.clientY,Ue=t;if(t=me,me===void 0||Ue===void 0)return;const be=Ue-me;if(!be)return;const Be=ue.currentTarget;Mg({root:Be,target:ue.target,delta:be,onMarkScrollGesture:e.onMarkScrollGesture})},onTouchEnd:()=>{t=void 0},onTouchCancel:()=>{t=void 0},onPointerDown:ue=>{ue.target===ue.currentTarget&&e.onMarkScrollGesture(ue.currentTarget)},onScroll:ue=>{e.onScheduleScrollState(ue.currentTarget),e.onTurnBackfillScroll(),e.hasScrollGesture()&&(e.onUserScroll(),e.onAutoScrollHandleScroll(),e.onMarkScrollGesture(ue.currentTarget))},get onClick(){return e.onAutoScrollInteraction},class:"relative min-w-0 w-full h-full",style:{"--sticky-accordion-top":"0px"},get children(){var ue=wF(),me=ue.firstChild,Ue=e.setContentRef;return typeof Ue=="function"?ut(Ue,ue):e.setContentRef=ue,p(me,c(F,{get when(){return e.turnStart>0||e.historyMore},get children(){var be=yF();return p(be,c(vt,{variant:"ghost",size:"large",class:"text-12-medium opacity-50",get disabled(){return e.historyLoading},get onClick(){return e.onLoadEarlier},get children(){return Te(()=>!!e.historyLoading)()?l.t("session.messages.loadingEarlier"):l.t("session.messages.loadEarlier")}})),be}}),null),p(me,c(rt,{get each(){return m()},children:be=>{const Be=$(()=>v()===be),E=$(()=>OF(o.data.part[be]??[]),[],{equals:(de,Ee)=>de.length===Ee.length&&de.every((Re,ot)=>Re.path===Ee[ot].path&&Re.comment===Ee[ot].comment&&Re.selection?.startLine===Ee[ot].selection?.startLine&&Re.selection?.endLine===Ee[ot].selection?.endLine)}),ae=$(()=>E().length);return(()=>{var de=DF();return Ie(de,"data-message-id",be),p(de,c(F,{get when(){return ae()>0},get children(){var Ee=TF(),Re=Ee.firstChild,ot=Re.firstChild;return p(ot,c(Ur,{get each(){return E()},children:Pe=>{const Oe=$(()=>Pe());return c(F,{get when(){return Oe()},children:pe=>(()=>{var De=AF(),st=De.firstChild,Je=st.firstChild,Ve=st.nextSibling;return p(st,c(Sn,{get node(){return{path:pe().path,type:"file"}},class:"size-3.5 shrink-0"}),Je),p(Je,()=>Qt(pe().path)),p(st,c(F,{get when(){return pe().selection},children:ht=>(()=>{var Mt=PF();return p(Mt,(()=>{var Tt=Te(()=>ht().startLine===ht().endLine);return()=>Tt()?`:${ht().startLine}`:`:${ht().startLine}-${ht().endLine}`})()),Mt})()}),null),p(Ve,()=>pe().comment),De})()})}})),Ee}}),null),p(de,c(vF,{get sessionID(){return h()??""},messageID:be,get messages(){return g()},get actions(){return e.actions},get active(){return Be()},get status(){return Te(()=>!!Be())()?b():void 0},get showReasoningSummaries(){return s.general.showReasoningSummaries()},get shellToolDefaultOpen(){return s.general.shellToolPartsExpanded()},get editToolDefaultOpen(){return s.general.editToolPartsExpanded()},classes:{root:"min-w-0 w-full relative",content:"flex flex-col justify-between !overflow-visible",container:"w-full px-4 md:px-5"},get children(){return c(F,{get when(){return Te(()=>!!Be())()?e.inlineQuestionRequest:void 0},keyed:!0,children:Ee=>(()=>{var Re=Pg();return p(Re,c(tc,{request:Ee,get onSubmit(){return e.onQuestionSubmit??e.onResumeScroll},placement:"inline"})),Re})()})}}),null),Ae(Ee=>{var Re=e.anchor(be),ot={"min-w-0 w-full max-w-full":!0,"md:max-w-200 2xl:max-w-[1000px]":e.centered},Pe=Be()?void 0:"auto",Oe=Be()?void 0:"auto 500px";return Re!==Ee.e&&Ie(de,"id",Ee.e=Re),Ee.t=Ct(de,ot,Ee.t),Pe!==Ee.a&&ft(de,"content-visibility",Ee.a=Pe),Oe!==Ee.o&&ft(de,"contain-intrinsic-size",Ee.o=Oe),Ee},{e:void 0,t:void 0,a:void 0,o:void 0}),de})()}}),null),p(me,c(F,{get when(){return Te(()=>!z())()?e.inlineQuestionRequest:void 0},keyed:!0,children:be=>(()=>{var Be=Pg();return p(Be,c(tc,{request:be,get onSubmit(){return e.onQuestionSubmit??e.onResumeScroll},placement:"inline"})),Be})()}),null),Ae(be=>{var Be={"w-full":!0,"md:max-w-200 md:mx-auto 2xl:max-w-[1000px]":e.centered,"mt-0.5":e.centered,"mt-0":!e.centered},E=`${64+P.todoHeight}px`;return be.e=Ct(me,Be,be.e),E!==be.t&&ft(me,"padding-bottom",be.t=E),be},{e:void 0,t:void 0}),ue}}),null),p(G,c(F,{get when(){return e.todoDock},children:ue=>c(E5,{get sessionID(){return ue().sessionID},get todos(){return ue().todos},get open(){return ue().open},get closing(){return ue().closing},get centered(){return e.centered},onHeightChange:me=>{B("todoHeight",me)}})}),null),Ae(ue=>{var me={"opacity-100 translate-y-0 scale-100":e.scroll.overflow&&e.scroll.jump&&!J.isStaging(),"opacity-0 translate-y-2 scale-95 pointer-events-none":!e.scroll.overflow||!e.scroll.jump||J.isStaging()},Ue=`${24+P.todoHeight}px`;return ue.e=Ct(we,me,ue.e),Ue!==ue.t&&ft(we,"bottom",ue.t=Ue),ue},{e:void 0,t:void 0}),G}})}Ot(["click","dblclick"]);function LF(e){if(typeof document>"u")return;const t=document.createElement("button");t.type="button",t.ariaLabel=e.label,t.textContent="+",t.style.width="20px",t.style.height="20px",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.border="none",t.style.borderRadius="var(--radius-md)",t.style.background="var(--icon-interactive-base)",t.style.color="var(--white)",t.style.boxShadow="var(--shadow-xs)",t.style.fontSize="14px",t.style.lineHeight="1",t.style.cursor="pointer",t.style.position="relative",t.style.left="30px",t.style.top="calc((var(--diffs-line-height, 24px) - 20px) / 2)";let r;const i=()=>{const s=e.getHoveredLine();s&&(r=s)},n=()=>{t.isConnected&&(i(),requestAnimationFrame(n))},o=()=>{const s=e.getHoveredLine()??r;s&&e.onSelect(s)};return requestAnimationFrame(n),t.addEventListener("mouseenter",i),t.addEventListener("mousemove",i),t.addEventListener("pointerdown",s=>{s.preventDefault(),s.stopPropagation(),i()}),t.addEventListener("mousedown",s=>{s.preventDefault(),s.stopPropagation(),i()}),t.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),o()}),t}var FF=I('<svg><path d="M16.25 3.75H3.75V16.25L6.875 14.4643H16.25V3.75Z"stroke=currentColor stroke-linecap=square></svg>',!1,!0,!1),NF=I('<svg data-slot=line-comment-icon viewBox="0 0 20 20"fill=none aria-hidden=true>'),RF=I('<svg><path d="M10 5.41699V10.0003M10 10.0003V14.5837M10 10.0003H5.4165M10 10.0003H14.5832"stroke=currentColor stroke-linecap=square></svg>',!1,!0,!1),jF=I("<div data-slot=line-comment-popover data-inline-body>"),UF=I("<div data-component=line-comment data-prevent-autofocus>"),KF=I("<button type=button data-slot=line-comment-button>"),VF=I("<div data-slot=line-comment-popover>"),BF=I("<div data-slot=line-comment-tools>"),ZF=I("<div data-slot=line-comment-content><div data-slot=line-comment-head><div data-slot=line-comment-text></div></div><div data-slot=line-comment-label>"),HF=I("<div data-slot=line-comment-mention-list>"),qF=I("<div data-slot=line-comment-editor><textarea data-slot=line-comment-textarea></textarea><div data-slot=line-comment-actions><div data-slot=line-comment-editor-label>"),GF=I("<span data-slot=line-comment-mention-file>"),WF=I("<button type=button data-slot=line-comment-mention-item><div data-slot=line-comment-mention-path><span data-slot=line-comment-mention-dir>"),XF=I("<button type=button data-slot=line-comment-action data-variant=ghost>"),YF=I("<button type=button data-slot=line-comment-action data-variant=primary>");i_();function JF(e){return(()=>{var t=NF();return p(t,c(F,{get when(){return e.icon==="comment"},get fallback(){return RF()},get children(){return FF()}})),t})()}const Y1=e=>{const t=()=>!e.inline&&e.top===void 0,r=()=>e.variant??"default",i=()=>e.icon??"comment",n=()=>e.inline&&e.hideButton;return(()=>{var o=UF();return p(o,c(F,{get when(){return n()},get fallback(){return[(()=>{var s=KF();return pt(s,"mouseenter",e.onMouseEnter),pt(s,"click",e.onClick),pt(s,"mouseup",a=>a.stopPropagation()),pt(s,"mousedown",a=>a.stopPropagation()),p(s,c(F,{get when(){return e.inline},get fallback(){return c(bt,{get name(){return i()==="plus"?"plus-small":"comment"},size:"small"})},get children(){return c(JF,{get icon(){return i()}})}})),Ae(()=>Ie(s,"aria-label",e.buttonLabel)),s})(),c(F,{get when(){return e.open},get children(){var s=VF();return pt(s,"focusout",e.onPopoverFocusOut),pt(s,"mousedown",a=>a.stopPropagation()),p(s,()=>e.children),Ae(a=>Ct(s,{[e.popoverClass??""]:!!e.popoverClass},a)),s}})]},get children(){var s=jF();return pt(s,"focusout",e.onPopoverFocusOut),pt(s,"mouseenter",e.onMouseEnter),pt(s,"click",e.onClick),pt(s,"mousedown",a=>a.stopPropagation()),p(s,()=>e.children),Ae(a=>Ct(s,{[e.popoverClass??""]:!!e.popoverClass},a)),s}})),Ae(s=>{var a=r(),l=e.id,u=e.open?"":void 0,d=e.inline?"":void 0,f={[e.class??""]:!!e.class},m=e.inline?void 0:{top:`${e.top??0}px`,opacity:t()?0:1,"pointer-events":t()?"none":"auto"};return a!==s.e&&Ie(o,"data-variant",s.e=a),l!==s.t&&Ie(o,"data-comment-id",s.t=l),u!==s.a&&Ie(o,"data-open",s.a=u),d!==s.o&&Ie(o,"data-inline",s.o=d),s.i=Ct(o,f,s.i),s.n=gr(o,m,s.n),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),o})()},QF=e=>{const t=yt(),[r,i]=$e(e,["comment","selection","actions"]);return c(Y1,ie(i,{variant:"default",get hideButton(){return e.inline},get children(){var n=ZF(),o=n.firstChild,s=o.firstChild,a=o.nextSibling;return p(s,()=>r.comment),p(o,c(F,{get when(){return r.actions},get children(){var l=BF();return p(l,()=>r.actions),l}}),null),p(a,()=>t.t("ui.lineComment.label.prefix"),null),p(a,()=>r.selection,null),p(a,()=>t.t("ui.lineComment.label.suffix"),null),n}}))},zg=e=>{const t=yt(),[r,i]=$e(e,["value","selection","onInput","onCancel","onSubmit","placeholder","rows","autofocus","cancelLabel","submitLabel","mention"]),n={textarea:void 0},[o,s]=ze(!1);function a(v){if(!v)return;const w=n.textarea,x=h();if(!w||!x)return;const _=`${w.value.slice(0,x.start)}@${v.path} ${w.value.slice(x.end)}`,k=x.start+v.path.length+2;r.onInput(_),m(),requestAnimationFrame(()=>{w.focus(),w.setSelectionRange(k,k)})}const l=Ls({items:async v=>r.mention?v.trim()?(await r.mention.items(v)).map(x=>({path:x})):[]:[],key:v=>v.path,filterKeys:["path"],onSelect:a}),u=()=>n.textarea?.focus(),d=v=>{v.preventDefault(),v.stopPropagation()},f=v=>w=>{w.stopPropagation(),v()},m=()=>{s(!1),l.clear()},h=()=>{const v=n.textarea;if(!v||!r.mention||v.selectionStart!==v.selectionEnd)return;const w=v.selectionStart,x=v.value.slice(0,w).match(/@(\S*)$/);if(x)return{query:x[1]??"",start:w-x[0].length,end:w}},g=()=>{const v=h();if(!v){m();return}s(!0),l.onInput(v.query)},y=()=>{const v=l.flat();if(v.length===0)return;const w=l.active();a(v.find(x=>x.path===w)??v[0])},b=()=>{const v=r.value.trim();v&&r.onSubmit(v)};return Vt(()=>{r.autofocus!==!1&&requestAnimationFrame(u)}),c(Y1,ie(i,{open:!0,variant:"editor",get hideButton(){return e.inline},onClick:()=>u(),get children(){var v=qF(),w=v.firstChild,x=w.nextSibling,_=x.firstChild;return pt(w,"keydown",k=>{const C=k;if(!(C.isComposing||C.keyCode===229)){if(C.stopPropagation(),o()){if(k.key==="Escape"){C.preventDefault(),m();return}if(k.key==="Tab"){if(l.flat().length===0)return;C.preventDefault(),y();return}const O=k.key==="ArrowUp"||k.key==="ArrowDown"||k.key==="Enter",z=C.ctrlKey&&!C.metaKey&&!C.altKey&&!C.shiftKey&&(k.key==="n"||k.key==="p");if((O||z)&&l.flat().length>0){l.onKeyDown(C),C.preventDefault();return}}if(k.key==="Escape"){C.preventDefault(),k.currentTarget.blur(),r.onCancel();return}k.key==="Enter"&&(k.shiftKey||(C.preventDefault(),b()))}}),pt(w,"select",()=>g()),pt(w,"click",()=>g()),pt(w,"input",k=>{const C=k.currentTarget.value;r.onInput(C),g()}),ut(k=>{n.textarea=k},w),p(v,c(F,{get when(){return Te(()=>!!o())()&&l.flat().length>0},get children(){var k=HF();return p(k,c(rt,{get each(){return l.flat().slice(0,10)},children:C=>{const O=C.path.endsWith("/")?C.path:Ri(C.path),z=C.path.endsWith("/")?"":Qt(C.path);return(()=>{var K=WF(),J=K.firstChild,T=J.firstChild;return K.$$click=()=>a(C),K.addEventListener("mouseenter",()=>l.setActive(C.path)),K.$$mousedown=M=>M.preventDefault(),p(K,c(Sn,{get node(){return{path:C.path,type:"file"}},class:"shrink-0 size-4"}),J),p(T,O),p(J,c(F,{when:z,get children(){var M=GF();return p(M,z),M}}),null),Ae(()=>Ie(K,"data-active",l.active()===C.path?"":void 0)),K})()}})),k}}),x),p(_,()=>t.t("ui.lineComment.editorLabel.prefix"),null),p(_,()=>r.selection,null),p(_,()=>t.t("ui.lineComment.editorLabel.suffix"),null),p(x,c(F,{get when(){return!e.inline},get fallback(){return[(()=>{var k=XF();return pt(k,"click",f(r.onCancel)),pt(k,"mousedown",d),p(k,()=>r.cancelLabel??t.t("ui.common.cancel")),k})(),(()=>{var k=YF();return pt(k,"click",f(b)),pt(k,"mousedown",d),p(k,()=>r.submitLabel??t.t("ui.lineComment.submit")),Ae(()=>k.disabled=r.value.trim().length===0),k})()]},get children(){return[c(vt,{size:"small",variant:"ghost",get onClick(){return r.onCancel},get children(){return r.cancelLabel??t.t("ui.common.cancel")}}),c(vt,{size:"small",variant:"primary",get disabled(){return r.value.trim().length===0},onClick:b,get children(){return r.submitLabel??t.t("ui.lineComment.submit")}})]}}),null),Ae(k=>{var C=r.rows??3,O=r.placeholder??t.t("ui.lineComment.placeholder");return C!==k.e&&Ie(w,"rows",k.e=C),O!==k.t&&Ie(w,"placeholder",k.t=O),k},{e:void 0,t:void 0}),Ae(()=>w.value=r.value),v}}))};Ot(["mousedown","click"]);function e9(e){const t=new Map,r=s=>{if(typeof document>"u")return;const a=document.createElement("div");a.setAttribute("data-prevent-autofocus","");const[l,u]=ze(s),d=o_(()=>{const m=l();if(m.kind==="comment"){const g=$(()=>{const y=l();return y.kind!=="comment"?e.renderComment(m.comment):e.renderComment(y.comment)});return c(F,{get when(){return g().editor},get fallback(){return c(QF,{inline:!0,get id(){return g().id},get open(){return g().open},get comment(){return g().comment},get selection(){return g().selection},get actions(){return g().actions},get onClick(){return g().onClick},get onMouseEnter(){return g().onMouseEnter}})},get children(){return c(zg,{inline:!0,get id(){return g().id},get value(){return g().editor.value},get selection(){return g().editor.selection},get onInput(){return g().editor.onInput},get onCancel(){return g().editor.onCancel},get onSubmit(){return g().editor.onSubmit},get onPopoverFocusOut(){return g().editor.onPopoverFocusOut},get cancelLabel(){return g().editor.cancelLabel},get submitLabel(){return g().editor.submitLabel},get mention(){return g().editor.mention}})}})}const h=$(()=>{const g=l();return g.kind!=="draft"?e.renderDraft(m.range):e.renderDraft(g.range)});return c(zg,{inline:!0,get value(){return h().value},get selection(){return h().selection},get onInput(){return h().onInput},get onCancel(){return h().onCancel},get onSubmit(){return h().onSubmit},get onPopoverFocusOut(){return h().onPopoverFocusOut},get mention(){return h().mention}})},a),f={host:a,dispose:d,setMeta:u};return t.set(s.key,f),f};return{render:s=>{const a=s.metadata,l=t.get(a.key)??r(a);if(l)return l.setMeta(a),l.host},reconcile:s=>{const a=new Set(s.map(l=>l.metadata.key));for(const[l,u]of t)a.has(l)||(u.dispose(),t.delete(l))},cleanup:()=>{for(const[,s]of t)s.dispose();t.clear()}}}function t9(e){const[t,r]=We({draft:"",editing:null}),i=()=>t.draft,n=x=>r("draft",x),o=()=>t.editing,s=x=>r("editing",typeof x=="function"?()=>x:x),a=x=>x?Ii(x):null,l=x=>{const _=a(x);return e.setSelected(_),e.syncSelected?.(a(_)),_},u=x=>{const _=a(x);return e.setCommenting(_),_},d=()=>{e.setOpened(null)},f=()=>{n(""),s(null),u(null)},m=()=>{n(""),s(null),e.setOpened(null),e.setSelected(null),e.setCommenting(null)},h=(x,_,k)=>{k?.cancelDraft&&f(),e.setOpened(x),l(_)},g=(x,_,k)=>{k?.cancelDraft&&f();const C=e.opened()===x?null:x;e.setOpened(C),l(_)},y=x=>{const _=a(x);n(""),s(null),d(),l(_),u(_)},b=(x,_,k)=>{d(),l(_),e.setCommenting(null),s(x),n(k)},v=x=>{const _=a(x);if(_){if(e.hoverSelected){e.hoverSelected(_);return}l(_)}},w=x=>{d(),l(x),f()};return{draft:i,setDraft:n,editing:o,opened:e.opened,selected:e.selected,commenting:e.commenting,isOpen:x=>e.opened()===x,isEditing:x=>o()===x,closeComment:d,openComment:h,toggleComment:g,openDraft:y,openEditor:b,hoverComment:v,cancelDraft:f,finishSelection:w,select:l,reset:m}}function J1(e){const t=yt(),r=t9(e.state),i="getSide"in e?Lg({comments:e.comments,getCommentId:u=>u.id,getCommentSelection:u=>u.selection,draftRange:r.commenting,draftKey:e.draftKey,getSide:e.getSide}):Lg({comments:e.comments,getCommentId:u=>u.id,getCommentSelection:u=>u.selection,draftRange:r.commenting,draftKey:e.draftKey}),{renderAnnotation:n}=n9({annotations:i,renderComment:u=>{const d=()=>r.openEditor(u.id,u.selection,u.comment),f=()=>{r.reset(),e.onDelete?.(u)};return{id:u.id,get open(){return r.isOpen(u.id)||r.isEditing(u.id)},comment:u.comment,selection:Ga(u.selection,t.t),get actions(){return e.renderCommentActions?.(u,{edit:d,remove:f})},get editor(){return r.isEditing(u.id)?{get value(){return r.draft()},selection:Ga(u.selection,t.t),mention:e.mention,onInput:r.setDraft,onCancel:r.cancelDraft,onSubmit:m=>{e.onUpdate?.({id:u.id,comment:m,selection:Ii(u.selection)}),r.cancelDraft()},submitLabel:e.editSubmitLabel}:void 0},onMouseEnter:()=>r.hoverComment(u.selection),onClick:()=>{r.isEditing(u.id)||r.toggleComment(u.id,u.selection,{cancelDraft:e.cancelDraftOnCommentToggle})}}},renderDraft:u=>({get value(){return r.draft()},selection:Ga(u,t.t),mention:e.mention,onInput:r.setDraft,onCancel:r.cancelDraft,onSubmit:d=>{e.onSubmit({comment:d,selection:Ii(u)}),r.cancelDraft()},onPopoverFocusOut:e.onDraftPopoverFocusOut})}),o=r9({label:e.label,getSelectedRange:()=>r.opened()?null:e.getHoverSelectedRange?.()??r.selected(),onOpenDraft:r.openDraft});return{note:r,annotations:i,renderAnnotation:n,renderHoverUtility:o,onLineSelected:u=>{if(!u){r.select(null),r.cancelDraft();return}r.select(u)},onLineSelectionEnd:u=>{if(!u){e.clearSelectionOnSelectionEndNull&&r.select(null),r.cancelDraft();return}r.finishSelection(u)},onLineNumberSelectionEnd:u=>{u&&r.openDraft(u)}}}function Lg(e){const t=r=>Math.max(r.start,r.end);return"getSide"in e?$(()=>{const r=e.comments().map(n=>{const o=e.getCommentSelection(n);return{side:e.getSide(o),lineNumber:t(o),metadata:{kind:"comment",key:`comment:${e.getCommentId(n)}`,comment:n}}}),i=e.draftRange();return i?[...r,{side:e.getSide(i),lineNumber:t(i),metadata:{kind:"draft",key:`draft:${e.draftKey()}`,range:i}}]:r}):$(()=>{const r=e.comments().map(o=>{const s=e.getCommentSelection(o);return{lineNumber:t(s),metadata:{kind:"comment",key:`comment:${e.getCommentId(o)}`,comment:o}}}),i=e.draftRange();if(!i)return r;const n={lineNumber:t(i),metadata:{kind:"draft",key:`draft:${e.draftKey()}`,range:i}};return[...r,n]})}function n9(e){const t=e9({renderComment:e.renderComment,renderDraft:e.renderDraft});return ne(()=>{t.reconcile(e.annotations())}),je(()=>{t.cleanup()}),{renderAnnotation:t.render}}function r9(e){return t=>LF({label:e.label,getHoveredLine:t,onSelect:r=>{const i=e.getSelectedRange();if(i&&s_(i,r.lineNumber,r.side)){e.onOpenDraft(Ii(i));return}const n={start:r.lineNumber,end:r.lineNumber};r.side&&(n.side=r.side),e.onOpenDraft(n)}})}var i9={};ir(i9,{Description:()=>Li,ErrorMessage:()=>zi,Item:()=>tx,ItemControl:()=>Qd,ItemDescription:()=>ef,ItemIndicator:()=>tf,ItemInput:()=>nx,ItemLabel:()=>nf,Label:()=>rf,RadioGroup:()=>ja,Root:()=>rx,useRadioGroupContext:()=>Ra});var Q1=Rt();function Ra(){const e=jt(Q1);if(e===void 0)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var ex=Rt();function Xi(){const e=jt(ex);if(e===void 0)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function tx(e){const t=Rr(),r=Ra(),i=`${t.generateId("item")}-${nn()}`,n=Ge({id:i},e),[o,s]=$e(n,["value","disabled","onPointerDown"]),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),[h,g]=ze(),[y,b]=ze(!1),v=$(()=>r.isDefaultValue(o.value)),w=$(()=>r.isSelectedValue(o.value)),x=$(()=>o.disabled||t.isDisabled()||!1),_=O=>{Qe(O,o.onPointerDown),y()&&O.preventDefault()},k=$(()=>({...t.dataset(),"data-disabled":x()?"":void 0,"data-checked":w()?"":void 0})),C={value:()=>o.value,dataset:k,isDefault:v,isSelected:w,isDisabled:x,inputId:a,labelId:u,descriptionId:f,inputRef:h,select:()=>r.setSelectedValue(o.value),generateId:Nn(()=>s.id),registerInput:tn(l),registerLabel:tn(d),registerDescription:tn(m),setIsFocused:b,setInputRef:g};return c(ex.Provider,{value:C,get children(){return c(it,ie({as:"div",role:"group",onPointerDown:_},k,s))}})}function Qd(e){const t=Xi(),r=Ge({id:t.generateId("control")},e),[i,n]=$e(r,["onClick","onKeyDown"]);return c(it,ie({as:"div",onClick:a=>{Qe(a,i.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:a=>{Qe(a,i.onKeyDown),a.key===uh.Space&&(t.select(),t.inputRef()?.focus())}},()=>t.dataset(),n))}function ef(e){const t=Xi(),r=Ge({id:t.generateId("description")},e);return ne(()=>je(t.registerDescription(r.id))),c(it,ie({as:"div"},()=>t.dataset(),r))}function tf(e){const t=Xi(),r=Ge({id:t.generateId("indicator")},e),[i,n]=$e(r,["ref","forceMount"]),[o,s]=ze(),{present:a}=li({show:()=>i.forceMount||t.isSelected(),element:()=>o()??null});return c(F,{get when(){return a()},get children(){return c(it,ie({as:"div",ref(l){var u=xt(s,i.ref);typeof u=="function"&&u(l)}},()=>t.dataset(),n))}})}function nx(e){const t=Rr(),r=Ra(),i=Xi(),n=Ge({id:i.generateId("input")},e),[o,s]=$e(n,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),a=()=>[o["aria-labelledby"],i.labelId(),o["aria-labelledby"]!=null&&s["aria-label"]!=null?s.id:void 0].filter(Boolean).join(" ")||void 0,l=()=>[o["aria-describedby"],i.descriptionId(),r.ariaDescribedBy()].filter(Boolean).join(" ")||void 0,[u,d]=ze(!1),f=g=>{if(Qe(g,o.onChange),g.stopPropagation(),!u()){r.setSelectedValue(i.value());const y=g.target;y.checked=i.isSelected()}d(!1)},m=g=>{Qe(g,o.onFocus),i.setIsFocused(!0)},h=g=>{Qe(g,o.onBlur),i.setIsFocused(!1)};return ne(qe([()=>i.isSelected(),()=>i.value()],g=>{if(!g[0]&&g[1]===i.value())return;d(!0);const y=i.inputRef();y?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),y?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},{defer:!0})),ne(()=>je(i.registerInput(s.id))),c(it,ie({as:"input",ref(g){var y=xt(i.setInputRef,o.ref);typeof y=="function"&&y(g)},type:"radio",get name(){return t.name()},get value(){return i.value()},get checked(){return i.isSelected()},get required(){return t.isRequired()},get disabled(){return i.isDisabled()},get readonly(){return t.isReadOnly()},get style(){return vr({...cc},o.style)},get"aria-labelledby"(){return a()},get"aria-describedby"(){return l()},onChange:f,onFocus:m,onBlur:h},()=>i.dataset(),s))}function nf(e){const t=Xi(),r=Ge({id:t.generateId("label")},e);return ne(()=>je(t.registerLabel(r.id))),c(it,ie({as:"label",get for(){return t.inputId()}},()=>t.dataset(),r))}function rf(e){return c(uc,ie({as:"span"},e))}function rx(e){let t;const r=`radiogroup-${nn()}`,i=Ge({id:r,orientation:"vertical"},e),[n,o,s]=$e(i,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],hc),[a,l]=ea({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:b=>n.onChange?.(b)}),{formControlContext:u}=pc(o);ta(()=>t,()=>l(n.defaultValue??""));const d=()=>u.getAriaLabelledBy(Ce(o.id),s["aria-label"],n["aria-labelledby"]),f=()=>u.getAriaDescribedBy(n["aria-describedby"]),m=b=>b===e.defaultValue,h=b=>b===a(),y={ariaDescribedBy:f,isDefaultValue:m,isSelectedValue:h,setSelectedValue:b=>{if(!(u.isReadOnly()||u.isDisabled())&&(l(b),t))for(const v of t.querySelectorAll("[type='radio']")){const w=v;w.checked=h(w.value)}}};return c(vc.Provider,{value:u,get children(){return c(Q1.Provider,{value:y,get children(){return c(it,ie({as:"div",ref(b){var v=xt(w=>t=w,n.ref);typeof v=="function"&&v(b)},role:"radiogroup",get id(){return Ce(o.id)},get"aria-invalid"(){return u.validationState()==="invalid"||void 0},get"aria-required"(){return u.isRequired()||void 0},get"aria-disabled"(){return u.isDisabled()||void 0},get"aria-readonly"(){return u.isReadOnly()||void 0},get"aria-orientation"(){return n.orientation},get"aria-labelledby"(){return d()},get"aria-describedby"(){return f()}},()=>u.dataset(),s))}})}})}var ja=Object.assign(rx,{Description:Li,ErrorMessage:zi,Item:tx,ItemControl:Qd,ItemDescription:ef,ItemIndicator:tf,ItemInput:nx,ItemLabel:nf,Label:rf}),ix=Rt();function ox(){const e=jt(ix);if(e===void 0)throw new Error("[kobalte]: `useSegmentedControlContext` must be used within a `SegmentedControl` component");return e}function o9(e){const t=ox(),[r,i]=$e(e,["style"]),[n,o]=ze(),[s,a]=ze(!1),l=()=>{const d=t.selectedItem();if(!d){o(void 0);return}o({width:`${d.offsetWidth}px`,height:`${d.offsetHeight}px`,transform:u(d),"transition-duration":s()?"0ms":void 0})},u=d=>{const f=getComputedStyle(d.parentElement),m=d.offsetLeft-Number.parseFloat(f.paddingLeft),h=d.offsetTop-Number.parseFloat(f.paddingTop);return`translate(${m}px, ${h}px)`};return ne(qe(t.selectedItem,()=>{a(!n()),l(),a(!1)})),Uo(t.root,()=>{$n(()=>{a(!0),l(),a(!1)})}),c(it,ie({as:"div",role:"presentation",get style(){return vr(n(),r.style)},get"data-resizing"(){return s()},get"data-orientation"(){return t.orientation()}},i))}var s9=e=>{const t=Ra(),r=ox(),[i,n]=$e(e,["ref"]),[o,s]=ze();return ne(()=>{const a=o();a&&t.isSelectedValue(e.value)&&r.setSelectedItem(a)}),c(ja.Item,ie({ref(a){var l=xt(s,i.ref);typeof l=="function"&&l(a)}},n))},a9=e=>{const t=Xi(),[r,i]=$e(e,["ref"]),[n,o]=ze();return ta(n,()=>{requestAnimationFrame(()=>{t.isDefault()&&t.select()})}),c(ja.ItemInput,ie({ref(s){var a=xt(o,r.ref);typeof a=="function"&&a(s)}},i))},l9=e=>{const t=ie({defaultValue:e.value,orientation:"horizontal"},e),[r,i]=$e(t,["ref"]),[n,o]=ze(),[s,a]=ze(),l={value:()=>i.value,defaultValue:()=>i.defaultValue,orientation:()=>i.orientation,root:n,selectedItem:s,setSelectedItem:a};return ne(()=>{l.value()||a(void 0)}),c(ix.Provider,{value:l,get children(){return c(ja,ie({ref(u){var d=xt(o,r.ref);typeof d=="function"&&d(u)}},i))}})},po=Object.assign(l9,{Description:Li,ErrorMessage:zi,Indicator:o9,Item:s9,ItemControl:Qd,ItemDescription:ef,ItemIndicator:tf,ItemInput:a9,ItemLabel:nf,Label:rf}),c9=I("<div role=presentation data-slot=radio-group-wrapper><div role=presentation data-slot=radio-group-items>"),u9=I("<span data-slot=radio-group-item-control>");function d9(e){const[t,r]=$e(e,["class","classList","options","current","defaultValue","value","label","onSelect","size","fill","pad"]),i=s=>t.value?t.value(s):String(s),n=s=>t.label?t.label(s):String(s),o=s=>t.options.find(a=>i(a)===s);return c(po,ie(r,{"data-component":"radio-group",get"data-size"(){return t.size??"medium"},get"data-fill"(){return t.fill?"":void 0},get"data-pad"(){return t.pad??"normal"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get value(){return Te(()=>!!t.current)()?i(t.current):void 0},get defaultValue(){return Te(()=>!!t.defaultValue)()?i(t.defaultValue):void 0},onChange:s=>t.onSelect?.(o(s)),get children(){var s=c9(),a=s.firstChild;return p(s,c(po.Indicator,{"data-slot":"radio-group-indicator"}),a),p(a,c(rt,{get each(){return t.options},children:l=>c(po.Item,{get value(){return i(l)},"data-slot":"radio-group-item",get"data-value"(){return i(l)},get children(){return[c(po.ItemInput,{"data-slot":"radio-group-item-input"}),c(po.ItemLabel,{"data-slot":"radio-group-item-label",get children(){var u=u9();return p(u,()=>n(l)),u}})]}})})),s}}))}var f9=I("<div>"),m9=I("<div class=pb-6>"),g9=I("<div data-slot=session-review-container>"),h9=I("<div data-component=session-review><div data-slot=session-review-header><div data-slot=session-review-title></div><div data-slot=session-review-actions>"),p9=I("<span data-slot=session-review-directory>"),v9=I("<button data-slot=session-review-view-button type=button>"),b9=I("<div data-slot=session-review-change-group data-type=added><span data-slot=session-review-change data-type=added>"),y9=I("<span data-slot=session-review-change data-type=removed>"),w9=I("<span data-slot=session-review-change data-type=modified>"),x9=I("<div data-slot=session-review-trigger-content><div data-slot=session-review-file-info><div data-slot=session-review-file-name-container><span data-slot=session-review-filename></span></div></div><div data-slot=session-review-trigger-actions><span data-slot=session-review-diff-chevron>"),_9=I('<div data-slot=session-review-diff-placeholder class="rounded-lg border border-border-weak-base bg-background-stronger/40"style=height:160px>'),$9=I("<div data-slot=session-review-large-diff><div data-slot=session-review-large-diff-title></div><div data-slot=session-review-large-diff-meta></div><div data-slot=session-review-large-diff-actions>"),S9=I("<div data-slot=session-review-diff-wrapper>");const Fg=500,Ng=300;function k9(e){return(()=>{var t=f9();return t.$$click=r=>r.stopPropagation(),t.$$mousedown=r=>r.stopPropagation(),p(t,c(ct,{gutter:4,placement:"bottom-end",get children(){return[c(ct.Trigger,{as:Pt,icon:"dot-grid",variant:"ghost",size:"small",class:"size-6 rounded-md",get"aria-label"(){return e.labels.moreLabel}}),c(ct.Portal,{get children(){return c(ct.Content,{get children(){return[c(ct.Item,{get onSelect(){return e.onEdit},get children(){return c(ct.ItemLabel,{get children(){return e.labels.editLabel}})}}),c(ct.Item,{get onSelect(){return e.onDelete},get children(){return c(ct.ItemLabel,{get children(){return e.labels.deleteLabel}})}})]}})}})]}})),t})()}function C9(e){const t=Ci(e);if(t)return`session-review-diff-${t}`}const I9=e=>{let t,r=0,i;const n=_t(),o=Ki(),s=new Map,a=new Map,[l,u]=We({open:[],visible:{},force:{},selection:null,commenting:null,opened:null}),d=()=>l.selection,f=()=>l.commenting,m=()=>l.opened,h=()=>e.open??l.open,g=$(()=>e.diffs.map(T=>T.file));$(()=>new Map(e.diffs.map(T=>[T.file,T])));const y=$(()=>{const T=new Map;for(const M of e.comments??[]){const U=T.get(M.file);if(U){U.push(M);continue}T.set(M.file,[M])}return T}),b=()=>e.diffStyle??(e.split?"split":"unified"),v=()=>g().length>0,w=()=>{if(i=void 0,!t)return;const T=t.getBoundingClientRect(),M=T.top-Ng,U=T.bottom+Ng,A=new Set(h()),j={};for(const[V,Q]of a){if(!A.has(V))continue;const ee=Q.getBoundingClientRect();ee.bottom<M||ee.top>U||(j[V]=!0)}const P=kt(()=>l.visible),B=Object.keys(P),R=Object.keys(j);B.length===R.length&&R.every(V=>P[V])||u("visible",j)},x=()=>{i===void 0&&(i=requestAnimationFrame(w))},_=T=>e.focusedComment?.file===T||e.focusedFile===T||d()?.file===T||f()?.file===T||m()?.file===T,k=T=>{x();const M=e.onScroll;if(M){if(Array.isArray(M)){const[U,A]=M;U(A,T);return}M(T)}};je(()=>{i!==void 0&&cancelAnimationFrame(i)}),ne(()=>{e.open,g(),x()});const C=T=>{e.onOpenChange?.(T),e.open===void 0&&u("open",T),x()},O=()=>{const T=h().length>0?[]:g();C(T)},z=()=>n.t("ui.sessionReview.openFile"),K=T=>T.endSide??T.side??"additions",J=(T,M)=>{const A=K(M)==="deletions"?T.before:T.after;if(!(typeof A!="string"||A.length===0))return ia(A,M)};return ne(()=>{const T=e.focusedComment;T&&kt(()=>{r++;const M=r;u("opened",T);const U=(e.comments??[]).find(P=>P.file===T.file&&P.id===T.id);U&&u("selection",{file:U.file,range:Ii(U.selection)});const A=h();A.includes(T.file)||C([...A,T.file]);const j=P=>{if(M!==r)return;const B=t;if(!B)return;const R=s.get(T.file),V=R?.querySelector(`[data-comment-id="${T.id}"]`),Q=V instanceof HTMLElement&&V.style.pointerEvents!=="none"&&V.style.opacity!=="0",ee=Q?V:R;if(!ee){if(P>=120)return;requestAnimationFrame(()=>j(P+1));return}const oe=B.getBoundingClientRect(),le=ee.getBoundingClientRect(),W=le.top-oe.top,D=B.scrollTop+W-oe.height/2+le.height/2;B.scrollTop=Math.max(0,D),!Q&&(P>=120||requestAnimationFrame(()=>j(P+1)))};requestAnimationFrame(()=>j(0)),requestAnimationFrame(()=>e.onFocusedCommentChange?.(null))})}),(()=>{var T=h9(),M=T.firstChild,U=M.firstChild,A=U.nextSibling;return p(U,(()=>{var j=Te(()=>e.title===void 0);return()=>j()?n.t("ui.sessionReview.title"):e.title})()),p(A,c(F,{get when(){return Te(()=>!!v())()&&e.onDiffStyleChange},get children(){return c(d9,{options:["unified","split"],get current(){return b()},size:"small",value:j=>j,label:j=>n.t(j==="unified"?"ui.sessionReview.diffStyle.unified":"ui.sessionReview.diffStyle.split"),onSelect:j=>j&&e.onDiffStyleChange?.(j)})}}),null),p(A,c(F,{get when(){return v()},get children(){return c(vt,{size:"small",icon:"chevron-grabber-vertical",class:"w-[106px] justify-start",onClick:O,get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return h().length>0},get children(){return n.t("ui.sessionReview.collapseAll")}}),c(Xe,{when:!0,get children(){return n.t("ui.sessionReview.expandAll")}})]}})}})}}),null),p(A,()=>e.actions,null),p(T,c(va,{"data-slot":"session-review-scroll",viewportRef:j=>{t=j,e.scrollRef?.(j),x()},onScroll:k,get classList(){return{[e.classes?.root??""]:!!e.classes?.root}},get children(){var j=g9();return p(j,c(F,{get when(){return v()},get fallback(){return e.empty},get children(){var P=m9();return p(P,c(Kt,{multiple:!0,get value(){return h()},onChange:C,get children(){return c(rt,{get each(){return e.diffs},children:B=>{const R=B.file,V=$(()=>h().includes(R)),Q=$(()=>V()&&(!!l.visible[R]||_(R))),ee=()=>!!l.force[R],oe=$(()=>y().get(R)??[]),le=$(()=>oe().map(G=>G.selection)),W=()=>typeof B.before=="string"?B.before:"",D=()=>typeof B.after=="string"?B.after:"",te=()=>B.additions+B.deletions,H=$(()=>a_(R)),Z=$(()=>!V()||ee()||H()?!1:te()>Fg),se=()=>B.status==="added"||W().length===0&&D().length>0,re=()=>B.status==="deleted"||D().length===0&&W().length>0,fe=$(()=>{const G=d();return!G||G.file!==R?null:G.range}),Se=$(()=>{const G=f();return!G||G.file!==R?null:G.range}),Ne=J1({comments:oe,label:n.t("ui.lineComment.submit"),draftKey:()=>R,mention:e.lineCommentMention,state:{opened:()=>{const G=m();return!G||G.file!==R?null:G.id},setOpened:G=>u("opened",G?{file:R,id:G}:null),selected:fe,setSelected:G=>u("selection",G?{file:R,range:G}:null),commenting:Se,setCommenting:G=>u("commenting",G?{file:R,range:G}:null)},getSide:K,clearSelectionOnSelectionEndNull:!1,onSubmit:({comment:G,selection:we})=>{e.onLineComment?.({file:R,selection:we,comment:G,preview:J(B,we)})},onUpdate:({id:G,comment:we,selection:ke})=>{e.onLineCommentUpdate?.({id:G,file:R,selection:ke,comment:we,preview:J(B,ke)})},onDelete:G=>{e.onLineCommentDelete?.({id:G.id,file:R})},editSubmitLabel:e.lineCommentActions?.saveLabel,renderCommentActions:e.lineCommentActions?(G,we)=>c(k9,{get labels(){return e.lineCommentActions},get onEdit(){return we.edit},get onDelete(){return we.remove}}):void 0});je(()=>{s.delete(R),a.delete(R),x()});const ce=G=>{e.onLineComment&&Ne.onLineSelected(G)},ye=G=>{e.onLineComment&&Ne.onLineSelectionEnd(G)};return c(Kt.Item,{value:R,get id(){return C9(R)},"data-file":R,"data-slot":"session-review-accordion-item",get"data-selected"(){return e.focusedFile===R?"":void 0},get children(){return[c(Wo,{get children(){return c(Kt.Trigger,{get children(){var G=x9(),we=G.firstChild,ke=we.firstChild,ue=ke.firstChild,me=we.nextSibling,Ue=me.firstChild;return p(we,c(Sn,{node:{path:R,type:"file"}}),ke),p(ke,c(F,{get when(){return R.includes("/")},get children(){var be=p9();return p(be,()=>`‪${Ri(R)}‬`),be}}),ue),p(ue,()=>Qt(R)),p(ke,c(F,{get when(){return e.onViewFile},get children(){return c(Et,{get value(){return z()},placement:"top",gutter:4,get children(){var be=v9();return be.$$click=Be=>{Be.stopPropagation(),e.onViewFile?.(R)},p(be,c(bt,{name:"open-file",size:"small"})),Ae(()=>Ie(be,"aria-label",z())),be}})}}),null),p(me,c(Gt,{get children(){return[c(Xe,{get when(){return se()},get children(){var be=b9(),Be=be.firstChild;return p(Be,()=>n.t("ui.sessionReview.change.added")),p(be,c(pr,{changes:B}),null),be}}),c(Xe,{get when(){return re()},get children(){var be=y9();return p(be,()=>n.t("ui.sessionReview.change.removed")),be}}),c(Xe,{get when(){return!!H()},get children(){var be=w9();return p(be,()=>n.t("ui.sessionReview.change.modified")),be}}),c(Xe,{when:!0,get children(){return c(pr,{changes:B})}})]}}),Ue),p(Ue,c(bt,{name:"chevron-down",size:"small"})),G}})}}),c(Kt.Content,{"data-slot":"session-review-accordion-content",get children(){var G=S9();return ut(we=>{s.set(R,we),a.set(R,we),x()},G),p(G,c(F,{get when(){return V()},get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return Te(()=>!Q())()&&!Z()},get children(){return _9()}}),c(Xe,{get when(){return Z()},get children(){var we=$9(),ke=we.firstChild,ue=ke.nextSibling,me=ue.nextSibling;return p(ke,()=>n.t("ui.sessionReview.largeDiff.title")),p(ue,()=>n.t("ui.sessionReview.largeDiff.meta",{limit:Fg.toLocaleString(),current:te().toLocaleString()})),p(me,c(vt,{size:"normal",variant:"secondary",onClick:()=>u("force",R,!0),get children(){return n.t("ui.sessionReview.largeDiff.renderAnyway")}})),we}}),c(Xe,{when:!0,get children(){return c(Jn,{component:o,mode:"diff",get preloadedDiff(){return B.preloaded},get diffStyle(){return b()},onRendered:()=>{e.onDiffRendered?.()},get enableLineSelection(){return e.onLineComment!=null},get enableHoverUtility(){return e.onLineComment!=null},onLineSelected:ce,onLineSelectionEnd:ye,get onLineNumberSelectionEnd(){return Ne.onLineNumberSelectionEnd},get annotations(){return Ne.annotations()},get renderAnnotation(){return Ne.renderAnnotation},get renderHoverUtility(){return Te(()=>!!e.onLineComment)()?Ne.renderHoverUtility:void 0},get selectedLines(){return fe()},get commentedLines(){return le()},get before(){return{name:R,contents:typeof B.before=="string"?B.before:""}},get after(){return{name:R,contents:typeof B.after=="string"?B.after:""}},get media(){return{mode:"auto",path:R,before:B.before,after:B.after,readFile:e.readFile}}})}})]}})}})),G}})]}})}})}})),P}})),Ae(()=>Jt(j,e.classes?.container)),j}}),null),Ae(j=>{var P=e.class,B=e.classList,R=e.classes?.header;return P!==j.e&&Jt(T,j.e=P),j.t=Ct(T,B,j.t),R!==j.a&&Jt(M,j.a=R),j},{e:void 0,t:void 0,a:void 0}),T})()};Ot(["mousedown","click"]);function T9(e){let t,r,i=!1,n;const o=Rn(),s=or(),a=async m=>o.client.file.read({path:m}).then(h=>h.data).catch(h=>{console.debug("[session-review] failed to read file",{path:m,error:h})}),l=()=>{i=!0,r!==void 0&&(cancelAnimationFrame(r),r=void 0)},u=()=>{r=void 0;const m=t;if(!m||!s.ready()||i||m.clientHeight===0||m.clientWidth===0)return;const h=e.view().scroll("review");if(!h||h.x===0&&h.y===0)return;const g=Math.max(0,m.scrollHeight-m.clientHeight),y=Math.max(0,m.scrollWidth-m.clientWidth),b=Math.min(h.y,g),v=Math.min(h.x,y);m.scrollTop===b&&m.scrollLeft===v||(m.scrollTop!==b&&(m.scrollTop=b),m.scrollLeft!==v&&(m.scrollLeft=v),n={x:m.scrollLeft,y:m.scrollTop})},d=()=>{i||r!==void 0||(r=requestAnimationFrame(u))},f=m=>{const h=m.currentTarget,g=n;if(g&&h.scrollTop===g.y&&h.scrollLeft===g.x){n=void 0;return}n=void 0,l(),s.ready()&&(h.clientHeight===0||h.clientWidth===0||e.view().setScroll("review",{x:h.scrollLeft,y:h.scrollTop}))};return ne(()=>{e.diffs().length,e.diffStyle,s.ready()&&d()}),je(()=>{r!==void 0&&cancelAnimationFrame(r)}),c(I9,{get title(){return e.title},get empty(){return e.empty},scrollRef:m=>{t=m,ln(m,"wheel",l,{passive:!0,capture:!0}),ln(m,"mousewheel",l,{passive:!0,capture:!0}),ln(m,"pointerdown",l,{passive:!0,capture:!0}),ln(m,"touchstart",l,{passive:!0,capture:!0}),ln(m,"keydown",l,{capture:!0}),e.onScrollRef?.(m),d()},onScroll:f,onDiffRendered:d,get open(){return e.view().review.open()},get onOpenChange(){return e.view().review.setOpen},get classes(){return{root:e.classes?.root??"pr-3",header:e.classes?.header??"px-3",container:e.classes?.container??"pl-3"}},get diffs(){return e.diffs()},get diffStyle(){return e.diffStyle},get onDiffStyleChange(){return e.onDiffStyleChange},get onViewFile(){return e.onViewFile},get focusedFile(){return e.focusedFile},readFile:a,get onLineComment(){return e.onLineComment},get onLineCommentUpdate(){return e.onLineCommentUpdate},get onLineCommentDelete(){return e.onLineCommentDelete},get lineCommentActions(){return e.lineCommentActions},get lineCommentMention(){return e.commentMentions},get comments(){return e.comments},get focusedComment(){return e.focusedComment},get onFocusedCommentChange(){return e.onFocusedCommentChange}})}const D9=(e,t)=>{e.session.restore(t)};var A9=I("<span>"),P9=I('<span class="shrink-0 w-4 text-center text-12-medium">'),O9=I('<div class="shrink-0 size-1.5 mr-1.5 rounded-full">'),E9=I("<div data-component=filetree>"),M9=I('<div class="size-4 flex items-center justify-center text-icon-weak">'),z9=I("<div>"),L9=I('<div class="w-4 shrink-0">'),F9=I('<span class="filetree-iconpair size-4">'),N9=I('<div class="px-2 py-1 text-12-regular text-text-weak">...');const R9=128;function j9(e){return`file://${l_(e)}`}function U9(e){return!(e.level!==0||e.dir?.loaded||e.dir?.loading)}function K9(e){return e.level!==0?[]:e.filter?[...e.filter.dirs].filter(t=>!e.expanded(t)):[]}const V9=e=>e==="add"?"A":e==="del"?"D":"M",ic=e=>e==="add"?"color: var(--icon-diff-add-base)":e==="del"?"color: var(--icon-diff-delete-base)":"color: var(--icon-diff-modified-base)",B9=e=>e==="add"?"background-color: var(--icon-diff-add-base)":e==="del"?"background-color: var(--icon-diff-delete-base)":"background-color: var(--icon-diff-modified-base)",sx=(e,t,r)=>{const i=t?.get(e.path);if(i&&r?.has(e.path))return i},Z9=e=>{const t=e.querySelector('[data-component="file-icon"]')??e.querySelector("svg"),r=e.querySelector("span");if(!t||!r)return;const i=document.createElement("div");return i.className="flex items-center gap-x-2 px-2 py-1 bg-surface-raised-base rounded-md border border-border-base text-12-regular text-text-strong",i.style.position="absolute",i.style.top="-1000px",i.innerHTML=t.outerHTML+r.outerHTML,i},H9=e=>{const t=Z9(e.currentTarget);t&&(document.body.appendChild(t),e.dataTransfer?.setDragImage(t,0,12),setTimeout(()=>document.body.removeChild(t),0))},Rg=e=>{const[t,r]=$e(e,["node","level","active","nodeClass","draggable","kinds","marks","as","children","class","classList"]),i=()=>sx(t.node,t.kinds,t.marks),n=()=>!!i()&&!t.node.ignored,o=()=>{const s=i();if(s)return ic(s)};return c(Jn,ie({get component(){return t.as??"div"},get classList(){return{"w-full min-w-0 h-6 flex items-center justify-start gap-x-1.5 rounded-md px-1.5 py-0 text-left hover:bg-surface-raised-base-hover active:bg-surface-base-active transition-colors cursor-pointer":!0,"bg-surface-base-active":t.node.path===t.active,...t.classList??{},[t.class??""]:!!t.class,[t.nodeClass??""]:!!t.nodeClass}},get style(){return`padding-left: ${Math.max(0,8+t.level*12-(t.node.type==="file"?24:4))}px`},get draggable(){return t.draggable},onDragStart:s=>{t.draggable&&(s.dataTransfer?.setData("text/plain",`file:${t.node.path}`),s.dataTransfer?.setData("text/uri-list",j9(t.node.path)),s.dataTransfer&&(s.dataTransfer.effectAllowed="copy"),H9(s))}},r,{get children(){return[Te(()=>t.children),(()=>{var s=A9();return p(s,()=>t.node.name),Ae(a=>{var l={"flex-1 min-w-0 text-12-medium whitespace-nowrap truncate":!0,"text-text-weaker":t.node.ignored,"text-text-weak":!t.node.ignored&&!n()},u=n()?o():void 0;return a.e=Ct(s,l,a.e),a.t=gr(s,u,a.t),a},{e:void 0,t:void 0}),s})(),Te(()=>(()=>{const s=i();return s?t.node.type==="file"?(()=>{var a=P9();return p(a,()=>V9(s)),Ae(l=>gr(a,ic(s),l)),a})():(()=>{var a=O9();return Ae(l=>gr(a,B9(s),l)),a})():null})())]}}))};function oc(e){const t=jr(),r=e.level??0,i=()=>e.draggable??!0,n=f=>t.normalize(f).replace(/[\\/]+$/,"").replaceAll("\\","/"),o=e._chain?[...e._chain,n(e.path)]:[n(e.path)],s=$(()=>{if(e._filter)return e._filter;const f=e.allowed;if(!f)return;const m=new Set(f),h=new Set;for(const g of f){const b=g.split("/").slice(0,-1);for(const[v]of b.entries()){const w=b.slice(0,v+1).join("/");w&&h.add(w)}}return{files:m,dirs:h}}),a=$(()=>{if(e._marks)return e._marks;const f=new Set;for(const m of e.modified??[])f.add(m);for(const m of e.kinds?.keys()??[])f.add(m);if(f.size!==0)return f}),l=$(()=>e._kinds?e._kinds:e.kinds),u=$(()=>{if(e._deeps)return e._deeps;const f=new Map,m=e.path;if(!(t.tree.state(m)?.expanded??!1))return f;const h=new Set,g=[],y=(b,v)=>{const w=n(b);if(h.has(w))return;h.add(w);const x=t.tree.children(b).filter(_=>_.type==="directory"&&(t.tree.state(_.path)?.expanded??!1)).map(_=>_.path);g.push({dir:b,lvl:v,i:0,kids:x,max:v})};for(y(m,r-1);g.length>0;){const b=g[g.length-1];if(b.i<b.kids.length){const w=b.kids[b.i];b.i++,y(w,b.lvl+1);continue}f.set(b.dir,b.max),g.pop();const v=g[g.length-1];v&&(v.max=Math.max(v.max,b.max))}return f});ne(()=>{const f=s(),m=K9({level:r,filter:f,expanded:h=>kt(()=>t.tree.state(h)?.expanded)??!1});for(const h of m)t.tree.expand(h)}),ne(qe(()=>e.path,f=>{const m=kt(()=>t.tree.state(f));U9({level:r,dir:m})&&t.tree.list(f)},{defer:!1}));const d=$(()=>{const f=t.tree.children(e.path),m=s();if(!m)return f;const h=v=>{const w=v.lastIndexOf("/");return w===-1?"":v.slice(0,w)},g=v=>{const w=v.lastIndexOf("/");return w===-1?v:v.slice(w+1)},y=f.filter(v=>v.type==="file"?m.files.has(v.path):m.dirs.has(v.path)),b=new Set(y.map(v=>v.path));for(const v of m.dirs)h(v)===e.path&&(b.has(v)||(y.push({name:g(v),path:v,absolute:v,type:"directory",ignored:!1}),b.add(v)));for(const v of m.files)h(v)===e.path&&(b.has(v)||(y.push({name:g(v),path:v,absolute:v,type:"file",ignored:!1}),b.add(v)));return y.sort((v,w)=>v.type!==w.type?v.type==="directory"?-1:1:v.name.localeCompare(w.name)),y});return(()=>{var f=E9();return p(f,c(rt,{get each(){return d()},children:m=>{const h=()=>t.tree.state(m.path)?.expanded??!1,g=()=>u().get(m.path)??-1,y=()=>sx(m,l(),a()),b=()=>!!y()&&!m.ignored;return c(Gt,{get children(){return[c(Xe,{get when(){return m.type==="directory"},get children(){return c(en,{variant:"ghost",class:"w-full","data-scope":"filetree",forceMount:!1,get open(){return h()},onOpenChange:v=>v?t.tree.expand(m.path):t.tree.collapse(m.path),get children(){return[c(en.Trigger,{get children(){return c(Rg,{node:m,level:r,get active(){return e.active},get nodeClass(){return e.nodeClass},get draggable(){return i()},get kinds(){return l()},get marks(){return a()},get children(){var v=M9();return p(v,c(bt,{get name(){return h()?"chevron-down":"chevron-right"},size:"small"})),v}})}}),c(en.Content,{class:"relative pt-0.5",get children(){return[(()=>{var v=z9();return Ae(w=>{var x={"absolute top-0 bottom-0 w-px pointer-events-none bg-border-weak-base opacity-0 transition-opacity duration-150 ease-out motion-reduce:transition-none":!0,"group-hover/filetree:opacity-100":h()&&g()===r,"group-hover/filetree:opacity-50":!(h()&&g()===r)},_=`left: ${Math.max(0,8+r*12-4)+8}px`;return w.e=Ct(v,x,w.e),w.t=gr(v,_,w.t),w},{e:void 0,t:void 0}),v})(),c(F,{get when(){return r<R9&&!o.includes(n(m.path))},get fallback(){return N9()},get children(){return c(oc,{get path(){return m.path},level:r+1,get allowed(){return e.allowed},get modified(){return e.modified},get kinds(){return e.kinds},get active(){return e.active},get draggable(){return e.draggable},get onFileClick(){return e.onFileClick},get _filter(){return s()},get _marks(){return a()},get _deeps(){return u()},get _kinds(){return l()},_chain:o})}})]}})]}})}}),c(Xe,{get when(){return m.type==="file"},get children(){return c(Rg,{node:m,level:r,get active(){return e.active},get nodeClass(){return e.nodeClass},get draggable(){return i()},get kinds(){return l()},get marks(){return a()},as:"button",type:"button",onClick:()=>e.onFileClick?.(m),get children(){return[L9(),c(Gt,{get children(){return[c(Xe,{get when(){return m.ignored},get children(){return c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--mono",style:"color: var(--icon-weak-base)",mono:!0})}}),c(Xe,{get when(){return b()},get children(){return c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--mono",get style(){return ic(y())},mono:!0})}}),c(Xe,{get when(){return!m.ignored},get children(){var v=F9();return p(v,c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--color opacity-0 group-hover/filetree:opacity-100"}),null),p(v,c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--mono group-hover/filetree:opacity-0",mono:!0}),null),v}})]}})]}})}})]}})}})),Ae(()=>Jt(f,`flex flex-col gap-0.5 ${e.class??""}`)),f})()}const q9=e=>{if(!(e.scrollWidth<=e.prevScrollWidth)){if(!e.prevContextOpen&&e.contextOpen)return 0;if(!(e.scrollWidth<=e.clientWidth))return e.scrollWidth-e.clientWidth}},G9=e=>{let t,r=e.el.scrollWidth,i=e.contextOpen();const n=()=>{const l=e.el.scrollWidth,u=e.el.clientWidth,d=e.contextOpen(),f=q9({prevScrollWidth:r,scrollWidth:l,clientWidth:u,prevContextOpen:i,contextOpen:d});f!==void 0&&e.el.scrollTo({left:f,behavior:"smooth"}),r=l,i=d},o=()=>{t!==void 0&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{t=void 0,n()})},s=l=>{Math.abs(l.deltaY)<=Math.abs(l.deltaX)||(e.el.scrollLeft+=l.deltaY>0?50:-50,l.preventDefault())};e.el.addEventListener("wheel",s,{passive:!1});const a=new MutationObserver(o);return a.observe(e.el,{childList:!0}),()=>{e.el.removeEventListener("wheel",s),a.disconnect(),t!==void 0&&cancelAnimationFrame(t)}};var W9=I("<div>"),X9=I('<div class="relative overflow-hidden pb-40">'),Y9=I('<div class="px-6 py-4 text-text-weak">...'),J9=I('<div class="px-6 py-4 text-text-weak">');function Q9(e){return(()=>{var t=W9();return t.$$click=r=>r.stopPropagation(),t.$$mousedown=r=>r.stopPropagation(),p(t,c(ct,{gutter:4,placement:"bottom-end",get children(){return[c(ct.Trigger,{as:Pt,icon:"dot-grid",variant:"ghost",size:"small",class:"size-6 rounded-md",get"aria-label"(){return e.moreLabel}}),c(ct.Portal,{get children(){return c(ct.Content,{get children(){return[c(ct.Item,{get onSelect(){return e.onEdit},get children(){return c(ct.ItemLabel,{get children(){return e.editLabel}})}}),c(ct.Item,{get onSelect(){return e.onDelete},get children(){return c(ct.ItemLabel,{get children(){return e.deleteLabel}})}})]}})}})]}})),t})()}function eN(e){let t,r,i,n;const[o,s]=ze([]),a=()=>{const y=t;if(!y)return[];const b=y.querySelector("diffs-container");if(!(b instanceof HTMLElement))return[];const v=b.shadowRoot;return v?Array.from(v.querySelectorAll("[data-code]")).filter(w=>w instanceof HTMLElement&&w.clientWidth>0):[]},l=y=>{n=y,r===void 0&&(r=requestAnimationFrame(()=>{r=void 0;const b=n;n=void 0,b&&e.view().setScroll(e.tab(),b)}))},u=y=>{const b=t;if(!b)return;const v=y.currentTarget;v instanceof HTMLElement&&l({x:v.scrollLeft,y:b.scrollTop})},d=()=>{const y=a(),b=o();y.length===b.length&&y.every((v,w)=>v===b[w])||s(y)},f=()=>{const y=t;if(!y)return;const b=e.view().scroll(e.tab());if(b){if(d(),o().length>0)for(const v of o())v.scrollLeft!==b.x&&(v.scrollLeft=b.x);y.scrollTop!==b.y&&(y.scrollTop=b.y),!(o().length>0)&&y.scrollLeft!==b.x&&(y.scrollLeft=b.x)}},m=()=>{i===void 0&&(i=requestAnimationFrame(()=>{i=void 0,f()}))},h=y=>{o().length===0&&d(),l({x:o()[0]?.scrollLeft??y.currentTarget.scrollLeft,y:y.currentTarget.scrollTop})};ne(()=>{for(const y of o())ln(y,"scroll",u)});const g=y=>{t=y,f()};return je(()=>{r!==void 0&&cancelAnimationFrame(r),i!==void 0&&cancelAnimationFrame(i)}),{handleScroll:h,queueRestore:m,setViewport:g}}function tN(e){const t=jr(),r=_c(),i=_t(),n=Ui(),o=Ki(),{sessionKey:s,tabs:a,view:l}=_r(),u=qo({tabs:a,pathFromTab:t.pathFromTab,normalizeTab:P=>P.startsWith("file://")?t.tab(P):P}).activeFileTab;let d=null;const f={register:P=>{d=P}},m=$(()=>t.pathFromTab(e.tab)),h=$(()=>{const P=m();if(P)return t.get(P)}),g=$(()=>h()?.content?.content??""),y=$(()=>c_(g())),b=$(()=>{const P=m();return P?t.ready()?t.selectedLines(P)??null:lh(s())?.files[P]??null:null}),v=eN({tab:()=>e.tab,view:l}),w=(P,B)=>ia(P,{start:B.startLine,end:B.endLine}),x=(P,B)=>{const R=P===m()?g():t.get(P)?.content?.content;if(R)return w(R,B)},_=P=>{const B=Ao(P.selection),R=P.preview??x(P.file,B),V=r.add({file:P.file,selection:P.selection,comment:P.comment});n.context.add({type:"file",path:P.file,selection:B,comment:P.comment,commentID:V.id,commentOrigin:P.origin,preview:R})},k=P=>{r.update(P.file,P.id,P.comment);const B=P.file===m()?x(P.file,Ao(P.selection)):void 0;n.context.updateComment(P.file,P.id,{comment:P.comment,...B?{preview:B}:{}})},C=P=>{r.remove(P.file,P.id),n.context.removeComment(P.file,P.id)},O=$(()=>{const P=m();return P?r.list(P):[]}),z=$(()=>O().map(P=>P.selection)),[K,J]=We({openedComment:null,commenting:null,selected:null}),T=P=>{const B=m();B&&t.setSelectedLines(B,P?Ii(P):null)},M=()=>K.selected??b(),U=J1({comments:O,label:i.t("ui.lineComment.submit"),draftKey:()=>m()??e.tab,mention:{items:t.searchFilesAndDirectories},state:{opened:()=>K.openedComment,setOpened:P=>J("openedComment",P),selected:()=>K.selected,setSelected:P=>J("selected",P),commenting:()=>K.commenting,setCommenting:P=>J("commenting",P),syncSelected:T,hoverSelected:T},getHoverSelectedRange:M,cancelDraftOnCommentToggle:!0,clearSelectionOnSelectionEndNull:!0,onSubmit:({comment:P,selection:B})=>{const R=m();R&&_({file:R,selection:B,comment:P,origin:"file"})},onUpdate:({id:P,comment:B,selection:R})=>{const V=m();V&&k({id:P,file:V,selection:R,comment:B})},onDelete:P=>{const B=m();B&&C({id:P.id,file:B})},editSubmitLabel:i.t("common.save"),renderCommentActions:(P,B)=>c(Q9,{get moreLabel(){return i.t("common.moreOptions")},get editLabel(){return i.t("common.edit")},get deleteLabel(){return i.t("common.delete")},get onEdit(){return B.edit},get onDelete(){return B.remove}})});ne(()=>{if(typeof window>"u")return;ln(window,"keydown",B=>{u()===e.tab&&(!(B.metaKey||B.ctrlKey)||B.altKey||B.shiftKey||B.key.toLowerCase()==="f"&&(B.preventDefault(),B.stopPropagation(),d?.focus()))},{capture:!0})}),ne(qe(m,()=>{U.note.reset()},{defer:!0})),ne(()=>{const P=r.focus(),B=m();if(!P||!B||P.file!==B||u()!==e.tab)return;const R=O().find(V=>V.id===P.id);R&&(U.note.openComment(R.id,R.selection,{cancelDraft:!0}),requestAnimationFrame(()=>r.clearFocus()))});let A={loaded:!1,ready:!1,active:!1};ne(()=>{const P=!!h()?.loaded,B=t.ready(),R=u()===e.tab,V=P&&!A.loaded||B&&!A.ready||R&&P&&!A.active;A={loaded:P,ready:B,active:R},V&&v.queueRestore()});const j=P=>(()=>{var B=X9();return p(B,c(Jn,{component:o,mode:"text",get file(){return{name:m()??"",contents:P,cacheKey:y()}},enableLineSelection:!0,enableHoverUtility:!0,get selectedLines(){return M()},get commentedLines(){return z()},onRendered:()=>{v.queueRestore()},get annotations(){return U.annotations()},get renderAnnotation(){return U.renderAnnotation},get renderHoverUtility(){return U.renderHoverUtility},onLineSelected:R=>{U.onLineSelected(R)},get onLineNumberSelectionEnd(){return U.onLineNumberSelectionEnd},onLineSelectionEnd:R=>{U.onLineSelectionEnd(R)},search:f,class:"select-text",get media(){return{mode:"auto",path:m(),current:h()?.content,onLoad:v.queueRestore,onError:R=>{R.kind==="svg"&&Nt({variant:"error",title:i.t("toast.file.loadFailed.title")})}}}})),B})();return c(Lt.Content,{get value(){return e.tab},class:"mt-3 relative h-full",get children(){return c(va,{class:"h-full",get viewportRef(){return v.setViewport},get onScroll(){return v.handleScroll},get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return h()?.loaded},get children(){return j(g())}}),c(Xe,{get when(){return h()?.loading},get children(){var P=Y9(),B=P.firstChild;return p(P,()=>i.t("common.loading"),B),P}}),c(Xe,{get when(){return h()?.error},children:P=>(()=>{var B=J9();return p(B,P),B})()})]}})}})}})}Ot(["mousedown","click"]);var nN=I('<div class="h-full flex flex-col"><div class="h-6 shrink-0"aria-hidden></div><div class="flex-1 pb-64 flex items-center justify-center text-center"><div class="text-12-regular text-text-weak">'),jg=I("<div>"),rN=I('<div class="flex items-center gap-1.5"><div>'),iN=I('<div class="flex items-center gap-2"><div>'),oN=I('<div class="bg-background-stronger h-full shrink-0 sticky right-0 z-10 flex items-center justify-center pr-3">'),sN=I('<div class="sticky top-0 shrink-0 flex">'),aN=I('<div class="relative pt-2 flex-1 min-h-0 overflow-hidden"><div class="h-full px-6 pb-42 -mt-4 flex flex-col items-center justify-center text-center gap-6"><div class="text-14-regular text-text-weak max-w-56">'),lN=I('<div class="relative pt-2 flex-1 min-h-0 overflow-hidden">'),cN=I('<aside id=review-panel class="relative min-w-0 h-full flex shrink-0 overflow-hidden bg-background-base"><div class="size-full flex border-l border-border-weaker-base"><div class="relative min-w-0 h-full flex-1 overflow-hidden bg-background-base"><div class="size-full min-w-0 h-full bg-background-base"></div></div><div id=file-tree-panel class="relative min-w-0 h-full shrink-0 overflow-hidden"><div class="h-full flex flex-col overflow-hidden group/filetree">'),uN=I("<div data-component=tabs-drag-preview>"),dN=I('<div class="px-2 py-2 text-12-regular text-text-weak">');function fN(e){const t=or(),r=jr(),i=_t(),n=br(),{sessionKey:o,tabs:s,view:a}=_r(),l=$c("(min-width: 768px)"),u=$(()=>l()&&a().reviewPanel.opened()),d=$(()=>l()&&t.fileTree.opened()),f=$(()=>u()||d()),m=$(()=>l()),h=$(()=>f()?u()?`calc(100% - ${t.session.width()}px)`:`${t.fileTree.width()}px`:"0px"),g=$(()=>d()?`${t.fileTree.width()}px`:"0px"),y=$(()=>e.diffs().map(V=>V.file)),b=$(()=>{const V=(oe,le)=>oe?oe===le?oe:"mix":le,Q=oe=>oe.replaceAll("\\\\","/").replace(/\/+$/,""),ee=new Map;for(const oe of e.diffs()){const le=Q(oe.file),W=oe.status==="added"?"add":oe.status==="deleted"?"del":"mix";ee.set(le,W);const D=le.split("/");for(const[te]of D.slice(0,-1).entries()){const H=D.slice(0,te+1).join("/");H&&ee.set(H,V(ee.get(H),W))}}return ee}),v=V=>(()=>{var Q=nN(),ee=Q.firstChild,oe=ee.nextSibling,le=oe.firstChild;return p(le,V),Q})(),w=$(()=>r.tree.state("")?.loaded?r.tree.children("").length===0:!1),x=V=>V.startsWith("file://")?r.tab(V):V,_=()=>{a().reviewPanel.opened()||a().reviewPanel.open()},k=ES({normalizeTab:x,openTab:s().open,pathFromTab:r.pathFromTab,loadFile:r.load,openReviewPanel:_,setActive:s().setActive}),C=qo({tabs:s,pathFromTab:r.pathFromTab,normalizeTab:x,review:m,hasReview:e.canReview}),O=C.contextOpen,z=C.openedTabs,K=C.activeTab,J=C.activeFileTab,T=()=>t.fileTree.tab(),M=V=>{V!=="changes"&&V!=="all"||t.fileTree.setTab(V)},U=()=>{T()==="changes"&&t.fileTree.setTab("all")},[A,j]=We({activeDraggable:void 0}),P=V=>{const Q=zs(V);Q&&j("activeDraggable",Q)},B=V=>{const{draggable:Q,droppable:ee}=V;if(!Q||!ee)return;const oe=s().all(),le=MS(oe,Q.id.toString(),ee.id.toString());le!==void 0&&s().move(Q.id.toString(),le)},R=()=>{j("activeDraggable",void 0)};return ne(()=>{r.ready()&&ch(o(),{files:s().all().reduce((V,Q)=>{const ee=r.pathFromTab(Q);if(!ee)return V;const oe=r.selectedLines(ee);return V[ee]=oe&&typeof oe=="object"&&"start"in oe&&"end"in oe?oe:null,V},{})})}),c(F,{get when(){return l()},get children(){var V=cN(),Q=V.firstChild,ee=Q.firstChild,oe=ee.firstChild,le=ee.nextSibling,W=le.firstChild;return p(oe,c(gh,{onDragStart:P,onDragEnd:R,onDragOver:B,collisionDetector:fh,get children(){return[c(hh,{}),c(wh,{}),c(Lt,{get value(){return K()},onChange:k,get children(){return[(()=>{var D=sN();return p(D,c(Lt.List,{ref:te=>{const H=G9({el:te,contextOpen:O});je(H)},get children(){return[c(F,{get when(){return Te(()=>!!m())()&&e.canReview()},get children(){return c(Lt.Trigger,{value:"review",get children(){var te=rN(),H=te.firstChild;return p(H,()=>i.t("session.tab.review")),p(te,c(F,{get when(){return e.hasReview()},get children(){var Z=jg();return p(Z,()=>e.reviewCount()),Z}}),null),te}})}}),c(F,{get when(){return O()},get children(){return c(Lt.Trigger,{value:"context",get closeButton(){return c(Et,{get value(){return i.t("common.closeTab")},placement:"bottom",gutter:10,get children(){return c(Pt,{icon:"close-small",variant:"ghost",class:"h-5 w-5",onClick:()=>s().close("context"),get"aria-label"(){return i.t("common.closeTab")}})}})},hideCloseButton:!0,onMiddleClick:()=>s().close("context"),get children(){var te=iN(),H=te.firstChild;return p(te,c(m1,{variant:"indicator"}),H),p(H,()=>i.t("session.tab.context")),te}})}}),c(bh,{get ids(){return z()},get children(){return c(rt,{get each(){return z()},children:te=>c(NI,{tab:te,get onTabClose(){return s().close}})})}}),(()=>{var te=oN();return p(te,c(Et,{get value(){return i.t("command.file.open")},class:"flex items-center",get children(){return c(Pt,{icon:"plus-small",variant:"ghost",iconSize:"large",class:"!rounded-md",onClick:()=>{Bn(()=>import("./dialog-select-file-BnW7C137.js"),__vite__mapDeps([4,1,2,3,5])).then(H=>{n.show(()=>c(H.DialogSelectFile,{mode:"files",onOpenFile:U}))})},get"aria-label"(){return i.t("command.file.open")}})}})),te})()]}})),D})(),c(F,{get when(){return Te(()=>!!m())()&&e.canReview()},get children(){return c(Lt.Content,{value:"review",class:"flex flex-col h-full overflow-hidden contain-strict",get children(){return c(F,{get when(){return K()==="review"},get children(){return e.reviewPanel()}})}})}}),c(Lt.Content,{value:"empty",class:"flex flex-col h-full overflow-hidden contain-strict",get children(){return c(F,{get when(){return K()==="empty"},get children(){var D=aN(),te=D.firstChild,H=te.firstChild;return p(te,c(sh,{class:"w-14 opacity-10"}),H),p(H,()=>i.t("session.files.selectToOpen")),D}})}}),c(F,{get when(){return O()},get children(){return c(Lt.Content,{value:"context",class:"flex flex-col h-full overflow-hidden contain-strict",get children(){return c(F,{get when(){return K()==="context"},get children(){var D=lN();return p(D,c(kI,{})),D}})}})}}),c(F,{get when(){return J()},keyed:!0,children:D=>c(tN,{tab:D})})]}}),c(ph,{get children(){return c(F,{get when(){return A.activeDraggable},keyed:!0,children:D=>{const te=r.pathFromTab(D);return(()=>{var H=uN();return p(H,c(F,{when:te,children:Z=>c(rv,{active:!0,get path(){return Z()}})})),H})()}})}})]}})),p(W,c(Lt,{variant:"pill",get value(){return T()},onChange:M,class:"h-full","data-scope":"filetree",get children(){return[c(Lt.List,{get children(){return[c(Lt.Trigger,{value:"changes",class:"flex-1",classes:{button:"w-full"},get children(){return[Te(()=>e.reviewCount())," ",Te(()=>i.t(e.reviewCount()===1?"session.review.change.one":"session.review.change.other"))]}}),c(Lt.Trigger,{value:"all",class:"flex-1",classes:{button:"w-full"},get children(){return i.t("session.files.all")}})]}}),c(Lt.Content,{value:"changes",class:"bg-background-stronger px-3 py-0",get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return e.hasReview()||!e.diffsReady()},get children(){return c(F,{get when(){return e.diffsReady()},get fallback(){return(()=>{var D=dN();return p(D,()=>i.t("common.loading"),null),p(D,()=>i.t("common.loading.ellipsis"),null),D})()},get children(){return c(oc,{path:"",class:"pt-3",get allowed(){return y()},get kinds(){return b()},draggable:!1,get active(){return e.activeDiff},onFileClick:D=>e.focusReviewDiff(D.path)})}})}}),c(Xe,{when:!0,get children(){return v(e.empty())}})]}})}}),c(Lt.Content,{value:"all",class:"bg-background-stronger px-3 py-0",get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return w()},get children(){return v(i.t("session.files.empty"))}}),c(Xe,{when:!0,get children(){return c(oc,{path:"",class:"pt-3",get modified(){return y()},get kinds(){return b()},onFileClick:D=>k(r.tab(D.path))})}})]}})}})]}})),p(le,c(F,{get when(){return d()},get children(){var D=jg();return D.$$pointerdown=()=>e.size.start(),p(D,c(Cc,{direction:"horizontal",edge:"start",get size(){return t.fileTree.width()},min:200,max:480,onResize:te=>{e.size.touch(),t.fileTree.resize(te)}})),D}}),null),Ae(D=>{var te=i.t("session.panel.reviewAndFiles"),H=!f(),Z=!f(),se={"pointer-events-none":!f(),"transition-[width] duration-[240ms] ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":!e.size.active()&&!e.reviewSnap},re=h(),fe=!u(),Se=!u(),Ne=!u(),ce=!d(),ye=!d(),G={"pointer-events-none":!d(),"transition-[width] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":!e.size.active()},we=g(),ke={"border-l border-border-weaker-base":u()};return te!==D.e&&Ie(V,"aria-label",D.e=te),H!==D.t&&Ie(V,"aria-hidden",D.t=H),Z!==D.a&&(V.inert=D.a=Z),D.o=Ct(V,se,D.o),re!==D.i&&ft(V,"width",D.i=re),fe!==D.n&&Ie(ee,"aria-hidden",D.n=fe),Se!==D.s&&(ee.inert=D.s=Se),Ne!==D.h&&ee.classList.toggle("pointer-events-none",D.h=Ne),ce!==D.r&&Ie(le,"aria-hidden",D.r=ce),ye!==D.d&&(le.inert=D.d=ye),D.l=Ct(le,G,D.l),we!==D.u&&ft(le,"width",D.u=we),D.c=Ct(W,ke,D.c),D},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0}),V}})}Ot(["pointerdown"]);const sc=e=>typeof e=="object"&&e!==null,vl=e=>!(!sc(e)||typeof e.length!="number"||typeof e.cursorX!="number"||typeof e.cursorY!="number"||typeof e.baseY!="number"||typeof e.viewportY!="number"||typeof e.getLine!="function"||typeof e.getNullCell!="function"),Ug=e=>{if(!sc(e))return;const t=e.buffer;if(!sc(t))return;const r=vl(t.active)?t.active:void 0,i=vl(t.normal)?t.normal:void 0,n=vl(t.alternate)?t.alternate:void 0;if(!(!r&&!i))return{active:r,normal:i,alternate:n}};function ac(e,t,r){return Math.max(t,Math.min(e,r))}function mN(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function gN(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function hN(e,t){return!!e.isInverse()==!!t.isInverse()&&!!e.isBold()==!!t.isBold()&&!!e.isUnderline()==!!t.isUnderline()&&!!e.isBlink()==!!t.isBlink()&&!!e.isInvisible()==!!t.isInvisible()&&!!e.isItalic()==!!t.isItalic()&&!!e.isDim()==!!t.isDim()&&!!e.isStrikethrough()==!!t.isStrikethrough()}class pN{constructor(t){this._buffer=t}serialize(t,r){let i=this._buffer.getNullCell();const n=t.start.y,o=t.end.y,s=t.start.x,a=t.end.x;this._beforeSerialize(o-n+1,n,o);for(let l=n;l<=o;l++){const u=this._buffer.getLine(l);if(u){const d=l===t.start.y?s:0,f=Math.min(a,u.length);for(let m=d;m<f;m++){const h=u.getCell(m);h&&(this._nextCell(h,i,l,m),i=h)}}this._rowEnd(l,l===o)}return this._afterSerialize(),this._serializeString(r)}_nextCell(t,r,i,n){}_rowEnd(t,r){}_beforeSerialize(t,r,i){}_afterSerialize(){}_serializeString(t){return""}}class vN extends pN{constructor(t,r){super(t),this._terminal=r,this._cursorStyle=this._buffer.getNullCell()}_rowIndex=0;_allRows=[];_allRowSeparators=[];_currentRow="";_nullCellCount=0;_cursorStyle;_firstRow=0;_lastCursorRow=0;_lastCursorCol=0;_lastContentCursorRow=0;_lastContentCursorCol=0;_beforeSerialize(t,r,i){this._allRows=new Array(t),this._allRowSeparators=new Array(t),this._rowIndex=0,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){let i="";const o=!!(r?void 0:this._buffer.getLine(t+1))?.isWrapped;this._nullCellCount>0&&o&&(this._currentRow+=" ".repeat(this._nullCellCount)),this._nullCellCount=0,!r&&!o&&(i=`\r
69
+ `+u:""}`}),[o,s]=ze(!1),a=async()=>{const l=n();l&&(await navigator.clipboard.writeText(l),s(!0),setTimeout(()=>s(!1),2e3))};return c(un,ie(e,{icon:"console",allowPendingToggle:!0,get trigger(){return(()=>{var l=yL(),u=l.firstChild,d=u.firstChild;return p(d,c(hn,{get text(){return t.t("ui.tool.shell")},get active(){return r()}})),p(u,c(F,{get when(){return Te(()=>!r())()&&e.input.description},get children(){return c(DL,{get text(){return e.input.description},animate:i})}}),null),l})()},get children(){return[(()=>{var l=bL(),u=l.firstChild,d=u.nextSibling,f=d.firstChild,m=f.firstChild;return p(u,c(Et,{get value(){return Te(()=>!!o())()?t.t("ui.message.copied"):t.t("ui.message.copy")},placement:"top",gutter:4,get children(){return c(Pt,{get icon(){return o()?"check":"copy"},size:"small",variant:"secondary",onMouseDown:h=>h.preventDefault(),onClick:a,get"aria-label"(){return Te(()=>!!o())()?t.t("ui.message.copied"):t.t("ui.message.copy")}})}})),p(m,n),l})(),c(sn,{get input(){return e.input}})]}}))}});_n.register({name:"edit",render(e){const t=yt(),r=Ki(),i=$(()=>E1(e.metadata.diagnostics,e.input.filePath)),n=$(()=>e.metadata?.filediff?.file||e.input.filePath||""),o=()=>Qt(e.input.filePath??""),s=()=>e.status==="pending"||e.status==="running";return(()=>{var a=xL();return p(a,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return(()=>{var l=O1(),u=l.firstChild,d=u.firstChild,f=d.firstChild,m=u.nextSibling;return p(f,c(hn,{get text(){return t.t("ui.messagePart.title.edit")},get active(){return s()}})),p(d,c(F,{get when(){return!s()},get children(){var h=Wd();return p(h,o),h}}),null),p(u,c(F,{get when(){return Te(()=>!s())()&&e.input.filePath?.includes("/")},get children(){var h=Xd(),g=h.firstChild;return p(g,()=>Yn(e.input.filePath)),h}}),null),p(m,c(F,{get when(){return Te(()=>!s())()&&e.metadata.filediff},get children(){return c(pr,{get changes(){return e.metadata.filediff}})}})),l})()},get children(){return[c(F,{get when(){return n()},get children(){return c(Jd,{get path(){return n()},get actions(){return c(F,{get when(){return Te(()=>!s())()&&e.metadata.filediff},get children(){return c(pr,{get changes(){return e.metadata.filediff}})}})},get children(){var l=wL();return p(l,c(Jn,{component:r,mode:"diff",get before(){return{name:e.metadata?.filediff?.file||e.input.filePath,contents:e.metadata?.filediff?.before||e.input.oldString}},get after(){return{name:e.metadata?.filediff?.file||e.input.filePath,contents:e.metadata?.filediff?.after||e.input.newString}}})),l}})}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}}),c(M1,{get diagnostics(){return i()}})]}}))),a})()}});_n.register({name:"write",render(e){const t=yt(),r=Ki(),i=$(()=>E1(e.metadata.diagnostics,e.input.filePath)),n=$(()=>e.input.filePath||""),o=()=>Qt(e.input.filePath??""),s=()=>e.status==="pending"||e.status==="running";return(()=>{var a=$L();return p(a,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return(()=>{var l=SL(),u=l.firstChild,d=u.firstChild,f=d.firstChild;return p(f,c(hn,{get text(){return t.t("ui.messagePart.title.write")},get active(){return s()}})),p(d,c(F,{get when(){return!s()},get children(){var m=Wd();return p(m,o),m}}),null),p(u,c(F,{get when(){return Te(()=>!s())()&&e.input.filePath?.includes("/")},get children(){var m=Xd(),h=m.firstChild;return p(h,()=>Yn(e.input.filePath)),m}}),null),l})()},get children(){return[c(F,{get when(){return Te(()=>!!e.input.content)()&&n()},get children(){return c(Jd,{get path(){return n()},get children(){var l=_L();return p(l,c(Jn,{component:r,mode:"text",get file(){return{name:e.input.filePath,contents:e.input.content,cacheKey:Ci(e.input.content)}},overflow:"scroll"})),l}})}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}}),c(M1,{get diagnostics(){return i()}})]}}))),a})()}});_n.register({name:"apply_patch",render(e){const t=yt(),r=Ki(),i=$(()=>e.metadata.files??[]),n=$(()=>e.status==="pending"||e.status==="running"),o=$(()=>{const d=i();if(d.length===1)return d[0]}),[s,a]=ze([]);let l=!1;ne(()=>{const d=i();d.length!==0&&(l||(l=!0,a(d.filter(f=>f.type!=="delete").map(f=>f.filePath))))});const u=$(()=>{const d=i().length;return d===0?"":`${d} ${t.t(d>1?"ui.common.file.other":"ui.common.file.one")}`});return c(F,{get when(){return o()},get fallback(){return(()=>{var d=_g();return p(d,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.patch"),subtitle:u()}},get children(){return[c(F,{get when(){return i().length>0},get children(){return c(Kt,{multiple:!0,"data-scope":"apply-patch",style:{"--sticky-accordion-offset":"40px"},get value(){return s()},onChange:f=>a(Array.isArray(f)?f:f?[f]:[]),get children(){return c(rt,{get each(){return i()},children:f=>{const m=$(()=>s().includes(f.filePath)),[h,g]=ze(!1);return ne(()=>{if(!m()){g(!1);return}requestAnimationFrame(()=>{m()&&g(!0)})}),c(Kt.Item,{get value(){return f.filePath},get"data-type"(){return f.type},get children(){return[c(Wo,{get children(){return c(Kt.Trigger,{get children(){var y=A1(),b=y.firstChild,v=b.firstChild,w=v.firstChild,x=b.nextSibling;return p(b,c(Sn,{get node(){return{path:f.relativePath,type:"file"}}}),v),p(v,c(F,{get when(){return f.relativePath.includes("/")},get children(){var _=D1();return p(_,()=>`‪${Yn(f.relativePath)}‬`),_}}),w),p(w,()=>Qt(f.relativePath)),p(x,c(Gt,{get children(){return[c(Xe,{get when(){return f.type==="add"},get children(){var _=$g();return p(_,()=>t.t("ui.patch.action.created")),_}}),c(Xe,{get when(){return f.type==="delete"},get children(){var _=Sg();return p(_,()=>t.t("ui.patch.action.deleted")),_}}),c(Xe,{get when(){return f.type==="move"},get children(){var _=kg();return p(_,()=>t.t("ui.patch.action.moved")),_}}),c(Xe,{when:!0,get children(){return c(pr,{get changes(){return{additions:f.additions,deletions:f.deletions}}})}})]}}),null),p(x,c(bt,{name:"chevron-grabber-vertical",size:"small"}),null),y}})}}),c(Kt.Content,{get children(){return c(F,{get when(){return h()},get children(){var y=xg();return p(y,c(Jn,{component:r,mode:"diff",get before(){return{name:f.filePath,contents:f.before}},get after(){return{name:f.movePath??f.filePath,contents:f.after}}})),y}})}})]}})}})}})}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))),d})()},get children(){var d=_g();return p(d,c(un,ie(e,{icon:"code-lines",defer:!0,allowPendingToggle:!0,get trigger(){return(()=>{var f=O1(),m=f.firstChild,h=m.firstChild,g=h.firstChild,y=m.nextSibling;return p(g,c(hn,{get text(){return t.t("ui.tool.patch")},get active(){return n()}})),p(h,c(F,{get when(){return!n()},get children(){var b=Wd();return p(b,()=>Qt(o().relativePath)),b}}),null),p(m,c(F,{get when(){return Te(()=>!n())()&&o().relativePath.includes("/")},get children(){var b=Xd(),v=b.firstChild;return p(v,()=>Yn(o().relativePath)),b}}),null),p(y,c(F,{get when(){return!n()},get children(){return c(pr,{get changes(){return{additions:o().additions,deletions:o().deletions}}})}})),f})()},get children(){return[c(Jd,{get path(){return o().relativePath},get actions(){return c(Gt,{get children(){return[c(Xe,{get when(){return o().type==="add"},get children(){var f=$g();return p(f,()=>t.t("ui.patch.action.created")),f}}),c(Xe,{get when(){return o().type==="delete"},get children(){var f=Sg();return p(f,()=>t.t("ui.patch.action.deleted")),f}}),c(Xe,{get when(){return o().type==="move"},get children(){var f=kg();return p(f,()=>t.t("ui.patch.action.moved")),f}}),c(Xe,{when:!0,get children(){return c(pr,{get changes(){return{additions:o().additions,deletions:o().deletions}}})}})]}})},get children(){var f=xg();return p(f,c(Jn,{component:r,mode:"diff",get before(){return{name:o().filePath,contents:o().before}},get after(){return{name:o().movePath??o().filePath,contents:o().after}}})),f}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))),d}})}});_n.register({name:"todowrite",render(e){const t=yt(),r=$(()=>{const n=e.metadata?.todos;if(Array.isArray(n))return n;const o=e.input.todos;return Array.isArray(o)?o:[]}),i=$(()=>{const n=r();return n.length===0?"":`${n.filter(o=>o.status==="completed").length}/${n.length}`});return c(un,ie(e,{defaultOpen:!0,icon:"checklist",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.todos"),subtitle:i()}},get children(){return[c(F,{get when(){return r().length},get children(){var n=kL();return p(n,c(rt,{get each(){return r()},children:o=>c(_1,{readOnly:!0,get checked(){return o.status==="completed"},get children(){var s=CL();return p(s,()=>o.content),Ae(()=>Ie(s,"data-completed",o.status==="completed"?"completed":void 0)),s}})})),n}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"question",render(e){const t=yt(),r=$(()=>e.input.questions??[]),i=$(()=>e.metadata.answers??[]),n=$(()=>i().length>0),o=$(()=>{const s=r().length;return s===0?"":n()?t.t("ui.question.subtitle.answered",{count:s}):`${s} ${t.t(s>1?"ui.common.question.other":"ui.common.question.one")}`});return c(un,ie(e,{icon:"bubble-5",allowPendingToggle:!0,get trigger(){return{title:t.t("ui.tool.questions"),subtitle:o()}},get children(){return[c(F,{get when(){return n()},get children(){var s=IL();return p(s,c(rt,{get each(){return r()},children:(a,l)=>{const u=()=>i()[l()]??[];return(()=>{var d=TL(),f=d.firstChild,m=f.nextSibling;return p(f,()=>a.question),p(m,()=>u().join(", ")||t.t("ui.question.answer.none")),d})()}})),s}}),c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})]}}))}});_n.register({name:"skill",render(e){const t=yt(),r=$(()=>e.input.name||t.t("ui.tool.skill")),i=$(()=>e.status==="pending"||e.status==="running"),n=()=>c(hn,{get text(){return r()},get active(){return i()}}),o=()=>(()=>{var s=P1(),a=s.firstChild,l=a.firstChild;return p(l,n),s})();return c(un,{icon:"brain",get status(){return e.status},get trigger(){return o()},get hideDetails(){return e.hideDetails},get defaultOpen(){return e.defaultOpen},allowPendingToggle:!0,get children(){return c(sn,{get input(){return e.input},get liveOutput(){return e.liveOutput},get output(){return e.output},get error(){return e.error}})}})}});Ot(["click"]);var YL=I('<div data-slot=session-turn-retry-message class="cursor-help truncate">'),JL=I('<div class="flex items-start gap-2"><div class=min-w-0>'),QL=I("<div data-slot=session-turn-retry>"),eF=I("<div data-slot=session-turn-retry-message>"),tF=I("<div data-slot=session-turn-retry-info>");function nF(e){const t=_t(),r=$(()=>{if(e.status.type==="retry")return e.status}),[i,n]=ze(0);ne(qe(r,l=>{if(!l)return;const u=()=>{const f=r()?.next;f&&n(Math.round((f-Date.now())/1e3))};u();const d=setInterval(u,1e3);je(()=>clearInterval(d))}));const o=$(()=>{const l=r();return l?l.message.length>80?l.message.slice(0,80)+"...":l.message:""}),s=$(()=>{const l=r();return l?l.message.length>80:!1}),a=$(()=>{const l=r();if(!l)return"";const u=Math.max(0,i()),d=u>0?t.t("ui.sessionTurn.retry.inSeconds",{seconds:u}):"",m=[t.t("ui.sessionTurn.retry.retrying"),d].filter(Boolean).join(" ");return m?t.t("ui.sessionTurn.retry.attemptLine",{line:m,attempt:l.attempt}):t.t("ui.sessionTurn.retry.attempt",{attempt:l.attempt})});return c(F,{get when(){return Te(()=>!!r())()&&(e.show??!0)},get children(){var l=QL();return p(l,c(qd,{variant:"error",class:"error-card",get children(){var u=JL(),d=u.firstChild;return p(u,c(Ap,{class:"size-4 mt-0.5"}),d),p(d,c(F,{get when(){return s()},get fallback(){return(()=>{var f=eF();return p(f,o),f})()},get children(){return c(Et,{get value(){return r()?.message??""},placement:"top",get children(){var f=YL();return p(f,o),f}})}}),null),p(d,c(F,{get when(){return a()},children:f=>(()=>{var m=tF();return p(m,f),m})()}),null),u}})),l}})}var rF=I("<div data-slot=session-turn-compaction>"),iF=I("<div data-slot=session-turn-assistant-content>"),oF=I("<div data-slot=session-turn-thinking>"),sF=I("<span data-slot=session-turn-diffs-toggle>"),aF=I("<div data-slot=session-turn-diffs-more>"),lF=I("<div data-slot=session-turn-diffs data-component=session-turn-diffs-group><div data-slot=session-turn-diffs-header><span data-slot=session-turn-diffs-label> <!> </span></div><div data-component=session-turn-diffs-content>"),cF=I("<div data-slot=session-turn-message-container><div data-slot=session-turn-message-content aria-live=off>"),uF=I("<div data-component=session-turn><div data-slot=session-turn-content><div>"),dF=I("<span data-slot=session-turn-diff-directory>"),fF=I("<div data-slot=session-turn-diff-trigger><span data-slot=session-turn-diff-path><span data-slot=session-turn-diff-filename></span></span><div data-slot=session-turn-diff-meta><span data-slot=session-turn-diff-changes></span><span data-slot=session-turn-diff-chevron>"),mF=I("<div data-slot=session-turn-diff-view data-scrollable>");function Dg(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ag(e){const t=e.replace(/^Error:\s*/,"").trim(),r=l=>{try{return JSON.parse(l)}catch{return}},i=l=>{const u=r(l);return typeof u!="string"?u:r(u.trim())};let n=i(t);if(n===void 0){const l=t.indexOf("{"),u=t.lastIndexOf("}");l!==-1&&u>l&&(n=i(t.slice(l,u+1)))}if(!Dg(n))return e;const o=Dg(n.error)?n.error:void 0;if(o){const l=typeof o.type=="string"?o.type:void 0,u=typeof o.message=="string"?o.message:void 0;if(l&&u)return`${l}: ${u}`;if(u)return u;if(l)return l;const d=typeof o.code=="string"?o.code:void 0;if(d)return d}const s=typeof n.message=="string"?n.message:void 0;if(s)return s;const a=typeof n.error=="string"?n.error:void 0;return a||e}function gF(e,t){return e===t?!0:e.length!==t.length?!1:e.every((r,i)=>r===t[i])}function Cs(e,t){return Array.isArray(e)?e:t}const hF=new Set(["todowrite"]);function pF(e,t){if(e.type==="tool")return hF.has(e.tool)||e.tool==="question"&&(e.state.status==="pending"||e.state.status==="running")?void 0:"visible";if(e.type==="text")return e.text?.trim()?"visible":void 0;if(e.type==="reasoning")return t&&e.text?.trim()?"visible":void 0;if(hi[e.type])return"visible"}function vF(e){const t=yr(),r=_t(),i=Ki(),n=[],o=[],s=[],a=[],l={type:"idle"},u=$(()=>e.messages??Cs(t.store.message?.[e.sessionID],n)),d=$(()=>{const H=u()??n,Z=Ms.search(H,e.messageID,fe=>fe.id),se=Z.found?Z.index:H.findIndex(fe=>fe.id===e.messageID);if(se<0)return-1;const re=H[se];return!re||re.role!=="user"?-1:se}),f=$(()=>{const H=d();if(H<0)return;const se=(u()??n)[H];if(!(!se||se.role!=="user"))return se}),m=$(()=>typeof e.active=="boolean"?void 0:(u()??n).findLast(Z=>Z.role==="assistant"&&typeof Z.time.completed!="number")),h=$(()=>{const H=m();if(!H?.parentID)return;const Z=u()??n,se=Ms.search(Z,H.parentID,fe=>fe.id),re=se.found?Z[se.index]:Z.find(fe=>fe.id===H.parentID);if(!(!re||re.role!=="user"))return re}),g=$(()=>{if(typeof e.active=="boolean")return e.active;const H=f(),Z=h();return!H||!Z?!1:Z.id===H.id}),y=$(()=>{const H=f();return H?Cs(t.store.part?.[H.id],o):o}),b=$(()=>y().find(H=>H.type==="compaction")),v=$(()=>{const H=f()?.summary?.diffs;if(!H?.length)return a;const Z=new Set;return H.reduceRight((se,re)=>(Z.has(re.file)||(Z.add(re.file),se.push(re)),se),[]).reverse()}),w=10,x=$(()=>v().length),[_,k]=We({showAll:!1,expanded:[]}),C=()=>_.showAll,O=()=>_.expanded,z=$(()=>Math.max(0,x()-w)),K=$(()=>C()?v():v().slice(0,w)),J=()=>{te.pause(),k("showAll",!C())},T=$(()=>{const H=f();if(!H)return s;const Z=u()??n,se=d();if(se<0)return s;const re=[];for(let fe=se+1;fe<Z.length;fe++){const Se=Z[fe];if(Se){if(Se.role==="user")break;Se.role==="assistant"&&Se.parentID===H.id&&re.push(Se)}}return re},s,{equals:gF}),M=$(()=>T().some(H=>H.error?.name==="MessageAbortedError")),U=$(()=>b()?r.t("ui.messagePart.compaction"):M()?r.t("ui.message.interrupted"):""),A=$(()=>T().find(H=>H.error&&H.error.name!=="MessageAbortedError")?.error),j=$(()=>{const H=T();for(let Z=H.length-1;Z>=0;Z--){const se=H[Z];if(!se)continue;const re=Cs(t.store.part?.[se.id],o);for(let fe=re.length-1;fe>=0;fe--){const Se=re[fe];if(!(!Se||Se.type!=="text"||!Se.text?.trim()))return Se.id}}}),P=$(()=>{const H=A()?.data?.message;return typeof H=="string"?Ag(H):H==null?"":Ag(String(H))}),B=$(()=>e.status!==void 0?e.status:typeof e.active=="boolean"&&!e.active?l:t.store.session_status[e.sessionID]??l),R=$(()=>B().type!=="idle"&&g()),V=$(()=>e.showReasoningSummaries??!0),Q=$(()=>R()?null:j()??null),ee=$(()=>{const H=f()?.time.created;if(typeof H!="number")return;const Z=T().reduce((se,re)=>{const fe=re.time.completed;return typeof fe!="number"?se:se===void 0?fe:Math.max(se,fe)},void 0);if(typeof Z=="number"&&!(Z<H))return Z-H}),oe=$(()=>{let H=0,Z;const se=V();for(const re of T())for(const fe of Cs(t.store.part?.[re.id],o))if(pF(fe,se)==="visible"&&H++,fe.type==="reasoning"&&fe.text){const Se=C1(fe.text);Se&&(Z=Se)}return{visible:H,reason:Z}}),le=$(()=>oe().visible),W=$(()=>oe().reason),D=$(()=>!R()||A()||B().type==="retry"?!1:V()?le()===0:!0),te=np({working:R,onUserInteracted:e.onUserInteracted,overflowAnchor:"dynamic"});return(()=>{var H=uF(),Z=H.firstChild,se=Z.firstChild;pt(Z,"scroll",te.handleScroll);var re=te.scrollRef;return typeof re=="function"?ut(re,Z):te.scrollRef=Z,pt(se,"click",te.handleInteraction,!0),p(se,c(F,{get when(){return f()},get children(){var fe=cF(),Se=fe.firstChild,Ne=te.contentRef;return typeof Ne=="function"?ut(Ne,fe):te.contentRef=fe,p(Se,c(H1,{get message(){return f()},get parts(){return y()},get actions(){return e.actions}})),p(fe,c(F,{get when(){return U()},get children(){var ce=rF();return p(ce,c(X1,{get label(){return U()}})),ce}}),null),p(fe,c(F,{get when(){return T().length>0},get children(){var ce=iF();return p(ce,c(jL,{get messages(){return T()},get showAssistantCopyPartID(){return Q()},get turnDurationMs(){return ee()},get working(){return R()},get showReasoningSummaries(){return V()},get shellToolDefaultOpen(){return e.shellToolDefaultOpen},get editToolDefaultOpen(){return e.editToolDefaultOpen}})),Ae(()=>Ie(ce,"aria-hidden",R())),ce}}),null),p(fe,c(F,{get when(){return D()},get children(){var ce=oF();return p(ce,c(hn,{get text(){return r.t("ui.sessionTurn.status.thinking")}}),null),p(ce,c(F,{get when(){return!V()},get children(){return c($1,{get text(){return W()},class:"session-turn-thinking-heading",travel:25,duration:700})}}),null),ce}}),null),p(fe,c(nF,{get status(){return B()},get show(){return g()}}),null),p(fe,c(F,{get when(){return Te(()=>x()>0)()&&!R()},get children(){var ce=lF(),ye=ce.firstChild,G=ye.firstChild,we=G.firstChild,ke=we.nextSibling;ke.nextSibling;var ue=ye.nextSibling;return p(G,x,we),p(G,()=>r.t("ui.sessionTurn.diffs.changed"),ke),p(G,()=>r.t(x()===1?"ui.common.file.one":"ui.common.file.other"),null),p(ye,c(pr,{get changes(){return v()}}),null),p(ye,c(F,{get when(){return z()>0},get children(){var me=sF();return me.$$click=J,p(me,(()=>{var Ue=Te(()=>!!C());return()=>Ue()?r.t("ui.sessionTurn.diffs.showLess"):r.t("ui.sessionTurn.diffs.showAll")})()),me}}),null),p(ue,c(Kt,{multiple:!0,style:{"--sticky-accordion-offset":"40px"},get value(){return O()},onChange:me=>k("expanded",Array.isArray(me)?me:me?[me]:[]),get children(){return c(rt,{get each(){return K()},children:me=>{const Ue=$(()=>O().includes(me.file)),[be,Be]=ze(!1);return ne(qe(Ue,E=>{if(!E){Be(!1);return}requestAnimationFrame(()=>{Ue()&&Be(!0)})},{defer:!0})),c(Kt.Item,{get value(){return me.file},get children(){return[c(Wo,{get children(){return c(Kt.Trigger,{get children(){var E=fF(),ae=E.firstChild,de=ae.firstChild,Ee=ae.nextSibling,Re=Ee.firstChild,ot=Re.nextSibling;return p(ae,c(F,{get when(){return me.file.includes("/")},get children(){var Pe=dF();return p(Pe,()=>`‪${Ri(me.file)}‬`),Pe}}),de),p(de,()=>Qt(me.file)),p(Re,c(pr,{changes:me})),p(ot,c(bt,{name:"chevron-down",size:"small"})),E}})}}),c(Kt.Content,{get children(){return c(F,{get when(){return be()},get children(){var E=mF();return p(E,c(Jn,{component:i,mode:"diff",get before(){return{name:me.file,contents:me.before}},get after(){return{name:me.file,contents:me.after}}})),E}})}})]}})}})}}),null),p(ue,c(F,{get when(){return Te(()=>!C())()&&z()>0},get children(){var me=aF();return me.$$click=J,p(me,()=>r.t("ui.sessionTurn.diffs.more",{count:String(z())})),me}}),null),Ae(()=>Ie(ce,"data-show-all",C()||void 0)),ce}}),null),p(fe,c(F,{get when(){return A()},get children(){return c(qd,{variant:"error",class:"error-card",get children(){return P()}})}}),null),Ae(ce=>{var ye=f().id,G=e.classes?.container;return ye!==ce.e&&Ie(fe,"data-message",ce.e=ye),G!==ce.t&&Jt(fe,ce.t=G),ce},{e:void 0,t:void 0}),fe}}),null),p(se,()=>e.children,null),Ae(fe=>{var Se=e.classes?.root,Ne=e.classes?.content;return Se!==fe.e&&Jt(H,fe.e=Se),Ne!==fe.t&&Jt(Z,fe.t=Ne),fe},{e:void 0,t:void 0}),H})()}Ot(["click"]);var bF=I('<div class="flex flex-col gap-4 pl-6 pr-2.5 pb-3"><div class="flex flex-col gap-1"><span class="text-14-regular text-text-strong"></span></div><div class="flex justify-end gap-2">'),yF=I('<div class="w-full flex justify-center">'),wF=I('<div class="min-w-0 w-full"><div role=log data-slot=session-turn-list class="flex flex-col items-start justify-start transition-[margin,padding] duration-200 ease-out">'),xF=I('<div class="relative w-full h-full min-w-0"><div class="absolute left-1/2 -translate-x-1/2 bottom-6 z-[60] pointer-events-none transition-all duration-200 ease-out"><button class="pointer-events-auto size-8 flex items-center justify-center rounded-full bg-background-base border border-border-base shadow-sm text-text-base hover:bg-background-stronger transition-colors">'),_F=I('<div class="relative h-full overflow-hidden">'),$F=I('<div class="pointer-events-auto flex min-w-0 w-full items-center justify-center gap-2 px-2">'),SF=I('<h1 data-action=session-title-heading class="text-14-medium text-text-strong truncate min-w-0 w-full text-center">'),kF=I('<div class="flex flex-col gap-2"><div class="grid grid-cols-2 gap-2">'),CF=I('<div class="flex flex-col p-3"><div class="flex flex-col gap-1"><div class="text-13-medium text-text-strong"></div><div class="text-12-regular text-text-weak"></div></div><div class="mt-3 flex flex-col gap-2">'),IF=I('<div class="pointer-events-auto flex shrink-0 items-center gap-2"><div class="hidden sm:flex">'),TF=I('<div class="w-full px-4 md:px-5 pb-2"><div class="ml-auto max-w-[82%] overflow-x-auto no-scrollbar"><div class="flex w-max min-w-full justify-end gap-2">'),DF=I("<div>"),AF=I('<div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2"><div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong"><span class=truncate></span></div><div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words">'),PF=I('<span class="shrink-0 text-text-weak">'),Pg=I('<div data-component=session-inline-question class="w-full px-4 md:px-5 pt-3">');const Og=[],Eg={type:"idle"},OF=e=>e.flatMap(t=>{if(t.type!=="text"||!t.synthetic)return[];const r=SA(t.metadata)??CA(t.text);return r?[{path:r.path,comment:r.comment,selection:r.selection?{startLine:r.selection.startLine,endLine:r.selection.endLine}:void 0}]:[]}),EF=(e,t)=>{const i=(t instanceof Element?t:void 0)?.closest("[data-scrollable]");return!i||i===e||!(i instanceof HTMLElement)?e:i},Mg=e=>{const t=EF(e.root,e.target);if(t===e.root){e.onMarkScrollGesture(e.root);return}QM({delta:e.delta,scrollTop:t.scrollTop,scrollHeight:t.scrollHeight,clientHeight:t.clientHeight})&&e.onMarkScrollGesture(e.root)};function MF(e){const[t,r]=We({activeSession:"",completedSession:"",count:0}),i=$(()=>{const l=e.messages().length;if(e.turnStart()<=0||t.completedSession===e.sessionKey())return l;const u=Math.min(l,e.config.init);return t.count<=u?u:t.count>=l?l:t.count}),n=$(()=>{const l=e.messages(),u=i();return u>=l.length?l:l.slice(Math.max(0,l.length-u))});let o;const s=()=>{o!==void 0&&(cancelAnimationFrame(o),o=void 0)};ne(qe(()=>[e.sessionKey(),e.turnStart()>0,e.messages().length],([l,u,d])=>{if(s(),!(u&&d>e.config.init&&t.completedSession!==l&&t.activeSession!==l)){r({activeSession:"",count:d});return}let m=Math.min(d,e.config.init);r({activeSession:l,count:m});const h=()=>{if(e.sessionKey()!==l){o=void 0;return}const g=e.messages().length;if(m=Math.min(g,m+e.config.batch),r("count",m),m>=g){r({completedSession:l,activeSession:""}),o=void 0;return}o=requestAnimationFrame(h)};o=requestAnimationFrame(h)}));const a=$(()=>{const l=e.sessionKey();return t.activeSession===l&&t.completedSession!==l});return je(s),{messages:n,isStaging:a}}function zF(e){let t;const r=ra(),i=r_(),n=Rn(),o=sr(),s=kc(),a=br(),l=_t(),{params:u,sessionKey:d}=Lc(),f=na(),m=$(()=>e.renderedUserMessages.map(G=>G.id)),h=$(()=>u.id),g=$(()=>{const G=h();return G?o.data.message[G]??Og:Og}),y=$(()=>g().findLast(G=>G.role==="assistant"&&typeof G.time.completed!="number")),b=$(()=>{const G=h();return G?o.data.session_status[G]??Eg:Eg}),v=$(()=>{const G=y()?.parentID;if(G){const ke=g(),ue=Ms.search(ke,G,Ue=>Ue.id),me=ue.found?ke[ue.index]:ke.find(Ue=>Ue.id===G);if(me&&me.role==="user")return me.id}if(b().type!=="idle"){const ke=g();for(let ue=ke.length-1;ue>=0;ue--)if(ke[ue].role==="user")return ke[ue].id}}),w=$(()=>{const G=h();if(G)return o.session.get(G)}),x=$(()=>w()?.title),_=$(()=>vf(x())),k=$(()=>w()?.share?.url),C=$(()=>o.data.config.share!=="disabled"),O=$(()=>w()?.parentID),z=$(()=>{const G=e.inlineQuestionRequest,we=v();return!G||!we?!1:m().includes(we)}),J=MF({sessionKey:d,turnStart:()=>e.turnStart,messages:()=>e.renderedUserMessages,config:{init:1,batch:3}}),[T,M]=We({draft:"",editing:!1,menuOpen:!1,pendingRename:!1,pendingShare:!1});let U;const[A,j]=We({open:!1,dismiss:null}),[P,B]=We({todoHeight:0}),R=$(()=>document.getElementById(So.leftLeading)),V=$(()=>document.getElementById(So.center)),Q=$(()=>document.getElementById(So.right));let ee;const oe=()=>{const G=k();G&&f.openLink(G)},le=G=>{if(G&&typeof G=="object"&&"data"in G){const we=G.data;if(we?.message)return we.message}return G instanceof Error?G.message:l.t("common.requestFailed")},W=Dr(()=>({mutationFn:G=>i.client.session.share({sessionID:G,directory:n.directory}),onError:G=>{console.error("Failed to share session",G)}})),D=Dr(()=>({mutationFn:G=>i.client.session.unshare({sessionID:G,directory:n.directory}),onError:G=>{console.error("Failed to unshare session",G)}})),te=Dr(()=>({mutationFn:G=>n.client.session.update({sessionID:G.id,title:G.title}),onSuccess:(G,we)=>{o.set(bf(ke=>{const ue=ke.session.findIndex(me=>me.id===we.id);ue!==-1&&(ke.session[ue].title=we.title)})),M("editing",!1)},onError:G=>{Nt({title:l.t("common.requestFailed"),description:le(G)})}})),H=()=>{const G=h();!G||W.isPending||C()&&W.mutate(G)},Z=()=>{const G=h();!G||D.isPending||C()&&D.mutate(G)};ne(qe(d,()=>M({draft:"",editing:!1,menuOpen:!1,pendingRename:!1,pendingShare:!1}),{defer:!0}));const se=()=>{h()&&(M({editing:!0,draft:_()??""}),requestAnimationFrame(()=>{U?.focus(),U?.select()}))},re=()=>{te.isPending||M("editing",!1)},fe=()=>{const G=h();if(!G||te.isPending)return;const we=T.draft.trim();if(!we||we===(_()??"")){M("editing",!1);return}te.mutate({id:G,title:we})},Se=(G,we,ke)=>{if(u.id===G){if(we){r(`/${u.dir}/session/${we}`);return}if(ke){r(`/${u.dir}/session/${ke}`);return}r(`/${u.dir}/session`)}},Ne=async G=>{const we=o.session.get(G);if(!we)return!1;const ke=(o.data.session??[]).filter(be=>!be.parentID&&!be.time?.archived),ue=ke.findIndex(be=>be.id===G),me=ue===-1?void 0:ke[ue+1]??ke[ue-1];return await n.client.session.delete({sessionID:G}).then(be=>be.data).catch(be=>(Nt({title:l.t("session.delete.failed.title"),description:le(be)}),!1))?(o.set(bf(be=>{const Be=new Set([G]),E=new Map;for(const de of be.session){const Ee=de.parentID;if(!Ee)continue;const Re=E.get(Ee);if(Re){Re.push(de.id);continue}E.set(Ee,[de.id])}const ae=[G];for(;ae.length;){const de=ae.pop();if(!de)continue;const Ee=E.get(de);if(Ee)for(const Re of Ee)Be.has(Re)||(Be.add(Re),ae.push(Re))}be.session=be.session.filter(de=>!Be.has(de.id))})),Se(G,we.parentID,me?.id),!0):!1},ce=()=>{const G=O();G&&r(`/${u.dir}/session/${G}`)};function ye(G){const we=$(()=>vf(o.session.get(G.sessionID)?.title)??l.t("command.session.new")),ke=async()=>{await Ne(G.sessionID),a.close()};return c(dh,{get title(){return l.t("session.delete.title")},fit:!0,get children(){var ue=bF(),me=ue.firstChild,Ue=me.firstChild,be=me.nextSibling;return p(Ue,()=>l.t("session.delete.confirm",{name:we()})),p(be,c(vt,{variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return l.t("common.cancel")}}),null),p(be,c(vt,{variant:"primary",size:"large",onClick:ke,get children(){return l.t("session.delete.button")}}),null),ue}})}return c(F,{get when(){return!e.mobileChanges},get fallback(){return(()=>{var G=_F();return p(G,()=>e.mobileFallback),G})()},get children(){var G=xF(),we=G.firstChild,ke=we.firstChild;return p(G,c(F,{get when(){return R()},children:ue=>c(F,{get when(){return O()},get children(){return c(hr,{get mount(){return ue()},get children(){return c(Pt,{tabIndex:-1,icon:"arrow-left",variant:"ghost",class:"titlebar-icon rounded-md",onClick:ce,get"aria-label"(){return l.t("common.goBack")}})}})}})}),we),p(G,c(F,{get when(){return V()},children:ue=>c(F,{get when(){return _()||T.editing},get children(){return c(hr,{get mount(){return ue()},get children(){var me=$F();return p(me,c(F,{get when(){return T.editing},get fallback(){return(()=>{var Ue=SF();return Ue.$$dblclick=se,p(Ue,_),Ue})()},get children(){return c(YM,{ref:Ue=>{U=Ue},get value(){return T.draft},get disabled(){return te.isPending},class:"text-14-medium text-text-strong min-w-0 w-full rounded-[6px] text-center",style:{"--inline-input-shadow":"var(--shadow-xs-border-select)"},onInput:Ue=>M("draft",Ue.currentTarget.value),onKeyDown:Ue=>{if(Ue.stopPropagation(),Ue.key==="Enter"){Ue.preventDefault(),fe();return}Ue.key==="Escape"&&(Ue.preventDefault(),re())},onBlur:re})}})),me}})}})}),we),p(G,c(F,{get when(){return Q()},children:ue=>c(F,{get when(){return h()},get children(){return c(hr,{get mount(){return ue()},get children(){var me=IF(),Ue=me.firstChild;return p(Ue,c(m1,{placement:"bottom"})),p(me,c(ct,{gutter:4,placement:"bottom-end",get open(){return T.menuOpen},onOpenChange:be=>{M("menuOpen",be)},get children(){return[c(ct.Trigger,{as:Pt,icon:"dot-grid",variant:"ghost",class:"titlebar-icon size-6 rounded-md data-[expanded]:bg-surface-base-active",get classList(){return{"bg-surface-base-active":A.open||T.pendingShare}},"data-action":"session-more-options",get"aria-label"(){return l.t("common.moreOptions")},get"aria-expanded"(){return T.menuOpen||A.open||T.pendingShare},ref:be=>{ee=be}}),c(ct.Portal,{get children(){return c(ct.Content,{style:{"min-width":"104px"},onCloseAutoFocus:be=>{if(T.pendingRename){be.preventDefault(),M("pendingRename",!1),se();return}T.pendingShare&&(be.preventDefault(),requestAnimationFrame(()=>{j({open:!0,dismiss:null}),M("pendingShare",!1)}))},get children(){return[c(ct.Item,{onSelect:()=>{M("pendingRename",!0),M("menuOpen",!1)},get children(){return c(ct.ItemLabel,{get children(){return l.t("common.rename")}})}}),c(F,{get when(){return C()},get children(){return c(ct.Item,{onSelect:()=>{M({pendingShare:!0,menuOpen:!1})},get children(){return c(ct.ItemLabel,{get children(){return l.t("session.share.action.share")}})}})}}),c(ct.Item,{onSelect:()=>a.show(()=>c(ye,{get sessionID(){return h()}})),get children(){return c(ct.ItemLabel,{get children(){return l.t("common.delete")}})}})]}})}})]}}),null),p(me,c(fr,{get open(){return A.open},anchorRef:()=>ee,placement:"bottom-end",gutter:4,modal:!1,onOpenChange:be=>{be&&j("dismiss",null),j("open",be)},get children(){return c(fr.Portal,{get children(){return c(fr.Content,{"data-component":"popover-content",style:{"min-width":"320px"},onEscapeKeyDown:be=>{j({dismiss:"escape",open:!1}),be.preventDefault(),be.stopPropagation()},onPointerDownOutside:()=>{j({dismiss:"outside",open:!1})},onFocusOutside:()=>{j({dismiss:"outside",open:!1})},onCloseAutoFocus:be=>{A.dismiss==="outside"&&be.preventDefault(),j("dismiss",null)},get children(){var be=CF(),Be=be.firstChild,E=Be.firstChild,ae=E.nextSibling,de=Be.nextSibling;return p(E,()=>l.t("session.share.popover.title")),p(ae,(()=>{var Ee=Te(()=>!!k());return()=>Ee()?l.t("session.share.popover.description.shared"):l.t("session.share.popover.description.unshared")})()),p(de,c(F,{get when(){return k()},get fallback(){return c(vt,{size:"large",variant:"primary",class:"w-full",onClick:H,get disabled(){return W.isPending},get children(){return Te(()=>!!W.isPending)()?l.t("session.share.action.publishing"):l.t("session.share.action.publish")}})},get children(){var Ee=kF(),Re=Ee.firstChild;return p(Ee,c(ah,{get value(){return k()??""},readOnly:!0,copyable:!0,copyKind:"link",tabIndex:-1,class:"w-full"}),Re),p(Re,c(vt,{size:"large",variant:"secondary",class:"w-full shadow-none border border-border-weak-base",onClick:Z,get disabled(){return D.isPending},get children(){return Te(()=>!!D.isPending)()?l.t("session.share.action.unpublishing"):l.t("session.share.action.unpublish")}}),null),p(Re,c(vt,{size:"large",variant:"primary",class:"w-full",onClick:oe,get disabled(){return D.isPending},get children(){return l.t("session.share.action.view")}}),null),Ee}})),be}})}})}}),null),me}})}})}),we),pt(ke,"click",e.onResumeScroll,!0),p(ke,c(bt,{name:"arrow-down-to-line"})),p(G,c(va,{get viewportRef(){return e.setScrollRef},onWheel:ue=>{const me=ue.currentTarget,Ue=JM({deltaY:ue.deltaY,deltaMode:ue.deltaMode,rootHeight:me.clientHeight});Ue&&Mg({root:me,target:ue.target,delta:Ue,onMarkScrollGesture:e.onMarkScrollGesture})},onTouchStart:ue=>{t=ue.touches[0]?.clientY},onTouchMove:ue=>{const me=ue.touches[0]?.clientY,Ue=t;if(t=me,me===void 0||Ue===void 0)return;const be=Ue-me;if(!be)return;const Be=ue.currentTarget;Mg({root:Be,target:ue.target,delta:be,onMarkScrollGesture:e.onMarkScrollGesture})},onTouchEnd:()=>{t=void 0},onTouchCancel:()=>{t=void 0},onPointerDown:ue=>{ue.target===ue.currentTarget&&e.onMarkScrollGesture(ue.currentTarget)},onScroll:ue=>{e.onScheduleScrollState(ue.currentTarget),e.onTurnBackfillScroll(),e.hasScrollGesture()&&(e.onUserScroll(),e.onAutoScrollHandleScroll(),e.onMarkScrollGesture(ue.currentTarget))},get onClick(){return e.onAutoScrollInteraction},class:"relative min-w-0 w-full h-full",style:{"--sticky-accordion-top":"0px"},get children(){var ue=wF(),me=ue.firstChild,Ue=e.setContentRef;return typeof Ue=="function"?ut(Ue,ue):e.setContentRef=ue,p(me,c(F,{get when(){return e.turnStart>0||e.historyMore},get children(){var be=yF();return p(be,c(vt,{variant:"ghost",size:"large",class:"text-12-medium opacity-50",get disabled(){return e.historyLoading},get onClick(){return e.onLoadEarlier},get children(){return Te(()=>!!e.historyLoading)()?l.t("session.messages.loadingEarlier"):l.t("session.messages.loadEarlier")}})),be}}),null),p(me,c(rt,{get each(){return m()},children:be=>{const Be=$(()=>v()===be),E=$(()=>OF(o.data.part[be]??[]),[],{equals:(de,Ee)=>de.length===Ee.length&&de.every((Re,ot)=>Re.path===Ee[ot].path&&Re.comment===Ee[ot].comment&&Re.selection?.startLine===Ee[ot].selection?.startLine&&Re.selection?.endLine===Ee[ot].selection?.endLine)}),ae=$(()=>E().length);return(()=>{var de=DF();return Ie(de,"data-message-id",be),p(de,c(F,{get when(){return ae()>0},get children(){var Ee=TF(),Re=Ee.firstChild,ot=Re.firstChild;return p(ot,c(Ur,{get each(){return E()},children:Pe=>{const Oe=$(()=>Pe());return c(F,{get when(){return Oe()},children:pe=>(()=>{var De=AF(),st=De.firstChild,Je=st.firstChild,Ve=st.nextSibling;return p(st,c(Sn,{get node(){return{path:pe().path,type:"file"}},class:"size-3.5 shrink-0"}),Je),p(Je,()=>Qt(pe().path)),p(st,c(F,{get when(){return pe().selection},children:ht=>(()=>{var Mt=PF();return p(Mt,(()=>{var Tt=Te(()=>ht().startLine===ht().endLine);return()=>Tt()?`:${ht().startLine}`:`:${ht().startLine}-${ht().endLine}`})()),Mt})()}),null),p(Ve,()=>pe().comment),De})()})}})),Ee}}),null),p(de,c(vF,{get sessionID(){return h()??""},messageID:be,get messages(){return g()},get actions(){return e.actions},get active(){return Be()},get status(){return Te(()=>!!Be())()?b():void 0},get showReasoningSummaries(){return s.general.showReasoningSummaries()},get shellToolDefaultOpen(){return s.general.shellToolPartsExpanded()},get editToolDefaultOpen(){return s.general.editToolPartsExpanded()},classes:{root:"min-w-0 w-full relative",content:"flex flex-col justify-between !overflow-visible",container:"w-full px-4 md:px-5"},get children(){return c(F,{get when(){return Te(()=>!!Be())()?e.inlineQuestionRequest:void 0},keyed:!0,children:Ee=>(()=>{var Re=Pg();return p(Re,c(tc,{request:Ee,get onSubmit(){return e.onQuestionSubmit??e.onResumeScroll},placement:"inline"})),Re})()})}}),null),Ae(Ee=>{var Re=e.anchor(be),ot={"min-w-0 w-full max-w-full":!0,"md:max-w-200 2xl:max-w-[1000px]":e.centered},Pe=Be()?void 0:"auto",Oe=Be()?void 0:"auto 500px";return Re!==Ee.e&&Ie(de,"id",Ee.e=Re),Ee.t=Ct(de,ot,Ee.t),Pe!==Ee.a&&ft(de,"content-visibility",Ee.a=Pe),Oe!==Ee.o&&ft(de,"contain-intrinsic-size",Ee.o=Oe),Ee},{e:void 0,t:void 0,a:void 0,o:void 0}),de})()}}),null),p(me,c(F,{get when(){return Te(()=>!z())()?e.inlineQuestionRequest:void 0},keyed:!0,children:be=>(()=>{var Be=Pg();return p(Be,c(tc,{request:be,get onSubmit(){return e.onQuestionSubmit??e.onResumeScroll},placement:"inline"})),Be})()}),null),Ae(be=>{var Be={"w-full":!0,"md:max-w-200 md:mx-auto 2xl:max-w-[1000px]":e.centered,"mt-0.5":e.centered,"mt-0":!e.centered},E=`${64+P.todoHeight}px`;return be.e=Ct(me,Be,be.e),E!==be.t&&ft(me,"padding-bottom",be.t=E),be},{e:void 0,t:void 0}),ue}}),null),p(G,c(F,{get when(){return e.todoDock},children:ue=>c(E5,{get sessionID(){return ue().sessionID},get todos(){return ue().todos},get open(){return ue().open},get closing(){return ue().closing},get centered(){return e.centered},onHeightChange:me=>{B("todoHeight",me)}})}),null),Ae(ue=>{var me={"opacity-100 translate-y-0 scale-100":e.scroll.overflow&&e.scroll.jump&&!J.isStaging(),"opacity-0 translate-y-2 scale-95 pointer-events-none":!e.scroll.overflow||!e.scroll.jump||J.isStaging()},Ue=`${24+P.todoHeight}px`;return ue.e=Ct(we,me,ue.e),Ue!==ue.t&&ft(we,"bottom",ue.t=Ue),ue},{e:void 0,t:void 0}),G}})}Ot(["click","dblclick"]);function LF(e){if(typeof document>"u")return;const t=document.createElement("button");t.type="button",t.ariaLabel=e.label,t.textContent="+",t.style.width="20px",t.style.height="20px",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.border="none",t.style.borderRadius="var(--radius-md)",t.style.background="var(--icon-interactive-base)",t.style.color="var(--white)",t.style.boxShadow="var(--shadow-xs)",t.style.fontSize="14px",t.style.lineHeight="1",t.style.cursor="pointer",t.style.position="relative",t.style.left="30px",t.style.top="calc((var(--diffs-line-height, 24px) - 20px) / 2)";let r;const i=()=>{const s=e.getHoveredLine();s&&(r=s)},n=()=>{t.isConnected&&(i(),requestAnimationFrame(n))},o=()=>{const s=e.getHoveredLine()??r;s&&e.onSelect(s)};return requestAnimationFrame(n),t.addEventListener("mouseenter",i),t.addEventListener("mousemove",i),t.addEventListener("pointerdown",s=>{s.preventDefault(),s.stopPropagation(),i()}),t.addEventListener("mousedown",s=>{s.preventDefault(),s.stopPropagation(),i()}),t.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),o()}),t}var FF=I('<svg><path d="M16.25 3.75H3.75V16.25L6.875 14.4643H16.25V3.75Z"stroke=currentColor stroke-linecap=square></svg>',!1,!0,!1),NF=I('<svg data-slot=line-comment-icon viewBox="0 0 20 20"fill=none aria-hidden=true>'),RF=I('<svg><path d="M10 5.41699V10.0003M10 10.0003V14.5837M10 10.0003H5.4165M10 10.0003H14.5832"stroke=currentColor stroke-linecap=square></svg>',!1,!0,!1),jF=I("<div data-slot=line-comment-popover data-inline-body>"),UF=I("<div data-component=line-comment data-prevent-autofocus>"),KF=I("<button type=button data-slot=line-comment-button>"),VF=I("<div data-slot=line-comment-popover>"),BF=I("<div data-slot=line-comment-tools>"),ZF=I("<div data-slot=line-comment-content><div data-slot=line-comment-head><div data-slot=line-comment-text></div></div><div data-slot=line-comment-label>"),HF=I("<div data-slot=line-comment-mention-list>"),qF=I("<div data-slot=line-comment-editor><textarea data-slot=line-comment-textarea></textarea><div data-slot=line-comment-actions><div data-slot=line-comment-editor-label>"),GF=I("<span data-slot=line-comment-mention-file>"),WF=I("<button type=button data-slot=line-comment-mention-item><div data-slot=line-comment-mention-path><span data-slot=line-comment-mention-dir>"),XF=I("<button type=button data-slot=line-comment-action data-variant=ghost>"),YF=I("<button type=button data-slot=line-comment-action data-variant=primary>");i_();function JF(e){return(()=>{var t=NF();return p(t,c(F,{get when(){return e.icon==="comment"},get fallback(){return RF()},get children(){return FF()}})),t})()}const Y1=e=>{const t=()=>!e.inline&&e.top===void 0,r=()=>e.variant??"default",i=()=>e.icon??"comment",n=()=>e.inline&&e.hideButton;return(()=>{var o=UF();return p(o,c(F,{get when(){return n()},get fallback(){return[(()=>{var s=KF();return pt(s,"mouseenter",e.onMouseEnter),pt(s,"click",e.onClick),pt(s,"mouseup",a=>a.stopPropagation()),pt(s,"mousedown",a=>a.stopPropagation()),p(s,c(F,{get when(){return e.inline},get fallback(){return c(bt,{get name(){return i()==="plus"?"plus-small":"comment"},size:"small"})},get children(){return c(JF,{get icon(){return i()}})}})),Ae(()=>Ie(s,"aria-label",e.buttonLabel)),s})(),c(F,{get when(){return e.open},get children(){var s=VF();return pt(s,"focusout",e.onPopoverFocusOut),pt(s,"mousedown",a=>a.stopPropagation()),p(s,()=>e.children),Ae(a=>Ct(s,{[e.popoverClass??""]:!!e.popoverClass},a)),s}})]},get children(){var s=jF();return pt(s,"focusout",e.onPopoverFocusOut),pt(s,"mouseenter",e.onMouseEnter),pt(s,"click",e.onClick),pt(s,"mousedown",a=>a.stopPropagation()),p(s,()=>e.children),Ae(a=>Ct(s,{[e.popoverClass??""]:!!e.popoverClass},a)),s}})),Ae(s=>{var a=r(),l=e.id,u=e.open?"":void 0,d=e.inline?"":void 0,f={[e.class??""]:!!e.class},m=e.inline?void 0:{top:`${e.top??0}px`,opacity:t()?0:1,"pointer-events":t()?"none":"auto"};return a!==s.e&&Ie(o,"data-variant",s.e=a),l!==s.t&&Ie(o,"data-comment-id",s.t=l),u!==s.a&&Ie(o,"data-open",s.a=u),d!==s.o&&Ie(o,"data-inline",s.o=d),s.i=Ct(o,f,s.i),s.n=gr(o,m,s.n),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),o})()},QF=e=>{const t=yt(),[r,i]=$e(e,["comment","selection","actions"]);return c(Y1,ie(i,{variant:"default",get hideButton(){return e.inline},get children(){var n=ZF(),o=n.firstChild,s=o.firstChild,a=o.nextSibling;return p(s,()=>r.comment),p(o,c(F,{get when(){return r.actions},get children(){var l=BF();return p(l,()=>r.actions),l}}),null),p(a,()=>t.t("ui.lineComment.label.prefix"),null),p(a,()=>r.selection,null),p(a,()=>t.t("ui.lineComment.label.suffix"),null),n}}))},zg=e=>{const t=yt(),[r,i]=$e(e,["value","selection","onInput","onCancel","onSubmit","placeholder","rows","autofocus","cancelLabel","submitLabel","mention"]),n={textarea:void 0},[o,s]=ze(!1);function a(v){if(!v)return;const w=n.textarea,x=h();if(!w||!x)return;const _=`${w.value.slice(0,x.start)}@${v.path} ${w.value.slice(x.end)}`,k=x.start+v.path.length+2;r.onInput(_),m(),requestAnimationFrame(()=>{w.focus(),w.setSelectionRange(k,k)})}const l=Ls({items:async v=>r.mention?v.trim()?(await r.mention.items(v)).map(x=>({path:x})):[]:[],key:v=>v.path,filterKeys:["path"],onSelect:a}),u=()=>n.textarea?.focus(),d=v=>{v.preventDefault(),v.stopPropagation()},f=v=>w=>{w.stopPropagation(),v()},m=()=>{s(!1),l.clear()},h=()=>{const v=n.textarea;if(!v||!r.mention||v.selectionStart!==v.selectionEnd)return;const w=v.selectionStart,x=v.value.slice(0,w).match(/@(\S*)$/);if(x)return{query:x[1]??"",start:w-x[0].length,end:w}},g=()=>{const v=h();if(!v){m();return}s(!0),l.onInput(v.query)},y=()=>{const v=l.flat();if(v.length===0)return;const w=l.active();a(v.find(x=>x.path===w)??v[0])},b=()=>{const v=r.value.trim();v&&r.onSubmit(v)};return Vt(()=>{r.autofocus!==!1&&requestAnimationFrame(u)}),c(Y1,ie(i,{open:!0,variant:"editor",get hideButton(){return e.inline},onClick:()=>u(),get children(){var v=qF(),w=v.firstChild,x=w.nextSibling,_=x.firstChild;return pt(w,"keydown",k=>{const C=k;if(!(C.isComposing||C.keyCode===229)){if(C.stopPropagation(),o()){if(k.key==="Escape"){C.preventDefault(),m();return}if(k.key==="Tab"){if(l.flat().length===0)return;C.preventDefault(),y();return}const O=k.key==="ArrowUp"||k.key==="ArrowDown"||k.key==="Enter",z=C.ctrlKey&&!C.metaKey&&!C.altKey&&!C.shiftKey&&(k.key==="n"||k.key==="p");if((O||z)&&l.flat().length>0){l.onKeyDown(C),C.preventDefault();return}}if(k.key==="Escape"){C.preventDefault(),k.currentTarget.blur(),r.onCancel();return}k.key==="Enter"&&(k.shiftKey||(C.preventDefault(),b()))}}),pt(w,"select",()=>g()),pt(w,"click",()=>g()),pt(w,"input",k=>{const C=k.currentTarget.value;r.onInput(C),g()}),ut(k=>{n.textarea=k},w),p(v,c(F,{get when(){return Te(()=>!!o())()&&l.flat().length>0},get children(){var k=HF();return p(k,c(rt,{get each(){return l.flat().slice(0,10)},children:C=>{const O=C.path.endsWith("/")?C.path:Ri(C.path),z=C.path.endsWith("/")?"":Qt(C.path);return(()=>{var K=WF(),J=K.firstChild,T=J.firstChild;return K.$$click=()=>a(C),K.addEventListener("mouseenter",()=>l.setActive(C.path)),K.$$mousedown=M=>M.preventDefault(),p(K,c(Sn,{get node(){return{path:C.path,type:"file"}},class:"shrink-0 size-4"}),J),p(T,O),p(J,c(F,{when:z,get children(){var M=GF();return p(M,z),M}}),null),Ae(()=>Ie(K,"data-active",l.active()===C.path?"":void 0)),K})()}})),k}}),x),p(_,()=>t.t("ui.lineComment.editorLabel.prefix"),null),p(_,()=>r.selection,null),p(_,()=>t.t("ui.lineComment.editorLabel.suffix"),null),p(x,c(F,{get when(){return!e.inline},get fallback(){return[(()=>{var k=XF();return pt(k,"click",f(r.onCancel)),pt(k,"mousedown",d),p(k,()=>r.cancelLabel??t.t("ui.common.cancel")),k})(),(()=>{var k=YF();return pt(k,"click",f(b)),pt(k,"mousedown",d),p(k,()=>r.submitLabel??t.t("ui.lineComment.submit")),Ae(()=>k.disabled=r.value.trim().length===0),k})()]},get children(){return[c(vt,{size:"small",variant:"ghost",get onClick(){return r.onCancel},get children(){return r.cancelLabel??t.t("ui.common.cancel")}}),c(vt,{size:"small",variant:"primary",get disabled(){return r.value.trim().length===0},onClick:b,get children(){return r.submitLabel??t.t("ui.lineComment.submit")}})]}}),null),Ae(k=>{var C=r.rows??3,O=r.placeholder??t.t("ui.lineComment.placeholder");return C!==k.e&&Ie(w,"rows",k.e=C),O!==k.t&&Ie(w,"placeholder",k.t=O),k},{e:void 0,t:void 0}),Ae(()=>w.value=r.value),v}}))};Ot(["mousedown","click"]);function e9(e){const t=new Map,r=s=>{if(typeof document>"u")return;const a=document.createElement("div");a.setAttribute("data-prevent-autofocus","");const[l,u]=ze(s),d=o_(()=>{const m=l();if(m.kind==="comment"){const g=$(()=>{const y=l();return y.kind!=="comment"?e.renderComment(m.comment):e.renderComment(y.comment)});return c(F,{get when(){return g().editor},get fallback(){return c(QF,{inline:!0,get id(){return g().id},get open(){return g().open},get comment(){return g().comment},get selection(){return g().selection},get actions(){return g().actions},get onClick(){return g().onClick},get onMouseEnter(){return g().onMouseEnter}})},get children(){return c(zg,{inline:!0,get id(){return g().id},get value(){return g().editor.value},get selection(){return g().editor.selection},get onInput(){return g().editor.onInput},get onCancel(){return g().editor.onCancel},get onSubmit(){return g().editor.onSubmit},get onPopoverFocusOut(){return g().editor.onPopoverFocusOut},get cancelLabel(){return g().editor.cancelLabel},get submitLabel(){return g().editor.submitLabel},get mention(){return g().editor.mention}})}})}const h=$(()=>{const g=l();return g.kind!=="draft"?e.renderDraft(m.range):e.renderDraft(g.range)});return c(zg,{inline:!0,get value(){return h().value},get selection(){return h().selection},get onInput(){return h().onInput},get onCancel(){return h().onCancel},get onSubmit(){return h().onSubmit},get onPopoverFocusOut(){return h().onPopoverFocusOut},get mention(){return h().mention}})},a),f={host:a,dispose:d,setMeta:u};return t.set(s.key,f),f};return{render:s=>{const a=s.metadata,l=t.get(a.key)??r(a);if(l)return l.setMeta(a),l.host},reconcile:s=>{const a=new Set(s.map(l=>l.metadata.key));for(const[l,u]of t)a.has(l)||(u.dispose(),t.delete(l))},cleanup:()=>{for(const[,s]of t)s.dispose();t.clear()}}}function t9(e){const[t,r]=We({draft:"",editing:null}),i=()=>t.draft,n=x=>r("draft",x),o=()=>t.editing,s=x=>r("editing",typeof x=="function"?()=>x:x),a=x=>x?Ii(x):null,l=x=>{const _=a(x);return e.setSelected(_),e.syncSelected?.(a(_)),_},u=x=>{const _=a(x);return e.setCommenting(_),_},d=()=>{e.setOpened(null)},f=()=>{n(""),s(null),u(null)},m=()=>{n(""),s(null),e.setOpened(null),e.setSelected(null),e.setCommenting(null)},h=(x,_,k)=>{k?.cancelDraft&&f(),e.setOpened(x),l(_)},g=(x,_,k)=>{k?.cancelDraft&&f();const C=e.opened()===x?null:x;e.setOpened(C),l(_)},y=x=>{const _=a(x);n(""),s(null),d(),l(_),u(_)},b=(x,_,k)=>{d(),l(_),e.setCommenting(null),s(x),n(k)},v=x=>{const _=a(x);if(_){if(e.hoverSelected){e.hoverSelected(_);return}l(_)}},w=x=>{d(),l(x),f()};return{draft:i,setDraft:n,editing:o,opened:e.opened,selected:e.selected,commenting:e.commenting,isOpen:x=>e.opened()===x,isEditing:x=>o()===x,closeComment:d,openComment:h,toggleComment:g,openDraft:y,openEditor:b,hoverComment:v,cancelDraft:f,finishSelection:w,select:l,reset:m}}function J1(e){const t=yt(),r=t9(e.state),i="getSide"in e?Lg({comments:e.comments,getCommentId:u=>u.id,getCommentSelection:u=>u.selection,draftRange:r.commenting,draftKey:e.draftKey,getSide:e.getSide}):Lg({comments:e.comments,getCommentId:u=>u.id,getCommentSelection:u=>u.selection,draftRange:r.commenting,draftKey:e.draftKey}),{renderAnnotation:n}=n9({annotations:i,renderComment:u=>{const d=()=>r.openEditor(u.id,u.selection,u.comment),f=()=>{r.reset(),e.onDelete?.(u)};return{id:u.id,get open(){return r.isOpen(u.id)||r.isEditing(u.id)},comment:u.comment,selection:Ga(u.selection,t.t),get actions(){return e.renderCommentActions?.(u,{edit:d,remove:f})},get editor(){return r.isEditing(u.id)?{get value(){return r.draft()},selection:Ga(u.selection,t.t),mention:e.mention,onInput:r.setDraft,onCancel:r.cancelDraft,onSubmit:m=>{e.onUpdate?.({id:u.id,comment:m,selection:Ii(u.selection)}),r.cancelDraft()},submitLabel:e.editSubmitLabel}:void 0},onMouseEnter:()=>r.hoverComment(u.selection),onClick:()=>{r.isEditing(u.id)||r.toggleComment(u.id,u.selection,{cancelDraft:e.cancelDraftOnCommentToggle})}}},renderDraft:u=>({get value(){return r.draft()},selection:Ga(u,t.t),mention:e.mention,onInput:r.setDraft,onCancel:r.cancelDraft,onSubmit:d=>{e.onSubmit({comment:d,selection:Ii(u)}),r.cancelDraft()},onPopoverFocusOut:e.onDraftPopoverFocusOut})}),o=r9({label:e.label,getSelectedRange:()=>r.opened()?null:e.getHoverSelectedRange?.()??r.selected(),onOpenDraft:r.openDraft});return{note:r,annotations:i,renderAnnotation:n,renderHoverUtility:o,onLineSelected:u=>{if(!u){r.select(null),r.cancelDraft();return}r.select(u)},onLineSelectionEnd:u=>{if(!u){e.clearSelectionOnSelectionEndNull&&r.select(null),r.cancelDraft();return}r.finishSelection(u)},onLineNumberSelectionEnd:u=>{u&&r.openDraft(u)}}}function Lg(e){const t=r=>Math.max(r.start,r.end);return"getSide"in e?$(()=>{const r=e.comments().map(n=>{const o=e.getCommentSelection(n);return{side:e.getSide(o),lineNumber:t(o),metadata:{kind:"comment",key:`comment:${e.getCommentId(n)}`,comment:n}}}),i=e.draftRange();return i?[...r,{side:e.getSide(i),lineNumber:t(i),metadata:{kind:"draft",key:`draft:${e.draftKey()}`,range:i}}]:r}):$(()=>{const r=e.comments().map(o=>{const s=e.getCommentSelection(o);return{lineNumber:t(s),metadata:{kind:"comment",key:`comment:${e.getCommentId(o)}`,comment:o}}}),i=e.draftRange();if(!i)return r;const n={lineNumber:t(i),metadata:{kind:"draft",key:`draft:${e.draftKey()}`,range:i}};return[...r,n]})}function n9(e){const t=e9({renderComment:e.renderComment,renderDraft:e.renderDraft});return ne(()=>{t.reconcile(e.annotations())}),je(()=>{t.cleanup()}),{renderAnnotation:t.render}}function r9(e){return t=>LF({label:e.label,getHoveredLine:t,onSelect:r=>{const i=e.getSelectedRange();if(i&&s_(i,r.lineNumber,r.side)){e.onOpenDraft(Ii(i));return}const n={start:r.lineNumber,end:r.lineNumber};r.side&&(n.side=r.side),e.onOpenDraft(n)}})}var i9={};ir(i9,{Description:()=>Li,ErrorMessage:()=>zi,Item:()=>tx,ItemControl:()=>Qd,ItemDescription:()=>ef,ItemIndicator:()=>tf,ItemInput:()=>nx,ItemLabel:()=>nf,Label:()=>rf,RadioGroup:()=>ja,Root:()=>rx,useRadioGroupContext:()=>Ra});var Q1=Rt();function Ra(){const e=jt(Q1);if(e===void 0)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var ex=Rt();function Xi(){const e=jt(ex);if(e===void 0)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function tx(e){const t=Rr(),r=Ra(),i=`${t.generateId("item")}-${nn()}`,n=Ge({id:i},e),[o,s]=$e(n,["value","disabled","onPointerDown"]),[a,l]=ze(),[u,d]=ze(),[f,m]=ze(),[h,g]=ze(),[y,b]=ze(!1),v=$(()=>r.isDefaultValue(o.value)),w=$(()=>r.isSelectedValue(o.value)),x=$(()=>o.disabled||t.isDisabled()||!1),_=O=>{Qe(O,o.onPointerDown),y()&&O.preventDefault()},k=$(()=>({...t.dataset(),"data-disabled":x()?"":void 0,"data-checked":w()?"":void 0})),C={value:()=>o.value,dataset:k,isDefault:v,isSelected:w,isDisabled:x,inputId:a,labelId:u,descriptionId:f,inputRef:h,select:()=>r.setSelectedValue(o.value),generateId:Nn(()=>s.id),registerInput:tn(l),registerLabel:tn(d),registerDescription:tn(m),setIsFocused:b,setInputRef:g};return c(ex.Provider,{value:C,get children(){return c(it,ie({as:"div",role:"group",onPointerDown:_},k,s))}})}function Qd(e){const t=Xi(),r=Ge({id:t.generateId("control")},e),[i,n]=$e(r,["onClick","onKeyDown"]);return c(it,ie({as:"div",onClick:a=>{Qe(a,i.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:a=>{Qe(a,i.onKeyDown),a.key===uh.Space&&(t.select(),t.inputRef()?.focus())}},()=>t.dataset(),n))}function ef(e){const t=Xi(),r=Ge({id:t.generateId("description")},e);return ne(()=>je(t.registerDescription(r.id))),c(it,ie({as:"div"},()=>t.dataset(),r))}function tf(e){const t=Xi(),r=Ge({id:t.generateId("indicator")},e),[i,n]=$e(r,["ref","forceMount"]),[o,s]=ze(),{present:a}=li({show:()=>i.forceMount||t.isSelected(),element:()=>o()??null});return c(F,{get when(){return a()},get children(){return c(it,ie({as:"div",ref(l){var u=xt(s,i.ref);typeof u=="function"&&u(l)}},()=>t.dataset(),n))}})}function nx(e){const t=Rr(),r=Ra(),i=Xi(),n=Ge({id:i.generateId("input")},e),[o,s]=$e(n,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),a=()=>[o["aria-labelledby"],i.labelId(),o["aria-labelledby"]!=null&&s["aria-label"]!=null?s.id:void 0].filter(Boolean).join(" ")||void 0,l=()=>[o["aria-describedby"],i.descriptionId(),r.ariaDescribedBy()].filter(Boolean).join(" ")||void 0,[u,d]=ze(!1),f=g=>{if(Qe(g,o.onChange),g.stopPropagation(),!u()){r.setSelectedValue(i.value());const y=g.target;y.checked=i.isSelected()}d(!1)},m=g=>{Qe(g,o.onFocus),i.setIsFocused(!0)},h=g=>{Qe(g,o.onBlur),i.setIsFocused(!1)};return ne(qe([()=>i.isSelected(),()=>i.value()],g=>{if(!g[0]&&g[1]===i.value())return;d(!0);const y=i.inputRef();y?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),y?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},{defer:!0})),ne(()=>je(i.registerInput(s.id))),c(it,ie({as:"input",ref(g){var y=xt(i.setInputRef,o.ref);typeof y=="function"&&y(g)},type:"radio",get name(){return t.name()},get value(){return i.value()},get checked(){return i.isSelected()},get required(){return t.isRequired()},get disabled(){return i.isDisabled()},get readonly(){return t.isReadOnly()},get style(){return vr({...cc},o.style)},get"aria-labelledby"(){return a()},get"aria-describedby"(){return l()},onChange:f,onFocus:m,onBlur:h},()=>i.dataset(),s))}function nf(e){const t=Xi(),r=Ge({id:t.generateId("label")},e);return ne(()=>je(t.registerLabel(r.id))),c(it,ie({as:"label",get for(){return t.inputId()}},()=>t.dataset(),r))}function rf(e){return c(uc,ie({as:"span"},e))}function rx(e){let t;const r=`radiogroup-${nn()}`,i=Ge({id:r,orientation:"vertical"},e),[n,o,s]=$e(i,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],hc),[a,l]=ea({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:b=>n.onChange?.(b)}),{formControlContext:u}=pc(o);ta(()=>t,()=>l(n.defaultValue??""));const d=()=>u.getAriaLabelledBy(Ce(o.id),s["aria-label"],n["aria-labelledby"]),f=()=>u.getAriaDescribedBy(n["aria-describedby"]),m=b=>b===e.defaultValue,h=b=>b===a(),y={ariaDescribedBy:f,isDefaultValue:m,isSelectedValue:h,setSelectedValue:b=>{if(!(u.isReadOnly()||u.isDisabled())&&(l(b),t))for(const v of t.querySelectorAll("[type='radio']")){const w=v;w.checked=h(w.value)}}};return c(vc.Provider,{value:u,get children(){return c(Q1.Provider,{value:y,get children(){return c(it,ie({as:"div",ref(b){var v=xt(w=>t=w,n.ref);typeof v=="function"&&v(b)},role:"radiogroup",get id(){return Ce(o.id)},get"aria-invalid"(){return u.validationState()==="invalid"||void 0},get"aria-required"(){return u.isRequired()||void 0},get"aria-disabled"(){return u.isDisabled()||void 0},get"aria-readonly"(){return u.isReadOnly()||void 0},get"aria-orientation"(){return n.orientation},get"aria-labelledby"(){return d()},get"aria-describedby"(){return f()}},()=>u.dataset(),s))}})}})}var ja=Object.assign(rx,{Description:Li,ErrorMessage:zi,Item:tx,ItemControl:Qd,ItemDescription:ef,ItemIndicator:tf,ItemInput:nx,ItemLabel:nf,Label:rf}),ix=Rt();function ox(){const e=jt(ix);if(e===void 0)throw new Error("[kobalte]: `useSegmentedControlContext` must be used within a `SegmentedControl` component");return e}function o9(e){const t=ox(),[r,i]=$e(e,["style"]),[n,o]=ze(),[s,a]=ze(!1),l=()=>{const d=t.selectedItem();if(!d){o(void 0);return}o({width:`${d.offsetWidth}px`,height:`${d.offsetHeight}px`,transform:u(d),"transition-duration":s()?"0ms":void 0})},u=d=>{const f=getComputedStyle(d.parentElement),m=d.offsetLeft-Number.parseFloat(f.paddingLeft),h=d.offsetTop-Number.parseFloat(f.paddingTop);return`translate(${m}px, ${h}px)`};return ne(qe(t.selectedItem,()=>{a(!n()),l(),a(!1)})),Uo(t.root,()=>{$n(()=>{a(!0),l(),a(!1)})}),c(it,ie({as:"div",role:"presentation",get style(){return vr(n(),r.style)},get"data-resizing"(){return s()},get"data-orientation"(){return t.orientation()}},i))}var s9=e=>{const t=Ra(),r=ox(),[i,n]=$e(e,["ref"]),[o,s]=ze();return ne(()=>{const a=o();a&&t.isSelectedValue(e.value)&&r.setSelectedItem(a)}),c(ja.Item,ie({ref(a){var l=xt(s,i.ref);typeof l=="function"&&l(a)}},n))},a9=e=>{const t=Xi(),[r,i]=$e(e,["ref"]),[n,o]=ze();return ta(n,()=>{requestAnimationFrame(()=>{t.isDefault()&&t.select()})}),c(ja.ItemInput,ie({ref(s){var a=xt(o,r.ref);typeof a=="function"&&a(s)}},i))},l9=e=>{const t=ie({defaultValue:e.value,orientation:"horizontal"},e),[r,i]=$e(t,["ref"]),[n,o]=ze(),[s,a]=ze(),l={value:()=>i.value,defaultValue:()=>i.defaultValue,orientation:()=>i.orientation,root:n,selectedItem:s,setSelectedItem:a};return ne(()=>{l.value()||a(void 0)}),c(ix.Provider,{value:l,get children(){return c(ja,ie({ref(u){var d=xt(o,r.ref);typeof d=="function"&&d(u)}},i))}})},po=Object.assign(l9,{Description:Li,ErrorMessage:zi,Indicator:o9,Item:s9,ItemControl:Qd,ItemDescription:ef,ItemIndicator:tf,ItemInput:a9,ItemLabel:nf,Label:rf}),c9=I("<div role=presentation data-slot=radio-group-wrapper><div role=presentation data-slot=radio-group-items>"),u9=I("<span data-slot=radio-group-item-control>");function d9(e){const[t,r]=$e(e,["class","classList","options","current","defaultValue","value","label","onSelect","size","fill","pad"]),i=s=>t.value?t.value(s):String(s),n=s=>t.label?t.label(s):String(s),o=s=>t.options.find(a=>i(a)===s);return c(po,ie(r,{"data-component":"radio-group",get"data-size"(){return t.size??"medium"},get"data-fill"(){return t.fill?"":void 0},get"data-pad"(){return t.pad??"normal"},get classList(){return{...t.classList??{},[t.class??""]:!!t.class}},get value(){return Te(()=>!!t.current)()?i(t.current):void 0},get defaultValue(){return Te(()=>!!t.defaultValue)()?i(t.defaultValue):void 0},onChange:s=>t.onSelect?.(o(s)),get children(){var s=c9(),a=s.firstChild;return p(s,c(po.Indicator,{"data-slot":"radio-group-indicator"}),a),p(a,c(rt,{get each(){return t.options},children:l=>c(po.Item,{get value(){return i(l)},"data-slot":"radio-group-item",get"data-value"(){return i(l)},get children(){return[c(po.ItemInput,{"data-slot":"radio-group-item-input"}),c(po.ItemLabel,{"data-slot":"radio-group-item-label",get children(){var u=u9();return p(u,()=>n(l)),u}})]}})})),s}}))}var f9=I("<div>"),m9=I("<div class=pb-6>"),g9=I("<div data-slot=session-review-container>"),h9=I("<div data-component=session-review><div data-slot=session-review-header><div data-slot=session-review-title></div><div data-slot=session-review-actions>"),p9=I("<span data-slot=session-review-directory>"),v9=I("<button data-slot=session-review-view-button type=button>"),b9=I("<div data-slot=session-review-change-group data-type=added><span data-slot=session-review-change data-type=added>"),y9=I("<span data-slot=session-review-change data-type=removed>"),w9=I("<span data-slot=session-review-change data-type=modified>"),x9=I("<div data-slot=session-review-trigger-content><div data-slot=session-review-file-info><div data-slot=session-review-file-name-container><span data-slot=session-review-filename></span></div></div><div data-slot=session-review-trigger-actions><span data-slot=session-review-diff-chevron>"),_9=I('<div data-slot=session-review-diff-placeholder class="rounded-lg border border-border-weak-base bg-background-stronger/40"style=height:160px>'),$9=I("<div data-slot=session-review-large-diff><div data-slot=session-review-large-diff-title></div><div data-slot=session-review-large-diff-meta></div><div data-slot=session-review-large-diff-actions>"),S9=I("<div data-slot=session-review-diff-wrapper>");const Fg=500,Ng=300;function k9(e){return(()=>{var t=f9();return t.$$click=r=>r.stopPropagation(),t.$$mousedown=r=>r.stopPropagation(),p(t,c(ct,{gutter:4,placement:"bottom-end",get children(){return[c(ct.Trigger,{as:Pt,icon:"dot-grid",variant:"ghost",size:"small",class:"size-6 rounded-md",get"aria-label"(){return e.labels.moreLabel}}),c(ct.Portal,{get children(){return c(ct.Content,{get children(){return[c(ct.Item,{get onSelect(){return e.onEdit},get children(){return c(ct.ItemLabel,{get children(){return e.labels.editLabel}})}}),c(ct.Item,{get onSelect(){return e.onDelete},get children(){return c(ct.ItemLabel,{get children(){return e.labels.deleteLabel}})}})]}})}})]}})),t})()}function C9(e){const t=Ci(e);if(t)return`session-review-diff-${t}`}const I9=e=>{let t,r=0,i;const n=_t(),o=Ki(),s=new Map,a=new Map,[l,u]=We({open:[],visible:{},force:{},selection:null,commenting:null,opened:null}),d=()=>l.selection,f=()=>l.commenting,m=()=>l.opened,h=()=>e.open??l.open,g=$(()=>e.diffs.map(T=>T.file));$(()=>new Map(e.diffs.map(T=>[T.file,T])));const y=$(()=>{const T=new Map;for(const M of e.comments??[]){const U=T.get(M.file);if(U){U.push(M);continue}T.set(M.file,[M])}return T}),b=()=>e.diffStyle??(e.split?"split":"unified"),v=()=>g().length>0,w=()=>{if(i=void 0,!t)return;const T=t.getBoundingClientRect(),M=T.top-Ng,U=T.bottom+Ng,A=new Set(h()),j={};for(const[V,Q]of a){if(!A.has(V))continue;const ee=Q.getBoundingClientRect();ee.bottom<M||ee.top>U||(j[V]=!0)}const P=kt(()=>l.visible),B=Object.keys(P),R=Object.keys(j);B.length===R.length&&R.every(V=>P[V])||u("visible",j)},x=()=>{i===void 0&&(i=requestAnimationFrame(w))},_=T=>e.focusedComment?.file===T||e.focusedFile===T||d()?.file===T||f()?.file===T||m()?.file===T,k=T=>{x();const M=e.onScroll;if(M){if(Array.isArray(M)){const[U,A]=M;U(A,T);return}M(T)}};je(()=>{i!==void 0&&cancelAnimationFrame(i)}),ne(()=>{e.open,g(),x()});const C=T=>{e.onOpenChange?.(T),e.open===void 0&&u("open",T),x()},O=()=>{const T=h().length>0?[]:g();C(T)},z=()=>n.t("ui.sessionReview.openFile"),K=T=>T.endSide??T.side??"additions",J=(T,M)=>{const A=K(M)==="deletions"?T.before:T.after;if(!(typeof A!="string"||A.length===0))return ia(A,M)};return ne(()=>{const T=e.focusedComment;T&&kt(()=>{r++;const M=r;u("opened",T);const U=(e.comments??[]).find(P=>P.file===T.file&&P.id===T.id);U&&u("selection",{file:U.file,range:Ii(U.selection)});const A=h();A.includes(T.file)||C([...A,T.file]);const j=P=>{if(M!==r)return;const B=t;if(!B)return;const R=s.get(T.file),V=R?.querySelector(`[data-comment-id="${T.id}"]`),Q=V instanceof HTMLElement&&V.style.pointerEvents!=="none"&&V.style.opacity!=="0",ee=Q?V:R;if(!ee){if(P>=120)return;requestAnimationFrame(()=>j(P+1));return}const oe=B.getBoundingClientRect(),le=ee.getBoundingClientRect(),W=le.top-oe.top,D=B.scrollTop+W-oe.height/2+le.height/2;B.scrollTop=Math.max(0,D),!Q&&(P>=120||requestAnimationFrame(()=>j(P+1)))};requestAnimationFrame(()=>j(0)),requestAnimationFrame(()=>e.onFocusedCommentChange?.(null))})}),(()=>{var T=h9(),M=T.firstChild,U=M.firstChild,A=U.nextSibling;return p(U,(()=>{var j=Te(()=>e.title===void 0);return()=>j()?n.t("ui.sessionReview.title"):e.title})()),p(A,c(F,{get when(){return Te(()=>!!v())()&&e.onDiffStyleChange},get children(){return c(d9,{options:["unified","split"],get current(){return b()},size:"small",value:j=>j,label:j=>n.t(j==="unified"?"ui.sessionReview.diffStyle.unified":"ui.sessionReview.diffStyle.split"),onSelect:j=>j&&e.onDiffStyleChange?.(j)})}}),null),p(A,c(F,{get when(){return v()},get children(){return c(vt,{size:"small",icon:"chevron-grabber-vertical",class:"w-[106px] justify-start",onClick:O,get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return h().length>0},get children(){return n.t("ui.sessionReview.collapseAll")}}),c(Xe,{when:!0,get children(){return n.t("ui.sessionReview.expandAll")}})]}})}})}}),null),p(A,()=>e.actions,null),p(T,c(va,{"data-slot":"session-review-scroll",viewportRef:j=>{t=j,e.scrollRef?.(j),x()},onScroll:k,get classList(){return{[e.classes?.root??""]:!!e.classes?.root}},get children(){var j=g9();return p(j,c(F,{get when(){return v()},get fallback(){return e.empty},get children(){var P=m9();return p(P,c(Kt,{multiple:!0,get value(){return h()},onChange:C,get children(){return c(rt,{get each(){return e.diffs},children:B=>{const R=B.file,V=$(()=>h().includes(R)),Q=$(()=>V()&&(!!l.visible[R]||_(R))),ee=()=>!!l.force[R],oe=$(()=>y().get(R)??[]),le=$(()=>oe().map(G=>G.selection)),W=()=>typeof B.before=="string"?B.before:"",D=()=>typeof B.after=="string"?B.after:"",te=()=>B.additions+B.deletions,H=$(()=>a_(R)),Z=$(()=>!V()||ee()||H()?!1:te()>Fg),se=()=>B.status==="added"||W().length===0&&D().length>0,re=()=>B.status==="deleted"||D().length===0&&W().length>0,fe=$(()=>{const G=d();return!G||G.file!==R?null:G.range}),Se=$(()=>{const G=f();return!G||G.file!==R?null:G.range}),Ne=J1({comments:oe,label:n.t("ui.lineComment.submit"),draftKey:()=>R,mention:e.lineCommentMention,state:{opened:()=>{const G=m();return!G||G.file!==R?null:G.id},setOpened:G=>u("opened",G?{file:R,id:G}:null),selected:fe,setSelected:G=>u("selection",G?{file:R,range:G}:null),commenting:Se,setCommenting:G=>u("commenting",G?{file:R,range:G}:null)},getSide:K,clearSelectionOnSelectionEndNull:!1,onSubmit:({comment:G,selection:we})=>{e.onLineComment?.({file:R,selection:we,comment:G,preview:J(B,we)})},onUpdate:({id:G,comment:we,selection:ke})=>{e.onLineCommentUpdate?.({id:G,file:R,selection:ke,comment:we,preview:J(B,ke)})},onDelete:G=>{e.onLineCommentDelete?.({id:G.id,file:R})},editSubmitLabel:e.lineCommentActions?.saveLabel,renderCommentActions:e.lineCommentActions?(G,we)=>c(k9,{get labels(){return e.lineCommentActions},get onEdit(){return we.edit},get onDelete(){return we.remove}}):void 0});je(()=>{s.delete(R),a.delete(R),x()});const ce=G=>{e.onLineComment&&Ne.onLineSelected(G)},ye=G=>{e.onLineComment&&Ne.onLineSelectionEnd(G)};return c(Kt.Item,{value:R,get id(){return C9(R)},"data-file":R,"data-slot":"session-review-accordion-item",get"data-selected"(){return e.focusedFile===R?"":void 0},get children(){return[c(Wo,{get children(){return c(Kt.Trigger,{get children(){var G=x9(),we=G.firstChild,ke=we.firstChild,ue=ke.firstChild,me=we.nextSibling,Ue=me.firstChild;return p(we,c(Sn,{node:{path:R,type:"file"}}),ke),p(ke,c(F,{get when(){return R.includes("/")},get children(){var be=p9();return p(be,()=>`‪${Ri(R)}‬`),be}}),ue),p(ue,()=>Qt(R)),p(ke,c(F,{get when(){return e.onViewFile},get children(){return c(Et,{get value(){return z()},placement:"top",gutter:4,get children(){var be=v9();return be.$$click=Be=>{Be.stopPropagation(),e.onViewFile?.(R)},p(be,c(bt,{name:"open-file",size:"small"})),Ae(()=>Ie(be,"aria-label",z())),be}})}}),null),p(me,c(Gt,{get children(){return[c(Xe,{get when(){return se()},get children(){var be=b9(),Be=be.firstChild;return p(Be,()=>n.t("ui.sessionReview.change.added")),p(be,c(pr,{changes:B}),null),be}}),c(Xe,{get when(){return re()},get children(){var be=y9();return p(be,()=>n.t("ui.sessionReview.change.removed")),be}}),c(Xe,{get when(){return!!H()},get children(){var be=w9();return p(be,()=>n.t("ui.sessionReview.change.modified")),be}}),c(Xe,{when:!0,get children(){return c(pr,{changes:B})}})]}}),Ue),p(Ue,c(bt,{name:"chevron-down",size:"small"})),G}})}}),c(Kt.Content,{"data-slot":"session-review-accordion-content",get children(){var G=S9();return ut(we=>{s.set(R,we),a.set(R,we),x()},G),p(G,c(F,{get when(){return V()},get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return Te(()=>!Q())()&&!Z()},get children(){return _9()}}),c(Xe,{get when(){return Z()},get children(){var we=$9(),ke=we.firstChild,ue=ke.nextSibling,me=ue.nextSibling;return p(ke,()=>n.t("ui.sessionReview.largeDiff.title")),p(ue,()=>n.t("ui.sessionReview.largeDiff.meta",{limit:Fg.toLocaleString(),current:te().toLocaleString()})),p(me,c(vt,{size:"normal",variant:"secondary",onClick:()=>u("force",R,!0),get children(){return n.t("ui.sessionReview.largeDiff.renderAnyway")}})),we}}),c(Xe,{when:!0,get children(){return c(Jn,{component:o,mode:"diff",get preloadedDiff(){return B.preloaded},get diffStyle(){return b()},onRendered:()=>{e.onDiffRendered?.()},get enableLineSelection(){return e.onLineComment!=null},get enableHoverUtility(){return e.onLineComment!=null},onLineSelected:ce,onLineSelectionEnd:ye,get onLineNumberSelectionEnd(){return Ne.onLineNumberSelectionEnd},get annotations(){return Ne.annotations()},get renderAnnotation(){return Ne.renderAnnotation},get renderHoverUtility(){return Te(()=>!!e.onLineComment)()?Ne.renderHoverUtility:void 0},get selectedLines(){return fe()},get commentedLines(){return le()},get before(){return{name:R,contents:typeof B.before=="string"?B.before:""}},get after(){return{name:R,contents:typeof B.after=="string"?B.after:""}},get media(){return{mode:"auto",path:R,before:B.before,after:B.after,readFile:e.readFile}}})}})]}})}})),G}})]}})}})}})),P}})),Ae(()=>Jt(j,e.classes?.container)),j}}),null),Ae(j=>{var P=e.class,B=e.classList,R=e.classes?.header;return P!==j.e&&Jt(T,j.e=P),j.t=Ct(T,B,j.t),R!==j.a&&Jt(M,j.a=R),j},{e:void 0,t:void 0,a:void 0}),T})()};Ot(["mousedown","click"]);function T9(e){let t,r,i=!1,n;const o=Rn(),s=or(),a=async m=>o.client.file.read({path:m}).then(h=>h.data).catch(h=>{console.debug("[session-review] failed to read file",{path:m,error:h})}),l=()=>{i=!0,r!==void 0&&(cancelAnimationFrame(r),r=void 0)},u=()=>{r=void 0;const m=t;if(!m||!s.ready()||i||m.clientHeight===0||m.clientWidth===0)return;const h=e.view().scroll("review");if(!h||h.x===0&&h.y===0)return;const g=Math.max(0,m.scrollHeight-m.clientHeight),y=Math.max(0,m.scrollWidth-m.clientWidth),b=Math.min(h.y,g),v=Math.min(h.x,y);m.scrollTop===b&&m.scrollLeft===v||(m.scrollTop!==b&&(m.scrollTop=b),m.scrollLeft!==v&&(m.scrollLeft=v),n={x:m.scrollLeft,y:m.scrollTop})},d=()=>{i||r!==void 0||(r=requestAnimationFrame(u))},f=m=>{const h=m.currentTarget,g=n;if(g&&h.scrollTop===g.y&&h.scrollLeft===g.x){n=void 0;return}n=void 0,l(),s.ready()&&(h.clientHeight===0||h.clientWidth===0||e.view().setScroll("review",{x:h.scrollLeft,y:h.scrollTop}))};return ne(()=>{e.diffs().length,e.diffStyle,s.ready()&&d()}),je(()=>{r!==void 0&&cancelAnimationFrame(r)}),c(I9,{get title(){return e.title},get empty(){return e.empty},scrollRef:m=>{t=m,ln(m,"wheel",l,{passive:!0,capture:!0}),ln(m,"mousewheel",l,{passive:!0,capture:!0}),ln(m,"pointerdown",l,{passive:!0,capture:!0}),ln(m,"touchstart",l,{passive:!0,capture:!0}),ln(m,"keydown",l,{capture:!0}),e.onScrollRef?.(m),d()},onScroll:f,onDiffRendered:d,get open(){return e.view().review.open()},get onOpenChange(){return e.view().review.setOpen},get classes(){return{root:e.classes?.root??"pr-3",header:e.classes?.header??"px-3",container:e.classes?.container??"pl-3"}},get diffs(){return e.diffs()},get diffStyle(){return e.diffStyle},get onDiffStyleChange(){return e.onDiffStyleChange},get onViewFile(){return e.onViewFile},get focusedFile(){return e.focusedFile},readFile:a,get onLineComment(){return e.onLineComment},get onLineCommentUpdate(){return e.onLineCommentUpdate},get onLineCommentDelete(){return e.onLineCommentDelete},get lineCommentActions(){return e.lineCommentActions},get lineCommentMention(){return e.commentMentions},get comments(){return e.comments},get focusedComment(){return e.focusedComment},get onFocusedCommentChange(){return e.onFocusedCommentChange}})}const D9=(e,t)=>{e.session.restore(t)};var A9=I("<span>"),P9=I('<span class="shrink-0 w-4 text-center text-12-medium">'),O9=I('<div class="shrink-0 size-1.5 mr-1.5 rounded-full">'),E9=I("<div data-component=filetree>"),M9=I('<div class="size-4 flex items-center justify-center text-icon-weak">'),z9=I("<div>"),L9=I('<div class="w-4 shrink-0">'),F9=I('<span class="filetree-iconpair size-4">'),N9=I('<div class="px-2 py-1 text-12-regular text-text-weak">...');const R9=128;function j9(e){return`file://${l_(e)}`}function U9(e){return!(e.level!==0||e.dir?.loaded||e.dir?.loading)}function K9(e){return e.level!==0?[]:e.filter?[...e.filter.dirs].filter(t=>!e.expanded(t)):[]}const V9=e=>e==="add"?"A":e==="del"?"D":"M",ic=e=>e==="add"?"color: var(--icon-diff-add-base)":e==="del"?"color: var(--icon-diff-delete-base)":"color: var(--icon-diff-modified-base)",B9=e=>e==="add"?"background-color: var(--icon-diff-add-base)":e==="del"?"background-color: var(--icon-diff-delete-base)":"background-color: var(--icon-diff-modified-base)",sx=(e,t,r)=>{const i=t?.get(e.path);if(i&&r?.has(e.path))return i},Z9=e=>{const t=e.querySelector('[data-component="file-icon"]')??e.querySelector("svg"),r=e.querySelector("span");if(!t||!r)return;const i=document.createElement("div");return i.className="flex items-center gap-x-2 px-2 py-1 bg-surface-raised-base rounded-md border border-border-base text-12-regular text-text-strong",i.style.position="absolute",i.style.top="-1000px",i.innerHTML=t.outerHTML+r.outerHTML,i},H9=e=>{const t=Z9(e.currentTarget);t&&(document.body.appendChild(t),e.dataTransfer?.setDragImage(t,0,12),setTimeout(()=>document.body.removeChild(t),0))},Rg=e=>{const[t,r]=$e(e,["node","level","active","nodeClass","draggable","kinds","marks","as","children","class","classList"]),i=()=>sx(t.node,t.kinds,t.marks),n=()=>!!i()&&!t.node.ignored,o=()=>{const s=i();if(s)return ic(s)};return c(Jn,ie({get component(){return t.as??"div"},get classList(){return{"w-full min-w-0 h-6 flex items-center justify-start gap-x-1.5 rounded-md px-1.5 py-0 text-left hover:bg-surface-raised-base-hover active:bg-surface-base-active transition-colors cursor-pointer":!0,"bg-surface-base-active":t.node.path===t.active,...t.classList??{},[t.class??""]:!!t.class,[t.nodeClass??""]:!!t.nodeClass}},get style(){return`padding-left: ${Math.max(0,8+t.level*12-(t.node.type==="file"?24:4))}px`},get draggable(){return t.draggable},onDragStart:s=>{t.draggable&&(s.dataTransfer?.setData("text/plain",`file:${t.node.path}`),s.dataTransfer?.setData("text/uri-list",j9(t.node.path)),s.dataTransfer&&(s.dataTransfer.effectAllowed="copy"),H9(s))}},r,{get children(){return[Te(()=>t.children),(()=>{var s=A9();return p(s,()=>t.node.name),Ae(a=>{var l={"flex-1 min-w-0 text-12-medium whitespace-nowrap truncate":!0,"text-text-weaker":t.node.ignored,"text-text-weak":!t.node.ignored&&!n()},u=n()?o():void 0;return a.e=Ct(s,l,a.e),a.t=gr(s,u,a.t),a},{e:void 0,t:void 0}),s})(),Te(()=>(()=>{const s=i();return s?t.node.type==="file"?(()=>{var a=P9();return p(a,()=>V9(s)),Ae(l=>gr(a,ic(s),l)),a})():(()=>{var a=O9();return Ae(l=>gr(a,B9(s),l)),a})():null})())]}}))};function oc(e){const t=jr(),r=e.level??0,i=()=>e.draggable??!0,n=f=>t.normalize(f).replace(/[\\/]+$/,"").replaceAll("\\","/"),o=e._chain?[...e._chain,n(e.path)]:[n(e.path)],s=$(()=>{if(e._filter)return e._filter;const f=e.allowed;if(!f)return;const m=new Set(f),h=new Set;for(const g of f){const b=g.split("/").slice(0,-1);for(const[v]of b.entries()){const w=b.slice(0,v+1).join("/");w&&h.add(w)}}return{files:m,dirs:h}}),a=$(()=>{if(e._marks)return e._marks;const f=new Set;for(const m of e.modified??[])f.add(m);for(const m of e.kinds?.keys()??[])f.add(m);if(f.size!==0)return f}),l=$(()=>e._kinds?e._kinds:e.kinds),u=$(()=>{if(e._deeps)return e._deeps;const f=new Map,m=e.path;if(!(t.tree.state(m)?.expanded??!1))return f;const h=new Set,g=[],y=(b,v)=>{const w=n(b);if(h.has(w))return;h.add(w);const x=t.tree.children(b).filter(_=>_.type==="directory"&&(t.tree.state(_.path)?.expanded??!1)).map(_=>_.path);g.push({dir:b,lvl:v,i:0,kids:x,max:v})};for(y(m,r-1);g.length>0;){const b=g[g.length-1];if(b.i<b.kids.length){const w=b.kids[b.i];b.i++,y(w,b.lvl+1);continue}f.set(b.dir,b.max),g.pop();const v=g[g.length-1];v&&(v.max=Math.max(v.max,b.max))}return f});ne(()=>{const f=s(),m=K9({level:r,filter:f,expanded:h=>kt(()=>t.tree.state(h)?.expanded)??!1});for(const h of m)t.tree.expand(h)}),ne(qe(()=>e.path,f=>{const m=kt(()=>t.tree.state(f));U9({level:r,dir:m})&&t.tree.list(f)},{defer:!1}));const d=$(()=>{const f=t.tree.children(e.path),m=s();if(!m)return f;const h=v=>{const w=v.lastIndexOf("/");return w===-1?"":v.slice(0,w)},g=v=>{const w=v.lastIndexOf("/");return w===-1?v:v.slice(w+1)},y=f.filter(v=>v.type==="file"?m.files.has(v.path):m.dirs.has(v.path)),b=new Set(y.map(v=>v.path));for(const v of m.dirs)h(v)===e.path&&(b.has(v)||(y.push({name:g(v),path:v,absolute:v,type:"directory",ignored:!1}),b.add(v)));for(const v of m.files)h(v)===e.path&&(b.has(v)||(y.push({name:g(v),path:v,absolute:v,type:"file",ignored:!1}),b.add(v)));return y.sort((v,w)=>v.type!==w.type?v.type==="directory"?-1:1:v.name.localeCompare(w.name)),y});return(()=>{var f=E9();return p(f,c(rt,{get each(){return d()},children:m=>{const h=()=>t.tree.state(m.path)?.expanded??!1,g=()=>u().get(m.path)??-1,y=()=>sx(m,l(),a()),b=()=>!!y()&&!m.ignored;return c(Gt,{get children(){return[c(Xe,{get when(){return m.type==="directory"},get children(){return c(en,{variant:"ghost",class:"w-full","data-scope":"filetree",forceMount:!1,get open(){return h()},onOpenChange:v=>v?t.tree.expand(m.path):t.tree.collapse(m.path),get children(){return[c(en.Trigger,{get children(){return c(Rg,{node:m,level:r,get active(){return e.active},get nodeClass(){return e.nodeClass},get draggable(){return i()},get kinds(){return l()},get marks(){return a()},get children(){var v=M9();return p(v,c(bt,{get name(){return h()?"chevron-down":"chevron-right"},size:"small"})),v}})}}),c(en.Content,{class:"relative pt-0.5",get children(){return[(()=>{var v=z9();return Ae(w=>{var x={"absolute top-0 bottom-0 w-px pointer-events-none bg-border-weak-base opacity-0 transition-opacity duration-150 ease-out motion-reduce:transition-none":!0,"group-hover/filetree:opacity-100":h()&&g()===r,"group-hover/filetree:opacity-50":!(h()&&g()===r)},_=`left: ${Math.max(0,8+r*12-4)+8}px`;return w.e=Ct(v,x,w.e),w.t=gr(v,_,w.t),w},{e:void 0,t:void 0}),v})(),c(F,{get when(){return r<R9&&!o.includes(n(m.path))},get fallback(){return N9()},get children(){return c(oc,{get path(){return m.path},level:r+1,get allowed(){return e.allowed},get modified(){return e.modified},get kinds(){return e.kinds},get active(){return e.active},get draggable(){return e.draggable},get onFileClick(){return e.onFileClick},get _filter(){return s()},get _marks(){return a()},get _deeps(){return u()},get _kinds(){return l()},_chain:o})}})]}})]}})}}),c(Xe,{get when(){return m.type==="file"},get children(){return c(Rg,{node:m,level:r,get active(){return e.active},get nodeClass(){return e.nodeClass},get draggable(){return i()},get kinds(){return l()},get marks(){return a()},as:"button",type:"button",onClick:()=>e.onFileClick?.(m),get children(){return[L9(),c(Gt,{get children(){return[c(Xe,{get when(){return m.ignored},get children(){return c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--mono",style:"color: var(--icon-weak-base)",mono:!0})}}),c(Xe,{get when(){return b()},get children(){return c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--mono",get style(){return ic(y())},mono:!0})}}),c(Xe,{get when(){return!m.ignored},get children(){var v=F9();return p(v,c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--color opacity-0 group-hover/filetree:opacity-100"}),null),p(v,c(Sn,{node:m,class:"size-4 filetree-icon filetree-icon--mono group-hover/filetree:opacity-0",mono:!0}),null),v}})]}})]}})}})]}})}})),Ae(()=>Jt(f,`flex flex-col gap-0.5 ${e.class??""}`)),f})()}const q9=e=>{if(!(e.scrollWidth<=e.prevScrollWidth)){if(!e.prevContextOpen&&e.contextOpen)return 0;if(!(e.scrollWidth<=e.clientWidth))return e.scrollWidth-e.clientWidth}},G9=e=>{let t,r=e.el.scrollWidth,i=e.contextOpen();const n=()=>{const l=e.el.scrollWidth,u=e.el.clientWidth,d=e.contextOpen(),f=q9({prevScrollWidth:r,scrollWidth:l,clientWidth:u,prevContextOpen:i,contextOpen:d});f!==void 0&&e.el.scrollTo({left:f,behavior:"smooth"}),r=l,i=d},o=()=>{t!==void 0&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{t=void 0,n()})},s=l=>{Math.abs(l.deltaY)<=Math.abs(l.deltaX)||(e.el.scrollLeft+=l.deltaY>0?50:-50,l.preventDefault())};e.el.addEventListener("wheel",s,{passive:!1});const a=new MutationObserver(o);return a.observe(e.el,{childList:!0}),()=>{e.el.removeEventListener("wheel",s),a.disconnect(),t!==void 0&&cancelAnimationFrame(t)}};var W9=I("<div>"),X9=I('<div class="relative overflow-hidden pb-40">'),Y9=I('<div class="px-6 py-4 text-text-weak">...'),J9=I('<div class="px-6 py-4 text-text-weak">');function Q9(e){return(()=>{var t=W9();return t.$$click=r=>r.stopPropagation(),t.$$mousedown=r=>r.stopPropagation(),p(t,c(ct,{gutter:4,placement:"bottom-end",get children(){return[c(ct.Trigger,{as:Pt,icon:"dot-grid",variant:"ghost",size:"small",class:"size-6 rounded-md",get"aria-label"(){return e.moreLabel}}),c(ct.Portal,{get children(){return c(ct.Content,{get children(){return[c(ct.Item,{get onSelect(){return e.onEdit},get children(){return c(ct.ItemLabel,{get children(){return e.editLabel}})}}),c(ct.Item,{get onSelect(){return e.onDelete},get children(){return c(ct.ItemLabel,{get children(){return e.deleteLabel}})}})]}})}})]}})),t})()}function eN(e){let t,r,i,n;const[o,s]=ze([]),a=()=>{const y=t;if(!y)return[];const b=y.querySelector("diffs-container");if(!(b instanceof HTMLElement))return[];const v=b.shadowRoot;return v?Array.from(v.querySelectorAll("[data-code]")).filter(w=>w instanceof HTMLElement&&w.clientWidth>0):[]},l=y=>{n=y,r===void 0&&(r=requestAnimationFrame(()=>{r=void 0;const b=n;n=void 0,b&&e.view().setScroll(e.tab(),b)}))},u=y=>{const b=t;if(!b)return;const v=y.currentTarget;v instanceof HTMLElement&&l({x:v.scrollLeft,y:b.scrollTop})},d=()=>{const y=a(),b=o();y.length===b.length&&y.every((v,w)=>v===b[w])||s(y)},f=()=>{const y=t;if(!y)return;const b=e.view().scroll(e.tab());if(b){if(d(),o().length>0)for(const v of o())v.scrollLeft!==b.x&&(v.scrollLeft=b.x);y.scrollTop!==b.y&&(y.scrollTop=b.y),!(o().length>0)&&y.scrollLeft!==b.x&&(y.scrollLeft=b.x)}},m=()=>{i===void 0&&(i=requestAnimationFrame(()=>{i=void 0,f()}))},h=y=>{o().length===0&&d(),l({x:o()[0]?.scrollLeft??y.currentTarget.scrollLeft,y:y.currentTarget.scrollTop})};ne(()=>{for(const y of o())ln(y,"scroll",u)});const g=y=>{t=y,f()};return je(()=>{r!==void 0&&cancelAnimationFrame(r),i!==void 0&&cancelAnimationFrame(i)}),{handleScroll:h,queueRestore:m,setViewport:g}}function tN(e){const t=jr(),r=_c(),i=_t(),n=Ui(),o=Ki(),{sessionKey:s,tabs:a,view:l}=_r(),u=qo({tabs:a,pathFromTab:t.pathFromTab,normalizeTab:P=>P.startsWith("file://")?t.tab(P):P}).activeFileTab;let d=null;const f={register:P=>{d=P}},m=$(()=>t.pathFromTab(e.tab)),h=$(()=>{const P=m();if(P)return t.get(P)}),g=$(()=>h()?.content?.content??""),y=$(()=>c_(g())),b=$(()=>{const P=m();return P?t.ready()?t.selectedLines(P)??null:lh(s())?.files[P]??null:null}),v=eN({tab:()=>e.tab,view:l}),w=(P,B)=>ia(P,{start:B.startLine,end:B.endLine}),x=(P,B)=>{const R=P===m()?g():t.get(P)?.content?.content;if(R)return w(R,B)},_=P=>{const B=Ao(P.selection),R=P.preview??x(P.file,B),V=r.add({file:P.file,selection:P.selection,comment:P.comment});n.context.add({type:"file",path:P.file,selection:B,comment:P.comment,commentID:V.id,commentOrigin:P.origin,preview:R})},k=P=>{r.update(P.file,P.id,P.comment);const B=P.file===m()?x(P.file,Ao(P.selection)):void 0;n.context.updateComment(P.file,P.id,{comment:P.comment,...B?{preview:B}:{}})},C=P=>{r.remove(P.file,P.id),n.context.removeComment(P.file,P.id)},O=$(()=>{const P=m();return P?r.list(P):[]}),z=$(()=>O().map(P=>P.selection)),[K,J]=We({openedComment:null,commenting:null,selected:null}),T=P=>{const B=m();B&&t.setSelectedLines(B,P?Ii(P):null)},M=()=>K.selected??b(),U=J1({comments:O,label:i.t("ui.lineComment.submit"),draftKey:()=>m()??e.tab,mention:{items:t.searchFilesAndDirectories},state:{opened:()=>K.openedComment,setOpened:P=>J("openedComment",P),selected:()=>K.selected,setSelected:P=>J("selected",P),commenting:()=>K.commenting,setCommenting:P=>J("commenting",P),syncSelected:T,hoverSelected:T},getHoverSelectedRange:M,cancelDraftOnCommentToggle:!0,clearSelectionOnSelectionEndNull:!0,onSubmit:({comment:P,selection:B})=>{const R=m();R&&_({file:R,selection:B,comment:P,origin:"file"})},onUpdate:({id:P,comment:B,selection:R})=>{const V=m();V&&k({id:P,file:V,selection:R,comment:B})},onDelete:P=>{const B=m();B&&C({id:P.id,file:B})},editSubmitLabel:i.t("common.save"),renderCommentActions:(P,B)=>c(Q9,{get moreLabel(){return i.t("common.moreOptions")},get editLabel(){return i.t("common.edit")},get deleteLabel(){return i.t("common.delete")},get onEdit(){return B.edit},get onDelete(){return B.remove}})});ne(()=>{if(typeof window>"u")return;ln(window,"keydown",B=>{u()===e.tab&&(!(B.metaKey||B.ctrlKey)||B.altKey||B.shiftKey||B.key.toLowerCase()==="f"&&(B.preventDefault(),B.stopPropagation(),d?.focus()))},{capture:!0})}),ne(qe(m,()=>{U.note.reset()},{defer:!0})),ne(()=>{const P=r.focus(),B=m();if(!P||!B||P.file!==B||u()!==e.tab)return;const R=O().find(V=>V.id===P.id);R&&(U.note.openComment(R.id,R.selection,{cancelDraft:!0}),requestAnimationFrame(()=>r.clearFocus()))});let A={loaded:!1,ready:!1,active:!1};ne(()=>{const P=!!h()?.loaded,B=t.ready(),R=u()===e.tab,V=P&&!A.loaded||B&&!A.ready||R&&P&&!A.active;A={loaded:P,ready:B,active:R},V&&v.queueRestore()});const j=P=>(()=>{var B=X9();return p(B,c(Jn,{component:o,mode:"text",get file(){return{name:m()??"",contents:P,cacheKey:y()}},enableLineSelection:!0,enableHoverUtility:!0,get selectedLines(){return M()},get commentedLines(){return z()},onRendered:()=>{v.queueRestore()},get annotations(){return U.annotations()},get renderAnnotation(){return U.renderAnnotation},get renderHoverUtility(){return U.renderHoverUtility},onLineSelected:R=>{U.onLineSelected(R)},get onLineNumberSelectionEnd(){return U.onLineNumberSelectionEnd},onLineSelectionEnd:R=>{U.onLineSelectionEnd(R)},search:f,class:"select-text",get media(){return{mode:"auto",path:m(),current:h()?.content,onLoad:v.queueRestore,onError:R=>{R.kind==="svg"&&Nt({variant:"error",title:i.t("toast.file.loadFailed.title")})}}}})),B})();return c(Lt.Content,{get value(){return e.tab},class:"mt-3 relative h-full",get children(){return c(va,{class:"h-full",get viewportRef(){return v.setViewport},get onScroll(){return v.handleScroll},get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return h()?.loaded},get children(){return j(g())}}),c(Xe,{get when(){return h()?.loading},get children(){var P=Y9(),B=P.firstChild;return p(P,()=>i.t("common.loading"),B),P}}),c(Xe,{get when(){return h()?.error},children:P=>(()=>{var B=J9();return p(B,P),B})()})]}})}})}})}Ot(["mousedown","click"]);var nN=I('<div class="h-full flex flex-col"><div class="h-6 shrink-0"aria-hidden></div><div class="flex-1 pb-64 flex items-center justify-center text-center"><div class="text-12-regular text-text-weak">'),jg=I("<div>"),rN=I('<div class="flex items-center gap-1.5"><div>'),iN=I('<div class="flex items-center gap-2"><div>'),oN=I('<div class="bg-background-stronger h-full shrink-0 sticky right-0 z-10 flex items-center justify-center pr-3">'),sN=I('<div class="sticky top-0 shrink-0 flex">'),aN=I('<div class="relative pt-2 flex-1 min-h-0 overflow-hidden"><div class="h-full px-6 pb-42 -mt-4 flex flex-col items-center justify-center text-center gap-6"><div class="text-14-regular text-text-weak max-w-56">'),lN=I('<div class="relative pt-2 flex-1 min-h-0 overflow-hidden">'),cN=I('<aside id=review-panel class="relative min-w-0 h-full flex shrink-0 overflow-hidden bg-background-base"><div class="size-full flex border-l border-border-weaker-base"><div class="relative min-w-0 h-full flex-1 overflow-hidden bg-background-base"><div class="size-full min-w-0 h-full bg-background-base"></div></div><div id=file-tree-panel class="relative min-w-0 h-full shrink-0 overflow-hidden"><div class="h-full flex flex-col overflow-hidden group/filetree">'),uN=I("<div data-component=tabs-drag-preview>"),dN=I('<div class="px-2 py-2 text-12-regular text-text-weak">');function fN(e){const t=or(),r=jr(),i=_t(),n=br(),{sessionKey:o,tabs:s,view:a}=_r(),l=$c("(min-width: 768px)"),u=$(()=>l()&&a().reviewPanel.opened()),d=$(()=>l()&&t.fileTree.opened()),f=$(()=>u()||d()),m=$(()=>l()),h=$(()=>f()?u()?`calc(100% - ${t.session.width()}px)`:`${t.fileTree.width()}px`:"0px"),g=$(()=>d()?`${t.fileTree.width()}px`:"0px"),y=$(()=>e.diffs().map(V=>V.file)),b=$(()=>{const V=(oe,le)=>oe?oe===le?oe:"mix":le,Q=oe=>oe.replaceAll("\\\\","/").replace(/\/+$/,""),ee=new Map;for(const oe of e.diffs()){const le=Q(oe.file),W=oe.status==="added"?"add":oe.status==="deleted"?"del":"mix";ee.set(le,W);const D=le.split("/");for(const[te]of D.slice(0,-1).entries()){const H=D.slice(0,te+1).join("/");H&&ee.set(H,V(ee.get(H),W))}}return ee}),v=V=>(()=>{var Q=nN(),ee=Q.firstChild,oe=ee.nextSibling,le=oe.firstChild;return p(le,V),Q})(),w=$(()=>r.tree.state("")?.loaded?r.tree.children("").length===0:!1),x=V=>V.startsWith("file://")?r.tab(V):V,_=()=>{a().reviewPanel.opened()||a().reviewPanel.open()},k=ES({normalizeTab:x,openTab:s().open,pathFromTab:r.pathFromTab,loadFile:r.load,openReviewPanel:_,setActive:s().setActive}),C=qo({tabs:s,pathFromTab:r.pathFromTab,normalizeTab:x,review:m,hasReview:e.canReview}),O=C.contextOpen,z=C.openedTabs,K=C.activeTab,J=C.activeFileTab,T=()=>t.fileTree.tab(),M=V=>{V!=="changes"&&V!=="all"||t.fileTree.setTab(V)},U=()=>{T()==="changes"&&t.fileTree.setTab("all")},[A,j]=We({activeDraggable:void 0}),P=V=>{const Q=zs(V);Q&&j("activeDraggable",Q)},B=V=>{const{draggable:Q,droppable:ee}=V;if(!Q||!ee)return;const oe=s().all(),le=MS(oe,Q.id.toString(),ee.id.toString());le!==void 0&&s().move(Q.id.toString(),le)},R=()=>{j("activeDraggable",void 0)};return ne(()=>{r.ready()&&ch(o(),{files:s().all().reduce((V,Q)=>{const ee=r.pathFromTab(Q);if(!ee)return V;const oe=r.selectedLines(ee);return V[ee]=oe&&typeof oe=="object"&&"start"in oe&&"end"in oe?oe:null,V},{})})}),c(F,{get when(){return l()},get children(){var V=cN(),Q=V.firstChild,ee=Q.firstChild,oe=ee.firstChild,le=ee.nextSibling,W=le.firstChild;return p(oe,c(gh,{onDragStart:P,onDragEnd:R,onDragOver:B,collisionDetector:fh,get children(){return[c(hh,{}),c(wh,{}),c(Lt,{get value(){return K()},onChange:k,get children(){return[(()=>{var D=sN();return p(D,c(Lt.List,{ref:te=>{const H=G9({el:te,contextOpen:O});je(H)},get children(){return[c(F,{get when(){return Te(()=>!!m())()&&e.canReview()},get children(){return c(Lt.Trigger,{value:"review",get children(){var te=rN(),H=te.firstChild;return p(H,()=>i.t("session.tab.review")),p(te,c(F,{get when(){return e.hasReview()},get children(){var Z=jg();return p(Z,()=>e.reviewCount()),Z}}),null),te}})}}),c(F,{get when(){return O()},get children(){return c(Lt.Trigger,{value:"context",get closeButton(){return c(Et,{get value(){return i.t("common.closeTab")},placement:"bottom",gutter:10,get children(){return c(Pt,{icon:"close-small",variant:"ghost",class:"h-5 w-5",onClick:()=>s().close("context"),get"aria-label"(){return i.t("common.closeTab")}})}})},hideCloseButton:!0,onMiddleClick:()=>s().close("context"),get children(){var te=iN(),H=te.firstChild;return p(te,c(m1,{variant:"indicator"}),H),p(H,()=>i.t("session.tab.context")),te}})}}),c(bh,{get ids(){return z()},get children(){return c(rt,{get each(){return z()},children:te=>c(NI,{tab:te,get onTabClose(){return s().close}})})}}),(()=>{var te=oN();return p(te,c(Et,{get value(){return i.t("command.file.open")},class:"flex items-center",get children(){return c(Pt,{icon:"plus-small",variant:"ghost",iconSize:"large",class:"!rounded-md",onClick:()=>{Bn(()=>import("./dialog-select-file-BItJBmej.js"),__vite__mapDeps([4,1,2,3,5])).then(H=>{n.show(()=>c(H.DialogSelectFile,{mode:"files",onOpenFile:U}))})},get"aria-label"(){return i.t("command.file.open")}})}})),te})()]}})),D})(),c(F,{get when(){return Te(()=>!!m())()&&e.canReview()},get children(){return c(Lt.Content,{value:"review",class:"flex flex-col h-full overflow-hidden contain-strict",get children(){return c(F,{get when(){return K()==="review"},get children(){return e.reviewPanel()}})}})}}),c(Lt.Content,{value:"empty",class:"flex flex-col h-full overflow-hidden contain-strict",get children(){return c(F,{get when(){return K()==="empty"},get children(){var D=aN(),te=D.firstChild,H=te.firstChild;return p(te,c(sh,{class:"w-14 opacity-10"}),H),p(H,()=>i.t("session.files.selectToOpen")),D}})}}),c(F,{get when(){return O()},get children(){return c(Lt.Content,{value:"context",class:"flex flex-col h-full overflow-hidden contain-strict",get children(){return c(F,{get when(){return K()==="context"},get children(){var D=lN();return p(D,c(kI,{})),D}})}})}}),c(F,{get when(){return J()},keyed:!0,children:D=>c(tN,{tab:D})})]}}),c(ph,{get children(){return c(F,{get when(){return A.activeDraggable},keyed:!0,children:D=>{const te=r.pathFromTab(D);return(()=>{var H=uN();return p(H,c(F,{when:te,children:Z=>c(rv,{active:!0,get path(){return Z()}})})),H})()}})}})]}})),p(W,c(Lt,{variant:"pill",get value(){return T()},onChange:M,class:"h-full","data-scope":"filetree",get children(){return[c(Lt.List,{get children(){return[c(Lt.Trigger,{value:"changes",class:"flex-1",classes:{button:"w-full"},get children(){return[Te(()=>e.reviewCount())," ",Te(()=>i.t(e.reviewCount()===1?"session.review.change.one":"session.review.change.other"))]}}),c(Lt.Trigger,{value:"all",class:"flex-1",classes:{button:"w-full"},get children(){return i.t("session.files.all")}})]}}),c(Lt.Content,{value:"changes",class:"bg-background-stronger px-3 py-0",get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return e.hasReview()||!e.diffsReady()},get children(){return c(F,{get when(){return e.diffsReady()},get fallback(){return(()=>{var D=dN();return p(D,()=>i.t("common.loading"),null),p(D,()=>i.t("common.loading.ellipsis"),null),D})()},get children(){return c(oc,{path:"",class:"pt-3",get allowed(){return y()},get kinds(){return b()},draggable:!1,get active(){return e.activeDiff},onFileClick:D=>e.focusReviewDiff(D.path)})}})}}),c(Xe,{when:!0,get children(){return v(e.empty())}})]}})}}),c(Lt.Content,{value:"all",class:"bg-background-stronger px-3 py-0",get children(){return c(Gt,{get children(){return[c(Xe,{get when(){return w()},get children(){return v(i.t("session.files.empty"))}}),c(Xe,{when:!0,get children(){return c(oc,{path:"",class:"pt-3",get modified(){return y()},get kinds(){return b()},onFileClick:D=>k(r.tab(D.path))})}})]}})}})]}})),p(le,c(F,{get when(){return d()},get children(){var D=jg();return D.$$pointerdown=()=>e.size.start(),p(D,c(Cc,{direction:"horizontal",edge:"start",get size(){return t.fileTree.width()},min:200,max:480,onResize:te=>{e.size.touch(),t.fileTree.resize(te)}})),D}}),null),Ae(D=>{var te=i.t("session.panel.reviewAndFiles"),H=!f(),Z=!f(),se={"pointer-events-none":!f(),"transition-[width] duration-[240ms] ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":!e.size.active()&&!e.reviewSnap},re=h(),fe=!u(),Se=!u(),Ne=!u(),ce=!d(),ye=!d(),G={"pointer-events-none":!d(),"transition-[width] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":!e.size.active()},we=g(),ke={"border-l border-border-weaker-base":u()};return te!==D.e&&Ie(V,"aria-label",D.e=te),H!==D.t&&Ie(V,"aria-hidden",D.t=H),Z!==D.a&&(V.inert=D.a=Z),D.o=Ct(V,se,D.o),re!==D.i&&ft(V,"width",D.i=re),fe!==D.n&&Ie(ee,"aria-hidden",D.n=fe),Se!==D.s&&(ee.inert=D.s=Se),Ne!==D.h&&ee.classList.toggle("pointer-events-none",D.h=Ne),ce!==D.r&&Ie(le,"aria-hidden",D.r=ce),ye!==D.d&&(le.inert=D.d=ye),D.l=Ct(le,G,D.l),we!==D.u&&ft(le,"width",D.u=we),D.c=Ct(W,ke,D.c),D},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0}),V}})}Ot(["pointerdown"]);const sc=e=>typeof e=="object"&&e!==null,vl=e=>!(!sc(e)||typeof e.length!="number"||typeof e.cursorX!="number"||typeof e.cursorY!="number"||typeof e.baseY!="number"||typeof e.viewportY!="number"||typeof e.getLine!="function"||typeof e.getNullCell!="function"),Ug=e=>{if(!sc(e))return;const t=e.buffer;if(!sc(t))return;const r=vl(t.active)?t.active:void 0,i=vl(t.normal)?t.normal:void 0,n=vl(t.alternate)?t.alternate:void 0;if(!(!r&&!i))return{active:r,normal:i,alternate:n}};function ac(e,t,r){return Math.max(t,Math.min(e,r))}function mN(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function gN(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function hN(e,t){return!!e.isInverse()==!!t.isInverse()&&!!e.isBold()==!!t.isBold()&&!!e.isUnderline()==!!t.isUnderline()&&!!e.isBlink()==!!t.isBlink()&&!!e.isInvisible()==!!t.isInvisible()&&!!e.isItalic()==!!t.isItalic()&&!!e.isDim()==!!t.isDim()&&!!e.isStrikethrough()==!!t.isStrikethrough()}class pN{constructor(t){this._buffer=t}serialize(t,r){let i=this._buffer.getNullCell();const n=t.start.y,o=t.end.y,s=t.start.x,a=t.end.x;this._beforeSerialize(o-n+1,n,o);for(let l=n;l<=o;l++){const u=this._buffer.getLine(l);if(u){const d=l===t.start.y?s:0,f=Math.min(a,u.length);for(let m=d;m<f;m++){const h=u.getCell(m);h&&(this._nextCell(h,i,l,m),i=h)}}this._rowEnd(l,l===o)}return this._afterSerialize(),this._serializeString(r)}_nextCell(t,r,i,n){}_rowEnd(t,r){}_beforeSerialize(t,r,i){}_afterSerialize(){}_serializeString(t){return""}}class vN extends pN{constructor(t,r){super(t),this._terminal=r,this._cursorStyle=this._buffer.getNullCell()}_rowIndex=0;_allRows=[];_allRowSeparators=[];_currentRow="";_nullCellCount=0;_cursorStyle;_firstRow=0;_lastCursorRow=0;_lastCursorCol=0;_lastContentCursorRow=0;_lastContentCursorCol=0;_beforeSerialize(t,r,i){this._allRows=new Array(t),this._allRowSeparators=new Array(t),this._rowIndex=0,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._lastContentCursorRow=r,this._lastCursorRow=r,this._firstRow=r}_rowEnd(t,r){let i="";const o=!!(r?void 0:this._buffer.getLine(t+1))?.isWrapped;this._nullCellCount>0&&o&&(this._currentRow+=" ".repeat(this._nullCellCount)),this._nullCellCount=0,!r&&!o&&(i=`\r
70
70
  `,this._lastCursorRow=t+1,this._lastCursorCol=0),this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=i,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){const i=[],n=!mN(t,r),o=!gN(t,r),s=!hN(t,r);if(n||o||s)if(this._isAttributeDefault(t))this._isAttributeDefault(r)||i.push(0);else{if(s&&(!!t.isInverse()!=!!r.isInverse()&&i.push(t.isInverse()?7:27),!!t.isBold()!=!!r.isBold()&&i.push(t.isBold()?1:22),!!t.isUnderline()!=!!r.isUnderline()&&i.push(t.isUnderline()?4:24),!!t.isBlink()!=!!r.isBlink()&&i.push(t.isBlink()?5:25),!!t.isInvisible()!=!!r.isInvisible()&&i.push(t.isInvisible()?8:28),!!t.isItalic()!=!!r.isItalic()&&i.push(t.isItalic()?3:23),!!t.isDim()!=!!r.isDim()&&i.push(t.isDim()?2:22),!!t.isStrikethrough()!=!!r.isStrikethrough()&&i.push(t.isStrikethrough()?9:29)),n){const a=t.getFgColor(),l=t.getFgColorMode();l===2||l===3||l===-1?i.push(38,2,a>>>16&255,a>>>8&255,a&255):l===1?a>=16?i.push(38,5,a):i.push(a&8?90+(a&7):30+(a&7)):i.push(39)}if(o){const a=t.getBgColor(),l=t.getBgColorMode();l===2||l===3||l===-1?i.push(48,2,a>>>16&255,a>>>8&255,a&255):l===1?a>=16?i.push(48,5,a):i.push(a&8?100+(a&7):40+(a&7)):i.push(49)}}return i}_isAttributeDefault(t){const r=t.getFgColorMode(),i=t.getBgColorMode();if(r===0&&i===0)return!t.isBold()&&!t.isItalic()&&!t.isUnderline()&&!t.isBlink()&&!t.isInverse()&&!t.isInvisible()&&!t.isDim()&&!t.isStrikethrough();const n=t.getFgColor(),o=t.getBgColor(),s=this._buffer.getNullCell(),a=s.getFgColor(),l=s.getBgColor();return n===a&&o===l&&!t.isBold()&&!t.isItalic()&&!t.isUnderline()&&!t.isBlink()&&!t.isInverse()&&!t.isInvisible()&&!t.isDim()&&!t.isStrikethrough()}_nextCell(t,r,i,n){if(t.getWidth()===0)return;const s=t.getCode(),l=s>1114111||s>=55296&&s<=57343||s>=61440&&t.getWidth()===1,u=s===0||t.getChars()===""||l,d=this._diffStyle(t,this._cursorStyle);if(d.length>0){this._nullCellCount>0&&(this._currentRow+=" ".repeat(this._nullCellCount),this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=i,this._lastContentCursorCol=this._lastCursorCol=n,this._currentRow+=`\x1B[${d.join(";")}m`;const h=this._buffer.getLine(i)?.getCell(n);h&&(this._cursorStyle=h)}u?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(this._currentRow+=" ".repeat(this._nullCellCount),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=i,this._lastContentCursorCol=this._lastCursorCol=n+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let i="";for(let f=0;f<r;f++)i+=this._allRows[f],f+1<r&&(i+=this._allRowSeparators[f]);if(t)return i;const n=(this._buffer.baseY??0)+this._buffer.cursorY,o=ac(n-this._firstRow+1,1,Number.MAX_SAFE_INTEGER),s=this._buffer.cursorX+1;i+=`\x1B[${o};${s}H`;const a=this._buffer.getLine(n),l=a?.getCell(this._buffer.cursorX),u=l?l.getWidth()!==0?l:this._buffer.cursorX>0?a?.getCell(this._buffer.cursorX-1)??l:l:this._buffer.getNullCell(),d=this._diffStyle(u,this._cursorStyle);return d.length&&(i+=`\x1B[${d.join(";")}m`),i}}class bN{_terminal;activate(t){this._terminal=t}dispose(){this._terminal=void 0}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const r=Ug(this._terminal);if(!r)return"";const i=r.normal??r.active,n=r.alternate;if(!i)return"";let o=t?.range?this._serializeBufferByRange(i,t.range,!0):this._serializeBufferByScrollback(i,t?.scrollback);if(!t?.excludeAltBuffer&&r.active?.type==="alternate"&&n){const s=this._serializeBufferByScrollback(n,void 0);o+=`\x1B[?1049h\x1B[H${s}`}return o}serializeAsText(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const r=Ug(this._terminal);if(!r)return"";const i=r.active??r.normal;if(!i)return"";const n=i.length,o=t?.scrollback,s=o===void 0?n:ac(o+this._terminal.rows,0,n),a=n-s,l=n-1,u=[];for(let d=a;d<=l;d++){const f=i.getLine(d);if(f){const m=f.translateToString(t?.trimWhitespace??!0);u.push(m)}}if(t?.trimWhitespace)for(;u.length>0&&u[u.length-1]==="";)u.pop();return u.join(`
71
- `)}_serializeBufferByScrollback(t,r){const i=t.length,n=this._terminal?.rows??24,o=r===void 0?i:ac(r+n,0,i);return this._serializeBufferByRange(t,{start:i-o,end:i-1},!1)}_serializeBufferByRange(t,r,i){const n=new vN(t,this._terminal),o=this._terminal?.cols??80;return n.serialize({start:{x:0,y:r.start},end:{x:o,y:r.end}},i)}}const yN="data-pty-id",yi=()=>({connected:!1,connects:0,rendered:"",settled:0,focusing:0}),ax=()=>{if(typeof window>"u")return;const e=window.__kcode_e2e?.terminal;if(e?.enabled)return e},wi=()=>{const e=ax();if(e)return e.terminals??={},e.terminals},Kg=()=>{const e=ax();if(e)return e.controls??={},e.controls},lx=e=>{const t=r=>{const i=wi();i&&(i[e]={...i[e]??yi(),...r})};return{init(){t(yi())},connect(){const r=wi();if(!r)return;const i=r[e]??yi();r[e]={...i,connected:!0,connects:i.connects+1}},render(r){const i=wi();if(!i)return;const n=i[e]??yi();i[e]={...n,rendered:n.rendered+r}},settle(){const r=wi();if(!r)return;const i=r[e]??yi();r[e]={...i,settled:i.settled+1}},focus(r){t({focusing:Math.max(0,r)})},step(){const r=wi();if(!r)return;const i=r[e]??yi();r[e]={...i,focusing:Math.max(0,i.focusing-1)}},control(r){const i=Kg();i&&(i[e]={...i[e]??{},...r})},drop(){const r=wi();r&&delete r[e];const i=Kg();i&&delete i[e]}}},Qs=e=>typeof e=="object"&&e!==null,wN=e=>Qs(e)&&typeof e.dispose=="function",Is=e=>{wN(e)&&e.dispose()},xN=e=>Qs(e)&&typeof e.setOption=="function",Vg=(e,t,r)=>{xN(e)&&e.setOption(t,r)},_N=e=>{if(!Qs(e))return;const t=e.currentHoveredLink;if(Qs(t)&&typeof t.text=="string")return t.text};function $N(e,t=queueMicrotask){let r,i,n=!1,o=!1;const s=()=>{if(n||o||r?.length)return;const d=i;if(d?.length){i=void 0;for(const f of d)f()}},a=()=>{if(o)return;n=!1;const d=r;if(!d?.length){s();return}r=void 0,o=!0,e(d.join(""),()=>{if(o=!1,r?.length){if(n)return;n=!0,t(a);return}s()})};return{push:d=>{d&&(r?r.push(d):r=[d],!(n||o)&&(n=!0,t(a)))},flush:d=>{if(!n&&!o&&!r?.length){d?.();return}d&&(i?i.push(d):i=[d]),a()}}}var SN=I("<div data-component=terminal>");let vo;const kN=()=>vo||(vo=Bn(()=>import("./ghostty-web-BELRRBIg.js"),__vite__mapDeps([6,1,2])).then(async e=>({mod:e,ghostty:await e.Ghostty.load()})).catch(e=>{throw vo=void 0,e}),vo),CN={light:{background:"#fcfcfc",foreground:"#211e1e",cursor:"#211e1e",selectionBackground:$l("#211e1e",.2)},dark:{background:"#191515",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:$l("#d4d4d4",.25)}},IN=e=>{if(!e||typeof e!="object"||!("name"in e))return;const t=e.name;return typeof t=="string"?t:void 0},TN=e=>{const t=o=>{const s=e.term.getSelection();if(!s)return;const a=o.clipboardData;a&&(o.preventDefault(),a.setData("text/plain",s))},r=o=>{const s=o.clipboardData,a=s?.getData("text/plain")??s?.getData("text")??"";a&&(o.preventDefault(),o.stopPropagation(),e.term.paste(a))},i=()=>{e.term.options.cursorBlink=!0},n=()=>{e.term.options.cursorBlink=!1};e.container.addEventListener("copy",t,!0),e.cleanups.push(()=>e.container.removeEventListener("copy",t,!0)),e.container.addEventListener("paste",r,!0),e.cleanups.push(()=>e.container.removeEventListener("paste",r,!0)),e.container.addEventListener("pointerdown",e.handlePointerDown),e.cleanups.push(()=>e.container.removeEventListener("pointerdown",e.handlePointerDown)),e.container.addEventListener("click",e.handleLinkClick,{capture:!0}),e.cleanups.push(()=>e.container.removeEventListener("click",e.handleLinkClick,{capture:!0})),e.term.textarea?.addEventListener("focus",i),e.term.textarea?.addEventListener("blur",n),e.cleanups.push(()=>e.term.textarea?.removeEventListener("focus",i)),e.cleanups.push(()=>e.term.textarea?.removeEventListener("blur",n))},DN=e=>{if(!e.addon||!e.onCleanup||!e.term)return;const t=(()=>{try{return e.addon.serialize()}catch{return""}})();e.onCleanup({id:e.id,buffer:t,cursor:e.cursor,rows:e.term.rows,cols:e.term.cols,scrollY:e.term.getViewportY()})},AN=e=>{const t=na(),r=Rn();kc();const i=nh(),n=_t(),o=rh(),s=r.directory,a=r.client,l=r.mock,u=r.pty,d=r.url,f=o.current?.http,m=f?.username??"kcode",h=f?.password??"";let g;const[y,b]=$e(e,["pty","class","classList","autoFocus","onConnect","onConnectError"]),v=y.pty.id,w=lx(v),x=typeof y.pty.buffer=="string"?y.pty.buffer:"",_=x&&typeof y.pty.cols=="number"&&Number.isSafeInteger(y.pty.cols)&&y.pty.cols>0&&typeof y.pty.rows=="number"&&Number.isSafeInteger(y.pty.rows)&&y.pty.rows>0?{cols:y.pty.cols,rows:y.pty.rows}:void 0,k=typeof y.pty.scrollY=="number"?y.pty.scrollY:void 0;let C,O,z,K,J,T,M,U,A,j=!1;const P=[],B=typeof y.pty.cursor=="number"&&Number.isSafeInteger(y.pty.cursor)?y.pty.cursor:void 0;let R=B??0,V=B!==void 0?B:x?-1:0,Q,ee,oe,le=0;const W=()=>{if(!P.length)return;const ce=P.splice(0).reverse();for(const ye of ce)try{ye()}catch{}},D=(ce,ye)=>a.pty.update({ptyID:v,size:{cols:ce,rows:ye}}).catch(G=>{}),H=$(()=>{const ce=i.mode()==="dark"?"dark":"light",ye=CN[ce],G=i.themes()[i.themeId()];if(!G)return ye;const we=ce==="dark"?G.dark:G.light;if(!we?.seeds&&!we?.palette)return ye;const ke=u_(we,ce==="dark"),ue=ke["text-stronger"]??ye.foreground,me=ke["background-stronger"]??ye.background,Ue=ce==="dark"?.25:.2,be=ue.startsWith("#")?ue:ye.foreground,Be=$l(be,Ue);return{background:me,foreground:ue,cursor:ue,selectionBackground:Be}}),Z=()=>{j||K&&T===void 0&&(T=requestAnimationFrame(()=>{T=void 0,!j&&K.fit()}))},se=(ce,ye)=>{if(!j&&!(A?.cols===ce&&A?.rows===ye)){if(U={cols:ce,rows:ye},!A){A=U,D(ce,ye);return}M===void 0&&(M=setTimeout(()=>{M=void 0;const G=U;G&&(U=void 0,!j&&(A?.cols===G.cols&&A?.rows===G.rows||(A=G,D(G.cols,G.rows))))},100))}};ne(()=>{const ce=H();O&&Vg(O,"theme",ce)}),ne(()=>{const ce=yf();O&&(Vg(O,"fontFamily",ce),Z())});let re=t.webviewZoom?.();ne(()=>{const ce=t.webviewZoom?.();ce!==void 0&&ce!==re&&(re=ce,Z())});const fe=()=>{const ce=O;ce&&(ce.focus(),ce.textarea?.focus(),setTimeout(()=>ce.textarea?.focus(),0))},Se=()=>{const ce=document.activeElement;ce instanceof HTMLElement&&ce!==g&&!g.contains(ce)&&ce.blur(),fe()},Ne=ce=>{if(!ce.shiftKey&&!ce.ctrlKey&&!ce.metaKey||ce.altKey||ce.button!==0)return;const ye=O;if(!ye)return;const G=_N(ye);G&&(ce.preventDefault(),ce.stopImmediatePropagation(),t.openLink(G))};return Vt(()=>{w.init(),P.push(()=>w.drop()),(async()=>{const ye=await kN();if(j)return;const G=ye.mod,we=ye.ghostty,ke=new G.Terminal({cursorBlink:!0,cursorStyle:"bar",cols:_?.cols,rows:_?.rows,fontSize:14,fontFamily:yf(),allowTransparency:!1,convertEol:!1,theme:H(),scrollback:1e4,ghostty:we});if(P.push(()=>ke.dispose()),j){W();return}O=ke,Q=$N((pe,De)=>ke.write(pe,()=>{w.render(pe),w.settle(),De?.()})),ke.attachCustomKeyEventHandler(pe=>{const De=pe.key.toLowerCase();return pe.ctrlKey&&pe.shiftKey&&!pe.metaKey&&De==="c"?(document.execCommand("copy"),!0):!1});const ue=new G.FitAddon,me=new bN;P.push(()=>Is(ue)),ke.loadAddon(me),ke.loadAddon(ue),K=ue,z=me,ke.open(g),TN({container:g,term:ke,cleanups:P,handlePointerDown:Se,handleLinkClick:Ne}),y.autoFocus!==!1&&fe(),typeof document<"u"&&document.fonts&&document.fonts.ready.then(Z);const Ue=ke.onResize(pe=>{se(pe.cols,pe.rows)});P.push(()=>Is(Ue));const be=ke.onData(pe=>{if(l){u.input(v,pe);return}C?.readyState===WebSocket.OPEN&&C.send(pe)});P.push(()=>Is(be));const Be=ke.onKey(pe=>{pe.key=="Enter"&&e.onSubmit?.()});P.push(()=>Is(Be));const E=()=>{ue.observeResize(),J=Z,window.addEventListener("resize",J),P.push(()=>window.removeEventListener("resize",J))},ae=pe=>new Promise(De=>{if(!Q){De();return}Q.push(pe),Q.flush(De)});x&&_?(await ae(x),ue.fit(),se(ke.cols,ke.rows),k!==void 0&&ke.scrollToLine(k),E()):(ue.fit(),se(ke.cols,ke.rows),x&&(await ae(x),k!==void 0&&ke.scrollToLine(k)),E());const de={value:!1},Ee=new TextDecoder;if(l){ee=u.attach({id:v,cursor:V,fn:(pe,De)=>{pe&&(Q?.push(pe),R=De,V=De)}}),le=0,w.connect(),y.onConnect?.(),se(ke.cols,ke.rows),w.control({disconnect:()=>{a.pty.remove({ptyID:v}).catch(pe=>{})}});return}const Re=pe=>{j||de.value||(de.value=!0,y.onConnectError?.(pe))},ot=()=>a.pty.get({ptyID:v}).then(()=>!1).catch(pe=>IN(pe)==="NotFoundError"),Pe=pe=>{if(j||oe!==void 0)return;const De=Math.min(250*2**Math.min(le,4),4e3);oe=setTimeout(async()=>{if(oe=void 0,!j){if(await ot()){if(j)return;Re(pe);return}j||(le+=1,Oe())}},De)},Oe=()=>{if(j)return;ee?.();const pe=new URL(d+`/pty/${v}/connect`);pe.searchParams.set("directory",s),pe.searchParams.set("cursor",String(V)),pe.protocol=pe.protocol==="https:"?"wss:":"ws:",pe.username=m,pe.password=h;const De=new WebSocket(pe);De.binaryType="arraybuffer",C=De;const st=()=>{j||(le=0,w.connect(),y.onConnect?.(),se(ke.cols,ke.rows))},Je=Tt=>{if(j)return;if(Tt.data instanceof ArrayBuffer){const rn=new Uint8Array(Tt.data);if(rn[0]!==0)return;const $r=Ee.decode(rn.subarray(1));try{const Kn=JSON.parse($r)?.cursor;typeof Kn=="number"&&Number.isSafeInteger(Kn)&&Kn>=0&&(R=Kn,V=Kn)}catch{}return}const zt=typeof Tt.data=="string"?Tt.data:"";zt&&(Q?.push(zt),R+=zt.length,V=R)},Ve=Tt=>{},ht=()=>{De.removeEventListener("open",st),De.removeEventListener("message",Je),De.removeEventListener("error",Ve),De.removeEventListener("close",Mt),C===De&&(C=void 0),ee===ht&&(ee=void 0),De.readyState!==WebSocket.CLOSED&&De.readyState!==WebSocket.CLOSING&&De.close(1e3)},Mt=Tt=>{C===De&&(C=void 0),ee===ht&&(ee=void 0),De.removeEventListener("open",st),De.removeEventListener("message",Je),De.removeEventListener("error",Ve),De.removeEventListener("close",Mt),!j&&Tt.code!==1e3&&Pe(new Error(n.t("terminal.connectionLost.abnormalClose",{code:Tt.code})))};ee=ht,De.addEventListener("open",st),De.addEventListener("message",Je),De.addEventListener("error",Ve),De.addEventListener("close",Mt)};w.control({disconnect:()=>{C&&C.close(4e3,"e2e")}}),Oe()})().catch(ye=>{j||(Nt({variant:"error",title:n.t("terminal.connectionLost.title"),description:ye instanceof Error?ye.message:n.t("terminal.connectionLost.description")}),y.onConnectError?.(ye))})}),je(()=>{j=!0,T!==void 0&&cancelAnimationFrame(T),M!==void 0&&clearTimeout(M),oe!==void 0&&clearTimeout(oe),ee?.(),C&&C.readyState!==WebSocket.CLOSED&&C.readyState!==WebSocket.CLOSING&&C.close(1e3);const ce=()=>{DN({term:O,addon:z,cursor:R,id:v,onCleanup:e.onCleanup}),W()};if(!Q){ce();return}Q.flush(ce)}),(()=>{var ce=SN(),ye=g;return typeof ye=="function"?ut(ye,ce):g=ce,dn(ce,ie({[yN]:v},{"data-prevent-autofocus":"",tabIndex:-1,get style(){return{"background-color":H().background}},get classList(){return{...y.classList??{},"select-text":!0,"size-full px-6 py-3 font-mono relative overflow-hidden":!0,[y.class??""]:!!y.class}}},b),!1,!1),ce})()},Bg=e=>{const t=e.title??"",r=e.titleNumber??0,i=Number.isFinite(r)&&r>0&&oh(t,r);return t&&!i?t:r>0?e.t("terminal.title.numbered",{number:r}):t||e.t("terminal.title")};var PN=I('<div class="h-full flex items-center justify-center">'),ON=I('<div class="flex flex-col h-full"><div class="flex-1 min-h-0 relative">'),EN=I('<div id=terminal-panel role=region class="relative w-full shrink-0 overflow-hidden bg-background-stronger"><div class="absolute inset-x-0 top-0 flex flex-col"><div class="hidden md:block">'),MN=I('<div class="flex flex-col h-full pointer-events-none"><div class="h-10 flex items-center gap-2 px-2 border-b border-border-weaker-base bg-background-stronger overflow-hidden"><div class=flex-1></div><div class="text-text-weak pr-2"></div></div><div class="flex-1 flex items-center justify-center text-text-weak">'),zN=I('<div class="px-2 py-1 rounded-md bg-surface-base text-14-regular text-text-weak truncate max-w-40">'),LN=I('<div class="absolute inset-0">'),FN=I('<div class="relative p-1 h-10 flex items-center bg-background-stronger text-14-regular">');function NN(){const e=[120,240],t=Rn(),r=or(),i=Ko(),n=_t(),{params:o,view:s}=_r(),a=$(()=>s().terminal.opened()),l=Pp(),u=$(()=>r.terminal.height()),d=()=>s().terminal.close();let f;const[m,h]=We({autoCreated:!1,activeDraggable:void 0,view:typeof window>"u"?1e3:window.visualViewport?.height??window.innerHeight});if(t.capabilities.terminal===!1)return null;const g=()=>m.view*.6,y=()=>Math.min(u(),g());Vt(()=>{if(typeof window>"u")return;const O=()=>h("view",window.visualViewport?.height??window.innerHeight),z=window.visualViewport;O(),ln(window,"resize",O),z&&ln(z,"resize",O)}),ne(()=>{if(!a()){h("autoCreated",!1);return}!i.ready()||i.all().length!==0||m.autoCreated||(i.new(),h("autoCreated",!0))}),ne(qe(()=>i.all().length,(O,z)=>{z===void 0||z<=0||O!==0||a()&&d()}));const b=O=>{const z=lx(O);z.focus(e.length+1),Jr(O);const K=requestAnimationFrame(()=>{z.step(),a()&&i.active()===O&&Jr(O)}),J=e.map(T=>window.setTimeout(()=>{z.step(),a()&&i.active()===O&&Jr(O)},T));return()=>{z.focus(0),cancelAnimationFrame(K);for(const T of J)clearTimeout(T)}};ne(qe(()=>[a(),i.active()],([O,z])=>{if(!O||!z)return;const K=b(z);je(K)})),ne(()=>{if(a())return;const O=document.activeElement;O instanceof HTMLElement&&f?.contains(O)&&O.blur()}),ne(()=>{const O=o.dir;O&&i.ready()&&(n.locale(),d_(O,i.all().map(z=>Bg({title:z.title,titleNumber:z.titleNumber,t:n.t}))))});const v=$(()=>{const O=o.dir;return O?f_(O)??[]:[]}),w=i.all,x=$(()=>w().map(O=>O.id)),_=O=>{const z=zs(O);z&&h("activeDraggable",z)},k=O=>{const{draggable:z,droppable:K}=O;if(!z||!K)return;const J=i.all(),T=J.findIndex(U=>U.id===z.id.toString()),M=J.findIndex(U=>U.id===K.id.toString());T!==-1&&M!==-1&&T!==M&&i.move(z.id.toString(),M)},C=()=>{h("activeDraggable",void 0);const O=i.active();O&&requestAnimationFrame(()=>{i.active()===O&&Jr(O)})};return(()=>{var O=EN(),z=O.firstChild,K=z.firstChild,J=f;return typeof J=="function"?ut(J,O):f=O,K.$$pointerdown=()=>l.start(),p(K,c(Cc,{direction:"vertical",get size(){return y()},min:100,get max(){return g()},collapseThreshold:50,onResize:T=>{l.touch(),r.terminal.resize(T)},onCollapse:d})),p(z,c(F,{get when(){return i.ready()},get fallback(){return(()=>{var T=MN(),M=T.firstChild,U=M.firstChild,A=U.nextSibling,j=M.nextSibling;return p(M,c(rt,{get each(){return v()},children:P=>(()=>{var B=zN();return p(B,P),B})()}),U),p(A,()=>n.t("common.loading"),null),p(A,()=>n.t("common.loading.ellipsis"),null),p(j,()=>n.t("terminal.loading")),T})()},get children(){return c(gh,{onDragStart:_,onDragEnd:C,onDragOver:k,collisionDetector:fh,get children(){return[c(hh,{}),c(wh,{}),(()=>{var T=ON(),M=T.firstChild;return p(T,c(Lt,{variant:"alt",get value(){return i.active()},onChange:U=>i.open(U),class:"!h-auto !flex-none",get children(){return c(Lt.List,{class:"h-10 border-b border-border-weaker-base",get children(){return[c(bh,{get ids(){return x()},get children(){return c(rt,{get each(){return w()},children:U=>c(KI,{terminal:U,onClose:d})})}}),(()=>{var U=PN();return p(U,c(Et,{get value(){return n.t("command.terminal.new")},class:"flex items-center",get children(){return c(Pt,{icon:"plus-small",variant:"ghost",iconSize:"large",get onClick(){return i.new},get"aria-label"(){return n.t("command.terminal.new")}})}})),U})()]}})}}),M),p(M,c(F,{get when(){return i.active()},keyed:!0,children:U=>{const A=i.bind();return c(F,{get when(){return w().find(j=>j.id===U)},children:j=>(()=>{var P=LN();return Ie(P,"id",`terminal-wrapper-${U}`),p(P,c(AN,{get pty(){return j()},get autoFocus(){return a()},onConnect:()=>A.trim(U),get onCleanup(){return A.update},onConnectError:()=>A.clone(U)})),P})()})}})),T})(),c(ph,{get children(){return c(F,{get when(){return m.activeDraggable},keyed:!0,children:T=>c(F,{get when(){return w().find(M=>M.id===T)},children:M=>(()=>{var U=FN();return p(U,()=>Bg({title:M().title,titleNumber:M().titleNumber,t:n.t})),U})()})})}})]}})}}),null),Ae(T=>{var M=n.t("terminal.title"),U=!a(),A=!a(),j={"border-t border-border-weak-base":a(),"transition-[height] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[height] motion-reduce:transition-none":!l.active()},P=a()?`${y()}px`:"0px",B=!a(),R=`${y()}px`;return M!==T.e&&Ie(O,"aria-label",T.e=M),U!==T.t&&Ie(O,"aria-hidden",T.t=U),A!==T.a&&(O.inert=T.a=A),T.o=Ct(O,j,T.o),P!==T.i&&ft(O,"height",T.i=P),B!==T.n&&z.classList.toggle("pointer-events-none",T.n=B),R!==T.s&&ft(z,"height",T.s=R),T},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),O})()}Ot(["pointerdown"]);function RN(e){const t=e.indexOf("?");if(t===-1)return;const r=new URLSearchParams(e.slice(t+1)),i=Number(r.get("start")),n=Number(r.get("end"));if(!(!Number.isFinite(i)||!Number.isFinite(n)))return{startLine:i,endLine:n,startChar:0,endChar:0}}function jN(e){return e.filter(r=>r.type==="text").filter(r=>!r.synthetic&&!r.ignored).reduce((r,i)=>!r||i.text.length>r.text.length?i:r,void 0)}function cx(e,t){const i=jN(e)?.text??"",n=t?.directory,o=h=>{if(!n)return h;const g=n.endsWith("/")?n:n+"/";if(h.startsWith(g))return h.slice(g.length);if(h.startsWith(n)){const y=h.slice(n.length);return y.startsWith("/")?y.slice(1):y}return h},s=[];for(const h of e){if(h.type==="file"){const g=h,y=g.source?.text;if(y){const b=y.value,v=y.start,w=y.end;let x=b;b.startsWith("@")&&(x=b.slice(1)),!b.startsWith("@")&&g.source&&"path"in g.source&&(x=g.source.path),s.push({type:"file",start:v,end:w,value:b,path:o(x),selection:RN(g.url)});continue}}if(h.type==="agent"){const g=h,y=g.source;if(!y)continue;s.push({type:"agent",start:y.start,end:y.end,value:y.value,name:g.name})}}s.sort((h,g)=>h.start!==g.start?h.start-g.start:h.end-g.end);const a=[];let l=0,u=0;const d=h=>{h&&(a.push({type:"text",content:h,start:l,end:l+h.length}),l+=h.length)},f=h=>{const g=h.value;a.push({type:"text",content:g,start:l,end:l+g.length}),l+=g.length},m=h=>{const g=h.value,y={type:"agent",name:h.name,content:g,start:l,end:l+g.length};a.push(y),l+=g.length};for(const h of s){if(h.start<0||h.end<h.start)continue;const g=h.value;if(!g)continue;const y=h.end>i.length||h.start<u||i.slice(h.start,h.end)!==g,b=y?i.indexOf(g,u):h.start;if(b===-1)continue;const v=y?b+g.length:h.end;d(i.slice(u,b)),h.type==="file"&&f(h),h.type==="agent"&&m(h),u=v}return d(i.slice(u)),a.length===0&&a.push({type:"text",content:"",start:0,end:0}),a}const Cr=e=>t=>({...t,category:e}),UN=e=>{const t=wc(),r=br(),i=jr(),n=_t(),o=ji(),s=Ui(),a=Rn(),l=sr(),u=Ko(),d=or(),f=ra(),{params:m,tabs:h,view:g}=_r(),y=()=>a.capabilities.terminal!==!1,b=()=>{const Pe=m.id;if(Pe)return l.session.get(Pe)},v=()=>!!m.id,w=Pe=>Pe.startsWith("file://")?i.tab(Pe):Pe,x=qo({tabs:h,pathFromTab:i.pathFromTab,normalizeTab:w,review:e.review,hasReview:v}),_=x.activeFileTab,k=x.closableTab,C={type:"idle"},O=()=>l.data.session_status[m.id??""]??C,z=()=>{const Pe=m.id;return Pe?l.data.message[Pe]??[]:[]},K=()=>z().filter(Pe=>Pe.role==="user"),J=()=>{const Pe=b()?.revert?.messageID;return Pe?K().filter(Oe=>Oe.id<Pe):K()},T=()=>{d.fileTree.tab()==="changes"&&d.fileTree.setTab("all")},M=(Pe,Oe)=>{const pe=i.get(Pe)?.content?.content;if(pe)return ia(pe,{start:Oe.startLine,end:Oe.endLine})},U=(Pe,Oe)=>{const pe=M(Pe,Oe);s.context.add({type:"file",path:Pe,selection:Oe,preview:pe})},A=()=>{const Pe=_();if(!Pe)return!1;const Oe=i.pathFromTab(Pe);return Oe?i.selectedLines(Oe)!=null:!1},j=e.navigateMessageByOffset,P=e.setActiveMessage,B=e.focusInput,R=Cr(n.t("command.category.session")),V=Cr(n.t("command.category.file")),Q=Cr(n.t("command.category.context")),ee=Cr(n.t("command.category.view")),oe=Cr(n.t("command.category.terminal")),le=Cr(n.t("command.category.model")),W=Cr(n.t("command.category.mcp")),D=Cr(n.t("command.category.mode")),te=async Pe=>{const Oe=typeof document>"u"?void 0:document.body;if(Oe){const De=document.createElement("textarea");De.value=Pe,De.setAttribute("readonly",""),De.style.position="fixed",De.style.opacity="0",De.style.pointerEvents="none",Oe.appendChild(De),De.select();const st=document.execCommand("copy");if(Oe.removeChild(De),st)return!0}const pe=typeof navigator>"u"?void 0:navigator.clipboard;return pe?.writeText?pe.writeText(Pe).then(()=>!0,()=>!1):!1},H=async(Pe,Oe)=>{if(!await te(Pe)){Nt({title:n.t("toast.session.share.copyFailed.title"),variant:"error"});return}Nt({title:Oe?n.t("session.share.copy.copied"):n.t("toast.session.share.success.title"),description:n.t("toast.session.share.success.description"),variant:"success"})},Z=async()=>{const Pe=m.id;if(!Pe)return;const Oe=b()?.share?.url;if(Oe){await H(Oe,!0);return}const pe=await a.client.session.share({sessionID:Pe}).then(De=>De.data?.share?.url).catch(()=>{});if(!pe){Nt({title:n.t("toast.session.share.failed.title"),description:n.t("toast.session.share.failed.description"),variant:"error"});return}await H(pe,!1)},se=async()=>{const Pe=m.id;Pe&&await a.client.session.unshare({sessionID:Pe}).then(()=>Nt({title:n.t("toast.session.unshare.success.title"),description:n.t("toast.session.unshare.success.description"),variant:"success"})).catch(()=>Nt({title:n.t("toast.session.unshare.failed.title"),description:n.t("toast.session.unshare.failed.description"),variant:"error"}))},re=()=>{Bn(()=>import("./dialog-select-file-BnW7C137.js"),__vite__mapDeps([4,1,2,3,5])).then(Pe=>{r.show(()=>c(Pe.DialogSelectFile,{onOpenFile:T}))})},fe=()=>{const Pe=k();Pe&&h().close(Pe)},Se=()=>{const Pe=_();if(!Pe)return;const Oe=i.pathFromTab(Pe);if(!Oe)return;const pe=i.selectedLines(Oe);if(!pe){Nt({title:n.t("toast.context.noLineSelection.title"),description:n.t("toast.context.noLineSelection.description")});return}U(Oe,Ao(pe))},Ne=()=>{y()&&(u.all().length>0&&u.new(),g().terminal.open())},ce=()=>{Bn(()=>Promise.resolve().then(()=>l1),void 0).then(Pe=>{r.show(()=>c(Pe.DialogSelectModel,{get model(){return o.model}}))})},ye=()=>{Bn(()=>import("./dialog-select-mcp-C3_oPeHg.js"),__vite__mapDeps([7,1,2,3,5])).then(Pe=>{r.show(()=>c(Pe.DialogSelectMcp,{}))})},G=async()=>{const Pe=m.id;if(!Pe)return;O().type!=="idle"&&await a.client.session.abort({sessionID:Pe}).catch(()=>{});const Oe=b()?.revert?.messageID,pe=bo(K(),Je=>!Oe||Je.id<Oe);if(!pe)return;await a.client.session.revert({sessionID:Pe,messageID:pe.id});const De=l.data.part[pe.id];if(De){const Je=cx(De,{directory:a.directory});s.set(Je)}const st=bo(K(),Je=>Je.id<pe.id);P(st)},we=async()=>{const Pe=m.id;if(!Pe)return;const Oe=b()?.revert?.messageID;if(!Oe)return;const pe=K().find(st=>st.id>Oe);if(!pe){await a.client.session.unrevert({sessionID:Pe}),s.reset();const st=bo(K(),Je=>Je.id>=Oe);P(st);return}await a.client.session.revert({sessionID:Pe,messageID:pe.id});const De=bo(K(),st=>st.id<pe.id);P(De)},ke=async()=>{const Pe=m.id;if(!Pe)return;const Oe=o.model.current();if(!Oe){Nt({title:n.t("toast.model.none.title"),description:n.t("toast.model.none.description")});return}await a.client.session.summarize({sessionID:Pe,modelID:Oe.id,providerID:Oe.provider.id})},ue=()=>{Bn(()=>import("./dialog-fork-Cmp2Zg_-.js"),__vite__mapDeps([8,1,2,3,5])).then(Pe=>{r.show(()=>c(Pe.DialogFork,{}))})},me=()=>l.data.config.share==="disabled"?[]:[R({id:"session.share",title:b()?.share?.url?n.t("session.share.copy.copyLink"):n.t("command.session.share"),description:b()?.share?.url?n.t("toast.session.share.success.description"):n.t("command.session.share.description"),slash:"share",disabled:!m.id,onSelect:Z}),R({id:"session.unshare",title:n.t("command.session.unshare"),description:n.t("command.session.unshare.description"),slash:"unshare",disabled:!m.id||!b()?.share?.url,onSelect:se})],Ue=()=>[R({id:"session.new",title:n.t("command.session.new"),slash:"new",onSelect:()=>f(`/${m.dir}/session`)}),R({id:"session.undo",title:n.t("command.session.undo"),description:n.t("command.session.undo.description"),slash:"undo",disabled:!m.id||J().length===0,onSelect:G}),R({id:"session.redo",title:n.t("command.session.redo"),description:n.t("command.session.redo.description"),slash:"redo",disabled:!m.id||!b()?.revert?.messageID,onSelect:we}),R({id:"session.compact",title:n.t("command.session.compact"),description:n.t("command.session.compact.description"),slash:"compact",disabled:!m.id||J().length===0,onSelect:ke}),R({id:"session.fork",title:n.t("command.session.fork"),description:n.t("command.session.fork.description"),slash:"fork",disabled:!m.id||J().length===0,onSelect:ue})],be=()=>[V({id:"file.open",title:n.t("command.file.open"),description:n.t("palette.search.placeholder"),slash:"open",onSelect:re}),V({id:"tab.close",title:n.t("command.tab.close"),disabled:!k(),onSelect:fe})],Be=()=>[Q({id:"context.addSelection",title:n.t("command.context.addSelection"),description:n.t("command.context.addSelection.description"),disabled:!A(),onSelect:Se})],E=()=>[...y()?[ee({id:"terminal.toggle",title:n.t("command.terminal.toggle"),slash:"terminal",onSelect:()=>g().terminal.toggle()})]:[],ee({id:"review.toggle",title:n.t("command.review.toggle"),onSelect:()=>g().reviewPanel.toggle()}),ee({id:"fileTree.toggle",title:n.t("command.fileTree.toggle"),onSelect:()=>d.fileTree.toggle()}),ee({id:"input.focus",title:n.t("command.input.focus"),onSelect:B})],ae=()=>y()?[oe({id:"terminal.new",title:n.t("command.terminal.new"),description:n.t("command.terminal.new.description"),onSelect:Ne})]:[],de=()=>[R({id:"message.previous",title:n.t("command.message.previous"),description:n.t("command.message.previous.description"),disabled:!m.id,onSelect:()=>j(-1)}),R({id:"message.next",title:n.t("command.message.next"),description:n.t("command.message.next.description"),disabled:!m.id,onSelect:()=>j(1)})],Ee=()=>[le({id:"model.choose",title:n.t("command.model.choose"),description:n.t("command.model.choose.description"),slash:"model",onSelect:ce})],Re=()=>[W({id:"mcp.toggle",title:n.t("command.mcp.toggle"),description:n.t("command.mcp.toggle.description"),slash:"mcp",onSelect:ye})],ot=()=>[D({id:"mode.cycle",title:n.t("command.mode.cycle"),description:n.t("command.mode.cycle.description"),slash:"mode",onSelect:()=>o.mode.move(1)}),D({id:"mode.cycle.reverse",title:n.t("command.mode.cycle.reverse"),description:n.t("command.mode.cycle.reverse.description"),onSelect:()=>o.mode.move(-1)})];t.register("session",()=>[...Ue(),...me(),...be(),...Be(),...E(),...ae(),...de(),...Ee(),...Re(),...ot()])},bl=e=>{const r=(e.startsWith("#")?e.slice(1):e).match(/^message-(.+)$/);if(r)return r[1]},KN=e=>{const t=$(()=>e.visibleUserMessages()),r=$(()=>new Map(t().map(v=>[v.id,v]))),i=$(()=>new Map(t().map((v,w)=>[v.id,w])));let n="",o=!1;const s=Sc(),a=ra(),l=new Set,u=v=>{const w=requestAnimationFrame(()=>{l.delete(w),v()});l.add(w)},d=()=>{for(const v of l)cancelAnimationFrame(v);l.clear()},f=()=>{d(),e.consumePendingMessage(e.sessionKey()),e.pendingMessage()&&e.setPendingMessage(void 0),s.hash&&(o=!0,a(s.pathname+s.search,{replace:!0}))},m=v=>{const w=`#${e.anchor(v)}`;s.hash!==w&&(o=!1,a(s.pathname+s.search+w,{replace:!0}))},h=(v,w)=>{const x=e.scroller();if(!x)return!1;const _=v.getBoundingClientRect(),k=x.getBoundingClientRect(),C=x.querySelector("[data-session-title]"),O=C instanceof HTMLElement?C.offsetHeight:0,z=Math.max(0,_.top-k.top+x.scrollTop-O);return x.scrollTo({top:z,behavior:w}),!0},g=(v,w,x=4)=>{const _=document.getElementById(e.anchor(v));return _?h(_,w):(x<=0||u(()=>{g(v,w,x-1)}),!1)},y=(v,w="smooth")=>{d(),e.currentMessageId()!==v.id&&e.setActiveMessage(v);const x=i().get(v.id)??-1;if(x!==-1&&x<e.turnStart()){e.setTurnStart(x),u(()=>{g(v.id,w)}),m(v.id);return}if(g(v.id,w)){m(v.id);return}m(v.id)},b=v=>{const w=s.hash.slice(1);if(!w){e.autoScroll.forceScrollToBottom();const C=e.scroller();C&&e.scheduleScrollState(C);return}const x=bl(w);if(x){e.autoScroll.pause();const C=r().get(x);if(C){y(C,v);return}return}const _=document.getElementById(w);if(_){e.autoScroll.pause(),h(_,v);return}e.autoScroll.forceScrollToBottom();const k=e.scroller();k&&e.scheduleScrollState(k)};return ne(()=>{s.hash||(o=!1),!(!e.sessionID()||!e.messagesReady())&&(d(),u(()=>b("auto")))}),ne(()=>{if(!e.sessionID()||!e.messagesReady())return;t(),e.turnStart();let v=e.pendingMessage();if(!v){const _=e.sessionKey();if(n!==_){n=_;const k=e.consumePendingMessage(_);k&&(e.setPendingMessage(k),v=k)}}if(!v&&!o&&(v=bl(s.hash)),!v)return;const w=e.pendingMessage()===v,x=r().get(v);x&&(w&&e.setPendingMessage(void 0),!(e.currentMessageId()===v&&!w)&&(e.autoScroll.pause(),d(),u(()=>y(x,"auto"))))}),ne(()=>{const v=e.sessionID();if(!v||!e.messagesReady())return;t();let w=e.pendingMessage();!w&&!o&&(w=bl(s.hash)),w&&(r().has(w)||!e.historyMore()||e.historyLoading()||e.loadMore(v))}),Vt(()=>{typeof window<"u"&&"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual")}),je(d),{clearMessageHash:f,scrollToMessage:y,applyHash:b}};var VN=I('<div class="h-full pb-64 -mt-4 flex flex-col items-center justify-center text-center gap-6"><div class="text-14-regular text-text-weak max-w-56">'),yl=I("<div>"),BN=I('<div><div class="flex flex-col gap-3"><div class="text-14-medium text-text-strong"></div><div class="text-14-regular text-text-base max-w-md"style=line-height:var(--line-height-normal)>'),ZN=I('<div><div class="text-14-regular text-text-weak max-w-56">'),HN=I('<div class="flex flex-col h-full overflow-hidden bg-background-stronger contain-strict"><div class="relative pt-2 flex-1 min-h-0 overflow-hidden">'),qN=I('<div class="relative bg-background-base size-full overflow-hidden flex flex-col"><div class="flex-1 min-h-0 flex flex-col md:flex-row"><div><div class="flex-1 min-h-0 overflow-hidden">');const lc=[],Zg=[];function GN(e){const[a,l]=We({turnID:void 0,turnStart:0,prefetchUntil:0,prefetchNoGrowth:0}),u=w=>w>10?w-10:0,d=$(()=>{const w=e.sessionID(),x=e.visibleUserMessages().length;return!w||x<=0?0:a.turnID!==w?u(x):a.turnStart<=0?0:a.turnStart>=x?u(x):a.turnStart}),f=w=>{const x=e.sessionID(),_=w>0?w:0;if(!x){l({turnID:void 0,turnStart:_});return}l({turnID:x,turnStart:_})},m=$(()=>{const w=e.visibleUserMessages(),x=d();return x<=0?w:w.slice(x)},lc,{equals:Pr}),h=w=>{const x=e.scroller();if(!x){w();return}const _=x.scrollTop,k=x.scrollHeight;w(),requestAnimationFrame(()=>{const C=x.scrollHeight-k;C&&(x.scrollTop=_+C)})},g=()=>{const w=d();if(w<=0)return;const x=w-8,_=x>0?x:0;h(()=>f(_))},y=async()=>{const w=e.sessionID();if(!w)return;const x=d(),_=e.visibleUserMessages().length;let k=e.loaded();if(x>0&&f(0),!e.historyMore()||e.historyLoading())return;let C=_,O=0;for(;;){if(await e.loadMore(w),e.sessionID()!==w)return;C=e.visibleUserMessages().length;const J=e.loaded(),T=J-k;if(O+=T,k=J,C>_||T<=0||!e.historyMore())break}if(O<=0||(a.prefetchNoGrowth&&l("prefetchNoGrowth",0),C-_<=0)||d()!==0)return;const K=Math.min(C,_+8);f(Math.max(0,C-K))},b=async w=>{const x=e.sessionID();if(!x||!e.historyMore()||e.historyLoading())return;if(w?.prefetch){const A=Date.now();if(a.prefetchUntil>A||a.prefetchNoGrowth>=2)return;l("prefetchUntil",A+400)}const _=d(),k=e.visibleUserMessages().length,C=_<=0?k:m().length;let O=e.loaded(),z=0,K=0;for(;;){if(await e.loadMore(x),e.sessionID()!==x)return;const A=e.loaded(),j=A-O;if(z+=j,O=A,K=e.visibleUserMessages().length-k,K>0||j<=0||w?.prefetch||!e.historyMore())break}const J=e.visibleUserMessages().length;if(w?.prefetch?l("prefetchNoGrowth",z>0?0:a.prefetchNoGrowth+1):z>0&&a.prefetchNoGrowth&&l("prefetchNoGrowth",0),z<=0||K<=0)return;if(w?.prefetch){const A=d();h(()=>f(A+K));return}if(d()!==_)return;const T=m().length,M=Math.max(C,T),U=Math.min(J,M+8);h(()=>f(Math.max(0,J-U)))},v=()=>{if(!e.userScrolled())return;const w=e.scroller();if(!w||w.scrollTop>=200)return;const x=d();if(x>0){x<=16&&b({prefetch:!0}),g();return}b()};return ne(qe(e.sessionID,()=>{l({prefetchUntil:0,prefetchNoGrowth:0})},{defer:!0})),ne(qe(()=>[e.sessionID(),e.messagesReady()],([w,x])=>{!w||!x||f(u(e.visibleUserMessages().length))},{defer:!0})),{turnStart:d,setTurnStart:f,renderedUserMessages:m,loadAndReveal:y,onScrollerScroll:v}}function WN(){const e=xc(),t=or(),r=ji(),i=jr(),n=sr(),o=br(),s=_t(),a=Rn(),l=kc(),u=Ui(),d=_c(),f=Ko(),[m,h]=m_(),{params:g,sessionKey:y,tabs:b,view:v}=_r();ne(()=>{u.ready()&&kt(()=>{if(g.id)return;const S=m.prompt;S&&(u.set([{type:"text",content:S,start:0,end:S.length}],S.length),h({...m,prompt:void 0}))})});const[w,x]=We({pendingMessage:void 0,reviewSnap:!1,scrollGesture:0,scroll:{overflow:!1,bottom:!0,jump:!1}}),_=WM(),k=$(()=>g.dir??""),C=$(()=>t.tabs(k));ne(qe(()=>g.id,(S,q)=>{if(!S||q)return;const ve=t.handoff.tabs();if(!ve)return;if(Date.now()-ve.at>6e4){t.handoff.clearTabs();return}if(ve.id!==S||(t.handoff.clearTabs(),ve.dir!==(g.dir??"")))return;const Fe=C().tabs();if(Fe.all.length===0&&!Fe.active)return;const Me=b().tabs();if(Me.all.length>0||Me.active)return;const tt=j(Fe.all),Ht=Fe.active?A(Fe.active):void 0;b().setAll(tt),b().setActive(Ht&&tt.includes(Ht)?Ht:tt[0]),C().setAll([]),C().setActive(void 0)},{defer:!0}));const O=$c("(min-width: 768px)"),z=Pp(),K=$(()=>O()&&v().reviewPanel.opened()),J=$(()=>O()&&t.fileTree.opened()),T=$(()=>K()||J()),M=$(()=>T()?K()?`${t.session.width()}px`:`calc(100% - ${t.fileTree.width()}px)`:"100%"),U=$(()=>O()&&!K());function A(S){return S.startsWith("file://")?i.tab(S):S}function j(S){const q=new Set,ve=[];for(const Fe of S){const Me=A(Fe);q.has(Me)||(q.add(Me),ve.push(Me))}return ve}const P=()=>{v().reviewPanel.opened()||v().reviewPanel.open()},B=$(()=>g.id?n.session.get(g.id):void 0),R=$(()=>g.id?n.data.session_diff[g.id]??[]:[]),V=$(()=>Math.max(B()?.summary?.files??0,R().length)),Q=$(()=>V()>0),ee=$(()=>!!n.project),oe=$(()=>O()),le=qo({tabs:b,pathFromTab:i.pathFromTab,normalizeTab:A,review:oe,hasReview:ee});le.contextOpen,le.openedTabs;const W=le.activeTab,D=le.activeFileTab,te=$(()=>B()?.revert?.messageID),H=$(()=>g.id?n.data.message[g.id]??[]:[]),Z=$(()=>{const S=g.id;return S?n.data.message[S]!==void 0:!0}),se=$(()=>{const S=g.id;return S?n.session.history.more(S):!1}),re=$(()=>{const S=g.id;return S?n.session.history.loading(S):!1}),fe=$(()=>{const S=g.id;return!S||!Q()?!0:n.data.session_diff[S]!==void 0}),Se=$(()=>H().filter(S=>S.role==="user"),lc,{equals:Pr}),Ne=$(()=>{const S=te();return S?Se().filter(q=>q.id<S):Se()},lc,{equals:Pr}),ce=$(()=>Ne().at(-1));ne(()=>{const S=D();if(!S)return;const q=i.pathFromTab(S);q&&i.load(q)}),ne(qe(()=>ce()?.id,()=>{const S=ce();S&&D9(r,S)})),ne(qe(()=>({dir:g.dir,id:g.id}),(S,q)=>{q&&(S.dir===q.dir&&S.id===q.id||q.id&&!S.id&&r.session.reset())},{defer:!0}));const[ye,G]=We({messageId:void 0,mobileTab:"session",changes:"git",deferRender:!1}),[we,ke]=We({diff:{git:[],branch:[]},ready:{git:!1,branch:!1}}),[ue,me]=Os(Es.workspace(a.directory,"followup",["followup.v1"]),We({items:{},failed:{},paused:{},edit:{}}));xl(S=>{const q=y();return q!==S&&(G("deferRender",!0),requestAnimationFrame(()=>{setTimeout(()=>G("deferRender",!1),0)})),q},y());let Ue,be,Be,E,ae,de,Ee;const Re=new Map,ot=new Map,Pe=S=>{const q=(ot.get(S)??0)+1;return ot.set(S,q),q},Oe=S=>{["git","branch"].forEach(ve=>{Pe(ve),Re.delete(ve),ke("diff",ve,[]),ke("ready",ve,!1)})},pe=(S,q=!1)=>{if(n.project?.vcs!=="git"||!q&&we.ready[S])return Promise.resolve();q&&(Re.has(S)&&Pe(S),Re.delete(S),ke("ready",S,!1));const ve=Re.get(S);if(ve)return ve;const Fe=Pe(S),Me=a.client.vcs.diff({mode:S}).then(tt=>{ot.get(S)===Fe&&(ke("diff",S,tt.data??[]),ke("ready",S,!0))}).catch(tt=>{ot.get(S)===Fe&&(console.debug("[session-review] failed to load vcs diff",{mode:S,error:tt}),ke("diff",S,[]),ke("ready",S,!0))}).finally(()=>{Re.get(S)===Me&&Re.delete(S)});return Re.set(S,Me),Me},De=()=>{Oe();const S=kt(Ve);S&&kt(Ke)&&pe(S,!0)};xl(S=>{const q=K();return S===void 0||S===q||(Ue!==void 0&&cancelAnimationFrame(Ue),x("reviewSnap",!0),Ue=requestAnimationFrame(()=>{Ue=void 0,x("reviewSnap",!1)})),q},K());const st=$(()=>ce()?.summary?.diffs??[]),Je=$(()=>{const S=[];return n.project?.vcs==="git"&&S.push("git"),n.project?.vcs==="git"&&n.data.vcs?.branch&&n.data.vcs?.default_branch&&n.data.vcs.branch!==n.data.vcs.default_branch&&S.push("branch"),S.push("session","turn"),S}),Ve=$(()=>{if(ye.changes==="git"||ye.changes==="branch")return ye.changes}),ht=$(()=>ye.changes==="git"?we.diff.git:ye.changes==="branch"?we.diff.branch:ye.changes==="session"?R():st()),Mt=$(()=>ye.changes==="git"?we.diff.git.length:ye.changes==="branch"?we.diff.branch.length:ye.changes==="session"?V():st().length),Tt=$(()=>Mt()>0),zt=$(()=>ye.changes==="git"?we.ready.git:ye.changes==="branch"?we.ready.branch:ye.changes==="session"?!Q()||fe():!0),rn=S=>{On=an,G("messageId",S?.id)},$r=S=>`message-${S}`,Un=()=>{const S=on;if(!S)return ye.messageId;const q=S.getBoundingClientRect(),ve=q.top+100,Fe=[...S.querySelectorAll("[data-message-id]")].map(fn=>{const ro=fn.dataset.messageId;if(!ro)return;const io=fn.getBoundingClientRect();return{id:ro,top:io.top,bottom:io.bottom}}).filter(fn=>!!fn),Me=Fe.filter(fn=>fn.bottom>q.top&&fn.top<q.bottom),tt=Me.find(fn=>fn.top<=ve&&fn.bottom>=ve);if(tt)return tt.id;const Ht=[...Me].sort((fn,ro)=>{const io=Math.abs(fn.top-ve),mf=Math.abs(ro.top-ve);return io!==mf?io-mf:fn.top-ro.top})[0];return Ht?Ht.id:Fe.filter(fn=>fn.top<=ve).at(-1)?.id??Fe[0]?.id??ye.messageId};function Kn(S){const q=Ne();if(q.length===0)return;const ve=ye.messageId&&On===an?ye.messageId:Un(),Fe=ve?q.findIndex(Ht=>Ht.id===ve):q.length,tt=(Fe===-1?q.length:Fe)+S;if(!(tt<0||tt>q.length)){if(tt===q.length){vi();return}Cn.pause(),Ox(q[tt],"auto")}}const Br=$(()=>{const S=n.project;return S&&!S.vcs?"session.review.noVcs":n.data.config.snapshot===!1?"session.review.noSnapshot":"session.review.empty"});function At(S){const q=e.data.project;n.set("project",S.id);const ve=q.findIndex(Me=>Me.id===S.id);if(ve>=0){e.set("project",q.map((Me,tt)=>tt===ve?{...Me,...S}:Me));return}const Fe=q.findIndex(Me=>Me.id>S.id);if(Fe>=0){e.set("project",[...q.slice(0,Fe),S,...q.slice(Fe)]);return}e.set("project",[...q,S])}const kn=Dr(()=>({mutationFn:()=>a.client.project.initGit(),onSuccess:S=>{S.data&&At(S.data)},onError:S=>{Nt({variant:"error",title:s.t("common.requestFailed"),description:_l(S,s.t)})}}));function Yi(){kn.isPending||kn.mutate()}let Pn,lr,cr=0,on,pi,an=0,On=0;const Zr=250,Sr=S=>{const q=on;if(!q)return;const Fe=(S instanceof Element?S:void 0)?.closest("[data-scrollable]");Fe&&Fe!==q||x("scrollGesture",Date.now())},Hr=()=>Date.now()-w.scrollGesture<Zr;ne(qe([()=>a.directory,()=>g.id],([,S])=>{if(be!==void 0&&cancelAnimationFrame(be),Be!==void 0&&window.clearTimeout(Be),be=void 0,Be=void 0,!S)return;const ve=kt(()=>n.data.message[S]!==void 0)?(()=>{const Fe=g_(a.directory,S);return Fe?Date.now()-Fe.at>h_:!0})():!1;kt(()=>{n.session.sync(S)}),be=requestAnimationFrame(()=>{be=void 0,Be=window.setTimeout(()=>{Be=void 0,g.id===S&&kt(()=>{ve&&n.session.sync(S,{force:!0})})},0)})})),ne(qe(()=>{const S=g.id;return[a.directory,S,S?n.data.session_status[S]?.type??"idle":"idle",S?_.blocked():!1]},([S,q,ve,Fe])=>{if(E!==void 0&&cancelAnimationFrame(E),ae!==void 0&&window.clearTimeout(ae),E=void 0,ae=void 0,!q||ve==="idle"&&!Fe)return;const Me=kt(()=>n.data.todo[q]!==void 0||e.data.session_todo[q]!==void 0);E=requestAnimationFrame(()=>{E=void 0,ae=window.setTimeout(()=>{ae=void 0,!(a.directory!==S||g.id!==q)&&kt(()=>{n.session.todo(q,Me?{force:!0}:void 0)})},0)})},{defer:!0})),ne(qe(()=>Ne().at(-1)?.id,(S,q)=>{S&&q&&S>q&&G("messageId",void 0)},{defer:!0})),ne(qe(y,()=>{G("messageId",void 0),G("changes","git"),x("pendingMessage",void 0)},{defer:!0})),ne(qe(()=>a.directory,()=>{Oe()},{defer:!0})),ne(qe(()=>[n.data.vcs?.branch,n.data.vcs?.default_branch],(S,q)=>{q===void 0||Pr(S,q)||De()},{defer:!0}));const N=a.event.listen(S=>{if(S.details.type!=="file.watcher.updated")return;const q=typeof S.details.properties=="object"&&S.details.properties?S.details.properties:void 0,ve=typeof q?.file=="string"?q.file:void 0;!ve||ve.startsWith(".git/")||De()});je(N);const X=(S,q)=>{const ve=i.get(S)?.content?.content;if(ve)return ia(ve,{start:q.startLine,end:q.endLine})},ge=S=>{const q=Ao(S.selection),ve=S.preview??X(S.file,q),Fe=d.add({file:S.file,selection:S.selection,comment:S.comment});u.context.add({type:"file",path:S.file,selection:q,comment:S.comment,commentID:Fe.id,commentOrigin:S.origin,preview:ve})},He=S=>{d.update(S.file,S.id,S.comment),u.context.updateComment(S.file,S.id,{comment:S.comment,...S.preview?{preview:S.preview}:{}})},at=S=>{d.remove(S.file,S.id),u.context.removeComment(S.file,S.id)},$t=$(()=>({moreLabel:s.t("common.moreOptions"),editLabel:s.t("common.edit"),deleteLabel:s.t("common.delete"),saveLabel:s.t("common.save")})),lt=S=>S instanceof HTMLElement?/^(INPUT|TEXTAREA|SELECT|BUTTON)$/.test(S.tagName)||S.isContentEditable:!1,he=()=>{let S=document.activeElement;for(;S instanceof HTMLElement&&S.shadowRoot?.activeElement;)S=S.shadowRoot.activeElement;return S instanceof HTMLElement?S:void 0},L=S=>{const q=S.composedPath(),ve=q.find(tt=>tt instanceof HTMLElement),Fe=he();if(!(q.some(tt=>tt instanceof HTMLElement&&tt.closest("[data-prevent-autofocus]")!==null)||lt(ve))){if(Fe){const tt=Fe.closest("[data-prevent-autofocus]"),Ht=lt(Fe);if(tt||Ht)return}if(!o.active){if(Fe===Pn){S.key==="Escape"&&Pn?.blur();return}if(v().terminal.opened()){const tt=f.active();if(tt&&PS(S)&&Jr(tt))return}if(S.key==="PageUp"||S.key==="PageDown"||S.key==="Home"||S.key==="End"){Sr();return}if(S.key.length===1&&S.key!=="Unidentified"&&!(S.ctrlKey||S.metaKey)){if(_.blocked())return;Pn?.focus()}}}},xe=$(()=>!O()&&ye.mobileTab==="changes"),Ke=$(()=>O()?J()||K()&&W()==="review":ye.mobileTab==="changes");ne(()=>{const S=Je();if(S.includes(ye.changes))return;const q=S[0];q&&G("changes",q)}),ne(()=>{const S=Ve();S&&Ke()&&pe(S)}),ne(qe(()=>n.data.session_status[g.id??""]?.type,(S,q)=>{const ve=Ve();ve&&Ke()&&(S!=="idle"||q===void 0||q==="idle"||pe(ve,!0))},{defer:!0}));const wt=()=>t.fileTree.tab(),Bt=S=>t.fileTree.setTab(S),[St,Zt]=We({reviewScroll:void 0,pendingDiff:void 0,activeDiff:void 0});ne(qe(y,()=>{Zt({reviewScroll:void 0,pendingDiff:void 0,activeDiff:void 0})},{defer:!0}));const En=()=>{wt()==="changes"&&Bt("all")};UN({navigateMessageByOffset:Kn,setActiveMessage:rn,focusInput:()=>Pn?.focus(),review:oe});const Ji=OS({showAllFiles:En,tabForPath:i.tab,openTab:b().open,setActive:b().setActive,loadFile:i.load}),Xt=()=>ee()?c(Zh,{get options(){return Je()},get current(){return ye.changes},label:q=>q==="git"?s.t("ui.sessionReview.title.git"):q==="branch"?s.t("ui.sessionReview.title.branch"):q==="session"?s.t("ui.sessionReview.title"):s.t("ui.sessionReview.title.lastTurn"),onSelect:q=>q&&G("changes",q),variant:"ghost",size:"small",valueClass:"text-14-medium"}):null,Qi=S=>(()=>{var q=VN(),ve=q.firstChild;return p(ve,S),q})(),Gr=$(()=>ye.changes==="git"?s.t("session.review.noUncommittedChanges"):ye.changes==="branch"?s.t("session.review.noBranchChanges"):ye.changes==="turn"?s.t("session.review.noChanges"):s.t(Br())),ux=S=>ye.changes==="git"||ye.changes==="branch"?zt()?Qi(Gr()):(()=>{var q=yl();return p(q,()=>s.t("session.review.loadingChanges")),Ae(()=>Jt(q,S.loadingClass)),q})():ye.changes==="turn"?Qi(Gr()):Q()&&!fe()?(()=>{var q=yl();return p(q,()=>s.t("session.review.loadingChanges")),Ae(()=>Jt(q,S.loadingClass)),q})():Br()==="session.review.noVcs"?(()=>{var q=BN(),ve=q.firstChild,Fe=ve.firstChild,Me=Fe.nextSibling;return p(Fe,()=>s.t("session.review.noVcs.createGit.title")),p(Me,()=>s.t("session.review.noVcs.createGit.description")),p(q,c(vt,{size:"large",get disabled(){return kn.isPending},onClick:Yi,get children(){return Te(()=>!!kn.isPending)()?s.t("session.review.noVcs.createGit.actionLoading"):s.t("session.review.noVcs.createGit.action")}}),null),Ae(()=>Jt(q,S.emptyClass)),q})():(()=>{var q=ZN(),ve=q.firstChild;return p(ve,Gr),Ae(()=>Jt(q,S.emptyClass)),q})(),of=S=>c(F,{get when(){return!ye.deferRender},get children(){return c(T9,{get title(){return Xt()},get empty(){return ux(S)},diffs:ht,view:v,get diffStyle(){return S.diffStyle},get onDiffStyleChange(){return S.onDiffStyleChange},onScrollRef:q=>Zt("reviewScroll",q),get focusedFile(){return St.activeDiff},onLineComment:q=>ge({...q,origin:"review"}),onLineCommentUpdate:He,onLineCommentDelete:at,get lineCommentActions(){return $t()},get commentMentions(){return{items:i.searchFilesAndDirectories}},get comments(){return d.all()},get focusedComment(){return d.focus()},get onFocusedCommentChange(){return d.setFocus},onViewFile:Ji,get classes(){return S.classes}})}}),dx=()=>(()=>{var S=HN(),q=S.firstChild;return p(q,()=>of({diffStyle:t.review.diffStyle(),onDiffStyleChange:t.review.setDiffStyle,loadingClass:"px-6 py-4 text-text-weak",emptyClass:"h-full pb-64 -mt-4 flex flex-col items-center justify-center text-center gap-6"})),S})();ne(qe(D,S=>{S&&wt()==="changes"&&En()},{defer:!0}));const fx=S=>{const q=Ci(S);if(q)return`session-review-diff-${q}`},sf=S=>{const q=St.reviewScroll;if(!q)return;const ve=fx(S);if(!ve)return;const Fe=document.getElementById(ve);if(!(Fe instanceof HTMLElement)||!q.contains(Fe))return;const Me=Fe.getBoundingClientRect(),tt=q.getBoundingClientRect();return Me.top-tt.top+q.scrollTop},mx=S=>{const q=St.reviewScroll;if(!q)return!1;const ve=sf(S);return ve===void 0?!1:(v().setScroll("review",{x:q.scrollLeft,y:ve}),q.scrollTo({top:ve,behavior:"auto"}),!0)},gx=S=>{P(),v().review.openPath(S),Zt({activeDiff:S,pendingDiff:S})};ne(()=>{const S=St.pendingDiff;if(!S||!St.reviewScroll||!zt())return;const q=ve=>{if(St.pendingDiff!==S)return;if(ve>60){Zt("pendingDiff",void 0);return}const Fe=St.reviewScroll;if(!Fe){requestAnimationFrame(()=>q(ve+1));return}if(!mx(S)){requestAnimationFrame(()=>q(ve+1));return}const Me=sf(S);if(Me===void 0){requestAnimationFrame(()=>q(ve+1));return}if(Math.abs(Fe.scrollTop-Me)<=1){Zt("pendingDiff",void 0);return}requestAnimationFrame(()=>q(ve+1))};requestAnimationFrame(()=>q(0))}),ne(()=>{const S=g.id;S&&Ke()&&n.data.session_diff[S]===void 0&&n.status!=="loading"&&n.session.diff(S)}),ne(qe(()=>[y(),Ke()],([S,q])=>{if(de!==void 0&&cancelAnimationFrame(de),Ee!==void 0&&window.clearTimeout(Ee),de=void 0,Ee=void 0,!q)return;const ve=g.id;ve&&kt(()=>n.data.session_diff[ve]!==void 0)&&(de=requestAnimationFrame(()=>{de=void 0,Ee=window.setTimeout(()=>{Ee=void 0,y()===S&&n.session.diff(ve,{force:!0})},0)}))},{defer:!0}));let af;ne(()=>{const S=a.directory;if(!O()||!t.fileTree.opened()||n.status==="loading")return;wt();const q=af!==S;af=S,q?i.tree.refresh(""):i.tree.list("")}),ne(qe(()=>a.directory,()=>{const S=D();if(!S)return;const q=i.pathFromTab(S);q&&i.load(q,{force:!0})},{defer:!0}));const Cn=np({working:()=>!0,overflowAnchor:"dynamic"});let eo,Ua,to;const hx=S=>Math.max(400,S.clientHeight),px=S=>{const q=S.scrollHeight-S.clientHeight,ve=q-S.scrollTop,Fe=q>1,Me=!Fe||ve<=2,tt=Fe&&ve>hx(S);w.scroll.overflow===Fe&&w.scroll.bottom===Me&&w.scroll.jump===tt||x("scroll",{overflow:Fe,bottom:Me,jump:tt})},Wr=S=>{Ua=S,eo===void 0&&(eo=requestAnimationFrame(()=>{eo=void 0;const q=Ua;Ua=void 0,q&&px(q)}))},vi=()=>{G("messageId",void 0),Cn.forceScrollToBottom(),ff();const S=on;S&&Wr(S)};ne(qe(Cn.userScrolled,S=>{S||(G("messageId",void 0),ff())},{defer:!0}));let no=()=>{};const vx=S=>{on=S,Cn.scrollRef(S),S&&(Wr(S),no())},bx=()=>{an+=1};Ti(()=>pi,()=>{const S=on;S&&Wr(S),no()});const ur=GN({sessionID:()=>g.id,messagesReady:Z,loaded:()=>H().length,visibleUserMessages:Ne,historyMore:se,historyLoading:re,loadMore:S=>n.session.history.loadMore(S),userScrolled:Cn.userScrolled,scroller:()=>on});no=()=>{to===void 0&&(to=requestAnimationFrame(()=>{if(to=void 0,!g.id||!Z()||Cn.userScrolled()||re())return;const S=on;S&&(S.scrollHeight>S.clientHeight+1||ur.turnStart()<=0&&!se()||ur.loadAndReveal())}))},ne(qe(()=>[g.id,Z(),ur.turnStart(),se(),re(),Cn.userScrolled(),Ne().length],([S,q,ve,Fe,Me,tt])=>{!S||!q||Me||tt||ve<=0&&!Fe||no()},{defer:!0}));const Ka=S=>cx(n.data.part[S]??[],{directory:a.directory}),yx=S=>{const q=Ka(S).map(ve=>ve.content).join("").replace(/\s+/g," ").trim();return q||`[${s.t("common.attachment")}]`},Va=S=>{Nt({variant:"error",title:s.t("common.requestFailed"),description:_l(S,s.t)})},lf=S=>n.set("session",q=>{const ve=q.findIndex(Me=>Me.id===S.id);if(ve<0)return q;const Fe=q.slice();return Fe[ve]=S,Fe}),cs=(S,q)=>n.set("session",ve=>{const Fe=ve.findIndex(tt=>tt.id===S);if(Fe<0)return ve;const Me=ve.slice();return Me[Fe]={...Me[Fe],revert:q},Me}),Ba=S=>(n.data.session_status[S]??{type:"idle"}).type!=="idle"?!0:(n.data.message[S]??[]).some(q=>q.role==="assistant"&&typeof q.time.completed!="number"),Za=$(()=>{const S=g.id;return S?ue.items[S]??Zg:Zg}),wx=$(()=>{const S=g.id;if(S)return ue.edit[S]}),us=Dr(()=>({mutationFn:async S=>{const q=(ue.items[S.sessionID]??[]).find(Fe=>Fe.id===S.id);!q||(S.manual&&me("paused",S.sessionID,void 0),me("failed",S.sessionID,void 0),!await U2({client:a.client,sync:n,globalSync:e,draft:q,optimisticBusy:q.sessionDirectory===a.directory}).catch(Fe=>(me("failed",S.sessionID,S.id),Va(Fe),!1)))||(me("items",S.sessionID,Fe=>(Fe??[]).filter(Me=>Me.id!==S.id)),S.manual&&vi())}})),ds=S=>us.isPending&&us.variables?.sessionID===S,xx=$(()=>{const S=g.id;if(S&&ds(S))return us.variables?.id}),_x=$(()=>{const S=g.id;return S?l.general.followup()==="queue"&&Ba(S)&&!_.blocked():!1}),$x=S=>{const q=S.prompt.map(Me=>Me.type==="agent"?`@${Me.name}`:Me.content).join("").split(/\r?\n/).map(Me=>Me.trim()).find(Me=>!!Me);if(q)return q;const ve=S.context.find(Me=>!!Me.comment?.trim())?.comment?.trim();if(ve)return ve;const Fe=S.context[0]?.path;return Fe?`Context file: ${Fe}`:`[${s.t("common.attachment")}]`},Sx=S=>{me("items",S.sessionID,q=>[...q??[],{id:rr.ascending("message"),...S}]),me("failed",S.sessionID,void 0),me("paused",S.sessionID,void 0)},kx=$(()=>Za().map(S=>({id:S.id,text:$x(S)}))),cf=(S,q,ve)=>!(ue.items[S]??[]).find(Me=>Me.id===q)||ds(S)?Promise.resolve():us.mutateAsync({sessionID:S,id:q,manual:ve?.manual}),Cx=S=>{const q=g.id;if(!q||ds(q))return;const ve=Za().find(Fe=>Fe.id===S);ve&&(me("items",q,Fe=>(Fe??[]).filter(Me=>Me.id!==S)),me("failed",q,Fe=>Fe===S?void 0:Fe),me("edit",q,{id:ve.id,prompt:ve.prompt,context:ve.context}))},Ix=()=>{const S=g.id;S&&me("edit",S,void 0)},Ha=S=>Ba(S)?a.client.session.abort({sessionID:S}).catch(()=>{}):Promise.resolve(),uf=Dr(()=>({mutationFn:async S=>{const q=u.current().slice(),ve=B()?.revert,Fe=Ka(S.messageID);$n(()=>{cs(S.sessionID,{messageID:S.messageID}),u.set(Fe)}),await Ha(S.sessionID).then(()=>a.client.session.revert(S)).then(Me=>{Me.data&&lf(Me.data)}).catch(Me=>{$n(()=>{cs(S.sessionID,ve),u.set(q)}),Va(Me)})}})),fs=Dr(()=>({mutationFn:async S=>{const q=g.id;if(!q)return;const ve=Se().find(Ht=>Ht.id>S),Fe=u.current().slice(),Me=B()?.revert;$n(()=>{if(cs(q,ve?{messageID:ve.id}:void 0),ve){u.set(Ka(ve.id));return}u.reset()}),await(ve?Ha(q).then(()=>a.client.session.revert({sessionID:q,messageID:ve.id})):Ha(q).then(()=>a.client.session.unrevert({sessionID:q}))).then(Ht=>{Ht.data&&lf(Ht.data)}).catch(Ht=>{$n(()=>{cs(q,Me),u.set(Fe)}),Va(Ht)})}})),qa=$(()=>uf.isPending||fs.isPending),Tx=$(()=>fs.isPending?fs.variables:void 0),Dx=S=>{if(!qa())return uf.mutateAsync(S)},Ax=S=>{if(!(!g.id||qa()))return fs.mutateAsync(S)},df=$(()=>{const S=te();return S?Se().filter(q=>q.id>=S).map(q=>({id:q.id,text:yx(q.id)})):[]}),Px={revert:Dx};ne(()=>{const S=g.id;if(!S)return;const q=Za()[0];q&&(ds(S)||ue.failed[S]!==q.id&&(ue.paused[S]||_.blocked()||Ba(S)||cf(S,q.id)))}),Ti(()=>lr,({height:S})=>{const q=Math.ceil(S);if(q===cr)return;const ve=on,Fe=q-cr,Me=ve?!Cn.userScrolled()||ve.scrollHeight-ve.clientHeight-ve.scrollTop<10+Math.max(0,Fe):!1;cr=q,Me&&Cn.forceScrollToBottom(),ve&&Wr(ve),no()});const{clearMessageHash:ff,scrollToMessage:Ox}=KN({sessionKey:y,sessionID:()=>g.id,messagesReady:Z,visibleUserMessages:Ne,historyMore:se,historyLoading:re,loadMore:S=>n.session.history.loadMore(S),turnStart:ur.turnStart,currentMessageId:()=>ye.messageId,pendingMessage:()=>w.pendingMessage,setPendingMessage:S=>x("pendingMessage",S),setActiveMessage:rn,setTurnStart:ur.setTurnStart,autoScroll:Cn,scroller:()=>on,anchor:$r,scheduleScrollState:Wr,consumePendingMessage:t.pendingMessage.consume});return ne(qe(()=>g.id,S=>{S||requestAnimationFrame(()=>Pn?.focus())})),Vt(()=>{ln(document,"keydown",L)}),je(()=>{Ue!==void 0&&cancelAnimationFrame(Ue),be!==void 0&&cancelAnimationFrame(be),Be!==void 0&&window.clearTimeout(Be),E!==void 0&&cancelAnimationFrame(E),ae!==void 0&&window.clearTimeout(ae),de!==void 0&&cancelAnimationFrame(de),Ee!==void 0&&window.clearTimeout(Ee),eo!==void 0&&cancelAnimationFrame(eo),to!==void 0&&cancelAnimationFrame(to)}),(()=>{var S=qN(),q=S.firstChild,ve=q.firstChild,Fe=ve.firstChild;return p(S,c(BS,{}),q),p(q,c(F,{get when(){return Te(()=>!O())()&&!!g.id},get children(){return c(Lt,{get value(){return ye.mobileTab},class:"h-auto",get children(){return c(Lt.List,{get children(){return[c(Lt.Trigger,{value:"session",class:"!w-1/2 !max-w-none",classes:{button:"w-full"},onClick:()=>G("mobileTab","session"),get children(){return s.t("session.tab.session")}}),c(Lt.Trigger,{value:"changes",class:"!w-1/2 !max-w-none !border-r-0",classes:{button:"w-full"},onClick:()=>G("mobileTab","changes"),get children(){return Te(()=>!!Tt())()?s.t("session.review.filesChanged",{count:Mt()}):s.t("session.review.change.other")}})]}})}})}}),ve),p(Fe,c(Gt,{get children(){return[c(Xe,{get when(){return g.id},get children(){return c(F,{get when(){return Z()},get children(){return c(zF,{get mobileChanges(){return xe()},get mobileFallback(){return of({diffStyle:"unified",classes:{root:"pb-8",header:"px-4",container:"px-4"},loadingClass:"px-4 py-4 text-text-weak",emptyClass:"h-full pb-64 -mt-4 flex flex-col items-center justify-center text-center gap-6"})},actions:Px,get scroll(){return w.scroll},onResumeScroll:vi,setScrollRef:vx,onScheduleScrollState:Wr,get onAutoScrollHandleScroll(){return Cn.handleScroll},onMarkScrollGesture:Sr,hasScrollGesture:Hr,onUserScroll:bx,get onTurnBackfillScroll(){return ur.onScrollerScroll},get onAutoScrollInteraction(){return Cn.handleInteraction},get centered(){return U()},setContentRef:Me=>{pi=Me,Cn.contentRef(Me);const tt=on;tt&&Wr(tt)},get turnStart(){return ur.turnStart()},get historyMore(){return se()},get historyLoading(){return re()},onLoadEarlier:()=>{ur.loadAndReveal()},get renderedUserMessages(){return ur.renderedUserMessages()},anchor:$r,get inlineQuestionRequest(){return _.currentQuestionRequest()},onQuestionSubmit:vi,get todoDock(){return Te(()=>!!g.id)()?{sessionID:g.id,todos:_.todos(),open:_.dock(),closing:_.closing()}:void 0}})}})}}),c(Xe,{when:!0,get children(){return c(ZI,{})}})]}})),p(ve,c(VM,{state:_,get ready(){return Te(()=>!ye.deferRender)()&&Z()},get centered(){return U()},inputRef:Me=>{Pn=Me},onSubmit:()=>{d.clear(),vi()},onResponseSubmit:vi,get followup(){return Te(()=>!!g.id)()?{queue:_x,items:kx(),sending:xx(),edit:wx(),onQueue:Sx,onAbort:()=>{const Me=g.id;Me&&me("paused",Me,!0)},onSend:Me=>{cf(g.id,Me,{manual:!0})},onEdit:Cx,onEditLoaded:Ix}:void 0},get revert(){return Te(()=>df().length>0)()?{items:df(),restoring:Tx(),disabled:qa(),onRestore:Ax}:void 0},setPromptDockRef:Me=>{lr=Me}}),null),p(ve,c(F,{get when(){return K()},get children(){var Me=yl();return Me.$$pointerdown=()=>z.start(),p(Me,c(Cc,{direction:"horizontal",get size(){return t.session.width()},min:450,get max(){return typeof window>"u"?1e3:window.innerWidth*.45},onResize:tt=>{z.touch(),t.session.resize(tt)}})),Me}}),null),p(q,c(fN,{canReview:ee,diffs:ht,diffsReady:zt,empty:Gr,hasReview:Tt,reviewCount:Mt,reviewPanel:dx,get activeDiff(){return St.activeDiff},focusReviewDiff:gx,get reviewSnap(){return w.reviewSnap},size:z}),null),p(S,c(NN,{}),null),Ae(Me=>{var tt={"@container relative shrink-0 flex flex-col min-h-0 h-full bg-background-stronger flex-1 md:flex-none":!0,"transition-[width] duration-[240ms] ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":!z.active()&&!w.reviewSnap},Ht=M();return Me.e=Ct(ve,tt,Me.e),Ht!==Me.t&&ft(ve,"width",Me.t=Ht),Me},{e:void 0,t:void 0}),S})()}Ot(["pointerdown"]);const QN=Object.freeze(Object.defineProperty({__proto__:null,default:WN},Symbol.toStringTag,{value:"Module"}));export{Sn as F,lE as L,ip as a,qo as c,cx as e,QN as s,_r as u};
71
+ `)}_serializeBufferByScrollback(t,r){const i=t.length,n=this._terminal?.rows??24,o=r===void 0?i:ac(r+n,0,i);return this._serializeBufferByRange(t,{start:i-o,end:i-1},!1)}_serializeBufferByRange(t,r,i){const n=new vN(t,this._terminal),o=this._terminal?.cols??80;return n.serialize({start:{x:0,y:r.start},end:{x:o,y:r.end}},i)}}const yN="data-pty-id",yi=()=>({connected:!1,connects:0,rendered:"",settled:0,focusing:0}),ax=()=>{if(typeof window>"u")return;const e=window.__kcode_e2e?.terminal;if(e?.enabled)return e},wi=()=>{const e=ax();if(e)return e.terminals??={},e.terminals},Kg=()=>{const e=ax();if(e)return e.controls??={},e.controls},lx=e=>{const t=r=>{const i=wi();i&&(i[e]={...i[e]??yi(),...r})};return{init(){t(yi())},connect(){const r=wi();if(!r)return;const i=r[e]??yi();r[e]={...i,connected:!0,connects:i.connects+1}},render(r){const i=wi();if(!i)return;const n=i[e]??yi();i[e]={...n,rendered:n.rendered+r}},settle(){const r=wi();if(!r)return;const i=r[e]??yi();r[e]={...i,settled:i.settled+1}},focus(r){t({focusing:Math.max(0,r)})},step(){const r=wi();if(!r)return;const i=r[e]??yi();r[e]={...i,focusing:Math.max(0,i.focusing-1)}},control(r){const i=Kg();i&&(i[e]={...i[e]??{},...r})},drop(){const r=wi();r&&delete r[e];const i=Kg();i&&delete i[e]}}},Qs=e=>typeof e=="object"&&e!==null,wN=e=>Qs(e)&&typeof e.dispose=="function",Is=e=>{wN(e)&&e.dispose()},xN=e=>Qs(e)&&typeof e.setOption=="function",Vg=(e,t,r)=>{xN(e)&&e.setOption(t,r)},_N=e=>{if(!Qs(e))return;const t=e.currentHoveredLink;if(Qs(t)&&typeof t.text=="string")return t.text};function $N(e,t=queueMicrotask){let r,i,n=!1,o=!1;const s=()=>{if(n||o||r?.length)return;const d=i;if(d?.length){i=void 0;for(const f of d)f()}},a=()=>{if(o)return;n=!1;const d=r;if(!d?.length){s();return}r=void 0,o=!0,e(d.join(""),()=>{if(o=!1,r?.length){if(n)return;n=!0,t(a);return}s()})};return{push:d=>{d&&(r?r.push(d):r=[d],!(n||o)&&(n=!0,t(a)))},flush:d=>{if(!n&&!o&&!r?.length){d?.();return}d&&(i?i.push(d):i=[d]),a()}}}var SN=I("<div data-component=terminal>");let vo;const kN=()=>vo||(vo=Bn(()=>import("./ghostty-web-BgPuLERF.js"),__vite__mapDeps([6,1,2])).then(async e=>({mod:e,ghostty:await e.Ghostty.load()})).catch(e=>{throw vo=void 0,e}),vo),CN={light:{background:"#fcfcfc",foreground:"#211e1e",cursor:"#211e1e",selectionBackground:$l("#211e1e",.2)},dark:{background:"#191515",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:$l("#d4d4d4",.25)}},IN=e=>{if(!e||typeof e!="object"||!("name"in e))return;const t=e.name;return typeof t=="string"?t:void 0},TN=e=>{const t=o=>{const s=e.term.getSelection();if(!s)return;const a=o.clipboardData;a&&(o.preventDefault(),a.setData("text/plain",s))},r=o=>{const s=o.clipboardData,a=s?.getData("text/plain")??s?.getData("text")??"";a&&(o.preventDefault(),o.stopPropagation(),e.term.paste(a))},i=()=>{e.term.options.cursorBlink=!0},n=()=>{e.term.options.cursorBlink=!1};e.container.addEventListener("copy",t,!0),e.cleanups.push(()=>e.container.removeEventListener("copy",t,!0)),e.container.addEventListener("paste",r,!0),e.cleanups.push(()=>e.container.removeEventListener("paste",r,!0)),e.container.addEventListener("pointerdown",e.handlePointerDown),e.cleanups.push(()=>e.container.removeEventListener("pointerdown",e.handlePointerDown)),e.container.addEventListener("click",e.handleLinkClick,{capture:!0}),e.cleanups.push(()=>e.container.removeEventListener("click",e.handleLinkClick,{capture:!0})),e.term.textarea?.addEventListener("focus",i),e.term.textarea?.addEventListener("blur",n),e.cleanups.push(()=>e.term.textarea?.removeEventListener("focus",i)),e.cleanups.push(()=>e.term.textarea?.removeEventListener("blur",n))},DN=e=>{if(!e.addon||!e.onCleanup||!e.term)return;const t=(()=>{try{return e.addon.serialize()}catch{return""}})();e.onCleanup({id:e.id,buffer:t,cursor:e.cursor,rows:e.term.rows,cols:e.term.cols,scrollY:e.term.getViewportY()})},AN=e=>{const t=na(),r=Rn();kc();const i=nh(),n=_t(),o=rh(),s=r.directory,a=r.client,l=r.mock,u=r.pty,d=r.url,f=o.current?.http,m=f?.username??"kcode",h=f?.password??"";let g;const[y,b]=$e(e,["pty","class","classList","autoFocus","onConnect","onConnectError"]),v=y.pty.id,w=lx(v),x=typeof y.pty.buffer=="string"?y.pty.buffer:"",_=x&&typeof y.pty.cols=="number"&&Number.isSafeInteger(y.pty.cols)&&y.pty.cols>0&&typeof y.pty.rows=="number"&&Number.isSafeInteger(y.pty.rows)&&y.pty.rows>0?{cols:y.pty.cols,rows:y.pty.rows}:void 0,k=typeof y.pty.scrollY=="number"?y.pty.scrollY:void 0;let C,O,z,K,J,T,M,U,A,j=!1;const P=[],B=typeof y.pty.cursor=="number"&&Number.isSafeInteger(y.pty.cursor)?y.pty.cursor:void 0;let R=B??0,V=B!==void 0?B:x?-1:0,Q,ee,oe,le=0;const W=()=>{if(!P.length)return;const ce=P.splice(0).reverse();for(const ye of ce)try{ye()}catch{}},D=(ce,ye)=>a.pty.update({ptyID:v,size:{cols:ce,rows:ye}}).catch(G=>{}),H=$(()=>{const ce=i.mode()==="dark"?"dark":"light",ye=CN[ce],G=i.themes()[i.themeId()];if(!G)return ye;const we=ce==="dark"?G.dark:G.light;if(!we?.seeds&&!we?.palette)return ye;const ke=u_(we,ce==="dark"),ue=ke["text-stronger"]??ye.foreground,me=ke["background-stronger"]??ye.background,Ue=ce==="dark"?.25:.2,be=ue.startsWith("#")?ue:ye.foreground,Be=$l(be,Ue);return{background:me,foreground:ue,cursor:ue,selectionBackground:Be}}),Z=()=>{j||K&&T===void 0&&(T=requestAnimationFrame(()=>{T=void 0,!j&&K.fit()}))},se=(ce,ye)=>{if(!j&&!(A?.cols===ce&&A?.rows===ye)){if(U={cols:ce,rows:ye},!A){A=U,D(ce,ye);return}M===void 0&&(M=setTimeout(()=>{M=void 0;const G=U;G&&(U=void 0,!j&&(A?.cols===G.cols&&A?.rows===G.rows||(A=G,D(G.cols,G.rows))))},100))}};ne(()=>{const ce=H();O&&Vg(O,"theme",ce)}),ne(()=>{const ce=yf();O&&(Vg(O,"fontFamily",ce),Z())});let re=t.webviewZoom?.();ne(()=>{const ce=t.webviewZoom?.();ce!==void 0&&ce!==re&&(re=ce,Z())});const fe=()=>{const ce=O;ce&&(ce.focus(),ce.textarea?.focus(),setTimeout(()=>ce.textarea?.focus(),0))},Se=()=>{const ce=document.activeElement;ce instanceof HTMLElement&&ce!==g&&!g.contains(ce)&&ce.blur(),fe()},Ne=ce=>{if(!ce.shiftKey&&!ce.ctrlKey&&!ce.metaKey||ce.altKey||ce.button!==0)return;const ye=O;if(!ye)return;const G=_N(ye);G&&(ce.preventDefault(),ce.stopImmediatePropagation(),t.openLink(G))};return Vt(()=>{w.init(),P.push(()=>w.drop()),(async()=>{const ye=await kN();if(j)return;const G=ye.mod,we=ye.ghostty,ke=new G.Terminal({cursorBlink:!0,cursorStyle:"bar",cols:_?.cols,rows:_?.rows,fontSize:14,fontFamily:yf(),allowTransparency:!1,convertEol:!1,theme:H(),scrollback:1e4,ghostty:we});if(P.push(()=>ke.dispose()),j){W();return}O=ke,Q=$N((pe,De)=>ke.write(pe,()=>{w.render(pe),w.settle(),De?.()})),ke.attachCustomKeyEventHandler(pe=>{const De=pe.key.toLowerCase();return pe.ctrlKey&&pe.shiftKey&&!pe.metaKey&&De==="c"?(document.execCommand("copy"),!0):!1});const ue=new G.FitAddon,me=new bN;P.push(()=>Is(ue)),ke.loadAddon(me),ke.loadAddon(ue),K=ue,z=me,ke.open(g),TN({container:g,term:ke,cleanups:P,handlePointerDown:Se,handleLinkClick:Ne}),y.autoFocus!==!1&&fe(),typeof document<"u"&&document.fonts&&document.fonts.ready.then(Z);const Ue=ke.onResize(pe=>{se(pe.cols,pe.rows)});P.push(()=>Is(Ue));const be=ke.onData(pe=>{if(l){u.input(v,pe);return}C?.readyState===WebSocket.OPEN&&C.send(pe)});P.push(()=>Is(be));const Be=ke.onKey(pe=>{pe.key=="Enter"&&e.onSubmit?.()});P.push(()=>Is(Be));const E=()=>{ue.observeResize(),J=Z,window.addEventListener("resize",J),P.push(()=>window.removeEventListener("resize",J))},ae=pe=>new Promise(De=>{if(!Q){De();return}Q.push(pe),Q.flush(De)});x&&_?(await ae(x),ue.fit(),se(ke.cols,ke.rows),k!==void 0&&ke.scrollToLine(k),E()):(ue.fit(),se(ke.cols,ke.rows),x&&(await ae(x),k!==void 0&&ke.scrollToLine(k)),E());const de={value:!1},Ee=new TextDecoder;if(l){ee=u.attach({id:v,cursor:V,fn:(pe,De)=>{pe&&(Q?.push(pe),R=De,V=De)}}),le=0,w.connect(),y.onConnect?.(),se(ke.cols,ke.rows),w.control({disconnect:()=>{a.pty.remove({ptyID:v}).catch(pe=>{})}});return}const Re=pe=>{j||de.value||(de.value=!0,y.onConnectError?.(pe))},ot=()=>a.pty.get({ptyID:v}).then(()=>!1).catch(pe=>IN(pe)==="NotFoundError"),Pe=pe=>{if(j||oe!==void 0)return;const De=Math.min(250*2**Math.min(le,4),4e3);oe=setTimeout(async()=>{if(oe=void 0,!j){if(await ot()){if(j)return;Re(pe);return}j||(le+=1,Oe())}},De)},Oe=()=>{if(j)return;ee?.();const pe=new URL(d+`/pty/${v}/connect`);pe.searchParams.set("directory",s),pe.searchParams.set("cursor",String(V)),pe.protocol=pe.protocol==="https:"?"wss:":"ws:",pe.username=m,pe.password=h;const De=new WebSocket(pe);De.binaryType="arraybuffer",C=De;const st=()=>{j||(le=0,w.connect(),y.onConnect?.(),se(ke.cols,ke.rows))},Je=Tt=>{if(j)return;if(Tt.data instanceof ArrayBuffer){const rn=new Uint8Array(Tt.data);if(rn[0]!==0)return;const $r=Ee.decode(rn.subarray(1));try{const Kn=JSON.parse($r)?.cursor;typeof Kn=="number"&&Number.isSafeInteger(Kn)&&Kn>=0&&(R=Kn,V=Kn)}catch{}return}const zt=typeof Tt.data=="string"?Tt.data:"";zt&&(Q?.push(zt),R+=zt.length,V=R)},Ve=Tt=>{},ht=()=>{De.removeEventListener("open",st),De.removeEventListener("message",Je),De.removeEventListener("error",Ve),De.removeEventListener("close",Mt),C===De&&(C=void 0),ee===ht&&(ee=void 0),De.readyState!==WebSocket.CLOSED&&De.readyState!==WebSocket.CLOSING&&De.close(1e3)},Mt=Tt=>{C===De&&(C=void 0),ee===ht&&(ee=void 0),De.removeEventListener("open",st),De.removeEventListener("message",Je),De.removeEventListener("error",Ve),De.removeEventListener("close",Mt),!j&&Tt.code!==1e3&&Pe(new Error(n.t("terminal.connectionLost.abnormalClose",{code:Tt.code})))};ee=ht,De.addEventListener("open",st),De.addEventListener("message",Je),De.addEventListener("error",Ve),De.addEventListener("close",Mt)};w.control({disconnect:()=>{C&&C.close(4e3,"e2e")}}),Oe()})().catch(ye=>{j||(Nt({variant:"error",title:n.t("terminal.connectionLost.title"),description:ye instanceof Error?ye.message:n.t("terminal.connectionLost.description")}),y.onConnectError?.(ye))})}),je(()=>{j=!0,T!==void 0&&cancelAnimationFrame(T),M!==void 0&&clearTimeout(M),oe!==void 0&&clearTimeout(oe),ee?.(),C&&C.readyState!==WebSocket.CLOSED&&C.readyState!==WebSocket.CLOSING&&C.close(1e3);const ce=()=>{DN({term:O,addon:z,cursor:R,id:v,onCleanup:e.onCleanup}),W()};if(!Q){ce();return}Q.flush(ce)}),(()=>{var ce=SN(),ye=g;return typeof ye=="function"?ut(ye,ce):g=ce,dn(ce,ie({[yN]:v},{"data-prevent-autofocus":"",tabIndex:-1,get style(){return{"background-color":H().background}},get classList(){return{...y.classList??{},"select-text":!0,"size-full px-6 py-3 font-mono relative overflow-hidden":!0,[y.class??""]:!!y.class}}},b),!1,!1),ce})()},Bg=e=>{const t=e.title??"",r=e.titleNumber??0,i=Number.isFinite(r)&&r>0&&oh(t,r);return t&&!i?t:r>0?e.t("terminal.title.numbered",{number:r}):t||e.t("terminal.title")};var PN=I('<div class="h-full flex items-center justify-center">'),ON=I('<div class="flex flex-col h-full"><div class="flex-1 min-h-0 relative">'),EN=I('<div id=terminal-panel role=region class="relative w-full shrink-0 overflow-hidden bg-background-stronger"><div class="absolute inset-x-0 top-0 flex flex-col"><div class="hidden md:block">'),MN=I('<div class="flex flex-col h-full pointer-events-none"><div class="h-10 flex items-center gap-2 px-2 border-b border-border-weaker-base bg-background-stronger overflow-hidden"><div class=flex-1></div><div class="text-text-weak pr-2"></div></div><div class="flex-1 flex items-center justify-center text-text-weak">'),zN=I('<div class="px-2 py-1 rounded-md bg-surface-base text-14-regular text-text-weak truncate max-w-40">'),LN=I('<div class="absolute inset-0">'),FN=I('<div class="relative p-1 h-10 flex items-center bg-background-stronger text-14-regular">');function NN(){const e=[120,240],t=Rn(),r=or(),i=Ko(),n=_t(),{params:o,view:s}=_r(),a=$(()=>s().terminal.opened()),l=Pp(),u=$(()=>r.terminal.height()),d=()=>s().terminal.close();let f;const[m,h]=We({autoCreated:!1,activeDraggable:void 0,view:typeof window>"u"?1e3:window.visualViewport?.height??window.innerHeight});if(t.capabilities.terminal===!1)return null;const g=()=>m.view*.6,y=()=>Math.min(u(),g());Vt(()=>{if(typeof window>"u")return;const O=()=>h("view",window.visualViewport?.height??window.innerHeight),z=window.visualViewport;O(),ln(window,"resize",O),z&&ln(z,"resize",O)}),ne(()=>{if(!a()){h("autoCreated",!1);return}!i.ready()||i.all().length!==0||m.autoCreated||(i.new(),h("autoCreated",!0))}),ne(qe(()=>i.all().length,(O,z)=>{z===void 0||z<=0||O!==0||a()&&d()}));const b=O=>{const z=lx(O);z.focus(e.length+1),Jr(O);const K=requestAnimationFrame(()=>{z.step(),a()&&i.active()===O&&Jr(O)}),J=e.map(T=>window.setTimeout(()=>{z.step(),a()&&i.active()===O&&Jr(O)},T));return()=>{z.focus(0),cancelAnimationFrame(K);for(const T of J)clearTimeout(T)}};ne(qe(()=>[a(),i.active()],([O,z])=>{if(!O||!z)return;const K=b(z);je(K)})),ne(()=>{if(a())return;const O=document.activeElement;O instanceof HTMLElement&&f?.contains(O)&&O.blur()}),ne(()=>{const O=o.dir;O&&i.ready()&&(n.locale(),d_(O,i.all().map(z=>Bg({title:z.title,titleNumber:z.titleNumber,t:n.t}))))});const v=$(()=>{const O=o.dir;return O?f_(O)??[]:[]}),w=i.all,x=$(()=>w().map(O=>O.id)),_=O=>{const z=zs(O);z&&h("activeDraggable",z)},k=O=>{const{draggable:z,droppable:K}=O;if(!z||!K)return;const J=i.all(),T=J.findIndex(U=>U.id===z.id.toString()),M=J.findIndex(U=>U.id===K.id.toString());T!==-1&&M!==-1&&T!==M&&i.move(z.id.toString(),M)},C=()=>{h("activeDraggable",void 0);const O=i.active();O&&requestAnimationFrame(()=>{i.active()===O&&Jr(O)})};return(()=>{var O=EN(),z=O.firstChild,K=z.firstChild,J=f;return typeof J=="function"?ut(J,O):f=O,K.$$pointerdown=()=>l.start(),p(K,c(Cc,{direction:"vertical",get size(){return y()},min:100,get max(){return g()},collapseThreshold:50,onResize:T=>{l.touch(),r.terminal.resize(T)},onCollapse:d})),p(z,c(F,{get when(){return i.ready()},get fallback(){return(()=>{var T=MN(),M=T.firstChild,U=M.firstChild,A=U.nextSibling,j=M.nextSibling;return p(M,c(rt,{get each(){return v()},children:P=>(()=>{var B=zN();return p(B,P),B})()}),U),p(A,()=>n.t("common.loading"),null),p(A,()=>n.t("common.loading.ellipsis"),null),p(j,()=>n.t("terminal.loading")),T})()},get children(){return c(gh,{onDragStart:_,onDragEnd:C,onDragOver:k,collisionDetector:fh,get children(){return[c(hh,{}),c(wh,{}),(()=>{var T=ON(),M=T.firstChild;return p(T,c(Lt,{variant:"alt",get value(){return i.active()},onChange:U=>i.open(U),class:"!h-auto !flex-none",get children(){return c(Lt.List,{class:"h-10 border-b border-border-weaker-base",get children(){return[c(bh,{get ids(){return x()},get children(){return c(rt,{get each(){return w()},children:U=>c(KI,{terminal:U,onClose:d})})}}),(()=>{var U=PN();return p(U,c(Et,{get value(){return n.t("command.terminal.new")},class:"flex items-center",get children(){return c(Pt,{icon:"plus-small",variant:"ghost",iconSize:"large",get onClick(){return i.new},get"aria-label"(){return n.t("command.terminal.new")}})}})),U})()]}})}}),M),p(M,c(F,{get when(){return i.active()},keyed:!0,children:U=>{const A=i.bind();return c(F,{get when(){return w().find(j=>j.id===U)},children:j=>(()=>{var P=LN();return Ie(P,"id",`terminal-wrapper-${U}`),p(P,c(AN,{get pty(){return j()},get autoFocus(){return a()},onConnect:()=>A.trim(U),get onCleanup(){return A.update},onConnectError:()=>A.clone(U)})),P})()})}})),T})(),c(ph,{get children(){return c(F,{get when(){return m.activeDraggable},keyed:!0,children:T=>c(F,{get when(){return w().find(M=>M.id===T)},children:M=>(()=>{var U=FN();return p(U,()=>Bg({title:M().title,titleNumber:M().titleNumber,t:n.t})),U})()})})}})]}})}}),null),Ae(T=>{var M=n.t("terminal.title"),U=!a(),A=!a(),j={"border-t border-border-weak-base":a(),"transition-[height] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[height] motion-reduce:transition-none":!l.active()},P=a()?`${y()}px`:"0px",B=!a(),R=`${y()}px`;return M!==T.e&&Ie(O,"aria-label",T.e=M),U!==T.t&&Ie(O,"aria-hidden",T.t=U),A!==T.a&&(O.inert=T.a=A),T.o=Ct(O,j,T.o),P!==T.i&&ft(O,"height",T.i=P),B!==T.n&&z.classList.toggle("pointer-events-none",T.n=B),R!==T.s&&ft(z,"height",T.s=R),T},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),O})()}Ot(["pointerdown"]);function RN(e){const t=e.indexOf("?");if(t===-1)return;const r=new URLSearchParams(e.slice(t+1)),i=Number(r.get("start")),n=Number(r.get("end"));if(!(!Number.isFinite(i)||!Number.isFinite(n)))return{startLine:i,endLine:n,startChar:0,endChar:0}}function jN(e){return e.filter(r=>r.type==="text").filter(r=>!r.synthetic&&!r.ignored).reduce((r,i)=>!r||i.text.length>r.text.length?i:r,void 0)}function cx(e,t){const i=jN(e)?.text??"",n=t?.directory,o=h=>{if(!n)return h;const g=n.endsWith("/")?n:n+"/";if(h.startsWith(g))return h.slice(g.length);if(h.startsWith(n)){const y=h.slice(n.length);return y.startsWith("/")?y.slice(1):y}return h},s=[];for(const h of e){if(h.type==="file"){const g=h,y=g.source?.text;if(y){const b=y.value,v=y.start,w=y.end;let x=b;b.startsWith("@")&&(x=b.slice(1)),!b.startsWith("@")&&g.source&&"path"in g.source&&(x=g.source.path),s.push({type:"file",start:v,end:w,value:b,path:o(x),selection:RN(g.url)});continue}}if(h.type==="agent"){const g=h,y=g.source;if(!y)continue;s.push({type:"agent",start:y.start,end:y.end,value:y.value,name:g.name})}}s.sort((h,g)=>h.start!==g.start?h.start-g.start:h.end-g.end);const a=[];let l=0,u=0;const d=h=>{h&&(a.push({type:"text",content:h,start:l,end:l+h.length}),l+=h.length)},f=h=>{const g=h.value;a.push({type:"text",content:g,start:l,end:l+g.length}),l+=g.length},m=h=>{const g=h.value,y={type:"agent",name:h.name,content:g,start:l,end:l+g.length};a.push(y),l+=g.length};for(const h of s){if(h.start<0||h.end<h.start)continue;const g=h.value;if(!g)continue;const y=h.end>i.length||h.start<u||i.slice(h.start,h.end)!==g,b=y?i.indexOf(g,u):h.start;if(b===-1)continue;const v=y?b+g.length:h.end;d(i.slice(u,b)),h.type==="file"&&f(h),h.type==="agent"&&m(h),u=v}return d(i.slice(u)),a.length===0&&a.push({type:"text",content:"",start:0,end:0}),a}const Cr=e=>t=>({...t,category:e}),UN=e=>{const t=wc(),r=br(),i=jr(),n=_t(),o=ji(),s=Ui(),a=Rn(),l=sr(),u=Ko(),d=or(),f=ra(),{params:m,tabs:h,view:g}=_r(),y=()=>a.capabilities.terminal!==!1,b=()=>{const Pe=m.id;if(Pe)return l.session.get(Pe)},v=()=>!!m.id,w=Pe=>Pe.startsWith("file://")?i.tab(Pe):Pe,x=qo({tabs:h,pathFromTab:i.pathFromTab,normalizeTab:w,review:e.review,hasReview:v}),_=x.activeFileTab,k=x.closableTab,C={type:"idle"},O=()=>l.data.session_status[m.id??""]??C,z=()=>{const Pe=m.id;return Pe?l.data.message[Pe]??[]:[]},K=()=>z().filter(Pe=>Pe.role==="user"),J=()=>{const Pe=b()?.revert?.messageID;return Pe?K().filter(Oe=>Oe.id<Pe):K()},T=()=>{d.fileTree.tab()==="changes"&&d.fileTree.setTab("all")},M=(Pe,Oe)=>{const pe=i.get(Pe)?.content?.content;if(pe)return ia(pe,{start:Oe.startLine,end:Oe.endLine})},U=(Pe,Oe)=>{const pe=M(Pe,Oe);s.context.add({type:"file",path:Pe,selection:Oe,preview:pe})},A=()=>{const Pe=_();if(!Pe)return!1;const Oe=i.pathFromTab(Pe);return Oe?i.selectedLines(Oe)!=null:!1},j=e.navigateMessageByOffset,P=e.setActiveMessage,B=e.focusInput,R=Cr(n.t("command.category.session")),V=Cr(n.t("command.category.file")),Q=Cr(n.t("command.category.context")),ee=Cr(n.t("command.category.view")),oe=Cr(n.t("command.category.terminal")),le=Cr(n.t("command.category.model")),W=Cr(n.t("command.category.mcp")),D=Cr(n.t("command.category.mode")),te=async Pe=>{const Oe=typeof document>"u"?void 0:document.body;if(Oe){const De=document.createElement("textarea");De.value=Pe,De.setAttribute("readonly",""),De.style.position="fixed",De.style.opacity="0",De.style.pointerEvents="none",Oe.appendChild(De),De.select();const st=document.execCommand("copy");if(Oe.removeChild(De),st)return!0}const pe=typeof navigator>"u"?void 0:navigator.clipboard;return pe?.writeText?pe.writeText(Pe).then(()=>!0,()=>!1):!1},H=async(Pe,Oe)=>{if(!await te(Pe)){Nt({title:n.t("toast.session.share.copyFailed.title"),variant:"error"});return}Nt({title:Oe?n.t("session.share.copy.copied"):n.t("toast.session.share.success.title"),description:n.t("toast.session.share.success.description"),variant:"success"})},Z=async()=>{const Pe=m.id;if(!Pe)return;const Oe=b()?.share?.url;if(Oe){await H(Oe,!0);return}const pe=await a.client.session.share({sessionID:Pe}).then(De=>De.data?.share?.url).catch(()=>{});if(!pe){Nt({title:n.t("toast.session.share.failed.title"),description:n.t("toast.session.share.failed.description"),variant:"error"});return}await H(pe,!1)},se=async()=>{const Pe=m.id;Pe&&await a.client.session.unshare({sessionID:Pe}).then(()=>Nt({title:n.t("toast.session.unshare.success.title"),description:n.t("toast.session.unshare.success.description"),variant:"success"})).catch(()=>Nt({title:n.t("toast.session.unshare.failed.title"),description:n.t("toast.session.unshare.failed.description"),variant:"error"}))},re=()=>{Bn(()=>import("./dialog-select-file-BItJBmej.js"),__vite__mapDeps([4,1,2,3,5])).then(Pe=>{r.show(()=>c(Pe.DialogSelectFile,{onOpenFile:T}))})},fe=()=>{const Pe=k();Pe&&h().close(Pe)},Se=()=>{const Pe=_();if(!Pe)return;const Oe=i.pathFromTab(Pe);if(!Oe)return;const pe=i.selectedLines(Oe);if(!pe){Nt({title:n.t("toast.context.noLineSelection.title"),description:n.t("toast.context.noLineSelection.description")});return}U(Oe,Ao(pe))},Ne=()=>{y()&&(u.all().length>0&&u.new(),g().terminal.open())},ce=()=>{Bn(()=>Promise.resolve().then(()=>l1),void 0).then(Pe=>{r.show(()=>c(Pe.DialogSelectModel,{get model(){return o.model}}))})},ye=()=>{Bn(()=>import("./dialog-select-mcp-C_fdDDWz.js"),__vite__mapDeps([7,1,2,3,5])).then(Pe=>{r.show(()=>c(Pe.DialogSelectMcp,{}))})},G=async()=>{const Pe=m.id;if(!Pe)return;O().type!=="idle"&&await a.client.session.abort({sessionID:Pe}).catch(()=>{});const Oe=b()?.revert?.messageID,pe=bo(K(),Je=>!Oe||Je.id<Oe);if(!pe)return;await a.client.session.revert({sessionID:Pe,messageID:pe.id});const De=l.data.part[pe.id];if(De){const Je=cx(De,{directory:a.directory});s.set(Je)}const st=bo(K(),Je=>Je.id<pe.id);P(st)},we=async()=>{const Pe=m.id;if(!Pe)return;const Oe=b()?.revert?.messageID;if(!Oe)return;const pe=K().find(st=>st.id>Oe);if(!pe){await a.client.session.unrevert({sessionID:Pe}),s.reset();const st=bo(K(),Je=>Je.id>=Oe);P(st);return}await a.client.session.revert({sessionID:Pe,messageID:pe.id});const De=bo(K(),st=>st.id<pe.id);P(De)},ke=async()=>{const Pe=m.id;if(!Pe)return;const Oe=o.model.current();if(!Oe){Nt({title:n.t("toast.model.none.title"),description:n.t("toast.model.none.description")});return}await a.client.session.summarize({sessionID:Pe,modelID:Oe.id,providerID:Oe.provider.id})},ue=()=>{Bn(()=>import("./dialog-fork-Drw_HDnF.js"),__vite__mapDeps([8,1,2,3,5])).then(Pe=>{r.show(()=>c(Pe.DialogFork,{}))})},me=()=>l.data.config.share==="disabled"?[]:[R({id:"session.share",title:b()?.share?.url?n.t("session.share.copy.copyLink"):n.t("command.session.share"),description:b()?.share?.url?n.t("toast.session.share.success.description"):n.t("command.session.share.description"),slash:"share",disabled:!m.id,onSelect:Z}),R({id:"session.unshare",title:n.t("command.session.unshare"),description:n.t("command.session.unshare.description"),slash:"unshare",disabled:!m.id||!b()?.share?.url,onSelect:se})],Ue=()=>[R({id:"session.new",title:n.t("command.session.new"),slash:"new",onSelect:()=>f(`/${m.dir}/session`)}),R({id:"session.undo",title:n.t("command.session.undo"),description:n.t("command.session.undo.description"),slash:"undo",disabled:!m.id||J().length===0,onSelect:G}),R({id:"session.redo",title:n.t("command.session.redo"),description:n.t("command.session.redo.description"),slash:"redo",disabled:!m.id||!b()?.revert?.messageID,onSelect:we}),R({id:"session.compact",title:n.t("command.session.compact"),description:n.t("command.session.compact.description"),slash:"compact",disabled:!m.id||J().length===0,onSelect:ke}),R({id:"session.fork",title:n.t("command.session.fork"),description:n.t("command.session.fork.description"),slash:"fork",disabled:!m.id||J().length===0,onSelect:ue})],be=()=>[V({id:"file.open",title:n.t("command.file.open"),description:n.t("palette.search.placeholder"),slash:"open",onSelect:re}),V({id:"tab.close",title:n.t("command.tab.close"),disabled:!k(),onSelect:fe})],Be=()=>[Q({id:"context.addSelection",title:n.t("command.context.addSelection"),description:n.t("command.context.addSelection.description"),disabled:!A(),onSelect:Se})],E=()=>[...y()?[ee({id:"terminal.toggle",title:n.t("command.terminal.toggle"),slash:"terminal",onSelect:()=>g().terminal.toggle()})]:[],ee({id:"review.toggle",title:n.t("command.review.toggle"),onSelect:()=>g().reviewPanel.toggle()}),ee({id:"fileTree.toggle",title:n.t("command.fileTree.toggle"),onSelect:()=>d.fileTree.toggle()}),ee({id:"input.focus",title:n.t("command.input.focus"),onSelect:B})],ae=()=>y()?[oe({id:"terminal.new",title:n.t("command.terminal.new"),description:n.t("command.terminal.new.description"),onSelect:Ne})]:[],de=()=>[R({id:"message.previous",title:n.t("command.message.previous"),description:n.t("command.message.previous.description"),disabled:!m.id,onSelect:()=>j(-1)}),R({id:"message.next",title:n.t("command.message.next"),description:n.t("command.message.next.description"),disabled:!m.id,onSelect:()=>j(1)})],Ee=()=>[le({id:"model.choose",title:n.t("command.model.choose"),description:n.t("command.model.choose.description"),slash:"model",onSelect:ce})],Re=()=>[W({id:"mcp.toggle",title:n.t("command.mcp.toggle"),description:n.t("command.mcp.toggle.description"),slash:"mcp",onSelect:ye})],ot=()=>[D({id:"mode.cycle",title:n.t("command.mode.cycle"),description:n.t("command.mode.cycle.description"),slash:"mode",onSelect:()=>o.mode.move(1)}),D({id:"mode.cycle.reverse",title:n.t("command.mode.cycle.reverse"),description:n.t("command.mode.cycle.reverse.description"),onSelect:()=>o.mode.move(-1)})];t.register("session",()=>[...Ue(),...me(),...be(),...Be(),...E(),...ae(),...de(),...Ee(),...Re(),...ot()])},bl=e=>{const r=(e.startsWith("#")?e.slice(1):e).match(/^message-(.+)$/);if(r)return r[1]},KN=e=>{const t=$(()=>e.visibleUserMessages()),r=$(()=>new Map(t().map(v=>[v.id,v]))),i=$(()=>new Map(t().map((v,w)=>[v.id,w])));let n="",o=!1;const s=Sc(),a=ra(),l=new Set,u=v=>{const w=requestAnimationFrame(()=>{l.delete(w),v()});l.add(w)},d=()=>{for(const v of l)cancelAnimationFrame(v);l.clear()},f=()=>{d(),e.consumePendingMessage(e.sessionKey()),e.pendingMessage()&&e.setPendingMessage(void 0),s.hash&&(o=!0,a(s.pathname+s.search,{replace:!0}))},m=v=>{const w=`#${e.anchor(v)}`;s.hash!==w&&(o=!1,a(s.pathname+s.search+w,{replace:!0}))},h=(v,w)=>{const x=e.scroller();if(!x)return!1;const _=v.getBoundingClientRect(),k=x.getBoundingClientRect(),C=x.querySelector("[data-session-title]"),O=C instanceof HTMLElement?C.offsetHeight:0,z=Math.max(0,_.top-k.top+x.scrollTop-O);return x.scrollTo({top:z,behavior:w}),!0},g=(v,w,x=4)=>{const _=document.getElementById(e.anchor(v));return _?h(_,w):(x<=0||u(()=>{g(v,w,x-1)}),!1)},y=(v,w="smooth")=>{d(),e.currentMessageId()!==v.id&&e.setActiveMessage(v);const x=i().get(v.id)??-1;if(x!==-1&&x<e.turnStart()){e.setTurnStart(x),u(()=>{g(v.id,w)}),m(v.id);return}if(g(v.id,w)){m(v.id);return}m(v.id)},b=v=>{const w=s.hash.slice(1);if(!w){e.autoScroll.forceScrollToBottom();const C=e.scroller();C&&e.scheduleScrollState(C);return}const x=bl(w);if(x){e.autoScroll.pause();const C=r().get(x);if(C){y(C,v);return}return}const _=document.getElementById(w);if(_){e.autoScroll.pause(),h(_,v);return}e.autoScroll.forceScrollToBottom();const k=e.scroller();k&&e.scheduleScrollState(k)};return ne(()=>{s.hash||(o=!1),!(!e.sessionID()||!e.messagesReady())&&(d(),u(()=>b("auto")))}),ne(()=>{if(!e.sessionID()||!e.messagesReady())return;t(),e.turnStart();let v=e.pendingMessage();if(!v){const _=e.sessionKey();if(n!==_){n=_;const k=e.consumePendingMessage(_);k&&(e.setPendingMessage(k),v=k)}}if(!v&&!o&&(v=bl(s.hash)),!v)return;const w=e.pendingMessage()===v,x=r().get(v);x&&(w&&e.setPendingMessage(void 0),!(e.currentMessageId()===v&&!w)&&(e.autoScroll.pause(),d(),u(()=>y(x,"auto"))))}),ne(()=>{const v=e.sessionID();if(!v||!e.messagesReady())return;t();let w=e.pendingMessage();!w&&!o&&(w=bl(s.hash)),w&&(r().has(w)||!e.historyMore()||e.historyLoading()||e.loadMore(v))}),Vt(()=>{typeof window<"u"&&"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual")}),je(d),{clearMessageHash:f,scrollToMessage:y,applyHash:b}};var VN=I('<div class="h-full pb-64 -mt-4 flex flex-col items-center justify-center text-center gap-6"><div class="text-14-regular text-text-weak max-w-56">'),yl=I("<div>"),BN=I('<div><div class="flex flex-col gap-3"><div class="text-14-medium text-text-strong"></div><div class="text-14-regular text-text-base max-w-md"style=line-height:var(--line-height-normal)>'),ZN=I('<div><div class="text-14-regular text-text-weak max-w-56">'),HN=I('<div class="flex flex-col h-full overflow-hidden bg-background-stronger contain-strict"><div class="relative pt-2 flex-1 min-h-0 overflow-hidden">'),qN=I('<div class="relative bg-background-base size-full overflow-hidden flex flex-col"><div class="flex-1 min-h-0 flex flex-col md:flex-row"><div><div class="flex-1 min-h-0 overflow-hidden">');const lc=[],Zg=[];function GN(e){const[a,l]=We({turnID:void 0,turnStart:0,prefetchUntil:0,prefetchNoGrowth:0}),u=w=>w>10?w-10:0,d=$(()=>{const w=e.sessionID(),x=e.visibleUserMessages().length;return!w||x<=0?0:a.turnID!==w?u(x):a.turnStart<=0?0:a.turnStart>=x?u(x):a.turnStart}),f=w=>{const x=e.sessionID(),_=w>0?w:0;if(!x){l({turnID:void 0,turnStart:_});return}l({turnID:x,turnStart:_})},m=$(()=>{const w=e.visibleUserMessages(),x=d();return x<=0?w:w.slice(x)},lc,{equals:Pr}),h=w=>{const x=e.scroller();if(!x){w();return}const _=x.scrollTop,k=x.scrollHeight;w(),requestAnimationFrame(()=>{const C=x.scrollHeight-k;C&&(x.scrollTop=_+C)})},g=()=>{const w=d();if(w<=0)return;const x=w-8,_=x>0?x:0;h(()=>f(_))},y=async()=>{const w=e.sessionID();if(!w)return;const x=d(),_=e.visibleUserMessages().length;let k=e.loaded();if(x>0&&f(0),!e.historyMore()||e.historyLoading())return;let C=_,O=0;for(;;){if(await e.loadMore(w),e.sessionID()!==w)return;C=e.visibleUserMessages().length;const J=e.loaded(),T=J-k;if(O+=T,k=J,C>_||T<=0||!e.historyMore())break}if(O<=0||(a.prefetchNoGrowth&&l("prefetchNoGrowth",0),C-_<=0)||d()!==0)return;const K=Math.min(C,_+8);f(Math.max(0,C-K))},b=async w=>{const x=e.sessionID();if(!x||!e.historyMore()||e.historyLoading())return;if(w?.prefetch){const A=Date.now();if(a.prefetchUntil>A||a.prefetchNoGrowth>=2)return;l("prefetchUntil",A+400)}const _=d(),k=e.visibleUserMessages().length,C=_<=0?k:m().length;let O=e.loaded(),z=0,K=0;for(;;){if(await e.loadMore(x),e.sessionID()!==x)return;const A=e.loaded(),j=A-O;if(z+=j,O=A,K=e.visibleUserMessages().length-k,K>0||j<=0||w?.prefetch||!e.historyMore())break}const J=e.visibleUserMessages().length;if(w?.prefetch?l("prefetchNoGrowth",z>0?0:a.prefetchNoGrowth+1):z>0&&a.prefetchNoGrowth&&l("prefetchNoGrowth",0),z<=0||K<=0)return;if(w?.prefetch){const A=d();h(()=>f(A+K));return}if(d()!==_)return;const T=m().length,M=Math.max(C,T),U=Math.min(J,M+8);h(()=>f(Math.max(0,J-U)))},v=()=>{if(!e.userScrolled())return;const w=e.scroller();if(!w||w.scrollTop>=200)return;const x=d();if(x>0){x<=16&&b({prefetch:!0}),g();return}b()};return ne(qe(e.sessionID,()=>{l({prefetchUntil:0,prefetchNoGrowth:0})},{defer:!0})),ne(qe(()=>[e.sessionID(),e.messagesReady()],([w,x])=>{!w||!x||f(u(e.visibleUserMessages().length))},{defer:!0})),{turnStart:d,setTurnStart:f,renderedUserMessages:m,loadAndReveal:y,onScrollerScroll:v}}function WN(){const e=xc(),t=or(),r=ji(),i=jr(),n=sr(),o=br(),s=_t(),a=Rn(),l=kc(),u=Ui(),d=_c(),f=Ko(),[m,h]=m_(),{params:g,sessionKey:y,tabs:b,view:v}=_r();ne(()=>{u.ready()&&kt(()=>{if(g.id)return;const S=m.prompt;S&&(u.set([{type:"text",content:S,start:0,end:S.length}],S.length),h({...m,prompt:void 0}))})});const[w,x]=We({pendingMessage:void 0,reviewSnap:!1,scrollGesture:0,scroll:{overflow:!1,bottom:!0,jump:!1}}),_=WM(),k=$(()=>g.dir??""),C=$(()=>t.tabs(k));ne(qe(()=>g.id,(S,q)=>{if(!S||q)return;const ve=t.handoff.tabs();if(!ve)return;if(Date.now()-ve.at>6e4){t.handoff.clearTabs();return}if(ve.id!==S||(t.handoff.clearTabs(),ve.dir!==(g.dir??"")))return;const Fe=C().tabs();if(Fe.all.length===0&&!Fe.active)return;const Me=b().tabs();if(Me.all.length>0||Me.active)return;const tt=j(Fe.all),Ht=Fe.active?A(Fe.active):void 0;b().setAll(tt),b().setActive(Ht&&tt.includes(Ht)?Ht:tt[0]),C().setAll([]),C().setActive(void 0)},{defer:!0}));const O=$c("(min-width: 768px)"),z=Pp(),K=$(()=>O()&&v().reviewPanel.opened()),J=$(()=>O()&&t.fileTree.opened()),T=$(()=>K()||J()),M=$(()=>T()?K()?`${t.session.width()}px`:`calc(100% - ${t.fileTree.width()}px)`:"100%"),U=$(()=>O()&&!K());function A(S){return S.startsWith("file://")?i.tab(S):S}function j(S){const q=new Set,ve=[];for(const Fe of S){const Me=A(Fe);q.has(Me)||(q.add(Me),ve.push(Me))}return ve}const P=()=>{v().reviewPanel.opened()||v().reviewPanel.open()},B=$(()=>g.id?n.session.get(g.id):void 0),R=$(()=>g.id?n.data.session_diff[g.id]??[]:[]),V=$(()=>Math.max(B()?.summary?.files??0,R().length)),Q=$(()=>V()>0),ee=$(()=>!!n.project),oe=$(()=>O()),le=qo({tabs:b,pathFromTab:i.pathFromTab,normalizeTab:A,review:oe,hasReview:ee});le.contextOpen,le.openedTabs;const W=le.activeTab,D=le.activeFileTab,te=$(()=>B()?.revert?.messageID),H=$(()=>g.id?n.data.message[g.id]??[]:[]),Z=$(()=>{const S=g.id;return S?n.data.message[S]!==void 0:!0}),se=$(()=>{const S=g.id;return S?n.session.history.more(S):!1}),re=$(()=>{const S=g.id;return S?n.session.history.loading(S):!1}),fe=$(()=>{const S=g.id;return!S||!Q()?!0:n.data.session_diff[S]!==void 0}),Se=$(()=>H().filter(S=>S.role==="user"),lc,{equals:Pr}),Ne=$(()=>{const S=te();return S?Se().filter(q=>q.id<S):Se()},lc,{equals:Pr}),ce=$(()=>Ne().at(-1));ne(()=>{const S=D();if(!S)return;const q=i.pathFromTab(S);q&&i.load(q)}),ne(qe(()=>ce()?.id,()=>{const S=ce();S&&D9(r,S)})),ne(qe(()=>({dir:g.dir,id:g.id}),(S,q)=>{q&&(S.dir===q.dir&&S.id===q.id||q.id&&!S.id&&r.session.reset())},{defer:!0}));const[ye,G]=We({messageId:void 0,mobileTab:"session",changes:"git",deferRender:!1}),[we,ke]=We({diff:{git:[],branch:[]},ready:{git:!1,branch:!1}}),[ue,me]=Os(Es.workspace(a.directory,"followup",["followup.v1"]),We({items:{},failed:{},paused:{},edit:{}}));xl(S=>{const q=y();return q!==S&&(G("deferRender",!0),requestAnimationFrame(()=>{setTimeout(()=>G("deferRender",!1),0)})),q},y());let Ue,be,Be,E,ae,de,Ee;const Re=new Map,ot=new Map,Pe=S=>{const q=(ot.get(S)??0)+1;return ot.set(S,q),q},Oe=S=>{["git","branch"].forEach(ve=>{Pe(ve),Re.delete(ve),ke("diff",ve,[]),ke("ready",ve,!1)})},pe=(S,q=!1)=>{if(n.project?.vcs!=="git"||!q&&we.ready[S])return Promise.resolve();q&&(Re.has(S)&&Pe(S),Re.delete(S),ke("ready",S,!1));const ve=Re.get(S);if(ve)return ve;const Fe=Pe(S),Me=a.client.vcs.diff({mode:S}).then(tt=>{ot.get(S)===Fe&&(ke("diff",S,tt.data??[]),ke("ready",S,!0))}).catch(tt=>{ot.get(S)===Fe&&(console.debug("[session-review] failed to load vcs diff",{mode:S,error:tt}),ke("diff",S,[]),ke("ready",S,!0))}).finally(()=>{Re.get(S)===Me&&Re.delete(S)});return Re.set(S,Me),Me},De=()=>{Oe();const S=kt(Ve);S&&kt(Ke)&&pe(S,!0)};xl(S=>{const q=K();return S===void 0||S===q||(Ue!==void 0&&cancelAnimationFrame(Ue),x("reviewSnap",!0),Ue=requestAnimationFrame(()=>{Ue=void 0,x("reviewSnap",!1)})),q},K());const st=$(()=>ce()?.summary?.diffs??[]),Je=$(()=>{const S=[];return n.project?.vcs==="git"&&S.push("git"),n.project?.vcs==="git"&&n.data.vcs?.branch&&n.data.vcs?.default_branch&&n.data.vcs.branch!==n.data.vcs.default_branch&&S.push("branch"),S.push("session","turn"),S}),Ve=$(()=>{if(ye.changes==="git"||ye.changes==="branch")return ye.changes}),ht=$(()=>ye.changes==="git"?we.diff.git:ye.changes==="branch"?we.diff.branch:ye.changes==="session"?R():st()),Mt=$(()=>ye.changes==="git"?we.diff.git.length:ye.changes==="branch"?we.diff.branch.length:ye.changes==="session"?V():st().length),Tt=$(()=>Mt()>0),zt=$(()=>ye.changes==="git"?we.ready.git:ye.changes==="branch"?we.ready.branch:ye.changes==="session"?!Q()||fe():!0),rn=S=>{On=an,G("messageId",S?.id)},$r=S=>`message-${S}`,Un=()=>{const S=on;if(!S)return ye.messageId;const q=S.getBoundingClientRect(),ve=q.top+100,Fe=[...S.querySelectorAll("[data-message-id]")].map(fn=>{const ro=fn.dataset.messageId;if(!ro)return;const io=fn.getBoundingClientRect();return{id:ro,top:io.top,bottom:io.bottom}}).filter(fn=>!!fn),Me=Fe.filter(fn=>fn.bottom>q.top&&fn.top<q.bottom),tt=Me.find(fn=>fn.top<=ve&&fn.bottom>=ve);if(tt)return tt.id;const Ht=[...Me].sort((fn,ro)=>{const io=Math.abs(fn.top-ve),mf=Math.abs(ro.top-ve);return io!==mf?io-mf:fn.top-ro.top})[0];return Ht?Ht.id:Fe.filter(fn=>fn.top<=ve).at(-1)?.id??Fe[0]?.id??ye.messageId};function Kn(S){const q=Ne();if(q.length===0)return;const ve=ye.messageId&&On===an?ye.messageId:Un(),Fe=ve?q.findIndex(Ht=>Ht.id===ve):q.length,tt=(Fe===-1?q.length:Fe)+S;if(!(tt<0||tt>q.length)){if(tt===q.length){vi();return}Cn.pause(),Ox(q[tt],"auto")}}const Br=$(()=>{const S=n.project;return S&&!S.vcs?"session.review.noVcs":n.data.config.snapshot===!1?"session.review.noSnapshot":"session.review.empty"});function At(S){const q=e.data.project;n.set("project",S.id);const ve=q.findIndex(Me=>Me.id===S.id);if(ve>=0){e.set("project",q.map((Me,tt)=>tt===ve?{...Me,...S}:Me));return}const Fe=q.findIndex(Me=>Me.id>S.id);if(Fe>=0){e.set("project",[...q.slice(0,Fe),S,...q.slice(Fe)]);return}e.set("project",[...q,S])}const kn=Dr(()=>({mutationFn:()=>a.client.project.initGit(),onSuccess:S=>{S.data&&At(S.data)},onError:S=>{Nt({variant:"error",title:s.t("common.requestFailed"),description:_l(S,s.t)})}}));function Yi(){kn.isPending||kn.mutate()}let Pn,lr,cr=0,on,pi,an=0,On=0;const Zr=250,Sr=S=>{const q=on;if(!q)return;const Fe=(S instanceof Element?S:void 0)?.closest("[data-scrollable]");Fe&&Fe!==q||x("scrollGesture",Date.now())},Hr=()=>Date.now()-w.scrollGesture<Zr;ne(qe([()=>a.directory,()=>g.id],([,S])=>{if(be!==void 0&&cancelAnimationFrame(be),Be!==void 0&&window.clearTimeout(Be),be=void 0,Be=void 0,!S)return;const ve=kt(()=>n.data.message[S]!==void 0)?(()=>{const Fe=g_(a.directory,S);return Fe?Date.now()-Fe.at>h_:!0})():!1;kt(()=>{n.session.sync(S)}),be=requestAnimationFrame(()=>{be=void 0,Be=window.setTimeout(()=>{Be=void 0,g.id===S&&kt(()=>{ve&&n.session.sync(S,{force:!0})})},0)})})),ne(qe(()=>{const S=g.id;return[a.directory,S,S?n.data.session_status[S]?.type??"idle":"idle",S?_.blocked():!1]},([S,q,ve,Fe])=>{if(E!==void 0&&cancelAnimationFrame(E),ae!==void 0&&window.clearTimeout(ae),E=void 0,ae=void 0,!q||ve==="idle"&&!Fe)return;const Me=kt(()=>n.data.todo[q]!==void 0||e.data.session_todo[q]!==void 0);E=requestAnimationFrame(()=>{E=void 0,ae=window.setTimeout(()=>{ae=void 0,!(a.directory!==S||g.id!==q)&&kt(()=>{n.session.todo(q,Me?{force:!0}:void 0)})},0)})},{defer:!0})),ne(qe(()=>Ne().at(-1)?.id,(S,q)=>{S&&q&&S>q&&G("messageId",void 0)},{defer:!0})),ne(qe(y,()=>{G("messageId",void 0),G("changes","git"),x("pendingMessage",void 0)},{defer:!0})),ne(qe(()=>a.directory,()=>{Oe()},{defer:!0})),ne(qe(()=>[n.data.vcs?.branch,n.data.vcs?.default_branch],(S,q)=>{q===void 0||Pr(S,q)||De()},{defer:!0}));const N=a.event.listen(S=>{if(S.details.type!=="file.watcher.updated")return;const q=typeof S.details.properties=="object"&&S.details.properties?S.details.properties:void 0,ve=typeof q?.file=="string"?q.file:void 0;!ve||ve.startsWith(".git/")||De()});je(N);const X=(S,q)=>{const ve=i.get(S)?.content?.content;if(ve)return ia(ve,{start:q.startLine,end:q.endLine})},ge=S=>{const q=Ao(S.selection),ve=S.preview??X(S.file,q),Fe=d.add({file:S.file,selection:S.selection,comment:S.comment});u.context.add({type:"file",path:S.file,selection:q,comment:S.comment,commentID:Fe.id,commentOrigin:S.origin,preview:ve})},He=S=>{d.update(S.file,S.id,S.comment),u.context.updateComment(S.file,S.id,{comment:S.comment,...S.preview?{preview:S.preview}:{}})},at=S=>{d.remove(S.file,S.id),u.context.removeComment(S.file,S.id)},$t=$(()=>({moreLabel:s.t("common.moreOptions"),editLabel:s.t("common.edit"),deleteLabel:s.t("common.delete"),saveLabel:s.t("common.save")})),lt=S=>S instanceof HTMLElement?/^(INPUT|TEXTAREA|SELECT|BUTTON)$/.test(S.tagName)||S.isContentEditable:!1,he=()=>{let S=document.activeElement;for(;S instanceof HTMLElement&&S.shadowRoot?.activeElement;)S=S.shadowRoot.activeElement;return S instanceof HTMLElement?S:void 0},L=S=>{const q=S.composedPath(),ve=q.find(tt=>tt instanceof HTMLElement),Fe=he();if(!(q.some(tt=>tt instanceof HTMLElement&&tt.closest("[data-prevent-autofocus]")!==null)||lt(ve))){if(Fe){const tt=Fe.closest("[data-prevent-autofocus]"),Ht=lt(Fe);if(tt||Ht)return}if(!o.active){if(Fe===Pn){S.key==="Escape"&&Pn?.blur();return}if(v().terminal.opened()){const tt=f.active();if(tt&&PS(S)&&Jr(tt))return}if(S.key==="PageUp"||S.key==="PageDown"||S.key==="Home"||S.key==="End"){Sr();return}if(S.key.length===1&&S.key!=="Unidentified"&&!(S.ctrlKey||S.metaKey)){if(_.blocked())return;Pn?.focus()}}}},xe=$(()=>!O()&&ye.mobileTab==="changes"),Ke=$(()=>O()?J()||K()&&W()==="review":ye.mobileTab==="changes");ne(()=>{const S=Je();if(S.includes(ye.changes))return;const q=S[0];q&&G("changes",q)}),ne(()=>{const S=Ve();S&&Ke()&&pe(S)}),ne(qe(()=>n.data.session_status[g.id??""]?.type,(S,q)=>{const ve=Ve();ve&&Ke()&&(S!=="idle"||q===void 0||q==="idle"||pe(ve,!0))},{defer:!0}));const wt=()=>t.fileTree.tab(),Bt=S=>t.fileTree.setTab(S),[St,Zt]=We({reviewScroll:void 0,pendingDiff:void 0,activeDiff:void 0});ne(qe(y,()=>{Zt({reviewScroll:void 0,pendingDiff:void 0,activeDiff:void 0})},{defer:!0}));const En=()=>{wt()==="changes"&&Bt("all")};UN({navigateMessageByOffset:Kn,setActiveMessage:rn,focusInput:()=>Pn?.focus(),review:oe});const Ji=OS({showAllFiles:En,tabForPath:i.tab,openTab:b().open,setActive:b().setActive,loadFile:i.load}),Xt=()=>ee()?c(Zh,{get options(){return Je()},get current(){return ye.changes},label:q=>q==="git"?s.t("ui.sessionReview.title.git"):q==="branch"?s.t("ui.sessionReview.title.branch"):q==="session"?s.t("ui.sessionReview.title"):s.t("ui.sessionReview.title.lastTurn"),onSelect:q=>q&&G("changes",q),variant:"ghost",size:"small",valueClass:"text-14-medium"}):null,Qi=S=>(()=>{var q=VN(),ve=q.firstChild;return p(ve,S),q})(),Gr=$(()=>ye.changes==="git"?s.t("session.review.noUncommittedChanges"):ye.changes==="branch"?s.t("session.review.noBranchChanges"):ye.changes==="turn"?s.t("session.review.noChanges"):s.t(Br())),ux=S=>ye.changes==="git"||ye.changes==="branch"?zt()?Qi(Gr()):(()=>{var q=yl();return p(q,()=>s.t("session.review.loadingChanges")),Ae(()=>Jt(q,S.loadingClass)),q})():ye.changes==="turn"?Qi(Gr()):Q()&&!fe()?(()=>{var q=yl();return p(q,()=>s.t("session.review.loadingChanges")),Ae(()=>Jt(q,S.loadingClass)),q})():Br()==="session.review.noVcs"?(()=>{var q=BN(),ve=q.firstChild,Fe=ve.firstChild,Me=Fe.nextSibling;return p(Fe,()=>s.t("session.review.noVcs.createGit.title")),p(Me,()=>s.t("session.review.noVcs.createGit.description")),p(q,c(vt,{size:"large",get disabled(){return kn.isPending},onClick:Yi,get children(){return Te(()=>!!kn.isPending)()?s.t("session.review.noVcs.createGit.actionLoading"):s.t("session.review.noVcs.createGit.action")}}),null),Ae(()=>Jt(q,S.emptyClass)),q})():(()=>{var q=ZN(),ve=q.firstChild;return p(ve,Gr),Ae(()=>Jt(q,S.emptyClass)),q})(),of=S=>c(F,{get when(){return!ye.deferRender},get children(){return c(T9,{get title(){return Xt()},get empty(){return ux(S)},diffs:ht,view:v,get diffStyle(){return S.diffStyle},get onDiffStyleChange(){return S.onDiffStyleChange},onScrollRef:q=>Zt("reviewScroll",q),get focusedFile(){return St.activeDiff},onLineComment:q=>ge({...q,origin:"review"}),onLineCommentUpdate:He,onLineCommentDelete:at,get lineCommentActions(){return $t()},get commentMentions(){return{items:i.searchFilesAndDirectories}},get comments(){return d.all()},get focusedComment(){return d.focus()},get onFocusedCommentChange(){return d.setFocus},onViewFile:Ji,get classes(){return S.classes}})}}),dx=()=>(()=>{var S=HN(),q=S.firstChild;return p(q,()=>of({diffStyle:t.review.diffStyle(),onDiffStyleChange:t.review.setDiffStyle,loadingClass:"px-6 py-4 text-text-weak",emptyClass:"h-full pb-64 -mt-4 flex flex-col items-center justify-center text-center gap-6"})),S})();ne(qe(D,S=>{S&&wt()==="changes"&&En()},{defer:!0}));const fx=S=>{const q=Ci(S);if(q)return`session-review-diff-${q}`},sf=S=>{const q=St.reviewScroll;if(!q)return;const ve=fx(S);if(!ve)return;const Fe=document.getElementById(ve);if(!(Fe instanceof HTMLElement)||!q.contains(Fe))return;const Me=Fe.getBoundingClientRect(),tt=q.getBoundingClientRect();return Me.top-tt.top+q.scrollTop},mx=S=>{const q=St.reviewScroll;if(!q)return!1;const ve=sf(S);return ve===void 0?!1:(v().setScroll("review",{x:q.scrollLeft,y:ve}),q.scrollTo({top:ve,behavior:"auto"}),!0)},gx=S=>{P(),v().review.openPath(S),Zt({activeDiff:S,pendingDiff:S})};ne(()=>{const S=St.pendingDiff;if(!S||!St.reviewScroll||!zt())return;const q=ve=>{if(St.pendingDiff!==S)return;if(ve>60){Zt("pendingDiff",void 0);return}const Fe=St.reviewScroll;if(!Fe){requestAnimationFrame(()=>q(ve+1));return}if(!mx(S)){requestAnimationFrame(()=>q(ve+1));return}const Me=sf(S);if(Me===void 0){requestAnimationFrame(()=>q(ve+1));return}if(Math.abs(Fe.scrollTop-Me)<=1){Zt("pendingDiff",void 0);return}requestAnimationFrame(()=>q(ve+1))};requestAnimationFrame(()=>q(0))}),ne(()=>{const S=g.id;S&&Ke()&&n.data.session_diff[S]===void 0&&n.status!=="loading"&&n.session.diff(S)}),ne(qe(()=>[y(),Ke()],([S,q])=>{if(de!==void 0&&cancelAnimationFrame(de),Ee!==void 0&&window.clearTimeout(Ee),de=void 0,Ee=void 0,!q)return;const ve=g.id;ve&&kt(()=>n.data.session_diff[ve]!==void 0)&&(de=requestAnimationFrame(()=>{de=void 0,Ee=window.setTimeout(()=>{Ee=void 0,y()===S&&n.session.diff(ve,{force:!0})},0)}))},{defer:!0}));let af;ne(()=>{const S=a.directory;if(!O()||!t.fileTree.opened()||n.status==="loading")return;wt();const q=af!==S;af=S,q?i.tree.refresh(""):i.tree.list("")}),ne(qe(()=>a.directory,()=>{const S=D();if(!S)return;const q=i.pathFromTab(S);q&&i.load(q,{force:!0})},{defer:!0}));const Cn=np({working:()=>!0,overflowAnchor:"dynamic"});let eo,Ua,to;const hx=S=>Math.max(400,S.clientHeight),px=S=>{const q=S.scrollHeight-S.clientHeight,ve=q-S.scrollTop,Fe=q>1,Me=!Fe||ve<=2,tt=Fe&&ve>hx(S);w.scroll.overflow===Fe&&w.scroll.bottom===Me&&w.scroll.jump===tt||x("scroll",{overflow:Fe,bottom:Me,jump:tt})},Wr=S=>{Ua=S,eo===void 0&&(eo=requestAnimationFrame(()=>{eo=void 0;const q=Ua;Ua=void 0,q&&px(q)}))},vi=()=>{G("messageId",void 0),Cn.forceScrollToBottom(),ff();const S=on;S&&Wr(S)};ne(qe(Cn.userScrolled,S=>{S||(G("messageId",void 0),ff())},{defer:!0}));let no=()=>{};const vx=S=>{on=S,Cn.scrollRef(S),S&&(Wr(S),no())},bx=()=>{an+=1};Ti(()=>pi,()=>{const S=on;S&&Wr(S),no()});const ur=GN({sessionID:()=>g.id,messagesReady:Z,loaded:()=>H().length,visibleUserMessages:Ne,historyMore:se,historyLoading:re,loadMore:S=>n.session.history.loadMore(S),userScrolled:Cn.userScrolled,scroller:()=>on});no=()=>{to===void 0&&(to=requestAnimationFrame(()=>{if(to=void 0,!g.id||!Z()||Cn.userScrolled()||re())return;const S=on;S&&(S.scrollHeight>S.clientHeight+1||ur.turnStart()<=0&&!se()||ur.loadAndReveal())}))},ne(qe(()=>[g.id,Z(),ur.turnStart(),se(),re(),Cn.userScrolled(),Ne().length],([S,q,ve,Fe,Me,tt])=>{!S||!q||Me||tt||ve<=0&&!Fe||no()},{defer:!0}));const Ka=S=>cx(n.data.part[S]??[],{directory:a.directory}),yx=S=>{const q=Ka(S).map(ve=>ve.content).join("").replace(/\s+/g," ").trim();return q||`[${s.t("common.attachment")}]`},Va=S=>{Nt({variant:"error",title:s.t("common.requestFailed"),description:_l(S,s.t)})},lf=S=>n.set("session",q=>{const ve=q.findIndex(Me=>Me.id===S.id);if(ve<0)return q;const Fe=q.slice();return Fe[ve]=S,Fe}),cs=(S,q)=>n.set("session",ve=>{const Fe=ve.findIndex(tt=>tt.id===S);if(Fe<0)return ve;const Me=ve.slice();return Me[Fe]={...Me[Fe],revert:q},Me}),Ba=S=>(n.data.session_status[S]??{type:"idle"}).type!=="idle"?!0:(n.data.message[S]??[]).some(q=>q.role==="assistant"&&typeof q.time.completed!="number"),Za=$(()=>{const S=g.id;return S?ue.items[S]??Zg:Zg}),wx=$(()=>{const S=g.id;if(S)return ue.edit[S]}),us=Dr(()=>({mutationFn:async S=>{const q=(ue.items[S.sessionID]??[]).find(Fe=>Fe.id===S.id);!q||(S.manual&&me("paused",S.sessionID,void 0),me("failed",S.sessionID,void 0),!await U2({client:a.client,sync:n,globalSync:e,draft:q,optimisticBusy:q.sessionDirectory===a.directory}).catch(Fe=>(me("failed",S.sessionID,S.id),Va(Fe),!1)))||(me("items",S.sessionID,Fe=>(Fe??[]).filter(Me=>Me.id!==S.id)),S.manual&&vi())}})),ds=S=>us.isPending&&us.variables?.sessionID===S,xx=$(()=>{const S=g.id;if(S&&ds(S))return us.variables?.id}),_x=$(()=>{const S=g.id;return S?l.general.followup()==="queue"&&Ba(S)&&!_.blocked():!1}),$x=S=>{const q=S.prompt.map(Me=>Me.type==="agent"?`@${Me.name}`:Me.content).join("").split(/\r?\n/).map(Me=>Me.trim()).find(Me=>!!Me);if(q)return q;const ve=S.context.find(Me=>!!Me.comment?.trim())?.comment?.trim();if(ve)return ve;const Fe=S.context[0]?.path;return Fe?`Context file: ${Fe}`:`[${s.t("common.attachment")}]`},Sx=S=>{me("items",S.sessionID,q=>[...q??[],{id:rr.ascending("message"),...S}]),me("failed",S.sessionID,void 0),me("paused",S.sessionID,void 0)},kx=$(()=>Za().map(S=>({id:S.id,text:$x(S)}))),cf=(S,q,ve)=>!(ue.items[S]??[]).find(Me=>Me.id===q)||ds(S)?Promise.resolve():us.mutateAsync({sessionID:S,id:q,manual:ve?.manual}),Cx=S=>{const q=g.id;if(!q||ds(q))return;const ve=Za().find(Fe=>Fe.id===S);ve&&(me("items",q,Fe=>(Fe??[]).filter(Me=>Me.id!==S)),me("failed",q,Fe=>Fe===S?void 0:Fe),me("edit",q,{id:ve.id,prompt:ve.prompt,context:ve.context}))},Ix=()=>{const S=g.id;S&&me("edit",S,void 0)},Ha=S=>Ba(S)?a.client.session.abort({sessionID:S}).catch(()=>{}):Promise.resolve(),uf=Dr(()=>({mutationFn:async S=>{const q=u.current().slice(),ve=B()?.revert,Fe=Ka(S.messageID);$n(()=>{cs(S.sessionID,{messageID:S.messageID}),u.set(Fe)}),await Ha(S.sessionID).then(()=>a.client.session.revert(S)).then(Me=>{Me.data&&lf(Me.data)}).catch(Me=>{$n(()=>{cs(S.sessionID,ve),u.set(q)}),Va(Me)})}})),fs=Dr(()=>({mutationFn:async S=>{const q=g.id;if(!q)return;const ve=Se().find(Ht=>Ht.id>S),Fe=u.current().slice(),Me=B()?.revert;$n(()=>{if(cs(q,ve?{messageID:ve.id}:void 0),ve){u.set(Ka(ve.id));return}u.reset()}),await(ve?Ha(q).then(()=>a.client.session.revert({sessionID:q,messageID:ve.id})):Ha(q).then(()=>a.client.session.unrevert({sessionID:q}))).then(Ht=>{Ht.data&&lf(Ht.data)}).catch(Ht=>{$n(()=>{cs(q,Me),u.set(Fe)}),Va(Ht)})}})),qa=$(()=>uf.isPending||fs.isPending),Tx=$(()=>fs.isPending?fs.variables:void 0),Dx=S=>{if(!qa())return uf.mutateAsync(S)},Ax=S=>{if(!(!g.id||qa()))return fs.mutateAsync(S)},df=$(()=>{const S=te();return S?Se().filter(q=>q.id>=S).map(q=>({id:q.id,text:yx(q.id)})):[]}),Px={revert:Dx};ne(()=>{const S=g.id;if(!S)return;const q=Za()[0];q&&(ds(S)||ue.failed[S]!==q.id&&(ue.paused[S]||_.blocked()||Ba(S)||cf(S,q.id)))}),Ti(()=>lr,({height:S})=>{const q=Math.ceil(S);if(q===cr)return;const ve=on,Fe=q-cr,Me=ve?!Cn.userScrolled()||ve.scrollHeight-ve.clientHeight-ve.scrollTop<10+Math.max(0,Fe):!1;cr=q,Me&&Cn.forceScrollToBottom(),ve&&Wr(ve),no()});const{clearMessageHash:ff,scrollToMessage:Ox}=KN({sessionKey:y,sessionID:()=>g.id,messagesReady:Z,visibleUserMessages:Ne,historyMore:se,historyLoading:re,loadMore:S=>n.session.history.loadMore(S),turnStart:ur.turnStart,currentMessageId:()=>ye.messageId,pendingMessage:()=>w.pendingMessage,setPendingMessage:S=>x("pendingMessage",S),setActiveMessage:rn,setTurnStart:ur.setTurnStart,autoScroll:Cn,scroller:()=>on,anchor:$r,scheduleScrollState:Wr,consumePendingMessage:t.pendingMessage.consume});return ne(qe(()=>g.id,S=>{S||requestAnimationFrame(()=>Pn?.focus())})),Vt(()=>{ln(document,"keydown",L)}),je(()=>{Ue!==void 0&&cancelAnimationFrame(Ue),be!==void 0&&cancelAnimationFrame(be),Be!==void 0&&window.clearTimeout(Be),E!==void 0&&cancelAnimationFrame(E),ae!==void 0&&window.clearTimeout(ae),de!==void 0&&cancelAnimationFrame(de),Ee!==void 0&&window.clearTimeout(Ee),eo!==void 0&&cancelAnimationFrame(eo),to!==void 0&&cancelAnimationFrame(to)}),(()=>{var S=qN(),q=S.firstChild,ve=q.firstChild,Fe=ve.firstChild;return p(S,c(BS,{}),q),p(q,c(F,{get when(){return Te(()=>!O())()&&!!g.id},get children(){return c(Lt,{get value(){return ye.mobileTab},class:"h-auto",get children(){return c(Lt.List,{get children(){return[c(Lt.Trigger,{value:"session",class:"!w-1/2 !max-w-none",classes:{button:"w-full"},onClick:()=>G("mobileTab","session"),get children(){return s.t("session.tab.session")}}),c(Lt.Trigger,{value:"changes",class:"!w-1/2 !max-w-none !border-r-0",classes:{button:"w-full"},onClick:()=>G("mobileTab","changes"),get children(){return Te(()=>!!Tt())()?s.t("session.review.filesChanged",{count:Mt()}):s.t("session.review.change.other")}})]}})}})}}),ve),p(Fe,c(Gt,{get children(){return[c(Xe,{get when(){return g.id},get children(){return c(F,{get when(){return Z()},get children(){return c(zF,{get mobileChanges(){return xe()},get mobileFallback(){return of({diffStyle:"unified",classes:{root:"pb-8",header:"px-4",container:"px-4"},loadingClass:"px-4 py-4 text-text-weak",emptyClass:"h-full pb-64 -mt-4 flex flex-col items-center justify-center text-center gap-6"})},actions:Px,get scroll(){return w.scroll},onResumeScroll:vi,setScrollRef:vx,onScheduleScrollState:Wr,get onAutoScrollHandleScroll(){return Cn.handleScroll},onMarkScrollGesture:Sr,hasScrollGesture:Hr,onUserScroll:bx,get onTurnBackfillScroll(){return ur.onScrollerScroll},get onAutoScrollInteraction(){return Cn.handleInteraction},get centered(){return U()},setContentRef:Me=>{pi=Me,Cn.contentRef(Me);const tt=on;tt&&Wr(tt)},get turnStart(){return ur.turnStart()},get historyMore(){return se()},get historyLoading(){return re()},onLoadEarlier:()=>{ur.loadAndReveal()},get renderedUserMessages(){return ur.renderedUserMessages()},anchor:$r,get inlineQuestionRequest(){return _.currentQuestionRequest()},onQuestionSubmit:vi,get todoDock(){return Te(()=>!!g.id)()?{sessionID:g.id,todos:_.todos(),open:_.dock(),closing:_.closing()}:void 0}})}})}}),c(Xe,{when:!0,get children(){return c(ZI,{})}})]}})),p(ve,c(VM,{state:_,get ready(){return Te(()=>!ye.deferRender)()&&Z()},get centered(){return U()},inputRef:Me=>{Pn=Me},onSubmit:()=>{d.clear(),vi()},onResponseSubmit:vi,get followup(){return Te(()=>!!g.id)()?{queue:_x,items:kx(),sending:xx(),edit:wx(),onQueue:Sx,onAbort:()=>{const Me=g.id;Me&&me("paused",Me,!0)},onSend:Me=>{cf(g.id,Me,{manual:!0})},onEdit:Cx,onEditLoaded:Ix}:void 0},get revert(){return Te(()=>df().length>0)()?{items:df(),restoring:Tx(),disabled:qa(),onRestore:Ax}:void 0},setPromptDockRef:Me=>{lr=Me}}),null),p(ve,c(F,{get when(){return K()},get children(){var Me=yl();return Me.$$pointerdown=()=>z.start(),p(Me,c(Cc,{direction:"horizontal",get size(){return t.session.width()},min:450,get max(){return typeof window>"u"?1e3:window.innerWidth*.45},onResize:tt=>{z.touch(),t.session.resize(tt)}})),Me}}),null),p(q,c(fN,{canReview:ee,diffs:ht,diffsReady:zt,empty:Gr,hasReview:Tt,reviewCount:Mt,reviewPanel:dx,get activeDiff(){return St.activeDiff},focusReviewDiff:gx,get reviewSnap(){return w.reviewSnap},size:z}),null),p(S,c(NN,{}),null),Ae(Me=>{var tt={"@container relative shrink-0 flex flex-col min-h-0 h-full bg-background-stronger flex-1 md:flex-none":!0,"transition-[width] duration-[240ms] ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":!z.active()&&!w.reviewSnap},Ht=M();return Me.e=Ct(ve,tt,Me.e),Ht!==Me.t&&ft(ve,"width",Me.t=Ht),Me},{e:void 0,t:void 0}),S})()}Ot(["pointerdown"]);const QN=Object.freeze(Object.defineProperty({__proto__:null,default:WN},Symbol.toStringTag,{value:"Module"}));export{Sn as F,lE as L,ip as a,qo as c,cx as e,QN as s,_r as u};