@g4rcez/components 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -238,5 +238,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
238
238
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function F1(e,t){if(e){if(typeof e=="string")return kd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kd(e,t)}}function kd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fL(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,s;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(l){i=!0,s=l}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw s}}return r}}function pL(e){if(Array.isArray(e))return e}var mL=typeof Su=="function"?Su:Su.default,hL="file-invalid-type",gL="file-too-large",vL="file-too-small",yL="too-many-files",xL=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:hL,message:"File type must be ".concat(r)}},vy=function(t){return{code:gL,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},yy=function(t){return{code:vL,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},bL={code:yL,message:"Too many files"};function L1(e,t){var n=e.type==="application/x-moz-file"||mL(e,t);return[n,n?null:xL(t)]}function V1(e,t,n){if(Br(e.size))if(Br(t)&&Br(n)){if(e.size>n)return[!1,vy(n)];if(e.size<t)return[!1,yy(t)]}else{if(Br(t)&&e.size<t)return[!1,yy(t)];if(Br(n)&&e.size>n)return[!1,vy(n)]}return[!0,null]}function Br(e){return e!=null}function wL(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,i=e.multiple,a=e.maxFiles,s=e.validator;return!i&&t.length>1||i&&a>=1&&t.length>a?!1:t.every(function(l){var c=L1(l,n),u=ca(c,1),d=u[0],p=V1(l,r,o),f=ca(p,1),h=f[0],g=s?s(l):null;return d&&h&&!g})}function Ns(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Qa(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function xy(e){e.preventDefault()}function SL(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function TL(e){return e.indexOf("Edge/")!==-1}function EL(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return SL(e)||TL(e)}function kn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.some(function(s){return!Ns(r)&&s&&s.apply(void 0,[r].concat(i)),Ns(r)})}}function CL(){return"showOpenFilePicker"in window}function kL(e){if(Br(e)){var t=Object.entries(e).filter(function(n){var r=ca(n,2),o=r[0],i=r[1],a=!0;return $1(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),a=!1),(!Array.isArray(i)||!i.every(z1))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(n,r){var o=ca(r,2),i=o[0],a=o[1];return gy(gy({},n),{},N1({},i,a))},{});return[{description:"Files",accept:t}]}return e}function RL(e){if(Br(e))return Object.entries(e).reduce(function(t,n){var r=ca(n,2),o=r[0],i=r[1];return[].concat(my(t),[o],my(i))},[]).filter(function(t){return $1(t)||z1(t)}).join(",")}function PL(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function AL(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function $1(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function z1(e){return/^.*\.[\w]+$/.test(e)}var IL=["children"],_L=["open"],OL=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],ML=["refKey","onChange","onClick"];function jL(e){return FL(e)||NL(e)||B1(e)||DL()}function DL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
239
239
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NL(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function FL(e){if(Array.isArray(e))return Rd(e)}function Tu(e,t){return $L(e)||VL(e,t)||B1(e,t)||LL()}function LL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
240
240
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B1(e,t){if(e){if(typeof e=="string")return Rd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rd(e,t)}}function Rd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function VL(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,s;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(l){i=!0,s=l}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw s}}return r}}function $L(e){if(Array.isArray(e))return e}function by(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?by(Object(n),!0).forEach(function(r){Pd(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):by(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Pd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fs(e,t){if(e==null)return{};var n=zL(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function zL(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var Mp=E.forwardRef(function(e,t){var n=e.children,r=Fs(e,IL),o=W1(r),i=o.open,a=Fs(o,_L);return E.useImperativeHandle(t,function(){return{open:i}},[i]),E.createElement(E.Fragment,null,n(mt(mt({},a),{},{open:i})))});Mp.displayName="Dropzone";var H1={disabled:!1,getFilesFromEvent:XF,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Mp.defaultProps=H1;Mp.propTypes={children:ot.func,accept:ot.objectOf(ot.arrayOf(ot.string)),multiple:ot.bool,preventDropOnDocument:ot.bool,noClick:ot.bool,noKeyboard:ot.bool,noDrag:ot.bool,noDragEventsBubbling:ot.bool,minSize:ot.number,maxSize:ot.number,maxFiles:ot.number,disabled:ot.bool,getFilesFromEvent:ot.func,onFileDialogCancel:ot.func,onFileDialogOpen:ot.func,useFsAccessApi:ot.bool,autoFocus:ot.bool,onDragEnter:ot.func,onDragLeave:ot.func,onDragOver:ot.func,onDrop:ot.func,onDropAccepted:ot.func,onDropRejected:ot.func,onError:ot.func,validator:ot.func};var Ad={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function W1(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=mt(mt({},H1),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,i=t.maxSize,a=t.minSize,s=t.multiple,l=t.maxFiles,c=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,p=t.onDrop,f=t.onDropAccepted,h=t.onDropRejected,g=t.onFileDialogCancel,m=t.onFileDialogOpen,v=t.useFsAccessApi,x=t.autoFocus,b=t.preventDropOnDocument,S=t.noClick,w=t.noKeyboard,T=t.noDrag,C=t.noDragEventsBubbling,R=t.onError,I=t.validator,P=E.useMemo(function(){return RL(n)},[n]),N=E.useMemo(function(){return kL(n)},[n]),j=E.useMemo(function(){return typeof m=="function"?m:wy},[m]),L=E.useMemo(function(){return typeof g=="function"?g:wy},[g]),A=E.useRef(null),O=E.useRef(null),M=E.useReducer(BL,Ad),F=Tu(M,2),D=F[0],H=F[1],_=D.isFocused,z=D.isFileDialogActive,X=E.useRef(typeof window<"u"&&window.isSecureContext&&v&&CL()),Q=function(){!X.current&&z&&setTimeout(function(){if(O.current){var te=O.current.files;te.length||(H({type:"closeDialog"}),L())}},300)};E.useEffect(function(){return window.addEventListener("focus",Q,!1),function(){window.removeEventListener("focus",Q,!1)}},[O,z,L,X]);var J=E.useRef([]),G=function(te){A.current&&A.current.contains(te.target)||(te.preventDefault(),J.current=[])};E.useEffect(function(){return b&&(document.addEventListener("dragover",xy,!1),document.addEventListener("drop",G,!1)),function(){b&&(document.removeEventListener("dragover",xy),document.removeEventListener("drop",G))}},[A,b]),E.useEffect(function(){return!r&&x&&A.current&&A.current.focus(),function(){}},[A,x,r]);var Y=E.useCallback(function(q){R?R(q):console.error(q)},[R]),Z=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q),J.current=[].concat(jL(J.current),[q.target]),Qa(q)&&Promise.resolve(o(q)).then(function(te){if(!(Ns(q)&&!C)){var me=te.length,Oe=me>0&&wL({files:te,accept:P,minSize:a,maxSize:i,multiple:s,maxFiles:l,validator:I}),He=me>0&&!Oe;H({isDragAccept:Oe,isDragReject:He,isDragActive:!0,type:"setDraggedFiles"}),c&&c(q)}}).catch(function(te){return Y(te)})},[o,c,Y,C,P,a,i,s,l,I]),V=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q);var te=Qa(q);if(te&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return te&&d&&d(q),!1},[d,C]),$=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q);var te=J.current.filter(function(Oe){return A.current&&A.current.contains(Oe)}),me=te.indexOf(q.target);me!==-1&&te.splice(me,1),J.current=te,!(te.length>0)&&(H({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Qa(q)&&u&&u(q))},[A,u,C]),K=E.useCallback(function(q,te){var me=[],Oe=[];q.forEach(function(He){var Ye=L1(He,P),Ot=Tu(Ye,2),pn=Ot[0],En=Ot[1],er=V1(He,a,i),tr=Tu(er,2),nr=tr[0],W=tr[1],U=I?I(He):null;if(pn&&nr&&!U)me.push(He);else{var ze=[En,W];U&&(ze=ze.concat(U)),Oe.push({file:He,errors:ze.filter(function(tt){return tt})})}}),(!s&&me.length>1||s&&l>=1&&me.length>l)&&(me.forEach(function(He){Oe.push({file:He,errors:[bL]})}),me.splice(0)),H({acceptedFiles:me,fileRejections:Oe,isDragReject:Oe.length>0,type:"setFiles"}),p&&p(me,Oe,te),Oe.length>0&&h&&h(Oe,te),me.length>0&&f&&f(me,te)},[H,s,P,a,i,l,p,f,h,I]),ie=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q),J.current=[],Qa(q)&&Promise.resolve(o(q)).then(function(te){Ns(q)&&!C||K(te,q)}).catch(function(te){return Y(te)}),H({type:"reset"})},[o,K,Y,C]),B=E.useCallback(function(){if(X.current){H({type:"openDialog"}),j();var q={multiple:s,types:N};window.showOpenFilePicker(q).then(function(te){return o(te)}).then(function(te){K(te,null),H({type:"closeDialog"})}).catch(function(te){PL(te)?(L(te),H({type:"closeDialog"})):AL(te)?(X.current=!1,O.current?(O.current.value=null,O.current.click()):Y(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Y(te)});return}O.current&&(H({type:"openDialog"}),j(),O.current.value=null,O.current.click())},[H,j,L,v,K,Y,N,s]),ye=E.useCallback(function(q){!A.current||!A.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),B())},[A,B]),Te=E.useCallback(function(){H({type:"focus"})},[]),Re=E.useCallback(function(){H({type:"blur"})},[]),$e=E.useCallback(function(){S||(EL()?setTimeout(B,0):B())},[S,B]),se=function(te){return r?null:te},xe=function(te){return w?null:se(te)},le=function(te){return T?null:se(te)},be=function(te){C&&te.stopPropagation()},oe=E.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=q.refKey,me=te===void 0?"ref":te,Oe=q.role,He=q.onKeyDown,Ye=q.onFocus,Ot=q.onBlur,pn=q.onClick,En=q.onDragEnter,er=q.onDragOver,tr=q.onDragLeave,nr=q.onDrop,W=Fs(q,OL);return mt(mt(Pd({onKeyDown:xe(kn(He,ye)),onFocus:xe(kn(Ye,Te)),onBlur:xe(kn(Ot,Re)),onClick:se(kn(pn,$e)),onDragEnter:le(kn(En,Z)),onDragOver:le(kn(er,V)),onDragLeave:le(kn(tr,$)),onDrop:le(kn(nr,ie)),role:typeof Oe=="string"&&Oe!==""?Oe:"presentation"},me,A),!r&&!w?{tabIndex:0}:{}),W)}},[A,ye,Te,Re,$e,Z,V,$,ie,w,T,r]),ue=E.useCallback(function(q){q.stopPropagation()},[]),ee=E.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=q.refKey,me=te===void 0?"ref":te,Oe=q.onChange,He=q.onClick,Ye=Fs(q,ML),Ot=Pd({accept:P,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:se(kn(Oe,ie)),onClick:se(kn(He,ue)),tabIndex:-1},me,O);return mt(mt({},Ot),Ye)}},[O,n,s,ie,r]);return mt(mt({},D),{},{isFocused:_&&!r,getRootProps:oe,getInputProps:ee,rootRef:A,inputRef:O,open:se(B)})}function BL(e,t){switch(t.type){case"focus":return mt(mt({},e),{},{isFocused:!0});case"blur":return mt(mt({},e),{},{isFocused:!1});case"openDialog":return mt(mt({},Ad),{},{isFileDialogActive:!0});case"closeDialog":return mt(mt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return mt(mt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return mt(mt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"reset":return mt({},Ad);default:return e}}function wy(){}const q1=E.createContext([null,()=>{}]),HL=()=>E.useContext(q1),WL=e=>e.type.startsWith("image/")?"img":e.type.startsWith("audio/")?"audio":e.type.startsWith("video/")?"video":e.type,qL={csv:Hc,xls:Hc,mov:hg,mp4:hg,xlsx:Hc,pdf:mg,txt:mg,json:GA,mp3:NA},UL=e=>{const[,t]=HL(),[n,r]=E.useState({url:"",type:"",size:""});E.useEffect(()=>{const l=e.file,c=URL.createObjectURL(l);return r({url:c,type:WL(l),size:VF(l.size)}),()=>URL.revokeObjectURL(c)},[e.file]);const o=l=>{l.stopPropagation(),l.preventDefault(),t({...n,file:e.file})},i=l=>{var c;l.preventDefault(),l.stopPropagation(),(c=e.onDeleteFile)==null||c.call(e,e.file)},a=qL[e.file.name.split(".").at(-1)]??c0,s=n.type==="img"?y.jsx("img",{src:n.url,className:"block w-full",alt:e.file.name}):y.jsx(a,{strokeWidth:2,absoluteStrokeWidth:!0,size:48});return y.jsxs("li",{className:"flex w-full flex-row justify-between gap-4 border-b border-card-border last:border-b-transparent",children:[y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsxs("div",{className:"flex flex-row items-center gap-4",children:[y.jsx("button",{type:"button",onClick:o,className:"flex size-20 items-center justify-center",children:s}),y.jsxs("div",{className:"flex flex-col items-start justify-start text-left",children:[y.jsx("span",{children:e.file.name}),y.jsx("span",{className:"text-sm italic",children:n.size})]})]}),e.File?y.jsx("div",{className:"min-w-full flex-1",children:y.jsx(e.File,{file:e.file})}):null]}),y.jsx("div",{className:"align-start justify-start flex py-4 transition-colors duration-300 ease-linear hover:text-danger-hover",children:y.jsx("button",{onClick:i,type:"button",className:"size-6 flex items-center justify-center",children:y.jsx(xa,{size:16})})})]})},KL=e=>y.jsx("ul",{className:"w-full space-y-8",children:e.files.map(t=>y.jsx(UL,{File:e.File,onDeleteFile:e.onDeleteFile,file:t},t.name))}),U1=e=>{const t=Ct(),n=e.dragging?eI:nI;return y.jsxs("div",{className:"flex flex-col items-center justify-center",children:[y.jsx("div",{className:"flex flex-col items-center justify-center gap-2",children:y.jsx(n,{className:"text-primary",size:80})}),y.jsxs("div",{className:"my-4 flex flex-col items-center gap-1",children:[y.jsx("p",{children:t.uploadIdle}),y.jsx("button",{className:"text-primary underline",type:"button",children:t.uploadIdleButton})]})]})},YL=e=>e.isDragActive?y.jsx(U1,{files:e.files,dragging:!0}):e.files.length>0?y.jsx(KL,{File:e.File,onDeleteFile:e.onDeleteFile,files:e.files}):y.jsx(E.Fragment,{children:e.idle}),GL=y.jsx(U1,{dragging:!1}),ZL=e=>{const t=e.item.file,n=e.item.type;return y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsx("p",{className:"text-lg font-medium",children:e.item.file.name}),y.jsx("p",{className:"text-base",children:e.item.size}),n==="img"?y.jsx("img",{className:"container block w-full max-w-96",src:e.item.url,alt:t.name}):n==="video"?y.jsx("video",{className:"container block w-full max-w-96",src:e.item.url,controls:!0,muted:!0}):n==="audio"?y.jsx("figure",{children:y.jsx("audio",{controls:!0,src:e.item.url})}):null]})},XL=({idle:e=GL,onDeleteFile:t,File:n,onDrop:r,...o})=>{const i=Ct(),a=E.useState(null),[s,l]=E.useState([]),c=o.files??s,u=()=>a[1](null),d=g=>{r==null||r(g),l(m=>m.concat(g))},{getRootProps:p,getInputProps:f,isDragActive:h}=W1({onDrop:d});return y.jsxs(q1.Provider,{value:a,children:[y.jsx(dp,{overlayClickClose:!0,title:i.uploadDialogTitle,ariaTitle:i.uploadDialogTitle,open:a[0]!==null,onChange:u,children:a[0]?y.jsx(ZL,{item:a[0]}):null}),y.jsxs("div",{...p(),"data-active":c?c.length>0:!1,className:"flex flex-col items-center justify-center rounded-lg border border-card-border p-6 text-foreground data-[active=true]:border-solid data-[active=false]:border-dashed data-[active=true]:border-transparent data-[active=true]:bg-card-background",children:[y.jsx("input",{...f(o),name:o.name,id:o.name}),y.jsx(YL,{File:n,onDeleteFile:t,isDragActive:h,idle:e,files:c})]})]})},QL=e=>{const t=n=>{var r;n.persist(),n.preventDefault(),(r=e.onSubmit)==null||r.call(e,n)};return y.jsx("form",{...e,onSubmit:t})},Sy=40,JL=e=>y.jsx(E.Fragment,{children:e.children}),eV={duration:300,initial:{transform:"scaleY(0)",opacity:.2},open:{transform:"scaleY(1)",opacity:1},close:{transform:"scaleY(0)",opacity:0}},Ty=[],tV=E.forwardRef(function(t,n){return y.jsx(pt.ul,{...t,role:"listbox",ref:n,className:"w-full rounded-b-lg border-b border-tooltip-border last:border-transparent",children:y.jsx(Er,{children:t.children})})}),nV=E.forwardRef(function({item:t,context:n,...r},o){return y.jsx(pt.li,{...r,ref:o,className:"last:rounded-t-lg"})}),rV={List:tV,Item:nV},oV=e=>{const t=Ct(),n=E.useRef(null),r=E.Children.count(e.children),[o,i]=E.useState(!1);return E.useEffect(()=>{if(n.current===null)return;const a=n.current.parentElement.getBoundingClientRect(),l=Array.from(n.current.querySelectorAll("[data-component='tag']")).reduce((u,d)=>u+d.getBoundingClientRect().width,0);if(n.current.querySelectorAll("[data-multicounter]").length&&r<=3)return i(!1);if(l>a.width)return i(!0)},[r]),y.jsx("span",{ref:n,className:"flex flex-nowrap gap-x-2",children:o?y.jsxs(cs,{size:"small","data-multicounter":"true",children:[r," ",t.multiSelectSelectedLabel]}):e.children})},iV=E.forwardRef(({left:e,error:t,right:n,options:r,container:o,rightLabel:i,interactive:a,emptyMessage:s,optionalText:l,selectedLabel:c,labelClassName:u,feedback:d=null,hideLeft:p=!1,required:f=!1,dynamicOption:h=!1,onChangeOptions:g,...m},v)=>{const x=E.useMemo(()=>new yn(r.map(ee=>[ee.value,ee])),[r]),b=E.useRef(null),S=E.useRef(null),w=m.value??m.defaultValue??Ty,T=Ct(),[C,R]=E.useState(0),[I,P]=E.useState(!1),[N,j]=E.useState(""),[L,A]=E.useState(()=>{const ee=new yn;return w.forEach(q=>{const te=x.get(q);return te?ee.set(q,te):void 0}),ee}),O=E.useMemo(()=>Array.from(L.keys()),[L]),[M,F]=E.useState(()=>{const ee=new Set(w);return r.reduce((q,te)=>ee.has(te.value)?[...q,te.label??te.value]:q,[])??w}),[D,H]=E.useState(null),_=E.useRef(Ty),z=h&&N!==""?[{value:N,label:N,"data-dynamic":"true"},...r]:r,X=N.length===0?z:lp(z,"value",[{key:"value",value:N},{key:"label",value:N}]),Q=up(I,"block-only"),J=X.filter(ee=>ee.hidden!==!0),G=J.length===0,{x:Y,y:Z,strategy:V,refs:$,context:K}=Ar({open:I,transform:!0,placement:"bottom-start",strategy:"absolute",onOpenChange:P,whileElementsMounted:di,middleware:[wa(4),Ow({padding:10,elementContext:"reference",apply(ee){const q=ee.elements.floating.querySelector("ul"),te=(q==null?void 0:q.getBoundingClientRect().height)||0,me=qi($.reference.current,window.innerHeight),Oe=Math.min(te<Sy?me:te,me,ee.availableHeight),He=J.length===0?Sy:Math.min(Oe,me,te),Ye=`${b.current.getBoundingClientRect().width}px`;Object.assign(ee.elements.floating.style,{width:Ye,maxWidth:Ye,height:He})}})]}),ie=Gw(K,eV),{getReferenceProps:B,getFloatingProps:ye,getItemProps:Te}=Ir([so(K,{role:"listbox"}),ao(K),Cl(K,{cols:0,listRef:_,loop:!0,virtual:!0,allowEscape:!0,activeIndex:D,selectedIndex:D,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,scrollItemIntoView:!0,onNavigate:ee=>H(q=>ee??q)})]);E.useEffect(()=>{if(!I)return R(0);const ee=$.reference;if(ee.current===null)return;const q=qi(ee.current,window.innerHeight);setTimeout(()=>R(Math.min(q,J.length*40)),100)},[N,I,$.reference]),E.useEffect(()=>{m.value&&A(new yn(m.value.map(ee=>[ee,x.get(ee)])))},[m.value,x]),E.useEffect(()=>{const ee=$.reference.current;if(ee)return ma(ee)},[]);const Re=(ee,q)=>{const te=L.clone(He=>He.has(ee.value)?He.remove(ee.value):He.set(ee.value,ee));A(te);const me=$.reference.current;if(!me)return;const Oe=te.map(He=>He.value);me==null||me.setAttribute("data-value",JSON.stringify(Oe)),g&&g(Oe),F(He=>He.concat(ee.label??"")),j(""),H(q)},$e=ee=>{const q=ee.target.value;return j(q),!I&&q===""?P(!0):(ee.target.name=m.name||"",q?P(!0):void 0)},se=()=>{var ee;P(!0),j(""),(ee=$.reference.current)==null||ee.focus()},xe=()=>{P(!0),j("")},le=()=>{var ee;(ee=$.reference.current)==null||ee.setAttribute("data-value","[]"),j(""),P(!1),A(new yn),g==null||g([])},be=m.id||m.name,oe=L.map((ee,q)=>y.jsx(cs,{size:"small",icon:y.jsx("button",{type:"button",className:"text-current hover:text-danger focus:text-danger",onClick:te=>{te.preventDefault(),te.stopPropagation(),Re(ee,q)},children:y.jsx(xa,{size:14})}),children:ee.label??ee.value},`MultiSelect-${ee.value}-x`)),ue={height:G?"0":L.size===0?C-49:C-86};return y.jsxs(Ra,{...m,left:e,error:t,ref:b,form:m.form,name:m.name,feedback:d,hideLeft:p,required:f,title:m.title,container:o,rightLabel:i,interactive:a,id:m.name||m.id,optionalText:l,componentName:"autocomplete",labelClassName:u,placeholder:m.placeholder,right:y.jsxs("span",{className:"flex items-center gap-0.5",children:[n,y.jsxs("button",{type:"button",className:"transition-colors link:text-primary",onClick:se,children:[y.jsx(If,{size:20}),y.jsx("span",{className:"sr-only",children:T.inputCaretDown})]}),L?y.jsx("button",{type:"button",onClick:le,className:"transition-colors link:text-danger",children:y.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:y.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}):null]}),children:[y.jsxs("ul",{...B({...m,onFocus:xe,id:`${be}-shadow`,name:`${be}-shadow`,ref:$.setReference}),tabIndex:0,role:"button","data-name":be,"data-target":be,"data-shadow":"true","data-error":!!t,"aria-autocomplete":"list","data-value":O.join(","),className:Ie("input placeholder-input-mask group h-input-height w-full","rounded-md bg-transparent px-input-x py-input-y text-foreground","outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary","group-error:text-danger group-error:placeholder-input-mask-error","group-focus-within:border-primary group-hover:border-primary","flex flex-row items-center gap-2 whitespace-nowrap text-left","max-w-full overflow-x-auto truncate overflow-ellipsis",m.className),children:[O.length>0?null:y.jsx("li",{className:"text-input-placeholder",children:m.placeholder}),y.jsx(oV,{label:c,children:oe})]}),y.jsx("input",{id:be,name:be,type:"hidden","data-origin":be,ref:v,required:f,defaultValue:m.value||O||void 0}),y.jsx(io,{preserveTabOrder:!0,children:I?y.jsx(Yw,{lockScroll:!0,children:y.jsx(mi,{modal:!0,guards:!0,returnFocus:!1,context:K,initialFocus:-1,visuallyHiddenDismiss:!0,children:y.jsxs("div",{...ye({ref:$.setFloating,style:{...ie.styles,top:Z??0,position:V,left:Y,height:C-(O.length===0?65:30)}}),"data-floating":"true",className:"shadow-floating isolate z-floating m-0 max-h-96 w-full origin-[top_center] list-none overscroll-contain rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground",children:[y.jsx("input",{autoFocus:!0,value:N,onChange:$e,title:m.title,placeholder:T.multiSelectInnerPlaceholder,className:"input placeholder-input-mask group mb-1 h-10 w-full flex-1 rounded border-b border-input-border bg-transparent px-input-x py-input-y outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary",onKeyDown:ee=>{var q,te;if(ee.key==="ArrowDown"){let me=D+1;return me>J.length-1&&(me=0),(q=S.current)==null||q.scrollIntoView({index:me}),H(me)}if(ee.key==="ArrowUp"){let me=D-1;return me<0&&(me=J.length-1),(te=S.current)==null||te.scrollIntoView({index:me}),H(me)}if(ee.key==="Escape")return ee.currentTarget.blur(),P(!1);if(ee.key==="Enter"){if(D!==null&&J[D])return ee.preventDefault(),Re(J[D],D);if(J.length===1)return ee.preventDefault(),Re(J[0],0)}}}),G?y.jsx("li",{role:"option",className:"w-full border-b border-tooltip-border last:border-transparent",children:y.jsx("span",{className:"flex w-full justify-between p-2 text-left text-disabled",children:s||T.autocompleteEmpty})}):null,G?null:y.jsx(pt.div,{initial:!1,"data-floating":"true",ref:Q,animate:{height:G?"auto":C},style:ue,className:"max-h-72 w-full overscroll-contain",onAnimationComplete:()=>{if(!I)return R(0);const q=$.floating.current.querySelectorAll("li").item(0),te=(q?q.getBoundingClientRect().height:40)*J.length;return pa.flushSync(()=>R(te+2))},children:y.jsx(Pp,{ref:S,hidden:G,data:J,components:rV,style:ue,className:"max-h-72 border-floating-border bg-floating-background p-0 text-foreground",itemContent:(ee,q)=>{const te=q.Render??JL,me=L.has(q.value)||L.has(q.label??""),Oe=D===ee,He=q.label??q.value;return y.jsxs("button",{"data-value":q.value,...Te({ref:Ye=>void(_.current[ee]=Ye),role:"option",type:"button","aria-checked":me,"aria-current":me,"aria-selected":me,"aria-busy":q.disabled,onClick:()=>Re(q,ee)}),className:`flex w-full max-w-full cursor-pointer items-center justify-start p-2 text-left hover:bg-floating-hover focus:bg-floating-hover ${me||Oe?"bg-floating-hover text-floating-foreground":""}`,children:[y.jsx(_p,{onChange:Bf,checked:me,"aria-checked":me,onClick:Ye=>{Ye.stopPropagation(),Re(q,ee)}}),y.jsx(te,{...m,label:q.label,value:q.value,children:He})]})}})}),y.jsx("div",{className:"sticky bottom-0 flex w-full flex-nowrap items-center gap-2 overflow-x-auto rounded-b-lg bg-floating-background p-2",children:L.size===0?y.jsx(cs,{theme:"muted",size:"small",children:T.autocompleteEmpty}):oe})]})})}):null})]})}),aV=({children:e,className:t="",size:n,...r})=>y.jsxs("label",{"data-component":"radiobox","data-disabled":r.disabled,"aria-disabled":r.disabled,className:"group flex items-center gap-2 font-normal data-[disabled=true]:cursor-not-allowed",children:[y.jsx("input",{...r,type:"radio",className:Ie("app form-radio inline-block h-4 w-4 appearance-none rounded-full border-card-border bg-origin-border text-primary focus:ring-primary disabled:opacity-70 group-aria-disabled:cursor-not-allowed",t),...r}),e]}),Qr=E.forwardRef(({required:e=!0,options:t,info:n,selectContainer:r="",feedback:o=null,labelClassName:i,interactive:a,rightLabel:s,loading:l,optionalText:c,container:u,hideLeft:d=!1,right:p,left:f,error:h,...g},m)=>{const v=Ct(),x=E.useRef(null),b=g.id??g.name;E.useImperativeHandle(m,()=>x.current),E.useEffect(()=>{if(x.current===null)return;const w=new AbortController,T=x.current,C=ma(x.current);return T.addEventListener("change",()=>T.setAttribute("data-selected","true"),{once:!0,signal:w.signal}),()=>{C(),w.abort()}},[]);const S=()=>{var w;return(w=x.current)==null?void 0:w.focus()};return y.jsx(Ra,{info:n,left:f,error:h,form:g.form,loading:l,name:g.name,feedback:o,hideLeft:d,required:e,title:g.title,container:u,componentName:"select",rightLabel:s,interactive:a,id:g.name||g.id,optionalText:c,labelClassName:i,placeholder:g.placeholder,right:y.jsxs("label",{htmlFor:b,children:[p,y.jsxs("button",{onClick:S,type:"button",className:"mt-2 transition-colors hover:text-primary",children:[y.jsx(If,{size:20}),y.jsx("span",{className:"sr-only",children:v.inputCaretDown})]})]}),children:y.jsxs("select",{...g,id:b,name:b,required:e,ref:Un(m,x),"data-selected":!!g.value||!1,title:typeof g.title=="string"?g.title:void 0,className:Ie("input select group h-10 w-full flex-1 appearance-none rounded-md","bg-transparent px-2 py-1 text-foreground placeholder-input-placeholder","outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error","data-[selected=false]:text-input-placeholder",g.className),children:[y.jsx("option",{value:"",disabled:!0,hidden:!0,children:g.placeholder}),t.map(w=>E.createElement("option",{...w,value:w.value,children:w.label??w.value,key:`${b}-select-option-${w.value}`}))]})})});function K1(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ao(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Ey(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Y1(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Ey(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():Ey(e[o],null)}}}}function Jr(...e){return k.useCallback(Y1(...e),e)}function G1(e,t=[]){let n=[];function r(i,a){const s=k.createContext(a),l=n.length;n=[...n,a];const c=d=>{var v;const{scope:p,children:f,...h}=d,g=((v=p==null?void 0:p[e])==null?void 0:v[l])||s,m=k.useMemo(()=>h,Object.values(h));return y.jsx(g.Provider,{value:m,children:f})};c.displayName=i+"Provider";function u(d,p){var g;const f=((g=p==null?void 0:p[e])==null?void 0:g[l])||s,h=k.useContext(f);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(a=>k.createContext(a));return function(s){const l=(s==null?void 0:s[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[r,sV(o,...t)]}function sV(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=r.reduce((s,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...s,...d}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Z1(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function lV({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=cV({defaultProp:t,onChange:n}),i=e!==void 0,a=i?e:r,s=Z1(n),l=k.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&s(d)}else o(c)},[i,e,o,s]);return[a,l]}function cV({defaultProp:e,onChange:t}){const n=k.useState(e),[r]=n,o=k.useRef(r),i=Z1(t);return k.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var uV=k.createContext(void 0);function dV(e){const t=k.useContext(uV);return e||t||"ltr"}function fV(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var pV=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{};function mV(e){const[t,n]=k.useState(void 0);return pV(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,s;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,s=c.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function Id(e){const t=hV(e),n=k.forwardRef((r,o)=>{const{children:i,...a}=r,s=k.Children.toArray(i),l=s.find(vV);if(l){const c=l.props.children,u=s.map(d=>d===l?k.Children.count(c)>1?k.Children.only(null):k.isValidElement(c)?c.props.children:null:d);return y.jsx(t,{...a,ref:o,children:k.isValidElement(c)?k.cloneElement(c,void 0,u):null})}return y.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function hV(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const a=xV(o),s=yV(i,o.props);return o.type!==k.Fragment&&(s.ref=r?Y1(r,a):a),k.cloneElement(o,s)}return k.Children.count(o)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gV=Symbol("radix.slottable");function vV(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gV}function yV(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...s)=>{i(...s),o(...s)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function xV(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bV=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_l=bV.reduce((e,t)=>{const n=Id(`Primitive.${t}`),r=k.forwardRef((o,i)=>{const{asChild:a,...s}=o,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(l,{...s,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wV(e){const t=e+"CollectionProvider",[n,r]=G1(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:m,children:v}=g,x=E.useRef(null),b=E.useRef(new Map).current;return y.jsx(o,{scope:m,itemMap:b,collectionRef:x,children:v})};a.displayName=t;const s=e+"CollectionSlot",l=Id(s),c=E.forwardRef((g,m)=>{const{scope:v,children:x}=g,b=i(s,v),S=Jr(m,b.collectionRef);return y.jsx(l,{ref:S,children:x})});c.displayName=s;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=Id(u),f=E.forwardRef((g,m)=>{const{scope:v,children:x,...b}=g,S=E.useRef(null),w=Jr(m,S),T=i(u,v);return E.useEffect(()=>(T.itemMap.set(S,{ref:S,...b}),()=>void T.itemMap.delete(S))),y.jsx(p,{[d]:"",ref:w,children:x})});f.displayName=u;function h(g){const m=i(e+"CollectionConsumer",g);return E.useCallback(()=>{const x=m.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((T,C)=>b.indexOf(T.ref.current)-b.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:c,ItemSlot:f},h,r]}var X1=["PageUp","PageDown"],Q1=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],J1={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},xi="Slider",[_d,SV,TV]=wV(xi),[eS,Kz]=G1(xi,[TV]),[EV,Ol]=eS(xi),tS=k.forwardRef((e,t)=>{const{name:n,min:r=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[r],value:u,onValueChange:d=()=>{},onValueCommit:p=()=>{},inverted:f=!1,form:h,...g}=e,m=k.useRef(new Set),v=k.useRef(0),b=a==="horizontal"?CV:kV,[S=[],w]=lV({prop:u,defaultProp:c,onChange:N=>{var L;(L=[...m.current][v.current])==null||L.focus(),d(N)}}),T=k.useRef(S);function C(N){const j=_V(S,N);P(N,j)}function R(N){P(N,v.current)}function I(){const N=T.current[v.current];S[v.current]!==N&&p(S)}function P(N,j,{commit:L}={commit:!1}){const A=DV(i),O=NV(Math.round((N-r)/i)*i+r,A),M=K1(O,[r,o]);w((F=[])=>{const D=AV(F,M,j);if(jV(D,l*i)){v.current=D.indexOf(M);const H=String(D)!==String(F);return H&&L&&p(D),H?D:F}else return F})}return y.jsx(EV,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:o,valueIndexToChangeRef:v,thumbs:m.current,values:S,orientation:a,form:h,children:y.jsx(_d.Provider,{scope:e.__scopeSlider,children:y.jsx(_d.Slot,{scope:e.__scopeSlider,children:y.jsx(b,{"aria-disabled":s,"data-disabled":s?"":void 0,...g,ref:t,onPointerDown:Ao(g.onPointerDown,()=>{s||(T.current=S)}),min:r,max:o,inverted:f,onSlideStart:s?void 0:C,onSlideMove:s?void 0:R,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&P(r,0,{commit:!0}),onEndKeyDown:()=>!s&&P(o,S.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:j})=>{if(!s){const O=X1.includes(N.key)||N.shiftKey&&Q1.includes(N.key)?10:1,M=v.current,F=S[M],D=i*O*j;P(F+D,M,{commit:!0})}}})})})})});tS.displayName=xi;var[nS,rS]=eS(xi,{startEdge:"left",endEdge:"right",size:"width",direction:1}),CV=k.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=e,[d,p]=k.useState(null),f=Jr(t,b=>p(b)),h=k.useRef(void 0),g=dV(o),m=g==="ltr",v=m&&!i||!m&&i;function x(b){const S=h.current||d.getBoundingClientRect(),w=[0,S.width],C=jp(w,v?[n,r]:[r,n]);return h.current=S,C(b-S.left)}return y.jsx(nS,{scope:e.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width",children:y.jsx(oS,{dir:g,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const S=x(b.clientX);a==null||a(S)},onSlideMove:b=>{const S=x(b.clientX);s==null||s(S)},onSlideEnd:()=>{h.current=void 0,l==null||l()},onStepKeyDown:b=>{const w=J1[v?"from-left":"from-right"].includes(b.key);c==null||c({event:b,direction:w?-1:1})}})})}),kV=k.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:l,...c}=e,u=k.useRef(null),d=Jr(t,u),p=k.useRef(void 0),f=!o;function h(g){const m=p.current||u.current.getBoundingClientRect(),v=[0,m.height],b=jp(v,f?[r,n]:[n,r]);return p.current=m,b(g-m.top)}return y.jsx(nS,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:y.jsx(oS,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const m=h(g.clientY);i==null||i(m)},onSlideMove:g=>{const m=h(g.clientY);a==null||a(m)},onSlideEnd:()=>{p.current=void 0,s==null||s()},onStepKeyDown:g=>{const v=J1[f?"from-bottom":"from-top"].includes(g.key);l==null||l({event:g,direction:v?-1:1})}})})}),oS=k.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:l,...c}=e,u=Ol(xi,n);return y.jsx(_l.span,{...c,ref:t,onKeyDown:Ao(e.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):X1.concat(Q1).includes(d.key)&&(l(d),d.preventDefault())}),onPointerDown:Ao(e.onPointerDown,d=>{const p=d.target;p.setPointerCapture(d.pointerId),d.preventDefault(),u.thumbs.has(p)?p.focus():r(d)}),onPointerMove:Ao(e.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:Ao(e.onPointerUp,d=>{const p=d.target;p.hasPointerCapture(d.pointerId)&&(p.releasePointerCapture(d.pointerId),i(d))})})}),iS="SliderTrack",aS=k.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=Ol(iS,n);return y.jsx(_l.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...r,ref:t})});aS.displayName=iS;var Od="SliderRange",sS=k.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=Ol(Od,n),i=rS(Od,n),a=k.useRef(null),s=Jr(t,a),l=o.values.length,c=o.values.map(p=>cS(p,o.min,o.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return y.jsx(_l.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...r,ref:s,style:{...e.style,[i.startEdge]:u+"%",[i.endEdge]:d+"%"}})});sS.displayName=Od;var Md="SliderThumb",lS=k.forwardRef((e,t)=>{const n=SV(e.__scopeSlider),[r,o]=k.useState(null),i=Jr(t,s=>o(s)),a=k.useMemo(()=>r?n().findIndex(s=>s.ref.current===r):-1,[n,r]);return y.jsx(RV,{...e,ref:i,index:a})}),RV=k.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:o,...i}=e,a=Ol(Md,n),s=rS(Md,n),[l,c]=k.useState(null),u=Jr(t,x=>c(x)),d=l?a.form||!!l.closest("form"):!0,p=mV(l),f=a.values[r],h=f===void 0?0:cS(f,a.min,a.max),g=IV(r,a.values.length),m=p==null?void 0:p[s.size],v=m?OV(m,h,s.direction):0;return k.useEffect(()=>{if(l)return a.thumbs.add(l),()=>{a.thumbs.delete(l)}},[l,a.thumbs]),y.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${h}% + ${v}px)`},children:[y.jsx(_d.ItemSlot,{scope:e.__scopeSlider,children:y.jsx(_l.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":a.min,"aria-valuenow":f,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:u,style:f===void 0?{display:"none"}:e.style,onFocus:Ao(e.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),d&&y.jsx(PV,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:f},r)]})});lS.displayName=Md;var PV=e=>{const{value:t,...n}=e,r=k.useRef(null),o=fV(t);return k.useEffect(()=>{const i=r.current,a=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(a,"value").set;if(o!==t&&l){const c=new Event("input",{bubbles:!0});l.call(i,t),i.dispatchEvent(c)}},[o,t]),y.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:t})};function AV(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,i)=>o-i)}function cS(e,t,n){const i=100/(n-t)*(e-t);return K1(i,[0,100])}function IV(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function _V(e,t){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-t)),r=Math.min(...n);return n.indexOf(r)}function OV(e,t,n){const r=e/2,i=jp([0,50],[0,r]);return(r-i(t)*n)*n}function MV(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function jV(e,t){if(t>0){const n=MV(e);return Math.min(...n)>=t}return!0}function jp(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function DV(e){return(String(e).split(".")[1]||"").length}function NV(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var FV=tS,LV=aS,VV=sS,$V=lS;const zV=e=>{const[t,n]=E.useState(null),r=E.useRef(null);return E.useEffect(()=>{const o=r.current;if(o===null)return;const i=Number(o.getAttribute("aria-valuenow"));Ve.number(i)&&n(i);const a=new MutationObserver(s=>{const l=s[0].target,c=Number(l.getAttribute("aria-valuenow"));n(Ve.number(c)?c:null)});return a.observe(o,{attributeFilter:["aria-valuenow"]}),()=>a.disconnect()},[]),y.jsx(fp,{title:"",ref:r,as:$V,enabled:e.tooltip,className:"block bg-input-switch size-5 cursor-grab rounded-full border-1 border-input-border shadow-shadow-floating active:cursor-grabbing",children:t})},BV=e=>{const{tooltip:t,className:n,defaultValue:r,value:o,...i}=e,a=E.useRef(li()),s=r||o||[];return y.jsxs(FV,{...i,defaultValue:r,value:o,className:Ie("relative flex h-5 w-full touch-none select-none items-center",n),children:[y.jsx(LV,{className:"relative h-2 grow rounded-full bg-background",children:y.jsx(VV,{className:"absolute h-full rounded-full bg-primary"})}),s.map((l,c)=>y.jsx(zV,{tooltip:t??!1},`${a.current}-${c}`))]})},HV=E.forwardRef(({children:e,loading:t,container:n,error:r,...o},i)=>{const a=E.useId(),[s,l]=E.useState(o.checked??!1),c=s,u=E.useRef(null),d=gr(o.onChange);E.useImperativeHandle(i,()=>u.current),E.useEffect(()=>{if(u.current!==null&&d.current){const f=g=>{d.current&&d.current(g)},h=u.current;return h.addEventListener("change",f),()=>h==null?void 0:h.removeEventListener("change",f)}},[]);const p=()=>{var h,g;const f=!((h=u.current)!=null&&h.checked);l(f),(g=o==null?void 0:o.onCheck)==null||g.call(o,f),u.current!==null&&(u.current.checked=f,u.current.dispatchEvent(new Event("change",{bubbles:!0})))};return y.jsxs("fieldset",{className:Ie("flex flex-col flex-wrap justify-center",n),"data-component":"switch",disabled:o.disabled||t,children:[y.jsxs("span",{className:"flex flex-row flex-wrap items-center",children:[y.jsx("input",{...o,hidden:!0,ref:u,type:"checkbox",checked:c,id:o.id||a,"data-trigger":"change","data-checked":c,disabled:o.disabled||t,onChange:f=>l(f.target.checked)}),y.jsx("button",{type:"button",role:"switch",onClick:p,"aria-checked":c,"data-checked":c,"aria-labelledby":`${a}-label`,disabled:o.disabled||t,className:"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked=false]:bg-input-switch-bg data-[checked=true]:bg-primary",children:y.jsx("span",{"aria-hidden":"true","data-checked":c,className:"inline-block aspect-square size-5 transform rounded-full shadow ring-0 transition duration-300 ease-in-out data-[checked=false]:translate-x-0 data-[checked=true]:translate-x-5 data-[checked=false]:bg-disabled data-[checked=true]:bg-input-switch"})}),y.jsx("label",{htmlFor:o.id||a,className:"ml-3 inline-block text-sm",id:`${a}-label`,children:y.jsx("span",{className:"font-medium text-foreground",children:e})})]}),y.jsx("span",{className:"mt-1 flex-1 whitespace-nowrap text-xs text-danger empty:mt-0 empty:hidden",children:r})]})}),WV=e=>{const[t,n]=hA();return E.useEffect(()=>{const r=t.current;if(!r)return;const o=i=>{const a=i.target,s=Array.from(r.querySelectorAll("input[data-task=true]")),l=s.every(u=>u.checked),c=s.indexOf(a);l&&c!==-1&&n("input",{scale:[1,1.35,1],rotate:[0,20,-20,0]},{duration:.5,delay:bA(.075,{from:c})})};return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),y.jsx("fieldset",{...e,"data-component":"task-list",ref:t})},qV=_1("textarea","textarea",{container:"w-full"},e=>{const t=()=>{const n=e.value.split(`
241
- `);if(e.style.height="auto",n.length>1)return void(e.style.height=`${e.scrollHeight}px`)};return e.addEventListener("input",t),()=>e.removeEventListener("input",t)}),UV=e=>{const[t,n]=E.useState(0);return E.useEffect(()=>{const r=e.current;if(!r)return;const o=r.parentElement;if(!o)return;const i=()=>{n(o.clientHeight)};return o.addEventListener("resize",i),i(),()=>{o.removeEventListener("resize",i)}},[]),t},KV={Item:E.forwardRef(function(t,n){return y.jsx("li",{...t,ref:n,className:"flex items-center gap-1 justify-between"})}),List:E.forwardRef(function(t,n){return y.jsx("ul",{...t,ref:n,className:"space-y-3"})})},YV=e=>{const t=E.useRef(null),n=UV(t);return y.jsxs("div",{className:"flex flex-row gap-4",ref:t,children:[y.jsxs("div",{className:"py-8 space-y-4 min-w-64 w-fit flex flex-col whitespace-nowrap rounded-lg border border-card-border",children:[y.jsx("header",{className:"border-b border-card-border pb-2"}),y.jsxs("div",{className:"px-8 space-y-2",children:[y.jsx(Pa,{rightLabel:"",title:"Search",placeholder:"Looking for..."}),y.jsx(Pp,{height:n,useWindowScroll:!0,data:e.source,components:KV,itemContent:(r,o)=>y.jsx(E.Fragment,{children:y.jsx(_p,{children:y.jsx(e.Item,{data:o})})})})]})]}),y.jsx("div",{children:y.jsx(tl,{children:y.jsx(_f,{})})}),y.jsx("div",{})]})};var GV=Object.defineProperty,Cy=Object.getOwnPropertySymbols,ZV=Object.prototype.hasOwnProperty,XV=Object.prototype.propertyIsEnumerable,ky=(e,t,n)=>t in e?GV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QV=(e,t)=>{for(var n in t||(t={}))ZV.call(t,n)&&ky(e,n,t[n]);if(Cy)for(var n of Cy(t))XV.call(t,n)&&ky(e,n,t[n]);return e},Dp=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return!0;return!1},JV=(e,t,n,r)=>Ml(Dp,e,t,n,r),Zo=e=>typeof e=="object",hr=(e,t)=>{if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||!Zo(e)&&!Zo(t))return e===t;if(e.prototype!==t.prototype)return!1;const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>hr(e[r],t[r]))},e$=(e,t)=>(Zo(e)||Array.isArray(e))&&t?e[t]:e,t$=e=>(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1,Ls=e=>/[0-9.]+/.test(e),Ry=e=>["string","number"].includes(typeof e),Py=e=>e==null||(e==null?void 0:e.length)===0||e==="",Ay={eq:hr,is:Object.is,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"==":(e,t)=>e==t,"===":(e,t)=>e===t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,includes:(e,t)=>`${e}`.includes(t),notIncludes:(e,t)=>!`${e}`.includes(t),startsWith:(e,t)=>`${e}`.startsWith(t),endsWith:(e,t)=>`${e}`.endsWith(t),like:(e,t)=>new RegExp(`.*${t}.*`,"gi").test(`${e}`),alphabetical:(e,t)=>e.toString().localeCompare(t.toString()),empty:Py,notEmpty:e=>!Py(e),in:(e,t)=>Dp(t,n=>hr(e,n)),notIn:(e,t)=>uS(t,n=>!hr(e,n))},n$=e=>{if(e in Ay)return Ay[e];throw new Error("Linq - Symbol not found")},Oo=(e,t)=>{const n=[],r=e.length;for(let o=0;o<r;o++)t(e[o],o,e)&&n.push(e[o]);return n},Ml=(e,t,n,r,o)=>{if(typeof n=="function")return e(t,n);const i=n$(r);return n&&r&&o!==void 0?e(t,a=>i(a[n],o)):e(t,a=>i(a,o))},r$=(e,t,n,r)=>Ml(Oo,e,t,n,r),uS=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},o$=(e,t,n,r)=>Ml(uS,e,t,n,r),dS=e=>{if(e===null)return null;const t=QV({},e);return Object.keys(t).forEach(n=>t[n]=Zo(e[n])?dS(e[n]):e[n]),Array.isArray(e)&&e.length?(t.length=e.length)&&Array.from(t):Array.isArray(e)?Array.from(e):t},Iy=(e,t)=>{if(Zo(t)){for(let n=0;n<e.length;n++){const r=e[n];if(hr(t,r))return!0}return!1}for(let n=0;n<e.length;n++){const r=e[n];if(hr(t,r))return!0}return!1},i$=(e,t)=>{const n=new Map(e.map(r=>[r[t],r]));return Object.fromEntries(n.entries())},a$=e=>Oo(e,(t,n,r)=>Zo(t)?n===r.findIndex(o=>hr(o,t)):n===r.indexOf(t)),s$=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return e[r]},fS=(e,t)=>{const n=new Map;return e.forEach(r=>{const o=t(r),i=n.get(o)||[];i.push(r),n.set(o,i)}),Object.fromEntries(n.entries())},l$=(e,t)=>fS(e,n=>n[t]),_y=(e,t)=>{const n=[];let r=0;const o=e.length;for(r;r<o;r++){const i=t(e[r],r,e);n.push(i)}return n},c$=(e,t)=>{let n=Number.parseInt(e,10),r=Number.parseInt(t,10);return n>r?[r,n]:[n,r]},u$=(e,t,n=1)=>{const r=[];let o=e.charCodeAt(0);const i=t.charCodeAt(0);for(;o<=i;o+=n)r.push(String.fromCharCode(o));return Ls(e)&&Ls(t)?r.map(a=>Number.parseInt(a)):r},Eu=(e,t,n=1)=>{let r=Math.abs(n);if((e.length>1||t.length>1)&&Ls(e)&&Ls(t)){const o=[],[i,a]=c$(e,t);for(let s=i;s<=a;s+=r)o.push(s);return o}return u$(e,t,r)},d$=(e,t,n=1)=>{if(t===void 0){const[r,o,i]=e.split("..");return i===void 0?Eu(r,o,1):Eu(r,i,Number.parseInt(o,10))}return Ry(e)&&Ry(t)?Eu(`${e}`,`${t}`,n):Array.from({length:e},(r,o)=>o*Math.abs(t))},Cu=(e,t,n)=>{let r=t;const o=n.length;for(let i=0;i<o;i++){const a=n[i];r=e(r,a,i,n)}return r},Oy=e=>{const t=Array.from(e.values());let n=null,r=null,o=t.length;for(n=0;n<o/2;n+=1){r=o-1-n;let i=t[n];t[n]=t[r],t[r]=i}return t},f$=(e,t)=>{if(typeof t=="number")return e.slice(t);let n=e.length;for(let r=0;r<n;r++){const o=e[r];if(t(o,r,e))return e.slice(r)}return e.slice(0)},p$=(e,t,n,r)=>Ml(f$,e,t,n,r),My=(e,t)=>{const n=[...e];return t===void 0?n.sort():typeof t=="function"?n.toSorted(t):n.toSorted(t$(t))},pS=(e=>(e.Asc="asc",e.Desc="desc",e))(pS||{}),m$=e=>(t,n)=>e.reduce((r,o)=>{const i=o.type==="desc"?-1:1,a=o.key,s=t[a]>n[a]?i:t[a]<n[a]?-i:0;return r!==0?r:s},0),h$=(e,t)=>e.sort(m$(t)),g$=(e,t)=>{if(t===void 0)return[...new Set(e).values()];const n=new Set;return Array.isArray(t)?[...new Set(t)]:Oo(e,r=>{const o=t?n.has(r[t]):n.has(t);return t&&(o||n.add(r[t])),!o})},v$=class jd{constructor(t=[]){this.array=t}static Range(...t){return d$(...t)}static New(t){return new jd(t)}Where(t,n,r){return this.array=r$(this.array,t,n,r),this}Some(t,n,r){return JV(this.array,t,n,r)}All(t,n,r){return o$(this.array,t,n,r)}Reverse(){return this.array=Oy(this.array),this}Add(t){return this.array=Array.isArray(t)?this.array.concat(t):this.array.concat([t]),this}Prepend(t){return this.array=Array.isArray(t)?t.concat(this.array):[t].concat(this.array),this}Select(t){return t===void 0?this.array:this.array.map(t)}Take(t,n){return n!==void 0?this.array=this.array.slice(t,Math.max(0,n)):this.array=this.array.slice(t),this}Head(){return this.array[0]}Tail(){return this.Skip(1)}Skip(t,n,r){return this.array=p$(this.array,t,n,r),this}Distinct(){return this.array=a$(this.array),this}First(t){return t===void 0?this.array[0]:s$(this.array,t)||null}Last(t){const n=this.array.length;if(t===void 0)return this.array[n-1];for(let r=n;r!==0;r--)if(t(this.array[r],r,this.array))return this.array[r]}Sum(t){return t===void 0?Cu((n,r)=>n+r,0,this.array):Cu((n,r)=>n+e$(r,t),0,this.array)}Average(t){return this.Sum(t)/this.array.length}GroupBy(t){return l$(this.array,t)}GroupWith(t){return fS(this.array,t)}Except(t){return Oo(this.array,n=>!Iy(t,n))}Intersect(t){return Oo(this.array,n=>Iy(t,n))}OrderBy(t,n){let r;return r=t?My(this.array,t):this.array.toSorted(),this.array=n==="desc"?Oy(r):r,this}Includes(t){return Dp(this.array,n=>hr(n,t))}In(t){const n=t.length;for(let r=0;r<n;r++){const o=t[r];if(this.Includes(o))return!0}return!1}Reduce(t,n){return Cu(t,n??this.array[0],this.array)}Empty(){return this.array.length===0}ToMap(t){return new Map(_y(this.array,n=>[t,n]))}Zip(t,n){return _y(this.array,(r,o)=>n(r,t[o]))}Count(t){return t===void 0?this.array.length:Oo(this.array,t).length}Get(t){return this.array[t]}Clone(){return new jd(dS(this.array))}ToObject(t){return i$(this.array,t)}Sort(t){return Array.isArray(t)?h$(this.array,t):My(this.array,t)}Unique(t){return g$(this.array,t)}},mS=v$,ku={},jy;function y$(){return jy||(jy=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=(m,v)=>{try{Object.keys(m).forEach(v)}catch(x){window.console.log(x)}},n=m=>m==null,r=m=>{const v=typeof m;return v==="string"||v==="number"||v==="boolean"||n(m)},o=(m,v)=>{const x=v.getItem(m);try{return JSON.parse(x)}catch{return x??null}},i=m=>Object.keys(m).reduce((v,x)=>({...v,[x]:o(x,m)}),{}),a=m=>m instanceof Date?m:typeof m=="number"?new Date(new Date*1+m*864e5):m,s="1969-12-31T23:59:59.000Z",l=()=>document.cookie===""?{}:document.cookie.split("; ").map(m=>m.split("=")).reduce((m,v)=>(m[decodeURIComponent(v[0].trim())]=decodeURIComponent(v[1].trim()),m),{}),c=new Set,u=()=>{const m=l();c.forEach(v=>v(m))},d=[{name:"expires",parse:m=>`expires=${a(m.expires??s)}`},{name:"maxAge",parse:m=>m.maxAge?`max-age=${a(m.expires??s)}`:""},{name:"path",parse:m=>`path=${m.path??"/"}`},{name:"sameSite",parse:m=>`samesite=${m.sameSite??"strict"}`},{name:"useSecure",parse:m=>`${m.useSecure??!0?"secure":""}`},{name:"domain",parse:m=>{const v=m.domain??"";return v===""?"":`domain=${m.multiDomain?".":""}${v}`}},{name:"partitioned",parse:m=>m.partitioned?"Partitioned":""}],p={json:l,listener:m=>(c.add(m),()=>c.delete(m)),clearListeners:()=>c.clear(),has:m=>document.cookie.split(";").some(v=>v.trim().startsWith(`${m}=`)),deleteAll:()=>{document.cookie.split(";").forEach(m=>{document.cookie=m.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}),u()},get:m=>{const v=p.json()[m];if(n(v))return null;try{return JSON.parse(decodeURIComponent(v))}catch{return v}},delete:m=>{document.cookie=`${encodeURIComponent(m)}=;expires=${new Date().toUTCString()}`,u()},set:(m,v,x={})=>{const b=r(v)?v:encodeURIComponent(JSON.stringify(v)),S=d.reduce((w,T)=>{const C=T.parse(x);return C===""?w:w.concat(C)},[`${encodeURIComponent(m)}=${b}`]).join(";");document.cookie=S,u()}},f=m=>{const v=new Set,x=b=>{m().removeItem(b);const S=i(m());v.forEach(w=>w(S))};return{delete:x,listener:b=>(v.add(b),()=>v.delete(b)),clearListeners:()=>v.clear(),json:(b=!1)=>b?i(m()):m(),has:b=>{const S=m().getItem(b);return!n(S)},deleteAll:()=>{t(m(),x),v.forEach(b=>b(m()))},get:b=>o(b,m()),set:(b,S)=>{m().setItem(b,JSON.stringify(S)),v.forEach(w=>w(m()))}}},h=f(()=>window.sessionStorage),g=f(()=>window.localStorage);e.Cookie=p,e.LocalStorage=g,e.SessionStorage=h,e.createStorage=f}(ku)),ku}var Hi=y$();const Np=e=>e.headerLabel??e.thead??e.id,Fp=e=>e.map(t=>({value:t.id,label:t.thead??t.headerLabel??t.id}));var Mo=(e=>(e.Boolean="boolean",e.Number="number",e.Select="select",e.Text="text",e))(Mo||{});const Lp=e=>e.type==="number"?e.valueAsNumber:e.value,x$=e=>{let t=[];return e({add:(o,i,a)=>t.push({...a,id:o,thead:i}),remove:o=>t=t.filter(i=>i.id!==o)}),t},b$={},w$=(e,t)=>{if(!Array.isArray(t))return e;const n=new Set(t.map(o=>o.id));if(!e.every(o=>n.has(o.id)))return e;const r=new Map(e.map(o=>[o.id,o]));return t.map((o,i)=>{const a=r.get(o.id);return a===void 0?e[i]:a})},S$=(e,t,n=b$)=>{const r=yr()?null:Hi.LocalStorage.get(`@components/table-${e}`)||null,[o,i]=Lf({name:e,groups:n.groups||(r==null?void 0:r.groups)||[],sorters:n.sorters||(r==null?void 0:r.sorters)||[],filters:n.filters||(r==null?void 0:r.filters)||[],cols:w$(t,r==null?void 0:r.cols)},a=>{const s=l=>{const c=a.state(),u={...c,...l};return yr()||Hi.LocalStorage.set(`@components/table-${c.name}`,u),u};return s(a.state()),{set:l=>s(l)}});return{...o,...i,name:e}},T$=e=>{const t=gr(e),n=E.useRef(null),r=E.useCallback(o=>{t.current(o),o.forEach(i=>{const a=n.current.querySelector(`th[data-colid="${i.id}"]`);a&&(a.style.width="auto")})},[t]);return[n,r]},E$=()=>yr()?void 0:document.querySelector('[data-component="modal-body"]'),Dd=(e,t,n,r={})=>{var c,u;const o=e.id,i=e.type??Mo.Text,a=t[i]??[],s=((c=a.find(d=>d["data-default"]))==null?void 0:c.value)??((u=a[0])==null?void 0:u.value),l=n[s];return{id:li(),operation:l,label:Np(e),name:o,type:i,value:"",...r}},Vp=()=>{const e=Ct(),t=E.useMemo(()=>({contains:{value:"contains",label:e.tableFilterTypeContains,symbol:"includes","data-default":"true"},is:{value:"is",label:e.tableFilterTypeIs,symbol:"is"},isNot:{value:"isNot",label:e.tableFilterTypeIsNot,symbol:"!=="},notContains:{value:"notContains",label:e.tableFilterTypeNotContains,symbol:"notIncludes"},lessThan:{value:"lessThan",label:e.tableFilterTypeLessThan,symbol:"<="},greaterThan:{value:"greaterThan",label:e.tableFilterTypeGreaterThan,symbol:">="},startsWith:{value:"startsWith",label:e.tableFilterTypeStartsWith,symbol:"startsWith"},endsWith:{value:"endsWith",label:e.tableFilterTypeEndsWith,symbol:"endsWith"}}),[e]);return{options:E.useMemo(()=>({[Mo.Text]:[t.is,t.isNot,t.contains,t.notContains,t.startsWith,t.endsWith],[Mo.Boolean]:[t.is,t.isNot],[Mo.Number]:[t.is,t.isNot,t.greaterThan,t.lessThan]}),[e]),operations:t}},C$=e=>{const t=Ct(),n=Vp(),r=()=>{const l=e.cols.at(0);e.set(c=>[...c,Dd(l,n.options,n.operations)])},o=l=>{const c=l.target.dataset.id||"",u=l.target.value;e.set(d=>d.map(p=>{if(c!==p.id)return p;const f=e.cols.find(h=>u===h.id);return Dd(f,n.options,n.operations,{value:""})}))},i=l=>{const c=l.target.dataset.id||"",u=l.target.value;e.set(d=>d.map(p=>p.id===c?{...p,operation:n.operations[u]}:p))},a=l=>{const c=l.currentTarget.dataset.id||"";e.set(u=>u.filter(d=>d.id!==c))},s=l=>{const c=l.target.dataset.id||"",u=Lp(l.target);e.set(d=>d.map(p=>p.id===c?{...p,value:u}:p))};return y.jsx(E.Fragment,{children:y.jsx(hi,{arrow:!0,title:t.tableFilterDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(lI,{size:14}),t.tableFilterLabel," ",e.filters.length===0?"":` (${e.filters.length})`]}),children:y.jsxs("ul",{className:"mt-4 space-y-2",children:[e.filters.map(l=>{const c=n.options[l.type];return y.jsxs("li",{className:"flex flex-nowrap gap-3",children:[y.jsx(Qr,{options:e.options,title:t.tableFilterColumnTitle,placeholder:t.tableFilterColumnPlaceholder,value:l.name,"data-id":l.id,onChange:o}),y.jsx(Qr,{"data-id":l.id,onChange:i,value:l.operation.value,options:c,title:t.tableFilterOperatorTitle,placeholder:t.tableFilterOperatorPlaceholder}),y.jsx(Pa,{"data-id":l.id,onChange:s,title:t.tableFilterValueTitle,placeholder:t.tableFilterValuePlaceholder,type:l.type,value:l.value,optionalText:""}),y.jsx("div",{className:"mt-5 flex items-center justify-center",children:y.jsx("button",{"data-id":l.id,type:"button",onClick:a,children:y.jsx(fl,{className:"text-danger",size:16})})})]},`filter-select-${l.id}`)}),y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1 text-primary",children:[y.jsx(Of,{size:14})," ",t.tableFilterNewFilter]})})]})})})},k$=({filter:e,onDelete:t,set:n})=>{const r=Ct(),o=Vp(),i=s=>{const l=s.target.value,c=s.target.dataset.id||"";n(u=>u.map(d=>d.id===c?{...d,operation:o.operations[l]}:d))},a=s=>{const l=s.target.dataset.id||"",c=Lp(s.target);n(u=>u.map(d=>d.id===l?{...d,value:c}:d))};return y.jsxs("div",{className:"flex flex-nowrap items-center gap-4 py-2",children:[y.jsx(Qr,{"data-id":e.id,onChange:i,value:e.operation.value,options:o.options[e.type],title:r.tableFilterColumnTitle,placeholder:r.tableFilterColumnPlaceholder}),y.jsx(Pa,{optionalText:" ","data-id":e.id,onChange:a,type:e.type,value:e.value,title:r.tableFilterValueTitle,placeholder:r.tableFilterValueTitle}),y.jsx("button",{onClick:t,"data-id":e.id,type:"button",className:"mt-4",children:y.jsx(fl,{className:"text-danger",size:14})})]})},R$=({item:e,onPointerDown:t})=>{const n=dl(0);return y.jsxs(i0,{onPointerDown:t,id:e.groupId,className:"flex flex-row items-center gap-2",value:e,style:{y:n},children:[y.jsx("button",{type:"button",className:"cursor-grab",children:y.jsx(iI,{size:14})}),y.jsx("span",{children:e.groupName})]},e.groupId)},P$=e=>{var l;const t=Ct(),n=Fp(e.cols),r=yA(),[o,i]=E.useState(((l=e.groups[0])==null?void 0:l.thead)||""),a=c=>{var m;const u=c.target,d=u.value,p=u.options.selectedIndex,f=((m=u.options.item(p))==null?void 0:m.label)||"";i(f);const h=new mS(e.rows).GroupBy(d),g=e.cols.find(v=>v.id===d);e.setGroups(vT(h).map((v,x)=>{const b=h[v];return{...g,groupId:li(),groupKey:d,index:x,rows:b,groupName:v}}))},s=()=>e.setGroups([]);return y.jsx(E.Fragment,{children:y.jsxs(hi,{arrow:!1,title:t.tableGroupLabel,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(wI,{size:14}),t.tableGroupLabelWithCount,e.groups.length>0?` - ${o}(${e.groups.length})`:""]}),children:[y.jsxs("div",{className:"flex flex-nowrap items-center",children:[y.jsx(Qr,{value:o,title:"Tipo de agrupamento",onChange:a,options:n,placeholder:"Agrupar por..."}),y.jsx(tl,{className:"mt-4",onClick:s,theme:"raw","data-id":o,children:y.jsx(fl,{size:16,className:"text-danger"})})]}),e.groups.length>0?y.jsxs("section",{className:"my-4",children:[y.jsx("header",{children:y.jsx("h2",{className:"text-xl font-medium",children:"Order groups"})}),y.jsx(PE,{children:y.jsx(o0,{axis:"y",className:"relative space-y-2",drag:!0,dragControls:r,dragListener:!1,layoutScroll:!0,onReorder:e.setGroups,values:e.groups,children:e.groups.map(c=>y.jsx(R$,{item:c,onPointerDown:u=>{r.start(u),e.setGroups([...e.groups])}},c.groupId))})})]}):null]})})},A$=e=>(t,n)=>e.reduce((r,o)=>{const i=o.type==="desc"?-1:1,a=o.value,s=t[a]>n[a]?i:t[a]<n[a]?-i:0;return r!==0?r:s},0),I$=(e,t)=>e.toSorted(A$(t)),hS=(e,t,n)=>({label:t,id:li(),type:n,value:e.id}),_$=e=>{const t=Ct(),n={asc:{label:t.tableSortAsc,value:"asc"},desc:{label:t.tableSortDesc,value:"desc"}},r=[n.asc,n.desc],o=()=>{const l=e.cols[0];l&&e.set(c=>[...c,hS(l,n.asc.label,n.asc.value)])},i=l=>c=>{const u=c.target.value;e.set(d=>d.map(p=>p.id===l?{...p,value:u}:p))},a=l=>c=>{const u=c.target.value;e.set(d=>d.map(p=>p.id===l?{...p,type:u}:p))},s=l=>{const c=l.currentTarget.dataset.id||"";e.set(u=>u.filter(d=>d.id!==c))};return y.jsx(E.Fragment,{children:y.jsx(hi,{title:t.tableSortDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(s0,{size:14}),t.tableSortOrderByLabel," ",e.sorters.length===0?"":` (${e.sorters.length})`]}),children:y.jsxs("ul",{className:"mt-4 space-y-2",children:[e.sorters.map(l=>y.jsxs("li",{className:"flex flex-nowrap gap-3",children:[y.jsx(Qr,{options:e.options,value:l.value,onChange:i(l.id),title:t.tableSortOrderInputTitle,placeholder:t.tableSortOrderInputPlaceholder}),y.jsx(Qr,{onChange:a(l.id),value:l.type,options:r,title:t.tableSortTypeInputTitle,placeholder:t.tableSortTypeInputPlaceholder}),y.jsx("button",{className:"mt-4","data-id":l.id,onClick:s,children:y.jsx(fl,{className:"text-danger",size:14})})]},`sorter-select-${l.id}`)),y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:o,className:"text-primary flex items-center gap-1",children:[y.jsx(Of,{size:14})," ",t.tableSortAddButton]})})]})})})},O$=e=>{const t=Ct(),[n,r]=E.useState(()=>{const s=e.sorters.find(l=>l.value===e.col.id);return s?s.type:"undefined"}),o=()=>r(s=>s==="undefined"?"asc":s==="asc"?"desc":"undefined");E.useEffect(()=>{e.setSorters(s=>{if(n==="undefined")return s.filter(u=>u.value!==e.col.id);const l=s.findIndex(u=>u.value===e.col.id),c=hS(e.col,n,n);return l===-1?[...s,c]:(s[l]=c,[...s])})},[n,e.col]);const i=`${e.col.id}-sorter-id`,a=Np(e.col);return y.jsxs("button",{"aria-labelledby":i,className:"isolate flex items-center",onClick:o,type:"button",children:[y.jsxs("span",{id:i,className:"sr-only",children:[t.tableSortDropdownTitle," ",a]}),n==="asc"?y.jsx(MA,{size:14}):null,n==="desc"?y.jsx(_A,{size:14}):null,n==="undefined"?y.jsx(s0,{size:14}):null]})},M$=e=>y.jsx("header",{className:"min-w-full mb-1",children:y.jsxs("div",{className:"flex flex-wrap min-w-full items-center justify-between gap-x-4 gap-y-1",children:[y.jsxs("div",{className:"flex w-fit items-centeend gap-4 whitespace-nowrap py-2",children:[y.jsx("span",{children:y.jsx(C$,{cols:e.cols,options:e.options,filters:e.filters,set:e.setFilters})}),y.jsx("span",{children:y.jsx(_$,{options:e.options,cols:e.cols,sorters:e.sorters,set:e.setSorters})}),y.jsx("span",{children:y.jsx(P$,{rows:e.rows,groups:e.groups,setGroups:e.setGroups,options:e.options,cols:e.cols})})]}),y.jsx("ul",{className:"flex flex-wrap w-full flex-1 flex-grow flex-row items-center md:justify-end gap-4",children:e.filters.map(t=>y.jsxs("li",{className:"flex gap-1 items-center rounded-xl border border-card-border px-4 py-0.5",children:[y.jsxs("span",{children:[y.jsx("span",{className:"size-3 mr-2 aspect-square bg-primary inline-block rounded-full","aria-hidden":"true"}),t.label," ",t.operation.label.toLowerCase(),":"]}),y.jsxs("div",{className:"relative w-min min-w-[1ch]",children:[y.jsx("span",{"aria-hidden":"true",className:"invisible whitespace-pre p-0",children:t.value||" "}),y.jsx("input",{type:t.type,value:t.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=Lp(n.target);e.setFilters(o=>o.map(i=>t.id===i.id?{...i,value:r}:i))}})]})]},`filter-table-${t.id}`))})]})});function j$(e,t){if(!e||!t)return[];const n=[1];if(e===1&&t===1)return n;e>4&&n.push("-");const r=2,o=e-r,i=e+r;for(let s=o>2?o:2;s<=Math.min(t,i);s++)n.push(s);const a=t-2;return i+1!==a&&i+1<t&&n.push("_"),i<t&&(n.push(t-2),n.push(t-1),n.push(t)),Array.from(new Set(n))}const D$=e=>{const t=E.useId(),n=Ct(),r=E.useMemo(()=>j$(e.current,e.pages),[e.current,e.pages]),o=e.current<e.pages;return y.jsxs("footer",{className:"flex flex-wrap items-center justify-center gap-4 px-1 py-4 lg:flex-nowrap lg:justify-between",children:[y.jsx("p",{children:y.jsx(n.tablePaginationFooter,{...e,sizes:e.sizes,select:e.onChangeSize&&Array.isArray(e.sizes)?y.jsxs(E.Fragment,{children:[y.jsx("label",{htmlFor:t,children:n.tablePaginationSelectLabel}),y.jsx("select",{id:t,value:e.size,className:"cursor-pointer bg-transparent",onChange:i=>{var a;(a=e.onChangeSize)==null||a.call(e,Number(i.target.value))},children:e.sizes.map(i=>y.jsx("option",{value:i,children:i},`pagination-opt-${i}`))})," "]}):null})}),y.jsx("nav",{children:y.jsxs("ul",{className:"flex items-center gap-2",children:[e.current>1?y.jsx("li",{children:y.jsx(un,{as:e.asLink||"button",href:"previous",className:"",children:n.tablePaginationPrevious})}):null,r.map(i=>i===null?null:y.jsx(E.Fragment,{children:typeof i=="string"?y.jsx("li",{children:"..."}):y.jsx("li",{children:y.jsx(un,{href:i,as:e.asLink||"button",className:`cursor-pointer border-b-2 px-3 py-1 proportional-nums transition-colors hover:border-primary-subtle hover:text-primary-subtle ${i===e.current?"border-primary text-primary":"border-transparent"}`,children:i})})},`pagination-${i}`)),o?y.jsx("li",{children:y.jsx(un,{as:e.asLink||"button",href:"next",className:"",children:n.tablePaginationNext})}):null]})})]})},N$=e=>{const t=E.useRef(null),n=E.useRef(null),[r,o]=E.useState("opacity-0"),i=r==="opacity-0",a=()=>o("opacity-0"),s=()=>{const c=n.current,u=t.current;c===null||u===null||(u.style.left=`-${c.getBoundingClientRect().width+4}px`)},l=()=>o("opacity-100");return E.useEffect(()=>{const c=n.current;if(c===null||parent===null)return;s();const u=new IntersectionObserver(d=>d.forEach(s),{root:document.documentElement});return u.observe(c),()=>u.disconnect()},[]),y.jsx("div",{ref:t,onMouseEnter:l,onMouseLeave:a,"data-component":"cell-aside",tabIndex:i?-1:void 0,className:`group-table-cell-aside absolute inset-0 top-0 flex h-full w-full min-w-8 max-w-20 items-stretch transition-opacity duration-300 ease-in-out ${r}`,children:y.jsx("div",{ref:n,className:"isolate block h-full w-auto",children:e.children})})},F$=(e,t,n)=>{const r=n.cols,o=n.loading;return y.jsx(E.Fragment,{children:r.map((i,a)=>{var f;const s=`${a},${e}`,l=zf(t,i.id),c=i.Element,u=((f=i.cellProps)==null?void 0:f.className)||"",d=a===0&&n.Aside&&o===!1,p=n.Aside;return E.createElement("td",{...i.cellProps,role:"cell","data-matrix":s,key:`accessor-${e}-${a}`,className:`group-table-cell py-2 sm:py-2 flex flex-col md:table-cell md:h-14 md:border-l md:border-table-border px-2 first:border-transparent ${u}`},d?y.jsx(N$,{children:y.jsx(p,{col:i,row:t,rowIndex:e})}):null,y.jsx("span",{className:"block md:hidden text-sm font-bold leading-tight",children:i.thead}),y.jsx("span",{className:"relative",children:o?cp:c?y.jsx(E.Fragment,{children:y.jsx(c,{row:t,matrix:s,col:i,rowIndex:e,value:l})}):y.jsx(E.Fragment,{children:Ve.nil(l)?"":l})}))})})},L$={top:0,left:0,right:0,bottom:-1},V$=e=>{var g;const t=Ip(),n=Ct(),r=e.filters.filter(m=>m.name===e.header.id),o=r.length>0,i=e.header.allowSort??t.table.sorters??!0,a=e.header.allowFilter??t.table.filters??!0,s=Vp(),l=o?pI:hI,c=E.useRef(null),u=m=>{const v=m.currentTarget.dataset.id||"";return e.setFilters(x=>x.filter(b=>b.id!==v))},d=E.useCallback(m=>{if(m===null)return;c.current=m;const v=new AbortController;return m.addEventListener("pointerdown",x=>{if(x.target.dataset.type==="resizer")return x.stopPropagation(),x.stopImmediatePropagation()},{signal:v.signal}),()=>v.abort()},[]),p=e.sorters.find(m=>e.header.id===m.value),f=p!=null&&p.type?p.type===pS.Asc?"ascending":"descending":"none",h=Np(e.header);return y.jsxs(i0,{...e.header.thProps,as:"th",ref:d,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,role:"columnheader","aria-sort":f,value:e.header,"aria-busy":e.loading,"data-colid":e.header.id,whileDrag:{cursor:"grabbing"},className:`relative min-w-0 cursor-grab font-medium ${((g=e.header.thProps)==null?void 0:g.className)??""}`,children:[y.jsx("span",{className:`flex h-full items-center justify-between bg-table-header px-2 py-4 ${e.isLast?"rounded-tr-lg":""} ${e.index===0?"rounded-tl-lg":""}`,children:y.jsxs("span",{className:"flex items-center gap-1",children:[e.inlineFilter&&a?y.jsx(hi,{arrow:!0,trigger:y.jsxs("span",{children:[y.jsxs("span",{id:`${e.header.id}-filter-dropdown-button`,className:"sr-only",children:[n.tableFilterDropdownTitleUnique," ",h]}),y.jsx(l,{"aria-labelledby":`${e.header.id}-filter-dropdown-button`,size:14})]}),title:y.jsxs("span",{className:"text-lg",children:[n.tableFilterDropdownTitleUnique," ",y.jsx("span",{className:"font-medium",children:h})]}),children:y.jsxs("ul",{className:"font-medium",children:[r.length===0?null:y.jsx(E.Fragment,{children:r.map(m=>y.jsx("li",{className:"my-1",children:y.jsx(k$,{onDelete:u,filter:m,set:e.setFilters})},`thead-filter-${m.id}`))}),y.jsx("li",{children:y.jsxs("button",{type:"button",className:"flex items-center gap-1 text-primary",onClick:()=>e.setFilters(m=>m.concat(Dd(e.header,s.options,s.operations))),children:[y.jsx(Of,{size:14})," ",n.tableFilterNewFilter]})})]})}):null,y.jsx("span",{className:"pointer-events-auto text-balance text-base",children:e.header.thead}),e.inlineSorter&&i?y.jsx(O$,{col:e.header,setSorters:e.setSorters,sorters:e.sorters}):null]})}),e.isLast?null:y.jsx(pt.button,{drag:"x",draggable:!0,dragListener:!0,dragMomentum:!0,type:"button",animate:!1,dragElastic:0,dragPropagation:!0,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,"data-type":"resizer",title:e.header.id,dragConstraints:L$,className:"absolute -right-[0.5px] top-0 z-calendar block h-full w-[1px] cursor-col-resize bg-table-border hover:w-1.5 hover:bg-primary active:w-1.5 active:bg-primary",onClick:m=>void m.currentTarget.focus(),onKeyDown:m=>{if(m.key==="ArrowLeft"||m.key==="ArrowRight"){if(c.current===null)return;c.current.setAttribute("data-resized","true");const v=c.current.getBoundingClientRect().width,b=(m.shiftKey?50:10)*(m.key==="ArrowLeft"?-1:1);c.current.style.width=`${Math.abs(v+b)}px`}},onDoubleClick:()=>{c.current!==null&&(c.current.style.width="auto")},onDrag:(m,v)=>{if(c.current===null)return;c.current.setAttribute("data-resized","true");const x=c.current.getBoundingClientRect().width,b=v.delta.x;c.current.style.width=`${Math.abs(x+b)}px`}})]})},$$=e=>{const[t,n]=T$(e.setCols);return y.jsx(o0,{layout:!0,as:"tr",axis:"x",drag:"x",layoutRoot:!0,role:"row",layoutScroll:!0,ref:t,onReorder:n,values:e.headers,children:y.jsx(Er,{children:e.headers.map((r,o)=>y.jsx(V$,{index:o,header:r,filters:e.filters,loading:e.loading,sorters:e.sorters,setFilters:e.setFilters,setSorters:e.setSorters,inlineFilter:e.inlineFilter,inlineSorter:e.inlineSorter,isLast:o===e.headers.length-1},`header-child-item-${r.id}`))})})},gS=E.createContext({}),z$=()=>E.useContext(gS),B$=E.forwardRef(({context:e,className:t="",...n},r)=>y.jsx("tbody",{...n,role:"rowgroup",className:`divide-y divide-table-border ${t}`,ref:r,children:y.jsx(Er,{children:n.children})})),H$=E.forwardRef(({context:e,className:t="",...n},r)=>y.jsx("table",{...n,ref:r,role:"table",className:`table min-w-full table-fixed border-separate text-left ${t??""}`})),W$=E.forwardRef(({context:e,...t},n)=>{const r=z$(),o={...t==null?void 0:t.style,top:Ve.number(r.sticky)?`${r.sticky}px`:void 0};return y.jsx("thead",{...t,style:o,role:"rowgroup",className:"hidden top-0 bg-transparent md:table-header-group shadow-shadow-card group:sticky",ref:n})}),q$=E.forwardRef(({context:e,item:t,...n},r)=>y.jsx("tr",{...n,role:"row",ref:r,className:`group-table-row flex h-fit flex-col flex-wrap justify-center gap-1 md:table-row ${(n==null?void 0:n.className)??""}`})),U$=E.forwardRef((e,t)=>e.context.loadingMore?y.jsx("tfoot",{...e,ref:t,className:"bg-card-background",children:y.jsx("tr",{role:"row",className:"bg-card-background",children:y.jsx("td",{colSpan:999,className:"px-2 h-14 bg-card-background",children:y.jsx("span",{className:"block w-full h-2 rounded opacity-60 animate-pulse bg-foreground"})})})}):null),K$={TableHead:W$,Table:H$,TableBody:B$,TableRow:q$,TableFoot:U$},Y$=[0,0,0,0,0,0,0,0,0,0],G$=e=>y.jsx("div",{className:"flex justify-center items-center px-2 w-full h-48",children:e.loading?cp:y.jsx(H0,{})}),Z$=()=>y.jsx(E.Fragment,{}),X$=()=>y.jsx(E.Fragment,{}),Q$=[],Dy=({cols:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,onScrollEnd:a,getScrollRef:s,border:l=!1,pagination:c=null,useControl:u=!1,...d})=>{const p=E.useRef(null),[f,h]=E.useState(!1),g=gr(a),m=gr(d.loadingMore),v=E.useMemo(()=>{if(d.loading)return Y$;if(u)return d.rows;const S=new mS(d.rows);return t.length>0&&t.forEach(w=>w.value===""||Number.isNaN(w.value)?void 0:S.Where(w.name,w.operation.symbol,w.value)),r.length===0?S.Select():I$(S.Select(),r)},[d.loading,d.rows,u,t,r]);E.useEffect(()=>{if(p.current===null)return()=>{};const S=p.current,w=new IntersectionObserver(T=>{var I;return T[T.length-1].isIntersecting&&m.current?((I=g.current)==null||I.call(g),void h(!0)):h(!1)});return w.observe(S),()=>w.disconnect()},[m,g]);const x=v.length===0,b={loading:d.loading,loadingMore:d.loadingMore,cols:e,Aside:d.Aside};return y.jsxs("div",{className:"min-w-full",children:[y.jsxs("div",{className:`group w-full relative rounded-lg ${l?"border border-table-border":""}`,children:[y.jsx(dF,{disabled:!0,context:b,components:K$,useWindowScroll:!1,totalCount:v.length,style:{height:"100%"},itemContent:x?Z$:F$,data:x?Q$:v,fixedFooterContent:f?X$:null,customScrollParent:s?s():void 0,fixedHeaderContent:()=>y.jsx($$,{headers:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,loading:!!d.loading,inlineFilter:d.inlineFilter,inlineSorter:d.inlineSorter})}),x?y.jsx(G$,{loading:d.loading}):null,y.jsx("div",{"aria-hidden":"true",ref:p,className:"w-full h-0.5"})]}),c!==null?y.jsx(D$,{...c}):null]})},J$=(e,t)=>typeof t=="function"?t(e):t,Ja=(e,t,n)=>e===t||n==null?void 0:n(t),ez=e=>{const t=Ip(),n=E.useMemo(()=>({sticky:e.sticky===void 0?t.table.sticky??void 0:e.sticky??void 0}),[e.sticky,t.table.sticky]),r=e.operations??t.table.operations??!0,o=E.useMemo(()=>Fp(e.cols),[e.cols]),[i,a]=Lf({cols:e.cols,sorters:e.sorters??[],groups:e.groups??[],filters:e.filters??[]},s=>{const l=c=>u=>{const d=s.state();return{...d,[c]:J$(d[c],u)}};return{cols:l("cols"),sorters:l("sorters"),groups:l("groups"),filters:l("filters")}},{postMiddleware:[(s,l)=>{var c;return(c=e.set)==null||c.call(e,s),Ja((l==null?void 0:l.filters)??[],s.filters??[],e.setFilters),Ja((l==null?void 0:l.sorters)??[],s.sorters??[],e.setSorters),Ja((l==null?void 0:l.groups)??[],s.groups??[],e.setGroups),Ja((l==null?void 0:l.cols)??[],s.cols??[],e.setCols),s}]});return y.jsxs(gS.Provider,{value:n,children:[r?y.jsx(M$,{cols:i.cols,rows:e.rows,options:o,groups:i.groups,filters:i.filters,setCols:a.cols,sorters:i.sorters,setGroups:a.groups,setFilters:a.filters,setSorters:a.sorters,pagination:e.pagination??null,inlineFilter:e.inlineFilter??!0,inlineSorter:e.inlineSorter??!0}):null,i.groups.length===0?y.jsx(Dy,{...e,index:0,cols:i.cols,options:o,groups:i.groups,filters:i.filters,optionCols:o,setCols:a.cols,sorters:i.sorters,setGroups:a.groups,setFilters:a.filters,setSorters:a.sorters,onScrollEnd:e.onScrollEnd,pagination:e.pagination??null,inlineFilter:e.inlineFilter??!0,inlineSorter:e.inlineSorter??!0}):y.jsx("div",{className:"flex flex-wrap gap-4",children:i.groups.map((s,l)=>y.jsx("div",{className:"min-w-full",children:y.jsx(Dy,{...e,group:s,index:l,cols:i.cols,pagination:null,rows:s.rows,options:o,groups:i.groups,filters:i.filters,optionCols:o,setCols:a.cols,sorters:i.sorters,setGroups:a.groups,setFilters:a.filters,setSorters:a.sorters,onScrollEnd:e.onScrollEnd,inlineFilter:e.inlineFilter??!0,inlineSorter:e.inlineSorter??!0})},`group-${s.groupId}`))})]})},tz=["INPUT","SELECT"],vS=e=>{if(!e)return;Array.from(e.elements).forEach(n=>{tz.includes(n.tagName)&&(n.tagName==="INPUT"&&(n.value=n.defaultValue),n.tagName==="SELECT"&&(n.value=""),n.setAttribute("data-initialized","false"))})};var Ru,Ny;function $p(){if(Ny)return Ru;Ny=1;var e=String.prototype.replace,t=/%20/g,n={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Ru={default:n.RFC3986,formatters:{RFC1738:function(r){return e.call(r,t,"+")},RFC3986:function(r){return String(r)}},RFC1738:n.RFC1738,RFC3986:n.RFC3986},Ru}var Pu,Fy;function yS(){if(Fy)return Pu;Fy=1;var e=$p(),t=Object.prototype.hasOwnProperty,n=Array.isArray,r=function(){for(var m=[],v=0;v<256;++v)m.push("%"+((v<16?"0":"")+v.toString(16)).toUpperCase());return m}(),o=function(v){for(;v.length>1;){var x=v.pop(),b=x.obj[x.prop];if(n(b)){for(var S=[],w=0;w<b.length;++w)typeof b[w]<"u"&&S.push(b[w]);x.obj[x.prop]=S}}},i=function(v,x){for(var b=x&&x.plainObjects?{__proto__:null}:{},S=0;S<v.length;++S)typeof v[S]<"u"&&(b[S]=v[S]);return b},a=function m(v,x,b){if(!x)return v;if(typeof x!="object"&&typeof x!="function"){if(n(v))v.push(x);else if(v&&typeof v=="object")(b&&(b.plainObjects||b.allowPrototypes)||!t.call(Object.prototype,x))&&(v[x]=!0);else return[v,x];return v}if(!v||typeof v!="object")return[v].concat(x);var S=v;return n(v)&&!n(x)&&(S=i(v,b)),n(v)&&n(x)?(x.forEach(function(w,T){if(t.call(v,T)){var C=v[T];C&&typeof C=="object"&&w&&typeof w=="object"?v[T]=m(C,w,b):v.push(w)}else v[T]=w}),v):Object.keys(x).reduce(function(w,T){var C=x[T];return t.call(w,T)?w[T]=m(w[T],C,b):w[T]=C,w},S)},s=function(v,x){return Object.keys(x).reduce(function(b,S){return b[S]=x[S],b},v)},l=function(m,v,x){var b=m.replace(/\+/g," ");if(x==="iso-8859-1")return b.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(b)}catch{return b}},c=1024,u=function(v,x,b,S,w){if(v.length===0)return v;var T=v;if(typeof v=="symbol"?T=Symbol.prototype.toString.call(v):typeof v!="string"&&(T=String(v)),b==="iso-8859-1")return escape(T).replace(/%u[0-9a-f]{4}/gi,function(L){return"%26%23"+parseInt(L.slice(2),16)+"%3B"});for(var C="",R=0;R<T.length;R+=c){for(var I=T.length>=c?T.slice(R,R+c):T,P=[],N=0;N<I.length;++N){var j=I.charCodeAt(N);if(j===45||j===46||j===95||j===126||j>=48&&j<=57||j>=65&&j<=90||j>=97&&j<=122||w===e.RFC1738&&(j===40||j===41)){P[P.length]=I.charAt(N);continue}if(j<128){P[P.length]=r[j];continue}if(j<2048){P[P.length]=r[192|j>>6]+r[128|j&63];continue}if(j<55296||j>=57344){P[P.length]=r[224|j>>12]+r[128|j>>6&63]+r[128|j&63];continue}N+=1,j=65536+((j&1023)<<10|I.charCodeAt(N)&1023),P[P.length]=r[240|j>>18]+r[128|j>>12&63]+r[128|j>>6&63]+r[128|j&63]}C+=P.join("")}return C},d=function(v){for(var x=[{obj:{o:v},prop:"o"}],b=[],S=0;S<x.length;++S)for(var w=x[S],T=w.obj[w.prop],C=Object.keys(T),R=0;R<C.length;++R){var I=C[R],P=T[I];typeof P=="object"&&P!==null&&b.indexOf(P)===-1&&(x.push({obj:T,prop:I}),b.push(P))}return o(x),v},p=function(v){return Object.prototype.toString.call(v)==="[object RegExp]"},f=function(v){return!v||typeof v!="object"?!1:!!(v.constructor&&v.constructor.isBuffer&&v.constructor.isBuffer(v))},h=function(v,x){return[].concat(v,x)},g=function(v,x){if(n(v)){for(var b=[],S=0;S<v.length;S+=1)b.push(x(v[S]));return b}return x(v)};return Pu={arrayToObject:i,assign:s,combine:h,compact:d,decode:l,encode:u,isBuffer:f,isRegExp:p,maybeMap:g,merge:a},Pu}var Au,Ly;function nz(){if(Ly)return Au;Ly=1;var e=fT(),t=yS(),n=$p(),r=Object.prototype.hasOwnProperty,o={brackets:function(m){return m+"[]"},comma:"comma",indices:function(m,v){return m+"["+v+"]"},repeat:function(m){return m}},i=Array.isArray,a=Array.prototype.push,s=function(g,m){a.apply(g,i(m)?m:[m])},l=Date.prototype.toISOString,c=n.default,u={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:t.encode,encodeValuesOnly:!1,filter:void 0,format:c,formatter:n.formatters[c],indices:!1,serializeDate:function(m){return l.call(m)},skipNulls:!1,strictNullHandling:!1},d=function(m){return typeof m=="string"||typeof m=="number"||typeof m=="boolean"||typeof m=="symbol"||typeof m=="bigint"},p={},f=function g(m,v,x,b,S,w,T,C,R,I,P,N,j,L,A,O,M,F){for(var D=m,H=F,_=0,z=!1;(H=H.get(p))!==void 0&&!z;){var X=H.get(m);if(_+=1,typeof X<"u"){if(X===_)throw new RangeError("Cyclic object value");z=!0}typeof H.get(p)>"u"&&(_=0)}if(typeof I=="function"?D=I(v,D):D instanceof Date?D=j(D):x==="comma"&&i(D)&&(D=t.maybeMap(D,function(Re){return Re instanceof Date?j(Re):Re})),D===null){if(w)return R&&!O?R(v,u.encoder,M,"key",L):v;D=""}if(d(D)||t.isBuffer(D)){if(R){var Q=O?v:R(v,u.encoder,M,"key",L);return[A(Q)+"="+A(R(D,u.encoder,M,"value",L))]}return[A(v)+"="+A(String(D))]}var J=[];if(typeof D>"u")return J;var G;if(x==="comma"&&i(D))O&&R&&(D=t.maybeMap(D,R)),G=[{value:D.length>0?D.join(",")||null:void 0}];else if(i(I))G=I;else{var Y=Object.keys(D);G=P?Y.sort(P):Y}var Z=C?String(v).replace(/\./g,"%2E"):String(v),V=b&&i(D)&&D.length===1?Z+"[]":Z;if(S&&i(D)&&D.length===0)return V+"[]";for(var $=0;$<G.length;++$){var K=G[$],ie=typeof K=="object"&&K&&typeof K.value<"u"?K.value:D[K];if(!(T&&ie===null)){var B=N&&C?String(K).replace(/\./g,"%2E"):String(K),ye=i(D)?typeof x=="function"?x(V,B):V:V+(N?"."+B:"["+B+"]");F.set(m,_);var Te=e();Te.set(p,F),s(J,g(ie,ye,x,b,S,w,T,C,x==="comma"&&O&&i(D)?null:R,I,P,N,j,L,A,O,M,Te))}}return J},h=function(m){if(!m)return u;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.encodeDotInKeys<"u"&&typeof m.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(m.encoder!==null&&typeof m.encoder<"u"&&typeof m.encoder!="function")throw new TypeError("Encoder has to be a function.");var v=m.charset||u.charset;if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var x=n.default;if(typeof m.format<"u"){if(!r.call(n.formatters,m.format))throw new TypeError("Unknown format option provided.");x=m.format}var b=n.formatters[x],S=u.filter;(typeof m.filter=="function"||i(m.filter))&&(S=m.filter);var w;if(m.arrayFormat in o?w=m.arrayFormat:"indices"in m?w=m.indices?"indices":"repeat":w=u.arrayFormat,"commaRoundTrip"in m&&typeof m.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var T=typeof m.allowDots>"u"?m.encodeDotInKeys===!0?!0:u.allowDots:!!m.allowDots;return{addQueryPrefix:typeof m.addQueryPrefix=="boolean"?m.addQueryPrefix:u.addQueryPrefix,allowDots:T,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:u.allowEmptyArrays,arrayFormat:w,charset:v,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:u.charsetSentinel,commaRoundTrip:!!m.commaRoundTrip,delimiter:typeof m.delimiter>"u"?u.delimiter:m.delimiter,encode:typeof m.encode=="boolean"?m.encode:u.encode,encodeDotInKeys:typeof m.encodeDotInKeys=="boolean"?m.encodeDotInKeys:u.encodeDotInKeys,encoder:typeof m.encoder=="function"?m.encoder:u.encoder,encodeValuesOnly:typeof m.encodeValuesOnly=="boolean"?m.encodeValuesOnly:u.encodeValuesOnly,filter:S,format:x,formatter:b,serializeDate:typeof m.serializeDate=="function"?m.serializeDate:u.serializeDate,skipNulls:typeof m.skipNulls=="boolean"?m.skipNulls:u.skipNulls,sort:typeof m.sort=="function"?m.sort:null,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:u.strictNullHandling}};return Au=function(g,m){var v=g,x=h(m),b,S;typeof x.filter=="function"?(S=x.filter,v=S("",v)):i(x.filter)&&(S=x.filter,b=S);var w=[];if(typeof v!="object"||v===null)return"";var T=o[x.arrayFormat],C=T==="comma"&&x.commaRoundTrip;b||(b=Object.keys(v)),x.sort&&b.sort(x.sort);for(var R=e(),I=0;I<b.length;++I){var P=b[I],N=v[P];x.skipNulls&&N===null||s(w,f(N,P,T,C,x.allowEmptyArrays,x.strictNullHandling,x.skipNulls,x.encodeDotInKeys,x.encode?x.encoder:null,x.filter,x.sort,x.allowDots,x.serializeDate,x.format,x.formatter,x.encodeValuesOnly,x.charset,R))}var j=w.join(x.delimiter),L=x.addQueryPrefix===!0?"?":"";return x.charsetSentinel&&(x.charset==="iso-8859-1"?L+="utf8=%26%2310003%3B&":L+="utf8=%E2%9C%93&"),j.length>0?L+j:""},Au}var Iu,Vy;function rz(){if(Vy)return Iu;Vy=1;var e=yS(),t=Object.prototype.hasOwnProperty,n=Array.isArray,r={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:e.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(p){return p.replace(/&#(\d+);/g,function(f,h){return String.fromCharCode(parseInt(h,10))})},i=function(p,f,h){if(p&&typeof p=="string"&&f.comma&&p.indexOf(",")>-1)return p.split(",");if(f.throwOnLimitExceeded&&h>=f.arrayLimit)throw new RangeError("Array limit exceeded. Only "+f.arrayLimit+" element"+(f.arrayLimit===1?"":"s")+" allowed in an array.");return p},a="utf8=%26%2310003%3B",s="utf8=%E2%9C%93",l=function(f,h){var g={__proto__:null},m=h.ignoreQueryPrefix?f.replace(/^\?/,""):f;m=m.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var v=h.parameterLimit===1/0?void 0:h.parameterLimit,x=m.split(h.delimiter,h.throwOnLimitExceeded?v+1:v);if(h.throwOnLimitExceeded&&x.length>v)throw new RangeError("Parameter limit exceeded. Only "+v+" parameter"+(v===1?"":"s")+" allowed.");var b=-1,S,w=h.charset;if(h.charsetSentinel)for(S=0;S<x.length;++S)x[S].indexOf("utf8=")===0&&(x[S]===s?w="utf-8":x[S]===a&&(w="iso-8859-1"),b=S,S=x.length);for(S=0;S<x.length;++S)if(S!==b){var T=x[S],C=T.indexOf("]="),R=C===-1?T.indexOf("="):C+1,I,P;R===-1?(I=h.decoder(T,r.decoder,w,"key"),P=h.strictNullHandling?null:""):(I=h.decoder(T.slice(0,R),r.decoder,w,"key"),P=e.maybeMap(i(T.slice(R+1),h,n(g[I])?g[I].length:0),function(j){return h.decoder(j,r.decoder,w,"value")})),P&&h.interpretNumericEntities&&w==="iso-8859-1"&&(P=o(String(P))),T.indexOf("[]=")>-1&&(P=n(P)?[P]:P);var N=t.call(g,I);N&&h.duplicates==="combine"?g[I]=e.combine(g[I],P):(!N||h.duplicates==="last")&&(g[I]=P)}return g},c=function(p,f,h,g){var m=0;if(p.length>0&&p[p.length-1]==="[]"){var v=p.slice(0,-1).join("");m=Array.isArray(f)&&f[v]?f[v].length:0}for(var x=g?f:i(f,h,m),b=p.length-1;b>=0;--b){var S,w=p[b];if(w==="[]"&&h.parseArrays)S=h.allowEmptyArrays&&(x===""||h.strictNullHandling&&x===null)?[]:e.combine([],x);else{S=h.plainObjects?{__proto__:null}:{};var T=w.charAt(0)==="["&&w.charAt(w.length-1)==="]"?w.slice(1,-1):w,C=h.decodeDotInKeys?T.replace(/%2E/g,"."):T,R=parseInt(C,10);!h.parseArrays&&C===""?S={0:x}:!isNaN(R)&&w!==C&&String(R)===C&&R>=0&&h.parseArrays&&R<=h.arrayLimit?(S=[],S[R]=x):C!=="__proto__"&&(S[C]=x)}x=S}return x},u=function(f,h,g,m){if(f){var v=g.allowDots?f.replace(/\.([^.[]+)/g,"[$1]"):f,x=/(\[[^[\]]*])/,b=/(\[[^[\]]*])/g,S=g.depth>0&&x.exec(v),w=S?v.slice(0,S.index):v,T=[];if(w){if(!g.plainObjects&&t.call(Object.prototype,w)&&!g.allowPrototypes)return;T.push(w)}for(var C=0;g.depth>0&&(S=b.exec(v))!==null&&C<g.depth;){if(C+=1,!g.plainObjects&&t.call(Object.prototype,S[1].slice(1,-1))&&!g.allowPrototypes)return;T.push(S[1])}if(S){if(g.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+g.depth+" and strictDepth is true");T.push("["+v.slice(S.index)+"]")}return c(T,h,g,m)}},d=function(f){if(!f)return r;if(typeof f.allowEmptyArrays<"u"&&typeof f.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof f.decodeDotInKeys<"u"&&typeof f.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(f.decoder!==null&&typeof f.decoder<"u"&&typeof f.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof f.charset<"u"&&f.charset!=="utf-8"&&f.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof f.throwOnLimitExceeded<"u"&&typeof f.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var h=typeof f.charset>"u"?r.charset:f.charset,g=typeof f.duplicates>"u"?r.duplicates:f.duplicates;if(g!=="combine"&&g!=="first"&&g!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var m=typeof f.allowDots>"u"?f.decodeDotInKeys===!0?!0:r.allowDots:!!f.allowDots;return{allowDots:m,allowEmptyArrays:typeof f.allowEmptyArrays=="boolean"?!!f.allowEmptyArrays:r.allowEmptyArrays,allowPrototypes:typeof f.allowPrototypes=="boolean"?f.allowPrototypes:r.allowPrototypes,allowSparse:typeof f.allowSparse=="boolean"?f.allowSparse:r.allowSparse,arrayLimit:typeof f.arrayLimit=="number"?f.arrayLimit:r.arrayLimit,charset:h,charsetSentinel:typeof f.charsetSentinel=="boolean"?f.charsetSentinel:r.charsetSentinel,comma:typeof f.comma=="boolean"?f.comma:r.comma,decodeDotInKeys:typeof f.decodeDotInKeys=="boolean"?f.decodeDotInKeys:r.decodeDotInKeys,decoder:typeof f.decoder=="function"?f.decoder:r.decoder,delimiter:typeof f.delimiter=="string"||e.isRegExp(f.delimiter)?f.delimiter:r.delimiter,depth:typeof f.depth=="number"||f.depth===!1?+f.depth:r.depth,duplicates:g,ignoreQueryPrefix:f.ignoreQueryPrefix===!0,interpretNumericEntities:typeof f.interpretNumericEntities=="boolean"?f.interpretNumericEntities:r.interpretNumericEntities,parameterLimit:typeof f.parameterLimit=="number"?f.parameterLimit:r.parameterLimit,parseArrays:f.parseArrays!==!1,plainObjects:typeof f.plainObjects=="boolean"?f.plainObjects:r.plainObjects,strictDepth:typeof f.strictDepth=="boolean"?!!f.strictDepth:r.strictDepth,strictNullHandling:typeof f.strictNullHandling=="boolean"?f.strictNullHandling:r.strictNullHandling,throwOnLimitExceeded:typeof f.throwOnLimitExceeded=="boolean"?f.throwOnLimitExceeded:!1}};return Iu=function(p,f){var h=d(f);if(p===""||p===null||typeof p>"u")return h.plainObjects?{__proto__:null}:{};for(var g=typeof p=="string"?l(p,h):p,m=h.plainObjects?{__proto__:null}:{},v=Object.keys(g),x=0;x<v.length;++x){var b=v[x],S=u(b,g[b],h,typeof p=="string");m=e.merge(m,S,h)}return h.allowSparse===!0?m:e.compact(m)},Iu}var _u,$y;function oz(){if($y)return _u;$y=1;var e=nz(),t=rz(),n=$p();return _u={formats:n,parse:t,stringify:e},_u}var iz=oz(),qe;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const a of o)i[a]=a;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(const s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(const a of o)if(i(a))return a},e.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(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(qe||(qe={}));var zy;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(zy||(zy={}));const fe=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dr=e=>{switch(typeof e){case"undefined":return fe.undefined;case"string":return fe.string;case"number":return isNaN(e)?fe.nan:fe.number;case"boolean":return fe.boolean;case"function":return fe.function;case"bigint":return fe.bigint;case"symbol":return fe.symbol;case"object":return Array.isArray(e)?fe.array:e===null?fe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?fe.promise:typeof Map<"u"&&e instanceof Map?fe.map:typeof Set<"u"&&e instanceof Set?fe.set:typeof Date<"u"&&e instanceof Date?fe.date:fe.object;default:return fe.unknown}},re=qe.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 dn extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(a))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof dn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=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(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}dn.create=e=>new dn(e);const ua=(e,t)=>{let n;switch(e.code){case re.invalid_type:e.received===fe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case re.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,qe.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:n=`Unrecognized key(s) in object: ${qe.joinValues(e.keys,", ")}`;break;case re.invalid_union:n="Invalid input";break;case re.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${qe.joinValues(e.options)}`;break;case re.invalid_enum_value:n=`Invalid enum value. Expected ${qe.joinValues(e.options)}, received '${e.received}'`;break;case re.invalid_arguments:n="Invalid function arguments";break;case re.invalid_return_type:n="Invalid function return type";break;case re.invalid_date:n="Invalid date";break;case re.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:qe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case re.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case re.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case re.custom:n="Invalid input";break;case re.invalid_intersection_types:n="Intersection results could not be merged";break;case re.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case re.not_finite:n="Number must be finite";break;default:n=t.defaultError,qe.assertNever(e)}return{message:n}};let az=ua;function Nd(){return az}const Fd=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function ce(e,t){const n=Nd(),r=Fd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ua?void 0:ua].filter(o=>!!o)});e.common.issues.push(r)}class Ht{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return ke;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,a=await o.value;r.push({key:i,value:a})}return Ht.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return ke;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(r[i.value]=a.value)}return{status:t.value,value:r}}}const ke=Object.freeze({status:"aborted"}),Pi=e=>({status:"dirty",value:e}),Yt=e=>({status:"valid",value:e}),By=e=>e.status==="aborted",Hy=e=>e.status==="dirty",Xo=e=>e.status==="valid",Vs=e=>typeof Promise<"u"&&e instanceof Promise;function $s(e,t,n,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function xS(e,t,n,r,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var ve;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ve||(ve={}));var Ai,Ii;class $n{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,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 Wy=(e,t)=>{if(Xo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new dn(e.common.issues);return this._error=n,this._error}}};function _e(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{var l,c;const{message:u}=e;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:s.defaultError}},description:o}}class Fe{get description(){return this._def.description}_getType(t){return dr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:dr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ht,ctx:{common:t.parent.common,data:t.data,parsedType:dr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Vs(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,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:t,parsedType:dr(t)},i=this._parseSync({data:t,path:o.path,parent:o});return Wy(o,i)}"~validate"(t){var n,r;const o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:dr(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:o});return Xo(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((r=(n=i==null?void 0:i.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:o}).then(i=>Xo(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,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:t,parsedType:dr(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Vs(o)?o:Promise.resolve(o));return Wy(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const a=t(o),s=()=>i.addIssue({code:re.custom,...r(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Qn({schema:this,typeName:Ee.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return qn.create(this,this._def)}nullable(){return no.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nn.create(this)}promise(){return fa.create(this,this._def)}or(t){return Hs.create([this,t],this._def)}and(t){return Ws.create(this,t,this._def)}transform(t){return new Qn({..._e(this._def),schema:this,typeName:Ee.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Gs({..._e(this._def),innerType:this,defaultValue:n,typeName:Ee.ZodDefault})}brand(){return new TS({typeName:Ee.ZodBranded,type:this,..._e(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Zs({..._e(this._def),innerType:this,catchValue:n,typeName:Ee.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return jl.create(this,t)}readonly(){return Xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const sz=/^c[^\s-]{8,}$/i,lz=/^[0-9a-z]+$/,cz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uz=/^[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,dz=/^[a-z0-9_-]{21}$/i,fz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pz=/^[-+]?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)?)??$/,mz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ou;const gz=/^(?:(?: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])$/,vz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,yz=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xz=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bS="((\\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])))",Sz=new RegExp(`^${bS}$`);function wS(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Tz(e){return new RegExp(`^${wS(e)}$`)}function Ez(e){let t=`${bS}T${wS(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Cz(e,t){return!!((t==="v4"||!t)&&gz.test(e)||(t==="v6"||!t)&&yz.test(e))}function kz(e,t){if(!fz.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||!o.typ||!o.alg||t&&o.alg!==t)}catch{return!1}}function Rz(e,t){return!!((t==="v4"||!t)&&vz.test(e)||(t==="v6"||!t)&&xz.test(e))}class Wn extends Fe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==fe.string){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:fe.string,received:i.parsedType}),ke}const r=new Ht;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ce(o,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ce(o,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")mz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"email",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Ou||(Ou=new RegExp(hz,"u")),Ou.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"emoji",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")uz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"uuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")dz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"nanoid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")sz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")lz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid2",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")cz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ulid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ce(o,{validation:"url",code:re.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"regex",code:re.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ez(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Sz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Tz(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?pz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Cz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ip",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?kz(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"jwt",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Rz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cidr",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?bz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?wz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64url",code:re.invalid_string,message:i.message}),r.dirty()):qe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:re.invalid_string,...ve.errToObj(r)})}_addCheck(t){return new Wn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ve.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ve.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ve.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ve.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ve.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ve.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ve.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ve.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ve.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ve.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ve.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ve.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ve.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...ve.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ve.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ve.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ve.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ve.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ve.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ve.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ve.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ve.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ve.errToObj(n)})}nonempty(t){return this.min(1,ve.errToObj(t))}trim(){return new Wn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Wn.create=e=>{var t;return new Wn({checks:[],typeName:Ee.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};function Pz(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),a=parseInt(t.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}class eo extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==fe.number){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:fe.number,received:i.parsedType}),ke}let r;const o=new Ht;for(const i of this._def.checks)i.kind==="int"?qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:re.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Pz(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_finite,message:i.message}),o.dirty()):qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,o){return new eo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(o)}]})}_addCheck(t){return new eo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ve.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ve.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&qe.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}eo.create=e=>new eo({checks:[],typeName:Ee.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class Qo extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==fe.bigint)return this._getInvalidInput(t);let r;const o=new Ht;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):qe.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:fe.bigint,received:n.parsedType}),ke}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,o){return new Qo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(o)}]})}_addCheck(t){return new Qo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Qo.create=e=>{var t;return new Qo({checks:[],typeName:Ee.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};class Ld extends Fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==fe.boolean){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.boolean,received:r.parsedType}),ke}return Yt(t.data)}}Ld.create=e=>new Ld({typeName:Ee.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class da extends Fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==fe.date){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:fe.date,received:i.parsedType}),ke}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_date}),ke}const r=new Ht;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):qe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new da({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ve.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ve.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}da.create=e=>new da({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ee.ZodDate,..._e(e)});class Vd extends Fe{_parse(t){if(this._getType(t)!==fe.symbol){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.symbol,received:r.parsedType}),ke}return Yt(t.data)}}Vd.create=e=>new Vd({typeName:Ee.ZodSymbol,..._e(e)});class zs extends Fe{_parse(t){if(this._getType(t)!==fe.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.undefined,received:r.parsedType}),ke}return Yt(t.data)}}zs.create=e=>new zs({typeName:Ee.ZodUndefined,..._e(e)});class Bs extends Fe{_parse(t){if(this._getType(t)!==fe.null){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.null,received:r.parsedType}),ke}return Yt(t.data)}}Bs.create=e=>new Bs({typeName:Ee.ZodNull,..._e(e)});class $d extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return Yt(t.data)}}$d.create=e=>new $d({typeName:Ee.ZodAny,..._e(e)});class jo extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Yt(t.data)}}jo.create=e=>new jo({typeName:Ee.ZodUnknown,..._e(e)});class Tr extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:fe.never,received:n.parsedType}),ke}}Tr.create=e=>new Tr({typeName:Ee.ZodNever,..._e(e)});class zd extends Fe{_parse(t){if(this._getType(t)!==fe.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.void,received:r.parsedType}),ke}return Yt(t.data)}}zd.create=e=>new zd({typeName:Ee.ZodVoid,..._e(e)});class Nn extends Fe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==fe.array)return ce(n,{code:re.invalid_type,expected:fe.array,received:n.parsedType}),ke;if(o.exactLength!==null){const a=n.data.length>o.exactLength.value,s=n.data.length<o.exactLength.value;(a||s)&&(ce(n,{code:a?re.too_big:re.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?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&&(ce(n,{code:re.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&&(ce(n,{code:re.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((a,s)=>o.type._parseAsync(new $n(n,a,n.path,s)))).then(a=>Ht.mergeArray(r,a));const i=[...n.data].map((a,s)=>o.type._parseSync(new $n(n,a,n.path,s)));return Ht.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Nn({...this._def,minLength:{value:t,message:ve.toString(n)}})}max(t,n){return new Nn({...this._def,maxLength:{value:t,message:ve.toString(n)}})}length(t,n){return new Nn({...this._def,exactLength:{value:t,message:ve.toString(n)}})}nonempty(t){return this.min(1,t)}}Nn.create=(e,t)=>new Nn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ee.ZodArray,..._e(t)});function wo(e){if(e instanceof xt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=qn.create(wo(r))}return new xt({...e._def,shape:()=>t})}else return e instanceof Nn?new Nn({...e._def,type:wo(e.element)}):e instanceof qn?qn.create(wo(e.unwrap())):e instanceof no?no.create(wo(e.unwrap())):e instanceof Xn?Xn.create(e.items.map(t=>wo(t))):e}class xt extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=qe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==fe.object){const c=this._getOrReturnCtx(t);return ce(c,{code:re.invalid_type,expected:fe.object,received:c.parsedType}),ke}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(const c in o.data)a.includes(c)||s.push(c);const l=[];for(const c of a){const u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new $n(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Tr){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")s.length>0&&(ce(o,{code:re.unrecognized_keys,keys:s}),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 s){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>Ht.mergeObjectSync(r,c)):Ht.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ve.errToObj,new xt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,a,s;const l=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ve.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new xt({...this._def,unknownKeys:"strip"})}passthrough(){return new xt({...this._def,unknownKeys:"passthrough"})}extend(t){return new xt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new xt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ee.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new xt({...this._def,catchall:t})}pick(t){const n={};return qe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}omit(t){const n={};return qe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}deepPartial(){return wo(this)}partial(t){const n={};return qe.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new xt({...this._def,shape:()=>n})}required(t){const n={};return qe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof qn;)i=i._def.innerType;n[r]=i}}),new xt({...this._def,shape:()=>n})}keyof(){return SS(qe.objectKeys(this.shape))}}xt.create=(e,t)=>new xt({shape:()=>e,unknownKeys:"strip",catchall:Tr.create(),typeName:Ee.ZodObject,..._e(t)});xt.strictCreate=(e,t)=>new xt({shape:()=>e,unknownKeys:"strict",catchall:Tr.create(),typeName:Ee.ZodObject,..._e(t)});xt.lazycreate=(e,t)=>new xt({shape:e,unknownKeys:"strip",catchall:Tr.create(),typeName:Ee.ZodObject,..._e(t)});class Hs extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(s=>new dn(s.ctx.common.issues));return ce(n,{code:re.invalid_union,unionErrors:a}),ke}if(n.common.async)return Promise.all(r.map(async i=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(o);{let i;const a=[];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&&a.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const s=a.map(l=>new dn(l));return ce(n,{code:re.invalid_union,unionErrors:s}),ke}}get options(){return this._def.options}}Hs.create=(e,t)=>new Hs({options:e,typeName:Ee.ZodUnion,..._e(t)});const Hn=e=>e instanceof Us?Hn(e.schema):e instanceof Qn?Hn(e.innerType()):e instanceof Ks?[e.value]:e instanceof to?e.options:e instanceof Ys?qe.objectValues(e.enum):e instanceof Gs?Hn(e._def.innerType):e instanceof zs?[void 0]:e instanceof Bs?[null]:e instanceof qn?[void 0,...Hn(e.unwrap())]:e instanceof no?[null,...Hn(e.unwrap())]:e instanceof TS||e instanceof Xs?Hn(e.unwrap()):e instanceof Zs?Hn(e._def.innerType):[];class zp extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.object)return ce(n,{code:re.invalid_type,expected:fe.object,received:n.parsedType}),ke;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}):(ce(n,{code:re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ke)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const a=Hn(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new zp({typeName:Ee.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,..._e(r)})}}function Bd(e,t){const n=dr(e),r=dr(t);if(e===t)return{valid:!0,data:e};if(n===fe.object&&r===fe.object){const o=qe.objectKeys(t),i=qe.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(const s of i){const l=Bd(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===fe.array&&r===fe.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const a=e[i],s=t[i],l=Bd(a,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===fe.date&&r===fe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ws extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,a)=>{if(By(i)||By(a))return ke;const s=Bd(i.value,a.value);return s.valid?((Hy(i)||Hy(a))&&n.dirty(),{status:n.value,value:s.data}):(ce(r,{code:re.invalid_intersection_types}),ke)};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,a])=>o(i,a)):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}))}}Ws.create=(e,t,n)=>new Ws({left:e,right:t,typeName:Ee.ZodIntersection,..._e(n)});class Xn extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.array)return ce(r,{code:re.invalid_type,expected:fe.array,received:r.parsedType}),ke;if(r.data.length<this._def.items.length)return ce(r,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ke;!this._def.rest&&r.data.length>this._def.items.length&&(ce(r,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new $n(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>Ht.mergeArray(n,a)):Ht.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Xn({...this._def,rest:t})}}Xn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xn({items:e,typeName:Ee.ZodTuple,rest:null,..._e(t)})};class qs extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.object)return ce(r,{code:re.invalid_type,expected:fe.object,received:r.parsedType}),ke;const o=[],i=this._def.keyType,a=this._def.valueType;for(const s in r.data)o.push({key:i._parse(new $n(r,s,r.path,s)),value:a._parse(new $n(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?Ht.mergeObjectAsync(n,o):Ht.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Fe?new qs({keyType:t,valueType:n,typeName:Ee.ZodRecord,..._e(r)}):new qs({keyType:Wn.create(),valueType:t,typeName:Ee.ZodRecord,..._e(n)})}}class Hd extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.map)return ce(r,{code:re.invalid_type,expected:fe.map,received:r.parsedType}),ke;const o=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([s,l],c)=>({key:o._parse(new $n(r,s,r.path,[c,"key"])),value:i._parse(new $n(r,l,r.path,[c,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ke;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(c.value,u.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ke;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(c.value,u.value)}return{status:n.value,value:s}}}}Hd.create=(e,t,n)=>new Hd({valueType:t,keyType:e,typeName:Ee.ZodMap,..._e(n)});class Jo extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.set)return ce(r,{code:re.invalid_type,expected:fe.set,received:r.parsedType}),ke;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(ce(r,{code:re.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&&(ce(r,{code:re.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function a(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ke;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const s=[...r.data.values()].map((l,c)=>i._parse(new $n(r,l,r.path,c)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Jo({...this._def,minSize:{value:t,message:ve.toString(n)}})}max(t,n){return new Jo({...this._def,maxSize:{value:t,message:ve.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Jo.create=(e,t)=>new Jo({valueType:e,minSize:null,maxSize:null,typeName:Ee.ZodSet,..._e(t)});class Wi extends Fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.function)return ce(n,{code:re.invalid_type,expected:fe.function,received:n.parsedType}),ke;function r(s,l){return Fd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nd(),ua].filter(c=>!!c),issueData:{code:re.invalid_arguments,argumentsError:l}})}function o(s,l){return Fd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nd(),ua].filter(c=>!!c),issueData:{code:re.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof fa){const s=this;return Yt(async function(...l){const c=new dn([]),u=await s._def.args.parseAsync(l,i).catch(f=>{throw c.addIssue(r(l,f)),c}),d=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw c.addIssue(o(d,f)),c})})}else{const s=this;return Yt(function(...l){const c=s._def.args.safeParse(l,i);if(!c.success)throw new dn([r(l,c.error)]);const u=Reflect.apply(a,this,c.data),d=s._def.returns.safeParse(u,i);if(!d.success)throw new dn([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Wi({...this._def,args:Xn.create(t).rest(jo.create())})}returns(t){return new Wi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Wi({args:t||Xn.create([]).rest(jo.create()),returns:n||jo.create(),typeName:Ee.ZodFunction,..._e(r)})}}class Us extends Fe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Us.create=(e,t)=>new Us({getter:e,typeName:Ee.ZodLazy,..._e(t)});class Ks extends Fe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ce(n,{received:n.data,code:re.invalid_literal,expected:this._def.value}),ke}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ks.create=(e,t)=>new Ks({value:e,typeName:Ee.ZodLiteral,..._e(t)});function SS(e,t){return new to({values:e,typeName:Ee.ZodEnum,..._e(t)})}class to extends Fe{constructor(){super(...arguments),Ai.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{expected:qe.joinValues(r),received:n.parsedType,code:re.invalid_type}),ke}if($s(this,Ai)||xS(this,Ai,new Set(this._def.values)),!$s(this,Ai).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{received:n.data,code:re.invalid_enum_value,options:r}),ke}return Yt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return to.create(t,{...this._def,...n})}exclude(t,n=this._def){return to.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ai=new WeakMap;to.create=SS;class Ys extends Fe{constructor(){super(...arguments),Ii.set(this,void 0)}_parse(t){const n=qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==fe.string&&r.parsedType!==fe.number){const o=qe.objectValues(n);return ce(r,{expected:qe.joinValues(o),received:r.parsedType,code:re.invalid_type}),ke}if($s(this,Ii)||xS(this,Ii,new Set(qe.getValidEnumValues(this._def.values))),!$s(this,Ii).has(t.data)){const o=qe.objectValues(n);return ce(r,{received:r.data,code:re.invalid_enum_value,options:o}),ke}return Yt(t.data)}get enum(){return this._def.values}}Ii=new WeakMap;Ys.create=(e,t)=>new Ys({values:e,typeName:Ee.ZodNativeEnum,..._e(t)});class fa extends Fe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.promise&&n.common.async===!1)return ce(n,{code:re.invalid_type,expected:fe.promise,received:n.parsedType}),ke;const r=n.parsedType===fe.promise?n.data:Promise.resolve(n.data);return Yt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}fa.create=(e,t)=>new fa({type:e,typeName:Ee.ZodPromise,..._e(t)});class Qn extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ce(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const a=o.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return ke;const l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?ke:l.status==="dirty"||n.value==="dirty"?Pi(l.value):l});{if(n.value==="aborted")return ke;const s=this._def.schema._parseSync({data:a,path:r.path,parent:r});return s.status==="aborted"?ke:s.status==="dirty"||n.value==="dirty"?Pi(s.value):s}}if(o.type==="refinement"){const a=s=>{const l=o.refinement(s,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 s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ke:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?ke:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(o.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Xo(a))return a;const s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Xo(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:n.value,value:s})):a);qe.assertNever(o)}}Qn.create=(e,t,n)=>new Qn({schema:e,typeName:Ee.ZodEffects,effect:t,..._e(n)});Qn.createWithPreprocess=(e,t,n)=>new Qn({schema:t,effect:{type:"preprocess",transform:e},typeName:Ee.ZodEffects,..._e(n)});class qn extends Fe{_parse(t){return this._getType(t)===fe.undefined?Yt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}qn.create=(e,t)=>new qn({innerType:e,typeName:Ee.ZodOptional,..._e(t)});class no extends Fe{_parse(t){return this._getType(t)===fe.null?Yt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}no.create=(e,t)=>new no({innerType:e,typeName:Ee.ZodNullable,..._e(t)});class Gs extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===fe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Gs.create=(e,t)=>new Gs({innerType:e,typeName:Ee.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._e(t)});class Zs extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vs(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new dn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new dn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zs.create=(e,t)=>new Zs({innerType:e,typeName:Ee.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._e(t)});class Wd extends Fe{_parse(t){if(this._getType(t)!==fe.nan){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.nan,received:r.parsedType}),ke}return{status:"valid",value:t.data}}}Wd.create=e=>new Wd({typeName:Ee.ZodNaN,..._e(e)});class TS extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class jl extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);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"?ke:i.status==="dirty"?(n.dirty(),Pi(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"?ke:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new jl({in:t,out:n,typeName:Ee.ZodPipeline})}}class Xs extends Fe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Xo(o)&&(o.value=Object.freeze(o.value)),o);return Vs(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Xs.create=(e,t)=>new Xs({innerType:e,typeName:Ee.ZodReadonly,..._e(t)});xt.lazycreate;var Ee;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ee||(Ee={}));Wn.create;eo.create;Wd.create;Qo.create;Ld.create;da.create;Vd.create;zs.create;Bs.create;$d.create;jo.create;Tr.create;zd.create;Nn.create;xt.create;xt.strictCreate;Hs.create;zp.create;Ws.create;Xn.create;qs.create;Hd.create;Jo.create;Wi.create;Us.create;Ks.create;to.create;Ys.create;fa.create;Qn.create;qn.create;no.create;Qn.createWithPreprocess;jl.create;const Az=e=>{if(typeof e!="string")try{e=JSON.stringify(e)}catch{return!1}try{return JSON.parse(e),!0}catch{return!1}},Iz=(e,t,n)=>{const r=t.length-1;for(let o=0;o<t.length;o++){const i=t[o];if(o===r)e[i]=n;else{if(!(i in e)||typeof e[i]!="object"){const a=t[o+1];e[i]=isNaN(Number(a))?{}:[]}e=e[i]}}},ES=e=>e.replace(/\[(\d+)]/g,".$1").split("."),Xt=(e,t,n)=>{const r=Array.isArray(t)?t.map(String):ES(t),o=structuredClone(e);return Iz(o,r,n),o},_z=(e,t)=>e.localeCompare(t),bo={},CS=e=>{const t=e._def.typeName;if(t==="ZodDefault")return e._def.defaultValue();if(t==="ZodObject")return kS(e);if(t==="ZodArray")return[];if("innerType"in e._def){const n=CS(e._def.innerType);return t==="ZodArray"?n??[]:n}},kS=e=>Object.fromEntries(Object.entries(e.shape).map(([t,n])=>[t,CS(n)])),RS=(e,t)=>{const n=structuredClone(e);for(const r in t){const o=t[r],i=e[r];o!==void 0&&(typeof o=="object"&&o!==null&&!Array.isArray(o)&&typeof i=="object"&&i!==null&&!Array.isArray(i)?n[r]=RS(i,o):n[r]=o||i)}return n},Oz={sort:_z,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},PS=e=>{const t=new FormData(e),n=new URLSearchParams(t);return iz.parse(n.toString(),Oz)},lr=(e,t)=>ES(e).reduce((n,r)=>{var i;if(r==="")return n;const o=((i=n.shape)==null?void 0:i[r])||n;return o._def.typeName==="ZodArray"?o.element:o},t),fr=e=>e.dataset.value?e.dataset.value:e.type==="checkbox"?e.checked:e.type==="number"?e.valueAsNumber:e.value||e.getAttribute("value"),Mu=e=>{const t=e.dataset.target;if(!t)return fr(e);const n=document.querySelector(`[data-origin="${t}"]`);return fr(n||e)},Mz={state:{},loading:!1,useOnChange:!1},qy=e=>e.dataset.target||e.name,jz=e=>{const t=`@use-form/${e}`;return{get:()=>{const n=Hi.LocalStorage.get(t);return Az(n)?n:{}},clear:()=>void Hi.LocalStorage.delete(t),set:n=>Hi.LocalStorage.set(t,n)}},Dz=(e,t,n=Mz)=>{const[r,o]=E.useState(null),i=E.useRef({}),[a,s]=E.useState(()=>Ve.function(n==null?void 0:n.state)?n.state():(n==null?void 0:n.state)??kS(e)??{}),l=E.useCallback(b=>{var P;const S=b.target,w=b.currentTarget;if(S.dataset.optional==="true")return;const C=qy(S),R=Mu(S)||(w?fr(w):""),I=lr(C,e);if(S.setAttribute("data-initialized","true"),I){const N=I.safeParse(R),j=N.success?void 0:((P=N.error.issues[0])==null?void 0:P.message)??"";o(L=>Xt(L??{},C,j))}},[e]),c=E.useCallback(b=>S=>{const w=S.currentTarget,T=Object.values(i.current).reduce((R,I)=>{var A;const P=I.element,N=I.schema.safeParse(fr(P));if(P.dataset.ignore==="ignore"||N.success)return R;const j=(A=N.error.issues[0])==null?void 0:A.message;P.setAttribute("data-initialized","true");const L=P.dataset.name||P.name||"";return Xt(R,L,j)},{}),C=Ve.empty(T)?null:T;o(C),console.error(C),b==null||b({form:w,errors:C||{}})},[]),u=(b,S=bo)=>{const w=lr(b,e),T=C=>{var I;if(!Mf(C))return;s(P=>Xt(P,b,C.toISOString())),o(P=>Xt(P,b,void 0));const R=i.current[b].element;if(R){const P=R.getAttribute("data-origin"),N=document.querySelector(`input[data-target="${P}"]`);N&&N.setCustomValidity("")}(I=S==null?void 0:S.onChange)==null||I.call(S,C)};return{...S,loading:n.loading,name:b,id:b,onChange:T,form:t,date:Ve.string(a[b])?new Date(a[b]):a[b],required:S.required??!w.isOptional(),error:Cn(r,b),ref:C=>{C!==null&&(i.current[b]={element:C,schema:w})}}},d=(b,S=bo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const R=C.target.value;s(P=>Xt(P,b,R)),(I=S==null?void 0:S.onChange)==null||I.call(S,C)},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),value:Cn(a,b,void 0)??"",required:S.required??!w.isOptional(),ref:C=>C!==null?i.current[b]={element:C,schema:w}:void 0}},p=(b,S=bo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const R=C.target.checked;s(P=>Xt(P??{},b,R)),(I=S==null?void 0:S.onChange)==null||I.call(S,C)},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),ref:C=>C!==null?void(i.current[b]={element:C,schema:w}):void 0}},f=(b,S=bo)=>{const w=lr(b,e),T=C=>{var I,P;(I=C.persist)==null||I.call(C);const R=C.target.value;(P=S==null?void 0:S.onChange)==null||P.call(S,C),s(N=>Xt(N,b,R))};return{...S,loading:n.loading,name:b,id:b,onChange:T,form:t,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),value:Cn(a,b,void 0)||(S==null?void 0:S.value)||"",type:Ve.instance(w,eo)?"number":(S==null?void 0:S.type)??"text",ref:C=>C===null?void 0:i.current[b]={element:C,schema:w}}},h=(b,S=bo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChangeOptions:C=>{s(R=>Xt(R,b,C))},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),value:Cn(a,b,void 0)||(S==null?void 0:S.value)||[],ref:C=>C===null?void 0:void(i.current[b]={element:C,schema:w})}},g=(b,S=bo)=>{const w=lr(b,e),T=w._def.typeName==="ZodNumber";return{...S,name:b,id:b,onChange:R=>{var P,N;(P=R.persist)==null||P.call(R);const I=T?R.target.valueAsNumber:R.target.value;(N=S==null?void 0:S.onChange)==null||N.call(S,R),s(j=>Xt(j,b,I))},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),type:T?"number":(S==null?void 0:S.type)??"text",value:Cn(a,b,void 0)||(S==null?void 0:S.value)||"",ref:R=>R===null?void 0:void(i.current[b]={element:R,schema:w})}};E.useEffect(()=>{const b=Object.values(i.current).map(w=>{const T=w.element.dataset.origin?document.querySelector(`[data-target="${w.element.name}"]`):w.element,C=w.schema.safeParse(fr(T)),R=j=>{var F;const L=qy(j.target);if(!L)return!1;const A=j.target,O=Mu(j.target)||(j.relatedTarget?fr(j.relatedTarget):""),M=w.schema.safeParse(O);if(A.setAttribute("value",O),M.success)return T.setCustomValidity&&T.setCustomValidity(""),o(D=>{if(Ve.null(D))return null;const H=Xt(D,L,void 0);return Ve.empty(D)||Ve.nil(D)||Ve.empty(H)?null:H}),!1;if(T.required){const D=((F=M.error.issues[0])==null?void 0:F.message)||"";T.setCustomValidity&&T.setCustomValidity(D),o(H=>{if(Ve.null(H))return null;const _=Xt(H,L,D||void 0);return Ve.empty(_)?null:_})}return!1},I=new AbortController,P=T.getAttribute("data-trigger")||"blur";T.addEventListener(P,R,{signal:I.signal});const N=T.dataset.shadow?!1:T.required?!C.success:!1;return{input:w,hasInitialError:N,unsubscribe:()=>I.abort()}});return b.some(w=>w.hasInitialError)&&o(w=>w===null?{}:w),()=>b.forEach(w=>w.unsubscribe())});const m=b=>S=>{var N;S.preventDefault();const w=S.currentTarget;let T=PS(w);(t?Array.from(document.querySelectorAll(`[form="${t}"]`)):Array.from(w.elements)).forEach(j=>{if(j.tagName==="SELECT"){const L=j;T=Xt(T,L.name,L.value)}if(j.tagName==="INPUT"){const L=j,A=Mu(L)||(L?fr(L):"");T=Xt(T,L.dataset.target||L.name,A)}});const R=RS(T,a),I=e.safeParse(R),P=()=>{var j;vS(w),(j=n.interceptor)==null||j.clear()};if(I.success){const j=JSON.stringify(I.data);return w.setAttribute("data-json",j),(N=n.interceptor)==null||N.clear(),b==null?void 0:b(S,{form:w,event:S,reset:P,setErrors:o,errors:[],success:!0,data:I.data,json:I.data})}return console.group("useForm error"),console.info(I),console.info(I.error.issues),console.error(I.error),console.groupEnd(),w.reportValidity(),b==null?void 0:b(S,{form:w,json:T,event:S,reset:P,setErrors:o,data:T,success:!1,errors:I.error.issues.map(j=>({message:j.message,path:j.path.map(L=>String(L))}))})},v=b=>zf(a,b)||"",x=b=>({...b,id:t,name:t});return E.useEffect(()=>{var b;n.interceptor&&((b=n.interceptor)==null||b.set(a))},[a]),{get:v,input:g,state:a,errors:r,select:d,checkbox:p,onSubmit:m,setState:s,textarea:f,onInvalid:c,controller:x,datepicker:u,name:t,multiselect:h,disabled:r!==null}},Nz=e=>e?JSON.parse(e.getAttribute("data-json")):{},Fz=e=>{const t=E.useRef(void 0);return E.useEffect(()=>{t.current=e},[e]),t.current},AS={button:"0.55rem",pill:"2rem",card:"0.75rem",full:"9999px"},IS={base:"1rem",hairline:"0.0625rem",lg:"1.125rem",sm:"0.75rem","field-height":"1.5rem","field-label":"1.875rem","input-height":"2.5rem","input-x":"0.5rem","input-y":"0.25rem","input-inline":"0.25rem","input-gap":"0.3rem"},_S={normal:"1",navbar:"22",calendar:"2",overlay:"21",tooltip:"20",floating:"22"},Lz={name:"dark",zIndex:_S,rounded:AS,spacing:IS,shadow:{"shadow-notification":"1px 2px 2px 2px hsla(210, 25%, 40%, 0.15)","shadow-floating":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","shadow-card":"0px 1px 1px 1px hsla(210, 25%, 20%, 0.1)"},colors:{foreground:"hsla(210, 50%, 98%)",background:"hsla(0, 0%, 9%)",border:"hsla(240, 7%, 27%)",muted:"hsla(210, 10%, 40%)",disabled:"hsla(240, 4%, 33%)",emphasis:{foreground:"hsla(251, 91%, 95%)",DEFAULT:"hsla(255, 92%, 76%)",subtle:"hsla(252, 95%, 85%)",hover:"hsla(262, 83%, 58%)"},primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(200,98%,39%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{DEFAULT:"hsla(210, 32%, 70%)",background:"hsla(210, 30%, 81%)",subtle:"hsla(210, 27%, 88%)",hover:"hsla(210, 10%, 58%)",foreground:"hsla(210, 20%, 30%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 93%, 77%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 40%, 98%)",notification:"hsla(219, 91%, 59%)"},warn:{DEFAULT:"hsla(27, 96%, 61%)",subtle:"hsla(45, 95%, 66%)",hover:"hsla(21, 90%, 48%)",foreground:"hsla(210, 40%, 98%)",notification:"hsla(32, 65%, 75%)"},danger:{DEFAULT:"hsla(358, 65%, 57%)",subtle:"hsla(0, 94%, 81%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 40%, 98%)",notification:"hsla(358, 40%, 23%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 75%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(160, 91%, 50%)",notification:"hsla(161,62%,17%)"},input:{border:"hsla(240, 4%, 25%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 9%)",switch:"hsla(0, 0%, 100%)",slider:"hsla(0, 0%, 100%)"},card:{muted:"hsla(0, 0%, 22%)",border:"hsla(240, 7%, 20%)",background:"hsla(0, 0%, 15%)"},floating:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 14%)",hover:"hsla(221, 10%, 22%)",border:"hsla(240, 7%, 27%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 8%)",hover:"hsla(221, 10%, 35%)",border:"hsla(0, 0%, 19%)",overlay:"hsla(0, 0%, 0%)"},table:{header:"hsla(0, 0%, 12%)",border:"hsla(240, 4%, 20%)",background:"hsla(0, 0%, 15%)"},button:{primary:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},warn:{text:"hsla(26,100%,67%)",bg:"hsla(37,100%,15%)"},info:{text:"hsla(200,80%,70%)",bg:"hsla(206,66%,24%)"},success:{text:"hsla(151,65%,54%)",bg:"hsla(154,52%,19%)"},danger:{text:"hsla(2,100%,90%)",bg:"hsla(5,62%,23%)"},muted:{text:"hsla(0, 100%, 100%)",bg:"hsla(0, 0%, 12%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"}},tag:{primary:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},warn:{text:"hsla(26,100%,67%)",bg:"hsla(37,100%,15%)"},info:{text:"hsla(200,80%,70%)",bg:"hsla(206,66%,24%)"},success:{text:"hsla(151,65%,54%)",bg:"hsla(154,52%,19%)"},danger:{text:"hsla(2,100%,79%)",bg:"hsla(5,62%,23%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"},muted:{text:"hsla(0, 100%, 100%)",bg:"hsla(0, 0%, 12%)"}},alert:{primary:{text:"hsla(210,100%,72%)",border:"hsla(212,69%,16%)",bg:"hsla(215,42%,9%)"},warn:{bg:"hsla(28,33%,9%)",border:"hsla(29,65%,12%)",text:"hsla(27,100%,78%)"},info:{text:"hsla(253,100%,83%)",bg:"hsla(263,28%,11%)",border:"hsla(252,34%,51%)"},success:{text:"hsla(144,79%,79%)",bg:"hsla(153,20%,9%)",border:"hsla(144,70%,14%)"},danger:{text:"hsla(350,100%,91%)",bg:"hsla(355,25%,15%)",border:"hsla(355,25%,10%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)",border:"hsla(200,90%,89%)"},secondary:{text:"hsla(220,9%,94%)",bg:"hsla(220,6%,10%)",border:"hsla(214,7%,19%)"},muted:{bg:"hsla(0, 0%, 12%)",border:"hsla(0, 0%, 40%)",text:"hsla(0, 100%, 100%)"}}}},Vz={rounded:AS,spacing:IS,name:"light",shadow:{"shadow-notification":"1px 2px 2px 2px hsla(210, 25%, 40%, 0.15)","shadow-floating":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","shadow-card":"0px 1px 1px 1px hsla(210, 25%, 20%, 0.1)"},zIndex:_S,colors:{foreground:"hsla(217, 15%, 30%)",background:"hsla(210, 40%, 98%)",border:"hsla(210, 25%, 88%)",muted:"hsla(210, 30%, 86%)",disabled:"hsla(240, 10%, 78%)",emphasis:{foreground:"hsla(251,91%,95%)",DEFAULT:"hsla(255,92%,76%)",subtle:"hsla(252,95%,85%)",hover:"hsla(262,83%,58%)"},primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(199, 89%, 54%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{background:"hsla(210, 25%, 35%)",DEFAULT:"hsla(210, 25%, 45%)",subtle:"hsla(207, 29%, 39%)",hover:"hsla(210, 21%, 67%)",foreground:"hsla(210, 40%, 98%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 70%, 90%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 34%, 96%)",notification:"hsla(219, 91%, 59%)"},danger:{DEFAULT:"hsla(0, 82%, 63%)",subtle:"hsla(0, 96%, 95%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 34%, 96%)",notification:"hsla(0, 100%, 87%)"},warn:{DEFAULT:"hsla(27, 100%, 70%)",subtle:"hsla(45, 95%, 80%)",hover:"hsla(29, 85%, 50%)",foreground:"hsla(210, 34%, 96%)",notification:"hsla(27, 85%, 92%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 90%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(160, 91%, 17%)",notification:"hsla(160, 75%, 80%)"},input:{border:"hsla(218, 22%, 85%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 45%)",switch:"hsla(0, 0%, 100%)",slider:"hsla(0, 0%, 100%)"},card:{muted:"hsla(210, 25%, 94%)",border:"hsla(210, 25%, 95%)",background:"hsla(0, 0%, 100%)"},floating:{foreground:"hsla(217, 15%, 20%)",background:"hsla(0, 0%, 100%)",hover:"hsla(0, 0%, 92%)",border:"hsla(210, 25%, 88%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(217, 15%, 20%)",background:"hsla(210, 25%, 98%)",hover:"hsla(210, 25%, 92%)",border:"hsla(200, 1%, 80%)",overlay:"hsla(0, 0%, 0%)"},table:{header:"hsla(221, 20%, 97%)",background:"hsla(0, 0%, 100%)",border:"hsla(210, 20%, 92%)"},button:{muted:{bg:"hsla(210, 30%, 86%)",text:"hsla(210, 10%, 15%)"},primary:{text:"hsla(0, 0%, 100%)",bg:"hsla(207,96%,48%)"},warn:{bg:"hsla(26,90%,60%)",text:"hsla(0, 0%, 100%)"},info:{text:"hsla(0, 0%, 100%)",bg:"hsla(210,60%,60%)"},success:{text:"hsla(0, 0%, 100%)",bg:"hsla(152,56%,39%)"},danger:{text:"hsla(0, 0%, 100%)",bg:"hsla(10,78%,54%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"}},tag:{muted:{bg:"hsla(210, 30%, 92%)",text:"hsla(210, 10%, 25%)"},primary:{text:"hsla(0, 0%, 100%)",bg:"hsla(207,70%,55%)"},warn:{bg:"hsla(30,100%,82%)",text:"hsla(23,100%,40%)"},info:{text:"hsla(196,100%,20%)",bg:"hsla(197,65%,80%)"},success:{text:"hsla(154,52%,19%)",bg:"hsla(152,56%,80%)"},danger:{text:"hsla(10,82%,45%)",bg:"hsla(359,94%,92%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"}},alert:{muted:{bg:"hsla(210, 30%, 86%)",text:"hsla(210, 30%, 86%)",border:"hsla(210, 10%, 70%)"},primary:{text:"hsla(206,70%,50%)",border:"hsla(206,90%,89%)",bg:"hsla(205,92%,95%)"},warn:{bg:"hsla(23,100%,96%)",text:"hsla(23,93%,53%)",border:"hsla(33,100%,85%)"},info:{text:"hsla(252,56%,57%)",bg:"hsla(256,100%,95%)",border:"hsla(252,76%,84%)"},success:{text:"hsla(152,56%,39%)",bg:"hsla(139,47%,93%)",border:"hsla(152,58%,78%)"},danger:{text:"hsla(358,69%,55%)",bg:"hsla(357,90%,96%)",border:"hsla(359,100%,90%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)",border:"hsla(200,90%,89%)"},secondary:{text:"hsla(216,10%,10%)",bg:"hsla(214,7%,92%)",border:"hsla(216,22%,78%)"}}}},$z=Lz,zz=Vz,Bz=e=>{const t=E.useMemo(()=>({locale:e.locale,tweaks:{...vl,...e.tweaks},parser:e.parser||hl.hsla,map:{...gl,...e.map}}),[e]);return y.jsx(si.Provider,{value:t,children:e.children})},Hz=()=>{const e=E.useContext(si);return e?e.parser:hl.hsla};exports.Alert=kI;exports.Autocomplete=OF;exports.Button=tl;exports.Calendar=B0;exports.Card=Hf;exports.Checkbox=_p;exports.ColType=Mo;exports.Collapse=d0;exports.CommandPalette=$2;exports.ComponentsProvider=Bz;exports.Context=si;exports.DatePicker=jF;exports.Dict=yn;exports.Dropdown=hi;exports.Empty=H0;exports.Expand=z2;exports.FileUpload=XL;exports.Form=QL;exports.Input=Pa;exports.InputFeedback=I1;exports.InputField=Ra;exports.Menu=W2;exports.MenuItem=H2;exports.Modal=dp;exports.MultiSelect=iV;exports.Notifications=bj;exports.Polymorph=un;exports.Radiobox=aV;exports.RenderOnView=fE;exports.Select=Qr;exports.Slider=BV;exports.Stats=wj;exports.Switch=HV;exports.Tab=Cj;exports.Table=ez;exports.Tabs=Tj;exports.Tag=cs;exports.TaskList=WV;exports.Textarea=qV;exports.Timeline=kj;exports.TimelineItem=bl;exports.Toolbar=q2;exports.Tooltip=fp;exports.TransferList=YV;exports.createColumns=x$;exports.createCssProperties=mM;exports.createDesignTokens=N0;exports.createFormStorage=jz;exports.createOptionCols=Fp;exports.createStyles=dM;exports.createTheme=pM;exports.createTokenStyles=hM;exports.css=Ie;exports.defaultDarkTheme=$z;exports.defaultLightTheme=zz;exports.defaultTranslations=gl;exports.defaultTweaks=vl;exports.dispatchInput=px;exports.formReset=vS;exports.formToJson=PS;exports.getCoords=sE;exports.getJsonForm=Nz;exports.getModalScrollerRef=E$;exports.getRemainingSize=qi;exports.getSchemaShape=lr;exports.hasVerticalScroll=mx;exports.initializeInputDataset=ma;exports.isMobile=V0;exports.isReactComponent=aE;exports.isReactFC=Gd;exports.isSsr=yr;exports.mergeRefs=Un;exports.negate=gM;exports.noop=Bf;exports.parsers=hl;exports.path=zf;exports.reduceTokens=cr;exports.safeRegex=ad;exports.splitInto=L0;exports.useColorParser=Hz;exports.useForm=Dz;exports.useLocale=$f;exports.useNotification=yj;exports.usePrevious=Fz;exports.useReactive=fw;exports.useStableRef=gr;exports.useSwipe=F0;exports.useTablePreferences=S$;exports.useTranslations=Ct;exports.uuid=li;
241
+ `);if(e.style.height="auto",n.length>1)return void(e.style.height=`${e.scrollHeight}px`)};return e.addEventListener("input",t),()=>e.removeEventListener("input",t)}),UV=e=>{const[t,n]=E.useState(0);return E.useEffect(()=>{const r=e.current;if(!r)return;const o=r.parentElement;if(!o)return;const i=()=>{n(o.clientHeight)};return o.addEventListener("resize",i),i(),()=>{o.removeEventListener("resize",i)}},[]),t},KV={Item:E.forwardRef(function(t,n){return y.jsx("li",{...t,ref:n,className:"flex items-center gap-1 justify-between"})}),List:E.forwardRef(function(t,n){return y.jsx("ul",{...t,ref:n,className:"space-y-3"})})},YV=e=>{const t=E.useRef(null),n=UV(t);return y.jsxs("div",{className:"flex flex-row gap-4",ref:t,children:[y.jsxs("div",{className:"py-8 space-y-4 min-w-64 w-fit flex flex-col whitespace-nowrap rounded-lg border border-card-border",children:[y.jsx("header",{className:"border-b border-card-border pb-2"}),y.jsxs("div",{className:"px-8 space-y-2",children:[y.jsx(Pa,{rightLabel:"",title:"Search",placeholder:"Looking for..."}),y.jsx(Pp,{height:n,useWindowScroll:!0,data:e.source,components:KV,itemContent:(r,o)=>y.jsx(E.Fragment,{children:y.jsx(_p,{children:y.jsx(e.Item,{data:o})})})})]})]}),y.jsx("div",{children:y.jsx(tl,{children:y.jsx(_f,{})})}),y.jsx("div",{})]})};var GV=Object.defineProperty,Cy=Object.getOwnPropertySymbols,ZV=Object.prototype.hasOwnProperty,XV=Object.prototype.propertyIsEnumerable,ky=(e,t,n)=>t in e?GV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QV=(e,t)=>{for(var n in t||(t={}))ZV.call(t,n)&&ky(e,n,t[n]);if(Cy)for(var n of Cy(t))XV.call(t,n)&&ky(e,n,t[n]);return e},Dp=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return!0;return!1},JV=(e,t,n,r)=>Ml(Dp,e,t,n,r),Zo=e=>typeof e=="object",hr=(e,t)=>{if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||!Zo(e)&&!Zo(t))return e===t;if(e.prototype!==t.prototype)return!1;const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>hr(e[r],t[r]))},e$=(e,t)=>(Zo(e)||Array.isArray(e))&&t?e[t]:e,t$=e=>(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1,Ls=e=>/[0-9.]+/.test(e),Ry=e=>["string","number"].includes(typeof e),Py=e=>e==null||(e==null?void 0:e.length)===0||e==="",Ay={eq:hr,is:Object.is,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"==":(e,t)=>e==t,"===":(e,t)=>e===t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,includes:(e,t)=>`${e}`.includes(t),notIncludes:(e,t)=>!`${e}`.includes(t),startsWith:(e,t)=>`${e}`.startsWith(t),endsWith:(e,t)=>`${e}`.endsWith(t),like:(e,t)=>new RegExp(`.*${t}.*`,"gi").test(`${e}`),alphabetical:(e,t)=>e.toString().localeCompare(t.toString()),empty:Py,notEmpty:e=>!Py(e),in:(e,t)=>Dp(t,n=>hr(e,n)),notIn:(e,t)=>uS(t,n=>!hr(e,n))},n$=e=>{if(e in Ay)return Ay[e];throw new Error("Linq - Symbol not found")},Oo=(e,t)=>{const n=[],r=e.length;for(let o=0;o<r;o++)t(e[o],o,e)&&n.push(e[o]);return n},Ml=(e,t,n,r,o)=>{if(typeof n=="function")return e(t,n);const i=n$(r);return n&&r&&o!==void 0?e(t,a=>i(a[n],o)):e(t,a=>i(a,o))},r$=(e,t,n,r)=>Ml(Oo,e,t,n,r),uS=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},o$=(e,t,n,r)=>Ml(uS,e,t,n,r),dS=e=>{if(e===null)return null;const t=QV({},e);return Object.keys(t).forEach(n=>t[n]=Zo(e[n])?dS(e[n]):e[n]),Array.isArray(e)&&e.length?(t.length=e.length)&&Array.from(t):Array.isArray(e)?Array.from(e):t},Iy=(e,t)=>{if(Zo(t)){for(let n=0;n<e.length;n++){const r=e[n];if(hr(t,r))return!0}return!1}for(let n=0;n<e.length;n++){const r=e[n];if(hr(t,r))return!0}return!1},i$=(e,t)=>{const n=new Map(e.map(r=>[r[t],r]));return Object.fromEntries(n.entries())},a$=e=>Oo(e,(t,n,r)=>Zo(t)?n===r.findIndex(o=>hr(o,t)):n===r.indexOf(t)),s$=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return e[r]},fS=(e,t)=>{const n=new Map;return e.forEach(r=>{const o=t(r),i=n.get(o)||[];i.push(r),n.set(o,i)}),Object.fromEntries(n.entries())},l$=(e,t)=>fS(e,n=>n[t]),_y=(e,t)=>{const n=[];let r=0;const o=e.length;for(r;r<o;r++){const i=t(e[r],r,e);n.push(i)}return n},c$=(e,t)=>{let n=Number.parseInt(e,10),r=Number.parseInt(t,10);return n>r?[r,n]:[n,r]},u$=(e,t,n=1)=>{const r=[];let o=e.charCodeAt(0);const i=t.charCodeAt(0);for(;o<=i;o+=n)r.push(String.fromCharCode(o));return Ls(e)&&Ls(t)?r.map(a=>Number.parseInt(a)):r},Eu=(e,t,n=1)=>{let r=Math.abs(n);if((e.length>1||t.length>1)&&Ls(e)&&Ls(t)){const o=[],[i,a]=c$(e,t);for(let s=i;s<=a;s+=r)o.push(s);return o}return u$(e,t,r)},d$=(e,t,n=1)=>{if(t===void 0){const[r,o,i]=e.split("..");return i===void 0?Eu(r,o,1):Eu(r,i,Number.parseInt(o,10))}return Ry(e)&&Ry(t)?Eu(`${e}`,`${t}`,n):Array.from({length:e},(r,o)=>o*Math.abs(t))},Cu=(e,t,n)=>{let r=t;const o=n.length;for(let i=0;i<o;i++){const a=n[i];r=e(r,a,i,n)}return r},Oy=e=>{const t=Array.from(e.values());let n=null,r=null,o=t.length;for(n=0;n<o/2;n+=1){r=o-1-n;let i=t[n];t[n]=t[r],t[r]=i}return t},f$=(e,t)=>{if(typeof t=="number")return e.slice(t);let n=e.length;for(let r=0;r<n;r++){const o=e[r];if(t(o,r,e))return e.slice(r)}return e.slice(0)},p$=(e,t,n,r)=>Ml(f$,e,t,n,r),My=(e,t)=>{const n=[...e];return t===void 0?n.sort():typeof t=="function"?n.toSorted(t):n.toSorted(t$(t))},pS=(e=>(e.Asc="asc",e.Desc="desc",e))(pS||{}),m$=e=>(t,n)=>e.reduce((r,o)=>{const i=o.type==="desc"?-1:1,a=o.key,s=t[a]>n[a]?i:t[a]<n[a]?-i:0;return r!==0?r:s},0),h$=(e,t)=>e.sort(m$(t)),g$=(e,t)=>{if(t===void 0)return[...new Set(e).values()];const n=new Set;return Array.isArray(t)?[...new Set(t)]:Oo(e,r=>{const o=t?n.has(r[t]):n.has(t);return t&&(o||n.add(r[t])),!o})},v$=class jd{constructor(t=[]){this.array=t}static Range(...t){return d$(...t)}static New(t){return new jd(t)}Where(t,n,r){return this.array=r$(this.array,t,n,r),this}Some(t,n,r){return JV(this.array,t,n,r)}All(t,n,r){return o$(this.array,t,n,r)}Reverse(){return this.array=Oy(this.array),this}Add(t){return this.array=Array.isArray(t)?this.array.concat(t):this.array.concat([t]),this}Prepend(t){return this.array=Array.isArray(t)?t.concat(this.array):[t].concat(this.array),this}Select(t){return t===void 0?this.array:this.array.map(t)}Take(t,n){return n!==void 0?this.array=this.array.slice(t,Math.max(0,n)):this.array=this.array.slice(t),this}Head(){return this.array[0]}Tail(){return this.Skip(1)}Skip(t,n,r){return this.array=p$(this.array,t,n,r),this}Distinct(){return this.array=a$(this.array),this}First(t){return t===void 0?this.array[0]:s$(this.array,t)||null}Last(t){const n=this.array.length;if(t===void 0)return this.array[n-1];for(let r=n;r!==0;r--)if(t(this.array[r],r,this.array))return this.array[r]}Sum(t){return t===void 0?Cu((n,r)=>n+r,0,this.array):Cu((n,r)=>n+e$(r,t),0,this.array)}Average(t){return this.Sum(t)/this.array.length}GroupBy(t){return l$(this.array,t)}GroupWith(t){return fS(this.array,t)}Except(t){return Oo(this.array,n=>!Iy(t,n))}Intersect(t){return Oo(this.array,n=>Iy(t,n))}OrderBy(t,n){let r;return r=t?My(this.array,t):this.array.toSorted(),this.array=n==="desc"?Oy(r):r,this}Includes(t){return Dp(this.array,n=>hr(n,t))}In(t){const n=t.length;for(let r=0;r<n;r++){const o=t[r];if(this.Includes(o))return!0}return!1}Reduce(t,n){return Cu(t,n??this.array[0],this.array)}Empty(){return this.array.length===0}ToMap(t){return new Map(_y(this.array,n=>[t,n]))}Zip(t,n){return _y(this.array,(r,o)=>n(r,t[o]))}Count(t){return t===void 0?this.array.length:Oo(this.array,t).length}Get(t){return this.array[t]}Clone(){return new jd(dS(this.array))}ToObject(t){return i$(this.array,t)}Sort(t){return Array.isArray(t)?h$(this.array,t):My(this.array,t)}Unique(t){return g$(this.array,t)}},mS=v$,ku={},jy;function y$(){return jy||(jy=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=(m,v)=>{try{Object.keys(m).forEach(v)}catch(x){window.console.log(x)}},n=m=>m==null,r=m=>{const v=typeof m;return v==="string"||v==="number"||v==="boolean"||n(m)},o=(m,v)=>{const x=v.getItem(m);try{return JSON.parse(x)}catch{return x??null}},i=m=>Object.keys(m).reduce((v,x)=>({...v,[x]:o(x,m)}),{}),a=m=>m instanceof Date?m:typeof m=="number"?new Date(new Date*1+m*864e5):m,s="1969-12-31T23:59:59.000Z",l=()=>document.cookie===""?{}:document.cookie.split("; ").map(m=>m.split("=")).reduce((m,v)=>(m[decodeURIComponent(v[0].trim())]=decodeURIComponent(v[1].trim()),m),{}),c=new Set,u=()=>{const m=l();c.forEach(v=>v(m))},d=[{name:"expires",parse:m=>`expires=${a(m.expires??s)}`},{name:"maxAge",parse:m=>m.maxAge?`max-age=${a(m.expires??s)}`:""},{name:"path",parse:m=>`path=${m.path??"/"}`},{name:"sameSite",parse:m=>`samesite=${m.sameSite??"strict"}`},{name:"useSecure",parse:m=>`${m.useSecure??!0?"secure":""}`},{name:"domain",parse:m=>{const v=m.domain??"";return v===""?"":`domain=${m.multiDomain?".":""}${v}`}},{name:"partitioned",parse:m=>m.partitioned?"Partitioned":""}],p={json:l,listener:m=>(c.add(m),()=>c.delete(m)),clearListeners:()=>c.clear(),has:m=>document.cookie.split(";").some(v=>v.trim().startsWith(`${m}=`)),deleteAll:()=>{document.cookie.split(";").forEach(m=>{document.cookie=m.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}),u()},get:m=>{const v=p.json()[m];if(n(v))return null;try{return JSON.parse(decodeURIComponent(v))}catch{return v}},delete:m=>{document.cookie=`${encodeURIComponent(m)}=;expires=${new Date().toUTCString()}`,u()},set:(m,v,x={})=>{const b=r(v)?v:encodeURIComponent(JSON.stringify(v)),S=d.reduce((w,T)=>{const C=T.parse(x);return C===""?w:w.concat(C)},[`${encodeURIComponent(m)}=${b}`]).join(";");document.cookie=S,u()}},f=m=>{const v=new Set,x=b=>{m().removeItem(b);const S=i(m());v.forEach(w=>w(S))};return{delete:x,listener:b=>(v.add(b),()=>v.delete(b)),clearListeners:()=>v.clear(),json:(b=!1)=>b?i(m()):m(),has:b=>{const S=m().getItem(b);return!n(S)},deleteAll:()=>{t(m(),x),v.forEach(b=>b(m()))},get:b=>o(b,m()),set:(b,S)=>{m().setItem(b,JSON.stringify(S)),v.forEach(w=>w(m()))}}},h=f(()=>window.sessionStorage),g=f(()=>window.localStorage);e.Cookie=p,e.LocalStorage=g,e.SessionStorage=h,e.createStorage=f}(ku)),ku}var Hi=y$();const Np=e=>e.headerLabel??e.thead??e.id,Fp=e=>e.map(t=>({value:t.id,label:t.thead??t.headerLabel??t.id}));var Mo=(e=>(e.Boolean="boolean",e.Number="number",e.Select="select",e.Text="text",e))(Mo||{});const Lp=e=>e.type==="number"?e.valueAsNumber:e.value,x$=e=>{let t=[];return e({add:(o,i,a)=>t.push({...a,id:o,thead:i}),remove:o=>t=t.filter(i=>i.id!==o)}),t},b$={},w$=(e,t)=>{if(!Array.isArray(t))return e;const n=new Set(t.map(o=>o.id));if(!e.every(o=>n.has(o.id)))return e;const r=new Map(e.map(o=>[o.id,o]));return t.map((o,i)=>{const a=r.get(o.id);return a===void 0?e[i]:a})},S$=(e,t,n=b$)=>{const r=yr()?null:Hi.LocalStorage.get(`@components/table-${e}`)||null,[o,i]=Lf({name:e,groups:n.groups||(r==null?void 0:r.groups)||[],sorters:n.sorters||(r==null?void 0:r.sorters)||[],filters:n.filters||(r==null?void 0:r.filters)||[],cols:w$(t,r==null?void 0:r.cols)},a=>{const s=l=>{const c=a.state(),u={...c,...l};return yr()||Hi.LocalStorage.set(`@components/table-${c.name}`,u),u};return s(a.state()),{set:l=>s(l)}});return{...o,...i,name:e}},T$=e=>{const t=gr(e),n=E.useRef(null),r=E.useCallback(o=>{t.current(o),o.forEach(i=>{const a=n.current.querySelector(`th[data-colid="${i.id}"]`);a&&(a.style.width="auto")})},[t]);return[n,r]},E$=()=>yr()?void 0:document.querySelector('[data-component="modal-body"]'),Dd=(e,t,n,r={})=>{var c,u;const o=e.id,i=e.type??Mo.Text,a=t[i]??[],s=((c=a.find(d=>d["data-default"]))==null?void 0:c.value)??((u=a[0])==null?void 0:u.value),l=n[s];return{id:li(),operation:l,label:Np(e),name:o,type:i,value:"",...r}},Vp=()=>{const e=Ct(),t=E.useMemo(()=>({contains:{value:"contains",label:e.tableFilterTypeContains,symbol:"includes","data-default":"true"},is:{value:"is",label:e.tableFilterTypeIs,symbol:"is"},isNot:{value:"isNot",label:e.tableFilterTypeIsNot,symbol:"!=="},notContains:{value:"notContains",label:e.tableFilterTypeNotContains,symbol:"notIncludes"},lessThan:{value:"lessThan",label:e.tableFilterTypeLessThan,symbol:"<="},greaterThan:{value:"greaterThan",label:e.tableFilterTypeGreaterThan,symbol:">="},startsWith:{value:"startsWith",label:e.tableFilterTypeStartsWith,symbol:"startsWith"},endsWith:{value:"endsWith",label:e.tableFilterTypeEndsWith,symbol:"endsWith"}}),[e]);return{options:E.useMemo(()=>({[Mo.Text]:[t.is,t.isNot,t.contains,t.notContains,t.startsWith,t.endsWith],[Mo.Boolean]:[t.is,t.isNot],[Mo.Number]:[t.is,t.isNot,t.greaterThan,t.lessThan]}),[e]),operations:t}},C$=e=>{const t=Ct(),n=Vp(),r=()=>{const l=e.cols.at(0);e.set(c=>[...c,Dd(l,n.options,n.operations)])},o=l=>{const c=l.target.dataset.id||"",u=l.target.value;e.set(d=>d.map(p=>{if(c!==p.id)return p;const f=e.cols.find(h=>u===h.id);return Dd(f,n.options,n.operations,{value:""})}))},i=l=>{const c=l.target.dataset.id||"",u=l.target.value;e.set(d=>d.map(p=>p.id===c?{...p,operation:n.operations[u]}:p))},a=l=>{const c=l.currentTarget.dataset.id||"";e.set(u=>u.filter(d=>d.id!==c))},s=l=>{const c=l.target.dataset.id||"",u=Lp(l.target);e.set(d=>d.map(p=>p.id===c?{...p,value:u}:p))};return y.jsx(E.Fragment,{children:y.jsx(hi,{arrow:!0,title:t.tableFilterDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(lI,{size:14}),t.tableFilterLabel," ",e.filters.length===0?"":` (${e.filters.length})`]}),children:y.jsxs("ul",{className:"mt-4 space-y-2",children:[e.filters.map(l=>{const c=n.options[l.type];return y.jsxs("li",{className:"flex flex-nowrap gap-3",children:[y.jsx(Qr,{options:e.options,title:t.tableFilterColumnTitle,placeholder:t.tableFilterColumnPlaceholder,value:l.name,"data-id":l.id,onChange:o}),y.jsx(Qr,{"data-id":l.id,onChange:i,value:l.operation.value,options:c,title:t.tableFilterOperatorTitle,placeholder:t.tableFilterOperatorPlaceholder}),y.jsx(Pa,{"data-id":l.id,onChange:s,title:t.tableFilterValueTitle,placeholder:t.tableFilterValuePlaceholder,type:l.type,value:l.value,optionalText:""}),y.jsx("div",{className:"mt-5 flex items-center justify-center",children:y.jsx("button",{"data-id":l.id,type:"button",onClick:a,children:y.jsx(fl,{className:"text-danger",size:16})})})]},`filter-select-${l.id}`)}),y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1 text-primary",children:[y.jsx(Of,{size:14})," ",t.tableFilterNewFilter]})})]})})})},k$=({filter:e,onDelete:t,set:n})=>{const r=Ct(),o=Vp(),i=s=>{const l=s.target.value,c=s.target.dataset.id||"";n(u=>u.map(d=>d.id===c?{...d,operation:o.operations[l]}:d))},a=s=>{const l=s.target.dataset.id||"",c=Lp(s.target);n(u=>u.map(d=>d.id===l?{...d,value:c}:d))};return y.jsxs("div",{className:"flex flex-nowrap items-center gap-4 py-2",children:[y.jsx(Qr,{"data-id":e.id,onChange:i,value:e.operation.value,options:o.options[e.type],title:r.tableFilterColumnTitle,placeholder:r.tableFilterColumnPlaceholder}),y.jsx(Pa,{optionalText:" ","data-id":e.id,onChange:a,type:e.type,value:e.value,title:r.tableFilterValueTitle,placeholder:r.tableFilterValueTitle}),y.jsx("button",{onClick:t,"data-id":e.id,type:"button",className:"mt-4",children:y.jsx(fl,{className:"text-danger",size:14})})]})},R$=({item:e,onPointerDown:t})=>{const n=dl(0);return y.jsxs(i0,{onPointerDown:t,id:e.groupId,className:"flex flex-row items-center gap-2",value:e,style:{y:n},children:[y.jsx("button",{type:"button",className:"cursor-grab",children:y.jsx(iI,{size:14})}),y.jsx("span",{children:e.groupName})]},e.groupId)},P$=e=>{var l;const t=Ct(),n=Fp(e.cols),r=yA(),[o,i]=E.useState(((l=e.groups[0])==null?void 0:l.thead)||""),a=c=>{var m;const u=c.target,d=u.value,p=u.options.selectedIndex,f=((m=u.options.item(p))==null?void 0:m.label)||"";i(f);const h=new mS(e.rows).GroupBy(d),g=e.cols.find(v=>v.id===d);e.setGroups(vT(h).map((v,x)=>{const b=h[v];return{...g,groupId:li(),groupKey:d,index:x,rows:b,groupName:v}}))},s=()=>e.setGroups([]);return y.jsx(E.Fragment,{children:y.jsxs(hi,{arrow:!1,title:t.tableGroupLabel,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(wI,{size:14}),t.tableGroupLabelWithCount,e.groups.length>0?` - ${o}(${e.groups.length})`:""]}),children:[y.jsxs("div",{className:"flex flex-nowrap items-center",children:[y.jsx(Qr,{value:o,title:"Tipo de agrupamento",onChange:a,options:n,placeholder:"Agrupar por..."}),y.jsx(tl,{className:"mt-4",onClick:s,theme:"raw","data-id":o,children:y.jsx(fl,{size:16,className:"text-danger"})})]}),e.groups.length>0?y.jsxs("section",{className:"my-4",children:[y.jsx("header",{children:y.jsx("h2",{className:"text-xl font-medium",children:"Order groups"})}),y.jsx(PE,{children:y.jsx(o0,{axis:"y",className:"relative space-y-2",drag:!0,dragControls:r,dragListener:!1,layoutScroll:!0,onReorder:e.setGroups,values:e.groups,children:e.groups.map(c=>y.jsx(R$,{item:c,onPointerDown:u=>{r.start(u),e.setGroups([...e.groups])}},c.groupId))})})]}):null]})})},A$=e=>(t,n)=>e.reduce((r,o)=>{const i=o.type==="desc"?-1:1,a=o.value,s=t[a]>n[a]?i:t[a]<n[a]?-i:0;return r!==0?r:s},0),I$=(e,t)=>e.toSorted(A$(t)),hS=(e,t,n)=>({label:t,id:li(),type:n,value:e.id}),_$=e=>{const t=Ct(),n={asc:{label:t.tableSortAsc,value:"asc"},desc:{label:t.tableSortDesc,value:"desc"}},r=[n.asc,n.desc],o=()=>{const l=e.cols[0];l&&e.set(c=>[...c,hS(l,n.asc.label,n.asc.value)])},i=l=>c=>{const u=c.target.value;e.set(d=>d.map(p=>p.id===l?{...p,value:u}:p))},a=l=>c=>{const u=c.target.value;e.set(d=>d.map(p=>p.id===l?{...p,type:u}:p))},s=l=>{const c=l.currentTarget.dataset.id||"";e.set(u=>u.filter(d=>d.id!==c))};return y.jsx(E.Fragment,{children:y.jsx(hi,{title:t.tableSortDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(s0,{size:14}),t.tableSortOrderByLabel," ",e.sorters.length===0?"":` (${e.sorters.length})`]}),children:y.jsxs("ul",{className:"mt-4 space-y-2",children:[e.sorters.map(l=>y.jsxs("li",{className:"flex flex-nowrap gap-3",children:[y.jsx(Qr,{options:e.options,value:l.value,onChange:i(l.id),title:t.tableSortOrderInputTitle,placeholder:t.tableSortOrderInputPlaceholder}),y.jsx(Qr,{onChange:a(l.id),value:l.type,options:r,title:t.tableSortTypeInputTitle,placeholder:t.tableSortTypeInputPlaceholder}),y.jsx("button",{className:"mt-4","data-id":l.id,onClick:s,children:y.jsx(fl,{className:"text-danger",size:14})})]},`sorter-select-${l.id}`)),y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:o,className:"text-primary flex items-center gap-1",children:[y.jsx(Of,{size:14})," ",t.tableSortAddButton]})})]})})})},O$=e=>{const t=Ct(),[n,r]=E.useState(()=>{const s=e.sorters.find(l=>l.value===e.col.id);return s?s.type:"undefined"}),o=()=>r(s=>s==="undefined"?"asc":s==="asc"?"desc":"undefined");E.useEffect(()=>{e.setSorters(s=>{if(n==="undefined")return s.filter(u=>u.value!==e.col.id);const l=s.findIndex(u=>u.value===e.col.id),c=hS(e.col,n,n);return l===-1?[...s,c]:(s[l]=c,[...s])})},[n,e.col]);const i=`${e.col.id}-sorter-id`,a=Np(e.col);return y.jsxs("button",{"aria-labelledby":i,className:"isolate flex items-center",onClick:o,type:"button",children:[y.jsxs("span",{id:i,className:"sr-only",children:[t.tableSortDropdownTitle," ",a]}),n==="asc"?y.jsx(MA,{size:14}):null,n==="desc"?y.jsx(_A,{size:14}):null,n==="undefined"?y.jsx(s0,{size:14}):null]})},M$=e=>y.jsx("header",{className:"min-w-full mb-1",children:y.jsxs("div",{className:"flex flex-wrap min-w-full items-center justify-between gap-x-4 gap-y-1",children:[y.jsxs("div",{className:"flex w-fit items-centeend gap-4 whitespace-nowrap py-2",children:[y.jsx("span",{children:y.jsx(C$,{cols:e.cols,options:e.options,filters:e.filters,set:e.setFilters})}),y.jsx("span",{children:y.jsx(_$,{options:e.options,cols:e.cols,sorters:e.sorters,set:e.setSorters})}),y.jsx("span",{children:y.jsx(P$,{rows:e.rows,groups:e.groups,setGroups:e.setGroups,options:e.options,cols:e.cols})})]}),y.jsx("ul",{className:"flex flex-wrap w-full flex-1 flex-grow flex-row items-center md:justify-end gap-4",children:e.filters.map(t=>y.jsxs("li",{className:"flex gap-1 items-center rounded-xl border border-card-border px-4 py-0.5",children:[y.jsxs("span",{children:[y.jsx("span",{className:"size-3 mr-2 aspect-square bg-primary inline-block rounded-full","aria-hidden":"true"}),t.label," ",t.operation.label.toLowerCase(),":"]}),y.jsxs("div",{className:"relative w-min min-w-[1ch]",children:[y.jsx("span",{"aria-hidden":"true",className:"invisible whitespace-pre p-0",children:t.value||" "}),y.jsx("input",{type:t.type,value:t.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=Lp(n.target);e.setFilters(o=>o.map(i=>t.id===i.id?{...i,value:r}:i))}})]})]},`filter-table-${t.id}`))})]})});function j$(e,t){if(!e||!t)return[];const n=[1];if(e===1&&t===1)return n;e>4&&n.push("-");const r=2,o=e-r,i=e+r;for(let s=o>2?o:2;s<=Math.min(t,i);s++)n.push(s);const a=t-2;return i+1!==a&&i+1<t&&n.push("_"),i<t&&(n.push(t-2),n.push(t-1),n.push(t)),Array.from(new Set(n))}const D$=e=>{const t=E.useId(),n=Ct(),r=E.useMemo(()=>j$(e.current,e.pages),[e.current,e.pages]),o=e.current<e.pages;return y.jsxs("footer",{className:"flex flex-wrap items-center justify-center gap-4 px-1 py-4 lg:flex-nowrap lg:justify-between",children:[y.jsx("p",{children:y.jsx(n.tablePaginationFooter,{...e,sizes:e.sizes,select:e.onChangeSize&&Array.isArray(e.sizes)?y.jsxs(E.Fragment,{children:[y.jsx("label",{htmlFor:t,children:n.tablePaginationSelectLabel}),y.jsx("select",{id:t,value:e.size,className:"cursor-pointer bg-transparent",onChange:i=>{var a;(a=e.onChangeSize)==null||a.call(e,Number(i.target.value))},children:e.sizes.map(i=>y.jsx("option",{value:i,children:i},`pagination-opt-${i}`))})," "]}):null})}),y.jsx("nav",{children:y.jsxs("ul",{className:"flex items-center gap-2",children:[e.current>1?y.jsx("li",{children:y.jsx(un,{as:e.asLink||"button",href:"previous",className:"",children:n.tablePaginationPrevious})}):null,r.map(i=>i===null?null:y.jsx(E.Fragment,{children:typeof i=="string"?y.jsx("li",{children:"..."}):y.jsx("li",{children:y.jsx(un,{href:i,as:e.asLink||"button",className:`cursor-pointer border-b-2 px-3 py-1 proportional-nums transition-colors hover:border-primary-subtle hover:text-primary-subtle ${i===e.current?"border-primary text-primary":"border-transparent"}`,children:i})})},`pagination-${i}`)),o?y.jsx("li",{children:y.jsx(un,{as:e.asLink||"button",href:"next",className:"",children:n.tablePaginationNext})}):null]})})]})},N$=e=>{const t=E.useRef(null),n=E.useRef(null),[r,o]=E.useState("opacity-0"),i=r==="opacity-0",a=()=>o("opacity-0"),s=()=>{const c=n.current,u=t.current;c===null||u===null||(u.style.left=`-${c.getBoundingClientRect().width+4}px`)},l=()=>o("opacity-100");return E.useEffect(()=>{const c=n.current;if(c===null||parent===null)return;s();const u=new IntersectionObserver(d=>d.forEach(s),{root:document.documentElement});return u.observe(c),()=>u.disconnect()},[]),y.jsx("div",{ref:t,onMouseEnter:l,onMouseLeave:a,"data-component":"cell-aside",tabIndex:i?-1:void 0,className:`group-table-cell-aside absolute inset-0 top-0 flex h-full w-full min-w-8 max-w-20 items-stretch transition-opacity duration-300 ease-in-out ${r}`,children:y.jsx("div",{ref:n,className:"isolate block h-full w-auto",children:e.children})})},F$=(e,t,n)=>{const r=n.cols,o=n.loading;return y.jsx(E.Fragment,{children:r.map((i,a)=>{var f;const s=`${a},${e}`,l=zf(t,i.id),c=i.Element,u=((f=i.cellProps)==null?void 0:f.className)||"",d=a===0&&n.Aside&&o===!1,p=n.Aside;return E.createElement("td",{...i.cellProps,role:"cell","data-matrix":s,key:`accessor-${e}-${a}`,className:`group-table-cell py-2 sm:py-2 flex flex-col md:table-cell md:h-14 md:border-l md:border-table-border px-2 first:border-transparent ${u}`},d?y.jsx(N$,{children:y.jsx(p,{col:i,row:t,rowIndex:e})}):null,y.jsx("span",{className:"block md:hidden text-sm font-bold leading-tight",children:i.thead}),y.jsx("span",{className:"relative",children:o?cp:c?y.jsx(E.Fragment,{children:y.jsx(c,{row:t,matrix:s,col:i,rowIndex:e,value:l})}):y.jsx(E.Fragment,{children:Ve.nil(l)?"":l})}))})})},L$={top:0,left:0,right:0,bottom:-1},V$=e=>{var g;const t=Ip(),n=Ct(),r=e.filters.filter(m=>m.name===e.header.id),o=r.length>0,i=e.header.allowSort??t.table.sorters??!0,a=e.header.allowFilter??t.table.filters??!0,s=Vp(),l=o?pI:hI,c=E.useRef(null),u=m=>{const v=m.currentTarget.dataset.id||"";return e.setFilters(x=>x.filter(b=>b.id!==v))},d=E.useCallback(m=>{if(m===null)return;c.current=m;const v=new AbortController;return m.addEventListener("pointerdown",x=>{if(x.target.dataset.type==="resizer")return x.stopPropagation(),x.stopImmediatePropagation()},{signal:v.signal}),()=>v.abort()},[]),p=e.sorters.find(m=>e.header.id===m.value),f=p!=null&&p.type?p.type===pS.Asc?"ascending":"descending":"none",h=Np(e.header);return y.jsxs(i0,{...e.header.thProps,as:"th",ref:d,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,role:"columnheader","aria-sort":f,value:e.header,"aria-busy":e.loading,"data-colid":e.header.id,whileDrag:{cursor:"grabbing"},className:`relative min-w-0 cursor-grab font-medium ${((g=e.header.thProps)==null?void 0:g.className)??""}`,children:[y.jsx("span",{className:`flex h-full items-center justify-between bg-table-header px-2 py-4 ${e.isLast?"rounded-tr-lg":""} ${e.index===0?"rounded-tl-lg":""}`,children:y.jsxs("span",{className:"flex items-center gap-1",children:[e.inlineFilter&&a?y.jsx(hi,{arrow:!0,trigger:y.jsxs("span",{children:[y.jsxs("span",{id:`${e.header.id}-filter-dropdown-button`,className:"sr-only",children:[n.tableFilterDropdownTitleUnique," ",h]}),y.jsx(l,{"aria-labelledby":`${e.header.id}-filter-dropdown-button`,size:14})]}),title:y.jsxs("span",{className:"text-lg",children:[n.tableFilterDropdownTitleUnique," ",y.jsx("span",{className:"font-medium",children:h})]}),children:y.jsxs("ul",{className:"font-medium",children:[r.length===0?null:y.jsx(E.Fragment,{children:r.map(m=>y.jsx("li",{className:"my-1",children:y.jsx(k$,{onDelete:u,filter:m,set:e.setFilters})},`thead-filter-${m.id}`))}),y.jsx("li",{children:y.jsxs("button",{type:"button",className:"flex items-center gap-1 text-primary",onClick:()=>e.setFilters(m=>m.concat(Dd(e.header,s.options,s.operations))),children:[y.jsx(Of,{size:14})," ",n.tableFilterNewFilter]})})]})}):null,y.jsx("span",{className:"pointer-events-auto text-balance text-base",children:e.header.thead}),e.inlineSorter&&i?y.jsx(O$,{col:e.header,setSorters:e.setSorters,sorters:e.sorters}):null]})}),e.isLast?null:y.jsx(pt.button,{drag:"x",draggable:!0,dragListener:!0,dragMomentum:!0,type:"button",animate:!1,dragElastic:0,dragPropagation:!0,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,"data-type":"resizer",title:e.header.id,dragConstraints:L$,className:"absolute -right-[0.5px] top-0 z-calendar block h-full w-[1px] cursor-col-resize bg-table-border hover:w-1.5 hover:bg-primary active:w-1.5 active:bg-primary",onClick:m=>void m.currentTarget.focus(),onKeyDown:m=>{if(m.key==="ArrowLeft"||m.key==="ArrowRight"){if(c.current===null)return;c.current.setAttribute("data-resized","true");const v=c.current.getBoundingClientRect().width,b=(m.shiftKey?50:10)*(m.key==="ArrowLeft"?-1:1);c.current.style.width=`${Math.abs(v+b)}px`}},onDoubleClick:()=>{c.current!==null&&(c.current.style.width="auto")},onDrag:(m,v)=>{if(c.current===null)return;c.current.setAttribute("data-resized","true");const x=c.current.getBoundingClientRect().width,b=v.delta.x;c.current.style.width=`${Math.abs(x+b)}px`}})]})},$$=e=>{const[t,n]=T$(e.setCols);return y.jsx(o0,{layout:!0,as:"tr",axis:"x",drag:"x",layoutRoot:!0,role:"row",layoutScroll:!0,ref:t,onReorder:n,values:e.headers,children:y.jsx(Er,{children:e.headers.map((r,o)=>y.jsx(V$,{index:o,header:r,filters:e.filters,loading:e.loading,sorters:e.sorters,setFilters:e.setFilters,setSorters:e.setSorters,inlineFilter:e.inlineFilter,inlineSorter:e.inlineSorter,isLast:o===e.headers.length-1},`header-child-item-${r.id}`))})})},gS=E.createContext({}),z$=()=>E.useContext(gS),B$=E.forwardRef(({context:e,className:t="",...n},r)=>y.jsx("tbody",{...n,role:"rowgroup",className:`divide-y divide-table-border ${t}`,ref:r,children:y.jsx(Er,{children:n.children})})),H$=E.forwardRef(({context:e,className:t="",...n},r)=>y.jsx("table",{...n,ref:r,role:"table",className:`table min-w-full table-fixed border-separate text-left ${t??""}`})),W$=E.forwardRef(({context:e,...t},n)=>{const r=z$(),o={...t==null?void 0:t.style,top:Ve.number(r.sticky)?`${r.sticky}px`:void 0};return y.jsx("thead",{...t,style:o,role:"rowgroup",className:"hidden top-0 bg-transparent md:table-header-group shadow-shadow-card group:sticky",ref:n})}),q$=E.forwardRef(({context:e,item:t,...n},r)=>y.jsx("tr",{...n,role:"row",ref:r,className:`group-table-row flex h-fit flex-col flex-wrap justify-center gap-1 md:table-row ${(n==null?void 0:n.className)??""}`})),U$=E.forwardRef((e,t)=>e.context.loadingMore?y.jsx("tfoot",{...e,ref:t,className:"bg-card-background",children:y.jsx("tr",{role:"row",className:"bg-card-background",children:y.jsx("td",{colSpan:999,className:"px-2 h-14 bg-card-background",children:y.jsx("span",{className:"block w-full h-2 rounded opacity-60 animate-pulse bg-foreground"})})})}):null),K$={TableHead:W$,Table:H$,TableBody:B$,TableRow:q$,TableFoot:U$},Y$=[0,0,0,0,0,0,0,0,0,0],G$=e=>y.jsx("div",{className:"flex justify-center items-center px-2 w-full h-48",children:e.loading?cp:y.jsx(H0,{})}),Z$=()=>y.jsx(E.Fragment,{}),X$=()=>y.jsx(E.Fragment,{}),Q$=[],Dy=({cols:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,onScrollEnd:a,getScrollRef:s,border:l=!1,pagination:c=null,useControl:u=!1,...d})=>{const p=E.useRef(null),[f,h]=E.useState(!1),g=gr(a),m=gr(d.loadingMore),v=E.useMemo(()=>{if(d.loading)return Y$;if(u)return d.rows;const S=new mS(d.rows);return t.length>0&&t.forEach(w=>w.value===""||Number.isNaN(w.value)?void 0:S.Where(w.name,w.operation.symbol,w.value)),r.length===0?S.Select():I$(S.Select(),r)},[d.loading,d.rows,u,t,r]);E.useEffect(()=>{if(p.current===null)return()=>{};const S=p.current,w=new IntersectionObserver(T=>{var I;return T[T.length-1].isIntersecting&&m.current?((I=g.current)==null||I.call(g),void h(!0)):h(!1)});return w.observe(S),()=>w.disconnect()},[m,g]);const x=v.length===0,b={loading:d.loading,loadingMore:d.loadingMore,cols:e,Aside:d.Aside};return y.jsxs("div",{className:"min-w-full",children:[y.jsxs("div",{className:`group w-full relative rounded-lg ${l?"border border-table-border":""}`,children:[y.jsx(dF,{context:b,components:K$,totalCount:v.length,style:{height:"100%"},itemContent:x?Z$:F$,data:x?Q$:v,useWindowScroll:!s,fixedFooterContent:f?X$:null,customScrollParent:s?s():void 0,fixedHeaderContent:()=>y.jsx($$,{headers:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,loading:!!d.loading,inlineFilter:d.inlineFilter,inlineSorter:d.inlineSorter})}),x?y.jsx(G$,{loading:d.loading}):null,y.jsx("div",{"aria-hidden":"true",ref:p,className:"w-full h-0.5"})]}),c!==null?y.jsx(D$,{...c}):null]})},J$=(e,t)=>typeof t=="function"?t(e):t,Ja=(e,t,n)=>e===t||n==null?void 0:n(t),ez=e=>{const t=Ip(),n=E.useMemo(()=>({sticky:e.sticky===void 0?t.table.sticky??void 0:e.sticky??void 0}),[e.sticky,t.table.sticky]),r=e.operations??t.table.operations??!0,o=E.useMemo(()=>Fp(e.cols),[e.cols]),[i,a]=Lf({cols:e.cols,sorters:e.sorters??[],groups:e.groups??[],filters:e.filters??[]},s=>{const l=c=>u=>{const d=s.state();return{...d,[c]:J$(d[c],u)}};return{cols:l("cols"),sorters:l("sorters"),groups:l("groups"),filters:l("filters")}},{postMiddleware:[(s,l)=>{var c;return(c=e.set)==null||c.call(e,s),Ja((l==null?void 0:l.filters)??[],s.filters??[],e.setFilters),Ja((l==null?void 0:l.sorters)??[],s.sorters??[],e.setSorters),Ja((l==null?void 0:l.groups)??[],s.groups??[],e.setGroups),Ja((l==null?void 0:l.cols)??[],s.cols??[],e.setCols),s}]});return y.jsxs(gS.Provider,{value:n,children:[r?y.jsx(M$,{cols:i.cols,rows:e.rows,options:o,groups:i.groups,filters:i.filters,setCols:a.cols,sorters:i.sorters,setGroups:a.groups,setFilters:a.filters,setSorters:a.sorters,pagination:e.pagination??null,inlineFilter:e.inlineFilter??!0,inlineSorter:e.inlineSorter??!0}):null,i.groups.length===0?y.jsx(Dy,{...e,index:0,cols:i.cols,options:o,groups:i.groups,filters:i.filters,optionCols:o,setCols:a.cols,sorters:i.sorters,setGroups:a.groups,setFilters:a.filters,setSorters:a.sorters,onScrollEnd:e.onScrollEnd,pagination:e.pagination??null,inlineFilter:e.inlineFilter??!0,inlineSorter:e.inlineSorter??!0}):y.jsx("div",{className:"flex flex-wrap gap-4",children:i.groups.map((s,l)=>y.jsx("div",{className:"min-w-full",children:y.jsx(Dy,{...e,group:s,index:l,cols:i.cols,pagination:null,rows:s.rows,options:o,groups:i.groups,filters:i.filters,optionCols:o,setCols:a.cols,sorters:i.sorters,setGroups:a.groups,setFilters:a.filters,setSorters:a.sorters,onScrollEnd:e.onScrollEnd,inlineFilter:e.inlineFilter??!0,inlineSorter:e.inlineSorter??!0})},`group-${s.groupId}`))})]})},tz=["INPUT","SELECT"],vS=e=>{if(!e)return;Array.from(e.elements).forEach(n=>{tz.includes(n.tagName)&&(n.tagName==="INPUT"&&(n.value=n.defaultValue),n.tagName==="SELECT"&&(n.value=""),n.setAttribute("data-initialized","false"))})};var Ru,Ny;function $p(){if(Ny)return Ru;Ny=1;var e=String.prototype.replace,t=/%20/g,n={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Ru={default:n.RFC3986,formatters:{RFC1738:function(r){return e.call(r,t,"+")},RFC3986:function(r){return String(r)}},RFC1738:n.RFC1738,RFC3986:n.RFC3986},Ru}var Pu,Fy;function yS(){if(Fy)return Pu;Fy=1;var e=$p(),t=Object.prototype.hasOwnProperty,n=Array.isArray,r=function(){for(var m=[],v=0;v<256;++v)m.push("%"+((v<16?"0":"")+v.toString(16)).toUpperCase());return m}(),o=function(v){for(;v.length>1;){var x=v.pop(),b=x.obj[x.prop];if(n(b)){for(var S=[],w=0;w<b.length;++w)typeof b[w]<"u"&&S.push(b[w]);x.obj[x.prop]=S}}},i=function(v,x){for(var b=x&&x.plainObjects?{__proto__:null}:{},S=0;S<v.length;++S)typeof v[S]<"u"&&(b[S]=v[S]);return b},a=function m(v,x,b){if(!x)return v;if(typeof x!="object"&&typeof x!="function"){if(n(v))v.push(x);else if(v&&typeof v=="object")(b&&(b.plainObjects||b.allowPrototypes)||!t.call(Object.prototype,x))&&(v[x]=!0);else return[v,x];return v}if(!v||typeof v!="object")return[v].concat(x);var S=v;return n(v)&&!n(x)&&(S=i(v,b)),n(v)&&n(x)?(x.forEach(function(w,T){if(t.call(v,T)){var C=v[T];C&&typeof C=="object"&&w&&typeof w=="object"?v[T]=m(C,w,b):v.push(w)}else v[T]=w}),v):Object.keys(x).reduce(function(w,T){var C=x[T];return t.call(w,T)?w[T]=m(w[T],C,b):w[T]=C,w},S)},s=function(v,x){return Object.keys(x).reduce(function(b,S){return b[S]=x[S],b},v)},l=function(m,v,x){var b=m.replace(/\+/g," ");if(x==="iso-8859-1")return b.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(b)}catch{return b}},c=1024,u=function(v,x,b,S,w){if(v.length===0)return v;var T=v;if(typeof v=="symbol"?T=Symbol.prototype.toString.call(v):typeof v!="string"&&(T=String(v)),b==="iso-8859-1")return escape(T).replace(/%u[0-9a-f]{4}/gi,function(L){return"%26%23"+parseInt(L.slice(2),16)+"%3B"});for(var C="",R=0;R<T.length;R+=c){for(var I=T.length>=c?T.slice(R,R+c):T,P=[],N=0;N<I.length;++N){var j=I.charCodeAt(N);if(j===45||j===46||j===95||j===126||j>=48&&j<=57||j>=65&&j<=90||j>=97&&j<=122||w===e.RFC1738&&(j===40||j===41)){P[P.length]=I.charAt(N);continue}if(j<128){P[P.length]=r[j];continue}if(j<2048){P[P.length]=r[192|j>>6]+r[128|j&63];continue}if(j<55296||j>=57344){P[P.length]=r[224|j>>12]+r[128|j>>6&63]+r[128|j&63];continue}N+=1,j=65536+((j&1023)<<10|I.charCodeAt(N)&1023),P[P.length]=r[240|j>>18]+r[128|j>>12&63]+r[128|j>>6&63]+r[128|j&63]}C+=P.join("")}return C},d=function(v){for(var x=[{obj:{o:v},prop:"o"}],b=[],S=0;S<x.length;++S)for(var w=x[S],T=w.obj[w.prop],C=Object.keys(T),R=0;R<C.length;++R){var I=C[R],P=T[I];typeof P=="object"&&P!==null&&b.indexOf(P)===-1&&(x.push({obj:T,prop:I}),b.push(P))}return o(x),v},p=function(v){return Object.prototype.toString.call(v)==="[object RegExp]"},f=function(v){return!v||typeof v!="object"?!1:!!(v.constructor&&v.constructor.isBuffer&&v.constructor.isBuffer(v))},h=function(v,x){return[].concat(v,x)},g=function(v,x){if(n(v)){for(var b=[],S=0;S<v.length;S+=1)b.push(x(v[S]));return b}return x(v)};return Pu={arrayToObject:i,assign:s,combine:h,compact:d,decode:l,encode:u,isBuffer:f,isRegExp:p,maybeMap:g,merge:a},Pu}var Au,Ly;function nz(){if(Ly)return Au;Ly=1;var e=fT(),t=yS(),n=$p(),r=Object.prototype.hasOwnProperty,o={brackets:function(m){return m+"[]"},comma:"comma",indices:function(m,v){return m+"["+v+"]"},repeat:function(m){return m}},i=Array.isArray,a=Array.prototype.push,s=function(g,m){a.apply(g,i(m)?m:[m])},l=Date.prototype.toISOString,c=n.default,u={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:t.encode,encodeValuesOnly:!1,filter:void 0,format:c,formatter:n.formatters[c],indices:!1,serializeDate:function(m){return l.call(m)},skipNulls:!1,strictNullHandling:!1},d=function(m){return typeof m=="string"||typeof m=="number"||typeof m=="boolean"||typeof m=="symbol"||typeof m=="bigint"},p={},f=function g(m,v,x,b,S,w,T,C,R,I,P,N,j,L,A,O,M,F){for(var D=m,H=F,_=0,z=!1;(H=H.get(p))!==void 0&&!z;){var X=H.get(m);if(_+=1,typeof X<"u"){if(X===_)throw new RangeError("Cyclic object value");z=!0}typeof H.get(p)>"u"&&(_=0)}if(typeof I=="function"?D=I(v,D):D instanceof Date?D=j(D):x==="comma"&&i(D)&&(D=t.maybeMap(D,function(Re){return Re instanceof Date?j(Re):Re})),D===null){if(w)return R&&!O?R(v,u.encoder,M,"key",L):v;D=""}if(d(D)||t.isBuffer(D)){if(R){var Q=O?v:R(v,u.encoder,M,"key",L);return[A(Q)+"="+A(R(D,u.encoder,M,"value",L))]}return[A(v)+"="+A(String(D))]}var J=[];if(typeof D>"u")return J;var G;if(x==="comma"&&i(D))O&&R&&(D=t.maybeMap(D,R)),G=[{value:D.length>0?D.join(",")||null:void 0}];else if(i(I))G=I;else{var Y=Object.keys(D);G=P?Y.sort(P):Y}var Z=C?String(v).replace(/\./g,"%2E"):String(v),V=b&&i(D)&&D.length===1?Z+"[]":Z;if(S&&i(D)&&D.length===0)return V+"[]";for(var $=0;$<G.length;++$){var K=G[$],ie=typeof K=="object"&&K&&typeof K.value<"u"?K.value:D[K];if(!(T&&ie===null)){var B=N&&C?String(K).replace(/\./g,"%2E"):String(K),ye=i(D)?typeof x=="function"?x(V,B):V:V+(N?"."+B:"["+B+"]");F.set(m,_);var Te=e();Te.set(p,F),s(J,g(ie,ye,x,b,S,w,T,C,x==="comma"&&O&&i(D)?null:R,I,P,N,j,L,A,O,M,Te))}}return J},h=function(m){if(!m)return u;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.encodeDotInKeys<"u"&&typeof m.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(m.encoder!==null&&typeof m.encoder<"u"&&typeof m.encoder!="function")throw new TypeError("Encoder has to be a function.");var v=m.charset||u.charset;if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var x=n.default;if(typeof m.format<"u"){if(!r.call(n.formatters,m.format))throw new TypeError("Unknown format option provided.");x=m.format}var b=n.formatters[x],S=u.filter;(typeof m.filter=="function"||i(m.filter))&&(S=m.filter);var w;if(m.arrayFormat in o?w=m.arrayFormat:"indices"in m?w=m.indices?"indices":"repeat":w=u.arrayFormat,"commaRoundTrip"in m&&typeof m.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var T=typeof m.allowDots>"u"?m.encodeDotInKeys===!0?!0:u.allowDots:!!m.allowDots;return{addQueryPrefix:typeof m.addQueryPrefix=="boolean"?m.addQueryPrefix:u.addQueryPrefix,allowDots:T,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:u.allowEmptyArrays,arrayFormat:w,charset:v,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:u.charsetSentinel,commaRoundTrip:!!m.commaRoundTrip,delimiter:typeof m.delimiter>"u"?u.delimiter:m.delimiter,encode:typeof m.encode=="boolean"?m.encode:u.encode,encodeDotInKeys:typeof m.encodeDotInKeys=="boolean"?m.encodeDotInKeys:u.encodeDotInKeys,encoder:typeof m.encoder=="function"?m.encoder:u.encoder,encodeValuesOnly:typeof m.encodeValuesOnly=="boolean"?m.encodeValuesOnly:u.encodeValuesOnly,filter:S,format:x,formatter:b,serializeDate:typeof m.serializeDate=="function"?m.serializeDate:u.serializeDate,skipNulls:typeof m.skipNulls=="boolean"?m.skipNulls:u.skipNulls,sort:typeof m.sort=="function"?m.sort:null,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:u.strictNullHandling}};return Au=function(g,m){var v=g,x=h(m),b,S;typeof x.filter=="function"?(S=x.filter,v=S("",v)):i(x.filter)&&(S=x.filter,b=S);var w=[];if(typeof v!="object"||v===null)return"";var T=o[x.arrayFormat],C=T==="comma"&&x.commaRoundTrip;b||(b=Object.keys(v)),x.sort&&b.sort(x.sort);for(var R=e(),I=0;I<b.length;++I){var P=b[I],N=v[P];x.skipNulls&&N===null||s(w,f(N,P,T,C,x.allowEmptyArrays,x.strictNullHandling,x.skipNulls,x.encodeDotInKeys,x.encode?x.encoder:null,x.filter,x.sort,x.allowDots,x.serializeDate,x.format,x.formatter,x.encodeValuesOnly,x.charset,R))}var j=w.join(x.delimiter),L=x.addQueryPrefix===!0?"?":"";return x.charsetSentinel&&(x.charset==="iso-8859-1"?L+="utf8=%26%2310003%3B&":L+="utf8=%E2%9C%93&"),j.length>0?L+j:""},Au}var Iu,Vy;function rz(){if(Vy)return Iu;Vy=1;var e=yS(),t=Object.prototype.hasOwnProperty,n=Array.isArray,r={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:e.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(p){return p.replace(/&#(\d+);/g,function(f,h){return String.fromCharCode(parseInt(h,10))})},i=function(p,f,h){if(p&&typeof p=="string"&&f.comma&&p.indexOf(",")>-1)return p.split(",");if(f.throwOnLimitExceeded&&h>=f.arrayLimit)throw new RangeError("Array limit exceeded. Only "+f.arrayLimit+" element"+(f.arrayLimit===1?"":"s")+" allowed in an array.");return p},a="utf8=%26%2310003%3B",s="utf8=%E2%9C%93",l=function(f,h){var g={__proto__:null},m=h.ignoreQueryPrefix?f.replace(/^\?/,""):f;m=m.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var v=h.parameterLimit===1/0?void 0:h.parameterLimit,x=m.split(h.delimiter,h.throwOnLimitExceeded?v+1:v);if(h.throwOnLimitExceeded&&x.length>v)throw new RangeError("Parameter limit exceeded. Only "+v+" parameter"+(v===1?"":"s")+" allowed.");var b=-1,S,w=h.charset;if(h.charsetSentinel)for(S=0;S<x.length;++S)x[S].indexOf("utf8=")===0&&(x[S]===s?w="utf-8":x[S]===a&&(w="iso-8859-1"),b=S,S=x.length);for(S=0;S<x.length;++S)if(S!==b){var T=x[S],C=T.indexOf("]="),R=C===-1?T.indexOf("="):C+1,I,P;R===-1?(I=h.decoder(T,r.decoder,w,"key"),P=h.strictNullHandling?null:""):(I=h.decoder(T.slice(0,R),r.decoder,w,"key"),P=e.maybeMap(i(T.slice(R+1),h,n(g[I])?g[I].length:0),function(j){return h.decoder(j,r.decoder,w,"value")})),P&&h.interpretNumericEntities&&w==="iso-8859-1"&&(P=o(String(P))),T.indexOf("[]=")>-1&&(P=n(P)?[P]:P);var N=t.call(g,I);N&&h.duplicates==="combine"?g[I]=e.combine(g[I],P):(!N||h.duplicates==="last")&&(g[I]=P)}return g},c=function(p,f,h,g){var m=0;if(p.length>0&&p[p.length-1]==="[]"){var v=p.slice(0,-1).join("");m=Array.isArray(f)&&f[v]?f[v].length:0}for(var x=g?f:i(f,h,m),b=p.length-1;b>=0;--b){var S,w=p[b];if(w==="[]"&&h.parseArrays)S=h.allowEmptyArrays&&(x===""||h.strictNullHandling&&x===null)?[]:e.combine([],x);else{S=h.plainObjects?{__proto__:null}:{};var T=w.charAt(0)==="["&&w.charAt(w.length-1)==="]"?w.slice(1,-1):w,C=h.decodeDotInKeys?T.replace(/%2E/g,"."):T,R=parseInt(C,10);!h.parseArrays&&C===""?S={0:x}:!isNaN(R)&&w!==C&&String(R)===C&&R>=0&&h.parseArrays&&R<=h.arrayLimit?(S=[],S[R]=x):C!=="__proto__"&&(S[C]=x)}x=S}return x},u=function(f,h,g,m){if(f){var v=g.allowDots?f.replace(/\.([^.[]+)/g,"[$1]"):f,x=/(\[[^[\]]*])/,b=/(\[[^[\]]*])/g,S=g.depth>0&&x.exec(v),w=S?v.slice(0,S.index):v,T=[];if(w){if(!g.plainObjects&&t.call(Object.prototype,w)&&!g.allowPrototypes)return;T.push(w)}for(var C=0;g.depth>0&&(S=b.exec(v))!==null&&C<g.depth;){if(C+=1,!g.plainObjects&&t.call(Object.prototype,S[1].slice(1,-1))&&!g.allowPrototypes)return;T.push(S[1])}if(S){if(g.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+g.depth+" and strictDepth is true");T.push("["+v.slice(S.index)+"]")}return c(T,h,g,m)}},d=function(f){if(!f)return r;if(typeof f.allowEmptyArrays<"u"&&typeof f.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof f.decodeDotInKeys<"u"&&typeof f.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(f.decoder!==null&&typeof f.decoder<"u"&&typeof f.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof f.charset<"u"&&f.charset!=="utf-8"&&f.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof f.throwOnLimitExceeded<"u"&&typeof f.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var h=typeof f.charset>"u"?r.charset:f.charset,g=typeof f.duplicates>"u"?r.duplicates:f.duplicates;if(g!=="combine"&&g!=="first"&&g!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var m=typeof f.allowDots>"u"?f.decodeDotInKeys===!0?!0:r.allowDots:!!f.allowDots;return{allowDots:m,allowEmptyArrays:typeof f.allowEmptyArrays=="boolean"?!!f.allowEmptyArrays:r.allowEmptyArrays,allowPrototypes:typeof f.allowPrototypes=="boolean"?f.allowPrototypes:r.allowPrototypes,allowSparse:typeof f.allowSparse=="boolean"?f.allowSparse:r.allowSparse,arrayLimit:typeof f.arrayLimit=="number"?f.arrayLimit:r.arrayLimit,charset:h,charsetSentinel:typeof f.charsetSentinel=="boolean"?f.charsetSentinel:r.charsetSentinel,comma:typeof f.comma=="boolean"?f.comma:r.comma,decodeDotInKeys:typeof f.decodeDotInKeys=="boolean"?f.decodeDotInKeys:r.decodeDotInKeys,decoder:typeof f.decoder=="function"?f.decoder:r.decoder,delimiter:typeof f.delimiter=="string"||e.isRegExp(f.delimiter)?f.delimiter:r.delimiter,depth:typeof f.depth=="number"||f.depth===!1?+f.depth:r.depth,duplicates:g,ignoreQueryPrefix:f.ignoreQueryPrefix===!0,interpretNumericEntities:typeof f.interpretNumericEntities=="boolean"?f.interpretNumericEntities:r.interpretNumericEntities,parameterLimit:typeof f.parameterLimit=="number"?f.parameterLimit:r.parameterLimit,parseArrays:f.parseArrays!==!1,plainObjects:typeof f.plainObjects=="boolean"?f.plainObjects:r.plainObjects,strictDepth:typeof f.strictDepth=="boolean"?!!f.strictDepth:r.strictDepth,strictNullHandling:typeof f.strictNullHandling=="boolean"?f.strictNullHandling:r.strictNullHandling,throwOnLimitExceeded:typeof f.throwOnLimitExceeded=="boolean"?f.throwOnLimitExceeded:!1}};return Iu=function(p,f){var h=d(f);if(p===""||p===null||typeof p>"u")return h.plainObjects?{__proto__:null}:{};for(var g=typeof p=="string"?l(p,h):p,m=h.plainObjects?{__proto__:null}:{},v=Object.keys(g),x=0;x<v.length;++x){var b=v[x],S=u(b,g[b],h,typeof p=="string");m=e.merge(m,S,h)}return h.allowSparse===!0?m:e.compact(m)},Iu}var _u,$y;function oz(){if($y)return _u;$y=1;var e=nz(),t=rz(),n=$p();return _u={formats:n,parse:t,stringify:e},_u}var iz=oz(),qe;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const a of o)i[a]=a;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(const s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(const a of o)if(i(a))return a},e.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(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(qe||(qe={}));var zy;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(zy||(zy={}));const fe=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dr=e=>{switch(typeof e){case"undefined":return fe.undefined;case"string":return fe.string;case"number":return isNaN(e)?fe.nan:fe.number;case"boolean":return fe.boolean;case"function":return fe.function;case"bigint":return fe.bigint;case"symbol":return fe.symbol;case"object":return Array.isArray(e)?fe.array:e===null?fe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?fe.promise:typeof Map<"u"&&e instanceof Map?fe.map:typeof Set<"u"&&e instanceof Set?fe.set:typeof Date<"u"&&e instanceof Date?fe.date:fe.object;default:return fe.unknown}},re=qe.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 dn extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(a))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof dn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=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(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}dn.create=e=>new dn(e);const ua=(e,t)=>{let n;switch(e.code){case re.invalid_type:e.received===fe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case re.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,qe.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:n=`Unrecognized key(s) in object: ${qe.joinValues(e.keys,", ")}`;break;case re.invalid_union:n="Invalid input";break;case re.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${qe.joinValues(e.options)}`;break;case re.invalid_enum_value:n=`Invalid enum value. Expected ${qe.joinValues(e.options)}, received '${e.received}'`;break;case re.invalid_arguments:n="Invalid function arguments";break;case re.invalid_return_type:n="Invalid function return type";break;case re.invalid_date:n="Invalid date";break;case re.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:qe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case re.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case re.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case re.custom:n="Invalid input";break;case re.invalid_intersection_types:n="Intersection results could not be merged";break;case re.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case re.not_finite:n="Number must be finite";break;default:n=t.defaultError,qe.assertNever(e)}return{message:n}};let az=ua;function Nd(){return az}const Fd=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function ce(e,t){const n=Nd(),r=Fd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ua?void 0:ua].filter(o=>!!o)});e.common.issues.push(r)}class Ht{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return ke;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,a=await o.value;r.push({key:i,value:a})}return Ht.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return ke;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(r[i.value]=a.value)}return{status:t.value,value:r}}}const ke=Object.freeze({status:"aborted"}),Pi=e=>({status:"dirty",value:e}),Yt=e=>({status:"valid",value:e}),By=e=>e.status==="aborted",Hy=e=>e.status==="dirty",Xo=e=>e.status==="valid",Vs=e=>typeof Promise<"u"&&e instanceof Promise;function $s(e,t,n,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function xS(e,t,n,r,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var ve;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ve||(ve={}));var Ai,Ii;class $n{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,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 Wy=(e,t)=>{if(Xo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new dn(e.common.issues);return this._error=n,this._error}}};function _e(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{var l,c;const{message:u}=e;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:s.defaultError}},description:o}}class Fe{get description(){return this._def.description}_getType(t){return dr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:dr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ht,ctx:{common:t.parent.common,data:t.data,parsedType:dr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Vs(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,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:t,parsedType:dr(t)},i=this._parseSync({data:t,path:o.path,parent:o});return Wy(o,i)}"~validate"(t){var n,r;const o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:dr(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:o});return Xo(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((r=(n=i==null?void 0:i.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:o}).then(i=>Xo(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,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:t,parsedType:dr(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Vs(o)?o:Promise.resolve(o));return Wy(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const a=t(o),s=()=>i.addIssue({code:re.custom,...r(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Qn({schema:this,typeName:Ee.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return qn.create(this,this._def)}nullable(){return no.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nn.create(this)}promise(){return fa.create(this,this._def)}or(t){return Hs.create([this,t],this._def)}and(t){return Ws.create(this,t,this._def)}transform(t){return new Qn({..._e(this._def),schema:this,typeName:Ee.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Gs({..._e(this._def),innerType:this,defaultValue:n,typeName:Ee.ZodDefault})}brand(){return new TS({typeName:Ee.ZodBranded,type:this,..._e(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Zs({..._e(this._def),innerType:this,catchValue:n,typeName:Ee.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return jl.create(this,t)}readonly(){return Xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const sz=/^c[^\s-]{8,}$/i,lz=/^[0-9a-z]+$/,cz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uz=/^[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,dz=/^[a-z0-9_-]{21}$/i,fz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pz=/^[-+]?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)?)??$/,mz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ou;const gz=/^(?:(?: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])$/,vz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,yz=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xz=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bS="((\\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])))",Sz=new RegExp(`^${bS}$`);function wS(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Tz(e){return new RegExp(`^${wS(e)}$`)}function Ez(e){let t=`${bS}T${wS(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Cz(e,t){return!!((t==="v4"||!t)&&gz.test(e)||(t==="v6"||!t)&&yz.test(e))}function kz(e,t){if(!fz.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||!o.typ||!o.alg||t&&o.alg!==t)}catch{return!1}}function Rz(e,t){return!!((t==="v4"||!t)&&vz.test(e)||(t==="v6"||!t)&&xz.test(e))}class Wn extends Fe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==fe.string){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:fe.string,received:i.parsedType}),ke}const r=new Ht;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?ce(o,{code:re.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ce(o,{code:re.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")mz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"email",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Ou||(Ou=new RegExp(hz,"u")),Ou.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"emoji",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")uz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"uuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")dz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"nanoid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")sz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")lz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid2",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")cz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ulid",code:re.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ce(o,{validation:"url",code:re.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"regex",code:re.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ez(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Sz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Tz(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?pz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Cz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ip",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?kz(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"jwt",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Rz(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cidr",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?bz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?wz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64url",code:re.invalid_string,message:i.message}),r.dirty()):qe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:re.invalid_string,...ve.errToObj(r)})}_addCheck(t){return new Wn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ve.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ve.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ve.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ve.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ve.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ve.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ve.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ve.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ve.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ve.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ve.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ve.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ve.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...ve.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ve.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ve.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ve.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ve.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ve.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ve.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ve.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ve.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ve.errToObj(n)})}nonempty(t){return this.min(1,ve.errToObj(t))}trim(){return new Wn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Wn.create=e=>{var t;return new Wn({checks:[],typeName:Ee.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};function Pz(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),a=parseInt(t.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}class eo extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==fe.number){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:fe.number,received:i.parsedType}),ke}let r;const o=new Ht;for(const i of this._def.checks)i.kind==="int"?qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:re.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Pz(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_finite,message:i.message}),o.dirty()):qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,o){return new eo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(o)}]})}_addCheck(t){return new eo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ve.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ve.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&qe.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}eo.create=e=>new eo({checks:[],typeName:Ee.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class Qo extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==fe.bigint)return this._getInvalidInput(t);let r;const o=new Ht;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:re.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):qe.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:fe.bigint,received:n.parsedType}),ke}gte(t,n){return this.setLimit("min",t,!0,ve.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ve.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ve.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ve.toString(n))}setLimit(t,n,r,o){return new Qo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(o)}]})}_addCheck(t){return new Qo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ve.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Qo.create=e=>{var t;return new Qo({checks:[],typeName:Ee.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};class Ld extends Fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==fe.boolean){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.boolean,received:r.parsedType}),ke}return Yt(t.data)}}Ld.create=e=>new Ld({typeName:Ee.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class da extends Fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==fe.date){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:fe.date,received:i.parsedType}),ke}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_date}),ke}const r=new Ht;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:re.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):qe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new da({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ve.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ve.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}da.create=e=>new da({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ee.ZodDate,..._e(e)});class Vd extends Fe{_parse(t){if(this._getType(t)!==fe.symbol){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.symbol,received:r.parsedType}),ke}return Yt(t.data)}}Vd.create=e=>new Vd({typeName:Ee.ZodSymbol,..._e(e)});class zs extends Fe{_parse(t){if(this._getType(t)!==fe.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.undefined,received:r.parsedType}),ke}return Yt(t.data)}}zs.create=e=>new zs({typeName:Ee.ZodUndefined,..._e(e)});class Bs extends Fe{_parse(t){if(this._getType(t)!==fe.null){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.null,received:r.parsedType}),ke}return Yt(t.data)}}Bs.create=e=>new Bs({typeName:Ee.ZodNull,..._e(e)});class $d extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return Yt(t.data)}}$d.create=e=>new $d({typeName:Ee.ZodAny,..._e(e)});class jo extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Yt(t.data)}}jo.create=e=>new jo({typeName:Ee.ZodUnknown,..._e(e)});class Tr extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:fe.never,received:n.parsedType}),ke}}Tr.create=e=>new Tr({typeName:Ee.ZodNever,..._e(e)});class zd extends Fe{_parse(t){if(this._getType(t)!==fe.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.void,received:r.parsedType}),ke}return Yt(t.data)}}zd.create=e=>new zd({typeName:Ee.ZodVoid,..._e(e)});class Nn extends Fe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==fe.array)return ce(n,{code:re.invalid_type,expected:fe.array,received:n.parsedType}),ke;if(o.exactLength!==null){const a=n.data.length>o.exactLength.value,s=n.data.length<o.exactLength.value;(a||s)&&(ce(n,{code:a?re.too_big:re.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?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&&(ce(n,{code:re.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&&(ce(n,{code:re.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((a,s)=>o.type._parseAsync(new $n(n,a,n.path,s)))).then(a=>Ht.mergeArray(r,a));const i=[...n.data].map((a,s)=>o.type._parseSync(new $n(n,a,n.path,s)));return Ht.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Nn({...this._def,minLength:{value:t,message:ve.toString(n)}})}max(t,n){return new Nn({...this._def,maxLength:{value:t,message:ve.toString(n)}})}length(t,n){return new Nn({...this._def,exactLength:{value:t,message:ve.toString(n)}})}nonempty(t){return this.min(1,t)}}Nn.create=(e,t)=>new Nn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ee.ZodArray,..._e(t)});function wo(e){if(e instanceof xt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=qn.create(wo(r))}return new xt({...e._def,shape:()=>t})}else return e instanceof Nn?new Nn({...e._def,type:wo(e.element)}):e instanceof qn?qn.create(wo(e.unwrap())):e instanceof no?no.create(wo(e.unwrap())):e instanceof Xn?Xn.create(e.items.map(t=>wo(t))):e}class xt extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=qe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==fe.object){const c=this._getOrReturnCtx(t);return ce(c,{code:re.invalid_type,expected:fe.object,received:c.parsedType}),ke}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(const c in o.data)a.includes(c)||s.push(c);const l=[];for(const c of a){const u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new $n(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Tr){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")s.length>0&&(ce(o,{code:re.unrecognized_keys,keys:s}),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 s){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new $n(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>Ht.mergeObjectSync(r,c)):Ht.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ve.errToObj,new xt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,a,s;const l=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ve.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new xt({...this._def,unknownKeys:"strip"})}passthrough(){return new xt({...this._def,unknownKeys:"passthrough"})}extend(t){return new xt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new xt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ee.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new xt({...this._def,catchall:t})}pick(t){const n={};return qe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}omit(t){const n={};return qe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}deepPartial(){return wo(this)}partial(t){const n={};return qe.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new xt({...this._def,shape:()=>n})}required(t){const n={};return qe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof qn;)i=i._def.innerType;n[r]=i}}),new xt({...this._def,shape:()=>n})}keyof(){return SS(qe.objectKeys(this.shape))}}xt.create=(e,t)=>new xt({shape:()=>e,unknownKeys:"strip",catchall:Tr.create(),typeName:Ee.ZodObject,..._e(t)});xt.strictCreate=(e,t)=>new xt({shape:()=>e,unknownKeys:"strict",catchall:Tr.create(),typeName:Ee.ZodObject,..._e(t)});xt.lazycreate=(e,t)=>new xt({shape:e,unknownKeys:"strip",catchall:Tr.create(),typeName:Ee.ZodObject,..._e(t)});class Hs extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(s=>new dn(s.ctx.common.issues));return ce(n,{code:re.invalid_union,unionErrors:a}),ke}if(n.common.async)return Promise.all(r.map(async i=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(o);{let i;const a=[];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&&a.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const s=a.map(l=>new dn(l));return ce(n,{code:re.invalid_union,unionErrors:s}),ke}}get options(){return this._def.options}}Hs.create=(e,t)=>new Hs({options:e,typeName:Ee.ZodUnion,..._e(t)});const Hn=e=>e instanceof Us?Hn(e.schema):e instanceof Qn?Hn(e.innerType()):e instanceof Ks?[e.value]:e instanceof to?e.options:e instanceof Ys?qe.objectValues(e.enum):e instanceof Gs?Hn(e._def.innerType):e instanceof zs?[void 0]:e instanceof Bs?[null]:e instanceof qn?[void 0,...Hn(e.unwrap())]:e instanceof no?[null,...Hn(e.unwrap())]:e instanceof TS||e instanceof Xs?Hn(e.unwrap()):e instanceof Zs?Hn(e._def.innerType):[];class zp extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.object)return ce(n,{code:re.invalid_type,expected:fe.object,received:n.parsedType}),ke;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}):(ce(n,{code:re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ke)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const a=Hn(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new zp({typeName:Ee.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,..._e(r)})}}function Bd(e,t){const n=dr(e),r=dr(t);if(e===t)return{valid:!0,data:e};if(n===fe.object&&r===fe.object){const o=qe.objectKeys(t),i=qe.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(const s of i){const l=Bd(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===fe.array&&r===fe.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const a=e[i],s=t[i],l=Bd(a,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===fe.date&&r===fe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ws extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,a)=>{if(By(i)||By(a))return ke;const s=Bd(i.value,a.value);return s.valid?((Hy(i)||Hy(a))&&n.dirty(),{status:n.value,value:s.data}):(ce(r,{code:re.invalid_intersection_types}),ke)};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,a])=>o(i,a)):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}))}}Ws.create=(e,t,n)=>new Ws({left:e,right:t,typeName:Ee.ZodIntersection,..._e(n)});class Xn extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.array)return ce(r,{code:re.invalid_type,expected:fe.array,received:r.parsedType}),ke;if(r.data.length<this._def.items.length)return ce(r,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ke;!this._def.rest&&r.data.length>this._def.items.length&&(ce(r,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new $n(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>Ht.mergeArray(n,a)):Ht.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Xn({...this._def,rest:t})}}Xn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xn({items:e,typeName:Ee.ZodTuple,rest:null,..._e(t)})};class qs extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.object)return ce(r,{code:re.invalid_type,expected:fe.object,received:r.parsedType}),ke;const o=[],i=this._def.keyType,a=this._def.valueType;for(const s in r.data)o.push({key:i._parse(new $n(r,s,r.path,s)),value:a._parse(new $n(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?Ht.mergeObjectAsync(n,o):Ht.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Fe?new qs({keyType:t,valueType:n,typeName:Ee.ZodRecord,..._e(r)}):new qs({keyType:Wn.create(),valueType:t,typeName:Ee.ZodRecord,..._e(n)})}}class Hd extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.map)return ce(r,{code:re.invalid_type,expected:fe.map,received:r.parsedType}),ke;const o=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([s,l],c)=>({key:o._parse(new $n(r,s,r.path,[c,"key"])),value:i._parse(new $n(r,l,r.path,[c,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ke;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(c.value,u.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ke;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(c.value,u.value)}return{status:n.value,value:s}}}}Hd.create=(e,t,n)=>new Hd({valueType:t,keyType:e,typeName:Ee.ZodMap,..._e(n)});class Jo extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.set)return ce(r,{code:re.invalid_type,expected:fe.set,received:r.parsedType}),ke;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(ce(r,{code:re.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&&(ce(r,{code:re.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function a(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ke;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const s=[...r.data.values()].map((l,c)=>i._parse(new $n(r,l,r.path,c)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Jo({...this._def,minSize:{value:t,message:ve.toString(n)}})}max(t,n){return new Jo({...this._def,maxSize:{value:t,message:ve.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Jo.create=(e,t)=>new Jo({valueType:e,minSize:null,maxSize:null,typeName:Ee.ZodSet,..._e(t)});class Wi extends Fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.function)return ce(n,{code:re.invalid_type,expected:fe.function,received:n.parsedType}),ke;function r(s,l){return Fd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nd(),ua].filter(c=>!!c),issueData:{code:re.invalid_arguments,argumentsError:l}})}function o(s,l){return Fd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nd(),ua].filter(c=>!!c),issueData:{code:re.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof fa){const s=this;return Yt(async function(...l){const c=new dn([]),u=await s._def.args.parseAsync(l,i).catch(f=>{throw c.addIssue(r(l,f)),c}),d=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw c.addIssue(o(d,f)),c})})}else{const s=this;return Yt(function(...l){const c=s._def.args.safeParse(l,i);if(!c.success)throw new dn([r(l,c.error)]);const u=Reflect.apply(a,this,c.data),d=s._def.returns.safeParse(u,i);if(!d.success)throw new dn([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Wi({...this._def,args:Xn.create(t).rest(jo.create())})}returns(t){return new Wi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Wi({args:t||Xn.create([]).rest(jo.create()),returns:n||jo.create(),typeName:Ee.ZodFunction,..._e(r)})}}class Us extends Fe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Us.create=(e,t)=>new Us({getter:e,typeName:Ee.ZodLazy,..._e(t)});class Ks extends Fe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ce(n,{received:n.data,code:re.invalid_literal,expected:this._def.value}),ke}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ks.create=(e,t)=>new Ks({value:e,typeName:Ee.ZodLiteral,..._e(t)});function SS(e,t){return new to({values:e,typeName:Ee.ZodEnum,..._e(t)})}class to extends Fe{constructor(){super(...arguments),Ai.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{expected:qe.joinValues(r),received:n.parsedType,code:re.invalid_type}),ke}if($s(this,Ai)||xS(this,Ai,new Set(this._def.values)),!$s(this,Ai).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{received:n.data,code:re.invalid_enum_value,options:r}),ke}return Yt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return to.create(t,{...this._def,...n})}exclude(t,n=this._def){return to.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ai=new WeakMap;to.create=SS;class Ys extends Fe{constructor(){super(...arguments),Ii.set(this,void 0)}_parse(t){const n=qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==fe.string&&r.parsedType!==fe.number){const o=qe.objectValues(n);return ce(r,{expected:qe.joinValues(o),received:r.parsedType,code:re.invalid_type}),ke}if($s(this,Ii)||xS(this,Ii,new Set(qe.getValidEnumValues(this._def.values))),!$s(this,Ii).has(t.data)){const o=qe.objectValues(n);return ce(r,{received:r.data,code:re.invalid_enum_value,options:o}),ke}return Yt(t.data)}get enum(){return this._def.values}}Ii=new WeakMap;Ys.create=(e,t)=>new Ys({values:e,typeName:Ee.ZodNativeEnum,..._e(t)});class fa extends Fe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.promise&&n.common.async===!1)return ce(n,{code:re.invalid_type,expected:fe.promise,received:n.parsedType}),ke;const r=n.parsedType===fe.promise?n.data:Promise.resolve(n.data);return Yt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}fa.create=(e,t)=>new fa({type:e,typeName:Ee.ZodPromise,..._e(t)});class Qn extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{ce(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const a=o.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return ke;const l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?ke:l.status==="dirty"||n.value==="dirty"?Pi(l.value):l});{if(n.value==="aborted")return ke;const s=this._def.schema._parseSync({data:a,path:r.path,parent:r});return s.status==="aborted"?ke:s.status==="dirty"||n.value==="dirty"?Pi(s.value):s}}if(o.type==="refinement"){const a=s=>{const l=o.refinement(s,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 s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ke:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?ke:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(o.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Xo(a))return a;const s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Xo(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:n.value,value:s})):a);qe.assertNever(o)}}Qn.create=(e,t,n)=>new Qn({schema:e,typeName:Ee.ZodEffects,effect:t,..._e(n)});Qn.createWithPreprocess=(e,t,n)=>new Qn({schema:t,effect:{type:"preprocess",transform:e},typeName:Ee.ZodEffects,..._e(n)});class qn extends Fe{_parse(t){return this._getType(t)===fe.undefined?Yt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}qn.create=(e,t)=>new qn({innerType:e,typeName:Ee.ZodOptional,..._e(t)});class no extends Fe{_parse(t){return this._getType(t)===fe.null?Yt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}no.create=(e,t)=>new no({innerType:e,typeName:Ee.ZodNullable,..._e(t)});class Gs extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===fe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Gs.create=(e,t)=>new Gs({innerType:e,typeName:Ee.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._e(t)});class Zs extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vs(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new dn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new dn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zs.create=(e,t)=>new Zs({innerType:e,typeName:Ee.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._e(t)});class Wd extends Fe{_parse(t){if(this._getType(t)!==fe.nan){const r=this._getOrReturnCtx(t);return ce(r,{code:re.invalid_type,expected:fe.nan,received:r.parsedType}),ke}return{status:"valid",value:t.data}}}Wd.create=e=>new Wd({typeName:Ee.ZodNaN,..._e(e)});class TS extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class jl extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);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"?ke:i.status==="dirty"?(n.dirty(),Pi(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"?ke:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new jl({in:t,out:n,typeName:Ee.ZodPipeline})}}class Xs extends Fe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Xo(o)&&(o.value=Object.freeze(o.value)),o);return Vs(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Xs.create=(e,t)=>new Xs({innerType:e,typeName:Ee.ZodReadonly,..._e(t)});xt.lazycreate;var Ee;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ee||(Ee={}));Wn.create;eo.create;Wd.create;Qo.create;Ld.create;da.create;Vd.create;zs.create;Bs.create;$d.create;jo.create;Tr.create;zd.create;Nn.create;xt.create;xt.strictCreate;Hs.create;zp.create;Ws.create;Xn.create;qs.create;Hd.create;Jo.create;Wi.create;Us.create;Ks.create;to.create;Ys.create;fa.create;Qn.create;qn.create;no.create;Qn.createWithPreprocess;jl.create;const Az=e=>{if(typeof e!="string")try{e=JSON.stringify(e)}catch{return!1}try{return JSON.parse(e),!0}catch{return!1}},Iz=(e,t,n)=>{const r=t.length-1;for(let o=0;o<t.length;o++){const i=t[o];if(o===r)e[i]=n;else{if(!(i in e)||typeof e[i]!="object"){const a=t[o+1];e[i]=isNaN(Number(a))?{}:[]}e=e[i]}}},ES=e=>e.replace(/\[(\d+)]/g,".$1").split("."),Xt=(e,t,n)=>{const r=Array.isArray(t)?t.map(String):ES(t),o=structuredClone(e);return Iz(o,r,n),o},_z=(e,t)=>e.localeCompare(t),bo={},CS=e=>{const t=e._def.typeName;if(t==="ZodDefault")return e._def.defaultValue();if(t==="ZodObject")return kS(e);if(t==="ZodArray")return[];if("innerType"in e._def){const n=CS(e._def.innerType);return t==="ZodArray"?n??[]:n}},kS=e=>Object.fromEntries(Object.entries(e.shape).map(([t,n])=>[t,CS(n)])),RS=(e,t)=>{const n=structuredClone(e);for(const r in t){const o=t[r],i=e[r];o!==void 0&&(typeof o=="object"&&o!==null&&!Array.isArray(o)&&typeof i=="object"&&i!==null&&!Array.isArray(i)?n[r]=RS(i,o):n[r]=o||i)}return n},Oz={sort:_z,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},PS=e=>{const t=new FormData(e),n=new URLSearchParams(t);return iz.parse(n.toString(),Oz)},lr=(e,t)=>ES(e).reduce((n,r)=>{var i;if(r==="")return n;const o=((i=n.shape)==null?void 0:i[r])||n;return o._def.typeName==="ZodArray"?o.element:o},t),fr=e=>e.dataset.value?e.dataset.value:e.type==="checkbox"?e.checked:e.type==="number"?e.valueAsNumber:e.value||e.getAttribute("value"),Mu=e=>{const t=e.dataset.target;if(!t)return fr(e);const n=document.querySelector(`[data-origin="${t}"]`);return fr(n||e)},Mz={state:{},loading:!1,useOnChange:!1},qy=e=>e.dataset.target||e.name,jz=e=>{const t=`@use-form/${e}`;return{get:()=>{const n=Hi.LocalStorage.get(t);return Az(n)?n:{}},clear:()=>void Hi.LocalStorage.delete(t),set:n=>Hi.LocalStorage.set(t,n)}},Dz=(e,t,n=Mz)=>{const[r,o]=E.useState(null),i=E.useRef({}),[a,s]=E.useState(()=>Ve.function(n==null?void 0:n.state)?n.state():(n==null?void 0:n.state)??kS(e)??{}),l=E.useCallback(b=>{var P;const S=b.target,w=b.currentTarget;if(S.dataset.optional==="true")return;const C=qy(S),R=Mu(S)||(w?fr(w):""),I=lr(C,e);if(S.setAttribute("data-initialized","true"),I){const N=I.safeParse(R),j=N.success?void 0:((P=N.error.issues[0])==null?void 0:P.message)??"";o(L=>Xt(L??{},C,j))}},[e]),c=E.useCallback(b=>S=>{const w=S.currentTarget,T=Object.values(i.current).reduce((R,I)=>{var A;const P=I.element,N=I.schema.safeParse(fr(P));if(P.dataset.ignore==="ignore"||N.success)return R;const j=(A=N.error.issues[0])==null?void 0:A.message;P.setAttribute("data-initialized","true");const L=P.dataset.name||P.name||"";return Xt(R,L,j)},{}),C=Ve.empty(T)?null:T;o(C),console.error(C),b==null||b({form:w,errors:C||{}})},[]),u=(b,S=bo)=>{const w=lr(b,e),T=C=>{var I;if(!Mf(C))return;s(P=>Xt(P,b,C.toISOString())),o(P=>Xt(P,b,void 0));const R=i.current[b].element;if(R){const P=R.getAttribute("data-origin"),N=document.querySelector(`input[data-target="${P}"]`);N&&N.setCustomValidity("")}(I=S==null?void 0:S.onChange)==null||I.call(S,C)};return{...S,loading:n.loading,name:b,id:b,onChange:T,form:t,date:Ve.string(a[b])?new Date(a[b]):a[b],required:S.required??!w.isOptional(),error:Cn(r,b),ref:C=>{C!==null&&(i.current[b]={element:C,schema:w})}}},d=(b,S=bo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const R=C.target.value;s(P=>Xt(P,b,R)),(I=S==null?void 0:S.onChange)==null||I.call(S,C)},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),value:Cn(a,b,void 0)??"",required:S.required??!w.isOptional(),ref:C=>C!==null?i.current[b]={element:C,schema:w}:void 0}},p=(b,S=bo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const R=C.target.checked;s(P=>Xt(P??{},b,R)),(I=S==null?void 0:S.onChange)==null||I.call(S,C)},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),ref:C=>C!==null?void(i.current[b]={element:C,schema:w}):void 0}},f=(b,S=bo)=>{const w=lr(b,e),T=C=>{var I,P;(I=C.persist)==null||I.call(C);const R=C.target.value;(P=S==null?void 0:S.onChange)==null||P.call(S,C),s(N=>Xt(N,b,R))};return{...S,loading:n.loading,name:b,id:b,onChange:T,form:t,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),value:Cn(a,b,void 0)||(S==null?void 0:S.value)||"",type:Ve.instance(w,eo)?"number":(S==null?void 0:S.type)??"text",ref:C=>C===null?void 0:i.current[b]={element:C,schema:w}}},h=(b,S=bo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChangeOptions:C=>{s(R=>Xt(R,b,C))},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),value:Cn(a,b,void 0)||(S==null?void 0:S.value)||[],ref:C=>C===null?void 0:void(i.current[b]={element:C,schema:w})}},g=(b,S=bo)=>{const w=lr(b,e),T=w._def.typeName==="ZodNumber";return{...S,name:b,id:b,onChange:R=>{var P,N;(P=R.persist)==null||P.call(R);const I=T?R.target.valueAsNumber:R.target.value;(N=S==null?void 0:S.onChange)==null||N.call(S,R),s(j=>Xt(j,b,I))},form:t,loading:n.loading,onInvalid:l,error:Cn(r,b,void 0),required:S.required??!w.isOptional(),type:T?"number":(S==null?void 0:S.type)??"text",value:Cn(a,b,void 0)||(S==null?void 0:S.value)||"",ref:R=>R===null?void 0:void(i.current[b]={element:R,schema:w})}};E.useEffect(()=>{const b=Object.values(i.current).map(w=>{const T=w.element.dataset.origin?document.querySelector(`[data-target="${w.element.name}"]`):w.element,C=w.schema.safeParse(fr(T)),R=j=>{var F;const L=qy(j.target);if(!L)return!1;const A=j.target,O=Mu(j.target)||(j.relatedTarget?fr(j.relatedTarget):""),M=w.schema.safeParse(O);if(A.setAttribute("value",O),M.success)return T.setCustomValidity&&T.setCustomValidity(""),o(D=>{if(Ve.null(D))return null;const H=Xt(D,L,void 0);return Ve.empty(D)||Ve.nil(D)||Ve.empty(H)?null:H}),!1;if(T.required){const D=((F=M.error.issues[0])==null?void 0:F.message)||"";T.setCustomValidity&&T.setCustomValidity(D),o(H=>{if(Ve.null(H))return null;const _=Xt(H,L,D||void 0);return Ve.empty(_)?null:_})}return!1},I=new AbortController,P=T.getAttribute("data-trigger")||"blur";T.addEventListener(P,R,{signal:I.signal});const N=T.dataset.shadow?!1:T.required?!C.success:!1;return{input:w,hasInitialError:N,unsubscribe:()=>I.abort()}});return b.some(w=>w.hasInitialError)&&o(w=>w===null?{}:w),()=>b.forEach(w=>w.unsubscribe())});const m=b=>S=>{var N;S.preventDefault();const w=S.currentTarget;let T=PS(w);(t?Array.from(document.querySelectorAll(`[form="${t}"]`)):Array.from(w.elements)).forEach(j=>{if(j.tagName==="SELECT"){const L=j;T=Xt(T,L.name,L.value)}if(j.tagName==="INPUT"){const L=j,A=Mu(L)||(L?fr(L):"");T=Xt(T,L.dataset.target||L.name,A)}});const R=RS(T,a),I=e.safeParse(R),P=()=>{var j;vS(w),(j=n.interceptor)==null||j.clear()};if(I.success){const j=JSON.stringify(I.data);return w.setAttribute("data-json",j),(N=n.interceptor)==null||N.clear(),b==null?void 0:b(S,{form:w,event:S,reset:P,setErrors:o,errors:[],success:!0,data:I.data,json:I.data})}return console.group("useForm error"),console.info(I),console.info(I.error.issues),console.error(I.error),console.groupEnd(),w.reportValidity(),b==null?void 0:b(S,{form:w,json:T,event:S,reset:P,setErrors:o,data:T,success:!1,errors:I.error.issues.map(j=>({message:j.message,path:j.path.map(L=>String(L))}))})},v=b=>zf(a,b)||"",x=b=>({...b,id:t,name:t});return E.useEffect(()=>{var b;n.interceptor&&((b=n.interceptor)==null||b.set(a))},[a]),{get:v,input:g,state:a,errors:r,select:d,checkbox:p,onSubmit:m,setState:s,textarea:f,onInvalid:c,controller:x,datepicker:u,name:t,multiselect:h,disabled:r!==null}},Nz=e=>e?JSON.parse(e.getAttribute("data-json")):{},Fz=e=>{const t=E.useRef(void 0);return E.useEffect(()=>{t.current=e},[e]),t.current},AS={button:"0.55rem",pill:"2rem",card:"0.75rem",full:"9999px"},IS={base:"1rem",hairline:"0.0625rem",lg:"1.125rem",sm:"0.75rem","field-height":"1.5rem","field-label":"1.875rem","input-height":"2.5rem","input-x":"0.5rem","input-y":"0.25rem","input-inline":"0.25rem","input-gap":"0.3rem"},_S={normal:"1",navbar:"22",calendar:"2",overlay:"21",tooltip:"20",floating:"22"},Lz={name:"dark",zIndex:_S,rounded:AS,spacing:IS,shadow:{"shadow-notification":"1px 2px 2px 2px hsla(210, 25%, 40%, 0.15)","shadow-floating":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","shadow-card":"0px 1px 1px 1px hsla(210, 25%, 20%, 0.1)"},colors:{foreground:"hsla(210, 50%, 98%)",background:"hsla(0, 0%, 9%)",border:"hsla(240, 7%, 27%)",muted:"hsla(210, 10%, 40%)",disabled:"hsla(240, 4%, 33%)",emphasis:{foreground:"hsla(251, 91%, 95%)",DEFAULT:"hsla(255, 92%, 76%)",subtle:"hsla(252, 95%, 85%)",hover:"hsla(262, 83%, 58%)"},primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(200,98%,39%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{DEFAULT:"hsla(210, 32%, 70%)",background:"hsla(210, 30%, 81%)",subtle:"hsla(210, 27%, 88%)",hover:"hsla(210, 10%, 58%)",foreground:"hsla(210, 20%, 30%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 93%, 77%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 40%, 98%)",notification:"hsla(219, 91%, 59%)"},warn:{DEFAULT:"hsla(27, 96%, 61%)",subtle:"hsla(45, 95%, 66%)",hover:"hsla(21, 90%, 48%)",foreground:"hsla(210, 40%, 98%)",notification:"hsla(32, 65%, 75%)"},danger:{DEFAULT:"hsla(358, 65%, 57%)",subtle:"hsla(0, 94%, 81%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 40%, 98%)",notification:"hsla(358, 40%, 23%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 75%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(160, 91%, 50%)",notification:"hsla(161,62%,17%)"},input:{border:"hsla(240, 4%, 25%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 9%)",switch:"hsla(0, 0%, 100%)",slider:"hsla(0, 0%, 100%)"},card:{muted:"hsla(0, 0%, 22%)",border:"hsla(240, 7%, 20%)",background:"hsla(0, 0%, 15%)"},floating:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 14%)",hover:"hsla(221, 10%, 22%)",border:"hsla(240, 7%, 27%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 8%)",hover:"hsla(221, 10%, 35%)",border:"hsla(0, 0%, 19%)",overlay:"hsla(0, 0%, 0%)"},table:{header:"hsla(0, 0%, 12%)",border:"hsla(240, 4%, 20%)",background:"hsla(0, 0%, 15%)"},button:{primary:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},warn:{text:"hsla(26,100%,67%)",bg:"hsla(37,100%,15%)"},info:{text:"hsla(200,80%,70%)",bg:"hsla(206,66%,24%)"},success:{text:"hsla(151,65%,54%)",bg:"hsla(154,52%,19%)"},danger:{text:"hsla(2,100%,90%)",bg:"hsla(5,62%,23%)"},muted:{text:"hsla(0, 100%, 100%)",bg:"hsla(0, 0%, 12%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"}},tag:{primary:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},warn:{text:"hsla(26,100%,67%)",bg:"hsla(37,100%,15%)"},info:{text:"hsla(200,80%,70%)",bg:"hsla(206,66%,24%)"},success:{text:"hsla(151,65%,54%)",bg:"hsla(154,52%,19%)"},danger:{text:"hsla(2,100%,79%)",bg:"hsla(5,62%,23%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"},muted:{text:"hsla(0, 100%, 100%)",bg:"hsla(0, 0%, 12%)"}},alert:{primary:{text:"hsla(210,100%,72%)",border:"hsla(212,69%,16%)",bg:"hsla(215,42%,9%)"},warn:{bg:"hsla(28,33%,9%)",border:"hsla(29,65%,12%)",text:"hsla(27,100%,78%)"},info:{text:"hsla(253,100%,83%)",bg:"hsla(263,28%,11%)",border:"hsla(252,34%,51%)"},success:{text:"hsla(144,79%,79%)",bg:"hsla(153,20%,9%)",border:"hsla(144,70%,14%)"},danger:{text:"hsla(350,100%,91%)",bg:"hsla(355,25%,15%)",border:"hsla(355,25%,10%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)",border:"hsla(200,90%,89%)"},secondary:{text:"hsla(220,9%,94%)",bg:"hsla(220,6%,10%)",border:"hsla(214,7%,19%)"},muted:{bg:"hsla(0, 0%, 12%)",border:"hsla(0, 0%, 40%)",text:"hsla(0, 100%, 100%)"}}}},Vz={rounded:AS,spacing:IS,name:"light",shadow:{"shadow-notification":"1px 2px 2px 2px hsla(210, 25%, 40%, 0.15)","shadow-floating":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","shadow-card":"0px 1px 1px 1px hsla(210, 25%, 20%, 0.1)"},zIndex:_S,colors:{foreground:"hsla(217, 15%, 30%)",background:"hsla(210, 40%, 98%)",border:"hsla(210, 25%, 88%)",muted:"hsla(210, 30%, 86%)",disabled:"hsla(240, 10%, 78%)",emphasis:{foreground:"hsla(251,91%,95%)",DEFAULT:"hsla(255,92%,76%)",subtle:"hsla(252,95%,85%)",hover:"hsla(262,83%,58%)"},primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(199, 89%, 54%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{background:"hsla(210, 25%, 35%)",DEFAULT:"hsla(210, 25%, 45%)",subtle:"hsla(207, 29%, 39%)",hover:"hsla(210, 21%, 67%)",foreground:"hsla(210, 40%, 98%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 70%, 90%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 34%, 96%)",notification:"hsla(219, 91%, 59%)"},danger:{DEFAULT:"hsla(0, 82%, 63%)",subtle:"hsla(0, 96%, 95%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 34%, 96%)",notification:"hsla(0, 100%, 87%)"},warn:{DEFAULT:"hsla(27, 100%, 70%)",subtle:"hsla(45, 95%, 80%)",hover:"hsla(29, 85%, 50%)",foreground:"hsla(210, 34%, 96%)",notification:"hsla(27, 85%, 92%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 90%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(160, 91%, 17%)",notification:"hsla(160, 75%, 80%)"},input:{border:"hsla(218, 22%, 85%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 45%)",switch:"hsla(0, 0%, 100%)",slider:"hsla(0, 0%, 100%)"},card:{muted:"hsla(210, 25%, 94%)",border:"hsla(210, 25%, 95%)",background:"hsla(0, 0%, 100%)"},floating:{foreground:"hsla(217, 15%, 20%)",background:"hsla(0, 0%, 100%)",hover:"hsla(0, 0%, 92%)",border:"hsla(210, 25%, 88%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(217, 15%, 20%)",background:"hsla(210, 25%, 98%)",hover:"hsla(210, 25%, 92%)",border:"hsla(200, 1%, 80%)",overlay:"hsla(0, 0%, 0%)"},table:{header:"hsla(221, 20%, 97%)",background:"hsla(0, 0%, 100%)",border:"hsla(210, 20%, 92%)"},button:{muted:{bg:"hsla(210, 30%, 86%)",text:"hsla(210, 10%, 15%)"},primary:{text:"hsla(0, 0%, 100%)",bg:"hsla(207,96%,48%)"},warn:{bg:"hsla(26,90%,60%)",text:"hsla(0, 0%, 100%)"},info:{text:"hsla(0, 0%, 100%)",bg:"hsla(210,60%,60%)"},success:{text:"hsla(0, 0%, 100%)",bg:"hsla(152,56%,39%)"},danger:{text:"hsla(0, 0%, 100%)",bg:"hsla(10,78%,54%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"}},tag:{muted:{bg:"hsla(210, 30%, 92%)",text:"hsla(210, 10%, 25%)"},primary:{text:"hsla(0, 0%, 100%)",bg:"hsla(207,70%,55%)"},warn:{bg:"hsla(30,100%,82%)",text:"hsla(23,100%,40%)"},info:{text:"hsla(196,100%,20%)",bg:"hsla(197,65%,80%)"},success:{text:"hsla(154,52%,19%)",bg:"hsla(152,56%,80%)"},danger:{text:"hsla(10,82%,45%)",bg:"hsla(359,94%,92%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)"},secondary:{text:"hsla(216,10%,90%)",bg:"hsla(214,7%,19%)"}},alert:{muted:{bg:"hsla(210, 30%, 86%)",text:"hsla(210, 30%, 86%)",border:"hsla(210, 10%, 70%)"},primary:{text:"hsla(206,70%,50%)",border:"hsla(206,90%,89%)",bg:"hsla(205,92%,95%)"},warn:{bg:"hsla(23,100%,96%)",text:"hsla(23,93%,53%)",border:"hsla(33,100%,85%)"},info:{text:"hsla(252,56%,57%)",bg:"hsla(256,100%,95%)",border:"hsla(252,76%,84%)"},success:{text:"hsla(152,56%,39%)",bg:"hsla(139,47%,93%)",border:"hsla(152,58%,78%)"},danger:{text:"hsla(358,69%,55%)",bg:"hsla(357,90%,96%)",border:"hsla(359,100%,90%)"},neutral:{text:"hsla(200,98%,60%)",bg:"hsla(200,28%,19%)",border:"hsla(200,90%,89%)"},secondary:{text:"hsla(216,10%,10%)",bg:"hsla(214,7%,92%)",border:"hsla(216,22%,78%)"}}}},$z=Lz,zz=Vz,Bz=e=>{const t=E.useMemo(()=>({locale:e.locale,tweaks:{...vl,...e.tweaks},parser:e.parser||hl.hsla,map:{...gl,...e.map}}),[e]);return y.jsx(si.Provider,{value:t,children:e.children})},Hz=()=>{const e=E.useContext(si);return e?e.parser:hl.hsla};exports.Alert=kI;exports.Autocomplete=OF;exports.Button=tl;exports.Calendar=B0;exports.Card=Hf;exports.Checkbox=_p;exports.ColType=Mo;exports.Collapse=d0;exports.CommandPalette=$2;exports.ComponentsProvider=Bz;exports.Context=si;exports.DatePicker=jF;exports.Dict=yn;exports.Dropdown=hi;exports.Empty=H0;exports.Expand=z2;exports.FileUpload=XL;exports.Form=QL;exports.Input=Pa;exports.InputFeedback=I1;exports.InputField=Ra;exports.Menu=W2;exports.MenuItem=H2;exports.Modal=dp;exports.MultiSelect=iV;exports.Notifications=bj;exports.Polymorph=un;exports.Radiobox=aV;exports.RenderOnView=fE;exports.Select=Qr;exports.Slider=BV;exports.Stats=wj;exports.Switch=HV;exports.Tab=Cj;exports.Table=ez;exports.Tabs=Tj;exports.Tag=cs;exports.TaskList=WV;exports.Textarea=qV;exports.Timeline=kj;exports.TimelineItem=bl;exports.Toolbar=q2;exports.Tooltip=fp;exports.TransferList=YV;exports.createColumns=x$;exports.createCssProperties=mM;exports.createDesignTokens=N0;exports.createFormStorage=jz;exports.createOptionCols=Fp;exports.createStyles=dM;exports.createTheme=pM;exports.createTokenStyles=hM;exports.css=Ie;exports.defaultDarkTheme=$z;exports.defaultLightTheme=zz;exports.defaultTranslations=gl;exports.defaultTweaks=vl;exports.dispatchInput=px;exports.formReset=vS;exports.formToJson=PS;exports.getCoords=sE;exports.getJsonForm=Nz;exports.getModalScrollerRef=E$;exports.getRemainingSize=qi;exports.getSchemaShape=lr;exports.hasVerticalScroll=mx;exports.initializeInputDataset=ma;exports.isMobile=V0;exports.isReactComponent=aE;exports.isReactFC=Gd;exports.isSsr=yr;exports.mergeRefs=Un;exports.negate=gM;exports.noop=Bf;exports.parsers=hl;exports.path=zf;exports.reduceTokens=cr;exports.safeRegex=ad;exports.splitInto=L0;exports.useColorParser=Hz;exports.useForm=Dz;exports.useLocale=$f;exports.useNotification=yj;exports.usePrevious=Fz;exports.useReactive=fw;exports.useStableRef=gr;exports.useSwipe=F0;exports.useTablePreferences=S$;exports.useTranslations=Ct;exports.uuid=li;
242
242
  //# sourceMappingURL=index.js.map