knowns 0.8.6 → 0.8.7

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.
@@ -54,7 +54,7 @@ Error generating stack: `+x.message+`
54
54
  `)},W$=function(){var e=parseInt(document.body.getAttribute(Qp)||"0",10);return isFinite(e)?e:0},aEe=function(){v.useEffect(function(){return document.body.setAttribute(Qp,(W$()+1).toString()),function(){var e=W$()-1;e<=0?document.body.removeAttribute(Qp):document.body.setAttribute(Qp,e.toString())}},[])},lEe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;aEe();var o=v.useMemo(function(){return iEe(i)},[i]);return v.createElement(oEe,{styles:sEe(o,!t,i,n?"":"!important")})},bR=!1;if(typeof window<"u")try{var xv=Object.defineProperty({},"passive",{get:function(){return bR=!0,!0}});window.addEventListener("test",xv,xv),window.removeEventListener("test",xv,xv)}catch{bR=!1}var xp=bR?{passive:!1}:!1,cEe=function(e){return e.tagName==="TEXTAREA"},XX=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!cEe(e)&&n[t]==="visible")},uEe=function(e){return XX(e,"overflowY")},dEe=function(e){return XX(e,"overflowX")},Y$=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=ZX(e,r);if(i){var o=QX(e,r),s=o[1],a=o[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},fEe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},pEe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},ZX=function(e,t){return e==="v"?uEe(t):dEe(t)},QX=function(e,t){return e==="v"?fEe(t):pEe(t)},hEe=function(e,t){return e==="h"&&t==="rtl"?-1:1},mEe=function(e,t,n,r,i){var o=hEe(e,window.getComputedStyle(t).direction),s=o*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,h=0;do{if(!a)break;var g=QX(e,a),y=g[0],E=g[1],S=g[2],w=E-S-o*y;(y||w)&&ZX(e,a)&&(f+=w,h+=y);var T=a.parentNode;a=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(f)<1||!u&&Math.abs(h)<1)&&(c=!0),c},Ev=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},K$=function(e){return[e.deltaX,e.deltaY]},X$=function(e){return e&&"current"in e?e.current:e},gEe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bEe=function(e){return`
55
55
  .block-interactivity-`.concat(e,` {pointer-events: none;}
56
56
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
57
- `)},yEe=0,Ep=[];function vEe(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(yEe++)[0],o=v.useState(KX)[0],s=v.useRef(e);v.useEffect(function(){s.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var E=$xe([e.lockRef.current],(e.shards||[]).map(X$),!0).filter(Boolean);return E.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),E.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(E,S){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!s.current.allowPinchZoom;var w=Ev(E),T=n.current,A="deltaX"in E?E.deltaX:T[0]-w[0],R="deltaY"in E?E.deltaY:T[1]-w[1],_,D=E.target,I=Math.abs(A)>Math.abs(R)?"h":"v";if("touches"in E&&I==="h"&&D.type==="range")return!1;var M=window.getSelection(),j=M&&M.anchorNode,L=j?j===D||j.contains(D):!1;if(L)return!1;var F=Y$(I,D);if(!F)return!0;if(F?_=I:(_=I==="v"?"h":"v",F=Y$(I,D)),!F)return!1;if(!r.current&&"changedTouches"in E&&(A||R)&&(r.current=_),!_)return!0;var H=r.current||_;return mEe(H,S,E,H==="h"?A:R)},[]),l=v.useCallback(function(E){var S=E;if(!(!Ep.length||Ep[Ep.length-1]!==o)){var w="deltaY"in S?K$(S):Ev(S),T=t.current.filter(function(_){return _.name===S.type&&(_.target===S.target||S.target===_.shadowParent)&&gEe(_.delta,w)})[0];if(T&&T.should){S.cancelable&&S.preventDefault();return}if(!T){var A=(s.current.shards||[]).map(X$).filter(Boolean).filter(function(_){return _.contains(S.target)}),R=A.length>0?a(S,A[0]):!s.current.noIsolation;R&&S.cancelable&&S.preventDefault()}}},[]),c=v.useCallback(function(E,S,w,T){var A={name:E,delta:S,target:w,should:T,shadowParent:xEe(w)};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(R){return R!==A})},1)},[]),u=v.useCallback(function(E){n.current=Ev(E),r.current=void 0},[]),f=v.useCallback(function(E){c(E.type,K$(E),E.target,a(E,e.lockRef.current))},[]),h=v.useCallback(function(E){c(E.type,Ev(E),E.target,a(E,e.lockRef.current))},[]);v.useEffect(function(){return Ep.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,xp),document.addEventListener("touchmove",l,xp),document.addEventListener("touchstart",u,xp),function(){Ep=Ep.filter(function(E){return E!==o}),document.removeEventListener("wheel",l,xp),document.removeEventListener("touchmove",l,xp),document.removeEventListener("touchstart",u,xp)}},[]);var g=e.removeScrollBar,y=e.inert;return v.createElement(v.Fragment,null,y?v.createElement(o,{styles:bEe(i)}):null,g?v.createElement(lEe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xEe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const EEe=Kxe(YX,vEe);var J0=v.forwardRef(function(e,t){return v.createElement(Aw,Ha({},e,{ref:t,sideCar:EEe}))});J0.classNames=Aw.classNames;var SEe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Sp=new WeakMap,Sv=new WeakMap,wv={},wN=0,JX=function(e){return e&&(e.host||JX(e.parentNode))},wEe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=JX(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},CEe=function(e,t,n,r){var i=wEe(t,Array.isArray(e)?e:[e]);wv[n]||(wv[n]=new WeakMap);var o=wv[n],s=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var g=h.getAttribute(r),y=g!==null&&g!=="false",E=(Sp.get(h)||0)+1,S=(o.get(h)||0)+1;Sp.set(h,E),o.set(h,S),s.push(h),E===1&&y&&Sv.set(h,!0),S===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return u(t),a.clear(),wN++,function(){s.forEach(function(f){var h=Sp.get(f)-1,g=o.get(f)-1;Sp.set(f,h),o.set(f,g),h||(Sv.has(f)||f.removeAttribute(r),Sv.delete(f)),g||f.removeAttribute(n)}),wN--,wN||(Sp=new WeakMap,Sp=new WeakMap,Sv=new WeakMap,wv={})}},Nw=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=SEe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),CEe(r,i,n,"aria-hidden")):function(){return null}},_w="Dialog",[eZ]=Bve(_w),[TEe,Ca]=eZ(_w),tZ=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=v.useRef(null),l=v.useRef(null),[c,u]=Us({prop:r,defaultProp:i??!1,onChange:o,caller:_w});return m.jsx(TEe,{scope:t,triggerRef:a,contentRef:l,contentId:xr(),titleId:xr(),descriptionId:xr(),open:c,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(f=>!f),[u]),modal:s,children:n})};tZ.displayName=_w;var nZ="DialogTrigger",kEe=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(nZ,n),o=It(t,i.triggerRef);return m.jsx(Q0.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":TO(i.open),...r,ref:o,onClick:Ue(e.onClick,i.onOpenToggle)})});kEe.displayName=nZ;var wO="DialogPortal",[AEe,rZ]=eZ(wO,{forceMount:void 0}),iZ=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Ca(wO,t);return m.jsx(AEe,{scope:t,forceMount:n,children:v.Children.map(r,s=>m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:s})}))})};iZ.displayName=wO;var xE="DialogOverlay",oZ=v.forwardRef((e,t)=>{const n=rZ(xE,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ca(xE,e.__scopeDialog);return o.modal?m.jsx(Yr,{present:r||o.open,children:m.jsx(_Ee,{...i,ref:t})}):null});oZ.displayName=xE;var NEe=GX("DialogOverlay.RemoveScroll"),_Ee=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(xE,n);return m.jsx(J0,{as:NEe,allowPinchZoom:!0,shards:[i.contentRef],children:m.jsx(Q0.div,{"data-state":TO(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Yd="DialogContent",sZ=v.forwardRef((e,t)=>{const n=rZ(Yd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ca(Yd,e.__scopeDialog);return m.jsx(Yr,{present:r||o.open,children:o.modal?m.jsx(REe,{...i,ref:t}):m.jsx(DEe,{...i,ref:t})})});sZ.displayName=Yd;var REe=v.forwardRef((e,t)=>{const n=Ca(Yd,e.__scopeDialog),r=v.useRef(null),i=It(t,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return Nw(o)},[]),m.jsx(aZ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ue(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault())})}),DEe=v.forwardRef((e,t)=>{const n=Ca(Yd,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return m.jsx(aZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;n.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),aZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Ca(Yd,n),l=v.useRef(null),c=It(t,l);return kw(),m.jsxs(m.Fragment,{children:[m.jsx(Z0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:m.jsx(tm,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":TO(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(IEe,{titleId:a.titleId}),m.jsx(MEe,{contentRef:l,descriptionId:a.descriptionId})]})]})}),CO="DialogTitle",lZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(CO,n);return m.jsx(Q0.h2,{id:i.titleId,...r,ref:t})});lZ.displayName=CO;var cZ="DialogDescription",uZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(cZ,n);return m.jsx(Q0.p,{id:i.descriptionId,...r,ref:t})});uZ.displayName=cZ;var dZ="DialogClose",fZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(dZ,n);return m.jsx(Q0.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,()=>i.onOpenChange(!1))})});fZ.displayName=dZ;function TO(e){return e?"open":"closed"}var pZ="DialogTitleWarning",[Fpt,hZ]=Fve(pZ,{contentName:Yd,titleName:CO,docsSlug:"dialog"}),IEe=({titleId:e})=>{const t=hZ(pZ),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
57
+ `)},yEe=0,Ep=[];function vEe(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(yEe++)[0],o=v.useState(KX)[0],s=v.useRef(e);v.useEffect(function(){s.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var E=$xe([e.lockRef.current],(e.shards||[]).map(X$),!0).filter(Boolean);return E.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),E.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(E,S){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!s.current.allowPinchZoom;var w=Ev(E),T=n.current,A="deltaX"in E?E.deltaX:T[0]-w[0],R="deltaY"in E?E.deltaY:T[1]-w[1],_,D=E.target,I=Math.abs(A)>Math.abs(R)?"h":"v";if("touches"in E&&I==="h"&&D.type==="range")return!1;var M=window.getSelection(),j=M&&M.anchorNode,L=j?j===D||j.contains(D):!1;if(L)return!1;var F=Y$(I,D);if(!F)return!0;if(F?_=I:(_=I==="v"?"h":"v",F=Y$(I,D)),!F)return!1;if(!r.current&&"changedTouches"in E&&(A||R)&&(r.current=_),!_)return!0;var H=r.current||_;return mEe(H,S,E,H==="h"?A:R)},[]),l=v.useCallback(function(E){var S=E;if(!(!Ep.length||Ep[Ep.length-1]!==o)){var w="deltaY"in S?K$(S):Ev(S),T=t.current.filter(function(_){return _.name===S.type&&(_.target===S.target||S.target===_.shadowParent)&&gEe(_.delta,w)})[0];if(T&&T.should){S.cancelable&&S.preventDefault();return}if(!T){var A=(s.current.shards||[]).map(X$).filter(Boolean).filter(function(_){return _.contains(S.target)}),R=A.length>0?a(S,A[0]):!s.current.noIsolation;R&&S.cancelable&&S.preventDefault()}}},[]),c=v.useCallback(function(E,S,w,T){var A={name:E,delta:S,target:w,should:T,shadowParent:xEe(w)};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(R){return R!==A})},1)},[]),u=v.useCallback(function(E){n.current=Ev(E),r.current=void 0},[]),f=v.useCallback(function(E){c(E.type,K$(E),E.target,a(E,e.lockRef.current))},[]),h=v.useCallback(function(E){c(E.type,Ev(E),E.target,a(E,e.lockRef.current))},[]);v.useEffect(function(){return Ep.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,xp),document.addEventListener("touchmove",l,xp),document.addEventListener("touchstart",u,xp),function(){Ep=Ep.filter(function(E){return E!==o}),document.removeEventListener("wheel",l,xp),document.removeEventListener("touchmove",l,xp),document.removeEventListener("touchstart",u,xp)}},[]);var g=e.removeScrollBar,y=e.inert;return v.createElement(v.Fragment,null,y?v.createElement(o,{styles:bEe(i)}):null,g?v.createElement(lEe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xEe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const EEe=Kxe(YX,vEe);var J0=v.forwardRef(function(e,t){return v.createElement(Aw,Ha({},e,{ref:t,sideCar:EEe}))});J0.classNames=Aw.classNames;var SEe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Sp=new WeakMap,Sv=new WeakMap,wv={},wN=0,JX=function(e){return e&&(e.host||JX(e.parentNode))},wEe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=JX(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},CEe=function(e,t,n,r){var i=wEe(t,Array.isArray(e)?e:[e]);wv[n]||(wv[n]=new WeakMap);var o=wv[n],s=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var g=h.getAttribute(r),y=g!==null&&g!=="false",E=(Sp.get(h)||0)+1,S=(o.get(h)||0)+1;Sp.set(h,E),o.set(h,S),s.push(h),E===1&&y&&Sv.set(h,!0),S===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return u(t),a.clear(),wN++,function(){s.forEach(function(f){var h=Sp.get(f)-1,g=o.get(f)-1;Sp.set(f,h),o.set(f,g),h||(Sv.has(f)||f.removeAttribute(r),Sv.delete(f)),g||f.removeAttribute(n)}),wN--,wN||(Sp=new WeakMap,Sp=new WeakMap,Sv=new WeakMap,wv={})}},Nw=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=SEe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),CEe(r,i,n,"aria-hidden")):function(){return null}},_w="Dialog",[eZ]=Bve(_w),[TEe,Ca]=eZ(_w),tZ=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=v.useRef(null),l=v.useRef(null),[c,u]=Us({prop:r,defaultProp:i??!1,onChange:o,caller:_w});return m.jsx(TEe,{scope:t,triggerRef:a,contentRef:l,contentId:xr(),titleId:xr(),descriptionId:xr(),open:c,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(f=>!f),[u]),modal:s,children:n})};tZ.displayName=_w;var nZ="DialogTrigger",kEe=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(nZ,n),o=It(t,i.triggerRef);return m.jsx(Q0.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":TO(i.open),...r,ref:o,onClick:Ue(e.onClick,i.onOpenToggle)})});kEe.displayName=nZ;var wO="DialogPortal",[AEe,rZ]=eZ(wO,{forceMount:void 0}),iZ=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Ca(wO,t);return m.jsx(AEe,{scope:t,forceMount:n,children:v.Children.map(r,s=>m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:s})}))})};iZ.displayName=wO;var xE="DialogOverlay",oZ=v.forwardRef((e,t)=>{const n=rZ(xE,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ca(xE,e.__scopeDialog);return o.modal?m.jsx(Yr,{present:r||o.open,children:m.jsx(_Ee,{...i,ref:t})}):null});oZ.displayName=xE;var NEe=GX("DialogOverlay.RemoveScroll"),_Ee=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(xE,n);return m.jsx(J0,{as:NEe,allowPinchZoom:!0,shards:[i.contentRef],children:m.jsx(Q0.div,{"data-state":TO(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Yd="DialogContent",sZ=v.forwardRef((e,t)=>{const n=rZ(Yd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ca(Yd,e.__scopeDialog);return m.jsx(Yr,{present:r||o.open,children:o.modal?m.jsx(REe,{...i,ref:t}):m.jsx(DEe,{...i,ref:t})})});sZ.displayName=Yd;var REe=v.forwardRef((e,t)=>{const n=Ca(Yd,e.__scopeDialog),r=v.useRef(null),i=It(t,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return Nw(o)},[]),m.jsx(aZ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ue(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault())})}),DEe=v.forwardRef((e,t)=>{const n=Ca(Yd,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return m.jsx(aZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;n.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),aZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Ca(Yd,n),l=v.useRef(null),c=It(t,l);return kw(),m.jsxs(m.Fragment,{children:[m.jsx(Z0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:m.jsx(tm,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":TO(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(IEe,{titleId:a.titleId}),m.jsx(MEe,{contentRef:l,descriptionId:a.descriptionId})]})]})}),CO="DialogTitle",lZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(CO,n);return m.jsx(Q0.h2,{id:i.titleId,...r,ref:t})});lZ.displayName=CO;var cZ="DialogDescription",uZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(cZ,n);return m.jsx(Q0.p,{id:i.descriptionId,...r,ref:t})});uZ.displayName=cZ;var dZ="DialogClose",fZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ca(dZ,n);return m.jsx(Q0.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,()=>i.onOpenChange(!1))})});fZ.displayName=dZ;function TO(e){return e?"open":"closed"}var pZ="DialogTitleWarning",[Bpt,hZ]=Fve(pZ,{contentName:Yd,titleName:CO,docsSlug:"dialog"}),IEe=({titleId:e})=>{const t=hZ(pZ),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
58
58
 
59
59
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
60
60
 
@@ -289,7 +289,7 @@ ${S}
289
289
  `);throw Error("Blocks with the following IDs could not be found in the editor: "+u)}return a.forEach(u=>nI(e,u)),{insertedBlocks:i.map(u=>lr(u,r)),removedBlocks:s}}function HWe(e,t,n,r,i){let o;if(t)if(typeof t=="string")o=Vs([t],e.pmSchema,r);else if(Array.isArray(t))o=Vs(t,e.pmSchema,r);else if(t.type==="tableContent")o=KC(t,e.pmSchema);else throw new il(t.type);else throw new Error("blockContent is required");const s=(i?.document??document).createDocumentFragment();for(const a of o)if(a.type.name!=="text"&&e.schema.inlineContentSchema[a.type.name]){const l=e.schema.inlineContentSpecs[a.type.name].implementation;if(l){const c=k0(a,e.schema.inlineContentSchema,e.schema.styleSchema),u=l.render.call({renderType:"dom",props:void 0},c,()=>{},e);if(u){if(s.appendChild(u.dom),u.contentDOM){const f=n.serializeFragment(a.content,i);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(f)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(const c of a.marks.toReversed())if(c.type.name in e.schema.styleSpecs){const u=e.schema.styleSpecs[c.type.name].implementation.render(c.attrs.stringValue,e);u.contentDOM.appendChild(l),l=u.dom}else{const u=c.type.spec.toDOM(c,!0),f=ts.renderSpec(document,u);f.contentDOM.appendChild(l),l=f.dom}s.appendChild(l)}else{const l=n.serializeFragment(we.from([a]),i);s.appendChild(l)}return s}function zWe(e,t,n,r){var i,o,s,a,l;const c=e.pmSchema.nodes.blockContainer,u=t.props||{};for(const[y,E]of Object.entries(e.schema.blockSchema[t.type].propSchema))!(y in u)&&E.default!==void 0&&(u[y]=E.default);const f=t.children||[],h=e.blockImplementations[t.type].implementation.render.call({renderType:"dom",props:void 0},{...t,props:u,children:f},e);if(h.contentDOM&&t.content){const y=HWe(e,t.content,n,t.type,r);h.contentDOM.appendChild(y)}if(e.pmSchema.nodes[t.type].isInGroup("bnBlock")){if(t.children&&t.children.length>0){const y=vse(e,t.children,n,r);(i=h.contentDOM)==null||i.append(y)}return h.dom}const g=(s=(o=c.spec)==null?void 0:o.toDOM)==null?void 0:s.call(o,c.create({id:t.id,...u}));return(a=g.contentDOM)==null||a.appendChild(h.dom),t.children&&t.children.length>0&&((l=g.contentDOM)==null||l.appendChild(xse(e,t.children,n,r))),g.dom}function vse(e,t,n,r){const i=(r?.document??document).createDocumentFragment();for(const o of t){const s=zWe(e,o,n,r);i.appendChild(s)}return i}const xse=(e,t,n,r)=>{var i;const o=e.pmSchema.nodes.blockGroup,s=o.spec.toDOM(o.create({})),a=vse(e,t,n,r);return(i=s.contentDOM)==null||i.appendChild(a),s.dom},VWe=(e,t)=>{const n=ts.fromSchema(e);return{serializeBlocks:(r,i)=>xse(t,r,n,i).outerHTML}};function GWe(e){return e.transact(t=>{const n=Iu(t.doc,t.selection.anchor);if(t.selection instanceof Cn)return{type:"cell",anchorBlockId:n.node.attrs.id,anchorCellOffset:t.selection.$anchorCell.pos-n.posBeforeNode,headCellOffset:t.selection.$headCell.pos-n.posBeforeNode};if(t.selection instanceof Ze)return{type:"node",anchorBlockId:n.node.attrs.id};{const r=Iu(t.doc,t.selection.head);return{type:"text",anchorBlockId:n.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:t.selection.anchor-n.posBeforeNode,headOffset:t.selection.head-r.posBeforeNode}}})}function qWe(e,t){var n,r;const i=(n=no(t.anchorBlockId,e.doc))==null?void 0:n.posBeforeNode;if(i===void 0)throw new Error(`Could not find block with ID ${t.anchorBlockId} to update selection`);let o;if(t.type==="cell")o=Cn.create(e.doc,i+t.anchorCellOffset,i+t.headCellOffset);else if(t.type==="node")o=Ze.create(e.doc,i+1);else{const s=(r=no(t.headBlockId,e.doc))==null?void 0:r.posBeforeNode;if(s===void 0)throw new Error(`Could not find block with ID ${t.headBlockId} to update selection`);o=We.create(e.doc,i+t.anchorOffset,s+t.headOffset)}e.setSelection(o)}function rI(e){return e.map(t=>t.type==="columnList"?t.children.map(n=>rI(n.children)).flat():{...t,children:rI(t.children)}).flat()}function Ese(e,t,n){e.transact(r=>{var i;const o=((i=e.getSelection())==null?void 0:i.blocks)||[e.getTextCursorPosition().block],s=GWe(e);e.removeBlocks(o),e.insertBlocks(rI(o),t,n),qWe(r,s)})}function Sse(e){return!e||e.type!=="columnList"}function wse(e,t,n){let r,i;if(t?t.children.length>0?(r=t.children[t.children.length-1],i="after"):(r=t,i="before"):n&&(r=n,i="before"),!r||!i)return;const o=e.getParentBlock(r);return Sse(o)?{referenceBlock:r,placement:i}:wse(e,i==="after"?r:e.getPrevBlock(r),o)}function Cse(e,t,n){let r,i;if(t?t.children.length>0?(r=t.children[0],i="before"):(r=t,i="after"):n&&(r=n,i="after"),!r||!i)return;const o=e.getParentBlock(r);return Sse(o)?{referenceBlock:r,placement:i}:Cse(e,i==="before"?r:e.getNextBlock(r),o)}function WWe(e){e.transact(()=>{const t=e.getSelection(),n=t?.blocks[0]||e.getTextCursorPosition().block,r=wse(e,e.getPrevBlock(n),e.getParentBlock(n));r&&Ese(e,r.referenceBlock,r.placement)})}function YWe(e){e.transact(()=>{const t=e.getSelection(),n=t?.blocks[t?.blocks.length-1]||e.getTextCursorPosition().block,r=Cse(e,e.getNextBlock(n),e.getParentBlock(n));r&&Ese(e,r.referenceBlock,r.placement)})}function KWe(e,t,n){const{$from:r,$to:i}=e.selection,o=r.blockRange(i,g=>g.childCount>0&&(g.type.name==="blockGroup"||g.type.name==="column"));if(!o)return!1;const s=o.startIndex;if(s===0)return!1;const a=o.parent.child(s-1);if(a.type!==t)return!1;const l=a.lastChild&&a.lastChild.type===n,c=we.from(l?t.create():null),u=new Pe(we.from(t.create(null,we.from(n.create(null,c)))),l?3:1,0),f=o.start,h=o.end;return e.step(new Er(f-(l?3:1),h,f,h,u,1,!0)).scrollIntoView(),!0}function Tse(e){return e.transact(t=>KWe(t,e.pmSchema.nodes.blockContainer,e.pmSchema.nodes.blockGroup))}function XWe(e){e._tiptapEditor.commands.liftListItem("blockContainer")}function ZWe(e){return e.transact(t=>{const{bnBlock:n}=Oy(t);return t.doc.resolve(n.beforePos).nodeBefore!==null})}function QWe(e){return e.transact(t=>{const{bnBlock:n}=Oy(t);return t.doc.resolve(n.beforePos).depth>1})}function JWe(e,t){const n=typeof t=="string"?t:t.id,r=Cr(e),i=no(n,e);if(i)return lr(i.node,r)}function eYe(e,t){const n=typeof t=="string"?t:t.id,r=no(n,e),i=Cr(e);if(!r)return;const o=e.resolve(r.posBeforeNode).nodeBefore;if(o)return lr(o,i)}function tYe(e,t){const n=typeof t=="string"?t:t.id,r=no(n,e),i=Cr(e);if(!r)return;const o=e.resolve(r.posBeforeNode+r.node.nodeSize).nodeAfter;if(o)return lr(o,i)}function nYe(e,t){const n=typeof t=="string"?t:t.id,r=Cr(e),i=no(n,e);if(!i)return;const o=e.resolve(i.posBeforeNode),s=o.node(),a=o.node(-1),l=a.type.name!=="doc"?s.type.name==="blockGroup"?a:s:void 0;if(l)return lr(l,r)}let rYe=class{constructor(t){this.editor=t}get document(){return this.editor.transact(t=>q9e(t.doc,this.editor.pmSchema))}getBlock(t){return this.editor.transact(n=>JWe(n.doc,t))}getPrevBlock(t){return this.editor.transact(n=>eYe(n.doc,t))}getNextBlock(t){return this.editor.transact(n=>tYe(n.doc,t))}getParentBlock(t){return this.editor.transact(n=>nYe(n.doc,t))}forEachBlock(t,n=!1){const r=this.document.slice();n&&r.reverse();function i(o){for(const s of o){if(t(s)===!1)return!1;const a=n?s.children.slice().reverse():s.children;if(!i(a))return!1}return!0}i(r)}insertBlocks(t,n,r="before"){return this.editor.transact(i=>$We(i,t,n,r))}updateBlock(t,n){return this.editor.transact(r=>$Ue(r,t,n))}removeBlocks(t){return this.editor.transact(n=>Cq(n,t,[]).removedBlocks)}replaceBlocks(t,n){return this.editor.transact(r=>Cq(r,t,n))}canNestBlock(){return ZWe(this.editor)}nestBlock(){Tse(this.editor)}canUnnestBlock(){return QWe(this.editor)}unnestBlock(){XWe(this.editor)}moveBlocksUp(){return WWe(this.editor)}moveBlocksDown(){return YWe(this.editor)}},iYe=class extends aP{constructor(t){super(),this.editor=t,t.on("create",()=>{t._tiptapEditor.on("update",({transaction:n,appendedTransactions:r})=>{this.emit("onChange",{editor:t,transaction:n,appendedTransactions:r})}),t._tiptapEditor.on("selectionUpdate",({transaction:n})=>{this.emit("onSelectionChange",{editor:t,transaction:n})}),t._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:t})}),t._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:t})})})}onChange(t,n=!0){const r=({transaction:i,appendedTransactions:o})=>{!n&&Tq(i)||t(this.editor,{getChanges(){return Ooe(i,o)}})};return this.on("onChange",r),()=>{this.off("onChange",r)}}onSelectionChange(t,n=!1){const r=i=>{!n&&Tq(i.transaction)||t(this.editor)};return this.on("onSelectionChange",r),()=>{this.off("onSelectionChange",r)}}onMount(t){return this.on("onMount",t),()=>{this.off("onMount",t)}}onUnmount(t){return this.on("onUnmount",t),()=>{this.off("onUnmount",t)}}};function Tq(e){return!!e.getMeta("y-sync$")}function oYe(e){return Array.prototype.indexOf.call(e.parentElement.childNodes,e)}function sYe(e){return e.nodeType===3&&!/\S/.test(e.nodeValue||"")}function aYe(e){e.querySelectorAll("li > ul, li > ol").forEach(t=>{const n=oYe(t),r=t.parentElement,i=Array.from(r.childNodes).slice(n+1);t.remove(),i.forEach(o=>{o.remove()}),r.insertAdjacentElement("afterend",t),i.reverse().forEach(o=>{if(sYe(o))return;const s=document.createElement("li");s.append(o),t.insertAdjacentElement("afterend",s)}),r.childNodes.length===0&&r.remove()})}function lYe(e){e.querySelectorAll("li + ul, li + ol").forEach(t=>{var n,r;const i=t.previousElementSibling,o=document.createElement("div");i.insertAdjacentElement("afterend",o),o.append(i);const s=document.createElement("div");for(s.setAttribute("data-node-type","blockGroup"),o.append(s);((n=o.nextElementSibling)==null?void 0:n.nodeName)==="UL"||((r=o.nextElementSibling)==null?void 0:r.nodeName)==="OL";)s.append(o.nextElementSibling)})}let kq=null;function cYe(){return kq||(kq=document.implementation.createHTMLDocument("title"))}function uYe(e){if(typeof e=="string"){const t=cYe().createElement("div");t.innerHTML=e,e=t}return aYe(e),lYe(e),e}function kse(e,t){const n=uYe(e),r=fa.fromSchema(t).parse(n,{topNode:t.nodes.blockGroup.create()}),i=[];for(let o=0;o<r.childCount;o++)i.push(lr(r.child(o),t));return i}function dYe(e,t){const n=t.value?t.value:"",r={};t.lang&&(r["data-language"]=t.lang);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function fYe(e,t){var n;const r=String(t?.url||""),i=t!=null&&t.title?String(t.title):void 0;let o={type:"element",tagName:"video",properties:{src:r,"data-name":i,"data-url":r,controls:!0},children:[]};return(n=e.patch)==null||n.call(e,t,o),o=e.applyData?e.applyData(t,o):o,o}function Ase(e){return mC().use(XJ).use(gC).use(JJ,{handlers:{...jR,image:(t,n)=>{const r=String(n?.url||"");return AUe(r)?fYe(t,n):jR.image(t,n)},code:dYe,blockquote:(t,n)=>{const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(n),!1)};return t.patch(n,r),t.applyData(n,r)}}}).use(Uee).processSync(e).value}function pYe(e,t){const n=Ase(e);return kse(n,t)}let hYe=class{constructor(t){this.editor=t}blocksToHTMLLossy(t=this.editor.document){return tT(this.editor.pmSchema,this.editor).exportBlocks(t,{})}blocksToFullHTML(t=this.editor.document){return VWe(this.editor.pmSchema,this.editor).serializeBlocks(t,{})}tryParseHTMLToBlocks(t){return kse(t,this.editor.pmSchema)}blocksToMarkdownLossy(t=this.editor.document){return QVe(t,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(t){return pYe(t,this.editor.pmSchema)}pasteHTML(t,n=!1){var r;let i=t;if(!n){const o=this.tryParseHTMLToBlocks(t);i=this.blocksToFullHTML(o)}i&&((r=this.editor.prosemirrorView)==null||r.pasteHTML(i))}pasteText(t){var n;return(n=this.editor.prosemirrorView)==null?void 0:n.pasteText(t)}pasteMarkdown(t){const n=Ase(t);return this.pasteHTML(n)}};const qP=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function mYe(e,t){if(!e.startsWith(".")||!t.startsWith("."))throw new Error("The strings provided are not valid file extensions.");return e===t}function gYe(e,t){const n=e.split("/"),r=t.split("/");if(n.length!==2)throw new Error(`The string ${e} is not a valid MIME type.`);if(r.length!==2)throw new Error(`The string ${t} is not a valid MIME type.`);return n[1]==="*"||r[1]==="*"?n[0]===r[0]:(n[0]==="*"||r[0]==="*"||n[0]===r[0])&&n[1]===r[1]}function Aq(e,t,n,r="after"){let i;return Array.isArray(t.content)&&t.content.length===0?i=e.updateBlock(t,n).id:i=e.insertBlocks([n],t,r)[0].id,i}async function Nse(e,t){var n;if(!t.uploadFile){console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");return}const r="dataTransfer"in e?e.dataTransfer:e.clipboardData;if(r===null)return;let i=null;for(const s of qP)if(r.types.includes(s)){i=s;break}if(i!=="Files")return;const o=r.items;if(o){e.preventDefault();for(let s=0;s<o.length;s++){let a="file";for(const c of Object.values(t.schema.blockSpecs))for(const u of((n=c.implementation.meta)==null?void 0:n.fileBlockAccept)||[]){const f=u.startsWith("."),h=o[s].getAsFile();if(h&&(!f&&h.type&&gYe(o[s].type,u)||f&&mYe("."+h.name.split(".").pop(),u))){a=c.config.type;break}}const l=o[s].getAsFile();if(l){const c={type:a,props:{name:l.name}};let u;if(e.type==="paste"){const g=t.getTextCursorPosition().block;u=Aq(t,g,c)}else if(e.type==="drop"){const g={left:e.clientX,top:e.clientY},y=t.prosemirrorView.posAtCoords(g);if(!y)return;u=t.transact(E=>{var S;const w=Iu(E.doc,y.pos),T=(S=t.domElement)==null?void 0:S.querySelector(`[data-id="${w.node.attrs.id}"]`),A=T?.getBoundingClientRect();return Aq(t,t.getBlock(w.node.attrs.id),c,A&&(A.top+A.bottom)/2>g.top?"before":"after")})}else return;const f=await t.uploadFile(l,u),h=typeof f=="string"?{props:{url:f}}:{...f};t.updateBlock(u,h)}}}}const bYe=e=>En.create({name:"dropFile",addProseMirrorPlugins(){return[new vt({props:{handleDOMEvents:{drop(t,n){if(!e.isEditable)return;let r=null;for(const i of qP)if(n.dataTransfer.types.includes(i)){r=i;break}return r===null?!0:r==="Files"?(Nse(n,e),!0):!1}}}})]}}),yYe=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,vYe=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,xYe=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,EYe=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,SYe=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,wYe=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,CYe=/\n{2} {0,3}-{2,48}\n{2}/,TYe=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,kYe=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,AYe=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,NYe=/^\s*\|(.+\|)+\s*$/m,_Ye=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,RYe=/^\s*\|(.+\|)+\s*$/m,DYe=e=>yYe.test(e)||vYe.test(e)||xYe.test(e)||EYe.test(e)||SYe.test(e)||wYe.test(e)||CYe.test(e)||TYe.test(e)||kYe.test(e)||AYe.test(e)||NYe.test(e)||_Ye.test(e)||RYe.test(e);async function IYe(e,t){const{schema:n}=t.state;if(!e.clipboardData)return!1;const r=e.clipboardData.getData("text/plain");if(!r)return!1;if(!n.nodes.codeBlock)return t.pasteText(r),!0;const i=e.clipboardData.getData("vscode-editor-data"),o=i?JSON.parse(i):void 0,s=o?.mode;return s?(t.pasteHTML(`<pre><code class="language-${s}">${r.replace(/\r\n?/g,`
290
290
  `)}</code></pre>`),!0):!1}function OYe({event:e,editor:t,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){var i;if(t.transact(a=>a.selection.$from.parent.type.spec.code&&a.selection.$to.parent.type.spec.code)){const a=(i=e.clipboardData)==null?void 0:i.getData("text/plain");if(a)return t.pasteText(a),!0}let o;for(const a of qP)if(e.clipboardData.types.includes(a)){o=a;break}if(!o)return!0;if(o==="vscode-editor-data")return IYe(e,t.prosemirrorView),!0;if(o==="Files")return Nse(e,t),!0;const s=e.clipboardData.getData(o);if(o==="blocknote/html")return t.pasteHTML(s,!0),!0;if(o==="text/markdown")return t.pasteMarkdown(s),!0;if(n){const a=e.clipboardData.getData("text/plain");if(DYe(a))return t.pasteMarkdown(a),!0}return o==="text/html"?(t.pasteHTML(s),!0):r?(t.pasteMarkdown(s),!0):(t.pasteText(s),!0)}const MYe=(e,t)=>En.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new vt({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),!!e.isEditable)return t({event:r,editor:e,defaultPasteHandler:({prioritizeMarkdownOverHTML:i=!0,plainTextAsMarkdown:o=!0}={})=>OYe({event:r,editor:e,prioritizeMarkdownOverHTML:i,plainTextAsMarkdown:o})})}}}})]}});function LYe(e,t,n){var r;let i=!1;const o=e.state.selection instanceof Cn;if(!o){const l=e.state.doc.slice(e.state.selection.from,e.state.selection.to,!1).content,c=[];for(let u=0;u<l.childCount;u++)c.push(l.child(u));i=c.find(u=>u.type.isInGroup("bnBlock")||u.type.name==="blockGroup"||u.type.spec.group==="blockContent")===void 0,i&&(t=l)}let s;const a=tT(e.state.schema,n);if(o){((r=t.firstChild)==null?void 0:r.type.name)==="table"&&(t=t.firstChild.content);const l=Rie(t,n.schema.inlineContentSchema,n.schema.styleSchema);s=`<table>${a.exportInlineContent(l,{})}</table>`}else if(i){const l=YC(t,n.schema.inlineContentSchema,n.schema.styleSchema);s=a.exportInlineContent(l,{})}else{const l=joe(t);s=a.exportBlocks(l,{})}return s}function _se(e,t){"node"in e.state.selection&&e.state.selection.node.type.spec.group==="blockContent"&&t.transact(s=>s.setSelection(new Ze(s.doc.resolve(e.state.selection.from-1))));const n=e.serializeForClipboard(e.state.selection.content()).dom.innerHTML,r=e.state.selection.content().content,i=LYe(e,r,t),o=NP(i);return{clipboardHTML:n,externalHTML:i,markdown:o}}const Nq=()=>{const e=window.getSelection();if(!e||e.isCollapsed)return!0;let t=e.focusNode;for(;t;){if(t instanceof HTMLElement&&t.getAttribute("contenteditable")==="false")return!0;t=t.parentElement}return!1},_q=(e,t,n)=>{n.preventDefault(),n.clipboardData.clearData();const{clipboardHTML:r,externalHTML:i,markdown:o}=_se(t,e);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",i),n.clipboardData.setData("text/plain",o)},PYe=e=>En.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new vt({props:{handleDOMEvents:{copy(t,n){return Nq()||_q(e,t,n),!0},cut(t,n){return Nq()||(_q(e,t,n),t.editable&&t.dispatch(t.state.tr.deleteSelection())),!0},dragstart(t,n){if(!("node"in t.state.selection)||t.state.selection.node.type.spec.group!=="blockContent")return;e.transact(s=>s.setSelection(new Ze(s.doc.resolve(t.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();const{clipboardHTML:r,externalHTML:i,markdown:o}=_se(t,e);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",i),n.dataTransfer.setData("text/plain",o),!0}}}})]}}),FYe=En.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:zUe()}}]}}),BYe=Xs.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",ns(this.options.HTMLAttributes,e)]},renderText(){return`
291
291
  `}}),iI=(e,t)=>{const n=e.resolve(t),r=n.index();if(r===0)return;const i=n.posAtIndex(r-1);return WC(e.resolve(i))},Rse=(e,t)=>{for(;t.childContainer;){const n=t.childContainer.node,r=e.resolve(t.childContainer.beforePos+1).posAtIndex(n.childCount-1);t=WC(e.resolve(r))}return t},jYe=(e,t)=>e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*"&&e.blockContent.node.childCount>0&&t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*",$Ye=(e,t,n,r)=>{if(!r.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){const i=e.doc.resolve(r.childContainer.beforePos+1),o=e.doc.resolve(r.childContainer.afterPos-1),s=i.blockRange(o);if(t){const a=e.doc.resolve(r.bnBlock.beforePos);e.tr.lift(s,a.depth)}}if(t){if(!n.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);t(e.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},Rq=e=>({state:t,dispatch:n})=>{const r=t.doc.resolve(e),i=WC(r),o=iI(t.doc,i.bnBlock.beforePos);if(!o)return!1;const s=Rse(t.doc,o);return jYe(s,i)?$Ye(t,n,s,i):!1},UYe=En.create({priority:50,addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({chain:r,commands:i})=>[()=>i.deleteSelection(),()=>i.undoInputRule(),()=>i.command(({state:o})=>{const s=bo(o);if(!s.isBlockContainer)return!1;const a=o.selection.from===s.blockContent.beforePos+1,l=s.blockContent.node.type.name==="paragraph";return a&&!l?i.command(BUe(s.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>i.command(({state:o})=>{const s=bo(o);if(!s.isBlockContainer)return!1;const{blockContent:a}=s;return o.selection.from===a.beforePos+1?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:o})=>{const s=bo(o);if(!s.isBlockContainer)return!1;const{bnBlock:a,blockContent:l}=s,c=o.selection.from===l.beforePos+1,u=o.selection.empty,f=a.beforePos;return c&&u?r().command(Rq(f)).scrollIntoView().run():!1}),()=>i.command(({state:o,tr:s,dispatch:a})=>{const l=bo(o);if(!l.isBlockContainer||s.selection.from!==l.blockContent.beforePos+1)return!1;const c=s.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;const u=s.doc.resolve(l.bnBlock.beforePos),f=s.doc.resolve(u.before()),h=f.before();if(a){const g=s.doc.slice(l.bnBlock.beforePos,l.bnBlock.afterPos).content;s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),f.index()===0?(nI(s,h),s.insert(h,g),s.setSelection(We.near(s.doc.resolve(h)))):(s.insert(f.pos-1,g),s.setSelection(We.near(s.doc.resolve(f.pos-1))),nI(s,h))}return!0}),()=>i.command(({state:o})=>{const s=bo(o);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){const a=iI(o.doc,s.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){const c=s.bnBlock.beforePos-1-1-1-1-1;l=l.setTextSelection(c)}else if(a.blockContent.node.type.spec.content===""){const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setNodeSelection(c)}else{const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setTextSelection(c)}return l.deleteRange({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>i.command(({state:o})=>{const s=bo(o);if(!s.isBlockContainer)throw new Error("todo");const a=o.selection.from===s.blockContent.beforePos+1,l=o.selection.empty,c=iI(o.doc,s.bnBlock.beforePos);if(c&&a&&l){const u=Rse(o.doc,c);if(!u.isBlockContainer)throw new Error("todo");if(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)return r().cut({from:s.bnBlock.beforePos,to:s.bnBlock.afterPos},u.bnBlock.afterPos).deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).run()}return!1})]),t=()=>this.editor.commands.first(({commands:r})=>[()=>r.deleteSelection(),()=>r.command(({state:i})=>{const o=bo(i);if(!o.isBlockContainer)return!1;const{bnBlock:s,blockContent:a,childContainer:l}=o,{depth:c}=i.doc.resolve(s.beforePos),u=s.afterPos===i.doc.nodeSize-3,f=i.selection.from===a.afterPos-1,h=i.selection.empty;if(!u&&f&&h&&l===void 0){let g=c,y=s.afterPos+1,E=i.doc.resolve(y).depth;for(;E<g;)g=E,y+=2,E=i.doc.resolve(y).depth;return r.command(Rq(y-1))}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:i,tr:o})=>[()=>i.command(({state:s})=>{const a=bo(s);if(!a.isBlockContainer)return!1;const{bnBlock:l,blockContent:c}=a,{depth:u}=s.doc.resolve(l.beforePos),f=s.selection.$anchor.parentOffset===0,h=s.selection.anchor===s.selection.head,g=c.node.childCount===0,y=u>1;return f&&h&&g&&y?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:s})=>{var a;const l=bo(s),c=((a=this.options.editor.schema.blockSchema[l.blockNoteType].meta)==null?void 0:a.hardBreakShortcut)??"shift+enter";if(c==="none")return!1;if(c==="shift+enter"&&r||c==="enter"){const u=o.storedMarks||o.selection.$head.marks().filter(f=>this.editor.extensionManager.splittableMarks.includes(f.type.name));return o.insert(o.selection.head,o.doc.type.schema.nodes.hardBreak.create()).ensureMarks(u),!0}return!1}),()=>i.command(({state:s,dispatch:a})=>{const l=bo(s);if(!l.isBlockContainer)return!1;const{bnBlock:c,blockContent:u}=l,f=s.selection.$anchor.parentOffset===0,h=s.selection.anchor===s.selection.head,g=u.node.childCount===0;if(f&&h&&g){const y=c.afterPos,E=y+2;if(a){const S=s.schema.nodes.blockContainer.createAndFill();s.tr.insert(y,S).scrollIntoView(),s.tr.setSelection(new We(s.doc.resolve(E)))}return!0}return!1}),()=>i.command(({state:s,chain:a})=>{const l=bo(s);if(!l.isBlockContainer)return!1;const{blockContent:c}=l,u=s.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(yHe(s.selection.from,u,u)).run(),!0)})]);return{Backspace:e,Delete:t,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Mu))!=null&&r.store.state||((i=this.options.editor.getExtension(ca))==null?void 0:i.store.state)!==void 0)?!1:Tse(this.options.editor)},"Shift-Tab":()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Mu))!=null&&r.store.state||((i=this.options.editor.getExtension(ca))==null?void 0:i.store.state)!==void 0)?!1:this.editor.commands.liftListItem("blockContainer")},"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),HYe=Ks.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(e){return e.name!=="insertion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return["ins",{"data-id":String(t.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10)}:!1}}]}}}),zYe=Ks.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(e){return e.name!=="deletion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return["del",{"data-id":String(t.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10)}:!1}}]}}}),VYe=Ks.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(e){return e.name!=="modification"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(t,n){return[n?"span":"div",{"data-type":"modification","data-id":String(t.attrs.id),"data-mod-type":t.attrs.type,"data-mod-prev-val":JSON.stringify(t.attrs.previousValue),"data-mod-new-val":JSON.stringify(t.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10),type:t.dataset.modType,previousValue:t.dataset.modPrevVal,newValue:t.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(t){return t.dataset.id?{id:parseInt(t.dataset.id,10),type:t.dataset.modType,previousValue:t.dataset.modPrevVal}:!1}}]}}}),GYe=En.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:e=>e.getAttribute("data-text-alignment"),renderHTML:e=>e.textAlignment==="left"?{}:{"data-text-alignment":e.textAlignment}}}}]}}),qYe=En.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:VUe()}}]}}),WYe={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},YYe=Xs.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:e=>{if(typeof e=="string")return!1;const t={};for(const[n,r]of Object.entries(WYe))e.getAttribute(r)&&(t[n]=e.getAttribute(r));return t}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:e}){var t;const n=document.createElement("div");n.className="bn-block-outer",n.setAttribute("data-node-type","blockOuter");for(const[o,s]of Object.entries(e))o!=="class"&&n.setAttribute(o,s);const r={...((t=this.options.domAttributes)==null?void 0:t.block)||{},...e},i=document.createElement("div");i.className=Fr("bn-block",r.class),i.setAttribute("data-node-type",this.name);for(const[o,s]of Object.entries(r))o!=="class"&&i.setAttribute(o,s);return n.appendChild(i),{dom:n,contentDOM:i}}}),KYe=Xs.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:e=>typeof e=="string"?!1:e.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:e}){var t;const n={...((t=this.options.domAttributes)==null?void 0:t.blockGroup)||{},...e},r=document.createElement("div");r.className=Fr("bn-block-group",n.class),r.setAttribute("data-node-type","blockGroup");for(const[i,o]of Object.entries(n))i!=="class"&&r.setAttribute(i,o);return{dom:r,contentDOM:r}}}),XYe=Xs.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),ZYe=on(({options:e})=>({key:"collaboration",blockNoteExtensions:[FVe(e),$D(e),Yx(e),Kx(),$Ve(e)]}));let Dq=!1;function QYe(e,t){const n=[Pp.ClipboardTextSerializer,Pp.Commands,Pp.Editable,Pp.FocusEvents,Pp.Tabindex,uWe,qC.configure({types:["blockContainer","columnList","column"],setIdAttribute:t.setIdAttribute}),BYe,PWe,HYe,zYe,VYe,LWe.extend({inclusive:!1}).configure({defaultProtocol:Foe,protocols:Dq?[]:Poe}),...Object.values(e.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:e})),qYe,FYe,GYe,En.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>{var r;return(r=e.getExtension(js))!=null&&r.shown()?!1:(e.blur(),!0)}})}),XYe,YYe.configure({editor:e,domAttributes:t.domAttributes}),UYe.configure({editor:e,tabBehavior:t.tabBehavior}),KYe.configure({domAttributes:t.domAttributes}),...Object.values(e.schema.inlineContentSpecs).filter(r=>r.config!=="link"&&r.config!=="text").map(r=>r.implementation.node.configure({editor:e})),...Object.values(e.schema.blockSpecs).flatMap(r=>[..."node"in r.implementation?[r.implementation.node.configure({editor:e,domAttributes:t.domAttributes})]:[]]),PYe(e),MYe(e,t.pasteHandler||(r=>r.defaultPasteHandler())),bYe(e)];return Dq=!0,n}function JYe(e,t){const n=[Moe(),UVe(t),ca(t),Mu(t),Py(t),VVe(),qVe(t),fS(t),va(t),js(t),...t.trailingBlock!==!1?[lGe()]:[]];return t.collaboration?n.push(ZYe(t.collaboration)):n.push(HVe()),"table"in e.schema.blockSpecs&&n.push(zn(t)),t.animations!==!1&&n.push(YVe()),n}class eKe{constructor(t,n){nn(this,"disabledExtensions",new Set),nn(this,"extensions",[]),nn(this,"abortMap",new Map),nn(this,"extensionFactories",new Map),nn(this,"extensionPlugins",new Map),this.editor=t,this.options=n,t.onMount(()=>{for(const r of this.extensions)if(r.mount){const i=new window.AbortController,o=r.mount({dom:t.prosemirrorView.dom,root:t.prosemirrorView.root,signal:i.signal});o&&i.signal.addEventListener("abort",()=>{o()}),this.abortMap.set(r,i)}}),t.onUnmount(()=>{for(const[r,i]of this.abortMap.entries())this.abortMap.delete(r),i.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(const r of JYe(this.editor,this.options))this.addExtension(r);for(const r of this.options.extensions??[])this.addExtension(r);for(const r of Object.values(this.editor.schema.blockSpecs))for(const i of r.extensions??[])this.addExtension(i)}registerExtension(t){var n;const r=[].concat(t).filter(Boolean);if(!r.length){console.warn("No extensions found to register",t);return}const i=r.map(s=>this.addExtension(s)).filter(Boolean),o=new Set;for(const s of i)s!=null&&s.tiptapExtensions&&console.warn(`Extension ${s.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,s),(n=s?.inputRules)!=null&&n.length&&console.warn(`Extension ${s.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,s),this.getProsemirrorPluginsFromExtension(s).plugins.forEach(a=>{o.add(a)});this.updatePlugins(s=>[...s,...o])}addExtension(t){let n;if(typeof t=="function"?n=t({editor:this.editor}):n=t,!(!n||this.disabledExtensions.has(n.key))){if(typeof t=="function"){const r=n[kD];typeof r=="function"&&this.extensionFactories.set(r,n)}if(this.extensions.push(n),n.blockNoteExtensions)for(const r of n.blockNoteExtensions)this.addExtension(r);return n}}resolveExtensions(t){const n=[];if(typeof t=="function"){const r=this.extensionFactories.get(t);r&&n.push(r)}else if(Array.isArray(t))for(const r of t)n.push(...this.resolveExtensions(r));else if(typeof t=="object"&&"key"in t)n.push(t);else if(typeof t=="string"){const r=this.extensions.find(i=>i.key===t);r&&n.push(r)}return n}unregisterExtension(t){var n;const r=this.resolveExtensions(t);if(!r.length){console.warn("No extensions found to unregister",t);return}let i=!1;const o=new Set;for(const s of r){this.extensions=this.extensions.filter(l=>l!==s),this.extensionFactories.forEach((l,c)=>{l===s&&this.extensionFactories.delete(c)}),(n=this.abortMap.get(s))==null||n.abort(),this.abortMap.delete(s);const a=this.extensionPlugins.get(s);a?.forEach(l=>{o.add(l)}),this.extensionPlugins.delete(s),s.tiptapExtensions&&!i&&(i=!0,console.warn(`Extension ${s.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,t))}this.updatePlugins(s=>s.filter(a=>!o.has(a)))}updatePlugins(t){const n=this.editor.prosemirrorState,r=n.reconfigure({plugins:t(n.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){var t;const n=QYe(this.editor,this.options).filter(o=>!this.disabledExtensions.has(o.name)),r=ase(this.extensions),i=new Map;for(const o of this.extensions){o.tiptapExtensions&&n.push(...o.tiptapExtensions);const s=r(o.key),{plugins:a,inputRules:l}=this.getProsemirrorPluginsFromExtension(o);a.length&&n.push(En.create({name:o.key,priority:s,addProseMirrorPlugins:()=>a})),l.length&&(i.has(s)||i.set(s,[]),i.get(s).push(...l))}n.push(En.create({name:"blocknote-input-rules",addProseMirrorPlugins(){const o=[];return Array.from(i.keys()).sort().reverse().forEach(s=>{o.push(...i.get(s))}),[nWe({rules:o})]}}));for(const o of((t=this.options._tiptapOptions)==null?void 0:t.extensions)??[])n.push(o);return n}getProsemirrorPluginsFromExtension(t){var n,r,i;const o=[...t.prosemirrorPlugins??[]],s=[];return!((n=t.prosemirrorPlugins)!=null&&n.length)&&!Object.keys(t.keyboardShortcuts||{}).length&&!((r=t.inputRules)!=null&&r.length)?{plugins:o,inputRules:s}:(this.extensionPlugins.set(t,o),(i=t.inputRules)!=null&&i.length&&s.push(...t.inputRules.map(a=>new Mf(a.find,(l,c,u,f)=>{const h=a.replace({match:c,range:{from:u,to:f},editor:this.editor});if(h){const g=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[g.block.type].content!=="inline")return null;const y=Oy(l.tr),E=l.tr.deleteRange(u,f);return XC(E,y.bnBlock.beforePos,h),E}return null}))),Object.keys(t.keyboardShortcuts||{}).length&&o.push(qre(Object.fromEntries(Object.entries(t.keyboardShortcuts).map(([a,l])=>[a,()=>l({editor:this.editor})])))),{plugins:o,inputRules:s})}getExtensions(){return new Map(this.extensions.map(t=>[t.key,t]))}getExtension(t){if(typeof t=="string")return this.extensions.find(r=>r.key===t)||void 0;if(typeof t=="function")return this.extensionFactories.get(t)||void 0;throw new Error(`Invalid extension type: ${typeof t}`)}hasExtension(t){return typeof t=="string"?this.extensions.some(n=>n.key===t):typeof t=="object"&&"key"in t?this.extensions.some(n=>n.key===t.key):typeof t=="function"?this.extensionFactories.has(t):!1}}function tKe(e,t){let{$from:n,$to:r}=t;if(n.pos>n.start()&&n.pos<e.content.size){const i=e.textBetween(n.pos,n.pos+1);if(/^[\w\p{P}]$/u.test(i)){const o=e.textBetween(n.start(),n.pos).match(/[\w\p{P}]+$/u);o&&(n=e.resolve(n.pos-o[0].length))}}if(r.pos<r.end()&&r.pos>0){const i=e.textBetween(r.pos-1,r.pos);if(/^[\w\p{P}]$/u.test(i)){const o=e.textBetween(r.pos,r.end()).match(/^[\w\p{P}]+/u);o&&(r=e.resolve(r.pos+o[0].length))}}return{$from:n,$to:r,from:n.pos,to:r.pos}}function nKe(e){const t=Cr(e);if(e.selection.empty||"node"in e.selection)return;const n=e.doc.resolve(Iu(e.doc,e.selection.from).posBeforeNode),r=e.doc.resolve(Iu(e.doc,e.selection.to).posBeforeNode),i=(c,u)=>{const f=n.posAtIndex(c,u),h=e.doc.resolve(f).nodeAfter;if(!h)throw new Error(`Error getting selection - node not found at position ${f}`);return lr(h,t)},o=[],s=n.sharedDepth(r.pos),a=n.index(s),l=r.index(s);if(n.depth>s){o.push(lr(n.nodeAfter,t));for(let c=n.depth;c>s;c--)if(n.node(c).type.isInGroup("childContainer")){const u=n.index(c)+1,f=n.node(c).childCount;for(let h=u;h<f;h++)o.push(i(h,c))}}else o.push(i(a,s));for(let c=a+1;c<=l;c++)o.push(i(c,s));if(o.length===0)throw new Error(`Error getting selection - selection doesn't span any blocks (${e.selection})`);return{blocks:o}}function rKe(e,t,n){const r=typeof t=="string"?t:t.id,i=typeof n=="string"?n:n.id,o=Cr(e),s=My(o);if(r===i)throw new Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);const a=no(r,e.doc);if(!a)throw new Error(`Block with ID ${r} not found`);const l=no(i,e.doc);if(!l)throw new Error(`Block with ID ${i} not found`);const c=Ou(a),u=Ou(l),f=s.blockSchema[c.blockNoteType],h=s.blockSchema[u.blockNoteType];if(!c.isBlockContainer||f.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!u.isBlockContainer||h.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${i})`);let g,y;if(f.content==="table"){const E=Un.get(c.blockContent.node);g=c.blockContent.beforePos+E.positionAt(0,0,c.blockContent.node)+1+2}else g=c.blockContent.beforePos+1;if(h.content==="table"){const E=Un.get(u.blockContent.node),S=u.blockContent.beforePos+E.positionAt(E.height-1,E.width-1,u.blockContent.node)+1,w=e.doc.resolve(S).nodeAfter.nodeSize;y=S+w-2}else y=u.blockContent.afterPos-1;e.setSelection(We.create(e.doc,g,y))}function iKe(e,t=!1){const n=Cr(e),r=t?tKe(e.doc,e.selection):e.selection;let i=r.$from,o=r.$to;for(;o.parentOffset>=o.parent.nodeSize-2&&o.depth>0;)o=e.doc.resolve(o.pos+1);for(;o.parentOffset===0&&o.depth>0;)o=e.doc.resolve(o.pos-1);for(;i.parentOffset===0&&i.depth>0;)i=e.doc.resolve(i.pos-1);for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=e.doc.resolve(i.pos+1);const s=W9e(e.doc.slice(i.pos,o.pos,!0),n);return{_meta:{startPos:i.pos,endPos:o.pos},...s}}function oKe(e){const{bnBlock:t}=Oy(e),n=Cr(e.doc),r=e.doc.resolve(t.beforePos),i=r.nodeBefore,o=e.doc.resolve(t.afterPos).nodeAfter;let s;return r.depth>1&&(s=r.node(),s.type.isInGroup("bnBlock")||(s=r.node(r.depth-1))),{block:lr(t.node,n),prevBlock:i===null?void 0:lr(i,n),nextBlock:o===null?void 0:lr(o,n),parentBlock:s===void 0?void 0:lr(s,n)}}function Dse(e,t,n="start"){const r=typeof t=="string"?t:t.id,i=Cr(e.doc),o=My(i),s=no(r,e.doc);if(!s)throw new Error(`Block with ID ${r} not found`);const a=Ou(s),l=o.blockSchema[a.blockNoteType].content;if(a.isBlockContainer){const c=a.blockContent;if(l==="none"){e.setSelection(Ze.create(e.doc,c.beforePos));return}if(l==="inline")n==="start"?e.setSelection(We.create(e.doc,c.beforePos+1)):e.setSelection(We.create(e.doc,c.afterPos-1));else if(l==="table")n==="start"?e.setSelection(We.create(e.doc,c.beforePos+4)):e.setSelection(We.create(e.doc,c.afterPos-4));else throw new il(l)}else{const c=n==="start"?a.childContainer.node.firstChild:a.childContainer.node.lastChild;Dse(e,c.attrs.id,n)}}class sKe{constructor(t){this.editor=t}getSelection(){return this.editor.transact(t=>nKe(t))}getSelectionCutBlocks(t=!1){return this.editor.transact(n=>iKe(n,t))}setSelection(t,n){return this.editor.transact(r=>rKe(r,t,n))}getTextCursorPosition(){return this.editor.transact(t=>oKe(t))}setTextCursorPosition(t,n="start"){return this.editor.transact(r=>Dse(r,t,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;const{selection:t}=this.editor.prosemirrorState,{ranges:n}=t,r=Math.min(...n.map(o=>o.$from.pos)),i=Math.max(...n.map(o=>o.$to.pos));if(cie(t)){const o=this.editor.prosemirrorView.nodeDOM(r);if(o)return o.getBoundingClientRect()}return rP(this.editor.prosemirrorView,r,i).toJSON()}}class aKe{constructor(t){nn(this,"activeTransaction",null),nn(this,"isInCan",!1),this.editor=t}can(t){try{return this.isInCan=!0,t()}finally{this.isInCan=!1}}exec(t){if(this.activeTransaction)throw new Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(t);const n=this.prosemirrorState,r=this.prosemirrorView;return t(n,i=>this.prosemirrorView.dispatch(i),r)}canExec(t){if(this.activeTransaction)throw new Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");const n=this.prosemirrorState,r=this.prosemirrorView;return t(n,void 0,r)}transact(t){if(this.activeTransaction)return t(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;const n=t(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),n}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw new Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){var t;return((t=this.prosemirrorView)==null?void 0:t.hasFocus())||!1}focus(){var t;(t=this.prosemirrorView)==null||t.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(t){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==t&&this.editor._tiptapEditor.setEditable(t)}undo(){const t=this.editor.getExtension("yUndo");if(t)return this.exec(t.undoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.undoCommand);throw new Error("No undo plugin found")}redo(){const t=this.editor.getExtension("yUndo");if(t)return this.exec(t.redoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.redoCommand);throw new Error("No redo plugin found")}}function lKe(e,t,n,r={updateSelection:!0}){let{from:i,to:o}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},s=!0,a=!0,l="";if(n.forEach(c=>{c.check(),s&&c.isText&&c.marks.length===0?l+=c.text:s=!1,a=a?c.isBlock:!1}),i===o&&a){const{parent:c}=e.doc.resolve(i);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(i-=1,o+=1)}return s?e.insertText(l,i,o):e.replaceWith(i,o,n),r.updateSelection&&Jre(e,e.steps.length-1,-1),!0}class cKe{constructor(t){this.editor=t}insertInlineContent(t,{updateSelection:n=!1}={}){const r=Vs(t,this.editor.pmSchema);this.editor.transact(i=>{lKe(i,{from:i.selection.from,to:i.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(t=>{const n={},r=t.selection.$to.marks();for(const i of r){const o=this.editor.schema.styleSchema[i.type.name];if(!o){i.type.name!=="link"&&!i.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",i.type.name);continue}o.propSchema==="boolean"?n[o.type]=!0:n[o.type]=i.attrs.stringValue}return n})}addStyles(t){for(const[n,r]of Object.entries(t)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new il(i.propSchema)}}removeStyles(t){for(const n of Object.keys(t))this.editor._tiptapEditor.commands.unsetMark(n)}toggleStyles(t){for(const[n,r]of Object.entries(t)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new il(i.propSchema)}}getSelectedText(){return this.editor.transact(t=>t.doc.textBetween(t.selection.from,t.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(t,n){if(t==="")return;const r=this.editor.pmSchema.mark("link",{href:t});this.editor.transact(i=>{const{from:o,to:s}=i.selection;n?i.insertText(n,o,s).addMark(o,o+n.length,r):i.setSelection(We.create(i.doc,s)).addMark(o,s,r)})}}function uKe(e,t){const n=[];return e.forEach((r,i,o)=>{o!==t&&n.push(r)}),we.from(n)}function dKe(e,t){const n=[];for(let r=0;r<e.childCount;r++)if(e.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){const i=n[n.length-1],o=i.copy(i.content.addToEnd(e.child(r)));n[n.length-1]=o}else{const i=t.nodes.table.createChecked(void 0,e.child(r));n.push(i)}else n.push(e.child(r));return e=we.from(n),e}function fKe(e,t){let n=we.from(e.content);if(n=dKe(n,t.state.schema),!pKe(n,t))return new Pe(n,e.openStart,e.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){const i=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){const s=n.child(r+1).child(0).child(0);(s.type.name==="bulletListItem"||s.type.name==="numberedListItem"||s.type.name==="checkListItem")&&(i.push(n.child(r+1)),n=uKe(n,r+1))}const o=t.state.schema.nodes.blockContainer.createChecked(void 0,i);n=n.replaceChild(r,o)}return new Pe(n,e.openStart,e.openEnd)}function pKe(e,t){var n,r;const i=e.childCount===1,o=((n=e.firstChild)==null?void 0:n.type.spec.content)==="inline*",s=((r=e.firstChild)==null?void 0:r.type.spec.content)==="tableRow+";if(i){if(o)return!1;if(s){const a=bo(t.state);if(a.isBlockContainer)return a.blockContent.node.type.spec.content!=="tableRow+"}}return!0}const hKe={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};let mKe=class Ise extends aP{constructor(t){var n,r,i,o,s,a,l,c,u,f;super(),nn(this,"pmSchema"),nn(this,"_tiptapEditor"),nn(this,"elementRenderer",null),nn(this,"blockCache",new WeakMap),nn(this,"dictionary"),nn(this,"schema"),nn(this,"blockImplementations"),nn(this,"inlineContentImplementations"),nn(this,"styleImplementations"),nn(this,"uploadFile"),nn(this,"onUploadStartCallbacks",[]),nn(this,"onUploadEndCallbacks",[]),nn(this,"resolveFileUrl"),nn(this,"settings"),nn(this,"_blockManager"),nn(this,"_eventManager"),nn(this,"_exportManager"),nn(this,"_extensionManager"),nn(this,"_selectionManager"),nn(this,"_stateManager"),nn(this,"_styleManager"),nn(this,"unregisterExtension",(...T)=>this._extensionManager.unregisterExtension(...T)),nn(this,"registerExtension",(...T)=>this._extensionManager.registerExtension(...T)),nn(this,"getExtension",(...T)=>this._extensionManager.getExtension(...T)),nn(this,"mount",T=>{this._tiptapEditor.mount({mount:T})}),nn(this,"unmount",()=>{this._tiptapEditor.unmount()}),this.options=t,this.dictionary=t.dictionary||Jqe,this.settings={tables:{splitCells:((n=t?.tables)==null?void 0:n.splitCells)??!1,cellBackgroundColor:((r=t?.tables)==null?void 0:r.cellBackgroundColor)??!1,cellTextColor:((i=t?.tables)==null?void 0:i.cellTextColor)??!1,headers:((o=t?.tables)==null?void 0:o.headers)??!1}};const h={defaultStyles:!0,schema:t.schema||LP.create(),...t,placeholders:{...this.dictionary.placeholders,...t.placeholders}};if(this.schema=h.schema,this.blockImplementations=h.schema.blockSpecs,this.inlineContentImplementations=h.schema.inlineContentSpecs,this.styleImplementations=h.schema.styleSpecs,h.uploadFile){const T=h.uploadFile;this.uploadFile=async(A,R)=>{this.onUploadStartCallbacks.forEach(_=>_.apply(this,[R]));try{return await T(A,R)}finally{this.onUploadEndCallbacks.forEach(_=>_.apply(this,[R]))}}}this.resolveFileUrl=h.resolveFileUrl,this._eventManager=new iYe(this),this._extensionManager=new eKe(this,h);const g=this._extensionManager.getTiptapExtensions(),y=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");y&&h.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const E={...hKe,...h._tiptapOptions,element:null,autofocus:h.autofocus??!1,extensions:g,editorProps:{...(s=h._tiptapOptions)==null?void 0:s.editorProps,attributes:{tabIndex:"0",...(l=(a=h._tiptapOptions)==null?void 0:a.editorProps)==null?void 0:l.attributes,...(c=h.domAttributes)==null?void 0:c.editor,class:Fr("bn-editor",h.defaultStyles?"bn-default-styles":"",((f=(u=h.domAttributes)==null?void 0:u.editor)==null?void 0:f.class)||"")},transformPasted:fKe}};try{const T=h.initialContent||(y?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:qC.options.generateID()}]);if(!Array.isArray(T)||T.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+T);const A=N7e(E.extensions),R=T.map(D=>If(D,A,this.schema.styleSchema).toJSON()),_=mS({type:"doc",content:[{type:"blockGroup",content:R}]},A,E.parseOptions);this._tiptapEditor=new y9e({...E,content:_.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(T){throw new Error("Error creating document from blocks passed as `initialContent`",{cause:T})}let S;const w=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...T)=>{if(S)return S;const A=w.apply(this.pmSchema.nodes.doc,T),R=JSON.parse(JSON.stringify(A.toJSON()));return R.content[0].content[0].attrs.id="initialBlockId",S=Xl.fromJSON(this.pmSchema,R),S},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new rYe(this),this._exportManager=new hYe(this),this._selectionManager=new sKe(this),this._stateManager=new aKe(this),this._styleManager=new cKe(this),this.emit("create")}static create(t){return new Ise(t??{})}get extensions(){return this._extensionManager.getExtensions()}exec(t){return this._stateManager.exec(t)}canExec(t){return this._stateManager.canExec(t)}transact(t){return this._stateManager.transact(t)}get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){var t;if(!this.headless)return(t=this.prosemirrorView)==null?void 0:t.dom}isFocused(){var t;return this.headless?!1:((t=this.prosemirrorView)==null?void 0:t.hasFocus())||!1}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){var t;this.headless||(t=this.domElement)==null||t.blur()}onUploadStart(t){return this.onUploadStartCallbacks.push(t),()=>{const n=this.onUploadStartCallbacks.indexOf(t);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(t){return this.onUploadEndCallbacks.push(t),()=>{const n=this.onUploadEndCallbacks.indexOf(t);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(t){return this._blockManager.getBlock(t)}getPrevBlock(t){return this._blockManager.getPrevBlock(t)}getNextBlock(t){return this._blockManager.getNextBlock(t)}getParentBlock(t){return this._blockManager.getParentBlock(t)}forEachBlock(t,n=!1){this._blockManager.forEachBlock(t,n)}onEditorContentChange(t){this._tiptapEditor.on("update",t)}onEditorSelectionChange(t){this._tiptapEditor.on("selectionUpdate",t)}onBeforeChange(t){return this._extensionManager.getExtension(Moe).subscribe(t)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(t,n="start"){return this._selectionManager.setTextCursorPosition(t,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(t=!1){return this._selectionManager.getSelectionCutBlocks(t)}setSelection(t,n){return this._selectionManager.setSelection(t,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(t){this._stateManager.isEditable=t}insertBlocks(t,n,r="before"){return this._blockManager.insertBlocks(t,n,r)}updateBlock(t,n){return this._blockManager.updateBlock(t,n)}removeBlocks(t){return this._blockManager.removeBlocks(t)}replaceBlocks(t,n){return this._blockManager.replaceBlocks(t,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(t,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(t,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(t){this._styleManager.addStyles(t)}removeStyles(t){this._styleManager.removeStyles(t)}toggleStyles(t){this._styleManager.toggleStyles(t)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(t,n){this._styleManager.createLink(t,n)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(t=this.document){return this._exportManager.blocksToHTMLLossy(t)}blocksToFullHTML(t=this.document){return this._exportManager.blocksToFullHTML(t)}tryParseHTMLToBlocks(t){return this._exportManager.tryParseHTMLToBlocks(t)}blocksToMarkdownLossy(t=this.document){return this._exportManager.blocksToMarkdownLossy(t)}tryParseMarkdownToBlocks(t){return this._exportManager.tryParseMarkdownToBlocks(t)}onChange(t,n){return this._eventManager.onChange(t,n)}onSelectionChange(t,n){return this._eventManager.onSelectionChange(t,n)}onMount(t){this._eventManager.onMount(t)}onUnmount(t){this._eventManager.onUnmount(t)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){const t=this.document;return t.length===0||t.length===1&&t[0].type==="paragraph"&&t[0].content.length===0}pasteHTML(t,n=!1){this._exportManager.pasteHTML(t,n)}pasteText(t){return this._exportManager.pasteText(t)}pasteMarkdown(t){return this._exportManager.pasteMarkdown(t)}};var a_={exports:{}},l_={},c_={exports:{}},u_={};var Iq;function gKe(){if(Iq)return u_;Iq=1;var e=G0();function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function a(f,h){var g=h(),y=r({inst:{value:g,getSnapshot:h}}),E=y[0].inst,S=y[1];return o(function(){E.value=g,E.getSnapshot=h,l(E)&&S({inst:E})},[f,g,h]),i(function(){return l(E)&&S({inst:E}),f(function(){l(E)&&S({inst:E})})},[f]),s(g),g}function l(f){var h=f.getSnapshot;f=f.value;try{var g=h();return!n(f,g)}catch{return!0}}function c(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return u_.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,u_}var Oq;function Ose(){return Oq||(Oq=1,c_.exports=gKe()),c_.exports}var Mq;function bKe(){if(Mq)return l_;Mq=1;var e=G0(),t=Ose();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return l_.useSyncExternalStoreWithSelector=function(c,u,f,h,g){var y=o(null);if(y.current===null){var E={hasValue:!1,value:null};y.current=E}else E=y.current;y=a(function(){function w(D){if(!T){if(T=!0,A=D,D=h(D),g!==void 0&&E.hasValue){var I=E.value;if(g(I,D))return R=I}return R=D}if(I=R,r(A,D))return I;var M=h(D);return g!==void 0&&g(I,M)?(A=D,I):(A=D,R=M)}var T=!1,A,R,_=f===void 0?null:f;return[function(){return w(u())},_===null?void 0:function(){return w(_())}]},[u,f,h,g]);var S=i(c,y[0],y[1]);return s(function(){E.hasValue=!0,E.value=S},[S]),l(S),S},l_}var Lq;function yKe(){return Lq||(Lq=1,a_.exports=bKe()),a_.exports}var Mse=yKe();const vKe=lc(Mse);function xKe(e,t=n=>n){return Mse.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,EKe)}function EKe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!t.has(r)||!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Pq(e);if(n.length!==Pq(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Pq(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Lse=Ose(),SKe=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},wKe=({contentComponent:e})=>{const t=Lse.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(t)})};function CKe(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:SO.createPortal(r.reactElement,r.element,n)},e.forEach(i=>i())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(i=>i())}}}var TKe=class extends pe.Component{constructor(e){var t;super(e),this.editorContentRef=pe.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=CKe(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:SKe(t,this.editorContentRef),...n}),e?.contentComponent&&m.jsx(wKe,{contentComponent:e.contentComponent})]})}},kKe=v.forwardRef((e,t)=>{const n=pe.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return pe.createElement(TKe,{key:n,innerRef:t,...e})});pe.memo(kKe);var AKe=v.createContext({editor:null});AKe.Consumer;var Pse=v.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Fse=()=>v.useContext(Pse),NKe=pe.forwardRef((e,t)=>{const{onDragStart:n}=Fse(),r=e.as||"div";return m.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function Fq(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function Bq(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.forward_ref)"||e.$$typeof.description==="react.forward_ref"))}function _Ke(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.memo)"||e.$$typeof.description==="react.memo"))}function RKe(e){if(Fq(e)||Bq(e))return!0;if(_Ke(e)){const t=e.type;if(t)return Fq(t)||Bq(t)}return!1}function DKe(){try{if(v.version)return parseInt(v.version.split(".")[0],10)>=19}catch{}return!1}var IKe=class{constructor(e,{editor:t,props:n={},as:r="div",className:i=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Wr.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var e;const t=this.component,n=this.props,r=this.editor,i=DKe(),o=RKe(t),s={...n};s.ref&&!(i||o)&&delete s.ref,!s.ref&&(i||o)&&(s.ref=a=>{this.ref=a}),this.reactElement=m.jsx(t,{...s}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};pe.createContext({markViewContentRef:()=>{}});var OKe=class extends N9e{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:v.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,o=v.memo(l=>m.jsx(Pse.Provider,{value:r,children:v.createElement(i,l)}));o.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new IKe(o,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!((e=this.renderer.element.firstElementChild)!=null&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,o=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n})})}return e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,n=w0(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function MKe(e,t){return n=>n.editor.contentComponent?new OKe(e,n,t):{}}var LKe=Object.defineProperty,PKe=(e,t,n)=>t in e?LKe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vg=(e,t,n)=>PKe(e,typeof t!="symbol"?t+"":t,n);const Bse=v.createContext(void 0);function hl(e){return v.useContext(Bse)}const jse=v.createContext(void 0);function at(){return v.useContext(jse)}function mt(e){const t=hl();if(!(t!=null&&t.editor))throw new Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return t.editor}function Rt(){return hl().editor.dictionary}const FKe=e=>{const t=at(),n=Rt(),r=mt(),i=r.getBlock(e.blockId),[o,s]=v.useState(""),a=v.useCallback(u=>{s(u.currentTarget.value)},[]),l=v.useCallback(u=>{u.key==="Enter"&&(u.preventDefault(),r.updateBlock(i.id,{props:{name:fG(o),url:o}}))},[r,i.id,o]),c=v.useCallback(()=>{r.updateBlock(i.id,{props:{name:fG(o),url:o}})},[r,i.id,o]);return m.jsxs(t.FilePanel.TabPanel,{className:"bn-tab-panel",children:[m.jsx(t.FilePanel.TextInput,{className:"bn-text-input",placeholder:n.file_panel.embed.url_placeholder,value:o,onChange:a,onKeyDown:l,"data-test":"embed-input"}),m.jsx(t.FilePanel.Button,{className:"bn-button",onClick:c,"data-test":"embed-input-button",children:n.file_panel.embed.embed_button[i.type]||n.file_panel.embed.embed_button.file})]})},BKe=e=>{var t,n;const r=at(),i=Rt(),{setLoading:o}=e,s=mt(),a=s.getBlock(e.blockId),[l,c]=v.useState(!1);v.useEffect(()=>{l&&setTimeout(()=>{c(!1)},3e3)},[l]);const u=v.useCallback(g=>{if(g===null)return;async function y(E){if(o(!0),s.uploadFile!==void 0)try{let S=await s.uploadFile(E,e.blockId);typeof S=="string"&&(S={props:{name:E.name,url:S}}),s.updateBlock(e.blockId,S)}catch{c(!0)}finally{o(!1)}}y(g)},[e.blockId,s,o]),f=s.schema.blockSpecs[a.type],h=(n=(t=f.implementation.meta)==null?void 0:t.fileBlockAccept)!=null&&n.length?f.implementation.meta.fileBlockAccept.join(","):"*/*";return m.jsxs(r.FilePanel.TabPanel,{className:"bn-tab-panel",children:[m.jsx(r.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:h,placeholder:i.file_panel.upload.file_placeholder[a.type]||i.file_panel.upload.file_placeholder.file,value:null,onChange:u}),l&&m.jsx("div",{className:"bn-error-text",children:i.file_panel.upload.upload_error})]})},$se=e=>{const t=at(),n=Rt(),r=mt(),[i,o]=v.useState(!1),s=e.tabs??[...r.uploadFile!==void 0?[{name:n.file_panel.upload.title,tabPanel:m.jsx(BKe,{blockId:e.blockId,setLoading:o})}]:[],{name:n.file_panel.embed.title,tabPanel:m.jsx(FKe,{blockId:e.blockId})}],[a,l]=v.useState(e.defaultOpenTab||s[0].name);return m.jsx(t.FilePanel.Root,{className:"bn-panel",defaultOpenTab:a,openTab:a,setOpenTab:l,tabs:s,loading:i})};function jKe(e){let t=new DOMRect;const n="getBoundingClientRect"in e?()=>e.getBoundingClientRect():()=>e.element.getBoundingClientRect();return()=>"element"in e&&(e.cacheMountedBoundingClientRect??!0)?(e.element.isConnected&&(t=n()),t):n()}const Va=e=>{var t,n,r;const{refs:i,floatingStyles:o,context:s}=jqe({whileElementsMounted:Joe,...e.useFloatingOptions}),{isMounted:a,styles:l}=Hqe(s,e.useTransitionStylesProps),{status:c}=ose(s,e.useTransitionStatusProps),u=Fqe(s,e.useDismissProps),f=Oqe(s,{enabled:!1,...e.useHoverProps}),{getFloatingProps:h}=$qe([u,f]),g=v.useRef(""),y=v.useRef(null),E=wqe([y,i.setFloating]);if(v.useEffect(()=>{if(e.reference){const w="element"in e.reference?e.reference.element:void 0;w!==void 0&&i.setReference(w),i.setPositionReference({getBoundingClientRect:jKe(e.reference),contextElement:w})}},[e.reference,i]),v.useEffect(()=>{var w;(c==="initial"||c==="open")&&(w=y.current)!=null&&w.innerHTML&&(g.current=y.current.innerHTML)},[c,e.reference,e.children]),!a)return!1;const S={...e.elementProps,style:{display:"flex",...(t=e.elementProps)==null?void 0:t.style,zIndex:`calc(var(--bn-ui-base-z-index) + ${((r=(n=e.elementProps)==null?void 0:n.style)==null?void 0:r.zIndex)||0})`,...o,...l},...h()};return c==="close"?m.jsx("div",{ref:E,...S,dangerouslySetInnerHTML:{__html:g.current}}):m.jsx("div",{ref:E,...S,children:e.children})},Use=e=>{const{blockId:t,children:n,...r}=e,i=mt(),o=v.useMemo(()=>i.transact(s=>{if(!t)return;const a=no(t,s.doc);if(!a)return;const{node:l}=i.prosemirrorView.domAtPos(a.posBeforeNode+1);if(l instanceof Element)return{element:l}}),[i,t]);return m.jsx(Va,{reference:o,...r,children:t!==void 0&&n})};function sn(e,t){const n=(t?.editor??mt()).getExtension(e);if(!n)throw new Error("Extension not found",{cause:{plugin:e}});return n}function Fn(e,t){const{store:n}=sn(e,t);if(!n)throw new Error("Store not found on plugin",{cause:{plugin:e}});return xKe(n,t?.selector)}const $Ke=e=>{const t=mt(),n=sn(ca),r=Fn(ca),i=v.useMemo(()=>({useFloatingOptions:{open:!!r,onOpenChange:(s,a,l)=>{s||n.closeMenu(),l==="escape-key"&&t.focus()},middleware:[ha(10),_m()]},elementProps:{style:{zIndex:90}},...e.floatingUIOptions}),[r,t,n,e.floatingUIOptions]),o=e.filePanel||$se;return m.jsx(Use,{blockId:r,...i,children:r&&m.jsx(o,{blockId:r})})};function UKe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var HKe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&t.$$typeof)&&!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n};const zKe=UKe(HKe);var Hse={exports:{}},d_={},jq={exports:{}},f_={};var $q;function VKe(){if($q)return f_;$q=1;var e=pe;function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function a(f,h){var g=h(),y=r({inst:{value:g,getSnapshot:h}}),E=y[0].inst,S=y[1];return o(function(){E.value=g,E.getSnapshot=h,l(E)&&S({inst:E})},[f,g,h]),i(function(){return l(E)&&S({inst:E}),f(function(){l(E)&&S({inst:E})})},[f]),s(g),g}function l(f){var h=f.getSnapshot;f=f.value;try{var g=h();return!n(f,g)}catch{return!0}}function c(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return f_.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,f_}var Uq;function GKe(){return Uq||(Uq=1,jq.exports=VKe()),jq.exports}var Hq;function qKe(){if(Hq)return d_;Hq=1;var e=pe,t=GKe();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return d_.useSyncExternalStoreWithSelector=function(c,u,f,h,g){var y=o(null);if(y.current===null){var E={hasValue:!1,value:null};y.current=E}else E=y.current;y=a(function(){function w(D){if(!T){if(T=!0,A=D,D=h(D),g!==void 0&&E.hasValue){var I=E.value;if(g(I,D))return R=I}return R=D}if(I=R,r(A,D))return I;var M=h(D);return g!==void 0&&g(I,M)?(A=D,I):(A=D,R=M)}var T=!1,A,R,_=f===void 0?null:f;return[function(){return w(u())},_===null?void 0:function(){return w(_())}]},[u,f,h,g]);var S=i(c,y[0],y[1]);return s(function(){E.hasValue=!0,E.value=S},[S]),l(S),S},d_}Hse.exports=qKe();var WKe=Hse.exports;const YKe=typeof window<"u"?v.useLayoutEffect:v.useEffect;class KKe{constructor(t){Vg(this,"transactionNumber",0),Vg(this,"lastTransactionNumber",0),Vg(this,"lastSnapshot"),Vg(this,"editor"),Vg(this,"subscribers",new Set),this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t,n){if(this.editor=t,this.editor){const r=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},i=this.editor._tiptapEditor,o={all:"transaction",selection:"selectionUpdate",change:"update"};return i.on(o[n],r),()=>{i.off(o[n],r)}}}}function li(e){const t=hl(),n=e.editor||t?.editor||null,r=e.on||"all",[i]=v.useState(()=>new KKe(n)),o=WKe.useSyncExternalStoreWithSelector(i.subscribe,i.getSnapshot,i.getServerSnapshot,e.selector,e.equalityFn??zKe);return YKe(()=>i.watch(n,r),[n,i,r]),v.useDebugValue(o),o}const WP=e=>{const{position:t,children:n,...r}=e,{from:i,to:o}=t||{},s=mt(),a=v.useMemo(()=>{var l;if(!(i===void 0||o===void 0))return{element:((l=s.domElement)==null?void 0:l.firstElementChild)||void 0,getBoundingClientRect:()=>rP(s.prosemirrorView,i,o??i)}},[s,i,o]);return m.jsx(Va,{reference:a,...r,children:t!==void 0&&n})};var zse={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},zq=pe.createContext&&pe.createContext(zse),XKe=["attr","size","title"];function ZKe(e,t){if(e==null)return{};var n=QKe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function QKe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function XS(){return XS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},XS.apply(this,arguments)}function Vq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ZS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vq(Object(n),!0).forEach(function(r){JKe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vq(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JKe(e,t,n){return t=eXe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eXe(e){var t=tXe(e,"string");return typeof t=="symbol"?t:t+""}function tXe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vse(e){return e&&e.map((t,n)=>pe.createElement(t.tag,ZS({key:n},t.attr),Vse(t.child)))}function ct(e){return t=>pe.createElement(nXe,XS({attr:ZS({},e.attr)},t),Vse(e.child))}function nXe(e){var t=n=>{var{attr:r,size:i,title:o}=e,s=ZKe(e,XKe),a=i||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),pe.createElement("svg",XS({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:ZS(ZS({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&pe.createElement("title",null,o),e.children)};return zq!==void 0?pe.createElement(zq.Consumer,null,n=>t(n)):t(zse)}function rXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(e)}function Gse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(e)}function iXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(e)}function oXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(e)}function sXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"},child:[]}]})(e)}function aXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(e)}function lXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(e)}function cXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(e)}function uXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(e)}function dXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(e)}function fXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(e)}function Gq(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(e)}function QS(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(e)}function JS(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(e)}function ew(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(e)}function qse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(e)}function Wse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(e)}function Yse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(e)}function pXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(e)}function hXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(e)}function qq(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(e)}function mXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(e)}function gXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(e)}function Kse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(e)}function Xse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(e)}function Zse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(e)}function Qse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(e)}function bXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(e)}function yXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(e)}function Jse(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(e)}function vXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(e)}function xXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3Z"},child:[]}]})(e)}function YP(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(e)}function EXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(e)}function SXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"},child:[]}]})(e)}function wXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"},child:[]}]})(e)}function CXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(e)}function TXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(e)}function eae(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(e)}function kXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"},child:[]}]})(e)}function AXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(e)}function NXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(e)}function _Xe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(e)}function RXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(e)}function DXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(e)}function IXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(e)}function OXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(e)}function MXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(e)}function LXe(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(e)}function Wq(e){return ct({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(e)}const PXe={bold:dXe,italic:mXe,underline:EXe,strike:vXe,code:oXe};function FXe(e,t){return e in t.schema.styleSchema&&t.schema.styleSchema[e].type===e&&t.schema.styleSchema[e].propSchema==="boolean"}const fx=e=>{const t=Rt(),n=at(),r=mt(),i=li({editor:r,selector:({editor:a})=>{var l;if(!(!a.isEditable||!FXe(e.basicTextStyle,a)||!(((l=a.getSelection())==null?void 0:l.blocks)||[a.getTextCursorPosition().block]).find(c=>c.content!==void 0)))return e.basicTextStyle in a.getActiveStyles()?{active:!0}:{active:!1}}}),o=v.useCallback(a=>{r.focus(),r.toggleStyles({[a]:!0})},[r,e]);if(i===void 0)return null;const s=PXe[e.basicTextStyle];return m.jsx(n.FormattingToolbar.Button,{className:"bn-button","data-test":e.basicTextStyle,onClick:()=>o(e.basicTextStyle),isSelected:i.active,label:t.formatting_toolbar[e.basicTextStyle].tooltip,mainTooltip:t.formatting_toolbar[e.basicTextStyle].tooltip,secondaryTooltip:ws(t.formatting_toolbar[e.basicTextStyle].secondary_tooltip,t.generic.ctrl_shortcut),icon:m.jsx(s,{})})},oI=e=>{const t=e.textColor||"default",n=e.backgroundColor||"default",r=e.size||16,i=v.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return m.jsx("div",{className:"bn-color-icon","data-background-color":n,"data-text-color":t,style:i,children:"A"})},Yq=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],lT=e=>{const t=at(),n=Rt();return m.jsxs(m.Fragment,{children:[m.jsx(()=>e.text?m.jsxs(m.Fragment,{children:[m.jsx(t.Generic.Menu.Label,{children:n.color_picker.text_title}),Yq.map(r=>m.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.text.setColor(r)},"data-test":"text-color-"+r,icon:m.jsx(oI,{textColor:r,size:e.iconSize}),checked:e.text.color===r,children:n.color_picker.colors[r]},"text-color-"+r))]}):null,{}),m.jsx(()=>e.background?m.jsxs(m.Fragment,{children:[m.jsx(t.Generic.Menu.Label,{children:n.color_picker.background_title}),Yq.map(r=>m.jsx(t.Generic.Menu.Item,{onClick:()=>{e.onClick&&e.onClick(),e.background.setColor(r)},"data-test":"background-color-"+r,icon:m.jsx(oI,{backgroundColor:r,size:e.iconSize}),checked:e.background.color===r,children:n.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function px(e,t){return`${e}Color`in t.schema.styleSchema&&t.schema.styleSchema[`${e}Color`].type===`${e}Color`&&t.schema.styleSchema[`${e}Color`].propSchema==="string"}const BXe=()=>{const e=at(),t=Rt(),n=mt(),r=px("text",n),i=px("background",n),o=li({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable||!(((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block]).find(h=>h.content!==void 0))return;const u=px("text",l),f=px("background",l);if(!(!u&&!f))return{textColor:u?l.getActiveStyles().textColor||"default":void 0,backgroundColor:f?l.getActiveStyles().backgroundColor||"default":void 0}}}),s=v.useCallback(l=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");l==="default"?n.removeStyles({textColor:l}):n.addStyles({textColor:l}),setTimeout(()=>{n.focus()})},[n,r]),a=v.useCallback(l=>{if(!i)throw Error("Tried to set background color, but style does not exist in editor schema.");l==="default"?n.removeStyles({backgroundColor:l}):n.addStyles({backgroundColor:l}),setTimeout(()=>{n.focus()})},[i,n]);return o===void 0?null:m.jsxs(e.Generic.Menu.Root,{children:[m.jsx(e.Generic.Menu.Trigger,{children:m.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:t.formatting_toolbar.colors.tooltip,mainTooltip:t.formatting_toolbar.colors.tooltip,icon:m.jsx(oI,{textColor:o.textColor,backgroundColor:o.backgroundColor,size:20})})}),m.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:m.jsx(lT,{text:o.textColor?{color:o.textColor,setColor:s}:void 0,background:o.backgroundColor?{color:o.backgroundColor,setColor:a}:void 0})})]})},Kq=e=>{for(const t of Poe)if(e.startsWith(t))return e;return`${Foe}://${e}`},tae=e=>{const t=at(),n=Rt(),{editLink:r}=sn(Py),{url:i,text:o,showTextField:s}=e,[a,l]=v.useState(i),[c,u]=v.useState(o);v.useEffect(()=>{l(i),u(o)},[o,i]);const f=v.useCallback(E=>{var S,w;E.key==="Enter"&&(E.preventDefault(),r(Kq(a),c,e.range.from),(S=e.setToolbarOpen)==null||S.call(e,!1),(w=e.setToolbarPositionFrozen)==null||w.call(e,!1))},[r,a,c,e]),h=v.useCallback(E=>l(E.currentTarget.value),[]),g=v.useCallback(E=>u(E.currentTarget.value),[]),y=v.useCallback(()=>{var E,S;r(Kq(a),c,e.range.from),(E=e.setToolbarOpen)==null||E.call(e,!1),(S=e.setToolbarPositionFrozen)==null||S.call(e,!1)},[r,a,c,e]);return m.jsxs(t.Generic.Form.Root,{children:[m.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:m.jsx(Kse,{}),autoFocus:!0,placeholder:n.link_toolbar.form.url_placeholder,value:a,onKeyDown:f,onChange:h,onSubmit:y}),s!==!1&&m.jsx(t.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:m.jsx(YP,{}),placeholder:n.link_toolbar.form.title_placeholder,value:c,onKeyDown:f,onChange:g,onSubmit:y})]})};function jXe(e){return"link"in e.schema.inlineContentSchema&&e.schema.inlineContentSchema.link==="link"}const $Xe=()=>{const e=mt(),t=at(),n=Rt(),r=sn(Mu),{showSelection:i}=sn(fS),[o,s]=v.useState(!1);v.useEffect(()=>(i(o),()=>i(!1)),[o,i]);const a=li({editor:e,selector:({editor:l})=>{var c;if(!(!l.isEditable||!jXe(l)||BD(l.prosemirrorState.selection)||!(((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block]).find(u=>u.content!==void 0)))return{url:l.getSelectedLinkUrl(),text:l.getSelectedText(),range:{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}}}});return v.useEffect(()=>{var l;const c=u=>{(u.ctrlKey||u.metaKey)&&u.key==="k"&&(s(!0),u.preventDefault())};return(l=e.domElement)==null||l.addEventListener("keydown",c),()=>{var u;(u=e.domElement)==null||u.removeEventListener("keydown",c)}},[e.domElement]),a===void 0?null:m.jsxs(t.Generic.Popover.Root,{open:o,children:[m.jsx(t.Generic.Popover.Trigger,{children:m.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:n.formatting_toolbar.link.tooltip,mainTooltip:n.formatting_toolbar.link.tooltip,secondaryTooltip:ws(n.formatting_toolbar.link.secondary_tooltip,n.generic.ctrl_shortcut),icon:m.jsx(Kse,{}),onClick:()=>s(!0)})}),m.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:m.jsx(tae,{url:a.url||"",text:a.text,range:a.range,showTextField:!1,setToolbarOpen:l=>r.store.setState(l)})})]})},UXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block];if(u.length!==1)return;const f=u[0];if(Co(f,l,f.type,{url:"string",caption:"string"}))return f}}),[i,o]=v.useState();v.useEffect(()=>{r!==void 0&&o(r.props.caption)},[r]);const s=v.useCallback(l=>o(l.currentTarget.value),[]),a=v.useCallback(l=>{r!==void 0&&Kn(n,r.type,{caption:"string"})&&l.key==="Enter"&&(l.preventDefault(),n.updateBlock(r.id,{props:{caption:i}}))},[r,i,n]);return r===void 0?null:m.jsxs(t.Generic.Popover.Root,{children:[m.jsx(t.Generic.Popover.Trigger,{children:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_caption.tooltip,mainTooltip:e.formatting_toolbar.file_caption.tooltip,icon:m.jsx(qq,{})})}),m.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:m.jsx(t.Generic.Form.Root,{children:m.jsx(t.Generic.Form.TextInput,{name:"file-caption",icon:m.jsx(qq,{}),value:i||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_caption.input_placeholder,onKeyDown:a,onChange:s})})})]})},HXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:o})=>{var s;if(!o.isEditable)return;const a=((s=o.getSelection())==null?void 0:s.blocks)||[o.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(Co(l,o,l.type,{url:"string"}))return l}}),i=v.useCallback(()=>{r!==void 0&&(n.focus(),n.removeBlocks([r.id]))},[r,n]);return r===void 0?null:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,mainTooltip:e.formatting_toolbar.file_delete.tooltip[r.type]||e.formatting_toolbar.file_delete.tooltip.file,icon:m.jsx(_Xe,{}),onClick:i})},zXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block];if(u.length!==1)return;const f=u[0];if(Co(f,l,f.type,{url:"string",name:"string"}))return f}}),[i,o]=v.useState();v.useEffect(()=>{r!==void 0&&o(r.props.name)},[r]);const s=v.useCallback(l=>o(l.currentTarget.value),[]),a=v.useCallback(l=>{r!==void 0&&Kn(n,r.type,{name:"string"})&&l.key==="Enter"&&(l.preventDefault(),n.updateBlock(r.id,{props:{name:i}}))},[r,i,n]);return r===void 0?null:m.jsxs(t.Generic.Popover.Root,{children:[m.jsx(t.Generic.Popover.Trigger,{children:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,mainTooltip:e.formatting_toolbar.file_rename.tooltip[r.type]||e.formatting_toolbar.file_rename.tooltip.file,icon:m.jsx(Gq,{})})}),m.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:m.jsx(t.Generic.Form.Root,{children:m.jsx(t.Generic.Form.TextInput,{name:"file-name",icon:m.jsx(Gq,{}),value:i||"",autoFocus:!0,placeholder:e.formatting_toolbar.file_rename.input_placeholder[r.type]||e.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:a,onChange:s})})})]})},VXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:i})=>{var o;if(!i.isEditable)return;const s=((o=i.getSelection())==null?void 0:o.blocks)||[i.getTextCursorPosition().block];if(s.length!==1)return;const a=s[0];if(Co(a,i,a.type,{url:"string"}))return a}});return r===void 0?null:m.jsxs(t.Generic.Popover.Root,{position:"bottom",children:[m.jsx(t.Generic.Popover.Trigger,{children:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",mainTooltip:e.formatting_toolbar.file_replace.tooltip[r.type]||e.formatting_toolbar.file_replace.tooltip.file,label:e.formatting_toolbar.file_replace.tooltip[r.type]||e.formatting_toolbar.file_replace.tooltip.file,icon:m.jsx(TXe,{})})}),m.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:m.jsx($se,{blockId:r.id})})]})},GXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:o})=>{var s;if(!(!o.isEditable||!(((s=o.getSelection())==null?void 0:s.blocks)||[o.getTextCursorPosition().block]).find(a=>a.content!==void 0)))return{canNestBlock:o.canNestBlock()}}}),i=v.useCallback(()=>{r!==void 0&&r.canNestBlock&&(n.focus(),n.nestBlock())},[n,r]);return r===void 0?null:m.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:i,isDisabled:!r.canNestBlock,label:e.formatting_toolbar.nest.tooltip,mainTooltip:e.formatting_toolbar.nest.tooltip,secondaryTooltip:ws(e.formatting_toolbar.nest.secondary_tooltip,e.generic.ctrl_shortcut),icon:m.jsx(hXe,{})})},qXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:o})=>{var s;if(!(!o.isEditable||!(((s=o.getSelection())==null?void 0:s.blocks)||[o.getTextCursorPosition().block]).find(a=>a.content!==void 0)))return{canUnnestBlock:o.canUnnestBlock()}}}),i=v.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(n.focus(),n.unnestBlock())},[n,r]);return r===void 0?null:m.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:i,isDisabled:!r.canUnnestBlock,label:e.formatting_toolbar.unnest.tooltip,mainTooltip:e.formatting_toolbar.unnest.tooltip,secondaryTooltip:ws(e.formatting_toolbar.unnest.secondary_tooltip,e.generic.ctrl_shortcut),icon:m.jsx(pXe,{})})},WXe=e=>[{name:e.slash_menu.paragraph.title,type:"paragraph",icon:YP},{name:e.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:QS},{name:e.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:JS},{name:e.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:ew},{name:e.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:qse},{name:e.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:Wse},{name:e.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:Yse},{name:e.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:QS},{name:e.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:JS},{name:e.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:ew},{name:e.slash_menu.quote.title,type:"quote",icon:Jse},{name:e.slash_menu.toggle_list.title,type:"toggleListItem",icon:eae},{name:e.slash_menu.bullet_list.title,type:"bulletListItem",icon:Qse},{name:e.slash_menu.numbered_list.title,type:"numberedListItem",icon:Zse},{name:e.slash_menu.check_list.title,type:"checkListItem",icon:Xse}],YXe=e=>{const t=at(),n=mt(),r=li({editor:n,selector:({editor:a})=>{var l;return((l=a.getSelection())==null?void 0:l.blocks)||[a.getTextCursorPosition().block]}}),i=r[0],o=v.useMemo(()=>(e.items||WXe(n.dictionary)).filter(a=>Kn(n,a.type,Object.fromEntries(Object.entries(a.props||{}).map(([l,c])=>[l,typeof c])))),[n,e.items]),s=v.useMemo(()=>o.map(a=>{const l=a.icon,c=a.type===i.type,u=Object.entries(a.props||{}).filter(([f,h])=>h!==i.props[f]).length===0;return{text:a.name,icon:m.jsx(l,{size:16}),onClick:()=>{n.focus(),n.transact(()=>{for(const f of r)n.updateBlock(f,{type:a.type,props:a.props})})},isSelected:c&&u}}),[n,o,i.props,i.type,r]);return!v.useMemo(()=>s.find(a=>a.isSelected)!==void 0,[s])||!n.isEditable?null:m.jsx(t.FormattingToolbar.Select,{className:"bn-select",items:s})},KXe=()=>{const e=Rt(),t=at(),n=sn("comments"),{store:r}=sn(Mu),i=v.useCallback(()=>{n.startPendingComment(),r.setState(!1)},[n,r]);return m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:m.jsx(Gse,{}),onClick:i})},XXe=()=>mt().getExtension("comments")?m.jsx(KXe,{}):null,ZXe=()=>{const e=Rt(),t=at(),n=mt(),r=v.useCallback(()=>{n._tiptapEditor.chain().focus().addPendingComment().run()},[n]);return!n._tiptapEditor.commands.addPendingComment||!n.isEditable?null:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.comment.tooltip,mainTooltip:e.formatting_toolbar.comment.tooltip,icon:m.jsx(Gse,{}),onClick:r})};function sI(e,t){try{const n=new URL(e,t);if(n.protocol!=="javascript:")return n.href}catch{}return"#"}const QXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:o})=>{var s;const a=((s=o.getSelection())==null?void 0:s.blocks)||[o.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(Co(l,o,l.type,{url:"string"}))return l}}),i=v.useCallback(()=>{r!==void 0&&(n.focus(),n.resolveFileUrl?n.resolveFileUrl(r.props.url).then(o=>window.open(sI(o,window.location.href))):window.open(sI(r.props.url,window.location.href)))},[r,n]);return r===void 0?null:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,mainTooltip:e.formatting_toolbar.file_download.tooltip[r.type]||e.formatting_toolbar.file_download.tooltip.file,icon:m.jsx(DXe,{}),onClick:i})},JXe=()=>{const e=Rt(),t=at(),n=mt(),r=li({editor:n,selector:({editor:o})=>{var s;if(!o.isEditable)return;const a=((s=o.getSelection())==null?void 0:s.blocks)||[o.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(Co(l,o,l.type,{url:"string",showPreview:"boolean"}))return l}}),i=v.useCallback(()=>{r!==void 0&&Kn(n,r.type,{showPreview:"boolean"})&&n.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,n]);return r===void 0?null:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:e.formatting_toolbar.file_preview_toggle.tooltip,icon:m.jsx(CXe,{}),isSelected:r.props.showPreview,onClick:i})},eZe=()=>{const e=Rt(),t=at(),n=mt(),r=sn(zn),i=li({editor:n,selector:({editor:s})=>{var a;if(!s.isEditable||!s.settings.tables.splitCells)return;const l=((a=s.getSelection())==null?void 0:a.blocks)||[s.getTextCursorPosition().block];if(l.length!==1)return;const c=l[0];if(c.type==="table")return{mergeDirection:r.getMergeDirection(c)}}}),o=v.useCallback(()=>{r?.mergeCells()},[r]);return i===void 0?null:m.jsx(t.FormattingToolbar.Button,{className:"bn-button",label:e.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:e.formatting_toolbar.table_cell_merge.tooltip,icon:i.mergeDirection==="horizontal"?m.jsx(bXe,{}):m.jsx(yXe,{}),onClick:o})},tZe=()=>mt().getExtension(zn)?m.jsx(eZe,{}):null,nZe={left:cXe,center:aXe,right:uXe,justify:lXe},p_=e=>{const t=at(),n=Rt(),r=mt(),i=li({editor:r,selector:({editor:a})=>{var l,c;if(!a.isEditable)return;const u=((l=a.getSelection())==null?void 0:l.blocks)||[a.getTextCursorPosition().block],f=u[0];if(Co(f,a,f.type,{textAlignment:rn.textAlignment}))return{textAlignment:f.props.textAlignment,blocks:u};if(u.length===1&&Co(f,a,"table"))return(c=a.getExtension(zn))!=null&&c.getCellSelection()?{textAlignment:Ru(f.content.rows[0].cells[0]).props.textAlignment,blocks:[f]}:void 0}}),o=v.useCallback(a=>{var l;if(i!==void 0){r.focus();for(const c of i.blocks)if(Co(c,r,c.type,{textAlignment:rn.textAlignment})&&Kn(r,c.type,{textAlignment:rn.textAlignment}))r.updateBlock(c,{props:{textAlignment:a}});else if(c.type==="table"){const u=(l=r.getExtension(zn))==null?void 0:l.getCellSelection();if(!u)continue;const f=c.content.rows.map(h=>({...h,cells:h.cells.map(g=>Ru(g))}));u.cells.forEach(({row:h,col:g})=>{f[h].cells[g].props.textAlignment=a}),r.updateBlock(c,{type:"table",content:{...c.content,type:"tableContent",rows:f}}),r.setTextCursorPosition(c)}}},[r,i]);if(i===void 0)return null;const s=nZe[e.textAlignment];return m.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${e.textAlignment.slice(0,1).toUpperCase()+e.textAlignment.slice(1)}`,onClick:()=>o(e.textAlignment),isSelected:i.textAlignment===e.textAlignment,label:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,mainTooltip:n.formatting_toolbar[`align_${e.textAlignment}`].tooltip,icon:m.jsx(s,{})})},nae=e=>[m.jsx(YXe,{items:e},"blockTypeSelect"),m.jsx(tZe,{},"tableCellMergeButton"),m.jsx(UXe,{},"fileCaptionButton"),m.jsx(VXe,{},"replaceFileButton"),m.jsx(zXe,{},"fileRenameButton"),m.jsx(HXe,{},"fileDeleteButton"),m.jsx(QXe,{},"fileDownloadButton"),m.jsx(JXe,{},"filePreviewButton"),m.jsx(fx,{basicTextStyle:"bold"},"boldStyleButton"),m.jsx(fx,{basicTextStyle:"italic"},"italicStyleButton"),m.jsx(fx,{basicTextStyle:"underline"},"underlineStyleButton"),m.jsx(fx,{basicTextStyle:"strike"},"strikeStyleButton"),m.jsx(p_,{textAlignment:"left"},"textAlignLeftButton"),m.jsx(p_,{textAlignment:"center"},"textAlignCenterButton"),m.jsx(p_,{textAlignment:"right"},"textAlignRightButton"),m.jsx(BXe,{},"colorStyleButton"),m.jsx(GXe,{},"nestBlockButton"),m.jsx(qXe,{},"unnestBlockButton"),m.jsx($Xe,{},"createLinkButton"),m.jsx(XXe,{},"addCommentButton"),m.jsx(ZXe,{},"addTiptapCommentButton")],rae=e=>{const t=at();return m.jsx(t.FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:e.children||nae(e.blockTypeSelectItems)})},rZe=e=>{switch(e){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},iae=e=>{const t=mt(),n=sn(Mu,{editor:t}),r=Fn(Mu,{editor:t}),i=li({editor:t,selector:({editor:l})=>n.store.state?{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}:void 0}),o=li({editor:t,selector:({editor:l})=>{const c=l.getTextCursorPosition().block;return Co(c,l,c.type,{textAlignment:rn.textAlignment})?rZe(c.props.textAlignment):"top-start"}}),s=v.useMemo(()=>({useFloatingOptions:{open:r,onOpenChange:(l,c,u)=>{n.store.setState(l),u==="escape-key"&&t.focus()},placement:o,middleware:[ha(10),Nm(),_m()]},elementProps:{style:{zIndex:40}},...e.floatingUIOptions}),[r,o,e.floatingUIOptions,n.store,t]),a=e.formattingToolbar||rae;return m.jsx(WP,{position:i,...s,children:r&&m.jsx(a,{})})},iZe=e=>{const t=at(),n=Rt(),{deleteLink:r}=sn(Py);return m.jsx(t.LinkToolbar.Button,{className:"bn-button",label:n.link_toolbar.delete.tooltip,mainTooltip:n.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{var i;r(e.range.from),(i=e.setToolbarOpen)==null||i.call(e,!1)},icon:m.jsx(gXe,{})})},oZe=e=>{const t=at(),n=Rt();return m.jsxs(t.Generic.Popover.Root,{onOpenChange:e.setToolbarPositionFrozen,children:[m.jsx(t.Generic.Popover.Trigger,{children:m.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.edit.tooltip,isSelected:!1,children:n.link_toolbar.edit.text})}),m.jsx(t.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:m.jsx(tae,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen})})]})},sZe=e=>{const t=at(),n=Rt();return m.jsx(t.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.open.tooltip,label:n.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(sI(e.url,window.location.href),"_blank")},icon:m.jsx(IXe,{})})},aZe=e=>{const t=at();return m.jsx(t.LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:e.children||m.jsxs(m.Fragment,{children:[m.jsx(oZe,{url:e.url,text:e.text,range:e.range,setToolbarOpen:e.setToolbarOpen,setToolbarPositionFrozen:e.setToolbarPositionFrozen}),m.jsx(sZe,{url:e.url}),m.jsx(iZe,{range:e.range,setToolbarOpen:e.setToolbarOpen})]})})},lZe=e=>{const t=mt(),[n,r]=v.useState(!1),[i,o]=v.useState(!1),s=sn(Py),[a,l]=v.useState(void 0);v.useEffect(()=>{var h;const g=()=>{const w=s.getLinkAtSelection();if(!w){l(void 0),i||r(!1);return}l({cursorType:"text",url:w.mark.attrs.href,text:w.text,range:w.range,element:s.getLinkElementAtPos(w.range.from)}),i||r(!0)},y=w=>{if(a!==void 0&&a.cursorType==="text"||!(w.target instanceof HTMLElement))return;const T=s.getLinkAtElement(w.target);T&&l({cursorType:"mouse",url:T.mark.attrs.href,text:T.text,range:T.range,element:s.getLinkElementAtPos(T.range.from)})},E=t.onChange(g),S=t.onSelectionChange(g);return(h=t.domElement)==null||h.addEventListener("mouseover",y),()=>{var w;E(),S(),(w=t.domElement)==null||w.removeEventListener("mouseover",y)}},[t,s,a,i]);const c=v.useMemo(()=>({useFloatingOptions:{open:n,onOpenChange:(h,g,y)=>{i||a!==void 0&&a.cursorType==="text"&&y==="hover"||(y==="escape-key"&&t.focus(),r(h))},placement:"top-start",middleware:[ha(10),_m()]},useHoverProps:{enabled:a!==void 0&&a.cursorType==="mouse",delay:{open:250,close:250},handleClose:Vqe()},elementProps:{style:{zIndex:50}},...e.floatingUIOptions}),[t,a,e.floatingUIOptions,n,i]),u=v.useMemo(()=>a!=null&&a.element?{element:a.element}:void 0,[a?.element]);if(!t.isEditable)return null;const f=e.linkToolbar||aZe;return m.jsx(Va,{reference:u,...c,children:a&&m.jsx(f,{url:a.url,text:a.text,range:a.range,setToolbarOpen:r,setToolbarPositionFrozen:o})})};function cZe(e){return ct({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(e)}const uZe=()=>{const e=at(),t=Rt(),n=mt(),r=sn(js),i=Fn(va,{editor:n,selector:s=>s?.block}),o=v.useCallback(()=>{if(i===void 0)return;const s=i.content;if(s!==void 0&&Array.isArray(s)&&s.length===0)n.setTextCursorPosition(i),r.openSuggestionMenu("/");else{const a=n.insertBlocks([{type:"paragraph"}],i,"after")[0];n.setTextCursorPosition(a),r.openSuggestionMenu("/")}},[i,n,r]);return i===void 0?null:m.jsx(e.SideMenu.Button,{className:"bn-button",label:t.side_menu.add_block_label,icon:m.jsx(cZe,{size:24,onClick:o,"data-test":"dragHandleAdd"})})};function oae(e){return ct({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(e)}function dZe(e){return ct({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(e)}const fZe=e=>{const t=at(),n=mt(),r=Fn(va,{editor:n,selector:i=>i?.block});return r===void 0||!Co(r,n,r.type,{textColor:"string"})&&!Co(r,n,r.type,{backgroundColor:"string"})?null:m.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[m.jsx(t.Generic.Menu.Trigger,{sub:!0,children:m.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children})}),m.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:m.jsx(lT,{iconSize:18,text:Co(r,n,r.type,{textColor:"string"})&&Kn(n,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:i=>n.updateBlock(r,{type:r.type,props:{textColor:i}})}:void 0,background:Co(r,n,r.type,{backgroundColor:"string"})&&Kn(n,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:i=>n.updateBlock(r,{props:{backgroundColor:i}})}:void 0})})]})},pZe=e=>{const t=at(),n=mt(),r=Fn(va,{editor:n,selector:i=>i?.block});return r===void 0?null:m.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>n.removeBlocks([r]),children:e.children})},hZe=e=>{const t=at(),n=mt(),r=Fn(va,{editor:n,selector:o=>o?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;const i=!!r.content.headerRows;return m.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:i,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerRows:i?void 0:1}})},children:e.children})},mZe=e=>{const t=at(),n=mt(),r=Fn(va,{editor:n,selector:o=>o?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;const i=!!r.content.headerCols;return m.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:i,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerCols:i?void 0:1}})},children:e.children})},gZe=e=>{const t=at(),n=Rt();return m.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:e.children||m.jsxs(m.Fragment,{children:[m.jsx(pZe,{children:n.drag_handle.delete_menuitem}),m.jsx(fZe,{children:n.drag_handle.colors_menuitem}),m.jsx(hZe,{children:n.drag_handle.header_row_menuitem}),m.jsx(mZe,{children:n.drag_handle.header_column_menuitem})]})})},bZe=e=>{const t=at(),n=Rt(),r=sn(va),i=Fn(va,{selector:s=>s?.block});if(i===void 0)return null;const o=e.dragHandleMenu||gZe;return m.jsxs(t.Generic.Menu.Root,{onOpenChange:s=>{s?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[m.jsx(t.Generic.Menu.Trigger,{children:m.jsx(t.SideMenu.Button,{label:n.side_menu.drag_handle_label,draggable:!0,onDragStart:s=>r.blockDragStart(s,i),onDragEnd:r.blockDragEnd,className:"bn-button",icon:m.jsx(oae,{size:24,"data-test":"dragHandle"})})}),m.jsx(o,{children:e.children})]})},yZe=e=>{const t=at(),n=mt(),r=Fn(va,{editor:n,selector:o=>o?.block}),i=v.useMemo(()=>{var o;if(r===void 0)return{};const s={"data-block-type":r.type};return r.type==="heading"&&(s["data-level"]=r.props.level.toString()),(o=n.schema.blockSpecs[r.type].implementation.meta)!=null&&o.fileBlockAccept&&(r.props.url?s["data-url"]="true":s["data-url"]="false"),s},[r,n.schema.blockSpecs]);return m.jsx(t.SideMenu.Root,{className:"bn-side-menu",...i,children:e.children||m.jsxs(m.Fragment,{children:[m.jsx(uZe,{}),m.jsx(bZe,{dragHandleMenu:e.dragHandleMenu})]})})},vZe=e=>{const t=Fn(va,{selector:s=>s!==void 0?{show:s.show,block:s.block}:void 0}),{show:n,block:r}=t||{},i=v.useMemo(()=>({useFloatingOptions:{open:n,placement:"left-start"},useDismissProps:{enabled:!1},elementProps:{style:{zIndex:20}},...e.floatingUIOptions}),[e.floatingUIOptions,n]),o=e.sideMenu||yZe;return m.jsx(Use,{blockId:n?r?.id:void 0,...i,children:r?.id&&m.jsx(o,{})})};async function xZe(e,t){return(await uGe(e,t)).map(({id:n,onItemClick:r})=>({id:n,onItemClick:r,icon:n}))}function EZe(e){const t=at(),n=Rt(),{items:r,loadingState:i,selectedIndex:o,onItemClick:s,columns:a}=e,l=i==="loading-initial"||i==="loading"?m.jsx(t.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:a}):null,c=v.useMemo(()=>{const u=[];for(let f=0;f<r.length;f++){const h=r[f];u.push(m.jsx(t.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:h,id:`bn-grid-suggestion-menu-item-${f}`,isSelected:f===o,onClick:()=>s?.(h)},h.id))}return u},[t,r,s,o]);return m.jsxs(t.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:a,className:"bn-grid-suggestion-menu",children:[l,c,c.length===0&&e.loadingState==="loaded"&&m.jsx(t.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:a,children:n.suggestion_menu.no_items_title})]})}function sae(e,t,n,r=3){const i=v.useRef(0);v.useEffect(()=>{t!==void 0&&(e.length>0?i.current=t.length:t.length-i.current>r&&n())},[n,r,e.length,t])}function aae(e,t){const[n,r]=v.useState([]),[i,o]=v.useState(!1),s=v.useRef(void 0),a=v.useRef(void 0);return v.useEffect(()=>{const l=e;s.current=e,o(!0),t(e).then(c=>{s.current===l&&(r(c),o(!1),a.current=l)})},[e,t]),{items:n||[],usedQuery:a.current,loadingState:a.current===void 0?"loading-initial":i?"loading":"loaded"}}function SZe(e,t,n,r,i){const[o,s]=v.useState(0),a=r!==void 0&&r>1;return v.useEffect(()=>{var l;const c=u=>(u.key==="ArrowLeft"&&(u.preventDefault(),n.length&&s((o-1+n.length)%n.length)),u.key==="ArrowRight"&&(u.preventDefault(),n.length&&s((o+1+n.length)%n.length)),u.key==="ArrowUp"?(u.preventDefault(),n.length&&s((o-r+n.length)%n.length),!0):u.key==="ArrowDown"?(u.preventDefault(),n.length&&s((o+r)%n.length),!0):u.key==="Enter"&&!u.isComposing?(u.stopPropagation(),u.preventDefault(),n.length&&i?.(n[o]),!0):!1);return(l=e.domElement)==null||l.addEventListener("keydown",c,!0),()=>{var u;(u=e.domElement)==null||u.removeEventListener("keydown",c,!0)}},[e.domElement,n,o,i,r,a]),v.useEffect(()=>{s(0)},[t]),{selectedIndex:n.length===0?void 0:o}}function wZe(e){const t=hl().setContentEditableProps,n=mt(),{getItems:r,gridSuggestionMenuComponent:i,query:o,clearQuery:s,closeMenu:a,onItemClick:l,columns:c}=e,u=v.useCallback(E=>{a(),s(),l?.(E)},[l,a,s]),{items:f,usedQuery:h,loadingState:g}=aae(o,r);sae(f,h,a);const{selectedIndex:y}=SZe(n,o,f,c,u);return v.useEffect(()=>(t(E=>({...E,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(E=>({...E,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),v.useEffect(()=>(t(E=>({...E,"aria-activedescendant":y?"bn-suggestion-menu-item-"+y:void 0})),()=>{t(E=>({...E,"aria-activedescendant":void 0}))}),[t,y]),m.jsx(i,{items:f,onItemClick:u,loadingState:g,selectedIndex:y,columns:c})}function CZe(e){const t=mt(),{triggerCharacter:n,gridSuggestionMenuComponent:r,columns:i,minQueryLength:o,onItemClick:s,getItems:a}=e,l=v.useMemo(()=>s||(y=>{y.onItemClick(t)}),[t,s]),c=v.useMemo(()=>a||(async y=>await xZe(t,y)),[t,a]),u=sn(js);v.useEffect(()=>{u.addTriggerCharacter(n)},[u,n]);const f=Fn(js),h=Fn(js,{selector:y=>{var E;return{element:((E=t.domElement)==null?void 0:E.firstChild)||void 0,getBoundingClientRect:()=>y?.referencePos||new DOMRect}}}),g=v.useMemo(()=>({useFloatingOptions:{open:f?.show&&f?.triggerCharacter===n,onOpenChange:y=>{y||u.closeMenu()},placement:"bottom-start",middleware:[ha(10),nse({allowedPlacements:["bottom-start","top-start"],padding:10}),Nm(),_0({apply({elements:y,availableHeight:E}){y.floating.style.maxHeight=`${Math.max(0,E)}px`},padding:10})]},elementProps:{onMouseDownCapture:y=>y.preventDefault(),style:{zIndex:70}},...e.floatingUIOptions}),[e.floatingUIOptions,f?.show,f?.triggerCharacter,u,n]);return!f||!f.ignoreQueryLength&&o&&(f.query.startsWith(" ")||f.query.length<o)?null:m.jsx(Va,{reference:h,...g,children:n&&m.jsx(wZe,{query:f.query,closeMenu:u.closeMenu,clearQuery:u.clearQuery,getItems:c,columns:i,gridSuggestionMenuComponent:r||EZe,onItemClick:l})})}function TZe(e){const t=at(),n=Rt(),{items:r,loadingState:i,selectedIndex:o,onItemClick:s}=e,a=i==="loading-initial"||i==="loading"?m.jsx(t.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,l=v.useMemo(()=>{let c;const u=[];for(let f=0;f<r.length;f++){const h=r[f];h.group!==c&&(c=h.group,u.push(m.jsx(t.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:c},c))),u.push(m.jsx(t.SuggestionMenu.Item,{className:Fr("bn-suggestion-menu-item",h.size==="small"?"bn-suggestion-menu-item-small":""),item:h,id:`bn-suggestion-menu-item-${f}`,isSelected:f===o,onClick:()=>s?.(h)},h.title))}return u},[t,r,s,o]);return m.jsxs(t.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[l,l.length===0&&(e.loadingState==="loading"||e.loadingState==="loaded")&&m.jsx(t.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:n.suggestion_menu.no_items_title}),a]})}function kZe(e,t){const[n,r]=v.useState(0);return{selectedIndex:n,setSelectedIndex:r,handler:i=>{if(i.key==="ArrowUp")return i.preventDefault(),e.length&&r((n-1+e.length)%e.length),!0;if(i.key==="ArrowDown")return i.preventDefault(),e.length&&r((n+1)%e.length),!0;const o=AZe(i)?i.nativeEvent.isComposing:i.isComposing;return i.key==="Enter"&&!o?(i.preventDefault(),i.stopPropagation(),e.length&&t?.(e[n]),!0):!1}}}function AZe(e){return e.nativeEvent!==void 0}function NZe(e,t,n,r,i){const{selectedIndex:o,setSelectedIndex:s,handler:a}=kZe(n,r);return v.useEffect(()=>{var l;return(l=e.domElement)==null||l.addEventListener("keydown",a,!0),()=>{var c;(c=e.domElement)==null||c.removeEventListener("keydown",a,!0)}},[e.domElement,n,o,r,i,a]),v.useEffect(()=>{s(0)},[t,s]),{selectedIndex:n.length===0?void 0:o}}function _Ze(e){const t=hl().setContentEditableProps,n=mt(),{getItems:r,suggestionMenuComponent:i,query:o,clearQuery:s,closeMenu:a,onItemClick:l}=e,c=v.useCallback(y=>{a(),s(),l?.(y)},[l,a,s]),{items:u,usedQuery:f,loadingState:h}=aae(o,r);sae(u,f,a);const{selectedIndex:g}=NZe(n,o,u,c);return v.useEffect(()=>(t(y=>({...y,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{t(y=>({...y,"aria-expanded":!1,"aria-controls":void 0}))}),[t]),v.useEffect(()=>(t(y=>({...y,"aria-activedescendant":g?"bn-suggestion-menu-item-"+g:void 0})),()=>{t(y=>({...y,"aria-activedescendant":void 0}))}),[t,g]),m.jsx(i,{items:u,onItemClick:c,loadingState:h,selectedIndex:g})}const RZe={heading:QS,heading_2:JS,heading_3:ew,heading_4:qse,heading_5:Wse,heading_6:Yse,toggle_heading:QS,toggle_heading_2:JS,toggle_heading_3:ew,quote:Jse,toggle_list:eae,numbered_list:Zse,bullet_list:Qse,check_list:Xse,paragraph:YP,table:xXe,image:wXe,video:SXe,audio:kXe,file:sXe,emoji:LXe,code_block:fXe,divider:MXe};function DZe(e){return XHe(e).map(t=>{const n=RZe[t.key];return{...t,icon:m.jsx(n,{size:18})}})}function lae(e){const t=mt(),{triggerCharacter:n,suggestionMenuComponent:r,minQueryLength:i,onItemClick:o,getItems:s}=e,a=v.useMemo(()=>o||(g=>{g.onItemClick(t)}),[t,o]),l=v.useMemo(()=>s||(async g=>ZHe(DZe(t),g)),[t,s]),c=sn(js);v.useEffect(()=>{c.addTriggerCharacter(n)},[c,n]);const u=Fn(js),f=Fn(js,{selector:g=>{var y;return{element:((y=t.domElement)==null?void 0:y.firstChild)||void 0,getBoundingClientRect:()=>g?.referencePos||new DOMRect}}}),h=v.useMemo(()=>({useFloatingOptions:{open:u?.show&&u?.triggerCharacter===n,onOpenChange:g=>{g||c.closeMenu()},placement:"bottom-start",middleware:[ha(10),nse({allowedPlacements:["bottom-start","top-start"],padding:10}),Nm(),_0({apply({elements:g,availableHeight:y}){g.floating.style.maxHeight=`${Math.max(0,y)}px`},padding:10})]},elementProps:{onMouseDownCapture:g=>g.preventDefault(),style:{zIndex:80}},...e.floatingUIOptions}),[e.floatingUIOptions,u?.show,u?.triggerCharacter,c,n]);return!u||!u.ignoreQueryLength&&i&&(u.query.startsWith(" ")||u.query.length<i)?null:m.jsx(Va,{reference:f,...h,children:n&&m.jsx(_Ze,{query:u.query,closeMenu:c.closeMenu,clearQuery:c.clearQuery,getItems:l,suggestionMenuComponent:r||TZe,onItemClick:a})})}const IZe=(e,t=.3)=>{const n=Math.floor(e)+t,r=Math.ceil(e)-t;return e>=n&&e<=r?Math.round(e):e<n?Math.floor(e):Math.ceil(e)},OZe=e=>{const t=at(),n=mt(),r=sn(zn),i=Fn(zn,{selector:u=>u?.block}),o=v.useRef(!1),[s,a]=v.useState(),l=v.useCallback(u=>{r.freezeHandles(),e.hideOtherElements(!0),i&&(a({originalContent:i.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(i,e.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:e.orientation==="addOrRemoveColumns"?u.clientX:u.clientY}),o.current=!1,u.preventDefault())},[i,e,r]),c=v.useCallback(()=>{!i||o.current||n.updateBlock(i,{type:"table",content:{...i.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(i,"columns",1):r.addRowsOrColumns(i,"rows",1)}})},[i,n,e.orientation,r]);return v.useEffect(()=>{const u=f=>{var h,g;if(!i)return;if(!s)throw new Error("editingState is undefined");o.current=!0;const y=(e.orientation==="addOrRemoveColumns"?f.clientX:f.clientY)-s.startPos,E=e.orientation==="addOrRemoveColumns"?((h=s.originalCroppedContent.rows[0])==null?void 0:h.cells.length)??0:s.originalCroppedContent.rows.length,S=e.orientation==="addOrRemoveColumns"?((g=s.originalContent.rows[0])==null?void 0:g.cells.length)??0:s.originalContent.rows.length,w=e.orientation==="addOrRemoveColumns"?i.content.rows[0].cells.length:i.content.rows.length,T=S+IZe(y/(e.orientation==="addOrRemoveColumns"?xP:IHe),.3);T>=E&&T>0&&T!==w&&(n.updateBlock(i,{type:"table",content:{...i.content,rows:e.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"columns",T-E):r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"rows",T-E)}}),i.content&&n.setTextCursorPosition(i))};return s&&window.addEventListener("mousemove",u),()=>{window.removeEventListener("mousemove",u)}},[i,s,n,e.orientation,r]),v.useEffect(()=>{const u=()=>{e.hideOtherElements(!1),r.unfreezeHandles(),a(void 0)};return s&&window.addEventListener("mouseup",u),()=>{window.removeEventListener("mouseup",u)}},[s,e,r]),n.isEditable?m.jsx(t.TableHandle.ExtendButton,{className:Fr("bn-extend-button",e.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",s!==null?"bn-extend-button-editing":""),onClick:c,onMouseDown:l,children:e.children||m.jsx(AXe,{size:18,"data-test":"extendButton"})}):null},Xq=e=>{const t=at(),n=Rt(),r=sn(zn),i=Fn(zn,{selector:o=>e.orientation==="column"?o?.colIndex:o?.rowIndex});return r===void 0||i===void 0?null:m.jsx(t.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(i,e.orientation==="row"?{orientation:"row",side:e.side}:{orientation:"column",side:e.side})},children:n.table_handle[`add_${e.side}_menuitem`]})},MZe=e=>{const t=at(),n=Rt(),r=sn(zn),i=Fn(zn,{selector:o=>e.orientation==="column"?o?.colIndex:o?.rowIndex});return r===void 0||i===void 0?null:m.jsx(t.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(i,e.orientation),children:e.orientation==="row"?n.table_handle.delete_row_menuitem:n.table_handle.delete_column_menuitem})},LZe=e=>{const t=at(),n=Rt(),r=mt(),i=sn(zn),{block:o,index:s}=Fn(zn,{selector:u=>({block:u?.block,index:e.orientation==="column"?u?.colIndex:u?.rowIndex})}),a=v.useMemo(()=>i===void 0||o===void 0||s===void 0?[]:e.orientation==="row"?i.getCellsAtRowHandle(o,s):i.getCellsAtColumnHandle(o,s),[o,s,e.orientation,i]),l=(u,f)=>{if(o===void 0)return;const h=o.content.rows.map(g=>({...g,cells:g.cells.map(y=>Ru(y))}));a.forEach(({row:g,col:y})=>{f==="text"?h[g].cells[y].props.textColor=u:h[g].cells[y].props.backgroundColor=u}),r.updateBlock(o,{type:"table",content:{...o.content,rows:h}}),r.setTextCursorPosition(o)};if(!a||!a[0]||!i||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;const c=Ru(a[0].cell);return m.jsxs(t.Generic.Menu.Root,{position:"right",sub:!0,children:[m.jsx(t.Generic.Menu.Trigger,{sub:!0,children:m.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||n.drag_handle.colors_menuitem})}),m.jsx(t.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:m.jsx(lT,{iconSize:18,text:r.settings.tables.cellTextColor?{color:a.every(({cell:u})=>Du(u)&&u.props.textColor===c.props.textColor)?c.props.textColor:"default",setColor:u=>{l(u,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:a.every(({cell:u})=>Du(u)&&u.props.backgroundColor===c.props.backgroundColor)?c.props.backgroundColor:"default",setColor:u=>l(u,"background")}:void 0})})]})},PZe=e=>{const t=at(),n=Rt(),r=mt(),i=sn(zn),{block:o,index:s}=Fn(zn,{selector:l=>({block:l?.block,index:e.orientation==="column"?l?.colIndex:l?.rowIndex})});if(i===void 0||o===void 0||s!==0||e.orientation!=="row"||!r.settings.tables.headers)return null;const a=!!o.content.headerRows;return m.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(o,{...o,content:{...o.content,headerRows:a?void 0:1}})},children:n.drag_handle.header_row_menuitem})},FZe=e=>{const t=at(),n=Rt(),r=mt(),i=sn(zn),o=Fn(zn,{selector:l=>l?.block}),s=Fn(zn,{selector:l=>e.orientation==="column"?l?.colIndex:l?.rowIndex});if(!i||s!==0||!o||e.orientation!=="column"||!r.settings.tables.headers)return null;const a=!!o.content.headerCols;return m.jsx(t.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(o,{...o,content:{...o.content,headerCols:a?void 0:1}})},children:n.drag_handle.header_column_menuitem})},BZe=e=>{const t=at();return m.jsx(t.Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:e.children||m.jsxs(m.Fragment,{children:[m.jsx(MZe,{orientation:e.orientation}),m.jsx(Xq,{orientation:e.orientation,side:e.orientation==="row"?"above":"left"}),m.jsx(Xq,{orientation:e.orientation,side:e.orientation==="row"?"below":"right"}),m.jsx(PZe,{orientation:e.orientation}),m.jsx(FZe,{orientation:e.orientation}),m.jsx(LZe,{orientation:e.orientation})]})})},jZe=e=>{const t=mt(),n=at(),[r,i]=v.useState(!1),o=e.tableHandleMenu||BZe,s=sn(zn),a=Fn(zn),l=v.useMemo(()=>!s||!a||!a.block||a.block.type!=="table"?!1:e.orientation==="column"?s.getCellsAtColumnHandle(a.block,a.colIndex).every(({cell:c})=>lf(c)===1):s.getCellsAtRowHandle(a.block,a.rowIndex).every(({cell:c})=>T0(c)===1),[e.orientation,a,s]);return a?m.jsxs(n.Generic.Menu.Root,{onOpenChange:c=>{c?(s.freezeHandles(),e.hideOtherElements(!0)):(s.unfreezeHandles(),e.hideOtherElements(!1),t.focus())},position:"right",children:[m.jsx(n.Generic.Menu.Trigger,{children:m.jsx(n.TableHandle.Root,{className:Fr("bn-table-handle",r?"bn-table-handle-dragging":"",l?"":"bn-table-handle-not-draggable"),draggable:l,onDragStart:c=>{i(!0),e.hideOtherElements(!0),e.orientation==="column"?s.colDragStart(c):s.rowDragStart(c)},onDragEnd:()=>{s.dragEnd(),e.hideOtherElements(!1),i(!1)},style:e.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:e.children||m.jsx(oae,{size:24,"data-test":"tableHandle"})})}),m.jsx(o,{orientation:e.orientation})]}):null},$Ze=e=>{var t,n;const r=at(),i=Rt(),o=mt(),{block:s,colIndex:a,rowIndex:l}=Fn(zn,{selector:f=>({block:f?.block,colIndex:f?.colIndex,rowIndex:f?.rowIndex})}),c=(f,h)=>{if(s===void 0||a===void 0||l===void 0)return;const g=s.content.rows.map(y=>({...y,cells:y.cells.map(E=>Ru(E))}));h==="text"?g[l].cells[a].props.textColor=f:g[l].cells[a].props.backgroundColor=f,o.updateBlock(s,{type:"table",content:{...s.content,rows:g}}),o.setTextCursorPosition(s)};if(s===void 0||a===void 0||l===void 0)return null;const u=(n=(t=s.content.rows[l])==null?void 0:t.cells)==null?void 0:n[a];return!u||o.settings.tables.cellTextColor===!1&&o.settings.tables.cellBackgroundColor===!1?null:m.jsxs(r.Generic.Menu.Root,{position:"right",sub:!0,children:[m.jsx(r.Generic.Menu.Trigger,{sub:!0,children:m.jsx(r.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:e.children||i.drag_handle.colors_menuitem})}),m.jsx(r.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:m.jsx(lT,{iconSize:18,text:o.settings.tables.cellTextColor?{color:Du(u)?u.props.textColor:"default",setColor:f=>c(f,"text")}:void 0,background:o.settings.tables.cellBackgroundColor?{color:Du(u)?u.props.backgroundColor:"default",setColor:f=>c(f,"background")}:void 0})})]})},UZe=()=>{var e,t;const n=at(),r=Rt(),i=mt(),o=sn(zn),{block:s,colIndex:a,rowIndex:l}=Fn(zn,{selector:u=>({block:u?.block,colIndex:u?.colIndex,rowIndex:u?.rowIndex})});if(s===void 0||a===void 0||l===void 0)return null;const c=(t=(e=s.content.rows[l])==null?void 0:e.cells)==null?void 0:t[a];return!c||!Du(c)||T0(c)===1&&lf(c)===1||!i.settings.tables.splitCells?null:m.jsx(n.Generic.Menu.Item,{onClick:()=>{o.splitCell({row:l,col:a})},children:r.table_handle.split_cell_menuitem})},HZe=e=>{const t=at();return m.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:e.children||m.jsxs(m.Fragment,{children:[m.jsx(UZe,{}),m.jsx($Ze,{})]})})},zZe=e=>{const t=at(),n=mt(),r=sn(zn),i=e.tableCellMenu||HZe;return!n.settings.tables.splitCells&&!n.settings.tables.cellBackgroundColor&&!n.settings.tables.cellTextColor?null:m.jsxs(t.Generic.Menu.Root,{onOpenChange:o=>{o?(r.freezeHandles(),e.hideOtherElements(!0)):(r.unfreezeHandles(),e.hideOtherElements(!1),n.focus())},position:"right",children:[m.jsx(t.Generic.Menu.Trigger,{children:m.jsx(t.Generic.Menu.Button,{className:"bn-table-cell-handle",children:e.children||m.jsx(dZe,{size:12,"data-test":"tableCellHandle"})})}),m.jsx(i,{})]})},VZe=e=>{const t=mt(),[n,r]=v.useState(),i=Fn(zn),o=v.useMemo(()=>{const u={};if(i===void 0)return{};const f=no(i.block.id,t.prosemirrorState.doc);if(!f)return{};const h=f.posBeforeNode+1,g=t.prosemirrorView.domAtPos(h+1).node;if(!(g instanceof Element))return{};if(u.tableReference={element:g},i.rowIndex===void 0||i.colIndex===void 0)return u;const y=t.prosemirrorState.doc.resolve(h+1).posAtIndex(i.rowIndex),E=t.prosemirrorState.doc.resolve(y+1).posAtIndex(i.colIndex),S=t.prosemirrorView.domAtPos(E+1).node;return S instanceof Element?(u.cellReference={element:S},u.rowReference={element:g,getBoundingClientRect:()=>{const w=g.getBoundingClientRect(),T=S.getBoundingClientRect();return new DOMRect(w.x,i.draggingState&&i.draggingState.draggedCellOrientation==="row"?i.draggingState.mousePos-T.height/2:T.y,w.width,T.height)}},u.columnReference={element:g,getBoundingClientRect:()=>{const w=g.getBoundingClientRect(),T=S.getBoundingClientRect();return new DOMRect(i.draggingState&&i.draggingState.draggedCellOrientation==="col"?i.draggingState.mousePos-T.width/2:T.x,w.y,T.width,w.height)}},u):{}},[t,i]),s=v.useMemo(()=>i!==void 0?{rowTableHandle:{useFloatingOptions:{open:i.show&&i.rowIndex!==void 0&&(!n||n==="rowTableHandle"),placement:"left",middleware:[ha(-10)]},elementProps:{style:{zIndex:10}}},columnTableHandle:{useFloatingOptions:{open:i.show&&i.colIndex!==void 0&&(!n||n==="columnTableHandle"),placement:"top",middleware:[ha(-12)]},elementProps:{style:{zIndex:10}}},tableCellHandle:{useFloatingOptions:{open:i.show&&i.rowIndex!==void 0&&i.colIndex!==void 0&&(!n||n==="tableCellHandle"),placement:"top-end",middleware:[ha({mainAxis:-15,crossAxis:-1})]},elementProps:{style:{zIndex:10}}},extendRowsButton:{useFloatingOptions:{open:i.show&&i.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton"),placement:"bottom",middleware:[_0({apply({rects:u,elements:f}){Object.assign(f.floating.style,{width:`${u.reference.width}px`})}})]},elementProps:{style:{zIndex:10}}},extendColumnsButton:{useFloatingOptions:{open:i.show&&i.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton"),placement:"right",middleware:[_0({apply({rects:u,elements:f}){Object.assign(f.floating.style,{height:`${u.reference.height}px`})}})]},elementProps:{style:{zIndex:10}}}}:void 0,[n,i]);if(!i)return null;const a=e.tableHandle||jZe,l=e.extendButton||OZe,c=e.tableCellHandle||zZe;return m.jsxs(m.Fragment,{children:[m.jsx(Va,{reference:o?.rowReference,...s?.rowTableHandle,children:i.show&&i.rowIndex!==void 0&&(!n||n==="rowTableHandle")&&m.jsx(a,{orientation:"row",hideOtherElements:u=>r(u?"rowTableHandle":void 0)})}),m.jsx(Va,{reference:o?.columnReference,...s?.columnTableHandle,children:i.show&&i.colIndex!==void 0&&(!n||n==="columnTableHandle")&&m.jsx(a,{orientation:"column",hideOtherElements:u=>r(u?"columnTableHandle":void 0)})}),m.jsx(Va,{reference:o?.cellReference,...s?.tableCellHandle,children:i.show&&i.rowIndex!==void 0&&i.colIndex!==void 0&&(!n||n==="tableCellHandle")&&m.jsx(c,{hideOtherElements:u=>r(u?"tableCellHandle":void 0)})}),m.jsx(Va,{reference:o?.tableReference,...s?.extendRowsButton,children:i.show&&i.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton")&&m.jsx(l,{orientation:"addOrRemoveRows",hideOtherElements:u=>r(u?"extendRowsButton":void 0)})}),m.jsx(Va,{reference:o?.tableReference,...s?.extendColumnsButton,children:i.show&&i.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton")&&m.jsx(l,{orientation:"addOrRemoveColumns",hideOtherElements:u=>r(u?"extendColumnsButton":void 0)})})]})},GZe=v.lazy(()=>Promise.resolve().then(()=>mQe)),qZe=v.lazy(()=>Promise.resolve().then(()=>yQe));function WZe(e){const t=mt();if(!t)throw new Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return m.jsxs(m.Fragment,{children:[t.getExtension(Mu)&&e.formattingToolbar!==!1&&m.jsx(iae,{}),t.getExtension(Py)&&e.linkToolbar!==!1&&m.jsx(lZe,{}),t.getExtension(js)&&e.slashMenu!==!1&&m.jsx(lae,{triggerCharacter:"/"}),t.getExtension(js)&&e.emojiPicker!==!1&&m.jsx(CZe,{triggerCharacter:":",columns:10,minQueryLength:2}),t.getExtension(va)&&e.sideMenu!==!1&&m.jsx(vZe,{}),t.getExtension(ca)&&e.filePanel!==!1&&m.jsx($Ke,{}),t.getExtension(zn)&&e.tableHandles!==!1&&m.jsx(VZe,{}),t.getExtension(zs)&&e.comments!==!1&&m.jsxs(v.Suspense,{children:[m.jsx(GZe,{}),m.jsx(qZe,{})]})]})}function YZe(e,t){const n=hl();t||(t=n?.editor),v.useEffect(()=>{if(!t)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onChange(e)},[e,t])}function KZe(e,t,n){const r=hl();t||(t=r?.editor),v.useEffect(()=>{if(!t)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return t.onSelectionChange(e,n)},[e,t,n])}const XZe=()=>{const e=v.useMemo(()=>{var s;return(s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: dark)")},[]),t=v.useMemo(()=>{var s;return(s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: light)")},[]),n=e?.matches,r=t?.matches,[i,o]=v.useState(n?"dark":r?"light":"no-preference");return v.useEffect(()=>{o(n?"dark":r?"light":"no-preference")},[n,r]),v.useEffect(()=>{if(typeof e?.addEventListener=="function"){const s=({matches:l})=>l&&o("dark"),a=({matches:l})=>l&&o("light");return e?.addEventListener("change",s),t?.addEventListener("change",a),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",a)}}else{const s=()=>o(e.matches?"dark":t.matches?"light":"no-preference");return e?.addEventListener("change",s),t?.addEventListener("change",s),()=>{e?.removeEventListener("change",s),t?.removeEventListener("change",s)}}},[e,t]),i},cae=v.createContext(void 0);function ZZe(){return v.useContext(cae)}function QZe(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Wr.createPortal(r.reactElement,r.element,n)},e.forEach(i=>i())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(i=>i())}}}const JZe=({contentComponent:e})=>{const t=v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return m.jsx(m.Fragment,{children:Object.values(t)})},eQe=v.forwardRef((e,t)=>{const[n,r]=v.useState();return v.useImperativeHandle(t,()=>(i,o)=>{Wr.flushSync(()=>{r({node:i,container:o})}),r(void 0)},[]),m.jsx(m.Fragment,{children:n&&Wr.createPortal(n.node,n.container)})}),Zq=()=>{};function tQe(e,t){const{editor:n,className:r,theme:i,children:o,editable:s,onSelectionChange:a,onChange:l,formattingToolbar:c,linkToolbar:u,slashMenu:f,emojiPicker:h,sideMenu:g,filePanel:y,tableHandles:E,comments:S,autoFocus:w,renderEditor:T=!0,...A}=e,[R,_]=v.useState(),D=hl(),I=XZe(),M=D?.colorSchemePreference||I,j=i||(M==="dark"?"dark":"light");YZe(l||Zq,n),KZe(a||Zq,n),v.useEffect(()=>{n.isEditable=s!==!1},[s,n]);const L=v.useCallback(Y=>{n.elementRenderer=Y},[n]),F=v.useMemo(()=>({...D,editor:n,setContentEditableProps:_,colorSchemePreference:j}),[D,n,j]),H=v.useMemo(()=>({editorProps:{autoFocus:w,contentEditableProps:R},defaultUIProps:{formattingToolbar:c,linkToolbar:u,slashMenu:f,emojiPicker:h,sideMenu:g,filePanel:y,tableHandles:E,comments:S}}),[w,R,c,u,f,h,g,y,E,S]);return m.jsx(Bse.Provider,{value:F,children:m.jsxs(cae.Provider,{value:H,children:[m.jsx(eQe,{ref:L}),m.jsx(nQe,{className:r,renderEditor:T,editable:s,editorColorScheme:j,ref:t,...A,children:o})]})})}const nQe=pe.forwardRef(({className:e,renderEditor:t,editable:n,editorColorScheme:r,children:i,...o},s)=>m.jsx("div",{className:Fr("bn-container",r,e),"data-color-scheme":r,...o,ref:s,children:t?m.jsx(iQe,{editable:n,children:i}):i})),rQe=pe.forwardRef(tQe),iQe=e=>{const t=ZZe(),n=mt(),r=v.useMemo(()=>QZe(),[]),i=v.useCallback(o=>{e.editable!==void 0&&e.editable!==n.isEditable&&(n.isEditable=e.editable),n._tiptapEditor.contentComponent=r,o?n.mount(o):n.unmount()},[n,r,e.editable]);return m.jsxs(m.Fragment,{children:[m.jsx(JZe,{contentComponent:r}),m.jsx(oQe,{...t.editorProps,...e,mount:i}),m.jsx(WZe,{...t.defaultUIProps}),e.children]})},oQe=e=>{const{autoFocus:t,mount:n,contentEditableProps:r}=e;return m.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":t,ref:n,...r})};function h_(e,t){let n;const r=document.createElement("div");let i;if(t!=null&&t.elementRenderer)t.elementRenderer(e(l=>n=l||void 0),r);else{if(!(t!=null&&t.headless))throw new Error("elementRenderer not available, expected headless editor");i=zY.createRoot(r),Wr.flushSync(()=>{i.render(e(l=>n=l||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};n?.setAttribute("data-tmp-find","true");const o=r.cloneNode(!0),s=o.firstElementChild,a=o.querySelector("[data-tmp-find]");return a?.removeAttribute("data-tmp-find"),i?.unmount(),{dom:s,contentDOM:a||void 0}}const By=(e={},t=[])=>v.useMemo(()=>{const n=mKe.create(e);return window&&(window.ProseMirror=n._tiptapEditor),n},t),KP=e=>{const[t,n]=v.useState(!1),r=li({editor:e.editor,selector:({editor:a})=>a.isEmpty}),i=at(),o=v.useCallback(()=>{n(!0)},[]),s=v.useCallback(()=>{n(!1)},[]);return v.useEffect(()=>{e.editable&&e.autoFocus&&e.editor.focus()},[e.autoFocus,e.editable,e.editor]),m.jsxs(m.Fragment,{children:[m.jsx(i.Comments.Editor,{autoFocus:e.autoFocus,className:"bn-comment-editor",editor:e.editor,onFocus:o,onBlur:s,editable:e.editable}),e.actions&&m.jsx("div",{className:"bn-comment-actions-wrapper",children:m.jsx(e.actions,{isFocused:t,isEmpty:r})})]})};let m_;async function sQe(){return m_||(m_=(async()=>{const[e,t]=await Promise.all([jE(()=>import("./module-RjUF93sV.js"),[]),jE(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in e?e.default:e,r="default"in t?t.default:t;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),m_)}function aQe(e){const t=v.useRef(null),n=v.useRef(null);return n.current&&n.current.update(e),v.useEffect(()=>((async()=>{const{emojiMart:r}=await sQe();n.current=new r.Picker({...e,ref:t})})(),()=>{n.current=null}),[]),pe.createElement("div",{ref:t})}const Qq=e=>{const[t,n]=v.useState(!1),r=at(),i=mt(),o=hl();return m.jsxs(r.Generic.Popover.Root,{open:t,children:[m.jsx(r.Generic.Popover.Trigger,{children:m.jsx("div",{onClick:s=>{var a;s.preventDefault(),s.stopPropagation(),n(!t),(a=e.onOpenChange)==null||a.call(e,!t)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.children})}),Wr.createPortal(m.jsx(r.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:m.jsx(aQe,{perLine:7,onClickOutside:()=>{var s;n(!1),(s=e.onOpenChange)==null||s.call(e,!1)},onEmojiSelect:s=>{var a;e.onEmojiSelect(s),n(!1),(a=e.onOpenChange)==null||a.call(e,!1)},theme:o?.colorSchemePreference})}),i.domElement.parentElement)]})};function lQe(e){return XP([e]).get(e)}function XP(e){const t=sn(zs).userStore,n=v.useCallback(()=>{const o=new Map;for(const s of e){const a=t.getUser(s);a&&o.set(s,a)}return o},[t,e]),r=v.useMemo(()=>({current:n()}),[n]),i=v.useCallback(o=>{const s=t.subscribe(a=>{r.current=n(),o()});return t.loadUsers(e),s},[t,n,e,r]);return v.useSyncExternalStore(i,()=>r.current)}const cQe=e=>{const t=at(),n=Rt(),r=sn(zs),i=e.comment.reactions.find(l=>l.emoji===e.emoji);if(!i)throw new Error("Trying to render reaction badge for non-existing reaction");const[o,s]=v.useState([]),a=XP(o);return m.jsx(t.Generic.Badge.Root,{className:Fr("bn-badge","bn-comment-reaction"),text:i.userIds.length.toString(),icon:i.emoji,isSelected:r.threadStore.auth.canDeleteReaction(e.comment,i.emoji),onClick:()=>e.onReactionSelect(i.emoji),onMouseEnter:()=>s(i.userIds),mainTooltip:n.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(a.values()).map(l=>l.username).join(`
292
- `)}`},i.emoji)},{textColor:Jpt,backgroundColor:eht,...uQe}=EP,ZP=LP.create({blockSpecs:{paragraph:noe()},styleSpecs:uQe}),dQe=({comment:e,thread:t,showResolveButton:n})=>{const r=sn(zs),i=Rt(),o=By({initialContent:e.body,trailingBlock:!1,dictionary:{...i,placeholders:{emptyDocument:i.placeholders.edit_comment}},schema:r.commentEditorSchema||ZP}),s=at(),[a,l]=v.useState(!1),[c,u]=v.useState(!1),f=r.threadStore,h=v.useCallback(()=>{l(!0)},[]),g=v.useCallback(()=>{o.replaceBlocks(o.document,e.body),l(!1)},[o,e.body]),y=v.useCallback(async L=>{await f.updateComment({commentId:e.id,comment:{body:o.document},threadId:t.id}),l(!1)},[e,t.id,o,f]),E=v.useCallback(async()=>{await f.deleteComment({commentId:e.id,threadId:t.id})},[e,t.id,f]),S=v.useCallback(async L=>{f.auth.canAddReaction(e,L)?await f.addReaction({threadId:t.id,commentId:e.id,emoji:L}):f.auth.canDeleteReaction(e,L)&&await f.deleteReaction({threadId:t.id,commentId:e.id,emoji:L})},[f,e,t.id]),w=v.useCallback(async()=>{await f.resolveThread({threadId:t.id})},[t.id,f]),T=v.useCallback(async()=>{await f.unresolveThread({threadId:t.id})},[t.id,f]),A=lQe(e.userId);if(!e.body)return null;let R;const _=f.auth.canAddReaction(e),D=f.auth.canDeleteComment(e),I=f.auth.canUpdateComment(e),M=n&&(t.resolved?f.auth.canUnresolveThread(t):f.auth.canResolveThread(t));a||(R=m.jsxs(s.Generic.Toolbar.Root,{className:Fr("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[_&&m.jsx(Qq,{onEmojiSelect:L=>S(L.native),onOpenChange:u,children:m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.actions.add_reaction,variant:"compact",children:m.jsx(Wq,{size:16})},"add-reaction")}),M&&(t.resolved?m.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:T,children:m.jsx(rXe,{size:16})},"reopen"):m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.actions.resolve,variant:"compact",onClick:w,children:m.jsx(NXe,{size:16})},"resolve")),(D||I)&&m.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[m.jsx(s.Generic.Menu.Trigger,{children:m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.actions.more_actions,variant:"compact",children:m.jsx(OXe,{size:16})},"more-actions")}),m.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[I&&m.jsx(s.Generic.Menu.Item,{icon:m.jsx(iXe,{}),onClick:h,children:i.comments.actions.edit_comment},"edit-comment"),D&&m.jsx(s.Generic.Menu.Item,{icon:m.jsx(RXe,{}),onClick:E,children:i.comments.actions.delete_comment},"delete-comment")]})]})]}));const j=e.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!e.body)throw new Error("soft deletes are not yet supported");return m.jsx(s.Comments.Comment,{authorInfo:A??"loading",timeString:j,edited:e.updatedAt.getTime()!==e.createdAt.getTime(),showActions:"hover",actions:R,className:"bn-thread-comment",emojiPickerOpen:c,children:m.jsx(KP,{autoFocus:a,editor:o,editable:a,actions:e.reactions.length>0||a?({isEmpty:L})=>m.jsxs(m.Fragment,{children:[e.reactions.length>0&&!a&&m.jsxs(s.Generic.Badge.Group,{className:Fr("bn-badge-group","bn-comment-reactions"),children:[e.reactions.map(F=>m.jsx(cQe,{comment:e,emoji:F.emoji,onReactionSelect:S},F.emoji)),_&&m.jsx(Qq,{onEmojiSelect:F=>S(F.native),onOpenChange:u,children:m.jsx(s.Generic.Badge.Root,{className:Fr("bn-badge","bn-comment-add-reaction"),text:"+",icon:m.jsx(Wq,{size:16}),mainTooltip:i.comments.actions.add_reaction})})]}),a&&m.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:Fr("bn-action-toolbar","bn-comment-actions"),children:[m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.save_button_text,variant:"compact",onClick:y,isDisabled:L,children:i.comments.save_button_text}),m.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:i.comments.cancel_button_text,variant:"compact",onClick:g,children:i.comments.cancel_button_text})]})]}):void 0})})},fQe=({thread:e,maxCommentsBeforeCollapse:t})=>{const n=at(),r=Rt(),i=XP(e.resolvedBy?[e.resolvedBy]:[]),o=e.comments.map((s,a)=>m.jsx(dQe,{thread:e,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(e.resolved&&e.resolvedUpdatedAt&&e.resolvedBy){if(!i.get(e.resolvedBy))throw new Error(`User ${e.resolvedBy} resolved thread ${e.id}, but their data could not be found.`);const s=e.comments.findLastIndex(a=>e.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;o.splice(s,0,m.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:e.resolvedBy&&i.get(e.resolvedBy)||"loading",timeString:e.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:m.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return t&&o.length>t&&o.splice(1,o.length-2,m.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(e.comments.length-2)},"expand-prompt")),o};function pQe(){const e=sn(zs),t=at(),n=Rt(),r=By({trailingBlock:!1,dictionary:{...n,placeholders:{emptyDocument:n.placeholders.new_comment}},schema:e.commentEditorSchema||ZP});return m.jsx(t.Comments.Card,{className:"bn-thread",children:m.jsx(KP,{autoFocus:!0,editable:!0,editor:r,actions:({isEmpty:i})=>m.jsx(t.Generic.Toolbar.Root,{className:Fr("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:m.jsx(t.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:i,onClick:async()=>{await e.createThread({initialComment:{body:r.document}}),e.stopPendingComment()},children:"Save"})})})})}function hQe(e){const t=mt(),n=sn(zs),r=Fn(zs,{editor:t,selector:a=>a.pendingComment}),i=li({editor:t,selector:({editor:a})=>r?{from:a.prosemirrorState.selection.from,to:a.prosemirrorState.selection.to}:void 0}),o=v.useMemo(()=>({useFloatingOptions:{open:!!r,onOpenChange:a=>{a||(n.stopPendingComment(),t.focus())},placement:"bottom",middleware:[ha(10),Nm(),_m()]},elementProps:{style:{zIndex:60}},...e.floatingUIOptions}),[n,t,r,e.floatingUIOptions]),s=e.floatingComposer||pQe;return m.jsx(WP,{position:i,...o,children:m.jsx(s,{})})}const mQe=Object.freeze(Object.defineProperty({__proto__:null,default:hQe},Symbol.toStringTag,{value:"Module"})),uae=({thread:e,selected:t,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:i,onBlur:o,tabIndex:s})=>{const a=at(),l=Rt(),c=sn(zs),u=By({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||ZP}),f=v.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:e.id}),u.removeBlocks(u.document)},[c,u,e.id]);return m.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:i,onBlur:o,selected:t,tabIndex:s,children:[m.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:m.jsx(fQe,{thread:e,maxCommentsBeforeCollapse:t?void 0:r||5})}),t&&m.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:m.jsx(KP,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:h})=>h?null:m.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:Fr("bn-action-toolbar","bn-comment-actions"),children:m.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:h,onClick:f,children:l.comments.save_button_text})})})})]})};function gQe(){const e=sn(zs).threadStore,t=v.useRef(void 0);t.current||(t.current=e.getThreads());const n=v.useCallback(r=>e.subscribe(i=>{t.current=i,r()}),[e]);return v.useSyncExternalStore(n,()=>t.current)}function bQe(e){const t=mt(),n=sn(zs),r=Fn(zs,{editor:t,selector:l=>l.selectedThreadId?{id:l.selectedThreadId,position:l.threadPositions.get(l.selectedThreadId)}:void 0}),i=gQe(),o=v.useMemo(()=>r?i.get(r.id):void 0,[r,i]),s=v.useMemo(()=>({useFloatingOptions:{open:!!r,onOpenChange:(l,c,u)=>{u==="escape-key"&&t.focus(),l||n.selectThread(void 0)},placement:"bottom",middleware:[ha(10),Nm(),_m()]},elementProps:{style:{zIndex:30}},...e.floatingUIOptions}),[n,t,e.floatingUIOptions,r]),a=e.floatingThread||uae;return m.jsx(WP,{position:r?.position,...s,children:o&&m.jsx(a,{thread:o,selected:!0})})}const yQe=Object.freeze(Object.defineProperty({__proto__:null,default:bQe},Symbol.toStringTag,{value:"Module"}));pe.memo(({thread:e,selectedThreadId:t,maxCommentsBeforeCollapse:n,referenceText:r})=>{const i=sn(zs),o=v.useCallback(a=>{a.target.closest(".bn-action-toolbar")||i.selectThread(e.id)},[i,e.id]),s=v.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;const l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&i.selectThread(void 0)},[i]);return m.jsx(uae,{thread:e,selected:e.id===t,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:o,onBlur:s,tabIndex:0})});function vQe(e){return e.currentTarget instanceof HTMLElement&&e.relatedTarget instanceof HTMLElement?e.currentTarget.contains(e.relatedTarget):!1}function xQe({onBlur:e,onFocus:t}={}){const n=v.useRef(null),[r,i]=v.useState(!1),o=v.useRef(!1),s=c=>{i(c),o.current=c},a=c=>{o.current||(s(!0),t?.(c))},l=c=>{o.current&&!vQe(c)&&(s(!1),e?.(c))};return v.useEffect(()=>{const c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function g_(e){return m.jsx(NKe,{as:"span",className:"bn-inline-content-section","data-inline-content-type":e.inlineContentType,...Object.fromEntries(Object.entries(e.inlineContentProps).filter(([t,n])=>{const r=e.propSchema[t];return n!==r.default}).map(([t,n])=>[N0(t),n])),children:e.children})}function dae(e,t){var n;const r=Xs.create({name:e.type,inline:!0,group:"inline",selectable:e.content==="styled",atom:e.content==="none",draggable:(n=t.meta)==null?void 0:n.draggable,content:e.content==="styled"?"inline*":"",addAttributes(){return Gie(e.propSchema)},addKeyboardShortcuts(){return MUe(e)},parseHTML(){return jWe(e,t.parse)},renderHTML({node:i}){const o=this.options.editor,s=k0(i,o.schema.inlineContentSchema,o.schema.styleSchema),a=t.toExternalHTML||t.render,l=h_(c=>m.jsx(a,{contentRef:u=>{c(u),u&&(u.dataset.editable="")},inlineContent:s,updateInlineContent:()=>{},editor:o}),o);return OUe(l,e.type,i.attrs,e.propSchema)},addNodeView(){const i=this.options.editor;return o=>MKe(s=>{const a=Fse().nodeViewContentRef;if(!a)throw new Error("nodeViewContentRef is not set");const l=t.render;return m.jsx(g_,{inlineContentProps:s.node.attrs,inlineContentType:e.type,propSchema:e.propSchema,children:m.jsx(l,{contentRef:c=>{a(c),c&&(c.dataset.editable="")},editor:i,inlineContent:k0(s.node,i.schema.inlineContentSchema,i.schema.styleSchema),updateInlineContent:c=>{const u=Vs([c],i.pmSchema),f=s.getPos();f!==void 0&&i.transact(h=>h.replaceWith(f,f+s.node.nodeSize,u))}})})},{className:"bn-ic-react-node-view-renderer",as:"span"})(o)}});return LUe(e,{...t,node:r,render(i,o,s){const a=t.render;return h_(l=>m.jsx(g_,{inlineContentProps:i.props,inlineContentType:e.type,propSchema:e.propSchema,children:m.jsx(a,{contentRef:c=>{l(c),c&&(c.dataset.editable="")},editor:s,inlineContent:i,updateInlineContent:o})}),s)},toExternalHTML(i,o){const s=t.toExternalHTML||t.render;return h_(a=>m.jsx(g_,{inlineContentProps:i.props,inlineContentType:e.type,propSchema:e.propSchema,children:m.jsx(s,{contentRef:l=>{a(l),l&&(l.dataset.editable="")},editor:o,inlineContent:i,updateInlineContent:()=>{}})}),o)}})}function fae(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.top<r.top,o=n.bottom>r.bottom;return i&&o?"both":i?"top":o?"bottom":"none"}function pae(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var jy=e=>e.type==="checkbox",Md=e=>e instanceof Date,xo=e=>e==null;const hae=e=>typeof e=="object";var Br=e=>!xo(e)&&!Array.isArray(e)&&hae(e)&&!Md(e),EQe=e=>Br(e)&&e.target?jy(e.target)?e.target.checked:e.target.value:e,SQe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,wQe=(e,t)=>e.has(SQe(t)),CQe=e=>{const t=e.constructor&&e.constructor.prototype;return Br(t)&&t.hasOwnProperty("isPrototypeOf")},QP=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qr(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(QP&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Br(e)&&CQe(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=Qr(e[i]));return r}var cT=e=>/^\w*$/.test(e),br=e=>e===void 0,JP=e=>Array.isArray(e)?e.filter(Boolean):[],eF=e=>JP(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Je=(e,t,n)=>{if(!t||!Br(e))return n;const r=(cT(t)?[t]:eF(t)).reduce((i,o)=>xo(i)?i:i[o],e);return br(r)||r===e?br(e[t])?n:e[t]:r},ja=e=>typeof e=="boolean",oa=e=>typeof e=="function",nr=(e,t,n)=>{let r=-1;const i=cT(t)?[t]:eF(t),o=i.length,s=o-1;for(;++r<o;){const a=i[r];let l=n;if(r!==s){const c=e[a];l=Br(c)||Array.isArray(c)?c:isNaN(+i[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const Jq={BLUR:"blur",FOCUS_OUT:"focusout"},sa={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},$l={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mae=pe.createContext(null);mae.displayName="HookFormContext";const TQe=e=>{const{children:t,...n}=e;return pe.createElement(mae.Provider,{value:n},t)};var kQe=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const s=o;return t._proxyFormState[s]!==sa.all&&(t._proxyFormState[s]=!r||sa.all),e[s]}});return i};const AQe=typeof window<"u"?pe.useLayoutEffect:pe.useEffect;var Wo=e=>typeof e=="string",NQe=(e,t,n,r,i)=>Wo(e)?(r&&t.watch.add(e),Je(n,e,i)):Array.isArray(e)?e.map(o=>(r&&t.watch.add(o),Je(n,o))):(r&&(t.watchAll=!0),n),aI=e=>xo(e)||!hae(e);function ru(e,t,n=new WeakSet){if(aI(e)||aI(t))return Object.is(e,t);if(Md(e)&&Md(t))return e.getTime()===t.getTime();const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of r){const s=e[o];if(!i.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Md(s)&&Md(a)||Br(s)&&Br(a)||Array.isArray(s)&&Array.isArray(a)?!ru(s,a,n):!Object.is(s,a))return!1}}return!0}var _Qe=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Mb=e=>Array.isArray(e)?e:[e],eW=()=>{let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}};function gae(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],o=t[r];if(i&&Br(i)&&o){const s=gae(i,o);Br(s)&&(n[r]=s)}else e[r]&&(n[r]=o)}return n}var Gi=e=>Br(e)&&!Object.keys(e).length,tF=e=>e.type==="file",tw=e=>{if(!QP)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},bae=e=>e.type==="select-multiple",nF=e=>e.type==="radio",RQe=e=>nF(e)||jy(e),b_=e=>tw(e)&&e.isConnected;function DQe(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=br(e)?r++:e[t[r++]];return e}function IQe(e){for(const t in e)if(e.hasOwnProperty(t)&&!br(e[t]))return!1;return!0}function Rr(e,t){const n=Array.isArray(t)?t:cT(t)?[t]:eF(t),r=n.length===1?e:DQe(e,n),i=n.length-1,o=n[i];return r&&delete r[o],i!==0&&(Br(r)&&Gi(r)||Array.isArray(r)&&IQe(r))&&Rr(e,n.slice(0,-1)),e}var OQe=e=>{for(const t in e)if(oa(e[t]))return!0;return!1};function yae(e){return Array.isArray(e)||Br(e)&&!OQe(e)}function lI(e,t={}){for(const n in e){const r=e[n];yae(r)?(t[n]=Array.isArray(r)?[]:{},lI(r,t[n])):br(r)||(t[n]=!0)}return t}function jp(e,t,n){n||(n=lI(t));for(const r in e){const i=e[r];if(yae(i))br(t)||aI(n[r])?n[r]=lI(i,Array.isArray(i)?[]:{}):jp(i,xo(t)?{}:t[r],n[r]);else{const o=t[r];n[r]=!ru(i,o)}}return n}const tW={value:!1,isValid:!1},nW={value:!0,isValid:!0};var vae=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&&!br(e[0].attributes.value)?br(e[0].value)||e[0].value===""?nW:{value:e[0].value,isValid:!0}:nW:tW}return tW},xae=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>br(e)?e:t?e===""?NaN:e&&+e:n&&Wo(e)?new Date(e):r?r(e):e;const rW={isValid:!1,value:null};var Eae=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,rW):rW;function iW(e){const t=e.ref;return tF(t)?t.files:nF(t)?Eae(e.refs).value:bae(t)?[...t.selectedOptions].map(({value:n})=>n):jy(t)?vae(e.refs).value:xae(br(t.value)?e.ref.value:t.value,e)}var MQe=(e,t,n,r)=>{const i={};for(const o of e){const s=Je(t,o);s&&nr(i,o,s._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},nw=e=>e instanceof RegExp,Gg=e=>br(e)?e:nw(e)?e.source:Br(e)?nw(e.value)?e.value.source:e.value:e,oW=e=>({isOnSubmit:!e||e===sa.onSubmit,isOnBlur:e===sa.onBlur,isOnChange:e===sa.onChange,isOnAll:e===sa.all,isOnTouch:e===sa.onTouched});const sW="AsyncFunction";var LQe=e=>!!e&&!!e.validate&&!!(oa(e.validate)&&e.validate.constructor.name===sW||Br(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===sW)),PQe=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),aW=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Lb=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const o=Je(e,i);if(o){const{_f:s,...a}=o;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],i)&&!r)return!0;if(s.ref&&t(s.ref,s.name)&&!r)return!0;if(Lb(a,t))break}else if(Br(a)&&Lb(a,t))break}}};function lW(e,t,n){const r=Je(e,n);if(r||cT(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=Je(t,o),a=Je(e,o);if(s&&!Array.isArray(s)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};i.pop()}return{name:n}}var FQe=(e,t,n,r)=>{n(e);const{name:i,...o}=e;return Gi(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(s=>t[s]===(!r||sa.all))},BQe=(e,t,n)=>!e||!t||e===t||Mb(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),jQe=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,$Qe=(e,t)=>!JP(Je(e,t)).length&&Rr(e,t),UQe=(e,t,n)=>{const r=Mb(Je(e,n));return nr(r,"root",t[n]),nr(e,n,r),e};function cW(e,t,n="validate"){if(Wo(e)||Array.isArray(e)&&e.every(Wo)||ja(e)&&!e)return{type:n,message:Wo(e)?e:"",ref:t}}var Ip=e=>Br(e)&&!nw(e)?e:{value:e,message:""},uW=async(e,t,n,r,i,o)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:f,max:h,pattern:g,validate:y,name:E,valueAsNumber:S,mount:w}=e._f,T=Je(n,E);if(!w||t.has(E))return{};const A=a?a[0]:s,R=H=>{i&&A.reportValidity&&(A.setCustomValidity(ja(H)?"":H||""),A.reportValidity())},_={},D=nF(s),I=jy(s),M=D||I,j=(S||tF(s))&&br(s.value)&&br(T)||tw(s)&&s.value===""||T===""||Array.isArray(T)&&!T.length,L=_Qe.bind(null,E,r,_),F=(H,Y,$,G=$l.maxLength,V=$l.minLength)=>{const X=H?Y:$;_[E]={type:H?G:V,message:X,ref:s,...L(H?G:V,X)}};if(o?!Array.isArray(T)||!T.length:l&&(!M&&(j||xo(T))||ja(T)&&!T||I&&!vae(a).isValid||D&&!Eae(a).isValid)){const{value:H,message:Y}=Wo(l)?{value:!!l,message:l}:Ip(l);if(H&&(_[E]={type:$l.required,message:Y,ref:A,...L($l.required,Y)},!r))return R(Y),_}if(!j&&(!xo(f)||!xo(h))){let H,Y;const $=Ip(h),G=Ip(f);if(!xo(T)&&!isNaN(T)){const V=s.valueAsNumber||T&&+T;xo($.value)||(H=V>$.value),xo(G.value)||(Y=V<G.value)}else{const V=s.valueAsDate||new Date(T),X=B=>new Date(new Date().toDateString()+" "+B),Q=s.type=="time",J=s.type=="week";Wo($.value)&&T&&(H=Q?X(T)>X($.value):J?T>$.value:V>new Date($.value)),Wo(G.value)&&T&&(Y=Q?X(T)<X(G.value):J?T<G.value:V<new Date(G.value))}if((H||Y)&&(F(!!H,$.message,G.message,$l.max,$l.min),!r))return R(_[E].message),_}if((c||u)&&!j&&(Wo(T)||o&&Array.isArray(T))){const H=Ip(c),Y=Ip(u),$=!xo(H.value)&&T.length>+H.value,G=!xo(Y.value)&&T.length<+Y.value;if(($||G)&&(F($,H.message,Y.message),!r))return R(_[E].message),_}if(g&&!j&&Wo(T)){const{value:H,message:Y}=Ip(g);if(nw(H)&&!T.match(H)&&(_[E]={type:$l.pattern,message:Y,ref:s,...L($l.pattern,Y)},!r))return R(Y),_}if(y){if(oa(y)){const H=await y(T,n),Y=cW(H,A);if(Y&&(_[E]={...Y,...L($l.validate,Y.message)},!r))return R(Y.message),_}else if(Br(y)){let H={};for(const Y in y){if(!Gi(H)&&!r)break;const $=cW(await y[Y](T,n),A,Y);$&&(H={...$,...L(Y,$.message)},R($.message),r&&(_[E]=H))}if(!Gi(H)&&(_[E]={ref:A,...H},!r))return _}}return R(!0),_};const HQe={mode:sa.onSubmit,reValidateMode:sa.onChange,shouldFocusError:!0};function zQe(e={}){let t={...HQe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:oa(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=Br(t.defaultValues)||Br(t.values)?Qr(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Qr(i),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let h={...f};const g={array:eW(),state:eW()},y=t.criteriaMode===sa.all,E=re=>de=>{clearTimeout(c),c=setTimeout(re,de)},S=async re=>{if(!s.keepIsValid&&!t.disabled&&(f.isValid||h.isValid||re)){let de;t.resolver?(de=Gi((await M()).errors),w()):de=await L(r,!0),de!==n.isValid&&g.state.next({isValid:de})}},w=(re,de)=>{!t.disabled&&(f.isValidating||f.validatingFields||h.isValidating||h.validatingFields)&&((re||Array.from(a.mount)).forEach(ye=>{ye&&(de?nr(n.validatingFields,ye,de):Rr(n.validatingFields,ye))}),g.state.next({validatingFields:n.validatingFields,isValidating:!Gi(n.validatingFields)}))},T=(re,de=[],ye,Me,Fe=!0,q=!0)=>{if(Me&&ye&&!t.disabled){if(s.action=!0,q&&Array.isArray(Je(r,re))){const ge=ye(Je(r,re),Me.argA,Me.argB);Fe&&nr(r,re,ge)}if(q&&Array.isArray(Je(n.errors,re))){const ge=ye(Je(n.errors,re),Me.argA,Me.argB);Fe&&nr(n.errors,re,ge),$Qe(n.errors,re)}if((f.touchedFields||h.touchedFields)&&q&&Array.isArray(Je(n.touchedFields,re))){const ge=ye(Je(n.touchedFields,re),Me.argA,Me.argB);Fe&&nr(n.touchedFields,re,ge)}(f.dirtyFields||h.dirtyFields)&&(n.dirtyFields=jp(i,o)),g.state.next({name:re,isDirty:H(re,de),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else nr(o,re,de)},A=(re,de)=>{nr(n.errors,re,de),g.state.next({errors:n.errors})},R=re=>{n.errors=re,g.state.next({errors:n.errors,isValid:!1})},_=(re,de,ye,Me)=>{const Fe=Je(r,re);if(Fe){const q=Je(o,re,br(ye)?Je(i,re):ye);br(q)||Me&&Me.defaultChecked||de?nr(o,re,de?q:iW(Fe._f)):G(re,q),s.mount&&!s.action&&S()}},D=(re,de,ye,Me,Fe)=>{let q=!1,ge=!1;const De={name:re};if(!t.disabled){if(!ye||Me){(f.isDirty||h.isDirty)&&(ge=n.isDirty,n.isDirty=De.isDirty=H(),q=ge!==De.isDirty);const He=ru(Je(i,re),de);ge=!!Je(n.dirtyFields,re),He?Rr(n.dirtyFields,re):nr(n.dirtyFields,re,!0),De.dirtyFields=n.dirtyFields,q=q||(f.dirtyFields||h.dirtyFields)&&ge!==!He}if(ye){const He=Je(n.touchedFields,re);He||(nr(n.touchedFields,re,ye),De.touchedFields=n.touchedFields,q=q||(f.touchedFields||h.touchedFields)&&He!==ye)}q&&Fe&&g.state.next(De)}return q?De:{}},I=(re,de,ye,Me)=>{const Fe=Je(n.errors,re),q=(f.isValid||h.isValid)&&ja(de)&&n.isValid!==de;if(t.delayError&&ye?(l=E(()=>A(re,ye)),l(t.delayError)):(clearTimeout(c),l=null,ye?nr(n.errors,re,ye):Rr(n.errors,re)),(ye?!ru(Fe,ye):Fe)||!Gi(Me)||q){const ge={...Me,...q&&ja(de)?{isValid:de}:{},errors:n.errors,name:re};n={...n,...ge},g.state.next(ge)}},M=async re=>(w(re,!0),await t.resolver(o,t.context,MQe(re||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),j=async re=>{const{errors:de}=await M(re);if(w(re),re)for(const ye of re){const Me=Je(de,ye);Me?nr(n.errors,ye,Me):Rr(n.errors,ye)}else n.errors=de;return de},L=async(re,de,ye={valid:!0})=>{for(const Me in re){const Fe=re[Me];if(Fe){const{_f:q,...ge}=Fe;if(q){const De=a.array.has(q.name),He=Fe._f&&LQe(Fe._f);He&&f.validatingFields&&w([q.name],!0);const ot=await uW(Fe,a.disabled,o,y,t.shouldUseNativeValidation&&!de,De);if(He&&f.validatingFields&&w([q.name]),ot[q.name]&&(ye.valid=!1,de))break;!de&&(Je(ot,q.name)?De?UQe(n.errors,ot,q.name):nr(n.errors,q.name,ot[q.name]):Rr(n.errors,q.name))}!Gi(ge)&&await L(ge,de,ye)}}return ye.valid},F=()=>{for(const re of a.unMount){const de=Je(r,re);de&&(de._f.refs?de._f.refs.every(ye=>!b_(ye)):!b_(de._f.ref))&&oe(re)}a.unMount=new Set},H=(re,de)=>!t.disabled&&(re&&de&&nr(o,re,de),!ru(W(),i)),Y=(re,de,ye)=>NQe(re,a,{...s.mount?o:br(de)?i:Wo(re)?{[re]:de}:de},ye,de),$=re=>JP(Je(s.mount?o:i,re,t.shouldUnregister?Je(i,re,[]):[])),G=(re,de,ye={})=>{const Me=Je(r,re);let Fe=de;if(Me){const q=Me._f;q&&(!q.disabled&&nr(o,re,xae(de,q)),Fe=tw(q.ref)&&xo(de)?"":de,bae(q.ref)?[...q.ref.options].forEach(ge=>ge.selected=Fe.includes(ge.value)):q.refs?jy(q.ref)?q.refs.forEach(ge=>{(!ge.defaultChecked||!ge.disabled)&&(Array.isArray(Fe)?ge.checked=!!Fe.find(De=>De===ge.value):ge.checked=Fe===ge.value||!!Fe)}):q.refs.forEach(ge=>ge.checked=ge.value===Fe):tF(q.ref)?q.ref.value="":(q.ref.value=Fe,q.ref.type||g.state.next({name:re,values:Qr(o)})))}(ye.shouldDirty||ye.shouldTouch)&&D(re,Fe,ye.shouldTouch,ye.shouldDirty,!0),ye.shouldValidate&&B(re)},V=(re,de,ye)=>{for(const Me in de){if(!de.hasOwnProperty(Me))return;const Fe=de[Me],q=re+"."+Me,ge=Je(r,q);(a.array.has(re)||Br(Fe)||ge&&!ge._f)&&!Md(Fe)?V(q,Fe,ye):G(q,Fe,ye)}},X=(re,de,ye={})=>{const Me=Je(r,re),Fe=a.array.has(re),q=Qr(de);nr(o,re,q),Fe?(g.array.next({name:re,values:Qr(o)}),(f.isDirty||f.dirtyFields||h.isDirty||h.dirtyFields)&&ye.shouldDirty&&g.state.next({name:re,dirtyFields:jp(i,o),isDirty:H(re,q)})):Me&&!Me._f&&!xo(q)?V(re,q,ye):G(re,q,ye),aW(re,a)&&g.state.next({...n,name:re}),g.state.next({name:s.mount?re:void 0,values:Qr(o)})},Q=async re=>{s.mount=!0;const de=re.target;let ye=de.name,Me=!0;const Fe=Je(r,ye),q=He=>{Me=Number.isNaN(He)||Md(He)&&isNaN(He.getTime())||ru(He,Je(o,ye,He))},ge=oW(t.mode),De=oW(t.reValidateMode);if(Fe){let He,ot;const an=de.type?iW(Fe._f):EQe(re),fn=re.type===Jq.BLUR||re.type===Jq.FOCUS_OUT,Dn=!PQe(Fe._f)&&!t.resolver&&!Je(n.errors,ye)&&!Fe._f.deps||jQe(fn,Je(n.touchedFields,ye),n.isSubmitted,De,ge),vn=aW(ye,a,fn);nr(o,ye,an),fn?(!de||!de.readOnly)&&(Fe._f.onBlur&&Fe._f.onBlur(re),l&&l(0)):Fe._f.onChange&&Fe._f.onChange(re);const xn=D(ye,an,fn),Ae=!Gi(xn)||vn;if(!fn&&g.state.next({name:ye,type:re.type,values:Qr(o)}),Dn)return(f.isValid||h.isValid)&&(t.mode==="onBlur"?fn&&S():fn||S()),Ae&&g.state.next({name:ye,...vn?{}:xn});if(!fn&&vn&&g.state.next({...n}),t.resolver){const{errors:Ge}=await M([ye]);if(w([ye]),q(an),Me){const gt=lW(n.errors,r,ye),lt=lW(Ge,r,gt.name||ye);He=lt.error,ye=lt.name,ot=Gi(Ge)}}else w([ye],!0),He=(await uW(Fe,a.disabled,o,y,t.shouldUseNativeValidation))[ye],w([ye]),q(an),Me&&(He?ot=!1:(f.isValid||h.isValid)&&(ot=await L(r,!0)));Me&&(Fe._f.deps&&(!Array.isArray(Fe._f.deps)||Fe._f.deps.length>0)&&B(Fe._f.deps),I(ye,ot,He,xn))}},J=(re,de)=>{if(Je(n.errors,de)&&re.focus)return re.focus(),1},B=async(re,de={})=>{let ye,Me;const Fe=Mb(re);if(t.resolver){const q=await j(br(re)?re:Fe);ye=Gi(q),Me=re?!Fe.some(ge=>Je(q,ge)):ye}else re?(Me=(await Promise.all(Fe.map(async q=>{const ge=Je(r,q);return await L(ge&&ge._f?{[q]:ge}:ge)}))).every(Boolean),!(!Me&&!n.isValid)&&S()):Me=ye=await L(r);return g.state.next({...!Wo(re)||(f.isValid||h.isValid)&&ye!==n.isValid?{}:{name:re},...t.resolver||!re?{isValid:ye}:{},errors:n.errors}),de.shouldFocus&&!Me&&Lb(r,J,re?Fe:a.mount),Me},W=(re,de)=>{let ye={...s.mount?o:i};return de&&(ye=gae(de.dirtyFields?n.dirtyFields:n.touchedFields,ye)),br(re)?ye:Wo(re)?Je(ye,re):re.map(Me=>Je(ye,Me))},K=(re,de)=>({invalid:!!Je((de||n).errors,re),isDirty:!!Je((de||n).dirtyFields,re),error:Je((de||n).errors,re),isValidating:!!Je(n.validatingFields,re),isTouched:!!Je((de||n).touchedFields,re)}),P=re=>{re&&Mb(re).forEach(de=>Rr(n.errors,de)),g.state.next({errors:re?n.errors:{}})},ce=(re,de,ye)=>{const Me=(Je(r,re,{_f:{}})._f||{}).ref,Fe=Je(n.errors,re)||{},{ref:q,message:ge,type:De,...He}=Fe;nr(n.errors,re,{...He,...de,ref:Me}),g.state.next({name:re,errors:n.errors,isValid:!1}),ye&&ye.shouldFocus&&Me&&Me.focus&&Me.focus()},le=(re,de)=>oa(re)?g.state.subscribe({next:ye=>"values"in ye&&re(Y(void 0,de),ye)}):Y(re,de,!0),se=re=>g.state.subscribe({next:de=>{BQe(re.name,de.name,re.exact)&&FQe(de,re.formState||f,Vn,re.reRenderRoot)&&re.callback({values:{...o},...n,...de,defaultValues:i})}}).unsubscribe,te=re=>(s.mount=!0,h={...h,...re.formState},se({...re,formState:{...u,...re.formState}})),oe=(re,de={})=>{for(const ye of re?Mb(re):a.mount)a.mount.delete(ye),a.array.delete(ye),de.keepValue||(Rr(r,ye),Rr(o,ye)),!de.keepError&&Rr(n.errors,ye),!de.keepDirty&&Rr(n.dirtyFields,ye),!de.keepTouched&&Rr(n.touchedFields,ye),!de.keepIsValidating&&Rr(n.validatingFields,ye),!t.shouldUnregister&&!de.keepDefaultValue&&Rr(i,ye);g.state.next({values:Qr(o)}),g.state.next({...n,...de.keepDirty?{isDirty:H()}:{}}),!de.keepIsValid&&S()},ue=({disabled:re,name:de})=>{(ja(re)&&s.mount||re||a.disabled.has(de))&&(re?a.disabled.add(de):a.disabled.delete(de))},Te=(re,de={})=>{let ye=Je(r,re);const Me=ja(de.disabled)||ja(t.disabled);return nr(r,re,{...ye||{},_f:{...ye&&ye._f?ye._f:{ref:{name:re}},name:re,mount:!0,...de}}),a.mount.add(re),ye?ue({disabled:ja(de.disabled)?de.disabled:t.disabled,name:re}):_(re,!0,de.value),{...Me?{disabled:de.disabled||t.disabled}:{},...t.progressive?{required:!!de.required,min:Gg(de.min),max:Gg(de.max),minLength:Gg(de.minLength),maxLength:Gg(de.maxLength),pattern:Gg(de.pattern)}:{},name:re,onChange:Q,onBlur:Q,ref:Fe=>{if(Fe){Te(re,de),ye=Je(r,re);const q=br(Fe.value)&&Fe.querySelectorAll&&Fe.querySelectorAll("input,select,textarea")[0]||Fe,ge=RQe(q),De=ye._f.refs||[];if(ge?De.find(He=>He===q):q===ye._f.ref)return;nr(r,re,{_f:{...ye._f,...ge?{refs:[...De.filter(b_),q,...Array.isArray(Je(i,re))?[{}]:[]],ref:{type:q.type,name:re}}:{ref:q}}}),_(re,!1,void 0,q)}else ye=Je(r,re,{}),ye._f&&(ye._f.mount=!1),(t.shouldUnregister||de.shouldUnregister)&&!(wQe(a.array,re)&&s.action)&&a.unMount.add(re)}}},Ie=()=>t.shouldFocusError&&Lb(r,J,a.mount),ke=re=>{ja(re)&&(g.state.next({disabled:re}),Lb(r,(de,ye)=>{const Me=Je(r,ye);Me&&(de.disabled=Me._f.disabled||re,Array.isArray(Me._f.refs)&&Me._f.refs.forEach(Fe=>{Fe.disabled=Me._f.disabled||re}))},0,!1))},tt=(re,de)=>async ye=>{let Me;ye&&(ye.preventDefault&&ye.preventDefault(),ye.persist&&ye.persist());let Fe=Qr(o);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:q,values:ge}=await M();w(),n.errors=q,Fe=Qr(ge)}else await L(r);if(a.disabled.size)for(const q of a.disabled)Rr(Fe,q);if(Rr(n.errors,"root"),Gi(n.errors)){g.state.next({errors:{}});try{await re(Fe,ye)}catch(q){Me=q}}else de&&await de({...n.errors},ye),Ie(),setTimeout(Ie);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gi(n.errors)&&!Me,submitCount:n.submitCount+1,errors:n.errors}),Me)throw Me},rt=(re,de={})=>{Je(r,re)&&(br(de.defaultValue)?X(re,Qr(Je(i,re))):(X(re,de.defaultValue),nr(i,re,Qr(de.defaultValue))),de.keepTouched||Rr(n.touchedFields,re),de.keepDirty||(Rr(n.dirtyFields,re),n.isDirty=de.defaultValue?H(re,Qr(Je(i,re))):H()),de.keepError||(Rr(n.errors,re),f.isValid&&S()),g.state.next({...n}))},ze=(re,de={})=>{const ye=re?Qr(re):i,Me=Qr(ye),Fe=Gi(re),q=Fe?i:Me;if(de.keepDefaultValues||(i=ye),!de.keepValues){if(de.keepDirtyValues){const ge=new Set([...a.mount,...Object.keys(jp(i,o))]);for(const De of Array.from(ge))Je(n.dirtyFields,De)?nr(q,De,Je(o,De)):X(De,Je(q,De))}else{if(QP&&br(re))for(const ge of a.mount){const De=Je(r,ge);if(De&&De._f){const He=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(tw(He)){const ot=He.closest("form");if(ot){ot.reset();break}}}}if(de.keepFieldsRef)for(const ge of a.mount)X(ge,Je(q,ge));else r={}}o=t.shouldUnregister?de.keepDefaultValues?Qr(i):{}:Qr(q),g.array.next({values:{...q}}),g.state.next({values:{...q}})}a={mount:de.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!f.isValid||!!de.keepIsValid||!!de.keepDirtyValues||!t.shouldUnregister&&!Gi(q),s.watch=!!t.shouldUnregister,s.keepIsValid=!!de.keepIsValid,s.action=!1,de.keepErrors||(n.errors={}),g.state.next({submitCount:de.keepSubmitCount?n.submitCount:0,isDirty:Fe?!1:de.keepDirty?n.isDirty:!!(de.keepDefaultValues&&!ru(re,i)),isSubmitted:de.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Fe?{}:de.keepDirtyValues?de.keepDefaultValues&&o?jp(i,o):n.dirtyFields:de.keepDefaultValues&&re?jp(i,re):de.keepDirty?n.dirtyFields:{},touchedFields:de.keepTouched?n.touchedFields:{},errors:de.keepErrors?n.errors:{},isSubmitSuccessful:de.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},dn=(re,de)=>ze(oa(re)?re(o):re,{...t.resetOptions,...de}),nt=(re,de={})=>{const ye=Je(r,re),Me=ye&&ye._f;if(Me){const Fe=Me.refs?Me.refs[0]:Me.ref;Fe.focus&&setTimeout(()=>{Fe.focus(),de.shouldSelect&&oa(Fe.select)&&Fe.select()})}},Vn=re=>{n={...n,...re}},xt={control:{register:Te,unregister:oe,getFieldState:K,handleSubmit:tt,setError:ce,_subscribe:se,_runSchema:M,_updateIsValidating:w,_focusError:Ie,_getWatch:Y,_getDirty:H,_setValid:S,_setFieldArray:T,_setDisabledField:ue,_setErrors:R,_getFieldArray:$,_reset:ze,_resetDefaultValues:()=>oa(t.defaultValues)&&t.defaultValues().then(re=>{dn(re,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:ke,_subjects:g,_proxyFormState:f,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(re){s=re},get _defaultValues(){return i},get _names(){return a},set _names(re){a=re},get _formState(){return n},get _options(){return t},set _options(re){t={...t,...re}}},subscribe:te,trigger:B,register:Te,handleSubmit:tt,watch:le,setValue:X,getValues:W,reset:dn,resetField:rt,clearErrors:P,unregister:oe,setError:ce,setFocus:nt,getFieldState:K};return{...xt,formControl:xt}}function VQe(e={}){const t=pe.useRef(void 0),n=pe.useRef(void 0),[r,i]=pe.useState({isDirty:!1,isValidating:!1,isLoading:oa(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:oa(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!oa(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=zQe(e);t.current={...a,formState:r}}const o=t.current.control;return o._options=e,AQe(()=>{const s=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(a=>({...a,isReady:!0})),o._formState.isReady=!0,s},[o]),pe.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),pe.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),pe.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),pe.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),pe.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==r.isDirty&&o._subjects.state.next({isDirty:s})}},[o,r.isDirty]),pe.useEffect(()=>{var s;e.values&&!ru(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((s=o._options.resetOptions)===null||s===void 0)&&s.keepIsValid||o._setValid(),n.current=e.values,i(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),pe.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=kQe(r,o),t.current}function Sae(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s);a.displayName=o+"Context";const l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,GQe(i,...t)]}function GQe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var qQe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],io=qQe.reduce((e,t)=>{const n=OZ(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function WQe(){return Lse.useSyncExternalStore(YQe,()=>!0,()=>!1)}function YQe(){return()=>{}}var rF="Avatar",[KQe]=Sae(rF),[XQe,wae]=KQe(rF),Cae=v.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[i,o]=v.useState("idle");return m.jsx(XQe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:m.jsx(io.span,{...r,ref:t})})});Cae.displayName=rF;var Tae="AvatarImage",kae=v.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...o}=e,s=wae(Tae,n),a=ZQe(r,o),l=Gr(c=>{i(c),s.onImageLoadingStatusChange(c)});return Sr(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?m.jsx(io.img,{...o,ref:t,src:r}):null});kae.displayName=Tae;var Aae="AvatarFallback",Nae=v.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...i}=e,o=wae(Aae,n),[s,a]=v.useState(r===void 0);return v.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&o.imageLoadingStatus!=="loaded"?m.jsx(io.span,{...i,ref:t}):null});Nae.displayName=Aae;function dW(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function ZQe(e,{referrerPolicy:t,crossOrigin:n}){const r=WQe(),i=v.useRef(null),o=r?(i.current||(i.current=new window.Image),i.current):null,[s,a]=v.useState(()=>dW(o,e));return Sr(()=>{a(dW(o,e))},[o,e]),Sr(()=>{const l=f=>()=>{a(f)};if(!o)return;const c=l("loaded"),u=l("error");return o.addEventListener("load",c),o.addEventListener("error",u),t&&(o.referrerPolicy=t),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",c),o.removeEventListener("error",u)}},[o,n,t]),s}var QQe=Cae,JQe=kae,eJe=Nae;const iF="-",tJe=e=>{const t=rJe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(iF);return a[0]===""&&a.length!==1&&a.shift(),_ae(a,t)||nJe(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},_ae=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?_ae(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(iF);return t.validators.find(({validator:s})=>s(o))?.classGroupId},fW=/^\[(.+)\]$/,nJe=e=>{if(fW.test(e)){const t=fW.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},rJe=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return oJe(Object.entries(e.classGroups),n).forEach(([o,s])=>{cI(s,r,o,t)}),r},cI=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:pW(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(iJe(i)){cI(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{cI(s,pW(t,o),n,r)})})},pW=(e,t)=>{let n=e;return t.split(iF).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},iJe=e=>e.isThemeGetter,oJe=(e,t)=>t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e,sJe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},Rae="!",aJe=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],o=t.length,s=a=>{const l=[];let c=0,u=0,f;for(let S=0;S<a.length;S++){let w=a[S];if(c===0){if(w===i&&(r||a.slice(S,S+o)===t)){l.push(a.slice(u,S)),u=S+o;continue}if(w==="/"){f=S;continue}}w==="["?c++:w==="]"&&c--}const h=l.length===0?a:a.substring(u),g=h.startsWith(Rae),y=g?h.substring(1):h,E=f&&f>u?f-u:void 0;return{modifiers:l,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:E}};return n?a=>n({className:a,parseClassName:s}):s},lJe=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},cJe=e=>({cache:sJe(e.cacheSize),parseClassName:aJe(e),...tJe(e)}),uJe=/\s+/,dJe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(uJe);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:g}=n(c);let y=!!g,E=r(y?h.substring(0,g):h);if(!E){if(!y){a=c+(a.length>0?" "+a:a);continue}if(E=r(h),!E){a=c+(a.length>0?" "+a:a);continue}y=!1}const S=lJe(u).join(":"),w=f?S+Rae:S,T=w+E;if(o.includes(T))continue;o.push(T);const A=i(E,y);for(let R=0;R<A.length;++R){const _=A[R];o.push(w+_)}a=c+(a.length>0?" "+a:a)}return a};function fJe(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Dae(t))&&(r&&(r+=" "),r+=n);return r}const Dae=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Dae(e[r]))&&(n&&(n+=" "),n+=t);return n};function pJe(e,...t){let n,r,i,o=s;function s(l){const c=t.reduce((u,f)=>f(u),e());return n=cJe(c),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=dJe(l,n);return i(l,u),u}return function(){return o(fJe.apply(null,arguments))}}const Yn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Iae=/^\[(?:([a-z-]+):)?(.+)\]$/i,hJe=/^\d+\/\d+$/,mJe=new Set(["px","full","screen"]),gJe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bJe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yJe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,vJe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xJe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ul=e=>mh(e)||mJe.has(e)||hJe.test(e),Uc=e=>Rm(e,"length",NJe),mh=e=>!!e&&!Number.isNaN(Number(e)),y_=e=>Rm(e,"number",mh),qg=e=>!!e&&Number.isInteger(Number(e)),EJe=e=>e.endsWith("%")&&mh(e.slice(0,-1)),At=e=>Iae.test(e),Hc=e=>gJe.test(e),SJe=new Set(["length","size","percentage"]),wJe=e=>Rm(e,SJe,Oae),CJe=e=>Rm(e,"position",Oae),TJe=new Set(["image","url"]),kJe=e=>Rm(e,TJe,RJe),AJe=e=>Rm(e,"",_Je),Wg=()=>!0,Rm=(e,t,n)=>{const r=Iae.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},NJe=e=>bJe.test(e)&&!yJe.test(e),Oae=()=>!1,_Je=e=>vJe.test(e),RJe=e=>xJe.test(e),DJe=()=>{const e=Yn("colors"),t=Yn("spacing"),n=Yn("blur"),r=Yn("brightness"),i=Yn("borderColor"),o=Yn("borderRadius"),s=Yn("borderSpacing"),a=Yn("borderWidth"),l=Yn("contrast"),c=Yn("grayscale"),u=Yn("hueRotate"),f=Yn("invert"),h=Yn("gap"),g=Yn("gradientColorStops"),y=Yn("gradientColorStopPositions"),E=Yn("inset"),S=Yn("margin"),w=Yn("opacity"),T=Yn("padding"),A=Yn("saturate"),R=Yn("scale"),_=Yn("sepia"),D=Yn("skew"),I=Yn("space"),M=Yn("translate"),j=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",At,t],H=()=>[At,t],Y=()=>["",Ul,Uc],$=()=>["auto",mh,At],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",At],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[mh,At];return{cacheSize:500,separator:":",theme:{colors:[Wg],spacing:[Ul,Uc],blur:["none","",Hc,At],brightness:W(),borderColor:[e],borderRadius:["none","","full",Hc,At],borderSpacing:H(),borderWidth:Y(),contrast:W(),grayscale:J(),hueRotate:W(),invert:J(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[EJe,Uc],inset:F(),margin:F(),opacity:W(),padding:H(),saturate:W(),scale:W(),sepia:J(),skew:W(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",At]}],container:["container"],columns:[{columns:[Hc]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...G(),At]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[E]}],"inset-x":[{"inset-x":[E]}],"inset-y":[{"inset-y":[E]}],start:[{start:[E]}],end:[{end:[E]}],top:[{top:[E]}],right:[{right:[E]}],bottom:[{bottom:[E]}],left:[{left:[E]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qg,At]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",At]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",qg,At]}],"grid-cols":[{"grid-cols":[Wg]}],"col-start-end":[{col:["auto",{span:["full",qg,At]},At]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[Wg]}],"row-start-end":[{row:["auto",{span:[qg,At]},At]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",At]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",At]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",At,t]}],"min-w":[{"min-w":[At,t,"min","max","fit"]}],"max-w":[{"max-w":[At,t,"none","full","min","max","fit","prose",{screen:[Hc]},Hc]}],h:[{h:[At,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[At,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[At,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[At,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Hc,Uc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",y_]}],"font-family":[{font:[Wg]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",At]}],"line-clamp":[{"line-clamp":["none",mh,y_]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ul,At]}],"list-image":[{"list-image":["none",At]}],"list-style-type":[{list:["none","disc","decimal",At]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ul,Uc]}],"underline-offset":[{"underline-offset":["auto",Ul,At]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",At]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",At]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),CJe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",wJe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kJe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:V()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Ul,At]}],"outline-w":[{outline:[Ul,Uc]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Ul,Uc]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Hc,AJe]}],"shadow-color":[{shadow:[Wg]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Hc,At]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[A]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",At]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",At]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",At]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[qg,At]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",At]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",At]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",At]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ul,Uc,y_]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},IJe=pJe(DJe);function OJe(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,MJe(i,...t)]}function MJe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function LJe(e){const t=PJe(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(BJe);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function PJe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=$Je(i),a=jJe(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var FJe=Symbol("radix.slottable");function BJe(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===FJe}function jJe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function $Je(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var UJe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],HJe=UJe.reduce((e,t)=>{const n=LJe(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function zJe(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,VJe(i,...t)]}function VJe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function hW(e){const t=GJe(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(WJe);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function GJe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=KJe(i),a=YJe(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qJe=Symbol("radix.slottable");function WJe(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qJe}function YJe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function KJe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function oF(e){const t=e+"CollectionProvider",[n,r]=zJe(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=E=>{const{scope:S,children:w}=E,T=pe.useRef(null),A=pe.useRef(new Map).current;return m.jsx(i,{scope:S,itemMap:A,collectionRef:T,children:w})};s.displayName=t;const a=e+"CollectionSlot",l=hW(a),c=pe.forwardRef((E,S)=>{const{scope:w,children:T}=E,A=o(a,w),R=It(S,A.collectionRef);return m.jsx(l,{ref:R,children:T})});c.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",h=hW(u),g=pe.forwardRef((E,S)=>{const{scope:w,children:T,...A}=E,R=pe.useRef(null),_=It(S,R),D=o(u,w);return pe.useEffect(()=>(D.itemMap.set(R,{ref:R,...A}),()=>{D.itemMap.delete(R)})),m.jsx(h,{[f]:"",ref:_,children:T})});g.displayName=u;function y(E){const S=o(e+"CollectionConsumer",E);return pe.useCallback(()=>{const T=S.collectionRef.current;if(!T)return[];const A=Array.from(T.querySelectorAll(`[${f}]`));return Array.from(S.itemMap.values()).sort((D,I)=>A.indexOf(D.ref.current)-A.indexOf(I.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:s,Slot:c,ItemSlot:g},y,r]}function XJe(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,ZJe(i,...t)]}function ZJe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function QJe(e){const t=JJe(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(tet);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function JJe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=ret(i),a=net(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eet=Symbol("radix.slottable");function tet(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eet}function net(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function ret(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var iet=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oet=iet.reduce((e,t)=>{const n=QJe(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),set="Arrow",Mae=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return m.jsx(oet.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});Mae.displayName=set;var aet=Mae;function cet(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,uet(i,...t)]}function uet(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function det(e){const t=fet(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(het);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function fet(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=get(i),a=met(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pet=Symbol("radix.slottable");function het(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pet}function met(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function get(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bet=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lae=bet.reduce((e,t)=>{const n=det(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Pae(e){const[t,n]=v.useState(void 0);return Sr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var sF="Popper",[Fae,Ku]=cet(sF),[yet,Bae]=Fae(sF),jae=e=>{const{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return m.jsx(yet,{scope:t,anchor:r,onAnchorChange:i,children:n})};jae.displayName=sF;var $ae="PopperAnchor",Uae=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=Bae($ae,n),s=v.useRef(null),a=It(t,s),l=v.useRef(null);return v.useEffect(()=>{const c=l.current;l.current=r?.current||s.current,c!==l.current&&o.onAnchorChange(l.current)}),r?null:m.jsx(Lae.div,{...i,ref:a})});Uae.displayName=$ae;var aF="PopperContent",[vet,xet]=Fae(aF),Hae=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:y,...E}=e,S=Bae(aF,n),[w,T]=v.useState(null),A=It(t,te=>T(te)),[R,_]=v.useState(null),D=Pae(R),I=D?.width??0,M=D?.height??0,j=r+(o!=="center"?"-"+o:""),L=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},F=Array.isArray(c)?c:[c],H=F.length>0,Y={padding:L,boundary:F.filter(wet),altBoundary:H},{refs:$,floatingStyles:G,placement:V,isPositioned:X,middlewareData:Q}=tse({strategy:"fixed",placement:j,whileElementsMounted:(...te)=>Joe(...te,{animationFrame:g==="always"}),elements:{reference:S.anchor},middleware:[ha({mainAxis:i+M,alignmentAxis:s}),l&&Nm({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?xqe():void 0,...Y}),l&&_m({...Y}),_0({...Y,apply:({elements:te,rects:oe,availableWidth:ue,availableHeight:Te})=>{const{width:Ie,height:ke}=oe.reference,tt=te.floating.style;tt.setProperty("--radix-popper-available-width",`${ue}px`),tt.setProperty("--radix-popper-available-height",`${Te}px`),tt.setProperty("--radix-popper-anchor-width",`${Ie}px`),tt.setProperty("--radix-popper-anchor-height",`${ke}px`)}}),R&&Sqe({element:R,padding:a}),Cet({arrowWidth:I,arrowHeight:M}),h&&Eqe({strategy:"referenceHidden",...Y})]}),[J,B]=Gae(V),W=Gr(y);Sr(()=>{X&&W?.()},[X,W]);const K=Q.arrow?.x,P=Q.arrow?.y,ce=Q.arrow?.centerOffset!==0,[le,se]=v.useState();return Sr(()=>{w&&se(window.getComputedStyle(w).zIndex)},[w]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:X?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[Q.transformOrigin?.x,Q.transformOrigin?.y].join(" "),...Q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(vet,{scope:n,placedSide:J,onArrowChange:_,arrowX:K,arrowY:P,shouldHideArrow:ce,children:m.jsx(Lae.div,{"data-side":J,"data-align":B,...E,ref:A,style:{...E.style,animation:X?void 0:"none"}})})})});Hae.displayName=aF;var zae="PopperArrow",Eet={top:"bottom",right:"left",bottom:"top",left:"right"},Vae=v.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=xet(zae,r),s=Eet[o.placedSide];return m.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:m.jsx(aet,{...i,ref:n,style:{...i.style,display:"block"}})})});Vae.displayName=zae;function wet(e){return e!==null}var Cet=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Gae(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(i.arrow?.x??0)+a/2,g=(i.arrow?.y??0)+l/2;let y="",E="";return c==="bottom"?(y=s?f:`${h}px`,E=`${-l}px`):c==="top"?(y=s?f:`${h}px`,E=`${r.floating.height+l}px`):c==="right"?(y=`${-l}px`,E=s?f:`${g}px`):c==="left"&&(y=`${r.floating.width+l}px`,E=s?f:`${g}px`),{data:{x:y,y:E}}}});function Gae(e){const[t,n="center"]=e.split("-");return[t,n]}var $y=jae,Uy=Uae,uT=Hae,dT=Vae;function qae(e){const t=Tet(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Aet);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Tet(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=_et(i),a=Net(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ket=Symbol("radix.slottable");function Aet(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ket}function Net(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function _et(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ret=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hy=Ret.reduce((e,t)=>{const n=qae(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Det(e,t){e&&Wr.flushSync(()=>e.dispatchEvent(t))}function Iet(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Oet(i,...t)]}function Oet(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Met(e){const t=Let(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Fet);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Let(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=jet(i),a=Bet(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Pet=Symbol("radix.slottable");function Fet(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Pet}function Bet(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function jet(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $et=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wae=$et.reduce((e,t)=>{const n=Met(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),v_="rovingFocusGroup.onEntryFocus",Uet={bubbles:!1,cancelable:!0},zy="RovingFocusGroup",[uI,Yae,Het]=oF(zy),[zet,fT]=Iet(zy,[Het]),[Vet,Get]=zet(zy),Kae=v.forwardRef((e,t)=>m.jsx(uI.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(uI.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(qet,{...e,ref:t})})}));Kae.displayName=zy;var qet=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=e,h=v.useRef(null),g=It(t,h),y=ry(o),[E,S]=Us({prop:s,defaultProp:a??null,onChange:l,caller:zy}),[w,T]=v.useState(!1),A=Gr(c),R=Yae(n),_=v.useRef(!1),[D,I]=v.useState(0);return v.useEffect(()=>{const M=h.current;if(M)return M.addEventListener(v_,A),()=>M.removeEventListener(v_,A)},[A]),m.jsx(Vet,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:E,onItemFocus:v.useCallback(M=>S(M),[S]),onItemShiftTab:v.useCallback(()=>T(!0),[]),onFocusableItemAdd:v.useCallback(()=>I(M=>M+1),[]),onFocusableItemRemove:v.useCallback(()=>I(M=>M-1),[]),children:m.jsx(Wae.div,{tabIndex:w||D===0?-1:0,"data-orientation":r,...f,ref:g,style:{outline:"none",...e.style},onMouseDown:Ue(e.onMouseDown,()=>{_.current=!0}),onFocus:Ue(e.onFocus,M=>{const j=!_.current;if(M.target===M.currentTarget&&j&&!w){const L=new CustomEvent(v_,Uet);if(M.currentTarget.dispatchEvent(L),!L.defaultPrevented){const F=R().filter(V=>V.focusable),H=F.find(V=>V.active),Y=F.find(V=>V.id===E),G=[H,Y,...F].filter(Boolean).map(V=>V.ref.current);Qae(G,u)}}_.current=!1}),onBlur:Ue(e.onBlur,()=>T(!1))})})}),Xae="RovingFocusGroupItem",Zae=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=xr(),c=o||l,u=Get(Xae,n),f=u.currentTabStopId===c,h=Yae(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:E}=u;return v.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),m.jsx(uI.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:m.jsx(Wae.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Ue(e.onMouseDown,S=>{r?u.onItemFocus(c):S.preventDefault()}),onFocus:Ue(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ue(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){u.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const w=Ket(S,u.orientation,u.dir);if(w!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let A=h().filter(R=>R.focusable).map(R=>R.ref.current);if(w==="last")A.reverse();else if(w==="prev"||w==="next"){w==="prev"&&A.reverse();const R=A.indexOf(S.currentTarget);A=u.loop?Xet(A,R+1):A.slice(R+1)}setTimeout(()=>Qae(A))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:E!=null}):s})})});Zae.displayName=Xae;var Wet={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yet(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ket(e,t,n){const r=Yet(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Wet[r]}function Qae(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Xet(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Jae=Kae,ele=Zae,dI=["Enter"," "],Zet=["ArrowDown","PageUp","Home"],tle=["ArrowUp","PageDown","End"],Qet=[...Zet,...tle],Jet={ltr:[...dI,"ArrowRight"],rtl:[...dI,"ArrowLeft"]},ett={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Vy="Menu",[I0,ttt,ntt]=oF(Vy),[Lf,nle]=XJe(Vy,[ntt,Ku,fT]),Gy=Ku(),rle=fT(),[ile,Xu]=Lf(Vy),[rtt,qy]=Lf(Vy),ole=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=e,a=Gy(t),[l,c]=v.useState(null),u=v.useRef(!1),f=Gr(o),h=ry(i);return v.useEffect(()=>{const g=()=>{u.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>u.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx($y,{...a,children:m.jsx(ile,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c,children:m.jsx(rtt,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};ole.displayName=Vy;var itt="MenuAnchor",lF=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gy(n);return m.jsx(Uy,{...i,...r,ref:t})});lF.displayName=itt;var cF="MenuPortal",[ott,sle]=Lf(cF,{forceMount:void 0}),ale=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=Xu(cF,t);return m.jsx(ott,{scope:t,forceMount:n,children:m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:r})})})};ale.displayName=cF;var $s="MenuContent",[stt,uF]=Lf($s),lle=v.forwardRef((e,t)=>{const n=sle($s,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Xu($s,e.__scopeMenu),s=qy($s,e.__scopeMenu);return m.jsx(I0.Provider,{scope:e.__scopeMenu,children:m.jsx(Yr,{present:r||o.open,children:m.jsx(I0.Slot,{scope:e.__scopeMenu,children:s.modal?m.jsx(att,{...i,ref:t}):m.jsx(ltt,{...i,ref:t})})})})}),att=v.forwardRef((e,t)=>{const n=Xu($s,e.__scopeMenu),r=v.useRef(null),i=It(t,r);return v.useEffect(()=>{const o=r.current;if(o)return Nw(o)},[]),m.jsx(dF,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ltt=v.forwardRef((e,t)=>{const n=Xu($s,e.__scopeMenu);return m.jsx(dF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ctt=qae("MenuContent.ScrollLock"),dF=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,disableOutsideScroll:y,...E}=e,S=Xu($s,n),w=qy($s,n),T=Gy(n),A=rle(n),R=ttt(n),[_,D]=v.useState(null),I=v.useRef(null),M=It(t,I,S.onContentChange),j=v.useRef(0),L=v.useRef(""),F=v.useRef(0),H=v.useRef(null),Y=v.useRef("right"),$=v.useRef(0),G=y?J0:v.Fragment,V=y?{as:ctt,allowPinchZoom:!0}:void 0,X=J=>{const B=L.current+J,W=R().filter(te=>!te.disabled),K=document.activeElement,P=W.find(te=>te.ref.current===K)?.textValue,ce=W.map(te=>te.textValue),le=Ett(ce,B,P),se=W.find(te=>te.textValue===le)?.ref.current;(function te(oe){L.current=oe,window.clearTimeout(j.current),oe!==""&&(j.current=window.setTimeout(()=>te(""),1e3))})(B),se&&setTimeout(()=>se.focus())};v.useEffect(()=>()=>window.clearTimeout(j.current),[]),kw();const Q=v.useCallback(J=>Y.current===H.current?.side&&wtt(J,H.current?.area),[]);return m.jsx(stt,{scope:n,searchRef:L,onItemEnter:v.useCallback(J=>{Q(J)&&J.preventDefault()},[Q]),onItemLeave:v.useCallback(J=>{Q(J)||(I.current?.focus(),D(null))},[Q]),onTriggerLeave:v.useCallback(J=>{Q(J)&&J.preventDefault()},[Q]),pointerGraceTimerRef:F,onPointerGraceIntentChange:v.useCallback(J=>{H.current=J},[]),children:m.jsx(G,{...V,children:m.jsx(Z0,{asChild:!0,trapped:i,onMountAutoFocus:Ue(o,J=>{J.preventDefault(),I.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,children:m.jsx(Jae,{asChild:!0,...A,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:D,onEntryFocus:Ue(l,J=>{w.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(uT,{role:"menu","aria-orientation":"vertical","data-state":Tle(S.open),"data-radix-menu-content":"",dir:w.dir,...T,...E,ref:M,style:{outline:"none",...E.style},onKeyDown:Ue(E.onKeyDown,J=>{const W=J.target.closest("[data-radix-menu-content]")===J.currentTarget,K=J.ctrlKey||J.altKey||J.metaKey,P=J.key.length===1;W&&(J.key==="Tab"&&J.preventDefault(),!K&&P&&X(J.key));const ce=I.current;if(J.target!==ce||!Qet.includes(J.key))return;J.preventDefault();const se=R().filter(te=>!te.disabled).map(te=>te.ref.current);tle.includes(J.key)&&se.reverse(),vtt(se)}),onBlur:Ue(e.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(j.current),L.current="")}),onPointerMove:Ue(e.onPointerMove,O0(J=>{const B=J.target,W=$.current!==J.clientX;if(J.currentTarget.contains(B)&&W){const K=J.clientX>$.current?"right":"left";Y.current=K,$.current=J.clientX}}))})})})})})})});lle.displayName=$s;var utt="MenuGroup",fF=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Hy.div,{role:"group",...r,ref:t})});fF.displayName=utt;var dtt="MenuLabel",cle=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Hy.div,{...r,ref:t})});cle.displayName=dtt;var rw="MenuItem",mW="menu.itemSelect",pT=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=v.useRef(null),s=qy(rw,e.__scopeMenu),a=uF(rw,e.__scopeMenu),l=It(t,o),c=v.useRef(!1),u=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(mW,{bubbles:!0,cancelable:!0});f.addEventListener(mW,g=>r?.(g),{once:!0}),Det(f,h),h.defaultPrevented?c.current=!1:s.onClose()}};return m.jsx(ule,{...i,ref:l,disabled:n,onClick:Ue(e.onClick,u),onPointerDown:f=>{e.onPointerDown?.(f),c.current=!0},onPointerUp:Ue(e.onPointerUp,f=>{c.current||f.currentTarget?.click()}),onKeyDown:Ue(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||dI.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});pT.displayName=rw;var ule=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=uF(rw,n),a=rle(n),l=v.useRef(null),c=It(t,l),[u,f]=v.useState(!1),[h,g]=v.useState("");return v.useEffect(()=>{const y=l.current;y&&g((y.textContent??"").trim())},[o.children]),m.jsx(I0.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:m.jsx(ele,{asChild:!0,...a,focusable:!r,children:m.jsx(Hy.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:c,onPointerMove:Ue(e.onPointerMove,O0(y=>{r?s.onItemLeave(y):(s.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ue(e.onPointerLeave,O0(y=>s.onItemLeave(y))),onFocus:Ue(e.onFocus,()=>f(!0)),onBlur:Ue(e.onBlur,()=>f(!1))})})})}),ftt="MenuCheckboxItem",dle=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(gle,{scope:e.__scopeMenu,checked:n,children:m.jsx(pT,{role:"menuitemcheckbox","aria-checked":iw(n)?"mixed":n,...i,ref:t,"data-state":mF(n),onSelect:Ue(i.onSelect,()=>r?.(iw(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dle.displayName=ftt;var fle="MenuRadioGroup",[ptt,htt]=Lf(fle,{value:void 0,onValueChange:()=>{}}),ple=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=Gr(r);return m.jsx(ptt,{scope:e.__scopeMenu,value:n,onValueChange:o,children:m.jsx(fF,{...i,ref:t})})});ple.displayName=fle;var hle="MenuRadioItem",mle=v.forwardRef((e,t)=>{const{value:n,...r}=e,i=htt(hle,e.__scopeMenu),o=n===i.value;return m.jsx(gle,{scope:e.__scopeMenu,checked:o,children:m.jsx(pT,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":mF(o),onSelect:Ue(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});mle.displayName=hle;var pF="MenuItemIndicator",[gle,mtt]=Lf(pF,{checked:!1}),ble=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=mtt(pF,n);return m.jsx(Yr,{present:r||iw(o.checked)||o.checked===!0,children:m.jsx(Hy.span,{...i,ref:t,"data-state":mF(o.checked)})})});ble.displayName=pF;var gtt="MenuSeparator",yle=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Hy.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});yle.displayName=gtt;var btt="MenuArrow",vle=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gy(n);return m.jsx(dT,{...i,...r,ref:t})});vle.displayName=btt;var hF="MenuSub",[ytt,xle]=Lf(hF),Ele=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,o=Xu(hF,t),s=Gy(t),[a,l]=v.useState(null),[c,u]=v.useState(null),f=Gr(i);return v.useEffect(()=>(o.open===!1&&f(!1),()=>f(!1)),[o.open,f]),m.jsx($y,{...s,children:m.jsx(ile,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:m.jsx(ytt,{scope:t,contentId:xr(),triggerId:xr(),trigger:a,onTriggerChange:l,children:n})})})};Ele.displayName=hF;var ib="MenuSubTrigger",Sle=v.forwardRef((e,t)=>{const n=Xu(ib,e.__scopeMenu),r=qy(ib,e.__scopeMenu),i=xle(ib,e.__scopeMenu),o=uF(ib,e.__scopeMenu),s=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},u=v.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.jsx(lF,{asChild:!0,...c,children:m.jsx(ule,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Tle(n.open),...e,ref:_n(t,i.onTriggerChange),onClick:f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ue(e.onPointerMove,O0(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Ue(e.onPointerLeave,O0(f=>{u();const h=n.content?.getBoundingClientRect();if(h){const g=n.content?.dataset.side,y=g==="right",E=y?-5:5,S=h[y?"left":"right"],w=h[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+E,y:f.clientY},{x:S,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:S,y:h.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Ue(e.onKeyDown,f=>{const h=o.searchRef.current!=="";e.disabled||h&&f.key===" "||Jet[r.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})});Sle.displayName=ib;var wle="MenuSubContent",Cle=v.forwardRef((e,t)=>{const n=sle($s,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Xu($s,e.__scopeMenu),s=qy($s,e.__scopeMenu),a=xle(wle,e.__scopeMenu),l=v.useRef(null),c=It(t,l);return m.jsx(I0.Provider,{scope:e.__scopeMenu,children:m.jsx(Yr,{present:r||o.open,children:m.jsx(I0.Slot,{scope:e.__scopeMenu,children:m.jsx(dF,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{s.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Ue(e.onFocusOutside,u=>{u.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Ue(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:Ue(e.onKeyDown,u=>{const f=u.currentTarget.contains(u.target),h=ett[s.dir].includes(u.key);f&&h&&(o.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});Cle.displayName=wle;function Tle(e){return e?"open":"closed"}function iw(e){return e==="indeterminate"}function mF(e){return iw(e)?"indeterminate":e?"checked":"unchecked"}function vtt(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function xtt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ett(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=xtt(e,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Stt(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o],l=t[s],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function wtt(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Stt(n,t)}function O0(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Ctt=ole,Ttt=lF,ktt=ale,Att=lle,Ntt=fF,_tt=cle,Rtt=pT,Dtt=dle,Itt=ple,Ott=mle,Mtt=ble,Ltt=yle,Ptt=vle,Ftt=Ele,Btt=Sle,jtt=Cle,hT="DropdownMenu",[$tt]=OJe(hT,[nle]),zi=nle(),[Utt,kle]=$tt(hT),Ale=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=zi(t),c=v.useRef(null),[u,f]=Us({prop:i,defaultProp:o??!1,onChange:s,caller:hT});return m.jsx(Utt,{scope:t,triggerId:xr(),triggerRef:c,contentId:xr(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:a,children:m.jsx(Ctt,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};Ale.displayName=hT;var Nle="DropdownMenuTrigger",_le=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=kle(Nle,n),s=zi(n);return m.jsx(Ttt,{asChild:!0,...s,children:m.jsx(HJe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:_n(t,o.triggerRef),onPointerDown:Ue(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:Ue(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});_le.displayName=Nle;var Htt="DropdownMenuPortal",Rle=e=>{const{__scopeDropdownMenu:t,...n}=e,r=zi(t);return m.jsx(ktt,{...r,...n})};Rle.displayName=Htt;var Dle="DropdownMenuContent",Ile=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=kle(Dle,n),o=zi(n),s=v.useRef(!1);return m.jsx(Att,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:Ue(e.onCloseAutoFocus,a=>{s.current||i.triggerRef.current?.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Ue(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ile.displayName=Dle;var ztt="DropdownMenuGroup",Vtt=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ntt,{...i,...r,ref:t})});Vtt.displayName=ztt;var Gtt="DropdownMenuLabel",Ole=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(_tt,{...i,...r,ref:t})});Ole.displayName=Gtt;var qtt="DropdownMenuItem",Mle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Rtt,{...i,...r,ref:t})});Mle.displayName=qtt;var Wtt="DropdownMenuCheckboxItem",Lle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Dtt,{...i,...r,ref:t})});Lle.displayName=Wtt;var Ytt="DropdownMenuRadioGroup",Ktt=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Itt,{...i,...r,ref:t})});Ktt.displayName=Ytt;var Xtt="DropdownMenuRadioItem",Ple=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ott,{...i,...r,ref:t})});Ple.displayName=Xtt;var Ztt="DropdownMenuItemIndicator",Fle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Mtt,{...i,...r,ref:t})});Fle.displayName=Ztt;var Qtt="DropdownMenuSeparator",Ble=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ltt,{...i,...r,ref:t})});Ble.displayName=Qtt;var Jtt="DropdownMenuArrow",ent=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ptt,{...i,...r,ref:t})});ent.displayName=Jtt;var tnt=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:o}=e,s=zi(t),[a,l]=Us({prop:r,defaultProp:o??!1,onChange:i,caller:"DropdownMenuSub"});return m.jsx(Ftt,{...s,open:a,onOpenChange:l,children:n})},nnt="DropdownMenuSubTrigger",jle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Btt,{...i,...r,ref:t})});jle.displayName=nnt;var rnt="DropdownMenuSubContent",$le=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(jtt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$le.displayName=rnt;var Ule=Ale,Hle=_le,int=Rle,gF=Ile,bF=Ole,yF=Mle,vF=Lle,zle=Ple,xF=Fle,EF=Ble,ont=tnt,SF=jle,wF=$le;const snt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ant=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),gW=e=>{const t=ant(e);return t.charAt(0).toUpperCase()+t.slice(1)},Vle=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),lnt=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var cnt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const unt=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...a},l)=>v.createElement("svg",{ref:l,...cnt,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Vle("lucide",i),...!o&&!lnt(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>v.createElement(c,u)),...Array.isArray(o)?o:[o]]));const mT=(e,t)=>{const n=v.forwardRef(({className:r,...i},o)=>v.createElement(unt,{ref:o,iconNode:t,className:Vle(`lucide-${snt(gW(e))}`,`lucide-${e}`,r),...i}));return n.displayName=gW(e),n};const dnt=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Gle=mT("check",dnt);const fnt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qle=mT("chevron-down",fnt);const pnt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wle=mT("chevron-right",pnt);const hnt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],mnt=mT("chevron-up",hnt);var gnt="Label",Yle=v.forwardRef((e,t)=>m.jsx(io.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Yle.displayName=gnt;var CF=Yle;function bnt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,ynt(i,...t)]}function ynt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Kle(e){const t=vnt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Ent);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function vnt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=wnt(i),a=Snt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xnt=Symbol("radix.slottable");function Ent(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xnt}function Snt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function wnt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cnt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xle=Cnt.reduce((e,t)=>{const n=Kle(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),gT="Popover",[Zle]=bnt(gT,[Ku]),Wy=Ku(),[Tnt,Zu]=Zle(gT),Qle=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=e,a=Wy(t),l=v.useRef(null),[c,u]=v.useState(!1),[f,h]=Us({prop:r,defaultProp:i??!1,onChange:o,caller:gT});return m.jsx($y,{...a,children:m.jsx(Tnt,{scope:t,contentId:xr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:v.useCallback(()=>h(g=>!g),[h]),hasCustomAnchor:c,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:s,children:n})})};Qle.displayName=gT;var Jle="PopoverAnchor",knt=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Zu(Jle,n),o=Wy(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=i;return v.useEffect(()=>(s(),()=>a()),[s,a]),m.jsx(Uy,{...o,...r,ref:t})});knt.displayName=Jle;var ece="PopoverTrigger",tce=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Zu(ece,n),o=Wy(n),s=It(t,i.triggerRef),a=m.jsx(Xle.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sce(i.open),...r,ref:s,onClick:Ue(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:m.jsx(Uy,{asChild:!0,...o,children:a})});tce.displayName=ece;var TF="PopoverPortal",[Ant,Nnt]=Zle(TF,{forceMount:void 0}),nce=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=Zu(TF,t);return m.jsx(Ant,{scope:t,forceMount:n,children:m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:r})})})};nce.displayName=TF;var Hh="PopoverContent",rce=v.forwardRef((e,t)=>{const n=Nnt(Hh,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=Zu(Hh,e.__scopePopover);return m.jsx(Yr,{present:r||o.open,children:o.modal?m.jsx(Rnt,{...i,ref:t}):m.jsx(Dnt,{...i,ref:t})})});rce.displayName=Hh;var _nt=Kle("PopoverContent.RemoveScroll"),Rnt=v.forwardRef((e,t)=>{const n=Zu(Hh,e.__scopePopover),r=v.useRef(null),i=It(t,r),o=v.useRef(!1);return v.useEffect(()=>{const s=r.current;if(s)return Nw(s)},[]),m.jsx(J0,{as:_nt,allowPinchZoom:!0,children:m.jsx(ice,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(e.onCloseAutoFocus,s=>{s.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ue(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ue(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),Dnt=v.forwardRef((e,t)=>{const n=Zu(Hh,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return m.jsx(ice,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;n.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),ice=v.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Zu(Hh,n),g=Wy(n);return kw(),m.jsx(Z0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:m.jsx(uT,{"data-state":sce(h.open),role:"dialog",id:h.contentId,...g,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),oce="PopoverClose",Int=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Zu(oce,n);return m.jsx(Xle.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,()=>i.onOpenChange(!1))})});Int.displayName=oce;var Ont="PopoverArrow",Mnt=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Wy(n);return m.jsx(dT,{...i,...r,ref:t})});Mnt.displayName=Ont;function sce(e){return e?"open":"closed"}var ace=Qle,lce=tce,Lnt=nce,kF=rce;function Pnt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Fnt(i,...t)]}function Fnt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function cce(e){const t=Bnt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find($nt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Bnt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Hnt(i),a=Unt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jnt=Symbol("radix.slottable");function $nt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jnt}function Unt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Hnt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var znt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ss=znt.reduce((e,t)=>{const n=cce(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function uce(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Vnt(e){const t=Gnt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Wnt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Gnt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Knt(i),a=Ynt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qnt=Symbol("radix.slottable");function Wnt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qnt}function Ynt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Knt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xnt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Znt=Xnt.reduce((e,t)=>{const n=Vnt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),dce=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Qnt="VisuallyHidden",fce=v.forwardRef((e,t)=>m.jsx(Znt.span,{...e,ref:t,style:{...dce,...e.style}}));fce.displayName=Qnt;var Jnt=fce,ert=[" ","Enter","ArrowUp","ArrowDown"],trt=[" ","Enter"],pf="Select",[bT,yT,nrt]=oF(pf),[Dm]=Pnt(pf,[nrt,Ku]),vT=Ku(),[rrt,Qu]=Dm(pf),[irt,ort]=Dm(pf),pce=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:g,form:y}=e,E=vT(t),[S,w]=v.useState(null),[T,A]=v.useState(null),[R,_]=v.useState(!1),D=ry(c),[I,M]=Us({prop:r,defaultProp:i??!1,onChange:o,caller:pf}),[j,L]=Us({prop:s,defaultProp:a,onChange:l,caller:pf}),F=v.useRef(null),H=S?y||!!S.closest("form"):!0,[Y,$]=v.useState(new Set),G=Array.from(Y).map(V=>V.props.value).join(";");return m.jsx($y,{...E,children:m.jsxs(rrt,{required:g,scope:t,trigger:S,onTriggerChange:w,valueNode:T,onValueNodeChange:A,valueNodeHasChildren:R,onValueNodeHasChildrenChange:_,contentId:xr(),value:j,onValueChange:L,open:I,onOpenChange:M,dir:D,triggerPointerDownPosRef:F,disabled:h,children:[m.jsx(bT.Provider,{scope:t,children:m.jsx(irt,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{$(X=>new Set(X).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{$(X=>{const Q=new Set(X);return Q.delete(V),Q})},[]),children:n})}),H?m.jsxs(Fce,{"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:f,value:j,onChange:V=>L(V.target.value),disabled:h,form:y,children:[j===void 0?m.jsx("option",{value:""}):null,Array.from(Y)]},G):null]})})};pce.displayName=pf;var hce="SelectTrigger",mce=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=vT(n),s=Qu(hce,n),a=s.disabled||r,l=It(t,s.onTriggerChange),c=yT(n),u=v.useRef("touch"),[f,h,g]=jce(E=>{const S=c().filter(A=>!A.disabled),w=S.find(A=>A.value===s.value),T=$ce(S,E,w);T!==void 0&&s.onValueChange(T.value)}),y=E=>{a||(s.onOpenChange(!0),g()),E&&(s.triggerPointerDownPosRef.current={x:Math.round(E.pageX),y:Math.round(E.pageY)})};return m.jsx(Uy,{asChild:!0,...o,children:m.jsx(ss.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Bce(s.value)?"":void 0,...i,ref:l,onClick:Ue(i.onClick,E=>{E.currentTarget.focus(),u.current!=="mouse"&&y(E)}),onPointerDown:Ue(i.onPointerDown,E=>{u.current=E.pointerType;const S=E.target;S.hasPointerCapture(E.pointerId)&&S.releasePointerCapture(E.pointerId),E.button===0&&E.ctrlKey===!1&&E.pointerType==="mouse"&&(y(E),E.preventDefault())}),onKeyDown:Ue(i.onKeyDown,E=>{const S=f.current!=="";!(E.ctrlKey||E.altKey||E.metaKey)&&E.key.length===1&&h(E.key),!(S&&E.key===" ")&&ert.includes(E.key)&&(y(),E.preventDefault())})})})});mce.displayName=hce;var gce="SelectValue",bce=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...a}=e,l=Qu(gce,n),{onValueNodeHasChildrenChange:c}=l,u=o!==void 0,f=It(t,l.onValueNodeChange);return Sr(()=>{c(u)},[c,u]),m.jsx(ss.span,{...a,ref:f,style:{pointerEvents:"none"},children:Bce(l.value)?m.jsx(m.Fragment,{children:s}):o})});bce.displayName=gce;var srt="SelectIcon",yce=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return m.jsx(ss.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});yce.displayName=srt;var art="SelectPortal",vce=e=>m.jsx(nm,{asChild:!0,...e});vce.displayName=art;var hf="SelectContent",xce=v.forwardRef((e,t)=>{const n=Qu(hf,e.__scopeSelect),[r,i]=v.useState();if(Sr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?Wr.createPortal(m.jsx(Ece,{scope:e.__scopeSelect,children:m.jsx(bT.Slot,{scope:e.__scopeSelect,children:m.jsx("div",{children:e.children})})}),o):null}return m.jsx(Sce,{...e,ref:t})});xce.displayName=hf;var na=10,[Ece,Ju]=Dm(hf),lrt="SelectContentImpl",crt=cce("SelectContent.RemoveScroll"),Sce=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:y,hideWhenDetached:E,avoidCollisions:S,...w}=e,T=Qu(hf,n),[A,R]=v.useState(null),[_,D]=v.useState(null),I=It(t,te=>R(te)),[M,j]=v.useState(null),[L,F]=v.useState(null),H=yT(n),[Y,$]=v.useState(!1),G=v.useRef(!1);v.useEffect(()=>{if(A)return Nw(A)},[A]),kw();const V=v.useCallback(te=>{const[oe,...ue]=H().map(ke=>ke.ref.current),[Te]=ue.slice(-1),Ie=document.activeElement;for(const ke of te)if(ke===Ie||(ke?.scrollIntoView({block:"nearest"}),ke===oe&&_&&(_.scrollTop=0),ke===Te&&_&&(_.scrollTop=_.scrollHeight),ke?.focus(),document.activeElement!==Ie))return},[H,_]),X=v.useCallback(()=>V([M,A]),[V,M,A]);v.useEffect(()=>{Y&&X()},[Y,X]);const{onOpenChange:Q,triggerPointerDownPosRef:J}=T;v.useEffect(()=>{if(A){let te={x:0,y:0};const oe=Te=>{te={x:Math.abs(Math.round(Te.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(Te.pageY)-(J.current?.y??0))}},ue=Te=>{te.x<=10&&te.y<=10?Te.preventDefault():A.contains(Te.target)||Q(!1),document.removeEventListener("pointermove",oe),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",ue,{capture:!0})}}},[A,Q,J]),v.useEffect(()=>{const te=()=>Q(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[Q]);const[B,W]=jce(te=>{const oe=H().filter(Ie=>!Ie.disabled),ue=oe.find(Ie=>Ie.ref.current===document.activeElement),Te=$ce(oe,te,ue);Te&&setTimeout(()=>Te.ref.current.focus())}),K=v.useCallback((te,oe,ue)=>{const Te=!G.current&&!ue;(T.value!==void 0&&T.value===oe||Te)&&(j(te),Te&&(G.current=!0))},[T.value]),P=v.useCallback(()=>A?.focus(),[A]),ce=v.useCallback((te,oe,ue)=>{const Te=!G.current&&!ue;(T.value!==void 0&&T.value===oe||Te)&&F(te)},[T.value]),le=r==="popper"?fI:wce,se=le===fI?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:y,hideWhenDetached:E,avoidCollisions:S}:{};return m.jsx(Ece,{scope:n,content:A,viewport:_,onViewportChange:D,itemRefCallback:K,selectedItem:M,onItemLeave:P,itemTextRefCallback:ce,focusSelectedItem:X,selectedItemText:L,position:r,isPositioned:Y,searchRef:B,children:m.jsx(J0,{as:crt,allowPinchZoom:!0,children:m.jsx(Z0,{asChild:!0,trapped:T.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Ue(i,te=>{T.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:m.jsx(le,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:te=>te.preventDefault(),...w,...se,onPlaced:()=>$(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Ue(w.onKeyDown,te=>{const oe=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!oe&&te.key.length===1&&W(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let Te=H().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(te.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Ie=te.target,ke=Te.indexOf(Ie);Te=Te.slice(ke+1)}setTimeout(()=>V(Te)),te.preventDefault()}})})})})})})});Sce.displayName=lrt;var urt="SelectItemAlignedPosition",wce=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=Qu(hf,n),s=Ju(hf,n),[a,l]=v.useState(null),[c,u]=v.useState(null),f=It(t,I=>u(I)),h=yT(n),g=v.useRef(!1),y=v.useRef(!0),{viewport:E,selectedItem:S,selectedItemText:w,focusSelectedItem:T}=s,A=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&E&&S&&w){const I=o.trigger.getBoundingClientRect(),M=c.getBoundingClientRect(),j=o.valueNode.getBoundingClientRect(),L=w.getBoundingClientRect();if(o.dir!=="rtl"){const Ie=L.left-M.left,ke=j.left-Ie,tt=I.left-ke,rt=I.width+tt,ze=Math.max(rt,M.width),dn=window.innerWidth-na,nt=vR(ke,[na,Math.max(na,dn-ze)]);a.style.minWidth=rt+"px",a.style.left=nt+"px"}else{const Ie=M.right-L.right,ke=window.innerWidth-j.right-Ie,tt=window.innerWidth-I.right-ke,rt=I.width+tt,ze=Math.max(rt,M.width),dn=window.innerWidth-na,nt=vR(ke,[na,Math.max(na,dn-ze)]);a.style.minWidth=rt+"px",a.style.right=nt+"px"}const F=h(),H=window.innerHeight-na*2,Y=E.scrollHeight,$=window.getComputedStyle(c),G=parseInt($.borderTopWidth,10),V=parseInt($.paddingTop,10),X=parseInt($.borderBottomWidth,10),Q=parseInt($.paddingBottom,10),J=G+V+Y+Q+X,B=Math.min(S.offsetHeight*5,J),W=window.getComputedStyle(E),K=parseInt(W.paddingTop,10),P=parseInt(W.paddingBottom,10),ce=I.top+I.height/2-na,le=H-ce,se=S.offsetHeight/2,te=S.offsetTop+se,oe=G+V+te,ue=J-oe;if(oe<=ce){const Ie=F.length>0&&S===F[F.length-1].ref.current;a.style.bottom="0px";const ke=c.clientHeight-E.offsetTop-E.offsetHeight,tt=Math.max(le,se+(Ie?P:0)+ke+X),rt=oe+tt;a.style.height=rt+"px"}else{const Ie=F.length>0&&S===F[0].ref.current;a.style.top="0px";const tt=Math.max(ce,G+E.offsetTop+(Ie?K:0)+se)+ue;a.style.height=tt+"px",E.scrollTop=oe-ce+E.offsetTop}a.style.margin=`${na}px 0`,a.style.minHeight=B+"px",a.style.maxHeight=H+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,a,c,E,S,w,o.dir,r]);Sr(()=>A(),[A]);const[R,_]=v.useState();Sr(()=>{c&&_(window.getComputedStyle(c).zIndex)},[c]);const D=v.useCallback(I=>{I&&y.current===!0&&(A(),T?.(),y.current=!1)},[A,T]);return m.jsx(frt,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:D,children:m.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:m.jsx(ss.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});wce.displayName=urt;var drt="SelectPopperPosition",fI=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=na,...o}=e,s=vT(n);return m.jsx(uT,{...s,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});fI.displayName=drt;var[frt,AF]=Dm(hf,{}),pI="SelectViewport",Cce=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=Ju(pI,n),s=AF(pI,n),a=It(t,o.onViewportChange),l=v.useRef(0);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),m.jsx(bT.Slot,{scope:n,children:m.jsx(ss.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Ue(i.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=s;if(h?.current&&f){const g=Math.abs(l.current-u.scrollTop);if(g>0){const y=window.innerHeight-na*2,E=parseFloat(f.style.minHeight),S=parseFloat(f.style.height),w=Math.max(E,S);if(w<y){const T=w+g,A=Math.min(y,T),R=T-A;f.style.height=A+"px",f.style.bottom==="0px"&&(u.scrollTop=R>0?R:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Cce.displayName=pI;var Tce="SelectGroup",[prt,hrt]=Dm(Tce),mrt=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=xr();return m.jsx(prt,{scope:n,id:i,children:m.jsx(ss.div,{role:"group","aria-labelledby":i,...r,ref:t})})});mrt.displayName=Tce;var kce="SelectLabel",Ace=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=hrt(kce,n);return m.jsx(ss.div,{id:i.id,...r,ref:t})});Ace.displayName=kce;var ow="SelectItem",[grt,Nce]=Dm(ow),_ce=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=e,a=Qu(ow,n),l=Ju(ow,n),c=a.value===r,[u,f]=v.useState(o??""),[h,g]=v.useState(!1),y=It(t,T=>l.itemRefCallback?.(T,r,i)),E=xr(),S=v.useRef("touch"),w=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.jsx(grt,{scope:n,value:r,disabled:i,textId:E,isSelected:c,onItemTextChange:v.useCallback(T=>{f(A=>A||(T?.textContent??"").trim())},[]),children:m.jsx(bT.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:m.jsx(ss.div,{role:"option","aria-labelledby":E,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...s,ref:y,onFocus:Ue(s.onFocus,()=>g(!0)),onBlur:Ue(s.onBlur,()=>g(!1)),onClick:Ue(s.onClick,()=>{S.current!=="mouse"&&w()}),onPointerUp:Ue(s.onPointerUp,()=>{S.current==="mouse"&&w()}),onPointerDown:Ue(s.onPointerDown,T=>{S.current=T.pointerType}),onPointerMove:Ue(s.onPointerMove,T=>{S.current=T.pointerType,i?l.onItemLeave?.():S.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(s.onPointerLeave,T=>{T.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:Ue(s.onKeyDown,T=>{l.searchRef?.current!==""&&T.key===" "||(trt.includes(T.key)&&w(),T.key===" "&&T.preventDefault())})})})})});_ce.displayName=ow;var ob="SelectItemText",Rce=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,s=Qu(ob,n),a=Ju(ob,n),l=Nce(ob,n),c=ort(ob,n),[u,f]=v.useState(null),h=It(t,w=>f(w),l.onItemTextChange,w=>a.itemTextRefCallback?.(w,l.value,l.disabled)),g=u?.textContent,y=v.useMemo(()=>m.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:E,onNativeOptionRemove:S}=c;return Sr(()=>(E(y),()=>S(y)),[E,S,y]),m.jsxs(m.Fragment,{children:[m.jsx(ss.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Wr.createPortal(o.children,s.valueNode):null]})});Rce.displayName=ob;var Dce="SelectItemIndicator",Ice=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Nce(Dce,n).isSelected?m.jsx(ss.span,{"aria-hidden":!0,...r,ref:t}):null});Ice.displayName=Dce;var hI="SelectScrollUpButton",Oce=v.forwardRef((e,t)=>{const n=Ju(hI,e.__scopeSelect),r=AF(hI,e.__scopeSelect),[i,o]=v.useState(!1),s=It(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;o(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?m.jsx(Lce,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Oce.displayName=hI;var mI="SelectScrollDownButton",Mce=v.forwardRef((e,t)=>{const n=Ju(mI,e.__scopeSelect),r=AF(mI,e.__scopeSelect),[i,o]=v.useState(!1),s=It(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;o(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?m.jsx(Lce,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Mce.displayName=mI;var Lce=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=Ju("SelectScrollButton",n),s=v.useRef(null),a=yT(n),l=v.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return v.useEffect(()=>()=>l(),[l]),Sr(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),m.jsx(ss.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Ue(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Ue(i.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Ue(i.onPointerLeave,()=>{l()})})}),brt="SelectSeparator",Pce=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.jsx(ss.div,{"aria-hidden":!0,...r,ref:t})});Pce.displayName=brt;var gI="SelectArrow",yrt=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=vT(n),o=Qu(gI,n),s=Ju(gI,n);return o.open&&s.position==="popper"?m.jsx(dT,{...i,...r,ref:t}):null});yrt.displayName=gI;var vrt="SelectBubbleInput",Fce=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=v.useRef(null),o=It(r,i),s=uce(t);return v.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==t&&u){const f=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(f)}},[s,t]),m.jsx(ss.select,{...n,style:{...dce,...n.style},ref:o,defaultValue:t})});Fce.displayName=vrt;function Bce(e){return e===""||e===void 0}function jce(e){const t=Gr(e),n=v.useRef(""),r=v.useRef(0),i=v.useCallback(s=>{const a=n.current+s;t(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function $ce(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=xrt(e,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function xrt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Uce=pce,NF=mce,Hce=bce,zce=yce,Ert=vce,_F=xce,Vce=Cce,Gce=Ace,RF=_ce,qce=Rce,Wce=Ice,DF=Oce,IF=Mce,Yce=Pce;function Srt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,wrt(i,...t)]}function wrt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Crt(e){const t=Trt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Art);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Trt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=_rt(i),a=Nrt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var krt=Symbol("radix.slottable");function Art(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===krt}function Nrt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function _rt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xT=Rrt.reduce((e,t)=>{const n=Crt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ET="Tabs",[Drt]=Srt(ET,[fT]),Kce=fT(),[Irt,OF]=Drt(ET),Xce=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=ry(a),[f,h]=Us({prop:r,onChange:i,defaultProp:o??"",caller:ET});return m.jsx(Irt,{scope:n,baseId:xr(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l,children:m.jsx(xT.div,{dir:u,"data-orientation":s,...c,ref:t})})});Xce.displayName=ET;var Zce="TabsList",Qce=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=OF(Zce,n),s=Kce(n);return m.jsx(Jae,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:m.jsx(xT.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Qce.displayName=Zce;var Jce="TabsTrigger",eue=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=OF(Jce,n),a=Kce(n),l=rue(s.baseId,r),c=iue(s.baseId,r),u=r===s.value;return m.jsx(ele,{asChild:!0,...a,focusable:!i,active:u,children:m.jsx(xT.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:Ue(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Ue(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Ue(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!i&&f&&s.onValueChange(r)})})})});eue.displayName=Jce;var tue="TabsContent",nue=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=OF(tue,n),l=rue(a.baseId,r),c=iue(a.baseId,r),u=r===a.value,f=v.useRef(u);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.jsx(Yr,{present:i||u,children:({present:h})=>m.jsx(xT.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});nue.displayName=tue;function rue(e,t){return`${e}-trigger-${t}`}function iue(e,t){return`${e}-content-${t}`}var Ort=Xce,Mrt=Qce,Lrt=eue,Prt=nue;function Frt(e){const t=Brt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find($rt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Brt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Hrt(i),a=Urt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jrt=Symbol("radix.slottable");function $rt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jrt}function Urt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Hrt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var zrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vrt=zrt.reduce((e,t)=>{const n=Frt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),oue="Toggle",sue=v.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...o}=e,[s,a]=Us({prop:n,onChange:i,defaultProp:r??!1,caller:oue});return m.jsx(Vrt.button,{type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":e.disabled?"":void 0,...o,ref:t,onClick:Ue(e.onClick,()=>{e.disabled||a(!s)})})});sue.displayName=oue;var Grt=sue;function qrt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Wrt(i,...t)]}function Wrt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Yrt(e){const t=Krt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Zrt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Krt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Jrt(i),a=Qrt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var aue=Symbol("radix.slottable");function Xrt(e){const t=({children:n})=>m.jsx(m.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=aue,t}function Zrt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===aue}function Qrt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Jrt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var eit=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tit=eit.reduce((e,t)=>{const n=Yrt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),[ST]=qrt("Tooltip",[Ku]),wT=Ku(),lue="TooltipProvider",nit=700,bI="tooltip.open",[rit,MF]=ST(lue),cue=e=>{const{__scopeTooltip:t,delayDuration:n=nit,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=e,s=v.useRef(!0),a=v.useRef(!1),l=v.useRef(0);return v.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),m.jsx(rit,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(l.current),s.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:v.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:o})};cue.displayName=lue;var M0="Tooltip",[iit,Yy]=ST(M0),uue=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:s,delayDuration:a}=e,l=MF(M0,e.__scopeTooltip),c=wT(t),[u,f]=v.useState(null),h=xr(),g=v.useRef(0),y=s??l.disableHoverableContent,E=a??l.delayDuration,S=v.useRef(!1),[w,T]=Us({prop:r,defaultProp:i??!1,onChange:I=>{I?(l.onOpen(),document.dispatchEvent(new CustomEvent(bI))):l.onClose(),o?.(I)},caller:M0}),A=v.useMemo(()=>w?S.current?"delayed-open":"instant-open":"closed",[w]),R=v.useCallback(()=>{window.clearTimeout(g.current),g.current=0,S.current=!1,T(!0)},[T]),_=v.useCallback(()=>{window.clearTimeout(g.current),g.current=0,T(!1)},[T]),D=v.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{S.current=!0,T(!0),g.current=0},E)},[E,T]);return v.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),m.jsx($y,{...c,children:m.jsx(iit,{scope:t,contentId:h,open:w,stateAttribute:A,trigger:u,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{l.isOpenDelayedRef.current?D():R()},[l.isOpenDelayedRef,D,R]),onTriggerLeave:v.useCallback(()=>{y?_():(window.clearTimeout(g.current),g.current=0)},[_,y]),onOpen:R,onClose:_,disableHoverableContent:y,children:n})})};uue.displayName=M0;var yI="TooltipTrigger",due=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Yy(yI,n),o=MF(yI,n),s=wT(n),a=v.useRef(null),l=It(t,a,i.onTriggerChange),c=v.useRef(!1),u=v.useRef(!1),f=v.useCallback(()=>c.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.jsx(Uy,{asChild:!0,...s,children:m.jsx(tit.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Ue(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ue(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ue(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ue(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ue(e.onBlur,i.onClose),onClick:Ue(e.onClick,i.onClose)})})});due.displayName=yI;var LF="TooltipPortal",[oit,sit]=ST(LF,{forceMount:void 0}),fue=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,o=Yy(LF,t);return m.jsx(oit,{scope:t,forceMount:n,children:m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:r})})})};fue.displayName=LF;var zh="TooltipContent",pue=v.forwardRef((e,t)=>{const n=sit(zh,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,s=Yy(zh,e.__scopeTooltip);return m.jsx(Yr,{present:r||s.open,children:s.disableHoverableContent?m.jsx(hue,{side:i,...o,ref:t}):m.jsx(ait,{side:i,...o,ref:t})})}),ait=v.forwardRef((e,t)=>{const n=Yy(zh,e.__scopeTooltip),r=MF(zh,e.__scopeTooltip),i=v.useRef(null),o=It(t,i),[s,a]=v.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{a(null),f(!1)},[f]),g=v.useCallback((y,E)=>{const S=y.currentTarget,w={x:y.clientX,y:y.clientY},T=dit(w,S.getBoundingClientRect()),A=fit(w,T),R=pit(E.getBoundingClientRect()),_=mit([...A,...R]);a(_),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(l&&u){const y=S=>g(S,u),E=S=>g(S,l);return l.addEventListener("pointerleave",y),u.addEventListener("pointerleave",E),()=>{l.removeEventListener("pointerleave",y),u.removeEventListener("pointerleave",E)}}},[l,u,g,h]),v.useEffect(()=>{if(s){const y=E=>{const S=E.target,w={x:E.clientX,y:E.clientY},T=l?.contains(S)||u?.contains(S),A=!hit(w,s);T?h():A&&(h(),c())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,u,s,c,h]),m.jsx(hue,{...e,ref:o})}),[lit,cit]=ST(M0,{isInside:!1}),uit=Xrt("TooltipContent"),hue=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,l=Yy(zh,n),c=wT(n),{onClose:u}=l;return v.useEffect(()=>(document.addEventListener(bI,u),()=>document.removeEventListener(bI,u)),[u]),v.useEffect(()=>{if(l.trigger){const f=h=>{h.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:m.jsxs(uT,{"data-state":l.stateAttribute,...c,...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:[m.jsx(uit,{children:r}),m.jsx(lit,{scope:n,isInside:!0,children:m.jsx(Jnt,{id:l.contentId,role:"tooltip",children:i||r})})]})})});pue.displayName=zh;var mue="TooltipArrow",gue=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=wT(n);return cit(mue,n).isInside?null:m.jsx(dT,{...i,...r,ref:t})});gue.displayName=mue;function dit(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function fit(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 pit(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function hit(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o],l=t[s],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function mit(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),git(t)}function git(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}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 bue=cue,yue=uue,vue=due,bit=fue,PF=pue,yit=gue;function et(...e){return IJe(NO(e))}function vit({className:e,...t}){return m.jsx(QQe,{"data-slot":"avatar",className:et("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function xit({className:e,...t}){return m.jsx(JQe,{"data-slot":"avatar-image",className:et("aspect-square size-full",e),...t})}function Eit({className:e,...t}){return m.jsx(eJe,{"data-slot":"avatar-fallback",className:et("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const Sit=cc("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function wit({className:e,variant:t,asChild:n=!1,...r}){return m.jsx(n?Hu:"span",{"data-slot":"badge",className:et(Sit({variant:t}),e),...r})}const Cit=cc("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Tit({className:e,variant:t,size:n,asChild:r=!1,...i}){return m.jsx(r?Hu:"button",{"data-slot":"button",className:et(Cit({variant:t,size:n,className:e})),...i})}function kit({className:e,...t}){return m.jsx("div",{"data-slot":"card",className:et("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ait({className:e,...t}){return m.jsx("div",{"data-slot":"card-content",className:et("px-6",e),...t})}function Nit({...e}){return m.jsx(Ule,{"data-slot":"dropdown-menu",...e})}function _it({...e}){return m.jsx(Hle,{"data-slot":"dropdown-menu-trigger",...e})}function Rit({className:e,sideOffset:t=4,...n}){return m.jsx(gF,{"data-slot":"dropdown-menu-content",sideOffset:t,className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",e),...n})}function Dit({className:e,inset:t,variant:n="default",...r}){return m.jsx(yF,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function Iit({className:e,children:t,checked:n,...r}){return m.jsxs(vF,{"data-slot":"dropdown-menu-checkbox-item",className:et("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),checked:n,...r,children:[m.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:m.jsx(xF,{children:m.jsx(Gle,{className:"size-4"})})}),t]})}function Oit({className:e,inset:t,...n}){return m.jsx(bF,{"data-slot":"dropdown-menu-label","data-inset":t,className:et("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Mit({className:e,...t}){return m.jsx(EF,{"data-slot":"dropdown-menu-separator",className:et("bg-border -mx-1 my-1 h-px",e),...t})}function Lit({...e}){return m.jsx(ont,{"data-slot":"dropdown-menu-sub",...e})}function Pit({className:e,inset:t,children:n,...r}){return m.jsxs(SF,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:et("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",e),...r,children:[n,m.jsx(Wle,{className:"ml-auto size-4"})]})}function Fit({className:e,...t}){return m.jsx(wF,{"data-slot":"dropdown-menu-sub-content",className:et("bg-popover text-popover-foreground 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-[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 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}function Bit({className:e,...t}){return m.jsx(CF,{"data-slot":"label",className:et("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...t})}const jit=TQe;v.createContext({});v.createContext({});function $it({className:e,type:t,...n}){return m.jsx("input",{type:t,"data-slot":"input",className:et("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function Uit({...e}){return m.jsx(ace,{"data-slot":"popover",...e})}function Hit({...e}){return m.jsx(lce,{"data-slot":"popover-trigger",...e})}function zit({className:e,align:t="center",sideOffset:n=4,...r}){return m.jsx(kF,{"data-slot":"popover-content",align:t,sideOffset:n,className:et("bg-popover text-popover-foreground 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-[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 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",e),...r})}function Vit({...e}){return m.jsx(Uce,{"data-slot":"select",...e})}function Git({...e}){return m.jsx(Hce,{"data-slot":"select-value",...e})}function qit({className:e,size:t="default",children:n,...r}){return m.jsxs(NF,{"data-slot":"select-trigger","data-size":t,className:et("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,m.jsx(zce,{asChild:!0,children:m.jsx(qle,{className:"size-4 opacity-50"})})]})}function Wit({className:e,children:t,position:n="popper",...r}){return m.jsxs(_F,{"data-slot":"select-content",className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[m.jsx(Kit,{}),m.jsx(Vce,{className:et("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),m.jsx(Xit,{})]})}function Yit({className:e,children:t,...n}){return m.jsxs(RF,{"data-slot":"select-item",className:et("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[m.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:m.jsx(Wce,{children:m.jsx(Gle,{className:"size-4"})})}),m.jsx(qce,{children:t})]})}function Kit({className:e,...t}){return m.jsx(DF,{"data-slot":"select-scroll-up-button",className:et("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(mnt,{className:"size-4"})})}function Xit({className:e,...t}){return m.jsx(IF,{"data-slot":"select-scroll-down-button",className:et("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(qle,{className:"size-4"})})}function Zit({className:e,...t}){return m.jsx("div",{"data-slot":"skeleton",className:et("bg-accent animate-pulse rounded-md",e),...t})}function Qit({className:e,...t}){return m.jsx(Ort,{"data-slot":"tabs",className:et("flex flex-col gap-2",e),...t})}function Jit({className:e,...t}){return m.jsx(Mrt,{"data-slot":"tabs-list",className:et("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function eot({className:e,...t}){return m.jsx(Lrt,{"data-slot":"tabs-trigger",className:et("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...t})}function tot({className:e,...t}){return m.jsx(Prt,{"data-slot":"tabs-content",className:et("flex-1 outline-none",e),...t})}const not=cc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function rot({className:e,variant:t,size:n,...r}){return m.jsx(Grt,{"data-slot":"toggle",className:et(not({variant:t,size:n,className:e})),...r})}function xue({delayDuration:e=0,...t}){return m.jsx(bue,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function iot({...e}){return m.jsx(xue,{children:m.jsx(yue,{"data-slot":"tooltip",...e})})}function oot({...e}){return m.jsx(vue,{"data-slot":"tooltip-trigger",...e})}function sot({className:e,sideOffset:t=0,children:n,...r}){return m.jsxs(PF,{"data-slot":"tooltip-content",sideOffset:t,className:et("bg-primary 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 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",e),...r,children:[n,m.jsx(yit,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}const aot={Avatar:{Avatar:vit,AvatarFallback:Eit,AvatarImage:xit},Badge:{Badge:wit},Button:{Button:Tit},Card:{Card:kit,CardContent:Ait},DropdownMenu:{DropdownMenu:Nit,DropdownMenuCheckboxItem:Iit,DropdownMenuContent:Rit,DropdownMenuItem:Dit,DropdownMenuLabel:Oit,DropdownMenuSeparator:Mit,DropdownMenuSub:Lit,DropdownMenuSubContent:Fit,DropdownMenuSubTrigger:Pit,DropdownMenuTrigger:_it},Form:{Form:jit},Input:{Input:$it},Label:{Label:Bit},Popover:{Popover:Uit,PopoverContent:zit,PopoverTrigger:Hit},Select:{Select:Vit,SelectContent:Wit,SelectItem:Yit,SelectTrigger:qit,SelectValue:Git},Skeleton:{Skeleton:Zit},Tabs:{Tabs:Qit,TabsContent:tot,TabsList:Jit,TabsTrigger:eot},Toggle:{Toggle:rot},Tooltip:{Tooltip:iot,TooltipContent:sot,TooltipProvider:xue,TooltipTrigger:oot}},Eue=v.createContext(void 0);function Rn(){return v.useContext(Eue)}const lot=e=>{const{children:t,...n}=e;_t(n);const r=Rn(),i=VQe();return m.jsx(r.Form.Form,{...i,children:t})},cot=v.forwardRef((e,t)=>{const{className:n,name:r,label:i,variant:o,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:f,onChange:h,onSubmit:g,autoComplete:y,rightSection:E,...S}=e;_t(S);const w=Rn();return m.jsxs("div",{className:et(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,m.jsxs("div",{className:"flex-1",children:[i&&m.jsx(w.Label.Label,{htmlFor:i,children:i}),m.jsx(w.Input.Input,{className:et(n,"h-auto border-none p-0"),id:i,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:f,onChange:h,onSubmit:g,ref:t})]}),E]})}),uot=e=>v.forwardRef((t,n)=>m.jsx(e,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{const i=new PointerEvent("pointerdown",r.nativeEvent);i.fakeEvent=!0,r.target.dispatchEvent(i)},...t,ref:n})),dot=e=>{const{children:t,onOpenChange:n,position:r,sub:i,...o}=e;_t(o);const s=Rn();return i?m.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:t}):m.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:t})},fot=e=>{const{children:t,sub:n,...r}=e;_t(r);const i=Rn(),o=v.useMemo(()=>uot(i.DropdownMenu.DropdownMenuTrigger),[i.DropdownMenu.DropdownMenuTrigger]);return n?m.jsx(i.DropdownMenu.DropdownMenuSubTrigger,{children:t}):m.jsx(o,{asChild:!0,...r,children:t})},pot=v.forwardRef((e,t)=>{const{className:n,children:r,sub:i,...o}=e;_t(o);const s=Rn();return i?m.jsx(s.DropdownMenu.DropdownMenuSubContent,{className:n,ref:t,children:r}):m.jsx(s.DropdownMenu.DropdownMenuContent,{className:n,ref:t,children:r})}),hot=v.forwardRef((e,t)=>{const{className:n,children:r,icon:i,checked:o,subTrigger:s,onClick:a,...l}=e;_t(l);const c=Rn();return s?m.jsxs(m.Fragment,{children:[i,r]}):o!==void 0?m.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:et(n,"gap-1",o?"":"px-2"),ref:t,checked:o,onClick:a,...l,children:[i,r]}):m.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:t,onClick:a,...l,children:[i,r,s&&m.jsx(Wle,{className:"ml-auto h-4 w-4"})]})}),mot=v.forwardRef((e,t)=>{const{className:n,...r}=e;_t(r);const i=Rn();return m.jsx(i.DropdownMenu.DropdownMenuSeparator,{className:n,ref:t})}),got=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;_t(i);const o=Rn();return m.jsx(o.DropdownMenu.DropdownMenuLabel,{className:n,ref:t,children:r})}),bot=v.forwardRef((e,t)=>{const{className:n,children:r,icon:i,onClick:o,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;_t(u,!1);const f=Rn();return m.jsxs(f.Button.Button,{variant:"ghost",className:et(n,"text-gray-400"),ref:t,"aria-label":c,onClick:o,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[i,r]})}),yot=v.forwardRef((e,t)=>{const{className:n,tabs:r,defaultOpenTab:i,openTab:o,setOpenTab:s,loading:a,...l}=e;_t(l);const c=Rn();return m.jsxs(c.Tabs.Tabs,{className:et(n,"bg-popover max-w-screen rounded-lg p-2"),ref:t,value:o,defaultValue:i,onValueChange:s,children:[m.jsx(c.Tabs.TabsList,{children:r.map(u=>m.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>m.jsx(c.Tabs.TabsContent,{value:u.name,children:m.jsx(c.Card.Card,{children:m.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),vot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et(n,"flex flex-col items-start justify-center gap-2"),ref:t,children:r})}),xot=v.forwardRef((e,t)=>{const{className:n,value:r,placeholder:i,onKeyDown:o,onChange:s,...a}=e;_t(a);const l=Rn();return m.jsx(l.Input.Input,{"data-test":"embed-input",className:et(n,"w-80 max-w-full"),ref:t,value:r,placeholder:i,onKeyDown:o,onChange:s})}),Eot=e=>{const{children:t,open:n,onOpenChange:r,position:i,...o}=e;_t(o);const s=Rn();return m.jsx(s.Popover.Popover,{open:n,onOpenChange:r,children:t})},Sot=v.forwardRef((e,t)=>{const{children:n,...r}=e;_t(r);const i=Rn();return m.jsx(i.Popover.PopoverTrigger,{ref:t,asChild:!0,children:n})}),wot=v.forwardRef((e,t)=>{const{className:n,variant:r,children:i,...o}=e;_t(o);const s=Rn();return m.jsx(s.Popover.PopoverContent,{sideOffset:8,className:et(n,"z-[10000] flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:t,children:i})}),Cot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i,!1),m.jsx("div",{className:n,ref:t,...i,children:r})}),Tot=v.forwardRef((e,t)=>{const{className:n,children:r,icon:i,onClick:o,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;_t(u,!1);const f=Rn();return m.jsxs(f.Button.Button,{variant:"ghost",className:et(n,"text-gray-400"),ref:t,"aria-label":c,onClick:o,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[i,r]})}),kot=v.forwardRef((e,t)=>{const{className:n,children:r,id:i,columns:o,...s}=e;return _t(s),m.jsx("div",{className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${o}, 1fr)`},ref:t,id:i,role:"grid",children:r})}),Aot=v.forwardRef((e,t)=>{const{className:n,children:r,columns:i,...o}=e;return _t(o),m.jsx("div",{className:n,style:{gridColumn:`1 / ${i+1}`},ref:t,children:r})}),Not=v.forwardRef((e,t)=>{const{className:n,children:r,id:i,...o}=e;return _t(o),m.jsx("div",{id:i,role:"listbox",className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:t,children:r})}),_ot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:t,children:m.jsx("div",{children:r})})}),Rot=v.forwardRef((e,t)=>{const n=Rn(),{className:r,item:i,isSelected:o,onClick:s,id:a,...l}=e;_t(l);const c=v.useRef(null);return v.useEffect(()=>{if(!c.current||!o)return;const u=fae(c.current,c.current.closest(".bn-suggestion-menu, #ai-suggestion-menu"));u==="top"?c.current.scrollIntoView(!0):u==="bottom"&&c.current.scrollIntoView(!1)},[o]),m.jsxs("div",{className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",e.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:pae([t,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":o||void 0,children:[i.icon&&m.jsx("div",{className:et("p-3",e.item.size==="small"?"p-0":"",r),"data-position":"left",children:i.icon}),m.jsxs("div",{className:"flex-1",children:[m.jsx("div",{className:et("text-base",e.item.size==="small"?"text-sm":"",r),children:i.title}),m.jsx("div",{className:et("text-xs",e.item.size==="small"?"hidden":"",r),children:i.subtext})]}),i.badge&&m.jsx("div",{"data-position":"right",className:"text-xs",children:m.jsx(n.Badge.Badge,{variant:"secondary",children:i.badge})})]})}),Dot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:t,children:r})}),Iot=v.forwardRef((e,t)=>{const{className:n,...r}=e;return _t(r),m.jsx("div",{className:et(n,"animate-spin"),ref:t,children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:m.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),Oot=v.forwardRef((e,t)=>{const{className:n,children:r,onMouseDown:i,onClick:o,...s}=e;_t(s,!1);const a=Rn();return m.jsx(a.Button.Button,{variant:"ghost",className:et(n,"h-full w-full p-0 text-gray-400",n!=null&&n.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n!=null&&n.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:t,onClick:o,onMouseDown:i,...s,children:r})}),Mot=v.forwardRef((e,t)=>{const{className:n,children:r,draggable:i,onDragStart:o,onDragEnd:s,style:a,label:l,...c}=e;_t(c,!1);const u=Rn();return m.jsx(u.Button.Button,{variant:"ghost",className:et(n,"h-fit w-fit p-0 text-gray-400"),ref:t,"aria-label":l,draggable:i,onDragStart:o,onDragEnd:s,style:a,...c,children:r})}),x_=v.forwardRef((e,t)=>{const{className:n,children:r,onMouseEnter:i,onMouseLeave:o,variant:s,...a}=e;_t(a);const l=Rn();return m.jsx(l.Tooltip.TooltipProvider,{delayDuration:0,children:m.jsx("div",{className:et(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:t,onMouseEnter:i,onMouseLeave:o,children:r})})}),E_=v.forwardRef((e,t)=>{const{className:n,children:r,mainTooltip:i,secondaryTooltip:o,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:f,...h}=e;_t(h,!1);const g=Rn(),y=a===void 0?m.jsxs(g.Button.Button,{className:et(n,f==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:f==="compact"?"sm":"default",disabled:l,onClick:c,ref:t,"aria-label":u,...h,children:[s,r]}):m.jsxs(g.Toggle.Toggle,{className:et(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",f==="compact"?"h-6 min-w-6 p-0":""),size:f==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:t,...h,children:[s,r]});return m.jsxs(g.Tooltip.Tooltip,{children:[m.jsx(g.Tooltip.TooltipTrigger,{asChild:!0,children:y}),m.jsxs(g.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[m.jsx("span",{children:i}),o&&m.jsx("span",{children:o})]})]})}),S_=v.forwardRef((e,t)=>{const{className:n,items:r,isDisabled:i,...o}=e;_t(o);const s=Rn(),a=c=>m.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?m.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>{var u,f;return(f=(u=r.find(h=>h.text===c)).onClick)==null?void 0:f.call(u)},disabled:i,children:[m.jsx(s.Select.SelectTrigger,{className:"border-none",children:m.jsx(s.Select.SelectValue,{})}),m.jsx(s.Select.SelectContent,{className:n,ref:t,children:r.map(c=>m.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:m.jsx(a,{...c})},c.text))})]}):null}),Lot=v.forwardRef((e,t)=>{const{className:n,children:r,selected:i,headerText:o,onFocus:s,onBlur:a,tabIndex:l,...c}=e;_t(c);const u=Rn();return m.jsxs(u.Card.Card,{className:et(n,"w-[300px]",i?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:t,children:[o&&m.jsx("div",{className:"px-4 pt-4 text-sm italic",children:o}),r]})}),Pot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et(n,"p-4",n!=null&&n.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:t,children:r})}),Fot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;_t(i,!1);const o=Rn();return m.jsx(o.Button.Button,{className:et(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:t,children:r})}),Bot=v.forwardRef((e,t)=>{const{authorInfo:n,timeString:r,edited:i,...o}=e,s=Rt();_t(o,!1);const a=Rn();return n==="loading"?m.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[m.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),m.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):m.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[m.jsxs(a.Avatar.Avatar,{children:[m.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),m.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),m.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[m.jsx("span",{className:"text-sm font-bold",children:n.username}),m.jsxs("span",{className:"text-xs",children:[r," ",i&&`(${s.comments.edited})`]})]})]})}),jot=v.forwardRef((e,t)=>{const{className:n,showActions:r,authorInfo:i,timeString:o,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=e;_t(u);const[f,h]=v.useState(!1),{focused:g,ref:y}=xQe(),E=s&&(r===!0||r===void 0||r==="hover"&&f||g);return m.jsxs("div",{ref:t,className:et(n,"relative flex flex-col gap-2"),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[E?m.jsx("div",{className:"absolute right-0 top-0 z-10",ref:y,children:s}):null,m.jsx(Bot,{...e}),c]})}),$ot=v.forwardRef((e,t)=>{const{className:n,onFocus:r,onBlur:i,autoFocus:o,editor:s,editable:a,...l}=e;_t(l);const c=hl();return m.jsx(FF,{autoFocus:o,className:et(n,""),theme:c?.colorSchemePreference,editor:e.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:t,onFocus:r,onBlur:i,children:m.jsx(iae,{formattingToolbar:Uot})})}),Uot=()=>{const e=nae([]).filter(t=>t.key!=="nestBlockButton"&&t.key!=="unnestBlockButton");return m.jsx(rae,{blockTypeSelectItems:[],children:e})},Hot=v.forwardRef((e,t)=>{const{className:n,text:r,icon:i,isSelected:o,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=e;_t(u,!1);const f=Rn(),h=m.jsxs(f.Button.Button,{variant:o?"secondary":"outline",className:et(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:t,children:[m.jsx("span",{children:i}),m.jsx("span",{children:r})]});return s?m.jsxs(f.Tooltip.Tooltip,{children:[m.jsx(f.Tooltip.TooltipTrigger,{asChild:!0,children:h}),m.jsxs(f.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[m.jsx("span",{children:s}),a&&m.jsx("span",{children:a})]})]}):h}),zot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;_t(i);const o=Rn();return m.jsx(o.Tooltip.TooltipProvider,{delayDuration:0,children:m.jsx("div",{className:et(n,"flex w-full flex-row flex-wrap gap-1"),ref:t,children:r})})}),Vot=v.forwardRef((e,t)=>{const{className:n,children:r,onClick:i,label:o,...s}=e;_t(s);const a=Rn();return m.jsx(a.Button.Button,{type:"submit",className:n,"aria-label":o,ref:t,onClick:i,children:r})}),Got=v.forwardRef((e,t)=>{const{className:n,accept:r,value:i,placeholder:o,onChange:s,...a}=e;_t(a);const l=Rn();return m.jsx(l.Input.Input,{type:"file",className:n,ref:t,accept:r,value:i?i.name:void 0,onChange:async c=>s?.(c.target.files[0]),placeholder:o})}),qot=v.forwardRef((e,t)=>{const{className:n,isSelected:r,onClick:i,item:o,id:s,...a}=e;_t(a);const l=v.useRef(null);return v.useEffect(()=>{if(!l.current||!r)return;const c=fae(l.current,l.current.closest(".bn-grid-suggestion-menu"));c==="top"?l.current.scrollIntoView(!0):c==="bottom"&&l.current.scrollIntoView(!1)},[r]),m.jsx("div",{className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:pae([t,l]),id:s,role:"option",onClick:i,"aria-selected":r||void 0,children:o.icon})}),Wot=v.forwardRef((e,t)=>{const{className:n,children:r,columns:i,...o}=e;return _t(o),m.jsx("div",{className:n,style:{gridColumn:`1 / ${i+1}`},ref:t,children:r})}),Yot={FormattingToolbar:{Root:x_,Button:E_,Select:S_},FilePanel:{Root:yot,Button:Vot,FileInput:Got,TabPanel:vot,TextInput:xot},LinkToolbar:{Root:x_,Button:E_,Select:S_},SideMenu:{Root:Cot,Button:Tot},SuggestionMenu:{Root:Not,Item:Rot,EmptyItem:_ot,Label:Dot,Loader:Iot},GridSuggestionMenu:{Root:kot,Item:qot,EmptyItem:Aot,Loader:Wot},TableHandle:{Root:Mot,ExtendButton:Oot},Comments:{Comment:jot,Editor:$ot,Card:Lot,CardSection:Pot,ExpandSectionsPrompt:Fot},Generic:{Badge:{Root:Hot,Group:zot},Toolbar:{Root:x_,Button:E_,Select:S_},Form:{Root:lot,TextInput:cot},Menu:{Root:dot,Trigger:fot,Dropdown:pot,Divider:mot,Label:got,Item:hot,Button:bot},Popover:{Root:Eot,Trigger:Sot,Content:wot}}},FF=e=>{const{className:t,shadCNComponents:n,...r}=e,i=v.useMemo(()=>({...aot,...n}),[n]);return m.jsx(Eue.Provider,{value:i,children:m.jsx(jse.Provider,{value:Yot,children:m.jsx(rQe,{className:Fr("bn-shadcn",t||""),...r})})})},L0=ace,P0=lce,Vh=v.forwardRef(({className:e,align:t="center",sideOffset:n=4,container:r,...i},o)=>m.jsx(Lnt,{container:r,children:m.jsx(kF,{ref:o,align:t,sideOffset:n,className:Se("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[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 origin-[--radix-popover-content-transform-origin]",e),...i})}));Vh.displayName=kF.displayName;var bW=1,Kot=.9,Xot=.8,Zot=.17,w_=.1,C_=.999,Qot=.9999,Jot=.99,est=/[\\\/_+.#"@\[\(\{&]/,tst=/[\\\/_+.#"@\[\(\{&]/g,nst=/[\s-]/,Sue=/[\s-]/g;function vI(e,t,n,r,i,o,s){if(o===t.length)return i===e.length?bW:Jot;var a=`${i},${o}`;if(s[a]!==void 0)return s[a];for(var l=r.charAt(o),c=n.indexOf(l,i),u=0,f,h,g,y;c>=0;)f=vI(e,t,n,r,c+1,o+1,s),f>u&&(c===i?f*=bW:est.test(e.charAt(c-1))?(f*=Xot,g=e.slice(i,c-1).match(tst),g&&i>0&&(f*=Math.pow(C_,g.length))):nst.test(e.charAt(c-1))?(f*=Kot,y=e.slice(i,c-1).match(Sue),y&&i>0&&(f*=Math.pow(C_,y.length))):(f*=Zot,i>0&&(f*=Math.pow(C_,c-i))),e.charAt(c)!==t.charAt(o)&&(f*=Qot)),(f<w_&&n.charAt(c-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(c-1)!==r.charAt(o))&&(h=vI(e,t,n,r,c+1,o+2,s),h*w_>f&&(f=h*w_)),f>u&&(u=f),c=n.indexOf(l,c+1);return s[a]=u,u}function yW(e){return e.toLowerCase().replace(Sue," ")}function rst(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,vI(e,t,yW(e),yW(t),0,0,{})}var Yg='[cmdk-group=""]',T_='[cmdk-group-items=""]',ist='[cmdk-group-heading=""]',wue='[cmdk-item=""]',vW=`${wue}:not([aria-disabled="true"])`,xI="cmdk-item-select",$p="data-value",ost=(e,t,n)=>rst(e,t,n),Cue=v.createContext(void 0),Ky=()=>v.useContext(Cue),Tue=v.createContext(void 0),BF=()=>v.useContext(Tue),kue=v.createContext(void 0),Aue=v.forwardRef((e,t)=>{let n=Up(()=>{var K,P;return{search:"",value:(P=(K=e.value)!=null?K:e.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Up(()=>new Set),i=Up(()=>new Map),o=Up(()=>new Map),s=Up(()=>new Set),a=Nue(e),{label:l,children:c,value:u,onValueChange:f,filter:h,shouldFilter:g,loop:y,disablePointerSelection:E=!1,vimBindings:S=!0,...w}=e,T=xr(),A=xr(),R=xr(),_=v.useRef(null),D=gst();mf(()=>{if(u!==void 0){let K=u.trim();n.current.value=K,I.emit()}},[u]),mf(()=>{D(6,Y)},[]);let I=v.useMemo(()=>({subscribe:K=>(s.current.add(K),()=>s.current.delete(K)),snapshot:()=>n.current,setState:(K,P,ce)=>{var le,se,te,oe;if(!Object.is(n.current[K],P)){if(n.current[K]=P,K==="search")H(),L(),D(1,F);else if(K==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ue=document.getElementById(R);ue?ue.focus():(le=document.getElementById(T))==null||le.focus()}if(D(7,()=>{var ue;n.current.selectedItemId=(ue=$())==null?void 0:ue.id,I.emit()}),ce||D(5,Y),((se=a.current)==null?void 0:se.value)!==void 0){let ue=P??"";(oe=(te=a.current).onValueChange)==null||oe.call(te,ue);return}}I.emit()}},emit:()=>{s.current.forEach(K=>K())}}),[]),M=v.useMemo(()=>({value:(K,P,ce)=>{var le;P!==((le=o.current.get(K))==null?void 0:le.value)&&(o.current.set(K,{value:P,keywords:ce}),n.current.filtered.items.set(K,j(P,ce)),D(2,()=>{L(),I.emit()}))},item:(K,P)=>(r.current.add(K),P&&(i.current.has(P)?i.current.get(P).add(K):i.current.set(P,new Set([K]))),D(3,()=>{H(),L(),n.current.value||F(),I.emit()}),()=>{o.current.delete(K),r.current.delete(K),n.current.filtered.items.delete(K);let ce=$();D(4,()=>{H(),ce?.getAttribute("id")===K&&F(),I.emit()})}),group:K=>(i.current.has(K)||i.current.set(K,new Set),()=>{o.current.delete(K),i.current.delete(K)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:T,inputId:R,labelId:A,listInnerRef:_}),[]);function j(K,P){var ce,le;let se=(le=(ce=a.current)==null?void 0:ce.filter)!=null?le:ost;return K?se(K,n.current.search,P):0}function L(){if(!n.current.search||a.current.shouldFilter===!1)return;let K=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(le=>{let se=i.current.get(le),te=0;se.forEach(oe=>{let ue=K.get(oe);te=Math.max(ue,te)}),P.push([le,te])});let ce=_.current;G().sort((le,se)=>{var te,oe;let ue=le.getAttribute("id"),Te=se.getAttribute("id");return((te=K.get(Te))!=null?te:0)-((oe=K.get(ue))!=null?oe:0)}).forEach(le=>{let se=le.closest(T_);se?se.appendChild(le.parentElement===se?le:le.closest(`${T_} > *`)):ce.appendChild(le.parentElement===ce?le:le.closest(`${T_} > *`))}),P.sort((le,se)=>se[1]-le[1]).forEach(le=>{var se;let te=(se=_.current)==null?void 0:se.querySelector(`${Yg}[${$p}="${encodeURIComponent(le[0])}"]`);te?.parentElement.appendChild(te)})}function F(){let K=G().find(ce=>ce.getAttribute("aria-disabled")!=="true"),P=K?.getAttribute($p);I.setState("value",P||void 0)}function H(){var K,P,ce,le;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let se=0;for(let te of r.current){let oe=(P=(K=o.current.get(te))==null?void 0:K.value)!=null?P:"",ue=(le=(ce=o.current.get(te))==null?void 0:ce.keywords)!=null?le:[],Te=j(oe,ue);n.current.filtered.items.set(te,Te),Te>0&&se++}for(let[te,oe]of i.current)for(let ue of oe)if(n.current.filtered.items.get(ue)>0){n.current.filtered.groups.add(te);break}n.current.filtered.count=se}function Y(){var K,P,ce;let le=$();le&&(((K=le.parentElement)==null?void 0:K.firstChild)===le&&((ce=(P=le.closest(Yg))==null?void 0:P.querySelector(ist))==null||ce.scrollIntoView({block:"nearest"})),le.scrollIntoView({block:"nearest"}))}function $(){var K;return(K=_.current)==null?void 0:K.querySelector(`${wue}[aria-selected="true"]`)}function G(){var K;return Array.from(((K=_.current)==null?void 0:K.querySelectorAll(vW))||[])}function V(K){let P=G()[K];P&&I.setState("value",P.getAttribute($p))}function X(K){var P;let ce=$(),le=G(),se=le.findIndex(oe=>oe===ce),te=le[se+K];(P=a.current)!=null&&P.loop&&(te=se+K<0?le[le.length-1]:se+K===le.length?le[0]:le[se+K]),te&&I.setState("value",te.getAttribute($p))}function Q(K){let P=$(),ce=P?.closest(Yg),le;for(;ce&&!le;)ce=K>0?hst(ce,Yg):mst(ce,Yg),le=ce?.querySelector(vW);le?I.setState("value",le.getAttribute($p)):X(K)}let J=()=>V(G().length-1),B=K=>{K.preventDefault(),K.metaKey?J():K.altKey?Q(1):X(1)},W=K=>{K.preventDefault(),K.metaKey?V(0):K.altKey?Q(-1):X(-1)};return v.createElement(io.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:K=>{var P;(P=w.onKeyDown)==null||P.call(w,K);let ce=K.nativeEvent.isComposing||K.keyCode===229;if(!(K.defaultPrevented||ce))switch(K.key){case"n":case"j":{S&&K.ctrlKey&&B(K);break}case"ArrowDown":{B(K);break}case"p":case"k":{S&&K.ctrlKey&&W(K);break}case"ArrowUp":{W(K);break}case"Home":{K.preventDefault(),V(0);break}case"End":{K.preventDefault(),J();break}case"Enter":{K.preventDefault();let le=$();if(le){let se=new Event(xI);le.dispatchEvent(se)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:yst},l),CT(e,K=>v.createElement(Tue.Provider,{value:I},v.createElement(Cue.Provider,{value:M},K))))}),sst=v.forwardRef((e,t)=>{var n,r;let i=xr(),o=v.useRef(null),s=v.useContext(kue),a=Ky(),l=Nue(e),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;mf(()=>{if(!c)return a.item(i,s?.id)},[c]);let u=_ue(i,o,[e.value,e.children,o],e.keywords),f=BF(),h=Fu(D=>D.value&&D.value===u.current),g=Fu(D=>c||a.filter()===!1?!0:D.search?D.filtered.items.get(i)>0:!0);v.useEffect(()=>{let D=o.current;if(!(!D||e.disabled))return D.addEventListener(xI,y),()=>D.removeEventListener(xI,y)},[g,e.onSelect,e.disabled]);function y(){var D,I;E(),(I=(D=l.current).onSelect)==null||I.call(D,u.current)}function E(){f.setState("value",u.current,!0)}if(!g)return null;let{disabled:S,value:w,onSelect:T,forceMount:A,keywords:R,..._}=e;return v.createElement(io.div,{ref:_n(o,t),..._,id:i,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!h,"data-disabled":!!S,"data-selected":!!h,onPointerMove:S||a.getDisablePointerSelection()?void 0:E,onClick:S?void 0:y},e.children)}),ast=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=xr(),a=v.useRef(null),l=v.useRef(null),c=xr(),u=Ky(),f=Fu(g=>i||u.filter()===!1?!0:g.search?g.filtered.groups.has(s):!0);mf(()=>u.group(s),[]),_ue(s,a,[e.value,e.heading,l]);let h=v.useMemo(()=>({id:s,forceMount:i}),[i]);return v.createElement(io.div,{ref:_n(a,t),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&v.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),CT(e,g=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},v.createElement(kue.Provider,{value:h},g))))}),lst=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=v.useRef(null),o=Fu(s=>!s.search);return!n&&!o?null:v.createElement(io.div,{ref:_n(i,t),...r,"cmdk-separator":"",role:"separator"})}),cst=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,o=BF(),s=Fu(c=>c.search),a=Fu(c=>c.selectedItemId),l=Ky();return v.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),v.createElement(io.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:s,onChange:c=>{i||o.setState("search",c.target.value),n?.(c.target.value)}})}),ust=v.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,o=v.useRef(null),s=v.useRef(null),a=Fu(c=>c.selectedItemId),l=Ky();return v.useEffect(()=>{if(s.current&&o.current){let c=s.current,u=o.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let g=c.offsetHeight;u.style.setProperty("--cmdk-list-height",g.toFixed(1)+"px")})});return h.observe(c),()=>{cancelAnimationFrame(f),h.unobserve(c)}}},[]),v.createElement(io.div,{ref:_n(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},CT(e,c=>v.createElement("div",{ref:_n(s,l.listInnerRef),"cmdk-list-sizer":""},c)))}),dst=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:o,container:s,...a}=e;return v.createElement(kO,{open:n,onOpenChange:r},v.createElement(AO,{container:s},v.createElement(ey,{"cmdk-overlay":"",className:i}),v.createElement(ty,{"aria-label":e.label,"cmdk-dialog":"",className:o},v.createElement(Aue,{ref:t,...a}))))}),fst=v.forwardRef((e,t)=>Fu(n=>n.filtered.count===0)?v.createElement(io.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),pst=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...o}=e;return v.createElement(io.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},CT(e,s=>v.createElement("div",{"aria-hidden":!0},s)))}),Ro=Object.assign(Aue,{List:ust,Item:sst,Input:cst,Group:ast,Separator:lst,Dialog:dst,Empty:fst,Loading:pst});function hst(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function mst(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Nue(e){let t=v.useRef(e);return mf(()=>{t.current=e}),t}var mf=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Up(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Fu(e){let t=BF(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function _ue(e,t,n,r=[]){let i=v.useRef(),o=Ky();return mf(()=>{var s;let a=(()=>{var c;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());o.value(e,a,l),(s=t.current)==null||s.setAttribute($p,a),i.current=a}),i}var gst=()=>{let[e,t]=v.useState(),n=Up(()=>new Map);return mf(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,i)=>{n.current.set(r,i),t({})}};function bst(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function CT({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(bst(t),{ref:t.ref},n(t.props.children)):n(t)}var yst={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Gh=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro,{ref:n,className:Se("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Gh.displayName=Ro.displayName;const qh=v.forwardRef(({className:e,...t},n)=>m.jsxs("div",{className:"flex items-center border-b border-border px-3","cmdk-input-wrapper":"",children:[m.jsx(Ew,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),m.jsx(Ro.Input,{ref:n,className:Se("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));qh.displayName=Ro.Input.displayName;const Wh=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.List,{ref:n,className:Se("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Wh.displayName=Ro.List.displayName;const Yh=v.forwardRef((e,t)=>m.jsx(Ro.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Yh.displayName=Ro.Empty.displayName;const Ja=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.Group,{ref:n,className:Se("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Ja.displayName=Ro.Group.displayName;const sw=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.Separator,{ref:n,className:Se("-mx-1 h-px bg-border",e),...t}));sw.displayName=Ro.Separator.displayName;const Ko=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.Item,{ref:n,className:Se("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm text-popover-foreground outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Ko.displayName=Ro.Item.displayName;const vst={todo:"bg-muted-foreground/50","in-progress":"bg-yellow-500","in-review":"bg-purple-500",blocked:"bg-destructive",done:"bg-green-500"};function Rue({children:e,isEditable:t,onPreview:n,onReplace:r,onDelete:i,previewContent:o,type:s}){const[a,l]=v.useState(!1),[c,u]=v.useState(!1),[f,h]=v.useState(!1),[g,y]=v.useState(""),[E,S]=v.useState([]),[w,T]=v.useState([]),[A,R]=v.useState(!1),_=v.useRef(null),D=v.useRef(null),I=v.useRef(!1),M=v.useCallback(async()=>{R(!0);try{if(s==="task"){const B=await VY();S(B.slice(0,10))}else{const B=await jI();T(B.slice(0,10))}}catch(B){console.error("Failed to load items:",B)}finally{R(!1)}},[s]),j=v.useCallback(async B=>{if(!B.trim()){M();return}R(!0);try{const W=await WY(B);s==="task"?S(W.tasks.slice(0,10)):T(W.docs.slice(0,10))}catch(W){console.error("Failed to search:",W)}finally{R(!1)}},[s,M]);v.useEffect(()=>{if(f)return D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{j(g)},300),()=>{D.current&&clearTimeout(D.current)}},[g,f,j]),v.useEffect(()=>{f&&M()},[f,M]);const L=()=>{t&&(I.current=!0,_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{I.current&&l(!0)},300))},F=()=>{I.current=!1,_.current&&clearTimeout(_.current),!f&&(_.current=setTimeout(()=>{I.current||(l(!1),u(!1))},200))},H=()=>{I.current=!0,_.current&&clearTimeout(_.current)},Y=()=>{f||F()};v.useEffect(()=>()=>{_.current&&clearTimeout(_.current),D.current&&clearTimeout(D.current)},[]);const $=B=>{B.preventDefault(),B.stopPropagation(),u(!c),h(!1)},G=B=>{B.preventDefault(),B.stopPropagation(),h(!f),u(!1),y("")},V=(B,W)=>{l(!1),h(!1),y(""),r(B,W)},X=B=>{B.preventDefault(),B.stopPropagation(),l(!1),i()},Q=B=>{B.preventDefault(),B.stopPropagation(),l(!1),n()},J=()=>{l(!1),u(!1),h(!1),y("")};return t?m.jsxs(L0,{open:a,onOpenChange:B=>{B?l(!0):J()},modal:!1,children:[m.jsx(P0,{asChild:!0,onClick:B=>B.preventDefault(),children:m.jsx("span",{onMouseEnter:L,onMouseLeave:F,children:e})}),m.jsx(Vh,{className:"w-auto p-0",side:"top",align:"center",sideOffset:4,onMouseEnter:H,onMouseLeave:Y,onOpenAutoFocus:B=>B.preventDefault(),children:m.jsxs("div",{className:"flex flex-col",children:[m.jsxs("div",{className:"flex items-center gap-0.5 p-1 border-b border-border",children:[m.jsxs($e,{variant:c?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5",onClick:$,children:[m.jsx(q_,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Preview"})]}),m.jsxs($e,{variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5",onClick:G,children:[m.jsx(UI,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Replace"})]}),m.jsxs($e,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:X,children:[m.jsx(Wd,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Delete"})]}),m.jsx("div",{className:"w-px h-4 bg-border mx-1"}),m.jsxs($e,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5",onClick:Q,children:[m.jsx(eK,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Open"})]})]}),c&&o&&m.jsxs("div",{className:"p-2 border-b border-border",children:[m.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:"Preview"}),m.jsx("div",{className:"max-h-28 overflow-auto text-sm",children:o})]}),f&&m.jsxs(Gh,{className:"w-full min-w-56",shouldFilter:!1,children:[m.jsxs("div",{className:"relative",children:[m.jsx(qh,{placeholder:`Search ${s==="task"?"tasks":"docs"}...`,value:g,onValueChange:y,onMouseDown:B=>B.stopPropagation(),className:"h-8 text-sm"}),A&&m.jsx(nK,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 animate-spin text-muted-foreground"})]}),m.jsxs(Wh,{className:"max-h-48",children:[m.jsx(Yh,{className:"py-3 text-xs",children:A?"Searching...":`No ${s==="task"?"tasks":"docs"} found`}),s==="task"?m.jsx(Ja,{heading:"Tasks",className:"[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:py-1",children:E.map(B=>m.jsxs(Ko,{value:`task-${B.id}`,onSelect:()=>V("task",`task-${B.id}`),onMouseDown:W=>W.stopPropagation(),className:"cursor-pointer py-1.5 text-sm gap-2",children:[m.jsx(gf,{className:"w-3.5 h-3.5 shrink-0 text-green-600 dark:text-green-400"}),m.jsxs("span",{className:"text-muted-foreground text-xs shrink-0",children:["#",B.id]}),m.jsx("span",{className:"truncate flex-1",children:B.title}),m.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${vst[B.status]||"bg-muted-foreground/50"}`})]},B.id))}):m.jsx(Ja,{heading:"Docs",className:"[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:py-1",children:w.map(B=>m.jsxs(Ko,{value:B.path,onSelect:()=>V("doc",B.path.replace(/\.md$/,"")),onMouseDown:W=>W.stopPropagation(),className:"cursor-pointer py-1.5 text-sm gap-2",children:[m.jsx(Xo,{className:"w-3.5 h-3.5 shrink-0 text-blue-600 dark:text-blue-400"}),m.jsx("span",{className:"truncate flex-1",children:B.title||B.path})]},B.path))})]})]})]})})]}):m.jsx(m.Fragment,{children:e})}const xW={todo:"bg-muted-foreground/50","in-progress":"bg-yellow-500","in-review":"bg-purple-500",blocked:"bg-destructive",done:"bg-green-500"};function xst({taskId:e,isEditable:t=!1,onDelete:n,onReplace:r,onClick:i}){const[o,s]=v.useState(null),[a,l]=v.useState(!0),c=e.replace("task-","");v.useEffect(()=>{let E=!1;return GY(c).then(S=>{E||(s(S),l(!1))}).catch(()=>{E||(s(null),l(!1))}),()=>{E=!0}},[c]);const u=E=>{E.preventDefault(),E.stopPropagation(),!t&&(i?i(c):window.location.hash=`/kanban/${c}`)},f=()=>{window.location.hash=`/kanban/${c}`},h=o?.status?xW[o.status]:xW.todo,g=m.jsxs(oc,{variant:"outline",className:Se("mention-badge cursor-pointer select-none gap-1.5 font-medium","border-green-500/30 bg-green-500/10 text-green-700 hover:bg-green-500/20","dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-400 dark:hover:bg-green-500/20","transition-colors"),"data-task-id":c,onClick:u,onMouseDown:E=>{E.stopPropagation(),u(E)},children:[m.jsx(gf,{className:"w-3.5 h-3.5 shrink-0"}),a?m.jsxs("span",{className:"opacity-70",children:["#",c]}):o?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"max-w-[200px] truncate",children:["#",c,": ",o.title]}),m.jsx("span",{className:Se("w-2 h-2 rounded-full shrink-0",h)})]}):m.jsxs("span",{children:["#",c]})]}),y=o?m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("div",{className:"font-medium text-sm leading-tight",children:o.title}),o.description&&m.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:o.description}),m.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:Se("w-1.5 h-1.5 rounded-full",h)}),m.jsx("span",{className:"capitalize",children:o.status})]}),m.jsx("span",{className:"text-muted-foreground",children:"•"}),m.jsx("span",{className:"text-muted-foreground capitalize",children:o.priority})]})]}):null;return m.jsx(Rue,{isEditable:t,onPreview:f,onReplace:r||(()=>{}),onDelete:n||(()=>{}),previewContent:y,type:"task",children:g})}function EW(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="tableContent"&&"rows"in e}function SW(e){return Array.isArray(e)?e:e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:null}const Est=dae({type:"taskMention",propSchema:{taskId:{default:""}},content:"none"},{render:e=>{const t=e.inlineContent.props.taskId,n=e.editor,r=n?.isEditable??!1,i=()=>{if(!n)return;const s=n.document;for(const a of s){if(a.type==="table"&&EW(a.content)){let l=!1;const c=a.content.rows.map(u=>({...u,cells:u.cells.map(f=>{const h=SW(f);if(!h)return f;const g=h.filter(y=>{const E=y;return!(E.type==="taskMention"&&E.props?.taskId===t)});return g.length!==h.length?(l=!0,Array.isArray(f)?g:{...f,content:g}):f})}));if(l){n.updateBlock(a,{content:{...a.content,rows:c}});return}}if(Array.isArray(a.content)){const l=a.content.filter(c=>{const u=c;return!(u.type==="taskMention"&&u.props?.taskId===t)});if(l.length!==a.content.length){n.updateBlock(a,{content:l});return}}}},o=(s,a)=>{if(!n)return;const l=n.document;for(const c of l){if(c.type==="table"&&EW(c.content)){let u=!1;const f=c.content.rows.map(h=>({...h,cells:h.cells.map(g=>{const y=SW(g);if(!y)return g;const E=y.map(S=>{const w=S;return w.type==="taskMention"&&w.props?.taskId===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):S});return Array.isArray(g)?E:{...g,content:E}})}));if(u){n.updateBlock(c,{content:{...c.content,rows:f}});return}}if(Array.isArray(c.content)){let u=!1;const f=c.content.map(h=>{const g=h;return g.type==="taskMention"&&g.props?.taskId===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):h});if(u){n.updateBlock(c,{content:f});return}}}};return m.jsx(xst,{taskId:t,isEditable:r,onDelete:i,onReplace:o})}});function Sst({docPath:e,isEditable:t=!1,onDelete:n,onReplace:r,onClick:i}){const[o,s]=v.useState(null),[a,l]=v.useState(!0),c=e.endsWith(".md")?e:`${e}.md`;v.useEffect(()=>{let E=!1;return qY(c).then(S=>{!E&&S?(s(S),l(!1)):E||l(!1)}).catch(()=>{E||(s(null),l(!1))}),()=>{E=!0}},[c]);const u=E=>{E.preventDefault(),E.stopPropagation(),!t&&(i?i(c):window.location.hash=`/docs/${c}`)},f=()=>{window.location.hash=`/docs/${c}`},h=e.replace(/\.md$/,"").split("/").pop()||e,g=m.jsxs(oc,{variant:"outline",className:Se("mention-badge cursor-pointer select-none gap-1 font-medium","border-blue-500/30 bg-blue-500/10 text-blue-700 hover:bg-blue-500/20","dark:border-blue-500/30 dark:bg-blue-500/10 dark:text-blue-400 dark:hover:bg-blue-500/20","transition-colors"),"data-doc-path":c,onClick:u,onMouseDown:E=>{E.stopPropagation(),u(E)},children:[m.jsx(Xo,{className:"w-3.5 h-3.5 shrink-0"}),a?m.jsx("span",{className:"opacity-70",children:h}):o?.title?m.jsx("span",{className:"max-w-[200px] truncate",children:o.title}):m.jsx("span",{className:"max-w-[200px] truncate",children:h})]}),y=o?m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("div",{className:"font-medium text-sm leading-tight",children:o.title||h}),o.description&&m.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:o.description}),m.jsx("div",{className:"text-xs text-muted-foreground truncate",children:c}),o.tags&&o.tags.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1",children:o.tags.slice(0,3).map(E=>m.jsx(oc,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:E},E))})]}):null;return m.jsx(Rue,{isEditable:t,onPreview:f,onReplace:r||(()=>{}),onDelete:n||(()=>{}),previewContent:y,type:"doc",children:g})}function wW(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="tableContent"&&"rows"in e}function CW(e){return Array.isArray(e)?e:e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:null}const wst=dae({type:"docMention",propSchema:{docPath:{default:""}},content:"none"},{render:e=>{const t=e.inlineContent.props.docPath,n=e.editor,r=n?.isEditable??!1,i=()=>{if(!n)return;const s=n.document;for(const a of s){if(a.type==="table"&&wW(a.content)){let l=!1;const c=a.content.rows.map(u=>({...u,cells:u.cells.map(f=>{const h=CW(f);if(!h)return f;const g=h.filter(y=>{const E=y;return!(E.type==="docMention"&&E.props?.docPath===t)});return g.length!==h.length?(l=!0,Array.isArray(f)?g:{...f,content:g}):f})}));if(l){n.updateBlock(a,{content:{...a.content,rows:c}});return}}if(Array.isArray(a.content)){const l=a.content.filter(c=>{const u=c;return!(u.type==="docMention"&&u.props?.docPath===t)});if(l.length!==a.content.length){n.updateBlock(a,{content:l});return}}}},o=(s,a)=>{if(!n)return;const l=n.document;for(const c of l){if(c.type==="table"&&wW(c.content)){let u=!1;const f=c.content.rows.map(h=>({...h,cells:h.cells.map(g=>{const y=CW(g);if(!y)return g;const E=y.map(S=>{const w=S;return w.type==="docMention"&&w.props?.docPath===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):S});return Array.isArray(g)?E:{...g,content:E}})}));if(u){n.updateBlock(c,{content:{...c.content,rows:f}});return}}if(Array.isArray(c.content)){let u=!1;const f=c.content.map(h=>{const g=h;return g.type==="docMention"&&g.props?.docPath===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):h});if(u){n.updateBlock(c,{content:f});return}}}};return m.jsx(Sst,{docPath:t,isEditable:r,onDelete:i,onReplace:o})}}),Cst={todo:"bg-muted-foreground/50","in-progress":"bg-yellow-500","in-review":"bg-purple-500",blocked:"bg-destructive",done:"bg-green-500"};async function Tst(e,t){const n=[],r=t.toLowerCase(),i=r.startsWith("task-")||r.startsWith("task "),o=r.startsWith("doc/")||r.startsWith("doc ")||r.startsWith("docs/");let s=t;i?s=t.replace(/^task[-\s]/i,""):o&&(s=t.replace(/^docs?[/\s]/i,""));try{let a=[],l=[];if(s.length>0){const c=await WY(s);a=c.tasks,l=c.docs}else o||(a=await VY(),a=a.slice(0,8)),i||(l=await jI(),l=l.slice(0,8));if(!o)for(const c of a.slice(0,8))n.push({id:`task-${c.id}`,title:`#${c.id}: ${c.title}`,group:"Tasks",itemType:"task",status:c.status,onItemClick:()=>{e.insertInlineContent([{type:"taskMention",props:{taskId:`task-${c.id}`}}," "])}});if(!i)for(const c of l.slice(0,8)){const u=c.path.replace(/\.md$/,"");n.push({id:u,title:c.title||u,group:"Docs",itemType:"doc",onItemClick:()=>{e.insertInlineContent([{type:"docMention",props:{docPath:u}}," "])}})}}catch(a){console.error("Failed to fetch mention suggestions:",a)}return n}function kst(e){const{items:t,selectedIndex:n,onItemClick:r}=e,i=t.filter(s=>s.itemType==="task"),o=t.filter(s=>s.itemType==="doc");return t.length===0?m.jsx("div",{className:"z-50 w-56 rounded-md border border-border bg-popover p-1 shadow-md",children:m.jsx("div",{className:"py-3 text-center text-xs text-muted-foreground",children:"No results found"})}):m.jsxs("div",{className:"z-50 w-56 max-h-48 overflow-y-auto rounded-md border border-border bg-popover p-1 shadow-md",children:[i.length>0&&m.jsxs("div",{className:"mb-1",children:[m.jsx("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:"Tasks"}),i.map(s=>{const l=t.indexOf(s)===n;return m.jsxs("div",{className:`flex items-center gap-2 px-2 py-1.5 text-sm rounded-sm cursor-pointer ${l?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onClick:()=>r?.(s),children:[m.jsx(gf,{className:"w-3.5 h-3.5 shrink-0 text-green-600 dark:text-green-400"}),m.jsx("span",{className:"text-muted-foreground text-xs shrink-0",children:s.id.replace("task-","#")}),m.jsx("span",{className:"truncate flex-1",children:s.title.replace(/^#\d+:\s*/,"")}),m.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Cst[s.status||"todo"]||"bg-muted-foreground/50"}`})]},s.id)})]}),o.length>0&&m.jsxs("div",{children:[m.jsx("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:"Docs"}),o.map(s=>{const l=t.indexOf(s)===n;return m.jsxs("div",{className:`flex items-center gap-2 px-2 py-1.5 text-sm rounded-sm cursor-pointer ${l?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onClick:()=>r?.(s),children:[m.jsx(Xo,{className:"w-3.5 h-3.5 shrink-0 text-blue-600 dark:text-blue-400"}),m.jsx("span",{className:"truncate flex-1",children:s.title})]},s.id)})]})]})}function Ast({editor:e}){return m.jsx(lae,{triggerCharacter:"@",getItems:async t=>Tst(e,t),suggestionMenuComponent:kst})}const{image:tht,video:nht,audio:rht,file:iht,...Nst}=ioe,Due=LP.create({blockSpecs:Nst,inlineContentSpecs:{...SP,taskMention:Est,docMention:wst}}),_st=/@(task-\d+(?:\.\d+)?)/g,Rst=/@docs?\/([^\s,;:!?"'()[\]]+)/g,Dst=/@\.knowns\/tasks\/task-(\d+(?:\.\d+)?)(?:\s*-\s*[^@\n]+?\.md|\.md)/g,Ist=/@\.knowns\/docs\/([^\s@]+?)\.md(?:\s*-\s*[^@\n]+)?/g,F0="[[TASK_MENTION:",B0="[[DOC_MENTION:",Bu="]]",TW="[[CODE_BLOCK:",kW="[[INLINE_CODE:",hx="]]";function Ost(e){let t=e;return t=t.replace(Dst,(n,r)=>`@task-${r}`),t=t.replace(Ist,(n,r)=>`@doc/${r}`),t}function Iue(e){let t=Ost(e);const n=[],r=[];return t=t.replace(/```[\s\S]*?```/g,i=>{const o=n.length;return n.push(i),`${TW}${o}${hx}`}),t=t.replace(/`[^`\n]+`/g,i=>{const o=r.length;return r.push(i),`${kW}${o}${hx}`}),t=t.replace(_st,(i,o)=>`${F0}${o}${Bu}`),t=t.replace(Rst,(i,o)=>{let s=o;return s.endsWith(".")&&!s.match(/\.\w+$/)&&(s=s.slice(0,-1)),`${B0}${s}${Bu}`}),t=t.replace(new RegExp(`${du(kW)}(\\d+)${du(hx)}`,"g"),(i,o)=>r[Number.parseInt(o,10)]),t=t.replace(new RegExp(`${du(TW)}(\\d+)${du(hx)}`,"g"),(i,o)=>n[Number.parseInt(o,10)]),t}function Oue(e){return e.map(t=>Mue(t))}function Mue(e){const t=e.children?.map(r=>Mue(r))||[];if(e.type==="table"&&Lue(e.content)){const r=Mst(e.content);return{...e,content:r,children:t}}const n=Array.isArray(e.content)?jF(e.content):e.content;return{...e,content:n,children:t}}function Lue(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="tableContent"&&"rows"in e&&Array.isArray(e.rows)}function Pue(e){return Array.isArray(e)?e:e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:null}function Mst(e){return{...e,rows:e.rows.map(t=>({...t,cells:t.cells.map(n=>{const r=Pue(n);if(r){const i=jF(r);return Array.isArray(n)?i:{...n,content:i}}return n})}))}}function jF(e){const t=[];for(const n of e)if(n.type==="text"&&typeof n.text=="string"){const r=n.text,i=Lst(r);for(const o of i)o.type==="text"?o.value&&t.push({type:"text",text:o.value,styles:n.styles||{}}):o.type==="taskMention"?t.push({type:"taskMention",props:{taskId:o.value}}):o.type==="docMention"&&t.push({type:"docMention",props:{docPath:o.value}})}else n.type==="link"?t.push({...n,content:jF(n.content||[])}):t.push(n);return t}function Lst(e){const t=[];let n=e;for(;n.length>0;){const r=n.indexOf(F0),i=n.indexOf(B0);let o=-1,s=!1;if(r>=0&&(i<0||r<i)?(o=r,s=!0):i>=0&&(o=i,s=!1),o<0){n&&t.push({type:"text",value:n});break}o>0&&t.push({type:"text",value:n.slice(0,o)});const l=o+(s?F0:B0).length,c=n.indexOf(Bu,l);if(c<0){t.push({type:"text",value:n.slice(o)});break}const u=n.slice(l,c);t.push({type:s?"taskMention":"docMention",value:u}),n=n.slice(c+Bu.length)}return t}function Pst(e){return e.map(t=>Fue(t))}function Fue(e){const t=e.children?.map(r=>Fue(r))||[];if(e.type==="table"&&Lue(e.content)){const r=Fst(e.content);return{...e,content:r,children:t}}const n=Array.isArray(e.content)?$F(e.content):e.content;return{...e,content:n,children:t}}function Fst(e){return{...e,rows:e.rows.map(t=>({...t,cells:t.cells.map(n=>{const r=Pue(n);if(r){const i=$F(r);return Array.isArray(n)?i:{...n,content:i}}return n})}))}}function $F(e){const t=[];for(const n of e)if(n.type==="taskMention"){const r=n.props?.taskId;r&&t.push({type:"text",text:`${F0}${r}${Bu}`,styles:{}})}else if(n.type==="docMention"){const r=n.props?.docPath;r&&t.push({type:"text",text:`${B0}${r}${Bu}`,styles:{}})}else n.type==="link"?t.push({...n,content:$F(n.content||[])}):t.push(n);return t}function Bst(e,t){let n=e;return n=n.replace(new RegExp(`${du(F0)}([^\\]]+)${du(Bu)}`,"g"),"@$1"),n=n.replace(new RegExp(`${du(B0)}([^\\]]+)${du(Bu)}`,"g"),"@doc/$1"),n}function du(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}class AW extends v.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("BlockNote Editor Error:",t,n),this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-muted-foreground",children:[m.jsx("p",{className:"text-sm",children:"Editor encountered an error"}),m.jsx("button",{type:"button",className:"mt-2 text-xs underline hover:text-foreground",onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}const yu=v.forwardRef(({markdown:e,onChange:t,placeholder:n="Write your content here...",readOnly:r=!1,className:i=""},o)=>{const{isDark:s}=Pm(),a=v.useRef(!1),l=v.useRef(!1),c=By({schema:Due});v.useEffect(()=>{c&&e&&!a.current&&(a.current=!0,u(e))},[c,e]);const u=v.useCallback(async g=>{if(!(!c||!g))try{l.current=!0;const y=Iue(g),E=await c.tryParseMarkdownToBlocks(y),S=Oue(E);c.replaceBlocks(c.document,S)}catch(y){console.error("Failed to load markdown:",y)}finally{l.current=!1}},[c]),f=v.useCallback(async()=>{if(!(!c||l.current))try{const g=Pst(c.document),y=await c.blocksToMarkdownLossy(g),E=Bst(y,c.document);t(E)}catch(g){console.error("Failed to convert to markdown:",g)}},[c,t]);v.useImperativeHandle(o,()=>({setMarkdown:g=>{u(g)},getMarkdown:()=>e}),[e,u]);const h=v.useMemo(()=>`blocknote-editor-wrapper ${i} ${s?"dark":""}`.trim(),[i,s]);return m.jsx(AW,{children:m.jsx("div",{className:h,style:{height:"100%",display:"flex",flexDirection:"column"},children:m.jsx(FF,{editor:c,editable:!r,onChange:f,theme:s?"dark":"light","data-placeholder":n,children:!r&&m.jsx(AW,{children:m.jsx(Ast,{editor:c})})})})})});yu.displayName="BlockNoteEditor";const jst=v.forwardRef(({markdown:e,className:t="",onDocLinkClick:n,onTaskLinkClick:r},i)=>{const{isDark:o}=Pm(),s=v.useRef(null),a=v.useRef(""),l=By({schema:Due});v.useEffect(()=>{if(!l||!e||e===a.current)return;a.current=e,(async()=>{try{const f=Iue(e),h=await l.tryParseMarkdownToBlocks(f),g=Oue(h);l.replaceBlocks(l.document,g)}catch(f){console.error("Failed to render markdown:",f)}})()},[l,e]),v.useEffect(()=>{if(!s.current)return;const u=h=>{const g=h.target,y=g.closest("[data-task-id]");if(y){const S=y.getAttribute("data-task-id");S&&r&&(h.preventDefault(),h.stopPropagation(),r(S));return}const E=g.closest("[data-doc-path]");if(E){const S=E.getAttribute("data-doc-path");S&&n&&(h.preventDefault(),h.stopPropagation(),n(S))}},f=s.current;return f.addEventListener("click",u),()=>{f.removeEventListener("click",u)}},[n,r]),v.useImperativeHandle(i,()=>({getElement:()=>s.current}));const c=v.useMemo(()=>`blocknote-render-wrapper ${t} ${o?"dark":""}`.trim(),[t,o]);return e?m.jsx("div",{ref:s,className:c,children:m.jsx(FF,{editor:l,editable:!1,theme:o?"dark":"light"})}):null});jst.displayName="BlockNoteRender";function $st({task:e,onSave:t,saving:n}){const[r,i]=v.useState(!1),[o,s]=v.useState(e.description||"");v.useEffect(()=>{s(e.description||"")},[e.description]);const a=()=>{o!==e.description&&t({description:o||void 0}),i(!1)},l=()=>{s(e.description||""),i(!1)};return m.jsxs(Kd,{children:[m.jsx(iy,{className:"pb-3",children:m.jsxs(oy,{className:"flex items-center gap-2 text-base",children:[m.jsx(sK,{className:"w-4 h-4"}),"Description"]})}),m.jsx(sy,{children:r?m.jsxs("div",{className:"space-y-3",children:[m.jsx(yu,{markdown:o,onChange:s,placeholder:"Add a more detailed description...",readOnly:n}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx($e,{size:"sm",onClick:a,disabled:n,children:"Save"}),m.jsx($e,{size:"sm",variant:"ghost",onClick:l,children:"Cancel"})]})]}):m.jsx("div",{className:"min-h-[60px] p-3 rounded-md border border-dashed cursor-pointer hover:border-primary hover:bg-accent/50 transition-colors",onClick:()=>i(!0),role:"button",tabIndex:0,onKeyDown:c=>c.key==="Enter"&&i(!0),children:e.description?m.jsx(bC,{markdown:e.description,className:"text-sm prose prose-sm dark:prose-invert max-w-none"}):m.jsx("span",{className:"text-muted-foreground text-sm italic",children:"Click to add description..."})})})]})}function Ust(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Hst(i,...t)]}function Hst(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function zst(e){const t=Vst(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(qst);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Vst(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Yst(i),a=Wst(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Gst=Symbol("radix.slottable");function qst(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Gst}function Wst(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Yst(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Kst=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],UF=Kst.reduce((e,t)=>{const n=zst(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),TT="Checkbox",[Xst]=Ust(TT),[Zst,HF]=Xst(TT);function Qst(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:f}=e,[h,g]=Us({prop:n,defaultProp:i??!1,onChange:l,caller:TT}),[y,E]=v.useState(null),[S,w]=v.useState(null),T=v.useRef(!1),A=y?!!s||!!y.closest("form"):!0,R={checked:h,disabled:o,setChecked:g,control:y,setControl:E,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:T,required:c,defaultChecked:vu(i)?!1:i,isFormControl:A,bubbleInput:S,setBubbleInput:w};return m.jsx(Zst,{scope:t,...R,children:Jst(f)?f(R):r})}var Bue="CheckboxTrigger",jue=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:s,disabled:a,checked:l,required:c,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:y}=HF(Bue,e),E=It(i,u),S=v.useRef(l);return v.useEffect(()=>{const w=o?.form;if(w){const T=()=>f(S.current);return w.addEventListener("reset",T),()=>w.removeEventListener("reset",T)}},[o,f]),m.jsx(UF.button,{type:"button",role:"checkbox","aria-checked":vu(l)?"mixed":l,"aria-required":c,"data-state":Vue(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:E,onKeyDown:Ue(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:Ue(n,w=>{f(T=>vu(T)?!0:!T),y&&g&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});jue.displayName=Bue;var zF=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l,onCheckedChange:c,form:u,...f}=e;return m.jsx(Qst,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:s,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>m.jsxs(m.Fragment,{children:[m.jsx(jue,{...f,ref:t,__scopeCheckbox:n}),h&&m.jsx(zue,{__scopeCheckbox:n})]})})});zF.displayName=TT;var $ue="CheckboxIndicator",Uue=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=HF($ue,n);return m.jsx(Yr,{present:r||vu(o.checked)||o.checked===!0,children:m.jsx(UF.span,{"data-state":Vue(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Uue.displayName=$ue;var Hue="CheckboxBubbleInput",zue=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:a,disabled:l,name:c,value:u,form:f,bubbleInput:h,setBubbleInput:g}=HF(Hue,e),y=It(n,g),E=uce(o),S=Pae(r);v.useEffect(()=>{const T=h;if(!T)return;const A=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(A,"checked").set,D=!i.current;if(E!==o&&_){const I=new Event("click",{bubbles:D});T.indeterminate=vu(o),_.call(T,vu(o)?!1:o),T.dispatchEvent(I)}},[h,E,o,i]);const w=v.useRef(vu(o)?!1:o);return m.jsx(UF.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??w.current,required:a,disabled:l,name:c,value:u,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});zue.displayName=Hue;function Jst(e){return typeof e=="function"}function vu(e){return e==="indeterminate"}function Vue(e){return vu(e)?"indeterminate":e?"checked":"unchecked"}const aw=v.forwardRef(({className:e,...t},n)=>m.jsx(zF,{ref:n,className:Se("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:m.jsx(Uue,{className:Se("grid place-content-center text-current"),children:m.jsx(Ds,{className:"h-4 w-4"})})}));aw.displayName=zF.displayName;var VF="Progress",GF=100,[eat]=Sae(VF),[tat,nat]=eat(VF),Gue=v.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=rat,...s}=e;(i||i===0)&&!NW(i)&&console.error(iat(`${i}`,"Progress"));const a=NW(i)?i:GF;r!==null&&!_W(r,a)&&console.error(oat(`${r}`,"Progress"));const l=_W(r,a)?r:null,c=lw(l)?o(l,a):void 0;return m.jsx(tat,{scope:n,value:l,max:a,children:m.jsx(io.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":lw(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":Yue(l,a),"data-value":l??void 0,"data-max":a,...s,ref:t})})});Gue.displayName=VF;var que="ProgressIndicator",Wue=v.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,i=nat(que,n);return m.jsx(io.div,{"data-state":Yue(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});Wue.displayName=que;function rat(e,t){return`${Math.round(e/t*100)}%`}function Yue(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function lw(e){return typeof e=="number"}function NW(e){return lw(e)&&!isNaN(e)&&e>0}function _W(e,t){return lw(e)&&!isNaN(e)&&e<=t&&e>=0}function iat(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${GF}\`.`}function oat(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
292
+ `)}`},i.emoji)},{textColor:eht,backgroundColor:tht,...uQe}=EP,ZP=LP.create({blockSpecs:{paragraph:noe()},styleSpecs:uQe}),dQe=({comment:e,thread:t,showResolveButton:n})=>{const r=sn(zs),i=Rt(),o=By({initialContent:e.body,trailingBlock:!1,dictionary:{...i,placeholders:{emptyDocument:i.placeholders.edit_comment}},schema:r.commentEditorSchema||ZP}),s=at(),[a,l]=v.useState(!1),[c,u]=v.useState(!1),f=r.threadStore,h=v.useCallback(()=>{l(!0)},[]),g=v.useCallback(()=>{o.replaceBlocks(o.document,e.body),l(!1)},[o,e.body]),y=v.useCallback(async L=>{await f.updateComment({commentId:e.id,comment:{body:o.document},threadId:t.id}),l(!1)},[e,t.id,o,f]),E=v.useCallback(async()=>{await f.deleteComment({commentId:e.id,threadId:t.id})},[e,t.id,f]),S=v.useCallback(async L=>{f.auth.canAddReaction(e,L)?await f.addReaction({threadId:t.id,commentId:e.id,emoji:L}):f.auth.canDeleteReaction(e,L)&&await f.deleteReaction({threadId:t.id,commentId:e.id,emoji:L})},[f,e,t.id]),w=v.useCallback(async()=>{await f.resolveThread({threadId:t.id})},[t.id,f]),T=v.useCallback(async()=>{await f.unresolveThread({threadId:t.id})},[t.id,f]),A=lQe(e.userId);if(!e.body)return null;let R;const _=f.auth.canAddReaction(e),D=f.auth.canDeleteComment(e),I=f.auth.canUpdateComment(e),M=n&&(t.resolved?f.auth.canUnresolveThread(t):f.auth.canResolveThread(t));a||(R=m.jsxs(s.Generic.Toolbar.Root,{className:Fr("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[_&&m.jsx(Qq,{onEmojiSelect:L=>S(L.native),onOpenChange:u,children:m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.actions.add_reaction,variant:"compact",children:m.jsx(Wq,{size:16})},"add-reaction")}),M&&(t.resolved?m.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:T,children:m.jsx(rXe,{size:16})},"reopen"):m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.actions.resolve,variant:"compact",onClick:w,children:m.jsx(NXe,{size:16})},"resolve")),(D||I)&&m.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[m.jsx(s.Generic.Menu.Trigger,{children:m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.actions.more_actions,variant:"compact",children:m.jsx(OXe,{size:16})},"more-actions")}),m.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[I&&m.jsx(s.Generic.Menu.Item,{icon:m.jsx(iXe,{}),onClick:h,children:i.comments.actions.edit_comment},"edit-comment"),D&&m.jsx(s.Generic.Menu.Item,{icon:m.jsx(RXe,{}),onClick:E,children:i.comments.actions.delete_comment},"delete-comment")]})]})]}));const j=e.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!e.body)throw new Error("soft deletes are not yet supported");return m.jsx(s.Comments.Comment,{authorInfo:A??"loading",timeString:j,edited:e.updatedAt.getTime()!==e.createdAt.getTime(),showActions:"hover",actions:R,className:"bn-thread-comment",emojiPickerOpen:c,children:m.jsx(KP,{autoFocus:a,editor:o,editable:a,actions:e.reactions.length>0||a?({isEmpty:L})=>m.jsxs(m.Fragment,{children:[e.reactions.length>0&&!a&&m.jsxs(s.Generic.Badge.Group,{className:Fr("bn-badge-group","bn-comment-reactions"),children:[e.reactions.map(F=>m.jsx(cQe,{comment:e,emoji:F.emoji,onReactionSelect:S},F.emoji)),_&&m.jsx(Qq,{onEmojiSelect:F=>S(F.native),onOpenChange:u,children:m.jsx(s.Generic.Badge.Root,{className:Fr("bn-badge","bn-comment-add-reaction"),text:"+",icon:m.jsx(Wq,{size:16}),mainTooltip:i.comments.actions.add_reaction})})]}),a&&m.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:Fr("bn-action-toolbar","bn-comment-actions"),children:[m.jsx(s.Generic.Toolbar.Button,{mainTooltip:i.comments.save_button_text,variant:"compact",onClick:y,isDisabled:L,children:i.comments.save_button_text}),m.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:i.comments.cancel_button_text,variant:"compact",onClick:g,children:i.comments.cancel_button_text})]})]}):void 0})})},fQe=({thread:e,maxCommentsBeforeCollapse:t})=>{const n=at(),r=Rt(),i=XP(e.resolvedBy?[e.resolvedBy]:[]),o=e.comments.map((s,a)=>m.jsx(dQe,{thread:e,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(e.resolved&&e.resolvedUpdatedAt&&e.resolvedBy){if(!i.get(e.resolvedBy))throw new Error(`User ${e.resolvedBy} resolved thread ${e.id}, but their data could not be found.`);const s=e.comments.findLastIndex(a=>e.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;o.splice(s,0,m.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:e.resolvedBy&&i.get(e.resolvedBy)||"loading",timeString:e.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:m.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return t&&o.length>t&&o.splice(1,o.length-2,m.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(e.comments.length-2)},"expand-prompt")),o};function pQe(){const e=sn(zs),t=at(),n=Rt(),r=By({trailingBlock:!1,dictionary:{...n,placeholders:{emptyDocument:n.placeholders.new_comment}},schema:e.commentEditorSchema||ZP});return m.jsx(t.Comments.Card,{className:"bn-thread",children:m.jsx(KP,{autoFocus:!0,editable:!0,editor:r,actions:({isEmpty:i})=>m.jsx(t.Generic.Toolbar.Root,{className:Fr("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:m.jsx(t.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:i,onClick:async()=>{await e.createThread({initialComment:{body:r.document}}),e.stopPendingComment()},children:"Save"})})})})}function hQe(e){const t=mt(),n=sn(zs),r=Fn(zs,{editor:t,selector:a=>a.pendingComment}),i=li({editor:t,selector:({editor:a})=>r?{from:a.prosemirrorState.selection.from,to:a.prosemirrorState.selection.to}:void 0}),o=v.useMemo(()=>({useFloatingOptions:{open:!!r,onOpenChange:a=>{a||(n.stopPendingComment(),t.focus())},placement:"bottom",middleware:[ha(10),Nm(),_m()]},elementProps:{style:{zIndex:60}},...e.floatingUIOptions}),[n,t,r,e.floatingUIOptions]),s=e.floatingComposer||pQe;return m.jsx(WP,{position:i,...o,children:m.jsx(s,{})})}const mQe=Object.freeze(Object.defineProperty({__proto__:null,default:hQe},Symbol.toStringTag,{value:"Module"})),uae=({thread:e,selected:t,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:i,onBlur:o,tabIndex:s})=>{const a=at(),l=Rt(),c=sn(zs),u=By({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||ZP}),f=v.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:e.id}),u.removeBlocks(u.document)},[c,u,e.id]);return m.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:i,onBlur:o,selected:t,tabIndex:s,children:[m.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:m.jsx(fQe,{thread:e,maxCommentsBeforeCollapse:t?void 0:r||5})}),t&&m.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:m.jsx(KP,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:h})=>h?null:m.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:Fr("bn-action-toolbar","bn-comment-actions"),children:m.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:h,onClick:f,children:l.comments.save_button_text})})})})]})};function gQe(){const e=sn(zs).threadStore,t=v.useRef(void 0);t.current||(t.current=e.getThreads());const n=v.useCallback(r=>e.subscribe(i=>{t.current=i,r()}),[e]);return v.useSyncExternalStore(n,()=>t.current)}function bQe(e){const t=mt(),n=sn(zs),r=Fn(zs,{editor:t,selector:l=>l.selectedThreadId?{id:l.selectedThreadId,position:l.threadPositions.get(l.selectedThreadId)}:void 0}),i=gQe(),o=v.useMemo(()=>r?i.get(r.id):void 0,[r,i]),s=v.useMemo(()=>({useFloatingOptions:{open:!!r,onOpenChange:(l,c,u)=>{u==="escape-key"&&t.focus(),l||n.selectThread(void 0)},placement:"bottom",middleware:[ha(10),Nm(),_m()]},elementProps:{style:{zIndex:30}},...e.floatingUIOptions}),[n,t,e.floatingUIOptions,r]),a=e.floatingThread||uae;return m.jsx(WP,{position:r?.position,...s,children:o&&m.jsx(a,{thread:o,selected:!0})})}const yQe=Object.freeze(Object.defineProperty({__proto__:null,default:bQe},Symbol.toStringTag,{value:"Module"}));pe.memo(({thread:e,selectedThreadId:t,maxCommentsBeforeCollapse:n,referenceText:r})=>{const i=sn(zs),o=v.useCallback(a=>{a.target.closest(".bn-action-toolbar")||i.selectThread(e.id)},[i,e.id]),s=v.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;const l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&i.selectThread(void 0)},[i]);return m.jsx(uae,{thread:e,selected:e.id===t,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:o,onBlur:s,tabIndex:0})});function vQe(e){return e.currentTarget instanceof HTMLElement&&e.relatedTarget instanceof HTMLElement?e.currentTarget.contains(e.relatedTarget):!1}function xQe({onBlur:e,onFocus:t}={}){const n=v.useRef(null),[r,i]=v.useState(!1),o=v.useRef(!1),s=c=>{i(c),o.current=c},a=c=>{o.current||(s(!0),t?.(c))},l=c=>{o.current&&!vQe(c)&&(s(!1),e?.(c))};return v.useEffect(()=>{const c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function g_(e){return m.jsx(NKe,{as:"span",className:"bn-inline-content-section","data-inline-content-type":e.inlineContentType,...Object.fromEntries(Object.entries(e.inlineContentProps).filter(([t,n])=>{const r=e.propSchema[t];return n!==r.default}).map(([t,n])=>[N0(t),n])),children:e.children})}function dae(e,t){var n;const r=Xs.create({name:e.type,inline:!0,group:"inline",selectable:e.content==="styled",atom:e.content==="none",draggable:(n=t.meta)==null?void 0:n.draggable,content:e.content==="styled"?"inline*":"",addAttributes(){return Gie(e.propSchema)},addKeyboardShortcuts(){return MUe(e)},parseHTML(){return jWe(e,t.parse)},renderHTML({node:i}){const o=this.options.editor,s=k0(i,o.schema.inlineContentSchema,o.schema.styleSchema),a=t.toExternalHTML||t.render,l=h_(c=>m.jsx(a,{contentRef:u=>{c(u),u&&(u.dataset.editable="")},inlineContent:s,updateInlineContent:()=>{},editor:o}),o);return OUe(l,e.type,i.attrs,e.propSchema)},addNodeView(){const i=this.options.editor;return o=>MKe(s=>{const a=Fse().nodeViewContentRef;if(!a)throw new Error("nodeViewContentRef is not set");const l=t.render;return m.jsx(g_,{inlineContentProps:s.node.attrs,inlineContentType:e.type,propSchema:e.propSchema,children:m.jsx(l,{contentRef:c=>{a(c),c&&(c.dataset.editable="")},editor:i,inlineContent:k0(s.node,i.schema.inlineContentSchema,i.schema.styleSchema),updateInlineContent:c=>{const u=Vs([c],i.pmSchema),f=s.getPos();f!==void 0&&i.transact(h=>h.replaceWith(f,f+s.node.nodeSize,u))}})})},{className:"bn-ic-react-node-view-renderer",as:"span"})(o)}});return LUe(e,{...t,node:r,render(i,o,s){const a=t.render;return h_(l=>m.jsx(g_,{inlineContentProps:i.props,inlineContentType:e.type,propSchema:e.propSchema,children:m.jsx(a,{contentRef:c=>{l(c),c&&(c.dataset.editable="")},editor:s,inlineContent:i,updateInlineContent:o})}),s)},toExternalHTML(i,o){const s=t.toExternalHTML||t.render;return h_(a=>m.jsx(g_,{inlineContentProps:i.props,inlineContentType:e.type,propSchema:e.propSchema,children:m.jsx(s,{contentRef:l=>{a(l),l&&(l.dataset.editable="")},editor:o,inlineContent:i,updateInlineContent:()=>{}})}),o)}})}function fae(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.top<r.top,o=n.bottom>r.bottom;return i&&o?"both":i?"top":o?"bottom":"none"}function pae(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var jy=e=>e.type==="checkbox",Md=e=>e instanceof Date,xo=e=>e==null;const hae=e=>typeof e=="object";var Br=e=>!xo(e)&&!Array.isArray(e)&&hae(e)&&!Md(e),EQe=e=>Br(e)&&e.target?jy(e.target)?e.target.checked:e.target.value:e,SQe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,wQe=(e,t)=>e.has(SQe(t)),CQe=e=>{const t=e.constructor&&e.constructor.prototype;return Br(t)&&t.hasOwnProperty("isPrototypeOf")},QP=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qr(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(QP&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Br(e)&&CQe(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=Qr(e[i]));return r}var cT=e=>/^\w*$/.test(e),br=e=>e===void 0,JP=e=>Array.isArray(e)?e.filter(Boolean):[],eF=e=>JP(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Je=(e,t,n)=>{if(!t||!Br(e))return n;const r=(cT(t)?[t]:eF(t)).reduce((i,o)=>xo(i)?i:i[o],e);return br(r)||r===e?br(e[t])?n:e[t]:r},ja=e=>typeof e=="boolean",oa=e=>typeof e=="function",nr=(e,t,n)=>{let r=-1;const i=cT(t)?[t]:eF(t),o=i.length,s=o-1;for(;++r<o;){const a=i[r];let l=n;if(r!==s){const c=e[a];l=Br(c)||Array.isArray(c)?c:isNaN(+i[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=l,e=e[a]}};const Jq={BLUR:"blur",FOCUS_OUT:"focusout"},sa={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},$l={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mae=pe.createContext(null);mae.displayName="HookFormContext";const TQe=e=>{const{children:t,...n}=e;return pe.createElement(mae.Provider,{value:n},t)};var kQe=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const s=o;return t._proxyFormState[s]!==sa.all&&(t._proxyFormState[s]=!r||sa.all),e[s]}});return i};const AQe=typeof window<"u"?pe.useLayoutEffect:pe.useEffect;var Wo=e=>typeof e=="string",NQe=(e,t,n,r,i)=>Wo(e)?(r&&t.watch.add(e),Je(n,e,i)):Array.isArray(e)?e.map(o=>(r&&t.watch.add(o),Je(n,o))):(r&&(t.watchAll=!0),n),aI=e=>xo(e)||!hae(e);function ru(e,t,n=new WeakSet){if(aI(e)||aI(t))return Object.is(e,t);if(Md(e)&&Md(t))return e.getTime()===t.getTime();const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of r){const s=e[o];if(!i.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Md(s)&&Md(a)||Br(s)&&Br(a)||Array.isArray(s)&&Array.isArray(a)?!ru(s,a,n):!Object.is(s,a))return!1}}return!0}var _Qe=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Mb=e=>Array.isArray(e)?e:[e],eW=()=>{let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}};function gae(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],o=t[r];if(i&&Br(i)&&o){const s=gae(i,o);Br(s)&&(n[r]=s)}else e[r]&&(n[r]=o)}return n}var Gi=e=>Br(e)&&!Object.keys(e).length,tF=e=>e.type==="file",tw=e=>{if(!QP)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},bae=e=>e.type==="select-multiple",nF=e=>e.type==="radio",RQe=e=>nF(e)||jy(e),b_=e=>tw(e)&&e.isConnected;function DQe(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=br(e)?r++:e[t[r++]];return e}function IQe(e){for(const t in e)if(e.hasOwnProperty(t)&&!br(e[t]))return!1;return!0}function Rr(e,t){const n=Array.isArray(t)?t:cT(t)?[t]:eF(t),r=n.length===1?e:DQe(e,n),i=n.length-1,o=n[i];return r&&delete r[o],i!==0&&(Br(r)&&Gi(r)||Array.isArray(r)&&IQe(r))&&Rr(e,n.slice(0,-1)),e}var OQe=e=>{for(const t in e)if(oa(e[t]))return!0;return!1};function yae(e){return Array.isArray(e)||Br(e)&&!OQe(e)}function lI(e,t={}){for(const n in e){const r=e[n];yae(r)?(t[n]=Array.isArray(r)?[]:{},lI(r,t[n])):br(r)||(t[n]=!0)}return t}function jp(e,t,n){n||(n=lI(t));for(const r in e){const i=e[r];if(yae(i))br(t)||aI(n[r])?n[r]=lI(i,Array.isArray(i)?[]:{}):jp(i,xo(t)?{}:t[r],n[r]);else{const o=t[r];n[r]=!ru(i,o)}}return n}const tW={value:!1,isValid:!1},nW={value:!0,isValid:!0};var vae=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&&!br(e[0].attributes.value)?br(e[0].value)||e[0].value===""?nW:{value:e[0].value,isValid:!0}:nW:tW}return tW},xae=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>br(e)?e:t?e===""?NaN:e&&+e:n&&Wo(e)?new Date(e):r?r(e):e;const rW={isValid:!1,value:null};var Eae=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,rW):rW;function iW(e){const t=e.ref;return tF(t)?t.files:nF(t)?Eae(e.refs).value:bae(t)?[...t.selectedOptions].map(({value:n})=>n):jy(t)?vae(e.refs).value:xae(br(t.value)?e.ref.value:t.value,e)}var MQe=(e,t,n,r)=>{const i={};for(const o of e){const s=Je(t,o);s&&nr(i,o,s._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},nw=e=>e instanceof RegExp,Gg=e=>br(e)?e:nw(e)?e.source:Br(e)?nw(e.value)?e.value.source:e.value:e,oW=e=>({isOnSubmit:!e||e===sa.onSubmit,isOnBlur:e===sa.onBlur,isOnChange:e===sa.onChange,isOnAll:e===sa.all,isOnTouch:e===sa.onTouched});const sW="AsyncFunction";var LQe=e=>!!e&&!!e.validate&&!!(oa(e.validate)&&e.validate.constructor.name===sW||Br(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===sW)),PQe=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),aW=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Lb=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const o=Je(e,i);if(o){const{_f:s,...a}=o;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],i)&&!r)return!0;if(s.ref&&t(s.ref,s.name)&&!r)return!0;if(Lb(a,t))break}else if(Br(a)&&Lb(a,t))break}}};function lW(e,t,n){const r=Je(e,n);if(r||cT(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=Je(t,o),a=Je(e,o);if(s&&!Array.isArray(s)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};i.pop()}return{name:n}}var FQe=(e,t,n,r)=>{n(e);const{name:i,...o}=e;return Gi(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(s=>t[s]===(!r||sa.all))},BQe=(e,t,n)=>!e||!t||e===t||Mb(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),jQe=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,$Qe=(e,t)=>!JP(Je(e,t)).length&&Rr(e,t),UQe=(e,t,n)=>{const r=Mb(Je(e,n));return nr(r,"root",t[n]),nr(e,n,r),e};function cW(e,t,n="validate"){if(Wo(e)||Array.isArray(e)&&e.every(Wo)||ja(e)&&!e)return{type:n,message:Wo(e)?e:"",ref:t}}var Ip=e=>Br(e)&&!nw(e)?e:{value:e,message:""},uW=async(e,t,n,r,i,o)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:f,max:h,pattern:g,validate:y,name:E,valueAsNumber:S,mount:w}=e._f,T=Je(n,E);if(!w||t.has(E))return{};const A=a?a[0]:s,R=H=>{i&&A.reportValidity&&(A.setCustomValidity(ja(H)?"":H||""),A.reportValidity())},_={},D=nF(s),I=jy(s),M=D||I,j=(S||tF(s))&&br(s.value)&&br(T)||tw(s)&&s.value===""||T===""||Array.isArray(T)&&!T.length,L=_Qe.bind(null,E,r,_),F=(H,Y,$,G=$l.maxLength,V=$l.minLength)=>{const X=H?Y:$;_[E]={type:H?G:V,message:X,ref:s,...L(H?G:V,X)}};if(o?!Array.isArray(T)||!T.length:l&&(!M&&(j||xo(T))||ja(T)&&!T||I&&!vae(a).isValid||D&&!Eae(a).isValid)){const{value:H,message:Y}=Wo(l)?{value:!!l,message:l}:Ip(l);if(H&&(_[E]={type:$l.required,message:Y,ref:A,...L($l.required,Y)},!r))return R(Y),_}if(!j&&(!xo(f)||!xo(h))){let H,Y;const $=Ip(h),G=Ip(f);if(!xo(T)&&!isNaN(T)){const V=s.valueAsNumber||T&&+T;xo($.value)||(H=V>$.value),xo(G.value)||(Y=V<G.value)}else{const V=s.valueAsDate||new Date(T),X=B=>new Date(new Date().toDateString()+" "+B),Q=s.type=="time",J=s.type=="week";Wo($.value)&&T&&(H=Q?X(T)>X($.value):J?T>$.value:V>new Date($.value)),Wo(G.value)&&T&&(Y=Q?X(T)<X(G.value):J?T<G.value:V<new Date(G.value))}if((H||Y)&&(F(!!H,$.message,G.message,$l.max,$l.min),!r))return R(_[E].message),_}if((c||u)&&!j&&(Wo(T)||o&&Array.isArray(T))){const H=Ip(c),Y=Ip(u),$=!xo(H.value)&&T.length>+H.value,G=!xo(Y.value)&&T.length<+Y.value;if(($||G)&&(F($,H.message,Y.message),!r))return R(_[E].message),_}if(g&&!j&&Wo(T)){const{value:H,message:Y}=Ip(g);if(nw(H)&&!T.match(H)&&(_[E]={type:$l.pattern,message:Y,ref:s,...L($l.pattern,Y)},!r))return R(Y),_}if(y){if(oa(y)){const H=await y(T,n),Y=cW(H,A);if(Y&&(_[E]={...Y,...L($l.validate,Y.message)},!r))return R(Y.message),_}else if(Br(y)){let H={};for(const Y in y){if(!Gi(H)&&!r)break;const $=cW(await y[Y](T,n),A,Y);$&&(H={...$,...L(Y,$.message)},R($.message),r&&(_[E]=H))}if(!Gi(H)&&(_[E]={ref:A,...H},!r))return _}}return R(!0),_};const HQe={mode:sa.onSubmit,reValidateMode:sa.onChange,shouldFocusError:!0};function zQe(e={}){let t={...HQe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:oa(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=Br(t.defaultValues)||Br(t.values)?Qr(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Qr(i),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let h={...f};const g={array:eW(),state:eW()},y=t.criteriaMode===sa.all,E=re=>de=>{clearTimeout(c),c=setTimeout(re,de)},S=async re=>{if(!s.keepIsValid&&!t.disabled&&(f.isValid||h.isValid||re)){let de;t.resolver?(de=Gi((await M()).errors),w()):de=await L(r,!0),de!==n.isValid&&g.state.next({isValid:de})}},w=(re,de)=>{!t.disabled&&(f.isValidating||f.validatingFields||h.isValidating||h.validatingFields)&&((re||Array.from(a.mount)).forEach(ye=>{ye&&(de?nr(n.validatingFields,ye,de):Rr(n.validatingFields,ye))}),g.state.next({validatingFields:n.validatingFields,isValidating:!Gi(n.validatingFields)}))},T=(re,de=[],ye,Me,Fe=!0,q=!0)=>{if(Me&&ye&&!t.disabled){if(s.action=!0,q&&Array.isArray(Je(r,re))){const ge=ye(Je(r,re),Me.argA,Me.argB);Fe&&nr(r,re,ge)}if(q&&Array.isArray(Je(n.errors,re))){const ge=ye(Je(n.errors,re),Me.argA,Me.argB);Fe&&nr(n.errors,re,ge),$Qe(n.errors,re)}if((f.touchedFields||h.touchedFields)&&q&&Array.isArray(Je(n.touchedFields,re))){const ge=ye(Je(n.touchedFields,re),Me.argA,Me.argB);Fe&&nr(n.touchedFields,re,ge)}(f.dirtyFields||h.dirtyFields)&&(n.dirtyFields=jp(i,o)),g.state.next({name:re,isDirty:H(re,de),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else nr(o,re,de)},A=(re,de)=>{nr(n.errors,re,de),g.state.next({errors:n.errors})},R=re=>{n.errors=re,g.state.next({errors:n.errors,isValid:!1})},_=(re,de,ye,Me)=>{const Fe=Je(r,re);if(Fe){const q=Je(o,re,br(ye)?Je(i,re):ye);br(q)||Me&&Me.defaultChecked||de?nr(o,re,de?q:iW(Fe._f)):G(re,q),s.mount&&!s.action&&S()}},D=(re,de,ye,Me,Fe)=>{let q=!1,ge=!1;const De={name:re};if(!t.disabled){if(!ye||Me){(f.isDirty||h.isDirty)&&(ge=n.isDirty,n.isDirty=De.isDirty=H(),q=ge!==De.isDirty);const He=ru(Je(i,re),de);ge=!!Je(n.dirtyFields,re),He?Rr(n.dirtyFields,re):nr(n.dirtyFields,re,!0),De.dirtyFields=n.dirtyFields,q=q||(f.dirtyFields||h.dirtyFields)&&ge!==!He}if(ye){const He=Je(n.touchedFields,re);He||(nr(n.touchedFields,re,ye),De.touchedFields=n.touchedFields,q=q||(f.touchedFields||h.touchedFields)&&He!==ye)}q&&Fe&&g.state.next(De)}return q?De:{}},I=(re,de,ye,Me)=>{const Fe=Je(n.errors,re),q=(f.isValid||h.isValid)&&ja(de)&&n.isValid!==de;if(t.delayError&&ye?(l=E(()=>A(re,ye)),l(t.delayError)):(clearTimeout(c),l=null,ye?nr(n.errors,re,ye):Rr(n.errors,re)),(ye?!ru(Fe,ye):Fe)||!Gi(Me)||q){const ge={...Me,...q&&ja(de)?{isValid:de}:{},errors:n.errors,name:re};n={...n,...ge},g.state.next(ge)}},M=async re=>(w(re,!0),await t.resolver(o,t.context,MQe(re||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),j=async re=>{const{errors:de}=await M(re);if(w(re),re)for(const ye of re){const Me=Je(de,ye);Me?nr(n.errors,ye,Me):Rr(n.errors,ye)}else n.errors=de;return de},L=async(re,de,ye={valid:!0})=>{for(const Me in re){const Fe=re[Me];if(Fe){const{_f:q,...ge}=Fe;if(q){const De=a.array.has(q.name),He=Fe._f&&LQe(Fe._f);He&&f.validatingFields&&w([q.name],!0);const ot=await uW(Fe,a.disabled,o,y,t.shouldUseNativeValidation&&!de,De);if(He&&f.validatingFields&&w([q.name]),ot[q.name]&&(ye.valid=!1,de))break;!de&&(Je(ot,q.name)?De?UQe(n.errors,ot,q.name):nr(n.errors,q.name,ot[q.name]):Rr(n.errors,q.name))}!Gi(ge)&&await L(ge,de,ye)}}return ye.valid},F=()=>{for(const re of a.unMount){const de=Je(r,re);de&&(de._f.refs?de._f.refs.every(ye=>!b_(ye)):!b_(de._f.ref))&&oe(re)}a.unMount=new Set},H=(re,de)=>!t.disabled&&(re&&de&&nr(o,re,de),!ru(W(),i)),Y=(re,de,ye)=>NQe(re,a,{...s.mount?o:br(de)?i:Wo(re)?{[re]:de}:de},ye,de),$=re=>JP(Je(s.mount?o:i,re,t.shouldUnregister?Je(i,re,[]):[])),G=(re,de,ye={})=>{const Me=Je(r,re);let Fe=de;if(Me){const q=Me._f;q&&(!q.disabled&&nr(o,re,xae(de,q)),Fe=tw(q.ref)&&xo(de)?"":de,bae(q.ref)?[...q.ref.options].forEach(ge=>ge.selected=Fe.includes(ge.value)):q.refs?jy(q.ref)?q.refs.forEach(ge=>{(!ge.defaultChecked||!ge.disabled)&&(Array.isArray(Fe)?ge.checked=!!Fe.find(De=>De===ge.value):ge.checked=Fe===ge.value||!!Fe)}):q.refs.forEach(ge=>ge.checked=ge.value===Fe):tF(q.ref)?q.ref.value="":(q.ref.value=Fe,q.ref.type||g.state.next({name:re,values:Qr(o)})))}(ye.shouldDirty||ye.shouldTouch)&&D(re,Fe,ye.shouldTouch,ye.shouldDirty,!0),ye.shouldValidate&&B(re)},V=(re,de,ye)=>{for(const Me in de){if(!de.hasOwnProperty(Me))return;const Fe=de[Me],q=re+"."+Me,ge=Je(r,q);(a.array.has(re)||Br(Fe)||ge&&!ge._f)&&!Md(Fe)?V(q,Fe,ye):G(q,Fe,ye)}},X=(re,de,ye={})=>{const Me=Je(r,re),Fe=a.array.has(re),q=Qr(de);nr(o,re,q),Fe?(g.array.next({name:re,values:Qr(o)}),(f.isDirty||f.dirtyFields||h.isDirty||h.dirtyFields)&&ye.shouldDirty&&g.state.next({name:re,dirtyFields:jp(i,o),isDirty:H(re,q)})):Me&&!Me._f&&!xo(q)?V(re,q,ye):G(re,q,ye),aW(re,a)&&g.state.next({...n,name:re}),g.state.next({name:s.mount?re:void 0,values:Qr(o)})},Q=async re=>{s.mount=!0;const de=re.target;let ye=de.name,Me=!0;const Fe=Je(r,ye),q=He=>{Me=Number.isNaN(He)||Md(He)&&isNaN(He.getTime())||ru(He,Je(o,ye,He))},ge=oW(t.mode),De=oW(t.reValidateMode);if(Fe){let He,ot;const an=de.type?iW(Fe._f):EQe(re),fn=re.type===Jq.BLUR||re.type===Jq.FOCUS_OUT,Dn=!PQe(Fe._f)&&!t.resolver&&!Je(n.errors,ye)&&!Fe._f.deps||jQe(fn,Je(n.touchedFields,ye),n.isSubmitted,De,ge),vn=aW(ye,a,fn);nr(o,ye,an),fn?(!de||!de.readOnly)&&(Fe._f.onBlur&&Fe._f.onBlur(re),l&&l(0)):Fe._f.onChange&&Fe._f.onChange(re);const xn=D(ye,an,fn),Ae=!Gi(xn)||vn;if(!fn&&g.state.next({name:ye,type:re.type,values:Qr(o)}),Dn)return(f.isValid||h.isValid)&&(t.mode==="onBlur"?fn&&S():fn||S()),Ae&&g.state.next({name:ye,...vn?{}:xn});if(!fn&&vn&&g.state.next({...n}),t.resolver){const{errors:Ge}=await M([ye]);if(w([ye]),q(an),Me){const gt=lW(n.errors,r,ye),lt=lW(Ge,r,gt.name||ye);He=lt.error,ye=lt.name,ot=Gi(Ge)}}else w([ye],!0),He=(await uW(Fe,a.disabled,o,y,t.shouldUseNativeValidation))[ye],w([ye]),q(an),Me&&(He?ot=!1:(f.isValid||h.isValid)&&(ot=await L(r,!0)));Me&&(Fe._f.deps&&(!Array.isArray(Fe._f.deps)||Fe._f.deps.length>0)&&B(Fe._f.deps),I(ye,ot,He,xn))}},J=(re,de)=>{if(Je(n.errors,de)&&re.focus)return re.focus(),1},B=async(re,de={})=>{let ye,Me;const Fe=Mb(re);if(t.resolver){const q=await j(br(re)?re:Fe);ye=Gi(q),Me=re?!Fe.some(ge=>Je(q,ge)):ye}else re?(Me=(await Promise.all(Fe.map(async q=>{const ge=Je(r,q);return await L(ge&&ge._f?{[q]:ge}:ge)}))).every(Boolean),!(!Me&&!n.isValid)&&S()):Me=ye=await L(r);return g.state.next({...!Wo(re)||(f.isValid||h.isValid)&&ye!==n.isValid?{}:{name:re},...t.resolver||!re?{isValid:ye}:{},errors:n.errors}),de.shouldFocus&&!Me&&Lb(r,J,re?Fe:a.mount),Me},W=(re,de)=>{let ye={...s.mount?o:i};return de&&(ye=gae(de.dirtyFields?n.dirtyFields:n.touchedFields,ye)),br(re)?ye:Wo(re)?Je(ye,re):re.map(Me=>Je(ye,Me))},K=(re,de)=>({invalid:!!Je((de||n).errors,re),isDirty:!!Je((de||n).dirtyFields,re),error:Je((de||n).errors,re),isValidating:!!Je(n.validatingFields,re),isTouched:!!Je((de||n).touchedFields,re)}),P=re=>{re&&Mb(re).forEach(de=>Rr(n.errors,de)),g.state.next({errors:re?n.errors:{}})},ce=(re,de,ye)=>{const Me=(Je(r,re,{_f:{}})._f||{}).ref,Fe=Je(n.errors,re)||{},{ref:q,message:ge,type:De,...He}=Fe;nr(n.errors,re,{...He,...de,ref:Me}),g.state.next({name:re,errors:n.errors,isValid:!1}),ye&&ye.shouldFocus&&Me&&Me.focus&&Me.focus()},le=(re,de)=>oa(re)?g.state.subscribe({next:ye=>"values"in ye&&re(Y(void 0,de),ye)}):Y(re,de,!0),se=re=>g.state.subscribe({next:de=>{BQe(re.name,de.name,re.exact)&&FQe(de,re.formState||f,Vn,re.reRenderRoot)&&re.callback({values:{...o},...n,...de,defaultValues:i})}}).unsubscribe,te=re=>(s.mount=!0,h={...h,...re.formState},se({...re,formState:{...u,...re.formState}})),oe=(re,de={})=>{for(const ye of re?Mb(re):a.mount)a.mount.delete(ye),a.array.delete(ye),de.keepValue||(Rr(r,ye),Rr(o,ye)),!de.keepError&&Rr(n.errors,ye),!de.keepDirty&&Rr(n.dirtyFields,ye),!de.keepTouched&&Rr(n.touchedFields,ye),!de.keepIsValidating&&Rr(n.validatingFields,ye),!t.shouldUnregister&&!de.keepDefaultValue&&Rr(i,ye);g.state.next({values:Qr(o)}),g.state.next({...n,...de.keepDirty?{isDirty:H()}:{}}),!de.keepIsValid&&S()},ue=({disabled:re,name:de})=>{(ja(re)&&s.mount||re||a.disabled.has(de))&&(re?a.disabled.add(de):a.disabled.delete(de))},Te=(re,de={})=>{let ye=Je(r,re);const Me=ja(de.disabled)||ja(t.disabled);return nr(r,re,{...ye||{},_f:{...ye&&ye._f?ye._f:{ref:{name:re}},name:re,mount:!0,...de}}),a.mount.add(re),ye?ue({disabled:ja(de.disabled)?de.disabled:t.disabled,name:re}):_(re,!0,de.value),{...Me?{disabled:de.disabled||t.disabled}:{},...t.progressive?{required:!!de.required,min:Gg(de.min),max:Gg(de.max),minLength:Gg(de.minLength),maxLength:Gg(de.maxLength),pattern:Gg(de.pattern)}:{},name:re,onChange:Q,onBlur:Q,ref:Fe=>{if(Fe){Te(re,de),ye=Je(r,re);const q=br(Fe.value)&&Fe.querySelectorAll&&Fe.querySelectorAll("input,select,textarea")[0]||Fe,ge=RQe(q),De=ye._f.refs||[];if(ge?De.find(He=>He===q):q===ye._f.ref)return;nr(r,re,{_f:{...ye._f,...ge?{refs:[...De.filter(b_),q,...Array.isArray(Je(i,re))?[{}]:[]],ref:{type:q.type,name:re}}:{ref:q}}}),_(re,!1,void 0,q)}else ye=Je(r,re,{}),ye._f&&(ye._f.mount=!1),(t.shouldUnregister||de.shouldUnregister)&&!(wQe(a.array,re)&&s.action)&&a.unMount.add(re)}}},Ie=()=>t.shouldFocusError&&Lb(r,J,a.mount),ke=re=>{ja(re)&&(g.state.next({disabled:re}),Lb(r,(de,ye)=>{const Me=Je(r,ye);Me&&(de.disabled=Me._f.disabled||re,Array.isArray(Me._f.refs)&&Me._f.refs.forEach(Fe=>{Fe.disabled=Me._f.disabled||re}))},0,!1))},tt=(re,de)=>async ye=>{let Me;ye&&(ye.preventDefault&&ye.preventDefault(),ye.persist&&ye.persist());let Fe=Qr(o);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:q,values:ge}=await M();w(),n.errors=q,Fe=Qr(ge)}else await L(r);if(a.disabled.size)for(const q of a.disabled)Rr(Fe,q);if(Rr(n.errors,"root"),Gi(n.errors)){g.state.next({errors:{}});try{await re(Fe,ye)}catch(q){Me=q}}else de&&await de({...n.errors},ye),Ie(),setTimeout(Ie);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gi(n.errors)&&!Me,submitCount:n.submitCount+1,errors:n.errors}),Me)throw Me},rt=(re,de={})=>{Je(r,re)&&(br(de.defaultValue)?X(re,Qr(Je(i,re))):(X(re,de.defaultValue),nr(i,re,Qr(de.defaultValue))),de.keepTouched||Rr(n.touchedFields,re),de.keepDirty||(Rr(n.dirtyFields,re),n.isDirty=de.defaultValue?H(re,Qr(Je(i,re))):H()),de.keepError||(Rr(n.errors,re),f.isValid&&S()),g.state.next({...n}))},ze=(re,de={})=>{const ye=re?Qr(re):i,Me=Qr(ye),Fe=Gi(re),q=Fe?i:Me;if(de.keepDefaultValues||(i=ye),!de.keepValues){if(de.keepDirtyValues){const ge=new Set([...a.mount,...Object.keys(jp(i,o))]);for(const De of Array.from(ge))Je(n.dirtyFields,De)?nr(q,De,Je(o,De)):X(De,Je(q,De))}else{if(QP&&br(re))for(const ge of a.mount){const De=Je(r,ge);if(De&&De._f){const He=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(tw(He)){const ot=He.closest("form");if(ot){ot.reset();break}}}}if(de.keepFieldsRef)for(const ge of a.mount)X(ge,Je(q,ge));else r={}}o=t.shouldUnregister?de.keepDefaultValues?Qr(i):{}:Qr(q),g.array.next({values:{...q}}),g.state.next({values:{...q}})}a={mount:de.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!f.isValid||!!de.keepIsValid||!!de.keepDirtyValues||!t.shouldUnregister&&!Gi(q),s.watch=!!t.shouldUnregister,s.keepIsValid=!!de.keepIsValid,s.action=!1,de.keepErrors||(n.errors={}),g.state.next({submitCount:de.keepSubmitCount?n.submitCount:0,isDirty:Fe?!1:de.keepDirty?n.isDirty:!!(de.keepDefaultValues&&!ru(re,i)),isSubmitted:de.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Fe?{}:de.keepDirtyValues?de.keepDefaultValues&&o?jp(i,o):n.dirtyFields:de.keepDefaultValues&&re?jp(i,re):de.keepDirty?n.dirtyFields:{},touchedFields:de.keepTouched?n.touchedFields:{},errors:de.keepErrors?n.errors:{},isSubmitSuccessful:de.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},dn=(re,de)=>ze(oa(re)?re(o):re,{...t.resetOptions,...de}),nt=(re,de={})=>{const ye=Je(r,re),Me=ye&&ye._f;if(Me){const Fe=Me.refs?Me.refs[0]:Me.ref;Fe.focus&&setTimeout(()=>{Fe.focus(),de.shouldSelect&&oa(Fe.select)&&Fe.select()})}},Vn=re=>{n={...n,...re}},xt={control:{register:Te,unregister:oe,getFieldState:K,handleSubmit:tt,setError:ce,_subscribe:se,_runSchema:M,_updateIsValidating:w,_focusError:Ie,_getWatch:Y,_getDirty:H,_setValid:S,_setFieldArray:T,_setDisabledField:ue,_setErrors:R,_getFieldArray:$,_reset:ze,_resetDefaultValues:()=>oa(t.defaultValues)&&t.defaultValues().then(re=>{dn(re,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:ke,_subjects:g,_proxyFormState:f,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(re){s=re},get _defaultValues(){return i},get _names(){return a},set _names(re){a=re},get _formState(){return n},get _options(){return t},set _options(re){t={...t,...re}}},subscribe:te,trigger:B,register:Te,handleSubmit:tt,watch:le,setValue:X,getValues:W,reset:dn,resetField:rt,clearErrors:P,unregister:oe,setError:ce,setFocus:nt,getFieldState:K};return{...xt,formControl:xt}}function VQe(e={}){const t=pe.useRef(void 0),n=pe.useRef(void 0),[r,i]=pe.useState({isDirty:!1,isValidating:!1,isLoading:oa(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:oa(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!oa(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=zQe(e);t.current={...a,formState:r}}const o=t.current.control;return o._options=e,AQe(()=>{const s=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(a=>({...a,isReady:!0})),o._formState.isReady=!0,s},[o]),pe.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),pe.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),pe.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),pe.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),pe.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==r.isDirty&&o._subjects.state.next({isDirty:s})}},[o,r.isDirty]),pe.useEffect(()=>{var s;e.values&&!ru(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((s=o._options.resetOptions)===null||s===void 0)&&s.keepIsValid||o._setValid(),n.current=e.values,i(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),pe.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=kQe(r,o),t.current}function Sae(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s);a.displayName=o+"Context";const l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,GQe(i,...t)]}function GQe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var qQe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],io=qQe.reduce((e,t)=>{const n=OZ(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function WQe(){return Lse.useSyncExternalStore(YQe,()=>!0,()=>!1)}function YQe(){return()=>{}}var rF="Avatar",[KQe]=Sae(rF),[XQe,wae]=KQe(rF),Cae=v.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[i,o]=v.useState("idle");return m.jsx(XQe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:m.jsx(io.span,{...r,ref:t})})});Cae.displayName=rF;var Tae="AvatarImage",kae=v.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...o}=e,s=wae(Tae,n),a=ZQe(r,o),l=Gr(c=>{i(c),s.onImageLoadingStatusChange(c)});return Sr(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?m.jsx(io.img,{...o,ref:t,src:r}):null});kae.displayName=Tae;var Aae="AvatarFallback",Nae=v.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...i}=e,o=wae(Aae,n),[s,a]=v.useState(r===void 0);return v.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&o.imageLoadingStatus!=="loaded"?m.jsx(io.span,{...i,ref:t}):null});Nae.displayName=Aae;function dW(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function ZQe(e,{referrerPolicy:t,crossOrigin:n}){const r=WQe(),i=v.useRef(null),o=r?(i.current||(i.current=new window.Image),i.current):null,[s,a]=v.useState(()=>dW(o,e));return Sr(()=>{a(dW(o,e))},[o,e]),Sr(()=>{const l=f=>()=>{a(f)};if(!o)return;const c=l("loaded"),u=l("error");return o.addEventListener("load",c),o.addEventListener("error",u),t&&(o.referrerPolicy=t),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",c),o.removeEventListener("error",u)}},[o,n,t]),s}var QQe=Cae,JQe=kae,eJe=Nae;const iF="-",tJe=e=>{const t=rJe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(iF);return a[0]===""&&a.length!==1&&a.shift(),_ae(a,t)||nJe(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},_ae=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?_ae(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(iF);return t.validators.find(({validator:s})=>s(o))?.classGroupId},fW=/^\[(.+)\]$/,nJe=e=>{if(fW.test(e)){const t=fW.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},rJe=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return oJe(Object.entries(e.classGroups),n).forEach(([o,s])=>{cI(s,r,o,t)}),r},cI=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:pW(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(iJe(i)){cI(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{cI(s,pW(t,o),n,r)})})},pW=(e,t)=>{let n=e;return t.split(iF).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},iJe=e=>e.isThemeGetter,oJe=(e,t)=>t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e,sJe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},Rae="!",aJe=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],o=t.length,s=a=>{const l=[];let c=0,u=0,f;for(let S=0;S<a.length;S++){let w=a[S];if(c===0){if(w===i&&(r||a.slice(S,S+o)===t)){l.push(a.slice(u,S)),u=S+o;continue}if(w==="/"){f=S;continue}}w==="["?c++:w==="]"&&c--}const h=l.length===0?a:a.substring(u),g=h.startsWith(Rae),y=g?h.substring(1):h,E=f&&f>u?f-u:void 0;return{modifiers:l,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:E}};return n?a=>n({className:a,parseClassName:s}):s},lJe=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},cJe=e=>({cache:sJe(e.cacheSize),parseClassName:aJe(e),...tJe(e)}),uJe=/\s+/,dJe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(uJe);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:g}=n(c);let y=!!g,E=r(y?h.substring(0,g):h);if(!E){if(!y){a=c+(a.length>0?" "+a:a);continue}if(E=r(h),!E){a=c+(a.length>0?" "+a:a);continue}y=!1}const S=lJe(u).join(":"),w=f?S+Rae:S,T=w+E;if(o.includes(T))continue;o.push(T);const A=i(E,y);for(let R=0;R<A.length;++R){const _=A[R];o.push(w+_)}a=c+(a.length>0?" "+a:a)}return a};function fJe(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Dae(t))&&(r&&(r+=" "),r+=n);return r}const Dae=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Dae(e[r]))&&(n&&(n+=" "),n+=t);return n};function pJe(e,...t){let n,r,i,o=s;function s(l){const c=t.reduce((u,f)=>f(u),e());return n=cJe(c),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=dJe(l,n);return i(l,u),u}return function(){return o(fJe.apply(null,arguments))}}const Yn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Iae=/^\[(?:([a-z-]+):)?(.+)\]$/i,hJe=/^\d+\/\d+$/,mJe=new Set(["px","full","screen"]),gJe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bJe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yJe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,vJe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xJe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ul=e=>mh(e)||mJe.has(e)||hJe.test(e),Uc=e=>Rm(e,"length",NJe),mh=e=>!!e&&!Number.isNaN(Number(e)),y_=e=>Rm(e,"number",mh),qg=e=>!!e&&Number.isInteger(Number(e)),EJe=e=>e.endsWith("%")&&mh(e.slice(0,-1)),At=e=>Iae.test(e),Hc=e=>gJe.test(e),SJe=new Set(["length","size","percentage"]),wJe=e=>Rm(e,SJe,Oae),CJe=e=>Rm(e,"position",Oae),TJe=new Set(["image","url"]),kJe=e=>Rm(e,TJe,RJe),AJe=e=>Rm(e,"",_Je),Wg=()=>!0,Rm=(e,t,n)=>{const r=Iae.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},NJe=e=>bJe.test(e)&&!yJe.test(e),Oae=()=>!1,_Je=e=>vJe.test(e),RJe=e=>xJe.test(e),DJe=()=>{const e=Yn("colors"),t=Yn("spacing"),n=Yn("blur"),r=Yn("brightness"),i=Yn("borderColor"),o=Yn("borderRadius"),s=Yn("borderSpacing"),a=Yn("borderWidth"),l=Yn("contrast"),c=Yn("grayscale"),u=Yn("hueRotate"),f=Yn("invert"),h=Yn("gap"),g=Yn("gradientColorStops"),y=Yn("gradientColorStopPositions"),E=Yn("inset"),S=Yn("margin"),w=Yn("opacity"),T=Yn("padding"),A=Yn("saturate"),R=Yn("scale"),_=Yn("sepia"),D=Yn("skew"),I=Yn("space"),M=Yn("translate"),j=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",At,t],H=()=>[At,t],Y=()=>["",Ul,Uc],$=()=>["auto",mh,At],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",At],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[mh,At];return{cacheSize:500,separator:":",theme:{colors:[Wg],spacing:[Ul,Uc],blur:["none","",Hc,At],brightness:W(),borderColor:[e],borderRadius:["none","","full",Hc,At],borderSpacing:H(),borderWidth:Y(),contrast:W(),grayscale:J(),hueRotate:W(),invert:J(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[EJe,Uc],inset:F(),margin:F(),opacity:W(),padding:H(),saturate:W(),scale:W(),sepia:J(),skew:W(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",At]}],container:["container"],columns:[{columns:[Hc]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...G(),At]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[E]}],"inset-x":[{"inset-x":[E]}],"inset-y":[{"inset-y":[E]}],start:[{start:[E]}],end:[{end:[E]}],top:[{top:[E]}],right:[{right:[E]}],bottom:[{bottom:[E]}],left:[{left:[E]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qg,At]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",At]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",qg,At]}],"grid-cols":[{"grid-cols":[Wg]}],"col-start-end":[{col:["auto",{span:["full",qg,At]},At]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[Wg]}],"row-start-end":[{row:["auto",{span:[qg,At]},At]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",At]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",At]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",At,t]}],"min-w":[{"min-w":[At,t,"min","max","fit"]}],"max-w":[{"max-w":[At,t,"none","full","min","max","fit","prose",{screen:[Hc]},Hc]}],h:[{h:[At,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[At,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[At,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[At,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Hc,Uc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",y_]}],"font-family":[{font:[Wg]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",At]}],"line-clamp":[{"line-clamp":["none",mh,y_]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ul,At]}],"list-image":[{"list-image":["none",At]}],"list-style-type":[{list:["none","disc","decimal",At]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ul,Uc]}],"underline-offset":[{"underline-offset":["auto",Ul,At]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",At]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",At]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),CJe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",wJe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kJe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:V()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Ul,At]}],"outline-w":[{outline:[Ul,Uc]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Ul,Uc]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Hc,AJe]}],"shadow-color":[{shadow:[Wg]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Hc,At]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[A]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",At]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",At]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",At]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[qg,At]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",At]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",At]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",At]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ul,Uc,y_]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},IJe=pJe(DJe);function OJe(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,MJe(i,...t)]}function MJe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function LJe(e){const t=PJe(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(BJe);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function PJe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=$Je(i),a=jJe(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var FJe=Symbol("radix.slottable");function BJe(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===FJe}function jJe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function $Je(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var UJe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],HJe=UJe.reduce((e,t)=>{const n=LJe(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function zJe(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,VJe(i,...t)]}function VJe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function hW(e){const t=GJe(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(WJe);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function GJe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=KJe(i),a=YJe(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qJe=Symbol("radix.slottable");function WJe(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qJe}function YJe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function KJe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function oF(e){const t=e+"CollectionProvider",[n,r]=zJe(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=E=>{const{scope:S,children:w}=E,T=pe.useRef(null),A=pe.useRef(new Map).current;return m.jsx(i,{scope:S,itemMap:A,collectionRef:T,children:w})};s.displayName=t;const a=e+"CollectionSlot",l=hW(a),c=pe.forwardRef((E,S)=>{const{scope:w,children:T}=E,A=o(a,w),R=It(S,A.collectionRef);return m.jsx(l,{ref:R,children:T})});c.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",h=hW(u),g=pe.forwardRef((E,S)=>{const{scope:w,children:T,...A}=E,R=pe.useRef(null),_=It(S,R),D=o(u,w);return pe.useEffect(()=>(D.itemMap.set(R,{ref:R,...A}),()=>{D.itemMap.delete(R)})),m.jsx(h,{[f]:"",ref:_,children:T})});g.displayName=u;function y(E){const S=o(e+"CollectionConsumer",E);return pe.useCallback(()=>{const T=S.collectionRef.current;if(!T)return[];const A=Array.from(T.querySelectorAll(`[${f}]`));return Array.from(S.itemMap.values()).sort((D,I)=>A.indexOf(D.ref.current)-A.indexOf(I.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:s,Slot:c,ItemSlot:g},y,r]}function XJe(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,ZJe(i,...t)]}function ZJe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function QJe(e){const t=JJe(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(tet);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function JJe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=ret(i),a=net(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eet=Symbol("radix.slottable");function tet(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eet}function net(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function ret(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var iet=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oet=iet.reduce((e,t)=>{const n=QJe(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),set="Arrow",Mae=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return m.jsx(oet.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});Mae.displayName=set;var aet=Mae;function cet(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,uet(i,...t)]}function uet(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function det(e){const t=fet(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(het);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function fet(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=get(i),a=met(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pet=Symbol("radix.slottable");function het(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pet}function met(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function get(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bet=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lae=bet.reduce((e,t)=>{const n=det(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Pae(e){const[t,n]=v.useState(void 0);return Sr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var sF="Popper",[Fae,Ku]=cet(sF),[yet,Bae]=Fae(sF),jae=e=>{const{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return m.jsx(yet,{scope:t,anchor:r,onAnchorChange:i,children:n})};jae.displayName=sF;var $ae="PopperAnchor",Uae=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=Bae($ae,n),s=v.useRef(null),a=It(t,s),l=v.useRef(null);return v.useEffect(()=>{const c=l.current;l.current=r?.current||s.current,c!==l.current&&o.onAnchorChange(l.current)}),r?null:m.jsx(Lae.div,{...i,ref:a})});Uae.displayName=$ae;var aF="PopperContent",[vet,xet]=Fae(aF),Hae=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:y,...E}=e,S=Bae(aF,n),[w,T]=v.useState(null),A=It(t,te=>T(te)),[R,_]=v.useState(null),D=Pae(R),I=D?.width??0,M=D?.height??0,j=r+(o!=="center"?"-"+o:""),L=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},F=Array.isArray(c)?c:[c],H=F.length>0,Y={padding:L,boundary:F.filter(wet),altBoundary:H},{refs:$,floatingStyles:G,placement:V,isPositioned:X,middlewareData:Q}=tse({strategy:"fixed",placement:j,whileElementsMounted:(...te)=>Joe(...te,{animationFrame:g==="always"}),elements:{reference:S.anchor},middleware:[ha({mainAxis:i+M,alignmentAxis:s}),l&&Nm({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?xqe():void 0,...Y}),l&&_m({...Y}),_0({...Y,apply:({elements:te,rects:oe,availableWidth:ue,availableHeight:Te})=>{const{width:Ie,height:ke}=oe.reference,tt=te.floating.style;tt.setProperty("--radix-popper-available-width",`${ue}px`),tt.setProperty("--radix-popper-available-height",`${Te}px`),tt.setProperty("--radix-popper-anchor-width",`${Ie}px`),tt.setProperty("--radix-popper-anchor-height",`${ke}px`)}}),R&&Sqe({element:R,padding:a}),Cet({arrowWidth:I,arrowHeight:M}),h&&Eqe({strategy:"referenceHidden",...Y})]}),[J,B]=Gae(V),W=Gr(y);Sr(()=>{X&&W?.()},[X,W]);const K=Q.arrow?.x,P=Q.arrow?.y,ce=Q.arrow?.centerOffset!==0,[le,se]=v.useState();return Sr(()=>{w&&se(window.getComputedStyle(w).zIndex)},[w]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:X?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[Q.transformOrigin?.x,Q.transformOrigin?.y].join(" "),...Q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(vet,{scope:n,placedSide:J,onArrowChange:_,arrowX:K,arrowY:P,shouldHideArrow:ce,children:m.jsx(Lae.div,{"data-side":J,"data-align":B,...E,ref:A,style:{...E.style,animation:X?void 0:"none"}})})})});Hae.displayName=aF;var zae="PopperArrow",Eet={top:"bottom",right:"left",bottom:"top",left:"right"},Vae=v.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=xet(zae,r),s=Eet[o.placedSide];return m.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:m.jsx(aet,{...i,ref:n,style:{...i.style,display:"block"}})})});Vae.displayName=zae;function wet(e){return e!==null}var Cet=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Gae(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(i.arrow?.x??0)+a/2,g=(i.arrow?.y??0)+l/2;let y="",E="";return c==="bottom"?(y=s?f:`${h}px`,E=`${-l}px`):c==="top"?(y=s?f:`${h}px`,E=`${r.floating.height+l}px`):c==="right"?(y=`${-l}px`,E=s?f:`${g}px`):c==="left"&&(y=`${r.floating.width+l}px`,E=s?f:`${g}px`),{data:{x:y,y:E}}}});function Gae(e){const[t,n="center"]=e.split("-");return[t,n]}var $y=jae,Uy=Uae,uT=Hae,dT=Vae;function qae(e){const t=Tet(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Aet);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Tet(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=_et(i),a=Net(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ket=Symbol("radix.slottable");function Aet(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ket}function Net(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function _et(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ret=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hy=Ret.reduce((e,t)=>{const n=qae(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Det(e,t){e&&Wr.flushSync(()=>e.dispatchEvent(t))}function Iet(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Oet(i,...t)]}function Oet(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Met(e){const t=Let(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Fet);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Let(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=jet(i),a=Bet(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Pet=Symbol("radix.slottable");function Fet(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Pet}function Bet(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function jet(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $et=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wae=$et.reduce((e,t)=>{const n=Met(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),v_="rovingFocusGroup.onEntryFocus",Uet={bubbles:!1,cancelable:!0},zy="RovingFocusGroup",[uI,Yae,Het]=oF(zy),[zet,fT]=Iet(zy,[Het]),[Vet,Get]=zet(zy),Kae=v.forwardRef((e,t)=>m.jsx(uI.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(uI.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(qet,{...e,ref:t})})}));Kae.displayName=zy;var qet=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=e,h=v.useRef(null),g=It(t,h),y=ry(o),[E,S]=Us({prop:s,defaultProp:a??null,onChange:l,caller:zy}),[w,T]=v.useState(!1),A=Gr(c),R=Yae(n),_=v.useRef(!1),[D,I]=v.useState(0);return v.useEffect(()=>{const M=h.current;if(M)return M.addEventListener(v_,A),()=>M.removeEventListener(v_,A)},[A]),m.jsx(Vet,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:E,onItemFocus:v.useCallback(M=>S(M),[S]),onItemShiftTab:v.useCallback(()=>T(!0),[]),onFocusableItemAdd:v.useCallback(()=>I(M=>M+1),[]),onFocusableItemRemove:v.useCallback(()=>I(M=>M-1),[]),children:m.jsx(Wae.div,{tabIndex:w||D===0?-1:0,"data-orientation":r,...f,ref:g,style:{outline:"none",...e.style},onMouseDown:Ue(e.onMouseDown,()=>{_.current=!0}),onFocus:Ue(e.onFocus,M=>{const j=!_.current;if(M.target===M.currentTarget&&j&&!w){const L=new CustomEvent(v_,Uet);if(M.currentTarget.dispatchEvent(L),!L.defaultPrevented){const F=R().filter(V=>V.focusable),H=F.find(V=>V.active),Y=F.find(V=>V.id===E),G=[H,Y,...F].filter(Boolean).map(V=>V.ref.current);Qae(G,u)}}_.current=!1}),onBlur:Ue(e.onBlur,()=>T(!1))})})}),Xae="RovingFocusGroupItem",Zae=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=xr(),c=o||l,u=Get(Xae,n),f=u.currentTabStopId===c,h=Yae(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:E}=u;return v.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),m.jsx(uI.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:m.jsx(Wae.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Ue(e.onMouseDown,S=>{r?u.onItemFocus(c):S.preventDefault()}),onFocus:Ue(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ue(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){u.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const w=Ket(S,u.orientation,u.dir);if(w!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let A=h().filter(R=>R.focusable).map(R=>R.ref.current);if(w==="last")A.reverse();else if(w==="prev"||w==="next"){w==="prev"&&A.reverse();const R=A.indexOf(S.currentTarget);A=u.loop?Xet(A,R+1):A.slice(R+1)}setTimeout(()=>Qae(A))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:E!=null}):s})})});Zae.displayName=Xae;var Wet={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yet(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ket(e,t,n){const r=Yet(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Wet[r]}function Qae(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Xet(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Jae=Kae,ele=Zae,dI=["Enter"," "],Zet=["ArrowDown","PageUp","Home"],tle=["ArrowUp","PageDown","End"],Qet=[...Zet,...tle],Jet={ltr:[...dI,"ArrowRight"],rtl:[...dI,"ArrowLeft"]},ett={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Vy="Menu",[I0,ttt,ntt]=oF(Vy),[Lf,nle]=XJe(Vy,[ntt,Ku,fT]),Gy=Ku(),rle=fT(),[ile,Xu]=Lf(Vy),[rtt,qy]=Lf(Vy),ole=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=e,a=Gy(t),[l,c]=v.useState(null),u=v.useRef(!1),f=Gr(o),h=ry(i);return v.useEffect(()=>{const g=()=>{u.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>u.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx($y,{...a,children:m.jsx(ile,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c,children:m.jsx(rtt,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};ole.displayName=Vy;var itt="MenuAnchor",lF=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gy(n);return m.jsx(Uy,{...i,...r,ref:t})});lF.displayName=itt;var cF="MenuPortal",[ott,sle]=Lf(cF,{forceMount:void 0}),ale=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=Xu(cF,t);return m.jsx(ott,{scope:t,forceMount:n,children:m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:r})})})};ale.displayName=cF;var $s="MenuContent",[stt,uF]=Lf($s),lle=v.forwardRef((e,t)=>{const n=sle($s,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Xu($s,e.__scopeMenu),s=qy($s,e.__scopeMenu);return m.jsx(I0.Provider,{scope:e.__scopeMenu,children:m.jsx(Yr,{present:r||o.open,children:m.jsx(I0.Slot,{scope:e.__scopeMenu,children:s.modal?m.jsx(att,{...i,ref:t}):m.jsx(ltt,{...i,ref:t})})})})}),att=v.forwardRef((e,t)=>{const n=Xu($s,e.__scopeMenu),r=v.useRef(null),i=It(t,r);return v.useEffect(()=>{const o=r.current;if(o)return Nw(o)},[]),m.jsx(dF,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ltt=v.forwardRef((e,t)=>{const n=Xu($s,e.__scopeMenu);return m.jsx(dF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ctt=qae("MenuContent.ScrollLock"),dF=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,disableOutsideScroll:y,...E}=e,S=Xu($s,n),w=qy($s,n),T=Gy(n),A=rle(n),R=ttt(n),[_,D]=v.useState(null),I=v.useRef(null),M=It(t,I,S.onContentChange),j=v.useRef(0),L=v.useRef(""),F=v.useRef(0),H=v.useRef(null),Y=v.useRef("right"),$=v.useRef(0),G=y?J0:v.Fragment,V=y?{as:ctt,allowPinchZoom:!0}:void 0,X=J=>{const B=L.current+J,W=R().filter(te=>!te.disabled),K=document.activeElement,P=W.find(te=>te.ref.current===K)?.textValue,ce=W.map(te=>te.textValue),le=Ett(ce,B,P),se=W.find(te=>te.textValue===le)?.ref.current;(function te(oe){L.current=oe,window.clearTimeout(j.current),oe!==""&&(j.current=window.setTimeout(()=>te(""),1e3))})(B),se&&setTimeout(()=>se.focus())};v.useEffect(()=>()=>window.clearTimeout(j.current),[]),kw();const Q=v.useCallback(J=>Y.current===H.current?.side&&wtt(J,H.current?.area),[]);return m.jsx(stt,{scope:n,searchRef:L,onItemEnter:v.useCallback(J=>{Q(J)&&J.preventDefault()},[Q]),onItemLeave:v.useCallback(J=>{Q(J)||(I.current?.focus(),D(null))},[Q]),onTriggerLeave:v.useCallback(J=>{Q(J)&&J.preventDefault()},[Q]),pointerGraceTimerRef:F,onPointerGraceIntentChange:v.useCallback(J=>{H.current=J},[]),children:m.jsx(G,{...V,children:m.jsx(Z0,{asChild:!0,trapped:i,onMountAutoFocus:Ue(o,J=>{J.preventDefault(),I.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,children:m.jsx(Jae,{asChild:!0,...A,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:D,onEntryFocus:Ue(l,J=>{w.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(uT,{role:"menu","aria-orientation":"vertical","data-state":Tle(S.open),"data-radix-menu-content":"",dir:w.dir,...T,...E,ref:M,style:{outline:"none",...E.style},onKeyDown:Ue(E.onKeyDown,J=>{const W=J.target.closest("[data-radix-menu-content]")===J.currentTarget,K=J.ctrlKey||J.altKey||J.metaKey,P=J.key.length===1;W&&(J.key==="Tab"&&J.preventDefault(),!K&&P&&X(J.key));const ce=I.current;if(J.target!==ce||!Qet.includes(J.key))return;J.preventDefault();const se=R().filter(te=>!te.disabled).map(te=>te.ref.current);tle.includes(J.key)&&se.reverse(),vtt(se)}),onBlur:Ue(e.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(j.current),L.current="")}),onPointerMove:Ue(e.onPointerMove,O0(J=>{const B=J.target,W=$.current!==J.clientX;if(J.currentTarget.contains(B)&&W){const K=J.clientX>$.current?"right":"left";Y.current=K,$.current=J.clientX}}))})})})})})})});lle.displayName=$s;var utt="MenuGroup",fF=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Hy.div,{role:"group",...r,ref:t})});fF.displayName=utt;var dtt="MenuLabel",cle=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Hy.div,{...r,ref:t})});cle.displayName=dtt;var rw="MenuItem",mW="menu.itemSelect",pT=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=v.useRef(null),s=qy(rw,e.__scopeMenu),a=uF(rw,e.__scopeMenu),l=It(t,o),c=v.useRef(!1),u=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(mW,{bubbles:!0,cancelable:!0});f.addEventListener(mW,g=>r?.(g),{once:!0}),Det(f,h),h.defaultPrevented?c.current=!1:s.onClose()}};return m.jsx(ule,{...i,ref:l,disabled:n,onClick:Ue(e.onClick,u),onPointerDown:f=>{e.onPointerDown?.(f),c.current=!0},onPointerUp:Ue(e.onPointerUp,f=>{c.current||f.currentTarget?.click()}),onKeyDown:Ue(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||dI.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});pT.displayName=rw;var ule=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=uF(rw,n),a=rle(n),l=v.useRef(null),c=It(t,l),[u,f]=v.useState(!1),[h,g]=v.useState("");return v.useEffect(()=>{const y=l.current;y&&g((y.textContent??"").trim())},[o.children]),m.jsx(I0.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:m.jsx(ele,{asChild:!0,...a,focusable:!r,children:m.jsx(Hy.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:c,onPointerMove:Ue(e.onPointerMove,O0(y=>{r?s.onItemLeave(y):(s.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ue(e.onPointerLeave,O0(y=>s.onItemLeave(y))),onFocus:Ue(e.onFocus,()=>f(!0)),onBlur:Ue(e.onBlur,()=>f(!1))})})})}),ftt="MenuCheckboxItem",dle=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(gle,{scope:e.__scopeMenu,checked:n,children:m.jsx(pT,{role:"menuitemcheckbox","aria-checked":iw(n)?"mixed":n,...i,ref:t,"data-state":mF(n),onSelect:Ue(i.onSelect,()=>r?.(iw(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dle.displayName=ftt;var fle="MenuRadioGroup",[ptt,htt]=Lf(fle,{value:void 0,onValueChange:()=>{}}),ple=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=Gr(r);return m.jsx(ptt,{scope:e.__scopeMenu,value:n,onValueChange:o,children:m.jsx(fF,{...i,ref:t})})});ple.displayName=fle;var hle="MenuRadioItem",mle=v.forwardRef((e,t)=>{const{value:n,...r}=e,i=htt(hle,e.__scopeMenu),o=n===i.value;return m.jsx(gle,{scope:e.__scopeMenu,checked:o,children:m.jsx(pT,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":mF(o),onSelect:Ue(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});mle.displayName=hle;var pF="MenuItemIndicator",[gle,mtt]=Lf(pF,{checked:!1}),ble=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=mtt(pF,n);return m.jsx(Yr,{present:r||iw(o.checked)||o.checked===!0,children:m.jsx(Hy.span,{...i,ref:t,"data-state":mF(o.checked)})})});ble.displayName=pF;var gtt="MenuSeparator",yle=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Hy.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});yle.displayName=gtt;var btt="MenuArrow",vle=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gy(n);return m.jsx(dT,{...i,...r,ref:t})});vle.displayName=btt;var hF="MenuSub",[ytt,xle]=Lf(hF),Ele=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,o=Xu(hF,t),s=Gy(t),[a,l]=v.useState(null),[c,u]=v.useState(null),f=Gr(i);return v.useEffect(()=>(o.open===!1&&f(!1),()=>f(!1)),[o.open,f]),m.jsx($y,{...s,children:m.jsx(ile,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:m.jsx(ytt,{scope:t,contentId:xr(),triggerId:xr(),trigger:a,onTriggerChange:l,children:n})})})};Ele.displayName=hF;var ib="MenuSubTrigger",Sle=v.forwardRef((e,t)=>{const n=Xu(ib,e.__scopeMenu),r=qy(ib,e.__scopeMenu),i=xle(ib,e.__scopeMenu),o=uF(ib,e.__scopeMenu),s=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},u=v.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.jsx(lF,{asChild:!0,...c,children:m.jsx(ule,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Tle(n.open),...e,ref:_n(t,i.onTriggerChange),onClick:f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ue(e.onPointerMove,O0(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Ue(e.onPointerLeave,O0(f=>{u();const h=n.content?.getBoundingClientRect();if(h){const g=n.content?.dataset.side,y=g==="right",E=y?-5:5,S=h[y?"left":"right"],w=h[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+E,y:f.clientY},{x:S,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:S,y:h.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Ue(e.onKeyDown,f=>{const h=o.searchRef.current!=="";e.disabled||h&&f.key===" "||Jet[r.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})});Sle.displayName=ib;var wle="MenuSubContent",Cle=v.forwardRef((e,t)=>{const n=sle($s,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=Xu($s,e.__scopeMenu),s=qy($s,e.__scopeMenu),a=xle(wle,e.__scopeMenu),l=v.useRef(null),c=It(t,l);return m.jsx(I0.Provider,{scope:e.__scopeMenu,children:m.jsx(Yr,{present:r||o.open,children:m.jsx(I0.Slot,{scope:e.__scopeMenu,children:m.jsx(dF,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{s.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Ue(e.onFocusOutside,u=>{u.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Ue(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:Ue(e.onKeyDown,u=>{const f=u.currentTarget.contains(u.target),h=ett[s.dir].includes(u.key);f&&h&&(o.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});Cle.displayName=wle;function Tle(e){return e?"open":"closed"}function iw(e){return e==="indeterminate"}function mF(e){return iw(e)?"indeterminate":e?"checked":"unchecked"}function vtt(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function xtt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ett(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=xtt(e,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Stt(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o],l=t[s],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function wtt(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Stt(n,t)}function O0(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Ctt=ole,Ttt=lF,ktt=ale,Att=lle,Ntt=fF,_tt=cle,Rtt=pT,Dtt=dle,Itt=ple,Ott=mle,Mtt=ble,Ltt=yle,Ptt=vle,Ftt=Ele,Btt=Sle,jtt=Cle,hT="DropdownMenu",[$tt]=OJe(hT,[nle]),zi=nle(),[Utt,kle]=$tt(hT),Ale=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=zi(t),c=v.useRef(null),[u,f]=Us({prop:i,defaultProp:o??!1,onChange:s,caller:hT});return m.jsx(Utt,{scope:t,triggerId:xr(),triggerRef:c,contentId:xr(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:a,children:m.jsx(Ctt,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};Ale.displayName=hT;var Nle="DropdownMenuTrigger",_le=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=kle(Nle,n),s=zi(n);return m.jsx(Ttt,{asChild:!0,...s,children:m.jsx(HJe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:_n(t,o.triggerRef),onPointerDown:Ue(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:Ue(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});_le.displayName=Nle;var Htt="DropdownMenuPortal",Rle=e=>{const{__scopeDropdownMenu:t,...n}=e,r=zi(t);return m.jsx(ktt,{...r,...n})};Rle.displayName=Htt;var Dle="DropdownMenuContent",Ile=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=kle(Dle,n),o=zi(n),s=v.useRef(!1);return m.jsx(Att,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:Ue(e.onCloseAutoFocus,a=>{s.current||i.triggerRef.current?.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Ue(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ile.displayName=Dle;var ztt="DropdownMenuGroup",Vtt=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ntt,{...i,...r,ref:t})});Vtt.displayName=ztt;var Gtt="DropdownMenuLabel",Ole=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(_tt,{...i,...r,ref:t})});Ole.displayName=Gtt;var qtt="DropdownMenuItem",Mle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Rtt,{...i,...r,ref:t})});Mle.displayName=qtt;var Wtt="DropdownMenuCheckboxItem",Lle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Dtt,{...i,...r,ref:t})});Lle.displayName=Wtt;var Ytt="DropdownMenuRadioGroup",Ktt=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Itt,{...i,...r,ref:t})});Ktt.displayName=Ytt;var Xtt="DropdownMenuRadioItem",Ple=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ott,{...i,...r,ref:t})});Ple.displayName=Xtt;var Ztt="DropdownMenuItemIndicator",Fle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Mtt,{...i,...r,ref:t})});Fle.displayName=Ztt;var Qtt="DropdownMenuSeparator",Ble=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ltt,{...i,...r,ref:t})});Ble.displayName=Qtt;var Jtt="DropdownMenuArrow",ent=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Ptt,{...i,...r,ref:t})});ent.displayName=Jtt;var tnt=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:o}=e,s=zi(t),[a,l]=Us({prop:r,defaultProp:o??!1,onChange:i,caller:"DropdownMenuSub"});return m.jsx(Ftt,{...s,open:a,onOpenChange:l,children:n})},nnt="DropdownMenuSubTrigger",jle=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(Btt,{...i,...r,ref:t})});jle.displayName=nnt;var rnt="DropdownMenuSubContent",$le=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=zi(n);return m.jsx(jtt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$le.displayName=rnt;var Ule=Ale,Hle=_le,int=Rle,gF=Ile,bF=Ole,yF=Mle,vF=Lle,zle=Ple,xF=Fle,EF=Ble,ont=tnt,SF=jle,wF=$le;const snt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ant=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),gW=e=>{const t=ant(e);return t.charAt(0).toUpperCase()+t.slice(1)},Vle=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),lnt=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var cnt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const unt=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...a},l)=>v.createElement("svg",{ref:l,...cnt,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Vle("lucide",i),...!o&&!lnt(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>v.createElement(c,u)),...Array.isArray(o)?o:[o]]));const mT=(e,t)=>{const n=v.forwardRef(({className:r,...i},o)=>v.createElement(unt,{ref:o,iconNode:t,className:Vle(`lucide-${snt(gW(e))}`,`lucide-${e}`,r),...i}));return n.displayName=gW(e),n};const dnt=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Gle=mT("check",dnt);const fnt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qle=mT("chevron-down",fnt);const pnt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wle=mT("chevron-right",pnt);const hnt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],mnt=mT("chevron-up",hnt);var gnt="Label",Yle=v.forwardRef((e,t)=>m.jsx(io.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Yle.displayName=gnt;var CF=Yle;function bnt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,ynt(i,...t)]}function ynt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Kle(e){const t=vnt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Ent);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function vnt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=wnt(i),a=Snt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xnt=Symbol("radix.slottable");function Ent(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xnt}function Snt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function wnt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cnt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xle=Cnt.reduce((e,t)=>{const n=Kle(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),gT="Popover",[Zle]=bnt(gT,[Ku]),Wy=Ku(),[Tnt,Zu]=Zle(gT),Qle=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=e,a=Wy(t),l=v.useRef(null),[c,u]=v.useState(!1),[f,h]=Us({prop:r,defaultProp:i??!1,onChange:o,caller:gT});return m.jsx($y,{...a,children:m.jsx(Tnt,{scope:t,contentId:xr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:v.useCallback(()=>h(g=>!g),[h]),hasCustomAnchor:c,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:s,children:n})})};Qle.displayName=gT;var Jle="PopoverAnchor",knt=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Zu(Jle,n),o=Wy(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=i;return v.useEffect(()=>(s(),()=>a()),[s,a]),m.jsx(Uy,{...o,...r,ref:t})});knt.displayName=Jle;var ece="PopoverTrigger",tce=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Zu(ece,n),o=Wy(n),s=It(t,i.triggerRef),a=m.jsx(Xle.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sce(i.open),...r,ref:s,onClick:Ue(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:m.jsx(Uy,{asChild:!0,...o,children:a})});tce.displayName=ece;var TF="PopoverPortal",[Ant,Nnt]=Zle(TF,{forceMount:void 0}),nce=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=Zu(TF,t);return m.jsx(Ant,{scope:t,forceMount:n,children:m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:r})})})};nce.displayName=TF;var Hh="PopoverContent",rce=v.forwardRef((e,t)=>{const n=Nnt(Hh,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=Zu(Hh,e.__scopePopover);return m.jsx(Yr,{present:r||o.open,children:o.modal?m.jsx(Rnt,{...i,ref:t}):m.jsx(Dnt,{...i,ref:t})})});rce.displayName=Hh;var _nt=Kle("PopoverContent.RemoveScroll"),Rnt=v.forwardRef((e,t)=>{const n=Zu(Hh,e.__scopePopover),r=v.useRef(null),i=It(t,r),o=v.useRef(!1);return v.useEffect(()=>{const s=r.current;if(s)return Nw(s)},[]),m.jsx(J0,{as:_nt,allowPinchZoom:!0,children:m.jsx(ice,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ue(e.onCloseAutoFocus,s=>{s.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ue(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ue(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),Dnt=v.forwardRef((e,t)=>{const n=Zu(Hh,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return m.jsx(ice,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;n.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),ice=v.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Zu(Hh,n),g=Wy(n);return kw(),m.jsx(Z0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:m.jsx(uT,{"data-state":sce(h.open),role:"dialog",id:h.contentId,...g,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),oce="PopoverClose",Int=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Zu(oce,n);return m.jsx(Xle.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,()=>i.onOpenChange(!1))})});Int.displayName=oce;var Ont="PopoverArrow",Mnt=v.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Wy(n);return m.jsx(dT,{...i,...r,ref:t})});Mnt.displayName=Ont;function sce(e){return e?"open":"closed"}var ace=Qle,lce=tce,Lnt=nce,kF=rce;function Pnt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Fnt(i,...t)]}function Fnt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function cce(e){const t=Bnt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find($nt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Bnt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Hnt(i),a=Unt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jnt=Symbol("radix.slottable");function $nt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jnt}function Unt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Hnt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var znt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ss=znt.reduce((e,t)=>{const n=cce(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function uce(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Vnt(e){const t=Gnt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Wnt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Gnt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Knt(i),a=Ynt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qnt=Symbol("radix.slottable");function Wnt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qnt}function Ynt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Knt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xnt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Znt=Xnt.reduce((e,t)=>{const n=Vnt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),dce=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Qnt="VisuallyHidden",fce=v.forwardRef((e,t)=>m.jsx(Znt.span,{...e,ref:t,style:{...dce,...e.style}}));fce.displayName=Qnt;var Jnt=fce,ert=[" ","Enter","ArrowUp","ArrowDown"],trt=[" ","Enter"],pf="Select",[bT,yT,nrt]=oF(pf),[Dm]=Pnt(pf,[nrt,Ku]),vT=Ku(),[rrt,Qu]=Dm(pf),[irt,ort]=Dm(pf),pce=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:g,form:y}=e,E=vT(t),[S,w]=v.useState(null),[T,A]=v.useState(null),[R,_]=v.useState(!1),D=ry(c),[I,M]=Us({prop:r,defaultProp:i??!1,onChange:o,caller:pf}),[j,L]=Us({prop:s,defaultProp:a,onChange:l,caller:pf}),F=v.useRef(null),H=S?y||!!S.closest("form"):!0,[Y,$]=v.useState(new Set),G=Array.from(Y).map(V=>V.props.value).join(";");return m.jsx($y,{...E,children:m.jsxs(rrt,{required:g,scope:t,trigger:S,onTriggerChange:w,valueNode:T,onValueNodeChange:A,valueNodeHasChildren:R,onValueNodeHasChildrenChange:_,contentId:xr(),value:j,onValueChange:L,open:I,onOpenChange:M,dir:D,triggerPointerDownPosRef:F,disabled:h,children:[m.jsx(bT.Provider,{scope:t,children:m.jsx(irt,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{$(X=>new Set(X).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{$(X=>{const Q=new Set(X);return Q.delete(V),Q})},[]),children:n})}),H?m.jsxs(Fce,{"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:f,value:j,onChange:V=>L(V.target.value),disabled:h,form:y,children:[j===void 0?m.jsx("option",{value:""}):null,Array.from(Y)]},G):null]})})};pce.displayName=pf;var hce="SelectTrigger",mce=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=vT(n),s=Qu(hce,n),a=s.disabled||r,l=It(t,s.onTriggerChange),c=yT(n),u=v.useRef("touch"),[f,h,g]=jce(E=>{const S=c().filter(A=>!A.disabled),w=S.find(A=>A.value===s.value),T=$ce(S,E,w);T!==void 0&&s.onValueChange(T.value)}),y=E=>{a||(s.onOpenChange(!0),g()),E&&(s.triggerPointerDownPosRef.current={x:Math.round(E.pageX),y:Math.round(E.pageY)})};return m.jsx(Uy,{asChild:!0,...o,children:m.jsx(ss.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Bce(s.value)?"":void 0,...i,ref:l,onClick:Ue(i.onClick,E=>{E.currentTarget.focus(),u.current!=="mouse"&&y(E)}),onPointerDown:Ue(i.onPointerDown,E=>{u.current=E.pointerType;const S=E.target;S.hasPointerCapture(E.pointerId)&&S.releasePointerCapture(E.pointerId),E.button===0&&E.ctrlKey===!1&&E.pointerType==="mouse"&&(y(E),E.preventDefault())}),onKeyDown:Ue(i.onKeyDown,E=>{const S=f.current!=="";!(E.ctrlKey||E.altKey||E.metaKey)&&E.key.length===1&&h(E.key),!(S&&E.key===" ")&&ert.includes(E.key)&&(y(),E.preventDefault())})})})});mce.displayName=hce;var gce="SelectValue",bce=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...a}=e,l=Qu(gce,n),{onValueNodeHasChildrenChange:c}=l,u=o!==void 0,f=It(t,l.onValueNodeChange);return Sr(()=>{c(u)},[c,u]),m.jsx(ss.span,{...a,ref:f,style:{pointerEvents:"none"},children:Bce(l.value)?m.jsx(m.Fragment,{children:s}):o})});bce.displayName=gce;var srt="SelectIcon",yce=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return m.jsx(ss.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});yce.displayName=srt;var art="SelectPortal",vce=e=>m.jsx(nm,{asChild:!0,...e});vce.displayName=art;var hf="SelectContent",xce=v.forwardRef((e,t)=>{const n=Qu(hf,e.__scopeSelect),[r,i]=v.useState();if(Sr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?Wr.createPortal(m.jsx(Ece,{scope:e.__scopeSelect,children:m.jsx(bT.Slot,{scope:e.__scopeSelect,children:m.jsx("div",{children:e.children})})}),o):null}return m.jsx(Sce,{...e,ref:t})});xce.displayName=hf;var na=10,[Ece,Ju]=Dm(hf),lrt="SelectContentImpl",crt=cce("SelectContent.RemoveScroll"),Sce=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:y,hideWhenDetached:E,avoidCollisions:S,...w}=e,T=Qu(hf,n),[A,R]=v.useState(null),[_,D]=v.useState(null),I=It(t,te=>R(te)),[M,j]=v.useState(null),[L,F]=v.useState(null),H=yT(n),[Y,$]=v.useState(!1),G=v.useRef(!1);v.useEffect(()=>{if(A)return Nw(A)},[A]),kw();const V=v.useCallback(te=>{const[oe,...ue]=H().map(ke=>ke.ref.current),[Te]=ue.slice(-1),Ie=document.activeElement;for(const ke of te)if(ke===Ie||(ke?.scrollIntoView({block:"nearest"}),ke===oe&&_&&(_.scrollTop=0),ke===Te&&_&&(_.scrollTop=_.scrollHeight),ke?.focus(),document.activeElement!==Ie))return},[H,_]),X=v.useCallback(()=>V([M,A]),[V,M,A]);v.useEffect(()=>{Y&&X()},[Y,X]);const{onOpenChange:Q,triggerPointerDownPosRef:J}=T;v.useEffect(()=>{if(A){let te={x:0,y:0};const oe=Te=>{te={x:Math.abs(Math.round(Te.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(Te.pageY)-(J.current?.y??0))}},ue=Te=>{te.x<=10&&te.y<=10?Te.preventDefault():A.contains(Te.target)||Q(!1),document.removeEventListener("pointermove",oe),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",ue,{capture:!0})}}},[A,Q,J]),v.useEffect(()=>{const te=()=>Q(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[Q]);const[B,W]=jce(te=>{const oe=H().filter(Ie=>!Ie.disabled),ue=oe.find(Ie=>Ie.ref.current===document.activeElement),Te=$ce(oe,te,ue);Te&&setTimeout(()=>Te.ref.current.focus())}),K=v.useCallback((te,oe,ue)=>{const Te=!G.current&&!ue;(T.value!==void 0&&T.value===oe||Te)&&(j(te),Te&&(G.current=!0))},[T.value]),P=v.useCallback(()=>A?.focus(),[A]),ce=v.useCallback((te,oe,ue)=>{const Te=!G.current&&!ue;(T.value!==void 0&&T.value===oe||Te)&&F(te)},[T.value]),le=r==="popper"?fI:wce,se=le===fI?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:y,hideWhenDetached:E,avoidCollisions:S}:{};return m.jsx(Ece,{scope:n,content:A,viewport:_,onViewportChange:D,itemRefCallback:K,selectedItem:M,onItemLeave:P,itemTextRefCallback:ce,focusSelectedItem:X,selectedItemText:L,position:r,isPositioned:Y,searchRef:B,children:m.jsx(J0,{as:crt,allowPinchZoom:!0,children:m.jsx(Z0,{asChild:!0,trapped:T.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Ue(i,te=>{T.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:m.jsx(le,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:te=>te.preventDefault(),...w,...se,onPlaced:()=>$(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Ue(w.onKeyDown,te=>{const oe=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!oe&&te.key.length===1&&W(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let Te=H().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(te.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Ie=te.target,ke=Te.indexOf(Ie);Te=Te.slice(ke+1)}setTimeout(()=>V(Te)),te.preventDefault()}})})})})})})});Sce.displayName=lrt;var urt="SelectItemAlignedPosition",wce=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=Qu(hf,n),s=Ju(hf,n),[a,l]=v.useState(null),[c,u]=v.useState(null),f=It(t,I=>u(I)),h=yT(n),g=v.useRef(!1),y=v.useRef(!0),{viewport:E,selectedItem:S,selectedItemText:w,focusSelectedItem:T}=s,A=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&E&&S&&w){const I=o.trigger.getBoundingClientRect(),M=c.getBoundingClientRect(),j=o.valueNode.getBoundingClientRect(),L=w.getBoundingClientRect();if(o.dir!=="rtl"){const Ie=L.left-M.left,ke=j.left-Ie,tt=I.left-ke,rt=I.width+tt,ze=Math.max(rt,M.width),dn=window.innerWidth-na,nt=vR(ke,[na,Math.max(na,dn-ze)]);a.style.minWidth=rt+"px",a.style.left=nt+"px"}else{const Ie=M.right-L.right,ke=window.innerWidth-j.right-Ie,tt=window.innerWidth-I.right-ke,rt=I.width+tt,ze=Math.max(rt,M.width),dn=window.innerWidth-na,nt=vR(ke,[na,Math.max(na,dn-ze)]);a.style.minWidth=rt+"px",a.style.right=nt+"px"}const F=h(),H=window.innerHeight-na*2,Y=E.scrollHeight,$=window.getComputedStyle(c),G=parseInt($.borderTopWidth,10),V=parseInt($.paddingTop,10),X=parseInt($.borderBottomWidth,10),Q=parseInt($.paddingBottom,10),J=G+V+Y+Q+X,B=Math.min(S.offsetHeight*5,J),W=window.getComputedStyle(E),K=parseInt(W.paddingTop,10),P=parseInt(W.paddingBottom,10),ce=I.top+I.height/2-na,le=H-ce,se=S.offsetHeight/2,te=S.offsetTop+se,oe=G+V+te,ue=J-oe;if(oe<=ce){const Ie=F.length>0&&S===F[F.length-1].ref.current;a.style.bottom="0px";const ke=c.clientHeight-E.offsetTop-E.offsetHeight,tt=Math.max(le,se+(Ie?P:0)+ke+X),rt=oe+tt;a.style.height=rt+"px"}else{const Ie=F.length>0&&S===F[0].ref.current;a.style.top="0px";const tt=Math.max(ce,G+E.offsetTop+(Ie?K:0)+se)+ue;a.style.height=tt+"px",E.scrollTop=oe-ce+E.offsetTop}a.style.margin=`${na}px 0`,a.style.minHeight=B+"px",a.style.maxHeight=H+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,a,c,E,S,w,o.dir,r]);Sr(()=>A(),[A]);const[R,_]=v.useState();Sr(()=>{c&&_(window.getComputedStyle(c).zIndex)},[c]);const D=v.useCallback(I=>{I&&y.current===!0&&(A(),T?.(),y.current=!1)},[A,T]);return m.jsx(frt,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:D,children:m.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:m.jsx(ss.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});wce.displayName=urt;var drt="SelectPopperPosition",fI=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=na,...o}=e,s=vT(n);return m.jsx(uT,{...s,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});fI.displayName=drt;var[frt,AF]=Dm(hf,{}),pI="SelectViewport",Cce=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=Ju(pI,n),s=AF(pI,n),a=It(t,o.onViewportChange),l=v.useRef(0);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),m.jsx(bT.Slot,{scope:n,children:m.jsx(ss.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Ue(i.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=s;if(h?.current&&f){const g=Math.abs(l.current-u.scrollTop);if(g>0){const y=window.innerHeight-na*2,E=parseFloat(f.style.minHeight),S=parseFloat(f.style.height),w=Math.max(E,S);if(w<y){const T=w+g,A=Math.min(y,T),R=T-A;f.style.height=A+"px",f.style.bottom==="0px"&&(u.scrollTop=R>0?R:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Cce.displayName=pI;var Tce="SelectGroup",[prt,hrt]=Dm(Tce),mrt=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=xr();return m.jsx(prt,{scope:n,id:i,children:m.jsx(ss.div,{role:"group","aria-labelledby":i,...r,ref:t})})});mrt.displayName=Tce;var kce="SelectLabel",Ace=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=hrt(kce,n);return m.jsx(ss.div,{id:i.id,...r,ref:t})});Ace.displayName=kce;var ow="SelectItem",[grt,Nce]=Dm(ow),_ce=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=e,a=Qu(ow,n),l=Ju(ow,n),c=a.value===r,[u,f]=v.useState(o??""),[h,g]=v.useState(!1),y=It(t,T=>l.itemRefCallback?.(T,r,i)),E=xr(),S=v.useRef("touch"),w=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.jsx(grt,{scope:n,value:r,disabled:i,textId:E,isSelected:c,onItemTextChange:v.useCallback(T=>{f(A=>A||(T?.textContent??"").trim())},[]),children:m.jsx(bT.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:m.jsx(ss.div,{role:"option","aria-labelledby":E,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...s,ref:y,onFocus:Ue(s.onFocus,()=>g(!0)),onBlur:Ue(s.onBlur,()=>g(!1)),onClick:Ue(s.onClick,()=>{S.current!=="mouse"&&w()}),onPointerUp:Ue(s.onPointerUp,()=>{S.current==="mouse"&&w()}),onPointerDown:Ue(s.onPointerDown,T=>{S.current=T.pointerType}),onPointerMove:Ue(s.onPointerMove,T=>{S.current=T.pointerType,i?l.onItemLeave?.():S.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(s.onPointerLeave,T=>{T.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:Ue(s.onKeyDown,T=>{l.searchRef?.current!==""&&T.key===" "||(trt.includes(T.key)&&w(),T.key===" "&&T.preventDefault())})})})})});_ce.displayName=ow;var ob="SelectItemText",Rce=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,s=Qu(ob,n),a=Ju(ob,n),l=Nce(ob,n),c=ort(ob,n),[u,f]=v.useState(null),h=It(t,w=>f(w),l.onItemTextChange,w=>a.itemTextRefCallback?.(w,l.value,l.disabled)),g=u?.textContent,y=v.useMemo(()=>m.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:E,onNativeOptionRemove:S}=c;return Sr(()=>(E(y),()=>S(y)),[E,S,y]),m.jsxs(m.Fragment,{children:[m.jsx(ss.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Wr.createPortal(o.children,s.valueNode):null]})});Rce.displayName=ob;var Dce="SelectItemIndicator",Ice=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Nce(Dce,n).isSelected?m.jsx(ss.span,{"aria-hidden":!0,...r,ref:t}):null});Ice.displayName=Dce;var hI="SelectScrollUpButton",Oce=v.forwardRef((e,t)=>{const n=Ju(hI,e.__scopeSelect),r=AF(hI,e.__scopeSelect),[i,o]=v.useState(!1),s=It(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;o(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?m.jsx(Lce,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Oce.displayName=hI;var mI="SelectScrollDownButton",Mce=v.forwardRef((e,t)=>{const n=Ju(mI,e.__scopeSelect),r=AF(mI,e.__scopeSelect),[i,o]=v.useState(!1),s=It(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;o(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?m.jsx(Lce,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Mce.displayName=mI;var Lce=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=Ju("SelectScrollButton",n),s=v.useRef(null),a=yT(n),l=v.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return v.useEffect(()=>()=>l(),[l]),Sr(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),m.jsx(ss.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Ue(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Ue(i.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Ue(i.onPointerLeave,()=>{l()})})}),brt="SelectSeparator",Pce=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.jsx(ss.div,{"aria-hidden":!0,...r,ref:t})});Pce.displayName=brt;var gI="SelectArrow",yrt=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=vT(n),o=Qu(gI,n),s=Ju(gI,n);return o.open&&s.position==="popper"?m.jsx(dT,{...i,...r,ref:t}):null});yrt.displayName=gI;var vrt="SelectBubbleInput",Fce=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=v.useRef(null),o=It(r,i),s=uce(t);return v.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==t&&u){const f=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(f)}},[s,t]),m.jsx(ss.select,{...n,style:{...dce,...n.style},ref:o,defaultValue:t})});Fce.displayName=vrt;function Bce(e){return e===""||e===void 0}function jce(e){const t=Gr(e),n=v.useRef(""),r=v.useRef(0),i=v.useCallback(s=>{const a=n.current+s;t(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function $ce(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=xrt(e,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function xrt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Uce=pce,NF=mce,Hce=bce,zce=yce,Ert=vce,_F=xce,Vce=Cce,Gce=Ace,RF=_ce,qce=Rce,Wce=Ice,DF=Oce,IF=Mce,Yce=Pce;function Srt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,wrt(i,...t)]}function wrt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Crt(e){const t=Trt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Art);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Trt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=_rt(i),a=Nrt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var krt=Symbol("radix.slottable");function Art(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===krt}function Nrt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function _rt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xT=Rrt.reduce((e,t)=>{const n=Crt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ET="Tabs",[Drt]=Srt(ET,[fT]),Kce=fT(),[Irt,OF]=Drt(ET),Xce=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=ry(a),[f,h]=Us({prop:r,onChange:i,defaultProp:o??"",caller:ET});return m.jsx(Irt,{scope:n,baseId:xr(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l,children:m.jsx(xT.div,{dir:u,"data-orientation":s,...c,ref:t})})});Xce.displayName=ET;var Zce="TabsList",Qce=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=OF(Zce,n),s=Kce(n);return m.jsx(Jae,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:m.jsx(xT.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Qce.displayName=Zce;var Jce="TabsTrigger",eue=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=OF(Jce,n),a=Kce(n),l=rue(s.baseId,r),c=iue(s.baseId,r),u=r===s.value;return m.jsx(ele,{asChild:!0,...a,focusable:!i,active:u,children:m.jsx(xT.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:Ue(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Ue(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Ue(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!i&&f&&s.onValueChange(r)})})})});eue.displayName=Jce;var tue="TabsContent",nue=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=OF(tue,n),l=rue(a.baseId,r),c=iue(a.baseId,r),u=r===a.value,f=v.useRef(u);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.jsx(Yr,{present:i||u,children:({present:h})=>m.jsx(xT.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});nue.displayName=tue;function rue(e,t){return`${e}-trigger-${t}`}function iue(e,t){return`${e}-content-${t}`}var Ort=Xce,Mrt=Qce,Lrt=eue,Prt=nue;function Frt(e){const t=Brt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find($rt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Brt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Hrt(i),a=Urt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jrt=Symbol("radix.slottable");function $rt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jrt}function Urt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Hrt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var zrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vrt=zrt.reduce((e,t)=>{const n=Frt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),oue="Toggle",sue=v.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...o}=e,[s,a]=Us({prop:n,onChange:i,defaultProp:r??!1,caller:oue});return m.jsx(Vrt.button,{type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":e.disabled?"":void 0,...o,ref:t,onClick:Ue(e.onClick,()=>{e.disabled||a(!s)})})});sue.displayName=oue;var Grt=sue;function qrt(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Wrt(i,...t)]}function Wrt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Yrt(e){const t=Krt(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(Zrt);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Krt(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Jrt(i),a=Qrt(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var aue=Symbol("radix.slottable");function Xrt(e){const t=({children:n})=>m.jsx(m.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=aue,t}function Zrt(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===aue}function Qrt(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Jrt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var eit=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tit=eit.reduce((e,t)=>{const n=Yrt(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),[ST]=qrt("Tooltip",[Ku]),wT=Ku(),lue="TooltipProvider",nit=700,bI="tooltip.open",[rit,MF]=ST(lue),cue=e=>{const{__scopeTooltip:t,delayDuration:n=nit,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=e,s=v.useRef(!0),a=v.useRef(!1),l=v.useRef(0);return v.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),m.jsx(rit,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(l.current),s.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:v.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:o})};cue.displayName=lue;var M0="Tooltip",[iit,Yy]=ST(M0),uue=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:s,delayDuration:a}=e,l=MF(M0,e.__scopeTooltip),c=wT(t),[u,f]=v.useState(null),h=xr(),g=v.useRef(0),y=s??l.disableHoverableContent,E=a??l.delayDuration,S=v.useRef(!1),[w,T]=Us({prop:r,defaultProp:i??!1,onChange:I=>{I?(l.onOpen(),document.dispatchEvent(new CustomEvent(bI))):l.onClose(),o?.(I)},caller:M0}),A=v.useMemo(()=>w?S.current?"delayed-open":"instant-open":"closed",[w]),R=v.useCallback(()=>{window.clearTimeout(g.current),g.current=0,S.current=!1,T(!0)},[T]),_=v.useCallback(()=>{window.clearTimeout(g.current),g.current=0,T(!1)},[T]),D=v.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{S.current=!0,T(!0),g.current=0},E)},[E,T]);return v.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),m.jsx($y,{...c,children:m.jsx(iit,{scope:t,contentId:h,open:w,stateAttribute:A,trigger:u,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{l.isOpenDelayedRef.current?D():R()},[l.isOpenDelayedRef,D,R]),onTriggerLeave:v.useCallback(()=>{y?_():(window.clearTimeout(g.current),g.current=0)},[_,y]),onOpen:R,onClose:_,disableHoverableContent:y,children:n})})};uue.displayName=M0;var yI="TooltipTrigger",due=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Yy(yI,n),o=MF(yI,n),s=wT(n),a=v.useRef(null),l=It(t,a,i.onTriggerChange),c=v.useRef(!1),u=v.useRef(!1),f=v.useCallback(()=>c.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.jsx(Uy,{asChild:!0,...s,children:m.jsx(tit.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Ue(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ue(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ue(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ue(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ue(e.onBlur,i.onClose),onClick:Ue(e.onClick,i.onClose)})})});due.displayName=yI;var LF="TooltipPortal",[oit,sit]=ST(LF,{forceMount:void 0}),fue=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,o=Yy(LF,t);return m.jsx(oit,{scope:t,forceMount:n,children:m.jsx(Yr,{present:n||o.open,children:m.jsx(nm,{asChild:!0,container:i,children:r})})})};fue.displayName=LF;var zh="TooltipContent",pue=v.forwardRef((e,t)=>{const n=sit(zh,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,s=Yy(zh,e.__scopeTooltip);return m.jsx(Yr,{present:r||s.open,children:s.disableHoverableContent?m.jsx(hue,{side:i,...o,ref:t}):m.jsx(ait,{side:i,...o,ref:t})})}),ait=v.forwardRef((e,t)=>{const n=Yy(zh,e.__scopeTooltip),r=MF(zh,e.__scopeTooltip),i=v.useRef(null),o=It(t,i),[s,a]=v.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{a(null),f(!1)},[f]),g=v.useCallback((y,E)=>{const S=y.currentTarget,w={x:y.clientX,y:y.clientY},T=dit(w,S.getBoundingClientRect()),A=fit(w,T),R=pit(E.getBoundingClientRect()),_=mit([...A,...R]);a(_),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(l&&u){const y=S=>g(S,u),E=S=>g(S,l);return l.addEventListener("pointerleave",y),u.addEventListener("pointerleave",E),()=>{l.removeEventListener("pointerleave",y),u.removeEventListener("pointerleave",E)}}},[l,u,g,h]),v.useEffect(()=>{if(s){const y=E=>{const S=E.target,w={x:E.clientX,y:E.clientY},T=l?.contains(S)||u?.contains(S),A=!hit(w,s);T?h():A&&(h(),c())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,u,s,c,h]),m.jsx(hue,{...e,ref:o})}),[lit,cit]=ST(M0,{isInside:!1}),uit=Xrt("TooltipContent"),hue=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,l=Yy(zh,n),c=wT(n),{onClose:u}=l;return v.useEffect(()=>(document.addEventListener(bI,u),()=>document.removeEventListener(bI,u)),[u]),v.useEffect(()=>{if(l.trigger){const f=h=>{h.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.jsx(tm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:m.jsxs(uT,{"data-state":l.stateAttribute,...c,...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:[m.jsx(uit,{children:r}),m.jsx(lit,{scope:n,isInside:!0,children:m.jsx(Jnt,{id:l.contentId,role:"tooltip",children:i||r})})]})})});pue.displayName=zh;var mue="TooltipArrow",gue=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=wT(n);return cit(mue,n).isInside?null:m.jsx(dT,{...i,...r,ref:t})});gue.displayName=mue;function dit(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function fit(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 pit(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function hit(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o],l=t[s],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function mit(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),git(t)}function git(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}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 bue=cue,yue=uue,vue=due,bit=fue,PF=pue,yit=gue;function et(...e){return IJe(NO(e))}function vit({className:e,...t}){return m.jsx(QQe,{"data-slot":"avatar",className:et("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function xit({className:e,...t}){return m.jsx(JQe,{"data-slot":"avatar-image",className:et("aspect-square size-full",e),...t})}function Eit({className:e,...t}){return m.jsx(eJe,{"data-slot":"avatar-fallback",className:et("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const Sit=cc("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function wit({className:e,variant:t,asChild:n=!1,...r}){return m.jsx(n?Hu:"span",{"data-slot":"badge",className:et(Sit({variant:t}),e),...r})}const Cit=cc("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Tit({className:e,variant:t,size:n,asChild:r=!1,...i}){return m.jsx(r?Hu:"button",{"data-slot":"button",className:et(Cit({variant:t,size:n,className:e})),...i})}function kit({className:e,...t}){return m.jsx("div",{"data-slot":"card",className:et("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ait({className:e,...t}){return m.jsx("div",{"data-slot":"card-content",className:et("px-6",e),...t})}function Nit({...e}){return m.jsx(Ule,{"data-slot":"dropdown-menu",...e})}function _it({...e}){return m.jsx(Hle,{"data-slot":"dropdown-menu-trigger",...e})}function Rit({className:e,sideOffset:t=4,...n}){return m.jsx(gF,{"data-slot":"dropdown-menu-content",sideOffset:t,className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",e),...n})}function Dit({className:e,inset:t,variant:n="default",...r}){return m.jsx(yF,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function Iit({className:e,children:t,checked:n,...r}){return m.jsxs(vF,{"data-slot":"dropdown-menu-checkbox-item",className:et("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),checked:n,...r,children:[m.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:m.jsx(xF,{children:m.jsx(Gle,{className:"size-4"})})}),t]})}function Oit({className:e,inset:t,...n}){return m.jsx(bF,{"data-slot":"dropdown-menu-label","data-inset":t,className:et("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Mit({className:e,...t}){return m.jsx(EF,{"data-slot":"dropdown-menu-separator",className:et("bg-border -mx-1 my-1 h-px",e),...t})}function Lit({...e}){return m.jsx(ont,{"data-slot":"dropdown-menu-sub",...e})}function Pit({className:e,inset:t,children:n,...r}){return m.jsxs(SF,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:et("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",e),...r,children:[n,m.jsx(Wle,{className:"ml-auto size-4"})]})}function Fit({className:e,...t}){return m.jsx(wF,{"data-slot":"dropdown-menu-sub-content",className:et("bg-popover text-popover-foreground 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-[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 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}function Bit({className:e,...t}){return m.jsx(CF,{"data-slot":"label",className:et("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",e),...t})}const jit=TQe;v.createContext({});v.createContext({});function $it({className:e,type:t,...n}){return m.jsx("input",{type:t,"data-slot":"input",className:et("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function Uit({...e}){return m.jsx(ace,{"data-slot":"popover",...e})}function Hit({...e}){return m.jsx(lce,{"data-slot":"popover-trigger",...e})}function zit({className:e,align:t="center",sideOffset:n=4,...r}){return m.jsx(kF,{"data-slot":"popover-content",align:t,sideOffset:n,className:et("bg-popover text-popover-foreground 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-[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 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",e),...r})}function Vit({...e}){return m.jsx(Uce,{"data-slot":"select",...e})}function Git({...e}){return m.jsx(Hce,{"data-slot":"select-value",...e})}function qit({className:e,size:t="default",children:n,...r}){return m.jsxs(NF,{"data-slot":"select-trigger","data-size":t,className:et("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,m.jsx(zce,{asChild:!0,children:m.jsx(qle,{className:"size-4 opacity-50"})})]})}function Wit({className:e,children:t,position:n="popper",...r}){return m.jsxs(_F,{"data-slot":"select-content",className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[m.jsx(Kit,{}),m.jsx(Vce,{className:et("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),m.jsx(Xit,{})]})}function Yit({className:e,children:t,...n}){return m.jsxs(RF,{"data-slot":"select-item",className:et("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[m.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:m.jsx(Wce,{children:m.jsx(Gle,{className:"size-4"})})}),m.jsx(qce,{children:t})]})}function Kit({className:e,...t}){return m.jsx(DF,{"data-slot":"select-scroll-up-button",className:et("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(mnt,{className:"size-4"})})}function Xit({className:e,...t}){return m.jsx(IF,{"data-slot":"select-scroll-down-button",className:et("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(qle,{className:"size-4"})})}function Zit({className:e,...t}){return m.jsx("div",{"data-slot":"skeleton",className:et("bg-accent animate-pulse rounded-md",e),...t})}function Qit({className:e,...t}){return m.jsx(Ort,{"data-slot":"tabs",className:et("flex flex-col gap-2",e),...t})}function Jit({className:e,...t}){return m.jsx(Mrt,{"data-slot":"tabs-list",className:et("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function eot({className:e,...t}){return m.jsx(Lrt,{"data-slot":"tabs-trigger",className:et("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...t})}function tot({className:e,...t}){return m.jsx(Prt,{"data-slot":"tabs-content",className:et("flex-1 outline-none",e),...t})}const not=cc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function rot({className:e,variant:t,size:n,...r}){return m.jsx(Grt,{"data-slot":"toggle",className:et(not({variant:t,size:n,className:e})),...r})}function xue({delayDuration:e=0,...t}){return m.jsx(bue,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function iot({...e}){return m.jsx(xue,{children:m.jsx(yue,{"data-slot":"tooltip",...e})})}function oot({...e}){return m.jsx(vue,{"data-slot":"tooltip-trigger",...e})}function sot({className:e,sideOffset:t=0,children:n,...r}){return m.jsxs(PF,{"data-slot":"tooltip-content",sideOffset:t,className:et("bg-primary 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 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",e),...r,children:[n,m.jsx(yit,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}const aot={Avatar:{Avatar:vit,AvatarFallback:Eit,AvatarImage:xit},Badge:{Badge:wit},Button:{Button:Tit},Card:{Card:kit,CardContent:Ait},DropdownMenu:{DropdownMenu:Nit,DropdownMenuCheckboxItem:Iit,DropdownMenuContent:Rit,DropdownMenuItem:Dit,DropdownMenuLabel:Oit,DropdownMenuSeparator:Mit,DropdownMenuSub:Lit,DropdownMenuSubContent:Fit,DropdownMenuSubTrigger:Pit,DropdownMenuTrigger:_it},Form:{Form:jit},Input:{Input:$it},Label:{Label:Bit},Popover:{Popover:Uit,PopoverContent:zit,PopoverTrigger:Hit},Select:{Select:Vit,SelectContent:Wit,SelectItem:Yit,SelectTrigger:qit,SelectValue:Git},Skeleton:{Skeleton:Zit},Tabs:{Tabs:Qit,TabsContent:tot,TabsList:Jit,TabsTrigger:eot},Toggle:{Toggle:rot},Tooltip:{Tooltip:iot,TooltipContent:sot,TooltipProvider:xue,TooltipTrigger:oot}},Eue=v.createContext(void 0);function Rn(){return v.useContext(Eue)}const lot=e=>{const{children:t,...n}=e;_t(n);const r=Rn(),i=VQe();return m.jsx(r.Form.Form,{...i,children:t})},cot=v.forwardRef((e,t)=>{const{className:n,name:r,label:i,variant:o,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:f,onChange:h,onSubmit:g,autoComplete:y,rightSection:E,...S}=e;_t(S);const w=Rn();return m.jsxs("div",{className:et(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,m.jsxs("div",{className:"flex-1",children:[i&&m.jsx(w.Label.Label,{htmlFor:i,children:i}),m.jsx(w.Input.Input,{className:et(n,"h-auto border-none p-0"),id:i,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:f,onChange:h,onSubmit:g,ref:t})]}),E]})}),uot=e=>v.forwardRef((t,n)=>m.jsx(e,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{const i=new PointerEvent("pointerdown",r.nativeEvent);i.fakeEvent=!0,r.target.dispatchEvent(i)},...t,ref:n})),dot=e=>{const{children:t,onOpenChange:n,position:r,sub:i,...o}=e;_t(o);const s=Rn();return i?m.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:t}):m.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:t})},fot=e=>{const{children:t,sub:n,...r}=e;_t(r);const i=Rn(),o=v.useMemo(()=>uot(i.DropdownMenu.DropdownMenuTrigger),[i.DropdownMenu.DropdownMenuTrigger]);return n?m.jsx(i.DropdownMenu.DropdownMenuSubTrigger,{children:t}):m.jsx(o,{asChild:!0,...r,children:t})},pot=v.forwardRef((e,t)=>{const{className:n,children:r,sub:i,...o}=e;_t(o);const s=Rn();return i?m.jsx(s.DropdownMenu.DropdownMenuSubContent,{className:n,ref:t,children:r}):m.jsx(s.DropdownMenu.DropdownMenuContent,{className:n,ref:t,children:r})}),hot=v.forwardRef((e,t)=>{const{className:n,children:r,icon:i,checked:o,subTrigger:s,onClick:a,...l}=e;_t(l);const c=Rn();return s?m.jsxs(m.Fragment,{children:[i,r]}):o!==void 0?m.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:et(n,"gap-1",o?"":"px-2"),ref:t,checked:o,onClick:a,...l,children:[i,r]}):m.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:t,onClick:a,...l,children:[i,r,s&&m.jsx(Wle,{className:"ml-auto h-4 w-4"})]})}),mot=v.forwardRef((e,t)=>{const{className:n,...r}=e;_t(r);const i=Rn();return m.jsx(i.DropdownMenu.DropdownMenuSeparator,{className:n,ref:t})}),got=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;_t(i);const o=Rn();return m.jsx(o.DropdownMenu.DropdownMenuLabel,{className:n,ref:t,children:r})}),bot=v.forwardRef((e,t)=>{const{className:n,children:r,icon:i,onClick:o,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;_t(u,!1);const f=Rn();return m.jsxs(f.Button.Button,{variant:"ghost",className:et(n,"text-gray-400"),ref:t,"aria-label":c,onClick:o,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[i,r]})}),yot=v.forwardRef((e,t)=>{const{className:n,tabs:r,defaultOpenTab:i,openTab:o,setOpenTab:s,loading:a,...l}=e;_t(l);const c=Rn();return m.jsxs(c.Tabs.Tabs,{className:et(n,"bg-popover max-w-screen rounded-lg p-2"),ref:t,value:o,defaultValue:i,onValueChange:s,children:[m.jsx(c.Tabs.TabsList,{children:r.map(u=>m.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>m.jsx(c.Tabs.TabsContent,{value:u.name,children:m.jsx(c.Card.Card,{children:m.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),vot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et(n,"flex flex-col items-start justify-center gap-2"),ref:t,children:r})}),xot=v.forwardRef((e,t)=>{const{className:n,value:r,placeholder:i,onKeyDown:o,onChange:s,...a}=e;_t(a);const l=Rn();return m.jsx(l.Input.Input,{"data-test":"embed-input",className:et(n,"w-80 max-w-full"),ref:t,value:r,placeholder:i,onKeyDown:o,onChange:s})}),Eot=e=>{const{children:t,open:n,onOpenChange:r,position:i,...o}=e;_t(o);const s=Rn();return m.jsx(s.Popover.Popover,{open:n,onOpenChange:r,children:t})},Sot=v.forwardRef((e,t)=>{const{children:n,...r}=e;_t(r);const i=Rn();return m.jsx(i.Popover.PopoverTrigger,{ref:t,asChild:!0,children:n})}),wot=v.forwardRef((e,t)=>{const{className:n,variant:r,children:i,...o}=e;_t(o);const s=Rn();return m.jsx(s.Popover.PopoverContent,{sideOffset:8,className:et(n,"z-[10000] flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:t,children:i})}),Cot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i,!1),m.jsx("div",{className:n,ref:t,...i,children:r})}),Tot=v.forwardRef((e,t)=>{const{className:n,children:r,icon:i,onClick:o,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=e;_t(u,!1);const f=Rn();return m.jsxs(f.Button.Button,{variant:"ghost",className:et(n,"text-gray-400"),ref:t,"aria-label":c,onClick:o,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[i,r]})}),kot=v.forwardRef((e,t)=>{const{className:n,children:r,id:i,columns:o,...s}=e;return _t(s),m.jsx("div",{className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${o}, 1fr)`},ref:t,id:i,role:"grid",children:r})}),Aot=v.forwardRef((e,t)=>{const{className:n,children:r,columns:i,...o}=e;return _t(o),m.jsx("div",{className:n,style:{gridColumn:`1 / ${i+1}`},ref:t,children:r})}),Not=v.forwardRef((e,t)=>{const{className:n,children:r,id:i,...o}=e;return _t(o),m.jsx("div",{id:i,role:"listbox",className:et("bg-popover text-popover-foreground 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-[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 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:t,children:r})}),_ot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:t,children:m.jsx("div",{children:r})})}),Rot=v.forwardRef((e,t)=>{const n=Rn(),{className:r,item:i,isSelected:o,onClick:s,id:a,...l}=e;_t(l);const c=v.useRef(null);return v.useEffect(()=>{if(!c.current||!o)return;const u=fae(c.current,c.current.closest(".bn-suggestion-menu, #ai-suggestion-menu"));u==="top"?c.current.scrollIntoView(!0):u==="bottom"&&c.current.scrollIntoView(!1)},[o]),m.jsxs("div",{className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",e.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:pae([t,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":o||void 0,children:[i.icon&&m.jsx("div",{className:et("p-3",e.item.size==="small"?"p-0":"",r),"data-position":"left",children:i.icon}),m.jsxs("div",{className:"flex-1",children:[m.jsx("div",{className:et("text-base",e.item.size==="small"?"text-sm":"",r),children:i.title}),m.jsx("div",{className:et("text-xs",e.item.size==="small"?"hidden":"",r),children:i.subtext})]}),i.badge&&m.jsx("div",{"data-position":"right",className:"text-xs",children:m.jsx(n.Badge.Badge,{variant:"secondary",children:i.badge})})]})}),Dot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:t,children:r})}),Iot=v.forwardRef((e,t)=>{const{className:n,...r}=e;return _t(r),m.jsx("div",{className:et(n,"animate-spin"),ref:t,children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:m.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),Oot=v.forwardRef((e,t)=>{const{className:n,children:r,onMouseDown:i,onClick:o,...s}=e;_t(s,!1);const a=Rn();return m.jsx(a.Button.Button,{variant:"ghost",className:et(n,"h-full w-full p-0 text-gray-400",n!=null&&n.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n!=null&&n.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:t,onClick:o,onMouseDown:i,...s,children:r})}),Mot=v.forwardRef((e,t)=>{const{className:n,children:r,draggable:i,onDragStart:o,onDragEnd:s,style:a,label:l,...c}=e;_t(c,!1);const u=Rn();return m.jsx(u.Button.Button,{variant:"ghost",className:et(n,"h-fit w-fit p-0 text-gray-400"),ref:t,"aria-label":l,draggable:i,onDragStart:o,onDragEnd:s,style:a,...c,children:r})}),x_=v.forwardRef((e,t)=>{const{className:n,children:r,onMouseEnter:i,onMouseLeave:o,variant:s,...a}=e;_t(a);const l=Rn();return m.jsx(l.Tooltip.TooltipProvider,{delayDuration:0,children:m.jsx("div",{className:et(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:t,onMouseEnter:i,onMouseLeave:o,children:r})})}),E_=v.forwardRef((e,t)=>{const{className:n,children:r,mainTooltip:i,secondaryTooltip:o,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:f,...h}=e;_t(h,!1);const g=Rn(),y=a===void 0?m.jsxs(g.Button.Button,{className:et(n,f==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:f==="compact"?"sm":"default",disabled:l,onClick:c,ref:t,"aria-label":u,...h,children:[s,r]}):m.jsxs(g.Toggle.Toggle,{className:et(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",f==="compact"?"h-6 min-w-6 p-0":""),size:f==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:t,...h,children:[s,r]});return m.jsxs(g.Tooltip.Tooltip,{children:[m.jsx(g.Tooltip.TooltipTrigger,{asChild:!0,children:y}),m.jsxs(g.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[m.jsx("span",{children:i}),o&&m.jsx("span",{children:o})]})]})}),S_=v.forwardRef((e,t)=>{const{className:n,items:r,isDisabled:i,...o}=e;_t(o);const s=Rn(),a=c=>m.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?m.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>{var u,f;return(f=(u=r.find(h=>h.text===c)).onClick)==null?void 0:f.call(u)},disabled:i,children:[m.jsx(s.Select.SelectTrigger,{className:"border-none",children:m.jsx(s.Select.SelectValue,{})}),m.jsx(s.Select.SelectContent,{className:n,ref:t,children:r.map(c=>m.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:m.jsx(a,{...c})},c.text))})]}):null}),Lot=v.forwardRef((e,t)=>{const{className:n,children:r,selected:i,headerText:o,onFocus:s,onBlur:a,tabIndex:l,...c}=e;_t(c);const u=Rn();return m.jsxs(u.Card.Card,{className:et(n,"w-[300px]",i?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:t,children:[o&&m.jsx("div",{className:"px-4 pt-4 text-sm italic",children:o}),r]})}),Pot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;return _t(i),m.jsx("div",{className:et(n,"p-4",n!=null&&n.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:t,children:r})}),Fot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;_t(i,!1);const o=Rn();return m.jsx(o.Button.Button,{className:et(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:t,children:r})}),Bot=v.forwardRef((e,t)=>{const{authorInfo:n,timeString:r,edited:i,...o}=e,s=Rt();_t(o,!1);const a=Rn();return n==="loading"?m.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[m.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),m.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):m.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[m.jsxs(a.Avatar.Avatar,{children:[m.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),m.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),m.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[m.jsx("span",{className:"text-sm font-bold",children:n.username}),m.jsxs("span",{className:"text-xs",children:[r," ",i&&`(${s.comments.edited})`]})]})]})}),jot=v.forwardRef((e,t)=>{const{className:n,showActions:r,authorInfo:i,timeString:o,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=e;_t(u);const[f,h]=v.useState(!1),{focused:g,ref:y}=xQe(),E=s&&(r===!0||r===void 0||r==="hover"&&f||g);return m.jsxs("div",{ref:t,className:et(n,"relative flex flex-col gap-2"),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[E?m.jsx("div",{className:"absolute right-0 top-0 z-10",ref:y,children:s}):null,m.jsx(Bot,{...e}),c]})}),$ot=v.forwardRef((e,t)=>{const{className:n,onFocus:r,onBlur:i,autoFocus:o,editor:s,editable:a,...l}=e;_t(l);const c=hl();return m.jsx(FF,{autoFocus:o,className:et(n,""),theme:c?.colorSchemePreference,editor:e.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:t,onFocus:r,onBlur:i,children:m.jsx(iae,{formattingToolbar:Uot})})}),Uot=()=>{const e=nae([]).filter(t=>t.key!=="nestBlockButton"&&t.key!=="unnestBlockButton");return m.jsx(rae,{blockTypeSelectItems:[],children:e})},Hot=v.forwardRef((e,t)=>{const{className:n,text:r,icon:i,isSelected:o,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=e;_t(u,!1);const f=Rn(),h=m.jsxs(f.Button.Button,{variant:o?"secondary":"outline",className:et(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:t,children:[m.jsx("span",{children:i}),m.jsx("span",{children:r})]});return s?m.jsxs(f.Tooltip.Tooltip,{children:[m.jsx(f.Tooltip.TooltipTrigger,{asChild:!0,children:h}),m.jsxs(f.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[m.jsx("span",{children:s}),a&&m.jsx("span",{children:a})]})]}):h}),zot=v.forwardRef((e,t)=>{const{className:n,children:r,...i}=e;_t(i);const o=Rn();return m.jsx(o.Tooltip.TooltipProvider,{delayDuration:0,children:m.jsx("div",{className:et(n,"flex w-full flex-row flex-wrap gap-1"),ref:t,children:r})})}),Vot=v.forwardRef((e,t)=>{const{className:n,children:r,onClick:i,label:o,...s}=e;_t(s);const a=Rn();return m.jsx(a.Button.Button,{type:"submit",className:n,"aria-label":o,ref:t,onClick:i,children:r})}),Got=v.forwardRef((e,t)=>{const{className:n,accept:r,value:i,placeholder:o,onChange:s,...a}=e;_t(a);const l=Rn();return m.jsx(l.Input.Input,{type:"file",className:n,ref:t,accept:r,value:i?i.name:void 0,onChange:async c=>s?.(c.target.files[0]),placeholder:o})}),qot=v.forwardRef((e,t)=>{const{className:n,isSelected:r,onClick:i,item:o,id:s,...a}=e;_t(a);const l=v.useRef(null);return v.useEffect(()=>{if(!l.current||!r)return;const c=fae(l.current,l.current.closest(".bn-grid-suggestion-menu"));c==="top"?l.current.scrollIntoView(!0):c==="bottom"&&l.current.scrollIntoView(!1)},[r]),m.jsx("div",{className:et("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:pae([t,l]),id:s,role:"option",onClick:i,"aria-selected":r||void 0,children:o.icon})}),Wot=v.forwardRef((e,t)=>{const{className:n,children:r,columns:i,...o}=e;return _t(o),m.jsx("div",{className:n,style:{gridColumn:`1 / ${i+1}`},ref:t,children:r})}),Yot={FormattingToolbar:{Root:x_,Button:E_,Select:S_},FilePanel:{Root:yot,Button:Vot,FileInput:Got,TabPanel:vot,TextInput:xot},LinkToolbar:{Root:x_,Button:E_,Select:S_},SideMenu:{Root:Cot,Button:Tot},SuggestionMenu:{Root:Not,Item:Rot,EmptyItem:_ot,Label:Dot,Loader:Iot},GridSuggestionMenu:{Root:kot,Item:qot,EmptyItem:Aot,Loader:Wot},TableHandle:{Root:Mot,ExtendButton:Oot},Comments:{Comment:jot,Editor:$ot,Card:Lot,CardSection:Pot,ExpandSectionsPrompt:Fot},Generic:{Badge:{Root:Hot,Group:zot},Toolbar:{Root:x_,Button:E_,Select:S_},Form:{Root:lot,TextInput:cot},Menu:{Root:dot,Trigger:fot,Dropdown:pot,Divider:mot,Label:got,Item:hot,Button:bot},Popover:{Root:Eot,Trigger:Sot,Content:wot}}},FF=e=>{const{className:t,shadCNComponents:n,...r}=e,i=v.useMemo(()=>({...aot,...n}),[n]);return m.jsx(Eue.Provider,{value:i,children:m.jsx(jse.Provider,{value:Yot,children:m.jsx(rQe,{className:Fr("bn-shadcn",t||""),...r})})})},L0=ace,P0=lce,Vh=v.forwardRef(({className:e,align:t="center",sideOffset:n=4,container:r,...i},o)=>m.jsx(Lnt,{container:r,children:m.jsx(kF,{ref:o,align:t,sideOffset:n,className:Se("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[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 origin-[--radix-popover-content-transform-origin]",e),...i})}));Vh.displayName=kF.displayName;var bW=1,Kot=.9,Xot=.8,Zot=.17,w_=.1,C_=.999,Qot=.9999,Jot=.99,est=/[\\\/_+.#"@\[\(\{&]/,tst=/[\\\/_+.#"@\[\(\{&]/g,nst=/[\s-]/,Sue=/[\s-]/g;function vI(e,t,n,r,i,o,s){if(o===t.length)return i===e.length?bW:Jot;var a=`${i},${o}`;if(s[a]!==void 0)return s[a];for(var l=r.charAt(o),c=n.indexOf(l,i),u=0,f,h,g,y;c>=0;)f=vI(e,t,n,r,c+1,o+1,s),f>u&&(c===i?f*=bW:est.test(e.charAt(c-1))?(f*=Xot,g=e.slice(i,c-1).match(tst),g&&i>0&&(f*=Math.pow(C_,g.length))):nst.test(e.charAt(c-1))?(f*=Kot,y=e.slice(i,c-1).match(Sue),y&&i>0&&(f*=Math.pow(C_,y.length))):(f*=Zot,i>0&&(f*=Math.pow(C_,c-i))),e.charAt(c)!==t.charAt(o)&&(f*=Qot)),(f<w_&&n.charAt(c-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(c-1)!==r.charAt(o))&&(h=vI(e,t,n,r,c+1,o+2,s),h*w_>f&&(f=h*w_)),f>u&&(u=f),c=n.indexOf(l,c+1);return s[a]=u,u}function yW(e){return e.toLowerCase().replace(Sue," ")}function rst(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,vI(e,t,yW(e),yW(t),0,0,{})}var Yg='[cmdk-group=""]',T_='[cmdk-group-items=""]',ist='[cmdk-group-heading=""]',wue='[cmdk-item=""]',vW=`${wue}:not([aria-disabled="true"])`,xI="cmdk-item-select",$p="data-value",ost=(e,t,n)=>rst(e,t,n),Cue=v.createContext(void 0),Ky=()=>v.useContext(Cue),Tue=v.createContext(void 0),BF=()=>v.useContext(Tue),kue=v.createContext(void 0),Aue=v.forwardRef((e,t)=>{let n=Up(()=>{var K,P;return{search:"",value:(P=(K=e.value)!=null?K:e.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Up(()=>new Set),i=Up(()=>new Map),o=Up(()=>new Map),s=Up(()=>new Set),a=Nue(e),{label:l,children:c,value:u,onValueChange:f,filter:h,shouldFilter:g,loop:y,disablePointerSelection:E=!1,vimBindings:S=!0,...w}=e,T=xr(),A=xr(),R=xr(),_=v.useRef(null),D=gst();mf(()=>{if(u!==void 0){let K=u.trim();n.current.value=K,I.emit()}},[u]),mf(()=>{D(6,Y)},[]);let I=v.useMemo(()=>({subscribe:K=>(s.current.add(K),()=>s.current.delete(K)),snapshot:()=>n.current,setState:(K,P,ce)=>{var le,se,te,oe;if(!Object.is(n.current[K],P)){if(n.current[K]=P,K==="search")H(),L(),D(1,F);else if(K==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ue=document.getElementById(R);ue?ue.focus():(le=document.getElementById(T))==null||le.focus()}if(D(7,()=>{var ue;n.current.selectedItemId=(ue=$())==null?void 0:ue.id,I.emit()}),ce||D(5,Y),((se=a.current)==null?void 0:se.value)!==void 0){let ue=P??"";(oe=(te=a.current).onValueChange)==null||oe.call(te,ue);return}}I.emit()}},emit:()=>{s.current.forEach(K=>K())}}),[]),M=v.useMemo(()=>({value:(K,P,ce)=>{var le;P!==((le=o.current.get(K))==null?void 0:le.value)&&(o.current.set(K,{value:P,keywords:ce}),n.current.filtered.items.set(K,j(P,ce)),D(2,()=>{L(),I.emit()}))},item:(K,P)=>(r.current.add(K),P&&(i.current.has(P)?i.current.get(P).add(K):i.current.set(P,new Set([K]))),D(3,()=>{H(),L(),n.current.value||F(),I.emit()}),()=>{o.current.delete(K),r.current.delete(K),n.current.filtered.items.delete(K);let ce=$();D(4,()=>{H(),ce?.getAttribute("id")===K&&F(),I.emit()})}),group:K=>(i.current.has(K)||i.current.set(K,new Set),()=>{o.current.delete(K),i.current.delete(K)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:T,inputId:R,labelId:A,listInnerRef:_}),[]);function j(K,P){var ce,le;let se=(le=(ce=a.current)==null?void 0:ce.filter)!=null?le:ost;return K?se(K,n.current.search,P):0}function L(){if(!n.current.search||a.current.shouldFilter===!1)return;let K=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(le=>{let se=i.current.get(le),te=0;se.forEach(oe=>{let ue=K.get(oe);te=Math.max(ue,te)}),P.push([le,te])});let ce=_.current;G().sort((le,se)=>{var te,oe;let ue=le.getAttribute("id"),Te=se.getAttribute("id");return((te=K.get(Te))!=null?te:0)-((oe=K.get(ue))!=null?oe:0)}).forEach(le=>{let se=le.closest(T_);se?se.appendChild(le.parentElement===se?le:le.closest(`${T_} > *`)):ce.appendChild(le.parentElement===ce?le:le.closest(`${T_} > *`))}),P.sort((le,se)=>se[1]-le[1]).forEach(le=>{var se;let te=(se=_.current)==null?void 0:se.querySelector(`${Yg}[${$p}="${encodeURIComponent(le[0])}"]`);te?.parentElement.appendChild(te)})}function F(){let K=G().find(ce=>ce.getAttribute("aria-disabled")!=="true"),P=K?.getAttribute($p);I.setState("value",P||void 0)}function H(){var K,P,ce,le;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let se=0;for(let te of r.current){let oe=(P=(K=o.current.get(te))==null?void 0:K.value)!=null?P:"",ue=(le=(ce=o.current.get(te))==null?void 0:ce.keywords)!=null?le:[],Te=j(oe,ue);n.current.filtered.items.set(te,Te),Te>0&&se++}for(let[te,oe]of i.current)for(let ue of oe)if(n.current.filtered.items.get(ue)>0){n.current.filtered.groups.add(te);break}n.current.filtered.count=se}function Y(){var K,P,ce;let le=$();le&&(((K=le.parentElement)==null?void 0:K.firstChild)===le&&((ce=(P=le.closest(Yg))==null?void 0:P.querySelector(ist))==null||ce.scrollIntoView({block:"nearest"})),le.scrollIntoView({block:"nearest"}))}function $(){var K;return(K=_.current)==null?void 0:K.querySelector(`${wue}[aria-selected="true"]`)}function G(){var K;return Array.from(((K=_.current)==null?void 0:K.querySelectorAll(vW))||[])}function V(K){let P=G()[K];P&&I.setState("value",P.getAttribute($p))}function X(K){var P;let ce=$(),le=G(),se=le.findIndex(oe=>oe===ce),te=le[se+K];(P=a.current)!=null&&P.loop&&(te=se+K<0?le[le.length-1]:se+K===le.length?le[0]:le[se+K]),te&&I.setState("value",te.getAttribute($p))}function Q(K){let P=$(),ce=P?.closest(Yg),le;for(;ce&&!le;)ce=K>0?hst(ce,Yg):mst(ce,Yg),le=ce?.querySelector(vW);le?I.setState("value",le.getAttribute($p)):X(K)}let J=()=>V(G().length-1),B=K=>{K.preventDefault(),K.metaKey?J():K.altKey?Q(1):X(1)},W=K=>{K.preventDefault(),K.metaKey?V(0):K.altKey?Q(-1):X(-1)};return v.createElement(io.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:K=>{var P;(P=w.onKeyDown)==null||P.call(w,K);let ce=K.nativeEvent.isComposing||K.keyCode===229;if(!(K.defaultPrevented||ce))switch(K.key){case"n":case"j":{S&&K.ctrlKey&&B(K);break}case"ArrowDown":{B(K);break}case"p":case"k":{S&&K.ctrlKey&&W(K);break}case"ArrowUp":{W(K);break}case"Home":{K.preventDefault(),V(0);break}case"End":{K.preventDefault(),J();break}case"Enter":{K.preventDefault();let le=$();if(le){let se=new Event(xI);le.dispatchEvent(se)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:yst},l),CT(e,K=>v.createElement(Tue.Provider,{value:I},v.createElement(Cue.Provider,{value:M},K))))}),sst=v.forwardRef((e,t)=>{var n,r;let i=xr(),o=v.useRef(null),s=v.useContext(kue),a=Ky(),l=Nue(e),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;mf(()=>{if(!c)return a.item(i,s?.id)},[c]);let u=_ue(i,o,[e.value,e.children,o],e.keywords),f=BF(),h=Fu(D=>D.value&&D.value===u.current),g=Fu(D=>c||a.filter()===!1?!0:D.search?D.filtered.items.get(i)>0:!0);v.useEffect(()=>{let D=o.current;if(!(!D||e.disabled))return D.addEventListener(xI,y),()=>D.removeEventListener(xI,y)},[g,e.onSelect,e.disabled]);function y(){var D,I;E(),(I=(D=l.current).onSelect)==null||I.call(D,u.current)}function E(){f.setState("value",u.current,!0)}if(!g)return null;let{disabled:S,value:w,onSelect:T,forceMount:A,keywords:R,..._}=e;return v.createElement(io.div,{ref:_n(o,t),..._,id:i,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!h,"data-disabled":!!S,"data-selected":!!h,onPointerMove:S||a.getDisablePointerSelection()?void 0:E,onClick:S?void 0:y},e.children)}),ast=v.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=xr(),a=v.useRef(null),l=v.useRef(null),c=xr(),u=Ky(),f=Fu(g=>i||u.filter()===!1?!0:g.search?g.filtered.groups.has(s):!0);mf(()=>u.group(s),[]),_ue(s,a,[e.value,e.heading,l]);let h=v.useMemo(()=>({id:s,forceMount:i}),[i]);return v.createElement(io.div,{ref:_n(a,t),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&v.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),CT(e,g=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},v.createElement(kue.Provider,{value:h},g))))}),lst=v.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=v.useRef(null),o=Fu(s=>!s.search);return!n&&!o?null:v.createElement(io.div,{ref:_n(i,t),...r,"cmdk-separator":"",role:"separator"})}),cst=v.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,o=BF(),s=Fu(c=>c.search),a=Fu(c=>c.selectedItemId),l=Ky();return v.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),v.createElement(io.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:s,onChange:c=>{i||o.setState("search",c.target.value),n?.(c.target.value)}})}),ust=v.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,o=v.useRef(null),s=v.useRef(null),a=Fu(c=>c.selectedItemId),l=Ky();return v.useEffect(()=>{if(s.current&&o.current){let c=s.current,u=o.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let g=c.offsetHeight;u.style.setProperty("--cmdk-list-height",g.toFixed(1)+"px")})});return h.observe(c),()=>{cancelAnimationFrame(f),h.unobserve(c)}}},[]),v.createElement(io.div,{ref:_n(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},CT(e,c=>v.createElement("div",{ref:_n(s,l.listInnerRef),"cmdk-list-sizer":""},c)))}),dst=v.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:o,container:s,...a}=e;return v.createElement(kO,{open:n,onOpenChange:r},v.createElement(AO,{container:s},v.createElement(ey,{"cmdk-overlay":"",className:i}),v.createElement(ty,{"aria-label":e.label,"cmdk-dialog":"",className:o},v.createElement(Aue,{ref:t,...a}))))}),fst=v.forwardRef((e,t)=>Fu(n=>n.filtered.count===0)?v.createElement(io.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),pst=v.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...o}=e;return v.createElement(io.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},CT(e,s=>v.createElement("div",{"aria-hidden":!0},s)))}),Ro=Object.assign(Aue,{List:ust,Item:sst,Input:cst,Group:ast,Separator:lst,Dialog:dst,Empty:fst,Loading:pst});function hst(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function mst(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Nue(e){let t=v.useRef(e);return mf(()=>{t.current=e}),t}var mf=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Up(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Fu(e){let t=BF(),n=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,n,n)}function _ue(e,t,n,r=[]){let i=v.useRef(),o=Ky();return mf(()=>{var s;let a=(()=>{var c;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());o.value(e,a,l),(s=t.current)==null||s.setAttribute($p,a),i.current=a}),i}var gst=()=>{let[e,t]=v.useState(),n=Up(()=>new Map);return mf(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,i)=>{n.current.set(r,i),t({})}};function bst(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function CT({asChild:e,children:t},n){return e&&v.isValidElement(t)?v.cloneElement(bst(t),{ref:t.ref},n(t.props.children)):n(t)}var yst={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Gh=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro,{ref:n,className:Se("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Gh.displayName=Ro.displayName;const qh=v.forwardRef(({className:e,...t},n)=>m.jsxs("div",{className:"flex items-center border-b border-border px-3","cmdk-input-wrapper":"",children:[m.jsx(Ew,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),m.jsx(Ro.Input,{ref:n,className:Se("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));qh.displayName=Ro.Input.displayName;const Wh=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.List,{ref:n,className:Se("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Wh.displayName=Ro.List.displayName;const Yh=v.forwardRef((e,t)=>m.jsx(Ro.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Yh.displayName=Ro.Empty.displayName;const Ja=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.Group,{ref:n,className:Se("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Ja.displayName=Ro.Group.displayName;const sw=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.Separator,{ref:n,className:Se("-mx-1 h-px bg-border",e),...t}));sw.displayName=Ro.Separator.displayName;const Ko=v.forwardRef(({className:e,...t},n)=>m.jsx(Ro.Item,{ref:n,className:Se("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm text-popover-foreground outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Ko.displayName=Ro.Item.displayName;const vst={todo:"bg-muted-foreground/50","in-progress":"bg-yellow-500","in-review":"bg-purple-500",blocked:"bg-destructive",done:"bg-green-500"};function Rue({children:e,isEditable:t,onPreview:n,onReplace:r,onDelete:i,previewContent:o,type:s}){const[a,l]=v.useState(!1),[c,u]=v.useState(!1),[f,h]=v.useState(!1),[g,y]=v.useState(""),[E,S]=v.useState([]),[w,T]=v.useState([]),[A,R]=v.useState(!1),_=v.useRef(null),D=v.useRef(null),I=v.useRef(!1),M=v.useCallback(async()=>{R(!0);try{if(s==="task"){const B=await VY();S(B.slice(0,10))}else{const B=await jI();T(B.slice(0,10))}}catch(B){console.error("Failed to load items:",B)}finally{R(!1)}},[s]),j=v.useCallback(async B=>{if(!B.trim()){M();return}R(!0);try{const W=await WY(B);s==="task"?S(W.tasks.slice(0,10)):T(W.docs.slice(0,10))}catch(W){console.error("Failed to search:",W)}finally{R(!1)}},[s,M]);v.useEffect(()=>{if(f)return D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{j(g)},300),()=>{D.current&&clearTimeout(D.current)}},[g,f,j]),v.useEffect(()=>{f&&M()},[f,M]);const L=()=>{t&&(I.current=!0,_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{I.current&&l(!0)},300))},F=()=>{I.current=!1,_.current&&clearTimeout(_.current),!f&&(_.current=setTimeout(()=>{I.current||(l(!1),u(!1))},200))},H=()=>{I.current=!0,_.current&&clearTimeout(_.current)},Y=()=>{f||F()};v.useEffect(()=>()=>{_.current&&clearTimeout(_.current),D.current&&clearTimeout(D.current)},[]);const $=B=>{B.preventDefault(),B.stopPropagation(),u(!c),h(!1)},G=B=>{B.preventDefault(),B.stopPropagation(),h(!f),u(!1),y("")},V=(B,W)=>{l(!1),h(!1),y(""),r(B,W)},X=B=>{B.preventDefault(),B.stopPropagation(),l(!1),i()},Q=B=>{B.preventDefault(),B.stopPropagation(),l(!1),n()},J=()=>{l(!1),u(!1),h(!1),y("")};return t?m.jsxs(L0,{open:a,onOpenChange:B=>{B?l(!0):J()},modal:!1,children:[m.jsx(P0,{asChild:!0,onClick:B=>B.preventDefault(),children:m.jsx("span",{onMouseEnter:L,onMouseLeave:F,children:e})}),m.jsx(Vh,{className:"w-auto p-0",side:"top",align:"center",sideOffset:4,onMouseEnter:H,onMouseLeave:Y,onOpenAutoFocus:B=>B.preventDefault(),children:m.jsxs("div",{className:"flex flex-col",children:[m.jsxs("div",{className:"flex items-center gap-0.5 p-1 border-b border-border",children:[m.jsxs($e,{variant:c?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5",onClick:$,children:[m.jsx(q_,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Preview"})]}),m.jsxs($e,{variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5",onClick:G,children:[m.jsx(UI,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Replace"})]}),m.jsxs($e,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:X,children:[m.jsx(Wd,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Delete"})]}),m.jsx("div",{className:"w-px h-4 bg-border mx-1"}),m.jsxs($e,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5",onClick:Q,children:[m.jsx(eK,{className:"w-3.5 h-3.5"}),m.jsx("span",{className:"hidden sm:inline",children:"Open"})]})]}),c&&o&&m.jsxs("div",{className:"p-2 border-b border-border",children:[m.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:"Preview"}),m.jsx("div",{className:"max-h-28 overflow-auto text-sm",children:o})]}),f&&m.jsxs(Gh,{className:"w-full min-w-56",shouldFilter:!1,children:[m.jsxs("div",{className:"relative",children:[m.jsx(qh,{placeholder:`Search ${s==="task"?"tasks":"docs"}...`,value:g,onValueChange:y,onMouseDown:B=>B.stopPropagation(),className:"h-8 text-sm"}),A&&m.jsx(nK,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 animate-spin text-muted-foreground"})]}),m.jsxs(Wh,{className:"max-h-48",children:[m.jsx(Yh,{className:"py-3 text-xs",children:A?"Searching...":`No ${s==="task"?"tasks":"docs"} found`}),s==="task"?m.jsx(Ja,{heading:"Tasks",className:"[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:py-1",children:E.map(B=>m.jsxs(Ko,{value:`task-${B.id}`,onSelect:()=>V("task",`task-${B.id}`),onMouseDown:W=>W.stopPropagation(),className:"cursor-pointer py-1.5 text-sm gap-2",children:[m.jsx(gf,{className:"w-3.5 h-3.5 shrink-0 text-green-600 dark:text-green-400"}),m.jsxs("span",{className:"text-muted-foreground text-xs shrink-0",children:["#",B.id]}),m.jsx("span",{className:"truncate flex-1",children:B.title}),m.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${vst[B.status]||"bg-muted-foreground/50"}`})]},B.id))}):m.jsx(Ja,{heading:"Docs",className:"[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:py-1",children:w.map(B=>m.jsxs(Ko,{value:B.path,onSelect:()=>V("doc",B.path.replace(/\.md$/,"")),onMouseDown:W=>W.stopPropagation(),className:"cursor-pointer py-1.5 text-sm gap-2",children:[m.jsx(Xo,{className:"w-3.5 h-3.5 shrink-0 text-blue-600 dark:text-blue-400"}),m.jsx("span",{className:"truncate flex-1",children:B.title||B.path})]},B.path))})]})]})]})})]}):m.jsx(m.Fragment,{children:e})}const xW={todo:"bg-muted-foreground/50","in-progress":"bg-yellow-500","in-review":"bg-purple-500",blocked:"bg-destructive",done:"bg-green-500"};function xst({taskId:e,isEditable:t=!1,onDelete:n,onReplace:r,onClick:i}){const[o,s]=v.useState(null),[a,l]=v.useState(!0),c=e.replace("task-","");v.useEffect(()=>{let E=!1;return GY(c).then(S=>{E||(s(S),l(!1))}).catch(()=>{E||(s(null),l(!1))}),()=>{E=!0}},[c]);const u=E=>{E.preventDefault(),E.stopPropagation(),!t&&(i?i(c):window.location.hash=`/kanban/${c}`)},f=()=>{window.location.hash=`/kanban/${c}`},h=o?.status?xW[o.status]:xW.todo,g=m.jsxs(oc,{variant:"outline",className:Se("mention-badge cursor-pointer select-none gap-1.5 font-medium","border-green-500/30 bg-green-500/10 text-green-700 hover:bg-green-500/20","dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-400 dark:hover:bg-green-500/20","transition-colors"),"data-task-id":c,onClick:u,onMouseDown:E=>{E.stopPropagation(),u(E)},children:[m.jsx(gf,{className:"w-3.5 h-3.5 shrink-0"}),a?m.jsxs("span",{className:"opacity-70",children:["#",c]}):o?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"max-w-[200px] truncate",children:["#",c,": ",o.title]}),m.jsx("span",{className:Se("w-2 h-2 rounded-full shrink-0",h)})]}):m.jsxs("span",{children:["#",c]})]}),y=o?m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("div",{className:"font-medium text-sm leading-tight",children:o.title}),o.description&&m.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:o.description}),m.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{className:Se("w-1.5 h-1.5 rounded-full",h)}),m.jsx("span",{className:"capitalize",children:o.status})]}),m.jsx("span",{className:"text-muted-foreground",children:"•"}),m.jsx("span",{className:"text-muted-foreground capitalize",children:o.priority})]})]}):null;return m.jsx(Rue,{isEditable:t,onPreview:f,onReplace:r||(()=>{}),onDelete:n||(()=>{}),previewContent:y,type:"task",children:g})}function EW(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="tableContent"&&"rows"in e}function SW(e){return Array.isArray(e)?e:e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:null}const Est=dae({type:"taskMention",propSchema:{taskId:{default:""}},content:"none"},{render:e=>{const t=e.inlineContent.props.taskId,n=e.editor,r=n?.isEditable??!1,i=()=>{if(!n)return;const s=n.document;for(const a of s){if(a.type==="table"&&EW(a.content)){let l=!1;const c=a.content.rows.map(u=>({...u,cells:u.cells.map(f=>{const h=SW(f);if(!h)return f;const g=h.filter(y=>{const E=y;return!(E.type==="taskMention"&&E.props?.taskId===t)});return g.length!==h.length?(l=!0,Array.isArray(f)?g:{...f,content:g}):f})}));if(l){n.updateBlock(a,{content:{...a.content,rows:c}});return}}if(Array.isArray(a.content)){const l=a.content.filter(c=>{const u=c;return!(u.type==="taskMention"&&u.props?.taskId===t)});if(l.length!==a.content.length){n.updateBlock(a,{content:l});return}}}},o=(s,a)=>{if(!n)return;const l=n.document;for(const c of l){if(c.type==="table"&&EW(c.content)){let u=!1;const f=c.content.rows.map(h=>({...h,cells:h.cells.map(g=>{const y=SW(g);if(!y)return g;const E=y.map(S=>{const w=S;return w.type==="taskMention"&&w.props?.taskId===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):S});return Array.isArray(g)?E:{...g,content:E}})}));if(u){n.updateBlock(c,{content:{...c.content,rows:f}});return}}if(Array.isArray(c.content)){let u=!1;const f=c.content.map(h=>{const g=h;return g.type==="taskMention"&&g.props?.taskId===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):h});if(u){n.updateBlock(c,{content:f});return}}}};return m.jsx(xst,{taskId:t,isEditable:r,onDelete:i,onReplace:o})}});function Sst({docPath:e,isEditable:t=!1,onDelete:n,onReplace:r,onClick:i}){const[o,s]=v.useState(null),[a,l]=v.useState(!0),c=e.endsWith(".md")?e:`${e}.md`;v.useEffect(()=>{let E=!1;return qY(c).then(S=>{!E&&S?(s(S),l(!1)):E||l(!1)}).catch(()=>{E||(s(null),l(!1))}),()=>{E=!0}},[c]);const u=E=>{E.preventDefault(),E.stopPropagation(),!t&&(i?i(c):window.location.hash=`/docs/${c}`)},f=()=>{window.location.hash=`/docs/${c}`},h=e.replace(/\.md$/,"").split("/").pop()||e,g=m.jsxs(oc,{variant:"outline",className:Se("mention-badge cursor-pointer select-none gap-1 font-medium","border-blue-500/30 bg-blue-500/10 text-blue-700 hover:bg-blue-500/20","dark:border-blue-500/30 dark:bg-blue-500/10 dark:text-blue-400 dark:hover:bg-blue-500/20","transition-colors"),"data-doc-path":c,onClick:u,onMouseDown:E=>{E.stopPropagation(),u(E)},children:[m.jsx(Xo,{className:"w-3.5 h-3.5 shrink-0"}),a?m.jsx("span",{className:"opacity-70",children:h}):o?.title?m.jsx("span",{className:"max-w-[200px] truncate",children:o.title}):m.jsx("span",{className:"max-w-[200px] truncate",children:h})]}),y=o?m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("div",{className:"font-medium text-sm leading-tight",children:o.title||h}),o.description&&m.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:o.description}),m.jsx("div",{className:"text-xs text-muted-foreground truncate",children:c}),o.tags&&o.tags.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1",children:o.tags.slice(0,3).map(E=>m.jsx(oc,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:E},E))})]}):null;return m.jsx(Rue,{isEditable:t,onPreview:f,onReplace:r||(()=>{}),onDelete:n||(()=>{}),previewContent:y,type:"doc",children:g})}function wW(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="tableContent"&&"rows"in e}function CW(e){return Array.isArray(e)?e:e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:null}const wst=dae({type:"docMention",propSchema:{docPath:{default:""}},content:"none"},{render:e=>{const t=e.inlineContent.props.docPath,n=e.editor,r=n?.isEditable??!1,i=()=>{if(!n)return;const s=n.document;for(const a of s){if(a.type==="table"&&wW(a.content)){let l=!1;const c=a.content.rows.map(u=>({...u,cells:u.cells.map(f=>{const h=CW(f);if(!h)return f;const g=h.filter(y=>{const E=y;return!(E.type==="docMention"&&E.props?.docPath===t)});return g.length!==h.length?(l=!0,Array.isArray(f)?g:{...f,content:g}):f})}));if(l){n.updateBlock(a,{content:{...a.content,rows:c}});return}}if(Array.isArray(a.content)){const l=a.content.filter(c=>{const u=c;return!(u.type==="docMention"&&u.props?.docPath===t)});if(l.length!==a.content.length){n.updateBlock(a,{content:l});return}}}},o=(s,a)=>{if(!n)return;const l=n.document;for(const c of l){if(c.type==="table"&&wW(c.content)){let u=!1;const f=c.content.rows.map(h=>({...h,cells:h.cells.map(g=>{const y=CW(g);if(!y)return g;const E=y.map(S=>{const w=S;return w.type==="docMention"&&w.props?.docPath===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):S});return Array.isArray(g)?E:{...g,content:E}})}));if(u){n.updateBlock(c,{content:{...c.content,rows:f}});return}}if(Array.isArray(c.content)){let u=!1;const f=c.content.map(h=>{const g=h;return g.type==="docMention"&&g.props?.docPath===t?(u=!0,s==="task"?{type:"taskMention",props:{taskId:a}}:{type:"docMention",props:{docPath:a}}):h});if(u){n.updateBlock(c,{content:f});return}}}};return m.jsx(Sst,{docPath:t,isEditable:r,onDelete:i,onReplace:o})}}),Cst={todo:"bg-muted-foreground/50","in-progress":"bg-yellow-500","in-review":"bg-purple-500",blocked:"bg-destructive",done:"bg-green-500"};async function Tst(e,t){const n=[],r=t.toLowerCase(),i=r.startsWith("task-")||r.startsWith("task "),o=r.startsWith("doc/")||r.startsWith("doc ")||r.startsWith("docs/");let s=t;i?s=t.replace(/^task[-\s]/i,""):o&&(s=t.replace(/^docs?[/\s]/i,""));try{let a=[],l=[];if(s.length>0){const c=await WY(s);a=c.tasks,l=c.docs}else o||(a=await VY(),a=a.slice(0,8)),i||(l=await jI(),l=l.slice(0,8));if(!o)for(const c of a.slice(0,8))n.push({id:`task-${c.id}`,title:`#${c.id}: ${c.title}`,group:"Tasks",itemType:"task",status:c.status,onItemClick:()=>{e.insertInlineContent([{type:"taskMention",props:{taskId:`task-${c.id}`}}," "])}});if(!i)for(const c of l.slice(0,8)){const u=c.path.replace(/\.md$/,"");n.push({id:u,title:c.title||u,group:"Docs",itemType:"doc",onItemClick:()=>{e.insertInlineContent([{type:"docMention",props:{docPath:u}}," "])}})}}catch(a){console.error("Failed to fetch mention suggestions:",a)}return n}function kst(e){const{items:t,selectedIndex:n,onItemClick:r}=e,i=t.filter(s=>s.itemType==="task"),o=t.filter(s=>s.itemType==="doc");return t.length===0?m.jsx("div",{className:"z-50 w-56 rounded-md border border-border bg-popover p-1 shadow-md",children:m.jsx("div",{className:"py-3 text-center text-xs text-muted-foreground",children:"No results found"})}):m.jsxs("div",{className:"z-50 w-56 max-h-48 overflow-y-auto rounded-md border border-border bg-popover p-1 shadow-md",children:[i.length>0&&m.jsxs("div",{className:"mb-1",children:[m.jsx("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:"Tasks"}),i.map(s=>{const l=t.indexOf(s)===n;return m.jsxs("div",{className:`flex items-center gap-2 px-2 py-1.5 text-sm rounded-sm cursor-pointer ${l?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onClick:()=>r?.(s),children:[m.jsx(gf,{className:"w-3.5 h-3.5 shrink-0 text-green-600 dark:text-green-400"}),m.jsx("span",{className:"text-muted-foreground text-xs shrink-0",children:s.id.replace("task-","#")}),m.jsx("span",{className:"truncate flex-1",children:s.title.replace(/^#\d+:\s*/,"")}),m.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Cst[s.status||"todo"]||"bg-muted-foreground/50"}`})]},s.id)})]}),o.length>0&&m.jsxs("div",{children:[m.jsx("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:"Docs"}),o.map(s=>{const l=t.indexOf(s)===n;return m.jsxs("div",{className:`flex items-center gap-2 px-2 py-1.5 text-sm rounded-sm cursor-pointer ${l?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onClick:()=>r?.(s),children:[m.jsx(Xo,{className:"w-3.5 h-3.5 shrink-0 text-blue-600 dark:text-blue-400"}),m.jsx("span",{className:"truncate flex-1",children:s.title})]},s.id)})]})]})}function Ast({editor:e}){return m.jsx(lae,{triggerCharacter:"@",getItems:async t=>Tst(e,t),suggestionMenuComponent:kst})}const{image:nht,video:rht,audio:iht,file:oht,...Nst}=ioe,Due=LP.create({blockSpecs:Nst,inlineContentSpecs:{...SP,taskMention:Est,docMention:wst}}),_st=/@(task-\d+(?:\.\d+)?)/g,Rst=/@docs?\/([^\s,;:!?"'()[\]]+)/g,Dst=/@\.knowns\/tasks\/task-(\d+(?:\.\d+)?)(?:\s*-\s*[^@\n]+?\.md|\.md)/g,Ist=/@\.knowns\/docs\/([^\s@]+?)\.md(?:\s*-\s*[^@\n]+)?/g,F0="[[TASK_MENTION:",B0="[[DOC_MENTION:",Bu="]]",TW="[[CODE_BLOCK:",kW="[[INLINE_CODE:",hx="]]";function Ost(e){let t=e;return t=t.replace(Dst,(n,r)=>`@task-${r}`),t=t.replace(Ist,(n,r)=>`@doc/${r}`),t}function Iue(e){let t=Ost(e);const n=[],r=[];return t=t.replace(/```[\s\S]*?```/g,i=>{const o=n.length;return n.push(i),`${TW}${o}${hx}`}),t=t.replace(/`[^`\n]+`/g,i=>{const o=r.length;return r.push(i),`${kW}${o}${hx}`}),t=t.replace(_st,(i,o)=>`${F0}${o}${Bu}`),t=t.replace(Rst,(i,o)=>{let s=o;return s.endsWith(".")&&!s.match(/\.\w+$/)&&(s=s.slice(0,-1)),`${B0}${s}${Bu}`}),t=t.replace(new RegExp(`${du(kW)}(\\d+)${du(hx)}`,"g"),(i,o)=>r[Number.parseInt(o,10)]),t=t.replace(new RegExp(`${du(TW)}(\\d+)${du(hx)}`,"g"),(i,o)=>n[Number.parseInt(o,10)]),t}function Oue(e){return e.map(t=>Mue(t))}function Mue(e){const t=e.children?.map(r=>Mue(r))||[];if(e.type==="table"&&Lue(e.content)){const r=Mst(e.content);return{...e,content:r,children:t}}const n=Array.isArray(e.content)?jF(e.content):e.content;return{...e,content:n,children:t}}function Lue(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="tableContent"&&"rows"in e&&Array.isArray(e.rows)}function Pue(e){return Array.isArray(e)?e:e&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)?e.content:null}function Mst(e){return{...e,rows:e.rows.map(t=>({...t,cells:t.cells.map(n=>{const r=Pue(n);if(r){const i=jF(r);return Array.isArray(n)?i:{...n,content:i}}return n})}))}}function jF(e){const t=[];for(const n of e)if(n.type==="text"&&typeof n.text=="string"){const r=n.text,i=Lst(r);for(const o of i)o.type==="text"?o.value&&t.push({type:"text",text:o.value,styles:n.styles||{}}):o.type==="taskMention"?t.push({type:"taskMention",props:{taskId:o.value}}):o.type==="docMention"&&t.push({type:"docMention",props:{docPath:o.value}})}else n.type==="link"?t.push({...n,content:jF(n.content||[])}):t.push(n);return t}function Lst(e){const t=[];let n=e;for(;n.length>0;){const r=n.indexOf(F0),i=n.indexOf(B0);let o=-1,s=!1;if(r>=0&&(i<0||r<i)?(o=r,s=!0):i>=0&&(o=i,s=!1),o<0){n&&t.push({type:"text",value:n});break}o>0&&t.push({type:"text",value:n.slice(0,o)});const l=o+(s?F0:B0).length,c=n.indexOf(Bu,l);if(c<0){t.push({type:"text",value:n.slice(o)});break}const u=n.slice(l,c);t.push({type:s?"taskMention":"docMention",value:u}),n=n.slice(c+Bu.length)}return t}function Pst(e){return e.map(t=>Fue(t))}function Fue(e){const t=e.children?.map(r=>Fue(r))||[];if(e.type==="table"&&Lue(e.content)){const r=Fst(e.content);return{...e,content:r,children:t}}const n=Array.isArray(e.content)?$F(e.content):e.content;return{...e,content:n,children:t}}function Fst(e){return{...e,rows:e.rows.map(t=>({...t,cells:t.cells.map(n=>{const r=Pue(n);if(r){const i=$F(r);return Array.isArray(n)?i:{...n,content:i}}return n})}))}}function $F(e){const t=[];for(const n of e)if(n.type==="taskMention"){const r=n.props?.taskId;r&&t.push({type:"text",text:`${F0}${r}${Bu}`,styles:{}})}else if(n.type==="docMention"){const r=n.props?.docPath;r&&t.push({type:"text",text:`${B0}${r}${Bu}`,styles:{}})}else n.type==="link"?t.push({...n,content:$F(n.content||[])}):t.push(n);return t}function Bst(e,t){let n=e;return n=n.replace(new RegExp(`${du(F0)}([^\\]]+)${du(Bu)}`,"g"),"@$1"),n=n.replace(new RegExp(`${du(B0)}([^\\]]+)${du(Bu)}`,"g"),"@doc/$1"),n}function du(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}class AW extends v.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("BlockNote Editor Error:",t,n),this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:m.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-muted-foreground",children:[m.jsx("p",{className:"text-sm",children:"Editor encountered an error"}),m.jsx("button",{type:"button",className:"mt-2 text-xs underline hover:text-foreground",onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}const yu=v.forwardRef(({markdown:e,onChange:t,placeholder:n="Write your content here...",readOnly:r=!1,className:i=""},o)=>{const{isDark:s}=Pm(),a=v.useRef(!1),l=v.useRef(!1),c=By({schema:Due});v.useEffect(()=>{c&&e&&!a.current&&(a.current=!0,u(e))},[c,e]);const u=v.useCallback(async g=>{if(!(!c||!g))try{l.current=!0;const y=Iue(g),E=await c.tryParseMarkdownToBlocks(y),S=Oue(E);c.replaceBlocks(c.document,S)}catch(y){console.error("Failed to load markdown:",y)}finally{l.current=!1}},[c]),f=v.useCallback(async()=>{if(!(!c||l.current))try{const g=Pst(c.document),y=await c.blocksToMarkdownLossy(g),E=Bst(y,c.document);t(E)}catch(g){console.error("Failed to convert to markdown:",g)}},[c,t]);v.useImperativeHandle(o,()=>({setMarkdown:g=>{u(g)},getMarkdown:()=>e}),[e,u]);const h=v.useMemo(()=>`blocknote-editor-wrapper ${i} ${s?"dark":""}`.trim(),[i,s]);return m.jsx(AW,{children:m.jsx("div",{className:h,style:{height:"100%",display:"flex",flexDirection:"column"},children:m.jsx(FF,{editor:c,editable:!r,onChange:f,theme:s?"dark":"light","data-placeholder":n,children:!r&&m.jsx(AW,{children:m.jsx(Ast,{editor:c})})})})})});yu.displayName="BlockNoteEditor";const jst=v.forwardRef(({markdown:e,className:t="",onDocLinkClick:n,onTaskLinkClick:r},i)=>{const{isDark:o}=Pm(),s=v.useRef(null),a=v.useRef(""),l=By({schema:Due});v.useEffect(()=>{if(!l||!e||e===a.current)return;a.current=e,(async()=>{try{const f=Iue(e),h=await l.tryParseMarkdownToBlocks(f),g=Oue(h);l.replaceBlocks(l.document,g)}catch(f){console.error("Failed to render markdown:",f)}})()},[l,e]),v.useEffect(()=>{if(!s.current)return;const u=h=>{const g=h.target,y=g.closest("[data-task-id]");if(y){const S=y.getAttribute("data-task-id");S&&r&&(h.preventDefault(),h.stopPropagation(),r(S));return}const E=g.closest("[data-doc-path]");if(E){const S=E.getAttribute("data-doc-path");S&&n&&(h.preventDefault(),h.stopPropagation(),n(S))}},f=s.current;return f.addEventListener("click",u),()=>{f.removeEventListener("click",u)}},[n,r]),v.useImperativeHandle(i,()=>({getElement:()=>s.current}));const c=v.useMemo(()=>`blocknote-render-wrapper ${t} ${o?"dark":""}`.trim(),[t,o]);return e?m.jsx("div",{ref:s,className:c,children:m.jsx(FF,{editor:l,editable:!1,theme:o?"dark":"light"})}):null});jst.displayName="BlockNoteRender";function $st({task:e,onSave:t,saving:n}){const[r,i]=v.useState(!1),[o,s]=v.useState(e.description||"");v.useEffect(()=>{s(e.description||"")},[e.description]);const a=()=>{o!==e.description&&t({description:o||void 0}),i(!1)},l=()=>{s(e.description||""),i(!1)};return m.jsxs(Kd,{children:[m.jsx(iy,{className:"pb-3",children:m.jsxs(oy,{className:"flex items-center gap-2 text-base",children:[m.jsx(sK,{className:"w-4 h-4"}),"Description"]})}),m.jsx(sy,{children:r?m.jsxs("div",{className:"space-y-3",children:[m.jsx(yu,{markdown:o,onChange:s,placeholder:"Add a more detailed description...",readOnly:n}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx($e,{size:"sm",onClick:a,disabled:n,children:"Save"}),m.jsx($e,{size:"sm",variant:"ghost",onClick:l,children:"Cancel"})]})]}):m.jsx("div",{className:"min-h-[60px] p-3 rounded-md border border-dashed cursor-pointer hover:border-primary hover:bg-accent/50 transition-colors",onClick:()=>i(!0),role:"button",tabIndex:0,onKeyDown:c=>c.key==="Enter"&&i(!0),children:e.description?m.jsx(bC,{markdown:e.description,className:"text-sm prose prose-sm dark:prose-invert max-w-none"}):m.jsx("span",{className:"text-muted-foreground text-sm italic",children:"Click to add description..."})})})]})}function Ust(e,t=[]){let n=[];function r(o,s){const a=v.createContext(s),l=n.length;n=[...n,s];const c=f=>{const{scope:h,children:g,...y}=f,E=h?.[e]?.[l]||a,S=v.useMemo(()=>y,Object.values(y));return m.jsx(E.Provider,{value:S,children:g})};c.displayName=o+"Provider";function u(f,h){const g=h?.[e]?.[l]||a,y=v.useContext(g);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(a){const l=a?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,Hst(i,...t)]}function Hst(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function zst(e){const t=Vst(e),n=v.forwardRef((r,i)=>{const{children:o,...s}=r,a=v.Children.toArray(o),l=a.find(qst);if(l){const c=l.props.children,u=a.map(f=>f===l?v.Children.count(c)>1?v.Children.only(null):v.isValidElement(c)?c.props.children:null:f);return m.jsx(t,{...s,ref:i,children:v.isValidElement(c)?v.cloneElement(c,void 0,u):null})}return m.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Vst(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const s=Yst(i),a=Wst(o,i.props);return i.type!==v.Fragment&&(a.ref=r?_n(r,s):s),v.cloneElement(i,a)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Gst=Symbol("radix.slottable");function qst(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Gst}function Wst(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Yst(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Kst=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],UF=Kst.reduce((e,t)=>{const n=zst(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),TT="Checkbox",[Xst]=Ust(TT),[Zst,HF]=Xst(TT);function Qst(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:f}=e,[h,g]=Us({prop:n,defaultProp:i??!1,onChange:l,caller:TT}),[y,E]=v.useState(null),[S,w]=v.useState(null),T=v.useRef(!1),A=y?!!s||!!y.closest("form"):!0,R={checked:h,disabled:o,setChecked:g,control:y,setControl:E,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:T,required:c,defaultChecked:vu(i)?!1:i,isFormControl:A,bubbleInput:S,setBubbleInput:w};return m.jsx(Zst,{scope:t,...R,children:Jst(f)?f(R):r})}var Bue="CheckboxTrigger",jue=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:s,disabled:a,checked:l,required:c,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:y}=HF(Bue,e),E=It(i,u),S=v.useRef(l);return v.useEffect(()=>{const w=o?.form;if(w){const T=()=>f(S.current);return w.addEventListener("reset",T),()=>w.removeEventListener("reset",T)}},[o,f]),m.jsx(UF.button,{type:"button",role:"checkbox","aria-checked":vu(l)?"mixed":l,"aria-required":c,"data-state":Vue(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:E,onKeyDown:Ue(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:Ue(n,w=>{f(T=>vu(T)?!0:!T),y&&g&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});jue.displayName=Bue;var zF=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l,onCheckedChange:c,form:u,...f}=e;return m.jsx(Qst,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:s,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>m.jsxs(m.Fragment,{children:[m.jsx(jue,{...f,ref:t,__scopeCheckbox:n}),h&&m.jsx(zue,{__scopeCheckbox:n})]})})});zF.displayName=TT;var $ue="CheckboxIndicator",Uue=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=HF($ue,n);return m.jsx(Yr,{present:r||vu(o.checked)||o.checked===!0,children:m.jsx(UF.span,{"data-state":Vue(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Uue.displayName=$ue;var Hue="CheckboxBubbleInput",zue=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:a,disabled:l,name:c,value:u,form:f,bubbleInput:h,setBubbleInput:g}=HF(Hue,e),y=It(n,g),E=uce(o),S=Pae(r);v.useEffect(()=>{const T=h;if(!T)return;const A=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(A,"checked").set,D=!i.current;if(E!==o&&_){const I=new Event("click",{bubbles:D});T.indeterminate=vu(o),_.call(T,vu(o)?!1:o),T.dispatchEvent(I)}},[h,E,o,i]);const w=v.useRef(vu(o)?!1:o);return m.jsx(UF.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??w.current,required:a,disabled:l,name:c,value:u,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});zue.displayName=Hue;function Jst(e){return typeof e=="function"}function vu(e){return e==="indeterminate"}function Vue(e){return vu(e)?"indeterminate":e?"checked":"unchecked"}const aw=v.forwardRef(({className:e,...t},n)=>m.jsx(zF,{ref:n,className:Se("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:m.jsx(Uue,{className:Se("grid place-content-center text-current"),children:m.jsx(Ds,{className:"h-4 w-4"})})}));aw.displayName=zF.displayName;var VF="Progress",GF=100,[eat]=Sae(VF),[tat,nat]=eat(VF),Gue=v.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=rat,...s}=e;(i||i===0)&&!NW(i)&&console.error(iat(`${i}`,"Progress"));const a=NW(i)?i:GF;r!==null&&!_W(r,a)&&console.error(oat(`${r}`,"Progress"));const l=_W(r,a)?r:null,c=lw(l)?o(l,a):void 0;return m.jsx(tat,{scope:n,value:l,max:a,children:m.jsx(io.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":lw(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":Yue(l,a),"data-value":l??void 0,"data-max":a,...s,ref:t})})});Gue.displayName=VF;var que="ProgressIndicator",Wue=v.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,i=nat(que,n);return m.jsx(io.div,{"data-state":Yue(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});Wue.displayName=que;function rat(e,t){return`${Math.round(e/t*100)}%`}function Yue(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function lw(e){return typeof e=="number"}function NW(e){return lw(e)&&!isNaN(e)&&e>0}function _W(e,t){return lw(e)&&!isNaN(e)&&e<=t&&e>=0}function iat(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${GF}\`.`}function oat(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
293
293
  - a positive number
294
294
  - less than the value passed to \`max\` (or ${GF} if no \`max\` prop is set)
295
295
  - \`null\` or \`undefined\` if the progress is indeterminate.
@@ -311,7 +311,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
311
311
  To pick up a draggable item, press the space bar.
312
312
  While dragging, use the arrow keys to move the item.
313
313
  Press space again to drop the item in its new position, or press escape to cancel.
314
- `},Uct={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Hct(e){let{announcements:t=Uct,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=$ct}=e;const{announce:o,announcement:s}=Fct(),a=Jy("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),Bct(v.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=pe.createElement(pe.Fragment,null,pe.createElement(Lct,{id:r,value:i.draggable}),pe.createElement(Pct,{id:a,announcement:s}));return n?Wr.createPortal(u,n):u}var Vr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Vr||(Vr={}));function yw(){}function R_(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function zct(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const wa=Object.freeze({x:0,y:0});function sB(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vct(e,t){const n=bw(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function aB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Gct(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _I(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function qct(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function hY(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Wct=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=hY(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=sB(hY(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(aB)},mY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=_I(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=_I(l),u=i.reduce((h,g,y)=>h+sB(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(aB)};function Yct(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const Ode=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=Yct(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Gct)};function Kct(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const Xct=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&Kct(r,a)){const c=_I(a).reduce((f,h)=>f+sB(r,h),0),u=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:u}})}}return i.sort(aB)};function Zct(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Mde(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wa}function Qct(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Jct=Qct(1);function Lde(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function eut(e,t,n){const r=Lde(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const tut={ignoreTransform:!1};function Lm(e,t){t===void 0&&(t=tut);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=oo(e).getComputedStyle(e);c&&(n=eut(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function gY(e){return Lm(e,{ignoreTransform:!0})}function nut(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function rut(e,t){return t===void 0&&(t=oo(e).getComputedStyle(e)),t.position==="fixed"}function iut(e,t){t===void 0&&(t=oo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function lB(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(oB(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Zy(i)||Rde(i)||n.includes(i))return n;const o=oo(e).getComputedStyle(i);return i!==e&&iut(i,o)&&n.push(i),rut(i,o)?n:r(i.parentNode)}return e?r(e):n}function Pde(e){const[t]=lB(e,1);return t??null}function D_(e){return!OT||!e?null:Om(e)?e:iB(e)?oB(e)||e===Mm(e).scrollingElement?window:Zy(e)?e:null:null}function Fde(e){return Om(e)?e.scrollX:e.scrollLeft}function Bde(e){return Om(e)?e.scrollY:e.scrollTop}function RI(e){return{x:Fde(e),y:Bde(e)}}var ni;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ni||(ni={}));function jde(e){return!OT||!e?!1:e===document.scrollingElement}function $de(e){const t={x:0,y:0},n=jde(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const out={x:.2,y:.2};function sut(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=out);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=$de(e),g={x:0,y:0},y={x:0,y:0},E={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+E.height?(g.y=ni.Backward,y.y=r*Math.abs((t.top+E.height-o)/E.height)):!u&&l>=t.bottom-E.height&&(g.y=ni.Forward,y.y=r*Math.abs((t.bottom-E.height-l)/E.height)),!h&&a>=t.right-E.width?(g.x=ni.Forward,y.x=r*Math.abs((t.right-E.width-a)/E.width)):!f&&s<=t.left+E.width&&(g.x=ni.Backward,y.x=r*Math.abs((t.left+E.width-s)/E.width)),{direction:g,speed:y}}function aut(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ude(e){return e.reduce((t,n)=>bh(t,RI(n)),wa)}function lut(e){return e.reduce((t,n)=>t+Fde(n),0)}function cut(e){return e.reduce((t,n)=>t+Bde(n),0)}function Hde(e,t){if(t===void 0&&(t=Lm),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Pde(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const uut=[["x",["left","right"],lut],["y",["top","bottom"],cut]];class cB{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=lB(n),i=Ude(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of uut)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pb{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function dut(e){const{EventTarget:t}=oo(e);return e instanceof t?e:Mm(e)}function I_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Ts;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ts||(Ts={}));function bY(e){e.preventDefault()}function fut(e){e.stopPropagation()}var bn;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(bn||(bn={}));const zde={start:[bn.Space,bn.Enter],cancel:[bn.Esc],end:[bn.Space,bn.Enter,bn.Tab]},put=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case bn.Right:return{...n,x:n.x+25};case bn.Left:return{...n,x:n.x-25};case bn.Down:return{...n,y:n.y+25};case bn.Up:return{...n,y:n.y-25}}};class uB{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Pb(Mm(n)),this.windowListeners=new Pb(oo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ts.Resize,this.handleCancel),this.windowListeners.add(Ts.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ts.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Hde(r),n(wa)}handleKeyDown(t){if(LT(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=zde,coordinateGetter:s=put,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:wa;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=gw(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const E of y){const S=t.code,{isTop:w,isRight:T,isLeft:A,isBottom:R,maxScroll:_,minScroll:D}=$de(E),I=aut(E),M={x:Math.min(S===bn.Right?I.right-I.width/2:I.right,Math.max(S===bn.Right?I.left:I.left+I.width/2,f.x)),y:Math.min(S===bn.Down?I.bottom-I.height/2:I.bottom,Math.max(S===bn.Down?I.top:I.top+I.height/2,f.y))},j=S===bn.Right&&!T||S===bn.Left&&!A,L=S===bn.Down&&!R||S===bn.Up&&!w;if(j&&M.x!==f.x){const F=E.scrollLeft+h.x,H=S===bn.Right&&F<=_.x||S===bn.Left&&F>=D.x;if(H&&!h.y){E.scrollTo({left:F,behavior:a});return}H?g.x=E.scrollLeft-F:g.x=S===bn.Right?E.scrollLeft-_.x:E.scrollLeft-D.x,g.x&&E.scrollBy({left:-g.x,behavior:a});break}else if(L&&M.y!==f.y){const F=E.scrollTop+h.y,H=S===bn.Down&&F<=_.y||S===bn.Up&&F>=D.y;if(H&&!h.x){E.scrollTo({top:F,behavior:a});return}H?g.y=E.scrollTop-F:g.y=S===bn.Down?E.scrollTop-_.y:E.scrollTop-D.y,g.y&&E.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,bh(gw(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}uB.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=zde,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function yY(e){return!!(e&&"distance"in e)}function vY(e){return!!(e&&"delay"in e)}class dB{constructor(t,n,r){var i;r===void 0&&(r=dut(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=Mm(s),this.documentListeners=new Pb(this.document),this.listeners=new Pb(r),this.windowListeners=new Pb(oo(s)),this.initialCoordinates=(i=bw(o))!=null?i:wa,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ts.Resize,this.handleCancel),this.windowListeners.add(Ts.DragStart,bY),this.windowListeners.add(Ts.VisibilityChange,this.handleCancel),this.windowListeners.add(Ts.ContextMenu,bY),this.documentListeners.add(Ts.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(vY(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(yY(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ts.Click,fut,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ts.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=bw(t))!=null?n:wa,c=gw(i,l);if(!r&&a){if(yY(a)){if(a.tolerance!=null&&I_(c,a.tolerance))return this.handleCancel();if(I_(c,a.distance))return this.handleStart()}if(vY(a)&&I_(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===bn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const hut={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vde extends dB{constructor(t){const{event:n}=t,r=Mm(n.target);super(t,hut,r)}}Vde.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const mut={move:{name:"mousemove"},end:{name:"mouseup"}};var DI;(function(e){e[e.RightClick=2]="RightClick"})(DI||(DI={}));class Gde extends dB{constructor(t){super(t,mut,Mm(t.event.target))}}Gde.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===DI.RightClick?!1:(r?.({event:n}),!0)}}];const O_={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class qde extends dB{constructor(t){super(t,O_)}static setup(){return window.addEventListener(O_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(O_.move.name,t)};function t(){}}}qde.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Fb;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Fb||(Fb={}));var vw;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(vw||(vw={}));function gut(e){let{acceleration:t,activator:n=Fb.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=vw.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=yut({delta:f,disabled:!o}),[y,E]=Rct(),S=v.useRef({x:0,y:0}),w=v.useRef({x:0,y:0}),T=v.useMemo(()=>{switch(n){case Fb.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Fb.DraggableRect:return i}},[n,i,l]),A=v.useRef(null),R=v.useCallback(()=>{const D=A.current;if(!D)return;const I=S.current.x*w.current.x,M=S.current.y*w.current.y;D.scrollBy(I,M)},[]),_=v.useMemo(()=>a===vw.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!T){E();return}for(const D of _){if(r?.(D)===!1)continue;const I=c.indexOf(D),M=u[I];if(!M)continue;const{direction:j,speed:L}=sut(D,M,T,t,h);for(const F of["x","y"])g[F][j[F]]||(L[F]=0,j[F]=0);if(L.x>0||L.y>0){E(),A.current=D,y(R,s),S.current=L,w.current=j;return}}S.current={x:0,y:0},w.current={x:0,y:0},E()},[t,R,r,E,o,s,JSON.stringify(T),JSON.stringify(g),y,c,_,u,JSON.stringify(h)])}const but={x:{[ni.Backward]:!1,[ni.Forward]:!1},y:{[ni.Backward]:!1,[ni.Forward]:!1}};function yut(e){let{delta:t,disabled:n}=e;const r=mw(t);return Qy(i=>{if(n||!r||!i)return but;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ni.Backward]:i.x[ni.Backward]||o.x===-1,[ni.Forward]:i.x[ni.Forward]||o.x===1},y:{[ni.Backward]:i.y[ni.Backward]||o.y===-1,[ni.Forward]:i.y[ni.Forward]||o.y===1}}},[n,t,r])}function vut(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Qy(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function xut(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var V0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(V0||(V0={}));var II;(function(e){e.Optimized="optimized"})(II||(II={}));const xY=new Map;function Eut(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=v.useState(null),{frequency:a,measure:l,strategy:c}=i,u=v.useRef(e),f=S(),h=z0(f),g=v.useCallback(function(w){w===void 0&&(w=[]),!h.current&&s(T=>T===null?w:T.concat(w.filter(A=>!T.includes(A))))},[h]),y=v.useRef(null),E=Qy(w=>{if(f&&!n)return xY;if(!w||w===xY||u.current!==e||o!=null){const T=new Map;for(let A of e){if(!A)continue;if(o&&o.length>0&&!o.includes(A.id)&&A.rect.current){T.set(A.id,A.rect.current);continue}const R=A.node.current,_=R?new cB(l(R),R):null;A.rect.current=_,_&&T.set(A.id,_)}return T}return w},[e,o,n,f,l]);return v.useEffect(()=>{u.current=e},[e]),v.useEffect(()=>{f||g()},[n,f]),v.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),v.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:E,measureDroppableContainers:g,measuringScheduled:o!=null};function S(){switch(c){case V0.Always:return!1;case V0.BeforeDragging:return n;default:return!n}}}function fB(e,t){return Qy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Sut(e,t){return fB(e,t)}function wut(e){let{callback:t,disabled:n}=e;const r=MT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function PT(e){let{callback:t,disabled:n}=e;const r=MT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function Cut(e){return new cB(Lm(e),e)}function EY(e,t,n){t===void 0&&(t=Cut);const[r,i]=v.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=wut({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=PT({callback:o});return Sa(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Tut(e){const t=fB(e);return Mde(e,t)}const SY=[];function kut(e){const t=v.useRef(e),n=Qy(r=>e?r&&r!==SY&&e&&t.current&&e.parentNode===t.current.parentNode?r:lB(e):SY,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function Aut(e){const[t,n]=v.useState(null),r=v.useRef(e),i=v.useCallback(o=>{const s=D_(o.target);s&&n(a=>a?(a.set(s,RI(s)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=D_(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,RI(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=D_(l);c?.removeEventListener("scroll",i)})}},[i,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>bh(o,s),wa):Ude(e):wa,[e,t])}function wY(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==wa;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?gw(e,n.current):wa}function Nut(e){v.useEffect(()=>{if(!OT)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function _ut(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function Wde(e){return v.useMemo(()=>e?nut(e):null,[e])}const CY=[];function Rut(e,t){t===void 0&&(t=Lm);const[n]=e,r=Wde(n?oo(n):null),[i,o]=v.useState(CY);function s(){o(()=>e.length?e.map(l=>jde(l)?r:new cB(t(l),l)):CY)}const a=PT({callback:s});return Sa(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Yde(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zy(t)?t:e}function Dut(e){let{measure:t}=e;const[n,r]=v.useState(null),i=v.useCallback(c=>{for(const{target:u}of c)if(Zy(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=PT({callback:i}),s=v.useCallback(c=>{const u=Yde(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=hw(s);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Iut=[{sensor:Vde,options:{}},{sensor:uB,options:{}}],Out={current:{}},iE={draggable:{measure:gY},droppable:{measure:gY,strategy:V0.WhileDragging,frequency:II.Optimized},dragOverlay:{measure:Lm}};class Bb extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Mut={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bb,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yw},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:iE,measureDroppableContainers:yw,windowRect:null,measuringScheduled:!1},Kde={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yw,draggableNodes:new Map,over:null,measureDroppableContainers:yw},e1=v.createContext(Kde),Xde=v.createContext(Mut);function Lut(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bb}}}function Put(e,t){switch(t.type){case Vr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vr.DragEnd:case Vr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Bb(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Vr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Bb(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Vr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Bb(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Fut(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=v.useContext(e1),o=mw(r),s=mw(n?.id);return v.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!LT(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Oct(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function Zde(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function But(e){return v.useMemo(()=>({draggable:{...iE.draggable,...e?.draggable},droppable:{...iE.droppable,...e?.droppable},dragOverlay:{...iE.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function jut(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=v.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Sa(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=Mde(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=Pde(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const FT=v.createContext({...wa,scaleX:1,scaleY:1});var Qc;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Qc||(Qc={}));const $ut=v.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Iut,collisionDetection:f=Ode,measuring:h,modifiers:g,...y}=t;const E=v.useReducer(Put,void 0,Lut),[S,w]=E,[T,A]=jct(),[R,_]=v.useState(Qc.Uninitialized),D=R===Qc.Initialized,{draggable:{active:I,nodes:M,translate:j},droppable:{containers:L}}=S,F=I!=null?M.get(I):null,H=v.useRef({initial:null,translated:null}),Y=v.useMemo(()=>{var en;return I!=null?{id:I,data:(en=F?.data)!=null?en:Out,rect:H}:null},[I,F]),$=v.useRef(null),[G,V]=v.useState(null),[X,Q]=v.useState(null),J=z0(y,Object.values(y)),B=Jy("DndDescribedBy",s),W=v.useMemo(()=>L.getEnabled(),[L]),K=But(h),{droppableRects:P,measureDroppableContainers:ce,measuringScheduled:le}=Eut(W,{dragging:D,dependencies:[j.x,j.y],config:K.droppable}),se=vut(M,I),te=v.useMemo(()=>X?bw(X):null,[X]),oe=di(),ue=Sut(se,K.draggable.measure);jut({activeNode:I!=null?M.get(I):null,config:oe.layoutShiftCompensation,initialRect:ue,measure:K.draggable.measure});const Te=EY(se,K.draggable.measure,ue),Ie=EY(se?se.parentElement:null),ke=v.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=L.getNodeFor((n=ke.current.over)==null?void 0:n.id),rt=Dut({measure:K.dragOverlay.measure}),ze=(r=rt.nodeRef.current)!=null?r:se,dn=D?(i=rt.rect)!=null?i:Te:null,nt=!!(rt.nodeRef.current&&rt.rect),Vn=Tut(nt?null:Te),$t=Wde(ze?oo(ze):null),xt=kut(D?tt??se:null),re=Rut(xt),de=Zde(g,{transform:{x:j.x-Vn.x,y:j.y-Vn.y,scaleX:1,scaleY:1},activatorEvent:X,active:Y,activeNodeRect:Te,containerNodeRect:Ie,draggingNodeRect:dn,over:ke.current.over,overlayNodeRect:rt.rect,scrollableAncestors:xt,scrollableAncestorRects:re,windowRect:$t}),ye=te?bh(te,j):null,Me=Aut(xt),Fe=wY(Me),q=wY(Me,[Te]),ge=bh(de,Fe),De=dn?Jct(dn,de):null,He=Y&&De?f({active:Y,collisionRect:De,droppableRects:P,droppableContainers:W,pointerCoordinates:ye}):null,ot=qct(He,"id"),[an,fn]=v.useState(null),Dn=nt?de:bh(de,q),vn=Zct(Dn,(o=an?.rect)!=null?o:null,Te),xn=v.useRef(null),Ae=v.useCallback((en,tn)=>{let{sensor:Ve,options:qt}=tn;if($.current==null)return;const yt=M.get($.current);if(!yt)return;const Mt=en.nativeEvent,Gn=new Ve({active:$.current,activeNode:yt,event:Mt,options:qt,context:ke,onAbort(Zt){if(!M.get(Zt))return;const{onDragAbort:Tn}=J.current,Jn={id:Zt};Tn?.(Jn),T({type:"onDragAbort",event:Jn})},onPending(Zt,Qn,Tn,Jn){if(!M.get(Zt))return;const{onDragPending:fi}=J.current,ls={id:Zt,constraint:Qn,initialCoordinates:Tn,offset:Jn};fi?.(ls),T({type:"onDragPending",event:ls})},onStart(Zt){const Qn=$.current;if(Qn==null)return;const Tn=M.get(Qn);if(!Tn)return;const{onDragStart:Jn}=J.current,as={activatorEvent:Mt,active:{id:Qn,data:Tn.data,rect:H}};Wr.unstable_batchedUpdates(()=>{Jn?.(as),_(Qc.Initializing),w({type:Vr.DragStart,initialCoordinates:Zt,active:Qn}),T({type:"onDragStart",event:as}),V(xn.current),Q(Mt)})},onMove(Zt){w({type:Vr.DragMove,coordinates:Zt})},onEnd:Xt(Vr.DragEnd),onCancel:Xt(Vr.DragCancel)});xn.current=Gn;function Xt(Zt){return async function(){const{active:Tn,collisions:Jn,over:as,scrollAdjustedTranslate:fi}=ke.current;let ls=null;if(Tn&&fi){const{cancelDrop:pc}=J.current;ls={activatorEvent:Mt,active:Tn,collisions:Jn,delta:fi,over:as},Zt===Vr.DragEnd&&typeof pc=="function"&&await Promise.resolve(pc(ls))&&(Zt=Vr.DragCancel)}$.current=null,Wr.unstable_batchedUpdates(()=>{w({type:Zt}),_(Qc.Uninitialized),fn(null),V(null),Q(null),xn.current=null;const pc=Zt===Vr.DragEnd?"onDragEnd":"onDragCancel";if(ls){const cs=J.current[pc];cs?.(ls),T({type:pc,event:ls})}})}}},[M]),Ge=v.useCallback((en,tn)=>(Ve,qt)=>{const yt=Ve.nativeEvent,Mt=M.get(qt);if($.current!==null||!Mt||yt.dndKit||yt.defaultPrevented)return;const Gn={active:Mt};en(Ve,tn.options,Gn)===!0&&(yt.dndKit={capturedBy:tn.sensor},$.current=qt,Ae(Ve,tn))},[M,Ae]),gt=xut(u,Ge);Nut(u),Sa(()=>{Te&&R===Qc.Initializing&&_(Qc.Initialized)},[Te,R]),v.useEffect(()=>{const{onDragMove:en}=J.current,{active:tn,activatorEvent:Ve,collisions:qt,over:yt}=ke.current;if(!tn||!Ve)return;const Mt={active:tn,activatorEvent:Ve,collisions:qt,delta:{x:ge.x,y:ge.y},over:yt};Wr.unstable_batchedUpdates(()=>{en?.(Mt),T({type:"onDragMove",event:Mt})})},[ge.x,ge.y]),v.useEffect(()=>{const{active:en,activatorEvent:tn,collisions:Ve,droppableContainers:qt,scrollAdjustedTranslate:yt}=ke.current;if(!en||$.current==null||!tn||!yt)return;const{onDragOver:Mt}=J.current,Gn=qt.get(ot),Xt=Gn&&Gn.rect.current?{id:Gn.id,rect:Gn.rect.current,data:Gn.data,disabled:Gn.disabled}:null,Zt={active:en,activatorEvent:tn,collisions:Ve,delta:{x:yt.x,y:yt.y},over:Xt};Wr.unstable_batchedUpdates(()=>{fn(Xt),Mt?.(Zt),T({type:"onDragOver",event:Zt})})},[ot]),Sa(()=>{ke.current={activatorEvent:X,active:Y,activeNode:se,collisionRect:De,collisions:He,droppableRects:P,draggableNodes:M,draggingNode:ze,draggingNodeRect:dn,droppableContainers:L,over:an,scrollableAncestors:xt,scrollAdjustedTranslate:ge},H.current={initial:dn,translated:De}},[Y,se,He,De,M,ze,dn,P,L,an,xt,ge]),gut({...oe,delta:j,draggingRect:De,pointerCoordinates:ye,scrollableAncestors:xt,scrollableAncestorRects:re});const lt=v.useMemo(()=>({active:Y,activeNode:se,activeNodeRect:Te,activatorEvent:X,collisions:He,containerNodeRect:Ie,dragOverlay:rt,draggableNodes:M,droppableContainers:L,droppableRects:P,over:an,measureDroppableContainers:ce,scrollableAncestors:xt,scrollableAncestorRects:re,measuringConfiguration:K,measuringScheduled:le,windowRect:$t}),[Y,se,Te,X,He,Ie,rt,M,L,P,an,ce,xt,re,K,le,$t]),sr=v.useMemo(()=>({activatorEvent:X,activators:gt,active:Y,activeNodeRect:Te,ariaDescribedById:{draggable:B},dispatch:w,draggableNodes:M,over:an,measureDroppableContainers:ce}),[X,gt,Y,Te,w,B,M,an,ce]);return pe.createElement(Ide.Provider,{value:A},pe.createElement(e1.Provider,{value:sr},pe.createElement(Xde.Provider,{value:lt},pe.createElement(FT.Provider,{value:vn},c)),pe.createElement(Fut,{disabled:a?.restoreFocus===!1})),pe.createElement(Hct,{...a,hiddenTextDescribedById:B}));function di(){const en=G?.autoScrollEnabled===!1,tn=typeof l=="object"?l.enabled===!1:l===!1,Ve=D&&!en&&!tn;return typeof l=="object"?{...l,enabled:Ve}:{enabled:Ve}}}),Uut=v.createContext(null),TY="button",Hut="Draggable";function zut(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Jy(Hut),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=v.useContext(e1),{role:g=TY,roleDescription:y="draggable",tabIndex:E=0}=i??{},S=l?.id===t,w=v.useContext(S?FT:Uut),[T,A]=hw(),[R,_]=hw(),D=_ut(s,t),I=z0(n);Sa(()=>(f.set(t,{id:t,key:o,node:T,activatorNode:R,data:I}),()=>{const j=f.get(t);j&&j.key===o&&f.delete(t)}),[f,t]);const M=v.useMemo(()=>({role:g,tabIndex:E,"aria-disabled":r,"aria-pressed":S&&g===TY?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,E,S,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:M,isDragging:S,listeners:r?void 0:D,node:T,over:h,setNodeRef:A,setActivatorNodeRef:_,transform:w}}function Qde(){return v.useContext(Xde)}const Vut="Droppable",Gut={timeout:25};function Jde(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Jy(Vut),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(e1),u=v.useRef({disabled:n}),f=v.useRef(!1),h=v.useRef(null),g=v.useRef(null),{disabled:y,updateMeasurementsFor:E,timeout:S}={...Gut,...i},w=z0(E??r),T=v.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),g.current=null},S)},[S]),A=PT({callback:T,disabled:y||!s}),R=v.useCallback((M,j)=>{A&&(j&&(A.unobserve(j),f.current=!1),M&&A.observe(M))},[A]),[_,D]=hw(R),I=z0(t);return v.useEffect(()=>{!A||!_.current||(A.disconnect(),f.current=!1,A.observe(_.current))},[_,A]),v.useEffect(()=>(a({type:Vr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:_,rect:h,data:I}}),()=>a({type:Vr.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==u.current.disabled&&(a({type:Vr.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:_,over:l,setNodeRef:D}}function qut(e){let{animation:t,children:n}=e;const[r,i]=v.useState(null),[o,s]=v.useState(null),a=mw(n);return!n&&!r&&a&&i(a),Sa(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),pe.createElement(pe.Fragment,null,n,r?v.cloneElement(r,{ref:s}):null)}const Wut={x:0,y:0,scaleX:1,scaleY:1};function Yut(e){let{children:t}=e;return pe.createElement(e1.Provider,{value:Kde},pe.createElement(FT.Provider,{value:Wut},t))}const Kut={position:"fixed",touchAction:"none"},Xut=e=>LT(e)?"transform 250ms ease":void 0,Zut=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:c,transition:u=Xut}=e;if(!a)return null;const f=i?c:{...c,scaleX:1,scaleY:1},h={...Kut,width:a.width,height:a.height,top:a.top,left:a.left,transform:ju.Transform.toString(f),transformOrigin:i&&r?Vct(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return pe.createElement(n,{className:s,style:h,ref:t},o)}),Qut=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,c]of Object.entries(i))n.node.style.setProperty(l,c);s!=null&&s.active&&n.node.classList.remove(s.active)}},Jut=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ju.Transform.toString(t)},{transform:ju.Transform.toString(n)}]},edt={duration:250,easing:"ease",keyframes:Jut,sideEffects:Qut({styles:{active:{opacity:"0"}}})};function tdt(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return MT((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Yde(s);if(!c)return;const{transform:u}=oo(s).getComputedStyle(s),f=Lde(u);if(!f)return;const h=typeof t=="function"?t:ndt(t);return Hde(l,i.draggable.measure),h({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function ndt(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...edt,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...c}=o;if(!t)return;const u={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},f={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...f},g=i({...c,active:s,dragOverlay:a,transform:{initial:l,final:h}}),[y]=g,E=g[g.length-1];if(JSON.stringify(y)===JSON.stringify(E))return;const S=r?.({active:s,dragOverlay:a,...c}),w=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(T=>{w.onfinish=()=>{S?.(),T()}})}}let kY=0;function rdt(e){return v.useMemo(()=>{if(e!=null)return kY++,kY},[e])}const idt=pe.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggableNodes:y,droppableContainers:E,dragOverlay:S,over:w,measuringConfiguration:T,scrollableAncestors:A,scrollableAncestorRects:R,windowRect:_}=Qde(),D=v.useContext(FT),I=rdt(f?.id),M=Zde(s,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:S.rect,over:w,overlayNodeRect:S.rect,scrollableAncestors:A,scrollableAncestorRects:R,transform:D,windowRect:_}),j=fB(h),L=tdt({config:r,draggableNodes:y,droppableContainers:E,measuringConfiguration:T}),F=j?S.setRef:void 0;return pe.createElement(Yut,null,pe.createElement(qut,{animation:L},f&&I?pe.createElement(Zut,{key:I,id:f.id,ref:F,as:a,activatorEvent:u,adjustScale:t,className:l,transition:o,rect:j,style:{zIndex:c,...i},transform:M},n):null))});function xw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function odt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function bx(e){return e!==null&&e>=0}function sdt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function adt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const efe=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=xw(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},tfe="Sortable",nfe=pe.createContext({activeIndex:-1,containerId:tfe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:efe,disabled:{draggable:!1,droppable:!1}});function ldt(e){let{children:t,id:n,items:r,strategy:i=efe,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Qde(),f=Jy(tfe,n),h=a.rect!==null,g=v.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),y=s!=null,E=s?g.indexOf(s.id):-1,S=c?g.indexOf(c.id):-1,w=v.useRef(g),T=!sdt(g,w.current),A=S!==-1&&E===-1||T,R=adt(o);Sa(()=>{T&&y&&u(g)},[T,g,y,u]),v.useEffect(()=>{w.current=g},[g]);const _=v.useMemo(()=>({activeIndex:E,containerId:f,disabled:R,disableTransforms:A,items:g,overIndex:S,useDragOverlay:h,sortedRects:odt(g,l),strategy:i}),[E,f,R.draggable,R.droppable,A,g,S,l,h,i]);return pe.createElement(nfe.Provider,{value:_},t)}const cdt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return xw(n,r,i).indexOf(t)},udt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},ddt={duration:200,easing:"ease"},rfe="transform",fdt=ju.Transition.toString({property:rfe,duration:0,easing:"linear"}),pdt={roleDescription:"sortable"};function hdt(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=v.useState(null),a=v.useRef(n);return Sa(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=Lm(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),v.useEffect(()=>{o&&s(null)},[o]),o}function mdt(e){let{animateLayoutChanges:t=udt,attributes:n,disabled:r,data:i,getNewIndex:o=cdt,id:s,strategy:a,resizeObserverConfig:l,transition:c=ddt}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:E,overIndex:S,useDragOverlay:w,strategy:T}=v.useContext(nfe),A=gdt(r,g),R=u.indexOf(s),_=v.useMemo(()=>({sortable:{containerId:f,index:R,items:u},...i}),[f,i,R,u]),D=v.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:M,isOver:j,setNodeRef:L}=Jde({id:s,data:_,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...l}}),{active:F,activatorEvent:H,activeNodeRect:Y,attributes:$,setNodeRef:G,listeners:V,isDragging:X,over:Q,setActivatorNodeRef:J,transform:B}=zut({id:s,data:_,attributes:{...pdt,...n},disabled:A.draggable}),W=_ct(L,G),K=!!F,P=K&&!y&&bx(h)&&bx(S),ce=!w&&X,le=ce&&P?B:null,te=P?le??(a??T)({rects:E,activeNodeRect:Y,activeIndex:h,overIndex:S,index:R}):null,oe=bx(h)&&bx(S)?o({id:s,items:u,activeIndex:h,overIndex:S}):R,ue=F?.id,Te=v.useRef({activeId:ue,items:u,newIndex:oe,containerId:f}),Ie=u!==Te.current.items,ke=t({active:F,containerId:f,isDragging:X,isSorting:K,id:s,index:R,items:u,newIndex:Te.current.newIndex,previousItems:Te.current.items,previousContainerId:Te.current.containerId,transition:c,wasDragging:Te.current.activeId!=null}),tt=hdt({disabled:!ke,index:R,node:M,rect:I});return v.useEffect(()=>{K&&Te.current.newIndex!==oe&&(Te.current.newIndex=oe),f!==Te.current.containerId&&(Te.current.containerId=f),u!==Te.current.items&&(Te.current.items=u)},[K,oe,f,u]),v.useEffect(()=>{if(ue===Te.current.activeId)return;if(ue!=null&&Te.current.activeId==null){Te.current.activeId=ue;return}const ze=setTimeout(()=>{Te.current.activeId=ue},50);return()=>clearTimeout(ze)},[ue]),{active:F,activeIndex:h,attributes:$,data:_,rect:I,index:R,newIndex:oe,items:u,isOver:j,isSorting:K,isDragging:X,listeners:V,node:M,overIndex:S,over:Q,setNodeRef:W,setActivatorNodeRef:J,setDroppableNodeRef:L,setDraggableNodeRef:G,transform:tt??te,transition:rt()};function rt(){if(tt||Ie&&Te.current.newIndex===R)return fdt;if(!(ce&&!LT(H)||!c)&&(K||ke))return ju.Transition.toString({...c,property:rfe})}}function gdt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}bn.Down,bn.Right,bn.Up,bn.Left;const bdt={},AY=e=>{let t;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(y=>y(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(bdt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,i,l);return l},ydt=e=>e?AY(e):AY,ife={},{useDebugValue:vdt}=pe,{useSyncExternalStoreWithSelector:xdt}=vKe;let NY=!1;const Edt=e=>e;function Sdt(e,t=Edt,n){(ife?"production":void 0)!=="production"&&n&&!NY&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),NY=!0);const r=xdt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vdt(r),r}const _Y=e=>{(ife?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?ydt(e):e,n=(r,i)=>Sdt(t,r,i);return Object.assign(n,t),n},wdt=e=>e?_Y(e):_Y;var RY,DY;const IY=typeof window<"u"&&((RY=window.document)!=null&&RY.createElement||((DY=window.navigator)==null?void 0:DY.product)==="ReactNative")?pe.useLayoutEffect:pe.useEffect;function Cdt(){const e=wdt(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{const n=e(i=>i.set),r=e(i=>i.version);return IY(()=>{n(i=>({version:i.version+1}))},[]),IY(()=>(n(({current:i})=>({current:[...i,t]})),()=>n(({current:i})=>({current:i.filter(o=>o!==t)}))),[t,r]),null},Out:()=>{const t=e(n=>n.current);return pe.createElement(pe.Fragment,null,t)}}}const M_=768;function BT(){const[e,t]=v.useState(void 0);return v.useEffect(()=>{const n=window.matchMedia(`(max-width: ${M_-1}px)`),r=()=>{t(window.innerWidth<M_)};return n.addEventListener("change",r),t(window.innerWidth<M_),()=>n.removeEventListener("change",r)},[]),!!e}const ofe=Cdt(),pB=v.createContext({columns:[],data:[],activeCardId:null}),Tdt=({id:e,children:t,className:n})=>{const{isOver:r,setNodeRef:i}=Jde({id:e});return m.jsx("div",{className:Se("flex min-h-40 flex-col divide-y overflow-hidden rounded-md border bg-secondary text-xs shadow-sm ring-2 transition-all shrink-0",r?"ring-primary":"ring-transparent",n),ref:i,children:t})},kdt=({id:e,name:t,children:n,className:r})=>{const{attributes:i,listeners:o,setNodeRef:s,transition:a,transform:l,isDragging:c}=mdt({id:e}),{activeCardId:u}=v.useContext(pB),f={transition:a,transform:ju.Transform.toString(l)};return m.jsxs(m.Fragment,{children:[m.jsx("div",{style:f,...o,...i,ref:s,children:m.jsx(Kd,{className:Se("cursor-grab gap-4 rounded-md p-3 shadow-sm",c&&"pointer-events-none cursor-grabbing opacity-30",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})}),u===e&&m.jsx(ofe.In,{children:m.jsx(Kd,{className:Se("cursor-grab gap-4 rounded-md p-3 shadow-sm ring-2 ring-primary",c&&"cursor-grabbing",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})})]})},Adt=({children:e,className:t,...n})=>{const{data:r}=v.useContext(pB),i=r.filter(s=>s.column===n.id),o=i.map(s=>s.id);return m.jsxs(Xi,{className:"overflow-hidden flex-1",children:[m.jsx(ldt,{items:o,children:m.jsx("div",{className:Se("flex flex-grow flex-col gap-2 p-2",t),...n,children:i.map(e)})}),m.jsx(Pw,{orientation:"vertical"})]})},Ndt=({className:e,...t})=>m.jsx("div",{className:Se("m-0 p-2 font-semibold text-sm",e),...t}),_dt=e=>t=>{const{droppableRects:n,droppableContainers:r,pointerCoordinates:i}=t,o=y=>!e.includes(y),s=y=>e.includes(y),a=Xct(t),l=a.filter(y=>o(y.id)),c=a.filter(y=>s(y.id));if(l.length>0){const E=mY(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[l[0]]}if(c.length>0)return[c[0]];const u=Ode(t),f=u.filter(y=>o(y.id)),h=u.filter(y=>s(y.id));if(f.length>0){const E=Wct(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[f[0]]}if(h.length>0)return[h[0]];if(i){let y=null;for(const E of e){const S=n.get(E);if(!S)continue;const w=S.left+S.width/2,T=S.top+S.height/2,A=Math.sqrt(Math.pow(i.x-w,2)+Math.pow(i.y-T,2)),R={left:S.left-150,right:S.right+150,top:S.top-50,bottom:S.bottom+50};i.x>=R.left&&i.x<=R.right&&i.y>=R.top&&i.y<=R.bottom&&(!y||A<y.distance)&&(y={id:E,distance:A})}if(y)return[{id:y.id}]}const g=mY(t);if(g.length>0){const y=g.find(E=>s(E.id));return y?[y]:[g[0]]}return[]},Rdt=({children:e,onDragStart:t,onDragEnd:n,onDragOver:r,className:i,columns:o,data:s,onDataChange:a,...l})=>{const[c,u]=v.useState(null),f=BT(),h=v.useMemo(()=>o.map(A=>A.id),[o]),g=v.useMemo(()=>_dt(h),[h]),y=zct(R_(Gde,{activationConstraint:{distance:8}}),R_(qde,{activationConstraint:{delay:150,tolerance:8}}),R_(uB)),E=A=>{s.find(_=>_.id===A.active.id)&&u(A.active.id),t?.(A)},S=A=>{const{active:R,over:_}=A;if(!_)return;const D=s.find(F=>F.id===R.id),I=s.find(F=>F.id===_.id);if(!D)return;const M=D.column,L=o.some(F=>F.id===_.id)?_.id:I?.column||M;if(M!==L){let F=[...s];const H=F.findIndex(Y=>Y.id===R.id);if(F[H]={...F[H],column:L},I){const Y=F.findIndex($=>$.id===_.id);F=xw(F,H,Y)}a?.(F)}r?.(A)},w=A=>{u(null),n?.(A);const{active:R,over:_}=A;if(!_||R.id===_.id)return;if(o.some(L=>L.id===_.id)){const L=s.find(F=>F.id===R.id);if(L&&L.column!==_.id){let F=[...s];const H=F.findIndex(Y=>Y.id===R.id);F[H]={...F[H],column:_.id},a?.(F)}return}let I=[...s];const M=I.findIndex(L=>L.id===R.id),j=I.findIndex(L=>L.id===_.id);M!==-1&&j!==-1&&(I=xw(I,M,j),a?.(I))},T={onDragStart({active:A}){const{name:R,column:_}=s.find(D=>D.id===A.id)??{};return`Picked up the card "${R}" from the "${_}" column`},onDragOver({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dragged the card "${_}" over the "${D}" column`},onDragEnd({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dropped the card "${_}" into the "${D}" column`},onDragCancel({active:A}){const{name:R}=s.find(_=>_.id===A.id)??{};return`Cancelled dragging the card "${R}"`}};return m.jsx(pB.Provider,{value:{columns:o,data:s,activeCardId:c},children:m.jsxs($ut,{accessibility:{announcements:T},collisionDetection:g,onDragEnd:w,onDragOver:S,onDragStart:E,sensors:y,...l,children:[m.jsx("div",{className:Se("flex gap-4",f&&"flex-col",i),children:o.map(A=>e(A))}),typeof window<"u"&&Wr.createPortal(m.jsx(idt,{children:m.jsx(ofe.Out,{})}),document.body)]})})},OY={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function sb(e){return OY[e]?OY[e]:e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Ddt({tasks:e,loading:t,onTasksUpdate:n}){const{config:r,updateConfig:i}=bf(),[o,s]=v.useState(new Set),[a,l]=v.useState(!1),c=BT(),u=r?.statuses||["todo","in-progress","in-review","done","blocked"],f=r?.statusColors||jO,h=v.useMemo(()=>u.filter(L=>o.has(L)).map(L=>({id:L,name:sb(L),color:f[L]||"gray"})),[u,o,f]),g={high:0,medium:1,low:2},y=v.useMemo(()=>[...e].sort((F,H)=>{const Y=g[F.priority]??2,$=g[H.priority]??2;return Y!==$?Y-$:new Date(H.updatedAt).getTime()-new Date(F.updatedAt).getTime()}).map(F=>({id:F.id,name:F.title,column:F.status,task:F})),[e]),E=()=>{const F=window.location.hash.slice(1).match(/^\/kanban\/([^?]+)/);if(!F)return null;const H=F[1];return e.find(Y=>Y.id===H)||null},[S,w]=v.useState(E());v.useEffect(()=>{const L=()=>{w(E())};return w(E()),window.addEventListener("hashchange",L),()=>window.removeEventListener("hashchange",L)},[e]),v.useEffect(()=>{r?.visibleColumns?s(new Set(r.visibleColumns)):s(new Set(u))},[r?.visibleColumns,u.join(",")]);const T=async L=>{try{await i({visibleColumns:[...L]})}catch(F){console.error("Failed to save config:",F)}},A=L=>{s(F=>{const H=new Set(F);return H.has(L)?H.delete(L):H.add(L),T(H),H})},R=async L=>{const F=L.filter(Y=>{const $=e.find(G=>G.id===Y.id);return $&&$.status!==Y.column}),H=e.map(Y=>{const $=L.find(G=>G.id===Y.id);return $&&$.column!==Y.status?{...Y,status:$.column}:Y});n(H);for(const Y of F)try{await ua.updateTask(Y.id,{status:Y.column}),Kl.success("Status updated",{description:`#${Y.id} moved to ${sb(Y.column)}`})}catch($){console.error("Failed to update task:",$),Kl.error("Failed to update status",{description:$ instanceof Error?$.message:"Unknown error"}),ua.getTasks().then(n).catch(console.error);break}};if(t)return m.jsx("div",{className:"flex items-center justify-center h-64",children:m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading tasks..."})]})});const _=L=>{window.location.hash=`/kanban/${L.id}`},D=()=>{window.location.hash="/"},I=L=>{n(e.map(F=>F.id===L.id?L:F))},M=L=>{window.location.hash=`/kanban/${L}`},j=async L=>{try{await ua.archiveTask(L),n(e.filter(F=>F.id!==L)),D()}catch(F){console.error("Failed to archive task:",F)}};return m.jsxs("div",{className:"flex flex-col h-full",children:[c?m.jsxs(ude,{open:a,onOpenChange:l,className:"shrink-0 bg-card rounded-lg mb-4 border border-border",children:[m.jsxs(dde,{className:"flex items-center justify-between w-full p-3",children:[m.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Show Columns (",o.size,"/",u.length,")"]}),a?m.jsx(XY,{className:"w-4 h-4 text-muted-foreground"}):m.jsx(Eu,{className:"w-4 h-4 text-muted-foreground"})]}),m.jsx(fde,{children:m.jsx("div",{className:"flex flex-wrap gap-2 px-3 pb-3",children:u.map(L=>{const F=o.has(L),H=e.filter(Y=>Y.status===L).length;return m.jsxs("button",{type:"button",onClick:()=>A(L),className:Se("flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-colors text-xs",F?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[F?m.jsx(q_,{className:"w-3.5 h-3.5"}):m.jsx(G_,{className:"w-3.5 h-3.5"}),m.jsxs("span",{className:"font-medium",children:[sb(L)," (",H,")"]})]},L)})})})]}):m.jsx("div",{className:"shrink-0 bg-card rounded-lg p-4 mb-4 border border-border",children:m.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Show Columns:"}),u.map(L=>{const F=o.has(L),H=e.filter(Y=>Y.status===L).length;return m.jsxs("button",{type:"button",onClick:()=>A(L),className:Se("flex items-center gap-2 px-3 py-1.5 rounded-lg transition-colors",F?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[F?m.jsx(q_,{className:"w-4 h-4"}):m.jsx(G_,{className:"w-4 h-4"}),m.jsxs("span",{className:"text-sm font-medium",children:[sb(L)," (",H,")"]})]},L)})]})}),m.jsxs(Xi,{className:"flex-1",children:[o.size>0?m.jsx(Rdt,{columns:h,data:y,onDataChange:R,className:"min-h-full pb-4",children:L=>{const F=Fwe(L.id,f),H=y.filter(Y=>Y.column===L.id).length;return m.jsxs(Tdt,{id:L.id,className:Se("min-w-[320px] max-w-[380px]",c&&"min-w-0 max-w-none w-full",F.bg,F.border),children:[m.jsxs(Ndt,{className:"flex items-center justify-between",children:[m.jsx("span",{className:"font-bold text-sm uppercase tracking-wide text-foreground",children:L.name}),m.jsx("span",{className:"text-xs rounded-full px-2 py-1 font-medium text-muted-foreground bg-background",children:H})]}),m.jsx(Adt,{id:L.id,children:Y=>m.jsx(Idt,{item:Y,statusColors:f,onClick:()=>_(Y.task)},Y.id)})]},L.id)}}):m.jsx("div",{className:"text-center py-12",children:m.jsx("p",{className:"text-lg text-muted-foreground",children:"No columns visible. Please select at least one column to display."})}),m.jsx(Pw,{orientation:"horizontal"})]}),m.jsx(_de,{task:S,allTasks:e,onClose:D,onUpdate:I,onArchive:j,onNavigateToTask:M})]})}function Idt({item:e,statusColors:t,onClick:n}){const{task:r}=e,i=wh(r.status,t),o=r.acceptanceCriteria.filter(a=>a.completed).length,s=r.acceptanceCriteria.length;return m.jsx(kdt,{id:e.id,name:e.name,column:e.column,className:"w-full",children:m.jsxs("div",{onClick:n,onKeyDown:a=>a.key==="Enter"&&n(),role:"button",tabIndex:0,className:"cursor-pointer",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono shrink-0 text-muted-foreground",children:["#",r.id]}),m.jsxs("div",{className:"flex items-center gap-1 flex-wrap justify-end",children:[m.jsx("span",{className:Se("text-xs px-1.5 py-0.5 rounded font-medium",i),children:sb(r.status)}),r.priority==="high"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-destructive/10 text-destructive dark:bg-destructive/20",children:"HIGH"}),r.priority==="medium"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",children:"MED"})]})]}),m.jsx("h3",{className:"font-medium text-sm mb-2 line-clamp-2 text-foreground",children:r.title}),s>0&&m.jsxs("div",{className:"flex items-center gap-2 text-xs mb-2 text-muted-foreground",children:[m.jsx(QY,{className:"w-3 h-3","aria-hidden":"true"}),m.jsxs("span",{children:[o,"/",s]})]}),r.labels.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:r.labels.map(a=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-secondary text-secondary-foreground",children:a},a))}),r.assignee&&m.jsxs("div",{className:"flex items-center gap-1.5 text-xs mt-2 text-muted-foreground",children:[m.jsx($0,{name:r.assignee,size:"sm"}),m.jsx("span",{children:r.assignee})]})]})})}const MY=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],LY={low:"bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400",medium:"bg-amber-100 dark:bg-amber-900 text-amber-700 dark:text-amber-300",high:"bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300"};function Odt({isOpen:e,allTasks:t,onClose:n,onCreated:r}){const{currentUser:i}=YZ(),{config:o}=bf(),s=v.useRef(null),a=v.useRef(null),l=v.useMemo(()=>{const q=o.statuses||["todo","in-progress","in-review","done","blocked"];return JZ(q)},[o.statuses]),c=o.statusColors||{},[u,f]=v.useState(""),[h,g]=v.useState(""),[y,E]=v.useState("todo"),[S,w]=v.useState("medium"),[T,A]=v.useState(""),[R,_]=v.useState([]),[D,I]=v.useState(""),[M,j]=v.useState([]),[L,F]=v.useState(""),[H,Y]=v.useState(""),[$,G]=v.useState(!1),[V,X]=v.useState(null),[Q,J]=v.useState(!1),[B,W]=v.useState(""),[K,P]=v.useState(!1),[ce,le]=v.useState(""),[se,te]=v.useState(!1),[oe,ue]=v.useState(!1),{preferences:Te,toggleTaskCreateLayout:Ie}=ZZ(),ke=Te.taskCreateLayout==="maximized",tt=v.useRef(null),rt={hidden:{opacity:0,y:20,scale:.98},visible:{opacity:1,y:0,scale:1,transition:{duration:.2,ease:"easeOut"}},exit:{opacity:0,y:10,scale:.98,transition:{duration:.15,ease:"easeIn"}}};v.useEffect(()=>{e||(f(""),g(""),E("todo"),w("medium"),A(""),_([]),I(""),j([]),F(""),Y(""),X(null),J(!1),W(""),P(!1),le(""),te(!1),ue(!1))},[e]),v.useEffect(()=>{e&&setTimeout(()=>s.current?.focus(),100)},[e,ke]),v.useEffect(()=>{K&&tt.current&&tt.current.focus()},[K]);const ze=v.useCallback(()=>{B.trim()&&(j(q=>[...q,{id:crypto.randomUUID(),text:B.trim()}]),W(""),P(!1))},[B]),dn=v.useCallback(q=>{j(ge=>ge.filter(De=>De.id!==q))},[]),nt=v.useCallback(()=>{ce.trim()&&(R.includes(ce.trim())||_(q=>[...q,ce.trim()]),le(""),te(!1))},[ce,R]),Vn=v.useCallback(q=>{_(ge=>ge.filter(De=>De!==q))},[]),$t=async q=>{if(q.preventDefault(),X(null),!u.trim()){X("Title is required");return}G(!0);try{const ge={title:u.trim(),description:h.trim()||void 0,status:y,priority:S,labels:R,assignee:T.trim()||void 0,parent:D||void 0,acceptanceCriteria:M.map(De=>({text:De.text,completed:!1})),implementationPlan:L.trim()||void 0,implementationNotes:H.trim()||void 0};await sme(ge),J(!0),Kl.success("Task created successfully",{description:u.trim()}),setTimeout(()=>{r(),n()},800)}catch(ge){const De=ge instanceof Error?ge.message:"Failed to create task";X(De),Kl.error("Failed to create task",{description:De})}finally{G(!1)}},xt=D?t.find(q=>q.id===D):null,re=m.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 border-b bg-green-700",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"text-green-100 text-xs font-medium uppercase tracking-wide",children:"New Task"}),m.jsx("input",{ref:s,type:"text",value:u,onChange:q=>f(q.target.value),placeholder:"Enter task title...",className:"w-full text-lg font-semibold bg-white/20 text-white placeholder-white/60 border-0 rounded px-2 py-1 mt-1 focus:outline-none focus:ring-2 focus:ring-white/50",disabled:$})]}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[m.jsx($e,{variant:"ghost",size:"icon",onClick:Ie,className:"h-8 w-8 text-foreground hover:text-foreground",title:ke?"Minimize":"Maximize",children:ke?m.jsx(iK,{className:"w-4 h-4"}):m.jsx(rK,{className:"w-4 h-4"})}),m.jsx($e,{variant:"ghost",size:"icon",onClick:n,className:"h-8 w-8 text-foreground hover:text-foreground",title:"Close",children:m.jsx(Yo,{className:"w-4 h-4"})})]})]}),de=(Q||V)&&m.jsxs("div",{className:"px-4 pt-4",children:[Q&&m.jsx("div",{className:"bg-green-50 dark:bg-green-900/50 border border-green-200 dark:border-green-700 text-green-700 dark:text-green-300 px-4 py-2 rounded-lg text-sm",children:"Task created successfully!"}),V&&m.jsx("div",{className:"bg-red-50 dark:bg-red-900/50 border border-red-200 dark:border-red-700 text-red-700 dark:text-red-300 px-4 py-2 rounded-lg text-sm",children:V})]}),ye=m.jsxs("div",{className:"p-6 space-y-6",children:[m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(sK,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Description"})]}),m.jsx(yu,{markdown:h,onChange:g,placeholder:"Add a more detailed description...",readOnly:$})]}),m.jsxs("section",{children:[m.jsx("div",{className:"flex items-center justify-between mb-3",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(gf,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Acceptance Criteria"}),M.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.length,")"]})]})}),m.jsx("div",{className:"space-y-2",children:M.map(q=>m.jsxs("div",{className:"flex items-start gap-2 bg-muted/50 rounded-lg px-3 py-2 group hover:shadow-sm transition-shadow",children:[m.jsx("input",{type:"checkbox",checked:!1,disabled:!0,className:"mt-1 w-4 h-4 rounded cursor-not-allowed opacity-50"}),m.jsx("span",{className:"flex-1 text-sm",children:q.text}),m.jsx("button",{type:"button",onClick:()=>dn(q.id),className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500 p-1 transition-all",title:"Delete",children:m.jsx(Wd,{className:"w-4 h-4"})})]},q.id))}),K?m.jsxs("div",{className:"mt-2 bg-muted/50 rounded-lg px-3 py-2",children:[m.jsx("input",{ref:tt,type:"text",value:B,onChange:q=>W(q.target.value),onKeyDown:q=>{q.key==="Enter"&&B.trim()&&(q.preventDefault(),ze()),q.key==="Escape"&&(W(""),P(!1))},placeholder:"Add an item...",className:"w-full border border-input rounded px-2 py-1.5 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-green-500",disabled:$}),m.jsxs("div",{className:"flex gap-2 mt-2",children:[m.jsx($e,{type:"button",size:"sm",onClick:ze,disabled:!B.trim()||$,className:"bg-green-700 hover:bg-green-800 text-white",children:"Add"}),m.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:()=>{W(""),P(!1)},children:"Cancel"})]})]}):m.jsxs("button",{type:"button",onClick:()=>P(!0),className:"mt-2 flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground hover:bg-muted px-3 py-2 rounded-lg transition-colors w-full",disabled:$,children:[m.jsx(Os,{className:"w-4 h-4"}),m.jsx("span",{children:"Add an item"})]})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Xo,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Plan"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(yu,{markdown:L,onChange:F,placeholder:"Describe how you plan to implement this task...",readOnly:$})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Wge,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Notes"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(yu,{markdown:H,onChange:Y,placeholder:"Add notes, observations, or any other relevant information...",readOnly:$})]})]}),Me=m.jsxs("div",{className:"p-4 space-y-6",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(Yi,{value:y,onValueChange:q=>E(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full",wh(y,c)),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:l.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(Yi,{value:S,onValueChange:q=>w(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full",LY[S]),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:MY.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(cw,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Labels"}),m.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(q=>m.jsxs(oc,{variant:"secondary",className:"gap-1 pr-1",children:[q,m.jsx("button",{type:"button",onClick:()=>Vn(q),className:"ml-1 hover:text-destructive",children:m.jsx(Yo,{className:"w-3 h-3"})})]},q))}),se?m.jsxs("div",{className:"space-y-2",children:[m.jsx(qr,{value:ce,onChange:q=>le(q.target.value),onKeyDown:q=>{q.key==="Enter"&&ce.trim()&&(q.preventDefault(),nt()),q.key==="Escape"&&(le(""),te(!1))},placeholder:"Label name",disabled:$,autoFocus:!0}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx($e,{size:"sm",onClick:nt,disabled:!ce.trim()||$,children:"Add"}),m.jsx($e,{size:"sm",variant:"ghost",onClick:()=>{le(""),te(!1)},children:"Cancel"})]})]}):m.jsxs($e,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground",onClick:()=>te(!0),disabled:$,children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"Add label"]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Parent Task"}),m.jsxs(L0,{open:oe,onOpenChange:ue,children:[m.jsx(P0,{asChild:!0,children:m.jsxs($e,{variant:"outline",role:"combobox","aria-expanded":oe,className:"w-full justify-between h-auto min-h-10 py-2",disabled:$,title:xt?`#${xt.id} - ${xt.title}`:void 0,children:[xt?m.jsxs("div",{className:"flex items-center gap-2 text-left overflow-hidden min-w-0 flex-1",children:[m.jsx(yh,{className:"w-4 h-4 shrink-0 text-muted-foreground"}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",xt.id]}),m.jsx("p",{className:"truncate text-sm",children:xt.title})]})]}):m.jsx("span",{className:"text-muted-foreground",children:"Select parent task..."}),m.jsx(cE,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Vh,{className:"w-[400px] p-0",align:"start",children:m.jsxs(Gh,{children:[m.jsx(qh,{placeholder:"Search tasks..."}),m.jsxs(Wh,{children:[m.jsx(Yh,{children:"No task found."}),m.jsxs(Ja,{children:[m.jsxs(Ko,{value:"none",onSelect:()=>{I(""),ue(!1)},children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(q=>m.jsxs(Ko,{value:`${q.id} ${q.title}`,onSelect:()=>{I(q.id),ue(!1)},title:`#${q.id} - ${q.title}`,children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D===q.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",q.id]}),m.jsx("p",{className:"truncate text-sm",children:q.title})]})]},q.id))]})]})]})})]})]})]}),Fe=m.jsxs("div",{className:"border-t px-6 py-4 bg-muted/30 flex justify-end gap-3",children:[m.jsx($e,{type:"button",variant:"ghost",onClick:n,disabled:$,children:"Cancel"}),m.jsx($e,{type:"button",onClick:$t,className:"bg-green-700 hover:bg-green-800 text-white",disabled:$||Q||!u.trim(),children:$?"Creating...":"Create Task"})]});return ke?m.jsx(mE,{children:e&&m.jsx(OO,{open:e,onOpenChange:q=>!q&&n(),children:m.jsxs(Ow,{className:"max-w-6xl w-[95vw] h-[90vh] p-0 gap-0 overflow-hidden flex flex-col",hideCloseButton:!0,children:[m.jsx(MO,{className:"sr-only",children:"Create New Task"}),m.jsxs(vE.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:rt,initial:"hidden",animate:"visible",exit:"exit",children:[re,de,m.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[m.jsx(Xi,{className:"flex-1",children:ye}),m.jsx("div",{className:"shrink-0 w-72 border-l bg-muted/20",children:m.jsx(Xi,{className:"h-full",children:Me})})]}),Fe]})]})})}):m.jsx(mE,{children:e&&m.jsx(RO,{open:e,onOpenChange:q=>!q&&n(),children:m.jsx(Iw,{side:"right",className:"w-full sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl p-0 flex flex-col gap-0",hideCloseButton:!0,children:m.jsxs(vE.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:rt,initial:"hidden",animate:"visible",exit:"exit",children:[re,de,m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m.jsx("div",{className:"shrink-0 border-b bg-muted/20",children:m.jsxs("div",{className:"p-4 space-y-3",children:[m.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(Yi,{value:y,onValueChange:q=>E(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full h-9",wh(y,c)),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:l.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(Yi,{value:S,onValueChange:q=>w(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full h-9",LY[S]),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:MY.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(cw,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]})]}),m.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Labels:"}),m.jsxs("div",{className:"flex flex-wrap gap-1 flex-1",children:[R.map(q=>m.jsxs(oc,{variant:"secondary",className:"gap-1 pr-1 text-xs",children:[q,m.jsx("button",{type:"button",onClick:()=>Vn(q),className:"ml-0.5 hover:text-destructive",children:m.jsx(Yo,{className:"w-3 h-3"})})]},q)),!se&&m.jsxs($e,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs text-muted-foreground",onClick:()=>te(!0),children:[m.jsx(Os,{className:"w-3 h-3 mr-1"}),"Add"]})]}),se&&m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(qr,{value:ce,onChange:q=>le(q.target.value),onKeyDown:q=>{q.key==="Enter"&&ce.trim()&&nt(),q.key==="Escape"&&(le(""),te(!1))},placeholder:"Label",className:"h-7 w-24 text-xs",autoFocus:!0}),m.jsx($e,{size:"sm",className:"h-7 px-2",onClick:nt,disabled:!ce.trim(),children:"Add"}),m.jsx($e,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:()=>{le(""),te(!1)},children:m.jsx(Yo,{className:"w-3 h-3"})})]})]}),m.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Parent:"}),m.jsxs(L0,{open:oe,onOpenChange:ue,children:[m.jsx(P0,{asChild:!0,children:m.jsxs($e,{variant:"outline",role:"combobox",size:"sm",className:"h-7 justify-between min-w-[120px] max-w-[250px]",disabled:$,title:xt?`#${xt.id} - ${xt.title}`:void 0,children:[xt?m.jsxs("span",{className:"truncate text-xs",children:["#",xt.id," - ",xt.title]}):m.jsx("span",{className:"text-muted-foreground text-xs",children:"None"}),m.jsx(cE,{className:"ml-1 h-3 w-3 shrink-0 opacity-50"})]})}),m.jsx(Vh,{className:"w-[400px] p-0",align:"end",children:m.jsxs(Gh,{children:[m.jsx(qh,{placeholder:"Search tasks..."}),m.jsxs(Wh,{children:[m.jsx(Yh,{children:"No task found."}),m.jsxs(Ja,{children:[m.jsxs(Ko,{value:"none",onSelect:()=>{I(""),ue(!1)},children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(q=>m.jsxs(Ko,{value:`${q.id} ${q.title}`,onSelect:()=>{I(q.id),ue(!1)},title:`#${q.id} - ${q.title}`,children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D===q.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",q.id]}),m.jsx("p",{className:"truncate text-sm",children:q.title})]})]},q.id))]})]})]})})]})]})]})]})}),m.jsx(Xi,{className:"flex-1",children:ye})]}),Fe]})})})})}const Mdt=bue,Ldt=yue,Pdt=vue,sfe=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(bit,{children:m.jsx(PF,{ref:r,sideOffset:t,className:Se("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 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));sfe.displayName=PF.displayName;const Fdt="sidebar_state",Bdt=3600*24*7,jdt="16rem",$dt="18rem",Udt="3rem",Hdt="b",afe=v.createContext(null);function t1(){const e=v.useContext(afe);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const lfe=v.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:o,...s},a)=>{const l=BT(),[c,u]=v.useState(!1),[f,h]=v.useState(e),g=t??f,y=v.useCallback(T=>{const A=typeof T=="function"?T(g):T;n?n(A):h(A),document.cookie=`${Fdt}=${A}; path=/; max-age=${Bdt}`},[n,g]),E=v.useCallback(()=>l?u(T=>!T):y(T=>!T),[l,y,u]);v.useEffect(()=>{const T=A=>{A.key===Hdt&&(A.metaKey||A.ctrlKey)&&(A.preventDefault(),E())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[E]);const S=g?"expanded":"collapsed",w=v.useMemo(()=>({state:S,open:g,setOpen:y,isMobile:l,openMobile:c,setOpenMobile:u,toggleSidebar:E}),[S,g,y,l,c,u,E]);return m.jsx(afe.Provider,{value:w,children:m.jsx(Mdt,{delayDuration:0,children:m.jsx("div",{style:{"--sidebar-width":jdt,"--sidebar-width-icon":Udt,...i},className:Se("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:a,...s,children:o})})})});lfe.displayName="SidebarProvider";const cfe=v.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,...o},s)=>{const{isMobile:a,state:l,openMobile:c,setOpenMobile:u}=t1();return n==="none"?m.jsx("div",{className:Se("flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground",r),ref:s,...o,children:i}):a?m.jsx(RO,{open:c,onOpenChange:u,...o,children:m.jsxs(Iw,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":$dt},side:e,children:[m.jsxs(DO,{className:"sr-only",children:[m.jsx(IO,{children:"Sidebar"}),m.jsx(RZ,{children:"Displays the mobile sidebar."})]}),m.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):m.jsxs("div",{ref:s,className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":t,"data-side":e,children:[m.jsx("div",{className:Se("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),m.jsx("div",{className:Se("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:m.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:i})})]})});cfe.displayName="Sidebar";const ufe=v.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:i}=t1();return m.jsxs($e,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Se("h-7 w-7",e),onClick:o=>{t?.(o),i()},...n,children:[m.jsx(Ige,{}),m.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});ufe.displayName="SidebarTrigger";const dfe=v.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=t1();return m.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:Se("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});dfe.displayName="SidebarRail";const zdt=v.forwardRef(({className:e,...t},n)=>m.jsx("main",{ref:n,className:Se("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));zdt.displayName="SidebarInset";const Vdt=v.forwardRef(({className:e,...t},n)=>m.jsx(qr,{ref:n,"data-sidebar":"input",className:Se("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Vdt.displayName="SidebarInput";const ffe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"header",className:Se("flex flex-col gap-2 p-2",e),...t}));ffe.displayName="SidebarHeader";const pfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"footer",className:Se("flex flex-col gap-2 p-2",e),...t}));pfe.displayName="SidebarFooter";const Gdt=v.forwardRef(({className:e,...t},n)=>m.jsx(j0,{ref:n,"data-sidebar":"separator",className:Se("mx-2 w-auto bg-sidebar-border",e),...t}));Gdt.displayName="SidebarSeparator";const hfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"content",className:Se("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));hfe.displayName="SidebarContent";const mfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group",className:Se("relative flex w-full min-w-0 flex-col p-2",e),...t}));mfe.displayName="SidebarGroup";const gfe=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Hu:"div";return m.jsx(i,{ref:r,"data-sidebar":"group-label",className:Se("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});gfe.displayName="SidebarGroupLabel";const qdt=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Hu:"button";return m.jsx(i,{ref:r,"data-sidebar":"group-action",className:Se("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});qdt.displayName="SidebarGroupAction";const bfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group-content",className:Se("w-full text-sm",e),...t}));bfe.displayName="SidebarGroupContent";const oE=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu",className:Se("flex w-full min-w-0 flex-col gap-1",e),...t}));oE.displayName="SidebarMenu";const sE=v.forwardRef(({className:e,...t},n)=>m.jsx("li",{ref:n,"data-sidebar":"menu-item",className:Se("group/menu-item relative",e),...t}));sE.displayName="SidebarMenuItem";const Wdt=cc("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),aE=v.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:o,...s},a)=>{const l=e?Hu:"button",{isMobile:c,state:u}=t1(),f=m.jsx(l,{ref:a,"data-sidebar":"menu-button","data-size":r,"data-active":t,className:Se(Wdt({variant:n,size:r}),o),...s});return i?(typeof i=="string"&&(i={children:i}),m.jsxs(Ldt,{children:[m.jsx(Pdt,{asChild:!0,children:f}),m.jsx(sfe,{side:"right",align:"center",hidden:u!=="collapsed"||c,...i})]})):f});aE.displayName="SidebarMenuButton";const Ydt=v.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>{const o=t?Hu:"button";return m.jsx(o,{ref:i,"data-sidebar":"menu-action",className:Se("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...r})});Ydt.displayName="SidebarMenuAction";const Kdt=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:Se("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));Kdt.displayName="SidebarMenuBadge";const Xdt=v.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const i=v.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return m.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:Se("flex h-8 items-center gap-2 rounded-md px-2",e),...n,children:[t&&m.jsx(PW,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),m.jsx(PW,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":i}})]})});Xdt.displayName="SidebarMenuSkeleton";const Zdt=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:Se("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));Zdt.displayName="SidebarMenuSub";const Qdt=v.forwardRef(({...e},t)=>m.jsx("li",{ref:t,...e}));Qdt.displayName="SidebarMenuSubItem";const Jdt=v.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:r,...i},o)=>{const s=e?Hu:"a";return m.jsx(s,{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:Se("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...i})});Jdt.displayName="SidebarMenuSubButton";const eft=[{id:"kanban",label:"Kanban",icon:yge,href:"#/"},{id:"tasks",label:"Tasks",icon:tK,href:"#/tasks"},{id:"docs",label:"Docs",icon:Xo,href:"#/docs"}];function tft({currentPage:e,onSearchClick:t}){const{state:n}=t1(),r=BT(),i=n==="expanded";return m.jsxs(cfe,{collapsible:"icon",variant:r?"floating":"sidebar",children:[m.jsxs(ffe,{children:[m.jsx(oE,{children:m.jsx(sE,{children:m.jsx(aE,{size:"lg",asChild:!0,children:m.jsxs("a",{href:"#/",children:[m.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:m.jsx("span",{className:"text-lg font-bold",children:"◆"})}),m.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[m.jsx("span",{className:"truncate font-semibold",children:"Knowns.dev"}),m.jsx("span",{className:"truncate text-xs",children:"Task Management"})]})]})})})}),i&&m.jsx("div",{className:"px-2 pb-2",children:m.jsxs("button",{type:"button",onClick:t,className:"flex w-full items-center gap-2 rounded-lg border bg-background px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[m.jsx(Ew,{className:"h-4 w-4"}),m.jsx("span",{children:"Search..."}),m.jsxs("kbd",{className:"ml-auto pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",children:[m.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]})})]}),m.jsx(hfe,{children:m.jsxs(mfe,{children:[m.jsx(gfe,{children:"Navigation"}),m.jsx(bfe,{children:m.jsx(oE,{children:eft.map(o=>{const s=e===o.id;return m.jsx(sE,{children:m.jsx(aE,{asChild:!0,isActive:s,tooltip:o.label,children:m.jsxs("a",{href:o.href,children:[m.jsx(o.icon,{}),m.jsx("span",{children:o.label})]})})},o.id)})})})]})}),m.jsxs(pfe,{children:[m.jsx(oE,{children:m.jsx(sE,{children:m.jsx(aE,{asChild:!0,isActive:e==="config",tooltip:"Settings",children:m.jsxs("a",{href:"#/config",children:[m.jsx(HI,{}),m.jsx("span",{children:"Settings"})]})})})}),i&&m.jsx("div",{className:"px-3 py-2 text-xs text-sidebar-foreground/50",children:m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("a",{href:"https://github.com/knowns-dev/knowns",target:"_blank",rel:"noopener noreferrer",className:"hover:text-sidebar-foreground transition-colors",children:"Knowns"}),m.jsx("span",{className:"font-mono",children:"0.8.6"})]})})]}),m.jsx(dfe,{})]})}const nft=[{value:"all",label:"All"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"content",label:"Content"}];function rft(e){const t=e.changes;if(t.length===0)return"Updated";const n=t.find(s=>s.field==="status");if(n){const s=String(n.newValue);return s==="done"?"Completed":s==="in-progress"?"Started working on":s==="in-review"?"Submitted for review":s==="blocked"?"Blocked":`Changed status to ${s}`}const r=t.find(s=>s.field==="assignee");if(r){const s=r.newValue;return s?`Assigned to ${s}`:"Unassigned"}if(t.find(s=>s.field==="title"))return"Updated title";const o=t.find(s=>s.field==="priority");return o?`Set priority to ${o.newValue}`:t.some(s=>s.field==="description")?"Updated description":t.some(s=>s.field==="acceptanceCriteria")?"Updated acceptance criteria":t.some(s=>s.field==="implementationPlan")?"Updated plan":t.some(s=>s.field==="implementationNotes")?"Updated notes":t.some(s=>s.field==="labels")?"Updated labels":`Updated ${t.length} field(s)`}function ift(e){const n=new Date().getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return r<1?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:o<7?`${o}d ago`:e.toLocaleDateString()}function oft(e){return e.some(t=>t.field==="status"&&t.newValue==="done")?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":e.some(t=>t.field==="status"&&t.newValue==="in-progress")?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":e.some(t=>t.field==="status"&&t.newValue==="blocked")?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":e.some(t=>t.field==="assignee")?"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400":"bg-muted text-muted-foreground"}function sft({limit:e=20,showFilter:t=!0,onTaskClick:n}){const[r,i]=v.useState([]),[o,s]=v.useState(!0),[a,l]=v.useState("all"),[c,u]=v.useState(!1),f=v.useCallback(async()=>{try{const y=a==="all"?void 0:a,E=await ua.getActivities({limit:e,type:y});i(E)}catch(y){console.error("Failed to load activities:",y)}finally{s(!1),u(!1)}},[e,a]);v.useEffect(()=>{f()},[f]),xu("tasks:updated",()=>{f()},[f]);const h=()=>{u(!0),f()},g=y=>{n?n(y):window.location.hash=`/kanban/${y}`};return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(x9,{className:"w-5 h-5"}),m.jsx("h3",{className:"font-semibold",children:"Recent Activity"})]}),m.jsx($e,{variant:"ghost",size:"icon",onClick:h,disabled:c,className:"h-8 w-8",children:m.jsx(UI,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]}),t&&m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx($I,{className:"w-4 h-4 text-muted-foreground"}),m.jsx("select",{value:a,onChange:y=>l(y.target.value),className:"text-sm rounded px-2 py-1 bg-card border flex-1",children:nft.map(y=>m.jsx("option",{value:y.value,children:y.label},y.value))})]}),m.jsx(Xi,{className:"flex-1",children:m.jsx("div",{className:"space-y-1.5 pr-3",children:o?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"Loading activities..."}):r.length===0?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"No recent activity"}):r.map((y,E)=>m.jsx("div",{role:"button",tabIndex:0,onClick:S=>{S.preventDefault(),S.stopPropagation(),g(y.taskId)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),g(y.taskId))},className:"w-full bg-card rounded p-2 text-left hover:bg-accent transition-colors border cursor-pointer select-none",children:m.jsxs("div",{className:"flex items-center gap-2",children:[y.author?m.jsx($0,{name:y.author,size:"xs"}):m.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center shrink-0 ${oft(y.changes)}`,children:m.jsx(x9,{className:"w-2.5 h-2.5"})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-xs font-medium truncate",children:rft(y)}),m.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:ift(y.timestamp)})]}),m.jsxs("div",{className:"text-[11px] text-muted-foreground truncate",children:[m.jsxs("span",{className:"font-medium",children:["#",y.taskId]})," ",y.taskTitle]})]})]})},`${y.taskId}-${y.version}-${E}`))})})]})}function aft(){const[e,t]=v.useState(!1),[n,r]=v.useState(!1),[i,o]=v.useState(()=>{const l=localStorage.getItem("knowns-last-activity-check");return l?new Date(l):new Date}),s=v.useCallback(async()=>{try{const l=await ua.getActivities({limit:1});l.length>0&&new Date(l[0].timestamp)>i&&t(!0)}catch(l){console.error("Failed to check activities:",l)}},[i]);v.useEffect(()=>{s()},[s]),xu("tasks:updated",()=>{n||t(!0)},[n]);const a=l=>{if(r(l),l){t(!1);const c=new Date;o(c),localStorage.setItem("knowns-last-activity-check",c.toISOString())}};return m.jsxs(L0,{open:n,onOpenChange:a,children:[m.jsx(P0,{asChild:!0,children:m.jsxs($e,{variant:"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Notifications",children:[m.jsx(Nme,{className:"h-4 w-4"}),e&&m.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-blue-500 animate-pulse"})]})}),m.jsx(Vh,{className:"w-80 p-0",align:"end",sideOffset:8,children:m.jsxs("div",{className:"flex flex-col h-[400px]",children:[m.jsx("div",{className:"px-4 py-3 border-b",children:m.jsx("h3",{className:"font-semibold text-sm",children:"Recent Activity"})}),m.jsx("div",{className:"flex-1 overflow-hidden p-2",children:m.jsx(sft,{limit:20,showFilter:!1,onTaskClick:l=>{r(!1),window.location.hash=`/kanban/${l}`}})})]})})]})}const PY={todo:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300","in-progress":"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300","in-review":"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",done:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",blocked:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300","on-hold":"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300"},lft={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function cft({open:e,onOpenChange:t,onTaskSelect:n,onDocSelect:r}){const[i,o]=v.useState(""),[s,a]=v.useState({tasks:[],docs:[]}),[l,c]=v.useState(!1);v.useEffect(()=>{if(!e){o(""),a({tasks:[],docs:[]});return}if(!i.trim()){a({tasks:[],docs:[]});return}c(!0);const h=setTimeout(()=>{fetch(`/api/search?q=${encodeURIComponent(i)}`).then(g=>g.json()).then(g=>{a({tasks:g.tasks||[],docs:g.docs||[]})}).catch(g=>{console.error("Search failed:",g),a({tasks:[],docs:[]})}).finally(()=>{c(!1)})},300);return()=>clearTimeout(h)},[i,e]);const u=h=>{n(h),t(!1),o("")},f=h=>{r(h),t(!1),o("")};return m.jsx(OO,{open:e,onOpenChange:t,children:m.jsx(Ow,{className:"overflow-hidden p-0 max-w-2xl",hideClose:!0,children:m.jsxs(Gh,{shouldFilter:!1,children:[m.jsx(qh,{placeholder:"Search tasks and docs...",value:i,onValueChange:o}),m.jsxs(Wh,{children:[m.jsx(Yh,{children:l?"Searching...":i?"No results found.":"Type to search..."}),s.tasks.length>0&&m.jsx(Ja,{heading:"Tasks",children:s.tasks.slice(0,8).map(h=>{const g=PY[h.status]||PY.todo,y=lft[h.status]||h.status;return m.jsxs(Ko,{value:`task-${h.id}`,onSelect:()=>u(h),children:[m.jsx(tK,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",h.id]}),m.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${g}`,children:y})]}),m.jsx("div",{className:"font-medium truncate",children:h.title})]})]},h.id)})}),s.tasks.length>0&&s.docs.length>0&&m.jsx(sw,{}),s.docs.length>0&&m.jsx(Ja,{heading:"Documentation",children:s.docs.slice(0,8).map(h=>{const g=h.metadata?.title||h.filename;return m.jsxs(Ko,{value:`doc-${h.path}`,onSelect:()=>f(h),children:[m.jsx(Xo,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"font-medium truncate mb-1",children:g}),m.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:m.jsx("span",{className:"truncate",children:h.path})})]})]},h.path)})})]})]})})})}const yfe={description:{begin:"<!-- SECTION:DESCRIPTION:BEGIN -->",end:"<!-- SECTION:DESCRIPTION:END -->"},plan:{begin:"<!-- SECTION:PLAN:BEGIN -->",end:"<!-- SECTION:PLAN:END -->"},notes:{begin:"<!-- SECTION:NOTES:BEGIN -->",end:"<!-- SECTION:NOTES:END -->"},ac:{begin:"<!-- AC:BEGIN -->",end:"<!-- AC:END -->"}};function uft(e,t){const n=yfe[t];if(!n)return e;const r=e.indexOf(n.begin),i=e.indexOf(n.end);return r===-1||i===-1?e:e.substring(r+n.begin.length,i).trim()}function dft(e,t){const n=yfe[t];return n?e.includes(n.begin)&&e.includes(n.end):!1}function fft(e){return e.replace(/<!--[\s\S]*?-->/g,"")}function pft(e,t){return e?t&&dft(e,t)?uft(e,t):e:""}const hft="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-green-100/50 border border-green-500/30 text-green-700 hover:bg-green-100 hover:border-green-500/50 dark:bg-green-900/20 dark:text-green-300 dark:hover:bg-green-900/30",mft="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-blue-100/50 border border-blue-500/30 text-blue-700 hover:bg-blue-100 hover:border-blue-500/50 dark:bg-blue-900/20 dark:text-blue-300 dark:hover:bg-blue-900/30",gft=v.forwardRef(({markdown:e,className:t="",sectionType:n,enableGFM:r=!0,onDocLinkClick:i},o)=>{if(!e)return null;const s=fft(pft(e,n)),a=({href:l,children:c})=>{if(l&&/^(task-)?\d+(\.\d+)?(\.md)?$/.test(l)){const u=l.replace(/^task-/,"").replace(/\.md$/,""),f=`#/tasks/${u}`;return m.jsxs("a",{href:f,className:hft,"data-task-id":u,children:[m.jsx(gf,{className:"w-4 h-4 shrink-0"}),c]})}if(l&&(l.endsWith(".md")||l.includes(".md#"))){const u=l.replace(/^\.\//,""),f=`#/docs/${u}`;return m.jsxs("a",{href:f,className:mft,"data-doc-path":u,onClick:h=>{i&&(h.preventDefault(),i(u))},children:[m.jsx(Xo,{className:"w-4 h-4 shrink-0"}),c]})}return m.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-600 underline",children:c})};return m.jsx("div",{ref:o,className:`prose prose-sm max-w-none dark:prose-invert ${t}`,children:m.jsx(eee,{remarkPlugins:r?[gC]:[],components:{a,code:({className:l,children:c,...u})=>l?m.jsx("code",{className:l,...u,children:c}):m.jsx("code",{className:"px-1.5 py-0.5 rounded text-sm bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200",...u,children:c}),pre:({children:l})=>m.jsx("pre",{className:"overflow-x-auto rounded-lg p-4 text-sm bg-gray-100 dark:bg-gray-900",children:l}),table:({children:l})=>m.jsx("div",{className:"overflow-x-auto my-4",children:m.jsx("table",{className:"min-w-full border-collapse",children:l})}),th:({children:l})=>m.jsx("th",{className:"px-4 py-2 text-left font-semibold border bg-gray-100 text-gray-900 border-gray-200 dark:bg-gray-700 dark:text-gray-100 dark:border-gray-600",children:l}),td:({children:l})=>m.jsx("td",{className:"px-4 py-2 border border-gray-200 text-gray-700 dark:border-gray-600 dark:text-gray-200",children:l}),input:({type:l,checked:c,...u})=>l==="checkbox"?m.jsx("input",{type:"checkbox",checked:c,readOnly:!0,className:"mr-2 accent-blue-600",...u}):m.jsx("input",{type:l,...u})},children:s})})});gft.displayName="MarkdownRenderer";function pu(e,t){return typeof e=="function"?e(t):e}function rs(e,t){return n=>{t.setState(r=>({...r,[e]:pu(n,r[e])}))}}function jT(e){return e instanceof Function}function bft(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function yft(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const s=t(o);s!=null&&s.length&&r(s)})};return r(e),n}function ut(e,t,n){let r=[],i;return o=>{let s;n.key&&n.debug&&(s=Date.now());const a=e(o);if(!(a.length!==r.length||a.some((u,f)=>r[f]!==u)))return i;r=a;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...a),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-s)*100)/100,f=Math.round((Date.now()-c)*100)/100,h=f/16,g=(y,E)=>{for(y=String(y);y.length<E;)y=" "+y;return y};console.info(`%c⏱ ${g(f,5)} /${g(u,5)} ms`,`
314
+ `},Uct={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Hct(e){let{announcements:t=Uct,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=$ct}=e;const{announce:o,announcement:s}=Fct(),a=Jy("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),Bct(v.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const u=pe.createElement(pe.Fragment,null,pe.createElement(Lct,{id:r,value:i.draggable}),pe.createElement(Pct,{id:a,announcement:s}));return n?Wr.createPortal(u,n):u}var Vr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Vr||(Vr={}));function yw(){}function R_(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function zct(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const wa=Object.freeze({x:0,y:0});function sB(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vct(e,t){const n=bw(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function aB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Gct(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _I(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function qct(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function hY(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Wct=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=hY(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=sB(hY(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(aB)},mY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=_I(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=_I(l),u=i.reduce((h,g,y)=>h+sB(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(aB)};function Yct(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const Ode=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=Yct(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Gct)};function Kct(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const Xct=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&Kct(r,a)){const c=_I(a).reduce((f,h)=>f+sB(r,h),0),u=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:u}})}}return i.sort(aB)};function Zct(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Mde(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wa}function Qct(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Jct=Qct(1);function Lde(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function eut(e,t,n){const r=Lde(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const tut={ignoreTransform:!1};function Lm(e,t){t===void 0&&(t=tut);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=oo(e).getComputedStyle(e);c&&(n=eut(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function gY(e){return Lm(e,{ignoreTransform:!0})}function nut(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function rut(e,t){return t===void 0&&(t=oo(e).getComputedStyle(e)),t.position==="fixed"}function iut(e,t){t===void 0&&(t=oo(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function lB(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(oB(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Zy(i)||Rde(i)||n.includes(i))return n;const o=oo(e).getComputedStyle(i);return i!==e&&iut(i,o)&&n.push(i),rut(i,o)?n:r(i.parentNode)}return e?r(e):n}function Pde(e){const[t]=lB(e,1);return t??null}function D_(e){return!OT||!e?null:Om(e)?e:iB(e)?oB(e)||e===Mm(e).scrollingElement?window:Zy(e)?e:null:null}function Fde(e){return Om(e)?e.scrollX:e.scrollLeft}function Bde(e){return Om(e)?e.scrollY:e.scrollTop}function RI(e){return{x:Fde(e),y:Bde(e)}}var ni;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ni||(ni={}));function jde(e){return!OT||!e?!1:e===document.scrollingElement}function $de(e){const t={x:0,y:0},n=jde(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const out={x:.2,y:.2};function sut(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=out);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=$de(e),g={x:0,y:0},y={x:0,y:0},E={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+E.height?(g.y=ni.Backward,y.y=r*Math.abs((t.top+E.height-o)/E.height)):!u&&l>=t.bottom-E.height&&(g.y=ni.Forward,y.y=r*Math.abs((t.bottom-E.height-l)/E.height)),!h&&a>=t.right-E.width?(g.x=ni.Forward,y.x=r*Math.abs((t.right-E.width-a)/E.width)):!f&&s<=t.left+E.width&&(g.x=ni.Backward,y.x=r*Math.abs((t.left+E.width-s)/E.width)),{direction:g,speed:y}}function aut(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ude(e){return e.reduce((t,n)=>bh(t,RI(n)),wa)}function lut(e){return e.reduce((t,n)=>t+Fde(n),0)}function cut(e){return e.reduce((t,n)=>t+Bde(n),0)}function Hde(e,t){if(t===void 0&&(t=Lm),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Pde(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const uut=[["x",["left","right"],lut],["y",["top","bottom"],cut]];class cB{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=lB(n),i=Ude(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of uut)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pb{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function dut(e){const{EventTarget:t}=oo(e);return e instanceof t?e:Mm(e)}function I_(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Ts;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ts||(Ts={}));function bY(e){e.preventDefault()}function fut(e){e.stopPropagation()}var bn;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(bn||(bn={}));const zde={start:[bn.Space,bn.Enter],cancel:[bn.Esc],end:[bn.Space,bn.Enter,bn.Tab]},put=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case bn.Right:return{...n,x:n.x+25};case bn.Left:return{...n,x:n.x-25};case bn.Down:return{...n,y:n.y+25};case bn.Up:return{...n,y:n.y-25}}};class uB{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Pb(Mm(n)),this.windowListeners=new Pb(oo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ts.Resize,this.handleCancel),this.windowListeners.add(Ts.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ts.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Hde(r),n(wa)}handleKeyDown(t){if(LT(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=zde,coordinateGetter:s=put,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:wa;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=gw(f,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const E of y){const S=t.code,{isTop:w,isRight:T,isLeft:A,isBottom:R,maxScroll:_,minScroll:D}=$de(E),I=aut(E),M={x:Math.min(S===bn.Right?I.right-I.width/2:I.right,Math.max(S===bn.Right?I.left:I.left+I.width/2,f.x)),y:Math.min(S===bn.Down?I.bottom-I.height/2:I.bottom,Math.max(S===bn.Down?I.top:I.top+I.height/2,f.y))},j=S===bn.Right&&!T||S===bn.Left&&!A,L=S===bn.Down&&!R||S===bn.Up&&!w;if(j&&M.x!==f.x){const F=E.scrollLeft+h.x,H=S===bn.Right&&F<=_.x||S===bn.Left&&F>=D.x;if(H&&!h.y){E.scrollTo({left:F,behavior:a});return}H?g.x=E.scrollLeft-F:g.x=S===bn.Right?E.scrollLeft-_.x:E.scrollLeft-D.x,g.x&&E.scrollBy({left:-g.x,behavior:a});break}else if(L&&M.y!==f.y){const F=E.scrollTop+h.y,H=S===bn.Down&&F<=_.y||S===bn.Up&&F>=D.y;if(H&&!h.x){E.scrollTo({top:F,behavior:a});return}H?g.y=E.scrollTop-F:g.y=S===bn.Down?E.scrollTop-_.y:E.scrollTop-D.y,g.y&&E.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,bh(gw(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}uB.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=zde,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function yY(e){return!!(e&&"distance"in e)}function vY(e){return!!(e&&"delay"in e)}class dB{constructor(t,n,r){var i;r===void 0&&(r=dut(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=Mm(s),this.documentListeners=new Pb(this.document),this.listeners=new Pb(r),this.windowListeners=new Pb(oo(s)),this.initialCoordinates=(i=bw(o))!=null?i:wa,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ts.Resize,this.handleCancel),this.windowListeners.add(Ts.DragStart,bY),this.windowListeners.add(Ts.VisibilityChange,this.handleCancel),this.windowListeners.add(Ts.ContextMenu,bY),this.documentListeners.add(Ts.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(vY(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(yY(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ts.Click,fut,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ts.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=bw(t))!=null?n:wa,c=gw(i,l);if(!r&&a){if(yY(a)){if(a.tolerance!=null&&I_(c,a.tolerance))return this.handleCancel();if(I_(c,a.distance))return this.handleStart()}if(vY(a)&&I_(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===bn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const hut={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vde extends dB{constructor(t){const{event:n}=t,r=Mm(n.target);super(t,hut,r)}}Vde.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const mut={move:{name:"mousemove"},end:{name:"mouseup"}};var DI;(function(e){e[e.RightClick=2]="RightClick"})(DI||(DI={}));class Gde extends dB{constructor(t){super(t,mut,Mm(t.event.target))}}Gde.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===DI.RightClick?!1:(r?.({event:n}),!0)}}];const O_={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class qde extends dB{constructor(t){super(t,O_)}static setup(){return window.addEventListener(O_.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(O_.move.name,t)};function t(){}}}qde.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Fb;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Fb||(Fb={}));var vw;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(vw||(vw={}));function gut(e){let{acceleration:t,activator:n=Fb.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=vw.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const g=yut({delta:f,disabled:!o}),[y,E]=Rct(),S=v.useRef({x:0,y:0}),w=v.useRef({x:0,y:0}),T=v.useMemo(()=>{switch(n){case Fb.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Fb.DraggableRect:return i}},[n,i,l]),A=v.useRef(null),R=v.useCallback(()=>{const D=A.current;if(!D)return;const I=S.current.x*w.current.x,M=S.current.y*w.current.y;D.scrollBy(I,M)},[]),_=v.useMemo(()=>a===vw.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!T){E();return}for(const D of _){if(r?.(D)===!1)continue;const I=c.indexOf(D),M=u[I];if(!M)continue;const{direction:j,speed:L}=sut(D,M,T,t,h);for(const F of["x","y"])g[F][j[F]]||(L[F]=0,j[F]=0);if(L.x>0||L.y>0){E(),A.current=D,y(R,s),S.current=L,w.current=j;return}}S.current={x:0,y:0},w.current={x:0,y:0},E()},[t,R,r,E,o,s,JSON.stringify(T),JSON.stringify(g),y,c,_,u,JSON.stringify(h)])}const but={x:{[ni.Backward]:!1,[ni.Forward]:!1},y:{[ni.Backward]:!1,[ni.Forward]:!1}};function yut(e){let{delta:t,disabled:n}=e;const r=mw(t);return Qy(i=>{if(n||!r||!i)return but;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ni.Backward]:i.x[ni.Backward]||o.x===-1,[ni.Forward]:i.x[ni.Forward]||o.x===1},y:{[ni.Backward]:i.y[ni.Backward]||o.y===-1,[ni.Forward]:i.y[ni.Forward]||o.y===1}}},[n,t,r])}function vut(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Qy(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function xut(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var V0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(V0||(V0={}));var II;(function(e){e.Optimized="optimized"})(II||(II={}));const xY=new Map;function Eut(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=v.useState(null),{frequency:a,measure:l,strategy:c}=i,u=v.useRef(e),f=S(),h=z0(f),g=v.useCallback(function(w){w===void 0&&(w=[]),!h.current&&s(T=>T===null?w:T.concat(w.filter(A=>!T.includes(A))))},[h]),y=v.useRef(null),E=Qy(w=>{if(f&&!n)return xY;if(!w||w===xY||u.current!==e||o!=null){const T=new Map;for(let A of e){if(!A)continue;if(o&&o.length>0&&!o.includes(A.id)&&A.rect.current){T.set(A.id,A.rect.current);continue}const R=A.node.current,_=R?new cB(l(R),R):null;A.rect.current=_,_&&T.set(A.id,_)}return T}return w},[e,o,n,f,l]);return v.useEffect(()=>{u.current=e},[e]),v.useEffect(()=>{f||g()},[n,f]),v.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),v.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:E,measureDroppableContainers:g,measuringScheduled:o!=null};function S(){switch(c){case V0.Always:return!1;case V0.BeforeDragging:return n;default:return!n}}}function fB(e,t){return Qy(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Sut(e,t){return fB(e,t)}function wut(e){let{callback:t,disabled:n}=e;const r=MT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function PT(e){let{callback:t,disabled:n}=e;const r=MT(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>i?.disconnect(),[i]),i}function Cut(e){return new cB(Lm(e),e)}function EY(e,t,n){t===void 0&&(t=Cut);const[r,i]=v.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=wut({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=PT({callback:o});return Sa(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Tut(e){const t=fB(e);return Mde(e,t)}const SY=[];function kut(e){const t=v.useRef(e),n=Qy(r=>e?r&&r!==SY&&e&&t.current&&e.parentNode===t.current.parentNode?r:lB(e):SY,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function Aut(e){const[t,n]=v.useState(null),r=v.useRef(e),i=v.useCallback(o=>{const s=D_(o.target);s&&n(a=>a?(a.set(s,RI(s)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=D_(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,RI(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=D_(l);c?.removeEventListener("scroll",i)})}},[i,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>bh(o,s),wa):Ude(e):wa,[e,t])}function wY(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==wa;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?gw(e,n.current):wa}function Nut(e){v.useEffect(()=>{if(!OT)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function _ut(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function Wde(e){return v.useMemo(()=>e?nut(e):null,[e])}const CY=[];function Rut(e,t){t===void 0&&(t=Lm);const[n]=e,r=Wde(n?oo(n):null),[i,o]=v.useState(CY);function s(){o(()=>e.length?e.map(l=>jde(l)?r:new cB(t(l),l)):CY)}const a=PT({callback:s});return Sa(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Yde(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zy(t)?t:e}function Dut(e){let{measure:t}=e;const[n,r]=v.useState(null),i=v.useCallback(c=>{for(const{target:u}of c)if(Zy(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=PT({callback:i}),s=v.useCallback(c=>{const u=Yde(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=hw(s);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Iut=[{sensor:Vde,options:{}},{sensor:uB,options:{}}],Out={current:{}},iE={draggable:{measure:gY},droppable:{measure:gY,strategy:V0.WhileDragging,frequency:II.Optimized},dragOverlay:{measure:Lm}};class Bb extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Mut={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bb,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yw},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:iE,measureDroppableContainers:yw,windowRect:null,measuringScheduled:!1},Kde={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yw,draggableNodes:new Map,over:null,measureDroppableContainers:yw},e1=v.createContext(Kde),Xde=v.createContext(Mut);function Lut(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bb}}}function Put(e,t){switch(t.type){case Vr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vr.DragEnd:case Vr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Bb(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Vr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Bb(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Vr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Bb(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Fut(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=v.useContext(e1),o=mw(r),s=mw(n?.id);return v.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!LT(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Oct(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function Zde(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function But(e){return v.useMemo(()=>({draggable:{...iE.draggable,...e?.draggable},droppable:{...iE.droppable,...e?.droppable},dragOverlay:{...iE.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function jut(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=v.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Sa(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=Mde(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=Pde(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const FT=v.createContext({...wa,scaleX:1,scaleY:1});var Qc;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Qc||(Qc={}));const $ut=v.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Iut,collisionDetection:f=Ode,measuring:h,modifiers:g,...y}=t;const E=v.useReducer(Put,void 0,Lut),[S,w]=E,[T,A]=jct(),[R,_]=v.useState(Qc.Uninitialized),D=R===Qc.Initialized,{draggable:{active:I,nodes:M,translate:j},droppable:{containers:L}}=S,F=I!=null?M.get(I):null,H=v.useRef({initial:null,translated:null}),Y=v.useMemo(()=>{var en;return I!=null?{id:I,data:(en=F?.data)!=null?en:Out,rect:H}:null},[I,F]),$=v.useRef(null),[G,V]=v.useState(null),[X,Q]=v.useState(null),J=z0(y,Object.values(y)),B=Jy("DndDescribedBy",s),W=v.useMemo(()=>L.getEnabled(),[L]),K=But(h),{droppableRects:P,measureDroppableContainers:ce,measuringScheduled:le}=Eut(W,{dragging:D,dependencies:[j.x,j.y],config:K.droppable}),se=vut(M,I),te=v.useMemo(()=>X?bw(X):null,[X]),oe=di(),ue=Sut(se,K.draggable.measure);jut({activeNode:I!=null?M.get(I):null,config:oe.layoutShiftCompensation,initialRect:ue,measure:K.draggable.measure});const Te=EY(se,K.draggable.measure,ue),Ie=EY(se?se.parentElement:null),ke=v.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=L.getNodeFor((n=ke.current.over)==null?void 0:n.id),rt=Dut({measure:K.dragOverlay.measure}),ze=(r=rt.nodeRef.current)!=null?r:se,dn=D?(i=rt.rect)!=null?i:Te:null,nt=!!(rt.nodeRef.current&&rt.rect),Vn=Tut(nt?null:Te),$t=Wde(ze?oo(ze):null),xt=kut(D?tt??se:null),re=Rut(xt),de=Zde(g,{transform:{x:j.x-Vn.x,y:j.y-Vn.y,scaleX:1,scaleY:1},activatorEvent:X,active:Y,activeNodeRect:Te,containerNodeRect:Ie,draggingNodeRect:dn,over:ke.current.over,overlayNodeRect:rt.rect,scrollableAncestors:xt,scrollableAncestorRects:re,windowRect:$t}),ye=te?bh(te,j):null,Me=Aut(xt),Fe=wY(Me),q=wY(Me,[Te]),ge=bh(de,Fe),De=dn?Jct(dn,de):null,He=Y&&De?f({active:Y,collisionRect:De,droppableRects:P,droppableContainers:W,pointerCoordinates:ye}):null,ot=qct(He,"id"),[an,fn]=v.useState(null),Dn=nt?de:bh(de,q),vn=Zct(Dn,(o=an?.rect)!=null?o:null,Te),xn=v.useRef(null),Ae=v.useCallback((en,tn)=>{let{sensor:Ve,options:qt}=tn;if($.current==null)return;const yt=M.get($.current);if(!yt)return;const Mt=en.nativeEvent,Gn=new Ve({active:$.current,activeNode:yt,event:Mt,options:qt,context:ke,onAbort(Zt){if(!M.get(Zt))return;const{onDragAbort:Tn}=J.current,Jn={id:Zt};Tn?.(Jn),T({type:"onDragAbort",event:Jn})},onPending(Zt,Qn,Tn,Jn){if(!M.get(Zt))return;const{onDragPending:fi}=J.current,ls={id:Zt,constraint:Qn,initialCoordinates:Tn,offset:Jn};fi?.(ls),T({type:"onDragPending",event:ls})},onStart(Zt){const Qn=$.current;if(Qn==null)return;const Tn=M.get(Qn);if(!Tn)return;const{onDragStart:Jn}=J.current,as={activatorEvent:Mt,active:{id:Qn,data:Tn.data,rect:H}};Wr.unstable_batchedUpdates(()=>{Jn?.(as),_(Qc.Initializing),w({type:Vr.DragStart,initialCoordinates:Zt,active:Qn}),T({type:"onDragStart",event:as}),V(xn.current),Q(Mt)})},onMove(Zt){w({type:Vr.DragMove,coordinates:Zt})},onEnd:Xt(Vr.DragEnd),onCancel:Xt(Vr.DragCancel)});xn.current=Gn;function Xt(Zt){return async function(){const{active:Tn,collisions:Jn,over:as,scrollAdjustedTranslate:fi}=ke.current;let ls=null;if(Tn&&fi){const{cancelDrop:pc}=J.current;ls={activatorEvent:Mt,active:Tn,collisions:Jn,delta:fi,over:as},Zt===Vr.DragEnd&&typeof pc=="function"&&await Promise.resolve(pc(ls))&&(Zt=Vr.DragCancel)}$.current=null,Wr.unstable_batchedUpdates(()=>{w({type:Zt}),_(Qc.Uninitialized),fn(null),V(null),Q(null),xn.current=null;const pc=Zt===Vr.DragEnd?"onDragEnd":"onDragCancel";if(ls){const cs=J.current[pc];cs?.(ls),T({type:pc,event:ls})}})}}},[M]),Ge=v.useCallback((en,tn)=>(Ve,qt)=>{const yt=Ve.nativeEvent,Mt=M.get(qt);if($.current!==null||!Mt||yt.dndKit||yt.defaultPrevented)return;const Gn={active:Mt};en(Ve,tn.options,Gn)===!0&&(yt.dndKit={capturedBy:tn.sensor},$.current=qt,Ae(Ve,tn))},[M,Ae]),gt=xut(u,Ge);Nut(u),Sa(()=>{Te&&R===Qc.Initializing&&_(Qc.Initialized)},[Te,R]),v.useEffect(()=>{const{onDragMove:en}=J.current,{active:tn,activatorEvent:Ve,collisions:qt,over:yt}=ke.current;if(!tn||!Ve)return;const Mt={active:tn,activatorEvent:Ve,collisions:qt,delta:{x:ge.x,y:ge.y},over:yt};Wr.unstable_batchedUpdates(()=>{en?.(Mt),T({type:"onDragMove",event:Mt})})},[ge.x,ge.y]),v.useEffect(()=>{const{active:en,activatorEvent:tn,collisions:Ve,droppableContainers:qt,scrollAdjustedTranslate:yt}=ke.current;if(!en||$.current==null||!tn||!yt)return;const{onDragOver:Mt}=J.current,Gn=qt.get(ot),Xt=Gn&&Gn.rect.current?{id:Gn.id,rect:Gn.rect.current,data:Gn.data,disabled:Gn.disabled}:null,Zt={active:en,activatorEvent:tn,collisions:Ve,delta:{x:yt.x,y:yt.y},over:Xt};Wr.unstable_batchedUpdates(()=>{fn(Xt),Mt?.(Zt),T({type:"onDragOver",event:Zt})})},[ot]),Sa(()=>{ke.current={activatorEvent:X,active:Y,activeNode:se,collisionRect:De,collisions:He,droppableRects:P,draggableNodes:M,draggingNode:ze,draggingNodeRect:dn,droppableContainers:L,over:an,scrollableAncestors:xt,scrollAdjustedTranslate:ge},H.current={initial:dn,translated:De}},[Y,se,He,De,M,ze,dn,P,L,an,xt,ge]),gut({...oe,delta:j,draggingRect:De,pointerCoordinates:ye,scrollableAncestors:xt,scrollableAncestorRects:re});const lt=v.useMemo(()=>({active:Y,activeNode:se,activeNodeRect:Te,activatorEvent:X,collisions:He,containerNodeRect:Ie,dragOverlay:rt,draggableNodes:M,droppableContainers:L,droppableRects:P,over:an,measureDroppableContainers:ce,scrollableAncestors:xt,scrollableAncestorRects:re,measuringConfiguration:K,measuringScheduled:le,windowRect:$t}),[Y,se,Te,X,He,Ie,rt,M,L,P,an,ce,xt,re,K,le,$t]),sr=v.useMemo(()=>({activatorEvent:X,activators:gt,active:Y,activeNodeRect:Te,ariaDescribedById:{draggable:B},dispatch:w,draggableNodes:M,over:an,measureDroppableContainers:ce}),[X,gt,Y,Te,w,B,M,an,ce]);return pe.createElement(Ide.Provider,{value:A},pe.createElement(e1.Provider,{value:sr},pe.createElement(Xde.Provider,{value:lt},pe.createElement(FT.Provider,{value:vn},c)),pe.createElement(Fut,{disabled:a?.restoreFocus===!1})),pe.createElement(Hct,{...a,hiddenTextDescribedById:B}));function di(){const en=G?.autoScrollEnabled===!1,tn=typeof l=="object"?l.enabled===!1:l===!1,Ve=D&&!en&&!tn;return typeof l=="object"?{...l,enabled:Ve}:{enabled:Ve}}}),Uut=v.createContext(null),TY="button",Hut="Draggable";function zut(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Jy(Hut),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=v.useContext(e1),{role:g=TY,roleDescription:y="draggable",tabIndex:E=0}=i??{},S=l?.id===t,w=v.useContext(S?FT:Uut),[T,A]=hw(),[R,_]=hw(),D=_ut(s,t),I=z0(n);Sa(()=>(f.set(t,{id:t,key:o,node:T,activatorNode:R,data:I}),()=>{const j=f.get(t);j&&j.key===o&&f.delete(t)}),[f,t]);const M=v.useMemo(()=>({role:g,tabIndex:E,"aria-disabled":r,"aria-pressed":S&&g===TY?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,E,S,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:M,isDragging:S,listeners:r?void 0:D,node:T,over:h,setNodeRef:A,setActivatorNodeRef:_,transform:w}}function Qde(){return v.useContext(Xde)}const Vut="Droppable",Gut={timeout:25};function Jde(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Jy(Vut),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(e1),u=v.useRef({disabled:n}),f=v.useRef(!1),h=v.useRef(null),g=v.useRef(null),{disabled:y,updateMeasurementsFor:E,timeout:S}={...Gut,...i},w=z0(E??r),T=v.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),g.current=null},S)},[S]),A=PT({callback:T,disabled:y||!s}),R=v.useCallback((M,j)=>{A&&(j&&(A.unobserve(j),f.current=!1),M&&A.observe(M))},[A]),[_,D]=hw(R),I=z0(t);return v.useEffect(()=>{!A||!_.current||(A.disconnect(),f.current=!1,A.observe(_.current))},[_,A]),v.useEffect(()=>(a({type:Vr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:_,rect:h,data:I}}),()=>a({type:Vr.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==u.current.disabled&&(a({type:Vr.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:_,over:l,setNodeRef:D}}function qut(e){let{animation:t,children:n}=e;const[r,i]=v.useState(null),[o,s]=v.useState(null),a=mw(n);return!n&&!r&&a&&i(a),Sa(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){i(null);return}Promise.resolve(t(c,o)).then(()=>{i(null)})},[t,r,o]),pe.createElement(pe.Fragment,null,n,r?v.cloneElement(r,{ref:s}):null)}const Wut={x:0,y:0,scaleX:1,scaleY:1};function Yut(e){let{children:t}=e;return pe.createElement(e1.Provider,{value:Kde},pe.createElement(FT.Provider,{value:Wut},t))}const Kut={position:"fixed",touchAction:"none"},Xut=e=>LT(e)?"transform 250ms ease":void 0,Zut=v.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:c,transition:u=Xut}=e;if(!a)return null;const f=i?c:{...c,scaleX:1,scaleY:1},h={...Kut,width:a.width,height:a.height,top:a.top,left:a.left,transform:ju.Transform.toString(f),transformOrigin:i&&r?Vct(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return pe.createElement(n,{className:s,style:h,ref:t},o)}),Qut=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,c]of Object.entries(i))n.node.style.setProperty(l,c);s!=null&&s.active&&n.node.classList.remove(s.active)}},Jut=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ju.Transform.toString(t)},{transform:ju.Transform.toString(n)}]},edt={duration:250,easing:"ease",keyframes:Jut,sideEffects:Qut({styles:{active:{opacity:"0"}}})};function tdt(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return MT((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Yde(s);if(!c)return;const{transform:u}=oo(s).getComputedStyle(s),f=Lde(u);if(!f)return;const h=typeof t=="function"?t:ndt(t);return Hde(l,i.draggable.measure),h({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function ndt(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...edt,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...c}=o;if(!t)return;const u={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},f={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...f},g=i({...c,active:s,dragOverlay:a,transform:{initial:l,final:h}}),[y]=g,E=g[g.length-1];if(JSON.stringify(y)===JSON.stringify(E))return;const S=r?.({active:s,dragOverlay:a,...c}),w=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(T=>{w.onfinish=()=>{S?.(),T()}})}}let kY=0;function rdt(e){return v.useMemo(()=>{if(e!=null)return kY++,kY},[e])}const idt=pe.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggableNodes:y,droppableContainers:E,dragOverlay:S,over:w,measuringConfiguration:T,scrollableAncestors:A,scrollableAncestorRects:R,windowRect:_}=Qde(),D=v.useContext(FT),I=rdt(f?.id),M=Zde(s,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:S.rect,over:w,overlayNodeRect:S.rect,scrollableAncestors:A,scrollableAncestorRects:R,transform:D,windowRect:_}),j=fB(h),L=tdt({config:r,draggableNodes:y,droppableContainers:E,measuringConfiguration:T}),F=j?S.setRef:void 0;return pe.createElement(Yut,null,pe.createElement(qut,{animation:L},f&&I?pe.createElement(Zut,{key:I,id:f.id,ref:F,as:a,activatorEvent:u,adjustScale:t,className:l,transition:o,rect:j,style:{zIndex:c,...i},transform:M},n):null))});function xw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function odt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function bx(e){return e!==null&&e>=0}function sdt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function adt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const efe=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=xw(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},tfe="Sortable",nfe=pe.createContext({activeIndex:-1,containerId:tfe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:efe,disabled:{draggable:!1,droppable:!1}});function ldt(e){let{children:t,id:n,items:r,strategy:i=efe,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Qde(),f=Jy(tfe,n),h=a.rect!==null,g=v.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),y=s!=null,E=s?g.indexOf(s.id):-1,S=c?g.indexOf(c.id):-1,w=v.useRef(g),T=!sdt(g,w.current),A=S!==-1&&E===-1||T,R=adt(o);Sa(()=>{T&&y&&u(g)},[T,g,y,u]),v.useEffect(()=>{w.current=g},[g]);const _=v.useMemo(()=>({activeIndex:E,containerId:f,disabled:R,disableTransforms:A,items:g,overIndex:S,useDragOverlay:h,sortedRects:odt(g,l),strategy:i}),[E,f,R.draggable,R.droppable,A,g,S,l,h,i]);return pe.createElement(nfe.Provider,{value:_},t)}const cdt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return xw(n,r,i).indexOf(t)},udt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},ddt={duration:200,easing:"ease"},rfe="transform",fdt=ju.Transition.toString({property:rfe,duration:0,easing:"linear"}),pdt={roleDescription:"sortable"};function hdt(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=v.useState(null),a=v.useRef(n);return Sa(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=Lm(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),v.useEffect(()=>{o&&s(null)},[o]),o}function mdt(e){let{animateLayoutChanges:t=udt,attributes:n,disabled:r,data:i,getNewIndex:o=cdt,id:s,strategy:a,resizeObserverConfig:l,transition:c=ddt}=e;const{items:u,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:E,overIndex:S,useDragOverlay:w,strategy:T}=v.useContext(nfe),A=gdt(r,g),R=u.indexOf(s),_=v.useMemo(()=>({sortable:{containerId:f,index:R,items:u},...i}),[f,i,R,u]),D=v.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:M,isOver:j,setNodeRef:L}=Jde({id:s,data:_,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...l}}),{active:F,activatorEvent:H,activeNodeRect:Y,attributes:$,setNodeRef:G,listeners:V,isDragging:X,over:Q,setActivatorNodeRef:J,transform:B}=zut({id:s,data:_,attributes:{...pdt,...n},disabled:A.draggable}),W=_ct(L,G),K=!!F,P=K&&!y&&bx(h)&&bx(S),ce=!w&&X,le=ce&&P?B:null,te=P?le??(a??T)({rects:E,activeNodeRect:Y,activeIndex:h,overIndex:S,index:R}):null,oe=bx(h)&&bx(S)?o({id:s,items:u,activeIndex:h,overIndex:S}):R,ue=F?.id,Te=v.useRef({activeId:ue,items:u,newIndex:oe,containerId:f}),Ie=u!==Te.current.items,ke=t({active:F,containerId:f,isDragging:X,isSorting:K,id:s,index:R,items:u,newIndex:Te.current.newIndex,previousItems:Te.current.items,previousContainerId:Te.current.containerId,transition:c,wasDragging:Te.current.activeId!=null}),tt=hdt({disabled:!ke,index:R,node:M,rect:I});return v.useEffect(()=>{K&&Te.current.newIndex!==oe&&(Te.current.newIndex=oe),f!==Te.current.containerId&&(Te.current.containerId=f),u!==Te.current.items&&(Te.current.items=u)},[K,oe,f,u]),v.useEffect(()=>{if(ue===Te.current.activeId)return;if(ue!=null&&Te.current.activeId==null){Te.current.activeId=ue;return}const ze=setTimeout(()=>{Te.current.activeId=ue},50);return()=>clearTimeout(ze)},[ue]),{active:F,activeIndex:h,attributes:$,data:_,rect:I,index:R,newIndex:oe,items:u,isOver:j,isSorting:K,isDragging:X,listeners:V,node:M,overIndex:S,over:Q,setNodeRef:W,setActivatorNodeRef:J,setDroppableNodeRef:L,setDraggableNodeRef:G,transform:tt??te,transition:rt()};function rt(){if(tt||Ie&&Te.current.newIndex===R)return fdt;if(!(ce&&!LT(H)||!c)&&(K||ke))return ju.Transition.toString({...c,property:rfe})}}function gdt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}bn.Down,bn.Right,bn.Up,bn.Left;const bdt={},AY=e=>{let t;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(y=>y(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(bdt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,i,l);return l},ydt=e=>e?AY(e):AY,ife={},{useDebugValue:vdt}=pe,{useSyncExternalStoreWithSelector:xdt}=vKe;let NY=!1;const Edt=e=>e;function Sdt(e,t=Edt,n){(ife?"production":void 0)!=="production"&&n&&!NY&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),NY=!0);const r=xdt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vdt(r),r}const _Y=e=>{(ife?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?ydt(e):e,n=(r,i)=>Sdt(t,r,i);return Object.assign(n,t),n},wdt=e=>e?_Y(e):_Y;var RY,DY;const IY=typeof window<"u"&&((RY=window.document)!=null&&RY.createElement||((DY=window.navigator)==null?void 0:DY.product)==="ReactNative")?pe.useLayoutEffect:pe.useEffect;function Cdt(){const e=wdt(t=>({current:new Array,version:0,set:t}));return{In:({children:t})=>{const n=e(i=>i.set),r=e(i=>i.version);return IY(()=>{n(i=>({version:i.version+1}))},[]),IY(()=>(n(({current:i})=>({current:[...i,t]})),()=>n(({current:i})=>({current:i.filter(o=>o!==t)}))),[t,r]),null},Out:()=>{const t=e(n=>n.current);return pe.createElement(pe.Fragment,null,t)}}}const M_=768;function BT(){const[e,t]=v.useState(void 0);return v.useEffect(()=>{const n=window.matchMedia(`(max-width: ${M_-1}px)`),r=()=>{t(window.innerWidth<M_)};return n.addEventListener("change",r),t(window.innerWidth<M_),()=>n.removeEventListener("change",r)},[]),!!e}const ofe=Cdt(),pB=v.createContext({columns:[],data:[],activeCardId:null}),Tdt=({id:e,children:t,className:n})=>{const{isOver:r,setNodeRef:i}=Jde({id:e});return m.jsx("div",{className:Se("flex min-h-40 flex-col divide-y overflow-hidden rounded-md border bg-secondary text-xs shadow-sm ring-2 transition-all shrink-0",r?"ring-primary":"ring-transparent",n),ref:i,children:t})},kdt=({id:e,name:t,children:n,className:r})=>{const{attributes:i,listeners:o,setNodeRef:s,transition:a,transform:l,isDragging:c}=mdt({id:e}),{activeCardId:u}=v.useContext(pB),f={transition:a,transform:ju.Transform.toString(l)};return m.jsxs(m.Fragment,{children:[m.jsx("div",{style:f,...o,...i,ref:s,children:m.jsx(Kd,{className:Se("cursor-grab gap-4 rounded-md p-3 shadow-sm",c&&"pointer-events-none cursor-grabbing opacity-30",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})}),u===e&&m.jsx(ofe.In,{children:m.jsx(Kd,{className:Se("cursor-grab gap-4 rounded-md p-3 shadow-sm ring-2 ring-primary",c&&"cursor-grabbing",r),children:n??m.jsx("p",{className:"m-0 font-medium text-sm",children:t})})})]})},Adt=({children:e,className:t,...n})=>{const{data:r}=v.useContext(pB),i=r.filter(s=>s.column===n.id),o=i.map(s=>s.id);return m.jsxs(Xi,{className:"overflow-hidden flex-1",children:[m.jsx(ldt,{items:o,children:m.jsx("div",{className:Se("flex flex-grow flex-col gap-2 p-2",t),...n,children:i.map(e)})}),m.jsx(Pw,{orientation:"vertical"})]})},Ndt=({className:e,...t})=>m.jsx("div",{className:Se("m-0 p-2 font-semibold text-sm",e),...t}),_dt=e=>t=>{const{droppableRects:n,droppableContainers:r,pointerCoordinates:i}=t,o=y=>!e.includes(y),s=y=>e.includes(y),a=Xct(t),l=a.filter(y=>o(y.id)),c=a.filter(y=>s(y.id));if(l.length>0){const E=mY(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[l[0]]}if(c.length>0)return[c[0]];const u=Ode(t),f=u.filter(y=>o(y.id)),h=u.filter(y=>s(y.id));if(f.length>0){const E=Wct(t).filter(S=>o(S.id));return E.length>0?[E[0]]:[f[0]]}if(h.length>0)return[h[0]];if(i){let y=null;for(const E of e){const S=n.get(E);if(!S)continue;const w=S.left+S.width/2,T=S.top+S.height/2,A=Math.sqrt(Math.pow(i.x-w,2)+Math.pow(i.y-T,2)),R={left:S.left-150,right:S.right+150,top:S.top-50,bottom:S.bottom+50};i.x>=R.left&&i.x<=R.right&&i.y>=R.top&&i.y<=R.bottom&&(!y||A<y.distance)&&(y={id:E,distance:A})}if(y)return[{id:y.id}]}const g=mY(t);if(g.length>0){const y=g.find(E=>s(E.id));return y?[y]:[g[0]]}return[]},Rdt=({children:e,onDragStart:t,onDragEnd:n,onDragOver:r,className:i,columns:o,data:s,onDataChange:a,...l})=>{const[c,u]=v.useState(null),f=BT(),h=v.useMemo(()=>o.map(A=>A.id),[o]),g=v.useMemo(()=>_dt(h),[h]),y=zct(R_(Gde,{activationConstraint:{distance:8}}),R_(qde,{activationConstraint:{delay:150,tolerance:8}}),R_(uB)),E=A=>{s.find(_=>_.id===A.active.id)&&u(A.active.id),t?.(A)},S=A=>{const{active:R,over:_}=A;if(!_)return;const D=s.find(F=>F.id===R.id),I=s.find(F=>F.id===_.id);if(!D)return;const M=D.column,L=o.some(F=>F.id===_.id)?_.id:I?.column||M;if(M!==L){let F=[...s];const H=F.findIndex(Y=>Y.id===R.id);if(F[H]={...F[H],column:L},I){const Y=F.findIndex($=>$.id===_.id);F=xw(F,H,Y)}a?.(F)}r?.(A)},w=A=>{u(null),n?.(A);const{active:R,over:_}=A;if(!_||R.id===_.id)return;if(o.some(L=>L.id===_.id)){const L=s.find(F=>F.id===R.id);if(L&&L.column!==_.id){let F=[...s];const H=F.findIndex(Y=>Y.id===R.id);F[H]={...F[H],column:_.id},a?.(F)}return}let I=[...s];const M=I.findIndex(L=>L.id===R.id),j=I.findIndex(L=>L.id===_.id);M!==-1&&j!==-1&&(I=xw(I,M,j),a?.(I))},T={onDragStart({active:A}){const{name:R,column:_}=s.find(D=>D.id===A.id)??{};return`Picked up the card "${R}" from the "${_}" column`},onDragOver({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dragged the card "${_}" over the "${D}" column`},onDragEnd({active:A,over:R}){const{name:_}=s.find(I=>I.id===A.id)??{},D=o.find(I=>I.id===R?.id)?.name;return`Dropped the card "${_}" into the "${D}" column`},onDragCancel({active:A}){const{name:R}=s.find(_=>_.id===A.id)??{};return`Cancelled dragging the card "${R}"`}};return m.jsx(pB.Provider,{value:{columns:o,data:s,activeCardId:c},children:m.jsxs($ut,{accessibility:{announcements:T},collisionDetection:g,onDragEnd:w,onDragOver:S,onDragStart:E,sensors:y,...l,children:[m.jsx("div",{className:Se("flex gap-4",f&&"flex-col",i),children:o.map(A=>e(A))}),typeof window<"u"&&Wr.createPortal(m.jsx(idt,{children:m.jsx(ofe.Out,{})}),document.body)]})})},OY={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function sb(e){return OY[e]?OY[e]:e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Ddt({tasks:e,loading:t,onTasksUpdate:n}){const{config:r,updateConfig:i}=bf(),[o,s]=v.useState(new Set),[a,l]=v.useState(!1),c=BT(),u=r?.statuses||["todo","in-progress","in-review","done","blocked"],f=r?.statusColors||jO,h=v.useMemo(()=>u.filter(L=>o.has(L)).map(L=>({id:L,name:sb(L),color:f[L]||"gray"})),[u,o,f]),g={high:0,medium:1,low:2},y=v.useMemo(()=>[...e].sort((F,H)=>{const Y=g[F.priority]??2,$=g[H.priority]??2;return Y!==$?Y-$:new Date(H.updatedAt).getTime()-new Date(F.updatedAt).getTime()}).map(F=>({id:F.id,name:F.title,column:F.status,task:F})),[e]),E=()=>{const F=window.location.hash.slice(1).match(/^\/kanban\/([^?]+)/);if(!F)return null;const H=F[1];return e.find(Y=>Y.id===H)||null},[S,w]=v.useState(E());v.useEffect(()=>{const L=()=>{w(E())};return w(E()),window.addEventListener("hashchange",L),()=>window.removeEventListener("hashchange",L)},[e]),v.useEffect(()=>{r?.visibleColumns?s(new Set(r.visibleColumns)):s(new Set(u))},[r?.visibleColumns,u.join(",")]);const T=async L=>{try{await i({visibleColumns:[...L]})}catch(F){console.error("Failed to save config:",F)}},A=L=>{s(F=>{const H=new Set(F);return H.has(L)?H.delete(L):H.add(L),T(H),H})},R=async L=>{const F=L.filter(Y=>{const $=e.find(G=>G.id===Y.id);return $&&$.status!==Y.column}),H=e.map(Y=>{const $=L.find(G=>G.id===Y.id);return $&&$.column!==Y.status?{...Y,status:$.column}:Y});n(H);for(const Y of F)try{await ua.updateTask(Y.id,{status:Y.column}),Kl.success("Status updated",{description:`#${Y.id} moved to ${sb(Y.column)}`})}catch($){console.error("Failed to update task:",$),Kl.error("Failed to update status",{description:$ instanceof Error?$.message:"Unknown error"}),ua.getTasks().then(n).catch(console.error);break}};if(t)return m.jsx("div",{className:"flex items-center justify-center h-64",children:m.jsxs("div",{className:"text-center",children:[m.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading tasks..."})]})});const _=L=>{window.location.hash=`/kanban/${L.id}`},D=()=>{window.location.hash="/"},I=L=>{n(e.map(F=>F.id===L.id?L:F))},M=L=>{window.location.hash=`/kanban/${L}`},j=async L=>{try{await ua.archiveTask(L),n(e.filter(F=>F.id!==L)),D()}catch(F){console.error("Failed to archive task:",F)}};return m.jsxs("div",{className:"flex flex-col h-full",children:[c?m.jsxs(ude,{open:a,onOpenChange:l,className:"shrink-0 bg-card rounded-lg mb-4 border border-border",children:[m.jsxs(dde,{className:"flex items-center justify-between w-full p-3",children:[m.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Show Columns (",o.size,"/",u.length,")"]}),a?m.jsx(XY,{className:"w-4 h-4 text-muted-foreground"}):m.jsx(Eu,{className:"w-4 h-4 text-muted-foreground"})]}),m.jsx(fde,{children:m.jsx("div",{className:"flex flex-wrap gap-2 px-3 pb-3",children:u.map(L=>{const F=o.has(L),H=e.filter(Y=>Y.status===L).length;return m.jsxs("button",{type:"button",onClick:()=>A(L),className:Se("flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-colors text-xs",F?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[F?m.jsx(q_,{className:"w-3.5 h-3.5"}):m.jsx(G_,{className:"w-3.5 h-3.5"}),m.jsxs("span",{className:"font-medium",children:[sb(L)," (",H,")"]})]},L)})})})]}):m.jsx("div",{className:"shrink-0 bg-card rounded-lg p-4 mb-4 border border-border",children:m.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[m.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Show Columns:"}),u.map(L=>{const F=o.has(L),H=e.filter(Y=>Y.status===L).length;return m.jsxs("button",{type:"button",onClick:()=>A(L),className:Se("flex items-center gap-2 px-3 py-1.5 rounded-lg transition-colors",F?"bg-primary/10 text-primary dark:bg-primary/20":"bg-muted text-muted-foreground"),children:[F?m.jsx(q_,{className:"w-4 h-4"}):m.jsx(G_,{className:"w-4 h-4"}),m.jsxs("span",{className:"text-sm font-medium",children:[sb(L)," (",H,")"]})]},L)})]})}),m.jsxs(Xi,{className:"flex-1",children:[o.size>0?m.jsx(Rdt,{columns:h,data:y,onDataChange:R,className:"min-h-full pb-4",children:L=>{const F=Fwe(L.id,f),H=y.filter(Y=>Y.column===L.id).length;return m.jsxs(Tdt,{id:L.id,className:Se("min-w-[320px] max-w-[380px]",c&&"min-w-0 max-w-none w-full",F.bg,F.border),children:[m.jsxs(Ndt,{className:"flex items-center justify-between",children:[m.jsx("span",{className:"font-bold text-sm uppercase tracking-wide text-foreground",children:L.name}),m.jsx("span",{className:"text-xs rounded-full px-2 py-1 font-medium text-muted-foreground bg-background",children:H})]}),m.jsx(Adt,{id:L.id,children:Y=>m.jsx(Idt,{item:Y,statusColors:f,onClick:()=>_(Y.task)},Y.id)})]},L.id)}}):m.jsx("div",{className:"text-center py-12",children:m.jsx("p",{className:"text-lg text-muted-foreground",children:"No columns visible. Please select at least one column to display."})}),m.jsx(Pw,{orientation:"horizontal"})]}),m.jsx(_de,{task:S,allTasks:e,onClose:D,onUpdate:I,onArchive:j,onNavigateToTask:M})]})}function Idt({item:e,statusColors:t,onClick:n}){const{task:r}=e,i=wh(r.status,t),o=r.acceptanceCriteria.filter(a=>a.completed).length,s=r.acceptanceCriteria.length;return m.jsx(kdt,{id:e.id,name:e.name,column:e.column,className:"w-full",children:m.jsxs("div",{onClick:n,onKeyDown:a=>a.key==="Enter"&&n(),role:"button",tabIndex:0,className:"cursor-pointer",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono shrink-0 text-muted-foreground",children:["#",r.id]}),m.jsxs("div",{className:"flex items-center gap-1 flex-wrap justify-end",children:[m.jsx("span",{className:Se("text-xs px-1.5 py-0.5 rounded font-medium",i),children:sb(r.status)}),r.priority==="high"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-destructive/10 text-destructive dark:bg-destructive/20",children:"HIGH"}),r.priority==="medium"&&m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",children:"MED"})]})]}),m.jsx("h3",{className:"font-medium text-sm mb-2 line-clamp-2 text-foreground",children:r.title}),s>0&&m.jsxs("div",{className:"flex items-center gap-2 text-xs mb-2 text-muted-foreground",children:[m.jsx(QY,{className:"w-3 h-3","aria-hidden":"true"}),m.jsxs("span",{children:[o,"/",s]})]}),r.labels.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:r.labels.map(a=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-secondary text-secondary-foreground",children:a},a))}),r.assignee&&m.jsxs("div",{className:"flex items-center gap-1.5 text-xs mt-2 text-muted-foreground",children:[m.jsx($0,{name:r.assignee,size:"sm"}),m.jsx("span",{children:r.assignee})]})]})})}const MY=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],LY={low:"bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400",medium:"bg-amber-100 dark:bg-amber-900 text-amber-700 dark:text-amber-300",high:"bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300"};function Odt({isOpen:e,allTasks:t,onClose:n,onCreated:r}){const{currentUser:i}=YZ(),{config:o}=bf(),s=v.useRef(null),a=v.useRef(null),l=v.useMemo(()=>{const q=o.statuses||["todo","in-progress","in-review","done","blocked"];return JZ(q)},[o.statuses]),c=o.statusColors||{},[u,f]=v.useState(""),[h,g]=v.useState(""),[y,E]=v.useState("todo"),[S,w]=v.useState("medium"),[T,A]=v.useState(""),[R,_]=v.useState([]),[D,I]=v.useState(""),[M,j]=v.useState([]),[L,F]=v.useState(""),[H,Y]=v.useState(""),[$,G]=v.useState(!1),[V,X]=v.useState(null),[Q,J]=v.useState(!1),[B,W]=v.useState(""),[K,P]=v.useState(!1),[ce,le]=v.useState(""),[se,te]=v.useState(!1),[oe,ue]=v.useState(!1),{preferences:Te,toggleTaskCreateLayout:Ie}=ZZ(),ke=Te.taskCreateLayout==="maximized",tt=v.useRef(null),rt={hidden:{opacity:0,y:20,scale:.98},visible:{opacity:1,y:0,scale:1,transition:{duration:.2,ease:"easeOut"}},exit:{opacity:0,y:10,scale:.98,transition:{duration:.15,ease:"easeIn"}}};v.useEffect(()=>{e||(f(""),g(""),E("todo"),w("medium"),A(""),_([]),I(""),j([]),F(""),Y(""),X(null),J(!1),W(""),P(!1),le(""),te(!1),ue(!1))},[e]),v.useEffect(()=>{e&&setTimeout(()=>s.current?.focus(),100)},[e,ke]),v.useEffect(()=>{K&&tt.current&&tt.current.focus()},[K]);const ze=v.useCallback(()=>{B.trim()&&(j(q=>[...q,{id:crypto.randomUUID(),text:B.trim()}]),W(""),P(!1))},[B]),dn=v.useCallback(q=>{j(ge=>ge.filter(De=>De.id!==q))},[]),nt=v.useCallback(()=>{ce.trim()&&(R.includes(ce.trim())||_(q=>[...q,ce.trim()]),le(""),te(!1))},[ce,R]),Vn=v.useCallback(q=>{_(ge=>ge.filter(De=>De!==q))},[]),$t=async q=>{if(q.preventDefault(),X(null),!u.trim()){X("Title is required");return}G(!0);try{const ge={title:u.trim(),description:h.trim()||void 0,status:y,priority:S,labels:R,assignee:T.trim()||void 0,parent:D||void 0,acceptanceCriteria:M.map(De=>({text:De.text,completed:!1})),implementationPlan:L.trim()||void 0,implementationNotes:H.trim()||void 0};await sme(ge),J(!0),Kl.success("Task created successfully",{description:u.trim()}),setTimeout(()=>{r(),n()},800)}catch(ge){const De=ge instanceof Error?ge.message:"Failed to create task";X(De),Kl.error("Failed to create task",{description:De})}finally{G(!1)}},xt=D?t.find(q=>q.id===D):null,re=m.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 border-b bg-green-700",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"text-green-100 text-xs font-medium uppercase tracking-wide",children:"New Task"}),m.jsx("input",{ref:s,type:"text",value:u,onChange:q=>f(q.target.value),placeholder:"Enter task title...",className:"w-full text-lg font-semibold bg-white/20 text-white placeholder-white/60 border-0 rounded px-2 py-1 mt-1 focus:outline-none focus:ring-2 focus:ring-white/50",disabled:$})]}),m.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[m.jsx($e,{variant:"ghost",size:"icon",onClick:Ie,className:"h-8 w-8 text-foreground hover:text-foreground",title:ke?"Minimize":"Maximize",children:ke?m.jsx(iK,{className:"w-4 h-4"}):m.jsx(rK,{className:"w-4 h-4"})}),m.jsx($e,{variant:"ghost",size:"icon",onClick:n,className:"h-8 w-8 text-foreground hover:text-foreground",title:"Close",children:m.jsx(Yo,{className:"w-4 h-4"})})]})]}),de=(Q||V)&&m.jsxs("div",{className:"px-4 pt-4",children:[Q&&m.jsx("div",{className:"bg-green-50 dark:bg-green-900/50 border border-green-200 dark:border-green-700 text-green-700 dark:text-green-300 px-4 py-2 rounded-lg text-sm",children:"Task created successfully!"}),V&&m.jsx("div",{className:"bg-red-50 dark:bg-red-900/50 border border-red-200 dark:border-red-700 text-red-700 dark:text-red-300 px-4 py-2 rounded-lg text-sm",children:V})]}),ye=m.jsxs("div",{className:"p-6 space-y-6",children:[m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(sK,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Description"})]}),m.jsx(yu,{markdown:h,onChange:g,placeholder:"Add a more detailed description...",readOnly:$})]}),m.jsxs("section",{children:[m.jsx("div",{className:"flex items-center justify-between mb-3",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(gf,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Acceptance Criteria"}),M.length>0&&m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.length,")"]})]})}),m.jsx("div",{className:"space-y-2",children:M.map(q=>m.jsxs("div",{className:"flex items-start gap-2 bg-muted/50 rounded-lg px-3 py-2 group hover:shadow-sm transition-shadow",children:[m.jsx("input",{type:"checkbox",checked:!1,disabled:!0,className:"mt-1 w-4 h-4 rounded cursor-not-allowed opacity-50"}),m.jsx("span",{className:"flex-1 text-sm",children:q.text}),m.jsx("button",{type:"button",onClick:()=>dn(q.id),className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500 p-1 transition-all",title:"Delete",children:m.jsx(Wd,{className:"w-4 h-4"})})]},q.id))}),K?m.jsxs("div",{className:"mt-2 bg-muted/50 rounded-lg px-3 py-2",children:[m.jsx("input",{ref:tt,type:"text",value:B,onChange:q=>W(q.target.value),onKeyDown:q=>{q.key==="Enter"&&B.trim()&&(q.preventDefault(),ze()),q.key==="Escape"&&(W(""),P(!1))},placeholder:"Add an item...",className:"w-full border border-input rounded px-2 py-1.5 text-sm bg-background focus:outline-none focus:ring-2 focus:ring-green-500",disabled:$}),m.jsxs("div",{className:"flex gap-2 mt-2",children:[m.jsx($e,{type:"button",size:"sm",onClick:ze,disabled:!B.trim()||$,className:"bg-green-700 hover:bg-green-800 text-white",children:"Add"}),m.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:()=>{W(""),P(!1)},children:"Cancel"})]})]}):m.jsxs("button",{type:"button",onClick:()=>P(!0),className:"mt-2 flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground hover:bg-muted px-3 py-2 rounded-lg transition-colors w-full",disabled:$,children:[m.jsx(Os,{className:"w-4 h-4"}),m.jsx("span",{children:"Add an item"})]})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Xo,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Plan"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(yu,{markdown:L,onChange:F,placeholder:"Describe how you plan to implement this task...",readOnly:$})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Wge,{className:"w-5 h-5 text-muted-foreground"}),m.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Implementation Notes"}),m.jsx("span",{className:"text-xs text-muted-foreground",children:"(optional)"})]}),m.jsx(yu,{markdown:H,onChange:Y,placeholder:"Add notes, observations, or any other relevant information...",readOnly:$})]})]}),Me=m.jsxs("div",{className:"p-4 space-y-6",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(Yi,{value:y,onValueChange:q=>E(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full",wh(y,c)),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:l.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(Yi,{value:S,onValueChange:q=>w(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full",LY[S]),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:MY.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(cw,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Labels"}),m.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(q=>m.jsxs(oc,{variant:"secondary",className:"gap-1 pr-1",children:[q,m.jsx("button",{type:"button",onClick:()=>Vn(q),className:"ml-1 hover:text-destructive",children:m.jsx(Yo,{className:"w-3 h-3"})})]},q))}),se?m.jsxs("div",{className:"space-y-2",children:[m.jsx(qr,{value:ce,onChange:q=>le(q.target.value),onKeyDown:q=>{q.key==="Enter"&&ce.trim()&&(q.preventDefault(),nt()),q.key==="Escape"&&(le(""),te(!1))},placeholder:"Label name",disabled:$,autoFocus:!0}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx($e,{size:"sm",onClick:nt,disabled:!ce.trim()||$,children:"Add"}),m.jsx($e,{size:"sm",variant:"ghost",onClick:()=>{le(""),te(!1)},children:"Cancel"})]})]}):m.jsxs($e,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground",onClick:()=>te(!0),disabled:$,children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"Add label"]})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Parent Task"}),m.jsxs(L0,{open:oe,onOpenChange:ue,children:[m.jsx(P0,{asChild:!0,children:m.jsxs($e,{variant:"outline",role:"combobox","aria-expanded":oe,className:"w-full justify-between h-auto min-h-10 py-2",disabled:$,title:xt?`#${xt.id} - ${xt.title}`:void 0,children:[xt?m.jsxs("div",{className:"flex items-center gap-2 text-left overflow-hidden min-w-0 flex-1",children:[m.jsx(yh,{className:"w-4 h-4 shrink-0 text-muted-foreground"}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",xt.id]}),m.jsx("p",{className:"truncate text-sm",children:xt.title})]})]}):m.jsx("span",{className:"text-muted-foreground",children:"Select parent task..."}),m.jsx(cE,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Vh,{className:"w-[400px] p-0",align:"start",children:m.jsxs(Gh,{children:[m.jsx(qh,{placeholder:"Search tasks..."}),m.jsxs(Wh,{children:[m.jsx(Yh,{children:"No task found."}),m.jsxs(Ja,{children:[m.jsxs(Ko,{value:"none",onSelect:()=>{I(""),ue(!1)},children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(q=>m.jsxs(Ko,{value:`${q.id} ${q.title}`,onSelect:()=>{I(q.id),ue(!1)},title:`#${q.id} - ${q.title}`,children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D===q.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",q.id]}),m.jsx("p",{className:"truncate text-sm",children:q.title})]})]},q.id))]})]})]})})]})]})]}),Fe=m.jsxs("div",{className:"border-t px-6 py-4 bg-muted/30 flex justify-end gap-3",children:[m.jsx($e,{type:"button",variant:"ghost",onClick:n,disabled:$,children:"Cancel"}),m.jsx($e,{type:"button",onClick:$t,className:"bg-green-700 hover:bg-green-800 text-white",disabled:$||Q||!u.trim(),children:$?"Creating...":"Create Task"})]});return ke?m.jsx(mE,{children:e&&m.jsx(OO,{open:e,onOpenChange:q=>!q&&n(),children:m.jsxs(Ow,{className:"max-w-6xl w-[95vw] h-[90vh] p-0 gap-0 overflow-hidden flex flex-col",hideCloseButton:!0,children:[m.jsx(MO,{className:"sr-only",children:"Create New Task"}),m.jsxs(vE.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:rt,initial:"hidden",animate:"visible",exit:"exit",children:[re,de,m.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[m.jsx(Xi,{className:"flex-1",children:ye}),m.jsx("div",{className:"shrink-0 w-72 border-l bg-muted/20",children:m.jsx(Xi,{className:"h-full",children:Me})})]}),Fe]})]})})}):m.jsx(mE,{children:e&&m.jsx(RO,{open:e,onOpenChange:q=>!q&&n(),children:m.jsx(Iw,{side:"right",className:"w-full sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl p-0 flex flex-col gap-0",hideCloseButton:!0,children:m.jsxs(vE.div,{ref:a,className:"flex flex-col h-full overflow-hidden",variants:rt,initial:"hidden",animate:"visible",exit:"exit",children:[re,de,m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m.jsx("div",{className:"shrink-0 border-b bg-muted/20",children:m.jsxs("div",{className:"p-4 space-y-3",children:[m.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Status"}),m.jsxs(Yi,{value:y,onValueChange:q=>E(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full h-9",wh(y,c)),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:l.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Priority"}),m.jsxs(Yi,{value:S,onValueChange:q=>w(q),disabled:$,children:[m.jsx(Pi,{className:Se("w-full h-9",LY[S]),children:m.jsx(Ki,{})}),m.jsx(Fi,{children:MY.map(q=>m.jsx(yn,{value:q.value,children:q.label},q.value))})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Assignee"}),m.jsx(cw,{value:T,onChange:A,showGrabButton:!1,currentUser:i,container:a.current})]})]}),m.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Labels:"}),m.jsxs("div",{className:"flex flex-wrap gap-1 flex-1",children:[R.map(q=>m.jsxs(oc,{variant:"secondary",className:"gap-1 pr-1 text-xs",children:[q,m.jsx("button",{type:"button",onClick:()=>Vn(q),className:"ml-0.5 hover:text-destructive",children:m.jsx(Yo,{className:"w-3 h-3"})})]},q)),!se&&m.jsxs($e,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs text-muted-foreground",onClick:()=>te(!0),children:[m.jsx(Os,{className:"w-3 h-3 mr-1"}),"Add"]})]}),se&&m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(qr,{value:ce,onChange:q=>le(q.target.value),onKeyDown:q=>{q.key==="Enter"&&ce.trim()&&nt(),q.key==="Escape"&&(le(""),te(!1))},placeholder:"Label",className:"h-7 w-24 text-xs",autoFocus:!0}),m.jsx($e,{size:"sm",className:"h-7 px-2",onClick:nt,disabled:!ce.trim(),children:"Add"}),m.jsx($e,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:()=>{le(""),te(!1)},children:m.jsx(Yo,{className:"w-3 h-3"})})]})]}),m.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[m.jsx(rr,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground shrink-0",children:"Parent:"}),m.jsxs(L0,{open:oe,onOpenChange:ue,children:[m.jsx(P0,{asChild:!0,children:m.jsxs($e,{variant:"outline",role:"combobox",size:"sm",className:"h-7 justify-between min-w-[120px] max-w-[250px]",disabled:$,title:xt?`#${xt.id} - ${xt.title}`:void 0,children:[xt?m.jsxs("span",{className:"truncate text-xs",children:["#",xt.id," - ",xt.title]}):m.jsx("span",{className:"text-muted-foreground text-xs",children:"None"}),m.jsx(cE,{className:"ml-1 h-3 w-3 shrink-0 opacity-50"})]})}),m.jsx(Vh,{className:"w-[400px] p-0",align:"end",children:m.jsxs(Gh,{children:[m.jsx(qh,{placeholder:"Search tasks..."}),m.jsxs(Wh,{children:[m.jsx(Yh,{children:"No task found."}),m.jsxs(Ja,{children:[m.jsxs(Ko,{value:"none",onSelect:()=>{I(""),ue(!1)},children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D?"opacity-0":"opacity-100")}),m.jsx("span",{className:"text-muted-foreground",children:"None"})]}),t.map(q=>m.jsxs(Ko,{value:`${q.id} ${q.title}`,onSelect:()=>{I(q.id),ue(!1)},title:`#${q.id} - ${q.title}`,children:[m.jsx(Ds,{className:Se("mr-2 h-4 w-4 shrink-0",D===q.id?"opacity-100":"opacity-0")}),m.jsxs("div",{className:"overflow-hidden min-w-0 flex-1",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono block",children:["#",q.id]}),m.jsx("p",{className:"truncate text-sm",children:q.title})]})]},q.id))]})]})]})})]})]})]})]})}),m.jsx(Xi,{className:"flex-1",children:ye})]}),Fe]})})})})}const Mdt="/assets/logo-BkDQ9x4a.png",Ldt=bue,Pdt=yue,Fdt=vue,sfe=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(bit,{children:m.jsx(PF,{ref:r,sideOffset:t,className:Se("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 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));sfe.displayName=PF.displayName;const Bdt="sidebar_state",jdt=3600*24*7,$dt="16rem",Udt="18rem",Hdt="3rem",zdt="b",afe=v.createContext(null);function t1(){const e=v.useContext(afe);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const lfe=v.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:o,...s},a)=>{const l=BT(),[c,u]=v.useState(!1),[f,h]=v.useState(e),g=t??f,y=v.useCallback(T=>{const A=typeof T=="function"?T(g):T;n?n(A):h(A),document.cookie=`${Bdt}=${A}; path=/; max-age=${jdt}`},[n,g]),E=v.useCallback(()=>l?u(T=>!T):y(T=>!T),[l,y,u]);v.useEffect(()=>{const T=A=>{A.key===zdt&&(A.metaKey||A.ctrlKey)&&(A.preventDefault(),E())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[E]);const S=g?"expanded":"collapsed",w=v.useMemo(()=>({state:S,open:g,setOpen:y,isMobile:l,openMobile:c,setOpenMobile:u,toggleSidebar:E}),[S,g,y,l,c,u,E]);return m.jsx(afe.Provider,{value:w,children:m.jsx(Ldt,{delayDuration:0,children:m.jsx("div",{style:{"--sidebar-width":$dt,"--sidebar-width-icon":Hdt,...i},className:Se("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:a,...s,children:o})})})});lfe.displayName="SidebarProvider";const cfe=v.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,...o},s)=>{const{isMobile:a,state:l,openMobile:c,setOpenMobile:u}=t1();return n==="none"?m.jsx("div",{className:Se("flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground",r),ref:s,...o,children:i}):a?m.jsx(RO,{open:c,onOpenChange:u,...o,children:m.jsxs(Iw,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Udt},side:e,children:[m.jsxs(DO,{className:"sr-only",children:[m.jsx(IO,{children:"Sidebar"}),m.jsx(RZ,{children:"Displays the mobile sidebar."})]}),m.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):m.jsxs("div",{ref:s,className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":t,"data-side":e,children:[m.jsx("div",{className:Se("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),m.jsx("div",{className:Se("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:m.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:i})})]})});cfe.displayName="Sidebar";const ufe=v.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:i}=t1();return m.jsxs($e,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Se("h-7 w-7",e),onClick:o=>{t?.(o),i()},...n,children:[m.jsx(Ige,{}),m.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});ufe.displayName="SidebarTrigger";const dfe=v.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=t1();return m.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:Se("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});dfe.displayName="SidebarRail";const Vdt=v.forwardRef(({className:e,...t},n)=>m.jsx("main",{ref:n,className:Se("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));Vdt.displayName="SidebarInset";const Gdt=v.forwardRef(({className:e,...t},n)=>m.jsx(qr,{ref:n,"data-sidebar":"input",className:Se("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Gdt.displayName="SidebarInput";const ffe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"header",className:Se("flex flex-col gap-2 p-2",e),...t}));ffe.displayName="SidebarHeader";const pfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"footer",className:Se("flex flex-col gap-2 p-2",e),...t}));pfe.displayName="SidebarFooter";const qdt=v.forwardRef(({className:e,...t},n)=>m.jsx(j0,{ref:n,"data-sidebar":"separator",className:Se("mx-2 w-auto bg-sidebar-border",e),...t}));qdt.displayName="SidebarSeparator";const hfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"content",className:Se("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));hfe.displayName="SidebarContent";const mfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group",className:Se("relative flex w-full min-w-0 flex-col p-2",e),...t}));mfe.displayName="SidebarGroup";const gfe=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Hu:"div";return m.jsx(i,{ref:r,"data-sidebar":"group-label",className:Se("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});gfe.displayName="SidebarGroupLabel";const Wdt=v.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const i=t?Hu:"button";return m.jsx(i,{ref:r,"data-sidebar":"group-action",className:Se("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});Wdt.displayName="SidebarGroupAction";const bfe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"group-content",className:Se("w-full text-sm",e),...t}));bfe.displayName="SidebarGroupContent";const oE=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu",className:Se("flex w-full min-w-0 flex-col gap-1",e),...t}));oE.displayName="SidebarMenu";const sE=v.forwardRef(({className:e,...t},n)=>m.jsx("li",{ref:n,"data-sidebar":"menu-item",className:Se("group/menu-item relative",e),...t}));sE.displayName="SidebarMenuItem";const Ydt=cc("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),aE=v.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:o,...s},a)=>{const l=e?Hu:"button",{isMobile:c,state:u}=t1(),f=m.jsx(l,{ref:a,"data-sidebar":"menu-button","data-size":r,"data-active":t,className:Se(Ydt({variant:n,size:r}),o),...s});return i?(typeof i=="string"&&(i={children:i}),m.jsxs(Pdt,{children:[m.jsx(Fdt,{asChild:!0,children:f}),m.jsx(sfe,{side:"right",align:"center",hidden:u!=="collapsed"||c,...i})]})):f});aE.displayName="SidebarMenuButton";const Kdt=v.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>{const o=t?Hu:"button";return m.jsx(o,{ref:i,"data-sidebar":"menu-action",className:Se("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...r})});Kdt.displayName="SidebarMenuAction";const Xdt=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:Se("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));Xdt.displayName="SidebarMenuBadge";const Zdt=v.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const i=v.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return m.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:Se("flex h-8 items-center gap-2 rounded-md px-2",e),...n,children:[t&&m.jsx(PW,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),m.jsx(PW,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":i}})]})});Zdt.displayName="SidebarMenuSkeleton";const Qdt=v.forwardRef(({className:e,...t},n)=>m.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:Se("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));Qdt.displayName="SidebarMenuSub";const Jdt=v.forwardRef(({...e},t)=>m.jsx("li",{ref:t,...e}));Jdt.displayName="SidebarMenuSubItem";const eft=v.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:r,...i},o)=>{const s=e?Hu:"a";return m.jsx(s,{ref:o,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:Se("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...i})});eft.displayName="SidebarMenuSubButton";const tft=[{id:"kanban",label:"Kanban",icon:yge,href:"#/"},{id:"tasks",label:"Tasks",icon:tK,href:"#/tasks"},{id:"docs",label:"Docs",icon:Xo,href:"#/docs"}];function nft({currentPage:e,onSearchClick:t}){const{state:n}=t1(),r=BT(),i=n==="expanded";return m.jsxs(cfe,{collapsible:"icon",variant:r?"floating":"sidebar",children:[m.jsxs(ffe,{children:[m.jsx(oE,{children:m.jsx(sE,{children:m.jsx(aE,{size:"lg",asChild:!0,children:m.jsxs("a",{href:"#/",children:[m.jsx("img",{src:Mdt,alt:"Knowns",className:"size-8 rounded-lg object-contain"}),m.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[m.jsx("span",{className:"truncate font-semibold",children:"Knowns"}),m.jsx("span",{className:"truncate text-xs",children:"AI-ready task management"})]})]})})})}),i&&m.jsx("div",{className:"px-2 pb-2",children:m.jsxs("button",{type:"button",onClick:t,className:"flex w-full items-center gap-2 rounded-lg border bg-background px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[m.jsx(Ew,{className:"h-4 w-4"}),m.jsx("span",{children:"Search..."}),m.jsxs("kbd",{className:"ml-auto pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",children:[m.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]})})]}),m.jsx(hfe,{children:m.jsxs(mfe,{children:[m.jsx(gfe,{children:"Navigation"}),m.jsx(bfe,{children:m.jsx(oE,{children:tft.map(o=>{const s=e===o.id;return m.jsx(sE,{children:m.jsx(aE,{asChild:!0,isActive:s,tooltip:o.label,children:m.jsxs("a",{href:o.href,children:[m.jsx(o.icon,{}),m.jsx("span",{children:o.label})]})})},o.id)})})})]})}),m.jsxs(pfe,{children:[m.jsx(oE,{children:m.jsx(sE,{children:m.jsx(aE,{asChild:!0,isActive:e==="config",tooltip:"Settings",children:m.jsxs("a",{href:"#/config",children:[m.jsx(HI,{}),m.jsx("span",{children:"Settings"})]})})})}),i&&m.jsx("div",{className:"px-3 py-2 text-xs text-sidebar-foreground/50",children:m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("a",{href:"https://github.com/knowns-dev/knowns",target:"_blank",rel:"noopener noreferrer",className:"hover:text-sidebar-foreground transition-colors",children:"Knowns"}),m.jsx("span",{className:"font-mono",children:"0.8.7"})]})})]}),m.jsx(dfe,{})]})}const rft=[{value:"all",label:"All"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"content",label:"Content"}];function ift(e){const t=e.changes;if(t.length===0)return"Updated";const n=t.find(s=>s.field==="status");if(n){const s=String(n.newValue);return s==="done"?"Completed":s==="in-progress"?"Started working on":s==="in-review"?"Submitted for review":s==="blocked"?"Blocked":`Changed status to ${s}`}const r=t.find(s=>s.field==="assignee");if(r){const s=r.newValue;return s?`Assigned to ${s}`:"Unassigned"}if(t.find(s=>s.field==="title"))return"Updated title";const o=t.find(s=>s.field==="priority");return o?`Set priority to ${o.newValue}`:t.some(s=>s.field==="description")?"Updated description":t.some(s=>s.field==="acceptanceCriteria")?"Updated acceptance criteria":t.some(s=>s.field==="implementationPlan")?"Updated plan":t.some(s=>s.field==="implementationNotes")?"Updated notes":t.some(s=>s.field==="labels")?"Updated labels":`Updated ${t.length} field(s)`}function oft(e){const n=new Date().getTime()-e.getTime(),r=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return r<1?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:o<7?`${o}d ago`:e.toLocaleDateString()}function sft(e){return e.some(t=>t.field==="status"&&t.newValue==="done")?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":e.some(t=>t.field==="status"&&t.newValue==="in-progress")?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":e.some(t=>t.field==="status"&&t.newValue==="blocked")?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":e.some(t=>t.field==="assignee")?"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400":"bg-muted text-muted-foreground"}function aft({limit:e=20,showFilter:t=!0,onTaskClick:n}){const[r,i]=v.useState([]),[o,s]=v.useState(!0),[a,l]=v.useState("all"),[c,u]=v.useState(!1),f=v.useCallback(async()=>{try{const y=a==="all"?void 0:a,E=await ua.getActivities({limit:e,type:y});i(E)}catch(y){console.error("Failed to load activities:",y)}finally{s(!1),u(!1)}},[e,a]);v.useEffect(()=>{f()},[f]),xu("tasks:updated",()=>{f()},[f]);const h=()=>{u(!0),f()},g=y=>{n?n(y):window.location.hash=`/kanban/${y}`};return m.jsxs("div",{className:"flex flex-col h-full",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(x9,{className:"w-5 h-5"}),m.jsx("h3",{className:"font-semibold",children:"Recent Activity"})]}),m.jsx($e,{variant:"ghost",size:"icon",onClick:h,disabled:c,className:"h-8 w-8",children:m.jsx(UI,{className:`w-4 h-4 ${c?"animate-spin":""}`})})]}),t&&m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx($I,{className:"w-4 h-4 text-muted-foreground"}),m.jsx("select",{value:a,onChange:y=>l(y.target.value),className:"text-sm rounded px-2 py-1 bg-card border flex-1",children:rft.map(y=>m.jsx("option",{value:y.value,children:y.label},y.value))})]}),m.jsx(Xi,{className:"flex-1",children:m.jsx("div",{className:"space-y-1.5 pr-3",children:o?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"Loading activities..."}):r.length===0?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"No recent activity"}):r.map((y,E)=>m.jsx("div",{role:"button",tabIndex:0,onClick:S=>{S.preventDefault(),S.stopPropagation(),g(y.taskId)},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),g(y.taskId))},className:"w-full bg-card rounded p-2 text-left hover:bg-accent transition-colors border cursor-pointer select-none",children:m.jsxs("div",{className:"flex items-center gap-2",children:[y.author?m.jsx($0,{name:y.author,size:"xs"}):m.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center shrink-0 ${sft(y.changes)}`,children:m.jsx(x9,{className:"w-2.5 h-2.5"})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-xs font-medium truncate",children:ift(y)}),m.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:oft(y.timestamp)})]}),m.jsxs("div",{className:"text-[11px] text-muted-foreground truncate",children:[m.jsxs("span",{className:"font-medium",children:["#",y.taskId]})," ",y.taskTitle]})]})]})},`${y.taskId}-${y.version}-${E}`))})})]})}function lft(){const[e,t]=v.useState(!1),[n,r]=v.useState(!1),[i,o]=v.useState(()=>{const l=localStorage.getItem("knowns-last-activity-check");return l?new Date(l):new Date}),s=v.useCallback(async()=>{try{const l=await ua.getActivities({limit:1});l.length>0&&new Date(l[0].timestamp)>i&&t(!0)}catch(l){console.error("Failed to check activities:",l)}},[i]);v.useEffect(()=>{s()},[s]),xu("tasks:updated",()=>{n||t(!0)},[n]);const a=l=>{if(r(l),l){t(!1);const c=new Date;o(c),localStorage.setItem("knowns-last-activity-check",c.toISOString())}};return m.jsxs(L0,{open:n,onOpenChange:a,children:[m.jsx(P0,{asChild:!0,children:m.jsxs($e,{variant:"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Notifications",children:[m.jsx(Nme,{className:"h-4 w-4"}),e&&m.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-blue-500 animate-pulse"})]})}),m.jsx(Vh,{className:"w-80 p-0",align:"end",sideOffset:8,children:m.jsxs("div",{className:"flex flex-col h-[400px]",children:[m.jsx("div",{className:"px-4 py-3 border-b",children:m.jsx("h3",{className:"font-semibold text-sm",children:"Recent Activity"})}),m.jsx("div",{className:"flex-1 overflow-hidden p-2",children:m.jsx(aft,{limit:20,showFilter:!1,onTaskClick:l=>{r(!1),window.location.hash=`/kanban/${l}`}})})]})})]})}const PY={todo:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300","in-progress":"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300","in-review":"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",done:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",blocked:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300","on-hold":"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300"},cft={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold"};function uft({open:e,onOpenChange:t,onTaskSelect:n,onDocSelect:r}){const[i,o]=v.useState(""),[s,a]=v.useState({tasks:[],docs:[]}),[l,c]=v.useState(!1);v.useEffect(()=>{if(!e){o(""),a({tasks:[],docs:[]});return}if(!i.trim()){a({tasks:[],docs:[]});return}c(!0);const h=setTimeout(()=>{fetch(`/api/search?q=${encodeURIComponent(i)}`).then(g=>g.json()).then(g=>{a({tasks:g.tasks||[],docs:g.docs||[]})}).catch(g=>{console.error("Search failed:",g),a({tasks:[],docs:[]})}).finally(()=>{c(!1)})},300);return()=>clearTimeout(h)},[i,e]);const u=h=>{n(h),t(!1),o("")},f=h=>{r(h),t(!1),o("")};return m.jsx(OO,{open:e,onOpenChange:t,children:m.jsx(Ow,{className:"overflow-hidden p-0 max-w-2xl",hideClose:!0,children:m.jsxs(Gh,{shouldFilter:!1,children:[m.jsx(qh,{placeholder:"Search tasks and docs...",value:i,onValueChange:o}),m.jsxs(Wh,{children:[m.jsx(Yh,{children:l?"Searching...":i?"No results found.":"Type to search..."}),s.tasks.length>0&&m.jsx(Ja,{heading:"Tasks",children:s.tasks.slice(0,8).map(h=>{const g=PY[h.status]||PY.todo,y=cft[h.status]||h.status;return m.jsxs(Ko,{value:`task-${h.id}`,onSelect:()=>u(h),children:[m.jsx(tK,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["#",h.id]}),m.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${g}`,children:y})]}),m.jsx("div",{className:"font-medium truncate",children:h.title})]})]},h.id)})}),s.tasks.length>0&&s.docs.length>0&&m.jsx(sw,{}),s.docs.length>0&&m.jsx(Ja,{heading:"Documentation",children:s.docs.slice(0,8).map(h=>{const g=h.metadata?.title||h.filename;return m.jsxs(Ko,{value:`doc-${h.path}`,onSelect:()=>f(h),children:[m.jsx(Xo,{className:"mr-2 h-4 w-4 shrink-0"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"font-medium truncate mb-1",children:g}),m.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:m.jsx("span",{className:"truncate",children:h.path})})]})]},h.path)})})]})]})})})}const yfe={description:{begin:"<!-- SECTION:DESCRIPTION:BEGIN -->",end:"<!-- SECTION:DESCRIPTION:END -->"},plan:{begin:"<!-- SECTION:PLAN:BEGIN -->",end:"<!-- SECTION:PLAN:END -->"},notes:{begin:"<!-- SECTION:NOTES:BEGIN -->",end:"<!-- SECTION:NOTES:END -->"},ac:{begin:"<!-- AC:BEGIN -->",end:"<!-- AC:END -->"}};function dft(e,t){const n=yfe[t];if(!n)return e;const r=e.indexOf(n.begin),i=e.indexOf(n.end);return r===-1||i===-1?e:e.substring(r+n.begin.length,i).trim()}function fft(e,t){const n=yfe[t];return n?e.includes(n.begin)&&e.includes(n.end):!1}function pft(e){return e.replace(/<!--[\s\S]*?-->/g,"")}function hft(e,t){return e?t&&fft(e,t)?dft(e,t):e:""}const mft="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-green-100/50 border border-green-500/30 text-green-700 hover:bg-green-100 hover:border-green-500/50 dark:bg-green-900/20 dark:text-green-300 dark:hover:bg-green-900/30",gft="inline-flex items-center gap-1 px-1 py-1 rounded-md text-sm font-medium transition-all hover:scale-105 bg-blue-100/50 border border-blue-500/30 text-blue-700 hover:bg-blue-100 hover:border-blue-500/50 dark:bg-blue-900/20 dark:text-blue-300 dark:hover:bg-blue-900/30",bft=v.forwardRef(({markdown:e,className:t="",sectionType:n,enableGFM:r=!0,onDocLinkClick:i},o)=>{if(!e)return null;const s=pft(hft(e,n)),a=({href:l,children:c})=>{if(l&&/^(task-)?\d+(\.\d+)?(\.md)?$/.test(l)){const u=l.replace(/^task-/,"").replace(/\.md$/,""),f=`#/tasks/${u}`;return m.jsxs("a",{href:f,className:mft,"data-task-id":u,children:[m.jsx(gf,{className:"w-4 h-4 shrink-0"}),c]})}if(l&&(l.endsWith(".md")||l.includes(".md#"))){const u=l.replace(/^\.\//,""),f=`#/docs/${u}`;return m.jsxs("a",{href:f,className:gft,"data-doc-path":u,onClick:h=>{i&&(h.preventDefault(),i(u))},children:[m.jsx(Xo,{className:"w-4 h-4 shrink-0"}),c]})}return m.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-600 underline",children:c})};return m.jsx("div",{ref:o,className:`prose prose-sm max-w-none dark:prose-invert ${t}`,children:m.jsx(eee,{remarkPlugins:r?[gC]:[],components:{a,code:({className:l,children:c,...u})=>l?m.jsx("code",{className:l,...u,children:c}):m.jsx("code",{className:"px-1.5 py-0.5 rounded text-sm bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200",...u,children:c}),pre:({children:l})=>m.jsx("pre",{className:"overflow-x-auto rounded-lg p-4 text-sm bg-gray-100 dark:bg-gray-900",children:l}),table:({children:l})=>m.jsx("div",{className:"overflow-x-auto my-4",children:m.jsx("table",{className:"min-w-full border-collapse",children:l})}),th:({children:l})=>m.jsx("th",{className:"px-4 py-2 text-left font-semibold border bg-gray-100 text-gray-900 border-gray-200 dark:bg-gray-700 dark:text-gray-100 dark:border-gray-600",children:l}),td:({children:l})=>m.jsx("td",{className:"px-4 py-2 border border-gray-200 text-gray-700 dark:border-gray-600 dark:text-gray-200",children:l}),input:({type:l,checked:c,...u})=>l==="checkbox"?m.jsx("input",{type:"checkbox",checked:c,readOnly:!0,className:"mr-2 accent-blue-600",...u}):m.jsx("input",{type:l,...u})},children:s})})});bft.displayName="MarkdownRenderer";function pu(e,t){return typeof e=="function"?e(t):e}function rs(e,t){return n=>{t.setState(r=>({...r,[e]:pu(n,r[e])}))}}function jT(e){return e instanceof Function}function yft(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function vft(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const s=t(o);s!=null&&s.length&&r(s)})};return r(e),n}function ut(e,t,n){let r=[],i;return o=>{let s;n.key&&n.debug&&(s=Date.now());const a=e(o);if(!(a.length!==r.length||a.some((u,f)=>r[f]!==u)))return i;r=a;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...a),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const u=Math.round((Date.now()-s)*100)/100,f=Math.round((Date.now()-c)*100)/100,h=f/16,g=(y,E)=>{for(y=String(y);y.length<E;)y=" "+y;return y};console.info(`%c⏱ ${g(f,5)} /${g(u,5)} ms`,`
315
315
  font-size: .6rem;
316
316
  font-weight: bold;
317
- color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,n?.key)}return i}}function dt(e,t,n,r){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function vft(e,t,n,r){const i=()=>{var s;return(s=o.getValue())!=null?s:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:ut(()=>[e,n,t,o],(s,a,l,c)=>({table:s,column:a,row:l,cell:c,getValue:c.getValue,renderValue:c.renderValue}),dt(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(o,n,t,e)},{}),o}function xft(e,t,n,r){var i,o;const a={...e._getDefaultColumnDef(),...t},l=a.accessorKey;let c=(i=(o=a.id)!=null?o:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?i:typeof a.header=="string"?a.header:void 0,u;if(a.accessorFn?u=a.accessorFn:l&&(l.includes(".")?u=h=>{let g=h;for(const E of l.split(".")){var y;g=(y=g)==null?void 0:y[E]}return g}:u=h=>h[a.accessorKey]),!c)throw new Error;let f={id:`${String(c)}`,accessorFn:u,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:ut(()=>[!0],()=>{var h;return[f,...(h=f.columns)==null?void 0:h.flatMap(g=>g.getFlatColumns())]},dt(e.options,"debugColumns")),getLeafColumns:ut(()=>[e._getOrderColumnsFn()],h=>{var g;if((g=f.columns)!=null&&g.length){let y=f.columns.flatMap(E=>E.getLeafColumns());return h(y)}return[f]},dt(e.options,"debugColumns"))};for(const h of e._features)h.createColumn==null||h.createColumn(f,e);return f}const Di="debugHeaders";function FY(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),s.push(l)};return a(o),s},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(o,e)}),o}const Eft={createTable:e=>{e.getHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,s;const a=(o=r?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?o:[],l=(s=i?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?s:[],c=n.filter(f=>!(r!=null&&r.includes(f.id))&&!(i!=null&&i.includes(f.id)));return yx(t,[...a,...c,...l],e)},dt(e.options,Di)),e.getCenterHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),yx(t,n,e,"center")),dt(e.options,Di)),e.getLeftHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?i:[];return yx(t,o,e,"left")},dt(e.options,Di)),e.getRightHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?i:[];return yx(t,o,e,"right")},dt(e.options,Di)),e.getFooterGroups=ut(()=>[e.getHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getLeftFooterGroups=ut(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getCenterFooterGroups=ut(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getRightFooterGroups=ut(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getFlatHeaders=ut(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getLeftFlatHeaders=ut(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getCenterFlatHeaders=ut(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getRightFlatHeaders=ut(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getCenterLeafHeaders=ut(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),dt(e.options,Di)),e.getLeftLeafHeaders=ut(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),dt(e.options,Di)),e.getRightLeafHeaders=ut(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),dt(e.options,Di)),e.getLeafHeaders=ut(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,s,a,l,c;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(s=(a=n[0])==null?void 0:a.headers)!=null?s:[],...(l=(c=r[0])==null?void 0:c.headers)!=null?l:[]].map(u=>u.getLeafHeaders()).flat()},dt(e.options,Di))}};function yx(e,t,n,r){var i,o;let s=0;const a=function(h,g){g===void 0&&(g=1),s=Math.max(s,g),h.filter(y=>y.getIsVisible()).forEach(y=>{var E;(E=y.columns)!=null&&E.length&&a(y.columns,g+1)},0)};a(e);let l=[];const c=(h,g)=>{const y={depth:g,id:[r,`${g}`].filter(Boolean).join("_"),headers:[]},E=[];h.forEach(S=>{const w=[...E].reverse()[0],T=S.column.depth===y.depth;let A,R=!1;if(T&&S.column.parent?A=S.column.parent:(A=S.column,R=!0),w&&w?.column===A)w.subHeaders.push(S);else{const _=FY(n,A,{id:[r,g,A.id,S?.id].filter(Boolean).join("_"),isPlaceholder:R,placeholderId:R?`${E.filter(D=>D.column===A).length}`:void 0,depth:g,index:E.length});_.subHeaders.push(S),E.push(_)}y.headers.push(S),S.headerGroup=y}),l.push(y),g>0&&c(E,g-1)},u=t.map((h,g)=>FY(n,h,{depth:s,index:g}));c(u,s-1),l.reverse();const f=h=>h.filter(y=>y.column.getIsVisible()).map(y=>{let E=0,S=0,w=[0];y.subHeaders&&y.subHeaders.length?(w=[],f(y.subHeaders).forEach(A=>{let{colSpan:R,rowSpan:_}=A;E+=R,w.push(_)})):E=1;const T=Math.min(...w);return S=S+T,y.colSpan=E,y.rowSpan=S,{colSpan:E,rowSpan:S}});return f((i=(o=l[0])==null?void 0:o.headers)!=null?i:[]),l}const hB=(e,t,n,r,i,o,s)=>{let a={id:t,index:r,original:n,depth:i,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const c=e.getColumn(l);if(c!=null&&c.accessorFn)return a._valuesCache[l]=c.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const c=e.getColumn(l);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=c.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var c;return(c=a.getValue(l))!=null?c:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>yft(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],c=a;for(;;){const u=c.getParentRow();if(!u)break;l.push(u),c=u}return l.reverse()},getAllCells:ut(()=>[e.getAllLeafColumns()],l=>l.map(c=>vft(e,a,c,c.id)),dt(e.options,"debugRows")),_getAllCellsByColumnId:ut(()=>[a.getAllCells()],l=>l.reduce((c,u)=>(c[u.column.id]=u,c),{}),dt(e.options,"debugRows"))};for(let l=0;l<e._features.length;l++){const c=e._features[l];c==null||c.createRow==null||c.createRow(a,e)}return a},Sft={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},vfe=(e,t,n)=>{var r,i;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(o))};vfe.autoRemove=e=>ma(e);const xfe=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};xfe.autoRemove=e=>ma(e);const Efe=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};Efe.autoRemove=e=>ma(e);const Sfe=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};Sfe.autoRemove=e=>ma(e);const wfe=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});wfe.autoRemove=e=>ma(e)||!(e!=null&&e.length);const Cfe=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});Cfe.autoRemove=e=>ma(e)||!(e!=null&&e.length);const Tfe=(e,t,n)=>e.getValue(t)===n;Tfe.autoRemove=e=>ma(e);const kfe=(e,t,n)=>e.getValue(t)==n;kfe.autoRemove=e=>ma(e);const mB=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};mB.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(i)?1/0:i;if(o>s){const a=o;o=s,s=a}return[o,s]};mB.autoRemove=e=>ma(e)||ma(e[0])&&ma(e[1]);const Gl={includesString:vfe,includesStringSensitive:xfe,equalsString:Efe,arrIncludes:Sfe,arrIncludesAll:wfe,arrIncludesSome:Cfe,equals:Tfe,weakEquals:kfe,inNumberRange:mB};function ma(e){return e==null||e===""}const wft={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:rs("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);return typeof r=="string"?Gl.includesString:typeof r=="number"?Gl.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Gl.equals:Array.isArray(r)?Gl.arrIncludes:Gl.weakEquals},e.getFilterFn=()=>{var n,r;return jT(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:Gl[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r?.find(u=>u.id===e.id),s=pu(n,o?o.value:void 0);if(BY(i,s,e)){var a;return(a=r?.filter(u=>u.id!==e.id))!=null?a:[]}const l={id:e.id,value:s};if(o){var c;return(c=r?.map(u=>u.id===e.id?l:u))!=null?c:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=pu(t,i))==null?void 0:o.filter(s=>{const a=n.find(l=>l.id===s.id);if(a){const l=a.getFilterFn();if(BY(l,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function BY(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Cft=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),Tft=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},kft=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}),r},Aft=(e,t,n)=>{let r,i;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r===void 0?s>=s&&(r=i=s):(r>s&&(r=s),i<s&&(i=s)))}),[r,i]},Nft=(e,t)=>{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},_ft=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!bft(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,s)=>o-s);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},Rft=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Dft=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Ift=(e,t)=>t.length,L_={sum:Cft,min:Tft,max:kft,extent:Aft,mean:Nft,median:_ft,unique:Rft,uniqueCount:Dft,count:Ift},Oft={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:rs("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);if(typeof r=="number")return L_.sum;if(Object.prototype.toString.call(r)==="[object Date]")return L_.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return jT(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:L_[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function Mft(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(s=>s.id===o)).filter(Boolean),...r]}const Lft={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:rs("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ut(n=>[jb(t,n)],n=>n.findIndex(r=>r.id===e.id),dt(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=jb(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const i=jb(t,n);return((r=i[i.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=ut(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const s=[...t],a=[...i];for(;a.length&&s.length;){const l=s.shift(),c=a.findIndex(u=>u.id===l);c>-1&&o.push(a.splice(c,1)[0])}o=[...o,...a]}return Mft(o,n,r)},dt(e.options,"debugTable"))}},P_=()=>({left:[],right:[]}),Pft={getInitialState:e=>({columnPinning:P_(),...e}),getDefaultOptions:e=>({onColumnPinningChange:rs("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,s;if(n==="right"){var a,l;return{left:((a=i?.left)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((l=i?.right)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(n==="left"){var c,u;return{left:[...((c=i?.left)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((u=i?.right)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((o=i?.left)!=null?o:[]).filter(f=>!(r!=null&&r.includes(f))),right:((s=i?.right)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var i,o,s;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(a=>r?.includes(a)),s=n.some(a=>i?.includes(a));return o?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();return i?(n=(r=t.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=ut(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(s=>!o.includes(s.column.id))},dt(t.options,"debugRows")),e.getLeftVisibleCells=ut(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),dt(t.options,"debugRows")),e.getRightVisibleCells=ut(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),dt(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?P_():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:P_())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=ut(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),dt(e.options,"debugColumns")),e.getRightLeafColumns=ut(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),dt(e.options,"debugColumns")),e.getCenterLeafColumns=ut(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},dt(e.options,"debugColumns"))}};function Fft(e){return e||(typeof document<"u"?document:null)}const vx={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},F_=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Bft={getDefaultColumnDef:()=>vx,getInitialState:e=>({columnSizing:{},columnSizingInfo:F_(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:rs("columnSizing",e),onColumnSizingInfoChange:rs("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:vx.minSize,(r=o??e.columnDef.size)!=null?r:vx.size),(i=e.columnDef.maxSize)!=null?i:vx.maxSize)},e.getStart=ut(n=>[n,jb(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((i,o)=>i+o.getSize(),0),dt(t.options,"debugColumns")),e.getAfter=ut(n=>[n,jb(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((i,o)=>i+o.getSize(),0),dt(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),i=r?.getCanResize();return o=>{if(!r||!i||(o.persist==null||o.persist(),B_(o)&&o.touches&&o.touches.length>1))return;const s=e.getSize(),a=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[r.id,r.getSize()]],l=B_(o)?Math.round(o.touches[0].clientX):o.clientX,c={},u=(w,T)=>{typeof T=="number"&&(t.setColumnSizingInfo(A=>{var R,_;const D=t.options.columnResizeDirection==="rtl"?-1:1,I=(T-((R=A?.startOffset)!=null?R:0))*D,M=Math.max(I/((_=A?.startSize)!=null?_:0),-.999999);return A.columnSizingStart.forEach(j=>{let[L,F]=j;c[L]=Math.round(Math.max(F+F*M,0)*100)/100}),{...A,deltaOffset:I,deltaPercentage:M}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(A=>({...A,...c})))},f=w=>u("move",w),h=w=>{u("end",w),t.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g=Fft(n),y={moveHandler:w=>f(w.clientX),upHandler:w=>{g?.removeEventListener("mousemove",y.moveHandler),g?.removeEventListener("mouseup",y.upHandler),h(w.clientX)}},E={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),f(w.touches[0].clientX),!1),upHandler:w=>{var T;g?.removeEventListener("touchmove",E.moveHandler),g?.removeEventListener("touchend",E.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),h((T=w.touches[0])==null?void 0:T.clientX)}},S=jft()?{passive:!1}:!1;B_(o)?(g?.addEventListener("touchmove",E.moveHandler,S),g?.addEventListener("touchend",E.upHandler,S)):(g?.addEventListener("mousemove",y.moveHandler,S),g?.addEventListener("mouseup",y.upHandler,S)),t.setColumnSizingInfo(w=>({...w,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?F_():(n=e.initialState.columnSizingInfo)!=null?n:F_())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}}};let xx=null;function jft(){if(typeof xx=="boolean")return xx;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return xx=e,xx}function B_(e){return e.type==="touchstart"}const $ft={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:rs("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const i=e.columns;return(n=i.length?i.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=ut(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),dt(t.options,"debugRows")),e.getVisibleCells=ut(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],dt(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>ut(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),dt(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function jb(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Uft={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Hft={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:rs("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Gl.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return jT(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:Gl[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},zft={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:rs("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const s=o.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,n=(i=n)!=null?i:!o,!o&&n)return{...s,[e.id]:!0};if(o&&!n){const{[e.id]:a,...l}=s;return l}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r?.[e.id])},e.getCanExpand=()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},OI=0,MI=10,j_=()=>({pageIndex:OI,pageSize:MI}),Vft={getInitialState:e=>({...e,pagination:{...j_(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:rs("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const i=o=>pu(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=r=>{var i;e.setPagination(r?j_():(i=e.initialState.pagination)!=null?i:j_())},e.setPageIndex=r=>{e.setPagination(i=>{let o=pu(r,i.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,s)),{...i,pageIndex:o}})},e.resetPageIndex=r=>{var i,o;e.setPageIndex(r?OI:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?i:OI)},e.resetPageSize=r=>{var i,o;e.setPageSize(r?MI:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?i:MI)},e.setPageSize=r=>{e.setPagination(i=>{const o=Math.max(1,pu(r,i.pageSize)),s=i.pageSize*i.pageIndex,a=Math.floor(s/o);return{...i,pageIndex:a,pageSize:o}})},e.setPageCount=r=>e.setPagination(i=>{var o;let s=pu(r,(o=e.options.pageCount)!=null?o:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...i,pageCount:s}}),e.getPageOptions=ut(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,s)=>s)),i},dt(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:r<i-1},e.previousPage=()=>e.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},$_=()=>({top:[],bottom:[]}),Gft={getInitialState:e=>({rowPinning:$_(),...e}),getDefaultOptions:e=>({onRowPinningChange:rs("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{const o=r?e.getLeafRows().map(l=>{let{id:c}=l;return c}):[],s=i?e.getParentRows().map(l=>{let{id:c}=l;return c}):[],a=new Set([...s,e.id,...o]);t.setRowPinning(l=>{var c,u;if(n==="bottom"){var f,h;return{top:((f=l?.top)!=null?f:[]).filter(E=>!(a!=null&&a.has(E))),bottom:[...((h=l?.bottom)!=null?h:[]).filter(E=>!(a!=null&&a.has(E))),...Array.from(a)]}}if(n==="top"){var g,y;return{top:[...((g=l?.top)!=null?g:[]).filter(E=>!(a!=null&&a.has(E))),...Array.from(a)],bottom:((y=l?.bottom)!=null?y:[]).filter(E=>!(a!=null&&a.has(E)))}}return{top:((c=l?.top)!=null?c:[]).filter(E=>!(a!=null&&a.has(E))),bottom:((u=l?.bottom)!=null?u:[]).filter(E=>!(a!=null&&a.has(E)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=t.options;return typeof r=="function"?r(e):(n=r??i)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,o=n.some(a=>r?.includes(a)),s=n.some(a=>i?.includes(a));return o?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();if(!i)return-1;const o=(n=i==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(s=>{let{id:a}=s;return a});return(r=o?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?$_():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:$_())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var i,o;return!!((i=r.top)!=null&&i.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(n??[]).map(s=>{const a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(s=>t.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=ut(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),dt(e.options,"debugRows")),e.getBottomRows=ut(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),dt(e.options,"debugRows")),e.getCenterRows=ut(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const i=new Set([...n??[],...r??[]]);return t.filter(o=>!i.has(o.id))},dt(e.options,"debugRows"))}},qft={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:rs("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{LI(i,o.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ut(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?U_(e,n):{rows:[],flatRows:[],rowsById:{}},dt(e.options,"debugTable")),e.getFilteredSelectedRowModel=ut(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?U_(e,n):{rows:[],flatRows:[],rowsById:{}},dt(e.options,"debugTable")),e.getGroupedSelectedRowModel=ut(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?U_(e,n):{rows:[],flatRows:[],rowsById:{}},dt(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const i=e.getIsSelected();t.setRowSelection(o=>{var s;if(n=typeof n<"u"?n:!i,e.getCanSelect()&&i===n)return o;const a={...o};return LI(a,e.id,n,(s=r?.selectChildren)!=null?s:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return gB(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return PI(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return PI(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},LI=(e,t,n,r,i)=>{var o;const s=i.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=s.subRows)!=null&&o.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>LI(e,a.id,n,r,i))};function U_(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(s,a){return s.map(l=>{var c;const u=gB(l,n);if(u&&(r.push(l),i[l.id]=l),(c=l.subRows)!=null&&c.length&&(l={...l,subRows:o(l.subRows)}),u)return l}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function gB(e,t){var n;return(n=t[e.id])!=null?n:!1}function PI(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,o=!1;return e.subRows.forEach(s=>{if(!(o&&!i)&&(s.getCanSelect()&&(gB(s,t)?o=!0:i=!1),s.subRows&&s.subRows.length)){const a=PI(s,t);a==="all"?o=!0:(a==="some"&&(o=!0),i=!1)}}),i?"all":o?"some":!1}const FI=/([0-9]+)/gm,Wft=(e,t,n)=>Afe($u(e.getValue(n)).toLowerCase(),$u(t.getValue(n)).toLowerCase()),Yft=(e,t,n)=>Afe($u(e.getValue(n)),$u(t.getValue(n))),Kft=(e,t,n)=>bB($u(e.getValue(n)).toLowerCase(),$u(t.getValue(n)).toLowerCase()),Xft=(e,t,n)=>bB($u(e.getValue(n)),$u(t.getValue(n))),Zft=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},Qft=(e,t,n)=>bB(e.getValue(n),t.getValue(n));function bB(e,t){return e===t?0:e>t?1:-1}function $u(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Afe(e,t){const n=e.split(FI).filter(Boolean),r=t.split(FI).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),s=parseInt(i,10),a=parseInt(o,10),l=[s,a].sort();if(isNaN(l[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return n.length-r.length}const Xg={alphanumeric:Wft,alphanumericCaseSensitive:Yft,text:Kft,textCaseSensitive:Xft,datetime:Zft,basic:Qft},Jft={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:rs("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i?.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Xg.datetime;if(typeof o=="string"&&(r=!0,o.split(FI).length>1))return Xg.alphanumeric}return r?Xg.text:Xg.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof n?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return jT(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Xg[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(s=>{const a=s?.find(g=>g.id===e.id),l=s?.findIndex(g=>g.id===e.id);let c=[],u,f=o?n:i==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?u="toggle":u="add":s!=null&&s.length&&l!==s.length-1?u="replace":a?u="toggle":u="replace",u==="toggle"&&(o||i||(u="remove")),u==="add"){var h;c=[...s,{id:e.id,desc:f}],c.splice(0,c.length-((h=t.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=s.map(g=>g.id===e.id?{...g,desc:f}:g):u==="remove"?c=s.filter(g=>g.id!==e.id):c=[{id:e.id,desc:f}];return c})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;const o=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:s==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},ept=[Eft,$ft,Lft,Pft,Sft,wft,Uft,Hft,Jft,Oft,zft,Vft,Gft,qft,Bft];function tpt(e){var t,n;const r=[...ept,...(t=e._features)!=null?t:[]];let i={_features:r};const o=i._features.reduce((h,g)=>Object.assign(h,g.getDefaultOptions==null?void 0:g.getDefaultOptions(i)),{}),s=h=>i.options.mergeOptions?i.options.mergeOptions(o,h):{...o,...h};let l={...{},...(n=e.initialState)!=null?n:{}};i._features.forEach(h=>{var g;l=(g=h.getInitialState==null?void 0:h.getInitialState(l))!=null?g:l});const c=[];let u=!1;const f={_features:r,options:{...o,...e},initialState:l,_queue:h=>{c.push(h),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{i.setState(i.initialState)},setOptions:h=>{const g=pu(h,i.options);i.options=s(g)},getState:()=>i.options.state,setState:h=>{i.options.onStateChange==null||i.options.onStateChange(h)},_getRowId:(h,g,y)=>{var E;return(E=i.options.getRowId==null?void 0:i.options.getRowId(h,g,y))!=null?E:`${y?[y.id,g].join("."):g}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(h,g)=>{let y=(g?i.getPrePaginationRowModel():i.getRowModel()).rowsById[h];if(!y&&(y=i.getCoreRowModel().rowsById[h],!y))throw new Error;return y},_getDefaultColumnDef:ut(()=>[i.options.defaultColumn],h=>{var g;return h=(g=h)!=null?g:{},{header:y=>{const E=y.header.column.columnDef;return E.accessorKey?E.accessorKey:E.accessorFn?E.id:null},cell:y=>{var E,S;return(E=(S=y.renderValue())==null||S.toString==null?void 0:S.toString())!=null?E:null},...i._features.reduce((y,E)=>Object.assign(y,E.getDefaultColumnDef==null?void 0:E.getDefaultColumnDef()),{}),...h}},dt(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:ut(()=>[i._getColumnDefs()],h=>{const g=function(y,E,S){return S===void 0&&(S=0),y.map(w=>{const T=xft(i,w,S,E),A=w;return T.columns=A.columns?g(A.columns,T,S+1):[],T})};return g(h)},dt(e,"debugColumns")),getAllFlatColumns:ut(()=>[i.getAllColumns()],h=>h.flatMap(g=>g.getFlatColumns()),dt(e,"debugColumns")),_getAllFlatColumnsById:ut(()=>[i.getAllFlatColumns()],h=>h.reduce((g,y)=>(g[y.id]=y,g),{}),dt(e,"debugColumns")),getAllLeafColumns:ut(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(h,g)=>{let y=h.flatMap(E=>E.getLeafColumns());return g(y)},dt(e,"debugColumns")),getColumn:h=>i._getAllFlatColumnsById()[h]};Object.assign(i,f);for(let h=0;h<i._features.length;h++){const g=i._features[h];g==null||g.createTable==null||g.createTable(i)}return i}function npt(){return e=>ut(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,s){o===void 0&&(o=0);const a=[];for(let c=0;c<i.length;c++){const u=hB(e,e._getRowId(i[c],c,s),i[c],c,o,void 0,s?.id);if(n.flatRows.push(u),n.rowsById[u.id]=u,a.push(u),e.options.getSubRows){var l;u.originalSubRows=e.options.getSubRows(i[c],c),(l=u.originalSubRows)!=null&&l.length&&(u.subRows=r(u.originalSubRows,o+1,u))}}return a};return n.rows=r(t),n},dt(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function rpt(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Nfe(e,t,n){return n.options.filterFromLeafRows?ipt(e,t,n):opt(e,t,n)}function ipt(e,t,n){var r;const i=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;h<l.length;h++){var f;let g=l[h];const y=hB(n,g.id,g.original,g.index,g.depth,void 0,g.parentId);if(y.columnFilters=g.columnFilters,(f=g.subRows)!=null&&f.length&&c<s){if(y.subRows=a(g.subRows,c+1),g=y,t(g)&&!y.subRows.length){u.push(g),o[g.id]=g,i.push(g);continue}if(t(g)||y.subRows.length){u.push(g),o[g.id]=g,i.push(g);continue}}else g=y,t(g)&&(u.push(g),o[g.id]=g,i.push(g))}return u};return{rows:a(e),flatRows:i,rowsById:o}}function opt(e,t,n){var r;const i=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;h<l.length;h++){let g=l[h];if(t(g)){var f;if((f=g.subRows)!=null&&f.length&&c<s){const E=hB(n,g.id,g.original,g.index,g.depth,void 0,g.parentId);E.subRows=a(g.subRows,c+1),g=E}u.push(g),i.push(g),o[g.id]=g}}return u};return{rows:a(e),flatRows:i,rowsById:o}}function spt(){return(e,t)=>ut(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(a=>a.id).filter(a=>a!==t),i?"__global__":void 0].filter(Boolean),s=a=>{for(let l=0;l<o.length;l++)if(a.columnFilters[o[l]]===!1)return!1;return!0};return Nfe(n.rows,s,e)},dt(e.options,"debugTable"))}function apt(){return(e,t)=>ut(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{if(!n)return new Map;let r=new Map;for(let o=0;o<n.flatRows.length;o++){const s=n.flatRows[o].getUniqueValues(t);for(let a=0;a<s.length;a++){const l=s[a];if(r.has(l)){var i;r.set(l,((i=r.get(l))!=null?i:0)+1)}else r.set(l,1)}}return r},dt(e.options,"debugTable"))}function lpt(){return e=>ut(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let h=0;h<t.flatRows.length;h++)t.flatRows[h].columnFilters={},t.flatRows[h].columnFiltersMeta={};return t}const i=[],o=[];(n??[]).forEach(h=>{var g;const y=e.getColumn(h.id);if(!y)return;const E=y.getFilterFn();E&&i.push({id:h.id,filterFn:E,resolvedValue:(g=E.resolveFilterValue==null?void 0:E.resolveFilterValue(h.value))!=null?g:h.value})});const s=(n??[]).map(h=>h.id),a=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());r&&a&&l.length&&(s.push("__global__"),l.forEach(h=>{var g;o.push({id:h.id,filterFn:a,resolvedValue:(g=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?g:r})}));let c,u;for(let h=0;h<t.flatRows.length;h++){const g=t.flatRows[h];if(g.columnFilters={},i.length)for(let y=0;y<i.length;y++){c=i[y];const E=c.id;g.columnFilters[E]=c.filterFn(g,E,c.resolvedValue,S=>{g.columnFiltersMeta[E]=S})}if(o.length){for(let y=0;y<o.length;y++){u=o[y];const E=u.id;if(u.filterFn(g,E,u.resolvedValue,S=>{g.columnFiltersMeta[E]=S})){g.columnFilters.__global__=!0;break}}g.columnFilters.__global__!==!0&&(g.columnFilters.__global__=!1)}}const f=h=>{for(let g=0;g<s.length;g++)if(h.columnFilters[s[g]]===!1)return!1;return!0};return Nfe(t.rows,f,e)},dt(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function cpt(e){return t=>ut(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:s,flatRows:a,rowsById:l}=r;const c=i*o,u=c+i;s=s.slice(c,u);let f;t.options.paginateExpandedRows?f={rows:s,flatRows:a,rowsById:l}:f=rpt({rows:s,flatRows:a,rowsById:l}),f.flatRows=[];const h=g=>{f.flatRows.push(g),g.subRows.length&&g.subRows.forEach(h)};return f.rows.forEach(h),f},dt(t.options,"debugTable"))}function upt(){return e=>ut(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(l=>{var c;return(c=e.getColumn(l.id))==null?void 0:c.getCanSort()}),s={};o.forEach(l=>{const c=e.getColumn(l.id);c&&(s[l.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const a=l=>{const c=l.map(u=>({...u}));return c.sort((u,f)=>{for(let g=0;g<o.length;g+=1){var h;const y=o[g],E=s[y.id],S=E.sortUndefined,w=(h=y?.desc)!=null?h:!1;let T=0;if(S){const A=u.getValue(y.id),R=f.getValue(y.id),_=A===void 0,D=R===void 0;if(_||D){if(S==="first")return _?-1:1;if(S==="last")return _?1:-1;T=_&&D?0:_?S:-S}}if(T===0&&(T=E.sortingFn(u,f,y.id)),T!==0)return w&&(T*=-1),E.invertSorting&&(T*=-1),T}return u.index-f.index}),c.forEach(u=>{var f;i.push(u),(f=u.subRows)!=null&&f.length&&(u.subRows=a(u.subRows))}),c};return{rows:a(n.rows),flatRows:i,rowsById:n.rowsById}},dt(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function jY(e,t){return e?dpt(e)?v.createElement(e,t):e:null}function dpt(e){return fpt(e)||typeof e=="function"||ppt(e)}function fpt(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function ppt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function hpt(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:tpt(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:s=>{i(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}const _fe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{className:"relative w-full overflow-auto",children:m.jsx("table",{ref:n,className:Se("w-full caption-bottom text-sm",e),...t})}));_fe.displayName="Table";const Rfe=v.forwardRef(({className:e,...t},n)=>m.jsx("thead",{ref:n,className:Se("[&_tr]:border-b",e),...t}));Rfe.displayName="TableHeader";const Dfe=v.forwardRef(({className:e,...t},n)=>m.jsx("tbody",{ref:n,className:Se("[&_tr:last-child]:border-0",e),...t}));Dfe.displayName="TableBody";const mpt=v.forwardRef(({className:e,...t},n)=>m.jsx("tfoot",{ref:n,className:Se("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));mpt.displayName="TableFooter";const lE=v.forwardRef(({className:e,...t},n)=>m.jsx("tr",{ref:n,className:Se("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));lE.displayName="TableRow";const Ife=v.forwardRef(({className:e,...t},n)=>m.jsx("th",{ref:n,className:Se("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Ife.displayName="TableHead";const BI=v.forwardRef(({className:e,...t},n)=>m.jsx("td",{ref:n,className:Se("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));BI.displayName="TableCell";const gpt=v.forwardRef(({className:e,...t},n)=>m.jsx("caption",{ref:n,className:Se("mt-4 text-sm text-muted-foreground",e),...t}));gpt.displayName="TableCaption";function bpt({table:e,showRowSelection:t=!0}){return m.jsxs("div",{className:"flex items-center justify-between px-2",children:[t&&m.jsxs("div",{className:"flex-1 text-sm text-muted-foreground",children:[e.getFilteredSelectedRowModel().rows.length," of"," ",e.getFilteredRowModel().rows.length," row(s) selected."]}),m.jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),m.jsxs(Yi,{value:`${e.getState().pagination.pageSize}`,onValueChange:n=>{e.setPageSize(Number(n))},children:[m.jsx(Pi,{className:"h-8 w-[70px]",children:m.jsx(Ki,{placeholder:e.getState().pagination.pageSize})}),m.jsx(Fi,{side:"top",children:[10,20,30,40,50].map(n=>m.jsx(yn,{value:`${n}`,children:n},n))})]})]}),m.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of ",e.getPageCount()]}),m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsxs($e,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to first page"}),m.jsx(Bme,{className:"h-4 w-4"})]}),m.jsxs($e,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to previous page"}),m.jsx(Mme,{className:"h-4 w-4"})]}),m.jsxs($e,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to next page"}),m.jsx(vh,{className:"h-4 w-4"})]}),m.jsxs($e,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to last page"}),m.jsx($me,{className:"h-4 w-4"})]})]})]})]})}function ypt({columns:e,data:t,toolbar:n,onRowClick:r,showPagination:i=!0,showRowSelection:o=!0,initialSorting:s=[],onSelectionChange:a}){const[l,c]=v.useState({}),[u,f]=v.useState({}),[h,g]=v.useState([]),[y,E]=v.useState(s),S=hpt({data:t,columns:e,state:{sorting:y,columnVisibility:u,rowSelection:l,columnFilters:h},enableRowSelection:!0,onRowSelectionChange:c,onSortingChange:E,onColumnFiltersChange:g,onColumnVisibilityChange:f,getCoreRowModel:npt(),getFilteredRowModel:lpt(),getPaginationRowModel:cpt(),getSortedRowModel:upt(),getFacetedRowModel:spt(),getFacetedUniqueValues:apt()});return v.useEffect(()=>{if(a){const w=S.getFilteredSelectedRowModel().rows.map(T=>T.original);a(w)}},[l,a,S]),m.jsxs("div",{className:"space-y-4",children:[n,m.jsx("div",{className:"rounded-md border",children:m.jsxs(_fe,{children:[m.jsx(Rfe,{children:S.getHeaderGroups().map(w=>m.jsx(lE,{children:w.headers.map(T=>m.jsx(Ife,{colSpan:T.colSpan,children:T.isPlaceholder?null:jY(T.column.columnDef.header,T.getContext())},T.id))},w.id))}),m.jsx(Dfe,{children:S.getRowModel().rows?.length?S.getRowModel().rows.map(w=>m.jsx(lE,{"data-state":w.getIsSelected()&&"selected",onClick:()=>r?.(w.original),className:r?"cursor-pointer":"",children:w.getVisibleCells().map(T=>m.jsx(BI,{children:jY(T.column.columnDef.cell,T.getContext())},T.id))},w.id)):m.jsx(lE,{children:m.jsx(BI,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),i&&m.jsx(bpt,{table:S,showRowSelection:o})]})}const Ofe=Ule,Mfe=Hle,vpt=v.forwardRef(({className:e,inset:t,children:n,...r},i)=>m.jsxs(SF,{ref:i,className:Se("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,m.jsx(vh,{className:"ml-auto"})]}));vpt.displayName=SF.displayName;const xpt=v.forwardRef(({className:e,...t},n)=>m.jsx(wF,{ref:n,className:Se("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));xpt.displayName=wF.displayName;const yB=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(int,{children:m.jsx(gF,{ref:r,sideOffset:t,className:Se("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","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-[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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));yB.displayName=gF.displayName;const $b=v.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(yF,{ref:r,className:Se("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));$b.displayName=yF.displayName;const Ept=v.forwardRef(({className:e,children:t,checked:n,...r},i)=>m.jsxs(vF,{ref:i,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(xF,{children:m.jsx(Ds,{className:"h-4 w-4"})})}),t]}));Ept.displayName=vF.displayName;const Spt=v.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(zle,{ref:r,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(xF,{children:m.jsx(ZY,{className:"h-2 w-2 fill-current"})})}),t]}));Spt.displayName=zle.displayName;const wpt=v.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(bF,{ref:r,className:Se("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));wpt.displayName=bF.displayName;const Lfe=v.forwardRef(({className:e,...t},n)=>m.jsx(EF,{ref:n,className:Se("-mx-1 my-1 h-px bg-muted",e),...t}));Lfe.displayName=EF.displayName;function wd({column:e,title:t,className:n}){return e.getCanSort()?m.jsx("div",{className:Se("flex items-center space-x-2",n),children:m.jsxs(Ofe,{children:[m.jsx(Mfe,{asChild:!0,children:m.jsxs($e,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[m.jsx("span",{children:t}),e.getIsSorted()==="desc"?m.jsx(V_,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?m.jsx(yh,{className:"ml-2 h-4 w-4"}):m.jsx(cE,{className:"ml-2 h-4 w-4"})]})}),m.jsxs(yB,{align:"start",children:[m.jsxs($b,{onClick:()=>e.toggleSorting(!1),children:[m.jsx(yh,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),m.jsxs($b,{onClick:()=>e.toggleSorting(!0),children:[m.jsx(V_,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),e.getCanHide()&&m.jsxs(m.Fragment,{children:[m.jsx(Lfe,{}),m.jsxs($b,{onClick:()=>e.toggleVisibility(!1),children:[m.jsx(G_,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})]})}):m.jsx("div",{className:Se(n),children:t})}const Cpt=[{id:"select",header:({table:e})=>m.jsx(aw,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":"Select all",className:"translate-y-[2px]",onClick:t=>t.stopPropagation()}),cell:({row:e})=>m.jsx(aw,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":"Select row",className:"translate-y-[2px]",onClick:t=>t.stopPropagation()}),enableSorting:!1,enableHiding:!1},{accessorKey:"id",header:({column:e})=>m.jsx(wd,{column:e,title:"ID"}),cell:({row:e})=>m.jsxs("div",{className:"w-[60px] font-mono text-xs text-muted-foreground",children:["#",e.getValue("id")]}),enableSorting:!0,enableHiding:!1},{accessorKey:"title",header:({column:e})=>m.jsx(wd,{column:e,title:"Title"}),cell:({row:e})=>{const t=e.original;return m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("span",{className:"font-medium line-clamp-1",children:t.title}),t.description&&m.jsx("span",{className:"text-xs text-muted-foreground line-clamp-1",children:t.description})]})},enableSorting:!0},{accessorKey:"status",header:({column:e})=>m.jsx(wd,{column:e,title:"Status"}),cell:({row:e})=>{const t=e.getValue("status");return m.jsx(rde,{status:t})},filterFn:(e,t,n)=>n.includes(e.getValue(t)),enableSorting:!0},{accessorKey:"priority",header:({column:e})=>m.jsx(wd,{column:e,title:"Priority"}),cell:({row:e})=>{const t=e.getValue("priority");return m.jsx(ide,{priority:t})},filterFn:(e,t,n)=>n.includes(e.getValue(t)),enableSorting:!0,sortingFn:(e,t)=>{const n={high:0,medium:1,low:2},r=n[e.getValue("priority")]??1,i=n[t.getValue("priority")]??1;return r-i}},{accessorKey:"assignee",header:({column:e})=>m.jsx(wd,{column:e,title:"Assignee"}),cell:({row:e})=>{const t=e.getValue("assignee");return t?m.jsx("span",{className:"text-sm font-mono",children:t}):m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})},filterFn:(e,t,n)=>{const r=e.getValue(t);return r?n.includes(r):n.includes("unassigned")},enableSorting:!0},{accessorKey:"labels",header:({column:e})=>m.jsx(wd,{column:e,title:"Labels"}),cell:({row:e})=>{const t=e.getValue("labels");return t.length>0?m.jsx(ode,{labels:t,maxVisible:2}):m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})},filterFn:(e,t,n)=>{const r=e.getValue(t);return n.some(i=>r.includes(i))},enableSorting:!1},{accessorKey:"acceptanceCriteria",header:({column:e})=>m.jsx(wd,{column:e,title:"Progress"}),cell:({row:e})=>{const t=e.original.acceptanceCriteria;if(t.length===0)return m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"});const n=t.filter(o=>o.completed).length,r=t.length,i=Math.round(n/r*100);return m.jsxs("div",{className:"flex items-center gap-2 min-w-[80px]",children:[m.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:m.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${i}%`}})}),m.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[n,"/",r]})]})},enableSorting:!1}];function Tpt({globalFilter:e,setGlobalFilter:t,statusFilter:n,setStatusFilter:r,priorityFilter:i,setPriorityFilter:o,onNewTask:s}){const a=e||n!=="all"||i!=="all";return m.jsxs("div",{className:"flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[m.jsxs("div",{className:"relative w-[250px]",children:[m.jsx(Ew,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),m.jsx(qr,{placeholder:"Search tasks...",value:e,onChange:l=>t(l.target.value),className:"pl-8"})]}),m.jsxs(Yi,{value:n,onValueChange:r,children:[m.jsx(Pi,{className:"w-[150px]",children:m.jsx(Ki,{placeholder:"Status"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Status"}),m.jsx(yn,{value:"todo",children:"To Do"}),m.jsx(yn,{value:"in-progress",children:"In Progress"}),m.jsx(yn,{value:"in-review",children:"In Review"}),m.jsx(yn,{value:"blocked",children:"Blocked"}),m.jsx(yn,{value:"done",children:"Done"})]})]}),m.jsxs(Yi,{value:i,onValueChange:o,children:[m.jsx(Pi,{className:"w-[150px]",children:m.jsx(Ki,{placeholder:"Priority"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Priority"}),m.jsx(yn,{value:"high",children:"High"}),m.jsx(yn,{value:"medium",children:"Medium"}),m.jsx(yn,{value:"low",children:"Low"})]})]}),a&&m.jsxs($e,{variant:"ghost",onClick:()=>{t(""),r("all"),o("all")},className:"h-8 px-2 lg:px-3",children:["Reset",m.jsx(Yo,{className:"ml-2 h-4 w-4"})]})]}),s&&m.jsxs($e,{onClick:s,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"mr-2 h-4 w-4"}),"New Task"]})]})}function kpt({tasks:e,onTaskClick:t,onSelectionChange:n,onNewTask:r}){const[i,o]=v.useState(""),[s,a]=v.useState("all"),[l,c]=v.useState("all"),u=v.useMemo(()=>{let f=e;if(i){const h=i.toLowerCase();f=f.filter(g=>g.id.toLowerCase().includes(h)||g.title.toLowerCase().includes(h)||g.description?.toLowerCase().includes(h)||g.assignee?.toLowerCase().includes(h)||g.labels.some(y=>y.toLowerCase().includes(h)))}return s!=="all"&&(f=f.filter(h=>h.status===s)),l!=="all"&&(f=f.filter(h=>h.priority===l)),f},[e,i,s,l]);return m.jsx(ypt,{columns:Cpt,data:u,onRowClick:t,onSelectionChange:n,showPagination:!0,showRowSelection:!0,initialSorting:[{id:"priority",desc:!1}],toolbar:m.jsx(Tpt,{table:null,globalFilter:i,setGlobalFilter:o,statusFilter:s,setStatusFilter:a,priorityFilter:l,setPriorityFilter:c,onNewTask:r})})}const H_=["todo","in-progress","in-review","done","blocked","on-hold","urgent"],Apt=["gray","blue","green","yellow","red","purple","orange","pink","cyan","indigo"];function Npt(){const{config:e,loading:t,updateConfig:n}=bf(),[r,i]=v.useState({}),[o,s]=v.useState(!1),[a,l]=v.useState(null),[c,u]=v.useState("form"),[f,h]=v.useState(""),[g,y]=v.useState(null),[E,S]=v.useState(""),[w,T]=v.useState(!1);v.useEffect(()=>{!t&&!w&&(i(e),h(JSON.stringify(e,null,2)),T(!0))},[e,t,w]);const A=r,R=i;v.useEffect(()=>{c==="form"&&h(JSON.stringify(A,null,2))},[A,c]);const _=async()=>{s(!0),l(null);try{let F=A;if(c==="json")try{F=JSON.parse(f),R(F),y(null)}catch{y("Invalid JSON syntax"),s(!1);return}await n(F),l({type:"success",text:"Configuration saved successfully!"}),setTimeout(()=>l(null),3e3)}catch(F){l({type:"error",text:F instanceof Error?F.message:"Failed to save config"})}finally{s(!1)}},D=()=>{if(!E.trim())return;const F=E.toLowerCase().replace(/\s+/g,"-"),H=A.statuses||H_;if(H.includes(F)){l({type:"error",text:"Status already exists"});return}R({...A,statuses:[...H,F],statusColors:{...A.statusColors||{},[F]:"gray"}}),S("")},I=F=>{const H=A.statuses||H_,Y={...A.statusColors||{}};delete Y[F],R({...A,statuses:H.filter($=>$!==F),statusColors:Y,visibleColumns:(A.visibleColumns||[]).filter($=>$!==F)})},M=(F,H)=>{R({...A,statusColors:{...A.statusColors||{},[F]:H}})};if(t)return m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading configuration..."})});const j=A.statuses||H_,L=A.statusColors||{};return m.jsx(Xi,{className:"h-full",children:m.jsxs("div",{className:"p-6 max-w-3xl",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(HI,{className:"w-6 h-6"}),m.jsx("h1",{className:"text-2xl font-bold",children:"Configuration"})]}),m.jsxs("div",{className:"flex rounded-lg border overflow-hidden",children:[m.jsxs("button",{type:"button",onClick:()=>u("form"),className:`px-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${c==="form"?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:[m.jsx(Bge,{className:"w-4 h-4"}),"Form"]}),m.jsxs("button",{type:"button",onClick:()=>u("json"),className:`px-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${c==="json"?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:[m.jsx(Zme,{className:"w-4 h-4"}),"JSON"]})]})]}),a&&m.jsx("div",{className:`mb-6 p-4 rounded-lg ${a.type==="success"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-200"}`,children:a.text}),c==="json"?m.jsxs("div",{className:"bg-card rounded-lg border p-6 space-y-4",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"config.json"}),m.jsx("textarea",{value:f,onChange:F=>{h(F.target.value),y(null)},className:"w-full h-96 px-3 py-2 rounded-lg border bg-input font-mono text-sm focus:outline-none focus:ring-2 focus:ring-ring",spellCheck:!1}),g&&m.jsx("p",{className:"mt-2 text-sm text-destructive",children:g})]}),m.jsx("div",{className:"pt-4 border-t",children:m.jsxs($e,{onClick:_,disabled:o,children:[m.jsx(Ds,{className:"w-4 h-4 mr-2"}),o?"Saving...":"Save Configuration"]})})]}):m.jsxs("div",{className:"bg-card rounded-lg border p-6 space-y-6",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Project Name"}),m.jsx(qr,{type:"text",value:A.name||"",onChange:F=>R({...A,name:F.target.value}),placeholder:"My Project"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Name of your project"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Assignee"}),m.jsx(qr,{type:"text",value:A.defaultAssignee||"",onChange:F=>R({...A,defaultAssignee:F.target.value}),placeholder:"@username"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default assignee for new tasks (e.g., @claude)"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Priority"}),m.jsxs("select",{value:A.defaultPriority||"medium",onChange:F=>R({...A,defaultPriority:F.target.value}),className:"w-full px-3 py-2 rounded-lg border bg-input focus:outline-none focus:ring-2 focus:ring-ring",children:[m.jsx("option",{value:"low",children:"Low"}),m.jsx("option",{value:"medium",children:"Medium"}),m.jsx("option",{value:"high",children:"High"})]}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default priority for new tasks"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Labels"}),m.jsx(qr,{type:"text",value:A.defaultLabels?.join(", ")||"",onChange:F=>R({...A,defaultLabels:F.target.value.split(",").map(H=>H.trim()).filter(Boolean)}),placeholder:"frontend, backend, ui"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Comma-separated list of default labels for new tasks"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Time Format"}),m.jsxs("select",{value:A.timeFormat||"24h",onChange:F=>R({...A,timeFormat:F.target.value}),className:"w-full px-3 py-2 rounded-lg border bg-input focus:outline-none focus:ring-2 focus:ring-ring",children:[m.jsx("option",{value:"12h",children:"12-hour (AM/PM)"}),m.jsx("option",{value:"24h",children:"24-hour"})]}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Time display format"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Editor"}),m.jsx(qr,{type:"text",value:A.editor||"",onChange:F=>R({...A,editor:F.target.value}),placeholder:"code, vim, nano"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default editor command for editing files"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Task Statuses"}),m.jsx("div",{className:"space-y-2 mb-3",children:j.map(F=>m.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-accent",children:[m.jsx("span",{className:"flex-1 font-mono text-sm",children:F}),m.jsx("select",{value:L[F]||"gray",onChange:H=>M(F,H.target.value),className:"px-2 py-1 rounded border bg-input text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:Apt.map(H=>m.jsx("option",{value:H,children:H},H))}),m.jsx("button",{type:"button",onClick:()=>I(F),className:"p-1 text-destructive hover:text-destructive hover:bg-destructive/10 rounded transition-colors",title:"Remove status",children:m.jsx(Wd,{className:"w-4 h-4"})})]},F))}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(qr,{type:"text",value:E,onChange:F=>S(F.target.value),placeholder:"new-status",className:"flex-1",onKeyDown:F=>F.key==="Enter"&&D()}),m.jsxs($e,{onClick:D,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"Add"]})]}),m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Define custom task statuses and their colors for the Kanban board"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Visible Kanban Columns"}),m.jsx("div",{className:"space-y-2",children:j.map(F=>{const H=A.visibleColumns?.includes(F)??!0,Y=F.split("-").map($=>$.charAt(0).toUpperCase()+$.slice(1)).join(" ");return m.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",children:[m.jsx("input",{type:"checkbox",checked:H,onChange:$=>{const G=A.visibleColumns||j,V=$.target.checked?[...G,F]:G.filter(X=>X!==F);R({...A,visibleColumns:V})},className:"w-4 h-4 rounded border-border text-primary focus:ring-primary"}),m.jsx("span",{children:Y})]},F)})}),m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Select which columns to show in the Kanban board"})]}),m.jsx("div",{className:"pt-4 border-t",children:m.jsxs($e,{onClick:_,disabled:o,children:[m.jsx(Ds,{className:"w-4 h-4 mr-2"}),o?"Saving...":"Save Configuration"]})})]})]})})}function _pt(){const[e,t]=v.useState([]),[n,r]=v.useState(!0),[i,o]=v.useState(null),[s,a]=v.useState(!1),[l,c]=v.useState(""),[u,f]=v.useState(!1),[h,g]=v.useState(!1),[y,E]=v.useState(""),[S,w]=v.useState(""),[T,A]=v.useState(""),[R,_]=v.useState(""),[D,I]=v.useState(""),[M,j]=v.useState(!1),[L,F]=v.useState(new Set(["(root)"])),[H,Y]=v.useState(!1),$=v.useRef(null);v.useEffect(()=>{V()},[]),xu("docs:updated",()=>{V()}),xu("docs:refresh",()=>{V()});const G=v.useCallback(()=>{if(e.length===0)return;const te=window.location.hash.match(/^#\/docs\/(.+)$/);if(te){const oe=decodeURIComponent(te[1]),ue=SE(oe).replace(/^\.\//,"").replace(/^\//,""),Te=e.find(Ie=>{const ke=SE(Ie.path);return ke===ue||ke.endsWith(`/${ue}`)||Ie.filename===ue});Te&&Te!==i&&(o(Te),a(!1))}},[e,i]);v.useEffect(()=>{G()},[G]),v.useEffect(()=>{if(!i||!i.folder)return;const se=i.folder.split("/"),te=[];let oe="";for(const ue of se)oe=oe?`${oe}/${ue}`:ue,te.push(oe);F(ue=>{const Te=new Set(ue);for(const Ie of te)Te.add(Ie);return Te})},[i]),v.useEffect(()=>(window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)),[G]),v.useEffect(()=>{const se=oe=>{let ue=oe.target;for(;ue&&ue.tagName!=="A"&&ue!==$.current;)ue=ue.parentElement;if(ue&&ue.tagName==="A"){const Ie=ue.getAttribute("href");if(Ie&&/^task-\d+(.md)?$/.test(Ie)){oe.preventDefault();const ke=Ie.replace(".md","");window.location.hash=`/tasks?task=${ke}`;return}if(Ie&&(Ie.endsWith(".md")||Ie.includes(".md#"))){oe.preventDefault();let ke=Ie.replace(/^\.\//,"").replace(/^\//,"");ke=ke.split("#")[0],window.location.hash=`/docs/${ke}`}}},te=$.current;if(te)return te.addEventListener("click",se),()=>te.removeEventListener("click",se)},[e,i]);const V=()=>{jI().then(se=>{t(se),r(!1)}).catch(se=>{console.error("Failed to load docs:",se),r(!1)})},X=async()=>{if(!y.trim()){alert("Please enter a title");return}j(!0);try{const se=T.split(",").map(te=>te.trim()).filter(te=>te);await ume({title:y,description:S,tags:se,folder:R,content:D}),E(""),w(""),A(""),_(""),I(""),g(!1),V()}catch(se){console.error("Failed to create doc:",se),alert("Failed to create document. Please try again.")}finally{j(!1)}},Q=()=>{i&&(c(i.content),a(!0))},J=()=>{if(i){const te=`@doc/${kN(i.path).replace(/\.md$/,"")}`;navigator.clipboard.writeText(te).then(()=>{Y(!0),setTimeout(()=>Y(!1),2e3)})}},B=async()=>{if(i){f(!0);try{const se=await dme(wSe(i.path),{content:l});t(te=>te.map(oe=>oe.path===i.path?{...oe,content:l,metadata:{...oe.metadata,updatedAt:new Date().toISOString()}}:oe)),o(te=>te&&{...te,content:l}),a(!1)}catch(se){console.error("Failed to save doc:",se),alert(se instanceof Error?se.message:"Failed to save document")}finally{f(!1)}}},W=()=>{a(!1),c("")},K=se=>{F(te=>{const oe=new Set(te);return oe.has(se)?oe.delete(se):oe.add(se),oe})},P=()=>{const se={name:"(root)",path:"",docs:[],children:new Map};for(const te of e)if(!te.folder)se.docs.push(te);else{const oe=te.folder.split("/");let ue=se;for(let Te=0;Te<oe.length;Te++){const Ie=oe[Te],ke=oe.slice(0,Te+1).join("/");ue.children.has(Ie)||ue.children.set(Ie,{name:Ie,path:ke,docs:[],children:new Map}),ue=ue.children.get(Ie)}ue.docs.push(te)}return se},ce=se=>{let te=se.docs.length;for(const oe of se.children.values())te+=ce(oe);return te},le=(se,te=0)=>{const oe=[],ue=te===0||L.has(se.path),Te=`${te*16}px`;if(te>0){const Ie=ce(se);oe.push(m.jsxs("button",{type:"button",onClick:()=>K(se.path),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-accent text-foreground transition-colors",style:{paddingLeft:Te},children:[ue?m.jsx(Eu,{className:"w-4 h-4"}):m.jsx(vh,{className:"w-4 h-4"}),ue?m.jsx(cge,{className:"w-4 h-4"}):m.jsx(S9,{className:"w-4 h-4"}),m.jsx("span",{className:"text-sm font-medium",children:se.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",Ie,")"]})]},`folder-${se.path}`))}if(ue||te===0){const Ie=Array.from(se.children.values()).sort((tt,rt)=>tt.name.localeCompare(rt.name));for(const tt of Ie)oe.push(...le(tt,te+1));const ke=[...se.docs].sort((tt,rt)=>tt.metadata.title.localeCompare(rt.metadata.title));for(const tt of ke)oe.push(m.jsxs("button",{type:"button",onClick:()=>{window.location.hash=`/docs/${kN(tt.path)}`},className:`w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-accent text-foreground transition-colors ${i?.path===tt.path?"bg-accent":""}`,style:{paddingLeft:`${(te+1)*16}px`},children:[m.jsx(Xo,{className:"w-5 h-5"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-sm font-medium truncate",children:tt.metadata.title}),tt.metadata.description&&m.jsx("div",{className:"text-xs text-muted-foreground truncate",children:tt.metadata.description})]})]},`doc-${tt.path}`))}return oe};return n?m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading documentation..."})}):m.jsxs("div",{className:"p-6 h-full flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"Documentation"}),m.jsxs($e,{onClick:()=>g(!0),className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"New Document"]})]}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0 overflow-hidden",children:[m.jsxs("div",{className:"lg:col-span-1 flex flex-col min-h-0 overflow-hidden",children:[m.jsxs("div",{className:"bg-card rounded-lg border overflow-hidden flex flex-col flex-1 min-h-0",children:[m.jsx("div",{className:"p-4 border-b shrink-0",children:m.jsxs("h2",{className:"font-semibold",children:["All Documents (",e.length,")"]})}),m.jsx(Xi,{className:"flex-1",children:le(P())})]}),e.length===0&&m.jsxs("div",{className:"bg-card rounded-lg border p-8 text-center",children:[m.jsx(Xo,{className:"w-5 h-5"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"No documentation found"}),m.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Create a doc with: ",m.jsx("code",{className:"font-mono",children:'knowns doc create "Title"'})]})]})]}),m.jsx("div",{className:"lg:col-span-2 flex flex-col min-h-0 overflow-hidden",children:i?m.jsxs("div",{className:"bg-card rounded-lg border overflow-hidden flex flex-col flex-1 min-h-0",children:[m.jsxs("div",{className:"p-6 border-b flex items-start justify-between shrink-0",children:[m.jsxs("div",{className:"flex-1",children:[m.jsx("h2",{className:"text-2xl font-bold mb-2",children:i.metadata.title}),i.metadata.description&&m.jsx("p",{className:"text-muted-foreground mb-2",children:i.metadata.description}),m.jsxs("button",{type:"button",onClick:J,className:"flex items-center gap-2 px-2 py-1 rounded text-xs text-blue-600 dark:text-blue-400 hover:bg-accent transition-colors group",title:"Click to copy reference",children:[m.jsx(S9,{className:"w-4 h-4"}),m.jsxs("span",{className:"font-mono",children:["@doc/",kN(i.path).replace(/\.md$/,"")]}),m.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:H?"✓ Copied!":m.jsx(tge,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["Last updated: ",new Date(i.metadata.updatedAt).toLocaleString()]})]}),m.jsx("div",{className:"flex gap-2 ml-4",children:s?m.jsxs(m.Fragment,{children:[m.jsxs($e,{onClick:B,disabled:u,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Ds,{className:"w-4 h-4 mr-2"}),u?"Saving...":"Save"]}),m.jsxs($e,{variant:"secondary",onClick:W,disabled:u,children:[m.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Cancel"]})]}):m.jsxs($e,{onClick:Q,children:[m.jsx(oK,{className:"w-4 h-4 mr-2"}),"Edit"]})})]}),s?m.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:m.jsx("div",{className:"flex-1 p-6 min-h-0",children:m.jsx(yu,{markdown:l,onChange:c,placeholder:"Write your documentation here..."})})}):m.jsx(Xi,{className:"flex-1",children:m.jsx("div",{className:"p-6 prose prose-sm dark:prose-invert max-w-none",ref:$,children:m.jsx(bC,{markdown:i.content||""})})})]}):m.jsxs("div",{className:"bg-card rounded-lg border p-12 text-center",children:[m.jsx(Xo,{className:"w-5 h-5"}),m.jsx("p",{className:"mt-4 text-muted-foreground",children:"Select a document to view its content"})]})})]}),h&&m.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:m.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-4xl w-full h-[90vh] flex flex-col",children:[m.jsx("div",{className:"p-6 border-b shrink-0",children:m.jsx("h2",{className:"text-xl font-bold",children:"Create New Document"})}),m.jsxs("div",{className:"p-6 space-y-4 flex-1 flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Title *"}),m.jsx(qr,{type:"text",value:y,onChange:se=>E(se.target.value),placeholder:"Document title"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Description"}),m.jsx(qr,{type:"text",value:S,onChange:se=>w(se.target.value),placeholder:"Brief description"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Folder (optional)"}),m.jsx(qr,{type:"text",value:R,onChange:se=>_(se.target.value),placeholder:"api/auth, guides, etc. (leave empty for root)"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Tags (comma-separated)"}),m.jsx(qr,{type:"text",value:T,onChange:se=>A(se.target.value),placeholder:"guide, tutorial, api"})]}),m.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Content"}),m.jsx("div",{className:"flex-1 min-h-[400px]",children:m.jsx(yu,{markdown:D,onChange:I,placeholder:"Write your documentation here..."})})]})]}),m.jsxs("div",{className:"p-6 border-t flex justify-end gap-3 shrink-0",children:[m.jsx($e,{variant:"secondary",onClick:()=>{g(!1),E(""),w(""),A(""),_(""),I("")},disabled:M,children:"Cancel"}),m.jsx($e,{onClick:X,disabled:M||!y.trim(),className:"bg-green-700 hover:bg-green-800 text-white",children:M?"Creating...":"Create Document"})]})]})})]})}const Rpt=[{label:"1 hour ago",value:3600*1e3},{label:"1 day ago",value:1440*60*1e3},{label:"1 week ago",value:10080*60*1e3},{label:"1 month ago",value:720*60*60*1e3},{label:"3 months ago",value:2160*60*60*1e3}];function $Y({tasks:e,loading:t,onTasksUpdate:n,onNewTask:r}){const i=s=>{const a=Date.now()-s;return e.filter(l=>l.status==="done"&&new Date(l.updatedAt).getTime()<a).length},o=async(s,a)=>{try{const l=await ua.batchArchiveTasks(s);if(l.count>0){const c=new Set(l.tasks.map(u=>u.id));n(e.filter(u=>!c.has(u.id))),Kl.success(`Archived ${l.count} task${l.count>1?"s":""} done before ${a}`)}else Kl.info(`No done tasks found before ${a}`)}catch(l){console.error("Failed to batch archive tasks:",l),Kl.error("Failed to archive tasks")}};return m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsx("div",{className:"shrink-0 p-6 pb-0",children:m.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"Kanban Board"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(Ofe,{children:[m.jsx(Mfe,{asChild:!0,children:m.jsxs($e,{variant:"outline",size:"default",className:"gap-2",children:[m.jsx(z_,{className:"w-4 h-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Batch Archive"}),m.jsx(Eu,{className:"w-3 h-3"})]})}),m.jsx(yB,{align:"end",children:Rpt.map(s=>{const a=i(s.value);return m.jsxs($b,{onClick:()=>o(s.value,s.label),disabled:a===0,children:[m.jsxs("span",{className:"flex-1",children:["Done before ",s.label]}),m.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",a,")"]})]},s.value)})})]}),m.jsxs($e,{onClick:r,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"New Task"]})]})]})}),m.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-6",children:m.jsx(Ddt,{tasks:e,loading:t,onTasksUpdate:n})})]})}const UY={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold",urgent:"Urgent"};function Dpt(e){return UY[e]?UY[e]:e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Ipt({tasks:e,onTaskClick:t,onNewTask:n}){const[r,i]=v.useState("all"),[o,s]=v.useState("all"),[a,l]=v.useState(new Set),c=e.filter(g=>g.subtasks&&g.subtasks.length>0);let u=r==="all"?e:e.filter(g=>g.status===r);o==="root"?u=u.filter(g=>!g.parent):o!=="all"&&(u=u.filter(g=>g.parent===o));const f={todo:[],"in-progress":[],"in-review":[],blocked:[],done:[]};for(const g of u)f[g.status]&&f[g.status].push(g);const h={high:0,medium:1,low:2};for(const g in f)f[g].sort((y,E)=>{const S=h[y.priority]-h[E.priority];return S!==0?S:y.id.localeCompare(E.id,void 0,{numeric:!0})});return m.jsxs("div",{className:"h-full flex flex-col",children:[m.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsx($I,{className:"w-4 h-4 text-muted-foreground"}),m.jsxs(Yi,{value:r,onValueChange:i,children:[m.jsx(Pi,{className:"w-[150px]",children:m.jsx(Ki,{placeholder:"Status"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Status"}),m.jsx(yn,{value:"todo",children:"To Do"}),m.jsx(yn,{value:"in-progress",children:"In Progress"}),m.jsx(yn,{value:"in-review",children:"In Review"}),m.jsx(yn,{value:"blocked",children:"Blocked"}),m.jsx(yn,{value:"done",children:"Done"})]})]}),m.jsxs(Yi,{value:o,onValueChange:s,children:[m.jsx(Pi,{className:"w-[200px]",children:m.jsx(Ki,{placeholder:"Parent"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Tasks"}),m.jsx(yn,{value:"root",children:"Root Tasks Only"}),c.map(g=>{const y=`Subtasks of #${g.id}: ${g.title}`,E=y.length>40?y.substring(0,40)+"...":y;return m.jsx(yn,{value:g.id,title:y,children:E},g.id)})]})]}),m.jsxs("span",{className:"text-muted-foreground text-sm",children:[u.length," ",u.length===1?"task":"tasks"]})]}),m.jsxs($e,{onClick:n,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"mr-2 h-4 w-4"}),"New Task"]})]}),m.jsx(Xi,{className:"flex-1",children:m.jsxs("div",{className:"space-y-6 pr-4",children:[Object.entries(f).map(([g,y])=>y.length===0?null:m.jsxs("div",{children:[m.jsxs("h2",{className:"text-lg font-semibold mb-3",children:[Dpt(g)," (",y.length,")"]}),m.jsx("div",{className:"space-y-2",children:y.map(E=>{const S=a.has(E.id),w=E.parent?e.find(T=>T.id===E.parent):null;return m.jsx("div",{className:"bg-card rounded-lg p-4 border transition-colors hover:bg-accent/50",children:m.jsxs("div",{className:"flex items-start gap-3",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["#",E.id]}),m.jsx(rde,{status:E.status}),m.jsx(ide,{priority:E.priority}),w&&m.jsxs("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",children:["Subtask of #",w.id]}),E.subtasks&&E.subtasks.length>0&&m.jsxs("span",{className:"text-xs px-2 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",children:[E.subtasks.length," subtask",E.subtasks.length>1?"s":""]})]}),m.jsx("button",{type:"button",onClick:()=>t(E),className:"font-medium mb-1 hover:underline text-left w-full",children:E.title}),E.description&&m.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:[m.jsx("p",{className:S?"":"line-clamp-2",children:E.description}),E.description.length>100&&m.jsx("button",{type:"button",onClick:T=>{T.stopPropagation();const A=new Set(a);S?A.delete(E.id):A.add(E.id),l(A)},className:"text-xs text-primary hover:underline mt-1 font-medium",children:S?"Show less":"Show more"})]}),E.acceptanceCriteria.length>0&&m.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground",children:[m.jsx(QY,{className:"w-3 h-3"}),m.jsxs("span",{children:[E.acceptanceCriteria.filter(T=>T.completed).length,"/",E.acceptanceCriteria.length," criteria"]})]}),E.labels.length>0&&m.jsx("div",{className:"mt-2",children:m.jsx(ode,{labels:E.labels,maxVisible:3})})]}),E.assignee&&m.jsx("span",{className:"text-sm text-muted-foreground font-mono shrink-0",children:E.assignee})]})},E.id)})})]},g)),u.length===0&&m.jsx("div",{className:"text-center py-12",children:m.jsx("p",{className:"text-lg text-muted-foreground",children:"No tasks found"})})]})})]})}function Opt({tasks:e,loading:t,onTasksUpdate:n,selectedTask:r,onTaskClose:i,onNewTask:o}){const[s,a]=v.useState("table"),[l,c]=v.useState(null),[u,f]=v.useState([]);v.useEffect(()=>{r&&c(r)},[r]);const h=y=>{window.location.hash=`/tasks/${y.id}`},g=y=>{window.location.hash=`/tasks/${y}`};return t?m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading tasks..."})}):m.jsxs("div",{className:"p-6 h-full flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"All Tasks"}),m.jsxs("span",{className:"text-muted-foreground",children:[e.length," ",e.length===1?"task":"tasks"]})]}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs("div",{className:"flex items-center border rounded-lg p-1",children:[m.jsxs($e,{variant:s==="table"?"secondary":"ghost",size:"sm",onClick:()=>a("table"),className:"h-8 px-3",children:[m.jsx(Sge,{className:"h-4 w-4 mr-2"}),"Table"]}),m.jsxs($e,{variant:s==="grouped"?"secondary":"ghost",size:"sm",onClick:()=>a("grouped"),className:"h-8 px-3",children:[m.jsx(xge,{className:"h-4 w-4 mr-2"}),"Grouped"]})]})})]}),m.jsx("div",{className:"flex-1 overflow-hidden",children:s==="table"?m.jsx(Xi,{className:"h-full",children:m.jsx("div",{className:"pr-4",children:m.jsx(kpt,{tasks:e,onTaskClick:h,onSelectionChange:f,onNewTask:o})})}):m.jsx(Ipt,{tasks:e,onTaskClick:h,onNewTask:o})}),u.length>0&&m.jsxs("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 bg-primary text-primary-foreground px-4 py-2 rounded-lg shadow-lg flex items-center gap-4",children:[m.jsxs("span",{className:"text-sm font-medium",children:[u.length," task",u.length>1?"s":""," selected"]}),m.jsx($e,{variant:"secondary",size:"sm",onClick:()=>{console.log("Bulk action on:",u)},children:"Bulk Edit"})]}),m.jsx(_de,{task:l,allTasks:e,onClose:()=>{c(null),i&&i()},onUpdate:n,onNavigateToTask:g})]})}const Pfe=v.createContext({isDark:!1,toggle:()=>{}}),Pm=()=>v.useContext(Pfe);function Mpt(){const{config:e}=bf(),[t,n]=v.useState([]),[r,i]=v.useState(!0),[o,s]=v.useState(!1),[a,l]=v.useState(!1),[c,u]=v.useState(()=>{if(typeof window<"u"){const I=localStorage.getItem("theme");return I?I==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),f=()=>{const I=window.location.hash.slice(1);return I.startsWith("/tasks")?"tasks":I.startsWith("/docs")?"docs":I.startsWith("/config")?"config":(I.startsWith("/kanban")||I==="/"||I==="","kanban")},h=I=>{const M=window.location.hash.slice(1),j="(?:kanban|tasks)",L=M.match(new RegExp(`^/${j}/([^?]+)`))||M.match(/[?&]id=([^&]+)/);return L?L[1]:null},[g,y]=v.useState(f()),[E,S]=v.useState(window.location.hash);v.useEffect(()=>{const I=()=>{y(f()),S(window.location.hash)};return window.addEventListener("hashchange",I),()=>window.removeEventListener("hashchange",I)},[f]),v.useEffect(()=>{c?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))},[c]),v.useEffect(()=>{const I=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),l(j=>!j))};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]),v.useEffect(()=>{ua.getTasks().then(I=>{n(I),i(!1)}).catch(I=>{console.error("Failed to load tasks:",I),i(!1)})},[]),xu("tasks:updated",({task:I})=>{n(M=>{const j=M.findIndex(L=>L.id===I.id);if(j>=0){const L=[...M];return L[j]=I,L}return[...M,I]})}),xu("tasks:refresh",()=>{ua.getTasks().then(n).catch(console.error)});const w=()=>{ua.getTasks().then(n).catch(console.error)},T=I=>{n(I)},A=async I=>{const M=!c;if(!document.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){u(M);return}const j=I.clientX,L=I.clientY,F=Math.hypot(Math.max(j,window.innerWidth-j),Math.max(L,window.innerHeight-L));await document.startViewTransition(()=>{u(M)}).ready,document.documentElement.animate({clipPath:[`circle(0px at ${j}px ${L}px)`,`circle(${F}px at ${j}px ${L}px)`]},{duration:400,easing:"ease-out",pseudoElement:"::view-transition-new(root)"})},R=I=>{window.location.hash=`/kanban/${I.id}`},_=I=>{I?.path?window.location.hash=`/docs/${I.path}`:I?.filename?window.location.hash=`/docs/${I.filename}`:window.location.hash="/docs"},D=()=>{switch(g){case"kanban":return m.jsx($Y,{tasks:t,loading:r,onTasksUpdate:T,onNewTask:()=>s(!0)});case"tasks":{const I=h(),M=I?t.find(j=>j.id===I):null;return m.jsx(Opt,{tasks:t,loading:r,onTasksUpdate:w,selectedTask:M,onTaskClose:()=>{window.location.hash="/tasks"},onNewTask:()=>s(!0)})}case"docs":return m.jsx(_pt,{});case"config":return m.jsx(Npt,{});default:return m.jsx($Y,{tasks:t,loading:r,onTasksUpdate:T,onNewTask:()=>s(!0)})}};return m.jsxs(Pfe.Provider,{value:{isDark:c,toggle:A},children:[m.jsxs(lfe,{children:[m.jsx(tft,{currentPage:g,onSearchClick:()=>l(!0)}),m.jsxs("main",{className:"flex flex-1 flex-col bg-background overflow-hidden",children:[m.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[m.jsx(ufe,{className:"-ml-1"}),m.jsx(j0,{orientation:"vertical",className:"mr-2 h-4"}),m.jsx("div",{className:"flex flex-1 items-center gap-2 text-sm",children:m.jsx("span",{className:"font-semibold text-foreground",children:e.name||"Knowns"})}),m.jsx(Iat,{onTaskClick:I=>{window.location.hash=`/kanban/${I}`}}),m.jsx(_at,{isDark:c,onToggle:A,size:"sm"}),m.jsx(aft,{})]}),m.jsx("div",{className:"flex-1 w-full overflow-y-auto overflow-x-hidden",children:D()})]}),m.jsx(Odt,{isOpen:o,allTasks:t,onClose:()=>s(!1),onCreated:w}),m.jsx(cft,{open:a,onOpenChange:l,onTaskSelect:R,onDocSelect:_})]}),m.jsx(Iwe,{})]})}function Lpt(){return m.jsx(ibe,{children:m.jsx(Owe,{children:m.jsx(Lwe,{children:m.jsx(pme,{children:m.jsx(xat,{children:m.jsx(Mpt,{})})})})})})}const Ffe=document.getElementById("root");if(!Ffe)throw new Error("Root element not found");zY.createRoot(Ffe).render(m.jsx(Lpt,{}));
317
+ color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,n?.key)}return i}}function dt(e,t,n,r){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function xft(e,t,n,r){const i=()=>{var s;return(s=o.getValue())!=null?s:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:ut(()=>[e,n,t,o],(s,a,l,c)=>({table:s,column:a,row:l,cell:c,getValue:c.getValue,renderValue:c.renderValue}),dt(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(o,n,t,e)},{}),o}function Eft(e,t,n,r){var i,o;const a={...e._getDefaultColumnDef(),...t},l=a.accessorKey;let c=(i=(o=a.id)!=null?o:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?i:typeof a.header=="string"?a.header:void 0,u;if(a.accessorFn?u=a.accessorFn:l&&(l.includes(".")?u=h=>{let g=h;for(const E of l.split(".")){var y;g=(y=g)==null?void 0:y[E]}return g}:u=h=>h[a.accessorKey]),!c)throw new Error;let f={id:`${String(c)}`,accessorFn:u,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:ut(()=>[!0],()=>{var h;return[f,...(h=f.columns)==null?void 0:h.flatMap(g=>g.getFlatColumns())]},dt(e.options,"debugColumns")),getLeafColumns:ut(()=>[e._getOrderColumnsFn()],h=>{var g;if((g=f.columns)!=null&&g.length){let y=f.columns.flatMap(E=>E.getLeafColumns());return h(y)}return[f]},dt(e.options,"debugColumns"))};for(const h of e._features)h.createColumn==null||h.createColumn(f,e);return f}const Di="debugHeaders";function FY(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),s.push(l)};return a(o),s},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(o,e)}),o}const Sft={createTable:e=>{e.getHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,s;const a=(o=r?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?o:[],l=(s=i?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?s:[],c=n.filter(f=>!(r!=null&&r.includes(f.id))&&!(i!=null&&i.includes(f.id)));return yx(t,[...a,...c,...l],e)},dt(e.options,Di)),e.getCenterHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),yx(t,n,e,"center")),dt(e.options,Di)),e.getLeftHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?i:[];return yx(t,o,e,"left")},dt(e.options,Di)),e.getRightHeaderGroups=ut(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?i:[];return yx(t,o,e,"right")},dt(e.options,Di)),e.getFooterGroups=ut(()=>[e.getHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getLeftFooterGroups=ut(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getCenterFooterGroups=ut(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getRightFooterGroups=ut(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),dt(e.options,Di)),e.getFlatHeaders=ut(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getLeftFlatHeaders=ut(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getCenterFlatHeaders=ut(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getRightFlatHeaders=ut(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),dt(e.options,Di)),e.getCenterLeafHeaders=ut(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),dt(e.options,Di)),e.getLeftLeafHeaders=ut(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),dt(e.options,Di)),e.getRightLeafHeaders=ut(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),dt(e.options,Di)),e.getLeafHeaders=ut(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,s,a,l,c;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(s=(a=n[0])==null?void 0:a.headers)!=null?s:[],...(l=(c=r[0])==null?void 0:c.headers)!=null?l:[]].map(u=>u.getLeafHeaders()).flat()},dt(e.options,Di))}};function yx(e,t,n,r){var i,o;let s=0;const a=function(h,g){g===void 0&&(g=1),s=Math.max(s,g),h.filter(y=>y.getIsVisible()).forEach(y=>{var E;(E=y.columns)!=null&&E.length&&a(y.columns,g+1)},0)};a(e);let l=[];const c=(h,g)=>{const y={depth:g,id:[r,`${g}`].filter(Boolean).join("_"),headers:[]},E=[];h.forEach(S=>{const w=[...E].reverse()[0],T=S.column.depth===y.depth;let A,R=!1;if(T&&S.column.parent?A=S.column.parent:(A=S.column,R=!0),w&&w?.column===A)w.subHeaders.push(S);else{const _=FY(n,A,{id:[r,g,A.id,S?.id].filter(Boolean).join("_"),isPlaceholder:R,placeholderId:R?`${E.filter(D=>D.column===A).length}`:void 0,depth:g,index:E.length});_.subHeaders.push(S),E.push(_)}y.headers.push(S),S.headerGroup=y}),l.push(y),g>0&&c(E,g-1)},u=t.map((h,g)=>FY(n,h,{depth:s,index:g}));c(u,s-1),l.reverse();const f=h=>h.filter(y=>y.column.getIsVisible()).map(y=>{let E=0,S=0,w=[0];y.subHeaders&&y.subHeaders.length?(w=[],f(y.subHeaders).forEach(A=>{let{colSpan:R,rowSpan:_}=A;E+=R,w.push(_)})):E=1;const T=Math.min(...w);return S=S+T,y.colSpan=E,y.rowSpan=S,{colSpan:E,rowSpan:S}});return f((i=(o=l[0])==null?void 0:o.headers)!=null?i:[]),l}const hB=(e,t,n,r,i,o,s)=>{let a={id:t,index:r,original:n,depth:i,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const c=e.getColumn(l);if(c!=null&&c.accessorFn)return a._valuesCache[l]=c.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const c=e.getColumn(l);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=c.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var c;return(c=a.getValue(l))!=null?c:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>vft(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],c=a;for(;;){const u=c.getParentRow();if(!u)break;l.push(u),c=u}return l.reverse()},getAllCells:ut(()=>[e.getAllLeafColumns()],l=>l.map(c=>xft(e,a,c,c.id)),dt(e.options,"debugRows")),_getAllCellsByColumnId:ut(()=>[a.getAllCells()],l=>l.reduce((c,u)=>(c[u.column.id]=u,c),{}),dt(e.options,"debugRows"))};for(let l=0;l<e._features.length;l++){const c=e._features[l];c==null||c.createRow==null||c.createRow(a,e)}return a},wft={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},vfe=(e,t,n)=>{var r,i;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(o))};vfe.autoRemove=e=>ma(e);const xfe=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};xfe.autoRemove=e=>ma(e);const Efe=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};Efe.autoRemove=e=>ma(e);const Sfe=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};Sfe.autoRemove=e=>ma(e);const wfe=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});wfe.autoRemove=e=>ma(e)||!(e!=null&&e.length);const Cfe=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});Cfe.autoRemove=e=>ma(e)||!(e!=null&&e.length);const Tfe=(e,t,n)=>e.getValue(t)===n;Tfe.autoRemove=e=>ma(e);const kfe=(e,t,n)=>e.getValue(t)==n;kfe.autoRemove=e=>ma(e);const mB=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};mB.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(i)?1/0:i;if(o>s){const a=o;o=s,s=a}return[o,s]};mB.autoRemove=e=>ma(e)||ma(e[0])&&ma(e[1]);const Gl={includesString:vfe,includesStringSensitive:xfe,equalsString:Efe,arrIncludes:Sfe,arrIncludesAll:wfe,arrIncludesSome:Cfe,equals:Tfe,weakEquals:kfe,inNumberRange:mB};function ma(e){return e==null||e===""}const Cft={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:rs("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);return typeof r=="string"?Gl.includesString:typeof r=="number"?Gl.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Gl.equals:Array.isArray(r)?Gl.arrIncludes:Gl.weakEquals},e.getFilterFn=()=>{var n,r;return jT(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:Gl[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r?.find(u=>u.id===e.id),s=pu(n,o?o.value:void 0);if(BY(i,s,e)){var a;return(a=r?.filter(u=>u.id!==e.id))!=null?a:[]}const l={id:e.id,value:s};if(o){var c;return(c=r?.map(u=>u.id===e.id?l:u))!=null?c:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=pu(t,i))==null?void 0:o.filter(s=>{const a=n.find(l=>l.id===s.id);if(a){const l=a.getFilterFn();if(BY(l,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function BY(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const Tft=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),kft=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},Aft=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}),r},Nft=(e,t,n)=>{let r,i;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r===void 0?s>=s&&(r=i=s):(r>s&&(r=s),i<s&&(i=s)))}),[r,i]},_ft=(e,t)=>{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},Rft=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!yft(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,s)=>o-s);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},Dft=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),Ift=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Oft=(e,t)=>t.length,L_={sum:Tft,min:kft,max:Aft,extent:Nft,mean:_ft,median:Rft,unique:Dft,uniqueCount:Ift,count:Oft},Mft={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:rs("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);if(typeof r=="number")return L_.sum;if(Object.prototype.toString.call(r)==="[object Date]")return L_.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return jT(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:L_[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function Lft(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(s=>s.id===o)).filter(Boolean),...r]}const Pft={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:rs("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ut(n=>[jb(t,n)],n=>n.findIndex(r=>r.id===e.id),dt(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=jb(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const i=jb(t,n);return((r=i[i.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=ut(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const s=[...t],a=[...i];for(;a.length&&s.length;){const l=s.shift(),c=a.findIndex(u=>u.id===l);c>-1&&o.push(a.splice(c,1)[0])}o=[...o,...a]}return Lft(o,n,r)},dt(e.options,"debugTable"))}},P_=()=>({left:[],right:[]}),Fft={getInitialState:e=>({columnPinning:P_(),...e}),getDefaultOptions:e=>({onColumnPinningChange:rs("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,s;if(n==="right"){var a,l;return{left:((a=i?.left)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((l=i?.right)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(n==="left"){var c,u;return{left:[...((c=i?.left)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((u=i?.right)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((o=i?.left)!=null?o:[]).filter(f=>!(r!=null&&r.includes(f))),right:((s=i?.right)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var i,o,s;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(a=>r?.includes(a)),s=n.some(a=>i?.includes(a));return o?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();return i?(n=(r=t.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=ut(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(s=>!o.includes(s.column.id))},dt(t.options,"debugRows")),e.getLeftVisibleCells=ut(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),dt(t.options,"debugRows")),e.getRightVisibleCells=ut(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),dt(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?P_():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:P_())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=ut(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),dt(e.options,"debugColumns")),e.getRightLeafColumns=ut(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),dt(e.options,"debugColumns")),e.getCenterLeafColumns=ut(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},dt(e.options,"debugColumns"))}};function Bft(e){return e||(typeof document<"u"?document:null)}const vx={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},F_=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),jft={getDefaultColumnDef:()=>vx,getInitialState:e=>({columnSizing:{},columnSizingInfo:F_(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:rs("columnSizing",e),onColumnSizingInfoChange:rs("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:vx.minSize,(r=o??e.columnDef.size)!=null?r:vx.size),(i=e.columnDef.maxSize)!=null?i:vx.maxSize)},e.getStart=ut(n=>[n,jb(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((i,o)=>i+o.getSize(),0),dt(t.options,"debugColumns")),e.getAfter=ut(n=>[n,jb(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((i,o)=>i+o.getSize(),0),dt(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),i=r?.getCanResize();return o=>{if(!r||!i||(o.persist==null||o.persist(),B_(o)&&o.touches&&o.touches.length>1))return;const s=e.getSize(),a=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[r.id,r.getSize()]],l=B_(o)?Math.round(o.touches[0].clientX):o.clientX,c={},u=(w,T)=>{typeof T=="number"&&(t.setColumnSizingInfo(A=>{var R,_;const D=t.options.columnResizeDirection==="rtl"?-1:1,I=(T-((R=A?.startOffset)!=null?R:0))*D,M=Math.max(I/((_=A?.startSize)!=null?_:0),-.999999);return A.columnSizingStart.forEach(j=>{let[L,F]=j;c[L]=Math.round(Math.max(F+F*M,0)*100)/100}),{...A,deltaOffset:I,deltaPercentage:M}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(A=>({...A,...c})))},f=w=>u("move",w),h=w=>{u("end",w),t.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g=Bft(n),y={moveHandler:w=>f(w.clientX),upHandler:w=>{g?.removeEventListener("mousemove",y.moveHandler),g?.removeEventListener("mouseup",y.upHandler),h(w.clientX)}},E={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),f(w.touches[0].clientX),!1),upHandler:w=>{var T;g?.removeEventListener("touchmove",E.moveHandler),g?.removeEventListener("touchend",E.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),h((T=w.touches[0])==null?void 0:T.clientX)}},S=$ft()?{passive:!1}:!1;B_(o)?(g?.addEventListener("touchmove",E.moveHandler,S),g?.addEventListener("touchend",E.upHandler,S)):(g?.addEventListener("mousemove",y.moveHandler,S),g?.addEventListener("mouseup",y.upHandler,S)),t.setColumnSizingInfo(w=>({...w,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?F_():(n=e.initialState.columnSizingInfo)!=null?n:F_())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}}};let xx=null;function $ft(){if(typeof xx=="boolean")return xx;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return xx=e,xx}function B_(e){return e.type==="touchstart"}const Uft={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:rs("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const i=e.columns;return(n=i.length?i.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=ut(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),dt(t.options,"debugRows")),e.getVisibleCells=ut(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],dt(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>ut(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),dt(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function jb(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Hft={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},zft={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:rs("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Gl.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return jT(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:Gl[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Vft={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:rs("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const s=o.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,n=(i=n)!=null?i:!o,!o&&n)return{...s,[e.id]:!0};if(o&&!n){const{[e.id]:a,...l}=s;return l}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r?.[e.id])},e.getCanExpand=()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},OI=0,MI=10,j_=()=>({pageIndex:OI,pageSize:MI}),Gft={getInitialState:e=>({...e,pagination:{...j_(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:rs("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const i=o=>pu(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=r=>{var i;e.setPagination(r?j_():(i=e.initialState.pagination)!=null?i:j_())},e.setPageIndex=r=>{e.setPagination(i=>{let o=pu(r,i.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,s)),{...i,pageIndex:o}})},e.resetPageIndex=r=>{var i,o;e.setPageIndex(r?OI:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?i:OI)},e.resetPageSize=r=>{var i,o;e.setPageSize(r?MI:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?i:MI)},e.setPageSize=r=>{e.setPagination(i=>{const o=Math.max(1,pu(r,i.pageSize)),s=i.pageSize*i.pageIndex,a=Math.floor(s/o);return{...i,pageIndex:a,pageSize:o}})},e.setPageCount=r=>e.setPagination(i=>{var o;let s=pu(r,(o=e.options.pageCount)!=null?o:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...i,pageCount:s}}),e.getPageOptions=ut(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,s)=>s)),i},dt(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:r<i-1},e.previousPage=()=>e.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},$_=()=>({top:[],bottom:[]}),qft={getInitialState:e=>({rowPinning:$_(),...e}),getDefaultOptions:e=>({onRowPinningChange:rs("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{const o=r?e.getLeafRows().map(l=>{let{id:c}=l;return c}):[],s=i?e.getParentRows().map(l=>{let{id:c}=l;return c}):[],a=new Set([...s,e.id,...o]);t.setRowPinning(l=>{var c,u;if(n==="bottom"){var f,h;return{top:((f=l?.top)!=null?f:[]).filter(E=>!(a!=null&&a.has(E))),bottom:[...((h=l?.bottom)!=null?h:[]).filter(E=>!(a!=null&&a.has(E))),...Array.from(a)]}}if(n==="top"){var g,y;return{top:[...((g=l?.top)!=null?g:[]).filter(E=>!(a!=null&&a.has(E))),...Array.from(a)],bottom:((y=l?.bottom)!=null?y:[]).filter(E=>!(a!=null&&a.has(E)))}}return{top:((c=l?.top)!=null?c:[]).filter(E=>!(a!=null&&a.has(E))),bottom:((u=l?.bottom)!=null?u:[]).filter(E=>!(a!=null&&a.has(E)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=t.options;return typeof r=="function"?r(e):(n=r??i)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,o=n.some(a=>r?.includes(a)),s=n.some(a=>i?.includes(a));return o?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();if(!i)return-1;const o=(n=i==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(s=>{let{id:a}=s;return a});return(r=o?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?$_():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:$_())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var i,o;return!!((i=r.top)!=null&&i.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(n??[]).map(s=>{const a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(s=>t.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=ut(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),dt(e.options,"debugRows")),e.getBottomRows=ut(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),dt(e.options,"debugRows")),e.getCenterRows=ut(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const i=new Set([...n??[],...r??[]]);return t.filter(o=>!i.has(o.id))},dt(e.options,"debugRows"))}},Wft={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:rs("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{LI(i,o.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ut(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?U_(e,n):{rows:[],flatRows:[],rowsById:{}},dt(e.options,"debugTable")),e.getFilteredSelectedRowModel=ut(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?U_(e,n):{rows:[],flatRows:[],rowsById:{}},dt(e.options,"debugTable")),e.getGroupedSelectedRowModel=ut(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?U_(e,n):{rows:[],flatRows:[],rowsById:{}},dt(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const i=e.getIsSelected();t.setRowSelection(o=>{var s;if(n=typeof n<"u"?n:!i,e.getCanSelect()&&i===n)return o;const a={...o};return LI(a,e.id,n,(s=r?.selectChildren)!=null?s:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return gB(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return PI(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return PI(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},LI=(e,t,n,r,i)=>{var o;const s=i.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=s.subRows)!=null&&o.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>LI(e,a.id,n,r,i))};function U_(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(s,a){return s.map(l=>{var c;const u=gB(l,n);if(u&&(r.push(l),i[l.id]=l),(c=l.subRows)!=null&&c.length&&(l={...l,subRows:o(l.subRows)}),u)return l}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function gB(e,t){var n;return(n=t[e.id])!=null?n:!1}function PI(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,o=!1;return e.subRows.forEach(s=>{if(!(o&&!i)&&(s.getCanSelect()&&(gB(s,t)?o=!0:i=!1),s.subRows&&s.subRows.length)){const a=PI(s,t);a==="all"?o=!0:(a==="some"&&(o=!0),i=!1)}}),i?"all":o?"some":!1}const FI=/([0-9]+)/gm,Yft=(e,t,n)=>Afe($u(e.getValue(n)).toLowerCase(),$u(t.getValue(n)).toLowerCase()),Kft=(e,t,n)=>Afe($u(e.getValue(n)),$u(t.getValue(n))),Xft=(e,t,n)=>bB($u(e.getValue(n)).toLowerCase(),$u(t.getValue(n)).toLowerCase()),Zft=(e,t,n)=>bB($u(e.getValue(n)),$u(t.getValue(n))),Qft=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},Jft=(e,t,n)=>bB(e.getValue(n),t.getValue(n));function bB(e,t){return e===t?0:e>t?1:-1}function $u(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Afe(e,t){const n=e.split(FI).filter(Boolean),r=t.split(FI).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),s=parseInt(i,10),a=parseInt(o,10),l=[s,a].sort();if(isNaN(l[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return n.length-r.length}const Xg={alphanumeric:Yft,alphanumericCaseSensitive:Kft,text:Xft,textCaseSensitive:Zft,datetime:Qft,basic:Jft},ept={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:rs("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i?.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Xg.datetime;if(typeof o=="string"&&(r=!0,o.split(FI).length>1))return Xg.alphanumeric}return r?Xg.text:Xg.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof n?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return jT(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Xg[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(s=>{const a=s?.find(g=>g.id===e.id),l=s?.findIndex(g=>g.id===e.id);let c=[],u,f=o?n:i==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?u="toggle":u="add":s!=null&&s.length&&l!==s.length-1?u="replace":a?u="toggle":u="replace",u==="toggle"&&(o||i||(u="remove")),u==="add"){var h;c=[...s,{id:e.id,desc:f}],c.splice(0,c.length-((h=t.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=s.map(g=>g.id===e.id?{...g,desc:f}:g):u==="remove"?c=s.filter(g=>g.id!==e.id):c=[{id:e.id,desc:f}];return c})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;const o=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:s==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},tpt=[Sft,Uft,Pft,Fft,wft,Cft,Hft,zft,ept,Mft,Vft,Gft,qft,Wft,jft];function npt(e){var t,n;const r=[...tpt,...(t=e._features)!=null?t:[]];let i={_features:r};const o=i._features.reduce((h,g)=>Object.assign(h,g.getDefaultOptions==null?void 0:g.getDefaultOptions(i)),{}),s=h=>i.options.mergeOptions?i.options.mergeOptions(o,h):{...o,...h};let l={...{},...(n=e.initialState)!=null?n:{}};i._features.forEach(h=>{var g;l=(g=h.getInitialState==null?void 0:h.getInitialState(l))!=null?g:l});const c=[];let u=!1;const f={_features:r,options:{...o,...e},initialState:l,_queue:h=>{c.push(h),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{i.setState(i.initialState)},setOptions:h=>{const g=pu(h,i.options);i.options=s(g)},getState:()=>i.options.state,setState:h=>{i.options.onStateChange==null||i.options.onStateChange(h)},_getRowId:(h,g,y)=>{var E;return(E=i.options.getRowId==null?void 0:i.options.getRowId(h,g,y))!=null?E:`${y?[y.id,g].join("."):g}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(h,g)=>{let y=(g?i.getPrePaginationRowModel():i.getRowModel()).rowsById[h];if(!y&&(y=i.getCoreRowModel().rowsById[h],!y))throw new Error;return y},_getDefaultColumnDef:ut(()=>[i.options.defaultColumn],h=>{var g;return h=(g=h)!=null?g:{},{header:y=>{const E=y.header.column.columnDef;return E.accessorKey?E.accessorKey:E.accessorFn?E.id:null},cell:y=>{var E,S;return(E=(S=y.renderValue())==null||S.toString==null?void 0:S.toString())!=null?E:null},...i._features.reduce((y,E)=>Object.assign(y,E.getDefaultColumnDef==null?void 0:E.getDefaultColumnDef()),{}),...h}},dt(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:ut(()=>[i._getColumnDefs()],h=>{const g=function(y,E,S){return S===void 0&&(S=0),y.map(w=>{const T=Eft(i,w,S,E),A=w;return T.columns=A.columns?g(A.columns,T,S+1):[],T})};return g(h)},dt(e,"debugColumns")),getAllFlatColumns:ut(()=>[i.getAllColumns()],h=>h.flatMap(g=>g.getFlatColumns()),dt(e,"debugColumns")),_getAllFlatColumnsById:ut(()=>[i.getAllFlatColumns()],h=>h.reduce((g,y)=>(g[y.id]=y,g),{}),dt(e,"debugColumns")),getAllLeafColumns:ut(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(h,g)=>{let y=h.flatMap(E=>E.getLeafColumns());return g(y)},dt(e,"debugColumns")),getColumn:h=>i._getAllFlatColumnsById()[h]};Object.assign(i,f);for(let h=0;h<i._features.length;h++){const g=i._features[h];g==null||g.createTable==null||g.createTable(i)}return i}function rpt(){return e=>ut(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,s){o===void 0&&(o=0);const a=[];for(let c=0;c<i.length;c++){const u=hB(e,e._getRowId(i[c],c,s),i[c],c,o,void 0,s?.id);if(n.flatRows.push(u),n.rowsById[u.id]=u,a.push(u),e.options.getSubRows){var l;u.originalSubRows=e.options.getSubRows(i[c],c),(l=u.originalSubRows)!=null&&l.length&&(u.subRows=r(u.originalSubRows,o+1,u))}}return a};return n.rows=r(t),n},dt(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function ipt(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Nfe(e,t,n){return n.options.filterFromLeafRows?opt(e,t,n):spt(e,t,n)}function opt(e,t,n){var r;const i=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;h<l.length;h++){var f;let g=l[h];const y=hB(n,g.id,g.original,g.index,g.depth,void 0,g.parentId);if(y.columnFilters=g.columnFilters,(f=g.subRows)!=null&&f.length&&c<s){if(y.subRows=a(g.subRows,c+1),g=y,t(g)&&!y.subRows.length){u.push(g),o[g.id]=g,i.push(g);continue}if(t(g)||y.subRows.length){u.push(g),o[g.id]=g,i.push(g);continue}}else g=y,t(g)&&(u.push(g),o[g.id]=g,i.push(g))}return u};return{rows:a(e),flatRows:i,rowsById:o}}function spt(e,t,n){var r;const i=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;h<l.length;h++){let g=l[h];if(t(g)){var f;if((f=g.subRows)!=null&&f.length&&c<s){const E=hB(n,g.id,g.original,g.index,g.depth,void 0,g.parentId);E.subRows=a(g.subRows,c+1),g=E}u.push(g),i.push(g),o[g.id]=g}}return u};return{rows:a(e),flatRows:i,rowsById:o}}function apt(){return(e,t)=>ut(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(a=>a.id).filter(a=>a!==t),i?"__global__":void 0].filter(Boolean),s=a=>{for(let l=0;l<o.length;l++)if(a.columnFilters[o[l]]===!1)return!1;return!0};return Nfe(n.rows,s,e)},dt(e.options,"debugTable"))}function lpt(){return(e,t)=>ut(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{if(!n)return new Map;let r=new Map;for(let o=0;o<n.flatRows.length;o++){const s=n.flatRows[o].getUniqueValues(t);for(let a=0;a<s.length;a++){const l=s[a];if(r.has(l)){var i;r.set(l,((i=r.get(l))!=null?i:0)+1)}else r.set(l,1)}}return r},dt(e.options,"debugTable"))}function cpt(){return e=>ut(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let h=0;h<t.flatRows.length;h++)t.flatRows[h].columnFilters={},t.flatRows[h].columnFiltersMeta={};return t}const i=[],o=[];(n??[]).forEach(h=>{var g;const y=e.getColumn(h.id);if(!y)return;const E=y.getFilterFn();E&&i.push({id:h.id,filterFn:E,resolvedValue:(g=E.resolveFilterValue==null?void 0:E.resolveFilterValue(h.value))!=null?g:h.value})});const s=(n??[]).map(h=>h.id),a=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());r&&a&&l.length&&(s.push("__global__"),l.forEach(h=>{var g;o.push({id:h.id,filterFn:a,resolvedValue:(g=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?g:r})}));let c,u;for(let h=0;h<t.flatRows.length;h++){const g=t.flatRows[h];if(g.columnFilters={},i.length)for(let y=0;y<i.length;y++){c=i[y];const E=c.id;g.columnFilters[E]=c.filterFn(g,E,c.resolvedValue,S=>{g.columnFiltersMeta[E]=S})}if(o.length){for(let y=0;y<o.length;y++){u=o[y];const E=u.id;if(u.filterFn(g,E,u.resolvedValue,S=>{g.columnFiltersMeta[E]=S})){g.columnFilters.__global__=!0;break}}g.columnFilters.__global__!==!0&&(g.columnFilters.__global__=!1)}}const f=h=>{for(let g=0;g<s.length;g++)if(h.columnFilters[s[g]]===!1)return!1;return!0};return Nfe(t.rows,f,e)},dt(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function upt(e){return t=>ut(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:s,flatRows:a,rowsById:l}=r;const c=i*o,u=c+i;s=s.slice(c,u);let f;t.options.paginateExpandedRows?f={rows:s,flatRows:a,rowsById:l}:f=ipt({rows:s,flatRows:a,rowsById:l}),f.flatRows=[];const h=g=>{f.flatRows.push(g),g.subRows.length&&g.subRows.forEach(h)};return f.rows.forEach(h),f},dt(t.options,"debugTable"))}function dpt(){return e=>ut(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(l=>{var c;return(c=e.getColumn(l.id))==null?void 0:c.getCanSort()}),s={};o.forEach(l=>{const c=e.getColumn(l.id);c&&(s[l.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const a=l=>{const c=l.map(u=>({...u}));return c.sort((u,f)=>{for(let g=0;g<o.length;g+=1){var h;const y=o[g],E=s[y.id],S=E.sortUndefined,w=(h=y?.desc)!=null?h:!1;let T=0;if(S){const A=u.getValue(y.id),R=f.getValue(y.id),_=A===void 0,D=R===void 0;if(_||D){if(S==="first")return _?-1:1;if(S==="last")return _?1:-1;T=_&&D?0:_?S:-S}}if(T===0&&(T=E.sortingFn(u,f,y.id)),T!==0)return w&&(T*=-1),E.invertSorting&&(T*=-1),T}return u.index-f.index}),c.forEach(u=>{var f;i.push(u),(f=u.subRows)!=null&&f.length&&(u.subRows=a(u.subRows))}),c};return{rows:a(n.rows),flatRows:i,rowsById:n.rowsById}},dt(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function jY(e,t){return e?fpt(e)?v.createElement(e,t):e:null}function fpt(e){return ppt(e)||typeof e=="function"||hpt(e)}function ppt(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function hpt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function mpt(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:npt(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:s=>{i(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}const _fe=v.forwardRef(({className:e,...t},n)=>m.jsx("div",{className:"relative w-full overflow-auto",children:m.jsx("table",{ref:n,className:Se("w-full caption-bottom text-sm",e),...t})}));_fe.displayName="Table";const Rfe=v.forwardRef(({className:e,...t},n)=>m.jsx("thead",{ref:n,className:Se("[&_tr]:border-b",e),...t}));Rfe.displayName="TableHeader";const Dfe=v.forwardRef(({className:e,...t},n)=>m.jsx("tbody",{ref:n,className:Se("[&_tr:last-child]:border-0",e),...t}));Dfe.displayName="TableBody";const gpt=v.forwardRef(({className:e,...t},n)=>m.jsx("tfoot",{ref:n,className:Se("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));gpt.displayName="TableFooter";const lE=v.forwardRef(({className:e,...t},n)=>m.jsx("tr",{ref:n,className:Se("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));lE.displayName="TableRow";const Ife=v.forwardRef(({className:e,...t},n)=>m.jsx("th",{ref:n,className:Se("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Ife.displayName="TableHead";const BI=v.forwardRef(({className:e,...t},n)=>m.jsx("td",{ref:n,className:Se("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));BI.displayName="TableCell";const bpt=v.forwardRef(({className:e,...t},n)=>m.jsx("caption",{ref:n,className:Se("mt-4 text-sm text-muted-foreground",e),...t}));bpt.displayName="TableCaption";function ypt({table:e,showRowSelection:t=!0}){return m.jsxs("div",{className:"flex items-center justify-between px-2",children:[t&&m.jsxs("div",{className:"flex-1 text-sm text-muted-foreground",children:[e.getFilteredSelectedRowModel().rows.length," of"," ",e.getFilteredRowModel().rows.length," row(s) selected."]}),m.jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),m.jsxs(Yi,{value:`${e.getState().pagination.pageSize}`,onValueChange:n=>{e.setPageSize(Number(n))},children:[m.jsx(Pi,{className:"h-8 w-[70px]",children:m.jsx(Ki,{placeholder:e.getState().pagination.pageSize})}),m.jsx(Fi,{side:"top",children:[10,20,30,40,50].map(n=>m.jsx(yn,{value:`${n}`,children:n},n))})]})]}),m.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of ",e.getPageCount()]}),m.jsxs("div",{className:"flex items-center space-x-2",children:[m.jsxs($e,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to first page"}),m.jsx(Bme,{className:"h-4 w-4"})]}),m.jsxs($e,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to previous page"}),m.jsx(Mme,{className:"h-4 w-4"})]}),m.jsxs($e,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to next page"}),m.jsx(vh,{className:"h-4 w-4"})]}),m.jsxs($e,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[m.jsx("span",{className:"sr-only",children:"Go to last page"}),m.jsx($me,{className:"h-4 w-4"})]})]})]})]})}function vpt({columns:e,data:t,toolbar:n,onRowClick:r,showPagination:i=!0,showRowSelection:o=!0,initialSorting:s=[],onSelectionChange:a}){const[l,c]=v.useState({}),[u,f]=v.useState({}),[h,g]=v.useState([]),[y,E]=v.useState(s),S=mpt({data:t,columns:e,state:{sorting:y,columnVisibility:u,rowSelection:l,columnFilters:h},enableRowSelection:!0,onRowSelectionChange:c,onSortingChange:E,onColumnFiltersChange:g,onColumnVisibilityChange:f,getCoreRowModel:rpt(),getFilteredRowModel:cpt(),getPaginationRowModel:upt(),getSortedRowModel:dpt(),getFacetedRowModel:apt(),getFacetedUniqueValues:lpt()});return v.useEffect(()=>{if(a){const w=S.getFilteredSelectedRowModel().rows.map(T=>T.original);a(w)}},[l,a,S]),m.jsxs("div",{className:"space-y-4",children:[n,m.jsx("div",{className:"rounded-md border",children:m.jsxs(_fe,{children:[m.jsx(Rfe,{children:S.getHeaderGroups().map(w=>m.jsx(lE,{children:w.headers.map(T=>m.jsx(Ife,{colSpan:T.colSpan,children:T.isPlaceholder?null:jY(T.column.columnDef.header,T.getContext())},T.id))},w.id))}),m.jsx(Dfe,{children:S.getRowModel().rows?.length?S.getRowModel().rows.map(w=>m.jsx(lE,{"data-state":w.getIsSelected()&&"selected",onClick:()=>r?.(w.original),className:r?"cursor-pointer":"",children:w.getVisibleCells().map(T=>m.jsx(BI,{children:jY(T.column.columnDef.cell,T.getContext())},T.id))},w.id)):m.jsx(lE,{children:m.jsx(BI,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),i&&m.jsx(ypt,{table:S,showRowSelection:o})]})}const Ofe=Ule,Mfe=Hle,xpt=v.forwardRef(({className:e,inset:t,children:n,...r},i)=>m.jsxs(SF,{ref:i,className:Se("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,m.jsx(vh,{className:"ml-auto"})]}));xpt.displayName=SF.displayName;const Ept=v.forwardRef(({className:e,...t},n)=>m.jsx(wF,{ref:n,className:Se("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));Ept.displayName=wF.displayName;const yB=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(int,{children:m.jsx(gF,{ref:r,sideOffset:t,className:Se("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","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-[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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));yB.displayName=gF.displayName;const $b=v.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(yF,{ref:r,className:Se("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));$b.displayName=yF.displayName;const Spt=v.forwardRef(({className:e,children:t,checked:n,...r},i)=>m.jsxs(vF,{ref:i,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(xF,{children:m.jsx(Ds,{className:"h-4 w-4"})})}),t]}));Spt.displayName=vF.displayName;const wpt=v.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(zle,{ref:r,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(xF,{children:m.jsx(ZY,{className:"h-2 w-2 fill-current"})})}),t]}));wpt.displayName=zle.displayName;const Cpt=v.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(bF,{ref:r,className:Se("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Cpt.displayName=bF.displayName;const Lfe=v.forwardRef(({className:e,...t},n)=>m.jsx(EF,{ref:n,className:Se("-mx-1 my-1 h-px bg-muted",e),...t}));Lfe.displayName=EF.displayName;function wd({column:e,title:t,className:n}){return e.getCanSort()?m.jsx("div",{className:Se("flex items-center space-x-2",n),children:m.jsxs(Ofe,{children:[m.jsx(Mfe,{asChild:!0,children:m.jsxs($e,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[m.jsx("span",{children:t}),e.getIsSorted()==="desc"?m.jsx(V_,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?m.jsx(yh,{className:"ml-2 h-4 w-4"}):m.jsx(cE,{className:"ml-2 h-4 w-4"})]})}),m.jsxs(yB,{align:"start",children:[m.jsxs($b,{onClick:()=>e.toggleSorting(!1),children:[m.jsx(yh,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),m.jsxs($b,{onClick:()=>e.toggleSorting(!0),children:[m.jsx(V_,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),e.getCanHide()&&m.jsxs(m.Fragment,{children:[m.jsx(Lfe,{}),m.jsxs($b,{onClick:()=>e.toggleVisibility(!1),children:[m.jsx(G_,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})]})}):m.jsx("div",{className:Se(n),children:t})}const Tpt=[{id:"select",header:({table:e})=>m.jsx(aw,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":"Select all",className:"translate-y-[2px]",onClick:t=>t.stopPropagation()}),cell:({row:e})=>m.jsx(aw,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":"Select row",className:"translate-y-[2px]",onClick:t=>t.stopPropagation()}),enableSorting:!1,enableHiding:!1},{accessorKey:"id",header:({column:e})=>m.jsx(wd,{column:e,title:"ID"}),cell:({row:e})=>m.jsxs("div",{className:"w-[60px] font-mono text-xs text-muted-foreground",children:["#",e.getValue("id")]}),enableSorting:!0,enableHiding:!1},{accessorKey:"title",header:({column:e})=>m.jsx(wd,{column:e,title:"Title"}),cell:({row:e})=>{const t=e.original;return m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("span",{className:"font-medium line-clamp-1",children:t.title}),t.description&&m.jsx("span",{className:"text-xs text-muted-foreground line-clamp-1",children:t.description})]})},enableSorting:!0},{accessorKey:"status",header:({column:e})=>m.jsx(wd,{column:e,title:"Status"}),cell:({row:e})=>{const t=e.getValue("status");return m.jsx(rde,{status:t})},filterFn:(e,t,n)=>n.includes(e.getValue(t)),enableSorting:!0},{accessorKey:"priority",header:({column:e})=>m.jsx(wd,{column:e,title:"Priority"}),cell:({row:e})=>{const t=e.getValue("priority");return m.jsx(ide,{priority:t})},filterFn:(e,t,n)=>n.includes(e.getValue(t)),enableSorting:!0,sortingFn:(e,t)=>{const n={high:0,medium:1,low:2},r=n[e.getValue("priority")]??1,i=n[t.getValue("priority")]??1;return r-i}},{accessorKey:"assignee",header:({column:e})=>m.jsx(wd,{column:e,title:"Assignee"}),cell:({row:e})=>{const t=e.getValue("assignee");return t?m.jsx("span",{className:"text-sm font-mono",children:t}):m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})},filterFn:(e,t,n)=>{const r=e.getValue(t);return r?n.includes(r):n.includes("unassigned")},enableSorting:!0},{accessorKey:"labels",header:({column:e})=>m.jsx(wd,{column:e,title:"Labels"}),cell:({row:e})=>{const t=e.getValue("labels");return t.length>0?m.jsx(ode,{labels:t,maxVisible:2}):m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})},filterFn:(e,t,n)=>{const r=e.getValue(t);return n.some(i=>r.includes(i))},enableSorting:!1},{accessorKey:"acceptanceCriteria",header:({column:e})=>m.jsx(wd,{column:e,title:"Progress"}),cell:({row:e})=>{const t=e.original.acceptanceCriteria;if(t.length===0)return m.jsx("span",{className:"text-muted-foreground text-sm",children:"-"});const n=t.filter(o=>o.completed).length,r=t.length,i=Math.round(n/r*100);return m.jsxs("div",{className:"flex items-center gap-2 min-w-[80px]",children:[m.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:m.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${i}%`}})}),m.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[n,"/",r]})]})},enableSorting:!1}];function kpt({globalFilter:e,setGlobalFilter:t,statusFilter:n,setStatusFilter:r,priorityFilter:i,setPriorityFilter:o,onNewTask:s}){const a=e||n!=="all"||i!=="all";return m.jsxs("div",{className:"flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[m.jsxs("div",{className:"relative w-[250px]",children:[m.jsx(Ew,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),m.jsx(qr,{placeholder:"Search tasks...",value:e,onChange:l=>t(l.target.value),className:"pl-8"})]}),m.jsxs(Yi,{value:n,onValueChange:r,children:[m.jsx(Pi,{className:"w-[150px]",children:m.jsx(Ki,{placeholder:"Status"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Status"}),m.jsx(yn,{value:"todo",children:"To Do"}),m.jsx(yn,{value:"in-progress",children:"In Progress"}),m.jsx(yn,{value:"in-review",children:"In Review"}),m.jsx(yn,{value:"blocked",children:"Blocked"}),m.jsx(yn,{value:"done",children:"Done"})]})]}),m.jsxs(Yi,{value:i,onValueChange:o,children:[m.jsx(Pi,{className:"w-[150px]",children:m.jsx(Ki,{placeholder:"Priority"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Priority"}),m.jsx(yn,{value:"high",children:"High"}),m.jsx(yn,{value:"medium",children:"Medium"}),m.jsx(yn,{value:"low",children:"Low"})]})]}),a&&m.jsxs($e,{variant:"ghost",onClick:()=>{t(""),r("all"),o("all")},className:"h-8 px-2 lg:px-3",children:["Reset",m.jsx(Yo,{className:"ml-2 h-4 w-4"})]})]}),s&&m.jsxs($e,{onClick:s,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"mr-2 h-4 w-4"}),"New Task"]})]})}function Apt({tasks:e,onTaskClick:t,onSelectionChange:n,onNewTask:r}){const[i,o]=v.useState(""),[s,a]=v.useState("all"),[l,c]=v.useState("all"),u=v.useMemo(()=>{let f=e;if(i){const h=i.toLowerCase();f=f.filter(g=>g.id.toLowerCase().includes(h)||g.title.toLowerCase().includes(h)||g.description?.toLowerCase().includes(h)||g.assignee?.toLowerCase().includes(h)||g.labels.some(y=>y.toLowerCase().includes(h)))}return s!=="all"&&(f=f.filter(h=>h.status===s)),l!=="all"&&(f=f.filter(h=>h.priority===l)),f},[e,i,s,l]);return m.jsx(vpt,{columns:Tpt,data:u,onRowClick:t,onSelectionChange:n,showPagination:!0,showRowSelection:!0,initialSorting:[{id:"priority",desc:!1}],toolbar:m.jsx(kpt,{table:null,globalFilter:i,setGlobalFilter:o,statusFilter:s,setStatusFilter:a,priorityFilter:l,setPriorityFilter:c,onNewTask:r})})}const H_=["todo","in-progress","in-review","done","blocked","on-hold","urgent"],Npt=["gray","blue","green","yellow","red","purple","orange","pink","cyan","indigo"];function _pt(){const{config:e,loading:t,updateConfig:n}=bf(),[r,i]=v.useState({}),[o,s]=v.useState(!1),[a,l]=v.useState(null),[c,u]=v.useState("form"),[f,h]=v.useState(""),[g,y]=v.useState(null),[E,S]=v.useState(""),[w,T]=v.useState(!1);v.useEffect(()=>{!t&&!w&&(i(e),h(JSON.stringify(e,null,2)),T(!0))},[e,t,w]);const A=r,R=i;v.useEffect(()=>{c==="form"&&h(JSON.stringify(A,null,2))},[A,c]);const _=async()=>{s(!0),l(null);try{let F=A;if(c==="json")try{F=JSON.parse(f),R(F),y(null)}catch{y("Invalid JSON syntax"),s(!1);return}await n(F),l({type:"success",text:"Configuration saved successfully!"}),setTimeout(()=>l(null),3e3)}catch(F){l({type:"error",text:F instanceof Error?F.message:"Failed to save config"})}finally{s(!1)}},D=()=>{if(!E.trim())return;const F=E.toLowerCase().replace(/\s+/g,"-"),H=A.statuses||H_;if(H.includes(F)){l({type:"error",text:"Status already exists"});return}R({...A,statuses:[...H,F],statusColors:{...A.statusColors||{},[F]:"gray"}}),S("")},I=F=>{const H=A.statuses||H_,Y={...A.statusColors||{}};delete Y[F],R({...A,statuses:H.filter($=>$!==F),statusColors:Y,visibleColumns:(A.visibleColumns||[]).filter($=>$!==F)})},M=(F,H)=>{R({...A,statusColors:{...A.statusColors||{},[F]:H}})};if(t)return m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading configuration..."})});const j=A.statuses||H_,L=A.statusColors||{};return m.jsx(Xi,{className:"h-full",children:m.jsxs("div",{className:"p-6 max-w-3xl",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(HI,{className:"w-6 h-6"}),m.jsx("h1",{className:"text-2xl font-bold",children:"Configuration"})]}),m.jsxs("div",{className:"flex rounded-lg border overflow-hidden",children:[m.jsxs("button",{type:"button",onClick:()=>u("form"),className:`px-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${c==="form"?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:[m.jsx(Bge,{className:"w-4 h-4"}),"Form"]}),m.jsxs("button",{type:"button",onClick:()=>u("json"),className:`px-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${c==="json"?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:[m.jsx(Zme,{className:"w-4 h-4"}),"JSON"]})]})]}),a&&m.jsx("div",{className:`mb-6 p-4 rounded-lg ${a.type==="success"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-200"}`,children:a.text}),c==="json"?m.jsxs("div",{className:"bg-card rounded-lg border p-6 space-y-4",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"config.json"}),m.jsx("textarea",{value:f,onChange:F=>{h(F.target.value),y(null)},className:"w-full h-96 px-3 py-2 rounded-lg border bg-input font-mono text-sm focus:outline-none focus:ring-2 focus:ring-ring",spellCheck:!1}),g&&m.jsx("p",{className:"mt-2 text-sm text-destructive",children:g})]}),m.jsx("div",{className:"pt-4 border-t",children:m.jsxs($e,{onClick:_,disabled:o,children:[m.jsx(Ds,{className:"w-4 h-4 mr-2"}),o?"Saving...":"Save Configuration"]})})]}):m.jsxs("div",{className:"bg-card rounded-lg border p-6 space-y-6",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Project Name"}),m.jsx(qr,{type:"text",value:A.name||"",onChange:F=>R({...A,name:F.target.value}),placeholder:"My Project"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Name of your project"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Assignee"}),m.jsx(qr,{type:"text",value:A.defaultAssignee||"",onChange:F=>R({...A,defaultAssignee:F.target.value}),placeholder:"@username"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default assignee for new tasks (e.g., @claude)"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Priority"}),m.jsxs("select",{value:A.defaultPriority||"medium",onChange:F=>R({...A,defaultPriority:F.target.value}),className:"w-full px-3 py-2 rounded-lg border bg-input focus:outline-none focus:ring-2 focus:ring-ring",children:[m.jsx("option",{value:"low",children:"Low"}),m.jsx("option",{value:"medium",children:"Medium"}),m.jsx("option",{value:"high",children:"High"})]}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default priority for new tasks"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Labels"}),m.jsx(qr,{type:"text",value:A.defaultLabels?.join(", ")||"",onChange:F=>R({...A,defaultLabels:F.target.value.split(",").map(H=>H.trim()).filter(Boolean)}),placeholder:"frontend, backend, ui"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Comma-separated list of default labels for new tasks"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Time Format"}),m.jsxs("select",{value:A.timeFormat||"24h",onChange:F=>R({...A,timeFormat:F.target.value}),className:"w-full px-3 py-2 rounded-lg border bg-input focus:outline-none focus:ring-2 focus:ring-ring",children:[m.jsx("option",{value:"12h",children:"12-hour (AM/PM)"}),m.jsx("option",{value:"24h",children:"24-hour"})]}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Time display format"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Default Editor"}),m.jsx(qr,{type:"text",value:A.editor||"",onChange:F=>R({...A,editor:F.target.value}),placeholder:"code, vim, nano"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Default editor command for editing files"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Task Statuses"}),m.jsx("div",{className:"space-y-2 mb-3",children:j.map(F=>m.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-accent",children:[m.jsx("span",{className:"flex-1 font-mono text-sm",children:F}),m.jsx("select",{value:L[F]||"gray",onChange:H=>M(F,H.target.value),className:"px-2 py-1 rounded border bg-input text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:Npt.map(H=>m.jsx("option",{value:H,children:H},H))}),m.jsx("button",{type:"button",onClick:()=>I(F),className:"p-1 text-destructive hover:text-destructive hover:bg-destructive/10 rounded transition-colors",title:"Remove status",children:m.jsx(Wd,{className:"w-4 h-4"})})]},F))}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(qr,{type:"text",value:E,onChange:F=>S(F.target.value),placeholder:"new-status",className:"flex-1",onKeyDown:F=>F.key==="Enter"&&D()}),m.jsxs($e,{onClick:D,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"Add"]})]}),m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Define custom task statuses and their colors for the Kanban board"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Visible Kanban Columns"}),m.jsx("div",{className:"space-y-2",children:j.map(F=>{const H=A.visibleColumns?.includes(F)??!0,Y=F.split("-").map($=>$.charAt(0).toUpperCase()+$.slice(1)).join(" ");return m.jsxs("label",{className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",children:[m.jsx("input",{type:"checkbox",checked:H,onChange:$=>{const G=A.visibleColumns||j,V=$.target.checked?[...G,F]:G.filter(X=>X!==F);R({...A,visibleColumns:V})},className:"w-4 h-4 rounded border-border text-primary focus:ring-primary"}),m.jsx("span",{children:Y})]},F)})}),m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Select which columns to show in the Kanban board"})]}),m.jsx("div",{className:"pt-4 border-t",children:m.jsxs($e,{onClick:_,disabled:o,children:[m.jsx(Ds,{className:"w-4 h-4 mr-2"}),o?"Saving...":"Save Configuration"]})})]})]})})}function Rpt(){const[e,t]=v.useState([]),[n,r]=v.useState(!0),[i,o]=v.useState(null),[s,a]=v.useState(!1),[l,c]=v.useState(""),[u,f]=v.useState(!1),[h,g]=v.useState(!1),[y,E]=v.useState(""),[S,w]=v.useState(""),[T,A]=v.useState(""),[R,_]=v.useState(""),[D,I]=v.useState(""),[M,j]=v.useState(!1),[L,F]=v.useState(new Set(["(root)"])),[H,Y]=v.useState(!1),$=v.useRef(null);v.useEffect(()=>{V()},[]),xu("docs:updated",()=>{V()}),xu("docs:refresh",()=>{V()});const G=v.useCallback(()=>{if(e.length===0)return;const te=window.location.hash.match(/^#\/docs\/(.+)$/);if(te){const oe=decodeURIComponent(te[1]),ue=SE(oe).replace(/^\.\//,"").replace(/^\//,""),Te=e.find(Ie=>{const ke=SE(Ie.path);return ke===ue||ke.endsWith(`/${ue}`)||Ie.filename===ue});Te&&Te!==i&&(o(Te),a(!1))}},[e,i]);v.useEffect(()=>{G()},[G]),v.useEffect(()=>{if(!i||!i.folder)return;const se=i.folder.split("/"),te=[];let oe="";for(const ue of se)oe=oe?`${oe}/${ue}`:ue,te.push(oe);F(ue=>{const Te=new Set(ue);for(const Ie of te)Te.add(Ie);return Te})},[i]),v.useEffect(()=>(window.addEventListener("hashchange",G),()=>window.removeEventListener("hashchange",G)),[G]),v.useEffect(()=>{const se=oe=>{let ue=oe.target;for(;ue&&ue.tagName!=="A"&&ue!==$.current;)ue=ue.parentElement;if(ue&&ue.tagName==="A"){const Ie=ue.getAttribute("href");if(Ie&&/^task-\d+(.md)?$/.test(Ie)){oe.preventDefault();const ke=Ie.replace(".md","");window.location.hash=`/tasks?task=${ke}`;return}if(Ie&&(Ie.endsWith(".md")||Ie.includes(".md#"))){oe.preventDefault();let ke=Ie.replace(/^\.\//,"").replace(/^\//,"");ke=ke.split("#")[0],window.location.hash=`/docs/${ke}`}}},te=$.current;if(te)return te.addEventListener("click",se),()=>te.removeEventListener("click",se)},[e,i]);const V=()=>{jI().then(se=>{t(se),r(!1)}).catch(se=>{console.error("Failed to load docs:",se),r(!1)})},X=async()=>{if(!y.trim()){alert("Please enter a title");return}j(!0);try{const se=T.split(",").map(te=>te.trim()).filter(te=>te);await ume({title:y,description:S,tags:se,folder:R,content:D}),E(""),w(""),A(""),_(""),I(""),g(!1),V()}catch(se){console.error("Failed to create doc:",se),alert("Failed to create document. Please try again.")}finally{j(!1)}},Q=()=>{i&&(c(i.content),a(!0))},J=()=>{if(i){const te=`@doc/${kN(i.path).replace(/\.md$/,"")}`;navigator.clipboard.writeText(te).then(()=>{Y(!0),setTimeout(()=>Y(!1),2e3)})}},B=async()=>{if(i){f(!0);try{const se=await dme(wSe(i.path),{content:l});t(te=>te.map(oe=>oe.path===i.path?{...oe,content:l,metadata:{...oe.metadata,updatedAt:new Date().toISOString()}}:oe)),o(te=>te&&{...te,content:l}),a(!1)}catch(se){console.error("Failed to save doc:",se),alert(se instanceof Error?se.message:"Failed to save document")}finally{f(!1)}}},W=()=>{a(!1),c("")},K=se=>{F(te=>{const oe=new Set(te);return oe.has(se)?oe.delete(se):oe.add(se),oe})},P=()=>{const se={name:"(root)",path:"",docs:[],children:new Map};for(const te of e)if(!te.folder)se.docs.push(te);else{const oe=te.folder.split("/");let ue=se;for(let Te=0;Te<oe.length;Te++){const Ie=oe[Te],ke=oe.slice(0,Te+1).join("/");ue.children.has(Ie)||ue.children.set(Ie,{name:Ie,path:ke,docs:[],children:new Map}),ue=ue.children.get(Ie)}ue.docs.push(te)}return se},ce=se=>{let te=se.docs.length;for(const oe of se.children.values())te+=ce(oe);return te},le=(se,te=0)=>{const oe=[],ue=te===0||L.has(se.path),Te=`${te*16}px`;if(te>0){const Ie=ce(se);oe.push(m.jsxs("button",{type:"button",onClick:()=>K(se.path),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-accent text-foreground transition-colors",style:{paddingLeft:Te},children:[ue?m.jsx(Eu,{className:"w-4 h-4"}):m.jsx(vh,{className:"w-4 h-4"}),ue?m.jsx(cge,{className:"w-4 h-4"}):m.jsx(S9,{className:"w-4 h-4"}),m.jsx("span",{className:"text-sm font-medium",children:se.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",Ie,")"]})]},`folder-${se.path}`))}if(ue||te===0){const Ie=Array.from(se.children.values()).sort((tt,rt)=>tt.name.localeCompare(rt.name));for(const tt of Ie)oe.push(...le(tt,te+1));const ke=[...se.docs].sort((tt,rt)=>tt.metadata.title.localeCompare(rt.metadata.title));for(const tt of ke)oe.push(m.jsxs("button",{type:"button",onClick:()=>{window.location.hash=`/docs/${kN(tt.path)}`},className:`w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-accent text-foreground transition-colors ${i?.path===tt.path?"bg-accent":""}`,style:{paddingLeft:`${(te+1)*16}px`},children:[m.jsx(Xo,{className:"w-5 h-5"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-sm font-medium truncate",children:tt.metadata.title}),tt.metadata.description&&m.jsx("div",{className:"text-xs text-muted-foreground truncate",children:tt.metadata.description})]})]},`doc-${tt.path}`))}return oe};return n?m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading documentation..."})}):m.jsxs("div",{className:"p-6 h-full flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"Documentation"}),m.jsxs($e,{onClick:()=>g(!0),className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"New Document"]})]}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 flex-1 min-h-0 overflow-hidden",children:[m.jsxs("div",{className:"lg:col-span-1 flex flex-col min-h-0 overflow-hidden",children:[m.jsxs("div",{className:"bg-card rounded-lg border overflow-hidden flex flex-col flex-1 min-h-0",children:[m.jsx("div",{className:"p-4 border-b shrink-0",children:m.jsxs("h2",{className:"font-semibold",children:["All Documents (",e.length,")"]})}),m.jsx(Xi,{className:"flex-1",children:le(P())})]}),e.length===0&&m.jsxs("div",{className:"bg-card rounded-lg border p-8 text-center",children:[m.jsx(Xo,{className:"w-5 h-5"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"No documentation found"}),m.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Create a doc with: ",m.jsx("code",{className:"font-mono",children:'knowns doc create "Title"'})]})]})]}),m.jsx("div",{className:"lg:col-span-2 flex flex-col min-h-0 overflow-hidden",children:i?m.jsxs("div",{className:"bg-card rounded-lg border overflow-hidden flex flex-col flex-1 min-h-0",children:[m.jsxs("div",{className:"p-6 border-b flex items-start justify-between shrink-0",children:[m.jsxs("div",{className:"flex-1",children:[m.jsx("h2",{className:"text-2xl font-bold mb-2",children:i.metadata.title}),i.metadata.description&&m.jsx("p",{className:"text-muted-foreground mb-2",children:i.metadata.description}),m.jsxs("button",{type:"button",onClick:J,className:"flex items-center gap-2 px-2 py-1 rounded text-xs text-blue-600 dark:text-blue-400 hover:bg-accent transition-colors group",title:"Click to copy reference",children:[m.jsx(S9,{className:"w-4 h-4"}),m.jsxs("span",{className:"font-mono",children:["@doc/",kN(i.path).replace(/\.md$/,"")]}),m.jsx("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:H?"✓ Copied!":m.jsx(tge,{className:"w-4 h-4"})})]}),m.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["Last updated: ",new Date(i.metadata.updatedAt).toLocaleString()]})]}),m.jsx("div",{className:"flex gap-2 ml-4",children:s?m.jsxs(m.Fragment,{children:[m.jsxs($e,{onClick:B,disabled:u,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Ds,{className:"w-4 h-4 mr-2"}),u?"Saving...":"Save"]}),m.jsxs($e,{variant:"secondary",onClick:W,disabled:u,children:[m.jsx(Yo,{className:"w-4 h-4 mr-2"}),"Cancel"]})]}):m.jsxs($e,{onClick:Q,children:[m.jsx(oK,{className:"w-4 h-4 mr-2"}),"Edit"]})})]}),s?m.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:m.jsx("div",{className:"flex-1 p-6 min-h-0",children:m.jsx(yu,{markdown:l,onChange:c,placeholder:"Write your documentation here..."})})}):m.jsx(Xi,{className:"flex-1",children:m.jsx("div",{className:"p-6 prose prose-sm dark:prose-invert max-w-none",ref:$,children:m.jsx(bC,{markdown:i.content||""})})})]}):m.jsxs("div",{className:"bg-card rounded-lg border p-12 text-center",children:[m.jsx(Xo,{className:"w-5 h-5"}),m.jsx("p",{className:"mt-4 text-muted-foreground",children:"Select a document to view its content"})]})})]}),h&&m.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:m.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-4xl w-full h-[90vh] flex flex-col",children:[m.jsx("div",{className:"p-6 border-b shrink-0",children:m.jsx("h2",{className:"text-xl font-bold",children:"Create New Document"})}),m.jsxs("div",{className:"p-6 space-y-4 flex-1 flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Title *"}),m.jsx(qr,{type:"text",value:y,onChange:se=>E(se.target.value),placeholder:"Document title"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Description"}),m.jsx(qr,{type:"text",value:S,onChange:se=>w(se.target.value),placeholder:"Brief description"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Folder (optional)"}),m.jsx(qr,{type:"text",value:R,onChange:se=>_(se.target.value),placeholder:"api/auth, guides, etc. (leave empty for root)"})]}),m.jsxs("div",{className:"shrink-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Tags (comma-separated)"}),m.jsx(qr,{type:"text",value:T,onChange:se=>A(se.target.value),placeholder:"guide, tutorial, api"})]}),m.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[m.jsx("label",{className:"block text-sm font-medium mb-2",children:"Content"}),m.jsx("div",{className:"flex-1 min-h-[400px]",children:m.jsx(yu,{markdown:D,onChange:I,placeholder:"Write your documentation here..."})})]})]}),m.jsxs("div",{className:"p-6 border-t flex justify-end gap-3 shrink-0",children:[m.jsx($e,{variant:"secondary",onClick:()=>{g(!1),E(""),w(""),A(""),_(""),I("")},disabled:M,children:"Cancel"}),m.jsx($e,{onClick:X,disabled:M||!y.trim(),className:"bg-green-700 hover:bg-green-800 text-white",children:M?"Creating...":"Create Document"})]})]})})]})}const Dpt=[{label:"1 hour ago",value:3600*1e3},{label:"1 day ago",value:1440*60*1e3},{label:"1 week ago",value:10080*60*1e3},{label:"1 month ago",value:720*60*60*1e3},{label:"3 months ago",value:2160*60*60*1e3}];function $Y({tasks:e,loading:t,onTasksUpdate:n,onNewTask:r}){const i=s=>{const a=Date.now()-s;return e.filter(l=>l.status==="done"&&new Date(l.updatedAt).getTime()<a).length},o=async(s,a)=>{try{const l=await ua.batchArchiveTasks(s);if(l.count>0){const c=new Set(l.tasks.map(u=>u.id));n(e.filter(u=>!c.has(u.id))),Kl.success(`Archived ${l.count} task${l.count>1?"s":""} done before ${a}`)}else Kl.info(`No done tasks found before ${a}`)}catch(l){console.error("Failed to batch archive tasks:",l),Kl.error("Failed to archive tasks")}};return m.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[m.jsx("div",{className:"shrink-0 p-6 pb-0",children:m.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"Kanban Board"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(Ofe,{children:[m.jsx(Mfe,{asChild:!0,children:m.jsxs($e,{variant:"outline",size:"default",className:"gap-2",children:[m.jsx(z_,{className:"w-4 h-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Batch Archive"}),m.jsx(Eu,{className:"w-3 h-3"})]})}),m.jsx(yB,{align:"end",children:Dpt.map(s=>{const a=i(s.value);return m.jsxs($b,{onClick:()=>o(s.value,s.label),disabled:a===0,children:[m.jsxs("span",{className:"flex-1",children:["Done before ",s.label]}),m.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",a,")"]})]},s.value)})})]}),m.jsxs($e,{onClick:r,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"w-4 h-4 mr-2"}),"New Task"]})]})]})}),m.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-6",children:m.jsx(Ddt,{tasks:e,loading:t,onTasksUpdate:n})})]})}const UY={todo:"To Do","in-progress":"In Progress","in-review":"In Review",done:"Done",blocked:"Blocked","on-hold":"On Hold",urgent:"Urgent"};function Ipt(e){return UY[e]?UY[e]:e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Opt({tasks:e,onTaskClick:t,onNewTask:n}){const[r,i]=v.useState("all"),[o,s]=v.useState("all"),[a,l]=v.useState(new Set),c=e.filter(g=>g.subtasks&&g.subtasks.length>0);let u=r==="all"?e:e.filter(g=>g.status===r);o==="root"?u=u.filter(g=>!g.parent):o!=="all"&&(u=u.filter(g=>g.parent===o));const f={todo:[],"in-progress":[],"in-review":[],blocked:[],done:[]};for(const g of u)f[g.status]&&f[g.status].push(g);const h={high:0,medium:1,low:2};for(const g in f)f[g].sort((y,E)=>{const S=h[y.priority]-h[E.priority];return S!==0?S:y.id.localeCompare(E.id,void 0,{numeric:!0})});return m.jsxs("div",{className:"h-full flex flex-col",children:[m.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsx($I,{className:"w-4 h-4 text-muted-foreground"}),m.jsxs(Yi,{value:r,onValueChange:i,children:[m.jsx(Pi,{className:"w-[150px]",children:m.jsx(Ki,{placeholder:"Status"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Status"}),m.jsx(yn,{value:"todo",children:"To Do"}),m.jsx(yn,{value:"in-progress",children:"In Progress"}),m.jsx(yn,{value:"in-review",children:"In Review"}),m.jsx(yn,{value:"blocked",children:"Blocked"}),m.jsx(yn,{value:"done",children:"Done"})]})]}),m.jsxs(Yi,{value:o,onValueChange:s,children:[m.jsx(Pi,{className:"w-[200px]",children:m.jsx(Ki,{placeholder:"Parent"})}),m.jsxs(Fi,{children:[m.jsx(yn,{value:"all",children:"All Tasks"}),m.jsx(yn,{value:"root",children:"Root Tasks Only"}),c.map(g=>{const y=`Subtasks of #${g.id}: ${g.title}`,E=y.length>40?y.substring(0,40)+"...":y;return m.jsx(yn,{value:g.id,title:y,children:E},g.id)})]})]}),m.jsxs("span",{className:"text-muted-foreground text-sm",children:[u.length," ",u.length===1?"task":"tasks"]})]}),m.jsxs($e,{onClick:n,className:"bg-green-700 hover:bg-green-800 text-white",children:[m.jsx(Os,{className:"mr-2 h-4 w-4"}),"New Task"]})]}),m.jsx(Xi,{className:"flex-1",children:m.jsxs("div",{className:"space-y-6 pr-4",children:[Object.entries(f).map(([g,y])=>y.length===0?null:m.jsxs("div",{children:[m.jsxs("h2",{className:"text-lg font-semibold mb-3",children:[Ipt(g)," (",y.length,")"]}),m.jsx("div",{className:"space-y-2",children:y.map(E=>{const S=a.has(E.id),w=E.parent?e.find(T=>T.id===E.parent):null;return m.jsx("div",{className:"bg-card rounded-lg p-4 border transition-colors hover:bg-accent/50",children:m.jsxs("div",{className:"flex items-start gap-3",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[m.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["#",E.id]}),m.jsx(rde,{status:E.status}),m.jsx(ide,{priority:E.priority}),w&&m.jsxs("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",children:["Subtask of #",w.id]}),E.subtasks&&E.subtasks.length>0&&m.jsxs("span",{className:"text-xs px-2 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",children:[E.subtasks.length," subtask",E.subtasks.length>1?"s":""]})]}),m.jsx("button",{type:"button",onClick:()=>t(E),className:"font-medium mb-1 hover:underline text-left w-full",children:E.title}),E.description&&m.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:[m.jsx("p",{className:S?"":"line-clamp-2",children:E.description}),E.description.length>100&&m.jsx("button",{type:"button",onClick:T=>{T.stopPropagation();const A=new Set(a);S?A.delete(E.id):A.add(E.id),l(A)},className:"text-xs text-primary hover:underline mt-1 font-medium",children:S?"Show less":"Show more"})]}),E.acceptanceCriteria.length>0&&m.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs text-muted-foreground",children:[m.jsx(QY,{className:"w-3 h-3"}),m.jsxs("span",{children:[E.acceptanceCriteria.filter(T=>T.completed).length,"/",E.acceptanceCriteria.length," criteria"]})]}),E.labels.length>0&&m.jsx("div",{className:"mt-2",children:m.jsx(ode,{labels:E.labels,maxVisible:3})})]}),E.assignee&&m.jsx("span",{className:"text-sm text-muted-foreground font-mono shrink-0",children:E.assignee})]})},E.id)})})]},g)),u.length===0&&m.jsx("div",{className:"text-center py-12",children:m.jsx("p",{className:"text-lg text-muted-foreground",children:"No tasks found"})})]})})]})}function Mpt({tasks:e,loading:t,onTasksUpdate:n,selectedTask:r,onTaskClose:i,onNewTask:o}){const[s,a]=v.useState("table"),[l,c]=v.useState(null),[u,f]=v.useState([]);v.useEffect(()=>{r&&c(r)},[r]);const h=y=>{window.location.hash=`/tasks/${y.id}`},g=y=>{window.location.hash=`/tasks/${y}`};return t?m.jsx("div",{className:"p-6 flex items-center justify-center h-64",children:m.jsx("div",{className:"text-lg text-muted-foreground",children:"Loading tasks..."})}):m.jsxs("div",{className:"p-6 h-full flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx("h1",{className:"text-2xl font-bold",children:"All Tasks"}),m.jsxs("span",{className:"text-muted-foreground",children:[e.length," ",e.length===1?"task":"tasks"]})]}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs("div",{className:"flex items-center border rounded-lg p-1",children:[m.jsxs($e,{variant:s==="table"?"secondary":"ghost",size:"sm",onClick:()=>a("table"),className:"h-8 px-3",children:[m.jsx(Sge,{className:"h-4 w-4 mr-2"}),"Table"]}),m.jsxs($e,{variant:s==="grouped"?"secondary":"ghost",size:"sm",onClick:()=>a("grouped"),className:"h-8 px-3",children:[m.jsx(xge,{className:"h-4 w-4 mr-2"}),"Grouped"]})]})})]}),m.jsx("div",{className:"flex-1 overflow-hidden",children:s==="table"?m.jsx(Xi,{className:"h-full",children:m.jsx("div",{className:"pr-4",children:m.jsx(Apt,{tasks:e,onTaskClick:h,onSelectionChange:f,onNewTask:o})})}):m.jsx(Opt,{tasks:e,onTaskClick:h,onNewTask:o})}),u.length>0&&m.jsxs("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 bg-primary text-primary-foreground px-4 py-2 rounded-lg shadow-lg flex items-center gap-4",children:[m.jsxs("span",{className:"text-sm font-medium",children:[u.length," task",u.length>1?"s":""," selected"]}),m.jsx($e,{variant:"secondary",size:"sm",onClick:()=>{console.log("Bulk action on:",u)},children:"Bulk Edit"})]}),m.jsx(_de,{task:l,allTasks:e,onClose:()=>{c(null),i&&i()},onUpdate:n,onNavigateToTask:g})]})}const Pfe=v.createContext({isDark:!1,toggle:()=>{}}),Pm=()=>v.useContext(Pfe);function Lpt(){const{config:e}=bf(),[t,n]=v.useState([]),[r,i]=v.useState(!0),[o,s]=v.useState(!1),[a,l]=v.useState(!1),[c,u]=v.useState(()=>{if(typeof window<"u"){const I=localStorage.getItem("theme");return I?I==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),f=()=>{const I=window.location.hash.slice(1);return I.startsWith("/tasks")?"tasks":I.startsWith("/docs")?"docs":I.startsWith("/config")?"config":(I.startsWith("/kanban")||I==="/"||I==="","kanban")},h=I=>{const M=window.location.hash.slice(1),j="(?:kanban|tasks)",L=M.match(new RegExp(`^/${j}/([^?]+)`))||M.match(/[?&]id=([^&]+)/);return L?L[1]:null},[g,y]=v.useState(f()),[E,S]=v.useState(window.location.hash);v.useEffect(()=>{const I=()=>{y(f()),S(window.location.hash)};return window.addEventListener("hashchange",I),()=>window.removeEventListener("hashchange",I)},[f]),v.useEffect(()=>{c?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))},[c]),v.useEffect(()=>{const I=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),l(j=>!j))};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]),v.useEffect(()=>{ua.getTasks().then(I=>{n(I),i(!1)}).catch(I=>{console.error("Failed to load tasks:",I),i(!1)})},[]),xu("tasks:updated",({task:I})=>{n(M=>{const j=M.findIndex(L=>L.id===I.id);if(j>=0){const L=[...M];return L[j]=I,L}return[...M,I]})}),xu("tasks:refresh",()=>{ua.getTasks().then(n).catch(console.error)});const w=()=>{ua.getTasks().then(n).catch(console.error)},T=I=>{n(I)},A=async I=>{const M=!c;if(!document.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){u(M);return}const j=I.clientX,L=I.clientY,F=Math.hypot(Math.max(j,window.innerWidth-j),Math.max(L,window.innerHeight-L));await document.startViewTransition(()=>{u(M)}).ready,document.documentElement.animate({clipPath:[`circle(0px at ${j}px ${L}px)`,`circle(${F}px at ${j}px ${L}px)`]},{duration:400,easing:"ease-out",pseudoElement:"::view-transition-new(root)"})},R=I=>{window.location.hash=`/kanban/${I.id}`},_=I=>{I?.path?window.location.hash=`/docs/${I.path}`:I?.filename?window.location.hash=`/docs/${I.filename}`:window.location.hash="/docs"},D=()=>{switch(g){case"kanban":return m.jsx($Y,{tasks:t,loading:r,onTasksUpdate:T,onNewTask:()=>s(!0)});case"tasks":{const I=h(),M=I?t.find(j=>j.id===I):null;return m.jsx(Mpt,{tasks:t,loading:r,onTasksUpdate:w,selectedTask:M,onTaskClose:()=>{window.location.hash="/tasks"},onNewTask:()=>s(!0)})}case"docs":return m.jsx(Rpt,{});case"config":return m.jsx(_pt,{});default:return m.jsx($Y,{tasks:t,loading:r,onTasksUpdate:T,onNewTask:()=>s(!0)})}};return m.jsxs(Pfe.Provider,{value:{isDark:c,toggle:A},children:[m.jsxs(lfe,{children:[m.jsx(nft,{currentPage:g,onSearchClick:()=>l(!0)}),m.jsxs("main",{className:"flex flex-1 flex-col bg-background overflow-hidden",children:[m.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[m.jsx(ufe,{className:"-ml-1"}),m.jsx(j0,{orientation:"vertical",className:"mr-2 h-4"}),m.jsx("div",{className:"flex flex-1 items-center gap-2 text-sm",children:m.jsx("span",{className:"font-semibold text-foreground",children:e.name||"Knowns"})}),m.jsx(Iat,{onTaskClick:I=>{window.location.hash=`/kanban/${I}`}}),m.jsx(_at,{isDark:c,onToggle:A,size:"sm"}),m.jsx(lft,{})]}),m.jsx("div",{className:"flex-1 w-full overflow-y-auto overflow-x-hidden",children:D()})]}),m.jsx(Odt,{isOpen:o,allTasks:t,onClose:()=>s(!1),onCreated:w}),m.jsx(uft,{open:a,onOpenChange:l,onTaskSelect:R,onDocSelect:_})]}),m.jsx(Iwe,{})]})}function Ppt(){return m.jsx(ibe,{children:m.jsx(Owe,{children:m.jsx(Lwe,{children:m.jsx(pme,{children:m.jsx(xat,{children:m.jsx(Lpt,{})})})})})})}const Ffe=document.getElementById("root");if(!Ffe)throw new Error("Root element not found");zY.createRoot(Ffe).render(m.jsx(Ppt,{}));