natroc 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/dist/agent/home-context.d.ts +11 -1
- package/server/dist/agent/home-context.js +48 -5
- package/server/dist/agent/home-context.js.map +1 -1
- package/server/dist/config/natroc-config.d.ts +35 -0
- package/server/dist/config/natroc-config.js +138 -0
- package/server/dist/config/natroc-config.js.map +1 -0
- package/server/dist/gateway/agent-service.js +2 -2
- package/server/dist/gateway/agent-service.js.map +1 -1
- package/server/dist/gateway/gateway.js +2 -1
- package/server/dist/gateway/gateway.js.map +1 -1
- package/server/dist/gateway/index.js +2 -0
- package/server/dist/gateway/index.js.map +1 -1
- package/server/dist/gateway/rpc/auth.js +4 -0
- package/server/dist/gateway/rpc/auth.js.map +1 -1
- package/server/dist/gateway/rpc/home.d.ts +2 -0
- package/server/dist/gateway/rpc/home.js +45 -0
- package/server/dist/gateway/rpc/home.js.map +1 -0
- package/server/dist/local-runtime.d.ts +2 -0
- package/server/dist/local-runtime.js +5 -1
- package/server/dist/local-runtime.js.map +1 -1
- package/server/dist/runtime.d.ts +3 -1
- package/server/dist/runtime.js +2 -1
- package/server/dist/runtime.js.map +1 -1
- package/server/dist/server.js +6 -3
- package/server/dist/server.js.map +1 -1
- package/ui/dist/assets/{index-BiVH3g6R.js → index-BiU8FgKo.js} +2 -2
- package/ui/dist/assets/index-Dosh6wwG.css +2 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-DOfPcjx3.css +0 -2
|
@@ -50,7 +50,7 @@ Error generating stack: `+e.message+`
|
|
|
50
50
|
|
|
51
51
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
52
52
|
|
|
53
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Oa=`DialogDescriptionWarning`,ka=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ea(Oa).contentName}}.`;return b.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Aa=ta,ja=sa,Ma=la,Na=pa,Pa=va,Fa=ba,Ia=Sa,La=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ra=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),za=s(((e,t)=>{t.exports=Ra()}))();function Ba(){return(0,za.useSyncExternalStore)(Va,()=>!0,()=>!1)}function Va(){return()=>{}}var Ha=`Avatar`,[Ua,Wa]=pn(Ha),[Ga,Ka]=Ua(Ha),qa=b.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=b.useState(`idle`);return(0,C.jsx)(Ga,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,C.jsx)(La.span,{...r,ref:t})})});qa.displayName=Ha;var Ja=`AvatarImage`,Ya=b.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=Ka(Ja,n),s=$a(r,a),c=qn(e=>{i(e),o.onImageLoadingStatusChange(e)});return gn(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,C.jsx)(La.img,{...a,ref:t,src:r}):null});Ya.displayName=Ja;var Xa=`AvatarFallback`,Za=b.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=Ka(Xa,n),[o,s]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,C.jsx)(La.span,{...i,ref:t}):null});Za.displayName=Xa;function Qa(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function $a(e,{referrerPolicy:t,crossOrigin:n}){let r=Ba(),i=b.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=b.useState(()=>Qa(a,e));return gn(()=>{s(Qa(a,e))},[a,e]),gn(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var eo=qa,to=Ya,no=Za;function ro(e){let t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function io(e){let[t,n]=b.useState(void 0);return gn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var ao=[`top`,`right`,`bottom`,`left`],oo=Math.min,so=Math.max,co=Math.round,lo=Math.floor,uo=e=>({x:e,y:e}),fo={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function po(e,t,n){return so(e,oo(t,n))}function mo(e,t){return typeof e==`function`?e(t):e}function z(e){return e.split(`-`)[0]}function ho(e){return e.split(`-`)[1]}function go(e){return e===`x`?`y`:`x`}function _o(e){return e===`y`?`height`:`width`}function vo(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function yo(e){return go(vo(e))}function bo(e,t,n){n===void 0&&(n=!1);let r=ho(e),i=yo(e),a=_o(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ko(o)),[o,ko(o)]}function xo(e){let t=ko(e);return[So(e),t,So(t)]}function So(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Co=[`left`,`right`],wo=[`right`,`left`],To=[`top`,`bottom`],Eo=[`bottom`,`top`];function Do(e,t,n){switch(e){case`top`:case`bottom`:return n?t?wo:Co:t?Co:wo;case`left`:case`right`:return t?To:Eo;default:return[]}}function Oo(e,t,n,r){let i=ho(e),a=Do(z(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(So)))),a}function ko(e){let t=z(e);return fo[t]+e.slice(t.length)}function Ao(e){return{top:0,right:0,bottom:0,left:0,...e}}function jo(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ao(e)}function Mo(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function No(e,t,n){let{reference:r,floating:i}=e,a=vo(t),o=yo(t),s=_o(o),c=z(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ho(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Po(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=mo(t,e),p=jo(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Mo(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Mo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Fo=50,Io=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Po},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=No(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Fo&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=No(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Lo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=mo(e,t)||{};if(l==null)return{};let d=jo(u),f={x:n,y:r},p=yo(i),m=_o(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=oo(d[_],T),D=oo(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=po(O,A,k),M=!c.arrow&&ho(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Ro=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=mo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=z(r),_=vo(o),v=z(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ko(o)]:xo(o)),x=p!==`none`;!d&&x&&b.push(...Oo(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=bo(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==vo(t))||T.every(e=>vo(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vo(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function zo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bo(e){return ao.some(t=>e[t]>=0)}var Vo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=mo(e,t);switch(i){case`referenceHidden`:{let e=zo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Bo(e)}}}case`escaped`:{let e=zo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Bo(e)}}}default:return{}}}}},Ho=new Set([`left`,`top`]);async function Uo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=z(n),s=ho(n),c=vo(n)===`y`,l=Ho.has(o)?-1:1,u=a&&c?-1:1,d=mo(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Wo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Uo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Go=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=mo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=vo(z(i)),p=go(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=po(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=po(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ko=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=mo(e,t),u={x:n,y:r},d=vo(i),f=go(d),p=u[f],m=u[d],h=mo(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ho.has(z(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},qo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=mo(e,t),u=await o.detectOverflow(t,l),d=z(i),f=ho(i),p=vo(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=oo(h-u[g],v),x=oo(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=so(u.left,0),t=so(u.right,0),n=so(u.top,0),r=so(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:so(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:so(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Jo(){return typeof window<`u`}function Yo(e){return Qo(e)?(e.nodeName||``).toLowerCase():`#document`}function Xo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zo(e){return((Qo(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Qo(e){return Jo()?e instanceof Node||e instanceof Xo(e).Node:!1}function $o(e){return Jo()?e instanceof Element||e instanceof Xo(e).Element:!1}function es(e){return Jo()?e instanceof HTMLElement||e instanceof Xo(e).HTMLElement:!1}function ts(e){return!Jo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Xo(e).ShadowRoot}function ns(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ps(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function rs(e){return/^(table|td|th)$/.test(Yo(e))}function is(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var as=/transform|translate|scale|rotate|perspective|filter/,os=/paint|layout|strict|content/,ss=e=>!!e&&e!==`none`,cs;function ls(e){let t=$o(e)?ps(e):e;return ss(t.transform)||ss(t.translate)||ss(t.scale)||ss(t.rotate)||ss(t.perspective)||!ds()&&(ss(t.backdropFilter)||ss(t.filter))||as.test(t.willChange||``)||os.test(t.contain||``)}function us(e){let t=hs(e);for(;es(t)&&!fs(t);){if(ls(t))return t;if(is(t))return null;t=hs(t)}return null}function ds(){return cs??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),cs}function fs(e){return/^(html|body|#document)$/.test(Yo(e))}function ps(e){return Xo(e).getComputedStyle(e)}function ms(e){return $o(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hs(e){if(Yo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ts(e)&&e.host||Zo(e);return ts(t)?t.host:t}function gs(e){let t=hs(e);return fs(t)?e.ownerDocument?e.ownerDocument.body:e.body:es(t)&&ns(t)?t:gs(t)}function _s(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=gs(e),i=r===e.ownerDocument?.body,a=Xo(r);if(i){let e=vs(a);return t.concat(a,a.visualViewport||[],ns(r)?r:[],e&&n?_s(e):[])}else return t.concat(r,_s(r,[],n))}function vs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ys(e){let t=ps(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=es(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=co(n)!==a||co(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function bs(e){return $o(e)?e:e.contextElement}function xs(e){let t=bs(e);if(!es(t))return uo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ys(t),o=(a?co(n.width):n.width)/r,s=(a?co(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ss=uo(0);function Cs(e){let t=Xo(e);return!ds()||!t.visualViewport?Ss:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ws(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Xo(e)?!1:t}function Ts(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=bs(e),o=uo(1);t&&(r?$o(r)&&(o=xs(r)):o=xs(e));let s=ws(a,n,r)?Cs(a):uo(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Xo(a),t=r&&$o(r)?Xo(r):r,n=e,i=vs(n);for(;i&&r&&t!==n;){let e=xs(i),t=i.getBoundingClientRect(),r=ps(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Xo(i),i=vs(n)}}return Mo({width:u,height:d,x:c,y:l})}function Es(e,t){let n=ms(e).scrollLeft;return t?t.left+n:Ts(Zo(e)).left+n}function Ds(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Es(e,n),y:n.top+t.scrollTop}}function Os(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Zo(r),s=t?is(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=uo(1),u=uo(0),d=es(r);if((d||!d&&!a)&&((Yo(r)!==`body`||ns(o))&&(c=ms(r)),d)){let e=Ts(r);l=xs(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ds(o,c):uo(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ks(e){return Array.from(e.getClientRects())}function As(e){let t=Zo(e),n=ms(e),r=e.ownerDocument.body,i=so(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=so(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Es(e),s=-n.scrollTop;return ps(r).direction===`rtl`&&(o+=so(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var js=25;function Ms(e,t){let n=Xo(e),r=Zo(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ds();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Es(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=js&&(a-=o)}else l<=js&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ns(e,t){let n=Ts(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=es(e)?xs(e):uo(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ps(e,t,n){let r;if(t===`viewport`)r=Ms(e,n);else if(t===`document`)r=As(Zo(e));else if($o(t))r=Ns(t,n);else{let n=Cs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Mo(r)}function Fs(e,t){let n=hs(e);return n===t||!$o(n)||fs(n)?!1:ps(n).position===`fixed`||Fs(n,t)}function Is(e,t){let n=t.get(e);if(n)return n;let r=_s(e,[],!1).filter(e=>$o(e)&&Yo(e)!==`body`),i=null,a=ps(e).position===`fixed`,o=a?hs(e):e;for(;$o(o)&&!fs(o);){let t=ps(o),n=ls(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ns(o)&&!n&&Fs(e,o))?r=r.filter(e=>e!==o):i=t,o=hs(o)}return t.set(e,r),r}function Ls(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?is(t)?[]:Is(t,this._c):[].concat(n),r],o=Ps(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ps(t,a[e],i);s=so(n.top,s),c=oo(n.right,c),l=oo(n.bottom,l),u=so(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Rs(e){let{width:t,height:n}=ys(e);return{width:t,height:n}}function zs(e,t,n){let r=es(t),i=Zo(t),a=n===`fixed`,o=Ts(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=uo(0);function l(){c.x=Es(i)}if(r||!r&&!a)if((Yo(t)!==`body`||ns(i))&&(s=ms(t)),r){let e=Ts(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ds(i,s):uo(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Bs(e){return ps(e).position===`static`}function Vs(e,t){if(!es(e)||ps(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Zo(e)===n&&(n=n.ownerDocument.body),n}function Hs(e,t){let n=Xo(e);if(is(e))return n;if(!es(e)){let t=hs(e);for(;t&&!fs(t);){if($o(t)&&!Bs(t))return t;t=hs(t)}return n}let r=Vs(e,t);for(;r&&rs(r)&&Bs(r);)r=Vs(r,t);return r&&fs(r)&&Bs(r)&&!ls(r)?n:r||us(e)||n}var Us=async function(e){let t=this.getOffsetParent||Hs,n=this.getDimensions,r=await n(e.floating);return{reference:zs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ws(e){return ps(e).direction===`rtl`}var Gs={convertOffsetParentRelativeRectToViewportRelativeRect:Os,getDocumentElement:Zo,getClippingRect:Ls,getOffsetParent:Hs,getElementRects:Us,getClientRects:ks,getDimensions:Rs,getScale:xs,isElement:$o,isRTL:Ws};function Ks(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qs(e,t){let n=null,r,i=Zo(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=lo(d),h=lo(i.clientWidth-(u+f)),g=lo(i.clientHeight-(d+p)),_=lo(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:so(0,oo(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ks(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Js(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=bs(e),u=i||a?[...l?_s(l):[],...t?_s(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?qs(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ts(e):null;c&&g();function g(){let t=Ts(e);h&&!Ks(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ys=Wo,Xs=Go,Zs=Ro,Qs=qo,$s=Vo,ec=Lo,tc=Ko,nc=(e,t,n)=>{let r=new Map,i={platform:Gs,...n},a={...i.platform,_c:r};return Io(e,t,{...i,platform:a})},rc=typeof document<`u`?b.useLayoutEffect:function(){};function ic(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ic(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ic(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ac(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oc(e,t){let n=ac(e);return Math.round(t*n)/n}function sc(e){let t=b.useRef(e);return rc(()=>{t.current=e}),t}function cc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);ic(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=sc(c),O=sc(i),k=sc(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),nc(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!ic(T.current,t)&&(T.current=t,P.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);rc(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);rc(()=>(j.current=!0,()=>{j.current=!1}),[]),rc(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),ee=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=oc(N.floating,u.x),r=oc(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ac(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var lc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ec({element:r.current,padding:i}).fn(n):r?ec({element:r,padding:i}).fn(n):{}}}},uc=(e,t)=>{let n=Ys(e);return{name:n.name,fn:n.fn,options:[e,t]}},dc=(e,t)=>{let n=Xs(e);return{name:n.name,fn:n.fn,options:[e,t]}},fc=(e,t)=>({fn:tc(e).fn,options:[e,t]}),pc=(e,t)=>{let n=Zs(e);return{name:n.name,fn:n.fn,options:[e,t]}},mc=(e,t)=>{let n=Qs(e);return{name:n.name,fn:n.fn,options:[e,t]}},hc=(e,t)=>{let n=$s(e);return{name:n.name,fn:n.fn,options:[e,t]}},gc=(e,t)=>{let n=lc(e);return{name:n.name,fn:n.fn,options:[e,t]}},_c=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),vc=`Arrow`,yc=b.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,C.jsx)(_c.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,C.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});yc.displayName=vc;var bc=yc,xc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Sc=`Popper`,[Cc,wc]=pn(Sc),[Tc,Ec]=Cc(Sc),Dc=e=>{let{__scopePopper:t,children:n}=e,[r,i]=b.useState(null);return(0,C.jsx)(Tc,{scope:t,anchor:r,onAnchorChange:i,children:n})};Dc.displayName=Sc;var Oc=`PopperAnchor`,kc=b.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Ec(Oc,n),o=b.useRef(null),s=Zt(t,o),c=b.useRef(null);return b.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,C.jsx)(xc.div,{...i,ref:s})});kc.displayName=Oc;var Ac=`PopperContent`,[jc,Mc]=Cc(Ac),Nc=b.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Ec(Ac,n),[_,v]=b.useState(null),y=Zt(t,e=>v(e)),[x,S]=b.useState(null),w=io(x),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(Lc),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:te,middlewareData:P}=cc({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>Js(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[uc({mainAxis:i+E,alignmentAxis:o}),c&&dc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?fc():void 0,...j}),c&&pc({...j}),mc({...j,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&gc({element:x,padding:s}),Rc({arrowWidth:T,arrowHeight:E}),f&&hc({strategy:`referenceHidden`,...j})]}),[F,ne]=zc(ee),re=qn(m);gn(()=>{te&&re?.()},[te,re]);let ie=P.arrow?.x,ae=P.arrow?.y,I=P.arrow?.centerOffset!==0,[oe,se]=b.useState();return gn(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,C.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:te?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,C.jsx)(jc,{scope:n,placedSide:F,onArrowChange:S,arrowX:ie,arrowY:ae,shouldHideArrow:I,children:(0,C.jsx)(xc.div,{"data-side":F,"data-align":ne,...h,ref:y,style:{...h.style,animation:te?void 0:`none`}})})})});Nc.displayName=Ac;var Pc=`PopperArrow`,Fc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Ic=b.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Mc(Pc,n),a=Fc[i.placedSide];return(0,C.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,C.jsx)(bc,{...r,ref:t,style:{...r.style,display:`block`}})})});Ic.displayName=Pc;function Lc(e){return e!==null}var Rc=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=zc(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function zc(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Bc=Dc,Vc=kc,Hc=Nc,Uc=Ic,Wc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Gc(e,t){e&&P.flushSync(()=>e.dispatchEvent(t))}var Kc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),qc=`rovingFocusGroup.onEntryFocus`,Jc={bubbles:!1,cancelable:!0},Yc=`RovingFocusGroup`,[Xc,Zc,Qc]=hn(Yc),[$c,el]=pn(Yc,[Qc]),[tl,nl]=$c(Yc),rl=b.forwardRef((e,t)=>(0,C.jsx)(Xc.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,C.jsx)(Xc.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,C.jsx)(il,{...e,ref:t})})}));rl.displayName=Yc;var il=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=b.useRef(null),p=Zt(t,f),m=Wn(a),[h,g]=vn({prop:o,defaultProp:s??null,onChange:c,caller:Yc}),[_,v]=b.useState(!1),y=qn(l),x=Zc(n),S=b.useRef(!1),[w,T]=b.useState(0);return b.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(qc,y),()=>e.removeEventListener(qc,y)},[y]),(0,C.jsx)(tl,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:b.useCallback(e=>g(e),[g]),onItemShiftTab:b.useCallback(()=>v(!0),[]),onFocusableItemAdd:b.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:b.useCallback(()=>T(e=>e-1),[]),children:(0,C.jsx)(Kc.div,{tabIndex:_||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:R(e.onMouseDown,()=>{S.current=!0}),onFocus:R(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(qc,Jc);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);ul([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:R(e.onBlur,()=>v(!1))})})}),al=`RovingFocusGroupItem`,ol=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=kn(),l=a||c,u=nl(al,n),d=u.currentTabStopId===l,f=Zc(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return b.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,C.jsx)(Xc.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,C.jsx)(Kc.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:R(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:R(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ll(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?dl(n,r+1):n.slice(r+1)}setTimeout(()=>ul(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});ol.displayName=al;var sl={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function cl(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ll(e,t,n){let r=cl(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return sl[r]}function ul(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function dl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fl=rl,pl=ol,ml=[`Enter`,` `],hl=[`ArrowDown`,`PageUp`,`Home`],gl=[`ArrowUp`,`PageDown`,`End`],_l=[...hl,...gl],vl={ltr:[...ml,`ArrowRight`],rtl:[...ml,`ArrowLeft`]},yl={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},bl=`Menu`,[xl,Sl,Cl]=hn(bl),[wl,Tl]=pn(bl,[Cl,wc,el]),El=wc(),Dl=el(),[Ol,kl]=wl(bl),[Al,jl]=wl(bl),Ml=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=El(t),[c,l]=b.useState(null),u=b.useRef(!1),d=qn(a),f=Wn(i);return b.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,C.jsx)(Bc,{...s,children:(0,C.jsx)(Ol,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,C.jsx)(Al,{scope:t,onClose:b.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Ml.displayName=bl;var Nl=`MenuAnchor`,Pl=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=El(n);return(0,C.jsx)(Vc,{...i,...r,ref:t})});Pl.displayName=Nl;var Fl=`MenuPortal`,[Il,Ll]=wl(Fl,{forceMount:void 0}),Rl=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=kl(Fl,t);return(0,C.jsx)(Il,{scope:t,forceMount:n,children:(0,C.jsx)(Cn,{present:n||a.open,children:(0,C.jsx)(Dr,{asChild:!0,container:i,children:r})})})};Rl.displayName=Fl;var zl=`MenuContent`,[Bl,Vl]=wl(zl),Hl=b.forwardRef((e,t)=>{let n=Ll(zl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=kl(zl,e.__scopeMenu),o=jl(zl,e.__scopeMenu);return(0,C.jsx)(xl.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(Cn,{present:r||a.open,children:(0,C.jsx)(xl.Slot,{scope:e.__scopeMenu,children:o.modal?(0,C.jsx)(Ul,{...i,ref:t}):(0,C.jsx)(Wl,{...i,ref:t})})})})}),Ul=b.forwardRef((e,t)=>{let n=kl(zl,e.__scopeMenu),r=b.useRef(null),i=Zt(t,r);return b.useEffect(()=>{let e=r.current;if(e)return Yi(e)},[]),(0,C.jsx)(Kl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Wl=b.forwardRef((e,t)=>{let n=kl(zl,e.__scopeMenu);return(0,C.jsx)(Kl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Gl=Qt(`MenuContent.ScrollLock`),Kl=b.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=kl(zl,n),_=jl(zl,n),v=El(n),y=Dl(n),x=Sl(n),[S,w]=b.useState(null),T=b.useRef(null),E=Zt(t,T,g.onContentChange),D=b.useRef(0),O=b.useRef(``),k=b.useRef(0),A=b.useRef(null),j=b.useRef(`right`),M=b.useRef(0),N=m?Bi:b.Fragment,ee=m?{as:Gl,allowPinchZoom:!0}:void 0,te=e=>{let t=O.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Ou(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};b.useEffect(()=>()=>window.clearTimeout(D.current),[]),Ar();let P=b.useCallback(e=>j.current===A.current?.side&&Au(e,A.current?.area),[]);return(0,C.jsx)(Bl,{scope:n,searchRef:O,onItemEnter:b.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:b.useCallback(e=>{P(e)||(T.current?.focus(),w(null))},[P]),onTriggerLeave:b.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:k,onPointerGraceIntentChange:b.useCallback(e=>{A.current=e},[]),children:(0,C.jsx)(N,{...ee,children:(0,C.jsx)(pr,{asChild:!0,trapped:i,onMountAutoFocus:R(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,C.jsx)(tr,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,C.jsx)(fl,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:w,onEntryFocus:R(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,C.jsx)(Hc,{role:`menu`,"aria-orientation":`vertical`,"data-state":Cu(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:E,style:{outline:`none`,...h.style},onKeyDown:R(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&te(e.key));let i=T.current;if(e.target!==i||!_l.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);gl.includes(e.key)&&a.reverse(),Eu(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:R(e.onPointerMove,ju(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(j.current=e.clientX>M.current?`right`:`left`,M.current=e.clientX)}))})})})})})})});Hl.displayName=zl;var B=`MenuGroup`,V=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,C.jsx)(Wc.div,{role:`group`,...r,ref:t})});V.displayName=B;var ql=`MenuLabel`,Jl=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,C.jsx)(Wc.div,{...r,ref:t})});Jl.displayName=ql;var Yl=`MenuItem`,Xl=`menu.itemSelect`,Zl=b.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=b.useRef(null),o=jl(Yl,e.__scopeMenu),s=Vl(Yl,e.__scopeMenu),c=Zt(t,a),l=b.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Xl,{bubbles:!0,cancelable:!0});e.addEventListener(Xl,e=>r?.(e),{once:!0}),Gc(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,C.jsx)(Ql,{...i,ref:c,disabled:n,onClick:R(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:R(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||ml.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Zl.displayName=Yl;var Ql=b.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Vl(Yl,n),s=Dl(n),c=b.useRef(null),l=Zt(t,c),[u,d]=b.useState(!1),[f,p]=b.useState(``);return b.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,C.jsx)(xl.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,C.jsx)(pl,{asChild:!0,...s,focusable:!r,children:(0,C.jsx)(Wc.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:R(e.onPointerMove,ju(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,ju(e=>o.onItemLeave(e))),onFocus:R(e.onFocus,()=>d(!0)),onBlur:R(e.onBlur,()=>d(!1))})})})}),$l=`MenuCheckboxItem`,eu=b.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,C.jsx)(cu,{scope:e.__scopeMenu,checked:n,children:(0,C.jsx)(Zl,{role:`menuitemcheckbox`,"aria-checked":wu(n)?`mixed`:n,...i,ref:t,"data-state":Tu(n),onSelect:R(i.onSelect,()=>r?.(wu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});eu.displayName=$l;var tu=`MenuRadioGroup`,[nu,ru]=wl(tu,{value:void 0,onValueChange:()=>{}}),iu=b.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=qn(r);return(0,C.jsx)(nu,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,C.jsx)(V,{...i,ref:t})})});iu.displayName=tu;var au=`MenuRadioItem`,ou=b.forwardRef((e,t)=>{let{value:n,...r}=e,i=ru(au,e.__scopeMenu),a=n===i.value;return(0,C.jsx)(cu,{scope:e.__scopeMenu,checked:a,children:(0,C.jsx)(Zl,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Tu(a),onSelect:R(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ou.displayName=au;var su=`MenuItemIndicator`,[cu,lu]=wl(su,{checked:!1}),uu=b.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=lu(su,n);return(0,C.jsx)(Cn,{present:r||wu(a.checked)||a.checked===!0,children:(0,C.jsx)(Wc.span,{...i,ref:t,"data-state":Tu(a.checked)})})});uu.displayName=su;var du=`MenuSeparator`,fu=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,C.jsx)(Wc.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});fu.displayName=du;var pu=`MenuArrow`,mu=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=El(n);return(0,C.jsx)(Uc,{...i,...r,ref:t})});mu.displayName=pu;var hu=`MenuSub`,[gu,_u]=wl(hu),vu=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=kl(hu,t),o=El(t),[s,c]=b.useState(null),[l,u]=b.useState(null),d=qn(i);return b.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,C.jsx)(Bc,{...o,children:(0,C.jsx)(Ol,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,C.jsx)(gu,{scope:t,contentId:kn(),triggerId:kn(),trigger:s,onTriggerChange:c,children:n})})})};vu.displayName=hu;var yu=`MenuSubTrigger`,bu=b.forwardRef((e,t)=>{let n=kl(yu,e.__scopeMenu),r=jl(yu,e.__scopeMenu),i=_u(yu,e.__scopeMenu),a=Vl(yu,e.__scopeMenu),o=b.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=b.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return b.useEffect(()=>u,[u]),b.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,C.jsx)(Pl,{asChild:!0,...l,children:(0,C.jsx)(Ql,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Cu(n.open),...e,ref:Xt(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,ju(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,ju(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||vl[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});bu.displayName=yu;var xu=`MenuSubContent`,Su=b.forwardRef((e,t)=>{let n=Ll(zl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=kl(zl,e.__scopeMenu),o=jl(zl,e.__scopeMenu),s=_u(xu,e.__scopeMenu),c=b.useRef(null),l=Zt(t,c);return(0,C.jsx)(xl.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(Cn,{present:r||a.open,children:(0,C.jsx)(xl.Slot,{scope:e.__scopeMenu,children:(0,C.jsx)(Kl,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=yl[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Su.displayName=xu;function Cu(e){return e?`open`:`closed`}function wu(e){return e===`indeterminate`}function Tu(e){return wu(e)?`indeterminate`:e?`checked`:`unchecked`}function Eu(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Du(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ou(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Du(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ku(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Au(e,t){return t?ku({x:e.clientX,y:e.clientY},t):!1}function ju(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Mu=Ml,Nu=Pl,Pu=Rl,Fu=Hl,Iu=V,Lu=Jl,Ru=Zl,zu=eu,Bu=iu,Vu=ou,Hu=uu,Uu=fu,Wu=mu,Gu=bu,Ku=Su,qu=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ju=`DropdownMenu`,[Yu,Xu]=pn(Ju,[Tl]),Zu=Tl(),[Qu,$u]=Yu(Ju),ed=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Zu(t),l=b.useRef(null),[u,d]=vn({prop:i,defaultProp:a??!1,onChange:o,caller:Ju});return(0,C.jsx)(Qu,{scope:t,triggerId:kn(),triggerRef:l,contentId:kn(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,C.jsx)(Mu,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};ed.displayName=Ju;var td=`DropdownMenuTrigger`,nd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=$u(td,n),o=Zu(n);return(0,C.jsx)(Nu,{asChild:!0,...o,children:(0,C.jsx)(qu.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Xt(t,a.triggerRef),onPointerDown:R(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});nd.displayName=td;var rd=`DropdownMenuPortal`,id=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Zu(t);return(0,C.jsx)(Pu,{...r,...n})};id.displayName=rd;var ad=`DropdownMenuContent`,od=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$u(ad,n),a=Zu(n),o=b.useRef(!1);return(0,C.jsx)(Fu,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});od.displayName=ad;var sd=`DropdownMenuGroup`,cd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Iu,{...i,...r,ref:t})});cd.displayName=sd;var ld=`DropdownMenuLabel`,ud=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Lu,{...i,...r,ref:t})});ud.displayName=ld;var dd=`DropdownMenuItem`,fd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Ru,{...i,...r,ref:t})});fd.displayName=dd;var pd=`DropdownMenuCheckboxItem`,md=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(zu,{...i,...r,ref:t})});md.displayName=pd;var hd=`DropdownMenuRadioGroup`,gd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Bu,{...i,...r,ref:t})});gd.displayName=hd;var _d=`DropdownMenuRadioItem`,vd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Vu,{...i,...r,ref:t})});vd.displayName=_d;var yd=`DropdownMenuItemIndicator`,bd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Hu,{...i,...r,ref:t})});bd.displayName=yd;var xd=`DropdownMenuSeparator`,Sd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Uu,{...i,...r,ref:t})});Sd.displayName=xd;var Cd=`DropdownMenuArrow`,wd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Wu,{...i,...r,ref:t})});wd.displayName=Cd;var Td=`DropdownMenuSubTrigger`,Ed=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Gu,{...i,...r,ref:t})});Ed.displayName=Td;var Dd=`DropdownMenuSubContent`,Od=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Ku,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Od.displayName=Dd;var kd=ed,H=nd,Ad=id,jd=od,Md=cd,Nd=ud,Pd=fd,Fd=gd,Id=vd,Ld=bd,Rd=Sd,zd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Bd=`Label`,Vd=b.forwardRef((e,t)=>(0,C.jsx)(zd.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Vd.displayName=Bd;var Hd=Vd;function Ud(e,[t,n]){return Math.min(n,Math.max(t,e))}var Wd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Gd=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Kd=[` `,`Enter`],qd=`Select`,[Jd,Yd,Xd]=hn(qd),[Zd,Qd]=pn(qd,[Xd,wc]),$d=wc(),[ef,tf]=Zd(qd),[nf,rf]=Zd(qd),af=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=$d(t),[g,_]=b.useState(null),[v,y]=b.useState(null),[x,S]=b.useState(!1),w=Wn(l),[T,E]=vn({prop:r,defaultProp:i??!1,onChange:a,caller:qd}),[D,O]=vn({prop:o,defaultProp:s,onChange:c,caller:qd}),k=b.useRef(null),A=g?m||!!g.closest(`form`):!0,[j,M]=b.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,C.jsx)(Bc,{...h,children:(0,C.jsxs)(ef,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:kn(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,children:[(0,C.jsx)(Jd.Provider,{scope:t,children:(0,C.jsx)(nf,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:b.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,C.jsxs)(ep,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:D,onChange:e=>O(e.target.value),disabled:f,form:m,children:[D===void 0?(0,C.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};af.displayName=qd;var of=`SelectTrigger`,sf=b.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=$d(n),o=tf(of,n),s=o.disabled||r,c=Zt(t,o.onTriggerChange),l=Yd(n),u=b.useRef(`touch`),[d,f,p]=np(e=>{let t=l().filter(e=>!e.disabled),n=rp(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,C.jsx)(Vc,{asChild:!0,...a,children:(0,C.jsx)(Wd.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":tp(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Gd.includes(e.key)&&(m(),e.preventDefault())})})})});sf.displayName=of;var cf=`SelectValue`,lf=b.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=tf(cf,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Zt(t,c.onValueNodeChange);return gn(()=>{l(u)},[l,u]),(0,C.jsx)(Wd.span,{...s,ref:d,style:{pointerEvents:`none`},children:tp(c.value)?(0,C.jsx)(C.Fragment,{children:o}):a})});lf.displayName=cf;var uf=`SelectIcon`,df=b.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,C.jsx)(Wd.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});df.displayName=uf;var ff=`SelectPortal`,pf=e=>(0,C.jsx)(Dr,{asChild:!0,...e});pf.displayName=ff;var mf=`SelectContent`,hf=b.forwardRef((e,t)=>{let n=tf(mf,e.__scopeSelect),[r,i]=b.useState();if(gn(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?P.createPortal((0,C.jsx)(_f,{scope:e.__scopeSelect,children:(0,C.jsx)(Jd.Slot,{scope:e.__scopeSelect,children:(0,C.jsx)(`div`,{children:e.children})})}),t):null}return(0,C.jsx)(xf,{...e,ref:t})});hf.displayName=mf;var gf=10,[_f,vf]=Zd(mf),yf=`SelectContentImpl`,bf=Qt(`SelectContent.RemoveScroll`),xf=b.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=tf(mf,n),[y,x]=b.useState(null),[S,w]=b.useState(null),T=Zt(t,e=>x(e)),[E,D]=b.useState(null),[O,k]=b.useState(null),A=Yd(n),[j,M]=b.useState(!1),N=b.useRef(!1);b.useEffect(()=>{if(y)return Yi(y)},[y]),Ar();let ee=b.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,S]),te=b.useCallback(()=>ee([E,y]),[ee,E,y]);b.useEffect(()=>{j&&te()},[j,te]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;b.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),b.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[ne,re]=np(e=>{let t=A().filter(e=>!e.disabled),n=rp(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=b.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&(D(e),r&&(N.current=!0))},[v.value]),ae=b.useCallback(()=>y?.focus(),[y]),I=b.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&k(e)},[v.value]),oe=r===`popper`?Tf:Cf,se=oe===Tf?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,C.jsx)(_f,{scope:n,content:y,viewport:S,onViewportChange:w,itemRefCallback:ie,selectedItem:E,onItemLeave:ae,itemTextRefCallback:I,focusSelectedItem:te,selectedItemText:O,position:r,isPositioned:j,searchRef:ne,children:(0,C.jsx)(Bi,{as:bf,allowPinchZoom:!0,children:(0,C.jsx)(pr,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,C.jsx)(tr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,C.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ee(t)),e.preventDefault()}})})})})})})});xf.displayName=yf;var Sf=`SelectItemAlignedPosition`,Cf=b.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=tf(mf,n),o=vf(mf,n),[s,c]=b.useState(null),[l,u]=b.useState(null),d=Zt(t,e=>u(e)),f=Yd(n),p=b.useRef(!1),m=b.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=b.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-gf,d=Ud(a,[gf,Math.max(gf,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-gf,d=Ud(a,[gf,Math.max(gf,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-gf*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-gf,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${gf}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);gn(()=>y(),[y]);let[x,S]=b.useState();return gn(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,C.jsx)(Ef,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:b.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,C.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,C.jsx)(Wd.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Cf.displayName=Sf;var wf=`SelectPopperPosition`,Tf=b.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=gf,...a}=e,o=$d(n);return(0,C.jsx)(Hc,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Tf.displayName=wf;var[Ef,Df]=Zd(mf,{}),Of=`SelectViewport`,kf=b.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=vf(Of,n),o=Df(Of,n),s=Zt(t,a.onViewportChange),c=b.useRef(0);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,C.jsx)(Jd.Slot,{scope:n,children:(0,C.jsx)(Wd.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-gf*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});kf.displayName=Of;var Af=`SelectGroup`,[jf,Mf]=Zd(Af),Nf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=kn();return(0,C.jsx)(jf,{scope:n,id:i,children:(0,C.jsx)(Wd.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Nf.displayName=Af;var Pf=`SelectLabel`,Ff=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Mf(Pf,n);return(0,C.jsx)(Wd.div,{id:i.id,...r,ref:t})});Ff.displayName=Pf;var If=`SelectItem`,[Lf,Rf]=Zd(If),zf=b.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=tf(If,n),c=vf(If,n),l=s.value===r,[u,d]=b.useState(a??``),[f,p]=b.useState(!1),m=Zt(t,e=>c.itemRefCallback?.(e,r,i)),h=kn(),g=b.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,C.jsx)(Lf,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:b.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,C.jsx)(Jd.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,C.jsx)(Wd.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:R(o.onFocus,()=>p(!0)),onBlur:R(o.onBlur,()=>p(!1)),onClick:R(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:R(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:R(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Kd.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});zf.displayName=If;var Bf=`SelectItemText`,Vf=b.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=tf(Bf,n),s=vf(Bf,n),c=Rf(Bf,n),l=rf(Bf,n),[u,d]=b.useState(null),f=Zt(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=b.useMemo(()=>(0,C.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return gn(()=>(h(m),()=>g(m)),[h,g,m]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Wd.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?P.createPortal(a.children,o.valueNode):null]})});Vf.displayName=Bf;var Hf=`SelectItemIndicator`,Uf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Rf(Hf,n).isSelected?(0,C.jsx)(Wd.span,{"aria-hidden":!0,...r,ref:t}):null});Uf.displayName=Hf;var Wf=`SelectScrollUpButton`,Gf=b.forwardRef((e,t)=>{let n=vf(Wf,e.__scopeSelect),r=Df(Wf,e.__scopeSelect),[i,a]=b.useState(!1),o=Zt(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,C.jsx)(Jf,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Gf.displayName=Wf;var Kf=`SelectScrollDownButton`,qf=b.forwardRef((e,t)=>{let n=vf(Kf,e.__scopeSelect),r=Df(Kf,e.__scopeSelect),[i,a]=b.useState(!1),o=Zt(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,C.jsx)(Jf,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});qf.displayName=Kf;var Jf=b.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=vf(`SelectScrollButton`,n),o=b.useRef(null),s=Yd(n),c=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>c(),[c]),gn(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,C.jsx)(Wd.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),Yf=`SelectSeparator`,Xf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,C.jsx)(Wd.div,{"aria-hidden":!0,...r,ref:t})});Xf.displayName=Yf;var Zf=`SelectArrow`,Qf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$d(n),a=tf(Zf,n),o=vf(Zf,n);return a.open&&o.position===`popper`?(0,C.jsx)(Uc,{...i,...r,ref:t}):null});Qf.displayName=Zf;var $f=`SelectBubbleInput`,ep=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=b.useRef(null),a=Zt(r,i),o=ro(t);return b.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,C.jsx)(Wd.select,{...n,style:{...cn,...n.style},ref:a,defaultValue:t})});ep.displayName=$f;function tp(e){return e===``||e===void 0}function np(e){let t=qn(e),n=b.useRef(``),r=b.useRef(0),i=b.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=b.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function rp(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ip(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ip(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ap=af,op=sf,sp=lf,cp=df,lp=pf,up=hf,dp=kf,fp=zf,pp=Vf,mp=Uf,hp=Gf,gp=qf,_p=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),vp=`Separator`,yp=`horizontal`,bp=[`horizontal`,`vertical`],xp=b.forwardRef((e,t)=>{let{decorative:n,orientation:r=yp,...i}=e,a=Sp(r)?r:yp,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,C.jsx)(_p.div,{"data-orientation":a,...o,...i,ref:t})});xp.displayName=vp;function Sp(e){return bp.includes(e)}var Cp=xp,wp=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Tp=`Switch`,[Ep,Dp]=pn(Tp),[Op,kp]=Ep(Tp),Ap=b.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=b.useState(null),m=Zt(t,e=>p(e)),h=b.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=vn({prop:i,defaultProp:a??!1,onChange:l,caller:Tp});return(0,C.jsxs)(Op,{scope:n,checked:_,disabled:s,children:[(0,C.jsx)(wp.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":Fp(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:R(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,C.jsx)(Pp,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Ap.displayName=Tp;var jp=`SwitchThumb`,Mp=b.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=kp(jp,n);return(0,C.jsx)(wp.span,{"data-state":Fp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Mp.displayName=jp;var Np=`SwitchBubbleInput`,Pp=b.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=b.useRef(null),s=Zt(o,a),c=ro(n),l=io(t);return b.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,C.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Pp.displayName=Np;function Fp(e){return e?`checked`:`unchecked`}var Ip=Ap,Lp=Mp,Rp=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),zp=`Tabs`,[Bp,Vp]=pn(zp,[el]),Hp=el(),[Up,Wp]=Bp(zp),Gp=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Wn(s),[d,f]=vn({prop:r,onChange:i,defaultProp:a??``,caller:zp});return(0,C.jsx)(Up,{scope:n,baseId:kn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,C.jsx)(Rp.div,{dir:u,"data-orientation":o,...l,ref:t})})});Gp.displayName=zp;var Kp=`TabsList`,qp=b.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Wp(Kp,n),o=Hp(n);return(0,C.jsx)(fl,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,C.jsx)(Rp.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});qp.displayName=Kp;var Jp=`TabsTrigger`,Yp=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Wp(Jp,n),s=Hp(n),c=Qp(o.baseId,r),l=$p(o.baseId,r),u=r===o.value;return(0,C.jsx)(pl,{asChild:!0,...s,focusable:!i,active:u,children:(0,C.jsx)(Rp.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:R(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:R(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Yp.displayName=Jp;var Xp=`TabsContent`,Zp=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Wp(Xp,n),c=Qp(s.baseId,r),l=$p(s.baseId,r),u=r===s.value,d=b.useRef(u);return b.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,C.jsx)(Cn,{present:i||u,children:({present:n})=>(0,C.jsx)(Rp.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Zp.displayName=Xp;function Qp(e,t){return`${e}-trigger-${t}`}function $p(e,t){return`${e}-content-${t}`}var em=Gp,tm=qp,nm=Yp,rm=Zp,im=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),[am,om]=pn(`Tooltip`,[wc]),sm=wc(),cm=`TooltipProvider`,lm=700,um=`tooltip.open`,[dm,fm]=am(cm),pm=e=>{let{__scopeTooltip:t,delayDuration:n=lm,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,C.jsx)(dm,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};pm.displayName=cm;var mm=`Tooltip`,[hm,gm]=am(mm),_m=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=fm(mm,e.__scopeTooltip),l=sm(t),[u,d]=b.useState(null),f=kn(),p=b.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=b.useRef(!1),[_,v]=vn({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(um))):c.onClose(),a?.(e)},caller:mm}),y=b.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),x=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),S=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),w=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return b.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,C.jsx)(Bc,{...l,children:(0,C.jsx)(hm,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?w():x()},[c.isOpenDelayedRef,w,x]),onTriggerLeave:b.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};_m.displayName=mm;var vm=`TooltipTrigger`,ym=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=gm(vm,n),a=fm(vm,n),o=sm(n),s=Zt(t,b.useRef(null),i.onTriggerChange),c=b.useRef(!1),l=b.useRef(!1),u=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,C.jsx)(Vc,{asChild:!0,...o,children:(0,C.jsx)(im.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:R(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:R(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:R(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:R(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:R(e.onBlur,i.onClose),onClick:R(e.onClick,i.onClose)})})});ym.displayName=vm;var bm=`TooltipPortal`,[xm,Sm]=am(bm,{forceMount:void 0}),Cm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=gm(bm,t);return(0,C.jsx)(xm,{scope:t,forceMount:n,children:(0,C.jsx)(Cn,{present:n||a.open,children:(0,C.jsx)(Dr,{asChild:!0,container:i,children:r})})})};Cm.displayName=bm;var wm=`TooltipContent`,Tm=b.forwardRef((e,t)=>{let n=Sm(wm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=gm(wm,e.__scopeTooltip);return(0,C.jsx)(Cn,{present:r||o.open,children:o.disableHoverableContent?(0,C.jsx)(Am,{side:i,...a,ref:t}):(0,C.jsx)(Em,{side:i,...a,ref:t})})}),Em=b.forwardRef((e,t)=>{let n=gm(wm,e.__scopeTooltip),r=fm(wm,e.__scopeTooltip),i=b.useRef(null),a=Zt(t,i),[o,s]=b.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=b.useCallback(()=>{s(null),d(!1)},[d]),p=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Pm(r,Nm(r,n.getBoundingClientRect())),a=Fm(t.getBoundingClientRect());s(Lm([...i,...a])),d(!0)},[d]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Im(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,C.jsx)(Am,{...e,ref:a})}),[Dm,Om]=am(mm,{isInside:!1}),km=nn(`TooltipContent`),Am=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=gm(wm,n),l=sm(n),{onClose:u}=c;return b.useEffect(()=>(document.addEventListener(um,u),()=>document.removeEventListener(um,u)),[u]),b.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,C.jsx)(tr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,C.jsxs)(Hc,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,C.jsx)(km,{children:r}),(0,C.jsx)(Dm,{scope:n,isInside:!0,children:(0,C.jsx)(dn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Tm.displayName=wm;var jm=`TooltipArrow`,Mm=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=sm(n);return Om(jm,n).isInside?null:(0,C.jsx)(Uc,{...i,...r,ref:t})});Mm.displayName=jm;function Nm(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Pm(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Fm(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Im(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Lm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Rm(t)}function Rm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var zm=pm,Bm=_m,Vm=ym,Hm=Cm,Um=Tm,Wm=Mm;function Gm(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Gm(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Km(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Gm(e))&&(r&&(r+=` `),r+=t);return r}var qm=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Jm=(e,t)=>({classGroupId:e,validator:t}),Ym=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Xm=`-`,Zm=[],Qm=`arbitrary..`,$m=e=>{let t=nh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return th(e);let n=e.split(Xm);return eh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?qm(i,t):t:i||Zm}return n[e]||Zm}}},eh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=eh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Xm):e.slice(t).join(Xm),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},th=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Qm+r:void 0})(),nh=e=>{let{theme:t,classGroups:n}=e;return rh(n,t)},rh=(e,t)=>{let n=Ym();for(let r in e){let i=e[r];ih(i,n,r,t)}return n},ih=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];ah(i,t,n,r)}},ah=(e,t,n,r)=>{if(typeof e==`string`){oh(e,t,n);return}if(typeof e==`function`){sh(e,t,n,r);return}ch(e,t,n,r)},oh=(e,t,n)=>{let r=e===``?t:lh(t,e);r.classGroupId=n},sh=(e,t,n,r)=>{if(uh(e)){ih(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Jm(n,e))},ch=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ih(o,lh(t,a),n,r)}},lh=(e,t)=>{let n=e,r=t.split(Xm),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ym(),n.nextPart.set(t,i)),n=i}return n},uh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,dh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},fh=`!`,ph=`:`,mh=[],hh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),gh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===ph){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(fh)?(c=s.slice(0,-1),l=!0):s.startsWith(fh)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return hh(t,l,c,u)};if(t){let e=t+ph,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):hh(mh,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},_h=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},vh=e=>({cache:dh(e.cacheSize),parseClassName:gh(e),sortModifiers:_h(e),postfixLookupClassGroupIds:yh(e),...$m(e)}),yh=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},bh=/\s+/,xh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(bh),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+fh:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Sh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Ch(n))&&(i&&(i+=` `),i+=r);return i},Ch=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Ch(e[r]))&&(n&&(n+=` `),n+=t);return n},wh=(e,...t)=>{let n,r,i,a,o=o=>(n=vh(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=xh(e,n);return i(e,a),a};return a=o,(...e)=>a(Sh(...e))},Th=[],Eh=e=>{let t=t=>t[e]||Th;return t.isThemeGetter=!0,t},Dh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ah=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Nh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ph=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fh=e=>kh.test(e),U=e=>!!e&&!Number.isNaN(Number(e)),Ih=e=>!!e&&Number.isInteger(Number(e)),Lh=e=>e.endsWith(`%`)&&U(e.slice(0,-1)),Rh=e=>Ah.test(e),zh=()=>!0,Bh=e=>jh.test(e)&&!Mh.test(e),Vh=()=>!1,Hh=e=>Nh.test(e),Uh=e=>Ph.test(e),Wh=e=>!W(e)&&!G(e),Gh=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Kh=e=>sg(e,dg,Vh),W=e=>Dh.test(e),qh=e=>sg(e,fg,Bh),Jh=e=>sg(e,pg,U),Yh=e=>sg(e,hg,zh),Xh=e=>sg(e,mg,Vh),Zh=e=>sg(e,lg,Vh),Qh=e=>sg(e,ug,Uh),$h=e=>sg(e,gg,Hh),G=e=>Oh.test(e),eg=e=>cg(e,fg),tg=e=>cg(e,mg),ng=e=>cg(e,lg),rg=e=>cg(e,dg),ig=e=>cg(e,ug),ag=e=>cg(e,gg,!0),og=e=>cg(e,hg,!0),sg=(e,t,n)=>{let r=Dh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},cg=(e,t,n=!1)=>{let r=Oh.exec(e);return r?r[1]?t(r[1]):n:!1},lg=e=>e===`position`||e===`percentage`,ug=e=>e===`image`||e===`url`,dg=e=>e===`length`||e===`size`||e===`bg-size`,fg=e=>e===`length`,pg=e=>e===`number`,mg=e=>e===`family-name`,hg=e=>e===`number`||e===`weight`,gg=e=>e===`shadow`,_g=wh(()=>{let e=Eh(`color`),t=Eh(`font`),n=Eh(`text`),r=Eh(`font-weight`),i=Eh(`tracking`),a=Eh(`leading`),o=Eh(`breakpoint`),s=Eh(`container`),c=Eh(`spacing`),l=Eh(`radius`),u=Eh(`shadow`),d=Eh(`inset-shadow`),f=Eh(`text-shadow`),p=Eh(`drop-shadow`),m=Eh(`blur`),h=Eh(`perspective`),g=Eh(`aspect`),_=Eh(`ease`),v=Eh(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[Fh,`full`,`auto`,...w()],E=()=>[Ih,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,Ih,G,W]},Ih,G,W],O=()=>[Ih,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Fh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Fh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],te=()=>[Fh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,G,W],F=()=>[...b(),ng,Zh,{position:[G,W]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,rg,Kh,{size:[G,W]}],ie=()=>[Lh,eg,qh],ae=()=>[``,`none`,`full`,l,G,W],I=()=>[``,U,eg,qh],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[U,Lh,ng,Zh],le=()=>[``,`none`,m,G,W],ue=()=>[`none`,U,G,W],de=()=>[`none`,U,G,W],fe=()=>[U,G,W],pe=()=>[Fh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Rh],breakpoint:[Rh],color:[zh],container:[Rh],"drop-shadow":[Rh],ease:[`in`,`out`,`in-out`],font:[Wh],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Rh],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Rh],shadow:[Rh],spacing:[`px`,U],text:[Rh],"text-shadow":[Rh],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Fh,W,G,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,G,W]}],"container-named":[Gh],columns:[{columns:[U,W,G,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ih,`auto`,G,W]}],basis:[{basis:[Fh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[U,Fh,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,U,G,W]}],shrink:[{shrink:[``,U,G,W]}],order:[{order:[Ih,`first`,`last`,`none`,G,W]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...te()]}],"min-block-size":[{"min-block":[`auto`,...te()]}],"max-block-size":[{"max-block":[`none`,...te()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,eg,qh]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,og,Yh]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Lh,W]}],"font-family":[{font:[tg,Xh,t]}],"font-features":[{"font-features":[W]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,G,W]}],"line-clamp":[{"line-clamp":[U,`none`,G,Jh]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[U,`from-font`,`auto`,G,qh]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[U,`auto`,G,W]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Ih,G,W]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,G,W]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,G,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ih,G,W],radial:[``,G,W],conic:[Ih,G,W]},ig,Qh]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":I()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[U,G,W]}],"outline-w":[{outline:[``,U,eg,qh]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,ag,$h]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,ag,$h]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:I()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[U,qh]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,ag,$h]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[U,G,W]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[U]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[U]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:le()}],brightness:[{brightness:[U,G,W]}],contrast:[{contrast:[U,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ag,$h]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,U,G,W]}],"hue-rotate":[{"hue-rotate":[U,G,W]}],invert:[{invert:[``,U,G,W]}],saturate:[{saturate:[U,G,W]}],sepia:[{sepia:[``,U,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[U,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[U,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,U,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[U,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,U,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[U,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[U,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,U,G,W]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[U,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[U,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],zoom:[{zoom:[Ih,G,W]}],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,G,W]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,G,W]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[U,eg,qh,Jh]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function K(...e){return _g(Km(e))}function vg({delayDuration:e=0,...t}){return(0,C.jsx)(zm,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function yg({...e}){return(0,C.jsx)(Bm,{"data-slot":`tooltip`,...e})}function bg({...e}){return(0,C.jsx)(Vm,{"data-slot":`tooltip-trigger`,...e})}function xg({className:e,sideOffset:t=0,children:n,...r}){return(0,C.jsx)(Hm,{children:(0,C.jsxs)(Um,{"data-slot":`tooltip-content`,sideOffset:t,className:K(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,C.jsx)(Wm,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var Sg=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Cg=Km,wg=(e,t)=>n=>{if(t?.variants==null)return Cg(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Sg(t)||Sg(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Cg(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Tg=`(max-width: 767px)`;function Eg(){return window.matchMedia(Tg).matches}function Dg(){return!1}function Og(e){let t=window.matchMedia(Tg);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function kg(){return b.useSyncExternalStore(Og,Eg,Dg)}var Ag=wg(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow,transform] duration-150 ease-[var(--natroc-ease-out)] outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:scale-[0.98] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 motion-reduce:transition-colors motion-reduce:active:not-aria-[haspopup]:scale-100 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,C.jsx)(r?$t:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:K(Ag({variant:t,size:n,className:e})),...i})}function jg({className:e,type:t,...n}){return(0,C.jsx)(`input`,{type:t,"data-slot":`input`,className:K(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Mg({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,C.jsx)(Cp,{"data-slot":`separator`,decorative:n,orientation:t,className:K(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function Ng({...e}){return(0,C.jsx)(Aa,{"data-slot":`sheet`,...e})}function Pg({...e}){return(0,C.jsx)(ja,{"data-slot":`sheet-portal`,...e})}function Fg({className:e,...t}){return(0,C.jsx)(Ma,{"data-slot":`sheet-overlay`,className:K(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ig({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,C.jsxs)(Pg,{children:[(0,C.jsx)(Fg,{}),(0,C.jsxs)(Na,{"data-slot":`sheet-content`,"data-side":n,className:K(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,C.jsx)(Ia,{"data-slot":`sheet-close`,asChild:!0,children:(0,C.jsxs)(q,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,C.jsx)(qt,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Lg({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sheet-header`,className:K(`flex flex-col gap-0.5 p-4`,e),...t})}function Rg({className:e,...t}){return(0,C.jsx)(Pa,{"data-slot":`sheet-title`,className:K(`font-heading text-base font-medium text-foreground`,e),...t})}function zg({className:e,...t}){return(0,C.jsx)(Fa,{"data-slot":`sheet-description`,className:K(`text-sm text-muted-foreground`,e),...t})}var Bg=`sidebar_state`,Vg=3600*24*7,Hg=`16rem`,Ug=`18rem`,Wg=`3rem`,Gg=`b`,Kg=b.createContext(null);function qg(){let e=b.useContext(Kg);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Jg({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=kg(),[c,l]=b.useState(!1),[u,d]=b.useState(e),f=t??u,p=b.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Bg}=${t}; path=/; max-age=${Vg}`},[n,f]),m=b.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);b.useEffect(()=>{let e=e=>{e.key===Gg&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=b.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,C.jsx)(Kg.Provider,{value:g,children:(0,C.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Hg,"--sidebar-width-icon":Wg,...i},className:K(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Yg({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=qg();return n===`none`?(0,C.jsx)(`div`,{"data-slot":`sidebar`,className:K(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,C.jsx)(Ng,{open:l,onOpenChange:u,...o,children:(0,C.jsxs)(Ig,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Ug},side:e,children:[(0,C.jsxs)(Lg,{className:`sr-only`,children:[(0,C.jsx)(Rg,{children:`Sidebar`}),(0,C.jsx)(zg,{children:`Displays the mobile sidebar.`})]}),(0,C.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,C.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,C.jsx)(`div`,{"data-slot":`sidebar-gap`,className:K(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,C.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:K(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,C.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Xg({className:e,onClick:t,...n}){let{toggleSidebar:r}=qg();return(0,C.jsxs)(q,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:K(e),onClick:e=>{t?.(e),r()},...n,children:[(0,C.jsx)(kt,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Zg({className:e,...t}){return(0,C.jsx)(`main`,{"data-slot":`sidebar-inset`,className:K(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,e),...t})}function Qg({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:K(`flex flex-col gap-2 p-2`,e),...t})}function $g({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:K(`flex flex-col gap-2 p-2`,e),...t})}function e_({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:K(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function t_({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:K(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function n_({className:e,asChild:t=!1,...n}){return(0,C.jsx)(t?$t:`div`,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:K(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e),...n})}function r_({className:e,...t}){return(0,C.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:K(`flex w-full min-w-0 flex-col gap-0`,e),...t})}function i_({className:e,...t}){return(0,C.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:K(`group/menu-item relative`,e),...t})}var a_=wg(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function o_({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let s=e?$t:`button`,{isMobile:c,state:l}=qg(),u=(0,C.jsx)(s,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:K(a_({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,C.jsxs)(yg,{children:[(0,C.jsx)(bg,{asChild:!0,children:u}),(0,C.jsx)(xg,{side:`right`,align:`center`,hidden:l!==`collapsed`||c,...i})]})):u}function s_({className:e,asChild:t=!1,showOnHover:n=!1,...r}){return(0,C.jsx)(t?$t:`button`,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:K(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,e),...r})}function c_({className:e,...t}){return(0,C.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:K(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,e),...t})}function l_({className:e,...t}){return(0,C.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:K(`group/menu-sub-item relative`,e),...t})}function u_({asChild:e=!1,size:t=`md`,isActive:n=!1,className:r,...i}){return(0,C.jsx)(e?$t:`a`,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:K(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,r),...i})}function d_({className:e,...t}){return(0,C.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:K(e),...t})}function f_({className:e,...t}){return(0,C.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:K(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,e),...t})}function p_({className:e,...t}){return(0,C.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:K(`inline-flex items-center gap-1`,e),...t})}function m_({className:e,...t}){return(0,C.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:K(`font-normal text-foreground`,e),...t})}function h_({page:e}){return e?.title?(0,C.jsx)(d_,{children:(0,C.jsx)(f_,{children:(0,C.jsx)(p_,{children:(0,C.jsxs)(m_,{className:`flex items-center gap-2 [&>svg]:size-3.5`,children:[e.icon,e.title]})})})}):null}function g_({className:e,...t}){return(0,C.jsx)(`kbd`,{"data-slot":`kbd`,className:K(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function __({className:e,...t}){return(0,C.jsx)(`kbd`,{"data-slot":`kbd-group`,className:K(`inline-flex items-center gap-1`,e),...t})}function v_(){return(0,C.jsxs)(yg,{delayDuration:1e3,children:[(0,C.jsx)(bg,{asChild:!0,children:(0,C.jsx)(Xg,{})}),(0,C.jsxs)(xg,{className:`px-2 py-1`,side:`right`,children:[`Toggle Sidebar`,` `,(0,C.jsxs)(__,{children:[(0,C.jsx)(g_,{children:`⌘`}),(0,C.jsx)(g_,{children:`b`})]})]})]})}var y_={home:{id:`home`,path:`/`,title:`New Conversation`,icon:(0,C.jsx)(Et,{}),showInPrimaryNav:!1},projects:{id:`projects`,path:`/projects`,title:`Projects`,icon:(0,C.jsx)(ut,{}),showInPrimaryNav:!0},config:{id:`config`,path:`/config`,title:`Config`,icon:(0,C.jsx)(Rt,{}),showInPrimaryNav:!0},account:{id:`account`,path:`/account`,title:`Account Settings`,icon:(0,C.jsx)(Gt,{}),showInPrimaryNav:!1}},b_=Object.values(y_).filter(e=>e.showInPrimaryNav);function x_(e){return e===`/agent`?y_.config:Object.values(y_).find(t=>t.path===e)??null}function S_(e,t){return e===y_.home.path&&!t.startsWith(`#/chat/`)}function C_({className:e,size:t=`default`,...n}){return(0,C.jsx)(eo,{"data-slot":`avatar`,"data-size":t,className:K(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function w_({className:e,...t}){return(0,C.jsx)(to,{"data-slot":`avatar-image`,className:K(`aspect-square size-full rounded-full object-cover`,e),...t})}function T_({className:e,...t}){return(0,C.jsx)(no,{"data-slot":`avatar-fallback`,className:K(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function E_({...e}){return(0,C.jsx)(kd,{"data-slot":`dropdown-menu`,...e})}function D_({...e}){return(0,C.jsx)(H,{"data-slot":`dropdown-menu-trigger`,...e})}function O_({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,C.jsx)(Ad,{children:(0,C.jsx)(jd,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:K(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function k_({...e}){return(0,C.jsx)(Md,{"data-slot":`dropdown-menu-group`,...e})}function A_({className:e,inset:t,variant:n=`default`,...r}){return(0,C.jsx)(Pd,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:K(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function j_({...e}){return(0,C.jsx)(Fd,{"data-slot":`dropdown-menu-radio-group`,...e})}function M_({className:e,children:t,inset:n,...r}){return(0,C.jsxs)(Id,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:K(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,C.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,C.jsx)(Ld,{children:(0,C.jsx)(Je,{})})}),t]})}function N_({className:e,inset:t,...n}){return(0,C.jsx)(Nd,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:K(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function P_({className:e,...t}){return(0,C.jsx)(Rd,{"data-slot":`dropdown-menu-separator`,className:K(`-mx-1 my-1 h-px bg-border`,e),...t})}var F_=`natroc:token`;function I_(){try{return localStorage.getItem(F_)}catch{return null}}function L_(e){try{localStorage.setItem(F_,e)}catch{}}function R_(){try{localStorage.removeItem(F_)}catch{}}function z_(){return!!I_()}var B_=1,V_=class extends Error{code;constructor(e,t){super(e),this.name=`GatewayError`,this.code=t}};function H_(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/gateway`}function U_(e){return e instanceof V_?e:new V_(e instanceof Error?e.message:`Gateway request failed.`)}function W_(e){return new V_(e?.message??`Gateway request failed.`,e?.code)}function G_(){R_(),typeof window<`u`&&window.location.pathname!==`/login`&&window.location.assign(`/login`)}var J=new class{socket=null;connecting=null;pending=new Map;streams=new Map;broadcastListeners=new Map;lastSeqByEvent=new Map;async call(e,t){return await this.connect(),new Promise((n,r)=>{let i=crypto.randomUUID();this.pending.set(i,{resolve:e=>n(e),reject:r}),this.transmit({type:`req`,id:i,method:e,params:t})})}stream(e,t,n){let r=crypto.randomUUID(),i=!1;return this.connect().then(()=>{i||(this.streams.set(r,n),this.transmit({type:`req`,id:r,method:e,params:t}))},e=>n.onError(U_(e))),()=>{i=!0,this.streams.has(r)&&(this.streams.delete(r),this.transmit({type:`cancel`,id:r}))}}on(e,t){let n=this.broadcastListeners.get(e);return n||(n=new Set,this.broadcastListeners.set(e,n)),n.add(t),()=>{n?.delete(t)}}connect(){return this.socket?.readyState===WebSocket.OPEN&&this.connecting===null?Promise.resolve():(this.connecting||=new Promise((e,t)=>{let n=new WebSocket(H_());this.socket=n;let r=I_(),i=!!r,a=crypto.randomUUID();this.pending.set(a,{resolve:n=>{if(i&&n?.auth?.ok===!1){G_();let e=new V_(`Session is invalid or expired.`,`unauthenticated`);this.connecting=null,t(e);return}this.connecting=null,e()},reject:e=>{this.connecting=null,t(e)}}),n.addEventListener(`open`,()=>{this.transmit({type:`connect`,id:a,params:{protocol:B_,auth:r?{token:r}:void 0,client:{id:`natroc-web`,mode:`ui`,version:`0.0.1`}}})}),n.addEventListener(`message`,e=>{this.handleFrame(e.data)}),n.addEventListener(`close`,()=>{this.handleClose()})}),this.connecting)}transmit(e){this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify(e))}handleFrame(e){if(typeof e!=`string`)return;let t;try{t=JSON.parse(e)}catch{return}if(t.type===`res`){!t.ok&&t.error?.code===`unauthenticated`&&G_();let e=this.pending.get(t.id);if(e){this.pending.delete(t.id),t.ok?e.resolve(t.payload):e.reject(W_(t.error));return}let n=this.streams.get(t.id);n&&(this.streams.delete(t.id),t.ok?n.onEnd(t.payload):n.onError(W_(t.error)));return}if(t.type===`event`){if(t.id){this.streams.get(t.id)?.onEvent(t.payload);return}let e=this.broadcastListeners.get(t.event);if(!e||e.size===0)return;let n=this.lastSeqByEvent.get(t.event),r=t.seq,i=n!==void 0&&r!==void 0&&r>n+1;r!==void 0&&this.lastSeqByEvent.set(t.event,r);let a={seq:r,stateVersion:t.stateVersion,gap:i};for(let n of e)n(t.payload,a);return}}handleClose(){this.socket=null,this.connecting=null;let e=new V_(`Gateway connection closed.`,`connection_closed`);for(let t of this.pending.values())t.reject(e);this.pending.clear();for(let t of this.streams.values())t.onError(e);this.streams.clear()}};function K_(e,t){return J.call(`auth.login`,{username:e,password:t})}function q_(e){return J.call(`auth.register`,e)}async function J_(){if(!I_())return null;try{return(await J.call(`auth.me`)).user}catch{return null}}async function Y_(){if(I_())try{await J.call(`auth.logout`)}catch{}}function X_(e){return J.call(`auth.updatePassword`,e)}function Z_(e){return J.call(`auth.updateAvatar`,e)}function Q_(){let[e,t]=(0,b.useState)({name:`Natroc user`,handle:``,avatarUrl:null});(0,b.useEffect)(()=>{let e=!0,n=e=>{t({name:e.fullName,handle:`@${e.username}`,avatarUrl:e.avatarUrl})};J_().then(t=>{e&&t&&n(t)});let r=e=>{let t=e;t.detail&&n(t.detail)};return window.addEventListener(`natroc:user-updated`,r),()=>{e=!1,window.removeEventListener(`natroc:user-updated`,r)}},[]);let n=async()=>{await Y_(),R_(),window.location.assign(`/login`)},r=e.name.trim().charAt(0).toUpperCase()||`N`;return(0,C.jsxs)(E_,{children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsxs)(C_,{className:`size-8`,children:[e.avatarUrl&&(0,C.jsx)(w_,{src:e.avatarUrl,alt:e.name}),(0,C.jsx)(T_,{children:r})]})}),(0,C.jsxs)(O_,{align:`end`,className:`w-60`,children:[(0,C.jsx)(A_,{className:`flex items-center justify-start gap-2`,children:(0,C.jsxs)(N_,{className:`flex items-center gap-3`,children:[(0,C.jsxs)(C_,{className:`size-10`,children:[e.avatarUrl&&(0,C.jsx)(w_,{src:e.avatarUrl,alt:e.name}),(0,C.jsx)(T_,{children:r})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),` `,(0,C.jsx)(`br`,{}),(0,C.jsx)(`div`,{className:`max-w-full overflow-hidden text-xs overflow-ellipsis whitespace-nowrap text-muted-foreground`,children:e.handle})]})]})}),(0,C.jsx)(P_,{}),(0,C.jsx)(k_,{children:(0,C.jsxs)(A_,{onSelect:()=>window.location.assign(y_.account.path),children:[(0,C.jsx)(Gt,{}),`Account Settings`]})}),(0,C.jsx)(P_,{}),(0,C.jsxs)(k_,{children:[(0,C.jsxs)(A_,{children:[(0,C.jsx)(Ue,{}),`Notifications`]}),(0,C.jsxs)(A_,{children:[(0,C.jsx)(nt,{}),`Keyboard shortcuts`]})]}),(0,C.jsx)(P_,{}),(0,C.jsxs)(k_,{children:[(0,C.jsxs)(A_,{children:[(0,C.jsx)(yt,{}),`Help center`]}),(0,C.jsxs)(A_,{children:[(0,C.jsx)(ft,{}),`Agent training`]})]}),(0,C.jsx)(P_,{}),(0,C.jsx)(k_,{children:(0,C.jsxs)(A_,{children:[(0,C.jsx)(rt,{}),`Subscription`]})}),(0,C.jsx)(P_,{}),(0,C.jsx)(k_,{children:(0,C.jsxs)(A_,{className:`w-full cursor-pointer`,variant:`destructive`,onSelect:()=>{n()},children:[(0,C.jsx)(wt,{}),`Log out`]})})]})]})}var $_=({size:e=24,style:t,...n})=>(0,C.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,width:e,height:e,style:{width:e,height:e,minWidth:e,minHeight:e,...t},...n,children:[(0,C.jsx)(`title`,{children:`Github`}),(0,C.jsx)(`path`,{d:`M12 0c6.63 0 12 5.276 12 11.79-.001 5.067-3.29 9.567-8.175 11.187-.6.118-.825-.25-.825-.56 0-.398.015-1.665.015-3.242 0-1.105-.375-1.813-.81-2.181 2.67-.295 5.475-1.297 5.475-5.822 0-1.297-.465-2.344-1.23-3.169.12-.295.54-1.503-.12-3.125 0 0-1.005-.324-3.3 1.209a11.32 11.32 0 00-3-.398c-1.02 0-2.04.133-3 .398-2.295-1.518-3.3-1.209-3.3-1.209-.66 1.622-.24 2.83-.12 3.125-.765.825-1.23 1.887-1.23 3.169 0 4.51 2.79 5.527 5.46 5.822-.345.294-.66.81-.765 1.577-.69.31-2.415.81-3.495-.973-.225-.354-.9-1.223-1.845-1.209-1.005.015-.405.56.015.781.51.28 1.095 1.327 1.23 1.666.24.663 1.02 1.93 4.035 1.385 0 .988.015 1.916.015 2.196 0 .31-.225.664-.825.56C3.303 21.374-.003 16.867 0 11.791 0 5.276 5.37 0 12 0z`})]}),ev=({size:e=24,style:t,...n})=>(0,C.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,width:e,height:e,style:{width:e,height:e,minWidth:e,minHeight:e,...t},...n,children:[(0,C.jsx)(`title`,{children:`Ollama`}),(0,C.jsx)(`path`,{d:`M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z`})]}),tv=({size:e=24,style:t,...n})=>(0,C.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,width:e,height:e,style:{width:e,height:e,minWidth:e,minHeight:e,...t},...n,children:[(0,C.jsx)(`title`,{children:`OpenRouter`}),(0,C.jsx)(`path`,{d:`M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z`})]});function nv({...e}){return(0,C.jsx)(Aa,{"data-slot":`dialog`,...e})}function rv({...e}){return(0,C.jsx)(ja,{"data-slot":`dialog-portal`,...e})}function iv({...e}){return(0,C.jsx)(Ia,{"data-slot":`dialog-close`,...e})}function av({className:e,...t}){return(0,C.jsx)(Ma,{"data-slot":`dialog-overlay`,className:K(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function ov({className:e,children:t,showCloseButton:n=!0,...r}){return(0,C.jsxs)(rv,{children:[(0,C.jsx)(av,{}),(0,C.jsxs)(Na,{"data-slot":`dialog-content`,className:K(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,C.jsx)(Ia,{"data-slot":`dialog-close`,asChild:!0,children:(0,C.jsxs)(q,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,C.jsx)(qt,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function sv({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`dialog-header`,className:K(`flex flex-col gap-2`,e),...t})}function cv({className:e,showCloseButton:t=!1,children:n,...r}){return(0,C.jsxs)(`div`,{"data-slot":`dialog-footer`,className:K(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,C.jsx)(Ia,{asChild:!0,children:(0,C.jsx)(q,{variant:`outline`,children:`Close`})})]})}function lv({className:e,...t}){return(0,C.jsx)(Pa,{"data-slot":`dialog-title`,className:K(`font-heading text-base leading-none font-medium`,e),...t})}function uv({className:e,...t}){return(0,C.jsx)(Fa,{"data-slot":`dialog-description`,className:K(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function dv({className:e,...t}){return(0,C.jsx)(`textarea`,{"data-slot":`textarea`,className:K(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function fv({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:K(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var pv=wg(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function mv({className:e,align:t=`inline-start`,...n}){return(0,C.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:K(pv({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var hv=wg(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function gv({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,C.jsx)(q,{type:t,"data-size":r,variant:n,className:K(hv({size:r}),e),...i})}function _v({className:e,...t}){return(0,C.jsx)(jg,{"data-slot":`input-group-control`,className:K(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function vv({className:e,...t}){return(0,C.jsx)(Hd,{"data-slot":`label`,className:K(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function yv({...e}){return(0,C.jsx)(ap,{"data-slot":`select`,...e})}function bv({...e}){return(0,C.jsx)(sp,{"data-slot":`select-value`,...e})}function xv({className:e,size:t=`default`,children:n,...r}){return(0,C.jsxs)(op,{"data-slot":`select-trigger`,"data-size":t,className:K(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,C.jsx)(cp,{asChild:!0,children:(0,C.jsx)(Ye,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Sv({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,C.jsx)(lp,{children:(0,C.jsxs)(up,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:K(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,C.jsx)(wv,{}),(0,C.jsx)(dp,{"data-position":n,className:K(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,C.jsx)(Tv,{})]})})}function Cv({className:e,children:t,...n}){return(0,C.jsxs)(fp,{"data-slot":`select-item`,className:K(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,C.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,C.jsx)(mp,{children:(0,C.jsx)(Je,{className:`pointer-events-none`})})}),(0,C.jsx)(pp,{children:t})]})}function wv({className:e,...t}){return(0,C.jsx)(hp,{"data-slot":`select-scroll-up-button`,className:K(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,C.jsx)(Ze,{})})}function Tv({className:e,...t}){return(0,C.jsx)(gp,{"data-slot":`select-scroll-down-button`,className:K(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,C.jsx)(Ye,{})})}var Ev=`http://127.0.0.1:11434`,Dv=`https://openrouter.ai/api/v1`,Ov=[{value:`ollama`,label:`Ollama`,Icon:ev},{value:`openrouter`,label:`OpenRouter`,Icon:tv}];function kv(){let[e,t]=(0,b.useState)(!1),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)([]),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(``),[m,h]=(0,b.useState)(``),[g,_]=(0,b.useState)(!1),[v,y]=(0,b.useState)(null),x=c.find(e=>e.isActive);(0,b.useEffect)(()=>{let e=!0;return Av().then(t=>{e&&l(t)}),()=>{e=!1}},[]);let S=async()=>{l(await Av())},w=()=>{r(``),a(``),s(``),d(``),p(``)},T=e=>{t(e),e||w()},E=e=>{let t=e;r(t),a(t===`ollama`?Ev:Dv),s(``),d(``),p(``)},D=n===`ollama`,O=n===`openrouter`,k=!!n&&!g&&(D||O&&o.trim().length>0),A=async()=>{if(!(!n||!k)){_(!0),d(``),p(``);try{n===`ollama`?await J.call(`providers.connectOllama`,{baseUrl:i.trim()}):await J.call(`providers.connectOpenRouter`,{apiKey:o.trim(),baseUrl:i.trim()}),await S(),d(`${O?`OpenRouter`:`Ollama`} connected and active.`),window.dispatchEvent(new Event(`natroc:provider-updated`))}catch(e){p(e instanceof Error?e.message:`Failed to connect provider.`)}finally{_(!1)}}},j=async e=>{if(!v){y(e),h(``);try{await J.call(`providers.setActive`,{providerId:e}),await S(),window.dispatchEvent(new Event(`natroc:provider-updated`))}catch(e){h(e instanceof Error?e.message:`Failed to switch provider.`)}finally{y(null)}}};return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(E_,{children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsxs)(q,{variant:`outline`,size:`sm`,children:[x?.displayName??`Select provider`,(0,C.jsx)(Ye,{className:`text-muted-foreground`})]})}),(0,C.jsxs)(O_,{align:`start`,className:`w-56`,children:[(0,C.jsx)(N_,{children:`Your providers`}),c.length>0?c.map(e=>(0,C.jsxs)(A_,{disabled:e.isActive||!!v,onSelect:()=>{j(e.id)},children:[(0,C.jsx)(`span`,{children:e.displayName}),v===e.id?(0,C.jsx)(`span`,{className:`natroc-soft-panel ml-auto text-xs text-muted-foreground`,children:`Switching...`}):e.isActive?(0,C.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`Active`}):(0,C.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`Switch`})]},e.id)):(0,C.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No providers connected yet.`}),m&&(0,C.jsx)(`div`,{className:`px-2 py-2 text-xs text-destructive`,children:m}),(0,C.jsx)(P_,{}),(0,C.jsxs)(A_,{onSelect:()=>t(!0),children:[(0,C.jsx)(Pt,{}),`Add Provider`]})]})]}),(0,C.jsx)(nv,{open:e,onOpenChange:T,children:(0,C.jsxs)(ov,{className:`sm:max-w-md`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-1.5 pr-6`,children:[(0,C.jsx)(lv,{children:`Add a new provider`}),(0,C.jsx)(uv,{children:`Pick a provider to connect to Natroc. You can manage and switch between them later from the topbar.`})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`provider`,children:`Provider`}),(0,C.jsxs)(yv,{value:n,onValueChange:E,children:[(0,C.jsx)(xv,{id:`provider`,className:`w-full`,children:(0,C.jsx)(bv,{placeholder:`Select a provider...`})}),(0,C.jsx)(Sv,{children:Ov.map(({value:e,label:t,Icon:n})=>(0,C.jsxs)(Cv,{value:e,children:[(0,C.jsx)(n,{size:16}),t]},e))})]})]}),n&&(0,C.jsxs)(`div`,{className:`natroc-soft-panel flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`base-url`,children:`Base URL`}),(0,C.jsx)(fv,{children:(0,C.jsx)(_v,{id:`base-url`,placeholder:D?Ev:Dv,value:i,onChange:e=>a(e.target.value)})}),D&&(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Leave empty to use the default`,` `,(0,C.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[0.7rem]`,children:Ev}),`.`]})]}),O&&(0,C.jsxs)(`div`,{className:`natroc-soft-panel flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`api-key`,children:`API Key`}),(0,C.jsx)(jg,{id:`api-key`,type:`password`,placeholder:`sk-or-v1-...`,autoComplete:`off`,value:o,onChange:e=>s(e.target.value)})]}),u&&(0,C.jsx)(`p`,{className:`natroc-soft-panel rounded-md border border-green-500/20 bg-green-500/10 px-3 py-2 text-xs text-green-700 dark:text-green-300`,children:u}),f&&(0,C.jsx)(`p`,{className:`natroc-soft-panel rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:f})]}),(0,C.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,C.jsx)(iv,{asChild:!0,children:(0,C.jsx)(q,{variant:`outline`,children:`Close`})}),(0,C.jsx)(q,{onClick:A,disabled:!k,children:g?`Connecting...`:`Connect provider`})]})]})})]})}async function Av(){try{return(await J.call(`providers.list`)).providers??[]}catch{return[]}}function jv(){let e=x_(window.location.pathname);return(0,C.jsxs)(`header`,{className:K(`sticky top-0 z-50 flex h-14 shrink-0 items-center justify-between gap-2 border-b px-4 md:px-6`),children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(v_,{}),(0,C.jsx)(kv,{}),(0,C.jsx)(Mg,{className:`mr-2 h-4 data-[orientation=vertical]:self-center`,orientation:`vertical`}),(0,C.jsx)(h_,{page:e})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(q,{size:`icon-sm`,variant:`outline`,children:(0,C.jsx)(Lt,{})}),(0,C.jsx)(q,{"aria-label":`Notifications`,size:`icon-sm`,variant:`outline`,children:(0,C.jsx)(Ue,{})}),(0,C.jsx)(Mg,{className:`h-4 data-[orientation=vertical]:self-center`,orientation:`vertical`}),(0,C.jsx)(Q_,{})]})]})}var Mv={x:50,y:120,w:397,h:248},Nv=Mv.h/Mv.w,Pv=({size:e=24,style:t,...n})=>{let r=e,i=e*Nv;return(0,C.jsx)(`svg`,{version:`1.0`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`${Mv.x} ${Mv.y} ${Mv.w} ${Mv.h}`,preserveAspectRatio:`xMidYMid meet`,width:r,height:i,style:{width:r,height:i,minWidth:r,minHeight:i,...t},...n,children:(0,C.jsxs)(`g`,{transform:`translate(0.000000,500.000000) scale(0.100000,-0.100000)`,fill:`currentColor`,stroke:`none`,children:[(0,C.jsx)(`path`,{d:`M605 3748 c61 -22 189 -69 285 -105 634 -233 736 -301 1270 -847 329 -335 592 -599 680 -681 247 -228 563 -433 995 -644 127 -62 295 -141 301 -141 15 0 -497 676 -546 720 -3 3 -55 61 -117 130 -170 191 -392 406 -714 691 -381 338 -415 366 -534 444 -108 71 -195 117 -287 154 -70 28 -289 88 -408 111 -25 5 -76 17 -115 25 -236 53 -886 185 -905 184 -8 0 35 -18 95 -41z`}),(0,C.jsx)(`path`,{d:`M4385 3760 c-118 -32 -415 -136 -556 -196 -245 -103 -345 -160 -417 -238 -67 -72 -72 -104 -72 -440 0 -331 0 -327 85 -426 117 -134 255 -318 327 -434 l38 -61 0 522 c0 317 4 552 11 599 38 273 195 452 553 630 138 68 142 74 31 44z`}),(0,C.jsx)(`path`,{d:`M1290 2633 c0 -381 -4 -653 -11 -708 -19 -161 -61 -291 -134 -419 -25 -44 -43 -81 -41 -84 3 -2 20 7 38 20 364 266 514 417 579 587 20 50 22 79 26 281 2 124 9 244 14 267 39 151 200 110 529 -134 96 -71 -466 452 -614 572 -150 120 -333 235 -376 235 -7 0 -10 -208 -10 -617z`})]})})};function Fv({...e}){return(0,C.jsx)(Hn,{"data-slot":`collapsible`,...e})}function Iv({...e}){return(0,C.jsx)(Ln,{"data-slot":`collapsible-trigger`,...e})}function Lv({...e}){return(0,C.jsx)(zn,{"data-slot":`collapsible-content`,...e})}function Rv({label:e,items:t}){return(0,C.jsxs)(t_,{children:[e&&(0,C.jsx)(n_,{children:e}),(0,C.jsx)(r_,{children:t.map(e=>(0,C.jsx)(Fv,{asChild:!0,className:`group/collapsible`,defaultOpen:!!e.isActive||e.subItems?.some(e=>!!e.isActive),children:(0,C.jsx)(i_,{children:e.subItems?.length?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Iv,{asChild:!0,children:(0,C.jsxs)(o_,{isActive:e.isActive,children:[e.icon,(0,C.jsx)(`span`,{children:e.title}),(0,C.jsx)(Xe,{className:`ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,C.jsx)(Lv,{children:(0,C.jsx)(c_,{children:e.subItems?.map(e=>(0,C.jsx)(l_,{children:(0,C.jsx)(u_,{asChild:!0,isActive:e.isActive,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})},e.title))})})]}):(0,C.jsx)(o_,{asChild:!0,isActive:e.isActive,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})})},e.title))})]})}var zv=[],Bv=[{title:`Github`,path:`https://github.com/licentora/natroc`,icon:(0,C.jsx)($_,{size:16})},{title:`System status`,path:`#/status`,icon:(0,C.jsx)(ze,{})}];[...zv.flatMap(e=>e.items.flatMap(e=>e.subItems?.length?[e,...e.subItems]:[e])),...Bv];var Vv={badge:`NEW`,title:`Smarter queue triage`,description:`One-click triage for your queue.`,readMore:{href:`#`,label:`Release notes`}};function Hv(){let[e,t]=(0,b.useState)(!0);return e?(0,C.jsxs)(`div`,{className:K(`group/latest-change size-full min-h-27 justify-center rounded-lg border bg-background`,`relative flex size-full flex-col gap-1 overflow-hidden px-4 pt-3 pb-1 *:text-nowrap`,`transition-opacity group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:opacity-0`),children:[(0,C.jsx)(`span`,{className:`font-mono text-[10px] font-light text-muted-foreground`,children:Vv.badge}),(0,C.jsx)(`p`,{className:`text-xs font-medium`,children:Vv.title}),(0,C.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:Vv.description}),(0,C.jsx)(q,{asChild:!0,className:`w-max px-0 text-xs font-light`,size:`sm`,variant:`link`,children:(0,C.jsx)(`a`,{href:Vv.readMore.href,children:Vv.readMore.label})}),(0,C.jsxs)(q,{className:`absolute top-2 right-2 z-10 size-6 rounded-full opacity-0 transition-opacity group-hover/latest-change:opacity-100`,onClick:()=>t(!1),size:`icon-sm`,variant:`ghost`,children:[(0,C.jsx)(qt,{className:`size-3.5 text-muted-foreground`}),` `]})]}):null}function Uv({chat:e,onDelete:t,onSelect:n}){let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{if(!a)return;let n=n=>{(n.key===`y`||n.key===`Y`)&&(n.preventDefault(),t?.(e.id),o(!1))};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[a,e.id,t]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(i_,{children:[(0,C.jsx)(o_,{asChild:!0,tooltip:e.title,children:(0,C.jsx)(`a`,{href:`#/chat/${e.id}`,onClick:t=>{t.preventDefault(),n?.(e.id)},children:(0,C.jsx)(`span`,{className:`truncate`,children:e.title})})}),(0,C.jsxs)(E_,{open:r,onOpenChange:i,children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsx)(s_,{showOnHover:!0,"aria-label":`More options`,children:(0,C.jsx)(at,{})})}),(0,C.jsxs)(O_,{side:`right`,align:`start`,className:`w-44`,children:[(0,C.jsxs)(A_,{children:[(0,C.jsx)(lt,{}),(0,C.jsx)(`span`,{children:`Move to Project`})]}),(0,C.jsx)(P_,{}),(0,C.jsxs)(A_,{variant:`destructive`,onSelect:e=>{e.preventDefault(),i(!1),o(!0)},children:[(0,C.jsx)(Ht,{}),(0,C.jsx)(`span`,{children:`Delete`})]})]})]})]}),(0,C.jsx)(nv,{open:a,onOpenChange:o,children:(0,C.jsxs)(ov,{className:`max-w-md`,showCloseButton:!1,children:[(0,C.jsxs)(sv,{children:[(0,C.jsx)(lv,{children:`Delete chat?`}),(0,C.jsxs)(uv,{children:[`This will permanently delete`,` `,(0,C.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`"`,e.title,`"`]}),`. This action cannot be undone.`]})]}),(0,C.jsxs)(cv,{children:[(0,C.jsxs)(q,{variant:`outline`,onClick:()=>o(!1),children:[`Cancel`,(0,C.jsx)(g_,{className:`ml-1`,children:`Esc`})]}),(0,C.jsxs)(q,{variant:`destructive`,onClick:()=>{t?.(e.id),o(!1)},children:[`Yes, delete`,(0,C.jsx)(g_,{className:`ml-1`,children:`Y`})]})]})]})})]})}function Wv(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!0),i=window.location.pathname,a=window.location.hash,o=S_(i,a),s=(0,b.useCallback)(async()=>{r(!0);try{t(await Gv())}finally{r(!1)}},[]);(0,b.useEffect)(()=>{let e=!0;Gv().then(n=>{e&&t(n)}).finally(()=>{e&&r(!1)});let n=()=>{s()};return window.addEventListener(`natroc:conversation-updated`,n),()=>{e=!1,window.removeEventListener(`natroc:conversation-updated`,n)}},[s]);let c=async e=>{try{await J.call(`conversations.delete`,{conversationId:e})}catch{return}t(t=>t.filter(t=>t.id!==e)),window.dispatchEvent(new Event(`natroc:conversation-updated`))},l=e=>{if(i!==y_.home.path){window.location.assign(`/#/chat/${e}`);return}window.history.replaceState(null,``,`#/chat/${e}`),window.dispatchEvent(new CustomEvent(`natroc:conversation-selected`,{detail:{id:e}}))};return(0,C.jsxs)(Yg,{collapsible:`icon`,variant:`inset`,children:[(0,C.jsx)(Qg,{className:`h-14 justify-center`,children:(0,C.jsx)(o_,{asChild:!0,className:`h-auto`,children:(0,C.jsxs)(`a`,{href:`/`,children:[(0,C.jsx)(Pv,{size:24}),(0,C.jsx)(`span`,{className:`font-medium`,children:`Natroc`})]})})}),(0,C.jsxs)(e_,{children:[(0,C.jsx)(t_,{children:(0,C.jsxs)(r_,{children:[(0,C.jsx)(i_,{children:(0,C.jsxs)(o_,{onClick:()=>{if(i!==y_.home.path){window.location.assign(y_.home.path);return}window.history.replaceState(null,``,y_.home.path),window.dispatchEvent(new Event(`natroc:new-conversation`))},isActive:o,className:K(`w-full duration-200 ease-linear`,o?`bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),tooltip:y_.home.title,children:[y_.home.icon,(0,C.jsx)(`span`,{children:y_.home.title})]})}),b_.map(e=>(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{asChild:!0,isActive:i===e.path,tooltip:e.title,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})},e.id))]})}),zv.map((e,t)=>(0,C.jsx)(Rv,{...e},`sidebar-group-${t}`)),(0,C.jsxs)(t_,{className:`group-data-[collapsible=icon]:hidden`,children:[(0,C.jsx)(n_,{children:`Recents`}),(0,C.jsxs)(r_,{children:[n&&e.length===0&&(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{disabled:!0,children:(0,C.jsx)(`span`,{children:`Loading chats...`})})}),!n&&e.length===0&&(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{disabled:!0,children:(0,C.jsx)(`span`,{children:`No recent chats`})})}),e.map(e=>(0,C.jsx)(Uv,{chat:e,onDelete:c,onSelect:l},e.id))]})]})]}),(0,C.jsxs)($g,{children:[(0,C.jsx)(Hv,{}),(0,C.jsx)(r_,{className:`mt-2`,children:Bv.map(e=>(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{asChild:!0,className:`text-muted-foreground`,isActive:e.isActive,size:`sm`,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})},e.title))})]})]})}async function Gv(){try{return(await J.call(`conversations.list`)).conversations?.map(e=>({id:e.id,title:e.title,updatedAt:e.updatedAt}))??[]}catch{return[]}}function Kv({children:e}){return(0,C.jsx)(`div`,{className:`overflow-hidden`,children:(0,C.jsxs)(Jg,{className:`relative h-svh`,children:[(0,C.jsx)(Wv,{}),(0,C.jsxs)(Zg,{className:`md:peer-data-[variant=inset]:ml-0`,children:[(0,C.jsx)(jv,{}),(0,C.jsx)(`div`,{className:`flex flex-1 flex-col gap-4 overflow-y-auto p-4 md:p-6`,children:e})]})]})})}var qv=(0,b.createContext)({});function Jv(e){let t=(0,b.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Yv=typeof window<`u`?b.useLayoutEffect:b.useEffect,Xv=(0,b.createContext)(null);function Zv(e,t){e.indexOf(t)===-1&&e.push(t)}function Qv(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var $v=(e,t,n)=>n>t?t:n<e?e:n,ey={},ty=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),ny=e=>typeof e==`object`&&!!e,ry=e=>/^0[^.\s]+$/u.test(e);function iy(e){let t;return()=>(t===void 0&&(t=e()),t)}var ay=e=>e,oy=(...e)=>e.reduce((e,t)=>n=>t(e(n))),sy=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},cy=class{constructor(){this.subscriptions=[]}add(e){return Zv(this.subscriptions,e),()=>Qv(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},ly=e=>e*1e3,uy=e=>e/1e3,dy=(e,t)=>t?1e3/t*e:0,fy=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,py=1e-7,my=12;function hy(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=fy(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>py&&++s<my);return o}function gy(e,t,n,r){if(e===t&&n===r)return ay;let i=t=>hy(t,0,1,e,n);return e=>e===0||e===1?e:fy(i(e),t,r)}var _y=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vy=e=>t=>1-e(1-t),yy=gy(.33,1.53,.69,.99),by=vy(yy),xy=_y(by),Sy=e=>e>=1?1:(e*=2)<1?.5*by(e):.5*(2-2**(-10*(e-1))),Cy=e=>1-Math.sin(Math.acos(e)),wy=vy(Cy),Ty=_y(Cy),Ey=gy(.42,0,1,1),Dy=gy(0,0,.58,1),Oy=gy(.42,0,.58,1),ky=e=>Array.isArray(e)&&typeof e[0]!=`number`,Ay=e=>Array.isArray(e)&&typeof e[0]==`number`,jy={linear:ay,easeIn:Ey,easeInOut:Oy,easeOut:Dy,circIn:Cy,circInOut:Ty,circOut:wy,backIn:by,backInOut:xy,backOut:yy,anticipate:Sy},My=e=>typeof e==`string`,Ny=e=>{if(Ay(e)){e.length;let[t,n,r,i]=e;return gy(t,n,r,i)}else if(My(e))return jy[e],`${e}`,jy[e];return e},Py=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Fy={value:null,addProjectionMetrics:null};function Iy(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&Fy.value&&Fy.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Ly=40;function Ry(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Py.reduce((e,n)=>(e[n]=Iy(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=ey.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Ly),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Py.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Py.length;t++)o[Py[t]].cancel(e)},state:i,steps:o}}var{schedule:zy,cancel:By,state:Vy,steps:Hy}=Ry(typeof requestAnimationFrame<`u`?requestAnimationFrame:ay,!0),Uy;function Wy(){Uy=void 0}var Gy={now:()=>(Uy===void 0&&Gy.set(Vy.isProcessing||ey.useManualTiming?Vy.timestamp:performance.now()),Uy),set:e=>{Uy=e,queueMicrotask(Wy)}},Ky={layout:0,mainThread:0,waapi:0},qy=e=>t=>typeof t==`string`&&t.startsWith(e),Jy=qy(`--`),Yy=qy(`var(--`),Xy=e=>Yy(e)?Zy.test(e.split(`/*`)[0].trim()):!1,Zy=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Qy(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var $y={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},eb={...$y,transform:e=>$v(0,1,e)},tb={...$y,default:1},nb=e=>Math.round(e*1e5)/1e5,rb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ib(e){return e==null}var ab=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ob=(e,t)=>n=>!!(typeof n==`string`&&ab.test(n)&&n.startsWith(e)||t&&!ib(n)&&Object.prototype.hasOwnProperty.call(n,t)),sb=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(rb);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},cb=e=>$v(0,255,e),lb={...$y,transform:e=>Math.round(cb(e))},ub={test:ob(`rgb`,`red`),parse:sb(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+lb.transform(e)+`, `+lb.transform(t)+`, `+lb.transform(n)+`, `+nb(eb.transform(r))+`)`};function db(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var fb={test:ob(`#`),parse:db,transform:ub.transform},pb=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),mb=pb(`deg`),hb=pb(`%`),Y=pb(`px`),gb=pb(`vh`),_b=pb(`vw`),vb={...hb,parse:e=>hb.parse(e)/100,transform:e=>hb.transform(e*100)},yb={test:ob(`hsl`,`hue`),parse:sb(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+hb.transform(nb(t))+`, `+hb.transform(nb(n))+`, `+nb(eb.transform(r))+`)`},bb={test:e=>ub.test(e)||fb.test(e)||yb.test(e),parse:e=>ub.test(e)?ub.parse(e):yb.test(e)?yb.parse(e):fb.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?ub.transform(e):yb.transform(e),getAnimatableNone:e=>{let t=bb.parse(e);return t.alpha=0,bb.transform(t)}},xb=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Sb(e){return isNaN(e)&&typeof e==`string`&&(e.match(rb)?.length||0)+(e.match(xb)?.length||0)>0}var Cb=`number`,wb=`color`,Tb=`var`,Eb=`var(`,Db="${}",Ob=/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 kb(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Ob,e=>(bb.test(e)?(r.color.push(a),i.push(wb),n.push(bb.parse(e))):e.startsWith(Eb)?(r.var.push(a),i.push(Tb),n.push(e)):(r.number.push(a),i.push(Cb),n.push(parseFloat(e))),++a,Db)).split(Db),indexes:r,types:i}}function Ab(e){return kb(e).values}function jb({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Cb?i+=nb(r[a]):e===wb?i+=bb.transform(r[a]):i+=r[a]}return i}}function Mb(e){return jb(kb(e))}var Nb=e=>typeof e==`number`?0:bb.test(e)?bb.getAnimatableNone(e):e,Pb=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Nb(e);function Fb(e){let t=kb(e);return jb(t)(t.values.map((e,n)=>Pb(e,t.split[n])))}var Ib={test:Sb,parse:Ab,createTransformer:Mb,getAnimatableNone:Fb};function Lb(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Rb({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Lb(s,r,e+1/3),a=Lb(s,r,e),o=Lb(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function zb(e,t){return n=>n>0?t:e}var Bb=(e,t,n)=>e+(t-e)*n,Vb=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Hb=[fb,ub,yb],Ub=e=>Hb.find(t=>t.test(e));function Wb(e){let t=Ub(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===yb&&(n=Rb(n)),n}var Gb=(e,t)=>{let n=Wb(e),r=Wb(t);if(!n||!r)return zb(e,t);let i={...n};return e=>(i.red=Vb(n.red,r.red,e),i.green=Vb(n.green,r.green,e),i.blue=Vb(n.blue,r.blue,e),i.alpha=Bb(n.alpha,r.alpha,e),ub.transform(i))},Kb=new Set([`none`,`hidden`]);function qb(e,t){return Kb.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Jb(e,t){return n=>Bb(e,t,n)}function Yb(e){return typeof e==`number`?Jb:typeof e==`string`?Xy(e)?zb:bb.test(e)?Gb:$b:Array.isArray(e)?Xb:typeof e==`object`?bb.test(e)?Gb:Zb:zb}function Xb(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Yb(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Zb(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Yb(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Qb(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var $b=(e,t)=>{let n=Ib.createTransformer(t),r=kb(e),i=kb(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Kb.has(e)&&!i.values.length||Kb.has(t)&&!r.values.length?qb(e,t):oy(Xb(Qb(r,i),i.values),n):(`${e}${t}`,zb(e,t))};function ex(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Bb(e,t,n):Yb(e)(e,t)}var tx=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>zy.update(t,e),stop:()=>By(t),now:()=>Vy.isProcessing?Vy.timestamp:Gy.now()}},nx=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},rx=2e4;function ix(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function ax(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(ix(r),rx);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:uy(i)}}var ox={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 sx(e,t){return e*Math.sqrt(1-t*t)}var cx=12;function lx(e,t,n){let r=n;for(let n=1;n<cx;n++)r-=e(r)/t(r);return r}var ux=.001;function dx({duration:e=ox.duration,bounce:t=ox.bounce,velocity:n=ox.velocity,mass:r=ox.mass}){let i,a;ox.maxDuration;let o=1-t;o=$v(ox.minDamping,ox.maxDamping,o),e=$v(ox.minDuration,ox.maxDuration,uy(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=sx(t,o),c=Math.exp(-i);return ux-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=sx(t**2,o);return(-i(t)+ux>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=lx(i,a,s);if(e=ly(e),isNaN(c))return{stiffness:ox.stiffness,damping:ox.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var fx=[`duration`,`bounce`],px=[`stiffness`,`damping`,`mass`];function mx(e,t){return t.some(t=>e[t]!==void 0)}function hx(e){let t={velocity:ox.velocity,stiffness:ox.stiffness,damping:ox.damping,mass:ox.mass,isResolvedFromDuration:!1,...e};if(!mx(e,px)&&mx(e,fx))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*$v(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ox.mass,stiffness:i,damping:a}}else{let n=dx({...e,velocity:0});t={...t,...n,mass:ox.mass},t.isResolvedFromDuration=!0}return t}function gx(e=ox.visualDuration,t=ox.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=hx({...n,velocity:-uy(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=uy(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?ox.restSpeed.granular:ox.restSpeed.default,i||=v?ox.restDelta.granular:ox.restDelta.default;let y,b,x,S,C,w;if(h<1)x=sx(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>ly(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=ly(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=ly(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(ix(T),rx),t=nx(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}gx.applyToOptions=e=>{let t=ax(e,100,gx);return e.ease=t.ease,e.duration=ly(t.duration),e.type=`keyframes`,e};var _x=5;function vx(e,t,n){let r=Math.max(t-_x,0);return dy(n-e(r),t-r)}function yx({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=gx({keyframes:[f.value,m(f.value)],velocity:vx(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function bx(e,t,n){let r=[],i=n||ey.mix||ex,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=oy(Array.isArray(t)?t[n]||ay:t,a)),r.push(a)}return r}function xx(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=bx(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=sy(e[r],e[r+1],n);return s[r](i)};return n?t=>l($v(e[0],e[a-1],t)):l}function Sx(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=sy(0,t,r);e.push(Bb(n,1,i))}}function Cx(e){let t=[0];return Sx(t,e.length-1),t}function wx(e,t){return e.map(e=>e*t)}function Tx(e,t){return e.map(()=>t||Oy).splice(0,e.length-1)}function Ex({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ky(r)?r.map(Ny):Ny(r),a={done:!1,value:t[0]},o=xx(wx(n&&n.length===t.length?n:Cx(t),e),t,{ease:Array.isArray(i)?i:Tx(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Dx=e=>e!==null;function Ox(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Dx),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var kx={decay:yx,inertia:yx,tween:Ex,keyframes:Ex,spring:gx};function Ax(e){typeof e.type==`string`&&(e.type=kx[e.type])}var jx=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Mx=e=>e/100,Nx=class extends jx{constructor(e){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=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Gy.now()&&this.tick(Gy.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Ky.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Ax(e);let{type:t=Ex,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Ex;s!==Ex&&typeof o[0]!=`number`&&(this.mixKeyframes=oy(Mx,ex(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=ix(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=$v(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==yx&&(b.value=Ox(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return uy(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uy(e)}get time(){return uy(this.currentTime)}set time(e){e=ly(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return vx(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Gy.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=uy(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=tx,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,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(Gy.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,Ky.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Px(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Fx=e=>e*180/Math.PI,Ix=e=>Rx(Fx(Math.atan2(e[1],e[0]))),Lx={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ix,rotateZ:Ix,skewX:e=>Fx(Math.atan(e[1])),skewY:e=>Fx(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Rx=e=>(e%=360,e<0&&(e+=360),e),zx=Ix,Bx=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Vx=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Hx={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Bx,scaleY:Vx,scale:e=>(Bx(e)+Vx(e))/2,rotateX:e=>Rx(Fx(Math.atan2(e[6],e[5]))),rotateY:e=>Rx(Fx(Math.atan2(-e[2],e[0]))),rotateZ:zx,rotate:zx,skewX:e=>Fx(Math.atan(e[4])),skewY:e=>Fx(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Ux(e){return+!!e.includes(`scale`)}function Wx(e,t){if(!e||e===`none`)return Ux(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Hx,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Lx,i=t}if(!i)return Ux(t);let a=r[t],o=i[1].split(`,`).map(Kx);return typeof a==`function`?a(o):o[a]}var Gx=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Wx(n,t)};function Kx(e){return parseFloat(e.trim())}var qx=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Jx=new Set([...qx,`pathRotation`]),Yx=e=>e===$y||e===Y,Xx=new Set([`x`,`y`,`z`]),Zx=qx.filter(e=>!Xx.has(e));function Qx(e){let t=[];return Zx.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var $x={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},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})=>Wx(t,`x`),y:(e,{transform:t})=>Wx(t,`y`)};$x.translateX=$x.x,$x.translateY=$x.y;var eS=new Set,tS=!1,nS=!1,rS=!1;function iS(){if(nS){let e=Array.from(eS).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Qx(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}nS=!1,tS=!1,eS.forEach(e=>e.complete(rS)),eS.clear()}function aS(){eS.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(nS=!0)})}function oS(){rS=!0,aS(),iS(),rS=!1}var sS=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(eS.add(this),tS||(tS=!0,zy.read(aS),zy.resolveKeyframes(iS))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Px(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),eS.delete(this)}cancel(){this.state===`scheduled`&&(eS.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},cS=e=>e.startsWith(`--`);function lS(e,t,n){cS(t)?e.style.setProperty(t,n):e.style[t]=n}var uS={};function dS(e,t){let n=iy(e);return()=>uS[t]??n()}var fS=dS(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),pS=dS(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),mS=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,hS={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:mS([0,.65,.55,1]),circOut:mS([.55,0,1,.45]),backIn:mS([.31,.01,.66,-.59]),backOut:mS([.33,1.53,.69,.99])};function gS(e,t){if(e)return typeof e==`function`?pS()?nx(e,t):`ease-out`:Ay(e)?mS(e):Array.isArray(e)?e.map(e=>gS(e,t)||hS.easeOut):hS[e]}function _S(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=gS(s,i);Array.isArray(d)&&(u.easing=d),Fy.value&&Ky.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Fy.value&&p.finished.finally(()=>{Ky.waapi--}),p}function vS(e){return typeof e==`function`&&`applyToOptions`in e}function yS({type:e,...t}){return vS(e)&&pS()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var bS=class extends jx{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=yS(e);this.animation=_S(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Ox(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),lS(t,n,e),this.animation.cancel()}s?.(),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;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return uy(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uy(e)}get time(){return uy(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ly(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&fS()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),ay):r(this)}},xS={anticipate:Sy,backInOut:xy,circInOut:Ty};function SS(e){return e in xS}function CS(e){typeof e.ease==`string`&&SS(e.ease)&&(e.ease=xS[e.ease])}var wS=10,TS=class extends bS{constructor(e){CS(e),Ax(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Nx({...a,autoplay:!1}),s=Math.max(wS,Gy.now()-this.startTime),c=$v(0,wS,s-wS),l=o.sample(s).value,{name:u}=this.options;i&&u&&lS(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},ES=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ib.test(e)||e===`0`)&&!e.startsWith(`url(`));function DS(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function OS(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=ES(i,t),s=ES(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:DS(e)||(n===`spring`||vS(n))&&r}function kS(e){e.duration=0,e.type=`keyframes`}var AS=new Set([`opacity`,`clipPath`,`filter`,`transform`]),jS=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function MS(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&jS.test(e[t]))return!0;return!1}var NS=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),PS=iy(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function FS(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return PS()&&n&&(AS.has(n)||NS.has(n)&&MS(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var IS=40,LS=class extends jx{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Gy.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||sS;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Gy.now();let u=!0;OS(e,i,a,o)||(u=!1,(ey.instantAnimations||!s)&&l?.(Ox(e,n,t)),e[0]=e[e.length-1],kS(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>IS?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&FS(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new TS({...d,element:p})}catch{m=new Nx(d)}else m=new Nx(d);m.finished.then(()=>{this.notifyFinished()}).catch(ay),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),oS()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function RS(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var zS=30,BS=e=>!isNaN(parseFloat(e)),VS={current:void 0},HS=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Gy.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Gy.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=BS(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new cy);let n=this.events[e].add(t);return e===`change`?()=>{n(),zy.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return VS.current&&VS.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Gy.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>zS)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,zS);return dy(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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 US(e,t){return new HS(e,t)}function WS(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function GS(e,t){let n=e?.[t]??e?.default??e;return n===e?n:WS(n,e)}var KS={type:`spring`,stiffness:500,damping:25,restSpeed:10},qS=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),JS={type:`keyframes`,duration:.8},YS={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},XS=(e,{keyframes:t})=>t.length>2?JS:Jx.has(e)?e.startsWith(`scale`)?qS(t[1]):KS:YS,ZS=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function QS(e){for(let t in e)if(!ZS.has(t))return!0;return!1}var $S=(e,t,n,r={},i,a)=>o=>{let s=GS(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=ly(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};QS(s)||Object.assign(u,XS(e,u)),u.duration&&=ly(u.duration),u.repeatDelay&&=ly(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(kS(u),u.delay===0&&(d=!0)),(ey.instantAnimations||ey.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,kS(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Ox(u.keyframes,s);if(e!==void 0){zy.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Nx(u):new LS(u)},eC=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tC(e){let t=eC.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function nC(e,t,n=1){`${e}`;let[r,i]=tC(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return ty(e)?parseFloat(e):e}return Xy(i)?nC(i,t,n+1):i}function rC(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function iC(e,t,n,r){if(typeof t==`function`){let[i,a]=rC(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=rC(r);t=t(n===void 0?e.custom:n,i,a)}return t}function aC(e,t,n){let r=e.getProps();return iC(r,t,n===void 0?r.custom:n,e)}var oC=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...qx]),sC=e=>Array.isArray(e);function cC(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,US(n))}function lC(e){return sC(e)?e[e.length-1]||0:e}function uC(e,t){let{transitionEnd:n={},transition:r={},...i}=aC(e,t)||{};i={...i,...n};for(let t in i)cC(e,t,lC(i[t]))}var dC=e=>!!(e&&e.getVelocity);function fC(e){return!!(dC(e)&&e.add)}function pC(e,t){let n=e.getValue(`willChange`);if(fC(n))return n.add(t);if(!n&&ey.WillChange){let n=new ey.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function mC(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var hC=`data-`+mC(`framerAppearId`);function gC(e){return e.props[hC]}function _C({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function vC(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?WS(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&_C(f,t))continue;let o={delay:n,...GS(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){zy.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=gC(e);if(n){let e=window.MotionHandoffAnimation(n,t,zy);e!==null&&(o.startTime=e,p=!0)}}pC(e,t);let m=l??e.shouldReduceMotion;r.start($S(t,r,i,m&&oC.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>zy.update(()=>{o&&uC(e,o)});d.length?Promise.all(d).then(t):t()}return d}function yC(e,t,n={}){let r=aC(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(vC(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return bC(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function bC(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(yC(c,t,{...o,delay:n+(typeof r==`function`?0:r)+RS(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function xC(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>yC(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=yC(e,t,n);else{let i=typeof t==`function`?aC(e,t,n.custom):t;r=Promise.all(vC(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var SC={test:e=>e===`auto`,parse:e=>e},CC=e=>t=>t.test(e),wC=[$y,Y,hb,mb,_b,gb,SC],TC=e=>wC.find(CC(e));function EC(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||ry(e)}var DC=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function OC(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(rb)||[];if(!r)return e;let i=n.replace(r,``),a=+!!DC.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var kC=/\b([a-z-]*)\(.*?\)/gu,AC={...Ib,getAnimatableNone:e=>{let t=e.match(kC);return t?t.map(OC).join(` `):e}},jC={...Ib,getAnimatableNone:e=>{let t=Ib.parse(e);return Ib.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},MC={...$y,transform:Math.round},NC={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,top:Y,right:Y,bottom:Y,left:Y,inset:Y,insetBlock:Y,insetBlockStart:Y,insetBlockEnd:Y,insetInline:Y,insetInlineStart:Y,insetInlineEnd:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,paddingBlock:Y,paddingBlockStart:Y,paddingBlockEnd:Y,paddingInline:Y,paddingInlineStart:Y,paddingInlineEnd:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,marginBlock:Y,marginBlockStart:Y,marginBlockEnd:Y,marginInline:Y,marginInlineStart:Y,marginInlineEnd:Y,fontSize:Y,backgroundPositionX:Y,backgroundPositionY:Y,rotate:mb,pathRotation:mb,rotateX:mb,rotateY:mb,rotateZ:mb,scale:tb,scaleX:tb,scaleY:tb,scaleZ:tb,skew:mb,skewX:mb,skewY:mb,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:eb,originX:vb,originY:vb,originZ:Y,zIndex:MC,fillOpacity:eb,strokeOpacity:eb,numOctaves:MC},PC={...NC,color:bb,backgroundColor:bb,outlineColor:bb,fill:bb,stroke:bb,borderColor:bb,borderTopColor:bb,borderRightColor:bb,borderBottomColor:bb,borderLeftColor:bb,filter:AC,WebkitFilter:AC,mask:jC,WebkitMask:jC},FC=e=>PC[e],IC=new Set([AC,jC]);function LC(e,t){let n=FC(e);return IC.has(n)||(n=Ib),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var RC=new Set([`auto`,`none`,`0`]);function zC(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!RC.has(t)&&kb(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=LC(n,i)}var BC=class extends sS{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Xy(r))){let i=nC(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!oC.has(n)||e.length!==2)return;let[r,i]=e,a=TC(r),o=TC(i);if(Qy(r)!==Qy(i)&&$x[n]){this.needsMeasurement=!0;return}if(a!==o)if(Yx(a)&&Yx(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else $x[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||EC(e[t]))&&n.push(t);n.length&&zC(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=$x[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=$x[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function VC(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var HC=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function UC(e){return ny(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:WC,cancel:GC}=Ry(queueMicrotask,!1),KC={x:!1,y:!1};function qC(){return KC.x||KC.y}function JC(e){return e===`x`||e===`y`?KC[e]?null:(KC[e]=!0,()=>{KC[e]=!1}):KC.x||KC.y?null:(KC.x=KC.y=!0,()=>{KC.x=KC.y=!1})}function YC(e,t){let n=VC(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function XC(e){return!(e.pointerType===`touch`||qC())}function ZC(e,t,n={}){let[r,i,a]=YC(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!XC(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var QC=(e,t)=>t?e===t?!0:QC(e,t.parentElement):!1,$C=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,ew=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function tw(e){return ew.has(e.tagName)||e.isContentEditable===!0}var nw=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function rw(e){return nw.has(e.tagName)||e.isContentEditable===!0}var iw=new WeakSet;function aw(e){return t=>{t.key===`Enter`&&e(t)}}function ow(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var sw=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=aw(()=>{if(iw.has(n))return;ow(n,`down`);let e=aw(()=>{ow(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>ow(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function cw(e){return $C(e)&&!qC()}var lw=new WeakSet;function uw(e,t,n={}){let[r,i,a]=YC(e,n),o=e=>{let r=e.currentTarget;if(!cw(e)||lw.has(e))return;iw.add(r),n.stopPropagation&&lw.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),iw.has(r)&&iw.delete(r),cw(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||QC(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),UC(e)&&(e.addEventListener(`focus`,e=>sw(e,i)),!tw(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function dw(e){return ny(e)&&`ownerSVGElement`in e}var fw=new WeakMap,pw,mw=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:dw(r)&&`getBBox`in r?r.getBBox()[t]:r[n],hw=mw(`inline`,`width`,`offsetWidth`),gw=mw(`block`,`height`,`offsetHeight`);function _w({target:e,borderBoxSize:t}){fw.get(e)?.forEach(n=>{n(e,{get width(){return hw(e,t)},get height(){return gw(e,t)}})})}function vw(e){e.forEach(_w)}function yw(){typeof ResizeObserver>`u`||(pw=new ResizeObserver(vw))}function bw(e,t){pw||yw();let n=VC(e);return n.forEach(e=>{let n=fw.get(e);n||(n=new Set,fw.set(e,n)),n.add(t),pw?.observe(e)}),()=>{n.forEach(e=>{let n=fw.get(e);n?.delete(t),n?.size||pw?.unobserve(e)})}}var xw=new Set,Sw;function Cw(){Sw=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};xw.forEach(t=>t(e))},window.addEventListener(`resize`,Sw)}function ww(e){return xw.add(e),Sw||Cw(),()=>{xw.delete(e),!xw.size&&typeof Sw==`function`&&(window.removeEventListener(`resize`,Sw),Sw=void 0)}}function Tw(e,t){return typeof e==`function`?ww(e):bw(e,t)}function Ew(e){return dw(e)&&e.tagName===`svg`}var Dw=[...wC,bb,Ib],Ow=e=>Dw.find(CC(e)),kw=()=>({translate:0,scale:1,origin:0,originPoint:0}),Aw=()=>({x:kw(),y:kw()}),jw=()=>({min:0,max:0}),Mw=()=>({x:jw(),y:jw()}),Nw=new WeakMap;function Pw(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Fw(e){return typeof e==`string`||Array.isArray(e)}var Iw=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Lw=[`initial`,...Iw];function Rw(e){return Pw(e.animate)||Lw.some(t=>Fw(e[t]))}function zw(e){return!!(Rw(e)||e.variants)}function Bw(e,t,n){for(let r in t){let i=t[r],a=n[r];if(dC(i))e.addValue(r,i);else if(dC(a))e.addValue(r,US(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,US(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Vw={current:null},Hw={current:!1},Uw=typeof window<`u`;function Ww(){if(Hw.current=!0,Uw)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Vw.current=e.matches;e.addEventListener(`change`,t),t()}else Vw.current=!1}var Gw=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Kw={};function qw(e){Kw=e}function Jw(){return Kw}var Yw=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){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=sS,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=()=>{let e=Gy.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,zy.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=Rw(t),this.isVariantNode=zw(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&dC(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,Nw.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Hw.current||Ww(),this.shouldReduceMotion=Vw.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(),By(this.notifyUpdate),By(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&AS.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new bS({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:ly(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Jx.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&zy.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Kw){let t=Kw[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Mw()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Gw.length;t++){let n=Gw[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Bw(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]: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(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=US(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(ty(n)||ry(n))?n=parseFloat(n):!Ow(n)&&Ib.test(t)&&(n=LC(e,t)),this.setBaseTarget(e,dC(n)?n.get():n)),dC(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=iC(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!dC(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new cy),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){WC.render(this.render)}},Xw=class extends Yw{constructor(){super(...arguments),this.KeyframeResolver=BC}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;dC(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Zw=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Qw({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function $w({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function eT(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function tT(e){return e===void 0||e===1}function nT({scale:e,scaleX:t,scaleY:n}){return!tT(e)||!tT(t)||!tT(n)}function rT(e){return nT(e)||iT(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function iT(e){return aT(e.x)||aT(e.y)}function aT(e){return e&&e!==`0%`}function oT(e,t,n){return n+t*(e-n)}function sT(e,t,n,r,i){return i!==void 0&&(e=oT(e,i,r)),oT(e,n,r)+t}function cT(e,t=0,n=1,r,i){e.min=sT(e.min,t,n,r,i),e.max=sT(e.max,t,n,r,i)}function lT(e,{x:t,y:n}){cT(e.x,t.translate,t.scale,t.originPoint),cT(e.y,n.translate,n.scale,n.originPoint)}var uT=.999999999999,dT=1.0000000000001;function fT(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(pT(e.x,-a.scroll.offset.x),pT(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,lT(e,o)),r&&rT(a.latestValues)&&gT(e,a.latestValues,a.layout?.layoutBox))}t.x<dT&&t.x>uT&&(t.x=1),t.y<dT&&t.y>uT&&(t.y=1)}function pT(e,t){e.min+=t,e.max+=t}function mT(e,t,n,r,i=.5){cT(e,t,n,Bb(e.min,e.max,i),r)}function hT(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function gT(e,t,n){let r=n??e;mT(e.x,hT(t.x,r.x),t.scaleX,t.scale,t.originX),mT(e.y,hT(t.y,r.y),t.scaleY,t.scale,t.originY)}function _T(e,t){return Qw(eT(e.getBoundingClientRect(),t))}function vT(e,t,n){let r=_T(e,n),{scroll:i}=t;return i&&(pT(r.x,i.offset.x),pT(r.y,i.offset.y)),r}var yT={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},bT=qx.length;function xT(e,t,n){let r=``,i=!0;for(let a=0;a<bT;a++){let o=qx[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=HC(s,NC[o]);if(!c){i=!1;let t=yT[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${HC(a,NC.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function ST(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Jx.has(e)){o=!0;continue}else if(Jy(e)){i[e]=n;continue}else{let t=HC(n,NC[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=xT(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function CT(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function wT(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var TT={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Y.test(e))e=parseFloat(e);else return e;return`${wT(e,t.target.x)}% ${wT(e,t.target.y)}%`}},ET={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ib.parse(e);if(i.length>5)return r;let a=Ib.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=Bb(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},DT={borderRadius:{...TT,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:TT,borderTopRightRadius:TT,borderBottomLeftRadius:TT,borderBottomRightRadius:TT,boxShadow:ET};function OT(e,{layout:t,layoutId:n}){return Jx.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!DT[e]||e===`opacity`)}function kT(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(dC(r[t])||i&&dC(i[t])||OT(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function AT(e){return window.getComputedStyle(e)}var jT=class extends Xw{constructor(){super(...arguments),this.type=`html`,this.renderInstance=CT}readValueFromInstance(e,t){if(Jx.has(t))return this.projection?.isProjecting?Ux(t):Gx(e,t);{let n=AT(e),r=(Jy(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return _T(e,t)}build(e,t,n){ST(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return kT(e,t,n)}},MT={offset:`stroke-dashoffset`,array:`stroke-dasharray`},NT={offset:`strokeDashoffset`,array:`strokeDasharray`};function PT(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?MT:NT;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var FT=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function IT(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(ST(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of FT)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&PT(d,i,a,o,!1)}var LT=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`]),RT=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function zT(e,t,n,r){CT(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(LT.has(n)?n:mC(n),t.attrs[n])}function BT(e,t,n){let r=kT(e,t,n);for(let n in e)if(dC(e[n])||dC(t[n])){let t=qx.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var VT=class extends Xw{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Mw}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Jx.has(t)){let e=FC(t);return e&&e.default||0}return t=LT.has(t)?t:mC(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return BT(e,t,n)}build(e,t,n){IT(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){zT(e,t,n,r)}mount(e){this.isSVGTag=RT(e.tagName),super.mount(e)}},HT=Lw.length;function UT(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&UT(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<HT;n++){let r=Lw[n],i=e.props[r];(Fw(i)||i===!1)&&(t[r]=i)}return t}function WT(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var GT=[...Iw].reverse(),KT=Iw.length;function qT(e){return t=>Promise.all(t.map(({animation:t,options:n})=>xC(e,t,n)))}function JT(e){let t=qT(e),n=ZT(),r=!0,i=!1,a=t=>(n,r)=>{let i=aC(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=UT(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<KT;t++){let p=GT[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Fw(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||Pw(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=YT(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=sC(t)&&sC(n)?!WT(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=aC(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=RS(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=aC(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=ZT(),i=!0}}}function YT(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!WT(t,e):!1}function XT(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ZT(){return{animate:XT(!0),whileInView:XT(),whileHover:XT(),whileTap:XT(),whileDrag:XT(),whileFocus:XT(),exit:XT()}}function QT(e,t){e.min=t.min,e.max=t.max}function $T(e,t){QT(e.x,t.x),QT(e.y,t.y)}function eE(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var tE=.9999,nE=1.0001,rE=-.01,iE=.01;function aE(e){return e.max-e.min}function oE(e,t,n){return Math.abs(e-t)<=n}function sE(e,t,n,r=.5){e.origin=r,e.originPoint=Bb(t.min,t.max,e.origin),e.scale=aE(n)/aE(t),e.translate=Bb(n.min,n.max,e.origin)-e.originPoint,(e.scale>=tE&&e.scale<=nE||isNaN(e.scale))&&(e.scale=1),(e.translate>=rE&&e.translate<=iE||isNaN(e.translate))&&(e.translate=0)}function cE(e,t,n,r){sE(e.x,t.x,n.x,r?r.originX:void 0),sE(e.y,t.y,n.y,r?r.originY:void 0)}function lE(e,t,n,r=0){e.min=(r?Bb(n.min,n.max,r):n.min)+t.min,e.max=e.min+aE(t)}function uE(e,t,n,r){lE(e.x,t.x,n.x,r?.x),lE(e.y,t.y,n.y,r?.y)}function dE(e,t,n,r=0){let i=r?Bb(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+aE(t)}function fE(e,t,n,r){dE(e.x,t.x,n.x,r?.x),dE(e.y,t.y,n.y,r?.y)}function pE(e,t,n,r,i){return e-=t,e=oT(e,1/n,r),i!==void 0&&(e=oT(e,1/i,r)),e}function mE(e,t=0,n=1,r=.5,i,a=e,o=e){if(hb.test(t)&&(t=parseFloat(t),t=Bb(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Bb(a.min,a.max,r);e===a&&(s-=t),e.min=pE(e.min,t,n,s,i),e.max=pE(e.max,t,n,s,i)}function hE(e,t,[n,r,i],a,o){mE(e,t[n],t[r],t[i],t.scale,a,o)}var gE=[`x`,`scaleX`,`originX`],_E=[`y`,`scaleY`,`originY`];function vE(e,t,n,r){hE(e.x,t,gE,n?n.x:void 0,r?r.x:void 0),hE(e.y,t,_E,n?n.y:void 0,r?r.y:void 0)}function yE(e){return e.translate===0&&e.scale===1}function bE(e){return yE(e.x)&&yE(e.y)}function xE(e,t){return e.min===t.min&&e.max===t.max}function SE(e,t){return xE(e.x,t.x)&&xE(e.y,t.y)}function CE(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function wE(e,t){return CE(e.x,t.x)&&CE(e.y,t.y)}function TE(e){return aE(e.x)/aE(e.y)}function EE(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function DE(e){return[e(`x`),e(`y`)]}function OE(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var kE=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],AE=kE.length,jE=e=>typeof e==`string`?parseFloat(e):e,ME=e=>typeof e==`number`||Y.test(e);function NE(e,t,n,r,i,a){i?(e.opacity=Bb(0,n.opacity??1,FE(r)),e.opacityExit=Bb(t.opacity??1,0,IE(r))):a&&(e.opacity=Bb(t.opacity??1,n.opacity??1,r));for(let i=0;i<AE;i++){let a=kE[i],o=PE(t,a),s=PE(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||ME(o)===ME(s)?(e[a]=Math.max(Bb(jE(o),jE(s),r),0),(hb.test(s)||hb.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Bb(t.rotate||0,n.rotate||0,r))}function PE(e,t){return e[t]===void 0?e.borderRadius:e[t]}var FE=LE(0,.5,wy),IE=LE(.5,.95,ay);function LE(e,t,n){return r=>r<e?0:r>t?1:n(sy(e,t,r))}function RE(e,t,n){let r=dC(e)?e:US(e);return r.start($S(``,r,t,n)),r.animation}function zE(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var BE=(e,t)=>e.depth-t.depth,VE=class{constructor(){this.children=[],this.isDirty=!1}add(e){Zv(this.children,e),this.isDirty=!0}remove(e){Qv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(BE),this.isDirty=!1,this.children.forEach(e)}};function HE(e,t){let n=Gy.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(By(r),e(a-t))};return zy.setup(r,!0),()=>By(r)}function UE(e){return dC(e)?e.get():e}var WE=class{constructor(){this.members=[]}add(e){Zv(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Qv(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Qv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},GE={hasAnimatedSinceResize:!0,hasEverUpdated:!1},KE={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},qE=[``,`X`,`Y`,`Z`],JE=1e3,YE=0;function XE(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function ZE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=gC(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,zy,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&ZE(r)}function QE({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=YE++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Fy.value&&(KE.nodes=KE.calculatedTargetDeltas=KE.calculatedProjections=0),this.nodes.forEach(tD),this.nodes.forEach(uD),this.nodes.forEach(dD),this.nodes.forEach(nD),Fy.addProjectionMetrics&&Fy.addProjectionMetrics(KE)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new VE)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cy),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=dw(t)&&!Ew(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;zy.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=HE(i,250),GE.hasAnimatedSinceResize&&(GE.hasAnimatedSinceResize=!1,this.nodes.forEach(lD)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||vD,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!wE(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...GS(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||lD(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),By(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fD),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ZE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(aD),this.nodes.forEach(iD);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(oD);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(sD),this.nodes.forEach(cD),this.nodes.forEach($E),this.nodes.forEach(eD)):this.nodes.forEach(oD),this.clearAllSnapshots();let e=Gy.now();Vy.delta=$v(0,1e3/60,e-Vy.timestamp),Vy.timestamp=e,Vy.isProcessing=!0,Hy.update.process(Vy),Hy.preRender.process(Vy),Hy.render.process(Vy),Vy.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,WC.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(rD),this.sharedNodes.forEach(pD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,zy.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){zy.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!aE(this.snapshot.measuredBox.x)&&!aE(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=Mw(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!bE(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||rT(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),SD(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Mw();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(wD))){let{scroll:e}=this.root;e&&(pT(t.x,e.offset.x),pT(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Mw();if($T(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&$T(t,e),pT(t.x,i.offset.x),pT(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Mw();$T(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(pT(r.x,-n.scroll.offset.x),pT(r.y,-n.scroll.offset.y)),rT(n.latestValues)&&gT(r,n.latestValues,n.layout?.layoutBox)}return rT(this.latestValues)&&gT(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Mw();$T(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!rT(n.latestValues))continue;let r;n.instance&&(nT(n.latestValues)&&n.updateSnapshot(),r=Mw(),$T(r,n.measurePageBox())),vE(t,n.latestValues,n.snapshot?.layoutBox,r)}return rT(this.latestValues)&&vE(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Vy.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=Vy.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Mw(),this.targetWithTransforms=Mw()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),uE(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):$T(this.target,this.layout.layoutBox),lT(this.target,this.targetDelta)):$T(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Fy.value&&KE.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||nT(this.parent.latestValues)||iT(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Mw(),this.relativeTargetOrigin=Mw(),fE(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),$T(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Vy.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;$T(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;fT(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Mw());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(eE(this.prevProjectionDelta.x,this.projectionDelta.x),eE(this.prevProjectionDelta.y,this.projectionDelta.y)),cE(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!EE(this.projectionDelta.x,this.prevProjectionDelta.x)||!EE(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Fy.value&&KE.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Aw(),this.projectionDelta=Aw(),this.projectionDeltaWithTransform=Aw()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Aw();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=Mw(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(_D));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=Bb(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=Bb(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(mD(o.x,e.x,n),mD(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fE(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),gD(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&SE(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Mw(),$T(f,this.relativeTarget)),c&&(this.animationValues=a,NE(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(By(this.pendingAnimation),void 0),this.pendingAnimation=zy.update(()=>{GE.hasAnimatedSinceResize=!0,Ky.layout++,this.motionValue||=US(0),this.motionValue.jump(0,!1),this.currentAnimation=RE(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Ky.layout--},onComplete:()=>{Ky.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(JE),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&CD(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Mw();let t=aE(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=aE(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}$T(t,n),gT(t,i),cE(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new WE),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&XE(`z`,e,r,this.animationValues);for(let t=0;t<qE.length;t++)XE(`rotate${qE[t]}`,e,r,this.animationValues),XE(`skew${qE[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=UE(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=UE(t?.pointerEvents)||``),this.hasProjected&&!rT(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=OE(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in DT){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=DT[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?UE(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(iD),this.root.sharedNodes.clear()}}}function $E(e){e.updateLayout()}function eD(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)DE(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=aE(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;QT(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else CD(i,t.layoutBox,n)&&DE(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=aE(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Aw();cE(o,n,t.layoutBox);let s=Aw();a?cE(s,e.applyTransform(r,!0),t.measuredBox):cE(s,n,t.layoutBox);let c=!bE(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=Mw();fE(s,t.layoutBox,i.layoutBox,o);let c=Mw();fE(c,n,a.layoutBox,o),wE(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function tD(e){Fy.value&&KE.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function nD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rD(e){e.clearSnapshot()}function iD(e){e.clearMeasurements()}function aD(e){e.isLayoutDirty=!0,e.updateLayout()}function oD(e){e.isLayoutDirty=!1}function sD(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function cD(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function lD(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function uD(e){e.resolveTargetDelta()}function dD(e){e.calcProjection()}function fD(e){e.resetSkewAndRotation()}function pD(e){e.removeLeadSnapshot()}function mD(e,t,n){e.translate=Bb(t.translate,0,n),e.scale=Bb(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function hD(e,t,n,r){e.min=Bb(t.min,n.min,r),e.max=Bb(t.max,n.max,r)}function gD(e,t,n,r){hD(e.x,t.x,n.x,r),hD(e.y,t.y,n.y,r)}function _D(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var vD={duration:.45,ease:[.4,0,.1,1]},yD=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),bD=yD(`applewebkit/`)&&!yD(`chrome/`)?Math.round:ay;function xD(e){e.min=bD(e.min),e.max=bD(e.max)}function SD(e){xD(e.x),xD(e.y)}function CD(e,t,n){return e===`position`||e===`preserve-aspect`&&!oE(TE(t),TE(n),.2)}function wD(e){return e!==e.root&&e.scroll?.wasRoot}var TD=QE({attachResizeListener:(e,t)=>zE(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),ED={current:void 0},DD=QE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ED.current){let e=new TD({});e.mount(window),e.setOptions({layoutScroll:!0}),ED.current=e}return ED.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),OD=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function kD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function AD(...e){return t=>{let n=!1,r=e.map(e=>{let r=kD(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():kD(e[t],null)}}}}function jD(...e){return b.useCallback(AD(...e),e)}var MD=class extends b.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(UC(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=UC(e)&&e.offsetWidth||0,r=UC(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function ND({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,b.useId)(),s=(0,b.useRef)(null),c=(0,b.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,b.useContext)(OD),u=jD(s,e.props?.ref??e?.ref);return(0,b.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
53
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Oa=`DialogDescriptionWarning`,ka=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ea(Oa).contentName}}.`;return b.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Aa=ta,ja=sa,Ma=la,Na=pa,Pa=va,Fa=ba,Ia=Sa,La=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ra=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),za=s(((e,t)=>{t.exports=Ra()}))();function Ba(){return(0,za.useSyncExternalStore)(Va,()=>!0,()=>!1)}function Va(){return()=>{}}var Ha=`Avatar`,[Ua,Wa]=pn(Ha),[Ga,Ka]=Ua(Ha),qa=b.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=b.useState(`idle`);return(0,C.jsx)(Ga,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,C.jsx)(La.span,{...r,ref:t})})});qa.displayName=Ha;var Ja=`AvatarImage`,Ya=b.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=Ka(Ja,n),s=$a(r,a),c=qn(e=>{i(e),o.onImageLoadingStatusChange(e)});return gn(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,C.jsx)(La.img,{...a,ref:t,src:r}):null});Ya.displayName=Ja;var Xa=`AvatarFallback`,Za=b.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=Ka(Xa,n),[o,s]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,C.jsx)(La.span,{...i,ref:t}):null});Za.displayName=Xa;function Qa(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function $a(e,{referrerPolicy:t,crossOrigin:n}){let r=Ba(),i=b.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=b.useState(()=>Qa(a,e));return gn(()=>{s(Qa(a,e))},[a,e]),gn(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var eo=qa,to=Ya,no=Za;function ro(e){let t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function io(e){let[t,n]=b.useState(void 0);return gn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var ao=[`top`,`right`,`bottom`,`left`],oo=Math.min,so=Math.max,co=Math.round,lo=Math.floor,uo=e=>({x:e,y:e}),fo={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function po(e,t,n){return so(e,oo(t,n))}function mo(e,t){return typeof e==`function`?e(t):e}function z(e){return e.split(`-`)[0]}function ho(e){return e.split(`-`)[1]}function go(e){return e===`x`?`y`:`x`}function _o(e){return e===`y`?`height`:`width`}function vo(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function yo(e){return go(vo(e))}function bo(e,t,n){n===void 0&&(n=!1);let r=ho(e),i=yo(e),a=_o(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ko(o)),[o,ko(o)]}function xo(e){let t=ko(e);return[So(e),t,So(t)]}function So(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Co=[`left`,`right`],wo=[`right`,`left`],To=[`top`,`bottom`],Eo=[`bottom`,`top`];function Do(e,t,n){switch(e){case`top`:case`bottom`:return n?t?wo:Co:t?Co:wo;case`left`:case`right`:return t?To:Eo;default:return[]}}function Oo(e,t,n,r){let i=ho(e),a=Do(z(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(So)))),a}function ko(e){let t=z(e);return fo[t]+e.slice(t.length)}function Ao(e){return{top:0,right:0,bottom:0,left:0,...e}}function jo(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ao(e)}function Mo(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function No(e,t,n){let{reference:r,floating:i}=e,a=vo(t),o=yo(t),s=_o(o),c=z(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ho(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Po(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=mo(t,e),p=jo(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Mo(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Mo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Fo=50,Io=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Po},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=No(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Fo&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=No(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Lo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=mo(e,t)||{};if(l==null)return{};let d=jo(u),f={x:n,y:r},p=yo(i),m=_o(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=oo(d[_],T),D=oo(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=po(O,A,k),M=!c.arrow&&ho(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Ro=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=mo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=z(r),_=vo(o),v=z(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ko(o)]:xo(o)),x=p!==`none`;!d&&x&&b.push(...Oo(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=bo(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==vo(t))||T.every(e=>vo(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vo(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function zo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bo(e){return ao.some(t=>e[t]>=0)}var Vo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=mo(e,t);switch(i){case`referenceHidden`:{let e=zo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Bo(e)}}}case`escaped`:{let e=zo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Bo(e)}}}default:return{}}}}},Ho=new Set([`left`,`top`]);async function Uo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=z(n),s=ho(n),c=vo(n)===`y`,l=Ho.has(o)?-1:1,u=a&&c?-1:1,d=mo(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Wo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Uo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Go=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=mo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=vo(z(i)),p=go(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=po(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=po(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ko=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=mo(e,t),u={x:n,y:r},d=vo(i),f=go(d),p=u[f],m=u[d],h=mo(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ho.has(z(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},qo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=mo(e,t),u=await o.detectOverflow(t,l),d=z(i),f=ho(i),p=vo(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=oo(h-u[g],v),x=oo(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=so(u.left,0),t=so(u.right,0),n=so(u.top,0),r=so(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:so(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:so(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Jo(){return typeof window<`u`}function Yo(e){return Qo(e)?(e.nodeName||``).toLowerCase():`#document`}function Xo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zo(e){return((Qo(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Qo(e){return Jo()?e instanceof Node||e instanceof Xo(e).Node:!1}function $o(e){return Jo()?e instanceof Element||e instanceof Xo(e).Element:!1}function es(e){return Jo()?e instanceof HTMLElement||e instanceof Xo(e).HTMLElement:!1}function ts(e){return!Jo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Xo(e).ShadowRoot}function ns(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ps(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function rs(e){return/^(table|td|th)$/.test(Yo(e))}function is(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var as=/transform|translate|scale|rotate|perspective|filter/,os=/paint|layout|strict|content/,ss=e=>!!e&&e!==`none`,cs;function ls(e){let t=$o(e)?ps(e):e;return ss(t.transform)||ss(t.translate)||ss(t.scale)||ss(t.rotate)||ss(t.perspective)||!ds()&&(ss(t.backdropFilter)||ss(t.filter))||as.test(t.willChange||``)||os.test(t.contain||``)}function us(e){let t=hs(e);for(;es(t)&&!fs(t);){if(ls(t))return t;if(is(t))return null;t=hs(t)}return null}function ds(){return cs??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),cs}function fs(e){return/^(html|body|#document)$/.test(Yo(e))}function ps(e){return Xo(e).getComputedStyle(e)}function ms(e){return $o(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hs(e){if(Yo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ts(e)&&e.host||Zo(e);return ts(t)?t.host:t}function gs(e){let t=hs(e);return fs(t)?e.ownerDocument?e.ownerDocument.body:e.body:es(t)&&ns(t)?t:gs(t)}function _s(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=gs(e),i=r===e.ownerDocument?.body,a=Xo(r);if(i){let e=vs(a);return t.concat(a,a.visualViewport||[],ns(r)?r:[],e&&n?_s(e):[])}else return t.concat(r,_s(r,[],n))}function vs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ys(e){let t=ps(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=es(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=co(n)!==a||co(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function bs(e){return $o(e)?e:e.contextElement}function xs(e){let t=bs(e);if(!es(t))return uo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ys(t),o=(a?co(n.width):n.width)/r,s=(a?co(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ss=uo(0);function Cs(e){let t=Xo(e);return!ds()||!t.visualViewport?Ss:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ws(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Xo(e)?!1:t}function Ts(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=bs(e),o=uo(1);t&&(r?$o(r)&&(o=xs(r)):o=xs(e));let s=ws(a,n,r)?Cs(a):uo(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Xo(a),t=r&&$o(r)?Xo(r):r,n=e,i=vs(n);for(;i&&r&&t!==n;){let e=xs(i),t=i.getBoundingClientRect(),r=ps(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Xo(i),i=vs(n)}}return Mo({width:u,height:d,x:c,y:l})}function Es(e,t){let n=ms(e).scrollLeft;return t?t.left+n:Ts(Zo(e)).left+n}function Ds(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Es(e,n),y:n.top+t.scrollTop}}function Os(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Zo(r),s=t?is(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=uo(1),u=uo(0),d=es(r);if((d||!d&&!a)&&((Yo(r)!==`body`||ns(o))&&(c=ms(r)),d)){let e=Ts(r);l=xs(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ds(o,c):uo(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ks(e){return Array.from(e.getClientRects())}function As(e){let t=Zo(e),n=ms(e),r=e.ownerDocument.body,i=so(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=so(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Es(e),s=-n.scrollTop;return ps(r).direction===`rtl`&&(o+=so(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var js=25;function Ms(e,t){let n=Xo(e),r=Zo(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ds();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Es(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=js&&(a-=o)}else l<=js&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ns(e,t){let n=Ts(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=es(e)?xs(e):uo(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ps(e,t,n){let r;if(t===`viewport`)r=Ms(e,n);else if(t===`document`)r=As(Zo(e));else if($o(t))r=Ns(t,n);else{let n=Cs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Mo(r)}function Fs(e,t){let n=hs(e);return n===t||!$o(n)||fs(n)?!1:ps(n).position===`fixed`||Fs(n,t)}function Is(e,t){let n=t.get(e);if(n)return n;let r=_s(e,[],!1).filter(e=>$o(e)&&Yo(e)!==`body`),i=null,a=ps(e).position===`fixed`,o=a?hs(e):e;for(;$o(o)&&!fs(o);){let t=ps(o),n=ls(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ns(o)&&!n&&Fs(e,o))?r=r.filter(e=>e!==o):i=t,o=hs(o)}return t.set(e,r),r}function Ls(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?is(t)?[]:Is(t,this._c):[].concat(n),r],o=Ps(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ps(t,a[e],i);s=so(n.top,s),c=oo(n.right,c),l=oo(n.bottom,l),u=so(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Rs(e){let{width:t,height:n}=ys(e);return{width:t,height:n}}function zs(e,t,n){let r=es(t),i=Zo(t),a=n===`fixed`,o=Ts(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=uo(0);function l(){c.x=Es(i)}if(r||!r&&!a)if((Yo(t)!==`body`||ns(i))&&(s=ms(t)),r){let e=Ts(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ds(i,s):uo(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Bs(e){return ps(e).position===`static`}function Vs(e,t){if(!es(e)||ps(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Zo(e)===n&&(n=n.ownerDocument.body),n}function Hs(e,t){let n=Xo(e);if(is(e))return n;if(!es(e)){let t=hs(e);for(;t&&!fs(t);){if($o(t)&&!Bs(t))return t;t=hs(t)}return n}let r=Vs(e,t);for(;r&&rs(r)&&Bs(r);)r=Vs(r,t);return r&&fs(r)&&Bs(r)&&!ls(r)?n:r||us(e)||n}var Us=async function(e){let t=this.getOffsetParent||Hs,n=this.getDimensions,r=await n(e.floating);return{reference:zs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ws(e){return ps(e).direction===`rtl`}var Gs={convertOffsetParentRelativeRectToViewportRelativeRect:Os,getDocumentElement:Zo,getClippingRect:Ls,getOffsetParent:Hs,getElementRects:Us,getClientRects:ks,getDimensions:Rs,getScale:xs,isElement:$o,isRTL:Ws};function Ks(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qs(e,t){let n=null,r,i=Zo(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=lo(d),h=lo(i.clientWidth-(u+f)),g=lo(i.clientHeight-(d+p)),_=lo(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:so(0,oo(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ks(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Js(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=bs(e),u=i||a?[...l?_s(l):[],...t?_s(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?qs(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ts(e):null;c&&g();function g(){let t=Ts(e);h&&!Ks(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ys=Wo,Xs=Go,Zs=Ro,Qs=qo,$s=Vo,ec=Lo,tc=Ko,nc=(e,t,n)=>{let r=new Map,i={platform:Gs,...n},a={...i.platform,_c:r};return Io(e,t,{...i,platform:a})},rc=typeof document<`u`?b.useLayoutEffect:function(){};function ic(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ic(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ic(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ac(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oc(e,t){let n=ac(e);return Math.round(t*n)/n}function sc(e){let t=b.useRef(e);return rc(()=>{t.current=e}),t}function cc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);ic(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=sc(c),O=sc(i),k=sc(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),nc(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!ic(T.current,t)&&(T.current=t,P.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);rc(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);rc(()=>(j.current=!0,()=>{j.current=!1}),[]),rc(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),ee=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=oc(N.floating,u.x),r=oc(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ac(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var lc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ec({element:r.current,padding:i}).fn(n):r?ec({element:r,padding:i}).fn(n):{}}}},uc=(e,t)=>{let n=Ys(e);return{name:n.name,fn:n.fn,options:[e,t]}},dc=(e,t)=>{let n=Xs(e);return{name:n.name,fn:n.fn,options:[e,t]}},fc=(e,t)=>({fn:tc(e).fn,options:[e,t]}),pc=(e,t)=>{let n=Zs(e);return{name:n.name,fn:n.fn,options:[e,t]}},mc=(e,t)=>{let n=Qs(e);return{name:n.name,fn:n.fn,options:[e,t]}},hc=(e,t)=>{let n=$s(e);return{name:n.name,fn:n.fn,options:[e,t]}},gc=(e,t)=>{let n=lc(e);return{name:n.name,fn:n.fn,options:[e,t]}},_c=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),vc=`Arrow`,yc=b.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,C.jsx)(_c.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,C.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});yc.displayName=vc;var bc=yc,xc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Sc=`Popper`,[Cc,wc]=pn(Sc),[Tc,Ec]=Cc(Sc),Dc=e=>{let{__scopePopper:t,children:n}=e,[r,i]=b.useState(null);return(0,C.jsx)(Tc,{scope:t,anchor:r,onAnchorChange:i,children:n})};Dc.displayName=Sc;var Oc=`PopperAnchor`,kc=b.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Ec(Oc,n),o=b.useRef(null),s=Zt(t,o),c=b.useRef(null);return b.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,C.jsx)(xc.div,{...i,ref:s})});kc.displayName=Oc;var Ac=`PopperContent`,[jc,Mc]=Cc(Ac),Nc=b.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Ec(Ac,n),[_,v]=b.useState(null),y=Zt(t,e=>v(e)),[x,S]=b.useState(null),w=io(x),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(Lc),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:te,middlewareData:P}=cc({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>Js(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[uc({mainAxis:i+E,alignmentAxis:o}),c&&dc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?fc():void 0,...j}),c&&pc({...j}),mc({...j,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&gc({element:x,padding:s}),Rc({arrowWidth:T,arrowHeight:E}),f&&hc({strategy:`referenceHidden`,...j})]}),[F,ne]=zc(ee),re=qn(m);gn(()=>{te&&re?.()},[te,re]);let ie=P.arrow?.x,ae=P.arrow?.y,I=P.arrow?.centerOffset!==0,[oe,se]=b.useState();return gn(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,C.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:te?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,C.jsx)(jc,{scope:n,placedSide:F,onArrowChange:S,arrowX:ie,arrowY:ae,shouldHideArrow:I,children:(0,C.jsx)(xc.div,{"data-side":F,"data-align":ne,...h,ref:y,style:{...h.style,animation:te?void 0:`none`}})})})});Nc.displayName=Ac;var Pc=`PopperArrow`,Fc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Ic=b.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Mc(Pc,n),a=Fc[i.placedSide];return(0,C.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,C.jsx)(bc,{...r,ref:t,style:{...r.style,display:`block`}})})});Ic.displayName=Pc;function Lc(e){return e!==null}var Rc=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=zc(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function zc(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Bc=Dc,Vc=kc,Hc=Nc,Uc=Ic,Wc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Gc(e,t){e&&P.flushSync(()=>e.dispatchEvent(t))}var Kc=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),qc=`rovingFocusGroup.onEntryFocus`,Jc={bubbles:!1,cancelable:!0},Yc=`RovingFocusGroup`,[Xc,Zc,Qc]=hn(Yc),[$c,el]=pn(Yc,[Qc]),[tl,nl]=$c(Yc),rl=b.forwardRef((e,t)=>(0,C.jsx)(Xc.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,C.jsx)(Xc.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,C.jsx)(il,{...e,ref:t})})}));rl.displayName=Yc;var il=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=b.useRef(null),p=Zt(t,f),m=Wn(a),[h,g]=vn({prop:o,defaultProp:s??null,onChange:c,caller:Yc}),[_,v]=b.useState(!1),y=qn(l),x=Zc(n),S=b.useRef(!1),[w,T]=b.useState(0);return b.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(qc,y),()=>e.removeEventListener(qc,y)},[y]),(0,C.jsx)(tl,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:b.useCallback(e=>g(e),[g]),onItemShiftTab:b.useCallback(()=>v(!0),[]),onFocusableItemAdd:b.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:b.useCallback(()=>T(e=>e-1),[]),children:(0,C.jsx)(Kc.div,{tabIndex:_||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:R(e.onMouseDown,()=>{S.current=!0}),onFocus:R(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(qc,Jc);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);ul([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:R(e.onBlur,()=>v(!1))})})}),al=`RovingFocusGroupItem`,ol=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=kn(),l=a||c,u=nl(al,n),d=u.currentTabStopId===l,f=Zc(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return b.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,C.jsx)(Xc.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,C.jsx)(Kc.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:R(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:R(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ll(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?dl(n,r+1):n.slice(r+1)}setTimeout(()=>ul(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});ol.displayName=al;var sl={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function cl(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ll(e,t,n){let r=cl(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return sl[r]}function ul(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function dl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fl=rl,pl=ol,ml=[`Enter`,` `],hl=[`ArrowDown`,`PageUp`,`Home`],gl=[`ArrowUp`,`PageDown`,`End`],_l=[...hl,...gl],vl={ltr:[...ml,`ArrowRight`],rtl:[...ml,`ArrowLeft`]},yl={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},bl=`Menu`,[xl,Sl,Cl]=hn(bl),[wl,Tl]=pn(bl,[Cl,wc,el]),El=wc(),Dl=el(),[Ol,kl]=wl(bl),[Al,jl]=wl(bl),Ml=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=El(t),[c,l]=b.useState(null),u=b.useRef(!1),d=qn(a),f=Wn(i);return b.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,C.jsx)(Bc,{...s,children:(0,C.jsx)(Ol,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,C.jsx)(Al,{scope:t,onClose:b.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Ml.displayName=bl;var Nl=`MenuAnchor`,Pl=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=El(n);return(0,C.jsx)(Vc,{...i,...r,ref:t})});Pl.displayName=Nl;var Fl=`MenuPortal`,[Il,Ll]=wl(Fl,{forceMount:void 0}),Rl=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=kl(Fl,t);return(0,C.jsx)(Il,{scope:t,forceMount:n,children:(0,C.jsx)(Cn,{present:n||a.open,children:(0,C.jsx)(Dr,{asChild:!0,container:i,children:r})})})};Rl.displayName=Fl;var zl=`MenuContent`,[Bl,Vl]=wl(zl),Hl=b.forwardRef((e,t)=>{let n=Ll(zl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=kl(zl,e.__scopeMenu),o=jl(zl,e.__scopeMenu);return(0,C.jsx)(xl.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(Cn,{present:r||a.open,children:(0,C.jsx)(xl.Slot,{scope:e.__scopeMenu,children:o.modal?(0,C.jsx)(Ul,{...i,ref:t}):(0,C.jsx)(Wl,{...i,ref:t})})})})}),Ul=b.forwardRef((e,t)=>{let n=kl(zl,e.__scopeMenu),r=b.useRef(null),i=Zt(t,r);return b.useEffect(()=>{let e=r.current;if(e)return Yi(e)},[]),(0,C.jsx)(Kl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Wl=b.forwardRef((e,t)=>{let n=kl(zl,e.__scopeMenu);return(0,C.jsx)(Kl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Gl=Qt(`MenuContent.ScrollLock`),Kl=b.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=kl(zl,n),_=jl(zl,n),v=El(n),y=Dl(n),x=Sl(n),[S,w]=b.useState(null),T=b.useRef(null),E=Zt(t,T,g.onContentChange),D=b.useRef(0),O=b.useRef(``),k=b.useRef(0),A=b.useRef(null),j=b.useRef(`right`),M=b.useRef(0),N=m?Bi:b.Fragment,ee=m?{as:Gl,allowPinchZoom:!0}:void 0,te=e=>{let t=O.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Ou(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};b.useEffect(()=>()=>window.clearTimeout(D.current),[]),Ar();let P=b.useCallback(e=>j.current===A.current?.side&&Au(e,A.current?.area),[]);return(0,C.jsx)(Bl,{scope:n,searchRef:O,onItemEnter:b.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:b.useCallback(e=>{P(e)||(T.current?.focus(),w(null))},[P]),onTriggerLeave:b.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:k,onPointerGraceIntentChange:b.useCallback(e=>{A.current=e},[]),children:(0,C.jsx)(N,{...ee,children:(0,C.jsx)(pr,{asChild:!0,trapped:i,onMountAutoFocus:R(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,C.jsx)(tr,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,C.jsx)(fl,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:w,onEntryFocus:R(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,C.jsx)(Hc,{role:`menu`,"aria-orientation":`vertical`,"data-state":Cu(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:E,style:{outline:`none`,...h.style},onKeyDown:R(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&te(e.key));let i=T.current;if(e.target!==i||!_l.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);gl.includes(e.key)&&a.reverse(),Eu(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:R(e.onPointerMove,ju(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(j.current=e.clientX>M.current?`right`:`left`,M.current=e.clientX)}))})})})})})})});Hl.displayName=zl;var B=`MenuGroup`,V=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,C.jsx)(Wc.div,{role:`group`,...r,ref:t})});V.displayName=B;var ql=`MenuLabel`,Jl=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,C.jsx)(Wc.div,{...r,ref:t})});Jl.displayName=ql;var Yl=`MenuItem`,Xl=`menu.itemSelect`,Zl=b.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=b.useRef(null),o=jl(Yl,e.__scopeMenu),s=Vl(Yl,e.__scopeMenu),c=Zt(t,a),l=b.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Xl,{bubbles:!0,cancelable:!0});e.addEventListener(Xl,e=>r?.(e),{once:!0}),Gc(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,C.jsx)(Ql,{...i,ref:c,disabled:n,onClick:R(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:R(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||ml.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Zl.displayName=Yl;var Ql=b.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Vl(Yl,n),s=Dl(n),c=b.useRef(null),l=Zt(t,c),[u,d]=b.useState(!1),[f,p]=b.useState(``);return b.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,C.jsx)(xl.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,C.jsx)(pl,{asChild:!0,...s,focusable:!r,children:(0,C.jsx)(Wc.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:R(e.onPointerMove,ju(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,ju(e=>o.onItemLeave(e))),onFocus:R(e.onFocus,()=>d(!0)),onBlur:R(e.onBlur,()=>d(!1))})})})}),$l=`MenuCheckboxItem`,eu=b.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,C.jsx)(cu,{scope:e.__scopeMenu,checked:n,children:(0,C.jsx)(Zl,{role:`menuitemcheckbox`,"aria-checked":wu(n)?`mixed`:n,...i,ref:t,"data-state":Tu(n),onSelect:R(i.onSelect,()=>r?.(wu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});eu.displayName=$l;var tu=`MenuRadioGroup`,[nu,ru]=wl(tu,{value:void 0,onValueChange:()=>{}}),iu=b.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=qn(r);return(0,C.jsx)(nu,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,C.jsx)(V,{...i,ref:t})})});iu.displayName=tu;var au=`MenuRadioItem`,ou=b.forwardRef((e,t)=>{let{value:n,...r}=e,i=ru(au,e.__scopeMenu),a=n===i.value;return(0,C.jsx)(cu,{scope:e.__scopeMenu,checked:a,children:(0,C.jsx)(Zl,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Tu(a),onSelect:R(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ou.displayName=au;var su=`MenuItemIndicator`,[cu,lu]=wl(su,{checked:!1}),uu=b.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=lu(su,n);return(0,C.jsx)(Cn,{present:r||wu(a.checked)||a.checked===!0,children:(0,C.jsx)(Wc.span,{...i,ref:t,"data-state":Tu(a.checked)})})});uu.displayName=su;var du=`MenuSeparator`,fu=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,C.jsx)(Wc.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});fu.displayName=du;var pu=`MenuArrow`,mu=b.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=El(n);return(0,C.jsx)(Uc,{...i,...r,ref:t})});mu.displayName=pu;var hu=`MenuSub`,[gu,_u]=wl(hu),vu=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=kl(hu,t),o=El(t),[s,c]=b.useState(null),[l,u]=b.useState(null),d=qn(i);return b.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,C.jsx)(Bc,{...o,children:(0,C.jsx)(Ol,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,C.jsx)(gu,{scope:t,contentId:kn(),triggerId:kn(),trigger:s,onTriggerChange:c,children:n})})})};vu.displayName=hu;var yu=`MenuSubTrigger`,bu=b.forwardRef((e,t)=>{let n=kl(yu,e.__scopeMenu),r=jl(yu,e.__scopeMenu),i=_u(yu,e.__scopeMenu),a=Vl(yu,e.__scopeMenu),o=b.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=b.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return b.useEffect(()=>u,[u]),b.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,C.jsx)(Pl,{asChild:!0,...l,children:(0,C.jsx)(Ql,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Cu(n.open),...e,ref:Xt(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,ju(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,ju(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||vl[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});bu.displayName=yu;var xu=`MenuSubContent`,Su=b.forwardRef((e,t)=>{let n=Ll(zl,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=kl(zl,e.__scopeMenu),o=jl(zl,e.__scopeMenu),s=_u(xu,e.__scopeMenu),c=b.useRef(null),l=Zt(t,c);return(0,C.jsx)(xl.Provider,{scope:e.__scopeMenu,children:(0,C.jsx)(Cn,{present:r||a.open,children:(0,C.jsx)(xl.Slot,{scope:e.__scopeMenu,children:(0,C.jsx)(Kl,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=yl[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Su.displayName=xu;function Cu(e){return e?`open`:`closed`}function wu(e){return e===`indeterminate`}function Tu(e){return wu(e)?`indeterminate`:e?`checked`:`unchecked`}function Eu(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Du(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ou(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Du(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ku(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Au(e,t){return t?ku({x:e.clientX,y:e.clientY},t):!1}function ju(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Mu=Ml,Nu=Pl,Pu=Rl,Fu=Hl,Iu=V,Lu=Jl,Ru=Zl,zu=eu,Bu=iu,Vu=ou,Hu=uu,Uu=fu,Wu=mu,Gu=bu,Ku=Su,qu=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ju=`DropdownMenu`,[Yu,Xu]=pn(Ju,[Tl]),Zu=Tl(),[Qu,$u]=Yu(Ju),ed=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Zu(t),l=b.useRef(null),[u,d]=vn({prop:i,defaultProp:a??!1,onChange:o,caller:Ju});return(0,C.jsx)(Qu,{scope:t,triggerId:kn(),triggerRef:l,contentId:kn(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,C.jsx)(Mu,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};ed.displayName=Ju;var td=`DropdownMenuTrigger`,nd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=$u(td,n),o=Zu(n);return(0,C.jsx)(Nu,{asChild:!0,...o,children:(0,C.jsx)(qu.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Xt(t,a.triggerRef),onPointerDown:R(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});nd.displayName=td;var rd=`DropdownMenuPortal`,id=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Zu(t);return(0,C.jsx)(Pu,{...r,...n})};id.displayName=rd;var ad=`DropdownMenuContent`,od=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$u(ad,n),a=Zu(n),o=b.useRef(!1);return(0,C.jsx)(Fu,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});od.displayName=ad;var sd=`DropdownMenuGroup`,cd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Iu,{...i,...r,ref:t})});cd.displayName=sd;var ld=`DropdownMenuLabel`,ud=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Lu,{...i,...r,ref:t})});ud.displayName=ld;var dd=`DropdownMenuItem`,fd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Ru,{...i,...r,ref:t})});fd.displayName=dd;var pd=`DropdownMenuCheckboxItem`,md=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(zu,{...i,...r,ref:t})});md.displayName=pd;var hd=`DropdownMenuRadioGroup`,gd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Bu,{...i,...r,ref:t})});gd.displayName=hd;var _d=`DropdownMenuRadioItem`,vd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Vu,{...i,...r,ref:t})});vd.displayName=_d;var yd=`DropdownMenuItemIndicator`,bd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Hu,{...i,...r,ref:t})});bd.displayName=yd;var xd=`DropdownMenuSeparator`,Sd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Uu,{...i,...r,ref:t})});Sd.displayName=xd;var Cd=`DropdownMenuArrow`,wd=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Wu,{...i,...r,ref:t})});wd.displayName=Cd;var Td=`DropdownMenuSubTrigger`,Ed=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Gu,{...i,...r,ref:t})});Ed.displayName=Td;var Dd=`DropdownMenuSubContent`,Od=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Zu(n);return(0,C.jsx)(Ku,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Od.displayName=Dd;var kd=ed,H=nd,Ad=id,jd=od,Md=cd,Nd=ud,Pd=fd,Fd=gd,Id=vd,Ld=bd,Rd=Sd,zd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Bd=`Label`,Vd=b.forwardRef((e,t)=>(0,C.jsx)(zd.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Vd.displayName=Bd;var Hd=Vd;function Ud(e,[t,n]){return Math.min(n,Math.max(t,e))}var Wd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Gd=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Kd=[` `,`Enter`],qd=`Select`,[Jd,Yd,Xd]=hn(qd),[Zd,Qd]=pn(qd,[Xd,wc]),$d=wc(),[ef,tf]=Zd(qd),[nf,rf]=Zd(qd),af=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=$d(t),[g,_]=b.useState(null),[v,y]=b.useState(null),[x,S]=b.useState(!1),w=Wn(l),[T,E]=vn({prop:r,defaultProp:i??!1,onChange:a,caller:qd}),[D,O]=vn({prop:o,defaultProp:s,onChange:c,caller:qd}),k=b.useRef(null),A=g?m||!!g.closest(`form`):!0,[j,M]=b.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,C.jsx)(Bc,{...h,children:(0,C.jsxs)(ef,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:kn(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,children:[(0,C.jsx)(Jd.Provider,{scope:t,children:(0,C.jsx)(nf,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:b.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,C.jsxs)(ep,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:D,onChange:e=>O(e.target.value),disabled:f,form:m,children:[D===void 0?(0,C.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};af.displayName=qd;var of=`SelectTrigger`,sf=b.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=$d(n),o=tf(of,n),s=o.disabled||r,c=Zt(t,o.onTriggerChange),l=Yd(n),u=b.useRef(`touch`),[d,f,p]=np(e=>{let t=l().filter(e=>!e.disabled),n=rp(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,C.jsx)(Vc,{asChild:!0,...a,children:(0,C.jsx)(Wd.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":tp(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Gd.includes(e.key)&&(m(),e.preventDefault())})})})});sf.displayName=of;var cf=`SelectValue`,lf=b.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=tf(cf,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Zt(t,c.onValueNodeChange);return gn(()=>{l(u)},[l,u]),(0,C.jsx)(Wd.span,{...s,ref:d,style:{pointerEvents:`none`},children:tp(c.value)?(0,C.jsx)(C.Fragment,{children:o}):a})});lf.displayName=cf;var uf=`SelectIcon`,df=b.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,C.jsx)(Wd.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});df.displayName=uf;var ff=`SelectPortal`,pf=e=>(0,C.jsx)(Dr,{asChild:!0,...e});pf.displayName=ff;var mf=`SelectContent`,hf=b.forwardRef((e,t)=>{let n=tf(mf,e.__scopeSelect),[r,i]=b.useState();if(gn(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?P.createPortal((0,C.jsx)(_f,{scope:e.__scopeSelect,children:(0,C.jsx)(Jd.Slot,{scope:e.__scopeSelect,children:(0,C.jsx)(`div`,{children:e.children})})}),t):null}return(0,C.jsx)(xf,{...e,ref:t})});hf.displayName=mf;var gf=10,[_f,vf]=Zd(mf),yf=`SelectContentImpl`,bf=Qt(`SelectContent.RemoveScroll`),xf=b.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=tf(mf,n),[y,x]=b.useState(null),[S,w]=b.useState(null),T=Zt(t,e=>x(e)),[E,D]=b.useState(null),[O,k]=b.useState(null),A=Yd(n),[j,M]=b.useState(!1),N=b.useRef(!1);b.useEffect(()=>{if(y)return Yi(y)},[y]),Ar();let ee=b.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,S]),te=b.useCallback(()=>ee([E,y]),[ee,E,y]);b.useEffect(()=>{j&&te()},[j,te]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;b.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),b.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[ne,re]=np(e=>{let t=A().filter(e=>!e.disabled),n=rp(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=b.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&(D(e),r&&(N.current=!0))},[v.value]),ae=b.useCallback(()=>y?.focus(),[y]),I=b.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&k(e)},[v.value]),oe=r===`popper`?Tf:Cf,se=oe===Tf?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,C.jsx)(_f,{scope:n,content:y,viewport:S,onViewportChange:w,itemRefCallback:ie,selectedItem:E,onItemLeave:ae,itemTextRefCallback:I,focusSelectedItem:te,selectedItemText:O,position:r,isPositioned:j,searchRef:ne,children:(0,C.jsx)(Bi,{as:bf,allowPinchZoom:!0,children:(0,C.jsx)(pr,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,C.jsx)(tr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,C.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ee(t)),e.preventDefault()}})})})})})})});xf.displayName=yf;var Sf=`SelectItemAlignedPosition`,Cf=b.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=tf(mf,n),o=vf(mf,n),[s,c]=b.useState(null),[l,u]=b.useState(null),d=Zt(t,e=>u(e)),f=Yd(n),p=b.useRef(!1),m=b.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=b.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-gf,d=Ud(a,[gf,Math.max(gf,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-gf,d=Ud(a,[gf,Math.max(gf,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-gf*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-gf,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${gf}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);gn(()=>y(),[y]);let[x,S]=b.useState();return gn(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,C.jsx)(Ef,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:b.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,C.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,C.jsx)(Wd.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Cf.displayName=Sf;var wf=`SelectPopperPosition`,Tf=b.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=gf,...a}=e,o=$d(n);return(0,C.jsx)(Hc,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Tf.displayName=wf;var[Ef,Df]=Zd(mf,{}),Of=`SelectViewport`,kf=b.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=vf(Of,n),o=Df(Of,n),s=Zt(t,a.onViewportChange),c=b.useRef(0);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,C.jsx)(Jd.Slot,{scope:n,children:(0,C.jsx)(Wd.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-gf*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});kf.displayName=Of;var Af=`SelectGroup`,[jf,Mf]=Zd(Af),Nf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=kn();return(0,C.jsx)(jf,{scope:n,id:i,children:(0,C.jsx)(Wd.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Nf.displayName=Af;var Pf=`SelectLabel`,Ff=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Mf(Pf,n);return(0,C.jsx)(Wd.div,{id:i.id,...r,ref:t})});Ff.displayName=Pf;var If=`SelectItem`,[Lf,Rf]=Zd(If),zf=b.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=tf(If,n),c=vf(If,n),l=s.value===r,[u,d]=b.useState(a??``),[f,p]=b.useState(!1),m=Zt(t,e=>c.itemRefCallback?.(e,r,i)),h=kn(),g=b.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,C.jsx)(Lf,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:b.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,C.jsx)(Jd.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,C.jsx)(Wd.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:R(o.onFocus,()=>p(!0)),onBlur:R(o.onBlur,()=>p(!1)),onClick:R(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:R(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:R(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Kd.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});zf.displayName=If;var Bf=`SelectItemText`,Vf=b.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=tf(Bf,n),s=vf(Bf,n),c=Rf(Bf,n),l=rf(Bf,n),[u,d]=b.useState(null),f=Zt(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=b.useMemo(()=>(0,C.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return gn(()=>(h(m),()=>g(m)),[h,g,m]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Wd.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?P.createPortal(a.children,o.valueNode):null]})});Vf.displayName=Bf;var Hf=`SelectItemIndicator`,Uf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Rf(Hf,n).isSelected?(0,C.jsx)(Wd.span,{"aria-hidden":!0,...r,ref:t}):null});Uf.displayName=Hf;var Wf=`SelectScrollUpButton`,Gf=b.forwardRef((e,t)=>{let n=vf(Wf,e.__scopeSelect),r=Df(Wf,e.__scopeSelect),[i,a]=b.useState(!1),o=Zt(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,C.jsx)(Jf,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Gf.displayName=Wf;var Kf=`SelectScrollDownButton`,qf=b.forwardRef((e,t)=>{let n=vf(Kf,e.__scopeSelect),r=Df(Kf,e.__scopeSelect),[i,a]=b.useState(!1),o=Zt(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,C.jsx)(Jf,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});qf.displayName=Kf;var Jf=b.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=vf(`SelectScrollButton`,n),o=b.useRef(null),s=Yd(n),c=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>c(),[c]),gn(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,C.jsx)(Wd.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),Yf=`SelectSeparator`,Xf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,C.jsx)(Wd.div,{"aria-hidden":!0,...r,ref:t})});Xf.displayName=Yf;var Zf=`SelectArrow`,Qf=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$d(n),a=tf(Zf,n),o=vf(Zf,n);return a.open&&o.position===`popper`?(0,C.jsx)(Uc,{...i,...r,ref:t}):null});Qf.displayName=Zf;var $f=`SelectBubbleInput`,ep=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=b.useRef(null),a=Zt(r,i),o=ro(t);return b.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,C.jsx)(Wd.select,{...n,style:{...cn,...n.style},ref:a,defaultValue:t})});ep.displayName=$f;function tp(e){return e===``||e===void 0}function np(e){let t=qn(e),n=b.useRef(``),r=b.useRef(0),i=b.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=b.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function rp(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ip(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ip(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ap=af,op=sf,sp=lf,cp=df,lp=pf,up=hf,dp=kf,fp=zf,pp=Vf,mp=Uf,hp=Gf,gp=qf,_p=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),vp=`Separator`,yp=`horizontal`,bp=[`horizontal`,`vertical`],xp=b.forwardRef((e,t)=>{let{decorative:n,orientation:r=yp,...i}=e,a=Sp(r)?r:yp,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,C.jsx)(_p.div,{"data-orientation":a,...o,...i,ref:t})});xp.displayName=vp;function Sp(e){return bp.includes(e)}var Cp=xp,wp=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Tp=`Switch`,[Ep,Dp]=pn(Tp),[Op,kp]=Ep(Tp),Ap=b.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=b.useState(null),m=Zt(t,e=>p(e)),h=b.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=vn({prop:i,defaultProp:a??!1,onChange:l,caller:Tp});return(0,C.jsxs)(Op,{scope:n,checked:_,disabled:s,children:[(0,C.jsx)(wp.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":Fp(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:R(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,C.jsx)(Pp,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Ap.displayName=Tp;var jp=`SwitchThumb`,Mp=b.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=kp(jp,n);return(0,C.jsx)(wp.span,{"data-state":Fp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Mp.displayName=jp;var Np=`SwitchBubbleInput`,Pp=b.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=b.useRef(null),s=Zt(o,a),c=ro(n),l=io(t);return b.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,C.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Pp.displayName=Np;function Fp(e){return e?`checked`:`unchecked`}var Ip=Ap,Lp=Mp,Rp=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),zp=`Tabs`,[Bp,Vp]=pn(zp,[el]),Hp=el(),[Up,Wp]=Bp(zp),Gp=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Wn(s),[d,f]=vn({prop:r,onChange:i,defaultProp:a??``,caller:zp});return(0,C.jsx)(Up,{scope:n,baseId:kn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,C.jsx)(Rp.div,{dir:u,"data-orientation":o,...l,ref:t})})});Gp.displayName=zp;var Kp=`TabsList`,qp=b.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Wp(Kp,n),o=Hp(n);return(0,C.jsx)(fl,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,C.jsx)(Rp.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});qp.displayName=Kp;var Jp=`TabsTrigger`,Yp=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Wp(Jp,n),s=Hp(n),c=Qp(o.baseId,r),l=$p(o.baseId,r),u=r===o.value;return(0,C.jsx)(pl,{asChild:!0,...s,focusable:!i,active:u,children:(0,C.jsx)(Rp.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:R(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:R(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Yp.displayName=Jp;var Xp=`TabsContent`,Zp=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Wp(Xp,n),c=Qp(s.baseId,r),l=$p(s.baseId,r),u=r===s.value,d=b.useRef(u);return b.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,C.jsx)(Cn,{present:i||u,children:({present:n})=>(0,C.jsx)(Rp.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Zp.displayName=Xp;function Qp(e,t){return`${e}-trigger-${t}`}function $p(e,t){return`${e}-content-${t}`}var em=Gp,tm=qp,nm=Yp,rm=Zp,im=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Qt(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,C.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),[am,om]=pn(`Tooltip`,[wc]),sm=wc(),cm=`TooltipProvider`,lm=700,um=`tooltip.open`,[dm,fm]=am(cm),pm=e=>{let{__scopeTooltip:t,delayDuration:n=lm,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,C.jsx)(dm,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};pm.displayName=cm;var mm=`Tooltip`,[hm,gm]=am(mm),_m=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=fm(mm,e.__scopeTooltip),l=sm(t),[u,d]=b.useState(null),f=kn(),p=b.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=b.useRef(!1),[_,v]=vn({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(um))):c.onClose(),a?.(e)},caller:mm}),y=b.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),x=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),S=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),w=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return b.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,C.jsx)(Bc,{...l,children:(0,C.jsx)(hm,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?w():x()},[c.isOpenDelayedRef,w,x]),onTriggerLeave:b.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};_m.displayName=mm;var vm=`TooltipTrigger`,ym=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=gm(vm,n),a=fm(vm,n),o=sm(n),s=Zt(t,b.useRef(null),i.onTriggerChange),c=b.useRef(!1),l=b.useRef(!1),u=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,C.jsx)(Vc,{asChild:!0,...o,children:(0,C.jsx)(im.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:R(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:R(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:R(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:R(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:R(e.onBlur,i.onClose),onClick:R(e.onClick,i.onClose)})})});ym.displayName=vm;var bm=`TooltipPortal`,[xm,Sm]=am(bm,{forceMount:void 0}),Cm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=gm(bm,t);return(0,C.jsx)(xm,{scope:t,forceMount:n,children:(0,C.jsx)(Cn,{present:n||a.open,children:(0,C.jsx)(Dr,{asChild:!0,container:i,children:r})})})};Cm.displayName=bm;var wm=`TooltipContent`,Tm=b.forwardRef((e,t)=>{let n=Sm(wm,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=gm(wm,e.__scopeTooltip);return(0,C.jsx)(Cn,{present:r||o.open,children:o.disableHoverableContent?(0,C.jsx)(Am,{side:i,...a,ref:t}):(0,C.jsx)(Em,{side:i,...a,ref:t})})}),Em=b.forwardRef((e,t)=>{let n=gm(wm,e.__scopeTooltip),r=fm(wm,e.__scopeTooltip),i=b.useRef(null),a=Zt(t,i),[o,s]=b.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=b.useCallback(()=>{s(null),d(!1)},[d]),p=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Pm(r,Nm(r,n.getBoundingClientRect())),a=Fm(t.getBoundingClientRect());s(Lm([...i,...a])),d(!0)},[d]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Im(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,C.jsx)(Am,{...e,ref:a})}),[Dm,Om]=am(mm,{isInside:!1}),km=nn(`TooltipContent`),Am=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=gm(wm,n),l=sm(n),{onClose:u}=c;return b.useEffect(()=>(document.addEventListener(um,u),()=>document.removeEventListener(um,u)),[u]),b.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,C.jsx)(tr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,C.jsxs)(Hc,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,C.jsx)(km,{children:r}),(0,C.jsx)(Dm,{scope:n,isInside:!0,children:(0,C.jsx)(dn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Tm.displayName=wm;var jm=`TooltipArrow`,Mm=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=sm(n);return Om(jm,n).isInside?null:(0,C.jsx)(Uc,{...i,...r,ref:t})});Mm.displayName=jm;function Nm(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Pm(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Fm(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Im(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Lm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Rm(t)}function Rm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var zm=pm,Bm=_m,Vm=ym,Hm=Cm,Um=Tm,Wm=Mm;function Gm(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Gm(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Km(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Gm(e))&&(r&&(r+=` `),r+=t);return r}var qm=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Jm=(e,t)=>({classGroupId:e,validator:t}),Ym=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Xm=`-`,Zm=[],Qm=`arbitrary..`,$m=e=>{let t=nh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return th(e);let n=e.split(Xm);return eh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?qm(i,t):t:i||Zm}return n[e]||Zm}}},eh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=eh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Xm):e.slice(t).join(Xm),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},th=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Qm+r:void 0})(),nh=e=>{let{theme:t,classGroups:n}=e;return rh(n,t)},rh=(e,t)=>{let n=Ym();for(let r in e){let i=e[r];ih(i,n,r,t)}return n},ih=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];ah(i,t,n,r)}},ah=(e,t,n,r)=>{if(typeof e==`string`){oh(e,t,n);return}if(typeof e==`function`){sh(e,t,n,r);return}ch(e,t,n,r)},oh=(e,t,n)=>{let r=e===``?t:lh(t,e);r.classGroupId=n},sh=(e,t,n,r)=>{if(uh(e)){ih(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Jm(n,e))},ch=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ih(o,lh(t,a),n,r)}},lh=(e,t)=>{let n=e,r=t.split(Xm),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ym(),n.nextPart.set(t,i)),n=i}return n},uh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,dh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},fh=`!`,ph=`:`,mh=[],hh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),gh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===ph){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(fh)?(c=s.slice(0,-1),l=!0):s.startsWith(fh)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return hh(t,l,c,u)};if(t){let e=t+ph,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):hh(mh,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},_h=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},vh=e=>({cache:dh(e.cacheSize),parseClassName:gh(e),sortModifiers:_h(e),postfixLookupClassGroupIds:yh(e),...$m(e)}),yh=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},bh=/\s+/,xh=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(bh),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+fh:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Sh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Ch(n))&&(i&&(i+=` `),i+=r);return i},Ch=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Ch(e[r]))&&(n&&(n+=` `),n+=t);return n},wh=(e,...t)=>{let n,r,i,a,o=o=>(n=vh(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=xh(e,n);return i(e,a),a};return a=o,(...e)=>a(Sh(...e))},Th=[],Eh=e=>{let t=t=>t[e]||Th;return t.isThemeGetter=!0,t},Dh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ah=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Nh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ph=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fh=e=>kh.test(e),U=e=>!!e&&!Number.isNaN(Number(e)),Ih=e=>!!e&&Number.isInteger(Number(e)),Lh=e=>e.endsWith(`%`)&&U(e.slice(0,-1)),Rh=e=>Ah.test(e),zh=()=>!0,Bh=e=>jh.test(e)&&!Mh.test(e),Vh=()=>!1,Hh=e=>Nh.test(e),Uh=e=>Ph.test(e),Wh=e=>!W(e)&&!G(e),Gh=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Kh=e=>sg(e,dg,Vh),W=e=>Dh.test(e),qh=e=>sg(e,fg,Bh),Jh=e=>sg(e,pg,U),Yh=e=>sg(e,hg,zh),Xh=e=>sg(e,mg,Vh),Zh=e=>sg(e,lg,Vh),Qh=e=>sg(e,ug,Uh),$h=e=>sg(e,gg,Hh),G=e=>Oh.test(e),eg=e=>cg(e,fg),tg=e=>cg(e,mg),ng=e=>cg(e,lg),rg=e=>cg(e,dg),ig=e=>cg(e,ug),ag=e=>cg(e,gg,!0),og=e=>cg(e,hg,!0),sg=(e,t,n)=>{let r=Dh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},cg=(e,t,n=!1)=>{let r=Oh.exec(e);return r?r[1]?t(r[1]):n:!1},lg=e=>e===`position`||e===`percentage`,ug=e=>e===`image`||e===`url`,dg=e=>e===`length`||e===`size`||e===`bg-size`,fg=e=>e===`length`,pg=e=>e===`number`,mg=e=>e===`family-name`,hg=e=>e===`number`||e===`weight`,gg=e=>e===`shadow`,_g=wh(()=>{let e=Eh(`color`),t=Eh(`font`),n=Eh(`text`),r=Eh(`font-weight`),i=Eh(`tracking`),a=Eh(`leading`),o=Eh(`breakpoint`),s=Eh(`container`),c=Eh(`spacing`),l=Eh(`radius`),u=Eh(`shadow`),d=Eh(`inset-shadow`),f=Eh(`text-shadow`),p=Eh(`drop-shadow`),m=Eh(`blur`),h=Eh(`perspective`),g=Eh(`aspect`),_=Eh(`ease`),v=Eh(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[Fh,`full`,`auto`,...w()],E=()=>[Ih,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,Ih,G,W]},Ih,G,W],O=()=>[Ih,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Fh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Fh,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],te=()=>[Fh,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,G,W],F=()=>[...b(),ng,Zh,{position:[G,W]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,rg,Kh,{size:[G,W]}],ie=()=>[Lh,eg,qh],ae=()=>[``,`none`,`full`,l,G,W],I=()=>[``,U,eg,qh],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[U,Lh,ng,Zh],le=()=>[``,`none`,m,G,W],ue=()=>[`none`,U,G,W],de=()=>[`none`,U,G,W],fe=()=>[U,G,W],pe=()=>[Fh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Rh],breakpoint:[Rh],color:[zh],container:[Rh],"drop-shadow":[Rh],ease:[`in`,`out`,`in-out`],font:[Wh],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Rh],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Rh],shadow:[Rh],spacing:[`px`,U],text:[Rh],"text-shadow":[Rh],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Fh,W,G,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,G,W]}],"container-named":[Gh],columns:[{columns:[U,W,G,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ih,`auto`,G,W]}],basis:[{basis:[Fh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[U,Fh,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,U,G,W]}],shrink:[{shrink:[``,U,G,W]}],order:[{order:[Ih,`first`,`last`,`none`,G,W]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...te()]}],"min-block-size":[{"min-block":[`auto`,...te()]}],"max-block-size":[{"max-block":[`none`,...te()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,eg,qh]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,og,Yh]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Lh,W]}],"font-family":[{font:[tg,Xh,t]}],"font-features":[{"font-features":[W]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,G,W]}],"line-clamp":[{"line-clamp":[U,`none`,G,Jh]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[U,`from-font`,`auto`,G,qh]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[U,`auto`,G,W]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Ih,G,W]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,G,W]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,G,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ih,G,W],radial:[``,G,W],conic:[Ih,G,W]},ig,Qh]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":I()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[U,G,W]}],"outline-w":[{outline:[``,U,eg,qh]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,ag,$h]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,ag,$h]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:I()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[U,qh]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,ag,$h]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[U,G,W]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[U]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[U]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:le()}],brightness:[{brightness:[U,G,W]}],contrast:[{contrast:[U,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ag,$h]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,U,G,W]}],"hue-rotate":[{"hue-rotate":[U,G,W]}],invert:[{invert:[``,U,G,W]}],saturate:[{saturate:[U,G,W]}],sepia:[{sepia:[``,U,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[U,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[U,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,U,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[U,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,U,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[U,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[U,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,U,G,W]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[U,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[U,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],zoom:[{zoom:[Ih,G,W]}],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,G,W]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,G,W]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[U,eg,qh,Jh]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function K(...e){return _g(Km(e))}function vg({delayDuration:e=0,...t}){return(0,C.jsx)(zm,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function yg({...e}){return(0,C.jsx)(Bm,{"data-slot":`tooltip`,...e})}function bg({...e}){return(0,C.jsx)(Vm,{"data-slot":`tooltip-trigger`,...e})}function xg({className:e,sideOffset:t=0,children:n,...r}){return(0,C.jsx)(Hm,{children:(0,C.jsxs)(Um,{"data-slot":`tooltip-content`,sideOffset:t,className:K(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,C.jsx)(Wm,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var Sg=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Cg=Km,wg=(e,t)=>n=>{if(t?.variants==null)return Cg(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Sg(t)||Sg(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Cg(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Tg=`(max-width: 767px)`;function Eg(){return window.matchMedia(Tg).matches}function Dg(){return!1}function Og(e){let t=window.matchMedia(Tg);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function kg(){return b.useSyncExternalStore(Og,Eg,Dg)}var Ag=wg(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow,transform] duration-150 ease-[var(--natroc-ease-out)] outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:scale-[0.98] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 motion-reduce:transition-colors motion-reduce:active:not-aria-[haspopup]:scale-100 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,C.jsx)(r?$t:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:K(Ag({variant:t,size:n,className:e})),...i})}function jg({className:e,type:t,...n}){return(0,C.jsx)(`input`,{type:t,"data-slot":`input`,className:K(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Mg({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,C.jsx)(Cp,{"data-slot":`separator`,decorative:n,orientation:t,className:K(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function Ng({...e}){return(0,C.jsx)(Aa,{"data-slot":`sheet`,...e})}function Pg({...e}){return(0,C.jsx)(ja,{"data-slot":`sheet-portal`,...e})}function Fg({className:e,...t}){return(0,C.jsx)(Ma,{"data-slot":`sheet-overlay`,className:K(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ig({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,C.jsxs)(Pg,{children:[(0,C.jsx)(Fg,{}),(0,C.jsxs)(Na,{"data-slot":`sheet-content`,"data-side":n,className:K(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,C.jsx)(Ia,{"data-slot":`sheet-close`,asChild:!0,children:(0,C.jsxs)(q,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,C.jsx)(qt,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Lg({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sheet-header`,className:K(`flex flex-col gap-0.5 p-4`,e),...t})}function Rg({className:e,...t}){return(0,C.jsx)(Pa,{"data-slot":`sheet-title`,className:K(`font-heading text-base font-medium text-foreground`,e),...t})}function zg({className:e,...t}){return(0,C.jsx)(Fa,{"data-slot":`sheet-description`,className:K(`text-sm text-muted-foreground`,e),...t})}var Bg=`sidebar_state`,Vg=3600*24*7,Hg=`16rem`,Ug=`18rem`,Wg=`3rem`,Gg=`b`,Kg=b.createContext(null);function qg(){let e=b.useContext(Kg);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Jg({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=kg(),[c,l]=b.useState(!1),[u,d]=b.useState(e),f=t??u,p=b.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Bg}=${t}; path=/; max-age=${Vg}`},[n,f]),m=b.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);b.useEffect(()=>{let e=e=>{e.key===Gg&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=b.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,C.jsx)(Kg.Provider,{value:g,children:(0,C.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Hg,"--sidebar-width-icon":Wg,...i},className:K(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Yg({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=qg();return n===`none`?(0,C.jsx)(`div`,{"data-slot":`sidebar`,className:K(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,C.jsx)(Ng,{open:l,onOpenChange:u,...o,children:(0,C.jsxs)(Ig,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Ug},side:e,children:[(0,C.jsxs)(Lg,{className:`sr-only`,children:[(0,C.jsx)(Rg,{children:`Sidebar`}),(0,C.jsx)(zg,{children:`Displays the mobile sidebar.`})]}),(0,C.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,C.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,C.jsx)(`div`,{"data-slot":`sidebar-gap`,className:K(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,C.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:K(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,C.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Xg({className:e,onClick:t,...n}){let{toggleSidebar:r}=qg();return(0,C.jsxs)(q,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:K(e),onClick:e=>{t?.(e),r()},...n,children:[(0,C.jsx)(kt,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Zg({className:e,...t}){return(0,C.jsx)(`main`,{"data-slot":`sidebar-inset`,className:K(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,e),...t})}function Qg({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:K(`flex flex-col gap-2 p-2`,e),...t})}function $g({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:K(`flex flex-col gap-2 p-2`,e),...t})}function e_({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:K(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function t_({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:K(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function n_({className:e,asChild:t=!1,...n}){return(0,C.jsx)(t?$t:`div`,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:K(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e),...n})}function r_({className:e,...t}){return(0,C.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:K(`flex w-full min-w-0 flex-col gap-0`,e),...t})}function i_({className:e,...t}){return(0,C.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:K(`group/menu-item relative`,e),...t})}var a_=wg(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function o_({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let s=e?$t:`button`,{isMobile:c,state:l}=qg(),u=(0,C.jsx)(s,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:K(a_({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,C.jsxs)(yg,{children:[(0,C.jsx)(bg,{asChild:!0,children:u}),(0,C.jsx)(xg,{side:`right`,align:`center`,hidden:l!==`collapsed`||c,...i})]})):u}function s_({className:e,asChild:t=!1,showOnHover:n=!1,...r}){return(0,C.jsx)(t?$t:`button`,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:K(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,e),...r})}function c_({className:e,...t}){return(0,C.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:K(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,e),...t})}function l_({className:e,...t}){return(0,C.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:K(`group/menu-sub-item relative`,e),...t})}function u_({asChild:e=!1,size:t=`md`,isActive:n=!1,className:r,...i}){return(0,C.jsx)(e?$t:`a`,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:K(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,r),...i})}function d_({className:e,...t}){return(0,C.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:K(e),...t})}function f_({className:e,...t}){return(0,C.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:K(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,e),...t})}function p_({className:e,...t}){return(0,C.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:K(`inline-flex items-center gap-1`,e),...t})}function m_({className:e,...t}){return(0,C.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:K(`font-normal text-foreground`,e),...t})}function h_({page:e}){return e?.title?(0,C.jsx)(d_,{children:(0,C.jsx)(f_,{children:(0,C.jsx)(p_,{children:(0,C.jsxs)(m_,{className:`flex items-center gap-2 [&>svg]:size-3.5`,children:[e.icon,e.title]})})})}):null}function g_({className:e,...t}){return(0,C.jsx)(`kbd`,{"data-slot":`kbd`,className:K(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function __({className:e,...t}){return(0,C.jsx)(`kbd`,{"data-slot":`kbd-group`,className:K(`inline-flex items-center gap-1`,e),...t})}function v_(){return(0,C.jsxs)(yg,{delayDuration:1e3,children:[(0,C.jsx)(bg,{asChild:!0,children:(0,C.jsx)(Xg,{})}),(0,C.jsxs)(xg,{className:`px-2 py-1`,side:`right`,children:[`Toggle Sidebar`,` `,(0,C.jsxs)(__,{children:[(0,C.jsx)(g_,{children:`⌘`}),(0,C.jsx)(g_,{children:`b`})]})]})]})}var y_={home:{id:`home`,path:`/`,title:`New Conversation`,icon:(0,C.jsx)(Et,{}),showInPrimaryNav:!1},projects:{id:`projects`,path:`/projects`,title:`Projects`,icon:(0,C.jsx)(ut,{}),showInPrimaryNav:!0},config:{id:`config`,path:`/config`,title:`Config`,icon:(0,C.jsx)(Rt,{}),showInPrimaryNav:!0},account:{id:`account`,path:`/account`,title:`Account Settings`,icon:(0,C.jsx)(Gt,{}),showInPrimaryNav:!1}},b_=Object.values(y_).filter(e=>e.showInPrimaryNav);function x_(e){return e===`/agent`?y_.config:Object.values(y_).find(t=>t.path===e)??null}function S_(e){return e===y_.home.path}function C_({className:e,size:t=`default`,...n}){return(0,C.jsx)(eo,{"data-slot":`avatar`,"data-size":t,className:K(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function w_({className:e,...t}){return(0,C.jsx)(to,{"data-slot":`avatar-image`,className:K(`aspect-square size-full rounded-full object-cover`,e),...t})}function T_({className:e,...t}){return(0,C.jsx)(no,{"data-slot":`avatar-fallback`,className:K(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function E_({...e}){return(0,C.jsx)(kd,{"data-slot":`dropdown-menu`,...e})}function D_({...e}){return(0,C.jsx)(H,{"data-slot":`dropdown-menu-trigger`,...e})}function O_({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,C.jsx)(Ad,{children:(0,C.jsx)(jd,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:K(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function k_({...e}){return(0,C.jsx)(Md,{"data-slot":`dropdown-menu-group`,...e})}function A_({className:e,inset:t,variant:n=`default`,...r}){return(0,C.jsx)(Pd,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:K(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function j_({...e}){return(0,C.jsx)(Fd,{"data-slot":`dropdown-menu-radio-group`,...e})}function M_({className:e,children:t,inset:n,...r}){return(0,C.jsxs)(Id,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:K(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,C.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,C.jsx)(Ld,{children:(0,C.jsx)(Je,{})})}),t]})}function N_({className:e,inset:t,...n}){return(0,C.jsx)(Nd,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:K(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function P_({className:e,...t}){return(0,C.jsx)(Rd,{"data-slot":`dropdown-menu-separator`,className:K(`-mx-1 my-1 h-px bg-border`,e),...t})}var F_=`natroc:token`;function I_(){try{return localStorage.getItem(F_)}catch{return null}}function L_(e){try{localStorage.setItem(F_,e)}catch{}}function R_(){try{localStorage.removeItem(F_)}catch{}}function z_(){return!!I_()}var B_=1,V_=class extends Error{code;constructor(e,t){super(e),this.name=`GatewayError`,this.code=t}};function H_(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/gateway`}function U_(e){return e instanceof V_?e:new V_(e instanceof Error?e.message:`Gateway request failed.`)}function W_(e){return new V_(e?.message??`Gateway request failed.`,e?.code)}function G_(){R_(),typeof window<`u`&&window.location.pathname!==`/login`&&window.location.assign(`/login`)}var J=new class{socket=null;connecting=null;pending=new Map;streams=new Map;broadcastListeners=new Map;lastSeqByEvent=new Map;async call(e,t){return await this.connect(),new Promise((n,r)=>{let i=crypto.randomUUID();this.pending.set(i,{resolve:e=>n(e),reject:r}),this.transmit({type:`req`,id:i,method:e,params:t})})}stream(e,t,n){let r=crypto.randomUUID(),i=!1;return this.connect().then(()=>{i||(this.streams.set(r,n),this.transmit({type:`req`,id:r,method:e,params:t}))},e=>n.onError(U_(e))),()=>{i=!0,this.streams.has(r)&&(this.streams.delete(r),this.transmit({type:`cancel`,id:r}))}}on(e,t){let n=this.broadcastListeners.get(e);return n||(n=new Set,this.broadcastListeners.set(e,n)),n.add(t),()=>{n?.delete(t)}}connect(){return this.socket?.readyState===WebSocket.OPEN&&this.connecting===null?Promise.resolve():(this.connecting||=new Promise((e,t)=>{let n=new WebSocket(H_());this.socket=n;let r=I_(),i=!!r,a=crypto.randomUUID();this.pending.set(a,{resolve:n=>{if(i&&n?.auth?.ok===!1){G_();let e=new V_(`Session is invalid or expired.`,`unauthenticated`);this.connecting=null,t(e);return}this.connecting=null,e()},reject:e=>{this.connecting=null,t(e)}}),n.addEventListener(`open`,()=>{this.transmit({type:`connect`,id:a,params:{protocol:B_,auth:r?{token:r}:void 0,client:{id:`natroc-web`,mode:`ui`,version:`0.0.1`}}})}),n.addEventListener(`message`,e=>{this.handleFrame(e.data)}),n.addEventListener(`close`,()=>{this.handleClose()})}),this.connecting)}transmit(e){this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify(e))}handleFrame(e){if(typeof e!=`string`)return;let t;try{t=JSON.parse(e)}catch{return}if(t.type===`res`){!t.ok&&t.error?.code===`unauthenticated`&&G_();let e=this.pending.get(t.id);if(e){this.pending.delete(t.id),t.ok?e.resolve(t.payload):e.reject(W_(t.error));return}let n=this.streams.get(t.id);n&&(this.streams.delete(t.id),t.ok?n.onEnd(t.payload):n.onError(W_(t.error)));return}if(t.type===`event`){if(t.id){this.streams.get(t.id)?.onEvent(t.payload);return}let e=this.broadcastListeners.get(t.event);if(!e||e.size===0)return;let n=this.lastSeqByEvent.get(t.event),r=t.seq,i=n!==void 0&&r!==void 0&&r>n+1;r!==void 0&&this.lastSeqByEvent.set(t.event,r);let a={seq:r,stateVersion:t.stateVersion,gap:i};for(let n of e)n(t.payload,a);return}}handleClose(){this.socket=null,this.connecting=null;let e=new V_(`Gateway connection closed.`,`connection_closed`);for(let t of this.pending.values())t.reject(e);this.pending.clear();for(let t of this.streams.values())t.onError(e);this.streams.clear()}};function K_(e,t){return J.call(`auth.login`,{username:e,password:t})}function q_(e){return J.call(`auth.register`,e)}async function J_(){if(!I_())return null;try{return(await J.call(`auth.me`)).user}catch{return null}}async function Y_(){if(I_())try{await J.call(`auth.logout`)}catch{}}function X_(e){return J.call(`auth.updatePassword`,e)}function Z_(e){return J.call(`auth.updateAvatar`,e)}function Q_(){let[e,t]=(0,b.useState)({name:`Natroc user`,handle:``,avatarUrl:null});(0,b.useEffect)(()=>{let e=!0,n=e=>{t({name:e.fullName,handle:`@${e.username}`,avatarUrl:e.avatarUrl})};J_().then(t=>{e&&t&&n(t)});let r=e=>{let t=e;t.detail&&n(t.detail)};return window.addEventListener(`natroc:user-updated`,r),()=>{e=!1,window.removeEventListener(`natroc:user-updated`,r)}},[]);let n=async()=>{await Y_(),R_(),window.location.assign(`/login`)},r=e.name.trim().charAt(0).toUpperCase()||`N`;return(0,C.jsxs)(E_,{children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsxs)(C_,{className:`size-8`,children:[e.avatarUrl&&(0,C.jsx)(w_,{src:e.avatarUrl,alt:e.name}),(0,C.jsx)(T_,{children:r})]})}),(0,C.jsxs)(O_,{align:`end`,className:`w-60`,children:[(0,C.jsx)(A_,{className:`flex items-center justify-start gap-2`,children:(0,C.jsxs)(N_,{className:`flex items-center gap-3`,children:[(0,C.jsxs)(C_,{className:`size-10`,children:[e.avatarUrl&&(0,C.jsx)(w_,{src:e.avatarUrl,alt:e.name}),(0,C.jsx)(T_,{children:r})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),` `,(0,C.jsx)(`br`,{}),(0,C.jsx)(`div`,{className:`max-w-full overflow-hidden text-xs overflow-ellipsis whitespace-nowrap text-muted-foreground`,children:e.handle})]})]})}),(0,C.jsx)(P_,{}),(0,C.jsx)(k_,{children:(0,C.jsxs)(A_,{onSelect:()=>window.location.assign(y_.account.path),children:[(0,C.jsx)(Gt,{}),`Account Settings`]})}),(0,C.jsx)(P_,{}),(0,C.jsxs)(k_,{children:[(0,C.jsxs)(A_,{children:[(0,C.jsx)(Ue,{}),`Notifications`]}),(0,C.jsxs)(A_,{children:[(0,C.jsx)(nt,{}),`Keyboard shortcuts`]})]}),(0,C.jsx)(P_,{}),(0,C.jsxs)(k_,{children:[(0,C.jsxs)(A_,{children:[(0,C.jsx)(yt,{}),`Help center`]}),(0,C.jsxs)(A_,{children:[(0,C.jsx)(ft,{}),`Agent training`]})]}),(0,C.jsx)(P_,{}),(0,C.jsx)(k_,{children:(0,C.jsxs)(A_,{children:[(0,C.jsx)(rt,{}),`Subscription`]})}),(0,C.jsx)(P_,{}),(0,C.jsx)(k_,{children:(0,C.jsxs)(A_,{className:`w-full cursor-pointer`,variant:`destructive`,onSelect:()=>{n()},children:[(0,C.jsx)(wt,{}),`Log out`]})})]})]})}var $_=({size:e=24,style:t,...n})=>(0,C.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,width:e,height:e,style:{width:e,height:e,minWidth:e,minHeight:e,...t},...n,children:[(0,C.jsx)(`title`,{children:`Github`}),(0,C.jsx)(`path`,{d:`M12 0c6.63 0 12 5.276 12 11.79-.001 5.067-3.29 9.567-8.175 11.187-.6.118-.825-.25-.825-.56 0-.398.015-1.665.015-3.242 0-1.105-.375-1.813-.81-2.181 2.67-.295 5.475-1.297 5.475-5.822 0-1.297-.465-2.344-1.23-3.169.12-.295.54-1.503-.12-3.125 0 0-1.005-.324-3.3 1.209a11.32 11.32 0 00-3-.398c-1.02 0-2.04.133-3 .398-2.295-1.518-3.3-1.209-3.3-1.209-.66 1.622-.24 2.83-.12 3.125-.765.825-1.23 1.887-1.23 3.169 0 4.51 2.79 5.527 5.46 5.822-.345.294-.66.81-.765 1.577-.69.31-2.415.81-3.495-.973-.225-.354-.9-1.223-1.845-1.209-1.005.015-.405.56.015.781.51.28 1.095 1.327 1.23 1.666.24.663 1.02 1.93 4.035 1.385 0 .988.015 1.916.015 2.196 0 .31-.225.664-.825.56C3.303 21.374-.003 16.867 0 11.791 0 5.276 5.37 0 12 0z`})]}),ev=({size:e=24,style:t,...n})=>(0,C.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,width:e,height:e,style:{width:e,height:e,minWidth:e,minHeight:e,...t},...n,children:[(0,C.jsx)(`title`,{children:`Ollama`}),(0,C.jsx)(`path`,{d:`M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z`})]}),tv=({size:e=24,style:t,...n})=>(0,C.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,width:e,height:e,style:{width:e,height:e,minWidth:e,minHeight:e,...t},...n,children:[(0,C.jsx)(`title`,{children:`OpenRouter`}),(0,C.jsx)(`path`,{d:`M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z`})]});function nv({...e}){return(0,C.jsx)(Aa,{"data-slot":`dialog`,...e})}function rv({...e}){return(0,C.jsx)(ja,{"data-slot":`dialog-portal`,...e})}function iv({...e}){return(0,C.jsx)(Ia,{"data-slot":`dialog-close`,...e})}function av({className:e,...t}){return(0,C.jsx)(Ma,{"data-slot":`dialog-overlay`,className:K(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function ov({className:e,children:t,showCloseButton:n=!0,...r}){return(0,C.jsxs)(rv,{children:[(0,C.jsx)(av,{}),(0,C.jsxs)(Na,{"data-slot":`dialog-content`,className:K(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,C.jsx)(Ia,{"data-slot":`dialog-close`,asChild:!0,children:(0,C.jsxs)(q,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,C.jsx)(qt,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function sv({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`dialog-header`,className:K(`flex flex-col gap-2`,e),...t})}function cv({className:e,showCloseButton:t=!1,children:n,...r}){return(0,C.jsxs)(`div`,{"data-slot":`dialog-footer`,className:K(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,C.jsx)(Ia,{asChild:!0,children:(0,C.jsx)(q,{variant:`outline`,children:`Close`})})]})}function lv({className:e,...t}){return(0,C.jsx)(Pa,{"data-slot":`dialog-title`,className:K(`font-heading text-base leading-none font-medium`,e),...t})}function uv({className:e,...t}){return(0,C.jsx)(Fa,{"data-slot":`dialog-description`,className:K(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function dv({className:e,...t}){return(0,C.jsx)(`textarea`,{"data-slot":`textarea`,className:K(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function fv({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:K(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var pv=wg(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function mv({className:e,align:t=`inline-start`,...n}){return(0,C.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:K(pv({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var hv=wg(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function gv({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,C.jsx)(q,{type:t,"data-size":r,variant:n,className:K(hv({size:r}),e),...i})}function _v({className:e,...t}){return(0,C.jsx)(jg,{"data-slot":`input-group-control`,className:K(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function vv({className:e,...t}){return(0,C.jsx)(Hd,{"data-slot":`label`,className:K(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function yv({...e}){return(0,C.jsx)(ap,{"data-slot":`select`,...e})}function bv({...e}){return(0,C.jsx)(sp,{"data-slot":`select-value`,...e})}function xv({className:e,size:t=`default`,children:n,...r}){return(0,C.jsxs)(op,{"data-slot":`select-trigger`,"data-size":t,className:K(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,C.jsx)(cp,{asChild:!0,children:(0,C.jsx)(Ye,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Sv({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,C.jsx)(lp,{children:(0,C.jsxs)(up,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:K(`relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,C.jsx)(wv,{}),(0,C.jsx)(dp,{"data-position":n,className:K(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,C.jsx)(Tv,{})]})})}function Cv({className:e,children:t,...n}){return(0,C.jsxs)(fp,{"data-slot":`select-item`,className:K(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,C.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,C.jsx)(mp,{children:(0,C.jsx)(Je,{className:`pointer-events-none`})})}),(0,C.jsx)(pp,{children:t})]})}function wv({className:e,...t}){return(0,C.jsx)(hp,{"data-slot":`select-scroll-up-button`,className:K(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,C.jsx)(Ze,{})})}function Tv({className:e,...t}){return(0,C.jsx)(gp,{"data-slot":`select-scroll-down-button`,className:K(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,C.jsx)(Ye,{})})}var Ev=`http://127.0.0.1:11434`,Dv=`https://openrouter.ai/api/v1`,Ov=[{value:`ollama`,label:`Ollama`,Icon:ev},{value:`openrouter`,label:`OpenRouter`,Icon:tv}];function kv(){let[e,t]=(0,b.useState)(!1),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)([]),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(``),[m,h]=(0,b.useState)(``),[g,_]=(0,b.useState)(!1),[v,y]=(0,b.useState)(null),x=c.find(e=>e.isActive);(0,b.useEffect)(()=>{let e=!0;return Av().then(t=>{e&&l(t)}),()=>{e=!1}},[]);let S=async()=>{l(await Av())},w=()=>{r(``),a(``),s(``),d(``),p(``)},T=e=>{t(e),e||w()},E=e=>{let t=e;r(t),a(t===`ollama`?Ev:Dv),s(``),d(``),p(``)},D=n===`ollama`,O=n===`openrouter`,k=!!n&&!g&&(D||O&&o.trim().length>0),A=async()=>{if(!(!n||!k)){_(!0),d(``),p(``);try{n===`ollama`?await J.call(`providers.connectOllama`,{baseUrl:i.trim()}):await J.call(`providers.connectOpenRouter`,{apiKey:o.trim(),baseUrl:i.trim()}),await S(),d(`${O?`OpenRouter`:`Ollama`} connected and active.`),window.dispatchEvent(new Event(`natroc:provider-updated`)),window.setTimeout(()=>{t(!1),w()},600)}catch(e){p(e instanceof Error?e.message:`Failed to connect provider.`)}finally{_(!1)}}},j=async e=>{if(!v){y(e),h(``);try{await J.call(`providers.setActive`,{providerId:e}),await S(),window.dispatchEvent(new Event(`natroc:provider-updated`))}catch(e){h(e instanceof Error?e.message:`Failed to switch provider.`)}finally{y(null)}}};return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(E_,{children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsxs)(q,{variant:`outline`,size:`sm`,children:[x?.displayName??`Select provider`,(0,C.jsx)(Ye,{className:`text-muted-foreground`})]})}),(0,C.jsxs)(O_,{align:`start`,className:`w-56`,children:[(0,C.jsx)(N_,{children:`Your providers`}),c.length>0?c.map(e=>(0,C.jsxs)(A_,{disabled:e.isActive||!!v,onSelect:()=>{j(e.id)},children:[(0,C.jsx)(`span`,{children:e.displayName}),v===e.id?(0,C.jsx)(`span`,{className:`natroc-soft-panel ml-auto text-xs text-muted-foreground`,children:`Switching...`}):e.isActive?(0,C.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`Active`}):(0,C.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`Switch`})]},e.id)):(0,C.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No providers connected yet.`}),m&&(0,C.jsx)(`div`,{className:`px-2 py-2 text-xs text-destructive`,children:m}),(0,C.jsx)(P_,{}),(0,C.jsxs)(A_,{onSelect:()=>t(!0),children:[(0,C.jsx)(Pt,{}),`Add Provider`]})]})]}),(0,C.jsx)(nv,{open:e,onOpenChange:T,children:(0,C.jsxs)(ov,{className:`sm:max-w-md`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-1.5 pr-6`,children:[(0,C.jsx)(lv,{children:`Add a new provider`}),(0,C.jsx)(uv,{children:`Pick a provider to connect to Natroc. You can manage and switch between them later from the topbar.`})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`provider`,children:`Provider`}),(0,C.jsxs)(yv,{value:n,onValueChange:E,children:[(0,C.jsx)(xv,{id:`provider`,className:`w-full`,children:(0,C.jsx)(bv,{placeholder:`Select a provider...`})}),(0,C.jsx)(Sv,{children:Ov.map(({value:e,label:t,Icon:n})=>(0,C.jsxs)(Cv,{value:e,children:[(0,C.jsx)(n,{size:16}),t]},e))})]})]}),n&&(0,C.jsxs)(`div`,{className:`natroc-soft-panel flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`base-url`,children:`Base URL`}),(0,C.jsx)(fv,{children:(0,C.jsx)(_v,{id:`base-url`,placeholder:D?Ev:Dv,value:i,onChange:e=>a(e.target.value)})}),D&&(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Leave empty to use the default`,` `,(0,C.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[0.7rem]`,children:Ev}),`.`]})]}),O&&(0,C.jsxs)(`div`,{className:`natroc-soft-panel flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`api-key`,children:`API Key`}),(0,C.jsx)(jg,{id:`api-key`,type:`password`,placeholder:`sk-or-v1-...`,autoComplete:`off`,value:o,onChange:e=>s(e.target.value)})]}),u&&(0,C.jsx)(`p`,{className:`natroc-soft-panel rounded-md border border-green-500/20 bg-green-500/10 px-3 py-2 text-xs text-green-700 dark:text-green-300`,children:u}),f&&(0,C.jsx)(`p`,{className:`natroc-soft-panel rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:f})]}),(0,C.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,C.jsx)(iv,{asChild:!0,children:(0,C.jsx)(q,{variant:`outline`,children:`Close`})}),(0,C.jsx)(q,{onClick:A,disabled:!k,children:g?`Connecting...`:`Connect provider`})]})]})})]})}async function Av(){try{return(await J.call(`providers.list`)).providers??[]}catch{return[]}}function jv(){let e=x_(window.location.pathname);return(0,C.jsxs)(`header`,{className:K(`sticky top-0 z-50 flex h-14 shrink-0 items-center justify-between gap-2 border-b px-4 md:px-6`),children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(v_,{}),(0,C.jsx)(kv,{}),(0,C.jsx)(Mg,{className:`mr-2 h-4 data-[orientation=vertical]:self-center`,orientation:`vertical`}),(0,C.jsx)(h_,{page:e})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(q,{size:`icon-sm`,variant:`outline`,children:(0,C.jsx)(Lt,{})}),(0,C.jsx)(q,{"aria-label":`Notifications`,size:`icon-sm`,variant:`outline`,children:(0,C.jsx)(Ue,{})}),(0,C.jsx)(Mg,{className:`h-4 data-[orientation=vertical]:self-center`,orientation:`vertical`}),(0,C.jsx)(Q_,{})]})]})}var Mv={x:50,y:120,w:397,h:248},Nv=Mv.h/Mv.w,Pv=({size:e=24,style:t,...n})=>{let r=e,i=e*Nv;return(0,C.jsx)(`svg`,{version:`1.0`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`${Mv.x} ${Mv.y} ${Mv.w} ${Mv.h}`,preserveAspectRatio:`xMidYMid meet`,width:r,height:i,style:{width:r,height:i,minWidth:r,minHeight:i,...t},...n,children:(0,C.jsxs)(`g`,{transform:`translate(0.000000,500.000000) scale(0.100000,-0.100000)`,fill:`currentColor`,stroke:`none`,children:[(0,C.jsx)(`path`,{d:`M605 3748 c61 -22 189 -69 285 -105 634 -233 736 -301 1270 -847 329 -335 592 -599 680 -681 247 -228 563 -433 995 -644 127 -62 295 -141 301 -141 15 0 -497 676 -546 720 -3 3 -55 61 -117 130 -170 191 -392 406 -714 691 -381 338 -415 366 -534 444 -108 71 -195 117 -287 154 -70 28 -289 88 -408 111 -25 5 -76 17 -115 25 -236 53 -886 185 -905 184 -8 0 35 -18 95 -41z`}),(0,C.jsx)(`path`,{d:`M4385 3760 c-118 -32 -415 -136 -556 -196 -245 -103 -345 -160 -417 -238 -67 -72 -72 -104 -72 -440 0 -331 0 -327 85 -426 117 -134 255 -318 327 -434 l38 -61 0 522 c0 317 4 552 11 599 38 273 195 452 553 630 138 68 142 74 31 44z`}),(0,C.jsx)(`path`,{d:`M1290 2633 c0 -381 -4 -653 -11 -708 -19 -161 -61 -291 -134 -419 -25 -44 -43 -81 -41 -84 3 -2 20 7 38 20 364 266 514 417 579 587 20 50 22 79 26 281 2 124 9 244 14 267 39 151 200 110 529 -134 96 -71 -466 452 -614 572 -150 120 -333 235 -376 235 -7 0 -10 -208 -10 -617z`})]})})};function Fv({...e}){return(0,C.jsx)(Hn,{"data-slot":`collapsible`,...e})}function Iv({...e}){return(0,C.jsx)(Ln,{"data-slot":`collapsible-trigger`,...e})}function Lv({...e}){return(0,C.jsx)(zn,{"data-slot":`collapsible-content`,...e})}function Rv({label:e,items:t}){return(0,C.jsxs)(t_,{children:[e&&(0,C.jsx)(n_,{children:e}),(0,C.jsx)(r_,{children:t.map(e=>(0,C.jsx)(Fv,{asChild:!0,className:`group/collapsible`,defaultOpen:!!e.isActive||e.subItems?.some(e=>!!e.isActive),children:(0,C.jsx)(i_,{children:e.subItems?.length?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Iv,{asChild:!0,children:(0,C.jsxs)(o_,{isActive:e.isActive,children:[e.icon,(0,C.jsx)(`span`,{children:e.title}),(0,C.jsx)(Xe,{className:`ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,C.jsx)(Lv,{children:(0,C.jsx)(c_,{children:e.subItems?.map(e=>(0,C.jsx)(l_,{children:(0,C.jsx)(u_,{asChild:!0,isActive:e.isActive,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})},e.title))})})]}):(0,C.jsx)(o_,{asChild:!0,isActive:e.isActive,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})})},e.title))})]})}var zv=[],Bv=[{title:`Github`,path:`https://github.com/licentora/natroc`,icon:(0,C.jsx)($_,{size:16})},{title:`System status`,path:`#/status`,icon:(0,C.jsx)(ze,{})}];[...zv.flatMap(e=>e.items.flatMap(e=>e.subItems?.length?[e,...e.subItems]:[e])),...Bv];var Vv={badge:`NEW`,title:`Smarter queue triage`,description:`One-click triage for your queue.`,readMore:{href:`#`,label:`Release notes`}};function Hv(){let[e,t]=(0,b.useState)(!0);return e?(0,C.jsxs)(`div`,{className:K(`group/latest-change size-full min-h-27 justify-center rounded-lg border bg-background`,`relative flex size-full flex-col gap-1 overflow-hidden px-4 pt-3 pb-1 *:text-nowrap`,`transition-opacity group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:opacity-0`),children:[(0,C.jsx)(`span`,{className:`font-mono text-[10px] font-light text-muted-foreground`,children:Vv.badge}),(0,C.jsx)(`p`,{className:`text-xs font-medium`,children:Vv.title}),(0,C.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:Vv.description}),(0,C.jsx)(q,{asChild:!0,className:`w-max px-0 text-xs font-light`,size:`sm`,variant:`link`,children:(0,C.jsx)(`a`,{href:Vv.readMore.href,children:Vv.readMore.label})}),(0,C.jsxs)(q,{className:`absolute top-2 right-2 z-10 size-6 rounded-full opacity-0 transition-opacity group-hover/latest-change:opacity-100`,onClick:()=>t(!1),size:`icon-sm`,variant:`ghost`,children:[(0,C.jsx)(qt,{className:`size-3.5 text-muted-foreground`}),` `]})]}):null}function Uv({chat:e,onDelete:t,onSelect:n}){let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{if(!a)return;let n=n=>{(n.key===`y`||n.key===`Y`)&&(n.preventDefault(),t?.(e.id),o(!1))};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[a,e.id,t]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(i_,{children:[(0,C.jsx)(o_,{asChild:!0,tooltip:e.title,children:(0,C.jsx)(`a`,{href:`/chat/${e.id}`,onClick:t=>{t.preventDefault(),n?.(e.id)},children:(0,C.jsx)(`span`,{className:`truncate`,children:e.title})})}),(0,C.jsxs)(E_,{open:r,onOpenChange:i,children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsx)(s_,{showOnHover:!0,"aria-label":`More options`,children:(0,C.jsx)(at,{})})}),(0,C.jsxs)(O_,{side:`right`,align:`start`,className:`w-44`,children:[(0,C.jsxs)(A_,{children:[(0,C.jsx)(lt,{}),(0,C.jsx)(`span`,{children:`Move to Project`})]}),(0,C.jsx)(P_,{}),(0,C.jsxs)(A_,{variant:`destructive`,onSelect:e=>{e.preventDefault(),i(!1),o(!0)},children:[(0,C.jsx)(Ht,{}),(0,C.jsx)(`span`,{children:`Delete`})]})]})]})]}),(0,C.jsx)(nv,{open:a,onOpenChange:o,children:(0,C.jsxs)(ov,{className:`max-w-md`,showCloseButton:!1,children:[(0,C.jsxs)(sv,{children:[(0,C.jsx)(lv,{children:`Delete chat?`}),(0,C.jsxs)(uv,{children:[`This will permanently delete`,` `,(0,C.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`"`,e.title,`"`]}),`. This action cannot be undone.`]})]}),(0,C.jsxs)(cv,{children:[(0,C.jsxs)(q,{variant:`outline`,onClick:()=>o(!1),children:[`Cancel`,(0,C.jsx)(g_,{className:`ml-1`,children:`Esc`})]}),(0,C.jsxs)(q,{variant:`destructive`,onClick:()=>{t?.(e.id),o(!1)},children:[`Yes, delete`,(0,C.jsx)(g_,{className:`ml-1`,children:`Y`})]})]})]})})]})}function Wv(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!0),i=window.location.pathname,a=S_(i),o=(0,b.useCallback)(async()=>{r(!0);try{t(await Gv())}finally{r(!1)}},[]);(0,b.useEffect)(()=>{let e=!0;Gv().then(n=>{e&&t(n)}).finally(()=>{e&&r(!1)});let n=()=>{o()};return window.addEventListener(`natroc:conversation-updated`,n),()=>{e=!1,window.removeEventListener(`natroc:conversation-updated`,n)}},[o]);let s=async e=>{try{await J.call(`conversations.delete`,{conversationId:e})}catch{return}t(t=>t.filter(t=>t.id!==e)),window.dispatchEvent(new Event(`natroc:conversation-updated`))},c=e=>{let t=`/chat/${e}`;if(i!==y_.home.path&&!i.startsWith(`/chat/`)){window.location.assign(t);return}window.history.replaceState(null,``,t),window.dispatchEvent(new Event(`natroc:navigate`)),window.dispatchEvent(new CustomEvent(`natroc:conversation-selected`,{detail:{id:e}}))};return(0,C.jsxs)(Yg,{collapsible:`icon`,variant:`inset`,children:[(0,C.jsx)(Qg,{className:`h-14 justify-center`,children:(0,C.jsx)(o_,{asChild:!0,className:`h-auto`,children:(0,C.jsxs)(`a`,{href:`/`,children:[(0,C.jsx)(Pv,{size:24}),(0,C.jsx)(`span`,{className:`font-medium`,children:`Natroc`})]})})}),(0,C.jsxs)(e_,{children:[(0,C.jsx)(t_,{children:(0,C.jsxs)(r_,{children:[(0,C.jsx)(i_,{children:(0,C.jsxs)(o_,{onClick:()=>{if(i!==y_.home.path&&!i.startsWith(`/chat/`)){window.location.assign(y_.home.path);return}window.history.replaceState(null,``,y_.home.path),window.dispatchEvent(new Event(`natroc:navigate`)),window.dispatchEvent(new Event(`natroc:new-conversation`))},isActive:a,className:K(`w-full duration-200 ease-linear`,a?`bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),tooltip:y_.home.title,children:[y_.home.icon,(0,C.jsx)(`span`,{children:y_.home.title})]})}),b_.map(e=>(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{asChild:!0,isActive:i===e.path,tooltip:e.title,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})},e.id))]})}),zv.map((e,t)=>(0,C.jsx)(Rv,{...e},`sidebar-group-${t}`)),(0,C.jsxs)(t_,{className:`group-data-[collapsible=icon]:hidden`,children:[(0,C.jsx)(n_,{children:`Recents`}),(0,C.jsxs)(r_,{children:[n&&e.length===0&&(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{disabled:!0,children:(0,C.jsx)(`span`,{children:`Loading chats...`})})}),!n&&e.length===0&&(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{disabled:!0,children:(0,C.jsx)(`span`,{children:`No recent chats`})})}),e.map(e=>(0,C.jsx)(Uv,{chat:e,onDelete:s,onSelect:c},e.id))]})]})]}),(0,C.jsxs)($g,{children:[(0,C.jsx)(Hv,{}),(0,C.jsx)(r_,{className:`mt-2`,children:Bv.map(e=>(0,C.jsx)(i_,{children:(0,C.jsx)(o_,{asChild:!0,className:`text-muted-foreground`,isActive:e.isActive,size:`sm`,children:(0,C.jsxs)(`a`,{href:e.path,children:[e.icon,(0,C.jsx)(`span`,{children:e.title})]})})},e.title))})]})]})}async function Gv(){try{return(await J.call(`conversations.list`)).conversations?.map(e=>({id:e.id,title:e.title,updatedAt:e.updatedAt}))??[]}catch{return[]}}function Kv({children:e}){return(0,C.jsx)(`div`,{className:`overflow-hidden`,children:(0,C.jsxs)(Jg,{className:`relative h-svh`,children:[(0,C.jsx)(Wv,{}),(0,C.jsxs)(Zg,{className:`md:peer-data-[variant=inset]:ml-0`,children:[(0,C.jsx)(jv,{}),(0,C.jsx)(`div`,{className:`flex flex-1 flex-col gap-4 overflow-y-auto p-4 md:p-6`,children:e})]})]})})}var qv=(0,b.createContext)({});function Jv(e){let t=(0,b.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Yv=typeof window<`u`?b.useLayoutEffect:b.useEffect,Xv=(0,b.createContext)(null);function Zv(e,t){e.indexOf(t)===-1&&e.push(t)}function Qv(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var $v=(e,t,n)=>n>t?t:n<e?e:n,ey={},ty=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),ny=e=>typeof e==`object`&&!!e,ry=e=>/^0[^.\s]+$/u.test(e);function iy(e){let t;return()=>(t===void 0&&(t=e()),t)}var ay=e=>e,oy=(...e)=>e.reduce((e,t)=>n=>t(e(n))),sy=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},cy=class{constructor(){this.subscriptions=[]}add(e){return Zv(this.subscriptions,e),()=>Qv(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},ly=e=>e*1e3,uy=e=>e/1e3,dy=(e,t)=>t?1e3/t*e:0,fy=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,py=1e-7,my=12;function hy(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=fy(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>py&&++s<my);return o}function gy(e,t,n,r){if(e===t&&n===r)return ay;let i=t=>hy(t,0,1,e,n);return e=>e===0||e===1?e:fy(i(e),t,r)}var _y=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vy=e=>t=>1-e(1-t),yy=gy(.33,1.53,.69,.99),by=vy(yy),xy=_y(by),Sy=e=>e>=1?1:(e*=2)<1?.5*by(e):.5*(2-2**(-10*(e-1))),Cy=e=>1-Math.sin(Math.acos(e)),wy=vy(Cy),Ty=_y(Cy),Ey=gy(.42,0,1,1),Dy=gy(0,0,.58,1),Oy=gy(.42,0,.58,1),ky=e=>Array.isArray(e)&&typeof e[0]!=`number`,Ay=e=>Array.isArray(e)&&typeof e[0]==`number`,jy={linear:ay,easeIn:Ey,easeInOut:Oy,easeOut:Dy,circIn:Cy,circInOut:Ty,circOut:wy,backIn:by,backInOut:xy,backOut:yy,anticipate:Sy},My=e=>typeof e==`string`,Ny=e=>{if(Ay(e)){e.length;let[t,n,r,i]=e;return gy(t,n,r,i)}else if(My(e))return jy[e],`${e}`,jy[e];return e},Py=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Fy={value:null,addProjectionMetrics:null};function Iy(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&Fy.value&&Fy.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Ly=40;function Ry(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Py.reduce((e,n)=>(e[n]=Iy(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=ey.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Ly),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Py.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Py.length;t++)o[Py[t]].cancel(e)},state:i,steps:o}}var{schedule:zy,cancel:By,state:Vy,steps:Hy}=Ry(typeof requestAnimationFrame<`u`?requestAnimationFrame:ay,!0),Uy;function Wy(){Uy=void 0}var Gy={now:()=>(Uy===void 0&&Gy.set(Vy.isProcessing||ey.useManualTiming?Vy.timestamp:performance.now()),Uy),set:e=>{Uy=e,queueMicrotask(Wy)}},Ky={layout:0,mainThread:0,waapi:0},qy=e=>t=>typeof t==`string`&&t.startsWith(e),Jy=qy(`--`),Yy=qy(`var(--`),Xy=e=>Yy(e)?Zy.test(e.split(`/*`)[0].trim()):!1,Zy=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Qy(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var $y={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},eb={...$y,transform:e=>$v(0,1,e)},tb={...$y,default:1},nb=e=>Math.round(e*1e5)/1e5,rb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ib(e){return e==null}var ab=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ob=(e,t)=>n=>!!(typeof n==`string`&&ab.test(n)&&n.startsWith(e)||t&&!ib(n)&&Object.prototype.hasOwnProperty.call(n,t)),sb=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(rb);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},cb=e=>$v(0,255,e),lb={...$y,transform:e=>Math.round(cb(e))},ub={test:ob(`rgb`,`red`),parse:sb(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+lb.transform(e)+`, `+lb.transform(t)+`, `+lb.transform(n)+`, `+nb(eb.transform(r))+`)`};function db(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var fb={test:ob(`#`),parse:db,transform:ub.transform},pb=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),mb=pb(`deg`),hb=pb(`%`),Y=pb(`px`),gb=pb(`vh`),_b=pb(`vw`),vb={...hb,parse:e=>hb.parse(e)/100,transform:e=>hb.transform(e*100)},yb={test:ob(`hsl`,`hue`),parse:sb(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+hb.transform(nb(t))+`, `+hb.transform(nb(n))+`, `+nb(eb.transform(r))+`)`},bb={test:e=>ub.test(e)||fb.test(e)||yb.test(e),parse:e=>ub.test(e)?ub.parse(e):yb.test(e)?yb.parse(e):fb.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?ub.transform(e):yb.transform(e),getAnimatableNone:e=>{let t=bb.parse(e);return t.alpha=0,bb.transform(t)}},xb=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Sb(e){return isNaN(e)&&typeof e==`string`&&(e.match(rb)?.length||0)+(e.match(xb)?.length||0)>0}var Cb=`number`,wb=`color`,Tb=`var`,Eb=`var(`,Db="${}",Ob=/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 kb(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Ob,e=>(bb.test(e)?(r.color.push(a),i.push(wb),n.push(bb.parse(e))):e.startsWith(Eb)?(r.var.push(a),i.push(Tb),n.push(e)):(r.number.push(a),i.push(Cb),n.push(parseFloat(e))),++a,Db)).split(Db),indexes:r,types:i}}function Ab(e){return kb(e).values}function jb({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Cb?i+=nb(r[a]):e===wb?i+=bb.transform(r[a]):i+=r[a]}return i}}function Mb(e){return jb(kb(e))}var Nb=e=>typeof e==`number`?0:bb.test(e)?bb.getAnimatableNone(e):e,Pb=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Nb(e);function Fb(e){let t=kb(e);return jb(t)(t.values.map((e,n)=>Pb(e,t.split[n])))}var Ib={test:Sb,parse:Ab,createTransformer:Mb,getAnimatableNone:Fb};function Lb(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Rb({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Lb(s,r,e+1/3),a=Lb(s,r,e),o=Lb(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function zb(e,t){return n=>n>0?t:e}var Bb=(e,t,n)=>e+(t-e)*n,Vb=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Hb=[fb,ub,yb],Ub=e=>Hb.find(t=>t.test(e));function Wb(e){let t=Ub(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===yb&&(n=Rb(n)),n}var Gb=(e,t)=>{let n=Wb(e),r=Wb(t);if(!n||!r)return zb(e,t);let i={...n};return e=>(i.red=Vb(n.red,r.red,e),i.green=Vb(n.green,r.green,e),i.blue=Vb(n.blue,r.blue,e),i.alpha=Bb(n.alpha,r.alpha,e),ub.transform(i))},Kb=new Set([`none`,`hidden`]);function qb(e,t){return Kb.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Jb(e,t){return n=>Bb(e,t,n)}function Yb(e){return typeof e==`number`?Jb:typeof e==`string`?Xy(e)?zb:bb.test(e)?Gb:$b:Array.isArray(e)?Xb:typeof e==`object`?bb.test(e)?Gb:Zb:zb}function Xb(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Yb(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Zb(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Yb(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Qb(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var $b=(e,t)=>{let n=Ib.createTransformer(t),r=kb(e),i=kb(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Kb.has(e)&&!i.values.length||Kb.has(t)&&!r.values.length?qb(e,t):oy(Xb(Qb(r,i),i.values),n):(`${e}${t}`,zb(e,t))};function ex(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Bb(e,t,n):Yb(e)(e,t)}var tx=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>zy.update(t,e),stop:()=>By(t),now:()=>Vy.isProcessing?Vy.timestamp:Gy.now()}},nx=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},rx=2e4;function ix(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function ax(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(ix(r),rx);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:uy(i)}}var ox={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 sx(e,t){return e*Math.sqrt(1-t*t)}var cx=12;function lx(e,t,n){let r=n;for(let n=1;n<cx;n++)r-=e(r)/t(r);return r}var ux=.001;function dx({duration:e=ox.duration,bounce:t=ox.bounce,velocity:n=ox.velocity,mass:r=ox.mass}){let i,a;ox.maxDuration;let o=1-t;o=$v(ox.minDamping,ox.maxDamping,o),e=$v(ox.minDuration,ox.maxDuration,uy(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=sx(t,o),c=Math.exp(-i);return ux-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=sx(t**2,o);return(-i(t)+ux>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=lx(i,a,s);if(e=ly(e),isNaN(c))return{stiffness:ox.stiffness,damping:ox.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var fx=[`duration`,`bounce`],px=[`stiffness`,`damping`,`mass`];function mx(e,t){return t.some(t=>e[t]!==void 0)}function hx(e){let t={velocity:ox.velocity,stiffness:ox.stiffness,damping:ox.damping,mass:ox.mass,isResolvedFromDuration:!1,...e};if(!mx(e,px)&&mx(e,fx))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*$v(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ox.mass,stiffness:i,damping:a}}else{let n=dx({...e,velocity:0});t={...t,...n,mass:ox.mass},t.isResolvedFromDuration=!0}return t}function gx(e=ox.visualDuration,t=ox.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=hx({...n,velocity:-uy(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=uy(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?ox.restSpeed.granular:ox.restSpeed.default,i||=v?ox.restDelta.granular:ox.restDelta.default;let y,b,x,S,C,w;if(h<1)x=sx(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>ly(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=ly(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=ly(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(ix(T),rx),t=nx(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}gx.applyToOptions=e=>{let t=ax(e,100,gx);return e.ease=t.ease,e.duration=ly(t.duration),e.type=`keyframes`,e};var _x=5;function vx(e,t,n){let r=Math.max(t-_x,0);return dy(n-e(r),t-r)}function yx({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=gx({keyframes:[f.value,m(f.value)],velocity:vx(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function bx(e,t,n){let r=[],i=n||ey.mix||ex,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=oy(Array.isArray(t)?t[n]||ay:t,a)),r.push(a)}return r}function xx(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=bx(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=sy(e[r],e[r+1],n);return s[r](i)};return n?t=>l($v(e[0],e[a-1],t)):l}function Sx(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=sy(0,t,r);e.push(Bb(n,1,i))}}function Cx(e){let t=[0];return Sx(t,e.length-1),t}function wx(e,t){return e.map(e=>e*t)}function Tx(e,t){return e.map(()=>t||Oy).splice(0,e.length-1)}function Ex({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ky(r)?r.map(Ny):Ny(r),a={done:!1,value:t[0]},o=xx(wx(n&&n.length===t.length?n:Cx(t),e),t,{ease:Array.isArray(i)?i:Tx(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Dx=e=>e!==null;function Ox(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Dx),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var kx={decay:yx,inertia:yx,tween:Ex,keyframes:Ex,spring:gx};function Ax(e){typeof e.type==`string`&&(e.type=kx[e.type])}var jx=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Mx=e=>e/100,Nx=class extends jx{constructor(e){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=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Gy.now()&&this.tick(Gy.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Ky.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Ax(e);let{type:t=Ex,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Ex;s!==Ex&&typeof o[0]!=`number`&&(this.mixKeyframes=oy(Mx,ex(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=ix(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=$v(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==yx&&(b.value=Ox(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return uy(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uy(e)}get time(){return uy(this.currentTime)}set time(e){e=ly(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return vx(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Gy.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=uy(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=tx,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,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(Gy.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,Ky.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Px(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Fx=e=>e*180/Math.PI,Ix=e=>Rx(Fx(Math.atan2(e[1],e[0]))),Lx={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ix,rotateZ:Ix,skewX:e=>Fx(Math.atan(e[1])),skewY:e=>Fx(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Rx=e=>(e%=360,e<0&&(e+=360),e),zx=Ix,Bx=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Vx=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Hx={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Bx,scaleY:Vx,scale:e=>(Bx(e)+Vx(e))/2,rotateX:e=>Rx(Fx(Math.atan2(e[6],e[5]))),rotateY:e=>Rx(Fx(Math.atan2(-e[2],e[0]))),rotateZ:zx,rotate:zx,skewX:e=>Fx(Math.atan(e[4])),skewY:e=>Fx(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Ux(e){return+!!e.includes(`scale`)}function Wx(e,t){if(!e||e===`none`)return Ux(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Hx,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Lx,i=t}if(!i)return Ux(t);let a=r[t],o=i[1].split(`,`).map(Kx);return typeof a==`function`?a(o):o[a]}var Gx=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Wx(n,t)};function Kx(e){return parseFloat(e.trim())}var qx=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Jx=new Set([...qx,`pathRotation`]),Yx=e=>e===$y||e===Y,Xx=new Set([`x`,`y`,`z`]),Zx=qx.filter(e=>!Xx.has(e));function Qx(e){let t=[];return Zx.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var $x={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},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})=>Wx(t,`x`),y:(e,{transform:t})=>Wx(t,`y`)};$x.translateX=$x.x,$x.translateY=$x.y;var eS=new Set,tS=!1,nS=!1,rS=!1;function iS(){if(nS){let e=Array.from(eS).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Qx(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}nS=!1,tS=!1,eS.forEach(e=>e.complete(rS)),eS.clear()}function aS(){eS.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(nS=!0)})}function oS(){rS=!0,aS(),iS(),rS=!1}var sS=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(eS.add(this),tS||(tS=!0,zy.read(aS),zy.resolveKeyframes(iS))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Px(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),eS.delete(this)}cancel(){this.state===`scheduled`&&(eS.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},cS=e=>e.startsWith(`--`);function lS(e,t,n){cS(t)?e.style.setProperty(t,n):e.style[t]=n}var uS={};function dS(e,t){let n=iy(e);return()=>uS[t]??n()}var fS=dS(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),pS=dS(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),mS=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,hS={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:mS([0,.65,.55,1]),circOut:mS([.55,0,1,.45]),backIn:mS([.31,.01,.66,-.59]),backOut:mS([.33,1.53,.69,.99])};function gS(e,t){if(e)return typeof e==`function`?pS()?nx(e,t):`ease-out`:Ay(e)?mS(e):Array.isArray(e)?e.map(e=>gS(e,t)||hS.easeOut):hS[e]}function _S(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=gS(s,i);Array.isArray(d)&&(u.easing=d),Fy.value&&Ky.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Fy.value&&p.finished.finally(()=>{Ky.waapi--}),p}function vS(e){return typeof e==`function`&&`applyToOptions`in e}function yS({type:e,...t}){return vS(e)&&pS()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var bS=class extends jx{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=yS(e);this.animation=_S(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Ox(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),lS(t,n,e),this.animation.cancel()}s?.(),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;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return uy(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uy(e)}get time(){return uy(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ly(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&fS()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),ay):r(this)}},xS={anticipate:Sy,backInOut:xy,circInOut:Ty};function SS(e){return e in xS}function CS(e){typeof e.ease==`string`&&SS(e.ease)&&(e.ease=xS[e.ease])}var wS=10,TS=class extends bS{constructor(e){CS(e),Ax(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Nx({...a,autoplay:!1}),s=Math.max(wS,Gy.now()-this.startTime),c=$v(0,wS,s-wS),l=o.sample(s).value,{name:u}=this.options;i&&u&&lS(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},ES=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ib.test(e)||e===`0`)&&!e.startsWith(`url(`));function DS(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function OS(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=ES(i,t),s=ES(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:DS(e)||(n===`spring`||vS(n))&&r}function kS(e){e.duration=0,e.type=`keyframes`}var AS=new Set([`opacity`,`clipPath`,`filter`,`transform`]),jS=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function MS(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&jS.test(e[t]))return!0;return!1}var NS=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),PS=iy(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function FS(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return PS()&&n&&(AS.has(n)||NS.has(n)&&MS(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var IS=40,LS=class extends jx{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Gy.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||sS;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Gy.now();let u=!0;OS(e,i,a,o)||(u=!1,(ey.instantAnimations||!s)&&l?.(Ox(e,n,t)),e[0]=e[e.length-1],kS(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>IS?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&FS(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new TS({...d,element:p})}catch{m=new Nx(d)}else m=new Nx(d);m.finished.then(()=>{this.notifyFinished()}).catch(ay),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),oS()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function RS(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var zS=30,BS=e=>!isNaN(parseFloat(e)),VS={current:void 0},HS=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Gy.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Gy.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=BS(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new cy);let n=this.events[e].add(t);return e===`change`?()=>{n(),zy.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return VS.current&&VS.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Gy.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>zS)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,zS);return dy(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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 US(e,t){return new HS(e,t)}function WS(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function GS(e,t){let n=e?.[t]??e?.default??e;return n===e?n:WS(n,e)}var KS={type:`spring`,stiffness:500,damping:25,restSpeed:10},qS=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),JS={type:`keyframes`,duration:.8},YS={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},XS=(e,{keyframes:t})=>t.length>2?JS:Jx.has(e)?e.startsWith(`scale`)?qS(t[1]):KS:YS,ZS=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function QS(e){for(let t in e)if(!ZS.has(t))return!0;return!1}var $S=(e,t,n,r={},i,a)=>o=>{let s=GS(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=ly(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};QS(s)||Object.assign(u,XS(e,u)),u.duration&&=ly(u.duration),u.repeatDelay&&=ly(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(kS(u),u.delay===0&&(d=!0)),(ey.instantAnimations||ey.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,kS(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Ox(u.keyframes,s);if(e!==void 0){zy.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Nx(u):new LS(u)},eC=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tC(e){let t=eC.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function nC(e,t,n=1){`${e}`;let[r,i]=tC(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return ty(e)?parseFloat(e):e}return Xy(i)?nC(i,t,n+1):i}function rC(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function iC(e,t,n,r){if(typeof t==`function`){let[i,a]=rC(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=rC(r);t=t(n===void 0?e.custom:n,i,a)}return t}function aC(e,t,n){let r=e.getProps();return iC(r,t,n===void 0?r.custom:n,e)}var oC=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...qx]),sC=e=>Array.isArray(e);function cC(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,US(n))}function lC(e){return sC(e)?e[e.length-1]||0:e}function uC(e,t){let{transitionEnd:n={},transition:r={},...i}=aC(e,t)||{};i={...i,...n};for(let t in i)cC(e,t,lC(i[t]))}var dC=e=>!!(e&&e.getVelocity);function fC(e){return!!(dC(e)&&e.add)}function pC(e,t){let n=e.getValue(`willChange`);if(fC(n))return n.add(t);if(!n&&ey.WillChange){let n=new ey.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function mC(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var hC=`data-`+mC(`framerAppearId`);function gC(e){return e.props[hC]}function _C({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function vC(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?WS(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&_C(f,t))continue;let o={delay:n,...GS(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){zy.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=gC(e);if(n){let e=window.MotionHandoffAnimation(n,t,zy);e!==null&&(o.startTime=e,p=!0)}}pC(e,t);let m=l??e.shouldReduceMotion;r.start($S(t,r,i,m&&oC.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>zy.update(()=>{o&&uC(e,o)});d.length?Promise.all(d).then(t):t()}return d}function yC(e,t,n={}){let r=aC(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(vC(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return bC(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function bC(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(yC(c,t,{...o,delay:n+(typeof r==`function`?0:r)+RS(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function xC(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>yC(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=yC(e,t,n);else{let i=typeof t==`function`?aC(e,t,n.custom):t;r=Promise.all(vC(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var SC={test:e=>e===`auto`,parse:e=>e},CC=e=>t=>t.test(e),wC=[$y,Y,hb,mb,_b,gb,SC],TC=e=>wC.find(CC(e));function EC(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||ry(e)}var DC=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function OC(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(rb)||[];if(!r)return e;let i=n.replace(r,``),a=+!!DC.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var kC=/\b([a-z-]*)\(.*?\)/gu,AC={...Ib,getAnimatableNone:e=>{let t=e.match(kC);return t?t.map(OC).join(` `):e}},jC={...Ib,getAnimatableNone:e=>{let t=Ib.parse(e);return Ib.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},MC={...$y,transform:Math.round},NC={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,top:Y,right:Y,bottom:Y,left:Y,inset:Y,insetBlock:Y,insetBlockStart:Y,insetBlockEnd:Y,insetInline:Y,insetInlineStart:Y,insetInlineEnd:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,paddingBlock:Y,paddingBlockStart:Y,paddingBlockEnd:Y,paddingInline:Y,paddingInlineStart:Y,paddingInlineEnd:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,marginBlock:Y,marginBlockStart:Y,marginBlockEnd:Y,marginInline:Y,marginInlineStart:Y,marginInlineEnd:Y,fontSize:Y,backgroundPositionX:Y,backgroundPositionY:Y,rotate:mb,pathRotation:mb,rotateX:mb,rotateY:mb,rotateZ:mb,scale:tb,scaleX:tb,scaleY:tb,scaleZ:tb,skew:mb,skewX:mb,skewY:mb,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:eb,originX:vb,originY:vb,originZ:Y,zIndex:MC,fillOpacity:eb,strokeOpacity:eb,numOctaves:MC},PC={...NC,color:bb,backgroundColor:bb,outlineColor:bb,fill:bb,stroke:bb,borderColor:bb,borderTopColor:bb,borderRightColor:bb,borderBottomColor:bb,borderLeftColor:bb,filter:AC,WebkitFilter:AC,mask:jC,WebkitMask:jC},FC=e=>PC[e],IC=new Set([AC,jC]);function LC(e,t){let n=FC(e);return IC.has(n)||(n=Ib),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var RC=new Set([`auto`,`none`,`0`]);function zC(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!RC.has(t)&&kb(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=LC(n,i)}var BC=class extends sS{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Xy(r))){let i=nC(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!oC.has(n)||e.length!==2)return;let[r,i]=e,a=TC(r),o=TC(i);if(Qy(r)!==Qy(i)&&$x[n]){this.needsMeasurement=!0;return}if(a!==o)if(Yx(a)&&Yx(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else $x[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||EC(e[t]))&&n.push(t);n.length&&zC(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=$x[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=$x[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function VC(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var HC=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function UC(e){return ny(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:WC,cancel:GC}=Ry(queueMicrotask,!1),KC={x:!1,y:!1};function qC(){return KC.x||KC.y}function JC(e){return e===`x`||e===`y`?KC[e]?null:(KC[e]=!0,()=>{KC[e]=!1}):KC.x||KC.y?null:(KC.x=KC.y=!0,()=>{KC.x=KC.y=!1})}function YC(e,t){let n=VC(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function XC(e){return!(e.pointerType===`touch`||qC())}function ZC(e,t,n={}){let[r,i,a]=YC(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!XC(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var QC=(e,t)=>t?e===t?!0:QC(e,t.parentElement):!1,$C=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,ew=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function tw(e){return ew.has(e.tagName)||e.isContentEditable===!0}var nw=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function rw(e){return nw.has(e.tagName)||e.isContentEditable===!0}var iw=new WeakSet;function aw(e){return t=>{t.key===`Enter`&&e(t)}}function ow(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var sw=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=aw(()=>{if(iw.has(n))return;ow(n,`down`);let e=aw(()=>{ow(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>ow(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function cw(e){return $C(e)&&!qC()}var lw=new WeakSet;function uw(e,t,n={}){let[r,i,a]=YC(e,n),o=e=>{let r=e.currentTarget;if(!cw(e)||lw.has(e))return;iw.add(r),n.stopPropagation&&lw.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),iw.has(r)&&iw.delete(r),cw(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||QC(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),UC(e)&&(e.addEventListener(`focus`,e=>sw(e,i)),!tw(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function dw(e){return ny(e)&&`ownerSVGElement`in e}var fw=new WeakMap,pw,mw=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:dw(r)&&`getBBox`in r?r.getBBox()[t]:r[n],hw=mw(`inline`,`width`,`offsetWidth`),gw=mw(`block`,`height`,`offsetHeight`);function _w({target:e,borderBoxSize:t}){fw.get(e)?.forEach(n=>{n(e,{get width(){return hw(e,t)},get height(){return gw(e,t)}})})}function vw(e){e.forEach(_w)}function yw(){typeof ResizeObserver>`u`||(pw=new ResizeObserver(vw))}function bw(e,t){pw||yw();let n=VC(e);return n.forEach(e=>{let n=fw.get(e);n||(n=new Set,fw.set(e,n)),n.add(t),pw?.observe(e)}),()=>{n.forEach(e=>{let n=fw.get(e);n?.delete(t),n?.size||pw?.unobserve(e)})}}var xw=new Set,Sw;function Cw(){Sw=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};xw.forEach(t=>t(e))},window.addEventListener(`resize`,Sw)}function ww(e){return xw.add(e),Sw||Cw(),()=>{xw.delete(e),!xw.size&&typeof Sw==`function`&&(window.removeEventListener(`resize`,Sw),Sw=void 0)}}function Tw(e,t){return typeof e==`function`?ww(e):bw(e,t)}function Ew(e){return dw(e)&&e.tagName===`svg`}var Dw=[...wC,bb,Ib],Ow=e=>Dw.find(CC(e)),kw=()=>({translate:0,scale:1,origin:0,originPoint:0}),Aw=()=>({x:kw(),y:kw()}),jw=()=>({min:0,max:0}),Mw=()=>({x:jw(),y:jw()}),Nw=new WeakMap;function Pw(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Fw(e){return typeof e==`string`||Array.isArray(e)}var Iw=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Lw=[`initial`,...Iw];function Rw(e){return Pw(e.animate)||Lw.some(t=>Fw(e[t]))}function zw(e){return!!(Rw(e)||e.variants)}function Bw(e,t,n){for(let r in t){let i=t[r],a=n[r];if(dC(i))e.addValue(r,i);else if(dC(a))e.addValue(r,US(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,US(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Vw={current:null},Hw={current:!1},Uw=typeof window<`u`;function Ww(){if(Hw.current=!0,Uw)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Vw.current=e.matches;e.addEventListener(`change`,t),t()}else Vw.current=!1}var Gw=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Kw={};function qw(e){Kw=e}function Jw(){return Kw}var Yw=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){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=sS,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=()=>{let e=Gy.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,zy.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=Rw(t),this.isVariantNode=zw(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&dC(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,Nw.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Hw.current||Ww(),this.shouldReduceMotion=Vw.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(),By(this.notifyUpdate),By(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&AS.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new bS({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:ly(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Jx.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&zy.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Kw){let t=Kw[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Mw()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Gw.length;t++){let n=Gw[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Bw(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]: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(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=US(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(ty(n)||ry(n))?n=parseFloat(n):!Ow(n)&&Ib.test(t)&&(n=LC(e,t)),this.setBaseTarget(e,dC(n)?n.get():n)),dC(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=iC(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!dC(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new cy),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){WC.render(this.render)}},Xw=class extends Yw{constructor(){super(...arguments),this.KeyframeResolver=BC}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;dC(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Zw=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Qw({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function $w({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function eT(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function tT(e){return e===void 0||e===1}function nT({scale:e,scaleX:t,scaleY:n}){return!tT(e)||!tT(t)||!tT(n)}function rT(e){return nT(e)||iT(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function iT(e){return aT(e.x)||aT(e.y)}function aT(e){return e&&e!==`0%`}function oT(e,t,n){return n+t*(e-n)}function sT(e,t,n,r,i){return i!==void 0&&(e=oT(e,i,r)),oT(e,n,r)+t}function cT(e,t=0,n=1,r,i){e.min=sT(e.min,t,n,r,i),e.max=sT(e.max,t,n,r,i)}function lT(e,{x:t,y:n}){cT(e.x,t.translate,t.scale,t.originPoint),cT(e.y,n.translate,n.scale,n.originPoint)}var uT=.999999999999,dT=1.0000000000001;function fT(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(pT(e.x,-a.scroll.offset.x),pT(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,lT(e,o)),r&&rT(a.latestValues)&&gT(e,a.latestValues,a.layout?.layoutBox))}t.x<dT&&t.x>uT&&(t.x=1),t.y<dT&&t.y>uT&&(t.y=1)}function pT(e,t){e.min+=t,e.max+=t}function mT(e,t,n,r,i=.5){cT(e,t,n,Bb(e.min,e.max,i),r)}function hT(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function gT(e,t,n){let r=n??e;mT(e.x,hT(t.x,r.x),t.scaleX,t.scale,t.originX),mT(e.y,hT(t.y,r.y),t.scaleY,t.scale,t.originY)}function _T(e,t){return Qw(eT(e.getBoundingClientRect(),t))}function vT(e,t,n){let r=_T(e,n),{scroll:i}=t;return i&&(pT(r.x,i.offset.x),pT(r.y,i.offset.y)),r}var yT={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},bT=qx.length;function xT(e,t,n){let r=``,i=!0;for(let a=0;a<bT;a++){let o=qx[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=HC(s,NC[o]);if(!c){i=!1;let t=yT[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${HC(a,NC.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function ST(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Jx.has(e)){o=!0;continue}else if(Jy(e)){i[e]=n;continue}else{let t=HC(n,NC[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=xT(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function CT(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function wT(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var TT={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Y.test(e))e=parseFloat(e);else return e;return`${wT(e,t.target.x)}% ${wT(e,t.target.y)}%`}},ET={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ib.parse(e);if(i.length>5)return r;let a=Ib.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=Bb(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},DT={borderRadius:{...TT,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:TT,borderTopRightRadius:TT,borderBottomLeftRadius:TT,borderBottomRightRadius:TT,boxShadow:ET};function OT(e,{layout:t,layoutId:n}){return Jx.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!DT[e]||e===`opacity`)}function kT(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(dC(r[t])||i&&dC(i[t])||OT(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function AT(e){return window.getComputedStyle(e)}var jT=class extends Xw{constructor(){super(...arguments),this.type=`html`,this.renderInstance=CT}readValueFromInstance(e,t){if(Jx.has(t))return this.projection?.isProjecting?Ux(t):Gx(e,t);{let n=AT(e),r=(Jy(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return _T(e,t)}build(e,t,n){ST(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return kT(e,t,n)}},MT={offset:`stroke-dashoffset`,array:`stroke-dasharray`},NT={offset:`strokeDashoffset`,array:`strokeDasharray`};function PT(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?MT:NT;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var FT=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function IT(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(ST(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of FT)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&PT(d,i,a,o,!1)}var LT=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`]),RT=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function zT(e,t,n,r){CT(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(LT.has(n)?n:mC(n),t.attrs[n])}function BT(e,t,n){let r=kT(e,t,n);for(let n in e)if(dC(e[n])||dC(t[n])){let t=qx.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var VT=class extends Xw{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Mw}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Jx.has(t)){let e=FC(t);return e&&e.default||0}return t=LT.has(t)?t:mC(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return BT(e,t,n)}build(e,t,n){IT(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){zT(e,t,n,r)}mount(e){this.isSVGTag=RT(e.tagName),super.mount(e)}},HT=Lw.length;function UT(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&UT(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<HT;n++){let r=Lw[n],i=e.props[r];(Fw(i)||i===!1)&&(t[r]=i)}return t}function WT(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var GT=[...Iw].reverse(),KT=Iw.length;function qT(e){return t=>Promise.all(t.map(({animation:t,options:n})=>xC(e,t,n)))}function JT(e){let t=qT(e),n=ZT(),r=!0,i=!1,a=t=>(n,r)=>{let i=aC(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=UT(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<KT;t++){let p=GT[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Fw(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||Pw(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=YT(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=sC(t)&&sC(n)?!WT(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=aC(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=RS(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=aC(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=ZT(),i=!0}}}function YT(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!WT(t,e):!1}function XT(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ZT(){return{animate:XT(!0),whileInView:XT(),whileHover:XT(),whileTap:XT(),whileDrag:XT(),whileFocus:XT(),exit:XT()}}function QT(e,t){e.min=t.min,e.max=t.max}function $T(e,t){QT(e.x,t.x),QT(e.y,t.y)}function eE(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var tE=.9999,nE=1.0001,rE=-.01,iE=.01;function aE(e){return e.max-e.min}function oE(e,t,n){return Math.abs(e-t)<=n}function sE(e,t,n,r=.5){e.origin=r,e.originPoint=Bb(t.min,t.max,e.origin),e.scale=aE(n)/aE(t),e.translate=Bb(n.min,n.max,e.origin)-e.originPoint,(e.scale>=tE&&e.scale<=nE||isNaN(e.scale))&&(e.scale=1),(e.translate>=rE&&e.translate<=iE||isNaN(e.translate))&&(e.translate=0)}function cE(e,t,n,r){sE(e.x,t.x,n.x,r?r.originX:void 0),sE(e.y,t.y,n.y,r?r.originY:void 0)}function lE(e,t,n,r=0){e.min=(r?Bb(n.min,n.max,r):n.min)+t.min,e.max=e.min+aE(t)}function uE(e,t,n,r){lE(e.x,t.x,n.x,r?.x),lE(e.y,t.y,n.y,r?.y)}function dE(e,t,n,r=0){let i=r?Bb(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+aE(t)}function fE(e,t,n,r){dE(e.x,t.x,n.x,r?.x),dE(e.y,t.y,n.y,r?.y)}function pE(e,t,n,r,i){return e-=t,e=oT(e,1/n,r),i!==void 0&&(e=oT(e,1/i,r)),e}function mE(e,t=0,n=1,r=.5,i,a=e,o=e){if(hb.test(t)&&(t=parseFloat(t),t=Bb(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Bb(a.min,a.max,r);e===a&&(s-=t),e.min=pE(e.min,t,n,s,i),e.max=pE(e.max,t,n,s,i)}function hE(e,t,[n,r,i],a,o){mE(e,t[n],t[r],t[i],t.scale,a,o)}var gE=[`x`,`scaleX`,`originX`],_E=[`y`,`scaleY`,`originY`];function vE(e,t,n,r){hE(e.x,t,gE,n?n.x:void 0,r?r.x:void 0),hE(e.y,t,_E,n?n.y:void 0,r?r.y:void 0)}function yE(e){return e.translate===0&&e.scale===1}function bE(e){return yE(e.x)&&yE(e.y)}function xE(e,t){return e.min===t.min&&e.max===t.max}function SE(e,t){return xE(e.x,t.x)&&xE(e.y,t.y)}function CE(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function wE(e,t){return CE(e.x,t.x)&&CE(e.y,t.y)}function TE(e){return aE(e.x)/aE(e.y)}function EE(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function DE(e){return[e(`x`),e(`y`)]}function OE(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var kE=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],AE=kE.length,jE=e=>typeof e==`string`?parseFloat(e):e,ME=e=>typeof e==`number`||Y.test(e);function NE(e,t,n,r,i,a){i?(e.opacity=Bb(0,n.opacity??1,FE(r)),e.opacityExit=Bb(t.opacity??1,0,IE(r))):a&&(e.opacity=Bb(t.opacity??1,n.opacity??1,r));for(let i=0;i<AE;i++){let a=kE[i],o=PE(t,a),s=PE(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||ME(o)===ME(s)?(e[a]=Math.max(Bb(jE(o),jE(s),r),0),(hb.test(s)||hb.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Bb(t.rotate||0,n.rotate||0,r))}function PE(e,t){return e[t]===void 0?e.borderRadius:e[t]}var FE=LE(0,.5,wy),IE=LE(.5,.95,ay);function LE(e,t,n){return r=>r<e?0:r>t?1:n(sy(e,t,r))}function RE(e,t,n){let r=dC(e)?e:US(e);return r.start($S(``,r,t,n)),r.animation}function zE(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var BE=(e,t)=>e.depth-t.depth,VE=class{constructor(){this.children=[],this.isDirty=!1}add(e){Zv(this.children,e),this.isDirty=!0}remove(e){Qv(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(BE),this.isDirty=!1,this.children.forEach(e)}};function HE(e,t){let n=Gy.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(By(r),e(a-t))};return zy.setup(r,!0),()=>By(r)}function UE(e){return dC(e)?e.get():e}var WE=class{constructor(){this.members=[]}add(e){Zv(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Qv(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Qv(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},GE={hasAnimatedSinceResize:!0,hasEverUpdated:!1},KE={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},qE=[``,`X`,`Y`,`Z`],JE=1e3,YE=0;function XE(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function ZE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=gC(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,zy,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&ZE(r)}function QE({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=YE++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Fy.value&&(KE.nodes=KE.calculatedTargetDeltas=KE.calculatedProjections=0),this.nodes.forEach(tD),this.nodes.forEach(uD),this.nodes.forEach(dD),this.nodes.forEach(nD),Fy.addProjectionMetrics&&Fy.addProjectionMetrics(KE)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new VE)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cy),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=dw(t)&&!Ew(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;zy.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=HE(i,250),GE.hasAnimatedSinceResize&&(GE.hasAnimatedSinceResize=!1,this.nodes.forEach(lD)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||vD,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!wE(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...GS(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||lD(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),By(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fD),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ZE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(aD),this.nodes.forEach(iD);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(oD);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(sD),this.nodes.forEach(cD),this.nodes.forEach($E),this.nodes.forEach(eD)):this.nodes.forEach(oD),this.clearAllSnapshots();let e=Gy.now();Vy.delta=$v(0,1e3/60,e-Vy.timestamp),Vy.timestamp=e,Vy.isProcessing=!0,Hy.update.process(Vy),Hy.preRender.process(Vy),Hy.render.process(Vy),Vy.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,WC.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(rD),this.sharedNodes.forEach(pD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,zy.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){zy.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!aE(this.snapshot.measuredBox.x)&&!aE(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=Mw(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!bE(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||rT(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),SD(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Mw();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(wD))){let{scroll:e}=this.root;e&&(pT(t.x,e.offset.x),pT(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Mw();if($T(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&$T(t,e),pT(t.x,i.offset.x),pT(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Mw();$T(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(pT(r.x,-n.scroll.offset.x),pT(r.y,-n.scroll.offset.y)),rT(n.latestValues)&&gT(r,n.latestValues,n.layout?.layoutBox)}return rT(this.latestValues)&&gT(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Mw();$T(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!rT(n.latestValues))continue;let r;n.instance&&(nT(n.latestValues)&&n.updateSnapshot(),r=Mw(),$T(r,n.measurePageBox())),vE(t,n.latestValues,n.snapshot?.layoutBox,r)}return rT(this.latestValues)&&vE(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Vy.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=Vy.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Mw(),this.targetWithTransforms=Mw()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),uE(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):$T(this.target,this.layout.layoutBox),lT(this.target,this.targetDelta)):$T(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Fy.value&&KE.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||nT(this.parent.latestValues)||iT(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Mw(),this.relativeTargetOrigin=Mw(),fE(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),$T(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Vy.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;$T(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;fT(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Mw());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(eE(this.prevProjectionDelta.x,this.projectionDelta.x),eE(this.prevProjectionDelta.y,this.projectionDelta.y)),cE(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!EE(this.projectionDelta.x,this.prevProjectionDelta.x)||!EE(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Fy.value&&KE.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Aw(),this.projectionDelta=Aw(),this.projectionDeltaWithTransform=Aw()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Aw();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=Mw(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(_D));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=Bb(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=Bb(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(mD(o.x,e.x,n),mD(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fE(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),gD(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&SE(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Mw(),$T(f,this.relativeTarget)),c&&(this.animationValues=a,NE(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(By(this.pendingAnimation),void 0),this.pendingAnimation=zy.update(()=>{GE.hasAnimatedSinceResize=!0,Ky.layout++,this.motionValue||=US(0),this.motionValue.jump(0,!1),this.currentAnimation=RE(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Ky.layout--},onComplete:()=>{Ky.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(JE),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&CD(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Mw();let t=aE(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=aE(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}$T(t,n),gT(t,i),cE(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new WE),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&XE(`z`,e,r,this.animationValues);for(let t=0;t<qE.length;t++)XE(`rotate${qE[t]}`,e,r,this.animationValues),XE(`skew${qE[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=UE(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=UE(t?.pointerEvents)||``),this.hasProjected&&!rT(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=OE(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in DT){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=DT[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?UE(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(iD),this.root.sharedNodes.clear()}}}function $E(e){e.updateLayout()}function eD(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)DE(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=aE(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;QT(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else CD(i,t.layoutBox,n)&&DE(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=aE(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Aw();cE(o,n,t.layoutBox);let s=Aw();a?cE(s,e.applyTransform(r,!0),t.measuredBox):cE(s,n,t.layoutBox);let c=!bE(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=Mw();fE(s,t.layoutBox,i.layoutBox,o);let c=Mw();fE(c,n,a.layoutBox,o),wE(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function tD(e){Fy.value&&KE.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function nD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rD(e){e.clearSnapshot()}function iD(e){e.clearMeasurements()}function aD(e){e.isLayoutDirty=!0,e.updateLayout()}function oD(e){e.isLayoutDirty=!1}function sD(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function cD(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function lD(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function uD(e){e.resolveTargetDelta()}function dD(e){e.calcProjection()}function fD(e){e.resetSkewAndRotation()}function pD(e){e.removeLeadSnapshot()}function mD(e,t,n){e.translate=Bb(t.translate,0,n),e.scale=Bb(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function hD(e,t,n,r){e.min=Bb(t.min,n.min,r),e.max=Bb(t.max,n.max,r)}function gD(e,t,n,r){hD(e.x,t.x,n.x,r),hD(e.y,t.y,n.y,r)}function _D(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var vD={duration:.45,ease:[.4,0,.1,1]},yD=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),bD=yD(`applewebkit/`)&&!yD(`chrome/`)?Math.round:ay;function xD(e){e.min=bD(e.min),e.max=bD(e.max)}function SD(e){xD(e.x),xD(e.y)}function CD(e,t,n){return e===`position`||e===`preserve-aspect`&&!oE(TE(t),TE(n),.2)}function wD(e){return e!==e.root&&e.scroll?.wasRoot}var TD=QE({attachResizeListener:(e,t)=>zE(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),ED={current:void 0},DD=QE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ED.current){let e=new TD({});e.mount(window),e.setOptions({layoutScroll:!0}),ED.current=e}return ED.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),OD=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function kD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function AD(...e){return t=>{let n=!1,r=e.map(e=>{let r=kD(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():kD(e[t],null)}}}}function jD(...e){return b.useCallback(AD(...e),e)}var MD=class extends b.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(UC(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=UC(e)&&e.offsetWidth||0,r=UC(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function ND({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,b.useId)(),s=(0,b.useRef)(null),c=(0,b.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,b.useContext)(OD),u=jD(s,e.props?.ref??e?.ref);return(0,b.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
54
54
|
[data-motion-pop-id="${o}"] {
|
|
55
55
|
position: absolute !important;
|
|
56
56
|
width: ${e}px !important;
|
|
@@ -111,4 +111,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
111
111
|
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
112
112
|
`,...a.current()});return/^[\t ]/.test(l)&&(l=bR(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}ER.peek=DR;function ER(e){return e.value||``}function DR(){return`<`}OR.peek=kR;function OR(e,t,n,r){let i=_R(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function kR(){return`!`}AR.peek=jR;function AR(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function jR(){return`!`}MR.peek=NR;function MR(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function NR(){return"`"}function PR(e,t){let n=sM(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}FR.peek=IR;function FR(e,t,n,r){let i=_R(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(PR(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function IR(e,t,n){return PR(e,n)?`<`:`[`}LR.peek=RR;function LR(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function RR(){return`[`}function zR(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function BR(e){let t=zR(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function VR(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function HR(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function UR(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?VR(n):zR(n),s=e.ordered?o===`.`?`)`:`.`:BR(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),HR(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function WR(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function GR(e,t,n,r){let i=WR(n),a=n.bulletCurrent||zR(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function KR(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var qR=eI([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function JR(e,t,n,r){return(e.children.some(function(e){return qR(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function YR(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}XR.peek=ZR;function XR(e,t,n,r){let i=YR(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=xR(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=bR(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=xR(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+bR(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function ZR(e,t,n){return n.options.strong||`*`}function QR(e,t,n,r){return n.safe(e.value,r)}function $R(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ez(e,t,n){let r=(HR(n)+(n.options.ruleSpaces?` `:``)).repeat($R(n));return n.options.ruleSpaces?r.slice(0,-1):r}var tz={blockquote:sR,break:dR,code:hR,definition:vR,emphasis:SR,hardBreak:dR,heading:TR,html:ER,image:OR,imageReference:AR,inlineCode:MR,link:FR,linkReference:LR,list:UR,listItem:GR,paragraph:KR,root:JR,strong:XR,text:QR,thematicBreak:ez};function nz(){return{enter:{table:rz,tableData:sz,tableHeader:sz,tableRow:az},exit:{codeText:cz,table:iz,tableData:oz,tableHeader:oz,tableRow:oz}}}function rz(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function iz(e){this.exit(e),this.data.inTable=void 0}function az(e){this.enter({type:`tableRow`,children:[]},e)}function oz(e){this.exit(e)}function sz(e){this.enter({type:`tableCell`,children:[]},e)}function cz(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,lz));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function lz(e,t){return t===`|`?t:e}function uz(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
113
113
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
114
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return iR(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=tz.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function dz(){return{exit:{taskListCheckValueChecked:pz,taskListCheckValueUnchecked:pz,paragraph:mz}}}function fz(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:hz}}}function pz(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function mz(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function hz(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=tz.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function gz(){return[SL(),KL(),ZL(),nz(),dz()]}function _z(e){return{extensions:[CL(),qL(e),QL(),uz(e),fz()]}}var vz={tokenize:Mz,partial:!0},yz={tokenize:Nz,partial:!0},bz={tokenize:Pz,partial:!0},xz={tokenize:Fz,partial:!0},Sz={tokenize:Iz,partial:!0},Cz={name:`wwwAutolink`,tokenize:Az,previous:Lz},wz={name:`protocolAutolink`,tokenize:jz,previous:Rz},Tz={name:`emailAutolink`,tokenize:kz,previous:zz},Ez={};function Dz(){return{text:Ez}}for(var Oz=48;Oz<123;)Ez[Oz]=Tz,Oz++,Oz===58?Oz=65:Oz===91&&(Oz=97);Ez[43]=Tz,Ez[45]=Tz,Ez[46]=Tz,Ez[95]=Tz,Ez[72]=[Tz,wz],Ez[104]=[Tz,wz],Ez[87]=[Tz,Cz],Ez[119]=[Tz,Cz];function kz(e,t,n){let r=this,i,a;return o;function o(t){return!Bz(t)||!zz.call(r,r.previous)||Vz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Bz(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Sz,u,l)(t):t===45||t===95||SM(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&xM(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Az(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Lz.call(r,r.previous)||Vz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(vz,e.attempt(yz,e.attempt(bz,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function jz(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Rz.call(r,r.previous)&&!Vz(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(xM(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||wM(t)||OM(t)||jM(t)||AM(t)?n(t):e.attempt(yz,e.attempt(bz,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Mz(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Nz(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(xz,c,s)(t):t===null||OM(t)||jM(t)||t!==45&&AM(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Pz(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(xz,t,a)(o):o===null||OM(o)||jM(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Fz(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||OM(o)||jM(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||OM(e)||jM(e)?t(e):r(e)}function a(e){return xM(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):xM(t)?(e.consume(t),o):n(t)}}function Iz(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return SM(e)?n(e):t(e)}}function Lz(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||OM(e)}function Rz(e){return!xM(e)}function zz(e){return!(e===47||Bz(e))}function Bz(e){return e===43||e===45||e===46||e===95||SM(e)}function Vz(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Hz={tokenize:Xz,partial:!0};function Uz(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:qz,continuation:{tokenize:Jz},exit:Yz}},text:{91:{name:`gfmFootnoteCall`,tokenize:Kz},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Wz,resolveTo:Gz}}}}function Wz(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=bM(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Gz(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Kz(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||OM(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(bM(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return OM(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function qz(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||OM(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=bM(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return OM(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),PM(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Jz(e,t,n){return e.check(YM,t,e.attempt(Hz,t,n))}function Yz(e){e.exit(`gfmFootnoteDefinition`)}function Xz(e,t,n){let r=this;return PM(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Zz(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&pM(o,o.length,0,HM(s,e.slice(r+1,n),t)),pM(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),pM(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=VM(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=VM(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Qz=class{constructor(){this.map=[]}add(e,t,n){$z(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function $z(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function eB(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function tB(){return{flow:{null:{name:`table`,tokenize:nB,resolveAll:rB}}}}function nB(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):$(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):kM(t)?PM(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||OM(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,kM(t)?PM(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return kM(t)?PM(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||$(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return kM(t)?PM(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||$(n)?(e.exit(`tableRow`),t(n)):kM(n)?PM(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||OM(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function rB(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Qz;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(aB(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=iB(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=iB(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=iB(f,t,o,i,n,d)):(o[0]=o[1],d=iB(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&aB(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=eB(t.events,n))}return e}function iB(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},oB(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=oB(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=oB(t.events,n[2]),a=oB(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},oB(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function aB(e,t,n,r,i){let a=[],o=oB(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function oB(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var sB={name:`tasklistCheck`,tokenize:lB};function cB(){return{text:{91:sB}}}function lB(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return OM(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return $(r)?t(r):kM(r)?e.check({tokenize:uB},t,n)(r):n(r)}}function uB(e,t,n){return PM(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function dB(e){return gM([Dz(),Uz(),Zz(e),tB(),cB()])}var fB={};function pB(e){let t=this,n=e||fB,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(dB(n)),a.push(gz()),o.push(_z(n))}function mB({content:e,className:t}){return(0,C.jsx)(`div`,{className:K(`space-y-3 break-words text-foreground`,`[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-4`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]`,`[&_h1]:text-xl [&_h1]:font-semibold [&_h2]:text-lg [&_h2]:font-semibold [&_h3]:font-semibold`,`[&_li]:ml-5 [&_ol]:list-decimal [&_ul]:list-disc`,`[&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_table]:w-full [&_table]:border-collapse [&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:text-left`,t),children:(0,C.jsx)(lL,{remarkPlugins:[pB],children:e})})}function hB(e){return!Number.isFinite(e)||e<=0?`0.0s`:e<1?`${e.toFixed(1)}s`:`${Math.round(e)}s`}function gB(e){return e===void 0?`Thought`:`Thought for ${hB(e)}`}function _B({durationSeconds:e,isOpen:t=!1,isThinking:n=!1,onToggle:r,reasoningText:i=``}){let a=Fk(),o=i.trim().length>0;if(!o&&!n&&e===void 0)return null;let s=n?`Thinking...`:gB(e),c=a?{duration:0}:{duration:.18,ease:[.23,1,.32,1]};return(0,C.jsxs)(`div`,{className:`mb-2 text-xs text-muted-foreground`,children:[(0,C.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:r,className:`inline-flex items-center gap-1.5 text-left font-medium text-muted-foreground transition-colors duration-150 ease-[var(--natroc-ease-out)] hover:text-foreground`,children:[(0,C.jsx)(Ke,{className:`size-3.5 shrink-0`}),n?(0,C.jsx)(kA,{text:s,duration:1.4}):(0,C.jsx)(`span`,{children:s}),(0,C.jsx)(X.span,{"aria-hidden":`true`,animate:{rotate:t?180:0},transition:c,className:`inline-flex`,children:(0,C.jsx)(Ye,{className:`size-3.5 shrink-0`})})]}),(0,C.jsx)(zD,{initial:!1,children:t&&o&&(0,C.jsx)(X.div,{initial:a?!1:{height:0,opacity:0,y:-4},animate:{height:`auto`,opacity:1,y:0},exit:a?{opacity:0}:{height:0,opacity:0},transition:c,className:`overflow-hidden`,children:(0,C.jsx)(`div`,{className:`mt-1 pl-5`,children:(0,C.jsx)(mB,{content:i,className:K(`space-y-1 text-xs leading-relaxed text-muted-foreground`,`[&_p]:my-0 [&_pre]:my-1 [&_pre]:rounded-md [&_pre]:border [&_pre]:border-border/60 [&_pre]:bg-muted/40 [&_pre]:p-2`)})})},`reasoning-content`)})]})}function vB({events:e}){return e.length===0?null:(0,C.jsx)(`div`,{className:`mb-2 flex flex-col gap-1.5`,children:e.map(e=>(0,C.jsx)(yB,{event:e},e.id))})}function yB({event:e}){let[t,n]=(0,b.useState)(!1);return(0,C.jsxs)(`div`,{className:`natroc-soft-panel rounded-lg border border-border bg-muted/30 text-xs`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,C.jsx)(bB,{status:e.status}),(0,C.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:e.name}),(0,C.jsx)(`span`,{className:`truncate text-muted-foreground`,children:xB(e.args)}),e.risk===`high`&&(0,C.jsx)(`span`,{className:`shrink-0 rounded bg-amber-500/15 px-1.5 py-0.5 text-[0.65rem] font-medium text-amber-600 dark:text-amber-400`,children:`high risk`}),(0,C.jsx)(Ye,{className:K(`ml-auto h-4 w-4 shrink-0 text-muted-foreground transition-transform`,t&&`rotate-180`)})]}),t&&(0,C.jsx)(`div`,{className:`border-t border-border px-3 py-2`,children:(0,C.jsx)(`pre`,{className:`overflow-x-auto whitespace-pre-wrap break-words text-[0.7rem] leading-relaxed text-muted-foreground`,children:e.output??`Running...`})})]})}function bB({status:e}){return e===`running`?(0,C.jsx)(`span`,{className:`h-3.5 w-3.5 shrink-0 animate-spin rounded-full border-2 border-muted-foreground/30 border-t-muted-foreground`}):e===`error`?(0,C.jsx)(qt,{className:`h-4 w-4 shrink-0 text-destructive`}):(0,C.jsx)(Je,{className:`h-4 w-4 shrink-0 text-green-600 dark:text-green-400`})}function xB(e){let t=Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`string`?t:JSON.stringify(t)}`).join(` · `);return t.length>90?`${t.slice(0,90)}…`:t}var SB={id:`ollama`,listModels:CB};async function CB(){return(await J.call(`providers.models`,{provider:`ollama`})).models??[]}var wB={id:`openrouter`,listModels:TB};async function TB(){return(await J.call(`providers.models`,{provider:`openrouter`})).models??[]}var EB={openrouter:wB,ollama:SB};function DB(e){return EB[e]}function OB(e){return DB(e).listModels()}async function kB(){try{return(await J.call(`providers.list`)).providers?.find(e=>e.isActive)??null}catch{return null}}async function AB(e){return(await J.call(`conversations.messages`,{conversationId:e})).messages??[]}function jB(e,t){return new Promise((n,r)=>{t.onStart?.(),J.stream(`agent.chat`,e,{onEvent:e=>{let n=e;switch(n.type){case`text`:t.onText(n.delta);break;case`reasoning`:t.onReasoning(n.delta);break;case`step`:t.onStep?.();break;case`tool_call`:t.onToolCall?.({id:n.id,name:n.name,args:n.args,risk:n.risk});break;case`tool_result`:t.onToolResult?.({id:n.id,status:n.status,output:n.output});break;case`metadata`:break}},onEnd:e=>{t.onDone(e),n()},onError:e=>r(e)})})}function MB(e,t,n){return t||(n&&e.some(e=>e.id===n)?n:e[0]?.id??n??void 0)}function NB(e,t){return!t||e.some(e=>e.id===t)?e:[{id:t,name:t},...e]}var PB=[`medium`,`low`,`auto`,`high`,`minimal`,`xhigh`];function FB(e){let t=e.replace(/[_-]+/g,` `).trim();return t.toLowerCase()===`xhigh`?`Extra High`:t.split(/\s+/).map(e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(` `)}function IB(e){return e?.thinking?.supported?e.thinking.efforts.map(e=>({value:e,label:FB(e)})):[]}function LB(e,t){return t&&e.some(e=>e.value===t)?t:PB.find(t=>e.some(e=>e.value===t))??e[0]?.value}var RB=`The agent finished without a visible response. Please try again.`;function zB(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!1),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)([]),[u,d]=(0,b.useState)(),[f,p]=(0,b.useState)(),[m,h]=(0,b.useState)(!1),g=(0,b.useRef)(null),_=o?.baseUrl??null,v=o?.defaultModel??null,y=o?.id,x=o?.provider,S=(0,b.useMemo)(()=>NB(c,u),[c,u]),C=(0,b.useMemo)(()=>S.find(e=>e.id===u),[S,u]),w=(0,b.useMemo)(()=>IB(C),[C]),T=(0,b.useMemo)(()=>!y||!x?null:{baseUrl:_,defaultModel:v,id:y,provider:x},[_,v,y,x]),E=(0,b.useCallback)(async()=>{s(await kB())},[]),D=(0,b.useCallback)(async e=>{r(!0);try{let n=await AB(e);a(e),t(n.map(e=>{let t=typeof e.thinkingDurationMs==`number`?Math.max(0,Math.round(e.thinkingDurationMs/100)/10):void 0;return{id:e.id,role:e.role,text:e.content,reasoningText:e.reasoningText??void 0,isReasoningOpen:!1,isThinking:!1,thinkingDurationSeconds:t,toolEvents:(e.toolEvents??[]).map(e=>({id:e.id,name:e.name,args:e.args,risk:e.risk,status:e.status,output:e.output})),files:[]}}))}catch(e){t([{id:crypto.randomUUID(),role:`error`,text:e instanceof Error?e.message:`Failed to load conversation.`,files:[]}])}finally{r(!1)}},[]),O=(0,b.useCallback)(async()=>{let e=window.location.hash.match(/^#\/chat\/(.+)$/)?.[1];e&&await D(e)},[D]);return(0,b.useEffect)(()=>{E(),O();let e=()=>{E()},n=e=>{let t=e;t.detail?.id&&D(t.detail.id)},r=()=>{a(void 0),t([])};return window.addEventListener(`natroc:provider-updated`,e),window.addEventListener(`natroc:conversation-selected`,n),window.addEventListener(`natroc:new-conversation`,r),()=>{window.removeEventListener(`natroc:provider-updated`,e),window.removeEventListener(`natroc:conversation-selected`,n),window.removeEventListener(`natroc:new-conversation`,r)}},[D,O,E]),(0,b.useEffect)(()=>{if(!T){g.current=null,l([]),d(void 0),p(void 0);return}let e=T,t=BB(e),n=g.current===t,r=!1;g.current=t,n||(l([]),d(void 0),p(void 0));async function i(){h(!0);try{let t=await OB(e.provider);if(r)return;l(t),d(r=>MB(t,n?r:void 0,e.defaultModel))}catch{if(r)return;n||l([]),d(t=>n?t??e.defaultModel??void 0:e.defaultModel??void 0)}finally{r||h(!1)}}return i(),()=>{r=!0}},[T]),(0,b.useEffect)(()=>{p(e=>LB(w,e))},[w]),{activeProvider:o,handleSend:async(e,c,l)=>{let d=e.trim();if(!d||n)return;let f=l?.thinkingEffort?{enabled:!0,effort:l.thinkingEffort}:void 0,p=(c??[]).map(e=>({name:e.name,url:URL.createObjectURL(e)})),m=crypto.randomUUID();t(e=>[...e,{id:m,role:`user`,text:d,files:p}]),r(!0);let h=crypto.randomUUID(),g=null,_=0,v,y=()=>{g===null&&(g=performance.now())},b=()=>(g!==null&&(_+=(performance.now()-g)/1e3,g=null,v=_),v);try{let e=o??await kB();if(!e)throw Error(`Connect OpenRouter or Ollama before sending a message.`);await jB({conversationId:i,message:d,model:u,thinking:f},{onStart(){t(e=>[...e,VB(h)])},onStep(){t(e=>e.map(e=>e.id===h?{...e,text:``}:e))},onText(e){t(t=>t.map(t=>t.id===h?{...t,text:t.text+e,isLoading:!1,isThinking:!1,thinkingDurationSeconds:b()??t.thinkingDurationSeconds}:t))},onToolCall(e){t(t=>t.map(t=>t.id===h?{...t,text:``,isLoading:!1,isThinking:!1,thinkingDurationSeconds:b()??t.thinkingDurationSeconds,toolEvents:[...t.toolEvents??[],{id:e.id,name:e.name,args:e.args,risk:e.risk,status:`running`}]}:t))},onToolResult(e){t(t=>t.map(t=>t.id===h?{...t,toolEvents:(t.toolEvents??[]).map(t=>t.id===e.id?{...t,status:e.status,output:e.output}:t)}:t))},onReasoning(e){y(),t(t=>t.map(t=>t.id===h?{...t,reasoningText:`${t.reasoningText??``}${e}`,isLoading:!1,isThinking:!0,thinkingDurationSeconds:void 0}:t))},onDone(n){a(n.conversationId),window.dispatchEvent(new Event(`natroc:conversation-updated`)),s(e),t(e=>e.map(e=>e.id===h?{...e,text:HB(n.content,e.text),isLoading:!1,isThinking:!1,thinkingDurationSeconds:b()??e.thinkingDurationSeconds}:e))}})}catch(e){t(t=>[...t.filter(e=>e.id!==h||!!(e.text||e.reasoningText||e.toolEvents&&e.toolEvents.length>0)).map(e=>e.id===h?{...e,isThinking:!1,thinkingDurationSeconds:b()??e.thinkingDurationSeconds}:e),{id:crypto.randomUUID(),role:`error`,text:e instanceof Error?e.message:`Failed to send message.`,files:[]}])}finally{r(!1)}},handleToggleReasoning:e=>{t(t=>t.map(t=>t.id===e?{...t,isReasoningOpen:!t.isReasoningOpen}:t))},isEmpty:e.length===0,isLoading:n,isLoadingModels:m,messages:e,modelOptions:S,selectedModel:u,selectedThinkingEffort:f,setSelectedModel:d,setSelectedThinkingEffort:p,thinkingEffortOptions:w}}function BB(e){return`${e.provider}:${e.id}:${e.baseUrl??``}`}function VB(e){return{id:e,role:`assistant`,text:``,reasoningText:``,isReasoningOpen:!1,isLoading:!0,isThinking:!1,thinkingDurationSeconds:void 0,toolEvents:[],files:[]}}function HB(e,t){return e.trim()?e:t.trim()?t:RB}function UB({clientHeight:e,scrollHeight:t}){return Math.max(0,t-e)}var WB=48,GB=360;function KB(){let{activeProvider:e,handleSend:t,handleToggleReasoning:n,isEmpty:r,isLoading:i,isLoadingModels:a,messages:o,modelOptions:s,selectedModel:c,selectedThinkingEffort:l,setSelectedModel:u,setSelectedThinkingEffort:d,thinkingEffortOptions:f}=zB(),p=(0,b.useRef)(null),m=(0,b.useRef)(!0),h=(0,b.useRef)(!1),g=(0,b.useRef)(null),[_,v]=(0,b.useState)(!0),[y,x]=(0,b.useState)(!1),S=(0,b.useCallback)((e=`auto`)=>{let t=p.current;t&&(t.scrollTo({top:UB(t),behavior:e}),v(!0))},[]),w=(0,b.useCallback)(()=>{let e=p.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<=WB;if(h.current){m.current=!0,v(t);return}m.current=t,v(t)},[]),T=(0,b.useCallback)(()=>{m.current=!0,h.current=!0,x(!0),g.current!==null&&window.clearTimeout(g.current);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;S(e?`auto`:`smooth`);let t=()=>{S(),h.current=!1,x(!1),g.current=null};if(e){t();return}g.current=window.setTimeout(t,GB)},[S]),E=(0,b.useCallback)((e,n,r)=>{m.current=!0,v(!0),t(e,n,r),requestAnimationFrame(()=>S())},[t,S]);return(0,b.useEffect)(()=>{if(r){m.current=!0;let e=window.setTimeout(()=>{v(!0)},0);return()=>window.clearTimeout(e)}if(!m.current)return;let e=requestAnimationFrame(()=>S());return()=>cancelAnimationFrame(e)},[r,o,S]),(0,b.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),h.current=!1},[]),(0,C.jsxs)(`div`,{className:K(`flex h-full min-h-0 w-full flex-col items-center gap-4 overflow-hidden`,r?`justify-center`:`justify-end`),children:[!r&&(0,C.jsx)(`div`,{ref:p,onScroll:w,className:`flex min-h-0 w-full max-w-2xl flex-1 scrollbar-none flex-col gap-3 overflow-y-auto py-4 [&::-webkit-scrollbar]:hidden`,children:o.map(e=>(0,C.jsxs)(`div`,{className:K(`natroc-message-enter text-sm leading-relaxed`,e.role===`user`&&`self-end rounded-2xl border border-border bg-muted/40 px-4 py-2`,e.role===`assistant`&&`w-full self-start py-1`,e.role===`error`&&`self-start rounded-2xl border border-destructive/30 bg-destructive/10 px-4 py-2 text-destructive`),children:[e.role===`assistant`&&(e.reasoningText||e.isThinking||e.thinkingDurationSeconds!==void 0)&&(0,C.jsx)(_B,{durationSeconds:e.thinkingDurationSeconds,isOpen:e.isReasoningOpen,isThinking:e.isThinking,reasoningText:e.reasoningText,onToggle:()=>n(e.id)}),e.role===`assistant`&&e.toolEvents&&e.toolEvents.length>0&&(0,C.jsx)(vB,{events:e.toolEvents}),e.role===`assistant`&&e.isLoading&&!e.text&&!e.reasoningText&&!e.toolEvents?.length&&(0,C.jsx)(OA,{}),e.text&&(e.role===`assistant`?(0,C.jsx)(mB,{content:e.text}):(0,C.jsx)(`p`,{className:`whitespace-pre-wrap`,children:e.text})),e.files.length>0&&(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.files.map(e=>(0,C.jsx)(`img`,{src:e.url,alt:e.name,className:`h-20 w-20 rounded-lg object-cover`},e.url))})]},e.id))}),(0,C.jsxs)(`div`,{className:`flex w-full max-w-2xl shrink-0 flex-col items-center gap-3`,children:[r&&(0,C.jsxs)(`div`,{className:`natroc-stagger flex max-w-2xl flex-col items-center gap-3 text-center`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground md:text-3xl`,children:`Good morning! May this beautiful morning lead you to progress. Have a productive day ahead.`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e?`Using ${e.displayName}${c?` · ${c}`:``}`:`Connect OpenRouter or Ollama to start chatting.`})]}),(0,C.jsxs)(`div`,{className:`relative w-full`,children:[(!_||y)&&(0,C.jsx)(`div`,{className:`pointer-events-none absolute bottom-full left-0 z-10 mb-2 flex w-full justify-center`,children:(0,C.jsx)(`button`,{type:`button`,"aria-label":i?`Follow agent stream`:`Scroll to latest message`,onClick:T,className:K(`natroc-soft-panel pointer-events-auto inline-flex h-8 w-8 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-[0_8px_24px_rgba(0,0,0,0.14)] transition-[background-color,color,transform] duration-150 ease-[var(--natroc-ease-out)] hover:bg-muted hover:text-foreground active:scale-[0.96] motion-reduce:active:scale-100`,y&&`natroc-jump-to-latest`),children:(0,C.jsx)($e,{className:`h-4 w-4`})})}),(0,C.jsx)(DA,{onSend:E,isLoading:i,placeholder:`Write a message...`,selectedModel:c,modelOptions:s,onModelChange:u,isModelLoading:a,isModelDisabled:!e,thinkingEffortOptions:f,selectedThinkingEffort:l,onThinkingEffortChange:d})]})]})]})}var qB=[`image/png`,`image/jpeg`,`image/webp`],JB=2*1024*1024;function YB(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)({status:`loading`}),[i,a]=(0,b.useState)({status:`idle`}),[o,s]=(0,b.useState)({status:`idle`}),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)({currentPassword:``,newPassword:``,confirmPassword:``}),f=(0,b.useRef)(null),p=(0,b.useCallback)(e=>{t(e),window.dispatchEvent(new CustomEvent(`natroc:user-updated`,{detail:e}))},[]),m=(0,b.useCallback)(async()=>{r({status:`loading`});try{let e=await J_();if(!e){r({status:`error`,message:`Account session is not available.`});return}t(e),r({status:`idle`})}catch(e){r({status:`error`,message:e instanceof Error?e.message:`Failed to load account.`})}},[]);(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{m()},0);return()=>window.clearTimeout(e)},[m]);let h=async e=>{let t=e.currentTarget.files?.[0];if(e.currentTarget.value=``,!(!t||i.status===`loading`)){if(!ZB(t.type)){me.error(`Profile picture must be PNG, JPEG, or WebP.`),a({status:`error`,message:`Profile picture must be PNG, JPEG, or WebP.`});return}if(t.size>JB){me.error(`Profile picture must be 2MB or smaller.`),a({status:`error`,message:`Profile picture must be 2MB or smaller.`});return}a({status:`loading`});try{let e=await QB(t);l(e),p((await Z_({dataUrl:e})).user),l(null),me.success(`Profile picture updated.`),a({status:`success`,message:`Profile picture updated.`})}catch(e){let t=$B(e,`Failed to update profile picture.`);l(null),me.error(t),a({status:`error`,message:t})}}},g=async()=>{if(!(i.status===`loading`||!e?.avatarUrl)){a({status:`loading`});try{p((await Z_({dataUrl:null})).user),me.success(`Profile picture removed.`),a({status:`success`,message:`Profile picture removed.`})}catch(e){let t=$B(e,`Failed to remove profile picture.`);me.error(t),a({status:`error`,message:t})}}},_=async e=>{if(e.preventDefault(),o.status!==`loading`){if(u.newPassword!==u.confirmPassword){me.error(`New password and confirmation do not match.`),s({status:`error`,message:`New password and confirmation do not match.`});return}s({status:`loading`});try{p((await X_({currentPassword:u.currentPassword,newPassword:u.newPassword})).user),d({currentPassword:``,newPassword:``,confirmPassword:``}),me.success(`Password updated.`),s({status:`success`,message:`Password updated.`})}catch(e){let t=$B(e,`Failed to update password.`);me.error(t),s({status:`error`,message:t})}}},v=e?.fullName.trim().charAt(0).toUpperCase()||`N`,y=c??e?.avatarUrl,x=i.status===`loading`,S=o.status===`loading`;return n.status===`loading`?(0,C.jsx)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] items-center justify-center text-sm text-muted-foreground`,children:`Loading account...`}):!e||n.status===`error`?(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] flex-col items-center justify-center gap-3`,children:[(0,C.jsx)(`p`,{className:`text-sm text-destructive`,children:n.message??`Failed to load account.`}),(0,C.jsxs)(q,{variant:`secondary`,onClick:()=>void m(),children:[(0,C.jsx)(Ft,{}),`Retry`]})]}):(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] w-full flex-col gap-6`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Account Settings`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.username})]}),(0,C.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]`,children:[(0,C.jsx)(`section`,{className:`natroc-soft-panel rounded-lg border border-border bg-card p-4`,children:(0,C.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,C.jsxs)(C_,{className:`size-20`,children:[y&&(0,C.jsx)(w_,{src:y,alt:e.fullName}),(0,C.jsx)(T_,{className:`text-xl`,children:v})]}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`h2`,{className:`font-medium`,children:`Profile Picture`}),(0,C.jsx)(`p`,{className:`mt-1 truncate text-sm text-muted-foreground`,children:e.fullName}),(0,C.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(q,{type:`button`,variant:`secondary`,onClick:()=>f.current?.click(),disabled:x,children:[(0,C.jsx)(ht,{}),`Choose image`]}),(0,C.jsxs)(q,{type:`button`,variant:`ghost`,onClick:()=>void g(),disabled:x||!e.avatarUrl,children:[(0,C.jsx)(Ht,{}),`Remove`]})]}),(0,C.jsx)(`input`,{ref:f,type:`file`,className:`hidden`,accept:qB.join(`,`),onChange:h}),(0,C.jsx)(XB,{state:i})]})]})}),(0,C.jsxs)(`form`,{className:`natroc-soft-panel rounded-lg border border-border bg-card p-4`,onSubmit:_,children:[(0,C.jsxs)(`div`,{className:`mb-5 flex items-center gap-2`,children:[(0,C.jsx)(St,{className:`size-4 text-muted-foreground`}),(0,C.jsx)(`h2`,{className:`font-medium`,children:`Password`})]}),(0,C.jsxs)(`div`,{className:`grid gap-4`,children:[(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`account-current-password`,children:`Current password`}),(0,C.jsx)(jg,{id:`account-current-password`,type:`password`,autoComplete:`current-password`,value:u.currentPassword,onChange:e=>d(t=>({...t,currentPassword:e.currentTarget.value})),required:!0})]}),(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`account-new-password`,children:`New password`}),(0,C.jsx)(jg,{id:`account-new-password`,type:`password`,autoComplete:`new-password`,minLength:6,value:u.newPassword,onChange:e=>d(t=>({...t,newPassword:e.currentTarget.value})),required:!0})]}),(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`account-confirm-password`,children:`Confirm new password`}),(0,C.jsx)(jg,{id:`account-confirm-password`,type:`password`,autoComplete:`new-password`,minLength:6,value:u.confirmPassword,onChange:e=>d(t=>({...t,confirmPassword:e.currentTarget.value})),required:!0})]})]}),(0,C.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsx)(XB,{state:o}),(0,C.jsx)(q,{type:`submit`,disabled:S||!u.currentPassword||!u.newPassword||!u.confirmPassword,children:S?`Saving...`:`Save password`})]})]})]})]})}function XB({state:e}){return e.message?(0,C.jsx)(`p`,{className:K(`mt-3 text-sm`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:e.message}):null}function ZB(e){return qB.some(t=>t===e)}function QB(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result==`string`){t(r.result);return}n(Error(`Unable to read profile picture.`))},r.onerror=()=>n(Error(`Unable to read profile picture.`)),r.readAsDataURL(e)})}function $B(e,t){return e instanceof Error?e.message:t}function eV({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`field-group`,className:K(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var tV=wg(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function nV({className:e,orientation:t=`vertical`,...n}){return(0,C.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:K(tV({orientation:t}),e),...n})}function rV({className:e,...t}){return(0,C.jsx)(vv,{"data-slot":`field-label`,className:K(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function iV({className:e,...t}){return(0,C.jsx)(`p`,{"data-slot":`field-description`,className:K(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function aV({className:e,children:t,errors:n,...r}){let i=(0,b.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,C.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,C.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,C.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:K(`text-sm font-normal text-destructive`,e),...r,children:i}):null}var oV=[{cx:48,cy:68},{cx:104,cy:36},{cx:152,cy:72},{cx:86,cy:130},{cx:164,cy:154}],sV=[`M48 68L104 36L152 72`,`M48 68L86 130L164 154`,`M104 36L86 130L152 72L164 154`];function cV(){let e=Fk();return(0,C.jsxs)(X.svg,{"aria-hidden":`true`,viewBox:`0 0 212 188`,className:`h-full w-full text-foreground`,fill:`none`,initial:e?!1:{opacity:0,y:8},animate:e?void 0:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsx)(`rect`,{x:`18`,y:`18`,width:`176`,height:`152`,rx:`18`,fill:`oklch(0.98 0.004 250 / 0.7)`,stroke:`oklch(0.48 0.02 250 / 0.16)`}),(0,C.jsx)(`path`,{d:`M42 156h128`,stroke:`oklch(0.48 0.02 250 / 0.16)`,strokeLinecap:`round`}),sV.map((t,n)=>(0,C.jsx)(X.path,{d:t,stroke:`oklch(0.62 0.08 218 / 0.58)`,strokeWidth:`2`,strokeLinecap:`round`,initial:e?!1:{pathLength:.2,opacity:.35},animate:e?void 0:{pathLength:[.2,1,.2],opacity:[.32,.72,.32]},transition:{delay:n*.16,duration:2.6,repeat:1/0,ease:[.22,1,.36,1]}},t)),oV.map((t,n)=>(0,C.jsxs)(X.g,{animate:e?void 0:{scale:[1,1.08,1],opacity:[.78,1,.78]},transition:{delay:n*.12,duration:2,repeat:1/0,ease:`easeInOut`},style:{originX:t.cx,originY:t.cy},children:[(0,C.jsx)(`circle`,{cx:t.cx,cy:t.cy,r:`12`,fill:`oklch(0.96 0.01 250)`,stroke:`oklch(0.46 0.04 250 / 0.28)`}),(0,C.jsx)(`circle`,{cx:t.cx,cy:t.cy,r:`4`,fill:`oklch(0.62 0.08 218)`})]},`${t.cx}-${t.cy}`)),(0,C.jsx)(X.rect,{x:`68`,y:`79`,width:`76`,height:`35`,rx:`12`,fill:`oklch(0.18 0.012 250)`,animate:e?void 0:{y:[79,76,79]},transition:{duration:3,repeat:1/0,ease:[.22,1,.36,1]}}),(0,C.jsx)(X.path,{d:`M88 96h36`,stroke:`oklch(0.82 0.1 190)`,strokeWidth:`3`,strokeLinecap:`round`,animate:e?void 0:{opacity:[.45,1,.45]},transition:{duration:1.8,repeat:1/0,ease:`easeInOut`}})]})}function lV({brandName:e=`Natroc`,className:t,errorMessage:n,isLoading:r=!1,logo:i=(0,C.jsx)(Pv,{}),onForgotPassword:a,onRegister:o,onSubmit:s}){let[c,l]=(0,b.useState)({password:``,username:``}),[u,d]=(0,b.useState)(!1),f=c.username.trim().length>0&&c.password.trim().length>0&&!r;return(0,C.jsx)(`main`,{className:K(`grid h-dvh max-h-dvh min-h-0 overflow-hidden bg-background text-foreground`,t),children:(0,C.jsxs)(`div`,{className:`grid min-h-0 lg:grid-cols-[minmax(24rem,0.9fr)_minmax(0,1.1fr)]`,children:[(0,C.jsx)(`section`,{className:`flex min-h-0 items-center justify-center px-4 py-6 sm:px-6 lg:px-10`,children:(0,C.jsxs)(X.div,{className:`flex w-full max-w-sm flex-col gap-7`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-lg border bg-card text-foreground`,children:i}),(0,C.jsxs)(`div`,{className:`flex flex-col`,children:[(0,C.jsx)(`span`,{className:`text-base leading-tight font-semibold`,children:e}),(0,C.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Agent workspace`})]})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-normal`,children:`Welcome back`}),(0,C.jsx)(`p`,{className:`max-w-[46ch] text-sm leading-6 text-muted-foreground`,children:`Sign in with your workspace username and password.`})]}),(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f&&s?.({password:c.password,username:c.username.trim()})},className:`flex flex-col gap-5`,children:[(0,C.jsxs)(eV,{children:[(0,C.jsxs)(nV,{children:[(0,C.jsx)(rV,{htmlFor:`login-username`,children:`Username`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Kt,{})}),(0,C.jsx)(_v,{id:`login-username`,autoComplete:`username`,placeholder:`your.username`,value:c.username,onChange:e=>l(t=>({...t,username:e.target.value}))})]})]}),(0,C.jsxs)(nV,{children:[(0,C.jsx)(rV,{htmlFor:`login-password`,children:`Password`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Ct,{})}),(0,C.jsx)(_v,{id:`login-password`,autoComplete:`current-password`,placeholder:`Enter password`,type:u?`text`:`password`,value:c.password,onChange:e=>l(t=>({...t,password:e.target.value}))}),(0,C.jsx)(mv,{align:`inline-end`,children:(0,C.jsx)(gv,{"aria-label":u?`Hide password`:`Show password`,onClick:()=>d(e=>!e),size:`icon-xs`,children:u?(0,C.jsx)(ot,{}):(0,C.jsx)(st,{})})})]}),(0,C.jsx)(iV,{children:`Use the account assigned to your Natroc workspace.`})]})]}),(0,C.jsx)(zD,{children:n&&(0,C.jsx)(X.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,ease:[.22,1,.36,1]},children:(0,C.jsx)(aV,{children:n})})}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(q,{type:`button`,variant:`ghost`,className:`px-0`,onClick:a,disabled:!a||r,children:`Forgot password?`}),(0,C.jsxs)(q,{type:`submit`,disabled:!f,children:[r?`Signing in...`:`Sign in`,(0,C.jsx)(Ve,{"data-icon":`inline-end`})]})]})]}),o&&(0,C.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Don't have an account?`,` `,(0,C.jsx)(`button`,{type:`button`,onClick:o,className:`font-medium text-foreground underline-offset-4 hover:underline`,children:`Create one`})]})]})}),(0,C.jsxs)(`section`,{className:`relative hidden min-h-0 overflow-hidden border-l bg-muted/30 lg:block`,children:[(0,C.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px),linear-gradient(90deg,oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px)] [mask-image:radial-gradient(ellipse_at_center,black_18%,transparent_72%)] bg-[size:38px_38px]`}),(0,C.jsxs)(`div`,{className:`relative flex h-full flex-col justify-center px-14`,children:[(0,C.jsx)(X.div,{className:`mx-auto aspect-[1.12] w-full max-w-md`,initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.22,1,.36,1]},children:(0,C.jsx)(cV,{})}),(0,C.jsxs)(`div`,{className:`mx-auto flex max-w-md flex-col gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Secure access for every user`}),(0,C.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:`Natroc keeps the interface quiet while your agent handles the busy work behind the workspace.`})]})]})]})]})})}function uV(){let[e,t]=(0,b.useState)(``),[n,r]=(0,b.useState)(!1);return(0,C.jsx)(lV,{onSubmit:async e=>{r(!0),t(``);try{L_((await K_(e.username,e.password)).token),window.location.assign(`/`)}catch(e){t(e instanceof Error?e.message:`Sign in failed.`)}finally{r(!1)}},isLoading:n,errorMessage:e,onRegister:()=>window.location.assign(`/register`)})}var dV=[{detail:`Human-readable profile identity`,label:`Full Name`},{detail:`Workspace handle for agent access`,label:`Username`},{detail:`Verified secret before submit`,label:`Password`}],fV=[mt,Kt,_t];function pV(){let e=Fk();return(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col gap-6`,children:[(0,C.jsxs)(X.div,{"aria-hidden":`true`,className:`relative mx-auto aspect-square w-full max-w-[22rem]`,initial:e?!1:{opacity:0,y:8},animate:e?void 0:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsx)(X.div,{className:`absolute inset-6 rounded-full border border-border`,animate:e?void 0:{rotate:360},transition:{duration:18,repeat:1/0,ease:`linear`}}),(0,C.jsx)(X.div,{className:`absolute inset-14 rounded-full border border-dashed border-border`,animate:e?void 0:{rotate:-360},transition:{duration:24,repeat:1/0,ease:`linear`}}),(0,C.jsxs)(X.div,{className:`absolute inset-x-16 top-16 flex flex-col gap-3 rounded-lg border bg-background p-4 shadow-sm`,animate:e?void 0:{y:[-3,3,-3]},transition:{duration:3.2,repeat:1/0,ease:[.22,1,.36,1]},children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground`,children:(0,C.jsx)(ct,{className:`size-4`})}),(0,C.jsx)(`span`,{className:`rounded-md border px-2 py-1 text-xs text-muted-foreground`,children:`user.create`})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(`span`,{className:`h-2 w-3/4 rounded-sm bg-foreground/80`}),(0,C.jsx)(`span`,{className:`h-2 w-1/2 rounded-sm bg-muted-foreground/45`})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,C.jsx)(`span`,{className:`h-8 rounded-md border bg-muted/50`}),(0,C.jsx)(`span`,{className:`h-8 rounded-md border bg-muted/50`}),(0,C.jsx)(`span`,{className:`h-8 rounded-md border bg-muted/50`})]})]}),(0,C.jsx)(X.div,{className:`absolute top-12 left-1 rounded-lg border bg-background px-3 py-2 text-xs font-medium shadow-sm`,animate:e?void 0:{y:[-2,4,-2]},transition:{duration:2.8,repeat:1/0,ease:`easeInOut`},children:`Full Name`}),(0,C.jsx)(X.div,{className:`absolute top-28 right-2 rounded-lg border bg-background px-3 py-2 text-xs font-medium shadow-sm`,animate:e?void 0:{y:[3,-3,3]},transition:{duration:3,repeat:1/0,ease:`easeInOut`},children:`Username`}),(0,C.jsx)(X.div,{className:`absolute bottom-14 left-12 rounded-lg border bg-background px-3 py-2 text-xs font-medium shadow-sm`,animate:e?void 0:{y:[-1,4,-1]},transition:{duration:3.4,repeat:1/0,ease:`easeInOut`},children:`Password`})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-2`,children:dV.map((t,n)=>{let r=fV[n];return(0,C.jsxs)(X.div,{className:`flex items-center gap-3 rounded-lg border bg-background px-3 py-2 shadow-sm`,initial:e?!1:{opacity:0,y:6},animate:e?void 0:{opacity:1,y:0},transition:{delay:.08*n,duration:.28,ease:[.22,1,.36,1]},children:[(0,C.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-md bg-muted`,children:(0,C.jsx)(r,{className:`size-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.label}),(0,C.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:t.detail})]}),(0,C.jsx)(Je,{className:`size-4 text-muted-foreground`})]},t.label)})})]})}function mV({brandName:e=`Natroc`,className:t,errorMessage:n,isLoading:r=!1,logo:i=(0,C.jsx)(Pv,{}),onLogin:a,onSubmit:o}){let[s,c]=(0,b.useState)({confirmPassword:``,fullName:``,password:``,username:``}),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),p=s.confirmPassword.length>0&&s.password!==s.confirmPassword,m=s.fullName.trim().length>0&&s.username.trim().length>0&&s.password.length>0&&s.confirmPassword.length>0&&!p&&!r;return(0,C.jsx)(`main`,{className:K(`grid h-dvh max-h-dvh min-h-0 overflow-hidden bg-background text-foreground`,t),children:(0,C.jsxs)(`div`,{className:`grid min-h-0 lg:grid-cols-[minmax(24rem,0.9fr)_minmax(0,1.1fr)]`,children:[(0,C.jsx)(`section`,{className:`flex min-h-0 items-center justify-center px-4 py-5 sm:px-6 lg:px-10`,children:(0,C.jsxs)(X.div,{className:`flex w-full max-w-sm flex-col gap-6`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-lg border bg-card text-foreground`,children:i}),(0,C.jsxs)(`div`,{className:`flex flex-col`,children:[(0,C.jsx)(`span`,{className:`text-base leading-tight font-semibold`,children:e}),(0,C.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`User access`})]})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-normal`,children:`Create account`}),(0,C.jsx)(`p`,{className:`max-w-[48ch] text-sm leading-6 text-muted-foreground`,children:`Register a user profile for access to the Natroc workspace.`})]}),(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),m&&o?.({confirmPassword:s.confirmPassword,fullName:s.fullName.trim(),password:s.password,username:s.username.trim()})},className:`flex flex-col gap-5`,children:[(0,C.jsxs)(eV,{children:[(0,C.jsxs)(nV,{children:[(0,C.jsx)(rV,{htmlFor:`register-full-name`,children:`Full Name`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(mt,{})}),(0,C.jsx)(_v,{id:`register-full-name`,autoComplete:`name`,placeholder:`Full name`,value:s.fullName,onChange:e=>c(t=>({...t,fullName:e.target.value}))})]})]}),(0,C.jsxs)(nV,{children:[(0,C.jsx)(rV,{htmlFor:`register-username`,children:`Username`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Kt,{})}),(0,C.jsx)(_v,{id:`register-username`,autoComplete:`username`,placeholder:`your.username`,value:s.username,onChange:e=>c(t=>({...t,username:e.target.value}))})]})]}),(0,C.jsxs)(nV,{children:[(0,C.jsx)(rV,{htmlFor:`register-password`,children:`Password`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Ct,{})}),(0,C.jsx)(_v,{id:`register-password`,autoComplete:`new-password`,placeholder:`Create password`,type:l?`text`:`password`,value:s.password,onChange:e=>c(t=>({...t,password:e.target.value}))}),(0,C.jsx)(mv,{align:`inline-end`,children:(0,C.jsx)(gv,{"aria-label":l?`Hide password`:`Show password`,onClick:()=>u(e=>!e),size:`icon-xs`,children:l?(0,C.jsx)(ot,{}):(0,C.jsx)(st,{})})})]})]}),(0,C.jsxs)(nV,{"data-invalid":p,children:[(0,C.jsx)(rV,{htmlFor:`register-confirm-password`,children:`Confirm Password`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Ct,{})}),(0,C.jsx)(_v,{id:`register-confirm-password`,"aria-invalid":p,autoComplete:`new-password`,placeholder:`Confirm password`,type:d?`text`:`password`,value:s.confirmPassword,onChange:e=>c(t=>({...t,confirmPassword:e.target.value}))}),(0,C.jsx)(mv,{align:`inline-end`,children:(0,C.jsx)(gv,{"aria-label":d?`Hide confirm password`:`Show confirm password`,onClick:()=>f(e=>!e),size:`icon-xs`,children:d?(0,C.jsx)(ot,{}):(0,C.jsx)(st,{})})})]}),p?(0,C.jsx)(aV,{children:`Passwords do not match.`}):(0,C.jsx)(iV,{children:`Use the same password to confirm access.`})]})]}),(0,C.jsx)(zD,{children:n&&(0,C.jsx)(X.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,ease:[.22,1,.36,1]},children:(0,C.jsx)(aV,{children:n})})}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(q,{type:`button`,variant:`ghost`,className:`px-0`,onClick:a,disabled:!a||r,children:`Sign in instead`}),(0,C.jsxs)(q,{type:`submit`,disabled:!m,children:[r?`Creating...`:`Create account`,(0,C.jsx)(Ve,{"data-icon":`inline-end`})]})]})]})]})}),(0,C.jsxs)(`section`,{className:`relative hidden min-h-0 overflow-hidden border-l bg-muted/30 lg:block`,children:[(0,C.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px),linear-gradient(90deg,oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px)] [mask-image:radial-gradient(ellipse_at_center,black_18%,transparent_72%)] bg-[size:38px_38px]`}),(0,C.jsxs)(`div`,{className:`relative flex h-full flex-col justify-center px-14`,children:[(0,C.jsx)(pV,{}),(0,C.jsxs)(`div`,{className:`mx-auto flex max-w-md flex-col gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Account identity for every user`}),(0,C.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:`Keep identity simple: a real name, a workspace username, and a password verified before submit.`})]})]})]})]})})}function hV(){let[e,t]=(0,b.useState)(``),[n,r]=(0,b.useState)(!1);return(0,C.jsx)(mV,{onSubmit:async e=>{if(e.password!==e.confirmPassword){t(`Passwords do not match.`);return}r(!0),t(``);try{L_((await q_({username:e.username,fullName:e.fullName,password:e.password})).token),window.location.assign(`/`)}catch(e){t(e instanceof Error?e.message:`Registration failed.`)}finally{r(!1)}},isLoading:n,errorMessage:e,onLogin:()=>window.location.assign(`/login`)})}var gV=wg(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function _V({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,C.jsx)(n?$t:`span`,{"data-slot":`badge`,"data-variant":t,className:K(gV({variant:t}),e),...r})}async function vV(){return J.call(`agent.status`)}async function yV(e){let t=e?.trim();return(await J.call(`agent.memory`,t?{query:t}:{})).entries??[]}async function bV(e=`pending`){return(await J.call(`agent.proposals.list`,{status:e})).proposals??[]}async function xV(e){return J.call(`agent.proposals.approve`,{id:e})}async function SV(e){return J.call(`agent.proposals.reject`,{id:e})}async function CV(){return(await J.call(`agent.improve`,{})).proposals??[]}function wV(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)({error:null,isLoading:!0}),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),g=(0,b.useCallback)(async()=>{d({error:null,isLoading:!0});try{let[e,n,i]=await Promise.all([vV(),yV(o),bV()]);t(e),r(n),a(i)}catch(e){d({error:e instanceof Error?e.message:`Failed to load agent state.`,isLoading:!1});return}d({error:null,isLoading:!1})},[o]);(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{g()},0);return()=>window.clearTimeout(e)},[g]);let _=async e=>{p(e);try{await xV(e),await g()}finally{p(null)}},v=async e=>{p(e);try{await SV(e),await g()}finally{p(null)}};return(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] w-full flex-col gap-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(Ge,{className:`size-4`}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:`Agent runtime`})]}),(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Natroc is alive locally`})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(q,{variant:`secondary`,onClick:()=>void g(),disabled:u.isLoading,children:[(0,C.jsx)(Ft,{className:K(u.isLoading&&`animate-spin`)}),`Refresh`]}),(0,C.jsxs)(q,{onClick:async()=>{h(!0),l(null);try{l(`Created ${(await CV()).length} pending proposal(s).`),await g()}catch(e){l(e instanceof Error?e.message:`Improvement review failed.`)}finally{h(!1)}},disabled:m,children:[(0,C.jsx)(zt,{className:K(m&&`animate-pulse`)}),`Improve`]})]})]}),u.error&&(0,C.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:u.error}),c&&(0,C.jsx)(`div`,{className:`natroc-soft-panel rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm text-muted-foreground`,children:c}),(0,C.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,C.jsx)(TV,{status:e}),(0,C.jsx)(EV,{status:e}),(0,C.jsx)(DV,{status:e})]}),(0,C.jsxs)(`div`,{className:`grid min-h-0 gap-5 xl:grid-cols-[minmax(0,1.05fr)_minmax(360px,0.95fr)]`,children:[(0,C.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Pending proposals`}),(0,C.jsx)(_V,{variant:`secondary`,children:i.length})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-3`,children:i.length===0?(0,C.jsx)(jV,{text:`No pending proposals.`}):i.map(e=>(0,C.jsx)(kV,{proposal:e,isBusy:f===e.id,onApprove:_,onReject:v},e.id))})]}),(0,C.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Approved memory`}),(0,C.jsxs)(`div`,{className:`relative w-56`,children:[(0,C.jsx)(It,{className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(jg,{value:o,onChange:e=>s(e.target.value),placeholder:`Search memory`,className:`h-9 rounded-lg border-transparent bg-muted/80 pl-9`})]})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.length===0?(0,C.jsx)(jV,{text:`No approved memory.`}):n.map(e=>(0,C.jsx)(AV,{entry:e},e.id))})]})]})]})}function TV({status:e}){return(0,C.jsx)(OV,{icon:(0,C.jsx)(Ge,{className:`size-4`}),label:`Runtime`,value:e?.providers.active?.displayName??`No provider`,detail:e?.providers.active?.defaultModel??`Model not selected`})}function EV({status:e}){let t=e?.homeFiles.filter(e=>e.exists).length??0,n=e?.homeFiles.length??0;return(0,C.jsx)(OV,{icon:(0,C.jsx)(pt,{className:`size-4`}),label:`Home`,value:e?.paths?.homeDir??`~/.natroc/home`,detail:`${t}/${n} files ready`})}function DV({status:e}){return(0,C.jsx)(OV,{icon:(0,C.jsx)(it,{className:`size-4`}),label:`Memory`,value:`${e?.counts.memories??0} approved`,detail:`${e?.counts.pendingProposals??0} pending proposal(s)`})}function OV({detail:e,icon:t,label:n,value:r}){return(0,C.jsxs)(`div`,{className:`natroc-soft-panel min-w-0 rounded-lg border border-border bg-muted/30 p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[t,(0,C.jsx)(`span`,{children:n})]}),(0,C.jsx)(`p`,{className:`mt-3 truncate text-sm font-semibold`,children:r}),(0,C.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,children:e})]})}function kV({isBusy:e,onApprove:t,onReject:n,proposal:r}){return(0,C.jsx)(`div`,{className:`natroc-soft-panel rounded-lg border border-border bg-background/60 p-4`,children:(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(_V,{variant:`secondary`,children:r.kind}),(0,C.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.title})]}),(0,C.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:r.content}),(0,C.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground/80`,children:r.reason})]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,C.jsx)(q,{size:`icon`,variant:`secondary`,disabled:e,onClick:()=>void t(r.id),"aria-label":`Approve proposal`,children:(0,C.jsx)(Je,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,disabled:e,onClick:()=>void n(r.id),"aria-label":`Reject proposal`,children:(0,C.jsx)(qt,{})})]})]})})}function AV({entry:e}){return(0,C.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/60 p-4`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(_V,{variant:`secondary`,children:e.kind}),(0,C.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.title})]}),(0,C.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:e.content})]})}function jV({text:e}){return(0,C.jsx)(`div`,{className:`rounded-lg border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground`,children:e})}function MV({className:e,size:t=`default`,...n}){return(0,C.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:K(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function NV({className:e,size:t=`default`,...n}){return(0,C.jsxs)(`div`,{className:K(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,e),"data-slot":`native-select-wrapper`,"data-size":t,children:[(0,C.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...n}),(0,C.jsx)(Ye,{className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function PV({className:e,...t}){return(0,C.jsx)(`option`,{"data-slot":`native-select-option`,className:K(`bg-[Canvas] text-[CanvasText]`,e),...t})}function FV({className:e,size:t=`default`,...n}){return(0,C.jsx)(Ip,{"data-slot":`switch`,"data-size":t,className:K(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,C.jsx)(Lp,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function IV({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,C.jsx)(`table`,{"data-slot":`table`,className:K(`w-full caption-bottom text-sm`,e),...t})})}function LV({className:e,...t}){return(0,C.jsx)(`thead`,{"data-slot":`table-header`,className:K(`[&_tr]:border-b`,e),...t})}function RV({className:e,...t}){return(0,C.jsx)(`tbody`,{"data-slot":`table-body`,className:K(`[&_tr:last-child]:border-0`,e),...t})}function zV({className:e,...t}){return(0,C.jsx)(`tr`,{"data-slot":`table-row`,className:K(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function BV({className:e,...t}){return(0,C.jsx)(`th`,{"data-slot":`table-head`,className:K(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function VV({className:e,...t}){return(0,C.jsx)(`td`,{"data-slot":`table-cell`,className:K(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function HV({className:e,orientation:t=`horizontal`,...n}){return(0,C.jsx)(em,{"data-slot":`tabs`,"data-orientation":t,className:K(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var UV=wg(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function WV({className:e,variant:t=`default`,...n}){return(0,C.jsx)(tm,{"data-slot":`tabs-list`,"data-variant":t,className:K(UV({variant:t}),e),...n})}function GV({className:e,...t}){return(0,C.jsx)(nm,{"data-slot":`tabs-trigger`,className:K(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function KV({className:e,...t}){return(0,C.jsx)(rm,{"data-slot":`tabs-content`,className:K(`flex-1 text-sm outline-none`,e),...t})}async function qV(){return(await J.call(`agents.list`)).agents??[]}async function JV(e){return(await J.call(`agents.create`,e)).agent}async function YV(e,t){return(await J.call(`agents.update`,{id:e,...t})).agent}async function XV(e){await J.call(`agents.delete`,{id:e})}async function ZV(e){return(await J.call(`agents.setDefault`,{id:e})).agent}async function QV(){return(await J.call(`usage.summary`)).summary}async function $V(){return(await J.call(`usage.detail`,{limit:100})).events??[]}async function eH(){return(await J.call(`channels.accounts.list`)).accounts??[]}async function tH(e){return(await J.call(`channels.accounts.create`,e)).account}async function nH(e){return(await J.call(`channels.accounts.connect`,{id:e})).account}async function rH(e){return(await J.call(`channels.accounts.disconnect`,{id:e})).account}async function iH(e){await J.call(`channels.accounts.delete`,{id:e})}async function aH(){return(await J.call(`channels.bindings.list`)).bindings??[]}async function oH(e){return(await J.call(`channels.bindings.create`,e)).binding}async function sH(e){await J.call(`channels.bindings.delete`,{id:e})}var cH={name:``,description:``,defaultProvider:``,defaultModel:``,workspace:``,systemPrompt:``,configJson:`{}`,isEnabled:!0,isDefault:!1},lH={channel:`telegram`,displayName:``,accountRef:``,token:``,allowlist:``};function uH(){let[e,t]=(0,b.useState)(()=>bH()),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)([]),[c,l]=(0,b.useState)([]),[u,d]=(0,b.useState)([]),[f,p]=(0,b.useState)({error:null,isLoading:!0}),m=(0,b.useCallback)(async()=>{p({error:null,isLoading:!0});try{let[e,t,n,i,o]=await Promise.all([qV(),QV(),$V(),eH(),aH()]);r(e),a(t),s(n),l(i),d(o),p({error:null,isLoading:!1})}catch(e){p({error:e instanceof Error?e.message:`Failed to load config data.`,isLoading:!1})}},[]);return(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{m()},0);return()=>window.clearTimeout(e)},[m]),(0,C.jsxs)(`section`,{className:`natroc-enter flex w-full flex-1 flex-col gap-5`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(Rt,{className:`size-4`}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:`Config`})]}),(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Agent, usage, and channel control`})]}),(0,C.jsxs)(q,{variant:`secondary`,onClick:()=>void m(),disabled:f.isLoading,children:[(0,C.jsx)(Ft,{className:K(f.isLoading&&`animate-spin`)}),`Refresh`]})]}),f.error&&(0,C.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:f.error}),(0,C.jsxs)(HV,{value:e,onValueChange:e=>{if(!xH(e))return;t(e);let n=new URL(window.location.href);n.searchParams.set(`tab`,e),window.history.replaceState(null,``,n)},className:`gap-5`,children:[(0,C.jsxs)(WV,{className:`w-full justify-start overflow-x-auto sm:w-fit`,children:[(0,C.jsxs)(GV,{value:`agents`,children:[(0,C.jsx)(We,{}),`Agents`]}),(0,C.jsxs)(GV,{value:`usage`,children:[(0,C.jsx)(qe,{}),`Usage`]}),(0,C.jsxs)(GV,{value:`channels`,children:[(0,C.jsx)(Nt,{}),`Channels`]})]}),(0,C.jsx)(KV,{value:`agents`,className:`space-y-5`,children:(0,C.jsx)(dH,{agents:n,onRefresh:m})}),(0,C.jsx)(KV,{value:`usage`,children:(0,C.jsx)(fH,{summary:i,events:o})}),(0,C.jsx)(KV,{value:`channels`,children:(0,C.jsx)(pH,{agents:n,accounts:c,bindings:u,onRefresh:m})})]})]})}function dH({agents:e,onRefresh:t}){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(cH),[o,s]=(0,b.useState)(null),c=e.find(e=>e.id===n)??null,l=()=>{r(null),a(cH),s(null)},u=e=>{r(e.id),a({name:e.name,description:e.description,defaultProvider:e.defaultProvider??``,defaultModel:e.defaultModel??``,workspace:e.workspace??``,systemPrompt:e.systemPrompt,configJson:JSON.stringify(e.config??{},null,2),isEnabled:e.isEnabled,isDefault:e.isDefault}),s(null)};return(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(360px,0.72fr)_minmax(0,1.28fr)]`,children:[(0,C.jsxs)(vH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:c?`Edit agent`:`Create agent`}),(0,C.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.length,` configured`]})]}),n&&(0,C.jsx)(q,{variant:`ghost`,onClick:l,children:`New`})]}),(0,C.jsxs)(`form`,{className:`mt-4 space-y-3`,onSubmit:async e=>{e.preventDefault(),s(null);let r;try{let e=JSON.parse(i.configJson||`{}`);r=e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{s(`Config JSON is invalid.`);return}let a={name:i.name,description:i.description,defaultProvider:i.defaultProvider||null,defaultModel:SH(i.defaultModel),workspace:SH(i.workspace),systemPrompt:i.systemPrompt,config:r,isEnabled:i.isEnabled,isDefault:i.isDefault};n?(await YV(n,a),s(`Agent updated.`)):(await JV(a),s(`Agent created.`)),await t(),n||l()},children:[(0,C.jsx)(gH,{label:`Name`,children:(0,C.jsx)(jg,{value:i.name,onChange:e=>a(t=>({...t,name:e.target.value})),required:!0})}),(0,C.jsx)(gH,{label:`Description`,children:(0,C.jsx)(dv,{value:i.description,onChange:e=>a(t=>({...t,description:e.target.value})),className:`min-h-20`})}),(0,C.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,C.jsx)(gH,{label:`Provider`,children:(0,C.jsxs)(NV,{className:`w-full`,value:i.defaultProvider,onChange:e=>a(t=>({...t,defaultProvider:e.target.value})),children:[(0,C.jsx)(PV,{value:``,children:`Active provider`}),(0,C.jsx)(PV,{value:`openrouter`,children:`OpenRouter`}),(0,C.jsx)(PV,{value:`ollama`,children:`Ollama`})]})}),(0,C.jsx)(gH,{label:`Model`,children:(0,C.jsx)(jg,{value:i.defaultModel,onChange:e=>a(t=>({...t,defaultModel:e.target.value})),placeholder:`Provider default`})})]}),(0,C.jsx)(gH,{label:`Workspace`,children:(0,C.jsx)(jg,{value:i.workspace,onChange:e=>a(t=>({...t,workspace:e.target.value})),placeholder:`Optional path`})}),(0,C.jsx)(gH,{label:`System prompt`,children:(0,C.jsx)(dv,{value:i.systemPrompt,onChange:e=>a(t=>({...t,systemPrompt:e.target.value})),className:`min-h-24`})}),(0,C.jsx)(gH,{label:`Config JSON`,children:(0,C.jsx)(dv,{value:i.configJson,onChange:e=>a(t=>({...t,configJson:e.target.value})),className:`min-h-24 font-mono text-xs`})}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,C.jsx)(_H,{label:`Enabled`,checked:i.isEnabled,onCheckedChange:e=>a(t=>({...t,isEnabled:e}))}),(0,C.jsx)(_H,{label:`Default`,checked:i.isDefault,onCheckedChange:e=>a(t=>({...t,isDefault:e}))})]}),o&&(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o}),(0,C.jsxs)(q,{type:`submit`,children:[(0,C.jsx)(Pt,{}),c?`Update`:`Create`]})]})]}),(0,C.jsxs)(vH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Agents`}),(0,C.jsx)(_V,{variant:`secondary`,children:e.length})]}),(0,C.jsx)(`div`,{className:`mt-4`,children:e.length===0?(0,C.jsx)(yH,{text:`No agents configured.`}):(0,C.jsxs)(IV,{children:[(0,C.jsx)(LV,{children:(0,C.jsxs)(zV,{children:[(0,C.jsx)(BV,{children:`Name`}),(0,C.jsx)(BV,{children:`Provider`}),(0,C.jsx)(BV,{children:`Status`}),(0,C.jsx)(BV,{className:`text-right`,children:`Actions`})]})}),(0,C.jsx)(RV,{children:e.map(e=>(0,C.jsxs)(zV,{children:[(0,C.jsxs)(VV,{className:`min-w-52 whitespace-normal`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,C.jsx)(`div`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.description||`No description`})]}),(0,C.jsxs)(VV,{children:[e.defaultProvider??`active`,(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.defaultModel??`default model`})]}),(0,C.jsx)(VV,{children:(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[e.isDefault&&(0,C.jsx)(_V,{variant:`secondary`,children:`default`}),(0,C.jsx)(_V,{variant:e.isEnabled?`default`:`outline`,children:e.isEnabled?`enabled`:`disabled`})]})}),(0,C.jsx)(VV,{children:(0,C.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Edit agent`,onClick:()=>u(e),children:(0,C.jsx)(Mt,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Set default agent`,disabled:e.isDefault,onClick:()=>void ZV(e.id).then(t),children:(0,C.jsx)(Vt,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Delete agent`,onClick:()=>void XV(e.id).then(t),children:(0,C.jsx)(Ht,{})})]})})]},e.id))})]})})]})]}),(0,C.jsx)(wV,{})]})}function fH({events:e,summary:t}){let n=t?.totals;return(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,C.jsx)(hH,{label:`Requests`,value:wH(n?.requests)}),(0,C.jsx)(hH,{label:`Tokens`,value:wH(n?.totalTokens)}),(0,C.jsx)(hH,{label:`Known`,value:wH(n?.knownRequests)}),(0,C.jsx)(hH,{label:`Unknown`,value:wH(n?.unknownRequests)})]}),(0,C.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2`,children:[(0,C.jsx)(mH,{title:`By provider`,rows:t?.byProvider??[],labelKey:`provider`}),(0,C.jsx)(mH,{title:`By channel`,rows:t?.byChannel??[],labelKey:`channel`})]}),(0,C.jsxs)(vH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Request detail`}),(0,C.jsx)(_V,{variant:`secondary`,children:e.length})]}),(0,C.jsx)(`div`,{className:`mt-4`,children:e.length===0?(0,C.jsx)(yH,{text:`No usage events yet.`}):(0,C.jsxs)(IV,{children:[(0,C.jsx)(LV,{children:(0,C.jsxs)(zV,{children:[(0,C.jsx)(BV,{children:`Time`}),(0,C.jsx)(BV,{children:`Provider`}),(0,C.jsx)(BV,{children:`Model`}),(0,C.jsx)(BV,{children:`Channel`}),(0,C.jsx)(BV,{children:`Tokens`}),(0,C.jsx)(BV,{children:`Status`})]})}),(0,C.jsx)(RV,{children:e.map(e=>(0,C.jsxs)(zV,{children:[(0,C.jsx)(VV,{children:TH(e.createdAt)}),(0,C.jsx)(VV,{children:e.provider}),(0,C.jsx)(VV,{children:e.model}),(0,C.jsx)(VV,{children:e.channel}),(0,C.jsx)(VV,{children:wH(e.totalTokens)}),(0,C.jsx)(VV,{children:(0,C.jsx)(_V,{variant:e.usageStatus===`actual`?`default`:`outline`,children:e.usageStatus})})]},e.id))})]})})]})]})}function pH({accounts:e,agents:t,bindings:n,onRefresh:r}){let[i,a]=(0,b.useState)(lH),[o,s]=(0,b.useState)({accountId:``,agentId:``,peer:`*`});return(0,C.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(360px,0.72fr)_minmax(0,1.28fr)]`,children:[(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(vH,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Add channel`}),(0,C.jsxs)(`form`,{className:`mt-4 space-y-3`,onSubmit:async e=>{e.preventDefault(),await tH({channel:i.channel,displayName:i.displayName,accountRef:SH(i.accountRef),token:SH(i.token),allowlist:CH(i.allowlist)}),a(lH),await r()},children:[(0,C.jsx)(gH,{label:`Channel`,children:(0,C.jsxs)(NV,{className:`w-full`,value:i.channel,onChange:e=>a(t=>({...t,channel:e.target.value})),children:[(0,C.jsx)(PV,{value:`telegram`,children:`Telegram`}),(0,C.jsx)(PV,{value:`whatsapp`,children:`WhatsApp`})]})}),(0,C.jsx)(gH,{label:`Display name`,children:(0,C.jsx)(jg,{value:i.displayName,onChange:e=>a(t=>({...t,displayName:e.target.value})),required:!0})}),(0,C.jsx)(gH,{label:`Account ref`,children:(0,C.jsx)(jg,{value:i.accountRef,onChange:e=>a(t=>({...t,accountRef:e.target.value})),placeholder:`@bot or phone/JID`})}),(0,C.jsx)(gH,{label:`Token`,children:(0,C.jsx)(jg,{value:i.token,onChange:e=>a(t=>({...t,token:e.target.value})),type:`password`,placeholder:`Telegram only`})}),(0,C.jsx)(gH,{label:`Allowlist`,children:(0,C.jsx)(jg,{value:i.allowlist,onChange:e=>a(t=>({...t,allowlist:e.target.value})),placeholder:`12345, *`})}),(0,C.jsxs)(q,{type:`submit`,children:[(0,C.jsx)(Pt,{}),`Add`]})]})]}),(0,C.jsxs)(vH,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Bind agent`}),(0,C.jsxs)(`form`,{className:`mt-4 space-y-3`,onSubmit:async e=>{e.preventDefault(),await oH({accountId:o.accountId,agentId:o.agentId,peer:o.peer,isEnabled:!0}),s({accountId:``,agentId:``,peer:`*`}),await r()},children:[(0,C.jsx)(gH,{label:`Account`,children:(0,C.jsxs)(NV,{className:`w-full`,value:o.accountId,onChange:e=>s(t=>({...t,accountId:e.target.value})),required:!0,children:[(0,C.jsx)(PV,{value:``,children:`Select account`}),e.map(e=>(0,C.jsx)(PV,{value:e.id,children:e.displayName},e.id))]})}),(0,C.jsx)(gH,{label:`Agent`,children:(0,C.jsxs)(NV,{className:`w-full`,value:o.agentId,onChange:e=>s(t=>({...t,agentId:e.target.value})),required:!0,children:[(0,C.jsx)(PV,{value:``,children:`Select agent`}),t.map(e=>(0,C.jsx)(PV,{value:e.id,children:e.name},e.id))]})}),(0,C.jsx)(gH,{label:`Peer`,children:(0,C.jsx)(jg,{value:o.peer,onChange:e=>s(t=>({...t,peer:e.target.value})),required:!0})}),(0,C.jsxs)(q,{type:`submit`,disabled:!e.length||!t.length,children:[(0,C.jsx)(Nt,{}),`Bind`]})]})]})]}),(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(vH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Accounts`}),(0,C.jsx)(_V,{variant:`secondary`,children:e.length})]}),(0,C.jsx)(`div`,{className:`mt-4 space-y-3`,children:e.length===0?(0,C.jsx)(yH,{text:`No channel accounts configured.`}):e.map(e=>(0,C.jsx)(MV,{className:`gap-0 rounded-lg border-border bg-background/60 p-4 py-4 shadow-none`,children:(0,C.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`h3`,{className:`font-medium`,children:e.displayName}),(0,C.jsx)(_V,{variant:`secondary`,children:e.channel}),(0,C.jsx)(_V,{variant:e.status===`connected`?`default`:`outline`,children:e.status})]}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.accountRef??`No account ref`}),typeof e.metadata.qr==`string`&&(0,C.jsx)(`p`,{className:`mt-2 break-all rounded-lg bg-muted/50 p-2 font-mono text-xs text-muted-foreground`,children:e.metadata.qr}),e.lastError&&(0,C.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:e.lastError})]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[e.status===`connected`?(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Disconnect channel`,onClick:()=>void rH(e.id).then(r),children:(0,C.jsx)(Wt,{})}):(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Connect channel`,onClick:()=>void nH(e.id).then(r),children:(0,C.jsx)(Nt,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Delete channel`,onClick:()=>void iH(e.id).then(r),children:(0,C.jsx)(Ht,{})})]})]})},e.id))})]}),(0,C.jsxs)(vH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Bindings`}),(0,C.jsx)(_V,{variant:`secondary`,children:n.length})]}),(0,C.jsx)(`div`,{className:`mt-4`,children:n.length===0?(0,C.jsx)(yH,{text:`No channel bindings configured.`}):(0,C.jsxs)(IV,{children:[(0,C.jsx)(LV,{children:(0,C.jsxs)(zV,{children:[(0,C.jsx)(BV,{children:`Peer`}),(0,C.jsx)(BV,{children:`Account`}),(0,C.jsx)(BV,{children:`Agent`}),(0,C.jsx)(BV,{className:`text-right`,children:`Actions`})]})}),(0,C.jsx)(RV,{children:n.map(n=>(0,C.jsxs)(zV,{children:[(0,C.jsx)(VV,{children:n.peer}),(0,C.jsx)(VV,{children:EH(e,n.accountId)}),(0,C.jsx)(VV,{children:DH(t,n.agentId)}),(0,C.jsx)(VV,{children:(0,C.jsx)(`div`,{className:`flex justify-end`,children:(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Delete binding`,onClick:()=>void sH(n.id).then(r),children:(0,C.jsx)(Ht,{})})})})]},n.id))})]})})]})]})]})}function mH({labelKey:e,rows:t,title:n}){return(0,C.jsxs)(vH,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:n}),(0,C.jsx)(`div`,{className:`mt-4`,children:t.length===0?(0,C.jsx)(yH,{text:`No usage breakdown yet.`}):(0,C.jsxs)(IV,{children:[(0,C.jsx)(LV,{children:(0,C.jsxs)(zV,{children:[(0,C.jsx)(BV,{children:`Name`}),(0,C.jsx)(BV,{children:`Requests`}),(0,C.jsx)(BV,{children:`Tokens`})]})}),(0,C.jsx)(RV,{children:t.map(t=>(0,C.jsxs)(zV,{children:[(0,C.jsx)(VV,{children:String(t[e]??`unknown`)}),(0,C.jsx)(VV,{children:wH(t.requests)}),(0,C.jsx)(VV,{children:wH(t.totalTokens)})]},String(t[e])))})]})})]})}function hH({label:e,value:t}){return(0,C.jsxs)(MV,{className:`gap-0 rounded-lg border-border bg-muted/30 p-4 py-4 shadow-none`,children:[(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),(0,C.jsx)(`p`,{className:`mt-2 text-xl font-semibold`,children:t})]})}function gH({children:e,label:t}){return(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(vv,{htmlFor:(0,b.useMemo)(()=>`${t.toLowerCase().replace(/\s+/g,`-`)}-${crypto.randomUUID()}`,[t]),children:t}),e]})}function _H({checked:e,label:t,onCheckedChange:n}){return(0,C.jsxs)(vv,{className:`flex items-center gap-2 text-sm`,children:[(0,C.jsx)(FV,{checked:e,onCheckedChange:n}),t]})}function vH({children:e}){return(0,C.jsx)(MV,{className:`natroc-soft-panel gap-0 rounded-lg border-border bg-background/70 p-4 py-4 shadow-none`,children:e})}function yH({text:e}){return(0,C.jsx)(`div`,{className:`rounded-lg border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground`,children:e})}function bH(){let e=new URLSearchParams(window.location.search).get(`tab`);return xH(e)?e:`agents`}function xH(e){return e===`agents`||e===`usage`||e===`channels`}function SH(e){return e.trim()||null}function CH(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function wH(e){return new Intl.NumberFormat().format(e??0)}function TH(e){return new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}function EH(e,t){return e.find(e=>e.id===t)?.displayName??`Unknown`}function DH(e,t){return e.find(e=>e.id===t)?.name??`Unknown`}function OH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty`,className:K(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function kH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-header`,className:K(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var AH=wg(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function jH({className:e,variant:t=`default`,...n}){return(0,C.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:K(AH({variant:t,className:e})),...n})}function MH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-title`,className:K(`font-heading text-sm font-medium tracking-tight`,e),...t})}function NH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-description`,className:K(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function PH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-content`,className:K(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,e),...t})}async function FH(){return(await J.call(`projects.list`)).projects??[]}async function IH(e,t){return(await J.call(`projects.create`,{name:e,description:t})).project}async function LH(e){await J.call(`projects.delete`,{id:e})}var RH=[`Activity`,`Name`,`Created`];function zH(e,t){let n=[...e];return t===`Name`?n.sort((e,t)=>e.name.localeCompare(t.name)):t===`Created`?n.sort((e,t)=>t.createdAt.localeCompare(e.createdAt)):n.sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function BH(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString()}function VH(e){return(0,C.jsxs)(`svg`,{viewBox:`0 0 96 96`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,"aria-hidden":`true`,...e,children:[(0,C.jsx)(`rect`,{x:`28`,y:`14`,width:`22`,height:`22`,rx:`1`}),(0,C.jsx)(`rect`,{x:`51`,y:`13`,width:`22`,height:`22`,rx:`1`}),(0,C.jsx)(`rect`,{x:`51`,y:`38`,width:`22`,height:`20`,rx:`1`}),(0,C.jsx)(`path`,{d:`M59 62V51a4 4 0 0 1 8 0v11`}),(0,C.jsx)(`path`,{d:`M67 58V49a4 4 0 0 1 8 0v14`}),(0,C.jsx)(`path`,{d:`M75 60v-8a4 4 0 0 1 8 0v15`}),(0,C.jsx)(`path`,{d:`M83 61v-6a4 4 0 0 1 8 0v17c0 10-6 16-17 16H55a4 4 0 0 1-4-4V62a4 4 0 0 1 8 0v10`}),(0,C.jsx)(`path`,{d:`M51 72h12`})]})}function HH(){let[e,t]=(0,b.useState)(`Activity`),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(!0),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(``),[m,h]=(0,b.useState)(``),[g,_]=(0,b.useState)(!1),[v,y]=(0,b.useState)(``),x=(0,b.useCallback)(async()=>{s(!0),l(``);try{a(await FH())}catch(e){l(e instanceof Error?e.message:`Failed to load projects.`)}finally{s(!1)}},[]);(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{x()});return()=>window.clearTimeout(e)},[x]);let S=()=>d(!0),w=()=>{p(``),h(``),y(``)},T=e=>{d(e),e||w()},E=async e=>{if(e.preventDefault(),!(!f.trim()||g)){_(!0),y(``);try{let e=await IH(f.trim(),m.trim());a(t=>[e,...t]),d(!1),w()}catch(e){y(e instanceof Error?e.message:`Failed to create project.`)}finally{_(!1)}}},D=async e=>{a(t=>t.filter(t=>t.id!==e));try{await LH(e)}catch{x()}},O=zH(i.filter(e=>{let t=n.trim().toLowerCase();return t?e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t):!0}),e);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] w-full flex-col gap-6`,children:[(0,C.jsxs)(`div`,{className:`natroc-stagger flex flex-col gap-5`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Projects`}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3 self-start sm:self-auto`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Sort by`}),(0,C.jsxs)(E_,{children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsxs)(q,{variant:`secondary`,children:[e,(0,C.jsx)(Ye,{})]})}),(0,C.jsx)(O_,{align:`end`,className:`w-36`,children:(0,C.jsx)(j_,{value:e,onValueChange:e=>t(e),children:RH.map(e=>(0,C.jsx)(M_,{value:e,children:e},e))})})]}),(0,C.jsx)(q,{onClick:S,children:`New project`})]})]}),(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(It,{className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(jg,{"aria-label":`Search projects`,placeholder:`Search projects...`,value:n,onChange:e=>r(e.target.value),className:`h-10 rounded-lg border-transparent bg-muted/80 pl-9 text-sm focus-visible:border-ring dark:bg-muted/80`})]})]}),o?(0,C.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-12 text-sm text-muted-foreground`,children:`Loading projects...`}):c?(0,C.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-12`,children:[(0,C.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),(0,C.jsx)(q,{variant:`secondary`,onClick:()=>void x(),children:`Try again`})]}):O.length===0?(0,C.jsx)(`div`,{className:`natroc-enter flex flex-1 items-center justify-center py-12`,children:(0,C.jsxs)(OH,{className:`max-w-md border-0 p-0`,children:[(0,C.jsxs)(kH,{children:[(0,C.jsx)(jH,{className:`mb-3 text-foreground`,children:(0,C.jsx)(VH,{className:`size-20`})}),(0,C.jsx)(MH,{children:i.length===0?`Looking to start a project?`:`No projects match your search`}),(0,C.jsx)(NH,{children:`Upload materials, set custom instructions, and organize conversations in one space.`})]}),(0,C.jsx)(PH,{children:(0,C.jsx)(q,{variant:`secondary`,onClick:S,children:`New project`})})]})}):(0,C.jsx)(`div`,{className:`natroc-stagger grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:O.map(e=>(0,C.jsxs)(`div`,{className:`natroc-soft-panel flex flex-col gap-2 rounded-lg border border-border bg-card p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsx)(`h3`,{className:`font-medium break-words`,children:e.name}),(0,C.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,onClick:()=>void D(e.id),children:(0,C.jsx)(Ht,{className:`text-muted-foreground`})})]}),e.description&&(0,C.jsx)(`p`,{className:`line-clamp-3 text-sm text-muted-foreground`,children:e.description}),(0,C.jsxs)(`p`,{className:`mt-auto text-xs text-muted-foreground`,children:[`Created `,BH(e.createdAt)]})]},e.id))})]}),(0,C.jsx)(nv,{open:u,onOpenChange:T,children:(0,C.jsxs)(ov,{className:`gap-6 rounded-lg p-6 sm:max-w-[520px]`,children:[(0,C.jsx)(lv,{className:`pr-8 text-2xl font-semibold`,children:`Create a project`}),(0,C.jsxs)(`div`,{className:`natroc-soft-panel rounded-lg bg-muted/80 p-4 dark:bg-background/80`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:`How to use projects`}),(0,C.jsxs)(uv,{className:`mt-3 space-y-3 text-sm leading-relaxed`,children:[(0,C.jsx)(`p`,{children:`Projects help organize your work and leverage knowledge across multiple conversations. Upload docs, code, and files to create themed collections that Natroc can reference again and again.`}),(0,C.jsx)(`p`,{children:`Start by creating a memorable title and description to organize your project. You can always edit it later.`})]})]}),(0,C.jsxs)(`form`,{className:`natroc-stagger flex flex-col gap-6`,onSubmit:E,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`project-name`,children:`What are you working on?`}),(0,C.jsx)(jg,{id:`project-name`,placeholder:`Name your project`,value:f,onChange:e=>p(e.target.value),className:`border-transparent bg-muted/80 dark:bg-muted/80`})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`project-description`,children:`What are you trying to achieve?`}),(0,C.jsx)(dv,{id:`project-description`,placeholder:`Describe your project, goals, subject, etc...`,value:m,onChange:e=>h(e.target.value),className:`min-h-20 resize-none border-transparent bg-muted/80 dark:bg-muted/80`})]}),v&&(0,C.jsx)(`p`,{className:`text-sm text-destructive`,children:v}),(0,C.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,C.jsx)(iv,{asChild:!0,children:(0,C.jsx)(q,{type:`button`,variant:`secondary`,children:`Cancel`})}),(0,C.jsx)(q,{type:`submit`,disabled:!f.trim()||g,children:g?`Creating...`:`Create project`})]})]})]})})]})}var UH=window.location.pathname;function WH(){return UH===`/login`?(0,C.jsx)(uV,{}):UH===`/register`?(0,C.jsx)(hV,{}):UH===`/onboarding/register`?(0,C.jsx)(rA,{}):z_()?UH===y_.home.path?(0,C.jsx)(Kv,{children:(0,C.jsx)(KB,{})}):UH===y_.projects.path?(0,C.jsx)(Kv,{children:(0,C.jsx)(HH,{})}):UH===`/agent`?(window.location.replace(`/config?tab=agents`),null):UH===y_.config.path?(0,C.jsx)(Kv,{children:(0,C.jsx)(uH,{})}):UH===y_.account.path?(0,C.jsx)(Kv,{children:(0,C.jsx)(YB,{})}):(0,C.jsx)(Hk,{}):(0,C.jsx)(uV,{})}var GH=WH();(0,x.createRoot)(document.getElementById(`root`)).render((0,C.jsx)(b.StrictMode,{children:(0,C.jsxs)(j,{children:[(0,C.jsx)(vg,{children:GH}),(0,C.jsx)(Jt,{position:`top-right`,richColors:!0})]})}));
|
|
114
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return iR(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=tz.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function dz(){return{exit:{taskListCheckValueChecked:pz,taskListCheckValueUnchecked:pz,paragraph:mz}}}function fz(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:hz}}}function pz(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function mz(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function hz(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=tz.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function gz(){return[SL(),KL(),ZL(),nz(),dz()]}function _z(e){return{extensions:[CL(),qL(e),QL(),uz(e),fz()]}}var vz={tokenize:Mz,partial:!0},yz={tokenize:Nz,partial:!0},bz={tokenize:Pz,partial:!0},xz={tokenize:Fz,partial:!0},Sz={tokenize:Iz,partial:!0},Cz={name:`wwwAutolink`,tokenize:Az,previous:Lz},wz={name:`protocolAutolink`,tokenize:jz,previous:Rz},Tz={name:`emailAutolink`,tokenize:kz,previous:zz},Ez={};function Dz(){return{text:Ez}}for(var Oz=48;Oz<123;)Ez[Oz]=Tz,Oz++,Oz===58?Oz=65:Oz===91&&(Oz=97);Ez[43]=Tz,Ez[45]=Tz,Ez[46]=Tz,Ez[95]=Tz,Ez[72]=[Tz,wz],Ez[104]=[Tz,wz],Ez[87]=[Tz,Cz],Ez[119]=[Tz,Cz];function kz(e,t,n){let r=this,i,a;return o;function o(t){return!Bz(t)||!zz.call(r,r.previous)||Vz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Bz(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Sz,u,l)(t):t===45||t===95||SM(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&xM(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Az(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Lz.call(r,r.previous)||Vz(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(vz,e.attempt(yz,e.attempt(bz,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function jz(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Rz.call(r,r.previous)&&!Vz(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(xM(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||wM(t)||OM(t)||jM(t)||AM(t)?n(t):e.attempt(yz,e.attempt(bz,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Mz(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Nz(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(xz,c,s)(t):t===null||OM(t)||jM(t)||t!==45&&AM(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Pz(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(xz,t,a)(o):o===null||OM(o)||jM(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Fz(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||OM(o)||jM(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||OM(e)||jM(e)?t(e):r(e)}function a(e){return xM(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):xM(t)?(e.consume(t),o):n(t)}}function Iz(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return SM(e)?n(e):t(e)}}function Lz(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||OM(e)}function Rz(e){return!xM(e)}function zz(e){return!(e===47||Bz(e))}function Bz(e){return e===43||e===45||e===46||e===95||SM(e)}function Vz(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Hz={tokenize:Xz,partial:!0};function Uz(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:qz,continuation:{tokenize:Jz},exit:Yz}},text:{91:{name:`gfmFootnoteCall`,tokenize:Kz},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Wz,resolveTo:Gz}}}}function Wz(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=bM(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Gz(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Kz(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||OM(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(bM(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return OM(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function qz(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||OM(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=bM(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return OM(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),PM(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Jz(e,t,n){return e.check(YM,t,e.attempt(Hz,t,n))}function Yz(e){e.exit(`gfmFootnoteDefinition`)}function Xz(e,t,n){let r=this;return PM(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Zz(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&pM(o,o.length,0,HM(s,e.slice(r+1,n),t)),pM(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),pM(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=VM(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=VM(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Qz=class{constructor(){this.map=[]}add(e,t,n){$z(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function $z(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function eB(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function tB(){return{flow:{null:{name:`table`,tokenize:nB,resolveAll:rB}}}}function nB(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):$(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):kM(t)?PM(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||OM(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,kM(t)?PM(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return kM(t)?PM(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||$(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return kM(t)?PM(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||$(n)?(e.exit(`tableRow`),t(n)):kM(n)?PM(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||OM(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function rB(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Qz;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(aB(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=iB(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=iB(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=iB(f,t,o,i,n,d)):(o[0]=o[1],d=iB(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&aB(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=eB(t.events,n))}return e}function iB(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},oB(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=oB(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=oB(t.events,n[2]),a=oB(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},oB(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function aB(e,t,n,r,i){let a=[],o=oB(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function oB(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var sB={name:`tasklistCheck`,tokenize:lB};function cB(){return{text:{91:sB}}}function lB(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return OM(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return $(r)?t(r):kM(r)?e.check({tokenize:uB},t,n)(r):n(r)}}function uB(e,t,n){return PM(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function dB(e){return gM([Dz(),Uz(),Zz(e),tB(),cB()])}var fB={};function pB(e){let t=this,n=e||fB,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(dB(n)),a.push(gz()),o.push(_z(n))}function mB({content:e,className:t}){return(0,C.jsx)(`div`,{className:K(`space-y-3 break-words text-foreground`,`[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-4`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]`,`[&_h1]:text-xl [&_h1]:font-semibold [&_h2]:text-lg [&_h2]:font-semibold [&_h3]:font-semibold`,`[&_li]:ml-5 [&_ol]:list-decimal [&_ul]:list-disc`,`[&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_table]:w-full [&_table]:border-collapse [&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:text-left`,t),children:(0,C.jsx)(lL,{remarkPlugins:[pB],children:e})})}function hB(e){return!Number.isFinite(e)||e<=0?`0.0s`:e<1?`${e.toFixed(1)}s`:`${Math.round(e)}s`}function gB(e){return e===void 0?`Thought`:`Thought for ${hB(e)}`}function _B({durationSeconds:e,isOpen:t=!1,isThinking:n=!1,onToggle:r,reasoningText:i=``}){let a=Fk(),o=i.trim().length>0;if(!o&&!n&&e===void 0)return null;let s=n?`Thinking...`:gB(e),c=a?{duration:0}:{duration:.18,ease:[.23,1,.32,1]};return(0,C.jsxs)(`div`,{className:`mb-2 text-xs text-muted-foreground`,children:[(0,C.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:r,className:`inline-flex items-center gap-1.5 text-left font-medium text-muted-foreground transition-colors duration-150 ease-[var(--natroc-ease-out)] hover:text-foreground`,children:[(0,C.jsx)(Ke,{className:`size-3.5 shrink-0`}),n?(0,C.jsx)(kA,{text:s,duration:1.4}):(0,C.jsx)(`span`,{children:s}),(0,C.jsx)(X.span,{"aria-hidden":`true`,animate:{rotate:t?180:0},transition:c,className:`inline-flex`,children:(0,C.jsx)(Ye,{className:`size-3.5 shrink-0`})})]}),(0,C.jsx)(zD,{initial:!1,children:t&&o&&(0,C.jsx)(X.div,{initial:a?!1:{height:0,opacity:0,y:-4},animate:{height:`auto`,opacity:1,y:0},exit:a?{opacity:0}:{height:0,opacity:0},transition:c,className:`overflow-hidden`,children:(0,C.jsx)(`div`,{className:`mt-1 pl-5`,children:(0,C.jsx)(mB,{content:i,className:K(`space-y-1 text-xs leading-relaxed text-muted-foreground`,`[&_p]:my-0 [&_pre]:my-1 [&_pre]:rounded-md [&_pre]:border [&_pre]:border-border/60 [&_pre]:bg-muted/40 [&_pre]:p-2`)})})},`reasoning-content`)})]})}function vB({events:e}){return e.length===0?null:(0,C.jsx)(`div`,{className:`mb-2 flex flex-col gap-1.5`,children:e.map(e=>(0,C.jsx)(yB,{event:e},e.id))})}function yB({event:e}){let[t,n]=(0,b.useState)(!1);return(0,C.jsxs)(`div`,{className:`natroc-soft-panel rounded-lg border border-border bg-muted/30 text-xs`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,C.jsx)(bB,{status:e.status}),(0,C.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:e.name}),(0,C.jsx)(`span`,{className:`truncate text-muted-foreground`,children:xB(e.args)}),e.risk===`high`&&(0,C.jsx)(`span`,{className:`shrink-0 rounded bg-amber-500/15 px-1.5 py-0.5 text-[0.65rem] font-medium text-amber-600 dark:text-amber-400`,children:`high risk`}),(0,C.jsx)(Ye,{className:K(`ml-auto h-4 w-4 shrink-0 text-muted-foreground transition-transform`,t&&`rotate-180`)})]}),t&&(0,C.jsx)(`div`,{className:`border-t border-border px-3 py-2`,children:(0,C.jsx)(`pre`,{className:`overflow-x-auto whitespace-pre-wrap break-words text-[0.7rem] leading-relaxed text-muted-foreground`,children:e.output??`Running...`})})]})}function bB({status:e}){return e===`running`?(0,C.jsx)(`span`,{className:`h-3.5 w-3.5 shrink-0 animate-spin rounded-full border-2 border-muted-foreground/30 border-t-muted-foreground`}):e===`error`?(0,C.jsx)(qt,{className:`h-4 w-4 shrink-0 text-destructive`}):(0,C.jsx)(Je,{className:`h-4 w-4 shrink-0 text-green-600 dark:text-green-400`})}function xB(e){let t=Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`string`?t:JSON.stringify(t)}`).join(` · `);return t.length>90?`${t.slice(0,90)}…`:t}var SB={id:`ollama`,listModels:CB};async function CB(){return(await J.call(`providers.models`,{provider:`ollama`})).models??[]}var wB={id:`openrouter`,listModels:TB};async function TB(){return(await J.call(`providers.models`,{provider:`openrouter`})).models??[]}var EB={openrouter:wB,ollama:SB};function DB(e){return EB[e]}function OB(e){return DB(e).listModels()}async function kB(){try{return(await J.call(`providers.list`)).providers?.find(e=>e.isActive)??null}catch{return null}}async function AB(e){return(await J.call(`conversations.messages`,{conversationId:e})).messages??[]}function jB(e,t){return new Promise((n,r)=>{t.onStart?.(),J.stream(`agent.chat`,e,{onEvent:e=>{let n=e;switch(n.type){case`text`:t.onText(n.delta);break;case`reasoning`:t.onReasoning(n.delta);break;case`step`:t.onStep?.();break;case`tool_call`:t.onToolCall?.({id:n.id,name:n.name,args:n.args,risk:n.risk});break;case`tool_result`:t.onToolResult?.({id:n.id,status:n.status,output:n.output});break;case`metadata`:break}},onEnd:e=>{t.onDone(e),n()},onError:e=>r(e)})})}function MB(e,t,n){return t||(n&&e.some(e=>e.id===n)?n:e[0]?.id??n??void 0)}function NB(e,t){return!t||e.some(e=>e.id===t)?e:[{id:t,name:t},...e]}var PB=[`medium`,`low`,`auto`,`high`,`minimal`,`xhigh`];function FB(e){let t=e.replace(/[_-]+/g,` `).trim();return t.toLowerCase()===`xhigh`?`Extra High`:t.split(/\s+/).map(e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(` `)}function IB(e){return e?.thinking?.supported?e.thinking.efforts.map(e=>({value:e,label:FB(e)})):[]}function LB(e,t){return t&&e.some(e=>e.value===t)?t:PB.find(t=>e.some(e=>e.value===t))??e[0]?.value}var RB=`The agent finished without a visible response. Please try again.`;function zB(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!1),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)([]),[u,d]=(0,b.useState)(),[f,p]=(0,b.useState)(),[m,h]=(0,b.useState)(!1),g=(0,b.useRef)(null),_=o?.baseUrl??null,v=o?.defaultModel??null,y=o?.id,x=o?.provider,S=(0,b.useMemo)(()=>NB(c,u),[c,u]),C=(0,b.useMemo)(()=>S.find(e=>e.id===u),[S,u]),w=(0,b.useMemo)(()=>IB(C),[C]),T=(0,b.useMemo)(()=>!y||!x?null:{baseUrl:_,defaultModel:v,id:y,provider:x},[_,v,y,x]),E=(0,b.useCallback)(async()=>{s(await kB())},[]),D=(0,b.useCallback)(async e=>{r(!0);try{let n=await AB(e);a(e),t(n.map(e=>{let t=typeof e.thinkingDurationMs==`number`?Math.max(0,Math.round(e.thinkingDurationMs/100)/10):void 0;return{id:e.id,role:e.role,text:e.content,reasoningText:e.reasoningText??void 0,isReasoningOpen:!1,isThinking:!1,thinkingDurationSeconds:t,toolEvents:(e.toolEvents??[]).map(e=>({id:e.id,name:e.name,args:e.args,risk:e.risk,status:e.status,output:e.output})),files:[]}}))}catch(e){t([{id:crypto.randomUUID(),role:`error`,text:e instanceof Error?e.message:`Failed to load conversation.`,files:[]}])}finally{r(!1)}},[]),O=(0,b.useCallback)(async()=>{let e=window.location.pathname.match(/^\/chat\/(.+)$/)?.[1];e&&await D(e)},[D]);return(0,b.useEffect)(()=>{E(),O();let e=()=>{E()},n=e=>{let t=e;t.detail?.id&&D(t.detail.id)},r=()=>{a(void 0),t([])};return window.addEventListener(`natroc:provider-updated`,e),window.addEventListener(`natroc:conversation-selected`,n),window.addEventListener(`natroc:new-conversation`,r),()=>{window.removeEventListener(`natroc:provider-updated`,e),window.removeEventListener(`natroc:conversation-selected`,n),window.removeEventListener(`natroc:new-conversation`,r)}},[D,O,E]),(0,b.useEffect)(()=>{if(!T){g.current=null,l([]),d(void 0),p(void 0);return}let e=T,t=BB(e),n=g.current===t,r=!1;g.current=t,n||(l([]),d(void 0),p(void 0));async function i(){h(!0);try{let t=await OB(e.provider);if(r)return;l(t),d(r=>MB(t,n?r:void 0,e.defaultModel))}catch{if(r)return;n||l([]),d(t=>n?t??e.defaultModel??void 0:e.defaultModel??void 0)}finally{r||h(!1)}}return i(),()=>{r=!0}},[T]),(0,b.useEffect)(()=>{p(e=>LB(w,e))},[w]),{activeProvider:o,handleSend:async(e,c,l)=>{let d=e.trim();if(!d||n)return;let f=l?.thinkingEffort?{enabled:!0,effort:l.thinkingEffort}:void 0,p=(c??[]).map(e=>({name:e.name,url:URL.createObjectURL(e)})),m=crypto.randomUUID();t(e=>[...e,{id:m,role:`user`,text:d,files:p}]),r(!0);let h=crypto.randomUUID(),g=null,_=0,v,y=()=>{g===null&&(g=performance.now())},b=()=>(g!==null&&(_+=(performance.now()-g)/1e3,g=null,v=_),v);try{let e=o??await kB();if(!e)throw Error(`Connect OpenRouter or Ollama before sending a message.`);await jB({conversationId:i,message:d,model:u,thinking:f},{onStart(){t(e=>[...e,VB(h)])},onStep(){t(e=>e.map(e=>e.id===h?{...e,text:``}:e))},onText(e){t(t=>t.map(t=>t.id===h?{...t,text:t.text+e,isLoading:!1,isThinking:!1,thinkingDurationSeconds:b()??t.thinkingDurationSeconds}:t))},onToolCall(e){t(t=>t.map(t=>t.id===h?{...t,text:``,isLoading:!1,isThinking:!1,thinkingDurationSeconds:b()??t.thinkingDurationSeconds,toolEvents:[...t.toolEvents??[],{id:e.id,name:e.name,args:e.args,risk:e.risk,status:`running`}]}:t))},onToolResult(e){t(t=>t.map(t=>t.id===h?{...t,toolEvents:(t.toolEvents??[]).map(t=>t.id===e.id?{...t,status:e.status,output:e.output}:t)}:t))},onReasoning(e){y(),t(t=>t.map(t=>t.id===h?{...t,reasoningText:`${t.reasoningText??``}${e}`,isLoading:!1,isThinking:!0,thinkingDurationSeconds:void 0}:t))},onDone(n){a(n.conversationId),window.dispatchEvent(new Event(`natroc:conversation-updated`)),s(e),t(e=>e.map(e=>e.id===h?{...e,text:HB(n.content,e.text),isLoading:!1,isThinking:!1,thinkingDurationSeconds:b()??e.thinkingDurationSeconds}:e))}})}catch(e){t(t=>[...t.filter(e=>e.id!==h||!!(e.text||e.reasoningText||e.toolEvents&&e.toolEvents.length>0)).map(e=>e.id===h?{...e,isThinking:!1,thinkingDurationSeconds:b()??e.thinkingDurationSeconds}:e),{id:crypto.randomUUID(),role:`error`,text:e instanceof Error?e.message:`Failed to send message.`,files:[]}])}finally{r(!1)}},handleToggleReasoning:e=>{t(t=>t.map(t=>t.id===e?{...t,isReasoningOpen:!t.isReasoningOpen}:t))},isEmpty:e.length===0,isLoading:n,isLoadingModels:m,messages:e,modelOptions:S,selectedModel:u,selectedThinkingEffort:f,setSelectedModel:d,setSelectedThinkingEffort:p,thinkingEffortOptions:w}}function BB(e){return`${e.provider}:${e.id}:${e.baseUrl??``}`}function VB(e){return{id:e,role:`assistant`,text:``,reasoningText:``,isReasoningOpen:!1,isLoading:!0,isThinking:!1,thinkingDurationSeconds:void 0,toolEvents:[],files:[]}}function HB(e,t){return e.trim()?e:t.trim()?t:RB}function UB({clientHeight:e,scrollHeight:t}){return Math.max(0,t-e)}var WB=48,GB=360;function KB(){let{activeProvider:e,handleSend:t,handleToggleReasoning:n,isEmpty:r,isLoading:i,isLoadingModels:a,messages:o,modelOptions:s,selectedModel:c,selectedThinkingEffort:l,setSelectedModel:u,setSelectedThinkingEffort:d,thinkingEffortOptions:f}=zB(),p=(0,b.useRef)(null),m=(0,b.useRef)(!0),h=(0,b.useRef)(!1),g=(0,b.useRef)(null),[_,v]=(0,b.useState)(!0),[y,x]=(0,b.useState)(!1),S=(0,b.useCallback)((e=`auto`)=>{let t=p.current;t&&(t.scrollTo({top:UB(t),behavior:e}),v(!0))},[]),w=(0,b.useCallback)(()=>{let e=p.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<=WB;if(h.current){m.current=!0,v(t);return}m.current=t,v(t)},[]),T=(0,b.useCallback)(()=>{m.current=!0,h.current=!0,x(!0),g.current!==null&&window.clearTimeout(g.current);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;S(e?`auto`:`smooth`);let t=()=>{S(),h.current=!1,x(!1),g.current=null};if(e){t();return}g.current=window.setTimeout(t,GB)},[S]),E=(0,b.useCallback)((e,n,r)=>{m.current=!0,v(!0),t(e,n,r),requestAnimationFrame(()=>S())},[t,S]);return(0,b.useEffect)(()=>{if(r){m.current=!0;let e=window.setTimeout(()=>{v(!0)},0);return()=>window.clearTimeout(e)}if(!m.current)return;let e=requestAnimationFrame(()=>S());return()=>cancelAnimationFrame(e)},[r,o,S]),(0,b.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current),h.current=!1},[]),(0,C.jsxs)(`div`,{className:K(`flex h-full min-h-0 w-full flex-col items-center gap-4 overflow-hidden`,r?`justify-center`:`justify-end`),children:[!r&&(0,C.jsx)(`div`,{ref:p,onScroll:w,className:`flex min-h-0 w-full max-w-2xl flex-1 scrollbar-none flex-col gap-3 overflow-y-auto py-4 [&::-webkit-scrollbar]:hidden`,children:o.map(e=>(0,C.jsxs)(`div`,{className:K(`natroc-message-enter text-sm leading-relaxed`,e.role===`user`&&`self-end rounded-2xl border border-border bg-muted/40 px-4 py-2`,e.role===`assistant`&&`w-full self-start py-1`,e.role===`error`&&`self-start rounded-2xl border border-destructive/30 bg-destructive/10 px-4 py-2 text-destructive`),children:[e.role===`assistant`&&(e.reasoningText||e.isThinking||e.thinkingDurationSeconds!==void 0)&&(0,C.jsx)(_B,{durationSeconds:e.thinkingDurationSeconds,isOpen:e.isReasoningOpen,isThinking:e.isThinking,reasoningText:e.reasoningText,onToggle:()=>n(e.id)}),e.role===`assistant`&&e.toolEvents&&e.toolEvents.length>0&&(0,C.jsx)(vB,{events:e.toolEvents}),e.role===`assistant`&&e.isLoading&&!e.text&&!e.reasoningText&&!e.toolEvents?.length&&(0,C.jsx)(OA,{}),e.text&&(e.role===`assistant`?(0,C.jsx)(mB,{content:e.text}):(0,C.jsx)(`p`,{className:`whitespace-pre-wrap`,children:e.text})),e.files.length>0&&(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.files.map(e=>(0,C.jsx)(`img`,{src:e.url,alt:e.name,className:`h-20 w-20 rounded-lg object-cover`},e.url))})]},e.id))}),(0,C.jsxs)(`div`,{className:`flex w-full max-w-2xl shrink-0 flex-col items-center gap-3`,children:[r&&(0,C.jsxs)(`div`,{className:`natroc-stagger flex max-w-2xl flex-col items-center gap-3 text-center`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground md:text-3xl`,children:`Good morning! May this beautiful morning lead you to progress. Have a productive day ahead.`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e?`Using ${e.displayName}${c?` · ${c}`:``}`:`Connect OpenRouter or Ollama to start chatting.`})]}),(0,C.jsxs)(`div`,{className:`relative w-full`,children:[(!_||y)&&(0,C.jsx)(`div`,{className:`pointer-events-none absolute bottom-full left-0 z-10 mb-2 flex w-full justify-center`,children:(0,C.jsx)(`button`,{type:`button`,"aria-label":i?`Follow agent stream`:`Scroll to latest message`,onClick:T,className:K(`natroc-soft-panel pointer-events-auto inline-flex h-8 w-8 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-[0_8px_24px_rgba(0,0,0,0.14)] transition-[background-color,color,transform] duration-150 ease-[var(--natroc-ease-out)] hover:bg-muted hover:text-foreground active:scale-[0.96] motion-reduce:active:scale-100`,y&&`natroc-jump-to-latest`),children:(0,C.jsx)($e,{className:`h-4 w-4`})})}),(0,C.jsx)(DA,{onSend:E,isLoading:i,placeholder:`Write a message...`,selectedModel:c,modelOptions:s,onModelChange:u,isModelLoading:a,isModelDisabled:!e,thinkingEffortOptions:f,selectedThinkingEffort:l,onThinkingEffortChange:d})]})]})]})}var qB=[`image/png`,`image/jpeg`,`image/webp`],JB=2*1024*1024;function YB(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)({status:`loading`}),[i,a]=(0,b.useState)({status:`idle`}),[o,s]=(0,b.useState)({status:`idle`}),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)({currentPassword:``,newPassword:``,confirmPassword:``}),f=(0,b.useRef)(null),p=(0,b.useCallback)(e=>{t(e),window.dispatchEvent(new CustomEvent(`natroc:user-updated`,{detail:e}))},[]),m=(0,b.useCallback)(async()=>{r({status:`loading`});try{let e=await J_();if(!e){r({status:`error`,message:`Account session is not available.`});return}t(e),r({status:`idle`})}catch(e){r({status:`error`,message:e instanceof Error?e.message:`Failed to load account.`})}},[]);(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{m()},0);return()=>window.clearTimeout(e)},[m]);let h=async e=>{let t=e.currentTarget.files?.[0];if(e.currentTarget.value=``,!(!t||i.status===`loading`)){if(!ZB(t.type)){me.error(`Profile picture must be PNG, JPEG, or WebP.`),a({status:`error`,message:`Profile picture must be PNG, JPEG, or WebP.`});return}if(t.size>JB){me.error(`Profile picture must be 2MB or smaller.`),a({status:`error`,message:`Profile picture must be 2MB or smaller.`});return}a({status:`loading`});try{let e=await QB(t);l(e),p((await Z_({dataUrl:e})).user),l(null),me.success(`Profile picture updated.`),a({status:`success`,message:`Profile picture updated.`})}catch(e){let t=$B(e,`Failed to update profile picture.`);l(null),me.error(t),a({status:`error`,message:t})}}},g=async()=>{if(!(i.status===`loading`||!e?.avatarUrl)){a({status:`loading`});try{p((await Z_({dataUrl:null})).user),me.success(`Profile picture removed.`),a({status:`success`,message:`Profile picture removed.`})}catch(e){let t=$B(e,`Failed to remove profile picture.`);me.error(t),a({status:`error`,message:t})}}},_=async e=>{if(e.preventDefault(),o.status!==`loading`){if(u.newPassword!==u.confirmPassword){me.error(`New password and confirmation do not match.`),s({status:`error`,message:`New password and confirmation do not match.`});return}s({status:`loading`});try{p((await X_({currentPassword:u.currentPassword,newPassword:u.newPassword})).user),d({currentPassword:``,newPassword:``,confirmPassword:``}),me.success(`Password updated.`),s({status:`success`,message:`Password updated.`})}catch(e){let t=$B(e,`Failed to update password.`);me.error(t),s({status:`error`,message:t})}}},v=e?.fullName.trim().charAt(0).toUpperCase()||`N`,y=c??e?.avatarUrl,x=i.status===`loading`,S=o.status===`loading`;return n.status===`loading`?(0,C.jsx)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] items-center justify-center text-sm text-muted-foreground`,children:`Loading account...`}):!e||n.status===`error`?(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] flex-col items-center justify-center gap-3`,children:[(0,C.jsx)(`p`,{className:`text-sm text-destructive`,children:n.message??`Failed to load account.`}),(0,C.jsxs)(q,{variant:`secondary`,onClick:()=>void m(),children:[(0,C.jsx)(Ft,{}),`Retry`]})]}):(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] w-full flex-col gap-6`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Account Settings`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.username})]}),(0,C.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]`,children:[(0,C.jsx)(`section`,{className:`natroc-soft-panel rounded-lg border border-border bg-card p-4`,children:(0,C.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,C.jsxs)(C_,{className:`size-20`,children:[y&&(0,C.jsx)(w_,{src:y,alt:e.fullName}),(0,C.jsx)(T_,{className:`text-xl`,children:v})]}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`h2`,{className:`font-medium`,children:`Profile Picture`}),(0,C.jsx)(`p`,{className:`mt-1 truncate text-sm text-muted-foreground`,children:e.fullName}),(0,C.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(q,{type:`button`,variant:`secondary`,onClick:()=>f.current?.click(),disabled:x,children:[(0,C.jsx)(ht,{}),`Choose image`]}),(0,C.jsxs)(q,{type:`button`,variant:`ghost`,onClick:()=>void g(),disabled:x||!e.avatarUrl,children:[(0,C.jsx)(Ht,{}),`Remove`]})]}),(0,C.jsx)(`input`,{ref:f,type:`file`,className:`hidden`,accept:qB.join(`,`),onChange:h}),(0,C.jsx)(XB,{state:i})]})]})}),(0,C.jsxs)(`form`,{className:`natroc-soft-panel rounded-lg border border-border bg-card p-4`,onSubmit:_,children:[(0,C.jsxs)(`div`,{className:`mb-5 flex items-center gap-2`,children:[(0,C.jsx)(St,{className:`size-4 text-muted-foreground`}),(0,C.jsx)(`h2`,{className:`font-medium`,children:`Password`})]}),(0,C.jsxs)(`div`,{className:`grid gap-4`,children:[(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`account-current-password`,children:`Current password`}),(0,C.jsx)(jg,{id:`account-current-password`,type:`password`,autoComplete:`current-password`,value:u.currentPassword,onChange:e=>d(t=>({...t,currentPassword:e.currentTarget.value})),required:!0})]}),(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`account-new-password`,children:`New password`}),(0,C.jsx)(jg,{id:`account-new-password`,type:`password`,autoComplete:`new-password`,minLength:6,value:u.newPassword,onChange:e=>d(t=>({...t,newPassword:e.currentTarget.value})),required:!0})]}),(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`account-confirm-password`,children:`Confirm new password`}),(0,C.jsx)(jg,{id:`account-confirm-password`,type:`password`,autoComplete:`new-password`,minLength:6,value:u.confirmPassword,onChange:e=>d(t=>({...t,confirmPassword:e.currentTarget.value})),required:!0})]})]}),(0,C.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsx)(XB,{state:o}),(0,C.jsx)(q,{type:`submit`,disabled:S||!u.currentPassword||!u.newPassword||!u.confirmPassword,children:S?`Saving...`:`Save password`})]})]})]})]})}function XB({state:e}){return e.message?(0,C.jsx)(`p`,{className:K(`mt-3 text-sm`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:e.message}):null}function ZB(e){return qB.some(t=>t===e)}function QB(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result==`string`){t(r.result);return}n(Error(`Unable to read profile picture.`))},r.onerror=()=>n(Error(`Unable to read profile picture.`)),r.readAsDataURL(e)})}function $B(e,t){return e instanceof Error?e.message:t}async function eV(){return await J.call(`auth.bootstrap`)}function tV({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`field-group`,className:K(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var nV=wg(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function rV({className:e,orientation:t=`vertical`,...n}){return(0,C.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:K(nV({orientation:t}),e),...n})}function iV({className:e,...t}){return(0,C.jsx)(vv,{"data-slot":`field-label`,className:K(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function aV({className:e,...t}){return(0,C.jsx)(`p`,{"data-slot":`field-description`,className:K(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function oV({className:e,children:t,errors:n,...r}){let i=(0,b.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,C.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,C.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,C.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:K(`text-sm font-normal text-destructive`,e),...r,children:i}):null}var sV=[{cx:48,cy:68},{cx:104,cy:36},{cx:152,cy:72},{cx:86,cy:130},{cx:164,cy:154}],cV=[`M48 68L104 36L152 72`,`M48 68L86 130L164 154`,`M104 36L86 130L152 72L164 154`];function lV(){let e=Fk();return(0,C.jsxs)(X.svg,{"aria-hidden":`true`,viewBox:`0 0 212 188`,className:`h-full w-full text-foreground`,fill:`none`,initial:e?!1:{opacity:0,y:8},animate:e?void 0:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsx)(`rect`,{x:`18`,y:`18`,width:`176`,height:`152`,rx:`18`,fill:`oklch(0.98 0.004 250 / 0.7)`,stroke:`oklch(0.48 0.02 250 / 0.16)`}),(0,C.jsx)(`path`,{d:`M42 156h128`,stroke:`oklch(0.48 0.02 250 / 0.16)`,strokeLinecap:`round`}),cV.map((t,n)=>(0,C.jsx)(X.path,{d:t,stroke:`oklch(0.62 0.08 218 / 0.58)`,strokeWidth:`2`,strokeLinecap:`round`,initial:e?!1:{pathLength:.2,opacity:.35},animate:e?void 0:{pathLength:[.2,1,.2],opacity:[.32,.72,.32]},transition:{delay:n*.16,duration:2.6,repeat:1/0,ease:[.22,1,.36,1]}},t)),sV.map((t,n)=>(0,C.jsxs)(X.g,{animate:e?void 0:{scale:[1,1.08,1],opacity:[.78,1,.78]},transition:{delay:n*.12,duration:2,repeat:1/0,ease:`easeInOut`},style:{originX:t.cx,originY:t.cy},children:[(0,C.jsx)(`circle`,{cx:t.cx,cy:t.cy,r:`12`,fill:`oklch(0.96 0.01 250)`,stroke:`oklch(0.46 0.04 250 / 0.28)`}),(0,C.jsx)(`circle`,{cx:t.cx,cy:t.cy,r:`4`,fill:`oklch(0.62 0.08 218)`})]},`${t.cx}-${t.cy}`)),(0,C.jsx)(X.rect,{x:`68`,y:`79`,width:`76`,height:`35`,rx:`12`,fill:`oklch(0.18 0.012 250)`,animate:e?void 0:{y:[79,76,79]},transition:{duration:3,repeat:1/0,ease:[.22,1,.36,1]}}),(0,C.jsx)(X.path,{d:`M88 96h36`,stroke:`oklch(0.82 0.1 190)`,strokeWidth:`3`,strokeLinecap:`round`,animate:e?void 0:{opacity:[.45,1,.45]},transition:{duration:1.8,repeat:1/0,ease:`easeInOut`}})]})}function uV({brandName:e=`Natroc`,className:t,errorMessage:n,isLoading:r=!1,logo:i=(0,C.jsx)(Pv,{}),onForgotPassword:a,onRegister:o,onSubmit:s}){let[c,l]=(0,b.useState)({password:``,username:``}),[u,d]=(0,b.useState)(!1),f=c.username.trim().length>0&&c.password.trim().length>0&&!r;return(0,C.jsx)(`main`,{className:K(`grid h-dvh max-h-dvh min-h-0 overflow-hidden bg-background text-foreground`,t),children:(0,C.jsxs)(`div`,{className:`grid min-h-0 lg:grid-cols-[minmax(24rem,0.9fr)_minmax(0,1.1fr)]`,children:[(0,C.jsx)(`section`,{className:`flex min-h-0 items-center justify-center px-4 py-6 sm:px-6 lg:px-10`,children:(0,C.jsxs)(X.div,{className:`flex w-full max-w-sm flex-col gap-7`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-lg border bg-card text-foreground`,children:i}),(0,C.jsxs)(`div`,{className:`flex flex-col`,children:[(0,C.jsx)(`span`,{className:`text-base leading-tight font-semibold`,children:e}),(0,C.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Agent workspace`})]})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-normal`,children:`Welcome back`}),(0,C.jsx)(`p`,{className:`max-w-[46ch] text-sm leading-6 text-muted-foreground`,children:`Sign in with your workspace username and password.`})]}),(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f&&s?.({password:c.password,username:c.username.trim()})},className:`flex flex-col gap-5`,children:[(0,C.jsxs)(tV,{children:[(0,C.jsxs)(rV,{children:[(0,C.jsx)(iV,{htmlFor:`login-username`,children:`Username`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Kt,{})}),(0,C.jsx)(_v,{id:`login-username`,autoComplete:`username`,placeholder:`your.username`,value:c.username,onChange:e=>l(t=>({...t,username:e.target.value}))})]})]}),(0,C.jsxs)(rV,{children:[(0,C.jsx)(iV,{htmlFor:`login-password`,children:`Password`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Ct,{})}),(0,C.jsx)(_v,{id:`login-password`,autoComplete:`current-password`,placeholder:`Enter password`,type:u?`text`:`password`,value:c.password,onChange:e=>l(t=>({...t,password:e.target.value}))}),(0,C.jsx)(mv,{align:`inline-end`,children:(0,C.jsx)(gv,{"aria-label":u?`Hide password`:`Show password`,onClick:()=>d(e=>!e),size:`icon-xs`,children:u?(0,C.jsx)(ot,{}):(0,C.jsx)(st,{})})})]}),(0,C.jsx)(aV,{children:`Use the account assigned to your Natroc workspace.`})]})]}),(0,C.jsx)(zD,{children:n&&(0,C.jsx)(X.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,ease:[.22,1,.36,1]},children:(0,C.jsx)(oV,{children:n})})}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(q,{type:`button`,variant:`ghost`,className:`px-0`,onClick:a,disabled:!a||r,children:`Forgot password?`}),(0,C.jsxs)(q,{type:`submit`,disabled:!f,children:[r?`Signing in...`:`Sign in`,(0,C.jsx)(Ve,{"data-icon":`inline-end`})]})]})]}),o&&(0,C.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Don't have an account?`,` `,(0,C.jsx)(`button`,{type:`button`,onClick:o,className:`font-medium text-foreground underline-offset-4 hover:underline`,children:`Create one`})]})]})}),(0,C.jsxs)(`section`,{className:`relative hidden min-h-0 overflow-hidden border-l bg-muted/30 lg:block`,children:[(0,C.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px),linear-gradient(90deg,oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px)] [mask-image:radial-gradient(ellipse_at_center,black_18%,transparent_72%)] bg-[size:38px_38px]`}),(0,C.jsxs)(`div`,{className:`relative flex h-full flex-col justify-center px-14`,children:[(0,C.jsx)(X.div,{className:`mx-auto aspect-[1.12] w-full max-w-md`,initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.22,1,.36,1]},children:(0,C.jsx)(lV,{})}),(0,C.jsxs)(`div`,{className:`mx-auto flex max-w-md flex-col gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Secure access for every user`}),(0,C.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:`Natroc keeps the interface quiet while your agent handles the busy work behind the workspace.`})]})]})]})]})})}function dV(){let[e,t]=(0,b.useState)(``),[n,r]=(0,b.useState)(!1);return(0,C.jsx)(uV,{onSubmit:async e=>{r(!0),t(``);try{L_((await K_(e.username,e.password)).token),window.location.assign(`/`)}catch(e){t(e instanceof Error?e.message:`Sign in failed.`)}finally{r(!1)}},isLoading:n,errorMessage:e,onRegister:()=>window.location.assign(`/register`)})}var fV=[{detail:`Human-readable profile identity`,label:`Full Name`},{detail:`Workspace handle for agent access`,label:`Username`},{detail:`Verified secret before submit`,label:`Password`}],pV=[mt,Kt,_t];function mV(){let e=Fk();return(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col gap-6`,children:[(0,C.jsxs)(X.div,{"aria-hidden":`true`,className:`relative mx-auto aspect-square w-full max-w-[22rem]`,initial:e?!1:{opacity:0,y:8},animate:e?void 0:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsx)(X.div,{className:`absolute inset-6 rounded-full border border-border`,animate:e?void 0:{rotate:360},transition:{duration:18,repeat:1/0,ease:`linear`}}),(0,C.jsx)(X.div,{className:`absolute inset-14 rounded-full border border-dashed border-border`,animate:e?void 0:{rotate:-360},transition:{duration:24,repeat:1/0,ease:`linear`}}),(0,C.jsxs)(X.div,{className:`absolute inset-x-16 top-16 flex flex-col gap-3 rounded-lg border bg-background p-4 shadow-sm`,animate:e?void 0:{y:[-3,3,-3]},transition:{duration:3.2,repeat:1/0,ease:[.22,1,.36,1]},children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground`,children:(0,C.jsx)(ct,{className:`size-4`})}),(0,C.jsx)(`span`,{className:`rounded-md border px-2 py-1 text-xs text-muted-foreground`,children:`user.create`})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(`span`,{className:`h-2 w-3/4 rounded-sm bg-foreground/80`}),(0,C.jsx)(`span`,{className:`h-2 w-1/2 rounded-sm bg-muted-foreground/45`})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,C.jsx)(`span`,{className:`h-8 rounded-md border bg-muted/50`}),(0,C.jsx)(`span`,{className:`h-8 rounded-md border bg-muted/50`}),(0,C.jsx)(`span`,{className:`h-8 rounded-md border bg-muted/50`})]})]}),(0,C.jsx)(X.div,{className:`absolute top-12 left-1 rounded-lg border bg-background px-3 py-2 text-xs font-medium shadow-sm`,animate:e?void 0:{y:[-2,4,-2]},transition:{duration:2.8,repeat:1/0,ease:`easeInOut`},children:`Full Name`}),(0,C.jsx)(X.div,{className:`absolute top-28 right-2 rounded-lg border bg-background px-3 py-2 text-xs font-medium shadow-sm`,animate:e?void 0:{y:[3,-3,3]},transition:{duration:3,repeat:1/0,ease:`easeInOut`},children:`Username`}),(0,C.jsx)(X.div,{className:`absolute bottom-14 left-12 rounded-lg border bg-background px-3 py-2 text-xs font-medium shadow-sm`,animate:e?void 0:{y:[-1,4,-1]},transition:{duration:3.4,repeat:1/0,ease:`easeInOut`},children:`Password`})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-2`,children:fV.map((t,n)=>{let r=pV[n];return(0,C.jsxs)(X.div,{className:`flex items-center gap-3 rounded-lg border bg-background px-3 py-2 shadow-sm`,initial:e?!1:{opacity:0,y:6},animate:e?void 0:{opacity:1,y:0},transition:{delay:.08*n,duration:.28,ease:[.22,1,.36,1]},children:[(0,C.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-md bg-muted`,children:(0,C.jsx)(r,{className:`size-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.label}),(0,C.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:t.detail})]}),(0,C.jsx)(Je,{className:`size-4 text-muted-foreground`})]},t.label)})})]})}function hV({brandName:e=`Natroc`,className:t,errorMessage:n,isLoading:r=!1,logo:i=(0,C.jsx)(Pv,{}),onLogin:a,onSubmit:o}){let[s,c]=(0,b.useState)({confirmPassword:``,fullName:``,password:``,username:``}),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),p=s.confirmPassword.length>0&&s.password!==s.confirmPassword,m=s.fullName.trim().length>0&&s.username.trim().length>0&&s.password.length>0&&s.confirmPassword.length>0&&!p&&!r;return(0,C.jsx)(`main`,{className:K(`grid h-dvh max-h-dvh min-h-0 overflow-hidden bg-background text-foreground`,t),children:(0,C.jsxs)(`div`,{className:`grid min-h-0 lg:grid-cols-[minmax(24rem,0.9fr)_minmax(0,1.1fr)]`,children:[(0,C.jsx)(`section`,{className:`flex min-h-0 items-center justify-center px-4 py-5 sm:px-6 lg:px-10`,children:(0,C.jsxs)(X.div,{className:`flex w-full max-w-sm flex-col gap-6`,initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-lg border bg-card text-foreground`,children:i}),(0,C.jsxs)(`div`,{className:`flex flex-col`,children:[(0,C.jsx)(`span`,{className:`text-base leading-tight font-semibold`,children:e}),(0,C.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`User access`})]})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-normal`,children:`Create account`}),(0,C.jsx)(`p`,{className:`max-w-[48ch] text-sm leading-6 text-muted-foreground`,children:`Register a user profile for access to the Natroc workspace.`})]}),(0,C.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),m&&o?.({confirmPassword:s.confirmPassword,fullName:s.fullName.trim(),password:s.password,username:s.username.trim()})},className:`flex flex-col gap-5`,children:[(0,C.jsxs)(tV,{children:[(0,C.jsxs)(rV,{children:[(0,C.jsx)(iV,{htmlFor:`register-full-name`,children:`Full Name`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(mt,{})}),(0,C.jsx)(_v,{id:`register-full-name`,autoComplete:`name`,placeholder:`Full name`,value:s.fullName,onChange:e=>c(t=>({...t,fullName:e.target.value}))})]})]}),(0,C.jsxs)(rV,{children:[(0,C.jsx)(iV,{htmlFor:`register-username`,children:`Username`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Kt,{})}),(0,C.jsx)(_v,{id:`register-username`,autoComplete:`username`,placeholder:`your.username`,value:s.username,onChange:e=>c(t=>({...t,username:e.target.value}))})]})]}),(0,C.jsxs)(rV,{children:[(0,C.jsx)(iV,{htmlFor:`register-password`,children:`Password`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Ct,{})}),(0,C.jsx)(_v,{id:`register-password`,autoComplete:`new-password`,placeholder:`Create password`,type:l?`text`:`password`,value:s.password,onChange:e=>c(t=>({...t,password:e.target.value}))}),(0,C.jsx)(mv,{align:`inline-end`,children:(0,C.jsx)(gv,{"aria-label":l?`Hide password`:`Show password`,onClick:()=>u(e=>!e),size:`icon-xs`,children:l?(0,C.jsx)(ot,{}):(0,C.jsx)(st,{})})})]})]}),(0,C.jsxs)(rV,{"data-invalid":p,children:[(0,C.jsx)(iV,{htmlFor:`register-confirm-password`,children:`Confirm Password`}),(0,C.jsxs)(fv,{children:[(0,C.jsx)(mv,{children:(0,C.jsx)(Ct,{})}),(0,C.jsx)(_v,{id:`register-confirm-password`,"aria-invalid":p,autoComplete:`new-password`,placeholder:`Confirm password`,type:d?`text`:`password`,value:s.confirmPassword,onChange:e=>c(t=>({...t,confirmPassword:e.target.value}))}),(0,C.jsx)(mv,{align:`inline-end`,children:(0,C.jsx)(gv,{"aria-label":d?`Hide confirm password`:`Show confirm password`,onClick:()=>f(e=>!e),size:`icon-xs`,children:d?(0,C.jsx)(ot,{}):(0,C.jsx)(st,{})})})]}),p?(0,C.jsx)(oV,{children:`Passwords do not match.`}):(0,C.jsx)(aV,{children:`Use the same password to confirm access.`})]})]}),(0,C.jsx)(zD,{children:n&&(0,C.jsx)(X.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,ease:[.22,1,.36,1]},children:(0,C.jsx)(oV,{children:n})})}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(q,{type:`button`,variant:`ghost`,className:`px-0`,onClick:a,disabled:!a||r,children:`Sign in instead`}),(0,C.jsxs)(q,{type:`submit`,disabled:!m,children:[r?`Creating...`:`Create account`,(0,C.jsx)(Ve,{"data-icon":`inline-end`})]})]})]})]})}),(0,C.jsxs)(`section`,{className:`relative hidden min-h-0 overflow-hidden border-l bg-muted/30 lg:block`,children:[(0,C.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px),linear-gradient(90deg,oklch(0.48_0.02_250_/_0.08)_1px,transparent_1px)] [mask-image:radial-gradient(ellipse_at_center,black_18%,transparent_72%)] bg-[size:38px_38px]`}),(0,C.jsxs)(`div`,{className:`relative flex h-full flex-col justify-center px-14`,children:[(0,C.jsx)(mV,{}),(0,C.jsxs)(`div`,{className:`mx-auto flex max-w-md flex-col gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Account identity for every user`}),(0,C.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:`Keep identity simple: a real name, a workspace username, and a password verified before submit.`})]})]})]})]})})}function gV(){let[e,t]=(0,b.useState)(``),[n,r]=(0,b.useState)(!1);return(0,C.jsx)(hV,{onSubmit:async e=>{if(e.password!==e.confirmPassword){t(`Passwords do not match.`);return}r(!0),t(``);try{L_((await q_({username:e.username,fullName:e.fullName,password:e.password})).token),window.location.assign(`/`)}catch(e){t(e instanceof Error?e.message:`Registration failed.`)}finally{r(!1)}},isLoading:n,errorMessage:e,onLogin:()=>window.location.assign(`/login`)})}var _V=wg(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function vV({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,C.jsx)(n?$t:`span`,{"data-slot":`badge`,"data-variant":t,className:K(_V({variant:t}),e),...r})}async function yV(){return J.call(`agent.status`)}async function bV(e){let t=e?.trim();return(await J.call(`agent.memory`,t?{query:t}:{})).entries??[]}async function xV(e=`pending`){return(await J.call(`agent.proposals.list`,{status:e})).proposals??[]}async function SV(e){return J.call(`agent.proposals.approve`,{id:e})}async function CV(e){return J.call(`agent.proposals.reject`,{id:e})}async function wV(){return(await J.call(`agent.improve`,{})).proposals??[]}function TV(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)({error:null,isLoading:!0}),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),g=(0,b.useCallback)(async()=>{d({error:null,isLoading:!0});try{let[e,n,i]=await Promise.all([yV(),bV(o),xV()]);t(e),r(n),a(i)}catch(e){d({error:e instanceof Error?e.message:`Failed to load agent state.`,isLoading:!1});return}d({error:null,isLoading:!1})},[o]);(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{g()},0);return()=>window.clearTimeout(e)},[g]);let _=async e=>{p(e);try{await SV(e),await g()}finally{p(null)}},v=async e=>{p(e);try{await CV(e),await g()}finally{p(null)}};return(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] w-full flex-col gap-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(Ge,{className:`size-4`}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:`Agent runtime`})]}),(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Natroc is alive locally`})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(q,{variant:`secondary`,onClick:()=>void g(),disabled:u.isLoading,children:[(0,C.jsx)(Ft,{className:K(u.isLoading&&`animate-spin`)}),`Refresh`]}),(0,C.jsxs)(q,{onClick:async()=>{h(!0),l(null);try{l(`Created ${(await wV()).length} pending proposal(s).`),await g()}catch(e){l(e instanceof Error?e.message:`Improvement review failed.`)}finally{h(!1)}},disabled:m,children:[(0,C.jsx)(zt,{className:K(m&&`animate-pulse`)}),`Improve`]})]})]}),u.error&&(0,C.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:u.error}),c&&(0,C.jsx)(`div`,{className:`natroc-soft-panel rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm text-muted-foreground`,children:c}),(0,C.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,C.jsx)(EV,{status:e}),(0,C.jsx)(DV,{status:e}),(0,C.jsx)(OV,{status:e})]}),(0,C.jsxs)(`div`,{className:`grid min-h-0 gap-5 xl:grid-cols-[minmax(0,1.05fr)_minmax(360px,0.95fr)]`,children:[(0,C.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Pending proposals`}),(0,C.jsx)(vV,{variant:`secondary`,children:i.length})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-3`,children:i.length===0?(0,C.jsx)(MV,{text:`No pending proposals.`}):i.map(e=>(0,C.jsx)(AV,{proposal:e,isBusy:f===e.id,onApprove:_,onReject:v},e.id))})]}),(0,C.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Approved memory`}),(0,C.jsxs)(`div`,{className:`relative w-56`,children:[(0,C.jsx)(It,{className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(jg,{value:o,onChange:e=>s(e.target.value),placeholder:`Search memory`,className:`h-9 rounded-lg border-transparent bg-muted/80 pl-9`})]})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.length===0?(0,C.jsx)(MV,{text:`No approved memory.`}):n.map(e=>(0,C.jsx)(jV,{entry:e},e.id))})]})]})]})}function EV({status:e}){return(0,C.jsx)(kV,{icon:(0,C.jsx)(Ge,{className:`size-4`}),label:`Runtime`,value:e?.providers.active?.displayName??`No provider`,detail:e?.providers.active?.defaultModel??`Model not selected`})}function DV({status:e}){let t=e?.homeFiles.filter(e=>e.exists).length??0,n=e?.homeFiles.length??0;return(0,C.jsx)(kV,{icon:(0,C.jsx)(pt,{className:`size-4`}),label:`Home`,value:e?.paths?.homeDir??`~/.natroc/home`,detail:`${t}/${n} files ready`})}function OV({status:e}){return(0,C.jsx)(kV,{icon:(0,C.jsx)(it,{className:`size-4`}),label:`Memory`,value:`${e?.counts.memories??0} approved`,detail:`${e?.counts.pendingProposals??0} pending proposal(s)`})}function kV({detail:e,icon:t,label:n,value:r}){return(0,C.jsxs)(`div`,{className:`natroc-soft-panel min-w-0 rounded-lg border border-border bg-muted/30 p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[t,(0,C.jsx)(`span`,{children:n})]}),(0,C.jsx)(`p`,{className:`mt-3 truncate text-sm font-semibold`,children:r}),(0,C.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,children:e})]})}function AV({isBusy:e,onApprove:t,onReject:n,proposal:r}){return(0,C.jsx)(`div`,{className:`natroc-soft-panel rounded-lg border border-border bg-background/60 p-4`,children:(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(vV,{variant:`secondary`,children:r.kind}),(0,C.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.title})]}),(0,C.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:r.content}),(0,C.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground/80`,children:r.reason})]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,C.jsx)(q,{size:`icon`,variant:`secondary`,disabled:e,onClick:()=>void t(r.id),"aria-label":`Approve proposal`,children:(0,C.jsx)(Je,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,disabled:e,onClick:()=>void n(r.id),"aria-label":`Reject proposal`,children:(0,C.jsx)(qt,{})})]})]})})}function jV({entry:e}){return(0,C.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/60 p-4`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(vV,{variant:`secondary`,children:e.kind}),(0,C.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.title})]}),(0,C.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:e.content})]})}function MV({text:e}){return(0,C.jsx)(`div`,{className:`rounded-lg border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground`,children:e})}function NV({className:e,size:t=`default`,...n}){return(0,C.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:K(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function PV({className:e,size:t=`default`,...n}){return(0,C.jsxs)(`div`,{className:K(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,e),"data-slot":`native-select-wrapper`,"data-size":t,children:[(0,C.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...n}),(0,C.jsx)(Ye,{className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function FV({className:e,...t}){return(0,C.jsx)(`option`,{"data-slot":`native-select-option`,className:K(`bg-[Canvas] text-[CanvasText]`,e),...t})}function IV({className:e,size:t=`default`,...n}){return(0,C.jsx)(Ip,{"data-slot":`switch`,"data-size":t,className:K(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,C.jsx)(Lp,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function LV({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,C.jsx)(`table`,{"data-slot":`table`,className:K(`w-full caption-bottom text-sm`,e),...t})})}function RV({className:e,...t}){return(0,C.jsx)(`thead`,{"data-slot":`table-header`,className:K(`[&_tr]:border-b`,e),...t})}function zV({className:e,...t}){return(0,C.jsx)(`tbody`,{"data-slot":`table-body`,className:K(`[&_tr:last-child]:border-0`,e),...t})}function BV({className:e,...t}){return(0,C.jsx)(`tr`,{"data-slot":`table-row`,className:K(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function VV({className:e,...t}){return(0,C.jsx)(`th`,{"data-slot":`table-head`,className:K(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function HV({className:e,...t}){return(0,C.jsx)(`td`,{"data-slot":`table-cell`,className:K(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function UV({className:e,orientation:t=`horizontal`,...n}){return(0,C.jsx)(em,{"data-slot":`tabs`,"data-orientation":t,className:K(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var WV=wg(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function GV({className:e,variant:t=`default`,...n}){return(0,C.jsx)(tm,{"data-slot":`tabs-list`,"data-variant":t,className:K(WV({variant:t}),e),...n})}function KV({className:e,...t}){return(0,C.jsx)(nm,{"data-slot":`tabs-trigger`,className:K(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function qV({className:e,...t}){return(0,C.jsx)(rm,{"data-slot":`tabs-content`,className:K(`flex-1 text-sm outline-none`,e),...t})}async function JV(){return(await J.call(`agents.list`)).agents??[]}async function YV(e){return(await J.call(`agents.create`,e)).agent}async function XV(e,t){return(await J.call(`agents.update`,{id:e,...t})).agent}async function ZV(e){await J.call(`agents.delete`,{id:e})}async function QV(e){return(await J.call(`agents.setDefault`,{id:e})).agent}async function $V(){return(await J.call(`usage.summary`)).summary}async function eH(){return(await J.call(`usage.detail`,{limit:100})).events??[]}async function tH(){return(await J.call(`channels.accounts.list`)).accounts??[]}async function nH(e){return(await J.call(`channels.accounts.create`,e)).account}async function rH(e){return(await J.call(`channels.accounts.connect`,{id:e})).account}async function iH(e){return(await J.call(`channels.accounts.disconnect`,{id:e})).account}async function aH(e){await J.call(`channels.accounts.delete`,{id:e})}async function oH(){return(await J.call(`channels.bindings.list`)).bindings??[]}async function sH(e){return(await J.call(`channels.bindings.create`,e)).binding}async function cH(e){await J.call(`channels.bindings.delete`,{id:e})}async function lH(){return(await J.call(`home.files.list`)).files}async function uH(e){return(await J.call(`home.file.read`,{name:e})).content}async function dH(e,t){return(await J.call(`home.file.write`,{name:e,content:t})).file}var fH={name:``,description:``,defaultProvider:``,defaultModel:``,workspace:``,systemPrompt:``,configJson:`{}`,isEnabled:!0,isDefault:!1},pH={channel:`telegram`,displayName:``,accountRef:``,token:``,allowlist:``};function mH(){let[e,t]=(0,b.useState)(()=>TH()),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)([]),[c,l]=(0,b.useState)([]),[u,d]=(0,b.useState)([]),[f,p]=(0,b.useState)({error:null,isLoading:!0}),m=(0,b.useCallback)(async()=>{p({error:null,isLoading:!0});try{let[e,t,n,i,o]=await Promise.all([JV(),$V(),eH(),tH(),oH()]);r(e),a(t),s(n),l(i),d(o),p({error:null,isLoading:!1})}catch(e){p({error:e instanceof Error?e.message:`Failed to load config data.`,isLoading:!1})}},[]);return(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{m()},0);return()=>window.clearTimeout(e)},[m]),(0,C.jsxs)(`section`,{className:`natroc-enter flex w-full flex-1 flex-col gap-5`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(Rt,{className:`size-4`}),(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:`Config`})]}),(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Agent, usage, and channel control`})]}),(0,C.jsxs)(q,{variant:`secondary`,onClick:()=>void m(),disabled:f.isLoading,children:[(0,C.jsx)(Ft,{className:K(f.isLoading&&`animate-spin`)}),`Refresh`]})]}),f.error&&(0,C.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:f.error}),(0,C.jsxs)(UV,{value:e,onValueChange:e=>{if(!EH(e))return;t(e);let n=new URL(window.location.href);n.searchParams.set(`tab`,e),window.history.replaceState(null,``,n)},className:`gap-5`,children:[(0,C.jsx)(`div`,{className:`flex justify-center`,children:(0,C.jsxs)(GV,{children:[(0,C.jsxs)(KV,{value:`agents`,children:[(0,C.jsx)(We,{}),`Agents`]}),(0,C.jsxs)(KV,{value:`usage`,children:[(0,C.jsx)(qe,{}),`Usage`]}),(0,C.jsxs)(KV,{value:`channels`,children:[(0,C.jsx)(Nt,{}),`Channels`]})]})}),(0,C.jsx)(qV,{value:`agents`,className:`space-y-5`,children:(0,C.jsx)(hH,{agents:n,onRefresh:m})}),(0,C.jsx)(qV,{value:`usage`,children:(0,C.jsx)(_H,{summary:i,events:o})}),(0,C.jsx)(qV,{value:`channels`,children:(0,C.jsx)(vH,{agents:n,accounts:c,bindings:u,onRefresh:m})})]})]})}function hH({agents:e,onRefresh:t}){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(fH),[o,s]=(0,b.useState)(null),c=e.find(e=>e.id===n)??null,l=()=>{r(null),a(fH),s(null)},u=e=>{r(e.id),a({name:e.name,description:e.description,defaultProvider:e.defaultProvider??``,defaultModel:e.defaultModel??``,workspace:e.workspace??``,systemPrompt:e.systemPrompt,configJson:JSON.stringify(e.config??{},null,2),isEnabled:e.isEnabled,isDefault:e.isDefault}),s(null)};return(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(360px,0.72fr)_minmax(0,1.28fr)]`,children:[(0,C.jsxs)(CH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:c?`Edit agent`:`Create agent`}),(0,C.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.length,` configured`]})]}),n&&(0,C.jsx)(q,{variant:`ghost`,onClick:l,children:`New`})]}),(0,C.jsxs)(`form`,{className:`mt-4 space-y-3`,onSubmit:async e=>{e.preventDefault(),s(null);let r;try{let e=JSON.parse(i.configJson||`{}`);r=e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{s(`Config JSON is invalid.`);return}let a={name:i.name,description:i.description,defaultProvider:i.defaultProvider||null,defaultModel:DH(i.defaultModel),workspace:DH(i.workspace),systemPrompt:i.systemPrompt,config:r,isEnabled:i.isEnabled,isDefault:i.isDefault};n?(await XV(n,a),s(`Agent updated.`)):(await YV(a),s(`Agent created.`)),await t(),n||l()},children:[(0,C.jsx)(xH,{label:`Name`,children:(0,C.jsx)(jg,{value:i.name,onChange:e=>a(t=>({...t,name:e.target.value})),required:!0})}),(0,C.jsx)(xH,{label:`Description`,children:(0,C.jsx)(dv,{value:i.description,onChange:e=>a(t=>({...t,description:e.target.value})),className:`min-h-20`})}),(0,C.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,C.jsx)(xH,{label:`Provider`,children:(0,C.jsxs)(PV,{className:`w-full`,value:i.defaultProvider,onChange:e=>a(t=>({...t,defaultProvider:e.target.value})),children:[(0,C.jsx)(FV,{value:``,children:`Active provider`}),(0,C.jsx)(FV,{value:`openrouter`,children:`OpenRouter`}),(0,C.jsx)(FV,{value:`ollama`,children:`Ollama`})]})}),(0,C.jsx)(xH,{label:`Model`,children:(0,C.jsx)(jg,{value:i.defaultModel,onChange:e=>a(t=>({...t,defaultModel:e.target.value})),placeholder:`Provider default`})})]}),(0,C.jsx)(xH,{label:`Workspace`,children:(0,C.jsx)(jg,{value:i.workspace,onChange:e=>a(t=>({...t,workspace:e.target.value})),placeholder:`Optional path`})}),(0,C.jsx)(xH,{label:`System prompt`,children:(0,C.jsx)(dv,{value:i.systemPrompt,onChange:e=>a(t=>({...t,systemPrompt:e.target.value})),className:`min-h-24`})}),(0,C.jsx)(xH,{label:`Config JSON`,children:(0,C.jsx)(dv,{value:i.configJson,onChange:e=>a(t=>({...t,configJson:e.target.value})),className:`min-h-24 font-mono text-xs`})}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,C.jsx)(SH,{label:`Enabled`,checked:i.isEnabled,onCheckedChange:e=>a(t=>({...t,isEnabled:e}))}),(0,C.jsx)(SH,{label:`Default`,checked:i.isDefault,onCheckedChange:e=>a(t=>({...t,isDefault:e}))})]}),o&&(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o}),(0,C.jsxs)(q,{type:`submit`,children:[(0,C.jsx)(Pt,{}),c?`Update`:`Create`]})]})]}),(0,C.jsxs)(CH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Agents`}),(0,C.jsx)(vV,{variant:`secondary`,children:e.length})]}),(0,C.jsx)(`div`,{className:`mt-4`,children:e.length===0?(0,C.jsx)(wH,{text:`No agents configured.`}):(0,C.jsxs)(LV,{children:[(0,C.jsx)(RV,{children:(0,C.jsxs)(BV,{children:[(0,C.jsx)(VV,{children:`Name`}),(0,C.jsx)(VV,{children:`Provider`}),(0,C.jsx)(VV,{children:`Status`}),(0,C.jsx)(VV,{className:`text-right`,children:`Actions`})]})}),(0,C.jsx)(zV,{children:e.map(e=>(0,C.jsxs)(BV,{children:[(0,C.jsxs)(HV,{className:`min-w-52 whitespace-normal`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,C.jsx)(`div`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.description||`No description`})]}),(0,C.jsxs)(HV,{children:[e.defaultProvider??`active`,(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.defaultModel??`default model`})]}),(0,C.jsx)(HV,{children:(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[e.isDefault&&(0,C.jsx)(vV,{variant:`secondary`,children:`default`}),(0,C.jsx)(vV,{variant:e.isEnabled?`default`:`outline`,children:e.isEnabled?`enabled`:`disabled`})]})}),(0,C.jsx)(HV,{children:(0,C.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Edit agent`,onClick:()=>u(e),children:(0,C.jsx)(Mt,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Set default agent`,disabled:e.isDefault,onClick:()=>void QV(e.id).then(t),children:(0,C.jsx)(Vt,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Delete agent`,onClick:()=>void ZV(e.id).then(t),children:(0,C.jsx)(Ht,{})})]})})]},e.id))})]})})]})]}),(0,C.jsx)(TV,{}),(0,C.jsx)(gH,{})]})}function gH(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)(!0),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(null),g=(0,b.useCallback)(async()=>{d(!0);try{t(await lH())}finally{d(!1)}},[]);(0,b.useEffect)(()=>{g()},[g]);let _=(0,b.useCallback)(async e=>{r(e),h(null);let t=await uH(e);a(t),s(t)},[]),v=async()=>{if(n){p(!0),h(null);try{await dH(n,i),s(i),await g(),h(`Saved.`)}catch(e){h(e instanceof Error?e.message:`Save failed.`)}finally{p(!1)}}},y=async()=>{let e=c.trim();if(!e.toLowerCase().endsWith(`.md`)){h(`File name must end with .md`);return}p(!0),h(null);try{await dH(e,`# ${e.replace(/\.md$/i,``)}\n\n`),l(``),await g(),await _(e),h(`Created.`)}catch(e){h(e instanceof Error?e.message:`Create failed.`)}finally{p(!1)}},x=n!==null&&i!==o;return(0,C.jsxs)(CH,{children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Workspace files`}),(0,C.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Markdown files in `,(0,C.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs`,children:`~/.natroc/home/`}),` — visible to every agent.`]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(jg,{value:c,onChange:e=>l(e.target.value),placeholder:`NEW_FILE.md`,className:`h-8 w-44`}),(0,C.jsxs)(q,{variant:`secondary`,size:`sm`,onClick:()=>void y(),disabled:f||c.trim().length===0,children:[(0,C.jsx)(Pt,{}),`Create`]}),(0,C.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>void g(),disabled:u,children:(0,C.jsx)(Ft,{className:K(u&&`animate-spin`)})})]})]}),(0,C.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,C.jsxs)(`div`,{className:`space-y-1`,children:[e.length===0&&!u&&(0,C.jsx)(wH,{text:`No markdown files yet.`}),e.map(e=>(0,C.jsxs)(`button`,{type:`button`,onClick:()=>void _(e.name),className:K(`flex w-full flex-col items-start rounded-md border px-3 py-2 text-left text-sm transition`,n===e.name?`border-primary bg-primary/10`:`border-border hover:bg-muted`),children:[(0,C.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,C.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[Math.max(1,Math.round(e.sizeBytes/10)/100),` KB`]})]},e.name))]}),(0,C.jsx)(`div`,{className:`space-y-3`,children:n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(dv,{value:i,onChange:e=>a(e.target.value),className:`min-h-[280px] font-mono text-xs`,spellCheck:!1}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x?`Unsaved changes`:`Up to date`,m&&(0,C.jsx)(`span`,{className:`ml-2 text-foreground`,children:m})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>a(o),disabled:!x||f,children:`Revert`}),(0,C.jsx)(q,{size:`sm`,onClick:()=>void v(),disabled:!x||f,children:f?`Saving...`:`Save`})]})]})]}):(0,C.jsx)(wH,{text:`Select a file to view or edit it.`})})]})]})}function _H({events:e,summary:t}){let n=t?.totals;return(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,C.jsx)(bH,{label:`Requests`,value:kH(n?.requests)}),(0,C.jsx)(bH,{label:`Tokens`,value:kH(n?.totalTokens)}),(0,C.jsx)(bH,{label:`Known`,value:kH(n?.knownRequests)}),(0,C.jsx)(bH,{label:`Unknown`,value:kH(n?.unknownRequests)})]}),(0,C.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2`,children:[(0,C.jsx)(yH,{title:`By provider`,rows:t?.byProvider??[],labelKey:`provider`}),(0,C.jsx)(yH,{title:`By channel`,rows:t?.byChannel??[],labelKey:`channel`})]}),(0,C.jsxs)(CH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Request detail`}),(0,C.jsx)(vV,{variant:`secondary`,children:e.length})]}),(0,C.jsx)(`div`,{className:`mt-4`,children:e.length===0?(0,C.jsx)(wH,{text:`No usage events yet.`}):(0,C.jsxs)(LV,{children:[(0,C.jsx)(RV,{children:(0,C.jsxs)(BV,{children:[(0,C.jsx)(VV,{children:`Time`}),(0,C.jsx)(VV,{children:`Provider`}),(0,C.jsx)(VV,{children:`Model`}),(0,C.jsx)(VV,{children:`Channel`}),(0,C.jsx)(VV,{children:`Tokens`}),(0,C.jsx)(VV,{children:`Status`})]})}),(0,C.jsx)(zV,{children:e.map(e=>(0,C.jsxs)(BV,{children:[(0,C.jsx)(HV,{children:AH(e.createdAt)}),(0,C.jsx)(HV,{children:e.provider}),(0,C.jsx)(HV,{children:e.model}),(0,C.jsx)(HV,{children:e.channel}),(0,C.jsx)(HV,{children:kH(e.totalTokens)}),(0,C.jsx)(HV,{children:(0,C.jsx)(vV,{variant:e.usageStatus===`actual`?`default`:`outline`,children:e.usageStatus})})]},e.id))})]})})]})]})}function vH({accounts:e,agents:t,bindings:n,onRefresh:r}){let[i,a]=(0,b.useState)(pH),[o,s]=(0,b.useState)({accountId:``,agentId:``,peer:`*`});return(0,C.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(360px,0.72fr)_minmax(0,1.28fr)]`,children:[(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(CH,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Add channel`}),(0,C.jsxs)(`form`,{className:`mt-4 space-y-3`,onSubmit:async e=>{e.preventDefault(),await nH({channel:i.channel,displayName:i.displayName,accountRef:DH(i.accountRef),token:DH(i.token),allowlist:OH(i.allowlist)}),a(pH),await r()},children:[(0,C.jsx)(xH,{label:`Channel`,children:(0,C.jsxs)(PV,{className:`w-full`,value:i.channel,onChange:e=>a(t=>({...t,channel:e.target.value})),children:[(0,C.jsx)(FV,{value:`telegram`,children:`Telegram`}),(0,C.jsx)(FV,{value:`whatsapp`,children:`WhatsApp`})]})}),(0,C.jsx)(xH,{label:`Display name`,children:(0,C.jsx)(jg,{value:i.displayName,onChange:e=>a(t=>({...t,displayName:e.target.value})),required:!0})}),(0,C.jsx)(xH,{label:`Account ref`,children:(0,C.jsx)(jg,{value:i.accountRef,onChange:e=>a(t=>({...t,accountRef:e.target.value})),placeholder:`@bot or phone/JID`})}),(0,C.jsx)(xH,{label:`Token`,children:(0,C.jsx)(jg,{value:i.token,onChange:e=>a(t=>({...t,token:e.target.value})),type:`password`,placeholder:`Telegram only`})}),(0,C.jsx)(xH,{label:`Allowlist`,children:(0,C.jsx)(jg,{value:i.allowlist,onChange:e=>a(t=>({...t,allowlist:e.target.value})),placeholder:`12345, *`})}),(0,C.jsxs)(q,{type:`submit`,children:[(0,C.jsx)(Pt,{}),`Add`]})]})]}),(0,C.jsxs)(CH,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Bind agent`}),(0,C.jsxs)(`form`,{className:`mt-4 space-y-3`,onSubmit:async e=>{e.preventDefault(),await sH({accountId:o.accountId,agentId:o.agentId,peer:o.peer,isEnabled:!0}),s({accountId:``,agentId:``,peer:`*`}),await r()},children:[(0,C.jsx)(xH,{label:`Account`,children:(0,C.jsxs)(PV,{className:`w-full`,value:o.accountId,onChange:e=>s(t=>({...t,accountId:e.target.value})),required:!0,children:[(0,C.jsx)(FV,{value:``,children:`Select account`}),e.map(e=>(0,C.jsx)(FV,{value:e.id,children:e.displayName},e.id))]})}),(0,C.jsx)(xH,{label:`Agent`,children:(0,C.jsxs)(PV,{className:`w-full`,value:o.agentId,onChange:e=>s(t=>({...t,agentId:e.target.value})),required:!0,children:[(0,C.jsx)(FV,{value:``,children:`Select agent`}),t.map(e=>(0,C.jsx)(FV,{value:e.id,children:e.name},e.id))]})}),(0,C.jsx)(xH,{label:`Peer`,children:(0,C.jsx)(jg,{value:o.peer,onChange:e=>s(t=>({...t,peer:e.target.value})),required:!0})}),(0,C.jsxs)(q,{type:`submit`,disabled:!e.length||!t.length,children:[(0,C.jsx)(Nt,{}),`Bind`]})]})]})]}),(0,C.jsxs)(`div`,{className:`space-y-5`,children:[(0,C.jsxs)(CH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Accounts`}),(0,C.jsx)(vV,{variant:`secondary`,children:e.length})]}),(0,C.jsx)(`div`,{className:`mt-4 space-y-3`,children:e.length===0?(0,C.jsx)(wH,{text:`No channel accounts configured.`}):e.map(e=>(0,C.jsx)(NV,{className:`gap-0 rounded-lg border-border bg-background/60 p-4 py-4 shadow-none`,children:(0,C.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`h3`,{className:`font-medium`,children:e.displayName}),(0,C.jsx)(vV,{variant:`secondary`,children:e.channel}),(0,C.jsx)(vV,{variant:e.status===`connected`?`default`:`outline`,children:e.status})]}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.accountRef??`No account ref`}),typeof e.metadata.qr==`string`&&(0,C.jsx)(`p`,{className:`mt-2 break-all rounded-lg bg-muted/50 p-2 font-mono text-xs text-muted-foreground`,children:e.metadata.qr}),e.lastError&&(0,C.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:e.lastError})]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[e.status===`connected`?(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Disconnect channel`,onClick:()=>void iH(e.id).then(r),children:(0,C.jsx)(Wt,{})}):(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Connect channel`,onClick:()=>void rH(e.id).then(r),children:(0,C.jsx)(Nt,{})}),(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Delete channel`,onClick:()=>void aH(e.id).then(r),children:(0,C.jsx)(Ht,{})})]})]})},e.id))})]}),(0,C.jsxs)(CH,{children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:`Bindings`}),(0,C.jsx)(vV,{variant:`secondary`,children:n.length})]}),(0,C.jsx)(`div`,{className:`mt-4`,children:n.length===0?(0,C.jsx)(wH,{text:`No channel bindings configured.`}):(0,C.jsxs)(LV,{children:[(0,C.jsx)(RV,{children:(0,C.jsxs)(BV,{children:[(0,C.jsx)(VV,{children:`Peer`}),(0,C.jsx)(VV,{children:`Account`}),(0,C.jsx)(VV,{children:`Agent`}),(0,C.jsx)(VV,{className:`text-right`,children:`Actions`})]})}),(0,C.jsx)(zV,{children:n.map(n=>(0,C.jsxs)(BV,{children:[(0,C.jsx)(HV,{children:n.peer}),(0,C.jsx)(HV,{children:jH(e,n.accountId)}),(0,C.jsx)(HV,{children:MH(t,n.agentId)}),(0,C.jsx)(HV,{children:(0,C.jsx)(`div`,{className:`flex justify-end`,children:(0,C.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Delete binding`,onClick:()=>void cH(n.id).then(r),children:(0,C.jsx)(Ht,{})})})})]},n.id))})]})})]})]})]})}function yH({labelKey:e,rows:t,title:n}){return(0,C.jsxs)(CH,{children:[(0,C.jsx)(`h2`,{className:`text-base font-semibold`,children:n}),(0,C.jsx)(`div`,{className:`mt-4`,children:t.length===0?(0,C.jsx)(wH,{text:`No usage breakdown yet.`}):(0,C.jsxs)(LV,{children:[(0,C.jsx)(RV,{children:(0,C.jsxs)(BV,{children:[(0,C.jsx)(VV,{children:`Name`}),(0,C.jsx)(VV,{children:`Requests`}),(0,C.jsx)(VV,{children:`Tokens`})]})}),(0,C.jsx)(zV,{children:t.map(t=>(0,C.jsxs)(BV,{children:[(0,C.jsx)(HV,{children:String(t[e]??`unknown`)}),(0,C.jsx)(HV,{children:kH(t.requests)}),(0,C.jsx)(HV,{children:kH(t.totalTokens)})]},String(t[e])))})]})})]})}function bH({label:e,value:t}){return(0,C.jsxs)(NV,{className:`gap-0 rounded-lg border-border bg-muted/30 p-4 py-4 shadow-none`,children:[(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),(0,C.jsx)(`p`,{className:`mt-2 text-xl font-semibold`,children:t})]})}function xH({children:e,label:t}){return(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(vv,{htmlFor:(0,b.useMemo)(()=>`${t.toLowerCase().replace(/\s+/g,`-`)}-${crypto.randomUUID()}`,[t]),children:t}),e]})}function SH({checked:e,label:t,onCheckedChange:n}){return(0,C.jsxs)(vv,{className:`flex items-center gap-2 text-sm`,children:[(0,C.jsx)(IV,{checked:e,onCheckedChange:n}),t]})}function CH({children:e}){return(0,C.jsx)(NV,{className:`natroc-soft-panel gap-0 rounded-lg border-border bg-background/70 p-4 py-4 shadow-none`,children:e})}function wH({text:e}){return(0,C.jsx)(`div`,{className:`rounded-lg border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground`,children:e})}function TH(){let e=new URLSearchParams(window.location.search).get(`tab`);return EH(e)?e:`agents`}function EH(e){return e===`agents`||e===`usage`||e===`channels`}function DH(e){return e.trim()||null}function OH(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function kH(e){return new Intl.NumberFormat().format(e??0)}function AH(e){return new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}function jH(e,t){return e.find(e=>e.id===t)?.displayName??`Unknown`}function MH(e,t){return e.find(e=>e.id===t)?.name??`Unknown`}function NH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty`,className:K(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function PH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-header`,className:K(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var FH=wg(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function IH({className:e,variant:t=`default`,...n}){return(0,C.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:K(FH({variant:t,className:e})),...n})}function LH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-title`,className:K(`font-heading text-sm font-medium tracking-tight`,e),...t})}function RH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-description`,className:K(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function zH({className:e,...t}){return(0,C.jsx)(`div`,{"data-slot":`empty-content`,className:K(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,e),...t})}async function BH(){return(await J.call(`projects.list`)).projects??[]}async function VH(e,t){return(await J.call(`projects.create`,{name:e,description:t})).project}async function HH(e){await J.call(`projects.delete`,{id:e})}var UH=[`Activity`,`Name`,`Created`];function WH(e,t){let n=[...e];return t===`Name`?n.sort((e,t)=>e.name.localeCompare(t.name)):t===`Created`?n.sort((e,t)=>t.createdAt.localeCompare(e.createdAt)):n.sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function GH(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString()}function KH(e){return(0,C.jsxs)(`svg`,{viewBox:`0 0 96 96`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,"aria-hidden":`true`,...e,children:[(0,C.jsx)(`rect`,{x:`28`,y:`14`,width:`22`,height:`22`,rx:`1`}),(0,C.jsx)(`rect`,{x:`51`,y:`13`,width:`22`,height:`22`,rx:`1`}),(0,C.jsx)(`rect`,{x:`51`,y:`38`,width:`22`,height:`20`,rx:`1`}),(0,C.jsx)(`path`,{d:`M59 62V51a4 4 0 0 1 8 0v11`}),(0,C.jsx)(`path`,{d:`M67 58V49a4 4 0 0 1 8 0v14`}),(0,C.jsx)(`path`,{d:`M75 60v-8a4 4 0 0 1 8 0v15`}),(0,C.jsx)(`path`,{d:`M83 61v-6a4 4 0 0 1 8 0v17c0 10-6 16-17 16H55a4 4 0 0 1-4-4V62a4 4 0 0 1 8 0v10`}),(0,C.jsx)(`path`,{d:`M51 72h12`})]})}function qH(){let[e,t]=(0,b.useState)(`Activity`),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(!0),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(``),[m,h]=(0,b.useState)(``),[g,_]=(0,b.useState)(!1),[v,y]=(0,b.useState)(``),x=(0,b.useCallback)(async()=>{s(!0),l(``);try{a(await BH())}catch(e){l(e instanceof Error?e.message:`Failed to load projects.`)}finally{s(!1)}},[]);(0,b.useEffect)(()=>{let e=window.setTimeout(()=>{x()});return()=>window.clearTimeout(e)},[x]);let S=()=>d(!0),w=()=>{p(``),h(``),y(``)},T=e=>{d(e),e||w()},E=async e=>{if(e.preventDefault(),!(!f.trim()||g)){_(!0),y(``);try{let e=await VH(f.trim(),m.trim());a(t=>[e,...t]),d(!1),w()}catch(e){y(e instanceof Error?e.message:`Failed to create project.`)}finally{_(!1)}}},D=async e=>{a(t=>t.filter(t=>t.id!==e));try{await HH(e)}catch{x()}},O=WH(i.filter(e=>{let t=n.trim().toLowerCase();return t?e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t):!0}),e);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`section`,{className:`natroc-enter flex min-h-[calc(100svh-7rem)] w-full flex-col gap-6`,children:[(0,C.jsxs)(`div`,{className:`natroc-stagger flex flex-col gap-5`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Projects`}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3 self-start sm:self-auto`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:`Sort by`}),(0,C.jsxs)(E_,{children:[(0,C.jsx)(D_,{asChild:!0,children:(0,C.jsxs)(q,{variant:`secondary`,children:[e,(0,C.jsx)(Ye,{})]})}),(0,C.jsx)(O_,{align:`end`,className:`w-36`,children:(0,C.jsx)(j_,{value:e,onValueChange:e=>t(e),children:UH.map(e=>(0,C.jsx)(M_,{value:e,children:e},e))})})]}),(0,C.jsx)(q,{onClick:S,children:`New project`})]})]}),(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(It,{className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(jg,{"aria-label":`Search projects`,placeholder:`Search projects...`,value:n,onChange:e=>r(e.target.value),className:`h-10 rounded-lg border-transparent bg-muted/80 pl-9 text-sm focus-visible:border-ring dark:bg-muted/80`})]})]}),o?(0,C.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-12 text-sm text-muted-foreground`,children:`Loading projects...`}):c?(0,C.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-12`,children:[(0,C.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),(0,C.jsx)(q,{variant:`secondary`,onClick:()=>void x(),children:`Try again`})]}):O.length===0?(0,C.jsx)(`div`,{className:`natroc-enter flex flex-1 items-center justify-center py-12`,children:(0,C.jsxs)(NH,{className:`max-w-md border-0 p-0`,children:[(0,C.jsxs)(PH,{children:[(0,C.jsx)(IH,{className:`mb-3 text-foreground`,children:(0,C.jsx)(KH,{className:`size-20`})}),(0,C.jsx)(LH,{children:i.length===0?`Looking to start a project?`:`No projects match your search`}),(0,C.jsx)(RH,{children:`Upload materials, set custom instructions, and organize conversations in one space.`})]}),(0,C.jsx)(zH,{children:(0,C.jsx)(q,{variant:`secondary`,onClick:S,children:`New project`})})]})}):(0,C.jsx)(`div`,{className:`natroc-stagger grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:O.map(e=>(0,C.jsxs)(`div`,{className:`natroc-soft-panel flex flex-col gap-2 rounded-lg border border-border bg-card p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,C.jsx)(`h3`,{className:`font-medium break-words`,children:e.name}),(0,C.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,onClick:()=>void D(e.id),children:(0,C.jsx)(Ht,{className:`text-muted-foreground`})})]}),e.description&&(0,C.jsx)(`p`,{className:`line-clamp-3 text-sm text-muted-foreground`,children:e.description}),(0,C.jsxs)(`p`,{className:`mt-auto text-xs text-muted-foreground`,children:[`Created `,GH(e.createdAt)]})]},e.id))})]}),(0,C.jsx)(nv,{open:u,onOpenChange:T,children:(0,C.jsxs)(ov,{className:`gap-6 rounded-lg p-6 sm:max-w-[520px]`,children:[(0,C.jsx)(lv,{className:`pr-8 text-2xl font-semibold`,children:`Create a project`}),(0,C.jsxs)(`div`,{className:`natroc-soft-panel rounded-lg bg-muted/80 p-4 dark:bg-background/80`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:`How to use projects`}),(0,C.jsxs)(uv,{className:`mt-3 space-y-3 text-sm leading-relaxed`,children:[(0,C.jsx)(`p`,{children:`Projects help organize your work and leverage knowledge across multiple conversations. Upload docs, code, and files to create themed collections that Natroc can reference again and again.`}),(0,C.jsx)(`p`,{children:`Start by creating a memorable title and description to organize your project. You can always edit it later.`})]})]}),(0,C.jsxs)(`form`,{className:`natroc-stagger flex flex-col gap-6`,onSubmit:E,children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`project-name`,children:`What are you working on?`}),(0,C.jsx)(jg,{id:`project-name`,placeholder:`Name your project`,value:f,onChange:e=>p(e.target.value),className:`border-transparent bg-muted/80 dark:bg-muted/80`})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,C.jsx)(vv,{htmlFor:`project-description`,children:`What are you trying to achieve?`}),(0,C.jsx)(dv,{id:`project-description`,placeholder:`Describe your project, goals, subject, etc...`,value:m,onChange:e=>h(e.target.value),className:`min-h-20 resize-none border-transparent bg-muted/80 dark:bg-muted/80`})]}),v&&(0,C.jsx)(`p`,{className:`text-sm text-destructive`,children:v}),(0,C.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,C.jsx)(iv,{asChild:!0,children:(0,C.jsx)(q,{type:`button`,variant:`secondary`,children:`Cancel`})}),(0,C.jsx)(q,{type:`submit`,disabled:!f.trim()||g,children:g?`Creating...`:`Create project`})]})]})]})})]})}var JH=new Set([`/login`,`/register`,`/onboarding/register`]);function YH(){let[e,t]=(0,b.useState)(window.location.pathname),[n,r]=(0,b.useState)(!1),[i,a]=(0,b.useState)(!0);return(0,b.useEffect)(()=>{let e=!1;eV().then(t=>{e||(a(t.hasUsers),r(!0))}).catch(()=>{e||(a(!0),r(!0))});let n=()=>t(window.location.pathname);return window.addEventListener(`popstate`,n),window.addEventListener(`natroc:navigate`,n),()=>{e=!0,window.removeEventListener(`popstate`,n),window.removeEventListener(`natroc:navigate`,n)}},[]),n?!i&&!JH.has(e)?(window.history.replaceState(null,``,`/onboarding/register`),(0,C.jsx)(rA,{})):e===`/login`?(0,C.jsx)(dV,{}):e===`/register`?(0,C.jsx)(gV,{}):e===`/onboarding/register`?(0,C.jsx)(rA,{}):z_()?e===y_.home.path||e.startsWith(`/chat/`)?(0,C.jsx)(Kv,{children:(0,C.jsx)(KB,{})}):e===y_.projects.path?(0,C.jsx)(Kv,{children:(0,C.jsx)(qH,{})}):e===`/agent`?(window.location.replace(`/config?tab=agents`),null):e===y_.config.path?(0,C.jsx)(Kv,{children:(0,C.jsx)(mH,{})}):e===y_.account.path?(0,C.jsx)(Kv,{children:(0,C.jsx)(YB,{})}):(0,C.jsx)(Hk,{}):(0,C.jsx)(dV,{}):null}(0,x.createRoot)(document.getElementById(`root`)).render((0,C.jsx)(b.StrictMode,{children:(0,C.jsxs)(j,{children:[(0,C.jsx)(vg,{children:(0,C.jsx)(YH,{})}),(0,C.jsx)(Jt,{position:`top-right`,richColors:!0})]})}));
|