@g4rcez/components 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/button.d.ts +2 -2
- package/dist/components/core/button.d.ts.map +1 -1
- package/dist/components/core/button.js +2 -2
- package/dist/components/core/polymorph.d.ts +1 -1
- package/dist/components/core/polymorph.d.ts.map +1 -1
- package/dist/components/display/card.js +2 -2
- package/dist/components/floating/tooltip.d.ts +2 -2
- package/dist/components/floating/tooltip.d.ts.map +1 -1
- package/dist/components/floating/tooltip.js +1 -1
- package/dist/components/form/autocomplete.d.ts +2 -2
- package/dist/components/form/autocomplete.d.ts.map +1 -1
- package/dist/components/form/autocomplete.js +3 -3
- package/dist/components/form/file-upload.js +1 -1
- package/dist/components/form/input-field.d.ts +2 -2
- package/dist/components/form/input-field.d.ts.map +1 -1
- package/dist/components/form/input-field.js +1 -1
- package/dist/components/form/input.d.ts +2 -2
- package/dist/components/form/input.d.ts.map +1 -1
- package/dist/components/form/input.js +2 -2
- package/dist/components/form/select.d.ts +2 -2
- package/dist/components/form/select.d.ts.map +1 -1
- package/dist/components/form/select.js +2 -2
- package/dist/components/table/filter.d.ts +1 -1
- package/dist/components/table/filter.d.ts.map +1 -1
- package/dist/components/table/filter.js +4 -4
- package/dist/components/table/group.js +4 -4
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/table/sort.d.ts +1 -1
- package/dist/components/table/sort.d.ts.map +1 -1
- package/dist/components/table/sort.js +3 -3
- package/dist/components/table/table-lib.d.ts +2 -2
- package/dist/components/table/table-lib.d.ts.map +1 -1
- package/dist/components/table/table-lib.js +1 -1
- package/dist/components/table/thead.js +2 -2
- package/dist/hooks/use-form.d.ts +2 -2
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/fns.d.ts +1 -1
- package/dist/lib/fns.d.ts.map +1 -1
- package/dist/preset/src/styles/theme.js +3 -3
- package/dist/styles/theme.js +3 -3
- package/package.json +50 -12
package/dist/index.umd.js
CHANGED
|
@@ -147,5 +147,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
147
147
|
*
|
|
148
148
|
* This source code is licensed under the MIT license found in the
|
|
149
149
|
* LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/var tv;function MO(){return tv||(tv=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=w,e=Jy();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;function c(u,f,d,h,p){var m=i(null),y;m.current===null?(y={hasValue:!1,value:null},m.current=y):y=m.current;var v=a(function(){var x=!1,T,P,O=function(A){if(!x){x=!0,T=A;var j=h(A);if(p!==void 0&&y.hasValue){var F=y.value;if(p(F,j))return P=F,F}return P=j,j}var _=T,M=P;if(r(_,A))return M;var N=h(A);return p!==void 0&&p(M,N)?M:(T=A,P=N,N)},k=d===void 0?null:d,D=function(){return O(f())},L=k===null?void 0:function(){return O(k())};return[D,L]},[f,d,h,p]),b=v[0],g=v[1],S=o(u,b,g);return s(function(){y.hasValue=!0,y.value=S},[S]),l(S),S}ev.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ev}process.env.NODE_ENV==="production"?DO():MO();const no=t=>{const e=w.useRef(t??{});return w.useEffect(()=>void(e.current=t),[t]),e},RO=t=>{const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current},FO=t=>Object.entries(t),nv=t=>t instanceof Promise,rv=(t,e,n,r)=>e===t?n.reduce((o,i)=>i(o,e,r),t):t.constructor.name===Object.name?n.reduce((o,i)=>i(o,e,r),{...e,...t}):n.reduce((o,i)=>i(o,e,r),t),LO=(t,e,n,r,o,i)=>(...s)=>{const a=performance.now(),l=e(...s),c=(u,f)=>n(d=>rv(u,d,i,f));return nv(l)?l.then(u=>{o.current={method:t,props:r(),time:performance.now()-a},c(u,o.current)}):(o.current={method:t,props:r(),time:performance.now()-a},void c(l,o.current))},NO=(t,e,n,r,o,i)=>(...s)=>{o.current={method:t,time:0,props:r()};const a=e(...s),l=c=>n(u=>rv(c,u,i,o.current));return nv(a)?a.then(c=>l(c)):l(a)},VO=(t,e,n)=>{const[r,o]=w.useState(()=>t),i=no(r),s=no((n==null?void 0:n.props)??{}),a=no(e),l=no((n==null?void 0:n.postMiddleware)??[]),c=no((n==null?void 0:n.interceptor)??[]),u=w.useRef(t),f=RO(r),d=no(f),h=w.useRef(null);w.useEffect(()=>{if(h.current===null)return;const m=h.current;l.current.forEach(y=>{y(r,f,m)})},[r,l,f]);const[p]=w.useState(()=>{const m=()=>s.current,y=a.current({props:m,state:()=>i.current,initialState:u.current,previousState:()=>d.current});return FO(y).reduce((v,[b,g])=>({...v,[b]:n!=null&&n.debug?LO(b,g,o,m,h,c.current):NO(b,g,o,m,h,c.current)}),{})});return[r,p,s.current]},Ws=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)}),ov=(t,e,n)=>t.split(e).filter(Boolean).reduce((r,o)=>r!=null?r[o]:r,n),iv={basic:/[,[\]]+?/,extend:/[,[\].]+?/},sv=(t,e)=>{const n=ov(e,iv.basic,t)||ov(e,iv.extend,t);return n===void 0||n===t?void 0:n},$O=()=>typeof window>"u";var jO={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=(y,v)=>{try{Object.keys(y).forEach(v)}catch(b){window.console.log(b)}},n=y=>y==null,r=y=>{const v=typeof y;return v==="string"||v==="number"||v==="boolean"||n(y)},o=(y,v)=>{const b=v.getItem(y);try{return JSON.parse(b)}catch{return b??null}},i=y=>Object.keys(y).reduce((v,b)=>({...v,[b]:o(b,y)}),{}),s=y=>y instanceof Date?y:typeof y=="number"?new Date(new Date*1+y*864e5):y,a="1969-12-31T23:59:59.000Z",l=()=>document.cookie===""?{}:document.cookie.split("; ").map(y=>y.split("=")).reduce((y,v)=>(y[decodeURIComponent(v[0].trim())]=decodeURIComponent(v[1].trim()),y),{}),c=new Set,u=()=>{const y=l();c.forEach(v=>v(y))},f=[{name:"expires",parse:y=>`expires=${s(y.expires??a)}`},{name:"maxAge",parse:y=>y.maxAge?`max-age=${s(y.expires??a)}`:""},{name:"path",parse:y=>`path=${y.path??"/"}`},{name:"sameSite",parse:y=>`samesite=${y.sameSite??"strict"}`},{name:"useSecure",parse:y=>`${y.useSecure??!0?"secure":""}`},{name:"domain",parse:y=>{const v=y.domain??"";return v===""?"":`domain=${y.multiDomain?".":""}${v}`}},{name:"partitioned",parse:y=>y.partitioned?"Partitioned":""}],d={json:l,listener:y=>(c.add(y),()=>c.delete(y)),clearListeners:()=>c.clear(),has:y=>document.cookie.split(";").some(v=>v.trim().startsWith(`${y}=`)),deleteAll:()=>{document.cookie.split(";").forEach(y=>{document.cookie=y.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}),u()},get:y=>{const v=d.json()[y];if(n(v))return null;try{return JSON.parse(decodeURIComponent(v))}catch{return v}},delete:y=>{document.cookie=`${encodeURIComponent(y)}=;expires=${new Date().toUTCString()}`,u()},set:(y,v,b={})=>{const g=r(v)?v:encodeURIComponent(JSON.stringify(v)),S=f.reduce((x,T)=>{const P=T.parse(b);return P===""?x:x.concat(P)},[`${encodeURIComponent(y)}=${g}`]).join(";");document.cookie=S,u()}},h=y=>{const v=new Set,b=g=>{y().removeItem(g);const S=i(y());v.forEach(x=>x(S))};return{delete:b,listener:g=>(v.add(g),()=>v.delete(g)),clearListeners:()=>v.clear(),json:(g=!1)=>g?i(y()):y(),has:g=>{const S=y().getItem(g);return!n(S)},deleteAll:()=>{e(y(),b),v.forEach(g=>g(y()))},get:g=>o(g,y()),set:(g,S)=>{y().setItem(g,JSON.stringify(S)),v.forEach(x=>x(y()))}}},p=h(()=>window.sessionStorage),m=h(()=>window.localStorage);t.Cookie=d,t.LocalStorage=m,t.SessionStorage=p,t.createStorage=h})(jO);const av=t=>t.headerLabel??t.thead??t.id,lv=t=>t.map(e=>({value:e.id,label:e.thead??e.headerLabel??e.id}));var ai=(t=>(t.Boolean="boolean",t.Number="number",t.Select="select",t.Text="text",t))(ai||{});const uu=t=>t.type==="number"?t.valueAsNumber:t.value,wt={contains:{value:"contains",label:"Contains",symbol:"includes"},is:{value:"is",label:"Is",symbol:"is"},isNot:{value:"isNot",label:"Is not",symbol:"!=="},notContains:{value:"notContains",label:"Does not contains",symbol:"notIncludes"},lessThan:{value:"lessThan",label:"Less Than",symbol:"<="},greaterThan:{value:"greaterThan",label:"Greater than",symbol:">="},startsWith:{value:"startsWith",label:"Starts with",symbol:"startsWith"},endsWith:{value:"endsWith",label:"Ends with",symbol:"endsWith"}},fu={[ai.Text]:[wt.is,wt.isNot,wt.contains,wt.notContains,wt.startsWith,wt.endsWith],[ai.Boolean]:[wt.is,wt.isNot],[ai.Number]:[wt.is,wt.isNot,wt.greaterThan,wt.lessThan]},Hs=(t,e={})=>{var s;const n=t.id,r=t.type??ai.Text,o=(s=fu[r])==null?void 0:s[0].value,i=wt[o];return{id:Ws(),operation:i,label:av(t),name:n,type:r,value:"",...e}},BO=t=>{const e=()=>{const s=t.cols.at(0);t.set(a=>[...a,Hs(s)])},n=s=>{const a=s.target.dataset.id||"",l=s.target.value;t.set(c=>c.map(u=>{if(a!==u.id)return u;const f=t.cols.find(d=>l===d.id);return Hs(f,{value:""})}))},r=s=>{const a=s.target.dataset.id||"",l=s.target.value;t.set(c=>c.map(u=>u.id===a?{...u,operation:wt[l]}:u))},o=s=>{const a=s.currentTarget.dataset.id||"";console.log({id:a,f:t.filters}),t.set(l=>l.filter(c=>c.id!==a))},i=s=>{const a=s.target.dataset.id||"",l=uu(s.target);t.set(c=>c.map(u=>u.id===a?{...u,value:l}:u))};return E.jsx(w.Fragment,{children:E.jsx(Po,{arrow:!1,title:"Filters",trigger:E.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[E.jsx(Kf,{size:14}),"Filtros ",t.filters.length===0?"":` (${t.filters.length})`]}),children:E.jsxs("ul",{className:"mt-4 space-y-2",children:[t.filters.map(s=>{const a=fu[s.type];return E.jsxs("li",{className:"flex flex-nowrap gap-3",children:[E.jsx(er,{title:"Filtro",options:t.options,placeholder:"Seleciona um campo...",value:s.name,"data-id":s.id,onChange:n}),E.jsx(er,{title:"Tipo do filtro","data-id":s.id,onChange:r,value:s.operation.value,options:a,placeholder:"Operação..."}),E.jsx(Ya,{"data-id":s.id,onChange:i,placeholder:"Buscar por...",title:"Valor do filtro",type:s.type,value:s.value}),E.jsx("div",{className:"flex items-center justify-center mt-5",children:E.jsx("button",{"data-id":s.id,type:"button",onClick:o,children:E.jsx(xo,{className:"text-danger",size:16})})})]},`filter-select-${s.id}`)}),E.jsx("li",{children:E.jsxs("button",{type:"button",onClick:e,className:"text-primary flex items-center gap-1",children:[E.jsx(ja,{size:14})," Adicionar novo filtro"]})})]})})})},zO=({filter:t,set:e})=>{const n=o=>{const i=o.target.value,s=o.target.dataset.id||"";e(a=>a.map(l=>l.id===s?{...l,operation:wt[i]}:l))},r=o=>{const i=o.target.dataset.id||"",s=uu(o.target);e(a=>a.map(l=>l.id===i?{...l,value:s}:l))};return E.jsxs("div",{className:"flex flex-nowrap items-center gap-4 py-2",children:[E.jsx(er,{onChange:n,value:t.operation.value,options:fu[t.type],placeholder:"Operation..."}),E.jsx(Ya,{type:t.type,"data-id":t.id,onChange:r,placeholder:"Looking for...",value:t.value})]})},WO=({item:t,onPointerDown:e})=>{const n=hc(0);return E.jsxs(ys.Item,{onPointerDown:e,id:t.groupId,className:"flex flex-row items-center gap-2",value:t,style:{y:n},children:[E.jsx("button",{className:"cursor-grab",children:E.jsx(_0,{size:14})}),E.jsx("span",{children:t.groupName})]},t.groupId)},HO=t=>{var a;const e=lv(t.cols),n=LC(),[r,o]=w.useState(((a=t.groups[0])==null?void 0:a.thead)||""),i=l=>{var m;const c=l.target,u=c.value,f=c.options.selectedIndex,d=((m=c.options.item(f))==null?void 0:m.label)||"";o(d);const h=new cg(t.rows).GroupBy(u),p=t.cols.find(y=>y.id===u);t.setGroups(PO(h).map((y,v)=>{const b=h[y];return{...p,groupId:Ws(),groupKey:u,index:v,rows:b,groupName:y}}))},s=l=>t.setGroups([]);return E.jsx(w.Fragment,{children:E.jsxs(Po,{arrow:!1,title:"Groups",trigger:E.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[E.jsx(P0,{size:14}),"Groups",t.groups.length>0?` - ${r}(${t.groups.length})`:""]}),children:[E.jsxs("div",{className:"flex flex-nowrap items-center",children:[E.jsx(er,{value:r,title:"Tipo de agrupamento",onChange:i,options:e,placeholder:"Agrupar por..."}),E.jsx(Ki,{className:"mt-4",onClick:s,theme:"raw","data-id":r,children:E.jsx(xo,{size:16,className:"text-danger"})})]}),t.groups.length>0?E.jsxs("section",{className:"my-4",children:[E.jsx("header",{children:E.jsx("h2",{className:"text-xl font-medium",children:"Ordenar grupos"})}),E.jsx(wC,{children:E.jsx(ys.Group,{axis:"y",className:"relative space-y-2",dragListener:!1,dragControls:n,drag:!0,layoutScroll:!0,onReorder:t.setGroups,values:t.groups,children:t.groups.map(l=>E.jsx(WO,{item:l,onPointerDown:c=>{n.start(c),t.setGroups([...t.groups])}},l.groupId))})})]}):null]})})},UO=t=>(e,n)=>t.reduce((r,o)=>{const i=o.type==="desc"?-1:1,s=o.value,a=e[s]>n[s]?i:e[s]<n[s]?-i:0;return r!==0?r:a},0),GO=(t,e)=>t.sort(UO(e)),du={asc:{label:"Ascending",value:"asc"},desc:{label:"Descending",value:"desc"}},KO=[du.asc,du.desc],hu=(t,e="asc")=>({id:Ws(),type:e,value:t.id,label:du.asc.label}),ZO=t=>{const e=()=>{const i=t.cols[0];i&&t.set(s=>[...s,hu(i)])},n=i=>s=>{const a=s.target.value;t.set(l=>l.map(c=>c.id===i?{...c,value:a}:c))},r=i=>s=>{const a=s.target.value;t.set(l=>l.map(c=>c.id===i?{...c,type:a}:c))},o=i=>{const s=i.currentTarget.dataset.id||"";t.set(a=>a.filter(l=>l.id!==s))};return E.jsx(w.Fragment,{children:E.jsx(Po,{arrow:!1,title:"Order By",trigger:E.jsxs("span",{className:"flex items-center gap-1 proportional-nums text-foreground-description",children:[E.jsx(Gf,{size:14}),"Order by ",t.sorters.length===0?"":` (${t.sorters.length})`]}),children:E.jsxs("ul",{className:"mt-4 space-y-2",children:[t.sorters.map(i=>E.jsxs("li",{className:"flex flex-nowrap gap-3",children:[E.jsx(er,{onChange:n(i.id),options:t.options,placeholder:"Selecione um campo...",value:i.value}),E.jsx(er,{onChange:r(i.id),value:i.type,options:KO,placeholder:"Operação..."}),E.jsx("button",{className:"mt-4","data-id":i.id,onClick:o,children:E.jsx(xo,{className:"text-danger",size:14})})]},`sorter-select-${i.id}`)),E.jsx("li",{children:E.jsxs("button",{onClick:e,className:"text-primary flex items-center gap-1",children:[E.jsx(ja,{size:14})," Adicionar ordenação"]})})]})})})},qO=t=>{const e=t.sorters.find(i=>i.id===t.col.id),[n,r]=w.useState(e?e.type:"undefined"),o=()=>r(i=>i==="undefined"?"asc":i==="asc"?"desc":"undefined");return w.useEffect(()=>{t.setSorters(i=>{if(n==="undefined")return i.filter(a=>a.value!==t.col.id);const s=i.findIndex(a=>a.value===t.col.id);return s===-1?[...i,hu(t.col,n)]:(i[s]=hu(t.col,n),[...i])})},[n,t.col]),E.jsxs("button",{className:"isolate flex items-center",onClick:o,children:[n==="asc"?E.jsx($a,{size:14}):null,n==="desc"?E.jsx(T0,{size:14}):null,n==="undefined"?E.jsx(Gf,{size:14}):null]})},YO=t=>E.jsx("header",{className:"min-w-full mb-1",children:E.jsxs("div",{className:"flex flex-wrap min-w-full items-center justify-between gap-x-4 gap-y-1",children:[E.jsxs("div",{className:"flex w-fit items-centeend gap-4 whitespace-nowrap py-2",children:[E.jsx("p",{children:E.jsx(BO,{cols:t.cols,options:t.options,filters:t.filters,set:t.setFilters})}),E.jsx("p",{children:E.jsx(ZO,{options:t.options,cols:t.cols,sorters:t.sorters,set:t.setSorters})}),E.jsx("p",{children:E.jsx(HO,{rows:t.rows,groups:t.groups,setGroups:t.setGroups,options:t.options,cols:t.cols})})]}),E.jsx("ul",{className:"flex flex-wrap w-full flex-1 flex-grow flex-row items-center md:justify-end gap-4",children:t.filters.map(e=>E.jsxs("li",{className:"flex gap-1 items-center rounded-xl border border-card-border px-4 py-0.5",children:[E.jsxs("span",{children:[E.jsx("span",{className:"size-3 mr-2 aspect-square bg-primary inline-block rounded-full","aria-hidden":"true"}),e.label," ",e.operation.label.toLowerCase(),":"]}),E.jsxs("div",{className:"relative w-min min-w-[1ch]",children:[E.jsx("span",{"aria-hidden":"true",className:"invisible whitespace-pre p-0",children:e.value||" "}),E.jsx("input",{type:e.type,value:e.value,className:"absolute left-0 top-0 m-0 inline-block w-full bg-transparent p-0 placeholder-primary/70 outline-none [appearance:textfield] after:empty:text-primary/70 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",onChange:n=>{const r=uu(n.target);t.setFilters(o=>o.map(i=>e.id===i.id?{...i,value:r}:i))}})]})]},`filter-table-${e.id}`))})]})}),cv=(t,e)=>{const[n,r]=w.useState(()=>e||t);return w.useEffect(()=>{r(t)},[t]),[n,r]},XO={opacity:1},JO={opacity:.75,backgroundColor:"#a1a1aa"},QO={opacity:0,transition:{duration:.4,type:"spring"}},eI=t=>{var n;const e=t.filters.filter(r=>r.name===t.header.id);return E.jsx(ys.Item,{...t.header.thProps,as:"th",exit:QO,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,value:t.header,whileDrag:JO,animate:XO,className:`hidden px-2 py-4 first:table-cell md:table-cell ${((n=t.header.thProps)==null?void 0:n.className)??""}`,children:E.jsx("span",{className:"flex items-center justify-between",children:E.jsxs("span",{className:"flex items-center gap-1",children:[E.jsxs(Po,{arrow:!0,trigger:E.jsx(Kf,{size:14}),onChange:r=>{r&&t.setFilters(o=>o.concat(Hs(t.header,{})))},children:["Filter by: ",av(t.header),e.length===0===null?null:E.jsxs("ul",{children:[e.map(r=>E.jsx("li",{className:"my-1",children:E.jsx(zO,{filter:r,set:t.setFilters})},`thead-filter-${r.id}`)),E.jsx("li",{children:E.jsxs("button",{onClick:()=>t.setFilters(r=>r.concat(Hs(t.header))),className:"text-primary-muted flex items-center",children:[E.jsx(ja,{size:14})," Add"]})})]})]}),E.jsx("span",{className:"pointer-events-auto text-balance text-base",children:t.header.thead}),E.jsx(qO,{col:t.header,setSorters:t.setSorters,sorters:t.sorters})]})})})},tI=t=>{const[e,n]=cv(t.headers),r=()=>t.setCols(e);return E.jsx(ys.Group,{as:"tr",axis:"x",drag:!0,layout:!0,layoutRoot:!0,layoutScroll:!0,initial:!1,values:e,onReorder:n,onPointerUp:r,className:"bg-table-background border-none text-lg",children:E.jsx(Hm,{children:e.map(o=>E.jsx(eI,{setFilters:t.setFilters,filters:t.filters,setSorters:t.setSorters,sorters:t.sorters,header:o},`header-child-item-${o.id}`))})})},nI=w.forwardRef((t,e)=>E.jsx("tbody",{...t,className:`divide-y divide-table-row ${t.className??""}`,ref:e,children:E.jsx(Hm,{children:t.children})})),rI=w.forwardRef((t,e)=>E.jsx("table",{...t,ref:e,className:`table min-w-full divide-y divide-table-border table-auto text-left ${t.className??""}`})),oI=w.forwardRef((t,e)=>E.jsx("thead",{...t,className:"bg-content-bg shadow-xs group:sticky top-0",ref:e})),iI=w.forwardRef((t,e)=>E.jsx("tr",{...t,ref:e,className:`table-row ${t.className??""}`})),sI={TableHead:oI,Table:rI,TableBody:nI,TableRow:iI},aI=[0,0,0,0,0,0,0,0,0,0],uv=({filters:t,setCols:e,setFilters:n,sorters:r,cols:o,setSorters:i,...s})=>{const a=w.useMemo(()=>{if(s.loading)return aI;const l=new cg(s.rows);return t.length>0&&t.forEach(c=>c.value===""||Number.isNaN(c.value)?void 0:l.Where(c.name,c.operation.symbol,c.value)),r.length===0?l.Select():GO(l.Select(),r)},[s.rows,t,r,s.loading]);return E.jsx("div",{className:"group border border-table-border rounded-lg px-1 min-w-full",children:E.jsx(E_,{data:a,totalCount:a.length,useWindowScroll:!0,components:sI,fixedHeaderContent:()=>E.jsx(tI,{sorters:r,setSorters:i,filters:t,setFilters:n,headers:o,setCols:e}),itemContent:(l,c)=>o.map((u,f)=>{const d=`${f},${l}`,h=sv(c,u.id),p=u.Element;return w.createElement("td",{...u.cellProps,"data-matrix":d,key:`accessor-${l}-${f}`,className:"px-2 h-14 border-none first:table-cell hidden md:table-cell"},s.loading?E.jsx("div",{className:"animate-pulse h-2 bg-table-border rounded"}):p?E.jsx(p,{row:c,matrix:d,col:u,rowIndex:l,value:h}):E.jsx(w.Fragment,{children:zs.nil(h)?"":h}))})})})},lI=(t,e)=>typeof e=="function"?e(t):e,cI=t=>{const e=w.useMemo(()=>lv(t.cols),[t.cols]),[n,r]=VO({cols:t.cols,filters:t.filters??[],groups:t.groups??[],sorters:t.sorters??[]},o=>{const i=s=>a=>{const l=o.state();return{...l,[s]:lI(l[s],a)}};return{cols:i("cols"),filters:i("filters"),groups:i("groups"),sorters:i("sorters")}},{interceptor:[o=>{var i;return(i=t.set)==null||i.call(t,o),o}]});return E.jsxs("div",{className:"relative min-w-full",children:[E.jsx(YO,{setCols:r.cols,rows:t.rows,cols:n.cols,filters:n.filters,groups:n.groups,options:e,setFilters:r.filters,setGroups:r.groups,setSorters:r.sorters,sorters:n.sorters}),n.groups.length===0?E.jsx(uv,{...t,cols:n.cols,filters:n.filters,groups:n.groups,index:0,optionCols:e,options:e,setCols:r.cols,setFilters:r.filters,setGroups:r.groups,setSorters:r.sorters,sorters:n.sorters}):E.jsx("div",{className:"flex flex-wrap gap-4",children:n.groups.map((o,i)=>E.jsx(fc.div,{className:"min-w-full",children:E.jsx(uv,{...t,cols:n.cols,filters:n.filters,group:o,groups:n.groups,index:i,optionCols:e,options:e,rows:o.rows,setCols:r.cols,setFilters:r.filters,setGroups:r.groups,setSorters:r.sorters,sorters:n.sorters})},`group-${o.groupId}`))})]})};var uI=String.prototype.replace,fI=/%20/g,pu={RFC1738:"RFC1738",RFC3986:"RFC3986"},mu={default:pu.RFC3986,formatters:{RFC1738:function(t){return uI.call(t,fI,"+")},RFC3986:function(t){return String(t)}},RFC1738:pu.RFC1738,RFC3986:pu.RFC3986},dI=mu,gu=Object.prototype.hasOwnProperty,mr=Array.isArray,on=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),hI=function(e){for(;e.length>1;){var n=e.pop(),r=n.obj[n.prop];if(mr(r)){for(var o=[],i=0;i<r.length;++i)typeof r[i]<"u"&&o.push(r[i]);n.obj[n.prop]=o}}},fv=function(e,n){for(var r=n&&n.plainObjects?Object.create(null):{},o=0;o<e.length;++o)typeof e[o]<"u"&&(r[o]=e[o]);return r},pI=function t(e,n,r){if(!n)return e;if(typeof n!="object"){if(mr(e))e.push(n);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!gu.call(Object.prototype,n))&&(e[n]=!0);else return[e,n];return e}if(!e||typeof e!="object")return[e].concat(n);var o=e;return mr(e)&&!mr(n)&&(o=fv(e,r)),mr(e)&&mr(n)?(n.forEach(function(i,s){if(gu.call(e,s)){var a=e[s];a&&typeof a=="object"&&i&&typeof i=="object"?e[s]=t(a,i,r):e.push(i)}else e[s]=i}),e):Object.keys(n).reduce(function(i,s){var a=n[s];return gu.call(i,s)?i[s]=t(i[s],a,r):i[s]=a,i},o)},mI=function(e,n){return Object.keys(n).reduce(function(r,o){return r[o]=n[o],r},e)},gI=function(t,e,n){var r=t.replace(/\+/g," ");if(n==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},yu=1024,yI=function(e,n,r,o,i){if(e.length===0)return e;var s=e;if(typeof e=="symbol"?s=Symbol.prototype.toString.call(e):typeof e!="string"&&(s=String(e)),r==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});for(var a="",l=0;l<s.length;l+=yu){for(var c=s.length>=yu?s.slice(l,l+yu):s,u=[],f=0;f<c.length;++f){var d=c.charCodeAt(f);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===dI.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(f);continue}if(d<128){u[u.length]=on[d];continue}if(d<2048){u[u.length]=on[192|d>>6]+on[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=on[224|d>>12]+on[128|d>>6&63]+on[128|d&63];continue}f+=1,d=65536+((d&1023)<<10|c.charCodeAt(f)&1023),u[u.length]=on[240|d>>18]+on[128|d>>12&63]+on[128|d>>6&63]+on[128|d&63]}a+=u.join("")}return a},vI=function(e){for(var n=[{obj:{o:e},prop:"o"}],r=[],o=0;o<n.length;++o)for(var i=n[o],s=i.obj[i.prop],a=Object.keys(s),l=0;l<a.length;++l){var c=a[l],u=s[c];typeof u=="object"&&u!==null&&r.indexOf(u)===-1&&(n.push({obj:s,prop:c}),r.push(u))}return hI(n),e},bI=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},xI=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},wI=function(e,n){return[].concat(e,n)},SI=function(e,n){if(mr(e)){for(var r=[],o=0;o<e.length;o+=1)r.push(n(e[o]));return r}return n(e)},dv={arrayToObject:fv,assign:mI,combine:wI,compact:vI,decode:gI,encode:yI,isBuffer:xI,isRegExp:bI,maybeMap:SI,merge:pI},hv=aO,Us=dv,li=mu,TI=Object.prototype.hasOwnProperty,pv={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,n){return e+"["+n+"]"},repeat:function(e){return e}},sn=Array.isArray,EI=Array.prototype.push,mv=function(t,e){EI.apply(t,sn(e)?e:[e])},CI=Date.prototype.toISOString,gv=li.default,et={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Us.encode,encodeValuesOnly:!1,format:gv,formatter:li.formatters[gv],indices:!1,serializeDate:function(e){return CI.call(e)},skipNulls:!1,strictNullHandling:!1},AI=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},vu={},_I=function t(e,n,r,o,i,s,a,l,c,u,f,d,h,p,m,y,v,b){for(var g=e,S=b,x=0,T=!1;(S=S.get(vu))!==void 0&&!T;){var P=S.get(e);if(x+=1,typeof P<"u"){if(P===x)throw new RangeError("Cyclic object value");T=!0}typeof S.get(vu)>"u"&&(x=0)}if(typeof u=="function"?g=u(n,g):g instanceof Date?g=h(g):r==="comma"&&sn(g)&&(g=Us.maybeMap(g,function(C){return C instanceof Date?h(C):C})),g===null){if(s)return c&&!y?c(n,et.encoder,v,"key",p):n;g=""}if(AI(g)||Us.isBuffer(g)){if(c){var O=y?n:c(n,et.encoder,v,"key",p);return[m(O)+"="+m(c(g,et.encoder,v,"value",p))]}return[m(n)+"="+m(String(g))]}var k=[];if(typeof g>"u")return k;var D;if(r==="comma"&&sn(g))y&&c&&(g=Us.maybeMap(g,c)),D=[{value:g.length>0?g.join(",")||null:void 0}];else if(sn(u))D=u;else{var L=Object.keys(g);D=f?L.sort(f):L}var A=l?n.replace(/\./g,"%2E"):n,j=o&&sn(g)&&g.length===1?A+"[]":A;if(i&&sn(g)&&g.length===0)return j+"[]";for(var F=0;F<D.length;++F){var _=D[F],M=typeof _=="object"&&typeof _.value<"u"?_.value:g[_];if(!(a&&M===null)){var N=d&&l?_.replace(/\./g,"%2E"):_,z=sn(g)?typeof r=="function"?r(j,N):j:j+(d?"."+N:"["+N+"]");b.set(e,x);var q=hv();q.set(vu,b),mv(k,t(M,z,r,o,i,s,a,l,r==="comma"&&y&&sn(g)?null:c,u,f,d,h,p,m,y,v,q))}}return k},PI=function(e){if(!e)return et;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var n=e.charset||et.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=li.default;if(typeof e.format<"u"){if(!TI.call(li.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=li.formatters[r],i=et.filter;(typeof e.filter=="function"||sn(e.filter))&&(i=e.filter);var s;if(e.arrayFormat in pv?s=e.arrayFormat:"indices"in e?s=e.indices?"indices":"repeat":s=et.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:et.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:et.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:et.allowEmptyArrays,arrayFormat:s,charset:n,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:et.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?et.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:et.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:et.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:et.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:et.encodeValuesOnly,filter:i,format:r,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:et.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:et.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:et.strictNullHandling}},OI=function(t,e){var n=t,r=PI(e),o,i;typeof r.filter=="function"?(i=r.filter,n=i("",n)):sn(r.filter)&&(i=r.filter,o=i);var s=[];if(typeof n!="object"||n===null)return"";var a=pv[r.arrayFormat],l=a==="comma"&&r.commaRoundTrip;o||(o=Object.keys(n)),r.sort&&o.sort(r.sort);for(var c=hv(),u=0;u<o.length;++u){var f=o[u];r.skipNulls&&n[f]===null||mv(s,_I(n[f],f,a,l,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,c))}var d=s.join(r.delimiter),h=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),d.length>0?h+d:""},ro=dv,bu=Object.prototype.hasOwnProperty,II=Array.isArray,Ye={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ro.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},kI=function(t){return t.replace(/&#(\d+);/g,function(e,n){return String.fromCharCode(parseInt(n,10))})},yv=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},DI="utf8=%26%2310003%3B",MI="utf8=%E2%9C%93",RI=function(e,n){var r={__proto__:null},o=n.ignoreQueryPrefix?e.replace(/^\?/,""):e;o=o.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i=n.parameterLimit===1/0?void 0:n.parameterLimit,s=o.split(n.delimiter,i),a=-1,l,c=n.charset;if(n.charsetSentinel)for(l=0;l<s.length;++l)s[l].indexOf("utf8=")===0&&(s[l]===MI?c="utf-8":s[l]===DI&&(c="iso-8859-1"),a=l,l=s.length);for(l=0;l<s.length;++l)if(l!==a){var u=s[l],f=u.indexOf("]="),d=f===-1?u.indexOf("="):f+1,h,p;d===-1?(h=n.decoder(u,Ye.decoder,c,"key"),p=n.strictNullHandling?null:""):(h=n.decoder(u.slice(0,d),Ye.decoder,c,"key"),p=ro.maybeMap(yv(u.slice(d+1),n),function(y){return n.decoder(y,Ye.decoder,c,"value")})),p&&n.interpretNumericEntities&&c==="iso-8859-1"&&(p=kI(p)),u.indexOf("[]=")>-1&&(p=II(p)?[p]:p);var m=bu.call(r,h);m&&n.duplicates==="combine"?r[h]=ro.combine(r[h],p):(!m||n.duplicates==="last")&&(r[h]=p)}return r},FI=function(t,e,n,r){for(var o=r?e:yv(e,n),i=t.length-1;i>=0;--i){var s,a=t[i];if(a==="[]"&&n.parseArrays)s=n.allowEmptyArrays&&(o===""||n.strictNullHandling&&o===null)?[]:[].concat(o);else{s=n.plainObjects?Object.create(null):{};var l=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,c=n.decodeDotInKeys?l.replace(/%2E/g,"."):l,u=parseInt(c,10);!n.parseArrays&&c===""?s={0:o}:!isNaN(u)&&a!==c&&String(u)===c&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(s=[],s[u]=o):c!=="__proto__"&&(s[c]=o)}o=s}return o},LI=function(e,n,r,o){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=r.depth>0&&s.exec(i),c=l?i.slice(0,l.index):i,u=[];if(c){if(!r.plainObjects&&bu.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var f=0;r.depth>0&&(l=a.exec(i))!==null&&f<r.depth;){if(f+=1,!r.plainObjects&&bu.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+i.slice(l.index)+"]"),FI(u,n,r,o)}},NI=function(e){if(!e)return Ye;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=typeof e.charset>"u"?Ye.charset:e.charset,r=typeof e.duplicates>"u"?Ye.duplicates:e.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var o=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:Ye.allowDots:!!e.allowDots;return{allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Ye.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ye.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ye.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ye.arrayLimit,charset:n,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ye.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ye.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Ye.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Ye.decoder,delimiter:typeof e.delimiter=="string"||ro.isRegExp(e.delimiter)?e.delimiter:Ye.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ye.depth,duplicates:r,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ye.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ye.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ye.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ye.strictNullHandling}},VI=function(t,e){var n=NI(e);if(t===""||t===null||typeof t>"u")return n.plainObjects?Object.create(null):{};for(var r=typeof t=="string"?RI(t,n):t,o=n.plainObjects?Object.create(null):{},i=Object.keys(r),s=0;s<i.length;++s){var a=i[s],l=LI(a,r[a],n,typeof t=="string");o=ro.merge(o,l,n)}return n.allowSparse===!0?o:ro.compact(o)},$I=OI,jI=VI,BI=mu,zI={formats:BI,parse:jI,stringify:$I},Ee;(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},t.getValidEnumValues=o=>{const i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(const s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ee||(Ee={}));var vv;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(vv||(vv={}));const te=Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gr=t=>{switch(typeof t){case"undefined":return te.undefined;case"string":return te.string;case"number":return isNaN(t)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(t)?te.array:t===null?te.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?te.promise:typeof Map<"u"&&t instanceof Map?te.map:typeof Set<"u"&&t instanceof Set?te.set:typeof Date<"u"&&t instanceof Date?te.date:te.object;default:return te.unknown}},G=Ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class jt extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(e){if(!(e instanceof jt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}jt.create=t=>new jt(t);const ci=(t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===te.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ee.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ee.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ee.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Ee.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ee.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case G.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case G.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ee.assertNever(t)}return{message:n}};let WI=ci;function xu(){return WI}const wu=t=>{const{data:e,path:n,errorMaps:r,issueData:o}=t,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};function Q(t,e){const n=xu(),r=wu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ci?void 0:ci].filter(o=>!!o)});t.common.issues.push(r)}class St{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const o of n){if(o.status==="aborted")return de;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return St.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return de;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}}const de=Object.freeze({status:"aborted"}),ui=t=>({status:"dirty",value:t}),Ot=t=>({status:"valid",value:t}),bv=t=>t.status==="aborted",xv=t=>t.status==="dirty",Gs=t=>t.status==="valid",Ks=t=>typeof Promise<"u"&&t instanceof Promise;function Zs(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function wv(t,e,n,r,o){if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}typeof SuppressedError=="function"&&SuppressedError;var ie;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ie||(ie={}));var fi,di;class an{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}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 Sv=(t,e)=>{if(Gs(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new jt(t.common.issues);return this._error=n,this._error}}};function ge(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,c;const{message:u}=t;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class xe{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 gr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:gr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new St,ctx:{common:e.parent.common,data:e.data,parsedType:gr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ks(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gr(e)},i=this._parseSync({data:e,path:o.path,parent:o});return Sv(o,i)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gr(e)},o=this._parse({data:e,path:r.path,parent:r}),i=await(Ks(o)?o:Promise.resolve(o));return Sv(r,i)}refine(e,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=e(o),a=()=>i.addIssue({code:G.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Sn({schema:this,typeName:ue.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Tn.create(this,this._def)}nullable(){return br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kt.create(this,this._def)}promise(){return mi.create(this,this._def)}or(e){return Xs.create([this,e],this._def)}and(e){return Js.create(this,e,this._def)}transform(e){return new Sn({...ge(this._def),schema:this,typeName:ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ra({...ge(this._def),innerType:this,defaultValue:n,typeName:ue.ZodDefault})}brand(){return new Av({typeName:ue.ZodBranded,type:this,...ge(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new oa({...ge(this._def),innerType:this,catchValue:n,typeName:ue.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return ia.create(this,e)}readonly(){return sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const HI=/^c[^\s-]{8,}$/i,UI=/^[0-9a-z]+$/,GI=/^[0-9A-HJKMNP-TV-Z]{26}$/,KI=/^[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,ZI=/^[a-z0-9_-]{21}$/i,qI=/^[-+]?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)?)??$/,YI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,XI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Su;const JI=/^(?:(?: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])$/,QI=/^(([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})))$/,ek=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tv="((\\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])))",tk=new RegExp(`^${Tv}$`);function Ev(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function nk(t){return new RegExp(`^${Ev(t)}$`)}function rk(t){let e=`${Tv}T${Ev(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ok(t,e){return!!((e==="v4"||!e)&&JI.test(t)||(e==="v6"||!e)&&QI.test(t))}class bn extends xe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==te.string){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.string,received:i.parsedType}),de}const r=new St;let o;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?Q(o,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Q(o,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")YI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"email",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Su||(Su=new RegExp(XI,"u")),Su.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"emoji",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")KI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"uuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")ZI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"nanoid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")HI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"cuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")UI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"cuid2",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")GI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"ulid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Q(o,{validation:"url",code:G.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"regex",code:G.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?rk(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?tk.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?nk(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?qI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"duration",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?ok(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"ip",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ek.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"base64",code:G.invalid_string,message:i.message}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:G.invalid_string,...ie.errToObj(r)})}_addCheck(e){return new bn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ie.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ie.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ie.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ie.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ie.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ie.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ie.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ie.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ie.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ie.errToObj(e)})}datetime(e){var n,r;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:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...ie.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,...ie.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ie.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ie.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ie.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ie.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ie.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ie.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ie.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ie.errToObj(n)})}nonempty(e){return this.min(1,ie.errToObj(e))}trim(){return new bn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bn({...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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}bn.create=t=>{var e;return new bn({checks:[],typeName:ue.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...ge(t)})};function ik(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(t.toFixed(o).replace(".","")),s=parseInt(e.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class yr extends xe{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)!==te.number){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.number,received:i.parsedType}),de}let r;const o=new St;for(const i of this._def.checks)i.kind==="int"?Ee.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Q(r,{code:G.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ik(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Q(r,{code:G.not_finite,message:i.message}),o.dirty()):Ee.assertNever(i);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ie.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ie.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ie.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ie.toString(n))}setLimit(e,n,r,o){return new yr({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ie.toString(o)}]})}_addCheck(e){return new yr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ie.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ie.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ie.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ee.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}yr.create=t=>new yr({checks:[],typeName:ue.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ge(t)});class oo extends xe{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)!==te.bigint){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.bigint,received:i.parsedType}),de}let r;const o=new St;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ee.assertNever(i);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ie.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ie.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ie.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ie.toString(n))}setLimit(e,n,r,o){return new oo({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ie.toString(o)}]})}_addCheck(e){return new oo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ie.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}oo.create=t=>{var e;return new oo({checks:[],typeName:ue.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...ge(t)})};class Tu extends xe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==te.boolean){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.boolean,received:r.parsedType}),de}return Ot(e.data)}}Tu.create=t=>new Tu({typeName:ue.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ge(t)});class hi extends xe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==te.date){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.date,received:i.parsedType}),de}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_date}),de}const r=new St;let o;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hi({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ie.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ie.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}hi.create=t=>new hi({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ue.ZodDate,...ge(t)});class Eu extends xe{_parse(e){if(this._getType(e)!==te.symbol){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.symbol,received:r.parsedType}),de}return Ot(e.data)}}Eu.create=t=>new Eu({typeName:ue.ZodSymbol,...ge(t)});class qs extends xe{_parse(e){if(this._getType(e)!==te.undefined){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.undefined,received:r.parsedType}),de}return Ot(e.data)}}qs.create=t=>new qs({typeName:ue.ZodUndefined,...ge(t)});class Ys extends xe{_parse(e){if(this._getType(e)!==te.null){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.null,received:r.parsedType}),de}return Ot(e.data)}}Ys.create=t=>new Ys({typeName:ue.ZodNull,...ge(t)});class Cu extends xe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ot(e.data)}}Cu.create=t=>new Cu({typeName:ue.ZodAny,...ge(t)});class io extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ot(e.data)}}io.create=t=>new io({typeName:ue.ZodUnknown,...ge(t)});class Zn extends xe{_parse(e){const n=this._getOrReturnCtx(e);return Q(n,{code:G.invalid_type,expected:te.never,received:n.parsedType}),de}}Zn.create=t=>new Zn({typeName:ue.ZodNever,...ge(t)});class Au extends xe{_parse(e){if(this._getType(e)!==te.undefined){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.void,received:r.parsedType}),de}return Ot(e.data)}}Au.create=t=>new Au({typeName:ue.ZodVoid,...ge(t)});class Kt extends xe{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==te.array)return Q(n,{code:G.invalid_type,expected:te.array,received:n.parsedType}),de;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(Q(n,{code:s?G.too_big:G.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(Q(n,{code:G.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(Q(n,{code:G.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new an(n,s,n.path,a)))).then(s=>St.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new an(n,s,n.path,a)));return St.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Kt({...this._def,minLength:{value:e,message:ie.toString(n)}})}max(e,n){return new Kt({...this._def,maxLength:{value:e,message:ie.toString(n)}})}length(e,n){return new Kt({...this._def,exactLength:{value:e,message:ie.toString(n)}})}nonempty(e){return this.min(1,e)}}Kt.create=(t,e)=>new Kt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ue.ZodArray,...ge(e)});function so(t){if(t instanceof Ze){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Tn.create(so(r))}return new Ze({...t._def,shape:()=>e})}else return t instanceof Kt?new Kt({...t._def,type:so(t.element)}):t instanceof Tn?Tn.create(so(t.unwrap())):t instanceof br?br.create(so(t.unwrap())):t instanceof wn?wn.create(t.items.map(e=>so(e))):t}class Ze extends xe{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(),n=Ee.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==te.object){const c=this._getOrReturnCtx(e);return Q(c,{code:G.invalid_type,expected:te.object,received:c.parsedType}),de}const{status:r,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Zn&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new an(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Zn){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(Q(o,{code:G.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new an(o,f,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,d=await u.value;c.push({key:f,value:d,alwaysSet:u.alwaysSet})}return c}).then(c=>St.mergeObjectSync(r,c)):St.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ie.errToObj,new Ze({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var o,i,s,a;const l=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ie.errToObj(e).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Ze({...this._def,unknownKeys:"strip"})}passthrough(){return new Ze({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ze({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ze({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ue.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Ze({...this._def,catchall:e})}pick(e){const n={};return Ee.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Ze({...this._def,shape:()=>n})}omit(e){const n={};return Ee.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Ze({...this._def,shape:()=>n})}deepPartial(){return so(this)}partial(e){const n={};return Ee.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}),new Ze({...this._def,shape:()=>n})}required(e){const n={};return Ee.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Tn;)i=i._def.innerType;n[r]=i}}),new Ze({...this._def,shape:()=>n})}keyof(){return Cv(Ee.objectKeys(this.shape))}}Ze.create=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strip",catchall:Zn.create(),typeName:ue.ZodObject,...ge(e)}),Ze.strictCreate=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strict",catchall:Zn.create(),typeName:ue.ZodObject,...ge(e)}),Ze.lazycreate=(t,e)=>new Ze({shape:t,unknownKeys:"strip",catchall:Zn.create(),typeName:ue.ZodObject,...ge(e)});class Xs extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new jt(a.ctx.common.issues));return Q(n,{code:G.invalid_union,unionErrors:s}),de}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new jt(l));return Q(n,{code:G.invalid_union,unionErrors:a}),de}}get options(){return this._def.options}}Xs.create=(t,e)=>new Xs({options:t,typeName:ue.ZodUnion,...ge(e)});const xn=t=>t instanceof ea?xn(t.schema):t instanceof Sn?xn(t.innerType()):t instanceof ta?[t.value]:t instanceof vr?t.options:t instanceof na?Ee.objectValues(t.enum):t instanceof ra?xn(t._def.innerType):t instanceof qs?[void 0]:t instanceof Ys?[null]:t instanceof Tn?[void 0,...xn(t.unwrap())]:t instanceof br?[null,...xn(t.unwrap())]:t instanceof Av||t instanceof sa?xn(t.unwrap()):t instanceof oa?xn(t._def.innerType):[];class _u extends xe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.object)return Q(n,{code:G.invalid_type,expected:te.object,received:n.parsedType}),de;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Q(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const o=new Map;for(const i of n){const s=xn(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new _u({typeName:ue.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ge(r)})}}function Pu(t,e){const n=gr(t),r=gr(e);if(t===e)return{valid:!0,data:t};if(n===te.object&&r===te.object){const o=Ee.objectKeys(e),i=Ee.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(const a of i){const l=Pu(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===te.array&&r===te.array){if(t.length!==e.length)return{valid:!1};const o=[];for(let i=0;i<t.length;i++){const s=t[i],a=e[i],l=Pu(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===te.date&&r===te.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Js extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),o=(i,s)=>{if(bv(i)||bv(s))return de;const a=Pu(i.value,s.value);return a.valid?((xv(i)||xv(s))&&n.dirty(),{status:n.value,value:a.data}):(Q(r,{code:G.invalid_intersection_types}),de)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Js.create=(t,e,n)=>new Js({left:t,right:e,typeName:ue.ZodIntersection,...ge(n)});class wn extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.array)return Q(r,{code:G.invalid_type,expected:te.array,received:r.parsedType}),de;if(r.data.length<this._def.items.length)return Q(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&r.data.length>this._def.items.length&&(Q(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new an(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>St.mergeArray(n,s)):St.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new wn({...this._def,rest:e})}}wn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wn({items:t,typeName:ue.ZodTuple,rest:null,...ge(e)})};class Qs extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.object)return Q(r,{code:G.invalid_type,expected:te.object,received:r.parsedType}),de;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new an(r,a,r.path,a)),value:s._parse(new an(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?St.mergeObjectAsync(n,o):St.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof xe?new Qs({keyType:e,valueType:n,typeName:ue.ZodRecord,...ge(r)}):new Qs({keyType:bn.create(),valueType:e,typeName:ue.ZodRecord,...ge(n)})}}class Ou extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.map)return Q(r,{code:G.invalid_type,expected:te.map,received:r.parsedType}),de;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new an(r,a,r.path,[c,"key"])),value:i._parse(new an(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Ou.create=(t,e,n)=>new Ou({valueType:e,keyType:t,typeName:ue.ZodMap,...ge(n)});class ao extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.set)return Q(r,{code:G.invalid_type,expected:te.set,received:r.parsedType}),de;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(Q(r,{code:G.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(Q(r,{code:G.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return de;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new an(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,n){return new ao({...this._def,minSize:{value:e,message:ie.toString(n)}})}max(e,n){return new ao({...this._def,maxSize:{value:e,message:ie.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ao.create=(t,e)=>new ao({valueType:t,minSize:null,maxSize:null,typeName:ue.ZodSet,...ge(e)});class pi extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.function)return Q(n,{code:G.invalid_type,expected:te.function,received:n.parsedType}),de;function r(a,l){return wu({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xu(),ci].filter(c=>!!c),issueData:{code:G.invalid_arguments,argumentsError:l}})}function o(a,l){return wu({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xu(),ci].filter(c=>!!c),issueData:{code:G.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof mi){const a=this;return Ot(async function(...l){const c=new jt([]),u=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),f=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(f,i).catch(h=>{throw c.addIssue(o(f,h)),c})})}else{const a=this;return Ot(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new jt([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(u,i);if(!f.success)throw new jt([o(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pi({...this._def,args:wn.create(e).rest(io.create())})}returns(e){return new pi({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new pi({args:e||wn.create([]).rest(io.create()),returns:n||io.create(),typeName:ue.ZodFunction,...ge(r)})}}class ea extends xe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ea.create=(t,e)=>new ea({getter:t,typeName:ue.ZodLazy,...ge(e)});class ta extends xe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Q(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:e.data}}get value(){return this._def.value}}ta.create=(t,e)=>new ta({value:t,typeName:ue.ZodLiteral,...ge(e)});function Cv(t,e){return new vr({values:t,typeName:ue.ZodEnum,...ge(e)})}class vr extends xe{constructor(){super(...arguments),fi.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Q(n,{expected:Ee.joinValues(r),received:n.parsedType,code:G.invalid_type}),de}if(Zs(this,fi)||wv(this,fi,new Set(this._def.values)),!Zs(this,fi).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Q(n,{received:n.data,code:G.invalid_enum_value,options:r}),de}return Ot(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return vr.create(e,{...this._def,...n})}exclude(e,n=this._def){return vr.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}fi=new WeakMap,vr.create=Cv;class na extends xe{constructor(){super(...arguments),di.set(this,void 0)}_parse(e){const n=Ee.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==te.string&&r.parsedType!==te.number){const o=Ee.objectValues(n);return Q(r,{expected:Ee.joinValues(o),received:r.parsedType,code:G.invalid_type}),de}if(Zs(this,di)||wv(this,di,new Set(Ee.getValidEnumValues(this._def.values))),!Zs(this,di).has(e.data)){const o=Ee.objectValues(n);return Q(r,{received:r.data,code:G.invalid_enum_value,options:o}),de}return Ot(e.data)}get enum(){return this._def.values}}di=new WeakMap,na.create=(t,e)=>new na({values:t,typeName:ue.ZodNativeEnum,...ge(e)});class mi extends xe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.promise&&n.common.async===!1)return Q(n,{code:G.invalid_type,expected:te.promise,received:n.parsedType}),de;const r=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return Ot(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}mi.create=(t,e)=>new mi({type:t,typeName:ue.ZodPromise,...ge(e)});class Sn extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{Q(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return de;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?de:l.status==="dirty"||n.value==="dirty"?ui(l.value):l});{if(n.value==="aborted")return de;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?de:a.status==="dirty"||n.value==="dirty"?ui(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?de:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?de:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Gs(s))return s;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Gs(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);Ee.assertNever(o)}}Sn.create=(t,e,n)=>new Sn({schema:t,typeName:ue.ZodEffects,effect:e,...ge(n)}),Sn.createWithPreprocess=(t,e,n)=>new Sn({schema:e,effect:{type:"preprocess",transform:t},typeName:ue.ZodEffects,...ge(n)});class Tn extends xe{_parse(e){return this._getType(e)===te.undefined?Ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tn.create=(t,e)=>new Tn({innerType:t,typeName:ue.ZodOptional,...ge(e)});class br extends xe{_parse(e){return this._getType(e)===te.null?Ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}br.create=(t,e)=>new br({innerType:t,typeName:ue.ZodNullable,...ge(e)});class ra extends xe{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===te.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ra.create=(t,e)=>new ra({innerType:t,typeName:ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ge(e)});class oa extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ks(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}oa.create=(t,e)=>new oa({innerType:t,typeName:ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ge(e)});class Iu extends xe{_parse(e){if(this._getType(e)!==te.nan){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.nan,received:r.parsedType}),de}return{status:"valid",value:e.data}}}Iu.create=t=>new Iu({typeName:ue.ZodNaN,...ge(t)});class Av extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ia extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?de:i.status==="dirty"?(n.dirty(),ui(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?de:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new ia({in:e,out:n,typeName:ue.ZodPipeline})}}class sa extends xe{_parse(e){const n=this._def.innerType._parse(e),r=o=>(Gs(o)&&(o.value=Object.freeze(o.value)),o);return Ks(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}sa.create=(t,e)=>new sa({innerType:t,typeName:ue.ZodReadonly,...ge(e)}),Ze.lazycreate;var ue;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ue||(ue={})),bn.create,yr.create,Iu.create,oo.create,Tu.create,hi.create,Eu.create,qs.create,Ys.create,Cu.create,io.create,Zn.create,Au.create,Kt.create,Ze.create,Ze.strictCreate,Xs.create,_u.create,Js.create,wn.create,Qs.create,Ou.create,ao.create,pi.create,ea.create,ta.create,vr.create,na.create,mi.create,Sn.create,Tn.create,br.create,Sn.createWithPreprocess,ia.create;const sk={sort:(t,e)=>t.localeCompare(e),allowDots:!0,charset:"utf-8",parseArrays:!0,plainObjects:!0,charsetSentinel:!0,allowPrototypes:!1,depth:Number.MAX_SAFE_INTEGER,arrayLimit:Number.MAX_SAFE_INTEGER,parameterLimit:Number.MAX_SAFE_INTEGER},_v=t=>{const e=new FormData(t),n=new URLSearchParams(e);return zI.parse(n.toString(),sk)},Pv=t=>t.replace("[",".").replace("]","").split("."),ku=(t,e)=>Pv(t).reduce((n,r)=>{var i;if(r==="")return n;const o=((i=n.shape)==null?void 0:i[r])||n;return o instanceof Kt?o.element:o},e),aa=t=>t.type==="checkbox"?t.checked:t.type==="number"?t.valueAsNumber:t.value,ak=t=>{const[e,n]=w.useState(null),r=w.useRef({}),o=(l,c)=>{const u=ku(l,t);return{...c,name:l,id:l,error:e==null?void 0:e[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}},i=(l,c)=>{const u=ku(l,t);return{...c,name:l,id:l,type:zs.instance(u,yr)?"number":(c==null?void 0:c.type)??"text",error:e==null?void 0:e[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}};w.useEffect(()=>{const l=Object.values(r.current).map(u=>{const f=u.schema.safeParse(aa(u.element)),d=p=>{const m=u.schema.safeParse(aa(p.target)),y=u.element,v=y.name;if(m.success)return y.setCustomValidity(""),n(b=>{const{[v]:g,...S}=b||{};return S===null||zs.empty(S)?null:S});if(y.required){const b=m.error.issues[0].message;y.setCustomValidity(b),n(g=>({...g,[v]:b}))}},h=u.element.tagName==="INPUT"?"blur":"change";return u.element.addEventListener(h,d),{input:u,hasInitialError:u.element.required?!f.success:!1,unsubscribe:()=>u.element.removeEventListener(h,d)}});return l.some(u=>u.hasInitialError)&&n(u=>u===null?{}:u),()=>l.forEach(u=>u.unsubscribe())});const s=w.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget,f=Object.values(r.current).reduce((h,p)=>{const m=p.element,y=p.schema.safeParse(aa(m));if(y.success)return h;const v=y.error.issues[0].message;return m.setAttribute("data-initialized","true"),{...h,[m.name]:v}},{}),d=zs.empty(f)?null:{};n(d),l==null||l({form:u,errors:d||{}})},[]),a=w.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget;let f=_v(u);Array.from(u.elements).forEach(d=>{if(d.tagName==="SELECT"){const h=d;f=Ky(f,h.name,h.value)}if(d.tagName==="INPUT"){const h=d;f=Ky(f,h.name,aa(h))}}),l({form:u,json:f,event:c,reset:()=>rh(u)})},[]);return{input:i,select:o,onSubmit:a,errors:e,onInvalid:s,disabled:e!==null}},lk={name:"dark",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},colors:{foreground:"#f8fafc",background:"#191817",accent:"#0ea5e9",disabled:"#52525b",primary:{foreground:"#f8fafc",DEFAULT:"#0ea5e9",subtle:"#bae6fd",hover:"#0284c7"},secondary:{DEFAULT:"#475569",subtle:"#cbd5e1",hover:"#334155"},info:{DEFAULT:"#3b82f6",subtle:"#93c5fd",hover:"#1d4ed8"},danger:{DEFAULT:"#ef4444",subtle:"#fca5a5",hover:"#dc2626"},success:{DEFAULT:"#10b981",subtle:"#6ee7b7",hover:"#047857"},input:{border:"#52525b",placeholder:"#94a3b8","mask-error":"#fca5a5","switch-bg":"#171717",switch:"#fff"},card:{background:"#27272a",border:"#3f3f46",overlay:"#00000080"},floating:{background:"#252525",border:"#3f3f46",overlay:"#00000080"},tooltip:{background:"#141414",border:"#27272a"},table:{background:"#27272a",border:"#52525b",row:"#3f3f46"}}},ck={name:"light",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},colors:{foreground:"#334155",background:"#f1f5f9",accent:"#0ea5e9",disabled:"#52525b",primary:{foreground:"#f8fafc",DEFAULT:"#0ea5e9",subtle:"#bae6fd",hover:"#0284c7"},secondary:{DEFAULT:"#475569",subtle:"#cbd5e1",hover:"#334155"},info:{DEFAULT:"#3b82f6",subtle:"#93c5fd",hover:"#1d4ed8"},danger:{DEFAULT:"#ef4444",subtle:"#fca5a5",hover:"#dc2626"},success:{DEFAULT:"#10b981",subtle:"#6ee7b7",hover:"#047857"},input:{border:"#52525b",placeholder:"#94a3b8","mask-error":"#fca5a5","switch-bg":"#171717",switch:"#fff"},card:{background:"#ffffff",border:"#cbd5e1",overlay:"#00000080"},floating:{background:"#ffffff",border:"#cbd5e1",overlay:"#00000080"},tooltip:{background:"#141414",border:"#27272a"},table:{background:"#ffffff",border:"#cbd5e1",row:"#94a3b8"}}},uk={cssVariable:(t,e,n)=>`var(--${n})`,rgba:t=>`rgba(${t})`,rgb:t=>`rgb(${t})`,hsl:t=>`hsl(${t})`,hsla:t=>`hsla(${t})`,hex:t=>t,raw:t=>t},Ov=(t,e,n="",r="")=>Object.entries(t).reduce((o,[i,s])=>{const a=r===""?`${n}${i}`:`${r}-${i}`;if(typeof s=="string"){const l=r===""?`${n}${i}`:i;return o.concat(e(s,l,a))}return o.concat(Ov(s,e,n,a))},[]),Iv=(t,e,n="",r="")=>Object.entries(t).reduce((o,[i,s])=>{const a=r===""?`${n}${i}`:`${r}-${i}`;if(typeof s=="string"){const l=r===""?`${n}${i}`:i;return{...o,[l]:e(s,i,a)}}return{...o,[i]:Iv(s,e,n,a)}},{}),kv={default:t=>`:root { ${t} }`,dark:t=>`html.dark {${t}}`},Dv=(t,e)=>{const n=t.map(r=>`${r.key}: ${r.value}`).join(";");return e(n)},fk={default:t=>Dv(t,kv.default),dark:t=>Dv(t,kv.dark)};pe.Autocomplete=hx,pe.Button=Ki,pe.ButtonGroup=Ww,pe.Card=Qw,pe.Dropdown=Po,pe.FileUpload=qw,pe.Form=Xw,pe.Input=Ya,pe.InputFeedback=nd,pe.InputField=Vi,pe.Option=od,pe.Polymorph=Gi,pe.Select=er,pe.Switch=Jw,pe.Table=cI,pe.Tooltip=eS,pe.convertPath=Pv,pe.createDesignTokens=Iv,pe.createStyles=fk,pe.css=zt,pe.defaultDarkTheme=lk,pe.defaultLightTheme=ck,pe.formReset=rh,pe.formToJson=_v,pe.getSchemaShape=ku,pe.isReactComponent=cx,pe.isSsr=$O,pe.mergeRefs=Wa,pe.parsers=uk,pe.path=sv,pe.reduceTokens=Ov,pe.useForm=ak,pe.usePrevious=rd,pe.useReactive=cv,pe.uuid=Ws,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});
|
|
150
|
+
*/var tv;function MO(){return tv||(tv=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=w,e=Jy();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;function c(u,f,d,h,p){var m=i(null),y;m.current===null?(y={hasValue:!1,value:null},m.current=y):y=m.current;var v=a(function(){var x=!1,T,P,O=function(A){if(!x){x=!0,T=A;var j=h(A);if(p!==void 0&&y.hasValue){var F=y.value;if(p(F,j))return P=F,F}return P=j,j}var _=T,M=P;if(r(_,A))return M;var N=h(A);return p!==void 0&&p(M,N)?M:(T=A,P=N,N)},k=d===void 0?null:d,D=function(){return O(f())},L=k===null?void 0:function(){return O(k())};return[D,L]},[f,d,h,p]),b=v[0],g=v[1],S=o(u,b,g);return s(function(){y.hasValue=!0,y.value=S},[S]),l(S),S}ev.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ev}process.env.NODE_ENV==="production"?DO():MO();const no=t=>{const e=w.useRef(t??{});return w.useEffect(()=>void(e.current=t),[t]),e},RO=t=>{const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current},FO=t=>Object.entries(t),nv=t=>t instanceof Promise,rv=(t,e,n,r)=>e===t?n.reduce((o,i)=>i(o,e,r),t):t.constructor.name===Object.name?n.reduce((o,i)=>i(o,e,r),{...e,...t}):n.reduce((o,i)=>i(o,e,r),t),LO=(t,e,n,r,o,i)=>(...s)=>{const a=performance.now(),l=e(...s),c=(u,f)=>n(d=>rv(u,d,i,f));return nv(l)?l.then(u=>{o.current={method:t,props:r(),time:performance.now()-a},c(u,o.current)}):(o.current={method:t,props:r(),time:performance.now()-a},void c(l,o.current))},NO=(t,e,n,r,o,i)=>(...s)=>{o.current={method:t,time:0,props:r()};const a=e(...s),l=c=>n(u=>rv(c,u,i,o.current));return nv(a)?a.then(c=>l(c)):l(a)},VO=(t,e,n)=>{const[r,o]=w.useState(()=>t),i=no(r),s=no((n==null?void 0:n.props)??{}),a=no(e),l=no((n==null?void 0:n.postMiddleware)??[]),c=no((n==null?void 0:n.interceptor)??[]),u=w.useRef(t),f=RO(r),d=no(f),h=w.useRef(null);w.useEffect(()=>{if(h.current===null)return;const m=h.current;l.current.forEach(y=>{y(r,f,m)})},[r,l,f]);const[p]=w.useState(()=>{const m=()=>s.current,y=a.current({props:m,state:()=>i.current,initialState:u.current,previousState:()=>d.current});return FO(y).reduce((v,[b,g])=>({...v,[b]:n!=null&&n.debug?LO(b,g,o,m,h,c.current):NO(b,g,o,m,h,c.current)}),{})});return[r,p,s.current]},Ws=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)}),ov=(t,e,n)=>t.split(e).filter(Boolean).reduce((r,o)=>r!=null?r[o]:r,n),iv={basic:/[,[\]]+?/,extend:/[,[\].]+?/},sv=(t,e)=>{const n=ov(e,iv.basic,t)||ov(e,iv.extend,t);return n===void 0||n===t?void 0:n},$O=()=>typeof window>"u";var jO={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=(y,v)=>{try{Object.keys(y).forEach(v)}catch(b){window.console.log(b)}},n=y=>y==null,r=y=>{const v=typeof y;return v==="string"||v==="number"||v==="boolean"||n(y)},o=(y,v)=>{const b=v.getItem(y);try{return JSON.parse(b)}catch{return b??null}},i=y=>Object.keys(y).reduce((v,b)=>({...v,[b]:o(b,y)}),{}),s=y=>y instanceof Date?y:typeof y=="number"?new Date(new Date*1+y*864e5):y,a="1969-12-31T23:59:59.000Z",l=()=>document.cookie===""?{}:document.cookie.split("; ").map(y=>y.split("=")).reduce((y,v)=>(y[decodeURIComponent(v[0].trim())]=decodeURIComponent(v[1].trim()),y),{}),c=new Set,u=()=>{const y=l();c.forEach(v=>v(y))},f=[{name:"expires",parse:y=>`expires=${s(y.expires??a)}`},{name:"maxAge",parse:y=>y.maxAge?`max-age=${s(y.expires??a)}`:""},{name:"path",parse:y=>`path=${y.path??"/"}`},{name:"sameSite",parse:y=>`samesite=${y.sameSite??"strict"}`},{name:"useSecure",parse:y=>`${y.useSecure??!0?"secure":""}`},{name:"domain",parse:y=>{const v=y.domain??"";return v===""?"":`domain=${y.multiDomain?".":""}${v}`}},{name:"partitioned",parse:y=>y.partitioned?"Partitioned":""}],d={json:l,listener:y=>(c.add(y),()=>c.delete(y)),clearListeners:()=>c.clear(),has:y=>document.cookie.split(";").some(v=>v.trim().startsWith(`${y}=`)),deleteAll:()=>{document.cookie.split(";").forEach(y=>{document.cookie=y.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}),u()},get:y=>{const v=d.json()[y];if(n(v))return null;try{return JSON.parse(decodeURIComponent(v))}catch{return v}},delete:y=>{document.cookie=`${encodeURIComponent(y)}=;expires=${new Date().toUTCString()}`,u()},set:(y,v,b={})=>{const g=r(v)?v:encodeURIComponent(JSON.stringify(v)),S=f.reduce((x,T)=>{const P=T.parse(b);return P===""?x:x.concat(P)},[`${encodeURIComponent(y)}=${g}`]).join(";");document.cookie=S,u()}},h=y=>{const v=new Set,b=g=>{y().removeItem(g);const S=i(y());v.forEach(x=>x(S))};return{delete:b,listener:g=>(v.add(g),()=>v.delete(g)),clearListeners:()=>v.clear(),json:(g=!1)=>g?i(y()):y(),has:g=>{const S=y().getItem(g);return!n(S)},deleteAll:()=>{e(y(),b),v.forEach(g=>g(y()))},get:g=>o(g,y()),set:(g,S)=>{y().setItem(g,JSON.stringify(S)),v.forEach(x=>x(y()))}}},p=h(()=>window.sessionStorage),m=h(()=>window.localStorage);t.Cookie=d,t.LocalStorage=m,t.SessionStorage=p,t.createStorage=h})(jO);const av=t=>t.headerLabel??t.thead??t.id,lv=t=>t.map(e=>({value:e.id,label:e.thead??e.headerLabel??e.id}));var ai=(t=>(t.Boolean="boolean",t.Number="number",t.Select="select",t.Text="text",t))(ai||{});const uu=t=>t.type==="number"?t.valueAsNumber:t.value,wt={contains:{value:"contains",label:"Contains",symbol:"includes"},is:{value:"is",label:"Is",symbol:"is"},isNot:{value:"isNot",label:"Is not",symbol:"!=="},notContains:{value:"notContains",label:"Does not contains",symbol:"notIncludes"},lessThan:{value:"lessThan",label:"Less Than",symbol:"<="},greaterThan:{value:"greaterThan",label:"Greater than",symbol:">="},startsWith:{value:"startsWith",label:"Starts with",symbol:"startsWith"},endsWith:{value:"endsWith",label:"Ends with",symbol:"endsWith"}},fu={[ai.Text]:[wt.is,wt.isNot,wt.contains,wt.notContains,wt.startsWith,wt.endsWith],[ai.Boolean]:[wt.is,wt.isNot],[ai.Number]:[wt.is,wt.isNot,wt.greaterThan,wt.lessThan]},Hs=(t,e={})=>{var s;const n=t.id,r=t.type??ai.Text,o=(s=fu[r])==null?void 0:s[0].value,i=wt[o];return{id:Ws(),operation:i,label:av(t),name:n,type:r,value:"",...e}},BO=t=>{const e=()=>{const s=t.cols.at(0);t.set(a=>[...a,Hs(s)])},n=s=>{const a=s.target.dataset.id||"",l=s.target.value;t.set(c=>c.map(u=>{if(a!==u.id)return u;const f=t.cols.find(d=>l===d.id);return Hs(f,{value:""})}))},r=s=>{const a=s.target.dataset.id||"",l=s.target.value;t.set(c=>c.map(u=>u.id===a?{...u,operation:wt[l]}:u))},o=s=>{const a=s.currentTarget.dataset.id||"";console.log({id:a,f:t.filters}),t.set(l=>l.filter(c=>c.id!==a))},i=s=>{const a=s.target.dataset.id||"",l=uu(s.target);t.set(c=>c.map(u=>u.id===a?{...u,value:l}:u))};return E.jsx(w.Fragment,{children:E.jsx(Po,{arrow:!1,title:"Filters",trigger:E.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[E.jsx(Kf,{size:14}),"Filtros ",t.filters.length===0?"":` (${t.filters.length})`]}),children:E.jsxs("ul",{className:"mt-4 space-y-2",children:[t.filters.map(s=>{const a=fu[s.type];return E.jsxs("li",{className:"flex flex-nowrap gap-3",children:[E.jsx(er,{title:"Filtro",options:t.options,placeholder:"Seleciona um campo...",value:s.name,"data-id":s.id,onChange:n}),E.jsx(er,{title:"Tipo do filtro","data-id":s.id,onChange:r,value:s.operation.value,options:a,placeholder:"Operação..."}),E.jsx(Ya,{"data-id":s.id,onChange:i,placeholder:"Buscar por...",title:"Valor do filtro",type:s.type,value:s.value}),E.jsx("div",{className:"flex items-center justify-center mt-5",children:E.jsx("button",{"data-id":s.id,type:"button",onClick:o,children:E.jsx(xo,{className:"text-danger",size:16})})})]},`filter-select-${s.id}`)}),E.jsx("li",{children:E.jsxs("button",{type:"button",onClick:e,className:"text-primary flex items-center gap-1",children:[E.jsx(ja,{size:14})," Adicionar novo filtro"]})})]})})})},zO=({filter:t,set:e})=>{const n=o=>{const i=o.target.value,s=o.target.dataset.id||"";e(a=>a.map(l=>l.id===s?{...l,operation:wt[i]}:l))},r=o=>{const i=o.target.dataset.id||"",s=uu(o.target);e(a=>a.map(l=>l.id===i?{...l,value:s}:l))};return E.jsxs("div",{className:"flex flex-nowrap items-center gap-4 py-2",children:[E.jsx(er,{onChange:n,value:t.operation.value,options:fu[t.type],placeholder:"Operation..."}),E.jsx(Ya,{type:t.type,"data-id":t.id,onChange:r,placeholder:"Looking for...",value:t.value})]})},WO=({item:t,onPointerDown:e})=>{const n=hc(0);return E.jsxs(ys.Item,{onPointerDown:e,id:t.groupId,className:"flex flex-row items-center gap-2",value:t,style:{y:n},children:[E.jsx("button",{className:"cursor-grab",children:E.jsx(_0,{size:14})}),E.jsx("span",{children:t.groupName})]},t.groupId)},HO=t=>{var a;const e=lv(t.cols),n=LC(),[r,o]=w.useState(((a=t.groups[0])==null?void 0:a.thead)||""),i=l=>{var m;const c=l.target,u=c.value,f=c.options.selectedIndex,d=((m=c.options.item(f))==null?void 0:m.label)||"";o(d);const h=new cg(t.rows).GroupBy(u),p=t.cols.find(y=>y.id===u);t.setGroups(PO(h).map((y,v)=>{const b=h[y];return{...p,groupId:Ws(),groupKey:u,index:v,rows:b,groupName:y}}))},s=l=>t.setGroups([]);return E.jsx(w.Fragment,{children:E.jsxs(Po,{arrow:!1,title:"Groups",trigger:E.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[E.jsx(P0,{size:14}),"Groups",t.groups.length>0?` - ${r}(${t.groups.length})`:""]}),children:[E.jsxs("div",{className:"flex flex-nowrap items-center",children:[E.jsx(er,{value:r,title:"Tipo de agrupamento",onChange:i,options:e,placeholder:"Agrupar por..."}),E.jsx(Ki,{className:"mt-4",onClick:s,theme:"raw","data-id":r,children:E.jsx(xo,{size:16,className:"text-danger"})})]}),t.groups.length>0?E.jsxs("section",{className:"my-4",children:[E.jsx("header",{children:E.jsx("h2",{className:"text-xl font-medium",children:"Ordenar grupos"})}),E.jsx(wC,{children:E.jsx(ys.Group,{axis:"y",className:"relative space-y-2",dragListener:!1,dragControls:n,drag:!0,layoutScroll:!0,onReorder:t.setGroups,values:t.groups,children:t.groups.map(l=>E.jsx(WO,{item:l,onPointerDown:c=>{n.start(c),t.setGroups([...t.groups])}},l.groupId))})})]}):null]})})},UO=t=>(e,n)=>t.reduce((r,o)=>{const i=o.type==="desc"?-1:1,s=o.value,a=e[s]>n[s]?i:e[s]<n[s]?-i:0;return r!==0?r:a},0),GO=(t,e)=>t.sort(UO(e)),du={asc:{label:"Ascending",value:"asc"},desc:{label:"Descending",value:"desc"}},KO=[du.asc,du.desc],hu=(t,e="asc")=>({id:Ws(),type:e,value:t.id,label:du.asc.label}),ZO=t=>{const e=()=>{const i=t.cols[0];i&&t.set(s=>[...s,hu(i)])},n=i=>s=>{const a=s.target.value;t.set(l=>l.map(c=>c.id===i?{...c,value:a}:c))},r=i=>s=>{const a=s.target.value;t.set(l=>l.map(c=>c.id===i?{...c,type:a}:c))},o=i=>{const s=i.currentTarget.dataset.id||"";t.set(a=>a.filter(l=>l.id!==s))};return E.jsx(w.Fragment,{children:E.jsx(Po,{arrow:!1,title:"Order By",trigger:E.jsxs("span",{className:"flex items-center gap-1 proportional-nums text-foreground-description",children:[E.jsx(Gf,{size:14}),"Order by ",t.sorters.length===0?"":` (${t.sorters.length})`]}),children:E.jsxs("ul",{className:"mt-4 space-y-2",children:[t.sorters.map(i=>E.jsxs("li",{className:"flex flex-nowrap gap-3",children:[E.jsx(er,{onChange:n(i.id),options:t.options,placeholder:"Selecione um campo...",value:i.value}),E.jsx(er,{onChange:r(i.id),value:i.type,options:KO,placeholder:"Operação..."}),E.jsx("button",{className:"mt-4","data-id":i.id,onClick:o,children:E.jsx(xo,{className:"text-danger",size:14})})]},`sorter-select-${i.id}`)),E.jsx("li",{children:E.jsxs("button",{onClick:e,className:"text-primary flex items-center gap-1",children:[E.jsx(ja,{size:14})," Adicionar ordenação"]})})]})})})},qO=t=>{const e=t.sorters.find(i=>i.id===t.col.id),[n,r]=w.useState(e?e.type:"undefined"),o=()=>r(i=>i==="undefined"?"asc":i==="asc"?"desc":"undefined");return w.useEffect(()=>{t.setSorters(i=>{if(n==="undefined")return i.filter(a=>a.value!==t.col.id);const s=i.findIndex(a=>a.value===t.col.id);return s===-1?[...i,hu(t.col,n)]:(i[s]=hu(t.col,n),[...i])})},[n,t.col]),E.jsxs("button",{className:"isolate flex items-center",onClick:o,children:[n==="asc"?E.jsx($a,{size:14}):null,n==="desc"?E.jsx(T0,{size:14}):null,n==="undefined"?E.jsx(Gf,{size:14}):null]})},YO=t=>E.jsx("header",{className:"min-w-full mb-1",children:E.jsxs("div",{className:"flex flex-wrap min-w-full items-center justify-between gap-x-4 gap-y-1",children:[E.jsxs("div",{className:"flex w-fit items-centeend gap-4 whitespace-nowrap py-2",children:[E.jsx("p",{children:E.jsx(BO,{cols:t.cols,options:t.options,filters:t.filters,set:t.setFilters})}),E.jsx("p",{children:E.jsx(ZO,{options:t.options,cols:t.cols,sorters:t.sorters,set:t.setSorters})}),E.jsx("p",{children:E.jsx(HO,{rows:t.rows,groups:t.groups,setGroups:t.setGroups,options:t.options,cols:t.cols})})]}),E.jsx("ul",{className:"flex flex-wrap w-full flex-1 flex-grow flex-row items-center md:justify-end gap-4",children:t.filters.map(e=>E.jsxs("li",{className:"flex gap-1 items-center rounded-xl border border-card-border px-4 py-0.5",children:[E.jsxs("span",{children:[E.jsx("span",{className:"size-3 mr-2 aspect-square bg-primary inline-block rounded-full","aria-hidden":"true"}),e.label," ",e.operation.label.toLowerCase(),":"]}),E.jsxs("div",{className:"relative w-min min-w-[1ch]",children:[E.jsx("span",{"aria-hidden":"true",className:"invisible whitespace-pre p-0",children:e.value||" "}),E.jsx("input",{type:e.type,value:e.value,className:"absolute left-0 top-0 m-0 inline-block w-full bg-transparent p-0 placeholder-primary/70 outline-none [appearance:textfield] after:empty:text-primary/70 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",onChange:n=>{const r=uu(n.target);t.setFilters(o=>o.map(i=>e.id===i.id?{...i,value:r}:i))}})]})]},`filter-table-${e.id}`))})]})}),cv=(t,e)=>{const[n,r]=w.useState(()=>e||t);return w.useEffect(()=>{r(t)},[t]),[n,r]},XO={opacity:1},JO={opacity:.75,backgroundColor:"#a1a1aa"},QO={opacity:0,transition:{duration:.4,type:"spring"}},eI=t=>{var n;const e=t.filters.filter(r=>r.name===t.header.id);return E.jsx(ys.Item,{...t.header.thProps,as:"th",exit:QO,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,value:t.header,whileDrag:JO,animate:XO,className:`hidden px-2 py-4 first:table-cell md:table-cell ${((n=t.header.thProps)==null?void 0:n.className)??""}`,children:E.jsx("span",{className:"flex items-center justify-between",children:E.jsxs("span",{className:"flex items-center gap-1",children:[E.jsxs(Po,{arrow:!0,trigger:E.jsx(Kf,{size:14}),onChange:r=>{r&&t.setFilters(o=>o.concat(Hs(t.header,{})))},children:["Filter by: ",av(t.header),e.length===0===null?null:E.jsxs("ul",{children:[e.map(r=>E.jsx("li",{className:"my-1",children:E.jsx(zO,{filter:r,set:t.setFilters})},`thead-filter-${r.id}`)),E.jsx("li",{children:E.jsxs("button",{onClick:()=>t.setFilters(r=>r.concat(Hs(t.header))),className:"text-primary-muted flex items-center",children:[E.jsx(ja,{size:14})," Add"]})})]})]}),E.jsx("span",{className:"pointer-events-auto text-balance text-base",children:t.header.thead}),E.jsx(qO,{col:t.header,setSorters:t.setSorters,sorters:t.sorters})]})})})},tI=t=>{const[e,n]=cv(t.headers),r=()=>t.setCols(e);return E.jsx(ys.Group,{as:"tr",axis:"x",drag:!0,layout:!0,layoutRoot:!0,layoutScroll:!0,initial:!1,values:e,onReorder:n,onPointerUp:r,className:"bg-table-background border-none text-lg",children:E.jsx(Hm,{children:e.map(o=>E.jsx(eI,{setFilters:t.setFilters,filters:t.filters,setSorters:t.setSorters,sorters:t.sorters,header:o},`header-child-item-${o.id}`))})})},nI=w.forwardRef((t,e)=>E.jsx("tbody",{...t,className:`divide-y divide-table-row ${t.className??""}`,ref:e,children:E.jsx(Hm,{children:t.children})})),rI=w.forwardRef((t,e)=>E.jsx("table",{...t,ref:e,className:`table min-w-full divide-y divide-table-border table-auto text-left ${t.className??""}`})),oI=w.forwardRef((t,e)=>E.jsx("thead",{...t,className:"bg-content-bg shadow-xs group:sticky top-0",ref:e})),iI=w.forwardRef((t,e)=>E.jsx("tr",{...t,ref:e,className:`table-row ${t.className??""}`})),sI={TableHead:oI,Table:rI,TableBody:nI,TableRow:iI},aI=[0,0,0,0,0,0,0,0,0,0],uv=({filters:t,setCols:e,setFilters:n,sorters:r,cols:o,setSorters:i,...s})=>{const a=w.useMemo(()=>{if(s.loading)return aI;const l=new cg(s.rows);return t.length>0&&t.forEach(c=>c.value===""||Number.isNaN(c.value)?void 0:l.Where(c.name,c.operation.symbol,c.value)),r.length===0?l.Select():GO(l.Select(),r)},[s.rows,t,r,s.loading]);return E.jsx("div",{className:"group border border-table-border rounded-lg px-1 min-w-full",children:E.jsx(E_,{data:a,totalCount:a.length,useWindowScroll:!0,components:sI,fixedHeaderContent:()=>E.jsx(tI,{sorters:r,setSorters:i,filters:t,setFilters:n,headers:o,setCols:e}),itemContent:(l,c)=>o.map((u,f)=>{const d=`${f},${l}`,h=sv(c,u.id),p=u.Element;return w.createElement("td",{...u.cellProps,"data-matrix":d,key:`accessor-${l}-${f}`,className:"px-2 h-14 border-none first:table-cell hidden md:table-cell"},s.loading?E.jsx("div",{className:"animate-pulse h-2 bg-table-border rounded"}):p?E.jsx(p,{row:c,matrix:d,col:u,rowIndex:l,value:h}):E.jsx(w.Fragment,{children:zs.nil(h)?"":h}))})})})},lI=(t,e)=>typeof e=="function"?e(t):e,cI=t=>{const e=w.useMemo(()=>lv(t.cols),[t.cols]),[n,r]=VO({cols:t.cols,filters:t.filters??[],groups:t.groups??[],sorters:t.sorters??[]},o=>{const i=s=>a=>{const l=o.state();return{...l,[s]:lI(l[s],a)}};return{cols:i("cols"),filters:i("filters"),groups:i("groups"),sorters:i("sorters")}},{interceptor:[o=>{var i;return(i=t.set)==null||i.call(t,o),o}]});return E.jsxs("div",{className:"relative min-w-full",children:[E.jsx(YO,{setCols:r.cols,rows:t.rows,cols:n.cols,filters:n.filters,groups:n.groups,options:e,setFilters:r.filters,setGroups:r.groups,setSorters:r.sorters,sorters:n.sorters}),n.groups.length===0?E.jsx(uv,{...t,cols:n.cols,filters:n.filters,groups:n.groups,index:0,optionCols:e,options:e,setCols:r.cols,setFilters:r.filters,setGroups:r.groups,setSorters:r.sorters,sorters:n.sorters}):E.jsx("div",{className:"flex flex-wrap gap-4",children:n.groups.map((o,i)=>E.jsx(fc.div,{className:"min-w-full",children:E.jsx(uv,{...t,cols:n.cols,filters:n.filters,group:o,groups:n.groups,index:i,optionCols:e,options:e,rows:o.rows,setCols:r.cols,setFilters:r.filters,setGroups:r.groups,setSorters:r.sorters,sorters:n.sorters})},`group-${o.groupId}`))})]})};var uI=String.prototype.replace,fI=/%20/g,pu={RFC1738:"RFC1738",RFC3986:"RFC3986"},mu={default:pu.RFC3986,formatters:{RFC1738:function(t){return uI.call(t,fI,"+")},RFC3986:function(t){return String(t)}},RFC1738:pu.RFC1738,RFC3986:pu.RFC3986},dI=mu,gu=Object.prototype.hasOwnProperty,mr=Array.isArray,on=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),hI=function(e){for(;e.length>1;){var n=e.pop(),r=n.obj[n.prop];if(mr(r)){for(var o=[],i=0;i<r.length;++i)typeof r[i]<"u"&&o.push(r[i]);n.obj[n.prop]=o}}},fv=function(e,n){for(var r=n&&n.plainObjects?Object.create(null):{},o=0;o<e.length;++o)typeof e[o]<"u"&&(r[o]=e[o]);return r},pI=function t(e,n,r){if(!n)return e;if(typeof n!="object"){if(mr(e))e.push(n);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!gu.call(Object.prototype,n))&&(e[n]=!0);else return[e,n];return e}if(!e||typeof e!="object")return[e].concat(n);var o=e;return mr(e)&&!mr(n)&&(o=fv(e,r)),mr(e)&&mr(n)?(n.forEach(function(i,s){if(gu.call(e,s)){var a=e[s];a&&typeof a=="object"&&i&&typeof i=="object"?e[s]=t(a,i,r):e.push(i)}else e[s]=i}),e):Object.keys(n).reduce(function(i,s){var a=n[s];return gu.call(i,s)?i[s]=t(i[s],a,r):i[s]=a,i},o)},mI=function(e,n){return Object.keys(n).reduce(function(r,o){return r[o]=n[o],r},e)},gI=function(t,e,n){var r=t.replace(/\+/g," ");if(n==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},yu=1024,yI=function(e,n,r,o,i){if(e.length===0)return e;var s=e;if(typeof e=="symbol"?s=Symbol.prototype.toString.call(e):typeof e!="string"&&(s=String(e)),r==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});for(var a="",l=0;l<s.length;l+=yu){for(var c=s.length>=yu?s.slice(l,l+yu):s,u=[],f=0;f<c.length;++f){var d=c.charCodeAt(f);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===dI.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(f);continue}if(d<128){u[u.length]=on[d];continue}if(d<2048){u[u.length]=on[192|d>>6]+on[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=on[224|d>>12]+on[128|d>>6&63]+on[128|d&63];continue}f+=1,d=65536+((d&1023)<<10|c.charCodeAt(f)&1023),u[u.length]=on[240|d>>18]+on[128|d>>12&63]+on[128|d>>6&63]+on[128|d&63]}a+=u.join("")}return a},vI=function(e){for(var n=[{obj:{o:e},prop:"o"}],r=[],o=0;o<n.length;++o)for(var i=n[o],s=i.obj[i.prop],a=Object.keys(s),l=0;l<a.length;++l){var c=a[l],u=s[c];typeof u=="object"&&u!==null&&r.indexOf(u)===-1&&(n.push({obj:s,prop:c}),r.push(u))}return hI(n),e},bI=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},xI=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},wI=function(e,n){return[].concat(e,n)},SI=function(e,n){if(mr(e)){for(var r=[],o=0;o<e.length;o+=1)r.push(n(e[o]));return r}return n(e)},dv={arrayToObject:fv,assign:mI,combine:wI,compact:vI,decode:gI,encode:yI,isBuffer:xI,isRegExp:bI,maybeMap:SI,merge:pI},hv=aO,Us=dv,li=mu,TI=Object.prototype.hasOwnProperty,pv={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,n){return e+"["+n+"]"},repeat:function(e){return e}},sn=Array.isArray,EI=Array.prototype.push,mv=function(t,e){EI.apply(t,sn(e)?e:[e])},CI=Date.prototype.toISOString,gv=li.default,et={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Us.encode,encodeValuesOnly:!1,format:gv,formatter:li.formatters[gv],indices:!1,serializeDate:function(e){return CI.call(e)},skipNulls:!1,strictNullHandling:!1},AI=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},vu={},_I=function t(e,n,r,o,i,s,a,l,c,u,f,d,h,p,m,y,v,b){for(var g=e,S=b,x=0,T=!1;(S=S.get(vu))!==void 0&&!T;){var P=S.get(e);if(x+=1,typeof P<"u"){if(P===x)throw new RangeError("Cyclic object value");T=!0}typeof S.get(vu)>"u"&&(x=0)}if(typeof u=="function"?g=u(n,g):g instanceof Date?g=h(g):r==="comma"&&sn(g)&&(g=Us.maybeMap(g,function(C){return C instanceof Date?h(C):C})),g===null){if(s)return c&&!y?c(n,et.encoder,v,"key",p):n;g=""}if(AI(g)||Us.isBuffer(g)){if(c){var O=y?n:c(n,et.encoder,v,"key",p);return[m(O)+"="+m(c(g,et.encoder,v,"value",p))]}return[m(n)+"="+m(String(g))]}var k=[];if(typeof g>"u")return k;var D;if(r==="comma"&&sn(g))y&&c&&(g=Us.maybeMap(g,c)),D=[{value:g.length>0?g.join(",")||null:void 0}];else if(sn(u))D=u;else{var L=Object.keys(g);D=f?L.sort(f):L}var A=l?n.replace(/\./g,"%2E"):n,j=o&&sn(g)&&g.length===1?A+"[]":A;if(i&&sn(g)&&g.length===0)return j+"[]";for(var F=0;F<D.length;++F){var _=D[F],M=typeof _=="object"&&typeof _.value<"u"?_.value:g[_];if(!(a&&M===null)){var N=d&&l?_.replace(/\./g,"%2E"):_,z=sn(g)?typeof r=="function"?r(j,N):j:j+(d?"."+N:"["+N+"]");b.set(e,x);var q=hv();q.set(vu,b),mv(k,t(M,z,r,o,i,s,a,l,r==="comma"&&y&&sn(g)?null:c,u,f,d,h,p,m,y,v,q))}}return k},PI=function(e){if(!e)return et;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var n=e.charset||et.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=li.default;if(typeof e.format<"u"){if(!TI.call(li.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=li.formatters[r],i=et.filter;(typeof e.filter=="function"||sn(e.filter))&&(i=e.filter);var s;if(e.arrayFormat in pv?s=e.arrayFormat:"indices"in e?s=e.indices?"indices":"repeat":s=et.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:et.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:et.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:et.allowEmptyArrays,arrayFormat:s,charset:n,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:et.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?et.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:et.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:et.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:et.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:et.encodeValuesOnly,filter:i,format:r,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:et.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:et.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:et.strictNullHandling}},OI=function(t,e){var n=t,r=PI(e),o,i;typeof r.filter=="function"?(i=r.filter,n=i("",n)):sn(r.filter)&&(i=r.filter,o=i);var s=[];if(typeof n!="object"||n===null)return"";var a=pv[r.arrayFormat],l=a==="comma"&&r.commaRoundTrip;o||(o=Object.keys(n)),r.sort&&o.sort(r.sort);for(var c=hv(),u=0;u<o.length;++u){var f=o[u];r.skipNulls&&n[f]===null||mv(s,_I(n[f],f,a,l,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,c))}var d=s.join(r.delimiter),h=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),d.length>0?h+d:""},ro=dv,bu=Object.prototype.hasOwnProperty,II=Array.isArray,Ye={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ro.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},kI=function(t){return t.replace(/&#(\d+);/g,function(e,n){return String.fromCharCode(parseInt(n,10))})},yv=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},DI="utf8=%26%2310003%3B",MI="utf8=%E2%9C%93",RI=function(e,n){var r={__proto__:null},o=n.ignoreQueryPrefix?e.replace(/^\?/,""):e;o=o.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i=n.parameterLimit===1/0?void 0:n.parameterLimit,s=o.split(n.delimiter,i),a=-1,l,c=n.charset;if(n.charsetSentinel)for(l=0;l<s.length;++l)s[l].indexOf("utf8=")===0&&(s[l]===MI?c="utf-8":s[l]===DI&&(c="iso-8859-1"),a=l,l=s.length);for(l=0;l<s.length;++l)if(l!==a){var u=s[l],f=u.indexOf("]="),d=f===-1?u.indexOf("="):f+1,h,p;d===-1?(h=n.decoder(u,Ye.decoder,c,"key"),p=n.strictNullHandling?null:""):(h=n.decoder(u.slice(0,d),Ye.decoder,c,"key"),p=ro.maybeMap(yv(u.slice(d+1),n),function(y){return n.decoder(y,Ye.decoder,c,"value")})),p&&n.interpretNumericEntities&&c==="iso-8859-1"&&(p=kI(p)),u.indexOf("[]=")>-1&&(p=II(p)?[p]:p);var m=bu.call(r,h);m&&n.duplicates==="combine"?r[h]=ro.combine(r[h],p):(!m||n.duplicates==="last")&&(r[h]=p)}return r},FI=function(t,e,n,r){for(var o=r?e:yv(e,n),i=t.length-1;i>=0;--i){var s,a=t[i];if(a==="[]"&&n.parseArrays)s=n.allowEmptyArrays&&(o===""||n.strictNullHandling&&o===null)?[]:[].concat(o);else{s=n.plainObjects?Object.create(null):{};var l=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,c=n.decodeDotInKeys?l.replace(/%2E/g,"."):l,u=parseInt(c,10);!n.parseArrays&&c===""?s={0:o}:!isNaN(u)&&a!==c&&String(u)===c&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(s=[],s[u]=o):c!=="__proto__"&&(s[c]=o)}o=s}return o},LI=function(e,n,r,o){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=r.depth>0&&s.exec(i),c=l?i.slice(0,l.index):i,u=[];if(c){if(!r.plainObjects&&bu.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var f=0;r.depth>0&&(l=a.exec(i))!==null&&f<r.depth;){if(f+=1,!r.plainObjects&&bu.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+i.slice(l.index)+"]"),FI(u,n,r,o)}},NI=function(e){if(!e)return Ye;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=typeof e.charset>"u"?Ye.charset:e.charset,r=typeof e.duplicates>"u"?Ye.duplicates:e.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var o=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:Ye.allowDots:!!e.allowDots;return{allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Ye.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ye.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ye.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ye.arrayLimit,charset:n,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ye.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ye.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Ye.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Ye.decoder,delimiter:typeof e.delimiter=="string"||ro.isRegExp(e.delimiter)?e.delimiter:Ye.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ye.depth,duplicates:r,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ye.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ye.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ye.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ye.strictNullHandling}},VI=function(t,e){var n=NI(e);if(t===""||t===null||typeof t>"u")return n.plainObjects?Object.create(null):{};for(var r=typeof t=="string"?RI(t,n):t,o=n.plainObjects?Object.create(null):{},i=Object.keys(r),s=0;s<i.length;++s){var a=i[s],l=LI(a,r[a],n,typeof t=="string");o=ro.merge(o,l,n)}return n.allowSparse===!0?o:ro.compact(o)},$I=OI,jI=VI,BI=mu,zI={formats:BI,parse:jI,stringify:$I},Ee;(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},t.getValidEnumValues=o=>{const i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(const s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ee||(Ee={}));var vv;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(vv||(vv={}));const te=Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gr=t=>{switch(typeof t){case"undefined":return te.undefined;case"string":return te.string;case"number":return isNaN(t)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(t)?te.array:t===null?te.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?te.promise:typeof Map<"u"&&t instanceof Map?te.map:typeof Set<"u"&&t instanceof Set?te.set:typeof Date<"u"&&t instanceof Date?te.date:te.object;default:return te.unknown}},G=Ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class jt extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(e){if(!(e instanceof jt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}jt.create=t=>new jt(t);const ci=(t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===te.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ee.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ee.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ee.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Ee.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ee.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case G.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case G.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ee.assertNever(t)}return{message:n}};let WI=ci;function xu(){return WI}const wu=t=>{const{data:e,path:n,errorMaps:r,issueData:o}=t,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};function Q(t,e){const n=xu(),r=wu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ci?void 0:ci].filter(o=>!!o)});t.common.issues.push(r)}class St{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const o of n){if(o.status==="aborted")return de;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return St.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return de;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}}const de=Object.freeze({status:"aborted"}),ui=t=>({status:"dirty",value:t}),Ot=t=>({status:"valid",value:t}),bv=t=>t.status==="aborted",xv=t=>t.status==="dirty",Gs=t=>t.status==="valid",Ks=t=>typeof Promise<"u"&&t instanceof Promise;function Zs(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function wv(t,e,n,r,o){if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}typeof SuppressedError=="function"&&SuppressedError;var ie;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ie||(ie={}));var fi,di;class an{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}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 Sv=(t,e)=>{if(Gs(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new jt(t.common.issues);return this._error=n,this._error}}};function ge(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,c;const{message:u}=t;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class xe{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 gr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:gr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new St,ctx:{common:e.parent.common,data:e.data,parsedType:gr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ks(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gr(e)},i=this._parseSync({data:e,path:o.path,parent:o});return Sv(o,i)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gr(e)},o=this._parse({data:e,path:r.path,parent:r}),i=await(Ks(o)?o:Promise.resolve(o));return Sv(r,i)}refine(e,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=e(o),a=()=>i.addIssue({code:G.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Sn({schema:this,typeName:ue.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Tn.create(this,this._def)}nullable(){return br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kt.create(this,this._def)}promise(){return mi.create(this,this._def)}or(e){return Xs.create([this,e],this._def)}and(e){return Js.create(this,e,this._def)}transform(e){return new Sn({...ge(this._def),schema:this,typeName:ue.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ra({...ge(this._def),innerType:this,defaultValue:n,typeName:ue.ZodDefault})}brand(){return new Av({typeName:ue.ZodBranded,type:this,...ge(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new oa({...ge(this._def),innerType:this,catchValue:n,typeName:ue.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return ia.create(this,e)}readonly(){return sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const HI=/^c[^\s-]{8,}$/i,UI=/^[0-9a-z]+$/,GI=/^[0-9A-HJKMNP-TV-Z]{26}$/,KI=/^[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,ZI=/^[a-z0-9_-]{21}$/i,qI=/^[-+]?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)?)??$/,YI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,XI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Su;const JI=/^(?:(?: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])$/,QI=/^(([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})))$/,ek=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tv="((\\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])))",tk=new RegExp(`^${Tv}$`);function Ev(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function nk(t){return new RegExp(`^${Ev(t)}$`)}function rk(t){let e=`${Tv}T${Ev(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ok(t,e){return!!((e==="v4"||!e)&&JI.test(t)||(e==="v6"||!e)&&QI.test(t))}class bn extends xe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==te.string){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.string,received:i.parsedType}),de}const r=new St;let o;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?Q(o,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&Q(o,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")YI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"email",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Su||(Su=new RegExp(XI,"u")),Su.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"emoji",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")KI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"uuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")ZI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"nanoid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")HI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"cuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")UI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"cuid2",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")GI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"ulid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Q(o,{validation:"url",code:G.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"regex",code:G.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?rk(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?tk.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?nk(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{code:G.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?qI.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"duration",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?ok(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"ip",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ek.test(e.data)||(o=this._getOrReturnCtx(e,o),Q(o,{validation:"base64",code:G.invalid_string,message:i.message}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:G.invalid_string,...ie.errToObj(r)})}_addCheck(e){return new bn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ie.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ie.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ie.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ie.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ie.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ie.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ie.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ie.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ie.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ie.errToObj(e)})}datetime(e){var n,r;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:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...ie.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,...ie.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ie.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ie.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ie.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ie.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ie.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ie.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ie.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ie.errToObj(n)})}nonempty(e){return this.min(1,ie.errToObj(e))}trim(){return new bn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bn({...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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}bn.create=t=>{var e;return new bn({checks:[],typeName:ue.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...ge(t)})};function ik(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(t.toFixed(o).replace(".","")),s=parseInt(e.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class yr extends xe{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)!==te.number){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.number,received:i.parsedType}),de}let r;const o=new St;for(const i of this._def.checks)i.kind==="int"?Ee.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Q(r,{code:G.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ik(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Q(r,{code:G.not_finite,message:i.message}),o.dirty()):Ee.assertNever(i);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ie.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ie.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ie.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ie.toString(n))}setLimit(e,n,r,o){return new yr({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ie.toString(o)}]})}_addCheck(e){return new yr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ie.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ie.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ie.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ie.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ie.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ie.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ee.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}yr.create=t=>new yr({checks:[],typeName:ue.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ge(t)});class oo extends xe{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)!==te.bigint){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.bigint,received:i.parsedType}),de}let r;const o=new St;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Q(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ee.assertNever(i);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ie.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ie.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ie.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ie.toString(n))}setLimit(e,n,r,o){return new oo({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ie.toString(o)}]})}_addCheck(e){return new oo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ie.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ie.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ie.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ie.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ie.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}oo.create=t=>{var e;return new oo({checks:[],typeName:ue.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...ge(t)})};class Tu extends xe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==te.boolean){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.boolean,received:r.parsedType}),de}return Ot(e.data)}}Tu.create=t=>new Tu({typeName:ue.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ge(t)});class hi extends xe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==te.date){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_type,expected:te.date,received:i.parsedType}),de}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Q(i,{code:G.invalid_date}),de}const r=new St;let o;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),Q(o,{code:G.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hi({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ie.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ie.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}hi.create=t=>new hi({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ue.ZodDate,...ge(t)});class Eu extends xe{_parse(e){if(this._getType(e)!==te.symbol){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.symbol,received:r.parsedType}),de}return Ot(e.data)}}Eu.create=t=>new Eu({typeName:ue.ZodSymbol,...ge(t)});class qs extends xe{_parse(e){if(this._getType(e)!==te.undefined){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.undefined,received:r.parsedType}),de}return Ot(e.data)}}qs.create=t=>new qs({typeName:ue.ZodUndefined,...ge(t)});class Ys extends xe{_parse(e){if(this._getType(e)!==te.null){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.null,received:r.parsedType}),de}return Ot(e.data)}}Ys.create=t=>new Ys({typeName:ue.ZodNull,...ge(t)});class Cu extends xe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ot(e.data)}}Cu.create=t=>new Cu({typeName:ue.ZodAny,...ge(t)});class io extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ot(e.data)}}io.create=t=>new io({typeName:ue.ZodUnknown,...ge(t)});class Zn extends xe{_parse(e){const n=this._getOrReturnCtx(e);return Q(n,{code:G.invalid_type,expected:te.never,received:n.parsedType}),de}}Zn.create=t=>new Zn({typeName:ue.ZodNever,...ge(t)});class Au extends xe{_parse(e){if(this._getType(e)!==te.undefined){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.void,received:r.parsedType}),de}return Ot(e.data)}}Au.create=t=>new Au({typeName:ue.ZodVoid,...ge(t)});class Kt extends xe{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==te.array)return Q(n,{code:G.invalid_type,expected:te.array,received:n.parsedType}),de;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(Q(n,{code:s?G.too_big:G.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(Q(n,{code:G.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(Q(n,{code:G.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new an(n,s,n.path,a)))).then(s=>St.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new an(n,s,n.path,a)));return St.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Kt({...this._def,minLength:{value:e,message:ie.toString(n)}})}max(e,n){return new Kt({...this._def,maxLength:{value:e,message:ie.toString(n)}})}length(e,n){return new Kt({...this._def,exactLength:{value:e,message:ie.toString(n)}})}nonempty(e){return this.min(1,e)}}Kt.create=(t,e)=>new Kt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ue.ZodArray,...ge(e)});function so(t){if(t instanceof Ze){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Tn.create(so(r))}return new Ze({...t._def,shape:()=>e})}else return t instanceof Kt?new Kt({...t._def,type:so(t.element)}):t instanceof Tn?Tn.create(so(t.unwrap())):t instanceof br?br.create(so(t.unwrap())):t instanceof wn?wn.create(t.items.map(e=>so(e))):t}class Ze extends xe{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(),n=Ee.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==te.object){const c=this._getOrReturnCtx(e);return Q(c,{code:G.invalid_type,expected:te.object,received:c.parsedType}),de}const{status:r,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Zn&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new an(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Zn){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(Q(o,{code:G.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new an(o,f,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,d=await u.value;c.push({key:f,value:d,alwaysSet:u.alwaysSet})}return c}).then(c=>St.mergeObjectSync(r,c)):St.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ie.errToObj,new Ze({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var o,i,s,a;const l=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ie.errToObj(e).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Ze({...this._def,unknownKeys:"strip"})}passthrough(){return new Ze({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ze({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ze({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ue.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Ze({...this._def,catchall:e})}pick(e){const n={};return Ee.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Ze({...this._def,shape:()=>n})}omit(e){const n={};return Ee.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Ze({...this._def,shape:()=>n})}deepPartial(){return so(this)}partial(e){const n={};return Ee.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}),new Ze({...this._def,shape:()=>n})}required(e){const n={};return Ee.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Tn;)i=i._def.innerType;n[r]=i}}),new Ze({...this._def,shape:()=>n})}keyof(){return Cv(Ee.objectKeys(this.shape))}}Ze.create=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strip",catchall:Zn.create(),typeName:ue.ZodObject,...ge(e)}),Ze.strictCreate=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strict",catchall:Zn.create(),typeName:ue.ZodObject,...ge(e)}),Ze.lazycreate=(t,e)=>new Ze({shape:t,unknownKeys:"strip",catchall:Zn.create(),typeName:ue.ZodObject,...ge(e)});class Xs extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new jt(a.ctx.common.issues));return Q(n,{code:G.invalid_union,unionErrors:s}),de}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new jt(l));return Q(n,{code:G.invalid_union,unionErrors:a}),de}}get options(){return this._def.options}}Xs.create=(t,e)=>new Xs({options:t,typeName:ue.ZodUnion,...ge(e)});const xn=t=>t instanceof ea?xn(t.schema):t instanceof Sn?xn(t.innerType()):t instanceof ta?[t.value]:t instanceof vr?t.options:t instanceof na?Ee.objectValues(t.enum):t instanceof ra?xn(t._def.innerType):t instanceof qs?[void 0]:t instanceof Ys?[null]:t instanceof Tn?[void 0,...xn(t.unwrap())]:t instanceof br?[null,...xn(t.unwrap())]:t instanceof Av||t instanceof sa?xn(t.unwrap()):t instanceof oa?xn(t._def.innerType):[];class _u extends xe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.object)return Q(n,{code:G.invalid_type,expected:te.object,received:n.parsedType}),de;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Q(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),de)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const o=new Map;for(const i of n){const s=xn(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new _u({typeName:ue.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...ge(r)})}}function Pu(t,e){const n=gr(t),r=gr(e);if(t===e)return{valid:!0,data:t};if(n===te.object&&r===te.object){const o=Ee.objectKeys(e),i=Ee.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(const a of i){const l=Pu(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===te.array&&r===te.array){if(t.length!==e.length)return{valid:!1};const o=[];for(let i=0;i<t.length;i++){const s=t[i],a=e[i],l=Pu(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===te.date&&r===te.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Js extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),o=(i,s)=>{if(bv(i)||bv(s))return de;const a=Pu(i.value,s.value);return a.valid?((xv(i)||xv(s))&&n.dirty(),{status:n.value,value:a.data}):(Q(r,{code:G.invalid_intersection_types}),de)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Js.create=(t,e,n)=>new Js({left:t,right:e,typeName:ue.ZodIntersection,...ge(n)});class wn extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.array)return Q(r,{code:G.invalid_type,expected:te.array,received:r.parsedType}),de;if(r.data.length<this._def.items.length)return Q(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&r.data.length>this._def.items.length&&(Q(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new an(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>St.mergeArray(n,s)):St.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new wn({...this._def,rest:e})}}wn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wn({items:t,typeName:ue.ZodTuple,rest:null,...ge(e)})};class Qs extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.object)return Q(r,{code:G.invalid_type,expected:te.object,received:r.parsedType}),de;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new an(r,a,r.path,a)),value:s._parse(new an(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?St.mergeObjectAsync(n,o):St.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof xe?new Qs({keyType:e,valueType:n,typeName:ue.ZodRecord,...ge(r)}):new Qs({keyType:bn.create(),valueType:e,typeName:ue.ZodRecord,...ge(n)})}}class Ou extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.map)return Q(r,{code:G.invalid_type,expected:te.map,received:r.parsedType}),de;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new an(r,a,r.path,[c,"key"])),value:i._parse(new an(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return de;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Ou.create=(t,e,n)=>new Ou({valueType:e,keyType:t,typeName:ue.ZodMap,...ge(n)});class ao extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.set)return Q(r,{code:G.invalid_type,expected:te.set,received:r.parsedType}),de;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(Q(r,{code:G.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(Q(r,{code:G.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return de;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new an(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,n){return new ao({...this._def,minSize:{value:e,message:ie.toString(n)}})}max(e,n){return new ao({...this._def,maxSize:{value:e,message:ie.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ao.create=(t,e)=>new ao({valueType:t,minSize:null,maxSize:null,typeName:ue.ZodSet,...ge(e)});class pi extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.function)return Q(n,{code:G.invalid_type,expected:te.function,received:n.parsedType}),de;function r(a,l){return wu({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xu(),ci].filter(c=>!!c),issueData:{code:G.invalid_arguments,argumentsError:l}})}function o(a,l){return wu({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xu(),ci].filter(c=>!!c),issueData:{code:G.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof mi){const a=this;return Ot(async function(...l){const c=new jt([]),u=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),f=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(f,i).catch(h=>{throw c.addIssue(o(f,h)),c})})}else{const a=this;return Ot(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new jt([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(u,i);if(!f.success)throw new jt([o(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pi({...this._def,args:wn.create(e).rest(io.create())})}returns(e){return new pi({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new pi({args:e||wn.create([]).rest(io.create()),returns:n||io.create(),typeName:ue.ZodFunction,...ge(r)})}}class ea extends xe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ea.create=(t,e)=>new ea({getter:t,typeName:ue.ZodLazy,...ge(e)});class ta extends xe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Q(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:e.data}}get value(){return this._def.value}}ta.create=(t,e)=>new ta({value:t,typeName:ue.ZodLiteral,...ge(e)});function Cv(t,e){return new vr({values:t,typeName:ue.ZodEnum,...ge(e)})}class vr extends xe{constructor(){super(...arguments),fi.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Q(n,{expected:Ee.joinValues(r),received:n.parsedType,code:G.invalid_type}),de}if(Zs(this,fi)||wv(this,fi,new Set(this._def.values)),!Zs(this,fi).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Q(n,{received:n.data,code:G.invalid_enum_value,options:r}),de}return Ot(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return vr.create(e,{...this._def,...n})}exclude(e,n=this._def){return vr.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}fi=new WeakMap,vr.create=Cv;class na extends xe{constructor(){super(...arguments),di.set(this,void 0)}_parse(e){const n=Ee.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==te.string&&r.parsedType!==te.number){const o=Ee.objectValues(n);return Q(r,{expected:Ee.joinValues(o),received:r.parsedType,code:G.invalid_type}),de}if(Zs(this,di)||wv(this,di,new Set(Ee.getValidEnumValues(this._def.values))),!Zs(this,di).has(e.data)){const o=Ee.objectValues(n);return Q(r,{received:r.data,code:G.invalid_enum_value,options:o}),de}return Ot(e.data)}get enum(){return this._def.values}}di=new WeakMap,na.create=(t,e)=>new na({values:t,typeName:ue.ZodNativeEnum,...ge(e)});class mi extends xe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.promise&&n.common.async===!1)return Q(n,{code:G.invalid_type,expected:te.promise,received:n.parsedType}),de;const r=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return Ot(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}mi.create=(t,e)=>new mi({type:t,typeName:ue.ZodPromise,...ge(e)});class Sn extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{Q(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return de;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?de:l.status==="dirty"||n.value==="dirty"?ui(l.value):l});{if(n.value==="aborted")return de;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?de:a.status==="dirty"||n.value==="dirty"?ui(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?de:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?de:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Gs(s))return s;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Gs(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);Ee.assertNever(o)}}Sn.create=(t,e,n)=>new Sn({schema:t,typeName:ue.ZodEffects,effect:e,...ge(n)}),Sn.createWithPreprocess=(t,e,n)=>new Sn({schema:e,effect:{type:"preprocess",transform:t},typeName:ue.ZodEffects,...ge(n)});class Tn extends xe{_parse(e){return this._getType(e)===te.undefined?Ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tn.create=(t,e)=>new Tn({innerType:t,typeName:ue.ZodOptional,...ge(e)});class br extends xe{_parse(e){return this._getType(e)===te.null?Ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}br.create=(t,e)=>new br({innerType:t,typeName:ue.ZodNullable,...ge(e)});class ra extends xe{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===te.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ra.create=(t,e)=>new ra({innerType:t,typeName:ue.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ge(e)});class oa extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ks(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new jt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}oa.create=(t,e)=>new oa({innerType:t,typeName:ue.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ge(e)});class Iu extends xe{_parse(e){if(this._getType(e)!==te.nan){const r=this._getOrReturnCtx(e);return Q(r,{code:G.invalid_type,expected:te.nan,received:r.parsedType}),de}return{status:"valid",value:e.data}}}Iu.create=t=>new Iu({typeName:ue.ZodNaN,...ge(t)});class Av extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ia extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?de:i.status==="dirty"?(n.dirty(),ui(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?de:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new ia({in:e,out:n,typeName:ue.ZodPipeline})}}class sa extends xe{_parse(e){const n=this._def.innerType._parse(e),r=o=>(Gs(o)&&(o.value=Object.freeze(o.value)),o);return Ks(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}sa.create=(t,e)=>new sa({innerType:t,typeName:ue.ZodReadonly,...ge(e)}),Ze.lazycreate;var ue;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ue||(ue={})),bn.create,yr.create,Iu.create,oo.create,Tu.create,hi.create,Eu.create,qs.create,Ys.create,Cu.create,io.create,Zn.create,Au.create,Kt.create,Ze.create,Ze.strictCreate,Xs.create,_u.create,Js.create,wn.create,Qs.create,Ou.create,ao.create,pi.create,ea.create,ta.create,vr.create,na.create,mi.create,Sn.create,Tn.create,br.create,Sn.createWithPreprocess,ia.create;const sk={sort:(t,e)=>t.localeCompare(e),allowDots:!0,charset:"utf-8",parseArrays:!0,plainObjects:!0,charsetSentinel:!0,allowPrototypes:!1,depth:Number.MAX_SAFE_INTEGER,arrayLimit:Number.MAX_SAFE_INTEGER,parameterLimit:Number.MAX_SAFE_INTEGER},_v=t=>{const e=new FormData(t),n=new URLSearchParams(e);return zI.parse(n.toString(),sk)},Pv=t=>t.replace("[",".").replace("]","").split("."),ku=(t,e)=>Pv(t).reduce((n,r)=>{var i;if(r==="")return n;const o=((i=n.shape)==null?void 0:i[r])||n;return o instanceof Kt?o.element:o},e),aa=t=>t.type==="checkbox"?t.checked:t.type==="number"?t.valueAsNumber:t.value,ak=t=>{const[e,n]=w.useState(null),r=w.useRef({}),o=(l,c)=>{const u=ku(l,t);return{...c,name:l,id:l,error:e==null?void 0:e[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}},i=(l,c)=>{const u=ku(l,t);return{...c,name:l,id:l,type:zs.instance(u,yr)?"number":(c==null?void 0:c.type)??"text",error:e==null?void 0:e[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}};w.useEffect(()=>{const l=Object.values(r.current).map(u=>{const f=u.schema.safeParse(aa(u.element)),d=p=>{const m=u.schema.safeParse(aa(p.target)),y=u.element,v=y.name;if(m.success)return y.setCustomValidity(""),n(b=>{const{[v]:g,...S}=b||{};return S===null||zs.empty(S)?null:S});if(y.required){const b=m.error.issues[0].message;y.setCustomValidity(b),n(g=>({...g,[v]:b}))}},h=u.element.tagName==="INPUT"?"blur":"change";return u.element.addEventListener(h,d),{input:u,hasInitialError:u.element.required?!f.success:!1,unsubscribe:()=>u.element.removeEventListener(h,d)}});return l.some(u=>u.hasInitialError)&&n(u=>u===null?{}:u),()=>l.forEach(u=>u.unsubscribe())});const s=w.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget,f=Object.values(r.current).reduce((h,p)=>{const m=p.element,y=p.schema.safeParse(aa(m));if(y.success)return h;const v=y.error.issues[0].message;return m.setAttribute("data-initialized","true"),{...h,[m.name]:v}},{}),d=zs.empty(f)?null:{};n(d),l==null||l({form:u,errors:d||{}})},[]),a=w.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget;let f=_v(u);Array.from(u.elements).forEach(d=>{if(d.tagName==="SELECT"){const h=d;f=Ky(f,h.name,h.value)}if(d.tagName==="INPUT"){const h=d;f=Ky(f,h.name,aa(h))}}),l({form:u,json:f,event:c,reset:()=>rh(u)})},[]);return{input:i,select:o,onSubmit:a,errors:e,onInvalid:s,disabled:e!==null}},lk={name:"dark",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},colors:{foreground:"#f8fafc",background:"#191817",accent:"#0ea5e9",disabled:"#52525b",primary:{foreground:"#f8fafc",DEFAULT:"#0ea5e9",subtle:"#bae6fd",hover:"#0284c7"},secondary:{DEFAULT:"#475569",subtle:"#cbd5e1",hover:"#334155"},info:{DEFAULT:"#3b82f6",subtle:"#93c5fd",hover:"#1d4ed8"},danger:{DEFAULT:"#ef4444",subtle:"#fca5a5",hover:"#dc2626"},success:{DEFAULT:"#10b981",subtle:"#6ee7b7",hover:"#047857"},input:{border:"#52525b",placeholder:"#94a3b8","mask-error":"#fca5a5","switch-bg":"#171717",switch:"#fff"},card:{background:"#27272a",border:"#3f3f46",overlay:"#00000080"},floating:{background:"#252525",border:"#3f3f46",overlay:"#00000080"},tooltip:{background:"#141414",border:"#27272a"},table:{background:"#27272a",border:"#52525b",row:"#3f3f46"}}},ck={name:"light",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},colors:{foreground:"#334155",background:"#f1f5f9",accent:"#0ea5e9",disabled:"#52525b",primary:{foreground:"#f8fafc",DEFAULT:"#0ea5e9",subtle:"#bae6fd",hover:"#0284c7"},secondary:{DEFAULT:"#475569",subtle:"#cbd5e1",hover:"#334155"},info:{DEFAULT:"#3b82f6",subtle:"#93c5fd",hover:"#1d4ed8"},danger:{DEFAULT:"#ef4444",subtle:"#fca5a5",hover:"#dc2626"},success:{DEFAULT:"#10b981",subtle:"#6ee7b7",hover:"#047857"},input:{border:"#52525b",placeholder:"#94a3b8","mask-error":"#fca5a5","switch-bg":"#171717",switch:"#fff"},card:{background:"#ffffff",border:"#e2e8f0",overlay:"#00000080"},floating:{background:"#ffffff",border:"#e2e8f0",overlay:"#00000080"},tooltip:{background:"#141414",border:"#27272a"},table:{background:"#ffffff",border:"#e2e8f0",row:"#94a3b8"}}},uk={cssVariable:(t,e,n)=>`var(--${n})`,rgba:t=>`rgba(${t})`,rgb:t=>`rgb(${t})`,hsl:t=>`hsl(${t})`,hsla:t=>`hsla(${t})`,hex:t=>t,raw:t=>t},Ov=(t,e,n="",r="")=>Object.entries(t).reduce((o,[i,s])=>{const a=r===""?`${n}${i}`:`${r}-${i}`;if(typeof s=="string"){const l=r===""?`${n}${i}`:i;return o.concat(e(s,l,a))}return o.concat(Ov(s,e,n,a))},[]),Iv=(t,e,n="",r="")=>Object.entries(t).reduce((o,[i,s])=>{const a=r===""?`${n}${i}`:`${r}-${i}`;if(typeof s=="string"){const l=r===""?`${n}${i}`:i;return{...o,[l]:e(s,i,a)}}return{...o,[i]:Iv(s,e,n,a)}},{}),kv={default:t=>`:root { ${t} }`,dark:t=>`html.dark {${t}}`},Dv=(t,e)=>{const n=t.map(r=>`${r.key}: ${r.value}`).join(";");return e(n)},fk={default:t=>Dv(t,kv.default),dark:t=>Dv(t,kv.dark)};pe.Autocomplete=hx,pe.Button=Ki,pe.ButtonGroup=Ww,pe.Card=Qw,pe.Dropdown=Po,pe.FileUpload=qw,pe.Form=Xw,pe.Input=Ya,pe.InputFeedback=nd,pe.InputField=Vi,pe.Option=od,pe.Polymorph=Gi,pe.Select=er,pe.Switch=Jw,pe.Table=cI,pe.Tooltip=eS,pe.convertPath=Pv,pe.createDesignTokens=Iv,pe.createStyles=fk,pe.css=zt,pe.defaultDarkTheme=lk,pe.defaultLightTheme=ck,pe.formReset=rh,pe.formToJson=_v,pe.getSchemaShape=ku,pe.isReactComponent=cx,pe.isSsr=$O,pe.mergeRefs=Wa,pe.parsers=uk,pe.path=sv,pe.reduceTokens=Ov,pe.useForm=ak,pe.usePrevious=rd,pe.useReactive=cv,pe.uuid=Ws,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});
|
|
151
151
|
//# sourceMappingURL=index.umd.js.map
|