regular-calendar 0.0.7 → 0.0.9
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 +18 -18
- package/dist/index.css +1 -1
- package/dist/index.d.ts +149 -1
- package/dist/index.js +5162 -4533
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),p=require("react"),gr=require("react-dom"),Da=require("react-i18next");function Xi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const C=Xi(p),Ki=Xi(gr);function Ji(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Ji(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Qi(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Ji(e))&&(n&&(n+=" "),n+=t);return n}function de(...e){return Qi(e)}const ye={Spinner:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:de("animate-spin",e),...n,role:"presentation",children:o.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})},Check:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})})},X:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})},ChevronLeft:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("path",{d:"M15 18l-6-6 6-6"})})},ChevronRight:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("path",{d:"M9 18l6-6-6-6"})})},ChevronDown:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("path",{d:"M6 9l6 6 6-6"})})},Calendar:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),o.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),o.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),o.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})},Plus:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})},Edit:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),o.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})},Trash:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("polyline",{points:"3 6 5 6 21 6"}),o.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})},AlertTriangle:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),o.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}},bt=C.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:de("flex w-full rounded-md border border-input bg-background px-ui py-ui text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));bt.displayName="Input";function Na({value:e=[],onChange:t,personnel:r,placeholder:n,className:s,disabled:a=!1}){const[i,c]=p.useState(!1),[l,u]=p.useState(""),[f,d]=p.useState(-1),h=p.useRef(null),m=p.useMemo(()=>{if(!l||!r)return[];const v=l.toLowerCase();return v.length<1?[]:r.filter(_=>e.some(w=>w.personnelId===_.id)?!1:_.name.toLowerCase().includes(v)||_.department?.toLowerCase().includes(v)).slice(0,5)},[l,r,e]);p.useEffect(()=>{d(-1),c(m.length>0)},[m]);const b=v=>{t([...e,v]),u(""),c(!1),h.current?.focus()},g=v=>{const _=[...e];_.splice(v,1),t(_)},y=v=>{if(!v.nativeEvent.isComposing){if(i&&m.length>0){if(v.key==="ArrowDown"){v.preventDefault(),d(_=>_===-1?0:(_+1)%m.length);return}else if(v.key==="ArrowUp"){v.preventDefault(),d(_=>_===-1?m.length-1:(_-1+m.length)%m.length);return}}if(v.key==="Enter")if(v.preventDefault(),f>=0&&m[f]){const _=m[f];b({name:_.name,email:_.email||"",personnelId:_.id,type:"personnel"})}else l.trim().length>0&&b({name:l.trim(),type:"external"});else v.key==="Backspace"&&l===""&&e.length>0?g(e.length-1):v.key==="Escape"&&c(!1)}},x=()=>{setTimeout(()=>{c(!1)},200)};return o.jsxs("div",{className:de("flex flex-wrap items-center gap-ui px-ui py-[calc(var(--ui-component-padding-y)/2)] border rounded-md bg-background focus-within:ring-2 ring-ring ring-offset-2 border-input min-h-ui",s),children:[e.map((v,_)=>o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-1)] bg-secondary text-secondary-foreground px-[var(--ui-space-2)] py-[var(--ui-space-1)] rounded text-sm group",children:[o.jsx("span",{children:v.name}),!a&&o.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),g(_)},className:"text-muted-foreground group-hover:text-destructive transition-colors",children:o.jsx(ye.X,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})]},v.personnelId??v.email??`${v.type}-${v.name}`)),o.jsxs("div",{className:"relative flex-1 min-w-[var(--ui-space-30)]",children:[o.jsx(bt,{ref:h,value:l,onChange:v=>u(v.target.value),onKeyDown:y,onFocus:()=>{m.length>0&&c(!0)},onBlur:x,placeholder:e.length===0?n:"",disabled:a,className:de("border-0 focus-visible:ring-0 px-[var(--ui-space-0)] h-auto py-[var(--ui-space-1)] shadow-none bg-transparent",a&&"cursor-not-allowed text-muted-foreground"),autoComplete:"off"}),i&&m.length>0&&o.jsx("div",{className:"absolute top-full left-[var(--ui-space-0)] z-50 w-full min-w-[var(--ui-space-50)] mt-[var(--ui-space-1)] bg-popover text-popover-foreground border border-border rounded-md shadow-md overflow-hidden animate-in fade-in-0 zoom-in-95",children:m.map((v,_)=>o.jsxs("button",{type:"button",className:de("px-ui py-ui text-sm cursor-pointer flex justify-between items-center",_===f?"bg-accent text-accent-foreground":"hover:bg-accent hover:text-accent-foreground"),onClick:w=>{w.preventDefault(),w.stopPropagation(),b({name:v.name,email:v.email||"",personnelId:v.id,type:"personnel"})},onMouseEnter:()=>d(_),children:[o.jsx("span",{className:"font-medium",children:v.name}),v.department&&o.jsx("span",{className:"text-xs text-muted-foreground ml-[var(--ui-space-2)]",children:v.department})]},v.id))})]})]})}var bn=e=>e.type==="checkbox",vr=e=>e instanceof Date,Ge=e=>e==null;const ec=e=>typeof e=="object";var Ee=e=>!Ge(e)&&!Array.isArray(e)&&ec(e)&&!vr(e),tc=e=>Ee(e)&&e.target?bn(e.target)?e.target.checked:e.target.value:e,rd=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,rc=(e,t)=>e.has(rd(t)),nd=e=>{const t=e.constructor&&e.constructor.prototype;return Ee(t)&&t.hasOwnProperty("isPrototypeOf")},Ea=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Te(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Ea&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Ee(e)&&nd(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Te(e[s]));return n}var vs=e=>/^\w*$/.test(e),Se=e=>e===void 0,Aa=e=>Array.isArray(e)?e.filter(Boolean):[],Ta=e=>Aa(e.replace(/["|']|\]/g,"").split(/\.|\[/)),q=(e,t,r)=>{if(!t||!Ee(e))return r;const n=(vs(t)?[t]:Ta(t)).reduce((s,a)=>Ge(s)?s:s[a],e);return Se(n)||n===e?Se(e[t])?r:e[t]:n},rt=e=>typeof e=="boolean",He=e=>typeof e=="function",ge=(e,t,r)=>{let n=-1;const s=vs(t)?[t]:Ta(t),a=s.length,i=a-1;for(;++n<a;){const c=s[n];let l=r;if(n!==i){const u=e[c];l=Ee(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;e[c]=l,e=e[c]}};const Zn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},yt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Bt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ra=p.createContext(null);Ra.displayName="HookFormContext";const ys=()=>p.useContext(Ra),sd=e=>{const{children:t,...r}=e;return p.createElement(Ra.Provider,{value:r},t)};var nc=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(s,a,{get:()=>{const i=a;return t._proxyFormState[i]!==yt.all&&(t._proxyFormState[i]=!n||yt.all),r&&(r[i]=!0),e[i]}});return s};const Pa=typeof window<"u"?p.useLayoutEffect:p.useEffect;function ad(e){const t=ys(),{control:r=t.control,disabled:n,name:s,exact:a}=e||{},[i,c]=p.useState(r._formState),l=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Pa(()=>r._subscribe({name:s,formState:l.current,exact:a,callback:u=>{!n&&c({...r._formState,...u})}}),[s,n,a]),p.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>nc(i,r,l.current,!1),[i,r])}var ot=e=>typeof e=="string",sa=(e,t,r,n,s)=>ot(e)?(n&&t.watch.add(e),q(r,e,s)):Array.isArray(e)?e.map(a=>(n&&t.watch.add(a),q(r,a))):(n&&(t.watchAll=!0),r),aa=e=>Ge(e)||!ec(e);function xt(e,t,r=new WeakSet){if(aa(e)||aa(t))return Object.is(e,t);if(vr(e)&&vr(t))return e.getTime()===t.getTime();const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const a of n){const i=e[a];if(!s.includes(a))return!1;if(a!=="ref"){const c=t[a];if(vr(i)&&vr(c)||Ee(i)&&Ee(c)||Array.isArray(i)&&Array.isArray(c)?!xt(i,c,r):!Object.is(i,c))return!1}}return!0}function od(e){const t=ys(),{control:r=t.control,name:n,defaultValue:s,disabled:a,exact:i,compute:c}=e||{},l=p.useRef(s),u=p.useRef(c),f=p.useRef(void 0),d=p.useRef(r),h=p.useRef(n);u.current=c;const[m,b]=p.useState(()=>{const w=r._getWatch(n,l.current);return u.current?u.current(w):w}),g=p.useCallback(w=>{const S=sa(n,r._names,w||r._formValues,!1,l.current);return u.current?u.current(S):S},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!a){const S=sa(n,r._names,w||r._formValues,!1,l.current);if(u.current){const k=u.current(S);xt(k,f.current)||(b(k),f.current=k)}else b(S)}},[r._formValues,r._names,a,n]);Pa(()=>((d.current!==r||!xt(h.current,n))&&(d.current=r,h.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:w=>{y(w.values)}})),[r,i,n,y]),p.useEffect(()=>r._removeUnmounted());const x=d.current!==r,v=h.current,_=p.useMemo(()=>{if(a)return null;const w=!x&&!xt(v,n);return x||w?g():null},[a,x,n,v,g]);return _!==null?_:m}function id(e){const t=ys(),{name:r,disabled:n,control:s=t.control,shouldUnregister:a,defaultValue:i,exact:c=!0}=e,l=rc(s._names.array,r),u=p.useMemo(()=>q(s._formValues,r,q(s._defaultValues,r,i)),[s,r,i]),f=od({control:s,name:r,defaultValue:u,exact:c}),d=ad({control:s,name:r,exact:c}),h=p.useRef(e),m=p.useRef(void 0),b=p.useRef(s.register(r,{...e.rules,value:f,...rt(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const g=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!q(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!q(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!q(d.validatingFields,r)},error:{enumerable:!0,get:()=>q(d.errors,r)}}),[d,r]),y=p.useCallback(w=>b.current.onChange({target:{value:tc(w),name:r},type:Zn.CHANGE}),[r]),x=p.useCallback(()=>b.current.onBlur({target:{value:q(s._formValues,r),name:r},type:Zn.BLUR}),[r,s._formValues]),v=p.useCallback(w=>{const S=q(s._fields,r);S&&S._f&&w&&(S._f.ref={focus:()=>He(w.focus)&&w.focus(),select:()=>He(w.select)&&w.select(),setCustomValidity:k=>He(w.setCustomValidity)&&w.setCustomValidity(k),reportValidity:()=>He(w.reportValidity)&&w.reportValidity()})},[s._fields,r]),_=p.useMemo(()=>({name:r,value:f,...rt(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:y,onBlur:x,ref:v}),[r,n,d.disabled,y,x,v,f]);return p.useEffect(()=>{const w=s._options.shouldUnregister||a,S=m.current;S&&S!==r&&!l&&s.unregister(S),s.register(r,{...h.current.rules,...rt(h.current.disabled)?{disabled:h.current.disabled}:{}});const k=(j,E)=>{const I=q(s._fields,j);I&&I._f&&(I._f.mount=E)};if(k(r,!0),w){const j=Te(q(s._options.defaultValues,r,h.current.defaultValue));ge(s._defaultValues,r,j),Se(q(s._formValues,r))&&ge(s._formValues,r,j)}return!l&&s.register(r),m.current=r,()=>{(l?w&&!s._state.action:w)?s.unregister(r):k(r,!1)}},[r,s,l,a]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:_,formState:d,fieldState:g}),[_,d,g])}const cd=e=>e.render(id(e));var sc=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},sn=e=>Array.isArray(e)?e:[e],No=()=>{let e=[];return{get observers(){return e},next:s=>{for(const a of e)a.next&&a.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(a=>a!==s)}}),unsubscribe:()=>{e=[]}}};function ac(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],a=t[n];if(s&&Ee(s)&&a){const i=ac(s,a);Ee(i)&&(r[n]=i)}else e[n]&&(r[n]=a)}return r}var ze=e=>Ee(e)&&!Object.keys(e).length,Ma=e=>e.type==="file",Yn=e=>{if(!Ea)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},oc=e=>e.type==="select-multiple",Oa=e=>e.type==="radio",ld=e=>Oa(e)||bn(e),Hs=e=>Yn(e)&&e.isConnected;function ud(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Se(e)?n++:e[t[n++]];return e}function dd(e){for(const t in e)if(e.hasOwnProperty(t)&&!Se(e[t]))return!1;return!0}function Ce(e,t){const r=Array.isArray(t)?t:vs(t)?[t]:Ta(t),n=r.length===1?e:ud(e,r),s=r.length-1,a=r[s];return n&&delete n[a],s!==0&&(Ee(n)&&ze(n)||Array.isArray(n)&&dd(n))&&Ce(e,r.slice(0,-1)),e}var fd=e=>{for(const t in e)if(He(e[t]))return!0;return!1};function ic(e){return Array.isArray(e)||Ee(e)&&!fd(e)}function oa(e,t={}){for(const r in e){const n=e[r];ic(n)?(t[r]=Array.isArray(n)?[]:{},oa(n,t[r])):Se(n)||(t[r]=!0)}return t}function Pr(e,t,r){r||(r=oa(t));for(const n in e){const s=e[n];if(ic(s))Se(t)||aa(r[n])?r[n]=oa(s,Array.isArray(s)?[]:{}):Pr(s,Ge(t)?{}:t[n],r[n]);else{const a=t[n];r[n]=!xt(s,a)}}return r}const Eo={value:!1,isValid:!1},Ao={value:!0,isValid:!0};var cc=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Se(e[0].attributes.value)?Se(e[0].value)||e[0].value===""?Ao:{value:e[0].value,isValid:!0}:Ao:Eo}return Eo},lc=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Se(e)?e:t?e===""?NaN:e&&+e:r&&ot(e)?new Date(e):n?n(e):e;const To={isValid:!1,value:null};var uc=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,To):To;function Ro(e){const t=e.ref;return Ma(t)?t.files:Oa(t)?uc(e.refs).value:oc(t)?[...t.selectedOptions].map(({value:r})=>r):bn(t)?cc(e.refs).value:lc(Se(t.value)?e.ref.value:t.value,e)}var hd=(e,t,r,n)=>{const s={};for(const a of e){const i=q(t,a);i&&ge(s,a,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Gn=e=>e instanceof RegExp,rn=e=>Se(e)?e:Gn(e)?e.source:Ee(e)?Gn(e.value)?e.value.source:e.value:e,Po=e=>({isOnSubmit:!e||e===yt.onSubmit,isOnBlur:e===yt.onBlur,isOnChange:e===yt.onChange,isOnAll:e===yt.all,isOnTouch:e===yt.onTouched});const Mo="AsyncFunction";var md=e=>!!e&&!!e.validate&&!!(He(e.validate)&&e.validate.constructor.name===Mo||Ee(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Mo)),pd=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Oo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const an=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const a=q(e,s);if(a){const{_f:i,...c}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(an(c,t))break}else if(Ee(c)&&an(c,t))break}}};function Io(e,t,r){const n=q(e,r);if(n||vs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const a=s.join("."),i=q(t,a),c=q(e,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(c&&c.type)return{name:a,error:c};if(c&&c.root&&c.root.type)return{name:`${a}.root`,error:c.root};s.pop()}return{name:r}}var gd=(e,t,r,n)=>{r(e);const{name:s,...a}=e;return ze(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!n||yt.all))},vd=(e,t,r)=>!e||!t||e===t||sn(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),yd=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,xd=(e,t)=>!Aa(q(e,t)).length&&Ce(e,t),bd=(e,t,r)=>{const n=sn(q(e,r));return ge(n,"root",t[r]),ge(e,r,n),e};function $o(e,t,r="validate"){if(ot(e)||Array.isArray(e)&&e.every(ot)||rt(e)&&!e)return{type:r,message:ot(e)?e:"",ref:t}}var Nr=e=>Ee(e)&&!Gn(e)?e:{value:e,message:""},Fo=async(e,t,r,n,s,a)=>{const{ref:i,refs:c,required:l,maxLength:u,minLength:f,min:d,max:h,pattern:m,validate:b,name:g,valueAsNumber:y,mount:x}=e._f,v=q(r,g);if(!x||t.has(g))return{};const _=c?c[0]:i,w=N=>{s&&_.reportValidity&&(_.setCustomValidity(rt(N)?"":N||""),_.reportValidity())},S={},k=Oa(i),j=bn(i),E=k||j,I=(y||Ma(i))&&Se(i.value)&&Se(v)||Yn(i)&&i.value===""||v===""||Array.isArray(v)&&!v.length,M=sc.bind(null,g,n,S),H=(N,F,A,V=Bt.maxLength,O=Bt.minLength)=>{const P=N?F:A;S[g]={type:N?V:O,message:P,ref:i,...M(N?V:O,P)}};if(a?!Array.isArray(v)||!v.length:l&&(!E&&(I||Ge(v))||rt(v)&&!v||j&&!cc(c).isValid||k&&!uc(c).isValid)){const{value:N,message:F}=ot(l)?{value:!!l,message:l}:Nr(l);if(N&&(S[g]={type:Bt.required,message:F,ref:_,...M(Bt.required,F)},!n))return w(F),S}if(!I&&(!Ge(d)||!Ge(h))){let N,F;const A=Nr(h),V=Nr(d);if(!Ge(v)&&!isNaN(v)){const O=i.valueAsNumber||v&&+v;Ge(A.value)||(N=O>A.value),Ge(V.value)||(F=O<V.value)}else{const O=i.valueAsDate||new Date(v),P=z=>new Date(new Date().toDateString()+" "+z),R=i.type=="time",B=i.type=="week";ot(A.value)&&v&&(N=R?P(v)>P(A.value):B?v>A.value:O>new Date(A.value)),ot(V.value)&&v&&(F=R?P(v)<P(V.value):B?v<V.value:O<new Date(V.value))}if((N||F)&&(H(!!N,A.message,V.message,Bt.max,Bt.min),!n))return w(S[g].message),S}if((u||f)&&!I&&(ot(v)||a&&Array.isArray(v))){const N=Nr(u),F=Nr(f),A=!Ge(N.value)&&v.length>+N.value,V=!Ge(F.value)&&v.length<+F.value;if((A||V)&&(H(A,N.message,F.message),!n))return w(S[g].message),S}if(m&&!I&&ot(v)){const{value:N,message:F}=Nr(m);if(Gn(N)&&!v.match(N)&&(S[g]={type:Bt.pattern,message:F,ref:i,...M(Bt.pattern,F)},!n))return w(F),S}if(b){if(He(b)){const N=await b(v,r),F=$o(N,_);if(F&&(S[g]={...F,...M(Bt.validate,F.message)},!n))return w(F.message),S}else if(Ee(b)){let N={};for(const F in b){if(!ze(N)&&!n)break;const A=$o(await b[F](v,r),_,F);A&&(N={...A,...M(F,A.message)},w(A.message),n&&(S[g]=N))}if(!ze(N)&&(S[g]={ref:_,...N},!n))return S}}return w(!0),S};const wd={mode:yt.onSubmit,reValidateMode:yt.onChange,shouldFocusError:!0};function _d(e={}){let t={...wd,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:He(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Ee(t.defaultValues)||Ee(t.values)?Te(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Te(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...f};let h={...d};const m={array:No(),state:No()},b=t.criteriaMode===yt.all,g=D=>T=>{clearTimeout(u),u=setTimeout(D,T)},y=async D=>{if(!i.keepIsValid&&!t.disabled&&(d.isValid||h.isValid||D)){let T;t.resolver?(T=ze((await E()).errors),x()):T=await M(n,!0),T!==r.isValid&&m.state.next({isValid:T})}},x=(D,T)=>{!t.disabled&&(d.isValidating||d.validatingFields||h.isValidating||h.validatingFields)&&((D||Array.from(c.mount)).forEach($=>{$&&(T?ge(r.validatingFields,$,T):Ce(r.validatingFields,$))}),m.state.next({validatingFields:r.validatingFields,isValidating:!ze(r.validatingFields)}))},v=(D,T=[],$,X,Y=!0,Z=!0)=>{if(X&&$&&!t.disabled){if(i.action=!0,Z&&Array.isArray(q(n,D))){const te=$(q(n,D),X.argA,X.argB);Y&&ge(n,D,te)}if(Z&&Array.isArray(q(r.errors,D))){const te=$(q(r.errors,D),X.argA,X.argB);Y&&ge(r.errors,D,te),xd(r.errors,D)}if((d.touchedFields||h.touchedFields)&&Z&&Array.isArray(q(r.touchedFields,D))){const te=$(q(r.touchedFields,D),X.argA,X.argB);Y&&ge(r.touchedFields,D,te)}(d.dirtyFields||h.dirtyFields)&&(r.dirtyFields=Pr(s,a)),m.state.next({name:D,isDirty:N(D,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ge(a,D,T)},_=(D,T)=>{ge(r.errors,D,T),m.state.next({errors:r.errors})},w=D=>{r.errors=D,m.state.next({errors:r.errors,isValid:!1})},S=(D,T,$,X)=>{const Y=q(n,D);if(Y){const Z=q(a,D,Se($)?q(s,D):$);Se(Z)||X&&X.defaultChecked||T?ge(a,D,T?Z:Ro(Y._f)):V(D,Z),i.mount&&!i.action&&y()}},k=(D,T,$,X,Y)=>{let Z=!1,te=!1;const le={name:D};if(!t.disabled){if(!$||X){(d.isDirty||h.isDirty)&&(te=r.isDirty,r.isDirty=le.isDirty=N(),Z=te!==le.isDirty);const he=xt(q(s,D),T);te=!!q(r.dirtyFields,D),he?Ce(r.dirtyFields,D):ge(r.dirtyFields,D,!0),le.dirtyFields=r.dirtyFields,Z=Z||(d.dirtyFields||h.dirtyFields)&&te!==!he}if($){const he=q(r.touchedFields,D);he||(ge(r.touchedFields,D,$),le.touchedFields=r.touchedFields,Z=Z||(d.touchedFields||h.touchedFields)&&he!==$)}Z&&Y&&m.state.next(le)}return Z?le:{}},j=(D,T,$,X)=>{const Y=q(r.errors,D),Z=(d.isValid||h.isValid)&&rt(T)&&r.isValid!==T;if(t.delayError&&$?(l=g(()=>_(D,$)),l(t.delayError)):(clearTimeout(u),l=null,$?ge(r.errors,D,$):Ce(r.errors,D)),($?!xt(Y,$):Y)||!ze(X)||Z){const te={...X,...Z&&rt(T)?{isValid:T}:{},errors:r.errors,name:D};r={...r,...te},m.state.next(te)}},E=async D=>(x(D,!0),await t.resolver(a,t.context,hd(D||c.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),I=async D=>{const{errors:T}=await E(D);if(x(D),D)for(const $ of D){const X=q(T,$);X?ge(r.errors,$,X):Ce(r.errors,$)}else r.errors=T;return T},M=async(D,T,$={valid:!0})=>{for(const X in D){const Y=D[X];if(Y){const{_f:Z,...te}=Y;if(Z){const le=c.array.has(Z.name),he=Y._f&&md(Y._f);he&&d.validatingFields&&x([Z.name],!0);const Ve=await Fo(Y,c.disabled,a,b,t.shouldUseNativeValidation&&!T,le);if(he&&d.validatingFields&&x([Z.name]),Ve[Z.name]&&($.valid=!1,T))break;!T&&(q(Ve,Z.name)?le?bd(r.errors,Ve,Z.name):ge(r.errors,Z.name,Ve[Z.name]):Ce(r.errors,Z.name))}!ze(te)&&await M(te,T,$)}}return $.valid},H=()=>{for(const D of c.unMount){const T=q(n,D);T&&(T._f.refs?T._f.refs.every($=>!Hs($)):!Hs(T._f.ref))&&pe(D)}c.unMount=new Set},N=(D,T)=>!t.disabled&&(D&&T&&ge(a,D,T),!xt(J(),s)),F=(D,T,$)=>sa(D,c,{...i.mount?a:Se(T)?s:ot(D)?{[D]:T}:T},$,T),A=D=>Aa(q(i.mount?a:s,D,t.shouldUnregister?q(s,D,[]):[])),V=(D,T,$={})=>{const X=q(n,D);let Y=T;if(X){const Z=X._f;Z&&(!Z.disabled&&ge(a,D,lc(T,Z)),Y=Yn(Z.ref)&&Ge(T)?"":T,oc(Z.ref)?[...Z.ref.options].forEach(te=>te.selected=Y.includes(te.value)):Z.refs?bn(Z.ref)?Z.refs.forEach(te=>{(!te.defaultChecked||!te.disabled)&&(Array.isArray(Y)?te.checked=!!Y.find(le=>le===te.value):te.checked=Y===te.value||!!Y)}):Z.refs.forEach(te=>te.checked=te.value===Y):Ma(Z.ref)?Z.ref.value="":(Z.ref.value=Y,Z.ref.type||m.state.next({name:D,values:Te(a)})))}($.shouldDirty||$.shouldTouch)&&k(D,Y,$.shouldTouch,$.shouldDirty,!0),$.shouldValidate&&z(D)},O=(D,T,$)=>{for(const X in T){if(!T.hasOwnProperty(X))return;const Y=T[X],Z=D+"."+X,te=q(n,Z);(c.array.has(D)||Ee(Y)||te&&!te._f)&&!vr(Y)?O(Z,Y,$):V(Z,Y,$)}},P=(D,T,$={})=>{const X=q(n,D),Y=c.array.has(D),Z=Te(T);ge(a,D,Z),Y?(m.array.next({name:D,values:Te(a)}),(d.isDirty||d.dirtyFields||h.isDirty||h.dirtyFields)&&$.shouldDirty&&m.state.next({name:D,dirtyFields:Pr(s,a),isDirty:N(D,Z)})):X&&!X._f&&!Ge(Z)?O(D,Z,$):V(D,Z,$),Oo(D,c)&&m.state.next({...r,name:D}),m.state.next({name:i.mount?D:void 0,values:Te(a)})},R=async D=>{i.mount=!0;const T=D.target;let $=T.name,X=!0;const Y=q(n,$),Z=he=>{X=Number.isNaN(he)||vr(he)&&isNaN(he.getTime())||xt(he,q(a,$,he))},te=Po(t.mode),le=Po(t.reValidateMode);if(Y){let he,Ve;const Je=T.type?Ro(Y._f):tc(D),vt=D.type===Zn.BLUR||D.type===Zn.FOCUS_OUT,Vs=!pd(Y._f)&&!t.resolver&&!q(r.errors,$)&&!Y._f.deps||yd(vt,q(r.touchedFields,$),r.isSubmitted,le,te),Jr=Oo($,c,vt);ge(a,$,Je),vt?(!T||!T.readOnly)&&(Y._f.onBlur&&Y._f.onBlur(D),l&&l(0)):Y._f.onChange&&Y._f.onChange(D);const mr=k($,Je,vt),An=!ze(mr)||Jr;if(!vt&&m.state.next({name:$,type:D.type,values:Te(a)}),Vs)return(d.isValid||h.isValid)&&(t.mode==="onBlur"?vt&&y():vt||y()),An&&m.state.next({name:$,...Jr?{}:mr});if(!vt&&Jr&&m.state.next({...r}),t.resolver){const{errors:Tn}=await E([$]);if(x([$]),Z(Je),X){const Rn=Io(r.errors,n,$),Pn=Io(Tn,n,Rn.name||$);he=Pn.error,$=Pn.name,Ve=ze(Tn)}}else x([$],!0),he=(await Fo(Y,c.disabled,a,b,t.shouldUseNativeValidation))[$],x([$]),Z(Je),X&&(he?Ve=!1:(d.isValid||h.isValid)&&(Ve=await M(n,!0)));X&&(Y._f.deps&&(!Array.isArray(Y._f.deps)||Y._f.deps.length>0)&&z(Y._f.deps),j($,Ve,he,mr))}},B=(D,T)=>{if(q(r.errors,T)&&D.focus)return D.focus(),1},z=async(D,T={})=>{let $,X;const Y=sn(D);if(t.resolver){const Z=await I(Se(D)?D:Y);$=ze(Z),X=D?!Y.some(te=>q(Z,te)):$}else D?(X=(await Promise.all(Y.map(async Z=>{const te=q(n,Z);return await M(te&&te._f?{[Z]:te}:te)}))).every(Boolean),!(!X&&!r.isValid)&&y()):X=$=await M(n);return m.state.next({...!ot(D)||(d.isValid||h.isValid)&&$!==r.isValid?{}:{name:D},...t.resolver||!D?{isValid:$}:{},errors:r.errors}),T.shouldFocus&&!X&&an(n,B,D?Y:c.mount),X},J=(D,T)=>{let $={...i.mount?a:s};return T&&($=ac(T.dirtyFields?r.dirtyFields:r.touchedFields,$)),Se(D)?$:ot(D)?q($,D):D.map(X=>q($,X))},G=(D,T)=>({invalid:!!q((T||r).errors,D),isDirty:!!q((T||r).dirtyFields,D),error:q((T||r).errors,D),isValidating:!!q(r.validatingFields,D),isTouched:!!q((T||r).touchedFields,D)}),L=D=>{D&&sn(D).forEach(T=>Ce(r.errors,T)),m.state.next({errors:D?r.errors:{}})},W=(D,T,$)=>{const X=(q(n,D,{_f:{}})._f||{}).ref,Y=q(r.errors,D)||{},{ref:Z,message:te,type:le,...he}=Y;ge(r.errors,D,{...he,...T,ref:X}),m.state.next({name:D,errors:r.errors,isValid:!1}),$&&$.shouldFocus&&X&&X.focus&&X.focus()},se=(D,T)=>He(D)?m.state.subscribe({next:$=>"values"in $&&D(F(void 0,T),$)}):F(D,T,!0),ne=D=>m.state.subscribe({next:T=>{vd(D.name,T.name,D.exact)&&gd(T,D.formState||d,Nn,D.reRenderRoot)&&D.callback({values:{...a},...r,...T,defaultValues:s})}}).unsubscribe,fe=D=>(i.mount=!0,h={...h,...D.formState},ne({...D,formState:{...f,...D.formState}})),pe=(D,T={})=>{for(const $ of D?sn(D):c.mount)c.mount.delete($),c.array.delete($),T.keepValue||(Ce(n,$),Ce(a,$)),!T.keepError&&Ce(r.errors,$),!T.keepDirty&&Ce(r.dirtyFields,$),!T.keepTouched&&Ce(r.touchedFields,$),!T.keepIsValidating&&Ce(r.validatingFields,$),!t.shouldUnregister&&!T.keepDefaultValue&&Ce(s,$);m.state.next({values:Te(a)}),m.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&y()},Ae=({disabled:D,name:T})=>{(rt(D)&&i.mount||D||c.disabled.has(T))&&(D?c.disabled.add(T):c.disabled.delete(T))},xe=(D,T={})=>{let $=q(n,D);const X=rt(T.disabled)||rt(t.disabled);return ge(n,D,{...$||{},_f:{...$&&$._f?$._f:{ref:{name:D}},name:D,mount:!0,...T}}),c.mount.add(D),$?Ae({disabled:rt(T.disabled)?T.disabled:t.disabled,name:D}):S(D,!0,T.value),{...X?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:rn(T.min),max:rn(T.max),minLength:rn(T.minLength),maxLength:rn(T.maxLength),pattern:rn(T.pattern)}:{},name:D,onChange:R,onBlur:R,ref:Y=>{if(Y){xe(D,T),$=q(n,D);const Z=Se(Y.value)&&Y.querySelectorAll&&Y.querySelectorAll("input,select,textarea")[0]||Y,te=ld(Z),le=$._f.refs||[];if(te?le.find(he=>he===Z):Z===$._f.ref)return;ge(n,D,{_f:{...$._f,...te?{refs:[...le.filter(Hs),Z,...Array.isArray(q(s,D))?[{}]:[]],ref:{type:Z.type,name:D}}:{ref:Z}}}),S(D,!1,void 0,Z)}else $=q(n,D,{}),$._f&&($._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(rc(c.array,D)&&i.action)&&c.unMount.add(D)}}},Ze=()=>t.shouldFocusError&&an(n,B,c.mount),Ye=D=>{rt(D)&&(m.state.next({disabled:D}),an(n,(T,$)=>{const X=q(n,$);X&&(T.disabled=X._f.disabled||D,Array.isArray(X._f.refs)&&X._f.refs.forEach(Y=>{Y.disabled=X._f.disabled||D}))},0,!1))},Xe=(D,T)=>async $=>{let X;$&&($.preventDefault&&$.preventDefault(),$.persist&&$.persist());let Y=Te(a);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:Z,values:te}=await E();x(),r.errors=Z,Y=Te(te)}else await M(n);if(c.disabled.size)for(const Z of c.disabled)Ce(Y,Z);if(Ce(r.errors,"root"),ze(r.errors)){m.state.next({errors:{}});try{await D(Y,$)}catch(Z){X=Z}}else T&&await T({...r.errors},$),Ze(),setTimeout(Ze);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ze(r.errors)&&!X,submitCount:r.submitCount+1,errors:r.errors}),X)throw X},Ke=(D,T={})=>{q(n,D)&&(Se(T.defaultValue)?P(D,Te(q(s,D))):(P(D,T.defaultValue),ge(s,D,Te(T.defaultValue))),T.keepTouched||Ce(r.touchedFields,D),T.keepDirty||(Ce(r.dirtyFields,D),r.isDirty=T.defaultValue?N(D,Te(q(s,D))):N()),T.keepError||(Ce(r.errors,D),d.isValid&&y()),m.state.next({...r}))},Ct=(D,T={})=>{const $=D?Te(D):s,X=Te($),Y=ze(D),Z=Y?s:X;if(T.keepDefaultValues||(s=$),!T.keepValues){if(T.keepDirtyValues){const te=new Set([...c.mount,...Object.keys(Pr(s,a))]);for(const le of Array.from(te))q(r.dirtyFields,le)?ge(Z,le,q(a,le)):P(le,q(Z,le))}else{if(Ea&&Se(D))for(const te of c.mount){const le=q(n,te);if(le&&le._f){const he=Array.isArray(le._f.refs)?le._f.refs[0]:le._f.ref;if(Yn(he)){const Ve=he.closest("form");if(Ve){Ve.reset();break}}}}if(T.keepFieldsRef)for(const te of c.mount)P(te,q(Z,te));else n={}}a=t.shouldUnregister?T.keepDefaultValues?Te(s):{}:Te(Z),m.array.next({values:{...Z}}),m.state.next({values:{...Z}})}c={mount:T.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues||!t.shouldUnregister&&!ze(Z),i.watch=!!t.shouldUnregister,i.keepIsValid=!!T.keepIsValid,i.action=!1,T.keepErrors||(r.errors={}),m.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:Y?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!xt(D,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:Y?{}:T.keepDirtyValues?T.keepDefaultValues&&a?Pr(s,a):r.dirtyFields:T.keepDefaultValues&&D?Pr(s,D):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},pt=(D,T)=>Ct(He(D)?D(a):D,{...t.resetOptions,...T}),Kt=(D,T={})=>{const $=q(n,D),X=$&&$._f;if(X){const Y=X.refs?X.refs[0]:X.ref;Y.focus&&setTimeout(()=>{Y.focus(),T.shouldSelect&&He(Y.select)&&Y.select()})}},Nn=D=>{r={...r,...D}},gt={control:{register:xe,unregister:pe,getFieldState:G,handleSubmit:Xe,setError:W,_subscribe:ne,_runSchema:E,_updateIsValidating:x,_focusError:Ze,_getWatch:F,_getDirty:N,_setValid:y,_setFieldArray:v,_setDisabledField:Ae,_setErrors:w,_getFieldArray:A,_reset:Ct,_resetDefaultValues:()=>He(t.defaultValues)&&t.defaultValues().then(D=>{pt(D,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:H,_disableForm:Ye,_subjects:m,_proxyFormState:d,get _fields(){return n},get _formValues(){return a},get _state(){return i},set _state(D){i=D},get _defaultValues(){return s},get _names(){return c},set _names(D){c=D},get _formState(){return r},get _options(){return t},set _options(D){t={...t,...D}}},subscribe:fe,trigger:z,register:xe,handleSubmit:Xe,watch:se,setValue:P,getValues:J,reset:pt,resetField:Ke,clearErrors:L,unregister:pe,setError:W,setFocus:Kt,getFieldState:G};return{...gt,formControl:gt}}function dc(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),[n,s]=p.useState({isDirty:!1,isValidating:!1,isLoading:He(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:He(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!He(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...c}=_d(e);t.current={...c,formState:n}}const a=t.current.control;return a._options=e,Pa(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>s({...a._formState}),reRenderRoot:!0});return s(c=>({...c,isReady:!0})),a._formState.isReady=!0,i},[a]),p.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),p.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),p.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),p.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==n.isDirty&&a._subjects.state.next({isDirty:i})}},[a,n.isDirty]),p.useEffect(()=>{var i;e.values&&!xt(e.values,r.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((i=a._options.resetOptions)===null||i===void 0)&&i.keepIsValid||a._setValid(),r.current=e.values,s(c=>({...c}))):a._resetDefaultValues()},[a,e.values]),p.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=nc(n,a),t.current}const Lo=(e,t,r)=>{if(e&&"reportValidity"in e){const n=q(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},fc=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Lo(n.ref,r,e):n.refs&&n.refs.forEach(s=>Lo(s,r,e))}},Sd=(e,t)=>{t.shouldUseNativeValidation&&fc(e,t);const r={};for(const n in e){const s=q(t.fields,n),a=Object.assign(e[n]||{},{ref:s&&s.ref});if(kd(t.names||Object.keys(e),n)){const i=Object.assign({},q(r,n));ge(i,"root",a),ge(r,n,i)}else ge(r,n,a)}return r},kd=(e,t)=>e.some(r=>r.startsWith(t+"."));var Cd=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,a=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var c=n.unionErrors[0].errors[0];r[i]={message:c.message,type:c.code}}else r[i]={message:a,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(f){return f.errors.forEach(function(d){return e.push(d)})}),t){var l=r[i].types,u=l&&l[n.code];r[i]=sc(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},hc=function(e,t,r){return r===void 0&&(r={}),function(n,s,a){try{return Promise.resolve((function(i,c){try{var l=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return a.shouldUseNativeValidation&&fc({},a),{errors:{},values:r.raw?n:u}})}catch(u){return c(u)}return l&&l.then?l.then(void 0,c):l})(0,function(i){if((function(c){return Array.isArray(c?.errors)})(i))return{values:{},errors:Sd(Cd(i.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw i}))}catch(i){return Promise.reject(i)}}},me;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},e.getValidEnumValues=s=>{const a=e.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),i={};for(const c of a)i[c]=s[c];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(a){return s[a]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},e.find=(s,a)=>{for(const i of s)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(me||(me={}));var Vo;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Vo||(Vo={}));const ee=me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sr=e=>{switch(typeof e){case"undefined":return ee.undefined;case"string":return ee.string;case"number":return Number.isNaN(e)?ee.nan:ee.number;case"boolean":return ee.boolean;case"function":return ee.function;case"bigint":return ee.bigint;case"symbol":return ee.symbol;case"object":return Array.isArray(e)?ee.array:e===null?ee.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ee.promise:typeof Map<"u"&&e instanceof Map?ee.map:typeof Set<"u"&&e instanceof Set?ee.set:typeof Date<"u"&&e instanceof Date?ee.date:ee.object;default:return ee.unknown}},U=me.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Zt extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let c=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(r(i))):c[u]=c[u]||{_errors:[]},c=c[u],l++}}};return s(this),n}static assert(t){if(!(t instanceof Zt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(t(s))}else n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Zt.create=e=>new Zt(e);const ia=(e,t)=>{let r;switch(e.code){case U.invalid_type:e.received===ee.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,me.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:r=`Unrecognized key(s) in object: ${me.joinValues(e.keys,", ")}`;break;case U.invalid_union:r="Invalid input";break;case U.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${me.joinValues(e.options)}`;break;case U.invalid_enum_value:r=`Invalid enum value. Expected ${me.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:r="Invalid function arguments";break;case U.invalid_return_type:r="Invalid function return type";break;case U.invalid_date:r="Invalid date";break;case U.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:me.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case U.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case U.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case U.custom:r="Invalid input";break;case U.invalid_intersection_types:r="Intersection results could not be merged";break;case U.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:r="Number must be finite";break;default:r=t.defaultError,me.assertNever(e)}return{message:r}};let jd=ia;function Dd(){return jd}const Nd=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let c="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)c=u(i,{data:t,defaultError:c}).message;return{...s,path:a,message:c}};function K(e,t){const r=Dd(),n=Nd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ia?void 0:ia].filter(s=>!!s)});e.common.issues.push(n)}class We{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return ie;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return We.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return ie;a.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:t.value,value:n}}}const ie=Object.freeze({status:"aborted"}),nn=e=>({status:"dirty",value:e}),mt=e=>({status:"valid",value:e}),zo=e=>e.status==="aborted",Ho=e=>e.status==="dirty",Lr=e=>e.status==="valid",qn=e=>typeof Promise<"u"&&e instanceof Promise;var re;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(re||(re={}));class Lt{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Bo=(e,t)=>{if(Lr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Zt(e.common.issues);return this._error=r,this._error}}};function ce(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,c)=>{const{message:l}=e;return i.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??n??c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:l??r??c.defaultError}},description:s}}class ue{get description(){return this._def.description}_getType(t){return sr(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:sr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new We,ctx:{common:t.parent.common,data:t.data,parsedType:sr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(qn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:sr(t)},s=this._parseSync({data:t,path:n.path,parent:n});return Bo(n,s)}"~validate"(t){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:sr(t)};if(!this["~standard"].async)try{const n=this._parseSync({data:t,path:[],parent:r});return Lr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Lr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:sr(t)},s=this._parse({data:t,path:n.path,parent:n}),a=await(qn(s)?s:Promise.resolve(s));return Bo(n,a)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=t(s),c=()=>a.addIssue({code:U.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(c(),!1)):i?!0:(c(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new Hr({schema:this,typeName:ae.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return or.create(this,this._def)}nullable(){return Br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $t.create(this)}promise(){return es.create(this,this._def)}or(t){return Kn.create([this,t],this._def)}and(t){return Jn.create(this,t,this._def)}transform(t){return new Hr({...ce(this._def),schema:this,typeName:ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fa({...ce(this._def),innerType:this,defaultValue:r,typeName:ae.ZodDefault})}brand(){return new Kd({typeName:ae.ZodBranded,type:this,...ce(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new ha({...ce(this._def),innerType:this,catchValue:r,typeName:ae.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ia.create(this,t)}readonly(){return ma.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ed=/^c[^\s-]{8,}$/i,Ad=/^[0-9a-z]+$/,Td=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rd=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Pd=/^[a-z0-9_-]{21}$/i,Md=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Od=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Id=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$d="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bs;const Fd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ld=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Vd=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,zd=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Bd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mc="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Wd=new RegExp(`^${mc}$`);function pc(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Ud(e){return new RegExp(`^${pc(e)}$`)}function Zd(e){let t=`${mc}T${pc(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Yd(e,t){return!!((t==="v4"||!t)&&Fd.test(e)||(t==="v6"||!t)&&Vd.test(e))}function Gd(e,t){if(!Md.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function qd(e,t){return!!((t==="v4"||!t)&&Ld.test(e)||(t==="v6"||!t)&&zd.test(e))}class Tt extends ue{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ee.string){const a=this._getOrReturnCtx(t);return K(a,{code:U.invalid_type,expected:ee.string,received:a.parsedType}),ie}const n=new We;let s;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(s=this._getOrReturnCtx(t,s),K(s,{code:U.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(s=this._getOrReturnCtx(t,s),K(s,{code:U.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,c=t.data.length<a.value;(i||c)&&(s=this._getOrReturnCtx(t,s),i?K(s,{code:U.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&K(s,{code:U.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Id.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"email",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Bs||(Bs=new RegExp($d,"u")),Bs.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"emoji",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Rd.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"uuid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Pd.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"nanoid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Ed.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"cuid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Ad.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"cuid2",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Td.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"ulid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),K(s,{validation:"url",code:U.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"regex",code:U.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(t,s),K(s,{code:U.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(s=this._getOrReturnCtx(t,s),K(s,{code:U.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(s=this._getOrReturnCtx(t,s),K(s,{code:U.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Zd(a).test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{code:U.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Wd.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{code:U.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Ud(a).test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{code:U.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Od.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"duration",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Yd(t.data,a.version)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"ip",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Gd(t.data,a.alg)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"jwt",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?qd(t.data,a.version)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"cidr",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Hd.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"base64",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Bd.test(t.data)||(s=this._getOrReturnCtx(t,s),K(s,{validation:"base64url",code:U.invalid_string,message:a.message}),n.dirty()):me.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:U.invalid_string,...re.errToObj(n)})}_addCheck(t){return new Tt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...re.errToObj(t)})}url(t){return this._addCheck({kind:"url",...re.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...re.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...re.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...re.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...re.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...re.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...re.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...re.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...re.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...re.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...re.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...re.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...re.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...re.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...re.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}nonempty(t){return this.min(1,re.errToObj(t))}trim(){return new Tt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Tt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Tt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Tt.create=e=>new Tt({checks:[],typeName:ae.ZodString,coerce:e?.coerce??!1,...ce(e)});function Xd(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return a%i/10**s}class xr extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ee.number){const a=this._getOrReturnCtx(t);return K(a,{code:U.invalid_type,expected:ee.number,received:a.parsedType}),ie}let n;const s=new We;for(const a of this._def.checks)a.kind==="int"?me.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),K(n,{code:U.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),K(n,{code:U.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),K(n,{code:U.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Xd(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),K(n,{code:U.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),K(n,{code:U.not_finite,message:a.message}),s.dirty()):me.assertNever(a);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,s){return new xr({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(s)}]})}_addCheck(t){return new xr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:re.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:re.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&me.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}xr.create=e=>new xr({checks:[],typeName:ae.ZodNumber,coerce:e?.coerce||!1,...ce(e)});class br extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ee.bigint)return this._getInvalidInput(t);let n;const s=new We;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),K(n,{code:U.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),K(n,{code:U.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),K(n,{code:U.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):me.assertNever(a);return{status:s.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return K(r,{code:U.invalid_type,expected:ee.bigint,received:r.parsedType}),ie}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,s){return new br({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(s)}]})}_addCheck(t){return new br({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}br.create=e=>new br({checks:[],typeName:ae.ZodBigInt,coerce:e?.coerce??!1,...ce(e)});class Xn extends ue{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ee.boolean){const n=this._getOrReturnCtx(t);return K(n,{code:U.invalid_type,expected:ee.boolean,received:n.parsedType}),ie}return mt(t.data)}}Xn.create=e=>new Xn({typeName:ae.ZodBoolean,coerce:e?.coerce||!1,...ce(e)});class Vr extends ue{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ee.date){const a=this._getOrReturnCtx(t);return K(a,{code:U.invalid_type,expected:ee.date,received:a.parsedType}),ie}if(Number.isNaN(t.data.getTime())){const a=this._getOrReturnCtx(t);return K(a,{code:U.invalid_date}),ie}const n=new We;let s;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(s=this._getOrReturnCtx(t,s),K(s,{code:U.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(s=this._getOrReturnCtx(t,s),K(s,{code:U.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):me.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Vr({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}Vr.create=e=>new Vr({checks:[],coerce:e?.coerce||!1,typeName:ae.ZodDate,...ce(e)});class Wo extends ue{_parse(t){if(this._getType(t)!==ee.symbol){const n=this._getOrReturnCtx(t);return K(n,{code:U.invalid_type,expected:ee.symbol,received:n.parsedType}),ie}return mt(t.data)}}Wo.create=e=>new Wo({typeName:ae.ZodSymbol,...ce(e)});class Uo extends ue{_parse(t){if(this._getType(t)!==ee.undefined){const n=this._getOrReturnCtx(t);return K(n,{code:U.invalid_type,expected:ee.undefined,received:n.parsedType}),ie}return mt(t.data)}}Uo.create=e=>new Uo({typeName:ae.ZodUndefined,...ce(e)});class Zo extends ue{_parse(t){if(this._getType(t)!==ee.null){const n=this._getOrReturnCtx(t);return K(n,{code:U.invalid_type,expected:ee.null,received:n.parsedType}),ie}return mt(t.data)}}Zo.create=e=>new Zo({typeName:ae.ZodNull,...ce(e)});class ca extends ue{constructor(){super(...arguments),this._any=!0}_parse(t){return mt(t.data)}}ca.create=e=>new ca({typeName:ae.ZodAny,...ce(e)});class la extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(t){return mt(t.data)}}la.create=e=>new la({typeName:ae.ZodUnknown,...ce(e)});class cr extends ue{_parse(t){const r=this._getOrReturnCtx(t);return K(r,{code:U.invalid_type,expected:ee.never,received:r.parsedType}),ie}}cr.create=e=>new cr({typeName:ae.ZodNever,...ce(e)});class Yo extends ue{_parse(t){if(this._getType(t)!==ee.undefined){const n=this._getOrReturnCtx(t);return K(n,{code:U.invalid_type,expected:ee.void,received:n.parsedType}),ie}return mt(t.data)}}Yo.create=e=>new Yo({typeName:ae.ZodVoid,...ce(e)});class $t extends ue{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==ee.array)return K(r,{code:U.invalid_type,expected:ee.array,received:r.parsedType}),ie;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,c=r.data.length<s.exactLength.value;(i||c)&&(K(r,{code:i?U.too_big:U.too_small,minimum:c?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(K(r,{code:U.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(K(r,{code:U.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,c)=>s.type._parseAsync(new Lt(r,i,r.path,c)))).then(i=>We.mergeArray(n,i));const a=[...r.data].map((i,c)=>s.type._parseSync(new Lt(r,i,r.path,c)));return We.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new $t({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new $t({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new $t({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}}$t.create=(e,t)=>new $t({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ae.ZodArray,...ce(t)});function Mr(e){if(e instanceof je){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=or.create(Mr(n))}return new je({...e._def,shape:()=>t})}else return e instanceof $t?new $t({...e._def,type:Mr(e.element)}):e instanceof or?or.create(Mr(e.unwrap())):e instanceof Br?Br.create(Mr(e.unwrap())):e instanceof wr?wr.create(e.items.map(t=>Mr(t))):e}class je extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=me.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ee.object){const u=this._getOrReturnCtx(t);return K(u,{code:U.invalid_type,expected:ee.object,received:u.parsedType}),ie}const{status:n,ctx:s}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),c=[];if(!(this._def.catchall instanceof cr&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||c.push(u);const l=[];for(const u of i){const f=a[u],d=s.data[u];l.push({key:{status:"valid",value:u},value:f._parse(new Lt(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof cr){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of c)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(u==="strict")c.length>0&&(K(s,{code:U.unrecognized_keys,keys:c}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of c){const d=s.data[f];l.push({key:{status:"valid",value:f},value:u._parse(new Lt(s,d,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of l){const d=await f.key,h=await f.value;u.push({key:d,value:h,alwaysSet:f.alwaysSet})}return u}).then(u=>We.mergeObjectSync(n,u)):We.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new je({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new je({...this._def,unknownKeys:"strip"})}passthrough(){return new je({...this._def,unknownKeys:"passthrough"})}extend(t){return new je({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new je({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ae.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new je({...this._def,catchall:t})}pick(t){const r={};for(const n of me.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new je({...this._def,shape:()=>r})}omit(t){const r={};for(const n of me.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new je({...this._def,shape:()=>r})}deepPartial(){return Mr(this)}partial(t){const r={};for(const n of me.objectKeys(this.shape)){const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}return new je({...this._def,shape:()=>r})}required(t){const r={};for(const n of me.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof or;)a=a._def.innerType;r[n]=a}return new je({...this._def,shape:()=>r})}keyof(){return gc(me.objectKeys(this.shape))}}je.create=(e,t)=>new je({shape:()=>e,unknownKeys:"strip",catchall:cr.create(),typeName:ae.ZodObject,...ce(t)});je.strictCreate=(e,t)=>new je({shape:()=>e,unknownKeys:"strict",catchall:cr.create(),typeName:ae.ZodObject,...ce(t)});je.lazycreate=(e,t)=>new je({shape:e,unknownKeys:"strip",catchall:cr.create(),typeName:ae.ZodObject,...ce(t)});class Kn extends ue{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(a){for(const c of a)if(c.result.status==="valid")return c.result;for(const c of a)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;const i=a.map(c=>new Zt(c.ctx.common.issues));return K(r,{code:U.invalid_union,unionErrors:i}),ie}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const l of n){const u={...r,common:{...r.common,issues:[]},parent:null},f=l._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const c=i.map(l=>new Zt(l));return K(r,{code:U.invalid_union,unionErrors:c}),ie}}get options(){return this._def.options}}Kn.create=(e,t)=>new Kn({options:e,typeName:ae.ZodUnion,...ce(t)});function ua(e,t){const r=sr(e),n=sr(t);if(e===t)return{valid:!0,data:e};if(r===ee.object&&n===ee.object){const s=me.objectKeys(t),a=me.objectKeys(e).filter(c=>s.indexOf(c)!==-1),i={...e,...t};for(const c of a){const l=ua(e[c],t[c]);if(!l.valid)return{valid:!1};i[c]=l.data}return{valid:!0,data:i}}else if(r===ee.array&&n===ee.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const i=e[a],c=t[a],l=ua(i,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return r===ee.date&&n===ee.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Jn extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(a,i)=>{if(zo(a)||zo(i))return ie;const c=ua(a.value,i.value);return c.valid?((Ho(a)||Ho(i))&&r.dirty(),{status:r.value,value:c.data}):(K(n,{code:U.invalid_intersection_types}),ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Jn.create=(e,t,r)=>new Jn({left:e,right:t,typeName:ae.ZodIntersection,...ce(r)});class wr extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.array)return K(n,{code:U.invalid_type,expected:ee.array,received:n.parsedType}),ie;if(n.data.length<this._def.items.length)return K(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&n.data.length>this._def.items.length&&(K(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new Lt(n,i,n.path,c)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>We.mergeArray(r,i)):We.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new wr({...this._def,rest:t})}}wr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wr({items:e,typeName:ae.ZodTuple,rest:null,...ce(t)})};class Qn extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.object)return K(n,{code:U.invalid_type,expected:ee.object,received:n.parsedType}),ie;const s=[],a=this._def.keyType,i=this._def.valueType;for(const c in n.data)s.push({key:a._parse(new Lt(n,c,n.path,c)),value:i._parse(new Lt(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?We.mergeObjectAsync(r,s):We.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ue?new Qn({keyType:t,valueType:r,typeName:ae.ZodRecord,...ce(n)}):new Qn({keyType:Tt.create(),valueType:t,typeName:ae.ZodRecord,...ce(r)})}}class Go extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.map)return K(n,{code:U.invalid_type,expected:ee.map,received:n.parsedType}),ie;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([c,l],u)=>({key:s._parse(new Lt(n,c,n.path,[u,"key"])),value:a._parse(new Lt(n,l,n.path,[u,"value"]))}));if(n.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,f=await l.value;if(u.status==="aborted"||f.status==="aborted")return ie;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(u.value,f.value)}return{status:r.value,value:c}})}else{const c=new Map;for(const l of i){const u=l.key,f=l.value;if(u.status==="aborted"||f.status==="aborted")return ie;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(u.value,f.value)}return{status:r.value,value:c}}}}Go.create=(e,t,r)=>new Go({valueType:t,keyType:e,typeName:ae.ZodMap,...ce(r)});class fn extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.set)return K(n,{code:U.invalid_type,expected:ee.set,received:n.parsedType}),ie;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(K(n,{code:U.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(K(n,{code:U.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const f of l){if(f.status==="aborted")return ie;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}const c=[...n.data.values()].map((l,u)=>a._parse(new Lt(n,l,n.path,u)));return n.common.async?Promise.all(c).then(l=>i(l)):i(c)}min(t,r){return new fn({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new fn({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}fn.create=(e,t)=>new fn({valueType:e,minSize:null,maxSize:null,typeName:ae.ZodSet,...ce(t)});class qo extends ue{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}qo.create=(e,t)=>new qo({getter:e,typeName:ae.ZodLazy,...ce(t)});class da extends ue{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return K(r,{received:r.data,code:U.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:t.data}}get value(){return this._def.value}}da.create=(e,t)=>new da({value:e,typeName:ae.ZodLiteral,...ce(t)});function gc(e,t){return new zr({values:e,typeName:ae.ZodEnum,...ce(t)})}class zr extends ue{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return K(r,{expected:me.joinValues(n),received:r.parsedType,code:U.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return K(r,{received:r.data,code:U.invalid_enum_value,options:n}),ie}return mt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return zr.create(t,{...this._def,...r})}exclude(t,r=this._def){return zr.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}zr.create=gc;class Xo extends ue{_parse(t){const r=me.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ee.string&&n.parsedType!==ee.number){const s=me.objectValues(r);return K(n,{expected:me.joinValues(s),received:n.parsedType,code:U.invalid_type}),ie}if(this._cache||(this._cache=new Set(me.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=me.objectValues(r);return K(n,{received:n.data,code:U.invalid_enum_value,options:s}),ie}return mt(t.data)}get enum(){return this._def.values}}Xo.create=(e,t)=>new Xo({values:e,typeName:ae.ZodNativeEnum,...ce(t)});class es extends ue{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.promise&&r.common.async===!1)return K(r,{code:U.invalid_type,expected:ee.promise,received:r.parsedType}),ie;const n=r.parsedType===ee.promise?r.data:Promise.resolve(r.data);return mt(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}es.create=(e,t)=>new es({type:e,typeName:ae.ZodPromise,...ce(t)});class Hr extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:i=>{K(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async c=>{if(r.value==="aborted")return ie;const l=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return l.status==="aborted"?ie:l.status==="dirty"||r.value==="dirty"?nn(l.value):l});{if(r.value==="aborted")return ie;const c=this._def.schema._parseSync({data:i,path:n.path,parent:n});return c.status==="aborted"?ie:c.status==="dirty"||r.value==="dirty"?nn(c.value):c}}if(s.type==="refinement"){const i=c=>{const l=s.refinement(c,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){const c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?ie:(c.status==="dirty"&&r.dirty(),i(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?ie:(c.status==="dirty"&&r.dirty(),i(c.value).then(()=>({status:r.value,value:c.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Lr(i))return ie;const c=s.transform(i.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Lr(i)?Promise.resolve(s.transform(i.value,a)).then(c=>({status:r.value,value:c})):ie);me.assertNever(s)}}Hr.create=(e,t,r)=>new Hr({schema:e,typeName:ae.ZodEffects,effect:t,...ce(r)});Hr.createWithPreprocess=(e,t,r)=>new Hr({schema:t,effect:{type:"preprocess",transform:e},typeName:ae.ZodEffects,...ce(r)});class or extends ue{_parse(t){return this._getType(t)===ee.undefined?mt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}or.create=(e,t)=>new or({innerType:e,typeName:ae.ZodOptional,...ce(t)});class Br extends ue{_parse(t){return this._getType(t)===ee.null?mt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Br.create=(e,t)=>new Br({innerType:e,typeName:ae.ZodNullable,...ce(t)});class fa extends ue{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===ee.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fa.create=(e,t)=>new fa({innerType:e,typeName:ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ce(t)});class ha extends ue{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return qn(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ha.create=(e,t)=>new ha({innerType:e,typeName:ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ce(t)});class Ko extends ue{_parse(t){if(this._getType(t)!==ee.nan){const n=this._getOrReturnCtx(t);return K(n,{code:U.invalid_type,expected:ee.nan,received:n.parsedType}),ie}return{status:"valid",value:t.data}}}Ko.create=e=>new Ko({typeName:ae.ZodNaN,...ce(e)});class Kd extends ue{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ia extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ie:a.status==="dirty"?(r.dirty(),nn(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ie:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new Ia({in:t,out:r,typeName:ae.ZodPipeline})}}class ma extends ue{_parse(t){const r=this._def.innerType._parse(t),n=s=>(Lr(s)&&(s.value=Object.freeze(s.value)),s);return qn(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}ma.create=(e,t)=>new ma({innerType:e,typeName:ae.ZodReadonly,...ce(t)});var ae;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ae||(ae={}));const Q=Tt.create,we=xr.create;br.create;const qe=Xn.create,ke=Vr.create,vc=ca.create,Jd=la.create;cr.create;const Yt=$t.create,Fe=je.create,xs=Kn.create;Jn.create;wr.create;const yc=Qn.create,Wt=da.create,kr=zr.create;es.create;or.create;Br.create;const ts={string:(e=>Tt.create({...e,coerce:!0})),number:(e=>xr.create({...e,coerce:!0})),boolean:(e=>Xn.create({...e,coerce:!0})),bigint:(e=>br.create({...e,coerce:!0})),date:(e=>Vr.create({...e,coerce:!0}))};function Jo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $a(...e){return t=>{let r=!1;const n=e.map(s=>{const a=Jo(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():Jo(e[s],null)}}}}function ct(...e){return C.useCallback($a(...e),e)}var Qd=Symbol.for("react.lazy"),rs=C[" use ".trim().toString()];function ef(e){return typeof e=="object"&&e!==null&&"then"in e}function xc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Qd&&"_payload"in e&&ef(e._payload)}function tf(e){const t=nf(e),r=C.forwardRef((n,s)=>{let{children:a,...i}=n;xc(a)&&typeof rs=="function"&&(a=rs(a._payload));const c=C.Children.toArray(a),l=c.find(af);if(l){const u=l.props.children,f=c.map(d=>d===l?C.Children.count(u)>1?C.Children.only(null):C.isValidElement(u)?u.props.children:null:d);return o.jsx(t,{...i,ref:s,children:C.isValidElement(u)?C.cloneElement(u,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}var rf=tf("Slot");function nf(e){const t=C.forwardRef((r,n)=>{let{children:s,...a}=r;if(xc(s)&&typeof rs=="function"&&(s=rs(s._payload)),C.isValidElement(s)){const i=cf(s),c=of(a,s.props);return s.type!==C.Fragment&&(c.ref=n?$a(n,i):i),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sf=Symbol("radix.slottable");function af(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sf}function of(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...c)=>{const l=a(...c);return s(...c),l}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function cf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const Qo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ei=Qi,lf=(e,t)=>r=>{var n;if(t?.variants==null)return ei(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const f=r?.[u],d=a?.[u];if(f===null)return null;const h=Qo(f)||Qo(d);return s[u][h]}),c=r&&Object.entries(r).reduce((u,f)=>{let[d,h]=f;return h===void 0||(u[d]=h),u},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,f)=>{let{class:d,className:h,...m}=f;return Object.entries(m).every(b=>{let[g,y]=b;return Array.isArray(y)?y.includes({...a,...c}[g]):{...a,...c}[g]===y})?[...u,d,h]:u},[]);return ei(e,i,l,r?.class,r?.className)},on=lf("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 min-w-[var(--ui-space-0)] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-chart-4 text-white shadow-sm hover:bg-chart-4/90",outline:"border border-input bg-transparent text-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-accent underline-offset-4 underline hover:text-accent/80 !h-auto !py-[var(--ui-space-0)]",positive:"bg-chart-2 text-white shadow-sm hover:bg-chart-2/90",warning:"bg-chart-3 text-white shadow-sm hover:bg-chart-3/90",info:"bg-chart-5 text-white shadow-sm hover:bg-chart-5/90","outline-positive":"border border-chart-2 text-chart-2 hover:bg-chart-2/10","outline-negative":"border border-muted text-muted-foreground hover:bg-muted/10",fab:"rounded-full h-[var(--ui-space-14)] w-[var(--ui-space-14)] p-[var(--ui-space-0)] shadow-lg hover:shadow-xl bg-primary text-primary-foreground hover:bg-primary/90","circle-help":"bg-accent text-accent-foreground shadow-sm hover:bg-accent/90 rounded-full","circle-alert":"bg-chart-3 text-white shadow-sm hover:bg-chart-3/90 rounded-full",abort:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",negative:"bg-muted text-muted-foreground shadow-sm hover:bg-muted/80",delete:"bg-chart-4 text-white shadow-sm hover:bg-chart-4/90",pause:"bg-chart-3 text-white shadow-sm hover:bg-chart-3/90","outline-abort":"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",option:"border border-[hsl(210,30%,35%)] dark:border-border bg-background text-foreground shadow-none hover:bg-accent/30 hover:text-foreground","option-active":"border-2 border-primary bg-primary/10 text-foreground shadow-none hover:bg-primary/20","outline-delete":"border border-destructive/50 text-destructive bg-background hover:bg-destructive/10 hover:border-destructive"},size:{default:"px-ui-button py-ui text-ui min-h-ui-touch",sm:"rounded-md px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-xs",lg:"rounded-md px-[var(--ui-space-8)] py-[var(--ui-space-3)]",icon:"p-ui min-h-ui-touch min-w-[var(--ui-touch-target-min)]",circle:"rounded-full p-[var(--ui-space-2)] aspect-square"}},defaultVariants:{variant:"default",size:"default"}}),oe=C.forwardRef(({className:e,variant:t="default",size:r,children:n,loading:s=!1,success:a=!1,error:i=!1,icon:c,asChild:l=!1,disabled:u,maxLabelLength:f=100,...d},h)=>{const m=l?rf:"button",b=a?"positive":i?"destructive":t,g=()=>{if(s)return o.jsx(ye.Spinner,{className:"h-ui-icon w-ui-icon"});if(a)return o.jsx(ye.Check,{className:"h-ui-icon w-ui-icon"});if(i)return o.jsx(ye.X,{className:"h-ui-icon w-ui-icon"});const y=typeof n=="string"&&n.length>f?`${n.slice(0,Math.max(0,f-1))}…`:n,x=typeof n=="string"&&typeof y=="string"&&y!==n,v=typeof n=="string"?o.jsx("span",{className:"min-w-[var(--ui-space-0)] flex-1 whitespace-nowrap",title:x?n:void 0,children:y}):n;return o.jsxs("span",{className:"flex min-w-[var(--ui-space-0)] items-center",children:[c&&o.jsx(c,{className:de(n?"mr-[var(--ui-space-2)]":"mr-[var(--ui-space-0)]","h-ui-icon w-ui-icon")}),v]})};return o.jsx(m,{className:de(on({variant:b,size:r,className:e})),ref:h,disabled:u||s||a||i,...d,children:g()})});oe.displayName="Button";function uf(e,t){const r=C.createContext(t),n=a=>{const{children:i,...c}=a,l=C.useMemo(()=>c,Object.values(c));return o.jsx(r.Provider,{value:l,children:i})};n.displayName=e+"Provider";function s(a){const i=C.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function bs(e,t=[]){let r=[];function n(a,i){const c=C.createContext(i),l=r.length;r=[...r,i];const u=d=>{const{scope:h,children:m,...b}=d,g=h?.[e]?.[l]||c,y=C.useMemo(()=>b,Object.values(b));return o.jsx(g.Provider,{value:y,children:m})};u.displayName=a+"Provider";function f(d,h){const m=h?.[e]?.[l]||c,b=C.useContext(m);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[u,f]}const s=()=>{const a=r.map(i=>C.createContext(i));return function(c){const l=c?.[e]||a;return C.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return s.scopeName=e,[n,df(s,...t)]}function df(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=n.reduce((c,{useScope:l,scopeName:u})=>{const d=l(a)[`__scope${u}`];return{...c,...d}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function Be(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}var lr=globalThis?.document?C.useLayoutEffect:()=>{},ff=C[" useInsertionEffect ".trim().toString()]||lr;function Fa({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,i]=hf({defaultProp:t,onChange:r}),c=e!==void 0,l=c?e:s;{const f=C.useRef(e!==void 0);C.useEffect(()=>{const d=f.current;d!==c&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,n])}const u=C.useCallback(f=>{if(c){const d=mf(f)?f(e):f;d!==e&&i.current?.(d)}else a(f)},[c,e,a,i]);return[l,u]}function hf({defaultProp:e,onChange:t}){const[r,n]=C.useState(e),s=C.useRef(r),a=C.useRef(t);return ff(()=>{a.current=t},[t]),C.useEffect(()=>{s.current!==r&&(a.current?.(r),s.current=r)},[r,s]),[r,n,a]}function mf(e){return typeof e=="function"}function pf(e){const t=C.useRef({value:e,previous:e});return C.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function bc(e){const[t,r]=C.useState(void 0);return lr(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let i,c;if("borderBoxSize"in a){const l=a.borderBoxSize,u=Array.isArray(l)?l[0]:l;i=u.inlineSize,c=u.blockSize}else i=e.offsetWidth,c=e.offsetHeight;r({width:i,height:c})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function gf(e,t){return C.useReducer((r,n)=>t[r][n]??r,e)}var Cr=e=>{const{present:t,children:r}=e,n=vf(t),s=typeof r=="function"?r({present:n.isPresent}):C.Children.only(r),a=ct(n.ref,yf(s));return typeof r=="function"||n.isPresent?C.cloneElement(s,{ref:a}):null};Cr.displayName="Presence";function vf(e){const[t,r]=C.useState(),n=C.useRef(null),s=C.useRef(e),a=C.useRef("none"),i=e?"mounted":"unmounted",[c,l]=gf(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{const u=Mn(n.current);a.current=c==="mounted"?u:"none"},[c]),lr(()=>{const u=n.current,f=s.current;if(f!==e){const h=a.current,m=Mn(u);e?l("MOUNT"):m==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&h!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),lr(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=m=>{const g=Mn(n.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(l("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=m=>{m.target===t&&(a.current=Mn(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:C.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Mn(e){return e?.animationName||"none"}function yf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function La(e){const t=xf(e),r=C.forwardRef((n,s)=>{const{children:a,...i}=n,c=C.Children.toArray(a),l=c.find(wf);if(l){const u=l.props.children,f=c.map(d=>d===l?C.Children.count(u)>1?C.Children.only(null):C.isValidElement(u)?u.props.children:null:d);return o.jsx(t,{...i,ref:s,children:C.isValidElement(u)?C.cloneElement(u,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function xf(e){const t=C.forwardRef((r,n)=>{const{children:s,...a}=r;if(C.isValidElement(s)){const i=Sf(s),c=_f(a,s.props);return s.type!==C.Fragment&&(c.ref=n?$a(n,i):i),C.cloneElement(s,c)}return C.Children.count(s)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bf=Symbol("radix.slottable");function wf(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bf}function _f(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...c)=>{const l=a(...c);return s(...c),l}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Sf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var kf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=kf.reduce((e,t)=>{const r=La(`Primitive.${t}`),n=C.forwardRef((s,a)=>{const{asChild:i,...c}=s,l=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(l,{...c,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Cf(e,t){e&&Ki.flushSync(()=>e.dispatchEvent(t))}var ws="Checkbox",[jf]=bs(ws),[Df,Va]=jf(ws);function Nf(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:a,form:i,name:c,onCheckedChange:l,required:u,value:f="on",internal_do_not_use_render:d}=e,[h,m]=Fa({prop:r,defaultProp:s??!1,onChange:l,caller:ws}),[b,g]=C.useState(null),[y,x]=C.useState(null),v=C.useRef(!1),_=b?!!i||!!b.closest("form"):!0,w={checked:h,disabled:a,setChecked:m,control:b,setControl:g,name:c,form:i,value:f,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:ir(s)?!1:s,isFormControl:_,bubbleInput:y,setBubbleInput:x};return o.jsx(Df,{scope:t,...w,children:Ef(d)?d(w):n})}var wc="CheckboxTrigger",_c=C.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:a,value:i,disabled:c,checked:l,required:u,setControl:f,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:b}=Va(wc,e),g=ct(s,f),y=C.useRef(l);return C.useEffect(()=>{const x=a?.form;if(x){const v=()=>d(y.current);return x.addEventListener("reset",v),()=>x.removeEventListener("reset",v)}},[a,d]),o.jsx(Ie.button,{type:"button",role:"checkbox","aria-checked":ir(l)?"mixed":l,"aria-required":u,"data-state":Dc(l),"data-disabled":c?"":void 0,disabled:c,value:i,...n,ref:g,onKeyDown:Be(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Be(r,x=>{d(v=>ir(v)?!0:!v),b&&m&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});_c.displayName=wc;var za=C.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:a,required:i,disabled:c,value:l,onCheckedChange:u,form:f,...d}=e;return o.jsx(Nf,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:c,required:i,onCheckedChange:u,name:n,form:f,value:l,internal_do_not_use_render:({isFormControl:h})=>o.jsxs(o.Fragment,{children:[o.jsx(_c,{...d,ref:t,__scopeCheckbox:r}),h&&o.jsx(jc,{__scopeCheckbox:r})]})})});za.displayName=ws;var Sc="CheckboxIndicator",kc=C.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,a=Va(Sc,r);return o.jsx(Cr,{present:n||ir(a.checked)||a.checked===!0,children:o.jsx(Ie.span,{"data-state":Dc(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});kc.displayName=Sc;var Cc="CheckboxBubbleInput",jc=C.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:a,defaultChecked:i,required:c,disabled:l,name:u,value:f,form:d,bubbleInput:h,setBubbleInput:m}=Va(Cc,e),b=ct(r,m),g=pf(a),y=bc(n);C.useEffect(()=>{const v=h;if(!v)return;const _=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(_,"checked").set,k=!s.current;if(g!==a&&S){const j=new Event("click",{bubbles:k});v.indeterminate=ir(a),S.call(v,ir(a)?!1:a),v.dispatchEvent(j)}},[h,g,a,s]);const x=C.useRef(ir(a)?!1:a);return o.jsx(Ie.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:c,disabled:l,name:u,value:f,form:d,...t,tabIndex:-1,ref:b,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});jc.displayName=Cc;function Ef(e){return typeof e=="function"}function ir(e){return e==="indeterminate"}function Dc(e){return ir(e)?"indeterminate":e?"checked":"unchecked"}const hn=C.forwardRef(({className:e,...t},r)=>o.jsx(za,{ref:r,className:de("peer h-ui-checkbox w-ui-checkbox shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(kc,{className:de("flex items-center justify-center text-current"),children:o.jsx(ye.Check,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})}));hn.displayName=za.displayName;function Ne(e,t,r){const n=t||void 0;switch(r){case"header":return new Intl.DateTimeFormat(n,{year:"numeric",month:"short"}).format(e);case"picker":return new Intl.DateTimeFormat(n,{year:"numeric",month:"short",day:"numeric"}).format(e);case"weekday":{const s=new Intl.DateTimeFormat(n,{weekday:"short"}).format(e);return n?.startsWith("ja")?`(${s})`:new Intl.DateTimeFormat(n,{weekday:"long"}).format(e)}case"weekdayShort":return new Intl.DateTimeFormat(n,{weekday:"short"}).format(e);case"day":return new Intl.NumberFormat(n).format(e.getDate());case"monthDayShort":return new Intl.DateTimeFormat(n,{month:"short",day:"numeric",weekday:"short"}).format(e);case"compact":return new Intl.DateTimeFormat(n,{month:"numeric",day:"numeric",weekday:"short"}).format(e);case"time":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric"}).format(e);case"timeWithSeconds":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",second:"numeric"}).format(e);case"timeWithMs":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3}).format(e);case"minute":return new Intl.DateTimeFormat(n,{minute:"numeric"}).format(e);case"second":return new Intl.DateTimeFormat(n,{second:"numeric"}).format(e);case"time12":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",hour12:!0}).format(e);case"time24":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",hour12:!1}).format(e);case"year":return new Intl.DateTimeFormat(n,{year:"numeric"}).format(e);case"month":return new Intl.DateTimeFormat(n,{month:"long"}).format(e);case"monthShort":return new Intl.DateTimeFormat(n,{month:"short"}).format(e);case"full":{const s=new Intl.DateTimeFormat(n,{year:"numeric",month:"long",day:"numeric"}).format(e),a=new Intl.DateTimeFormat(n,{weekday:"short"}).format(e);return n?.startsWith("ja")?`${s}(${a})`:new Intl.DateTimeFormat(n,{year:"numeric",month:"long",day:"numeric",weekday:"long"}).format(e)}case"yearMonth":return new Intl.DateTimeFormat(n,{year:"numeric",month:"long"}).format(e);case"monthDay":return new Intl.DateTimeFormat(n,{month:"long",day:"numeric"}).format(e);default:return e.toLocaleDateString(n)}}const Af={loading:"Loading",today_button:"Today",previous:"Previous",next:"Next",view_day:"Day",view_week:"Week",view_month:"Month",days_short_sun:"Sun",days_short_mon:"Mon",days_short_tue:"Tue",days_short_wed:"Wed",days_short_thu:"Thu",days_short_fri:"Fri",days_short_sat:"Sat",user_name_label:"User Name",name_placeholder:"Enter name",attendee_label:"Attendee",attendee_placeholder:"Enter attendee name",resource_label:"Resource",resource_placeholder:"Select resource",start_time_label:"Start Time",duration_label:"Duration",status_label:"Status",note_label:"Notes",delete_button:"Delete",cancel_button:"Cancel",save_button:"Save",confirm_delete_title:"Delete Event",confirm_delete_message:"Are you sure you want to delete this event?",event_edit_title:"Edit Event",event_create_title:"Create Event",facility_prompt_group_name:"Enter group name",facility_confirm_delete_group_message:"Delete this group?",facility_prompt_resource_name:"Enter resource name",facility_confirm_delete_resource_message:"Delete this resource?",close:"Close",facility_settings_title:"Facility Settings",facility_label_group_name:"Group",facility_label_resource_name:"Resource",facility_action_add_group:"Add Group",facility_action_add_resource:"Add Resource",facility_label_no_groups:"No groups",facility_action_done:"Done",settings_title:"Settings",settings_language:"Language",settings_theme:"Theme",option_light:"Light",option_dark:"Dark",settings_density:"Density",option_compact:"Compact",option_normal:"Normal",option_spacious:"Spacious",settings_radius:"Radius",settings_font_size:"Font Size",settings_week_start:"Week Starts On",option_sunday:"Sunday",option_monday:"Monday",settings_business_hours:"Business Hours",settings_closed_days:"Closed Days",settings_pagination:"Facility Pagination",settings_page_size:"Items per page",page:"Page",previousPage:"Previous Page",nextPage:"Next Page",day_cell:"Day cell",event_custom_edit_title:"Edit Event",event_custom_create_title:"Create Event",event_name_label:"Event Name",event_name_placeholder:"Enter event name",usage_label:"Usage",usage_placeholder:"Select usage",all_day:"All day",date_time_label:"Date & Time",attendee_self:"Only me",date_picker_label:"Select date",personnel_list_title:"職員一覧",personnel_search_placeholder:"Search by name or email...",personnel_priority_high:"High Priority",personnel_priority_normal:"Normal",personnel_priority_low:"Low Priority",personnel_no_results:"No matching personnel found",personnel_all_departments:"All Departments",personnel_selected_count:"{{count}} selected",personnel_context_hint:"Right-click to set priority",keypad_title_number:"Enter number",keypad_title_phone:"Enter phone number",keypad_title_time:"Enter time",keypad_error_max_length:"Up to {{max}} characters",keypad_error_hyphen_repeat:"Hyphen cannot be repeated",keypad_error_decimal_repeat:"Only one decimal point is allowed",keypad_error_time_invalid:"Enter a valid 4-digit time (e.g., 0930)",keypad_error_value_required:"Please enter a value",keypad_error_decimal_end:"Value cannot end with a decimal point",keypad_error_hyphen_end:"Value cannot end with a hyphen"};function Le(){const{t:e,i18n:t}=Da.useTranslation();return{t:(n,s)=>{const a=typeof s=="string"?{defaultValue:s}:s??{},i=a.defaultValue??Af[n]??n;return e(n,{...a,defaultValue:i})},i18n:t}}function jr(e,t){const r=new Date(e);return r.setDate(r.getDate()+t),r}function Tf(e,t){return jr(e,t*7)}function Ha(e,t){const r=new Date(e),n=r.getMonth()+t;return r.setMonth(n),r.getMonth()!==(n%12+12)%12&&r.setDate(0),r}function Rf(e,t){return Ha(e,-1)}function dt(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function Pf(e){const t=new Date(e);return t.setHours(23,59,59,999),t}function pa(e){const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Nc(e){const t=new Date(e);return t.setMonth(t.getMonth()+1),t.setDate(0),t.setHours(23,59,59,999),t}function cn(e,t){const r=t?.weekStartsOn??0,n=new Date(e),s=n.getDay(),a=(s<r?7:0)+s-r;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}function ga(e,t){const r=cn(e,t),n=jr(r,6);return n.setHours(23,59,59,999),n}function pr(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Mf(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function ti(e,t){const r=e.getTime();return r>=t.start.getTime()&&r<=t.end.getTime()}function Ec(e,t){return e.start.getTime()<t.end.getTime()&&t.start.getTime()<e.end.getTime()}function ri(e){const t=dt(e.start),n=dt(e.end).getTime(),s=[],a=new Date(t);for(;a.getTime()<=n;)s.push(new Date(a)),a.setDate(a.getDate()+1);return s}function Of(e){const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`}function Ac(e){const t=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0");return`${t}:${r}`}function Or(e){return`${Of(e)}T${Ac(e)}`}function ni({className:e,locale:t,mode:r="single",selected:n,onSelect:s,disabled:a,numberOfMonths:i=1,defaultMonth:c}){const[l,u]=C.useState(c||(n instanceof Date?n:n?.from)||new Date),f=C.useRef(n);C.useEffect(()=>{if(n!==f.current){const k=n instanceof Date?n:n?.from;k&&u(pa(k)),f.current=n}},[n]);const d=k=>{if(!a)return!1;const j=dt(k);return Array.isArray(a)?a.some(E=>E instanceof Date?pr(j,dt(E)):typeof E=="object"&&"before"in E&&E.before?j.getTime()<dt(E.before).getTime():typeof E=="object"&&"after"in E&&E.after?j.getTime()>dt(E.after).getTime():!1):a instanceof Date?pr(j,dt(a)):typeof a=="function"?a(k):!1},h=k=>{if(!n)return!1;if(r==="single"&&n instanceof Date)return pr(k,n);if(r==="range"&&n.from){const j=n;if(j.from&&pr(k,j.from)||j.to&&pr(k,j.to))return!0;if(j.from&&j.to)return ti(k,{start:j.from,end:j.to})}return!1},m=k=>{let j=!1,E=!1,I=!1;if(r==="range"&&n?.from){const M=n;M.from&&pr(k,M.from)&&(j=!0),M.to&&pr(k,M.to)&&(E=!0),M.from&&M.to&&ti(k,{start:M.from,end:M.to})&&(I=!0)}return de(on({variant:"ghost"}),"p-ui font-normal aria-selected:opacity-100",h(k)&&"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",I&&!j&&!E&&"bg-accent text-accent-foreground rounded-none",j&&"bg-primary text-primary-foreground rounded-l-md rounded-r-none",E&&"bg-primary text-primary-foreground rounded-l-none rounded-r-md",r==="single"&&h(k)&&"rounded-md",!Mf(k,l)&&"text-muted-foreground opacity-50",d(k)&&"text-muted-foreground opacity-50 cursor-not-allowed")},b=k=>{if(!d(k)){if(r==="single")s?.(k);else if(r==="range"){const j=n||{from:void 0,to:void 0};!j.from||j.from&&j.to?s?.({from:k,to:void 0}):k<j.from?s?.({from:k,to:void 0}):s?.({from:j.from,to:k})}}},g=()=>u(k=>Ha(new Date(k),1)),y=()=>u(k=>Rf(new Date(k))),x=pa(l),v=Nc(x),_=cn(x),w=ga(v),S=ri({start:_,end:w});return o.jsxs("div",{className:de("p-ui flex flex-col gap-y-ui",e),children:[o.jsxs("div",{className:"flex items-center justify-between gap-x-ui",children:[o.jsx("button",{type:"button",onClick:y,"aria-label":"Go to previous month",className:de(on({variant:"outline"}),"bg-transparent p-ui hover:bg-accent hover:text-accent-foreground"),children:o.jsx(ye.ChevronLeft,{className:"h-ui-icon w-ui-icon",strokeWidth:3})}),o.jsx("div",{className:"font-medium text-ui",children:Ne(l,t,"header")}),o.jsx("button",{type:"button",onClick:g,"aria-label":"Go to next month",className:de(on({variant:"outline"}),"bg-transparent p-ui hover:bg-accent hover:text-accent-foreground"),children:o.jsx(ye.ChevronRight,{className:"h-ui-icon w-ui-icon",strokeWidth:3})})]}),o.jsxs("table",{className:"w-full border-collapse space-y-[var(--ui-space-1)]",children:[o.jsx("thead",{children:o.jsx("tr",{children:ri({start:cn(l),end:ga(cn(l))}).map(k=>{const j=k.getDay(),E=j===0,I=j===6;return o.jsx("th",{className:de("rounded-md font-normal text-[0.8rem]",E&&"text-red-500",I&&"text-blue-500",!E&&!I&&"text-muted-foreground"),children:o.jsx("div",{className:"flex justify-center items-center p-ui",children:Ne(k,t,"weekdayShort")})},k.getTime())})})}),o.jsx("tbody",{children:Array.from({length:Math.ceil(S.length/7)}).map((k,j)=>{const E=S.slice(j*7,(j+1)*7);return o.jsx("tr",{className:"w-full",children:E.map(I=>o.jsx("td",{className:"p-[var(--ui-space-0)] text-center relative focus-within:relative",children:o.jsx("button",{type:"button",onClick:()=>b(I),className:m(I),disabled:d(I),children:Ne(I,t,"day")})},I.getTime()))},E[0]?.getTime()||j)})})]})]})}function Wr(e){const t=C.useRef(e);return C.useEffect(()=>{t.current=e}),C.useMemo(()=>(...r)=>t.current?.(...r),[])}function If(e,t=globalThis?.document){const r=Wr(e);C.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var $f="DismissableLayer",va="dismissableLayer.update",Ff="dismissableLayer.pointerDownOutside",Lf="dismissableLayer.focusOutside",si,Tc=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ba=C.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:i,onDismiss:c,...l}=e,u=C.useContext(Tc),[f,d]=C.useState(null),h=f?.ownerDocument??globalThis?.document,[,m]=C.useState({}),b=ct(t,j=>d(j)),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(y),v=f?g.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,w=v>=x,S=Hf(j=>{const E=j.target,I=[...u.branches].some(M=>M.contains(E));!w||I||(s?.(j),i?.(j),j.defaultPrevented||c?.())},h),k=Bf(j=>{const E=j.target;[...u.branches].some(M=>M.contains(E))||(a?.(j),i?.(j),j.defaultPrevented||c?.())},h);return If(j=>{v===u.layers.size-1&&(n?.(j),!j.defaultPrevented&&c&&(j.preventDefault(),c()))},h),C.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(si=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),ai(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=si)}},[f,h,r,u]),C.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),ai())},[f,u]),C.useEffect(()=>{const j=()=>m({});return document.addEventListener(va,j),()=>document.removeEventListener(va,j)},[]),o.jsx(Ie.div,{...l,ref:b,style:{pointerEvents:_?w?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,S.onPointerDownCapture)})});Ba.displayName=$f;var Vf="DismissableLayerBranch",zf=C.forwardRef((e,t)=>{const r=C.useContext(Tc),n=C.useRef(null),s=ct(t,n);return C.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),o.jsx(Ie.div,{...e,ref:s})});zf.displayName=Vf;function Hf(e,t=globalThis?.document){const r=Wr(e),n=C.useRef(!1),s=C.useRef(()=>{});return C.useEffect(()=>{const a=c=>{if(c.target&&!n.current){let l=function(){Rc(Ff,r,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=l,t.addEventListener("click",s.current,{once:!0})):l()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Bf(e,t=globalThis?.document){const r=Wr(e),n=C.useRef(!1);return C.useEffect(()=>{const s=a=>{a.target&&!n.current&&Rc(Lf,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function ai(){const e=new CustomEvent(va);document.dispatchEvent(e)}function Rc(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Cf(s,a):s.dispatchEvent(a)}var Ws=0;function Pc(){C.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??oi()),document.body.insertAdjacentElement("beforeend",e[1]??oi()),Ws++,()=>{Ws===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ws--}},[])}function oi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Us="focusScope.autoFocusOnMount",Zs="focusScope.autoFocusOnUnmount",ii={bubbles:!1,cancelable:!0},Wf="FocusScope",Wa=C.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...i}=e,[c,l]=C.useState(null),u=Wr(s),f=Wr(a),d=C.useRef(null),h=ct(t,g=>l(g)),m=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(n){let g=function(_){if(m.paused||!c)return;const w=_.target;c.contains(w)?d.current=w:nr(d.current,{select:!0})},y=function(_){if(m.paused||!c)return;const w=_.relatedTarget;w!==null&&(c.contains(w)||nr(d.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const S of _)S.removedNodes.length>0&&nr(c)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const v=new MutationObserver(x);return c&&v.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),v.disconnect()}}},[n,c,m.paused]),C.useEffect(()=>{if(c){li.add(m);const g=document.activeElement;if(!c.contains(g)){const x=new CustomEvent(Us,ii);c.addEventListener(Us,u),c.dispatchEvent(x),x.defaultPrevented||(Uf(Xf(Mc(c)),{select:!0}),document.activeElement===g&&nr(c))}return()=>{c.removeEventListener(Us,u),setTimeout(()=>{const x=new CustomEvent(Zs,ii);c.addEventListener(Zs,f),c.dispatchEvent(x),x.defaultPrevented||nr(g??document.body,{select:!0}),c.removeEventListener(Zs,f),li.remove(m)},0)}}},[c,u,f,m]);const b=C.useCallback(g=>{if(!r&&!n||m.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(y&&x){const v=g.currentTarget,[_,w]=Zf(v);_&&w?!g.shiftKey&&x===w?(g.preventDefault(),r&&nr(_,{select:!0})):g.shiftKey&&x===_&&(g.preventDefault(),r&&nr(w,{select:!0})):x===v&&g.preventDefault()}},[r,n,m.paused]);return o.jsx(Ie.div,{tabIndex:-1,...i,ref:h,onKeyDown:b})});Wa.displayName=Wf;function Uf(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(nr(n,{select:t}),document.activeElement!==r)return}function Zf(e){const t=Mc(e),r=ci(t,e),n=ci(t.reverse(),e);return[r,n]}function Mc(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function ci(e,t){for(const r of e)if(!Yf(r,{upTo:t}))return r}function Yf(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Gf(e){return e instanceof HTMLInputElement&&"select"in e}function nr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Gf(e)&&t&&e.select()}}var li=qf();function qf(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=ui(e,t),e.unshift(t)},remove(t){e=ui(e,t),e[0]?.resume()}}}function ui(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Xf(e){return e.filter(t=>t.tagName!=="A")}var Kf=C[" useId ".trim().toString()]||(()=>{}),Jf=0;function zn(e){const[t,r]=C.useState(Kf());return lr(()=>{r(n=>n??String(Jf++))},[e]),e||(t?`radix-${t}`:"")}const Qf=["top","right","bottom","left"],ur=Math.min,st=Math.max,ns=Math.round,On=Math.floor,Ft=e=>({x:e,y:e}),eh={left:"right",right:"left",bottom:"top",top:"bottom"},th={start:"end",end:"start"};function ya(e,t,r){return st(e,ur(t,r))}function Gt(e,t){return typeof e=="function"?e(t):e}function qt(e){return e.split("-")[0]}function Yr(e){return e.split("-")[1]}function Ua(e){return e==="x"?"y":"x"}function Za(e){return e==="y"?"height":"width"}const rh=new Set(["top","bottom"]);function Rt(e){return rh.has(qt(e))?"y":"x"}function Ya(e){return Ua(Rt(e))}function nh(e,t,r){r===void 0&&(r=!1);const n=Yr(e),s=Ya(e),a=Za(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=ss(i)),[i,ss(i)]}function sh(e){const t=ss(e);return[xa(e),t,xa(t)]}function xa(e){return e.replace(/start|end/g,t=>th[t])}const di=["left","right"],fi=["right","left"],ah=["top","bottom"],oh=["bottom","top"];function ih(e,t,r){switch(e){case"top":case"bottom":return r?t?fi:di:t?di:fi;case"left":case"right":return t?ah:oh;default:return[]}}function ch(e,t,r,n){const s=Yr(e);let a=ih(qt(e),r==="start",n);return s&&(a=a.map(i=>i+"-"+s),t&&(a=a.concat(a.map(xa)))),a}function ss(e){return e.replace(/left|right|bottom|top/g,t=>eh[t])}function lh(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oc(e){return typeof e!="number"?lh(e):{top:e,right:e,bottom:e,left:e}}function as(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function hi(e,t,r){let{reference:n,floating:s}=e;const a=Rt(t),i=Ya(t),c=Za(i),l=qt(t),u=a==="y",f=n.x+n.width/2-s.width/2,d=n.y+n.height/2-s.height/2,h=n[c]/2-s[c]/2;let m;switch(l){case"top":m={x:f,y:n.y-s.height};break;case"bottom":m={x:f,y:n.y+n.height};break;case"right":m={x:n.x+n.width,y:d};break;case"left":m={x:n.x-s.width,y:d};break;default:m={x:n.x,y:n.y}}switch(Yr(t)){case"start":m[i]-=h*(r&&u?-1:1);break;case"end":m[i]+=h*(r&&u?-1:1);break}return m}const uh=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:a=[],platform:i}=r,c=a.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:d}=hi(u,n,l),h=n,m={},b=0;for(let g=0;g<c.length;g++){const{name:y,fn:x}=c[g],{x:v,y:_,data:w,reset:S}=await x({x:f,y:d,initialPlacement:n,placement:h,strategy:s,middlewareData:m,rects:u,platform:i,elements:{reference:e,floating:t}});f=v??f,d=_??d,m={...m,[y]:{...m[y],...w}},S&&b<=50&&(b++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(u=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:f,y:d}=hi(u,h,l)),g=-1)}return{x:f,y:d,placement:h,strategy:s,middlewareData:m}};async function mn(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:a,rects:i,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=Gt(t,e),b=Oc(m),y=c[h?d==="floating"?"reference":"floating":d],x=as(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(y)))==null||r?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:u,rootBoundary:f,strategy:l})),v=d==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,_=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),w=await(a.isElement==null?void 0:a.isElement(_))?await(a.getScale==null?void 0:a.getScale(_))||{x:1,y:1}:{x:1,y:1},S=as(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:_,strategy:l}):v);return{top:(x.top-S.top+b.top)/w.y,bottom:(S.bottom-x.bottom+b.bottom)/w.y,left:(x.left-S.left+b.left)/w.x,right:(S.right-x.right+b.right)/w.x}}const dh=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:a,platform:i,elements:c,middlewareData:l}=t,{element:u,padding:f=0}=Gt(e,t)||{};if(u==null)return{};const d=Oc(f),h={x:r,y:n},m=Ya(s),b=Za(m),g=await i.getDimensions(u),y=m==="y",x=y?"top":"left",v=y?"bottom":"right",_=y?"clientHeight":"clientWidth",w=a.reference[b]+a.reference[m]-h[m]-a.floating[b],S=h[m]-a.reference[m],k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=k?k[_]:0;(!j||!await(i.isElement==null?void 0:i.isElement(k)))&&(j=c.floating[_]||a.floating[b]);const E=w/2-S/2,I=j/2-g[b]/2-1,M=ur(d[x],I),H=ur(d[v],I),N=M,F=j-g[b]-H,A=j/2-g[b]/2+E,V=ya(N,A,F),O=!l.arrow&&Yr(s)!=null&&A!==V&&a.reference[b]/2-(A<N?M:H)-g[b]/2<0,P=O?A<N?A-N:A-F:0;return{[m]:h[m]+P,data:{[m]:V,centerOffset:A-V-P,...O&&{alignmentOffset:P}},reset:O}}}),fh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:a,rects:i,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...y}=Gt(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const x=qt(s),v=Rt(c),_=qt(c)===c,w=await(l.isRTL==null?void 0:l.isRTL(u.floating)),S=h||(_||!g?[ss(c)]:sh(c)),k=b!=="none";!h&&k&&S.push(...ch(c,g,b,w));const j=[c,...S],E=await mn(t,y),I=[];let M=((n=a.flip)==null?void 0:n.overflows)||[];if(f&&I.push(E[x]),d){const A=nh(s,i,w);I.push(E[A[0]],E[A[1]])}if(M=[...M,{placement:s,overflows:I}],!I.every(A=>A<=0)){var H,N;const A=(((H=a.flip)==null?void 0:H.index)||0)+1,V=j[A];if(V&&(!(d==="alignment"?v!==Rt(V):!1)||M.every(R=>Rt(R.placement)===v?R.overflows[0]>0:!0)))return{data:{index:A,overflows:M},reset:{placement:V}};let O=(N=M.filter(P=>P.overflows[0]<=0).sort((P,R)=>P.overflows[1]-R.overflows[1])[0])==null?void 0:N.placement;if(!O)switch(m){case"bestFit":{var F;const P=(F=M.filter(R=>{if(k){const B=Rt(R.placement);return B===v||B==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(B=>B>0).reduce((B,z)=>B+z,0)]).sort((R,B)=>R[1]-B[1])[0])==null?void 0:F[0];P&&(O=P);break}case"initialPlacement":O=c;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function mi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pi(e){return Qf.some(t=>e[t]>=0)}const hh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=Gt(e,t);switch(n){case"referenceHidden":{const a=await mn(t,{...s,elementContext:"reference"}),i=mi(a,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:pi(i)}}}case"escaped":{const a=await mn(t,{...s,altBoundary:!0}),i=mi(a,r.floating);return{data:{escapedOffsets:i,escaped:pi(i)}}}default:return{}}}}},Ic=new Set(["left","top"]);async function mh(e,t){const{placement:r,platform:n,elements:s}=e,a=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=qt(r),c=Yr(r),l=Rt(r)==="y",u=Ic.has(i)?-1:1,f=a&&l?-1:1,d=Gt(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof b=="number"&&(m=c==="end"?b*-1:b),l?{x:m*f,y:h*u}:{x:h*u,y:m*f}}const ph=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:a,placement:i,middlewareData:c}=t,l=await mh(t,e);return i===((r=c.offset)==null?void 0:r.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:s+l.x,y:a+l.y,data:{...l,placement:i}}}}},gh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:c={fn:y=>{let{x,y:v}=y;return{x,y:v}}},...l}=Gt(e,t),u={x:r,y:n},f=await mn(t,l),d=Rt(qt(s)),h=Ua(d);let m=u[h],b=u[d];if(a){const y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",v=m+f[y],_=m-f[x];m=ya(v,m,_)}if(i){const y=d==="y"?"top":"left",x=d==="y"?"bottom":"right",v=b+f[y],_=b-f[x];b=ya(v,b,_)}const g=c.fn({...t,[h]:m,[d]:b});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[h]:a,[d]:i}}}}}},vh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:a,middlewareData:i}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Gt(e,t),f={x:r,y:n},d=Rt(s),h=Ua(d);let m=f[h],b=f[d];const g=Gt(c,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const _=h==="y"?"height":"width",w=a.reference[h]-a.floating[_]+y.mainAxis,S=a.reference[h]+a.reference[_]-y.mainAxis;m<w?m=w:m>S&&(m=S)}if(u){var x,v;const _=h==="y"?"width":"height",w=Ic.has(qt(s)),S=a.reference[d]-a.floating[_]+(w&&((x=i.offset)==null?void 0:x[d])||0)+(w?0:y.crossAxis),k=a.reference[d]+a.reference[_]+(w?0:((v=i.offset)==null?void 0:v[d])||0)-(w?y.crossAxis:0);b<S?b=S:b>k&&(b=k)}return{[h]:m,[d]:b}}}},yh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:a,platform:i,elements:c}=t,{apply:l=()=>{},...u}=Gt(e,t),f=await mn(t,u),d=qt(s),h=Yr(s),m=Rt(s)==="y",{width:b,height:g}=a.floating;let y,x;d==="top"||d==="bottom"?(y=d,x=h===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(x=d,y=h==="end"?"top":"bottom");const v=g-f.top-f.bottom,_=b-f.left-f.right,w=ur(g-f[y],v),S=ur(b-f[x],_),k=!t.middlewareData.shift;let j=w,E=S;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(E=_),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(j=v),k&&!h){const M=st(f.left,0),H=st(f.right,0),N=st(f.top,0),F=st(f.bottom,0);m?E=b-2*(M!==0||H!==0?M+H:st(f.left,f.right)):j=g-2*(N!==0||F!==0?N+F:st(f.top,f.bottom))}await l({...t,availableWidth:E,availableHeight:j});const I=await i.getDimensions(c.floating);return b!==I.width||g!==I.height?{reset:{rects:!0}}:{}}}};function _s(){return typeof window<"u"}function Gr(e){return $c(e)?(e.nodeName||"").toLowerCase():"#document"}function it(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function zt(e){var t;return(t=($c(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $c(e){return _s()?e instanceof Node||e instanceof it(e).Node:!1}function wt(e){return _s()?e instanceof Element||e instanceof it(e).Element:!1}function Vt(e){return _s()?e instanceof HTMLElement||e instanceof it(e).HTMLElement:!1}function gi(e){return!_s()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof it(e).ShadowRoot}const xh=new Set(["inline","contents"]);function wn(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=_t(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!xh.has(s)}const bh=new Set(["table","td","th"]);function wh(e){return bh.has(Gr(e))}const _h=[":popover-open",":modal"];function Ss(e){return _h.some(t=>{try{return e.matches(t)}catch{return!1}})}const Sh=["transform","translate","scale","rotate","perspective"],kh=["transform","translate","scale","rotate","perspective","filter"],Ch=["paint","layout","strict","content"];function Ga(e){const t=qa(),r=wt(e)?_t(e):e;return Sh.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||kh.some(n=>(r.willChange||"").includes(n))||Ch.some(n=>(r.contain||"").includes(n))}function jh(e){let t=dr(e);for(;Vt(t)&&!Ur(t);){if(Ga(t))return t;if(Ss(t))return null;t=dr(t)}return null}function qa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Dh=new Set(["html","body","#document"]);function Ur(e){return Dh.has(Gr(e))}function _t(e){return it(e).getComputedStyle(e)}function ks(e){return wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dr(e){if(Gr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gi(e)&&e.host||zt(e);return gi(t)?t.host:t}function Fc(e){const t=dr(e);return Ur(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&wn(t)?t:Fc(t)}function pn(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Fc(e),a=s===((n=e.ownerDocument)==null?void 0:n.body),i=it(s);if(a){const c=ba(i);return t.concat(i,i.visualViewport||[],wn(s)?s:[],c&&r?pn(c):[])}return t.concat(s,pn(s,[],r))}function ba(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Lc(e){const t=_t(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=Vt(e),a=s?e.offsetWidth:r,i=s?e.offsetHeight:n,c=ns(r)!==a||ns(n)!==i;return c&&(r=a,n=i),{width:r,height:n,$:c}}function Xa(e){return wt(e)?e:e.contextElement}function Ir(e){const t=Xa(e);if(!Vt(t))return Ft(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:a}=Lc(t);let i=(a?ns(r.width):r.width)/n,c=(a?ns(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Nh=Ft(0);function Vc(e){const t=it(e);return!qa()||!t.visualViewport?Nh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Eh(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==it(e)?!1:t}function _r(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),a=Xa(e);let i=Ft(1);t&&(n?wt(n)&&(i=Ir(n)):i=Ir(e));const c=Eh(a,r,n)?Vc(a):Ft(0);let l=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,f=s.width/i.x,d=s.height/i.y;if(a){const h=it(a),m=n&&wt(n)?it(n):n;let b=h,g=ba(b);for(;g&&n&&m!==b;){const y=Ir(g),x=g.getBoundingClientRect(),v=_t(g),_=x.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,w=x.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,u*=y.y,f*=y.x,d*=y.y,l+=_,u+=w,b=it(g),g=ba(b)}}return as({width:f,height:d,x:l,y:u})}function Cs(e,t){const r=ks(e).scrollLeft;return t?t.left+r:_r(zt(e)).left+r}function zc(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-Cs(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function Ah(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const a=s==="fixed",i=zt(n),c=t?Ss(t.floating):!1;if(n===i||c&&a)return r;let l={scrollLeft:0,scrollTop:0},u=Ft(1);const f=Ft(0),d=Vt(n);if((d||!d&&!a)&&((Gr(n)!=="body"||wn(i))&&(l=ks(n)),Vt(n))){const m=_r(n);u=Ir(n),f.x=m.x+n.clientLeft,f.y=m.y+n.clientTop}const h=i&&!d&&!a?zc(i,l):Ft(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+f.x+h.x,y:r.y*u.y-l.scrollTop*u.y+f.y+h.y}}function Th(e){return Array.from(e.getClientRects())}function Rh(e){const t=zt(e),r=ks(e),n=e.ownerDocument.body,s=st(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=st(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Cs(e);const c=-r.scrollTop;return _t(n).direction==="rtl"&&(i+=st(t.clientWidth,n.clientWidth)-s),{width:s,height:a,x:i,y:c}}const vi=25;function Ph(e,t){const r=it(e),n=zt(e),s=r.visualViewport;let a=n.clientWidth,i=n.clientHeight,c=0,l=0;if(s){a=s.width,i=s.height;const f=qa();(!f||f&&t==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}const u=Cs(n);if(u<=0){const f=n.ownerDocument,d=f.body,h=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,b=Math.abs(n.clientWidth-d.clientWidth-m);b<=vi&&(a-=b)}else u<=vi&&(a+=u);return{width:a,height:i,x:c,y:l}}const Mh=new Set(["absolute","fixed"]);function Oh(e,t){const r=_r(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,a=Vt(e)?Ir(e):Ft(1),i=e.clientWidth*a.x,c=e.clientHeight*a.y,l=s*a.x,u=n*a.y;return{width:i,height:c,x:l,y:u}}function yi(e,t,r){let n;if(t==="viewport")n=Ph(e,r);else if(t==="document")n=Rh(zt(e));else if(wt(t))n=Oh(t,r);else{const s=Vc(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return as(n)}function Hc(e,t){const r=dr(e);return r===t||!wt(r)||Ur(r)?!1:_t(r).position==="fixed"||Hc(r,t)}function Ih(e,t){const r=t.get(e);if(r)return r;let n=pn(e,[],!1).filter(c=>wt(c)&&Gr(c)!=="body"),s=null;const a=_t(e).position==="fixed";let i=a?dr(e):e;for(;wt(i)&&!Ur(i);){const c=_t(i),l=Ga(i);!l&&c.position==="fixed"&&(s=null),(a?!l&&!s:!l&&c.position==="static"&&!!s&&Mh.has(s.position)||wn(i)&&!l&&Hc(e,i))?n=n.filter(f=>f!==i):s=c,i=dr(i)}return t.set(e,n),n}function $h(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?Ss(t)?[]:Ih(t,this._c):[].concat(r),n],c=i[0],l=i.reduce((u,f)=>{const d=yi(t,f,s);return u.top=st(d.top,u.top),u.right=ur(d.right,u.right),u.bottom=ur(d.bottom,u.bottom),u.left=st(d.left,u.left),u},yi(t,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Fh(e){const{width:t,height:r}=Lc(e);return{width:t,height:r}}function Lh(e,t,r){const n=Vt(t),s=zt(t),a=r==="fixed",i=_r(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const l=Ft(0);function u(){l.x=Cs(s)}if(n||!n&&!a)if((Gr(t)!=="body"||wn(s))&&(c=ks(t)),n){const m=_r(t,!0,a,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else s&&u();a&&!n&&s&&u();const f=s&&!n&&!a?zc(s,c):Ft(0),d=i.left+c.scrollLeft-l.x-f.x,h=i.top+c.scrollTop-l.y-f.y;return{x:d,y:h,width:i.width,height:i.height}}function Ys(e){return _t(e).position==="static"}function xi(e,t){if(!Vt(e)||_t(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return zt(e)===r&&(r=r.ownerDocument.body),r}function Bc(e,t){const r=it(e);if(Ss(e))return r;if(!Vt(e)){let s=dr(e);for(;s&&!Ur(s);){if(wt(s)&&!Ys(s))return s;s=dr(s)}return r}let n=xi(e,t);for(;n&&wh(n)&&Ys(n);)n=xi(n,t);return n&&Ur(n)&&Ys(n)&&!Ga(n)?r:n||jh(e)||r}const Vh=async function(e){const t=this.getOffsetParent||Bc,r=this.getDimensions,n=await r(e.floating);return{reference:Lh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function zh(e){return _t(e).direction==="rtl"}const Hh={convertOffsetParentRelativeRectToViewportRelativeRect:Ah,getDocumentElement:zt,getClippingRect:$h,getOffsetParent:Bc,getElementRects:Vh,getClientRects:Th,getDimensions:Fh,getScale:Ir,isElement:wt,isRTL:zh};function Wc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bh(e,t){let r=null,n;const s=zt(e);function a(){var c;clearTimeout(n),(c=r)==null||c.disconnect(),r=null}function i(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),a();const u=e.getBoundingClientRect(),{left:f,top:d,width:h,height:m}=u;if(c||t(),!h||!m)return;const b=On(d),g=On(s.clientWidth-(f+h)),y=On(s.clientHeight-(d+m)),x=On(f),_={rootMargin:-b+"px "+-g+"px "+-y+"px "+-x+"px",threshold:st(0,ur(1,l))||1};let w=!0;function S(k){const j=k[0].intersectionRatio;if(j!==l){if(!w)return i();j?i(!1,j):n=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!Wc(u,e.getBoundingClientRect())&&i(),w=!1}try{r=new IntersectionObserver(S,{..._,root:s.ownerDocument})}catch{r=new IntersectionObserver(S,_)}r.observe(e)}return i(!0),a}function Wh(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,u=Xa(e),f=s||a?[...u?pn(u):[],...pn(t)]:[];f.forEach(x=>{s&&x.addEventListener("scroll",r,{passive:!0}),a&&x.addEventListener("resize",r)});const d=u&&c?Bh(u,r):null;let h=-1,m=null;i&&(m=new ResizeObserver(x=>{let[v]=x;v&&v.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=m)==null||_.observe(t)})),r()}),u&&!l&&m.observe(u),m.observe(t));let b,g=l?_r(e):null;l&&y();function y(){const x=_r(e);g&&!Wc(g,x)&&r(),g=x,b=requestAnimationFrame(y)}return r(),()=>{var x;f.forEach(v=>{s&&v.removeEventListener("scroll",r),a&&v.removeEventListener("resize",r)}),d?.(),(x=m)==null||x.disconnect(),m=null,l&&cancelAnimationFrame(b)}}const Uh=ph,Zh=gh,Yh=fh,Gh=yh,qh=hh,bi=dh,Xh=vh,Kh=(e,t,r)=>{const n=new Map,s={platform:Hh,...r},a={...s.platform,_c:n};return uh(e,t,{...s,platform:a})};var Jh=typeof document<"u",Qh=function(){},Hn=Jh?p.useLayoutEffect:Qh;function os(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!os(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const a=s[n];if(!(a==="_owner"&&e.$$typeof)&&!os(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Uc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wi(e,t){const r=Uc(e);return Math.round(t*r)/r}function Gs(e){const t=C.useRef(e);return Hn(()=>{t.current=e}),t}function em(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:a,floating:i}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[f,d]=C.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=C.useState(n);os(h,n)||m(n);const[b,g]=C.useState(null),[y,x]=C.useState(null),v=C.useCallback(R=>{R!==k.current&&(k.current=R,g(R))},[]),_=C.useCallback(R=>{R!==j.current&&(j.current=R,x(R))},[]),w=a||b,S=i||y,k=C.useRef(null),j=C.useRef(null),E=C.useRef(f),I=l!=null,M=Gs(l),H=Gs(s),N=Gs(u),F=C.useCallback(()=>{if(!k.current||!j.current)return;const R={placement:t,strategy:r,middleware:h};H.current&&(R.platform=H.current),Kh(k.current,j.current,R).then(B=>{const z={...B,isPositioned:N.current!==!1};A.current&&!os(E.current,z)&&(E.current=z,Ki.flushSync(()=>{d(z)}))})},[h,t,r,H,N]);Hn(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[u]);const A=C.useRef(!1);Hn(()=>(A.current=!0,()=>{A.current=!1}),[]),Hn(()=>{if(w&&(k.current=w),S&&(j.current=S),w&&S){if(M.current)return M.current(w,S,F);F()}},[w,S,F,M,I]);const V=C.useMemo(()=>({reference:k,floating:j,setReference:v,setFloating:_}),[v,_]),O=C.useMemo(()=>({reference:w,floating:S}),[w,S]),P=C.useMemo(()=>{const R={position:r,left:0,top:0};if(!O.floating)return R;const B=wi(O.floating,f.x),z=wi(O.floating,f.y);return c?{...R,transform:"translate("+B+"px, "+z+"px)",...Uc(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:B,top:z}},[r,c,O.floating,f.x,f.y]);return C.useMemo(()=>({...f,update:F,refs:V,elements:O,floatingStyles:P}),[f,F,V,O,P])}const tm=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?bi({element:n.current,padding:s}).fn(r):{}:n?bi({element:n,padding:s}).fn(r):{}}}},rm=(e,t)=>({...Uh(e),options:[e,t]}),nm=(e,t)=>({...Zh(e),options:[e,t]}),sm=(e,t)=>({...Xh(e),options:[e,t]}),am=(e,t)=>({...Yh(e),options:[e,t]}),om=(e,t)=>({...Gh(e),options:[e,t]}),im=(e,t)=>({...qh(e),options:[e,t]}),cm=(e,t)=>({...tm(e),options:[e,t]});var lm="Arrow",Zc=C.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...a}=e;return o.jsx(Ie.svg,{...a,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Zc.displayName=lm;var um=Zc,Ka="Popper",[Yc,Gc]=bs(Ka),[dm,qc]=Yc(Ka),Xc=e=>{const{__scopePopper:t,children:r}=e,[n,s]=C.useState(null);return o.jsx(dm,{scope:t,anchor:n,onAnchorChange:s,children:r})};Xc.displayName=Ka;var Kc="PopperAnchor",Jc=C.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,a=qc(Kc,r),i=C.useRef(null),c=ct(t,i),l=C.useRef(null);return C.useEffect(()=>{const u=l.current;l.current=n?.current||i.current,u!==l.current&&a.onAnchorChange(l.current)}),n?null:o.jsx(Ie.div,{...s,ref:c})});Jc.displayName=Kc;var Ja="PopperContent",[fm,hm]=Yc(Ja),Qc=C.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:a="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:b,...g}=e,y=qc(Ja,r),[x,v]=C.useState(null),_=ct(t,fe=>v(fe)),[w,S]=C.useState(null),k=bc(w),j=k?.width??0,E=k?.height??0,I=n+(a!=="center"?"-"+a:""),M=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},H=Array.isArray(u)?u:[u],N=H.length>0,F={padding:M,boundary:H.filter(pm),altBoundary:N},{refs:A,floatingStyles:V,placement:O,isPositioned:P,middlewareData:R}=em({strategy:"fixed",placement:I,whileElementsMounted:(...fe)=>Wh(...fe,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[rm({mainAxis:s+E,alignmentAxis:i}),l&&nm({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?sm():void 0,...F}),l&&am({...F}),om({...F,apply:({elements:fe,rects:pe,availableWidth:Ae,availableHeight:xe})=>{const{width:Ze,height:Ye}=pe.reference,Xe=fe.floating.style;Xe.setProperty("--radix-popper-available-width",`${Ae}px`),Xe.setProperty("--radix-popper-available-height",`${xe}px`),Xe.setProperty("--radix-popper-anchor-width",`${Ze}px`),Xe.setProperty("--radix-popper-anchor-height",`${Ye}px`)}}),w&&cm({element:w,padding:c}),gm({arrowWidth:j,arrowHeight:E}),h&&im({strategy:"referenceHidden",...F})]}),[B,z]=rl(O),J=Wr(b);lr(()=>{P&&J?.()},[P,J]);const G=R.arrow?.x,L=R.arrow?.y,W=R.arrow?.centerOffset!==0,[se,ne]=C.useState();return lr(()=>{x&&ne(window.getComputedStyle(x).zIndex)},[x]),o.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:P?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(" "),...R.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(fm,{scope:r,placedSide:B,onArrowChange:S,arrowX:G,arrowY:L,shouldHideArrow:W,children:o.jsx(Ie.div,{"data-side":B,"data-align":z,...g,ref:_,style:{...g.style,animation:P?void 0:"none"}})})})});Qc.displayName=Ja;var el="PopperArrow",mm={top:"bottom",right:"left",bottom:"top",left:"right"},tl=C.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,a=hm(el,n),i=mm[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:o.jsx(um,{...s,ref:r,style:{...s.style,display:"block"}})})});tl.displayName=el;function pm(e){return e!==null}var gm=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[u,f]=rl(r),d={start:"0%",center:"50%",end:"100%"}[f],h=(s.arrow?.x??0)+c/2,m=(s.arrow?.y??0)+l/2;let b="",g="";return u==="bottom"?(b=i?d:`${h}px`,g=`${-l}px`):u==="top"?(b=i?d:`${h}px`,g=`${n.floating.height+l}px`):u==="right"?(b=`${-l}px`,g=i?d:`${m}px`):u==="left"&&(b=`${n.floating.width+l}px`,g=i?d:`${m}px`),{data:{x:b,y:g}}}});function rl(e){const[t,r="center"]=e.split("-");return[t,r]}var vm=Xc,nl=Jc,ym=Qc,xm=tl,bm="Portal",Qa=C.forwardRef((e,t)=>{const{container:r,...n}=e,[s,a]=C.useState(!1);lr(()=>a(!0),[]);const i=r||s&&globalThis?.document?.body;return i?gr.createPortal(o.jsx(Ie.div,{...n,ref:t}),i):null});Qa.displayName=bm;var wm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Er=new WeakMap,In=new WeakMap,$n={},qs=0,sl=function(e){return e&&(e.host||sl(e.parentNode))},_m=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=sl(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Sm=function(e,t,r,n){var s=_m(t,Array.isArray(e)?e:[e]);$n[r]||($n[r]=new WeakMap);var a=$n[r],i=[],c=new Set,l=new Set(s),u=function(d){!d||c.has(d)||(c.add(d),u(d.parentNode))};s.forEach(u);var f=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(h){if(c.has(h))f(h);else try{var m=h.getAttribute(n),b=m!==null&&m!=="false",g=(Er.get(h)||0)+1,y=(a.get(h)||0)+1;Er.set(h,g),a.set(h,y),i.push(h),g===1&&b&&In.set(h,!0),y===1&&h.setAttribute(r,"true"),b||h.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return f(t),c.clear(),qs++,function(){i.forEach(function(d){var h=Er.get(d)-1,m=a.get(d)-1;Er.set(d,h),a.set(d,m),h||(In.has(d)||d.removeAttribute(n),In.delete(d)),m||d.removeAttribute(r)}),qs--,qs||(Er=new WeakMap,Er=new WeakMap,In=new WeakMap,$n={})}},al=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=wm(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Sm(n,s,r,"aria-hidden")):function(){return null}},Et=function(){return Et=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Et.apply(this,arguments)};function ol(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function km(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var Bn="right-scroll-bar-position",Wn="width-before-scroll-bar",Cm="with-scroll-bars-hidden",jm="--removed-body-scroll-bar-size";function Xs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Dm(e,t){var r=p.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Nm=typeof window<"u"?C.useLayoutEffect:C.useEffect,_i=new WeakMap;function Em(e,t){var r=Dm(null,function(n){return e.forEach(function(s){return Xs(s,n)})});return Nm(function(){var n=_i.get(r);if(n){var s=new Set(n),a=new Set(e),i=r.current;s.forEach(function(c){a.has(c)||Xs(c,null)}),a.forEach(function(c){s.has(c)||Xs(c,i)})}_i.set(r,e)},[e]),r}function Am(e){return e}function Tm(e,t){t===void 0&&(t=Am);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var i=t(a,n);return r.push(i),function(){r=r.filter(function(c){return c!==i})}},assignSyncMedium:function(a){for(n=!0;r.length;){var i=r;r=[],i.forEach(a)}r={push:function(c){return a(c)},filter:function(){return r}}},assignMedium:function(a){n=!0;var i=[];if(r.length){var c=r;r=[],c.forEach(a),i=r}var l=function(){var f=i;i=[],f.forEach(a)},u=function(){return Promise.resolve().then(l)};u(),r={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),r}}}};return s}function Rm(e){e===void 0&&(e={});var t=Tm(null);return t.options=Et({async:!0,ssr:!1},e),t}var il=function(e){var t=e.sideCar,r=ol(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return C.createElement(n,Et({},r))};il.isSideCarExport=!0;function Pm(e,t){return e.useMedium(t),il}var cl=Rm(),Ks=function(){},js=C.forwardRef(function(e,t){var r=C.useRef(null),n=C.useState({onScrollCapture:Ks,onWheelCapture:Ks,onTouchMoveCapture:Ks}),s=n[0],a=n[1],i=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,f=e.enabled,d=e.shards,h=e.sideCar,m=e.noRelative,b=e.noIsolation,g=e.inert,y=e.allowPinchZoom,x=e.as,v=x===void 0?"div":x,_=e.gapMode,w=ol(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,k=Em([r,t]),j=Et(Et({},w),s);return C.createElement(C.Fragment,null,f&&C.createElement(S,{sideCar:cl,removeScrollBar:u,shards:d,noRelative:m,noIsolation:b,inert:g,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:_}),i?C.cloneElement(C.Children.only(c),Et(Et({},j),{ref:k})):C.createElement(v,Et({},j,{className:l,ref:k}),c))});js.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};js.classNames={fullWidth:Wn,zeroRight:Bn};var Mm=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Om(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Mm();return t&&e.setAttribute("nonce",t),e}function Im(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $m(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Fm=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Om())&&(Im(t,r),$m(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Lm=function(){var e=Fm();return function(t,r){C.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},ll=function(){var e=Lm(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},Vm={left:0,top:0,right:0,gap:0},Js=function(e){return parseInt(e||"",10)||0},zm=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Js(r),Js(n),Js(s)]},Hm=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Vm;var t=zm(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Bm=ll(),$r="data-scroll-locked",Wm=function(e,t,r,n){var s=e.left,a=e.top,i=e.right,c=e.gap;return r===void 0&&(r="margin"),`
|
|
2
|
-
.`.concat(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),m=require("react"),vr=require("react-dom"),Oa=require("react-i18next");function dc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const j=dc(m),fc=dc(vr);function hc(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=hc(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function mc(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=hc(e))&&(n&&(n+=" "),n+=t);return n}function de(...e){return mc(e)}const ye={Spinner:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:de("animate-spin",e),...n,role:"presentation",children:o.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})},Check:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})})},X:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})},ChevronLeft:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("path",{d:"M15 18l-6-6 6-6"})})},ChevronRight:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("path",{d:"M9 18l6-6-6-6"})})},ChevronDown:({className:e,...t})=>{const{role:r,...n}=t;return o.jsx("svg",{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",className:e,...n,role:"presentation",children:o.jsx("path",{d:"M6 9l6 6 6-6"})})},Calendar:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),o.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),o.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),o.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})},Plus:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})},Edit:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),o.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})},Trash:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("polyline",{points:"3 6 5 6 21 6"}),o.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})},AlertTriangle:({className:e,...t})=>{const{role:r,...n}=t;return o.jsxs("svg",{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",className:e,...n,role:"presentation",children:[o.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),o.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}},bt=j.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:de("flex w-full rounded-md border border-input bg-background px-ui py-ui text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));bt.displayName="Input";function Ia({value:e=[],onChange:t,personnel:r,placeholder:n,className:s,disabled:a=!1}){const[i,c]=m.useState(!1),[l,u]=m.useState(""),[f,d]=m.useState(-1),h=m.useRef(null),p=m.useMemo(()=>{if(!l||!r)return[];const v=l.toLowerCase();return v.length<1?[]:r.filter(k=>e.some(w=>w.personnelId===k.id)?!1:k.name.toLowerCase().includes(v)||k.department?.toLowerCase().includes(v)).slice(0,5)},[l,r,e]);m.useEffect(()=>{d(-1),c(p.length>0)},[p]);const b=v=>{t([...e,v]),u(""),c(!1),h.current?.focus()},g=v=>{const k=[...e];k.splice(v,1),t(k)},y=v=>{if(!v.nativeEvent.isComposing){if(i&&p.length>0){if(v.key==="ArrowDown"){v.preventDefault(),d(k=>k===-1?0:(k+1)%p.length);return}else if(v.key==="ArrowUp"){v.preventDefault(),d(k=>k===-1?p.length-1:(k-1+p.length)%p.length);return}}if(v.key==="Enter")if(v.preventDefault(),f>=0&&p[f]){const k=p[f];b({name:k.name,email:k.email||"",personnelId:k.id,type:"personnel"})}else l.trim().length>0&&b({name:l.trim(),type:"external"});else v.key==="Backspace"&&l===""&&e.length>0?g(e.length-1):v.key==="Escape"&&c(!1)}},x=()=>{setTimeout(()=>{c(!1)},200)};return o.jsxs("div",{className:de("flex flex-wrap items-center gap-ui px-ui py-[calc(var(--ui-component-padding-y)/2)] border rounded-md bg-background focus-within:ring-2 ring-ring ring-offset-2 border-input min-h-ui",s),children:[e.map((v,k)=>o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-1)] bg-secondary text-secondary-foreground px-[var(--ui-space-2)] py-[var(--ui-space-1)] rounded text-sm group",children:[o.jsx("span",{children:v.name}),!a&&o.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),g(k)},className:"text-muted-foreground group-hover:text-destructive transition-colors",children:o.jsx(ye.X,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})]},v.personnelId??v.email??`${v.type}-${v.name}`)),o.jsxs("div",{className:"relative flex-1 min-w-[var(--ui-space-30)]",children:[o.jsx(bt,{ref:h,value:l,onChange:v=>u(v.target.value),onKeyDown:y,onFocus:()=>{p.length>0&&c(!0)},onBlur:x,placeholder:e.length===0?n:"",disabled:a,className:de("border-0 focus-visible:ring-0 px-[var(--ui-space-0)] h-auto py-[var(--ui-space-1)] shadow-none bg-transparent",a&&"cursor-not-allowed text-muted-foreground"),autoComplete:"off"}),i&&p.length>0&&o.jsx("div",{className:"absolute top-full left-[var(--ui-space-0)] z-50 w-full min-w-[var(--ui-space-50)] mt-[var(--ui-space-1)] bg-popover text-popover-foreground border border-border rounded-md shadow-md overflow-hidden animate-in fade-in-0 zoom-in-95",children:p.map((v,k)=>o.jsxs("button",{type:"button",className:de("px-ui py-ui text-sm cursor-pointer flex justify-between items-center",k===f?"bg-accent text-accent-foreground":"hover:bg-accent hover:text-accent-foreground"),onClick:w=>{w.preventDefault(),w.stopPropagation(),b({name:v.name,email:v.email||"",personnelId:v.id,type:"personnel"})},onMouseEnter:()=>d(k),children:[o.jsx("span",{className:"font-medium",children:v.name}),v.department&&o.jsx("span",{className:"text-xs text-muted-foreground ml-[var(--ui-space-2)]",children:v.department})]},v.id))})]})]})}var bn=e=>e.type==="checkbox",yr=e=>e instanceof Date,Ye=e=>e==null;const pc=e=>typeof e=="object";var Ee=e=>!Ye(e)&&!Array.isArray(e)&&pc(e)&&!yr(e),gc=e=>Ee(e)&&e.target?bn(e.target)?e.target.checked:e.target.value:e,Cd=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,vc=(e,t)=>e.has(Cd(t)),Dd=e=>{const t=e.constructor&&e.constructor.prototype;return Ee(t)&&t.hasOwnProperty("isPrototypeOf")},$a=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Te(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if($a&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Ee(e)&&Dd(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Te(e[s]));return n}var bs=e=>/^\w*$/.test(e),Se=e=>e===void 0,Fa=e=>Array.isArray(e)?e.filter(Boolean):[],La=e=>Fa(e.replace(/["|']|\]/g,"").split(/\.|\[/)),K=(e,t,r)=>{if(!t||!Ee(e))return r;const n=(bs(t)?[t]:La(t)).reduce((s,a)=>Ye(s)?s:s[a],e);return Se(n)||n===e?Se(e[t])?r:e[t]:n},rt=e=>typeof e=="boolean",He=e=>typeof e=="function",ge=(e,t,r)=>{let n=-1;const s=bs(t)?[t]:La(t),a=s.length,i=a-1;for(;++n<a;){const c=s[n];let l=r;if(n!==i){const u=e[c];l=Ee(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;e[c]=l,e=e[c]}};const Gn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},yt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Wt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Va=m.createContext(null);Va.displayName="HookFormContext";const ws=()=>m.useContext(Va),Nd=e=>{const{children:t,...r}=e;return m.createElement(Va.Provider,{value:r},t)};var yc=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(s,a,{get:()=>{const i=a;return t._proxyFormState[i]!==yt.all&&(t._proxyFormState[i]=!n||yt.all),r&&(r[i]=!0),e[i]}});return s};const za=typeof window<"u"?m.useLayoutEffect:m.useEffect;function Ed(e){const t=ws(),{control:r=t.control,disabled:n,name:s,exact:a}=e||{},[i,c]=m.useState(r._formState),l=m.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return za(()=>r._subscribe({name:s,formState:l.current,exact:a,callback:u=>{!n&&c({...r._formState,...u})}}),[s,n,a]),m.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),m.useMemo(()=>yc(i,r,l.current,!1),[i,r])}var ot=e=>typeof e=="string",ca=(e,t,r,n,s)=>ot(e)?(n&&t.watch.add(e),K(r,e,s)):Array.isArray(e)?e.map(a=>(n&&t.watch.add(a),K(r,a))):(n&&(t.watchAll=!0),r),la=e=>Ye(e)||!pc(e);function xt(e,t,r=new WeakSet){if(la(e)||la(t))return Object.is(e,t);if(yr(e)&&yr(t))return e.getTime()===t.getTime();const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const a of n){const i=e[a];if(!s.includes(a))return!1;if(a!=="ref"){const c=t[a];if(yr(i)&&yr(c)||Ee(i)&&Ee(c)||Array.isArray(i)&&Array.isArray(c)?!xt(i,c,r):!Object.is(i,c))return!1}}return!0}function Ad(e){const t=ws(),{control:r=t.control,name:n,defaultValue:s,disabled:a,exact:i,compute:c}=e||{},l=m.useRef(s),u=m.useRef(c),f=m.useRef(void 0),d=m.useRef(r),h=m.useRef(n);u.current=c;const[p,b]=m.useState(()=>{const w=r._getWatch(n,l.current);return u.current?u.current(w):w}),g=m.useCallback(w=>{const S=ca(n,r._names,w||r._formValues,!1,l.current);return u.current?u.current(S):S},[r._formValues,r._names,n]),y=m.useCallback(w=>{if(!a){const S=ca(n,r._names,w||r._formValues,!1,l.current);if(u.current){const C=u.current(S);xt(C,f.current)||(b(C),f.current=C)}else b(S)}},[r._formValues,r._names,a,n]);za(()=>((d.current!==r||!xt(h.current,n))&&(d.current=r,h.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:w=>{y(w.values)}})),[r,i,n,y]),m.useEffect(()=>r._removeUnmounted());const x=d.current!==r,v=h.current,k=m.useMemo(()=>{if(a)return null;const w=!x&&!xt(v,n);return x||w?g():null},[a,x,n,v,g]);return k!==null?k:p}function Td(e){const t=ws(),{name:r,disabled:n,control:s=t.control,shouldUnregister:a,defaultValue:i,exact:c=!0}=e,l=vc(s._names.array,r),u=m.useMemo(()=>K(s._formValues,r,K(s._defaultValues,r,i)),[s,r,i]),f=Ad({control:s,name:r,defaultValue:u,exact:c}),d=Ed({control:s,name:r,exact:c}),h=m.useRef(e),p=m.useRef(void 0),b=m.useRef(s.register(r,{...e.rules,value:f,...rt(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const g=m.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!K(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!K(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!K(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!K(d.validatingFields,r)},error:{enumerable:!0,get:()=>K(d.errors,r)}}),[d,r]),y=m.useCallback(w=>b.current.onChange({target:{value:gc(w),name:r},type:Gn.CHANGE}),[r]),x=m.useCallback(()=>b.current.onBlur({target:{value:K(s._formValues,r),name:r},type:Gn.BLUR}),[r,s._formValues]),v=m.useCallback(w=>{const S=K(s._fields,r);S&&S._f&&w&&(S._f.ref={focus:()=>He(w.focus)&&w.focus(),select:()=>He(w.select)&&w.select(),setCustomValidity:C=>He(w.setCustomValidity)&&w.setCustomValidity(C),reportValidity:()=>He(w.reportValidity)&&w.reportValidity()})},[s._fields,r]),k=m.useMemo(()=>({name:r,value:f,...rt(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:y,onBlur:x,ref:v}),[r,n,d.disabled,y,x,v,f]);return m.useEffect(()=>{const w=s._options.shouldUnregister||a,S=p.current;S&&S!==r&&!l&&s.unregister(S),s.register(r,{...h.current.rules,...rt(h.current.disabled)?{disabled:h.current.disabled}:{}});const C=(_,N)=>{const I=K(s._fields,_);I&&I._f&&(I._f.mount=N)};if(C(r,!0),w){const _=Te(K(s._options.defaultValues,r,h.current.defaultValue));ge(s._defaultValues,r,_),Se(K(s._formValues,r))&&ge(s._formValues,r,_)}return!l&&s.register(r),p.current=r,()=>{(l?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,l,a]),m.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),m.useMemo(()=>({field:k,formState:d,fieldState:g}),[k,d,g])}const Rd=e=>e.render(Td(e));var xc=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},sn=e=>Array.isArray(e)?e:[e],Fo=()=>{let e=[];return{get observers(){return e},next:s=>{for(const a of e)a.next&&a.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(a=>a!==s)}}),unsubscribe:()=>{e=[]}}};function bc(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],a=t[n];if(s&&Ee(s)&&a){const i=bc(s,a);Ee(i)&&(r[n]=i)}else e[n]&&(r[n]=a)}return r}var ze=e=>Ee(e)&&!Object.keys(e).length,Ha=e=>e.type==="file",Yn=e=>{if(!$a)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},wc=e=>e.type==="select-multiple",Ba=e=>e.type==="radio",Md=e=>Ba(e)||bn(e),Zs=e=>Yn(e)&&e.isConnected;function Pd(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Se(e)?n++:e[t[n++]];return e}function Od(e){for(const t in e)if(e.hasOwnProperty(t)&&!Se(e[t]))return!1;return!0}function je(e,t){const r=Array.isArray(t)?t:bs(t)?[t]:La(t),n=r.length===1?e:Pd(e,r),s=r.length-1,a=r[s];return n&&delete n[a],s!==0&&(Ee(n)&&ze(n)||Array.isArray(n)&&Od(n))&&je(e,r.slice(0,-1)),e}var Id=e=>{for(const t in e)if(He(e[t]))return!0;return!1};function _c(e){return Array.isArray(e)||Ee(e)&&!Id(e)}function ua(e,t={}){for(const r in e){const n=e[r];_c(n)?(t[r]=Array.isArray(n)?[]:{},ua(n,t[r])):Se(n)||(t[r]=!0)}return t}function Mr(e,t,r){r||(r=ua(t));for(const n in e){const s=e[n];if(_c(s))Se(t)||la(r[n])?r[n]=ua(s,Array.isArray(s)?[]:{}):Mr(s,Ye(t)?{}:t[n],r[n]);else{const a=t[n];r[n]=!xt(s,a)}}return r}const Lo={value:!1,isValid:!1},Vo={value:!0,isValid:!0};var Sc=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Se(e[0].attributes.value)?Se(e[0].value)||e[0].value===""?Vo:{value:e[0].value,isValid:!0}:Vo:Lo}return Lo},kc=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Se(e)?e:t?e===""?NaN:e&&+e:r&&ot(e)?new Date(e):n?n(e):e;const zo={isValid:!1,value:null};var jc=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,zo):zo;function Ho(e){const t=e.ref;return Ha(t)?t.files:Ba(t)?jc(e.refs).value:wc(t)?[...t.selectedOptions].map(({value:r})=>r):bn(t)?Sc(e.refs).value:kc(Se(t.value)?e.ref.value:t.value,e)}var $d=(e,t,r,n)=>{const s={};for(const a of e){const i=K(t,a);i&&ge(s,a,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Kn=e=>e instanceof RegExp,rn=e=>Se(e)?e:Kn(e)?e.source:Ee(e)?Kn(e.value)?e.value.source:e.value:e,Bo=e=>({isOnSubmit:!e||e===yt.onSubmit,isOnBlur:e===yt.onBlur,isOnChange:e===yt.onChange,isOnAll:e===yt.all,isOnTouch:e===yt.onTouched});const Wo="AsyncFunction";var Fd=e=>!!e&&!!e.validate&&!!(He(e.validate)&&e.validate.constructor.name===Wo||Ee(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Wo)),Ld=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Uo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const an=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const a=K(e,s);if(a){const{_f:i,...c}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(an(c,t))break}else if(Ee(c)&&an(c,t))break}}};function Zo(e,t,r){const n=K(e,r);if(n||bs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const a=s.join("."),i=K(t,a),c=K(e,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(c&&c.type)return{name:a,error:c};if(c&&c.root&&c.root.type)return{name:`${a}.root`,error:c.root};s.pop()}return{name:r}}var Vd=(e,t,r,n)=>{r(e);const{name:s,...a}=e;return ze(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!n||yt.all))},zd=(e,t,r)=>!e||!t||e===t||sn(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Hd=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,Bd=(e,t)=>!Fa(K(e,t)).length&&je(e,t),Wd=(e,t,r)=>{const n=sn(K(e,r));return ge(n,"root",t[r]),ge(e,r,n),e};function Go(e,t,r="validate"){if(ot(e)||Array.isArray(e)&&e.every(ot)||rt(e)&&!e)return{type:r,message:ot(e)?e:"",ref:t}}var Nr=e=>Ee(e)&&!Kn(e)?e:{value:e,message:""},Yo=async(e,t,r,n,s,a)=>{const{ref:i,refs:c,required:l,maxLength:u,minLength:f,min:d,max:h,pattern:p,validate:b,name:g,valueAsNumber:y,mount:x}=e._f,v=K(r,g);if(!x||t.has(g))return{};const k=c?c[0]:i,w=E=>{s&&k.reportValidity&&(k.setCustomValidity(rt(E)?"":E||""),k.reportValidity())},S={},C=Ba(i),_=bn(i),N=C||_,I=(y||Ha(i))&&Se(i.value)&&Se(v)||Yn(i)&&i.value===""||v===""||Array.isArray(v)&&!v.length,M=xc.bind(null,g,n,S),B=(E,F,T,$=Wt.maxLength,O=Wt.minLength)=>{const A=E?F:T;S[g]={type:E?$:O,message:A,ref:i,...M(E?$:O,A)}};if(a?!Array.isArray(v)||!v.length:l&&(!N&&(I||Ye(v))||rt(v)&&!v||_&&!Sc(c).isValid||C&&!jc(c).isValid)){const{value:E,message:F}=ot(l)?{value:!!l,message:l}:Nr(l);if(E&&(S[g]={type:Wt.required,message:F,ref:k,...M(Wt.required,F)},!n))return w(F),S}if(!I&&(!Ye(d)||!Ye(h))){let E,F;const T=Nr(h),$=Nr(d);if(!Ye(v)&&!isNaN(v)){const O=i.valueAsNumber||v&&+v;Ye(T.value)||(E=O>T.value),Ye($.value)||(F=O<$.value)}else{const O=i.valueAsDate||new Date(v),A=H=>new Date(new Date().toDateString()+" "+H),R=i.type=="time",V=i.type=="week";ot(T.value)&&v&&(E=R?A(v)>A(T.value):V?v>T.value:O>new Date(T.value)),ot($.value)&&v&&(F=R?A(v)<A($.value):V?v<$.value:O<new Date($.value))}if((E||F)&&(B(!!E,T.message,$.message,Wt.max,Wt.min),!n))return w(S[g].message),S}if((u||f)&&!I&&(ot(v)||a&&Array.isArray(v))){const E=Nr(u),F=Nr(f),T=!Ye(E.value)&&v.length>+E.value,$=!Ye(F.value)&&v.length<+F.value;if((T||$)&&(B(T,E.message,F.message),!n))return w(S[g].message),S}if(p&&!I&&ot(v)){const{value:E,message:F}=Nr(p);if(Kn(E)&&!v.match(E)&&(S[g]={type:Wt.pattern,message:F,ref:i,...M(Wt.pattern,F)},!n))return w(F),S}if(b){if(He(b)){const E=await b(v,r),F=Go(E,k);if(F&&(S[g]={...F,...M(Wt.validate,F.message)},!n))return w(F.message),S}else if(Ee(b)){let E={};for(const F in b){if(!ze(E)&&!n)break;const T=Go(await b[F](v,r),k,F);T&&(E={...T,...M(F,T.message)},w(T.message),n&&(S[g]=E))}if(!ze(E)&&(S[g]={ref:k,...E},!n))return S}}return w(!0),S};const Ud={mode:yt.onSubmit,reValidateMode:yt.onChange,shouldFocusError:!0};function Zd(e={}){let t={...Ud,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:He(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Ee(t.defaultValues)||Ee(t.values)?Te(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Te(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...f};let h={...d};const p={array:Fo(),state:Fo()},b=t.criteriaMode===yt.all,g=D=>P=>{clearTimeout(u),u=setTimeout(D,P)},y=async D=>{if(!i.keepIsValid&&!t.disabled&&(d.isValid||h.isValid||D)){let P;t.resolver?(P=ze((await N()).errors),x()):P=await M(n,!0),P!==r.isValid&&p.state.next({isValid:P})}},x=(D,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||h.isValidating||h.validatingFields)&&((D||Array.from(c.mount)).forEach(L=>{L&&(P?ge(r.validatingFields,L,P):je(r.validatingFields,L))}),p.state.next({validatingFields:r.validatingFields,isValidating:!ze(r.validatingFields)}))},v=(D,P=[],L,X,G=!0,Z=!0)=>{if(X&&L&&!t.disabled){if(i.action=!0,Z&&Array.isArray(K(n,D))){const te=L(K(n,D),X.argA,X.argB);G&&ge(n,D,te)}if(Z&&Array.isArray(K(r.errors,D))){const te=L(K(r.errors,D),X.argA,X.argB);G&&ge(r.errors,D,te),Bd(r.errors,D)}if((d.touchedFields||h.touchedFields)&&Z&&Array.isArray(K(r.touchedFields,D))){const te=L(K(r.touchedFields,D),X.argA,X.argB);G&&ge(r.touchedFields,D,te)}(d.dirtyFields||h.dirtyFields)&&(r.dirtyFields=Mr(s,a)),p.state.next({name:D,isDirty:E(D,P),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ge(a,D,P)},k=(D,P)=>{ge(r.errors,D,P),p.state.next({errors:r.errors})},w=D=>{r.errors=D,p.state.next({errors:r.errors,isValid:!1})},S=(D,P,L,X)=>{const G=K(n,D);if(G){const Z=K(a,D,Se(L)?K(s,D):L);Se(Z)||X&&X.defaultChecked||P?ge(a,D,P?Z:Ho(G._f)):$(D,Z),i.mount&&!i.action&&y()}},C=(D,P,L,X,G)=>{let Z=!1,te=!1;const le={name:D};if(!t.disabled){if(!L||X){(d.isDirty||h.isDirty)&&(te=r.isDirty,r.isDirty=le.isDirty=E(),Z=te!==le.isDirty);const he=xt(K(s,D),P);te=!!K(r.dirtyFields,D),he?je(r.dirtyFields,D):ge(r.dirtyFields,D,!0),le.dirtyFields=r.dirtyFields,Z=Z||(d.dirtyFields||h.dirtyFields)&&te!==!he}if(L){const he=K(r.touchedFields,D);he||(ge(r.touchedFields,D,L),le.touchedFields=r.touchedFields,Z=Z||(d.touchedFields||h.touchedFields)&&he!==L)}Z&&G&&p.state.next(le)}return Z?le:{}},_=(D,P,L,X)=>{const G=K(r.errors,D),Z=(d.isValid||h.isValid)&&rt(P)&&r.isValid!==P;if(t.delayError&&L?(l=g(()=>k(D,L)),l(t.delayError)):(clearTimeout(u),l=null,L?ge(r.errors,D,L):je(r.errors,D)),(L?!xt(G,L):G)||!ze(X)||Z){const te={...X,...Z&&rt(P)?{isValid:P}:{},errors:r.errors,name:D};r={...r,...te},p.state.next(te)}},N=async D=>(x(D,!0),await t.resolver(a,t.context,$d(D||c.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),I=async D=>{const{errors:P}=await N(D);if(x(D),D)for(const L of D){const X=K(P,L);X?ge(r.errors,L,X):je(r.errors,L)}else r.errors=P;return P},M=async(D,P,L={valid:!0})=>{for(const X in D){const G=D[X];if(G){const{_f:Z,...te}=G;if(Z){const le=c.array.has(Z.name),he=G._f&&Fd(G._f);he&&d.validatingFields&&x([Z.name],!0);const Ve=await Yo(G,c.disabled,a,b,t.shouldUseNativeValidation&&!P,le);if(he&&d.validatingFields&&x([Z.name]),Ve[Z.name]&&(L.valid=!1,P))break;!P&&(K(Ve,Z.name)?le?Wd(r.errors,Ve,Z.name):ge(r.errors,Z.name,Ve[Z.name]):je(r.errors,Z.name))}!ze(te)&&await M(te,P,L)}}return L.valid},B=()=>{for(const D of c.unMount){const P=K(n,D);P&&(P._f.refs?P._f.refs.every(L=>!Zs(L)):!Zs(P._f.ref))&&pe(D)}c.unMount=new Set},E=(D,P)=>!t.disabled&&(D&&P&&ge(a,D,P),!xt(Q(),s)),F=(D,P,L)=>ca(D,c,{...i.mount?a:Se(P)?s:ot(D)?{[D]:P}:P},L,P),T=D=>Fa(K(i.mount?a:s,D,t.shouldUnregister?K(s,D,[]):[])),$=(D,P,L={})=>{const X=K(n,D);let G=P;if(X){const Z=X._f;Z&&(!Z.disabled&&ge(a,D,kc(P,Z)),G=Yn(Z.ref)&&Ye(P)?"":P,wc(Z.ref)?[...Z.ref.options].forEach(te=>te.selected=G.includes(te.value)):Z.refs?bn(Z.ref)?Z.refs.forEach(te=>{(!te.defaultChecked||!te.disabled)&&(Array.isArray(G)?te.checked=!!G.find(le=>le===te.value):te.checked=G===te.value||!!G)}):Z.refs.forEach(te=>te.checked=te.value===G):Ha(Z.ref)?Z.ref.value="":(Z.ref.value=G,Z.ref.type||p.state.next({name:D,values:Te(a)})))}(L.shouldDirty||L.shouldTouch)&&C(D,G,L.shouldTouch,L.shouldDirty,!0),L.shouldValidate&&H(D)},O=(D,P,L)=>{for(const X in P){if(!P.hasOwnProperty(X))return;const G=P[X],Z=D+"."+X,te=K(n,Z);(c.array.has(D)||Ee(G)||te&&!te._f)&&!yr(G)?O(Z,G,L):$(Z,G,L)}},A=(D,P,L={})=>{const X=K(n,D),G=c.array.has(D),Z=Te(P);ge(a,D,Z),G?(p.array.next({name:D,values:Te(a)}),(d.isDirty||d.dirtyFields||h.isDirty||h.dirtyFields)&&L.shouldDirty&&p.state.next({name:D,dirtyFields:Mr(s,a),isDirty:E(D,Z)})):X&&!X._f&&!Ye(Z)?O(D,Z,L):$(D,Z,L),Uo(D,c)&&p.state.next({...r,name:D}),p.state.next({name:i.mount?D:void 0,values:Te(a)})},R=async D=>{i.mount=!0;const P=D.target;let L=P.name,X=!0;const G=K(n,L),Z=he=>{X=Number.isNaN(he)||yr(he)&&isNaN(he.getTime())||xt(he,K(a,L,he))},te=Bo(t.mode),le=Bo(t.reValidateMode);if(G){let he,Ve;const Je=P.type?Ho(G._f):gc(D),vt=D.type===Gn.BLUR||D.type===Gn.FOCUS_OUT,Ws=!Ld(G._f)&&!t.resolver&&!K(r.errors,L)&&!G._f.deps||Hd(vt,K(r.touchedFields,L),r.isSubmitted,le,te),Jr=Uo(L,c,vt);ge(a,L,Je),vt?(!P||!P.readOnly)&&(G._f.onBlur&&G._f.onBlur(D),l&&l(0)):G._f.onChange&&G._f.onChange(D);const pr=C(L,Je,vt),An=!ze(pr)||Jr;if(!vt&&p.state.next({name:L,type:D.type,values:Te(a)}),Ws)return(d.isValid||h.isValid)&&(t.mode==="onBlur"?vt&&y():vt||y()),An&&p.state.next({name:L,...Jr?{}:pr});if(!vt&&Jr&&p.state.next({...r}),t.resolver){const{errors:Tn}=await N([L]);if(x([L]),Z(Je),X){const Rn=Zo(r.errors,n,L),Mn=Zo(Tn,n,Rn.name||L);he=Mn.error,L=Mn.name,Ve=ze(Tn)}}else x([L],!0),he=(await Yo(G,c.disabled,a,b,t.shouldUseNativeValidation))[L],x([L]),Z(Je),X&&(he?Ve=!1:(d.isValid||h.isValid)&&(Ve=await M(n,!0)));X&&(G._f.deps&&(!Array.isArray(G._f.deps)||G._f.deps.length>0)&&H(G._f.deps),_(L,Ve,he,pr))}},V=(D,P)=>{if(K(r.errors,P)&&D.focus)return D.focus(),1},H=async(D,P={})=>{let L,X;const G=sn(D);if(t.resolver){const Z=await I(Se(D)?D:G);L=ze(Z),X=D?!G.some(te=>K(Z,te)):L}else D?(X=(await Promise.all(G.map(async Z=>{const te=K(n,Z);return await M(te&&te._f?{[Z]:te}:te)}))).every(Boolean),!(!X&&!r.isValid)&&y()):X=L=await M(n);return p.state.next({...!ot(D)||(d.isValid||h.isValid)&&L!==r.isValid?{}:{name:D},...t.resolver||!D?{isValid:L}:{},errors:r.errors}),P.shouldFocus&&!X&&an(n,V,D?G:c.mount),X},Q=(D,P)=>{let L={...i.mount?a:s};return P&&(L=bc(P.dirtyFields?r.dirtyFields:r.touchedFields,L)),Se(D)?L:ot(D)?K(L,D):D.map(X=>K(L,X))},Y=(D,P)=>({invalid:!!K((P||r).errors,D),isDirty:!!K((P||r).dirtyFields,D),error:K((P||r).errors,D),isValidating:!!K(r.validatingFields,D),isTouched:!!K((P||r).touchedFields,D)}),z=D=>{D&&sn(D).forEach(P=>je(r.errors,P)),p.state.next({errors:D?r.errors:{}})},W=(D,P,L)=>{const X=(K(n,D,{_f:{}})._f||{}).ref,G=K(r.errors,D)||{},{ref:Z,message:te,type:le,...he}=G;ge(r.errors,D,{...he,...P,ref:X}),p.state.next({name:D,errors:r.errors,isValid:!1}),L&&L.shouldFocus&&X&&X.focus&&X.focus()},se=(D,P)=>He(D)?p.state.subscribe({next:L=>"values"in L&&D(F(void 0,P),L)}):F(D,P,!0),ne=D=>p.state.subscribe({next:P=>{zd(D.name,P.name,D.exact)&&Vd(P,D.formState||d,Nn,D.reRenderRoot)&&D.callback({values:{...a},...r,...P,defaultValues:s})}}).unsubscribe,fe=D=>(i.mount=!0,h={...h,...D.formState},ne({...D,formState:{...f,...D.formState}})),pe=(D,P={})=>{for(const L of D?sn(D):c.mount)c.mount.delete(L),c.array.delete(L),P.keepValue||(je(n,L),je(a,L)),!P.keepError&&je(r.errors,L),!P.keepDirty&&je(r.dirtyFields,L),!P.keepTouched&&je(r.touchedFields,L),!P.keepIsValidating&&je(r.validatingFields,L),!t.shouldUnregister&&!P.keepDefaultValue&&je(s,L);p.state.next({values:Te(a)}),p.state.next({...r,...P.keepDirty?{isDirty:E()}:{}}),!P.keepIsValid&&y()},Ae=({disabled:D,name:P})=>{(rt(D)&&i.mount||D||c.disabled.has(P))&&(D?c.disabled.add(P):c.disabled.delete(P))},xe=(D,P={})=>{let L=K(n,D);const X=rt(P.disabled)||rt(t.disabled);return ge(n,D,{...L||{},_f:{...L&&L._f?L._f:{ref:{name:D}},name:D,mount:!0,...P}}),c.mount.add(D),L?Ae({disabled:rt(P.disabled)?P.disabled:t.disabled,name:D}):S(D,!0,P.value),{...X?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:rn(P.min),max:rn(P.max),minLength:rn(P.minLength),maxLength:rn(P.maxLength),pattern:rn(P.pattern)}:{},name:D,onChange:R,onBlur:R,ref:G=>{if(G){xe(D,P),L=K(n,D);const Z=Se(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,te=Md(Z),le=L._f.refs||[];if(te?le.find(he=>he===Z):Z===L._f.ref)return;ge(n,D,{_f:{...L._f,...te?{refs:[...le.filter(Zs),Z,...Array.isArray(K(s,D))?[{}]:[]],ref:{type:Z.type,name:D}}:{ref:Z}}}),S(D,!1,void 0,Z)}else L=K(n,D,{}),L._f&&(L._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(vc(c.array,D)&&i.action)&&c.unMount.add(D)}}},Ze=()=>t.shouldFocusError&&an(n,V,c.mount),Ge=D=>{rt(D)&&(p.state.next({disabled:D}),an(n,(P,L)=>{const X=K(n,L);X&&(P.disabled=X._f.disabled||D,Array.isArray(X._f.refs)&&X._f.refs.forEach(G=>{G.disabled=X._f.disabled||D}))},0,!1))},qe=(D,P)=>async L=>{let X;L&&(L.preventDefault&&L.preventDefault(),L.persist&&L.persist());let G=Te(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:Z,values:te}=await N();x(),r.errors=Z,G=Te(te)}else await M(n);if(c.disabled.size)for(const Z of c.disabled)je(G,Z);if(je(r.errors,"root"),ze(r.errors)){p.state.next({errors:{}});try{await D(G,L)}catch(Z){X=Z}}else P&&await P({...r.errors},L),Ze(),setTimeout(Ze);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ze(r.errors)&&!X,submitCount:r.submitCount+1,errors:r.errors}),X)throw X},Xe=(D,P={})=>{K(n,D)&&(Se(P.defaultValue)?A(D,Te(K(s,D))):(A(D,P.defaultValue),ge(s,D,Te(P.defaultValue))),P.keepTouched||je(r.touchedFields,D),P.keepDirty||(je(r.dirtyFields,D),r.isDirty=P.defaultValue?E(D,Te(K(s,D))):E()),P.keepError||(je(r.errors,D),d.isValid&&y()),p.state.next({...r}))},jt=(D,P={})=>{const L=D?Te(D):s,X=Te(L),G=ze(D),Z=G?s:X;if(P.keepDefaultValues||(s=L),!P.keepValues){if(P.keepDirtyValues){const te=new Set([...c.mount,...Object.keys(Mr(s,a))]);for(const le of Array.from(te))K(r.dirtyFields,le)?ge(Z,le,K(a,le)):A(le,K(Z,le))}else{if($a&&Se(D))for(const te of c.mount){const le=K(n,te);if(le&&le._f){const he=Array.isArray(le._f.refs)?le._f.refs[0]:le._f.ref;if(Yn(he)){const Ve=he.closest("form");if(Ve){Ve.reset();break}}}}if(P.keepFieldsRef)for(const te of c.mount)A(te,K(Z,te));else n={}}a=t.shouldUnregister?P.keepDefaultValues?Te(s):{}:Te(Z),p.array.next({values:{...Z}}),p.state.next({values:{...Z}})}c={mount:P.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!t.shouldUnregister&&!ze(Z),i.watch=!!t.shouldUnregister,i.keepIsValid=!!P.keepIsValid,i.action=!1,P.keepErrors||(r.errors={}),p.state.next({submitCount:P.keepSubmitCount?r.submitCount:0,isDirty:G?!1:P.keepDirty?r.isDirty:!!(P.keepDefaultValues&&!xt(D,s)),isSubmitted:P.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:G?{}:P.keepDirtyValues?P.keepDefaultValues&&a?Mr(s,a):r.dirtyFields:P.keepDefaultValues&&D?Mr(s,D):P.keepDirty?r.dirtyFields:{},touchedFields:P.keepTouched?r.touchedFields:{},errors:P.keepErrors?r.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},pt=(D,P)=>jt(He(D)?D(a):D,{...t.resetOptions,...P}),Jt=(D,P={})=>{const L=K(n,D),X=L&&L._f;if(X){const G=X.refs?X.refs[0]:X.ref;G.focus&&setTimeout(()=>{G.focus(),P.shouldSelect&&He(G.select)&&G.select()})}},Nn=D=>{r={...r,...D}},gt={control:{register:xe,unregister:pe,getFieldState:Y,handleSubmit:qe,setError:W,_subscribe:ne,_runSchema:N,_updateIsValidating:x,_focusError:Ze,_getWatch:F,_getDirty:E,_setValid:y,_setFieldArray:v,_setDisabledField:Ae,_setErrors:w,_getFieldArray:T,_reset:jt,_resetDefaultValues:()=>He(t.defaultValues)&&t.defaultValues().then(D=>{pt(D,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:B,_disableForm:Ge,_subjects:p,_proxyFormState:d,get _fields(){return n},get _formValues(){return a},get _state(){return i},set _state(D){i=D},get _defaultValues(){return s},get _names(){return c},set _names(D){c=D},get _formState(){return r},get _options(){return t},set _options(D){t={...t,...D}}},subscribe:fe,trigger:H,register:xe,handleSubmit:qe,watch:se,setValue:A,getValues:Q,reset:pt,resetField:Xe,clearErrors:z,unregister:pe,setError:W,setFocus:Jt,getFieldState:Y};return{...gt,formControl:gt}}function Cc(e={}){const t=m.useRef(void 0),r=m.useRef(void 0),[n,s]=m.useState({isDirty:!1,isValidating:!1,isLoading:He(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:He(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!He(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...c}=Zd(e);t.current={...c,formState:n}}const a=t.current.control;return a._options=e,za(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>s({...a._formState}),reRenderRoot:!0});return s(c=>({...c,isReady:!0})),a._formState.isReady=!0,i},[a]),m.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),m.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),m.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),m.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),m.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==n.isDirty&&a._subjects.state.next({isDirty:i})}},[a,n.isDirty]),m.useEffect(()=>{var i;e.values&&!xt(e.values,r.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((i=a._options.resetOptions)===null||i===void 0)&&i.keepIsValid||a._setValid(),r.current=e.values,s(c=>({...c}))):a._resetDefaultValues()},[a,e.values]),m.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=yc(n,a),t.current}const Ko=(e,t,r)=>{if(e&&"reportValidity"in e){const n=K(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Dc=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ko(n.ref,r,e):n.refs&&n.refs.forEach(s=>Ko(s,r,e))}},Gd=(e,t)=>{t.shouldUseNativeValidation&&Dc(e,t);const r={};for(const n in e){const s=K(t.fields,n),a=Object.assign(e[n]||{},{ref:s&&s.ref});if(Yd(t.names||Object.keys(e),n)){const i=Object.assign({},K(r,n));ge(i,"root",a),ge(r,n,i)}else ge(r,n,a)}return r},Yd=(e,t)=>e.some(r=>r.startsWith(t+"."));var Kd=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,a=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var c=n.unionErrors[0].errors[0];r[i]={message:c.message,type:c.code}}else r[i]={message:a,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(f){return f.errors.forEach(function(d){return e.push(d)})}),t){var l=r[i].types,u=l&&l[n.code];r[i]=xc(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Nc=function(e,t,r){return r===void 0&&(r={}),function(n,s,a){try{return Promise.resolve((function(i,c){try{var l=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return a.shouldUseNativeValidation&&Dc({},a),{errors:{},values:r.raw?n:u}})}catch(u){return c(u)}return l&&l.then?l.then(void 0,c):l})(0,function(i){if((function(c){return Array.isArray(c?.errors)})(i))return{values:{},errors:Gd(Kd(i.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw i}))}catch(i){return Promise.reject(i)}}},me;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},e.getValidEnumValues=s=>{const a=e.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),i={};for(const c of a)i[c]=s[c];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(a){return s[a]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},e.find=(s,a)=>{for(const i of s)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(me||(me={}));var qo;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qo||(qo={}));const ee=me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=e=>{switch(typeof e){case"undefined":return ee.undefined;case"string":return ee.string;case"number":return Number.isNaN(e)?ee.nan:ee.number;case"boolean":return ee.boolean;case"function":return ee.function;case"bigint":return ee.bigint;case"symbol":return ee.symbol;case"object":return Array.isArray(e)?ee.array:e===null?ee.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ee.promise:typeof Map<"u"&&e instanceof Map?ee.map:typeof Set<"u"&&e instanceof Set?ee.set:typeof Date<"u"&&e instanceof Date?ee.date:ee.object;default:return ee.unknown}},U=me.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Gt extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let c=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(r(i))):c[u]=c[u]||{_errors:[]},c=c[u],l++}}};return s(this),n}static assert(t){if(!(t instanceof Gt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(t(s))}else n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Gt.create=e=>new Gt(e);const da=(e,t)=>{let r;switch(e.code){case U.invalid_type:e.received===ee.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,me.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:r=`Unrecognized key(s) in object: ${me.joinValues(e.keys,", ")}`;break;case U.invalid_union:r="Invalid input";break;case U.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${me.joinValues(e.options)}`;break;case U.invalid_enum_value:r=`Invalid enum value. Expected ${me.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:r="Invalid function arguments";break;case U.invalid_return_type:r="Invalid function return type";break;case U.invalid_date:r="Invalid date";break;case U.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:me.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case U.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case U.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case U.custom:r="Invalid input";break;case U.invalid_intersection_types:r="Intersection results could not be merged";break;case U.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:r="Number must be finite";break;default:r=t.defaultError,me.assertNever(e)}return{message:r}};let qd=da;function Xd(){return qd}const Jd=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let c="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)c=u(i,{data:t,defaultError:c}).message;return{...s,path:a,message:c}};function J(e,t){const r=Xd(),n=Jd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===da?void 0:da].filter(s=>!!s)});e.common.issues.push(n)}class We{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return ie;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return We.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return ie;a.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:t.value,value:n}}}const ie=Object.freeze({status:"aborted"}),nn=e=>({status:"dirty",value:e}),mt=e=>({status:"valid",value:e}),Xo=e=>e.status==="aborted",Jo=e=>e.status==="dirty",Lr=e=>e.status==="valid",qn=e=>typeof Promise<"u"&&e instanceof Promise;var re;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(re||(re={}));class Lt{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Qo=(e,t)=>{if(Lr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Gt(e.common.issues);return this._error=r,this._error}}};function ce(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,c)=>{const{message:l}=e;return i.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??n??c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:l??r??c.defaultError}},description:s}}class ue{get description(){return this._def.description}_getType(t){return ar(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new We,ctx:{common:t.parent.common,data:t.data,parsedType:ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(qn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)},s=this._parseSync({data:t,path:n.path,parent:n});return Qo(n,s)}"~validate"(t){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)};if(!this["~standard"].async)try{const n=this._parseSync({data:t,path:[],parent:r});return Lr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Lr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)},s=this._parse({data:t,path:n.path,parent:n}),a=await(qn(s)?s:Promise.resolve(s));return Qo(n,a)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=t(s),c=()=>a.addIssue({code:U.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(c(),!1)):i?!0:(c(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new Hr({schema:this,typeName:oe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ir.create(this,this._def)}nullable(){return Br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $t.create(this)}promise(){return ts.create(this,this._def)}or(t){return Jn.create([this,t],this._def)}and(t){return Qn.create(this,t,this._def)}transform(t){return new Hr({...ce(this._def),schema:this,typeName:oe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new ga({...ce(this._def),innerType:this,defaultValue:r,typeName:oe.ZodDefault})}brand(){return new _f({typeName:oe.ZodBranded,type:this,...ce(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new va({...ce(this._def),innerType:this,catchValue:r,typeName:oe.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Wa.create(this,t)}readonly(){return ya.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Qd=/^c[^\s-]{8,}$/i,ef=/^[0-9a-z]+$/,tf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nf=/^[a-z0-9_-]{21}$/i,sf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,af=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,of=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gs;const lf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,uf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,df=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ff=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mf=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ec="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pf=new RegExp(`^${Ec}$`);function Ac(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function gf(e){return new RegExp(`^${Ac(e)}$`)}function vf(e){let t=`${Ec}T${Ac(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function yf(e,t){return!!((t==="v4"||!t)&&lf.test(e)||(t==="v6"||!t)&&df.test(e))}function xf(e,t){if(!sf.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function bf(e,t){return!!((t==="v4"||!t)&&uf.test(e)||(t==="v6"||!t)&&ff.test(e))}class Tt extends ue{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ee.string){const a=this._getOrReturnCtx(t);return J(a,{code:U.invalid_type,expected:ee.string,received:a.parsedType}),ie}const n=new We;let s;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(s=this._getOrReturnCtx(t,s),J(s,{code:U.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(s=this._getOrReturnCtx(t,s),J(s,{code:U.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,c=t.data.length<a.value;(i||c)&&(s=this._getOrReturnCtx(t,s),i?J(s,{code:U.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&J(s,{code:U.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")of.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"email",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Gs||(Gs=new RegExp(cf,"u")),Gs.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"emoji",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")rf.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"uuid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")nf.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"nanoid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Qd.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"cuid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ef.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"cuid2",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")tf.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"ulid",code:U.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),J(s,{validation:"url",code:U.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"regex",code:U.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(t,s),J(s,{code:U.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(s=this._getOrReturnCtx(t,s),J(s,{code:U.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(s=this._getOrReturnCtx(t,s),J(s,{code:U.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?vf(a).test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{code:U.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?pf.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{code:U.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?gf(a).test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{code:U.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?af.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"duration",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?yf(t.data,a.version)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"ip",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?xf(t.data,a.alg)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"jwt",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?bf(t.data,a.version)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"cidr",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?hf.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"base64",code:U.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?mf.test(t.data)||(s=this._getOrReturnCtx(t,s),J(s,{validation:"base64url",code:U.invalid_string,message:a.message}),n.dirty()):me.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:U.invalid_string,...re.errToObj(n)})}_addCheck(t){return new Tt({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...re.errToObj(t)})}url(t){return this._addCheck({kind:"url",...re.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...re.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...re.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...re.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...re.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...re.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...re.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...re.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...re.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...re.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...re.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...re.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...re.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...re.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...re.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}nonempty(t){return this.min(1,re.errToObj(t))}trim(){return new Tt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Tt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Tt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Tt.create=e=>new Tt({checks:[],typeName:oe.ZodString,coerce:e?.coerce??!1,...ce(e)});function wf(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return a%i/10**s}class br extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ee.number){const a=this._getOrReturnCtx(t);return J(a,{code:U.invalid_type,expected:ee.number,received:a.parsedType}),ie}let n;const s=new We;for(const a of this._def.checks)a.kind==="int"?me.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),J(n,{code:U.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),J(n,{code:U.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),J(n,{code:U.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?wf(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),J(n,{code:U.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),J(n,{code:U.not_finite,message:a.message}),s.dirty()):me.assertNever(a);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,s){return new br({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(s)}]})}_addCheck(t){return new br({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:re.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:re.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&me.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}br.create=e=>new br({checks:[],typeName:oe.ZodNumber,coerce:e?.coerce||!1,...ce(e)});class wr extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ee.bigint)return this._getInvalidInput(t);let n;const s=new We;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),J(n,{code:U.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),J(n,{code:U.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),J(n,{code:U.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):me.assertNever(a);return{status:s.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return J(r,{code:U.invalid_type,expected:ee.bigint,received:r.parsedType}),ie}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,s){return new wr({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(s)}]})}_addCheck(t){return new wr({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}wr.create=e=>new wr({checks:[],typeName:oe.ZodBigInt,coerce:e?.coerce??!1,...ce(e)});class Xn extends ue{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ee.boolean){const n=this._getOrReturnCtx(t);return J(n,{code:U.invalid_type,expected:ee.boolean,received:n.parsedType}),ie}return mt(t.data)}}Xn.create=e=>new Xn({typeName:oe.ZodBoolean,coerce:e?.coerce||!1,...ce(e)});class Vr extends ue{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ee.date){const a=this._getOrReturnCtx(t);return J(a,{code:U.invalid_type,expected:ee.date,received:a.parsedType}),ie}if(Number.isNaN(t.data.getTime())){const a=this._getOrReturnCtx(t);return J(a,{code:U.invalid_date}),ie}const n=new We;let s;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(s=this._getOrReturnCtx(t,s),J(s,{code:U.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(s=this._getOrReturnCtx(t,s),J(s,{code:U.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):me.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Vr({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}Vr.create=e=>new Vr({checks:[],coerce:e?.coerce||!1,typeName:oe.ZodDate,...ce(e)});class ei extends ue{_parse(t){if(this._getType(t)!==ee.symbol){const n=this._getOrReturnCtx(t);return J(n,{code:U.invalid_type,expected:ee.symbol,received:n.parsedType}),ie}return mt(t.data)}}ei.create=e=>new ei({typeName:oe.ZodSymbol,...ce(e)});class ti extends ue{_parse(t){if(this._getType(t)!==ee.undefined){const n=this._getOrReturnCtx(t);return J(n,{code:U.invalid_type,expected:ee.undefined,received:n.parsedType}),ie}return mt(t.data)}}ti.create=e=>new ti({typeName:oe.ZodUndefined,...ce(e)});class ri extends ue{_parse(t){if(this._getType(t)!==ee.null){const n=this._getOrReturnCtx(t);return J(n,{code:U.invalid_type,expected:ee.null,received:n.parsedType}),ie}return mt(t.data)}}ri.create=e=>new ri({typeName:oe.ZodNull,...ce(e)});class fa extends ue{constructor(){super(...arguments),this._any=!0}_parse(t){return mt(t.data)}}fa.create=e=>new fa({typeName:oe.ZodAny,...ce(e)});class ha extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(t){return mt(t.data)}}ha.create=e=>new ha({typeName:oe.ZodUnknown,...ce(e)});class lr extends ue{_parse(t){const r=this._getOrReturnCtx(t);return J(r,{code:U.invalid_type,expected:ee.never,received:r.parsedType}),ie}}lr.create=e=>new lr({typeName:oe.ZodNever,...ce(e)});class ni extends ue{_parse(t){if(this._getType(t)!==ee.undefined){const n=this._getOrReturnCtx(t);return J(n,{code:U.invalid_type,expected:ee.void,received:n.parsedType}),ie}return mt(t.data)}}ni.create=e=>new ni({typeName:oe.ZodVoid,...ce(e)});class $t extends ue{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==ee.array)return J(r,{code:U.invalid_type,expected:ee.array,received:r.parsedType}),ie;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,c=r.data.length<s.exactLength.value;(i||c)&&(J(r,{code:i?U.too_big:U.too_small,minimum:c?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(J(r,{code:U.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(J(r,{code:U.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,c)=>s.type._parseAsync(new Lt(r,i,r.path,c)))).then(i=>We.mergeArray(n,i));const a=[...r.data].map((i,c)=>s.type._parseSync(new Lt(r,i,r.path,c)));return We.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new $t({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new $t({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new $t({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}}$t.create=(e,t)=>new $t({type:e,minLength:null,maxLength:null,exactLength:null,typeName:oe.ZodArray,...ce(t)});function Pr(e){if(e instanceof Ce){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ir.create(Pr(n))}return new Ce({...e._def,shape:()=>t})}else return e instanceof $t?new $t({...e._def,type:Pr(e.element)}):e instanceof ir?ir.create(Pr(e.unwrap())):e instanceof Br?Br.create(Pr(e.unwrap())):e instanceof _r?_r.create(e.items.map(t=>Pr(t))):e}class Ce extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=me.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ee.object){const u=this._getOrReturnCtx(t);return J(u,{code:U.invalid_type,expected:ee.object,received:u.parsedType}),ie}const{status:n,ctx:s}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),c=[];if(!(this._def.catchall instanceof lr&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||c.push(u);const l=[];for(const u of i){const f=a[u],d=s.data[u];l.push({key:{status:"valid",value:u},value:f._parse(new Lt(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof lr){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of c)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(u==="strict")c.length>0&&(J(s,{code:U.unrecognized_keys,keys:c}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of c){const d=s.data[f];l.push({key:{status:"valid",value:f},value:u._parse(new Lt(s,d,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of l){const d=await f.key,h=await f.value;u.push({key:d,value:h,alwaysSet:f.alwaysSet})}return u}).then(u=>We.mergeObjectSync(n,u)):We.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new Ce({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new Ce({...this._def,unknownKeys:"strip"})}passthrough(){return new Ce({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ce({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ce({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:oe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Ce({...this._def,catchall:t})}pick(t){const r={};for(const n of me.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Ce({...this._def,shape:()=>r})}omit(t){const r={};for(const n of me.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new Ce({...this._def,shape:()=>r})}deepPartial(){return Pr(this)}partial(t){const r={};for(const n of me.objectKeys(this.shape)){const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}return new Ce({...this._def,shape:()=>r})}required(t){const r={};for(const n of me.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ir;)a=a._def.innerType;r[n]=a}return new Ce({...this._def,shape:()=>r})}keyof(){return Tc(me.objectKeys(this.shape))}}Ce.create=(e,t)=>new Ce({shape:()=>e,unknownKeys:"strip",catchall:lr.create(),typeName:oe.ZodObject,...ce(t)});Ce.strictCreate=(e,t)=>new Ce({shape:()=>e,unknownKeys:"strict",catchall:lr.create(),typeName:oe.ZodObject,...ce(t)});Ce.lazycreate=(e,t)=>new Ce({shape:e,unknownKeys:"strip",catchall:lr.create(),typeName:oe.ZodObject,...ce(t)});class Jn extends ue{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(a){for(const c of a)if(c.result.status==="valid")return c.result;for(const c of a)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;const i=a.map(c=>new Gt(c.ctx.common.issues));return J(r,{code:U.invalid_union,unionErrors:i}),ie}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const l of n){const u={...r,common:{...r.common,issues:[]},parent:null},f=l._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const c=i.map(l=>new Gt(l));return J(r,{code:U.invalid_union,unionErrors:c}),ie}}get options(){return this._def.options}}Jn.create=(e,t)=>new Jn({options:e,typeName:oe.ZodUnion,...ce(t)});function ma(e,t){const r=ar(e),n=ar(t);if(e===t)return{valid:!0,data:e};if(r===ee.object&&n===ee.object){const s=me.objectKeys(t),a=me.objectKeys(e).filter(c=>s.indexOf(c)!==-1),i={...e,...t};for(const c of a){const l=ma(e[c],t[c]);if(!l.valid)return{valid:!1};i[c]=l.data}return{valid:!0,data:i}}else if(r===ee.array&&n===ee.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const i=e[a],c=t[a],l=ma(i,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return r===ee.date&&n===ee.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Qn extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(a,i)=>{if(Xo(a)||Xo(i))return ie;const c=ma(a.value,i.value);return c.valid?((Jo(a)||Jo(i))&&r.dirty(),{status:r.value,value:c.data}):(J(n,{code:U.invalid_intersection_types}),ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Qn.create=(e,t,r)=>new Qn({left:e,right:t,typeName:oe.ZodIntersection,...ce(r)});class _r extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.array)return J(n,{code:U.invalid_type,expected:ee.array,received:n.parsedType}),ie;if(n.data.length<this._def.items.length)return J(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&n.data.length>this._def.items.length&&(J(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new Lt(n,i,n.path,c)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>We.mergeArray(r,i)):We.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new _r({...this._def,rest:t})}}_r.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _r({items:e,typeName:oe.ZodTuple,rest:null,...ce(t)})};class es extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.object)return J(n,{code:U.invalid_type,expected:ee.object,received:n.parsedType}),ie;const s=[],a=this._def.keyType,i=this._def.valueType;for(const c in n.data)s.push({key:a._parse(new Lt(n,c,n.path,c)),value:i._parse(new Lt(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?We.mergeObjectAsync(r,s):We.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ue?new es({keyType:t,valueType:r,typeName:oe.ZodRecord,...ce(n)}):new es({keyType:Tt.create(),valueType:t,typeName:oe.ZodRecord,...ce(r)})}}class si extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.map)return J(n,{code:U.invalid_type,expected:ee.map,received:n.parsedType}),ie;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([c,l],u)=>({key:s._parse(new Lt(n,c,n.path,[u,"key"])),value:a._parse(new Lt(n,l,n.path,[u,"value"]))}));if(n.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,f=await l.value;if(u.status==="aborted"||f.status==="aborted")return ie;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(u.value,f.value)}return{status:r.value,value:c}})}else{const c=new Map;for(const l of i){const u=l.key,f=l.value;if(u.status==="aborted"||f.status==="aborted")return ie;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),c.set(u.value,f.value)}return{status:r.value,value:c}}}}si.create=(e,t,r)=>new si({valueType:t,keyType:e,typeName:oe.ZodMap,...ce(r)});class fn extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ee.set)return J(n,{code:U.invalid_type,expected:ee.set,received:n.parsedType}),ie;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(J(n,{code:U.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(J(n,{code:U.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const f of l){if(f.status==="aborted")return ie;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}const c=[...n.data.values()].map((l,u)=>a._parse(new Lt(n,l,n.path,u)));return n.common.async?Promise.all(c).then(l=>i(l)):i(c)}min(t,r){return new fn({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new fn({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}fn.create=(e,t)=>new fn({valueType:e,minSize:null,maxSize:null,typeName:oe.ZodSet,...ce(t)});class ai extends ue{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}ai.create=(e,t)=>new ai({getter:e,typeName:oe.ZodLazy,...ce(t)});class pa extends ue{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return J(r,{received:r.data,code:U.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:t.data}}get value(){return this._def.value}}pa.create=(e,t)=>new pa({value:e,typeName:oe.ZodLiteral,...ce(t)});function Tc(e,t){return new zr({values:e,typeName:oe.ZodEnum,...ce(t)})}class zr extends ue{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return J(r,{expected:me.joinValues(n),received:r.parsedType,code:U.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return J(r,{received:r.data,code:U.invalid_enum_value,options:n}),ie}return mt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return zr.create(t,{...this._def,...r})}exclude(t,r=this._def){return zr.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}zr.create=Tc;class oi extends ue{_parse(t){const r=me.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ee.string&&n.parsedType!==ee.number){const s=me.objectValues(r);return J(n,{expected:me.joinValues(s),received:n.parsedType,code:U.invalid_type}),ie}if(this._cache||(this._cache=new Set(me.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=me.objectValues(r);return J(n,{received:n.data,code:U.invalid_enum_value,options:s}),ie}return mt(t.data)}get enum(){return this._def.values}}oi.create=(e,t)=>new oi({values:e,typeName:oe.ZodNativeEnum,...ce(t)});class ts extends ue{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==ee.promise&&r.common.async===!1)return J(r,{code:U.invalid_type,expected:ee.promise,received:r.parsedType}),ie;const n=r.parsedType===ee.promise?r.data:Promise.resolve(r.data);return mt(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ts.create=(e,t)=>new ts({type:e,typeName:oe.ZodPromise,...ce(t)});class Hr extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:i=>{J(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async c=>{if(r.value==="aborted")return ie;const l=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return l.status==="aborted"?ie:l.status==="dirty"||r.value==="dirty"?nn(l.value):l});{if(r.value==="aborted")return ie;const c=this._def.schema._parseSync({data:i,path:n.path,parent:n});return c.status==="aborted"?ie:c.status==="dirty"||r.value==="dirty"?nn(c.value):c}}if(s.type==="refinement"){const i=c=>{const l=s.refinement(c,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){const c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?ie:(c.status==="dirty"&&r.dirty(),i(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?ie:(c.status==="dirty"&&r.dirty(),i(c.value).then(()=>({status:r.value,value:c.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Lr(i))return ie;const c=s.transform(i.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Lr(i)?Promise.resolve(s.transform(i.value,a)).then(c=>({status:r.value,value:c})):ie);me.assertNever(s)}}Hr.create=(e,t,r)=>new Hr({schema:e,typeName:oe.ZodEffects,effect:t,...ce(r)});Hr.createWithPreprocess=(e,t,r)=>new Hr({schema:t,effect:{type:"preprocess",transform:e},typeName:oe.ZodEffects,...ce(r)});class ir extends ue{_parse(t){return this._getType(t)===ee.undefined?mt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ir.create=(e,t)=>new ir({innerType:e,typeName:oe.ZodOptional,...ce(t)});class Br extends ue{_parse(t){return this._getType(t)===ee.null?mt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Br.create=(e,t)=>new Br({innerType:e,typeName:oe.ZodNullable,...ce(t)});class ga extends ue{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===ee.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ga.create=(e,t)=>new ga({innerType:e,typeName:oe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ce(t)});class va extends ue{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return qn(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Gt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Gt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}va.create=(e,t)=>new va({innerType:e,typeName:oe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ce(t)});class ii extends ue{_parse(t){if(this._getType(t)!==ee.nan){const n=this._getOrReturnCtx(t);return J(n,{code:U.invalid_type,expected:ee.nan,received:n.parsedType}),ie}return{status:"valid",value:t.data}}}ii.create=e=>new ii({typeName:oe.ZodNaN,...ce(e)});class _f extends ue{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Wa extends ue{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ie:a.status==="dirty"?(r.dirty(),nn(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ie:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new Wa({in:t,out:r,typeName:oe.ZodPipeline})}}class ya extends ue{_parse(t){const r=this._def.innerType._parse(t),n=s=>(Lr(s)&&(s.value=Object.freeze(s.value)),s);return qn(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}ya.create=(e,t)=>new ya({innerType:e,typeName:oe.ZodReadonly,...ce(t)});var oe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(oe||(oe={}));const q=Tt.create,we=br.create;wr.create;const Ke=Xn.create,ke=Vr.create,Rc=fa.create,Sf=ha.create;lr.create;const Vt=$t.create,Oe=Ce.create,_s=Jn.create;Qn.create;_r.create;const Ua=es.create,Ut=pa.create,Xt=zr.create;ts.create;ir.create;Br.create;const rs={string:(e=>Tt.create({...e,coerce:!0})),number:(e=>br.create({...e,coerce:!0})),boolean:(e=>Xn.create({...e,coerce:!0})),bigint:(e=>wr.create({...e,coerce:!0})),date:(e=>Vr.create({...e,coerce:!0}))};function ci(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Za(...e){return t=>{let r=!1;const n=e.map(s=>{const a=ci(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():ci(e[s],null)}}}}function ct(...e){return j.useCallback(Za(...e),e)}var kf=Symbol.for("react.lazy"),ns=j[" use ".trim().toString()];function jf(e){return typeof e=="object"&&e!==null&&"then"in e}function Mc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===kf&&"_payload"in e&&jf(e._payload)}function Cf(e){const t=Nf(e),r=j.forwardRef((n,s)=>{let{children:a,...i}=n;Mc(a)&&typeof ns=="function"&&(a=ns(a._payload));const c=j.Children.toArray(a),l=c.find(Af);if(l){const u=l.props.children,f=c.map(d=>d===l?j.Children.count(u)>1?j.Children.only(null):j.isValidElement(u)?u.props.children:null:d);return o.jsx(t,{...i,ref:s,children:j.isValidElement(u)?j.cloneElement(u,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}var Df=Cf("Slot");function Nf(e){const t=j.forwardRef((r,n)=>{let{children:s,...a}=r;if(Mc(s)&&typeof ns=="function"&&(s=ns(s._payload)),j.isValidElement(s)){const i=Rf(s),c=Tf(a,s.props);return s.type!==j.Fragment&&(c.ref=n?Za(n,i):i),j.cloneElement(s,c)}return j.Children.count(s)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ef=Symbol("radix.slottable");function Af(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ef}function Tf(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...c)=>{const l=a(...c);return s(...c),l}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Rf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const li=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ui=mc,Mf=(e,t)=>r=>{var n;if(t?.variants==null)return ui(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const f=r?.[u],d=a?.[u];if(f===null)return null;const h=li(f)||li(d);return s[u][h]}),c=r&&Object.entries(r).reduce((u,f)=>{let[d,h]=f;return h===void 0||(u[d]=h),u},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,f)=>{let{class:d,className:h,...p}=f;return Object.entries(p).every(b=>{let[g,y]=b;return Array.isArray(y)?y.includes({...a,...c}[g]):{...a,...c}[g]===y})?[...u,d,h]:u},[]);return ui(e,i,l,r?.class,r?.className)},on=Mf("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 min-w-[var(--ui-space-0)] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-chart-4 text-white shadow-sm hover:bg-chart-4/90",outline:"border border-input bg-transparent text-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-accent underline-offset-4 underline hover:text-accent/80 !h-auto !py-[var(--ui-space-0)]",positive:"bg-chart-2 text-white shadow-sm hover:bg-chart-2/90",warning:"bg-chart-3 text-white shadow-sm hover:bg-chart-3/90",info:"bg-chart-5 text-white shadow-sm hover:bg-chart-5/90","outline-positive":"border border-chart-2 text-chart-2 hover:bg-chart-2/10","outline-negative":"border border-muted text-muted-foreground hover:bg-muted/10",fab:"rounded-full h-[var(--ui-space-14)] w-[var(--ui-space-14)] p-[var(--ui-space-0)] shadow-lg hover:shadow-xl bg-primary text-primary-foreground hover:bg-primary/90","circle-help":"bg-accent text-accent-foreground shadow-sm hover:bg-accent/90 rounded-full","circle-alert":"bg-chart-3 text-white shadow-sm hover:bg-chart-3/90 rounded-full",abort:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",negative:"bg-muted text-muted-foreground shadow-sm hover:bg-muted/80",delete:"bg-chart-4 text-white shadow-sm hover:bg-chart-4/90",pause:"bg-chart-3 text-white shadow-sm hover:bg-chart-3/90","outline-abort":"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",option:"border border-[hsl(210,30%,35%)] dark:border-border bg-background text-foreground shadow-none hover:bg-accent/30 hover:text-foreground","option-active":"border-2 border-primary bg-primary/10 text-foreground shadow-none hover:bg-primary/20","outline-delete":"border border-destructive/50 text-destructive bg-background hover:bg-destructive/10 hover:border-destructive"},size:{default:"px-ui-button py-ui text-ui min-h-ui-touch",sm:"rounded-md px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-xs",lg:"rounded-md px-[var(--ui-space-8)] py-[var(--ui-space-3)]",icon:"p-ui min-h-ui-touch min-w-[var(--ui-touch-target-min)]",circle:"rounded-full p-[var(--ui-space-2)] aspect-square"}},defaultVariants:{variant:"default",size:"default"}}),ae=j.forwardRef(({className:e,variant:t="default",size:r,children:n,loading:s=!1,success:a=!1,error:i=!1,icon:c,asChild:l=!1,disabled:u,maxLabelLength:f=100,...d},h)=>{const p=l?Df:"button",b=a?"positive":i?"destructive":t,g=()=>{if(s)return o.jsx(ye.Spinner,{className:"h-ui-icon w-ui-icon"});if(a)return o.jsx(ye.Check,{className:"h-ui-icon w-ui-icon"});if(i)return o.jsx(ye.X,{className:"h-ui-icon w-ui-icon"});const y=typeof n=="string"&&n.length>f?`${n.slice(0,Math.max(0,f-1))}…`:n,x=typeof n=="string"&&typeof y=="string"&&y!==n,v=typeof n=="string"?o.jsx("span",{className:"min-w-[var(--ui-space-0)] flex-1 whitespace-nowrap",title:x?n:void 0,children:y}):n;return o.jsxs("span",{className:"flex min-w-[var(--ui-space-0)] items-center",children:[c&&o.jsx(c,{className:de(n?"mr-[var(--ui-space-2)]":"mr-[var(--ui-space-0)]","h-ui-icon w-ui-icon")}),v]})};return o.jsx(p,{className:de(on({variant:b,size:r,className:e})),ref:h,disabled:u||s||a||i,...d,children:g()})});ae.displayName="Button";function Pf(e,t){const r=j.createContext(t),n=a=>{const{children:i,...c}=a,l=j.useMemo(()=>c,Object.values(c));return o.jsx(r.Provider,{value:l,children:i})};n.displayName=e+"Provider";function s(a){const i=j.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function Ss(e,t=[]){let r=[];function n(a,i){const c=j.createContext(i),l=r.length;r=[...r,i];const u=d=>{const{scope:h,children:p,...b}=d,g=h?.[e]?.[l]||c,y=j.useMemo(()=>b,Object.values(b));return o.jsx(g.Provider,{value:y,children:p})};u.displayName=a+"Provider";function f(d,h){const p=h?.[e]?.[l]||c,b=j.useContext(p);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[u,f]}const s=()=>{const a=r.map(i=>j.createContext(i));return function(c){const l=c?.[e]||a;return j.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return s.scopeName=e,[n,Of(s,...t)]}function Of(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=n.reduce((c,{useScope:l,scopeName:u})=>{const d=l(a)[`__scope${u}`];return{...c,...d}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function Be(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}var ur=globalThis?.document?j.useLayoutEffect:()=>{},If=j[" useInsertionEffect ".trim().toString()]||ur;function Ga({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,i]=$f({defaultProp:t,onChange:r}),c=e!==void 0,l=c?e:s;{const f=j.useRef(e!==void 0);j.useEffect(()=>{const d=f.current;d!==c&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,n])}const u=j.useCallback(f=>{if(c){const d=Ff(f)?f(e):f;d!==e&&i.current?.(d)}else a(f)},[c,e,a,i]);return[l,u]}function $f({defaultProp:e,onChange:t}){const[r,n]=j.useState(e),s=j.useRef(r),a=j.useRef(t);return If(()=>{a.current=t},[t]),j.useEffect(()=>{s.current!==r&&(a.current?.(r),s.current=r)},[r,s]),[r,n,a]}function Ff(e){return typeof e=="function"}function Lf(e){const t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Pc(e){const[t,r]=j.useState(void 0);return ur(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let i,c;if("borderBoxSize"in a){const l=a.borderBoxSize,u=Array.isArray(l)?l[0]:l;i=u.inlineSize,c=u.blockSize}else i=e.offsetWidth,c=e.offsetHeight;r({width:i,height:c})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function Vf(e,t){return j.useReducer((r,n)=>t[r][n]??r,e)}var jr=e=>{const{present:t,children:r}=e,n=zf(t),s=typeof r=="function"?r({present:n.isPresent}):j.Children.only(r),a=ct(n.ref,Hf(s));return typeof r=="function"||n.isPresent?j.cloneElement(s,{ref:a}):null};jr.displayName="Presence";function zf(e){const[t,r]=j.useState(),n=j.useRef(null),s=j.useRef(e),a=j.useRef("none"),i=e?"mounted":"unmounted",[c,l]=Vf(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return j.useEffect(()=>{const u=Pn(n.current);a.current=c==="mounted"?u:"none"},[c]),ur(()=>{const u=n.current,f=s.current;if(f!==e){const h=a.current,p=Pn(u);e?l("MOUNT"):p==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&h!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),ur(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=p=>{const g=Pn(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&g&&(l("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=p=>{p.target===t&&(a.current=Pn(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:j.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Pn(e){return e?.animationName||"none"}function Hf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ya(e){const t=Bf(e),r=j.forwardRef((n,s)=>{const{children:a,...i}=n,c=j.Children.toArray(a),l=c.find(Uf);if(l){const u=l.props.children,f=c.map(d=>d===l?j.Children.count(u)>1?j.Children.only(null):j.isValidElement(u)?u.props.children:null:d);return o.jsx(t,{...i,ref:s,children:j.isValidElement(u)?j.cloneElement(u,void 0,f):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Bf(e){const t=j.forwardRef((r,n)=>{const{children:s,...a}=r;if(j.isValidElement(s)){const i=Gf(s),c=Zf(a,s.props);return s.type!==j.Fragment&&(c.ref=n?Za(n,i):i),j.cloneElement(s,c)}return j.Children.count(s)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Wf=Symbol("radix.slottable");function Uf(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Wf}function Zf(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...c)=>{const l=a(...c);return s(...c),l}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Gf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Yf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$e=Yf.reduce((e,t)=>{const r=Ya(`Primitive.${t}`),n=j.forwardRef((s,a)=>{const{asChild:i,...c}=s,l=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(l,{...c,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Kf(e,t){e&&fc.flushSync(()=>e.dispatchEvent(t))}var ks="Checkbox",[qf]=Ss(ks),[Xf,Ka]=qf(ks);function Jf(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:a,form:i,name:c,onCheckedChange:l,required:u,value:f="on",internal_do_not_use_render:d}=e,[h,p]=Ga({prop:r,defaultProp:s??!1,onChange:l,caller:ks}),[b,g]=j.useState(null),[y,x]=j.useState(null),v=j.useRef(!1),k=b?!!i||!!b.closest("form"):!0,w={checked:h,disabled:a,setChecked:p,control:b,setControl:g,name:c,form:i,value:f,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:cr(s)?!1:s,isFormControl:k,bubbleInput:y,setBubbleInput:x};return o.jsx(Xf,{scope:t,...w,children:Qf(d)?d(w):n})}var Oc="CheckboxTrigger",Ic=j.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:a,value:i,disabled:c,checked:l,required:u,setControl:f,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:b}=Ka(Oc,e),g=ct(s,f),y=j.useRef(l);return j.useEffect(()=>{const x=a?.form;if(x){const v=()=>d(y.current);return x.addEventListener("reset",v),()=>x.removeEventListener("reset",v)}},[a,d]),o.jsx($e.button,{type:"button",role:"checkbox","aria-checked":cr(l)?"mixed":l,"aria-required":u,"data-state":zc(l),"data-disabled":c?"":void 0,disabled:c,value:i,...n,ref:g,onKeyDown:Be(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Be(r,x=>{d(v=>cr(v)?!0:!v),b&&p&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});Ic.displayName=Oc;var qa=j.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:a,required:i,disabled:c,value:l,onCheckedChange:u,form:f,...d}=e;return o.jsx(Jf,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:c,required:i,onCheckedChange:u,name:n,form:f,value:l,internal_do_not_use_render:({isFormControl:h})=>o.jsxs(o.Fragment,{children:[o.jsx(Ic,{...d,ref:t,__scopeCheckbox:r}),h&&o.jsx(Vc,{__scopeCheckbox:r})]})})});qa.displayName=ks;var $c="CheckboxIndicator",Fc=j.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,a=Ka($c,r);return o.jsx(jr,{present:n||cr(a.checked)||a.checked===!0,children:o.jsx($e.span,{"data-state":zc(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});Fc.displayName=$c;var Lc="CheckboxBubbleInput",Vc=j.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:a,defaultChecked:i,required:c,disabled:l,name:u,value:f,form:d,bubbleInput:h,setBubbleInput:p}=Ka(Lc,e),b=ct(r,p),g=Lf(a),y=Pc(n);j.useEffect(()=>{const v=h;if(!v)return;const k=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(k,"checked").set,C=!s.current;if(g!==a&&S){const _=new Event("click",{bubbles:C});v.indeterminate=cr(a),S.call(v,cr(a)?!1:a),v.dispatchEvent(_)}},[h,g,a,s]);const x=j.useRef(cr(a)?!1:a);return o.jsx($e.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:c,disabled:l,name:u,value:f,form:d,...t,tabIndex:-1,ref:b,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Vc.displayName=Lc;function Qf(e){return typeof e=="function"}function cr(e){return e==="indeterminate"}function zc(e){return cr(e)?"indeterminate":e?"checked":"unchecked"}const hn=j.forwardRef(({className:e,...t},r)=>o.jsx(qa,{ref:r,className:de("peer h-ui-checkbox w-ui-checkbox shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(Fc,{className:de("flex items-center justify-center text-current"),children:o.jsx(ye.Check,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})}));hn.displayName=qa.displayName;function Ne(e,t,r){const n=t||void 0;switch(r){case"header":return new Intl.DateTimeFormat(n,{year:"numeric",month:"short"}).format(e);case"picker":return new Intl.DateTimeFormat(n,{year:"numeric",month:"short",day:"numeric"}).format(e);case"weekday":{const s=new Intl.DateTimeFormat(n,{weekday:"short"}).format(e);return n?.startsWith("ja")?`(${s})`:new Intl.DateTimeFormat(n,{weekday:"long"}).format(e)}case"weekdayShort":return new Intl.DateTimeFormat(n,{weekday:"short"}).format(e);case"day":return new Intl.NumberFormat(n).format(e.getDate());case"monthDayShort":return new Intl.DateTimeFormat(n,{month:"short",day:"numeric",weekday:"short"}).format(e);case"compact":return new Intl.DateTimeFormat(n,{month:"numeric",day:"numeric",weekday:"short"}).format(e);case"time":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric"}).format(e);case"timeWithSeconds":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",second:"numeric"}).format(e);case"timeWithMs":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3}).format(e);case"minute":return new Intl.DateTimeFormat(n,{minute:"numeric"}).format(e);case"second":return new Intl.DateTimeFormat(n,{second:"numeric"}).format(e);case"time12":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",hour12:!0}).format(e);case"time24":return new Intl.DateTimeFormat(n,{hour:"numeric",minute:"numeric",hour12:!1}).format(e);case"year":return new Intl.DateTimeFormat(n,{year:"numeric"}).format(e);case"month":return new Intl.DateTimeFormat(n,{month:"long"}).format(e);case"monthShort":return new Intl.DateTimeFormat(n,{month:"short"}).format(e);case"full":{const s=new Intl.DateTimeFormat(n,{year:"numeric",month:"long",day:"numeric"}).format(e),a=new Intl.DateTimeFormat(n,{weekday:"short"}).format(e);return n?.startsWith("ja")?`${s}(${a})`:new Intl.DateTimeFormat(n,{year:"numeric",month:"long",day:"numeric",weekday:"long"}).format(e)}case"yearMonth":return new Intl.DateTimeFormat(n,{year:"numeric",month:"long"}).format(e);case"monthDay":return new Intl.DateTimeFormat(n,{month:"long",day:"numeric"}).format(e);default:return e.toLocaleDateString(n)}}const eh={loading:"Loading",today_button:"Today",previous:"Previous",next:"Next",view_day:"Day",view_week:"Week",view_month:"Month",days_short_sun:"Sun",days_short_mon:"Mon",days_short_tue:"Tue",days_short_wed:"Wed",days_short_thu:"Thu",days_short_fri:"Fri",days_short_sat:"Sat",user_name_label:"User Name",name_placeholder:"Enter name",attendee_label:"Attendee",attendee_placeholder:"Enter attendee name",resource_label:"Resource",resource_placeholder:"Select resource",start_time_label:"Start Time",duration_label:"Duration",status_label:"Status",note_label:"Notes",delete_button:"Delete",cancel_button:"Cancel",save_button:"Save",confirm_delete_title:"Delete Event",confirm_delete_message:"Are you sure you want to delete this event?",event_edit_title:"Edit Event",event_create_title:"Create Event",facility_prompt_group_name:"Enter group name",facility_confirm_delete_group_message:"Delete this group?",facility_prompt_resource_name:"Enter resource name",facility_confirm_delete_resource_message:"Delete this resource?",close:"Close",facility_settings_title:"Facility Settings",facility_label_group_name:"Group",facility_label_resource_name:"Resource",facility_action_add_group:"Add Group",facility_action_add_resource:"Add Resource",facility_label_no_groups:"No groups",facility_action_done:"Done",settings_title:"Settings",settings_language:"Language",settings_theme:"Theme",option_light:"Light",option_dark:"Dark",settings_density:"Density",option_compact:"Compact",option_normal:"Normal",option_spacious:"Spacious",settings_radius:"Radius",settings_font_size:"Font Size",settings_week_start:"Week Starts On",option_sunday:"Sunday",option_monday:"Monday",settings_business_hours:"Business Hours",settings_closed_days:"Closed Days",settings_pagination:"Facility Pagination",settings_page_size:"Items per page",page:"Page",previousPage:"Previous Page",nextPage:"Next Page",day_cell:"Day cell",event_custom_edit_title:"Edit Event",event_custom_create_title:"Create Event",event_name_label:"Event Name",event_name_placeholder:"Enter event name",usage_label:"Usage",usage_placeholder:"Select usage",all_day:"All day",date_time_label:"Date & Time",attendee_self:"Only me",date_picker_label:"Select date",personnel_list_title:"職員一覧",personnel_search_placeholder:"Search by name or email...",personnel_priority_high:"High Priority",personnel_priority_normal:"Normal",personnel_priority_low:"Low Priority",personnel_no_results:"No matching personnel found",personnel_all_departments:"All Departments",personnel_selected_count:"{{count}} selected",personnel_context_hint:"Right-click to set priority",keypad_title_number:"Enter number",keypad_title_phone:"Enter phone number",keypad_title_time:"Enter time",keypad_error_max_length:"Up to {{max}} characters",keypad_error_hyphen_repeat:"Hyphen cannot be repeated",keypad_error_decimal_repeat:"Only one decimal point is allowed",keypad_error_time_invalid:"Enter a valid 4-digit time (e.g., 0930)",keypad_error_value_required:"Please enter a value",keypad_error_decimal_end:"Value cannot end with a decimal point",keypad_error_hyphen_end:"Value cannot end with a hyphen",personnel_all_professions:"All Professions"};function Fe(){const{t:e,i18n:t}=Oa.useTranslation();return{t:(n,s)=>{const a=typeof s=="string"?{defaultValue:s}:s??{},i=a.defaultValue??eh[n]??n;return e(n,{...a,defaultValue:i})},i18n:t}}function Cr(e,t){const r=new Date(e);return r.setDate(r.getDate()+t),r}function th(e,t){return Cr(e,t*7)}function Xa(e,t){const r=new Date(e),n=r.getMonth()+t;return r.setMonth(n),r.getMonth()!==(n%12+12)%12&&r.setDate(0),r}function rh(e,t){return Xa(e,-1)}function dt(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function nh(e){const t=new Date(e);return t.setHours(23,59,59,999),t}function xa(e){const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Hc(e){const t=new Date(e);return t.setMonth(t.getMonth()+1),t.setDate(0),t.setHours(23,59,59,999),t}function cn(e,t){const r=t?.weekStartsOn??0,n=new Date(e),s=n.getDay(),a=(s<r?7:0)+s-r;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}function ba(e,t){const r=cn(e,t),n=Cr(r,6);return n.setHours(23,59,59,999),n}function gr(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function sh(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function di(e,t){const r=e.getTime();return r>=t.start.getTime()&&r<=t.end.getTime()}function Bc(e,t){return e.start.getTime()<t.end.getTime()&&t.start.getTime()<e.end.getTime()}function fi(e){const t=dt(e.start),n=dt(e.end).getTime(),s=[],a=new Date(t);for(;a.getTime()<=n;)s.push(new Date(a)),a.setDate(a.getDate()+1);return s}function ah(e){const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`}function Wc(e){const t=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0");return`${t}:${r}`}function Or(e){return`${ah(e)}T${Wc(e)}`}function hi({className:e,locale:t,mode:r="single",selected:n,onSelect:s,disabled:a,numberOfMonths:i=1,defaultMonth:c}){const[l,u]=j.useState(c||(n instanceof Date?n:n?.from)||new Date),f=j.useRef(n);j.useEffect(()=>{if(n!==f.current){const C=n instanceof Date?n:n?.from;C&&u(xa(C)),f.current=n}},[n]);const d=C=>{if(!a)return!1;const _=dt(C);return Array.isArray(a)?a.some(N=>N instanceof Date?gr(_,dt(N)):typeof N=="object"&&"before"in N&&N.before?_.getTime()<dt(N.before).getTime():typeof N=="object"&&"after"in N&&N.after?_.getTime()>dt(N.after).getTime():!1):a instanceof Date?gr(_,dt(a)):typeof a=="function"?a(C):!1},h=C=>{if(!n)return!1;if(r==="single"&&n instanceof Date)return gr(C,n);if(r==="range"&&n.from){const _=n;if(_.from&&gr(C,_.from)||_.to&&gr(C,_.to))return!0;if(_.from&&_.to)return di(C,{start:_.from,end:_.to})}return!1},p=C=>{let _=!1,N=!1,I=!1;if(r==="range"&&n?.from){const M=n;M.from&&gr(C,M.from)&&(_=!0),M.to&&gr(C,M.to)&&(N=!0),M.from&&M.to&&di(C,{start:M.from,end:M.to})&&(I=!0)}return de(on({variant:"ghost"}),"p-ui font-normal aria-selected:opacity-100",h(C)&&"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",I&&!_&&!N&&"bg-accent text-accent-foreground rounded-none",_&&"bg-primary text-primary-foreground rounded-l-md rounded-r-none",N&&"bg-primary text-primary-foreground rounded-l-none rounded-r-md",r==="single"&&h(C)&&"rounded-md",!sh(C,l)&&"text-muted-foreground opacity-50",d(C)&&"text-muted-foreground opacity-50 cursor-not-allowed")},b=C=>{if(!d(C)){if(r==="single")s?.(C);else if(r==="range"){const _=n||{from:void 0,to:void 0};!_.from||_.from&&_.to?s?.({from:C,to:void 0}):C<_.from?s?.({from:C,to:void 0}):s?.({from:_.from,to:C})}}},g=()=>u(C=>Xa(new Date(C),1)),y=()=>u(C=>rh(new Date(C))),x=xa(l),v=Hc(x),k=cn(x),w=ba(v),S=fi({start:k,end:w});return o.jsxs("div",{className:de("p-ui flex flex-col gap-y-ui",e),children:[o.jsxs("div",{className:"flex items-center justify-between gap-x-ui",children:[o.jsx("button",{type:"button",onClick:y,"aria-label":"Go to previous month",className:de(on({variant:"outline"}),"bg-transparent p-ui hover:bg-accent hover:text-accent-foreground"),children:o.jsx(ye.ChevronLeft,{className:"h-ui-icon w-ui-icon",strokeWidth:3})}),o.jsx("div",{className:"font-medium text-ui",children:Ne(l,t,"header")}),o.jsx("button",{type:"button",onClick:g,"aria-label":"Go to next month",className:de(on({variant:"outline"}),"bg-transparent p-ui hover:bg-accent hover:text-accent-foreground"),children:o.jsx(ye.ChevronRight,{className:"h-ui-icon w-ui-icon",strokeWidth:3})})]}),o.jsxs("table",{className:"w-full border-collapse space-y-[var(--ui-space-1)]",children:[o.jsx("thead",{children:o.jsx("tr",{children:fi({start:cn(l),end:ba(cn(l))}).map(C=>{const _=C.getDay(),N=_===0,I=_===6;return o.jsx("th",{className:de("rounded-md font-normal text-[0.8rem]",N&&"text-red-500",I&&"text-blue-500",!N&&!I&&"text-muted-foreground"),children:o.jsx("div",{className:"flex justify-center items-center p-ui",children:Ne(C,t,"weekdayShort")})},C.getTime())})})}),o.jsx("tbody",{children:Array.from({length:Math.ceil(S.length/7)}).map((C,_)=>{const N=S.slice(_*7,(_+1)*7);return o.jsx("tr",{className:"w-full",children:N.map(I=>o.jsx("td",{className:"p-[var(--ui-space-0)] text-center relative focus-within:relative",children:o.jsx("button",{type:"button",onClick:()=>b(I),className:p(I),disabled:d(I),children:Ne(I,t,"day")})},I.getTime()))},N[0]?.getTime()||_)})})]})]})}function Wr(e){const t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...r)=>t.current?.(...r),[])}function oh(e,t=globalThis?.document){const r=Wr(e);j.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var ih="DismissableLayer",wa="dismissableLayer.update",ch="dismissableLayer.pointerDownOutside",lh="dismissableLayer.focusOutside",mi,Uc=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ja=j.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:i,onDismiss:c,...l}=e,u=j.useContext(Uc),[f,d]=j.useState(null),h=f?.ownerDocument??globalThis?.document,[,p]=j.useState({}),b=ct(t,_=>d(_)),g=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(y),v=f?g.indexOf(f):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,w=v>=x,S=fh(_=>{const N=_.target,I=[...u.branches].some(M=>M.contains(N));!w||I||(s?.(_),i?.(_),_.defaultPrevented||c?.())},h),C=hh(_=>{const N=_.target;[...u.branches].some(M=>M.contains(N))||(a?.(_),i?.(_),_.defaultPrevented||c?.())},h);return oh(_=>{v===u.layers.size-1&&(n?.(_),!_.defaultPrevented&&c&&(_.preventDefault(),c()))},h),j.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(mi=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),pi(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=mi)}},[f,h,r,u]),j.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),pi())},[f,u]),j.useEffect(()=>{const _=()=>p({});return document.addEventListener(wa,_),()=>document.removeEventListener(wa,_)},[]),o.jsx($e.div,{...l,ref:b,style:{pointerEvents:k?w?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,S.onPointerDownCapture)})});Ja.displayName=ih;var uh="DismissableLayerBranch",dh=j.forwardRef((e,t)=>{const r=j.useContext(Uc),n=j.useRef(null),s=ct(t,n);return j.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),o.jsx($e.div,{...e,ref:s})});dh.displayName=uh;function fh(e,t=globalThis?.document){const r=Wr(e),n=j.useRef(!1),s=j.useRef(()=>{});return j.useEffect(()=>{const a=c=>{if(c.target&&!n.current){let l=function(){Zc(ch,r,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=l,t.addEventListener("click",s.current,{once:!0})):l()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function hh(e,t=globalThis?.document){const r=Wr(e),n=j.useRef(!1);return j.useEffect(()=>{const s=a=>{a.target&&!n.current&&Zc(lh,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function pi(){const e=new CustomEvent(wa);document.dispatchEvent(e)}function Zc(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Kf(s,a):s.dispatchEvent(a)}var Ys=0;function Gc(){j.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??gi()),document.body.insertAdjacentElement("beforeend",e[1]??gi()),Ys++,()=>{Ys===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ys--}},[])}function gi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ks="focusScope.autoFocusOnMount",qs="focusScope.autoFocusOnUnmount",vi={bubbles:!1,cancelable:!0},mh="FocusScope",Qa=j.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...i}=e,[c,l]=j.useState(null),u=Wr(s),f=Wr(a),d=j.useRef(null),h=ct(t,g=>l(g)),p=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(n){let g=function(k){if(p.paused||!c)return;const w=k.target;c.contains(w)?d.current=w:sr(d.current,{select:!0})},y=function(k){if(p.paused||!c)return;const w=k.relatedTarget;w!==null&&(c.contains(w)||sr(d.current,{select:!0}))},x=function(k){if(document.activeElement===document.body)for(const S of k)S.removedNodes.length>0&&sr(c)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const v=new MutationObserver(x);return c&&v.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),v.disconnect()}}},[n,c,p.paused]),j.useEffect(()=>{if(c){xi.add(p);const g=document.activeElement;if(!c.contains(g)){const x=new CustomEvent(Ks,vi);c.addEventListener(Ks,u),c.dispatchEvent(x),x.defaultPrevented||(ph(bh(Yc(c)),{select:!0}),document.activeElement===g&&sr(c))}return()=>{c.removeEventListener(Ks,u),setTimeout(()=>{const x=new CustomEvent(qs,vi);c.addEventListener(qs,f),c.dispatchEvent(x),x.defaultPrevented||sr(g??document.body,{select:!0}),c.removeEventListener(qs,f),xi.remove(p)},0)}}},[c,u,f,p]);const b=j.useCallback(g=>{if(!r&&!n||p.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(y&&x){const v=g.currentTarget,[k,w]=gh(v);k&&w?!g.shiftKey&&x===w?(g.preventDefault(),r&&sr(k,{select:!0})):g.shiftKey&&x===k&&(g.preventDefault(),r&&sr(w,{select:!0})):x===v&&g.preventDefault()}},[r,n,p.paused]);return o.jsx($e.div,{tabIndex:-1,...i,ref:h,onKeyDown:b})});Qa.displayName=mh;function ph(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(sr(n,{select:t}),document.activeElement!==r)return}function gh(e){const t=Yc(e),r=yi(t,e),n=yi(t.reverse(),e);return[r,n]}function Yc(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function yi(e,t){for(const r of e)if(!vh(r,{upTo:t}))return r}function vh(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function yh(e){return e instanceof HTMLInputElement&&"select"in e}function sr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&yh(e)&&t&&e.select()}}var xi=xh();function xh(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=bi(e,t),e.unshift(t)},remove(t){e=bi(e,t),e[0]?.resume()}}}function bi(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function bh(e){return e.filter(t=>t.tagName!=="A")}var wh=j[" useId ".trim().toString()]||(()=>{}),_h=0;function zn(e){const[t,r]=j.useState(wh());return ur(()=>{r(n=>n??String(_h++))},[e]),e||(t?`radix-${t}`:"")}const Sh=["top","right","bottom","left"],dr=Math.min,st=Math.max,ss=Math.round,On=Math.floor,Ft=e=>({x:e,y:e}),kh={left:"right",right:"left",bottom:"top",top:"bottom"},jh={start:"end",end:"start"};function _a(e,t,r){return st(e,dr(t,r))}function Yt(e,t){return typeof e=="function"?e(t):e}function Kt(e){return e.split("-")[0]}function Gr(e){return e.split("-")[1]}function eo(e){return e==="x"?"y":"x"}function to(e){return e==="y"?"height":"width"}const Ch=new Set(["top","bottom"]);function Rt(e){return Ch.has(Kt(e))?"y":"x"}function ro(e){return eo(Rt(e))}function Dh(e,t,r){r===void 0&&(r=!1);const n=Gr(e),s=ro(e),a=to(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=as(i)),[i,as(i)]}function Nh(e){const t=as(e);return[Sa(e),t,Sa(t)]}function Sa(e){return e.replace(/start|end/g,t=>jh[t])}const wi=["left","right"],_i=["right","left"],Eh=["top","bottom"],Ah=["bottom","top"];function Th(e,t,r){switch(e){case"top":case"bottom":return r?t?_i:wi:t?wi:_i;case"left":case"right":return t?Eh:Ah;default:return[]}}function Rh(e,t,r,n){const s=Gr(e);let a=Th(Kt(e),r==="start",n);return s&&(a=a.map(i=>i+"-"+s),t&&(a=a.concat(a.map(Sa)))),a}function as(e){return e.replace(/left|right|bottom|top/g,t=>kh[t])}function Mh(e){return{top:0,right:0,bottom:0,left:0,...e}}function Kc(e){return typeof e!="number"?Mh(e):{top:e,right:e,bottom:e,left:e}}function os(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Si(e,t,r){let{reference:n,floating:s}=e;const a=Rt(t),i=ro(t),c=to(i),l=Kt(t),u=a==="y",f=n.x+n.width/2-s.width/2,d=n.y+n.height/2-s.height/2,h=n[c]/2-s[c]/2;let p;switch(l){case"top":p={x:f,y:n.y-s.height};break;case"bottom":p={x:f,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-s.width,y:d};break;default:p={x:n.x,y:n.y}}switch(Gr(t)){case"start":p[i]-=h*(r&&u?-1:1);break;case"end":p[i]+=h*(r&&u?-1:1);break}return p}const Ph=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:a=[],platform:i}=r,c=a.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:d}=Si(u,n,l),h=n,p={},b=0;for(let g=0;g<c.length;g++){const{name:y,fn:x}=c[g],{x:v,y:k,data:w,reset:S}=await x({x:f,y:d,initialPlacement:n,placement:h,strategy:s,middlewareData:p,rects:u,platform:i,elements:{reference:e,floating:t}});f=v??f,d=k??d,p={...p,[y]:{...p[y],...w}},S&&b<=50&&(b++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(u=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:f,y:d}=Si(u,h,l)),g=-1)}return{x:f,y:d,placement:h,strategy:s,middlewareData:p}};async function mn(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:a,rects:i,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=Yt(t,e),b=Kc(p),y=c[h?d==="floating"?"reference":"floating":d],x=os(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(y)))==null||r?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:u,rootBoundary:f,strategy:l})),v=d==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),w=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},S=os(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:k,strategy:l}):v);return{top:(x.top-S.top+b.top)/w.y,bottom:(S.bottom-x.bottom+b.bottom)/w.y,left:(x.left-S.left+b.left)/w.x,right:(S.right-x.right+b.right)/w.x}}const Oh=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:a,platform:i,elements:c,middlewareData:l}=t,{element:u,padding:f=0}=Yt(e,t)||{};if(u==null)return{};const d=Kc(f),h={x:r,y:n},p=ro(s),b=to(p),g=await i.getDimensions(u),y=p==="y",x=y?"top":"left",v=y?"bottom":"right",k=y?"clientHeight":"clientWidth",w=a.reference[b]+a.reference[p]-h[p]-a.floating[b],S=h[p]-a.reference[p],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let _=C?C[k]:0;(!_||!await(i.isElement==null?void 0:i.isElement(C)))&&(_=c.floating[k]||a.floating[b]);const N=w/2-S/2,I=_/2-g[b]/2-1,M=dr(d[x],I),B=dr(d[v],I),E=M,F=_-g[b]-B,T=_/2-g[b]/2+N,$=_a(E,T,F),O=!l.arrow&&Gr(s)!=null&&T!==$&&a.reference[b]/2-(T<E?M:B)-g[b]/2<0,A=O?T<E?T-E:T-F:0;return{[p]:h[p]+A,data:{[p]:$,centerOffset:T-$-A,...O&&{alignmentOffset:A}},reset:O}}}),Ih=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:a,rects:i,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...y}=Yt(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const x=Kt(s),v=Rt(c),k=Kt(c)===c,w=await(l.isRTL==null?void 0:l.isRTL(u.floating)),S=h||(k||!g?[as(c)]:Nh(c)),C=b!=="none";!h&&C&&S.push(...Rh(c,g,b,w));const _=[c,...S],N=await mn(t,y),I=[];let M=((n=a.flip)==null?void 0:n.overflows)||[];if(f&&I.push(N[x]),d){const T=Dh(s,i,w);I.push(N[T[0]],N[T[1]])}if(M=[...M,{placement:s,overflows:I}],!I.every(T=>T<=0)){var B,E;const T=(((B=a.flip)==null?void 0:B.index)||0)+1,$=_[T];if($&&(!(d==="alignment"?v!==Rt($):!1)||M.every(R=>Rt(R.placement)===v?R.overflows[0]>0:!0)))return{data:{index:T,overflows:M},reset:{placement:$}};let O=(E=M.filter(A=>A.overflows[0]<=0).sort((A,R)=>A.overflows[1]-R.overflows[1])[0])==null?void 0:E.placement;if(!O)switch(p){case"bestFit":{var F;const A=(F=M.filter(R=>{if(C){const V=Rt(R.placement);return V===v||V==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(V=>V>0).reduce((V,H)=>V+H,0)]).sort((R,V)=>R[1]-V[1])[0])==null?void 0:F[0];A&&(O=A);break}case"initialPlacement":O=c;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function ki(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ji(e){return Sh.some(t=>e[t]>=0)}const $h=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=Yt(e,t);switch(n){case"referenceHidden":{const a=await mn(t,{...s,elementContext:"reference"}),i=ki(a,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ji(i)}}}case"escaped":{const a=await mn(t,{...s,altBoundary:!0}),i=ki(a,r.floating);return{data:{escapedOffsets:i,escaped:ji(i)}}}default:return{}}}}},qc=new Set(["left","top"]);async function Fh(e,t){const{placement:r,platform:n,elements:s}=e,a=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=Kt(r),c=Gr(r),l=Rt(r)==="y",u=qc.has(i)?-1:1,f=a&&l?-1:1,d=Yt(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof b=="number"&&(p=c==="end"?b*-1:b),l?{x:p*f,y:h*u}:{x:h*u,y:p*f}}const Lh=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:a,placement:i,middlewareData:c}=t,l=await Fh(t,e);return i===((r=c.offset)==null?void 0:r.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:s+l.x,y:a+l.y,data:{...l,placement:i}}}}},Vh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:c={fn:y=>{let{x,y:v}=y;return{x,y:v}}},...l}=Yt(e,t),u={x:r,y:n},f=await mn(t,l),d=Rt(Kt(s)),h=eo(d);let p=u[h],b=u[d];if(a){const y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",v=p+f[y],k=p-f[x];p=_a(v,p,k)}if(i){const y=d==="y"?"top":"left",x=d==="y"?"bottom":"right",v=b+f[y],k=b-f[x];b=_a(v,b,k)}const g=c.fn({...t,[h]:p,[d]:b});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[h]:a,[d]:i}}}}}},zh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:a,middlewareData:i}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Yt(e,t),f={x:r,y:n},d=Rt(s),h=eo(d);let p=f[h],b=f[d];const g=Yt(c,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const k=h==="y"?"height":"width",w=a.reference[h]-a.floating[k]+y.mainAxis,S=a.reference[h]+a.reference[k]-y.mainAxis;p<w?p=w:p>S&&(p=S)}if(u){var x,v;const k=h==="y"?"width":"height",w=qc.has(Kt(s)),S=a.reference[d]-a.floating[k]+(w&&((x=i.offset)==null?void 0:x[d])||0)+(w?0:y.crossAxis),C=a.reference[d]+a.reference[k]+(w?0:((v=i.offset)==null?void 0:v[d])||0)-(w?y.crossAxis:0);b<S?b=S:b>C&&(b=C)}return{[h]:p,[d]:b}}}},Hh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:a,platform:i,elements:c}=t,{apply:l=()=>{},...u}=Yt(e,t),f=await mn(t,u),d=Kt(s),h=Gr(s),p=Rt(s)==="y",{width:b,height:g}=a.floating;let y,x;d==="top"||d==="bottom"?(y=d,x=h===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(x=d,y=h==="end"?"top":"bottom");const v=g-f.top-f.bottom,k=b-f.left-f.right,w=dr(g-f[y],v),S=dr(b-f[x],k),C=!t.middlewareData.shift;let _=w,N=S;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(N=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(_=v),C&&!h){const M=st(f.left,0),B=st(f.right,0),E=st(f.top,0),F=st(f.bottom,0);p?N=b-2*(M!==0||B!==0?M+B:st(f.left,f.right)):_=g-2*(E!==0||F!==0?E+F:st(f.top,f.bottom))}await l({...t,availableWidth:N,availableHeight:_});const I=await i.getDimensions(c.floating);return b!==I.width||g!==I.height?{reset:{rects:!0}}:{}}}};function js(){return typeof window<"u"}function Yr(e){return Xc(e)?(e.nodeName||"").toLowerCase():"#document"}function it(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ht(e){var t;return(t=(Xc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xc(e){return js()?e instanceof Node||e instanceof it(e).Node:!1}function wt(e){return js()?e instanceof Element||e instanceof it(e).Element:!1}function zt(e){return js()?e instanceof HTMLElement||e instanceof it(e).HTMLElement:!1}function Ci(e){return!js()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof it(e).ShadowRoot}const Bh=new Set(["inline","contents"]);function wn(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=_t(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Bh.has(s)}const Wh=new Set(["table","td","th"]);function Uh(e){return Wh.has(Yr(e))}const Zh=[":popover-open",":modal"];function Cs(e){return Zh.some(t=>{try{return e.matches(t)}catch{return!1}})}const Gh=["transform","translate","scale","rotate","perspective"],Yh=["transform","translate","scale","rotate","perspective","filter"],Kh=["paint","layout","strict","content"];function no(e){const t=so(),r=wt(e)?_t(e):e;return Gh.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||Yh.some(n=>(r.willChange||"").includes(n))||Kh.some(n=>(r.contain||"").includes(n))}function qh(e){let t=fr(e);for(;zt(t)&&!Ur(t);){if(no(t))return t;if(Cs(t))return null;t=fr(t)}return null}function so(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Xh=new Set(["html","body","#document"]);function Ur(e){return Xh.has(Yr(e))}function _t(e){return it(e).getComputedStyle(e)}function Ds(e){return wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fr(e){if(Yr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ci(e)&&e.host||Ht(e);return Ci(t)?t.host:t}function Jc(e){const t=fr(e);return Ur(t)?e.ownerDocument?e.ownerDocument.body:e.body:zt(t)&&wn(t)?t:Jc(t)}function pn(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Jc(e),a=s===((n=e.ownerDocument)==null?void 0:n.body),i=it(s);if(a){const c=ka(i);return t.concat(i,i.visualViewport||[],wn(s)?s:[],c&&r?pn(c):[])}return t.concat(s,pn(s,[],r))}function ka(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qc(e){const t=_t(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=zt(e),a=s?e.offsetWidth:r,i=s?e.offsetHeight:n,c=ss(r)!==a||ss(n)!==i;return c&&(r=a,n=i),{width:r,height:n,$:c}}function ao(e){return wt(e)?e:e.contextElement}function Ir(e){const t=ao(e);if(!zt(t))return Ft(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:a}=Qc(t);let i=(a?ss(r.width):r.width)/n,c=(a?ss(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Jh=Ft(0);function el(e){const t=it(e);return!so()||!t.visualViewport?Jh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qh(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==it(e)?!1:t}function Sr(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),a=ao(e);let i=Ft(1);t&&(n?wt(n)&&(i=Ir(n)):i=Ir(e));const c=Qh(a,r,n)?el(a):Ft(0);let l=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,f=s.width/i.x,d=s.height/i.y;if(a){const h=it(a),p=n&&wt(n)?it(n):n;let b=h,g=ka(b);for(;g&&n&&p!==b;){const y=Ir(g),x=g.getBoundingClientRect(),v=_t(g),k=x.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,w=x.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,u*=y.y,f*=y.x,d*=y.y,l+=k,u+=w,b=it(g),g=ka(b)}}return os({width:f,height:d,x:l,y:u})}function Ns(e,t){const r=Ds(e).scrollLeft;return t?t.left+r:Sr(Ht(e)).left+r}function tl(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-Ns(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function em(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const a=s==="fixed",i=Ht(n),c=t?Cs(t.floating):!1;if(n===i||c&&a)return r;let l={scrollLeft:0,scrollTop:0},u=Ft(1);const f=Ft(0),d=zt(n);if((d||!d&&!a)&&((Yr(n)!=="body"||wn(i))&&(l=Ds(n)),zt(n))){const p=Sr(n);u=Ir(n),f.x=p.x+n.clientLeft,f.y=p.y+n.clientTop}const h=i&&!d&&!a?tl(i,l):Ft(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+f.x+h.x,y:r.y*u.y-l.scrollTop*u.y+f.y+h.y}}function tm(e){return Array.from(e.getClientRects())}function rm(e){const t=Ht(e),r=Ds(e),n=e.ownerDocument.body,s=st(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=st(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Ns(e);const c=-r.scrollTop;return _t(n).direction==="rtl"&&(i+=st(t.clientWidth,n.clientWidth)-s),{width:s,height:a,x:i,y:c}}const Di=25;function nm(e,t){const r=it(e),n=Ht(e),s=r.visualViewport;let a=n.clientWidth,i=n.clientHeight,c=0,l=0;if(s){a=s.width,i=s.height;const f=so();(!f||f&&t==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}const u=Ns(n);if(u<=0){const f=n.ownerDocument,d=f.body,h=getComputedStyle(d),p=f.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,b=Math.abs(n.clientWidth-d.clientWidth-p);b<=Di&&(a-=b)}else u<=Di&&(a+=u);return{width:a,height:i,x:c,y:l}}const sm=new Set(["absolute","fixed"]);function am(e,t){const r=Sr(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,a=zt(e)?Ir(e):Ft(1),i=e.clientWidth*a.x,c=e.clientHeight*a.y,l=s*a.x,u=n*a.y;return{width:i,height:c,x:l,y:u}}function Ni(e,t,r){let n;if(t==="viewport")n=nm(e,r);else if(t==="document")n=rm(Ht(e));else if(wt(t))n=am(t,r);else{const s=el(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return os(n)}function rl(e,t){const r=fr(e);return r===t||!wt(r)||Ur(r)?!1:_t(r).position==="fixed"||rl(r,t)}function om(e,t){const r=t.get(e);if(r)return r;let n=pn(e,[],!1).filter(c=>wt(c)&&Yr(c)!=="body"),s=null;const a=_t(e).position==="fixed";let i=a?fr(e):e;for(;wt(i)&&!Ur(i);){const c=_t(i),l=no(i);!l&&c.position==="fixed"&&(s=null),(a?!l&&!s:!l&&c.position==="static"&&!!s&&sm.has(s.position)||wn(i)&&!l&&rl(e,i))?n=n.filter(f=>f!==i):s=c,i=fr(i)}return t.set(e,n),n}function im(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?Cs(t)?[]:om(t,this._c):[].concat(r),n],c=i[0],l=i.reduce((u,f)=>{const d=Ni(t,f,s);return u.top=st(d.top,u.top),u.right=dr(d.right,u.right),u.bottom=dr(d.bottom,u.bottom),u.left=st(d.left,u.left),u},Ni(t,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function cm(e){const{width:t,height:r}=Qc(e);return{width:t,height:r}}function lm(e,t,r){const n=zt(t),s=Ht(t),a=r==="fixed",i=Sr(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const l=Ft(0);function u(){l.x=Ns(s)}if(n||!n&&!a)if((Yr(t)!=="body"||wn(s))&&(c=Ds(t)),n){const p=Sr(t,!0,a,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else s&&u();a&&!n&&s&&u();const f=s&&!n&&!a?tl(s,c):Ft(0),d=i.left+c.scrollLeft-l.x-f.x,h=i.top+c.scrollTop-l.y-f.y;return{x:d,y:h,width:i.width,height:i.height}}function Xs(e){return _t(e).position==="static"}function Ei(e,t){if(!zt(e)||_t(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ht(e)===r&&(r=r.ownerDocument.body),r}function nl(e,t){const r=it(e);if(Cs(e))return r;if(!zt(e)){let s=fr(e);for(;s&&!Ur(s);){if(wt(s)&&!Xs(s))return s;s=fr(s)}return r}let n=Ei(e,t);for(;n&&Uh(n)&&Xs(n);)n=Ei(n,t);return n&&Ur(n)&&Xs(n)&&!no(n)?r:n||qh(e)||r}const um=async function(e){const t=this.getOffsetParent||nl,r=this.getDimensions,n=await r(e.floating);return{reference:lm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function dm(e){return _t(e).direction==="rtl"}const fm={convertOffsetParentRelativeRectToViewportRelativeRect:em,getDocumentElement:Ht,getClippingRect:im,getOffsetParent:nl,getElementRects:um,getClientRects:tm,getDimensions:cm,getScale:Ir,isElement:wt,isRTL:dm};function sl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hm(e,t){let r=null,n;const s=Ht(e);function a(){var c;clearTimeout(n),(c=r)==null||c.disconnect(),r=null}function i(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),a();const u=e.getBoundingClientRect(),{left:f,top:d,width:h,height:p}=u;if(c||t(),!h||!p)return;const b=On(d),g=On(s.clientWidth-(f+h)),y=On(s.clientHeight-(d+p)),x=On(f),k={rootMargin:-b+"px "+-g+"px "+-y+"px "+-x+"px",threshold:st(0,dr(1,l))||1};let w=!0;function S(C){const _=C[0].intersectionRatio;if(_!==l){if(!w)return i();_?i(!1,_):n=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!sl(u,e.getBoundingClientRect())&&i(),w=!1}try{r=new IntersectionObserver(S,{...k,root:s.ownerDocument})}catch{r=new IntersectionObserver(S,k)}r.observe(e)}return i(!0),a}function mm(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,u=ao(e),f=s||a?[...u?pn(u):[],...pn(t)]:[];f.forEach(x=>{s&&x.addEventListener("scroll",r,{passive:!0}),a&&x.addEventListener("resize",r)});const d=u&&c?hm(u,r):null;let h=-1,p=null;i&&(p=new ResizeObserver(x=>{let[v]=x;v&&v.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),r()}),u&&!l&&p.observe(u),p.observe(t));let b,g=l?Sr(e):null;l&&y();function y(){const x=Sr(e);g&&!sl(g,x)&&r(),g=x,b=requestAnimationFrame(y)}return r(),()=>{var x;f.forEach(v=>{s&&v.removeEventListener("scroll",r),a&&v.removeEventListener("resize",r)}),d?.(),(x=p)==null||x.disconnect(),p=null,l&&cancelAnimationFrame(b)}}const pm=Lh,gm=Vh,vm=Ih,ym=Hh,xm=$h,Ai=Oh,bm=zh,wm=(e,t,r)=>{const n=new Map,s={platform:fm,...r},a={...s.platform,_c:n};return Ph(e,t,{...s,platform:a})};var _m=typeof document<"u",Sm=function(){},Hn=_m?m.useLayoutEffect:Sm;function is(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!is(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const a=s[n];if(!(a==="_owner"&&e.$$typeof)&&!is(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function al(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ti(e,t){const r=al(e);return Math.round(t*r)/r}function Js(e){const t=j.useRef(e);return Hn(()=>{t.current=e}),t}function km(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:a,floating:i}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[f,d]=j.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=j.useState(n);is(h,n)||p(n);const[b,g]=j.useState(null),[y,x]=j.useState(null),v=j.useCallback(R=>{R!==C.current&&(C.current=R,g(R))},[]),k=j.useCallback(R=>{R!==_.current&&(_.current=R,x(R))},[]),w=a||b,S=i||y,C=j.useRef(null),_=j.useRef(null),N=j.useRef(f),I=l!=null,M=Js(l),B=Js(s),E=Js(u),F=j.useCallback(()=>{if(!C.current||!_.current)return;const R={placement:t,strategy:r,middleware:h};B.current&&(R.platform=B.current),wm(C.current,_.current,R).then(V=>{const H={...V,isPositioned:E.current!==!1};T.current&&!is(N.current,H)&&(N.current=H,fc.flushSync(()=>{d(H)}))})},[h,t,r,B,E]);Hn(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[u]);const T=j.useRef(!1);Hn(()=>(T.current=!0,()=>{T.current=!1}),[]),Hn(()=>{if(w&&(C.current=w),S&&(_.current=S),w&&S){if(M.current)return M.current(w,S,F);F()}},[w,S,F,M,I]);const $=j.useMemo(()=>({reference:C,floating:_,setReference:v,setFloating:k}),[v,k]),O=j.useMemo(()=>({reference:w,floating:S}),[w,S]),A=j.useMemo(()=>{const R={position:r,left:0,top:0};if(!O.floating)return R;const V=Ti(O.floating,f.x),H=Ti(O.floating,f.y);return c?{...R,transform:"translate("+V+"px, "+H+"px)",...al(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:V,top:H}},[r,c,O.floating,f.x,f.y]);return j.useMemo(()=>({...f,update:F,refs:$,elements:O,floatingStyles:A}),[f,F,$,O,A])}const jm=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Ai({element:n.current,padding:s}).fn(r):{}:n?Ai({element:n,padding:s}).fn(r):{}}}},Cm=(e,t)=>({...pm(e),options:[e,t]}),Dm=(e,t)=>({...gm(e),options:[e,t]}),Nm=(e,t)=>({...bm(e),options:[e,t]}),Em=(e,t)=>({...vm(e),options:[e,t]}),Am=(e,t)=>({...ym(e),options:[e,t]}),Tm=(e,t)=>({...xm(e),options:[e,t]}),Rm=(e,t)=>({...jm(e),options:[e,t]});var Mm="Arrow",ol=j.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...a}=e;return o.jsx($e.svg,{...a,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});ol.displayName=Mm;var Pm=ol,oo="Popper",[il,cl]=Ss(oo),[Om,ll]=il(oo),ul=e=>{const{__scopePopper:t,children:r}=e,[n,s]=j.useState(null);return o.jsx(Om,{scope:t,anchor:n,onAnchorChange:s,children:r})};ul.displayName=oo;var dl="PopperAnchor",fl=j.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,a=ll(dl,r),i=j.useRef(null),c=ct(t,i),l=j.useRef(null);return j.useEffect(()=>{const u=l.current;l.current=n?.current||i.current,u!==l.current&&a.onAnchorChange(l.current)}),n?null:o.jsx($e.div,{...s,ref:c})});fl.displayName=dl;var io="PopperContent",[Im,$m]=il(io),hl=j.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:a="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:b,...g}=e,y=ll(io,r),[x,v]=j.useState(null),k=ct(t,fe=>v(fe)),[w,S]=j.useState(null),C=Pc(w),_=C?.width??0,N=C?.height??0,I=n+(a!=="center"?"-"+a:""),M=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},B=Array.isArray(u)?u:[u],E=B.length>0,F={padding:M,boundary:B.filter(Lm),altBoundary:E},{refs:T,floatingStyles:$,placement:O,isPositioned:A,middlewareData:R}=km({strategy:"fixed",placement:I,whileElementsMounted:(...fe)=>mm(...fe,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[Cm({mainAxis:s+N,alignmentAxis:i}),l&&Dm({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Nm():void 0,...F}),l&&Em({...F}),Am({...F,apply:({elements:fe,rects:pe,availableWidth:Ae,availableHeight:xe})=>{const{width:Ze,height:Ge}=pe.reference,qe=fe.floating.style;qe.setProperty("--radix-popper-available-width",`${Ae}px`),qe.setProperty("--radix-popper-available-height",`${xe}px`),qe.setProperty("--radix-popper-anchor-width",`${Ze}px`),qe.setProperty("--radix-popper-anchor-height",`${Ge}px`)}}),w&&Rm({element:w,padding:c}),Vm({arrowWidth:_,arrowHeight:N}),h&&Tm({strategy:"referenceHidden",...F})]}),[V,H]=gl(O),Q=Wr(b);ur(()=>{A&&Q?.()},[A,Q]);const Y=R.arrow?.x,z=R.arrow?.y,W=R.arrow?.centerOffset!==0,[se,ne]=j.useState();return ur(()=>{x&&ne(window.getComputedStyle(x).zIndex)},[x]),o.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:A?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(" "),...R.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Im,{scope:r,placedSide:V,onArrowChange:S,arrowX:Y,arrowY:z,shouldHideArrow:W,children:o.jsx($e.div,{"data-side":V,"data-align":H,...g,ref:k,style:{...g.style,animation:A?void 0:"none"}})})})});hl.displayName=io;var ml="PopperArrow",Fm={top:"bottom",right:"left",bottom:"top",left:"right"},pl=j.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,a=$m(ml,n),i=Fm[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:o.jsx(Pm,{...s,ref:r,style:{...s.style,display:"block"}})})});pl.displayName=ml;function Lm(e){return e!==null}var Vm=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[u,f]=gl(r),d={start:"0%",center:"50%",end:"100%"}[f],h=(s.arrow?.x??0)+c/2,p=(s.arrow?.y??0)+l/2;let b="",g="";return u==="bottom"?(b=i?d:`${h}px`,g=`${-l}px`):u==="top"?(b=i?d:`${h}px`,g=`${n.floating.height+l}px`):u==="right"?(b=`${-l}px`,g=i?d:`${p}px`):u==="left"&&(b=`${n.floating.width+l}px`,g=i?d:`${p}px`),{data:{x:b,y:g}}}});function gl(e){const[t,r="center"]=e.split("-");return[t,r]}var zm=ul,vl=fl,Hm=hl,Bm=pl,Wm="Portal",co=j.forwardRef((e,t)=>{const{container:r,...n}=e,[s,a]=j.useState(!1);ur(()=>a(!0),[]);const i=r||s&&globalThis?.document?.body;return i?vr.createPortal(o.jsx($e.div,{...n,ref:t}),i):null});co.displayName=Wm;var Um=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Er=new WeakMap,In=new WeakMap,$n={},Qs=0,yl=function(e){return e&&(e.host||yl(e.parentNode))},Zm=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=yl(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Gm=function(e,t,r,n){var s=Zm(t,Array.isArray(e)?e:[e]);$n[r]||($n[r]=new WeakMap);var a=$n[r],i=[],c=new Set,l=new Set(s),u=function(d){!d||c.has(d)||(c.add(d),u(d.parentNode))};s.forEach(u);var f=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(h){if(c.has(h))f(h);else try{var p=h.getAttribute(n),b=p!==null&&p!=="false",g=(Er.get(h)||0)+1,y=(a.get(h)||0)+1;Er.set(h,g),a.set(h,y),i.push(h),g===1&&b&&In.set(h,!0),y===1&&h.setAttribute(r,"true"),b||h.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return f(t),c.clear(),Qs++,function(){i.forEach(function(d){var h=Er.get(d)-1,p=a.get(d)-1;Er.set(d,h),a.set(d,p),h||(In.has(d)||d.removeAttribute(n),In.delete(d)),p||d.removeAttribute(r)}),Qs--,Qs||(Er=new WeakMap,Er=new WeakMap,In=new WeakMap,$n={})}},xl=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=Um(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Gm(n,s,r,"aria-hidden")):function(){return null}},Et=function(){return Et=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Et.apply(this,arguments)};function bl(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function Ym(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var Bn="right-scroll-bar-position",Wn="width-before-scroll-bar",Km="with-scroll-bars-hidden",qm="--removed-body-scroll-bar-size";function ea(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Xm(e,t){var r=m.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Jm=typeof window<"u"?j.useLayoutEffect:j.useEffect,Ri=new WeakMap;function Qm(e,t){var r=Xm(null,function(n){return e.forEach(function(s){return ea(s,n)})});return Jm(function(){var n=Ri.get(r);if(n){var s=new Set(n),a=new Set(e),i=r.current;s.forEach(function(c){a.has(c)||ea(c,null)}),a.forEach(function(c){s.has(c)||ea(c,i)})}Ri.set(r,e)},[e]),r}function ep(e){return e}function tp(e,t){t===void 0&&(t=ep);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var i=t(a,n);return r.push(i),function(){r=r.filter(function(c){return c!==i})}},assignSyncMedium:function(a){for(n=!0;r.length;){var i=r;r=[],i.forEach(a)}r={push:function(c){return a(c)},filter:function(){return r}}},assignMedium:function(a){n=!0;var i=[];if(r.length){var c=r;r=[],c.forEach(a),i=r}var l=function(){var f=i;i=[],f.forEach(a)},u=function(){return Promise.resolve().then(l)};u(),r={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),r}}}};return s}function rp(e){e===void 0&&(e={});var t=tp(null);return t.options=Et({async:!0,ssr:!1},e),t}var wl=function(e){var t=e.sideCar,r=bl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return j.createElement(n,Et({},r))};wl.isSideCarExport=!0;function np(e,t){return e.useMedium(t),wl}var _l=rp(),ta=function(){},Es=j.forwardRef(function(e,t){var r=j.useRef(null),n=j.useState({onScrollCapture:ta,onWheelCapture:ta,onTouchMoveCapture:ta}),s=n[0],a=n[1],i=e.forwardProps,c=e.children,l=e.className,u=e.removeScrollBar,f=e.enabled,d=e.shards,h=e.sideCar,p=e.noRelative,b=e.noIsolation,g=e.inert,y=e.allowPinchZoom,x=e.as,v=x===void 0?"div":x,k=e.gapMode,w=bl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,C=Qm([r,t]),_=Et(Et({},w),s);return j.createElement(j.Fragment,null,f&&j.createElement(S,{sideCar:_l,removeScrollBar:u,shards:d,noRelative:p,noIsolation:b,inert:g,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:k}),i?j.cloneElement(j.Children.only(c),Et(Et({},_),{ref:C})):j.createElement(v,Et({},_,{className:l,ref:C}),c))});Es.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Es.classNames={fullWidth:Wn,zeroRight:Bn};var sp=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ap(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=sp();return t&&e.setAttribute("nonce",t),e}function op(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ip(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var cp=function(){var e=0,t=null;return{add:function(r){e==0&&(t=ap())&&(op(t,r),ip(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},lp=function(){var e=cp();return function(t,r){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Sl=function(){var e=lp(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},up={left:0,top:0,right:0,gap:0},ra=function(e){return parseInt(e||"",10)||0},dp=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[ra(r),ra(n),ra(s)]},fp=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return up;var t=dp(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},hp=Sl(),$r="data-scroll-locked",mp=function(e,t,r,n){var s=e.left,a=e.top,i=e.right,c=e.gap;return r===void 0&&(r="margin"),`
|
|
2
|
+
.`.concat(Km,` {
|
|
3
3
|
overflow: hidden `).concat(n,`;
|
|
4
4
|
padding-right: `).concat(c,"px ").concat(n,`;
|
|
5
5
|
}
|
|
@@ -33,60 +33,60 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
body[`).concat($r,`] {
|
|
36
|
-
`).concat(
|
|
36
|
+
`).concat(qm,": ").concat(c,`px;
|
|
37
37
|
}
|
|
38
|
-
`)},
|
|
38
|
+
`)},Mi=function(){var e=parseInt(document.body.getAttribute($r)||"0",10);return isFinite(e)?e:0},pp=function(){j.useEffect(function(){return document.body.setAttribute($r,(Mi()+1).toString()),function(){var e=Mi()-1;e<=0?document.body.removeAttribute($r):document.body.setAttribute($r,e.toString())}},[])},gp=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;pp();var a=j.useMemo(function(){return fp(s)},[s]);return j.createElement(hp,{styles:mp(a,!t,s,r?"":"!important")})},ja=!1;if(typeof window<"u")try{var Fn=Object.defineProperty({},"passive",{get:function(){return ja=!0,!0}});window.addEventListener("test",Fn,Fn),window.removeEventListener("test",Fn,Fn)}catch{ja=!1}var Ar=ja?{passive:!1}:!1,vp=function(e){return e.tagName==="TEXTAREA"},kl=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!vp(e)&&r[t]==="visible")},yp=function(e){return kl(e,"overflowY")},xp=function(e){return kl(e,"overflowX")},Pi=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=jl(e,n);if(s){var a=Cl(e,n),i=a[1],c=a[2];if(i>c)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},bp=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},wp=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},jl=function(e,t){return e==="v"?yp(t):xp(t)},Cl=function(e,t){return e==="v"?bp(t):wp(t)},_p=function(e,t){return e==="h"&&t==="rtl"?-1:1},Sp=function(e,t,r,n,s){var a=_p(e,window.getComputedStyle(t).direction),i=a*n,c=r.target,l=t.contains(c),u=!1,f=i>0,d=0,h=0;do{if(!c)break;var p=Cl(e,c),b=p[0],g=p[1],y=p[2],x=g-y-a*b;(b||x)&&jl(e,c)&&(d+=x,h+=b);var v=c.parentNode;c=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(f&&Math.abs(d)<1||!f&&Math.abs(h)<1)&&(u=!0),u},Ln=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Oi=function(e){return[e.deltaX,e.deltaY]},Ii=function(e){return e&&"current"in e?e.current:e},kp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},jp=function(e){return`
|
|
39
39
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
40
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},rp=0,Tr=[];function np(e){var t=C.useRef([]),r=C.useRef([0,0]),n=C.useRef(),s=C.useState(rp++)[0],a=C.useState(ll)[0],i=C.useRef(e);C.useEffect(function(){i.current=e},[e]),C.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=km([e.lockRef.current],(e.shards||[]).map(ji),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=C.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var x=Ln(g),v=r.current,_="deltaX"in g?g.deltaX:v[0]-x[0],w="deltaY"in g?g.deltaY:v[1]-x[1],S,k=g.target,j=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in g&&j==="h"&&k.type==="range")return!1;var E=window.getSelection(),I=E&&E.anchorNode,M=I?I===k||I.contains(k):!1;if(M)return!1;var H=ki(j,k);if(!H)return!0;if(H?S=j:(S=j==="v"?"h":"v",H=ki(j,k)),!H)return!1;if(!n.current&&"changedTouches"in g&&(_||w)&&(n.current=S),!S)return!0;var N=n.current||S;return Qm(N,y,g,N==="h"?_:w)},[]),l=C.useCallback(function(g){var y=g;if(!(!Tr.length||Tr[Tr.length-1]!==a)){var x="deltaY"in y?Ci(y):Ln(y),v=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&ep(S.delta,x)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var _=(i.current.shards||[]).map(ji).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=_.length>0?c(y,_[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),u=C.useCallback(function(g,y,x,v){var _={name:g,delta:y,target:x,should:v,shadowParent:sp(x)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(w){return w!==_})},1)},[]),f=C.useCallback(function(g){r.current=Ln(g),n.current=void 0},[]),d=C.useCallback(function(g){u(g.type,Ci(g),g.target,c(g,e.lockRef.current))},[]),h=C.useCallback(function(g){u(g.type,Ln(g),g.target,c(g,e.lockRef.current))},[]);C.useEffect(function(){return Tr.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Ar),document.addEventListener("touchmove",l,Ar),document.addEventListener("touchstart",f,Ar),function(){Tr=Tr.filter(function(g){return g!==a}),document.removeEventListener("wheel",l,Ar),document.removeEventListener("touchmove",l,Ar),document.removeEventListener("touchstart",f,Ar)}},[]);var m=e.removeScrollBar,b=e.inert;return C.createElement(C.Fragment,null,b?C.createElement(a,{styles:tp(s)}):null,m?C.createElement(Zm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ap=Pm(cl,np);var eo=C.forwardRef(function(e,t){return C.createElement(js,Et({},e,{ref:t,sideCar:ap}))});eo.classNames=js.classNames;var Ds="Popover",[hl]=bs(Ds,[Gc]),_n=Gc(),[op,fr]=hl(Ds),ml=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!1}=e,c=_n(t),l=C.useRef(null),[u,f]=C.useState(!1),[d,h]=Fa({prop:n,defaultProp:s??!1,onChange:a,caller:Ds});return o.jsx(vm,{...c,children:o.jsx(op,{scope:t,contentId:zn(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:C.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:u,onCustomAnchorAdd:C.useCallback(()=>f(!0),[]),onCustomAnchorRemove:C.useCallback(()=>f(!1),[]),modal:i,children:r})})};ml.displayName=Ds;var pl="PopoverAnchor",ip=C.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=fr(pl,r),a=_n(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=s;return C.useEffect(()=>(i(),()=>c()),[i,c]),o.jsx(nl,{...a,...n,ref:t})});ip.displayName=pl;var gl="PopoverTrigger",vl=C.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=fr(gl,r),a=_n(r),i=ct(t,s.triggerRef),c=o.jsx(Ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":_l(s.open),...n,ref:i,onClick:Be(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(nl,{asChild:!0,...a,children:c})});vl.displayName=gl;var to="PopoverPortal",[cp,lp]=hl(to,{forceMount:void 0}),yl=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,a=fr(to,t);return o.jsx(cp,{scope:t,forceMount:r,children:o.jsx(Cr,{present:r||a.open,children:o.jsx(Qa,{asChild:!0,container:s,children:n})})})};yl.displayName=to;var Zr="PopoverContent",xl=C.forwardRef((e,t)=>{const r=lp(Zr,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,a=fr(Zr,e.__scopePopover);return o.jsx(Cr,{present:n||a.open,children:a.modal?o.jsx(dp,{...s,ref:t}):o.jsx(fp,{...s,ref:t})})});xl.displayName=Zr;var up=La("PopoverContent.RemoveScroll"),dp=C.forwardRef((e,t)=>{const r=fr(Zr,e.__scopePopover),n=C.useRef(null),s=ct(t,n),a=C.useRef(!1);return C.useEffect(()=>{const i=n.current;if(i)return al(i)},[]),o.jsx(eo,{as:up,allowPinchZoom:!0,children:o.jsx(bl,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,i=>{i.preventDefault(),a.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Be(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),fp=C.forwardRef((e,t)=>{const r=fr(Zr,e.__scopePopover),n=C.useRef(!1),s=C.useRef(!1);return o.jsx(bl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;r.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),bl=C.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,...d}=e,h=fr(Zr,r),m=_n(r);return Pc(),o.jsx(Wa,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(Ba,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:o.jsx(ym,{"data-state":_l(h.open),role:"dialog",id:h.contentId,...m,...d,ref:t,style:{...d.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)"}})})})}),wl="PopoverClose",hp=C.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=fr(wl,r);return o.jsx(Ie.button,{type:"button",...n,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});hp.displayName=wl;var mp="PopoverArrow",pp=C.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=_n(r);return o.jsx(xm,{...s,...n,ref:t})});pp.displayName=mp;function _l(e){return e?"open":"closed"}var gp=ml,vp=vl,yp=yl,Sl=xl;const xp=gp,bp=vp,kl=C.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>o.jsx(yp,{children:o.jsx(Sl,{ref:s,align:t,sideOffset:r,className:de("z-[100] rounded-md border bg-popover p-[var(--ui-space-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-[var(--ui-space-2)] data-[side=left]:slide-in-from-right-[var(--ui-space-2)] data-[side=right]:slide-in-from-left-[var(--ui-space-2)] data-[side=top]:slide-in-from-bottom-[var(--ui-space-2)]",e),...n})}));kl.displayName=Sl.displayName;function ro(e){const{className:t,label:r,disabled:n,minDate:s,maxDate:a,monthsShown:i=1,selectsRange:c}=e,{t:l,i18n:u}=Le(),f=u.language?.startsWith("ja")?"ja-JP":"en-US",d=r??l("date_picker_label"),h=c?void 0:e.value??e.date,m=_=>{const w=_;c||(e.onChange&&e.onChange(w??null),e.setDate&&e.setDate(w))},b=c?{from:e.startDate??void 0,to:e.endDate??void 0}:void 0,g=_=>{const w=_;c&&e.onRangeChange&&e.onRangeChange([w?.from??null,w?.to??null])},y=[...s?[{before:s}]:[],...a?[{after:a}]:[]];let x=d;const v=c?!!b?.from:!!h;return c&&b?.from?(x=Ne(b.from,f,"picker"),b.to&&(x+=` - ${Ne(b.to,f,"picker")}`)):!c&&h&&(x=Ne(h,f,"picker")),o.jsxs(xp,{modal:!0,children:[o.jsx(bp,{asChild:!0,children:o.jsxs(oe,{variant:"outline",disabled:n,className:de("w-full justify-start text-left font-normal",!v&&"opacity-70",t),children:[o.jsx(ye.Calendar,{className:"me-2 h-ui-icon w-ui-icon"}),x]})}),o.jsx(kl,{className:"w-auto p-[var(--ui-space-0)]",align:"start",children:c?o.jsx(ni,{mode:"range",defaultMonth:b?.from,selected:b,onSelect:g,numberOfMonths:i,disabled:y,locale:f}):o.jsx(ni,{mode:"single",selected:h,defaultMonth:h,onSelect:m,numberOfMonths:i,disabled:y,locale:f})})]})}const Cl=C.forwardRef(({className:e,children:t,...r},n)=>o.jsx("label",{ref:n,className:de("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...r,children:t}));Cl.displayName="Label";const no=sd,jl=C.createContext({}),Re=({...e})=>o.jsx(jl.Provider,{value:{name:e.name},children:o.jsx(cd,{...e})}),Ns=()=>{const e=C.useContext(jl),t=C.useContext(Dl),{getFieldState:r,formState:n}=ys(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...s}},Dl=C.createContext({}),De=C.forwardRef(({className:e,...t},r)=>{const n=C.useId();return o.jsx(Dl.Provider,{value:{id:n},children:o.jsx("div",{ref:r,className:de("space-y-[var(--ui-space-2)]",e),...t})})});De.displayName="FormItem";const _e=C.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Ns();return o.jsx(Cl,{ref:r,className:de(n&&"text-destructive",e),htmlFor:s,...t})});_e.displayName="FormLabel";const be=C.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:a}=Ns();return o.jsx("div",{ref:t,id:n,"aria-describedby":r?`${s} ${a}`:`${s}`,"aria-invalid":!!r,...e})});be.displayName="FormControl";const nt=C.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:a}=Ns(),i=s?String(s?.message):t;return i?o.jsx("p",{ref:n,id:a,className:de("text-sm font-medium text-destructive",e),...r,children:i}):null});nt.displayName="FormMessage";var Es="Dialog",[Nl]=bs(Es),[wp,kt]=Nl(Es),El=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,c=C.useRef(null),l=C.useRef(null),[u,f]=Fa({prop:n,defaultProp:s??!1,onChange:a,caller:Es});return o.jsx(wp,{scope:t,triggerRef:c,contentRef:l,contentId:zn(),titleId:zn(),descriptionId:zn(),open:u,onOpenChange:f,onOpenToggle:C.useCallback(()=>f(d=>!d),[f]),modal:i,children:r})};El.displayName=Es;var Al="DialogTrigger",Tl=C.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(Al,r),a=ct(t,s.triggerRef);return o.jsx(Ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":oo(s.open),...n,ref:a,onClick:Be(e.onClick,s.onOpenToggle)})});Tl.displayName=Al;var so="DialogPortal",[_p,Rl]=Nl(so,{forceMount:void 0}),Pl=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=kt(so,t);return o.jsx(_p,{scope:t,forceMount:r,children:C.Children.map(n,i=>o.jsx(Cr,{present:r||a.open,children:o.jsx(Qa,{asChild:!0,container:s,children:i})}))})};Pl.displayName=so;var is="DialogOverlay",Ml=C.forwardRef((e,t)=>{const r=Rl(is,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=kt(is,e.__scopeDialog);return a.modal?o.jsx(Cr,{present:n||a.open,children:o.jsx(kp,{...s,ref:t})}):null});Ml.displayName=is;var Sp=La("DialogOverlay.RemoveScroll"),kp=C.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(is,r);return o.jsx(eo,{as:Sp,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(Ie.div,{"data-state":oo(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Sr="DialogContent",Ol=C.forwardRef((e,t)=>{const r=Rl(Sr,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=kt(Sr,e.__scopeDialog);return o.jsx(Cr,{present:n||a.open,children:a.modal?o.jsx(Cp,{...s,ref:t}):o.jsx(jp,{...s,ref:t})})});Ol.displayName=Sr;var Cp=C.forwardRef((e,t)=>{const r=kt(Sr,e.__scopeDialog),n=C.useRef(null),s=ct(t,r.contentRef,n);return C.useEffect(()=>{const a=n.current;if(a)return al(a)},[]),o.jsx(Il,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,a=>a.preventDefault())})}),jp=C.forwardRef((e,t)=>{const r=kt(Sr,e.__scopeDialog),n=C.useRef(!1),s=C.useRef(!1);return o.jsx(Il,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;r.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),Il=C.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...i}=e,c=kt(Sr,r),l=C.useRef(null),u=ct(t,l);return Pc(),o.jsxs(o.Fragment,{children:[o.jsx(Wa,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(Ba,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":oo(c.open),...i,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Dp,{titleId:c.titleId}),o.jsx(Ep,{contentRef:l,descriptionId:c.descriptionId})]})]})}),ao="DialogTitle",$l=C.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(ao,r);return o.jsx(Ie.h2,{id:s.titleId,...n,ref:t})});$l.displayName=ao;var Fl="DialogDescription",Ll=C.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(Fl,r);return o.jsx(Ie.p,{id:s.descriptionId,...n,ref:t})});Ll.displayName=Fl;var Vl="DialogClose",zl=C.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(Vl,r);return o.jsx(Ie.button,{type:"button",...n,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});zl.displayName=Vl;function oo(e){return e?"open":"closed"}var Hl="DialogTitleWarning",[Ly,Bl]=uf(Hl,{contentName:Sr,titleName:ao,docsSlug:"dialog"}),Dp=({titleId:e})=>{const t=Bl(Hl),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
41
|
+
`)},Cp=0,Tr=[];function Dp(e){var t=j.useRef([]),r=j.useRef([0,0]),n=j.useRef(),s=j.useState(Cp++)[0],a=j.useState(Sl)[0],i=j.useRef(e);j.useEffect(function(){i.current=e},[e]),j.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=Ym([e.lockRef.current],(e.shards||[]).map(Ii),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=j.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var x=Ln(g),v=r.current,k="deltaX"in g?g.deltaX:v[0]-x[0],w="deltaY"in g?g.deltaY:v[1]-x[1],S,C=g.target,_=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in g&&_==="h"&&C.type==="range")return!1;var N=window.getSelection(),I=N&&N.anchorNode,M=I?I===C||I.contains(C):!1;if(M)return!1;var B=Pi(_,C);if(!B)return!0;if(B?S=_:(S=_==="v"?"h":"v",B=Pi(_,C)),!B)return!1;if(!n.current&&"changedTouches"in g&&(k||w)&&(n.current=S),!S)return!0;var E=n.current||S;return Sp(E,y,g,E==="h"?k:w)},[]),l=j.useCallback(function(g){var y=g;if(!(!Tr.length||Tr[Tr.length-1]!==a)){var x="deltaY"in y?Oi(y):Ln(y),v=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&kp(S.delta,x)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var k=(i.current.shards||[]).map(Ii).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=k.length>0?c(y,k[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),u=j.useCallback(function(g,y,x,v){var k={name:g,delta:y,target:x,should:v,shadowParent:Np(x)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(w){return w!==k})},1)},[]),f=j.useCallback(function(g){r.current=Ln(g),n.current=void 0},[]),d=j.useCallback(function(g){u(g.type,Oi(g),g.target,c(g,e.lockRef.current))},[]),h=j.useCallback(function(g){u(g.type,Ln(g),g.target,c(g,e.lockRef.current))},[]);j.useEffect(function(){return Tr.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Ar),document.addEventListener("touchmove",l,Ar),document.addEventListener("touchstart",f,Ar),function(){Tr=Tr.filter(function(g){return g!==a}),document.removeEventListener("wheel",l,Ar),document.removeEventListener("touchmove",l,Ar),document.removeEventListener("touchstart",f,Ar)}},[]);var p=e.removeScrollBar,b=e.inert;return j.createElement(j.Fragment,null,b?j.createElement(a,{styles:jp(s)}):null,p?j.createElement(gp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Np(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Ep=np(_l,Dp);var lo=j.forwardRef(function(e,t){return j.createElement(Es,Et({},e,{ref:t,sideCar:Ep}))});lo.classNames=Es.classNames;var As="Popover",[Dl]=Ss(As,[cl]),_n=cl(),[Ap,hr]=Dl(As),Nl=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!1}=e,c=_n(t),l=j.useRef(null),[u,f]=j.useState(!1),[d,h]=Ga({prop:n,defaultProp:s??!1,onChange:a,caller:As});return o.jsx(zm,{...c,children:o.jsx(Ap,{scope:t,contentId:zn(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:j.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:j.useCallback(()=>f(!0),[]),onCustomAnchorRemove:j.useCallback(()=>f(!1),[]),modal:i,children:r})})};Nl.displayName=As;var El="PopoverAnchor",Tp=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=hr(El,r),a=_n(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=s;return j.useEffect(()=>(i(),()=>c()),[i,c]),o.jsx(vl,{...a,...n,ref:t})});Tp.displayName=El;var Al="PopoverTrigger",Tl=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=hr(Al,r),a=_n(r),i=ct(t,s.triggerRef),c=o.jsx($e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Il(s.open),...n,ref:i,onClick:Be(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(vl,{asChild:!0,...a,children:c})});Tl.displayName=Al;var uo="PopoverPortal",[Rp,Mp]=Dl(uo,{forceMount:void 0}),Rl=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,a=hr(uo,t);return o.jsx(Rp,{scope:t,forceMount:r,children:o.jsx(jr,{present:r||a.open,children:o.jsx(co,{asChild:!0,container:s,children:n})})})};Rl.displayName=uo;var Zr="PopoverContent",Ml=j.forwardRef((e,t)=>{const r=Mp(Zr,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,a=hr(Zr,e.__scopePopover);return o.jsx(jr,{present:n||a.open,children:a.modal?o.jsx(Op,{...s,ref:t}):o.jsx(Ip,{...s,ref:t})})});Ml.displayName=Zr;var Pp=Ya("PopoverContent.RemoveScroll"),Op=j.forwardRef((e,t)=>{const r=hr(Zr,e.__scopePopover),n=j.useRef(null),s=ct(t,n),a=j.useRef(!1);return j.useEffect(()=>{const i=n.current;if(i)return xl(i)},[]),o.jsx(lo,{as:Pp,allowPinchZoom:!0,children:o.jsx(Pl,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,i=>{i.preventDefault(),a.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Be(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ip=j.forwardRef((e,t)=>{const r=hr(Zr,e.__scopePopover),n=j.useRef(!1),s=j.useRef(!1);return o.jsx(Pl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;r.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),Pl=j.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,...d}=e,h=hr(Zr,r),p=_n(r);return Gc(),o.jsx(Qa,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(Ja,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:o.jsx(Hm,{"data-state":Il(h.open),role:"dialog",id:h.contentId,...p,...d,ref:t,style:{...d.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)"}})})})}),Ol="PopoverClose",$p=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=hr(Ol,r);return o.jsx($e.button,{type:"button",...n,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});$p.displayName=Ol;var Fp="PopoverArrow",Lp=j.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=_n(r);return o.jsx(Bm,{...s,...n,ref:t})});Lp.displayName=Fp;function Il(e){return e?"open":"closed"}var Vp=Nl,zp=Tl,Hp=Rl,$l=Ml;const Bp=Vp,Wp=zp,Fl=j.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>o.jsx(Hp,{children:o.jsx($l,{ref:s,align:t,sideOffset:r,className:de("z-[100] rounded-md border bg-popover p-[var(--ui-space-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-[var(--ui-space-2)] data-[side=left]:slide-in-from-right-[var(--ui-space-2)] data-[side=right]:slide-in-from-left-[var(--ui-space-2)] data-[side=top]:slide-in-from-bottom-[var(--ui-space-2)]",e),...n})}));Fl.displayName=$l.displayName;function fo(e){const{className:t,label:r,disabled:n,minDate:s,maxDate:a,monthsShown:i=1,selectsRange:c}=e,{t:l,i18n:u}=Fe(),f=u.language?.startsWith("ja")?"ja-JP":"en-US",d=r??l("date_picker_label"),h=c?void 0:e.value??e.date,p=k=>{const w=k;c||(e.onChange&&e.onChange(w??null),e.setDate&&e.setDate(w))},b=c?{from:e.startDate??void 0,to:e.endDate??void 0}:void 0,g=k=>{const w=k;c&&e.onRangeChange&&e.onRangeChange([w?.from??null,w?.to??null])},y=[...s?[{before:s}]:[],...a?[{after:a}]:[]];let x=d;const v=c?!!b?.from:!!h;return c&&b?.from?(x=Ne(b.from,f,"picker"),b.to&&(x+=` - ${Ne(b.to,f,"picker")}`)):!c&&h&&(x=Ne(h,f,"picker")),o.jsxs(Bp,{modal:!0,children:[o.jsx(Wp,{asChild:!0,children:o.jsxs(ae,{variant:"outline",disabled:n,className:de("w-full justify-start text-left font-normal",!v&&"opacity-70",t),children:[o.jsx(ye.Calendar,{className:"me-2 h-ui-icon w-ui-icon"}),x]})}),o.jsx(Fl,{className:"w-auto p-[var(--ui-space-0)]",align:"start",children:c?o.jsx(hi,{mode:"range",defaultMonth:b?.from,selected:b,onSelect:g,numberOfMonths:i,disabled:y,locale:f}):o.jsx(hi,{mode:"single",selected:h,defaultMonth:h,onSelect:p,numberOfMonths:i,disabled:y,locale:f})})]})}const Ll=j.forwardRef(({className:e,children:t,...r},n)=>o.jsx("label",{ref:n,className:de("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...r,children:t}));Ll.displayName="Label";const ho=Nd,Vl=j.createContext({}),Re=({...e})=>o.jsx(Vl.Provider,{value:{name:e.name},children:o.jsx(Rd,{...e})}),Ts=()=>{const e=j.useContext(Vl),t=j.useContext(zl),{getFieldState:r,formState:n}=ws(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...s}},zl=j.createContext({}),De=j.forwardRef(({className:e,...t},r)=>{const n=j.useId();return o.jsx(zl.Provider,{value:{id:n},children:o.jsx("div",{ref:r,className:de("space-y-[var(--ui-space-2)]",e),...t})})});De.displayName="FormItem";const _e=j.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Ts();return o.jsx(Ll,{ref:r,className:de(n&&"text-destructive",e),htmlFor:s,...t})});_e.displayName="FormLabel";const be=j.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:a}=Ts();return o.jsx("div",{ref:t,id:n,"aria-describedby":r?`${s} ${a}`:`${s}`,"aria-invalid":!!r,...e})});be.displayName="FormControl";const nt=j.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:a}=Ts(),i=s?String(s?.message):t;return i?o.jsx("p",{ref:n,id:a,className:de("text-sm font-medium text-destructive",e),...r,children:i}):null});nt.displayName="FormMessage";var Rs="Dialog",[Hl]=Ss(Rs),[Up,kt]=Hl(Rs),Bl=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,c=j.useRef(null),l=j.useRef(null),[u,f]=Ga({prop:n,defaultProp:s??!1,onChange:a,caller:Rs});return o.jsx(Up,{scope:t,triggerRef:c,contentRef:l,contentId:zn(),titleId:zn(),descriptionId:zn(),open:u,onOpenChange:f,onOpenToggle:j.useCallback(()=>f(d=>!d),[f]),modal:i,children:r})};Bl.displayName=Rs;var Wl="DialogTrigger",Ul=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(Wl,r),a=ct(t,s.triggerRef);return o.jsx($e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":go(s.open),...n,ref:a,onClick:Be(e.onClick,s.onOpenToggle)})});Ul.displayName=Wl;var mo="DialogPortal",[Zp,Zl]=Hl(mo,{forceMount:void 0}),Gl=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=kt(mo,t);return o.jsx(Zp,{scope:t,forceMount:r,children:j.Children.map(n,i=>o.jsx(jr,{present:r||a.open,children:o.jsx(co,{asChild:!0,container:s,children:i})}))})};Gl.displayName=mo;var cs="DialogOverlay",Yl=j.forwardRef((e,t)=>{const r=Zl(cs,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=kt(cs,e.__scopeDialog);return a.modal?o.jsx(jr,{present:n||a.open,children:o.jsx(Yp,{...s,ref:t})}):null});Yl.displayName=cs;var Gp=Ya("DialogOverlay.RemoveScroll"),Yp=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(cs,r);return o.jsx(lo,{as:Gp,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx($e.div,{"data-state":go(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),kr="DialogContent",Kl=j.forwardRef((e,t)=>{const r=Zl(kr,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=kt(kr,e.__scopeDialog);return o.jsx(jr,{present:n||a.open,children:a.modal?o.jsx(Kp,{...s,ref:t}):o.jsx(qp,{...s,ref:t})})});Kl.displayName=kr;var Kp=j.forwardRef((e,t)=>{const r=kt(kr,e.__scopeDialog),n=j.useRef(null),s=ct(t,r.contentRef,n);return j.useEffect(()=>{const a=n.current;if(a)return xl(a)},[]),o.jsx(ql,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Be(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,a=>a.preventDefault())})}),qp=j.forwardRef((e,t)=>{const r=kt(kr,e.__scopeDialog),n=j.useRef(!1),s=j.useRef(!1);return o.jsx(ql,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;r.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),ql=j.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...i}=e,c=kt(kr,r),l=j.useRef(null),u=ct(t,l);return Gc(),o.jsxs(o.Fragment,{children:[o.jsx(Qa,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(Ja,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":go(c.open),...i,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Xp,{titleId:c.titleId}),o.jsx(Qp,{contentRef:l,descriptionId:c.descriptionId})]})]})}),po="DialogTitle",Xl=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(po,r);return o.jsx($e.h2,{id:s.titleId,...n,ref:t})});Xl.displayName=po;var Jl="DialogDescription",Ql=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(Jl,r);return o.jsx($e.p,{id:s.descriptionId,...n,ref:t})});Ql.displayName=Jl;var eu="DialogClose",tu=j.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=kt(eu,r);return o.jsx($e.button,{type:"button",...n,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});tu.displayName=eu;function go(e){return e?"open":"closed"}var ru="DialogTitleWarning",[Dx,nu]=Pf(ru,{contentName:kr,titleName:po,docsSlug:"dialog"}),Xp=({titleId:e})=>{const t=nu(ru),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
42
42
|
|
|
43
43
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
44
44
|
|
|
45
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return C.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Np="DialogDescriptionWarning",Ep=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Bl(Np).contentName}}.`;return C.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ap=El,Tp=Tl,Rp=Pl,Pp=Ml,Mp=Ol,Di=$l,Qs=Ll,Op=zl;const qr=C.memo(C.forwardRef(({children:e,trigger:t,title:r,description:n,footer:s,footerClassName:a,className:i,contentClassName:c,open:l,onOpenChange:u,onClose:f,defaultOpen:d,draggable:h=!0,...m},b)=>{const[g,y]=C.useState({x:0,y:0}),[x,v]=C.useState(!1),_=C.useRef({x:0,y:0}),[w,S]=C.useState(d||!1),k=l!==void 0,j=k?l:w;C.useEffect(()=>{j||(y({x:0,y:0}),v(!1))},[j]);const E=N=>{k||S(N),u?.(N),!N&&f&&f()},I=N=>{h&&(v(!0),_.current={x:N.clientX-g.x,y:N.clientY-g.y})};C.useEffect(()=>{if(!x)return;const N=A=>{y({x:A.clientX-_.current.x,y:A.clientY-_.current.y})},F=()=>{v(!1)};return document.addEventListener("mousemove",N),document.addEventListener("mouseup",F),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",F)}},[x]);const M=n??r??"Dialog content",H=o.jsxs(o.Fragment,{children:[!m.noHeader&&o.jsxs("div",{className:de("flex flex-col space-y-[var(--ui-space-1-5)] border-b border-border bg-card/50 flex-shrink-0",h&&"cursor-move",m.noPadding?"p-[var(--ui-space-1)]":"p-[var(--ui-component-padding-y)]"),role:"button",tabIndex:0,"aria-label":"Drag modal",onMouseDown:I,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&N.preventDefault()},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Di,{className:de("text-lg font-semibold leading-none tracking-tight text-foreground",!r&&"sr-only"),children:r||"Dialog"}),o.jsxs(Op,{className:"rounded-full p-[var(--ui-space-1)] opacity-70 ring-offset-background transition-all hover:opacity-100 hover:bg-accent focus:outline-none disabled:pointer-events-none cursor-pointer",children:[o.jsx(ye.X,{className:"h-[var(--ui-space-5)] w-[var(--ui-space-5)] text-foreground"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]}),n?o.jsx(Qs,{className:"text-sm text-muted-foreground",children:n}):o.jsx(Qs,{className:"sr-only",children:M})]}),m.noHeader&&o.jsxs(o.Fragment,{children:[o.jsx(Di,{className:"sr-only",children:r||"Dialog"}),o.jsx(Qs,{className:"sr-only",children:M})]}),o.jsx("div",{id:"modal-content",className:de("flex-1 overflow-y-auto",m.noPadding?"p-[var(--ui-space-0)]":"p-[var(--ui-modal-padding)]",c),children:e}),s&&o.jsx("div",{className:de("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-[var(--ui-space-2)] bg-background flex-shrink-0","p-[var(--ui-component-padding-y)]",a),children:s})]});return o.jsxs(Ap,{open:j,onOpenChange:E,...m,children:[t&&o.jsx(Tp,{asChild:!0,children:t}),o.jsxs(Rp,{children:[o.jsx(Pp,{className:"fixed inset-[var(--ui-space-0)] z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),o.jsx(Mp,{ref:b,className:de("fixed z-50 flex flex-col gap-[var(--ui-space-0)] bg-background",!h&&"duration-200",!h&&"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",!h&&"bottom-[var(--ui-space-0)] left-[var(--ui-space-0)] right-[var(--ui-space-0)] w-full h-[var(--ui-space-90vh)] rounded-t-xl border-t border-border",!h&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",h&&"left-[var(--ui-space-50pct)] top-[var(--ui-space-50pct)] h-auto max-h-[var(--ui-space-90vh)] w-[var(--ui-space-90vw)] max-w-lg rounded-md border border-border",!h&&"sm:left-[var(--ui-space-50pct)] sm:top-[var(--ui-space-50pct)] sm:bottom-auto sm:right-auto sm:h-auto sm:max-h-[var(--ui-space-90vh)] sm:max-w-lg sm:rounded-md sm:border sm:border-border",!h&&"sm:data-[state=closed]:zoom-out-95 sm:data-[state=open]:zoom-in-95",!h&&"sm:data-[state=closed]:slide-out-to-left-[var(--ui-space-50pct)] sm:data-[state=closed]:slide-out-to-top-[var(--ui-space-48pct)]",!h&&"sm:data-[state=open]:slide-in-from-left-[var(--ui-space-50pct)] sm:data-[state=open]:slide-in-from-top-[var(--ui-space-48pct)]",i),style:h?{transform:`translate(calc(-50% + ${g.x}px), calc(-50% + ${g.y}px))`,cursor:x?"grabbing":void 0}:{transform:"translate(-50%, -50%)"},children:H})]})]})}));qr.displayName="Modal";function io({onConfirm:e,variant:t="default",...r}){return o.jsx(qr,{...r,children:o.jsxs("div",{className:"flex justify-end gap-[var(--ui-space-2)] p-[var(--ui-component-padding-y)]",children:[o.jsx(oe,{variant:"outline",onClick:()=>r.onClose?.()||r.onOpenChange?.(!1),children:"Cancel"}),o.jsx(oe,{variant:t,onClick:e,children:"Confirm"})]})})}const Nt=4,Ip=e=>e?e.replace(/[^0-9]/g,"").slice(0,Nt):"",$p=e=>{const t=e.padEnd(Nt,"_");return`${t.slice(0,2)}:${t.slice(2,4)}`},Fp=e=>{if(e.length!==Nt)return!1;const t=Number.parseInt(e.slice(0,2),10),r=Number.parseInt(e.slice(2,4),10);return t>=0&&t<=23&&r>=0&&r<=59},Lp=e=>`${e.slice(0,2)}:${e.slice(2,4)}`,Vp=p.memo(({open:e,title:t,onClose:r,displayContent:n,errorMessage:s,onNumberClick:a,onBackspace:i,onClear:c,onConfirm:l,additionalButton:u})=>o.jsx(qr,{open:e,onOpenChange:f=>!f&&r(),title:t,onClose:r,children:o.jsxs("div",{className:"flex flex-col gap-[var(--ui-space-4)]",children:[o.jsx("div",{className:"bg-card border-2 border-theme-text-primary rounded-lg p-[var(--ui-modal-padding)] min-h-[var(--ui-space-15)] flex items-center justify-center text-lg font-semibold text-foreground",children:n}),s&&o.jsx("div",{className:"text-destructive text-sm text-center p-ui-gap bg-destructive/10 rounded-md border-l-[3px] border-destructive",children:s}),o.jsxs("div",{className:"grid grid-cols-3 gap-ui-gap",children:[[1,2,3,4,5,6,7,8,9].map(f=>o.jsx("button",{type:"button",onClick:()=>a(f.toString()),className:"min-h-[var(--ui-keypad-button-height)] text-lg font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:f},f)),u||o.jsx("div",{className:"min-h-[var(--ui-keypad-button-height)] bg-card rounded-lg"}),o.jsx("button",{type:"button",onClick:()=>a("0"),className:"min-h-[var(--ui-keypad-button-height)] text-lg font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:"0"}),o.jsx("button",{type:"button",onClick:i,className:"min-h-[var(--ui-keypad-button-height)] text-base font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:"⌫"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-ui-gap mt-[var(--ui-space-2)]",children:[o.jsx("button",{type:"button",onClick:c,className:"min-h-[var(--ui-keypad-button-height)] text-base font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:bg-destructive active:text-white active:border-theme-danger hover:bg-destructive hover:text-white hover:border-theme-danger",children:"C"}),o.jsx("button",{type:"button",onClick:l,className:"min-h-[var(--ui-keypad-button-height)] text-base font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:"OK"})]})]})})),zp={number:{titleKey:"keypad_title_number",placeholder:"",maxLength:10},phone:{titleKey:"keypad_title_phone",placeholder:"090-0000-0000",maxLength:13},time:{titleKey:"keypad_title_time",placeholder:"__:__",maxLength:Nt}},As=p.memo(({open:e,onClose:t,onSubmit:r,variant:n="number",initialValue:s="",title:a,placeholder:i,maxLength:c,allowDecimal:l=!1})=>{const{t:u}=Le(),f=p.useMemo(()=>n==="time"?Ip(s):s,[n,s]),[d,h]=p.useState(f),[m,b]=p.useState(""),[g,y]=p.useState(!0),x=p.useMemo(()=>zp[n],[n]),v=a??u(x.titleKey),_=i??x.placeholder,w=n==="time"?Nt:c??x.maxLength,S=n==="number"&&l,k=n==="phone",j=n==="time";p.useEffect(()=>{e&&(h(f),b(""),y(!0))},[e,f]);const E=p.useCallback(O=>{if(y(!1),j){h(P=>{const R=g?"":P;return R.length>=Nt?(b(u("keypad_error_max_length",{defaultValue:`Up to ${Nt} characters`,max:Nt})),R):(b(""),R.length===0&&Number.parseInt(O,10)>=3?`0${O}`:(R+O).slice(0,Nt))});return}h(P=>{const R=g?"":P;return R.length>=w?(b(u("keypad_error_max_length",{defaultValue:`Up to ${w} characters`,max:w})),R):(b(""),`${R}${O}`)})},[w,j,g,u]),I=p.useCallback(()=>{k&&(y(!1),h(O=>{const P=g?"":O;return P.length>=w?(b(u("keypad_error_max_length",{defaultValue:`Up to ${w} characters`,max:w})),P):P.endsWith("-")?(b(u("keypad_error_hyphen_repeat")),P):(b(""),`${P}-`)}))},[k,w,g,u]),M=p.useCallback(()=>{S&&(y(!1),h(O=>{const P=g?"":O;return P.includes(".")?(b(u("keypad_error_decimal_repeat")),P):(b(""),`${P}.`)}))},[S,g,u]),H=p.useCallback(()=>{y(!1),h(O=>O.slice(0,-1)),b("")},[]),N=p.useCallback(()=>{y(!1),h(""),b("")},[]),F=p.useCallback(()=>{if(j){h(O=>Fp(O)?(r(Lp(O)),O):(b(u("keypad_error_time_invalid")),O));return}h(O=>O===""?(b(u("keypad_error_value_required")),O):S&&O.endsWith(".")?(b(u("keypad_error_decimal_end")),O):k&&O.endsWith("-")?(b(u("keypad_error_hyphen_end")),O):(r(O),O))},[S,k,j,r,u]);p.useEffect(()=>{if(!e)return;const O=P=>{P.key>="0"&&P.key<="9"||P.code>="Numpad0"&&P.code<="Numpad9"?(P.preventDefault(),E(P.key)):k&&(P.key==="-"||P.code==="NumpadSubtract"||P.key==="Minus")?(P.preventDefault(),I()):S&&(P.key==="."||P.code==="NumpadDecimal")?(P.preventDefault(),M()):P.key==="Backspace"?(P.preventDefault(),H()):P.key==="Enter"?(P.preventDefault(),F()):P.key==="Escape"&&(P.preventDefault(),t())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[e,k,S,t,E,I,M,H,F]);const A=j?o.jsxs("div",{className:"flex flex-col items-center justify-center gap-[var(--ui-space-2)] w-full",children:[o.jsx("span",{style:{fontSize:"24px",fontFamily:"monospace",color:"hsl(var(--foreground))",letterSpacing:"2px",fontWeight:600},children:$p(d)}),o.jsxs("span",{style:{fontSize:"12px",color:"var(--theme-text-secondary)"},children:["入力: ",d.padEnd(Nt,"・")]})]}):o.jsx("span",{style:{fontSize:"24px",fontFamily:"monospace",color:"hsl(var(--foreground))",fontWeight:600},children:d||o.jsx("span",{style:{color:"var(--theme-text-secondary)"},children:_})}),V=p.useMemo(()=>{if(k||S){const O=k?"-":".",P=k?I:M;return o.jsx("button",{type:"button",onClick:P,className:"min-h-[var(--ui-keypad-button-height)] text-lg font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:O})}},[k,S,I,M]);return o.jsx(Vp,{open:e,title:v,onClose:t,displayContent:A,errorMessage:m,onNumberClick:E,onBackspace:H,onClear:N,onConfirm:F,additionalButton:V})});As.displayName="KeypadModal";const Sn=C.createContext(null),Ut=({children:e,value:t,onValueChange:r,defaultValue:n,disabled:s})=>{const[a,i]=C.useState(n||""),[c,l]=C.useState(!1),[u,f]=C.useState(null),d=t!==void 0?t:a,h=m=>{i(m),r?.(m),l(!1)};return o.jsx(Sn.Provider,{value:{value:d,onValueChange:h,open:c,setOpen:l,label:u,setLabel:f,disabled:s},children:o.jsx("div",{className:"relative",children:e})})},Pt=C.forwardRef(({className:e,children:t,...r},n)=>{const s=C.useContext(Sn);if(!s)throw new Error("SelectTrigger must be used within Select");return o.jsxs("button",{ref:n,type:"button",disabled:s.disabled||r.disabled,onClick:()=>!s.disabled&&s.setOpen(!s.open),className:de("flex w-full items-center justify-between rounded-md border border-input bg-background px-ui py-ui text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:[t,o.jsx(ye.ChevronDown,{className:"h-ui-icon w-ui-icon opacity-50"})]})});Pt.displayName="SelectTrigger";const Mt=C.forwardRef(({className:e,placeholder:t,...r},n)=>{const s=C.useContext(Sn);if(!s)throw new Error("SelectValue must be used within Select");return o.jsx("span",{ref:n,className:de("block truncate",e),...r,children:r.children||s.label||s.value||t})});Mt.displayName="SelectValue";const Ot=C.forwardRef(({className:e,children:t,...r},n)=>{const s=C.useContext(Sn);if(!s)throw new Error("SelectContent must be used within Select");return s.open?o.jsx("div",{ref:n,className:de("absolute z-50 min-w-[var(--ui-space-32)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80 w-full mt-[var(--ui-space-1)]",e),...r,children:o.jsx("div",{className:"p-[var(--ui-space-1)] max-h-[var(--ui-space-60)] overflow-y-auto",children:t})}):null});Ot.displayName="SelectContent";const at=C.forwardRef(({className:e,children:t,value:r,...n},s)=>{const a=C.useContext(Sn);if(!a)throw new Error("SelectItem must be used within Select");const i=a.value===r;return C.useEffect(()=>{i&&a.setLabel(t)},[i,t,a]),o.jsxs("button",{ref:s,type:"button",className:de("relative flex w-full cursor-default select-none items-center rounded-sm py-[var(--ui-space-1-5)] pl-[var(--ui-space-8)] pr-[var(--ui-space-2)] text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",i?"bg-accent/50":"",e),onClick:()=>{a.setLabel(t),a.onValueChange(r)},...n,children:[o.jsx("span",{className:"absolute left-[var(--ui-space-2)] flex h-[var(--ui-space-3-5)] w-[var(--ui-space-3-5)] items-center justify-center",children:i&&o.jsx("span",{className:"h-[var(--ui-space-2)] w-[var(--ui-space-2)] rounded-full bg-current"})}),o.jsx("span",{className:"truncate",children:t})]})});at.displayName="SelectItem";const gn=C.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:de("flex min-h-[var(--ui-space-20)] w-full rounded-md border border-input bg-background px-ui py-ui text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));gn.displayName="Textarea";function Wl(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(/,|、/).map(t=>t.trim()).filter(Boolean).map(t=>({name:t,type:"external"}))}function Ul(e){return e.length>0?JSON.stringify(e):"[]"}function Zl({personnel:e,currentUserId:t,isEditMode:r}){const n=p.useMemo(()=>s=>{let a=[];try{if(s&&s!=="[]"){const i=JSON.parse(s);Array.isArray(i)&&(a=i)}}catch{}if(!r&&t&&e&&!a.some(c=>c.personnelId===t)){const c=e.find(l=>l.id===t);c&&a.push({name:c.name,personnelId:c.id,type:"personnel"})}return{finalAttendees:a.length>0?JSON.stringify(a):"[]",shouldDelete:!1}},[r,t,e]);return{parseAttendees:Wl,stringifyAttendees:Ul,processAttendeesForSubmit:n}}function Yl(e,t,r,n){const{start:s,end:a}=r;if(Number.isNaN(s.getTime())||Number.isNaN(a.getTime()))return e.map(l=>({resourceId:l.id,isAvailable:!0,conflictingEvents:[],todaySchedule:[]}));const i=new Date(s);i.setHours(0,0,0,0);const c=new Date(s);return c.setHours(23,59,59,999),e.map(l=>{const u=l.id,f=t.filter(m=>m.resourceId===u&&m.id!==n&&m.status!=="cancelled"),d=f.filter(m=>{const b=m.isAllDay??m.extendedProps?.isAllDay,g=b===!0||b==="true"||b===1||b==="1",y=new Date(m.startDate);let x=new Date(m.endDate);return g&&(y.setHours(0,0,0,0),x<=y||x.getDate()===y.getDate()&&x.getFullYear()===y.getFullYear()&&x.getMonth()===y.getMonth()?(x=new Date(y),x.setDate(x.getDate()+1)):(x.setHours(0,0,0,0),x<=y&&(x=new Date(y),x.setDate(x.getDate()+1)))),s<x&&a>y}),h=f.filter(m=>{const b=new Date(m.startDate),g=new Date(m.endDate);return i<g&&c>b});return h.sort((m,b)=>m.startDate.getTime()-b.startDate.getTime()),{resourceId:u,isAvailable:d.length===0,conflictingEvents:d,todaySchedule:h}})}function Gl({resources:e,groups:t,events:r,timeRange:n,currentEventId:s,externalAvailability:a}){const i=p.useMemo(()=>a||Yl(e,r,n,s),[a,e,r,n,s]),c=p.useMemo(()=>e.filter(f=>i.find(h=>h.resourceId===f.id)?.isAvailable??!0),[e,i]),l=p.useMemo(()=>c.map(f=>{const d=t.find(h=>h.id===f.groupId);return d?`${f.name} (${d.name})`:f.name}),[c,t]),u=p.useMemo(()=>f=>{const d=e.find(m=>m.id===f);if(!d)return f;const h=t.find(m=>m.id===d.groupId);return h?`${d.name} (${h.name})`:d.name},[e,t]);return{availabilityList:i,availableResources:c,resourceNames:l,getDisplayName:u}}function Ts(e,t){return Ec({start:e.startDate,end:e.endDate},{start:t.startDate,end:t.endDate})}function co(e,t){for(const r of t)if(r.status!=="cancelled"&&r.id!==e.id&&r.resourceId===e.resourceId&&Ts(r,e))return{resourceId:e.resourceId,existingSchedule:r,newSchedule:e,conflictType:"double-booking"};return null}function Rs(e,t,r){return e.filter(n=>Ec({start:n.startDate,end:n.endDate},{start:t,end:r}))}function _a(e,t){return e.filter(r=>r.resourceId===t)}function Hp(e,t){return Rs(e,dt(t),Pf(t))}function lo(e){return[...e].sort((t,r)=>t.startDate.getTime()-r.startDate.getTime())}function Bp(e){return[...e].sort((t,r)=>t.order-r.order)}function Wp(e){return(e.endDate.getTime()-e.startDate.getTime())/(1e3*60*60)}function Up(e){const t=Ne(e.startDate,void 0,"time24"),r=Ne(e.endDate,void 0,"time24");return`${e.title} (${t}-${r})`}const Rr=new Map,Zp=100;function uo(e,t){const r=dt(e),n=dt(t),s=`${r.getTime()}-${n.getTime()}`;if(Rr.has(s)){const c=Rr.get(s);if(c!==void 0)return c}const a=[];let i=r;for(;i<=n;)a.push(i),i=jr(i,1);if(Rr.size>=Zp){const c=Rr.keys().next().value;c&&Rr.delete(c)}return Rr.set(s,a),a}function fo(e){switch(e){case 0:case 1:case 2:case 3:case 4:case 5:case 6:return e;default:return 1}}function Ps(e,t=1){return cn(e,{weekStartsOn:t})}function ho(e,t=1){return ga(e,{weekStartsOn:t})}function mo(e){return pa(e)}function ql(e){return Nc(e)}function Yp(e){const t=e.map(r=>({...r,hasConflict:!1}));for(let r=0;r<t.length;r++){const n=t[r];if(!(!n||n.status==="cancelled"))for(let s=r+1;s<t.length;s++){const a=t[s];!a||a.status==="cancelled"||n.resourceId===a.resourceId&&Ts(n,a)&&(n.hasConflict=!0,a.hasConflict=!0)}}return t}function Xl(e,t,r){const n=r.startTime.split(":"),s=r.endTime.split(":"),a=Number(n[0]??0),i=Number(s[0]??23);if(t==="day"){const c=dt(e);c.setHours(a);const l=dt(e);if(i>=24){const u=Math.floor(i/24),f=i%24,d=jr(l,u);return d.setHours(f,59,59,999),{start:c,end:d}}else return l.setHours(i,59,59,999),{start:c,end:l}}if(t==="week"){const c=fo(r.weekStartsOn),l=Ps(e,c),u=ho(e,c);return{start:l,end:u}}return{start:mo(e),end:ql(e)}}function Kl({startDate:e,duration:t,resourceId:r,events:n,currentEventId:s}){return p.useMemo(()=>{const a=new Date(e),i=new Date(a),c=(Number(t)||0)*60;if(i.setMinutes(i.getMinutes()+c),!r||Number.isNaN(a.getTime()))return null;const l=n.filter(u=>u.id!==s);return co({startDate:a,endDate:i,resourceId:r},l)},[e,t,r,n,s])}const Gp=e=>{const t=Math.floor(e),r=Math.round((e-t)*60);return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`},qp=(e,t)=>{const r=e?.[t];return typeof r=="string"?r:void 0},Xp=Fe({title:Q().min(1,"required"),attendee:Q().optional(),resourceId:Q().optional(),startDate:Q().min(1,"required"),durationHours:we().min(.25).max(24),note:Q().optional(),isRecurring:qe().optional(),scheduleType:Q().optional(),endDate:Q().optional(),isAllDay:qe().optional()}),Ni=[];function Jl({event:e,resources:t,groups:r,events:n,resourceAvailability:s,defaultResourceId:a,defaultStartTime:i,onSubmit:c,onCancel:l,onDelete:u,readOnlyResource:f=!1,personnel:d=Ni,currentUserId:h,onAvailabilityRequest:m,customFields:b=Ni}){const{t:g,i18n:y}=Le(),x=!!e,[v,_]=p.useState(!1),w=p.useMemo(()=>{const R={};return b.forEach(B=>{let z;B.type==="number"?(z=xs([we(),Q().transform(J=>J===""?void 0:Number(J))]),B.required?z=ts.number().min(1,"required"):z=ts.number().optional()):B.type==="boolean"?z=qe().optional():(z=Q(),B.required?z=z.min(1,"required"):z=z.optional()),R[B.name]=z}),Xp.extend(R)},[b]),S=p.useMemo(()=>{const R={title:qp(e?.extendedProps,"originalTitle")??e?.title??"",attendee:e?.attendee||"[]",resourceId:e?.resourceId||a||"",startDate:Or(e?.startDate||i||new Date),durationHours:e?Math.round((e.endDate.getTime()-e.startDate.getTime())/36e5*100)/100:1,note:e?.note||"",isRecurring:!1,isAllDay:e?.isAllDay||!1},B={};return b.forEach(z=>{const J=e?.extendedProps?.[z.name];B[z.name]=J!==void 0?J:z.defaultValue??""}),{...R,...B}},[e,a,i,b]),k=dc({resolver:hc(w),defaultValues:S});p.useEffect(()=>{k.reset(S)},[S,k]);const j=k.watch("isAllDay"),E=k.watch("startDate"),I=k.watch("durationHours"),M=k.watch("resourceId"),H=new Date(E);if(!Number.isNaN(H.getTime())){const R=(Number(I)||0)*60;H.setTime(new Date(E).getTime()+R*6e4)}const{availableResources:N,getDisplayName:F}=Gl({resources:t,groups:r,events:n,timeRange:{start:new Date(E),end:H},currentEventId:e?.id,externalAvailability:s});p.useEffect(()=>{if(m){const R=new Date(E);if(!Number.isNaN(R.getTime())){const B=new Date(R),z=(Number(I)||0)*60;B.setMinutes(B.getMinutes()+z),m({startDate:R,endDate:B})}}},[E,I,m]);const A=Kl({startDate:E,duration:I,resourceId:M,events:n,currentEventId:e?.id}),{parseAttendees:V,processAttendeesForSubmit:O}=Zl({personnel:d,currentUserId:h,isEditMode:x}),P=R=>{const B=new Date(R.startDate);R.isAllDay&&B.setHours(0,0,0,0);const z=new Date(B),J=(Number(R.durationHours)||0)*60;z.setMinutes(z.getMinutes()+J);const{finalAttendees:G,shouldDelete:L}=O(R.attendee||"[]");if(L&&u){u();return}const{startDate:W,endDate:se,title:ne,attendee:fe,resourceId:pe,note:Ae,durationHours:xe,isAllDay:Ze,isRecurring:Ye,scheduleType:Xe,...Ke}=R,Ct={...e?.extendedProps??{},...Ke};b.forEach(Kt=>{R[Kt.name]!==void 0&&(Ct[Kt.name]=R[Kt.name])});const pt={title:ne,attendee:G,resourceId:pe||void 0,startDate:B,endDate:z,status:e?.status??"booked",note:Ae,durationHours:xe,isAllDay:!!R.isAllDay,extendedProps:Ct};c(pt)};return o.jsxs(no,{...k,children:[o.jsxs("form",{onSubmit:k.handleSubmit(P),className:"space-y-[var(--ui-space-4)] text-foreground",children:[o.jsx(Re,{control:k.control,name:"title",render:({field:R})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[g("event_name_label")||"Event Name"," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(be,{children:o.jsx(bt,{...R,placeholder:g("event_name_placeholder")||"Enter event name",autoFocus:!0})}),o.jsx(nt,{})]})}),o.jsx(Re,{control:k.control,name:"attendee",render:({field:R})=>o.jsxs(De,{children:[o.jsx(_e,{children:g("attendee_label")||"Attendee"}),o.jsx(be,{children:o.jsx(Na,{value:V(R.value),onChange:B=>R.onChange(JSON.stringify(B)),personnel:d||[],placeholder:g("attendee_placeholder")||"Enter attendee name"})}),o.jsx(nt,{})]})}),o.jsx(Re,{control:k.control,name:"resourceId",render:({field:R})=>{const B=F(R.value||"");return o.jsxs(De,{children:[o.jsx(_e,{children:g("resource_label")}),f?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-ui py-ui bg-muted rounded-md text-sm border border-input min-h-ui flex items-center",children:B||g("resource_placeholder")}),o.jsx("input",{type:"hidden",...R})]}):o.jsx(be,{children:o.jsxs(Ut,{onValueChange:R.onChange,value:R.value||"",children:[o.jsx(be,{children:o.jsx(Pt,{children:o.jsx(Mt,{placeholder:g("resource_placeholder"),children:B})})}),o.jsx(Ot,{children:N.map(z=>o.jsx(at,{value:z.id,children:F(z.id)},z.id))})]})}),o.jsx(nt,{})]})}}),b.map(R=>o.jsx(Re,{control:k.control,name:R.name,render:({field:B})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[R.label,R.required&&o.jsx("span",{className:"text-red-500",children:" *"})]}),o.jsx(be,{children:R.type==="select"?o.jsxs(Ut,{onValueChange:B.onChange,value:String(B.value||""),children:[o.jsx(be,{children:o.jsx(Pt,{children:o.jsx(Mt,{placeholder:"Select..."})})}),o.jsx(Ot,{children:R.options?.map(z=>o.jsx(at,{value:z.value,children:z.label},z.value))})]}):R.type==="boolean"?o.jsxs("div",{className:"flex items-center space-x-[var(--ui-space-2)]",children:[o.jsx(hn,{checked:!!B.value,onCheckedChange:B.onChange}),o.jsx("span",{className:"text-sm text-muted-foreground",children:R.label})]}):R.type==="number"?o.jsx(bt,{type:"number",...B,value:String(B.value||""),onChange:B.onChange}):o.jsx(bt,{...B,value:String(B.value||"")})}),o.jsx(nt,{})]})},R.name)),o.jsxs("div",{className:"space-y-[var(--ui-space-2)]",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(_e,{className:"text-base font-semibold",children:[g("date_time_label")||"Date & Time"," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(Re,{control:k.control,name:"isAllDay",render:({field:R})=>o.jsxs(De,{className:"flex flex-row items-center space-x-[var(--ui-space-2)] space-y-[var(--ui-space-0)]",children:[o.jsx(be,{children:o.jsx(hn,{checked:!!R.value,onCheckedChange:R.onChange,id:"isAllDay-checkbox"})}),o.jsx("label",{htmlFor:"isAllDay-checkbox",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:g("all_day")||"All Day"})]})})]}),o.jsxs("div",{className:"grid grid-cols-4 gap-[var(--ui-space-4)] items-start",children:[o.jsx(Re,{control:k.control,name:"startDate",render:({field:R})=>o.jsxs(De,{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:g("date_label")||"Date"}),o.jsx(be,{children:o.jsx(ro,{value:new Date(R.value),disabled:j,onChange:B=>{if(B){const z=new Date(R.value);j?B.setHours(0,0,0,0):B.setHours(z.getHours(),z.getMinutes()),R.onChange(Or(B))}},className:"w-full"})}),o.jsx(nt,{})]})}),j?o.jsx("div",{"aria-hidden":"true"}):o.jsx(Re,{control:k.control,name:"startDate",render:({field:R})=>o.jsxs(De,{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:g("time_label")||"Time"}),o.jsx(be,{children:o.jsx(bt,{value:Ne(new Date(R.value),y.language,"time24"),readOnly:!0,className:"cursor-pointer w-full text-center",onClick:()=>_(!0),tabIndex:-1})}),o.jsx(nt,{})]})}),j?o.jsx("div",{"aria-hidden":"true"}):o.jsx(Re,{control:k.control,name:"durationHours",render:({field:R})=>o.jsxs(De,{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:g("duration_label")}),o.jsxs(Ut,{onValueChange:B=>R.onChange(Number(B)),value:String(R.value),disabled:j,children:[o.jsx(be,{children:o.jsx(Pt,{className:"w-full",children:o.jsx(Mt,{})})}),o.jsx(Ot,{className:"max-h-[var(--ui-space-50)]",children:[.25,.5,.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.5,4,4.5,5,6,8].map(B=>o.jsx(at,{value:String(B),children:Gp(B)},B))})]}),o.jsx(nt,{})]})}),j?o.jsx("div",{"aria-hidden":"true"}):o.jsxs("div",{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:"End Time"}),o.jsx("div",{className:"h-[var(--ui-component-height)] px-3 py-1 flex items-center justify-center border border-transparent text-sm text-foreground/80 font-medium whitespace-nowrap",children:Number.isNaN(H.getTime())?"-":Ne(H,y.language,"time24")})]})]})]}),A&&o.jsxs("div",{className:"p-[var(--ui-space-4)] bg-red-50 border border-red-500 rounded text-red-800 flex items-start gap-[var(--ui-space-2)]",children:[o.jsx(ye.AlertTriangle,{className:"w-[var(--ui-space-5)] h-[var(--ui-space-5)] flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("strong",{className:"block text-sm",children:"Conflict Detected"}),o.jsxs("span",{className:"text-xs",children:[g("event_form_conflict_warning")," (",Ne(A.existingSchedule.startDate,y.language,"time24")," ","-"," ",Ne(A.existingSchedule.endDate,y.language,"time24"),")"]})]})]}),o.jsx(Re,{control:k.control,name:"note",render:({field:R})=>o.jsxs(De,{children:[o.jsx(_e,{children:g("note_label")}),o.jsx(be,{children:o.jsx(gn,{...R,value:R.value||"",placeholder:"Add notes...",rows:2})})]})}),o.jsxs("div",{className:"flex gap-[var(--ui-space-3)] pt-[var(--ui-space-4)] border-t border-border",children:[x&&u&&o.jsx(oe,{type:"button",variant:"outline-delete",size:"sm",onClick:u,className:"flex-1",children:g("delete_button")}),o.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:l,className:"flex-1",children:g("cancel_button")}),o.jsx(oe,{type:"submit",variant:"default",size:"sm",className:"flex-1",children:g("save_button")})]})]}),o.jsx(As,{open:v,onClose:()=>_(!1),onSubmit:R=>{const B=new Date(k.getValues("startDate")),[z,J]=R.split(":").map(Number);B.setHours(z||0,J||0),k.setValue("startDate",Or(B)),_(!1)},initialValue:Ne(new Date(k.getValues("startDate")),y.language,"time24"),variant:"time"})]})}function po({isOpen:e,event:t,resources:r,groups:n,events:s,defaultResourceId:a,defaultStartTime:i,onClose:c,onSave:l,onDelete:u,readOnlyResource:f,personnel:d=[],currentUserId:h,resourceAvailability:m,onAvailabilityRequest:b,customFields:g}){const{t:y}=Le(),x=!!t,[v,_]=p.useState(!1),[w,S]=p.useState({open:!1,title:"",onConfirm:()=>{}});p.useEffect(()=>{if(e){_(!1);const j=setTimeout(()=>{_(!0)},500);return()=>clearTimeout(j)}_(!1)},[e]);const k=()=>{!t||!u||S({open:!0,title:y("confirm_delete_title"),description:y("confirm_delete_message"),onConfirm:()=>{u(t.id),S(j=>({...j,open:!1})),c()}})};return o.jsxs(qr,{open:e,onOpenChange:j=>!j&&c(),title:y(x?"event_edit_title":"event_create_title"),className:"sm:max-w-3xl",children:[o.jsx("div",{style:{pointerEvents:v?"auto":"none"},children:o.jsx(Jl,{event:t,resources:r,groups:n,events:s,personnel:d,resourceAvailability:m,defaultResourceId:a,defaultStartTime:i,onSubmit:l,onCancel:c,onDelete:x&&u?k:void 0,readOnlyResource:f,currentUserId:h,onAvailabilityRequest:b,customFields:g})}),o.jsx(io,{open:w.open,onOpenChange:j=>S(E=>({...E,open:j})),title:w.title,description:w.description,onConfirm:w.onConfirm,variant:"destructive"})]})}const Ql=p.createContext(void 0);function eu(){const e=p.useContext(Ql);if(!e)throw new Error("useScheduleContext must be used within a ScheduleProvider");return e}function Kp({children:e,apiClient:t,onError:r}){const n=p.useRef(t);p.useEffect(()=>{n.current=t},[t]);const s=p.useRef(null),[a,i]=p.useState([]),[c,l]=p.useState([]),[u,f]=p.useState([]),[d,h]=p.useState([]),[m,b]=p.useState(null),[g,y]=p.useState([]),[x,v]=p.useState(!0),[_,w]=p.useState(null),[S,k]=p.useState(new Map);p.useEffect(()=>{(async()=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot load data."),v(!1);return}try{const L=t.getConfig(),W=t.getEvents();s.current||(s.current=t.getPersonnel().catch(Ae=>{throw s.current=null,Ae}));const[se,ne,fe]=await Promise.all([L,W,s.current]);h(se.groups),f(se.resources),b(se.settings);const pe=ne.filter(Ae=>!!Ae.resourceId);i(pe),y(fe)}catch(L){console.error("Failed to load schedule data",L),w(L instanceof Error?L.message:"Unknown error")}finally{v(!1)}})()},[t]);const j=p.useCallback(async G=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot create event.");return}try{const L=await t.createEvent(G);i(W=>[...W,L]),l(W=>[...W,L]),k(new Map)}catch(L){console.error("Failed to create event",L);const W=L instanceof Error?L:new Error(String(L));throw r?.(W),W}},[t,r]),E=p.useCallback(async(G,L)=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot update event.");return}try{const W=await t.updateEvent(G,L);i(se=>se.map(ne=>ne.id===G?W:ne)),l(se=>se.map(ne=>ne.id===G?W:ne)),k(new Map)}catch(W){console.error("Failed to update event",W);const se=W instanceof Error?W:new Error(String(W));throw r?.(se),se}},[t,r]),I=p.useCallback(async G=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot delete event.");return}try{await t.deleteEvent(G),i(L=>L.filter(W=>W.id!==G)),l(L=>L.filter(W=>W.id!==G)),k(new Map)}catch(L){console.error("Failed to delete event",L);const W=L instanceof Error?L:new Error(String(L));throw r?.(W),W}},[t,r]),M=p.useCallback(async G=>{const L=await t.createGroup(G);return h(W=>[...W,L]),L},[t]),H=p.useCallback(async(G,L)=>{const W=await t.updateGroup(G,L);return h(se=>se.map(ne=>ne.id===G?W:ne)),W},[t]),N=p.useCallback(async G=>{await t.deleteGroup(G),h(L=>L.filter(W=>W.id!==G))},[t]),F=p.useCallback(async G=>{const L=await t.createResource(G);return f(W=>[...W,L]),L},[t]),A=p.useCallback(async(G,L)=>{const W=await t.updateResource(G,L);return f(se=>se.map(ne=>ne.id===G?W:ne)),W},[t]),V=p.useCallback(async G=>{await t.deleteResource(G),f(L=>L.filter(W=>W.id!==G))},[t]),O=p.useCallback(async(G,L)=>{try{const W=await t.updatePersonnelPriority(G,L);y(se=>{const ne=se.map(fe=>fe.id===G?W:fe);return ne.sort((fe,pe)=>pe.priority!==fe.priority?pe.priority-fe.priority:fe.name.localeCompare(pe.name,"ja")),ne})}catch(W){console.error("Failed to update personnel priority",W);const se=W instanceof Error?W:new Error(String(W));throw r?.(se),se}},[t,r]),P=p.useCallback(async(G,L=!1)=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot fetch personnel events.");return}if(G.length===0){L||l([]);return}try{const W=await t.getEvents(G);l(L?se=>{const ne=new Set(se.map(pe=>pe.id)),fe=W.filter(pe=>!ne.has(pe.id));return[...se,...fe]}:W)}catch(W){throw console.error("Failed to fetch personnel events",W),W}},[t]),R=p.useCallback((G,L)=>{const W=new Date(G);return W.setHours(0,0,0,0),`${W.toISOString().split("T")[0]}_${L}`},[]),B=p.useCallback((G,L="day")=>{const W=R(G,L);return S.get(W)},[S,R]),z=p.useCallback(async(G,L="day")=>{const W=R(G,L),se=S.get(W);if(se)return se;try{const ne=await t.getResourceAvailability({date:G,view:L});return k(fe=>{const pe=new Map(fe);return pe.set(W,ne),pe}),ne}catch(ne){return console.error("Failed to fetch resource availability",ne),[]}},[S,t,R]),J={events:a,personnelEvents:c,resources:u,groups:d,settings:m,personnel:g,loading:x,error:_,createEvent:j,updateEvent:E,deleteEvent:I,createGroup:M,updateGroup:H,deleteGroup:N,createResource:F,updateResource:A,deleteResource:V,updatePersonnelPriority:O,fetchPersonnelEvents:P,fetchResourceAvailability:z,getResourceAvailabilityFromCache:B};return o.jsx(Ql.Provider,{value:J,children:e})}const tr={SLOT_HEIGHT:60,SLOT_WIDTH:50,HEADER_HEIGHT:64,TIME_COLUMN_WIDTH:64},rr={DAY_CELL_HEIGHT:110,DATE_COLUMN_WIDTH:56,MAX_VISIBLE_EVENTS:4};function go(e){const t=new Map,r=new Map,n=new Map;for(const s of e){if(s.resourceId){const l=t.get(s.resourceId)??[];l.push(s),t.set(s.resourceId,l)}const a=yr(s.startDate),i=r.get(a)??[];i.push(s),r.set(a,i);const c=n.get(s.groupId)??[];c.push(s),n.set(s.groupId,c)}return{byResource:t,byDay:r,byGroup:n}}const Vn=new Map;function yr(e){const r=e.getTime().toString(),n=Vn.get(r);if(n)return n;const s=new Date(e);s.setHours(0,0,0,0);const a=s.toISOString().split("T")[0]??"";return Vn.size>1e3&&Vn.clear(),Vn.set(r,a),a}function Jp(e,t){return t.byResource.get(e)??[]}function tu(e,t){const r=yr(e);return t.byDay.get(r)??[]}const Qp=({children:e})=>o.jsx(o.Fragment,{children:e}),eg=({children:e})=>o.jsx("div",{className:"group contents",children:e}),tg=({children:e,asChild:t,...r})=>{if(t&&C.isValidElement(e)){const n=e;return C.cloneElement(n,{...r,className:de(n.props.className,"cursor-help")})}return o.jsx("span",{...r,className:"cursor-help inline-block",children:e})},rg=({children:e,className:t,...r})=>o.jsx("div",{className:de("absolute z-50 overflow-hidden rounded-md border bg-popover px-[var(--ui-space-3)] py-[var(--ui-space-1-5)] text-sm text-popover-foreground shadow-md 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-[var(--ui-space-2)] data-[side=left]:slide-in-from-right-[var(--ui-space-2)] data-[side=right]:slide-in-from-left-[var(--ui-space-2)] data-[side=top]:slide-in-from-bottom-[var(--ui-space-2)]","hidden group-hover:block w-max max-w-xs bottom-full mb-[var(--ui-space-2)] left-[var(--ui-space-1)]/2 -translate-x-[var(--ui-space-1)]/2",t),...r,children:e});function Ei({event:e,top:t,height:r,widthPercent:n=100,leftPercent:s=0,onClick:a,isDragging:i=!1,components:c,orientation:l="vertical"}){const u=e.startDate.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),f=e.endDate.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),d=Math.round((e.endDate.getTime()-e.startDate.getTime())/(1e3*60*60)*10)/10,h=e.hasConflict?"bg-destructive border-destructive":e.color?"border-primary/30":"bg-primary border-primary/30",m=x=>x.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),b=`${d}h`,y=l==="horizontal"?{left:`${t}px`,width:`${r}px`,top:`${s}%`,height:`${n}%`,paddingTop:s>0?"1px":"2px",paddingBottom:s+n<100?"1px":"2px"}:{top:`${t}px`,height:`${r}px`,left:`${s}%`,width:`${n}%`,paddingLeft:s>0?"2px":"4px",paddingRight:s+n<100?"2px":"4px"};return e.color&&!e.hasConflict&&(y.backgroundColor=e.color),o.jsx(Qp,{children:o.jsxs(eg,{children:[o.jsx(tg,{asChild:!0,children:o.jsx("button",{type:"button",className:`
|
|
45
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Jp="DialogDescriptionWarning",Qp=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nu(Jp).contentName}}.`;return j.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},eg=Bl,tg=Ul,rg=Gl,ng=Yl,sg=Kl,$i=Xl,na=Ql,ag=tu;const Kr=j.memo(j.forwardRef(({children:e,trigger:t,title:r,description:n,footer:s,footerClassName:a,className:i,contentClassName:c,open:l,onOpenChange:u,onClose:f,defaultOpen:d,draggable:h=!0,...p},b)=>{const[g,y]=j.useState({x:0,y:0}),[x,v]=j.useState(!1),k=j.useRef({x:0,y:0}),[w,S]=j.useState(d||!1),C=l!==void 0,_=C?l:w;j.useEffect(()=>{_||(y({x:0,y:0}),v(!1))},[_]);const N=E=>{C||S(E),u?.(E),!E&&f&&f()},I=E=>{h&&(v(!0),k.current={x:E.clientX-g.x,y:E.clientY-g.y})};j.useEffect(()=>{if(!x)return;const E=T=>{y({x:T.clientX-k.current.x,y:T.clientY-k.current.y})},F=()=>{v(!1)};return document.addEventListener("mousemove",E),document.addEventListener("mouseup",F),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",F)}},[x]);const M=n??r??"Dialog content",B=o.jsxs(o.Fragment,{children:[!p.noHeader&&o.jsxs("div",{className:de("flex flex-col space-y-[var(--ui-space-1-5)] border-b border-border bg-card/50 flex-shrink-0",h&&"cursor-move",p.noPadding?"p-[var(--ui-space-1)]":"p-[var(--ui-component-padding-y)]"),role:"button",tabIndex:0,"aria-label":"Drag modal",onMouseDown:I,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&E.preventDefault()},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx($i,{className:de("text-lg font-semibold leading-none tracking-tight text-foreground",!r&&"sr-only"),children:r||"Dialog"}),o.jsxs(ag,{className:"rounded-full p-[var(--ui-space-1)] opacity-70 ring-offset-background transition-all hover:opacity-100 hover:bg-accent focus:outline-none disabled:pointer-events-none cursor-pointer",children:[o.jsx(ye.X,{className:"h-[var(--ui-space-5)] w-[var(--ui-space-5)] text-foreground"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]}),n?o.jsx(na,{className:"text-sm text-muted-foreground",children:n}):o.jsx(na,{className:"sr-only",children:M})]}),p.noHeader&&o.jsxs(o.Fragment,{children:[o.jsx($i,{className:"sr-only",children:r||"Dialog"}),o.jsx(na,{className:"sr-only",children:M})]}),o.jsx("div",{id:"modal-content",className:de("flex-1 overflow-y-auto",p.noPadding?"p-[var(--ui-space-0)]":"p-[var(--ui-modal-padding)]",c),children:e}),s&&o.jsx("div",{className:de("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-[var(--ui-space-2)] bg-background flex-shrink-0","p-[var(--ui-component-padding-y)]",a),children:s})]});return o.jsxs(eg,{open:_,onOpenChange:N,...p,children:[t&&o.jsx(tg,{asChild:!0,children:t}),o.jsxs(rg,{children:[o.jsx(ng,{className:"fixed inset-[var(--ui-space-0)] z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),o.jsx(sg,{ref:b,className:de("fixed z-50 flex flex-col gap-[var(--ui-space-0)] bg-background",!h&&"duration-200",!h&&"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",!h&&"bottom-[var(--ui-space-0)] left-[var(--ui-space-0)] right-[var(--ui-space-0)] w-full h-[var(--ui-space-90vh)] rounded-t-xl border-t border-border",!h&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",h&&"left-[var(--ui-space-50pct)] top-[var(--ui-space-50pct)] h-auto max-h-[var(--ui-space-90vh)] w-[var(--ui-space-90vw)] max-w-lg rounded-md border border-border",!h&&"sm:left-[var(--ui-space-50pct)] sm:top-[var(--ui-space-50pct)] sm:bottom-auto sm:right-auto sm:h-auto sm:max-h-[var(--ui-space-90vh)] sm:max-w-lg sm:rounded-md sm:border sm:border-border",!h&&"sm:data-[state=closed]:zoom-out-95 sm:data-[state=open]:zoom-in-95",!h&&"sm:data-[state=closed]:slide-out-to-left-[var(--ui-space-50pct)] sm:data-[state=closed]:slide-out-to-top-[var(--ui-space-48pct)]",!h&&"sm:data-[state=open]:slide-in-from-left-[var(--ui-space-50pct)] sm:data-[state=open]:slide-in-from-top-[var(--ui-space-48pct)]",i),style:h?{transform:`translate(calc(-50% + ${g.x}px), calc(-50% + ${g.y}px))`,cursor:x?"grabbing":void 0}:{transform:"translate(-50%, -50%)"},children:B})]})]})}));Kr.displayName="Modal";function vo({onConfirm:e,variant:t="default",...r}){return o.jsx(Kr,{...r,children:o.jsxs("div",{className:"flex justify-end gap-[var(--ui-space-2)] p-[var(--ui-component-padding-y)]",children:[o.jsx(ae,{variant:"outline",onClick:()=>r.onClose?.()||r.onOpenChange?.(!1),children:"Cancel"}),o.jsx(ae,{variant:t,onClick:e,children:"Confirm"})]})})}const Nt=4,og=e=>e?e.replace(/[^0-9]/g,"").slice(0,Nt):"",ig=e=>{const t=e.padEnd(Nt,"_");return`${t.slice(0,2)}:${t.slice(2,4)}`},cg=e=>{if(e.length!==Nt)return!1;const t=Number.parseInt(e.slice(0,2),10),r=Number.parseInt(e.slice(2,4),10);return t>=0&&t<=23&&r>=0&&r<=59},lg=e=>`${e.slice(0,2)}:${e.slice(2,4)}`,ug=m.memo(({open:e,title:t,onClose:r,displayContent:n,errorMessage:s,onNumberClick:a,onBackspace:i,onClear:c,onConfirm:l,additionalButton:u})=>o.jsx(Kr,{open:e,onOpenChange:f=>!f&&r(),title:t,onClose:r,children:o.jsxs("div",{className:"flex flex-col gap-[var(--ui-space-4)]",children:[o.jsx("div",{className:"bg-card border-2 border-theme-text-primary rounded-lg p-[var(--ui-modal-padding)] min-h-[var(--ui-space-15)] flex items-center justify-center text-lg font-semibold text-foreground",children:n}),s&&o.jsx("div",{className:"text-destructive text-sm text-center p-ui-gap bg-destructive/10 rounded-md border-l-[3px] border-destructive",children:s}),o.jsxs("div",{className:"grid grid-cols-3 gap-ui-gap",children:[[1,2,3,4,5,6,7,8,9].map(f=>o.jsx("button",{type:"button",onClick:()=>a(f.toString()),className:"min-h-[var(--ui-keypad-button-height)] text-lg font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:f},f)),u||o.jsx("div",{className:"min-h-[var(--ui-keypad-button-height)] bg-card rounded-lg"}),o.jsx("button",{type:"button",onClick:()=>a("0"),className:"min-h-[var(--ui-keypad-button-height)] text-lg font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:"0"}),o.jsx("button",{type:"button",onClick:i,className:"min-h-[var(--ui-keypad-button-height)] text-base font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:"⌫"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-ui-gap mt-[var(--ui-space-2)]",children:[o.jsx("button",{type:"button",onClick:c,className:"min-h-[var(--ui-keypad-button-height)] text-base font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:bg-destructive active:text-white active:border-theme-danger hover:bg-destructive hover:text-white hover:border-theme-danger",children:"C"}),o.jsx("button",{type:"button",onClick:l,className:"min-h-[var(--ui-keypad-button-height)] text-base font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:"OK"})]})]})})),dg={number:{titleKey:"keypad_title_number",placeholder:"",maxLength:10},phone:{titleKey:"keypad_title_phone",placeholder:"090-0000-0000",maxLength:13},time:{titleKey:"keypad_title_time",placeholder:"__:__",maxLength:Nt}},Ms=m.memo(({open:e,onClose:t,onSubmit:r,variant:n="number",initialValue:s="",title:a,placeholder:i,maxLength:c,allowDecimal:l=!1})=>{const{t:u}=Fe(),f=m.useMemo(()=>n==="time"?og(s):s,[n,s]),[d,h]=m.useState(f),[p,b]=m.useState(""),[g,y]=m.useState(!0),x=m.useMemo(()=>dg[n],[n]),v=a??u(x.titleKey),k=i??x.placeholder,w=n==="time"?Nt:c??x.maxLength,S=n==="number"&&l,C=n==="phone",_=n==="time";m.useEffect(()=>{e&&(h(f),b(""),y(!0))},[e,f]);const N=m.useCallback(O=>{if(y(!1),_){h(A=>{const R=g?"":A;return R.length>=Nt?(b(u("keypad_error_max_length",{defaultValue:`Up to ${Nt} characters`,max:Nt})),R):(b(""),R.length===0&&Number.parseInt(O,10)>=3?`0${O}`:(R+O).slice(0,Nt))});return}h(A=>{const R=g?"":A;return R.length>=w?(b(u("keypad_error_max_length",{defaultValue:`Up to ${w} characters`,max:w})),R):(b(""),`${R}${O}`)})},[w,_,g,u]),I=m.useCallback(()=>{C&&(y(!1),h(O=>{const A=g?"":O;return A.length>=w?(b(u("keypad_error_max_length",{defaultValue:`Up to ${w} characters`,max:w})),A):A.endsWith("-")?(b(u("keypad_error_hyphen_repeat")),A):(b(""),`${A}-`)}))},[C,w,g,u]),M=m.useCallback(()=>{S&&(y(!1),h(O=>{const A=g?"":O;return A.includes(".")?(b(u("keypad_error_decimal_repeat")),A):(b(""),`${A}.`)}))},[S,g,u]),B=m.useCallback(()=>{y(!1),h(O=>O.slice(0,-1)),b("")},[]),E=m.useCallback(()=>{y(!1),h(""),b("")},[]),F=m.useCallback(()=>{if(_){h(O=>cg(O)?(r(lg(O)),O):(b(u("keypad_error_time_invalid")),O));return}h(O=>O===""?(b(u("keypad_error_value_required")),O):S&&O.endsWith(".")?(b(u("keypad_error_decimal_end")),O):C&&O.endsWith("-")?(b(u("keypad_error_hyphen_end")),O):(r(O),O))},[S,C,_,r,u]);m.useEffect(()=>{if(!e)return;const O=A=>{A.key>="0"&&A.key<="9"||A.code>="Numpad0"&&A.code<="Numpad9"?(A.preventDefault(),N(A.key)):C&&(A.key==="-"||A.code==="NumpadSubtract"||A.key==="Minus")?(A.preventDefault(),I()):S&&(A.key==="."||A.code==="NumpadDecimal")?(A.preventDefault(),M()):A.key==="Backspace"?(A.preventDefault(),B()):A.key==="Enter"?(A.preventDefault(),F()):A.key==="Escape"&&(A.preventDefault(),t())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[e,C,S,t,N,I,M,B,F]);const T=_?o.jsxs("div",{className:"flex flex-col items-center justify-center gap-[var(--ui-space-2)] w-full",children:[o.jsx("span",{style:{fontSize:"24px",fontFamily:"monospace",color:"hsl(var(--foreground))",letterSpacing:"2px",fontWeight:600},children:ig(d)}),o.jsxs("span",{style:{fontSize:"12px",color:"var(--theme-text-secondary)"},children:["入力: ",d.padEnd(Nt,"・")]})]}):o.jsx("span",{style:{fontSize:"24px",fontFamily:"monospace",color:"hsl(var(--foreground))",fontWeight:600},children:d||o.jsx("span",{style:{color:"var(--theme-text-secondary)"},children:k})}),$=m.useMemo(()=>{if(C||S){const O=C?"-":".",A=C?I:M;return o.jsx("button",{type:"button",onClick:A,className:"min-h-[var(--ui-keypad-button-height)] text-lg font-semibold bg-background text-foreground border-2 border-theme-text-primary rounded-lg cursor-pointer transition-all active:scale-95 active:brightness-90 hover:brightness-110",children:O})}},[C,S,I,M]);return o.jsx(ug,{open:e,title:v,onClose:t,displayContent:T,errorMessage:p,onNumberClick:N,onBackspace:B,onClear:E,onConfirm:F,additionalButton:$})});Ms.displayName="KeypadModal";const Sn=j.createContext(null),Zt=({children:e,value:t,onValueChange:r,defaultValue:n,disabled:s})=>{const[a,i]=j.useState(n||""),[c,l]=j.useState(!1),[u,f]=j.useState(null),d=t!==void 0?t:a,h=p=>{i(p),r?.(p),l(!1)};return o.jsx(Sn.Provider,{value:{value:d,onValueChange:h,open:c,setOpen:l,label:u,setLabel:f,disabled:s},children:o.jsx("div",{className:"relative",children:e})})},Mt=j.forwardRef(({className:e,children:t,...r},n)=>{const s=j.useContext(Sn);if(!s)throw new Error("SelectTrigger must be used within Select");return o.jsxs("button",{ref:n,type:"button",disabled:s.disabled||r.disabled,onClick:()=>!s.disabled&&s.setOpen(!s.open),className:de("flex w-full items-center justify-between rounded-md border border-input bg-background px-ui py-ui text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:[t,o.jsx(ye.ChevronDown,{className:"h-ui-icon w-ui-icon opacity-50"})]})});Mt.displayName="SelectTrigger";const Pt=j.forwardRef(({className:e,placeholder:t,...r},n)=>{const s=j.useContext(Sn);if(!s)throw new Error("SelectValue must be used within Select");return o.jsx("span",{ref:n,className:de("block truncate",e),...r,children:r.children||s.label||s.value||t})});Pt.displayName="SelectValue";const Ot=j.forwardRef(({className:e,children:t,...r},n)=>{const s=j.useContext(Sn);if(!s)throw new Error("SelectContent must be used within Select");return s.open?o.jsx("div",{ref:n,className:de("absolute z-50 min-w-[var(--ui-space-32)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80 w-full mt-[var(--ui-space-1)]",e),...r,children:o.jsx("div",{className:"p-[var(--ui-space-1)] max-h-[var(--ui-space-60)] overflow-y-auto",children:t})}):null});Ot.displayName="SelectContent";const at=j.forwardRef(({className:e,children:t,value:r,...n},s)=>{const a=j.useContext(Sn);if(!a)throw new Error("SelectItem must be used within Select");const i=a.value===r;return j.useEffect(()=>{i&&a.setLabel(t)},[i,t,a]),o.jsxs("button",{ref:s,type:"button",className:de("relative flex w-full cursor-default select-none items-center rounded-sm py-[var(--ui-space-1-5)] pl-[var(--ui-space-8)] pr-[var(--ui-space-2)] text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",i?"bg-accent/50":"",e),onClick:()=>{a.setLabel(t),a.onValueChange(r)},...n,children:[o.jsx("span",{className:"absolute left-[var(--ui-space-2)] flex h-[var(--ui-space-3-5)] w-[var(--ui-space-3-5)] items-center justify-center",children:i&&o.jsx("span",{className:"h-[var(--ui-space-2)] w-[var(--ui-space-2)] rounded-full bg-current"})}),o.jsx("span",{className:"truncate",children:t})]})});at.displayName="SelectItem";const gn=j.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:de("flex min-h-[var(--ui-space-20)] w-full rounded-md border border-input bg-background px-ui py-ui text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));gn.displayName="Textarea";function su(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(/,|、/).map(t=>t.trim()).filter(Boolean).map(t=>({name:t,type:"external"}))}function au(e){return e.length>0?JSON.stringify(e):"[]"}function ou({personnel:e,currentUserId:t,isEditMode:r}){const n=m.useMemo(()=>s=>{let a=[];try{if(s&&s!=="[]"){const i=JSON.parse(s);Array.isArray(i)&&(a=i)}}catch{}if(!r&&t&&e&&!a.some(c=>c.personnelId===t)){const c=e.find(l=>l.id===t);c&&a.push({name:c.name,personnelId:c.id,type:"personnel"})}return{finalAttendees:a.length>0?JSON.stringify(a):"[]",shouldDelete:!1}},[r,t,e]);return{parseAttendees:su,stringifyAttendees:au,processAttendeesForSubmit:n}}function iu(e,t,r,n){const{start:s,end:a}=r;if(Number.isNaN(s.getTime())||Number.isNaN(a.getTime()))return e.map(l=>({resourceId:l.id,isAvailable:!0,conflictingEvents:[],todaySchedule:[]}));const i=new Date(s);i.setHours(0,0,0,0);const c=new Date(s);return c.setHours(23,59,59,999),e.map(l=>{const u=l.id,f=t.filter(p=>p.resourceId===u&&p.id!==n&&p.status!=="cancelled"),d=f.filter(p=>{const b=p.isAllDay??p.extendedProps?.isAllDay,g=b===!0||b==="true"||b===1||b==="1",y=new Date(p.startDate);let x=new Date(p.endDate);return g&&(y.setHours(0,0,0,0),x<=y||x.getDate()===y.getDate()&&x.getFullYear()===y.getFullYear()&&x.getMonth()===y.getMonth()?(x=new Date(y),x.setDate(x.getDate()+1)):(x.setHours(0,0,0,0),x<=y&&(x=new Date(y),x.setDate(x.getDate()+1)))),s<x&&a>y}),h=f.filter(p=>{const b=new Date(p.startDate),g=new Date(p.endDate);return i<g&&c>b});return h.sort((p,b)=>p.startDate.getTime()-b.startDate.getTime()),{resourceId:u,isAvailable:d.length===0,conflictingEvents:d,todaySchedule:h}})}function cu({resources:e,groups:t,events:r,timeRange:n,currentEventId:s,externalAvailability:a}){const i=m.useMemo(()=>a||iu(e,r,n,s),[a,e,r,n,s]),c=m.useMemo(()=>e.filter(f=>i.find(h=>h.resourceId===f.id)?.isAvailable??!0),[e,i]),l=m.useMemo(()=>c.map(f=>{const d=t.find(h=>h.id===f.groupId);return d?`${f.name} (${d.name})`:f.name}),[c,t]),u=m.useMemo(()=>f=>{const d=e.find(p=>p.id===f);if(!d)return f;const h=t.find(p=>p.id===d.groupId);return h?`${d.name} (${h.name})`:d.name},[e,t]);return{availabilityList:i,availableResources:c,resourceNames:l,getDisplayName:u}}function Ps(e,t){return Bc({start:e.startDate,end:e.endDate},{start:t.startDate,end:t.endDate})}function yo(e,t){for(const r of t)if(r.status!=="cancelled"&&r.id!==e.id&&r.resourceId===e.resourceId&&Ps(r,e))return{resourceId:e.resourceId,existingSchedule:r,newSchedule:e,conflictType:"double-booking"};return null}function Os(e,t,r){return e.filter(n=>Bc({start:n.startDate,end:n.endDate},{start:t,end:r}))}function Ca(e,t){return e.filter(r=>r.resourceId===t)}function fg(e,t){return Os(e,dt(t),nh(t))}function xo(e){return[...e].sort((t,r)=>t.startDate.getTime()-r.startDate.getTime())}function hg(e){return[...e].sort((t,r)=>t.order-r.order)}function mg(e){return(e.endDate.getTime()-e.startDate.getTime())/(1e3*60*60)}function pg(e){const t=Ne(e.startDate,void 0,"time24"),r=Ne(e.endDate,void 0,"time24");return`${e.title} (${t}-${r})`}const Rr=new Map,gg=100;function bo(e,t){const r=dt(e),n=dt(t),s=`${r.getTime()}-${n.getTime()}`;if(Rr.has(s)){const c=Rr.get(s);if(c!==void 0)return c}const a=[];let i=r;for(;i<=n;)a.push(i),i=Cr(i,1);if(Rr.size>=gg){const c=Rr.keys().next().value;c&&Rr.delete(c)}return Rr.set(s,a),a}function wo(e){switch(e){case 0:case 1:case 2:case 3:case 4:case 5:case 6:return e;default:return 1}}function Is(e,t=1){return cn(e,{weekStartsOn:t})}function _o(e,t=1){return ba(e,{weekStartsOn:t})}function So(e){return xa(e)}function lu(e){return Hc(e)}function vg(e){const t=e.map(r=>({...r,hasConflict:!1}));for(let r=0;r<t.length;r++){const n=t[r];if(!(!n||n.status==="cancelled"))for(let s=r+1;s<t.length;s++){const a=t[s];!a||a.status==="cancelled"||n.resourceId===a.resourceId&&Ps(n,a)&&(n.hasConflict=!0,a.hasConflict=!0)}}return t}function uu(e,t,r){const n=r.startTime.split(":"),s=r.endTime.split(":"),a=Number(n[0]??0),i=Number(s[0]??23);if(t==="day"){const c=dt(e);c.setHours(a);const l=dt(e);if(i>=24){const u=Math.floor(i/24),f=i%24,d=Cr(l,u);return d.setHours(f,59,59,999),{start:c,end:d}}else return l.setHours(i,59,59,999),{start:c,end:l}}if(t==="week"){const c=wo(r.weekStartsOn),l=Is(e,c),u=_o(e,c);return{start:l,end:u}}return{start:So(e),end:lu(e)}}function du({startDate:e,duration:t,resourceId:r,events:n,currentEventId:s}){return m.useMemo(()=>{const a=new Date(e),i=new Date(a),c=(Number(t)||0)*60;if(i.setMinutes(i.getMinutes()+c),!r||Number.isNaN(a.getTime()))return null;const l=n.filter(u=>u.id!==s);return yo({startDate:a,endDate:i,resourceId:r},l)},[e,t,r,n,s])}const yg=e=>{const t=Math.floor(e),r=Math.round((e-t)*60);return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`},xg=(e,t)=>{const r=e?.[t];return typeof r=="string"?r:void 0},bg=Oe({title:q().min(1,"required"),attendee:q().optional(),resourceId:q().optional(),startDate:q().min(1,"required"),durationHours:we().min(.25).max(24),note:q().optional(),isRecurring:Ke().optional(),scheduleType:q().optional(),endDate:q().optional(),isAllDay:Ke().optional()}),Fi=[];function fu({event:e,resources:t,groups:r,events:n,resourceAvailability:s,defaultResourceId:a,defaultStartTime:i,onSubmit:c,onCancel:l,onDelete:u,readOnlyResource:f=!1,personnel:d=Fi,currentUserId:h,onAvailabilityRequest:p,customFields:b=Fi}){const{t:g,i18n:y}=Fe(),x=!!e,[v,k]=m.useState(!1),w=m.useMemo(()=>{const R={};return b.forEach(V=>{let H;V.type==="number"?(H=_s([we(),q().transform(Q=>Q===""?void 0:Number(Q))]),V.required?H=rs.number().min(1,"required"):H=rs.number().optional()):V.type==="boolean"?H=Ke().optional():(H=q(),V.required?H=H.min(1,"required"):H=H.optional()),R[V.name]=H}),bg.extend(R)},[b]),S=m.useMemo(()=>{const R={title:xg(e?.extendedProps,"originalTitle")??e?.title??"",attendee:e?.attendee||"[]",resourceId:e?.resourceId||a||"",startDate:Or(e?.startDate||i||new Date),durationHours:e?Math.round((e.endDate.getTime()-e.startDate.getTime())/36e5*100)/100:1,note:e?.note||"",isRecurring:!1,isAllDay:e?.isAllDay||!1},V={};return b.forEach(H=>{const Q=e?.extendedProps?.[H.name];V[H.name]=Q!==void 0?Q:H.defaultValue??""}),{...R,...V}},[e,a,i,b]),C=Cc({resolver:Nc(w),defaultValues:S});m.useEffect(()=>{C.reset(S)},[S,C]);const _=C.watch("isAllDay"),N=C.watch("startDate"),I=C.watch("durationHours"),M=C.watch("resourceId"),B=new Date(N);if(!Number.isNaN(B.getTime())){const R=(Number(I)||0)*60;B.setTime(new Date(N).getTime()+R*6e4)}const{availableResources:E,getDisplayName:F}=cu({resources:t,groups:r,events:n,timeRange:{start:new Date(N),end:B},currentEventId:e?.id,externalAvailability:s});m.useEffect(()=>{if(p){const R=new Date(N);if(!Number.isNaN(R.getTime())){const V=new Date(R),H=(Number(I)||0)*60;V.setMinutes(V.getMinutes()+H),p({startDate:R,endDate:V})}}},[N,I,p]);const T=du({startDate:N,duration:I,resourceId:M,events:n,currentEventId:e?.id}),{parseAttendees:$,processAttendeesForSubmit:O}=ou({personnel:d,currentUserId:h,isEditMode:x}),A=R=>{const V=new Date(R.startDate);R.isAllDay&&V.setHours(0,0,0,0);const H=new Date(V),Q=(Number(R.durationHours)||0)*60;H.setMinutes(H.getMinutes()+Q);const{finalAttendees:Y,shouldDelete:z}=O(R.attendee||"[]");if(z&&u){u();return}const{startDate:W,endDate:se,title:ne,attendee:fe,resourceId:pe,note:Ae,durationHours:xe,isAllDay:Ze,isRecurring:Ge,scheduleType:qe,...Xe}=R,jt={...e?.extendedProps??{},...Xe};b.forEach(Jt=>{R[Jt.name]!==void 0&&(jt[Jt.name]=R[Jt.name])});const pt={title:ne,attendee:Y,resourceId:pe||void 0,startDate:V,endDate:H,status:e?.status??"booked",note:Ae,durationHours:xe,isAllDay:!!R.isAllDay,extendedProps:jt};c(pt)};return o.jsxs(ho,{...C,children:[o.jsxs("form",{onSubmit:C.handleSubmit(A),className:"space-y-[var(--ui-space-4)] text-foreground",children:[o.jsx(Re,{control:C.control,name:"title",render:({field:R})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[g("event_name_label")||"Event Name"," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(be,{children:o.jsx(bt,{...R,placeholder:g("event_name_placeholder")||"Enter event name",autoFocus:!0})}),o.jsx(nt,{})]})}),o.jsx(Re,{control:C.control,name:"attendee",render:({field:R})=>o.jsxs(De,{children:[o.jsx(_e,{children:g("attendee_label")||"Attendee"}),o.jsx(be,{children:o.jsx(Ia,{value:$(R.value),onChange:V=>R.onChange(JSON.stringify(V)),personnel:d||[],placeholder:g("attendee_placeholder")||"Enter attendee name"})}),o.jsx(nt,{})]})}),o.jsx(Re,{control:C.control,name:"resourceId",render:({field:R})=>{const V=F(R.value||"");return o.jsxs(De,{children:[o.jsx(_e,{children:g("resource_label")}),f?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-ui py-ui bg-muted rounded-md text-sm border border-input min-h-ui flex items-center",children:V||g("resource_placeholder")}),o.jsx("input",{type:"hidden",...R})]}):o.jsx(be,{children:o.jsxs(Zt,{onValueChange:R.onChange,value:R.value||"",children:[o.jsx(be,{children:o.jsx(Mt,{children:o.jsx(Pt,{placeholder:g("resource_placeholder"),children:V})})}),o.jsx(Ot,{children:E.map(H=>o.jsx(at,{value:H.id,children:F(H.id)},H.id))})]})}),o.jsx(nt,{})]})}}),b.map(R=>o.jsx(Re,{control:C.control,name:R.name,render:({field:V})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[R.label,R.required&&o.jsx("span",{className:"text-red-500",children:" *"})]}),o.jsx(be,{children:R.type==="select"?o.jsxs(Zt,{onValueChange:V.onChange,value:String(V.value||""),children:[o.jsx(be,{children:o.jsx(Mt,{children:o.jsx(Pt,{placeholder:"Select..."})})}),o.jsx(Ot,{children:R.options?.map(H=>o.jsx(at,{value:H.value,children:H.label},H.value))})]}):R.type==="boolean"?o.jsxs("div",{className:"flex items-center space-x-[var(--ui-space-2)]",children:[o.jsx(hn,{checked:!!V.value,onCheckedChange:V.onChange}),o.jsx("span",{className:"text-sm text-muted-foreground",children:R.label})]}):R.type==="number"?o.jsx(bt,{type:"number",...V,value:String(V.value||""),onChange:V.onChange}):o.jsx(bt,{...V,value:String(V.value||"")})}),o.jsx(nt,{})]})},R.name)),o.jsxs("div",{className:"space-y-[var(--ui-space-2)]",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(_e,{className:"text-base font-semibold",children:[g("date_time_label")||"Date & Time"," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(Re,{control:C.control,name:"isAllDay",render:({field:R})=>o.jsxs(De,{className:"flex flex-row items-center space-x-[var(--ui-space-2)] space-y-[var(--ui-space-0)]",children:[o.jsx(be,{children:o.jsx(hn,{checked:!!R.value,onCheckedChange:R.onChange,id:"isAllDay-checkbox"})}),o.jsx("label",{htmlFor:"isAllDay-checkbox",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:g("all_day")||"All Day"})]})})]}),o.jsxs("div",{className:"grid grid-cols-4 gap-[var(--ui-space-4)] items-start",children:[o.jsx(Re,{control:C.control,name:"startDate",render:({field:R})=>o.jsxs(De,{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:g("date_label")||"Date"}),o.jsx(be,{children:o.jsx(fo,{value:new Date(R.value),disabled:_,onChange:V=>{if(V){const H=new Date(R.value);_?V.setHours(0,0,0,0):V.setHours(H.getHours(),H.getMinutes()),R.onChange(Or(V))}},className:"w-full"})}),o.jsx(nt,{})]})}),_?o.jsx("div",{"aria-hidden":"true"}):o.jsx(Re,{control:C.control,name:"startDate",render:({field:R})=>o.jsxs(De,{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:g("time_label")||"Time"}),o.jsx(be,{children:o.jsx(bt,{value:Ne(new Date(R.value),y.language,"time24"),readOnly:!0,className:"cursor-pointer w-full text-center",onClick:()=>k(!0),tabIndex:-1})}),o.jsx(nt,{})]})}),_?o.jsx("div",{"aria-hidden":"true"}):o.jsx(Re,{control:C.control,name:"durationHours",render:({field:R})=>o.jsxs(De,{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:g("duration_label")}),o.jsxs(Zt,{onValueChange:V=>R.onChange(Number(V)),value:String(R.value),disabled:_,children:[o.jsx(be,{children:o.jsx(Mt,{className:"w-full",children:o.jsx(Pt,{})})}),o.jsx(Ot,{className:"max-h-[var(--ui-space-50)]",children:[.25,.5,.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.5,4,4.5,5,6,8].map(V=>o.jsx(at,{value:String(V),children:yg(V)},V))})]}),o.jsx(nt,{})]})}),_?o.jsx("div",{"aria-hidden":"true"}):o.jsxs("div",{className:"space-y-[var(--ui-space-1-5)]",children:[o.jsx(_e,{className:"text-xs text-muted-foreground",children:"End Time"}),o.jsx("div",{className:"h-[var(--ui-component-height)] px-3 py-1 flex items-center justify-center border border-transparent text-sm text-foreground/80 font-medium whitespace-nowrap",children:Number.isNaN(B.getTime())?"-":Ne(B,y.language,"time24")})]})]})]}),T&&o.jsxs("div",{className:"p-[var(--ui-space-4)] bg-red-50 border border-red-500 rounded text-red-800 flex items-start gap-[var(--ui-space-2)]",children:[o.jsx(ye.AlertTriangle,{className:"w-[var(--ui-space-5)] h-[var(--ui-space-5)] flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("strong",{className:"block text-sm",children:"Conflict Detected"}),o.jsxs("span",{className:"text-xs",children:[g("event_form_conflict_warning")," (",Ne(T.existingSchedule.startDate,y.language,"time24")," ","-"," ",Ne(T.existingSchedule.endDate,y.language,"time24"),")"]})]})]}),o.jsx(Re,{control:C.control,name:"note",render:({field:R})=>o.jsxs(De,{children:[o.jsx(_e,{children:g("note_label")}),o.jsx(be,{children:o.jsx(gn,{...R,value:R.value||"",placeholder:"Add notes...",rows:2})})]})}),o.jsxs("div",{className:"flex gap-[var(--ui-space-3)] pt-[var(--ui-space-4)] border-t border-border",children:[x&&u&&o.jsx(ae,{type:"button",variant:"outline-delete",size:"sm",onClick:u,className:"flex-1",children:g("delete_button")}),o.jsx(ae,{type:"button",variant:"outline",size:"sm",onClick:l,className:"flex-1",children:g("cancel_button")}),o.jsx(ae,{type:"submit",variant:"default",size:"sm",className:"flex-1",children:g("save_button")})]})]}),o.jsx(Ms,{open:v,onClose:()=>k(!1),onSubmit:R=>{const V=new Date(C.getValues("startDate")),[H,Q]=R.split(":").map(Number);V.setHours(H||0,Q||0),C.setValue("startDate",Or(V)),k(!1)},initialValue:Ne(new Date(C.getValues("startDate")),y.language,"time24"),variant:"time"})]})}function ko({isOpen:e,event:t,resources:r,groups:n,events:s,defaultResourceId:a,defaultStartTime:i,onClose:c,onSave:l,onDelete:u,readOnlyResource:f,personnel:d=[],currentUserId:h,resourceAvailability:p,onAvailabilityRequest:b,customFields:g}){const{t:y}=Fe(),x=!!t,[v,k]=m.useState(!1),[w,S]=m.useState({open:!1,title:"",onConfirm:()=>{}});m.useEffect(()=>{if(e){k(!1);const _=setTimeout(()=>{k(!0)},500);return()=>clearTimeout(_)}k(!1)},[e]);const C=()=>{!t||!u||S({open:!0,title:y("confirm_delete_title"),description:y("confirm_delete_message"),onConfirm:()=>{u(t.id),S(_=>({..._,open:!1})),c()}})};return o.jsxs(Kr,{open:e,onOpenChange:_=>!_&&c(),title:y(x?"event_edit_title":"event_create_title"),className:"sm:max-w-3xl",children:[o.jsx("div",{style:{pointerEvents:v?"auto":"none"},children:o.jsx(fu,{event:t,resources:r,groups:n,events:s,personnel:d,resourceAvailability:p,defaultResourceId:a,defaultStartTime:i,onSubmit:l,onCancel:c,onDelete:x&&u?C:void 0,readOnlyResource:f,currentUserId:h,onAvailabilityRequest:b,customFields:g})}),o.jsx(vo,{open:w.open,onOpenChange:_=>S(N=>({...N,open:_})),title:w.title,description:w.description,onConfirm:w.onConfirm,variant:"destructive"})]})}const hu=m.createContext(void 0);function mu(){const e=m.useContext(hu);if(!e)throw new Error("useScheduleContext must be used within a ScheduleProvider");return e}function wg({children:e,apiClient:t,onError:r}){const n=m.useRef(t);m.useEffect(()=>{n.current=t},[t]);const s=m.useRef(null),[a,i]=m.useState([]),[c,l]=m.useState([]),[u,f]=m.useState([]),[d,h]=m.useState([]),[p,b]=m.useState(null),[g,y]=m.useState([]),[x,v]=m.useState(!0),[k,w]=m.useState(null),[S,C]=m.useState(new Map);m.useEffect(()=>{(async()=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot load data."),v(!1);return}try{const z=t.getConfig(),W=t.getEvents();s.current||(s.current=t.getPersonnel().catch(Ae=>{throw s.current=null,Ae}));const[se,ne,fe]=await Promise.all([z,W,s.current]);h(se.groups),f(se.resources),b(se.settings);const pe=ne.filter(Ae=>!!Ae.resourceId);i(pe),y(fe)}catch(z){console.error("Failed to load schedule data",z),w(z instanceof Error?z.message:"Unknown error")}finally{v(!1)}})()},[t]);const _=m.useCallback(async Y=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot create event.");return}try{const z=await t.createEvent(Y);i(W=>[...W,z]),l(W=>[...W,z]),C(new Map)}catch(z){console.error("Failed to create event",z);const W=z instanceof Error?z:new Error(String(z));throw r?.(W),W}},[t,r]),N=m.useCallback(async(Y,z)=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot update event.");return}try{const W=await t.updateEvent(Y,z);i(se=>se.map(ne=>ne.id===Y?W:ne)),l(se=>se.map(ne=>ne.id===Y?W:ne)),C(new Map)}catch(W){console.error("Failed to update event",W);const se=W instanceof Error?W:new Error(String(W));throw r?.(se),se}},[t,r]),I=m.useCallback(async Y=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot delete event.");return}try{await t.deleteEvent(Y),i(z=>z.filter(W=>W.id!==Y)),l(z=>z.filter(W=>W.id!==Y)),C(new Map)}catch(z){console.error("Failed to delete event",z);const W=z instanceof Error?z:new Error(String(z));throw r?.(W),W}},[t,r]),M=m.useCallback(async Y=>{const z=await t.createGroup(Y);return h(W=>[...W,z]),z},[t]),B=m.useCallback(async(Y,z)=>{const W=await t.updateGroup(Y,z);return h(se=>se.map(ne=>ne.id===Y?W:ne)),W},[t]),E=m.useCallback(async Y=>{await t.deleteGroup(Y),h(z=>z.filter(W=>W.id!==Y))},[t]),F=m.useCallback(async Y=>{const z=await t.createResource(Y);return f(W=>[...W,z]),z},[t]),T=m.useCallback(async(Y,z)=>{const W=await t.updateResource(Y,z);return f(se=>se.map(ne=>ne.id===Y?W:ne)),W},[t]),$=m.useCallback(async Y=>{await t.deleteResource(Y),f(z=>z.filter(W=>W.id!==Y))},[t]),O=m.useCallback(async(Y,z)=>{try{const W=await t.updatePersonnelPriority(Y,z);y(se=>{const ne=se.map(fe=>fe.id===Y?W:fe);return ne.sort((fe,pe)=>pe.priority!==fe.priority?pe.priority-fe.priority:fe.name.localeCompare(pe.name,"ja")),ne})}catch(W){console.error("Failed to update personnel priority",W);const se=W instanceof Error?W:new Error(String(W));throw r?.(se),se}},[t,r]),A=m.useCallback(async(Y,z=!1)=>{if(!t){console.error("ScheduleProvider: apiClient is undefined. Cannot fetch personnel events.");return}if(Y.length===0){z||l([]);return}try{const W=await t.getEvents(Y);l(z?se=>{const ne=new Set(se.map(pe=>pe.id)),fe=W.filter(pe=>!ne.has(pe.id));return[...se,...fe]}:W)}catch(W){throw console.error("Failed to fetch personnel events",W),W}},[t]),R=m.useCallback((Y,z)=>{const W=new Date(Y);return W.setHours(0,0,0,0),`${W.toISOString().split("T")[0]}_${z}`},[]),V=m.useCallback((Y,z="day")=>{const W=R(Y,z);return S.get(W)},[S,R]),H=m.useCallback(async(Y,z="day")=>{const W=R(Y,z),se=S.get(W);if(se)return se;try{const ne=await t.getResourceAvailability({date:Y,view:z});return C(fe=>{const pe=new Map(fe);return pe.set(W,ne),pe}),ne}catch(ne){return console.error("Failed to fetch resource availability",ne),[]}},[S,t,R]),Q={events:a,personnelEvents:c,resources:u,groups:d,settings:p,personnel:g,loading:x,error:k,createEvent:_,updateEvent:N,deleteEvent:I,createGroup:M,updateGroup:B,deleteGroup:E,createResource:F,updateResource:T,deleteResource:$,updatePersonnelPriority:O,fetchPersonnelEvents:A,fetchResourceAvailability:H,getResourceAvailabilityFromCache:V};return o.jsx(hu.Provider,{value:Q,children:e})}const rr={SLOT_HEIGHT:60,SLOT_WIDTH:50,HEADER_HEIGHT:64,TIME_COLUMN_WIDTH:64},nr={DAY_CELL_HEIGHT:110,DATE_COLUMN_WIDTH:56,MAX_VISIBLE_EVENTS:4};function jo(e){const t=new Map,r=new Map,n=new Map;for(const s of e){if(s.resourceId){const l=t.get(s.resourceId)??[];l.push(s),t.set(s.resourceId,l)}const a=xr(s.startDate),i=r.get(a)??[];i.push(s),r.set(a,i);const c=n.get(s.groupId)??[];c.push(s),n.set(s.groupId,c)}return{byResource:t,byDay:r,byGroup:n}}const Vn=new Map;function xr(e){const r=e.getTime().toString(),n=Vn.get(r);if(n)return n;const s=new Date(e);s.setHours(0,0,0,0);const a=s.toISOString().split("T")[0]??"";return Vn.size>1e3&&Vn.clear(),Vn.set(r,a),a}function _g(e,t){return t.byResource.get(e)??[]}function pu(e,t){const r=xr(e);return t.byDay.get(r)??[]}const Sg=({children:e})=>o.jsx(o.Fragment,{children:e}),kg=({children:e})=>o.jsx("div",{className:"group contents",children:e}),jg=({children:e,asChild:t,...r})=>{if(t&&j.isValidElement(e)){const n=e;return j.cloneElement(n,{...r,className:de(n.props.className,"cursor-help")})}return o.jsx("span",{...r,className:"cursor-help inline-block",children:e})},Cg=({children:e,className:t,...r})=>o.jsx("div",{className:de("absolute z-50 overflow-hidden rounded-md border bg-popover px-[var(--ui-space-3)] py-[var(--ui-space-1-5)] text-sm text-popover-foreground shadow-md 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-[var(--ui-space-2)] data-[side=left]:slide-in-from-right-[var(--ui-space-2)] data-[side=right]:slide-in-from-left-[var(--ui-space-2)] data-[side=top]:slide-in-from-bottom-[var(--ui-space-2)]","hidden group-hover:block w-max max-w-xs bottom-full mb-[var(--ui-space-2)] left-[var(--ui-space-1)]/2 -translate-x-[var(--ui-space-1)]/2",t),...r,children:e});function Li({event:e,top:t,height:r,widthPercent:n=100,leftPercent:s=0,onClick:a,isDragging:i=!1,components:c,orientation:l="vertical"}){const u=e.startDate.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),f=e.endDate.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),d=Math.round((e.endDate.getTime()-e.startDate.getTime())/(1e3*60*60)*10)/10,h=e.hasConflict?"bg-destructive border-destructive":e.color?"border-primary/30":"bg-primary border-primary/30",p=x=>x.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),b=`${d}h`,y=l==="horizontal"?{left:`${t}px`,width:`${r}px`,top:`${s}%`,height:`${n}%`,paddingTop:s>0?"1px":"2px",paddingBottom:s+n<100?"1px":"2px"}:{top:`${t}px`,height:`${r}px`,left:`${s}%`,width:`${n}%`,paddingLeft:s>0?"2px":"4px",paddingRight:s+n<100?"2px":"4px"};return e.color&&!e.hasConflict&&(y.backgroundColor=e.color),o.jsx(Sg,{children:o.jsxs(kg,{children:[o.jsx(jg,{asChild:!0,children:o.jsx("button",{type:"button",className:`
|
|
46
46
|
absolute rounded-md shadow-sm border
|
|
47
47
|
transition-all duration-200 cursor-pointer
|
|
48
48
|
${i?"opacity-50 scale-95":"hover:shadow-md hover:scale-[1.02] hover:z-20"}
|
|
49
49
|
${h} text-primary-foreground text-center
|
|
50
50
|
${e.hasConflict?"ring-2 ring-red-400 ring-offset-1":""}
|
|
51
|
-
`,style:{...y,zIndex:20},onClick:a,children:o.jsx("div",{className:"p-[var(--ui-space-2)] h-full flex flex-col items-center justify-start overflow-hidden",children:c?.EventCard?o.jsx(c.EventCard,{event:e,viewMode:"day",onClick:a,className:"w-full h-full"}):o.jsxs(o.Fragment,{children:[e.hasConflict&&o.jsx("div",{className:"text-xs font-bold mb-[var(--ui-space-1)]",children:"⚠️ Double Booking"}),o.jsx("div",{className:"font-semibold text-sm leading-snug break-words",children:e.title}),!e.isAllDay&&o.jsxs("div",{className:"flex flex-wrap justify-center items-center gap-x-[var(--ui-space-1)] text-[10px] opacity-90 mt-[var(--ui-space-1)] w-full text-center leading-tight",children:[o.jsx("span",{className:"font-mono tabular-nums tracking-tight",children:m(e.startDate)}),d>=.5&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"-"}),o.jsx("span",{className:"font-mono tabular-nums tracking-tight",children:m(e.endDate)}),o.jsxs("span",{className:"ml-[var(--ui-space-0-5)] opacity-75",children:["(",b,")"]})]})]})]})})})}),o.jsx(rg,{children:o.jsxs("div",{className:"space-y-[var(--ui-space-1)]",children:[e.hasConflict&&o.jsx("p",{className:"font-bold text-xs text-red-600",children:"⚠️ Double Booking"}),o.jsx("p",{className:"font-semibold text-xs",children:e.title}),o.jsxs("p",{className:"text-xs",children:[u," - ",f," (",d,"h)"]}),e.note&&o.jsx("p",{className:"text-[10px] text-muted-foreground max-w-[var(--ui-space-45)] break-words",children:e.note}),e.description&&o.jsx("p",{className:"text-[10px] text-muted-foreground max-w-[var(--ui-space-45)] break-words italic",children:e.description})]})})]})})}function Ai({resource:e,events:t,allDayEvents:r=[],startTime:n,endTime:s,currentDate:a,slotSize:i,slotInterval:c=60,onEventClick:l,onEmptySlotClick:u,components:f,orientation:d="vertical",headerLeftOffset:h=0}){const m=n.split(":"),b=s.split(":"),g=Number(m[0]??0),y=Number(m[1]??0),x=Number(b[0]??23),v=Number(b[1]??0),_=p.useRef(null),w=d==="horizontal",S=p.useMemo(()=>{const N=g*60+y,F=x*60+v,A=[];for(let V=N;V<F;V+=c)A.push(V);return A},[g,y,x,v,c]),k=i,j=S.length*k,E=p.useMemo(()=>{const N=[...t];if(r.length>0&&r.forEach(O=>{const P={...O},R=new Date(a);R.setHours(g,y,0,0);const B=new Date(a);B.setHours(x,v,0,0),P.startDate=R,P.endDate=B,N.push(P)}),N.length===0)return[];const F=[...N].sort((O,P)=>O.startDate.getTime()-P.startDate.getTime()),A=[];for(const O of F){let P=!1;for(const R of A)if(R.some(z=>Ts(z,O))){R.push(O),P=!0;break}P||A.push([O])}const V=[];for(const O of A)if(O.length===1){const P=O[0];P&&V.push({...P,column:0,totalColumns:1})}else{const P=Math.min(O.length,4);for(let R=0;R<O.length;R++){const B=O[R];B&&V.push({...B,column:R%P,totalColumns:P})}}return V},[t,r,a,g,y,x,v]);function I(N){const F=N,A=new Date(a);A.setHours(g,y,0,0);const O=(G=>(G.getTime()-A.getTime())/(1e3*60))(F.startDate),P=(F.endDate.getTime()-F.startDate.getTime())/(1e3*60),R=O/c*i,B=P/c*i,z=100/N.totalColumns,J=N.column*100/N.totalColumns;return{top:R,height:B,widthPercent:z,leftPercent:J}}function M(N){if(!u)return;const F=N.currentTarget.getBoundingClientRect(),A=w?N.clientX-F.left:N.clientY-F.top,O=Math.max(0,Math.floor(A/i))*c,P=new Date(a);P.setHours(g,y,0,0),P.setMinutes(P.getMinutes()+O),u(e.id,P)}function H(){if(!u)return;const N=new Date(a);N.setHours(g,0,0,0),u(e.id,N)}return w?o.jsxs("div",{className:"flex border-b border-border hover:bg-muted/5 w-full h-[var(--ui-space-24)] shrink-0",children:[o.jsxs("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border bg-background flex flex-col items-center justify-center sticky z-30 shrink-0 p-2",style:{left:h},children:[o.jsx("div",{className:"font-semibold text-xs text-center",children:e.name}),o.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[t.length+r.length," events"]})]}),o.jsxs("div",{ref:_,className:"relative flex-1 cursor-pointer min-w-max h-full",style:{minWidth:`${j}px`},onPointerUp:M,children:[o.jsx("div",{className:"absolute inset-0 z-0 pointer-events-none flex",children:S.map(N=>o.jsx("div",{className:"border-r border-border/50 h-full",style:{width:`${k}px`}},N))}),o.jsx("div",{className:"relative h-full z-10 flex",children:E.map(N=>{const{top:F,height:A,widthPercent:V,leftPercent:O}=I(N);return o.jsx(Ei,{event:N,top:F,height:A,widthPercent:V,leftPercent:O,onClick:P=>{P.stopPropagation(),l?.(N)},components:f,orientation:"horizontal"},N.id)})})]})]}):o.jsxs("div",{className:"flex-1 min-w-[var(--ui-space-22-5)] border-r border-border hover:bg-muted/5 flex flex-col",children:[o.jsx("div",{className:"h-[var(--ui-space-14)] border-b border-border bg-background flex items-center justify-center sticky top-[var(--ui-space-0)] z-20 shrink-0 py-[var(--ui-space-2)]",children:o.jsxs("div",{className:"text-center relative",children:[o.jsx("div",{className:"font-semibold text-sm",children:e.name}),o.jsxs("div",{className:"text-xs text-muted-foreground",children:[t.length+r.length," events"]}),o.jsx(oe,{type:"button",variant:"ghost",className:"sr-only focus:not-sr-only focus:absolute focus:right-[var(--ui-space-2)] focus:top-[var(--ui-space-2)]",onClick:N=>{N.stopPropagation(),H()},children:`Add event to ${e.name}`})]})}),o.jsxs("div",{ref:_,className:"relative flex-1 w-full cursor-pointer",style:{minHeight:`${j}px`},onPointerUp:M,children:[o.jsx("div",{className:"absolute inset-[var(--ui-space-0)] z-0 pointer-events-none flex flex-col",children:S.map(N=>o.jsx("div",{className:"border-b border-border/50 w-full",style:{height:`${k}px`}},N))}),o.jsx("div",{className:"relative w-full z-10 flex flex-col",children:E.map(N=>{const{top:F,height:A,widthPercent:V,leftPercent:O}=I(N);return o.jsx(Ei,{event:N,top:F,height:A,widthPercent:V,leftPercent:O,onClick:P=>{P.stopPropagation(),l?.(N)},components:f,orientation:"vertical"},N.id)})})]})]})}function Ti({startTime:e,endTime:t,slotSize:r=60,slotInterval:n=60,orientation:s="vertical"}){const a=ng(e,t,n),i=s==="horizontal",c=r;return i?o.jsx("div",{className:"flex min-w-max",children:a.map(l=>o.jsx("div",{className:"border-r border-border flex items-center justify-center text-[10px] text-muted-foreground font-medium flex-shrink-0",style:{width:`${c}px`},children:l},l))}):o.jsxs("div",{className:"flex flex-col border-r border-border h-full bg-background",children:[o.jsx("div",{className:"h-[var(--ui-space-14)] border-b border-border bg-background sticky top-[var(--ui-space-0)] z-30"}),a.map(l=>o.jsx("div",{className:"border-b border-border flex items-start justify-end pe-2 py-[var(--ui-space-0-5)] text-xs text-muted-foreground font-medium",style:{height:`${c}px`},children:l},l))]})}function ng(e,t,r){const n=e.split(":"),s=t.split(":"),a=Number(n[0]??0),i=Number(n[1]??0),c=Number(s[0]??23),l=Number(s[1]??0),u=a*60+i,f=c*60+l,d=[];for(let h=u;h<f;h+=r){const m=Math.floor(h/60),b=h%60;d.push(`${m.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`)}return d}function sg({currentDate:e,resources:t,events:r,settings:n,groups:s=[],onEventClick:a,onEmptySlotClick:i,components:c}){const l=j=>{const[E,I]=j.split(":").map(Number);return E+I/60},u=l(n.startTime),f=l(n.endTime),d=Math.round(u*60),h=Math.round(f*60),m=n.slotInterval??60,b=Math.ceil((h-d)/m),g=b*tr.SLOT_HEIGHT+tr.HEADER_HEIGHT,y=b*tr.SLOT_WIDTH,{allDayEvents:x,timedEvents:v}=p.useMemo(()=>{const{start:j,end:E}=Xl(e,"day",n),I=Rs(r,j,E),M=lo(I);return{allDayEvents:M.filter(H=>H.isAllDay),timedEvents:M.filter(H=>!H.isAllDay)}},[r,e,n]),_=p.useMemo(()=>go(v),[v]),w=p.useMemo(()=>{const j=new Map;for(const E of t){const I=Jp(E.id,_);j.set(E.id,I)}return j},[t,_]),S=p.useMemo(()=>{const j=new Map;for(const E of s)j.set(E.id,E);return j},[s]),k=n.orientation==="vertical";return o.jsx("div",{className:"flex flex-col h-full bg-background",children:k?o.jsx("div",{className:"flex-1 overflow-auto relative",children:o.jsxs("div",{className:"flex flex-col min-w-max",style:{minWidth:`${y+128}px`},children:[o.jsxs("div",{className:"flex border-b border-border bg-muted/40 sticky top-0 z-30",children:[o.jsxs("div",{className:"flex-shrink-0 bg-background border-r border-b border-border sticky left-0 z-50 flex",children:[o.jsx("div",{className:"w-[var(--ui-space-12)] border-r border-border shrink-0"})," ",o.jsx("div",{className:"w-[var(--ui-space-32)] flex-1 shrink-0"})," "]}),o.jsx(Ti,{startTime:n.startTime,endTime:n.endTime,slotSize:tr.SLOT_WIDTH,slotInterval:n.slotInterval??60,orientation:"horizontal"})]}),o.jsx("div",{className:"flex flex-col",children:(()=>{const j=[];let E,I=[];return t.forEach((M,H)=>{const N=S.get(M.groupId),F=H>0?t[H-1]:null;F&&F.groupId!==M.groupId&&(j.push({group:E,resources:I}),I=[]),E=N,I.push(M)}),I.length>0&&j.push({group:E,resources:I}),j.map((M,H)=>o.jsxs("div",{className:"flex border-b border-border relative",children:[o.jsx("div",{className:"sticky left-0 z-20 w-[var(--ui-space-12)] flex-shrink-0 bg-background border-r border-border flex items-center justify-center font-bold text-muted-foreground writing-mode-vertical-rl",children:o.jsx("div",{className:"sticky top-[var(--ui-space-14)] py-2 max-h-screen",children:M.group?.name||"-"})}),o.jsx("div",{className:"flex flex-col flex-1 min-w-0",children:M.resources.map((N,F)=>o.jsx("div",{className:`${F<M.resources.length-1?"border-b border-border":""}`,children:o.jsx(Ai,{resource:N,events:w.get(N.id)||[],allDayEvents:x.filter(A=>A.resourceId===N.id),startTime:n.startTime,endTime:n.endTime,currentDate:e,slotSize:tr.SLOT_WIDTH,slotInterval:n.slotInterval??60,onEventClick:a,onEmptySlotClick:i,components:c,orientation:"horizontal",headerLeftOffset:"var(--ui-space-12)"})},N.id))})]},`${M.group?.id}-${H}`))})()})]})}):o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsxs("div",{className:"flex",style:{minHeight:`${g}px`},children:[o.jsxs("div",{className:"sticky left-[var(--ui-space-0)] z-30 bg-background",style:{width:`${tr.TIME_COLUMN_WIDTH}px`},children:[o.jsx("div",{className:"sticky top-0 z-40 bg-background border-b border-r border-border h-[var(--ui-space-8)]"})," ",o.jsx(Ti,{startTime:n.startTime,endTime:n.endTime,slotSize:tr.SLOT_HEIGHT,slotInterval:n.slotInterval??60,orientation:"vertical"})]}),o.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[o.jsx("div",{className:"flex sticky top-0 z-30 bg-background border-b border-border h-[var(--ui-space-8)]",children:(()=>{const j=[];for(let E=0;E<t.length;E++){const I=t[E],M=S.get(I.groupId);let H=1;for(;E+H<t.length&&t[E+H].groupId===I.groupId;)H++;j.push(o.jsx("div",{className:"flex items-center justify-center border-r border-border text-xs font-semibold bg-muted/20 truncate px-2",style:{flex:`${H} ${H} 0%`},children:M?.name||"-"},`group-${I.groupId}-${E}`)),E+=H-1}return j})()}),o.jsx("div",{className:"flex flex-1 min-w-0",children:t.map(j=>o.jsx(Ai,{resource:j,events:w.get(j.id)||[],allDayEvents:x.filter(E=>E.resourceId===j.id),startTime:n.startTime,endTime:n.endTime,currentDate:e,slotSize:tr.SLOT_HEIGHT,slotInterval:n.slotInterval,onEventClick:a,onEmptySlotClick:i,components:c,orientation:"vertical"},j.id))})]})]})})})}const ag=e=>e.startsWith("ja")?"ja-JP":"en-GB",Ri=e=>{switch(e){case"japanese":return"ja-JP-u-ca-japanese";case"buddhist":return"th-TH-u-ca-buddhist";case"islamic":return"ar-SA-u-ca-islamic";case"chinese":return"zh-CN-u-ca-chinese";default:return null}},og=e=>e==="full"||e==="date"||e==="weekday"||e==="weekdayShort"||e==="yearMonth"||e==="monthDay"||e==="monthDayShort"||e==="compact",ig=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-secondary-calendar"),cg=()=>typeof document>"u"?!1:document.documentElement.getAttribute("data-prefer-local-calendar")==="true",lg=e=>e.startsWith("ja")?"japanese":e.startsWith("th")?"buddhist":e.startsWith("ar")?"islamic":e.startsWith("zh")?"chinese":null,Pi=(e,t,r,n)=>{const s=a=>new Intl.DateTimeFormat(t,{...a,calendar:n}).format(e);switch(r){case"weekday":return s({weekday:"long"});case"weekdayShort":return s({weekday:"short"});case"date":return s({year:"numeric",month:"short",day:"numeric"});case"monthDayShort":return s({month:"short",day:"numeric",weekday:"short"});case"compact":return s({month:"numeric",day:"numeric",weekday:"short"});case"yearMonth":return s({year:"numeric",month:"long"});case"monthDay":return s({month:"long",day:"numeric"});default:return s({year:"numeric",month:"long",day:"numeric",weekday:"long"})}},It=p.memo(({date:e,format:t="full",variant:r,className:n,showSecondary:s,showDayOfWeek:a,...i})=>{const{i18n:c}=Le(),l=c.language||"en",u=ag(l),f=t==="full"&&og(r)?r:t,d=()=>f==="full"||f==="yearMonth"||f==="monthDay"||f==="monthDayShort"||f==="compact"||f==="weekday"||f==="weekdayShort"?Ne(e,u,f):f==="date"?Ne(e,u,"picker"):Ne(e,u,"full"),h=()=>cg()?lg(l):null,m=()=>{const x=h();if(x){const v=Ri(x)??u;return Pi(e,v,f,x)}return d()},b=()=>{if(!s)return null;const x=ig();if(!x||x==="none")return null;const v=h();if(x===v)return null;const _=Ri(x)??u;return Pi(e,_,f,x)},g=m(),y=b();return o.jsxs("span",{className:de("inline-block",n),...i,children:[g,y&&o.jsxs("span",{className:"ml-[var(--ui-space-2)] text-muted-foreground",children:["(",y,")"]})]})});function ru({value:e,valueScale:t="ratio",options:r,className:n,...s}){const a=t==="percent"?e/100:e,i=new Intl.NumberFormat("en-US",{style:"percent",...r}).format(a);return o.jsx("span",{className:de("",n),...s,children:i})}function ug({date:e,density:t,isCurrentMonth:r,isClosedDay:n,maxSlots:s,onClick:a}){const i=e.getDate(),c=Math.round(t/100*s),l=t===0,u=l?0:.1+t/100*.9,f=t>50,d=f?"text-white":"text-foreground",h=f?"text-white/90":"text-muted-foreground";return o.jsxs("button",{type:"button",className:`
|
|
51
|
+
`,style:{...y,zIndex:20},onClick:a,children:o.jsx("div",{className:"p-[var(--ui-space-2)] h-full flex flex-col items-center justify-start overflow-hidden",children:c?.EventCard?o.jsx(c.EventCard,{event:e,viewMode:"day",onClick:a,className:"w-full h-full"}):o.jsxs(o.Fragment,{children:[e.hasConflict&&o.jsx("div",{className:"text-xs font-bold mb-[var(--ui-space-1)]",children:"⚠️ Double Booking"}),o.jsx("div",{className:"font-semibold text-sm leading-snug break-words",children:e.title}),!e.isAllDay&&o.jsxs("div",{className:"flex flex-wrap justify-center items-center gap-x-[var(--ui-space-1)] text-[10px] opacity-90 mt-[var(--ui-space-1)] w-full text-center leading-tight",children:[o.jsx("span",{className:"font-mono tabular-nums tracking-tight",children:p(e.startDate)}),d>=.5&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"-"}),o.jsx("span",{className:"font-mono tabular-nums tracking-tight",children:p(e.endDate)}),o.jsxs("span",{className:"ml-[var(--ui-space-0-5)] opacity-75",children:["(",b,")"]})]})]})]})})})}),o.jsx(Cg,{children:o.jsxs("div",{className:"space-y-[var(--ui-space-1)]",children:[e.hasConflict&&o.jsx("p",{className:"font-bold text-xs text-red-600",children:"⚠️ Double Booking"}),o.jsx("p",{className:"font-semibold text-xs",children:e.title}),o.jsxs("p",{className:"text-xs",children:[u," - ",f," (",d,"h)"]}),e.note&&o.jsx("p",{className:"text-[10px] text-muted-foreground max-w-[var(--ui-space-45)] break-words",children:e.note}),e.description&&o.jsx("p",{className:"text-[10px] text-muted-foreground max-w-[var(--ui-space-45)] break-words italic",children:e.description})]})})]})})}function Vi({resource:e,events:t,allDayEvents:r=[],startTime:n,endTime:s,currentDate:a,slotSize:i,slotInterval:c=60,onEventClick:l,onEmptySlotClick:u,components:f,orientation:d="vertical",headerLeftOffset:h=0}){const p=n.split(":"),b=s.split(":"),g=Number(p[0]??0),y=Number(p[1]??0),x=Number(b[0]??23),v=Number(b[1]??0),k=m.useRef(null),w=d==="horizontal",S=m.useMemo(()=>{const E=g*60+y,F=x*60+v,T=[];for(let $=E;$<F;$+=c)T.push($);return T},[g,y,x,v,c]),C=i,_=S.length*C,N=m.useMemo(()=>{const E=[...t];if(r.length>0&&r.forEach(O=>{const A={...O},R=new Date(a);R.setHours(g,y,0,0);const V=new Date(a);V.setHours(x,v,0,0),A.startDate=R,A.endDate=V,E.push(A)}),E.length===0)return[];const F=[...E].sort((O,A)=>O.startDate.getTime()-A.startDate.getTime()),T=[];for(const O of F){let A=!1;for(const R of T)if(R.some(H=>Ps(H,O))){R.push(O),A=!0;break}A||T.push([O])}const $=[];for(const O of T)if(O.length===1){const A=O[0];A&&$.push({...A,column:0,totalColumns:1})}else{const A=Math.min(O.length,4);for(let R=0;R<O.length;R++){const V=O[R];V&&$.push({...V,column:R%A,totalColumns:A})}}return $},[t,r,a,g,y,x,v]);function I(E){const F=E,T=new Date(a);T.setHours(g,y,0,0);const O=(Y=>(Y.getTime()-T.getTime())/(1e3*60))(F.startDate),A=(F.endDate.getTime()-F.startDate.getTime())/(1e3*60),R=O/c*i,V=A/c*i,H=100/E.totalColumns,Q=E.column*100/E.totalColumns;return{top:R,height:V,widthPercent:H,leftPercent:Q}}function M(E){if(!u)return;const F=E.currentTarget.getBoundingClientRect(),T=w?E.clientX-F.left:E.clientY-F.top,O=Math.max(0,Math.floor(T/i))*c,A=new Date(a);A.setHours(g,y,0,0),A.setMinutes(A.getMinutes()+O),u(e.id,A)}function B(){if(!u)return;const E=new Date(a);E.setHours(g,0,0,0),u(e.id,E)}return w?o.jsxs("div",{className:"flex border-b border-border hover:bg-muted/5 w-full h-[var(--ui-space-24)] shrink-0",children:[o.jsxs("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border bg-background flex flex-col items-center justify-center sticky z-30 shrink-0 p-2",style:{left:h},children:[o.jsx("div",{className:"font-semibold text-xs text-center",children:e.name}),o.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[t.length+r.length," events"]})]}),o.jsxs("div",{ref:k,className:"relative flex-1 cursor-pointer min-w-max h-full",style:{minWidth:`${_}px`},onPointerUp:M,children:[o.jsx("div",{className:"absolute inset-0 z-0 pointer-events-none flex",children:S.map(E=>o.jsx("div",{className:"border-r border-border/50 h-full",style:{width:`${C}px`}},E))}),o.jsx("div",{className:"relative h-full z-10 flex",children:N.map(E=>{const{top:F,height:T,widthPercent:$,leftPercent:O}=I(E);return o.jsx(Li,{event:E,top:F,height:T,widthPercent:$,leftPercent:O,onClick:A=>{A.stopPropagation(),l?.(E)},components:f,orientation:"horizontal"},E.id)})})]})]}):o.jsxs("div",{className:"flex-1 min-w-[var(--ui-space-22-5)] border-r border-border hover:bg-muted/5 flex flex-col",children:[o.jsx("div",{className:"h-[var(--ui-space-14)] border-b border-border bg-background flex items-center justify-center sticky top-[var(--ui-space-0)] z-20 shrink-0 py-[var(--ui-space-2)]",children:o.jsxs("div",{className:"text-center relative",children:[o.jsx("div",{className:"font-semibold text-sm",children:e.name}),o.jsxs("div",{className:"text-xs text-muted-foreground",children:[t.length+r.length," events"]}),o.jsx(ae,{type:"button",variant:"ghost",className:"sr-only focus:not-sr-only focus:absolute focus:right-[var(--ui-space-2)] focus:top-[var(--ui-space-2)]",onClick:E=>{E.stopPropagation(),B()},children:`Add event to ${e.name}`})]})}),o.jsxs("div",{ref:k,className:"relative flex-1 w-full cursor-pointer",style:{minHeight:`${_}px`},onPointerUp:M,children:[o.jsx("div",{className:"absolute inset-[var(--ui-space-0)] z-0 pointer-events-none flex flex-col",children:S.map(E=>o.jsx("div",{className:"border-b border-border/50 w-full",style:{height:`${C}px`}},E))}),o.jsx("div",{className:"relative w-full z-10 flex flex-col",children:N.map(E=>{const{top:F,height:T,widthPercent:$,leftPercent:O}=I(E);return o.jsx(Li,{event:E,top:F,height:T,widthPercent:$,leftPercent:O,onClick:A=>{A.stopPropagation(),l?.(E)},components:f,orientation:"vertical"},E.id)})})]})]})}function zi({startTime:e,endTime:t,slotSize:r=60,slotInterval:n=60,orientation:s="vertical"}){const a=Dg(e,t,n),i=s==="horizontal",c=r;return i?o.jsx("div",{className:"flex min-w-max",children:a.map(l=>o.jsx("div",{className:"border-r border-border flex items-center justify-center text-[10px] text-muted-foreground font-medium flex-shrink-0",style:{width:`${c}px`},children:l},l))}):o.jsxs("div",{className:"flex flex-col border-r border-border h-full bg-background",children:[o.jsx("div",{className:"h-[var(--ui-space-14)] border-b border-border bg-background sticky top-[var(--ui-space-0)] z-30"}),a.map(l=>o.jsx("div",{className:"border-b border-border flex items-start justify-end pe-2 py-[var(--ui-space-0-5)] text-xs text-muted-foreground font-medium",style:{height:`${c}px`},children:l},l))]})}function Dg(e,t,r){const n=e.split(":"),s=t.split(":"),a=Number(n[0]??0),i=Number(n[1]??0),c=Number(s[0]??23),l=Number(s[1]??0),u=a*60+i,f=c*60+l,d=[];for(let h=u;h<f;h+=r){const p=Math.floor(h/60),b=h%60;d.push(`${p.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`)}return d}function Ng({currentDate:e,resources:t,events:r,settings:n,groups:s=[],onEventClick:a,onEmptySlotClick:i,components:c}){const l=_=>{const[N,I]=_.split(":").map(Number);return N+I/60},u=l(n.startTime),f=l(n.endTime),d=Math.round(u*60),h=Math.round(f*60),p=n.slotInterval??60,b=Math.ceil((h-d)/p),g=b*rr.SLOT_HEIGHT+rr.HEADER_HEIGHT,y=b*rr.SLOT_WIDTH,{allDayEvents:x,timedEvents:v}=m.useMemo(()=>{const{start:_,end:N}=uu(e,"day",n),I=Os(r,_,N),M=xo(I);return{allDayEvents:M.filter(B=>B.isAllDay),timedEvents:M.filter(B=>!B.isAllDay)}},[r,e,n]),k=m.useMemo(()=>jo(v),[v]),w=m.useMemo(()=>{const _=new Map;for(const N of t){const I=_g(N.id,k);_.set(N.id,I)}return _},[t,k]),S=m.useMemo(()=>{const _=new Map;for(const N of s)_.set(N.id,N);return _},[s]),C=n.orientation==="vertical";return o.jsx("div",{className:"flex flex-col h-full bg-background",children:C?o.jsx("div",{className:"flex-1 overflow-auto relative",children:o.jsxs("div",{className:"flex flex-col min-w-max",style:{minWidth:`${y+128}px`},children:[o.jsxs("div",{className:"flex border-b border-border bg-muted/40 sticky top-0 z-30",children:[o.jsxs("div",{className:"flex-shrink-0 bg-background border-r border-b border-border sticky left-0 z-50 flex",children:[o.jsx("div",{className:"w-[var(--ui-space-12)] border-r border-border shrink-0"})," ",o.jsx("div",{className:"w-[var(--ui-space-32)] flex-1 shrink-0"})," "]}),o.jsx(zi,{startTime:n.startTime,endTime:n.endTime,slotSize:rr.SLOT_WIDTH,slotInterval:n.slotInterval??60,orientation:"horizontal"})]}),o.jsx("div",{className:"flex flex-col",children:(()=>{const _=[];let N,I=[];return t.forEach((M,B)=>{const E=S.get(M.groupId),F=B>0?t[B-1]:null;F&&F.groupId!==M.groupId&&(_.push({group:N,resources:I}),I=[]),N=E,I.push(M)}),I.length>0&&_.push({group:N,resources:I}),_.map((M,B)=>o.jsxs("div",{className:"flex border-b border-border relative",children:[o.jsx("div",{className:"sticky left-0 z-20 w-[var(--ui-space-12)] flex-shrink-0 bg-background border-r border-border flex items-center justify-center font-bold text-muted-foreground writing-mode-vertical-rl",children:o.jsx("div",{className:"sticky top-[var(--ui-space-14)] py-2 max-h-screen",children:M.group?.name||"-"})}),o.jsx("div",{className:"flex flex-col flex-1 min-w-0",children:M.resources.map((E,F)=>o.jsx("div",{className:`${F<M.resources.length-1?"border-b border-border":""}`,children:o.jsx(Vi,{resource:E,events:w.get(E.id)||[],allDayEvents:x.filter(T=>T.resourceId===E.id),startTime:n.startTime,endTime:n.endTime,currentDate:e,slotSize:rr.SLOT_WIDTH,slotInterval:n.slotInterval??60,onEventClick:a,onEmptySlotClick:i,components:c,orientation:"horizontal",headerLeftOffset:"var(--ui-space-12)"})},E.id))})]},`${M.group?.id}-${B}`))})()})]})}):o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsxs("div",{className:"flex",style:{minHeight:`${g}px`},children:[o.jsxs("div",{className:"sticky left-[var(--ui-space-0)] z-30 bg-background",style:{width:`${rr.TIME_COLUMN_WIDTH}px`},children:[o.jsx("div",{className:"sticky top-0 z-40 bg-background border-b border-r border-border h-[var(--ui-space-8)]"})," ",o.jsx(zi,{startTime:n.startTime,endTime:n.endTime,slotSize:rr.SLOT_HEIGHT,slotInterval:n.slotInterval??60,orientation:"vertical"})]}),o.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[o.jsx("div",{className:"flex sticky top-0 z-30 bg-background border-b border-border h-[var(--ui-space-8)]",children:(()=>{const _=[];for(let N=0;N<t.length;N++){const I=t[N],M=S.get(I.groupId);let B=1;for(;N+B<t.length&&t[N+B].groupId===I.groupId;)B++;_.push(o.jsx("div",{className:"flex items-center justify-center border-r border-border text-xs font-semibold bg-muted/20 truncate px-2",style:{flex:`${B} ${B} 0%`},children:M?.name||"-"},`group-${I.groupId}-${N}`)),N+=B-1}return _})()}),o.jsx("div",{className:"flex flex-1 min-w-0",children:t.map(_=>o.jsx(Vi,{resource:_,events:w.get(_.id)||[],allDayEvents:x.filter(N=>N.resourceId===_.id),startTime:n.startTime,endTime:n.endTime,currentDate:e,slotSize:rr.SLOT_HEIGHT,slotInterval:n.slotInterval,onEventClick:a,onEmptySlotClick:i,components:c,orientation:"vertical"},_.id))})]})]})})})}const Eg=e=>e.startsWith("ja")?"ja-JP":"en-GB",Hi=e=>{switch(e){case"japanese":return"ja-JP-u-ca-japanese";case"buddhist":return"th-TH-u-ca-buddhist";case"islamic":return"ar-SA-u-ca-islamic";case"chinese":return"zh-CN-u-ca-chinese";default:return null}},Ag=e=>e==="full"||e==="date"||e==="weekday"||e==="weekdayShort"||e==="yearMonth"||e==="monthDay"||e==="monthDayShort"||e==="compact",Tg=()=>typeof document>"u"?null:document.documentElement.getAttribute("data-secondary-calendar"),Rg=()=>typeof document>"u"?!1:document.documentElement.getAttribute("data-prefer-local-calendar")==="true",Mg=e=>e.startsWith("ja")?"japanese":e.startsWith("th")?"buddhist":e.startsWith("ar")?"islamic":e.startsWith("zh")?"chinese":null,Bi=(e,t,r,n)=>{const s=a=>new Intl.DateTimeFormat(t,{...a,calendar:n}).format(e);switch(r){case"weekday":return s({weekday:"long"});case"weekdayShort":return s({weekday:"short"});case"date":return s({year:"numeric",month:"short",day:"numeric"});case"monthDayShort":return s({month:"short",day:"numeric",weekday:"short"});case"compact":return s({month:"numeric",day:"numeric",weekday:"short"});case"yearMonth":return s({year:"numeric",month:"long"});case"monthDay":return s({month:"long",day:"numeric"});default:return s({year:"numeric",month:"long",day:"numeric",weekday:"long"})}},It=m.memo(({date:e,format:t="full",variant:r,className:n,showSecondary:s,showDayOfWeek:a,...i})=>{const{i18n:c}=Fe(),l=c.language||"en",u=Eg(l),f=t==="full"&&Ag(r)?r:t,d=()=>f==="full"||f==="yearMonth"||f==="monthDay"||f==="monthDayShort"||f==="compact"||f==="weekday"||f==="weekdayShort"?Ne(e,u,f):f==="date"?Ne(e,u,"picker"):Ne(e,u,"full"),h=()=>Rg()?Mg(l):null,p=()=>{const x=h();if(x){const v=Hi(x)??u;return Bi(e,v,f,x)}return d()},b=()=>{if(!s)return null;const x=Tg();if(!x||x==="none")return null;const v=h();if(x===v)return null;const k=Hi(x)??u;return Bi(e,k,f,x)},g=p(),y=b();return o.jsxs("span",{className:de("inline-block",n),...i,children:[g,y&&o.jsxs("span",{className:"ml-[var(--ui-space-2)] text-muted-foreground",children:["(",y,")"]})]})});function gu({value:e,valueScale:t="ratio",options:r,className:n,...s}){const a=t==="percent"?e/100:e,i=new Intl.NumberFormat("en-US",{style:"percent",...r}).format(a);return o.jsx("span",{className:de("",n),...s,children:i})}function Pg({date:e,density:t,isCurrentMonth:r,isClosedDay:n,maxSlots:s,onClick:a}){const i=e.getDate(),c=Math.round(t/100*s),l=t===0,u=l?0:.1+t/100*.9,f=t>50,d=f?"text-white":"text-foreground",h=f?"text-white/90":"text-muted-foreground";return o.jsxs("button",{type:"button",className:`
|
|
52
52
|
border border-border rounded-md p-[var(--ui-space-2)] min-h-[var(--ui-space-25)] cursor-pointer text-left
|
|
53
53
|
transition-all hover:shadow-md
|
|
54
54
|
${r?"":"opacity-50"}
|
|
55
55
|
${n?"bg-muted":"bg-card"}
|
|
56
|
-
`,style:!n&&!l?{backgroundColor:`hsl(var(--theme-accent) / ${u})`}:void 0,onClick:a,children:[o.jsxs("div",{className:"flex items-center justify-between mb-[var(--ui-space-2)]",children:[o.jsx("span",{className:`text-sm font-semibold ${r?d:"text-muted-foreground"}`,children:i}),n&&o.jsx("span",{className:"text-xs px-[var(--ui-space-1-5)] py-[var(--ui-space-0-5)] rounded bg-theme-warning text-white font-medium",children:"定休日"})]}),!n&&o.jsxs("div",{className:"space-y-[var(--ui-space-1)]",children:[o.jsxs("div",{className:`text-xs ${h}`,children:[c,"/",s]}),o.jsx(ru,{value:t,valueScale:"percent",options:{maximumFractionDigits:0},className:`text-xs font-medium ${d}`})]})]})}function dg(){const e=[{label:"0%",opacity:0},{label:"20%",opacity:.28},{label:"40%",opacity:.46},{label:"60%",opacity:.64},{label:"80%",opacity:.82},{label:"100%",opacity:1}];return o.jsxs("div",{className:"flex items-center justify-center gap-[var(--ui-space-4)] py-[var(--ui-space-3)] border-t border-border bg-background",children:[o.jsx("span",{className:"text-sm text-gray-600",children:"予約密度:"}),o.jsx("div",{className:"flex items-center gap-[var(--ui-space-1)]",children:e.map((t,r)=>o.jsxs("div",{className:"flex flex-col items-center gap-[var(--ui-space-1)]",children:[o.jsx("div",{className:"w-[var(--ui-space-8)] h-[var(--ui-space-8)] border border-gray-300",style:{backgroundColor:t.opacity===0?"white":`hsl(var(--theme-accent) / ${t.opacity})`}}),(r===0||r===e.length-1)&&o.jsx("span",{className:"text-xs text-gray-600",children:t.label})]},t.label))})]})}function fg({month:e,resources:t,events:r,settings:n,selectedGroupId:s,onDayClick:a}){const{t:i}=Le(),{filteredResources:c,filteredEvents:l}=p.useMemo(()=>s?{filteredResources:t.filter(y=>y.groupId===s),filteredEvents:r.filter(y=>y.groupId===s)}:{filteredResources:t,filteredEvents:r},[s,t,r]),u=p.useMemo(()=>{const y=mo(e),x=Ps(y,n.weekStartsOn??1);return uo(x,jr(x,41))},[e,n.weekStartsOn]),f=p.useMemo(()=>go(l),[l]),d=n.timeSlots?n.timeSlots.length:3,h=p.useMemo(()=>{const y=new Map,x=c.length*d;for(const v of u){const _=yr(v),w=tu(v,f),S=x>0?w.length/x*100:0;y.set(_,S)}return y},[u,f,c.length,d]),m=p.useMemo(()=>{const y=u.filter(v=>v.getMonth()===e.getMonth()),x=y.reduce((v,_)=>{const w=yr(_);return v+(h.get(w)||0)},0);return y.length>0?Math.round(x/y.length):0},[u,e,h]),b=p.useMemo(()=>{const y=[];for(let x=0;x<u.length;x+=7)y.push(u.slice(x,x+7));return y},[u]),g=p.useMemo(()=>{const y=[],x=n.weekStartsOn===0?0:1,v=[i("days_short_sun"),i("days_short_mon"),i("days_short_tue"),i("days_short_wed"),i("days_short_thu"),i("days_short_fri"),i("days_short_sat")];for(let _=0;_<7;_++){const w=(x+_)%7;y.push(v[w]||"")}return y},[n.weekStartsOn,i]);return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsx("div",{className:"border-b border-border bg-background px-ui py-ui",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("h2",{className:"text-lg font-semibold",children:o.jsx(It,{date:e,format:"yearMonth"})}),o.jsx("div",{className:"flex items-center gap-[var(--ui-space-4)] mt-[var(--ui-space-2)]",children:o.jsxs("div",{className:"text-sm text-muted-foreground",children:["Resources: ",c.length," / Utilization:"," ",o.jsx(ru,{value:m,valueScale:"percent",options:{maximumFractionDigits:0},className:"font-medium text-foreground"})]})})]}),o.jsx(dg,{})]})}),o.jsx("div",{className:"w-full p-[var(--ui-space-4)] overflow-y-auto",children:o.jsxs("div",{className:"w-full",children:[o.jsx("div",{className:"grid grid-cols-7 gap-[var(--ui-space-1)] mb-[var(--ui-space-1)]",children:g.map(y=>o.jsx("div",{className:"text-center font-semibold text-sm text-foreground py-[var(--ui-space-2)]",children:y},y))}),o.jsx("div",{className:"grid gap-[var(--ui-space-1)]",style:{gridTemplateRows:`repeat(${b.length}, 1fr)`},children:b.map(y=>o.jsx("div",{className:"grid grid-cols-7 gap-[var(--ui-space-1)]",children:y.map(x=>{const v=x.toISOString().split("T")[0]||"",_=h.get(v)||0,w=x.getMonth()===e.getMonth(),S=n.closedDays.includes(x.getDay());return o.jsx(ug,{date:x,density:_,isCurrentMonth:w,isClosedDay:S,maxSlots:c.length*d,onClick:()=>a?.(x)},v)})},y[0]?.toISOString()??"empty-week"))})]})})]})}function vo({currentView:e,onViewChange:t,options:r,className:n}){return o.jsx("div",{className:`flex bg-muted p-[calc(var(--ui-gap-base)/2)] rounded-md gap-[calc(var(--ui-gap-base)/2)] ${n||""}`,children:r.map(s=>o.jsx(oe,{variant:e===s.value?"default":"ghost",onClick:()=>t(s.value),className:"flex-1 h-[var(--ui-component-height)] px-[var(--ui-button-padding-x)]",children:s.label},s.value))})}function hg({currentDate:e,viewMode:t,groups:r,selectedGroupId:n,isLoading:s,hideGroupSelector:a,headerLeft:i,headerRight:c,onNavigate:l,onToday:u,onViewChange:f,onGroupChange:d,isPaginated:h,currentPage:m,totalPages:b,onPageChange:g,pageInfo:y}){const{t:x}=Le();return o.jsxs("header",{className:"border-b border-border px-[var(--ui-space-4)] py-[var(--ui-space-3)] flex items-center justify-between gap-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:[o.jsx(oe,{variant:"outline",size:"icon",onClick:()=>l("prev"),"aria-label":x("previous"),children:o.jsx(ye.ChevronLeft,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx(oe,{variant:"outline",onClick:u,children:x("today_button")}),o.jsx(oe,{variant:"outline",size:"icon",onClick:()=>l("next"),"aria-label":x("next"),children:o.jsx(ye.ChevronRight,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx("span",{className:"text-lg font-bold ml-[var(--ui-space-2)]",children:o.jsx(It,{date:e,showSecondary:!0,showDayOfWeek:!0})}),i]}),o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-4)]",children:[!a&&o.jsxs(Ut,{value:n??void 0,onValueChange:d,disabled:s||r.length===0,children:[o.jsx(Pt,{className:"w-[var(--ui-space-50)]",children:o.jsx(Mt,{placeholder:"Select Group",children:n==="ALL"?"All Facilities":r.find(v=>v.id===n)?.name||""})}),o.jsxs(Ot,{children:[o.jsx(at,{value:"ALL",children:"All Facilities"}),r.map(v=>o.jsx(at,{value:v.id,children:v.name},v.id))]})]}),o.jsx(vo,{currentView:t,onViewChange:f,options:[{value:"day",label:x("view_day")},{value:"week",label:x("view_week")},{value:"month",label:x("view_month")}]}),h&&b&&b>1&&g&&o.jsx("div",{className:"flex bg-muted p-[calc(var(--ui-gap-base)/2)] rounded-md gap-[calc(var(--ui-gap-base)/2)]",children:Array.from({length:b}).map((v,_)=>{const w=y?.find(k=>k.page===_),S=w?`${x("page")} ${_+1}: ${w.startResource} - ${w.endResource}`:`${x("page")} ${_+1}`;return o.jsx(oe,{variant:(m??0)===_?"default":"ghost",onClick:()=>g(_),className:"h-[var(--ui-component-height)] w-[var(--ui-component-height)] p-0",title:S,children:_+1},_)})}),c]})]})}function Mi(e,t){const r=e.getDay();return t.includes(r)}function mg({weekStart:e,resources:t,events:r,settings:n,groups:s=[],onEventClick:a,onEmptySlotClick:i,components:c}){const l=p.useMemo(()=>fo(n.weekStartsOn),[n.weekStartsOn]),u=p.useMemo(()=>Ps(e,l),[e,l]),f=p.useMemo(()=>ho(e,l),[e,l]),d=p.useMemo(()=>{const v=new Map;for(const _ of s)v.set(_.id,_);return v},[s]),h=p.useMemo(()=>uo(u,f),[u,f]),m=p.useMemo(()=>{const v=Rs(r,u,jr(f,1));return lo(v)},[r,u,f]),b=p.useMemo(()=>go(m),[m]),g=p.useMemo(()=>{const v=new Map;for(const _ of h){const w=tu(_,b).sort((k,j)=>k.isAllDay&&!j.isAllDay?-1:!k.isAllDay&&j.isAllDay?1:k.startDate.getTime()-j.startDate.getTime()),S=yr(_);v.set(S,w)}return v},[h,b]),y=p.useMemo(()=>{const v=new Date;return v.setHours(0,0,0,0),v},[]),x=n.orientation==="vertical";return o.jsxs("div",{className:"flex flex-col h-full bg-background overflow-hidden",children:[o.jsx("div",{className:"hidden md:block border-b border-border bg-background px-ui py-ui shrink-0",children:o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{children:[o.jsxs("h2",{className:"text-lg font-bold",children:[o.jsx(It,{date:u,variant:"date"})," - ",h[6]&&o.jsx(It,{date:h[6],variant:"monthDay"})]}),o.jsxs("div",{className:"text-sm text-muted-foreground mt-[var(--ui-space-1)]",children:["Events: ",m.length," / Resources: ",t.length]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto",children:x?o.jsxs("div",{className:"flex flex-col min-w-max",children:[o.jsxs("div",{className:"flex border-b border-border bg-background sticky top-0 z-30",children:[o.jsxs("div",{className:"bg-background border-r border-border sticky left-0 z-40 flex shrink-0",children:[o.jsx("div",{className:"w-[var(--ui-space-12)] border-r border-border shrink-0"}),o.jsx("div",{className:"w-[var(--ui-space-32)] flex-1 shrink-0"})]}),h.map(v=>{const _=new Date(v);_.setHours(0,0,0,0);const w=_.getTime()===y.getTime();return o.jsx("div",{className:`flex-1 border-r border-border px-[var(--ui-space-2)] py-[var(--ui-space-2)] text-center min-w-[var(--ui-space-32)] ${w?"bg-primary/5":""}`,children:o.jsx("div",{className:"font-semibold text-xs leading-tight",children:o.jsx(It,{date:v,variant:"compact"})})},v.toISOString())})]}),o.jsx("div",{className:"flex flex-col",children:(()=>{const v=[];let _,w=[];return t.forEach((S,k)=>{const j=d.get(S.groupId),E=k>0?t[k-1]:null;E&&E.groupId!==S.groupId&&(v.push({group:_,resources:w}),w=[]),_=j,w.push(S)}),w.length>0&&v.push({group:_,resources:w}),v.map((S,k)=>o.jsxs("div",{className:"flex border-b border-border relative",children:[o.jsx("div",{className:"sticky left-0 z-21 w-[var(--ui-space-12)] flex-shrink-0 bg-background border-r border-border flex items-center justify-center font-bold text-muted-foreground writing-mode-vertical-rl",style:{left:0},children:o.jsx("div",{className:"sticky top-0 py-2 max-h-screen",children:S.group?.name||"-"})}),o.jsx("div",{className:"flex flex-col flex-1 min-w-0",children:S.resources.map((j,E)=>o.jsxs("div",{className:`flex hover:bg-muted/5 group/row relative ${E<S.resources.length-1?"border-b border-border":""}`,children:[o.jsx("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border bg-background sticky left-[var(--ui-space-12)] z-20 px-[var(--ui-space-2)] py-[var(--ui-space-2)] flex flex-col justify-center",children:o.jsx("div",{className:"font-semibold text-xs leading-tight truncate",title:j.name,children:j.name})}),h.map(I=>{const M=new Date(I);M.setHours(0,0,0,0);const H=M.getTime()===y.getTime(),N=Mi(I,n.closedDays),F=yr(I),A=g.get(F)??[],V=_a(A,j.id),O=N?"bg-muted":H?"bg-primary/5":"bg-background";return o.jsxs("div",{className:`relative flex-1 border-r border-border p-[var(--ui-space-0-5)] min-w-[var(--ui-space-32)] min-h-[var(--ui-space-24)] ${O} transition-colors overflow-hidden h-[var(--ui-space-24)]`,children:[o.jsx(oe,{type:"button",variant:"ghost",className:"absolute inset-0 z-0 p-0 hover:bg-accent/30","aria-label":`Add event to ${j.name}`,disabled:N||!i,onClick:()=>i?.(j.id,I)}),o.jsxs("div",{className:"relative z-10 flex flex-col gap-0.5 h-full overflow-hidden pointer-events-none",children:[V.slice(0,3).map(P=>o.jsx(Oi,{event:P,onClick:a,components:c},P.id)),V.length>3&&o.jsxs("div",{className:"text-[9px] text-muted-foreground text-center",children:["+",V.length-3]})]})]},I.toISOString())})]},j.id))})]},`${S.group?.id}-${k}`))})()})]}):o.jsxs("div",{className:"flex flex-col min-w-max",children:[o.jsxs("div",{className:"flex flex-col sticky top-0 z-30 bg-background border-b border-border",children:[o.jsxs("div",{className:"flex bg-background border-b border-border",children:[o.jsx("div",{className:"flex-shrink-0 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] bg-background sticky left-0 z-40",style:{width:`${rr.DATE_COLUMN_WIDTH}px`}}),(()=>{const v=[];for(let _=0;_<t.length;_++){const w=t[_],S=d.get(w.groupId);let k=1;for(;_+k<t.length&&t[_+k].groupId===w.groupId;)k++;v.push(o.jsx("div",{className:"flex-1 flex items-center justify-center border-r border-border text-xs font-semibold bg-muted/20 truncate px-2 py-1",style:{minWidth:`${k*80}px`},children:S?.name||"-"},`group-${w.groupId}-${_}`)),_+=k-1}return v})()]}),o.jsxs("div",{className:"flex",children:[o.jsx("div",{className:"flex-shrink-0 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] bg-background sticky left-0 z-40",style:{width:`${rr.DATE_COLUMN_WIDTH}px`}}),t.map(v=>o.jsx("div",{className:"flex-1 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] text-center overflow-hidden min-w-[var(--ui-space-20)]",children:o.jsx("div",{className:"font-semibold text-xs leading-tight truncate",title:v.name,children:v.name})},v.id))]})]}),h.map(v=>{const _=new Date(v);_.setHours(0,0,0,0);const w=_.getTime()===y.getTime(),S=Mi(v,n.closedDays),k=yr(v),j=g.get(k)??[];return o.jsxs("div",{className:`flex border-b border-border ${w?"bg-primary/5":""}`,children:[o.jsx("div",{className:`flex-shrink-0 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] flex items-center justify-center sticky left-0 z-20 ${S?"bg-muted":"bg-card"}`,style:{width:`${rr.DATE_COLUMN_WIDTH}px`,minHeight:`${rr.DAY_CELL_HEIGHT}px`},children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"font-semibold text-xs leading-tight whitespace-pre-line",children:o.jsx(It,{date:v,variant:"compact"})}),S&&o.jsx("div",{className:"text-[10px] text-warning mt-[var(--ui-space-1)]",children:"Off"})]})}),t.map(E=>{const I=_a(j,E.id);return o.jsxs("div",{className:`relative flex-1 border-r border-border p-[var(--ui-space-0-5)] min-w-[var(--ui-space-20)] ${S?"bg-muted":"bg-card hover:bg-accent"} transition-colors overflow-hidden`,style:{minHeight:`${rr.DAY_CELL_HEIGHT}px`},children:[o.jsx(oe,{type:"button",variant:"ghost",className:"absolute inset-0 z-0 p-0","aria-label":`Add event to ${E.name}`,disabled:S||!i,onClick:()=>i?.(E.id,v)}),o.jsxs("div",{className:"relative z-10 flex flex-col gap-0.5 h-full overflow-hidden pointer-events-none",children:[I.slice(0,rr.MAX_VISIBLE_EVENTS).map(M=>o.jsx(Oi,{event:M,onClick:a,components:c},M.id)),I.length>rr.MAX_VISIBLE_EVENTS&&o.jsxs("div",{className:"text-[9px] text-muted-foreground text-center",children:["+",I.length-rr.MAX_VISIBLE_EVENTS]})]})]},E.id)})]},v.toISOString())})]})})]})}function Oi({event:e,onClick:t,components:r}){const n=e.hasConflict?"bg-destructive":e.color?"":"bg-primary",s=e.color&&!e.hasConflict?{backgroundColor:e.color}:{},a=e.startDate.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),i=({children:c})=>o.jsx("button",{type:"button",className:`${n} text-primary-foreground px-[var(--ui-space-1-5)] py-[var(--ui-space-0-5)] rounded text-[10px] cursor-pointer hover:brightness-110 transition-colors text-left leading-normal truncate w-full pointer-events-auto`,style:s,onClick:l=>{l.stopPropagation(),t?.(e)},children:c});return r?.EventCard?o.jsx(i,{children:o.jsx(r.EventCard,{event:e,viewMode:"week",isCompact:!0,onClick:()=>t?.(e)})}):o.jsx(i,{children:o.jsxs("span",{className:"font-medium",children:[e.hasConflict&&"⚠️ ",!e.isAllDay&&`${a} `,e.title]})})}function pg({allResources:e,paginationOptions:t}){const[r,n]=p.useState(0),s=t?.enabled??!1,a=t?.pageSize??8,i=e.length,{totalPages:c,pageDistribution:l}=p.useMemo(()=>{if(!s||i===0)return{totalPages:1,pageDistribution:[i]};if(i<=a)return{totalPages:1,pageDistribution:[i]};const b=Math.ceil(i/a),g=Math.floor(i/b),y=i%b,x=[];for(let v=0;v<b;v++){const _=v<y?g+1:g;x.push(_)}return{totalPages:b,pageDistribution:x}},[s,i,a]);r>=c&&c>0&&n(c-1);const u=p.useMemo(()=>{if(!s)return e;let b=0;for(let y=0;y<r;y++)b+=l[y]||0;const g=l[r]||e.length;return e.slice(b,b+g)},[e,s,r,l]),f=b=>{const g=Math.max(0,Math.min(b,c-1));n(g)},d=()=>f(r+1),h=()=>f(r-1),m=p.useMemo(()=>{if(!s||c<=1)return[];const b=[];let g=0;for(let y=0;y<c;y++){const x=l[y],v=e[g],_=e[g+x-1];v&&_&&b.push({page:y,startResource:v.name,endResource:_.name}),g+=x}return b},[s,c,l,e]);return{paginatedResources:u,currentPage:r,totalPages:c,goToPage:f,nextPage:d,prevPage:h,isPaginated:s,pageSize:l[r]??a,totalResources:i,pageInfo:m}}function nu({events:e,resources:t,groups:r,selectedGroupId:n}){const s=p.useMemo(()=>n??r[0]?.id??null,[n,r]),a=p.useMemo(()=>s==="ALL"?[...t].sort((c,l)=>{const u=r.findIndex(d=>d.id===c.groupId),f=r.findIndex(d=>d.id===l.groupId);return u!==f?u-f:0}):s?t.filter(c=>c.groupId===s):t,[t,s,r]),i=p.useMemo(()=>s==="ALL"?e:s?e.filter(c=>c.groupId===s):e,[e,s]);return{effectiveGroupId:s,filteredResources:a,filteredEvents:i}}function su({onEventCreate:e,onEventUpdate:t,onEventDelete:r,onDateChange:n,onViewChange:s}){const[a,i]=p.useState(!1),[c,l]=p.useState(void 0),[u,f]=p.useState({}),d=p.useCallback(x=>{l(x),f({}),i(!0)},[]),h=p.useCallback((x,v)=>{l(void 0),f({resourceId:x||void 0,startTime:v}),i(!0)},[]),m=p.useCallback(x=>{n?.(x),s?.("day")},[n,s]),b=p.useCallback(x=>{c?t?.(c.id,x):e?.(x),i(!1)},[c,e,t]),g=p.useCallback(x=>{r?.(x),i(!1)},[r]),y=p.useCallback(()=>{i(!1)},[]);return{isModalOpen:a,selectedEvent:c,newInfo:u,handleEventClick:d,handleEmptySlotClick:h,handleDayClick:m,handleModalSave:b,handleModalDelete:g,handleModalClose:y}}function yo(e,t,r){const n=r==="next"?1:-1;switch(t){case"day":return jr(e,n);case"week":return Tf(e,n);case"month":return Ha(e,n);default:return e}}function gg(){const e=new Date;return e.setHours(0,0,0,0),e}class au{getItem(t){if(typeof window>"u")return null;try{return localStorage.getItem(t)}catch(r){return console.warn(`Failed to get item from localStorage: ${t}`,r),null}}setItem(t,r){if(!(typeof window>"u"))try{localStorage.setItem(t,r)}catch(n){console.warn(`Failed to set item in localStorage: ${t}`,n)}}removeItem(t){if(!(typeof window>"u"))try{localStorage.removeItem(t)}catch(r){console.warn(`Failed to remove item from localStorage: ${t}`,r)}}}class vg{storage=new Map;getItem(t){return this.storage.get(t)??null}setItem(t,r){this.storage.set(t,r)}removeItem(t){this.storage.delete(t)}clear(){this.storage.clear()}keys(){return Array.from(this.storage.keys())}}const Ms=new au;function ou({defaultView:e="day",defaultDate:t=new Date,defaultGroupId:r=null,enablePersistence:n=!1,storageKey:s="facility-schedule-view",storage:a=Ms,onDateChange:i,onViewChange:c,onGroupChange:l}){const[u,f]=p.useState(t),[d,h]=p.useState(()=>{if(n)try{const w=a.getItem(s);if(w&&["day","week","month"].includes(w))return w}catch(w){console.warn("Failed to load schedule view from storage",w)}return e}),[m,b]=p.useState(r);p.useEffect(()=>{if(n)try{a.setItem(s,d)}catch(w){console.warn("Failed to save schedule view to storage",w)}},[d,n,s,a]);const g=p.useCallback(w=>{i&&i(w),f(w)},[i]),y=p.useCallback(w=>{c&&c(w),h(w)},[c]),x=p.useCallback(w=>{l&&l(w),b(w)},[l]),v=p.useCallback(w=>{const S=yo(u,d,w);g(S)},[u,d,g]),_=p.useCallback(()=>{g(new Date)},[g]);return{currentDate:u,viewMode:d,selectedGroupId:m,setDate:g,setViewMode:y,setSelectedGroupId:x,navigate:v,goToToday:_}}function iu({events:e,resources:t,groups:r,settings:n,currentDate:s,viewMode:a,selectedGroupId:i,onDateChange:c,onViewChange:l,onGroupChange:u,onEventCreate:f,onEventUpdate:d,onEventDelete:h,isLoading:m=!1,className:b,hideGroupSelector:g=!1,components:y,headerLeft:x,headerRight:v,defaultView:_="day",enablePersistence:w=!1,storageKey:S="facility-schedule-view",customFields:k,pagination:j}){const{t:E}=Le(),{currentDate:I,viewMode:M,selectedGroupId:H,setViewMode:N,setSelectedGroupId:F,navigate:A,goToToday:V,setDate:O}=ou({defaultView:a||_,defaultDate:s,defaultGroupId:i,enablePersistence:w,storageKey:S,onDateChange:c,onViewChange:l,onGroupChange:u}),{effectiveGroupId:P,filteredResources:R,filteredEvents:B}=nu({events:e,resources:t,groups:r,selectedGroupId:H}),{isModalOpen:z,selectedEvent:J,newInfo:G,handleEventClick:L,handleEmptySlotClick:W,handleDayClick:se,handleModalSave:ne,handleModalDelete:fe,handleModalClose:pe}=su({onEventCreate:f,onEventUpdate:d,onEventDelete:h,onDateChange:O,onViewChange:N}),{paginatedResources:Ae,currentPage:xe,totalPages:Ze,goToPage:Ye,isPaginated:Xe,pageInfo:Ke}=pg({allResources:R,paginationOptions:j});return o.jsxs("div",{className:`flex flex-col h-full bg-background ${b}`,children:[o.jsx(hg,{currentDate:I,viewMode:M,groups:r,selectedGroupId:P,isLoading:m,hideGroupSelector:g,headerLeft:x,headerRight:v,onNavigate:A,onToday:V,onViewChange:N,onGroupChange:F,isPaginated:Xe,currentPage:xe,totalPages:Ze,onPageChange:Ye,pageInfo:Ke}),o.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[m&&o.jsxs("div",{className:"absolute inset-[var(--ui-space-0)] bg-background/50 z-10 flex items-center justify-center",children:[E("loading"),"..."]}),M==="day"&&o.jsx(sg,{currentDate:I,resources:Ae,events:B,settings:n,groups:r,onEventClick:L,onEmptySlotClick:W,components:y}),M==="week"&&o.jsx(mg,{weekStart:I,resources:Ae,events:B,settings:n,groups:r,onEventClick:L,onEmptySlotClick:W,components:y}),M==="month"&&o.jsx(fg,{month:I,events:e,resources:Ae,settings:n,selectedGroupId:P,onDayClick:se})]}),y?.EventModal?o.jsx(y.EventModal,{isOpen:z,onClose:pe,event:J,resources:t,groups:r,events:e,defaultResourceId:G.resourceId,onSave:ne,onDelete:h?fe:void 0,readOnlyResource:!0,customFields:k}):o.jsx(po,{isOpen:z,onClose:pe,event:J,resources:t,groups:r,events:e,defaultResourceId:G.resourceId,defaultStartTime:G.startTime,onSave:ne,onDelete:h?fe:void 0,readOnlyResource:!0,customFields:k})]})}const Sa=["#3B82F6","#DC2626","#7C3AED","#0891B2","#EA580C","#DB2777","#4F46E5","#059669","#9333EA","#0284C7","#BE185D","#0D9488","#7C2D12","#1D4ED8","#9F1239","#6D28D9","#166534","#B45309","#1E40AF","#831843"];function xo(e){return Sa[e%Sa.length]}function yg(e){const t=new Map;return e.forEach((r,n)=>{t.set(r,xo(n))}),t}function cu(e,t){const r=lu(t);return r.length>0?`${e} (${r.join(", ")})`:e}function lu(e){if(!e||e==="[]")return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(r=>{if(typeof r!="object"||r===null)return null;const n=r.name;return typeof n=="string"?n:null}).filter(r=>!!r)}catch{return e.split(/[,、]/).map(t=>t.trim()).filter(Boolean)}return[]}function uu(e,t){const r=s=>typeof s=="string"?s:void 0;let n=r(e?.ownerId)??r(e?.personnelId);if(!n&&t&&t!=="[]")try{const s=JSON.parse(t);Array.isArray(s)&&s.length>0&&(n=s[0].personnelId)}catch{}return n}function xg(e){const t=typeof e.extendedProps?.realId=="string"?e.extendedProps.realId:e.id;return{...e,id:t}}function bg(e,t){const r=new Map;return e.forEach(n=>{const s=typeof n.extendedProps?.isAllDay=="boolean"?n.extendedProps.isAllDay:void 0;(!n.attendee||n.attendee==="[]")&&r.set(n.id,{...n,isAllDay:n.isAllDay??s??!1})}),t.forEach(n=>{const s=typeof n.extendedProps?.isAllDay=="boolean"?n.extendedProps.isAllDay:void 0;r.set(n.id,{...n,isAllDay:n.isAllDay??s??!1})}),Array.from(r.values())}function wg(e){if(!e)return{};if(typeof e=="string")try{return JSON.parse(e)}catch{return console.warn("[transformBookings] Failed to parse extendedProps",e),{}}return e}function du(e,t){return e.flatMap(r=>r.bookings.map(n=>{const s=wg(n.extendedProps),a=cu(n.title,n.attendee),i=uu(s,n.attendee);let c;if(i&&t.length>0){const l=t.findIndex(u=>u.id===i);l>=0&&(c=xo(l))}return{id:n.eventId,groupId:r.groupId,resourceId:r.resourceId,title:a,startDate:new Date(n.startDate),endDate:new Date(n.endDate),isAllDay:n.isAllDay,attendee:n.attendee,color:c,status:"booked",createdAt:new Date,updatedAt:new Date,extendedProps:{...s,originalTitle:n.title,ownerId:i}}}))}function _g({settings:e,currentUserId:t,enablePersistence:r=!0,pagination:n}){const{resources:s,groups:a,settings:i,loading:c,error:l,events:u,createEvent:f,updateEvent:d,deleteEvent:h,fetchResourceAvailability:m,personnel:b}=eu(),g=t||b?.[0]?.id,[y,x]=p.useState(new Date),[v,_]=p.useState("day"),[w,S]=p.useState([]),[k,j]=p.useState(!1),[E,I]=p.useState([]),M=p.useCallback(async()=>{j(!0);try{const z=await m(y,v),J=du(z,b);console.log(`[FacilityScheduleManager] Loaded ${J.length} events for ${v} view`),S(J)}catch(z){console.error("Failed to fetch data",z)}finally{j(!1)}},[y,v,m,b,u]);p.useEffect(()=>{M()},[M]);const H=p.useMemo(()=>{const z=new Map;for(const J of u)z.set(J.id,J);for(const J of w){const G=z.get(J.id);G?z.set(J.id,{...G,color:J.color||G.color,groupId:J.groupId||G.groupId}):z.set(J.id,J)}return Array.from(z.values())},[u,w]),N=p.useCallback(async z=>{const J={title:z.title,attendee:z.attendee,resourceId:z.resourceId||void 0,startDate:z.startDate,endDate:z.endDate,status:z.status,note:z.note,isAllDay:z.isAllDay,extendedProps:{...z.extendedProps||{},ownerId:g}};try{await f(J)}catch(G){console.error("Failed to save event",G)}},[f,g]),F=p.useCallback(async(z,J)=>{const G={title:J.title,attendee:J.attendee,resourceId:J.resourceId||void 0,startDate:J.startDate,endDate:J.endDate,status:J.status,note:J.note,isAllDay:J.isAllDay,extendedProps:{...J.extendedProps||{}}};try{await d(z,G)}catch(L){console.error("Failed to update event",L)}},[d]),A=p.useCallback(async z=>{try{await h(z)}catch(J){console.error("Failed to delete event",J)}},[h]),V=p.useCallback(async z=>{try{const J=await m(z.startDate,"day");I(J.map(G=>({resourceId:G.resourceId,isAvailable:G.isAvailable})))}catch(J){console.error("Failed to fetch specific availability",J)}},[m]),O=p.useRef({effectiveUserId:g,personnel:b,resourceAvailability:E,onAvailabilityRequest:V});p.useEffect(()=>{O.current={effectiveUserId:g,personnel:b,resourceAvailability:E,onAvailabilityRequest:V}},[g,b,E,V]);const P=p.useMemo(()=>z=>o.jsx(po,{...z,currentUserId:O.current.effectiveUserId,personnel:O.current.personnel,readOnlyResource:!0,resourceAvailability:O.current.resourceAvailability,onAvailabilityRequest:O.current.onAvailabilityRequest}),[]);if(l)return o.jsxs("div",{className:"p-[var(--ui-space-4)] text-red-500",children:["Error: ",l]});if(!i||c)return o.jsx("div",{className:"p-[var(--ui-space-4)]",children:"Loading schedule data..."});const R={...i,weekStartsOn:e.weekStartsOn??i.weekStartsOn,startTime:e.businessHoursStart!==void 0?`${e.businessHoursStart.toString().padStart(2,"0")}:00`:i.startTime,endTime:e.businessHoursEnd!==void 0?`${e.businessHoursEnd.toString().padStart(2,"0")}:00`:i.endTime,orientation:e.facilityOrientation,slotInterval:e.facilitySlotInterval??i.slotInterval??60},B={enabled:n?.enabled??e.paginationEnabled??i.paginationEnabled??!1,pageSize:n?.pageSize??e.paginationPageSize??i.paginationPageSize??10};return o.jsx(iu,{events:H,resources:s,groups:a,settings:R,isLoading:c||k,currentDate:y,viewMode:v,onDateChange:x,onViewChange:_,onEventCreate:N,onEventUpdate:F,onEventDelete:A,components:{EventModal:P},enablePersistence:r,pagination:B})}function Sg({groups:e,resources:t,onCreateGroup:r,onUpdateGroup:n,onDeleteGroup:s,onCreateResource:a,onUpdateResource:i,onDeleteResource:c,onClose:l}){const{t:u}=Le(),[f,d]=p.useState(null),[h,m]=p.useState(null),[b,g]=p.useState(""),y=A=>{d(A.id),g(A.name)},x=async A=>{b.trim()&&await n(A,{name:b}),d(null)},v=async()=>{const A=prompt(u("facility_prompt_group_name")||"Enter Group Name");A&&await r({name:A})},_=async A=>{confirm(u("facility_confirm_delete_group_message"))&&await s(A)},w=A=>{m(A.id),g(A.name)},S=async A=>{b.trim()&&await i(A,{name:b}),m(null)},k=async A=>{const V=prompt(u("facility_prompt_resource_name")||"Enter Resource Name");if(V){const O=t.filter(R=>R.groupId===A),P=Math.max(0,...O.map(R=>R.order));await a({name:V,groupId:A,order:P+1,isAvailable:!0})}},j=async A=>{confirm(u("facility_confirm_delete_resource_message"))&&await c(A)},E={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto"},I={backgroundColor:"hsl(var(--background))",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",borderRadius:"var(--radius)",width:"100%",maxWidth:"600px",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},M={marginBottom:"24px"},H={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px",fontWeight:"bold",fontSize:"14px"},N={display:"flex",gap:"8px",flexWrap:"wrap",alignItems:"center"},F={padding:"0 8px",borderRadius:"var(--radius)",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--background))",color:"hsl(var(--foreground))",fontSize:"var(--ui-font-size-base)",height:"var(--ui-component-height)",width:"100%"};return o.jsxs("div",{style:E,children:[o.jsx("button",{type:"button","aria-label":u("close"),onClick:l,style:{position:"absolute",inset:0,background:"transparent",border:"none",padding:0,margin:0}}),o.jsxs("div",{style:{...I,position:"relative",zIndex:1},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"24px",paddingBottom:"16px",borderBottom:"1px solid hsl(var(--border))"},children:[o.jsx("h2",{style:{margin:0,fontSize:"20px",fontWeight:"bold"},children:u("facility_settings_title")}),o.jsx(oe,{variant:"ghost",size:"icon",onClick:l,children:o.jsx(ye.X,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-[var(--ui-space-6)]",children:[o.jsxs("div",{style:{...M,display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid hsl(var(--border))",paddingBottom:"16px"},children:[o.jsxs("h3",{className:"text-md font-medium text-muted-foreground m-[var(--ui-space-0)]",children:[u("facility_label_group_name"),"s &"," ",u("facility_label_resource_name"),"s"]}),o.jsxs(oe,{onClick:v,children:[o.jsx(ye.Plus,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)] mr-[var(--ui-space-2)]"}),u("facility_action_add_group")]})]}),e.map(A=>o.jsxs("div",{style:{...M,borderBottom:"1px solid hsl(var(--border))",paddingBottom:"24px",marginBottom:"24px"},children:[o.jsx("div",{style:H,children:f===A.id?o.jsxs("div",{style:{display:"flex",gap:"8px",flex:1,alignItems:"center"},children:[o.jsx("input",{style:{...F,flex:1},value:b,onChange:V=>g(V.target.value)}),o.jsx(oe,{onClick:()=>x(A.id),children:u("save_button")}),o.jsx(oe,{variant:"ghost",onClick:()=>d(null),children:u("cancel_button")})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{fontSize:"16px"},children:A.name}),o.jsxs("div",{style:{display:"flex",gap:"4px"},children:[o.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>y(A),children:o.jsx(ye.Edit,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx(oe,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>_(A.id),children:o.jsx(ye.Trash,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})})]})]})}),o.jsxs("div",{style:N,children:[t.filter(V=>V.groupId===A.id).sort((V,O)=>V.order-O.order).map(V=>o.jsx("div",{style:{display:"flex",alignItems:"center",border:"1px solid hsl(var(--border))",borderRadius:"var(--radius)",padding:"4px 8px",backgroundColor:"hsl(var(--muted) / 0.3)"},children:h===V.id?o.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:[o.jsx("input",{style:{...F,width:"120px",height:"28px",fontSize:"13px"},value:b,onChange:O=>g(O.target.value)}),o.jsx(oe,{size:"sm",onClick:()=>S(V.id),children:u("save_button")}),o.jsx(oe,{size:"icon",variant:"ghost",className:"h-[var(--ui-space-6)] w-[var(--ui-space-6)]",onClick:()=>m(null),children:o.jsx(ye.X,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginRight:"8px",fontSize:"14px"},children:V.name}),o.jsx(oe,{variant:"ghost",size:"icon",className:"h-[var(--ui-space-6)] w-[var(--ui-space-6)] opacity-50 hover:opacity-100",onClick:()=>w(V),children:o.jsx(ye.Edit,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})}),o.jsx(oe,{variant:"ghost",size:"icon",className:"h-[var(--ui-space-6)] w-[var(--ui-space-6)] text-destructive opacity-50 hover:opacity-100",onClick:()=>j(V.id),children:o.jsx(ye.Trash,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})]})},V.id)),o.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>k(A.id),children:[o.jsx(ye.Plus,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)] mr-[var(--ui-space-1)]"}),u("facility_action_add_resource")]})]})]},A.id)),e.length===0&&o.jsx("div",{style:{textAlign:"center",padding:"32px",color:"hsl(var(--muted-foreground))"},children:u("facility_label_no_groups")})]}),o.jsx("div",{style:{padding:"24px",borderTop:"1px solid hsl(var(--border))",display:"flex",justifyContent:"flex-end"},children:o.jsx(oe,{onClick:l,children:u("facility_action_done")})})]})]})}function kg({form:e,onSubmit:t,onCancel:r,onDelete:n,isEditMode:s,canEdit:a,isAllDay:i,startDateVal:c,displayValue:l,availableResources:u,resourceDisplayNames:f,conflict:d,setIsTimeModalOpen:h,customFields:m=[],readOnlyResource:b=!1,personnel:g=[],currentUserId:y}){const{t:x,i18n:v}=Da.useTranslation(),_=w=>{const S=Math.floor(w),k=Math.round((w-S)*60);return S>0&&k>0?`${S}h ${k}m`:S>0?`${S}h`:`${k}m`};return o.jsx(no,{...e,children:o.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-[var(--ui-space-4)] text-foreground",children:[o.jsx(Re,{control:e.control,name:"title",render:({field:w})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[x("event_name_label","Event Name")," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(be,{children:o.jsx(bt,{...w,placeholder:x("event_name_placeholder","Enter event name"),disabled:!a})}),o.jsx(nt,{})]})}),o.jsx(Re,{control:e.control,name:"attendee",render:({field:w})=>{const S=g.filter(k=>k.id!==y);return o.jsxs(De,{children:[o.jsx(_e,{children:x("attendee_label","Attendee")}),o.jsx(be,{children:o.jsx(Na,{value:w.value||[],onChange:w.onChange,personnel:S,placeholder:x("attendee_placeholder","Enter attendee names"),disabled:!a})}),o.jsx(nt,{})]})}}),o.jsx(Re,{control:e.control,name:"resourceId",render:({field:w})=>o.jsxs(De,{children:[o.jsx(_e,{children:x("resource_label","Resource")}),b?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-ui py-ui bg-muted rounded-md text-sm border border-input min-h-ui flex items-center",children:l||x("resource_placeholder","Select a resource")}),o.jsx("input",{type:"hidden",...w})]}):o.jsx(be,{children:o.jsxs(Ut,{onValueChange:w.onChange,value:w.value,disabled:!a,children:[o.jsx(be,{children:o.jsx(Pt,{children:o.jsx(Mt,{placeholder:x("resource_placeholder","Select a resource"),children:w.value?f.get(w.value)||w.value:null})})}),o.jsx(Ot,{children:u.map(S=>o.jsx(at,{value:S.id,children:f.get(S.id)||S.name},S.id))})]})}),o.jsx(nt,{})]})}),o.jsxs("div",{className:"grid grid-cols-3 gap-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"space-y-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"flex justify-between items-center h-[var(--ui-space-5)]",children:[o.jsxs(_e,{className:"m-0",children:[x("date_label","Date")," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(Re,{control:e.control,name:"isAllDay",render:({field:w})=>o.jsxs(De,{className:"flex flex-row items-center space-x-[var(--ui-space-2)] space-y-[var(--ui-space-0)]",children:[o.jsx(be,{children:o.jsx(hn,{id:"isAllDay",checked:w.value,onCheckedChange:w.onChange,disabled:!a})}),o.jsx(_e,{htmlFor:"isAllDay",className:"font-normal cursor-pointer text-xs",children:"All Day"})]})})]}),o.jsx(Re,{name:"startDate",control:e.control,render:({field:w})=>o.jsx(De,{children:o.jsx(be,{children:o.jsx(ro,{value:new Date(w.value),disabled:!a,onChange:S=>{if(S){const k=new Date(w.value);i?S.setHours(0,0,0,0):S.setHours(k.getHours(),k.getMinutes()),w.onChange(Or(S))}}})})})})]}),o.jsxs("div",{className:"space-y-[var(--ui-space-4)]",children:[o.jsx("div",{className:"flex justify-between items-center h-[var(--ui-space-5)]",children:o.jsxs(_e,{className:"m-0",children:[x("start_time_label","Start Time")," ",!i&&o.jsx("span",{className:"text-red-500",children:"*"})]})}),o.jsx("div",{className:"flex items-center",children:i?o.jsx("div",{className:"w-full px-ui py-ui text-sm border border-dashed border-border rounded-md bg-muted/10",children:" "}):o.jsx(bt,{value:Ac(new Date(c)),readOnly:!0,className:"w-full cursor-pointer py-ui",onClick:()=>a&&h(!0),tabIndex:-1,disabled:!a})})]}),o.jsx(Re,{control:e.control,name:"durationHours",render:({field:w})=>o.jsxs(De,{className:"space-y-[var(--ui-space-4)]",children:[o.jsx("div",{className:"flex justify-between items-center h-[var(--ui-space-5)]",children:o.jsx(_e,{className:"m-0",children:x("duration_label","Duration")})}),o.jsxs(Ut,{onValueChange:S=>w.onChange(Number(S)),value:String(w.value),disabled:i||!a,children:[o.jsx(be,{children:o.jsx(Pt,{children:o.jsx(Mt,{})})}),o.jsx(Ot,{className:"max-h-[var(--ui-space-50)]",children:[.25,.5,.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.5,4,4.5,5].map(S=>o.jsx(at,{value:String(S),children:_(S)},S))})]})]})})]}),m.map(w=>o.jsx(Re,{control:e.control,name:w.name,render:({field:S})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[w.label,w.required&&o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(be,{children:w.type==="textarea"?o.jsx(gn,{...S,value:S.value||"",placeholder:w.placeholder,disabled:!a}):w.type==="select"?o.jsxs(Ut,{onValueChange:S.onChange,value:S.value||"",disabled:!a,children:[o.jsx(be,{children:o.jsx(Pt,{children:o.jsx(Mt,{placeholder:w.placeholder})})}),o.jsx(Ot,{children:w.options?.map(k=>o.jsx(at,{value:k.value,children:k.label},k.value))})]}):w.type==="number"?o.jsx(bt,{...S,value:S.value||"",type:"number",placeholder:w.placeholder,disabled:!a}):o.jsx(bt,{...S,value:S.value||"",placeholder:w.placeholder,disabled:!a})}),o.jsx(nt,{})]})},w.name)),d&&o.jsxs("div",{className:"p-[var(--ui-space-4)] bg-red-50 border border-red-500 rounded text-red-800 flex items-start gap-[var(--ui-space-2)]",children:[o.jsx(ye.AlertTriangle,{className:"w-[var(--ui-space-5)] h-[var(--ui-space-5)] flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("strong",{className:"block text-sm",children:"Conflict Detected"}),o.jsxs("span",{className:"text-xs",children:[x("event_form_conflict_warning","Clash with existing event")," ","(",Ne(d.existingSchedule.startDate,v.language,"time24")," ","-"," ",Ne(d.existingSchedule.endDate,v.language,"time24"),")"]})]})]}),o.jsx(Re,{control:e.control,name:"status",render:({field:w})=>o.jsxs(De,{children:[o.jsx(_e,{children:x("status_label","Status")}),o.jsxs(Ut,{onValueChange:w.onChange,value:w.value,disabled:!a,children:[o.jsx(be,{children:o.jsx(Pt,{children:o.jsx(Mt,{})})}),o.jsxs(Ot,{children:[o.jsx(at,{value:"booked",children:"Booked"}),o.jsx(at,{value:"completed",children:"Completed"}),o.jsx(at,{value:"cancelled",children:"Cancelled"})]})]})]})}),o.jsx(Re,{control:e.control,name:"note",render:({field:w})=>o.jsxs(De,{children:[o.jsx(_e,{children:x("note_label","Note")}),o.jsx(be,{children:o.jsx(gn,{...w,placeholder:"Add notes...",rows:2,disabled:!a})})]})}),o.jsxs("div",{className:"flex gap-[var(--ui-space-3)] pt-[var(--ui-space-4)] border-t border-border",children:[a&&s&&n&&o.jsx(oe,{type:"button",variant:"outline-delete",size:"sm",onClick:n,className:"flex-1",children:x("delete_button","Delete")}),o.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:r,className:"flex-1",children:a?x("cancel_button","Cancel"):"Close"}),a&&o.jsx(oe,{type:"submit",variant:"default",size:"sm",className:"flex-1",children:x("save_button","Save")})]})]})})}const Cg=Fe({title:Q().min(1,"Event name is required"),attendee:Yt(vc()),resourceId:Q().optional(),startDate:Q().min(1,"Start date is required"),durationHours:we().min(.25).max(24),status:Q().optional(),note:Q().optional(),isAllDay:qe().optional()}),jg=(e=[])=>{const t=Cg,r={};return e.forEach(n=>{let s;n.type==="number"?(s=xs([we(),Q().transform(a=>Number(a))]),n.required?s=ts.number().min(1,`${n.label} is required`):s=ts.number().optional()):(s=Q(),n.required?s=s.min(1,`${n.label} is required`):s=s.optional()),r[n.name]=s}),t.extend(r)};function fu({event:e,defaultResourceId:t,defaultStartTime:r,resources:n,personnel:s=[],customFields:a=[],currentUserId:i}){const c=!!e,l=p.useMemo(()=>jg(a),[a]),u=p.useMemo(()=>{const x=(S,k)=>{const j=S?.[k];return typeof j=="string"?j:void 0},v=(S,k)=>{if(!S)return[];try{const j=JSON.parse(S);if(Array.isArray(j))return j.filter(E=>!k||E.personnelId!==k)}catch{}return[]},_={title:x(e?.extendedProps,"originalTitle")||e?.title||"",attendee:v(e?.attendee,i),resourceId:e?.resourceId||t||n[0]?.id||"",startDate:Or(e?.startDate||r||new Date),durationHours:e?Math.round((e.endDate.getTime()-e.startDate.getTime())/36e5*100)/100:1,status:e?.status||"booked",note:e?.note||"",isAllDay:e?.isAllDay||!1},w={};return a.forEach(S=>{const k=e?.extendedProps?.[S.name];w[S.name]=k!==void 0?k:S.defaultValue??""}),{..._,...w}},[e,t,r,n,a,i]),f=dc({resolver:hc(l),defaultValues:u}),d=p.useMemo(()=>e?.id?`edit-${e.id}`:r?`create-${r.getTime()}`:"create-new",[e?.id,r]);p.useEffect(()=>{f.reset(u)},[d]);const h=f.watch("startDate"),m=f.watch("durationHours"),b=f.watch("resourceId"),g=f.watch("isAllDay")??!1,y=p.useMemo(()=>{const x=new Date(h);if(!Number.isNaN(x.getTime())){const v=(Number(m)||0)*60;x.setTime(new Date(h).getTime()+v*6e4)}return x},[h,m]);return{form:f,isEditMode:c,startDateVal:h,durationVal:m,resourceIdVal:b,isAllDay:g,endDateDisplay:y,personnel:s}}function hu(e,t,r,n,s){return p.useMemo(()=>{const a=new Date(e);if(Number.isNaN(a.getTime())||!r)return null;const i=(Number(t)||0)*60,c=new Date(a.getTime()+i*6e4),l=n.filter(u=>u.id!==s);return co({startDate:a,endDate:c,resourceId:r},l)},[e,t,r,n,s])}function mu(e,t,r,n,s){return e}function pu(e,t){return p.useMemo(()=>{const r=new Map;return e.forEach(n=>{const s=t.find(i=>i.id===n.groupId),a=s?`${n.name} (${s.name})`:n.name;r.set(n.id,a)}),r},[e,t])}function gu(e,t,r,n=[]){const s=new Date(e.startDate);e.isAllDay&&s.setHours(0,0,0,0);const a=(Number(e.durationHours)||0)*60,i=new Date(s.getTime()+a*6e4),c={...t?.extendedProps??{}};r&&!t&&(c.ownerId=r),n.forEach(f=>{e[f.name]!==void 0&&(c[f.name]=e[f.name])});const u=((f,d,h)=>{const m=[...f];if(h){let b=null;if(d)try{const g=JSON.parse(d);Array.isArray(g)&&(b=g.find(y=>y.personnelId===h))}catch{}b||(h==="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"?b={name:"John Doe",personnelId:h,type:"personnel"}:b={name:"Self",personnelId:h,type:"personnel"}),b&&m.unshift(b)}return JSON.stringify(m)})(e.attendee,t?.attendee,r);return{...e,attendee:u,startDate:s,endDate:i,extendedProps:c}}function vu({isOpen:e,event:t,resources:r,events:n,groups:s,defaultResourceId:a,defaultStartTime:i,onClose:c,onSave:l,onDelete:u,readOnlyResource:f=!1,currentUserId:d,personnel:h,customFields:m=[]}){const{t:b,i18n:g}=Da.useTranslation(),{form:y,isEditMode:x,startDateVal:v,durationVal:_,resourceIdVal:w,isAllDay:S,endDateDisplay:k,personnel:j}=fu({event:t,defaultResourceId:a,defaultStartTime:i,resources:r,personnel:h,customFields:m,currentUserId:d}),E=typeof t?.extendedProps?.ownerId=="string"?t.extendedProps.ownerId:void 0,M=!d||!x||!E||E===d,[H,N]=p.useState(!1),[F,A]=p.useState(!1),[V,O]=p.useState({open:!1,title:"",onConfirm:()=>{}});p.useEffect(()=>{if(e){N(!1);const L=setTimeout(()=>N(!0),100);return()=>clearTimeout(L)}N(!1)},[e]);const P=hu(v,_,w||"",n,t?.id),R=mu(r,n,new Date(v),k,t?.id),B=pu(R,s),z=p.useMemo(()=>{const L=r.find(se=>se.id===w);if(!L)return w||"";const W=s.find(se=>se.id===L.groupId);return W?`${L.name} (${W.name})`:L.name},[w,r,s]),J=L=>{const W=gu(L,t,d,m);l(W)},G=()=>{!t||!u||O({open:!0,title:b("confirm_delete_title","Are you sure?"),description:b("confirm_delete_message","This action cannot be undone."),onConfirm:()=>{u(t.id),O(L=>({...L,open:!1})),c()}})};return o.jsxs(qr,{open:e,onOpenChange:L=>!L&&c(),title:x?M?b("event_custom_edit_title","Edit Event"):"View Event (Read Only)":b("event_custom_create_title","Create Event"),children:[o.jsxs("div",{style:{pointerEvents:H?"auto":"none"},children:[!M&&x&&o.jsx("div",{className:"mb-[var(--ui-space-4)] p-[var(--ui-space-2)] bg-yellow-50 text-yellow-800 text-sm rounded border border-yellow-200",children:"You cannot edit this event because you are not the owner."}),o.jsx(kg,{form:y,onSubmit:J,onCancel:c,onDelete:u?G:void 0,isEditMode:x,canEdit:M,isAllDay:S,startDateVal:v,displayValue:z,availableResources:R,resourceDisplayNames:B,conflict:P,setIsTimeModalOpen:A,customFields:m,readOnlyResource:f,personnel:j,currentUserId:d})]}),o.jsx(As,{open:F,onClose:()=>A(!1),onSubmit:L=>{const W=new Date(y.getValues("startDate")),[se,ne]=L.split(":").map(Number);W.setHours(se||0,ne||0),y.setValue("startDate",Or(W)),A(!1)},initialValue:Ne(new Date(v),g.language,"time24"),variant:"time"}),o.jsx(io,{open:V.open,onOpenChange:L=>O(W=>({...W,open:L})),title:V.title,description:V.description,onConfirm:V.onConfirm,variant:"destructive"})]})}const Os=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function bo(e){return"nodeType"in e}function Ue(e){var t,r;return e?Xr(e)?e:bo(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function wo(e){const{Document:t}=Ue(e);return e instanceof t}function kn(e){return Xr(e)?!1:e instanceof Ue(e).HTMLElement}function yu(e){return e instanceof Ue(e).SVGElement}function Kr(e){return e?Xr(e)?e.document:bo(e)?wo(e)?e:kn(e)||yu(e)?e.ownerDocument:document:document:document}const Xt=Os?p.useLayoutEffect:p.useEffect;function Is(e){const t=p.useRef(e);return Xt(()=>{t.current=e}),p.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Dg(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function vn(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Xt(()=>{r.current!==e&&(r.current=e)},t),r}function Cn(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function cs(e){const t=Is(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&t?.(s,r.current),r.current=s},[]);return[r,n]}function ls(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let ea={};function $s(e,t){return p.useMemo(()=>{if(t)return t;const r=ea[e]==null?0:ea[e]+1;return ea[e]=r,e+"-"+r},[e,t])}function xu(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((a,i)=>{const c=Object.entries(i);for(const[l,u]of c){const f=a[l];f!=null&&(a[l]=f+e*u)}return a},{...t})}}const Fr=xu(1),us=xu(-1);function Ng(e){return"clientX"in e&&"clientY"in e}function _o(e){if(!e)return!1;const{KeyboardEvent:t}=Ue(e.target);return t&&e instanceof t}function Eg(e){if(!e)return!1;const{TouchEvent:t}=Ue(e.target);return t&&e instanceof t}function ds(e){if(Eg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ng(e)?{x:e.clientX,y:e.clientY}:null}const yn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[yn.Translate.toString(e),yn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Ii="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ag(e){return e.matches(Ii)?e:e.querySelector(Ii)}const Tg={display:"none"};function Rg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:Tg},r)}function Pg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return p.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Mg(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const bu=p.createContext(null);function Og(e){const t=p.useContext(bu);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ig(){const[e]=p.useState(()=>new Set),t=p.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[p.useCallback(n=>{let{type:s,event:a}=n;e.forEach(i=>{var c;return(c=i[s])==null?void 0:c.call(i,a)})},[e]),t]}const $g={draggable:`
|
|
56
|
+
`,style:!n&&!l?{backgroundColor:`hsl(var(--theme-accent) / ${u})`}:void 0,onClick:a,children:[o.jsxs("div",{className:"flex items-center justify-between mb-[var(--ui-space-2)]",children:[o.jsx("span",{className:`text-sm font-semibold ${r?d:"text-muted-foreground"}`,children:i}),n&&o.jsx("span",{className:"text-xs px-[var(--ui-space-1-5)] py-[var(--ui-space-0-5)] rounded bg-theme-warning text-white font-medium",children:"定休日"})]}),!n&&o.jsxs("div",{className:"space-y-[var(--ui-space-1)]",children:[o.jsxs("div",{className:`text-xs ${h}`,children:[c,"/",s]}),o.jsx(gu,{value:t,valueScale:"percent",options:{maximumFractionDigits:0},className:`text-xs font-medium ${d}`})]})]})}function Og(){const e=[{label:"0%",opacity:0},{label:"20%",opacity:.28},{label:"40%",opacity:.46},{label:"60%",opacity:.64},{label:"80%",opacity:.82},{label:"100%",opacity:1}];return o.jsxs("div",{className:"flex items-center justify-center gap-[var(--ui-space-4)] py-[var(--ui-space-3)] border-t border-border bg-background",children:[o.jsx("span",{className:"text-sm text-gray-600",children:"予約密度:"}),o.jsx("div",{className:"flex items-center gap-[var(--ui-space-1)]",children:e.map((t,r)=>o.jsxs("div",{className:"flex flex-col items-center gap-[var(--ui-space-1)]",children:[o.jsx("div",{className:"w-[var(--ui-space-8)] h-[var(--ui-space-8)] border border-gray-300",style:{backgroundColor:t.opacity===0?"white":`hsl(var(--theme-accent) / ${t.opacity})`}}),(r===0||r===e.length-1)&&o.jsx("span",{className:"text-xs text-gray-600",children:t.label})]},t.label))})]})}function Ig({month:e,resources:t,events:r,settings:n,selectedGroupId:s,onDayClick:a}){const{t:i}=Fe(),{filteredResources:c,filteredEvents:l}=m.useMemo(()=>s?{filteredResources:t.filter(y=>y.groupId===s),filteredEvents:r.filter(y=>y.groupId===s)}:{filteredResources:t,filteredEvents:r},[s,t,r]),u=m.useMemo(()=>{const y=So(e),x=Is(y,n.weekStartsOn??1);return bo(x,Cr(x,41))},[e,n.weekStartsOn]),f=m.useMemo(()=>jo(l),[l]),d=n.timeSlots?n.timeSlots.length:3,h=m.useMemo(()=>{const y=new Map,x=c.length*d;for(const v of u){const k=xr(v),w=pu(v,f),S=x>0?w.length/x*100:0;y.set(k,S)}return y},[u,f,c.length,d]),p=m.useMemo(()=>{const y=u.filter(v=>v.getMonth()===e.getMonth()),x=y.reduce((v,k)=>{const w=xr(k);return v+(h.get(w)||0)},0);return y.length>0?Math.round(x/y.length):0},[u,e,h]),b=m.useMemo(()=>{const y=[];for(let x=0;x<u.length;x+=7)y.push(u.slice(x,x+7));return y},[u]),g=m.useMemo(()=>{const y=[],x=n.weekStartsOn===0?0:1,v=[i("days_short_sun"),i("days_short_mon"),i("days_short_tue"),i("days_short_wed"),i("days_short_thu"),i("days_short_fri"),i("days_short_sat")];for(let k=0;k<7;k++){const w=(x+k)%7;y.push(v[w]||"")}return y},[n.weekStartsOn,i]);return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsx("div",{className:"border-b border-border bg-background px-ui py-ui",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("h2",{className:"text-lg font-semibold",children:o.jsx(It,{date:e,format:"yearMonth"})}),o.jsx("div",{className:"flex items-center gap-[var(--ui-space-4)] mt-[var(--ui-space-2)]",children:o.jsxs("div",{className:"text-sm text-muted-foreground",children:["Resources: ",c.length," / Utilization:"," ",o.jsx(gu,{value:p,valueScale:"percent",options:{maximumFractionDigits:0},className:"font-medium text-foreground"})]})})]}),o.jsx(Og,{})]})}),o.jsx("div",{className:"w-full p-[var(--ui-space-4)] overflow-y-auto",children:o.jsxs("div",{className:"w-full",children:[o.jsx("div",{className:"grid grid-cols-7 gap-[var(--ui-space-1)] mb-[var(--ui-space-1)]",children:g.map(y=>o.jsx("div",{className:"text-center font-semibold text-sm text-foreground py-[var(--ui-space-2)]",children:y},y))}),o.jsx("div",{className:"grid gap-[var(--ui-space-1)]",style:{gridTemplateRows:`repeat(${b.length}, 1fr)`},children:b.map(y=>o.jsx("div",{className:"grid grid-cols-7 gap-[var(--ui-space-1)]",children:y.map(x=>{const v=x.toISOString().split("T")[0]||"",k=h.get(v)||0,w=x.getMonth()===e.getMonth(),S=n.closedDays.includes(x.getDay());return o.jsx(Pg,{date:x,density:k,isCurrentMonth:w,isClosedDay:S,maxSlots:c.length*d,onClick:()=>a?.(x)},v)})},y[0]?.toISOString()??"empty-week"))})]})})]})}function Co({currentView:e,onViewChange:t,options:r,className:n}){return o.jsx("div",{className:`flex bg-muted p-[calc(var(--ui-gap-base)/2)] rounded-md gap-[calc(var(--ui-gap-base)/2)] ${n||""}`,children:r.map(s=>o.jsx(ae,{variant:e===s.value?"default":"ghost",onClick:()=>t(s.value),className:"flex-1 h-[var(--ui-component-height)] px-[var(--ui-button-padding-x)]",children:s.label},s.value))})}function $g({currentDate:e,viewMode:t,groups:r,selectedGroupId:n,isLoading:s,hideGroupSelector:a,headerLeft:i,headerRight:c,onNavigate:l,onToday:u,onViewChange:f,onGroupChange:d,isPaginated:h,currentPage:p,totalPages:b,onPageChange:g,pageInfo:y}){const{t:x}=Fe();return o.jsxs("header",{className:"border-b border-border px-[var(--ui-space-4)] py-[var(--ui-space-3)] flex items-center justify-between gap-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:[o.jsx(ae,{variant:"outline",size:"icon",onClick:()=>l("prev"),"aria-label":x("previous"),children:o.jsx(ye.ChevronLeft,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx(ae,{variant:"outline",onClick:u,children:x("today_button")}),o.jsx(ae,{variant:"outline",size:"icon",onClick:()=>l("next"),"aria-label":x("next"),children:o.jsx(ye.ChevronRight,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx("span",{className:"text-lg font-bold ml-[var(--ui-space-2)]",children:o.jsx(It,{date:e,showSecondary:!0,showDayOfWeek:!0})}),i]}),o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-4)]",children:[!a&&o.jsxs(Zt,{value:n??void 0,onValueChange:d,disabled:s||r.length===0,children:[o.jsx(Mt,{className:"w-[var(--ui-space-50)]",children:o.jsx(Pt,{placeholder:"Select Group",children:n==="ALL"?"All Facilities":r.find(v=>v.id===n)?.name||""})}),o.jsxs(Ot,{children:[o.jsx(at,{value:"ALL",children:"All Facilities"}),r.map(v=>o.jsx(at,{value:v.id,children:v.name},v.id))]})]}),o.jsx(Co,{currentView:t,onViewChange:f,options:[{value:"day",label:x("view_day")},{value:"week",label:x("view_week")},{value:"month",label:x("view_month")}]}),h&&b&&b>1&&g&&o.jsx("div",{className:"flex bg-muted p-[calc(var(--ui-gap-base)/2)] rounded-md gap-[calc(var(--ui-gap-base)/2)]",children:Array.from({length:b}).map((v,k)=>{const w=y?.find(C=>C.page===k),S=w?`${x("page")} ${k+1}: ${w.startResource} - ${w.endResource}`:`${x("page")} ${k+1}`;return o.jsx(ae,{variant:(p??0)===k?"default":"ghost",onClick:()=>g(k),className:"h-[var(--ui-component-height)] w-[var(--ui-component-height)] p-0",title:S,children:k+1},k)})}),c]})]})}function Wi(e,t){const r=e.getDay();return t.includes(r)}function Fg({weekStart:e,resources:t,events:r,settings:n,groups:s=[],onEventClick:a,onEmptySlotClick:i,components:c}){const l=m.useMemo(()=>wo(n.weekStartsOn),[n.weekStartsOn]),u=m.useMemo(()=>Is(e,l),[e,l]),f=m.useMemo(()=>_o(e,l),[e,l]),d=m.useMemo(()=>{const v=new Map;for(const k of s)v.set(k.id,k);return v},[s]),h=m.useMemo(()=>bo(u,f),[u,f]),p=m.useMemo(()=>{const v=Os(r,u,Cr(f,1));return xo(v)},[r,u,f]),b=m.useMemo(()=>jo(p),[p]),g=m.useMemo(()=>{const v=new Map;for(const k of h){const w=pu(k,b).sort((C,_)=>C.isAllDay&&!_.isAllDay?-1:!C.isAllDay&&_.isAllDay?1:C.startDate.getTime()-_.startDate.getTime()),S=xr(k);v.set(S,w)}return v},[h,b]),y=m.useMemo(()=>{const v=new Date;return v.setHours(0,0,0,0),v},[]),x=n.orientation==="vertical";return o.jsxs("div",{className:"flex flex-col h-full bg-background overflow-hidden",children:[o.jsx("div",{className:"hidden md:block border-b border-border bg-background px-ui py-ui shrink-0",children:o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{children:[o.jsxs("h2",{className:"text-lg font-bold",children:[o.jsx(It,{date:u,variant:"date"})," - ",h[6]&&o.jsx(It,{date:h[6],variant:"monthDay"})]}),o.jsxs("div",{className:"text-sm text-muted-foreground mt-[var(--ui-space-1)]",children:["Events: ",p.length," / Resources: ",t.length]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto",children:x?o.jsxs("div",{className:"flex flex-col min-w-max",children:[o.jsxs("div",{className:"flex border-b border-border bg-background sticky top-0 z-30",children:[o.jsxs("div",{className:"bg-background border-r border-border sticky left-0 z-40 flex shrink-0",children:[o.jsx("div",{className:"w-[var(--ui-space-12)] border-r border-border shrink-0"}),o.jsx("div",{className:"w-[var(--ui-space-32)] flex-1 shrink-0"})]}),h.map(v=>{const k=new Date(v);k.setHours(0,0,0,0);const w=k.getTime()===y.getTime();return o.jsx("div",{className:`flex-1 border-r border-border px-[var(--ui-space-2)] py-[var(--ui-space-2)] text-center min-w-[var(--ui-space-32)] ${w?"bg-primary/5":""}`,children:o.jsx("div",{className:"font-semibold text-xs leading-tight",children:o.jsx(It,{date:v,variant:"compact"})})},v.toISOString())})]}),o.jsx("div",{className:"flex flex-col",children:(()=>{const v=[];let k,w=[];return t.forEach((S,C)=>{const _=d.get(S.groupId),N=C>0?t[C-1]:null;N&&N.groupId!==S.groupId&&(v.push({group:k,resources:w}),w=[]),k=_,w.push(S)}),w.length>0&&v.push({group:k,resources:w}),v.map((S,C)=>o.jsxs("div",{className:"flex border-b border-border relative",children:[o.jsx("div",{className:"sticky left-0 z-21 w-[var(--ui-space-12)] flex-shrink-0 bg-background border-r border-border flex items-center justify-center font-bold text-muted-foreground writing-mode-vertical-rl",style:{left:0},children:o.jsx("div",{className:"sticky top-0 py-2 max-h-screen",children:S.group?.name||"-"})}),o.jsx("div",{className:"flex flex-col flex-1 min-w-0",children:S.resources.map((_,N)=>o.jsxs("div",{className:`flex hover:bg-muted/5 group/row relative ${N<S.resources.length-1?"border-b border-border":""}`,children:[o.jsx("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border bg-background sticky left-[var(--ui-space-12)] z-20 px-[var(--ui-space-2)] py-[var(--ui-space-2)] flex flex-col justify-center",children:o.jsx("div",{className:"font-semibold text-xs leading-tight truncate",title:_.name,children:_.name})}),h.map(I=>{const M=new Date(I);M.setHours(0,0,0,0);const B=M.getTime()===y.getTime(),E=Wi(I,n.closedDays),F=xr(I),T=g.get(F)??[],$=Ca(T,_.id),O=E?"bg-muted":B?"bg-primary/5":"bg-background";return o.jsxs("div",{className:`relative flex-1 border-r border-border p-[var(--ui-space-0-5)] min-w-[var(--ui-space-32)] min-h-[var(--ui-space-24)] ${O} transition-colors overflow-hidden h-[var(--ui-space-24)]`,children:[o.jsx(ae,{type:"button",variant:"ghost",className:"absolute inset-0 z-0 p-0 hover:bg-accent/30","aria-label":`Add event to ${_.name}`,disabled:E||!i,onClick:()=>i?.(_.id,I)}),o.jsxs("div",{className:"relative z-10 flex flex-col gap-0.5 h-full overflow-hidden pointer-events-none",children:[$.slice(0,3).map(A=>o.jsx(Ui,{event:A,onClick:a,components:c},A.id)),$.length>3&&o.jsxs("div",{className:"text-[9px] text-muted-foreground text-center",children:["+",$.length-3]})]})]},I.toISOString())})]},_.id))})]},`${S.group?.id}-${C}`))})()})]}):o.jsxs("div",{className:"flex flex-col min-w-max",children:[o.jsxs("div",{className:"flex flex-col sticky top-0 z-30 bg-background border-b border-border",children:[o.jsxs("div",{className:"flex bg-background border-b border-border",children:[o.jsx("div",{className:"flex-shrink-0 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] bg-background sticky left-0 z-40",style:{width:`${nr.DATE_COLUMN_WIDTH}px`}}),(()=>{const v=[];for(let k=0;k<t.length;k++){const w=t[k],S=d.get(w.groupId);let C=1;for(;k+C<t.length&&t[k+C].groupId===w.groupId;)C++;v.push(o.jsx("div",{className:"flex-1 flex items-center justify-center border-r border-border text-xs font-semibold bg-muted/20 truncate px-2 py-1",style:{minWidth:`${C*80}px`},children:S?.name||"-"},`group-${w.groupId}-${k}`)),k+=C-1}return v})()]}),o.jsxs("div",{className:"flex",children:[o.jsx("div",{className:"flex-shrink-0 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] bg-background sticky left-0 z-40",style:{width:`${nr.DATE_COLUMN_WIDTH}px`}}),t.map(v=>o.jsx("div",{className:"flex-1 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] text-center overflow-hidden min-w-[var(--ui-space-20)]",children:o.jsx("div",{className:"font-semibold text-xs leading-tight truncate",title:v.name,children:v.name})},v.id))]})]}),h.map(v=>{const k=new Date(v);k.setHours(0,0,0,0);const w=k.getTime()===y.getTime(),S=Wi(v,n.closedDays),C=xr(v),_=g.get(C)??[];return o.jsxs("div",{className:`flex border-b border-border ${w?"bg-primary/5":""}`,children:[o.jsx("div",{className:`flex-shrink-0 border-r border-border px-[var(--ui-space-1)] py-[var(--ui-space-2)] flex items-center justify-center sticky left-0 z-20 ${S?"bg-muted":"bg-card"}`,style:{width:`${nr.DATE_COLUMN_WIDTH}px`,minHeight:`${nr.DAY_CELL_HEIGHT}px`},children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"font-semibold text-xs leading-tight whitespace-pre-line",children:o.jsx(It,{date:v,variant:"compact"})}),S&&o.jsx("div",{className:"text-[10px] text-warning mt-[var(--ui-space-1)]",children:"Off"})]})}),t.map(N=>{const I=Ca(_,N.id);return o.jsxs("div",{className:`relative flex-1 border-r border-border p-[var(--ui-space-0-5)] min-w-[var(--ui-space-20)] ${S?"bg-muted":"bg-card hover:bg-accent"} transition-colors overflow-hidden`,style:{minHeight:`${nr.DAY_CELL_HEIGHT}px`},children:[o.jsx(ae,{type:"button",variant:"ghost",className:"absolute inset-0 z-0 p-0","aria-label":`Add event to ${N.name}`,disabled:S||!i,onClick:()=>i?.(N.id,v)}),o.jsxs("div",{className:"relative z-10 flex flex-col gap-0.5 h-full overflow-hidden pointer-events-none",children:[I.slice(0,nr.MAX_VISIBLE_EVENTS).map(M=>o.jsx(Ui,{event:M,onClick:a,components:c},M.id)),I.length>nr.MAX_VISIBLE_EVENTS&&o.jsxs("div",{className:"text-[9px] text-muted-foreground text-center",children:["+",I.length-nr.MAX_VISIBLE_EVENTS]})]})]},N.id)})]},v.toISOString())})]})})]})}function Ui({event:e,onClick:t,components:r}){const n=e.hasConflict?"bg-destructive":e.color?"":"bg-primary",s=e.color&&!e.hasConflict?{backgroundColor:e.color}:{},a=e.startDate.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"}),i=({children:c})=>o.jsx("button",{type:"button",className:`${n} text-primary-foreground px-[var(--ui-space-1-5)] py-[var(--ui-space-0-5)] rounded text-[10px] cursor-pointer hover:brightness-110 transition-colors text-left leading-normal truncate w-full pointer-events-auto`,style:s,onClick:l=>{l.stopPropagation(),t?.(e)},children:c});return r?.EventCard?o.jsx(i,{children:o.jsx(r.EventCard,{event:e,viewMode:"week",isCompact:!0,onClick:()=>t?.(e)})}):o.jsx(i,{children:o.jsxs("span",{className:"font-medium",children:[e.hasConflict&&"⚠️ ",!e.isAllDay&&`${a} `,e.title]})})}function Lg({allResources:e,paginationOptions:t}){const[r,n]=m.useState(0),s=t?.enabled??!1,a=t?.pageSize??8,i=e.length,{totalPages:c,pageDistribution:l}=m.useMemo(()=>{if(!s||i===0)return{totalPages:1,pageDistribution:[i]};if(i<=a)return{totalPages:1,pageDistribution:[i]};const b=Math.ceil(i/a),g=Math.floor(i/b),y=i%b,x=[];for(let v=0;v<b;v++){const k=v<y?g+1:g;x.push(k)}return{totalPages:b,pageDistribution:x}},[s,i,a]);r>=c&&c>0&&n(c-1);const u=m.useMemo(()=>{if(!s)return e;let b=0;for(let y=0;y<r;y++)b+=l[y]||0;const g=l[r]||e.length;return e.slice(b,b+g)},[e,s,r,l]),f=b=>{const g=Math.max(0,Math.min(b,c-1));n(g)},d=()=>f(r+1),h=()=>f(r-1),p=m.useMemo(()=>{if(!s||c<=1)return[];const b=[];let g=0;for(let y=0;y<c;y++){const x=l[y],v=e[g],k=e[g+x-1];v&&k&&b.push({page:y,startResource:v.name,endResource:k.name}),g+=x}return b},[s,c,l,e]);return{paginatedResources:u,currentPage:r,totalPages:c,goToPage:f,nextPage:d,prevPage:h,isPaginated:s,pageSize:l[r]??a,totalResources:i,pageInfo:p}}function vu({events:e,resources:t,groups:r,selectedGroupId:n}){const s=m.useMemo(()=>n??r[0]?.id??null,[n,r]),a=m.useMemo(()=>s==="ALL"?[...t].sort((c,l)=>{const u=r.findIndex(d=>d.id===c.groupId),f=r.findIndex(d=>d.id===l.groupId);return u!==f?u-f:0}):s?t.filter(c=>c.groupId===s):t,[t,s,r]),i=m.useMemo(()=>s==="ALL"?e:s?e.filter(c=>c.groupId===s):e,[e,s]);return{effectiveGroupId:s,filteredResources:a,filteredEvents:i}}function yu({onEventCreate:e,onEventUpdate:t,onEventDelete:r,onDateChange:n,onViewChange:s}){const[a,i]=m.useState(!1),[c,l]=m.useState(void 0),[u,f]=m.useState({}),d=m.useCallback(x=>{l(x),f({}),i(!0)},[]),h=m.useCallback((x,v)=>{l(void 0),f({resourceId:x||void 0,startTime:v}),i(!0)},[]),p=m.useCallback(x=>{n?.(x),s?.("day")},[n,s]),b=m.useCallback(x=>{c?t?.(c.id,x):e?.(x),i(!1)},[c,e,t]),g=m.useCallback(x=>{r?.(x),i(!1)},[r]),y=m.useCallback(()=>{i(!1)},[]);return{isModalOpen:a,selectedEvent:c,newInfo:u,handleEventClick:d,handleEmptySlotClick:h,handleDayClick:p,handleModalSave:b,handleModalDelete:g,handleModalClose:y}}function $s(e,t,r){const n=r==="next"?1:-1;switch(t){case"day":return Cr(e,n);case"week":return th(e,n);case"month":return Xa(e,n);default:return e}}function Vg(){const e=new Date;return e.setHours(0,0,0,0),e}class xu{getItem(t){if(typeof window>"u")return null;try{return localStorage.getItem(t)}catch(r){return console.warn(`Failed to get item from localStorage: ${t}`,r),null}}setItem(t,r){if(!(typeof window>"u"))try{localStorage.setItem(t,r)}catch(n){console.warn(`Failed to set item in localStorage: ${t}`,n)}}removeItem(t){if(!(typeof window>"u"))try{localStorage.removeItem(t)}catch(r){console.warn(`Failed to remove item from localStorage: ${t}`,r)}}}class zg{storage=new Map;getItem(t){return this.storage.get(t)??null}setItem(t,r){this.storage.set(t,r)}removeItem(t){this.storage.delete(t)}clear(){this.storage.clear()}keys(){return Array.from(this.storage.keys())}}const Fs=new xu;function bu({defaultView:e="day",defaultDate:t=new Date,defaultGroupId:r=null,enablePersistence:n=!1,storageKey:s="facility-schedule-view",storage:a=Fs,onDateChange:i,onViewChange:c,onGroupChange:l}){const[u,f]=m.useState(t),[d,h]=m.useState(()=>{if(n)try{const w=a.getItem(s);if(w&&["day","week","month"].includes(w))return w}catch(w){console.warn("Failed to load schedule view from storage",w)}return e}),[p,b]=m.useState(r);m.useEffect(()=>{if(n)try{a.setItem(s,d)}catch(w){console.warn("Failed to save schedule view to storage",w)}},[d,n,s,a]);const g=m.useCallback(w=>{i&&i(w),f(w)},[i]),y=m.useCallback(w=>{c&&c(w),h(w)},[c]),x=m.useCallback(w=>{l&&l(w),b(w)},[l]),v=m.useCallback(w=>{const S=$s(u,d,w);g(S)},[u,d,g]),k=m.useCallback(()=>{g(new Date)},[g]);return{currentDate:u,viewMode:d,selectedGroupId:p,setDate:g,setViewMode:y,setSelectedGroupId:x,navigate:v,goToToday:k}}function wu({events:e,resources:t,groups:r,settings:n,currentDate:s,viewMode:a,selectedGroupId:i,onDateChange:c,onViewChange:l,onGroupChange:u,onEventCreate:f,onEventUpdate:d,onEventDelete:h,isLoading:p=!1,className:b,hideGroupSelector:g=!1,components:y,headerLeft:x,headerRight:v,defaultView:k="day",enablePersistence:w=!1,storageKey:S="facility-schedule-view",customFields:C,pagination:_}){const{t:N}=Fe(),{currentDate:I,viewMode:M,selectedGroupId:B,setViewMode:E,setSelectedGroupId:F,navigate:T,goToToday:$,setDate:O}=bu({defaultView:a||k,defaultDate:s,defaultGroupId:i,enablePersistence:w,storageKey:S,onDateChange:c,onViewChange:l,onGroupChange:u}),{effectiveGroupId:A,filteredResources:R,filteredEvents:V}=vu({events:e,resources:t,groups:r,selectedGroupId:B}),{isModalOpen:H,selectedEvent:Q,newInfo:Y,handleEventClick:z,handleEmptySlotClick:W,handleDayClick:se,handleModalSave:ne,handleModalDelete:fe,handleModalClose:pe}=yu({onEventCreate:f,onEventUpdate:d,onEventDelete:h,onDateChange:O,onViewChange:E}),{paginatedResources:Ae,currentPage:xe,totalPages:Ze,goToPage:Ge,isPaginated:qe,pageInfo:Xe}=Lg({allResources:R,paginationOptions:_});return o.jsxs("div",{className:`flex flex-col h-full bg-background ${b}`,children:[o.jsx($g,{currentDate:I,viewMode:M,groups:r,selectedGroupId:A,isLoading:p,hideGroupSelector:g,headerLeft:x,headerRight:v,onNavigate:T,onToday:$,onViewChange:E,onGroupChange:F,isPaginated:qe,currentPage:xe,totalPages:Ze,onPageChange:Ge,pageInfo:Xe}),o.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[p&&o.jsxs("div",{className:"absolute inset-[var(--ui-space-0)] bg-background/50 z-10 flex items-center justify-center",children:[N("loading"),"..."]}),M==="day"&&o.jsx(Ng,{currentDate:I,resources:Ae,events:V,settings:n,groups:r,onEventClick:z,onEmptySlotClick:W,components:y}),M==="week"&&o.jsx(Fg,{weekStart:I,resources:Ae,events:V,settings:n,groups:r,onEventClick:z,onEmptySlotClick:W,components:y}),M==="month"&&o.jsx(Ig,{month:I,events:e,resources:Ae,settings:n,selectedGroupId:A,onDayClick:se})]}),y?.EventModal?o.jsx(y.EventModal,{isOpen:H,onClose:pe,event:Q,resources:t,groups:r,events:e,defaultResourceId:Y.resourceId,onSave:ne,onDelete:h?fe:void 0,readOnlyResource:!0,customFields:C}):o.jsx(ko,{isOpen:H,onClose:pe,event:Q,resources:t,groups:r,events:e,defaultResourceId:Y.resourceId,defaultStartTime:Y.startTime,onSave:ne,onDelete:h?fe:void 0,readOnlyResource:!0,customFields:C})]})}const Da=["#3B82F6","#DC2626","#7C3AED","#0891B2","#EA580C","#DB2777","#4F46E5","#059669","#9333EA","#0284C7","#BE185D","#0D9488","#7C2D12","#1D4ED8","#9F1239","#6D28D9","#166534","#B45309","#1E40AF","#831843"];function Do(e){return Da[e%Da.length]}function Hg(e){const t=new Map;return e.forEach((r,n)=>{t.set(r,Do(n))}),t}function _u(e,t){const r=Su(t);return r.length>0?`${e} (${r.join(", ")})`:e}function Su(e){if(!e||e==="[]")return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(r=>{if(typeof r!="object"||r===null)return null;const n=r.name;return typeof n=="string"?n:null}).filter(r=>!!r)}catch{return e.split(/[,、]/).map(t=>t.trim()).filter(Boolean)}return[]}function ku(e,t){const r=s=>typeof s=="string"?s:void 0;let n=r(e?.ownerId)??r(e?.personnelId);if(!n&&t&&t!=="[]")try{const s=JSON.parse(t);Array.isArray(s)&&s.length>0&&(n=s[0].personnelId)}catch{}return n}function Bg(e){const t=typeof e.extendedProps?.realId=="string"?e.extendedProps.realId:e.id;return{...e,id:t}}function Wg(e,t){const r=new Map;return e.forEach(n=>{const s=typeof n.extendedProps?.isAllDay=="boolean"?n.extendedProps.isAllDay:void 0;(!n.attendee||n.attendee==="[]")&&r.set(n.id,{...n,isAllDay:n.isAllDay??s??!1})}),t.forEach(n=>{const s=typeof n.extendedProps?.isAllDay=="boolean"?n.extendedProps.isAllDay:void 0;r.set(n.id,{...n,isAllDay:n.isAllDay??s??!1})}),Array.from(r.values())}function Ug(e){if(!e)return{};if(typeof e=="string")try{return JSON.parse(e)}catch{return console.warn("[transformBookings] Failed to parse extendedProps",e),{}}return e}function ju(e,t){return e.flatMap(r=>r.bookings.map(n=>{const s=Ug(n.extendedProps),a=_u(n.title,n.attendee),i=ku(s,n.attendee);let c;if(i&&t.length>0){const l=t.findIndex(u=>u.id===i);l>=0&&(c=Do(l))}return{id:n.eventId,groupId:r.groupId,resourceId:r.resourceId,title:a,startDate:new Date(n.startDate),endDate:new Date(n.endDate),isAllDay:n.isAllDay,attendee:n.attendee,color:c,status:"booked",createdAt:new Date,updatedAt:new Date,extendedProps:{...s,originalTitle:n.title,ownerId:i}}}))}function Zg({settings:e,currentUserId:t,enablePersistence:r=!0,pagination:n}){const{resources:s,groups:a,settings:i,loading:c,error:l,events:u,createEvent:f,updateEvent:d,deleteEvent:h,fetchResourceAvailability:p,personnel:b}=mu(),g=t||b?.[0]?.id,[y,x]=m.useState(new Date),[v,k]=m.useState("day"),[w,S]=m.useState([]),[C,_]=m.useState(!1),[N,I]=m.useState([]),M=m.useCallback(async()=>{_(!0);try{const H=await p(y,v),Q=ju(H,b);console.log(`[FacilityScheduleManager] Loaded ${Q.length} events for ${v} view`),S(Q)}catch(H){console.error("Failed to fetch data",H)}finally{_(!1)}},[y,v,p,b,u]);m.useEffect(()=>{M()},[M]);const B=m.useMemo(()=>{const H=new Map;for(const Q of u)H.set(Q.id,Q);for(const Q of w){const Y=H.get(Q.id);Y?H.set(Q.id,{...Y,color:Q.color||Y.color,groupId:Q.groupId||Y.groupId}):H.set(Q.id,Q)}return Array.from(H.values())},[u,w]),E=m.useCallback(async H=>{const Q={title:H.title,attendee:H.attendee,resourceId:H.resourceId||void 0,startDate:H.startDate,endDate:H.endDate,status:H.status,note:H.note,isAllDay:H.isAllDay,extendedProps:{...H.extendedProps||{},ownerId:g}};try{await f(Q)}catch(Y){console.error("Failed to save event",Y)}},[f,g]),F=m.useCallback(async(H,Q)=>{const Y={title:Q.title,attendee:Q.attendee,resourceId:Q.resourceId||void 0,startDate:Q.startDate,endDate:Q.endDate,status:Q.status,note:Q.note,isAllDay:Q.isAllDay,extendedProps:{...Q.extendedProps||{}}};try{await d(H,Y)}catch(z){console.error("Failed to update event",z)}},[d]),T=m.useCallback(async H=>{try{await h(H)}catch(Q){console.error("Failed to delete event",Q)}},[h]),$=m.useCallback(async H=>{try{const Q=await p(H.startDate,"day");I(Q.map(Y=>({resourceId:Y.resourceId,isAvailable:Y.isAvailable})))}catch(Q){console.error("Failed to fetch specific availability",Q)}},[p]),O=m.useRef({effectiveUserId:g,personnel:b,resourceAvailability:N,onAvailabilityRequest:$});m.useEffect(()=>{O.current={effectiveUserId:g,personnel:b,resourceAvailability:N,onAvailabilityRequest:$}},[g,b,N,$]);const A=m.useMemo(()=>H=>o.jsx(ko,{...H,currentUserId:O.current.effectiveUserId,personnel:O.current.personnel,readOnlyResource:!0,resourceAvailability:O.current.resourceAvailability,onAvailabilityRequest:O.current.onAvailabilityRequest}),[]);if(l)return o.jsxs("div",{className:"p-[var(--ui-space-4)] text-red-500",children:["Error: ",l]});if(!i||c)return o.jsx("div",{className:"p-[var(--ui-space-4)]",children:"Loading schedule data..."});const R={...i,weekStartsOn:e.weekStartsOn??i.weekStartsOn,startTime:e.businessHoursStart!==void 0?`${e.businessHoursStart.toString().padStart(2,"0")}:00`:i.startTime,endTime:e.businessHoursEnd!==void 0?`${e.businessHoursEnd.toString().padStart(2,"0")}:00`:i.endTime,orientation:e.facilityOrientation,slotInterval:e.facilitySlotInterval??i.slotInterval??60},V={enabled:n?.enabled??e.paginationEnabled??i.paginationEnabled??!1,pageSize:n?.pageSize??e.paginationPageSize??i.paginationPageSize??10};return o.jsx(wu,{events:B,resources:s,groups:a,settings:R,isLoading:c||C,currentDate:y,viewMode:v,onDateChange:x,onViewChange:k,onEventCreate:E,onEventUpdate:F,onEventDelete:T,components:{EventModal:A},enablePersistence:r,pagination:V})}function Gg({groups:e,resources:t,onCreateGroup:r,onUpdateGroup:n,onDeleteGroup:s,onCreateResource:a,onUpdateResource:i,onDeleteResource:c,onClose:l}){const{t:u}=Fe(),[f,d]=m.useState(null),[h,p]=m.useState(null),[b,g]=m.useState(""),y=T=>{d(T.id),g(T.name)},x=async T=>{b.trim()&&await n(T,{name:b}),d(null)},v=async()=>{const T=prompt(u("facility_prompt_group_name")||"Enter Group Name");T&&await r({name:T})},k=async T=>{confirm(u("facility_confirm_delete_group_message"))&&await s(T)},w=T=>{p(T.id),g(T.name)},S=async T=>{b.trim()&&await i(T,{name:b}),p(null)},C=async T=>{const $=prompt(u("facility_prompt_resource_name")||"Enter Resource Name");if($){const O=t.filter(R=>R.groupId===T),A=Math.max(0,...O.map(R=>R.order));await a({name:$,groupId:T,order:A+1,isAvailable:!0})}},_=async T=>{confirm(u("facility_confirm_delete_resource_message"))&&await c(T)},N={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto"},I={backgroundColor:"hsl(var(--background))",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",borderRadius:"var(--radius)",width:"100%",maxWidth:"600px",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},M={marginBottom:"24px"},B={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px",fontWeight:"bold",fontSize:"14px"},E={display:"flex",gap:"8px",flexWrap:"wrap",alignItems:"center"},F={padding:"0 8px",borderRadius:"var(--radius)",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--background))",color:"hsl(var(--foreground))",fontSize:"var(--ui-font-size-base)",height:"var(--ui-component-height)",width:"100%"};return o.jsxs("div",{style:N,children:[o.jsx("button",{type:"button","aria-label":u("close"),onClick:l,style:{position:"absolute",inset:0,background:"transparent",border:"none",padding:0,margin:0}}),o.jsxs("div",{style:{...I,position:"relative",zIndex:1},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"24px",paddingBottom:"16px",borderBottom:"1px solid hsl(var(--border))"},children:[o.jsx("h2",{style:{margin:0,fontSize:"20px",fontWeight:"bold"},children:u("facility_settings_title")}),o.jsx(ae,{variant:"ghost",size:"icon",onClick:l,children:o.jsx(ye.X,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-[var(--ui-space-6)]",children:[o.jsxs("div",{style:{...M,display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid hsl(var(--border))",paddingBottom:"16px"},children:[o.jsxs("h3",{className:"text-md font-medium text-muted-foreground m-[var(--ui-space-0)]",children:[u("facility_label_group_name"),"s &"," ",u("facility_label_resource_name"),"s"]}),o.jsxs(ae,{onClick:v,children:[o.jsx(ye.Plus,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)] mr-[var(--ui-space-2)]"}),u("facility_action_add_group")]})]}),e.map(T=>o.jsxs("div",{style:{...M,borderBottom:"1px solid hsl(var(--border))",paddingBottom:"24px",marginBottom:"24px"},children:[o.jsx("div",{style:B,children:f===T.id?o.jsxs("div",{style:{display:"flex",gap:"8px",flex:1,alignItems:"center"},children:[o.jsx("input",{style:{...F,flex:1},value:b,onChange:$=>g($.target.value)}),o.jsx(ae,{onClick:()=>x(T.id),children:u("save_button")}),o.jsx(ae,{variant:"ghost",onClick:()=>d(null),children:u("cancel_button")})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{fontSize:"16px"},children:T.name}),o.jsxs("div",{style:{display:"flex",gap:"4px"},children:[o.jsx(ae,{variant:"ghost",size:"icon",onClick:()=>y(T),children:o.jsx(ye.Edit,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx(ae,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>k(T.id),children:o.jsx(ye.Trash,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})})]})]})}),o.jsxs("div",{style:E,children:[t.filter($=>$.groupId===T.id).sort(($,O)=>$.order-O.order).map($=>o.jsx("div",{style:{display:"flex",alignItems:"center",border:"1px solid hsl(var(--border))",borderRadius:"var(--radius)",padding:"4px 8px",backgroundColor:"hsl(var(--muted) / 0.3)"},children:h===$.id?o.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:[o.jsx("input",{style:{...F,width:"120px",height:"28px",fontSize:"13px"},value:b,onChange:O=>g(O.target.value)}),o.jsx(ae,{size:"sm",onClick:()=>S($.id),children:u("save_button")}),o.jsx(ae,{size:"icon",variant:"ghost",className:"h-[var(--ui-space-6)] w-[var(--ui-space-6)]",onClick:()=>p(null),children:o.jsx(ye.X,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginRight:"8px",fontSize:"14px"},children:$.name}),o.jsx(ae,{variant:"ghost",size:"icon",className:"h-[var(--ui-space-6)] w-[var(--ui-space-6)] opacity-50 hover:opacity-100",onClick:()=>w($),children:o.jsx(ye.Edit,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})}),o.jsx(ae,{variant:"ghost",size:"icon",className:"h-[var(--ui-space-6)] w-[var(--ui-space-6)] text-destructive opacity-50 hover:opacity-100",onClick:()=>_($.id),children:o.jsx(ye.Trash,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)]"})})]})},$.id)),o.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>C(T.id),children:[o.jsx(ye.Plus,{className:"h-[var(--ui-space-3)] w-[var(--ui-space-3)] mr-[var(--ui-space-1)]"}),u("facility_action_add_resource")]})]})]},T.id)),e.length===0&&o.jsx("div",{style:{textAlign:"center",padding:"32px",color:"hsl(var(--muted-foreground))"},children:u("facility_label_no_groups")})]}),o.jsx("div",{style:{padding:"24px",borderTop:"1px solid hsl(var(--border))",display:"flex",justifyContent:"flex-end"},children:o.jsx(ae,{onClick:l,children:u("facility_action_done")})})]})]})}function Yg({form:e,onSubmit:t,onCancel:r,onDelete:n,isEditMode:s,canEdit:a,isAllDay:i,startDateVal:c,displayValue:l,availableResources:u,resourceDisplayNames:f,conflict:d,setIsTimeModalOpen:h,customFields:p=[],readOnlyResource:b=!1,personnel:g=[],currentUserId:y}){const{t:x,i18n:v}=Oa.useTranslation(),k=w=>{const S=Math.floor(w),C=Math.round((w-S)*60);return S>0&&C>0?`${S}h ${C}m`:S>0?`${S}h`:`${C}m`};return o.jsx(ho,{...e,children:o.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-[var(--ui-space-4)] text-foreground",children:[o.jsx(Re,{control:e.control,name:"title",render:({field:w})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[x("event_name_label","Event Name")," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(be,{children:o.jsx(bt,{...w,placeholder:x("event_name_placeholder","Enter event name"),disabled:!a})}),o.jsx(nt,{})]})}),o.jsx(Re,{control:e.control,name:"attendee",render:({field:w})=>{const S=g.filter(C=>C.id!==y);return o.jsxs(De,{children:[o.jsx(_e,{children:x("attendee_label","Attendee")}),o.jsx(be,{children:o.jsx(Ia,{value:w.value||[],onChange:w.onChange,personnel:S,placeholder:x("attendee_placeholder","Enter attendee names"),disabled:!a})}),o.jsx(nt,{})]})}}),o.jsx(Re,{control:e.control,name:"resourceId",render:({field:w})=>o.jsxs(De,{children:[o.jsx(_e,{children:x("resource_label","Resource")}),b?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-ui py-ui bg-muted rounded-md text-sm border border-input min-h-ui flex items-center",children:l||x("resource_placeholder","Select a resource")}),o.jsx("input",{type:"hidden",...w})]}):o.jsx(be,{children:o.jsxs(Zt,{onValueChange:w.onChange,value:w.value,disabled:!a,children:[o.jsx(be,{children:o.jsx(Mt,{children:o.jsx(Pt,{placeholder:x("resource_placeholder","Select a resource"),children:w.value?f.get(w.value)||w.value:null})})}),o.jsx(Ot,{children:u.map(S=>o.jsx(at,{value:S.id,children:f.get(S.id)||S.name},S.id))})]})}),o.jsx(nt,{})]})}),o.jsxs("div",{className:"grid grid-cols-3 gap-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"space-y-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"flex justify-between items-center h-[var(--ui-space-5)]",children:[o.jsxs(_e,{className:"m-0",children:[x("date_label","Date")," ",o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(Re,{control:e.control,name:"isAllDay",render:({field:w})=>o.jsxs(De,{className:"flex flex-row items-center space-x-[var(--ui-space-2)] space-y-[var(--ui-space-0)]",children:[o.jsx(be,{children:o.jsx(hn,{id:"isAllDay",checked:w.value,onCheckedChange:w.onChange,disabled:!a})}),o.jsx(_e,{htmlFor:"isAllDay",className:"font-normal cursor-pointer text-xs",children:"All Day"})]})})]}),o.jsx(Re,{name:"startDate",control:e.control,render:({field:w})=>o.jsx(De,{children:o.jsx(be,{children:o.jsx(fo,{value:new Date(w.value),disabled:!a,onChange:S=>{if(S){const C=new Date(w.value);i?S.setHours(0,0,0,0):S.setHours(C.getHours(),C.getMinutes()),w.onChange(Or(S))}}})})})})]}),o.jsxs("div",{className:"space-y-[var(--ui-space-4)]",children:[o.jsx("div",{className:"flex justify-between items-center h-[var(--ui-space-5)]",children:o.jsxs(_e,{className:"m-0",children:[x("start_time_label","Start Time")," ",!i&&o.jsx("span",{className:"text-red-500",children:"*"})]})}),o.jsx("div",{className:"flex items-center",children:i?o.jsx("div",{className:"w-full px-ui py-ui text-sm border border-dashed border-border rounded-md bg-muted/10",children:" "}):o.jsx(bt,{value:Wc(new Date(c)),readOnly:!0,className:"w-full cursor-pointer py-ui",onClick:()=>a&&h(!0),tabIndex:-1,disabled:!a})})]}),o.jsx(Re,{control:e.control,name:"durationHours",render:({field:w})=>o.jsxs(De,{className:"space-y-[var(--ui-space-4)]",children:[o.jsx("div",{className:"flex justify-between items-center h-[var(--ui-space-5)]",children:o.jsx(_e,{className:"m-0",children:x("duration_label","Duration")})}),o.jsxs(Zt,{onValueChange:S=>w.onChange(Number(S)),value:String(w.value),disabled:i||!a,children:[o.jsx(be,{children:o.jsx(Mt,{children:o.jsx(Pt,{})})}),o.jsx(Ot,{className:"max-h-[var(--ui-space-50)]",children:[.25,.5,.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.5,4,4.5,5].map(S=>o.jsx(at,{value:String(S),children:k(S)},S))})]})]})})]}),p.map(w=>o.jsx(Re,{control:e.control,name:w.name,render:({field:S})=>o.jsxs(De,{children:[o.jsxs(_e,{children:[w.label,w.required&&o.jsx("span",{className:"text-red-500",children:"*"})]}),o.jsx(be,{children:w.type==="textarea"?o.jsx(gn,{...S,value:S.value||"",placeholder:w.placeholder,disabled:!a}):w.type==="select"?o.jsxs(Zt,{onValueChange:S.onChange,value:S.value||"",disabled:!a,children:[o.jsx(be,{children:o.jsx(Mt,{children:o.jsx(Pt,{placeholder:w.placeholder})})}),o.jsx(Ot,{children:w.options?.map(C=>o.jsx(at,{value:C.value,children:C.label},C.value))})]}):w.type==="number"?o.jsx(bt,{...S,value:S.value||"",type:"number",placeholder:w.placeholder,disabled:!a}):o.jsx(bt,{...S,value:S.value||"",placeholder:w.placeholder,disabled:!a})}),o.jsx(nt,{})]})},w.name)),d&&o.jsxs("div",{className:"p-[var(--ui-space-4)] bg-red-50 border border-red-500 rounded text-red-800 flex items-start gap-[var(--ui-space-2)]",children:[o.jsx(ye.AlertTriangle,{className:"w-[var(--ui-space-5)] h-[var(--ui-space-5)] flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("strong",{className:"block text-sm",children:"Conflict Detected"}),o.jsxs("span",{className:"text-xs",children:[x("event_form_conflict_warning","Clash with existing event")," ","(",Ne(d.existingSchedule.startDate,v.language,"time24")," ","-"," ",Ne(d.existingSchedule.endDate,v.language,"time24"),")"]})]})]}),o.jsx(Re,{control:e.control,name:"status",render:({field:w})=>o.jsxs(De,{children:[o.jsx(_e,{children:x("status_label","Status")}),o.jsxs(Zt,{onValueChange:w.onChange,value:w.value,disabled:!a,children:[o.jsx(be,{children:o.jsx(Mt,{children:o.jsx(Pt,{})})}),o.jsxs(Ot,{children:[o.jsx(at,{value:"booked",children:"Booked"}),o.jsx(at,{value:"completed",children:"Completed"}),o.jsx(at,{value:"cancelled",children:"Cancelled"})]})]})]})}),o.jsx(Re,{control:e.control,name:"note",render:({field:w})=>o.jsxs(De,{children:[o.jsx(_e,{children:x("note_label","Note")}),o.jsx(be,{children:o.jsx(gn,{...w,placeholder:"Add notes...",rows:2,disabled:!a})})]})}),o.jsxs("div",{className:"flex gap-[var(--ui-space-3)] pt-[var(--ui-space-4)] border-t border-border",children:[a&&s&&n&&o.jsx(ae,{type:"button",variant:"outline-delete",size:"sm",onClick:n,className:"flex-1",children:x("delete_button","Delete")}),o.jsx(ae,{type:"button",variant:"outline",size:"sm",onClick:r,className:"flex-1",children:a?x("cancel_button","Cancel"):"Close"}),a&&o.jsx(ae,{type:"submit",variant:"default",size:"sm",className:"flex-1",children:x("save_button","Save")})]})]})})}const Kg=Oe({title:q().min(1,"Event name is required"),attendee:Vt(Rc()),resourceId:q().optional(),startDate:q().min(1,"Start date is required"),durationHours:we().min(.25).max(24),status:q().optional(),note:q().optional(),isAllDay:Ke().optional()}),qg=(e=[])=>{const t=Kg,r={};return e.forEach(n=>{let s;n.type==="number"?(s=_s([we(),q().transform(a=>Number(a))]),n.required?s=rs.number().min(1,`${n.label} is required`):s=rs.number().optional()):(s=q(),n.required?s=s.min(1,`${n.label} is required`):s=s.optional()),r[n.name]=s}),t.extend(r)};function Cu({event:e,defaultResourceId:t,defaultStartTime:r,resources:n,personnel:s=[],customFields:a=[],currentUserId:i}){const c=!!e,l=m.useMemo(()=>qg(a),[a]),u=m.useMemo(()=>{const x=(S,C)=>{const _=S?.[C];return typeof _=="string"?_:void 0},v=(S,C)=>{if(!S)return[];try{const _=JSON.parse(S);if(Array.isArray(_))return _.filter(N=>!C||N.personnelId!==C)}catch{}return[]},k={title:x(e?.extendedProps,"originalTitle")||e?.title||"",attendee:v(e?.attendee,i),resourceId:e?.resourceId||t||n[0]?.id||"",startDate:Or(e?.startDate||r||new Date),durationHours:e?Math.round((e.endDate.getTime()-e.startDate.getTime())/36e5*100)/100:1,status:e?.status||"booked",note:e?.note||"",isAllDay:e?.isAllDay||!1},w={};return a.forEach(S=>{const C=e?.extendedProps?.[S.name];w[S.name]=C!==void 0?C:S.defaultValue??""}),{...k,...w}},[e,t,r,n,a,i]),f=Cc({resolver:Nc(l),defaultValues:u}),d=m.useMemo(()=>e?.id?`edit-${e.id}`:r?`create-${r.getTime()}`:"create-new",[e?.id,r]);m.useEffect(()=>{f.reset(u)},[d]);const h=f.watch("startDate"),p=f.watch("durationHours"),b=f.watch("resourceId"),g=f.watch("isAllDay")??!1,y=m.useMemo(()=>{const x=new Date(h);if(!Number.isNaN(x.getTime())){const v=(Number(p)||0)*60;x.setTime(new Date(h).getTime()+v*6e4)}return x},[h,p]);return{form:f,isEditMode:c,startDateVal:h,durationVal:p,resourceIdVal:b,isAllDay:g,endDateDisplay:y,personnel:s}}function Du(e,t,r,n,s){return m.useMemo(()=>{const a=new Date(e);if(Number.isNaN(a.getTime())||!r)return null;const i=(Number(t)||0)*60,c=new Date(a.getTime()+i*6e4),l=n.filter(u=>u.id!==s);return yo({startDate:a,endDate:c,resourceId:r},l)},[e,t,r,n,s])}function Nu(e,t,r,n,s){return e}function Eu(e,t){return m.useMemo(()=>{const r=new Map;return e.forEach(n=>{const s=t.find(i=>i.id===n.groupId),a=s?`${n.name} (${s.name})`:n.name;r.set(n.id,a)}),r},[e,t])}function Au(e,t,r,n=[]){const s=new Date(e.startDate);e.isAllDay&&s.setHours(0,0,0,0);const a=(Number(e.durationHours)||0)*60,i=new Date(s.getTime()+a*6e4),c={...t?.extendedProps??{}};r&&!t&&(c.ownerId=r),n.forEach(f=>{e[f.name]!==void 0&&(c[f.name]=e[f.name])});const u=((f,d,h)=>{const p=[...f];if(h){let b=null;if(d)try{const g=JSON.parse(d);Array.isArray(g)&&(b=g.find(y=>y.personnelId===h))}catch{}b||(h==="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"?b={name:"John Doe",personnelId:h,type:"personnel"}:b={name:"Self",personnelId:h,type:"personnel"}),b&&p.unshift(b)}return JSON.stringify(p)})(e.attendee,t?.attendee,r);return{...e,attendee:u,startDate:s,endDate:i,extendedProps:c}}function Tu({isOpen:e,event:t,resources:r,events:n,groups:s,defaultResourceId:a,defaultStartTime:i,onClose:c,onSave:l,onDelete:u,readOnlyResource:f=!1,currentUserId:d,personnel:h,customFields:p=[]}){const{t:b,i18n:g}=Oa.useTranslation(),{form:y,isEditMode:x,startDateVal:v,durationVal:k,resourceIdVal:w,isAllDay:S,endDateDisplay:C,personnel:_}=Cu({event:t,defaultResourceId:a,defaultStartTime:i,resources:r,personnel:h,customFields:p,currentUserId:d}),N=typeof t?.extendedProps?.ownerId=="string"?t.extendedProps.ownerId:void 0,M=!d||!x||!N||N===d,[B,E]=m.useState(!1),[F,T]=m.useState(!1),[$,O]=m.useState({open:!1,title:"",onConfirm:()=>{}});m.useEffect(()=>{if(e){E(!1);const z=setTimeout(()=>E(!0),100);return()=>clearTimeout(z)}E(!1)},[e]);const A=Du(v,k,w||"",n,t?.id),R=Nu(r,n,new Date(v),C,t?.id),V=Eu(R,s),H=m.useMemo(()=>{const z=r.find(se=>se.id===w);if(!z)return w||"";const W=s.find(se=>se.id===z.groupId);return W?`${z.name} (${W.name})`:z.name},[w,r,s]),Q=z=>{const W=Au(z,t,d,p);l(W)},Y=()=>{!t||!u||O({open:!0,title:b("confirm_delete_title","Are you sure?"),description:b("confirm_delete_message","This action cannot be undone."),onConfirm:()=>{u(t.id),O(z=>({...z,open:!1})),c()}})};return o.jsxs(Kr,{open:e,onOpenChange:z=>!z&&c(),title:x?M?b("event_custom_edit_title","Edit Event"):"View Event (Read Only)":b("event_custom_create_title","Create Event"),children:[o.jsxs("div",{style:{pointerEvents:B?"auto":"none"},children:[!M&&x&&o.jsx("div",{className:"mb-[var(--ui-space-4)] p-[var(--ui-space-2)] bg-yellow-50 text-yellow-800 text-sm rounded border border-yellow-200",children:"You cannot edit this event because you are not the owner."}),o.jsx(Yg,{form:y,onSubmit:Q,onCancel:c,onDelete:u?Y:void 0,isEditMode:x,canEdit:M,isAllDay:S,startDateVal:v,displayValue:H,availableResources:R,resourceDisplayNames:V,conflict:A,setIsTimeModalOpen:T,customFields:p,readOnlyResource:f,personnel:_,currentUserId:d})]}),o.jsx(Ms,{open:F,onClose:()=>T(!1),onSubmit:z=>{const W=new Date(y.getValues("startDate")),[se,ne]=z.split(":").map(Number);W.setHours(se||0,ne||0),y.setValue("startDate",Or(W)),T(!1)},initialValue:Ne(new Date(v),g.language,"time24"),variant:"time"}),o.jsx(vo,{open:$.open,onOpenChange:z=>O(W=>({...W,open:z})),title:$.title,description:$.description,onConfirm:$.onConfirm,variant:"destructive"})]})}const Ls=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function No(e){return"nodeType"in e}function Ue(e){var t,r;return e?qr(e)?e:No(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Eo(e){const{Document:t}=Ue(e);return e instanceof t}function kn(e){return qr(e)?!1:e instanceof Ue(e).HTMLElement}function Ru(e){return e instanceof Ue(e).SVGElement}function Xr(e){return e?qr(e)?e.document:No(e)?Eo(e)?e:kn(e)||Ru(e)?e.ownerDocument:document:document:document}const qt=Ls?m.useLayoutEffect:m.useEffect;function Vs(e){const t=m.useRef(e);return qt(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Xg(){const e=m.useRef(null),t=m.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=m.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function vn(e,t){t===void 0&&(t=[e]);const r=m.useRef(e);return qt(()=>{r.current!==e&&(r.current=e)},t),r}function jn(e,t){const r=m.useRef();return m.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function ls(e){const t=Vs(e),r=m.useRef(null),n=m.useCallback(s=>{s!==r.current&&t?.(s,r.current),r.current=s},[]);return[r,n]}function us(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let sa={};function zs(e,t){return m.useMemo(()=>{if(t)return t;const r=sa[e]==null?0:sa[e]+1;return sa[e]=r,e+"-"+r},[e,t])}function Mu(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((a,i)=>{const c=Object.entries(i);for(const[l,u]of c){const f=a[l];f!=null&&(a[l]=f+e*u)}return a},{...t})}}const Fr=Mu(1),ds=Mu(-1);function Jg(e){return"clientX"in e&&"clientY"in e}function Ao(e){if(!e)return!1;const{KeyboardEvent:t}=Ue(e.target);return t&&e instanceof t}function Qg(e){if(!e)return!1;const{TouchEvent:t}=Ue(e.target);return t&&e instanceof t}function fs(e){if(Qg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Jg(e)?{x:e.clientX,y:e.clientY}:null}const yn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[yn.Translate.toString(e),yn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Zi="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ev(e){return e.matches(Zi)?e:e.querySelector(Zi)}const tv={display:"none"};function rv(e){let{id:t,value:r}=e;return m.createElement("div",{id:t,style:tv},r)}function nv(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return m.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function sv(){const[e,t]=m.useState("");return{announce:m.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Pu=m.createContext(null);function av(e){const t=m.useContext(Pu);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ov(){const[e]=m.useState(()=>new Set),t=m.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[m.useCallback(n=>{let{type:s,event:a}=n;e.forEach(i=>{var c;return(c=i[s])==null?void 0:c.call(i,a)})},[e]),t]}const iv={draggable:`
|
|
57
57
|
To pick up a draggable item, press the space bar.
|
|
58
58
|
While dragging, use the arrow keys to move the item.
|
|
59
59
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
60
|
-
`},Fg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Lg(e){let{announcements:t=Fg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=$g}=e;const{announce:a,announcement:i}=Mg(),c=$s("DndLiveRegion"),[l,u]=p.useState(!1);if(p.useEffect(()=>{u(!0)},[]),Og(p.useMemo(()=>({onDragStart(d){let{active:h}=d;a(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:m}=d;t.onDragMove&&a(t.onDragMove({active:h,over:m}))},onDragOver(d){let{active:h,over:m}=d;a(t.onDragOver({active:h,over:m}))},onDragEnd(d){let{active:h,over:m}=d;a(t.onDragEnd({active:h,over:m}))},onDragCancel(d){let{active:h,over:m}=d;a(t.onDragCancel({active:h,over:m}))}}),[a,t])),!l)return null;const f=p.createElement(p.Fragment,null,p.createElement(Rg,{id:n,value:s.draggable}),p.createElement(Pg,{id:c,announcement:i}));return r?gr.createPortal(f,r):f}var Pe;(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"})(Pe||(Pe={}));function fs(){}function Vg(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function zg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const St=Object.freeze({x:0,y:0});function Hg(e,t){const r=ds(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Bg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Wg(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Ug(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=s-n,c=a-r;if(n<s&&r<a){const l=t.width*t.height,u=e.width*e.height,f=i*c,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const Zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const a of n){const{id:i}=a,c=r.get(i);if(c){const l=Ug(c,t);l>0&&s.push({id:i,data:{droppableContainer:a,value:l}})}}return s.sort(Bg)};function Yg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function wu(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:St}function Gg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((i,c)=>({...i,top:i.top+e*c.y,bottom:i.bottom+e*c.y,left:i.left+e*c.x,right:i.right+e*c.x}),{...r})}}const qg=Gg(1);function _u(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 Xg(e,t,r){const n=_u(t);if(!n)return e;const{scaleX:s,scaleY:a,x:i,y:c}=n,l=e.left-i-(1-s)*parseFloat(r),u=e.top-c-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),f=s?e.width/s:e.width,d=a?e.height/a:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const Kg={ignoreTransform:!1};function jn(e,t){t===void 0&&(t=Kg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=Ue(e).getComputedStyle(e);u&&(r=Xg(r,u,f))}const{top:n,left:s,width:a,height:i,bottom:c,right:l}=r;return{top:n,left:s,width:a,height:i,bottom:c,right:l}}function $i(e){return jn(e,{ignoreTransform:!0})}function Jg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Qg(e,t){return t===void 0&&(t=Ue(e).getComputedStyle(e)),t.position==="fixed"}function ev(e,t){t===void 0&&(t=Ue(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?r.test(a):!1})}function So(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(wo(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!kn(s)||yu(s)||r.includes(s))return r;const a=Ue(e).getComputedStyle(s);return s!==e&&ev(s,a)&&r.push(s),Qg(s,a)?r:n(s.parentNode)}return e?n(e):r}function Su(e){const[t]=So(e,1);return t??null}function ta(e){return!Os||!e?null:Xr(e)?e:bo(e)?wo(e)||e===Kr(e).scrollingElement?window:kn(e)?e:null:null}function ku(e){return Xr(e)?e.scrollX:e.scrollLeft}function Cu(e){return Xr(e)?e.scrollY:e.scrollTop}function ka(e){return{x:ku(e),y:Cu(e)}}var Me;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Me||(Me={}));function ju(e){return!Os||!e?!1:e===document.scrollingElement}function Du(e){const t={x:0,y:0},r=ju(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=n.y,c=e.scrollLeft>=n.x;return{isTop:s,isLeft:a,isBottom:i,isRight:c,maxScroll:n,minScroll:t}}const tv={x:.2,y:.2};function rv(e,t,r,n,s){let{top:a,left:i,right:c,bottom:l}=r;n===void 0&&(n=10),s===void 0&&(s=tv);const{isTop:u,isBottom:f,isLeft:d,isRight:h}=Du(e),m={x:0,y:0},b={x:0,y:0},g={height:t.height*s.y,width:t.width*s.x};return!u&&a<=t.top+g.height?(m.y=Me.Backward,b.y=n*Math.abs((t.top+g.height-a)/g.height)):!f&&l>=t.bottom-g.height&&(m.y=Me.Forward,b.y=n*Math.abs((t.bottom-g.height-l)/g.height)),!h&&c>=t.right-g.width?(m.x=Me.Forward,b.x=n*Math.abs((t.right-g.width-c)/g.width)):!d&&i<=t.left+g.width&&(m.x=Me.Backward,b.x=n*Math.abs((t.left+g.width-i)/g.width)),{direction:m,speed:b}}function nv(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Nu(e){return e.reduce((t,r)=>Fr(t,ka(r)),St)}function sv(e){return e.reduce((t,r)=>t+ku(r),0)}function av(e){return e.reduce((t,r)=>t+Cu(r),0)}function Eu(e,t){if(t===void 0&&(t=jn),!e)return;const{top:r,left:n,bottom:s,right:a}=t(e);Su(e)&&(s<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ov=[["x",["left","right"],sv],["y",["top","bottom"],av]];class ko{constructor(t,r){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 n=So(r),s=Nu(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,c]of ov)for(const l of i)Object.defineProperty(this,l,{get:()=>{const u=c(n),f=s[a]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ln{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function iv(e){const{EventTarget:t}=Ue(e);return e instanceof t?e:Kr(e)}function ra(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function Fi(e){e.preventDefault()}function cv(e){e.stopPropagation()}var ve;(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"})(ve||(ve={}));const Au={start:[ve.Space,ve.Enter],cancel:[ve.Esc],end:[ve.Space,ve.Enter,ve.Tab]},lv=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ve.Right:return{...r,x:r.x+25};case ve.Left:return{...r,x:r.x-25};case ve.Down:return{...r,y:r.y+25};case ve.Up:return{...r,y:r.y-25}}};class Tu{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:r}}=t;this.props=t,this.listeners=new ln(Kr(r)),this.windowListeners=new ln(Ue(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Eu(n),r(St)}handleKeyDown(t){if(_o(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:a=Au,coordinateGetter:i=lv,scrollBehavior:c="smooth"}=s,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=n.current,f=u?{x:u.left,y:u.top}:St;this.referenceCoordinates||(this.referenceCoordinates=f);const d=i(t,{active:r,context:n.current,currentCoordinates:f});if(d){const h=us(d,f),m={x:0,y:0},{scrollableAncestors:b}=n.current;for(const g of b){const y=t.code,{isTop:x,isRight:v,isLeft:_,isBottom:w,maxScroll:S,minScroll:k}=Du(g),j=nv(g),E={x:Math.min(y===ve.Right?j.right-j.width/2:j.right,Math.max(y===ve.Right?j.left:j.left+j.width/2,d.x)),y:Math.min(y===ve.Down?j.bottom-j.height/2:j.bottom,Math.max(y===ve.Down?j.top:j.top+j.height/2,d.y))},I=y===ve.Right&&!v||y===ve.Left&&!_,M=y===ve.Down&&!w||y===ve.Up&&!x;if(I&&E.x!==d.x){const H=g.scrollLeft+h.x,N=y===ve.Right&&H<=S.x||y===ve.Left&&H>=k.x;if(N&&!h.y){g.scrollTo({left:H,behavior:c});return}N?m.x=g.scrollLeft-H:m.x=y===ve.Right?g.scrollLeft-S.x:g.scrollLeft-k.x,m.x&&g.scrollBy({left:-m.x,behavior:c});break}else if(M&&E.y!==d.y){const H=g.scrollTop+h.y,N=y===ve.Down&&H<=S.y||y===ve.Up&&H>=k.y;if(N&&!h.x){g.scrollTo({top:H,behavior:c});return}N?m.y=g.scrollTop-H:m.y=y===ve.Down?g.scrollTop-S.y:g.scrollTop-k.y,m.y&&g.scrollBy({top:-m.y,behavior:c});break}}this.handleMove(t,Fr(us(d,this.referenceCoordinates),m))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Tu.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Au,onActivation:s}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(n.start.includes(i)){const c=a.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Li(e){return!!(e&&"distance"in e)}function Vi(e){return!!(e&&"delay"in e)}class Co{constructor(t,r,n){var s;n===void 0&&(n=iv(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=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=Kr(i),this.documentListeners=new ln(this.document),this.listeners=new ln(n),this.windowListeners=new ln(Ue(i)),this.initialCoordinates=(s=ds(a))!=null?s:St,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:r,bypassActivationConstraint:n}}}=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(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,Fi),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,Fi),this.documentListeners.add(ut.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vi(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Li(r)){this.handlePending(r);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,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,cv,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:a}=this,{onMove:i,options:{activationConstraint:c}}=a;if(!s)return;const l=(r=ds(t))!=null?r:St,u=us(s,l);if(!n&&c){if(Li(c)){if(c.tolerance!=null&&ra(u,c.tolerance))return this.handleCancel();if(ra(u,c.distance))return this.handleStart()}if(Vi(c)&&ra(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ve.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const uv={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class jo extends Co{constructor(t){const{event:r}=t,n=Kr(r.target);super(t,uv,n)}}jo.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const dv={move:{name:"mousemove"},end:{name:"mouseup"}};var Ca;(function(e){e[e.RightClick=2]="RightClick"})(Ca||(Ca={}));class fv extends Co{constructor(t){super(t,dv,Kr(t.event.target))}}fv.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Ca.RightClick?!1:(n?.({event:r}),!0)}}];const na={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hv extends Co{constructor(t){super(t,na)}static setup(){return window.addEventListener(na.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(na.move.name,t)};function t(){}}}hv.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n?.({event:r}),!0)}}];var un;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(un||(un={}));var hs;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(hs||(hs={}));function mv(e){let{acceleration:t,activator:r=un.Pointer,canScroll:n,draggingRect:s,enabled:a,interval:i=5,order:c=hs.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:h}=e;const m=gv({delta:d,disabled:!a}),[b,g]=Dg(),y=p.useRef({x:0,y:0}),x=p.useRef({x:0,y:0}),v=p.useMemo(()=>{switch(r){case un.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case un.DraggableRect:return s}},[r,s,l]),_=p.useRef(null),w=p.useCallback(()=>{const k=_.current;if(!k)return;const j=y.current.x*x.current.x,E=y.current.y*x.current.y;k.scrollBy(j,E)},[]),S=p.useMemo(()=>c===hs.TreeOrder?[...u].reverse():u,[c,u]);p.useEffect(()=>{if(!a||!u.length||!v){g();return}for(const k of S){if(n?.(k)===!1)continue;const j=u.indexOf(k),E=f[j];if(!E)continue;const{direction:I,speed:M}=rv(k,E,v,t,h);for(const H of["x","y"])m[H][I[H]]||(M[H]=0,I[H]=0);if(M.x>0||M.y>0){g(),_.current=k,b(w,i),y.current=M,x.current=I;return}}y.current={x:0,y:0},x.current={x:0,y:0},g()},[t,w,n,g,a,i,JSON.stringify(v),JSON.stringify(m),b,u,S,f,JSON.stringify(h)])}const pv={x:{[Me.Backward]:!1,[Me.Forward]:!1},y:{[Me.Backward]:!1,[Me.Forward]:!1}};function gv(e){let{delta:t,disabled:r}=e;const n=ls(t);return Cn(s=>{if(r||!n||!s)return pv;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Me.Backward]:s.x[Me.Backward]||a.x===-1,[Me.Forward]:s.x[Me.Forward]||a.x===1},y:{[Me.Backward]:s.y[Me.Backward]||a.y===-1,[Me.Forward]:s.y[Me.Forward]||a.y===1}}},[r,t,n])}function vv(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Cn(s=>{var a;return t==null?null:(a=n??s)!=null?a:null},[n,t])}function yv(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,a=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,n)}));return[...r,...a]},[]),[e,t])}var xn;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xn||(xn={}));var ja;(function(e){e.Optimized="optimized"})(ja||(ja={}));const zi=new Map;function xv(e,t){let{dragging:r,dependencies:n,config:s}=t;const[a,i]=p.useState(null),{frequency:c,measure:l,strategy:u}=s,f=p.useRef(e),d=y(),h=vn(d),m=p.useCallback(function(x){x===void 0&&(x=[]),!h.current&&i(v=>v===null?x:v.concat(x.filter(_=>!v.includes(_))))},[h]),b=p.useRef(null),g=Cn(x=>{if(d&&!r)return zi;if(!x||x===zi||f.current!==e||a!=null){const v=new Map;for(let _ of e){if(!_)continue;if(a&&a.length>0&&!a.includes(_.id)&&_.rect.current){v.set(_.id,_.rect.current);continue}const w=_.node.current,S=w?new ko(l(w),w):null;_.rect.current=S,S&&v.set(_.id,S)}return v}return x},[e,a,r,d,l]);return p.useEffect(()=>{f.current=e},[e]),p.useEffect(()=>{d||m()},[r,d]),p.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),p.useEffect(()=>{d||typeof c!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},c))},[c,d,m,...n]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function y(){switch(u){case xn.Always:return!1;case xn.BeforeDragging:return r;default:return!r}}}function Do(e,t){return Cn(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function bv(e,t){return Do(e,t)}function wv(e){let{callback:t,disabled:r}=e;const n=Is(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return p.useEffect(()=>()=>s?.disconnect(),[s]),s}function Fs(e){let{callback:t,disabled:r}=e;const n=Is(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return p.useEffect(()=>()=>s?.disconnect(),[s]),s}function _v(e){return new ko(jn(e),e)}function Hi(e,t,r){t===void 0&&(t=_v);const[n,s]=p.useState(null);function a(){s(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??r)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const i=wv({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){a();break}}}}),c=Fs({callback:a});return Xt(()=>{a(),e?(c?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),i?.disconnect())},[e]),n}function Sv(e){const t=Do(e);return wu(e,t)}const Bi=[];function kv(e){const t=p.useRef(e),r=Cn(n=>e?n&&n!==Bi&&e&&t.current&&e.parentNode===t.current.parentNode?n:So(e):Bi,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function Cv(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(a=>{const i=ta(a.target);i&&r(c=>c?(c.set(i,ka(i)),new Map(c)):null)},[]);return p.useEffect(()=>{const a=n.current;if(e!==a){i(a);const c=e.map(l=>{const u=ta(l);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,ka(u)]):null}).filter(l=>l!=null);r(c.length?new Map(c):null),n.current=e}return()=>{i(e),i(a)};function i(c){c.forEach(l=>{const u=ta(l);u?.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Fr(a,i),St):Nu(e):St,[e,t])}function Wi(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==St;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?us(e,r.current):St}function jv(e){p.useEffect(()=>{if(!Os)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Dv(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:a}=n;return r[s]=i=>{a(i,t)},r},{}),[e,t])}function Ru(e){return p.useMemo(()=>e?Jg(e):null,[e])}const Ui=[];function Nv(e,t){t===void 0&&(t=jn);const[r]=e,n=Ru(r?Ue(r):null),[s,a]=p.useState(Ui);function i(){a(()=>e.length?e.map(l=>ju(l)?n:new ko(t(l),l)):Ui)}const c=Fs({callback:i});return Xt(()=>{c?.disconnect(),i(),e.forEach(l=>c?.observe(l))},[e]),s}function Pu(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return kn(t)?t:e}function Ev(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(u=>{for(const{target:f}of u)if(kn(f)){n(d=>{const h=t(f);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),a=Fs({callback:s}),i=p.useCallback(u=>{const f=Pu(u);a?.disconnect(),f&&a?.observe(f),n(f?t(f):null)},[t,a]),[c,l]=cs(i);return p.useMemo(()=>({nodeRef:c,rect:r,setRef:l}),[r,c,l])}const Av=[{sensor:jo,options:{}},{sensor:Tu,options:{}}],Tv={current:{}},Un={draggable:{measure:$i},droppable:{measure:$i,strategy:xn.WhileDragging,frequency:ja.Optimized},dragOverlay:{measure:jn}};class dn extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const Rv={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new dn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:fs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Un,measureDroppableContainers:fs,windowRect:null,measuringScheduled:!1},Mu={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:fs,draggableNodes:new Map,over:null,measureDroppableContainers:fs},Dn=p.createContext(Mu),Ou=p.createContext(Rv);function Pv(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new dn}}}function Mv(e,t){switch(t.type){case Pe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Pe.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 Pe.DragEnd:case Pe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Pe.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new dn(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Pe.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new dn(e.droppable.containers);return i.set(r,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case Pe.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const a=new dn(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Ov(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext(Dn),a=ls(n),i=ls(r?.id);return p.useEffect(()=>{if(!t&&!n&&a&&i!=null){if(!_o(a)||document.activeElement===a.target)return;const c=s.get(i);if(!c)return;const{activatorNode:l,node:u}=c;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=Ag(f);if(d){d.focus();break}}})}},[n,t,s,i,a]),null}function Iu(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...n}),r):r}function Iv(e){return p.useMemo(()=>({draggable:{...Un.draggable,...e?.draggable},droppable:{...Un.droppable,...e?.droppable},dragOverlay:{...Un.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function $v(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const a=p.useRef(!1),{x:i,y:c}=typeof s=="boolean"?{x:s,y:s}:s;Xt(()=>{if(!i&&!c||!t){a.current=!1;return}if(a.current||!n)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=r(u),d=wu(f,n);if(i||(d.x=0),c||(d.y=0),a.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=Su(u);h&&h.scrollBy({top:d.y,left:d.x})}},[t,i,c,n,r])}const Ls=p.createContext({...St,scaleX:1,scaleY:1});var ar;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ar||(ar={}));const Fv=p.memo(function(t){var r,n,s,a;let{id:i,accessibility:c,autoScroll:l=!0,children:u,sensors:f=Av,collisionDetection:d=Zg,measuring:h,modifiers:m,...b}=t;const g=p.useReducer(Mv,void 0,Pv),[y,x]=g,[v,_]=Ig(),[w,S]=p.useState(ar.Uninitialized),k=w===ar.Initialized,{draggable:{active:j,nodes:E,translate:I},droppable:{containers:M}}=y,H=j!=null?E.get(j):null,N=p.useRef({initial:null,translated:null}),F=p.useMemo(()=>{var $e;return j!=null?{id:j,data:($e=H?.data)!=null?$e:Tv,rect:N}:null},[j,H]),A=p.useRef(null),[V,O]=p.useState(null),[P,R]=p.useState(null),B=vn(b,Object.values(b)),z=$s("DndDescribedBy",i),J=p.useMemo(()=>M.getEnabled(),[M]),G=Iv(h),{droppableRects:L,measureDroppableContainers:W,measuringScheduled:se}=xv(J,{dragging:k,dependencies:[I.x,I.y],config:G.droppable}),ne=vv(E,j),fe=p.useMemo(()=>P?ds(P):null,[P]),pe=td(),Ae=bv(ne,G.draggable.measure);$v({activeNode:j!=null?E.get(j):null,config:pe.layoutShiftCompensation,initialRect:Ae,measure:G.draggable.measure});const xe=Hi(ne,G.draggable.measure,Ae),Ze=Hi(ne?ne.parentElement:null),Ye=p.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xe=M.getNodeFor((r=Ye.current.over)==null?void 0:r.id),Ke=Ev({measure:G.dragOverlay.measure}),Ct=(n=Ke.nodeRef.current)!=null?n:ne,pt=k?(s=Ke.rect)!=null?s:xe:null,Kt=!!(Ke.nodeRef.current&&Ke.rect),Nn=Sv(Kt?null:xe),En=Ru(Ct?Ue(Ct):null),gt=kv(k?Xe??ne:null),D=Nv(gt),T=Iu(m,{transform:{x:I.x-Nn.x,y:I.y-Nn.y,scaleX:1,scaleY:1},activatorEvent:P,active:F,activeNodeRect:xe,containerNodeRect:Ze,draggingNodeRect:pt,over:Ye.current.over,overlayNodeRect:Ke.rect,scrollableAncestors:gt,scrollableAncestorRects:D,windowRect:En}),$=fe?Fr(fe,I):null,X=Cv(gt),Y=Wi(X),Z=Wi(X,[xe]),te=Fr(T,Y),le=pt?qg(pt,T):null,he=F&&le?d({active:F,collisionRect:le,droppableRects:L,droppableContainers:J,pointerCoordinates:$}):null,Ve=Wg(he,"id"),[Je,vt]=p.useState(null),Vs=Kt?T:Fr(T,Z),Jr=Yg(Vs,(a=Je?.rect)!=null?a:null,xe),mr=p.useRef(null),An=p.useCallback(($e,Qe)=>{let{sensor:et,options:Jt}=Qe;if(A.current==null)return;const lt=E.get(A.current);if(!lt)return;const tt=$e.nativeEvent,jt=new et({active:A.current,activeNode:lt,event:tt,options:Jt,context:Ye,onAbort(Oe){if(!E.get(Oe))return;const{onDragAbort:Dt}=B.current,Ht={id:Oe};Dt?.(Ht),v({type:"onDragAbort",event:Ht})},onPending(Oe,Qt,Dt,Ht){if(!E.get(Oe))return;const{onDragPending:en}=B.current,er={id:Oe,constraint:Qt,initialCoordinates:Dt,offset:Ht};en?.(er),v({type:"onDragPending",event:er})},onStart(Oe){const Qt=A.current;if(Qt==null)return;const Dt=E.get(Qt);if(!Dt)return;const{onDragStart:Ht}=B.current,Qr={activatorEvent:tt,active:{id:Qt,data:Dt.data,rect:N}};gr.unstable_batchedUpdates(()=>{Ht?.(Qr),S(ar.Initializing),x({type:Pe.DragStart,initialCoordinates:Oe,active:Qt}),v({type:"onDragStart",event:Qr}),O(mr.current),R(tt)})},onMove(Oe){x({type:Pe.DragMove,coordinates:Oe})},onEnd:Dr(Pe.DragEnd),onCancel:Dr(Pe.DragCancel)});mr.current=jt;function Dr(Oe){return async function(){const{active:Dt,collisions:Ht,over:Qr,scrollAdjustedTranslate:en}=Ye.current;let er=null;if(Dt&&en){const{cancelDrop:tn}=B.current;er={activatorEvent:tt,active:Dt,collisions:Ht,delta:en,over:Qr},Oe===Pe.DragEnd&&typeof tn=="function"&&await Promise.resolve(tn(er))&&(Oe=Pe.DragCancel)}A.current=null,gr.unstable_batchedUpdates(()=>{x({type:Oe}),S(ar.Uninitialized),vt(null),O(null),R(null),mr.current=null;const tn=Oe===Pe.DragEnd?"onDragEnd":"onDragCancel";if(er){const zs=B.current[tn];zs?.(er),v({type:tn,event:er})}})}}},[E]),Tn=p.useCallback(($e,Qe)=>(et,Jt)=>{const lt=et.nativeEvent,tt=E.get(Jt);if(A.current!==null||!tt||lt.dndKit||lt.defaultPrevented)return;const jt={active:tt};$e(et,Qe.options,jt)===!0&&(lt.dndKit={capturedBy:Qe.sensor},A.current=Jt,An(et,Qe))},[E,An]),Rn=yv(f,Tn);jv(f),Xt(()=>{xe&&w===ar.Initializing&&S(ar.Initialized)},[xe,w]),p.useEffect(()=>{const{onDragMove:$e}=B.current,{active:Qe,activatorEvent:et,collisions:Jt,over:lt}=Ye.current;if(!Qe||!et)return;const tt={active:Qe,activatorEvent:et,collisions:Jt,delta:{x:te.x,y:te.y},over:lt};gr.unstable_batchedUpdates(()=>{$e?.(tt),v({type:"onDragMove",event:tt})})},[te.x,te.y]),p.useEffect(()=>{const{active:$e,activatorEvent:Qe,collisions:et,droppableContainers:Jt,scrollAdjustedTranslate:lt}=Ye.current;if(!$e||A.current==null||!Qe||!lt)return;const{onDragOver:tt}=B.current,jt=Jt.get(Ve),Dr=jt&&jt.rect.current?{id:jt.id,rect:jt.rect.current,data:jt.data,disabled:jt.disabled}:null,Oe={active:$e,activatorEvent:Qe,collisions:et,delta:{x:lt.x,y:lt.y},over:Dr};gr.unstable_batchedUpdates(()=>{vt(Dr),tt?.(Oe),v({type:"onDragOver",event:Oe})})},[Ve]),Xt(()=>{Ye.current={activatorEvent:P,active:F,activeNode:ne,collisionRect:le,collisions:he,droppableRects:L,draggableNodes:E,draggingNode:Ct,draggingNodeRect:pt,droppableContainers:M,over:Je,scrollableAncestors:gt,scrollAdjustedTranslate:te},N.current={initial:pt,translated:le}},[F,ne,he,le,E,Ct,pt,L,M,Je,gt,te]),mv({...pe,delta:I,draggingRect:le,pointerCoordinates:$,scrollableAncestors:gt,scrollableAncestorRects:D});const Pn=p.useMemo(()=>({active:F,activeNode:ne,activeNodeRect:xe,activatorEvent:P,collisions:he,containerNodeRect:Ze,dragOverlay:Ke,draggableNodes:E,droppableContainers:M,droppableRects:L,over:Je,measureDroppableContainers:W,scrollableAncestors:gt,scrollableAncestorRects:D,measuringConfiguration:G,measuringScheduled:se,windowRect:En}),[F,ne,xe,P,he,Ze,Ke,E,M,L,Je,W,gt,D,G,se,En]),ed=p.useMemo(()=>({activatorEvent:P,activators:Rn,active:F,activeNodeRect:xe,ariaDescribedById:{draggable:z},dispatch:x,draggableNodes:E,over:Je,measureDroppableContainers:W}),[P,Rn,F,xe,x,z,E,Je,W]);return p.createElement(bu.Provider,{value:_},p.createElement(Dn.Provider,{value:ed},p.createElement(Ou.Provider,{value:Pn},p.createElement(Ls.Provider,{value:Jr},u)),p.createElement(Ov,{disabled:c?.restoreFocus===!1})),p.createElement(Lg,{...c,hiddenTextDescribedById:z}));function td(){const $e=V?.autoScrollEnabled===!1,Qe=typeof l=="object"?l.enabled===!1:l===!1,et=k&&!$e&&!Qe;return typeof l=="object"?{...l,enabled:et}:{enabled:et}}}),Lv=p.createContext(null),Zi="button",Vv="Draggable";function zv(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const a=$s(Vv),{activators:i,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:h}=p.useContext(Dn),{role:m=Zi,roleDescription:b="draggable",tabIndex:g=0}=s??{},y=l?.id===t,x=p.useContext(y?Ls:Lv),[v,_]=cs(),[w,S]=cs(),k=Dv(i,t),j=vn(r);Xt(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:w,data:j}),()=>{const I=d.get(t);I&&I.key===a&&d.delete(t)}),[d,t]);const E=p.useMemo(()=>({role:m,tabIndex:g,"aria-disabled":n,"aria-pressed":y&&m===Zi?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[n,m,g,y,b,f.draggable]);return{active:l,activatorEvent:c,activeNodeRect:u,attributes:E,isDragging:y,listeners:n?void 0:k,node:v,over:h,setNodeRef:_,setActivatorNodeRef:S,transform:x}}function Hv(){return p.useContext(Ou)}const Bv="Droppable",Wv={timeout:25};function Uv(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const a=$s(Bv),{active:i,dispatch:c,over:l,measureDroppableContainers:u}=p.useContext(Dn),f=p.useRef({disabled:r}),d=p.useRef(!1),h=p.useRef(null),m=p.useRef(null),{disabled:b,updateMeasurementsFor:g,timeout:y}={...Wv,...s},x=vn(g??n),v=p.useCallback(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(x.current)?x.current:[x.current]),m.current=null},y)},[y]),_=Fs({callback:v,disabled:b||!i}),w=p.useCallback((E,I)=>{_&&(I&&(_.unobserve(I),d.current=!1),E&&_.observe(E))},[_]),[S,k]=cs(w),j=vn(t);return p.useEffect(()=>{!_||!S.current||(_.disconnect(),d.current=!1,_.observe(S.current))},[S,_]),p.useEffect(()=>(c({type:Pe.RegisterDroppable,element:{id:n,key:a,disabled:r,node:S,rect:h,data:j}}),()=>c({type:Pe.UnregisterDroppable,key:a,id:n})),[n]),p.useEffect(()=>{r!==f.current.disabled&&(c({type:Pe.SetDroppableDisabled,id:n,key:a,disabled:r}),f.current.disabled=r)},[n,a,r,c]),{active:i,rect:h,isOver:l?.id===n,node:S,over:l,setNodeRef:k}}function Zv(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[a,i]=p.useState(null),c=ls(r);return!r&&!n&&c&&s(c),Xt(()=>{if(!a)return;const l=n?.key,u=n?.props.id;if(l==null||u==null){s(null);return}Promise.resolve(t(u,a)).then(()=>{s(null)})},[t,n,a]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:i}):null)}const Yv={x:0,y:0,scaleX:1,scaleY:1};function Gv(e){let{children:t}=e;return p.createElement(Dn.Provider,{value:Mu},p.createElement(Ls.Provider,{value:Yv},t))}const qv={position:"fixed",touchAction:"none"},Xv=e=>_o(e)?"transform 250ms ease":void 0,Kv=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:a,className:i,rect:c,style:l,transform:u,transition:f=Xv}=e;if(!c)return null;const d=s?u:{...u,scaleX:1,scaleY:1},h={...qv,width:c.width,height:c.height,top:c.top,left:c.left,transform:yn.Transform.toString(d),transformOrigin:s&&n?Hg(n,c):void 0,transition:typeof f=="function"?f(n):f,...l};return p.createElement(r,{className:i,style:h,ref:t},a)}),Jv=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:a,className:i}=e;if(a!=null&&a.active)for(const[c,l]of Object.entries(a.active))l!==void 0&&(s[c]=r.node.style.getPropertyValue(c),r.node.style.setProperty(c,l));if(a!=null&&a.dragOverlay)for(const[c,l]of Object.entries(a.dragOverlay))l!==void 0&&n.node.style.setProperty(c,l);return i!=null&&i.active&&r.node.classList.add(i.active),i!=null&&i.dragOverlay&&n.node.classList.add(i.dragOverlay),function(){for(const[l,u]of Object.entries(s))r.node.style.setProperty(l,u);i!=null&&i.active&&r.node.classList.remove(i.active)}},Qv=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:yn.Transform.toString(t)},{transform:yn.Transform.toString(r)}]},ey={duration:250,easing:"ease",keyframes:Qv,sideEffects:Jv({styles:{active:{opacity:"0"}}})};function ty(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Is((a,i)=>{if(t===null)return;const c=r.get(a);if(!c)return;const l=c.node.current;if(!l)return;const u=Pu(i);if(!u)return;const{transform:f}=Ue(i).getComputedStyle(i),d=_u(f);if(!d)return;const h=typeof t=="function"?t:ry(t);return Eu(l,s.draggable.measure),h({active:{id:a,data:c.data,node:l,rect:s.draggable.measure(l)},draggableNodes:r,dragOverlay:{node:i,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:d})})}function ry(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...ey,...e};return a=>{let{active:i,dragOverlay:c,transform:l,...u}=a;if(!t)return;const f={x:c.rect.left-i.rect.left,y:c.rect.top-i.rect.top},d={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/c.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/c.rect.height:1},h={x:l.x-f.x,y:l.y-f.y,...d},m=s({...u,active:i,dragOverlay:c,transform:{initial:l,final:h}}),[b]=m,g=m[m.length-1];if(JSON.stringify(b)===JSON.stringify(g))return;const y=n?.({active:i,dragOverlay:c,...u}),x=c.node.animate(m,{duration:t,easing:r,fill:"forwards"});return new Promise(v=>{x.onfinish=()=>{y?.(),v()}})}}let Yi=0;function ny(e){return p.useMemo(()=>{if(e!=null)return Yi++,Yi},[e])}const sy=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:a,modifiers:i,wrapperElement:c="div",className:l,zIndex:u=999}=e;const{activatorEvent:f,active:d,activeNodeRect:h,containerNodeRect:m,draggableNodes:b,droppableContainers:g,dragOverlay:y,over:x,measuringConfiguration:v,scrollableAncestors:_,scrollableAncestorRects:w,windowRect:S}=Hv(),k=p.useContext(Ls),j=ny(d?.id),E=Iu(i,{activatorEvent:f,active:d,activeNodeRect:h,containerNodeRect:m,draggingNodeRect:y.rect,over:x,overlayNodeRect:y.rect,scrollableAncestors:_,scrollableAncestorRects:w,transform:k,windowRect:S}),I=Do(h),M=ty({config:n,draggableNodes:b,droppableContainers:g,measuringConfiguration:v}),H=I?y.setRef:void 0;return p.createElement(Gv,null,p.createElement(Zv,{animation:M},d&&j?p.createElement(Kv,{key:j,id:d.id,ref:H,as:c,activatorEvent:f,adjustScale:t,className:l,transition:a,rect:I,style:{zIndex:u,...s},transform:E},r):null))}),$u=e=>{if(e.extendedProps?.location){const t=e.extendedProps.location;if(typeof t=="string")return t;if(typeof t=="object"&&t!==null){const r=t,n=typeof r.building=="string"?r.building:"",s=typeof r.room=="string"?r.room:"";return`${n} ${s}`.trim()}}return e.description||""},ay=e=>!!e.extendedProps?.isAllDay,Fu=(e,t,r)=>{if(!e||e==="[]"||e==="")return t;try{const n=typeof e=="string"?JSON.parse(e):e;if(Array.isArray(n)){const a=n.filter(i=>!(typeof i!="object"||i===null||r&&"personnelId"in i&&i.personnelId===r)).map(i=>{const c=i.name;return typeof c=="string"?c:null}).filter(i=>!!i);return a.length>0?a.join(", "):""}}catch{}return typeof e=="string"?e:""},ms=({event:e,position:t,column:r=0,totalColumns:n=1,onEventClick:s,currentUserId:a,resources:i=[],renderEventContent:c,components:l,viewMode:u="week",orientation:f="horizontal",usePercentagePosition:d=!1})=>{const{attributes:h,listeners:m,setNodeRef:b,isDragging:g}=zv({id:e.id,data:e,disabled:!1}),y=M=>{M.stopPropagation(),s?.(e)},x=e.title,v=Fu(e.attendee,"",a),w=i.find(M=>M.id===e.resourceId)?.name||$u(e),S=f==="vertical",k=S?t.top>=40:t.height>=60,j=100/n,E=r*j,I=S?{left:d?`${t.top}%`:`${t.top}px`,width:d?`${t.height}%`:`${t.height}px`,top:`calc(${E}% + 2px)`,height:`calc(${j}% - 4px)`,minWidth:d?void 0:"44px",backgroundColor:e.color||"#3b82f6",color:"white",zIndex:g?50:10+r}:{top:d?`${t.top}%`:`${t.top}px`,height:d?`${t.height}%`:`${t.height}px`,minHeight:d?void 0:"44px",left:`calc(${E}% + 2px)`,width:`calc(${j}% - 4px)`,backgroundColor:e.color||"#3b82f6",color:"white",zIndex:g?50:10+r};return o.jsx("div",{ref:b,...m,...h,role:"button",tabIndex:0,onClick:y,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),M.stopPropagation(),s?.(e))},className:`
|
|
60
|
+
`},cv={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function lv(e){let{announcements:t=cv,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=iv}=e;const{announce:a,announcement:i}=sv(),c=zs("DndLiveRegion"),[l,u]=m.useState(!1);if(m.useEffect(()=>{u(!0)},[]),av(m.useMemo(()=>({onDragStart(d){let{active:h}=d;a(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:p}=d;t.onDragMove&&a(t.onDragMove({active:h,over:p}))},onDragOver(d){let{active:h,over:p}=d;a(t.onDragOver({active:h,over:p}))},onDragEnd(d){let{active:h,over:p}=d;a(t.onDragEnd({active:h,over:p}))},onDragCancel(d){let{active:h,over:p}=d;a(t.onDragCancel({active:h,over:p}))}}),[a,t])),!l)return null;const f=m.createElement(m.Fragment,null,m.createElement(rv,{id:n,value:s.draggable}),m.createElement(nv,{id:c,announcement:i}));return r?vr.createPortal(f,r):f}var Me;(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"})(Me||(Me={}));function hs(){}function uv(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function dv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const St=Object.freeze({x:0,y:0});function fv(e,t){const r=fs(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function hv(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function mv(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function pv(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=s-n,c=a-r;if(n<s&&r<a){const l=t.width*t.height,u=e.width*e.height,f=i*c,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const gv=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const a of n){const{id:i}=a,c=r.get(i);if(c){const l=pv(c,t);l>0&&s.push({id:i,data:{droppableContainer:a,value:l}})}}return s.sort(hv)};function vv(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Ou(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:St}function yv(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((i,c)=>({...i,top:i.top+e*c.y,bottom:i.bottom+e*c.y,left:i.left+e*c.x,right:i.right+e*c.x}),{...r})}}const xv=yv(1);function Iu(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 bv(e,t,r){const n=Iu(t);if(!n)return e;const{scaleX:s,scaleY:a,x:i,y:c}=n,l=e.left-i-(1-s)*parseFloat(r),u=e.top-c-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),f=s?e.width/s:e.width,d=a?e.height/a:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const wv={ignoreTransform:!1};function Cn(e,t){t===void 0&&(t=wv);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=Ue(e).getComputedStyle(e);u&&(r=bv(r,u,f))}const{top:n,left:s,width:a,height:i,bottom:c,right:l}=r;return{top:n,left:s,width:a,height:i,bottom:c,right:l}}function Gi(e){return Cn(e,{ignoreTransform:!0})}function _v(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Sv(e,t){return t===void 0&&(t=Ue(e).getComputedStyle(e)),t.position==="fixed"}function kv(e,t){t===void 0&&(t=Ue(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?r.test(a):!1})}function To(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Eo(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!kn(s)||Ru(s)||r.includes(s))return r;const a=Ue(e).getComputedStyle(s);return s!==e&&kv(s,a)&&r.push(s),Sv(s,a)?r:n(s.parentNode)}return e?n(e):r}function $u(e){const[t]=To(e,1);return t??null}function aa(e){return!Ls||!e?null:qr(e)?e:No(e)?Eo(e)||e===Xr(e).scrollingElement?window:kn(e)?e:null:null}function Fu(e){return qr(e)?e.scrollX:e.scrollLeft}function Lu(e){return qr(e)?e.scrollY:e.scrollTop}function Na(e){return{x:Fu(e),y:Lu(e)}}var Pe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Pe||(Pe={}));function Vu(e){return!Ls||!e?!1:e===document.scrollingElement}function zu(e){const t={x:0,y:0},r=Vu(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=n.y,c=e.scrollLeft>=n.x;return{isTop:s,isLeft:a,isBottom:i,isRight:c,maxScroll:n,minScroll:t}}const jv={x:.2,y:.2};function Cv(e,t,r,n,s){let{top:a,left:i,right:c,bottom:l}=r;n===void 0&&(n=10),s===void 0&&(s=jv);const{isTop:u,isBottom:f,isLeft:d,isRight:h}=zu(e),p={x:0,y:0},b={x:0,y:0},g={height:t.height*s.y,width:t.width*s.x};return!u&&a<=t.top+g.height?(p.y=Pe.Backward,b.y=n*Math.abs((t.top+g.height-a)/g.height)):!f&&l>=t.bottom-g.height&&(p.y=Pe.Forward,b.y=n*Math.abs((t.bottom-g.height-l)/g.height)),!h&&c>=t.right-g.width?(p.x=Pe.Forward,b.x=n*Math.abs((t.right-g.width-c)/g.width)):!d&&i<=t.left+g.width&&(p.x=Pe.Backward,b.x=n*Math.abs((t.left+g.width-i)/g.width)),{direction:p,speed:b}}function Dv(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Hu(e){return e.reduce((t,r)=>Fr(t,Na(r)),St)}function Nv(e){return e.reduce((t,r)=>t+Fu(r),0)}function Ev(e){return e.reduce((t,r)=>t+Lu(r),0)}function Bu(e,t){if(t===void 0&&(t=Cn),!e)return;const{top:r,left:n,bottom:s,right:a}=t(e);$u(e)&&(s<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Av=[["x",["left","right"],Nv],["y",["top","bottom"],Ev]];class Ro{constructor(t,r){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 n=To(r),s=Hu(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,c]of Av)for(const l of i)Object.defineProperty(this,l,{get:()=>{const u=c(n),f=s[a]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ln{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function Tv(e){const{EventTarget:t}=Ue(e);return e instanceof t?e:Xr(e)}function oa(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function Yi(e){e.preventDefault()}function Rv(e){e.stopPropagation()}var ve;(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"})(ve||(ve={}));const Wu={start:[ve.Space,ve.Enter],cancel:[ve.Esc],end:[ve.Space,ve.Enter,ve.Tab]},Mv=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ve.Right:return{...r,x:r.x+25};case ve.Left:return{...r,x:r.x-25};case ve.Down:return{...r,y:r.y+25};case ve.Up:return{...r,y:r.y-25}}};class Uu{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:r}}=t;this.props=t,this.listeners=new ln(Xr(r)),this.windowListeners=new ln(Ue(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Bu(n),r(St)}handleKeyDown(t){if(Ao(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:a=Wu,coordinateGetter:i=Mv,scrollBehavior:c="smooth"}=s,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=n.current,f=u?{x:u.left,y:u.top}:St;this.referenceCoordinates||(this.referenceCoordinates=f);const d=i(t,{active:r,context:n.current,currentCoordinates:f});if(d){const h=ds(d,f),p={x:0,y:0},{scrollableAncestors:b}=n.current;for(const g of b){const y=t.code,{isTop:x,isRight:v,isLeft:k,isBottom:w,maxScroll:S,minScroll:C}=zu(g),_=Dv(g),N={x:Math.min(y===ve.Right?_.right-_.width/2:_.right,Math.max(y===ve.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(y===ve.Down?_.bottom-_.height/2:_.bottom,Math.max(y===ve.Down?_.top:_.top+_.height/2,d.y))},I=y===ve.Right&&!v||y===ve.Left&&!k,M=y===ve.Down&&!w||y===ve.Up&&!x;if(I&&N.x!==d.x){const B=g.scrollLeft+h.x,E=y===ve.Right&&B<=S.x||y===ve.Left&&B>=C.x;if(E&&!h.y){g.scrollTo({left:B,behavior:c});return}E?p.x=g.scrollLeft-B:p.x=y===ve.Right?g.scrollLeft-S.x:g.scrollLeft-C.x,p.x&&g.scrollBy({left:-p.x,behavior:c});break}else if(M&&N.y!==d.y){const B=g.scrollTop+h.y,E=y===ve.Down&&B<=S.y||y===ve.Up&&B>=C.y;if(E&&!h.x){g.scrollTo({top:B,behavior:c});return}E?p.y=g.scrollTop-B:p.y=y===ve.Down?g.scrollTop-S.y:g.scrollTop-C.y,p.y&&g.scrollBy({top:-p.y,behavior:c});break}}this.handleMove(t,Fr(ds(d,this.referenceCoordinates),p))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Uu.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Wu,onActivation:s}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(n.start.includes(i)){const c=a.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Ki(e){return!!(e&&"distance"in e)}function qi(e){return!!(e&&"delay"in e)}class Mo{constructor(t,r,n){var s;n===void 0&&(n=Tv(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=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=Xr(i),this.documentListeners=new ln(this.document),this.listeners=new ln(n),this.windowListeners=new ln(Ue(i)),this.initialCoordinates=(s=fs(a))!=null?s:St,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:r,bypassActivationConstraint:n}}}=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(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,Yi),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,Yi),this.documentListeners.add(ut.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(qi(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Ki(r)){this.handlePending(r);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,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,Rv,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:a}=this,{onMove:i,options:{activationConstraint:c}}=a;if(!s)return;const l=(r=fs(t))!=null?r:St,u=ds(s,l);if(!n&&c){if(Ki(c)){if(c.tolerance!=null&&oa(u,c.tolerance))return this.handleCancel();if(oa(u,c.distance))return this.handleStart()}if(qi(c)&&oa(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ve.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Pv={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Po extends Mo{constructor(t){const{event:r}=t,n=Xr(r.target);super(t,Pv,n)}}Po.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const Ov={move:{name:"mousemove"},end:{name:"mouseup"}};var Ea;(function(e){e[e.RightClick=2]="RightClick"})(Ea||(Ea={}));class Iv extends Mo{constructor(t){super(t,Ov,Xr(t.event.target))}}Iv.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Ea.RightClick?!1:(n?.({event:r}),!0)}}];const ia={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class $v extends Mo{constructor(t){super(t,ia)}static setup(){return window.addEventListener(ia.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ia.move.name,t)};function t(){}}}$v.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n?.({event:r}),!0)}}];var un;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(un||(un={}));var ms;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ms||(ms={}));function Fv(e){let{acceleration:t,activator:r=un.Pointer,canScroll:n,draggingRect:s,enabled:a,interval:i=5,order:c=ms.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:h}=e;const p=Vv({delta:d,disabled:!a}),[b,g]=Xg(),y=m.useRef({x:0,y:0}),x=m.useRef({x:0,y:0}),v=m.useMemo(()=>{switch(r){case un.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case un.DraggableRect:return s}},[r,s,l]),k=m.useRef(null),w=m.useCallback(()=>{const C=k.current;if(!C)return;const _=y.current.x*x.current.x,N=y.current.y*x.current.y;C.scrollBy(_,N)},[]),S=m.useMemo(()=>c===ms.TreeOrder?[...u].reverse():u,[c,u]);m.useEffect(()=>{if(!a||!u.length||!v){g();return}for(const C of S){if(n?.(C)===!1)continue;const _=u.indexOf(C),N=f[_];if(!N)continue;const{direction:I,speed:M}=Cv(C,N,v,t,h);for(const B of["x","y"])p[B][I[B]]||(M[B]=0,I[B]=0);if(M.x>0||M.y>0){g(),k.current=C,b(w,i),y.current=M,x.current=I;return}}y.current={x:0,y:0},x.current={x:0,y:0},g()},[t,w,n,g,a,i,JSON.stringify(v),JSON.stringify(p),b,u,S,f,JSON.stringify(h)])}const Lv={x:{[Pe.Backward]:!1,[Pe.Forward]:!1},y:{[Pe.Backward]:!1,[Pe.Forward]:!1}};function Vv(e){let{delta:t,disabled:r}=e;const n=us(t);return jn(s=>{if(r||!n||!s)return Lv;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Pe.Backward]:s.x[Pe.Backward]||a.x===-1,[Pe.Forward]:s.x[Pe.Forward]||a.x===1},y:{[Pe.Backward]:s.y[Pe.Backward]||a.y===-1,[Pe.Forward]:s.y[Pe.Forward]||a.y===1}}},[r,t,n])}function zv(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return jn(s=>{var a;return t==null?null:(a=n??s)!=null?a:null},[n,t])}function Hv(e,t){return m.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,a=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,n)}));return[...r,...a]},[]),[e,t])}var xn;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xn||(xn={}));var Aa;(function(e){e.Optimized="optimized"})(Aa||(Aa={}));const Xi=new Map;function Bv(e,t){let{dragging:r,dependencies:n,config:s}=t;const[a,i]=m.useState(null),{frequency:c,measure:l,strategy:u}=s,f=m.useRef(e),d=y(),h=vn(d),p=m.useCallback(function(x){x===void 0&&(x=[]),!h.current&&i(v=>v===null?x:v.concat(x.filter(k=>!v.includes(k))))},[h]),b=m.useRef(null),g=jn(x=>{if(d&&!r)return Xi;if(!x||x===Xi||f.current!==e||a!=null){const v=new Map;for(let k of e){if(!k)continue;if(a&&a.length>0&&!a.includes(k.id)&&k.rect.current){v.set(k.id,k.rect.current);continue}const w=k.node.current,S=w?new Ro(l(w),w):null;k.rect.current=S,S&&v.set(k.id,S)}return v}return x},[e,a,r,d,l]);return m.useEffect(()=>{f.current=e},[e]),m.useEffect(()=>{d||p()},[r,d]),m.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),m.useEffect(()=>{d||typeof c!="number"||b.current!==null||(b.current=setTimeout(()=>{p(),b.current=null},c))},[c,d,p,...n]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:a!=null};function y(){switch(u){case xn.Always:return!1;case xn.BeforeDragging:return r;default:return!r}}}function Oo(e,t){return jn(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Wv(e,t){return Oo(e,t)}function Uv(e){let{callback:t,disabled:r}=e;const n=Vs(t),s=m.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return m.useEffect(()=>()=>s?.disconnect(),[s]),s}function Hs(e){let{callback:t,disabled:r}=e;const n=Vs(t),s=m.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return m.useEffect(()=>()=>s?.disconnect(),[s]),s}function Zv(e){return new Ro(Cn(e),e)}function Ji(e,t,r){t===void 0&&(t=Zv);const[n,s]=m.useState(null);function a(){s(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??r)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const i=Uv({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){a();break}}}}),c=Hs({callback:a});return qt(()=>{a(),e?(c?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),i?.disconnect())},[e]),n}function Gv(e){const t=Oo(e);return Ou(e,t)}const Qi=[];function Yv(e){const t=m.useRef(e),r=jn(n=>e?n&&n!==Qi&&e&&t.current&&e.parentNode===t.current.parentNode?n:To(e):Qi,[e]);return m.useEffect(()=>{t.current=e},[e]),r}function Kv(e){const[t,r]=m.useState(null),n=m.useRef(e),s=m.useCallback(a=>{const i=aa(a.target);i&&r(c=>c?(c.set(i,Na(i)),new Map(c)):null)},[]);return m.useEffect(()=>{const a=n.current;if(e!==a){i(a);const c=e.map(l=>{const u=aa(l);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Na(u)]):null}).filter(l=>l!=null);r(c.length?new Map(c):null),n.current=e}return()=>{i(e),i(a)};function i(c){c.forEach(l=>{const u=aa(l);u?.removeEventListener("scroll",s)})}},[s,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Fr(a,i),St):Hu(e):St,[e,t])}function ec(e,t){t===void 0&&(t=[]);const r=m.useRef(null);return m.useEffect(()=>{r.current=null},t),m.useEffect(()=>{const n=e!==St;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ds(e,r.current):St}function qv(e){m.useEffect(()=>{if(!Ls)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Xv(e,t){return m.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:a}=n;return r[s]=i=>{a(i,t)},r},{}),[e,t])}function Zu(e){return m.useMemo(()=>e?_v(e):null,[e])}const tc=[];function Jv(e,t){t===void 0&&(t=Cn);const[r]=e,n=Zu(r?Ue(r):null),[s,a]=m.useState(tc);function i(){a(()=>e.length?e.map(l=>Vu(l)?n:new Ro(t(l),l)):tc)}const c=Hs({callback:i});return qt(()=>{c?.disconnect(),i(),e.forEach(l=>c?.observe(l))},[e]),s}function Gu(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return kn(t)?t:e}function Qv(e){let{measure:t}=e;const[r,n]=m.useState(null),s=m.useCallback(u=>{for(const{target:f}of u)if(kn(f)){n(d=>{const h=t(f);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),a=Hs({callback:s}),i=m.useCallback(u=>{const f=Gu(u);a?.disconnect(),f&&a?.observe(f),n(f?t(f):null)},[t,a]),[c,l]=ls(i);return m.useMemo(()=>({nodeRef:c,rect:r,setRef:l}),[r,c,l])}const ey=[{sensor:Po,options:{}},{sensor:Uu,options:{}}],ty={current:{}},Un={draggable:{measure:Gi},droppable:{measure:Gi,strategy:xn.WhileDragging,frequency:Aa.Optimized},dragOverlay:{measure:Cn}};class dn extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const ry={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new dn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:hs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Un,measureDroppableContainers:hs,windowRect:null,measuringScheduled:!1},Yu={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:hs,draggableNodes:new Map,over:null,measureDroppableContainers:hs},Dn=m.createContext(Yu),Ku=m.createContext(ry);function ny(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new dn}}}function sy(e,t){switch(t.type){case Me.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Me.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 Me.DragEnd:case Me.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Me.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new dn(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Me.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new dn(e.droppable.containers);return i.set(r,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case Me.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const a=new dn(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function ay(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=m.useContext(Dn),a=us(n),i=us(r?.id);return m.useEffect(()=>{if(!t&&!n&&a&&i!=null){if(!Ao(a)||document.activeElement===a.target)return;const c=s.get(i);if(!c)return;const{activatorNode:l,node:u}=c;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=ev(f);if(d){d.focus();break}}})}},[n,t,s,i,a]),null}function qu(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...n}),r):r}function oy(e){return m.useMemo(()=>({draggable:{...Un.draggable,...e?.draggable},droppable:{...Un.droppable,...e?.droppable},dragOverlay:{...Un.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function iy(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const a=m.useRef(!1),{x:i,y:c}=typeof s=="boolean"?{x:s,y:s}:s;qt(()=>{if(!i&&!c||!t){a.current=!1;return}if(a.current||!n)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=r(u),d=Ou(f,n);if(i||(d.x=0),c||(d.y=0),a.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=$u(u);h&&h.scrollBy({top:d.y,left:d.x})}},[t,i,c,n,r])}const Bs=m.createContext({...St,scaleX:1,scaleY:1});var or;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(or||(or={}));const cy=m.memo(function(t){var r,n,s,a;let{id:i,accessibility:c,autoScroll:l=!0,children:u,sensors:f=ey,collisionDetection:d=gv,measuring:h,modifiers:p,...b}=t;const g=m.useReducer(sy,void 0,ny),[y,x]=g,[v,k]=ov(),[w,S]=m.useState(or.Uninitialized),C=w===or.Initialized,{draggable:{active:_,nodes:N,translate:I},droppable:{containers:M}}=y,B=_!=null?N.get(_):null,E=m.useRef({initial:null,translated:null}),F=m.useMemo(()=>{var Le;return _!=null?{id:_,data:(Le=B?.data)!=null?Le:ty,rect:E}:null},[_,B]),T=m.useRef(null),[$,O]=m.useState(null),[A,R]=m.useState(null),V=vn(b,Object.values(b)),H=zs("DndDescribedBy",i),Q=m.useMemo(()=>M.getEnabled(),[M]),Y=oy(h),{droppableRects:z,measureDroppableContainers:W,measuringScheduled:se}=Bv(Q,{dragging:C,dependencies:[I.x,I.y],config:Y.droppable}),ne=zv(N,_),fe=m.useMemo(()=>A?fs(A):null,[A]),pe=jd(),Ae=Wv(ne,Y.draggable.measure);iy({activeNode:_!=null?N.get(_):null,config:pe.layoutShiftCompensation,initialRect:Ae,measure:Y.draggable.measure});const xe=Ji(ne,Y.draggable.measure,Ae),Ze=Ji(ne?ne.parentElement:null),Ge=m.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),qe=M.getNodeFor((r=Ge.current.over)==null?void 0:r.id),Xe=Qv({measure:Y.dragOverlay.measure}),jt=(n=Xe.nodeRef.current)!=null?n:ne,pt=C?(s=Xe.rect)!=null?s:xe:null,Jt=!!(Xe.nodeRef.current&&Xe.rect),Nn=Gv(Jt?null:xe),En=Zu(jt?Ue(jt):null),gt=Yv(C?qe??ne:null),D=Jv(gt),P=qu(p,{transform:{x:I.x-Nn.x,y:I.y-Nn.y,scaleX:1,scaleY:1},activatorEvent:A,active:F,activeNodeRect:xe,containerNodeRect:Ze,draggingNodeRect:pt,over:Ge.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:gt,scrollableAncestorRects:D,windowRect:En}),L=fe?Fr(fe,I):null,X=Kv(gt),G=ec(X),Z=ec(X,[xe]),te=Fr(P,G),le=pt?xv(pt,P):null,he=F&&le?d({active:F,collisionRect:le,droppableRects:z,droppableContainers:Q,pointerCoordinates:L}):null,Ve=mv(he,"id"),[Je,vt]=m.useState(null),Ws=Jt?P:Fr(P,Z),Jr=vv(Ws,(a=Je?.rect)!=null?a:null,xe),pr=m.useRef(null),An=m.useCallback((Le,Qe)=>{let{sensor:et,options:Qt}=Qe;if(T.current==null)return;const lt=N.get(T.current);if(!lt)return;const tt=Le.nativeEvent,Ct=new et({active:T.current,activeNode:lt,event:tt,options:Qt,context:Ge,onAbort(Ie){if(!N.get(Ie))return;const{onDragAbort:Dt}=V.current,Bt={id:Ie};Dt?.(Bt),v({type:"onDragAbort",event:Bt})},onPending(Ie,er,Dt,Bt){if(!N.get(Ie))return;const{onDragPending:en}=V.current,tr={id:Ie,constraint:er,initialCoordinates:Dt,offset:Bt};en?.(tr),v({type:"onDragPending",event:tr})},onStart(Ie){const er=T.current;if(er==null)return;const Dt=N.get(er);if(!Dt)return;const{onDragStart:Bt}=V.current,Qr={activatorEvent:tt,active:{id:er,data:Dt.data,rect:E}};vr.unstable_batchedUpdates(()=>{Bt?.(Qr),S(or.Initializing),x({type:Me.DragStart,initialCoordinates:Ie,active:er}),v({type:"onDragStart",event:Qr}),O(pr.current),R(tt)})},onMove(Ie){x({type:Me.DragMove,coordinates:Ie})},onEnd:Dr(Me.DragEnd),onCancel:Dr(Me.DragCancel)});pr.current=Ct;function Dr(Ie){return async function(){const{active:Dt,collisions:Bt,over:Qr,scrollAdjustedTranslate:en}=Ge.current;let tr=null;if(Dt&&en){const{cancelDrop:tn}=V.current;tr={activatorEvent:tt,active:Dt,collisions:Bt,delta:en,over:Qr},Ie===Me.DragEnd&&typeof tn=="function"&&await Promise.resolve(tn(tr))&&(Ie=Me.DragCancel)}T.current=null,vr.unstable_batchedUpdates(()=>{x({type:Ie}),S(or.Uninitialized),vt(null),O(null),R(null),pr.current=null;const tn=Ie===Me.DragEnd?"onDragEnd":"onDragCancel";if(tr){const Us=V.current[tn];Us?.(tr),v({type:tn,event:tr})}})}}},[N]),Tn=m.useCallback((Le,Qe)=>(et,Qt)=>{const lt=et.nativeEvent,tt=N.get(Qt);if(T.current!==null||!tt||lt.dndKit||lt.defaultPrevented)return;const Ct={active:tt};Le(et,Qe.options,Ct)===!0&&(lt.dndKit={capturedBy:Qe.sensor},T.current=Qt,An(et,Qe))},[N,An]),Rn=Hv(f,Tn);qv(f),qt(()=>{xe&&w===or.Initializing&&S(or.Initialized)},[xe,w]),m.useEffect(()=>{const{onDragMove:Le}=V.current,{active:Qe,activatorEvent:et,collisions:Qt,over:lt}=Ge.current;if(!Qe||!et)return;const tt={active:Qe,activatorEvent:et,collisions:Qt,delta:{x:te.x,y:te.y},over:lt};vr.unstable_batchedUpdates(()=>{Le?.(tt),v({type:"onDragMove",event:tt})})},[te.x,te.y]),m.useEffect(()=>{const{active:Le,activatorEvent:Qe,collisions:et,droppableContainers:Qt,scrollAdjustedTranslate:lt}=Ge.current;if(!Le||T.current==null||!Qe||!lt)return;const{onDragOver:tt}=V.current,Ct=Qt.get(Ve),Dr=Ct&&Ct.rect.current?{id:Ct.id,rect:Ct.rect.current,data:Ct.data,disabled:Ct.disabled}:null,Ie={active:Le,activatorEvent:Qe,collisions:et,delta:{x:lt.x,y:lt.y},over:Dr};vr.unstable_batchedUpdates(()=>{vt(Dr),tt?.(Ie),v({type:"onDragOver",event:Ie})})},[Ve]),qt(()=>{Ge.current={activatorEvent:A,active:F,activeNode:ne,collisionRect:le,collisions:he,droppableRects:z,draggableNodes:N,draggingNode:jt,draggingNodeRect:pt,droppableContainers:M,over:Je,scrollableAncestors:gt,scrollAdjustedTranslate:te},E.current={initial:pt,translated:le}},[F,ne,he,le,N,jt,pt,z,M,Je,gt,te]),Fv({...pe,delta:I,draggingRect:le,pointerCoordinates:L,scrollableAncestors:gt,scrollableAncestorRects:D});const Mn=m.useMemo(()=>({active:F,activeNode:ne,activeNodeRect:xe,activatorEvent:A,collisions:he,containerNodeRect:Ze,dragOverlay:Xe,draggableNodes:N,droppableContainers:M,droppableRects:z,over:Je,measureDroppableContainers:W,scrollableAncestors:gt,scrollableAncestorRects:D,measuringConfiguration:Y,measuringScheduled:se,windowRect:En}),[F,ne,xe,A,he,Ze,Xe,N,M,z,Je,W,gt,D,Y,se,En]),kd=m.useMemo(()=>({activatorEvent:A,activators:Rn,active:F,activeNodeRect:xe,ariaDescribedById:{draggable:H},dispatch:x,draggableNodes:N,over:Je,measureDroppableContainers:W}),[A,Rn,F,xe,x,H,N,Je,W]);return m.createElement(Pu.Provider,{value:k},m.createElement(Dn.Provider,{value:kd},m.createElement(Ku.Provider,{value:Mn},m.createElement(Bs.Provider,{value:Jr},u)),m.createElement(ay,{disabled:c?.restoreFocus===!1})),m.createElement(lv,{...c,hiddenTextDescribedById:H}));function jd(){const Le=$?.autoScrollEnabled===!1,Qe=typeof l=="object"?l.enabled===!1:l===!1,et=C&&!Le&&!Qe;return typeof l=="object"?{...l,enabled:et}:{enabled:et}}}),ly=m.createContext(null),rc="button",uy="Draggable";function dy(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const a=zs(uy),{activators:i,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:h}=m.useContext(Dn),{role:p=rc,roleDescription:b="draggable",tabIndex:g=0}=s??{},y=l?.id===t,x=m.useContext(y?Bs:ly),[v,k]=ls(),[w,S]=ls(),C=Xv(i,t),_=vn(r);qt(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:w,data:_}),()=>{const I=d.get(t);I&&I.key===a&&d.delete(t)}),[d,t]);const N=m.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":n,"aria-pressed":y&&p===rc?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[n,p,g,y,b,f.draggable]);return{active:l,activatorEvent:c,activeNodeRect:u,attributes:N,isDragging:y,listeners:n?void 0:C,node:v,over:h,setNodeRef:k,setActivatorNodeRef:S,transform:x}}function fy(){return m.useContext(Ku)}const hy="Droppable",my={timeout:25};function py(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const a=zs(hy),{active:i,dispatch:c,over:l,measureDroppableContainers:u}=m.useContext(Dn),f=m.useRef({disabled:r}),d=m.useRef(!1),h=m.useRef(null),p=m.useRef(null),{disabled:b,updateMeasurementsFor:g,timeout:y}={...my,...s},x=vn(g??n),v=m.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(x.current)?x.current:[x.current]),p.current=null},y)},[y]),k=Hs({callback:v,disabled:b||!i}),w=m.useCallback((N,I)=>{k&&(I&&(k.unobserve(I),d.current=!1),N&&k.observe(N))},[k]),[S,C]=ls(w),_=vn(t);return m.useEffect(()=>{!k||!S.current||(k.disconnect(),d.current=!1,k.observe(S.current))},[S,k]),m.useEffect(()=>(c({type:Me.RegisterDroppable,element:{id:n,key:a,disabled:r,node:S,rect:h,data:_}}),()=>c({type:Me.UnregisterDroppable,key:a,id:n})),[n]),m.useEffect(()=>{r!==f.current.disabled&&(c({type:Me.SetDroppableDisabled,id:n,key:a,disabled:r}),f.current.disabled=r)},[n,a,r,c]),{active:i,rect:h,isOver:l?.id===n,node:S,over:l,setNodeRef:C}}function gy(e){let{animation:t,children:r}=e;const[n,s]=m.useState(null),[a,i]=m.useState(null),c=us(r);return!r&&!n&&c&&s(c),qt(()=>{if(!a)return;const l=n?.key,u=n?.props.id;if(l==null||u==null){s(null);return}Promise.resolve(t(u,a)).then(()=>{s(null)})},[t,n,a]),m.createElement(m.Fragment,null,r,n?m.cloneElement(n,{ref:i}):null)}const vy={x:0,y:0,scaleX:1,scaleY:1};function yy(e){let{children:t}=e;return m.createElement(Dn.Provider,{value:Yu},m.createElement(Bs.Provider,{value:vy},t))}const xy={position:"fixed",touchAction:"none"},by=e=>Ao(e)?"transform 250ms ease":void 0,wy=m.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:a,className:i,rect:c,style:l,transform:u,transition:f=by}=e;if(!c)return null;const d=s?u:{...u,scaleX:1,scaleY:1},h={...xy,width:c.width,height:c.height,top:c.top,left:c.left,transform:yn.Transform.toString(d),transformOrigin:s&&n?fv(n,c):void 0,transition:typeof f=="function"?f(n):f,...l};return m.createElement(r,{className:i,style:h,ref:t},a)}),_y=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:a,className:i}=e;if(a!=null&&a.active)for(const[c,l]of Object.entries(a.active))l!==void 0&&(s[c]=r.node.style.getPropertyValue(c),r.node.style.setProperty(c,l));if(a!=null&&a.dragOverlay)for(const[c,l]of Object.entries(a.dragOverlay))l!==void 0&&n.node.style.setProperty(c,l);return i!=null&&i.active&&r.node.classList.add(i.active),i!=null&&i.dragOverlay&&n.node.classList.add(i.dragOverlay),function(){for(const[l,u]of Object.entries(s))r.node.style.setProperty(l,u);i!=null&&i.active&&r.node.classList.remove(i.active)}},Sy=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:yn.Transform.toString(t)},{transform:yn.Transform.toString(r)}]},ky={duration:250,easing:"ease",keyframes:Sy,sideEffects:_y({styles:{active:{opacity:"0"}}})};function jy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Vs((a,i)=>{if(t===null)return;const c=r.get(a);if(!c)return;const l=c.node.current;if(!l)return;const u=Gu(i);if(!u)return;const{transform:f}=Ue(i).getComputedStyle(i),d=Iu(f);if(!d)return;const h=typeof t=="function"?t:Cy(t);return Bu(l,s.draggable.measure),h({active:{id:a,data:c.data,node:l,rect:s.draggable.measure(l)},draggableNodes:r,dragOverlay:{node:i,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:d})})}function Cy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...ky,...e};return a=>{let{active:i,dragOverlay:c,transform:l,...u}=a;if(!t)return;const f={x:c.rect.left-i.rect.left,y:c.rect.top-i.rect.top},d={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/c.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/c.rect.height:1},h={x:l.x-f.x,y:l.y-f.y,...d},p=s({...u,active:i,dragOverlay:c,transform:{initial:l,final:h}}),[b]=p,g=p[p.length-1];if(JSON.stringify(b)===JSON.stringify(g))return;const y=n?.({active:i,dragOverlay:c,...u}),x=c.node.animate(p,{duration:t,easing:r,fill:"forwards"});return new Promise(v=>{x.onfinish=()=>{y?.(),v()}})}}let nc=0;function Dy(e){return m.useMemo(()=>{if(e!=null)return nc++,nc},[e])}const Ny=m.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:a,modifiers:i,wrapperElement:c="div",className:l,zIndex:u=999}=e;const{activatorEvent:f,active:d,activeNodeRect:h,containerNodeRect:p,draggableNodes:b,droppableContainers:g,dragOverlay:y,over:x,measuringConfiguration:v,scrollableAncestors:k,scrollableAncestorRects:w,windowRect:S}=fy(),C=m.useContext(Bs),_=Dy(d?.id),N=qu(i,{activatorEvent:f,active:d,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:y.rect,over:x,overlayNodeRect:y.rect,scrollableAncestors:k,scrollableAncestorRects:w,transform:C,windowRect:S}),I=Oo(h),M=jy({config:n,draggableNodes:b,droppableContainers:g,measuringConfiguration:v}),B=I?y.setRef:void 0;return m.createElement(yy,null,m.createElement(gy,{animation:M},d&&_?m.createElement(wy,{key:_,id:d.id,ref:B,as:c,activatorEvent:f,adjustScale:t,className:l,transition:a,rect:I,style:{zIndex:u,...s},transform:N},r):null))});function Xu({currentDate:e,onNavigate:t,onToday:r,dateFormat:n="full",className:s=""}){const{t:a}=Fe();return o.jsxs("div",{className:`flex items-center gap-[var(--ui-space-2)] ${s}`,children:[o.jsx(ae,{variant:"outline",size:"icon",onClick:()=>t("prev"),"aria-label":a("previous"),children:o.jsx(ye.ChevronLeft,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx(ae,{variant:"outline",onClick:r,children:a("today_button")}),o.jsx(ae,{variant:"outline",size:"icon",onClick:()=>t("next"),"aria-label":a("next"),children:o.jsx(ye.ChevronRight,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx("span",{className:"text-lg font-bold ml-[var(--ui-space-2)]",children:o.jsx(It,{date:e,format:n,showSecondary:!0,showDayOfWeek:n==="full"})})]})}const Ju=e=>{if(e.extendedProps?.location){const t=e.extendedProps.location;if(typeof t=="string")return t;if(typeof t=="object"&&t!==null){const r=t,n=typeof r.building=="string"?r.building:"",s=typeof r.room=="string"?r.room:"";return`${n} ${s}`.trim()}}return e.description||""},Ey=e=>!!e.extendedProps?.isAllDay,Qu=(e,t,r)=>{if(!e||e==="[]"||e==="")return t;try{const n=typeof e=="string"?JSON.parse(e):e;if(Array.isArray(n)){const a=n.filter(i=>!(typeof i!="object"||i===null||r&&"personnelId"in i&&i.personnelId===r)).map(i=>{const c=i.name;return typeof c=="string"?c:null}).filter(i=>!!i);return a.length>0?a.join(", "):""}}catch{}return typeof e=="string"?e:""},ps=({event:e,position:t,column:r=0,totalColumns:n=1,onEventClick:s,currentUserId:a,resources:i=[],renderEventContent:c,components:l,viewMode:u="week",orientation:f="horizontal",usePercentagePosition:d=!1})=>{const{attributes:h,listeners:p,setNodeRef:b,isDragging:g}=dy({id:e.id,data:e,disabled:!1}),y=M=>{M.stopPropagation(),s?.(e)},x=e.title,v=Qu(e.attendee,"",a),w=i.find(M=>M.id===e.resourceId)?.name||Ju(e),S=f==="vertical",C=S?t.top>=40:t.height>=60,_=100/n,N=r*_,I=S?{left:d?`${t.top}%`:`${t.top}px`,width:d?`${t.height}%`:`${t.height}px`,top:`calc(${N}% + 2px)`,height:`calc(${_}% - 4px)`,minWidth:d?void 0:"44px",backgroundColor:e.color||"#3b82f6",color:"white",zIndex:g?50:10+r}:{top:d?`${t.top}%`:`${t.top}px`,height:d?`${t.height}%`:`${t.height}px`,minHeight:d?void 0:"44px",left:`calc(${N}% + 2px)`,width:`calc(${_}% - 4px)`,backgroundColor:e.color||"#3b82f6",color:"white",zIndex:g?50:10+r};return o.jsx("div",{ref:b,...p,...h,role:"button",tabIndex:0,onClick:y,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),M.stopPropagation(),s?.(e))},className:`
|
|
61
61
|
absolute rounded px-[var(--ui-space-1)] py-[var(--ui-space-1)] text-sm cursor-pointer
|
|
62
62
|
transition-all select-none flex flex-col items-start text-left
|
|
63
63
|
active:scale-95
|
|
64
64
|
${g?"opacity-50":"hover:shadow-md"}
|
|
65
|
-
`,style:I,children:l?.EventCard?o.jsx(l.EventCard,{event:e,viewMode:u||"week",isDragging:g,onClick:y,isCompact:t.height<50}):c?c(e,u||"week"):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"font-medium truncate text-xs w-full",children:x}),v!==""&&o.jsx("div",{className:"text-[10px] opacity-90 truncate w-full",children:v}),
|
|
65
|
+
`,style:I,children:l?.EventCard?o.jsx(l.EventCard,{event:e,viewMode:u||"week",isDragging:g,onClick:y,isCompact:t.height<50}):c?c(e,u||"week"):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"font-medium truncate text-xs w-full",children:x}),v!==""&&o.jsx("div",{className:"text-[10px] opacity-90 truncate w-full",children:v}),C&&w!==""&&o.jsx("div",{className:"text-[10px] opacity-90 truncate w-full",children:w})]})})},Ay=({event:e,onClick:t,renderEventContent:r,components:n})=>{const s=l=>{l.stopPropagation(),t?.(e)},a=e.title,c=Ey(e)?"All Day":`${e.startDate.getHours()}:${e.startDate.getMinutes().toString().padStart(2,"0")}`;return o.jsx("button",{type:"button",onClick:s,className:"w-full text-left text-sm px-[var(--ui-space-2)] py-[var(--ui-space-1)] mb-[var(--ui-space-0-5)] rounded truncate cursor-pointer active:scale-95 transition-transform select-none border-0 min-h-[var(--ui-space-7)] flex items-center",style:{backgroundColor:e.color||"#3b82f6",color:"white"},children:n?.EventCard?o.jsx(n.EventCard,{event:e,viewMode:"month",isDragging:!1,onClick:s,isCompact:!0}):r?r(e,"month"):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-medium mr-[var(--ui-space-1)]",children:c})," ",a]})})},Ty=({event:e,currentUserId:t,resources:r=[]})=>{const n=e.title,s=Qu(e.attendee,"",t),i=r.find(c=>c.id===e.resourceId)?.name||Ju(e);return o.jsxs("div",{className:"rounded px-[var(--ui-space-2)] py-[var(--ui-space-2)] text-sm shadow-lg min-h-[var(--ui-space-11)] flex flex-col items-start text-left",style:{backgroundColor:e.color||"#3b82f6",color:"white",width:"200px"},children:[o.jsx("div",{className:"font-medium w-full",children:n}),s!==""&&o.jsxs("div",{className:"text-xs opacity-90 w-full text-left",children:["with ",s]}),i!==""&&o.jsx("div",{className:"text-sm opacity-90 w-full text-left",children:i})]})},ft=60,At=50,ht={start:0,end:24},mr="Asia/Tokyo",Ry=(e,t)=>{const r=[],n=new Date(e);n.setHours(0,0,0,0);const s=n.getDay();let a;t===1?a=n.getDate()-(s+6)%7:a=n.getDate()-s,n.setDate(a);for(let i=0;i<7;i++){const c=new Date(n);c.setHours(0,0,0,0),r.push(c),n.setDate(n.getDate()+1)}return r},ed=(e,t=ht.start,r=ht.end)=>{const n=[];for(let s=t;s<r;s++)for(let a=0;a<60;a+=e){const i=`${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`;n.push(i)}return n},My=(e=30,t=ht.start,r=mr)=>{const n=new Date,{hour:s,minute:a}=vs(n,r),i=s*60+a,c=t*60,l=i-c,u=60/e,f=ft*u;return l/60*f},Py=(e=ht.start,t=ht.end,r=mr)=>{const n=new Date,{hour:s}=vs(n,r);return s>=e&&s<t},gs=(e,t,r=ht.start,n=ht.end)=>{const s=new Date(t);s.setHours(0,0,0,0);const a=new Date(t);a.setHours(23,59,59,999);const i=new Date(t);return i.setHours(0,0,0,0),i.setMinutes(n*60),e.filter(c=>{const l=new Date(c.startDate),u=l.getTime()>=s.getTime()&&l.getTime()<=a.getTime(),f=l.getTime()>=s.getTime()+r*60*60*1e3&&l.getTime()<i.getTime();if(n>24){const d=new Date(s);if(d.setDate(s.getDate()+1),l.getTime()>=d.getTime()&&l.getTime()<i.getTime())return!0}return u&&f})},Oy=(e,t)=>{const r=e.getFullYear(),n=e.getMonth(),s=new Date(r,n,1),a=s.getDay(),i=t===1?(a+6)%7:a,c=new Date(s);c.setDate(1-i);const l=[],u=new Date(c);for(let f=0;f<6;f++){const d=[];for(let h=0;h<7;h++)d.push(new Date(u)),u.setDate(u.getDate()+1);l.push(d)}return l},vs=(e,t=mr)=>{try{const n=new Intl.DateTimeFormat("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:t}).formatToParts(e),s=parseInt(n.find(i=>i.type==="hour")?.value||"0",10),a=parseInt(n.find(i=>i.type==="minute")?.value||"0",10);return{hour:s===24?0:s,minute:a}}catch(r){return console.error(`Invalid timezone: ${t}`,r),{hour:e.getHours(),minute:e.getMinutes()}}},td=(e,t=30,r=ht.start,n=mr)=>{const s=e.startDate,a=e.endDate,i=vs(s,n),c=vs(a,n),l=i.hour*60+i.minute;let u=c.hour*60+c.minute;u<l&&(u+=1440);const f=u-l,d=60/t,h=ft*d,p=r*60;let b=l-p;b<0&&(b+=1440);const g=b/60*h,y=f/60*h;return{top:g,height:y}},Iy=(e,t)=>{const r=e.getDay();let n="";return t?n+="font-bold":n+="font-normal",r===0?n+=" text-red-600":r===6?n+=" text-blue-600":n+=" text-foreground",n},$y=(e,t,r,n=mr)=>{if(e.length===0)return[];const s=e.map(d=>({...d,_start:new Date(d.startDate).getTime(),_end:new Date(d.endDate).getTime()})),a=(d,h)=>d._start<h._end&&d._end>h._start,i=[...s].sort((d,h)=>{const p=d._start-h._start;return p!==0?p:h._end-h._start-(d._end-d._start)}),c=Array.from({length:i.length},()=>[]);for(let d=0;d<i.length;d++)for(let h=d+1;h<i.length;h++)a(i[d],i[h])&&(c[d].push(h),c[h].push(d));const l=new Set,u=[];for(let d=0;d<i.length;d++){if(l.has(d))continue;const h=[],p=[d];for(l.add(d);p.length>0;){const b=p.shift();if(b!==void 0){h.push(b);for(const g of c[b])l.has(g)||(l.add(g),p.push(g))}}u.push(h)}const f=[];return u.forEach(d=>{d.sort((g,y)=>i[g]._start-i[y]._start);const h=[],p=new Map;d.forEach(g=>{const y=i[g];let x=-1;for(let v=0;v<h.length;v++){const k=h[v][h[v].length-1],w=i[k];if(y._start>=w._end){x=v;break}}x===-1&&(x=h.length,h.push([])),h[x].push(g),p.set(g,x)});const b=h.length;d.forEach(g=>{const y=i[g],x=p.get(g);if(x===void 0)return;const v=td(y,t,r,n),k=e.find(w=>w.id===y.id)??y;f.push({event:k,column:x,totalColumns:b,position:v})})}),f},rd=({interval:e,isToday:t,startHour:r,endHour:n,relative:s=!1,timeZone:a=mr})=>{const[i,c]=m.useState(new Date);if(m.useEffect(()=>{const u=setInterval(()=>{c(new Date)},6e4);return()=>clearInterval(u)},[]),!t||!Py(r,n,a))return null;const l=My(e,r,a);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`${s?"absolute":"fixed"} left-[var(--ui-space-0)] w-[var(--ui-space-2)] h-[var(--ui-space-2)] bg-red-500 rounded-full -translate-x-[var(--ui-space-1)]`,style:{top:`${l}px`,zIndex:20},"aria-hidden":"true",title:`Current time: ${i.toLocaleTimeString()}`}),o.jsx("div",{className:`${s?"absolute":"fixed"} left-[var(--ui-space-0)] right-[var(--ui-space-0)] h-[var(--ui-space-0-5)] bg-red-500`,style:{top:`${l}px`,zIndex:20},"aria-hidden":"true"})]})},sc=({date:e,timeSlot:t,onClick:r,orientation:n="horizontal"})=>{const s=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0"),c=`${s}-${a}-${i}T${t}`,{setNodeRef:l,isOver:u}=py({id:c}),f=n==="vertical";return o.jsx("button",{ref:l,type:"button",onClick:()=>r?.(e,t),className:`
|
|
66
66
|
border-border cursor-pointer transition-colors p-0 m-0 block box-border
|
|
67
67
|
${f?"border-r h-full flex-shrink-0":"border-b w-full text-left"}
|
|
68
68
|
${u?"bg-accent/50":"hover:bg-muted/30"}
|
|
69
|
-
`,style:f?{width:`${At}px`}:{height:`${ft}px`},"aria-label":`Time slot ${t}`})};function
|
|
69
|
+
`,style:f?{width:`${At}px`}:{height:`${ft}px`},"aria-label":`Time slot ${t}`})};function Fy({currentDate:e,events:t,settings:r,onTimeSlotClick:n,onEventClick:s,currentUserId:a,resources:i,renderEventContent:c,components:l}){const{t:u}=Fe(),f=r.slotInterval??r.defaultDuration??60,d=(r.startTime||r.businessHoursStart)?.split(":")[0],h=(r.endTime||r.businessHoursEnd)?.split(":")[0],p=d!==void 0?Number(d):ht.start,b=h!==void 0?Number(h):ht.end,g=r.timeZone||mr,y=m.useMemo(()=>ed(f,p,b),[f,p,b]),x=m.useMemo(()=>gs(t,e,p,b),[t,e,p,b]),{allDayEvents:v,timeEvents:k}=m.useMemo(()=>{const E=[],F=[];return x.forEach(T=>{T.isAllDay?E.push(T):F.push(T)}),{allDayEvents:E,timeEvents:F}},[x]),w=m.useMemo(()=>k.map(E=>({event:E,position:td(E,f,p,g)})),[k,f,p,g]),S=new Date,C=e.toDateString()===S.toDateString(),_=m.useRef(null),[N,I]=m.useState(0);m.useEffect(()=>{const E=_.current;if(!E)return;const F=()=>{const $=E.offsetWidth-E.clientWidth;I($>0?$:0)};F();const T=new ResizeObserver(F);return T.observe(E),()=>T.disconnect()},[]);const B=(r.orientation||"horizontal")==="vertical";return o.jsx("div",{className:"flex flex-col h-full bg-background text-foreground",children:B?o.jsx("div",{className:"flex-1 overflow-auto relative",children:o.jsxs("div",{className:"flex flex-col min-w-max",style:{minWidth:`${y.length*At+128}px`},children:[o.jsxs("div",{className:"flex border-b border-border bg-muted/40 sticky top-0 z-30",children:[o.jsx("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border bg-background sticky left-0 z-40"}),o.jsx("div",{className:"flex",children:y.map(E=>o.jsx("div",{className:"flex-shrink-0 text-center border-r border-border text-[10px] text-muted-foreground p-1 flex items-center justify-center box-border",style:{width:`${At}px`},children:E},E))})]}),o.jsxs("div",{className:`flex border-b border-border relative min-h-[var(--ui-space-20)] ${C?"bg-primary/5":""}`,children:[o.jsxs("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border sticky left-0 z-20 bg-background p-2 flex flex-col items-center justify-center",children:[o.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:o.jsx(It,{date:e,format:"weekday"})}),o.jsx("div",{className:`text-xl font-bold mt-[var(--ui-space-1)] ${C?"text-primary":""}`,children:e.getDate()})]}),o.jsxs("div",{className:"flex relative",children:[y.map(E=>o.jsx(sc,{date:e,timeSlot:E,onClick:n,orientation:"vertical"},`${e.toISOString()}-${E}`)),w.map(({event:E,position:F})=>o.jsx(ps,{event:E,position:{top:F.top/ft*At,height:F.height/ft*At},onEventClick:s,currentUserId:a,resources:i,renderEventContent:c,components:l,viewMode:"day",orientation:"vertical"},E.id))]})]})]})}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`border-b border-border p-[var(--ui-space-2)] sticky top-[var(--ui-space-0)] z-30 text-center ${C?"bg-muted/50":"bg-muted/40"}`,style:{paddingRight:N||void 0},children:[o.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:o.jsx(It,{date:e,format:"weekday"})}),o.jsx("div",{className:`text-xl font-bold mt-[var(--ui-space-1)] ${C?"text-primary":""}`,children:e.getDate()})]}),v.length>0&&o.jsxs("div",{className:"flex border-b border-border bg-muted/20 sticky top-[var(--ui-space-13)] z-30",style:{paddingRight:N||void 0},children:[o.jsx("div",{className:"w-[var(--ui-space-16)] flex-shrink-0 border-r border-border bg-background flex items-center justify-end pr-[var(--ui-space-1)]",children:o.jsx("span",{className:"text-[9px] text-muted-foreground",children:u("all_day")})}),o.jsx("div",{className:"flex-1 p-[var(--ui-space-0-5)] min-w-[var(--ui-space-0)]",children:o.jsx("div",{className:"flex flex-col gap-[var(--ui-space-0-5)]",children:v.map(E=>o.jsx("div",{role:"button",tabIndex:0,className:`
|
|
70
70
|
text-[9px] px-[var(--ui-space-1)] py-[var(--ui-space-0-5)] rounded w-full text-left truncate leading-tight
|
|
71
71
|
bg-primary text-primary-foreground
|
|
72
72
|
hover:brightness-110 transition-colors cursor-pointer
|
|
73
|
-
`,style:
|
|
73
|
+
`,style:E.color?{backgroundColor:E.color}:{},onClick:F=>{F.stopPropagation(),s?.(E)},onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),F.stopPropagation(),s?.(E))},children:l?.EventCard?o.jsx(l.EventCard,{event:E,viewMode:"day",isCompact:!0,onClick:()=>s?.(E)}):E.title},E.id))})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto relative",ref:_,children:o.jsxs("div",{className:"flex",style:{minHeight:`${(b-p)*60/f*ft}px`},children:[o.jsx("div",{className:"w-[var(--ui-space-16)] flex-shrink-0 bg-background sticky left-[var(--ui-space-0)] z-20",children:y.map(E=>o.jsx("div",{className:"border-b border-border text-xs text-muted-foreground p-0 flex items-center justify-end pr-[var(--ui-space-2)] box-border",style:{height:`${ft}px`},children:E},E))}),o.jsxs("div",{className:"flex-1 relative border-l border-border min-w-[var(--ui-space-50)]",children:[o.jsx(rd,{interval:f,isToday:C,startHour:p,endHour:b,relative:!0,timeZone:g}),y.map(E=>o.jsx(sc,{date:e,timeSlot:E,onClick:n,orientation:"horizontal"},E)),w.map(({event:E,position:F})=>o.jsx(ps,{event:E,position:F,onEventClick:s,currentUserId:a,resources:i,renderEventContent:c,components:l,viewMode:"day",orientation:"horizontal"},E.id))]})]})})]})})}function Ly({currentDate:e,events:t,settings:r,onDateClick:n,onEventClick:s,currentUserId:a,renderEventContent:i,components:c}){const{t:l}=Fe(),u=r.weekStartsOn??1,f=m.useMemo(()=>Oy(e,u),[e,u]),d=[l("days_short_sun"),l("days_short_mon"),l("days_short_tue"),l("days_short_wed"),l("days_short_thu"),l("days_short_fri"),l("days_short_sat")],h=u===1?[...d.slice(1),d[0]]:d,p=new Date,b=e.getMonth();return o.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[o.jsx("div",{className:"grid grid-cols-7 border-b border-border bg-muted/40",children:h.map(g=>o.jsx("div",{className:"p-[var(--ui-space-3)] text-center text-sm font-medium text-muted-foreground border-r border-border last:border-r-0",children:g},g))}),o.jsx("div",{className:"flex-1 grid gap-[var(--ui-space-0)]",style:{gridTemplateRows:`repeat(${f.length}, 1fr)`},children:f.map(g=>o.jsx("div",{className:"grid grid-cols-7 border-b border-border last:border-b-0 h-full",children:g.map(y=>{const x=y.toDateString()===p.toDateString(),v=y.getMonth()===b,k=y.toDateString()===e.toDateString(),w=gs(t,y,0,24);return o.jsxs("div",{className:`
|
|
74
74
|
relative border-r border-border last:border-r-0 p-ui-cell cursor-pointer
|
|
75
75
|
transition-colors
|
|
76
76
|
${v?"bg-background":"bg-muted/20 text-muted-foreground"}
|
|
77
|
-
${
|
|
77
|
+
${k?"bg-primary/5":""}
|
|
78
78
|
hover:bg-muted/50
|
|
79
79
|
flex flex-col
|
|
80
80
|
`,children:[o.jsx("button",{type:"button",className:"absolute inset-[var(--ui-space-0)] z-0","aria-label":l("day_cell")??"Day cell",onClick:()=>n?.(y)}),o.jsx("div",{className:`text-sm font-medium mb-[var(--ui-space-1)] flex justify-between items-center
|
|
81
|
-
${
|
|
81
|
+
${Iy(y,k)}
|
|
82
82
|
`,children:o.jsx("span",{className:`
|
|
83
83
|
${x?"bg-primary text-primary-foreground rounded-full w-[var(--ui-space-6)] h-[var(--ui-space-6)] flex items-center justify-center":""}
|
|
84
|
-
`,children:y.getDate()})}),o.jsxs("div",{className:"space-y-[var(--ui-space-1)] overflow-hidden flex-1 relative z-10",children:[w.slice(0,3).map(S=>o.jsx(
|
|
84
|
+
`,children:y.getDate()})}),o.jsxs("div",{className:"space-y-[var(--ui-space-1)] overflow-hidden flex-1 relative z-10",children:[w.slice(0,3).map(S=>o.jsx(Ay,{event:S,onClick:s,currentUserId:a,renderEventContent:i,components:c},S.id)),w.length>3&&o.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",w.length-3," more"]})]})]},y.toISOString())})},g[0]?.toISOString()??"empty-week"))})]})}function Vy({currentDate:e,events:t,settings:r,onTimeSlotClick:n,onEventClick:s,currentUserId:a,resources:i,renderEventContent:c,components:l}){const{t:u}=Fe(),f=r.slotInterval??r.defaultDuration??60,d=(r.startTime||r.businessHoursStart)?.split(":")[0],h=(r.endTime||r.businessHoursEnd)?.split(":")[0],p=d!==void 0?Number(d):ht.start,b=h!==void 0?Number(h):ht.end,g=r.weekStartsOn??1,y=r.timeZone||mr,x=m.useMemo(()=>Ry(e,g),[e,g]),v=m.useMemo(()=>ed(f,p,b),[f,p,b]),k=[u("days_short_sun"),u("days_short_mon"),u("days_short_tue"),u("days_short_wed"),u("days_short_thu"),u("days_short_fri"),u("days_short_sat")],S=new Date().toDateString(),C=m.useRef(null),[_,N]=m.useState(0);m.useEffect(()=>{const T=C.current;if(!T)return;const $=()=>{const A=T.offsetWidth-T.clientWidth;N(A>0?A:0)};$();const O=new ResizeObserver($);return O.observe(T),()=>O.disconnect()},[]);const{allDayEvents:I,timedEvents:M}=m.useMemo(()=>{const T=[],$=[];return t.forEach(O=>{O.isAllDay||O.extendedProps?.isAllDay?T.push(O):$.push(O)}),{allDayEvents:T,timedEvents:$}},[t]),B=m.useMemo(()=>x.map(T=>{const $=gs(M,T,p,b);return{date:T.toISOString(),events:$y($,f,p,y)}}),[x,M,f,p,y,b]),F=(r.orientation||"horizontal")==="vertical";return o.jsx("div",{className:"flex flex-col h-full bg-background text-foreground",children:F?o.jsx("div",{className:"flex-1 overflow-auto relative",children:o.jsxs("div",{className:"flex flex-col min-w-max",style:{minWidth:`${v.length*At+128}px`},children:[o.jsxs("div",{className:"flex border-b border-border bg-muted/40 sticky top-0 z-30",children:[o.jsx("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border bg-background sticky left-0 z-40"}),o.jsx("div",{className:"flex",children:v.map(T=>o.jsx("div",{className:"flex-shrink-0 text-center border-r border-border text-[10px] text-muted-foreground p-1 flex items-center justify-center box-border",style:{width:`${At}px`},children:T},T))})]}),x.map((T,$)=>{const O=T.toDateString()===S,A=T.toDateString()===e.toDateString(),R=T.getDay(),V=B[$];return o.jsxs("div",{className:`flex border-b border-border relative min-h-[80px] ${A?"bg-primary/5":""}`,children:[o.jsxs("div",{className:"w-[var(--ui-space-32)] flex-shrink-0 border-r border-border sticky left-0 z-20 bg-background p-2 flex flex-col items-center justify-center",children:[o.jsx("div",{className:`text-[10px] font-medium ${R===0?"text-red-500":R===6?"text-blue-500":"text-muted-foreground"}`,children:k[R]}),o.jsx("div",{className:`text-base font-bold ${O?"text-primary":""}`,children:T.getDate()})]}),o.jsxs("div",{className:"flex relative",children:[v.map(H=>o.jsx("button",{type:"button",onClick:()=>n?.(T,H),className:"border-r border-border cursor-pointer transition-colors hover:bg-muted/30 p-0 m-0 block box-border",style:{width:`${At}px`,height:"100%"},"aria-label":`Time slot ${H}`},`${T.toISOString()}-${H}`)),V?.events.map(({event:H,position:Q,column:Y,totalColumns:z})=>o.jsx(ps,{event:H,position:{top:Q.top/ft*At,height:Q.height/ft*At},column:Y,totalColumns:z,onEventClick:s,currentUserId:a,resources:i,renderEventContent:c,components:l,viewMode:"week",orientation:"vertical"},H.id))]})]},T.toISOString())})]})}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex border-b border-border bg-muted/40 sticky top-[var(--ui-space-0)] z-30",style:{paddingRight:_||void 0},children:[o.jsx("div",{className:"w-[var(--ui-space-16)] flex-shrink-0 border-r border-border bg-background"}),x.map(T=>{const $=T.toDateString()===S,O=T.toDateString()===e.toDateString(),A=T.getDay();return o.jsxs("div",{className:`flex-1 p-[var(--ui-space-1)] text-center border-r border-border last:border-r-0 transition-colors min-w-[var(--ui-space-0)]
|
|
85
85
|
${O?"bg-primary/5":""}
|
|
86
|
-
`,children:[o.jsx("div",{className:`text-[10px] font-medium ${
|
|
86
|
+
`,children:[o.jsx("div",{className:`text-[10px] font-medium ${A===0?"text-red-500":A===6?"text-blue-500":"text-muted-foreground"}`,children:k[A]}),o.jsx("div",{className:`text-base font-bold ${$?"text-primary":""}`,children:T.getDate()})]},T.toISOString())})]}),I.length>0&&o.jsxs("div",{className:"flex border-b border-border bg-muted/20 sticky top-[var(--ui-space-13)] z-30",style:{paddingRight:_||void 0},children:[o.jsx("div",{className:"w-[var(--ui-space-16)] flex-shrink-0 border-r border-border bg-background flex items-center justify-end pr-[var(--ui-space-1)]",children:o.jsx("span",{className:"text-[9px] text-muted-foreground",children:u("all_day")})}),x.map(T=>{const $=gs(I,T,p,b);return o.jsx("div",{className:"flex-1 p-[var(--ui-space-0-5)] border-r border-border last:border-r-0 min-w-[var(--ui-space-0)]",children:o.jsx("div",{className:"flex flex-col gap-[var(--ui-space-0-5)]",children:$.map(O=>o.jsx("div",{role:"button",tabIndex:0,className:`
|
|
87
87
|
text-[9px] px-[var(--ui-space-1)] py-[var(--ui-space-0-5)] rounded w-full text-left truncate leading-tight
|
|
88
88
|
bg-primary text-primary-foreground
|
|
89
89
|
hover:brightness-110 transition-colors cursor-pointer
|
|
90
|
-
`,style:O.color?{backgroundColor:O.color}:{},onClick:P=>{P.stopPropagation(),s?.(O)},onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),P.stopPropagation(),s?.(O))},children:l?.EventCard?o.jsx(l.EventCard,{event:O,viewMode:"week",isCompact:!0,onClick:()=>s?.(O)}):O.title},O.id))})},A.toISOString())})]}),o.jsx("div",{className:"flex-1 overflow-y-auto relative",ref:k,children:o.jsxs("div",{className:"flex",style:{minHeight:`${(b-m)*60/f*ft}px`},children:[o.jsx("div",{className:"w-[var(--ui-space-16)] flex-shrink-0 sticky left-[var(--ui-space-0)] z-20 bg-background border-r border-border",children:v.map(A=>o.jsx("div",{className:"border-b border-border text-xs text-muted-foreground p-0 flex items-center justify-end pr-[var(--ui-space-2)] box-border",style:{height:`${ft}px`},children:A},A))}),o.jsx("div",{className:"flex-1 flex",children:x.map((A,V)=>{const O=A.toDateString()===S,P=H[V];return o.jsxs("div",{className:"flex-1 border-r border-border last:border-r-0 relative min-w-[var(--ui-space-0)]",children:[o.jsx(zu,{interval:f,isToday:O,startHour:m,endHour:b,relative:!0,timeZone:y}),v.map(R=>o.jsx("button",{type:"button",onClick:()=>n?.(A,R),className:"border-b border-border cursor-pointer transition-colors hover:bg-muted/30 w-full text-left p-0 m-0 block box-border",style:{height:`${ft}px`},"aria-label":`Time slot ${R}`},`${A.toISOString()}-${R}`)),P?.events.map(({event:R,position:B,column:z,totalColumns:J})=>o.jsx(ms,{event:R,position:B,column:z,totalColumns:J,onEventClick:s,currentUserId:a,resources:i,renderEventContent:c,components:l,viewMode:"week",orientation:"horizontal"},R.id))]},A.toISOString())})})]})})]})})}function Hu({events:e,settings:t,currentDate:r,viewMode:n,onDateChange:s,onViewChange:a,onEventClick:i,onEventDrop:c,onTimeSlotClick:l,onDateClick:u,isLoading:f=!1,className:d,headerLeft:h,headerRight:m,defaultView:b="week",enablePersistence:g=!1,storageKey:y="regular-calendar-view",storage:x=Ms,currentUserId:v,resources:_=[],renderEventContent:w,components:S}){const{t:k}=Le(),[j,E]=p.useState(new Date),[I,M]=p.useState(()=>{if(g)try{const L=x.getItem(y);if(L&&["day","week","month"].includes(L))return L}catch(L){console.warn("Failed to load calendar view from storage",L)}return b}),H=r??j,N=n??I;p.useEffect(()=>{if(g&&!n)try{x.setItem(y,I)}catch(L){console.warn("Failed to save calendar view to storage",L)}},[I,g,y,n,x]);const F=L=>{const W=yo(H,N,L);s?s(W):E(W)},A=()=>{const L=new Date;s?s(L):E(L)},V=L=>{a?a(L):M(L)},O=(L,W)=>{const se=new Date(L);if(W){const[ne,fe]=W.split(":").map(Number);Number.isNaN(ne)||se.setHours(ne),Number.isNaN(fe)||se.setMinutes(fe)}l?.(se)},P=L=>{u&&u(L),s?s(L):E(L)},R=zg(Vg(jo,{activationConstraint:{distance:8}})),[B,z]=p.useState(null),J=L=>{const{active:W}=L,se=e.find(ne=>ne.id===W.id);se&&z(se)},G=L=>{const{active:W,over:se}=L;if(z(null),!se||!c)return;const ne=e.find(Ze=>Ze.id===W.id);if(!ne)return;const fe=se.id,pe=new Date(fe);if(Number.isNaN(pe.getTime()))return;const Ae=fe.includes("T"),xe=new Date(pe);Ae||xe.setHours(ne.startDate.getHours(),ne.startDate.getMinutes()),c(ne,xe)};return o.jsxs(Fv,{sensors:R,onDragStart:J,onDragEnd:G,children:[o.jsxs("div",{className:`flex flex-col h-full bg-background ${d}`,children:[o.jsxs("header",{className:"border-b border-border px-[var(--ui-space-4)] py-[var(--ui-space-3)] flex items-center justify-between gap-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:[o.jsx(oe,{variant:"outline",size:"icon",onClick:()=>F("prev"),children:o.jsx(ye.ChevronLeft,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx(oe,{variant:"outline",onClick:A,children:k("today_button")}),o.jsx(oe,{variant:"outline",size:"icon",onClick:()=>F("next"),children:o.jsx(ye.ChevronRight,{className:"h-[var(--ui-space-4)] w-[var(--ui-space-4)]"})}),o.jsx("span",{className:"text-lg font-bold ml-[var(--ui-space-2)]",children:o.jsx(It,{date:H,showSecondary:!0,showDayOfWeek:!0})}),h]}),o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-4)]",children:[o.jsx(vo,{currentView:N,onViewChange:V,options:[{value:"day",label:k("view_day")},{value:"week",label:k("view_week")},{value:"month",label:k("view_month")}]}),m]})]}),o.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[f&&o.jsx("div",{className:"absolute inset-[var(--ui-space-0)] bg-background/50 z-10 flex items-center justify-center",children:"Loading..."}),N==="day"&&o.jsx(my,{currentDate:H,events:e,settings:t,onEventClick:i,onTimeSlotClick:O,currentUserId:v,resources:_,renderEventContent:w,components:S}),N==="week"&&o.jsx(gy,{currentDate:H,events:e,settings:t,onEventClick:i,onTimeSlotClick:O,currentUserId:v,resources:_,renderEventContent:w,components:S}),N==="month"&&o.jsx(py,{currentDate:H,events:e,settings:t,onEventClick:i,onDateClick:P,currentUserId:v,renderEventContent:w,components:S})]})]}),o.jsx(sy,{children:B?o.jsx(iy,{event:B,currentUserId:v,resources:_}):null})]})}function vy({events:e,resources:t,groups:r,settings:n,isLoading:s,onEventCreate:a,onEventUpdate:i,onEventDelete:c,onToast:l,customFields:u,personnel:f,currentUserId:d,i18n:h}){const[m,b]=p.useState(!1),[g,y]=p.useState(void 0),[x,v]=p.useState(void 0),_={...n,defaultDuration:30},w=e,S=M=>{v(M),y(void 0),b(!0)},k=M=>{y(M),v(void 0),b(!0)},j=()=>{b(!1),y(void 0),v(void 0)},E=async M=>{try{g?(await i(g.id,M),l?.("Event updated successfully","success")):(await a(M),l?.("Event created successfully","success")),j()}catch(H){console.error("Failed to save event",H),l?.("Failed to save event","error")}},I=async M=>{try{await c(M),l?.("Event deleted successfully","success"),j()}catch(H){console.error("Failed to delete event",H),l?.("Failed to delete event","error")}};return o.jsxs(o.Fragment,{children:[o.jsx(Hu,{events:w,settings:_,isLoading:s,onEventClick:k,onTimeSlotClick:S,onDateClick:S,enablePersistence:!0,defaultView:"week",storageKey:"regular-calendar-view",currentUserId:d,resources:t}),o.jsx(vu,{isOpen:m,onClose:j,onSave:E,onDelete:()=>{g?.id&&I(g.id)},event:g,defaultStartTime:x,resources:t,groups:r,events:e,personnel:f,currentUserId:d,customFields:u})]})}const qi=[...Array.from({length:24},(e,t)=>`${t.toString().padStart(2,"0")}:00`),"24:00","25:00","26:00","27:00","28:00","29:00","30:00"];function yy({isOpen:e,onClose:t,settings:r,onUpdateSettings:n,onResetSettings:s}){const{t:a}=Le();if(!e)return null;const i=l=>{n(l)},c=[a("days_short_sun"),a("days_short_mon"),a("days_short_tue"),a("days_short_wed"),a("days_short_thu"),a("days_short_fri"),a("days_short_sat")];return o.jsxs("div",{className:"fixed inset-[var(--ui-space-0)] z-[9999] flex items-center justify-center bg-black/50 p-[var(--ui-space-4)]",children:[o.jsx("button",{type:"button","aria-label":a("close"),onClick:t,className:"absolute inset-[var(--ui-space-0)] border-none bg-transparent p-[var(--ui-space-0)] m-[var(--ui-space-0)] w-full h-full cursor-default"}),o.jsxs("div",{className:"relative z-10 w-full max-w-[var(--ui-space-125)] max-h-[var(--ui-space-90vh)] overflow-y-auto rounded-lg border border-border bg-background text-foreground shadow-xl p-[var(--ui-space-6)]",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border pb-[var(--ui-space-4)] mb-[var(--ui-space-6)]",children:[o.jsx("h2",{className:"m-[var(--ui-space-0)] text-xl font-bold",children:a("settings_title")}),o.jsx(oe,{variant:"ghost",size:"icon",onClick:t,children:"✕"})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_language")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["ja","en"].map(l=>o.jsx(oe,{variant:r.language===l?"default":"outline",onClick:()=>i({language:l}),children:l==="ja"?"日本語":"English"},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("label",{htmlFor:"settings-timezone",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:"TimeZone"}),o.jsxs("select",{id:"settings-timezone",value:r.timeZone||"Asia/Tokyo",onChange:l=>i({timeZone:l.target.value}),className:"h-ui w-full rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[o.jsx("option",{value:"Asia/Tokyo",children:"Asia/Tokyo (JST)"}),o.jsx("option",{value:"UTC",children:"UTC"}),o.jsx("option",{value:"America/New_York",children:"America/New_York (ET)"}),o.jsx("option",{value:"Europe/London",children:"Europe/London (GMT/BST)"}),o.jsx("option",{value:"Asia/Shanghai",children:"Asia/Shanghai (CST)"})]})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_theme")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["light","dark"].map(l=>o.jsx(oe,{variant:r.theme===l?"default":"outline",onClick:()=>i({theme:l}),children:a(l==="light"?"option_light":"option_dark")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_density")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["compact","normal","spacious"].map(l=>o.jsx(oe,{variant:r.density===l?"default":"outline",onClick:()=>i({density:l}),children:a(l==="compact"?"option_compact":l==="normal"?"option_normal":"option_spacious")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_calendar_orientation","Calendar Orientation")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["horizontal","vertical"].map(l=>o.jsx(oe,{variant:r.calendarOrientation===l?"default":"outline",onClick:()=>i({calendarOrientation:l}),children:l==="horizontal"?a("option_horizontal","Horizontal"):a("option_vertical","Vertical")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_calendar_interval","Calendar Slot Interval")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:[15,30,60,120].map(l=>o.jsxs(oe,{variant:r.calendarSlotInterval===l?"default":"outline",onClick:()=>i({calendarSlotInterval:l}),children:[l===15&&a("option_15m","15m"),l===30&&a("option_30m","30m"),l===60&&a("option_1h","1h"),l===120&&a("option_2h","2h")]},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_facility_orientation","Facility Orientation")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["horizontal","vertical"].map(l=>o.jsx(oe,{variant:r.facilityOrientation===l?"default":"outline",onClick:()=>i({facilityOrientation:l}),children:l==="horizontal"?a("option_horizontal","Horizontal"):a("option_vertical","Vertical")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_facility_interval","Facility Slot Interval")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:[15,30,60,120].map(l=>o.jsxs(oe,{variant:r.facilitySlotInterval===l?"default":"outline",onClick:()=>i({facilitySlotInterval:l}),children:[l===15&&a("option_15m","15m"),l===30&&a("option_30m","30m"),l===60&&a("option_1h","1h"),l===120&&a("option_2h","2h")]},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsxs("label",{htmlFor:"settings-radius",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:[a("settings_radius"),": ",r.borderRadius,"px"]}),o.jsx("input",{id:"settings-radius",type:"range",min:"0",max:"16",value:r.borderRadius,onChange:l=>i({borderRadius:Number(l.target.value)}),className:"w-full cursor-pointer"})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsxs("label",{htmlFor:"settings-font-size",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:[a("settings_font_size"),": ",r.fontSize,"px"]}),o.jsx("input",{id:"settings-font-size",type:"range",min:"12",max:"20",value:r.fontSize,onChange:l=>i({fontSize:Number(l.target.value)}),className:"w-full cursor-pointer"})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("label",{htmlFor:"settings-week-start",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_week_start")}),o.jsxs("select",{id:"settings-week-start",value:r.weekStartsOn,onChange:l=>i({weekStartsOn:Number(l.target.value)}),className:"h-ui w-full rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[o.jsx("option",{value:0,children:a("option_sunday")}),o.jsx("option",{value:1,children:a("option_monday")})]})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_business_hours")}),o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:[o.jsx("select",{value:r.businessHoursStart,onChange:l=>i({businessHoursStart:l.target.value}),className:"h-ui flex-1 rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:qi.map(l=>o.jsx("option",{value:l,children:l},l))}),o.jsx("span",{children:"〜"}),o.jsx("select",{value:r.businessHoursEnd,onChange:l=>i({businessHoursEnd:l.target.value}),className:"h-ui flex-1 rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:qi.map(l=>o.jsx("option",{value:l,children:l},l))})]})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_closed_days")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:c.map((l,u)=>o.jsx(oe,{variant:r.closedDays.includes(u)?"destructive":"outline",size:"sm",onClick:()=>{const f=r.closedDays.includes(u)?r.closedDays.filter(d=>d!==u):[...r.closedDays,u];i({closedDays:f})},className:"w-[var(--ui-space-10)] h-[var(--ui-space-10)] p-[var(--ui-space-0)]",children:l},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsxs("div",{className:"flex items-center justify-between mb-[var(--ui-space-2)]",children:[o.jsx("div",{className:"text-sm font-bold",children:a("settings_pagination")}),o.jsx("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:o.jsx(oe,{variant:r.paginationEnabled?"default":"outline",onClick:()=>i({paginationEnabled:!r.paginationEnabled}),children:r.paginationEnabled?"ON":"OFF"})})]}),r.paginationEnabled&&o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-4)]",children:[o.jsxs("label",{htmlFor:"settings-page-size",className:"text-sm whitespace-nowrap",children:[a("settings_page_size"),": ",r.paginationPageSize]}),o.jsx("input",{id:"settings-page-size",type:"range",min:"4",max:"20",step:"1",value:r.paginationPageSize,onChange:l=>i({paginationPageSize:Number(l.target.value)}),className:"w-full cursor-pointer"})]})]}),s&&o.jsx("div",{className:"mt-[var(--ui-space-8)] border-t border-border pt-[var(--ui-space-4)]",children:o.jsx(oe,{variant:"outline",className:"w-full text-destructive hover:bg-destructive/10 hover:border-destructive h-ui",onClick:s,children:"Reset All Settings"})})]})]})}function xy(e,t=document.documentElement){e.theme==="dark"?(t.style.setProperty("--background","210 20% 10%"),t.style.setProperty("--foreground","210 30% 96%"),t.style.setProperty("--card","210 20% 16%"),t.style.setProperty("--card-foreground","210 30% 96%"),t.style.setProperty("--popover","210 20% 10%"),t.style.setProperty("--popover-foreground","210 30% 96%"),t.style.setProperty("--primary","200 95% 42%"),t.style.setProperty("--primary-foreground","210 20% 10%"),t.style.setProperty("--secondary","210 20% 22%"),t.style.setProperty("--secondary-foreground","210 30% 96%"),t.style.setProperty("--muted","210 20% 22%"),t.style.setProperty("--muted-foreground","210 15% 60%"),t.style.setProperty("--accent","210 85% 42%"),t.style.setProperty("--accent-foreground","210 30% 96%"),t.style.setProperty("--destructive","0 50% 55%"),t.style.setProperty("--destructive-foreground","0 0% 100%"),t.style.setProperty("--border","210 20% 30%"),t.style.setProperty("--input","210 20% 30%"),t.style.setProperty("--ring","200 95% 42%"),t.setAttribute("data-theme","dark")):(t.style.setProperty("--background","0 0% 100%"),t.style.setProperty("--foreground","210 20% 10%"),t.style.setProperty("--card","0 0% 96%"),t.style.setProperty("--card-foreground","210 20% 10%"),t.style.setProperty("--popover","0 0% 100%"),t.style.setProperty("--popover-foreground","210 20% 10%"),t.style.setProperty("--primary","210 62% 49%"),t.style.setProperty("--primary-foreground","220 30% 15%"),t.style.setProperty("--secondary","210 12% 82%"),t.style.setProperty("--secondary-foreground","210 20% 10%"),t.style.setProperty("--muted","210 12% 82%"),t.style.setProperty("--muted-foreground","210 10% 45%"),t.style.setProperty("--accent","210 12% 82%"),t.style.setProperty("--accent-foreground","210 20% 10%"),t.style.setProperty("--destructive","0 55% 60%"),t.style.setProperty("--destructive-foreground","0 40% 20%"),t.style.setProperty("--border","210 16% 60%"),t.style.setProperty("--input","210 16% 60%"),t.style.setProperty("--ring","210 62% 49%"),t.removeAttribute("data-theme")),t.setAttribute("data-density",e.density),t.style.setProperty("--radius",`${e.borderRadius}px`),t.style.setProperty("--app-font-size",`${e.fontSize}px`),t.style.fontSize=`${e.fontSize}px`}class Bu{applyVariables(t){if(typeof window>"u"||!document.documentElement)return;const r=document.documentElement.style;t.density&&r.setProperty("--ui-density",t.density),t.tabletMode!==void 0&&r.setProperty("--tablet-mode",t.tabletMode?"1":"0"),t.radius!==void 0&&r.setProperty("--radius",`${t.radius}rem`),t.fontSize!==void 0&&r.setProperty("--font-size-base",`${t.fontSize}rem`),t.componentHeight!==void 0&&r.setProperty("--component-height",`${t.componentHeight}rem`),t.listRowHeight!==void 0&&r.setProperty("--list-row-height",`${t.listRowHeight}rem`),t.paddingX!==void 0&&r.setProperty("--padding-x",`${t.paddingX}rem`),t.paddingY!==void 0&&r.setProperty("--padding-y",`${t.paddingY}rem`),t.gap!==void 0&&r.setProperty("--gap",`${t.gap}rem`),t.iconSize!==void 0&&r.setProperty("--icon-size",`${t.iconSize}rem`),t.modalPadding!==void 0&&r.setProperty("--modal-padding",`${t.modalPadding}rem`),t.checkboxSize!==void 0&&r.setProperty("--checkbox-size",`${t.checkboxSize}rem`),t.buttonPaddingX!==void 0&&r.setProperty("--button-padding-x",`${t.buttonPaddingX}rem`),t.buttonPaddingY!==void 0&&r.setProperty("--button-padding-y",`${t.buttonPaddingY}rem`),t.badgePaddingX!==void 0&&r.setProperty("--badge-padding-x",`${t.badgePaddingX}rem`),t.badgePaddingY!==void 0&&r.setProperty("--badge-padding-y",`${t.badgePaddingY}rem`),t.cardPadding!==void 0&&r.setProperty("--card-padding",`${t.cardPadding}rem`),t.drawerWidthLeft!==void 0&&r.setProperty("--drawer-width-left",`${t.drawerWidthLeft}px`),t.drawerWidthRight!==void 0&&r.setProperty("--drawer-width-right",`${t.drawerWidthRight}px`),t.stepCircleSize!==void 0&&r.setProperty("--step-circle-size",`${t.stepCircleSize}rem`),t.switchWidth!==void 0&&r.setProperty("--switch-width",`${t.switchWidth}rem`),t.switchHeight!==void 0&&r.setProperty("--switch-height",`${t.switchHeight}rem`),t.switchThumbSize!==void 0&&r.setProperty("--switch-thumb-size",`${t.switchThumbSize}rem`),t.keypadButtonHeight!==void 0&&r.setProperty("--keypad-button-height",`${t.keypadButtonHeight}rem`)}removeVariables(){if(typeof window>"u"||!document.documentElement)return;const t=document.documentElement.style;t.removeProperty("--ui-density"),t.removeProperty("--tablet-mode"),t.removeProperty("--radius"),t.removeProperty("--font-size-base"),t.removeProperty("--component-height"),t.removeProperty("--list-row-height"),t.removeProperty("--padding-x"),t.removeProperty("--padding-y"),t.removeProperty("--gap"),t.removeProperty("--icon-size"),t.removeProperty("--modal-padding"),t.removeProperty("--checkbox-size"),t.removeProperty("--button-padding-x"),t.removeProperty("--button-padding-y"),t.removeProperty("--badge-padding-x"),t.removeProperty("--badge-padding-y"),t.removeProperty("--card-padding"),t.removeProperty("--drawer-width-left"),t.removeProperty("--drawer-width-right"),t.removeProperty("--step-circle-size"),t.removeProperty("--switch-width"),t.removeProperty("--switch-height"),t.removeProperty("--switch-thumb-size"),t.removeProperty("--keypad-button-height")}}class by{appliedConfig;applyVariables(t){this.appliedConfig=t}removeVariables(){this.appliedConfig=void 0}reset(){this.appliedConfig=void 0}}const Wu=new Bu,Uu=p.createContext(void 0);function wy(){return p.useContext(Uu)}function _y({config:e={},applier:t=Wu,children:r}){const n=p.useMemo(()=>e,[e]);return p.useEffect(()=>(t.applyVariables(n),()=>{t.removeVariables()}),[n,t]),o.jsx(Uu.Provider,{value:n,children:r})}const Sy=kr(["day","week","month"]),ky=Fe({name:Q(),email:Q().optional(),personnelId:Q().optional(),type:kr(["personnel","external"]).default("external")}),Zu=Fe({id:Q(),resourceId:Q().nullable().optional(),groupId:Q(),title:Q(),attendee:Q(),startDate:ke(),endDate:ke(),status:Q(),description:Q().optional(),note:Q().optional(),color:Q().optional(),isAllDay:qe().optional(),extendedProps:yc(Q(),Jd()).optional(),hasConflict:qe().optional(),createdAt:ke(),updatedAt:ke()}),Cy=Yt(Zu),Yu=Fe({id:Q(),name:Q(),order:we(),isAvailable:qe(),groupId:Q(),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),jy=Fe({id:Q(),name:Q(),displayMode:kr(["grid","list"]),dimension:we(),resources:Yt(Yu),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),Gu=Fe({id:Q().or(we()),label:Q(),startTime:Q(),endTime:Q()}),Dy=Fe({defaultDuration:we(),startTime:Q(),endTime:Q(),closedDays:Yt(we()),weekStartsOn:xs([Wt(0),Wt(1),Wt(2),Wt(3),Wt(4),Wt(5),Wt(6)]),timeZone:Q().optional(),timeSlots:Yt(Gu).optional(),paginationEnabled:qe().optional(),paginationPageSize:we().optional(),orientation:kr(["horizontal","vertical"]).optional(),slotInterval:we().optional()}),Ny=Fe({date:ke(),bookedCount:we(),maxSlots:we(),density:we(),isClosedDay:qe()}),Ey=Fe({enabled:qe().default(!1),pageSize:we().default(8)});function qu({personnel:e,position:t,onClose:r,onSetPriority:n}){const{t:s}=Le(),a=p.useRef(null);if(p.useEffect(()=>{const c=l=>{a.current&&!a.current.contains(l.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),!e||!t)return null;const i=[{label:s("personnel_priority_high"),priority:1,icon:"⬆️"},{label:s("personnel_priority_normal"),priority:0,icon:"➖"},{label:s("personnel_priority_low"),priority:-1,icon:"⬇️"}];return o.jsxs("div",{ref:a,className:"fixed bg-popover border border-border rounded-md shadow-lg py-[var(--ui-space-1)] z-50 min-w-[var(--ui-space-40)]",style:{left:t.x,top:t.y},children:[o.jsx("div",{className:"px-[var(--ui-space-3)] py-[var(--ui-space-1-5)] text-xs text-muted-foreground border-b border-border",children:e.name}),i.map(c=>o.jsxs("button",{type:"button",className:`w-full px-[var(--ui-space-3)] py-[var(--ui-space-2)] text-left text-sm hover:bg-muted flex items-center gap-[var(--ui-space-2)] transition-colors
|
|
90
|
+
`,style:O.color?{backgroundColor:O.color}:{},onClick:A=>{A.stopPropagation(),s?.(O)},onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),A.stopPropagation(),s?.(O))},children:l?.EventCard?o.jsx(l.EventCard,{event:O,viewMode:"week",isCompact:!0,onClick:()=>s?.(O)}):O.title},O.id))})},T.toISOString())})]}),o.jsx("div",{className:"flex-1 overflow-y-auto relative",ref:C,children:o.jsxs("div",{className:"flex",style:{minHeight:`${(b-p)*60/f*ft}px`},children:[o.jsx("div",{className:"w-[var(--ui-space-16)] flex-shrink-0 sticky left-[var(--ui-space-0)] z-20 bg-background border-r border-border",children:v.map(T=>o.jsx("div",{className:"border-b border-border text-xs text-muted-foreground p-0 flex items-center justify-end pr-[var(--ui-space-2)] box-border",style:{height:`${ft}px`},children:T},T))}),o.jsx("div",{className:"flex-1 flex",children:x.map((T,$)=>{const O=T.toDateString()===S,A=B[$];return o.jsxs("div",{className:"flex-1 border-r border-border last:border-r-0 relative min-w-[var(--ui-space-0)]",children:[o.jsx(rd,{interval:f,isToday:O,startHour:p,endHour:b,relative:!0,timeZone:y}),v.map(R=>o.jsx("button",{type:"button",onClick:()=>n?.(T,R),className:"border-b border-border cursor-pointer transition-colors hover:bg-muted/30 w-full text-left p-0 m-0 block box-border",style:{height:`${ft}px`},"aria-label":`Time slot ${R}`},`${T.toISOString()}-${R}`)),A?.events.map(({event:R,position:V,column:H,totalColumns:Q})=>o.jsx(ps,{event:R,position:V,column:H,totalColumns:Q,onEventClick:s,currentUserId:a,resources:i,renderEventContent:c,components:l,viewMode:"week",orientation:"horizontal"},R.id))]},T.toISOString())})})]})})]})})}function nd({events:e,settings:t,currentDate:r,viewMode:n,onDateChange:s,onViewChange:a,onEventClick:i,onEventDrop:c,onTimeSlotClick:l,onDateClick:u,isLoading:f=!1,className:d,headerLeft:h,headerRight:p,defaultView:b="week",enablePersistence:g=!1,storageKey:y="regular-calendar-view",storage:x=Fs,currentUserId:v,resources:k=[],renderEventContent:w,components:S}){const{t:C}=Fe(),[_,N]=m.useState(new Date),[I,M]=m.useState(()=>{if(g)try{const z=x.getItem(y);if(z&&["day","week","month"].includes(z))return z}catch(z){console.warn("Failed to load calendar view from storage",z)}return b}),B=r??_,E=n??I;m.useEffect(()=>{if(g&&!n)try{x.setItem(y,I)}catch(z){console.warn("Failed to save calendar view to storage",z)}},[I,g,y,n,x]);const F=z=>{const W=$s(B,E,z);s?s(W):N(W)},T=()=>{const z=new Date;s?s(z):N(z)},$=z=>{a?a(z):M(z)},O=(z,W)=>{const se=new Date(z);if(W){const[ne,fe]=W.split(":").map(Number);Number.isNaN(ne)||se.setHours(ne),Number.isNaN(fe)||se.setMinutes(fe)}l?.(se)},A=z=>{u&&u(z),s?s(z):N(z)},R=dv(uv(Po,{activationConstraint:{distance:8}})),[V,H]=m.useState(null),Q=z=>{const{active:W}=z,se=e.find(ne=>ne.id===W.id);se&&H(se)},Y=z=>{const{active:W,over:se}=z;if(H(null),!se||!c)return;const ne=e.find(Ze=>Ze.id===W.id);if(!ne)return;const fe=se.id,pe=new Date(fe);if(Number.isNaN(pe.getTime()))return;const Ae=fe.includes("T"),xe=new Date(pe);Ae||xe.setHours(ne.startDate.getHours(),ne.startDate.getMinutes()),c(ne,xe)};return o.jsxs(cy,{sensors:R,onDragStart:Q,onDragEnd:Y,children:[o.jsxs("div",{className:`flex flex-col h-full bg-background ${d}`,children:[o.jsxs("header",{className:"border-b border-border px-[var(--ui-space-4)] py-[var(--ui-space-3)] flex items-center justify-between gap-[var(--ui-space-4)]",children:[o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:[o.jsx(Xu,{currentDate:B,onNavigate:F,onToday:T}),h]}),o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-4)]",children:[o.jsx(Co,{currentView:E,onViewChange:$,options:[{value:"day",label:C("view_day")},{value:"week",label:C("view_week")},{value:"month",label:C("view_month")}]}),p]})]}),o.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[f&&o.jsx("div",{className:"absolute inset-[var(--ui-space-0)] bg-background/50 z-10 flex items-center justify-center",children:"Loading..."}),E==="day"&&o.jsx(Fy,{currentDate:B,events:e,settings:t,onEventClick:i,onTimeSlotClick:O,currentUserId:v,resources:k,renderEventContent:w,components:S}),E==="week"&&o.jsx(Vy,{currentDate:B,events:e,settings:t,onEventClick:i,onTimeSlotClick:O,currentUserId:v,resources:k,renderEventContent:w,components:S}),E==="month"&&o.jsx(Ly,{currentDate:B,events:e,settings:t,onEventClick:i,onDateClick:A,currentUserId:v,renderEventContent:w,components:S})]})]}),o.jsx(Ny,{children:V?o.jsx(Ty,{event:V,currentUserId:v,resources:k}):null})]})}function zy({events:e,resources:t,groups:r,settings:n,isLoading:s,onEventCreate:a,onEventUpdate:i,onEventDelete:c,onToast:l,customFields:u,personnel:f,currentUserId:d,i18n:h}){const[p,b]=m.useState(!1),[g,y]=m.useState(void 0),[x,v]=m.useState(void 0),k={...n,defaultDuration:30},w=e,S=M=>{v(M),y(void 0),b(!0)},C=M=>{y(M),v(void 0),b(!0)},_=()=>{b(!1),y(void 0),v(void 0)},N=async M=>{try{g?(await i(g.id,M),l?.("Event updated successfully","success")):(await a(M),l?.("Event created successfully","success")),_()}catch(B){console.error("Failed to save event",B),l?.("Failed to save event","error")}},I=async M=>{try{await c(M),l?.("Event deleted successfully","success"),_()}catch(B){console.error("Failed to delete event",B),l?.("Failed to delete event","error")}};return o.jsxs(o.Fragment,{children:[o.jsx(nd,{events:w,settings:k,isLoading:s,onEventClick:C,onTimeSlotClick:S,onDateClick:S,enablePersistence:!0,defaultView:"week",storageKey:"regular-calendar-view",currentUserId:d,resources:t}),o.jsx(Tu,{isOpen:p,onClose:_,onSave:N,onDelete:()=>{g?.id&&I(g.id)},event:g,defaultStartTime:x,resources:t,groups:r,events:e,personnel:f,currentUserId:d,customFields:u})]})}const ac=[...Array.from({length:24},(e,t)=>`${t.toString().padStart(2,"0")}:00`),"24:00","25:00","26:00","27:00","28:00","29:00","30:00"];function Hy({isOpen:e,onClose:t,settings:r,onUpdateSettings:n,onResetSettings:s}){const{t:a}=Fe();if(!e)return null;const i=l=>{n(l)},c=[a("days_short_sun"),a("days_short_mon"),a("days_short_tue"),a("days_short_wed"),a("days_short_thu"),a("days_short_fri"),a("days_short_sat")];return o.jsxs("div",{className:"fixed inset-[var(--ui-space-0)] z-[9999] flex items-center justify-center bg-black/50 p-[var(--ui-space-4)]",children:[o.jsx("button",{type:"button","aria-label":a("close"),onClick:t,className:"absolute inset-[var(--ui-space-0)] border-none bg-transparent p-[var(--ui-space-0)] m-[var(--ui-space-0)] w-full h-full cursor-default"}),o.jsxs("div",{className:"relative z-10 w-full max-w-[var(--ui-space-125)] max-h-[var(--ui-space-90vh)] overflow-y-auto rounded-lg border border-border bg-background text-foreground shadow-xl p-[var(--ui-space-6)]",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border pb-[var(--ui-space-4)] mb-[var(--ui-space-6)]",children:[o.jsx("h2",{className:"m-[var(--ui-space-0)] text-xl font-bold",children:a("settings_title")}),o.jsx(ae,{variant:"ghost",size:"icon",onClick:t,children:"✕"})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_language")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["ja","en"].map(l=>o.jsx(ae,{variant:r.language===l?"default":"outline",onClick:()=>i({language:l}),children:l==="ja"?"日本語":"English"},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("label",{htmlFor:"settings-timezone",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:"TimeZone"}),o.jsxs("select",{id:"settings-timezone",value:r.timeZone||"Asia/Tokyo",onChange:l=>i({timeZone:l.target.value}),className:"h-ui w-full rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[o.jsx("option",{value:"Asia/Tokyo",children:"Asia/Tokyo (JST)"}),o.jsx("option",{value:"UTC",children:"UTC"}),o.jsx("option",{value:"America/New_York",children:"America/New_York (ET)"}),o.jsx("option",{value:"Europe/London",children:"Europe/London (GMT/BST)"}),o.jsx("option",{value:"Asia/Shanghai",children:"Asia/Shanghai (CST)"})]})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_theme")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["light","dark"].map(l=>o.jsx(ae,{variant:r.theme===l?"default":"outline",onClick:()=>i({theme:l}),children:a(l==="light"?"option_light":"option_dark")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_density")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["compact","normal","spacious"].map(l=>o.jsx(ae,{variant:r.density===l?"default":"outline",onClick:()=>i({density:l}),children:a(l==="compact"?"option_compact":l==="normal"?"option_normal":"option_spacious")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_calendar_orientation","Calendar Orientation")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["horizontal","vertical"].map(l=>o.jsx(ae,{variant:r.calendarOrientation===l?"default":"outline",onClick:()=>i({calendarOrientation:l}),children:l==="horizontal"?a("option_horizontal","Horizontal"):a("option_vertical","Vertical")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_calendar_interval","Calendar Slot Interval")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:[15,30,60,120].map(l=>o.jsxs(ae,{variant:r.calendarSlotInterval===l?"default":"outline",onClick:()=>i({calendarSlotInterval:l}),children:[l===15&&a("option_15m","15m"),l===30&&a("option_30m","30m"),l===60&&a("option_1h","1h"),l===120&&a("option_2h","2h")]},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_facility_orientation","Facility Orientation")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:["horizontal","vertical"].map(l=>o.jsx(ae,{variant:r.facilityOrientation===l?"default":"outline",onClick:()=>i({facilityOrientation:l}),children:l==="horizontal"?a("option_horizontal","Horizontal"):a("option_vertical","Vertical")},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_facility_interval","Facility Slot Interval")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:[15,30,60,120].map(l=>o.jsxs(ae,{variant:r.facilitySlotInterval===l?"default":"outline",onClick:()=>i({facilitySlotInterval:l}),children:[l===15&&a("option_15m","15m"),l===30&&a("option_30m","30m"),l===60&&a("option_1h","1h"),l===120&&a("option_2h","2h")]},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsxs("label",{htmlFor:"settings-radius",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:[a("settings_radius"),": ",r.borderRadius,"px"]}),o.jsx("input",{id:"settings-radius",type:"range",min:"0",max:"16",value:r.borderRadius,onChange:l=>i({borderRadius:Number(l.target.value)}),className:"w-full cursor-pointer"})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsxs("label",{htmlFor:"settings-font-size",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:[a("settings_font_size"),": ",r.fontSize,"px"]}),o.jsx("input",{id:"settings-font-size",type:"range",min:"12",max:"20",value:r.fontSize,onChange:l=>i({fontSize:Number(l.target.value)}),className:"w-full cursor-pointer"})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("label",{htmlFor:"settings-week-start",className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_week_start")}),o.jsxs("select",{id:"settings-week-start",value:r.weekStartsOn,onChange:l=>i({weekStartsOn:Number(l.target.value)}),className:"h-ui w-full rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[o.jsx("option",{value:0,children:a("option_sunday")}),o.jsx("option",{value:1,children:a("option_monday")})]})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_business_hours")}),o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:[o.jsx("select",{value:r.businessHoursStart,onChange:l=>i({businessHoursStart:l.target.value}),className:"h-ui flex-1 rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:ac.map(l=>o.jsx("option",{value:l,children:l},l))}),o.jsx("span",{children:"〜"}),o.jsx("select",{value:r.businessHoursEnd,onChange:l=>i({businessHoursEnd:l.target.value}),className:"h-ui flex-1 rounded-md border border-input bg-background px-[var(--ui-space-3)] py-[var(--ui-space-1)] text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:ac.map(l=>o.jsx("option",{value:l,children:l},l))})]})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsx("div",{className:"block mb-[var(--ui-space-2)] text-sm font-bold",children:a("settings_closed_days")}),o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-2)]",children:c.map((l,u)=>o.jsx(ae,{variant:r.closedDays.includes(u)?"destructive":"outline",size:"sm",onClick:()=>{const f=r.closedDays.includes(u)?r.closedDays.filter(d=>d!==u):[...r.closedDays,u];i({closedDays:f})},className:"w-[var(--ui-space-10)] h-[var(--ui-space-10)] p-[var(--ui-space-0)]",children:l},l))})]}),o.jsxs("div",{className:"mb-[var(--ui-space-6)]",children:[o.jsxs("div",{className:"flex items-center justify-between mb-[var(--ui-space-2)]",children:[o.jsx("div",{className:"text-sm font-bold",children:a("settings_pagination")}),o.jsx("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:o.jsx(ae,{variant:r.paginationEnabled?"default":"outline",onClick:()=>i({paginationEnabled:!r.paginationEnabled}),children:r.paginationEnabled?"ON":"OFF"})})]}),r.paginationEnabled&&o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-4)]",children:[o.jsxs("label",{htmlFor:"settings-page-size",className:"text-sm whitespace-nowrap",children:[a("settings_page_size"),": ",r.paginationPageSize]}),o.jsx("input",{id:"settings-page-size",type:"range",min:"4",max:"20",step:"1",value:r.paginationPageSize,onChange:l=>i({paginationPageSize:Number(l.target.value)}),className:"w-full cursor-pointer"})]})]}),s&&o.jsx("div",{className:"mt-[var(--ui-space-8)] border-t border-border pt-[var(--ui-space-4)]",children:o.jsx(ae,{variant:"outline",className:"w-full text-destructive hover:bg-destructive/10 hover:border-destructive h-ui",onClick:s,children:"Reset All Settings"})})]})]})}function By(e,t=document.documentElement){e.theme==="dark"?(t.style.setProperty("--background","210 20% 10%"),t.style.setProperty("--foreground","210 30% 96%"),t.style.setProperty("--card","210 20% 16%"),t.style.setProperty("--card-foreground","210 30% 96%"),t.style.setProperty("--popover","210 20% 10%"),t.style.setProperty("--popover-foreground","210 30% 96%"),t.style.setProperty("--primary","200 95% 42%"),t.style.setProperty("--primary-foreground","210 20% 10%"),t.style.setProperty("--secondary","210 20% 22%"),t.style.setProperty("--secondary-foreground","210 30% 96%"),t.style.setProperty("--muted","210 20% 22%"),t.style.setProperty("--muted-foreground","210 15% 60%"),t.style.setProperty("--accent","210 85% 42%"),t.style.setProperty("--accent-foreground","210 30% 96%"),t.style.setProperty("--destructive","0 50% 55%"),t.style.setProperty("--destructive-foreground","0 0% 100%"),t.style.setProperty("--border","210 20% 30%"),t.style.setProperty("--input","210 20% 30%"),t.style.setProperty("--ring","200 95% 42%"),t.setAttribute("data-theme","dark")):(t.style.setProperty("--background","0 0% 100%"),t.style.setProperty("--foreground","210 20% 10%"),t.style.setProperty("--card","0 0% 96%"),t.style.setProperty("--card-foreground","210 20% 10%"),t.style.setProperty("--popover","0 0% 100%"),t.style.setProperty("--popover-foreground","210 20% 10%"),t.style.setProperty("--primary","210 62% 49%"),t.style.setProperty("--primary-foreground","220 30% 15%"),t.style.setProperty("--secondary","210 12% 82%"),t.style.setProperty("--secondary-foreground","210 20% 10%"),t.style.setProperty("--muted","210 12% 82%"),t.style.setProperty("--muted-foreground","210 10% 45%"),t.style.setProperty("--accent","210 12% 82%"),t.style.setProperty("--accent-foreground","210 20% 10%"),t.style.setProperty("--destructive","0 55% 60%"),t.style.setProperty("--destructive-foreground","0 40% 20%"),t.style.setProperty("--border","210 16% 60%"),t.style.setProperty("--input","210 16% 60%"),t.style.setProperty("--ring","210 62% 49%"),t.removeAttribute("data-theme")),t.setAttribute("data-density",e.density),t.style.setProperty("--radius",`${e.borderRadius}px`),t.style.setProperty("--app-font-size",`${e.fontSize}px`),t.style.fontSize=`${e.fontSize}px`}class sd{applyVariables(t){if(typeof window>"u"||!document.documentElement)return;const r=document.documentElement.style;t.density&&r.setProperty("--ui-density",t.density),t.tabletMode!==void 0&&r.setProperty("--tablet-mode",t.tabletMode?"1":"0"),t.radius!==void 0&&r.setProperty("--radius",`${t.radius}rem`),t.fontSize!==void 0&&r.setProperty("--font-size-base",`${t.fontSize}rem`),t.componentHeight!==void 0&&r.setProperty("--component-height",`${t.componentHeight}rem`),t.listRowHeight!==void 0&&r.setProperty("--list-row-height",`${t.listRowHeight}rem`),t.paddingX!==void 0&&r.setProperty("--padding-x",`${t.paddingX}rem`),t.paddingY!==void 0&&r.setProperty("--padding-y",`${t.paddingY}rem`),t.gap!==void 0&&r.setProperty("--gap",`${t.gap}rem`),t.iconSize!==void 0&&r.setProperty("--icon-size",`${t.iconSize}rem`),t.modalPadding!==void 0&&r.setProperty("--modal-padding",`${t.modalPadding}rem`),t.checkboxSize!==void 0&&r.setProperty("--checkbox-size",`${t.checkboxSize}rem`),t.buttonPaddingX!==void 0&&r.setProperty("--button-padding-x",`${t.buttonPaddingX}rem`),t.buttonPaddingY!==void 0&&r.setProperty("--button-padding-y",`${t.buttonPaddingY}rem`),t.badgePaddingX!==void 0&&r.setProperty("--badge-padding-x",`${t.badgePaddingX}rem`),t.badgePaddingY!==void 0&&r.setProperty("--badge-padding-y",`${t.badgePaddingY}rem`),t.cardPadding!==void 0&&r.setProperty("--card-padding",`${t.cardPadding}rem`),t.drawerWidthLeft!==void 0&&r.setProperty("--drawer-width-left",`${t.drawerWidthLeft}px`),t.drawerWidthRight!==void 0&&r.setProperty("--drawer-width-right",`${t.drawerWidthRight}px`),t.stepCircleSize!==void 0&&r.setProperty("--step-circle-size",`${t.stepCircleSize}rem`),t.switchWidth!==void 0&&r.setProperty("--switch-width",`${t.switchWidth}rem`),t.switchHeight!==void 0&&r.setProperty("--switch-height",`${t.switchHeight}rem`),t.switchThumbSize!==void 0&&r.setProperty("--switch-thumb-size",`${t.switchThumbSize}rem`),t.keypadButtonHeight!==void 0&&r.setProperty("--keypad-button-height",`${t.keypadButtonHeight}rem`)}removeVariables(){if(typeof window>"u"||!document.documentElement)return;const t=document.documentElement.style;t.removeProperty("--ui-density"),t.removeProperty("--tablet-mode"),t.removeProperty("--radius"),t.removeProperty("--font-size-base"),t.removeProperty("--component-height"),t.removeProperty("--list-row-height"),t.removeProperty("--padding-x"),t.removeProperty("--padding-y"),t.removeProperty("--gap"),t.removeProperty("--icon-size"),t.removeProperty("--modal-padding"),t.removeProperty("--checkbox-size"),t.removeProperty("--button-padding-x"),t.removeProperty("--button-padding-y"),t.removeProperty("--badge-padding-x"),t.removeProperty("--badge-padding-y"),t.removeProperty("--card-padding"),t.removeProperty("--drawer-width-left"),t.removeProperty("--drawer-width-right"),t.removeProperty("--step-circle-size"),t.removeProperty("--switch-width"),t.removeProperty("--switch-height"),t.removeProperty("--switch-thumb-size"),t.removeProperty("--keypad-button-height")}}class Wy{appliedConfig;applyVariables(t){this.appliedConfig=t}removeVariables(){this.appliedConfig=void 0}reset(){this.appliedConfig=void 0}}const ad=new sd,od=m.createContext(void 0);function Uy(){return m.useContext(od)}function Zy({config:e={},applier:t=ad,children:r}){const n=m.useMemo(()=>e,[e]);return m.useEffect(()=>(t.applyVariables(n),()=>{t.removeVariables()}),[n,t]),o.jsx(od.Provider,{value:n,children:r})}const Gy=Xt(["day","week","month"]),Yy=Oe({name:q(),email:q().optional(),personnelId:q().optional(),type:Xt(["personnel","external"]).default("external")}),id=Oe({id:q(),resourceId:q().nullable().optional(),groupId:q(),title:q(),attendee:q(),startDate:ke(),endDate:ke(),status:q(),description:q().optional(),note:q().optional(),color:q().optional(),isAllDay:Ke().optional(),extendedProps:Ua(q(),Sf()).optional(),hasConflict:Ke().optional(),createdAt:ke(),updatedAt:ke()}),Ky=Vt(id),cd=Oe({id:q(),name:q(),order:we(),isAvailable:Ke(),groupId:q(),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),qy=Oe({id:q(),name:q(),displayMode:Xt(["grid","list"]),dimension:we(),resources:Vt(cd),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),ld=Oe({id:q().or(we()),label:q(),startTime:q(),endTime:q()}),Xy=Oe({defaultDuration:we(),startTime:q(),endTime:q(),closedDays:Vt(we()),weekStartsOn:_s([Ut(0),Ut(1),Ut(2),Ut(3),Ut(4),Ut(5),Ut(6)]),timeZone:q().optional(),timeSlots:Vt(ld).optional(),paginationEnabled:Ke().optional(),paginationPageSize:we().optional(),orientation:Xt(["horizontal","vertical"]).optional(),slotInterval:we().optional()}),Jy=Oe({date:ke(),bookedCount:we(),maxSlots:we(),density:we(),isClosedDay:Ke()}),Qy=Oe({enabled:Ke().default(!1),pageSize:we().default(8)});function ud({personnel:e,position:t,onClose:r,onSetPriority:n}){const{t:s}=Fe(),a=m.useRef(null);if(m.useEffect(()=>{const c=l=>{a.current&&!a.current.contains(l.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),!e||!t)return null;const i=[{label:s("personnel_priority_high"),priority:1,icon:"⬆️"},{label:s("personnel_priority_normal"),priority:0,icon:"➖"},{label:s("personnel_priority_low"),priority:-1,icon:"⬇️"}];return o.jsxs("div",{ref:a,className:"fixed bg-popover border border-border rounded-md shadow-lg py-[var(--ui-space-1)] z-50 min-w-[var(--ui-space-40)]",style:{left:t.x,top:t.y},children:[o.jsx("div",{className:"px-[var(--ui-space-3)] py-[var(--ui-space-1-5)] text-xs text-muted-foreground border-b border-border",children:e.name}),i.map(c=>o.jsxs("button",{type:"button",className:`w-full px-[var(--ui-space-3)] py-[var(--ui-space-2)] text-left text-sm hover:bg-muted flex items-center gap-[var(--ui-space-2)] transition-colors
|
|
91
91
|
${e.priority===c.priority?"text-primary font-medium":"text-foreground"}
|
|
92
|
-
`,onClick:()=>{n(e.id,c.priority),r()},children:[o.jsx("span",{children:c.icon}),o.jsx("span",{children:c.label}),e.priority===c.priority&&o.jsx("span",{className:"ml-auto text-primary",children:"✓"})]},c.priority))]})}function Ay({personnel:e,selectedIds:t,onSelectionChange:r,onPriorityChange:n,className:s="",colorMap:a=new Map}){const{t:i}=Le(),[c,l]=p.useState(""),[u,f]=p.useState(!1),[d,h]=p.useState({personnel:null,position:null}),m=p.useMemo(()=>{const _=new Set(e.map(w=>w.department).filter(Boolean));return Array.from(_).sort()},[e]),b=p.useMemo(()=>{if(!c.trim())return e;const _=c.toLowerCase();return e.filter(w=>w.name.toLowerCase().includes(_)||w.department?.toLowerCase().includes(_))},[e,c]),g=p.useMemo(()=>{const _=b.filter(k=>k.priority===1),w=b.filter(k=>k.priority===0),S=b.filter(k=>k.priority===-1);return{high:_,normal:w,low:S}},[b]),y=_=>{t.includes(_)?r(t.filter(w=>w!==_)):r([...t,_])},x=(_,w)=>{_.preventDefault(),h({personnel:w,position:{x:_.clientX,y:_.clientY}})},v=_=>{const w=t.includes(_.id),S=a.get(_.id);return o.jsxs("button",{type:"button",className:`flex items-center gap-[var(--ui-space-2)] px-[var(--ui-space-2)] py-[var(--ui-space-1-5)] rounded cursor-pointer text-sm transition-colors w-full ${w?"border":"hover:bg-muted/50 border border-transparent"}`,style:w&&S?{backgroundColor:`${S}20`,borderColor:S}:{},onClick:()=>y(_.id),onContextMenu:k=>x(k,_),children:[w&&S?o.jsx("div",{className:"w-[var(--ui-space-3)] h-[var(--ui-space-3)] rounded-full flex-shrink-0",style:{backgroundColor:S}}):o.jsx("div",{className:"w-[var(--ui-space-3)] h-[var(--ui-space-3)] rounded-full flex-shrink-0 bg-transparent"}),o.jsxs("div",{className:"flex-1 min-w-[var(--ui-space-0)] text-left",children:[o.jsx("div",{className:"truncate font-medium",children:_.name}),o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_.department})]}),_.priority===1&&o.jsx("span",{className:"text-xs",title:i("personnel_priority_high"),children:"⬆️"}),_.priority===-1&&o.jsx("span",{className:"text-xs",title:i("personnel_priority_low"),children:"⬇️"})]},_.id)};return o.jsxs("div",{className:`flex flex-col h-full bg-background border-r border-border ${s}`,children:[o.jsxs("div",{className:"p-[var(--ui-space-2)] border-b border-border space-y-[var(--ui-space-2)]",children:[o.jsx("div",{className:"text-sm font-semibold",children:i("personnel_list_title")}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",placeholder:i("personnel_search_placeholder"),value:c,onChange:_=>l(_.target.value),onFocus:()=>f(!0),onBlur:()=>setTimeout(()=>f(!1),200),className:"w-full px-[var(--ui-space-2)] py-[var(--ui-space-1-5)] text-sm border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary"}),u&&o.jsx("div",{className:"absolute top-full left-0 w-full mt-1 bg-popover border border-border rounded shadow-lg z-50 max-h-48 overflow-y-auto",children:o.jsx("div",{className:"p-1",children:(()=>{if(!c.trim())return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground",children:i("personnel_all_departments")}),m.map(k=>o.jsx("button",{type:"button",className:"w-full text-left px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground rounded-sm cursor-pointer",onClick:()=>l(k),children:k},k))]});const _=c.toLowerCase(),w=e.filter(k=>k.name.toLowerCase().includes(_));if(w.length>0)return w.map(k=>o.jsxs("button",{type:"button",className:"w-full text-left px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground rounded-sm cursor-pointer",onClick:()=>l(k.name),children:[o.jsx("span",{className:"font-medium",children:k.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["(",k.department,")"]})]},k.id));const S=m.filter(k=>k.toLowerCase().includes(_));return S.length>0?S.map(k=>o.jsx("button",{type:"button",className:"w-full text-left px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground rounded-sm cursor-pointer",onClick:()=>l(k),children:k},k)):o.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground text-center",children:i("personnel_no_results")})})()})})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-[var(--ui-space-1)]",children:[g.high.length>0&&o.jsxs("div",{className:"mb-[var(--ui-space-2)]",children:[o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-1)] text-xs font-semibold text-muted-foreground",children:i("personnel_priority_high")}),g.high.map(v)]}),g.normal.length>0&&o.jsxs("div",{className:"mb-[var(--ui-space-2)]",children:[g.high.length>0&&o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-1)] text-xs font-semibold text-muted-foreground",children:i("personnel_priority_normal")}),g.normal.map(v)]}),g.low.length>0&&o.jsxs("div",{className:"mb-[var(--ui-space-2)]",children:[o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-1)] text-xs font-semibold text-muted-foreground",children:i("personnel_priority_low")}),g.low.map(v)]}),b.length===0&&o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-4)] text-center text-sm text-muted-foreground",children:i("personnel_no_results")})]}),o.jsx("div",{className:"p-[var(--ui-space-2)] border-t border-border text-xs text-muted-foreground",children:t.length>0?i("personnel_selected_count",{count:t.length,defaultValue:`${t.length} selected`}):i("personnel_context_hint")}),o.jsx(qu,{personnel:d.personnel,position:d.position,onClose:()=>h({personnel:null,position:null}),onSetPriority:n})]})}function Ty({children:e,defaultWidth:t=256,minWidth:r=180,maxWidth:n=400,storageKey:s,storage:a=Ms,className:i=""}){const[c,l]=p.useState(()=>{if(s){const h=a.getItem(s);if(h){const m=parseInt(h,10);if(!Number.isNaN(m)&&m>=r&&m<=n)return m}}return t}),u=p.useRef(!1),f=p.useRef(null);p.useEffect(()=>{s&&a.setItem(s,String(c))},[c,s,a]);const d=p.useCallback(h=>{h.preventDefault(),u.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);return p.useEffect(()=>{const h=b=>{if(!u.current||!f.current)return;const g=f.current.getBoundingClientRect(),y=b.clientX-g.left;y>=r&&y<=n&&l(y)},m=()=>{u.current&&(u.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",h),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m)}},[r,n]),o.jsxs("div",{ref:f,className:`relative flex-shrink-0 ${i}`,style:{width:c},children:[e,o.jsx("button",{type:"button","aria-label":"Resize",className:"absolute right-[var(--ui-space-0)] top-[var(--ui-space-0)] bottom-[var(--ui-space-0)] w-[var(--ui-space-1)] cursor-col-resize hover:bg-primary/30 active:bg-primary/50 transition-colors z-10",onMouseDown:d})]})}const Ry=kr(["day","week","month"]),Xu=kr(["horizontal","vertical"]),Ku=Fe({id:Q(),resourceId:Q(),groupId:Q(),title:Q(),attendee:Q(),startDate:ke(),endDate:ke(),status:Q(),description:Q().optional(),note:Q().optional(),color:Q().optional(),extendedProps:yc(Q(),vc()).optional(),isAllDay:qe().optional(),hasConflict:qe().optional(),createdAt:ke(),updatedAt:ke()}),Py=Yt(Ku),Ju=Fe({id:Q(),name:Q(),order:we(),isAvailable:qe(),groupId:Q(),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),My=Fe({id:Q(),name:Q(),displayMode:kr(["grid","list"]),dimension:we(),resources:Yt(Ju),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),Qu=Fe({id:Q().or(we()),label:Q(),startTime:Q(),endTime:Q()}),Oy=Fe({defaultDuration:we(),startTime:Q(),endTime:Q(),closedDays:Yt(we()),weekStartsOn:xs([Wt(0),Wt(1)]),timeZone:Q().optional(),businessHoursStart:Q().optional(),businessHoursEnd:Q().optional(),timeSlots:Yt(Qu).optional(),orientation:Xu.optional(),slotInterval:we().optional()}),Iy=Fe({date:ke(),bookedCount:we(),maxSlots:we(),density:we(),isClosedDay:qe()}),$y=Object.freeze(Object.defineProperty({__proto__:null,CalendarOrientationSchema:Xu,DensityDataSchema:Iy,FacilityScheduleSettingsSchema:Oy,ResourceGroupSchema:My,ResourceSchema:Ju,ScheduleEventArraySchema:Py,ScheduleEventSchema:Ku,TimeSlotSchema:Qu,ViewModeSchema:Ry},Symbol.toStringTag,{value:"Module"})),Fy={theme:"light",density:"normal",borderRadius:8,fontSize:16,weekStartsOn:1,businessHoursStart:"08:00",businessHoursEnd:"18:00",closedDays:[0,6],language:"ja",timeZone:"Asia/Tokyo",paginationEnabled:!1,paginationPageSize:8,calendarOrientation:"horizontal",facilityOrientation:"horizontal",calendarSlotInterval:60,facilitySlotInterval:60};exports.AttendeeInfoSchema=ky;exports.AttendeeInput=Na;exports.BrowserStorage=au;exports.Button=oe;exports.Checkbox=hn;exports.ConfirmModal=io;exports.DEFAULT_SETTINGS=Fy;exports.DOMThemeApplier=Bu;exports.DateDisplay=It;exports.DatePicker=ro;exports.DefaultEventModal=vu;exports.DensityDataSchema=Ny;exports.EventForm=Jl;exports.EventModal=po;exports.FacilitySchedule=iu;exports.FacilityScheduleManager=_g;exports.FacilityScheduleSettingsSchema=Dy;exports.FacilityStructureSettings=Sg;exports.Form=no;exports.FormControl=be;exports.FormField=Re;exports.FormItem=De;exports.FormLabel=_e;exports.FormMessage=nt;exports.Icons=ye;exports.InMemoryStorage=vg;exports.Input=bt;exports.KeypadModal=As;exports.MockThemeApplier=by;exports.Modal=qr;exports.PERSONNEL_COLORS=Sa;exports.PaginationOptionsSchema=Ey;exports.PersonnelContextMenu=qu;exports.PersonnelPanel=Ay;exports.RegularCalendar=Hu;exports.RegularCalendarSchema=$y;exports.ResizablePanel=Ty;exports.ResourceGroupSchema=jy;exports.ResourceSchema=Yu;exports.ScheduleEventArraySchema=Cy;exports.ScheduleEventSchema=Zu;exports.ScheduleManager=vy;exports.ScheduleProvider=Kp;exports.Select=Ut;exports.SelectContent=Ot;exports.SelectItem=at;exports.SelectTrigger=Pt;exports.SelectValue=Mt;exports.SettingsModal=yy;exports.Textarea=gn;exports.ThemeProvider=_y;exports.TimeSlotSchema=Gu;exports.ViewModeSchema=Sy;exports.ViewSelector=vo;exports.applyThemeSettings=xy;exports.buttonVariants=on;exports.calculateViewRange=Xl;exports.checkScheduleConflict=co;exports.cleanEventId=xg;exports.createPersonnelColorMap=yg;exports.defaultStorage=Ms;exports.defaultThemeApplier=Wu;exports.detectAndMarkConflicts=Yp;exports.filterEventsByDateRange=Rs;exports.filterEventsByDay=Hp;exports.filterEventsByResource=_a;exports.formatCalendarDate=Ne;exports.formatEventTitleWithAttendees=cu;exports.generateDateRange=uo;exports.getEventDisplayText=Up;exports.getEventDuration=Wp;exports.getMonthEnd=ql;exports.getMonthStart=mo;exports.getPersonnelColor=xo;exports.getResourceAvailability=Yl;exports.getToday=gg;exports.getWeekEnd=ho;exports.getWeekStart=Ps;exports.hasTimeOverlap=Ts;exports.mergeEvents=bg;exports.navigateDate=yo;exports.normalizeWeekStartsOn=fo;exports.parseAttendeeNames=lu;exports.parseAttendees=Wl;exports.prepareEventFormData=gu;exports.resolveEventOwnerId=uu;exports.sortEventsByTime=lo;exports.sortResourcesByOrder=Bp;exports.stringifyAttendees=Ul;exports.transformBookingsToEvents=du;exports.useAttendeeManagement=Zl;exports.useAvailableResources=mu;exports.useConflictCheck=hu;exports.useEventForm=fu;exports.useFormField=Ns;exports.useResourceAvailability=Gl;exports.useResourceDisplayNames=pu;exports.useScheduleConflict=Kl;exports.useScheduleContext=eu;exports.useScheduleData=nu;exports.useScheduleEventHandlers=su;exports.useScheduleView=ou;exports.useTheme=wy;
|
|
92
|
+
`,onClick:()=>{n(e.id,c.priority),r()},children:[o.jsx("span",{children:c.icon}),o.jsx("span",{children:c.label}),e.priority===c.priority&&o.jsx("span",{className:"ml-auto text-primary",children:"✓"})]},c.priority))]})}const dd=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();const ex=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const tx=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase());const oc=e=>{const t=tx(e);return t.charAt(0).toUpperCase()+t.slice(1)};var rx={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 nx=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const sx=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:i,...c},l)=>m.createElement("svg",{ref:l,...rx,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:dd("lucide",s),...!a&&!nx(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,f])=>m.createElement(u,f)),...Array.isArray(a)?a:[a]]));const fd=(e,t)=>{const r=m.forwardRef(({className:n,...s},a)=>m.createElement(sx,{ref:a,iconNode:t,className:dd(`lucide-${ex(oc(e))}`,`lucide-${e}`,n),...s}));return r.displayName=oc(e),r};const ax=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ox=fd("chevron-down",ax);const ix=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],cx=fd("funnel",ix);function hd({personnel:e,selectedIds:t,onSelectionChange:r,onPriorityChange:n,className:s="",colorMap:a=new Map,filterType:i="select"}){const{t:c}=Fe(),[l,u]=m.useState(""),[f,d]=m.useState(!1),[h,p]=m.useState(new Set),[b,g]=m.useState({personnel:null,position:null}),y=m.useMemo(()=>{const _=new Set(e.map(N=>N.department).filter(Boolean));return Array.from(_).sort()},[e]),x=m.useMemo(()=>{if(!l.trim()&&h.size===0)return e;const _=l.toLowerCase();return e.filter(N=>h.size>0&&!h.has(N.department)?!1:l.trim()?N.name.toLowerCase().includes(_)||N.department?.toLowerCase().includes(_):!0)},[e,l,h]),v=m.useMemo(()=>{const _=x.filter(M=>M.priority===1),N=x.filter(M=>M.priority===0),I=x.filter(M=>M.priority===-1);return{high:_,normal:N,low:I}},[x]),k=_=>{t.includes(_)?r(t.filter(N=>N!==_)):r([...t,_])},w=_=>{p(N=>{const I=new Set(N);return I.has(_)?I.delete(_):I.add(_),I})},S=(_,N)=>{_.preventDefault(),g({personnel:N,position:{x:_.clientX,y:_.clientY}})},C=_=>{const N=t.includes(_.id),I=a.get(_.id);return o.jsxs("button",{type:"button",className:`flex items-center gap-[var(--ui-space-2)] px-[var(--ui-space-2)] py-[var(--ui-space-1-5)] rounded cursor-pointer text-sm transition-colors w-full ${N?"border":"hover:bg-muted/50 border border-transparent"}`,style:N&&I?{backgroundColor:`${I}20`,borderColor:I}:{},onClick:()=>k(_.id),onContextMenu:M=>S(M,_),children:[N&&I?o.jsx("div",{className:"w-[var(--ui-space-3)] h-[var(--ui-space-3)] rounded-full flex-shrink-0",style:{backgroundColor:I}}):o.jsx("div",{className:"w-[var(--ui-space-3)] h-[var(--ui-space-3)] rounded-full flex-shrink-0 bg-transparent"}),o.jsxs("div",{className:"flex-1 min-w-[var(--ui-space-0)] text-left",children:[o.jsx("div",{className:"truncate font-medium",children:_.name}),o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_.department})]}),_.priority===1&&o.jsx("span",{className:"text-xs",title:c("personnel_priority_high"),children:"⬆️"}),_.priority===-1&&o.jsx("span",{className:"text-xs",title:c("personnel_priority_low"),children:"⬇️"})]},_.id)};return o.jsxs("div",{className:`flex flex-col h-full bg-background ${s}`,children:[o.jsxs("div",{className:"flex flex-col gap-[var(--ui-space-2)] px-[var(--ui-space-4)] border-b border-border",children:[o.jsx("div",{className:"text-sm font-semibold",children:c("personnel_list_title")}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",placeholder:c("personnel_search_placeholder"),value:l,onChange:_=>u(_.target.value),onFocus:()=>d(!0),onBlur:()=>setTimeout(()=>d(!1),200),className:"w-full px-[var(--ui-space-2)] py-[var(--ui-space-1-5)] text-sm border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary"}),f&&o.jsx("div",{className:"absolute top-full left-0 w-full mt-1 bg-popover border border-border rounded shadow-lg z-50 max-h-48 overflow-y-auto",children:o.jsx("div",{className:"p-1",children:(()=>{if(!l.trim())return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground",children:c("personnel_all_departments")}),y.map(M=>o.jsx("button",{type:"button",className:"w-full text-left px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground rounded-sm cursor-pointer",onClick:()=>u(M),children:M},M))]});const _=l.toLowerCase(),N=e.filter(M=>M.name.toLowerCase().includes(_));if(N.length>0)return N.map(M=>o.jsxs("button",{type:"button",className:"w-full text-left px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground rounded-sm cursor-pointer",onClick:()=>u(M.name),children:[o.jsx("span",{className:"font-medium",children:M.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["(",M.department,")"]})]},M.id));const I=y.filter(M=>M.toLowerCase().includes(_));return I.length>0?I.map(M=>o.jsx("button",{type:"button",className:"w-full text-left px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground rounded-sm cursor-pointer",onClick:()=>u(M),children:M},M)):o.jsx("div",{className:"px-2 py-2 text-sm text-muted-foreground text-center",children:c("personnel_no_results")})})()})})]}),y.length>0&&(i==="select"?o.jsxs("div",{className:"relative",children:[o.jsx(cx,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground pointer-events-none"}),o.jsxs("select",{value:Array.from(h)[0]||"",onChange:_=>{const N=_.target.value,I=new Set;N&&I.add(N),p(I)},className:"w-full pl-7 pr-8 py-1.5 text-sm border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary appearance-none cursor-pointer",children:[o.jsx("option",{value:"",children:c("personnel_all_professions")}),y.map(_=>o.jsx("option",{value:_,children:_},_))]}),o.jsx(ox,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"})]}):o.jsx("div",{className:"flex flex-wrap gap-[var(--ui-space-1)] max-h-[var(--ui-space-20)] overflow-auto",children:y.map(_=>{const N=h.has(_);return o.jsx("button",{type:"button",className:`text-xs px-[var(--ui-space-2)] py-[var(--ui-space-1)] rounded border cursor-pointer ${N?"bg-primary text-primary-foreground border-primary":"bg-background border-border hover:bg-muted/40"}`,onClick:()=>w(_),children:_},_)})}))]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-[var(--ui-space-2)] py-[var(--ui-space-2)]",children:[v.high.length>0&&o.jsxs("div",{className:"mb-[var(--ui-space-2)]",children:[o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-1)] text-xs font-semibold text-muted-foreground",children:c("personnel_priority_high")}),v.high.map(C)]}),v.normal.length>0&&o.jsxs("div",{className:"mb-[var(--ui-space-2)]",children:[v.high.length>0&&o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-1)] text-xs font-semibold text-muted-foreground",children:c("personnel_priority_normal")}),v.normal.map(C)]}),v.low.length>0&&o.jsxs("div",{className:"mb-[var(--ui-space-2)]",children:[o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-1)] text-xs font-semibold text-muted-foreground",children:c("personnel_priority_low")}),v.low.map(C)]}),x.length===0&&o.jsx("div",{className:"px-[var(--ui-space-2)] py-[var(--ui-space-4)] text-center text-sm text-muted-foreground",children:c("personnel_no_results")})]}),o.jsx(ud,{personnel:b.personnel,position:b.position,onClose:()=>g({personnel:null,position:null}),onSetPriority:n})]})}function lx({children:e,defaultWidth:t=256,minWidth:r=180,maxWidth:n=400,storageKey:s,storage:a=Fs,className:i=""}){const[c,l]=m.useState(()=>{if(s){const h=a.getItem(s);if(h){const p=parseInt(h,10);if(!Number.isNaN(p)&&p>=r&&p<=n)return p}}return t}),u=m.useRef(!1),f=m.useRef(null);m.useEffect(()=>{s&&a.setItem(s,String(c))},[c,s,a]);const d=m.useCallback(h=>{h.preventDefault(),u.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);return m.useEffect(()=>{const h=b=>{if(!u.current||!f.current)return;const g=f.current.getBoundingClientRect(),y=b.clientX-g.left;y>=r&&y<=n&&l(y)},p=()=>{u.current&&(u.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",h),document.addEventListener("mouseup",p),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",p)}},[r,n]),o.jsxs("div",{ref:f,className:`relative flex-shrink-0 ${i}`,style:{width:c},children:[e,o.jsx("button",{type:"button","aria-label":"Resize",className:"absolute right-[var(--ui-space-0)] top-[var(--ui-space-0)] bottom-[var(--ui-space-0)] w-[var(--ui-space-1)] cursor-col-resize hover:bg-primary/30 active:bg-primary/50 transition-colors z-10",onMouseDown:d})]})}const ux=Xt(["day","week","month"]),md=Xt(["horizontal","vertical"]),pd=Oe({id:q(),resourceId:q(),groupId:q(),title:q(),attendee:q(),startDate:ke(),endDate:ke(),status:q(),description:q().optional(),note:q().optional(),color:q().optional(),extendedProps:Ua(q(),Rc()).optional(),isAllDay:Ke().optional(),hasConflict:Ke().optional(),createdAt:ke(),updatedAt:ke()}),dx=Vt(pd),gd=Oe({id:q(),name:q(),order:we(),isAvailable:Ke(),groupId:q(),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),fx=Oe({id:q(),name:q(),displayMode:Xt(["grid","list"]),dimension:we(),resources:Vt(gd),createdAt:ke(),updatedAt:ke(),deletedAt:ke().optional()}),vd=Oe({id:q().or(we()),label:q(),startTime:q(),endTime:q()}),hx=Oe({defaultDuration:we(),startTime:q(),endTime:q(),closedDays:Vt(we()),weekStartsOn:_s([Ut(0),Ut(1)]),timeZone:q().optional(),businessHoursStart:q().optional(),businessHoursEnd:q().optional(),timeSlots:Vt(vd).optional(),orientation:md.optional(),slotInterval:we().optional()}),mx=Oe({date:ke(),bookedCount:we(),maxSlots:we(),density:we(),isClosedDay:Ke()}),px=Object.freeze(Object.defineProperty({__proto__:null,CalendarOrientationSchema:md,DensityDataSchema:mx,FacilityScheduleSettingsSchema:hx,ResourceGroupSchema:fx,ResourceSchema:gd,ScheduleEventArraySchema:dx,ScheduleEventSchema:pd,TimeSlotSchema:vd,ViewModeSchema:ux},Symbol.toStringTag,{value:"Module"})),Ta={morning:"午前",afternoon:"午後",night:"夜間",overnight:"オーバーナイト"},Ra=["morning","afternoon","night","overnight"],Ma={morning:0,afternoon:1,night:2,overnight:3},gx={morning:"bg-sky-100 text-sky-700 border-sky-200",afternoon:"bg-amber-100 text-amber-700 border-amber-200",night:"bg-indigo-100 text-indigo-700 border-indigo-200",overnight:"bg-rose-100 text-rose-700 border-rose-200"},ic={morning:"bg-sky-100 text-sky-800 border-sky-300 dark:bg-sky-900/40 dark:text-sky-200 dark:border-sky-700",afternoon:"bg-amber-100 text-amber-800 border-amber-300 dark:bg-amber-900/40 dark:text-amber-200 dark:border-amber-700",night:"bg-indigo-100 text-indigo-800 border-indigo-300 dark:bg-indigo-900/40 dark:text-indigo-200 dark:border-indigo-700",overnight:"bg-rose-100 text-rose-800 border-rose-300 dark:bg-rose-900/40 dark:text-rose-200 dark:border-rose-700"};function yd({selectedSlots:e,visibleSlots:t,eraseMode:r,onToggleSlot:n,onToggleVisibleSlot:s,onToggleEraseMode:a}){return o.jsxs("div",{className:"flex flex-wrap items-center gap-[var(--ui-space-2)]",children:[Ra.map(i=>{const c=e.has(i);return o.jsxs("label",{className:`flex items-center gap-[var(--ui-space-1)] text-xs rounded border px-[var(--ui-space-2)] py-[var(--ui-space-1)] cursor-pointer ${c?ic[i]:"bg-background border-border hover:bg-muted/40"}`,children:[o.jsx("input",{type:"checkbox",checked:c,onChange:()=>n(i)}),Ta[i]]},i)}),o.jsx("div",{className:"w-px h-5 bg-border mx-[var(--ui-space-1)]"}),Ra.map(i=>{const c=t.has(i);return o.jsxs("label",{className:`flex items-center gap-[var(--ui-space-1)] text-xs rounded border px-[var(--ui-space-2)] py-[var(--ui-space-1)] cursor-pointer ${c?ic[i]:"bg-background border-border opacity-70 hover:bg-muted/40"}`,children:[o.jsx("input",{type:"checkbox",checked:c,onChange:()=>s(i)}),Ta[i]]},`visible_${i}`)}),o.jsx(ae,{type:"button",size:"sm",variant:r?"destructive":"outline",onClick:a,className:"ml-auto",children:"削除モード"})]})}function xd({monthCursor:e,onNavigate:t,onToday:r}){return o.jsx("div",{className:"flex items-center gap-[var(--ui-space-2)]",children:o.jsx(Xu,{currentDate:e,onNavigate:t,onToday:r,dateFormat:"yearMonth"})})}function bd({weekLabels:e,dayCells:t,eraseMode:r,onDateClick:n,onClearDateAssignments:s,onDeleteAssignment:a}){return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"grid grid-cols-7 border-b border-border bg-muted/40",children:e.map(i=>o.jsx("div",{className:"px-[var(--ui-space-4)] py-[var(--ui-space-2)] text-xs font-medium text-muted-foreground border-r border-border last:border-r-0",children:i},i))}),o.jsx("div",{className:"grid grid-cols-7",children:t.map(i=>{const c=!r,l=`border-r border-b border-border last:border-r-0 p-[var(--ui-space-2)] min-h-[80px] flex flex-col gap-[var(--ui-space-1)] ${i.inCurrentMonth?"bg-background":"bg-muted/20 text-muted-foreground"} ${c?"cursor-pointer hover:bg-muted/50":""}`,u=o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:`text-xs font-semibold px-[var(--ui-space-1)] py-[var(--ui-space-0)] ${i.isToday?"text-primary":"text-foreground"}`,children:i.date.getDate()}),r&&o.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),s(i.dateKey)},className:"text-[10px] text-muted-foreground hover:text-foreground",title:"この日の全割当をクリア",children:"全消去"})]}),o.jsx("div",{className:"space-y-[4px]",children:i.assignments.map(f=>o.jsxs("div",{className:"text-[11px] rounded border border-border px-[4px] py-[2px] bg-background/90",children:[o.jsxs("div",{className:"flex items-start gap-[var(--ui-space-1)]",children:[o.jsx("div",{className:"font-medium break-words flex-1 min-w-[0]",children:f.staffName}),r&&o.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),a(i.dateKey,f.staffId)},className:"text-[10px] px-[4px] py-[1px] rounded border border-destructive text-destructive hover:bg-destructive/10",title:"このシフトを削除",children:"削除"})]}),o.jsx("div",{className:"flex flex-wrap gap-[2px] mt-[1px]",children:f.slots.map(d=>o.jsx("span",{className:`text-[10px] border rounded px-[3px] ${gx[d]}`,children:Ta[d]},`${i.dateKey}_${f.staffName}_${d}`))})]},`${i.dateKey}_${f.staffId}`))})]});return c?o.jsx("button",{type:"button",onClick:()=>n(i.dateKey),className:l,children:u},i.dateKey):o.jsx("div",{className:l,children:u},i.dateKey)})})]})}function vx({personnel:e,selectedIds:t,onSelectionChange:r}){return o.jsx(hd,{personnel:e,selectedIds:t,onSelectionChange:r,onPriorityChange:()=>{},className:"h-full",filterType:"select"})}function Zn(e){return new Date(e.getFullYear(),e.getMonth(),1)}function Io(e,t){const r=new Date(e);return r.setDate(r.getDate()+t),r}function wd(e){const t=e.getDay(),r=t===0?-6:1-t;return Io(e,r)}function cc(e){const t=e.getFullYear(),r=`${e.getMonth()+1}`.padStart(2,"0"),n=`${e.getDate()}`.padStart(2,"0");return`${t}-${r}-${n}`}function Pa(e,t){return`${e}__${t}`}function yx(e){const t=e.indexOf("__");return t<0?{staffId:"",dateKey:""}:{staffId:e.slice(0,t),dateKey:e.slice(t+2)}}function ys(e){return Array.from(new Set(e)).sort((t,r)=>Ma[t]-Ma[r])}function xs(e){const t=new Map;for(const r of e)t.set(Pa(r.staffId,r.date),{...r,slots:ys(r.slots)});return t}function lc(e){return Array.from(e.values()).sort((t,r)=>t.date===r.date?t.staffId.localeCompare(r.staffId):t.date.localeCompare(r.date))}function uc(e){return e.map(t=>`${t.staffId}__${t.date}__${ys(t.slots).join(",")}`).sort((t,r)=>t.localeCompare(r))}function xx(e,t){if(e.length!==t.length)return!1;const r=uc(e),n=uc(t);for(let s=0;s<r.length;s+=1)if(r[s]!==n[s])return!1;return!0}function bx(e){const t=Zn(e),r=wd(t);return Array.from({length:42},(n,s)=>Io(r,s))}function wx(){const e=wd(new Date(2026,1,2));return Array.from({length:7},(t,r)=>new Intl.DateTimeFormat("ja-JP",{weekday:"short"}).format(Io(e,r)))}function $o(e,t){const r=xs(e),n=xs(t),s=[],a=[],i=[];for(const[c,l]of n){const u=r.get(c);if(!u)s.push(l);else{const f=l.slots.join(","),d=u.slots.join(",");f!==d&&a.push(l)}}for(const[c,l]of r)n.has(c)||i.push({staffId:l.staffId,date:l.date});return{added:s,updated:a,deleted:i}}function _d(e,t){const r=$o(e,t);return r.added.length>0||r.updated.length>0||r.deleted.length>0}const _x=[];function Sx({staff:e,selectedStaffIds:t=[],targetMonth:r=new Date,initialAssignments:n=_x,onChange:s,onConfirm:a,className:i="",components:c}){const[l,u]=m.useState(()=>Zn(r)),[f,d]=m.useState(()=>xs(n)),[h,p]=m.useState(new Set(["morning"])),[b,g]=m.useState(new Set(Ra)),[y,x]=m.useState(!1);m.useEffect(()=>{d($=>{const O=lc($);return xx(O,n)?$:xs(n)})},[n]);const v=m.useMemo(()=>lc(f),[f]);m.useEffect(()=>{s&&s(v)},[v,s]);const k=m.useMemo(()=>bx(l),[l]),w=m.useMemo(()=>wx(),[]),S=m.useMemo(()=>{const $=new Map,O=new Map(e.map(A=>[A.id,A.name]));for(const A of f.values()){const R=O.get(A.staffId);if(!R)continue;const V=ys(A.slots.filter(Q=>b.has(Q)));if(V.length===0)continue;const H=$.get(A.date)??[];H.push({staffId:A.staffId,staffName:R,slots:V,sortIndex:Ma[V[0]]}),$.set(A.date,H)}for(const A of $.values())A.sort((R,V)=>R.sortIndex!==V.sortIndex?R.sortIndex-V.sortIndex:R.staffName.localeCompare(V.staffName));return $},[f,e,b]),C=m.useMemo(()=>{const $=cc(new Date);return k.map(O=>{const A=cc(O);return{date:O,dateKey:A,inCurrentMonth:O.getMonth()===l.getMonth(),isToday:A===$,assignments:S.get(A)??[]}})},[k,l,S]),_=$=>{p(O=>{const A=new Set(O);return A.has($)?A.delete($):A.add($),A})},N=$=>{g(O=>{const A=new Set(O);return A.has($)?A.delete($):A.add($),A})},I=$=>{y||t.length===0||d(O=>{const A=new Map(O),R=ys(Array.from(h));if(R.length===0)return O;for(const V of t){const H=Pa(V,$);A.set(H,{staffId:V,date:$,slots:R,source:t.length>1?"bulk":"manual"})}return A})},M=($,O)=>{d(A=>{const R=new Map(A);return R.delete(Pa(O,$)),R})},B=$=>{d(O=>{const A=new Map(O);for(const R of A.keys())yx(R).dateKey===$&&A.delete(R);return A})},E=c?.Header??xd,F=c?.FilterBar??yd,T=c?.MonthGrid??bd;return o.jsxs("div",{className:`flex flex-col h-full bg-background ${i}`,children:[o.jsxs("header",{className:"border-b border-border px-[var(--ui-space-4)] py-[var(--ui-space-3)] flex items-center justify-between gap-[var(--ui-space-4)]",children:[o.jsx(E,{monthCursor:l,onNavigate:$=>u(O=>Zn($s(O,"month",$))),onToday:()=>u(Zn(new Date))}),o.jsxs("div",{className:"flex items-center gap-[var(--ui-space-3)]",children:[o.jsx(F,{selectedSlots:h,visibleSlots:b,eraseMode:y,onToggleSlot:_,onToggleVisibleSlot:N,onToggleEraseMode:()=>x($=>!$)}),a&&o.jsx("button",{type:"button",onClick:()=>{const $=$o(n,v);a($)},disabled:!_d(n,v),className:"px-[var(--ui-space-4)] py-[var(--ui-space-2)] text-sm font-medium rounded border border-primary bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",children:"確定"})]})]}),o.jsx("div",{className:"flex-1 overflow-auto",children:o.jsx(T,{weekLabels:w,dayCells:C,eraseMode:y,onDateClick:I,onClearDateAssignments:B,onDeleteAssignment:M})})]})}const Sd=Xt(["morning","afternoon","night","overnight"]),kx=Oe({id:q(),name:q(),role:q(),department:q().optional(),color:q().optional(),attributes:Ua(q(),q()).optional()}),jx=Oe({staffId:q(),date:q(),slots:Vt(Sd).min(1),source:Xt(["manual","bulk","template","copy"]).default("manual")}),Cx={theme:"light",density:"normal",borderRadius:8,fontSize:16,weekStartsOn:1,businessHoursStart:"08:00",businessHoursEnd:"18:00",closedDays:[0,6],language:"ja",timeZone:"Asia/Tokyo",paginationEnabled:!1,paginationPageSize:8,calendarOrientation:"horizontal",facilityOrientation:"horizontal",calendarSlotInterval:60,facilitySlotInterval:60};exports.AttendeeInfoSchema=Yy;exports.AttendeeInput=Ia;exports.BrowserStorage=xu;exports.Button=ae;exports.Checkbox=hn;exports.ConfirmModal=vo;exports.DEFAULT_SETTINGS=Cx;exports.DOMThemeApplier=sd;exports.DateDisplay=It;exports.DatePicker=fo;exports.DefaultEventModal=Tu;exports.DensityDataSchema=Jy;exports.EventForm=fu;exports.EventModal=ko;exports.FacilitySchedule=wu;exports.FacilityScheduleManager=Zg;exports.FacilityScheduleSettingsSchema=Xy;exports.FacilityStructureSettings=Gg;exports.Form=ho;exports.FormControl=be;exports.FormField=Re;exports.FormItem=De;exports.FormLabel=_e;exports.FormMessage=nt;exports.Icons=ye;exports.InMemoryStorage=zg;exports.Input=bt;exports.KeypadModal=Ms;exports.MockThemeApplier=Wy;exports.Modal=Kr;exports.PERSONNEL_COLORS=Da;exports.PaginationOptionsSchema=Qy;exports.PersonnelContextMenu=ud;exports.PersonnelPanel=hd;exports.RegularCalendar=nd;exports.RegularCalendarSchema=px;exports.ResizablePanel=lx;exports.ResourceGroupSchema=qy;exports.ResourceSchema=cd;exports.ScheduleEventArraySchema=Ky;exports.ScheduleEventSchema=id;exports.ScheduleManager=zy;exports.ScheduleProvider=wg;exports.Select=Zt;exports.SelectContent=Ot;exports.SelectItem=at;exports.SelectTrigger=Mt;exports.SelectValue=Pt;exports.SettingsModal=Hy;exports.ShiftAssignmentSchema=jx;exports.ShiftSelector=Sx;exports.ShiftSelectorFilterBar=yd;exports.ShiftSelectorHeader=xd;exports.ShiftSelectorMonthGrid=bd;exports.ShiftSelectorStaffPanel=vx;exports.ShiftSlotSchema=Sd;exports.ShiftStaffSchema=kx;exports.Textarea=gn;exports.ThemeProvider=Zy;exports.TimeSlotSchema=ld;exports.ViewModeSchema=Gy;exports.ViewSelector=Co;exports.applyThemeSettings=By;exports.buttonVariants=on;exports.calculateAssignmentDiff=$o;exports.calculateViewRange=uu;exports.checkScheduleConflict=yo;exports.cleanEventId=Bg;exports.createPersonnelColorMap=Hg;exports.defaultStorage=Fs;exports.defaultThemeApplier=ad;exports.detectAndMarkConflicts=vg;exports.filterEventsByDateRange=Os;exports.filterEventsByDay=fg;exports.filterEventsByResource=Ca;exports.formatCalendarDate=Ne;exports.formatEventTitleWithAttendees=_u;exports.generateDateRange=bo;exports.getEventDisplayText=pg;exports.getEventDuration=mg;exports.getMonthEnd=lu;exports.getMonthStart=So;exports.getPersonnelColor=Do;exports.getResourceAvailability=iu;exports.getToday=Vg;exports.getWeekEnd=_o;exports.getWeekStart=Is;exports.hasDiff=_d;exports.hasTimeOverlap=Ps;exports.mergeEvents=Wg;exports.navigateDate=$s;exports.normalizeWeekStartsOn=wo;exports.parseAttendeeNames=Su;exports.parseAttendees=su;exports.prepareEventFormData=Au;exports.resolveEventOwnerId=ku;exports.sortEventsByTime=xo;exports.sortResourcesByOrder=hg;exports.stringifyAttendees=au;exports.transformBookingsToEvents=ju;exports.useAttendeeManagement=ou;exports.useAvailableResources=Nu;exports.useConflictCheck=Du;exports.useEventForm=Cu;exports.useFormField=Ts;exports.useResourceAvailability=cu;exports.useResourceDisplayNames=Eu;exports.useScheduleConflict=du;exports.useScheduleContext=mu;exports.useScheduleData=vu;exports.useScheduleEventHandlers=yu;exports.useScheduleView=bu;exports.useTheme=Uy;
|