@teamco/ischeduler-shadcn 2.0.16 → 2.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -38,4 +38,4 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
38
38
  `},gf=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},_f=function(){l.useEffect(function(){return document.body.setAttribute(mf,(gf()+1).toString()),function(){var e=gf()-1;e<=0?document.body.removeAttribute(mf):document.body.setAttribute(mf,e.toString())}},[])},vf=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;_f();var a=l.useMemo(function(){return ff(i)},[i]);return l.createElement(pf,{styles:hf(a,!t,i,n?``:`!important`)})},yf=!1;if(typeof window<`u`)try{var bf=Object.defineProperty({},`passive`,{get:function(){return yf=!0,!0}});window.addEventListener(`test`,bf,bf),window.removeEventListener(`test`,bf,bf)}catch{yf=!1}var xf=yf?{passive:!1}:!1,Sf=function(e){return e.tagName===`TEXTAREA`},Cf=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Sf(e)&&n[t]===`visible`)},wf=function(e){return Cf(e,`overflowY`)},Tf=function(e){return Cf(e,`overflowX`)},Ef=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),kf(e,r)){var i=Af(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Df=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Of=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},kf=function(e,t){return e===`v`?wf(t):Tf(t)},Af=function(e,t){return e===`v`?Df(t):Of(t)},jf=function(e,t){return e===`h`&&t===`rtl`?-1:1},Mf=function(e,t,n,r,i){var a=jf(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Af(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&kf(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Nf=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Pf=function(e){return[e.deltaX,e.deltaY]},Ff=function(e){return e&&`current`in e?e.current:e},If=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Lf=function(e){return`
39
39
  .block-interactivity-${e} {pointer-events: none;}
40
40
  .allow-interactivity-${e} {pointer-events: all;}
