@g4rcez/components 1.1.0 → 1.1.1

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
@@ -208,5 +208,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
208
208
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D1(e,t){if(e){if(typeof e=="string")return Ed(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 Ed(e,t)}}function Ed(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 QF(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 JF(e){if(Array.isArray(e))return e}var eL=typeof bu=="function"?bu:bu.default,tL="file-invalid-type",nL="file-too-large",rL="file-too-small",oL="too-many-files",iL=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:tL,message:"File type must be ".concat(r)}},my=function(t){return{code:nL,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},hy=function(t){return{code:rL,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},aL={code:oL,message:"Too many files"};function j1(e,t){var n=e.type==="application/x-moz-file"||eL(e,t);return[n,n?null:iL(t)]}function N1(e,t,n){if($r(e.size))if($r(t)&&$r(n)){if(e.size>n)return[!1,my(n)];if(e.size<t)return[!1,hy(t)]}else{if($r(t)&&e.size<t)return[!1,hy(t)];if($r(n)&&e.size>n)return[!1,my(n)]}return[!0,null]}function $r(e){return e!=null}function sL(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=j1(l,n),u=da(c,1),d=u[0],p=N1(l,r,o),f=da(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 Ja(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 gy(e){e.preventDefault()}function lL(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function cL(e){return e.indexOf("Edge/")!==-1}function uL(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return lL(e)||cL(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 dL(){return"showOpenFilePicker"in window}function fL(e){if($r(e)){var t=Object.entries(e).filter(function(n){var r=da(n,2),o=r[0],i=r[1],a=!0;return F1(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(L1))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(n,r){var o=da(r,2),i=o[0],a=o[1];return py(py({},n),{},M1({},i,a))},{});return[{description:"Files",accept:t}]}return e}function pL(e){if($r(e))return Object.entries(e).reduce(function(t,n){var r=da(n,2),o=r[0],i=r[1];return[].concat(dy(t),[o],dy(i))},[]).filter(function(t){return F1(t)||L1(t)}).join(",")}function mL(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function hL(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function F1(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function L1(e){return/^.*\.[\w]+$/.test(e)}var gL=["children"],vL=["open"],yL=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],xL=["refKey","onChange","onClick"];function bL(e){return TL(e)||SL(e)||V1(e)||wL()}function wL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
209
209
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SL(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function TL(e){if(Array.isArray(e))return Cd(e)}function wu(e,t){return kL(e)||CL(e,t)||V1(e,t)||EL()}function EL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
210
210
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V1(e,t){if(e){if(typeof e=="string")return Cd(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 Cd(e,t)}}function Cd(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 CL(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 kL(e){if(Array.isArray(e))return e}function vy(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?vy(Object(n),!0).forEach(function(r){kd(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kd(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=RL(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 RL(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 _p=E.forwardRef(function(e,t){var n=e.children,r=Fs(e,gL),o=z1(r),i=o.open,a=Fs(o,vL);return E.useImperativeHandle(t,function(){return{open:i}},[i]),E.createElement(E.Fragment,null,n(mt(mt({},a),{},{open:i})))});_p.displayName="Dropzone";var $1={disabled:!1,getFilesFromEvent:FF,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};_p.defaultProps=$1;_p.propTypes={children:rt.func,accept:rt.objectOf(rt.arrayOf(rt.string)),multiple:rt.bool,preventDropOnDocument:rt.bool,noClick:rt.bool,noKeyboard:rt.bool,noDrag:rt.bool,noDragEventsBubbling:rt.bool,minSize:rt.number,maxSize:rt.number,maxFiles:rt.number,disabled:rt.bool,getFilesFromEvent:rt.func,onFileDialogCancel:rt.func,onFileDialogOpen:rt.func,useFsAccessApi:rt.bool,autoFocus:rt.bool,onDragEnter:rt.func,onDragLeave:rt.func,onDragOver:rt.func,onDrop:rt.func,onDropAccepted:rt.func,onDropRejected:rt.func,onError:rt.func,validator:rt.func};var Rd={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function z1(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=mt(mt({},$1),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,k=t.onError,I=t.validator,A=E.useMemo(function(){return pL(n)},[n]),j=E.useMemo(function(){return fL(n)},[n]),D=E.useMemo(function(){return typeof m=="function"?m:yy},[m]),F=E.useMemo(function(){return typeof g=="function"?g:yy},[g]),P=E.useRef(null),O=E.useRef(null),_=E.useReducer(PL,Rd),V=wu(_,2),N=V[0],$=V[1],M=N.isFocused,B=N.isFileDialogActive,X=E.useRef(typeof window<"u"&&window.isSecureContext&&v&&dL()),Q=function(){!X.current&&B&&setTimeout(function(){if(O.current){var te=O.current.files;te.length||($({type:"closeDialog"}),F())}},300)};E.useEffect(function(){return window.addEventListener("focus",Q,!1),function(){window.removeEventListener("focus",Q,!1)}},[O,B,F,X]);var J=E.useRef([]),G=function(te){P.current&&P.current.contains(te.target)||(te.preventDefault(),J.current=[])};E.useEffect(function(){return b&&(document.addEventListener("dragover",gy,!1),document.addEventListener("drop",G,!1)),function(){b&&(document.removeEventListener("dragover",gy),document.removeEventListener("drop",G))}},[P,b]),E.useEffect(function(){return!r&&x&&P.current&&P.current.focus(),function(){}},[P,x,r]);var Y=E.useCallback(function(q){k?k(q):console.error(q)},[k]),Z=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q),J.current=[].concat(bL(J.current),[q.target]),Ja(q)&&Promise.resolve(o(q)).then(function(te){if(!(Ns(q)&&!C)){var me=te.length,Oe=me>0&&sL({files:te,accept:A,minSize:a,maxSize:i,multiple:s,maxFiles:l,validator:I}),He=me>0&&!Oe;$({isDragAccept:Oe,isDragReject:He,isDragActive:!0,type:"setDraggedFiles"}),c&&c(q)}}).catch(function(te){return Y(te)})},[o,c,Y,C,A,a,i,s,l,I]),L=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q);var te=Ja(q);if(te&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return te&&d&&d(q),!1},[d,C]),z=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q);var te=J.current.filter(function(Oe){return P.current&&P.current.contains(Oe)}),me=te.indexOf(q.target);me!==-1&&te.splice(me,1),J.current=te,!(te.length>0)&&($({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Ja(q)&&u&&u(q))},[P,u,C]),K=E.useCallback(function(q,te){var me=[],Oe=[];q.forEach(function(He){var Ye=j1(He,A),Ot=wu(Ye,2),pn=Ot[0],En=Ot[1],er=N1(He,a,i),tr=wu(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(et){return et})})}}),(!s&&me.length>1||s&&l>=1&&me.length>l)&&(me.forEach(function(He){Oe.push({file:He,errors:[aL]})}),me.splice(0)),$({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)},[$,s,A,a,i,l,p,f,h,I]),ie=E.useCallback(function(q){q.preventDefault(),q.persist(),be(q),J.current=[],Ja(q)&&Promise.resolve(o(q)).then(function(te){Ns(q)&&!C||K(te,q)}).catch(function(te){return Y(te)}),$({type:"reset"})},[o,K,Y,C]),H=E.useCallback(function(){if(X.current){$({type:"openDialog"}),D();var q={multiple:s,types:j};window.showOpenFilePicker(q).then(function(te){return o(te)}).then(function(te){K(te,null),$({type:"closeDialog"})}).catch(function(te){mL(te)?(F(te),$({type:"closeDialog"})):hL(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&&($({type:"openDialog"}),D(),O.current.value=null,O.current.click())},[$,D,F,v,K,Y,j,s]),ye=E.useCallback(function(q){!P.current||!P.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),H())},[P,H]),Te=E.useCallback(function(){$({type:"focus"})},[]),Re=E.useCallback(function(){$({type:"blur"})},[]),$e=E.useCallback(function(){S||(uL()?setTimeout(H,0):H())},[S,H]),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,yL);return mt(mt(kd({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,L)),onDragLeave:le(kn(tr,z)),onDrop:le(kn(nr,ie)),role:typeof Oe=="string"&&Oe!==""?Oe:"presentation"},me,P),!r&&!w?{tabIndex:0}:{}),W)}},[P,ye,Te,Re,$e,Z,L,z,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,xL),Ot=kd({accept:A,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({},N),{},{isFocused:M&&!r,getRootProps:oe,getInputProps:ee,rootRef:P,inputRef:O,open:se(H)})}function PL(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({},Rd),{},{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({},Rd);default:return e}}function yy(){}const AL={isImage:e=>e.type.includes("image")},IL=e=>{const[t,n]=E.useState({url:"",type:"",size:""});return E.useEffect(()=>{if(AL.isImage(e.file)){const r=URL.createObjectURL(e.file);return n({url:r,type:"img",size:Zv(e.file.size)}),()=>{URL.revokeObjectURL(r)}}n({url:"",type:e.file.type,size:Zv(e.file.size)})},[e.file]),t.type==="img"?y.jsxs("div",{className:"gap-jade-200 flex w-full flex-row items-center justify-between",children:[y.jsxs("header",{className:"gap-jade-200 flex flex-row items-center",children:[y.jsx("img",{src:t.url,className:"size-jade-500 rounded-jade-xsmall",alt:`Miniatura do arquivo ${e.file.name}`}),y.jsxs("div",{className:"flex flex-col",children:[y.jsx("span",{children:e.file.name}),y.jsx("span",{children:t.size})]})]}),y.jsx(Do,{className:"isolate",type:"button",theme:"raw",onClick:r=>{var o;r.stopPropagation(),(o=e.onDeleteFile)==null||o.call(e,e.file)},children:y.jsx(Vo,{})})]}):y.jsxs("div",{className:"gap-jade-200 flex w-full flex-row items-center justify-between",children:[y.jsxs("header",{className:"flex flex-row items-center gap-4",children:[y.jsx(a0,{size:48}),y.jsxs("div",{className:"flex flex-col items-start justify-start text-left",children:[y.jsx("span",{children:e.file.name}),y.jsx("span",{children:t.size})]})]}),y.jsx(Do,{className:"isolate",type:"button",theme:"raw",onClick:r=>{var o;r.stopPropagation(),(o=e.onDeleteFile)==null||o.call(e,e.file)},children:y.jsx(Vo,{className:"text-danger"})})]})},_L=e=>y.jsx("ul",{className:"space-y-jade-200 w-full",children:e.files.map(t=>y.jsx(IL,{onDeleteFile:e.onDeleteFile,file:t},t.name))}),OL=e=>e.isDragActive?y.jsx("p",{children:"Solte os arquivos selecionados"}):e.files.length>0?y.jsx(_L,{onDeleteFile:e.onDeleteFile,files:e.files}):y.jsx(E.Fragment,{children:e.idle}),ML=y.jsxs("div",{className:"flex flex-col items-center justify-center gap-4",children:[y.jsx(sI,{size:64}),y.jsxs("p",{children:["You can drag your files or"," ",y.jsx("button",{className:"text-primary underline",type:"button",children:"drag to here"})]})]}),DL=({idle:e=ML,onDeleteFile:t,onDrop:n,...r})=>{var u;const[o,i]=E.useState([]),a=d=>{n==null||n(d),i(d)},{getRootProps:s,getInputProps:l,isDragActive:c}=z1({onDrop:a});return y.jsxs("div",{...s(),"data-active":(u=r.files)!=null&&u.length?r.files.length>0:!1,className:"flex flex-col items-center justify-center rounded-lg border-2 border-card-border p-6 text-foreground data-[active=true]:border-solid data-[active=false]:border-dashed data-[active=true]:bg-card-background",children:[y.jsx("input",{...l(r),name:r.name,id:r.name}),y.jsx(OL,{onDeleteFile:t,isDragActive:c,idle:e,files:r.files??o})]})},jL=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})},xy=40,NL=e=>y.jsx(E.Fragment,{children:e.children}),FL={duration:300,initial:{transform:"scaleY(0)",opacity:.2},open:{transform:"scaleY(1)",opacity:1},close:{transform:"scaleY(0)",opacity:0}},by=[],LL=E.forwardRef(function(t,n){return y.jsx(ft.ul,{...t,role:"listbox",ref:n,className:"w-full rounded-b-lg border-b border-tooltip-border last:border-transparent",children:y.jsx(wr,{children:t.children})})}),VL=E.forwardRef(function({item:t,context:n,...r},o){return y.jsx(ft.li,{...r,ref:o,className:"last:rounded-t-lg"})}),$L={List:LL,Item:VL},zL=e=>{const t=At(),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(Yd,{size:"small","data-multicounter":"true",children:[r," ",t.multiSelectSelectedLabel]}):e.children})},BL=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??by,T=At(),[C,k]=E.useState(0),[I,A]=E.useState(!1),[j,D]=E.useState(""),[F,P]=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(F.keys()),[F]),[_,V]=E.useState(()=>{const ee=new Set(w);return r.reduce((q,te)=>ee.has(te.value)?[...q,te.label??te.value]:q,[])??w}),[N,$]=E.useState(null),M=E.useRef(by),B=h&&j!==""?[{value:j,label:j,"data-dynamic":"true"},...r]:r,X=j.length===0?B:sp(B,"value",[{key:"value",value:j},{key:"label",value:j}]),Q=cp(I,"block-only"),J=X.filter(ee=>ee.hidden!==!0),G=J.length===0,{x:Y,y:Z,strategy:L,refs:z,context:K}=kr({open:I,transform:!0,placement:"bottom-start",strategy:"absolute",onOpenChange:A,whileElementsMounted:fi,middleware:[Sa(4),Pw({padding:10,elementContext:"reference",apply(ee){const q=ee.elements.floating.querySelector("ul"),te=(q==null?void 0:q.getBoundingClientRect().height)||0,me=Ki(z.reference.current,window.innerHeight),Oe=Math.min(te<xy?me:te,me,ee.availableHeight),He=J.length===0?xy:Math.min(Oe,me,te),Ye=`${b.current.getBoundingClientRect().width}px`;Object.assign(ee.elements.floating.style,{width:Ye,maxWidth:Ye,height:He})}})]}),ie=qw(K,FL),{getReferenceProps:H,getFloatingProps:ye,getItemProps:Te}=Rr([so(K,{role:"listbox"}),ao(K),El(K,{cols:0,listRef:M,loop:!0,virtual:!0,allowEscape:!0,activeIndex:N,selectedIndex:N,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,scrollItemIntoView:!0,onNavigate:ee=>$(q=>ee??q)})]);E.useEffect(()=>{if(!I)return k(0);const ee=z.reference;if(ee.current===null)return;const q=Ki(ee.current,window.innerHeight);setTimeout(()=>k(Math.min(q,J.length*40)),100)},[j,I,z.reference]),E.useEffect(()=>{m.value&&P(new yn(m.value.map(ee=>[ee,x.get(ee)])))},[m.value,x]),E.useEffect(()=>{const ee=z.reference.current;if(ee)return ga(ee)},[]);const Re=(ee,q)=>{const te=F.clone(He=>He.has(ee.value)?He.remove(ee.value):He.set(ee.value,ee));P(te);const me=z.reference.current;if(!me)return;const Oe=te.map(He=>He.value);me==null||me.setAttribute("data-value",JSON.stringify(Oe)),g&&g(Oe),V(He=>He.concat(ee.label??"")),D(""),$(q)},$e=ee=>{const q=ee.target.value;return D(q),!I&&q===""?A(!0):(ee.target.name=m.name||"",q?A(!0):void 0)},se=()=>{var ee;A(!0),D(""),(ee=z.reference.current)==null||ee.focus()},xe=()=>{A(!0),D("")},le=()=>{var ee;(ee=z.reference.current)==null||ee.setAttribute("data-value","[]"),D(""),A(!1),P(new yn),g==null||g([])},be=m.id||m.name,oe=F.map((ee,q)=>y.jsx(Yd,{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(dl,{size:14})}),children:ee.label??ee.value},`MultiSelect-${ee.value}-x`)),ue={height:G?"0":F.size===0?C-49:C-86};return y.jsxs(Pa,{...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(Af,{size:20}),y.jsx("span",{className:"sr-only",children:T.inputCaretDown})]}),F?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",{...H({...m,onFocus:xe,id:`${be}-shadow`,name:`${be}-shadow`,ref:z.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(zL,{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(Ww,{lockScroll:!0,children:y.jsx(hi,{modal:!0,guards:!0,returnFocus:!1,context:K,initialFocus:-1,visuallyHiddenDismiss:!0,children:y.jsxs("div",{...ye({ref:z.setFloating,style:{...ie.styles,top:Z??0,position:L,left:Y,height:C-(O.length===0?65:30)}}),"data-floating":"true",className:"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 shadow-floating",children:[y.jsx("input",{autoFocus:!0,value:j,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=N+1;return me>J.length-1&&(me=0),(q=S.current)==null||q.scrollIntoView({index:me}),$(me)}if(ee.key==="ArrowUp"){let me=N-1;return me<0&&(me=J.length-1),(te=S.current)==null||te.scrollIntoView({index:me}),$(me)}if(ee.key==="Escape")return ee.currentTarget.blur(),A(!1);if(ee.key==="Enter"){if(N!==null&&J[N])return ee.preventDefault(),Re(J[N],N);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(ft.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 k(0);const q=z.floating.current.querySelectorAll("li").item(0),te=(q?q.getBoundingClientRect().height:40)*J.length;return ha.flushSync(()=>k(te+2))},children:y.jsx(kp,{ref:S,hidden:G,data:J,components:$L,style:ue,className:"max-h-72 border-floating-border bg-floating-background p-0 text-foreground",itemContent:(ee,q)=>{const te=q.Render??NL,me=F.has(q.value)||F.has(q.label??""),Oe=N===ee,He=q.label??q.value;return y.jsxs("button",{"data-value":q.value,...Te({ref:Ye=>void(M.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(Ap,{onChange:zf,checked:me,"aria-checked":me,onClick:Ye=>{Ye.stopPropagation(),Re(q,ee)}}),y.jsx(te,{...m,label:q.label,value:q.value,children:He})]})}})}),F.size===0?null: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:oe})]})})}):null})]})}),HL=({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=At(),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=ga(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(Pa,{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(Af,{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 B1(e,[t,n]){return Math.min(n,Math.max(t,e))}function Po(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 wy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function H1(...e){return t=>{let n=!1;const r=e.map(o=>{const i=wy(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():wy(e[o],null)}}}}function Jr(...e){return R.useCallback(H1(...e),e)}function W1(e,t=[]){let n=[];function r(i,a){const s=R.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=R.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=R.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=>R.createContext(a));return function(s){const l=(s==null?void 0:s[e])||i;return R.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return o.scopeName=e,[r,WL(o,...t)]}function WL(...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 R.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function q1(e){const t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function qL({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=UL({defaultProp:t,onChange:n}),i=e!==void 0,a=i?e:r,s=q1(n),l=R.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 UL({defaultProp:e,onChange:t}){const n=R.useState(e),[r]=n,o=R.useRef(r),i=q1(t);return R.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var KL=R.createContext(void 0);function YL(e){const t=R.useContext(KL);return e||t||"ltr"}function GL(e){const t=R.useRef({value:e,previous:e});return R.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ZL=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{};function XL(e){const[t,n]=R.useState(void 0);return ZL(()=>{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 Pd(e){const t=QL(e),n=R.forwardRef((r,o)=>{const{children:i,...a}=r,s=R.Children.toArray(i),l=s.find(eV);if(l){const c=l.props.children,u=s.map(d=>d===l?R.Children.count(c)>1?R.Children.only(null):R.isValidElement(c)?c.props.children:null:d);return y.jsx(t,{...a,ref:o,children:R.isValidElement(c)?R.cloneElement(c,void 0,u):null})}return y.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function QL(e){const t=R.forwardRef((n,r)=>{const{children:o,...i}=n;if(R.isValidElement(o)){const a=nV(o),s=tV(i,o.props);return o.type!==R.Fragment&&(s.ref=r?H1(r,a):a),R.cloneElement(o,s)}return R.Children.count(o)>1?R.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JL=Symbol("radix.slottable");function eV(e){return R.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JL}function tV(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 nV(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 rV=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Il=rV.reduce((e,t)=>{const n=Pd(`Primitive.${t}`),r=R.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 oV(e){const t=e+"CollectionProvider",[n,r]=W1(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=Pd(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=Pd(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 U1=["PageUp","PageDown"],K1=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Y1={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},bi="Slider",[Ad,iV,aV]=oV(bi),[G1,Az]=W1(bi,[aV]),[sV,_l]=G1(bi),Z1=R.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=R.useRef(new Set),v=R.useRef(0),b=a==="horizontal"?lV:cV,[S=[],w]=qL({prop:u,defaultProp:c,onChange:j=>{var F;(F=[...m.current][v.current])==null||F.focus(),d(j)}}),T=R.useRef(S);function C(j){const D=mV(S,j);A(j,D)}function k(j){A(j,v.current)}function I(){const j=T.current[v.current];S[v.current]!==j&&p(S)}function A(j,D,{commit:F}={commit:!1}){const P=yV(i),O=xV(Math.round((j-r)/i)*i+r,P),_=B1(O,[r,o]);w((V=[])=>{const N=fV(V,_,D);if(vV(N,l*i)){v.current=N.indexOf(_);const $=String(N)!==String(V);return $&&F&&p(N),$?N:V}else return V})}return y.jsx(sV,{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(Ad.Provider,{scope:e.__scopeSlider,children:y.jsx(Ad.Slot,{scope:e.__scopeSlider,children:y.jsx(b,{"aria-disabled":s,"data-disabled":s?"":void 0,...g,ref:t,onPointerDown:Po(g.onPointerDown,()=>{s||(T.current=S)}),min:r,max:o,inverted:f,onSlideStart:s?void 0:C,onSlideMove:s?void 0:k,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&A(r,0,{commit:!0}),onEndKeyDown:()=>!s&&A(o,S.length-1,{commit:!0}),onStepKeyDown:({event:j,direction:D})=>{if(!s){const O=U1.includes(j.key)||j.shiftKey&&K1.includes(j.key)?10:1,_=v.current,V=S[_],N=i*O*D;A(V+N,_,{commit:!0})}}})})})})});Z1.displayName=bi;var[X1,Q1]=G1(bi,{startEdge:"left",endEdge:"right",size:"width",direction:1}),lV=R.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=e,[d,p]=R.useState(null),f=Jr(t,b=>p(b)),h=R.useRef(void 0),g=YL(o),m=g==="ltr",v=m&&!i||!m&&i;function x(b){const S=h.current||d.getBoundingClientRect(),w=[0,S.width],C=Op(w,v?[n,r]:[r,n]);return h.current=S,C(b-S.left)}return y.jsx(X1,{scope:e.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width",children:y.jsx(J1,{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=Y1[v?"from-left":"from-right"].includes(b.key);c==null||c({event:b,direction:w?-1:1})}})})}),cV=R.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:l,...c}=e,u=R.useRef(null),d=Jr(t,u),p=R.useRef(void 0),f=!o;function h(g){const m=p.current||u.current.getBoundingClientRect(),v=[0,m.height],b=Op(v,f?[r,n]:[n,r]);return p.current=m,b(g-m.top)}return y.jsx(X1,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:y.jsx(J1,{"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=Y1[f?"from-bottom":"from-top"].includes(g.key);l==null||l({event:g,direction:v?-1:1})}})})}),J1=R.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:l,...c}=e,u=_l(bi,n);return y.jsx(Il.span,{...c,ref:t,onKeyDown:Po(e.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):U1.concat(K1).includes(d.key)&&(l(d),d.preventDefault())}),onPointerDown:Po(e.onPointerDown,d=>{const p=d.target;p.setPointerCapture(d.pointerId),d.preventDefault(),u.thumbs.has(p)?p.focus():r(d)}),onPointerMove:Po(e.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:Po(e.onPointerUp,d=>{const p=d.target;p.hasPointerCapture(d.pointerId)&&(p.releasePointerCapture(d.pointerId),i(d))})})}),eS="SliderTrack",tS=R.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=_l(eS,n);return y.jsx(Il.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...r,ref:t})});tS.displayName=eS;var Id="SliderRange",nS=R.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=_l(Id,n),i=Q1(Id,n),a=R.useRef(null),s=Jr(t,a),l=o.values.length,c=o.values.map(p=>oS(p,o.min,o.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return y.jsx(Il.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...r,ref:s,style:{...e.style,[i.startEdge]:u+"%",[i.endEdge]:d+"%"}})});nS.displayName=Id;var _d="SliderThumb",rS=R.forwardRef((e,t)=>{const n=iV(e.__scopeSlider),[r,o]=R.useState(null),i=Jr(t,s=>o(s)),a=R.useMemo(()=>r?n().findIndex(s=>s.ref.current===r):-1,[n,r]);return y.jsx(uV,{...e,ref:i,index:a})}),uV=R.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:o,...i}=e,a=_l(_d,n),s=Q1(_d,n),[l,c]=R.useState(null),u=Jr(t,x=>c(x)),d=l?a.form||!!l.closest("form"):!0,p=XL(l),f=a.values[r],h=f===void 0?0:oS(f,a.min,a.max),g=pV(r,a.values.length),m=p==null?void 0:p[s.size],v=m?hV(m,h,s.direction):0;return R.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(Ad.ItemSlot,{scope:e.__scopeSlider,children:y.jsx(Il.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:Po(e.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),d&&y.jsx(dV,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:f},r)]})});rS.displayName=_d;var dV=e=>{const{value:t,...n}=e,r=R.useRef(null),o=GL(t);return R.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 fV(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,i)=>o-i)}function oS(e,t,n){const i=100/(n-t)*(e-t);return B1(i,[0,100])}function pV(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function mV(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 hV(e,t,n){const r=e/2,i=Op([0,50],[0,r]);return(r-i(t)*n)*n}function gV(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function vV(e,t){if(t>0){const n=gV(e);return Math.min(...n)>=t}return!0}function Op(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 yV(e){return(String(e).split(".")[1]||"").length}function xV(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var bV=Z1,wV=tS,SV=nS,TV=rS;const EV=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(up,{title:"",ref:r,as:TV,enabled:e.tooltip,className:"block bg-input-switch size-5 cursor-grab rounded-full border-1 border-input-border shadow active:cursor-grabbing",children:t})},CV=e=>{const{tooltip:t,className:n,defaultValue:r,value:o,...i}=e,a=E.useRef(ci()),s=r||o||[];return y.jsxs(bV,{...i,defaultValue:r,value:o,className:Ie("relative flex h-5 w-full touch-none select-none items-center",n),children:[y.jsx(wV,{className:"relative h-2 grow rounded-full bg-background",children:y.jsx(SV,{className:"absolute h-full rounded-full bg-primary"})}),s.map((l,c)=>y.jsx(EV,{tooltip:t??!1},`${a.current}-${c}`))]})},kV=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=Ur(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})]})}),RV=e=>{const[t,n]=uA();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:hA(.075,{from:c})})};return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),y.jsx("fieldset",{...e,"data-component":"task-list",ref:t})},PV=P1("textarea","textarea",{container:"w-full"},e=>{const t=()=>{const n=e.value.split(`
211
- `);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)}),AV=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},IV={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"})})},_V=e=>{const t=E.useRef(null),n=AV(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(Aa,{rightLabel:"",title:"Search",placeholder:"Looking for..."}),y.jsx(kp,{height:n,useWindowScroll:!0,data:e.source,components:IV,itemContent:(r,o)=>y.jsx(E.Fragment,{children:y.jsx(Ap,{children:y.jsx(e.Item,{data:o})})})})]})]}),y.jsx("div",{children:y.jsx(Do,{children:y.jsx(If,{})})}),y.jsx("div",{})]})};var OV=Object.defineProperty,Sy=Object.getOwnPropertySymbols,MV=Object.prototype.hasOwnProperty,DV=Object.prototype.propertyIsEnumerable,Ty=(e,t,n)=>t in e?OV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jV=(e,t)=>{for(var n in t||(t={}))MV.call(t,n)&&Ty(e,n,t[n]);if(Sy)for(var n of Sy(t))DV.call(t,n)&&Ty(e,n,t[n]);return e},Mp=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return!0;return!1},NV=(e,t,n,r)=>Ol(Mp,e,t,n,r),Xo=e=>typeof e=="object",mr=(e,t)=>{if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||!Xo(e)&&!Xo(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=>mr(e[r],t[r]))},FV=(e,t)=>(Xo(e)||Array.isArray(e))&&t?e[t]:e,LV=e=>(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1,Ls=e=>/[0-9.]+/.test(e),Ey=e=>["string","number"].includes(typeof e),Cy=e=>e==null||(e==null?void 0:e.length)===0||e==="",ky={eq:mr,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:Cy,notEmpty:e=>!Cy(e),in:(e,t)=>Mp(t,n=>mr(e,n)),notIn:(e,t)=>iS(t,n=>!mr(e,n))},VV=e=>{if(e in ky)return ky[e];throw new Error("Linq - Symbol not found")},_o=(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},Ol=(e,t,n,r,o)=>{if(typeof n=="function")return e(t,n);const i=VV(r);return n&&r&&o!==void 0?e(t,a=>i(a[n],o)):e(t,a=>i(a,o))},$V=(e,t,n,r)=>Ol(_o,e,t,n,r),iS=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},zV=(e,t,n,r)=>Ol(iS,e,t,n,r),aS=e=>{if(e===null)return null;const t=jV({},e);return Object.keys(t).forEach(n=>t[n]=Xo(e[n])?aS(e[n]):e[n]),Array.isArray(e)&&e.length?(t.length=e.length)&&Array.from(t):Array.isArray(e)?Array.from(e):t},Ry=(e,t)=>{if(Xo(t)){for(let n=0;n<e.length;n++){const r=e[n];if(mr(t,r))return!0}return!1}for(let n=0;n<e.length;n++){const r=e[n];if(mr(t,r))return!0}return!1},BV=(e,t)=>{const n=new Map(e.map(r=>[r[t],r]));return Object.fromEntries(n.entries())},HV=e=>_o(e,(t,n,r)=>Xo(t)?n===r.findIndex(o=>mr(o,t)):n===r.indexOf(t)),WV=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return e[r]},sS=(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())},qV=(e,t)=>sS(e,n=>n[t]),Py=(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},UV=(e,t)=>{let n=Number.parseInt(e,10),r=Number.parseInt(t,10);return n>r?[r,n]:[n,r]},KV=(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},Su=(e,t,n=1)=>{let r=Math.abs(n);if((e.length>1||t.length>1)&&Ls(e)&&Ls(t)){const o=[],[i,a]=UV(e,t);for(let s=i;s<=a;s+=r)o.push(s);return o}return KV(e,t,r)},YV=(e,t,n=1)=>{if(t===void 0){const[r,o,i]=e.split("..");return i===void 0?Su(r,o,1):Su(r,i,Number.parseInt(o,10))}return Ey(e)&&Ey(t)?Su(`${e}`,`${t}`,n):Array.from({length:e},(r,o)=>o*Math.abs(t))},Tu=(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},Ay=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},GV=(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)},ZV=(e,t,n,r)=>Ol(GV,e,t,n,r),Iy=(e,t)=>{const n=[...e];return t===void 0?n.sort():typeof t=="function"?n.toSorted(t):n.toSorted(LV(t))},lS=(e=>(e.Asc="asc",e.Desc="desc",e))(lS||{}),XV=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),QV=(e,t)=>e.sort(XV(t)),JV=(e,t)=>{if(t===void 0)return[...new Set(e).values()];const n=new Set;return Array.isArray(t)?[...new Set(t)]:_o(e,r=>{const o=t?n.has(r[t]):n.has(t);return t&&(o||n.add(r[t])),!o})},e$=class Od{constructor(t=[]){this.array=t}static Range(...t){return YV(...t)}static New(t){return new Od(t)}Where(t,n,r){return this.array=$V(this.array,t,n,r),this}Some(t,n,r){return NV(this.array,t,n,r)}All(t,n,r){return zV(this.array,t,n,r)}Reverse(){return this.array=Ay(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=ZV(this.array,t,n,r),this}Distinct(){return this.array=HV(this.array),this}First(t){return t===void 0?this.array[0]:WV(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?Tu((n,r)=>n+r,0,this.array):Tu((n,r)=>n+FV(r,t),0,this.array)}Average(t){return this.Sum(t)/this.array.length}GroupBy(t){return qV(this.array,t)}GroupWith(t){return sS(this.array,t)}Except(t){return _o(this.array,n=>!Ry(t,n))}Intersect(t){return _o(this.array,n=>Ry(t,n))}OrderBy(t,n){let r;return r=t?Iy(this.array,t):this.array.toSorted(),this.array=n==="desc"?Ay(r):r,this}Includes(t){return Mp(this.array,n=>mr(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 Tu(t,n??this.array[0],this.array)}Empty(){return this.array.length===0}ToMap(t){return new Map(Py(this.array,n=>[t,n]))}Zip(t,n){return Py(this.array,(r,o)=>n(r,t[o]))}Count(t){return t===void 0?this.array.length:_o(this.array,t).length}Get(t){return this.array[t]}Clone(){return new Od(aS(this.array))}ToObject(t){return BV(this.array,t)}Sort(t){return Array.isArray(t)?QV(this.array,t):Iy(this.array,t)}Unique(t){return JV(this.array,t)}},cS=e$,Eu={},_y;function t$(){return _y||(_y=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}(Eu)),Eu}var qi=t$();const Dp=e=>e.headerLabel??e.thead??e.id,jp=e=>e.map(t=>({value:t.id,label:t.thead??t.headerLabel??t.id}));var Oo=(e=>(e.Boolean="boolean",e.Number="number",e.Select="select",e.Text="text",e))(Oo||{});const Np=e=>e.type==="number"?e.valueAsNumber:e.value,n$=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},r$={},o$=(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})},i$=(e,t,n=r$)=>{const r=Yr()?null:qi.LocalStorage.get(`@components/table-${e}`)||null,[o,i]=Ff({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:o$(t,r==null?void 0:r.cols)},a=>{const s=l=>{const c=a.state(),u={...c,...l};return Yr()||qi.LocalStorage.set(`@components/table-${c.name}`,u),u};return s(a.state()),{set:l=>s(l)}});return{...o,...i,name:e}},a$=e=>{const t=Ur(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]},Md=(e,t,n,r={})=>{var c,u;const o=e.id,i=e.type??Oo.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:ci(),operation:l,label:Dp(e),name:o,type:i,value:"",...r}},Fp=()=>{const e=At(),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(()=>({[Oo.Text]:[t.is,t.isNot,t.contains,t.notContains,t.startsWith,t.endsWith],[Oo.Boolean]:[t.is,t.isNot],[Oo.Number]:[t.is,t.isNot,t.greaterThan,t.lessThan]}),[e]),operations:t}},s$=e=>{const t=At(),n=Fp(),r=()=>{const l=e.cols.at(0);e.set(c=>[...c,Md(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 Md(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=Np(l.target);e.set(d=>d.map(p=>p.id===c?{...p,value:u}:p))};return y.jsx(E.Fragment,{children:y.jsx(gi,{arrow:!0,title:t.tableFilterDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(KA,{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(Aa,{"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(Vo,{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(_f,{size:14})," ",t.tableFilterNewFilter]})})]})})})},l$=({filter:e,onDelete:t,set:n})=>{const r=At(),o=Fp(),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=Np(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(Aa,{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(Vo,{className:"text-danger",size:14})})]})},c$=({item:e,onPointerDown:t})=>{const n=ul(0);return y.jsxs(n0,{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(WA,{size:14})}),y.jsx("span",{children:e.groupName})]},e.groupId)},u$=e=>{var l;const t=At(),n=jp(e.cols),r=pA(),[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 cS(e.rows).GroupBy(d),g=e.cols.find(v=>v.id===d);e.setGroups(fT(h).map((v,x)=>{const b=h[v];return{...g,groupId:ci(),groupKey:d,index:x,rows:b,groupName:v}}))},s=()=>e.setGroups([]);return y.jsx(E.Fragment,{children:y.jsxs(gi,{arrow:!1,title:t.tableGroupLabel,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(iI,{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(Do,{className:"mt-4",onClick:s,theme:"raw","data-id":o,children:y.jsx(Vo,{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(TE,{children:y.jsx(t0,{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(c$,{item:c,onPointerDown:u=>{r.start(u),e.setGroups([...e.groups])}},c.groupId))})})]}):null]})})},d$=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),f$=(e,t)=>e.toSorted(d$(t)),uS=(e,t,n)=>({label:t,id:ci(),type:n,value:e.id}),p$=e=>{const t=At(),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,uS(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(gi,{title:t.tableSortDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(o0,{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(Vo,{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(_f,{size:14})," ",t.tableSortAddButton]})})]})})})},m$=e=>{const t=At(),[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=uS(e.col,n,n);return l===-1?[...s,c]:(s[l]=c,[...s])})},[n,e.col]);const i=`${e.col.id}-sorter-id`,a=Dp(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(PA,{size:14}):null,n==="desc"?y.jsx(kA,{size:14}):null,n==="undefined"?y.jsx(o0,{size:14}):null]})},h$=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(s$,{cols:e.cols,options:e.options,filters:e.filters,set:e.setFilters})}),y.jsx("span",{children:y.jsx(p$,{options:e.options,cols:e.cols,sorters:e.sorters,set:e.setSorters})}),y.jsx("span",{children:y.jsx(u$,{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=Np(n.target);e.setFilters(o=>o.map(i=>t.id===i.id?{...i,value:r}:i))}})]})]},`filter-table-${t.id}`))})]})});function g$(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 v$=e=>{const t=E.useId(),n=At(),r=E.useMemo(()=>g$(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]})})]})},y$=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})})},x$=(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=$f(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(y$,{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?lp: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})}))})})},b$={top:0,left:0,right:0,bottom:-1},w$=e=>{var g;const t=Pp(),n=At(),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=Fp(),l=o?QA:eI,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===lS.Asc?"ascending":"descending":"none",h=Dp(e.header);return y.jsxs(n0,{...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(gi,{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(l$,{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(Md(e.header,s.options,s.operations))),children:[y.jsx(_f,{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(m$,{col:e.header,setSorters:e.setSorters,sorters:e.sorters}):null]})}),e.isLast?null:y.jsx(ft.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:b$,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`}})]})},S$=e=>{const[t,n]=a$(e.setCols);return y.jsx(t0,{layout:!0,as:"tr",axis:"x",drag:"x",layoutRoot:!0,role:"row",layoutScroll:!0,ref:t,onReorder:n,values:e.headers,children:y.jsx(wr,{children:e.headers.map((r,o)=>y.jsx(w$,{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}`))})})},dS=E.createContext({}),T$=()=>E.useContext(dS),E$=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(wr,{children:n.children})})),C$=E.forwardRef(({context:e,className:t="",...n},r)=>y.jsx("table",{...n,ref:r,role:"table",className:`table min-w-full table-fixed border-collapse text-left ${t??""}`})),k$=E.forwardRef(({context:e,...t},n)=>{const r=T$(),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:"shadow-xs hidden md:table-header-group group:sticky top-0 bg-transparent",ref:n})}),R$=E.forwardRef(({context:e,item:t,...n},r)=>y.jsx("tr",{...n,role:"row",ref:r,className:`group-table-row h-fit flex flex-wrap gap-1 flex-col justify-center md:table-row ${(n==null?void 0:n.className)??""}`})),P$=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:"h-14 bg-card-background px-2",children:y.jsx("span",{className:"block h-2 w-full animate-pulse rounded bg-foreground opacity-60"})})})}):null),A$={TableHead:k$,Table:C$,TableBody:E$,TableRow:R$,TableFoot:P$},I$=[0,0,0,0,0,0,0,0,0,0],_$=e=>y.jsx("div",{className:"flex h-48 w-full items-center justify-center px-2",children:e.loading?lp:y.jsx(V0,{})}),O$=()=>y.jsx(E.Fragment,{}),M$=()=>y.jsx(E.Fragment,{}),D$=[],Oy=({cols:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,onScrollEnd:a,border:s=!1,pagination:l=null,useControl:c=!1,...u})=>{const d=E.useRef(null),[p,f]=E.useState(!1),h=Ur(a),g=Ur(u.loadingMore),m=E.useMemo(()=>{if(u.loading)return I$;if(c)return u.rows;const b=new cS(u.rows);return t.length>0&&t.forEach(S=>S.value===""||Number.isNaN(S.value)?void 0:b.Where(S.name,S.operation.symbol,S.value)),r.length===0?b.Select():f$(b.Select(),r)},[u.loading,u.rows,c,t,r]);E.useEffect(()=>{if(d.current===null)return()=>{};const b=d.current,S=new IntersectionObserver(w=>{var k;return w[w.length-1].isIntersecting&&g.current?((k=h.current)==null||k.call(h),void f(!0)):f(!1)});return S.observe(b),()=>S.disconnect()},[g,h]);const v=m.length===0,x={loading:u.loading,loadingMore:u.loadingMore,cols:e,Aside:u.Aside};return y.jsxs("div",{className:"min-w-full",children:[y.jsxs("div",{className:`group w-full rounded-lg ${s?"border border-table-border":""}`,children:[y.jsx(Q2,{useWindowScroll:!0,context:x,components:A$,totalCount:m.length,itemContent:v?O$:x$,data:v?D$:m,fixedFooterContent:p?M$:null,fixedHeaderContent:()=>y.jsx(S$,{headers:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,loading:!!u.loading,inlineFilter:u.inlineFilter,inlineSorter:u.inlineSorter})}),v?y.jsx(_$,{loading:u.loading}):null,y.jsx("div",{"aria-hidden":"true",ref:d,className:"h-0.5 w-full"})]}),l!==null?y.jsx(v$,{...l}):null]})},j$=(e,t)=>typeof t=="function"?t(e):t,es=(e,t,n)=>e===t||n==null?void 0:n(t),N$=e=>{const t=E.useMemo(()=>({sticky:e.sticky}),[e.sticky]),n=Pp(),r=e.operations??n.table.operations??!0,o=E.useMemo(()=>jp(e.cols),[e.cols]),[i,a]=Ff({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),es((l==null?void 0:l.filters)??[],s.filters??[],e.setFilters),es((l==null?void 0:l.sorters)??[],s.sorters??[],e.setSorters),es((l==null?void 0:l.groups)??[],s.groups??[],e.setGroups),es((l==null?void 0:l.cols)??[],s.cols??[],e.setCols),s}]});return y.jsx(dS.Provider,{value:t,children:y.jsxs("div",{className:"relative min-w-full","data-component":"table",children:[r?y.jsx(h$,{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(Oy,{...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(Oy,{...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}`))})]})})},F$=["INPUT","SELECT"],fS=e=>{if(!e)return;Array.from(e.elements).forEach(n=>{F$.includes(n.tagName)&&(n.tagName==="INPUT"&&(n.value=n.defaultValue),n.tagName==="SELECT"&&(n.value=""),n.setAttribute("data-initialized","false"))})};var Cu,My;function Lp(){if(My)return Cu;My=1;var e=String.prototype.replace,t=/%20/g,n={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Cu={default:n.RFC3986,formatters:{RFC1738:function(r){return e.call(r,t,"+")},RFC3986:function(r){return String(r)}},RFC1738:n.RFC1738,RFC3986:n.RFC3986},Cu}var ku,Dy;function pS(){if(Dy)return ku;Dy=1;var e=Lp(),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(F){return"%26%23"+parseInt(F.slice(2),16)+"%3B"});for(var C="",k=0;k<T.length;k+=c){for(var I=T.length>=c?T.slice(k,k+c):T,A=[],j=0;j<I.length;++j){var D=I.charCodeAt(j);if(D===45||D===46||D===95||D===126||D>=48&&D<=57||D>=65&&D<=90||D>=97&&D<=122||w===e.RFC1738&&(D===40||D===41)){A[A.length]=I.charAt(j);continue}if(D<128){A[A.length]=r[D];continue}if(D<2048){A[A.length]=r[192|D>>6]+r[128|D&63];continue}if(D<55296||D>=57344){A[A.length]=r[224|D>>12]+r[128|D>>6&63]+r[128|D&63];continue}j+=1,D=65536+((D&1023)<<10|I.charCodeAt(j)&1023),A[A.length]=r[240|D>>18]+r[128|D>>12&63]+r[128|D>>6&63]+r[128|D&63]}C+=A.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),k=0;k<C.length;++k){var I=C[k],A=T[I];typeof A=="object"&&A!==null&&b.indexOf(A)===-1&&(x.push({obj:T,prop:I}),b.push(A))}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 ku={arrayToObject:i,assign:s,combine:h,compact:d,decode:l,encode:u,isBuffer:f,isRegExp:p,maybeMap:g,merge:a},ku}var Ru,jy;function L$(){if(jy)return Ru;jy=1;var e=sT(),t=pS(),n=Lp(),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,k,I,A,j,D,F,P,O,_,V){for(var N=m,$=V,M=0,B=!1;($=$.get(p))!==void 0&&!B;){var X=$.get(m);if(M+=1,typeof X<"u"){if(X===M)throw new RangeError("Cyclic object value");B=!0}typeof $.get(p)>"u"&&(M=0)}if(typeof I=="function"?N=I(v,N):N instanceof Date?N=D(N):x==="comma"&&i(N)&&(N=t.maybeMap(N,function(Re){return Re instanceof Date?D(Re):Re})),N===null){if(w)return k&&!O?k(v,u.encoder,_,"key",F):v;N=""}if(d(N)||t.isBuffer(N)){if(k){var Q=O?v:k(v,u.encoder,_,"key",F);return[P(Q)+"="+P(k(N,u.encoder,_,"value",F))]}return[P(v)+"="+P(String(N))]}var J=[];if(typeof N>"u")return J;var G;if(x==="comma"&&i(N))O&&k&&(N=t.maybeMap(N,k)),G=[{value:N.length>0?N.join(",")||null:void 0}];else if(i(I))G=I;else{var Y=Object.keys(N);G=A?Y.sort(A):Y}var Z=C?String(v).replace(/\./g,"%2E"):String(v),L=b&&i(N)&&N.length===1?Z+"[]":Z;if(S&&i(N)&&N.length===0)return L+"[]";for(var z=0;z<G.length;++z){var K=G[z],ie=typeof K=="object"&&K&&typeof K.value<"u"?K.value:N[K];if(!(T&&ie===null)){var H=j&&C?String(K).replace(/\./g,"%2E"):String(K),ye=i(N)?typeof x=="function"?x(L,H):L:L+(j?"."+H:"["+H+"]");V.set(m,M);var Te=e();Te.set(p,V),s(J,g(ie,ye,x,b,S,w,T,C,x==="comma"&&O&&i(N)?null:k,I,A,j,D,F,P,O,_,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 Ru=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 k=e(),I=0;I<b.length;++I){var A=b[I],j=v[A];x.skipNulls&&j===null||s(w,f(j,A,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,k))}var D=w.join(x.delimiter),F=x.addQueryPrefix===!0?"?":"";return x.charsetSentinel&&(x.charset==="iso-8859-1"?F+="utf8=%26%2310003%3B&":F+="utf8=%E2%9C%93&"),D.length>0?F+D:""},Ru}var Pu,Ny;function V$(){if(Ny)return Pu;Ny=1;var e=pS(),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("]="),k=C===-1?T.indexOf("="):C+1,I,A;k===-1?(I=h.decoder(T,r.decoder,w,"key"),A=h.strictNullHandling?null:""):(I=h.decoder(T.slice(0,k),r.decoder,w,"key"),A=e.maybeMap(i(T.slice(k+1),h,n(g[I])?g[I].length:0),function(D){return h.decoder(D,r.decoder,w,"value")})),A&&h.interpretNumericEntities&&w==="iso-8859-1"&&(A=o(String(A))),T.indexOf("[]=")>-1&&(A=n(A)?[A]:A);var j=t.call(g,I);j&&h.duplicates==="combine"?g[I]=e.combine(g[I],A):(!j||h.duplicates==="last")&&(g[I]=A)}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,k=parseInt(C,10);!h.parseArrays&&C===""?S={0:x}:!isNaN(k)&&w!==C&&String(k)===C&&k>=0&&h.parseArrays&&k<=h.arrayLimit?(S=[],S[k]=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 Pu=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)},Pu}var Au,Fy;function $$(){if(Fy)return Au;Fy=1;var e=L$(),t=V$(),n=Lp();return Au={formats:n,parse:t,stringify:e},Au}var z$=$$(),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 Ly;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Ly||(Ly={}));const fe=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ur=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 fa=(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 B$=fa;function Dd(){return B$}const jd=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=Dd(),r=jd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===fa?void 0:fa].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"}),Ii=e=>({status:"dirty",value:e}),Yt=e=>({status:"valid",value:e}),Vy=e=>e.status==="aborted",$y=e=>e.status==="dirty",Qo=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 mS(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 _i,Oi;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 zy=(e,t)=>{if(Qo(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 ur(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ur(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:ur(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:ur(t)},i=this._parseSync({data:t,path:o.path,parent:o});return zy(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:ur(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:o});return Qo(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=>Qo(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:ur(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Vs(o)?o:Promise.resolve(o));return zy(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 ma.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 yS({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 Ml.create(this,t)}readonly(){return Xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const H$=/^c[^\s-]{8,}$/i,W$=/^[0-9a-z]+$/,q$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U$=/^[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,K$=/^[a-z0-9_-]{21}$/i,Y$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G$=/^[-+]?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)?)??$/,Z$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,X$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Iu;const Q$=/^(?:(?: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])$/,J$=/^(?:(?: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])$/,ez=/^(([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]))$/,tz=/^(([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])$/,nz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hS="((\\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])))",oz=new RegExp(`^${hS}$`);function gS(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function iz(e){return new RegExp(`^${gS(e)}$`)}function az(e){let t=`${hS}T${gS(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 sz(e,t){return!!((t==="v4"||!t)&&Q$.test(e)||(t==="v6"||!t)&&ez.test(e))}function lz(e,t){if(!Y$.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 cz(e,t){return!!((t==="v4"||!t)&&J$.test(e)||(t==="v6"||!t)&&tz.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")Z$.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")Iu||(Iu=new RegExp(X$,"u")),Iu.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")U$.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")K$.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")H$.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")W$.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")q$.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"?az(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"?oz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?iz(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"?G$.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?sz(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"?lz(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"?cz(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"?nz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?rz.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 uz(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"?uz(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 Jo 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 Jo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(o)}]})}_addCheck(t){return new Jo({...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}}Jo.create=e=>{var t;return new Jo({checks:[],typeName:Ee.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};class Nd 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)}}Nd.create=e=>new Nd({typeName:Ee.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class pa 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 pa({...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}}pa.create=e=>new pa({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ee.ZodDate,..._e(e)});class Fd 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)}}Fd.create=e=>new Fd({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 Ld extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return Yt(t.data)}}Ld.create=e=>new Ld({typeName:Ee.ZodAny,..._e(e)});class Mo extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Yt(t.data)}}Mo.create=e=>new Mo({typeName:Ee.ZodUnknown,..._e(e)});class br extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:fe.never,received:n.parsedType}),ke}}br.create=e=>new br({typeName:Ee.ZodNever,..._e(e)});class Vd 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)}}Vd.create=e=>new Vd({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 bo(e){if(e instanceof xt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=qn.create(bo(r))}return new xt({...e._def,shape:()=>t})}else return e instanceof Nn?new Nn({...e._def,type:bo(e.element)}):e instanceof qn?qn.create(bo(e.unwrap())):e instanceof no?no.create(bo(e.unwrap())):e instanceof Xn?Xn.create(e.items.map(t=>bo(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 br&&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 br){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 bo(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 vS(qe.objectKeys(this.shape))}}xt.create=(e,t)=>new xt({shape:()=>e,unknownKeys:"strip",catchall:br.create(),typeName:Ee.ZodObject,..._e(t)});xt.strictCreate=(e,t)=>new xt({shape:()=>e,unknownKeys:"strict",catchall:br.create(),typeName:Ee.ZodObject,..._e(t)});xt.lazycreate=(e,t)=>new xt({shape:e,unknownKeys:"strip",catchall:br.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 yS||e instanceof Xs?Hn(e.unwrap()):e instanceof Zs?Hn(e._def.innerType):[];class Vp 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 Vp({typeName:Ee.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,..._e(r)})}}function $d(e,t){const n=ur(e),r=ur(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=$d(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=$d(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(Vy(i)||Vy(a))return ke;const s=$d(i.value,a.value);return s.valid?(($y(i)||$y(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 zd 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}}}}zd.create=(e,t,n)=>new zd({valueType:t,keyType:e,typeName:Ee.ZodMap,..._e(n)});class ei 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 ei({...this._def,minSize:{value:t,message:ve.toString(n)}})}max(t,n){return new ei({...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)}}ei.create=(e,t)=>new ei({valueType:e,minSize:null,maxSize:null,typeName:Ee.ZodSet,..._e(t)});class Ui 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 jd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dd(),fa].filter(c=>!!c),issueData:{code:re.invalid_arguments,argumentsError:l}})}function o(s,l){return jd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dd(),fa].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 ma){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 Ui({...this._def,args:Xn.create(t).rest(Mo.create())})}returns(t){return new Ui({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Ui({args:t||Xn.create([]).rest(Mo.create()),returns:n||Mo.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 vS(e,t){return new to({values:e,typeName:Ee.ZodEnum,..._e(t)})}class to extends Fe{constructor(){super(...arguments),_i.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,_i)||mS(this,_i,new Set(this._def.values)),!$s(this,_i).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})}}_i=new WeakMap;to.create=vS;class Ys extends Fe{constructor(){super(...arguments),Oi.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,Oi)||mS(this,Oi,new Set(qe.getValidEnumValues(this._def.values))),!$s(this,Oi).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}}Oi=new WeakMap;Ys.create=(e,t)=>new Ys({values:e,typeName:Ee.ZodNativeEnum,..._e(t)});class ma 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})))}}ma.create=(e,t)=>new ma({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"?Ii(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"?Ii(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(!Qo(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=>Qo(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 Bd 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}}}Bd.create=e=>new Bd({typeName:Ee.ZodNaN,..._e(e)});class yS 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 Ml 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(),Ii(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 Ml({in:t,out:n,typeName:Ee.ZodPipeline})}}class Xs extends Fe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Qo(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;Bd.create;Jo.create;Nd.create;pa.create;Fd.create;zs.create;Bs.create;Ld.create;Mo.create;br.create;Vd.create;Nn.create;xt.create;xt.strictCreate;Hs.create;Vp.create;Ws.create;Xn.create;qs.create;zd.create;ei.create;Ui.create;Us.create;Ks.create;to.create;Ys.create;ma.create;Qn.create;qn.create;no.create;Qn.createWithPreprocess;Ml.create;const dz=e=>{if(typeof e!="string")try{e=JSON.stringify(e)}catch{return!1}try{return JSON.parse(e),!0}catch{return!1}},fz=(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]}}},xS=e=>e.replace(/\[(\d+)]/g,".$1").split("."),Xt=(e,t,n)=>{const r=Array.isArray(t)?t.map(String):xS(t),o=structuredClone(e);return fz(o,r,n),o},pz=(e,t)=>e.localeCompare(t),xo={},bS=e=>{const t=e._def.typeName;if(t==="ZodDefault")return e._def.defaultValue();if(t==="ZodObject")return wS(e);if(t==="ZodArray")return[];if("innerType"in e._def){const n=bS(e._def.innerType);return t==="ZodArray"?n??[]:n}},wS=e=>Object.fromEntries(Object.entries(e.shape).map(([t,n])=>[t,bS(n)])),SS=(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]=SS(i,o):n[r]=o||i)}return n},mz={sort:pz,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},TS=e=>{const t=new FormData(e),n=new URLSearchParams(t);return z$.parse(n.toString(),mz)},lr=(e,t)=>xS(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),dr=e=>e.dataset.value?e.dataset.value:e.type==="checkbox"?e.checked:e.type==="number"?e.valueAsNumber:e.value||e.getAttribute("value"),_u=e=>{const t=e.dataset.target;if(!t)return dr(e);const n=document.querySelector(`[data-origin="${t}"]`);return dr(n||e)},hz={state:{},loading:!1,useOnChange:!1},By=e=>e.dataset.target||e.name,gz=e=>{const t=`@use-form/${e}`;return{get:()=>{const n=qi.LocalStorage.get(t);return dz(n)?n:{}},clear:()=>void qi.LocalStorage.delete(t),set:n=>qi.LocalStorage.set(t,n)}},vz=(e,t,n=hz)=>{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)??wS(e)??{}),l=E.useCallback(b=>{var A;const S=b.target,w=b.currentTarget;if(S.dataset.optional==="true")return;const C=By(S),k=_u(S)||(w?dr(w):""),I=lr(C,e);if(S.setAttribute("data-initialized","true"),I){const j=I.safeParse(k),D=j.success?void 0:((A=j.error.issues[0])==null?void 0:A.message)??"";o(F=>Xt(F??{},C,D))}},[e]),c=E.useCallback(b=>S=>{const w=S.currentTarget,T=Object.values(i.current).reduce((k,I)=>{var P;const A=I.element,j=I.schema.safeParse(dr(A));if(A.dataset.ignore==="ignore"||j.success)return k;const D=(P=j.error.issues[0])==null?void 0:P.message;A.setAttribute("data-initialized","true");const F=A.dataset.name||A.name||"";return Xt(k,F,D)},{}),C=Ve.empty(T)?null:T;o(C),console.error(C),b==null||b({form:w,errors:C||{}})},[]),u=(b,S=xo)=>{const w=lr(b,e),T=C=>{var I;if(!Of(C))return;s(A=>Xt(A,b,C.toISOString())),o(A=>Xt(A,b,void 0));const k=i.current[b].element;if(k){const A=k.getAttribute("data-origin"),j=document.querySelector(`input[data-target="${A}"]`);j&&j.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=xo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const k=C.target.value;s(A=>Xt(A,b,k)),(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=xo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const k=C.target.checked;s(A=>Xt(A??{},b,k)),(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=xo)=>{const w=lr(b,e),T=C=>{var I,A;(I=C.persist)==null||I.call(C);const k=C.target.value;(A=S==null?void 0:S.onChange)==null||A.call(S,C),s(j=>Xt(j,b,k))};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=xo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChangeOptions:C=>{s(k=>Xt(k,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=xo)=>{const w=lr(b,e),T=w._def.typeName==="ZodNumber";return{...S,name:b,id:b,onChange:k=>{var A,j;(A=k.persist)==null||A.call(k);const I=T?k.target.valueAsNumber:k.target.value;(j=S==null?void 0:S.onChange)==null||j.call(S,k),s(D=>Xt(D,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:k=>k===null?void 0:void(i.current[b]={element:k,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(dr(T)),k=D=>{var V;const F=By(D.target);if(!F)return!1;const P=D.target,O=_u(D.target)||(D.relatedTarget?dr(D.relatedTarget):""),_=w.schema.safeParse(O);if(P.setAttribute("value",O),_.success)return T.setCustomValidity&&T.setCustomValidity(""),o(N=>{if(Ve.null(N))return null;const $=Xt(N,F,void 0);return Ve.empty(N)||Ve.nil(N)||Ve.empty($)?null:$}),!1;if(T.required){const N=((V=_.error.issues[0])==null?void 0:V.message)||"";T.setCustomValidity&&T.setCustomValidity(N),o($=>{if(Ve.null($))return null;const M=Xt($,F,N||void 0);return Ve.empty(M)?null:M})}return!1},I=new AbortController,A=T.getAttribute("data-trigger")||"blur";T.addEventListener(A,k,{signal:I.signal});const j=T.dataset.shadow?!1:T.required?!C.success:!1;return{input:w,hasInitialError:j,unsubscribe:()=>I.abort()}});return b.some(w=>w.hasInitialError)&&o(w=>w===null?{}:w),()=>b.forEach(w=>w.unsubscribe())});const m=b=>S=>{var j;S.preventDefault();const w=S.currentTarget;let T=TS(w);(t?Array.from(document.querySelectorAll(`[form="${t}"]`)):Array.from(w.elements)).forEach(D=>{if(D.tagName==="SELECT"){const F=D;T=Xt(T,F.name,F.value)}if(D.tagName==="INPUT"){const F=D,P=_u(F)||(F?dr(F):"");T=Xt(T,F.dataset.target||F.name,P)}});const k=SS(T,a),I=e.safeParse(k),A=()=>{var D;fS(w),(D=n.interceptor)==null||D.clear()};if(I.success){const D=JSON.stringify(I.data);return w.setAttribute("data-json",D),(j=n.interceptor)==null||j.clear(),b==null?void 0:b(S,{form:w,event:S,reset:A,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:A,data:T,success:!1,errors:I.error.issues.map(D=>({message:D.message,path:D.path.map(F=>String(F))}))})},v=b=>$f(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}},yz=e=>e?JSON.parse(e.getAttribute("data-json")):{},xz=e=>{const t=E.useRef(void 0);return E.useEffect(()=>{t.current=e},[e]),t.current},ES={button:"0.55rem",pill:"2rem",card:"0.75rem",full:"9999px"},CS={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"},kS={normal:"1",navbar:"22",calendar:"2",overlay:"21",tooltip:"20",floating:"22"},bz={name:"dark",zIndex:kS,rounded:ES,spacing:CS,shadow:{floating:"0 1px 1px 0 rgb(0 0 0 / 0.02)"},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%)"}}}},wz={rounded:ES,spacing:CS,name:"light",shadow:{floating:"0 1px 1px 0 rgb(0 0 0 / 0.02)"},zIndex:kS,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%, 88%)",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%)"}}}},Sz=bz,Tz=wz,Ez=e=>{const t=E.useMemo(()=>({locale:e.locale,tweaks:{...gl,...e.tweaks},parser:e.parser||ml.hsla,map:{...hl,...e.map}}),[e]);return y.jsx(li.Provider,{value:t,children:e.children})},Cz=()=>{const e=E.useContext(li);return e?e.parser:ml.hsla};exports.Alert=fI;exports.Autocomplete=xF;exports.Button=Do;exports.Calendar=L0;exports.Card=Bf;exports.Checkbox=Ap;exports.ColType=Oo;exports.Collapse=l0;exports.CommandPalette=RN;exports.ComponentsProvider=Ez;exports.Context=li;exports.DatePicker=wF;exports.Dict=yn;exports.Dropdown=gi;exports.Empty=V0;exports.Expand=PN;exports.FileUpload=DL;exports.Form=jL;exports.Input=Aa;exports.InputFeedback=R1;exports.InputField=Pa;exports.Menu=_N;exports.MenuItem=IN;exports.Modal=Gw;exports.MultiSelect=BL;exports.Notifications=sD;exports.Polymorph=un;exports.Radiobox=HL;exports.RenderOnView=sE;exports.Select=Qr;exports.Slider=CV;exports.Stats=lD;exports.Switch=kV;exports.Tab=fD;exports.Table=N$;exports.Tabs=uD;exports.Tag=Yd;exports.TaskList=RV;exports.Textarea=PV;exports.Timeline=pD;exports.TimelineItem=xl;exports.Toolbar=ON;exports.Tooltip=up;exports.TransferList=_V;exports.createColumns=n$;exports.createCssProperties=eM;exports.createDesignTokens=M0;exports.createFormStorage=gz;exports.createOptionCols=jp;exports.createStyles=XO;exports.createTheme=JO;exports.createTokenStyles=tM;exports.css=Ie;exports.defaultDarkTheme=Sz;exports.defaultLightTheme=Tz;exports.defaultTranslations=hl;exports.defaultTweaks=gl;exports.dispatchInput=ux;exports.formReset=fS;exports.formToJson=TS;exports.getCoords=nE;exports.getJsonForm=yz;exports.getRemainingSize=Ki;exports.getSchemaShape=lr;exports.hasVerticalScroll=dx;exports.initializeInputDataset=ga;exports.isMobile=j0;exports.isReactComponent=tE;exports.isReactFC=Kd;exports.isSsr=Yr;exports.mergeRefs=Un;exports.negate=rM;exports.noop=zf;exports.parsers=ml;exports.path=$f;exports.reduceTokens=Vr;exports.safeRegex=od;exports.splitInto=D0;exports.useColorParser=Cz;exports.useForm=vz;exports.useLocale=Vf;exports.useNotification=iD;exports.usePrevious=xz;exports.useReactive=lw;exports.useTablePreferences=i$;exports.useTranslations=At;exports.uuid=ci;
211
+ `);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)}),AV=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},IV={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"})})},_V=e=>{const t=E.useRef(null),n=AV(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(Aa,{rightLabel:"",title:"Search",placeholder:"Looking for..."}),y.jsx(kp,{height:n,useWindowScroll:!0,data:e.source,components:IV,itemContent:(r,o)=>y.jsx(E.Fragment,{children:y.jsx(Ap,{children:y.jsx(e.Item,{data:o})})})})]})]}),y.jsx("div",{children:y.jsx(Do,{children:y.jsx(If,{})})}),y.jsx("div",{})]})};var OV=Object.defineProperty,Sy=Object.getOwnPropertySymbols,MV=Object.prototype.hasOwnProperty,DV=Object.prototype.propertyIsEnumerable,Ty=(e,t,n)=>t in e?OV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jV=(e,t)=>{for(var n in t||(t={}))MV.call(t,n)&&Ty(e,n,t[n]);if(Sy)for(var n of Sy(t))DV.call(t,n)&&Ty(e,n,t[n]);return e},Mp=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return!0;return!1},NV=(e,t,n,r)=>Ol(Mp,e,t,n,r),Xo=e=>typeof e=="object",mr=(e,t)=>{if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||!Xo(e)&&!Xo(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=>mr(e[r],t[r]))},FV=(e,t)=>(Xo(e)||Array.isArray(e))&&t?e[t]:e,LV=e=>(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1,Ls=e=>/[0-9.]+/.test(e),Ey=e=>["string","number"].includes(typeof e),Cy=e=>e==null||(e==null?void 0:e.length)===0||e==="",ky={eq:mr,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:Cy,notEmpty:e=>!Cy(e),in:(e,t)=>Mp(t,n=>mr(e,n)),notIn:(e,t)=>iS(t,n=>!mr(e,n))},VV=e=>{if(e in ky)return ky[e];throw new Error("Linq - Symbol not found")},_o=(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},Ol=(e,t,n,r,o)=>{if(typeof n=="function")return e(t,n);const i=VV(r);return n&&r&&o!==void 0?e(t,a=>i(a[n],o)):e(t,a=>i(a,o))},$V=(e,t,n,r)=>Ol(_o,e,t,n,r),iS=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},zV=(e,t,n,r)=>Ol(iS,e,t,n,r),aS=e=>{if(e===null)return null;const t=jV({},e);return Object.keys(t).forEach(n=>t[n]=Xo(e[n])?aS(e[n]):e[n]),Array.isArray(e)&&e.length?(t.length=e.length)&&Array.from(t):Array.isArray(e)?Array.from(e):t},Ry=(e,t)=>{if(Xo(t)){for(let n=0;n<e.length;n++){const r=e[n];if(mr(t,r))return!0}return!1}for(let n=0;n<e.length;n++){const r=e[n];if(mr(t,r))return!0}return!1},BV=(e,t)=>{const n=new Map(e.map(r=>[r[t],r]));return Object.fromEntries(n.entries())},HV=e=>_o(e,(t,n,r)=>Xo(t)?n===r.findIndex(o=>mr(o,t)):n===r.indexOf(t)),WV=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return e[r]},sS=(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())},qV=(e,t)=>sS(e,n=>n[t]),Py=(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},UV=(e,t)=>{let n=Number.parseInt(e,10),r=Number.parseInt(t,10);return n>r?[r,n]:[n,r]},KV=(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},Su=(e,t,n=1)=>{let r=Math.abs(n);if((e.length>1||t.length>1)&&Ls(e)&&Ls(t)){const o=[],[i,a]=UV(e,t);for(let s=i;s<=a;s+=r)o.push(s);return o}return KV(e,t,r)},YV=(e,t,n=1)=>{if(t===void 0){const[r,o,i]=e.split("..");return i===void 0?Su(r,o,1):Su(r,i,Number.parseInt(o,10))}return Ey(e)&&Ey(t)?Su(`${e}`,`${t}`,n):Array.from({length:e},(r,o)=>o*Math.abs(t))},Tu=(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},Ay=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},GV=(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)},ZV=(e,t,n,r)=>Ol(GV,e,t,n,r),Iy=(e,t)=>{const n=[...e];return t===void 0?n.sort():typeof t=="function"?n.toSorted(t):n.toSorted(LV(t))},lS=(e=>(e.Asc="asc",e.Desc="desc",e))(lS||{}),XV=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),QV=(e,t)=>e.sort(XV(t)),JV=(e,t)=>{if(t===void 0)return[...new Set(e).values()];const n=new Set;return Array.isArray(t)?[...new Set(t)]:_o(e,r=>{const o=t?n.has(r[t]):n.has(t);return t&&(o||n.add(r[t])),!o})},e$=class Od{constructor(t=[]){this.array=t}static Range(...t){return YV(...t)}static New(t){return new Od(t)}Where(t,n,r){return this.array=$V(this.array,t,n,r),this}Some(t,n,r){return NV(this.array,t,n,r)}All(t,n,r){return zV(this.array,t,n,r)}Reverse(){return this.array=Ay(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=ZV(this.array,t,n,r),this}Distinct(){return this.array=HV(this.array),this}First(t){return t===void 0?this.array[0]:WV(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?Tu((n,r)=>n+r,0,this.array):Tu((n,r)=>n+FV(r,t),0,this.array)}Average(t){return this.Sum(t)/this.array.length}GroupBy(t){return qV(this.array,t)}GroupWith(t){return sS(this.array,t)}Except(t){return _o(this.array,n=>!Ry(t,n))}Intersect(t){return _o(this.array,n=>Ry(t,n))}OrderBy(t,n){let r;return r=t?Iy(this.array,t):this.array.toSorted(),this.array=n==="desc"?Ay(r):r,this}Includes(t){return Mp(this.array,n=>mr(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 Tu(t,n??this.array[0],this.array)}Empty(){return this.array.length===0}ToMap(t){return new Map(Py(this.array,n=>[t,n]))}Zip(t,n){return Py(this.array,(r,o)=>n(r,t[o]))}Count(t){return t===void 0?this.array.length:_o(this.array,t).length}Get(t){return this.array[t]}Clone(){return new Od(aS(this.array))}ToObject(t){return BV(this.array,t)}Sort(t){return Array.isArray(t)?QV(this.array,t):Iy(this.array,t)}Unique(t){return JV(this.array,t)}},cS=e$,Eu={},_y;function t$(){return _y||(_y=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}(Eu)),Eu}var qi=t$();const Dp=e=>e.headerLabel??e.thead??e.id,jp=e=>e.map(t=>({value:t.id,label:t.thead??t.headerLabel??t.id}));var Oo=(e=>(e.Boolean="boolean",e.Number="number",e.Select="select",e.Text="text",e))(Oo||{});const Np=e=>e.type==="number"?e.valueAsNumber:e.value,n$=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},r$={},o$=(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})},i$=(e,t,n=r$)=>{const r=Yr()?null:qi.LocalStorage.get(`@components/table-${e}`)||null,[o,i]=Ff({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:o$(t,r==null?void 0:r.cols)},a=>{const s=l=>{const c=a.state(),u={...c,...l};return Yr()||qi.LocalStorage.set(`@components/table-${c.name}`,u),u};return s(a.state()),{set:l=>s(l)}});return{...o,...i,name:e}},a$=e=>{const t=Ur(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]},Md=(e,t,n,r={})=>{var c,u;const o=e.id,i=e.type??Oo.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:ci(),operation:l,label:Dp(e),name:o,type:i,value:"",...r}},Fp=()=>{const e=At(),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(()=>({[Oo.Text]:[t.is,t.isNot,t.contains,t.notContains,t.startsWith,t.endsWith],[Oo.Boolean]:[t.is,t.isNot],[Oo.Number]:[t.is,t.isNot,t.greaterThan,t.lessThan]}),[e]),operations:t}},s$=e=>{const t=At(),n=Fp(),r=()=>{const l=e.cols.at(0);e.set(c=>[...c,Md(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 Md(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=Np(l.target);e.set(d=>d.map(p=>p.id===c?{...p,value:u}:p))};return y.jsx(E.Fragment,{children:y.jsx(gi,{arrow:!0,title:t.tableFilterDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(KA,{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(Aa,{"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(Vo,{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(_f,{size:14})," ",t.tableFilterNewFilter]})})]})})})},l$=({filter:e,onDelete:t,set:n})=>{const r=At(),o=Fp(),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=Np(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(Aa,{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(Vo,{className:"text-danger",size:14})})]})},c$=({item:e,onPointerDown:t})=>{const n=ul(0);return y.jsxs(n0,{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(WA,{size:14})}),y.jsx("span",{children:e.groupName})]},e.groupId)},u$=e=>{var l;const t=At(),n=jp(e.cols),r=pA(),[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 cS(e.rows).GroupBy(d),g=e.cols.find(v=>v.id===d);e.setGroups(fT(h).map((v,x)=>{const b=h[v];return{...g,groupId:ci(),groupKey:d,index:x,rows:b,groupName:v}}))},s=()=>e.setGroups([]);return y.jsx(E.Fragment,{children:y.jsxs(gi,{arrow:!1,title:t.tableGroupLabel,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(iI,{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(Do,{className:"mt-4",onClick:s,theme:"raw","data-id":o,children:y.jsx(Vo,{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(TE,{children:y.jsx(t0,{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(c$,{item:c,onPointerDown:u=>{r.start(u),e.setGroups([...e.groups])}},c.groupId))})})]}):null]})})},d$=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),f$=(e,t)=>e.toSorted(d$(t)),uS=(e,t,n)=>({label:t,id:ci(),type:n,value:e.id}),p$=e=>{const t=At(),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,uS(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(gi,{title:t.tableSortDropdownTitle,trigger:y.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[y.jsx(o0,{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(Vo,{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(_f,{size:14})," ",t.tableSortAddButton]})})]})})})},m$=e=>{const t=At(),[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=uS(e.col,n,n);return l===-1?[...s,c]:(s[l]=c,[...s])})},[n,e.col]);const i=`${e.col.id}-sorter-id`,a=Dp(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(PA,{size:14}):null,n==="desc"?y.jsx(kA,{size:14}):null,n==="undefined"?y.jsx(o0,{size:14}):null]})},h$=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(s$,{cols:e.cols,options:e.options,filters:e.filters,set:e.setFilters})}),y.jsx("span",{children:y.jsx(p$,{options:e.options,cols:e.cols,sorters:e.sorters,set:e.setSorters})}),y.jsx("span",{children:y.jsx(u$,{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=Np(n.target);e.setFilters(o=>o.map(i=>t.id===i.id?{...i,value:r}:i))}})]})]},`filter-table-${t.id}`))})]})});function g$(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 v$=e=>{const t=E.useId(),n=At(),r=E.useMemo(()=>g$(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]})})]})},y$=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})})},x$=(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=$f(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(y$,{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?lp: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})}))})})},b$={top:0,left:0,right:0,bottom:-1},w$=e=>{var g;const t=Pp(),n=At(),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=Fp(),l=o?QA:eI,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===lS.Asc?"ascending":"descending":"none",h=Dp(e.header);return y.jsxs(n0,{...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(gi,{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(l$,{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(Md(e.header,s.options,s.operations))),children:[y.jsx(_f,{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(m$,{col:e.header,setSorters:e.setSorters,sorters:e.sorters}):null]})}),e.isLast?null:y.jsx(ft.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:b$,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`}})]})},S$=e=>{const[t,n]=a$(e.setCols);return y.jsx(t0,{layout:!0,as:"tr",axis:"x",drag:"x",layoutRoot:!0,role:"row",layoutScroll:!0,ref:t,onReorder:n,values:e.headers,children:y.jsx(wr,{children:e.headers.map((r,o)=>y.jsx(w$,{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}`))})})},dS=E.createContext({}),T$=()=>E.useContext(dS),E$=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(wr,{children:n.children})})),C$=E.forwardRef(({context:e,className:t="",...n},r)=>y.jsx("table",{...n,ref:r,role:"table",className:`table min-w-full table-fixed border-collapse text-left ${t??""}`})),k$=E.forwardRef(({context:e,...t},n)=>{const r=T$(),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:"shadow-xs hidden md:table-header-group group:sticky top-0 bg-transparent",ref:n})}),R$=E.forwardRef(({context:e,item:t,...n},r)=>y.jsx("tr",{...n,role:"row",ref:r,className:`group-table-row h-fit flex flex-wrap gap-1 flex-col justify-center md:table-row ${(n==null?void 0:n.className)??""}`})),P$=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:"h-14 bg-card-background px-2",children:y.jsx("span",{className:"block h-2 w-full animate-pulse rounded bg-foreground opacity-60"})})})}):null),A$={TableHead:k$,Table:C$,TableBody:E$,TableRow:R$,TableFoot:P$},I$=[0,0,0,0,0,0,0,0,0,0],_$=e=>y.jsx("div",{className:"flex h-48 w-full items-center justify-center px-2",children:e.loading?lp:y.jsx(V0,{})}),O$=()=>y.jsx(E.Fragment,{}),M$=()=>y.jsx(E.Fragment,{}),D$=[],Oy=({cols:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,onScrollEnd:a,border:s=!1,pagination:l=null,useControl:c=!1,...u})=>{const d=E.useRef(null),[p,f]=E.useState(!1),h=Ur(a),g=Ur(u.loadingMore),m=E.useMemo(()=>{if(u.loading)return I$;if(c)return u.rows;const b=new cS(u.rows);return t.length>0&&t.forEach(S=>S.value===""||Number.isNaN(S.value)?void 0:b.Where(S.name,S.operation.symbol,S.value)),r.length===0?b.Select():f$(b.Select(),r)},[u.loading,u.rows,c,t,r]);E.useEffect(()=>{if(d.current===null)return()=>{};const b=d.current,S=new IntersectionObserver(w=>{var k;return w[w.length-1].isIntersecting&&g.current?((k=h.current)==null||k.call(h),void f(!0)):f(!1)});return S.observe(b),()=>S.disconnect()},[g,h]);const v=m.length===0,x={loading:u.loading,loadingMore:u.loadingMore,cols:e,Aside:u.Aside};return y.jsxs("div",{className:"min-w-full",children:[y.jsxs("div",{className:`group w-full rounded-lg ${s?"border border-table-border":""}`,children:[y.jsx(Q2,{useWindowScroll:!0,context:x,components:A$,totalCount:m.length,itemContent:v?O$:x$,data:v?D$:m,fixedFooterContent:p?M$:null,fixedHeaderContent:()=>y.jsx(S$,{headers:e,filters:t,setCols:n,sorters:r,setFilters:o,setSorters:i,loading:!!u.loading,inlineFilter:u.inlineFilter,inlineSorter:u.inlineSorter})}),v?y.jsx(_$,{loading:u.loading}):null,y.jsx("div",{"aria-hidden":"true",ref:d,className:"h-0.5 w-full"})]}),l!==null?y.jsx(v$,{...l}):null]})},j$=(e,t)=>typeof t=="function"?t(e):t,es=(e,t,n)=>e===t||n==null?void 0:n(t),N$=e=>{const t=E.useMemo(()=>({sticky:e.sticky}),[e.sticky]),n=Pp(),r=e.operations??n.table.operations??!0,o=E.useMemo(()=>jp(e.cols),[e.cols]),[i,a]=Ff({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),es((l==null?void 0:l.filters)??[],s.filters??[],e.setFilters),es((l==null?void 0:l.sorters)??[],s.sorters??[],e.setSorters),es((l==null?void 0:l.groups)??[],s.groups??[],e.setGroups),es((l==null?void 0:l.cols)??[],s.cols??[],e.setCols),s}]});return y.jsx(dS.Provider,{value:t,children:y.jsxs("div",{className:"relative min-w-full","data-component":"table",children:[r?y.jsx(h$,{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(Oy,{...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(Oy,{...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}`))})]})})},F$=["INPUT","SELECT"],fS=e=>{if(!e)return;Array.from(e.elements).forEach(n=>{F$.includes(n.tagName)&&(n.tagName==="INPUT"&&(n.value=n.defaultValue),n.tagName==="SELECT"&&(n.value=""),n.setAttribute("data-initialized","false"))})};var Cu,My;function Lp(){if(My)return Cu;My=1;var e=String.prototype.replace,t=/%20/g,n={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Cu={default:n.RFC3986,formatters:{RFC1738:function(r){return e.call(r,t,"+")},RFC3986:function(r){return String(r)}},RFC1738:n.RFC1738,RFC3986:n.RFC3986},Cu}var ku,Dy;function pS(){if(Dy)return ku;Dy=1;var e=Lp(),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(F){return"%26%23"+parseInt(F.slice(2),16)+"%3B"});for(var C="",k=0;k<T.length;k+=c){for(var I=T.length>=c?T.slice(k,k+c):T,A=[],j=0;j<I.length;++j){var D=I.charCodeAt(j);if(D===45||D===46||D===95||D===126||D>=48&&D<=57||D>=65&&D<=90||D>=97&&D<=122||w===e.RFC1738&&(D===40||D===41)){A[A.length]=I.charAt(j);continue}if(D<128){A[A.length]=r[D];continue}if(D<2048){A[A.length]=r[192|D>>6]+r[128|D&63];continue}if(D<55296||D>=57344){A[A.length]=r[224|D>>12]+r[128|D>>6&63]+r[128|D&63];continue}j+=1,D=65536+((D&1023)<<10|I.charCodeAt(j)&1023),A[A.length]=r[240|D>>18]+r[128|D>>12&63]+r[128|D>>6&63]+r[128|D&63]}C+=A.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),k=0;k<C.length;++k){var I=C[k],A=T[I];typeof A=="object"&&A!==null&&b.indexOf(A)===-1&&(x.push({obj:T,prop:I}),b.push(A))}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 ku={arrayToObject:i,assign:s,combine:h,compact:d,decode:l,encode:u,isBuffer:f,isRegExp:p,maybeMap:g,merge:a},ku}var Ru,jy;function L$(){if(jy)return Ru;jy=1;var e=sT(),t=pS(),n=Lp(),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,k,I,A,j,D,F,P,O,_,V){for(var N=m,$=V,M=0,B=!1;($=$.get(p))!==void 0&&!B;){var X=$.get(m);if(M+=1,typeof X<"u"){if(X===M)throw new RangeError("Cyclic object value");B=!0}typeof $.get(p)>"u"&&(M=0)}if(typeof I=="function"?N=I(v,N):N instanceof Date?N=D(N):x==="comma"&&i(N)&&(N=t.maybeMap(N,function(Re){return Re instanceof Date?D(Re):Re})),N===null){if(w)return k&&!O?k(v,u.encoder,_,"key",F):v;N=""}if(d(N)||t.isBuffer(N)){if(k){var Q=O?v:k(v,u.encoder,_,"key",F);return[P(Q)+"="+P(k(N,u.encoder,_,"value",F))]}return[P(v)+"="+P(String(N))]}var J=[];if(typeof N>"u")return J;var G;if(x==="comma"&&i(N))O&&k&&(N=t.maybeMap(N,k)),G=[{value:N.length>0?N.join(",")||null:void 0}];else if(i(I))G=I;else{var Y=Object.keys(N);G=A?Y.sort(A):Y}var Z=C?String(v).replace(/\./g,"%2E"):String(v),L=b&&i(N)&&N.length===1?Z+"[]":Z;if(S&&i(N)&&N.length===0)return L+"[]";for(var z=0;z<G.length;++z){var K=G[z],ie=typeof K=="object"&&K&&typeof K.value<"u"?K.value:N[K];if(!(T&&ie===null)){var H=j&&C?String(K).replace(/\./g,"%2E"):String(K),ye=i(N)?typeof x=="function"?x(L,H):L:L+(j?"."+H:"["+H+"]");V.set(m,M);var Te=e();Te.set(p,V),s(J,g(ie,ye,x,b,S,w,T,C,x==="comma"&&O&&i(N)?null:k,I,A,j,D,F,P,O,_,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 Ru=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 k=e(),I=0;I<b.length;++I){var A=b[I],j=v[A];x.skipNulls&&j===null||s(w,f(j,A,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,k))}var D=w.join(x.delimiter),F=x.addQueryPrefix===!0?"?":"";return x.charsetSentinel&&(x.charset==="iso-8859-1"?F+="utf8=%26%2310003%3B&":F+="utf8=%E2%9C%93&"),D.length>0?F+D:""},Ru}var Pu,Ny;function V$(){if(Ny)return Pu;Ny=1;var e=pS(),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("]="),k=C===-1?T.indexOf("="):C+1,I,A;k===-1?(I=h.decoder(T,r.decoder,w,"key"),A=h.strictNullHandling?null:""):(I=h.decoder(T.slice(0,k),r.decoder,w,"key"),A=e.maybeMap(i(T.slice(k+1),h,n(g[I])?g[I].length:0),function(D){return h.decoder(D,r.decoder,w,"value")})),A&&h.interpretNumericEntities&&w==="iso-8859-1"&&(A=o(String(A))),T.indexOf("[]=")>-1&&(A=n(A)?[A]:A);var j=t.call(g,I);j&&h.duplicates==="combine"?g[I]=e.combine(g[I],A):(!j||h.duplicates==="last")&&(g[I]=A)}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,k=parseInt(C,10);!h.parseArrays&&C===""?S={0:x}:!isNaN(k)&&w!==C&&String(k)===C&&k>=0&&h.parseArrays&&k<=h.arrayLimit?(S=[],S[k]=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 Pu=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)},Pu}var Au,Fy;function $$(){if(Fy)return Au;Fy=1;var e=L$(),t=V$(),n=Lp();return Au={formats:n,parse:t,stringify:e},Au}var z$=$$(),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 Ly;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Ly||(Ly={}));const fe=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ur=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 fa=(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 B$=fa;function Dd(){return B$}const jd=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=Dd(),r=jd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===fa?void 0:fa].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"}),Ii=e=>({status:"dirty",value:e}),Yt=e=>({status:"valid",value:e}),Vy=e=>e.status==="aborted",$y=e=>e.status==="dirty",Qo=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 mS(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 _i,Oi;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 zy=(e,t)=>{if(Qo(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 ur(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ur(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:ur(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:ur(t)},i=this._parseSync({data:t,path:o.path,parent:o});return zy(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:ur(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:o});return Qo(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=>Qo(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:ur(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Vs(o)?o:Promise.resolve(o));return zy(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 ma.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 yS({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 Ml.create(this,t)}readonly(){return Xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const H$=/^c[^\s-]{8,}$/i,W$=/^[0-9a-z]+$/,q$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U$=/^[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,K$=/^[a-z0-9_-]{21}$/i,Y$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G$=/^[-+]?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)?)??$/,Z$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,X$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Iu;const Q$=/^(?:(?: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])$/,J$=/^(?:(?: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])$/,ez=/^(([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]))$/,tz=/^(([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])$/,nz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hS="((\\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])))",oz=new RegExp(`^${hS}$`);function gS(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 iz(e){return new RegExp(`^${gS(e)}$`)}function az(e){let t=`${hS}T${gS(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 sz(e,t){return!!((t==="v4"||!t)&&Q$.test(e)||(t==="v6"||!t)&&ez.test(e))}function lz(e,t){if(!Y$.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 cz(e,t){return!!((t==="v4"||!t)&&J$.test(e)||(t==="v6"||!t)&&tz.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")Z$.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")Iu||(Iu=new RegExp(X$,"u")),Iu.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")U$.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")K$.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")H$.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")W$.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")q$.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"?az(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"?oz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:re.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?iz(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"?G$.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?sz(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"?lz(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"?cz(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"?nz.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64",code:re.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?rz.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 uz(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"?uz(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 Jo 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 Jo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ve.toString(o)}]})}_addCheck(t){return new Jo({...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}}Jo.create=e=>{var t;return new Jo({checks:[],typeName:Ee.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};class Nd 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)}}Nd.create=e=>new Nd({typeName:Ee.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class pa 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 pa({...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}}pa.create=e=>new pa({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ee.ZodDate,..._e(e)});class Fd 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)}}Fd.create=e=>new Fd({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 Ld extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return Yt(t.data)}}Ld.create=e=>new Ld({typeName:Ee.ZodAny,..._e(e)});class Mo extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Yt(t.data)}}Mo.create=e=>new Mo({typeName:Ee.ZodUnknown,..._e(e)});class br extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:fe.never,received:n.parsedType}),ke}}br.create=e=>new br({typeName:Ee.ZodNever,..._e(e)});class Vd 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)}}Vd.create=e=>new Vd({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 bo(e){if(e instanceof xt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=qn.create(bo(r))}return new xt({...e._def,shape:()=>t})}else return e instanceof Nn?new Nn({...e._def,type:bo(e.element)}):e instanceof qn?qn.create(bo(e.unwrap())):e instanceof no?no.create(bo(e.unwrap())):e instanceof Xn?Xn.create(e.items.map(t=>bo(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 br&&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 br){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 bo(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 vS(qe.objectKeys(this.shape))}}xt.create=(e,t)=>new xt({shape:()=>e,unknownKeys:"strip",catchall:br.create(),typeName:Ee.ZodObject,..._e(t)});xt.strictCreate=(e,t)=>new xt({shape:()=>e,unknownKeys:"strict",catchall:br.create(),typeName:Ee.ZodObject,..._e(t)});xt.lazycreate=(e,t)=>new xt({shape:e,unknownKeys:"strip",catchall:br.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 yS||e instanceof Xs?Hn(e.unwrap()):e instanceof Zs?Hn(e._def.innerType):[];class Vp 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 Vp({typeName:Ee.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,..._e(r)})}}function $d(e,t){const n=ur(e),r=ur(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=$d(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=$d(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(Vy(i)||Vy(a))return ke;const s=$d(i.value,a.value);return s.valid?(($y(i)||$y(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 zd 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}}}}zd.create=(e,t,n)=>new zd({valueType:t,keyType:e,typeName:Ee.ZodMap,..._e(n)});class ei 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 ei({...this._def,minSize:{value:t,message:ve.toString(n)}})}max(t,n){return new ei({...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)}}ei.create=(e,t)=>new ei({valueType:e,minSize:null,maxSize:null,typeName:Ee.ZodSet,..._e(t)});class Ui 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 jd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dd(),fa].filter(c=>!!c),issueData:{code:re.invalid_arguments,argumentsError:l}})}function o(s,l){return jd({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dd(),fa].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 ma){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 Ui({...this._def,args:Xn.create(t).rest(Mo.create())})}returns(t){return new Ui({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Ui({args:t||Xn.create([]).rest(Mo.create()),returns:n||Mo.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 vS(e,t){return new to({values:e,typeName:Ee.ZodEnum,..._e(t)})}class to extends Fe{constructor(){super(...arguments),_i.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,_i)||mS(this,_i,new Set(this._def.values)),!$s(this,_i).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})}}_i=new WeakMap;to.create=vS;class Ys extends Fe{constructor(){super(...arguments),Oi.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,Oi)||mS(this,Oi,new Set(qe.getValidEnumValues(this._def.values))),!$s(this,Oi).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}}Oi=new WeakMap;Ys.create=(e,t)=>new Ys({values:e,typeName:Ee.ZodNativeEnum,..._e(t)});class ma 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})))}}ma.create=(e,t)=>new ma({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"?Ii(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"?Ii(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(!Qo(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=>Qo(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 Bd 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}}}Bd.create=e=>new Bd({typeName:Ee.ZodNaN,..._e(e)});class yS 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 Ml 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(),Ii(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 Ml({in:t,out:n,typeName:Ee.ZodPipeline})}}class Xs extends Fe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Qo(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;Bd.create;Jo.create;Nd.create;pa.create;Fd.create;zs.create;Bs.create;Ld.create;Mo.create;br.create;Vd.create;Nn.create;xt.create;xt.strictCreate;Hs.create;Vp.create;Ws.create;Xn.create;qs.create;zd.create;ei.create;Ui.create;Us.create;Ks.create;to.create;Ys.create;ma.create;Qn.create;qn.create;no.create;Qn.createWithPreprocess;Ml.create;const dz=e=>{if(typeof e!="string")try{e=JSON.stringify(e)}catch{return!1}try{return JSON.parse(e),!0}catch{return!1}},fz=(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]}}},xS=e=>e.replace(/\[(\d+)]/g,".$1").split("."),Xt=(e,t,n)=>{const r=Array.isArray(t)?t.map(String):xS(t),o=structuredClone(e);return fz(o,r,n),o},pz=(e,t)=>e.localeCompare(t),xo={},bS=e=>{const t=e._def.typeName;if(t==="ZodDefault")return e._def.defaultValue();if(t==="ZodObject")return wS(e);if(t==="ZodArray")return[];if("innerType"in e._def){const n=bS(e._def.innerType);return t==="ZodArray"?n??[]:n}},wS=e=>Object.fromEntries(Object.entries(e.shape).map(([t,n])=>[t,bS(n)])),SS=(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]=SS(i,o):n[r]=o||i)}return n},mz={sort:pz,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},TS=e=>{const t=new FormData(e),n=new URLSearchParams(t);return z$.parse(n.toString(),mz)},lr=(e,t)=>xS(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),dr=e=>e.dataset.value?e.dataset.value:e.type==="checkbox"?e.checked:e.type==="number"?e.valueAsNumber:e.value||e.getAttribute("value"),_u=e=>{const t=e.dataset.target;if(!t)return dr(e);const n=document.querySelector(`[data-origin="${t}"]`);return dr(n||e)},hz={state:{},loading:!1,useOnChange:!1},By=e=>e.dataset.target||e.name,gz=e=>{const t=`@use-form/${e}`;return{get:()=>{const n=qi.LocalStorage.get(t);return dz(n)?n:{}},clear:()=>void qi.LocalStorage.delete(t),set:n=>qi.LocalStorage.set(t,n)}},vz=(e,t,n=hz)=>{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)??wS(e)??{}),l=E.useCallback(b=>{var A;const S=b.target,w=b.currentTarget;if(S.dataset.optional==="true")return;const C=By(S),k=_u(S)||(w?dr(w):""),I=lr(C,e);if(S.setAttribute("data-initialized","true"),I){const j=I.safeParse(k),D=j.success?void 0:((A=j.error.issues[0])==null?void 0:A.message)??"";o(F=>Xt(F??{},C,D))}},[e]),c=E.useCallback(b=>S=>{const w=S.currentTarget,T=Object.values(i.current).reduce((k,I)=>{var P;const A=I.element,j=I.schema.safeParse(dr(A));if(A.dataset.ignore==="ignore"||j.success)return k;const D=(P=j.error.issues[0])==null?void 0:P.message;A.setAttribute("data-initialized","true");const F=A.dataset.name||A.name||"";return Xt(k,F,D)},{}),C=Ve.empty(T)?null:T;o(C),console.error(C),b==null||b({form:w,errors:C||{}})},[]),u=(b,S=xo)=>{const w=lr(b,e),T=C=>{var I;if(!Of(C))return;s(A=>Xt(A,b,C.toISOString())),o(A=>Xt(A,b,void 0));const k=i.current[b].element;if(k){const A=k.getAttribute("data-origin"),j=document.querySelector(`input[data-target="${A}"]`);j&&j.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=xo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const k=C.target.value;s(A=>Xt(A,b,k)),(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=xo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChange:C=>{var I;const k=C.target.checked;s(A=>Xt(A??{},b,k)),(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=xo)=>{const w=lr(b,e),T=C=>{var I,A;(I=C.persist)==null||I.call(C);const k=C.target.value;(A=S==null?void 0:S.onChange)==null||A.call(S,C),s(j=>Xt(j,b,k))};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=xo)=>{const w=lr(b,e);return{...S,name:b,id:b,onChangeOptions:C=>{s(k=>Xt(k,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=xo)=>{const w=lr(b,e),T=w._def.typeName==="ZodNumber";return{...S,name:b,id:b,onChange:k=>{var A,j;(A=k.persist)==null||A.call(k);const I=T?k.target.valueAsNumber:k.target.value;(j=S==null?void 0:S.onChange)==null||j.call(S,k),s(D=>Xt(D,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:k=>k===null?void 0:void(i.current[b]={element:k,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(dr(T)),k=D=>{var V;const F=By(D.target);if(!F)return!1;const P=D.target,O=_u(D.target)||(D.relatedTarget?dr(D.relatedTarget):""),_=w.schema.safeParse(O);if(P.setAttribute("value",O),_.success)return T.setCustomValidity&&T.setCustomValidity(""),o(N=>{if(Ve.null(N))return null;const $=Xt(N,F,void 0);return Ve.empty(N)||Ve.nil(N)||Ve.empty($)?null:$}),!1;if(T.required){const N=((V=_.error.issues[0])==null?void 0:V.message)||"";T.setCustomValidity&&T.setCustomValidity(N),o($=>{if(Ve.null($))return null;const M=Xt($,F,N||void 0);return Ve.empty(M)?null:M})}return!1},I=new AbortController,A=T.getAttribute("data-trigger")||"blur";T.addEventListener(A,k,{signal:I.signal});const j=T.dataset.shadow?!1:T.required?!C.success:!1;return{input:w,hasInitialError:j,unsubscribe:()=>I.abort()}});return b.some(w=>w.hasInitialError)&&o(w=>w===null?{}:w),()=>b.forEach(w=>w.unsubscribe())});const m=b=>S=>{var j;S.preventDefault();const w=S.currentTarget;let T=TS(w);(t?Array.from(document.querySelectorAll(`[form="${t}"]`)):Array.from(w.elements)).forEach(D=>{if(D.tagName==="SELECT"){const F=D;T=Xt(T,F.name,F.value)}if(D.tagName==="INPUT"){const F=D,P=_u(F)||(F?dr(F):"");T=Xt(T,F.dataset.target||F.name,P)}});const k=SS(T,a),I=e.safeParse(k),A=()=>{var D;fS(w),(D=n.interceptor)==null||D.clear()};if(I.success){const D=JSON.stringify(I.data);return w.setAttribute("data-json",D),(j=n.interceptor)==null||j.clear(),b==null?void 0:b(S,{form:w,event:S,reset:A,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:A,setErrors:o,data:T,success:!1,errors:I.error.issues.map(D=>({message:D.message,path:D.path.map(F=>String(F))}))})},v=b=>$f(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}},yz=e=>e?JSON.parse(e.getAttribute("data-json")):{},xz=e=>{const t=E.useRef(void 0);return E.useEffect(()=>{t.current=e},[e]),t.current},ES={button:"0.55rem",pill:"2rem",card:"0.75rem",full:"9999px"},CS={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"},kS={normal:"1",navbar:"22",calendar:"2",overlay:"21",tooltip:"20",floating:"22"},bz={name:"dark",zIndex:kS,rounded:ES,spacing:CS,shadow:{floating:"0 1px 1px 0 rgb(0 0 0 / 0.02)"},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%)"}}}},wz={rounded:ES,spacing:CS,name:"light",shadow:{floating:"0 1px 1px 0 rgb(0 0 0 / 0.02)"},zIndex:kS,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%, 88%)",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%)"}}}},Sz=bz,Tz=wz,Ez=e=>{const t=E.useMemo(()=>({locale:e.locale,tweaks:{...gl,...e.tweaks},parser:e.parser||ml.hsla,map:{...hl,...e.map}}),[e]);return y.jsx(li.Provider,{value:t,children:e.children})},Cz=()=>{const e=E.useContext(li);return e?e.parser:ml.hsla};exports.Alert=fI;exports.Autocomplete=xF;exports.Button=Do;exports.Calendar=L0;exports.Card=Bf;exports.Checkbox=Ap;exports.ColType=Oo;exports.Collapse=l0;exports.CommandPalette=RN;exports.ComponentsProvider=Ez;exports.Context=li;exports.DatePicker=wF;exports.Dict=yn;exports.Dropdown=gi;exports.Empty=V0;exports.Expand=PN;exports.FileUpload=DL;exports.Form=jL;exports.Input=Aa;exports.InputFeedback=R1;exports.InputField=Pa;exports.Menu=_N;exports.MenuItem=IN;exports.Modal=Gw;exports.MultiSelect=BL;exports.Notifications=sD;exports.Polymorph=un;exports.Radiobox=HL;exports.RenderOnView=sE;exports.Select=Qr;exports.Slider=CV;exports.Stats=lD;exports.Switch=kV;exports.Tab=fD;exports.Table=N$;exports.Tabs=uD;exports.Tag=Yd;exports.TaskList=RV;exports.Textarea=PV;exports.Timeline=pD;exports.TimelineItem=xl;exports.Toolbar=ON;exports.Tooltip=up;exports.TransferList=_V;exports.createColumns=n$;exports.createCssProperties=eM;exports.createDesignTokens=M0;exports.createFormStorage=gz;exports.createOptionCols=jp;exports.createStyles=XO;exports.createTheme=JO;exports.createTokenStyles=tM;exports.css=Ie;exports.defaultDarkTheme=Sz;exports.defaultLightTheme=Tz;exports.defaultTranslations=hl;exports.defaultTweaks=gl;exports.dispatchInput=ux;exports.formReset=fS;exports.formToJson=TS;exports.getCoords=nE;exports.getJsonForm=yz;exports.getRemainingSize=Ki;exports.getSchemaShape=lr;exports.hasVerticalScroll=dx;exports.initializeInputDataset=ga;exports.isMobile=j0;exports.isReactComponent=tE;exports.isReactFC=Kd;exports.isSsr=Yr;exports.mergeRefs=Un;exports.negate=rM;exports.noop=zf;exports.parsers=ml;exports.path=$f;exports.reduceTokens=Vr;exports.safeRegex=od;exports.splitInto=D0;exports.useColorParser=Cz;exports.useForm=vz;exports.useLocale=Vf;exports.useNotification=iD;exports.usePrevious=xz;exports.useReactive=lw;exports.useTablePreferences=i$;exports.useTranslations=At;exports.uuid=ci;
212
212
  //# sourceMappingURL=index.js.map