react-luminus-components 1.3.24 → 1.3.25

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.
@@ -43,15 +43,15 @@
43
43
  "_latinize-DaqzUOla.cjs"
44
44
  ]
45
45
  },
46
- "_dateUtils-7nL2BXlo.js": {
47
- "file": "dateUtils-7nL2BXlo.js",
46
+ "_dateUtils-C7tHbjab.js": {
47
+ "file": "dateUtils-C7tHbjab.js",
48
48
  "name": "dateUtils",
49
49
  "imports": [
50
50
  "_latinize-BQrinury.js"
51
51
  ]
52
52
  },
53
- "_dateUtils-DUA3CKds.cjs": {
54
- "file": "dateUtils-DUA3CKds.cjs",
53
+ "_dateUtils-b-AkAh2Y.cjs": {
54
+ "file": "dateUtils-b-AkAh2Y.cjs",
55
55
  "name": "dateUtils",
56
56
  "imports": [
57
57
  "_latinize-DaqzUOla.cjs"
@@ -128,7 +128,8 @@
128
128
  "_UserAvatarToggle-DYIBvTYX.cjs",
129
129
  "_latinize-DaqzUOla.cjs",
130
130
  "_useLocalStorageState-CxsNjf78.cjs",
131
- "_PrimaryButton-DXGul-f9.cjs"
131
+ "_PrimaryButton-DXGul-f9.cjs",
132
+ "_dateUtils-b-AkAh2Y.cjs"
132
133
  ]
133
134
  },
134
135
  "src/hooks/index.ts": {
@@ -140,7 +141,7 @@
140
141
  "_UserAvatarToggle-DYIBvTYX.cjs",
141
142
  "_useLocalStorageState-CxsNjf78.cjs",
142
143
  "_latinize-DaqzUOla.cjs",
143
- "_dateUtils-DUA3CKds.cjs",
144
+ "_dateUtils-b-AkAh2Y.cjs",
144
145
  "_useFormControlType-Dqz8sV4J.cjs",
145
146
  "_usePermissions-BEKIk6u3.cjs"
146
147
  ]
@@ -178,7 +179,7 @@
178
179
  "isEntry": true,
179
180
  "imports": [
180
181
  "_latinize-DaqzUOla.cjs",
181
- "_dateUtils-DUA3CKds.cjs",
182
+ "_dateUtils-b-AkAh2Y.cjs",
182
183
  "_searchUtils-Do20vjZW.cjs"
183
184
  ]
184
185
  },
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./UserAvatarToggle-DYIBvTYX.cjs"),n=require("react");require("./latinize-DaqzUOla.cjs");require("react-hook-form");const y=require("./useLocalStorageState-CxsNjf78.cjs"),c=require("./PrimaryButton-DXGul-f9.cjs"),N=({children:t})=>{const[i,s]=n.useState(!1),[r,o]=n.useState(""),a=n.useCallback(d=>{s(!0),o(d)},[]),u=n.useCallback(()=>{s(!1)},[]),l=n.useMemo(()=>({show:i,text:r,showConfirm:a,hideConfirm:u}),[i,r,a,u]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:l,children:[e.jsxRuntimeExports.jsx(F,{}),t]})},b=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{isShown:i,text:s,onFinish:r}=y.usePrompt(),{options:o}=n.useContext(e.PromptContext),[a,u]=n.useState(o.defaultValue??""),l=n.useCallback(()=>{r(null)},[r]),d=n.useCallback(m=>{m.preventDefault(),!(o.required&&!a)&&r(a)},[r,o.required,a]);n.useEffect(()=>{i===!0&&u(o.defaultValue??"")},[i,o.defaultValue]);const x=n.useMemo(()=>({value:a,onChange:m=>u(m.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[a]);return e.jsxRuntimeExports.jsxs(c.Modal,{show:i,size:"sm",centered:!0,onHide:l,children:[e.jsxRuntimeExports.jsx(c.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(c.Modal.Title,{children:s})}),e.jsxRuntimeExports.jsxs("form",{onSubmit:d,children:[e.jsxRuntimeExports.jsxs(c.Modal.Body,{children:[o.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...x,rows:5}):void 0,o.input==="input"?e.jsxRuntimeExports.jsx(c.FormControl,{...x,type:o.type}):void 0]}),e.jsxRuntimeExports.jsxs(c.Modal.Footer,{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(c.PrimaryButton,{variant:"outlined",color:"secondary",onClick:l,className:"flex-grow-1",children:t.cancel}),e.jsxRuntimeExports.jsx(c.PrimaryButton,{color:"primary",disabled:o.required&&!a,type:"submit",className:"flex-grow-1",children:t.confirm})]})]})]})},k=({children:t})=>{const[i,s]=n.useState(!1),[r,o]=n.useState(""),[a,u]=n.useState({input:"textarea",type:"text"}),l=n.useRef(()=>{}),d=n.useCallback(f=>{o(f),s(!0)},[]),x=n.useCallback(()=>{s(!1)},[]),m=n.useMemo(()=>({isShown:i,text:r,showPrompt:d,hidePrompt:x,resolveRef:l,options:a,setOptions:u}),[i,r,d,x,a]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:m,children:[t,e.jsxRuntimeExports.jsx(b,{})]})},O=({cookieDomain:t,axiosOptions:i,LinkComponent:s,NavigateComponent:r,language:o,axiosTexts:a,confirmTexts:u,formValidationTexts:l,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:m,customSelectTexts:f,errorBoundaryTexts:p,widgetTexts:g,children:S})=>{const I=n.useMemo(()=>({axiosOptions:i,cookieDomain:t,LinkComponent:s,NavigateComponent:r,language:o,axiosTexts:a,confirmTexts:u,formValidationTexts:l,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:m,customSelectTexts:f,errorBoundaryTexts:p,widgetTexts:g}),[i,t,s,r,o,a,u,l,d,x,m,f,p,g]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:I,children:e.jsxRuntimeExports.jsx(N,{children:e.jsxRuntimeExports.jsxs(k,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),S]})})})},U=({children:t})=>{const[i,s]=n.useState(!1),[r]=n.useState(new Set),o=n.useCallback(l=>{r.add(l),s(!0)},[r]),a=n.useCallback(l=>{r.delete(l),r.size===0&&s(!1)},[r]),u=n.useMemo(()=>({isLoading:i,startLoading:o,stopLoading:a}),[i,o,a]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:u,children:[i&&e.jsxRuntimeExports.jsx(c.Loading,{}),t]})};/*! @azure/msal-browser v3.14.0 2024-05-07 */class _{static getInteractionStatusFromEvent(i,s){switch(i.eventType){case c.EventType.LOGIN_START:return e.InteractionStatus.Login;case c.EventType.SSO_SILENT_START:return e.InteractionStatus.SsoSilent;case c.EventType.ACQUIRE_TOKEN_START:if(i.interactionType===e.InteractionType.Redirect||i.interactionType===e.InteractionType.Popup)return e.InteractionStatus.AcquireToken;break;case c.EventType.HANDLE_REDIRECT_START:return e.InteractionStatus.HandleRedirect;case c.EventType.LOGOUT_START:return e.InteractionStatus.Logout;case c.EventType.SSO_SILENT_SUCCESS:case c.EventType.SSO_SILENT_FAILURE:if(s&&s!==e.InteractionStatus.SsoSilent)break;return e.InteractionStatus.None;case c.EventType.LOGOUT_END:if(s&&s!==e.InteractionStatus.Logout)break;return e.InteractionStatus.None;case c.EventType.HANDLE_REDIRECT_END:if(s&&s!==e.InteractionStatus.HandleRedirect)break;return e.InteractionStatus.None;case c.EventType.LOGIN_SUCCESS:case c.EventType.LOGIN_FAILURE:case c.EventType.ACQUIRE_TOKEN_SUCCESS:case c.EventType.ACQUIRE_TOKEN_FAILURE:case c.EventType.RESTORE_FROM_BFCACHE:if(i.interactionType===e.InteractionType.Redirect||i.interactionType===e.InteractionType.Popup){if(s&&s!==e.InteractionStatus.Login&&s!==e.InteractionStatus.AcquireToken)break;return e.InteractionStatus.None}break}return null}}/*! @azure/msal-react v2.0.16 2024-05-07 */const M="@azure/msal-react",P="2.0.16";/*! @azure/msal-react v2.0.16 2024-05-07 */const T={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},w=(t,i)=>{const{type:s,payload:r}=i;let o=t.inProgress;switch(s){case T.UNBLOCK_INPROGRESS:t.inProgress===e.InteractionStatus.Startup&&(o=e.InteractionStatus.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case T.EVENT:const u=r.message,l=_.getInteractionStatusFromEvent(u,t.inProgress);l&&(r.logger.info(`MsalProvider - ${u.eventType} results in setting inProgress from ${t.inProgress} to ${l}`),o=l);break;default:throw new Error(`Unknown action type: ${s}`)}const a=r.instance.getAllAccounts();return o!==t.inProgress&&!e.accountArraysAreEqual(a,t.accounts)?{...t,inProgress:o,accounts:a}:o!==t.inProgress?{...t,inProgress:o}:e.accountArraysAreEqual(a,t.accounts)?t:{...t,accounts:a}};function D({instance:t,children:i}){n.useEffect(()=>{t.initializeWrapperLibrary(e.WrapperSKU.React,P)},[t]);const s=n.useMemo(()=>t.getLogger().clone(M,P),[t]),[r,o]=n.useReducer(w,void 0,()=>({inProgress:e.InteractionStatus.Startup,accounts:t.getAllAccounts()}));n.useEffect(()=>{const u=t.addEventCallback(l=>{o({payload:{instance:t,logger:s,message:l},type:T.EVENT})});return s.verbose(`MsalProvider - Registered event callback with id: ${u}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{o({payload:{instance:t,logger:s},type:T.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{u&&(s.verbose(`MsalProvider - Removing event callback ${u}`),t.removeEventCallback(u))}},[t,s]);const a={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:s};return n.createElement(e.MsalContext.Provider,{value:a},i)}const G=({children:t})=>{const i=e.useAxios(),{msalInstance:s}=n.useContext(e.AuthContext),{delegation:r,setDelegation:o,setAvailableDelegations:a,refreshAvailableDelegations:u}=n.useContext(e.DelegationContext),{getToken:l}=e.useAuth(),[d,x]=n.useState(null),m=n.useCallback(async()=>{const E=await l();E&&x(E)},[l]);n.useEffect(()=>{m()},[m]);const p=n.useCallback(()=>{const E=localStorage.getItem("user")??null;return E?JSON.parse(E??""):null},[])(),[g,S]=n.useState({state:p?e.LoginState.LOGGED_IN:e.LoginState.LOGGING_IN,user:p}),I=n.useCallback(async E=>{let C=null;return await i.get("/user/detail",E?{headers:{Authorization:`Bearer ${E}`}}:void 0).then(j=>{C=j.data}).catch(()=>{C=null}),C},[i]),h=n.useCallback(()=>{localStorage.removeItem("user"),S({state:e.LoginState.LOGGED_OUT,user:null}),o(null),a(null)},[a,o]),v=n.useCallback(async E=>{S({state:e.LoginState.LOGGING_IN,user:null});const C=await I(E);return C?(S({state:e.LoginState.LOGGED_IN,user:C}),localStorage.setItem("user",JSON.stringify(C)),!0):(S({state:e.LoginState.LOGIN_FAILED,user:null}),!1)},[I]),R=n.useCallback(()=>{h()},[h]),A=n.useMemo(()=>({user:g.user,userLoginState:g,loginUser:v,logoutUser:R}),[g,v,R]);n.useEffect(()=>{if(s){const E=s.addEventCallback(C=>{if(C.eventType===c.EventType.LOGIN_SUCCESS&&C.payload){const j=C.payload;x(j.accessToken)}});return()=>{E&&s.removeEventCallback(E)}}return()=>{}},[s,v,R]);const L=n.useCallback(async E=>{E&&(await v(E).catch(()=>{R(),o(null)}),await u())},[v,R,u,o]);return n.useEffect(()=>{L(d)},[d,r==null?void 0:r.id,L]),e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:A,children:t})},q=({...t})=>{const{cookieDomain:i}=n.useContext(e.LuminusComponentsContext),[,s]=e.useCookies(["Authorization"]),r=n.useMemo(()=>({useMsal:t.useMsal??!1,msalInstance:t.useMsal?t.msalInstance??null:null,msalScopes:t.useMsal?t.msalScopes??[]:[]}),[t]);return n.useEffect(()=>{if(t.useMsal){const o=t.msalInstance.addEventCallback(a=>{if(a.eventType===c.EventType.LOGIN_SUCCESS||a.eventType===c.EventType.ACQUIRE_TOKEN_SUCCESS&&a.payload){const u=a.payload,l=u.account;t.msalInstance.setActiveAccount(l);const d=u.accessToken,x=u.expiresOn;s("Authorization",d,{path:"/",secure:!0,sameSite:"none",domain:i,expires:x??void 0})}a.error&&console.error("AuthProvider MSAL Error",a)});return()=>{o&&t.msalInstance.removeEventCallback(o)}}return()=>{}},[t,s,i]),e.jsxRuntimeExports.jsx(e.AuthContext.Provider,{value:r,children:t.useMsal?e.jsxRuntimeExports.jsx(D,{instance:t.msalInstance,children:t.children}):t.children})},B=({children:t,relativeEndpoint:i})=>{const[s,r,o]=y.useLocalStorageState("user-delegation",null),{data:a,setData:u,reloadData:l}=y.useGetApiData(i,{nullStateBeforeLoad:!1,nullStateOnFail:!0});n.useEffect(()=>{const x=()=>{o()};return window.addEventListener("focus",x),()=>{window.removeEventListener("focus",x)}},[o]);const d=n.useMemo(()=>({delegation:s,setDelegation:r,availableDelegations:a,setAvailableDelegations:u,refreshAvailableDelegations:l}),[s,r,a,u,l]);return e.jsxRuntimeExports.jsx(e.DelegationContext.Provider,{value:d,children:t})},F=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{onConfirm:i,onCancel:s,text:r,show:o}=y.useConfirm();return e.jsxRuntimeExports.jsxs(c.Modal,{show:o,size:"sm",centered:!0,onHide:s,children:[e.jsxRuntimeExports.jsx(c.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(c.Modal.Title,{children:r})}),e.jsxRuntimeExports.jsx(c.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(c.PrimaryButton,{type:"button",variant:"outlined",color:"secondary",className:"w-100",onClick:s,children:t.no}),e.jsxRuntimeExports.jsx(c.PrimaryButton,{type:"button",color:"primary",onClick:i,className:"w-100 ml",children:t.yes})]})})]})};exports.AuthContext=e.AuthContext;exports.DelegationContext=e.DelegationContext;exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.AuthProvider=q;exports.DelegationProvider=B;exports.LoadingProvider=U;exports.LuminusComponentsProvider=O;exports.UserProvider=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./UserAvatarToggle-DYIBvTYX.cjs"),n=require("react");require("./latinize-DaqzUOla.cjs");require("react-hook-form");const I=require("./useLocalStorageState-CxsNjf78.cjs"),c=require("./PrimaryButton-DXGul-f9.cjs"),A=require("./dateUtils-b-AkAh2Y.cjs"),b=({children:t})=>{const[i,s]=n.useState(!1),[r,o]=n.useState(""),a=n.useCallback(d=>{s(!0),o(d)},[]),u=n.useCallback(()=>{s(!1)},[]),l=n.useMemo(()=>({show:i,text:r,showConfirm:a,hideConfirm:u}),[i,r,a,u]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:l,children:[e.jsxRuntimeExports.jsx(z,{}),t]})},k=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{isShown:i,text:s,onFinish:r}=I.usePrompt(),{options:o}=n.useContext(e.PromptContext),[a,u]=n.useState(o.defaultValue??""),l=n.useCallback(()=>{r(null)},[r]),d=n.useCallback(x=>{x.preventDefault(),!(o.required&&!a)&&r(a)},[r,o.required,a]);n.useEffect(()=>{i===!0&&u(o.defaultValue??"")},[i,o.defaultValue]);const E=n.useMemo(()=>({value:a,onChange:x=>u(x.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[a]);return e.jsxRuntimeExports.jsxs(c.Modal,{show:i,size:"sm",centered:!0,onHide:l,children:[e.jsxRuntimeExports.jsx(c.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(c.Modal.Title,{children:s})}),e.jsxRuntimeExports.jsxs("form",{onSubmit:d,children:[e.jsxRuntimeExports.jsxs(c.Modal.Body,{children:[o.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...E,rows:5}):void 0,o.input==="input"?e.jsxRuntimeExports.jsx(c.FormControl,{...E,type:o.type}):void 0]}),e.jsxRuntimeExports.jsxs(c.Modal.Footer,{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(c.PrimaryButton,{variant:"outlined",color:"secondary",onClick:l,className:"flex-grow-1",children:t.cancel}),e.jsxRuntimeExports.jsx(c.PrimaryButton,{color:"primary",disabled:o.required&&!a,type:"submit",className:"flex-grow-1",children:t.confirm})]})]})]})},O=({children:t})=>{const[i,s]=n.useState(!1),[r,o]=n.useState(""),[a,u]=n.useState({input:"textarea",type:"text"}),l=n.useRef(()=>{}),d=n.useCallback(S=>{o(S),s(!0)},[]),E=n.useCallback(()=>{s(!1)},[]),x=n.useMemo(()=>({isShown:i,text:r,showPrompt:d,hidePrompt:E,resolveRef:l,options:a,setOptions:u}),[i,r,d,E,a]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:x,children:[t,e.jsxRuntimeExports.jsx(k,{})]})},U=({cookieDomain:t,axiosOptions:i,LinkComponent:s,NavigateComponent:r,language:o,axiosTexts:a,confirmTexts:u,formValidationTexts:l,homeDashboardTexts:d,formSubmitTexts:E,appSearchTexts:x,customSelectTexts:S,errorBoundaryTexts:p,widgetTexts:g,children:f})=>{const y=n.useMemo(()=>({axiosOptions:i,cookieDomain:t,LinkComponent:s,NavigateComponent:r,language:o,axiosTexts:a,confirmTexts:u,formValidationTexts:l,homeDashboardTexts:d,formSubmitTexts:E,appSearchTexts:x,customSelectTexts:S,errorBoundaryTexts:p,widgetTexts:g}),[i,t,s,r,o,a,u,l,d,E,x,S,p,g]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:y,children:e.jsxRuntimeExports.jsx(b,{children:e.jsxRuntimeExports.jsxs(O,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),f]})})})},w=({children:t})=>{const[i,s]=n.useState(!1),[r]=n.useState(new Set),o=n.useCallback(l=>{r.add(l),s(!0)},[r]),a=n.useCallback(l=>{r.delete(l),r.size===0&&s(!1)},[r]),u=n.useMemo(()=>({isLoading:i,startLoading:o,stopLoading:a}),[i,o,a]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:u,children:[i&&e.jsxRuntimeExports.jsx(c.Loading,{}),t]})};/*! @azure/msal-browser v3.14.0 2024-05-07 */class _{static getInteractionStatusFromEvent(i,s){switch(i.eventType){case c.EventType.LOGIN_START:return e.InteractionStatus.Login;case c.EventType.SSO_SILENT_START:return e.InteractionStatus.SsoSilent;case c.EventType.ACQUIRE_TOKEN_START:if(i.interactionType===e.InteractionType.Redirect||i.interactionType===e.InteractionType.Popup)return e.InteractionStatus.AcquireToken;break;case c.EventType.HANDLE_REDIRECT_START:return e.InteractionStatus.HandleRedirect;case c.EventType.LOGOUT_START:return e.InteractionStatus.Logout;case c.EventType.SSO_SILENT_SUCCESS:case c.EventType.SSO_SILENT_FAILURE:if(s&&s!==e.InteractionStatus.SsoSilent)break;return e.InteractionStatus.None;case c.EventType.LOGOUT_END:if(s&&s!==e.InteractionStatus.Logout)break;return e.InteractionStatus.None;case c.EventType.HANDLE_REDIRECT_END:if(s&&s!==e.InteractionStatus.HandleRedirect)break;return e.InteractionStatus.None;case c.EventType.LOGIN_SUCCESS:case c.EventType.LOGIN_FAILURE:case c.EventType.ACQUIRE_TOKEN_SUCCESS:case c.EventType.ACQUIRE_TOKEN_FAILURE:case c.EventType.RESTORE_FROM_BFCACHE:if(i.interactionType===e.InteractionType.Redirect||i.interactionType===e.InteractionType.Popup){if(s&&s!==e.InteractionStatus.Login&&s!==e.InteractionStatus.AcquireToken)break;return e.InteractionStatus.None}break}return null}}/*! @azure/msal-react v2.0.16 2024-05-07 */const M="@azure/msal-react",P="2.0.16";/*! @azure/msal-react v2.0.16 2024-05-07 */const T={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},D=(t,i)=>{const{type:s,payload:r}=i;let o=t.inProgress;switch(s){case T.UNBLOCK_INPROGRESS:t.inProgress===e.InteractionStatus.Startup&&(o=e.InteractionStatus.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case T.EVENT:const u=r.message,l=_.getInteractionStatusFromEvent(u,t.inProgress);l&&(r.logger.info(`MsalProvider - ${u.eventType} results in setting inProgress from ${t.inProgress} to ${l}`),o=l);break;default:throw new Error(`Unknown action type: ${s}`)}const a=r.instance.getAllAccounts();return o!==t.inProgress&&!e.accountArraysAreEqual(a,t.accounts)?{...t,inProgress:o,accounts:a}:o!==t.inProgress?{...t,inProgress:o}:e.accountArraysAreEqual(a,t.accounts)?t:{...t,accounts:a}};function G({instance:t,children:i}){n.useEffect(()=>{t.initializeWrapperLibrary(e.WrapperSKU.React,P)},[t]);const s=n.useMemo(()=>t.getLogger().clone(M,P),[t]),[r,o]=n.useReducer(D,void 0,()=>({inProgress:e.InteractionStatus.Startup,accounts:t.getAllAccounts()}));n.useEffect(()=>{const u=t.addEventCallback(l=>{o({payload:{instance:t,logger:s,message:l},type:T.EVENT})});return s.verbose(`MsalProvider - Registered event callback with id: ${u}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{o({payload:{instance:t,logger:s},type:T.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{u&&(s.verbose(`MsalProvider - Removing event callback ${u}`),t.removeEventCallback(u))}},[t,s]);const a={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:s};return n.createElement(e.MsalContext.Provider,{value:a},i)}const q=({children:t})=>{const i=e.useAxios(),{msalInstance:s}=n.useContext(e.AuthContext),{delegation:r,setDelegation:o,setAvailableDelegations:a,refreshAvailableDelegations:u}=n.useContext(e.DelegationContext),{getToken:l}=e.useAuth(),[d,E]=n.useState(null),x=n.useCallback(async()=>{const m=await l();m&&E(m)},[l]);n.useEffect(()=>{x()},[x]);const p=n.useCallback(()=>{const m=localStorage.getItem("user")??null;return m?JSON.parse(m??""):null},[])(),[g,f]=n.useState({state:p?e.LoginState.LOGGED_IN:e.LoginState.LOGGING_IN,user:p}),y=n.useCallback(async m=>{let C=null;return await i.get("/user/detail",m?{headers:{Authorization:`Bearer ${m}`}}:void 0).then(h=>{C=h.data}).catch(()=>{C=null}),C},[i]),j=n.useCallback(()=>{localStorage.removeItem("user"),f({state:e.LoginState.LOGGED_OUT,user:null}),o(null),a(null)},[a,o]),v=n.useCallback(async m=>{f({state:e.LoginState.LOGGING_IN,user:null});const C=await y(m);return C?(f({state:e.LoginState.LOGGED_IN,user:C}),localStorage.setItem("user",JSON.stringify(C)),await u(),!0):(f({state:e.LoginState.LOGIN_FAILED,user:null}),!1)},[y,u]),R=n.useCallback(()=>{j()},[j]);n.useEffect(()=>{if(s){const m=s.addEventCallback(C=>{if(C.eventType===c.EventType.LOGIN_SUCCESS&&C.payload){const h=C.payload;E(h.accessToken)}});return()=>{m&&s.removeEventCallback(m)}}return()=>{}},[s,v,R]);const L=n.useCallback(async m=>{m&&await v(m).catch(()=>{R(),o(null)})},[v,R,o]);n.useEffect(()=>{L(d)},[d,r==null?void 0:r.id,L]);const N=n.useMemo(()=>({user:g.user,userLoginState:g,loginUser:v,logoutUser:R}),[g,v,R]);return e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:N,children:t})},B=({...t})=>{const{cookieDomain:i}=n.useContext(e.LuminusComponentsContext),[,s]=e.useCookies(["Authorization"]),r=n.useMemo(()=>({useMsal:t.useMsal??!1,msalInstance:t.useMsal?t.msalInstance??null:null,msalScopes:t.useMsal?t.msalScopes??[]:[]}),[t]);return n.useEffect(()=>{if(t.useMsal){const o=t.msalInstance.addEventCallback(a=>{if(a.eventType===c.EventType.LOGIN_SUCCESS||a.eventType===c.EventType.ACQUIRE_TOKEN_SUCCESS&&a.payload){const u=a.payload,l=u.account;t.msalInstance.setActiveAccount(l);const d=u.accessToken,E=u.expiresOn;s("Authorization",d,{path:"/",secure:!0,sameSite:"none",domain:i,expires:E??void 0})}a.error&&console.error("AuthProvider MSAL Error",a)});return()=>{o&&t.msalInstance.removeEventCallback(o)}}return()=>{}},[t,s,i]),e.jsxRuntimeExports.jsx(e.AuthContext.Provider,{value:r,children:t.useMsal?e.jsxRuntimeExports.jsx(G,{instance:t.msalInstance,children:t.children}):t.children})},F=({children:t,relativeEndpoint:i})=>{const[s,r,o]=I.useLocalStorageState("user-delegation",null),{data:a,setData:u,reloadData:l}=I.useGetApiData(i,{nullStateBeforeLoad:!1,nullStateOnFail:!0}),d=n.useRef(null);n.useEffect(()=>{const x=()=>{l(),d.current=window.setTimeout(x,A.msToStartOfNextDay()+5e3)};return x(),()=>{d.current!==null&&window.clearTimeout(d.current)}},[l]),n.useEffect(()=>{const x=()=>{o()};return window.addEventListener("focus",x),()=>{window.removeEventListener("focus",x)}},[o,l]);const E=n.useMemo(()=>({delegation:s,setDelegation:r,availableDelegations:a,setAvailableDelegations:u,refreshAvailableDelegations:l}),[s,r,a,u,l]);return e.jsxRuntimeExports.jsx(e.DelegationContext.Provider,{value:E,children:t})},z=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{onConfirm:i,onCancel:s,text:r,show:o}=I.useConfirm();return e.jsxRuntimeExports.jsxs(c.Modal,{show:o,size:"sm",centered:!0,onHide:s,children:[e.jsxRuntimeExports.jsx(c.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(c.Modal.Title,{children:r})}),e.jsxRuntimeExports.jsx(c.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(c.PrimaryButton,{type:"button",variant:"outlined",color:"secondary",className:"w-100",onClick:s,children:t.no}),e.jsxRuntimeExports.jsx(c.PrimaryButton,{type:"button",color:"primary",onClick:i,className:"w-100 ml",children:t.yes})]})})]})};exports.AuthContext=e.AuthContext;exports.DelegationContext=e.DelegationContext;exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.AuthProvider=B;exports.DelegationProvider=F;exports.LoadingProvider=w;exports.LuminusComponentsProvider=U;exports.UserProvider=q;
@@ -1,116 +1,117 @@
1
- import { j as a, am as B, Q as j, an as M, ao as H, ap as q, L as p, K as i, aq as V, ar as $, as as D, ab as Q, ae as F, at as z, af as J, ah as L, ag as W, au as X } from "./UserAvatarToggle-C1CRXpP2.js";
2
- import Y, { useState as h, useCallback as m, useMemo as S, useContext as N, useEffect as C, useRef as Z, useReducer as ee } from "react";
1
+ import { j as a, am as H, Q as b, an as M, ao as q, ap as V, L as O, K as d, aq as $, ar as Q, as as D, ab as J, ae as F, at as z, af as W, ah as N, ag as X, au as Y } from "./UserAvatarToggle-C1CRXpP2.js";
2
+ import Z, { useState as h, useCallback as E, useMemo as C, useContext as L, useEffect as v, useRef as K, useReducer as ee } from "react";
3
3
  import "./latinize-BQrinury.js";
4
4
  import "react-hook-form";
5
- import { u as te, a as se, b as ne, c as oe } from "./useLocalStorageState-DblJQuM7.js";
6
- import { M as v, b as re, P as O, L as ae, E as u } from "./PrimaryButton-Bewa28m7.js";
7
- const ce = ({ children: e }) => {
8
- const [r, t] = h(!1), [n, s] = h(""), o = m((d) => {
9
- t(!0), s(d);
10
- }, []), c = m(() => {
5
+ import { u as te, a as ne, b as se, c as oe } from "./useLocalStorageState-DblJQuM7.js";
6
+ import { M as S, b as re, P as _, L as ae, E as f } from "./PrimaryButton-Bewa28m7.js";
7
+ import { m as ce } from "./dateUtils-C7tHbjab.js";
8
+ const le = ({ children: e }) => {
9
+ const [r, t] = h(!1), [s, n] = h(""), o = E((i) => {
10
+ t(!0), n(i);
11
+ }, []), c = E(() => {
11
12
  t(!1);
12
- }, []), l = S(() => ({ show: r, text: n, showConfirm: o, hideConfirm: c }), [r, n, o, c]);
13
- return /* @__PURE__ */ a.jsxs(B.Provider, { value: l, children: [
14
- /* @__PURE__ */ a.jsx(me, {}),
13
+ }, []), l = C(() => ({ show: r, text: s, showConfirm: o, hideConfirm: c }), [r, s, o, c]);
14
+ return /* @__PURE__ */ a.jsxs(H.Provider, { value: l, children: [
15
+ /* @__PURE__ */ a.jsx(Ee, {}),
15
16
  e
16
17
  ] });
17
- }, le = () => {
18
- const { confirmTexts: e } = N(j), { isShown: r, text: t, onFinish: n } = te(), { options: s } = N(M), [o, c] = h(s.defaultValue ?? ""), l = m(() => {
19
- n(null);
20
- }, [n]), d = m((E) => {
21
- E.preventDefault(), !(s.required && !o) && n(o);
22
- }, [n, s.required, o]);
23
- C(() => {
24
- r === !0 && c(s.defaultValue ?? "");
25
- }, [r, s.defaultValue]);
26
- const f = S(() => ({
18
+ }, ie = () => {
19
+ const { confirmTexts: e } = L(b), { isShown: r, text: t, onFinish: s } = te(), { options: n } = L(M), [o, c] = h(n.defaultValue ?? ""), l = E(() => {
20
+ s(null);
21
+ }, [s]), i = E((u) => {
22
+ u.preventDefault(), !(n.required && !o) && s(o);
23
+ }, [s, n.required, o]);
24
+ v(() => {
25
+ r === !0 && c(n.defaultValue ?? "");
26
+ }, [r, n.defaultValue]);
27
+ const g = C(() => ({
27
28
  value: o,
28
- onChange: (E) => c(E.currentTarget.value),
29
+ onChange: (u) => c(u.currentTarget.value),
29
30
  className: "w-100",
30
31
  autoFocus: !0,
31
32
  tabIndex: 0
32
33
  }), [o]);
33
- return /* @__PURE__ */ a.jsxs(v, { show: r, size: "sm", centered: !0, onHide: l, children: [
34
- /* @__PURE__ */ a.jsx(v.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(v.Title, { children: t }) }),
35
- /* @__PURE__ */ a.jsxs("form", { onSubmit: d, children: [
36
- /* @__PURE__ */ a.jsxs(v.Body, { children: [
37
- s.input === "textarea" ? /* @__PURE__ */ a.jsx("textarea", { ...f, rows: 5 }) : void 0,
38
- s.input === "input" ? /* @__PURE__ */ a.jsx(re, { ...f, type: s.type }) : void 0
34
+ return /* @__PURE__ */ a.jsxs(S, { show: r, size: "sm", centered: !0, onHide: l, children: [
35
+ /* @__PURE__ */ a.jsx(S.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(S.Title, { children: t }) }),
36
+ /* @__PURE__ */ a.jsxs("form", { onSubmit: i, children: [
37
+ /* @__PURE__ */ a.jsxs(S.Body, { children: [
38
+ n.input === "textarea" ? /* @__PURE__ */ a.jsx("textarea", { ...g, rows: 5 }) : void 0,
39
+ n.input === "input" ? /* @__PURE__ */ a.jsx(re, { ...g, type: n.type }) : void 0
39
40
  ] }),
40
- /* @__PURE__ */ a.jsxs(v.Footer, { className: "w-100 d-flex gap-5", children: [
41
- /* @__PURE__ */ a.jsx(O, { variant: "outlined", color: "secondary", onClick: l, className: "flex-grow-1", children: e.cancel }),
42
- /* @__PURE__ */ a.jsx(O, { color: "primary", disabled: s.required && !o, type: "submit", className: "flex-grow-1", children: e.confirm })
41
+ /* @__PURE__ */ a.jsxs(S.Footer, { className: "w-100 d-flex gap-5", children: [
42
+ /* @__PURE__ */ a.jsx(_, { variant: "outlined", color: "secondary", onClick: l, className: "flex-grow-1", children: e.cancel }),
43
+ /* @__PURE__ */ a.jsx(_, { color: "primary", disabled: n.required && !o, type: "submit", className: "flex-grow-1", children: e.confirm })
43
44
  ] })
44
45
  ] })
45
46
  ] });
46
- }, ie = ({ children: e }) => {
47
- const [r, t] = h(!1), [n, s] = h(""), [o, c] = h({ input: "textarea", type: "text" }), l = Z(() => {
48
- }), d = m((y) => {
49
- s(y), t(!0);
50
- }, []), f = m(() => {
47
+ }, ue = ({ children: e }) => {
48
+ const [r, t] = h(!1), [s, n] = h(""), [o, c] = h({ input: "textarea", type: "text" }), l = K(() => {
49
+ }), i = E((T) => {
50
+ n(T), t(!0);
51
+ }, []), g = E(() => {
51
52
  t(!1);
52
- }, []), E = S(() => ({
53
+ }, []), u = C(() => ({
53
54
  isShown: r,
54
- text: n,
55
- showPrompt: d,
56
- hidePrompt: f,
55
+ text: s,
56
+ showPrompt: i,
57
+ hidePrompt: g,
57
58
  resolveRef: l,
58
59
  options: o,
59
60
  setOptions: c
60
- }), [r, n, d, f, o]);
61
- return /* @__PURE__ */ a.jsxs(M.Provider, { value: E, children: [
61
+ }), [r, s, i, g, o]);
62
+ return /* @__PURE__ */ a.jsxs(M.Provider, { value: u, children: [
62
63
  e,
63
- /* @__PURE__ */ a.jsx(le, {})
64
+ /* @__PURE__ */ a.jsx(ie, {})
64
65
  ] });
65
- }, Ie = ({ cookieDomain: e, axiosOptions: r, LinkComponent: t, NavigateComponent: n, language: s, axiosTexts: o, confirmTexts: c, formValidationTexts: l, homeDashboardTexts: d, formSubmitTexts: f, appSearchTexts: E, customSelectTexts: y, errorBoundaryTexts: R, widgetTexts: I, children: P }) => {
66
- const _ = S(() => ({
66
+ }, Ne = ({ cookieDomain: e, axiosOptions: r, LinkComponent: t, NavigateComponent: s, language: n, axiosTexts: o, confirmTexts: c, formValidationTexts: l, homeDashboardTexts: i, formSubmitTexts: g, appSearchTexts: u, customSelectTexts: T, errorBoundaryTexts: y, widgetTexts: I, children: P }) => {
67
+ const p = C(() => ({
67
68
  axiosOptions: r,
68
69
  cookieDomain: e,
69
70
  LinkComponent: t,
70
- NavigateComponent: n,
71
- language: s,
71
+ NavigateComponent: s,
72
+ language: n,
72
73
  axiosTexts: o,
73
74
  confirmTexts: c,
74
75
  formValidationTexts: l,
75
- homeDashboardTexts: d,
76
- formSubmitTexts: f,
77
- appSearchTexts: E,
78
- customSelectTexts: y,
79
- errorBoundaryTexts: R,
76
+ homeDashboardTexts: i,
77
+ formSubmitTexts: g,
78
+ appSearchTexts: u,
79
+ customSelectTexts: T,
80
+ errorBoundaryTexts: y,
80
81
  widgetTexts: I
81
82
  }), [
82
83
  r,
83
84
  e,
84
85
  t,
85
- n,
86
86
  s,
87
+ n,
87
88
  o,
88
89
  c,
89
90
  l,
90
- d,
91
- f,
92
- E,
91
+ i,
92
+ g,
93
+ u,
94
+ T,
93
95
  y,
94
- R,
95
96
  I
96
97
  ]);
97
- return /* @__PURE__ */ a.jsx(j.Provider, { value: _, children: /* @__PURE__ */ a.jsx(ce, { children: /* @__PURE__ */ a.jsxs(ie, { children: [
98
- /* @__PURE__ */ a.jsx(H, {}),
98
+ return /* @__PURE__ */ a.jsx(b.Provider, { value: p, children: /* @__PURE__ */ a.jsx(le, { children: /* @__PURE__ */ a.jsxs(ue, { children: [
99
+ /* @__PURE__ */ a.jsx(q, {}),
99
100
  P
100
101
  ] }) }) });
101
- }, Pe = ({ children: e }) => {
102
- const [r, t] = h(!1), [n] = h(/* @__PURE__ */ new Set()), s = m((l) => {
103
- n.add(l), t(!0);
104
- }, [n]), o = m((l) => {
105
- n.delete(l), n.size === 0 && t(!1);
106
- }, [n]), c = S(() => ({ isLoading: r, startLoading: s, stopLoading: o }), [r, s, o]);
107
- return /* @__PURE__ */ a.jsxs(q.Provider, { value: c, children: [
102
+ }, Le = ({ children: e }) => {
103
+ const [r, t] = h(!1), [s] = h(/* @__PURE__ */ new Set()), n = E((l) => {
104
+ s.add(l), t(!0);
105
+ }, [s]), o = E((l) => {
106
+ s.delete(l), s.size === 0 && t(!1);
107
+ }, [s]), c = C(() => ({ isLoading: r, startLoading: n, stopLoading: o }), [r, n, o]);
108
+ return /* @__PURE__ */ a.jsxs(V.Provider, { value: c, children: [
108
109
  r && /* @__PURE__ */ a.jsx(ae, {}),
109
110
  e
110
111
  ] });
111
112
  };
112
113
  /*! @azure/msal-browser v3.14.0 2024-05-07 */
113
- class ue {
114
+ class de {
114
115
  /**
115
116
  * Gets interaction status from event message
116
117
  * @param message
@@ -118,40 +119,40 @@ class ue {
118
119
  */
119
120
  static getInteractionStatusFromEvent(r, t) {
120
121
  switch (r.eventType) {
121
- case u.LOGIN_START:
122
- return i.Login;
123
- case u.SSO_SILENT_START:
124
- return i.SsoSilent;
125
- case u.ACQUIRE_TOKEN_START:
126
- if (r.interactionType === p.Redirect || r.interactionType === p.Popup)
127
- return i.AcquireToken;
122
+ case f.LOGIN_START:
123
+ return d.Login;
124
+ case f.SSO_SILENT_START:
125
+ return d.SsoSilent;
126
+ case f.ACQUIRE_TOKEN_START:
127
+ if (r.interactionType === O.Redirect || r.interactionType === O.Popup)
128
+ return d.AcquireToken;
128
129
  break;
129
- case u.HANDLE_REDIRECT_START:
130
- return i.HandleRedirect;
131
- case u.LOGOUT_START:
132
- return i.Logout;
133
- case u.SSO_SILENT_SUCCESS:
134
- case u.SSO_SILENT_FAILURE:
135
- if (t && t !== i.SsoSilent)
130
+ case f.HANDLE_REDIRECT_START:
131
+ return d.HandleRedirect;
132
+ case f.LOGOUT_START:
133
+ return d.Logout;
134
+ case f.SSO_SILENT_SUCCESS:
135
+ case f.SSO_SILENT_FAILURE:
136
+ if (t && t !== d.SsoSilent)
136
137
  break;
137
- return i.None;
138
- case u.LOGOUT_END:
139
- if (t && t !== i.Logout)
138
+ return d.None;
139
+ case f.LOGOUT_END:
140
+ if (t && t !== d.Logout)
140
141
  break;
141
- return i.None;
142
- case u.HANDLE_REDIRECT_END:
143
- if (t && t !== i.HandleRedirect)
142
+ return d.None;
143
+ case f.HANDLE_REDIRECT_END:
144
+ if (t && t !== d.HandleRedirect)
144
145
  break;
145
- return i.None;
146
- case u.LOGIN_SUCCESS:
147
- case u.LOGIN_FAILURE:
148
- case u.ACQUIRE_TOKEN_SUCCESS:
149
- case u.ACQUIRE_TOKEN_FAILURE:
150
- case u.RESTORE_FROM_BFCACHE:
151
- if (r.interactionType === p.Redirect || r.interactionType === p.Popup) {
152
- if (t && t !== i.Login && t !== i.AcquireToken)
146
+ return d.None;
147
+ case f.LOGIN_SUCCESS:
148
+ case f.LOGIN_FAILURE:
149
+ case f.ACQUIRE_TOKEN_SUCCESS:
150
+ case f.ACQUIRE_TOKEN_FAILURE:
151
+ case f.RESTORE_FROM_BFCACHE:
152
+ if (r.interactionType === O.Redirect || r.interactionType === O.Popup) {
153
+ if (t && t !== d.Login && t !== d.AcquireToken)
153
154
  break;
154
- return i.None;
155
+ return d.None;
155
156
  }
156
157
  break;
157
158
  }
@@ -159,66 +160,66 @@ class ue {
159
160
  }
160
161
  }
161
162
  /*! @azure/msal-react v2.0.16 2024-05-07 */
162
- const de = "@azure/msal-react", G = "2.0.16";
163
+ const fe = "@azure/msal-react", G = "2.0.16";
163
164
  /*! @azure/msal-react v2.0.16 2024-05-07 */
164
- const b = {
165
+ const w = {
165
166
  UNBLOCK_INPROGRESS: "UNBLOCK_INPROGRESS",
166
167
  EVENT: "EVENT"
167
- }, fe = (e, r) => {
168
- const { type: t, payload: n } = r;
169
- let s = e.inProgress;
168
+ }, me = (e, r) => {
169
+ const { type: t, payload: s } = r;
170
+ let n = e.inProgress;
170
171
  switch (t) {
171
- case b.UNBLOCK_INPROGRESS:
172
- e.inProgress === i.Startup && (s = i.None, n.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
172
+ case w.UNBLOCK_INPROGRESS:
173
+ e.inProgress === d.Startup && (n = d.None, s.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
173
174
  break;
174
- case b.EVENT:
175
- const c = n.message, l = ue.getInteractionStatusFromEvent(c, e.inProgress);
176
- l && (n.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${l}`), s = l);
175
+ case w.EVENT:
176
+ const c = s.message, l = de.getInteractionStatusFromEvent(c, e.inProgress);
177
+ l && (s.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${l}`), n = l);
177
178
  break;
178
179
  default:
179
180
  throw new Error(`Unknown action type: ${t}`);
180
181
  }
181
- const o = n.instance.getAllAccounts();
182
- return s !== e.inProgress && !D(o, e.accounts) ? {
182
+ const o = s.instance.getAllAccounts();
183
+ return n !== e.inProgress && !D(o, e.accounts) ? {
183
184
  ...e,
184
- inProgress: s,
185
+ inProgress: n,
185
186
  accounts: o
186
- } : s !== e.inProgress ? {
187
+ } : n !== e.inProgress ? {
187
188
  ...e,
188
- inProgress: s
189
+ inProgress: n
189
190
  } : D(o, e.accounts) ? e : {
190
191
  ...e,
191
192
  accounts: o
192
193
  };
193
194
  };
194
195
  function ge({ instance: e, children: r }) {
195
- C(() => {
196
- e.initializeWrapperLibrary(V.React, G);
196
+ v(() => {
197
+ e.initializeWrapperLibrary($.React, G);
197
198
  }, [e]);
198
- const t = S(() => e.getLogger().clone(de, G), [e]), [n, s] = ee(fe, void 0, () => ({
199
- inProgress: i.Startup,
199
+ const t = C(() => e.getLogger().clone(fe, G), [e]), [s, n] = ee(me, void 0, () => ({
200
+ inProgress: d.Startup,
200
201
  accounts: e.getAllAccounts()
201
202
  }));
202
- C(() => {
203
+ v(() => {
203
204
  const c = e.addEventCallback((l) => {
204
- s({
205
+ n({
205
206
  payload: {
206
207
  instance: e,
207
208
  logger: t,
208
209
  message: l
209
210
  },
210
- type: b.EVENT
211
+ type: w.EVENT
211
212
  });
212
213
  });
213
214
  return t.verbose(`MsalProvider - Registered event callback with id: ${c}`), e.initialize().then(() => {
214
215
  e.handleRedirectPromise().catch(() => {
215
216
  }).finally(() => {
216
- s({
217
+ n({
217
218
  payload: {
218
219
  instance: e,
219
220
  logger: t
220
221
  },
221
- type: b.UNBLOCK_INPROGRESS
222
+ type: w.UNBLOCK_INPROGRESS
222
223
  });
223
224
  });
224
225
  }).catch(() => {
@@ -228,158 +229,167 @@ function ge({ instance: e, children: r }) {
228
229
  }, [e, t]);
229
230
  const o = {
230
231
  instance: e,
231
- inProgress: n.inProgress,
232
- accounts: n.accounts,
232
+ inProgress: s.inProgress,
233
+ accounts: s.accounts,
233
234
  logger: t
234
235
  };
235
- return Y.createElement($.Provider, { value: o }, r);
236
+ return Z.createElement(Q.Provider, { value: o }, r);
236
237
  }
237
- const Le = ({ children: e }) => {
238
- const r = Q(), { msalInstance: t } = N(F), { delegation: n, setDelegation: s, setAvailableDelegations: o, refreshAvailableDelegations: c } = N(z), { getToken: l } = J(), [d, f] = h(null), E = m(async () => {
239
- const g = await l();
240
- g && f(g);
238
+ const Te = ({ children: e }) => {
239
+ const r = J(), { msalInstance: t } = L(F), { delegation: s, setDelegation: n, setAvailableDelegations: o, refreshAvailableDelegations: c } = L(z), { getToken: l } = W(), [i, g] = h(null), u = E(async () => {
240
+ const m = await l();
241
+ m && g(m);
241
242
  }, [l]);
242
- C(() => {
243
- E();
244
- }, [E]);
245
- const R = m(() => {
246
- const g = localStorage.getItem("user") ?? null;
247
- return g ? JSON.parse(g ?? "") : null;
243
+ v(() => {
244
+ u();
245
+ }, [u]);
246
+ const y = E(() => {
247
+ const m = localStorage.getItem("user") ?? null;
248
+ return m ? JSON.parse(m ?? "") : null;
248
249
  }, [])(), [I, P] = h({
249
- state: R ? L.LOGGED_IN : L.LOGGING_IN,
250
- user: R
251
- }), _ = m(async (g) => {
250
+ state: y ? N.LOGGED_IN : N.LOGGING_IN,
251
+ user: y
252
+ }), p = E(async (m) => {
252
253
  let x = null;
253
- return await r.get("/user/detail", g ? { headers: { Authorization: `Bearer ${g}` } } : void 0).then((U) => {
254
- x = U.data;
254
+ return await r.get("/user/detail", m ? { headers: { Authorization: `Bearer ${m}` } } : void 0).then((j) => {
255
+ x = j.data;
255
256
  }).catch(() => {
256
257
  x = null;
257
258
  }), x;
258
- }, [r]), k = m(() => {
259
+ }, [r]), k = E(() => {
259
260
  localStorage.removeItem("user"), P({
260
- state: L.LOGGED_OUT,
261
+ state: N.LOGGED_OUT,
261
262
  user: null
262
- }), s(null), o(null);
263
- }, [o, s]), T = m(async (g) => {
263
+ }), n(null), o(null);
264
+ }, [o, n]), R = E(async (m) => {
264
265
  P({
265
- state: L.LOGGING_IN,
266
+ state: N.LOGGING_IN,
266
267
  user: null
267
268
  });
268
- const x = await _(g);
269
+ const x = await p(m);
269
270
  return x ? (P({
270
- state: L.LOGGED_IN,
271
+ state: N.LOGGED_IN,
271
272
  user: x
272
- }), localStorage.setItem("user", JSON.stringify(x)), !0) : (P({
273
- state: L.LOGIN_FAILED,
273
+ }), localStorage.setItem("user", JSON.stringify(x)), await c(), !0) : (P({
274
+ state: N.LOGIN_FAILED,
274
275
  user: null
275
276
  }), !1);
276
- }, [_]), A = m(() => {
277
+ }, [p, c]), A = E(() => {
277
278
  k();
278
- }, [k]), K = S(() => ({
279
- user: I.user,
280
- userLoginState: I,
281
- loginUser: T,
282
- logoutUser: A
283
- }), [I, T, A]);
284
- C(() => {
279
+ }, [k]);
280
+ v(() => {
285
281
  if (t) {
286
- const g = t.addEventCallback((x) => {
287
- if (x.eventType === u.LOGIN_SUCCESS && x.payload) {
288
- const U = x.payload;
289
- f(U.accessToken);
282
+ const m = t.addEventCallback((x) => {
283
+ if (x.eventType === f.LOGIN_SUCCESS && x.payload) {
284
+ const j = x.payload;
285
+ g(j.accessToken);
290
286
  }
291
287
  });
292
288
  return () => {
293
- g && t.removeEventCallback(g);
289
+ m && t.removeEventCallback(m);
294
290
  };
295
291
  }
296
292
  return () => {
297
293
  };
298
- }, [t, T, A]);
299
- const w = m(async (g) => {
300
- g && (await T(g).catch(() => {
301
- A(), s(null);
302
- }), await c());
303
- }, [T, A, c, s]);
304
- return C(() => {
305
- w(d);
306
- }, [d, n == null ? void 0 : n.id, w]), /* @__PURE__ */ a.jsx(W.Provider, { value: K, children: e });
307
- }, Ne = ({ ...e }) => {
308
- const { cookieDomain: r } = N(j), [, t] = X(["Authorization"]), n = S(() => ({
294
+ }, [t, R, A]);
295
+ const U = E(async (m) => {
296
+ m && await R(m).catch(() => {
297
+ A(), n(null);
298
+ });
299
+ }, [R, A, n]);
300
+ v(() => {
301
+ U(i);
302
+ }, [i, s == null ? void 0 : s.id, U]);
303
+ const B = C(() => ({
304
+ user: I.user,
305
+ userLoginState: I,
306
+ loginUser: R,
307
+ logoutUser: A
308
+ }), [I, R, A]);
309
+ return /* @__PURE__ */ a.jsx(X.Provider, { value: B, children: e });
310
+ }, ye = ({ ...e }) => {
311
+ const { cookieDomain: r } = L(b), [, t] = Y(["Authorization"]), s = C(() => ({
309
312
  useMsal: e.useMsal ?? !1,
310
313
  msalInstance: e.useMsal ? e.msalInstance ?? null : null,
311
314
  msalScopes: e.useMsal ? e.msalScopes ?? [] : []
312
315
  }), [e]);
313
- return C(() => {
316
+ return v(() => {
314
317
  if (e.useMsal) {
315
- const s = e.msalInstance.addEventCallback((o) => {
316
- if (o.eventType === u.LOGIN_SUCCESS || o.eventType === u.ACQUIRE_TOKEN_SUCCESS && o.payload) {
318
+ const n = e.msalInstance.addEventCallback((o) => {
319
+ if (o.eventType === f.LOGIN_SUCCESS || o.eventType === f.ACQUIRE_TOKEN_SUCCESS && o.payload) {
317
320
  const c = o.payload, l = c.account;
318
321
  e.msalInstance.setActiveAccount(l);
319
- const d = c.accessToken, f = c.expiresOn;
320
- t("Authorization", d, {
322
+ const i = c.accessToken, g = c.expiresOn;
323
+ t("Authorization", i, {
321
324
  path: "/",
322
325
  secure: !0,
323
326
  sameSite: "none",
324
327
  domain: r,
325
- expires: f ?? void 0
328
+ expires: g ?? void 0
326
329
  });
327
330
  }
328
331
  o.error && console.error("AuthProvider MSAL Error", o);
329
332
  });
330
333
  return () => {
331
- s && e.msalInstance.removeEventCallback(s);
334
+ n && e.msalInstance.removeEventCallback(n);
332
335
  };
333
336
  }
334
337
  return () => {
335
338
  };
336
- }, [e, t, r]), /* @__PURE__ */ a.jsx(F.Provider, { value: n, children: e.useMsal ? /* @__PURE__ */ a.jsx(ge, { instance: e.msalInstance, children: e.children }) : e.children });
337
- }, ye = ({ children: e, relativeEndpoint: r }) => {
338
- const [t, n, s] = se("user-delegation", null), { data: o, setData: c, reloadData: l } = ne(r, {
339
+ }, [e, t, r]), /* @__PURE__ */ a.jsx(F.Provider, { value: s, children: e.useMsal ? /* @__PURE__ */ a.jsx(ge, { instance: e.msalInstance, children: e.children }) : e.children });
340
+ }, Re = ({ children: e, relativeEndpoint: r }) => {
341
+ const [t, s, n] = ne("user-delegation", null), { data: o, setData: c, reloadData: l } = se(r, {
339
342
  nullStateBeforeLoad: !1,
340
343
  nullStateOnFail: !0
341
- });
342
- C(() => {
343
- const f = () => {
344
- s();
344
+ }), i = K(null);
345
+ v(() => {
346
+ const u = () => {
347
+ l(), i.current = window.setTimeout(u, ce() + 5e3);
348
+ };
349
+ return u(), () => {
350
+ i.current !== null && window.clearTimeout(i.current);
345
351
  };
346
- return window.addEventListener("focus", f), () => {
347
- window.removeEventListener("focus", f);
352
+ }, [l]), v(() => {
353
+ const u = () => {
354
+ n();
348
355
  };
349
- }, [s]);
350
- const d = S(() => ({
356
+ return window.addEventListener("focus", u), () => {
357
+ window.removeEventListener("focus", u);
358
+ };
359
+ }, [n, l]);
360
+ const g = C(() => ({
351
361
  delegation: t,
352
- setDelegation: n,
362
+ setDelegation: s,
353
363
  availableDelegations: o,
354
364
  setAvailableDelegations: c,
355
365
  refreshAvailableDelegations: l
356
366
  }), [
357
367
  t,
358
- n,
368
+ s,
359
369
  o,
360
370
  c,
361
371
  l
362
372
  ]);
363
- return /* @__PURE__ */ a.jsx(z.Provider, { value: d, children: e });
364
- }, me = () => {
365
- const { confirmTexts: e } = N(j), { onConfirm: r, onCancel: t, text: n, show: s } = oe();
366
- return /* @__PURE__ */ a.jsxs(v, { show: s, size: "sm", centered: !0, onHide: t, children: [
367
- /* @__PURE__ */ a.jsx(v.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(v.Title, { children: n }) }),
368
- /* @__PURE__ */ a.jsx(v.Body, { children: /* @__PURE__ */ a.jsxs("div", { className: "w-100 d-flex gap-5", children: [
369
- /* @__PURE__ */ a.jsx(O, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: t, children: e.no }),
370
- /* @__PURE__ */ a.jsx(O, { type: "button", color: "primary", onClick: r, className: "w-100 ml", children: e.yes })
373
+ return /* @__PURE__ */ a.jsx(z.Provider, { value: g, children: e });
374
+ }, Ee = () => {
375
+ const { confirmTexts: e } = L(b), { onConfirm: r, onCancel: t, text: s, show: n } = oe();
376
+ return /* @__PURE__ */ a.jsxs(S, { show: n, size: "sm", centered: !0, onHide: t, children: [
377
+ /* @__PURE__ */ a.jsx(S.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(S.Title, { children: s }) }),
378
+ /* @__PURE__ */ a.jsx(S.Body, { children: /* @__PURE__ */ a.jsxs("div", { className: "w-100 d-flex gap-5", children: [
379
+ /* @__PURE__ */ a.jsx(_, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: t, children: e.no }),
380
+ /* @__PURE__ */ a.jsx(_, { type: "button", color: "primary", onClick: r, className: "w-100 ml", children: e.yes })
371
381
  ] }) })
372
382
  ] });
373
383
  };
374
384
  export {
375
385
  F as AuthContext,
376
- Ne as AuthProvider,
386
+ ye as AuthProvider,
377
387
  z as DelegationContext,
378
- ye as DelegationProvider,
379
- q as LoadingContext,
380
- Pe as LoadingProvider,
381
- j as LuminusComponentsContext,
382
- Ie as LuminusComponentsProvider,
383
- W as UserContext,
384
- Le as UserProvider
388
+ Re as DelegationProvider,
389
+ V as LoadingContext,
390
+ Le as LoadingProvider,
391
+ b as LuminusComponentsContext,
392
+ Ne as LuminusComponentsProvider,
393
+ X as UserContext,
394
+ Te as UserProvider
385
395
  };
@@ -1,6 +1,6 @@
1
- import { b as m, g as D } from "./latinize-BQrinury.js";
2
- function N(t, e) {
3
- const n = w(t);
1
+ import { b as d, g as D } from "./latinize-BQrinury.js";
2
+ function p(t, e) {
3
+ const n = U(t);
4
4
  let a;
5
5
  if (n.date) {
6
6
  const i = h(n.date, 2);
@@ -34,8 +34,8 @@ const f = {
34
34
  dateTimeDelimiter: /[T ]/,
35
35
  timeZoneDelimiter: /[Z ]/i,
36
36
  timezone: /([Z+-].*)$/
37
- }, g = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, T = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, U = /^([+-])(\d{2})(?::?(\d{2}))?$/;
38
- function w(t) {
37
+ }, g = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, T = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, w = /^([+-])(\d{2})(?::?(\d{2}))?$/;
38
+ function U(t) {
39
39
  const e = {}, r = t.split(f.dateTimeDelimiter);
40
40
  let n;
41
41
  if (r.length > 2)
@@ -69,10 +69,10 @@ function C(t, e) {
69
69
  return /* @__PURE__ */ new Date(NaN);
70
70
  const n = !!r[4], a = l(r[1]), s = l(r[2]) - 1, o = l(r[3]), u = l(r[4]), i = l(r[5]) - 1;
71
71
  if (n)
72
- return M(e, u, i) ? Y(e, u, i) : /* @__PURE__ */ new Date(NaN);
72
+ return S(e, u, i) ? y(e, u, i) : /* @__PURE__ */ new Date(NaN);
73
73
  {
74
74
  const c = /* @__PURE__ */ new Date(0);
75
- return !z(e, s, o) || !O(e, a) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(e, s, Math.max(a, o)), c);
75
+ return !Y(e, s, o) || !z(e, a) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(e, s, Math.max(a, o)), c);
76
76
  }
77
77
  }
78
78
  function l(t) {
@@ -82,50 +82,55 @@ function I(t) {
82
82
  const e = t.match(T);
83
83
  if (!e)
84
84
  return NaN;
85
- const r = d(e[1]), n = d(e[2]), a = d(e[3]);
86
- return S(r, n, a) ? r * m + n * D + a * 1e3 : NaN;
85
+ const r = m(e[1]), n = m(e[2]), a = m(e[3]);
86
+ return M(r, n, a) ? r * d + n * D + a * 1e3 : NaN;
87
87
  }
88
- function d(t) {
88
+ function m(t) {
89
89
  return t && parseFloat(t.replace(",", ".")) || 0;
90
90
  }
91
91
  function x(t) {
92
92
  if (t === "Z")
93
93
  return 0;
94
- const e = t.match(U);
94
+ const e = t.match(w);
95
95
  if (!e)
96
96
  return 0;
97
97
  const r = e[1] === "+" ? -1 : 1, n = parseInt(e[2]), a = e[3] && parseInt(e[3]) || 0;
98
- return Z(n, a) ? r * (n * m + a * D) : NaN;
98
+ return Z(n, a) ? r * (n * d + a * D) : NaN;
99
99
  }
100
- function Y(t, e, r) {
100
+ function y(t, e, r) {
101
101
  const n = /* @__PURE__ */ new Date(0);
102
102
  n.setUTCFullYear(t, 0, 4);
103
103
  const a = n.getUTCDay() || 7, s = (e - 1) * 7 + r + 1 - a;
104
104
  return n.setUTCDate(n.getUTCDate() + s), n;
105
105
  }
106
- const y = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
107
- function p(t) {
106
+ const O = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
107
+ function N(t) {
108
108
  return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
109
109
  }
110
- function z(t, e, r) {
111
- return e >= 0 && e <= 11 && r >= 1 && r <= (y[e] || (p(t) ? 29 : 28));
110
+ function Y(t, e, r) {
111
+ return e >= 0 && e <= 11 && r >= 1 && r <= (O[e] || (N(t) ? 29 : 28));
112
112
  }
113
- function O(t, e) {
114
- return e >= 1 && e <= (p(t) ? 366 : 365);
113
+ function z(t, e) {
114
+ return e >= 1 && e <= (N(t) ? 366 : 365);
115
115
  }
116
- function M(t, e, r) {
116
+ function S(t, e, r) {
117
117
  return e >= 1 && e <= 53 && r >= 0 && r <= 6;
118
118
  }
119
- function S(t, e, r) {
119
+ function M(t, e, r) {
120
120
  return t === 24 ? e === 0 && r === 0 : r >= 0 && r < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
121
121
  }
122
122
  function Z(t, e) {
123
123
  return e >= 0 && e <= 59;
124
124
  }
125
125
  const F = (t) => {
126
- const e = N(t);
126
+ const e = p(t);
127
127
  return !Number.isNaN(e.getTime());
128
128
  };
129
+ function R() {
130
+ const t = /* @__PURE__ */ new Date(), e = new Date(t);
131
+ return e.setHours(24, 0, 0, 0), e.getTime() - t.getTime();
132
+ }
129
133
  export {
130
- F as i
134
+ F as i,
135
+ R as m
131
136
  };
@@ -1 +1 @@
1
- "use strict";const d=require("./latinize-DaqzUOla.cjs");function N(t,e){const n=I(t);let i;if(n.date){const s=U(n.date,2);i=w(s.restDateString,s.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const a=i.getTime();let o=0,u;if(n.time&&(o=h(n.time),isNaN(o)))return new Date(NaN);if(n.timezone){if(u=C(n.timezone),isNaN(u))return new Date(NaN)}else{const s=new Date(a+o),c=new Date(0);return c.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),c.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),c}return new Date(a+o+u)}const f={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},p=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,g=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,T=/^([+-])(\d{2})(?::?(\d{2}))?$/;function I(t){const e={},r=t.split(f.dateTimeDelimiter);let n;if(r.length>2)return e;if(/:/.test(r[0])?n=r[0]:(e.date=r[0],n=r[1],f.timeZoneDelimiter.test(e.date)&&(e.date=t.split(f.timeZoneDelimiter)[0],n=t.substr(e.date.length,t.length))),n){const i=f.timezone.exec(n);i?(e.time=n.replace(i[1],""),e.timezone=i[1]):e.time=n}return e}function U(t,e){const r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(r);if(!n)return{year:NaN,restDateString:""};const i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:a===null?i:a*100,restDateString:t.slice((n[1]||n[2]).length)}}function w(t,e){if(e===null)return new Date(NaN);const r=t.match(p);if(!r)return new Date(NaN);const n=!!r[4],i=l(r[1]),a=l(r[2])-1,o=l(r[3]),u=l(r[4]),s=l(r[5])-1;if(n)return O(e,u,s)?Y(e,u,s):new Date(NaN);{const c=new Date(0);return!y(e,a,o)||!z(e,i)?new Date(NaN):(c.setUTCFullYear(e,a,Math.max(i,o)),c)}}function l(t){return t?parseInt(t):1}function h(t){const e=t.match(g);if(!e)return NaN;const r=m(e[1]),n=m(e[2]),i=m(e[3]);return M(r,n,i)?r*d.millisecondsInHour+n*d.millisecondsInMinute+i*1e3:NaN}function m(t){return t&&parseFloat(t.replace(",","."))||0}function C(t){if(t==="Z")return 0;const e=t.match(T);if(!e)return 0;const r=e[1]==="+"?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return S(n,i)?r*(n*d.millisecondsInHour+i*d.millisecondsInMinute):NaN}function Y(t,e,r){const n=new Date(0);n.setUTCFullYear(t,0,4);const i=n.getUTCDay()||7,a=(e-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+a),n}const x=[31,null,31,30,31,30,31,31,30,31,30,31];function D(t){return t%400===0||t%4===0&&t%100!==0}function y(t,e,r){return e>=0&&e<=11&&r>=1&&r<=(x[e]||(D(t)?29:28))}function z(t,e){return e>=1&&e<=(D(t)?366:365)}function O(t,e,r){return e>=1&&e<=53&&r>=0&&r<=6}function M(t,e,r){return t===24?e===0&&r===0:r>=0&&r<60&&e>=0&&e<60&&t>=0&&t<25}function S(t,e){return e>=0&&e<=59}const Z=t=>{const e=N(t);return!Number.isNaN(e.getTime())};exports.isISODate=Z;
1
+ "use strict";const d=require("./latinize-DaqzUOla.cjs");function N(t,e){const n=w(t);let i;if(n.date){const s=I(n.date,2);i=U(s.restDateString,s.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const a=i.getTime();let o=0,u;if(n.time&&(o=h(n.time),isNaN(o)))return new Date(NaN);if(n.timezone){if(u=C(n.timezone),isNaN(u))return new Date(NaN)}else{const s=new Date(a+o),c=new Date(0);return c.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),c.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),c}return new Date(a+o+u)}const f={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},p=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,g=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,T=/^([+-])(\d{2})(?::?(\d{2}))?$/;function w(t){const e={},r=t.split(f.dateTimeDelimiter);let n;if(r.length>2)return e;if(/:/.test(r[0])?n=r[0]:(e.date=r[0],n=r[1],f.timeZoneDelimiter.test(e.date)&&(e.date=t.split(f.timeZoneDelimiter)[0],n=t.substr(e.date.length,t.length))),n){const i=f.timezone.exec(n);i?(e.time=n.replace(i[1],""),e.timezone=i[1]):e.time=n}return e}function I(t,e){const r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(r);if(!n)return{year:NaN,restDateString:""};const i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:a===null?i:a*100,restDateString:t.slice((n[1]||n[2]).length)}}function U(t,e){if(e===null)return new Date(NaN);const r=t.match(p);if(!r)return new Date(NaN);const n=!!r[4],i=l(r[1]),a=l(r[2])-1,o=l(r[3]),u=l(r[4]),s=l(r[5])-1;if(n)return Y(e,u,s)?x(e,u,s):new Date(NaN);{const c=new Date(0);return!O(e,a,o)||!S(e,i)?new Date(NaN):(c.setUTCFullYear(e,a,Math.max(i,o)),c)}}function l(t){return t?parseInt(t):1}function h(t){const e=t.match(g);if(!e)return NaN;const r=m(e[1]),n=m(e[2]),i=m(e[3]);return z(r,n,i)?r*d.millisecondsInHour+n*d.millisecondsInMinute+i*1e3:NaN}function m(t){return t&&parseFloat(t.replace(",","."))||0}function C(t){if(t==="Z")return 0;const e=t.match(T);if(!e)return 0;const r=e[1]==="+"?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return M(n,i)?r*(n*d.millisecondsInHour+i*d.millisecondsInMinute):NaN}function x(t,e,r){const n=new Date(0);n.setUTCFullYear(t,0,4);const i=n.getUTCDay()||7,a=(e-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+a),n}const y=[31,null,31,30,31,30,31,31,30,31,30,31];function D(t){return t%400===0||t%4===0&&t%100!==0}function O(t,e,r){return e>=0&&e<=11&&r>=1&&r<=(y[e]||(D(t)?29:28))}function S(t,e){return e>=1&&e<=(D(t)?366:365)}function Y(t,e,r){return e>=1&&e<=53&&r>=0&&r<=6}function z(t,e,r){return t===24?e===0&&r===0:r>=0&&r<60&&e>=0&&e<60&&t>=0&&t<25}function M(t,e){return e>=0&&e<=59}const Z=t=>{const e=N(t);return!Number.isNaN(e.getTime())};function k(){const t=new Date,e=new Date(t);return e.setHours(24,0,0,0),e.getTime()-t.getTime()}exports.isISODate=Z;exports.msToStartOfNextDay=k;
package/dist/hooks.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("./UserAvatarToggle-DYIBvTYX.cjs"),Te=require("./useLocalStorageState-CxsNjf78.cjs"),Oe=require("react"),He=require("./latinize-DaqzUOla.cjs"),Ke=require("./dateUtils-DUA3CKds.cjs");require("react-hook-form");const je=require("./useFormControlType-Dqz8sV4J.cjs"),Xe=require("./usePermissions-BEKIk6u3.cjs");var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.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},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Ne;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ne||(Ne={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),z=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},d=x.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"]),Qe=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class N extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||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(t(i));else{let o=n,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),n}static assert(e){if(!(e instanceof N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=r=>new N(r);const H=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let ze=H;function Fe(r){ze=r}function _e(){return ze}const ve=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const u=n.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},et=[];function l(r,e){const t=_e(),n=ve({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===H?void 0:H].filter(s=>!!s)});r.common.issues.push(n)}class S{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return p;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return S.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return p;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const p=Object.freeze({status:"aborted"}),Y=r=>({status:"dirty",value:r}),Z=r=>({status:"valid",value:r}),Ee=r=>r.status==="aborted",Re=r=>r.status==="dirty",te=r=>r.status==="valid",re=r=>typeof Promise<"u"&&r instanceof Promise;function ge(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function De(r,e,t,n,s){if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(h||(h={}));var F,ee;class A{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pe=(r,e)=>{if(te(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new N(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{var u,c;const{message:y}=r;return i.code==="invalid_enum_value"?{message:y??o.defaultError}:typeof o.data>"u"?{message:(u=y??n)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=y??t)!==null&&c!==void 0?c:o.defaultError}},description:s}}class v{constructor(e){this.spa=this.safeParseAsync,this._def=e,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)}get description(){return this._def.description}_getType(e){return z(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:z(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Pe(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:z(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(re(s)?s:Promise.resolve(s));return Pe(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new I({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return j.create(this,this._def)}nullable(){return q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return R.create(this,this._def)}promise(){return X.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new I({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new fe({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Ae({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new he({..._(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return pe.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const tt=/^c[^\s-]{8,}$/i,rt=/^[0-9a-z]+$/,nt=/^[0-9A-HJKMNP-TV-Z]{26}$/,st=/^[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,at=/^[a-z0-9_-]{21}$/i,it=/^[-+]?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)?)??$/,ot=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ce;const ct=/^(?:(?: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])$/,ut=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,lt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ve="((\\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])))",ft=new RegExp(`^${Ve}$`);function Le(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ht(r){return new RegExp(`^${Le(r)}$`)}function qe(r){let e=`${Ve}T${Le(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function mt(r,e){return!!((e==="v4"||!e)&&ct.test(r)||(e==="v6"||!e)&&ut.test(r))}class E extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.string,received:a.parsedType}),p}const n=new S;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ot.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ce||(Ce=new RegExp(dt,"u")),Ce.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")st.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")at.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")tt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")rt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")nt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?qe(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ft.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ht(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?it.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?mt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?lt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...h.errToObj(n)})}_addCheck(e){return new E({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...h.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...h.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...h.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new E({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}E.create=r=>{var e;return new E({checks:[],typeName:m.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function pt(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class D extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.number,received:a.parsedType}),p}let n;const s=new S;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?pt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,n,s){return new D({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:h.toString(s)}]})}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}D.create=r=>new D({checks:[],typeName:m.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class V extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.bigint,received:a.parsedType}),p}let n;const s=new S;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,n,s){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:h.toString(s)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}V.create=r=>{var e;return new V({checks:[],typeName:m.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};class ne extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.boolean,received:n.parsedType}),p}return Z(e.data)}}ne.create=r=>new ne({typeName:m.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class B extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.date,received:a.parsedType}),p}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_date}),p}const n=new S;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}B.create=r=>new B({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:m.ZodDate,..._(r)});class xe extends v{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.symbol,received:n.parsedType}),p}return Z(e.data)}}xe.create=r=>new xe({typeName:m.ZodSymbol,..._(r)});class se extends v{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.undefined,received:n.parsedType}),p}return Z(e.data)}}se.create=r=>new se({typeName:m.ZodUndefined,..._(r)});class ae extends v{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.null,received:n.parsedType}),p}return Z(e.data)}}ae.create=r=>new ae({typeName:m.ZodNull,..._(r)});class K extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}K.create=r=>new K({typeName:m.ZodAny,..._(r)});class U extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}U.create=r=>new U({typeName:m.ZodUnknown,..._(r)});class $ extends v{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),p}}$.create=r=>new $({typeName:m.ZodNever,..._(r)});class ke extends v{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.void,received:n.parsedType}),p}return Z(e.data)}}ke.create=r=>new ke({typeName:m.ZodVoid,..._(r)});class R extends v{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return l(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),p;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?d.too_big:d.too_small,minimum:o?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&&t.data.length<s.minLength.value&&(l(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new A(t,i,t.path,o)))).then(i=>S.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new A(t,i,t.path,o)));return S.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new R({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new R({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new R({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}R.create=(r,e)=>new R({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function G(r){if(r instanceof k){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=j.create(G(n))}return new k({...r._def,shape:()=>e})}else return r instanceof R?new R({...r._def,type:G(r.element)}):r instanceof j?j.create(G(r.unwrap())):r instanceof q?q.create(G(r.unwrap())):r instanceof M?M.create(r.items.map(e=>G(e))):r}class k extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const c=this._getOrReturnCtx(e);return l(c,{code:d.invalid_type,expected:f.object,received:c.parsedType}),p}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const c in s.data)i.includes(c)||o.push(c);const u=[];for(const c of i){const y=a[c],O=s.data[c];u.push({key:{status:"valid",value:c},value:y._parse(new A(s,O,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof $){const c=this._def.unknownKeys;if(c==="passthrough")for(const y of o)u.push({key:{status:"valid",value:y},value:{status:"valid",value:s.data[y]}});else if(c==="strict")o.length>0&&(l(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const y of o){const O=s.data[y];u.push({key:{status:"valid",value:y},value:c._parse(new A(s,O,s.path,y)),alwaysSet:y in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const y of u){const O=await y.key,Ze=await y.value;c.push({key:O,value:Ze,alwaysSet:y.alwaysSet})}return c}).then(c=>S.mergeObjectSync(n,c)):S.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=h.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof j;)a=a._def.innerType;t[n]=a}}),new k({...this._def,shape:()=>t})}keyof(){return Ue(x.objectKeys(this.shape))}}k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,..._(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:$.create(),typeName:m.ZodObject,..._(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,..._(e)});class ie extends v{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new N(o.ctx.common.issues));return l(t,{code:d.invalid_union,unionErrors:i}),p}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const u of n){const c={...t,common:{...t.common,issues:[]},parent:null},y=u._parseSync({data:t.data,path:t.path,parent:c});if(y.status==="valid")return y;y.status==="dirty"&&!a&&(a={result:y,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new N(u));return l(t,{code:d.invalid_union,unionErrors:o}),p}}get options(){return this._def.options}}ie.create=(r,e)=>new ie({options:r,typeName:m.ZodUnion,..._(e)});const P=r=>r instanceof ce?P(r.schema):r instanceof I?P(r.innerType()):r instanceof ue?[r.value]:r instanceof L?r.options:r instanceof le?x.objectValues(r.enum):r instanceof fe?P(r._def.innerType):r instanceof se?[void 0]:r instanceof ae?[null]:r instanceof j?[void 0,...P(r.unwrap())]:r instanceof q?[null,...P(r.unwrap())]:r instanceof Ae||r instanceof me?P(r.unwrap()):r instanceof he?P(r._def.innerType):[];class Se extends v{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),p;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=P(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Se({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}}function Ie(r,e){const t=z(r),n=z(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){const s=x.objectKeys(e),a=x.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const u=Ie(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],u=Ie(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class oe extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Ee(a)||Ee(i))return p;const o=Ie(a.value,i.value);return o.valid?((Re(a)||Re(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:d.invalid_intersection_types}),p)};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}))}}oe.create=(r,e,t)=>new oe({left:r,right:e,typeName:m.ZodIntersection,..._(t)});class M extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return l(n,{code:d.invalid_type,expected:f.array,received:n.parsedType}),p;if(n.data.length<this._def.items.length)return l(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new A(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>S.mergeArray(t,i)):S.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new M({...this._def,rest:e})}}M.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new M({items:r,typeName:m.ZodTuple,rest:null,..._(e)})};class de extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:d.invalid_type,expected:f.object,received:n.parsedType}),p;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new A(n,o,n.path,o)),value:i._parse(new A(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?S.mergeObjectAsync(t,s):S.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new de({keyType:e,valueType:t,typeName:m.ZodRecord,..._(n)}):new de({keyType:E.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}}class be extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return l(n,{code:d.invalid_type,expected:f.map,received:n.parsedType}),p;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],c)=>({key:s._parse(new A(n,o,n.path,[c,"key"])),value:a._parse(new A(n,u,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const c=await u.key,y=await u.value;if(c.status==="aborted"||y.status==="aborted")return p;(c.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(c.value,y.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const c=u.key,y=u.value;if(c.status==="aborted"||y.status==="aborted")return p;(c.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(c.value,y.value)}return{status:t.value,value:o}}}}be.create=(r,e,t)=>new be({valueType:e,keyType:r,typeName:m.ZodMap,..._(t)});class W extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return l(n,{code:d.invalid_type,expected:f.set,received:n.parsedType}),p;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const y of u){if(y.status==="aborted")return p;y.status==="dirty"&&t.dirty(),c.add(y.value)}return{status:t.value,value:c}}const o=[...n.data.values()].map((u,c)=>a._parse(new A(n,u,n.path,c)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new W({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new W({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}W.create=(r,e)=>new W({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});class J extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),p;function n(o,u){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(c=>!!c),issueData:{code:d.invalid_arguments,argumentsError:u}})}function s(o,u){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(c=>!!c),issueData:{code:d.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof X){const o=this;return Z(async function(...u){const c=new N([]),y=await o._def.args.parseAsync(u,a).catch(ye=>{throw c.addIssue(n(u,ye)),c}),O=await Reflect.apply(i,this,y);return await o._def.returns._def.type.parseAsync(O,a).catch(ye=>{throw c.addIssue(s(O,ye)),c})})}else{const o=this;return Z(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new N([n(u,c.error)]);const y=Reflect.apply(i,this,c.data),O=o._def.returns.safeParse(y,a);if(!O.success)throw new N([s(y,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new J({...this._def,args:M.create(e).rest(U.create())})}returns(e){return new J({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new J({args:e||M.create([]).rest(U.create()),returns:t||U.create(),typeName:m.ZodFunction,..._(n)})}}class ce extends v{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ce.create=(r,e)=>new ce({getter:r,typeName:m.ZodLazy,..._(e)});class ue extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}ue.create=(r,e)=>new ue({value:r,typeName:m.ZodLiteral,..._(e)});function Ue(r,e){return new L({values:r,typeName:m.ZodEnum,..._(e)})}class L extends v{constructor(){super(...arguments),F.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:x.joinValues(n),received:t.parsedType,code:d.invalid_type}),p}if(ge(this,F)||De(this,F,new Set(this._def.values)),!ge(this,F).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:d.invalid_enum_value,options:n}),p}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return L.create(e,{...this._def,...t})}exclude(e,t=this._def){return L.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}F=new WeakMap;L.create=Ue;class le extends v{constructor(){super(...arguments),ee.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const s=x.objectValues(t);return l(n,{expected:x.joinValues(s),received:n.parsedType,code:d.invalid_type}),p}if(ge(this,ee)||De(this,ee,new Set(x.getValidEnumValues(this._def.values))),!ge(this,ee).has(e.data)){const s=x.objectValues(t);return l(n,{received:n.data,code:d.invalid_enum_value,options:s}),p}return Z(e.data)}get enum(){return this._def.values}}ee=new WeakMap;le.create=(r,e)=>new le({values:r,typeName:m.ZodNativeEnum,..._(e)});class X extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:d.invalid_type,expected:f.promise,received:t.parsedType}),p;const n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}X.create=(r,e)=>new X({type:r,typeName:m.ZodPromise,..._(e)});class I extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?t.abort():t.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 o=>{if(t.value==="aborted")return p;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?p:u.status==="dirty"||t.value==="dirty"?Y(u.value):u});{if(t.value==="aborted")return p;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?p:o.status==="dirty"||t.value==="dirty"?Y(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.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(!te(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>te(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(s)}}I.create=(r,e,t)=>new I({schema:r,typeName:m.ZodEffects,effect:e,..._(t)});I.createWithPreprocess=(r,e,t)=>new I({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,..._(t)});class j extends v{_parse(e){return this._getType(e)===f.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}j.create=(r,e)=>new j({innerType:r,typeName:m.ZodOptional,..._(e)});class q extends v{_parse(e){return this._getType(e)===f.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}q.create=(r,e)=>new q({innerType:r,typeName:m.ZodNullable,..._(e)});class fe extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fe.create=(r,e)=>new fe({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class he extends v{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return re(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}he.create=(r,e)=>new he({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class we extends v{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.nan,received:n.parsedType}),p}return{status:"valid",value:e.data}}}we.create=r=>new we({typeName:m.ZodNaN,..._(r)});const yt=Symbol("zod_brand");class Ae extends v{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class pe extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);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"?p:a.status==="dirty"?(t.dirty(),Y(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"?p:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new pe({in:e,out:t,typeName:m.ZodPipeline})}}class me extends v{_parse(e){const t=this._def.innerType._parse(e),n=s=>(te(s)&&(s.value=Object.freeze(s.value)),s);return re(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}me.create=(r,e)=>new me({innerType:r,typeName:m.ZodReadonly,..._(e)});function Be(r,e={},t){return r?K.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:u})}}):K.create()}const _t={object:k.lazycreate};var m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));const vt=(r,e={message:`Input not instance of ${r.name}`})=>Be(t=>t instanceof r,e),We=E.create,Ge=D.create,gt=we.create,xt=V.create,Ye=ne.create,kt=B.create,bt=xe.create,wt=se.create,Tt=ae.create,St=K.create,Zt=U.create,Ct=$.create,Ot=ke.create,Nt=R.create,Et=k.create,Rt=k.strictCreate,It=ie.create,jt=Se.create,At=oe.create,Mt=M.create,Pt=de.create,$t=be.create,zt=W.create,Dt=J.create,Vt=ce.create,Lt=ue.create,qt=L.create,Ut=le.create,Bt=X.create,$e=I.create,Wt=j.create,Gt=q.create,Yt=I.createWithPreprocess,Jt=pe.create,Ht=()=>We().optional(),Kt=()=>Ge().optional(),Xt=()=>Ye().optional(),Qt={string:r=>E.create({...r,coerce:!0}),number:r=>D.create({...r,coerce:!0}),boolean:r=>ne.create({...r,coerce:!0}),bigint:r=>V.create({...r,coerce:!0}),date:r=>B.create({...r,coerce:!0})},Ft=p;var C=Object.freeze({__proto__:null,defaultErrorMap:H,setErrorMap:Fe,getErrorMap:_e,makeIssue:ve,EMPTY_PATH:et,addIssueToContext:l,ParseStatus:S,INVALID:p,DIRTY:Y,OK:Z,isAborted:Ee,isDirty:Re,isValid:te,isAsync:re,get util(){return x},get objectUtil(){return Ne},ZodParsedType:f,getParsedType:z,ZodType:v,datetimeRegex:qe,ZodString:E,ZodNumber:D,ZodBigInt:V,ZodBoolean:ne,ZodDate:B,ZodSymbol:xe,ZodUndefined:se,ZodNull:ae,ZodAny:K,ZodUnknown:U,ZodNever:$,ZodVoid:ke,ZodArray:R,ZodObject:k,ZodUnion:ie,ZodDiscriminatedUnion:Se,ZodIntersection:oe,ZodTuple:M,ZodRecord:de,ZodMap:be,ZodSet:W,ZodFunction:J,ZodLazy:ce,ZodLiteral:ue,ZodEnum:L,ZodNativeEnum:le,ZodPromise:X,ZodEffects:I,ZodTransformer:I,ZodOptional:j,ZodNullable:q,ZodDefault:fe,ZodCatch:he,ZodNaN:we,BRAND:yt,ZodBranded:Ae,ZodPipeline:pe,ZodReadonly:me,custom:Be,Schema:v,ZodSchema:v,late:_t,get ZodFirstPartyTypeKind(){return m},coerce:Qt,any:St,array:Nt,bigint:xt,boolean:Ye,date:kt,discriminatedUnion:jt,effect:$e,enum:qt,function:Dt,instanceof:vt,intersection:At,lazy:Vt,literal:Lt,map:$t,nan:gt,nativeEnum:Ut,never:Ct,null:Tt,nullable:Gt,number:Ge,object:Et,oboolean:Xt,onumber:Kt,optional:Wt,ostring:Ht,pipeline:Jt,preprocess:Yt,promise:Bt,record:Pt,set:zt,strictObject:Rt,string:We,symbol:bt,transformer:$e,tuple:Mt,undefined:wt,union:It,unknown:Zt,void:Ot,NEVER:Ft,ZodIssueCode:d,quotelessJson:Qe,ZodError:N});const er=()=>{const{formValidationTexts:r}=Oe.useContext(Q.LuminusComponentsContext),e=g=>(g!=null&&g.useCoerce?C.coerce:C).string({invalid_type_error:r.required,required_error:r.required}).transform(w=>w??null),t=g=>e(g).nullable().optional().transform(b=>b??null),n=g=>{const b=(g!=null&&g.useCoerce?C.coerce:C).number({invalid_type_error:r.required,required_error:r.required});return(g==null?void 0:g.min)!==void 0&&b.min(g.min),(g==null?void 0:g.max)!==void 0&&b.max(g.max),b.transform(w=>w??null)},s=g=>n(g).nullable().optional().transform(b=>b??null),a=g=>(g!=null&&g.useCoerce?C.coerce:C).boolean({invalid_type_error:r.required,required_error:r.required}).transform(b=>b??null),i=g=>(g!=null&&g.useCoerce?C.coerce:C).string({invalid_type_error:r.required,required_error:r.required}).refine(Ke.isISODate,{message:r.invalidDate}).transform(w=>w??null),o=g=>i(g).nullable().transform(b=>b??null),u=(g,b)=>C.enum(g,{invalid_type_error:r.required,required_error:r.required}).transform(Me=>Me??null);return{zString:t,zStringRequired:e,zNumber:s,zNumberRequired:n,zBool:a,zDate:o,zDateRequired:i,zEnum:(g,b)=>u(g).nullable().transform(w=>w??null),zEnumRequired:u,zObjectIdInt:g=>C.object({id:s({useCoerce:!0})}).nullable().transform(w=>w??null),zObjectIdIntRequired:g=>C.object({id:n()}).transform(w=>w??null),zObjectIdStr:g=>C.object({id:t({useCoerce:!0})}).nullable().transform(w=>w??null),zObjectIdStrRequired:g=>C.object({id:e()}).transform(w=>w??null),zFile:({required:g,multiple:b,maxFileSize:w})=>C.any().transform(T=>Array.from(T??[])).refine(T=>!g||(T==null?void 0:T.length)>0,"File is required.").refine(T=>b||(T==null?void 0:T.length)<=1,"Multiple files not allowed.").refine(T=>T.every(Je=>Je.size<=w),`Maximum file size is ${He.formatFileSize(w)}.`).transform(T=>(b?T:T==null?void 0:T[0])??null)}},tr=r=>{let e="pending",t;const n=r.then(s=>{e="success",t=s},s=>{e="error",t=s});return()=>{switch(e){case"pending":throw n;case"success":return t;case"error":throw t;default:throw new Error("Unknown status")}}};function rr(r){const e=Q.useAxios({silent:!0}),[t,n]=Oe.useState(null);return Oe.useEffect(()=>{(async()=>{const a=e.get(r).then(i=>i.data);n(tr(a))})()},[e,r]),t}exports.cancelToken=Q.cancelToken;exports.useAuth=Q.useAuth;exports.useAxios=Q.useAxios;exports.useNotifications=Q.useNotifications;exports.useConfirm=Te.useConfirm;exports.useGetApiData=Te.useGetApiData;exports.useLocalStorageState=Te.useLocalStorageState;exports.usePrompt=Te.usePrompt;exports.useClickOutside=je.useClickOutside;exports.useFormControlType=je.useFormControlType;exports.useKeyPress=je.useKeyPress;exports.usePermissions=Xe.usePermissions;exports.useGetDataBound=rr;exports.useZodSchemaTypes=er;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("./UserAvatarToggle-DYIBvTYX.cjs"),Te=require("./useLocalStorageState-CxsNjf78.cjs"),Oe=require("react"),He=require("./latinize-DaqzUOla.cjs"),Ke=require("./dateUtils-b-AkAh2Y.cjs");require("react-hook-form");const je=require("./useFormControlType-Dqz8sV4J.cjs"),Xe=require("./usePermissions-BEKIk6u3.cjs");var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.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},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Ne;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ne||(Ne={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),z=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},d=x.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"]),Qe=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class N extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||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(t(i));else{let o=n,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),n}static assert(e){if(!(e instanceof N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=r=>new N(r);const H=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let ze=H;function Fe(r){ze=r}function _e(){return ze}const ve=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const u=n.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},et=[];function l(r,e){const t=_e(),n=ve({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===H?void 0:H].filter(s=>!!s)});r.common.issues.push(n)}class S{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return p;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return S.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return p;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const p=Object.freeze({status:"aborted"}),Y=r=>({status:"dirty",value:r}),Z=r=>({status:"valid",value:r}),Ee=r=>r.status==="aborted",Re=r=>r.status==="dirty",te=r=>r.status==="valid",re=r=>typeof Promise<"u"&&r instanceof Promise;function ge(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function De(r,e,t,n,s){if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(h||(h={}));var F,ee;class A{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pe=(r,e)=>{if(te(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new N(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{var u,c;const{message:y}=r;return i.code==="invalid_enum_value"?{message:y??o.defaultError}:typeof o.data>"u"?{message:(u=y??n)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=y??t)!==null&&c!==void 0?c:o.defaultError}},description:s}}class v{constructor(e){this.spa=this.safeParseAsync,this._def=e,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)}get description(){return this._def.description}_getType(e){return z(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:z(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Pe(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:z(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(re(s)?s:Promise.resolve(s));return Pe(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new I({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return j.create(this,this._def)}nullable(){return q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return R.create(this,this._def)}promise(){return X.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new I({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new fe({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new Ae({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new he({..._(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return pe.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const tt=/^c[^\s-]{8,}$/i,rt=/^[0-9a-z]+$/,nt=/^[0-9A-HJKMNP-TV-Z]{26}$/,st=/^[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,at=/^[a-z0-9_-]{21}$/i,it=/^[-+]?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)?)??$/,ot=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ce;const ct=/^(?:(?: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])$/,ut=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,lt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ve="((\\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])))",ft=new RegExp(`^${Ve}$`);function Le(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ht(r){return new RegExp(`^${Le(r)}$`)}function qe(r){let e=`${Ve}T${Le(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function mt(r,e){return!!((e==="v4"||!e)&&ct.test(r)||(e==="v6"||!e)&&ut.test(r))}class E extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.string,received:a.parsedType}),p}const n=new S;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ot.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ce||(Ce=new RegExp(dt,"u")),Ce.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")st.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")at.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")tt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")rt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")nt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?qe(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ft.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ht(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?it.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?mt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?lt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...h.errToObj(n)})}_addCheck(e){return new E({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...h.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...h.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...h.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new E({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}E.create=r=>{var e;return new E({checks:[],typeName:m.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function pt(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class D extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.number,received:a.parsedType}),p}let n;const s=new S;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?pt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,n,s){return new D({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:h.toString(s)}]})}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}D.create=r=>new D({checks:[],typeName:m.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class V extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.bigint,received:a.parsedType}),p}let n;const s=new S;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,n,s){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:h.toString(s)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}V.create=r=>{var e;return new V({checks:[],typeName:m.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,..._(r)})};class ne extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.boolean,received:n.parsedType}),p}return Z(e.data)}}ne.create=r=>new ne({typeName:m.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class B extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_type,expected:f.date,received:a.parsedType}),p}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return l(a,{code:d.invalid_date}),p}const n=new S;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}B.create=r=>new B({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:m.ZodDate,..._(r)});class xe extends v{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.symbol,received:n.parsedType}),p}return Z(e.data)}}xe.create=r=>new xe({typeName:m.ZodSymbol,..._(r)});class se extends v{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.undefined,received:n.parsedType}),p}return Z(e.data)}}se.create=r=>new se({typeName:m.ZodUndefined,..._(r)});class ae extends v{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.null,received:n.parsedType}),p}return Z(e.data)}}ae.create=r=>new ae({typeName:m.ZodNull,..._(r)});class K extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}K.create=r=>new K({typeName:m.ZodAny,..._(r)});class U extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}U.create=r=>new U({typeName:m.ZodUnknown,..._(r)});class $ extends v{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),p}}$.create=r=>new $({typeName:m.ZodNever,..._(r)});class ke extends v{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.void,received:n.parsedType}),p}return Z(e.data)}}ke.create=r=>new ke({typeName:m.ZodVoid,..._(r)});class R extends v{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return l(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),p;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?d.too_big:d.too_small,minimum:o?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&&t.data.length<s.minLength.value&&(l(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new A(t,i,t.path,o)))).then(i=>S.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new A(t,i,t.path,o)));return S.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new R({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new R({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new R({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}R.create=(r,e)=>new R({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function G(r){if(r instanceof k){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=j.create(G(n))}return new k({...r._def,shape:()=>e})}else return r instanceof R?new R({...r._def,type:G(r.element)}):r instanceof j?j.create(G(r.unwrap())):r instanceof q?q.create(G(r.unwrap())):r instanceof M?M.create(r.items.map(e=>G(e))):r}class k extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const c=this._getOrReturnCtx(e);return l(c,{code:d.invalid_type,expected:f.object,received:c.parsedType}),p}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(const c in s.data)i.includes(c)||o.push(c);const u=[];for(const c of i){const y=a[c],O=s.data[c];u.push({key:{status:"valid",value:c},value:y._parse(new A(s,O,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof $){const c=this._def.unknownKeys;if(c==="passthrough")for(const y of o)u.push({key:{status:"valid",value:y},value:{status:"valid",value:s.data[y]}});else if(c==="strict")o.length>0&&(l(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const y of o){const O=s.data[y];u.push({key:{status:"valid",value:y},value:c._parse(new A(s,O,s.path,y)),alwaysSet:y in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const y of u){const O=await y.key,Ze=await y.value;c.push({key:O,value:Ze,alwaysSet:y.alwaysSet})}return c}).then(c=>S.mergeObjectSync(n,c)):S.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=h.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new k({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof j;)a=a._def.innerType;t[n]=a}}),new k({...this._def,shape:()=>t})}keyof(){return Ue(x.objectKeys(this.shape))}}k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,..._(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:$.create(),typeName:m.ZodObject,..._(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:$.create(),typeName:m.ZodObject,..._(e)});class ie extends v{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new N(o.ctx.common.issues));return l(t,{code:d.invalid_union,unionErrors:i}),p}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const u of n){const c={...t,common:{...t.common,issues:[]},parent:null},y=u._parseSync({data:t.data,path:t.path,parent:c});if(y.status==="valid")return y;y.status==="dirty"&&!a&&(a={result:y,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new N(u));return l(t,{code:d.invalid_union,unionErrors:o}),p}}get options(){return this._def.options}}ie.create=(r,e)=>new ie({options:r,typeName:m.ZodUnion,..._(e)});const P=r=>r instanceof ce?P(r.schema):r instanceof I?P(r.innerType()):r instanceof ue?[r.value]:r instanceof L?r.options:r instanceof le?x.objectValues(r.enum):r instanceof fe?P(r._def.innerType):r instanceof se?[void 0]:r instanceof ae?[null]:r instanceof j?[void 0,...P(r.unwrap())]:r instanceof q?[null,...P(r.unwrap())]:r instanceof Ae||r instanceof me?P(r.unwrap()):r instanceof he?P(r._def.innerType):[];class Se extends v{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),p;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=P(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Se({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}}function Ie(r,e){const t=z(r),n=z(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){const s=x.objectKeys(e),a=x.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const u=Ie(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],u=Ie(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class oe extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Ee(a)||Ee(i))return p;const o=Ie(a.value,i.value);return o.valid?((Re(a)||Re(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:d.invalid_intersection_types}),p)};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}))}}oe.create=(r,e,t)=>new oe({left:r,right:e,typeName:m.ZodIntersection,..._(t)});class M extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return l(n,{code:d.invalid_type,expected:f.array,received:n.parsedType}),p;if(n.data.length<this._def.items.length)return l(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new A(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>S.mergeArray(t,i)):S.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new M({...this._def,rest:e})}}M.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new M({items:r,typeName:m.ZodTuple,rest:null,..._(e)})};class de extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:d.invalid_type,expected:f.object,received:n.parsedType}),p;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new A(n,o,n.path,o)),value:i._parse(new A(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?S.mergeObjectAsync(t,s):S.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new de({keyType:e,valueType:t,typeName:m.ZodRecord,..._(n)}):new de({keyType:E.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}}class be extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return l(n,{code:d.invalid_type,expected:f.map,received:n.parsedType}),p;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],c)=>({key:s._parse(new A(n,o,n.path,[c,"key"])),value:a._parse(new A(n,u,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const c=await u.key,y=await u.value;if(c.status==="aborted"||y.status==="aborted")return p;(c.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(c.value,y.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const c=u.key,y=u.value;if(c.status==="aborted"||y.status==="aborted")return p;(c.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(c.value,y.value)}return{status:t.value,value:o}}}}be.create=(r,e,t)=>new be({valueType:e,keyType:r,typeName:m.ZodMap,..._(t)});class W extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return l(n,{code:d.invalid_type,expected:f.set,received:n.parsedType}),p;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const y of u){if(y.status==="aborted")return p;y.status==="dirty"&&t.dirty(),c.add(y.value)}return{status:t.value,value:c}}const o=[...n.data.values()].map((u,c)=>a._parse(new A(n,u,n.path,c)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new W({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new W({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}W.create=(r,e)=>new W({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});class J extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),p;function n(o,u){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(c=>!!c),issueData:{code:d.invalid_arguments,argumentsError:u}})}function s(o,u){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(c=>!!c),issueData:{code:d.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof X){const o=this;return Z(async function(...u){const c=new N([]),y=await o._def.args.parseAsync(u,a).catch(ye=>{throw c.addIssue(n(u,ye)),c}),O=await Reflect.apply(i,this,y);return await o._def.returns._def.type.parseAsync(O,a).catch(ye=>{throw c.addIssue(s(O,ye)),c})})}else{const o=this;return Z(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new N([n(u,c.error)]);const y=Reflect.apply(i,this,c.data),O=o._def.returns.safeParse(y,a);if(!O.success)throw new N([s(y,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new J({...this._def,args:M.create(e).rest(U.create())})}returns(e){return new J({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new J({args:e||M.create([]).rest(U.create()),returns:t||U.create(),typeName:m.ZodFunction,..._(n)})}}class ce extends v{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ce.create=(r,e)=>new ce({getter:r,typeName:m.ZodLazy,..._(e)});class ue extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}ue.create=(r,e)=>new ue({value:r,typeName:m.ZodLiteral,..._(e)});function Ue(r,e){return new L({values:r,typeName:m.ZodEnum,..._(e)})}class L extends v{constructor(){super(...arguments),F.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:x.joinValues(n),received:t.parsedType,code:d.invalid_type}),p}if(ge(this,F)||De(this,F,new Set(this._def.values)),!ge(this,F).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:d.invalid_enum_value,options:n}),p}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return L.create(e,{...this._def,...t})}exclude(e,t=this._def){return L.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}F=new WeakMap;L.create=Ue;class le extends v{constructor(){super(...arguments),ee.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const s=x.objectValues(t);return l(n,{expected:x.joinValues(s),received:n.parsedType,code:d.invalid_type}),p}if(ge(this,ee)||De(this,ee,new Set(x.getValidEnumValues(this._def.values))),!ge(this,ee).has(e.data)){const s=x.objectValues(t);return l(n,{received:n.data,code:d.invalid_enum_value,options:s}),p}return Z(e.data)}get enum(){return this._def.values}}ee=new WeakMap;le.create=(r,e)=>new le({values:r,typeName:m.ZodNativeEnum,..._(e)});class X extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:d.invalid_type,expected:f.promise,received:t.parsedType}),p;const n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}X.create=(r,e)=>new X({type:r,typeName:m.ZodPromise,..._(e)});class I extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?t.abort():t.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 o=>{if(t.value==="aborted")return p;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?p:u.status==="dirty"||t.value==="dirty"?Y(u.value):u});{if(t.value==="aborted")return p;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?p:o.status==="dirty"||t.value==="dirty"?Y(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.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(!te(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>te(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(s)}}I.create=(r,e,t)=>new I({schema:r,typeName:m.ZodEffects,effect:e,..._(t)});I.createWithPreprocess=(r,e,t)=>new I({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,..._(t)});class j extends v{_parse(e){return this._getType(e)===f.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}j.create=(r,e)=>new j({innerType:r,typeName:m.ZodOptional,..._(e)});class q extends v{_parse(e){return this._getType(e)===f.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}q.create=(r,e)=>new q({innerType:r,typeName:m.ZodNullable,..._(e)});class fe extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fe.create=(r,e)=>new fe({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class he extends v{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return re(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}he.create=(r,e)=>new he({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class we extends v{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:f.nan,received:n.parsedType}),p}return{status:"valid",value:e.data}}}we.create=r=>new we({typeName:m.ZodNaN,..._(r)});const yt=Symbol("zod_brand");class Ae extends v{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class pe extends v{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);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"?p:a.status==="dirty"?(t.dirty(),Y(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"?p:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new pe({in:e,out:t,typeName:m.ZodPipeline})}}class me extends v{_parse(e){const t=this._def.innerType._parse(e),n=s=>(te(s)&&(s.value=Object.freeze(s.value)),s);return re(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}me.create=(r,e)=>new me({innerType:r,typeName:m.ZodReadonly,..._(e)});function Be(r,e={},t){return r?K.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:u})}}):K.create()}const _t={object:k.lazycreate};var m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));const vt=(r,e={message:`Input not instance of ${r.name}`})=>Be(t=>t instanceof r,e),We=E.create,Ge=D.create,gt=we.create,xt=V.create,Ye=ne.create,kt=B.create,bt=xe.create,wt=se.create,Tt=ae.create,St=K.create,Zt=U.create,Ct=$.create,Ot=ke.create,Nt=R.create,Et=k.create,Rt=k.strictCreate,It=ie.create,jt=Se.create,At=oe.create,Mt=M.create,Pt=de.create,$t=be.create,zt=W.create,Dt=J.create,Vt=ce.create,Lt=ue.create,qt=L.create,Ut=le.create,Bt=X.create,$e=I.create,Wt=j.create,Gt=q.create,Yt=I.createWithPreprocess,Jt=pe.create,Ht=()=>We().optional(),Kt=()=>Ge().optional(),Xt=()=>Ye().optional(),Qt={string:r=>E.create({...r,coerce:!0}),number:r=>D.create({...r,coerce:!0}),boolean:r=>ne.create({...r,coerce:!0}),bigint:r=>V.create({...r,coerce:!0}),date:r=>B.create({...r,coerce:!0})},Ft=p;var C=Object.freeze({__proto__:null,defaultErrorMap:H,setErrorMap:Fe,getErrorMap:_e,makeIssue:ve,EMPTY_PATH:et,addIssueToContext:l,ParseStatus:S,INVALID:p,DIRTY:Y,OK:Z,isAborted:Ee,isDirty:Re,isValid:te,isAsync:re,get util(){return x},get objectUtil(){return Ne},ZodParsedType:f,getParsedType:z,ZodType:v,datetimeRegex:qe,ZodString:E,ZodNumber:D,ZodBigInt:V,ZodBoolean:ne,ZodDate:B,ZodSymbol:xe,ZodUndefined:se,ZodNull:ae,ZodAny:K,ZodUnknown:U,ZodNever:$,ZodVoid:ke,ZodArray:R,ZodObject:k,ZodUnion:ie,ZodDiscriminatedUnion:Se,ZodIntersection:oe,ZodTuple:M,ZodRecord:de,ZodMap:be,ZodSet:W,ZodFunction:J,ZodLazy:ce,ZodLiteral:ue,ZodEnum:L,ZodNativeEnum:le,ZodPromise:X,ZodEffects:I,ZodTransformer:I,ZodOptional:j,ZodNullable:q,ZodDefault:fe,ZodCatch:he,ZodNaN:we,BRAND:yt,ZodBranded:Ae,ZodPipeline:pe,ZodReadonly:me,custom:Be,Schema:v,ZodSchema:v,late:_t,get ZodFirstPartyTypeKind(){return m},coerce:Qt,any:St,array:Nt,bigint:xt,boolean:Ye,date:kt,discriminatedUnion:jt,effect:$e,enum:qt,function:Dt,instanceof:vt,intersection:At,lazy:Vt,literal:Lt,map:$t,nan:gt,nativeEnum:Ut,never:Ct,null:Tt,nullable:Gt,number:Ge,object:Et,oboolean:Xt,onumber:Kt,optional:Wt,ostring:Ht,pipeline:Jt,preprocess:Yt,promise:Bt,record:Pt,set:zt,strictObject:Rt,string:We,symbol:bt,transformer:$e,tuple:Mt,undefined:wt,union:It,unknown:Zt,void:Ot,NEVER:Ft,ZodIssueCode:d,quotelessJson:Qe,ZodError:N});const er=()=>{const{formValidationTexts:r}=Oe.useContext(Q.LuminusComponentsContext),e=g=>(g!=null&&g.useCoerce?C.coerce:C).string({invalid_type_error:r.required,required_error:r.required}).transform(w=>w??null),t=g=>e(g).nullable().optional().transform(b=>b??null),n=g=>{const b=(g!=null&&g.useCoerce?C.coerce:C).number({invalid_type_error:r.required,required_error:r.required});return(g==null?void 0:g.min)!==void 0&&b.min(g.min),(g==null?void 0:g.max)!==void 0&&b.max(g.max),b.transform(w=>w??null)},s=g=>n(g).nullable().optional().transform(b=>b??null),a=g=>(g!=null&&g.useCoerce?C.coerce:C).boolean({invalid_type_error:r.required,required_error:r.required}).transform(b=>b??null),i=g=>(g!=null&&g.useCoerce?C.coerce:C).string({invalid_type_error:r.required,required_error:r.required}).refine(Ke.isISODate,{message:r.invalidDate}).transform(w=>w??null),o=g=>i(g).nullable().transform(b=>b??null),u=(g,b)=>C.enum(g,{invalid_type_error:r.required,required_error:r.required}).transform(Me=>Me??null);return{zString:t,zStringRequired:e,zNumber:s,zNumberRequired:n,zBool:a,zDate:o,zDateRequired:i,zEnum:(g,b)=>u(g).nullable().transform(w=>w??null),zEnumRequired:u,zObjectIdInt:g=>C.object({id:s({useCoerce:!0})}).nullable().transform(w=>w??null),zObjectIdIntRequired:g=>C.object({id:n()}).transform(w=>w??null),zObjectIdStr:g=>C.object({id:t({useCoerce:!0})}).nullable().transform(w=>w??null),zObjectIdStrRequired:g=>C.object({id:e()}).transform(w=>w??null),zFile:({required:g,multiple:b,maxFileSize:w})=>C.any().transform(T=>Array.from(T??[])).refine(T=>!g||(T==null?void 0:T.length)>0,"File is required.").refine(T=>b||(T==null?void 0:T.length)<=1,"Multiple files not allowed.").refine(T=>T.every(Je=>Je.size<=w),`Maximum file size is ${He.formatFileSize(w)}.`).transform(T=>(b?T:T==null?void 0:T[0])??null)}},tr=r=>{let e="pending",t;const n=r.then(s=>{e="success",t=s},s=>{e="error",t=s});return()=>{switch(e){case"pending":throw n;case"success":return t;case"error":throw t;default:throw new Error("Unknown status")}}};function rr(r){const e=Q.useAxios({silent:!0}),[t,n]=Oe.useState(null);return Oe.useEffect(()=>{(async()=>{const a=e.get(r).then(i=>i.data);n(tr(a))})()},[e,r]),t}exports.cancelToken=Q.cancelToken;exports.useAuth=Q.useAuth;exports.useAxios=Q.useAxios;exports.useNotifications=Q.useNotifications;exports.useConfirm=Te.useConfirm;exports.useGetApiData=Te.useGetApiData;exports.useLocalStorageState=Te.useLocalStorageState;exports.usePrompt=Te.usePrompt;exports.useClickOutside=je.useClickOutside;exports.useFormControlType=je.useFormControlType;exports.useKeyPress=je.useKeyPress;exports.usePermissions=Xe.usePermissions;exports.useGetDataBound=rr;exports.useZodSchemaTypes=er;
package/dist/hooks.es.js CHANGED
@@ -3,7 +3,7 @@ import { aI as lr, af as fr, aH as hr } from "./UserAvatarToggle-C1CRXpP2.js";
3
3
  import { c as pr, b as yr, a as _r, u as vr } from "./useLocalStorageState-DblJQuM7.js";
4
4
  import { useContext as He, useState as Je, useEffect as Ge } from "react";
5
5
  import { f as Qe } from "./latinize-BQrinury.js";
6
- import { i as Xe } from "./dateUtils-7nL2BXlo.js";
6
+ import { i as Xe } from "./dateUtils-C7tHbjab.js";
7
7
  import "react-hook-form";
8
8
  import { b as xr, u as kr, a as br } from "./useFormControlType-oJGqgThz.js";
9
9
  import { u as Tr } from "./usePermissions-avh3rydq.js";
@@ -1 +1,2 @@
1
1
  export declare const isISODate: (dateString: string) => boolean;
2
+ export declare function msToStartOfNextDay(): number;
package/dist/utils.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./latinize-DaqzUOla.cjs"),n=require("./dateUtils-DUA3CKds.cjs"),i=require("./searchUtils-Do20vjZW.cjs");function o(t,e){t.setValue(e,null)}function a(t,e){e.forEach(s=>{o(t,s)})}exports.extractErrorsFromResponse=r.extractErrorsFromResponse;exports.extractPermissionsFromResponse=r.extractPermissionsFromResponse;exports.fixNameIdNulls=r.fixNameIdNulls;exports.formatFileSize=r.formatFileSize;exports.hookFormSetServerErrors=r.hookFormSetServerErrors;exports.isPrimitive=r.isPrimitive;exports.joinStrings=r.joinStrings;exports.truncateText=r.truncateText;exports.isISODate=n.isISODate;exports.stringContains=i.stringContains;exports.stringSearchWithin=i.stringSearchWithin;exports.stringStartsWith=i.stringStartsWith;exports.hookFormSetNull=o;exports.hookFormSetNulls=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./latinize-DaqzUOla.cjs"),o=require("./dateUtils-b-AkAh2Y.cjs"),i=require("./searchUtils-Do20vjZW.cjs");function s(r,e){r.setValue(e,null)}function a(r,e){e.forEach(n=>{s(r,n)})}exports.extractErrorsFromResponse=t.extractErrorsFromResponse;exports.extractPermissionsFromResponse=t.extractPermissionsFromResponse;exports.fixNameIdNulls=t.fixNameIdNulls;exports.formatFileSize=t.formatFileSize;exports.hookFormSetServerErrors=t.hookFormSetServerErrors;exports.isPrimitive=t.isPrimitive;exports.joinStrings=t.joinStrings;exports.truncateText=t.truncateText;exports.isISODate=o.isISODate;exports.msToStartOfNextDay=o.msToStartOfNextDay;exports.stringContains=i.stringContains;exports.stringSearchWithin=i.stringSearchWithin;exports.stringStartsWith=i.stringStartsWith;exports.hookFormSetNull=s;exports.hookFormSetNulls=a;
package/dist/utils.es.js CHANGED
@@ -1,27 +1,28 @@
1
- import { e as n, c as m, d as l, f, h as S, i as c, j as h, t as u } from "./latinize-BQrinury.js";
2
- import { i as p } from "./dateUtils-7nL2BXlo.js";
3
- import { a as g, s as N, b as k } from "./searchUtils-Du4JnXdQ.js";
4
- function o(r, s) {
5
- r.setValue(s, null);
1
+ import { e as n, c as m, d as f, f as l, h as S, i as x, j as c, t as h } from "./latinize-BQrinury.js";
2
+ import { i as p, m as F } from "./dateUtils-C7tHbjab.js";
3
+ import { a as g, s as k, b as E } from "./searchUtils-Du4JnXdQ.js";
4
+ function o(s, r) {
5
+ s.setValue(r, null);
6
6
  }
7
- function e(r, s) {
8
- s.forEach((t) => {
9
- o(r, t);
7
+ function e(s, r) {
8
+ r.forEach((t) => {
9
+ o(s, t);
10
10
  });
11
11
  }
12
12
  export {
13
13
  n as extractErrorsFromResponse,
14
14
  m as extractPermissionsFromResponse,
15
- l as fixNameIdNulls,
16
- f as formatFileSize,
15
+ f as fixNameIdNulls,
16
+ l as formatFileSize,
17
17
  o as hookFormSetNull,
18
18
  e as hookFormSetNulls,
19
19
  S as hookFormSetServerErrors,
20
20
  p as isISODate,
21
- c as isPrimitive,
22
- h as joinStrings,
21
+ x as isPrimitive,
22
+ c as joinStrings,
23
+ F as msToStartOfNextDay,
23
24
  g as stringContains,
24
- N as stringSearchWithin,
25
- k as stringStartsWith,
26
- u as truncateText
25
+ k as stringSearchWithin,
26
+ E as stringStartsWith,
27
+ h as truncateText
27
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-luminus-components",
3
- "version": "1.3.24",
3
+ "version": "1.3.25",
4
4
  "description": "Library of React Components reusable in Luminus projects (Fleetman, CAFM)",
5
5
  "type": "module",
6
6
  "repository": {