1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,935108,79689,929442,954472,e=>{"use strict";var t=e.i(665044);e.s(["inferAdditionalFields",0,e=>({id:"additional-fields-client",version:t.PACKAGE_VERSION,$InferServerPlugin:{}})],935108);let r=(0,e.i(426241).defineErrorCodes)({CHALLENGE_NOT_FOUND:"Challenge not found",YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:"You are not allowed to register this passkey",FAILED_TO_VERIFY_REGISTRATION:"Failed to verify registration",PASSKEY_NOT_FOUND:"Passkey not found",AUTHENTICATION_FAILED:"Authentication failed",UNABLE_TO_CREATE_SESSION:"Unable to create session",USER_NOT_FOUND:"User not found",FAILED_TO_UPDATE_PASSKEY:"Failed to update passkey",PREVIOUSLY_REGISTERED:"Previously registered",REGISTRATION_CANCELLED:"Registration cancelled",AUTH_CANCELLED:"Auth cancelled",UNKNOWN_ERROR:"Unknown error",SESSION_REQUIRED:"Passkey registration requires an authenticated session",RESOLVE_USER_REQUIRED:"Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false",RESOLVED_USER_INVALID:"Resolved user is invalid"});function a(e){let t=new Uint8Array(e),r="";for(let e of t)r+=String.fromCharCode(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function o(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,a=atob(t.padEnd(t.length+r,"=")),o=new ArrayBuffer(a.length),n=new Uint8Array(o);for(let e=0;e<a.length;e++)n[e]=a.charCodeAt(e);return o}function n(){return i.stubThis(globalThis?.PublicKeyCredential!==void 0&&"function"==typeof globalThis.PublicKeyCredential)}let i={stubThis:e=>e};function s(e){let{id:t}=e;return{...e,id:o(t),transports:e.transports}}function l(e){return"localhost"===e||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}class u extends Error{constructor({message:e,code:t,cause:r,name:a}){super(e,{cause:r}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a??r.name,this.code=t}}let c=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},d=["cross-platform","platform"];function h(e){if(e&&!(0>d.indexOf(e)))return e}async function p(e){let t,r,i,d,p;!e.optionsJSON&&e.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:m,useAutoRegister:f=!1}=e;if(!n())throw Error("WebAuthn is not supported in this browser");let w={...m,challenge:o(m.challenge),user:{...m.user,id:o(m.user.id)},excludeCredentials:m.excludeCredentials?.map(s)},b={};f&&(b.mediation="conditional"),b.publicKey=w,b.signal=c.createNewAbortSignal();try{t=await navigator.credentials.create(b)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new u({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(r.authenticatorSelection?.requireResidentKey===!0)return new u({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&r.authenticatorSelection?.userVerification==="required")return new u({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if(r.authenticatorSelection?.userVerification==="required")return new u({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new u({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new u({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new u(0===r.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!l(t))return new u({message:`${globalThis.location.hostname}
1 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rp.id!==t)return new u({message:`The RP ID "${r.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new u({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new u({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:b})}if(!t)throw Error("Registration was not completed");let{id:y,rawId:E,response:R,type:v}=t;if("function"==typeof R.getTransports&&(i=R.getTransports()),"function"==typeof R.getPublicKeyAlgorithm)try{d=R.getPublicKeyAlgorithm()}catch(e){g("getPublicKeyAlgorithm()",e)}if("function"==typeof R.getPublicKey)try{let e=R.getPublicKey();null!==e&&(p=a(e))}catch(e){g("getPublicKey()",e)}if("function"==typeof R.getAuthenticatorData)try{r=a(R.getAuthenticatorData())}catch(e){g("getAuthenticatorData()",e)}return{id:y,rawId:a(E),response:{attestationObject:a(R.attestationObject),clientDataJSON:a(R.clientDataJSON),transports:i,publicKeyAlgorithm:d,publicKey:p,authenticatorData:r},type:v,clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:h(t.authenticatorAttachment)}}function g(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them. 2`,t)}let m=e=>e;async function f(e){let t,r,i;!e.optionsJSON&&e.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:d,useBrowserAutofill:p=!1,verifyBrowserAutofillInput:g=!0}=e;if(!n())throw Error("WebAuthn is not supported in this browser");d.allowCredentials?.length!==0&&(t=d.allowCredentials?.map(s));let f={...d,challenge:o(d.challenge),allowCredentials:t},w={};if(p){if(!await function(){if(!n())return m(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?m(new Promise(e=>e(!1))):m(e.isConditionalMediationAvailable())}())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&g)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');w.mediation="conditional",f.allowCredentials=[]}w.publicKey=f,w.signal=c.createNewAbortSignal();try{r=await navigator.credentials.get(w)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new u({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new u({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!l(t))return new u({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new u({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new u({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:w})}if(!r)throw Error("Authentication was not completed");let{id:b,rawId:y,response:E,type:R}=r;return E.userHandle&&(i=a(E.userHandle)),{id:b,rawId:a(y),response:{authenticatorData:a(E.authenticatorData),clientDataJSON:a(E.clientDataJSON),signature:a(E.signature),userHandle:i},type:R,clientExtensionResults:r.getClientExtensionResults(),authenticatorAttachment:h(r.authenticatorAttachment)}}var w=e.i(331127),b=e.i(761687);e.s(["passkeyClient",0,()=>{let e=(0,b.atom)();
2return{id:"passkey",version:"1.7.2",$InferServerPlugin:{},getActions:(t,a)=>((e,{$listPasskeys:t,$store:a})=>({signIn:{passkey:async(o,n)=>{let i,s=await e("/passkey/generate-authenticate-options",{method:"GET",throw:!1});if(!s.data)return s;let l=s.data.extensions||o?.extensions?{...s.data.extensions||{},...o?.extensions||{}}:void 0;try{i=await f({optionsJSON:{...s.data,extensions:l},useBrowserAutofill:o?.autoFill})}catch(e){return{data:null,error:{code:e instanceof u?e.code:"AUTH_CANCELLED",message:r.AUTH_CANCELLED.message,status:400,statusText:"BAD_REQUEST"}}}try{let{clientExtensionResults:r,...s}=i,l=await e("/passkey/verify-authentication",{body:{response:s},...o?.fetchOptions,...n,method:"POST",throw:!1});if(t.set(Math.random()),a.notify("$sessionSignal"),o?.returnWebAuthnResponse)return{...l,webauthn:{response:i,clientExtensionResults:r}};return l}catch(e){return console.error("[Better Auth] Error verifying passkey",e),{data:null,error:{code:"AUTH_CANCELLED",message:r.AUTH_CANCELLED.message,status:400,statusText:"BAD_REQUEST"}}}}},passkey:{addPasskey:async(o,n)=>{let i=await e("/passkey/generate-register-options",{method:"GET",query:{...o?.authenticatorAttachment&&{authenticatorAttachment:o.authenticatorAttachment},...o?.name&&{name:o.name},...o?.context&&{context:o.context}},throw:!1});if(!i.data)return i;try{let r=i.data.extensions||o?.extensions?{...i.data.extensions||{},...o?.extensions||{}}:void 0,s=await p({optionsJSON:{...i.data,extensions:r},useAutoRegister:o?.useAutoRegister}),{clientExtensionResults:l,...u}=s,c=await e("/passkey/verify-registration",{...o?.fetchOptions,...n,body:{response:u,name:o?.name,...o?.createSession&&{createSession:!0}},method:"POST",throw:!1});if(!c.data)return c;if(t.set(Math.random()),c.data.session&&a.notify("$sessionSignal"),o?.returnWebAuthnResponse)return{...c,webauthn:{response:s,clientExtensionResults:l}};return c}catch(e){if(e instanceof u){if("ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED"===e.code)return{data:null,error:{code:e.code,message:r.PREVIOUSLY_REGISTERED.message,status:400,statusText:"BAD_REQUEST"}};if("ERROR_CEREMONY_ABORTED"===e.code)return{data:null,error:{code:e.code,message:r.REGISTRATION_CANCELLED.message,status:400,statusText:"BAD_REQUEST"}};return{data:null,error:{code:e.code,message:e.message,status:400,statusText:"BAD_REQUEST"}}}return{data:null,error:{code:"UNKNOWN_ERROR",message:e instanceof Error?e.message:r.UNKNOWN_ERROR.message,status:500,statusText:"INTERNAL_SERVER_ERROR"}}}}},$Infer:{}}))(t,{$listPasskeys:e,$store:a}),getAtoms:t=>({listPasskeys:(0,w.useAuthQuery)(e,"/passkey/list-user-passkeys",t,{method:"GET"}),$listPasskeys:e}),pathMethods:{"/passkey/register":"POST","/passkey/authenticate":"POST"},atomListeners:[{matcher:e=>"/passkey/verify-registration"===e||"/passkey/delete-passkey"===e||"/passkey/update-passkey"===e||"/sign-out"===e,signal:"$listPasskeys"},{matcher:e=>"/passkey/verify-authentication"===e,signal:"$sessionSignal"}],$ERROR_CODES:r}}],79689),e.i(246230);var y=e.i(292743);let E=/^[A-Za-z0-9_-]{1,128}$/,R=/^[A-Za-z0-9_-]{1,64}$/,v=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,I=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,O=/^\+?[0-9 ()-]{3,32}$/,A=/^[A-Za-z0-9]{4,12}$/,T=new Set(["accesstoken","authorization","cookie","headers","idtoken","oauthcode","password","refreshtoken","secret","sessiontoken","setcookie","token","codeverifier"]);function S(e,t){if(!("object"==typeof e&&null!==e&&!Array.isArray(e)))throw Error(`${t} must be an object`);return e}function z(e,t){let r=new Set(t);for(let t of Object.keys(e))if(!r.has(t))throw Error(`Unexpected desktop auth field: ${t}`)}function k(e,t,{max:r=256,min:a=1,pattern:o}={}){if("string"!=typeof e||e.length<a||e.length>r||o&&!o.test(e))throw Error(`${t} is invalid`);return e}function D(e,t,r){return void 0===e?void 0:k(e,t,r)}function P(e,t){return k(e,t,{max:128,pattern:E})}function U(e,t){return void 0===e?void 0:P(e,t)}function C(e,t){return k(e,t,{max:320,pattern:I})}function _(e){if(Array.isArray(e)){if(0===e.length||e.length>16)throw Error("Role list is invalid");return e.map(e=>k(e,"Role",{max:64,pattern:R}))}return k(e,"Role",{max:64,pattern:R})}function N(e){return void 0===e?void 0:function e(t,r=0){if(r>8)throw Error("Desktop auth metadata is too deeply nested");if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t&&Number.isFinite(t))return t;if(Array.isArray(t)){if(t.length>128)throw Error("Desktop auth metadata array is too large");return t.map(t=>e(t,r+1))}let a=Object.entries(S(t,"Desktop auth metadata"));if(a.length>128)throw Error("Desktop auth metadata object is too large");return Object.fromEntries(a.map(([t,a])=>{let o;if(0===t.length||t.length>128||(o=t.replace(/[^a-z]/gi,"").toLowerCase(),T.has(o)||o.includes("authorization")||o.includes("cookie")||o.includes("password")||o.includes("secret")||o.includes("token")))throw Error("Desktop auth metadata contains a forbidden key");return[t,e(a,r+1)]}))}(e)}function L(e){if(!(0,y.isConfiguredLocale)(e))throw Error("Desktop auth locale is invali
2d");return e}function x(e,t){return t?{...e,locale:t}:e}function q(e,t){if(null==e)return e;let r=k(e,t,{max:196608,min:0});if(0===r.length||/^data:image\/(?:jpeg|png|webp);base64,[A-Za-z0-9+/=]+$/.test(r))return r;let a=new URL(r);if("https:"!==a.protocol||a.username||a.password)throw Error(`${t} is invalid`);return r}function $(e,t){if(void 0!==e){if("boolean"!=typeof e)throw Error(`${t} is invalid`);return e}}function j(e,t,r,a=0){if(void 0!==e){if("number"!=typeof e||!Number.isSafeInteger(e)||e<a||e>r)throw Error(`${t} is invalid`);return e}}function B(e){var t;let r;try{r=JSON.stringify(e)}catch{throw Error("Desktop auth payload is not serializable")}if(new TextEncoder().encode(r).byteLength>262144)throw Error("Desktop auth payload is too large");let a=S(e,"Desktop auth payload"),o=k(a.operation,"Desktop auth operation",{max:64}),n=void 0===(t=a.locale)?void 0:L(t),i=["operation","locale"];switch(o){case"account.list":case"organization.getActiveMember":case"organization.list":case"passkey.list":case"session.get":return z(a,i),x({operation:o},n);case"account.unlink":{z(a,[...i,"accountId","providerId"]);let e=U(a.accountId,"Account ID");return x({...e?{accountId:e}:{},operation:o,providerId:k(a.providerId,"Provider ID",{max:64,pattern:R})},n)}case"emailOtp.changeEmail":return z(a,[...i,"newEmail","otp"]),x({newEmail:C(a.newEmail,"New email"),operation:o,otp:k(a.otp,"Email OTP",{max:12,pattern:A})},n);case"emailOtp.requestEmailChange":return z(a,[...i,"newEmail"]),x({newEmail:C(a.newEmail,"New email"),operation:o},n);case"emailOtp.sendVerification":if(z(a,[...i,"email","type"]),"email-verification"!==a.type)throw Error("Email OTP type is invalid");return x({email:C(a.email,"Email"),operation:o,type:a.type},n);case"emailOtp.verifyEmail":return z(a,[...i,"email","otp"]),x({email:C(a.email,"Email"),operation:o,otp:k(a.otp,"Email OTP",{max:12,pattern:A})},n);case"organization.acceptInvitation":case"organization.cancelInvitation":return z(a,[...i,"invitationId"]),x({invitationId:P(a.invitationId,"Invitation ID"),operation:o},n);case"organization.checkSlug":return z(a,[...i,"slug"]),x({operation:o,slug:k(a.slug,"Organization slug",{max:128,pattern:v})},n);case"organization.create":{z(a,[...i,"logo","metadata","name","slug","type"]);let e=q(a.logo,"Organization logo"),t=N(a.metadata);return x({...void 0!==e?{logo:e}:{},...void 0!==t?{metadata:t}:{},name:k(a.name,"Organization name",{max:256}),operation:o,slug:k(a.slug,"Organization slug",{max:128,pattern:v}),type:function(e){if("business"!==e&&"driver"!==e&&"fleet"!==e&&"personal"!==e)throw Error("Organization type is invalid");return e}(a.type)},n)}case"organization.getFull":{z(a,[...i,"membersLimit","organizationId"]);let e=U(a.organizationId,"Organization ID"),t=j(a.membersLimit,"Member limit",500,1);return x({...void 0!==t?{membersLimit:t}:{},operation:o,...e?{organizationId:e}:{}},n)}case"organization.listInvitations":{z(a,[...i,"organizationId"]);let e=U(a.organizationId,"Organization ID");return x({...e?{organizationId:e}:{},operation:o},n)}case"organization.inviteMember":{z(a,[...i,"email","organizationId","resend","role"]);let e=U(a.organizationId,"Organization ID"),t=$(a.resend,"Invitation resend");return x({email:C(a.email,"Invitation email"),operation:o,...e?{organizationId:e}:{},...void 0!==t?{resend:t}:{},role:_(a.role)},n)}case"organization.listMembers":{z(a,[...i,"limit","offset","organizationId","sortBy","sortDirection"]);let e=U(a.organizationId,"Organization ID"),t=j(a.limit,"Member limit",500,1),r=j(a.offset,"Member offset",1e5),s=function(e){if(void 0!==e){if("createdAt"!==e)throw Error("Member sort field is invalid");return e}}(a.sortBy),l=function(e){if(void 0!==e){if("asc"!==e&&"desc"!==e)throw Error("Member sort direction is invalid");return e}}(a.sortDirection);if(void 0===s!=(void 0===l))throw Error("Member sort field and direction must be provided together");return x({...void 0!==t?{limit:t}:{},...void 0!==r?{offset:r}:{},operation:o,...e?{organizationId:e}:{},...s?{sortBy:s}:{},...l?{sortDirection:l}:{}},n)}case"password.change":{z(a,[...i,"currentPassword","newPassword","revokeOtherSessions"]);let e=$(a.revokeOtherSessions,"Revoke other sessions");return x({currentPassword:k(a.currentPassword,"Current password",{max:128,min:8}),newPassword:k(a.newPassword,"New password",{max:128,min:8}),operation:o,...void 0!==e?{revokeOtherSessions:e}:{}},n)}case"password.requestReset":return z(a,[...i,"email","redirectTo"]),x({email:C(a.email,"Password reset email"),operation:o,redirectTo:k(a.redirectTo,"Password reset redirect",{max:2048})},n);case"organization.removeMember":{z(a,[...i,"memberIdOrEmail","organizationId"]);let e="string"==typeof a.memberIdOrEmail&&a.memberIdOrEmail.includes("@")?C(a.memberIdOrEmail,"Member email"):P(a.memberIdOrEmail,"Member ID"),t=U(a.organizationId,"Organization ID");return x({memberIdOrEmail:e,operation:o,...t?{organizationId:t}:{}},n)}case"organization.update":{z(a,[...i,"data","organizationId"]);let e=S(a.data,"Organization update");z(e,["logo","metadata","name","slug"]);let t=q(e.logo,"Organization logo"),r=N(e.metadata),s=D(e.name,"Organization name",{max:256}),l=D(e.slug,"Organization slug",{max:128,pattern:v});if(void 0===t&&void 0===r&&void 0===s&&void 0===l)throw Error("Organization update is empty");return x({data:{...void 0!==t?{logo:t}:{},...void 0!==r?{metadata:r}:{},...void 0!==s?{name:s}:{},...void 0!==l?{slug:l}:{}},operation:o,organizationId:P(a.organizationId,"Organization ID")},n)}case"organization.updateMemberRole":{z(a,[...i,"memberId","organizationId","role"]);let e=U(a.organizationId,"Organization ID");return x({memberId:P(a.memberId,"Member ID"),operation:o,...e?{organizationId:e}:{},role:_(a.role)},n)}case"passkey.delete":return z(a,[...i,"id"]),x({id:P(a.id,"Passkey ID"),operation:o},n);case"phone.sendOtp":return z(a,[...i,"phoneNumber"]),x({operation:o,phoneNumber:k(a.phoneNumber,"Phone number",{max:32,pattern:O})},n);case"phone.verify":if(z(a,[...i,"code","phoneNumber","updatePhoneNumber"]),!0!==a.updatePhoneNumber)throw Error("Phone verification must update the current user");return x({code:k(a.code,"Phone OTP",{max:12,pattern:A}),operation:o,phoneNumber:k(a.phoneNumber,"Phone number",{max:32,pattern:O}),updatePhoneNumber:!0},n);case"user.delete":{z(a,[...i,"callbackURL"]);
2let e=k(a.callbackURL,"Account deletion callback",{max:2048}),t=new URL(e),r="https:"===t.protocol,s="http:"===t.protocol&&"localhost"===t.hostname;if(!r&&!s||t.username||t.password||t.hash)throw Error("Account deletion callback is invalid");return x({callbackURL:e,operation:o},n)}case"user.update":{z(a,[...i,"image","name"]);let e=q(a.image,"User image"),t=D(a.name,"User name",{max:256});if(void 0===e&&void 0===t)throw Error("User update is empty");return x({...void 0!==e?{image:e}:{},...void 0!==t?{name:t}:{},operation:o},n)}default:throw Error("Unsupported desktop auth operation")}}e.s(["parseDashboardAuthLocale",0,L,"parseDashboardAuthOperationRequest",0,B],929442);let H="/auth/api";async function K(e,t){let r,a="";if("string"==typeof t?.body)a=t.body;else if(t?.body instanceof URLSearchParams)throw Error("Desktop auth requires JSON request bodies");else if(t?.body!=null)throw Error("Desktop auth requires a bounded JSON request body");else e instanceof Request&&e.body&&(a=await e.clone().text());if(!a)return{};if(new TextEncoder().encode(a).byteLength>262144)throw Error("Desktop auth request body is too large");try{r=JSON.parse(a)}catch{throw Error("Desktop auth request body is not valid JSON")}var o=r;if(!("object"==typeof o&&null!==o&&!Array.isArray(o)))throw Error("Desktop auth request body must be an object");return o}function M(e,t){if(e!==t)throw Error("Desktop auth request method is not allowed")}function F(e,t){let r=new Set(t),a=new Set;for(let t of e.searchParams.keys()){if(!r.has(t))throw Error(`Unexpected desktop auth query field: ${t}`);if(a.has(t))throw Error(`Repeated desktop auth query field: ${t}`);a.add(t)}}function G(e,t){let r=e.searchParams.get(t);if(null!==r){if(!/^\d+$/.test(r))throw Error(`Desktop auth ${t} is invalid`);return Number(r)}}function W(e,t=200,r){return new Response(JSON.stringify(e),{headers:{"Content-Type":"application/json"},status:t,...r?{statusText:r}:{}})}async function V(e,t){let r,a,o=e instanceof Request?new URL(e.url):new URL(e.toString());if("https://dashboard-auth.invalid"!==o.origin||o.username||o.password||o.hash)throw Error("Desktop auth request escaped its fixed boundary");if(!o.pathname.startsWith(`${H}/`))throw Error("Desktop auth request escaped its fixed path boundary");let n=o.pathname.slice(H.length),i=(t?.method??(e instanceof Request?e.method:"GET")).toUpperCase(),s=(r=new Headers(e instanceof Request?e.headers:void 0),t?.headers&&new Headers(t.headers).forEach((e,t)=>r.set(t,e)),a=r.get("accept-language")?.trim().toLowerCase(),a?.startsWith("de")?"de":a?.startsWith("en")?"en":void 0),l=s?{locale:s}:{};if("/sign-out"===n){if(M(i,"POST"),F(o,[]),Object.keys(await K(e,t)).length>0)throw Error("Desktop sign-out does not accept a payload");return{kind:"sign-out"}}if("/organization/set-active"===n){M(i,"POST"),F(o,[]);let r=await K(e,t);if(Object.keys(r).some(e=>"organizationId"!==e&&"organizationSlug"!==e))throw Error("Unexpected desktop organization switch field");let a=B({...l,operation:"organization.getFull",organizationId:r.organizationId});if("organization.getFull"!==a.operation||!a.organizationId)throw Error("Desktop organization switch requires an organization ID");return{kind:"switch-organization",organizationId:a.organizationId}}let u=await (async()=>{switch(n){case"/get-session":return M(i,"GET"),F(o,["disableCookieCache"]),B({...l,operation:"session.get"});case"/list-accounts":return M(i,"GET"),F(o,[]),B({...l,operation:"account.list"});case"/unlink-account":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"account.unlink"});case"/update-user":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"user.update"});case"/delete-user":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"user.delete"});case"/email-otp/send-verification-otp":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"emailOtp.sendVerification"});case"/email-otp/verify-email":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"emailOtp.verifyEmail"});case"/email-otp/request-email-change":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"emailOtp.requestEmailChange"});case"/email-otp/change-email":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"emailOtp.changeEmail"});case"/phone-number/send-otp":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"phone.sendOtp"});
2case"/phone-number/verify":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"phone.verify"});case"/organization/list":return M(i,"GET"),F(o,[]),B({...l,operation:"organization.list"});case"/organization/get-full-organization":return M(i,"GET"),F(o,["membersLimit","organizationId"]),B({...l,operation:"organization.getFull",...o.searchParams.has("membersLimit")?{membersLimit:G(o,"membersLimit")}:{},...o.searchParams.get("organizationId")?{organizationId:o.searchParams.get("organizationId")}:{}});case"/organization/get-active-member":return M(i,"GET"),F(o,[]),B({...l,operation:"organization.getActiveMember"});case"/organization/list-members":return M(i,"GET"),F(o,["limit","offset","organizationId","sortBy","sortDirection"]),B({...l,operation:"organization.listMembers",...o.searchParams.get("organizationId")?{organizationId:o.searchParams.get("organizationId")}:{},...o.searchParams.has("limit")?{limit:G(o,"limit")}:{},...o.searchParams.has("offset")?{offset:G(o,"offset")}:{},...o.searchParams.get("sortBy")?{sortBy:o.searchParams.get("sortBy")}:{},...o.searchParams.get("sortDirection")?{sortDirection:o.searchParams.get("sortDirection")}:{}});case"/organization/list-invitations":return M(i,"GET"),F(o,["organizationId"]),B({...l,operation:"organization.listInvitations",...o.searchParams.get("organizationId")?{organizationId:o.searchParams.get("organizationId")}:{}});case"/organization/create":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.create"});case"/organization/update":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.update"});case"/organization/check-slug":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.checkSlug"});case"/organization/invite-member":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.inviteMember"});case"/organization/cancel-invitation":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.cancelInvitation"});case"/organization/update-member-role":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.updateMemberRole"});case"/organization/remove-member":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.removeMember"});case"/organization/accept-invitation":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"organization.acceptInvitation"});case"/passkey/list-user-passkeys":return M(i,"GET"),F(o,[]),B({...l,operation:"passkey.list"});case"/passkey/delete-passkey":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"passkey.delete"});case"/request-password-reset":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"password.requestReset"});case"/change-password":return M(i,"POST"),F(o,[]),B({...l,...await K(e,t),operation:"password.change"});case"/link-social":case"/passkey/generate-register-options":case"/passkey/verify-registration":return null;default:throw Error("Unsupported desktop auth endpoint")}})();return u?{kind:"operation",request:u}:{kind:"unsupported"}}e.s(["createDesktopAuthFetch",0,function(e){return async(t,r)=>{let a;r?.signal?.throwIfAborted();let o=await V(t,r);if("unsupported"===o.kind)return W({code:"DESKTOP_AUTH_OPERATION_UNSUPPORTED",message:"This authentication operation is not available in the desktop app."},501,"Not Implemented");if("sign-out"===o.kind)return await e.signOut(),W(null);if("switch-organization"===o.kind)return await e.switchOrganization(o.organizationId),W(null);try{a=await e.executeOperation(o.request)}catch{return W({code:"DESKTOP_AUTH_BRIDGE_UNAVAILABLE",message:"The desktop authentication service is unavailable."},503,"Service Unavailable")}return(r?.signal?.throwIfAborted(),a.ok)?W(a.data):W({code:a.error.code,message:a.error.message},a.error.status,a.error.statusText)}}],954472)},360503,929184,73898,673549,883053,e=>{"use strict";var t=e.i(229291),r=e.i(777853),a=e.i(131274),o=e.i(636807),n=e.i(68959);e.i(246230);var i=e.i(292743),s=e.i(262765),l=e.i(238983),u=e.i(876992),c=e.i(678739),d=e.i(398624),h=e.i(935108),p=e.i(296743),g=e.i(345775),m=e.i(79689),f=e.i(264212),w=e.i(954472),b=e.i(166157),y=e.i(591767),E=e.i(322690);let R="maxmove.dashboard.correlation_id",v=null;function I(){if(v)return v;try{let e=window.sessionStorage.getItem(R);if(e)return v=e,e}catch{}let e="u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`dashboard-${Date.now()}-${Math.random().toString(16).slice(2)}`;v=e;try{window.sessionStorage.setItem(R,e)}catch{}return e}e.s(["getCorrelationId",0,I,"resetCorrelationId",0,function(){v=null;try{window.sessionStorage.removeItem(R)}catch{}}],929184);let O="https://dashboard-auth.invalid/auth/api",A=(0,f.createAuthClient)({baseURL:O,sessionOptions:{refetchOnWindowFocus:!1},fetchOptions:{credentials:"include",customFetchImpl:async(e,t)=>{var r;let a=new Headers(e instanceof Request?e.headers:void 0);
2t?.headers&&new Headers(t.headers).forEach((e,t)=>a.set(t,e));let o=(0,c.resolveRuntimeBrowserAuthLocale)({supportedLocales:(0,i.configuredLocales)()});(0,c.applyAuthLocaleHeaders)(a,o),a.set("X-Correlation-Id",I());let n=(0,b.getDashboardPlatform)();if("desktop"===n.surface){let r=n.auth.executeOperation;if(!r)throw Error("The desktop authentication operation bridge is unavailable");return(0,w.createDesktopAuthFetch)({executeOperation:e=>r(e),signOut:()=>n.auth.signOut(),switchOrganization:e=>n.auth.switchOrganization(e)})(e,{...t,headers:a})}return globalThis.fetch((r=(0,E.getDashboardRuntimeConfig)().authBaseUrl,(0,y.rebaseFixedRequestUrl)(e,O,r)),{...!(e instanceof Request)?{}:{...e.body&&"GET"!==e.method&&"HEAD"!==e.method?{body:e.body}:{},method:e.method,signal:e.signal},...t,credentials:"include",headers:a,redirect:"error",referrerPolicy:"no-referrer"})}},plugins:[(0,h.inferAdditionalFields)(),(0,p.organizationClient)({ac:l.ac,roles:l.roles,schema:(0,p.inferOrgAdditionalFields)(u.organizationSchema)}),(0,d.emailOTPClient)(),(0,g.phoneNumberClient)(),(0,m.passkeyClient)()]}),{useSession:T}=A;function S(){let e=A.$store.atoms.$sessionSignal;if(!e)throw Error("Better Auth session signal is unavailable");return e}e.s(["authClient",0,A,"getDashboardAuthSessionSignal",0,S,"invalidateDashboardAuthSession",0,function(){S(),A.$store.notify("$sessionSignal")}],73898);let z=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function k(e){if(!("string"==typeof e&&z.test(e.trim())))throw Error("A valid create-order intent ID is required.");return e.trim().toLowerCase()}async function D(e){let t=globalThis.crypto?.subtle;if(!t)throw Error("Secure hashing is unavailable for create-order idempotency.");return[...new Uint8Array(await t.digest("SHA-256",new TextEncoder().encode(e)))].map(e=>e.toString(16).padStart(2,"0")).join("")}async function P(e){return D(`${function(e){if(!(e=e.trim()))throw Error("Authenticated actor scope is required for create-order idempotency.");return e}(e.scope)}\0${function(e){if("CreateOrder"!==e&&"CreateInternalOrder"!==e)throw Error("Unsupported create-order RPC method.");return e}(e.methodName)}\0${k(e.clientIntentId)}`)}async function U(e,t,r){return`dashboard-create-${await P({clientIntentId:t,methodName:e,scope:r.scope})}`}function C({userId:e,organizationId:t,anonymousKey:r}){return e&&t?`u:${e}|o:${t}`:r}let _="x-maxmove-renderer-session-epoch",N=new Set(["DELETE","GET","PATCH","POST","PUT"]);async function L(e,t,r){if("GET"!==r&&"DELETE"!==r){if(t?.body!==void 0&&null!==t.body){if("string"==typeof t.body)return new TextEncoder().encode(t.body).buffer;if(t.body instanceof ArrayBuffer)return t.body;if(ArrayBuffer.isView(t.body))return t.body.buffer.slice(t.body.byteOffset,t.body.byteOffset+t.body.byteLength);if(t.body instanceof URLSearchParams||t.body instanceof Blob)return await new Response(t.body).arrayBuffer();throw Error("Streaming and multipart bodies require a dedicated dashboard host bridge")}if(e instanceof Request&&e.body)return await e.clone().arrayBuffer()}}var x=e.i(710734),q=e.i(589091),$=e.i(869355);let j=null,B=null;async function H(){for(;B;)await B.promise}function K(e){let t=(0,q.readGatewayJwtIdentityFromToken)(e);return t?{organizationId:t.organizationId,userId:t.subject}:null}async function M(e){let t;return await H(),(t=(0,E.getDashboardRuntimeConfig)(),j??=(0,$.createFirstPartyOAuthAccessTokenCache)({allowInsecureDevelopmentHttp:"production"!==t.mode,authBaseUrl:t.authBaseUrl,clientId:x.firstPartyOAuthClientIds.dashboard,getSession:()=>A.getSession({query:{disableCookieCache:!0}}),resource:t.apiBaseUrl})).getResult(e)}async function F(){let e=await M();return e.ok?K(e.token):null}function G(){j?.invalidate()}e.s(["beginDashboardAccessTokenTransition",0,function(){if(!B){let e=Promise.withResolvers();B={pending:0,promise:e.promise,resolve:e.resolve}}let e=B;e.pending+=1;let t=!1;return()=>{t||(t=!0,e.pending-=1,e.pending>0||(j?.invalidate(),B===e&&(B=null),e.resolve()))}},"getDashboardAccessIdentity",0,F,"getDashboardAccessTokenResult",0,M,"invalidateDashboardAccessTokenCache",0,G,"readDashboardJwtIdentity",0,K],673549);var W=r;let V=["session-absent","missing-active-organization","auth-check-unavailable","token-unavailable","service-rejected-fresh-token"],J={"session-absent":{code:t.Code.Unauthenticated,message:"The dashboard session is no longer active"},"missing-active-organization":{code:t.Code.FailedPrecondition,message:"No active workspace is selected"},"auth-check-unavailable":{code:t.Code.Unavailable,message:"The authentication service is temporarily unavailable"},"token-unavailable":{code:t.Code.Unavailable,message:"Workspace credentials are temporarily unavailable"},"service-rejected-fresh-token":{code:t.Code.Unauthenticated,message:"The service rejected refreshed workspace credentials"}};class Y extends W.ConnectError{authFailureReason;constructor(e,t){const r=J[e];super(r.message,r.code,void 0,void 0,t),this.name="DashboardAuthRecoveryError",this.authFailureReason=e}}e.s(["DashboardAuthRecoveryError",0,Y,"isDashboardAuthRecoveryError",0,function(e){return null!==function(e){if(!e||"object"!=typeof e||!("authFailureReason"in e))return null;let t=Reflect.get(e,"authFailureReason");if("string"!=typeof t)return null;for(let e of V)if(e===t)return e;return null}(e)}],883053);let Q=["organization_required","organization_context_required","organization_mismatch"],Z={ORGANIZATION_CONTEXT_MISMATCH:"organization_mismatch",ORGANIZATION_CONTEXT_REQUIRED:"organization_context_required"},X=["active organization context is required","organization context is required","select a workspace before continuing onboarding"],ee=["active organization does not match this independent driver workspace","organization mismatch","organization context mismatch"],et=e=>"object"==typeof e&&null!==e,er=(e,t=new WeakSet)=>{if("string"==typeof e)return e;if(e instanceof Error)return e.message;if(!et(e)||t.has(e))return"";t.add(e);let r=e.message;if("string"==typeof r&&r.trim().length>0)return r.trim();for(let r of["value","error","cause","data"]){let a=er(e[r],t);if(a)return a}return""},ea=(e,t=new WeakSet)=>{if(!et(e)||t.has(e))return"";t.add(e);let r=e.code;if("string"==typeof r&&r.trim().length>0)return r.trim().toLowerCase();for(let r of["value","error","cause","data"]){let a=ea(e[r],t);if(a)return a}return""},eo=(e,t=new WeakSet)=>{if(!et(e)||t.has(e))return null;t.add(e);let r=e.details;if(Array.isArray(r))for(let e of r){if(!et(e)||"google.rpc.ErrorInfo"!==e.type)continue;let t=e.debug;if(!et(t)||"string"!=typeof t.reason)continue;let r=Z[t.reason];if(r)return r}for(let r of["value","error","cause","data"]){let a=eo(e[r],t);if(a)return a}return null},en=(e,t=new WeakSet)=>{if(!et(e)||t.has(e))return null;t.add(e);let r=e.status;if("number"==typeof r&&Number.isFinite(r))return r;for(let r of["value","error","cause","data"]){let a=en(e[r],t);if(null!==a)return a}return null};
2class ei extends Error{code;status;constructor(e){super(e.message&&e.message.trim().length>0?e.message:(e=>"organization_mismatch"===e?"Active organization does not match this independent driver workspace.":"Select a workspace before continuing onboarding.")(e.code)),this.name="WorkspaceContextError",this.code=e.code,this.status=e.status??("organization_mismatch"===e.code?403:412)}}let es=new Map,el=(0,i.configuredLocales)(),eu="https://dashboard-connect.invalid",ec=function({destination:e,network:t,sentinelOrigin:r}){let a=new URL(r).origin;return async(r,o)=>{let n,i=r instanceof Request?new URL(r.url):new URL(r.toString());if(i.origin!==a||i.username||i.password||i.hash||!i.pathname.startsWith("/"))throw Error("Dashboard request escaped its fixed host boundary");let s=function(e,t){let r=(t?.method??(e instanceof Request?e.method:"GET")).toUpperCase();if(!N.has(r))throw Error(`Unsupported dashboard request method: ${r}`);return r}(r,o),l=await L(r,o,s),u=(n=new Headers(r instanceof Request?r.headers:void 0),o?.headers&&new Headers(o.headers).forEach((e,t)=>n.set(t,e)),n),c=function(e){let t=e.get(_);if(e.delete(_),null===t)return;if(!/^(?:0|[1-9][0-9]*)$/.test(t))throw Error("Dashboard session epoch header is invalid");let r=Number(t);if(!Number.isSafeInteger(r))throw Error("Dashboard session epoch header is invalid");return r}(u);return await t.request({...l?{body:l}:{},destination:e,...void 0!==c?{expectedSessionEpoch:c}:{},headers:Object.fromEntries(u.entries()),method:s,path:`${i.pathname}${i.search}`,...o?.signal?{signal:o.signal}:{}})}}({destination:"connect",network:{request:e=>(0,b.getDashboardPlatform)().network.request(e)},sentinelOrigin:eu});function ed(e){return"CreateOrder"===e||"CreateInternalOrder"===e}async function eh(e,t,r,a){if(!ed(e))return;let o=k(t&&"object"==typeof t?Reflect.get(t,"clientIntentId"):void 0);if(!a)throw Error("Authenticated actor scope is required for create-order idempotency.");r.set("Idempotency-Key",await U(e,o,{scope:a}))}function ep(e,t){let r=e&&"object"==typeof e?Reflect.get(e,t):void 0;if("string"!=typeof r||0===r.trim().length)throw Error(`Dispatch assignment ${t} is required for idempotency.`);return r.trim()}function eg(e,t){let r=e&&"object"==typeof e?Reflect.get(e,"pickupLocation"):void 0;if(!r||"object"!=typeof r)return 0;let a=Reflect.get(r,t);if(void 0===a)return 0;if("number"!=typeof a||!Number.isFinite(a))throw Error(`Dispatch assignment pickup ${t} must be finite for idempotency.`);return a}async function em(e){let t=globalThis.crypto?.subtle;if(!t)throw Error("Secure hashing is unavailable for dispatch assignment idempotency.");return[...new Uint8Array(await t.digest("SHA-256",new TextEncoder().encode(e)))].map(e=>e.toString(16).padStart(2,"0")).join("")}async function ef(e){if(!e){let t=await F();if(!t)throw new Y("token-unavailable",Error("Authenticated organization scope is missing from the dashboard access token."));e=t.organizationId}if(!(e=e.trim()))throw Error("Authenticated organization scope is required for assignment idempotency.");return e}async function ew(e,t,r,a){if("Assign"!==e)return;a=await ef(a);let o=JSON.stringify({etag:ep(t,"etag"),orderId:ep(t,"orderId"),organizationId:a,pickup:{latitude:eg(t,"latitude"),longitude:eg(t,"longitude")},vehicleTypeId:t&&"object"==typeof t&&"string"==typeof Reflect.get(t,"vehicleTypeId")?Reflect.get(t,"vehicleTypeId").trim():""});r.set("Idempotency-Key",`dashboard-dispatch-${await em(o)}`)}async function eb(e,t,r,a){if("AssignInternalOrder"!==e)return;a=await ef(a);let o=function e(t){return"bigint"==typeof t?JSON.stringify(t.toString()):null===t||"object"!=typeof t?JSON.stringify(t)??"undefined":Array.isArray(t)?`[${t.map(e).join(",")}]`:`{${Object.entries(t).toSorted(([e],[t])=>e.localeCompare(t)).map(([t,r])=>`${JSON.stringify(t)}:${e(r)}`).join(",")}}`}({id:ep(t,"id"),etag:ep(t,"etag"),organizationId:a,assignment:t&&"object"==typeof t?Reflect.get(t,"assignment"):void 0,forceReassign:t&&"object"==typeof t?Reflect.get(t,"forceReassign"):void 0,proofOfDeliveryUploadInvite:t&&"object"==typeof t?Reflect.get(t,"proofOfDeliveryUploadInvite"):void 0});r.set("Idempotency-Key",`dashboard-order-assign-${await em(o)}`)}function ey(e){let a=r.ConnectError.from(e);return a.code===t.Code.Unauthenticated||a.code===t.Code.PermissionDenied&&(e=>{if(e instanceof ei)return e;let t=er(e),r=eo(e)??((e,t)=>{if(Q.includes(e))return e;let r=t.toLowerCase();return ee.some(e=>r.includes(e))?"organization_mismatch":X.some(e=>r.includes(e))?"organization_required":null})(ea(e),t);return r?new ei({code:r,message:t,status:en(e)}):null})(a)?.code==="organization_mismatch"}let eE=null,eR=null;function ev(e=Date.now()){return eR&&eR.expiresAtMs>e?eR:(eR=null,null)}async function eI(){let e;G();try{e=await A.getSession({query:{disableCookieCache:!0}})}catch(e){throw new Y("auth-check-unavailable",e)}if(e.error)throw new Y("auth-check-unavailable",e.error);if(!e.data)throw new Y("session-absent");let t=e.data.session.activeOrganizationId;if("string"!=typeof t||0===t.length)throw new Y("missing-active-organization");let r=await M(t);if(!r.ok)throw new Y("token-unavailable",r.cause);return{organizationId:t,token:r.token}}async function eO(e){if(!eE){let e=eI().finally(()=>{eE===e&&(eE=null)});eE=e}let t=await eE;return!function(e,t){if(e){let r=K(e);if(r?.organizationId!==t.organizationId)return}let r=ev();if(r&&r.organizationId===t.organizationId&&r.token===t.token){e&&r.staleTokens.add(e);return}eR={...t,expiresAtMs:Date.now()+3e4,freshTokenRejected:!1,staleTokens:new Set(e?[e]:[])}}(e??null,t),t.token}function eA(e,t){e.set("Authorization",`Bearer ${t}`)}async function eT(e,t){eA(e.header,t),ed(e.method.name)&&await eh(e.method.name,e.message,e.header,function(e){let t=K(e);if(!t)throw new Y("token-unavailable",Error("Authenticated actor scope is missing from the dashboard access token."));return C({userId:t.userId,organizationId:t.organizationId,anonymousKey:""})}(t))}function eS(e){return t=>async r=>{let a,o,n=await M(function(e){if(!e||"object"!=typeof e)return null;let t=Reflect.get(e,"organizationId");return"string"==typeof t&&t.length>0?t:null}(r.message)),i=n.ok?n.token:await eO();await e(r,i);try{return await t(r)}catch(e){if(!ey(e))throw e}let s=(a=ev(),o=K(i),a&&o?.organizationId===a.organizationId?i===a.token?(a.freshTokenRejected=!0,a.expiresAtMs=Date.now()+3e4,{outcome:"fresh-token-rejected"}):a.staleTokens.has(i)?a.freshTokenRejected?{outcome:"fresh-token-rejected"}:{outcome:"retry",token:a.token}:null:null);if(s?.outcome==="fresh-token-rejected")throw new Y("service-rejected-fresh-token");let l=s?.outcome==="retry"?s.token:await eO(i);await e(r,l);try{return await t(r)}catch(e){if(ey(e)){let t;throw(t=ev())&&t.token===l&&(t.freshTokenRejected=!0,t.expiresAtMs=Date.now()+3e4),new Y("service-rejected-fresh-token",e)}throw e}}}function ez(e,t){let r,i=(r=[e=>t=>(0,b.getOptionalDashboardPlatform)()?.surface==="desktop"?e(t):(0,s.createClientSurfaceInterceptor)(s.CLIENT_SURFACES.dashboard)(e)(t),e=>t=>{var r;return(r=t.header).get("X-Correlation-Id")||r.set("X-Correlation-Id",I()),e(t)}
2,e=>t=>(!function(e,t="en"){(0,n.applyBrowserTransportAcceptLanguage)(e,{supportedLocales:el,sources:void 0,fallback:t})}(t.header),e(t))],"order"===e&&t?.withAuth&&(r.push(e=>async t=>{if(!ed(t.method.name))return await e(t);let r=(0,b.getOptionalDashboardPlatform)();if(r?.surface!=="desktop")return await e(t);let a=await r.auth.getSessionIdentity();if(!a)throw Error("Authenticated desktop identity is required for order idempotency");let o=C({anonymousKey:"",organizationId:a.organizationId,userId:a.subject});return await eh(t.method.name,t.message,t.header,o),await e(t)}),r.push(e=>async t=>{if("AssignInternalOrder"!==t.method.name)return await e(t);let r=(0,b.getOptionalDashboardPlatform)(),a=r?.surface==="desktop"?await r.auth.getSessionIdentity():null;if(r?.surface==="desktop"&&!a)throw Error("Authenticated desktop identity is required for assignment idempotency");return await eb(t.method.name,t.message,t.header,a?.organizationId),await e(t)})),"dispatch"===e&&t?.withAuth&&r.push(e=>async t=>{if("Assign"!==t.method.name)return await e(t);let r=(0,b.getOptionalDashboardPlatform)(),a=r?.surface==="desktop"?await r.auth.getSessionIdentity():null;if(r?.surface==="desktop"&&!a)throw Error("Authenticated desktop identity is required for assignment idempotency");return await ew(t.method.name,t.message,t.header,a?.organizationId),await e(t)}),t?.withAuth&&r.push(t=>r=>(0,b.getOptionalDashboardPlatform)()?.surface==="desktop"?t(r):("order"===e?eS(eT):eS((e,t)=>{eA(e.header,t)}))(t)(r)),r);return(0,a.addStaticKeyToTransport)((0,o.createConnectTransport)({baseUrl:eu.replace(/\/$/,""),fetch:ec,interceptors:i,useBinaryFormat:!0}),`${e}:${eu}:${t?.withAuth?"auth":"public"}`)}e.s(["createServiceTransport",0,ez,"getServiceTransport",0,function(e,t){let r=`${e}-${t?.withAuth?"auth":"noauth"}`,a=es.get(r);if(a)return a;let o=ez(e,t);return es.set(r,o),o}],360503)},166157,e=>{"use strict";let t=null;function r(){if(!t)throw Error("The dashboard host has not configured its platform boundary");return t}e.s(["assertPresignedFileTransfersSupported",0,function(){if(!r().capabilities.presignedFileTransfers)throw Error("File transfers are available in the web dashboard")},"configureDashboardPlatform",0,function(e){return t=e,()=>{t===e&&(t=null)}},"getDashboardPlatform",0,r,"getOptionalDashboardPlatform",0,function(){return t}])},591767,e=>{"use strict";function t(e){let t=e.pathname.replace(/\/+$/,"");return"/"===t?"":t}function r(e,t){return""===t||e===t||e.startsWith(`${t}/`)}function a(e){if(e.username||e.password||e.search||e.hash)throw Error("Configured dashboard destination is not a fixed URL base")}function o(e,o){if(""!==o&&!o.startsWith("/")&&!o.startsWith("?")||o.startsWith("//")||o.includes("\\")||o.includes("#"))throw Error("Invalid dashboard destination path");let n=new URL(e);a(n);let i=t(n),s=new URL(`${i}${o}`,n.origin);if(s.origin!==n.origin||s.username||s.password||s.hash||!r(s.pathname,i))throw Error("Dashboard request escaped its configured destination");return s}e.s(["rebaseFixedRequestUrl",0,function(e,n,i){let s=new URL(n);a(s);let l=t(s),u=e instanceof Request?new URL(e.url):new URL(e.toString(),s);if(u.origin!==s.origin||u.username||u.password||u.hash||!r(u.pathname,l))throw Error("Dashboard request escaped its fixed URL boundary");let c=u.pathname.slice(l.length);return o(i,`${c}${u.search}`)},"resolveConfiguredDestinationUrl",0,o])},322690,e=>{"use strict";let t,r;var a=e.i(868280);e.i(156046);var o=e.i(452590);let n=e=>"string"==typeof e&&""===e.trim()?void 0:e,i=a.z.preprocess(n,a.z.string().trim().min(1).optional()),s=a.z.preprocess(n,a.z.string().trim().url().optional()),l=a.z.preprocess(n,a.z.string().trim().toLowerCase().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/).optional()),u=a.z.string().trim().url(),c=a.z.enum(["development","test","production"]),d=a.z.object({apiKey:a.z.string().trim().min(1),appId:a.z.string().trim().min(1),messagingSenderId:a.z.string().trim().min(1),projectId:a.z.string().trim().min(1),vapidKey:a.z.string().trim().min(1)}).strict(),h=a.z.discriminatedUnion("mode",[a.z.object({mode:a.z.literal("off")}
2).strict(),a.z.object({mode:a.z.literal("all")}).strict(),a.z.object({mode:a.z.literal("pilot"),slugs:a.z.array(a.z.string().trim().toLowerCase().refine(o.isAllowedFleetPortalSlug)).min(1).max(100)}).strict()]).transform(e=>"pilot"===e.mode?{mode:e.mode,slugs:Array.from(new Set(e.slugs))}:e),p=a.z.object({apiBaseUrl:u,authBaseUrl:u,authOrigin:u,datadogRumApplicationId:i,datadogRumClientToken:i,datadogRumReplaySampleRate:a.z.number().min(0).max(100).optional(),datadogRumSessionSampleRate:a.z.number().min(0).max(100).optional(),datadogSite:i,deploymentEnvironment:i,disableHttpsRedirect:a.z.boolean().optional(),dispatchKanbanViewEnabled:a.z.boolean(),facilityOperationsEnabled:a.z.boolean().default(!1),fleetCalendarEnabled:a.z.boolean(),fleetTelematicsEnabled:a.z.boolean(),fleetPortalBaseDomain:l,fleetTenantPortalRollout:h.default({mode:"off"}),gatewayUrl:u,googleMapsBrowserKey:i,googleMapsMapId:i,launchPromoCode:i,launchPromoHint:i,mode:c,posthogHost:s,posthogKey:i,sentryDsn:s,serviceVersion:i,siteOrigin:u,stripeCpmCashId:i,stripeCpmInvoiceId:i,stripeCpmWalletId:i,stripePublishableKey:i,supportAiEnabled:a.z.boolean(),surface:a.z.enum(["desktop","web"]),webPush:d.optional(),webOrigin:u}).strict().superRefine((e,t)=>{for(let[r,a]of[["apiBaseUrl",e.apiBaseUrl],["authBaseUrl",e.authBaseUrl],["authOrigin",e.authOrigin],["posthogHost",e.posthogHost],["siteOrigin",e.siteOrigin],["webOrigin",e.webOrigin]])a&&m(r,a,e.mode,"https:",t);for(let[n,i]of[["authOrigin",e.authOrigin],["siteOrigin",e.siteOrigin],["webOrigin",e.webOrigin]]){var r,a,o;i&&(r=n,a=i,o=t,"/"!==new URL(a).pathname&&o.addIssue({code:"custom",message:`${r} must be an origin without a path`,path:[r]}))}if(m("gatewayUrl",e.gatewayUrl,e.mode,"wss:",t),e.sentryDsn){let r=new URL(e.sentryDsn);"https:"!==r.protocol&&"production"===e.mode&&t.addIssue({code:"custom",message:"sentryDsn must use HTTPS in production",path:["sentryDsn"]}),(r.hash||r.search)&&t.addIssue({code:"custom",message:"sentryDsn cannot contain a query or fragment",path:["sentryDsn"]})}"desktop"===e.surface&&e.googleMapsBrowserKey&&t.addIssue({code:"custom",message:"Desktop runtime config cannot contain a Google Maps browser key",path:["googleMapsBrowserKey"]}),"desktop"===e.surface&&e.webPush&&t.addIssue({code:"custom",message:"Desktop runtime config cannot contain web push configuration",path:["webPush"]}),e.posthogHost&&!e.posthogKey&&t.addIssue({code:"custom",message:"posthogHost requires posthogKey",path:["posthogKey"]}),e.launchPromoHint&&!e.launchPromoCode&&t.addIssue({code:"custom",message:"launchPromoHint requires launchPromoCode",path:["launchPromoHint"]})}).transform(e=>Object.freeze({...e,apiBaseUrl:g(e.apiBaseUrl),authBaseUrl:g(e.authBaseUrl),authOrigin:g(e.authOrigin),datadogRumReplaySampleRate:e.datadogRumReplaySampleRate??0,datadogRumSessionSampleRate:e.datadogRumSessionSampleRate??20,datadogSite:e.datadogSite??"datadoghq.eu",deploymentEnvironment:e.deploymentEnvironment??e.mode,disableHttpsRedirect:e.disableHttpsRedirect??!1,fleetPortalBaseDomain:e.fleetPortalBaseDomain??("production"===e.mode?"maxmove.com":void 0),gatewayUrl:g(e.gatewayUrl),posthogHost:e.posthogHost?g(e.posthogHost):e.posthogKey?"https://eu.i.posthog.com":void 0,siteOrigin:g(e.siteOrigin),webOrigin:g(e.webOrigin)}));function g(e){return e.replace(/\/+$/,"")}function m(e,t,r,a,o){let n=new URL(t);n.protocol!==a&&("production"===r||"localhost"!==n.hostname&&"127.0.0.1"!==n.hostname&&"[::1]"!==n.hostname||n.protocol!==("https:"===a?"http:":"ws:"))&&o.addIssue({code:"custom",message:`${e} must use ${a}${"production"===r?"":" (or its loopback-only development equivalent)"}`,path:[e]}),(n.username||n.password||n.hash||n.search)&&o.addIssue({code:"custom",message:`${e} cannot contain credentials, a query, or a fragment`,path:[e]})}e.s(["configureDashboardRuntimeConfig",0,function(e){let a=p.parse(e),o=JSON.stringify(a);if(t){if(r!==o)throw Error("Dashboard runtime config is already initialized with different values.");return t}return t=a,r=o,t},"getDashboardRuntimeConfig",0,function(){if(!t)throw Error("Dashboard runtime config is not initialized. The host must call configureDashboardRuntimeConfig() before shared application code runs.");return t},"isDashboardRuntimeConfigConfigured",0,function(){return void 0!==t}],322690)}]);
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.