41
- `},Rf=0,zf=[];function Bf(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),i=l.useState(Rf++)[0],a=l.useState(cf)[0],o=l.useRef(e);l.useEffect(function(){o.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Id([e.lockRef.current],(e.shards||[]).map(Ff),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=l.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Nf(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Ef(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ef(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Mf(h,t,e,h===`h`?s:c,!0)},[]),c=l.useCallback(function(e){var n=e;if(!(!zf.length||zf[zf.length-1]!==a)){var r=`deltaY`in n?Pf(n):Nf(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&If(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ff).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=l.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Vf(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=l.useCallback(function(e){n.current=Nf(e),r.current=void 0},[]),f=l.useCallback(function(t){u(t.type,Pf(t),t.target,s(t,e.lockRef.current))},[]),p=l.useCallback(function(t){u(t.type,Nf(t),t.target,s(t,e.lockRef.current))},[]);l.useEffect(function(){return zf.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,xf),document.addEventListener(`touchmove`,c,xf),document.addEventListener(`touchstart`,d,xf),function(){zf=zf.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,xf),document.removeEventListener(`touchmove`,c,xf),document.removeEventListener(`touchstart`,d,xf)}},[]);var m=e.removeScrollBar,h=e.inert;return l.createElement(l.Fragment,null,h?l.createElement(a,{styles:Lf(i)}):null,m?l.createElement(vf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Vf(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Hf=Xd(Zd,Bf),Uf=l.forwardRef(function(e,t){return l.createElement($d,Pd({},e,{ref:t,sideCar:Hf}))});Uf.classNames=$d.classNames;var Wf=[`Enter`,` `],Gf=[`ArrowDown`,`PageUp`,`Home`],Kf=[`ArrowUp`,`PageDown`,`End`],qf=[...Gf,...Kf],Jf={ltr:[...Wf,`ArrowRight`],rtl:[...Wf,`ArrowLeft`]},Yf={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xf=`Menu`,[Zf,Qf,$f]=ba(Xf),[ep,tp]=fa(Xf,[$f,ml,Ka]),np=ml(),rp=Ka(),[ip,ap]=ep(Xf),[op,sp]=ep(Xf),cp=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=np(t),[c,l]=u.useState(null),d=u.useRef(!1),p=Ma(a),m=Ra(i);return u.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,f.jsx)(Al,{...s,children:(0,f.jsx)(ip,{scope:t,open:n,onOpenChange:p,content:c,onContentChange:l,children:(0,f.jsx)(op,{scope:t,onClose:u.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:m,modal:o,children:r})})})};cp.displayName=Xf;var lp=`MenuAnchor`,up=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=np(n);return(0,f.jsx)(jl,{...i,...r,ref:t})});up.displayName=lp;var dp=`MenuPortal`,[fp,pp]=ep(dp,{forceMount:void 0}),mp=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ap(dp,t);return(0,f.jsx)(fp,{scope:t,forceMount:n,children:(0,f.jsx)(so,{present:n||a.open,children:(0,f.jsx)(Fl,{asChild:!0,container:i,children:r})})})};mp.displayName=dp;var hp=`MenuContent`,[gp,_p]=ep(hp),vp=u.forwardRef((e,t)=>{let n=pp(hp,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ap(hp,e.__scopeMenu),o=sp(hp,e.__scopeMenu);return(0,f.jsx)(Zf.Provider,{scope:e.__scopeMenu,children:(0,f.jsx)(so,{present:r||a.open,children:(0,f.jsx)(Zf.Slot,{scope:e.__scopeMenu,children:o.modal?(0,f.jsx)(yp,{...i,ref:t}):(0,f.jsx)(bp,{...i,ref:t})})})})}),yp=u.forwardRef((e,t)=>{let n=ap(hp,e.__scopeMenu),r=u.useRef(null),i=B(t,r);return u.useEffect(()=>{let e=r.current;if(e)return Nd(e)},[]),(0,f.jsx)(Sp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bp=u.forwardRef((e,t)=>{let n=ap(hp,e.__scopeMenu);return(0,f.jsx)(Sp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xp=yd(`MenuContent.ScrollLock`),Sp=u.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=ap(hp,n),y=sp(hp,n),b=np(n),x=rp(n),S=Qf(n),[C,w]=u.useState(null),T=u.useRef(null),E=B(t,T,v.onContentChange),D=u.useRef(0),O=u.useRef(``),k=u.useRef(0),A=u.useRef(null),j=u.useRef(`right`),M=u.useRef(0),ee=g?Uf:u.Fragment,N=g?{as:xp,allowPinchZoom:!0}:void 0,P=e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=om(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};u.useEffect(()=>()=>window.clearTimeout(D.current),[]),td();let F=u.useCallback(e=>j.current===A.current?.side&&cm(e,A.current?.area),[]);return(0,f.jsx)(gp,{scope:n,searchRef:O,onItemEnter:u.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:u.useCallback(e=>{F(e)||(T.current?.focus(),w(null))},[F]),onTriggerLeave:u.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:k,onPointerGraceIntentChange:u.useCallback(e=>{A.current=e},[]),children:(0,f.jsx)(ee,{...N,children:(0,f.jsx)(sd,{asChild:!0,trapped:i,onMountAutoFocus:Z(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,f.jsx)(Uo,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,f.jsx)(io,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:Z(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,f.jsx)(Ml,{role:`menu`,"aria-orientation":`vertical`,"data-state":tm(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:Z(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=T.current;if(e.target!==i||!qf.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);Kf.includes(e.key)&&a.reverse(),im(a)}),onBlur:Z(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:Z(e.onPointerMove,lm(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(j.current=e.clientX>M.current?`right`:`left`,M.current=e.clientX)}))})})})})})})});vp.displayName=hp;var Cp=`MenuGroup`,wp=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,f.jsx)(Q.div,{role:`group`,...r,ref:t})});wp.displayName=Cp;var Tp=`MenuLabel`,Ep=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,f.jsx)(Q.div,{...r,ref:t})});Ep.displayName=Tp;var Dp=`MenuItem`,Op=`menu.itemSelect`,kp=u.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=u.useRef(null),o=sp(Dp,e.__scopeMenu),s=_p(Dp,e.__scopeMenu),c=B(t,a),l=u.useRef(!1),d=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Op,{bubbles:!0,cancelable:!0});e.addEventListener(Op,e=>r?.(e),{once:!0}),ja(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,f.jsx)(Ap,{...i,ref:c,disabled:n,onClick:Z(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Z(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Z(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Wf.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kp.displayName=Dp;var Ap=u.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=_p(Dp,n),s=rp(n),c=u.useRef(null),l=B(t,c),[d,p]=u.useState(!1),[m,h]=u.useState(``);return u.useEffect(()=>{let e=c.current;e&&h((e.textContent??``).trim())},[a.children]),(0,f.jsx)(Zf.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:(0,f.jsx)(ao,{asChild:!0,...s,focusable:!r,children:(0,f.jsx)(Q.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Z(e.onPointerMove,lm(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Z(e.onPointerLeave,lm(e=>o.onItemLeave(e))),onFocus:Z(e.onFocus,()=>p(!0)),onBlur:Z(e.onBlur,()=>p(!1))})})})}),jp=`MenuCheckboxItem`,Mp=u.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,f.jsx)(Bp,{scope:e.__scopeMenu,checked:n,children:(0,f.jsx)(kp,{role:`menuitemcheckbox`,"aria-checked":nm(n)?`mixed`:n,...i,ref:t,"data-state":rm(n),onSelect:Z(i.onSelect,()=>r?.(nm(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mp.displayName=jp;var Np=`MenuRadioGroup`,[Pp,Fp]=ep(Np,{value:void 0,onValueChange:()=>{}}),Ip=u.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Ma(r);return(0,f.jsx)(Pp,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,f.jsx)(wp,{...i,ref:t})})});Ip.displayName=Np;var Lp=`MenuRadioItem`,Rp=u.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fp(Lp,e.__scopeMenu),a=n===i.value;return(0,f.jsx)(Bp,{scope:e.__scopeMenu,checked:a,children:(0,f.jsx)(kp,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":rm(a),onSelect:Z(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rp.displayName=Lp;var zp=`MenuItemIndicator`,[Bp,Vp]=ep(zp,{checked:!1}),Hp=u.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vp(zp,n);return(0,f.jsx)(so,{present:r||nm(a.checked)||a.checked===!0,children:(0,f.jsx)(Q.span,{...i,ref:t,"data-state":rm(a.checked)})})});Hp.displayName=zp;var Up=`MenuSeparator`,Wp=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,f.jsx)(Q.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wp.displayName=Up;var Gp=`MenuArrow`,Kp=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=np(n);return(0,f.jsx)(Nl,{...i,...r,ref:t})});Kp.displayName=Gp;var qp=`MenuSub`,[Jp,Yp]=ep(qp),Xp=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ap(qp,t),o=np(t),[s,c]=u.useState(null),[l,d]=u.useState(null),p=Ma(i);return u.useEffect(()=>(a.open===!1&&p(!1),()=>p(!1)),[a.open,p]),(0,f.jsx)(Al,{...o,children:(0,f.jsx)(ip,{scope:t,open:r,onOpenChange:p,content:l,onContentChange:d,children:(0,f.jsx)(Jp,{scope:t,contentId:wa(),triggerId:wa(),trigger:s,onTriggerChange:c,children:n})})})};Xp.displayName=qp;var Zp=`MenuSubTrigger`,Qp=u.forwardRef((e,t)=>{let n=ap(Zp,e.__scopeMenu),r=sp(Zp,e.__scopeMenu),i=Yp(Zp,e.__scopeMenu),a=_p(Zp,e.__scopeMenu),o=u.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},d=u.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return u.useEffect(()=>d,[d]),u.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,f.jsx)(up,{asChild:!0,...l,children:(0,f.jsx)(Ap,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tm(n.open),...e,ref:Me(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Z(e.onPointerMove,lm(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Z(e.onPointerLeave,lm(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Z(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Jf[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qp.displayName=Zp;var $p=`MenuSubContent`,em=u.forwardRef((e,t)=>{let n=pp(hp,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ap(hp,e.__scopeMenu),o=sp(hp,e.__scopeMenu),s=Yp($p,e.__scopeMenu),c=u.useRef(null),l=B(t,c);return(0,f.jsx)(Zf.Provider,{scope:e.__scopeMenu,children:(0,f.jsx)(so,{present:r||a.open,children:(0,f.jsx)(Zf.Slot,{scope:e.__scopeMenu,children:(0,f.jsx)(Sp,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:Z(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Z(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:Z(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Yf[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});em.displayName=$p;function tm(e){return e?`open`:`closed`}function nm(e){return e===`indeterminate`}function rm(e){return nm(e)?`indeterminate`:e?`checked`:`unchecked`}function im(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function am(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function om(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=am(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sm(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cm(e,t){return t?sm({x:e.clientX,y:e.clientY},t):!1}function lm(e){return t=>t.pointerType===`mouse`?e(t):void 0}var um=cp,dm=up,fm=mp,pm=vp,mm=wp,hm=Ep,gm=kp,_m=Mp,vm=Ip,ym=Rp,bm=Hp,xm=Wp,Sm=Kp,Cm=Qp,wm=em,Tm=`DropdownMenu`,[Em,Dm]=fa(Tm,[tp]),$=tp(),[Om,km]=Em(Tm),Am=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=u.useRef(null),[d,p]=Pa({prop:i,defaultProp:a??!1,onChange:o,caller:Tm});return(0,f.jsx)(Om,{scope:t,triggerId:wa(),triggerRef:l,contentId:wa(),open:d,onOpenChange:p,onOpenToggle:u.useCallback(()=>p(e=>!e),[p]),modal:s,children:(0,f.jsx)(um,{...c,open:d,onOpenChange:p,dir:r,modal:s,children:n})})};Am.displayName=Tm;var jm=`DropdownMenuTrigger`,Mm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=km(jm,n),o=$(n);return(0,f.jsx)(dm,{asChild:!0,...o,children:(0,f.jsx)(Q.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Me(t,a.triggerRef),onPointerDown:Z(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Z(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Mm.displayName=jm;var Nm=`DropdownMenuPortal`,Pm=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,f.jsx)(fm,{...r,...n})};Pm.displayName=Nm;var Fm=`DropdownMenuContent`,Im=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=km(Fm,n),a=$(n),o=u.useRef(!1);return(0,f.jsx)(pm,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Z(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Z(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Im.displayName=Fm;var Lm=`DropdownMenuGroup`,Rm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(mm,{...i,...r,ref:t})});Rm.displayName=Lm;var zm=`DropdownMenuLabel`,Bm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(hm,{...i,...r,ref:t})});Bm.displayName=zm;var Vm=`DropdownMenuItem`,Hm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(gm,{...i,...r,ref:t})});Hm.displayName=Vm;var Um=`DropdownMenuCheckboxItem`,Wm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(_m,{...i,...r,ref:t})});Wm.displayName=Um;var Gm=`DropdownMenuRadioGroup`,Km=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(vm,{...i,...r,ref:t})});Km.displayName=Gm;var qm=`DropdownMenuRadioItem`,Jm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(ym,{...i,...r,ref:t})});Jm.displayName=qm;var Ym=`DropdownMenuItemIndicator`,Xm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(bm,{...i,...r,ref:t})});Xm.displayName=Ym;var Zm=`DropdownMenuSeparator`,Qm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(xm,{...i,...r,ref:t})});Qm.displayName=Zm;var $m=`DropdownMenuArrow`,eh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(Sm,{...i,...r,ref:t})});eh.displayName=$m;var th=`DropdownMenuSubTrigger`,nh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(Cm,{...i,...r,ref:t})});nh.displayName=th;var rh=`DropdownMenuSubContent`,ih=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(wm,{...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)`}})});ih.displayName=rh;var ah=Am,oh=Mm,sh=Pm,ch=Im,lh=Bm,uh=Hm,dh=Wm,fh=Jm,ph=Xm,mh=Qm,hh=nh,gh=ih,_h=ah,vh=oh,yh=u.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,f.jsxs)(hh,{ref:i,className:z(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,f.jsx)(ct,{className:`ml-auto h-4 w-4`})]}));yh.displayName=hh.displayName;var bh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(gh,{ref:n,className:z(`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`,e),...t}));bh.displayName=gh.displayName;var xh=u.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,f.jsx)(sh,{children:(0,f.jsx)(ch,{ref:r,sideOffset:t,className:z(`z-50 min-w-[8rem] overflow-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`,e),...n})}));xh.displayName=ch.displayName;var Sh=u.forwardRef(({className:e,inset:t,...n},r)=>(0,f.jsx)(uh,{ref:r,className:z(`relative flex cursor-default select-none items-center 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`,t&&`pl-8`,e),...n}));Sh.displayName=uh.displayName;var Ch=u.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,f.jsxs)(dh,{ref:i,className:z(`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:[(0,f.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,f.jsx)(ph,{children:(0,f.jsx)(at,{className:`h-4 w-4`})})}),t]}));Ch.displayName=dh.displayName;var wh=u.forwardRef(({className:e,children:t,...n},r)=>(0,f.jsxs)(fh,{ref:r,className:z(`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:[(0,f.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,f.jsx)(ph,{children:(0,f.jsx)(ut,{className:`h-2 w-2 fill-current`})})}),t]}));wh.displayName=fh.displayName;var Th=u.forwardRef(({className:e,inset:t,...n},r)=>(0,f.jsx)(lh,{ref:r,className:z(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));Th.displayName=lh.displayName;var Eh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(mh,{ref:n,className:z(`-mx-1 my-1 h-px bg-muted`,e),...t}));Eh.displayName=mh.displayName;var Dh=({className:e,...t})=>(0,f.jsx)(`span`,{className:z(`ml-auto text-xs tracking-widest opacity-60`,e),...t});Dh.displayName=`DropdownMenuShortcut`;var Oh=e=>{let{t}=(0,c.useSchedulerContext)(),{selectedColumns:n=[],columnsList:r=[],onChange:i}=e;if(!r?.length)return(0,f.jsx)(f.Fragment,{});let a=t(`table.hideColumns`),o=(e,t)=>{if(t)i([...n,e]);else{if(n.length<=1)return;i(n.filter(t=>t!==e))}};return(0,f.jsxs)(_h,{children:[(0,f.jsx)(vh,{asChild:!0,children:(0,f.jsxs)(X,{variant:`outline`,size:`sm`,children:[(0,f.jsx)(gt,{className:`mr-2 h-4 w-4`}),a]})}),(0,f.jsxs)(xh,{align:`end`,className:`w-[200px]`,children:[(0,f.jsx)(Th,{children:a}),(0,f.jsx)(Eh,{}),r.map(e=>(0,f.jsx)(Ch,{className:`capitalize`,checked:n.includes(e.value),onCheckedChange:t=>o(e.value,!!t),disabled:e.disabled,children:e.label},e.value))]})]})},kh=e=>{let{loading:t,t:n}=(0,c.useSchedulerContext)(),{children:r,items:i=[],onRefresh:a}=e;return(0,f.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[r,(0,f.jsxs)(_h,{children:[(0,f.jsx)(vh,{asChild:!0,children:(0,f.jsx)(X,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0`,children:t?(0,f.jsx)(ft,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(dt,{className:`h-4 w-4`})})}),(0,f.jsxs)(xh,{align:`end`,children:[i.map((e,t)=>(0,f.jsxs)(Sh,{onClick:e.onClick,className:`gap-2`,children:[e.icon,e.label]},t)),i.length>0&&a&&(0,f.jsx)(Eh,{}),a&&(0,f.jsxs)(Sh,{onClick:a,className:`gap-2`,children:[(0,f.jsx)(mt,{className:`h-4 w-4`}),n(`toolbar.refresh`)]})]})]})]})},Ah=Xe(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function jh({className:e,variant:t,...n}){return(0,f.jsx)(`div`,{className:z(Ah({variant:t}),e),...n})}var Mh={ACTIVE:`default`,DEACTIVATED:`secondary`,DELETED:`destructive`,PROCESSING:`outline`,PENDING:`outline`,APPROVED:`default`,PUBLISHED:`default`},Nh=({status:e})=>(0,f.jsx)(jh,{variant:Mh[e]||`outline`,children:e}),Ph=g.Root,Fh=g.Trigger,Ih=g.Portal,Lh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(g.Overlay,{ref:n,className:z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Lh.displayName=g.Overlay.displayName;var Rh=u.forwardRef(({className:e,children:t,...n},r)=>(0,f.jsxs)(Ih,{children:[(0,f.jsx)(Lh,{}),(0,f.jsxs)(g.Content,{ref:r,"aria-describedby":void 0,className:z(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[50%] translate-y-[50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...n,children:[t,(0,f.jsxs)(g.Close,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,f.jsx)(yt,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Rh.displayName=g.Content.displayName;var zh=({className:e,...t})=>(0,f.jsx)(`div`,{className:z(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});zh.displayName=`DialogHeader`;var Bh=({className:e,...t})=>(0,f.jsx)(`div`,{className:z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Bh.displayName=`DialogFooter`;var Vh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(g.Title,{ref:n,className:z(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Vh.displayName=g.Title.displayName;var Hh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(g.Description,{ref:n,className:z(`text-sm text-muted-foreground`,e),...t}));Hh.displayName=g.Description.displayName;var Uh=e=>{let{t,permissions:n}=(0,c.useSchedulerContext)(),{entity:r,disabled:i,onDelete:a,showLabel:o=!1}=e,[s,l]=(0,u.useState)(!1);return!r||!n.canDelete?null:(0,f.jsxs)(Ph,{open:s,onOpenChange:l,children:[(0,f.jsx)(Eu,{children:(0,f.jsxs)(Du,{children:[(0,f.jsx)(Ou,{asChild:!0,children:(0,f.jsx)(Fh,{asChild:!0,children:(0,f.jsxs)(X,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10`,disabled:i,onClick:e=>e.stopPropagation(),children:[(0,f.jsx)(vt,{className:`h-4 w-4`}),o&&(0,f.jsx)(`span`,{className:`ml-2`,children:t(`actions.delete`)})]})})}),(0,f.jsx)(ku,{children:(0,f.jsx)(`p`,{children:t(`actions.delete`)})})]})}),(0,f.jsxs)(Rh,{onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(zh,{children:[(0,f.jsx)(Vh,{children:t(`actions.delete`)}),(0,f.jsx)(Hh,{children:t(`actions.confirm.delete`)})]}),(0,f.jsxs)(Bh,{children:[(0,f.jsx)(X,{variant:`outline`,onClick:()=>l(!1),children:t(`actions.cancel`)}),(0,f.jsx)(X,{variant:`destructive`,onClick:e=>{e.stopPropagation(),a?.(r),l(!1)},children:t(`actions.delete`)})]})]})]})},Wh=e=>{let{t,permissions:n}=(0,c.useSchedulerContext)(),{entity:r,disabled:i,onEdit:a,showLabel:o=!1}=e;return!r||!n.canUpdate?null:(0,f.jsx)(Eu,{children:(0,f.jsxs)(Du,{children:[(0,f.jsx)(Ou,{asChild:!0,children:(0,f.jsxs)(X,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,disabled:i,onClick:e=>{e.stopPropagation(),a?.(r)},children:[(0,f.jsx)(pt,{className:`h-4 w-4`}),o&&(0,f.jsx)(`span`,{className:`ml-2`,children:t(`actions.edit`)})]})}),(0,f.jsx)(ku,{children:(0,f.jsx)(`p`,{children:t(`actions.edit`)})})]})})},Gh=e=>(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e?.days.map((e,t)=>(0,f.jsx)(jh,{variant:`outline`,className:`font-normal`,children:e},t))}),Kh=(e,t)=>e?.type===`PERIOD`?(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t?.days.map((t,n)=>(0,f.jsx)(jh,{variant:`outline`,className:`font-normal bg-blue-50 text-blue-700 border-blue-200`,children:`${e.weekDay} ${t}`},n))}):(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(0,f.jsx)(jh,{variant:`outline`,className:`font-normal bg-orange-50 text-orange-700 border-orange-200`,children:e?.monthDay})}),qh=(e,t,n)=>(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[Kh(t,n),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e?.months?.map((e,t)=>(0,f.jsx)(jh,{variant:`outline`,className:`font-normal bg-purple-50 text-purple-700 border-purple-200`,children:e},t))})]}),Jh=e=>{let{disabled:t,schedulerType:n,currency:r,t:i,onEdit:a,onDelete:o}=e,s=(e,t,n={})=>({id:e,key:e,title:t,label:t,...n});return[s(`index`,`#`,{className:`w-[50px]`}),s(`duration`,i(`scheduler.meta.duration`),{className:`w-[120px]`,format:e=>`${e?.period} (${e?.type})`}),s(`repeat`,i(`scheduler.duration`),{className:`min-w-[200px]`,format:(e,t)=>{let{duration:n,repeat:r}=t,{weekly:i,monthly:a,yearly:o}=r;switch(n?.type){case`WEEK`:return Gh(i);case`MONTH`:return Kh(a,i);case`YEAR`:return qh(o,a,i);default:return null}}}),[c.ESchedulerPrefix.DISCOUNT,c.ESchedulerPrefix.TRIAL_DISCOUNT].includes(n)?s(`discount`,i(`scheduler.meta.discount`),{className:`w-[120px]`,format:e=>e?e.type===`PERCENT`?`${e.value}${c.CDiscountTypeValues[e.type]}`:(0,c.numberToCurrency)(e.value,r??`USD`):`—`}):null,s(`status`,i(`scheduler.status`),{className:`w-[120px] text-center`,concealable:!0,format:e=>(0,f.jsx)(Nh,{status:e})}),s(`updatedAt`,i(`scheduler.updatedAt`),{className:`w-[180px] text-center`,concealable:!0,format:e=>(0,f.jsx)(`span`,{children:e?.updatedAt?(0,c.tsToLocaleDateTime)(e.updatedAt):`—`})}),a||o?s(`actions`,i(`table.actions`),{className:`w-[100px] text-center`,format:(e,n)=>(0,f.jsxs)(`div`,{className:`flex justify-center gap-1`,children:[a&&(0,f.jsx)(Wh,{onEdit:a,disabled:t,entity:n}),o&&(0,f.jsx)(Uh,{onDelete:o,entity:n,disabled:t})]})}):null].filter(Boolean)},Yh=e=>e.map((e,t)=>({...e,key:e.id||t.toString(),index:t+1})),Xh=()=>({title:`#`,dataIndex:`index`,key:`index`,width:`50px`}),Zh=e=>({title:e(`table.actions`),key:`actions`,width:`100px`}),Qh=e=>{let{type:t,title:n,disabled:r,readOnlyFields:i=[],currency:a,onRefresh:o}=e,{schedulers:s,loading:l,limit:d=c.DEFAULT_SCHEDULERS_LIMIT,disabled:p,t:m,permissions:h,onUpdate:g,onDelete:_}=(0,c.useSchedulerContext)(),v=r??p,y=s[t]??[],[b,x]=(0,u.useState)(new Set),[S,C]=(0,u.useState)(!1),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(!1),[O,k]=(0,u.useState)(null),A=(0,u.useMemo)(()=>{let e=y;return b.size>0&&(e=e.filter(e=>!e.id||!b.has(e.id))),Yh(e)},[y,b]),j=A.length>=d,M=e=>{k(JSON.parse(JSON.stringify(e))),D(!0),C(!1)},ee=async()=>{if(!(!O||!g))try{await g(t,O),D(!1),k(null),C(!1),o?.()}catch(e){console.error(`Failed to update scheduler:`,e)}},N=async e=>{if(e.id?.startsWith(`new-`)){x(t=>{let n=new Set(t);return e.id&&n.add(e.id),n});return}_&&e.id&&(await _(t,e.id),o?.())},{filteredColumns:P,columnsList:F,selectedColumns:I,setSelectedColumns:te}=(0,c.useColumnsToggle)((0,u.useMemo)(()=>Jh({disabled:v,schedulerType:t,entities:A,currency:a,t:m,onEdit:h.canUpdate?M:void 0,onDelete:h.canDelete?N:void 0}),[v,t,A,a,m,h.canUpdate,h.canDelete,N]));return(0,f.jsxs)(`div`,{className:`w-full space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[n&&(0,f.jsx)(`h2`,{className:`text-lg font-semibold`,children:n}),(0,f.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[h.canCreate&&!j&&(0,f.jsx)($u,{setDirty:C,dirty:S,isCreating:w,setIsCreating:T,schedulerType:t,disabled:v||l||j||w,onSuccess:()=>o?.(),buttonProps:{variant:`outline`,size:`sm`}}),(0,f.jsx)(kh,{onRefresh:o,children:(0,f.jsx)(Oh,{columnsList:F,selectedColumns:I,onChange:te})})]})]}),(0,f.jsx)(`div`,{className:`rounded-md border`,children:(0,f.jsxs)(Pu,{children:[(0,f.jsx)(Fu,{children:(0,f.jsx)(Ru,{children:P.filter(e=>!e.hidden).map(e=>(0,f.jsx)(zu,{className:e.className,children:e.label},e.id))})}),(0,f.jsxs)(Iu,{children:[A.map(e=>(0,f.jsx)(Ru,{children:P.filter(e=>!e.hidden).map(t=>{let n=t.id.includes(`.`)?t.id.split(`.`).reduce((e,t)=>e?.[t],e):e[t.id];return(0,f.jsx)(Bu,{className:t.className,children:t.format?t.format(n,e):n},t.id)})},e.key)),A.length===0&&(0,f.jsx)(Ru,{children:(0,f.jsx)(Bu,{colSpan:P.length,className:`h-24 text-center`,children:m(`table.noData`)||`No items found`})})]})]})}),(0,f.jsx)(Hu,{open:E,onOpenChange:e=>!e&&D(!1),children:(0,f.jsxs)(qu,{className:`w-full sm:max-w-[600px] overflow-y-auto`,children:[(0,f.jsxs)(Ju,{className:`flex flex-row items-center justify-between space-y-0 pb-4 border-b`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(rt,{className:`h-5 w-5 text-primary`}),(0,f.jsx)(Xu,{children:n??m(`scheduler`)})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>{D(!1),k(null)},children:(0,f.jsx)(yt,{className:`h-4 w-4`})}),(0,f.jsx)(Qu,{isEdit:!0,loading:l,disabled:v||!S||w,onClick:ee})]})]}),(0,f.jsx)(`div`,{className:`mt-6`,children:E&&O&&(0,f.jsx)(Nu,{schedulerType:t,value:O,onChange:e=>{k(e),C(!0)},disabled:v,readOnlyFields:i})})]})})]})};exports.Scheduler=Nu,exports.SchedulerDrawerButton=$u,exports.SchedulersList=Qh,exports.actionField=Zh,exports.indexColumn=Xh,exports.indexable=Yh,Object.keys(c).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return c[e]}})});
41
+ `},Rf=0,zf=[];function Bf(e){var t=l.useRef([]),n=l.useRef([0,0]),r=l.useRef(),i=l.useState(Rf++)[0],a=l.useState(cf)[0],o=l.useRef(e);l.useEffect(function(){o.current=e},[e]),l.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Id([e.lockRef.current],(e.shards||[]).map(Ff),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=l.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Nf(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Ef(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ef(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Mf(h,t,e,h===`h`?s:c,!0)},[]),c=l.useCallback(function(e){var n=e;if(!(!zf.length||zf[zf.length-1]!==a)){var r=`deltaY`in n?Pf(n):Nf(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&If(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ff).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=l.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Vf(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=l.useCallback(function(e){n.current=Nf(e),r.current=void 0},[]),f=l.useCallback(function(t){u(t.type,Pf(t),t.target,s(t,e.lockRef.current))},[]),p=l.useCallback(function(t){u(t.type,Nf(t),t.target,s(t,e.lockRef.current))},[]);l.useEffect(function(){return zf.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,xf),document.addEventListener(`touchmove`,c,xf),document.addEventListener(`touchstart`,d,xf),function(){zf=zf.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,xf),document.removeEventListener(`touchmove`,c,xf),document.removeEventListener(`touchstart`,d,xf)}},[]);var m=e.removeScrollBar,h=e.inert;return l.createElement(l.Fragment,null,h?l.createElement(a,{styles:Lf(i)}):null,m?l.createElement(vf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Vf(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Hf=Xd(Zd,Bf),Uf=l.forwardRef(function(e,t){return l.createElement($d,Pd({},e,{ref:t,sideCar:Hf}))});Uf.classNames=$d.classNames;var Wf=[`Enter`,` `],Gf=[`ArrowDown`,`PageUp`,`Home`],Kf=[`ArrowUp`,`PageDown`,`End`],qf=[...Gf,...Kf],Jf={ltr:[...Wf,`ArrowRight`],rtl:[...Wf,`ArrowLeft`]},Yf={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xf=`Menu`,[Zf,Qf,$f]=ba(Xf),[ep,tp]=fa(Xf,[$f,ml,Ka]),np=ml(),rp=Ka(),[ip,ap]=ep(Xf),[op,sp]=ep(Xf),cp=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=np(t),[c,l]=u.useState(null),d=u.useRef(!1),p=Ma(a),m=Ra(i);return u.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,f.jsx)(Al,{...s,children:(0,f.jsx)(ip,{scope:t,open:n,onOpenChange:p,content:c,onContentChange:l,children:(0,f.jsx)(op,{scope:t,onClose:u.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:d,dir:m,modal:o,children:r})})})};cp.displayName=Xf;var lp=`MenuAnchor`,up=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=np(n);return(0,f.jsx)(jl,{...i,...r,ref:t})});up.displayName=lp;var dp=`MenuPortal`,[fp,pp]=ep(dp,{forceMount:void 0}),mp=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ap(dp,t);return(0,f.jsx)(fp,{scope:t,forceMount:n,children:(0,f.jsx)(so,{present:n||a.open,children:(0,f.jsx)(Fl,{asChild:!0,container:i,children:r})})})};mp.displayName=dp;var hp=`MenuContent`,[gp,_p]=ep(hp),vp=u.forwardRef((e,t)=>{let n=pp(hp,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ap(hp,e.__scopeMenu),o=sp(hp,e.__scopeMenu);return(0,f.jsx)(Zf.Provider,{scope:e.__scopeMenu,children:(0,f.jsx)(so,{present:r||a.open,children:(0,f.jsx)(Zf.Slot,{scope:e.__scopeMenu,children:o.modal?(0,f.jsx)(yp,{...i,ref:t}):(0,f.jsx)(bp,{...i,ref:t})})})})}),yp=u.forwardRef((e,t)=>{let n=ap(hp,e.__scopeMenu),r=u.useRef(null),i=B(t,r);return u.useEffect(()=>{let e=r.current;if(e)return Nd(e)},[]),(0,f.jsx)(Sp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bp=u.forwardRef((e,t)=>{let n=ap(hp,e.__scopeMenu);return(0,f.jsx)(Sp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xp=yd(`MenuContent.ScrollLock`),Sp=u.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=ap(hp,n),y=sp(hp,n),b=np(n),x=rp(n),S=Qf(n),[C,w]=u.useState(null),T=u.useRef(null),E=B(t,T,v.onContentChange),D=u.useRef(0),O=u.useRef(``),k=u.useRef(0),A=u.useRef(null),j=u.useRef(`right`),M=u.useRef(0),ee=g?Uf:u.Fragment,N=g?{as:xp,allowPinchZoom:!0}:void 0,P=e=>{let t=O.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=om(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};u.useEffect(()=>()=>window.clearTimeout(D.current),[]),td();let F=u.useCallback(e=>j.current===A.current?.side&&cm(e,A.current?.area),[]);return(0,f.jsx)(gp,{scope:n,searchRef:O,onItemEnter:u.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:u.useCallback(e=>{F(e)||(T.current?.focus(),w(null))},[F]),onTriggerLeave:u.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:k,onPointerGraceIntentChange:u.useCallback(e=>{A.current=e},[]),children:(0,f.jsx)(ee,{...N,children:(0,f.jsx)(sd,{asChild:!0,trapped:i,onMountAutoFocus:Z(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,f.jsx)(Uo,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,f.jsx)(io,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:Z(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,f.jsx)(Ml,{role:`menu`,"aria-orientation":`vertical`,"data-state":tm(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:Z(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=T.current;if(e.target!==i||!qf.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);Kf.includes(e.key)&&a.reverse(),im(a)}),onBlur:Z(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:Z(e.onPointerMove,lm(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(j.current=e.clientX>M.current?`right`:`left`,M.current=e.clientX)}))})})})})})})});vp.displayName=hp;var Cp=`MenuGroup`,wp=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,f.jsx)(Q.div,{role:`group`,...r,ref:t})});wp.displayName=Cp;var Tp=`MenuLabel`,Ep=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,f.jsx)(Q.div,{...r,ref:t})});Ep.displayName=Tp;var Dp=`MenuItem`,Op=`menu.itemSelect`,kp=u.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=u.useRef(null),o=sp(Dp,e.__scopeMenu),s=_p(Dp,e.__scopeMenu),c=B(t,a),l=u.useRef(!1),d=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Op,{bubbles:!0,cancelable:!0});e.addEventListener(Op,e=>r?.(e),{once:!0}),ja(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,f.jsx)(Ap,{...i,ref:c,disabled:n,onClick:Z(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Z(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Z(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Wf.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kp.displayName=Dp;var Ap=u.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=_p(Dp,n),s=rp(n),c=u.useRef(null),l=B(t,c),[d,p]=u.useState(!1),[m,h]=u.useState(``);return u.useEffect(()=>{let e=c.current;e&&h((e.textContent??``).trim())},[a.children]),(0,f.jsx)(Zf.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:(0,f.jsx)(ao,{asChild:!0,...s,focusable:!r,children:(0,f.jsx)(Q.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Z(e.onPointerMove,lm(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Z(e.onPointerLeave,lm(e=>o.onItemLeave(e))),onFocus:Z(e.onFocus,()=>p(!0)),onBlur:Z(e.onBlur,()=>p(!1))})})})}),jp=`MenuCheckboxItem`,Mp=u.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,f.jsx)(Bp,{scope:e.__scopeMenu,checked:n,children:(0,f.jsx)(kp,{role:`menuitemcheckbox`,"aria-checked":nm(n)?`mixed`:n,...i,ref:t,"data-state":rm(n),onSelect:Z(i.onSelect,()=>r?.(nm(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mp.displayName=jp;var Np=`MenuRadioGroup`,[Pp,Fp]=ep(Np,{value:void 0,onValueChange:()=>{}}),Ip=u.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Ma(r);return(0,f.jsx)(Pp,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,f.jsx)(wp,{...i,ref:t})})});Ip.displayName=Np;var Lp=`MenuRadioItem`,Rp=u.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fp(Lp,e.__scopeMenu),a=n===i.value;return(0,f.jsx)(Bp,{scope:e.__scopeMenu,checked:a,children:(0,f.jsx)(kp,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":rm(a),onSelect:Z(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rp.displayName=Lp;var zp=`MenuItemIndicator`,[Bp,Vp]=ep(zp,{checked:!1}),Hp=u.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vp(zp,n);return(0,f.jsx)(so,{present:r||nm(a.checked)||a.checked===!0,children:(0,f.jsx)(Q.span,{...i,ref:t,"data-state":rm(a.checked)})})});Hp.displayName=zp;var Up=`MenuSeparator`,Wp=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,f.jsx)(Q.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wp.displayName=Up;var Gp=`MenuArrow`,Kp=u.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=np(n);return(0,f.jsx)(Nl,{...i,...r,ref:t})});Kp.displayName=Gp;var qp=`MenuSub`,[Jp,Yp]=ep(qp),Xp=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ap(qp,t),o=np(t),[s,c]=u.useState(null),[l,d]=u.useState(null),p=Ma(i);return u.useEffect(()=>(a.open===!1&&p(!1),()=>p(!1)),[a.open,p]),(0,f.jsx)(Al,{...o,children:(0,f.jsx)(ip,{scope:t,open:r,onOpenChange:p,content:l,onContentChange:d,children:(0,f.jsx)(Jp,{scope:t,contentId:wa(),triggerId:wa(),trigger:s,onTriggerChange:c,children:n})})})};Xp.displayName=qp;var Zp=`MenuSubTrigger`,Qp=u.forwardRef((e,t)=>{let n=ap(Zp,e.__scopeMenu),r=sp(Zp,e.__scopeMenu),i=Yp(Zp,e.__scopeMenu),a=_p(Zp,e.__scopeMenu),o=u.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},d=u.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return u.useEffect(()=>d,[d]),u.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,f.jsx)(up,{asChild:!0,...l,children:(0,f.jsx)(Ap,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tm(n.open),...e,ref:Me(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Z(e.onPointerMove,lm(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Z(e.onPointerLeave,lm(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Z(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Jf[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qp.displayName=Zp;var $p=`MenuSubContent`,em=u.forwardRef((e,t)=>{let n=pp(hp,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ap(hp,e.__scopeMenu),o=sp(hp,e.__scopeMenu),s=Yp($p,e.__scopeMenu),c=u.useRef(null),l=B(t,c);return(0,f.jsx)(Zf.Provider,{scope:e.__scopeMenu,children:(0,f.jsx)(so,{present:r||a.open,children:(0,f.jsx)(Zf.Slot,{scope:e.__scopeMenu,children:(0,f.jsx)(Sp,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:Z(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Z(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:Z(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Yf[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});em.displayName=$p;function tm(e){return e?`open`:`closed`}function nm(e){return e===`indeterminate`}function rm(e){return nm(e)?`indeterminate`:e?`checked`:`unchecked`}function im(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function am(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function om(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=am(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sm(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cm(e,t){return t?sm({x:e.clientX,y:e.clientY},t):!1}function lm(e){return t=>t.pointerType===`mouse`?e(t):void 0}var um=cp,dm=up,fm=mp,pm=vp,mm=wp,hm=Ep,gm=kp,_m=Mp,vm=Ip,ym=Rp,bm=Hp,xm=Wp,Sm=Kp,Cm=Qp,wm=em,Tm=`DropdownMenu`,[Em,Dm]=fa(Tm,[tp]),$=tp(),[Om,km]=Em(Tm),Am=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=u.useRef(null),[d,p]=Pa({prop:i,defaultProp:a??!1,onChange:o,caller:Tm});return(0,f.jsx)(Om,{scope:t,triggerId:wa(),triggerRef:l,contentId:wa(),open:d,onOpenChange:p,onOpenToggle:u.useCallback(()=>p(e=>!e),[p]),modal:s,children:(0,f.jsx)(um,{...c,open:d,onOpenChange:p,dir:r,modal:s,children:n})})};Am.displayName=Tm;var jm=`DropdownMenuTrigger`,Mm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=km(jm,n),o=$(n);return(0,f.jsx)(dm,{asChild:!0,...o,children:(0,f.jsx)(Q.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Me(t,a.triggerRef),onPointerDown:Z(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Z(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Mm.displayName=jm;var Nm=`DropdownMenuPortal`,Pm=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,f.jsx)(fm,{...r,...n})};Pm.displayName=Nm;var Fm=`DropdownMenuContent`,Im=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=km(Fm,n),a=$(n),o=u.useRef(!1);return(0,f.jsx)(pm,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Z(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Z(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Im.displayName=Fm;var Lm=`DropdownMenuGroup`,Rm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(mm,{...i,...r,ref:t})});Rm.displayName=Lm;var zm=`DropdownMenuLabel`,Bm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(hm,{...i,...r,ref:t})});Bm.displayName=zm;var Vm=`DropdownMenuItem`,Hm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(gm,{...i,...r,ref:t})});Hm.displayName=Vm;var Um=`DropdownMenuCheckboxItem`,Wm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(_m,{...i,...r,ref:t})});Wm.displayName=Um;var Gm=`DropdownMenuRadioGroup`,Km=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(vm,{...i,...r,ref:t})});Km.displayName=Gm;var qm=`DropdownMenuRadioItem`,Jm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(ym,{...i,...r,ref:t})});Jm.displayName=qm;var Ym=`DropdownMenuItemIndicator`,Xm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(bm,{...i,...r,ref:t})});Xm.displayName=Ym;var Zm=`DropdownMenuSeparator`,Qm=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(xm,{...i,...r,ref:t})});Qm.displayName=Zm;var $m=`DropdownMenuArrow`,eh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(Sm,{...i,...r,ref:t})});eh.displayName=$m;var th=`DropdownMenuSubTrigger`,nh=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(Cm,{...i,...r,ref:t})});nh.displayName=th;var rh=`DropdownMenuSubContent`,ih=u.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,f.jsx)(wm,{...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)`}})});ih.displayName=rh;var ah=Am,oh=Mm,sh=Pm,ch=Im,lh=Bm,uh=Hm,dh=Wm,fh=Jm,ph=Xm,mh=Qm,hh=nh,gh=ih,_h=ah,vh=oh,yh=u.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,f.jsxs)(hh,{ref:i,className:z(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,f.jsx)(ct,{className:`ml-auto h-4 w-4`})]}));yh.displayName=hh.displayName;var bh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(gh,{ref:n,className:z(`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`,e),...t}));bh.displayName=gh.displayName;var xh=u.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,f.jsx)(sh,{children:(0,f.jsx)(ch,{ref:r,sideOffset:t,className:z(`z-50 min-w-[8rem] overflow-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`,e),...n})}));xh.displayName=ch.displayName;var Sh=u.forwardRef(({className:e,inset:t,...n},r)=>(0,f.jsx)(uh,{ref:r,className:z(`relative flex cursor-default select-none items-center 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`,t&&`pl-8`,e),...n}));Sh.displayName=uh.displayName;var Ch=u.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,f.jsxs)(dh,{ref:i,className:z(`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:[(0,f.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,f.jsx)(ph,{children:(0,f.jsx)(at,{className:`h-4 w-4`})})}),t]}));Ch.displayName=dh.displayName;var wh=u.forwardRef(({className:e,children:t,...n},r)=>(0,f.jsxs)(fh,{ref:r,className:z(`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:[(0,f.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,f.jsx)(ph,{children:(0,f.jsx)(ut,{className:`h-2 w-2 fill-current`})})}),t]}));wh.displayName=fh.displayName;var Th=u.forwardRef(({className:e,inset:t,...n},r)=>(0,f.jsx)(lh,{ref:r,className:z(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));Th.displayName=lh.displayName;var Eh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(mh,{ref:n,className:z(`-mx-1 my-1 h-px bg-muted`,e),...t}));Eh.displayName=mh.displayName;var Dh=({className:e,...t})=>(0,f.jsx)(`span`,{className:z(`ml-auto text-xs tracking-widest opacity-60`,e),...t});Dh.displayName=`DropdownMenuShortcut`;var Oh=e=>{let{t}=(0,c.useSchedulerContext)(),{selectedColumns:n=[],columnsList:r=[],onChange:i}=e;if(!r?.length)return(0,f.jsx)(f.Fragment,{});let a=t(`table.hideColumns`),o=(e,t)=>{if(t)i([...n,e]);else{if(n.length<=1)return;i(n.filter(t=>t!==e))}};return(0,f.jsxs)(_h,{children:[(0,f.jsx)(vh,{asChild:!0,children:(0,f.jsxs)(X,{variant:`outline`,size:`sm`,children:[(0,f.jsx)(gt,{className:`mr-2 h-4 w-4`}),a]})}),(0,f.jsxs)(xh,{align:`end`,className:`w-[200px]`,children:[(0,f.jsx)(Th,{children:a}),(0,f.jsx)(Eh,{}),r.map(e=>(0,f.jsx)(Ch,{className:`capitalize`,checked:n.includes(e.value),onCheckedChange:t=>o(e.value,!!t),disabled:e.disabled,children:e.label},e.value))]})]})},kh=e=>{let{loading:t,t:n}=(0,c.useSchedulerContext)(),{children:r,items:i=[],onRefresh:a}=e;return(0,f.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[r,(0,f.jsxs)(_h,{children:[(0,f.jsx)(vh,{asChild:!0,children:(0,f.jsx)(X,{variant:`outline`,size:`sm`,className:`h-8 w-8 p-0`,children:t?(0,f.jsx)(ft,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(dt,{className:`h-4 w-4`})})}),(0,f.jsxs)(xh,{align:`end`,children:[i.map((e,t)=>(0,f.jsxs)(Sh,{onClick:e.onClick,className:`gap-2`,children:[e.icon,e.label]},t)),i.length>0&&a&&(0,f.jsx)(Eh,{}),a&&(0,f.jsxs)(Sh,{onClick:a,className:`gap-2`,children:[(0,f.jsx)(mt,{className:`h-4 w-4`}),n(`toolbar.refresh`)]})]})]})]})},Ah=Xe(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function jh({className:e,variant:t,...n}){return(0,f.jsx)(`div`,{className:z(Ah({variant:t}),e),...n})}var Mh={ACTIVE:`default`,DEACTIVATED:`secondary`,DELETED:`destructive`,PROCESSING:`outline`,PENDING:`outline`,APPROVED:`default`,PUBLISHED:`default`},Nh=({status:e})=>(0,f.jsx)(jh,{variant:Mh[e]||`outline`,children:e}),Ph=g.Root,Fh=g.Trigger,Ih=g.Portal,Lh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(g.Overlay,{ref:n,className:z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Lh.displayName=g.Overlay.displayName;var Rh=u.forwardRef(({className:e,children:t,...n},r)=>(0,f.jsxs)(Ih,{children:[(0,f.jsx)(Lh,{}),(0,f.jsxs)(g.Content,{ref:r,"aria-describedby":void 0,className:z(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[50%] translate-y-[50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...n,children:[t,(0,f.jsxs)(g.Close,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,f.jsx)(yt,{className:`h-4 w-4`}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Rh.displayName=g.Content.displayName;var zh=({className:e,...t})=>(0,f.jsx)(`div`,{className:z(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});zh.displayName=`DialogHeader`;var Bh=({className:e,...t})=>(0,f.jsx)(`div`,{className:z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Bh.displayName=`DialogFooter`;var Vh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(g.Title,{ref:n,className:z(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Vh.displayName=g.Title.displayName;var Hh=u.forwardRef(({className:e,...t},n)=>(0,f.jsx)(g.Description,{ref:n,className:z(`text-sm text-muted-foreground`,e),...t}));Hh.displayName=g.Description.displayName;var Uh=e=>{let{t,permissions:n}=(0,c.useSchedulerContext)(),{entity:r,disabled:i,onDelete:a,showLabel:o=!1}=e,[s,l]=(0,u.useState)(!1);return!r||!n.canDelete?null:(0,f.jsxs)(Ph,{open:s,onOpenChange:l,children:[(0,f.jsx)(Eu,{children:(0,f.jsxs)(Du,{children:[(0,f.jsx)(Ou,{asChild:!0,children:(0,f.jsx)(Fh,{asChild:!0,children:(0,f.jsxs)(X,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10`,disabled:i,onClick:e=>e.stopPropagation(),children:[(0,f.jsx)(vt,{className:`h-4 w-4`}),o&&(0,f.jsx)(`span`,{className:`ml-2`,children:t(`actions.delete`)})]})})}),(0,f.jsx)(ku,{children:(0,f.jsx)(`p`,{children:t(`actions.delete`)})})]})}),(0,f.jsxs)(Rh,{onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(zh,{children:[(0,f.jsx)(Vh,{children:t(`actions.delete`)}),(0,f.jsx)(Hh,{children:t(`actions.confirm.delete`)})]}),(0,f.jsxs)(Bh,{children:[(0,f.jsx)(X,{variant:`outline`,onClick:()=>l(!1),children:t(`actions.cancel`)}),(0,f.jsx)(X,{variant:`destructive`,onClick:e=>{e.stopPropagation(),a?.(r),l(!1)},children:t(`actions.delete`)})]})]})]})},Wh=e=>{let{t,permissions:n}=(0,c.useSchedulerContext)(),{entity:r,disabled:i,onEdit:a,showLabel:o=!1}=e;return!r||!n.canUpdate?null:(0,f.jsx)(Eu,{children:(0,f.jsxs)(Du,{children:[(0,f.jsx)(Ou,{asChild:!0,children:(0,f.jsxs)(X,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,disabled:i,onClick:e=>{e.stopPropagation(),a?.(r)},children:[(0,f.jsx)(pt,{className:`h-4 w-4`}),o&&(0,f.jsx)(`span`,{className:`ml-2`,children:t(`actions.edit`)})]})}),(0,f.jsx)(ku,{children:(0,f.jsx)(`p`,{children:t(`actions.edit`)})})]})})},Gh=e=>(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e?.days.map((e,t)=>(0,f.jsx)(jh,{variant:`outline`,className:`font-normal`,children:e},t))}),Kh=(e,t)=>e?.type===`PERIOD`?(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t?.days.map((t,n)=>(0,f.jsx)(jh,{variant:`outline`,className:`font-normal bg-blue-50 text-blue-700 border-blue-200`,children:`${e.weekDay} ${t}`},n))}):(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(0,f.jsx)(jh,{variant:`outline`,className:`font-normal bg-orange-50 text-orange-700 border-orange-200`,children:e?.monthDay})}),qh=(e,t,n)=>(0,f.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[Kh(t,n),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e?.months?.map((e,t)=>(0,f.jsx)(jh,{variant:`outline`,className:`font-normal bg-purple-50 text-purple-700 border-purple-200`,children:e},t))})]}),Jh=e=>{let{disabled:t,schedulerType:n,currency:r,t:i,onEdit:a,onDelete:o}=e,s=(e,t,n={})=>({id:e,key:e,title:t,label:t,...n});return[s(`index`,`#`,{className:`w-[50px]`}),s(`duration`,i(`scheduler.meta.duration`),{className:`w-[120px]`,format:e=>`${e?.period} (${e?.type})`}),s(`repeat`,i(`scheduler.duration`),{className:`min-w-[200px]`,format:(e,t)=>{let{duration:n,repeat:r}=t,{weekly:i,monthly:a,yearly:o}=r;switch(n?.type){case`WEEK`:return Gh(i);case`MONTH`:return Kh(a,i);case`YEAR`:return qh(o,a,i);default:return null}}}),[c.ESchedulerPrefix.DISCOUNT,c.ESchedulerPrefix.TRIAL_DISCOUNT].includes(n)?s(`discount`,i(`scheduler.meta.discount`),{className:`w-[120px]`,format:e=>e?e.type===`PERCENT`?`${e.value}${c.CDiscountTypeValues[e.type]}`:(0,c.numberToCurrency)(e.value,r??`USD`):`—`}):null,s(`status`,i(`scheduler.status`),{className:`w-[120px] text-center`,concealable:!0,format:e=>(0,f.jsx)(Nh,{status:e})}),s(`updatedAt`,i(`scheduler.updatedAt`),{className:`w-[180px] text-center`,concealable:!0,format:e=>(0,f.jsx)(`span`,{children:e?.updatedAt?(0,c.tsToLocaleDateTime)(e.updatedAt):`—`})}),a||o?s(`actions`,i(`table.actions`),{className:`w-[100px] text-center`,format:(e,n)=>(0,f.jsxs)(`div`,{className:`flex justify-center gap-1`,children:[a&&(0,f.jsx)(Wh,{onEdit:a,disabled:t,entity:n}),o&&(0,f.jsx)(Uh,{onDelete:o,entity:n,disabled:t})]})}):null].filter(Boolean)},Yh=e=>e.map((e,t)=>({...e,key:e.id||t.toString(),index:t+1})),Xh=()=>({title:`#`,dataIndex:`index`,key:`index`,width:`50px`}),Zh=e=>({title:e(`table.actions`),key:`actions`,width:`100px`}),Qh=e=>{let{type:t,title:n,disabled:r,readOnlyFields:i=[],currency:a,onRefresh:o}=e,{schedulers:s,loading:l,limit:d=c.DEFAULT_SCHEDULERS_LIMIT,disabled:p,t:m,permissions:h,onUpdate:g,onDelete:_}=(0,c.useSchedulerContext)(),v=r??p,y=s[t]??[],[b,x]=(0,u.useState)(new Set),[S,C]=(0,u.useState)(!1),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(!1),[O,k]=(0,u.useState)(null),A=(0,u.useMemo)(()=>{let e=y;return b.size>0&&(e=e.filter(e=>!e.id||!b.has(e.id))),Yh(e)},[y,b]),j=A.length>=d,M=(0,u.useCallback)(e=>{k(JSON.parse(JSON.stringify(e))),D(!0),C(!1)},[]),ee=(0,u.useCallback)(async()=>{if(!(!O||!g))try{await g(t,O),D(!1),k(null),C(!1),o?.()}catch(e){console.error(`Failed to update scheduler:`,e)}},[O,g,t,o]),N=(0,u.useCallback)(async e=>{if(e.id?.startsWith(`new-`)){x(t=>{let n=new Set(t);return e.id&&n.add(e.id),n});return}_&&e.id&&(await _(t,e.id),o?.())},[_,t,o]),{filteredColumns:P,columnsList:F,selectedColumns:I,setSelectedColumns:te}=(0,c.useColumnsToggle)((0,u.useMemo)(()=>Jh({disabled:v,schedulerType:t,entities:A,currency:a,t:m,onEdit:h.canUpdate?M:void 0,onDelete:h.canDelete?N:void 0}),[v,t,A,a,m,h.canUpdate,h.canDelete,M,N]));return(0,f.jsxs)(`div`,{className:`w-full space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[n&&(0,f.jsx)(`h2`,{className:`text-lg font-semibold`,children:n}),(0,f.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[h.canCreate&&!j&&(0,f.jsx)($u,{setDirty:C,dirty:S,isCreating:w,setIsCreating:T,schedulerType:t,disabled:v||l||j||w,onSuccess:()=>o?.(),buttonProps:{variant:`outline`,size:`sm`}}),(0,f.jsx)(kh,{onRefresh:o,children:(0,f.jsx)(Oh,{columnsList:F,selectedColumns:I,onChange:te})})]})]}),(0,f.jsx)(`div`,{className:`rounded-md border`,children:(0,f.jsxs)(Pu,{children:[(0,f.jsx)(Fu,{children:(0,f.jsx)(Ru,{children:P.filter(e=>!e.hidden).map(e=>(0,f.jsx)(zu,{className:e.className,children:e.label},e.id))})}),(0,f.jsxs)(Iu,{children:[A.map(e=>(0,f.jsx)(Ru,{children:P.filter(e=>!e.hidden).map(t=>{let n=t.id.includes(`.`)?t.id.split(`.`).reduce((e,t)=>e?.[t],e):e[t.id];return(0,f.jsx)(Bu,{className:t.className,children:t.format?t.format(n,e):n},t.id)})},e.key)),A.length===0&&(0,f.jsx)(Ru,{children:(0,f.jsx)(Bu,{colSpan:P.length,className:`h-24 text-center`,children:m(`table.noData`)||`No items found`})})]})]})}),(0,f.jsx)(Hu,{open:E,onOpenChange:e=>!e&&D(!1),children:(0,f.jsxs)(qu,{className:`w-full sm:max-w-[600px] overflow-y-auto`,children:[(0,f.jsxs)(Ju,{className:`flex flex-row items-center justify-between space-y-0 pb-4 border-b`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(rt,{className:`h-5 w-5 text-primary`}),(0,f.jsx)(Xu,{children:n??m(`scheduler`)})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>{D(!1),k(null)},children:(0,f.jsx)(yt,{className:`h-4 w-4`})}),(0,f.jsx)(Qu,{isEdit:!0,loading:l,disabled:v||!S||w,onClick:ee})]})]}),(0,f.jsx)(`div`,{className:`mt-6`,children:E&&O&&(0,f.jsx)(Nu,{schedulerType:t,value:O,onChange:e=>{k(e),C(!0)},disabled:v,readOnlyFields:i})})]})})]})};exports.Scheduler=Nu,exports.SchedulerDrawerButton=$u,exports.SchedulersList=Qh,exports.actionField=Zh,exports.indexColumn=Xh,exports.indexable=Yh,Object.keys(c).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return c[e]}})});