import{n as Gm,r as ty,t as yn}from"./chunk-BqhQeaEc.js";function ny(l){return typeof l=="symbol"||l instanceof Symbol}var pm=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();function ly(l,i,{signal:s,edges:c}={}){let o,p=null;const h=c!=null&&c.includes("leading"),m=c==null||c.includes("trailing"),S=()=>{p!==null&&(l.apply(o,p),o=void 0,p=null)},v=()=>{m&&S(),q()};let g=null;const T=()=>{g!=null&&clearTimeout(g),g=setTimeout(()=>{g=null,v()},i)},O=()=>{g!==null&&(clearTimeout(g),g=null)},q=()=>{O(),o=void 0,p=null},j=()=>{S()},Q=function(...J){if(s?.aborted)return;o=this,p=J;const G=g==null;T(),h&&G&&S()};return Q.schedule=T,Q.cancel=q,Q.flush=j,s?.addEventListener("abort",q,{once:!0}),Q}function Vm(){}function eo(l){return l==null||typeof l!="object"&&typeof l!="function"}function to(l){return ArrayBuffer.isView(l)&&!(l instanceof DataView)}function ay(l){if(eo(l))return l;if(Array.isArray(l)||to(l)||l instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&l instanceof SharedArrayBuffer)return l.slice(0);const i=Object.getPrototypeOf(l);if(i==null)return Object.assign(Object.create(i),l);const s=i.constructor;if(l instanceof Date||l instanceof Map||l instanceof Set)return new s(l);if(l instanceof RegExp){const c=new s(l);return c.lastIndex=l.lastIndex,c}if(l instanceof DataView)return new s(l.buffer.slice(0));if(l instanceof Error){let c;return l instanceof AggregateError?c=new s(l.errors,l.message,{cause:l.cause}):c=new s(l.message,{cause:l.cause}),c.stack=l.stack,Object.assign(c,l),c}return typeof File<"u"&&l instanceof File?new s([l],l.name,{type:l.type,lastModified:l.lastModified}):typeof l=="object"?Object.assign(Object.create(i),l):l}function tu(l){return typeof pm.Buffer<"u"&&pm.Buffer.isBuffer(l)}function nu(l){return Object.getOwnPropertySymbols(l).filter(i=>Object.prototype.propertyIsEnumerable.call(l,i))}function wi(l){return l==null?l===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(l)}var Zm="[object RegExp]",no="[object String]",lo="[object Number]",ao="[object Boolean]",Km="[object Arguments]",Pm="[object Symbol]",Jm="[object Date]",Fm="[object Map]",$m="[object Set]",km="[object Array]",iy="[object Function]",Wm="[object ArrayBuffer]",Fr="[object Object]",ry="[object Error]",Im="[object DataView]",ep="[object Uint8Array]",tp="[object Uint8ClampedArray]",np="[object Uint16Array]",lp="[object Uint32Array]",uy="[object BigUint64Array]",ap="[object Int8Array]",ip="[object Int16Array]",rp="[object Int32Array]",sy="[object BigInt64Array]",up="[object Float32Array]",sp="[object Float64Array]";function cy(l,i){return Rl(l,void 0,l,new Map,i)}function Rl(l,i,s,c=new Map,o=void 0){const p=o?.(l,i,s,c);if(p!==void 0)return p;if(eo(l))return l;if(c.has(l))return c.get(l);if(Array.isArray(l)){const h=new Array(l.length);c.set(l,h);for(let m=0;mbi(T,q,void 0,l,i,s,c));if(O===-1)return!1;v.splice(O,1)}return!0}case km:case ep:case tp:case np:case lp:case uy:case ap:case ip:case rp:case sy:case up:case sp:if(tu(l)!==tu(i)||l.length!==i.length)return!1;for(let S=0;S=0}var hy={"&":"&","<":"<",">":">",'"':""","'":"'"};function my(l){return l.replace(/[&<>"']/g,i=>hy[i])}function py(l){return l!=null&&typeof l!="function"&&dy(l.length)}function io(l){if(l==null)return"";if(typeof l=="string")return l;if(Array.isArray(l))return l.map(io).join(",");const i=String(l);return i==="0"&&Object.is(Number(l),-0)?"-0":i}function ro(l){return typeof l=="string"||typeof l=="symbol"?l:Object.is(l?.valueOf?.(),-0)?"-0":String(l)}function uo(l){if(Array.isArray(l))return l.map(ro);if(typeof l=="symbol")return[l];l=io(l);const i=[],s=l.length;if(s===0)return i;let c=0,o="",p="",h=!1;for(l.charCodeAt(0)===46&&(i.push(""),c++);c{const h=i?.(s,c,o,p);if(h!==void 0)return h;if(typeof l=="object"){if(wi(l)==="[object Object]"&&typeof l.constructor!="function"){const m={};return p.set(l,m),sn(m,l,o,p),m}switch(Object.prototype.toString.call(l)){case lo:case no:case ao:{const m=new l.constructor(l?.valueOf());return sn(m,l),m}case Km:{const m={};return sn(m,l),m.length=l.length,m[Symbol.iterator]=l[Symbol.iterator],m}default:return}}})}function vm(l){return yy(l)}function Bc(l){return l!==null&&typeof l=="object"&&wi(l)==="[object Arguments]"}var vy=/^(?:0|[1-9]\d*)$/;function fp(l,i=Number.MAX_SAFE_INTEGER){switch(typeof l){case"number":return Number.isInteger(l)&&l>=0&&l{const c=l[i];(!(Object.hasOwn(l,i)&&cp(c,s))||s===void 0&&!(i in l))&&(l[i]=s)};function Oy(l,i,s,c){if(l==null&&!ym(l))return l;let o;Ay(i,l)?o=[i]:Array.isArray(i)?o=i:o=uo(i);const p=s(Ze(l,o));let h=l;for(let m=0;ms,()=>{})}function wy(l,i=0,s={}){typeof s!="object"&&(s={});const{leading:c=!1,trailing:o=!0,maxWait:p}=s,h=Array(2);c&&(h[0]="leading"),o&&(h[1]="trailing");let m,S=null;const v=ly(function(...O){m=l.apply(this,O),S=null},i,{edges:h}),g=function(...O){return p!=null&&(S===null&&(S=Date.now()),Date.now()-S>=p)?(m=l.apply(this,O),S=Date.now(),v.cancel(),v.schedule(),m):(v.apply(this,O),m)},T=()=>(v.flush(),m);return g.cancel=v.cancel,g.flush=T,g}function Rc(l){return to(l)}function My(l,...i){const s=i.slice(0,-1),c=i[i.length-1];let o=l;for(let p=0;ptypeof File<"u"&&l instanceof File||l instanceof Blob||typeof FileList<"u"&&l instanceof FileList&&l.length>0,du=l=>l instanceof FormData?!0:so(l)||typeof l=="object"&&l!==null&&Object.values(l).some(i=>du(i)),au=class extends Error{response;constructor(l){super(`HTTP error ${l.status}`),this.name="HttpResponseError",this.response=l}},dp=class extends Error{constructor(l="Request was cancelled"){super(l),this.name="HttpCancelledError"}},zy=class extends Error{constructor(l="Network error"){super(l),this.name="HttpNetworkError"}};function Dy(l){const i=new URLSearchParams;return Object.entries(l).forEach(([s,c])=>{c!=null&&(Array.isArray(c)?c.forEach(o=>i.append(`${s}[]`,String(o))):typeof c=="object"?i.append(s,JSON.stringify(c)):i.append(s,String(c)))}),i.toString()}function Ny(l,i,s){if(i&&!l.startsWith("http://")&&!l.startsWith("https://")&&(l=i.replace(/\/$/,"")+"/"+l.replace(/^\//,"")),s&&Object.keys(s).length>0){const c=Dy(s);c&&(l+=(l.includes("?")?"&":"?")+c)}return l}function Ry(){return typeof window>"u"?null:window.axios?.defaults?.headers?.common?.["X-Requested-With"]??null}function hp(l,i=new FormData,s=null){for(const c in l)Object.prototype.hasOwnProperty.call(l,c)&&mp(i,s?`${s}[${c}]`:c,l[c]);return i}function mp(l,i,s){if(Array.isArray(s))return s.forEach((c,o)=>mp(l,`${i}[${o}]`,c));if(s instanceof Date)return l.append(i,s.toISOString());if(typeof File<"u"&&s instanceof File)return l.append(i,s,s.name);if(s instanceof Blob)return l.append(i,s);if(typeof s=="boolean")return l.append(i,s?"1":"0");if(typeof s=="string")return l.append(i,s);if(typeof s=="number")return l.append(i,`${s}`);if(s==null)return l.append(i,"");hp(s,l,i)}function _y(l,i){if(l!=null)return l instanceof FormData?l:typeof l=="object"&&du(l)?hp(l):typeof l=="object"||i["Content-Type"]?.includes("application/json")?JSON.stringify(l):String(l)}function Uy(l){const i={};return l.forEach((s,c)=>{i[c.toLowerCase()]=s}),i}function Hy(l={}){let i=l.xsrfCookieName??"XSRF-TOKEN",s=l.xsrfHeaderName??"X-XSRF-TOKEN";function c(){if(typeof document>"u")return null;const o=document.cookie.match(new RegExp("(^|;\\s*)"+i+"=([^;]*)"));return o?decodeURIComponent(o[2]):null}return{setXsrfCookieName(o){i=o},setXsrfHeaderName(o){s=o},async request(o){const p=Ny(o.url,o.baseURL,o.params),h=o.method.toUpperCase(),m={},S=Ry();S&&(m["X-Requested-With"]=S),o.data!==void 0&&!["GET","DELETE"].includes(h)&&!(o.data instanceof FormData)&&!du(o.data)&&(m["Content-Type"]="application/json"),o.headers&&Object.entries(o.headers).forEach(([j,Q])=>{Q!==void 0&&(m[j]=String(Q))});const v=c();v&&!["GET","HEAD","OPTIONS"].includes(h)&&(m[s]=v);let g=o.signal,T;const O=o.timeout??3e4;if(O>0&&!g){const j=new AbortController;g=j.signal,T=setTimeout(()=>j.abort(),O)}const q=["GET","DELETE"].includes(h)?void 0:_y(o.data,m);q instanceof FormData&&delete m["Content-Type"];try{const j=await fetch(p,{method:h,headers:m,body:q,signal:g,credentials:o.credentials??"same-origin"});T&&clearTimeout(T);let Q;j.headers.get("content-type")?.includes("application/json")?Q=await j.json():Q=await j.text();const J={status:j.status,data:Q,headers:Uy(j.headers)};if(!j.ok)throw new au(J);return J}catch(j){throw T&&clearTimeout(T),j instanceof au?j:j instanceof DOMException&&j.name==="AbortError"?new dp:j instanceof TypeError?new zy(j.message):j}}}}var Xc=Hy(),co=Xc,oo=void 0,pp=void 0,gp="same-origin",yp=l=>`${l.method}:${l.baseURL??oo??""}${l.url}`,vp=l=>l.status===204&&l.headers["precognition-success"]==="true",iu={},St={get:(l,i={},s={})=>vi(yi("get",l,i,s)),post:(l,i={},s={})=>vi(yi("post",l,i,s)),patch:(l,i={},s={})=>vi(yi("patch",l,i,s)),put:(l,i={},s={})=>vi(yi("put",l,i,s)),delete:(l,i={},s={})=>vi(yi("delete",l,i,s)),useHttpClient(l){return co=l,St},withBaseURL(l){return oo=l,St},withTimeout(l){return pp=l,St},withCredentials(l){return gp=typeof l=="string"?l:l?"include":"omit",St},fingerprintRequestsUsing(l){return yp=l===null?()=>null:l,St},determineSuccessUsing(l){return vp=l,St},withXsrfCookieName(l){return Xc.setXsrfCookieName(l),St},withXsrfHeaderName(l){return Xc.setXsrfHeaderName(l),St}},yi=(l,i,s,c)=>({url:i,method:l,...c,...["get","delete"].includes(l)?{params:lu({},s,c?.params)}:{data:lu({},s,c?.data)}}),vi=(l={})=>{const i=[Cy,qy,jy].reduce((s,c)=>c(s),l);return(i.onBefore??(()=>!0))()===!1?Promise.resolve(null):((i.onStart??(()=>null))(),co.request({method:i.method,url:i.url,baseURL:i.baseURL??oo,data:i.data,params:i.params,headers:i.headers,signal:i.signal,timeout:i.timeout,credentials:gp}).then(async s=>{i.precognitive&&bm(s);const c=s.status;let o=s;return i.precognitive&&i.onPrecognitionSuccess&&vp(s)&&(o=await Promise.resolve(i.onPrecognitionSuccess(s)??o)),i.onSuccess&&xy(c)&&(o=await Promise.resolve(i.onSuccess(o)??o)),(Em(i,c)??(p=>p))(o)??o},s=>{if(By(s))return Promise.reject(s);const c=s;return i.precognitive&&bm(c.response),(Em(i,c.response.status)??((o,p)=>Promise.reject(p)))(c.response,c)}).finally(i.onFinish??(()=>null)))},Cy=l=>{const i=l.only??l.validate;return{...l,timeout:l.timeout??pp,precognitive:l.precognitive!==!1,fingerprint:typeof l.fingerprint>"u"?yp(l,co):l.fingerprint,headers:{...l.headers,Accept:"application/json","Content-Type":Ly(l),...l.precognitive!==!1?{Precognition:!0}:{},...i?{"Precognition-Validate-Only":Array.from(i).join()}:{}}}},xy=l=>l>=200&&l<300,qy=l=>(typeof l.fingerprint!="string"||(iu[l.fingerprint]?.abort(),delete iu[l.fingerprint]),l),jy=l=>typeof l.fingerprint!="string"||l.signal||!l.precognitive?l:(iu[l.fingerprint]=new AbortController,{...l,signal:iu[l.fingerprint].signal}),bm=l=>{if(l.headers?.precognition!=="true")throw Error("Did not receive a Precognition response. Ensure you have the Precognition middleware in place for the route.")},By=l=>!(l instanceof au)||typeof l.response?.status!="number",Em=(l,i)=>({401:l.onUnauthorized,403:l.onForbidden,404:l.onNotFound,409:l.onConflict,422:l.onValidationError,423:l.onLocked})[i],Ly=l=>l.headers?.["Content-Type"]??l.headers?.["Content-type"]??l.headers?.["content-type"]??(du(l.data)?"multipart/form-data":"application/json"),Yy=(l,i)=>{if(!l.includes("*"))return[l];const s=l.split(".");let c=[""];for(const o of s)if(o==="*"){const p=[];for(const h of c){const m=h?Ze(i,h):i;if(Array.isArray(m))for(let S=0;Sp?`${p}.${o}`:o);return c},Xy=(l,i)=>i.includes("*")?new RegExp("^"+i.replace(/\./g,"\\.").replace(/\*/g,"[^.]+")+"$").test(l):l===i,Am=(l,i)=>Object.fromEntries(Object.entries(l).filter(([s])=>!i.some(c=>Xy(s,c)))),Qy=(l,i={})=>{const s={errorsChanged:[],touchedChanged:[],validatingChanged:[],validatedChanged:[]};let c=!1,o=!1;const p=L=>L!==o?(o=L,s.validatingChanged):[];let h=[];const m=L=>{const X=[...new Set(L)];return h.length!==X.length||!X.every(F=>h.includes(F))?(h=X,s.validatedChanged):[]},S=()=>h.filter(L=>typeof T[L]>"u");let v=[];const g=L=>{const X=[...new Set(L)];return v.length!==X.length||!X.every(F=>v.includes(F))?(v=X,s.touchedChanged):[]};let T={};const O=L=>{const X=Vy(L);return gn(T,X)?[]:(T=X,s.errorsChanged)},q=L=>{const X={...T};return delete X[Ti(L)],O(X)},j=()=>Object.keys(T).length>0;let Q=1500;const J=L=>{Q=L,Z.cancel(),Z=oe()};let G=i,ne=null,se=[],P=null;const oe=()=>wy(L=>{l({get:(X,F={},ae={})=>St.get(X,ue(F),le(ae,L,F)),post:(X,F={},ae={})=>St.post(X,ue(F),le(ae,L,F)),patch:(X,F={},ae={})=>St.patch(X,ue(F),le(ae,L,F)),put:(X,F={},ae={})=>St.put(X,ue(F),le(ae,L,F)),delete:(X,F={},ae={})=>St.delete(X,ue(F),le(ae,L,F))}).catch(X=>X instanceof dp||X instanceof au&&X.response?.status===422?null:Promise.reject(X))},Q,{leading:!0,trailing:!0});let Z=oe();const le=(L,X,F={})=>{const ae={...L,...X},Ee=Array.from(ae.only??ae.validate??v);return{...X,...lu({},L,X),only:Ee,timeout:ae.timeout??5e3,onValidationError:(_,R)=>([...m([...h,...Ee]),...O(lu(Am({...T},Ee),_.data.errors))].forEach(B=>B()),ae.onValidationError?ae.onValidationError(_,R):Promise.reject(R)),onSuccess:_=>(m([...h,...Ee]).forEach(R=>R()),ae.onSuccess?ae.onSuccess(_):_),onPrecognitionSuccess:_=>([...m([...h,...Ee]),...O(Am({...T},Ee))].forEach(R=>R()),ae.onPrecognitionSuccess?ae.onPrecognitionSuccess(_):_),onBefore:()=>{const _=v.some(B=>B.includes("*")),R=_?[...new Set(v.flatMap(B=>Yy(B,F)))]:v;return ae.onBeforeValidation&&ae.onBeforeValidation({data:F,touched:R},{data:G,touched:se})===!1||(ae.onBefore||(()=>!0))()===!1?!1:(_&&g(R).forEach(B=>B()),P=v,ne=F,!0)},onStart:()=>{p(!0).forEach(_=>_()),(ae.onStart??(()=>null))()},onFinish:()=>{p(!1).forEach(_=>_()),se=P,G=ne,P=ne=null,(ae.onFinish??(()=>null))()}}},$=(L,X,F)=>{if(typeof L>"u"){const ae=Array.from(F?.only??F?.validate??[]);g([...v,...ae]).forEach(Ee=>Ee()),Z(F??{});return}if(so(X)&&!c){console.warn('Precognition file validation is not active. Call the "validateFiles" function on your form to enable it.');return}L=Ti(L),(L.includes("*")||Ze(G,L)!==X)&&(g([L,...v]).forEach(ae=>ae()),Z(F??{}))},ue=L=>c===!1?Qc(L):L,W={touched:()=>v,validate(L,X,F){return typeof L=="object"&&!("target"in L)&&(F=L,L=X=void 0),$(L,X,F),W},touch(L){const X=Array.isArray(L)?L:[Ti(L)];return g([...v,...X]).forEach(F=>F()),W},validating:()=>o,valid:S,errors:()=>T,hasErrors:j,setErrors(L){return O(L).forEach(X=>X()),W},forgetError(L){return q(L).forEach(X=>X()),W},defaults(L){return i=L,G=L,W},reset(...L){if(L.length===0)g([]).forEach(X=>X());else{const X=[...v];L.forEach(F=>{X.includes(F)&&X.splice(X.indexOf(F),1),Ut(G,F,Ze(i,F))}),g(X).forEach(F=>F())}return W},setTimeout(L){return J(L),W},on(L,X){return s[L].push(X),W},validateFiles(){return c=!0,W},withoutFileValidation(){return c=!1,W}};return W},Gy=l=>Object.keys(l).reduce((i,s)=>({...i,[s]:Array.isArray(l[s])?l[s][0]:l[s]}),{}),Vy=l=>Object.keys(l).reduce((i,s)=>({...i,[s]:typeof l[s]=="string"?[l[s]]:l[s]}),{}),Ti=l=>typeof l!="string"?l.target.name:l,Qc=l=>{const i={...l};return Object.keys(i).forEach(s=>{const c=i[s];if(c!==null){if(so(c)){delete i[s];return}if(Array.isArray(c)){i[s]=Object.values(Qc({...c}));return}if(typeof c=="object"){i[s]=Qc(i[s]);return}}}),i},Zy=class{config={};defaults;constructor(l){this.defaults=l}extend(l){return l&&(this.defaults={...this.defaults,...l}),this}replace(l){this.config=l}get(l){return Lc(this.config,l)?Ze(this.config,l):Ze(this.defaults,l)}set(l,i){typeof l=="string"?Ut(this.config,l,i):Object.entries(l).forEach(([s,c])=>{Ut(this.config,s,c)})}},_l=new Zy({form:{recentlySuccessfulDuration:2e3,forceIndicesArrayFormatInFormData:!0,withAllErrors:!1},prefetch:{cacheFor:3e4,hoverDelay:75}});function zi(l,i){let s;return function(...c){clearTimeout(s),s=setTimeout(()=>l.apply(this,c),i)}}function Qt(l,i){return document.dispatchEvent(new CustomEvent(`inertia:${l}`,i))}var Tm=l=>Qt("before",{cancelable:!0,detail:{visit:l}}),Ky=l=>Qt("error",{detail:{errors:l}}),Py=l=>Qt("networkError",{cancelable:!0,detail:{error:l}}),Jy=l=>Qt("finish",{detail:{visit:l}}),Om=l=>Qt("httpException",{cancelable:!0,detail:{response:l}}),Fy=l=>Qt("beforeUpdate",{detail:{page:l}}),ru=l=>Qt("navigate",{detail:{page:l}}),$y=l=>Qt("progress",{detail:{progress:l}}),ky=l=>Qt("start",{detail:{visit:l}}),Wy=l=>Qt("success",{detail:{page:l}}),Iy=(l,i)=>Qt("prefetched",{detail:{fetchedAt:Date.now(),response:l,visit:i}}),ev=l=>Qt("prefetching",{detail:{visit:l}}),uu=l=>Qt("flash",{detail:{flash:l}}),Rt=class{static locationVisitKey="inertiaLocationVisit";static set(l,i){typeof window<"u"&&window.sessionStorage.setItem(l,JSON.stringify(i))}static get(l){if(typeof window<"u")return JSON.parse(window.sessionStorage.getItem(l)||"null")}static merge(l,i){const s=this.get(l);s===null?this.set(l,i):this.set(l,{...s,...i})}static remove(l){typeof window<"u"&&window.sessionStorage.removeItem(l)}static removeNested(l,i){const s=this.get(l);s!==null&&(delete s[i],this.set(l,s))}static exists(l){try{return this.get(l)!==null}catch{return!1}}static clear(){typeof window<"u"&&window.sessionStorage.clear()}},tv=async l=>{if(typeof window>"u")throw new Error("Unable to encrypt history");const i=Sp(),s=await uv(await bp());if(!s)throw new Error("Unable to encrypt history");return await lv(i,s,l)},Ea={key:"historyKey",iv:"historyIv"},nv=async l=>{const i=Sp(),s=await bp();if(!s)throw new Error("Unable to decrypt history");return await av(i,s,l)},lv=async(l,i,s)=>{if(typeof window>"u")throw new Error("Unable to encrypt history");if(typeof window.crypto.subtle>"u")return console.warn("Encryption is not supported in this environment. SSL is required."),Promise.resolve(s);const c=new TextEncoder,o=JSON.stringify(s),p=new Uint8Array(o.length*3),h=c.encodeInto(o,p);return window.crypto.subtle.encrypt({name:"AES-GCM",iv:l},i,p.subarray(0,h.written))},av=async(l,i,s)=>{if(typeof window.crypto.subtle>"u")return console.warn("Decryption is not supported in this environment. SSL is required."),Promise.resolve(s);const c=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:l},i,s);return JSON.parse(new TextDecoder().decode(c))},Sp=()=>{const l=Rt.get(Ea.iv);if(l)return new Uint8Array(l);const i=window.crypto.getRandomValues(new Uint8Array(12));return Rt.set(Ea.iv,Array.from(i)),i},iv=async()=>typeof window.crypto.subtle>"u"?(console.warn("Encryption is not supported in this environment. SSL is required."),Promise.resolve(null)):window.crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),rv=async l=>{if(typeof window.crypto.subtle>"u")return console.warn("Encryption is not supported in this environment. SSL is required."),Promise.resolve();const i=await window.crypto.subtle.exportKey("raw",l);Rt.set(Ea.key,Array.from(new Uint8Array(i)))},uv=async l=>{if(l)return l;const i=await iv();return i?(await rv(i),i):null},bp=async()=>{const l=Rt.get(Ea.key);return l?await window.crypto.subtle.importKey("raw",new Uint8Array(l),{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]):null},wm=l=>{const i={};for(const s of Object.keys(l))l[s]!==void 0&&(i[s]=l[s]);return i},Ep=(l,i,s)=>{if(l===i)return!0;for(const c in l)if(!s.includes(c)&&l[c]!==i[c]&&!sv(l[c],i[c]))return!1;for(const c in i)if(!s.includes(c)&&!(c in l))return!1;return!0},sv=(l,i)=>{switch(typeof l){case"object":return Ep(l,i,[]);case"function":return l.toString()===i.toString();default:return l===i}},cv={ms:1,s:1e3,m:1e3*60,h:1e3*60*60,d:1e3*60*60*24},Mm=l=>{if(typeof l=="number")return l;for(const[i,s]of Object.entries(cv))if(l.endsWith(i))return parseFloat(l)*s;return parseInt(l)},ov=class{cached=[];inFlightRequests=[];removalTimers=[];currentUseId=null;add(l,i,{cacheFor:s,cacheTags:c}){if(this.findInFlight(l))return Promise.resolve();const o=this.findCached(l);if(!l.fresh&&o&&o.staleTimestamp>Date.now())return Promise.resolve();const[p,h]=this.extractStaleValues(s),m=new Promise((S,v)=>{i({...l,onCancel:()=>{this.remove(l),l.onCancel(),v()},onError:g=>{this.remove(l),l.onError(g),v()},onPrefetching(g){l.onPrefetching(g)},onPrefetched(g,T){l.onPrefetched(g,T)},onPrefetchResponse(g){S(g)},onPrefetchError(g){mn.removeFromInFlight(l),v(g)}})}).then(S=>{this.remove(l);const v=S.getPageResponse();V.mergeOncePropsIntoResponse(v),this.cached.push({params:{...l},staleTimestamp:Date.now()+p,expiresAt:Date.now()+h,response:m,singleUse:h===0,timestamp:Date.now(),inFlight:!1,tags:Array.isArray(c)?c:[c]});const g=this.getShortestOncePropTtl(v);return this.scheduleForRemoval(l,g?Math.min(h,g):h),this.removeFromInFlight(l),S.handlePrefetch(),S});return this.inFlightRequests.push({params:{...l},response:m,staleTimestamp:null,inFlight:!0}),m}removeAll(){this.cached=[],this.removalTimers.forEach(l=>{clearTimeout(l.timer)}),this.removalTimers=[]}removeByTags(l){this.cached=this.cached.filter(i=>!i.tags.some(s=>l.includes(s)))}remove(l){this.cached=this.cached.filter(i=>!this.paramsAreEqual(i.params,l)),this.clearTimer(l)}removeFromInFlight(l){this.inFlightRequests=this.inFlightRequests.filter(i=>!this.paramsAreEqual(i.params,l))}extractStaleValues(l){const[i,s]=this.cacheForToStaleAndExpires(l);return[Mm(i),Mm(s)]}cacheForToStaleAndExpires(l){if(!Array.isArray(l))return[l,l];switch(l.length){case 0:return[0,0];case 1:return[l[0],l[0]];default:return[l[0],l[1]]}}clearTimer(l){const i=this.removalTimers.find(s=>this.paramsAreEqual(s.params,l));i&&(clearTimeout(i.timer),this.removalTimers=this.removalTimers.filter(s=>s!==i))}scheduleForRemoval(l,i){if(!(typeof window>"u")&&(this.clearTimer(l),i>0)){const s=window.setTimeout(()=>this.remove(l),i);this.removalTimers.push({params:l,timer:s})}}get(l){return this.findCached(l)||this.findInFlight(l)}use(l,i){const s=`${i.url.pathname}-${Date.now()}-${Math.random().toString(36).substring(7)}`;return this.currentUseId=s,l.response.then(c=>{if(this.currentUseId===s)return c.mergeParams({...i,onPrefetched:()=>{}}),this.removeSingleUseItems(i),c.handle()})}removeSingleUseItems(l){this.cached=this.cached.filter(i=>this.paramsAreEqual(i.params,l)?!i.singleUse:!0)}findCached(l){return this.cached.find(i=>this.paramsAreEqual(i.params,l))||null}findInFlight(l){return this.inFlightRequests.find(i=>this.paramsAreEqual(i.params,l))||null}withoutPurposePrefetchHeader(l){const i=Pe(l);return i.headers.Purpose==="prefetch"&&delete i.headers.Purpose,i}paramsAreEqual(l,i){return Ep(this.withoutPurposePrefetchHeader(l),this.withoutPurposePrefetchHeader(i),["showProgress","replace","prefetch","preserveScroll","preserveState","onBefore","onBeforeUpdate","onStart","onProgress","onFinish","onCancel","onSuccess","onError","onFlash","onPrefetched","onCancelToken","onPrefetching","async","viewTransition","optimistic","component","pageProps"])}updateCachedOncePropsFromCurrentPage(){this.cached.forEach(l=>{l.response.then(i=>{const s=i.getPageResponse();V.mergeOncePropsIntoResponse(s,{force:!0});for(const[h,m]of Object.entries(s.deferredProps??{})){const S=m.filter(v=>Ze(s.props,v)===void 0);S.length>0?s.deferredProps[h]=S:delete s.deferredProps[h]}const c=this.getShortestOncePropTtl(s);if(c===null)return;const o=l.expiresAt-Date.now(),p=Math.min(o,c);p>0?this.scheduleForRemoval(l.params,p):this.remove(l.params)})})}getShortestOncePropTtl(l){const i=Object.values(l.onceProps??{}).map(s=>s.expiresAt).filter(s=>!!s);return i.length===0?null:Math.min(...i)-Date.now()}},mn=new ov,_c=l=>{if(l.offsetParent===null)return!1;const i=l.getBoundingClientRect(),s=i.top=0,c=i.left=0;return s&&c},fv=l=>{const i=h=>{const m=window.getComputedStyle(h);return m.overflowY==="scroll"?!0:m.overflowY!=="auto"?!1:["visible","clip"].includes(m.overflowX)?!0:c(m.maxHeight,h.style.height)||o(h,"height")},s=h=>{const m=window.getComputedStyle(h);return m.overflowX==="scroll"?!0:m.overflowX!=="auto"?!1:["visible","clip"].includes(m.overflowY)?!0:c(m.maxWidth,h.style.width)||o(h,"width")},c=(h,m)=>!!(h&&h!=="none"&&h!=="0px"||m&&m!=="auto"&&m!=="0"),o=(h,m)=>{const S=h.parentElement;if(!S)return!1;const v=window.getComputedStyle(S);if(["flex","inline-flex"].includes(v.display)){const g=["column","column-reverse"].includes(v.flexDirection);return m==="height"?g:!g}return["grid","inline-grid"].includes(v.display)};let p=l?.parentElement;for(;p;){const h=i(p)||s(p);if(window.getComputedStyle(p).display!=="contents"&&h)return p;p=p.parentElement}return null},Ap=(l,i)=>{if(!i)return l.filter(p=>_c(p));const s=l.indexOf(i),c=[],o=[];for(let p=s;p>=0;p--){const h=l[p];if(_c(h))c.push(h);else break}for(let p=s+1;p{window.requestAnimationFrame(()=>{i>1?Oi(l,i-1):l()})},dv=l=>{if(typeof window>"u")return null;const i=document.querySelector(`script[data-page="${l}"][type="application/json"]`);return i?.textContent?JSON.parse(i.textContent):null},Ei=typeof window>"u",hv=!Ei&&/Firefox/i.test(window.navigator.userAgent),_t=class{static save(){De.saveScrollPositions(this.getScrollRegions())}static getScrollRegions(){return Array.from(this.regions()).map(l=>({top:l.scrollTop,left:l.scrollLeft}))}static regions(){return document.querySelectorAll("[scroll-region]")}static scrollToTop(){if(hv&&getComputedStyle(document.documentElement).scrollBehavior==="smooth")return Oi(()=>window.scrollTo(0,0),2);window.scrollTo(0,0)}static reset(){!Ei&&window.location.hash||this.scrollToTop(),this.regions().forEach(l=>{typeof l.scrollTo=="function"?l.scrollTo(0,0):(l.scrollTop=0,l.scrollLeft=0)}),this.save(),this.scrollToAnchor()}static scrollToAnchor(){const l=Ei?null:window.location.hash;l&&setTimeout(()=>{const i=document.getElementById(l.slice(1));i?i.scrollIntoView():this.scrollToTop()})}static restore(l){Ei||window.requestAnimationFrame(()=>{this.restoreDocument(),this.restoreScrollRegions(l)})}static restoreScrollRegions(l){Ei||this.regions().forEach((i,s)=>{const c=l[s];c&&(typeof i.scrollTo=="function"?i.scrollTo(c.left,c.top):(i.scrollTop=c.top,i.scrollLeft=c.left))})}static restoreDocument(){const l=De.getDocumentScrollPosition();window.scrollTo(l.left,l.top)}static onScroll(l){const i=l.target;typeof i.hasAttribute=="function"&&i.hasAttribute("scroll-region")&&this.save()}static onWindowScroll(){De.saveDocumentScrollPosition({top:window.scrollY,left:window.scrollX})}},fo=l=>typeof File<"u"&&l instanceof File||l instanceof Blob||typeof FileList<"u"&&l instanceof FileList&&l.length>0;function Gc(l){return fo(l)||l instanceof FormData&&Array.from(l.values()).some(i=>Gc(i))||typeof l=="object"&&l!==null&&Object.values(l).some(i=>Gc(i))}var Vc=l=>l instanceof FormData;function Tp(l,i=new FormData,s=null,c="brackets"){l=l||{};for(const o in l)Object.prototype.hasOwnProperty.call(l,o)&&wp(i,Op(s,o,"indices"),l[o],c);return i}function Op(l,i,s){return l?s==="brackets"?`${l}[]`:`${l}[${i}]`:i}function wp(l,i,s,c){if(Array.isArray(s))return Array.from(s.keys()).forEach(o=>wp(l,Op(i,o.toString(),c),s[o],c));if(s instanceof Date)return l.append(i,s.toISOString());if(s instanceof File)return l.append(i,s,s.name);if(s instanceof Blob)return l.append(i,s);if(typeof s=="boolean")return l.append(i,s?"1":"0");if(typeof s=="string")return l.append(i,s);if(typeof s=="number")return l.append(i,`${s}`);if(s==null)return l.append(i,"");Tp(s,l,i,c)}function mv(l){return/\[\d+\]/.test(decodeURIComponent(l.search))}function pv(l){if(!l||l==="?")return{};const i={};return l.replace(/^\?/,"").split("&").filter(Boolean).forEach(s=>{const[c,o]=yv(s);vv(i,zm(c),zm(o))}),i}function gv(l,i){const s=[];return Zc(l,"",s,i),s.length?"?"+s.join("&"):""}function yv(l){const i=l.indexOf("=");return i===-1?[l,""]:[l.substring(0,i),l.substring(i+1)]}function zm(l){return decodeURIComponent(l.replace(/\+/g," "))}function vv(l,i,s){const c=Sv(i);if(c.some(h=>h==="__proto__"))return;let o=l;for(;c.length>1;){const h=c.shift(),m=c[0]==="";(typeof o[h]!="object"||o[h]===null)&&(o[h]=m?[]:{}),o=o[h]}const p=c.shift();p===""&&Array.isArray(o)?o.push(s):o[p]=s}function Sv(l){const i=[],s=l.split("[")[0];s&&i.push(s);let c;const o=/\[([^\]]*)\]/g;for(;(c=o.exec(l))!==null;)i.push(c[1]);return i}function Zc(l,i,s,c){if(l!==void 0){if(l===null){s.push(`${i}=`);return}if(Array.isArray(l)){l.forEach((o,p)=>{Zc(o,c==="indices"?`${i}[${p}]`:`${i}[]`,s,c)});return}if(typeof l=="object"){Object.keys(l).forEach(o=>{Zc(l[o],i?`${i}[${o}]`:o,s,c)});return}s.push(`${i}=${encodeURIComponent(String(l))}`)}}function en(l){return new URL(l.toString(),typeof window>"u"?void 0:window.location.toString())}var bv=(l,i,s,c,o)=>{let p=typeof l=="string"?en(l):l;if((Gc(i)||c)&&!Vc(i)&&(_l.get("form.forceIndicesArrayFormatInFormData")&&(o="indices"),i=Tp(i,new FormData,null,o)),Vc(i))return[p,i];const[h,m]=hu(s,p,i,o);return[en(h),m]};function hu(l,i,s,c="brackets"){const o=l==="get"&&!Vc(s)&&Object.keys(s).length>0,p=Dp(i.toString()),h=p||i.toString().startsWith("/")||i.toString()==="",m=!h&&!i.toString().startsWith("#")&&!i.toString().startsWith("?"),S=/^[.]{1,2}([/]|$)/.test(i.toString()),v=i.toString().includes("?")||o,g=i.toString().includes("#"),T=new URL(i.toString(),typeof window>"u"?"http://localhost":window.location.toString());if(o){const O=mv(T)?"indices":c;T.search=gv({...pv(T.search),...s},O)}return[[p?`${T.protocol}//${T.host}`:"",h?T.pathname:"",m?T.pathname.substring(S?0:1):"",v?T.search:"",g?T.hash:""].join(""),o?{}:s]}function su(l){return l=new URL(l.href),l.hash="",l}var Dm=(l,i)=>{l.hash&&!i.hash&&su(l).href===i.href&&(i.hash=l.hash)},cu=(l,i)=>su(l).href===su(i).href,Mp=(l,i)=>l.origin===i.origin&&l.pathname===i.pathname;function cn(l){return l!==null&&typeof l=="object"&&l!==void 0&&"url"in l&&"method"in l}function zp(l){return l.component?typeof l.component!="string"?(console.error(`The "component" property on the URL method pair received multiple components (${Object.keys(l.component).join(", ")}), but only a single component string is supported for instant visits. Use the withComponent() method to specify which component to use.`),null):l.component:null}function Dp(l){return/^([a-z][a-z0-9+.-]*:)?\/\/[^/]/i.test(l)}function Ev(l,i){const s=typeof l=="string"?en(l):l;return i?`${s.protocol}//${s.host}${s.pathname}${s.search}${s.hash}`:`${s.pathname}${s.search}${s.hash}`}var Av=class{page;swapComponent;resolveComponent;onFlashCallback;componentId={};listeners=[];isFirstPageLoad=!0;cleared=!1;pendingDeferredProps=null;historyQuotaExceeded=!1;optimisticBaseline={};pendingOptimistics=[];optimisticCounter=0;init({initialPage:l,swapComponent:i,resolveComponent:s,onFlash:c}){return this.page={...l,flash:l.flash??{},rescuedProps:l.rescuedProps??[]},this.swapComponent=i,this.resolveComponent=s,this.onFlashCallback=c,pn.on("historyQuotaExceeded",()=>{this.historyQuotaExceeded=!0}),this}set(l,{replace:i=!1,preserveScroll:s=!1,preserveState:c=!1,viewTransition:o=!1}={}){Object.keys(l.deferredProps||{}).length&&(this.pendingDeferredProps={deferredProps:l.deferredProps,component:l.component,url:l.url},l.initialDeferredProps===void 0&&(l.initialDeferredProps=l.deferredProps)),this.componentId={};const p=this.componentId;return l.clearHistory&&De.clear(),this.resolve(l.component,l).then(h=>{if(p!==this.componentId)return;l.rememberedState??={};const m=typeof window>"u",S=m?new URL(l.url):window.location,v=!m&&s?_t.getScrollRegions():[];i=i||cu(en(l.url),S);const g={...l,flash:{}};return new Promise(T=>i?De.replaceState(g,T):De.pushState(g,T)).then(()=>{const T=!this.isTheSame(l);if(!T&&Object.keys(l.props.errors||{}).length>0&&(o=!1),this.page=l,this.cleared=!1,this.hasOnceProps()&&mn.updateCachedOncePropsFromCurrentPage(),T&&this.fireEventsFor("newComponent"),this.isFirstPageLoad&&this.fireEventsFor("firstLoad"),this.isFirstPageLoad=!1,this.historyQuotaExceeded){this.historyQuotaExceeded=!1;return}return this.swap({component:h,page:l,preserveState:c,viewTransition:o}).then(()=>{s?window.requestAnimationFrame(()=>_t.restoreScrollRegions(v)):_t.reset(),this.pendingDeferredProps&&this.pendingDeferredProps.component===l.component&&this.pendingDeferredProps.url===l.url&&pn.fireInternalEvent("loadDeferredProps",this.pendingDeferredProps.deferredProps),this.pendingDeferredProps=null,i||ru(l)})})})}setQuietly(l,{preserveState:i=!1}={}){return this.resolve(l.component,l).then(s=>(this.page=l,this.cleared=!1,De.setCurrent(l),this.swap({component:s,page:l,preserveState:i,viewTransition:!1})))}clear(){this.cleared=!0}isCleared(){return this.cleared}get(){return this.page}getWithoutFlashData(){return{...this.page,flash:{}}}hasOnceProps(){return Object.keys(this.page.onceProps??{}).length>0}merge(l){this.page={...this.page,...l}}setPropsQuietly(l){return this.page={...this.page,props:l},this.resolve(this.page.component,this.page).then(i=>this.swap({component:i,page:this.page,preserveState:!0,viewTransition:!1}))}setFlash(l){this.page={...this.page,flash:l},this.onFlashCallback?.(l)}setUrlHash(l){this.page.url.includes(l)||(this.page.url+=l)}remember(l){this.page.rememberedState=l}swap({component:l,page:i,preserveState:s,viewTransition:c}){const o=()=>this.swapComponent({component:l,page:i,preserveState:s});if(!c||!document?.startViewTransition||document.visibilityState==="hidden")return o();const p=typeof c=="boolean"?()=>null:c;return new Promise(h=>{p(document.startViewTransition(()=>o().then(h)))})}resolve(l,i){return Promise.resolve(this.resolveComponent(l,i))}nextOptimisticId(){return++this.optimisticCounter}setBaseline(l,i){l in this.optimisticBaseline||(this.optimisticBaseline[l]=i)}updateBaseline(l,i){l in this.optimisticBaseline&&(this.optimisticBaseline[l]=i)}hasBaseline(l){return l in this.optimisticBaseline}registerOptimistic(l,i){this.pendingOptimistics.push({id:l,callback:i})}unregisterOptimistic(l){this.pendingOptimistics=this.pendingOptimistics.filter(i=>i.id!==l)}replayOptimistics(){const l=Object.keys(this.optimisticBaseline);if(l.length===0)return{};const i=Pe(this.page.props);for(const c of l)i[c]=Pe(this.optimisticBaseline[c]);for(const{callback:c}of this.pendingOptimistics){const o=c(Pe(i));o&&Object.assign(i,o)}const s={};for(const c of l)s[c]=i[c];return s}pendingOptimisticCount(){return this.pendingOptimistics.length}clearOptimisticState(){this.optimisticBaseline={},this.pendingOptimistics=[]}isTheSame(l){return this.page.component===l.component}on(l,i){return this.listeners.push({event:l,callback:i}),()=>{this.listeners=this.listeners.filter(s=>s.event!==l&&s.callback!==i)}}fireEventsFor(l){this.listeners.filter(i=>i.event===l).forEach(i=>i.callback())}mergeOncePropsIntoResponse(l,{force:i=!1}={}){Object.entries(l.onceProps??{}).forEach(([s,c])=>{const o=this.page.onceProps?.[s];o!==void 0&&(i||Ze(l.props,c.prop)===void 0)&&(Ut(l.props,c.prop,Ze(this.page.props,o.prop)),l.onceProps[s].expiresAt=o.expiresAt)})}},V=new Av,mu=class{items=[];processingPromise=null;add(l){return this.items.push(l),this.process()}process(){return this.processingPromise??=this.processNext().finally(()=>{this.processingPromise=null}),this.processingPromise}processNext(){const l=this.items.shift();return l?Promise.resolve(l()).then(()=>this.processNext()):Promise.resolve()}},Sa=typeof window>"u",Si=new mu,Nm=!Sa&&/CriOS/.test(window.navigator.userAgent),Tv=class{rememberedState="rememberedState";scrollRegions="scrollRegions";preserveUrl=!1;current={};initialState=null;remember(l,i){this.replaceState({...V.getWithoutFlashData(),rememberedState:{...V.get()?.rememberedState??{},[i]:l}})}restore(l){if(!Sa)return this.current[this.rememberedState]?.[l]!==void 0?this.current[this.rememberedState]?.[l]:this.initialState?.[this.rememberedState]?.[l]}pushState(l,i=null){if(!Sa){if(this.preserveUrl){i&&i();return}this.current=l,Si.add(()=>this.getPageData(l).then(s=>{const c=()=>this.doPushState({page:s},l.url).then(()=>i?.());return Nm?new Promise(o=>{setTimeout(()=>c().then(o))}):c()}))}}clonePageProps(l){try{return structuredClone(l.props),l}catch{return{...l,props:Pe(l.props)}}}getPageData(l){const i=this.clonePageProps(l);return new Promise(s=>l.encryptHistory?tv(i).then(s):s(i))}processQueue(){return Si.process()}decrypt(l=null){if(Sa)return Promise.resolve(l??V.get());const i=l??window.history.state?.page;return this.decryptPageData(i).then(s=>{if(!s)throw new Error("Unable to decrypt history");return this.initialState===null?this.initialState=s??void 0:this.current=s??{},s})}decryptPageData(l){return l instanceof ArrayBuffer?nv(l):Promise.resolve(l)}saveScrollPositions(l){Si.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!gn(this.getScrollRegions(),l))return this.doReplaceState({page:window.history.state.page,scrollRegions:l})}))}saveDocumentScrollPosition(l){Si.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!gn(this.getDocumentScrollPosition(),l))return this.doReplaceState({page:window.history.state.page,documentScrollPosition:l})}))}getScrollRegions(){return window.history.state?.scrollRegions||[]}getDocumentScrollPosition(){return window.history.state?.documentScrollPosition||{top:0,left:0}}replaceState(l,i=null){if(gn(this.current,l)){i&&i();return}const{flash:s,...c}=l;if(V.merge(c),!Sa){if(this.preserveUrl){i&&i();return}this.current=l,Si.add(()=>this.getPageData(l).then(o=>{const p=()=>this.doReplaceState({page:o},l.url).then(()=>i?.());return Nm?new Promise(h=>{setTimeout(()=>p().then(h))}):p()}))}}isHistoryThrottleError(l){return l instanceof Error&&l.name==="SecurityError"&&(l.message.includes("history.pushState")||l.message.includes("history.replaceState"))}isQuotaExceededError(l){return l instanceof Error&&l.name==="QuotaExceededError"}withThrottleProtection(l){return Promise.resolve().then(()=>{try{return l()}catch(i){if(!this.isHistoryThrottleError(i))throw i;console.error(i.message)}})}doReplaceState(l,i){return this.withThrottleProtection(()=>{window.history.replaceState({...l,scrollRegions:l.scrollRegions??window.history.state?.scrollRegions,documentScrollPosition:l.documentScrollPosition??window.history.state?.documentScrollPosition},"",i)})}doPushState(l,i){return this.withThrottleProtection(()=>{try{window.history.pushState(l,"",i)}catch(s){if(!this.isQuotaExceededError(s))throw s;pn.fireInternalEvent("historyQuotaExceeded",i)}})}getState(l,i){return this.current?.[l]??i}deleteState(l){this.current[l]!==void 0&&(delete this.current[l],this.replaceState(this.current))}clearInitialState(l){this.initialState&&this.initialState[l]!==void 0&&delete this.initialState[l]}browserHasHistoryEntry(){return!Sa&&!!window.history.state?.page}clear(){Rt.remove(Ea.key),Rt.remove(Ea.iv)}setCurrent(l){this.current=l}isValidState(l){return!!l.page}getAllState(){return this.current}};typeof window<"u"&&window.history.scrollRestoration&&(window.history.scrollRestoration="manual");var De=new Tv,Ov=class{internalListeners=[];init(){typeof window<"u"&&(window.addEventListener("popstate",this.handlePopstateEvent.bind(this)),window.addEventListener("pageshow",this.handlePageshowEvent.bind(this)),window.addEventListener("scroll",zi(_t.onWindowScroll.bind(_t),100),!0)),typeof document<"u"&&document.addEventListener("scroll",zi(_t.onScroll.bind(_t),100),!0)}onGlobalEvent(l,i){const s=(c=>{const o=i(c);c.cancelable&&!c.defaultPrevented&&o===!1&&c.preventDefault()});return this.registerListener(`inertia:${l}`,s)}on(l,i){return this.internalListeners.push({event:l,listener:i}),()=>{this.internalListeners=this.internalListeners.filter(s=>s.listener!==i)}}onMissingHistoryItem(){V.clear(),this.fireInternalEvent("missingHistoryItem")}fireInternalEvent(l,...i){this.internalListeners.filter(s=>s.event===l).forEach(s=>s.listener(...i))}registerListener(l,i){return document.addEventListener(l,i),()=>document.removeEventListener(l,i)}handlePageshowEvent(l){l.persisted&&De.decrypt().catch(()=>this.onMissingHistoryItem())}handlePopstateEvent(l){const i=l.state||null;if(i===null){const s=en(V.get().url);s.hash=window.location.hash,De.replaceState({...V.getWithoutFlashData(),url:s.href}),_t.reset();return}if(!De.isValidState(i))return this.onMissingHistoryItem();De.decrypt(i.page).then(s=>{if(V.get().version!==s.version){this.onMissingHistoryItem();return}Ye.cancelAll({prefetch:!1}),V.setQuietly(s,{preserveState:!1}).then(()=>{_t.restore(De.getScrollRegions()),ru(V.get());const c={},o=V.get().props;for(const[p,h]of Object.entries(s.initialDeferredProps??s.deferredProps??{})){const m=h.filter(S=>Ze(o,S)===void 0);m.length>0&&(c[p]=m)}Object.keys(c).length>0&&this.fireInternalEvent("loadDeferredProps",c)})}).catch(()=>{this.onMissingHistoryItem()})}},pn=new Ov,wv=class{type;constructor(){this.type=this.resolveType()}resolveType(){return typeof window>"u"?"navigate":window.performance?.getEntriesByType("navigation")[0]?.type??"navigate"}get(){return this.type}isBackForward(){return this.type==="back_forward"}isReload(){return this.type==="reload"}},Uc=new wv,Mv=class{static handle(){this.clearRememberedStateOnReload(),[this.handleBackForward,this.handleLocation,this.handleDefault].find(l=>l.bind(this)())}static clearRememberedStateOnReload(){Uc.isReload()&&(De.deleteState(De.rememberedState),De.clearInitialState(De.rememberedState))}static handleBackForward(){if(!Uc.isBackForward()||!De.browserHasHistoryEntry())return!1;const l=De.getScrollRegions();return De.decrypt().then(i=>{V.set(i,{preserveScroll:!0,preserveState:!0}).then(()=>{_t.restore(l),ru(V.get())})}).catch(()=>{pn.onMissingHistoryItem()}),!0}static handleLocation(){if(!Rt.exists(Rt.locationVisitKey))return!1;const l=Rt.get(Rt.locationVisitKey)||{};return Rt.remove(Rt.locationVisitKey),typeof window<"u"&&V.setUrlHash(window.location.hash),De.decrypt(V.get()).then(()=>{const i=De.getState(De.rememberedState,{}),s=De.getScrollRegions();V.remember(i),V.set(V.get(),{preserveScroll:l.preserveScroll,preserveState:!0}).then(()=>{l.preserveScroll&&_t.restore(s),this.fireInitialEvents()})}).catch(()=>{pn.onMissingHistoryItem()}),!0}static handleDefault(){typeof window<"u"&&V.setUrlHash(window.location.hash),V.set(V.get(),{preserveScroll:!0,preserveState:!0}).then(()=>{Uc.isReload()?_t.restore(De.getScrollRegions()):_t.scrollToAnchor(),this.fireInitialEvents()})}static fireInitialEvents(){const l=V.get();ru(l),Object.keys(l.flash).length>0&&queueMicrotask(()=>uu(l.flash))}},zv=class{intervalId=null;timeoutId=null;throttle=!1;keepAlive=!1;cb;interval;cbCount=0;mode;inFlight=!1;currentCancel=null;stopped=!0;instanceId=0;constructor(l,i,s){this.keepAlive=s.keepAlive??!1,this.mode=s.mode??"overlap",this.cb=i,this.interval=l,(s.autoStart??!0)&&this.start()}stop(){this.stopped=!0,this.instanceId++,this.inFlight=!1,this.currentCancel=null,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}start(){if(!(typeof window>"u")){if(this.stop(),this.stopped=!1,this.mode==="rest"){this.scheduleNext();return}this.intervalId=window.setInterval(()=>this.tick(),this.interval)}}isInBackground(l){this.throttle=this.keepAlive?!1:l,this.throttle&&(this.cbCount=0)}scheduleNext(){this.stopped||(this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.tick()},this.interval))}tick(){!this.throttle||this.cbCount%10===0?this.fire():this.mode==="rest"&&this.scheduleNext(),this.throttle&&this.cbCount++}fire(){this.inFlight&&this.mode==="cancel"&&this.currentCancel?.();const l=this.instanceId;this.cb({onStart:i=>{l===this.instanceId&&(this.inFlight=!0,this.currentCancel=i)},onFinish:()=>{l===this.instanceId&&(this.inFlight=!1,this.currentCancel=null,this.mode==="rest"&&this.scheduleNext())}})}},Dv=class{polls=[];constructor(){this.setupVisibilityListener()}get count(){return this.polls.length}add(l,i,s){const c=new zv(l,i,s);return this.polls.push(c),{stop:()=>c.stop(),start:()=>c.start(),destroy:()=>{c.stop(),this.polls=this.polls.filter(o=>o!==c)}}}clear(){this.polls.forEach(l=>l.stop()),this.polls=[]}setupVisibilityListener(){typeof document>"u"||document.addEventListener("visibilitychange",()=>{this.polls.forEach(l=>l.isInBackground(document.hidden))},!1)}},Rm=new Dv,Nv=class{requestHandlers=[];responseHandlers=[];errorHandlers=[];onRequest(l){return this.requestHandlers.push(l),()=>{this.requestHandlers=this.requestHandlers.filter(i=>i!==l)}}onResponse(l){return this.responseHandlers.push(l),()=>{this.responseHandlers=this.responseHandlers.filter(i=>i!==l)}}onError(l){return this.errorHandlers.push(l),()=>{this.errorHandlers=this.errorHandlers.filter(i=>i!==l)}}async processRequest(l){let i=l;for(const s of this.requestHandlers)i=await s(i);return i}async processResponse(l){let i=l;for(const s of this.responseHandlers)i=await s(i);return i}async processError(l){for(const i of this.errorHandlers)await i(l)}},vt=new Nv,ho=class extends Error{code;url;constructor(l,i,s){super(s?`${l} (${s})`:l),this.name="HttpError",this.code=i,this.url=s}},Kc=class extends ho{response;constructor(l,i,s){super(l,"ERR_HTTP_RESPONSE",s),this.name="HttpResponseError",this.response=i}},Pc=class extends ho{constructor(l="Request was cancelled",i){super(l,"ERR_CANCELLED",i),this.name="HttpCancelledError"}},_m=class extends ho{cause;constructor(l,i,s){super(l,"ERR_NETWORK",i),this.name="HttpNetworkError",this.cause=s}};function Rv(l){const i=document.cookie.match(new RegExp("(^|;\\s*)("+l+")=([^;]*)"));return i?decodeURIComponent(i[3]):null}function _v(l){const i={};return l.getAllResponseHeaders().split(`\r `).forEach(s=>{const c=s.indexOf(":");c>0&&(i[s.slice(0,c).toLowerCase().trim()]=s.slice(c+1).trim())}),i}function Uv(l,i){if(!i.headers)return;const s=i.data instanceof FormData;Object.entries(i.headers).forEach(([c,o])=>{(c.toLowerCase()!=="content-type"||!s)&&l.setRequestHeader(c,String(o))})}function Hv(l,i){if(!i||Object.keys(i).length===0)return l;const[s]=hu("get",l,i);return s}var Np=class{xsrfCookieName;xsrfHeaderName;constructor(l={}){this.xsrfCookieName=l.xsrfCookieName??"XSRF-TOKEN",this.xsrfHeaderName=l.xsrfHeaderName??"X-XSRF-TOKEN"}async request(l){const i=await vt.processRequest(l);try{const s=await this.doRequest(i);return await vt.processResponse(s)}catch(s){throw(s instanceof Kc||s instanceof _m||s instanceof Pc)&&await vt.processError(s),s}}doRequest(l){return new Promise((i,s)=>{const c=new XMLHttpRequest,o=Hv(l.url,l.params);c.open(l.method.toUpperCase(),o,!0);const p=Rv(this.xsrfCookieName);p&&c.setRequestHeader(this.xsrfHeaderName,p);let h=null;l.data!==null&&l.data!==void 0&&(l.data instanceof FormData?h=l.data:typeof l.data=="object"?(h=JSON.stringify(l.data),!l.headers?.["Content-Type"]&&!l.headers?.["content-type"]&&c.setRequestHeader("Content-Type","application/json")):h=String(l.data)),Uv(c,l),l.onUploadProgress&&(c.upload.onprogress=m=>{const S=m.lengthComputable?m.loaded/m.total:void 0;l.onUploadProgress({progress:S,percentage:S?Math.round(S*100):0,loaded:m.loaded,total:m.lengthComputable?m.total:void 0})}),l.signal&&l.signal.addEventListener("abort",()=>c.abort()),c.onabort=()=>s(new Pc("Request was cancelled",l.url)),c.onerror=()=>s(new _m("Network error",l.url)),c.onload=()=>{const m={status:c.status,data:c.responseText,headers:_v(c)};c.status>=400?s(new Kc(`Request failed with status ${c.status}`,m,l.url)):i(m)},c.send(h)})}},Cv=new Np,Hc=Cv;function xv(l){return!("request"in l)}var Rp={getClient(){return Hc},setClient(l){if(!xv(l)){Hc=l;return}Hc=new Np(l),l.xsrfCookieName&&St.withXsrfCookieName(l.xsrfCookieName),l.xsrfHeaderName&&St.withXsrfHeaderName(l.xsrfHeaderName)},onRequest:vt.onRequest.bind(vt),onResponse:vt.onResponse.bind(vt),onError:vt.onError.bind(vt),processRequest:vt.processRequest.bind(vt),processResponse:vt.processResponse.bind(vt),processError:vt.processError.bind(vt)},kr=class Wr{callbacks=[];params;constructor(i){if(!i.prefetch)this.params=i;else{const s={onBefore:this.wrapCallback(i,"onBefore"),onBeforeUpdate:this.wrapCallback(i,"onBeforeUpdate"),onStart:this.wrapCallback(i,"onStart"),onProgress:this.wrapCallback(i,"onProgress"),onFinish:this.wrapCallback(i,"onFinish"),onCancel:this.wrapCallback(i,"onCancel"),onSuccess:this.wrapCallback(i,"onSuccess"),onError:this.wrapCallback(i,"onError"),onHttpException:this.wrapCallback(i,"onHttpException"),onNetworkError:this.wrapCallback(i,"onNetworkError"),onFlash:this.wrapCallback(i,"onFlash"),onCancelToken:this.wrapCallback(i,"onCancelToken"),onPrefetched:this.wrapCallback(i,"onPrefetched"),onPrefetching:this.wrapCallback(i,"onPrefetching")};this.params={...i,...s,onPrefetchResponse:i.onPrefetchResponse||(()=>{}),onPrefetchError:i.onPrefetchError||(()=>{})}}}static create(i){return new Wr(i)}data(){return this.params.method==="get"?null:this.params.data}queryParams(){return this.params.method==="get"?this.params.data:{}}isPartial(){return this.params.only.length>0||this.params.except.length>0||this.params.reset.length>0}isPrefetch(){return this.params.prefetch===!0}isDeferredPropsRequest(){return this.params.deferredProps===!0}onCancelToken(i){this.params.onCancelToken({cancel:i})}markAsFinished(){this.params.completed=!0,this.params.cancelled=!1,this.params.interrupted=!1}markAsCancelled({cancelled:i=!0,interrupted:s=!1}){this.params.onCancel(),this.params.completed=!1,this.params.cancelled=i,this.params.interrupted=s}wasCancelledAtAll(){return this.params.cancelled||this.params.interrupted}onFinish(){this.params.onFinish(this.params)}onStart(){this.params.onStart(this.params)}onPrefetching(){this.params.onPrefetching(this.params)}onPrefetchResponse(i){this.params.onPrefetchResponse&&this.params.onPrefetchResponse(i)}onPrefetchError(i){this.params.onPrefetchError&&this.params.onPrefetchError(i)}all(){return this.params}headers(){const i={...this.params.headers};this.isPartial()&&(i["X-Inertia-Partial-Component"]=V.get().component);const s=this.params.only.concat(this.params.reset);return s.length>0&&(i["X-Inertia-Partial-Data"]=s.join(",")),this.params.except.length>0&&(i["X-Inertia-Partial-Except"]=this.params.except.join(",")),this.params.reset.length>0&&(i["X-Inertia-Reset"]=this.params.reset.join(",")),this.params.errorBag&&this.params.errorBag.length>0&&(i["X-Inertia-Error-Bag"]=this.params.errorBag),i}setPreserveOptions(i){this.params.preserveScroll=Wr.resolvePreserveOption(this.params.preserveScroll,i),this.params.preserveState=Wr.resolvePreserveOption(this.params.preserveState,i)}runCallbacks(){this.callbacks.forEach(({name:i,args:s})=>{this.params[i](...s)})}merge(i){this.params={...this.params,...i}}wrapCallback(i,s){return(...c)=>{this.recordCallback(s,c),i[s](...c)}}recordCallback(i,s){this.callbacks.push({name:i,args:s})}static resolvePreserveOption(i,s){return typeof i=="function"?i(s):i==="errors"?Object.keys(s.props.errors||{}).length>0:i}},qv={createIframeAndPage(l){typeof l=="object"&&(l=`All Inertia requests must receive a valid Inertia response, however a plain JSON response was received.
${JSON.stringify(l)}`);const i=document.createElement("html");i.innerHTML=l,i.querySelectorAll("a").forEach(c=>c.setAttribute("target","_top"));const s=document.createElement("iframe");return s.style.backgroundColor="white",s.style.borderRadius="5px",s.style.width="100%",s.style.height="100%",s.setAttribute("sandbox","allow-scripts"),{iframe:s,page:i}},show(l){const{iframe:i,page:s}=this.createIframeAndPage(l);i.style.boxSizing="border-box",i.style.display="block";const c=document.createElement("dialog");c.id="inertia-error-dialog",Object.assign(c.style,{width:"calc(100vw - 100px)",height:"calc(100vh - 100px)",padding:"0",margin:"auto",border:"none",backgroundColor:"transparent"});const o=document.createElement("style");o.textContent=` dialog#inertia-error-dialog::backdrop { background-color: rgba(0, 0, 0, 0.6); } dialog#inertia-error-dialog:focus { outline: none; } `;const p=_l.get("nonce");p&&(o.nonce=p),document.head.appendChild(o),c.addEventListener("click",h=>{h.target===c&&c.close()}),c.addEventListener("close",()=>{o.remove(),c.remove()}),c.appendChild(i),document.body.prepend(c),c.showModal(),c.focus(),i.srcdoc=s.outerHTML}},Um=(l,i)=>l===i||l.startsWith(`${i}.`),_p=(l,i)=>{const{only:s,except:c}=l;return!(s.length===0&&c.length===0||s.length>0&&!s.some(o=>Um(i,o))||c.length>0&&c.some(o=>Um(i,o)))},jv=(l,i)=>i.some(s=>_p(l,s)),Bv=new mu,Hm=class Up{constructor(i,s,c){this.requestParams=i,this.response=s,this.originatingPage=c}wasPrefetched=!1;processed=!1;static create(i,s,c){return new Up(i,s,c)}isProcessed(){return this.processed}async handlePrefetch(){cu(this.requestParams.all().url,window.location)&&this.handle()}async handle(){return Bv.add(()=>this.process())}async process(){if(this.requestParams.all().prefetch)return this.wasPrefetched=!0,this.requestParams.all().prefetch=!1,this.requestParams.all().onPrefetched(this.response,this.requestParams.all()),Iy(this.response,this.requestParams.all()),Promise.resolve();if(this.requestParams.runCallbacks(),this.processed=!0,!this.isInertiaResponse())return this.handleNonInertiaResponse();if(this.isHttpException()){const c={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(c)===!1||!Om(c))return}await De.processQueue(),De.preserveUrl=this.requestParams.all().preserveUrl,await this.setPage();const{flash:i}=V.get();Object.keys(i).length>0&&!this.requestParams.isDeferredPropsRequest()&&(uu(i),this.requestParams.all().onFlash(i));const s=V.get().props.errors||{};if(Object.keys(s).length>0){const c=this.getScopedErrors(s);return Ky(c),this.requestParams.all().onError(c)}Ye.flushByCacheTags(this.requestParams.all().invalidateCacheTags||[]),this.wasPrefetched||Ye.flush(V.get().url),Wy(V.get()),await this.requestParams.all().onSuccess(V.get()),De.preserveUrl=!1}mergeParams(i){this.requestParams.merge(i)}getPageResponse(){const i=this.getDataFromResponse(this.response.data);return typeof i=="object"?this.response.data={...i,flash:i.flash??{},rescuedProps:i.rescuedProps??[]}:this.response.data=i}async handleNonInertiaResponse(){if(this.isInertiaRedirect()){Ye.visit(this.getHeader("x-inertia-redirect"),{...this.requestParams.all(),method:"get",data:{}});return}if(this.isLocationVisit()){const s=en(this.getHeader("x-inertia-location"));return Dm(this.requestParams.all().url,s),this.locationVisit(s)}const i={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(i)!==!1&&Om(i))return qv.show(i.data)}isInertiaResponse(){return this.hasHeader("x-inertia")}isHttpException(){return this.response.status>=400}hasStatus(i){return this.response.status===i}getHeader(i){return this.response.headers[i]}hasHeader(i){return this.getHeader(i)!==void 0}isInertiaRedirect(){return this.hasStatus(409)&&this.hasHeader("x-inertia-redirect")}isLocationVisit(){return this.hasStatus(409)&&this.hasHeader("x-inertia-location")}locationVisit(i){try{if(Rt.set(Rt.locationVisitKey,{preserveScroll:this.requestParams.all().preserveScroll===!0}),typeof window>"u")return;cu(window.location,i)?window.location.reload():window.location.href=i.href}catch{return!1}}async setPage(){const i=this.getPageResponse();return this.shouldSetPage(i)?(this.mergeProps(i),V.mergeOncePropsIntoResponse(i),this.preserveOptimisticProps(i),this.preserveEqualProps(i),await this.setRememberedState(i),this.requestParams.setPreserveOptions(i),i.url=De.preserveUrl?V.get().url:this.pageUrl(i),this.requestParams.all().onBeforeUpdate(i),Fy(i),V.set(i,{replace:this.requestParams.all().replace,preserveScroll:this.requestParams.all().preserveScroll,preserveState:this.requestParams.all().preserveState,viewTransition:this.requestParams.all().viewTransition})):Promise.resolve()}getDataFromResponse(i){if(typeof i!="string")return i;try{return JSON.parse(i)}catch{return i}}shouldSetPage(i){if(!this.requestParams.all().async||this.originatingPage.component!==i.component)return!0;if(this.originatingPage.component!==V.get().component)return!1;const s=en(this.originatingPage.url),c=en(V.get().url);return s.origin===c.origin&&s.pathname===c.pathname}pageUrl(i){const s=en(i.url);return i.preserveFragment?s.hash=this.requestParams.all().url.hash:Dm(this.requestParams.all().url,s),s.pathname+s.search+s.hash}preserveOptimisticProps(i){if(Ye.hasPendingOptimistic())for(const s of Object.keys(i.props))V.hasBaseline(s)&&(V.updateBaseline(s,i.props[s]),i.props[s]=V.get().props[s])}preserveEqualProps(i){if(i.component!==V.get().component)return;const s=V.get().props;Object.entries(i.props).forEach(([c,o])=>{gn(o,s[c])&&(i.props[c]=s[c])})}mergeProps(i){if(!this.requestParams.isPartial()||i.component!==V.get().component)return;const s=i.mergeProps||[],c=i.prependProps||[],o=i.deepMergeProps||[],p=i.matchPropsOn||[],h=(v,g)=>{const T=Ze(V.get().props,v),O=Ze(i.props,v);if(Array.isArray(O)){const q=this.mergeOrMatchItems(T||[],O,v,p,g);Ut(i.props,v,q)}else if(typeof O=="object"&&O!==null){const q={...T||{},...O};Ut(i.props,v,q)}};s.forEach(v=>h(v,!0)),c.forEach(v=>h(v,!1)),o.forEach(v=>{const g=Ze(V.get().props,v),T=Ze(i.props,v),O=(q,j,Q)=>Array.isArray(j)?this.mergeOrMatchItems(q,j,Q,p):typeof j=="object"&&j!==null?Object.keys(j).reduce((J,G)=>(J[G]=O(q?q[G]:void 0,j[G],`${Q}.${G}`),J),{...q}):j;Ut(i.props,v,O(g,T,v))});const m=new Set([...this.requestParams.all().only,...this.requestParams.all().except].filter(v=>v.includes(".")).map(v=>v.split(".")[0]));for(const v of m){const g=V.get().props[v];this.isObject(g)&&this.isObject(i.props[v])&&(i.props[v]=this.deepMergeObjects(g,i.props[v]))}i.props={...V.get().props,...i.props},this.shouldPreserveErrors(i)&&(i.props.errors=V.get().props.errors),V.get().scrollProps&&(i.scrollProps={...V.get().scrollProps||{},...i.scrollProps||{}}),V.hasOnceProps()&&(i.onceProps={...V.get().onceProps||{},...i.onceProps||{}}),this.requestParams.isDeferredPropsRequest()&&(i.flash={...V.get().flash});const S=V.get().initialDeferredProps;S&&Object.keys(S).length>0&&(i.initialDeferredProps=S),i.rescuedProps=this.mergeRescuedProps(i)}mergeRescuedProps(i){const s=V.get().rescuedProps??[],c=i.rescuedProps??[],o=new Set(s.filter(p=>!_p(this.requestParams.all(),p)));return c.forEach(p=>o.add(p)),Array.from(o)}shouldPreserveErrors(i){if(!this.requestParams.all().preserveErrors)return!1;const s=V.get().props.errors;if(!s||Object.keys(s).length===0)return!1;const c=i.props.errors;return!(c&&Object.keys(c).length>0)}isObject(i){return i&&typeof i=="object"&&!Array.isArray(i)}deepMergeObjects(i,s){const c={...i};for(const o of Object.keys(s)){const p=i[o],h=s[o];this.isObject(p)&&this.isObject(h)?c[o]=this.deepMergeObjects(p,h):c[o]=h}return c}mergeOrMatchItems(i,s,c,o,p=!0){const h=Array.isArray(i)?i:[],m=o.find(g=>g.split(".").slice(0,-1).join(".")===c);if(!m)return p?[...h,...s]:[...s,...h];const S=m.split(".").pop()||"",v=new Map;return s.forEach(g=>{this.hasUniqueProperty(g,S)&&v.set(g[S],g)}),p?this.appendWithMatching(h,s,v,S):this.prependWithMatching(h,s,v,S)}appendWithMatching(i,s,c,o){const p=i.map(m=>this.hasUniqueProperty(m,o)&&c.has(m[o])?c.get(m[o]):m),h=s.filter(m=>this.hasUniqueProperty(m,o)?!i.some(S=>this.hasUniqueProperty(S,o)&&S[o]===m[o]):!0);return[...p,...h]}prependWithMatching(i,s,c,o){const p=i.filter(h=>this.hasUniqueProperty(h,o)?!c.has(h[o]):!0);return[...s,...p]}hasUniqueProperty(i,s){return i&&typeof i=="object"&&s in i}async setRememberedState(i){const s=await De.getState(De.rememberedState,{});this.requestParams.all().preserveState&&s&&i.component===V.get().component&&(i.rememberedState=s)}getScopedErrors(i){return this.requestParams.all().errorBag?i[this.requestParams.all().errorBag||""]||{}:i}},Cm=class Hp{constructor(i,s,{optimistic:c=!1}={}){this.page=s,this.requestParams=kr.create(i),this.cancelToken=new AbortController,this.optimistic=c}response;cancelToken;requestParams;requestHasFinished=!1;optimistic;static create(i,s,c){return new Hp(i,s,c)}isPrefetch(){return this.requestParams.isPrefetch()}isOptimistic(){return this.optimistic}isPendingOptimistic(){return this.isOptimistic()&&(!this.response||!this.response.isProcessed())}async send(){this.requestParams.onCancelToken(()=>this.cancel({cancelled:!0})),ky(this.requestParams.all()),this.requestParams.onStart(),this.requestParams.all().prefetch&&(this.requestParams.onPrefetching(),ev(this.requestParams.all()));const i=this.requestParams.all().prefetch;return Rp.getClient().request({method:this.requestParams.all().method,url:su(this.requestParams.all().url).href,data:this.requestParams.data(),signal:this.cancelToken.signal,headers:this.getHeaders(),onUploadProgress:this.onProgress.bind(this)}).then(s=>(this.response=Hm.create(this.requestParams,s,this.page),this.response.handle())).catch(s=>s instanceof Kc?(this.response=Hm.create(this.requestParams,s.response,this.page),this.response.handle()):Promise.reject(s)).catch(s=>{if(!(s instanceof Pc)&&this.requestParams.all().onNetworkError(s)!==!1&&Py(s))return i&&this.requestParams.onPrefetchError(s),Promise.reject(s)}).finally(()=>{this.finish(),i&&this.response&&this.requestParams.onPrefetchResponse(this.response)})}finish(){this.requestParams.wasCancelledAtAll()||(this.requestParams.markAsFinished(),this.fireFinishEvents())}fireFinishEvents(){this.requestHasFinished||(this.requestHasFinished=!0,Jy(this.requestParams.all()),this.requestParams.onFinish())}cancel({cancelled:i=!1,interrupted:s=!1}){this.requestHasFinished||(this.cancelToken.abort(),this.requestParams.markAsCancelled({cancelled:i,interrupted:s}),this.fireFinishEvents())}onProgress(i){this.requestParams.data()instanceof FormData&&($y(i),this.requestParams.all().onProgress(i))}getHeaders(){const i={...this.requestParams.headers(),Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0},s=V.get();s.version&&(i["X-Inertia-Version"]=s.version);const c=Object.entries(s.onceProps||{}).filter(([,o])=>Ze(s.props,o.prop)===void 0?!1:!o.expiresAt||o.expiresAt>Date.now()).map(([o])=>o);return c.length>0&&(i["X-Inertia-Except-Once-Props"]=c.join(",")),i}},xm=class{requests=[];maxConcurrent;interruptible;constructor({maxConcurrent:l,interruptible:i}){this.maxConcurrent=l,this.interruptible=i}send(l){this.requests.push(l),l.send().finally(()=>{this.requests=this.requests.filter(i=>i!==l)})}interruptInFlight(){this.cancel({interrupted:!0},!1)}cancelInFlight({prefetch:l=!0,optimistic:i=!0}={}){this.requests.filter(s=>l||!s.isPrefetch()).filter(s=>i||!s.isOptimistic()).forEach(s=>s.cancel({cancelled:!0}))}cancel({cancelled:l=!1,interrupted:i=!1}={},s=!1){!s&&!this.shouldCancel()||this.requests.shift()?.cancel({cancelled:l,interrupted:i})}shouldCancel(){return this.interruptible&&this.requests.length>=this.maxConcurrent}hasPendingOptimistic(){return this.requests.some(l=>l.isPendingOptimistic())}},Nt=()=>{},Lv=class{syncRequestStream=new xm({maxConcurrent:1,interruptible:!0});asyncRequestStream=new xm({maxConcurrent:1/0,interruptible:!1});clientVisitQueue=new mu;pendingOptimisticCallback=void 0;init({initialPage:l,resolveComponent:i,swapComponent:s,onFlash:c}){V.init({initialPage:l,resolveComponent:i,swapComponent:s,onFlash:c}),Mv.handle(),pn.init(),pn.on("missingHistoryItem",()=>{typeof window<"u"&&this.visit(window.location.href,{preserveState:!0,preserveScroll:!0,replace:!0})}),pn.on("loadDeferredProps",o=>{this.loadDeferredProps(o)}),pn.on("historyQuotaExceeded",o=>{window.location.href=o})}optimistic(l){return this.pendingOptimisticCallback=l,this}get(l,i={},s={}){return this.visit(l,{...s,method:"get",data:i})}post(l,i={},s={}){return this.visit(l,{preserveState:!0,...s,method:"post",data:i})}put(l,i={},s={}){return this.visit(l,{preserveState:!0,...s,method:"put",data:i})}patch(l,i={},s={}){return this.visit(l,{preserveState:!0,...s,method:"patch",data:i})}delete(l,i={}){return this.visit(l,{preserveState:!0,...i,method:"delete"})}reload(l={}){return this.doReload(l)}doReload(l={}){if(!(typeof window>"u"))return this.visit(window.location.href,{...l,preserveScroll:!0,preserveState:!0,async:!0,headers:{...l.headers||{},"Cache-Control":"no-cache"}})}remember(l,i="default"){De.remember(l,i)}restore(l="default"){return De.restore(l)}on(l,i){return typeof window>"u"?()=>{}:pn.onGlobalEvent(l,i)}once(l,i){if(typeof window>"u")return()=>{};const s=this.on(l,c=>(s(),i(c)));return s}hasPendingOptimistic(){return this.asyncRequestStream.hasPendingOptimistic()}get activePolls(){return Rm.count}cancelAll({async:l=!0,prefetch:i=!0,sync:s=!0}={}){l&&this.asyncRequestStream.cancelInFlight({prefetch:i}),s&&this.syncRequestStream.cancelInFlight()}poll(l,i={},s={}){return Rm.add(l,({onStart:c,onFinish:o})=>{const p=typeof i=="function"?i():i;this.reload({preserveErrors:!0,...p,onCancelToken:h=>{c(h.cancel),p.onCancelToken?.(h)},onFinish:h=>{o(),p.onFinish?.(h)}})},{autoStart:s.autoStart??!0,keepAlive:s.keepAlive??!1,mode:s.mode})}visit(l,i={}){i.optimistic=i.optimistic??this.pendingOptimisticCallback,this.pendingOptimisticCallback=void 0,i.optimistic&&(i.async=i.async??!0);const s=this.getPendingVisit(l,{...i,showProgress:i.showProgress??(!i.async||!!i.optimistic)}),c=this.getVisitEvents(i);if(c.onBefore(s)===!1||!Tm(s))return;const o=en(V.get().url);(s.only.length>0||s.except.length>0||s.reset.length>0?Mp(s.url,o):cu(s.url,o))||this.asyncRequestStream.cancelInFlight({prefetch:!1,optimistic:!1}),s.async||this.syncRequestStream.interruptInFlight(),i.optimistic&&this.applyOptimisticUpdate(i.optimistic,c),!V.isCleared()&&!s.preserveUrl&&_t.save();const p={...s,...c},h=()=>{const m=mn.get(p);m?(tn.reveal(m.inFlight),mn.use(m,p)):(tn.reveal(!0),(s.async?this.asyncRequestStream:this.syncRequestStream).send(Cm.create(p,V.get(),{optimistic:!!i.optimistic})))};Array.isArray(s.component)&&(console.error(`The "component" prop received an array of components (${s.component.join(", ")}), but only a single component string is supported for instant visits. Pass an explicit component name instead.`),s.component=null),s.component?De.processQueue().then(()=>{this.performInstantSwap(s).then(()=>{p.preserveState=!0,p.replace=!0,p.viewTransition=!1,h()})}):h()}getCached(l,i={}){return mn.findCached(this.getPrefetchParams(l,i))}flush(l,i={}){mn.remove(this.getPrefetchParams(l,i))}flushAll(){mn.removeAll()}flushByCacheTags(l){mn.removeByTags(Array.isArray(l)?l:[l])}getPrefetching(l,i={}){return mn.findInFlight(this.getPrefetchParams(l,i))}prefetch(l,i={},s={}){if((i.method??(cn(l)?l.method:"get"))!=="get")throw new Error("Prefetch requests must use the GET method");const c=this.getPendingVisit(l,{...i,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1});if(c.url.origin+c.url.pathname+c.url.search===window.location.origin+window.location.pathname+window.location.search)return;const o=this.getVisitEvents(i);if(o.onBefore(c)===!1||!Tm(c))return;tn.hide(),this.asyncRequestStream.interruptInFlight();const p={...c,...o};new Promise(m=>{const S=()=>{V.get()?m():setTimeout(S,50)};S()}).then(()=>{mn.add(p,m=>{this.asyncRequestStream.send(Cm.create(m,V.get()))},{cacheFor:_l.get("prefetch.cacheFor"),cacheTags:[],...s})})}clearHistory(){De.clear()}decryptHistory(){return De.decrypt()}resolveComponent(l,i){return V.resolve(l,i)}replace(l){this.clientVisit(l,{replace:!0})}replaceProp(l,i,s){this.replace({preserveScroll:!0,preserveState:!0,props(c){const o=typeof i=="function"?i(Ze(c,l),c):i;return Ut(Pe(c),l,o)},...s||{}})}appendToProp(l,i,s){this.replaceProp(l,(c,o)=>{const p=typeof i=="function"?i(c,o):i;return Array.isArray(c)||(c=c!==void 0?[c]:[]),[...c,p]},s)}prependToProp(l,i,s){this.replaceProp(l,(c,o)=>{const p=typeof i=="function"?i(c,o):i;return Array.isArray(c)||(c=c!==void 0?[c]:[]),[p,...c]},s)}push(l){this.clientVisit(l)}flash(l,i){const s=V.get().flash;let c;if(typeof l=="function")c=l(s);else if(typeof l=="string")c={...s,[l]:i};else if(l&&Object.keys(l).length)c={...s,...l};else return;V.setFlash(c),Object.keys(c).length&&uu(c)}clientVisit(l,{replace:i=!1}={}){this.clientVisitQueue.add(()=>this.performClientVisit(l,{replace:i}))}performClientVisit(l,{replace:i=!1}={}){const s=V.get(),c=typeof l.props=="function"?Object.fromEntries(Object.values(s.onceProps??{}).map(Q=>[Q.prop,Ze(s.props,Q.prop)])):{},o=typeof l.props=="function"?l.props(s.props,c):l.props??s.props,p=typeof l.flash=="function"?l.flash(s.flash):l.flash,{viewTransition:h,onError:m,onFinish:S,onFlash:v,onSuccess:g,...T}=l,O={...s,...T,flash:p??{},props:o},q=kr.resolvePreserveOption(l.preserveScroll??!1,O),j=kr.resolvePreserveOption(l.preserveState??!1,O);return V.set(O,{replace:i,preserveScroll:q,preserveState:j,viewTransition:h}).then(()=>{const Q=V.get().flash;Object.keys(Q).length>0&&(uu(Q),v?.(Q));const J=V.get().props.errors||{};if(Object.keys(J).length===0){g?.(V.get());return}const G=l.errorBag?J[l.errorBag||""]||{}:J;m?.(G)}).finally(()=>S?.(l))}performInstantSwap(l){const i=V.get(),s=Object.fromEntries((i.sharedProps??[]).filter(h=>h in i.props).map(h=>[h,i.props[h]])),c=typeof l.pageProps=="function"?l.pageProps(Pe(i.props),Pe(s)):l.pageProps,o=c!==null?{...c}:{...s},p={component:l.component,url:l.url.pathname+l.url.search+l.url.hash,version:i.version,props:{...o,errors:{}},flash:{},rescuedProps:[],clearHistory:!1,encryptHistory:i.encryptHistory,sharedProps:i.sharedProps,rememberedState:{}};return V.set(p,{replace:l.replace,preserveScroll:kr.resolvePreserveOption(l.preserveScroll,p),preserveState:!1,viewTransition:l.viewTransition})}getPrefetchParams(l,i){return{...this.getPendingVisit(l,{...i,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1}),...this.getVisitEvents(i)}}getPendingVisit(l,i){if(cn(l)){const S=l;l=S.url,i.method=i.method??S.method}const s=_l.get("visitOptions"),c=s?s(l.toString(),Pe(i))||{}:{},o={method:"get",data:{},replace:!1,preserveScroll:!1,preserveState:!1,only:[],except:[],headers:{},errorBag:"",forceFormData:!1,queryStringArrayFormat:"brackets",async:!1,showProgress:!0,fresh:!1,reset:[],preserveUrl:!1,preserveErrors:!1,prefetch:!1,invalidateCacheTags:[],viewTransition:!1,component:null,pageProps:null,...wm(i),...wm(c)},[p,h]=bv(l,o.data,o.method,o.forceFormData,o.queryStringArrayFormat),m={cancelled:!1,completed:!1,interrupted:!1,...o,url:p,data:h};return m.prefetch&&(m.headers.Purpose="prefetch"),m}getVisitEvents(l){return{onCancelToken:l.onCancelToken||Nt,onBefore:l.onBefore||Nt,onBeforeUpdate:l.onBeforeUpdate||Nt,onStart:l.onStart||Nt,onProgress:l.onProgress||Nt,onFinish:l.onFinish||Nt,onCancel:l.onCancel||Nt,onSuccess:l.onSuccess||Nt,onError:l.onError||Nt,onHttpException:l.onHttpException||Nt,onNetworkError:l.onNetworkError||Nt,onFlash:l.onFlash||Nt,onPrefetched:l.onPrefetched||Nt,onPrefetching:l.onPrefetching||Nt}}applyOptimisticUpdate(l,i){const s=V.get().props,c=l(Pe(s));if(!c)return;const o=[];for(const g of Object.keys(c))gn(s[g],c[g])||o.push(g);if(o.length===0)return;const p=V.nextOptimisticId(),h=V.get().component;for(const g of o)V.setBaseline(g,Pe(s[g]));V.registerOptimistic(p,l),V.setPropsQuietly({...s,...c});let m=!0;const S=i.onSuccess;i.onSuccess=g=>(m=!1,S(g));const v=i.onFinish;i.onFinish=g=>{if(V.unregisterOptimistic(p),m&&V.get().component===h){const T=V.replayOptimistics();Object.keys(T).length>0&&V.setPropsQuietly({...V.get().props,...T})}return V.pendingOptimisticCount()===0&&V.clearOptimisticState(),v(g)}}loadDeferredProps(l){l&&Object.values(l).forEach(i=>{this.doReload({only:i,deferredProps:!0,preserveErrors:!0})})}},ou=class{static createWayfinderCallback(...l){return()=>l.length===1?cn(l[0])?l[0]:l[0]():{method:typeof l[0]=="function"?l[0]():l[0],url:typeof l[1]=="function"?l[1]():l[1]}}static parseUseFormArguments(...l){return l.length===0?{rememberKey:null,data:{},precognitionEndpoint:null}:l.length===1?{rememberKey:null,data:l[0],precognitionEndpoint:null}:l.length===2?typeof l[0]=="string"?{rememberKey:l[0],data:l[1],precognitionEndpoint:null}:{rememberKey:null,data:l[1],precognitionEndpoint:this.createWayfinderCallback(l[0])}:{rememberKey:null,data:l[2],precognitionEndpoint:this.createWayfinderCallback(l[0],l[1])}}static parseSubmitArguments(l,i){return l.length===3||l.length===2&&typeof l[0]=="string"?{method:l[0],url:l[1],options:l[2]??{}}:cn(l[0])?{...l[0],options:l[1]??{}}:{...i(),options:l[0]??{}}}static mergeHeadersForValidation(l,i,s){const c=o=>(o.headers={...s??{},...o.headers??{}},o);return l&&typeof l=="object"&&!("target"in l)?l=c(l):i&&typeof i=="object"?i=c(i):typeof l=="string"?i=c(i??{}):l=c(l??{}),[l,i]}};function Yv(l){if(!l.includes("."))return l;const i=s=>s.startsWith("[")&&s.endsWith("]")?s:s.split(".").reduce((c,o,p)=>p===0?o:`${c}[${o}]`);return l.replace(/\\\./g,"__ESCAPED_DOT__").split(/(\[[^\]]*\])/).filter(Boolean).map(i).join("").replace(/__ESCAPED_DOT__/g,".")}function Xv(l){const i=[],s=/([^\[\]]+)|\[(\d*)\]/g;let c;for(;(c=s.exec(l))!==null;)c[1]!==void 0?i.push(c[1]):c[2]!==void 0&&i.push(c[2]===""?"":Number(c[2]));return i}function Qv(l,i,s){let c=l;for(let o=0;o/^\d+$/.test(c)).map(Number).sort((c,o)=>c-o);return i.length===s.length&&s.length>0&&s[0]===0&&s.every((c,o)=>c===o)}function Ir(l){if(Array.isArray(l))return l.map(Ir);if(typeof l!="object"||l===null||fo(l))return l;if(Gv(l)){const s=[];for(let c=0;c/^\d+$/.test(S)).map(Number).sort((S,v)=>S-v);Ut(i,p,m.length>0?[...m.map(S=>h[S]),c]:[c])}else Ut(i,p,[c]);continue}Qv(i,o.map(String),c)}return Ir(i)}var Vv={buildDOMElement(l){const i=document.createElement("template");i.innerHTML=l;const s=i.content.firstChild;if(!l.startsWith("