finform-react-builder 1.5.14 → 1.5.15
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.es.js +5 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var da=e=>{throw TypeError(e)};var Jn=(e,t,r)=>t.has(e)||da("Cannot "+r);var v=(e,t,r)=>(Jn(e,t,"read from private field"),r?r.call(e):t.get(e)),le=(e,t,r)=>t.has(e)?da("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),X=(e,t,r,n)=>(Jn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),me=(e,t,r)=>(Jn(e,t,"access private method"),r);var un=(e,t,r,n)=>({set _(i){X(e,t,i,r)},get _(){return v(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react/jsx-runtime"),M=require("react"),I=require("@mui/material"),fl=require("@emotion/styled");require("@emotion/react");function ml(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=ml(M);var tn=e=>e.type==="checkbox",Qt=e=>e instanceof Date,Le=e=>e==null;const Bs=e=>typeof e=="object";var je=e=>!Le(e)&&!Array.isArray(e)&&Bs(e)&&!Qt(e),qs=e=>je(e)&&e.target?tn(e.target)?e.target.checked:e.target.value:e,hl=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Us=(e,t)=>e.has(hl(t)),yl=e=>{const t=e.constructor&&e.constructor.prototype;return je(t)&&t.hasOwnProperty("isPrototypeOf")},Bi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ie(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Bi&&(e instanceof Blob||n))&&(r||je(e)))if(t=r?[]:{},!r&&!yl(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=Ie(e[i]));else return e;return t}var Nn=e=>/^\w*$/.test(e),Fe=e=>e===void 0,qi=e=>Array.isArray(e)?e.filter(Boolean):[],Ui=e=>qi(e.replace(/["|']|\]/g,"").split(/\.|\[/)),U=(e,t,r)=>{if(!t||!je(e))return r;const n=(Nn(t)?[t]:Ui(t)).reduce((i,a)=>Le(i)?i:i[a],e);return Fe(n)||n===e?Fe(e[t])?r:e[t]:n},Ke=e=>typeof e=="boolean",ve=(e,t,r)=>{let n=-1;const i=Nn(t)?[t]:Ui(t),a=i.length,s=a-1;for(;++n<a;){const o=i[n];let l=r;if(n!==s){const f=e[o];l=je(f)||Array.isArray(f)?f:isNaN(+i[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=l,e=e[o]}};const On={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},at={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},yt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ws=M.createContext(null);Ws.displayName="HookFormContext";const Wi=()=>M.useContext(Ws);var Hs=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const s=a;return t._proxyFormState[s]!==at.all&&(t._proxyFormState[s]=!n||at.all),r&&(r[s]=!0),e[s]}});return i};const Hi=typeof window<"u"?Ae.useLayoutEffect:Ae.useEffect;function gl(e){const t=Wi(),{control:r=t.control,disabled:n,name:i,exact:a}=e||{},[s,o]=M.useState(r._formState),l=M.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Hi(()=>r._subscribe({name:i,formState:l.current,exact:a,callback:f=>{!n&&o({...r._formState,...f})}}),[i,n,a]),M.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),M.useMemo(()=>Hs(s,r,l.current,!1),[s,r])}var ht=e=>typeof e=="string",Ks=(e,t,r,n,i)=>ht(e)?(n&&t.watch.add(e),U(r,e,i)):Array.isArray(e)?e.map(a=>(n&&t.watch.add(a),U(r,a))):(n&&(t.watchAll=!0),r);function vl(e){const t=Wi(),{control:r=t.control,name:n,defaultValue:i,disabled:a,exact:s}=e||{},o=M.useRef(i),[l,f]=M.useState(r._getWatch(n,o.current));return Hi(()=>r._subscribe({name:n,formState:{values:!0},exact:s,callback:d=>!a&&f(Ks(n,r._names,d.values||r._formValues,!1,o.current))}),[n,r,a,s]),M.useEffect(()=>r._removeUnmounted()),l}function xl(e){const t=Wi(),{name:r,disabled:n,control:i=t.control,shouldUnregister:a}=e,s=Us(i._names.array,r),o=vl({control:i,name:r,defaultValue:U(i._formValues,r,U(i._defaultValues,r,e.defaultValue)),exact:!0}),l=gl({control:i,name:r,exact:!0}),f=M.useRef(e),d=M.useRef(i.register(r,{...e.rules,value:o,...Ke(e.disabled)?{disabled:e.disabled}:{}})),p=M.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!U(l.errors,r)},isDirty:{enumerable:!0,get:()=>!!U(l.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!U(l.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!U(l.validatingFields,r)},error:{enumerable:!0,get:()=>U(l.errors,r)}}),[l,r]),m=M.useCallback(b=>d.current.onChange({target:{value:qs(b),name:r},type:On.CHANGE}),[r]),x=M.useCallback(()=>d.current.onBlur({target:{value:U(i._formValues,r),name:r},type:On.BLUR}),[r,i._formValues]),h=M.useCallback(b=>{const g=U(i._fields,r);g&&b&&(g._f.ref={focus:()=>b.focus&&b.focus(),select:()=>b.select&&b.select(),setCustomValidity:O=>b.setCustomValidity(O),reportValidity:()=>b.reportValidity()})},[i._fields,r]),c=M.useMemo(()=>({name:r,value:o,...Ke(n)||l.disabled?{disabled:l.disabled||n}:{},onChange:m,onBlur:x,ref:h}),[r,n,l.disabled,m,x,h,o]);return M.useEffect(()=>{const b=i._options.shouldUnregister||a;i.register(r,{...f.current.rules,...Ke(f.current.disabled)?{disabled:f.current.disabled}:{}});const g=(O,A)=>{const C=U(i._fields,O);C&&C._f&&(C._f.mount=A)};if(g(r,!0),b){const O=Ie(U(i._options.defaultValues,r));ve(i._defaultValues,r,O),Fe(U(i._formValues,r))&&ve(i._formValues,r,O)}return!s&&i.register(r),()=>{(s?b&&!i._state.action:b)?i.unregister(r):g(r,!1)}},[r,i,s,a]),M.useEffect(()=>{i._setDisabledField({disabled:n,name:r})},[n,r,i]),M.useMemo(()=>({field:c,formState:l,fieldState:p}),[c,l,p])}const lt=e=>e.render(xl(e));var Qs=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},Ur=e=>Array.isArray(e)?e:[e],pa=()=>{let e=[];return{get observers(){return e},next:i=>{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}},yi=e=>Le(e)||!Bs(e);function _t(e,t){if(yi(e)||yi(t))return e===t;if(Qt(e)&&Qt(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r){const a=e[i];if(!n.includes(i))return!1;if(i!=="ref"){const s=t[i];if(Qt(a)&&Qt(s)||je(a)&&je(s)||Array.isArray(a)&&Array.isArray(s)?!_t(a,s):a!==s)return!1}}return!0}var Ue=e=>je(e)&&!Object.keys(e).length,Ki=e=>e.type==="file",st=e=>typeof e=="function",Tn=e=>{if(!Bi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Gs=e=>e.type==="select-multiple",Qi=e=>e.type==="radio",bl=e=>Qi(e)||tn(e),Xn=e=>Tn(e)&&e.isConnected;function wl(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Fe(e)?n++:e[t[n++]];return e}function Sl(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}function De(e,t){const r=Array.isArray(t)?t:Nn(t)?[t]:Ui(t),n=r.length===1?e:wl(e,r),i=r.length-1,a=r[i];return n&&delete n[a],i!==0&&(je(n)&&Ue(n)||Array.isArray(n)&&Sl(n))&&De(e,r.slice(0,-1)),e}var Ys=e=>{for(const t in e)if(st(e[t]))return!0;return!1};function Cn(e,t={}){const r=Array.isArray(e);if(je(e)||r)for(const n in e)Array.isArray(e[n])||je(e[n])&&!Ys(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Cn(e[n],t[n])):Le(e[n])||(t[n]=!0);return t}function Zs(e,t,r){const n=Array.isArray(e);if(je(e)||n)for(const i in e)Array.isArray(e[i])||je(e[i])&&!Ys(e[i])?Fe(t)||yi(r[i])?r[i]=Array.isArray(e[i])?Cn(e[i],[]):{...Cn(e[i])}:Zs(e[i],Le(t)?{}:t[i],r[i]):r[i]=!_t(e[i],t[i]);return r}var Mr=(e,t)=>Zs(e,t,Cn(t));const fa={value:!1,isValid:!1},ma={value:!0,isValid:!0};var Js=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Fe(e[0].attributes.value)?Fe(e[0].value)||e[0].value===""?ma:{value:e[0].value,isValid:!0}:ma:fa}return fa},Xs=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Fe(e)?e:t?e===""?NaN:e&&+e:r&&ht(e)?new Date(e):n?n(e):e;const ha={isValid:!1,value:null};var eo=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ha):ha;function ya(e){const t=e.ref;return Ki(t)?t.files:Qi(t)?eo(e.refs).value:Gs(t)?[...t.selectedOptions].map(({value:r})=>r):tn(t)?Js(e.refs).value:Xs(Fe(t.value)?e.ref.value:t.value,e)}var El=(e,t,r,n)=>{const i={};for(const a of e){const s=U(t,a);s&&ve(i,a,s._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},_n=e=>e instanceof RegExp,zr=e=>Fe(e)?e:_n(e)?e.source:je(e)?_n(e.value)?e.value.source:e.value:e,ga=e=>({isOnSubmit:!e||e===at.onSubmit,isOnBlur:e===at.onBlur,isOnChange:e===at.onChange,isOnAll:e===at.all,isOnTouch:e===at.onTouched});const va="AsyncFunction";var kl=e=>!!e&&!!e.validate&&!!(st(e.validate)&&e.validate.constructor.name===va||je(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===va)),Ol=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),xa=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Wr=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const a=U(e,i);if(a){const{_f:s,...o}=a;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],i)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(Wr(o,t))break}else if(je(o)&&Wr(o,t))break}}};function ba(e,t,r){const n=U(e,r);if(n||Nn(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const a=i.join("."),s=U(t,a),o=U(e,a);if(s&&!Array.isArray(s)&&r!==a)return{name:r};if(o&&o.type)return{name:a,error:o};if(o&&o.root&&o.root.type)return{name:`${a}.root`,error:o.root};i.pop()}return{name:r}}var Tl=(e,t,r,n)=>{r(e);const{name:i,...a}=e;return Ue(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(s=>t[s]===(!n||at.all))},Cl=(e,t,r)=>!e||!t||e===t||Ur(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),_l=(e,t,r,n,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?n.isOnChange:i.isOnChange)?e:!0,Al=(e,t)=>!qi(U(e,t)).length&&De(e,t),Fl=(e,t,r)=>{const n=Ur(U(e,r));return ve(n,"root",t[r]),ve(e,r,n),e},wn=e=>ht(e);function wa(e,t,r="validate"){if(wn(e)||Array.isArray(e)&&e.every(wn)||Ke(e)&&!e)return{type:r,message:wn(e)?e:"",ref:t}}var dr=e=>je(e)&&!_n(e)?e:{value:e,message:""},Sa=async(e,t,r,n,i,a)=>{const{ref:s,refs:o,required:l,maxLength:f,minLength:d,min:p,max:m,pattern:x,validate:h,name:c,valueAsNumber:b,mount:g}=e._f,O=U(r,c);if(!g||t.has(c))return{};const A=o?o[0]:s,C=$=>{i&&A.reportValidity&&(A.setCustomValidity(Ke($)?"":$||""),A.reportValidity())},w={},L=Qi(s),K=tn(s),ie=L||K,Q=(b||Ki(s))&&Fe(s.value)&&Fe(O)||Tn(s)&&s.value===""||O===""||Array.isArray(O)&&!O.length,u=Qs.bind(null,c,n,w),F=($,V,z,N=yt.maxLength,Z=yt.minLength)=>{const se=$?V:z;w[c]={type:$?N:Z,message:se,ref:s,...u($?N:Z,se)}};if(a?!Array.isArray(O)||!O.length:l&&(!ie&&(Q||Le(O))||Ke(O)&&!O||K&&!Js(o).isValid||L&&!eo(o).isValid)){const{value:$,message:V}=wn(l)?{value:!!l,message:l}:dr(l);if($&&(w[c]={type:yt.required,message:V,ref:A,...u(yt.required,V)},!n))return C(V),w}if(!Q&&(!Le(p)||!Le(m))){let $,V;const z=dr(m),N=dr(p);if(!Le(O)&&!isNaN(O)){const Z=s.valueAsNumber||O&&+O;Le(z.value)||($=Z>z.value),Le(N.value)||(V=Z<N.value)}else{const Z=s.valueAsDate||new Date(O),se=D=>new Date(new Date().toDateString()+" "+D),ce=s.type=="time",ue=s.type=="week";ht(z.value)&&O&&($=ce?se(O)>se(z.value):ue?O>z.value:Z>new Date(z.value)),ht(N.value)&&O&&(V=ce?se(O)<se(N.value):ue?O<N.value:Z<new Date(N.value))}if(($||V)&&(F(!!$,z.message,N.message,yt.max,yt.min),!n))return C(w[c].message),w}if((f||d)&&!Q&&(ht(O)||a&&Array.isArray(O))){const $=dr(f),V=dr(d),z=!Le($.value)&&O.length>+$.value,N=!Le(V.value)&&O.length<+V.value;if((z||N)&&(F(z,$.message,V.message),!n))return C(w[c].message),w}if(x&&!Q&&ht(O)){const{value:$,message:V}=dr(x);if(_n($)&&!O.match($)&&(w[c]={type:yt.pattern,message:V,ref:s,...u(yt.pattern,V)},!n))return C(V),w}if(h){if(st(h)){const $=await h(O,r),V=wa($,A);if(V&&(w[c]={...V,...u(yt.validate,V.message)},!n))return C(V.message),w}else if(je(h)){let $={};for(const V in h){if(!Ue($)&&!n)break;const z=wa(await h[V](O,r),A,V);z&&($={...z,...u(V,z.message)},C(z.message),n&&(w[c]=$))}if(!Ue($)&&(w[c]={ref:A,...$},!n))return w}}return C(!0),w};const jl={mode:at.onSubmit,reValidateMode:at.onChange,shouldFocusError:!0};function $l(e={}){let t={...jl,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:st(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const n={};let i=je(t.defaultValues)||je(t.values)?Ie(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Ie(i),s={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,f=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let p={...d};const m={array:pa(),state:pa()},x=t.criteriaMode===at.all,h=y=>S=>{clearTimeout(f),f=setTimeout(y,S)},c=async y=>{if(!t.disabled&&(d.isValid||p.isValid||y)){const S=t.resolver?Ue((await K()).errors):await Q(n,!0);S!==r.isValid&&m.state.next({isValid:S})}},b=(y,S)=>{!t.disabled&&(d.isValidating||d.validatingFields||p.isValidating||p.validatingFields)&&((y||Array.from(o.mount)).forEach(j=>{j&&(S?ve(r.validatingFields,j,S):De(r.validatingFields,j))}),m.state.next({validatingFields:r.validatingFields,isValidating:!Ue(r.validatingFields)}))},g=(y,S=[],j,Y,E=!0,T=!0)=>{if(Y&&j&&!t.disabled){if(s.action=!0,T&&Array.isArray(U(n,y))){const W=j(U(n,y),Y.argA,Y.argB);E&&ve(n,y,W)}if(T&&Array.isArray(U(r.errors,y))){const W=j(U(r.errors,y),Y.argA,Y.argB);E&&ve(r.errors,y,W),Al(r.errors,y)}if((d.touchedFields||p.touchedFields)&&T&&Array.isArray(U(r.touchedFields,y))){const W=j(U(r.touchedFields,y),Y.argA,Y.argB);E&&ve(r.touchedFields,y,W)}(d.dirtyFields||p.dirtyFields)&&(r.dirtyFields=Mr(i,a)),m.state.next({name:y,isDirty:F(y,S),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ve(a,y,S)},O=(y,S)=>{ve(r.errors,y,S),m.state.next({errors:r.errors})},A=y=>{r.errors=y,m.state.next({errors:r.errors,isValid:!1})},C=(y,S,j,Y)=>{const E=U(n,y);if(E){const T=U(a,y,Fe(j)?U(i,y):j);Fe(T)||Y&&Y.defaultChecked||S?ve(a,y,S?T:ya(E._f)):z(y,T),s.mount&&c()}},w=(y,S,j,Y,E)=>{let T=!1,W=!1;const oe={name:y};if(!t.disabled){if(!j||Y){(d.isDirty||p.isDirty)&&(W=r.isDirty,r.isDirty=oe.isDirty=F(),T=W!==oe.isDirty);const pe=_t(U(i,y),S);W=!!U(r.dirtyFields,y),pe?De(r.dirtyFields,y):ve(r.dirtyFields,y,!0),oe.dirtyFields=r.dirtyFields,T=T||(d.dirtyFields||p.dirtyFields)&&W!==!pe}if(j){const pe=U(r.touchedFields,y);pe||(ve(r.touchedFields,y,j),oe.touchedFields=r.touchedFields,T=T||(d.touchedFields||p.touchedFields)&&pe!==j)}T&&E&&m.state.next(oe)}return T?oe:{}},L=(y,S,j,Y)=>{const E=U(r.errors,y),T=(d.isValid||p.isValid)&&Ke(S)&&r.isValid!==S;if(t.delayError&&j?(l=h(()=>O(y,j)),l(t.delayError)):(clearTimeout(f),l=null,j?ve(r.errors,y,j):De(r.errors,y)),(j?!_t(E,j):E)||!Ue(Y)||T){const W={...Y,...T&&Ke(S)?{isValid:S}:{},errors:r.errors,name:y};r={...r,...W},m.state.next(W)}},K=async y=>{b(y,!0);const S=await t.resolver(a,t.context,El(y||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return b(y),S},ie=async y=>{const{errors:S}=await K(y);if(y)for(const j of y){const Y=U(S,j);Y?ve(r.errors,j,Y):De(r.errors,j)}else r.errors=S;return S},Q=async(y,S,j={valid:!0})=>{for(const Y in y){const E=y[Y];if(E){const{_f:T,...W}=E;if(T){const oe=o.array.has(T.name),pe=E._f&&kl(E._f);pe&&d.validatingFields&&b([Y],!0);const Pe=await Sa(E,o.disabled,a,x,t.shouldUseNativeValidation&&!S,oe);if(pe&&d.validatingFields&&b([Y]),Pe[T.name]&&(j.valid=!1,S))break;!S&&(U(Pe,T.name)?oe?Fl(r.errors,Pe,T.name):ve(r.errors,T.name,Pe[T.name]):De(r.errors,T.name))}!Ue(W)&&await Q(W,S,j)}}return j.valid},u=()=>{for(const y of o.unMount){const S=U(n,y);S&&(S._f.refs?S._f.refs.every(j=>!Xn(j)):!Xn(S._f.ref))&&ee(y)}o.unMount=new Set},F=(y,S)=>!t.disabled&&(y&&S&&ve(a,y,S),!_t(D(),i)),$=(y,S,j)=>Ks(y,o,{...s.mount?a:Fe(S)?i:ht(y)?{[y]:S}:S},j,S),V=y=>qi(U(s.mount?a:i,y,t.shouldUnregister?U(i,y,[]):[])),z=(y,S,j={})=>{const Y=U(n,y);let E=S;if(Y){const T=Y._f;T&&(!T.disabled&&ve(a,y,Xs(S,T)),E=Tn(T.ref)&&Le(S)?"":S,Gs(T.ref)?[...T.ref.options].forEach(W=>W.selected=E.includes(W.value)):T.refs?tn(T.ref)?T.refs.forEach(W=>{(!W.defaultChecked||!W.disabled)&&(Array.isArray(E)?W.checked=!!E.find(oe=>oe===W.value):W.checked=E===W.value||!!E)}):T.refs.forEach(W=>W.checked=W.value===E):Ki(T.ref)?T.ref.value="":(T.ref.value=E,T.ref.type||m.state.next({name:y,values:Ie(a)})))}(j.shouldDirty||j.shouldTouch)&&w(y,E,j.shouldTouch,j.shouldDirty,!0),j.shouldValidate&&ue(y)},N=(y,S,j)=>{for(const Y in S){if(!S.hasOwnProperty(Y))return;const E=S[Y],T=y+"."+Y,W=U(n,T);(o.array.has(y)||je(E)||W&&!W._f)&&!Qt(E)?N(T,E,j):z(T,E,j)}},Z=(y,S,j={})=>{const Y=U(n,y),E=o.array.has(y),T=Ie(S);ve(a,y,T),E?(m.array.next({name:y,values:Ie(a)}),(d.isDirty||d.dirtyFields||p.isDirty||p.dirtyFields)&&j.shouldDirty&&m.state.next({name:y,dirtyFields:Mr(i,a),isDirty:F(y,T)})):Y&&!Y._f&&!Le(T)?N(y,T,j):z(y,T,j),xa(y,o)&&m.state.next({...r}),m.state.next({name:s.mount?y:void 0,values:Ie(a)})},se=async y=>{s.mount=!0;const S=y.target;let j=S.name,Y=!0;const E=U(n,j),T=pe=>{Y=Number.isNaN(pe)||Qt(pe)&&isNaN(pe.getTime())||_t(pe,U(a,j,pe))},W=ga(t.mode),oe=ga(t.reValidateMode);if(E){let pe,Pe;const rt=S.type?ya(E._f):qs(y),Ze=y.type===On.BLUR||y.type===On.FOCUS_OUT,Rr=!Ol(E._f)&&!t.resolver&&!U(r.errors,j)&&!E._f.deps||_l(Ze,U(r.touchedFields,j),r.isSubmitted,oe,W),Ut=xa(j,o,Ze);ve(a,j,rt),Ze?(E._f.onBlur&&E._f.onBlur(y),l&&l(0)):E._f.onChange&&E._f.onChange(y);const Ot=w(j,rt,Ze),Pr=!Ue(Ot)||Ut;if(!Ze&&m.state.next({name:j,type:y.type,values:Ie(a)}),Rr)return(d.isValid||p.isValid)&&(t.mode==="onBlur"?Ze&&c():Ze||c()),Pr&&m.state.next({name:j,...Ut?{}:Ot});if(!Ze&&Ut&&m.state.next({...r}),t.resolver){const{errors:cr}=await K([j]);if(T(rt),Y){const Ir=ba(r.errors,n,j),ur=ba(cr,n,Ir.name||j);pe=ur.error,j=ur.name,Pe=Ue(cr)}}else b([j],!0),pe=(await Sa(E,o.disabled,a,x,t.shouldUseNativeValidation))[j],b([j]),T(rt),Y&&(pe?Pe=!1:(d.isValid||p.isValid)&&(Pe=await Q(n,!0)));Y&&(E._f.deps&&ue(E._f.deps),L(j,Pe,pe,Ot))}},ce=(y,S)=>{if(U(r.errors,S)&&y.focus)return y.focus(),1},ue=async(y,S={})=>{let j,Y;const E=Ur(y);if(t.resolver){const T=await ie(Fe(y)?y:E);j=Ue(T),Y=y?!E.some(W=>U(T,W)):j}else y?(Y=(await Promise.all(E.map(async T=>{const W=U(n,T);return await Q(W&&W._f?{[T]:W}:W)}))).every(Boolean),!(!Y&&!r.isValid)&&c()):Y=j=await Q(n);return m.state.next({...!ht(y)||(d.isValid||p.isValid)&&j!==r.isValid?{}:{name:y},...t.resolver||!y?{isValid:j}:{},errors:r.errors}),S.shouldFocus&&!Y&&Wr(n,ce,y?E:o.mount),Y},D=y=>{const S={...s.mount?a:i};return Fe(y)?S:ht(y)?U(S,y):y.map(j=>U(S,j))},q=(y,S)=>({invalid:!!U((S||r).errors,y),isDirty:!!U((S||r).dirtyFields,y),error:U((S||r).errors,y),isValidating:!!U(r.validatingFields,y),isTouched:!!U((S||r).touchedFields,y)}),B=y=>{y&&Ur(y).forEach(S=>De(r.errors,S)),m.state.next({errors:y?r.errors:{}})},G=(y,S,j)=>{const Y=(U(n,y,{_f:{}})._f||{}).ref,E=U(r.errors,y)||{},{ref:T,message:W,type:oe,...pe}=E;ve(r.errors,y,{...pe,...S,ref:Y}),m.state.next({name:y,errors:r.errors,isValid:!1}),j&&j.shouldFocus&&Y&&Y.focus&&Y.focus()},J=(y,S)=>st(y)?m.state.subscribe({next:j=>y($(void 0,S),j)}):$(y,S,!0),ae=y=>m.state.subscribe({next:S=>{Cl(y.name,S.name,y.exact)&&Tl(S,y.formState||d,kt,y.reRenderRoot)&&y.callback({values:{...a},...r,...S})}}).unsubscribe,ne=y=>(s.mount=!0,p={...p,...y.formState},ae({...y,formState:p})),ee=(y,S={})=>{for(const j of y?Ur(y):o.mount)o.mount.delete(j),o.array.delete(j),S.keepValue||(De(n,j),De(a,j)),!S.keepError&&De(r.errors,j),!S.keepDirty&&De(r.dirtyFields,j),!S.keepTouched&&De(r.touchedFields,j),!S.keepIsValidating&&De(r.validatingFields,j),!t.shouldUnregister&&!S.keepDefaultValue&&De(i,j);m.state.next({values:Ie(a)}),m.state.next({...r,...S.keepDirty?{isDirty:F()}:{}}),!S.keepIsValid&&c()},de=({disabled:y,name:S})=>{(Ke(y)&&s.mount||y||o.disabled.has(S))&&(y?o.disabled.add(S):o.disabled.delete(S))},P=(y,S={})=>{let j=U(n,y);const Y=Ke(S.disabled)||Ke(t.disabled);return ve(n,y,{...j||{},_f:{...j&&j._f?j._f:{ref:{name:y}},name:y,mount:!0,...S}}),o.mount.add(y),j?de({disabled:Ke(S.disabled)?S.disabled:t.disabled,name:y}):C(y,!0,S.value),{...Y?{disabled:S.disabled||t.disabled}:{},...t.progressive?{required:!!S.required,min:zr(S.min),max:zr(S.max),minLength:zr(S.minLength),maxLength:zr(S.maxLength),pattern:zr(S.pattern)}:{},name:y,onChange:se,onBlur:se,ref:E=>{if(E){P(y,S),j=U(n,y);const T=Fe(E.value)&&E.querySelectorAll&&E.querySelectorAll("input,select,textarea")[0]||E,W=bl(T),oe=j._f.refs||[];if(W?oe.find(pe=>pe===T):T===j._f.ref)return;ve(n,y,{_f:{...j._f,...W?{refs:[...oe.filter(Xn),T,...Array.isArray(U(i,y))?[{}]:[]],ref:{type:T.type,name:y}}:{ref:T}}}),C(y,!1,void 0,T)}else j=U(n,y,{}),j._f&&(j._f.mount=!1),(t.shouldUnregister||S.shouldUnregister)&&!(Us(o.array,y)&&s.action)&&o.unMount.add(y)}}},H=()=>t.shouldFocusError&&Wr(n,ce,o.mount),te=y=>{Ke(y)&&(m.state.next({disabled:y}),Wr(n,(S,j)=>{const Y=U(n,j);Y&&(S.disabled=Y._f.disabled||y,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(E=>{E.disabled=Y._f.disabled||y}))},0,!1))},R=(y,S)=>async j=>{let Y;j&&(j.preventDefault&&j.preventDefault(),j.persist&&j.persist());let E=Ie(a);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:T,values:W}=await K();r.errors=T,E=W}else await Q(n);if(o.disabled.size)for(const T of o.disabled)ve(E,T,void 0);if(De(r.errors,"root"),Ue(r.errors)){m.state.next({errors:{}});try{await y(E,j)}catch(T){Y=T}}else S&&await S({...r.errors},j),H(),setTimeout(H);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ue(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},fe=(y,S={})=>{U(n,y)&&(Fe(S.defaultValue)?Z(y,Ie(U(i,y))):(Z(y,S.defaultValue),ve(i,y,Ie(S.defaultValue))),S.keepTouched||De(r.touchedFields,y),S.keepDirty||(De(r.dirtyFields,y),r.isDirty=S.defaultValue?F(y,Ie(U(i,y))):F()),S.keepError||(De(r.errors,y),d.isValid&&c()),m.state.next({...r}))},Re=(y,S={})=>{const j=y?Ie(y):i,Y=Ie(j),E=Ue(y),T=E?i:Y;if(S.keepDefaultValues||(i=j),!S.keepValues){if(S.keepDirtyValues){const W=new Set([...o.mount,...Object.keys(Mr(i,a))]);for(const oe of Array.from(W))U(r.dirtyFields,oe)?ve(T,oe,U(a,oe)):Z(oe,U(T,oe))}else{if(Bi&&Fe(y))for(const W of o.mount){const oe=U(n,W);if(oe&&oe._f){const pe=Array.isArray(oe._f.refs)?oe._f.refs[0]:oe._f.ref;if(Tn(pe)){const Pe=pe.closest("form");if(Pe){Pe.reset();break}}}}for(const W of o.mount)Z(W,U(T,W))}a=Ie(T),m.array.next({values:{...T}}),m.state.next({values:{...T}})}o={mount:S.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!S.keepIsValid||!!S.keepDirtyValues,s.watch=!!t.shouldUnregister,m.state.next({submitCount:S.keepSubmitCount?r.submitCount:0,isDirty:E?!1:S.keepDirty?r.isDirty:!!(S.keepDefaultValues&&!_t(y,i)),isSubmitted:S.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:E?{}:S.keepDirtyValues?S.keepDefaultValues&&a?Mr(i,a):r.dirtyFields:S.keepDefaultValues&&y?Mr(i,y):S.keepDirty?r.dirtyFields:{},touchedFields:S.keepTouched?r.touchedFields:{},errors:S.keepErrors?r.errors:{},isSubmitSuccessful:S.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Et=(y,S)=>Re(st(y)?y(a):y,S),ln=(y,S={})=>{const j=U(n,y),Y=j&&j._f;if(Y){const E=Y.refs?Y.refs[0]:Y.ref;E.focus&&(E.focus(),S.shouldSelect&&st(E.select)&&E.select())}},kt=y=>{r={...r,...y}},qt={control:{register:P,unregister:ee,getFieldState:q,handleSubmit:R,setError:G,_subscribe:ae,_runSchema:K,_focusError:H,_getWatch:$,_getDirty:F,_setValid:c,_setFieldArray:g,_setDisabledField:de,_setErrors:A,_getFieldArray:V,_reset:Re,_resetDefaultValues:()=>st(t.defaultValues)&&t.defaultValues().then(y=>{Et(y,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:u,_disableForm:te,_subjects:m,_proxyFormState:d,get _fields(){return n},get _formValues(){return a},get _state(){return s},set _state(y){s=y},get _defaultValues(){return i},get _names(){return o},set _names(y){o=y},get _formState(){return r},get _options(){return t},set _options(y){t={...t,...y}}},subscribe:ne,trigger:ue,register:P,handleSubmit:R,watch:J,setValue:Z,getValues:D,reset:Et,resetField:fe,clearErrors:B,unregister:ee,setError:G,setFocus:ln,getFieldState:q};return{...qt,formControl:qt}}function Dl(e={}){const t=M.useRef(void 0),r=M.useRef(void 0),[n,i]=M.useState({isDirty:!1,isValidating:!1,isLoading:st(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:st(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!st(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...o}=$l(e);t.current={...o,formState:n}}const a=t.current.control;return a._options=e,Hi(()=>{const s=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(o=>({...o,isReady:!0})),a._formState.isReady=!0,s},[a]),M.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),M.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),M.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),M.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),M.useEffect(()=>{if(a._proxyFormState.isDirty){const s=a._getDirty();s!==n.isDirty&&a._subjects.state.next({isDirty:s})}},[a,n.isDirty]),M.useEffect(()=>{e.values&&!_t(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,i(s=>({...s}))):a._resetDefaultValues()},[a,e.values]),M.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=Hs(n,a),t.current}const Ea=(e,t,r)=>{if(e&&"reportValidity"in e){const n=U(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},to=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ea(n.ref,r,e):n&&n.refs&&n.refs.forEach(i=>Ea(i,r,e))}},Rl=(e,t)=>{t.shouldUseNativeValidation&&to(e,t);const r={};for(const n in e){const i=U(t.fields,n),a=Object.assign(e[n]||{},{ref:i&&i.ref});if(Pl(t.names||Object.keys(e),n)){const s=Object.assign({},U(r,n));ve(s,"root",a),ve(r,n,s)}else ve(r,n,a)}return r},Pl=(e,t)=>{const r=ka(t);return e.some(n=>ka(n).match(`^${r}\\.\\d+`))};function ka(e){return e.replace(/\]|\[/g,"")}function Il(e,t,r){return r===void 0&&(r={}),function(n,i,a){try{return Promise.resolve(function(s,o){try{var l=(t!=null&&t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[r.mode==="sync"?"validateSync":"validate"](n,Object.assign({abortEarly:!1},t,{context:i}))).then(function(f){return a.shouldUseNativeValidation&&to({},a),{values:r.raw?Object.assign({},n):f,errors:{}}}))}catch(f){return o(f)}return l&&l.then?l.then(void 0,o):l}(0,function(s){if(!s.inner)throw s;return{values:{},errors:Rl((o=s,l=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(o.inner||[]).reduce(function(f,d){if(f[d.path]||(f[d.path]={message:d.message,type:d.type}),l){var p=f[d.path].types,m=p&&p[d.type];f[d.path]=Qs(d.path,l,f,d.type,m?[].concat(m,d.message):d.message)}return f},{})),a)};var o,l}))}catch(s){return Promise.reject(s)}}}var rn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ar=typeof window>"u"||"Deno"in globalThis;function We(){}function Ml(e,t){return typeof e=="function"?e(t):e}function gi(e){return typeof e=="number"&&e>=0&&e!==1/0}function ro(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zt(e,t){return typeof e=="function"?e(t):e}function Xe(e,t){return typeof e=="function"?e(t):e}function Oa(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:s,stale:o}=e;if(s){if(n){if(t.queryHash!==Gi(s,t.options))return!1}else if(!Qr(t.queryKey,s))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ta(e,t){const{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Kr(t.options.mutationKey)!==Kr(a))return!1}else if(!Qr(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Gi(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kr)(e)}function Kr(e){return JSON.stringify(e,(t,r)=>bi(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function Qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Qr(e[r],t[r])):!1}function vi(e,t){if(e===t)return e;const r=Ca(e)&&Ca(t);if(r||bi(e)&&bi(t)){const n=r?e:Object.keys(e),i=n.length,a=r?t:Object.keys(t),s=a.length,o=r?[]:{},l=new Set(n);let f=0;for(let d=0;d<s;d++){const p=r?d:a[d];(!r&&l.has(p)||r)&&e[p]===void 0&&t[p]===void 0?(o[p]=void 0,f++):(o[p]=vi(e[p],t[p]),o[p]===e[p]&&e[p]!==void 0&&f++)}return i===s&&f===i?e:o}return t}function xi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Ca(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bi(e){if(!_a(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!_a(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function _a(e){return Object.prototype.toString.call(e)==="[object Object]"}function zl(e){return new Promise(t=>{setTimeout(t,e)})}function wi(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return vi(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return vi(e,t)}return t}function Vl(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Nl(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var An=Symbol();function no(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===An&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===An?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ll(e,t){return typeof e=="function"?e(...t):!!e}var Gt,At,br,Ds,Bl=(Ds=class extends rn{constructor(){super();le(this,Gt);le(this,At);le(this,br);X(this,br,t=>{if(!ar&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){v(this,At)||this.setEventListener(v(this,br))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,At))==null||t.call(this),X(this,At,void 0))}setEventListener(t){var r;X(this,br,t),(r=v(this,At))==null||r.call(this),X(this,At,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){v(this,Gt)!==t&&(X(this,Gt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof v(this,Gt)=="boolean"?v(this,Gt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gt=new WeakMap,At=new WeakMap,br=new WeakMap,Ds),Yi=new Bl,wr,Ft,Sr,Rs,ql=(Rs=class extends rn{constructor(){super();le(this,wr,!0);le(this,Ft);le(this,Sr);X(this,Sr,t=>{if(!ar&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){v(this,Ft)||this.setEventListener(v(this,Sr))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,Ft))==null||t.call(this),X(this,Ft,void 0))}setEventListener(t){var r;X(this,Sr,t),(r=v(this,Ft))==null||r.call(this),X(this,Ft,t(this.setOnline.bind(this)))}setOnline(t){v(this,wr)!==t&&(X(this,wr,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return v(this,wr)}},wr=new WeakMap,Ft=new WeakMap,Sr=new WeakMap,Rs),Fn=new ql;function Si(){let e,t;const r=new Promise((i,a)=>{e=i,t=a});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}function Ul(e){return Math.min(1e3*2**e,3e4)}function io(e){return(e??"online")==="online"?Fn.isOnline():!0}var ao=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ei(e){return e instanceof ao}function so(e){let t=!1,r=0,n=!1,i;const a=Si(),s=c=>{var b;n||(m(new ao(c)),(b=e.abort)==null||b.call(e))},o=()=>{t=!0},l=()=>{t=!1},f=()=>Yi.isFocused()&&(e.networkMode==="always"||Fn.isOnline())&&e.canRun(),d=()=>io(e.networkMode)&&e.canRun(),p=c=>{var b;n||(n=!0,(b=e.onSuccess)==null||b.call(e,c),i==null||i(),a.resolve(c))},m=c=>{var b;n||(n=!0,(b=e.onError)==null||b.call(e,c),i==null||i(),a.reject(c))},x=()=>new Promise(c=>{var b;i=g=>{(n||f())&&c(g)},(b=e.onPause)==null||b.call(e)}).then(()=>{var c;i=void 0,n||(c=e.onContinue)==null||c.call(e)}),h=()=>{if(n)return;let c;const b=r===0?e.initialPromise:void 0;try{c=b??e.fn()}catch(g){c=Promise.reject(g)}Promise.resolve(c).then(p).catch(g=>{var L;if(n)return;const O=e.retry??(ar?0:3),A=e.retryDelay??Ul,C=typeof A=="function"?A(r,g):A,w=O===!0||typeof O=="number"&&r<O||typeof O=="function"&&O(r,g);if(t||!w){m(g);return}r++,(L=e.onFail)==null||L.call(e,r,g),zl(C).then(()=>f()?void 0:x()).then(()=>{t?m(g):h()})})};return{promise:a,cancel:s,continue:()=>(i==null||i(),a),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?h():x().then(h),a)}}var Wl=e=>setTimeout(e,0);function Hl(){let e=[],t=0,r=o=>{o()},n=o=>{o()},i=Wl;const a=o=>{t?e.push(o):i(()=>{r(o)})},s=()=>{const o=e;e=[],o.length&&i(()=>{n(()=>{o.forEach(l=>{r(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||s()}return l},batchCalls:o=>(...l)=>{a(()=>{o(...l)})},schedule:a,setNotifyFunction:o=>{r=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{i=o}}}var Me=Hl(),Yt,Ps,oo=(Ps=class{constructor(){le(this,Yt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gi(this.gcTime)&&X(this,Yt,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ar?1/0:5*60*1e3))}clearGcTimeout(){v(this,Yt)&&(clearTimeout(v(this,Yt)),X(this,Yt,void 0))}},Yt=new WeakMap,Ps),Er,Zt,Je,Jt,ze,Zr,Xt,nt,xt,Is,Kl=(Is=class extends oo{constructor(t){super();le(this,nt);le(this,Er);le(this,Zt);le(this,Je);le(this,Jt);le(this,ze);le(this,Zr);le(this,Xt);X(this,Xt,!1),X(this,Zr,t.defaultOptions),this.setOptions(t.options),this.observers=[],X(this,Jt,t.client),X(this,Je,v(this,Jt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,X(this,Er,Ql(this.options)),this.state=t.state??v(this,Er),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=v(this,ze))==null?void 0:t.promise}setOptions(t){this.options={...v(this,Zr),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&v(this,Je).remove(this)}setData(t,r){const n=wi(this.state.data,t,this.options);return me(this,nt,xt).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){me(this,nt,xt).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,i;const r=(n=v(this,ze))==null?void 0:n.promise;return(i=v(this,ze))==null||i.cancel(t),r?r.then(We).catch(We):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(v(this,Er))}isActive(){return this.observers.some(t=>Xe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===An||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ro(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=v(this,ze))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=v(this,ze))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),v(this,Je).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(v(this,ze)&&(v(this,Xt)?v(this,ze).cancel({revert:!0}):v(this,ze).cancelRetry()),this.scheduleGc()),v(this,Je).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,nt,xt).call(this,{type:"invalidate"})}fetch(t,r){var f,d,p;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(v(this,ze))return v(this,ze).continueRetry(),v(this,ze).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(x=>x.options.queryFn);m&&this.setOptions(m.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(X(this,Xt,!0),n.signal)})},a=()=>{const m=no(this.options,r),h=(()=>{const c={client:v(this,Jt),queryKey:this.queryKey,meta:this.meta};return i(c),c})();return X(this,Xt,!1),this.options.persister?this.options.persister(m,h,this):m(h)},o=(()=>{const m={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:v(this,Jt),state:this.state,fetchFn:a};return i(m),m})();(f=this.options.behavior)==null||f.onFetch(o,this),X(this,Zt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&me(this,nt,xt).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const l=m=>{var x,h,c,b;ei(m)&&m.silent||me(this,nt,xt).call(this,{type:"error",error:m}),ei(m)||((h=(x=v(this,Je).config).onError)==null||h.call(x,m,this),(b=(c=v(this,Je).config).onSettled)==null||b.call(c,this.state.data,m,this)),this.scheduleGc()};return X(this,ze,so({initialPromise:r==null?void 0:r.initialPromise,fn:o.fetchFn,abort:n.abort.bind(n),onSuccess:m=>{var x,h,c,b;if(m===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(g){l(g);return}(h=(x=v(this,Je).config).onSuccess)==null||h.call(x,m,this),(b=(c=v(this,Je).config).onSettled)==null||b.call(c,m,this.state.error,this),this.scheduleGc()},onError:l,onFail:(m,x)=>{me(this,nt,xt).call(this,{type:"failed",failureCount:m,error:x})},onPause:()=>{me(this,nt,xt).call(this,{type:"pause"})},onContinue:()=>{me(this,nt,xt).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),v(this,ze).start()}},Er=new WeakMap,Zt=new WeakMap,Je=new WeakMap,Jt=new WeakMap,ze=new WeakMap,Zr=new WeakMap,Xt=new WeakMap,nt=new WeakSet,xt=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...lo(n.data,this.options),fetchMeta:t.meta??null};case"success":return X(this,Zt,void 0),{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return ei(i)&&i.revert&&v(this,Zt)?{...v(this,Zt),fetchStatus:"idle"}:{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),Me.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),v(this,Je).notify({query:this,type:"updated",action:t})})},Is);function lo(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:io(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ql(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var pt,Ms,Gl=(Ms=class extends rn{constructor(t={}){super();le(this,pt);this.config=t,X(this,pt,new Map)}build(t,r,n){const i=r.queryKey,a=r.queryHash??Gi(i,r);let s=this.get(a);return s||(s=new Kl({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){v(this,pt).has(t.queryHash)||(v(this,pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=v(this,pt).get(t.queryHash);r&&(t.destroy(),r===t&&v(this,pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Me.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return v(this,pt).get(t)}getAll(){return[...v(this,pt).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Oa(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Oa(t,n)):r}notify(t){Me.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Me.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Me.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},pt=new WeakMap,Ms),ft,Ve,er,mt,Tt,zs,Yl=(zs=class extends oo{constructor(t){super();le(this,mt);le(this,ft);le(this,Ve);le(this,er);this.mutationId=t.mutationId,X(this,Ve,t.mutationCache),X(this,ft,[]),this.state=t.state||Zl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){v(this,ft).includes(t)||(v(this,ft).push(t),this.clearGcTimeout(),v(this,Ve).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){X(this,ft,v(this,ft).filter(r=>r!==t)),this.scheduleGc(),v(this,Ve).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){v(this,ft).length||(this.state.status==="pending"?this.scheduleGc():v(this,Ve).remove(this))}continue(){var t;return((t=v(this,er))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,s,o,l,f,d,p,m,x,h,c,b,g,O,A,C,w,L,K,ie;const r=()=>{me(this,mt,Tt).call(this,{type:"continue"})};X(this,er,so({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(Q,u)=>{me(this,mt,Tt).call(this,{type:"failed",failureCount:Q,error:u})},onPause:()=>{me(this,mt,Tt).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>v(this,Ve).canRun(this)}));const n=this.state.status==="pending",i=!v(this,er).canStart();try{if(n)r();else{me(this,mt,Tt).call(this,{type:"pending",variables:t,isPaused:i}),await((s=(a=v(this,Ve).config).onMutate)==null?void 0:s.call(a,t,this));const u=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));u!==this.state.context&&me(this,mt,Tt).call(this,{type:"pending",context:u,variables:t,isPaused:i})}const Q=await v(this,er).start();return await((d=(f=v(this,Ve).config).onSuccess)==null?void 0:d.call(f,Q,t,this.state.context,this)),await((m=(p=this.options).onSuccess)==null?void 0:m.call(p,Q,t,this.state.context)),await((h=(x=v(this,Ve).config).onSettled)==null?void 0:h.call(x,Q,null,this.state.variables,this.state.context,this)),await((b=(c=this.options).onSettled)==null?void 0:b.call(c,Q,null,t,this.state.context)),me(this,mt,Tt).call(this,{type:"success",data:Q}),Q}catch(Q){try{throw await((O=(g=v(this,Ve).config).onError)==null?void 0:O.call(g,Q,t,this.state.context,this)),await((C=(A=this.options).onError)==null?void 0:C.call(A,Q,t,this.state.context)),await((L=(w=v(this,Ve).config).onSettled)==null?void 0:L.call(w,void 0,Q,this.state.variables,this.state.context,this)),await((ie=(K=this.options).onSettled)==null?void 0:ie.call(K,void 0,Q,t,this.state.context)),Q}finally{me(this,mt,Tt).call(this,{type:"error",error:Q})}}finally{v(this,Ve).runNext(this)}}},ft=new WeakMap,Ve=new WeakMap,er=new WeakMap,mt=new WeakSet,Tt=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Me.batch(()=>{v(this,ft).forEach(n=>{n.onMutationUpdate(t)}),v(this,Ve).notify({mutation:this,type:"updated",action:t})})},zs);function Zl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bt,it,Jr,Vs,Jl=(Vs=class extends rn{constructor(t={}){super();le(this,bt);le(this,it);le(this,Jr);this.config=t,X(this,bt,new Set),X(this,it,new Map),X(this,Jr,0)}build(t,r,n){const i=new Yl({mutationCache:this,mutationId:++un(this,Jr)._,options:t.defaultMutationOptions(r),state:n});return this.add(i),i}add(t){v(this,bt).add(t);const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r);n?n.push(t):v(this,it).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(v(this,bt).delete(t)){const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r);if(n)if(n.length>1){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}else n[0]===t&&v(this,it).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r),i=n==null?void 0:n.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){var n;const r=dn(t);if(typeof r=="string"){const i=(n=v(this,it).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Me.batch(()=>{v(this,bt).forEach(t=>{this.notify({type:"removed",mutation:t})}),v(this,bt).clear(),v(this,it).clear()})}getAll(){return Array.from(v(this,bt))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ta(r,n))}findAll(t={}){return this.getAll().filter(r=>Ta(t,r))}notify(t){Me.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Me.batch(()=>Promise.all(t.map(r=>r.continue().catch(We))))}},bt=new WeakMap,it=new WeakMap,Jr=new WeakMap,Vs);function dn(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Aa(e){return{onFetch:(t,r)=>{var d,p,m,x,h;const n=t.options,i=(m=(p=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,a=((x=t.state.data)==null?void 0:x.pages)||[],s=((h=t.state.data)==null?void 0:h.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const f=async()=>{let c=!1;const b=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},g=no(t.options,t.fetchOptions),O=async(A,C,w)=>{if(c)return Promise.reject();if(C==null&&A.pages.length)return Promise.resolve(A);const K=(()=>{const F={client:t.client,queryKey:t.queryKey,pageParam:C,direction:w?"backward":"forward",meta:t.options.meta};return b(F),F})(),ie=await g(K),{maxPages:Q}=t.options,u=w?Nl:Vl;return{pages:u(A.pages,ie,Q),pageParams:u(A.pageParams,C,Q)}};if(i&&a.length){const A=i==="backward",C=A?Xl:Fa,w={pages:a,pageParams:s},L=C(n,w);o=await O(w,L,A)}else{const A=e??a.length;do{const C=l===0?s[0]??n.initialPageParam:Fa(n,o);if(l>0&&C==null)break;o=await O(o,C),l++}while(l<A)}return o};t.options.persister?t.fetchFn=()=>{var c,b;return(b=(c=t.options).persister)==null?void 0:b.call(c,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=f}}}function Fa(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Xl(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var _e,jt,$t,kr,Or,Dt,Tr,Cr,Ns,ec=(Ns=class{constructor(e={}){le(this,_e);le(this,jt);le(this,$t);le(this,kr);le(this,Or);le(this,Dt);le(this,Tr);le(this,Cr);X(this,_e,e.queryCache||new Gl),X(this,jt,e.mutationCache||new Jl),X(this,$t,e.defaultOptions||{}),X(this,kr,new Map),X(this,Or,new Map),X(this,Dt,0)}mount(){un(this,Dt)._++,v(this,Dt)===1&&(X(this,Tr,Yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,_e).onFocus())})),X(this,Cr,Fn.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,_e).onOnline())})))}unmount(){var e,t;un(this,Dt)._--,v(this,Dt)===0&&((e=v(this,Tr))==null||e.call(this),X(this,Tr,void 0),(t=v(this,Cr))==null||t.call(this),X(this,Cr,void 0))}isFetching(e){return v(this,_e).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return v(this,jt).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=v(this,_e).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=v(this,_e).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zt(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return v(this,_e).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=v(this,_e).get(n.queryHash),a=i==null?void 0:i.state.data,s=Ml(t,a);if(s!==void 0)return v(this,_e).build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return Me.batch(()=>v(this,_e).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=v(this,_e).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=v(this,_e);Me.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=v(this,_e);return Me.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Me.batch(()=>v(this,_e).findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(We).catch(We)}invalidateQueries(e,t={}){return Me.batch(()=>(v(this,_e).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Me.batch(()=>v(this,_e).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,r);return r.throwOnError||(a=a.catch(We)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(We)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=v(this,_e).build(this,t);return r.isStaleByTime(zt(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(We).catch(We)}fetchInfiniteQuery(e){return e.behavior=Aa(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(We).catch(We)}ensureInfiniteQueryData(e){return e.behavior=Aa(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Fn.isOnline()?v(this,jt).resumePausedMutations():Promise.resolve()}getQueryCache(){return v(this,_e)}getMutationCache(){return v(this,jt)}getDefaultOptions(){return v(this,$t)}setDefaultOptions(e){X(this,$t,e)}setQueryDefaults(e,t){v(this,kr).set(Kr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...v(this,kr).values()],r={};return t.forEach(n=>{Qr(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){v(this,Or).set(Kr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...v(this,Or).values()],r={};return t.forEach(n=>{Qr(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...v(this,$t).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Gi(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===An&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...v(this,$t).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){v(this,_e).clear(),v(this,jt).clear()}},_e=new WeakMap,jt=new WeakMap,$t=new WeakMap,kr=new WeakMap,Or=new WeakMap,Dt=new WeakMap,Tr=new WeakMap,Cr=new WeakMap,Ns),qe,he,Xr,Ne,tr,_r,Rt,Pt,en,Ar,Fr,rr,nr,It,jr,xe,Nr,Ei,ki,Oi,Ti,Ci,_i,Ai,co,Ls,tc=(Ls=class extends rn{constructor(t,r){super();le(this,xe);le(this,qe);le(this,he);le(this,Xr);le(this,Ne);le(this,tr);le(this,_r);le(this,Rt);le(this,Pt);le(this,en);le(this,Ar);le(this,Fr);le(this,rr);le(this,nr);le(this,It);le(this,jr,new Set);this.options=r,X(this,qe,t),X(this,Pt,null),X(this,Rt,Si()),this.options.experimental_prefetchInRender||v(this,Rt).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(v(this,he).addObserver(this),ja(v(this,he),this.options)?me(this,xe,Nr).call(this):this.updateResult(),me(this,xe,Ti).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fi(v(this,he),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fi(v(this,he),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,xe,Ci).call(this),me(this,xe,_i).call(this),v(this,he).removeObserver(this)}setOptions(t){const r=this.options,n=v(this,he);if(this.options=v(this,qe).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xe(this.options.enabled,v(this,he))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,xe,Ai).call(this),v(this,he).setOptions(this.options),r._defaulted&&!xi(this.options,r)&&v(this,qe).getQueryCache().notify({type:"observerOptionsUpdated",query:v(this,he),observer:this});const i=this.hasListeners();i&&$a(v(this,he),n,this.options,r)&&me(this,xe,Nr).call(this),this.updateResult(),i&&(v(this,he)!==n||Xe(this.options.enabled,v(this,he))!==Xe(r.enabled,v(this,he))||zt(this.options.staleTime,v(this,he))!==zt(r.staleTime,v(this,he)))&&me(this,xe,Ei).call(this);const a=me(this,xe,ki).call(this);i&&(v(this,he)!==n||Xe(this.options.enabled,v(this,he))!==Xe(r.enabled,v(this,he))||a!==v(this,It))&&me(this,xe,Oi).call(this,a)}getOptimisticResult(t){const r=v(this,qe).getQueryCache().build(v(this,qe),t),n=this.createResult(r,t);return nc(this,n)&&(X(this,Ne,n),X(this,_r,this.options),X(this,tr,v(this,he).state)),n}getCurrentResult(){return v(this,Ne)}trackResult(t,r){return new Proxy(t,{get:(n,i)=>(this.trackProp(i),r==null||r(i),Reflect.get(n,i))})}trackProp(t){v(this,jr).add(t)}getCurrentQuery(){return v(this,he)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=v(this,qe).defaultQueryOptions(t),n=v(this,qe).getQueryCache().build(v(this,qe),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return me(this,xe,Nr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),v(this,Ne)))}createResult(t,r){var Q;const n=v(this,he),i=this.options,a=v(this,Ne),s=v(this,tr),o=v(this,_r),f=t!==n?t.state:v(this,Xr),{state:d}=t;let p={...d},m=!1,x;if(r._optimisticResults){const u=this.hasListeners(),F=!u&&ja(t,r),$=u&&$a(t,n,r,i);(F||$)&&(p={...p,...lo(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:h,errorUpdatedAt:c,status:b}=p;x=p.data;let g=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let u;a!=null&&a.isPlaceholderData&&r.placeholderData===(o==null?void 0:o.placeholderData)?(u=a.data,g=!0):u=typeof r.placeholderData=="function"?r.placeholderData((Q=v(this,Fr))==null?void 0:Q.state.data,v(this,Fr)):r.placeholderData,u!==void 0&&(b="success",x=wi(a==null?void 0:a.data,u,r),m=!0)}if(r.select&&x!==void 0&&!g)if(a&&x===(s==null?void 0:s.data)&&r.select===v(this,en))x=v(this,Ar);else try{X(this,en,r.select),x=r.select(x),x=wi(a==null?void 0:a.data,x,r),X(this,Ar,x),X(this,Pt,null)}catch(u){X(this,Pt,u)}v(this,Pt)&&(h=v(this,Pt),x=v(this,Ar),c=Date.now(),b="error");const O=p.fetchStatus==="fetching",A=b==="pending",C=b==="error",w=A&&O,L=x!==void 0,ie={status:b,fetchStatus:p.fetchStatus,isPending:A,isSuccess:b==="success",isError:C,isInitialLoading:w,isLoading:w,data:x,dataUpdatedAt:p.dataUpdatedAt,error:h,errorUpdatedAt:c,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:O,isRefetching:O&&!A,isLoadingError:C&&!L,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&L,isStale:Zi(t,r),refetch:this.refetch,promise:v(this,Rt),isEnabled:Xe(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const u=V=>{ie.status==="error"?V.reject(ie.error):ie.data!==void 0&&V.resolve(ie.data)},F=()=>{const V=X(this,Rt,ie.promise=Si());u(V)},$=v(this,Rt);switch($.status){case"pending":t.queryHash===n.queryHash&&u($);break;case"fulfilled":(ie.status==="error"||ie.data!==$.value)&&F();break;case"rejected":(ie.status!=="error"||ie.error!==$.reason)&&F();break}}return ie}updateResult(){const t=v(this,Ne),r=this.createResult(v(this,he),this.options);if(X(this,tr,v(this,he).state),X(this,_r,this.options),v(this,tr).data!==void 0&&X(this,Fr,v(this,he)),xi(r,t))return;X(this,Ne,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!v(this,jr).size)return!0;const s=new Set(a??v(this,jr));return this.options.throwOnError&&s.add("error"),Object.keys(v(this,Ne)).some(o=>{const l=o;return v(this,Ne)[l]!==t[l]&&s.has(l)})};me(this,xe,co).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,xe,Ti).call(this)}},qe=new WeakMap,he=new WeakMap,Xr=new WeakMap,Ne=new WeakMap,tr=new WeakMap,_r=new WeakMap,Rt=new WeakMap,Pt=new WeakMap,en=new WeakMap,Ar=new WeakMap,Fr=new WeakMap,rr=new WeakMap,nr=new WeakMap,It=new WeakMap,jr=new WeakMap,xe=new WeakSet,Nr=function(t){me(this,xe,Ai).call(this);let r=v(this,he).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(We)),r},Ei=function(){me(this,xe,Ci).call(this);const t=zt(this.options.staleTime,v(this,he));if(ar||v(this,Ne).isStale||!gi(t))return;const n=ro(v(this,Ne).dataUpdatedAt,t)+1;X(this,rr,setTimeout(()=>{v(this,Ne).isStale||this.updateResult()},n))},ki=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(v(this,he)):this.options.refetchInterval)??!1},Oi=function(t){me(this,xe,_i).call(this),X(this,It,t),!(ar||Xe(this.options.enabled,v(this,he))===!1||!gi(v(this,It))||v(this,It)===0)&&X(this,nr,setInterval(()=>{(this.options.refetchIntervalInBackground||Yi.isFocused())&&me(this,xe,Nr).call(this)},v(this,It)))},Ti=function(){me(this,xe,Ei).call(this),me(this,xe,Oi).call(this,me(this,xe,ki).call(this))},Ci=function(){v(this,rr)&&(clearTimeout(v(this,rr)),X(this,rr,void 0))},_i=function(){v(this,nr)&&(clearInterval(v(this,nr)),X(this,nr,void 0))},Ai=function(){const t=v(this,qe).getQueryCache().build(v(this,qe),this.options);if(t===v(this,he))return;const r=v(this,he);X(this,he,t),X(this,Xr,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},co=function(t){Me.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(v(this,Ne))}),v(this,qe).getQueryCache().notify({query:v(this,he),type:"observerResultsUpdated"})})},Ls);function rc(e,t){return Xe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ja(e,t){return rc(e,t)||e.state.data!==void 0&&Fi(e,t,t.refetchOnMount)}function Fi(e,t,r){if(Xe(t.enabled,e)!==!1&&zt(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Zi(e,t)}return!1}function $a(e,t,r,n){return(e!==t||Xe(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Zi(e,r)}function Zi(e,t){return Xe(t.enabled,e)!==!1&&e.isStaleByTime(zt(t.staleTime,e))}function nc(e,t){return!xi(e.getCurrentResult(),t)}var uo=Ae.createContext(void 0),ic=e=>{const t=Ae.useContext(uo);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ac=({client:e,children:t})=>(Ae.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),k.jsx(uo.Provider,{value:e,children:t})),po=Ae.createContext(!1),sc=()=>Ae.useContext(po);po.Provider;function oc(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var lc=Ae.createContext(oc()),cc=()=>Ae.useContext(lc),uc=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},dc=e=>{Ae.useEffect(()=>{e.clearReset()},[e])},pc=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&e.data===void 0||Ll(r,[e.error,n])),fc=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},mc=(e,t)=>e.isLoading&&e.isFetching&&!t,hc=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Da=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function yc(e,t,r){var p,m,x,h,c;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=sc(),i=cc(),a=ic(),s=a.defaultQueryOptions(e);(m=(p=a.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||m.call(p,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=n?"isRestoring":"optimistic",fc(s),uc(s,i),dc(i);const o=!a.getQueryCache().get(s.queryHash),[l]=Ae.useState(()=>new t(a,s)),f=l.getOptimisticResult(s),d=!n&&e.subscribed!==!1;if(Ae.useSyncExternalStore(Ae.useCallback(b=>{const g=d?l.subscribe(Me.batchCalls(b)):We;return l.updateResult(),g},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Ae.useEffect(()=>{l.setOptions(s)},[s,l]),hc(s,f))throw Da(s,l,i);if(pc({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:a.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((h=(x=a.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||h.call(x,s,f),s.experimental_prefetchInRender&&!ar&&mc(f,n)){const b=o?Da(s,l,i):(c=a.getQueryCache().get(s.queryHash))==null?void 0:c.promise;b==null||b.catch(We).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?f:l.trackResult(f)}function gc(e,t){return yc(e,tc)}const fo=({src:e,alt:t,width:r="100%",height:n="auto",style:i,className:a,onClick:s})=>k.jsx(I.Box,{sx:{textAlign:"center"},children:k.jsx("img",{src:e||"/placeholder-image.png",alt:t||"Image",width:r,height:n,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",cursor:s?"pointer":"default",...i},className:a,onClick:s,onError:o=>{o.currentTarget.src="/placeholder-image.png"}})});async function mo(e,t,r,n){try{const{endpoint:i,method:a="GET",valueField:s="value",labelField:o="label",headers:l={},params:f={},body:d,transform:p,dependsOn:m}=e;let x=i;if(t&&!i.startsWith("http")&&(x=`${t}${i.startsWith("/")?i:`/${i}`}`),m&&n){const C=n[m];C&&(x=x.replace(`{${m}}`,encodeURIComponent(C)))}const h=new URLSearchParams;Object.entries(f).forEach(([C,w])=>{w!=null&&h.append(C,String(w))}),h.toString()&&(x+=`${x.includes("?")?"&":"?"}${h.toString()}`);const c={"Content-Type":"application/json",...r,...l},b={method:a,headers:c};(a==="POST"||a==="PUT")&&d&&(b.body=JSON.stringify(d));const g=await fetch(x,b);if(!g.ok)throw new Error(`API request failed: ${g.status} ${g.statusText}`);const O=await g.json();if(p)return p(Array.isArray(O)?O:O.data||O);const A=Array.isArray(O)?O:O.data||O;if(!Array.isArray(A))throw new Error("API response is not an array");return A.map(C=>({label:C[o]||C.name||C.title||String(C[s]||""),value:C[s]||C.id||C.value||""}))}catch(i){throw console.error("API fetch error:",i),new Error(`Failed to fetch data: ${i instanceof Error?i.message:"Unknown error"}`)}}function ho(e,t,r,n,i=!1){const a=M.useMemo(()=>{if(!(e!=null&&e.dependsOn)||!n)return null;const o=n[e.dependsOn];return o!==void 0?o:null},[e==null?void 0:e.dependsOn,n]),s=M.useMemo(()=>["api-data",e==null?void 0:e.endpoint,e==null?void 0:e.method,e==null?void 0:e.valueField,e==null?void 0:e.labelField,t,a],[e==null?void 0:e.endpoint,e==null?void 0:e.method,e==null?void 0:e.valueField,e==null?void 0:e.labelField,t,a]);return gc({queryKey:s,queryFn:()=>{if(!e)throw new Error("API config is required");return mo(e,t,r,n)},enabled:i&&!!e,staleTime:15*60*1e3,gcTime:30*60*1e3,retry:3,retryDelay:o=>Math.min(1e3*2**o,3e4),refetchOnWindowFocus:!1,refetchOnReconnect:!0,refetchOnMount:!1})}function Ht(e){return!!(e.apiConfig||e.api_endpoint)}function Ji(e){return e.apiConfig?e.apiConfig:e.api_endpoint?{endpoint:e.api_endpoint,method:e.api_method||"GET",valueField:e.value_field||"value",labelField:e.label_field||"label",dependsOn:e.depends_on,conditional:e.conditional}:null}function vc(e,t){const r=Ji(e);if(!(r!=null&&r.conditional)&&!e.conditional)return!0;if(r!=null&&r.dependsOn||e.depends_on){const n=(r==null?void 0:r.dependsOn)||e.depends_on;if(n){const i=t[n];return i!=null&&i!==""}}return!0}const yo=({field:e,control:t,errors:r,baseUrl:n,apiHeaders:i,formData:a})=>{const s=r[e.name],o=!!s,[l,f]=M.useState(!1),d=M.useRef(!1),p=()=>{var $;return e.required!==void 0?e.required:(($=e.validation)==null?void 0:$.required)!==void 0?e.validation.required:!1},m=$=>p()?`${$} *`:$,x=()=>e.value!==void 0?e.value:e.type==="checkbox"?!1:e.type==="select"&&e.default?e.default:e.type==="autocomplete"&&e.multiple?[]:"",h=M.useMemo(()=>Ji(e),[e.apiConfig,e.api_endpoint,e.api_method,e.value_field,e.label_field,e.depends_on,e.conditional]),c=M.useRef(null),b=h!=null&&h.dependsOn?a==null?void 0:a[h.dependsOn]:null,g=M.useMemo(()=>{if(!(h!=null&&h.dependsOn))return!1;const $=b,V=c.current,z=$!==V;return z&&(c.current=$),z},[h==null?void 0:h.dependsOn,b]),O=M.useMemo(()=>!0,[]),A=M.useMemo(()=>l&&Ht(e)&&(!(h!=null&&h.dependsOn)||b),[l,e,h==null?void 0:h.dependsOn,b]),C=M.useMemo(()=>{if(!(h!=null&&h.dependsOn)||!a)return{};const $={};return h.dependsOn&&a[h.dependsOn]!==void 0&&($[h.dependsOn]=a[h.dependsOn]),$},[h==null?void 0:h.dependsOn,a]),{data:w=[],isLoading:L,error:K}=ho(h,n,i,C,A),ie=M.useCallback(()=>{Ht(e)&&!d.current&&(d.current=!0,f(!0))},[e]),Q=M.useCallback(()=>{Ht(e)&&!d.current&&(d.current=!0,f(!0))},[e]);M.useEffect(()=>{if(Ht(e)&&!d.current){const $=a==null?void 0:a[e.name];$!=null&&$!==""&&(d.current=!0,f(!0))}},[e,a]),M.useEffect(()=>{Ht(e)&&(h!=null&&h.dependsOn)&&g&&d.current&&(d.current=!1,f(!1))},[g,h==null?void 0:h.dependsOn]);const u=M.useCallback(()=>Ht(e)?w:e.type==="select"||e.type==="toggle"||e.type==="radio"||e.type==="autocomplete"?e.options||[]:[],[e,w]);if(!O)return null;const F=()=>{switch(e.type){case"title":return k.jsx(I.Typography,{variant:e.variant||"h4",component:"h1",color:e.color,align:e.align||"left",sx:{mb:3,fontWeight:600,...e.sx},children:e.label});case"section":return k.jsx(I.Typography,{variant:e.variant||"h6",component:"h3",color:e.color,align:e.align||"left",sx:{mb:2,fontWeight:600,color:"text.primary",...e.sx},children:e.label});case"text":case"email":case"password":case"tel":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(I.TextField,{...N,id:e.id,fullWidth:!0,label:m(e.label),type:e.type,placeholder:e.placeholder,disabled:e.disabled,error:o,helperText:(s==null?void 0:s.message)||e.helperText})});case"number":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(I.TextField,{...N,id:e.id,fullWidth:!0,label:m(e.label),type:"number",placeholder:e.placeholder,disabled:e.disabled,error:o,helperText:s==null?void 0:s.message,inputProps:{min:e.min,max:e.max}})});case"select":const $=u();return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.FormControl,{fullWidth:!0,error:o||!!K,children:[k.jsx(I.InputLabel,{id:e.id,children:m(e.label)}),k.jsx(I.Select,{...N,labelId:e.id,label:m(e.label),disabled:e.disabled||L,endAdornment:L?k.jsx(I.CircularProgress,{size:20}):void 0,onOpen:ie,children:L?k.jsx(I.MenuItem,{disabled:!0,children:k.jsxs(I.Box,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[k.jsx(I.CircularProgress,{size:16}),k.jsx(I.Typography,{variant:"body2",children:"Fetching data..."})]})}):$.length>0?$.map(Z=>k.jsx(I.MenuItem,{value:Z.value,children:Z.label},Z.value)):l&&!L?k.jsx(I.MenuItem,{disabled:!0,children:k.jsx(I.Typography,{variant:"body2",color:"text.secondary",children:"No options available"})}):k.jsx(I.MenuItem,{disabled:!0,children:k.jsx(I.Typography,{variant:"body2",color:"text.secondary",children:"Click to load options"})})}),(o||K||e.helperText)&&k.jsx(I.FormHelperText,{children:(s==null?void 0:s.message)||(K==null?void 0:K.message)||e.helperText})]})});case"checkbox":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.Box,{sx:{mt:1,mb:0},children:[k.jsx(I.FormControlLabel,{control:k.jsx(I.Checkbox,{...N,id:e.id,checked:N.value,disabled:e.disabled}),label:m(e.label)}),(o||e.helperText)&&k.jsx(I.FormHelperText,{error:o,sx:{ml:0},children:(s==null?void 0:s.message)||e.helperText})]})});case"toggle":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.FormControl,{component:"fieldset",error:o,children:[k.jsx(I.Typography,{variant:"body2",component:"legend",sx:{mb:1},children:m(e.label)}),k.jsx(I.RadioGroup,{...N,row:!0,children:e.options.map(Z=>k.jsx(I.FormControlLabel,{value:Z.value,control:k.jsx(I.Radio,{}),label:Z.label},Z.value))}),(o||e.helperText)&&k.jsx(I.FormHelperText,{error:o,children:(s==null?void 0:s.message)||e.helperText})]})});case"radio":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.FormControl,{component:"fieldset",error:o,children:[k.jsx(I.Typography,{variant:"body2",component:"legend",sx:{mb:1},children:m(e.label)}),k.jsx(I.RadioGroup,{...N,children:e.options.map(Z=>k.jsx(I.FormControlLabel,{value:Z.value,control:k.jsx(I.Radio,{}),label:Z.label},Z.value))}),o&&k.jsx(I.FormHelperText,{error:!0,children:s==null?void 0:s.message})]})});case"switch":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.Box,{sx:{mt:1,mb:0},children:[k.jsx(I.FormControlLabel,{control:k.jsx(I.Switch,{...N,id:e.id,checked:N.value,disabled:e.disabled}),label:m(e.label)}),(o||e.helperText)&&k.jsx(I.FormHelperText,{error:o,sx:{ml:0},children:(s==null?void 0:s.message)||e.helperText})]})});case"autocomplete":const V=u(),z=!!(e.disabled||L||h!=null&&h.dependsOn&&!b);return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>{const Z=N.value,se=e.multiple===!0,ce=(h==null?void 0:h.valueField)||e.value_field||"value",ue=(h==null?void 0:h.labelField)||e.label_field||"label",D=B=>{if(B!=null){if(typeof B=="string"||typeof B=="number")return B;if(typeof B=="object"){if(B[ce]!==void 0)return B[ce];if(B.value!==void 0)return B.value;if(B.id!==void 0)return B.id}}},q=(()=>{if(se)return(Array.isArray(Z)?Z:[]).map(G=>{const J=V.find(ae=>{const ne=D(ae);return ne!==void 0&&ne===G});return J||{[ce]:G,[ue]:`Selected: ${G}`,value:G,label:`Selected: ${G}`}});{if(Z==null||Z==="")return null;const B=V.find(G=>{const J=D(G);return J!==void 0&&J===Z});return B||{[ce]:Z,[ue]:`Selected: ${Z}`,value:Z,label:`Selected: ${Z}`}}})();return k.jsx(I.Autocomplete,{...N,id:e.id,options:V,value:q,getOptionLabel:B=>typeof B=="string"?B:B[ue]||B.label||B.name||"",isOptionEqualToValue:(B,G)=>{const J=D(B),ae=D(G);return J===void 0||ae===void 0?!1:J===ae},multiple:e.multiple,disableCloseOnSelect:se,freeSolo:e.freeSolo,filterOptions:e.filterOptions===!1?()=>V:void 0,disabled:z,loading:L,onOpen:Q,renderOption:(B,G,{selected:J})=>{const ae=typeof G=="string"?G:G[ue]||G.label||G.name||"";return k.jsxs("li",{...B,children:[se&&k.jsx(I.Checkbox,{style:{marginRight:8},checked:J}),ae]})},renderTags:se?(B,G)=>{const ae=B.slice(0,2).map((ee,de)=>{const P=typeof ee=="string"?ee:ee[ue]||ee.label||ee.name||"",H=G({index:de});return M.createElement(I.Chip,{...H,key:de,label:P,size:"small"})}),ne=B.length-2;return ne>0&&ae.push(k.jsx(I.Chip,{label:`+${ne} more`,size:"small"},"more")),ae}:void 0,renderInput:B=>k.jsx(I.TextField,{...B,label:m(e.label),placeholder:z&&(h!=null&&h.dependsOn)&&!b?`Please select ${h.dependsOn.replace(/_/g," ")} first`:e.placeholder,error:o||!!K,helperText:(s==null?void 0:s.message)||(K==null?void 0:K.message)||e.helperText||"",InputProps:{...B.InputProps,endAdornment:k.jsxs(k.Fragment,{children:[L?k.jsx(I.CircularProgress,{color:"inherit",size:20}):null,B.InputProps.endAdornment]})}}),onChange:(B,G)=>{const J=(h==null?void 0:h.valueField)||e.value_field||"value";if(se){const ne=(Array.isArray(G)?G:[]).map(ee=>typeof ee=="object"&&(ee[J]||ee.value||ee.id)||ee);N.onChange(ne)}else{let ae;G&&typeof G=="object"?ae=G[J]||G.value||G.id||G:ae=G,N.onChange(ae)}},noOptionsText:z&&(h!=null&&h.dependsOn)&&!b?`Please select ${h.dependsOn.replace(/_/g," ")} first`:L?"Fetching data...":l&&!L&&V.length===0?"No options available":"Click to load options"})}});case"date":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(I.TextField,{...N,id:e.name,fullWidth:!0,label:m(e.label),type:"date",disabled:e.disabled,error:o,helperText:s==null?void 0:s.message,InputLabelProps:{shrink:!0},inputProps:{min:e.minDate,max:e.maxDate}})});case"image":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(fo,{src:N.value||e.defaultValue||e.src,alt:e.alt||e.label,width:e.width,height:e.height,style:e.style,className:e.className,onClick:e.onClick})});case"component":return k.jsx(I.Box,{children:e.render?e.render():e.content});default:return null}};return k.jsx(I.Box,{children:F()})};function Xi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ti,Ra;function xc(){if(Ra)return ti;Ra=1;function e(g){this._maxSize=g,this.clear()}e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(g){return this._values[g]},e.prototype.set=function(g,O){return this._size>=this._maxSize&&this.clear(),g in this._values||this._size++,this._values[g]=O};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,n=/^\d/,i=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,o=new e(s),l=new e(s),f=new e(s);ti={Cache:e,split:p,normalizePath:d,setter:function(g){var O=d(g);return l.get(g)||l.set(g,function(C,w){for(var L=0,K=O.length,ie=C;L<K-1;){var Q=O[L];if(Q==="__proto__"||Q==="constructor"||Q==="prototype")return C;ie=ie[O[L++]]}ie[O[L]]=w})},getter:function(g,O){var A=d(g);return f.get(g)||f.set(g,function(w){for(var L=0,K=A.length;L<K;)if(w!=null||!O)w=w[A[L++]];else return;return w})},join:function(g){return g.reduce(function(O,A){return O+(x(A)||r.test(A)?"["+A+"]":(O?".":"")+A)},"")},forEach:function(g,O,A){m(Array.isArray(g)?g:p(g),O,A)}};function d(g){return o.get(g)||o.set(g,p(g).map(function(O){return O.replace(a,"$2")}))}function p(g){return g.match(t)||[""]}function m(g,O,A){var C=g.length,w,L,K,ie;for(L=0;L<C;L++)w=g[L],w&&(b(w)&&(w='"'+w+'"'),ie=x(w),K=!ie&&/^\d+$/.test(w),O.call(A,w,ie,K,L,g))}function x(g){return typeof g=="string"&&g&&["'",'"'].indexOf(g.charAt(0))!==-1}function h(g){return g.match(n)&&!g.match(r)}function c(g){return i.test(g)}function b(g){return!x(g)&&(h(g)||c(g))}return ti}var ir=xc(),ri,Pa;function bc(){if(Pa)return ri;Pa=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=d=>d.match(e)||[],r=d=>d[0].toUpperCase()+d.slice(1),n=(d,p)=>t(d).join(p).toLowerCase(),i=d=>t(d).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return ri={words:t,upperFirst:r,camelCase:i,pascalCase:d=>r(i(d)),snakeCase:d=>n(d,"_"),kebabCase:d=>n(d,"-"),sentenceCase:d=>r(n(d," ")),titleCase:d=>t(d).map(r).join(" ")},ri}var ni=bc(),pn={exports:{}},Ia;function wc(){if(Ia)return pn.exports;Ia=1,pn.exports=function(i){return e(t(i),i)},pn.exports.array=e;function e(i,a){var s=i.length,o=new Array(s),l={},f=s,d=r(a),p=n(i);for(a.forEach(function(x){if(!p.has(x[0])||!p.has(x[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});f--;)l[f]||m(i[f],f,new Set);return o;function m(x,h,c){if(c.has(x)){var b;try{b=", node was:"+JSON.stringify(x)}catch{b=""}throw new Error("Cyclic dependency"+b)}if(!p.has(x))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(x));if(!l[h]){l[h]=!0;var g=d.get(x)||new Set;if(g=Array.from(g),h=g.length){c.add(x);do{var O=g[--h];m(O,p.get(O),c)}while(h);c.delete(x)}o[--s]=x}}}function t(i){for(var a=new Set,s=0,o=i.length;s<o;s++){var l=i[s];a.add(l[0]),a.add(l[1])}return Array.from(a)}function r(i){for(var a=new Map,s=0,o=i.length;s<o;s++){var l=i[s];a.has(l[0])||a.set(l[0],new Set),a.has(l[1])||a.set(l[1],new Set),a.get(l[0]).add(l[1])}return a}function n(i){for(var a=new Map,s=0,o=i.length;s<o;s++)a.set(i[s],s);return a}return pn.exports}var Sc=wc();const Ec=Xi(Sc),kc=Object.prototype.toString,Oc=Error.prototype.toString,Tc=RegExp.prototype.toString,Cc=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",_c=/^Symbol\((.*)\)(.*)$/;function Ac(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Ma(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return Ac(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return Cc.call(e).replace(_c,"Symbol($1)");const n=kc.call(e).slice(8,-1);return n==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):n==="Error"||e instanceof Error?"["+Oc.call(e)+"]":n==="RegExp"?Tc.call(e):null}function Vt(e,t){let r=Ma(e,t);return r!==null?r:JSON.stringify(e,function(n,i){let a=Ma(this[n],t);return a!==null?a:i},2)}function go(e){return e==null?[]:[].concat(e)}let vo,xo,bo,Fc=/\$\{\s*(\w+)\s*\}/g;vo=Symbol.toStringTag;class za{constructor(t,r,n,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[vo]="Error",this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],go(t).forEach(a=>{if(He.isError(a)){this.errors.push(...a.errors);const s=a.inner.length?a.inner:[a];this.inner.push(...s)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}xo=Symbol.hasInstance;bo=Symbol.toStringTag;class He extends Error{static formatError(t,r){const n=r.label||r.path||"this";return r=Object.assign({},r,{path:n,originalPath:r.path}),typeof t=="string"?t.replace(Fc,(i,a)=>Vt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,n,i,a){const s=new za(t,r,n,i);if(a)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[bo]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,He)}static[xo](t){return za[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let dt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const i=n!=null&&n!==r?` (cast from the value \`${Vt(n,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${Vt(r,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${Vt(r,!0)}\``+i}},Be={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Ct={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ji={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},$i={isValue:"${path} field must be ${value}"},Sn={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},jc={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},$c={notType:e=>{const{path:t,value:r,spec:n}=e,i=n.types.length;if(Array.isArray(r)){if(r.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${r.length} for value: \`${Vt(r,!0)}\``;if(r.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${r.length} for value: \`${Vt(r,!0)}\``}return He.formatError(dt.notType,e)}};Object.assign(Object.create(null),{mixed:dt,string:Be,number:Ct,date:ji,object:Sn,array:jc,boolean:$i,tuple:$c});const ea=e=>e&&e.__isYupSchema__;class jn{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:a}=r,s=typeof n=="function"?n:(...o)=>o.every(l=>l===n);return new jn(t,(o,l)=>{var f;let d=s(...o)?i:a;return(f=d==null?void 0:d(l))!=null?f:l})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let n=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn(n,t,r);if(i===void 0||i===t)return t;if(!ea(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}}const fn={context:"$",value:"."};class or{constructor(t,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===fn.context,this.isValue=this.key[0]===fn.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?fn.context:this.isValue?fn.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&ir.getter(this.path,!0),this.map=r.map}getValue(t,r,n){let i=this.isContext?n:this.isValue?t:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}or.prototype.__isYupRef=!0;const ot=e=>e==null;function pr(e){function t({value:r,path:n="",options:i,originalValue:a,schema:s},o,l){const{name:f,test:d,params:p,message:m,skipAbsent:x}=e;let{parent:h,context:c,abortEarly:b=s.spec.abortEarly,disableStackTrace:g=s.spec.disableStackTrace}=i;function O(F){return or.isRef(F)?F.getValue(r,h,c):F}function A(F={}){const $=Object.assign({value:r,originalValue:a,label:s.spec.label,path:F.path||n,spec:s.spec,disableStackTrace:F.disableStackTrace||g},p,F.params);for(const z of Object.keys($))$[z]=O($[z]);const V=new He(He.formatError(F.message||m,$),r,$.path,F.type||f,$.disableStackTrace);return V.params=$,V}const C=b?o:l;let w={path:n,parent:h,type:f,from:i.from,createError:A,resolve:O,options:i,originalValue:a,schema:s};const L=F=>{He.isError(F)?C(F):F?l(null):C(A())},K=F=>{He.isError(F)?C(F):o(F)};if(x&&ot(r))return L(!0);let Q;try{var u;if(Q=d.call(w,r,w),typeof((u=Q)==null?void 0:u.then)=="function"){if(i.sync)throw new Error(`Validation test of type: "${w.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(Q).then(L,K)}}catch(F){K(F);return}L(Q)}return t.OPTIONS=e,t}function Dc(e,t,r,n=r){let i,a,s;return t?(ir.forEach(t,(o,l,f)=>{let d=l?o.slice(1,o.length-1):o;e=e.resolve({context:n,parent:i,value:r});let p=e.type==="tuple",m=f?parseInt(d,10):0;if(e.innerType||p){if(p&&!f)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(r&&m>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${o}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[m],e=p?e.spec.types[m]:e.innerType}if(!f){if(!e.fields||!e.fields[d])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${s} which is a type: "${e.type}")`);i=r,r=r&&r[d],e=e.fields[d]}a=d,s=l?"["+o+"]":"."+o}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}class $n extends Set{describe(){const t=[];for(const r of this.values())t.push(or.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const n of this.values())r.push(t(n));return r}clone(){return new $n(this.values())}merge(t,r){const n=this.clone();return t.forEach(i=>n.add(i)),r.forEach(i=>n.delete(i)),n}}function vr(e,t=new Map){if(ea(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n<e.length;n++)r[n]=vr(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,i]of e.entries())r.set(n,vr(i,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add(vr(n,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[n,i]of Object.entries(e))r[n]=vr(i,t)}else throw Error(`Unable to clone ${e}`);return r}class Ye{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new $n,this._blacklist=new $n,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(dt.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=vr(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let n=t(this);return this._mutate=r,n}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,n=t.clone();const i=Object.assign({},r.spec,n.spec);return n.spec=i,n.internalTests=Object.assign({},r.internalTests,n.internalTests),n._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),n._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(a=>{t.tests.forEach(s=>{a.test(s.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,a)=>a.resolve(i,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,n,i,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(n=t.abortEarly)!=null?n:this.spec.abortEarly,recursive:(i=t.recursive)!=null?i:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let n=this.resolve(Object.assign({value:t},r)),i=r.assert==="ignore-optionality",a=n._cast(t,r);if(r.assert!==!1&&!n.isType(a)){if(i&&ot(a))return a;let s=Vt(t),o=Vt(a);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
1
|
+
"use strict";var da=e=>{throw TypeError(e)};var Jn=(e,t,r)=>t.has(e)||da("Cannot "+r);var v=(e,t,r)=>(Jn(e,t,"read from private field"),r?r.call(e):t.get(e)),le=(e,t,r)=>t.has(e)?da("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),X=(e,t,r,n)=>(Jn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),me=(e,t,r)=>(Jn(e,t,"access private method"),r);var un=(e,t,r,n)=>({set _(i){X(e,t,i,r)},get _(){return v(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react/jsx-runtime"),M=require("react"),I=require("@mui/material"),fl=require("@emotion/styled");require("@emotion/react");function ml(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=ml(M);var tn=e=>e.type==="checkbox",Qt=e=>e instanceof Date,Le=e=>e==null;const Bs=e=>typeof e=="object";var je=e=>!Le(e)&&!Array.isArray(e)&&Bs(e)&&!Qt(e),qs=e=>je(e)&&e.target?tn(e.target)?e.target.checked:e.target.value:e,hl=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Us=(e,t)=>e.has(hl(t)),yl=e=>{const t=e.constructor&&e.constructor.prototype;return je(t)&&t.hasOwnProperty("isPrototypeOf")},Bi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ie(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Bi&&(e instanceof Blob||n))&&(r||je(e)))if(t=r?[]:{},!r&&!yl(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=Ie(e[i]));else return e;return t}var Nn=e=>/^\w*$/.test(e),Fe=e=>e===void 0,qi=e=>Array.isArray(e)?e.filter(Boolean):[],Ui=e=>qi(e.replace(/["|']|\]/g,"").split(/\.|\[/)),U=(e,t,r)=>{if(!t||!je(e))return r;const n=(Nn(t)?[t]:Ui(t)).reduce((i,a)=>Le(i)?i:i[a],e);return Fe(n)||n===e?Fe(e[t])?r:e[t]:n},Ke=e=>typeof e=="boolean",ve=(e,t,r)=>{let n=-1;const i=Nn(t)?[t]:Ui(t),a=i.length,s=a-1;for(;++n<a;){const o=i[n];let l=r;if(n!==s){const f=e[o];l=je(f)||Array.isArray(f)?f:isNaN(+i[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=l,e=e[o]}};const On={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},at={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},yt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ws=M.createContext(null);Ws.displayName="HookFormContext";const Wi=()=>M.useContext(Ws);var Hs=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const s=a;return t._proxyFormState[s]!==at.all&&(t._proxyFormState[s]=!n||at.all),r&&(r[s]=!0),e[s]}});return i};const Hi=typeof window<"u"?Ae.useLayoutEffect:Ae.useEffect;function gl(e){const t=Wi(),{control:r=t.control,disabled:n,name:i,exact:a}=e||{},[s,o]=M.useState(r._formState),l=M.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Hi(()=>r._subscribe({name:i,formState:l.current,exact:a,callback:f=>{!n&&o({...r._formState,...f})}}),[i,n,a]),M.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),M.useMemo(()=>Hs(s,r,l.current,!1),[s,r])}var ht=e=>typeof e=="string",Ks=(e,t,r,n,i)=>ht(e)?(n&&t.watch.add(e),U(r,e,i)):Array.isArray(e)?e.map(a=>(n&&t.watch.add(a),U(r,a))):(n&&(t.watchAll=!0),r);function vl(e){const t=Wi(),{control:r=t.control,name:n,defaultValue:i,disabled:a,exact:s}=e||{},o=M.useRef(i),[l,f]=M.useState(r._getWatch(n,o.current));return Hi(()=>r._subscribe({name:n,formState:{values:!0},exact:s,callback:d=>!a&&f(Ks(n,r._names,d.values||r._formValues,!1,o.current))}),[n,r,a,s]),M.useEffect(()=>r._removeUnmounted()),l}function xl(e){const t=Wi(),{name:r,disabled:n,control:i=t.control,shouldUnregister:a}=e,s=Us(i._names.array,r),o=vl({control:i,name:r,defaultValue:U(i._formValues,r,U(i._defaultValues,r,e.defaultValue)),exact:!0}),l=gl({control:i,name:r,exact:!0}),f=M.useRef(e),d=M.useRef(i.register(r,{...e.rules,value:o,...Ke(e.disabled)?{disabled:e.disabled}:{}})),p=M.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!U(l.errors,r)},isDirty:{enumerable:!0,get:()=>!!U(l.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!U(l.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!U(l.validatingFields,r)},error:{enumerable:!0,get:()=>U(l.errors,r)}}),[l,r]),m=M.useCallback(b=>d.current.onChange({target:{value:qs(b),name:r},type:On.CHANGE}),[r]),x=M.useCallback(()=>d.current.onBlur({target:{value:U(i._formValues,r),name:r},type:On.BLUR}),[r,i._formValues]),h=M.useCallback(b=>{const g=U(i._fields,r);g&&b&&(g._f.ref={focus:()=>b.focus&&b.focus(),select:()=>b.select&&b.select(),setCustomValidity:O=>b.setCustomValidity(O),reportValidity:()=>b.reportValidity()})},[i._fields,r]),c=M.useMemo(()=>({name:r,value:o,...Ke(n)||l.disabled?{disabled:l.disabled||n}:{},onChange:m,onBlur:x,ref:h}),[r,n,l.disabled,m,x,h,o]);return M.useEffect(()=>{const b=i._options.shouldUnregister||a;i.register(r,{...f.current.rules,...Ke(f.current.disabled)?{disabled:f.current.disabled}:{}});const g=(O,A)=>{const C=U(i._fields,O);C&&C._f&&(C._f.mount=A)};if(g(r,!0),b){const O=Ie(U(i._options.defaultValues,r));ve(i._defaultValues,r,O),Fe(U(i._formValues,r))&&ve(i._formValues,r,O)}return!s&&i.register(r),()=>{(s?b&&!i._state.action:b)?i.unregister(r):g(r,!1)}},[r,i,s,a]),M.useEffect(()=>{i._setDisabledField({disabled:n,name:r})},[n,r,i]),M.useMemo(()=>({field:c,formState:l,fieldState:p}),[c,l,p])}const lt=e=>e.render(xl(e));var Qs=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},Ur=e=>Array.isArray(e)?e:[e],pa=()=>{let e=[];return{get observers(){return e},next:i=>{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}},yi=e=>Le(e)||!Bs(e);function _t(e,t){if(yi(e)||yi(t))return e===t;if(Qt(e)&&Qt(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r){const a=e[i];if(!n.includes(i))return!1;if(i!=="ref"){const s=t[i];if(Qt(a)&&Qt(s)||je(a)&&je(s)||Array.isArray(a)&&Array.isArray(s)?!_t(a,s):a!==s)return!1}}return!0}var Ue=e=>je(e)&&!Object.keys(e).length,Ki=e=>e.type==="file",st=e=>typeof e=="function",Tn=e=>{if(!Bi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Gs=e=>e.type==="select-multiple",Qi=e=>e.type==="radio",bl=e=>Qi(e)||tn(e),Xn=e=>Tn(e)&&e.isConnected;function wl(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Fe(e)?n++:e[t[n++]];return e}function Sl(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}function De(e,t){const r=Array.isArray(t)?t:Nn(t)?[t]:Ui(t),n=r.length===1?e:wl(e,r),i=r.length-1,a=r[i];return n&&delete n[a],i!==0&&(je(n)&&Ue(n)||Array.isArray(n)&&Sl(n))&&De(e,r.slice(0,-1)),e}var Ys=e=>{for(const t in e)if(st(e[t]))return!0;return!1};function Cn(e,t={}){const r=Array.isArray(e);if(je(e)||r)for(const n in e)Array.isArray(e[n])||je(e[n])&&!Ys(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Cn(e[n],t[n])):Le(e[n])||(t[n]=!0);return t}function Zs(e,t,r){const n=Array.isArray(e);if(je(e)||n)for(const i in e)Array.isArray(e[i])||je(e[i])&&!Ys(e[i])?Fe(t)||yi(r[i])?r[i]=Array.isArray(e[i])?Cn(e[i],[]):{...Cn(e[i])}:Zs(e[i],Le(t)?{}:t[i],r[i]):r[i]=!_t(e[i],t[i]);return r}var Mr=(e,t)=>Zs(e,t,Cn(t));const fa={value:!1,isValid:!1},ma={value:!0,isValid:!0};var Js=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Fe(e[0].attributes.value)?Fe(e[0].value)||e[0].value===""?ma:{value:e[0].value,isValid:!0}:ma:fa}return fa},Xs=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Fe(e)?e:t?e===""?NaN:e&&+e:r&&ht(e)?new Date(e):n?n(e):e;const ha={isValid:!1,value:null};var eo=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ha):ha;function ya(e){const t=e.ref;return Ki(t)?t.files:Qi(t)?eo(e.refs).value:Gs(t)?[...t.selectedOptions].map(({value:r})=>r):tn(t)?Js(e.refs).value:Xs(Fe(t.value)?e.ref.value:t.value,e)}var El=(e,t,r,n)=>{const i={};for(const a of e){const s=U(t,a);s&&ve(i,a,s._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},_n=e=>e instanceof RegExp,zr=e=>Fe(e)?e:_n(e)?e.source:je(e)?_n(e.value)?e.value.source:e.value:e,ga=e=>({isOnSubmit:!e||e===at.onSubmit,isOnBlur:e===at.onBlur,isOnChange:e===at.onChange,isOnAll:e===at.all,isOnTouch:e===at.onTouched});const va="AsyncFunction";var kl=e=>!!e&&!!e.validate&&!!(st(e.validate)&&e.validate.constructor.name===va||je(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===va)),Ol=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),xa=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Wr=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const a=U(e,i);if(a){const{_f:s,...o}=a;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],i)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(Wr(o,t))break}else if(je(o)&&Wr(o,t))break}}};function ba(e,t,r){const n=U(e,r);if(n||Nn(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const a=i.join("."),s=U(t,a),o=U(e,a);if(s&&!Array.isArray(s)&&r!==a)return{name:r};if(o&&o.type)return{name:a,error:o};if(o&&o.root&&o.root.type)return{name:`${a}.root`,error:o.root};i.pop()}return{name:r}}var Tl=(e,t,r,n)=>{r(e);const{name:i,...a}=e;return Ue(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(s=>t[s]===(!n||at.all))},Cl=(e,t,r)=>!e||!t||e===t||Ur(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),_l=(e,t,r,n,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?n.isOnChange:i.isOnChange)?e:!0,Al=(e,t)=>!qi(U(e,t)).length&&De(e,t),Fl=(e,t,r)=>{const n=Ur(U(e,r));return ve(n,"root",t[r]),ve(e,r,n),e},wn=e=>ht(e);function wa(e,t,r="validate"){if(wn(e)||Array.isArray(e)&&e.every(wn)||Ke(e)&&!e)return{type:r,message:wn(e)?e:"",ref:t}}var dr=e=>je(e)&&!_n(e)?e:{value:e,message:""},Sa=async(e,t,r,n,i,a)=>{const{ref:s,refs:o,required:l,maxLength:f,minLength:d,min:p,max:m,pattern:x,validate:h,name:c,valueAsNumber:b,mount:g}=e._f,O=U(r,c);if(!g||t.has(c))return{};const A=o?o[0]:s,C=$=>{i&&A.reportValidity&&(A.setCustomValidity(Ke($)?"":$||""),A.reportValidity())},w={},L=Qi(s),K=tn(s),ie=L||K,Q=(b||Ki(s))&&Fe(s.value)&&Fe(O)||Tn(s)&&s.value===""||O===""||Array.isArray(O)&&!O.length,u=Qs.bind(null,c,n,w),F=($,V,z,N=yt.maxLength,Z=yt.minLength)=>{const se=$?V:z;w[c]={type:$?N:Z,message:se,ref:s,...u($?N:Z,se)}};if(a?!Array.isArray(O)||!O.length:l&&(!ie&&(Q||Le(O))||Ke(O)&&!O||K&&!Js(o).isValid||L&&!eo(o).isValid)){const{value:$,message:V}=wn(l)?{value:!!l,message:l}:dr(l);if($&&(w[c]={type:yt.required,message:V,ref:A,...u(yt.required,V)},!n))return C(V),w}if(!Q&&(!Le(p)||!Le(m))){let $,V;const z=dr(m),N=dr(p);if(!Le(O)&&!isNaN(O)){const Z=s.valueAsNumber||O&&+O;Le(z.value)||($=Z>z.value),Le(N.value)||(V=Z<N.value)}else{const Z=s.valueAsDate||new Date(O),se=D=>new Date(new Date().toDateString()+" "+D),ce=s.type=="time",ue=s.type=="week";ht(z.value)&&O&&($=ce?se(O)>se(z.value):ue?O>z.value:Z>new Date(z.value)),ht(N.value)&&O&&(V=ce?se(O)<se(N.value):ue?O<N.value:Z<new Date(N.value))}if(($||V)&&(F(!!$,z.message,N.message,yt.max,yt.min),!n))return C(w[c].message),w}if((f||d)&&!Q&&(ht(O)||a&&Array.isArray(O))){const $=dr(f),V=dr(d),z=!Le($.value)&&O.length>+$.value,N=!Le(V.value)&&O.length<+V.value;if((z||N)&&(F(z,$.message,V.message),!n))return C(w[c].message),w}if(x&&!Q&&ht(O)){const{value:$,message:V}=dr(x);if(_n($)&&!O.match($)&&(w[c]={type:yt.pattern,message:V,ref:s,...u(yt.pattern,V)},!n))return C(V),w}if(h){if(st(h)){const $=await h(O,r),V=wa($,A);if(V&&(w[c]={...V,...u(yt.validate,V.message)},!n))return C(V.message),w}else if(je(h)){let $={};for(const V in h){if(!Ue($)&&!n)break;const z=wa(await h[V](O,r),A,V);z&&($={...z,...u(V,z.message)},C(z.message),n&&(w[c]=$))}if(!Ue($)&&(w[c]={ref:A,...$},!n))return w}}return C(!0),w};const jl={mode:at.onSubmit,reValidateMode:at.onChange,shouldFocusError:!0};function $l(e={}){let t={...jl,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:st(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const n={};let i=je(t.defaultValues)||je(t.values)?Ie(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Ie(i),s={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,f=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let p={...d};const m={array:pa(),state:pa()},x=t.criteriaMode===at.all,h=y=>S=>{clearTimeout(f),f=setTimeout(y,S)},c=async y=>{if(!t.disabled&&(d.isValid||p.isValid||y)){const S=t.resolver?Ue((await K()).errors):await Q(n,!0);S!==r.isValid&&m.state.next({isValid:S})}},b=(y,S)=>{!t.disabled&&(d.isValidating||d.validatingFields||p.isValidating||p.validatingFields)&&((y||Array.from(o.mount)).forEach(j=>{j&&(S?ve(r.validatingFields,j,S):De(r.validatingFields,j))}),m.state.next({validatingFields:r.validatingFields,isValidating:!Ue(r.validatingFields)}))},g=(y,S=[],j,Y,E=!0,T=!0)=>{if(Y&&j&&!t.disabled){if(s.action=!0,T&&Array.isArray(U(n,y))){const W=j(U(n,y),Y.argA,Y.argB);E&&ve(n,y,W)}if(T&&Array.isArray(U(r.errors,y))){const W=j(U(r.errors,y),Y.argA,Y.argB);E&&ve(r.errors,y,W),Al(r.errors,y)}if((d.touchedFields||p.touchedFields)&&T&&Array.isArray(U(r.touchedFields,y))){const W=j(U(r.touchedFields,y),Y.argA,Y.argB);E&&ve(r.touchedFields,y,W)}(d.dirtyFields||p.dirtyFields)&&(r.dirtyFields=Mr(i,a)),m.state.next({name:y,isDirty:F(y,S),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ve(a,y,S)},O=(y,S)=>{ve(r.errors,y,S),m.state.next({errors:r.errors})},A=y=>{r.errors=y,m.state.next({errors:r.errors,isValid:!1})},C=(y,S,j,Y)=>{const E=U(n,y);if(E){const T=U(a,y,Fe(j)?U(i,y):j);Fe(T)||Y&&Y.defaultChecked||S?ve(a,y,S?T:ya(E._f)):z(y,T),s.mount&&c()}},w=(y,S,j,Y,E)=>{let T=!1,W=!1;const oe={name:y};if(!t.disabled){if(!j||Y){(d.isDirty||p.isDirty)&&(W=r.isDirty,r.isDirty=oe.isDirty=F(),T=W!==oe.isDirty);const pe=_t(U(i,y),S);W=!!U(r.dirtyFields,y),pe?De(r.dirtyFields,y):ve(r.dirtyFields,y,!0),oe.dirtyFields=r.dirtyFields,T=T||(d.dirtyFields||p.dirtyFields)&&W!==!pe}if(j){const pe=U(r.touchedFields,y);pe||(ve(r.touchedFields,y,j),oe.touchedFields=r.touchedFields,T=T||(d.touchedFields||p.touchedFields)&&pe!==j)}T&&E&&m.state.next(oe)}return T?oe:{}},L=(y,S,j,Y)=>{const E=U(r.errors,y),T=(d.isValid||p.isValid)&&Ke(S)&&r.isValid!==S;if(t.delayError&&j?(l=h(()=>O(y,j)),l(t.delayError)):(clearTimeout(f),l=null,j?ve(r.errors,y,j):De(r.errors,y)),(j?!_t(E,j):E)||!Ue(Y)||T){const W={...Y,...T&&Ke(S)?{isValid:S}:{},errors:r.errors,name:y};r={...r,...W},m.state.next(W)}},K=async y=>{b(y,!0);const S=await t.resolver(a,t.context,El(y||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return b(y),S},ie=async y=>{const{errors:S}=await K(y);if(y)for(const j of y){const Y=U(S,j);Y?ve(r.errors,j,Y):De(r.errors,j)}else r.errors=S;return S},Q=async(y,S,j={valid:!0})=>{for(const Y in y){const E=y[Y];if(E){const{_f:T,...W}=E;if(T){const oe=o.array.has(T.name),pe=E._f&&kl(E._f);pe&&d.validatingFields&&b([Y],!0);const Pe=await Sa(E,o.disabled,a,x,t.shouldUseNativeValidation&&!S,oe);if(pe&&d.validatingFields&&b([Y]),Pe[T.name]&&(j.valid=!1,S))break;!S&&(U(Pe,T.name)?oe?Fl(r.errors,Pe,T.name):ve(r.errors,T.name,Pe[T.name]):De(r.errors,T.name))}!Ue(W)&&await Q(W,S,j)}}return j.valid},u=()=>{for(const y of o.unMount){const S=U(n,y);S&&(S._f.refs?S._f.refs.every(j=>!Xn(j)):!Xn(S._f.ref))&&ee(y)}o.unMount=new Set},F=(y,S)=>!t.disabled&&(y&&S&&ve(a,y,S),!_t(D(),i)),$=(y,S,j)=>Ks(y,o,{...s.mount?a:Fe(S)?i:ht(y)?{[y]:S}:S},j,S),V=y=>qi(U(s.mount?a:i,y,t.shouldUnregister?U(i,y,[]):[])),z=(y,S,j={})=>{const Y=U(n,y);let E=S;if(Y){const T=Y._f;T&&(!T.disabled&&ve(a,y,Xs(S,T)),E=Tn(T.ref)&&Le(S)?"":S,Gs(T.ref)?[...T.ref.options].forEach(W=>W.selected=E.includes(W.value)):T.refs?tn(T.ref)?T.refs.forEach(W=>{(!W.defaultChecked||!W.disabled)&&(Array.isArray(E)?W.checked=!!E.find(oe=>oe===W.value):W.checked=E===W.value||!!E)}):T.refs.forEach(W=>W.checked=W.value===E):Ki(T.ref)?T.ref.value="":(T.ref.value=E,T.ref.type||m.state.next({name:y,values:Ie(a)})))}(j.shouldDirty||j.shouldTouch)&&w(y,E,j.shouldTouch,j.shouldDirty,!0),j.shouldValidate&&ue(y)},N=(y,S,j)=>{for(const Y in S){if(!S.hasOwnProperty(Y))return;const E=S[Y],T=y+"."+Y,W=U(n,T);(o.array.has(y)||je(E)||W&&!W._f)&&!Qt(E)?N(T,E,j):z(T,E,j)}},Z=(y,S,j={})=>{const Y=U(n,y),E=o.array.has(y),T=Ie(S);ve(a,y,T),E?(m.array.next({name:y,values:Ie(a)}),(d.isDirty||d.dirtyFields||p.isDirty||p.dirtyFields)&&j.shouldDirty&&m.state.next({name:y,dirtyFields:Mr(i,a),isDirty:F(y,T)})):Y&&!Y._f&&!Le(T)?N(y,T,j):z(y,T,j),xa(y,o)&&m.state.next({...r}),m.state.next({name:s.mount?y:void 0,values:Ie(a)})},se=async y=>{s.mount=!0;const S=y.target;let j=S.name,Y=!0;const E=U(n,j),T=pe=>{Y=Number.isNaN(pe)||Qt(pe)&&isNaN(pe.getTime())||_t(pe,U(a,j,pe))},W=ga(t.mode),oe=ga(t.reValidateMode);if(E){let pe,Pe;const rt=S.type?ya(E._f):qs(y),Ze=y.type===On.BLUR||y.type===On.FOCUS_OUT,Rr=!Ol(E._f)&&!t.resolver&&!U(r.errors,j)&&!E._f.deps||_l(Ze,U(r.touchedFields,j),r.isSubmitted,oe,W),Ut=xa(j,o,Ze);ve(a,j,rt),Ze?(E._f.onBlur&&E._f.onBlur(y),l&&l(0)):E._f.onChange&&E._f.onChange(y);const Ot=w(j,rt,Ze),Pr=!Ue(Ot)||Ut;if(!Ze&&m.state.next({name:j,type:y.type,values:Ie(a)}),Rr)return(d.isValid||p.isValid)&&(t.mode==="onBlur"?Ze&&c():Ze||c()),Pr&&m.state.next({name:j,...Ut?{}:Ot});if(!Ze&&Ut&&m.state.next({...r}),t.resolver){const{errors:cr}=await K([j]);if(T(rt),Y){const Ir=ba(r.errors,n,j),ur=ba(cr,n,Ir.name||j);pe=ur.error,j=ur.name,Pe=Ue(cr)}}else b([j],!0),pe=(await Sa(E,o.disabled,a,x,t.shouldUseNativeValidation))[j],b([j]),T(rt),Y&&(pe?Pe=!1:(d.isValid||p.isValid)&&(Pe=await Q(n,!0)));Y&&(E._f.deps&&ue(E._f.deps),L(j,Pe,pe,Ot))}},ce=(y,S)=>{if(U(r.errors,S)&&y.focus)return y.focus(),1},ue=async(y,S={})=>{let j,Y;const E=Ur(y);if(t.resolver){const T=await ie(Fe(y)?y:E);j=Ue(T),Y=y?!E.some(W=>U(T,W)):j}else y?(Y=(await Promise.all(E.map(async T=>{const W=U(n,T);return await Q(W&&W._f?{[T]:W}:W)}))).every(Boolean),!(!Y&&!r.isValid)&&c()):Y=j=await Q(n);return m.state.next({...!ht(y)||(d.isValid||p.isValid)&&j!==r.isValid?{}:{name:y},...t.resolver||!y?{isValid:j}:{},errors:r.errors}),S.shouldFocus&&!Y&&Wr(n,ce,y?E:o.mount),Y},D=y=>{const S={...s.mount?a:i};return Fe(y)?S:ht(y)?U(S,y):y.map(j=>U(S,j))},q=(y,S)=>({invalid:!!U((S||r).errors,y),isDirty:!!U((S||r).dirtyFields,y),error:U((S||r).errors,y),isValidating:!!U(r.validatingFields,y),isTouched:!!U((S||r).touchedFields,y)}),B=y=>{y&&Ur(y).forEach(S=>De(r.errors,S)),m.state.next({errors:y?r.errors:{}})},G=(y,S,j)=>{const Y=(U(n,y,{_f:{}})._f||{}).ref,E=U(r.errors,y)||{},{ref:T,message:W,type:oe,...pe}=E;ve(r.errors,y,{...pe,...S,ref:Y}),m.state.next({name:y,errors:r.errors,isValid:!1}),j&&j.shouldFocus&&Y&&Y.focus&&Y.focus()},J=(y,S)=>st(y)?m.state.subscribe({next:j=>y($(void 0,S),j)}):$(y,S,!0),ae=y=>m.state.subscribe({next:S=>{Cl(y.name,S.name,y.exact)&&Tl(S,y.formState||d,kt,y.reRenderRoot)&&y.callback({values:{...a},...r,...S})}}).unsubscribe,ne=y=>(s.mount=!0,p={...p,...y.formState},ae({...y,formState:p})),ee=(y,S={})=>{for(const j of y?Ur(y):o.mount)o.mount.delete(j),o.array.delete(j),S.keepValue||(De(n,j),De(a,j)),!S.keepError&&De(r.errors,j),!S.keepDirty&&De(r.dirtyFields,j),!S.keepTouched&&De(r.touchedFields,j),!S.keepIsValidating&&De(r.validatingFields,j),!t.shouldUnregister&&!S.keepDefaultValue&&De(i,j);m.state.next({values:Ie(a)}),m.state.next({...r,...S.keepDirty?{isDirty:F()}:{}}),!S.keepIsValid&&c()},de=({disabled:y,name:S})=>{(Ke(y)&&s.mount||y||o.disabled.has(S))&&(y?o.disabled.add(S):o.disabled.delete(S))},P=(y,S={})=>{let j=U(n,y);const Y=Ke(S.disabled)||Ke(t.disabled);return ve(n,y,{...j||{},_f:{...j&&j._f?j._f:{ref:{name:y}},name:y,mount:!0,...S}}),o.mount.add(y),j?de({disabled:Ke(S.disabled)?S.disabled:t.disabled,name:y}):C(y,!0,S.value),{...Y?{disabled:S.disabled||t.disabled}:{},...t.progressive?{required:!!S.required,min:zr(S.min),max:zr(S.max),minLength:zr(S.minLength),maxLength:zr(S.maxLength),pattern:zr(S.pattern)}:{},name:y,onChange:se,onBlur:se,ref:E=>{if(E){P(y,S),j=U(n,y);const T=Fe(E.value)&&E.querySelectorAll&&E.querySelectorAll("input,select,textarea")[0]||E,W=bl(T),oe=j._f.refs||[];if(W?oe.find(pe=>pe===T):T===j._f.ref)return;ve(n,y,{_f:{...j._f,...W?{refs:[...oe.filter(Xn),T,...Array.isArray(U(i,y))?[{}]:[]],ref:{type:T.type,name:y}}:{ref:T}}}),C(y,!1,void 0,T)}else j=U(n,y,{}),j._f&&(j._f.mount=!1),(t.shouldUnregister||S.shouldUnregister)&&!(Us(o.array,y)&&s.action)&&o.unMount.add(y)}}},H=()=>t.shouldFocusError&&Wr(n,ce,o.mount),te=y=>{Ke(y)&&(m.state.next({disabled:y}),Wr(n,(S,j)=>{const Y=U(n,j);Y&&(S.disabled=Y._f.disabled||y,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(E=>{E.disabled=Y._f.disabled||y}))},0,!1))},R=(y,S)=>async j=>{let Y;j&&(j.preventDefault&&j.preventDefault(),j.persist&&j.persist());let E=Ie(a);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:T,values:W}=await K();r.errors=T,E=W}else await Q(n);if(o.disabled.size)for(const T of o.disabled)ve(E,T,void 0);if(De(r.errors,"root"),Ue(r.errors)){m.state.next({errors:{}});try{await y(E,j)}catch(T){Y=T}}else S&&await S({...r.errors},j),H(),setTimeout(H);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ue(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},fe=(y,S={})=>{U(n,y)&&(Fe(S.defaultValue)?Z(y,Ie(U(i,y))):(Z(y,S.defaultValue),ve(i,y,Ie(S.defaultValue))),S.keepTouched||De(r.touchedFields,y),S.keepDirty||(De(r.dirtyFields,y),r.isDirty=S.defaultValue?F(y,Ie(U(i,y))):F()),S.keepError||(De(r.errors,y),d.isValid&&c()),m.state.next({...r}))},Re=(y,S={})=>{const j=y?Ie(y):i,Y=Ie(j),E=Ue(y),T=E?i:Y;if(S.keepDefaultValues||(i=j),!S.keepValues){if(S.keepDirtyValues){const W=new Set([...o.mount,...Object.keys(Mr(i,a))]);for(const oe of Array.from(W))U(r.dirtyFields,oe)?ve(T,oe,U(a,oe)):Z(oe,U(T,oe))}else{if(Bi&&Fe(y))for(const W of o.mount){const oe=U(n,W);if(oe&&oe._f){const pe=Array.isArray(oe._f.refs)?oe._f.refs[0]:oe._f.ref;if(Tn(pe)){const Pe=pe.closest("form");if(Pe){Pe.reset();break}}}}for(const W of o.mount)Z(W,U(T,W))}a=Ie(T),m.array.next({values:{...T}}),m.state.next({values:{...T}})}o={mount:S.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!S.keepIsValid||!!S.keepDirtyValues,s.watch=!!t.shouldUnregister,m.state.next({submitCount:S.keepSubmitCount?r.submitCount:0,isDirty:E?!1:S.keepDirty?r.isDirty:!!(S.keepDefaultValues&&!_t(y,i)),isSubmitted:S.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:E?{}:S.keepDirtyValues?S.keepDefaultValues&&a?Mr(i,a):r.dirtyFields:S.keepDefaultValues&&y?Mr(i,y):S.keepDirty?r.dirtyFields:{},touchedFields:S.keepTouched?r.touchedFields:{},errors:S.keepErrors?r.errors:{},isSubmitSuccessful:S.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Et=(y,S)=>Re(st(y)?y(a):y,S),ln=(y,S={})=>{const j=U(n,y),Y=j&&j._f;if(Y){const E=Y.refs?Y.refs[0]:Y.ref;E.focus&&(E.focus(),S.shouldSelect&&st(E.select)&&E.select())}},kt=y=>{r={...r,...y}},qt={control:{register:P,unregister:ee,getFieldState:q,handleSubmit:R,setError:G,_subscribe:ae,_runSchema:K,_focusError:H,_getWatch:$,_getDirty:F,_setValid:c,_setFieldArray:g,_setDisabledField:de,_setErrors:A,_getFieldArray:V,_reset:Re,_resetDefaultValues:()=>st(t.defaultValues)&&t.defaultValues().then(y=>{Et(y,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:u,_disableForm:te,_subjects:m,_proxyFormState:d,get _fields(){return n},get _formValues(){return a},get _state(){return s},set _state(y){s=y},get _defaultValues(){return i},get _names(){return o},set _names(y){o=y},get _formState(){return r},get _options(){return t},set _options(y){t={...t,...y}}},subscribe:ne,trigger:ue,register:P,handleSubmit:R,watch:J,setValue:Z,getValues:D,reset:Et,resetField:fe,clearErrors:B,unregister:ee,setError:G,setFocus:ln,getFieldState:q};return{...qt,formControl:qt}}function Dl(e={}){const t=M.useRef(void 0),r=M.useRef(void 0),[n,i]=M.useState({isDirty:!1,isValidating:!1,isLoading:st(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:st(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!st(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...o}=$l(e);t.current={...o,formState:n}}const a=t.current.control;return a._options=e,Hi(()=>{const s=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(o=>({...o,isReady:!0})),a._formState.isReady=!0,s},[a]),M.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),M.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),M.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),M.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),M.useEffect(()=>{if(a._proxyFormState.isDirty){const s=a._getDirty();s!==n.isDirty&&a._subjects.state.next({isDirty:s})}},[a,n.isDirty]),M.useEffect(()=>{e.values&&!_t(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,i(s=>({...s}))):a._resetDefaultValues()},[a,e.values]),M.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=Hs(n,a),t.current}const Ea=(e,t,r)=>{if(e&&"reportValidity"in e){const n=U(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},to=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ea(n.ref,r,e):n&&n.refs&&n.refs.forEach(i=>Ea(i,r,e))}},Rl=(e,t)=>{t.shouldUseNativeValidation&&to(e,t);const r={};for(const n in e){const i=U(t.fields,n),a=Object.assign(e[n]||{},{ref:i&&i.ref});if(Pl(t.names||Object.keys(e),n)){const s=Object.assign({},U(r,n));ve(s,"root",a),ve(r,n,s)}else ve(r,n,a)}return r},Pl=(e,t)=>{const r=ka(t);return e.some(n=>ka(n).match(`^${r}\\.\\d+`))};function ka(e){return e.replace(/\]|\[/g,"")}function Il(e,t,r){return r===void 0&&(r={}),function(n,i,a){try{return Promise.resolve(function(s,o){try{var l=(t!=null&&t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[r.mode==="sync"?"validateSync":"validate"](n,Object.assign({abortEarly:!1},t,{context:i}))).then(function(f){return a.shouldUseNativeValidation&&to({},a),{values:r.raw?Object.assign({},n):f,errors:{}}}))}catch(f){return o(f)}return l&&l.then?l.then(void 0,o):l}(0,function(s){if(!s.inner)throw s;return{values:{},errors:Rl((o=s,l=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(o.inner||[]).reduce(function(f,d){if(f[d.path]||(f[d.path]={message:d.message,type:d.type}),l){var p=f[d.path].types,m=p&&p[d.type];f[d.path]=Qs(d.path,l,f,d.type,m?[].concat(m,d.message):d.message)}return f},{})),a)};var o,l}))}catch(s){return Promise.reject(s)}}}var rn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ar=typeof window>"u"||"Deno"in globalThis;function We(){}function Ml(e,t){return typeof e=="function"?e(t):e}function gi(e){return typeof e=="number"&&e>=0&&e!==1/0}function ro(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zt(e,t){return typeof e=="function"?e(t):e}function Xe(e,t){return typeof e=="function"?e(t):e}function Oa(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:s,stale:o}=e;if(s){if(n){if(t.queryHash!==Gi(s,t.options))return!1}else if(!Qr(t.queryKey,s))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ta(e,t){const{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Kr(t.options.mutationKey)!==Kr(a))return!1}else if(!Qr(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Gi(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kr)(e)}function Kr(e){return JSON.stringify(e,(t,r)=>bi(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function Qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Qr(e[r],t[r])):!1}function vi(e,t){if(e===t)return e;const r=Ca(e)&&Ca(t);if(r||bi(e)&&bi(t)){const n=r?e:Object.keys(e),i=n.length,a=r?t:Object.keys(t),s=a.length,o=r?[]:{},l=new Set(n);let f=0;for(let d=0;d<s;d++){const p=r?d:a[d];(!r&&l.has(p)||r)&&e[p]===void 0&&t[p]===void 0?(o[p]=void 0,f++):(o[p]=vi(e[p],t[p]),o[p]===e[p]&&e[p]!==void 0&&f++)}return i===s&&f===i?e:o}return t}function xi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Ca(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bi(e){if(!_a(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!_a(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function _a(e){return Object.prototype.toString.call(e)==="[object Object]"}function zl(e){return new Promise(t=>{setTimeout(t,e)})}function wi(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return vi(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return vi(e,t)}return t}function Vl(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Nl(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var An=Symbol();function no(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===An&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===An?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ll(e,t){return typeof e=="function"?e(...t):!!e}var Gt,At,br,Ds,Bl=(Ds=class extends rn{constructor(){super();le(this,Gt);le(this,At);le(this,br);X(this,br,t=>{if(!ar&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){v(this,At)||this.setEventListener(v(this,br))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,At))==null||t.call(this),X(this,At,void 0))}setEventListener(t){var r;X(this,br,t),(r=v(this,At))==null||r.call(this),X(this,At,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){v(this,Gt)!==t&&(X(this,Gt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof v(this,Gt)=="boolean"?v(this,Gt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gt=new WeakMap,At=new WeakMap,br=new WeakMap,Ds),Yi=new Bl,wr,Ft,Sr,Rs,ql=(Rs=class extends rn{constructor(){super();le(this,wr,!0);le(this,Ft);le(this,Sr);X(this,Sr,t=>{if(!ar&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){v(this,Ft)||this.setEventListener(v(this,Sr))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,Ft))==null||t.call(this),X(this,Ft,void 0))}setEventListener(t){var r;X(this,Sr,t),(r=v(this,Ft))==null||r.call(this),X(this,Ft,t(this.setOnline.bind(this)))}setOnline(t){v(this,wr)!==t&&(X(this,wr,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return v(this,wr)}},wr=new WeakMap,Ft=new WeakMap,Sr=new WeakMap,Rs),Fn=new ql;function Si(){let e,t;const r=new Promise((i,a)=>{e=i,t=a});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}function Ul(e){return Math.min(1e3*2**e,3e4)}function io(e){return(e??"online")==="online"?Fn.isOnline():!0}var ao=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ei(e){return e instanceof ao}function so(e){let t=!1,r=0,n=!1,i;const a=Si(),s=c=>{var b;n||(m(new ao(c)),(b=e.abort)==null||b.call(e))},o=()=>{t=!0},l=()=>{t=!1},f=()=>Yi.isFocused()&&(e.networkMode==="always"||Fn.isOnline())&&e.canRun(),d=()=>io(e.networkMode)&&e.canRun(),p=c=>{var b;n||(n=!0,(b=e.onSuccess)==null||b.call(e,c),i==null||i(),a.resolve(c))},m=c=>{var b;n||(n=!0,(b=e.onError)==null||b.call(e,c),i==null||i(),a.reject(c))},x=()=>new Promise(c=>{var b;i=g=>{(n||f())&&c(g)},(b=e.onPause)==null||b.call(e)}).then(()=>{var c;i=void 0,n||(c=e.onContinue)==null||c.call(e)}),h=()=>{if(n)return;let c;const b=r===0?e.initialPromise:void 0;try{c=b??e.fn()}catch(g){c=Promise.reject(g)}Promise.resolve(c).then(p).catch(g=>{var L;if(n)return;const O=e.retry??(ar?0:3),A=e.retryDelay??Ul,C=typeof A=="function"?A(r,g):A,w=O===!0||typeof O=="number"&&r<O||typeof O=="function"&&O(r,g);if(t||!w){m(g);return}r++,(L=e.onFail)==null||L.call(e,r,g),zl(C).then(()=>f()?void 0:x()).then(()=>{t?m(g):h()})})};return{promise:a,cancel:s,continue:()=>(i==null||i(),a),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?h():x().then(h),a)}}var Wl=e=>setTimeout(e,0);function Hl(){let e=[],t=0,r=o=>{o()},n=o=>{o()},i=Wl;const a=o=>{t?e.push(o):i(()=>{r(o)})},s=()=>{const o=e;e=[],o.length&&i(()=>{n(()=>{o.forEach(l=>{r(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||s()}return l},batchCalls:o=>(...l)=>{a(()=>{o(...l)})},schedule:a,setNotifyFunction:o=>{r=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{i=o}}}var Me=Hl(),Yt,Ps,oo=(Ps=class{constructor(){le(this,Yt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gi(this.gcTime)&&X(this,Yt,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ar?1/0:5*60*1e3))}clearGcTimeout(){v(this,Yt)&&(clearTimeout(v(this,Yt)),X(this,Yt,void 0))}},Yt=new WeakMap,Ps),Er,Zt,Je,Jt,ze,Zr,Xt,nt,xt,Is,Kl=(Is=class extends oo{constructor(t){super();le(this,nt);le(this,Er);le(this,Zt);le(this,Je);le(this,Jt);le(this,ze);le(this,Zr);le(this,Xt);X(this,Xt,!1),X(this,Zr,t.defaultOptions),this.setOptions(t.options),this.observers=[],X(this,Jt,t.client),X(this,Je,v(this,Jt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,X(this,Er,Ql(this.options)),this.state=t.state??v(this,Er),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=v(this,ze))==null?void 0:t.promise}setOptions(t){this.options={...v(this,Zr),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&v(this,Je).remove(this)}setData(t,r){const n=wi(this.state.data,t,this.options);return me(this,nt,xt).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){me(this,nt,xt).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,i;const r=(n=v(this,ze))==null?void 0:n.promise;return(i=v(this,ze))==null||i.cancel(t),r?r.then(We).catch(We):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(v(this,Er))}isActive(){return this.observers.some(t=>Xe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===An||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zt(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ro(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=v(this,ze))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=v(this,ze))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),v(this,Je).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(v(this,ze)&&(v(this,Xt)?v(this,ze).cancel({revert:!0}):v(this,ze).cancelRetry()),this.scheduleGc()),v(this,Je).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,nt,xt).call(this,{type:"invalidate"})}fetch(t,r){var f,d,p;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(v(this,ze))return v(this,ze).continueRetry(),v(this,ze).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(x=>x.options.queryFn);m&&this.setOptions(m.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(X(this,Xt,!0),n.signal)})},a=()=>{const m=no(this.options,r),h=(()=>{const c={client:v(this,Jt),queryKey:this.queryKey,meta:this.meta};return i(c),c})();return X(this,Xt,!1),this.options.persister?this.options.persister(m,h,this):m(h)},o=(()=>{const m={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:v(this,Jt),state:this.state,fetchFn:a};return i(m),m})();(f=this.options.behavior)==null||f.onFetch(o,this),X(this,Zt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&me(this,nt,xt).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const l=m=>{var x,h,c,b;ei(m)&&m.silent||me(this,nt,xt).call(this,{type:"error",error:m}),ei(m)||((h=(x=v(this,Je).config).onError)==null||h.call(x,m,this),(b=(c=v(this,Je).config).onSettled)==null||b.call(c,this.state.data,m,this)),this.scheduleGc()};return X(this,ze,so({initialPromise:r==null?void 0:r.initialPromise,fn:o.fetchFn,abort:n.abort.bind(n),onSuccess:m=>{var x,h,c,b;if(m===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(g){l(g);return}(h=(x=v(this,Je).config).onSuccess)==null||h.call(x,m,this),(b=(c=v(this,Je).config).onSettled)==null||b.call(c,m,this.state.error,this),this.scheduleGc()},onError:l,onFail:(m,x)=>{me(this,nt,xt).call(this,{type:"failed",failureCount:m,error:x})},onPause:()=>{me(this,nt,xt).call(this,{type:"pause"})},onContinue:()=>{me(this,nt,xt).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),v(this,ze).start()}},Er=new WeakMap,Zt=new WeakMap,Je=new WeakMap,Jt=new WeakMap,ze=new WeakMap,Zr=new WeakMap,Xt=new WeakMap,nt=new WeakSet,xt=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...lo(n.data,this.options),fetchMeta:t.meta??null};case"success":return X(this,Zt,void 0),{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return ei(i)&&i.revert&&v(this,Zt)?{...v(this,Zt),fetchStatus:"idle"}:{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),Me.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),v(this,Je).notify({query:this,type:"updated",action:t})})},Is);function lo(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:io(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ql(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var pt,Ms,Gl=(Ms=class extends rn{constructor(t={}){super();le(this,pt);this.config=t,X(this,pt,new Map)}build(t,r,n){const i=r.queryKey,a=r.queryHash??Gi(i,r);let s=this.get(a);return s||(s=new Kl({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){v(this,pt).has(t.queryHash)||(v(this,pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=v(this,pt).get(t.queryHash);r&&(t.destroy(),r===t&&v(this,pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Me.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return v(this,pt).get(t)}getAll(){return[...v(this,pt).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Oa(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Oa(t,n)):r}notify(t){Me.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Me.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Me.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},pt=new WeakMap,Ms),ft,Ve,er,mt,Tt,zs,Yl=(zs=class extends oo{constructor(t){super();le(this,mt);le(this,ft);le(this,Ve);le(this,er);this.mutationId=t.mutationId,X(this,Ve,t.mutationCache),X(this,ft,[]),this.state=t.state||Zl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){v(this,ft).includes(t)||(v(this,ft).push(t),this.clearGcTimeout(),v(this,Ve).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){X(this,ft,v(this,ft).filter(r=>r!==t)),this.scheduleGc(),v(this,Ve).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){v(this,ft).length||(this.state.status==="pending"?this.scheduleGc():v(this,Ve).remove(this))}continue(){var t;return((t=v(this,er))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,s,o,l,f,d,p,m,x,h,c,b,g,O,A,C,w,L,K,ie;const r=()=>{me(this,mt,Tt).call(this,{type:"continue"})};X(this,er,so({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(Q,u)=>{me(this,mt,Tt).call(this,{type:"failed",failureCount:Q,error:u})},onPause:()=>{me(this,mt,Tt).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>v(this,Ve).canRun(this)}));const n=this.state.status==="pending",i=!v(this,er).canStart();try{if(n)r();else{me(this,mt,Tt).call(this,{type:"pending",variables:t,isPaused:i}),await((s=(a=v(this,Ve).config).onMutate)==null?void 0:s.call(a,t,this));const u=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));u!==this.state.context&&me(this,mt,Tt).call(this,{type:"pending",context:u,variables:t,isPaused:i})}const Q=await v(this,er).start();return await((d=(f=v(this,Ve).config).onSuccess)==null?void 0:d.call(f,Q,t,this.state.context,this)),await((m=(p=this.options).onSuccess)==null?void 0:m.call(p,Q,t,this.state.context)),await((h=(x=v(this,Ve).config).onSettled)==null?void 0:h.call(x,Q,null,this.state.variables,this.state.context,this)),await((b=(c=this.options).onSettled)==null?void 0:b.call(c,Q,null,t,this.state.context)),me(this,mt,Tt).call(this,{type:"success",data:Q}),Q}catch(Q){try{throw await((O=(g=v(this,Ve).config).onError)==null?void 0:O.call(g,Q,t,this.state.context,this)),await((C=(A=this.options).onError)==null?void 0:C.call(A,Q,t,this.state.context)),await((L=(w=v(this,Ve).config).onSettled)==null?void 0:L.call(w,void 0,Q,this.state.variables,this.state.context,this)),await((ie=(K=this.options).onSettled)==null?void 0:ie.call(K,void 0,Q,t,this.state.context)),Q}finally{me(this,mt,Tt).call(this,{type:"error",error:Q})}}finally{v(this,Ve).runNext(this)}}},ft=new WeakMap,Ve=new WeakMap,er=new WeakMap,mt=new WeakSet,Tt=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Me.batch(()=>{v(this,ft).forEach(n=>{n.onMutationUpdate(t)}),v(this,Ve).notify({mutation:this,type:"updated",action:t})})},zs);function Zl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var bt,it,Jr,Vs,Jl=(Vs=class extends rn{constructor(t={}){super();le(this,bt);le(this,it);le(this,Jr);this.config=t,X(this,bt,new Set),X(this,it,new Map),X(this,Jr,0)}build(t,r,n){const i=new Yl({mutationCache:this,mutationId:++un(this,Jr)._,options:t.defaultMutationOptions(r),state:n});return this.add(i),i}add(t){v(this,bt).add(t);const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r);n?n.push(t):v(this,it).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(v(this,bt).delete(t)){const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r);if(n)if(n.length>1){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}else n[0]===t&&v(this,it).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=dn(t);if(typeof r=="string"){const n=v(this,it).get(r),i=n==null?void 0:n.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){var n;const r=dn(t);if(typeof r=="string"){const i=(n=v(this,it).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Me.batch(()=>{v(this,bt).forEach(t=>{this.notify({type:"removed",mutation:t})}),v(this,bt).clear(),v(this,it).clear()})}getAll(){return Array.from(v(this,bt))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ta(r,n))}findAll(t={}){return this.getAll().filter(r=>Ta(t,r))}notify(t){Me.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Me.batch(()=>Promise.all(t.map(r=>r.continue().catch(We))))}},bt=new WeakMap,it=new WeakMap,Jr=new WeakMap,Vs);function dn(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Aa(e){return{onFetch:(t,r)=>{var d,p,m,x,h;const n=t.options,i=(m=(p=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,a=((x=t.state.data)==null?void 0:x.pages)||[],s=((h=t.state.data)==null?void 0:h.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const f=async()=>{let c=!1;const b=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},g=no(t.options,t.fetchOptions),O=async(A,C,w)=>{if(c)return Promise.reject();if(C==null&&A.pages.length)return Promise.resolve(A);const K=(()=>{const F={client:t.client,queryKey:t.queryKey,pageParam:C,direction:w?"backward":"forward",meta:t.options.meta};return b(F),F})(),ie=await g(K),{maxPages:Q}=t.options,u=w?Nl:Vl;return{pages:u(A.pages,ie,Q),pageParams:u(A.pageParams,C,Q)}};if(i&&a.length){const A=i==="backward",C=A?Xl:Fa,w={pages:a,pageParams:s},L=C(n,w);o=await O(w,L,A)}else{const A=e??a.length;do{const C=l===0?s[0]??n.initialPageParam:Fa(n,o);if(l>0&&C==null)break;o=await O(o,C),l++}while(l<A)}return o};t.options.persister?t.fetchFn=()=>{var c,b;return(b=(c=t.options).persister)==null?void 0:b.call(c,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=f}}}function Fa(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Xl(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var _e,jt,$t,kr,Or,Dt,Tr,Cr,Ns,ec=(Ns=class{constructor(e={}){le(this,_e);le(this,jt);le(this,$t);le(this,kr);le(this,Or);le(this,Dt);le(this,Tr);le(this,Cr);X(this,_e,e.queryCache||new Gl),X(this,jt,e.mutationCache||new Jl),X(this,$t,e.defaultOptions||{}),X(this,kr,new Map),X(this,Or,new Map),X(this,Dt,0)}mount(){un(this,Dt)._++,v(this,Dt)===1&&(X(this,Tr,Yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,_e).onFocus())})),X(this,Cr,Fn.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,_e).onOnline())})))}unmount(){var e,t;un(this,Dt)._--,v(this,Dt)===0&&((e=v(this,Tr))==null||e.call(this),X(this,Tr,void 0),(t=v(this,Cr))==null||t.call(this),X(this,Cr,void 0))}isFetching(e){return v(this,_e).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return v(this,jt).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=v(this,_e).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=v(this,_e).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zt(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return v(this,_e).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=v(this,_e).get(n.queryHash),a=i==null?void 0:i.state.data,s=Ml(t,a);if(s!==void 0)return v(this,_e).build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return Me.batch(()=>v(this,_e).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=v(this,_e).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=v(this,_e);Me.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=v(this,_e);return Me.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Me.batch(()=>v(this,_e).findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(We).catch(We)}invalidateQueries(e,t={}){return Me.batch(()=>(v(this,_e).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Me.batch(()=>v(this,_e).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,r);return r.throwOnError||(a=a.catch(We)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(We)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=v(this,_e).build(this,t);return r.isStaleByTime(zt(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(We).catch(We)}fetchInfiniteQuery(e){return e.behavior=Aa(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(We).catch(We)}ensureInfiniteQueryData(e){return e.behavior=Aa(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Fn.isOnline()?v(this,jt).resumePausedMutations():Promise.resolve()}getQueryCache(){return v(this,_e)}getMutationCache(){return v(this,jt)}getDefaultOptions(){return v(this,$t)}setDefaultOptions(e){X(this,$t,e)}setQueryDefaults(e,t){v(this,kr).set(Kr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...v(this,kr).values()],r={};return t.forEach(n=>{Qr(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){v(this,Or).set(Kr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...v(this,Or).values()],r={};return t.forEach(n=>{Qr(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...v(this,$t).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Gi(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===An&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...v(this,$t).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){v(this,_e).clear(),v(this,jt).clear()}},_e=new WeakMap,jt=new WeakMap,$t=new WeakMap,kr=new WeakMap,Or=new WeakMap,Dt=new WeakMap,Tr=new WeakMap,Cr=new WeakMap,Ns),qe,he,Xr,Ne,tr,_r,Rt,Pt,en,Ar,Fr,rr,nr,It,jr,xe,Nr,Ei,ki,Oi,Ti,Ci,_i,Ai,co,Ls,tc=(Ls=class extends rn{constructor(t,r){super();le(this,xe);le(this,qe);le(this,he);le(this,Xr);le(this,Ne);le(this,tr);le(this,_r);le(this,Rt);le(this,Pt);le(this,en);le(this,Ar);le(this,Fr);le(this,rr);le(this,nr);le(this,It);le(this,jr,new Set);this.options=r,X(this,qe,t),X(this,Pt,null),X(this,Rt,Si()),this.options.experimental_prefetchInRender||v(this,Rt).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(v(this,he).addObserver(this),ja(v(this,he),this.options)?me(this,xe,Nr).call(this):this.updateResult(),me(this,xe,Ti).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fi(v(this,he),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fi(v(this,he),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,xe,Ci).call(this),me(this,xe,_i).call(this),v(this,he).removeObserver(this)}setOptions(t){const r=this.options,n=v(this,he);if(this.options=v(this,qe).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xe(this.options.enabled,v(this,he))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,xe,Ai).call(this),v(this,he).setOptions(this.options),r._defaulted&&!xi(this.options,r)&&v(this,qe).getQueryCache().notify({type:"observerOptionsUpdated",query:v(this,he),observer:this});const i=this.hasListeners();i&&$a(v(this,he),n,this.options,r)&&me(this,xe,Nr).call(this),this.updateResult(),i&&(v(this,he)!==n||Xe(this.options.enabled,v(this,he))!==Xe(r.enabled,v(this,he))||zt(this.options.staleTime,v(this,he))!==zt(r.staleTime,v(this,he)))&&me(this,xe,Ei).call(this);const a=me(this,xe,ki).call(this);i&&(v(this,he)!==n||Xe(this.options.enabled,v(this,he))!==Xe(r.enabled,v(this,he))||a!==v(this,It))&&me(this,xe,Oi).call(this,a)}getOptimisticResult(t){const r=v(this,qe).getQueryCache().build(v(this,qe),t),n=this.createResult(r,t);return nc(this,n)&&(X(this,Ne,n),X(this,_r,this.options),X(this,tr,v(this,he).state)),n}getCurrentResult(){return v(this,Ne)}trackResult(t,r){return new Proxy(t,{get:(n,i)=>(this.trackProp(i),r==null||r(i),Reflect.get(n,i))})}trackProp(t){v(this,jr).add(t)}getCurrentQuery(){return v(this,he)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=v(this,qe).defaultQueryOptions(t),n=v(this,qe).getQueryCache().build(v(this,qe),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return me(this,xe,Nr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),v(this,Ne)))}createResult(t,r){var Q;const n=v(this,he),i=this.options,a=v(this,Ne),s=v(this,tr),o=v(this,_r),f=t!==n?t.state:v(this,Xr),{state:d}=t;let p={...d},m=!1,x;if(r._optimisticResults){const u=this.hasListeners(),F=!u&&ja(t,r),$=u&&$a(t,n,r,i);(F||$)&&(p={...p,...lo(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:h,errorUpdatedAt:c,status:b}=p;x=p.data;let g=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let u;a!=null&&a.isPlaceholderData&&r.placeholderData===(o==null?void 0:o.placeholderData)?(u=a.data,g=!0):u=typeof r.placeholderData=="function"?r.placeholderData((Q=v(this,Fr))==null?void 0:Q.state.data,v(this,Fr)):r.placeholderData,u!==void 0&&(b="success",x=wi(a==null?void 0:a.data,u,r),m=!0)}if(r.select&&x!==void 0&&!g)if(a&&x===(s==null?void 0:s.data)&&r.select===v(this,en))x=v(this,Ar);else try{X(this,en,r.select),x=r.select(x),x=wi(a==null?void 0:a.data,x,r),X(this,Ar,x),X(this,Pt,null)}catch(u){X(this,Pt,u)}v(this,Pt)&&(h=v(this,Pt),x=v(this,Ar),c=Date.now(),b="error");const O=p.fetchStatus==="fetching",A=b==="pending",C=b==="error",w=A&&O,L=x!==void 0,ie={status:b,fetchStatus:p.fetchStatus,isPending:A,isSuccess:b==="success",isError:C,isInitialLoading:w,isLoading:w,data:x,dataUpdatedAt:p.dataUpdatedAt,error:h,errorUpdatedAt:c,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:O,isRefetching:O&&!A,isLoadingError:C&&!L,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&L,isStale:Zi(t,r),refetch:this.refetch,promise:v(this,Rt),isEnabled:Xe(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const u=V=>{ie.status==="error"?V.reject(ie.error):ie.data!==void 0&&V.resolve(ie.data)},F=()=>{const V=X(this,Rt,ie.promise=Si());u(V)},$=v(this,Rt);switch($.status){case"pending":t.queryHash===n.queryHash&&u($);break;case"fulfilled":(ie.status==="error"||ie.data!==$.value)&&F();break;case"rejected":(ie.status!=="error"||ie.error!==$.reason)&&F();break}}return ie}updateResult(){const t=v(this,Ne),r=this.createResult(v(this,he),this.options);if(X(this,tr,v(this,he).state),X(this,_r,this.options),v(this,tr).data!==void 0&&X(this,Fr,v(this,he)),xi(r,t))return;X(this,Ne,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!v(this,jr).size)return!0;const s=new Set(a??v(this,jr));return this.options.throwOnError&&s.add("error"),Object.keys(v(this,Ne)).some(o=>{const l=o;return v(this,Ne)[l]!==t[l]&&s.has(l)})};me(this,xe,co).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,xe,Ti).call(this)}},qe=new WeakMap,he=new WeakMap,Xr=new WeakMap,Ne=new WeakMap,tr=new WeakMap,_r=new WeakMap,Rt=new WeakMap,Pt=new WeakMap,en=new WeakMap,Ar=new WeakMap,Fr=new WeakMap,rr=new WeakMap,nr=new WeakMap,It=new WeakMap,jr=new WeakMap,xe=new WeakSet,Nr=function(t){me(this,xe,Ai).call(this);let r=v(this,he).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(We)),r},Ei=function(){me(this,xe,Ci).call(this);const t=zt(this.options.staleTime,v(this,he));if(ar||v(this,Ne).isStale||!gi(t))return;const n=ro(v(this,Ne).dataUpdatedAt,t)+1;X(this,rr,setTimeout(()=>{v(this,Ne).isStale||this.updateResult()},n))},ki=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(v(this,he)):this.options.refetchInterval)??!1},Oi=function(t){me(this,xe,_i).call(this),X(this,It,t),!(ar||Xe(this.options.enabled,v(this,he))===!1||!gi(v(this,It))||v(this,It)===0)&&X(this,nr,setInterval(()=>{(this.options.refetchIntervalInBackground||Yi.isFocused())&&me(this,xe,Nr).call(this)},v(this,It)))},Ti=function(){me(this,xe,Ei).call(this),me(this,xe,Oi).call(this,me(this,xe,ki).call(this))},Ci=function(){v(this,rr)&&(clearTimeout(v(this,rr)),X(this,rr,void 0))},_i=function(){v(this,nr)&&(clearInterval(v(this,nr)),X(this,nr,void 0))},Ai=function(){const t=v(this,qe).getQueryCache().build(v(this,qe),this.options);if(t===v(this,he))return;const r=v(this,he);X(this,he,t),X(this,Xr,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},co=function(t){Me.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(v(this,Ne))}),v(this,qe).getQueryCache().notify({query:v(this,he),type:"observerResultsUpdated"})})},Ls);function rc(e,t){return Xe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ja(e,t){return rc(e,t)||e.state.data!==void 0&&Fi(e,t,t.refetchOnMount)}function Fi(e,t,r){if(Xe(t.enabled,e)!==!1&&zt(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Zi(e,t)}return!1}function $a(e,t,r,n){return(e!==t||Xe(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Zi(e,r)}function Zi(e,t){return Xe(t.enabled,e)!==!1&&e.isStaleByTime(zt(t.staleTime,e))}function nc(e,t){return!xi(e.getCurrentResult(),t)}var uo=Ae.createContext(void 0),ic=e=>{const t=Ae.useContext(uo);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ac=({client:e,children:t})=>(Ae.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),k.jsx(uo.Provider,{value:e,children:t})),po=Ae.createContext(!1),sc=()=>Ae.useContext(po);po.Provider;function oc(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var lc=Ae.createContext(oc()),cc=()=>Ae.useContext(lc),uc=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},dc=e=>{Ae.useEffect(()=>{e.clearReset()},[e])},pc=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&e.data===void 0||Ll(r,[e.error,n])),fc=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},mc=(e,t)=>e.isLoading&&e.isFetching&&!t,hc=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Da=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function yc(e,t,r){var p,m,x,h,c;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=sc(),i=cc(),a=ic(),s=a.defaultQueryOptions(e);(m=(p=a.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||m.call(p,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=n?"isRestoring":"optimistic",fc(s),uc(s,i),dc(i);const o=!a.getQueryCache().get(s.queryHash),[l]=Ae.useState(()=>new t(a,s)),f=l.getOptimisticResult(s),d=!n&&e.subscribed!==!1;if(Ae.useSyncExternalStore(Ae.useCallback(b=>{const g=d?l.subscribe(Me.batchCalls(b)):We;return l.updateResult(),g},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Ae.useEffect(()=>{l.setOptions(s)},[s,l]),hc(s,f))throw Da(s,l,i);if(pc({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:a.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((h=(x=a.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||h.call(x,s,f),s.experimental_prefetchInRender&&!ar&&mc(f,n)){const b=o?Da(s,l,i):(c=a.getQueryCache().get(s.queryHash))==null?void 0:c.promise;b==null||b.catch(We).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?f:l.trackResult(f)}function gc(e,t){return yc(e,tc)}const fo=({src:e,alt:t,width:r="100%",height:n="auto",style:i,className:a,onClick:s})=>k.jsx(I.Box,{sx:{textAlign:"center"},children:k.jsx("img",{src:e||"/placeholder-image.png",alt:t||"Image",width:r,height:n,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",cursor:s?"pointer":"default",...i},className:a,onClick:s,onError:o=>{o.currentTarget.src="/placeholder-image.png"}})});async function mo(e,t,r,n){try{const{endpoint:i,method:a="GET",valueField:s="value",labelField:o="label",headers:l={},params:f={},body:d,transform:p,dependsOn:m}=e;let x=i;if(t&&!i.startsWith("http")&&(x=`${t}${i.startsWith("/")?i:`/${i}`}`),m&&n){const C=n[m];C&&(x=x.replace(`{${m}}`,encodeURIComponent(C)))}const h=new URLSearchParams;Object.entries(f).forEach(([C,w])=>{w!=null&&h.append(C,String(w))}),h.toString()&&(x+=`${x.includes("?")?"&":"?"}${h.toString()}`);const c={"Content-Type":"application/json",...r,...l},b={method:a,headers:c};(a==="POST"||a==="PUT")&&d&&(b.body=JSON.stringify(d));const g=await fetch(x,b);if(!g.ok)throw new Error(`API request failed: ${g.status} ${g.statusText}`);const O=await g.json();if(p)return p(Array.isArray(O)?O:O.data||O);const A=Array.isArray(O)?O:O.data||O;if(!Array.isArray(A))throw new Error("API response is not an array");return A.map(C=>({label:C[o]||C.name||C.title||String(C[s]||""),value:C[s]||C.id||C.value||""}))}catch(i){throw console.error("API fetch error:",i),new Error(`Failed to fetch data: ${i instanceof Error?i.message:"Unknown error"}`)}}function ho(e,t,r,n,i=!1){const a=M.useMemo(()=>{if(!(e!=null&&e.dependsOn)||!n)return null;const o=n[e.dependsOn];return o!==void 0?o:null},[e==null?void 0:e.dependsOn,n]),s=M.useMemo(()=>["api-data",e==null?void 0:e.endpoint,e==null?void 0:e.method,e==null?void 0:e.valueField,e==null?void 0:e.labelField,t,a],[e==null?void 0:e.endpoint,e==null?void 0:e.method,e==null?void 0:e.valueField,e==null?void 0:e.labelField,t,a]);return gc({queryKey:s,queryFn:()=>{if(!e)throw new Error("API config is required");return mo(e,t,r,n)},enabled:i&&!!e,staleTime:15*60*1e3,gcTime:30*60*1e3,retry:3,retryDelay:o=>Math.min(1e3*2**o,3e4),refetchOnWindowFocus:!1,refetchOnReconnect:!0,refetchOnMount:!1})}function Ht(e){return!!(e.apiConfig||e.api_endpoint)}function Ji(e){return e.apiConfig?e.apiConfig:e.api_endpoint?{endpoint:e.api_endpoint,method:e.api_method||"GET",valueField:e.value_field||"value",labelField:e.label_field||"label",dependsOn:e.depends_on,conditional:e.conditional}:null}function vc(e,t){const r=Ji(e);if(!(r!=null&&r.conditional)&&!e.conditional)return!0;if(r!=null&&r.dependsOn||e.depends_on){const n=(r==null?void 0:r.dependsOn)||e.depends_on;if(n){const i=t[n];return i!=null&&i!==""}}return!0}const yo=({field:e,control:t,errors:r,baseUrl:n,apiHeaders:i,formData:a})=>{const s=r[e.name],o=!!s,[l,f]=M.useState(!1),d=M.useRef(!1),p=()=>{var $;return e.required!==void 0?e.required:(($=e.validation)==null?void 0:$.required)!==void 0?e.validation.required:!1},m=$=>p()?`${$} *`:$,x=()=>e.value!==void 0?e.value:e.type==="checkbox"?!1:e.type==="select"&&e.default?e.default:e.type==="autocomplete"&&e.multiple?[]:"",h=M.useMemo(()=>Ji(e),[e.apiConfig,e.api_endpoint,e.api_method,e.value_field,e.label_field,e.depends_on,e.conditional]),c=M.useRef(null),b=h!=null&&h.dependsOn?a==null?void 0:a[h.dependsOn]:null,g=M.useMemo(()=>{if(!(h!=null&&h.dependsOn))return!1;const $=b,V=c.current,z=$!==V;return z&&(c.current=$),z},[h==null?void 0:h.dependsOn,b]),O=M.useMemo(()=>!0,[]),A=M.useMemo(()=>l&&Ht(e)&&(!(h!=null&&h.dependsOn)||b),[l,e,h==null?void 0:h.dependsOn,b]),C=M.useMemo(()=>{if(!(h!=null&&h.dependsOn)||!a)return{};const $={};return h.dependsOn&&a[h.dependsOn]!==void 0&&($[h.dependsOn]=a[h.dependsOn]),$},[h==null?void 0:h.dependsOn,a]),{data:w=[],isLoading:L,error:K}=ho(h,n,i,C,A),ie=M.useCallback(()=>{Ht(e)&&!d.current&&(d.current=!0,f(!0))},[e]),Q=M.useCallback(()=>{Ht(e)&&!d.current&&(d.current=!0,f(!0))},[e]);M.useEffect(()=>{if(Ht(e)&&!d.current){const $=a==null?void 0:a[e.name];$!=null&&$!==""&&(d.current=!0,f(!0))}},[e,a]),M.useEffect(()=>{Ht(e)&&(h!=null&&h.dependsOn)&&g&&d.current&&(d.current=!1,f(!1))},[g,h==null?void 0:h.dependsOn]);const u=M.useCallback(()=>Ht(e)?w:e.type==="select"||e.type==="toggle"||e.type==="radio"||e.type==="autocomplete"?e.options||[]:[],[e,w]);if(!O)return null;const F=()=>{switch(e.type){case"title":return k.jsx(I.Typography,{variant:e.variant||"h4",component:"h1",color:e.color,align:e.align||"left",sx:{mb:3,fontWeight:600,...e.sx},children:e.label});case"section":return k.jsx(I.Typography,{variant:e.variant||"h6",component:"h3",color:e.color,align:e.align||"left",sx:{mb:2,fontWeight:600,color:"text.primary",...e.sx},children:e.label});case"text":case"email":case"password":case"tel":case"textarea":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(I.TextField,{...N,id:e.id,fullWidth:!0,label:m(e.label),type:e.type!=="textarea"?e.type:void 0,placeholder:e.placeholder,disabled:e.disabled,error:o,helperText:(s==null?void 0:s.message)||e.helperText,multiline:e.type==="textarea",minRows:e.rows||(e.type==="textarea"?3:void 0)})});case"number":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(I.TextField,{...N,id:e.id,fullWidth:!0,label:m(e.label),type:"number",placeholder:e.placeholder,disabled:e.disabled,error:o,helperText:s==null?void 0:s.message,inputProps:{min:e.min,max:e.max}})});case"select":const $=u();return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.FormControl,{fullWidth:!0,error:o||!!K,children:[k.jsx(I.InputLabel,{id:e.id,children:m(e.label)}),k.jsx(I.Select,{...N,labelId:e.id,label:m(e.label),disabled:e.disabled||L,endAdornment:L?k.jsx(I.CircularProgress,{size:20}):void 0,onOpen:ie,children:L?k.jsx(I.MenuItem,{disabled:!0,children:k.jsxs(I.Box,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[k.jsx(I.CircularProgress,{size:16}),k.jsx(I.Typography,{variant:"body2",children:"Fetching data..."})]})}):$.length>0?$.map(Z=>k.jsx(I.MenuItem,{value:Z.value,children:Z.label},Z.value)):l&&!L?k.jsx(I.MenuItem,{disabled:!0,children:k.jsx(I.Typography,{variant:"body2",color:"text.secondary",children:"No options available"})}):k.jsx(I.MenuItem,{disabled:!0,children:k.jsx(I.Typography,{variant:"body2",color:"text.secondary",children:"Click to load options"})})}),(o||K||e.helperText)&&k.jsx(I.FormHelperText,{children:(s==null?void 0:s.message)||(K==null?void 0:K.message)||e.helperText})]})});case"checkbox":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.Box,{sx:{mt:1,mb:0},children:[k.jsx(I.FormControlLabel,{control:k.jsx(I.Checkbox,{...N,id:e.id,checked:N.value,disabled:e.disabled}),label:m(e.label)}),(o||e.helperText)&&k.jsx(I.FormHelperText,{error:o,sx:{ml:0},children:(s==null?void 0:s.message)||e.helperText})]})});case"toggle":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.FormControl,{component:"fieldset",error:o,children:[k.jsx(I.Typography,{variant:"body2",component:"legend",sx:{mb:1},children:m(e.label)}),k.jsx(I.RadioGroup,{...N,row:!0,children:e.options.map(Z=>k.jsx(I.FormControlLabel,{value:Z.value,control:k.jsx(I.Radio,{}),label:Z.label},Z.value))}),(o||e.helperText)&&k.jsx(I.FormHelperText,{error:o,children:(s==null?void 0:s.message)||e.helperText})]})});case"radio":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.FormControl,{component:"fieldset",error:o,children:[k.jsx(I.Typography,{variant:"body2",component:"legend",sx:{mb:1},children:m(e.label)}),k.jsx(I.RadioGroup,{...N,children:e.options.map(Z=>k.jsx(I.FormControlLabel,{value:Z.value,control:k.jsx(I.Radio,{}),label:Z.label},Z.value))}),o&&k.jsx(I.FormHelperText,{error:!0,children:s==null?void 0:s.message})]})});case"switch":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsxs(I.Box,{sx:{mt:1,mb:0},children:[k.jsx(I.FormControlLabel,{control:k.jsx(I.Switch,{...N,id:e.id,checked:N.value,disabled:e.disabled}),label:m(e.label)}),(o||e.helperText)&&k.jsx(I.FormHelperText,{error:o,sx:{ml:0},children:(s==null?void 0:s.message)||e.helperText})]})});case"autocomplete":const V=u(),z=!!(e.disabled||L||h!=null&&h.dependsOn&&!b);return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>{const Z=N.value,se=e.multiple===!0,ce=(h==null?void 0:h.valueField)||e.value_field||"value",ue=(h==null?void 0:h.labelField)||e.label_field||"label",D=B=>{if(B!=null){if(typeof B=="string"||typeof B=="number")return B;if(typeof B=="object"){if(B[ce]!==void 0)return B[ce];if(B.value!==void 0)return B.value;if(B.id!==void 0)return B.id}}},q=(()=>{if(se)return(Array.isArray(Z)?Z:[]).map(G=>{const J=V.find(ae=>{const ne=D(ae);return ne!==void 0&&ne===G});return J||{[ce]:G,[ue]:`Selected: ${G}`,value:G,label:`Selected: ${G}`}});{if(Z==null||Z==="")return null;const B=V.find(G=>{const J=D(G);return J!==void 0&&J===Z});return B||{[ce]:Z,[ue]:`Selected: ${Z}`,value:Z,label:`Selected: ${Z}`}}})();return k.jsx(I.Autocomplete,{...N,id:e.id,options:V,value:q,getOptionLabel:B=>typeof B=="string"?B:B[ue]||B.label||B.name||"",isOptionEqualToValue:(B,G)=>{const J=D(B),ae=D(G);return J===void 0||ae===void 0?!1:J===ae},multiple:e.multiple,disableCloseOnSelect:se,freeSolo:e.freeSolo,filterOptions:e.filterOptions===!1?()=>V:void 0,disabled:z,loading:L,onOpen:Q,renderOption:(B,G,{selected:J})=>{const ae=typeof G=="string"?G:G[ue]||G.label||G.name||"";return k.jsxs("li",{...B,children:[se&&k.jsx(I.Checkbox,{style:{marginRight:8},checked:J}),ae]})},renderTags:se?(B,G)=>{const ae=B.slice(0,2).map((ee,de)=>{const P=typeof ee=="string"?ee:ee[ue]||ee.label||ee.name||"",H=G({index:de});return M.createElement(I.Chip,{...H,key:de,label:P,size:"small"})}),ne=B.length-2;return ne>0&&ae.push(k.jsx(I.Chip,{label:`+${ne} more`,size:"small"},"more")),ae}:void 0,renderInput:B=>k.jsx(I.TextField,{...B,label:m(e.label),placeholder:z&&(h!=null&&h.dependsOn)&&!b?`Please select ${h.dependsOn.replace(/_/g," ")} first`:e.placeholder,error:o||!!K,helperText:(s==null?void 0:s.message)||(K==null?void 0:K.message)||e.helperText||"",InputProps:{...B.InputProps,endAdornment:k.jsxs(k.Fragment,{children:[L?k.jsx(I.CircularProgress,{color:"inherit",size:20}):null,B.InputProps.endAdornment]})}}),onChange:(B,G)=>{const J=(h==null?void 0:h.valueField)||e.value_field||"value";if(se){const ne=(Array.isArray(G)?G:[]).map(ee=>typeof ee=="object"&&(ee[J]||ee.value||ee.id)||ee);N.onChange(ne)}else{let ae;G&&typeof G=="object"?ae=G[J]||G.value||G.id||G:ae=G,N.onChange(ae)}},noOptionsText:z&&(h!=null&&h.dependsOn)&&!b?`Please select ${h.dependsOn.replace(/_/g," ")} first`:L?"Fetching data...":l&&!L&&V.length===0?"No options available":"Click to load options"})}});case"date":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(I.TextField,{...N,id:e.name,fullWidth:!0,label:m(e.label),type:"date",disabled:e.disabled,error:o,helperText:s==null?void 0:s.message,InputLabelProps:{shrink:!0},inputProps:{min:e.minDate,max:e.maxDate}})});case"image":return k.jsx(lt,{name:e.name,control:t,defaultValue:x(),render:({field:N})=>k.jsx(fo,{src:N.value||e.defaultValue||e.src,alt:e.alt||e.label,width:e.width,height:e.height,style:e.style,className:e.className,onClick:e.onClick})});case"component":return k.jsx(I.Box,{children:e.render?e.render():e.content});default:return null}};return k.jsx(I.Box,{children:F()})};function Xi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ti,Ra;function xc(){if(Ra)return ti;Ra=1;function e(g){this._maxSize=g,this.clear()}e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(g){return this._values[g]},e.prototype.set=function(g,O){return this._size>=this._maxSize&&this.clear(),g in this._values||this._size++,this._values[g]=O};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,n=/^\d/,i=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,o=new e(s),l=new e(s),f=new e(s);ti={Cache:e,split:p,normalizePath:d,setter:function(g){var O=d(g);return l.get(g)||l.set(g,function(C,w){for(var L=0,K=O.length,ie=C;L<K-1;){var Q=O[L];if(Q==="__proto__"||Q==="constructor"||Q==="prototype")return C;ie=ie[O[L++]]}ie[O[L]]=w})},getter:function(g,O){var A=d(g);return f.get(g)||f.set(g,function(w){for(var L=0,K=A.length;L<K;)if(w!=null||!O)w=w[A[L++]];else return;return w})},join:function(g){return g.reduce(function(O,A){return O+(x(A)||r.test(A)?"["+A+"]":(O?".":"")+A)},"")},forEach:function(g,O,A){m(Array.isArray(g)?g:p(g),O,A)}};function d(g){return o.get(g)||o.set(g,p(g).map(function(O){return O.replace(a,"$2")}))}function p(g){return g.match(t)||[""]}function m(g,O,A){var C=g.length,w,L,K,ie;for(L=0;L<C;L++)w=g[L],w&&(b(w)&&(w='"'+w+'"'),ie=x(w),K=!ie&&/^\d+$/.test(w),O.call(A,w,ie,K,L,g))}function x(g){return typeof g=="string"&&g&&["'",'"'].indexOf(g.charAt(0))!==-1}function h(g){return g.match(n)&&!g.match(r)}function c(g){return i.test(g)}function b(g){return!x(g)&&(h(g)||c(g))}return ti}var ir=xc(),ri,Pa;function bc(){if(Pa)return ri;Pa=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=d=>d.match(e)||[],r=d=>d[0].toUpperCase()+d.slice(1),n=(d,p)=>t(d).join(p).toLowerCase(),i=d=>t(d).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return ri={words:t,upperFirst:r,camelCase:i,pascalCase:d=>r(i(d)),snakeCase:d=>n(d,"_"),kebabCase:d=>n(d,"-"),sentenceCase:d=>r(n(d," ")),titleCase:d=>t(d).map(r).join(" ")},ri}var ni=bc(),pn={exports:{}},Ia;function wc(){if(Ia)return pn.exports;Ia=1,pn.exports=function(i){return e(t(i),i)},pn.exports.array=e;function e(i,a){var s=i.length,o=new Array(s),l={},f=s,d=r(a),p=n(i);for(a.forEach(function(x){if(!p.has(x[0])||!p.has(x[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});f--;)l[f]||m(i[f],f,new Set);return o;function m(x,h,c){if(c.has(x)){var b;try{b=", node was:"+JSON.stringify(x)}catch{b=""}throw new Error("Cyclic dependency"+b)}if(!p.has(x))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(x));if(!l[h]){l[h]=!0;var g=d.get(x)||new Set;if(g=Array.from(g),h=g.length){c.add(x);do{var O=g[--h];m(O,p.get(O),c)}while(h);c.delete(x)}o[--s]=x}}}function t(i){for(var a=new Set,s=0,o=i.length;s<o;s++){var l=i[s];a.add(l[0]),a.add(l[1])}return Array.from(a)}function r(i){for(var a=new Map,s=0,o=i.length;s<o;s++){var l=i[s];a.has(l[0])||a.set(l[0],new Set),a.has(l[1])||a.set(l[1],new Set),a.get(l[0]).add(l[1])}return a}function n(i){for(var a=new Map,s=0,o=i.length;s<o;s++)a.set(i[s],s);return a}return pn.exports}var Sc=wc();const Ec=Xi(Sc),kc=Object.prototype.toString,Oc=Error.prototype.toString,Tc=RegExp.prototype.toString,Cc=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",_c=/^Symbol\((.*)\)(.*)$/;function Ac(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Ma(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return Ac(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return Cc.call(e).replace(_c,"Symbol($1)");const n=kc.call(e).slice(8,-1);return n==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):n==="Error"||e instanceof Error?"["+Oc.call(e)+"]":n==="RegExp"?Tc.call(e):null}function Vt(e,t){let r=Ma(e,t);return r!==null?r:JSON.stringify(e,function(n,i){let a=Ma(this[n],t);return a!==null?a:i},2)}function go(e){return e==null?[]:[].concat(e)}let vo,xo,bo,Fc=/\$\{\s*(\w+)\s*\}/g;vo=Symbol.toStringTag;class za{constructor(t,r,n,i){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[vo]="Error",this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],go(t).forEach(a=>{if(He.isError(a)){this.errors.push(...a.errors);const s=a.inner.length?a.inner:[a];this.inner.push(...s)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}xo=Symbol.hasInstance;bo=Symbol.toStringTag;class He extends Error{static formatError(t,r){const n=r.label||r.path||"this";return r=Object.assign({},r,{path:n,originalPath:r.path}),typeof t=="string"?t.replace(Fc,(i,a)=>Vt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,n,i,a){const s=new za(t,r,n,i);if(a)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[bo]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,He)}static[xo](t){return za[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let dt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const i=n!=null&&n!==r?` (cast from the value \`${Vt(n,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${Vt(r,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${Vt(r,!0)}\``+i}},Be={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Ct={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ji={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},$i={isValue:"${path} field must be ${value}"},Sn={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},jc={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},$c={notType:e=>{const{path:t,value:r,spec:n}=e,i=n.types.length;if(Array.isArray(r)){if(r.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${r.length} for value: \`${Vt(r,!0)}\``;if(r.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${r.length} for value: \`${Vt(r,!0)}\``}return He.formatError(dt.notType,e)}};Object.assign(Object.create(null),{mixed:dt,string:Be,number:Ct,date:ji,object:Sn,array:jc,boolean:$i,tuple:$c});const ea=e=>e&&e.__isYupSchema__;class jn{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:a}=r,s=typeof n=="function"?n:(...o)=>o.every(l=>l===n);return new jn(t,(o,l)=>{var f;let d=s(...o)?i:a;return(f=d==null?void 0:d(l))!=null?f:l})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let n=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn(n,t,r);if(i===void 0||i===t)return t;if(!ea(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}}const fn={context:"$",value:"."};class or{constructor(t,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===fn.context,this.isValue=this.key[0]===fn.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?fn.context:this.isValue?fn.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&ir.getter(this.path,!0),this.map=r.map}getValue(t,r,n){let i=this.isContext?n:this.isValue?t:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}or.prototype.__isYupRef=!0;const ot=e=>e==null;function pr(e){function t({value:r,path:n="",options:i,originalValue:a,schema:s},o,l){const{name:f,test:d,params:p,message:m,skipAbsent:x}=e;let{parent:h,context:c,abortEarly:b=s.spec.abortEarly,disableStackTrace:g=s.spec.disableStackTrace}=i;function O(F){return or.isRef(F)?F.getValue(r,h,c):F}function A(F={}){const $=Object.assign({value:r,originalValue:a,label:s.spec.label,path:F.path||n,spec:s.spec,disableStackTrace:F.disableStackTrace||g},p,F.params);for(const z of Object.keys($))$[z]=O($[z]);const V=new He(He.formatError(F.message||m,$),r,$.path,F.type||f,$.disableStackTrace);return V.params=$,V}const C=b?o:l;let w={path:n,parent:h,type:f,from:i.from,createError:A,resolve:O,options:i,originalValue:a,schema:s};const L=F=>{He.isError(F)?C(F):F?l(null):C(A())},K=F=>{He.isError(F)?C(F):o(F)};if(x&&ot(r))return L(!0);let Q;try{var u;if(Q=d.call(w,r,w),typeof((u=Q)==null?void 0:u.then)=="function"){if(i.sync)throw new Error(`Validation test of type: "${w.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(Q).then(L,K)}}catch(F){K(F);return}L(Q)}return t.OPTIONS=e,t}function Dc(e,t,r,n=r){let i,a,s;return t?(ir.forEach(t,(o,l,f)=>{let d=l?o.slice(1,o.length-1):o;e=e.resolve({context:n,parent:i,value:r});let p=e.type==="tuple",m=f?parseInt(d,10):0;if(e.innerType||p){if(p&&!f)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(r&&m>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${o}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[m],e=p?e.spec.types[m]:e.innerType}if(!f){if(!e.fields||!e.fields[d])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${s} which is a type: "${e.type}")`);i=r,r=r&&r[d],e=e.fields[d]}a=d,s=l?"["+o+"]":"."+o}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}class $n extends Set{describe(){const t=[];for(const r of this.values())t.push(or.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const n of this.values())r.push(t(n));return r}clone(){return new $n(this.values())}merge(t,r){const n=this.clone();return t.forEach(i=>n.add(i)),r.forEach(i=>n.delete(i)),n}}function vr(e,t=new Map){if(ea(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n<e.length;n++)r[n]=vr(e[n],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,i]of e.entries())r.set(n,vr(i,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e)r.add(vr(n,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[n,i]of Object.entries(e))r[n]=vr(i,t)}else throw Error(`Unable to clone ${e}`);return r}class Ye{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new $n,this._blacklist=new $n,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(dt.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=vr(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let n=t(this);return this._mutate=r,n}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,n=t.clone();const i=Object.assign({},r.spec,n.spec);return n.spec=i,n.internalTests=Object.assign({},r.internalTests,n.internalTests),n._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),n._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(a=>{t.tests.forEach(s=>{a.test(s.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,a)=>a.resolve(i,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,n,i,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(n=t.abortEarly)!=null?n:this.spec.abortEarly,recursive:(i=t.recursive)!=null?i:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let n=this.resolve(Object.assign({value:t},r)),i=r.assert==="ignore-optionality",a=n._cast(t,r);if(r.assert!==!1&&!n.isType(a)){if(i&&ot(a))return a;let s=Vt(t),o=Vt(a);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
2
2
|
|
|
3
3
|
attempted value: ${s}
|
|
4
4
|
`+(o!==s?`result of cast: ${o}`:""))}return a}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((i,a)=>a.call(this,i,t,this),t);return n===void 0&&(n=this.getDefault(r)),n}_validate(t,r={},n,i){let{path:a,originalValue:s=t,strict:o=this.spec.strict}=r,l=t;o||(l=this._cast(l,Object.assign({assert:!1},r)));let f=[];for(let d of Object.values(this.internalTests))d&&f.push(d);this.runTests({path:a,value:l,originalValue:s,options:r,tests:f},n,d=>{if(d.length)return i(d,l);this.runTests({path:a,value:l,originalValue:s,options:r,tests:this.tests},n,i)})}runTests(t,r,n){let i=!1,{tests:a,value:s,originalValue:o,path:l,options:f}=t,d=c=>{i||(i=!0,r(c,s))},p=c=>{i||(i=!0,n(c,s))},m=a.length,x=[];if(!m)return p([]);let h={value:s,originalValue:o,path:l,options:f,schema:this};for(let c=0;c<a.length;c++){const b=a[c];b(h,d,function(O){O&&(Array.isArray(O)?x.push(...O):x.push(O)),--m<=0&&p(x)})}}asNestedTest({key:t,index:r,parent:n,parentPath:i,originalParent:a,options:s}){const o=t??r;if(o==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof o=="number";let f=n[o];const d=Object.assign({},s,{strict:!0,parent:n,value:f,originalValue:a[o],key:void 0,[l?"index":"key"]:o,path:l||o.includes(".")?`${i||""}[${l?o:`"${o}"`}]`:(i?`${i}.`:"")+t});return(p,m,x)=>this.resolve(d)._validate(f,d,m,x)}validate(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return new Promise((s,o)=>i._validate(t,r,(l,f)=>{He.isError(l)&&(l.value=f),o(l)},(l,f)=>{l.length?o(new He(l,f,void 0,void 0,a)):s(f)}))}validateSync(t,r){var n;let i=this.resolve(Object.assign({},r,{value:t})),a,s=(n=r==null?void 0:r.disableStackTrace)!=null?n:i.spec.disableStackTrace;return i._validate(t,Object.assign({},r,{sync:!0}),(o,l)=>{throw He.isError(o)&&(o.value=l),o},(o,l)=>{if(o.length)throw new He(o,t,void 0,void 0,s);a=l}),a}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(He.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(He.isError(n))return!1;throw n}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):vr(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const n=this.clone({nullable:t});return n.internalTests.nullable=pr({message:r,name:"nullable",test(i){return i===null?this.schema.spec.nullable:!0}}),n}optionality(t,r){const n=this.clone({optional:t});return n.internalTests.optionality=pr({message:r,name:"optionality",test(i){return i===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(t=dt.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=dt.notNull){return this.nullability(!1,t)}required(t=dt.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=dt.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),i=pr(r),a=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(s=>!(s.OPTIONS.name===r.name&&(a||s.OPTIONS.test===i.OPTIONS.test))),n.tests.push(i),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),i=go(t).map(a=>new or(a));return i.forEach(a=>{a.isSibling&&n.deps.push(a.key)}),n.conditions.push(typeof r=="function"?new jn(i,r):jn.fromOptions(i,r)),n}typeError(t){let r=this.clone();return r.internalTests.typeError=pr({message:t,name:"typeError",skipAbsent:!0,test(n){return this.schema._typeCheck(n)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=dt.oneOf){let n=this.clone();return t.forEach(i=>{n._whitelist.add(i),n._blacklist.delete(i)}),n.internalTests.whiteList=pr({message:r,name:"oneOf",skipAbsent:!0,test(i){let a=this.schema._whitelist,s=a.resolveAll(this.resolve);return s.includes(i)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:s}})}}),n}notOneOf(t,r=dt.notOneOf){let n=this.clone();return t.forEach(i=>{n._blacklist.add(i),n._whitelist.delete(i)}),n.internalTests.blacklist=pr({message:r,name:"notOneOf",test(i){let a=this.schema._blacklist,s=a.resolveAll(this.resolve);return s.includes(i)?this.createError({params:{values:Array.from(a).join(", "),resolved:s}}):!0}}),n}strip(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:n,meta:i,optional:a,nullable:s}=r.spec;return{meta:i,label:n,optional:a,nullable:s,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,f,d)=>d.findIndex(p=>p.name===l.name)===f)}}}Ye.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])Ye.prototype[`${e}At`]=function(t,r,n={}){const{parent:i,parentPath:a,schema:s}=Dc(this,t,r,n.context);return s[e](i&&i[a],Object.assign({},n,{parent:i,path:t}))};for(const e of["equals","is"])Ye.prototype[e]=Ye.prototype.oneOf;for(const e of["not","nope"])Ye.prototype[e]=Ye.prototype.notOneOf;const Rc=()=>!0;function wo(e){return new So(e)}class So extends Ye{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:Rc},t))}}wo.prototype=So.prototype;function Eo(){return new ko}class ko extends Ye{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(n.spec.coerce&&!n.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=$i.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return ot(r)||r===!0}})}isFalse(t=$i.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return ot(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}Eo.prototype=ko.prototype;const Pc=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Ic(e){const t=Di(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function Di(e){var t,r;const n=Pc.exec(e);return n?{year:gt(n[1]),month:gt(n[2],1)-1,day:gt(n[3],1),hour:gt(n[4]),minute:gt(n[5]),second:gt(n[6]),millisecond:n[7]?gt(n[7].substring(0,3)):0,precision:(t=(r=n[7])==null?void 0:r.length)!=null?t:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:gt(n[10]),minuteOffset:gt(n[11])}:null}function gt(e,t=0){return Number(e)||t}let Mc=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,zc=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Vc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Nc="^\\d{4}-\\d{2}-\\d{2}",Lc="\\d{2}:\\d{2}:\\d{2}",Bc="(([+-]\\d{2}(:?\\d{2})?)|Z)",qc=new RegExp(`${Nc}T${Lc}(\\.\\d+)?${Bc}$`),Uc=e=>ot(e)||e===e.trim(),Wc={}.toString();function Lr(){return new Oo}class Oo extends Ye{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce||n.isType(t)||Array.isArray(t))return t;const i=t!=null&&t.toString?t.toString():t;return i===Wc?t:i})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||dt.required,name:"required",skipAbsent:!0,test:n=>!!n.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=Be.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(n){return n.length===this.resolve(t)}})}min(t,r=Be.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n.length>=this.resolve(t)}})}max(t,r=Be.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(n){return n.length<=this.resolve(t)}})}matches(t,r){let n=!1,i,a;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:i,name:a}=r:i=r),this.test({name:a||"matches",message:i||Be.matches,params:{regex:t},skipAbsent:!0,test:s=>s===""&&n||s.search(t)!==-1})}email(t=Be.email){return this.matches(Mc,{name:"email",message:t,excludeEmptyString:!0})}url(t=Be.url){return this.matches(zc,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=Be.uuid){return this.matches(Vc,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",n,i;return t&&(typeof t=="object"?{message:r="",allowOffset:n=!1,precision:i=void 0}=t:r=t),this.matches(qc,{name:"datetime",message:r||Be.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||Be.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:a=>{if(!a||n)return!0;const s=Di(a);return s?!!s.z:!1}}).test({name:"datetime_precision",message:r||Be.datetime_precision,params:{precision:i},skipAbsent:!0,test:a=>{if(!a||i==null)return!0;const s=Di(a);return s?s.precision===i:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=Be.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:Uc})}lowercase(t=Be.lowercase){return this.transform(r=>ot(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ot(r)||r===r.toLowerCase()})}uppercase(t=Be.uppercase){return this.transform(r=>ot(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>ot(r)||r===r.toUpperCase()})}}Lr.prototype=Oo.prototype;let Hc=e=>e!=+e;function To(){return new Co}class Co extends Ye{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!Hc(t)}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce)return t;let i=t;if(typeof i=="string"){if(i=i.replace(/\s/g,""),i==="")return NaN;i=+i}return n.isType(i)||i===null?i:parseFloat(i)})})}min(t,r=Ct.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(t)}})}max(t,r=Ct.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(t)}})}lessThan(t,r=Ct.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(n){return n<this.resolve(t)}})}moreThan(t,r=Ct.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(n){return n>this.resolve(t)}})}positive(t=Ct.positive){return this.moreThan(0,t)}negative(t=Ct.negative){return this.lessThan(0,t)}integer(t=Ct.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>ot(t)?t:t|0)}round(t){var r;let n=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(n.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(i=>ot(i)?i:Math[t](i))}}To.prototype=Co.prototype;let _o=new Date(""),Kc=e=>Object.prototype.toString.call(e)==="[object Date]";function ta(){return new nn}class nn extends Ye{constructor(){super({type:"date",check(t){return Kc(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,n)=>!n.spec.coerce||n.isType(t)||t===null?t:(t=Ic(t),isNaN(t)?nn.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let n;if(or.isRef(t))n=t;else{let i=this.cast(t);if(!this._typeCheck(i))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(t,r=ji.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(i){return i>=this.resolve(n)}})}max(t,r=ji.max){let n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(i){return i<=this.resolve(n)}})}}nn.INVALID_DATE=_o;ta.prototype=nn.prototype;ta.INVALID_DATE=_o;function Qc(e,t=[]){let r=[],n=new Set,i=new Set(t.map(([s,o])=>`${s}-${o}`));function a(s,o){let l=ir.split(s)[0];n.add(l),i.has(`${o}-${l}`)||r.push([o,l])}for(const s of Object.keys(e)){let o=e[s];n.add(s),or.isRef(o)&&o.isSibling?a(o.path,s):ea(o)&&"deps"in o&&o.deps.forEach(l=>a(l,s))}return Ec.array(Array.from(n),r).reverse()}function Va(e,t){let r=1/0;return e.some((n,i)=>{var a;if((a=t.path)!=null&&a.includes(n))return r=i,!0}),r}function Ao(e){return(t,r)=>Va(e,t)-Va(e,r)}const Gc=(e,t,r)=>{if(typeof e!="string")return e;let n=e;try{n=JSON.parse(e)}catch{}return r.isType(n)?n:e};function En(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=En(n);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=En(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(En)}):"optional"in e?e.optional():e}const Yc=(e,t)=>{const r=[...ir.normalizePath(t)];if(r.length===1)return r[0]in e;let n=r.pop(),i=ir.getter(ir.join(r),!0)(e);return!!(i&&n in i)};let Na=e=>Object.prototype.toString.call(e)==="[object Object]";function La(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}const Zc=Ao([]);function Fo(e){return new jo(e)}class jo extends Ye{constructor(t){super({type:"object",check(r){return Na(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=Zc,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var n;let i=super._cast(t,r);if(i===void 0)return this.getDefault(r);if(!this._typeCheck(i))return i;let a=this.fields,s=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(i).filter(p=>!this._nodes.includes(p))),l={},f=Object.assign({},r,{parent:l,__validating:r.__validating||!1}),d=!1;for(const p of o){let m=a[p],x=p in i;if(m){let h,c=i[p];f.path=(r.path?`${r.path}.`:"")+p,m=m.resolve({value:c,context:r.context,parent:l});let b=m instanceof Ye?m.spec:void 0,g=b==null?void 0:b.strict;if(b!=null&&b.strip){d=d||p in i;continue}h=!r.__validating||!g?m.cast(i[p],f):i[p],h!==void 0&&(l[p]=h)}else x&&!s&&(l[p]=i[p]);(x!==p in l||l[p]!==i[p])&&(d=!0)}return d?l:i}_validate(t,r={},n,i){let{from:a=[],originalValue:s=t,recursive:o=this.spec.recursive}=r;r.from=[{schema:this,value:s},...a],r.__validating=!0,r.originalValue=s,super._validate(t,r,n,(l,f)=>{if(!o||!Na(f)){i(l,f);return}s=s||f;let d=[];for(let p of this._nodes){let m=this.fields[p];!m||or.isRef(m)||d.push(m.asNestedTest({options:r,key:p,parent:f,parentPath:r.path,originalParent:s}))}this.runTests({tests:d,value:f,originalValue:s,options:r},n,p=>{i(p.sort(this._sortErrors).concat(l),f)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),n=r.fields;for(let[i,a]of Object.entries(this.fields)){const s=n[i];n[i]=s===void 0?a:s}return r.withMutation(i=>i.setFields(n,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(n=>{var i;const a=this.fields[n];let s=t;(i=s)!=null&&i.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[n]})),r[n]=a&&"getDefault"in a?a.getDefault(s):void 0}),r}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=Qc(t,r),n._sortErrors=Ao(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(t,r=[]){return this.clone().withMutation(n=>{let i=n._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),i=[...n._excludedEdges,...r]),n.setFields(Object.assign(n.fields,t),i)})}partial(){const t={};for(const[r,n]of Object.entries(this.fields))t[r]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(t)}deepPartial(){return En(this)}pick(t){const r={};for(const n of t)this.fields[n]&&(r[n]=this.fields[n]);return this.setFields(r,this._excludedEdges.filter(([n,i])=>t.includes(n)&&t.includes(i)))}omit(t){const r=[];for(const n of Object.keys(this.fields))t.includes(n)||r.push(n);return this.pick(r)}from(t,r,n){let i=ir.getter(t,!0);return this.transform(a=>{if(!a)return a;let s=a;return Yc(a,t)&&(s=Object.assign({},a),n||delete s[t],s[r]=i(a)),s})}json(){return this.transform(Gc)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Sn.exact,test(r){if(r==null)return!0;const n=La(this.schema,r);return n.length===0||this.createError({params:{properties:n.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=Sn.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(i){if(i==null)return!0;const a=La(this.schema,i);return!t||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=Sn.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const n={};for(const i of Object.keys(r))n[t(i)]=r[i];return n})}camelCase(){return this.transformKeys(ni.camelCase)}snakeCase(){return this.transformKeys(ni.snakeCase)}constantCase(){return this.transformKeys(t=>ni.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);n.fields={};for(const[a,s]of Object.entries(r.fields)){var i;let o=t;(i=o)!=null&&i.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[a]})),n.fields[a]=s.describe(o)}return n}}Fo.prototype=jo.prototype;const $o=e=>{const t={};return e.forEach(r=>{var a,s,o;let n;switch(r.type){case"text":case"textarea":case"tel":n=Lr(),r.validation?n=Wt(n,r,"string"):(r.minLength&&(n=n.min(r.minLength,`${r.label} must be at least ${r.minLength} characters`)),r.maxLength&&(n=n.max(r.maxLength,`${r.label} must be at most ${r.maxLength} characters`)),r.pattern&&(n=n.test("pattern",`${r.label} format is invalid`,l=>l?new RegExp(r.pattern).test(l):!0)));break;case"email":n=Lr().email(((a=r.validation)==null?void 0:a.message)||`${r.label} must be a valid email address`),r.validation&&(n=Wt(n,r,"string"));break;case"password":n=Lr(),r.validation?n=Wt(n,r,"string"):(r.minLength&&(n=n.min(r.minLength,`${r.label} must be at least ${r.minLength} characters`)),r.maxLength&&(n=n.max(r.maxLength,`${r.label} must be at most ${r.maxLength} characters`)),r.pattern&&(n=n.test("pattern",`${r.label} format is invalid`,l=>l?new RegExp(r.pattern).test(l):!0)));break;case"number":n=To().typeError(`${r.label} must be a number`),r.validation?n=Wt(n,r,"number"):(r.min!==void 0&&(n=n.min(r.min,`${r.label} must be at least ${r.min}`)),r.max!==void 0&&(n=n.max(r.max,`${r.label} must be at most ${r.max}`)));break;case"select":n=Lr(),r.validation&&(n=Wt(n,r,"string"));break;case"checkbox":n=Eo(),r.validation&&(n=Wt(n,r,"boolean"));break;case"date":n=ta().typeError(`${r.label} must be a valid date`),r.validation?n=Wt(n,r,"date"):(r.minDate&&(n=n.min(new Date(r.minDate),`${r.label} must be after ${r.minDate}`)),r.maxDate&&(n=n.max(new Date(r.maxDate),`${r.label} must be before ${r.maxDate}`)));break;default:n=wo()}if(((s=r.validation)==null?void 0:s.required)!==void 0?r.validation.required:r.required){const l=((o=r.validation)==null?void 0:o.message)||`${r.label} is required`;n=n.required(l)}t[r.name]=n}),Fo().shape(t)},Wt=(e,t,r)=>{const n=t.validation;if(!n)return e;if(r==="string"){if(n.minLength!==void 0){const i=n.message||`${t.label} must be at least ${n.minLength} characters`;e=e.min(n.minLength,i)}if(n.maxLength!==void 0){const i=n.message||`${t.label} must be at most ${n.maxLength} characters`;e=e.max(n.maxLength,i)}}if(r==="number"){if(n.min!==void 0){const i=n.message||`${t.label} must be at least ${n.min}`;e=e.min(n.min,i)}if(n.max!==void 0){const i=n.message||`${t.label} must be at most ${n.max}`;e=e.max(n.max,i)}}if(n.pattern){const i=typeof n.pattern=="string"?new RegExp(n.pattern):n.pattern,a=n.message||`${t.label} format is invalid`;e=e.test("pattern",a,s=>s?i.test(s):!0)}return n.custom&&(e=e.test("custom",n.message||`${t.label} is invalid`,i=>{const a=n.custom(i);return typeof a=="boolean"?a:!1})),e};function Nt(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}const Jc="$$material";function Xc(e){for(var t=0,r,n=0,i=e.length;i>=4;++n,i-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var eu={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function tu(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var ru=/[A-Z]|^ms/g,nu=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Do=function(t){return t.charCodeAt(1)===45},Ba=function(t){return t!=null&&typeof t!="boolean"},ii=tu(function(e){return Do(e)?e:e.replace(ru,"-$&").toLowerCase()}),qa=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(nu,function(n,i,a){return Mt={name:i,styles:a,next:Mt},i})}return eu[t]!==1&&!Do(t)&&typeof r=="number"&&r!==0?r+"px":r};function Dn(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return Mt={name:i.name,styles:i.styles,next:Mt},i.name;var a=r;if(a.styles!==void 0){var s=a.next;if(s!==void 0)for(;s!==void 0;)Mt={name:s.name,styles:s.styles,next:Mt},s=s.next;var o=a.styles+";";return o}return iu(e,t,r)}}var l=r;return l}function iu(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Dn(e,t,r[i])+";";else for(var a in r){var s=r[a];if(typeof s!="object"){var o=s;Ba(o)&&(n+=ii(a)+":"+qa(a,o)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&t==null)for(var l=0;l<s.length;l++)Ba(s[l])&&(n+=ii(a)+":"+qa(a,s[l])+";");else{var f=Dn(e,t,s);switch(a){case"animation":case"animationName":{n+=ii(a)+":"+f+";";break}default:n+=a+"{"+f+"}"}}}return n}var Ua=/label:\s*([^\s;{]+)\s*(;|$)/g,Mt;function au(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,i="";Mt=void 0;var a=e[0];if(a==null||a.raw===void 0)n=!1,i+=Dn(r,t,a);else{var s=a;i+=s[0]}for(var o=1;o<e.length;o++)if(i+=Dn(r,t,e[o]),n){var l=a;i+=l[o]}Ua.lastIndex=0;for(var f="",d;(d=Ua.exec(i))!==null;)f+="-"+d[1];var p=Xc(i)+f;return{name:p,styles:i,next:Mt}}var mn={exports:{}},hn={exports:{}},ye={};/** @license React v16.13.1
|