dccxx-s3-explorer 1.0.15 → 1.0.16
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/dist/s3-explorer.js +275 -276
- package/dist/s3-explorer.js.map +1 -1
- package/dist/s3-explorer.umd.cjs +1 -1
- package/dist/s3-explorer.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/s3-explorer.umd.cjs
CHANGED
|
@@ -128,6 +128,6 @@
|
|
|
128
128
|
|
|
129
129
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
130
130
|
|
|
131
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Wh="DialogDescriptionWarning",qh=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${El(Wh).contentName}}.`;return d.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Kh=ul,Xh=fl,Yh=gl,Nl=hl,Pl=ml,Tl=yl,Al=bl,Jh=Cl;const rn=Kh,lr=Xh,Zh=Yh,_l=d.forwardRef(({className:e,...t},n)=>c.jsx(Nl,{ref:n,className:J("s3-explr-ui-dialog-overlay fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));_l.displayName=Nl.displayName;const It=d.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Zh,{children:[c.jsx(_l,{}),c.jsxs(Pl,{ref:r,className:J("s3-explr-ui-dialog-content fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,c.jsxs(Jh,{className:J("s3-explr-ui-dialog-close absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"),children:[c.jsx(aa,{className:"s3-explr-ui-dialog-close-icon h-4 w-4"}),c.jsx("span",{className:"s3-explr-ui-dialog-close-text sr-only",children:"Close"})]})]})]}));It.displayName=Pl.displayName;const Lt=({className:e,...t})=>c.jsx("div",{className:J("s3-explr-ui-dialog-header flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Lt.displayName="DialogHeader";const cr=({className:e,...t})=>c.jsx("div",{className:J("s3-explr-ui-dialog-footer flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});cr.displayName="DialogFooter";const Vt=d.forwardRef(({className:e,...t},n)=>c.jsx(Tl,{ref:n,className:J("s3-explr-ui-dialog-title text-lg font-semibold leading-none tracking-tight",e),...t}));Vt.displayName=Tl.displayName;const Yo=d.forwardRef(({className:e,...t},n)=>c.jsx(Al,{ref:n,className:J("s3-explr-ui-dialog-description text-sm text-muted-foreground",e),...t}));Yo.displayName=Al.displayName;const Et=d.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:J("s3-explr-ui-input","flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));Et.displayName="Input";var Qh="Label",Fl=d.forwardRef((e,t)=>c.jsx(ve.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Fl.displayName=Qh;var Ol=Fl;const em=Fo("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 s3-explr-ui-label",{variants:{variant:{default:"s3-explr-ui-label-default",required:"s3-explr-ui-label-required",disabled:"s3-explr-ui-label-disabled"},size:{default:"s3-explr-ui-label-size-default",sm:"s3-explr-ui-label-size-sm",lg:"s3-explr-ui-label-size-lg"}},defaultVariants:{variant:"default",size:"default"}}),bn=d.forwardRef(({className:e,variant:t,size:n,...r},o)=>c.jsx(Ol,{ref:o,className:J(em({variant:t,size:n}),e),...r}));bn.displayName=Ol.displayName;const ur=d.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:J("relative w-full overflow-auto","s3-explr-ui-table-container"),children:c.jsx("table",{ref:n,className:J("w-full caption-bottom text-sm","s3-explr-ui-table",e),...t})}));ur.displayName="Table";const dr=d.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:J("[&_tr]:border-b","s3-explr-ui-table-header",e),...t}));dr.displayName="TableHeader";const fr=d.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:J("[&_tr:last-child]:border-0","s3-explr-ui-table-body",e),...t}));fr.displayName="TableBody";const tm=d.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:J("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0","s3-explr-ui-table-footer",e),...t}));tm.displayName="TableFooter";const Ue=d.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:J("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted","s3-explr-ui-table-row",e),...t}));Ue.displayName="TableRow";const Qe=d.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:J("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-head",e),...t}));Qe.displayName="TableHead";const Pe=d.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:J("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-cell",e),...t}));Pe.displayName="TableCell";const nm=d.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:J("mt-4 text-sm text-muted-foreground","s3-explr-ui-table-caption",e),...t}));nm.displayName="TableCaption";function Jo(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function on(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Dl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Zo(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Dl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Dl(e[o],null)}}}}function Qo(...e){return d.useCallback(Zo(...e),e)}var es=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(om);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ts,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ts,{...r,ref:t,children:n})});es.displayName="Slot";var ts=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=im(n);return d.cloneElement(n,{...sm(r,n.props),ref:t?Zo(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ts.displayName="SlotClone";var rm=({children:e})=>c.jsx(c.Fragment,{children:e});function om(e){return d.isValidElement(e)&&e.type===rm}function sm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function im(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function am(e){const t=e+"CollectionProvider",[n,r]=xt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:v,children:h}=p,y=O.useRef(null),w=O.useRef(new Map).current;return c.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=O.forwardRef((p,v)=>{const{scope:h,children:y}=p,w=s(a,h),x=Qo(v,w.collectionRef);return c.jsx(es,{ref:x,children:y})});u.displayName=a;const l=e+"CollectionItemSlot",f="data-radix-collection-item",g=O.forwardRef((p,v)=>{const{scope:h,children:y,...w}=p,x=O.useRef(null),N=Qo(v,x),P=s(l,h);return O.useEffect(()=>(P.itemMap.set(x,{ref:x,...w}),()=>void P.itemMap.delete(x))),c.jsx(es,{[f]:"",ref:N,children:y})});g.displayName=l;function m(p){const v=s(e+"CollectionConsumer",p);return O.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((P,b)=>w.indexOf(P.ref.current)-w.indexOf(b.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:g},m,r]}var Ml=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(cm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ns,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ns,{...r,ref:t,children:n})});Ml.displayName="Slot";var ns=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=dm(n);return d.cloneElement(n,{...um(r,n.props),ref:t?Zo(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ns.displayName="SlotClone";var lm=({children:e})=>c.jsx(c.Fragment,{children:e});function cm(e){return d.isValidElement(e)&&e.type===lm}function um(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function dm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Rl=fm.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Ml:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),pm=d.createContext(void 0);function kl(e){const t=d.useContext(pm);return e||t||"ltr"}var rs="rovingFocusGroup.onEntryFocus",gm={bubbles:!1,cancelable:!0},pr="RovingFocusGroup",[os,$l,hm]=am(pr),[mm,Il]=xt(pr,[hm]),[vm,ym]=mm(pr),Ll=d.forwardRef((e,t)=>c.jsx(os.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(os.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(wm,{...e,ref:t})})}));Ll.displayName=pr;var wm=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:l,preventScrollOnEntryFocus:f=!1,...g}=e,m=d.useRef(null),p=Qo(t,m),v=kl(s),[h=null,y]=Yt({prop:i,defaultProp:a,onChange:u}),[w,x]=d.useState(!1),N=Ce(l),P=$l(n),b=d.useRef(!1),[S,E]=d.useState(0);return d.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(rs,N),()=>R.removeEventListener(rs,N)},[N]),c.jsx(vm,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:h,onItemFocus:d.useCallback(R=>y(R),[y]),onItemShiftTab:d.useCallback(()=>x(!0),[]),onFocusableItemAdd:d.useCallback(()=>E(R=>R+1),[]),onFocusableItemRemove:d.useCallback(()=>E(R=>R-1),[]),children:c.jsx(Rl.div,{tabIndex:w||S===0?-1:0,"data-orientation":r,...g,ref:p,style:{outline:"none",...e.style},onMouseDown:on(e.onMouseDown,()=>{b.current=!0}),onFocus:on(e.onFocus,R=>{const U=!b.current;if(R.target===R.currentTarget&&U&&!w){const H=new CustomEvent(rs,gm);if(R.currentTarget.dispatchEvent(H),!H.defaultPrevented){const Z=P().filter(B=>B.focusable),F=Z.find(B=>B.active),$=Z.find(B=>B.id===h),G=[F,$,...Z].filter(Boolean).map(B=>B.ref.current);zl(G,f)}}b.current=!1}),onBlur:on(e.onBlur,()=>x(!1))})})}),Vl="RovingFocusGroupItem",Bl=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...i}=e,a=Zt(),u=s||a,l=ym(Vl,n),f=l.currentTabStopId===u,g=$l(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=l;return d.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),c.jsx(os.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:c.jsx(Rl.span,{tabIndex:f?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:on(e.onMouseDown,v=>{r?l.onItemFocus(u):v.preventDefault()}),onFocus:on(e.onFocus,()=>l.onItemFocus(u)),onKeyDown:on(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){l.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=Cm(v,l.orientation,l.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=g().filter(x=>x.focusable).map(x=>x.ref.current);if(h==="last")w.reverse();else if(h==="prev"||h==="next"){h==="prev"&&w.reverse();const x=w.indexOf(v.currentTarget);w=l.loop?Sm(w,x+1):w.slice(x+1)}setTimeout(()=>zl(w))}})})})});Bl.displayName=Vl;var bm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function xm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Cm(e,t,n){const r=xm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return bm[r]}function zl(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Sm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Em=Ll,Nm=Bl;function Hl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Pm(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Hl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Hl(e[o],null)}}}}function Tm(...e){return d.useCallback(Pm(...e),e)}function Am(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var Ul=e=>{const{present:t,children:n}=e,r=_m(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=Tm(r.ref,Fm(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Ul.displayName="Presence";function _m(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Am(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const l=gr(r.current);s.current=a==="mounted"?l:"none"},[a]),De(()=>{const l=r.current,f=o.current;if(f!==e){const m=s.current,p=gr(l);e?u("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?u("UNMOUNT"):u(f&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),De(()=>{if(t){let l;const f=t.ownerDocument.defaultView??window,g=p=>{const h=gr(r.current).includes(p.animationName);if(p.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=p=>{p.target===t&&(s.current=gr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{f.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function gr(e){return(e==null?void 0:e.animationName)||"none"}function Fm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function jl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Om(...e){return t=>{let n=!1;const r=e.map(o=>{const s=jl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():jl(e[o],null)}}}}var Gl=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Mm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ss,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ss,{...r,ref:t,children:n})});Gl.displayName="Slot";var ss=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=km(n);return d.cloneElement(n,{...Rm(r,n.props),ref:t?Om(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ss.displayName="SlotClone";var Dm=({children:e})=>c.jsx(c.Fragment,{children:e});function Mm(e){return d.isValidElement(e)&&e.type===Dm}function Rm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function km(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $m=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],hr=$m.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Gl:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),is="Tabs",[Im,xx]=xt(is,[Il]),Wl=Il(),[Lm,as]=Im(is),ql=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:u="automatic",...l}=e,f=kl(a),[g,m]=Yt({prop:r,onChange:o,defaultProp:s});return c.jsx(Lm,{scope:n,baseId:Zt(),value:g,onValueChange:m,orientation:i,dir:f,activationMode:u,children:c.jsx(hr.div,{dir:f,"data-orientation":i,...l,ref:t})})});ql.displayName=is;var Kl="TabsList",Xl=d.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=as(Kl,n),i=Wl(n);return c.jsx(Em,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:c.jsx(hr.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Xl.displayName=Kl;var Yl="TabsTrigger",Jl=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=as(Yl,n),a=Wl(n),u=ec(i.baseId,r),l=tc(i.baseId,r),f=r===i.value;return c.jsx(Nm,{asChild:!0,...a,focusable:!o,active:f,children:c.jsx(hr.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":l,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...s,ref:t,onMouseDown:Jo(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?i.onValueChange(r):g.preventDefault()}),onKeyDown:Jo(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(r)}),onFocus:Jo(e.onFocus,()=>{const g=i.activationMode!=="manual";!f&&!o&&g&&i.onValueChange(r)})})})});Jl.displayName=Yl;var Zl="TabsContent",Ql=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=as(Zl,n),u=ec(a.baseId,r),l=tc(a.baseId,r),f=r===a.value,g=d.useRef(f);return d.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),c.jsx(Ul,{present:o||f,children:({present:m})=>c.jsx(hr.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!m,id:l,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});Ql.displayName=Zl;function ec(e,t){return`${e}-trigger-${t}`}function tc(e,t){return`${e}-content-${t}`}var Vm=ql,nc=Xl,rc=Jl,oc=Ql;const Bm=Vm,sc=d.forwardRef(({className:e,...t},n)=>c.jsx(nc,{ref:n,className:J("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));sc.displayName=nc.displayName;const ls=d.forwardRef(({className:e,...t},n)=>c.jsx(rc,{ref:n,className:J("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));ls.displayName=rc.displayName;const cs=d.forwardRef(({className:e,...t},n)=>c.jsx(oc,{ref:n,className:J("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));cs.displayName=oc.displayName;const mr=d.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:J("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));mr.displayName="Textarea";function zm(e,t=[]){let n=[];function r(s,i){const a=d.createContext(i),u=n.length;n=[...n,i];function l(g){const{scope:m,children:p,...v}=g,h=(m==null?void 0:m[e][u])||a,y=d.useMemo(()=>v,Object.values(v));return c.jsx(h.Provider,{value:y,children:p})}function f(g,m){const p=(m==null?void 0:m[e][u])||a,v=d.useContext(p);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${g}\` must be used within \`${s}\``)}return l.displayName=s+"Provider",[l,f]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(a){const u=(a==null?void 0:a[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,Hm(o,...t)]}function Hm(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:u,scopeName:l})=>{const g=u(s)[`__scope${l}`];return{...a,...g}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var us=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(jm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ds,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ds,{...r,ref:t,children:n})});us.displayName="Slot";var ds=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Wm(n);return d.cloneElement(n,{...Gm(r,n.props),ref:t?Zn(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ds.displayName="SlotClone";var Um=({children:e})=>c.jsx(c.Fragment,{children:e});function jm(e){return d.isValidElement(e)&&e.type===Um}function Gm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Wm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function qm(e){const t=e+"CollectionProvider",[n,r]=zm(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:v,children:h}=p,y=O.useRef(null),w=O.useRef(new Map).current;return c.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=O.forwardRef((p,v)=>{const{scope:h,children:y}=p,w=s(a,h),x=$e(v,w.collectionRef);return c.jsx(us,{ref:x,children:y})});u.displayName=a;const l=e+"CollectionItemSlot",f="data-radix-collection-item",g=O.forwardRef((p,v)=>{const{scope:h,children:y,...w}=p,x=O.useRef(null),N=$e(v,x),P=s(l,h);return O.useEffect(()=>(P.itemMap.set(x,{ref:x,...w}),()=>void P.itemMap.delete(x))),c.jsx(us,{[f]:"",ref:N,children:y})});g.displayName=l;function m(p){const v=s(e+"CollectionConsumer",p);return O.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((P,b)=>w.indexOf(P.ref.current)-w.indexOf(b.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:g},m,r]}var Km="VisuallyHidden",fs=d.forwardRef((e,t)=>c.jsx(ve.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));fs.displayName=Km;var ps="ToastProvider",[gs,Xm,Ym]=qm("Toast"),[ic,Cx]=xt("Toast",[Ym]),[Jm,vr]=ic(ps),ac=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,u]=d.useState(null),[l,f]=d.useState(0),g=d.useRef(!1),m=d.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${ps}\`. Expected non-empty \`string\`.`),c.jsx(gs.Provider,{scope:t,children:c.jsx(Jm,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:l,viewport:a,onViewportChange:u,onToastAdd:d.useCallback(()=>f(p=>p+1),[]),onToastRemove:d.useCallback(()=>f(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:m,children:i})})};ac.displayName=ps;var lc="ToastViewport",Zm=["F8"],hs="toast.viewportPause",ms="toast.viewportResume",cc=d.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Zm,label:o="Notifications ({hotkey})",...s}=e,i=vr(lc,n),a=Xm(n),u=d.useRef(null),l=d.useRef(null),f=d.useRef(null),g=d.useRef(null),m=$e(t,g,i.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=i.toastCount>0;d.useEffect(()=>{const y=w=>{var N;r.length!==0&&r.every(P=>w[P]||w.code===P)&&((N=g.current)==null||N.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),d.useEffect(()=>{const y=u.current,w=g.current;if(v&&y&&w){const x=()=>{if(!i.isClosePausedRef.current){const S=new CustomEvent(hs);w.dispatchEvent(S),i.isClosePausedRef.current=!0}},N=()=>{if(i.isClosePausedRef.current){const S=new CustomEvent(ms);w.dispatchEvent(S),i.isClosePausedRef.current=!1}},P=S=>{!y.contains(S.relatedTarget)&&N()},b=()=>{y.contains(document.activeElement)||N()};return y.addEventListener("focusin",x),y.addEventListener("focusout",P),y.addEventListener("pointermove",x),y.addEventListener("pointerleave",b),window.addEventListener("blur",x),window.addEventListener("focus",N),()=>{y.removeEventListener("focusin",x),y.removeEventListener("focusout",P),y.removeEventListener("pointermove",x),y.removeEventListener("pointerleave",b),window.removeEventListener("blur",x),window.removeEventListener("focus",N)}}},[v,i.isClosePausedRef]);const h=d.useCallback(({tabbingDirection:y})=>{const x=a().map(N=>{const P=N.ref.current,b=[P,...dv(P)];return y==="forwards"?b:b.reverse()});return(y==="forwards"?x.reverse():x).flat()},[a]);return d.useEffect(()=>{const y=g.current;if(y){const w=x=>{var b,S,E;const N=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!N){const R=document.activeElement,U=x.shiftKey;if(x.target===y&&U){(b=l.current)==null||b.focus();return}const F=h({tabbingDirection:U?"backwards":"forwards"}),$=F.findIndex(D=>D===R);ws(F.slice($+1))?x.preventDefault():U?(S=l.current)==null||S.focus():(E=f.current)==null||E.focus()}};return y.addEventListener("keydown",w),()=>y.removeEventListener("keydown",w)}},[a,h]),c.jsxs(zg,{ref:u,role:"region","aria-label":o.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&c.jsx(vs,{ref:l,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"forwards"});ws(y)}}),c.jsx(gs.Slot,{scope:n,children:c.jsx(ve.ol,{tabIndex:-1,...s,ref:m})}),v&&c.jsx(vs,{ref:f,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"backwards"});ws(y)}})]})});cc.displayName=lc;var uc="ToastFocusProxy",vs=d.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=vr(uc,n);return c.jsx(fs,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var l;const a=i.relatedTarget;!((l=s.viewport)!=null&&l.contains(a))&&r()}})});vs.displayName=uc;var yr="Toast",Qm="toast.swipeStart",ev="toast.swipeMove",tv="toast.swipeCancel",nv="toast.swipeEnd",dc=d.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a=!0,u]=Yt({prop:r,defaultProp:o,onChange:s});return c.jsx(Jt,{present:n||a,children:c.jsx(sv,{open:a,...i,ref:t,onClose:()=>u(!1),onPause:Ce(e.onPause),onResume:Ce(e.onResume),onSwipeStart:he(e.onSwipeStart,l=>{l.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:he(e.onSwipeMove,l=>{const{x:f,y:g}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","move"),l.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${g}px`)}),onSwipeCancel:he(e.onSwipeCancel,l=>{l.currentTarget.setAttribute("data-swipe","cancel"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:he(e.onSwipeEnd,l=>{const{x:f,y:g}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","end"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${g}px`),u(!1)})})})});dc.displayName=yr;var[rv,ov]=ic(yr,{onClose(){}}),sv=d.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:u,onResume:l,onSwipeStart:f,onSwipeMove:g,onSwipeCancel:m,onSwipeEnd:p,...v}=e,h=vr(yr,n),[y,w]=d.useState(null),x=$e(t,D=>w(D)),N=d.useRef(null),P=d.useRef(null),b=o||h.duration,S=d.useRef(0),E=d.useRef(b),R=d.useRef(0),{onToastAdd:U,onToastRemove:H}=h,Z=Ce(()=>{var G;(y==null?void 0:y.contains(document.activeElement))&&((G=h.viewport)==null||G.focus()),i()}),F=d.useCallback(D=>{!D||D===1/0||(window.clearTimeout(R.current),S.current=new Date().getTime(),R.current=window.setTimeout(Z,D))},[Z]);d.useEffect(()=>{const D=h.viewport;if(D){const G=()=>{F(E.current),l==null||l()},B=()=>{const q=new Date().getTime()-S.current;E.current=E.current-q,window.clearTimeout(R.current),u==null||u()};return D.addEventListener(hs,B),D.addEventListener(ms,G),()=>{D.removeEventListener(hs,B),D.removeEventListener(ms,G)}}},[h.viewport,b,u,l,F]),d.useEffect(()=>{s&&!h.isClosePausedRef.current&&F(b)},[s,b,h.isClosePausedRef,F]),d.useEffect(()=>(U(),()=>H()),[U,H]);const $=d.useMemo(()=>y?yc(y):null,[y]);return h.viewport?c.jsxs(c.Fragment,{children:[$&&c.jsx(iv,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:$}),c.jsx(rv,{scope:n,onClose:Z,children:kn.createPortal(c.jsx(gs.ItemSlot,{scope:n,children:c.jsx(Bg,{asChild:!0,onEscapeKeyDown:he(a,()=>{h.isFocusedToastEscapeKeyDownRef.current||Z(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(ve.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":h.swipeDirection,...v,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:he(e.onKeyDown,D=>{D.key==="Escape"&&(a==null||a(D.nativeEvent),D.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,Z()))}),onPointerDown:he(e.onPointerDown,D=>{D.button===0&&(N.current={x:D.clientX,y:D.clientY})}),onPointerMove:he(e.onPointerMove,D=>{if(!N.current)return;const G=D.clientX-N.current.x,B=D.clientY-N.current.y,q=!!P.current,K=["left","right"].includes(h.swipeDirection),te=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,ae=K?te(0,G):0,re=K?0:te(0,B),Ae=D.pointerType==="touch"?10:2,qe={x:ae,y:re},at={originalEvent:D,delta:qe};q?(P.current=qe,wr(ev,g,at,{discrete:!1})):wc(qe,h.swipeDirection,Ae)?(P.current=qe,wr(Qm,f,at,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(G)>Ae||Math.abs(B)>Ae)&&(N.current=null)}),onPointerUp:he(e.onPointerUp,D=>{const G=P.current,B=D.target;if(B.hasPointerCapture(D.pointerId)&&B.releasePointerCapture(D.pointerId),P.current=null,N.current=null,G){const q=D.currentTarget,K={originalEvent:D,delta:G};wc(G,h.swipeDirection,h.swipeThreshold)?wr(nv,p,K,{discrete:!0}):wr(tv,m,K,{discrete:!0}),q.addEventListener("click",te=>te.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),iv=e=>{const{__scopeToast:t,children:n,...r}=e,o=vr(yr,t),[s,i]=d.useState(!1),[a,u]=d.useState(!1);return cv(()=>i(!0)),d.useEffect(()=>{const l=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(l)},[]),a?null:c.jsx(Lo,{asChild:!0,children:c.jsx(fs,{...r,children:s&&c.jsxs(c.Fragment,{children:[o.label," ",n]})})})},av="ToastTitle",fc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});fc.displayName=av;var lv="ToastDescription",pc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});pc.displayName=lv;var gc="ToastAction",hc=d.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(vc,{altText:n,asChild:!0,children:c.jsx(ys,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${gc}\`. Expected non-empty \`string\`.`),null)});hc.displayName=gc;var mc="ToastClose",ys=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=ov(mc,n);return c.jsx(vc,{asChild:!0,children:c.jsx(ve.button,{type:"button",...r,ref:t,onClick:he(e.onClick,o.onClose)})})});ys.displayName=mc;var vc=d.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return c.jsx(ve.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function yc(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),uv(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...yc(r))}}),t}function wr(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ta(o,s):o.dispatchEvent(s)}var wc=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function cv(e=()=>{}){const t=Ce(e);De(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function uv(e){return e.nodeType===e.ELEMENT_NODE}function dv(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ws(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var fv=ac,bc=cc,xc=dc,Cc=fc,Sc=pc,Ec=hc,Nc=ys;const pv=fv,Pc=d.forwardRef(({className:e,...t},n)=>c.jsx(bc,{ref:n,className:J("s3-explr-ui-toast-viewport fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Pc.displayName=bc.displayName;const gv=Fo("s3-explr-ui-toast group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"s3-explr-ui-toast-default border bg-background text-foreground",destructive:"s3-explr-ui-toast-destructive destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Tc=d.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(xc,{ref:r,className:J(gv({variant:t}),e),...n}));Tc.displayName=xc.displayName;const hv=d.forwardRef(({className:e,...t},n)=>c.jsx(Ec,{ref:n,className:J("s3-explr-ui-toast-action inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));hv.displayName=Ec.displayName;const Ac=d.forwardRef(({className:e,...t},n)=>c.jsx(Nc,{ref:n,className:J("s3-explr-ui-toast-close absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:c.jsx(aa,{className:"s3-explr-ui-toast-close-icon h-4 w-4"})}));Ac.displayName=Nc.displayName;const _c=d.forwardRef(({className:e,...t},n)=>c.jsx(Cc,{ref:n,className:J("s3-explr-ui-toast-title text-sm font-semibold [&+div]:text-xs",e),...t}));_c.displayName=Cc.displayName;const Fc=d.forwardRef(({className:e,...t},n)=>c.jsx(Sc,{ref:n,className:J("s3-explr-ui-toast-description text-sm opacity-90",e),...t}));Fc.displayName=Sc.displayName;const mv=1,vv=1e6;let bs=0;function yv(){return bs=(bs+1)%Number.MAX_SAFE_INTEGER,bs.toString()}const xs=new Map,Oc=e=>{if(xs.has(e))return;const t=setTimeout(()=>{xs.delete(e),xn({type:"REMOVE_TOAST",toastId:e})},vv);xs.set(e,t)},wv=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,mv)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Oc(n):e.toasts.forEach(r=>{Oc(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},br=[];let xr={toasts:[]};function xn(e){xr=wv(xr,e),br.forEach(t=>{t(xr)})}function bv({...e}){const t=yv(),n=o=>xn({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>xn({type:"DISMISS_TOAST",toastId:t});return xn({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function Cs(){const[e,t]=d.useState(xr);return d.useEffect(()=>(br.push(t),()=>{const n=br.indexOf(t);n>-1&&br.splice(n,1)}),[e]),{...e,toast:bv,dismiss:n=>xn({type:"DISMISS_TOAST",toastId:n})}}function Dc(){const{toasts:e}=Cs();return c.jsxs(pv,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return c.jsxs(Tc,{...s,className:`s3-explr-ui-toast ${s.className||""}`,children:[c.jsxs("div",{className:"s3-explr-ui-toast-content grid gap-1",children:[n&&c.jsx(_c,{className:"s3-explr-ui-toast-title",children:n}),r&&c.jsx(Fc,{className:"s3-explr-ui-toast-description",children:r})]}),o&&c.jsx("div",{className:"s3-explr-ui-toast-action",children:o}),c.jsx(Ac,{className:"s3-explr-ui-toast-close"})]},t)}),c.jsx(Pc,{className:"s3-explr-ui-toast-viewport"})]})}function xv({title:e,titleId:t,...n},r){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Cv=d.forwardRef(xv);var Sv=function(e){return function(t,n){var r=O.useRef(!1);e(function(){return function(){r.current=!1}},[]),e(function(){if(!r.current)r.current=!0;else return t()},n)}},Mc=function(e){return typeof e=="function"},Rc=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";const Ev=Sv(O.useEffect);function kc(e){var t=O.useRef(e);return t.current=e,t}var Nv=function(e){Rc&&(Mc(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e)));var t=kc(e);O.useEffect(function(){return function(){t.current()}},[])},Cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Tv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var $c=Tv,Av=typeof Cr=="object"&&Cr&&Cr.Object===Object&&Cr,_v=Av,Fv=_v,Ov=typeof self=="object"&&self&&self.Object===Object&&self,Dv=Fv||Ov||Function("return this")(),Ic=Dv,Mv=Ic,Rv=function(){return Mv.Date.now()},kv=Rv,$v=/\s/;function Iv(e){for(var t=e.length;t--&&$v.test(e.charAt(t)););return t}var Lv=Iv,Vv=Lv,Bv=/^\s+/;function zv(e){return e&&e.slice(0,Vv(e)+1).replace(Bv,"")}var Hv=zv,Uv=Ic,jv=Uv.Symbol,Lc=jv,Vc=Lc,Bc=Object.prototype,Gv=Bc.hasOwnProperty,Wv=Bc.toString,Cn=Vc?Vc.toStringTag:void 0;function qv(e){var t=Gv.call(e,Cn),n=e[Cn];try{e[Cn]=void 0;var r=!0}catch{}var o=Wv.call(e);return r&&(t?e[Cn]=n:delete e[Cn]),o}var Kv=qv,Xv=Object.prototype,Yv=Xv.toString;function Jv(e){return Yv.call(e)}var Zv=Jv,zc=Lc,Qv=Kv,ey=Zv,ty="[object Null]",ny="[object Undefined]",Hc=zc?zc.toStringTag:void 0;function ry(e){return e==null?e===void 0?ny:ty:Hc&&Hc in Object(e)?Qv(e):ey(e)}var oy=ry;function sy(e){return e!=null&&typeof e=="object"}var iy=sy,ay=oy,ly=iy,cy="[object Symbol]";function uy(e){return typeof e=="symbol"||ly(e)&&ay(e)==cy}var dy=uy,fy=Hv,Uc=$c,py=dy,jc=NaN,gy=/^[-+]0x[0-9a-f]+$/i,hy=/^0b[01]+$/i,my=/^0o[0-7]+$/i,vy=parseInt;function yy(e){if(typeof e=="number")return e;if(py(e))return jc;if(Uc(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Uc(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=fy(e);var n=hy.test(e);return n||my.test(e)?vy(e.slice(2),n?2:8):gy.test(e)?jc:+e}var wy=yy,by=$c,Ss=kv,Gc=wy,xy="Expected a function",Cy=Math.max,Sy=Math.min;function Ey(e,t,n){var r,o,s,i,a,u,l=0,f=!1,g=!1,m=!0;if(typeof e!="function")throw new TypeError(xy);t=Gc(t)||0,by(n)&&(f=!!n.leading,g="maxWait"in n,s=g?Cy(Gc(n.maxWait)||0,t):s,m="trailing"in n?!!n.trailing:m);function p(S){var E=r,R=o;return r=o=void 0,l=S,i=e.apply(R,E),i}function v(S){return l=S,a=setTimeout(w,t),f?p(S):i}function h(S){var E=S-u,R=S-l,U=t-E;return g?Sy(U,s-R):U}function y(S){var E=S-u,R=S-l;return u===void 0||E>=t||E<0||g&&R>=s}function w(){var S=Ss();if(y(S))return x(S);a=setTimeout(w,h(S))}function x(S){return a=void 0,m&&r?p(S):(r=o=void 0,i)}function N(){a!==void 0&&clearTimeout(a),l=0,r=u=o=a=void 0}function P(){return a===void 0?i:x(Ss())}function b(){var S=Ss(),E=y(S);if(r=arguments,o=this,u=S,E){if(a===void 0)return v(u);if(g)return clearTimeout(a),a=setTimeout(w,t),p(u)}return a===void 0&&(a=setTimeout(w,t)),i}return b.cancel=N,b.flush=P,b}var Ny=Ey;const Py=Pv(Ny);function Ty(){var e=(typeof global>"u"?"undefined":typeof global)=="object"&&global&&global.Object===Object&&global,t=typeof self=="object"&&self&&self.Object===Object&&self;return e||t}Ty()||(global.Date=Date);function Ay(e,t){var n;Rc&&(Mc(e)||console.error("useDebounceFn expected parameter is a function, got ".concat(typeof e)));var r=kc(e),o=(n=t==null?void 0:t.wait)!==null&&n!==void 0?n:1e3,s=O.useMemo(function(){return Py(function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return r.current.apply(r,Ka([],qa(i),!1))},o,t)},[]);return Nv(function(){s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}}function _y(e,t,n){var r=qa(O.useState({}),2),o=r[0],s=r[1],i=Ay(function(){s({})},n).run;O.useEffect(function(){return i()},t),Ev(e,[o])}const Fy=O.forwardRef(({onChange:e},t)=>{const n=O.useRef(null),[r,o]=O.useState("");return O.useImperativeHandle(t,()=>({setValue:s=>{var i;o(s),(i=n.current)==null||i.focus()}})),_y(()=>{e==null||e(r)},[r],{wait:300}),c.jsxs(c.Fragment,{children:[c.jsx(Et,{ref:n,type:"text",placeholder:"Search files...",value:r,onChange:s=>o(s.target.value),className:"pr-8"}),r&&c.jsx("button",{onClick:()=>{var s;o(""),(s=n.current)==null||s.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700",children:c.jsx(Cv,{className:"h-5 w-5"})})]})}),et={current:!1},Oy=(e,t,n)=>{const r=[],o=s=>{(e[s]||[]).forEach(a=>{a.name.toLowerCase().includes(t.toLowerCase())&&r.push(a),a.isFolder&&a.key.startsWith(n)&&o(a.key)})};return o(n),r},Sr=(e,t)=>{const n=[],r=o=>{(e[o]||[]).forEach(i=>{n.push(i.key),i.isFolder&&r(i.key)})};return r(t),n},Dy=(e,t)=>{const n=[];return(e[t]||[]).forEach(o=>{n.push(o.key),o.isFolder&&n.push(...Sr(e,o.key))}),n},My=(e,t)=>{const[n,r]=O.useState({}),[o,s]=O.useState(!1),[i,a]=O.useState(null),u=async()=>{s(!0);try{const l=!et.current;et.current&&(et.current=!1);const f=await se.get(`${e}/api/files`,{params:{cache:l,prefix:t}});r(f.data),a(null)}catch(l){a(l instanceof Error?l:new Error("Failed to fetch files"))}finally{s(!1)}};return O.useEffect(()=>{u()},[]),{data:n,isLoading:o,error:i,refetch:u}},Er=e=>{var r,o,s;const t=((s=(o=(r=e==null?void 0:e.name)==null?void 0:r.split("."))==null?void 0:o.pop())==null?void 0:s.toLowerCase())??"";return["txt","md","json","js","ts","jsx","tsx","css","html","xml","yaml","yml"].includes(t||"")},Ry=O.memo(({homeLabel:e="Document Store",apiBaseUrl:t="http://localhost:3000",rootPrefix:n="",asSelector:r=!1,onSelected:o=s=>console.log("selected:",s)})=>{const[s,i]=O.useState(""),[a,u]=O.useState(new Set),[l,f]=O.useState(n),[g,m]=O.useState(!1),[p,v]=O.useState(""),[h,y]=O.useState(!1),[w,x]=O.useState(null),[N,P]=O.useState(!1),[b,S]=O.useState(!1),[E,R]=O.useState(!1),[U,H]=O.useState(null),Z=O.useRef(null),{toast:F}=Cs(),[$,D]=O.useState(null),[G,B]=O.useState(""),[q,K]=O.useState(!1),[te,ae]=O.useState(new Set),[re,Ae]=O.useState(""),[qe,at]=O.useState(!1),[Ht,_t]=O.useState(!1),[Ft,Ke]=O.useState("rename"),{data:we={},isLoading:Ot,error:Ut,refetch:Le}=My(t,n),Xe=O.useMemo(()=>we[l]||[],[we,l]),ke=O.useMemo(()=>s?Oy(we,s,l):Xe,[Xe,s,l,we]),Dt=O.useMemo(()=>{const M={};return ke.forEach((I,j)=>{a.has(I.key)&&(M[j]=!0)}),M},[a,ke]),jr=M=>{const I=Sr(we,M);if(I.length===0)return a.has(M)?"all":"none";const j=I.filter(oe=>a.has(oe)).length;return j===0?"none":j===I.length?"all":"partial"},jt=M=>{f(M)},C=async(M,I)=>{y(!0);try{const j=`${I}${M}/`;if((await se.post(`${t}/api/create-folder`,{prefix:j})).status!==200){F({title:"Error",description:"Failed to create folder",variant:"destructive"});return}et.current=!0,await Le(),F({title:"Folder Created",description:`Successfully created folder "${M}"`}),v(""),m(!1)}catch(j){console.error("Error creating folder:",j),F({title:"Error",description:"Failed to create folder",variant:"destructive"})}finally{y(!1)}},T=async(M,I,j)=>{H(j);try{const oe=new FormData;oe.append("prefix",I),Array.from(M).forEach(fe=>{fe instanceof File&&oe.append("files",fe)}),(await se.post(`${t}/api/upload`,oe,{headers:{"Content-Type":"multipart/form-data"}})).status===200&&(et.current=!0,await Le(),F({title:"Files Uploaded",description:`Successfully uploaded ${M.length} files`}))}catch(oe){console.error("Error uploading files:",oe),F({title:"Error",description:"Failed to upload files",variant:"destructive"})}finally{H(null)}},_=async M=>{P(!0);try{await se.delete(`${t}/api/files`,{data:{paths:[M.key]}}),et.current=!0,await Le(),F({title:"File Deleted",description:`Successfully deleted "${M.name}"`}),x(null)}catch(I){console.error("Error deleting file:",I),F({title:"Error",description:"Failed to delete file",variant:"destructive"})}finally{P(!1)}},V=M=>{const I=new Set(a),j=typeof M=="function"?M(Dt):M;new Set(Object.keys(Dt).map(Number)).forEach(ie=>{const fe=ke[ie];fe&&(j[ie]||(I.delete(fe.key),fe.isFolder&&Sr(we,fe.key).forEach(_e=>I.delete(_e))))}),Object.entries(j).forEach(([ie,fe])=>{const _e=parseInt(ie),ht=ke[_e];ht&&fe&&(I.add(ht.key),ht.isFolder&&Sr(we,ht.key).forEach(oi=>I.add(oi)))}),u(I)},L=async()=>{S(!0);try{const M=Array.from(a).map(I=>{var j;for(const oe in we){const ie=(j=we[oe])==null?void 0:j.find(fe=>fe.key===I);if(ie)return ie}return null}).filter(I=>I!==null);await se.delete(`${t}/api/files`,{data:{paths:Array.from(a)}}),et.current=!0,await Le(),F({title:"Files Deleted",description:`Successfully deleted ${M.length} items`}),R(!1),u(new Set)}catch(M){console.error("Error deleting files:",M),F({title:"Error",description:"Failed to delete selected files",variant:"destructive"})}finally{S(!1)}},k=async(M,I)=>{K(!0);try{const j=M.key;let oe;M.isFolder?oe=j.split("/").slice(0,-2).join("/")+"/":oe=j.substring(0,j.lastIndexOf("/")+1);const ie=oe+I+(M.isFolder?"/":"");await se.post(`${t}/api/rename`,{oldPath:j,newPath:ie}),et.current=!0,await Le(),F({title:"Item Renamed",description:`Successfully renamed "${M.name}" to "${I}"`}),D(null),B("")}catch(j){console.error("Error renaming item:",j),F({title:"Error",description:"Failed to rename item",variant:"destructive"})}finally{K(!1)}},W=async M=>{ae(I=>new Set([...I,...M]));try{const I=await se.post(`${t}/api/download`,{paths:M},{responseType:"blob"}),j=window.URL.createObjectURL(I.data),oe=document.createElement("a");oe.href=j;const ie=I.headers["Content-Disposition"]||I.headers["content-disposition"],fe=ie==null?void 0:ie.match(/filename="(.+)"/),_e=fe?decodeURIComponent(fe[1]):"download.zip";oe.setAttribute("download",_e),document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),window.URL.revokeObjectURL(j),F({title:"Download Started",description:`Your download has started for ${M.length} item${M.length>1?"s":""}`})}catch(I){console.error("Error downloading files:",I),F({title:"Error",description:"Failed to download files",variant:"destructive"})}finally{ae(I=>{const j=new Set(I);return M.forEach(oe=>j.delete(oe)),j})}},ne=l?l.replace(n,"").split("/").filter(Boolean):[],me=()=>Array.from(a).map(M=>{var I;for(const j in we){const oe=(I=we[j])==null?void 0:I.find(ie=>ie.key===M);if(oe)return oe}return null}).filter(M=>M!==null),ge=O.useMemo(()=>{const M=[{id:"select",header:()=>{const I=Dy(we,l),j=I.length>0&&I.every(ie=>a.has(ie)),oe=I.some(ie=>a.has(ie));return c.jsx(Mo,{checked:j?!0:oe?"indeterminate":!1,onCheckedChange:ie=>{if(ie){const fe=ke.reduce((_e,ht,oi)=>(_e[oi]=!0,_e),{});V(fe)}else V({})},"aria-label":"Select all"})},cell:({row:I})=>{const j=I.original,ie=j.isFolder?jr(j.key):a.has(j.key)?"all":"none";return c.jsx("div",{className:"flex items-center",children:c.jsx(Mo,{checked:ie==="partial"?"indeterminate":ie==="all",onCheckedChange:fe=>{const _e={...Dt};fe?_e[I.index]=!0:delete _e[I.index],V(_e)},"aria-label":"Select row"})})},enableSorting:!1},{id:"fileName",header:"File Name",accessorKey:"name",cell:({row:I})=>{const j=I.original,oe=j.key.substring(0,j.key.lastIndexOf("/"))||"/",ie=s.trim()!==""&&oe!==l,fe=oe.split("/").filter(Boolean);return c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("div",{className:`flex items-center gap-2 ${j.isFolder?"cursor-pointer hover:text-blue-600":""}`,onClick:()=>{j.isFolder&&jt(j.key)},children:[j.isFolder?c.jsx(Wr,{className:"h-5 w-5 text-blue-500"}):null,j.name]}),ie&&c.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[c.jsx(Wr,{className:"h-4 w-4 text-gray-500 my-auto"}),c.jsxs("span",{className:"flex items-center ml-1",children:[c.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{jt("")},children:"/"}),fe.map((_e,ht)=>c.jsxs("span",{className:"flex items-center",children:[c.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{jt(fe.slice(0,ht+1).join("/")+"/")},children:_e}),ht<fe.length-1&&c.jsx("span",{children:"/"})]},ht))]})]})]})}}];return r||M.push({id:"size",header:"Size",accessorKey:"size",cell:({getValue:I,row:j})=>{const oe=I();return c.jsx("span",{children:j.original.isFolder?"-":fg(oe)})}},{id:"lastModified",header:"Last Modified",accessorKey:"lastModified",cell:({row:I})=>{const j=I.original.lastModified;return c.jsx("span",{children:j.toLocaleString()})}},{id:"actions",header:"Actions",accessorKey:"key",cell:({row:I})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>W([I.original.key]),className:"h-8 w-8 p-0",disabled:te.has(I.original.key),children:te.has(I.original.key)?c.jsx(Ne,{className:"h-4 w-4 animate-spin"}):c.jsx(ii,{className:"h-4 w-4"})}),c.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>{D(I.original),B(I.original.name)},className:"h-8 w-8 p-0",children:c.jsx(md,{className:"h-4 w-4"})}),c.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>x(I.original),className:"h-8 w-8 p-0",children:c.jsx(ai,{className:"h-4 w-4"})})]})}),M},[a,ke,Dt,te,r]),Ye=bi({data:ke,columns:ge,state:{rowSelection:Dt},enableRowSelection:!0,onRowSelectionChange:V,getCoreRowModel:wi()}),ri=async M=>{if(Er(M)){at(!0);try{const I=await se.get(`${t}/api/read-text`,{params:{path:M.key}});Ae(I.data.content)}catch(I){console.error("Error loading file content:",I),F({title:"Error",description:"Failed to load file content",variant:"destructive"})}finally{at(!1)}}},Rn=async(M,I)=>{_t(!0);try{await se.post(`${t}/api/modify-text`,{path:M.key,content:I}),F({title:"File Saved",description:"File content has been updated successfully"}),et.current=!0,await Le(),D(null),Ae(""),Ke("rename")}catch(j){console.error("Error saving file content:",j),F({title:"Error",description:"Failed to save file content",variant:"destructive"})}finally{_t(!1)}};return O.useEffect(()=>{$&&Er($)&&(ri($),Ke("rename"))},[$]),c.jsxs("div",{className:"space-y-4 s3-explr-container",children:[c.jsx(wa,{className:"s3-explr-breadcrumb",children:c.jsxs(ba,{className:"s3-explr-breadcrumb-list",children:[c.jsx(Ao,{className:"s3-explr-breadcrumb-item",children:c.jsx(_o,{onClick:()=>f(n),className:"flex items-center gap-1 cursor-pointer s3-explr-breadcrumb-home",children:e})}),ne.map((M,I)=>c.jsxs(c.Fragment,{children:[c.jsx(xa,{className:"s3-explr-breadcrumb-separator"},`sep-${I}`),c.jsx(Ao,{className:"s3-explr-breadcrumb-item",children:c.jsx(_o,{onClick:()=>jt(n+ne.slice(0,I+1).join("/")+"/"),className:"cursor-pointer s3-explr-breadcrumb-link",children:M})},`item-${M}`)]}))]})}),c.jsxs("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:[c.jsx("div",{className:"relative max-w-sm w-full s3-explr-search-container",children:c.jsx(Fy,{ref:Z,onChange:M=>i(M)})}),c.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>{et.current=!0,Le()},disabled:Ot,className:"flex items-center gap-2 s3-explr-refresh-btn",children:[c.jsx(cd,{className:`h-4 w-4 s3-explr-refresh-icon ${Ot?"animate-spin":""}`}),"Refresh"]}),!r&&c.jsxs(c.Fragment,{children:[a.size>0&&c.jsxs(c.Fragment,{children:[c.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>W(Array.from(a)),disabled:Array.from(a).some(M=>te.has(M)),className:"flex items-center gap-2 s3-explr-download-selected-btn",children:[Array.from(a).some(M=>te.has(M))?c.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}):c.jsx(ii,{className:"h-4 w-4 s3-explr-download-icon"}),"Download Selected (",a.size,")"]}),c.jsxs(rn,{open:E,onOpenChange:R,children:[c.jsx(lr,{asChild:!0,children:c.jsxs(ue,{variant:"destructive",size:"sm",className:"flex items-center gap-2 s3-explr-bulk-delete-btn",children:[c.jsx(ai,{className:"h-4 w-4 s3-explr-trash-icon"}),"Remove Selected (",a.size,")"]})}),c.jsxs(It,{className:"s3-explr-dialog-content",children:[c.jsxs(Lt,{className:"s3-explr-dialog-header",children:[c.jsx(Vt,{className:"s3-explr-dialog-title",children:"Confirm Bulk Deletion"}),c.jsxs(Yo,{className:"s3-explr-dialog-description",children:["Are you sure you want to delete ",a.size," selected items? This action cannot be undone."]})]}),c.jsxs(cr,{className:"s3-explr-dialog-footer",children:[c.jsx(ue,{variant:"outline",onClick:()=>R(!1),className:"s3-explr-cancel-btn",children:"Cancel"}),c.jsx(ue,{variant:"destructive",onClick:L,disabled:b,className:"s3-explr-confirm-delete-btn",children:b?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Deleting..."]}):"Delete Selected"})]})]})]})]}),c.jsxs(rn,{open:g,onOpenChange:m,children:[c.jsx(lr,{asChild:!0,children:c.jsxs(ue,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-new-folder-btn",children:[c.jsx(pd,{className:"h-4 w-4 s3-explr-folder-plus-icon"}),"New Folder"]})}),c.jsxs(It,{className:"s3-explr-dialog-content",children:[c.jsx(Lt,{className:"s3-explr-dialog-header",children:c.jsx(Vt,{className:"s3-explr-dialog-title",children:"Create New Folder"})}),c.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[c.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[c.jsx(bn,{htmlFor:"name",className:"s3-explr-label",children:"Folder Name"}),c.jsx(Et,{disabled:h,id:"name",value:p,onChange:M=>v(M.target.value),placeholder:"Enter folder name",className:"s3-explr-input"})]}),c.jsxs(ue,{onClick:()=>{p.trim()&&C(p,l)},disabled:h,className:"s3-explr-create-btn",children:[h&&c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),h?"Creating...":"Create"]})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2 s3-explr-upload-group",children:[c.jsx(ue,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-files-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.onchange=I=>{const j=I.target.files;j&&T(j,l,"files")},M.click()},disabled:U!==null,children:U==="files"?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Uploading..."]}):c.jsxs(c.Fragment,{children:[c.jsx(dd,{className:"h-4 w-4 s3-explr-upload-icon"}),"Upload Files"]})}),c.jsx(ue,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-folder-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.webkitdirectory=!0,M.onchange=I=>{const j=I.target.files;j&&T(j,l,"folder")},M.click()},disabled:U!==null,children:U==="folder"?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Uploading..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Wr,{className:"h-4 w-4 s3-explr-folder-icon"}),"Upload Folder"]})})]}),c.jsx(rn,{open:!!w,onOpenChange:M=>!M&&x(null),children:c.jsxs(It,{className:"s3-explr-dialog-content",children:[c.jsxs(Lt,{className:"s3-explr-dialog-header",children:[c.jsx(Vt,{className:"s3-explr-dialog-title",children:"Confirm Deletion"}),c.jsxs(Yo,{className:"s3-explr-dialog-description",children:["Are you sure you want to delete ",w==null?void 0:w.name,"? This action cannot be undone."]})]}),c.jsxs(cr,{className:"s3-explr-dialog-footer",children:[c.jsx(ue,{variant:"outline",onClick:()=>x(null),className:"s3-explr-cancel-btn",children:"Cancel"}),c.jsx(ue,{variant:"destructive",onClick:()=>_(w),disabled:N,className:"s3-explr-confirm-delete-btn",children:N?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Deleting..."]}):"Delete"})]})]})}),c.jsx(rn,{open:!!$,onOpenChange:M=>{M||(D(null),B(""),Ae(""),Ke("rename"))},children:c.jsxs(It,{className:"s3-explr-dialog-content max-w-2xl",children:[c.jsx(Lt,{className:"s3-explr-dialog-header",children:c.jsx(Vt,{className:"s3-explr-dialog-title",children:$!=null&&$.isFolder?"Rename Folder":Er($)?"Manage File":"Rename File"})}),$&&!$.isFolder&&Er($)?c.jsxs(Bm,{value:Ft,onValueChange:M=>Ke(M),children:[c.jsxs(sc,{className:"grid w-full grid-cols-2",children:[c.jsx(ls,{value:"rename",children:"Rename"}),c.jsx(ls,{value:"edit",children:"Edit Content"})]}),c.jsx(cs,{value:"rename",children:c.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:c.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[c.jsx(bn,{htmlFor:"newName",className:"s3-explr-label",children:"New Name"}),c.jsx(Et,{id:"newName",value:G,onChange:M=>B(M.target.value),placeholder:"Enter new name",disabled:q,className:"s3-explr-input"})]})})}),c.jsx(cs,{value:"edit",children:c.jsx("div",{className:"space-y-4 py-4",children:qe?c.jsx("div",{className:"flex items-center justify-center py-4",children:c.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):c.jsxs("div",{className:"space-y-2",children:[c.jsx(bn,{htmlFor:"content",className:"s3-explr-label",children:"File Content"}),c.jsx(mr,{id:"content",value:re,onChange:M=>Ae(M.target.value),placeholder:"Enter file content",className:"min-h-[200px] font-mono",disabled:Ht})]})})})]}):c.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:c.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[c.jsx(bn,{htmlFor:"newName",className:"s3-explr-label",children:"New Name"}),c.jsx(Et,{id:"newName",value:G,onChange:M=>B(M.target.value),placeholder:"Enter new name",disabled:q,className:"s3-explr-input"})]})}),c.jsxs(cr,{className:"s3-explr-dialog-footer",children:[c.jsx(ue,{variant:"outline",onClick:()=>{D(null),B(""),Ae("")},className:"s3-explr-cancel-btn",children:"Cancel"}),Ft==="edit"?c.jsx(ue,{onClick:()=>$&&Rn($,re),disabled:Ht||qe,className:"s3-explr-save-btn",children:Ht?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Saving..."]}):"Save Changes"}):c.jsx(ue,{onClick:()=>{G.trim()&&$&&k($,G.trim())},disabled:q||!G.trim()||G.trim()===($==null?void 0:$.name),className:"s3-explr-rename-btn",children:q?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Renaming..."]}):"Rename"})]})]})})]})]}),Ut&&c.jsx("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative s3-explr-error",children:"An error occurred while fetching files"}),c.jsx("div",{className:"rounded-md border s3-explr-table-container",children:c.jsxs(ur,{className:"s3-explr-table",children:[c.jsx(dr,{className:"s3-explr-table-header",children:Ye.getHeaderGroups().map(M=>c.jsx(Ue,{className:"hover:bg-transparent s3-explr-header-row",children:M.headers.map(I=>c.jsx(Qe,{className:"s3-explr-header-cell",children:I.isPlaceholder?null:Bn(I.column.columnDef.header,I.getContext())},I.id))},M.id))}),c.jsx(fr,{className:"s3-explr-table-body",children:Ye.getRowModel().rows.length===0?c.jsx(Ue,{className:"s3-explr-empty-row",children:c.jsx(Pe,{colSpan:ge.length,className:"h-24 text-center s3-explr-empty-cell",children:s?c.jsxs("div",{className:"text-gray-500 s3-explr-no-results",children:['No files or folders found matching "',s,'"']}):c.jsx("div",{className:"text-gray-500 s3-explr-empty-message",children:Ot?"Retrieving folder contents... Please wait":"This folder contains no files or subdirectories"})})}):Ye.getRowModel().rows.map(M=>c.jsx(Ue,{className:"h-12 s3-explr-row",children:M.getVisibleCells().map(I=>c.jsx(Pe,{className:"align-middle s3-explr-cell",children:Bn(I.column.columnDef.cell,I.getContext())},I.id))},M.id))})]})}),r&&o&&c.jsxs("div",{className:"flex justify-between items-center mt-4 s3-explr-selector-footer",children:[c.jsxs("div",{className:"text-sm text-gray-500 s3-explr-selection-count",children:[a.size," ",a.size===1?"file":"files"," selected"]}),c.jsx(ue,{variant:"default",onClick:()=>o(me()),disabled:a.size===0,className:"s3-explr-ok-btn",children:"OK"})]}),!r&&c.jsx(Dc,{})]})});var Sn=e=>e.type==="checkbox",Bt=e=>e instanceof Date,Se=e=>e==null;const Wc=e=>typeof e=="object";var pe=e=>!Se(e)&&!Array.isArray(e)&&Wc(e)&&!Bt(e),ky=e=>pe(e)&&e.target?Sn(e.target)?e.target.checked:e.target.value:e,$y=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Iy=(e,t)=>e.has($y(t)),Ly=e=>{const t=e.constructor&&e.constructor.prototype;return pe(t)&&t.hasOwnProperty("isPrototypeOf")},Es=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ie(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Es&&(e instanceof Blob||r))&&(n||pe(e)))if(t=n?[]:{},!n&&!Ly(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Ie(e[o]));else return e;return t}var Nr=e=>Array.isArray(e)?e.filter(Boolean):[],de=e=>e===void 0,z=(e,t,n)=>{if(!t||!pe(e))return n;const r=Nr(t.split(/[,[\].]+?/)).reduce((o,s)=>Se(o)?o:o[s],e);return de(r)||r===e?de(e[t])?n:e[t]:r},tt=e=>typeof e=="boolean",Ns=e=>/^\w*$/.test(e),qc=e=>Nr(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(e,t,n)=>{let r=-1;const o=Ns(t)?[t]:qc(t),s=o.length,i=s-1;for(;++r<s;){const a=o[r];let u=n;if(r!==i){const l=e[a];u=pe(l)||Array.isArray(l)?l:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=u,e=e[a]}return e};const Kc={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},je={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ut={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};O.createContext(null);var Vy=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==je.all&&(t._proxyFormState[i]=!r||je.all),e[i]}});return o},Te=e=>pe(e)&&!Object.keys(e).length,By=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return Te(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===je.all)},Pr=e=>Array.isArray(e)?e:[e];function zy(e){const t=O.useRef(e);t.current=e,O.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var nt=e=>typeof e=="string",Hy=(e,t,n,r,o)=>nt(e)?(r&&t.watch.add(e),z(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),z(n,s))):(r&&(t.watchAll=!0),n),Uy=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Xc=e=>({isOnSubmit:!e||e===je.onSubmit,isOnBlur:e===je.onBlur,isOnChange:e===je.onChange,isOnAll:e===je.all,isOnTouch:e===je.onTouched}),Yc=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const En=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=z(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)return!0;if(i.ref&&t(i.ref,i.name)&&!r)return!0;if(En(a,t))break}else if(pe(a)&&En(a,t))break}}};var jy=(e,t,n)=>{const r=Pr(z(e,n));return ce(r,"root",t[n]),ce(e,n,r),e},Ps=e=>e.type==="file",rt=e=>typeof e=="function",Tr=e=>{if(!Es)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ar=e=>nt(e),Ts=e=>e.type==="radio",_r=e=>e instanceof RegExp;const Jc={value:!1,isValid:!1},Zc={value:!0,isValid:!0};var Qc=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!de(e[0].attributes.value)?de(e[0].value)||e[0].value===""?Zc:{value:e[0].value,isValid:!0}:Zc:Jc}return Jc};const eu={isValid:!1,value:null};var tu=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,eu):eu;function nu(e,t,n="validate"){if(Ar(e)||Array.isArray(e)&&e.every(Ar)||tt(e)&&!e)return{type:n,message:Ar(e)?e:"",ref:t}}var sn=e=>pe(e)&&!_r(e)?e:{value:e,message:""},ru=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:u,minLength:l,min:f,max:g,pattern:m,validate:p,name:v,valueAsNumber:h,mount:y,disabled:w}=e._f,x=z(t,v);if(!y||w)return{};const N=i?i[0]:s,P=F=>{r&&N.reportValidity&&(N.setCustomValidity(tt(F)?"":F||""),N.reportValidity())},b={},S=Ts(s),E=Sn(s),R=S||E,U=(h||Ps(s))&&de(s.value)&&de(x)||Tr(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,H=Uy.bind(null,v,n,b),Z=(F,$,D,G=ut.maxLength,B=ut.minLength)=>{const q=F?$:D;b[v]={type:F?G:B,message:q,ref:s,...H(F?G:B,q)}};if(o?!Array.isArray(x)||!x.length:a&&(!R&&(U||Se(x))||tt(x)&&!x||E&&!Qc(i).isValid||S&&!tu(i).isValid)){const{value:F,message:$}=Ar(a)?{value:!!a,message:a}:sn(a);if(F&&(b[v]={type:ut.required,message:$,ref:N,...H(ut.required,$)},!n))return P($),b}if(!U&&(!Se(f)||!Se(g))){let F,$;const D=sn(g),G=sn(f);if(!Se(x)&&!isNaN(x)){const B=s.valueAsNumber||x&&+x;Se(D.value)||(F=B>D.value),Se(G.value)||($=B<G.value)}else{const B=s.valueAsDate||new Date(x),q=ae=>new Date(new Date().toDateString()+" "+ae),K=s.type=="time",te=s.type=="week";nt(D.value)&&x&&(F=K?q(x)>q(D.value):te?x>D.value:B>new Date(D.value)),nt(G.value)&&x&&($=K?q(x)<q(G.value):te?x<G.value:B<new Date(G.value))}if((F||$)&&(Z(!!F,D.message,G.message,ut.max,ut.min),!n))return P(b[v].message),b}if((u||l)&&!U&&(nt(x)||o&&Array.isArray(x))){const F=sn(u),$=sn(l),D=!Se(F.value)&&x.length>+F.value,G=!Se($.value)&&x.length<+$.value;if((D||G)&&(Z(D,F.message,$.message),!n))return P(b[v].message),b}if(m&&!U&&nt(x)){const{value:F,message:$}=sn(m);if(_r(F)&&!x.match(F)&&(b[v]={type:ut.pattern,message:$,ref:s,...H(ut.pattern,$)},!n))return P($),b}if(p){if(rt(p)){const F=await p(x,t),$=nu(F,N);if($&&(b[v]={...$,...H(ut.validate,$.message)},!n))return P($.message),b}else if(pe(p)){let F={};for(const $ in p){if(!Te(F)&&!n)break;const D=nu(await p[$](x,t),N,$);D&&(F={...D,...H($,D.message)},P(D.message),n&&(b[v]=F))}if(!Te(F)&&(b[v]={ref:N,...F},!n))return b}}return P(!0),b};function Gy(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=de(e)?r++:e[t[r++]];return e}function Wy(e){for(const t in e)if(e.hasOwnProperty(t)&&!de(e[t]))return!1;return!0}function ye(e,t){const n=Array.isArray(t)?t:Ns(t)?[t]:qc(t),r=n.length===1?e:Gy(e,n),o=n.length-1,s=n[o];return r&&delete r[s],o!==0&&(pe(r)&&Te(r)||Array.isArray(r)&&Wy(r))&&ye(e,n.slice(0,-1)),e}var As=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},_s=e=>Se(e)||!Wc(e);function Nt(e,t){if(_s(e)||_s(t))return e===t;if(Bt(e)&&Bt(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(Bt(s)&&Bt(i)||pe(s)&&pe(i)||Array.isArray(s)&&Array.isArray(i)?!Nt(s,i):s!==i)return!1}}return!0}var ou=e=>e.type==="select-multiple",qy=e=>Ts(e)||Sn(e),Fs=e=>Tr(e)&&e.isConnected,su=e=>{for(const t in e)if(rt(e[t]))return!0;return!1};function Fr(e,t={}){const n=Array.isArray(e);if(pe(e)||n)for(const r in e)Array.isArray(e[r])||pe(e[r])&&!su(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Fr(e[r],t[r])):Se(e[r])||(t[r]=!0);return t}function iu(e,t,n){const r=Array.isArray(e);if(pe(e)||r)for(const o in e)Array.isArray(e[o])||pe(e[o])&&!su(e[o])?de(t)||_s(n[o])?n[o]=Array.isArray(e[o])?Fr(e[o],[]):{...Fr(e[o])}:iu(e[o],Se(t)?{}:t[o],n[o]):n[o]=!Nt(e[o],t[o]);return n}var Nn=(e,t)=>iu(e,t,Fr(t)),au=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>de(e)?e:t?e===""?NaN:e&&+e:n&&nt(e)?new Date(e):r?r(e):e;function Os(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Ps(t)?t.files:Ts(t)?tu(e.refs).value:ou(t)?[...t.selectedOptions].map(({value:n})=>n):Sn(t)?Qc(e.refs).value:au(de(t.value)?e.ref.value:t.value,e)}var Ky=(e,t,n,r)=>{const o={};for(const s of e){const i=z(t,s);i&&ce(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},Pn=e=>de(e)?e:_r(e)?e.source:pe(e)?_r(e.value)?e.value.source:e.value:e;const lu="AsyncFunction";var Xy=e=>!!e&&!!e.validate&&!!(rt(e.validate)&&e.validate.constructor.name===lu||pe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===lu)),Yy=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function cu(e,t,n){const r=z(e,n);if(r||Ns(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=z(t,s),a=z(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var Jy=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,Zy=(e,t)=>!Nr(z(e,t)).length&&ye(e,t);const Qy={mode:je.onSubmit,reValidateMode:je.onChange,shouldFocusError:!0};function ew(e={}){let t={...Qy,...e},n={submitCount:0,isDirty:!1,isLoading:rt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=pe(t.defaultValues)||pe(t.values)?Ie(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Ie(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,l=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={values:As(),array:As(),state:As()},m=Xc(t.mode),p=Xc(t.reValidateMode),v=t.criteriaMode===je.all,h=C=>T=>{clearTimeout(l),l=setTimeout(C,T)},y=async C=>{if(!t.disabled&&(f.isValid||C)){const T=t.resolver?Te((await R()).errors):await H(r,!0);T!==n.isValid&&g.state.next({isValid:T})}},w=(C,T)=>{!t.disabled&&(f.isValidating||f.validatingFields)&&((C||Array.from(a.mount)).forEach(_=>{_&&(T?ce(n.validatingFields,_,T):ye(n.validatingFields,_))}),g.state.next({validatingFields:n.validatingFields,isValidating:!Te(n.validatingFields)}))},x=(C,T=[],_,V,L=!0,k=!0)=>{if(V&&_&&!t.disabled){if(i.action=!0,k&&Array.isArray(z(r,C))){const W=_(z(r,C),V.argA,V.argB);L&&ce(r,C,W)}if(k&&Array.isArray(z(n.errors,C))){const W=_(z(n.errors,C),V.argA,V.argB);L&&ce(n.errors,C,W),Zy(n.errors,C)}if(f.touchedFields&&k&&Array.isArray(z(n.touchedFields,C))){const W=_(z(n.touchedFields,C),V.argA,V.argB);L&&ce(n.touchedFields,C,W)}f.dirtyFields&&(n.dirtyFields=Nn(o,s)),g.state.next({name:C,isDirty:F(C,T),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ce(s,C,T)},N=(C,T)=>{ce(n.errors,C,T),g.state.next({errors:n.errors})},P=C=>{n.errors=C,g.state.next({errors:n.errors,isValid:!1})},b=(C,T,_,V)=>{const L=z(r,C);if(L){const k=z(s,C,de(_)?z(o,C):_);de(k)||V&&V.defaultChecked||T?ce(s,C,T?k:Os(L._f)):G(C,k),i.mount&&y()}},S=(C,T,_,V,L)=>{let k=!1,W=!1;const ne={name:C};if(!t.disabled){const me=!!(z(r,C)&&z(r,C)._f&&z(r,C)._f.disabled);if(!_||V){f.isDirty&&(W=n.isDirty,n.isDirty=ne.isDirty=F(),k=W!==ne.isDirty);const ge=me||Nt(z(o,C),T);W=!!(!me&&z(n.dirtyFields,C)),ge||me?ye(n.dirtyFields,C):ce(n.dirtyFields,C,!0),ne.dirtyFields=n.dirtyFields,k=k||f.dirtyFields&&W!==!ge}if(_){const ge=z(n.touchedFields,C);ge||(ce(n.touchedFields,C,_),ne.touchedFields=n.touchedFields,k=k||f.touchedFields&&ge!==_)}k&&L&&g.state.next(ne)}return k?ne:{}},E=(C,T,_,V)=>{const L=z(n.errors,C),k=f.isValid&&tt(T)&&n.isValid!==T;if(t.delayError&&_?(u=h(()=>N(C,_)),u(t.delayError)):(clearTimeout(l),u=null,_?ce(n.errors,C,_):ye(n.errors,C)),(_?!Nt(L,_):L)||!Te(V)||k){const W={...V,...k&&tt(T)?{isValid:T}:{},errors:n.errors,name:C};n={...n,...W},g.state.next(W)}},R=async C=>{w(C,!0);const T=await t.resolver(s,t.context,Ky(C||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return w(C),T},U=async C=>{const{errors:T}=await R(C);if(C)for(const _ of C){const V=z(T,_);V?ce(n.errors,_,V):ye(n.errors,_)}else n.errors=T;return T},H=async(C,T,_={valid:!0})=>{for(const V in C){const L=C[V];if(L){const{_f:k,...W}=L;if(k){const ne=a.array.has(k.name),me=L._f&&Xy(L._f);me&&f.validatingFields&&w([V],!0);const ge=await ru(L,s,v,t.shouldUseNativeValidation&&!T,ne);if(me&&f.validatingFields&&w([V]),ge[k.name]&&(_.valid=!1,T))break;!T&&(z(ge,k.name)?ne?jy(n.errors,ge,k.name):ce(n.errors,k.name,ge[k.name]):ye(n.errors,k.name))}!Te(W)&&await H(W,T,_)}}return _.valid},Z=()=>{for(const C of a.unMount){const T=z(r,C);T&&(T._f.refs?T._f.refs.every(_=>!Fs(_)):!Fs(T._f.ref))&&_t(C)}a.unMount=new Set},F=(C,T)=>!t.disabled&&(C&&T&&ce(s,C,T),!Nt(re(),o)),$=(C,T,_)=>Hy(C,a,{...i.mount?s:de(T)?o:nt(C)?{[C]:T}:T},_,T),D=C=>Nr(z(i.mount?s:o,C,t.shouldUnregister?z(o,C,[]):[])),G=(C,T,_={})=>{const V=z(r,C);let L=T;if(V){const k=V._f;k&&(!k.disabled&&ce(s,C,au(T,k)),L=Tr(k.ref)&&Se(T)?"":T,ou(k.ref)?[...k.ref.options].forEach(W=>W.selected=L.includes(W.value)):k.refs?Sn(k.ref)?k.refs.length>1?k.refs.forEach(W=>(!W.defaultChecked||!W.disabled)&&(W.checked=Array.isArray(L)?!!L.find(ne=>ne===W.value):L===W.value)):k.refs[0]&&(k.refs[0].checked=!!L):k.refs.forEach(W=>W.checked=W.value===L):Ps(k.ref)?k.ref.value="":(k.ref.value=L,k.ref.type||g.values.next({name:C,values:{...s}})))}(_.shouldDirty||_.shouldTouch)&&S(C,L,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&ae(C)},B=(C,T,_)=>{for(const V in T){const L=T[V],k=`${C}.${V}`,W=z(r,k);(a.array.has(C)||pe(L)||W&&!W._f)&&!Bt(L)?B(k,L,_):G(k,L,_)}},q=(C,T,_={})=>{const V=z(r,C),L=a.array.has(C),k=Ie(T);ce(s,C,k),L?(g.array.next({name:C,values:{...s}}),(f.isDirty||f.dirtyFields)&&_.shouldDirty&&g.state.next({name:C,dirtyFields:Nn(o,s),isDirty:F(C,k)})):V&&!V._f&&!Se(k)?B(C,k,_):G(C,k,_),Yc(C,a)&&g.state.next({...n}),g.values.next({name:i.mount?C:void 0,values:{...s}})},K=async C=>{i.mount=!0;const T=C.target;let _=T.name,V=!0;const L=z(r,_),k=()=>T.type?Os(L._f):ky(C),W=ne=>{V=Number.isNaN(ne)||Bt(ne)&&isNaN(ne.getTime())||Nt(ne,z(s,_,ne))};if(L){let ne,me;const ge=k(),Ye=C.type===Kc.BLUR||C.type===Kc.FOCUS_OUT,ri=!Yy(L._f)&&!t.resolver&&!z(n.errors,_)&&!L._f.deps||Jy(Ye,z(n.touchedFields,_),n.isSubmitted,p,m),Rn=Yc(_,a,Ye);ce(s,_,ge),Ye?(L._f.onBlur&&L._f.onBlur(C),u&&u(0)):L._f.onChange&&L._f.onChange(C);const M=S(_,ge,Ye,!1),I=!Te(M)||Rn;if(!Ye&&g.values.next({name:_,type:C.type,values:{...s}}),ri)return f.isValid&&(t.mode==="onBlur"?Ye&&y():y()),I&&g.state.next({name:_,...Rn?{}:M});if(!Ye&&Rn&&g.state.next({...n}),t.resolver){const{errors:j}=await R([_]);if(W(ge),V){const oe=cu(n.errors,r,_),ie=cu(j,r,oe.name||_);ne=ie.error,_=ie.name,me=Te(j)}}else w([_],!0),ne=(await ru(L,s,v,t.shouldUseNativeValidation))[_],w([_]),W(ge),V&&(ne?me=!1:f.isValid&&(me=await H(r,!0)));V&&(L._f.deps&&ae(L._f.deps),E(_,me,ne,M))}},te=(C,T)=>{if(z(n.errors,T)&&C.focus)return C.focus(),1},ae=async(C,T={})=>{let _,V;const L=Pr(C);if(t.resolver){const k=await U(de(C)?C:L);_=Te(k),V=C?!L.some(W=>z(k,W)):_}else C?(V=(await Promise.all(L.map(async k=>{const W=z(r,k);return await H(W&&W._f?{[k]:W}:W)}))).every(Boolean),!(!V&&!n.isValid)&&y()):V=_=await H(r);return g.state.next({...!nt(C)||f.isValid&&_!==n.isValid?{}:{name:C},...t.resolver||!C?{isValid:_}:{},errors:n.errors}),T.shouldFocus&&!V&&En(r,te,C?L:a.mount),V},re=C=>{const T={...i.mount?s:o};return de(C)?T:nt(C)?z(T,C):C.map(_=>z(T,_))},Ae=(C,T)=>({invalid:!!z((T||n).errors,C),isDirty:!!z((T||n).dirtyFields,C),error:z((T||n).errors,C),isValidating:!!z(n.validatingFields,C),isTouched:!!z((T||n).touchedFields,C)}),qe=C=>{C&&Pr(C).forEach(T=>ye(n.errors,T)),g.state.next({errors:C?n.errors:{}})},at=(C,T,_)=>{const V=(z(r,C,{_f:{}})._f||{}).ref,L=z(n.errors,C)||{},{ref:k,message:W,type:ne,...me}=L;ce(n.errors,C,{...me,...T,ref:V}),g.state.next({name:C,errors:n.errors,isValid:!1}),_&&_.shouldFocus&&V&&V.focus&&V.focus()},Ht=(C,T)=>rt(C)?g.values.subscribe({next:_=>C($(void 0,T),_)}):$(C,T,!0),_t=(C,T={})=>{for(const _ of C?Pr(C):a.mount)a.mount.delete(_),a.array.delete(_),T.keepValue||(ye(r,_),ye(s,_)),!T.keepError&&ye(n.errors,_),!T.keepDirty&&ye(n.dirtyFields,_),!T.keepTouched&&ye(n.touchedFields,_),!T.keepIsValidating&&ye(n.validatingFields,_),!t.shouldUnregister&&!T.keepDefaultValue&&ye(o,_);g.values.next({values:{...s}}),g.state.next({...n,...T.keepDirty?{isDirty:F()}:{}}),!T.keepIsValid&&y()},Ft=({disabled:C,name:T,field:_,fields:V,value:L})=>{if(tt(C)&&i.mount||C){const k=C?void 0:de(L)?Os(_?_._f:z(V,T)._f):L;(C||!C&&!de(k))&&ce(s,T,k),S(T,k,!1,!1,!0)}},Ke=(C,T={})=>{let _=z(r,C);const V=tt(T.disabled)||tt(t.disabled);return ce(r,C,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:C}},name:C,mount:!0,...T}}),a.mount.add(C),_?Ft({field:_,disabled:tt(T.disabled)?T.disabled:t.disabled,name:C,value:T.value}):b(C,!0,T.value),{...V?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:Pn(T.min),max:Pn(T.max),minLength:Pn(T.minLength),maxLength:Pn(T.maxLength),pattern:Pn(T.pattern)}:{},name:C,onChange:K,onBlur:K,ref:L=>{if(L){Ke(C,T),_=z(r,C);const k=de(L.value)&&L.querySelectorAll&&L.querySelectorAll("input,select,textarea")[0]||L,W=qy(k),ne=_._f.refs||[];if(W?ne.find(me=>me===k):k===_._f.ref)return;ce(r,C,{_f:{..._._f,...W?{refs:[...ne.filter(Fs),k,...Array.isArray(z(o,C))?[{}]:[]],ref:{type:k.type,name:C}}:{ref:k}}}),b(C,!1,void 0,k)}else _=z(r,C,{}),_._f&&(_._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(Iy(a.array,C)&&i.action)&&a.unMount.add(C)}}},we=()=>t.shouldFocusError&&En(r,te,a.mount),Ot=C=>{tt(C)&&(g.state.next({disabled:C}),En(r,(T,_)=>{const V=z(r,_);V&&(T.disabled=V._f.disabled||C,Array.isArray(V._f.refs)&&V._f.refs.forEach(L=>{L.disabled=V._f.disabled||C}))},0,!1))},Ut=(C,T)=>async _=>{let V;if(_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist()),t.disabled){T&&await T({...n.errors},_);return}let L=Ie(s);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:k,values:W}=await R();n.errors=k,L=W}else await H(r);if(ye(n.errors,"root"),Te(n.errors)){g.state.next({errors:{}});try{await C(L,_)}catch(k){V=k}}else T&&await T({...n.errors},_),we(),setTimeout(we);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(n.errors)&&!V,submitCount:n.submitCount+1,errors:n.errors}),V)throw V},Le=(C,T={})=>{z(r,C)&&(de(T.defaultValue)?q(C,Ie(z(o,C))):(q(C,T.defaultValue),ce(o,C,Ie(T.defaultValue))),T.keepTouched||ye(n.touchedFields,C),T.keepDirty||(ye(n.dirtyFields,C),n.isDirty=T.defaultValue?F(C,Ie(z(o,C))):F()),T.keepError||(ye(n.errors,C),f.isValid&&y()),g.state.next({...n}))},Xe=(C,T={})=>{const _=C?Ie(C):o,V=Ie(_),L=Te(C),k=L?o:V;if(T.keepDefaultValues||(o=_),!T.keepValues){if(T.keepDirtyValues){const W=new Set([...a.mount,...Object.keys(Nn(o,s))]);for(const ne of Array.from(W))z(n.dirtyFields,ne)?ce(k,ne,z(s,ne)):q(ne,z(k,ne))}else{if(Es&&de(C))for(const W of a.mount){const ne=z(r,W);if(ne&&ne._f){const me=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Tr(me)){const ge=me.closest("form");if(ge){ge.reset();break}}}}r={}}s=t.shouldUnregister?T.keepDefaultValues?Ie(o):{}:Ie(k),g.array.next({values:{...k}}),g.values.next({values:{...k}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!t.shouldUnregister,g.state.next({submitCount:T.keepSubmitCount?n.submitCount:0,isDirty:L?!1:T.keepDirty?n.isDirty:!!(T.keepDefaultValues&&!Nt(C,o)),isSubmitted:T.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:L?{}:T.keepDirtyValues?T.keepDefaultValues&&s?Nn(o,s):n.dirtyFields:T.keepDefaultValues&&C?Nn(o,C):T.keepDirty?n.dirtyFields:{},touchedFields:T.keepTouched?n.touchedFields:{},errors:T.keepErrors?n.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},ke=(C,T)=>Xe(rt(C)?C(s):C,T);return{control:{register:Ke,unregister:_t,getFieldState:Ae,handleSubmit:Ut,setError:at,_executeSchema:R,_getWatch:$,_getDirty:F,_updateValid:y,_removeUnmounted:Z,_updateFieldArray:x,_updateDisabledField:Ft,_getFieldArray:D,_reset:Xe,_resetDefaultValues:()=>rt(t.defaultValues)&&t.defaultValues().then(C=>{ke(C,t.resetOptions),g.state.next({isLoading:!1})}),_updateFormState:C=>{n={...n,...C}},_disableForm:Ot,_subjects:g,_proxyFormState:f,_setErrors:P,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(C){i=C},get _defaultValues(){return o},get _names(){return a},set _names(C){a=C},get _formState(){return n},set _formState(C){n=C},get _options(){return t},set _options(C){t={...t,...C}}},trigger:ae,register:Ke,handleSubmit:Ut,watch:Ht,setValue:q,getValues:re,reset:ke,resetField:Le,clearErrors:qe,unregister:_t,setError:at,setFocus:(C,T={})=>{const _=z(r,C),V=_&&_._f;if(V){const L=V.refs?V.refs[0]:V.ref;L.focus&&(L.focus(),T.shouldSelect&&rt(L.select)&&L.select())}},getFieldState:Ae}}function tw(e={}){const t=O.useRef(),n=O.useRef(),[r,o]=O.useState({isDirty:!1,isValidating:!1,isLoading:rt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:rt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...ew(e),formState:r});const s=t.current.control;return s._options=e,zy({subject:s._subjects.state,next:i=>{By(i,s._proxyFormState,s._updateFormState)&&o({...s._formState})}}),O.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),O.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),O.useEffect(()=>{e.values&&!Nt(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),O.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),O.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),O.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),O.useMemo(()=>({...t.current,formState:Vy(r,s)}),[r,s])}function dt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function uu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function nw(...e){return t=>{let n=!1;const r=e.map(o=>{const s=uu(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():uu(e[o],null)}}}}function Tn(...e){return d.useCallback(nw(...e),e)}var rw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],An=rw.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ow(e,t){e&&kn.flushSync(()=>e.dispatchEvent(t))}var sw="DismissableLayer",Ds="dismissableLayer.update",iw="dismissableLayer.pointerDownOutside",aw="dismissableLayer.focusOutside",du,fu=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pu=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...u}=e,l=d.useContext(fu),[f,g]=d.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=d.useState({}),v=Tn(t,E=>g(E)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),w=h.indexOf(y),x=f?h.indexOf(f):-1,N=l.layersWithOutsidePointerEventsDisabled.size>0,P=x>=w,b=uw(E=>{const R=E.target,U=[...l.branches].some(H=>H.contains(R));!P||U||(o==null||o(E),i==null||i(E),E.defaultPrevented||a==null||a())},m),S=dw(E=>{const R=E.target;[...l.branches].some(H=>H.contains(R))||(s==null||s(E),i==null||i(E),E.defaultPrevented||a==null||a())},m);return Ma(E=>{x===l.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},m),d.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(du=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),gu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=du)}},[f,m,n,l]),d.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),gu())},[f,l]),d.useEffect(()=>{const E=()=>p({});return document.addEventListener(Ds,E),()=>document.removeEventListener(Ds,E)},[]),c.jsx(An.div,{...u,ref:v,style:{pointerEvents:N?P?"auto":"none":void 0,...e.style},onFocusCapture:dt(e.onFocusCapture,S.onFocusCapture),onBlurCapture:dt(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:dt(e.onPointerDownCapture,b.onPointerDownCapture)})});pu.displayName=sw;var lw="DismissableLayerBranch",cw=d.forwardRef((e,t)=>{const n=d.useContext(fu),r=d.useRef(null),o=Tn(t,r);return d.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(An.div,{...e,ref:o})});cw.displayName=lw;function uw(e,t=globalThis==null?void 0:globalThis.document){const n=Ce(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){hu(iw,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function dw(e,t=globalThis==null?void 0:globalThis.document){const n=Ce(e),r=d.useRef(!1);return d.useEffect(()=>{const o=s=>{s.target&&!r.current&&hu(aw,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gu(){const e=new CustomEvent(Ds);document.dispatchEvent(e)}function hu(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ow(o,s):o.dispatchEvent(s)}const fw=["top","right","bottom","left"],Pt=Math.min,Me=Math.max,Or=Math.round,Dr=Math.floor,ot=e=>({x:e,y:e}),pw={left:"right",right:"left",bottom:"top",top:"bottom"},gw={start:"end",end:"start"};function Ms(e,t,n){return Me(e,Pt(t,n))}function ft(e,t){return typeof e=="function"?e(t):e}function pt(e){return e.split("-")[0]}function an(e){return e.split("-")[1]}function Rs(e){return e==="x"?"y":"x"}function ks(e){return e==="y"?"height":"width"}function Tt(e){return["top","bottom"].includes(pt(e))?"y":"x"}function $s(e){return Rs(Tt(e))}function hw(e,t,n){n===void 0&&(n=!1);const r=an(e),o=$s(e),s=ks(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Mr(i)),[i,Mr(i)]}function mw(e){const t=Mr(e);return[Is(e),t,Is(t)]}function Is(e){return e.replace(/start|end/g,t=>gw[t])}function vw(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:i;default:return[]}}function yw(e,t,n,r){const o=an(e);let s=vw(pt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Is)))),s}function Mr(e){return e.replace(/left|right|bottom|top/g,t=>pw[t])}function ww(e){return{top:0,right:0,bottom:0,left:0,...e}}function mu(e){return typeof e!="number"?ww(e):{top:e,right:e,bottom:e,left:e}}function Rr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function vu(e,t,n){let{reference:r,floating:o}=e;const s=Tt(t),i=$s(t),a=ks(i),u=pt(t),l=s==="y",f=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let p;switch(u){case"top":p={x:f,y:r.y-o.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:g};break;case"left":p={x:r.x-o.width,y:g};break;default:p={x:r.x,y:r.y}}switch(an(t)){case"start":p[i]-=m*(n&&l?-1:1);break;case"end":p[i]+=m*(n&&l?-1:1);break}return p}const bw=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:g}=vu(l,r,u),m=r,p={},v=0;for(let h=0;h<a.length;h++){const{name:y,fn:w}=a[h],{x,y:N,data:P,reset:b}=await w({x:f,y:g,initialPlacement:r,placement:m,strategy:o,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});f=x??f,g=N??g,p={...p,[y]:{...p[y],...P}},b&&v<=50&&(v++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(l=b.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:f,y:g}=vu(l,m,u)),h=-1)}return{x:f,y:g,placement:m,strategy:o,middlewareData:p}};async function _n(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:u}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:m=!1,padding:p=0}=ft(t,e),v=mu(p),y=a[m?g==="floating"?"reference":"floating":g],w=Rr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:f,strategy:u})),x=g==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),P=await(s.isElement==null?void 0:s.isElement(N))?await(s.getScale==null?void 0:s.getScale(N))||{x:1,y:1}:{x:1,y:1},b=Rr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:N,strategy:u}):x);return{top:(w.top-b.top+v.top)/P.y,bottom:(b.bottom-w.bottom+v.bottom)/P.y,left:(w.left-b.left+v.left)/P.x,right:(b.right-w.right+v.right)/P.x}}const xw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:u}=t,{element:l,padding:f=0}=ft(e,t)||{};if(l==null)return{};const g=mu(f),m={x:n,y:r},p=$s(o),v=ks(p),h=await i.getDimensions(l),y=p==="y",w=y?"top":"left",x=y?"bottom":"right",N=y?"clientHeight":"clientWidth",P=s.reference[v]+s.reference[p]-m[p]-s.floating[v],b=m[p]-s.reference[p],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let E=S?S[N]:0;(!E||!await(i.isElement==null?void 0:i.isElement(S)))&&(E=a.floating[N]||s.floating[v]);const R=P/2-b/2,U=E/2-h[v]/2-1,H=Pt(g[w],U),Z=Pt(g[x],U),F=H,$=E-h[v]-Z,D=E/2-h[v]/2+R,G=Ms(F,D,$),B=!u.arrow&&an(o)!=null&&D!==G&&s.reference[v]/2-(D<F?H:Z)-h[v]/2<0,q=B?D<F?D-F:D-$:0;return{[p]:m[p]+q,data:{[p]:G,centerOffset:D-G-q,...B&&{alignmentOffset:q}},reset:B}}}),Cw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:u,elements:l}=t,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...y}=ft(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=pt(o),x=Tt(a),N=pt(a)===a,P=await(u.isRTL==null?void 0:u.isRTL(l.floating)),b=m||(N||!h?[Mr(a)]:mw(a)),S=v!=="none";!m&&S&&b.push(...yw(a,h,v,P));const E=[a,...b],R=await _n(t,y),U=[];let H=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&U.push(R[w]),g){const D=hw(o,i,P);U.push(R[D[0]],R[D[1]])}if(H=[...H,{placement:o,overflows:U}],!U.every(D=>D<=0)){var Z,F;const D=(((Z=s.flip)==null?void 0:Z.index)||0)+1,G=E[D];if(G)return{data:{index:D,overflows:H},reset:{placement:G}};let B=(F=H.filter(q=>q.overflows[0]<=0).sort((q,K)=>q.overflows[1]-K.overflows[1])[0])==null?void 0:F.placement;if(!B)switch(p){case"bestFit":{var $;const q=($=H.filter(K=>{if(S){const te=Tt(K.placement);return te===x||te==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(te=>te>0).reduce((te,ae)=>te+ae,0)]).sort((K,te)=>K[1]-te[1])[0])==null?void 0:$[0];q&&(B=q);break}case"initialPlacement":B=a;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function yu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wu(e){return fw.some(t=>e[t]>=0)}const Sw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ft(e,t);switch(r){case"referenceHidden":{const s=await _n(t,{...o,elementContext:"reference"}),i=yu(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:wu(i)}}}case"escaped":{const s=await _n(t,{...o,altBoundary:!0}),i=yu(s,n.floating);return{data:{escapedOffsets:i,escaped:wu(i)}}}default:return{}}}}};async function Ew(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=pt(n),a=an(n),u=Tt(n)==="y",l=["left","top"].includes(i)?-1:1,f=s&&u?-1:1,g=ft(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:v}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return a&&typeof v=="number"&&(p=a==="end"?v*-1:v),u?{x:p*f,y:m*l}:{x:m*l,y:p*f}}const Nw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,u=await Ew(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:i}}}}},Pw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x:w,y:x}=y;return{x:w,y:x}}},...u}=ft(e,t),l={x:n,y:r},f=await _n(t,u),g=Tt(pt(o)),m=Rs(g);let p=l[m],v=l[g];if(s){const y=m==="y"?"top":"left",w=m==="y"?"bottom":"right",x=p+f[y],N=p-f[w];p=Ms(x,p,N)}if(i){const y=g==="y"?"top":"left",w=g==="y"?"bottom":"right",x=v+f[y],N=v-f[w];v=Ms(x,v,N)}const h=a.fn({...t,[m]:p,[g]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[m]:s,[g]:i}}}}}},Tw=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:u=!0,crossAxis:l=!0}=ft(e,t),f={x:n,y:r},g=Tt(o),m=Rs(g);let p=f[m],v=f[g];const h=ft(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const N=m==="y"?"height":"width",P=s.reference[m]-s.floating[N]+y.mainAxis,b=s.reference[m]+s.reference[N]-y.mainAxis;p<P?p=P:p>b&&(p=b)}if(l){var w,x;const N=m==="y"?"width":"height",P=["top","left"].includes(pt(o)),b=s.reference[g]-s.floating[N]+(P&&((w=i.offset)==null?void 0:w[g])||0)+(P?0:y.crossAxis),S=s.reference[g]+s.reference[N]+(P?0:((x=i.offset)==null?void 0:x[g])||0)-(P?y.crossAxis:0);v<b?v=b:v>S&&(v=S)}return{[m]:p,[g]:v}}}},Aw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:u=()=>{},...l}=ft(e,t),f=await _n(t,l),g=pt(o),m=an(o),p=Tt(o)==="y",{width:v,height:h}=s.floating;let y,w;g==="top"||g==="bottom"?(y=g,w=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=g,y=m==="end"?"top":"bottom");const x=h-f.top-f.bottom,N=v-f.left-f.right,P=Pt(h-f[y],x),b=Pt(v-f[w],N),S=!t.middlewareData.shift;let E=P,R=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=N),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=x),S&&!m){const H=Me(f.left,0),Z=Me(f.right,0),F=Me(f.top,0),$=Me(f.bottom,0);p?R=v-2*(H!==0||Z!==0?H+Z:Me(f.left,f.right)):E=h-2*(F!==0||$!==0?F+$:Me(f.top,f.bottom))}await u({...t,availableWidth:R,availableHeight:E});const U=await i.getDimensions(a.floating);return v!==U.width||h!==U.height?{reset:{rects:!0}}:{}}}};function kr(){return typeof window<"u"}function ln(e){return bu(e)?(e.nodeName||"").toLowerCase():"#document"}function Re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function st(e){var t;return(t=(bu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bu(e){return kr()?e instanceof Node||e instanceof Re(e).Node:!1}function Ge(e){return kr()?e instanceof Element||e instanceof Re(e).Element:!1}function it(e){return kr()?e instanceof HTMLElement||e instanceof Re(e).HTMLElement:!1}function xu(e){return!kr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Re(e).ShadowRoot}function Fn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=We(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function _w(e){return["table","td","th"].includes(ln(e))}function $r(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ls(e){const t=Vs(),n=Ge(e)?We(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Fw(e){let t=At(e);for(;it(t)&&!cn(t);){if(Ls(t))return t;if($r(t))return null;t=At(t)}return null}function Vs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function cn(e){return["html","body","#document"].includes(ln(e))}function We(e){return Re(e).getComputedStyle(e)}function Ir(e){return Ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function At(e){if(ln(e)==="html")return e;const t=e.assignedSlot||e.parentNode||xu(e)&&e.host||st(e);return xu(t)?t.host:t}function Cu(e){const t=At(e);return cn(t)?e.ownerDocument?e.ownerDocument.body:e.body:it(t)&&Fn(t)?t:Cu(t)}function On(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Cu(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Re(o);if(s){const a=Bs(i);return t.concat(i,i.visualViewport||[],Fn(o)?o:[],a&&n?On(a):[])}return t.concat(o,On(o,[],n))}function Bs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Su(e){const t=We(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=it(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Or(n)!==s||Or(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function zs(e){return Ge(e)?e:e.contextElement}function un(e){const t=zs(e);if(!it(t))return ot(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Su(t);let i=(s?Or(n.width):n.width)/r,a=(s?Or(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Ow=ot(0);function Eu(e){const t=Re(e);return!Vs()||!t.visualViewport?Ow:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Dw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Re(e)?!1:t}function zt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=zs(e);let i=ot(1);t&&(r?Ge(r)&&(i=un(r)):i=un(e));const a=Dw(s,n,r)?Eu(s):ot(0);let u=(o.left+a.x)/i.x,l=(o.top+a.y)/i.y,f=o.width/i.x,g=o.height/i.y;if(s){const m=Re(s),p=r&&Ge(r)?Re(r):r;let v=m,h=Bs(v);for(;h&&r&&p!==v;){const y=un(h),w=h.getBoundingClientRect(),x=We(h),N=w.left+(h.clientLeft+parseFloat(x.paddingLeft))*y.x,P=w.top+(h.clientTop+parseFloat(x.paddingTop))*y.y;u*=y.x,l*=y.y,f*=y.x,g*=y.y,u+=N,l+=P,v=Re(h),h=Bs(v)}}return Rr({width:f,height:g,x:u,y:l})}function Hs(e,t){const n=Ir(e).scrollLeft;return t?t.left+n:zt(st(e)).left+n}function Nu(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:Hs(e,r)),s=r.top+t.scrollTop;return{x:o,y:s}}function Mw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=st(r),a=t?$r(t.floating):!1;if(r===i||a&&s)return n;let u={scrollLeft:0,scrollTop:0},l=ot(1);const f=ot(0),g=it(r);if((g||!g&&!s)&&((ln(r)!=="body"||Fn(i))&&(u=Ir(r)),it(r))){const p=zt(r);l=un(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}const m=i&&!g&&!s?Nu(i,u,!0):ot(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+f.x+m.x,y:n.y*l.y-u.scrollTop*l.y+f.y+m.y}}function Rw(e){return Array.from(e.getClientRects())}function kw(e){const t=st(e),n=Ir(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Hs(e);const a=-n.scrollTop;return We(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}function $w(e,t){const n=Re(e),r=st(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,u=0;if(o){s=o.width,i=o.height;const l=Vs();(!l||l&&t==="fixed")&&(a=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:a,y:u}}function Iw(e,t){const n=zt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=it(e)?un(e):ot(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,u=o*s.x,l=r*s.y;return{width:i,height:a,x:u,y:l}}function Pu(e,t,n){let r;if(t==="viewport")r=$w(e,n);else if(t==="document")r=kw(st(e));else if(Ge(t))r=Iw(t,n);else{const o=Eu(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Rr(r)}function Tu(e,t){const n=At(e);return n===t||!Ge(n)||cn(n)?!1:We(n).position==="fixed"||Tu(n,t)}function Lw(e,t){const n=t.get(e);if(n)return n;let r=On(e,[],!1).filter(a=>Ge(a)&&ln(a)!=="body"),o=null;const s=We(e).position==="fixed";let i=s?At(e):e;for(;Ge(i)&&!cn(i);){const a=We(i),u=Ls(i);!u&&a.position==="fixed"&&(o=null),(s?!u&&!o:!u&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Fn(i)&&!u&&Tu(e,i))?r=r.filter(f=>f!==i):o=a,i=At(i)}return t.set(e,r),r}function Vw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?$r(t)?[]:Lw(t,this._c):[].concat(n),r],a=i[0],u=i.reduce((l,f)=>{const g=Pu(t,f,o);return l.top=Me(g.top,l.top),l.right=Pt(g.right,l.right),l.bottom=Pt(g.bottom,l.bottom),l.left=Me(g.left,l.left),l},Pu(t,a,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Bw(e){const{width:t,height:n}=Su(e);return{width:t,height:n}}function zw(e,t,n){const r=it(t),o=st(t),s=n==="fixed",i=zt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const u=ot(0);if(r||!r&&!s)if((ln(t)!=="body"||Fn(o))&&(a=Ir(t)),r){const m=zt(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&(u.x=Hs(o));const l=o&&!r&&!s?Nu(o,a):ot(0),f=i.left+a.scrollLeft-u.x-l.x,g=i.top+a.scrollTop-u.y-l.y;return{x:f,y:g,width:i.width,height:i.height}}function Us(e){return We(e).position==="static"}function Au(e,t){if(!it(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return st(e)===n&&(n=n.ownerDocument.body),n}function _u(e,t){const n=Re(e);if($r(e))return n;if(!it(e)){let o=At(e);for(;o&&!cn(o);){if(Ge(o)&&!Us(o))return o;o=At(o)}return n}let r=Au(e,t);for(;r&&_w(r)&&Us(r);)r=Au(r,t);return r&&cn(r)&&Us(r)&&!Ls(r)?n:r||Fw(e)||n}const Hw=async function(e){const t=this.getOffsetParent||_u,n=this.getDimensions,r=await n(e.floating);return{reference:zw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Uw(e){return We(e).direction==="rtl"}const jw={convertOffsetParentRelativeRectToViewportRelativeRect:Mw,getDocumentElement:st,getClippingRect:Vw,getOffsetParent:_u,getElementRects:Hw,getClientRects:Rw,getDimensions:Bw,getScale:un,isElement:Ge,isRTL:Uw};function Gw(e,t){let n=null,r;const o=st(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),s();const{left:l,top:f,width:g,height:m}=e.getBoundingClientRect();if(a||t(),!g||!m)return;const p=Dr(f),v=Dr(o.clientWidth-(l+g)),h=Dr(o.clientHeight-(f+m)),y=Dr(l),x={rootMargin:-p+"px "+-v+"px "+-h+"px "+-y+"px",threshold:Me(0,Pt(1,u))||1};let N=!0;function P(b){const S=b[0].intersectionRatio;if(S!==u){if(!N)return i();S?i(!1,S):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N=!1}try{n=new IntersectionObserver(P,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(P,x)}n.observe(e)}return i(!0),s}function Ww(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,l=zs(e),f=o||s?[...l?On(l):[],...On(t)]:[];f.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const g=l&&a?Gw(l,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(w=>{let[x]=w;x&&x.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var N;(N=p)==null||N.observe(t)})),n()}),l&&!u&&p.observe(l),p.observe(t));let v,h=u?zt(e):null;u&&y();function y(){const w=zt(e);h&&(w.x!==h.x||w.y!==h.y||w.width!==h.width||w.height!==h.height)&&n(),h=w,v=requestAnimationFrame(y)}return n(),()=>{var w;f.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),g==null||g(),(w=p)==null||w.disconnect(),p=null,u&&cancelAnimationFrame(v)}}const qw=Nw,Kw=Pw,Xw=Cw,Yw=Aw,Jw=Sw,Fu=xw,Zw=Tw,Qw=(e,t,n)=>{const r=new Map,o={platform:jw,...n},s={...o.platform,_c:r};return bw(e,t,{...o,platform:s})};var Lr=typeof document<"u"?O.useLayoutEffect:O.useEffect;function Vr(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,o;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(!Vr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Vr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ou(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Du(e,t){const n=Ou(e);return Math.round(t*n)/n}function js(e){const t=d.useRef(e);return Lr(()=>{t.current=e}),t}function eb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:u,open:l}=e,[f,g]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=d.useState(r);Vr(m,r)||p(r);const[v,h]=d.useState(null),[y,w]=d.useState(null),x=d.useCallback(K=>{K!==S.current&&(S.current=K,h(K))},[]),N=d.useCallback(K=>{K!==E.current&&(E.current=K,w(K))},[]),P=s||v,b=i||y,S=d.useRef(null),E=d.useRef(null),R=d.useRef(f),U=u!=null,H=js(u),Z=js(o),F=js(l),$=d.useCallback(()=>{if(!S.current||!E.current)return;const K={placement:t,strategy:n,middleware:m};Z.current&&(K.platform=Z.current),Qw(S.current,E.current,K).then(te=>{const ae={...te,isPositioned:F.current!==!1};D.current&&!Vr(R.current,ae)&&(R.current=ae,kn.flushSync(()=>{g(ae)}))})},[m,t,n,Z,F]);Lr(()=>{l===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,g(K=>({...K,isPositioned:!1})))},[l]);const D=d.useRef(!1);Lr(()=>(D.current=!0,()=>{D.current=!1}),[]),Lr(()=>{if(P&&(S.current=P),b&&(E.current=b),P&&b){if(H.current)return H.current(P,b,$);$()}},[P,b,$,H,U]);const G=d.useMemo(()=>({reference:S,floating:E,setReference:x,setFloating:N}),[x,N]),B=d.useMemo(()=>({reference:P,floating:b}),[P,b]),q=d.useMemo(()=>{const K={position:n,left:0,top:0};if(!B.floating)return K;const te=Du(B.floating,f.x),ae=Du(B.floating,f.y);return a?{...K,transform:"translate("+te+"px, "+ae+"px)",...Ou(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:ae}},[n,a,B.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:$,refs:G,elements:B,floatingStyles:q}),[f,$,G,B,q])}const tb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Fu({element:r.current,padding:o}).fn(n):{}:r?Fu({element:r,padding:o}).fn(n):{}}}},nb=(e,t)=>({...qw(e),options:[e,t]}),rb=(e,t)=>({...Kw(e),options:[e,t]}),ob=(e,t)=>({...Zw(e),options:[e,t]}),sb=(e,t)=>({...Xw(e),options:[e,t]}),ib=(e,t)=>({...Yw(e),options:[e,t]}),ab=(e,t)=>({...Jw(e),options:[e,t]}),lb=(e,t)=>({...tb(e),options:[e,t]});var cb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ub=cb.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),db="Arrow",Mu=d.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return c.jsx(ub.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Mu.displayName=db;var fb=Mu;function Ru(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function pb(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ru(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ru(e[o],null)}}}}function ku(...e){return d.useCallback(pb(...e),e)}var gb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$u=gb.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Gs="Popper",[Iu,Lu]=xt(Gs),[hb,Vu]=Iu(Gs),Bu=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return c.jsx(hb,{scope:t,anchor:r,onAnchorChange:o,children:n})};Bu.displayName=Gs;var zu="PopperAnchor",Hu=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Vu(zu,n),i=d.useRef(null),a=ku(t,i);return d.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:c.jsx($u.div,{...o,ref:a})});Hu.displayName=zu;var Ws="PopperContent",[mb,vb]=Iu(Ws),Uu=d.forwardRef((e,t)=>{var Ft,Ke,we,Ot,Ut,Le;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:g="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:v,...h}=e,y=Vu(Ws,n),[w,x]=d.useState(null),N=ku(t,Xe=>x(Xe)),[P,b]=d.useState(null),S=Na(P),E=(S==null?void 0:S.width)??0,R=(S==null?void 0:S.height)??0,U=r+(s!=="center"?"-"+s:""),H=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Z=Array.isArray(l)?l:[l],F=Z.length>0,$={padding:H,boundary:Z.filter(wb),altBoundary:F},{refs:D,floatingStyles:G,placement:B,isPositioned:q,middlewareData:K}=eb({strategy:"fixed",placement:U,whileElementsMounted:(...Xe)=>Ww(...Xe,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[nb({mainAxis:o+R,alignmentAxis:i}),u&&rb({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?ob():void 0,...$}),u&&sb({...$}),ib({...$,apply:({elements:Xe,rects:ke,availableWidth:Dt,availableHeight:jr})=>{const{width:jt,height:C}=ke.reference,T=Xe.floating.style;T.setProperty("--radix-popper-available-width",`${Dt}px`),T.setProperty("--radix-popper-available-height",`${jr}px`),T.setProperty("--radix-popper-anchor-width",`${jt}px`),T.setProperty("--radix-popper-anchor-height",`${C}px`)}}),P&&lb({element:P,padding:a}),bb({arrowWidth:E,arrowHeight:R}),m&&ab({strategy:"referenceHidden",...$})]}),[te,ae]=Wu(B),re=Ce(v);De(()=>{q&&(re==null||re())},[q,re]);const Ae=(Ft=K.arrow)==null?void 0:Ft.x,qe=(Ke=K.arrow)==null?void 0:Ke.y,at=((we=K.arrow)==null?void 0:we.centerOffset)!==0,[Ht,_t]=d.useState();return De(()=>{w&&_t(window.getComputedStyle(w).zIndex)},[w]),c.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:q?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ht,"--radix-popper-transform-origin":[(Ot=K.transformOrigin)==null?void 0:Ot.x,(Ut=K.transformOrigin)==null?void 0:Ut.y].join(" "),...((Le=K.hide)==null?void 0:Le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(mb,{scope:n,placedSide:te,onArrowChange:b,arrowX:Ae,arrowY:qe,shouldHideArrow:at,children:c.jsx($u.div,{"data-side":te,"data-align":ae,...h,ref:N,style:{...h.style,animation:q?void 0:"none"}})})})});Uu.displayName=Ws;var ju="PopperArrow",yb={top:"bottom",right:"left",bottom:"top",left:"right"},Gu=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=vb(ju,r),i=yb[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(fb,{...o,ref:n,style:{...o.style,display:"block"}})})});Gu.displayName=ju;function wb(e){return e!==null}var bb=e=>({name:"transformOrigin",options:e,fn(t){var y,w,x;const{placement:n,rects:r,middlewareData:o}=t,i=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[l,f]=Wu(n),g={start:"0%",center:"50%",end:"100%"}[f],m=(((w=o.arrow)==null?void 0:w.x)??0)+a/2,p=(((x=o.arrow)==null?void 0:x.y)??0)+u/2;let v="",h="";return l==="bottom"?(v=i?g:`${m}px`,h=`${-u}px`):l==="top"?(v=i?g:`${m}px`,h=`${r.floating.height+u}px`):l==="right"?(v=`${-u}px`,h=i?g:`${p}px`):l==="left"&&(v=`${r.floating.width+u}px`,h=i?g:`${p}px`),{data:{x:v,y:h}}}});function Wu(e){const[t,n="center"]=e.split("-");return[t,n]}var xb=Bu,Cb=Hu,Sb=Uu,Eb=Gu,Nb="Portal",qu=d.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=d.useState(!1);De(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Gr.createPortal(c.jsx(An.div,{...r,ref:t}),i):null});qu.displayName=Nb;function Pb(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var qs=e=>{const{present:t,children:n}=e,r=Tb(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=Tn(r.ref,Ab(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};qs.displayName="Presence";function Tb(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Pb(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const l=Br(r.current);s.current=a==="mounted"?l:"none"},[a]),De(()=>{const l=r.current,f=o.current;if(f!==e){const m=s.current,p=Br(l);e?u("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?u("UNMOUNT"):u(f&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),De(()=>{if(t){let l;const f=t.ownerDocument.defaultView??window,g=p=>{const h=Br(r.current).includes(p.animationName);if(p.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=p=>{p.target===t&&(s.current=Br(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{f.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function Br(e){return(e==null?void 0:e.animationName)||"none"}function Ab(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _b="VisuallyHidden",Ku=d.forwardRef((e,t)=>c.jsx(An.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Ku.displayName=_b;var Fb=Ku,[zr,Sx]=xt("Tooltip",[Lu]),Hr=Lu(),Xu="TooltipProvider",Ob=700,Ks="tooltip.open",[Db,Xs]=zr(Xu),Yu=e=>{const{__scopeTooltip:t,delayDuration:n=Ob,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,[i,a]=d.useState(!0),u=d.useRef(!1),l=d.useRef(0);return d.useEffect(()=>{const f=l.current;return()=>window.clearTimeout(f)},[]),c.jsx(Db,{scope:t,isOpenDelayed:i,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(l.current),a(!1)},[]),onClose:d.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:d.useCallback(f=>{u.current=f},[]),disableHoverableContent:o,children:s})};Yu.displayName=Xu;var Ur="Tooltip",[Mb,Dn]=zr(Ur),Ju=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,u=Xs(Ur,e.__scopeTooltip),l=Hr(t),[f,g]=d.useState(null),m=Zt(),p=d.useRef(0),v=i??u.disableHoverableContent,h=a??u.delayDuration,y=d.useRef(!1),[w=!1,x]=Yt({prop:r,defaultProp:o,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(Ks))):u.onClose(),s==null||s(E)}}),N=d.useMemo(()=>w?y.current?"delayed-open":"instant-open":"closed",[w]),P=d.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,x(!0)},[x]),b=d.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),S=d.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,x(!0),p.current=0},h)},[h,x]);return d.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),c.jsx(xb,{...l,children:c.jsx(Mb,{scope:t,contentId:m,open:w,stateAttribute:N,trigger:f,onTriggerChange:g,onTriggerEnter:d.useCallback(()=>{u.isOpenDelayed?S():P()},[u.isOpenDelayed,S,P]),onTriggerLeave:d.useCallback(()=>{v?b():(window.clearTimeout(p.current),p.current=0)},[b,v]),onOpen:P,onClose:b,disableHoverableContent:v,children:n})})};Ju.displayName=Ur;var Ys="TooltipTrigger",Zu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Dn(Ys,n),s=Xs(Ys,n),i=Hr(n),a=d.useRef(null),u=Tn(t,a,o.onTriggerChange),l=d.useRef(!1),f=d.useRef(!1),g=d.useCallback(()=>l.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),c.jsx(Cb,{asChild:!0,...i,children:c.jsx(An.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:dt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:dt(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:dt(e.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:dt(e.onFocus,()=>{l.current||o.onOpen()}),onBlur:dt(e.onBlur,o.onClose),onClick:dt(e.onClick,o.onClose)})})});Zu.displayName=Ys;var Js="TooltipPortal",[Rb,kb]=zr(Js,{forceMount:void 0}),Qu=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Dn(Js,t);return c.jsx(Rb,{scope:t,forceMount:n,children:c.jsx(qs,{present:n||s.open,children:c.jsx(qu,{asChild:!0,container:o,children:r})})})};Qu.displayName=Js;var dn="TooltipContent",ed=d.forwardRef((e,t)=>{const n=kb(dn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Dn(dn,e.__scopeTooltip);return c.jsx(qs,{present:r||i.open,children:i.disableHoverableContent?c.jsx(td,{side:o,...s,ref:t}):c.jsx($b,{side:o,...s,ref:t})})}),$b=d.forwardRef((e,t)=>{const n=Dn(dn,e.__scopeTooltip),r=Xs(dn,e.__scopeTooltip),o=d.useRef(null),s=Tn(t,o),[i,a]=d.useState(null),{trigger:u,onClose:l}=n,f=o.current,{onPointerInTransitChange:g}=r,m=d.useCallback(()=>{a(null),g(!1)},[g]),p=d.useCallback((v,h)=>{const y=v.currentTarget,w={x:v.clientX,y:v.clientY},x=Bb(w,y.getBoundingClientRect()),N=zb(w,x),P=Hb(h.getBoundingClientRect()),b=jb([...N,...P]);a(b),g(!0)},[g]);return d.useEffect(()=>()=>m(),[m]),d.useEffect(()=>{if(u&&f){const v=y=>p(y,f),h=y=>p(y,u);return u.addEventListener("pointerleave",v),f.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",v),f.removeEventListener("pointerleave",h)}}},[u,f,p,m]),d.useEffect(()=>{if(i){const v=h=>{const y=h.target,w={x:h.clientX,y:h.clientY},x=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),N=!Ub(w,i);x?m():N&&(m(),l())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[u,f,i,l,m]),c.jsx(td,{...e,ref:s})}),[Ib,Lb]=zr(Ur,{isInside:!1}),td=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,u=Dn(dn,n),l=Hr(n),{onClose:f}=u;return d.useEffect(()=>(document.addEventListener(Ks,f),()=>document.removeEventListener(Ks,f)),[f]),d.useEffect(()=>{if(u.trigger){const g=m=>{const p=m.target;p!=null&&p.contains(u.trigger)&&f()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[u.trigger,f]),c.jsx(pu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:g=>g.preventDefault(),onDismiss:f,children:c.jsxs(Sb,{"data-state":u.stateAttribute,...l,...a,ref:t,style:{...a.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:[c.jsx(ca,{children:r}),c.jsx(Ib,{scope:n,isInside:!0,children:c.jsx(Fb,{id:u.contentId,role:"tooltip",children:o||r})})]})})});ed.displayName=dn;var nd="TooltipArrow",Vb=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Hr(n);return Lb(nd,n).isInside?null:c.jsx(Eb,{...o,...r,ref:t})});Vb.displayName=nd;function Bb(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function zb(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Hb(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function Ub(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s].x,u=t[s].y,l=t[i].x,f=t[i].y;u>r!=f>r&&n<(l-a)*(r-u)/(f-u)+a&&(o=!o)}return o}function jb(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Gb(t)}function Gb(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}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 Wb=Yu,qb=Ju,Kb=Zu,Xb=Qu,rd=ed;const Yb=Wb,Jb=qb,Zb=Kb,od=d.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(Xb,{children:c.jsx(rd,{ref:r,sideOffset:t,className:J("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));od.displayName=rd.displayName;const sd=({className:e,children:t,content:n,side:r})=>{const[o,s]=O.useState(!1);return c.jsx(Yb,{delayDuration:0,children:c.jsxs(Jb,{open:o,children:[c.jsx(Zb,{asChild:!0,children:c.jsx("button",{type:"button",className:J("cursor-pointer",e),onClick:()=>s(!o),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onTouchStart:()=>s(!o),onKeyDown:i=>{i.preventDefault(),i.key==="Enter"&&s(!o)},children:t})}),c.jsx(od,{side:r,className:n?"":"hidden",children:c.jsx("span",{className:"inline-block",children:n})})]})})},Zs=({className:e,...t})=>c.jsx("nav",{role:"navigation","aria-label":"pagination",className:J("mx-auto flex w-full justify-center",e),...t});Zs.displayName="Pagination";const Qs=d.forwardRef(({className:e,...t},n)=>c.jsx("ul",{ref:n,className:J("flex flex-row items-center gap-1",e),...t}));Qs.displayName="PaginationContent";const gt=d.forwardRef(({className:e,...t},n)=>c.jsx("li",{ref:n,className:J("",e),...t}));gt.displayName="PaginationItem";const Mn=({className:e,isActive:t,size:n="icon",...r})=>c.jsx("a",{"aria-current":t?"page":void 0,className:J(Ea({variant:t?"outline":"ghost",size:n}),e),...r});Mn.displayName="PaginationLink";const ei=({className:e,...t})=>c.jsxs(Mn,{"aria-label":"Go to previous page",size:"default",className:J("gap-1 pl-2.5",e),...t,children:[c.jsx(Ap,{className:"h-4 w-4"}),c.jsx("span",{children:"Previous"})]});ei.displayName="PaginationPrevious";const ti=({className:e,...t})=>c.jsxs(Mn,{"aria-label":"Go to next page",size:"default",className:J("gap-1 pr-2.5",e),...t,children:[c.jsx("span",{children:"Next"}),c.jsx(ia,{className:"h-4 w-4"})]});ti.displayName="PaginationNext";const ni=({className:e,...t})=>c.jsxs("span",{"aria-hidden":!0,className:J("flex h-9 w-9 items-center justify-center",e),...t,children:[c.jsx(_p,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"More pages"})]});ni.displayName="PaginationEllipsis";const Qb=({apiBaseUrl:e="http://localhost:3000"})=>{var x,N,P;const[t,n]=O.useState([]),[r,o]=O.useState(!1),[s,i]=O.useState([]),[a,u]=O.useState(1),[l,f]=O.useState(1),[g,m]=O.useState(null),p=b=>b.map(E=>({id:E==null?void 0:E.id,prefix:(E==null?void 0:E.prefix)||"",model:(E==null?void 0:E.model)||"",fileName:(E==null?void 0:E.file_name)||"",code:(E==null?void 0:E.stock_id)||"",content:(E==null?void 0:E.text_summary)||"",status:(E==null?void 0:E.status)||"",note:(E==null?void 0:E.note)||"",lastUpdate:E==null?void 0:E.updated_at,stock_id:E==null?void 0:E.stock_id})),v=b=>{if(!(b!=null&&b.data))return[];const S=p(b==null?void 0:b.data);n(S),f(b.pagination.totalPages)},h=async(b=1,S=15)=>{console.log("🚀 ~ fetchData ~ page:",b),m(b);try{const E=await se.get(`${e}/api/latest-summaries`,{params:{page:b,limit:S}});console.log("🚀 ~ fetchData ~ result.data:",E.data),(E==null?void 0:E.status)===200?v(E.data):console.error(E)}catch(E){console.error("Error fetching data:",E)}finally{m(null),o(!1)}};O.useEffect(()=>{h(a)},[a]);const y=O.useMemo(()=>[{id:"code",header:"Mã",accessorKey:"code",cell:({row:S})=>c.jsx("span",{className:"flex flex-col",children:S.original.code})},{id:"fileName",header:"Tên file",accessorKey:"fileName",cell:({row:S})=>c.jsx("span",{className:"flex flex-col",children:S.original.fileName})},{id:"content",header:"Nội dung",accessorKey:"content",cell:({row:S})=>{const E=S.getValue("content");return c.jsx(sd,{content:c.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:E}),children:c.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[30dvw]",children:E})})}},{id:"status",header:"Trạng thái",accessorKey:"status",cell:({row:S})=>c.jsx("span",{className:"flex flex-col",children:S.original.status})},{id:"note",header:"Ghi chú",accessorKey:"note",cell:({row:S})=>c.jsx(sd,{content:c.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:S.original.note}),children:c.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[20dvw]",children:S.original.note})})},{id:"last-update",header:"Cập nhật",accessorKey:"last-update",cell:({row:S})=>{const R=new Date(S.original.lastUpdate).getMonth()+1;return c.jsxs("span",{className:"flex flex-col",children:["tháng ",R]})}},{accessorKey:"edit",header:()=>c.jsx("div",{className:"font-medium text-center",children:"Sửa"}),cell:({row:S})=>{const[E,R]=O.useState(!1),[U,H]=O.useState(!1),{handleSubmit:Z,register:F,reset:$}=tw(),D=S.original.id,G=async B=>{R(!0);try{const q=await se.patch(`${e}/api/update-summary`,{note:B.note,text_summary:B.content,id:D});q.status===200?(await h(a),H(!1)):console.error("Failed to update summary:",q)}catch(q){console.error("Error updating summary:",q)}return R(!1)};return c.jsxs(rn,{open:U,onOpenChange:B=>{H(B),B?$({content:S.original.content,note:S.original.note}):$()},children:[c.jsx(lr,{className:"w-full",children:c.jsx("div",{onClick:()=>H(B=>!B),className:"font-medium text-center text-orange-500 cursor-pointer",children:"sửa"})}),c.jsx(It,{className:"rounded-lg sm:px-3 h-[calc(100dvh-200px)] min-w-[calc(100dvw-112px)]",children:c.jsxs(Lt,{className:"flex flex-col gap-3",children:[c.jsx(Vt,{className:"max-sm:hidden text-center",children:"Sửa summary"}),c.jsxs("form",{className:"flex flex-col gap-3 h-full justify-between",onSubmit:Z(G),children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"flex flex-col items-start",children:[c.jsx("span",{children:"Nội dung:"}),c.jsx(mr,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:S.original.answer||"",rows:10,...F("content")})]}),c.jsxs("div",{className:"flex flex-col items-start",children:[c.jsx("span",{children:"Lưu ý:"}),c.jsx(mr,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:S.original.note||"",rows:1,...F("note")})]})]}),c.jsx("div",{className:"flex justify-end",children:c.jsx(ue,{disabled:E,type:"submit",variant:"default",children:"Ok"})})]})]})})]})}},{id:"publish",header:"",accessorKey:"publish",cell:({row:S})=>{const[E,R]=O.useState(!1),[U,H]=O.useState(!1),Z=S.original.id,F=S.getValue("status"),$=S.getValue("code"),G=new Date(S.original.lastUpdate).getMonth()+1,[B,q]=O.useState(""),[K,te]=O.useState("1"),ae=async()=>{try{R(!0);try{const re=await se.patch(`${e}/api/toggle-publish/${Z}`,{id:Z,status:F,idInput:K,stock_id:S.original.stock_id,bucket:B,prefix:S.original.prefix,model:S.original.model,summary_result:S.original.content,note:S.original.note});re.status===200?(h(a),H(!1)):console.error("Failed to toggle publish status:",re)}catch(re){console.error("Error toggling publish status:",re)}finally{q(""),R(!1)}}catch{}};return c.jsxs(rn,{open:U,onOpenChange:re=>{H(re)},children:[c.jsx(lr,{className:"w-full",children:c.jsx("div",{onClick:()=>H(re=>!re),className:"font-medium text-start text-green-400 cursor-pointer",children:F==="unpublish"?"Publish":"Unpublish"})}),c.jsx(It,{className:"rounded-lg sm:px-3 sm:w-[calc(100%-30px)]",children:c.jsxs(Lt,{className:"flex flex-col gap-3",children:[c.jsxs(Vt,{children:[F==="unpublish"?"Publish":"Unpublish"," Summary?"]}),c.jsxs("span",{children:["Bạn có muốn ",F==="unpublish"?"publish":"unpublish"," summary mã ",$," ","tháng ",G," không?"]}),c.jsxs("div",{children:[c.jsx("span",{children:"id:"}),c.jsx(Et,{type:"number",value:K,onChange:re=>te(re.target.value)})]}),c.jsxs("div",{children:[c.jsx("span",{children:"bucket:"}),c.jsx(Et,{value:B,onChange:re=>q(re.target.value)})]}),c.jsx("div",{className:"flex items-center justify-end",children:c.jsx(ue,{onClick:ae,disabled:E,children:"ok"})})]})})]})}}],[]),w=bi({data:t,columns:y,state:{columnFilters:s},enableRowSelection:!0,onColumnFiltersChange:i,getFilteredRowModel:Xd(),getCoreRowModel:wi()});return c.jsxs("div",{className:"space-y-4 s3-explr-container",children:[c.jsx("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:c.jsx(Et,{placeholder:"Tìm kiếm theo mã...",value:((x=w.getColumn("code"))==null?void 0:x.getFilterValue())??"",onChange:b=>{var S;return(S=w.getColumn("code"))==null?void 0:S.setFilterValue(b.target.value)},className:"max-w-sm"})}),c.jsx("div",{className:"rounded-md border s3-explr-table-container",children:c.jsxs(ur,{className:"s3-explr-table",children:[c.jsx(dr,{className:"s3-explr-table-header",children:w.getHeaderGroups().map(b=>c.jsx(Ue,{className:"hover:bg-transparent s3-explr-header-row",children:b.headers.map(S=>c.jsx(Qe,{className:"s3-explr-header-cell",children:S.isPlaceholder?null:Bn(S.column.columnDef.header,S.getContext())},S.id))},b.id))}),c.jsx(fr,{className:"s3-explr-table-body",children:(N=w.getRowModel().rows)!=null&&N.length?(P=w.getRowModel().rows)==null?void 0:P.map(b=>c.jsx(Ue,{className:"h-12 s3-explr-row",children:b.getVisibleCells().map(S=>c.jsx(Pe,{className:"align-middle s3-explr-cell",children:Bn(S.column.columnDef.cell,S.getContext())},S.id))},b.id)):r?c.jsx(Ue,{children:c.jsx(Pe,{colSpan:y.length,className:"h-24 text-center",children:"loading..."})}):c.jsx(Ue,{children:c.jsx(Pe,{colSpan:y.length,className:"h-24 text-center",children:"Không có kết quả."})})})]})}),c.jsx("div",{className:"mt-4",children:c.jsx(Zs,{children:c.jsxs(Qs,{children:[c.jsx(gt,{children:c.jsx(ei,{onClick:()=>u(b=>Math.max(1,b-1)),className:a===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:l},(b,S)=>S+1).filter(b=>b===1||b===l||Math.abs(b-a)<=1).map((b,S,E)=>c.jsxs(c.Fragment,{children:[S>0&&E[S-1]!==b-1&&c.jsx(gt,{children:c.jsx(ni,{})},b+"..."),c.jsx(gt,{children:c.jsx(Mn,{onClick:()=>u(b),isActive:a===b,className:`cursor-pointer ${r?"pointer-events-none":""}`,children:g===b?c.jsx(Ne,{className:"h-4 w-4 animate-spin"}):b})},b)]})),c.jsx(gt,{children:c.jsx(ti,{onClick:()=>u(b=>Math.min(l,b+1)),className:a===l||g!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})},id=10,ex=O.memo(({apiBaseUrl:e="http://localhost:3000"})=>{const[t,n]=O.useState(1),[r,o]=O.useState([]),[s,i]=O.useState({total:0,page:1,limit:id,totalPages:1}),[a,u]=O.useState(!0),[l,f]=O.useState(null),[g,m]=O.useState(new Set),{toast:p}=Cs(),[v,h]=O.useState(!1),y=async b=>{try{f(b);const S=await se.get(`${e}/api/jobs`,{params:{page:b.toString(),limit:id.toString()}});o(S.data.data),i(S.data.pagination)}catch{p({variant:"destructive",title:"Error",description:"Failed to fetch jobs. Please try again."})}finally{f(null),u(!1)}};O.useEffect(()=>{y(t)},[t,e]);const w=async b=>{m(S=>new Set(S).add(b.toString()));try{await new Promise(S=>setTimeout(S,2e3)),p({variant:"destructive",title:"Retry Failed",description:`Failed to restart job ${b}. Please try again.`}),y(t)}catch{p({variant:"destructive",title:"Retry Failed",description:`Failed to restart job ${b}. Please try again.`})}finally{m(S=>{const E=new Set(S);return E.delete(b.toString()),E})}},x=async()=>{h(!0),n(1),await y(1),h(!1)},N=b=>new Date(b).toLocaleString(),P=b=>{if(b=parseFloat(b),b<60)return`${b.toFixed(2)}s`;const S=Math.floor(b/60),E=(b%60).toFixed(0);return`${S}m ${E}s`};return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[c.jsx(Pp,{className:"w-8 h-8 text-primary"}),c.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Job Management"}),c.jsx(ue,{variant:"outline",size:"icon",onClick:x,disabled:v||a,className:"ml-2",children:c.jsx(Fp,{className:`h-4 w-4 ${v?"animate-spin":""}`})})]}),c.jsx("div",{className:"rounded-md border",children:c.jsxs(ur,{children:[c.jsx(dr,{children:c.jsxs(Ue,{children:[c.jsx(Qe,{children:"ID"}),c.jsx(Qe,{children:"Tên Công Việc"}),c.jsx(Qe,{children:"Thời Gian Bắt Đầu"}),c.jsx(Qe,{children:"Thời Gian Cập Nhật"}),c.jsx(Qe,{children:"Thời Gian Thực Thi"}),c.jsx(Qe,{children:"Trạng Thái"}),c.jsx(Qe,{children:"Thao Tác"})]})}),c.jsx(fr,{children:a&&r.length===0?c.jsx(Ue,{children:c.jsx(Pe,{colSpan:7,className:"text-center py-4",children:c.jsx(Ne,{className:"w-6 h-6 animate-spin mx-auto"})})}):r.map(b=>{var S,E;return c.jsxs(Ue,{children:[c.jsx(Pe,{className:"!w-[100px]",children:b.id}),c.jsx(Pe,{className:"font-medium",children:(S=b.job_name)==null?void 0:S.replace("Upload file","Summary")}),c.jsx(Pe,{className:"!w-[200px]",children:N(b.created_at)}),c.jsx(Pe,{className:"!w-[200px]",children:N(b.updated_at)}),c.jsx(Pe,{className:"!w-[150px]",children:P(b.execution_time_seconds)}),c.jsx(Pe,{className:"!w-[200px]",children:c.jsx("div",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium
|
|
131
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Wh="DialogDescriptionWarning",qh=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${El(Wh).contentName}}.`;return d.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Kh=ul,Xh=fl,Yh=gl,Nl=hl,Pl=ml,Tl=yl,Al=bl,Jh=Cl;const rn=Kh,lr=Xh,Zh=Yh,_l=d.forwardRef(({className:e,...t},n)=>c.jsx(Nl,{ref:n,className:J("s3-explr-ui-dialog-overlay fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));_l.displayName=Nl.displayName;const It=d.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Zh,{children:[c.jsx(_l,{}),c.jsxs(Pl,{ref:r,className:J("s3-explr-ui-dialog-content fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,c.jsxs(Jh,{className:J("s3-explr-ui-dialog-close absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"),children:[c.jsx(aa,{className:"s3-explr-ui-dialog-close-icon h-4 w-4"}),c.jsx("span",{className:"s3-explr-ui-dialog-close-text sr-only",children:"Close"})]})]})]}));It.displayName=Pl.displayName;const Lt=({className:e,...t})=>c.jsx("div",{className:J("s3-explr-ui-dialog-header flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Lt.displayName="DialogHeader";const cr=({className:e,...t})=>c.jsx("div",{className:J("s3-explr-ui-dialog-footer flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});cr.displayName="DialogFooter";const Vt=d.forwardRef(({className:e,...t},n)=>c.jsx(Tl,{ref:n,className:J("s3-explr-ui-dialog-title text-lg font-semibold leading-none tracking-tight",e),...t}));Vt.displayName=Tl.displayName;const Yo=d.forwardRef(({className:e,...t},n)=>c.jsx(Al,{ref:n,className:J("s3-explr-ui-dialog-description text-sm text-muted-foreground",e),...t}));Yo.displayName=Al.displayName;const Et=d.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:J("s3-explr-ui-input","flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));Et.displayName="Input";var Qh="Label",Fl=d.forwardRef((e,t)=>c.jsx(ve.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Fl.displayName=Qh;var Ol=Fl;const em=Fo("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 s3-explr-ui-label",{variants:{variant:{default:"s3-explr-ui-label-default",required:"s3-explr-ui-label-required",disabled:"s3-explr-ui-label-disabled"},size:{default:"s3-explr-ui-label-size-default",sm:"s3-explr-ui-label-size-sm",lg:"s3-explr-ui-label-size-lg"}},defaultVariants:{variant:"default",size:"default"}}),bn=d.forwardRef(({className:e,variant:t,size:n,...r},o)=>c.jsx(Ol,{ref:o,className:J(em({variant:t,size:n}),e),...r}));bn.displayName=Ol.displayName;const ur=d.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:J("relative w-full overflow-auto","s3-explr-ui-table-container"),children:c.jsx("table",{ref:n,className:J("w-full caption-bottom text-sm","s3-explr-ui-table",e),...t})}));ur.displayName="Table";const dr=d.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:J("[&_tr]:border-b","s3-explr-ui-table-header",e),...t}));dr.displayName="TableHeader";const fr=d.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:J("[&_tr:last-child]:border-0","s3-explr-ui-table-body",e),...t}));fr.displayName="TableBody";const tm=d.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:J("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0","s3-explr-ui-table-footer",e),...t}));tm.displayName="TableFooter";const Ue=d.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:J("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted","s3-explr-ui-table-row",e),...t}));Ue.displayName="TableRow";const Qe=d.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:J("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-head",e),...t}));Qe.displayName="TableHead";const Pe=d.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:J("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-cell",e),...t}));Pe.displayName="TableCell";const nm=d.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:J("mt-4 text-sm text-muted-foreground","s3-explr-ui-table-caption",e),...t}));nm.displayName="TableCaption";function Jo(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function on(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Dl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Zo(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Dl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Dl(e[o],null)}}}}function Qo(...e){return d.useCallback(Zo(...e),e)}var es=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(om);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ts,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ts,{...r,ref:t,children:n})});es.displayName="Slot";var ts=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=im(n);return d.cloneElement(n,{...sm(r,n.props),ref:t?Zo(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ts.displayName="SlotClone";var rm=({children:e})=>c.jsx(c.Fragment,{children:e});function om(e){return d.isValidElement(e)&&e.type===rm}function sm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function im(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function am(e){const t=e+"CollectionProvider",[n,r]=xt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:v,children:h}=p,y=O.useRef(null),w=O.useRef(new Map).current;return c.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=O.forwardRef((p,v)=>{const{scope:h,children:y}=p,w=s(a,h),x=Qo(v,w.collectionRef);return c.jsx(es,{ref:x,children:y})});u.displayName=a;const l=e+"CollectionItemSlot",f="data-radix-collection-item",g=O.forwardRef((p,v)=>{const{scope:h,children:y,...w}=p,x=O.useRef(null),N=Qo(v,x),P=s(l,h);return O.useEffect(()=>(P.itemMap.set(x,{ref:x,...w}),()=>void P.itemMap.delete(x))),c.jsx(es,{[f]:"",ref:N,children:y})});g.displayName=l;function m(p){const v=s(e+"CollectionConsumer",p);return O.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((P,b)=>w.indexOf(P.ref.current)-w.indexOf(b.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:g},m,r]}var Ml=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(cm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ns,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ns,{...r,ref:t,children:n})});Ml.displayName="Slot";var ns=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=dm(n);return d.cloneElement(n,{...um(r,n.props),ref:t?Zo(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ns.displayName="SlotClone";var lm=({children:e})=>c.jsx(c.Fragment,{children:e});function cm(e){return d.isValidElement(e)&&e.type===lm}function um(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function dm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Rl=fm.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Ml:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),pm=d.createContext(void 0);function kl(e){const t=d.useContext(pm);return e||t||"ltr"}var rs="rovingFocusGroup.onEntryFocus",gm={bubbles:!1,cancelable:!0},pr="RovingFocusGroup",[os,$l,hm]=am(pr),[mm,Il]=xt(pr,[hm]),[vm,ym]=mm(pr),Ll=d.forwardRef((e,t)=>c.jsx(os.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(os.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(wm,{...e,ref:t})})}));Ll.displayName=pr;var wm=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:l,preventScrollOnEntryFocus:f=!1,...g}=e,m=d.useRef(null),p=Qo(t,m),v=kl(s),[h=null,y]=Yt({prop:i,defaultProp:a,onChange:u}),[w,x]=d.useState(!1),N=Ce(l),P=$l(n),b=d.useRef(!1),[S,E]=d.useState(0);return d.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(rs,N),()=>R.removeEventListener(rs,N)},[N]),c.jsx(vm,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:h,onItemFocus:d.useCallback(R=>y(R),[y]),onItemShiftTab:d.useCallback(()=>x(!0),[]),onFocusableItemAdd:d.useCallback(()=>E(R=>R+1),[]),onFocusableItemRemove:d.useCallback(()=>E(R=>R-1),[]),children:c.jsx(Rl.div,{tabIndex:w||S===0?-1:0,"data-orientation":r,...g,ref:p,style:{outline:"none",...e.style},onMouseDown:on(e.onMouseDown,()=>{b.current=!0}),onFocus:on(e.onFocus,R=>{const U=!b.current;if(R.target===R.currentTarget&&U&&!w){const H=new CustomEvent(rs,gm);if(R.currentTarget.dispatchEvent(H),!H.defaultPrevented){const Z=P().filter(B=>B.focusable),F=Z.find(B=>B.active),$=Z.find(B=>B.id===h),G=[F,$,...Z].filter(Boolean).map(B=>B.ref.current);zl(G,f)}}b.current=!1}),onBlur:on(e.onBlur,()=>x(!1))})})}),Vl="RovingFocusGroupItem",Bl=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...i}=e,a=Zt(),u=s||a,l=ym(Vl,n),f=l.currentTabStopId===u,g=$l(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=l;return d.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),c.jsx(os.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:c.jsx(Rl.span,{tabIndex:f?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:on(e.onMouseDown,v=>{r?l.onItemFocus(u):v.preventDefault()}),onFocus:on(e.onFocus,()=>l.onItemFocus(u)),onKeyDown:on(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){l.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=Cm(v,l.orientation,l.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=g().filter(x=>x.focusable).map(x=>x.ref.current);if(h==="last")w.reverse();else if(h==="prev"||h==="next"){h==="prev"&&w.reverse();const x=w.indexOf(v.currentTarget);w=l.loop?Sm(w,x+1):w.slice(x+1)}setTimeout(()=>zl(w))}})})})});Bl.displayName=Vl;var bm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function xm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Cm(e,t,n){const r=xm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return bm[r]}function zl(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Sm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Em=Ll,Nm=Bl;function Hl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Pm(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Hl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Hl(e[o],null)}}}}function Tm(...e){return d.useCallback(Pm(...e),e)}function Am(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var Ul=e=>{const{present:t,children:n}=e,r=_m(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=Tm(r.ref,Fm(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Ul.displayName="Presence";function _m(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Am(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const l=gr(r.current);s.current=a==="mounted"?l:"none"},[a]),De(()=>{const l=r.current,f=o.current;if(f!==e){const m=s.current,p=gr(l);e?u("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?u("UNMOUNT"):u(f&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),De(()=>{if(t){let l;const f=t.ownerDocument.defaultView??window,g=p=>{const h=gr(r.current).includes(p.animationName);if(p.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=p=>{p.target===t&&(s.current=gr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{f.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function gr(e){return(e==null?void 0:e.animationName)||"none"}function Fm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function jl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Om(...e){return t=>{let n=!1;const r=e.map(o=>{const s=jl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():jl(e[o],null)}}}}var Gl=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Mm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ss,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ss,{...r,ref:t,children:n})});Gl.displayName="Slot";var ss=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=km(n);return d.cloneElement(n,{...Rm(r,n.props),ref:t?Om(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ss.displayName="SlotClone";var Dm=({children:e})=>c.jsx(c.Fragment,{children:e});function Mm(e){return d.isValidElement(e)&&e.type===Dm}function Rm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function km(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $m=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],hr=$m.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Gl:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),is="Tabs",[Im,xx]=xt(is,[Il]),Wl=Il(),[Lm,as]=Im(is),ql=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:u="automatic",...l}=e,f=kl(a),[g,m]=Yt({prop:r,onChange:o,defaultProp:s});return c.jsx(Lm,{scope:n,baseId:Zt(),value:g,onValueChange:m,orientation:i,dir:f,activationMode:u,children:c.jsx(hr.div,{dir:f,"data-orientation":i,...l,ref:t})})});ql.displayName=is;var Kl="TabsList",Xl=d.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=as(Kl,n),i=Wl(n);return c.jsx(Em,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:c.jsx(hr.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Xl.displayName=Kl;var Yl="TabsTrigger",Jl=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=as(Yl,n),a=Wl(n),u=ec(i.baseId,r),l=tc(i.baseId,r),f=r===i.value;return c.jsx(Nm,{asChild:!0,...a,focusable:!o,active:f,children:c.jsx(hr.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":l,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...s,ref:t,onMouseDown:Jo(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?i.onValueChange(r):g.preventDefault()}),onKeyDown:Jo(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(r)}),onFocus:Jo(e.onFocus,()=>{const g=i.activationMode!=="manual";!f&&!o&&g&&i.onValueChange(r)})})})});Jl.displayName=Yl;var Zl="TabsContent",Ql=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=as(Zl,n),u=ec(a.baseId,r),l=tc(a.baseId,r),f=r===a.value,g=d.useRef(f);return d.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),c.jsx(Ul,{present:o||f,children:({present:m})=>c.jsx(hr.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!m,id:l,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});Ql.displayName=Zl;function ec(e,t){return`${e}-trigger-${t}`}function tc(e,t){return`${e}-content-${t}`}var Vm=ql,nc=Xl,rc=Jl,oc=Ql;const Bm=Vm,sc=d.forwardRef(({className:e,...t},n)=>c.jsx(nc,{ref:n,className:J("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));sc.displayName=nc.displayName;const ls=d.forwardRef(({className:e,...t},n)=>c.jsx(rc,{ref:n,className:J("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));ls.displayName=rc.displayName;const cs=d.forwardRef(({className:e,...t},n)=>c.jsx(oc,{ref:n,className:J("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));cs.displayName=oc.displayName;const mr=d.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:J("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));mr.displayName="Textarea";function zm(e,t=[]){let n=[];function r(s,i){const a=d.createContext(i),u=n.length;n=[...n,i];function l(g){const{scope:m,children:p,...v}=g,h=(m==null?void 0:m[e][u])||a,y=d.useMemo(()=>v,Object.values(v));return c.jsx(h.Provider,{value:y,children:p})}function f(g,m){const p=(m==null?void 0:m[e][u])||a,v=d.useContext(p);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${g}\` must be used within \`${s}\``)}return l.displayName=s+"Provider",[l,f]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(a){const u=(a==null?void 0:a[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,Hm(o,...t)]}function Hm(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:u,scopeName:l})=>{const g=u(s)[`__scope${l}`];return{...a,...g}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var us=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(jm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return c.jsx(ds,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return c.jsx(ds,{...r,ref:t,children:n})});us.displayName="Slot";var ds=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Wm(n);return d.cloneElement(n,{...Gm(r,n.props),ref:t?Zn(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});ds.displayName="SlotClone";var Um=({children:e})=>c.jsx(c.Fragment,{children:e});function jm(e){return d.isValidElement(e)&&e.type===Um}function Gm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Wm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function qm(e){const t=e+"CollectionProvider",[n,r]=zm(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:v,children:h}=p,y=O.useRef(null),w=O.useRef(new Map).current;return c.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=O.forwardRef((p,v)=>{const{scope:h,children:y}=p,w=s(a,h),x=$e(v,w.collectionRef);return c.jsx(us,{ref:x,children:y})});u.displayName=a;const l=e+"CollectionItemSlot",f="data-radix-collection-item",g=O.forwardRef((p,v)=>{const{scope:h,children:y,...w}=p,x=O.useRef(null),N=$e(v,x),P=s(l,h);return O.useEffect(()=>(P.itemMap.set(x,{ref:x,...w}),()=>void P.itemMap.delete(x))),c.jsx(us,{[f]:"",ref:N,children:y})});g.displayName=l;function m(p){const v=s(e+"CollectionConsumer",p);return O.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((P,b)=>w.indexOf(P.ref.current)-w.indexOf(b.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:g},m,r]}var Km="VisuallyHidden",fs=d.forwardRef((e,t)=>c.jsx(ve.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));fs.displayName=Km;var ps="ToastProvider",[gs,Xm,Ym]=qm("Toast"),[ic,Cx]=xt("Toast",[Ym]),[Jm,vr]=ic(ps),ac=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,u]=d.useState(null),[l,f]=d.useState(0),g=d.useRef(!1),m=d.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${ps}\`. Expected non-empty \`string\`.`),c.jsx(gs.Provider,{scope:t,children:c.jsx(Jm,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:l,viewport:a,onViewportChange:u,onToastAdd:d.useCallback(()=>f(p=>p+1),[]),onToastRemove:d.useCallback(()=>f(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:m,children:i})})};ac.displayName=ps;var lc="ToastViewport",Zm=["F8"],hs="toast.viewportPause",ms="toast.viewportResume",cc=d.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Zm,label:o="Notifications ({hotkey})",...s}=e,i=vr(lc,n),a=Xm(n),u=d.useRef(null),l=d.useRef(null),f=d.useRef(null),g=d.useRef(null),m=$e(t,g,i.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=i.toastCount>0;d.useEffect(()=>{const y=w=>{var N;r.length!==0&&r.every(P=>w[P]||w.code===P)&&((N=g.current)==null||N.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),d.useEffect(()=>{const y=u.current,w=g.current;if(v&&y&&w){const x=()=>{if(!i.isClosePausedRef.current){const S=new CustomEvent(hs);w.dispatchEvent(S),i.isClosePausedRef.current=!0}},N=()=>{if(i.isClosePausedRef.current){const S=new CustomEvent(ms);w.dispatchEvent(S),i.isClosePausedRef.current=!1}},P=S=>{!y.contains(S.relatedTarget)&&N()},b=()=>{y.contains(document.activeElement)||N()};return y.addEventListener("focusin",x),y.addEventListener("focusout",P),y.addEventListener("pointermove",x),y.addEventListener("pointerleave",b),window.addEventListener("blur",x),window.addEventListener("focus",N),()=>{y.removeEventListener("focusin",x),y.removeEventListener("focusout",P),y.removeEventListener("pointermove",x),y.removeEventListener("pointerleave",b),window.removeEventListener("blur",x),window.removeEventListener("focus",N)}}},[v,i.isClosePausedRef]);const h=d.useCallback(({tabbingDirection:y})=>{const x=a().map(N=>{const P=N.ref.current,b=[P,...dv(P)];return y==="forwards"?b:b.reverse()});return(y==="forwards"?x.reverse():x).flat()},[a]);return d.useEffect(()=>{const y=g.current;if(y){const w=x=>{var b,S,E;const N=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!N){const R=document.activeElement,U=x.shiftKey;if(x.target===y&&U){(b=l.current)==null||b.focus();return}const F=h({tabbingDirection:U?"backwards":"forwards"}),$=F.findIndex(D=>D===R);ws(F.slice($+1))?x.preventDefault():U?(S=l.current)==null||S.focus():(E=f.current)==null||E.focus()}};return y.addEventListener("keydown",w),()=>y.removeEventListener("keydown",w)}},[a,h]),c.jsxs(zg,{ref:u,role:"region","aria-label":o.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&c.jsx(vs,{ref:l,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"forwards"});ws(y)}}),c.jsx(gs.Slot,{scope:n,children:c.jsx(ve.ol,{tabIndex:-1,...s,ref:m})}),v&&c.jsx(vs,{ref:f,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"backwards"});ws(y)}})]})});cc.displayName=lc;var uc="ToastFocusProxy",vs=d.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=vr(uc,n);return c.jsx(fs,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var l;const a=i.relatedTarget;!((l=s.viewport)!=null&&l.contains(a))&&r()}})});vs.displayName=uc;var yr="Toast",Qm="toast.swipeStart",ev="toast.swipeMove",tv="toast.swipeCancel",nv="toast.swipeEnd",dc=d.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a=!0,u]=Yt({prop:r,defaultProp:o,onChange:s});return c.jsx(Jt,{present:n||a,children:c.jsx(sv,{open:a,...i,ref:t,onClose:()=>u(!1),onPause:Ce(e.onPause),onResume:Ce(e.onResume),onSwipeStart:he(e.onSwipeStart,l=>{l.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:he(e.onSwipeMove,l=>{const{x:f,y:g}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","move"),l.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${g}px`)}),onSwipeCancel:he(e.onSwipeCancel,l=>{l.currentTarget.setAttribute("data-swipe","cancel"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:he(e.onSwipeEnd,l=>{const{x:f,y:g}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","end"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${g}px`),u(!1)})})})});dc.displayName=yr;var[rv,ov]=ic(yr,{onClose(){}}),sv=d.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:u,onResume:l,onSwipeStart:f,onSwipeMove:g,onSwipeCancel:m,onSwipeEnd:p,...v}=e,h=vr(yr,n),[y,w]=d.useState(null),x=$e(t,D=>w(D)),N=d.useRef(null),P=d.useRef(null),b=o||h.duration,S=d.useRef(0),E=d.useRef(b),R=d.useRef(0),{onToastAdd:U,onToastRemove:H}=h,Z=Ce(()=>{var G;(y==null?void 0:y.contains(document.activeElement))&&((G=h.viewport)==null||G.focus()),i()}),F=d.useCallback(D=>{!D||D===1/0||(window.clearTimeout(R.current),S.current=new Date().getTime(),R.current=window.setTimeout(Z,D))},[Z]);d.useEffect(()=>{const D=h.viewport;if(D){const G=()=>{F(E.current),l==null||l()},B=()=>{const q=new Date().getTime()-S.current;E.current=E.current-q,window.clearTimeout(R.current),u==null||u()};return D.addEventListener(hs,B),D.addEventListener(ms,G),()=>{D.removeEventListener(hs,B),D.removeEventListener(ms,G)}}},[h.viewport,b,u,l,F]),d.useEffect(()=>{s&&!h.isClosePausedRef.current&&F(b)},[s,b,h.isClosePausedRef,F]),d.useEffect(()=>(U(),()=>H()),[U,H]);const $=d.useMemo(()=>y?yc(y):null,[y]);return h.viewport?c.jsxs(c.Fragment,{children:[$&&c.jsx(iv,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:$}),c.jsx(rv,{scope:n,onClose:Z,children:kn.createPortal(c.jsx(gs.ItemSlot,{scope:n,children:c.jsx(Bg,{asChild:!0,onEscapeKeyDown:he(a,()=>{h.isFocusedToastEscapeKeyDownRef.current||Z(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(ve.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":h.swipeDirection,...v,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:he(e.onKeyDown,D=>{D.key==="Escape"&&(a==null||a(D.nativeEvent),D.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,Z()))}),onPointerDown:he(e.onPointerDown,D=>{D.button===0&&(N.current={x:D.clientX,y:D.clientY})}),onPointerMove:he(e.onPointerMove,D=>{if(!N.current)return;const G=D.clientX-N.current.x,B=D.clientY-N.current.y,q=!!P.current,K=["left","right"].includes(h.swipeDirection),te=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,ae=K?te(0,G):0,re=K?0:te(0,B),Ae=D.pointerType==="touch"?10:2,qe={x:ae,y:re},at={originalEvent:D,delta:qe};q?(P.current=qe,wr(ev,g,at,{discrete:!1})):wc(qe,h.swipeDirection,Ae)?(P.current=qe,wr(Qm,f,at,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(G)>Ae||Math.abs(B)>Ae)&&(N.current=null)}),onPointerUp:he(e.onPointerUp,D=>{const G=P.current,B=D.target;if(B.hasPointerCapture(D.pointerId)&&B.releasePointerCapture(D.pointerId),P.current=null,N.current=null,G){const q=D.currentTarget,K={originalEvent:D,delta:G};wc(G,h.swipeDirection,h.swipeThreshold)?wr(nv,p,K,{discrete:!0}):wr(tv,m,K,{discrete:!0}),q.addEventListener("click",te=>te.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),iv=e=>{const{__scopeToast:t,children:n,...r}=e,o=vr(yr,t),[s,i]=d.useState(!1),[a,u]=d.useState(!1);return cv(()=>i(!0)),d.useEffect(()=>{const l=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(l)},[]),a?null:c.jsx(Lo,{asChild:!0,children:c.jsx(fs,{...r,children:s&&c.jsxs(c.Fragment,{children:[o.label," ",n]})})})},av="ToastTitle",fc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});fc.displayName=av;var lv="ToastDescription",pc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});pc.displayName=lv;var gc="ToastAction",hc=d.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(vc,{altText:n,asChild:!0,children:c.jsx(ys,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${gc}\`. Expected non-empty \`string\`.`),null)});hc.displayName=gc;var mc="ToastClose",ys=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=ov(mc,n);return c.jsx(vc,{asChild:!0,children:c.jsx(ve.button,{type:"button",...r,ref:t,onClick:he(e.onClick,o.onClose)})})});ys.displayName=mc;var vc=d.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return c.jsx(ve.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function yc(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),uv(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...yc(r))}}),t}function wr(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ta(o,s):o.dispatchEvent(s)}var wc=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function cv(e=()=>{}){const t=Ce(e);De(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function uv(e){return e.nodeType===e.ELEMENT_NODE}function dv(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ws(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var fv=ac,bc=cc,xc=dc,Cc=fc,Sc=pc,Ec=hc,Nc=ys;const pv=fv,Pc=d.forwardRef(({className:e,...t},n)=>c.jsx(bc,{ref:n,className:J("s3-explr-ui-toast-viewport fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Pc.displayName=bc.displayName;const gv=Fo("s3-explr-ui-toast group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"s3-explr-ui-toast-default border bg-background text-foreground",destructive:"s3-explr-ui-toast-destructive destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Tc=d.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(xc,{ref:r,className:J(gv({variant:t}),e),...n}));Tc.displayName=xc.displayName;const hv=d.forwardRef(({className:e,...t},n)=>c.jsx(Ec,{ref:n,className:J("s3-explr-ui-toast-action inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));hv.displayName=Ec.displayName;const Ac=d.forwardRef(({className:e,...t},n)=>c.jsx(Nc,{ref:n,className:J("s3-explr-ui-toast-close absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:c.jsx(aa,{className:"s3-explr-ui-toast-close-icon h-4 w-4"})}));Ac.displayName=Nc.displayName;const _c=d.forwardRef(({className:e,...t},n)=>c.jsx(Cc,{ref:n,className:J("s3-explr-ui-toast-title text-sm font-semibold [&+div]:text-xs",e),...t}));_c.displayName=Cc.displayName;const Fc=d.forwardRef(({className:e,...t},n)=>c.jsx(Sc,{ref:n,className:J("s3-explr-ui-toast-description text-sm opacity-90",e),...t}));Fc.displayName=Sc.displayName;const mv=1,vv=1e6;let bs=0;function yv(){return bs=(bs+1)%Number.MAX_SAFE_INTEGER,bs.toString()}const xs=new Map,Oc=e=>{if(xs.has(e))return;const t=setTimeout(()=>{xs.delete(e),xn({type:"REMOVE_TOAST",toastId:e})},vv);xs.set(e,t)},wv=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,mv)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Oc(n):e.toasts.forEach(r=>{Oc(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},br=[];let xr={toasts:[]};function xn(e){xr=wv(xr,e),br.forEach(t=>{t(xr)})}function bv({...e}){const t=yv(),n=o=>xn({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>xn({type:"DISMISS_TOAST",toastId:t});return xn({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function Cs(){const[e,t]=d.useState(xr);return d.useEffect(()=>(br.push(t),()=>{const n=br.indexOf(t);n>-1&&br.splice(n,1)}),[e]),{...e,toast:bv,dismiss:n=>xn({type:"DISMISS_TOAST",toastId:n})}}function Dc(){const{toasts:e}=Cs();return c.jsxs(pv,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return c.jsxs(Tc,{...s,className:`s3-explr-ui-toast ${s.className||""}`,children:[c.jsxs("div",{className:"s3-explr-ui-toast-content grid gap-1",children:[n&&c.jsx(_c,{className:"s3-explr-ui-toast-title",children:n}),r&&c.jsx(Fc,{className:"s3-explr-ui-toast-description",children:r})]}),o&&c.jsx("div",{className:"s3-explr-ui-toast-action",children:o}),c.jsx(Ac,{className:"s3-explr-ui-toast-close"})]},t)}),c.jsx(Pc,{className:"s3-explr-ui-toast-viewport"})]})}function xv({title:e,titleId:t,...n},r){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Cv=d.forwardRef(xv);var Sv=function(e){return function(t,n){var r=O.useRef(!1);e(function(){return function(){r.current=!1}},[]),e(function(){if(!r.current)r.current=!0;else return t()},n)}},Mc=function(e){return typeof e=="function"},Rc=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";const Ev=Sv(O.useEffect);function kc(e){var t=O.useRef(e);return t.current=e,t}var Nv=function(e){Rc&&(Mc(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e)));var t=kc(e);O.useEffect(function(){return function(){t.current()}},[])},Cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Tv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var $c=Tv,Av=typeof Cr=="object"&&Cr&&Cr.Object===Object&&Cr,_v=Av,Fv=_v,Ov=typeof self=="object"&&self&&self.Object===Object&&self,Dv=Fv||Ov||Function("return this")(),Ic=Dv,Mv=Ic,Rv=function(){return Mv.Date.now()},kv=Rv,$v=/\s/;function Iv(e){for(var t=e.length;t--&&$v.test(e.charAt(t)););return t}var Lv=Iv,Vv=Lv,Bv=/^\s+/;function zv(e){return e&&e.slice(0,Vv(e)+1).replace(Bv,"")}var Hv=zv,Uv=Ic,jv=Uv.Symbol,Lc=jv,Vc=Lc,Bc=Object.prototype,Gv=Bc.hasOwnProperty,Wv=Bc.toString,Cn=Vc?Vc.toStringTag:void 0;function qv(e){var t=Gv.call(e,Cn),n=e[Cn];try{e[Cn]=void 0;var r=!0}catch{}var o=Wv.call(e);return r&&(t?e[Cn]=n:delete e[Cn]),o}var Kv=qv,Xv=Object.prototype,Yv=Xv.toString;function Jv(e){return Yv.call(e)}var Zv=Jv,zc=Lc,Qv=Kv,ey=Zv,ty="[object Null]",ny="[object Undefined]",Hc=zc?zc.toStringTag:void 0;function ry(e){return e==null?e===void 0?ny:ty:Hc&&Hc in Object(e)?Qv(e):ey(e)}var oy=ry;function sy(e){return e!=null&&typeof e=="object"}var iy=sy,ay=oy,ly=iy,cy="[object Symbol]";function uy(e){return typeof e=="symbol"||ly(e)&&ay(e)==cy}var dy=uy,fy=Hv,Uc=$c,py=dy,jc=NaN,gy=/^[-+]0x[0-9a-f]+$/i,hy=/^0b[01]+$/i,my=/^0o[0-7]+$/i,vy=parseInt;function yy(e){if(typeof e=="number")return e;if(py(e))return jc;if(Uc(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Uc(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=fy(e);var n=hy.test(e);return n||my.test(e)?vy(e.slice(2),n?2:8):gy.test(e)?jc:+e}var wy=yy,by=$c,Ss=kv,Gc=wy,xy="Expected a function",Cy=Math.max,Sy=Math.min;function Ey(e,t,n){var r,o,s,i,a,u,l=0,f=!1,g=!1,m=!0;if(typeof e!="function")throw new TypeError(xy);t=Gc(t)||0,by(n)&&(f=!!n.leading,g="maxWait"in n,s=g?Cy(Gc(n.maxWait)||0,t):s,m="trailing"in n?!!n.trailing:m);function p(S){var E=r,R=o;return r=o=void 0,l=S,i=e.apply(R,E),i}function v(S){return l=S,a=setTimeout(w,t),f?p(S):i}function h(S){var E=S-u,R=S-l,U=t-E;return g?Sy(U,s-R):U}function y(S){var E=S-u,R=S-l;return u===void 0||E>=t||E<0||g&&R>=s}function w(){var S=Ss();if(y(S))return x(S);a=setTimeout(w,h(S))}function x(S){return a=void 0,m&&r?p(S):(r=o=void 0,i)}function N(){a!==void 0&&clearTimeout(a),l=0,r=u=o=a=void 0}function P(){return a===void 0?i:x(Ss())}function b(){var S=Ss(),E=y(S);if(r=arguments,o=this,u=S,E){if(a===void 0)return v(u);if(g)return clearTimeout(a),a=setTimeout(w,t),p(u)}return a===void 0&&(a=setTimeout(w,t)),i}return b.cancel=N,b.flush=P,b}var Ny=Ey;const Py=Pv(Ny);function Ty(){var e=(typeof global>"u"?"undefined":typeof global)=="object"&&global&&global.Object===Object&&global,t=typeof self=="object"&&self&&self.Object===Object&&self;return e||t}Ty()||(global.Date=Date);function Ay(e,t){var n;Rc&&(Mc(e)||console.error("useDebounceFn expected parameter is a function, got ".concat(typeof e)));var r=kc(e),o=(n=t==null?void 0:t.wait)!==null&&n!==void 0?n:1e3,s=O.useMemo(function(){return Py(function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return r.current.apply(r,Ka([],qa(i),!1))},o,t)},[]);return Nv(function(){s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}}function _y(e,t,n){var r=qa(O.useState({}),2),o=r[0],s=r[1],i=Ay(function(){s({})},n).run;O.useEffect(function(){return i()},t),Ev(e,[o])}const Fy=O.forwardRef(({onChange:e},t)=>{const n=O.useRef(null),[r,o]=O.useState("");return O.useImperativeHandle(t,()=>({setValue:s=>{var i;o(s),(i=n.current)==null||i.focus()}})),_y(()=>{e==null||e(r)},[r],{wait:300}),c.jsxs(c.Fragment,{children:[c.jsx(Et,{ref:n,type:"text",placeholder:"Search files...",value:r,onChange:s=>o(s.target.value),className:"pr-8"}),r&&c.jsx("button",{onClick:()=>{var s;o(""),(s=n.current)==null||s.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700",children:c.jsx(Cv,{className:"h-5 w-5"})})]})}),et={current:!1},Oy=(e,t,n)=>{const r=[],o=s=>{(e[s]||[]).forEach(a=>{a.name.toLowerCase().includes(t.toLowerCase())&&r.push(a),a.isFolder&&a.key.startsWith(n)&&o(a.key)})};return o(n),r},Sr=(e,t)=>{const n=[],r=o=>{(e[o]||[]).forEach(i=>{n.push(i.key),i.isFolder&&r(i.key)})};return r(t),n},Dy=(e,t)=>{const n=[];return(e[t]||[]).forEach(o=>{n.push(o.key),o.isFolder&&n.push(...Sr(e,o.key))}),n},My=(e,t)=>{const[n,r]=O.useState({}),[o,s]=O.useState(!1),[i,a]=O.useState(null),u=async()=>{s(!0);try{const l=!et.current;et.current&&(et.current=!1);const f=await se.get(`${e}/api/files`,{params:{cache:l,prefix:t}});r(f.data),a(null)}catch(l){a(l instanceof Error?l:new Error("Failed to fetch files"))}finally{s(!1)}};return O.useEffect(()=>{u()},[]),{data:n,isLoading:o,error:i,refetch:u}},Er=e=>{var r,o,s;const t=((s=(o=(r=e==null?void 0:e.name)==null?void 0:r.split("."))==null?void 0:o.pop())==null?void 0:s.toLowerCase())??"";return["txt","md","json","js","ts","jsx","tsx","css","html","xml","yaml","yml"].includes(t||"")},Ry=O.memo(({homeLabel:e="Document Store",apiBaseUrl:t="http://localhost:3000",rootPrefix:n="",asSelector:r=!1,onSelected:o=s=>console.log("selected:",s)})=>{const[s,i]=O.useState(""),[a,u]=O.useState(new Set),[l,f]=O.useState(n),[g,m]=O.useState(!1),[p,v]=O.useState(""),[h,y]=O.useState(!1),[w,x]=O.useState(null),[N,P]=O.useState(!1),[b,S]=O.useState(!1),[E,R]=O.useState(!1),[U,H]=O.useState(null),Z=O.useRef(null),{toast:F}=Cs(),[$,D]=O.useState(null),[G,B]=O.useState(""),[q,K]=O.useState(!1),[te,ae]=O.useState(new Set),[re,Ae]=O.useState(""),[qe,at]=O.useState(!1),[Ht,_t]=O.useState(!1),[Ft,Ke]=O.useState("rename"),{data:we={},isLoading:Ot,error:Ut,refetch:Le}=My(t,n),Xe=O.useMemo(()=>we[l]||[],[we,l]),ke=O.useMemo(()=>s?Oy(we,s,l):Xe,[Xe,s,l,we]),Dt=O.useMemo(()=>{const M={};return ke.forEach((I,j)=>{a.has(I.key)&&(M[j]=!0)}),M},[a,ke]),jr=M=>{const I=Sr(we,M);if(I.length===0)return a.has(M)?"all":"none";const j=I.filter(oe=>a.has(oe)).length;return j===0?"none":j===I.length?"all":"partial"},jt=M=>{f(M)},C=async(M,I)=>{y(!0);try{const j=`${I}${M}/`;if((await se.post(`${t}/api/create-folder`,{prefix:j})).status!==200){F({title:"Error",description:"Failed to create folder",variant:"destructive"});return}et.current=!0,await Le(),F({title:"Folder Created",description:`Successfully created folder "${M}"`}),v(""),m(!1)}catch(j){console.error("Error creating folder:",j),F({title:"Error",description:"Failed to create folder",variant:"destructive"})}finally{y(!1)}},T=async(M,I,j)=>{H(j);try{const oe=new FormData;oe.append("prefix",I),Array.from(M).forEach(fe=>{fe instanceof File&&oe.append("files",fe)}),(await se.post(`${t}/api/upload`,oe,{headers:{"Content-Type":"multipart/form-data"}})).status===200&&(et.current=!0,await Le(),F({title:"Files Uploaded",description:`Successfully uploaded ${M.length} files`}))}catch(oe){console.error("Error uploading files:",oe),F({title:"Error",description:"Failed to upload files",variant:"destructive"})}finally{H(null)}},_=async M=>{P(!0);try{await se.delete(`${t}/api/files`,{data:{paths:[M.key]}}),et.current=!0,await Le(),F({title:"File Deleted",description:`Successfully deleted "${M.name}"`}),x(null)}catch(I){console.error("Error deleting file:",I),F({title:"Error",description:"Failed to delete file",variant:"destructive"})}finally{P(!1)}},V=M=>{const I=new Set(a),j=typeof M=="function"?M(Dt):M;new Set(Object.keys(Dt).map(Number)).forEach(ie=>{const fe=ke[ie];fe&&(j[ie]||(I.delete(fe.key),fe.isFolder&&Sr(we,fe.key).forEach(_e=>I.delete(_e))))}),Object.entries(j).forEach(([ie,fe])=>{const _e=parseInt(ie),ht=ke[_e];ht&&fe&&(I.add(ht.key),ht.isFolder&&Sr(we,ht.key).forEach(oi=>I.add(oi)))}),u(I)},L=async()=>{S(!0);try{const M=Array.from(a).map(I=>{var j;for(const oe in we){const ie=(j=we[oe])==null?void 0:j.find(fe=>fe.key===I);if(ie)return ie}return null}).filter(I=>I!==null);await se.delete(`${t}/api/files`,{data:{paths:Array.from(a)}}),et.current=!0,await Le(),F({title:"Files Deleted",description:`Successfully deleted ${M.length} items`}),R(!1),u(new Set)}catch(M){console.error("Error deleting files:",M),F({title:"Error",description:"Failed to delete selected files",variant:"destructive"})}finally{S(!1)}},k=async(M,I)=>{K(!0);try{const j=M.key;let oe;M.isFolder?oe=j.split("/").slice(0,-2).join("/")+"/":oe=j.substring(0,j.lastIndexOf("/")+1);const ie=oe+I+(M.isFolder?"/":"");await se.post(`${t}/api/rename`,{oldPath:j,newPath:ie}),et.current=!0,await Le(),F({title:"Item Renamed",description:`Successfully renamed "${M.name}" to "${I}"`}),D(null),B("")}catch(j){console.error("Error renaming item:",j),F({title:"Error",description:"Failed to rename item",variant:"destructive"})}finally{K(!1)}},W=async M=>{ae(I=>new Set([...I,...M]));try{const I=await se.post(`${t}/api/download`,{paths:M},{responseType:"blob"}),j=window.URL.createObjectURL(I.data),oe=document.createElement("a");oe.href=j;const ie=I.headers["Content-Disposition"]||I.headers["content-disposition"],fe=ie==null?void 0:ie.match(/filename="(.+)"/),_e=fe?decodeURIComponent(fe[1]):"download.zip";oe.setAttribute("download",_e),document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),window.URL.revokeObjectURL(j),F({title:"Download Started",description:`Your download has started for ${M.length} item${M.length>1?"s":""}`})}catch(I){console.error("Error downloading files:",I),F({title:"Error",description:"Failed to download files",variant:"destructive"})}finally{ae(I=>{const j=new Set(I);return M.forEach(oe=>j.delete(oe)),j})}},ne=l?l.replace(n,"").split("/").filter(Boolean):[],me=()=>Array.from(a).map(M=>{var I;for(const j in we){const oe=(I=we[j])==null?void 0:I.find(ie=>ie.key===M);if(oe)return oe}return null}).filter(M=>M!==null),ge=O.useMemo(()=>{const M=[{id:"select",header:()=>{const I=Dy(we,l),j=I.length>0&&I.every(ie=>a.has(ie)),oe=I.some(ie=>a.has(ie));return c.jsx(Mo,{checked:j?!0:oe?"indeterminate":!1,onCheckedChange:ie=>{if(ie){const fe=ke.reduce((_e,ht,oi)=>(_e[oi]=!0,_e),{});V(fe)}else V({})},"aria-label":"Select all"})},cell:({row:I})=>{const j=I.original,ie=j.isFolder?jr(j.key):a.has(j.key)?"all":"none";return c.jsx("div",{className:"flex items-center",children:c.jsx(Mo,{checked:ie==="partial"?"indeterminate":ie==="all",onCheckedChange:fe=>{const _e={...Dt};fe?_e[I.index]=!0:delete _e[I.index],V(_e)},"aria-label":"Select row"})})},enableSorting:!1},{id:"fileName",header:"File Name",accessorKey:"name",cell:({row:I})=>{const j=I.original,oe=j.key.substring(0,j.key.lastIndexOf("/"))||"/",ie=s.trim()!==""&&oe!==l,fe=oe.split("/").filter(Boolean);return c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("div",{className:`flex items-center gap-2 ${j.isFolder?"cursor-pointer hover:text-blue-600":""}`,onClick:()=>{j.isFolder&&jt(j.key)},children:[j.isFolder?c.jsx(Wr,{className:"h-5 w-5 text-blue-500"}):null,j.name]}),ie&&c.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[c.jsx(Wr,{className:"h-4 w-4 text-gray-500 my-auto"}),c.jsxs("span",{className:"flex items-center ml-1",children:[c.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{jt("")},children:"/"}),fe.map((_e,ht)=>c.jsxs("span",{className:"flex items-center",children:[c.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{jt(fe.slice(0,ht+1).join("/")+"/")},children:_e}),ht<fe.length-1&&c.jsx("span",{children:"/"})]},ht))]})]})]})}}];return r||M.push({id:"size",header:"Size",accessorKey:"size",cell:({getValue:I,row:j})=>{const oe=I();return c.jsx("span",{children:j.original.isFolder?"-":fg(oe)})}},{id:"lastModified",header:"Last Modified",accessorKey:"lastModified",cell:({row:I})=>{const j=I.original.lastModified;return c.jsx("span",{children:j.toLocaleString()})}},{id:"actions",header:"Actions",accessorKey:"key",cell:({row:I})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>W([I.original.key]),className:"h-8 w-8 p-0",disabled:te.has(I.original.key),children:te.has(I.original.key)?c.jsx(Ne,{className:"h-4 w-4 animate-spin"}):c.jsx(ii,{className:"h-4 w-4"})}),c.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>{D(I.original),B(I.original.name)},className:"h-8 w-8 p-0",children:c.jsx(md,{className:"h-4 w-4"})}),c.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>x(I.original),className:"h-8 w-8 p-0",children:c.jsx(ai,{className:"h-4 w-4"})})]})}),M},[a,ke,Dt,te,r]),Ye=bi({data:ke,columns:ge,state:{rowSelection:Dt},enableRowSelection:!0,onRowSelectionChange:V,getCoreRowModel:wi()}),ri=async M=>{if(Er(M)){at(!0);try{const I=await se.get(`${t}/api/read-text`,{params:{path:M.key}});Ae(I.data.content)}catch(I){console.error("Error loading file content:",I),F({title:"Error",description:"Failed to load file content",variant:"destructive"})}finally{at(!1)}}},Rn=async(M,I)=>{_t(!0);try{await se.post(`${t}/api/modify-text`,{path:M.key,content:I}),F({title:"File Saved",description:"File content has been updated successfully"}),et.current=!0,await Le(),D(null),Ae(""),Ke("rename")}catch(j){console.error("Error saving file content:",j),F({title:"Error",description:"Failed to save file content",variant:"destructive"})}finally{_t(!1)}};return O.useEffect(()=>{$&&Er($)&&(ri($),Ke("rename"))},[$]),c.jsxs("div",{className:"space-y-4 s3-explr-container",children:[c.jsx(wa,{className:"s3-explr-breadcrumb",children:c.jsxs(ba,{className:"s3-explr-breadcrumb-list",children:[c.jsx(Ao,{className:"s3-explr-breadcrumb-item",children:c.jsx(_o,{onClick:()=>f(n),className:"flex items-center gap-1 cursor-pointer s3-explr-breadcrumb-home",children:e})}),ne.map((M,I)=>c.jsxs(c.Fragment,{children:[c.jsx(xa,{className:"s3-explr-breadcrumb-separator"},`sep-${I}`),c.jsx(Ao,{className:"s3-explr-breadcrumb-item",children:c.jsx(_o,{onClick:()=>jt(n+ne.slice(0,I+1).join("/")+"/"),className:"cursor-pointer s3-explr-breadcrumb-link",children:M})},`item-${M}`)]}))]})}),c.jsxs("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:[c.jsx("div",{className:"relative max-w-sm w-full s3-explr-search-container",children:c.jsx(Fy,{ref:Z,onChange:M=>i(M)})}),c.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>{et.current=!0,Le()},disabled:Ot,className:"flex items-center gap-2 s3-explr-refresh-btn",children:[c.jsx(cd,{className:`h-4 w-4 s3-explr-refresh-icon ${Ot?"animate-spin":""}`}),"Refresh"]}),!r&&c.jsxs(c.Fragment,{children:[a.size>0&&c.jsxs(c.Fragment,{children:[c.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>W(Array.from(a)),disabled:Array.from(a).some(M=>te.has(M)),className:"flex items-center gap-2 s3-explr-download-selected-btn",children:[Array.from(a).some(M=>te.has(M))?c.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}):c.jsx(ii,{className:"h-4 w-4 s3-explr-download-icon"}),"Download Selected (",a.size,")"]}),c.jsxs(rn,{open:E,onOpenChange:R,children:[c.jsx(lr,{asChild:!0,children:c.jsxs(ue,{variant:"destructive",size:"sm",className:"flex items-center gap-2 s3-explr-bulk-delete-btn",children:[c.jsx(ai,{className:"h-4 w-4 s3-explr-trash-icon"}),"Remove Selected (",a.size,")"]})}),c.jsxs(It,{className:"s3-explr-dialog-content",children:[c.jsxs(Lt,{className:"s3-explr-dialog-header",children:[c.jsx(Vt,{className:"s3-explr-dialog-title",children:"Confirm Bulk Deletion"}),c.jsxs(Yo,{className:"s3-explr-dialog-description",children:["Are you sure you want to delete ",a.size," selected items? This action cannot be undone."]})]}),c.jsxs(cr,{className:"s3-explr-dialog-footer",children:[c.jsx(ue,{variant:"outline",onClick:()=>R(!1),className:"s3-explr-cancel-btn",children:"Cancel"}),c.jsx(ue,{variant:"destructive",onClick:L,disabled:b,className:"s3-explr-confirm-delete-btn",children:b?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Deleting..."]}):"Delete Selected"})]})]})]})]}),c.jsxs(rn,{open:g,onOpenChange:m,children:[c.jsx(lr,{asChild:!0,children:c.jsxs(ue,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-new-folder-btn",children:[c.jsx(pd,{className:"h-4 w-4 s3-explr-folder-plus-icon"}),"New Folder"]})}),c.jsxs(It,{className:"s3-explr-dialog-content",children:[c.jsx(Lt,{className:"s3-explr-dialog-header",children:c.jsx(Vt,{className:"s3-explr-dialog-title",children:"Create New Folder"})}),c.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[c.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[c.jsx(bn,{htmlFor:"name",className:"s3-explr-label",children:"Folder Name"}),c.jsx(Et,{disabled:h,id:"name",value:p,onChange:M=>v(M.target.value),placeholder:"Enter folder name",className:"s3-explr-input"})]}),c.jsxs(ue,{onClick:()=>{p.trim()&&C(p,l)},disabled:h,className:"s3-explr-create-btn",children:[h&&c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),h?"Creating...":"Create"]})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2 s3-explr-upload-group",children:[c.jsx(ue,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-files-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.onchange=I=>{const j=I.target.files;j&&T(j,l,"files")},M.click()},disabled:U!==null,children:U==="files"?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Uploading..."]}):c.jsxs(c.Fragment,{children:[c.jsx(dd,{className:"h-4 w-4 s3-explr-upload-icon"}),"Upload Files"]})}),c.jsx(ue,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-folder-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.webkitdirectory=!0,M.onchange=I=>{const j=I.target.files;j&&T(j,l,"folder")},M.click()},disabled:U!==null,children:U==="folder"?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Uploading..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Wr,{className:"h-4 w-4 s3-explr-folder-icon"}),"Upload Folder"]})})]}),c.jsx(rn,{open:!!w,onOpenChange:M=>!M&&x(null),children:c.jsxs(It,{className:"s3-explr-dialog-content",children:[c.jsxs(Lt,{className:"s3-explr-dialog-header",children:[c.jsx(Vt,{className:"s3-explr-dialog-title",children:"Confirm Deletion"}),c.jsxs(Yo,{className:"s3-explr-dialog-description",children:["Are you sure you want to delete ",w==null?void 0:w.name,"? This action cannot be undone."]})]}),c.jsxs(cr,{className:"s3-explr-dialog-footer",children:[c.jsx(ue,{variant:"outline",onClick:()=>x(null),className:"s3-explr-cancel-btn",children:"Cancel"}),c.jsx(ue,{variant:"destructive",onClick:()=>_(w),disabled:N,className:"s3-explr-confirm-delete-btn",children:N?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Deleting..."]}):"Delete"})]})]})}),c.jsx(rn,{open:!!$,onOpenChange:M=>{M||(D(null),B(""),Ae(""),Ke("rename"))},children:c.jsxs(It,{className:"s3-explr-dialog-content max-w-2xl",children:[c.jsx(Lt,{className:"s3-explr-dialog-header",children:c.jsx(Vt,{className:"s3-explr-dialog-title",children:$!=null&&$.isFolder?"Rename Folder":Er($)?"Manage File":"Rename File"})}),$&&!$.isFolder&&Er($)?c.jsxs(Bm,{value:Ft,onValueChange:M=>Ke(M),children:[c.jsxs(sc,{className:"grid w-full grid-cols-2",children:[c.jsx(ls,{value:"rename",children:"Rename"}),c.jsx(ls,{value:"edit",children:"Edit Content"})]}),c.jsx(cs,{value:"rename",children:c.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:c.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[c.jsx(bn,{htmlFor:"newName",className:"s3-explr-label",children:"New Name"}),c.jsx(Et,{id:"newName",value:G,onChange:M=>B(M.target.value),placeholder:"Enter new name",disabled:q,className:"s3-explr-input"})]})})}),c.jsx(cs,{value:"edit",children:c.jsx("div",{className:"space-y-4 py-4",children:qe?c.jsx("div",{className:"flex items-center justify-center py-4",children:c.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):c.jsxs("div",{className:"space-y-2",children:[c.jsx(bn,{htmlFor:"content",className:"s3-explr-label",children:"File Content"}),c.jsx(mr,{id:"content",value:re,onChange:M=>Ae(M.target.value),placeholder:"Enter file content",className:"min-h-[200px] font-mono",disabled:Ht})]})})})]}):c.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:c.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[c.jsx(bn,{htmlFor:"newName",className:"s3-explr-label",children:"New Name"}),c.jsx(Et,{id:"newName",value:G,onChange:M=>B(M.target.value),placeholder:"Enter new name",disabled:q,className:"s3-explr-input"})]})}),c.jsxs(cr,{className:"s3-explr-dialog-footer",children:[c.jsx(ue,{variant:"outline",onClick:()=>{D(null),B(""),Ae("")},className:"s3-explr-cancel-btn",children:"Cancel"}),Ft==="edit"?c.jsx(ue,{onClick:()=>$&&Rn($,re),disabled:Ht||qe,className:"s3-explr-save-btn",children:Ht?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Saving..."]}):"Save Changes"}):c.jsx(ue,{onClick:()=>{G.trim()&&$&&k($,G.trim())},disabled:q||!G.trim()||G.trim()===($==null?void 0:$.name),className:"s3-explr-rename-btn",children:q?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Renaming..."]}):"Rename"})]})]})})]})]}),Ut&&c.jsx("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative s3-explr-error",children:"An error occurred while fetching files"}),c.jsx("div",{className:"rounded-md border s3-explr-table-container",children:c.jsxs(ur,{className:"s3-explr-table",children:[c.jsx(dr,{className:"s3-explr-table-header",children:Ye.getHeaderGroups().map(M=>c.jsx(Ue,{className:"hover:bg-transparent s3-explr-header-row",children:M.headers.map(I=>c.jsx(Qe,{className:"s3-explr-header-cell",children:I.isPlaceholder?null:Bn(I.column.columnDef.header,I.getContext())},I.id))},M.id))}),c.jsx(fr,{className:"s3-explr-table-body",children:Ye.getRowModel().rows.length===0?c.jsx(Ue,{className:"s3-explr-empty-row",children:c.jsx(Pe,{colSpan:ge.length,className:"h-24 text-center s3-explr-empty-cell",children:s?c.jsxs("div",{className:"text-gray-500 s3-explr-no-results",children:['No files or folders found matching "',s,'"']}):c.jsx("div",{className:"text-gray-500 s3-explr-empty-message",children:Ot?"Retrieving folder contents... Please wait":"This folder contains no files or subdirectories"})})}):Ye.getRowModel().rows.map(M=>c.jsx(Ue,{className:"h-12 s3-explr-row",children:M.getVisibleCells().map(I=>c.jsx(Pe,{className:"align-middle s3-explr-cell",children:Bn(I.column.columnDef.cell,I.getContext())},I.id))},M.id))})]})}),r&&o&&c.jsxs("div",{className:"flex justify-between items-center mt-4 s3-explr-selector-footer",children:[c.jsxs("div",{className:"text-sm text-gray-500 s3-explr-selection-count",children:[a.size," ",a.size===1?"file":"files"," selected"]}),c.jsx(ue,{variant:"default",onClick:()=>o(me()),disabled:a.size===0,className:"s3-explr-ok-btn",children:"OK"})]}),!r&&c.jsx(Dc,{})]})});var Sn=e=>e.type==="checkbox",Bt=e=>e instanceof Date,Se=e=>e==null;const Wc=e=>typeof e=="object";var pe=e=>!Se(e)&&!Array.isArray(e)&&Wc(e)&&!Bt(e),ky=e=>pe(e)&&e.target?Sn(e.target)?e.target.checked:e.target.value:e,$y=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Iy=(e,t)=>e.has($y(t)),Ly=e=>{const t=e.constructor&&e.constructor.prototype;return pe(t)&&t.hasOwnProperty("isPrototypeOf")},Es=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ie(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Es&&(e instanceof Blob||r))&&(n||pe(e)))if(t=n?[]:{},!n&&!Ly(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Ie(e[o]));else return e;return t}var Nr=e=>Array.isArray(e)?e.filter(Boolean):[],de=e=>e===void 0,z=(e,t,n)=>{if(!t||!pe(e))return n;const r=Nr(t.split(/[,[\].]+?/)).reduce((o,s)=>Se(o)?o:o[s],e);return de(r)||r===e?de(e[t])?n:e[t]:r},tt=e=>typeof e=="boolean",Ns=e=>/^\w*$/.test(e),qc=e=>Nr(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(e,t,n)=>{let r=-1;const o=Ns(t)?[t]:qc(t),s=o.length,i=s-1;for(;++r<s;){const a=o[r];let u=n;if(r!==i){const l=e[a];u=pe(l)||Array.isArray(l)?l:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=u,e=e[a]}return e};const Kc={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},je={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ut={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};O.createContext(null);var Vy=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==je.all&&(t._proxyFormState[i]=!r||je.all),e[i]}});return o},Te=e=>pe(e)&&!Object.keys(e).length,By=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return Te(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===je.all)},Pr=e=>Array.isArray(e)?e:[e];function zy(e){const t=O.useRef(e);t.current=e,O.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var nt=e=>typeof e=="string",Hy=(e,t,n,r,o)=>nt(e)?(r&&t.watch.add(e),z(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),z(n,s))):(r&&(t.watchAll=!0),n),Uy=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Xc=e=>({isOnSubmit:!e||e===je.onSubmit,isOnBlur:e===je.onBlur,isOnChange:e===je.onChange,isOnAll:e===je.all,isOnTouch:e===je.onTouched}),Yc=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const En=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=z(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)return!0;if(i.ref&&t(i.ref,i.name)&&!r)return!0;if(En(a,t))break}else if(pe(a)&&En(a,t))break}}};var jy=(e,t,n)=>{const r=Pr(z(e,n));return ce(r,"root",t[n]),ce(e,n,r),e},Ps=e=>e.type==="file",rt=e=>typeof e=="function",Tr=e=>{if(!Es)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ar=e=>nt(e),Ts=e=>e.type==="radio",_r=e=>e instanceof RegExp;const Jc={value:!1,isValid:!1},Zc={value:!0,isValid:!0};var Qc=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!de(e[0].attributes.value)?de(e[0].value)||e[0].value===""?Zc:{value:e[0].value,isValid:!0}:Zc:Jc}return Jc};const eu={isValid:!1,value:null};var tu=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,eu):eu;function nu(e,t,n="validate"){if(Ar(e)||Array.isArray(e)&&e.every(Ar)||tt(e)&&!e)return{type:n,message:Ar(e)?e:"",ref:t}}var sn=e=>pe(e)&&!_r(e)?e:{value:e,message:""},ru=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:u,minLength:l,min:f,max:g,pattern:m,validate:p,name:v,valueAsNumber:h,mount:y,disabled:w}=e._f,x=z(t,v);if(!y||w)return{};const N=i?i[0]:s,P=F=>{r&&N.reportValidity&&(N.setCustomValidity(tt(F)?"":F||""),N.reportValidity())},b={},S=Ts(s),E=Sn(s),R=S||E,U=(h||Ps(s))&&de(s.value)&&de(x)||Tr(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,H=Uy.bind(null,v,n,b),Z=(F,$,D,G=ut.maxLength,B=ut.minLength)=>{const q=F?$:D;b[v]={type:F?G:B,message:q,ref:s,...H(F?G:B,q)}};if(o?!Array.isArray(x)||!x.length:a&&(!R&&(U||Se(x))||tt(x)&&!x||E&&!Qc(i).isValid||S&&!tu(i).isValid)){const{value:F,message:$}=Ar(a)?{value:!!a,message:a}:sn(a);if(F&&(b[v]={type:ut.required,message:$,ref:N,...H(ut.required,$)},!n))return P($),b}if(!U&&(!Se(f)||!Se(g))){let F,$;const D=sn(g),G=sn(f);if(!Se(x)&&!isNaN(x)){const B=s.valueAsNumber||x&&+x;Se(D.value)||(F=B>D.value),Se(G.value)||($=B<G.value)}else{const B=s.valueAsDate||new Date(x),q=ae=>new Date(new Date().toDateString()+" "+ae),K=s.type=="time",te=s.type=="week";nt(D.value)&&x&&(F=K?q(x)>q(D.value):te?x>D.value:B>new Date(D.value)),nt(G.value)&&x&&($=K?q(x)<q(G.value):te?x<G.value:B<new Date(G.value))}if((F||$)&&(Z(!!F,D.message,G.message,ut.max,ut.min),!n))return P(b[v].message),b}if((u||l)&&!U&&(nt(x)||o&&Array.isArray(x))){const F=sn(u),$=sn(l),D=!Se(F.value)&&x.length>+F.value,G=!Se($.value)&&x.length<+$.value;if((D||G)&&(Z(D,F.message,$.message),!n))return P(b[v].message),b}if(m&&!U&&nt(x)){const{value:F,message:$}=sn(m);if(_r(F)&&!x.match(F)&&(b[v]={type:ut.pattern,message:$,ref:s,...H(ut.pattern,$)},!n))return P($),b}if(p){if(rt(p)){const F=await p(x,t),$=nu(F,N);if($&&(b[v]={...$,...H(ut.validate,$.message)},!n))return P($.message),b}else if(pe(p)){let F={};for(const $ in p){if(!Te(F)&&!n)break;const D=nu(await p[$](x,t),N,$);D&&(F={...D,...H($,D.message)},P(D.message),n&&(b[v]=F))}if(!Te(F)&&(b[v]={ref:N,...F},!n))return b}}return P(!0),b};function Gy(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=de(e)?r++:e[t[r++]];return e}function Wy(e){for(const t in e)if(e.hasOwnProperty(t)&&!de(e[t]))return!1;return!0}function ye(e,t){const n=Array.isArray(t)?t:Ns(t)?[t]:qc(t),r=n.length===1?e:Gy(e,n),o=n.length-1,s=n[o];return r&&delete r[s],o!==0&&(pe(r)&&Te(r)||Array.isArray(r)&&Wy(r))&&ye(e,n.slice(0,-1)),e}var As=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},_s=e=>Se(e)||!Wc(e);function Nt(e,t){if(_s(e)||_s(t))return e===t;if(Bt(e)&&Bt(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(Bt(s)&&Bt(i)||pe(s)&&pe(i)||Array.isArray(s)&&Array.isArray(i)?!Nt(s,i):s!==i)return!1}}return!0}var ou=e=>e.type==="select-multiple",qy=e=>Ts(e)||Sn(e),Fs=e=>Tr(e)&&e.isConnected,su=e=>{for(const t in e)if(rt(e[t]))return!0;return!1};function Fr(e,t={}){const n=Array.isArray(e);if(pe(e)||n)for(const r in e)Array.isArray(e[r])||pe(e[r])&&!su(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Fr(e[r],t[r])):Se(e[r])||(t[r]=!0);return t}function iu(e,t,n){const r=Array.isArray(e);if(pe(e)||r)for(const o in e)Array.isArray(e[o])||pe(e[o])&&!su(e[o])?de(t)||_s(n[o])?n[o]=Array.isArray(e[o])?Fr(e[o],[]):{...Fr(e[o])}:iu(e[o],Se(t)?{}:t[o],n[o]):n[o]=!Nt(e[o],t[o]);return n}var Nn=(e,t)=>iu(e,t,Fr(t)),au=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>de(e)?e:t?e===""?NaN:e&&+e:n&&nt(e)?new Date(e):r?r(e):e;function Os(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Ps(t)?t.files:Ts(t)?tu(e.refs).value:ou(t)?[...t.selectedOptions].map(({value:n})=>n):Sn(t)?Qc(e.refs).value:au(de(t.value)?e.ref.value:t.value,e)}var Ky=(e,t,n,r)=>{const o={};for(const s of e){const i=z(t,s);i&&ce(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},Pn=e=>de(e)?e:_r(e)?e.source:pe(e)?_r(e.value)?e.value.source:e.value:e;const lu="AsyncFunction";var Xy=e=>!!e&&!!e.validate&&!!(rt(e.validate)&&e.validate.constructor.name===lu||pe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===lu)),Yy=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function cu(e,t,n){const r=z(e,n);if(r||Ns(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=z(t,s),a=z(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var Jy=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,Zy=(e,t)=>!Nr(z(e,t)).length&&ye(e,t);const Qy={mode:je.onSubmit,reValidateMode:je.onChange,shouldFocusError:!0};function ew(e={}){let t={...Qy,...e},n={submitCount:0,isDirty:!1,isLoading:rt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=pe(t.defaultValues)||pe(t.values)?Ie(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Ie(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,l=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={values:As(),array:As(),state:As()},m=Xc(t.mode),p=Xc(t.reValidateMode),v=t.criteriaMode===je.all,h=C=>T=>{clearTimeout(l),l=setTimeout(C,T)},y=async C=>{if(!t.disabled&&(f.isValid||C)){const T=t.resolver?Te((await R()).errors):await H(r,!0);T!==n.isValid&&g.state.next({isValid:T})}},w=(C,T)=>{!t.disabled&&(f.isValidating||f.validatingFields)&&((C||Array.from(a.mount)).forEach(_=>{_&&(T?ce(n.validatingFields,_,T):ye(n.validatingFields,_))}),g.state.next({validatingFields:n.validatingFields,isValidating:!Te(n.validatingFields)}))},x=(C,T=[],_,V,L=!0,k=!0)=>{if(V&&_&&!t.disabled){if(i.action=!0,k&&Array.isArray(z(r,C))){const W=_(z(r,C),V.argA,V.argB);L&&ce(r,C,W)}if(k&&Array.isArray(z(n.errors,C))){const W=_(z(n.errors,C),V.argA,V.argB);L&&ce(n.errors,C,W),Zy(n.errors,C)}if(f.touchedFields&&k&&Array.isArray(z(n.touchedFields,C))){const W=_(z(n.touchedFields,C),V.argA,V.argB);L&&ce(n.touchedFields,C,W)}f.dirtyFields&&(n.dirtyFields=Nn(o,s)),g.state.next({name:C,isDirty:F(C,T),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ce(s,C,T)},N=(C,T)=>{ce(n.errors,C,T),g.state.next({errors:n.errors})},P=C=>{n.errors=C,g.state.next({errors:n.errors,isValid:!1})},b=(C,T,_,V)=>{const L=z(r,C);if(L){const k=z(s,C,de(_)?z(o,C):_);de(k)||V&&V.defaultChecked||T?ce(s,C,T?k:Os(L._f)):G(C,k),i.mount&&y()}},S=(C,T,_,V,L)=>{let k=!1,W=!1;const ne={name:C};if(!t.disabled){const me=!!(z(r,C)&&z(r,C)._f&&z(r,C)._f.disabled);if(!_||V){f.isDirty&&(W=n.isDirty,n.isDirty=ne.isDirty=F(),k=W!==ne.isDirty);const ge=me||Nt(z(o,C),T);W=!!(!me&&z(n.dirtyFields,C)),ge||me?ye(n.dirtyFields,C):ce(n.dirtyFields,C,!0),ne.dirtyFields=n.dirtyFields,k=k||f.dirtyFields&&W!==!ge}if(_){const ge=z(n.touchedFields,C);ge||(ce(n.touchedFields,C,_),ne.touchedFields=n.touchedFields,k=k||f.touchedFields&&ge!==_)}k&&L&&g.state.next(ne)}return k?ne:{}},E=(C,T,_,V)=>{const L=z(n.errors,C),k=f.isValid&&tt(T)&&n.isValid!==T;if(t.delayError&&_?(u=h(()=>N(C,_)),u(t.delayError)):(clearTimeout(l),u=null,_?ce(n.errors,C,_):ye(n.errors,C)),(_?!Nt(L,_):L)||!Te(V)||k){const W={...V,...k&&tt(T)?{isValid:T}:{},errors:n.errors,name:C};n={...n,...W},g.state.next(W)}},R=async C=>{w(C,!0);const T=await t.resolver(s,t.context,Ky(C||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return w(C),T},U=async C=>{const{errors:T}=await R(C);if(C)for(const _ of C){const V=z(T,_);V?ce(n.errors,_,V):ye(n.errors,_)}else n.errors=T;return T},H=async(C,T,_={valid:!0})=>{for(const V in C){const L=C[V];if(L){const{_f:k,...W}=L;if(k){const ne=a.array.has(k.name),me=L._f&&Xy(L._f);me&&f.validatingFields&&w([V],!0);const ge=await ru(L,s,v,t.shouldUseNativeValidation&&!T,ne);if(me&&f.validatingFields&&w([V]),ge[k.name]&&(_.valid=!1,T))break;!T&&(z(ge,k.name)?ne?jy(n.errors,ge,k.name):ce(n.errors,k.name,ge[k.name]):ye(n.errors,k.name))}!Te(W)&&await H(W,T,_)}}return _.valid},Z=()=>{for(const C of a.unMount){const T=z(r,C);T&&(T._f.refs?T._f.refs.every(_=>!Fs(_)):!Fs(T._f.ref))&&_t(C)}a.unMount=new Set},F=(C,T)=>!t.disabled&&(C&&T&&ce(s,C,T),!Nt(re(),o)),$=(C,T,_)=>Hy(C,a,{...i.mount?s:de(T)?o:nt(C)?{[C]:T}:T},_,T),D=C=>Nr(z(i.mount?s:o,C,t.shouldUnregister?z(o,C,[]):[])),G=(C,T,_={})=>{const V=z(r,C);let L=T;if(V){const k=V._f;k&&(!k.disabled&&ce(s,C,au(T,k)),L=Tr(k.ref)&&Se(T)?"":T,ou(k.ref)?[...k.ref.options].forEach(W=>W.selected=L.includes(W.value)):k.refs?Sn(k.ref)?k.refs.length>1?k.refs.forEach(W=>(!W.defaultChecked||!W.disabled)&&(W.checked=Array.isArray(L)?!!L.find(ne=>ne===W.value):L===W.value)):k.refs[0]&&(k.refs[0].checked=!!L):k.refs.forEach(W=>W.checked=W.value===L):Ps(k.ref)?k.ref.value="":(k.ref.value=L,k.ref.type||g.values.next({name:C,values:{...s}})))}(_.shouldDirty||_.shouldTouch)&&S(C,L,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&ae(C)},B=(C,T,_)=>{for(const V in T){const L=T[V],k=`${C}.${V}`,W=z(r,k);(a.array.has(C)||pe(L)||W&&!W._f)&&!Bt(L)?B(k,L,_):G(k,L,_)}},q=(C,T,_={})=>{const V=z(r,C),L=a.array.has(C),k=Ie(T);ce(s,C,k),L?(g.array.next({name:C,values:{...s}}),(f.isDirty||f.dirtyFields)&&_.shouldDirty&&g.state.next({name:C,dirtyFields:Nn(o,s),isDirty:F(C,k)})):V&&!V._f&&!Se(k)?B(C,k,_):G(C,k,_),Yc(C,a)&&g.state.next({...n}),g.values.next({name:i.mount?C:void 0,values:{...s}})},K=async C=>{i.mount=!0;const T=C.target;let _=T.name,V=!0;const L=z(r,_),k=()=>T.type?Os(L._f):ky(C),W=ne=>{V=Number.isNaN(ne)||Bt(ne)&&isNaN(ne.getTime())||Nt(ne,z(s,_,ne))};if(L){let ne,me;const ge=k(),Ye=C.type===Kc.BLUR||C.type===Kc.FOCUS_OUT,ri=!Yy(L._f)&&!t.resolver&&!z(n.errors,_)&&!L._f.deps||Jy(Ye,z(n.touchedFields,_),n.isSubmitted,p,m),Rn=Yc(_,a,Ye);ce(s,_,ge),Ye?(L._f.onBlur&&L._f.onBlur(C),u&&u(0)):L._f.onChange&&L._f.onChange(C);const M=S(_,ge,Ye,!1),I=!Te(M)||Rn;if(!Ye&&g.values.next({name:_,type:C.type,values:{...s}}),ri)return f.isValid&&(t.mode==="onBlur"?Ye&&y():y()),I&&g.state.next({name:_,...Rn?{}:M});if(!Ye&&Rn&&g.state.next({...n}),t.resolver){const{errors:j}=await R([_]);if(W(ge),V){const oe=cu(n.errors,r,_),ie=cu(j,r,oe.name||_);ne=ie.error,_=ie.name,me=Te(j)}}else w([_],!0),ne=(await ru(L,s,v,t.shouldUseNativeValidation))[_],w([_]),W(ge),V&&(ne?me=!1:f.isValid&&(me=await H(r,!0)));V&&(L._f.deps&&ae(L._f.deps),E(_,me,ne,M))}},te=(C,T)=>{if(z(n.errors,T)&&C.focus)return C.focus(),1},ae=async(C,T={})=>{let _,V;const L=Pr(C);if(t.resolver){const k=await U(de(C)?C:L);_=Te(k),V=C?!L.some(W=>z(k,W)):_}else C?(V=(await Promise.all(L.map(async k=>{const W=z(r,k);return await H(W&&W._f?{[k]:W}:W)}))).every(Boolean),!(!V&&!n.isValid)&&y()):V=_=await H(r);return g.state.next({...!nt(C)||f.isValid&&_!==n.isValid?{}:{name:C},...t.resolver||!C?{isValid:_}:{},errors:n.errors}),T.shouldFocus&&!V&&En(r,te,C?L:a.mount),V},re=C=>{const T={...i.mount?s:o};return de(C)?T:nt(C)?z(T,C):C.map(_=>z(T,_))},Ae=(C,T)=>({invalid:!!z((T||n).errors,C),isDirty:!!z((T||n).dirtyFields,C),error:z((T||n).errors,C),isValidating:!!z(n.validatingFields,C),isTouched:!!z((T||n).touchedFields,C)}),qe=C=>{C&&Pr(C).forEach(T=>ye(n.errors,T)),g.state.next({errors:C?n.errors:{}})},at=(C,T,_)=>{const V=(z(r,C,{_f:{}})._f||{}).ref,L=z(n.errors,C)||{},{ref:k,message:W,type:ne,...me}=L;ce(n.errors,C,{...me,...T,ref:V}),g.state.next({name:C,errors:n.errors,isValid:!1}),_&&_.shouldFocus&&V&&V.focus&&V.focus()},Ht=(C,T)=>rt(C)?g.values.subscribe({next:_=>C($(void 0,T),_)}):$(C,T,!0),_t=(C,T={})=>{for(const _ of C?Pr(C):a.mount)a.mount.delete(_),a.array.delete(_),T.keepValue||(ye(r,_),ye(s,_)),!T.keepError&&ye(n.errors,_),!T.keepDirty&&ye(n.dirtyFields,_),!T.keepTouched&&ye(n.touchedFields,_),!T.keepIsValidating&&ye(n.validatingFields,_),!t.shouldUnregister&&!T.keepDefaultValue&&ye(o,_);g.values.next({values:{...s}}),g.state.next({...n,...T.keepDirty?{isDirty:F()}:{}}),!T.keepIsValid&&y()},Ft=({disabled:C,name:T,field:_,fields:V,value:L})=>{if(tt(C)&&i.mount||C){const k=C?void 0:de(L)?Os(_?_._f:z(V,T)._f):L;(C||!C&&!de(k))&&ce(s,T,k),S(T,k,!1,!1,!0)}},Ke=(C,T={})=>{let _=z(r,C);const V=tt(T.disabled)||tt(t.disabled);return ce(r,C,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:C}},name:C,mount:!0,...T}}),a.mount.add(C),_?Ft({field:_,disabled:tt(T.disabled)?T.disabled:t.disabled,name:C,value:T.value}):b(C,!0,T.value),{...V?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:Pn(T.min),max:Pn(T.max),minLength:Pn(T.minLength),maxLength:Pn(T.maxLength),pattern:Pn(T.pattern)}:{},name:C,onChange:K,onBlur:K,ref:L=>{if(L){Ke(C,T),_=z(r,C);const k=de(L.value)&&L.querySelectorAll&&L.querySelectorAll("input,select,textarea")[0]||L,W=qy(k),ne=_._f.refs||[];if(W?ne.find(me=>me===k):k===_._f.ref)return;ce(r,C,{_f:{..._._f,...W?{refs:[...ne.filter(Fs),k,...Array.isArray(z(o,C))?[{}]:[]],ref:{type:k.type,name:C}}:{ref:k}}}),b(C,!1,void 0,k)}else _=z(r,C,{}),_._f&&(_._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(Iy(a.array,C)&&i.action)&&a.unMount.add(C)}}},we=()=>t.shouldFocusError&&En(r,te,a.mount),Ot=C=>{tt(C)&&(g.state.next({disabled:C}),En(r,(T,_)=>{const V=z(r,_);V&&(T.disabled=V._f.disabled||C,Array.isArray(V._f.refs)&&V._f.refs.forEach(L=>{L.disabled=V._f.disabled||C}))},0,!1))},Ut=(C,T)=>async _=>{let V;if(_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist()),t.disabled){T&&await T({...n.errors},_);return}let L=Ie(s);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:k,values:W}=await R();n.errors=k,L=W}else await H(r);if(ye(n.errors,"root"),Te(n.errors)){g.state.next({errors:{}});try{await C(L,_)}catch(k){V=k}}else T&&await T({...n.errors},_),we(),setTimeout(we);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(n.errors)&&!V,submitCount:n.submitCount+1,errors:n.errors}),V)throw V},Le=(C,T={})=>{z(r,C)&&(de(T.defaultValue)?q(C,Ie(z(o,C))):(q(C,T.defaultValue),ce(o,C,Ie(T.defaultValue))),T.keepTouched||ye(n.touchedFields,C),T.keepDirty||(ye(n.dirtyFields,C),n.isDirty=T.defaultValue?F(C,Ie(z(o,C))):F()),T.keepError||(ye(n.errors,C),f.isValid&&y()),g.state.next({...n}))},Xe=(C,T={})=>{const _=C?Ie(C):o,V=Ie(_),L=Te(C),k=L?o:V;if(T.keepDefaultValues||(o=_),!T.keepValues){if(T.keepDirtyValues){const W=new Set([...a.mount,...Object.keys(Nn(o,s))]);for(const ne of Array.from(W))z(n.dirtyFields,ne)?ce(k,ne,z(s,ne)):q(ne,z(k,ne))}else{if(Es&&de(C))for(const W of a.mount){const ne=z(r,W);if(ne&&ne._f){const me=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Tr(me)){const ge=me.closest("form");if(ge){ge.reset();break}}}}r={}}s=t.shouldUnregister?T.keepDefaultValues?Ie(o):{}:Ie(k),g.array.next({values:{...k}}),g.values.next({values:{...k}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!t.shouldUnregister,g.state.next({submitCount:T.keepSubmitCount?n.submitCount:0,isDirty:L?!1:T.keepDirty?n.isDirty:!!(T.keepDefaultValues&&!Nt(C,o)),isSubmitted:T.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:L?{}:T.keepDirtyValues?T.keepDefaultValues&&s?Nn(o,s):n.dirtyFields:T.keepDefaultValues&&C?Nn(o,C):T.keepDirty?n.dirtyFields:{},touchedFields:T.keepTouched?n.touchedFields:{},errors:T.keepErrors?n.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},ke=(C,T)=>Xe(rt(C)?C(s):C,T);return{control:{register:Ke,unregister:_t,getFieldState:Ae,handleSubmit:Ut,setError:at,_executeSchema:R,_getWatch:$,_getDirty:F,_updateValid:y,_removeUnmounted:Z,_updateFieldArray:x,_updateDisabledField:Ft,_getFieldArray:D,_reset:Xe,_resetDefaultValues:()=>rt(t.defaultValues)&&t.defaultValues().then(C=>{ke(C,t.resetOptions),g.state.next({isLoading:!1})}),_updateFormState:C=>{n={...n,...C}},_disableForm:Ot,_subjects:g,_proxyFormState:f,_setErrors:P,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(C){i=C},get _defaultValues(){return o},get _names(){return a},set _names(C){a=C},get _formState(){return n},set _formState(C){n=C},get _options(){return t},set _options(C){t={...t,...C}}},trigger:ae,register:Ke,handleSubmit:Ut,watch:Ht,setValue:q,getValues:re,reset:ke,resetField:Le,clearErrors:qe,unregister:_t,setError:at,setFocus:(C,T={})=>{const _=z(r,C),V=_&&_._f;if(V){const L=V.refs?V.refs[0]:V.ref;L.focus&&(L.focus(),T.shouldSelect&&rt(L.select)&&L.select())}},getFieldState:Ae}}function tw(e={}){const t=O.useRef(),n=O.useRef(),[r,o]=O.useState({isDirty:!1,isValidating:!1,isLoading:rt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:rt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...ew(e),formState:r});const s=t.current.control;return s._options=e,zy({subject:s._subjects.state,next:i=>{By(i,s._proxyFormState,s._updateFormState)&&o({...s._formState})}}),O.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),O.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),O.useEffect(()=>{e.values&&!Nt(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),O.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),O.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),O.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),O.useMemo(()=>({...t.current,formState:Vy(r,s)}),[r,s])}function dt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function uu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function nw(...e){return t=>{let n=!1;const r=e.map(o=>{const s=uu(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():uu(e[o],null)}}}}function Tn(...e){return d.useCallback(nw(...e),e)}var rw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],An=rw.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ow(e,t){e&&kn.flushSync(()=>e.dispatchEvent(t))}var sw="DismissableLayer",Ds="dismissableLayer.update",iw="dismissableLayer.pointerDownOutside",aw="dismissableLayer.focusOutside",du,fu=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pu=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...u}=e,l=d.useContext(fu),[f,g]=d.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=d.useState({}),v=Tn(t,E=>g(E)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),w=h.indexOf(y),x=f?h.indexOf(f):-1,N=l.layersWithOutsidePointerEventsDisabled.size>0,P=x>=w,b=uw(E=>{const R=E.target,U=[...l.branches].some(H=>H.contains(R));!P||U||(o==null||o(E),i==null||i(E),E.defaultPrevented||a==null||a())},m),S=dw(E=>{const R=E.target;[...l.branches].some(H=>H.contains(R))||(s==null||s(E),i==null||i(E),E.defaultPrevented||a==null||a())},m);return Ma(E=>{x===l.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},m),d.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(du=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),gu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=du)}},[f,m,n,l]),d.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),gu())},[f,l]),d.useEffect(()=>{const E=()=>p({});return document.addEventListener(Ds,E),()=>document.removeEventListener(Ds,E)},[]),c.jsx(An.div,{...u,ref:v,style:{pointerEvents:N?P?"auto":"none":void 0,...e.style},onFocusCapture:dt(e.onFocusCapture,S.onFocusCapture),onBlurCapture:dt(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:dt(e.onPointerDownCapture,b.onPointerDownCapture)})});pu.displayName=sw;var lw="DismissableLayerBranch",cw=d.forwardRef((e,t)=>{const n=d.useContext(fu),r=d.useRef(null),o=Tn(t,r);return d.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(An.div,{...e,ref:o})});cw.displayName=lw;function uw(e,t=globalThis==null?void 0:globalThis.document){const n=Ce(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){hu(iw,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function dw(e,t=globalThis==null?void 0:globalThis.document){const n=Ce(e),r=d.useRef(!1);return d.useEffect(()=>{const o=s=>{s.target&&!r.current&&hu(aw,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gu(){const e=new CustomEvent(Ds);document.dispatchEvent(e)}function hu(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ow(o,s):o.dispatchEvent(s)}const fw=["top","right","bottom","left"],Pt=Math.min,Me=Math.max,Or=Math.round,Dr=Math.floor,ot=e=>({x:e,y:e}),pw={left:"right",right:"left",bottom:"top",top:"bottom"},gw={start:"end",end:"start"};function Ms(e,t,n){return Me(e,Pt(t,n))}function ft(e,t){return typeof e=="function"?e(t):e}function pt(e){return e.split("-")[0]}function an(e){return e.split("-")[1]}function Rs(e){return e==="x"?"y":"x"}function ks(e){return e==="y"?"height":"width"}function Tt(e){return["top","bottom"].includes(pt(e))?"y":"x"}function $s(e){return Rs(Tt(e))}function hw(e,t,n){n===void 0&&(n=!1);const r=an(e),o=$s(e),s=ks(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Mr(i)),[i,Mr(i)]}function mw(e){const t=Mr(e);return[Is(e),t,Is(t)]}function Is(e){return e.replace(/start|end/g,t=>gw[t])}function vw(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:i;default:return[]}}function yw(e,t,n,r){const o=an(e);let s=vw(pt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Is)))),s}function Mr(e){return e.replace(/left|right|bottom|top/g,t=>pw[t])}function ww(e){return{top:0,right:0,bottom:0,left:0,...e}}function mu(e){return typeof e!="number"?ww(e):{top:e,right:e,bottom:e,left:e}}function Rr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function vu(e,t,n){let{reference:r,floating:o}=e;const s=Tt(t),i=$s(t),a=ks(i),u=pt(t),l=s==="y",f=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let p;switch(u){case"top":p={x:f,y:r.y-o.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:g};break;case"left":p={x:r.x-o.width,y:g};break;default:p={x:r.x,y:r.y}}switch(an(t)){case"start":p[i]-=m*(n&&l?-1:1);break;case"end":p[i]+=m*(n&&l?-1:1);break}return p}const bw=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:g}=vu(l,r,u),m=r,p={},v=0;for(let h=0;h<a.length;h++){const{name:y,fn:w}=a[h],{x,y:N,data:P,reset:b}=await w({x:f,y:g,initialPlacement:r,placement:m,strategy:o,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});f=x??f,g=N??g,p={...p,[y]:{...p[y],...P}},b&&v<=50&&(v++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(l=b.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:f,y:g}=vu(l,m,u)),h=-1)}return{x:f,y:g,placement:m,strategy:o,middlewareData:p}};async function _n(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:u}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:m=!1,padding:p=0}=ft(t,e),v=mu(p),y=a[m?g==="floating"?"reference":"floating":g],w=Rr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:f,strategy:u})),x=g==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),P=await(s.isElement==null?void 0:s.isElement(N))?await(s.getScale==null?void 0:s.getScale(N))||{x:1,y:1}:{x:1,y:1},b=Rr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:N,strategy:u}):x);return{top:(w.top-b.top+v.top)/P.y,bottom:(b.bottom-w.bottom+v.bottom)/P.y,left:(w.left-b.left+v.left)/P.x,right:(b.right-w.right+v.right)/P.x}}const xw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:u}=t,{element:l,padding:f=0}=ft(e,t)||{};if(l==null)return{};const g=mu(f),m={x:n,y:r},p=$s(o),v=ks(p),h=await i.getDimensions(l),y=p==="y",w=y?"top":"left",x=y?"bottom":"right",N=y?"clientHeight":"clientWidth",P=s.reference[v]+s.reference[p]-m[p]-s.floating[v],b=m[p]-s.reference[p],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let E=S?S[N]:0;(!E||!await(i.isElement==null?void 0:i.isElement(S)))&&(E=a.floating[N]||s.floating[v]);const R=P/2-b/2,U=E/2-h[v]/2-1,H=Pt(g[w],U),Z=Pt(g[x],U),F=H,$=E-h[v]-Z,D=E/2-h[v]/2+R,G=Ms(F,D,$),B=!u.arrow&&an(o)!=null&&D!==G&&s.reference[v]/2-(D<F?H:Z)-h[v]/2<0,q=B?D<F?D-F:D-$:0;return{[p]:m[p]+q,data:{[p]:G,centerOffset:D-G-q,...B&&{alignmentOffset:q}},reset:B}}}),Cw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:u,elements:l}=t,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...y}=ft(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=pt(o),x=Tt(a),N=pt(a)===a,P=await(u.isRTL==null?void 0:u.isRTL(l.floating)),b=m||(N||!h?[Mr(a)]:mw(a)),S=v!=="none";!m&&S&&b.push(...yw(a,h,v,P));const E=[a,...b],R=await _n(t,y),U=[];let H=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&U.push(R[w]),g){const D=hw(o,i,P);U.push(R[D[0]],R[D[1]])}if(H=[...H,{placement:o,overflows:U}],!U.every(D=>D<=0)){var Z,F;const D=(((Z=s.flip)==null?void 0:Z.index)||0)+1,G=E[D];if(G)return{data:{index:D,overflows:H},reset:{placement:G}};let B=(F=H.filter(q=>q.overflows[0]<=0).sort((q,K)=>q.overflows[1]-K.overflows[1])[0])==null?void 0:F.placement;if(!B)switch(p){case"bestFit":{var $;const q=($=H.filter(K=>{if(S){const te=Tt(K.placement);return te===x||te==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(te=>te>0).reduce((te,ae)=>te+ae,0)]).sort((K,te)=>K[1]-te[1])[0])==null?void 0:$[0];q&&(B=q);break}case"initialPlacement":B=a;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function yu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wu(e){return fw.some(t=>e[t]>=0)}const Sw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ft(e,t);switch(r){case"referenceHidden":{const s=await _n(t,{...o,elementContext:"reference"}),i=yu(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:wu(i)}}}case"escaped":{const s=await _n(t,{...o,altBoundary:!0}),i=yu(s,n.floating);return{data:{escapedOffsets:i,escaped:wu(i)}}}default:return{}}}}};async function Ew(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=pt(n),a=an(n),u=Tt(n)==="y",l=["left","top"].includes(i)?-1:1,f=s&&u?-1:1,g=ft(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:v}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return a&&typeof v=="number"&&(p=a==="end"?v*-1:v),u?{x:p*f,y:m*l}:{x:m*l,y:p*f}}const Nw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,u=await Ew(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:i}}}}},Pw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x:w,y:x}=y;return{x:w,y:x}}},...u}=ft(e,t),l={x:n,y:r},f=await _n(t,u),g=Tt(pt(o)),m=Rs(g);let p=l[m],v=l[g];if(s){const y=m==="y"?"top":"left",w=m==="y"?"bottom":"right",x=p+f[y],N=p-f[w];p=Ms(x,p,N)}if(i){const y=g==="y"?"top":"left",w=g==="y"?"bottom":"right",x=v+f[y],N=v-f[w];v=Ms(x,v,N)}const h=a.fn({...t,[m]:p,[g]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[m]:s,[g]:i}}}}}},Tw=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:u=!0,crossAxis:l=!0}=ft(e,t),f={x:n,y:r},g=Tt(o),m=Rs(g);let p=f[m],v=f[g];const h=ft(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const N=m==="y"?"height":"width",P=s.reference[m]-s.floating[N]+y.mainAxis,b=s.reference[m]+s.reference[N]-y.mainAxis;p<P?p=P:p>b&&(p=b)}if(l){var w,x;const N=m==="y"?"width":"height",P=["top","left"].includes(pt(o)),b=s.reference[g]-s.floating[N]+(P&&((w=i.offset)==null?void 0:w[g])||0)+(P?0:y.crossAxis),S=s.reference[g]+s.reference[N]+(P?0:((x=i.offset)==null?void 0:x[g])||0)-(P?y.crossAxis:0);v<b?v=b:v>S&&(v=S)}return{[m]:p,[g]:v}}}},Aw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:u=()=>{},...l}=ft(e,t),f=await _n(t,l),g=pt(o),m=an(o),p=Tt(o)==="y",{width:v,height:h}=s.floating;let y,w;g==="top"||g==="bottom"?(y=g,w=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=g,y=m==="end"?"top":"bottom");const x=h-f.top-f.bottom,N=v-f.left-f.right,P=Pt(h-f[y],x),b=Pt(v-f[w],N),S=!t.middlewareData.shift;let E=P,R=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=N),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=x),S&&!m){const H=Me(f.left,0),Z=Me(f.right,0),F=Me(f.top,0),$=Me(f.bottom,0);p?R=v-2*(H!==0||Z!==0?H+Z:Me(f.left,f.right)):E=h-2*(F!==0||$!==0?F+$:Me(f.top,f.bottom))}await u({...t,availableWidth:R,availableHeight:E});const U=await i.getDimensions(a.floating);return v!==U.width||h!==U.height?{reset:{rects:!0}}:{}}}};function kr(){return typeof window<"u"}function ln(e){return bu(e)?(e.nodeName||"").toLowerCase():"#document"}function Re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function st(e){var t;return(t=(bu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bu(e){return kr()?e instanceof Node||e instanceof Re(e).Node:!1}function Ge(e){return kr()?e instanceof Element||e instanceof Re(e).Element:!1}function it(e){return kr()?e instanceof HTMLElement||e instanceof Re(e).HTMLElement:!1}function xu(e){return!kr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Re(e).ShadowRoot}function Fn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=We(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function _w(e){return["table","td","th"].includes(ln(e))}function $r(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ls(e){const t=Vs(),n=Ge(e)?We(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Fw(e){let t=At(e);for(;it(t)&&!cn(t);){if(Ls(t))return t;if($r(t))return null;t=At(t)}return null}function Vs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function cn(e){return["html","body","#document"].includes(ln(e))}function We(e){return Re(e).getComputedStyle(e)}function Ir(e){return Ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function At(e){if(ln(e)==="html")return e;const t=e.assignedSlot||e.parentNode||xu(e)&&e.host||st(e);return xu(t)?t.host:t}function Cu(e){const t=At(e);return cn(t)?e.ownerDocument?e.ownerDocument.body:e.body:it(t)&&Fn(t)?t:Cu(t)}function On(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Cu(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Re(o);if(s){const a=Bs(i);return t.concat(i,i.visualViewport||[],Fn(o)?o:[],a&&n?On(a):[])}return t.concat(o,On(o,[],n))}function Bs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Su(e){const t=We(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=it(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Or(n)!==s||Or(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function zs(e){return Ge(e)?e:e.contextElement}function un(e){const t=zs(e);if(!it(t))return ot(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Su(t);let i=(s?Or(n.width):n.width)/r,a=(s?Or(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Ow=ot(0);function Eu(e){const t=Re(e);return!Vs()||!t.visualViewport?Ow:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Dw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Re(e)?!1:t}function zt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=zs(e);let i=ot(1);t&&(r?Ge(r)&&(i=un(r)):i=un(e));const a=Dw(s,n,r)?Eu(s):ot(0);let u=(o.left+a.x)/i.x,l=(o.top+a.y)/i.y,f=o.width/i.x,g=o.height/i.y;if(s){const m=Re(s),p=r&&Ge(r)?Re(r):r;let v=m,h=Bs(v);for(;h&&r&&p!==v;){const y=un(h),w=h.getBoundingClientRect(),x=We(h),N=w.left+(h.clientLeft+parseFloat(x.paddingLeft))*y.x,P=w.top+(h.clientTop+parseFloat(x.paddingTop))*y.y;u*=y.x,l*=y.y,f*=y.x,g*=y.y,u+=N,l+=P,v=Re(h),h=Bs(v)}}return Rr({width:f,height:g,x:u,y:l})}function Hs(e,t){const n=Ir(e).scrollLeft;return t?t.left+n:zt(st(e)).left+n}function Nu(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:Hs(e,r)),s=r.top+t.scrollTop;return{x:o,y:s}}function Mw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=st(r),a=t?$r(t.floating):!1;if(r===i||a&&s)return n;let u={scrollLeft:0,scrollTop:0},l=ot(1);const f=ot(0),g=it(r);if((g||!g&&!s)&&((ln(r)!=="body"||Fn(i))&&(u=Ir(r)),it(r))){const p=zt(r);l=un(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}const m=i&&!g&&!s?Nu(i,u,!0):ot(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+f.x+m.x,y:n.y*l.y-u.scrollTop*l.y+f.y+m.y}}function Rw(e){return Array.from(e.getClientRects())}function kw(e){const t=st(e),n=Ir(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Hs(e);const a=-n.scrollTop;return We(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}function $w(e,t){const n=Re(e),r=st(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,u=0;if(o){s=o.width,i=o.height;const l=Vs();(!l||l&&t==="fixed")&&(a=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:a,y:u}}function Iw(e,t){const n=zt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=it(e)?un(e):ot(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,u=o*s.x,l=r*s.y;return{width:i,height:a,x:u,y:l}}function Pu(e,t,n){let r;if(t==="viewport")r=$w(e,n);else if(t==="document")r=kw(st(e));else if(Ge(t))r=Iw(t,n);else{const o=Eu(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Rr(r)}function Tu(e,t){const n=At(e);return n===t||!Ge(n)||cn(n)?!1:We(n).position==="fixed"||Tu(n,t)}function Lw(e,t){const n=t.get(e);if(n)return n;let r=On(e,[],!1).filter(a=>Ge(a)&&ln(a)!=="body"),o=null;const s=We(e).position==="fixed";let i=s?At(e):e;for(;Ge(i)&&!cn(i);){const a=We(i),u=Ls(i);!u&&a.position==="fixed"&&(o=null),(s?!u&&!o:!u&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Fn(i)&&!u&&Tu(e,i))?r=r.filter(f=>f!==i):o=a,i=At(i)}return t.set(e,r),r}function Vw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?$r(t)?[]:Lw(t,this._c):[].concat(n),r],a=i[0],u=i.reduce((l,f)=>{const g=Pu(t,f,o);return l.top=Me(g.top,l.top),l.right=Pt(g.right,l.right),l.bottom=Pt(g.bottom,l.bottom),l.left=Me(g.left,l.left),l},Pu(t,a,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Bw(e){const{width:t,height:n}=Su(e);return{width:t,height:n}}function zw(e,t,n){const r=it(t),o=st(t),s=n==="fixed",i=zt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const u=ot(0);if(r||!r&&!s)if((ln(t)!=="body"||Fn(o))&&(a=Ir(t)),r){const m=zt(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&(u.x=Hs(o));const l=o&&!r&&!s?Nu(o,a):ot(0),f=i.left+a.scrollLeft-u.x-l.x,g=i.top+a.scrollTop-u.y-l.y;return{x:f,y:g,width:i.width,height:i.height}}function Us(e){return We(e).position==="static"}function Au(e,t){if(!it(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return st(e)===n&&(n=n.ownerDocument.body),n}function _u(e,t){const n=Re(e);if($r(e))return n;if(!it(e)){let o=At(e);for(;o&&!cn(o);){if(Ge(o)&&!Us(o))return o;o=At(o)}return n}let r=Au(e,t);for(;r&&_w(r)&&Us(r);)r=Au(r,t);return r&&cn(r)&&Us(r)&&!Ls(r)?n:r||Fw(e)||n}const Hw=async function(e){const t=this.getOffsetParent||_u,n=this.getDimensions,r=await n(e.floating);return{reference:zw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Uw(e){return We(e).direction==="rtl"}const jw={convertOffsetParentRelativeRectToViewportRelativeRect:Mw,getDocumentElement:st,getClippingRect:Vw,getOffsetParent:_u,getElementRects:Hw,getClientRects:Rw,getDimensions:Bw,getScale:un,isElement:Ge,isRTL:Uw};function Gw(e,t){let n=null,r;const o=st(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),s();const{left:l,top:f,width:g,height:m}=e.getBoundingClientRect();if(a||t(),!g||!m)return;const p=Dr(f),v=Dr(o.clientWidth-(l+g)),h=Dr(o.clientHeight-(f+m)),y=Dr(l),x={rootMargin:-p+"px "+-v+"px "+-h+"px "+-y+"px",threshold:Me(0,Pt(1,u))||1};let N=!0;function P(b){const S=b[0].intersectionRatio;if(S!==u){if(!N)return i();S?i(!1,S):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N=!1}try{n=new IntersectionObserver(P,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(P,x)}n.observe(e)}return i(!0),s}function Ww(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,l=zs(e),f=o||s?[...l?On(l):[],...On(t)]:[];f.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const g=l&&a?Gw(l,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(w=>{let[x]=w;x&&x.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var N;(N=p)==null||N.observe(t)})),n()}),l&&!u&&p.observe(l),p.observe(t));let v,h=u?zt(e):null;u&&y();function y(){const w=zt(e);h&&(w.x!==h.x||w.y!==h.y||w.width!==h.width||w.height!==h.height)&&n(),h=w,v=requestAnimationFrame(y)}return n(),()=>{var w;f.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),g==null||g(),(w=p)==null||w.disconnect(),p=null,u&&cancelAnimationFrame(v)}}const qw=Nw,Kw=Pw,Xw=Cw,Yw=Aw,Jw=Sw,Fu=xw,Zw=Tw,Qw=(e,t,n)=>{const r=new Map,o={platform:jw,...n},s={...o.platform,_c:r};return bw(e,t,{...o,platform:s})};var Lr=typeof document<"u"?O.useLayoutEffect:O.useEffect;function Vr(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,o;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(!Vr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Vr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ou(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Du(e,t){const n=Ou(e);return Math.round(t*n)/n}function js(e){const t=d.useRef(e);return Lr(()=>{t.current=e}),t}function eb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:u,open:l}=e,[f,g]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=d.useState(r);Vr(m,r)||p(r);const[v,h]=d.useState(null),[y,w]=d.useState(null),x=d.useCallback(K=>{K!==S.current&&(S.current=K,h(K))},[]),N=d.useCallback(K=>{K!==E.current&&(E.current=K,w(K))},[]),P=s||v,b=i||y,S=d.useRef(null),E=d.useRef(null),R=d.useRef(f),U=u!=null,H=js(u),Z=js(o),F=js(l),$=d.useCallback(()=>{if(!S.current||!E.current)return;const K={placement:t,strategy:n,middleware:m};Z.current&&(K.platform=Z.current),Qw(S.current,E.current,K).then(te=>{const ae={...te,isPositioned:F.current!==!1};D.current&&!Vr(R.current,ae)&&(R.current=ae,kn.flushSync(()=>{g(ae)}))})},[m,t,n,Z,F]);Lr(()=>{l===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,g(K=>({...K,isPositioned:!1})))},[l]);const D=d.useRef(!1);Lr(()=>(D.current=!0,()=>{D.current=!1}),[]),Lr(()=>{if(P&&(S.current=P),b&&(E.current=b),P&&b){if(H.current)return H.current(P,b,$);$()}},[P,b,$,H,U]);const G=d.useMemo(()=>({reference:S,floating:E,setReference:x,setFloating:N}),[x,N]),B=d.useMemo(()=>({reference:P,floating:b}),[P,b]),q=d.useMemo(()=>{const K={position:n,left:0,top:0};if(!B.floating)return K;const te=Du(B.floating,f.x),ae=Du(B.floating,f.y);return a?{...K,transform:"translate("+te+"px, "+ae+"px)",...Ou(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:ae}},[n,a,B.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:$,refs:G,elements:B,floatingStyles:q}),[f,$,G,B,q])}const tb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Fu({element:r.current,padding:o}).fn(n):{}:r?Fu({element:r,padding:o}).fn(n):{}}}},nb=(e,t)=>({...qw(e),options:[e,t]}),rb=(e,t)=>({...Kw(e),options:[e,t]}),ob=(e,t)=>({...Zw(e),options:[e,t]}),sb=(e,t)=>({...Xw(e),options:[e,t]}),ib=(e,t)=>({...Yw(e),options:[e,t]}),ab=(e,t)=>({...Jw(e),options:[e,t]}),lb=(e,t)=>({...tb(e),options:[e,t]});var cb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ub=cb.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),db="Arrow",Mu=d.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return c.jsx(ub.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});Mu.displayName=db;var fb=Mu;function Ru(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function pb(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ru(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ru(e[o],null)}}}}function ku(...e){return d.useCallback(pb(...e),e)}var gb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$u=gb.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Gs="Popper",[Iu,Lu]=xt(Gs),[hb,Vu]=Iu(Gs),Bu=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return c.jsx(hb,{scope:t,anchor:r,onAnchorChange:o,children:n})};Bu.displayName=Gs;var zu="PopperAnchor",Hu=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Vu(zu,n),i=d.useRef(null),a=ku(t,i);return d.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:c.jsx($u.div,{...o,ref:a})});Hu.displayName=zu;var Ws="PopperContent",[mb,vb]=Iu(Ws),Uu=d.forwardRef((e,t)=>{var Ft,Ke,we,Ot,Ut,Le;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:g="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:v,...h}=e,y=Vu(Ws,n),[w,x]=d.useState(null),N=ku(t,Xe=>x(Xe)),[P,b]=d.useState(null),S=Na(P),E=(S==null?void 0:S.width)??0,R=(S==null?void 0:S.height)??0,U=r+(s!=="center"?"-"+s:""),H=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Z=Array.isArray(l)?l:[l],F=Z.length>0,$={padding:H,boundary:Z.filter(wb),altBoundary:F},{refs:D,floatingStyles:G,placement:B,isPositioned:q,middlewareData:K}=eb({strategy:"fixed",placement:U,whileElementsMounted:(...Xe)=>Ww(...Xe,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[nb({mainAxis:o+R,alignmentAxis:i}),u&&rb({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?ob():void 0,...$}),u&&sb({...$}),ib({...$,apply:({elements:Xe,rects:ke,availableWidth:Dt,availableHeight:jr})=>{const{width:jt,height:C}=ke.reference,T=Xe.floating.style;T.setProperty("--radix-popper-available-width",`${Dt}px`),T.setProperty("--radix-popper-available-height",`${jr}px`),T.setProperty("--radix-popper-anchor-width",`${jt}px`),T.setProperty("--radix-popper-anchor-height",`${C}px`)}}),P&&lb({element:P,padding:a}),bb({arrowWidth:E,arrowHeight:R}),m&&ab({strategy:"referenceHidden",...$})]}),[te,ae]=Wu(B),re=Ce(v);De(()=>{q&&(re==null||re())},[q,re]);const Ae=(Ft=K.arrow)==null?void 0:Ft.x,qe=(Ke=K.arrow)==null?void 0:Ke.y,at=((we=K.arrow)==null?void 0:we.centerOffset)!==0,[Ht,_t]=d.useState();return De(()=>{w&&_t(window.getComputedStyle(w).zIndex)},[w]),c.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:q?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ht,"--radix-popper-transform-origin":[(Ot=K.transformOrigin)==null?void 0:Ot.x,(Ut=K.transformOrigin)==null?void 0:Ut.y].join(" "),...((Le=K.hide)==null?void 0:Le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(mb,{scope:n,placedSide:te,onArrowChange:b,arrowX:Ae,arrowY:qe,shouldHideArrow:at,children:c.jsx($u.div,{"data-side":te,"data-align":ae,...h,ref:N,style:{...h.style,animation:q?void 0:"none"}})})})});Uu.displayName=Ws;var ju="PopperArrow",yb={top:"bottom",right:"left",bottom:"top",left:"right"},Gu=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=vb(ju,r),i=yb[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(fb,{...o,ref:n,style:{...o.style,display:"block"}})})});Gu.displayName=ju;function wb(e){return e!==null}var bb=e=>({name:"transformOrigin",options:e,fn(t){var y,w,x;const{placement:n,rects:r,middlewareData:o}=t,i=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[l,f]=Wu(n),g={start:"0%",center:"50%",end:"100%"}[f],m=(((w=o.arrow)==null?void 0:w.x)??0)+a/2,p=(((x=o.arrow)==null?void 0:x.y)??0)+u/2;let v="",h="";return l==="bottom"?(v=i?g:`${m}px`,h=`${-u}px`):l==="top"?(v=i?g:`${m}px`,h=`${r.floating.height+u}px`):l==="right"?(v=`${-u}px`,h=i?g:`${p}px`):l==="left"&&(v=`${r.floating.width+u}px`,h=i?g:`${p}px`),{data:{x:v,y:h}}}});function Wu(e){const[t,n="center"]=e.split("-");return[t,n]}var xb=Bu,Cb=Hu,Sb=Uu,Eb=Gu,Nb="Portal",qu=d.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=d.useState(!1);De(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Gr.createPortal(c.jsx(An.div,{...r,ref:t}),i):null});qu.displayName=Nb;function Pb(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var qs=e=>{const{present:t,children:n}=e,r=Tb(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=Tn(r.ref,Ab(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};qs.displayName="Presence";function Tb(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Pb(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const l=Br(r.current);s.current=a==="mounted"?l:"none"},[a]),De(()=>{const l=r.current,f=o.current;if(f!==e){const m=s.current,p=Br(l);e?u("MOUNT"):p==="none"||(l==null?void 0:l.display)==="none"?u("UNMOUNT"):u(f&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),De(()=>{if(t){let l;const f=t.ownerDocument.defaultView??window,g=p=>{const h=Br(r.current).includes(p.animationName);if(p.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=p=>{p.target===t&&(s.current=Br(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{f.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function Br(e){return(e==null?void 0:e.animationName)||"none"}function Ab(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _b="VisuallyHidden",Ku=d.forwardRef((e,t)=>c.jsx(An.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Ku.displayName=_b;var Fb=Ku,[zr,Sx]=xt("Tooltip",[Lu]),Hr=Lu(),Xu="TooltipProvider",Ob=700,Ks="tooltip.open",[Db,Xs]=zr(Xu),Yu=e=>{const{__scopeTooltip:t,delayDuration:n=Ob,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,[i,a]=d.useState(!0),u=d.useRef(!1),l=d.useRef(0);return d.useEffect(()=>{const f=l.current;return()=>window.clearTimeout(f)},[]),c.jsx(Db,{scope:t,isOpenDelayed:i,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(l.current),a(!1)},[]),onClose:d.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:d.useCallback(f=>{u.current=f},[]),disableHoverableContent:o,children:s})};Yu.displayName=Xu;var Ur="Tooltip",[Mb,Dn]=zr(Ur),Ju=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,u=Xs(Ur,e.__scopeTooltip),l=Hr(t),[f,g]=d.useState(null),m=Zt(),p=d.useRef(0),v=i??u.disableHoverableContent,h=a??u.delayDuration,y=d.useRef(!1),[w=!1,x]=Yt({prop:r,defaultProp:o,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(Ks))):u.onClose(),s==null||s(E)}}),N=d.useMemo(()=>w?y.current?"delayed-open":"instant-open":"closed",[w]),P=d.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,x(!0)},[x]),b=d.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),S=d.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,x(!0),p.current=0},h)},[h,x]);return d.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),c.jsx(xb,{...l,children:c.jsx(Mb,{scope:t,contentId:m,open:w,stateAttribute:N,trigger:f,onTriggerChange:g,onTriggerEnter:d.useCallback(()=>{u.isOpenDelayed?S():P()},[u.isOpenDelayed,S,P]),onTriggerLeave:d.useCallback(()=>{v?b():(window.clearTimeout(p.current),p.current=0)},[b,v]),onOpen:P,onClose:b,disableHoverableContent:v,children:n})})};Ju.displayName=Ur;var Ys="TooltipTrigger",Zu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Dn(Ys,n),s=Xs(Ys,n),i=Hr(n),a=d.useRef(null),u=Tn(t,a,o.onTriggerChange),l=d.useRef(!1),f=d.useRef(!1),g=d.useCallback(()=>l.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),c.jsx(Cb,{asChild:!0,...i,children:c.jsx(An.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:dt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:dt(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:dt(e.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:dt(e.onFocus,()=>{l.current||o.onOpen()}),onBlur:dt(e.onBlur,o.onClose),onClick:dt(e.onClick,o.onClose)})})});Zu.displayName=Ys;var Js="TooltipPortal",[Rb,kb]=zr(Js,{forceMount:void 0}),Qu=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Dn(Js,t);return c.jsx(Rb,{scope:t,forceMount:n,children:c.jsx(qs,{present:n||s.open,children:c.jsx(qu,{asChild:!0,container:o,children:r})})})};Qu.displayName=Js;var dn="TooltipContent",ed=d.forwardRef((e,t)=>{const n=kb(dn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Dn(dn,e.__scopeTooltip);return c.jsx(qs,{present:r||i.open,children:i.disableHoverableContent?c.jsx(td,{side:o,...s,ref:t}):c.jsx($b,{side:o,...s,ref:t})})}),$b=d.forwardRef((e,t)=>{const n=Dn(dn,e.__scopeTooltip),r=Xs(dn,e.__scopeTooltip),o=d.useRef(null),s=Tn(t,o),[i,a]=d.useState(null),{trigger:u,onClose:l}=n,f=o.current,{onPointerInTransitChange:g}=r,m=d.useCallback(()=>{a(null),g(!1)},[g]),p=d.useCallback((v,h)=>{const y=v.currentTarget,w={x:v.clientX,y:v.clientY},x=Bb(w,y.getBoundingClientRect()),N=zb(w,x),P=Hb(h.getBoundingClientRect()),b=jb([...N,...P]);a(b),g(!0)},[g]);return d.useEffect(()=>()=>m(),[m]),d.useEffect(()=>{if(u&&f){const v=y=>p(y,f),h=y=>p(y,u);return u.addEventListener("pointerleave",v),f.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",v),f.removeEventListener("pointerleave",h)}}},[u,f,p,m]),d.useEffect(()=>{if(i){const v=h=>{const y=h.target,w={x:h.clientX,y:h.clientY},x=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),N=!Ub(w,i);x?m():N&&(m(),l())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[u,f,i,l,m]),c.jsx(td,{...e,ref:s})}),[Ib,Lb]=zr(Ur,{isInside:!1}),td=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,u=Dn(dn,n),l=Hr(n),{onClose:f}=u;return d.useEffect(()=>(document.addEventListener(Ks,f),()=>document.removeEventListener(Ks,f)),[f]),d.useEffect(()=>{if(u.trigger){const g=m=>{const p=m.target;p!=null&&p.contains(u.trigger)&&f()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[u.trigger,f]),c.jsx(pu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:g=>g.preventDefault(),onDismiss:f,children:c.jsxs(Sb,{"data-state":u.stateAttribute,...l,...a,ref:t,style:{...a.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:[c.jsx(ca,{children:r}),c.jsx(Ib,{scope:n,isInside:!0,children:c.jsx(Fb,{id:u.contentId,role:"tooltip",children:o||r})})]})})});ed.displayName=dn;var nd="TooltipArrow",Vb=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Hr(n);return Lb(nd,n).isInside?null:c.jsx(Eb,{...o,...r,ref:t})});Vb.displayName=nd;function Bb(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function zb(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Hb(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function Ub(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s].x,u=t[s].y,l=t[i].x,f=t[i].y;u>r!=f>r&&n<(l-a)*(r-u)/(f-u)+a&&(o=!o)}return o}function jb(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Gb(t)}function Gb(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}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 Wb=Yu,qb=Ju,Kb=Zu,Xb=Qu,rd=ed;const Yb=Wb,Jb=qb,Zb=Kb,od=d.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(Xb,{children:c.jsx(rd,{ref:r,sideOffset:t,className:J("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));od.displayName=rd.displayName;const sd=({className:e,children:t,content:n,side:r})=>{const[o,s]=O.useState(!1);return c.jsx(Yb,{delayDuration:0,children:c.jsxs(Jb,{open:o,children:[c.jsx(Zb,{asChild:!0,children:c.jsx("button",{type:"button",className:J("cursor-pointer",e),onClick:()=>s(!o),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onTouchStart:()=>s(!o),onKeyDown:i=>{i.preventDefault(),i.key==="Enter"&&s(!o)},children:t})}),c.jsx(od,{side:r,className:n?"":"hidden",children:c.jsx("span",{className:"inline-block",children:n})})]})})},Zs=({className:e,...t})=>c.jsx("nav",{role:"navigation","aria-label":"pagination",className:J("mx-auto flex w-full justify-center",e),...t});Zs.displayName="Pagination";const Qs=d.forwardRef(({className:e,...t},n)=>c.jsx("ul",{ref:n,className:J("flex flex-row items-center gap-1",e),...t}));Qs.displayName="PaginationContent";const gt=d.forwardRef(({className:e,...t},n)=>c.jsx("li",{ref:n,className:J("",e),...t}));gt.displayName="PaginationItem";const Mn=({className:e,isActive:t,size:n="icon",...r})=>c.jsx("a",{"aria-current":t?"page":void 0,className:J(Ea({variant:t?"outline":"ghost",size:n}),e),...r});Mn.displayName="PaginationLink";const ei=({className:e,...t})=>c.jsxs(Mn,{"aria-label":"Go to previous page",size:"default",className:J("gap-1 pl-2.5",e),...t,children:[c.jsx(Ap,{className:"h-4 w-4"}),c.jsx("span",{children:"Previous"})]});ei.displayName="PaginationPrevious";const ti=({className:e,...t})=>c.jsxs(Mn,{"aria-label":"Go to next page",size:"default",className:J("gap-1 pr-2.5",e),...t,children:[c.jsx("span",{children:"Next"}),c.jsx(ia,{className:"h-4 w-4"})]});ti.displayName="PaginationNext";const ni=({className:e,...t})=>c.jsxs("span",{"aria-hidden":!0,className:J("flex h-9 w-9 items-center justify-center",e),...t,children:[c.jsx(_p,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"More pages"})]});ni.displayName="PaginationEllipsis";const Qb=({apiBaseUrl:e="http://localhost:3000"})=>{var x,N,P;const[t,n]=O.useState([]),[r,o]=O.useState(!1),[s,i]=O.useState([]),[a,u]=O.useState(1),[l,f]=O.useState(1),[g,m]=O.useState(null),p=b=>b.map(E=>({id:E==null?void 0:E.id,prefix:(E==null?void 0:E.prefix)||"",model:(E==null?void 0:E.model)||"",fileName:(E==null?void 0:E.file_name)||"",code:(E==null?void 0:E.stock_id)||"",content:(E==null?void 0:E.text_summary)||"",status:(E==null?void 0:E.status)||"",note:(E==null?void 0:E.note)||"",lastUpdate:E==null?void 0:E.updated_at,stock_id:E==null?void 0:E.stock_id})),v=b=>{if(!(b!=null&&b.data))return[];const S=p(b==null?void 0:b.data);n(S),f(b.pagination.totalPages)},h=async(b=1,S=15)=>{console.log("🚀 ~ fetchData ~ page:",b),m(b);try{const E=await se.get(`${e}/api/latest-summaries`,{params:{page:b,limit:S}});console.log("🚀 ~ fetchData ~ result.data:",E.data),(E==null?void 0:E.status)===200?v(E.data):console.error(E)}catch(E){console.error("Error fetching data:",E)}finally{m(null),o(!1)}};O.useEffect(()=>{h(a)},[a]);const y=O.useMemo(()=>[{id:"code",header:"Mã",accessorKey:"code",cell:({row:S})=>c.jsx("span",{className:"flex flex-col",children:S.original.code})},{id:"fileName",header:"Tên file",accessorKey:"fileName",cell:({row:S})=>c.jsx("span",{className:"flex flex-col",children:S.original.fileName})},{id:"content",header:"Nội dung",accessorKey:"content",cell:({row:S})=>{const E=S.getValue("content");return c.jsx(sd,{content:c.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:E}),children:c.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[30dvw]",children:E})})}},{id:"status",header:"Trạng thái",accessorKey:"status",cell:({row:S})=>c.jsx("span",{className:"flex flex-col",children:S.original.status})},{id:"note",header:"Ghi chú",accessorKey:"note",cell:({row:S})=>c.jsx(sd,{content:c.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:S.original.note}),children:c.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[20dvw]",children:S.original.note})})},{id:"last-update",header:"Cập nhật",accessorKey:"last-update",cell:({row:S})=>{const R=new Date(S.original.lastUpdate).getMonth()+1;return c.jsxs("span",{className:"flex flex-col",children:["tháng ",R]})}},{accessorKey:"edit",header:()=>c.jsx("div",{className:"font-medium text-center",children:"Sửa"}),cell:({row:S})=>{const[E,R]=O.useState(!1),[U,H]=O.useState(!1),{handleSubmit:Z,register:F,reset:$}=tw(),D=S.original.id,G=async B=>{R(!0);try{const q=await se.patch(`${e}/api/update-summary`,{note:B.note,text_summary:B.content,id:D});q.status===200?(await h(a),H(!1)):console.error("Failed to update summary:",q)}catch(q){console.error("Error updating summary:",q)}return R(!1)};return c.jsxs(rn,{open:U,onOpenChange:B=>{H(B),B?$({content:S.original.content,note:S.original.note}):$()},children:[c.jsx(lr,{className:"w-full",children:c.jsx("div",{onClick:()=>H(B=>!B),className:"font-medium text-center text-orange-500 cursor-pointer",children:"sửa"})}),c.jsx(It,{className:"rounded-lg sm:px-3 h-[calc(100dvh-200px)] min-w-[calc(100dvw-112px)]",children:c.jsxs(Lt,{className:"flex flex-col gap-3",children:[c.jsx(Vt,{className:"max-sm:hidden text-center",children:"Sửa summary"}),c.jsxs("form",{className:"flex flex-col gap-3 h-full justify-between",onSubmit:Z(G),children:[c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"flex flex-col items-start",children:[c.jsx("span",{children:"Nội dung:"}),c.jsx(mr,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:S.original.answer||"",rows:10,...F("content")})]}),c.jsxs("div",{className:"flex flex-col items-start",children:[c.jsx("span",{children:"Lưu ý:"}),c.jsx(mr,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:S.original.note||"",rows:1,...F("note")})]})]}),c.jsx("div",{className:"flex justify-end",children:c.jsx(ue,{disabled:E,type:"submit",variant:"default",children:"Ok"})})]})]})})]})}},{id:"publish",header:"",accessorKey:"publish",cell:({row:S})=>{const[E,R]=O.useState(!1),[U,H]=O.useState(!1),Z=S.original.id,F=S.getValue("status"),$=S.getValue("code"),G=new Date(S.original.lastUpdate).getMonth()+1,[B,q]=O.useState(""),[K,te]=O.useState("1"),ae=async()=>{try{R(!0);try{const re=await se.patch(`${e}/api/toggle-publish/${Z}`,{id:Z,status:F,idInput:K,stock_id:S.original.stock_id,bucket:B,prefix:S.original.prefix,model:S.original.model,summary_result:S.original.content,note:S.original.note});re.status===200?(h(a),H(!1)):console.error("Failed to toggle publish status:",re)}catch(re){console.error("Error toggling publish status:",re)}finally{q(""),R(!1)}}catch{}};return c.jsxs(rn,{open:U,onOpenChange:re=>{H(re)},children:[c.jsx(lr,{className:"w-full",children:c.jsx("div",{onClick:()=>H(re=>!re),className:"font-medium text-start text-green-400 cursor-pointer",children:F==="unpublish"?"Publish":"Unpublish"})}),c.jsx(It,{className:"rounded-lg sm:px-3 sm:w-[calc(100%-30px)]",children:c.jsxs(Lt,{className:"flex flex-col gap-3",children:[c.jsxs(Vt,{children:[F==="unpublish"?"Publish":"Unpublish"," Summary?"]}),c.jsxs("span",{children:["Bạn có muốn ",F==="unpublish"?"publish":"unpublish"," summary mã ",$," ","tháng ",G," không?"]}),c.jsxs("div",{children:[c.jsx("span",{children:"id:"}),c.jsx(Et,{type:"number",value:K,onChange:re=>te(re.target.value)})]}),c.jsxs("div",{children:[c.jsx("span",{children:"bucket:"}),c.jsx(Et,{value:B,onChange:re=>q(re.target.value)})]}),c.jsx("div",{className:"flex items-center justify-end",children:c.jsx(ue,{onClick:ae,disabled:E,children:"ok"})})]})})]})}}],[]),w=bi({data:t,columns:y,state:{columnFilters:s},enableRowSelection:!0,onColumnFiltersChange:i,getFilteredRowModel:Xd(),getCoreRowModel:wi()});return c.jsxs("div",{className:"space-y-4 s3-explr-container",children:[c.jsx("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:c.jsx(Et,{placeholder:"Tìm kiếm theo mã...",value:((x=w.getColumn("code"))==null?void 0:x.getFilterValue())??"",onChange:b=>{var S;return(S=w.getColumn("code"))==null?void 0:S.setFilterValue(b.target.value)},className:"max-w-sm"})}),c.jsx("div",{className:"rounded-md border s3-explr-table-container",children:c.jsxs(ur,{className:"s3-explr-table",children:[c.jsx(dr,{className:"s3-explr-table-header",children:w.getHeaderGroups().map(b=>c.jsx(Ue,{className:"hover:bg-transparent s3-explr-header-row",children:b.headers.map(S=>c.jsx(Qe,{className:"s3-explr-header-cell",children:S.isPlaceholder?null:Bn(S.column.columnDef.header,S.getContext())},S.id))},b.id))}),c.jsx(fr,{className:"s3-explr-table-body",children:(N=w.getRowModel().rows)!=null&&N.length?(P=w.getRowModel().rows)==null?void 0:P.map(b=>c.jsx(Ue,{className:"h-12 s3-explr-row",children:b.getVisibleCells().map(S=>c.jsx(Pe,{className:"align-middle s3-explr-cell",children:Bn(S.column.columnDef.cell,S.getContext())},S.id))},b.id)):r?c.jsx(Ue,{children:c.jsx(Pe,{colSpan:y.length,className:"h-24 text-center",children:"loading..."})}):c.jsx(Ue,{children:c.jsx(Pe,{colSpan:y.length,className:"h-24 text-center",children:"Không có kết quả."})})})]})}),c.jsx("div",{className:"mt-4",children:c.jsx(Zs,{children:c.jsxs(Qs,{children:[c.jsx(gt,{children:c.jsx(ei,{onClick:()=>u(b=>Math.max(1,b-1)),className:a===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:l},(b,S)=>S+1).filter(b=>b===1||b===l||Math.abs(b-a)<=1).map((b,S,E)=>c.jsxs(c.Fragment,{children:[S>0&&E[S-1]!==b-1&&c.jsx(gt,{children:c.jsx(ni,{})},b+"..."),c.jsx(gt,{children:c.jsx(Mn,{onClick:()=>u(b),isActive:a===b,className:`cursor-pointer ${r?"pointer-events-none":""}`,children:g===b?c.jsx(Ne,{className:"h-4 w-4 animate-spin"}):b})},b)]})),c.jsx(gt,{children:c.jsx(ti,{onClick:()=>u(b=>Math.min(l,b+1)),className:a===l||g!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})},id=10,ex=O.memo(({apiBaseUrl:e="http://localhost:3000"})=>{const[t,n]=O.useState(1),[r,o]=O.useState([]),[s,i]=O.useState({total:0,page:1,limit:id,totalPages:1}),[a,u]=O.useState(!0),[l,f]=O.useState(null),[g,m]=O.useState(new Set),{toast:p}=Cs(),[v,h]=O.useState(!1),y=async b=>{try{f(b);const S=await se.get(`${e}/api/jobs`,{params:{page:b.toString(),limit:id.toString()}});o(S.data.data),i(S.data.pagination)}catch{p({variant:"destructive",title:"Error",description:"Failed to fetch jobs. Please try again."})}finally{f(null),u(!1)}};O.useEffect(()=>{y(t)},[t,e]);const w=async b=>{m(S=>new Set(S).add(b.toString()));try{await se.post(`${e}/api/retry-job`,{jobId:b}),p({title:"Job Restarted",description:`Job ${b} has been successfully restarted.`}),y(t)}catch{p({variant:"destructive",title:"Retry Failed",description:`Failed to restart job ${b}. Please try again.`})}finally{m(S=>{const E=new Set(S);return E.delete(b.toString()),E})}},x=async()=>{h(!0),n(1),await y(1),h(!1)},N=b=>new Date(b).toLocaleString(),P=b=>{if(b=parseFloat(b),b<60)return`${b.toFixed(2)}s`;const S=Math.floor(b/60),E=(b%60).toFixed(0);return`${S}m ${E}s`};return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[c.jsx(Pp,{className:"w-8 h-8 text-primary"}),c.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Job Management"}),c.jsx(ue,{variant:"outline",size:"icon",onClick:x,disabled:v||a,className:"ml-2",children:c.jsx(Fp,{className:`h-4 w-4 ${v?"animate-spin":""}`})})]}),c.jsx("div",{className:"rounded-md border",children:c.jsxs(ur,{children:[c.jsx(dr,{children:c.jsxs(Ue,{children:[c.jsx(Qe,{children:"ID"}),c.jsx(Qe,{children:"Tên Công Việc"}),c.jsx(Qe,{children:"Thời Gian Bắt Đầu"}),c.jsx(Qe,{children:"Thời Gian Cập Nhật"}),c.jsx(Qe,{children:"Thời Gian Thực Thi"}),c.jsx(Qe,{children:"Trạng Thái"}),c.jsx(Qe,{children:"Thao Tác"})]})}),c.jsx(fr,{children:a&&r.length===0?c.jsx(Ue,{children:c.jsx(Pe,{colSpan:7,className:"text-center py-4",children:c.jsx(Ne,{className:"w-6 h-6 animate-spin mx-auto"})})}):r.map(b=>{var S,E;return c.jsxs(Ue,{children:[c.jsx(Pe,{className:"!w-[100px]",children:b.id}),c.jsx(Pe,{className:"font-medium",children:(S=b.job_name)==null?void 0:S.replace("Upload file","Summary")}),c.jsx(Pe,{className:"!w-[200px]",children:N(b.created_at)}),c.jsx(Pe,{className:"!w-[200px]",children:N(b.updated_at)}),c.jsx(Pe,{className:"!w-[150px]",children:P(b.execution_time_seconds)}),c.jsx(Pe,{className:"!w-[200px]",children:c.jsx("div",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium
|
|
132
132
|
${b.status==="done"?"bg-green-100 text-green-800":b.status==="fail"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800"}`,children:(E=b.status)==null?void 0:E.replace("fail","failed").toUpperCase()})}),c.jsx(Pe,{className:"!w-[200px]",children:b.status==="fail"?c.jsx(ue,{variant:"outline",size:"sm",onClick:()=>w(b.id),disabled:g.has(b.id.toString()),className:"h-[32px]",children:g.has(b.id.toString())?c.jsxs(c.Fragment,{children:[c.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Đang thử lại..."]}):"Thử Lại"}):c.jsx("div",{className:"h-[32px]"})})]},b.id)})})]})}),c.jsx("div",{className:"mt-4",children:c.jsx(Zs,{children:c.jsxs(Qs,{children:[c.jsx(gt,{children:c.jsx(ei,{onClick:()=>n(b=>Math.max(1,b-1)),className:t===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:s.totalPages},(b,S)=>S+1).filter(b=>b===1||b===s.totalPages||Math.abs(b-t)<=1).map((b,S,E)=>c.jsxs(c.Fragment,{children:[S>0&&E[S-1]!==b-1&&c.jsx(gt,{children:c.jsx(ni,{})},b+"..."),c.jsx(gt,{children:c.jsx(Mn,{onClick:()=>n(b),isActive:t===b,className:`cursor-pointer ${l!==null?"pointer-events-none":""}`,children:l===b?c.jsx(Ne,{className:"h-4 w-4 animate-spin"}):b})},b)]})),c.jsx(gt,{children:c.jsx(ti,{onClick:()=>n(b=>Math.min(s.totalPages,b+1)),className:t===s.totalPages||l!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})}),c.jsx(Dc,{})]})});Ve.Job=ex,Ve.S3Explorer=Ry,Ve.Summary=Qb,Object.defineProperty(Ve,Symbol.toStringTag,{value:"Module"})});
|
|
133
133
|
//# sourceMappingURL=s3-explorer.umd.cjs.map
|