import{r as c,j as b,R}from"./app-DhRhnYTp.js";import{u as O,S as I,P as D,d as $}from"./index-Bo28OnLq.js";import{R as z}from"./index-CxJRE1yb.js";function M(e,t,{checkForDefaultPrevented:s=!0}={}){return function(n){if(e==null||e(n),s===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}function ae(e,t){const s=c.createContext(t),r=o=>{const{children:a,...i}=o,d=c.useMemo(()=>i,Object.values(i));return b.jsx(s.Provider,{value:d,children:a})};r.displayName=e+"Provider";function n(o){const a=c.useContext(s);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,n]}function V(e,t=[]){let s=[];function r(o,a){const i=c.createContext(a),d=s.length;s=[...s,a];const u=E=>{var y;const{scope:p,children:h,...f}=E,m=((y=p==null?void 0:p[e])==null?void 0:y[d])||i,C=c.useMemo(()=>f,Object.values(f));return b.jsx(m.Provider,{value:C,children:h})};u.displayName=o+"Provider";function l(E,p){var m;const h=((m=p==null?void 0:p[e])==null?void 0:m[d])||i,f=c.useContext(h);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${E}\` must be used within \`${o}\``)}return[u,l]}const n=()=>{const o=s.map(a=>c.createContext(a));return function(i){const d=(i==null?void 0:i[e])||o;return c.useMemo(()=>({[`__scope${e}`]:{...i,[e]:d}}),[i,d])}};return n.scopeName=e,[r,K(n,...t)]}function K(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const r=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(o){const a=r.reduce((i,{useScope:d,scopeName:u})=>{const E=d(o)[`__scope${u}`];return{...i,...E}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return s.scopeName=t.scopeName,s}function S(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...s)=>{var r;return(r=t.current)==null?void 0:r.call(t,...s)},[])}function ue({prop:e,defaultProp:t,onChange:s=()=>{}}){const[r,n]=q({defaultProp:t,onChange:s}),o=e!==void 0,a=o?e:r,i=S(s),d=c.useCallback(u=>{if(o){const E=typeof u=="function"?u(e):u;E!==e&&i(E)}else n(u)},[o,e,n,i]);return[a,d]}function q({defaultProp:e,onChange:t}){const s=c.useState(e),[r]=s,n=c.useRef(r),o=S(t);return c.useEffect(()=>{n.current!==r&&(o(r),n.current=r)},[r,n,o]),s}var X=globalThis!=null&&globalThis.document?c.useLayoutEffect:()=>{};function le(e){const t=e+"CollectionProvider",[s,r]=V(t),[n,o]=s(t,{collectionRef:{current:null},itemMap:new Map}),a=h=>{const{scope:f,children:m}=h,C=R.useRef(null),y=R.useRef(new Map).current;return b.jsx(n,{scope:f,itemMap:y,collectionRef:C,children:m})};a.displayName=t;const i=e+"CollectionSlot",d=R.forwardRef((h,f)=>{const{scope:m,children:C}=h,y=o(i,m),P=O(f,y.collectionRef);return b.jsx(I,{ref:P,children:C})});d.displayName=i;const u=e+"CollectionItemSlot",l="data-radix-collection-item",E=R.forwardRef((h,f)=>{const{scope:m,children:C,...y}=h,P=R.useRef(null),w=O(f,P),x=o(u,m);return R.useEffect(()=>(x.itemMap.set(P,{ref:P,...y}),()=>void x.itemMap.delete(P))),b.jsx(I,{[l]:"",ref:w,children:C})});E.displayName=u;function p(h){const f=o(e+"CollectionConsumer",h);return R.useCallback(()=>{const C=f.collectionRef.current;if(!C)return[];const y=Array.from(C.querySelectorAll(`[${l}]`));return Array.from(f.itemMap.values()).sort((x,g)=>y.indexOf(x.ref.current)-y.indexOf(g.ref.current))},[f.collectionRef,f.itemMap])}return[{Provider:a,Slot:d,ItemSlot:E},p,r]}function Y(e,t=globalThis==null?void 0:globalThis.document){const s=S(e);c.useEffect(()=>{const r=n=>{n.key==="Escape"&&s(n)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[s,t])}var G="DismissableLayer",N="dismissableLayer.update",J="dismissableLayer.pointerDownOutside",Q="dismissableLayer.focusOutside",B,W=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),k=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:n,onFocusOutside:o,onInteractOutside:a,onDismiss:i,...d}=e,u=c.useContext(W),[l,E]=c.useState(null),p=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=c.useState({}),f=O(t,v=>E(v)),m=Array.from(u.layers),[C]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(C),P=l?m.indexOf(l):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,x=P>=y,g=H(v=>{const L=v.target,_=[...u.branches].some(T=>T.contains(L));!x||_||(n==null||n(v),a==null||a(v),v.defaultPrevented||i==null||i())},p),A=ee(v=>{const L=v.target;[...u.branches].some(T=>T.contains(L))||(o==null||o(v),a==null||a(v),v.defaultPrevented||i==null||i())},p);return Y(v=>{P===u.layers.size-1&&(r==null||r(v),!v.defaultPrevented&&i&&(v.preventDefault(),i()))},p),c.useEffect(()=>{if(l)return s&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(B=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),j(),()=>{s&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=B)}},[l,p,s,u]),c.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),j())},[l,u]),c.useEffect(()=>{const v=()=>h({});return document.addEventListener(N,v),()=>document.removeEventListener(N,v)},[]),b.jsx(D.div,{...d,ref:f,style:{pointerEvents:w?x?"auto":"none":void 0,...e.style},onFocusCapture:M(e.onFocusCapture,A.onFocusCapture),onBlurCapture:M(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:M(e.onPointerDownCapture,g.onPointerDownCapture)})});k.displayName=G;var Z="DismissableLayerBranch",F=c.forwardRef((e,t)=>{const s=c.useContext(W),r=c.useRef(null),n=O(t,r);return c.useEffect(()=>{const o=r.current;if(o)return s.branches.add(o),()=>{s.branches.delete(o)}},[s.branches]),b.jsx(D.div,{...e,ref:n})});F.displayName=Z;function H(e,t=globalThis==null?void 0:globalThis.document){const s=S(e),r=c.useRef(!1),n=c.useRef(()=>{});return c.useEffect(()=>{const o=i=>{if(i.target&&!r.current){let d=function(){U(J,s,u,{discrete:!0})};const u={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=d,t.addEventListener("click",n.current,{once:!0})):d()}else t.removeEventListener("click",n.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",n.current)}},[t,s]),{onPointerDownCapture:()=>r.current=!0}}function ee(e,t=globalThis==null?void 0:globalThis.document){const s=S(e),r=c.useRef(!1);return c.useEffect(()=>{const n=o=>{o.target&&!r.current&&U(Q,s,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,s]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function j(){const e=new CustomEvent(N);document.dispatchEvent(e)}function U(e,t,s,{discrete:r}){const n=s.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:s});t&&n.addEventListener(e,t,{once:!0}),r?$(n,o):n.dispatchEvent(o)}var de=k,fe=F,te="Portal",ne=c.forwardRef((e,t)=>{var i;const{container:s,...r}=e,[n,o]=c.useState(!1);X(()=>o(!0),[]);const a=s||n&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?z.createPortal(b.jsx(D.div,{...r,ref:t}),a):null});ne.displayName=te;var se="VisuallyHidden",re=c.forwardRef((e,t)=>b.jsx(D.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}}));re.displayName=se;export{fe as B,k as D,ne as P,de as R,re as V,M as a,X as b,V as c,S as d,le as e,ae as f,ue as u};
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]