1import{a as ee,i as G,b as _,m as te}from"./axios-DjWHqwoD.js";import{m as q,d as re,s as ne,g as B,i as se}from"./lodash-es-DY0-vtN4.js";let A=ee.create(),I=(e,t)=>`${e.method}:${e.baseURL??t.defaults.baseURL??""}${e.url}`,J=e=>e.status===204&&e.headers["precognition-success"]==="true";const T={},b={get:(e,t={},n={})=>w(C("get",e,t,n)),post:(e,t={},n={})=>w(C("post",e,t,n)),patch:(e,t={},n={})=>w(C("patch",e,t,n)),put:(e,t={},n={})=>w(C("put",e,t,n)),delete:(e,t={},n={})=>w(C("delete",e,t,n)),use(e){return A=e,b},axios(){return A},fingerprintRequestsUsing(e){return I=e===null?()=>null:e,b},determineSuccessUsing(e){return J=e,b}},C=(e,t,n,i)=>({url:t,method:e,...i,...["get","delete"].includes(e)?{params:q({},n,i==null?void 0:i.params)}:{data:q({},n,i==null?void 0:i.data)}}),w=(e={})=>{const t=[oe,le,ae].reduce((n,i)=>i(n),e);return(t.onBefore??(()=>!0))()===!1?Promise.resolve(null):((t.onStart??(()=>null))(),A.request(t).then(async n=>{t.precognitive&&W(n);const i=n.status;let a=n;return t.precognitive&&t.onPrecognitionSuccess&&J(a)&&(a=await Promise.resolve(t.onPrecognitionSuccess(a)??a)),t.onSuccess&&ie(i)&&(a=await Promise.resolve(t.onSuccess(a)??a)),(k(t,i)??(u=>u))(a)??a},n=>ue(n)?Promise.reject(n):(t.precognitive&&W(n.response),(k(t,n.response.status)??((a,f)=>Promise.reject(f)))(n.response,n))).finally(t.onFinish??(()=>null)))},oe=e=>{const t=e.only??e.validate;return{...e,timeout:e.timeout??A.defaults.timeout??3e4,precognitive:e.precognitive!==!1,fingerprint:typeof e.fingerprint>"u"?I(e,A):e.fingerprint,headers:{...e.headers,"Content-Type":ce(e),...e.precognitive!==!1?{Precognition:!0}:{},...t?{"Precognition-Validate-Only":Array.from(t).join()}:{}}}},ie=e=>e>=200&&e<300,le=e=>{var t;return typeof e.fingerprint!="string"||((t=T[e.fingerprint])==null||t.abort(),delete T[e.fingerprint]),e},ae=e=>typeof e.fingerprint!="string"||e.signal||e.cancelToken||!e.precognitive?e:(T[e.fingerprint]=new AbortController,{...e,signal:T[e.fingerprint].signal}),W=e=>{var t;if(((t=e.headers)==null?void 0:t.precognition)!=="true")throw Error("Did not receive a Precognition response. Ensure you have the Precognition middleware in place for the route.")},ue=e=>{var t;return!G(e)||typeof((t=e.response)==null?void 0:t.status)!="number"||_(e)},k=(e,t)=>({401:e.onUnauthorized,403:e.onForbidden,404:e.onNotFound,409:e.onConflict,422:e.onValidationError,423:e.onLocked})[t],ce=e=>{var t,n,i;return((t=e.headers)==null?void 0:t["Content-Type"])??((n=e.headers)==null?void 0:n["Content-type"])??((i=e.headers)==null?void 0:i["content-type"])??(K(e.data)?"multipart/form-data":"application/json")},K=e=>H(e)||typeof e=="object"&&e!==null&&Object.values(e).some(t=>K(t)),H=e=>typeof File<"u"&&e instanceof File||e instanceof Blob||typeof FileList<"u"&&e instanceof FileList&&e.length>0,de=(e,t)=>{if(!e.includes("*"))return[e];const n=e.split(".");let i=[""];for(const a of n)if(a==="*"){const f=[];for(const u of i){const p=u?B(t,u):t;if(Array.isArray(p))for(let y=0;y<p.length;y++)f.push(u?`${u}.${y}`:String(y));else if(p!==null&&typeof p=="object")for(const y of Object.keys(p))f.push(u?`${u}.${y}`:y)}i=f}else i=i.map(f=>f?`${f}.${a}`:a);return i},fe=(e,t)=>t.includes("*")?new RegExp("^"+t.replace(/\./g,"\\.").replace(/\*/g,"[^.]+")+"$").test(e):e===t,z=(e,t)=>Object.fromEntries(Object.entries(e).filter(([n])=>!t.some(i=>fe(n,i)))),ve=(e,t={})=>{const n={errorsChanged:[],touchedChanged:[],validatingChanged:[],validatedChanged:[]};let i=!1,a=!1;const f=r=>r!==a?(a=r,n.validatingChanged):[];let u=[];const p=r=>{const s=[...new Set(r)];return u.length!==s.length||!s.every(o=>u.includes(o))?(u=s,n.validatedChanged):[]},y=()=>u.filter(r=>typeof E[r]>"u");let d=[];const m=r=>{const s=[...new Set(r)];return d.length!==s.length||!s.every(o=>d.includes(o))?(d=s,n.touchedChanged):[]};let E={};const V=r=>{const s=he(r);return se(E,s)?[]:(E=s,n.errorsChanged)},Q=r=>{const s={...E};return delete s[R(r)],V(s)},X=()=>Object.keys(E).length>0;let L=1500;const Y=r=>{L=r,x.cancel(),x=U()};let S=t,O=null,N=[],$=null;const U=()=>re(r=>{e({get:(s,o={},l={})=>b.get(s,j(o),P(l,r,o)),post:(s,o={},l={})=>b.post(s,j(o),P(l,r,o)),patch:(s,o={},l={})=>b.patch(s,j(o),P(l,r,o)),put:(s,o={},l={})=>b.put(s,j(o),P(l,r,o)),delete:(s,o={},l={})=>b.delete(s,j(o),P(l,r,o))}).catch(s=>{var o;return _(s)||G(s)&&((o=s.response)==null?void 0:o.status)===422?null:Promise.reject(s)})},L,{leading:!0,trailing:!0});let x=U();const P=(r,s,o={})=>{const l={...r,...s},g=Array.from(l.only??l.validate??d);return{...s,...te(r,s),only:g,timeout:l.timeout??5e3,onValidationError:(c,v)=>([...p([...u,...g]),...V(q(z({...E}
1,g),c.data.errors))].forEach(M=>M()),l.onValidationError?l.onValidationError(c,v):Promise.reject(v)),onSuccess:c=>(p([...u,...g]).forEach(v=>v()),l.onSuccess?l.onSuccess(c):c),onPrecognitionSuccess:c=>([...p([...u,...g]),...V(z({...E},g))].forEach(v=>v()),l.onPrecognitionSuccess?l.onPrecognitionSuccess(c):c),onBefore:()=>{const c=d.some(F=>F.includes("*")),v=c?[...new Set(d.flatMap(F=>de(F,o)))]:d;return l.onBeforeValidation&&l.onBeforeValidation({data:o,touched:v},{data:S,touched:N})===!1||(l.onBefore||(()=>!0))()===!1?!1:(c&&m(v).forEach(F=>F()),$=d,O=o,!0)},onStart:()=>{f(!0).forEach(c=>c()),(l.onStart??(()=>null))()},onFinish:()=>{f(!1).forEach(c=>c()),N=$,S=O,$=O=null,(l.onFinish??(()=>null))()}}},Z=(r,s,o)=>{if(typeof r>"u"){const l=Array.from((o==null?void 0:o.only)??(o==null?void 0:o.validate)??[]);m([...d,...l]).forEach(g=>g()),x(o??{});return}if(H(s)&&!i){console.warn('Precognition file validation is not active. Call the "validateFiles" function on your form to enable it.');return}r=R(r),(r.includes("*")||B(S,r)!==s)&&(m([r,...d]).forEach(l=>l()),x(o??{}))},j=r=>i===!1?D(r):r,h={touched:()=>d,validate(r,s,o){return typeof r=="object"&&!("target"in r)&&(o=r,r=s=void 0),Z(r,s,o),h},touch(r){const s=Array.isArray(r)?r:[R(r)];return m([...d,...s]).forEach(o=>o()),h},validating:()=>a,valid:y,errors:()=>E,hasErrors:X,setErrors(r){return V(r).forEach(s=>s()),h},forgetError(r){return Q(r).forEach(s=>s()),h},defaults(r){return t=r,S=r,h}
1,reset(...r){if(r.length===0)m([]).forEach(s=>s());else{const s=[...d];r.forEach(o=>{s.includes(o)&&s.splice(s.indexOf(o),1),ne(S,o,B(t,o))}),m(s).forEach(o=>o())}return h},setTimeout(r){return Y(r),h},on(r,s){return n[r].push(s),h},validateFiles(){return i=!0,h},withoutFileValidation(){return i=!1,h}};return h},Ee=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:Array.isArray(e[n])?e[n][0]:e[n]}),{}),he=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:typeof e[n]=="string"?[e[n]]:e[n]}),{}),R=e=>typeof e!="string"?e.target.name:e,D=e=>{const t={...e};return Object.keys(t).forEach(n=>{const i=t[n];if(i!==null){if(H(i)){delete t[n];return}if(Array.isArray(i)){t[n]=Object.values(D({...i}));return}if(typeof i=="object"){t[n]=D(t[n]);return}}}),t};export{ve as c,R as r,Ee as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.