@void/platform 0.26.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/dist/browser-page.d.mts +19 -0
- package/dist/browser-page.mjs +90 -0
- package/dist/email-protocol.mjs +47 -53
- package/dist/index.mjs +7 -23
- package/dist/installer.mjs +3 -1
- package/dist/runtime/api/assets/admin/client.js +85 -24
- package/dist/runtime/api/assets/admin/style.css +1 -1
- package/dist/runtime/api/index.js +401 -301
- package/dist/runtime/dispatch/index.js +8 -8
- package/dist/runtime/drizzle/0058_project_proxy_token_gen.sql +2 -0
- package/dist/runtime/drizzle/compatibility.json +8 -0
- package/dist/runtime/drizzle/meta/_journal.json +7 -0
- package/dist/runtime/emailGateway/index.js +5 -5
- package/dist/runtime/manifest.json +30 -16
- package/dist/runtime/proxy/index.js +6 -3
- package/package.json +13 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var xn=Object.defineProperty;var o=(e,t)=>xn(e,"name",{value:t,configurable:!0});var kn=["github","google","oidc","cloudflare-access"];var Dn={ai:!0,customDomains:!1,email:!1,githubActions:!1,githubOAuth:!0,googleOAuth:!1,managedBuilds:!1,sandbox:!1},On={apiHostname:null,dashboardHostname:null,proxyHostname:null};function Ge(e,t){if(typeof e!="string"||e.trim()==="")throw new Error(`${t} must be a non-empty string.`);return e}o(Ge,"requiredString$1");function pr(e){let t=e.trim().toLowerCase().replaceAll(/[^a-z0-9-]+/g,"-").replaceAll(/^-+|-+$/g,"").replaceAll(/-{2,}/g,"-");if(!t)throw new Error("The installation name must contain a letter or number.");if(t.length>40)throw new Error("The installation name must be 40 characters or fewer after normalization.");return t}o(pr,"normalizeInstallationSlug");function de(e){let t=e.trim().toLowerCase();if(t.endsWith(".")&&(t=t.slice(0,-1)),t.length>253||!t.includes(".")||t.split(".").some(n=>!/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(n)))throw new Error(`Invalid domain: ${JSON.stringify(e)}.`);return t}o(de,"normalizeApplicationDomain");function Ln(e){let t=e.trim(),n;try{n=new URL(t)}catch{throw new Error("The dashboard URL must be an HTTPS origin.")}if(!/^https:\/\/[^/?#]+\/?$/i.test(t)||/[\s\\]/.test(t)||n.protocol!=="https:"||n.username||n.password||n.pathname!=="/"||n.search||n.hash)throw new Error("The dashboard URL must be an HTTPS origin without credentials, a path, query, or fragment.");return n.hostname=de(n.hostname),n.origin}o(Ln,"normalizePlatformDashboardUrl");function Nn(e){let t=`void-${pr(e)}`,n=t.replaceAll("-","_");return{aiGateway:t,apiWorker:`${t}-api`,assetsBucket:`${t}-assets`,cronQueue:`${t}-cron-fires`,deploymentQueue:`${t}-deployments`,dashboardWorker:`${t}-dashboard`,dispatchNamespace:`${t}-users`,dispatchWorker:`${t}-dispatch`,emailGatewayWorker:`${t}-email-gateway`,hyperdrive:`${t}-database`,isrCacheKv:`${t}-isr-cache`,legacyAssetsKv:`${t}-legacy-assets`,logsDataset:`${n}_logs`,proxyWorker:`${t}-proxy`,requestsDataset:`${n}_requests`,routingKv:`${t}-routing`,tailWorker:`${t}-tail`,usageQueue:`${t}-usage-events`}}o(Nn,"createPlatformResourceNames");function Un(e){if(!e.zoneName&&e.workersDev){if(e.dedicatedZone)throw new Error("workers.dev cannot use a dedicated-zone catch-all.");return[]}let t=de(e.baseDomain),n=de(e.zoneName);if(t!==n&&!t.endsWith(`.${n}`))throw new Error(`Application domain ${t} is not inside zone ${n}.`);let r=[{pattern:`*.${t}/*`,zoneName:n},{pattern:`*.${t}`,zoneName:n}];if(e.dedicatedZone){if(t!==n)throw new Error("A dedicated-zone catch-all requires the application domain to be the zone.");r.push({pattern:"*/*",zoneName:n},{pattern:"*",zoneName:n})}return r}o(Un,"createApplicationRoutes");function Mn(e){if(e.emailSharedZoneId===void 0!=(e.emailSenderDomain===void 0))throw new Error("Shared email configuration requires both emailSenderDomain and emailSharedZoneId.");let t=pr(e.installationSlug),n=de(e.application.baseDomain),r=e.application.workersDev;if(r&&(!/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(r.subdomain)||!/^[a-z0-9][a-z0-9-]{0,80}$/.test(r.installationId)))throw new Error("Invalid workers.dev installation identity.");let s=r&&e.application.zoneName===""?"":de(e.application.zoneName);if(!s&&n!==`${r.subdomain}.workers.dev`)throw new Error("workers.dev application domain must match its account subdomain.");let i={...Nn(t),...e.resources},c={...Dn,...e.capabilities};if(c.managedBuilds&&!c.githubActions)throw new Error("Managed builds require the GitHub Actions capability.");if(e.appAccess!==void 0&&!["public","platform","custom"].includes(e.appAccess))throw new Error("appAccess must be public, platform, or custom.");let d=e.authentication?.providers??["github"];if(d.some(f=>!kn.includes(f))||new Set(d).size!==d.length)throw new Error("Authentication providers must be unique supported login kinds.");let u=e.authentication?.configurable===!0||e.authentication?.accessProtection===!0||d.some(f=>f==="oidc"||f==="cloudflare-access");if(d.length===0)throw new Error("At least one authentication provider is required.");if(d.includes("github")!==c.githubOAuth)throw new Error("The GitHub provider and githubOAuth capability must agree.");if(d.includes("google")!==c.googleOAuth)throw new Error("The Google provider and googleOAuth capability must agree.");let p=e.controlPlane?.dashboardUrl===void 0?void 0:Ln(e.controlPlane.dashboardUrl),a={...e.appAccess!==void 0?{appAccess:e.appAccess}:{},application:{baseDomain:n,dedicatedZone:e.application.dedicatedZone??!1,zoneName:s,...r?{workersDev:{...r}}:{},...e.application.zoneId?{zoneId:Ge(e.application.zoneId,"application.zoneId")}:{}},authentication:{providers:[...d],...u?{configurable:!0}:{},...e.authentication?.accessProtection?{accessProtection:!0}:{}},capabilities:c,...e.emailSharedZoneId!==void 0?{emailSharedZoneId:Ge(e.emailSharedZoneId,"emailSharedZoneId")}:{},...e.emailSenderDomain!==void 0?{emailSenderDomain:de(e.emailSenderDomain)}:{},controlPlane:{...On,...e.controlPlane,...p!==void 0?{dashboardUrl:p,dashboardHostname:e.controlPlane?.dashboardHostname??new URL(p).hostname}:{}},displayName:Ge(e.displayName,"displayName").trim(),installationSlug:t,resources:i,schemaVersion:e.appAccess!==void 0?4:u?3:r?2:1};Un(a.application);for(let[f,l]of Object.entries(a.controlPlane))if(f!=="dashboardUrl"&&(l!==null&&de(l),l===""))throw new Error(`controlPlane.${f} must be a hostname or null.`);if(a.controlPlane.dashboardUrl){let f=new URL(a.controlPlane.dashboardUrl).hostname;if(a.controlPlane.dashboardHostname!==f)throw new Error("The dashboard URL and dashboard hostname must agree.")}for(let[f,l]of Object.entries(a.resources))Ge(l,`resources.${f}`);return a}o(Mn,"createPlatformDeploymentManifest");var fr=2;function Ae(e){let t=e.SITE_DOMAIN??e.BASE_HOSTNAME??"void.app";return e.PLATFORM_APPLICATION?Mn({installationSlug:"runtime",displayName:"Runtime",application:JSON.parse(e.PLATFORM_APPLICATION)}).application:{baseDomain:t,zoneName:t,dedicatedZone:!1}}o(Ae,"readPlatformApplication");function mr(e){return`workers-dev:${e}`}o(mr,"platformWorkersDevAliasKey");var Hn="__void/platform/application/v1";async function hr(e){if(!e.PLATFORM_APPLICATION)return e;let t=await e.ROUTING.get(Hn);if(!t)return e;let n=Ae(e),r=Ae({PLATFORM_APPLICATION:t});if(!n.workersDev||!r.workersDev||n.workersDev.installationId!==r.workersDev.installationId||n.workersDev.subdomain!==r.workersDev.subdomain)throw new Error("Application routing belongs to another platform installation.");return{...e,PLATFORM_APPLICATION:t,SITE_DOMAIN:r.baseDomain,BASE_HOSTNAME:r.baseDomain,...r.zoneId?{CF_ZONE_ID:r.zoneId}:{}}}o(hr,"resolvePlatformApplicationEnvironment");function $n(e){return`void-${e.installationId.slice(-12)}-`}o($n,"platformProjectIngressPrefix");function Kn(e,t){if(!/^proj_[a-z0-9]{1,32}$/.test(e.id)||!/^[a-z0-9][a-z0-9-]*$/.test(e.slug))throw new Error("Invalid platform project identity.");let n=$n(t),r=`-${e.id.slice(5)}`;return`${n}${e.slug.slice(0,63-n.length-r.length).replace(/-+$/,"")}${r}`}o(Kn,"platformProjectIngressName");function gr(e,t){return`${Kn(e,t)}.${t.subdomain}.workers.dev`}o(gr,"platformProjectWorkersDevHostname");var At="void-platform-health";function yr(e){return e.zoneName?`${At}.${e.baseDomain}`:null}o(yr,"platformHealthHostname");var Ye=new TextEncoder,Xe=new TextDecoder,Qe=new TextDecoder("utf-8",{fatal:!0}),fs=2**32;function wr(...e){let t=e.reduce((s,{length:i})=>s+i,0),n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}o(wr,"concat");var Fn=/[^\x00-\x7f]/;function Re(e){if(typeof e=="string"&&e.length>=128){if(Fn.test(e))throw new TypeError("non-ASCII string encountered in encode()");return Ye.encode(e)}let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}o(Re,"encode");function br(e,t=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e,{alphabet:t?"base64url":"base64"});if(t){if(e.includes("+")||e.includes("/"))throw new TypeError("Invalid base64url");e=e.replace(/-/g,"+").replace(/_/g,"/")}let n=atob(e),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}o(br,"decodeBase64");var K=class extends Error{static{o(this,"JOSEError")}static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,n){super(t,n),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},re=class extends K{static{o(this,"JWTClaimValidationFailed")}static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(t,n,r="unspecified",s="unspecified"){super(t,{cause:{claim:r,reason:s,payload:n}}),this.claim=r,this.reason=s,this.payload=n}},Ne=class extends K{static{o(this,"JWTExpired")}static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(t,n,r="unspecified",s="unspecified"){super(t,{cause:{claim:r,reason:s,payload:n}}),this.claim=r,this.reason=s,this.payload=n}},Ze=class extends K{static{o(this,"JOSEAlgNotAllowed")}static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},X=class extends K{static{o(this,"JOSENotSupported")}static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"};var H=class extends K{static{o(this,"JWSInvalid")}static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"},Ee=class extends K{static{o(this,"JWTInvalid")}static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};var Ue=class extends K{static{o(this,"JWKSInvalid")}static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"},Se=class extends K{static{o(this,"JWKSNoMatchingKey")}static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(t="no applicable key found in the JSON Web Key Set",n){super(t,n)}},et=class extends K{static{o(this,"JWKSMultipleMatchingKeys")}[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(t="multiple matching keys found in the JSON Web Key Set",n){super(t,n)}},tt=class extends K{static{o(this,"JWKSTimeout")}static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(t="request timed out",n){super(t,n)}},rt=class extends K{static{o(this,"JWSSignatureVerificationFailed")}static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(t="signature verification failed",n){super(t,n)}};var Vn="The input to be decoded is not correctly encoded.";function Me(e){try{return br(typeof e=="string"?e:Xe.decode(e),!0)}catch(t){throw new TypeError(Vn,{cause:t})}}o(Me,"decode");function ce(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}o(ce,"isObject");function nt(e){return ce(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(ce)}o(nt,"isJwkSet");function Ar(...e){let t=new Set;for(let n of e)if(n)for(let r of Object.keys(n)){if(t.has(r))return!1;t.add(r)}return!0}o(Ar,"isDisjoint");function Rt(e,t,n){try{return Me(e)}catch{throw new n(`Failed to base64url decode the ${t}`)}}o(Rt,"decodeBase64url");function Rr(e,t,n){try{return Re(e)}catch{throw new n(`The ${t} is not a valid base64url string`)}}o(Rr,"encodeBase64url");function Er(e,t,n){let r;try{r=JSON.parse(Qe.decode(Me(e)))}catch{throw new t(n)}if(!ce(r))throw new t(n);return r}o(Er,"parseJoseHeader");var Sr={__proto__:null,b64:!0};function Ir(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);return t===void 0?void 0:new Set(t)}o(Ir,"validateAlgorithms");function Pr(e,t,n,r,s){if(s.crit!==void 0&&r?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return[];if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(c=>typeof c!="string"||c.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=n===void 0?t:{__proto__:null,...n,...t};for(let c of r.crit){if(!(c in i))throw new X(`Extension Header Parameter "${c}" is not recognized`);if(!Object.hasOwn(s,c)||s[c]===void 0)throw new e(`Extension Header Parameter "${c}" is missing`);if(i[c]&&(!Object.hasOwn(r,c)||r[c]===void 0))throw new e(`Extension Header Parameter "${c}" MUST be integrity protected`)}return r.crit}o(Pr,"validateCrit");function _r(e,t){if(t.includes("b64")){let n=e.b64;if(typeof n!="boolean")throw new H('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return n}return!0}o(_r,"validateB64");var jn=o(e=>e[Symbol.toStringTag],"tag"),Wn=o((e,t,n)=>{let{alg:r}=e;if(t.use!==void 0){let s=n==="sign"||n==="verify"?"sig":"enc";if(t.use!==s)throw new TypeError(`Invalid key for this operation, its "use" must be "${s}" when present`)}if(t.alg!==void 0&&t.alg!==r)throw new TypeError(`Invalid key for this operation, its "alg" must be "${r}" when present`);if(Array.isArray(t.key_ops)){let s=n==="encrypt"||n==="decrypt"?e.ops?.[n==="encrypt"?0:1]:n;if(s&&!t.key_ops.includes(s))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${s}" when present`)}},"jwkMatchesOp");async function Cr(e,t,n){let{alg:r,secret:s}=e,i=n==="decrypt"||n==="sign";if(s&&t instanceof Uint8Array)return t;let c,d;if(ce(t)){if(c=Xn(t),typeof c.kty!="string")throw Tr(r,t,s);if(!(s?c.kty==="oct"&&typeof c.k=="string":c.kty!=="oct"&&(i?c.kty==="AKP"&&typeof c.priv=="string"||typeof c.d=="string":c.d===void 0&&c.priv===void 0)))throw new TypeError(s?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);if(Wn(e,c,n),c.kty==="oct")return Me(c.k);if(!Object.isFrozen(t)){let{key_ops:a}=t;Array.isArray(a)&&Object.freeze(a),Object.freeze(t)}}else{if(!zn(t))throw Tr(r,t,s);let a=s?"secret":i?"private":"public";if(t.type!==a&&(s||["secret","public","private"].includes(t.type)))throw new TypeError(`${jn(t)} instances must be of type "${a}" for the ${r} algorithm`);if(vr(t))return t;if(d=t,d.type==="secret")return d.export()}Et||=new WeakMap;let u=t,p=Et.get(u);if(p?.[r])return p[r];if(p||Et.set(u,p={}),d&&typeof d.toCryptoKey=="function"){let a=d.type==="public",f=Jn[d.asymmetricKeyDetails?.namedCurve],l=e.resolve?.({crv:f,asymmetricKeyType:d.asymmetricKeyType})??e.subtle;return p[r]=d.toCryptoKey(l,a,e.usages[a?0:1])}return c??=d.export({format:"jwk"}),c.alg=r,p[r]=await It(e,c)}o(Cr,"prepareKey");var Et,Jn={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};var vr=o(e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},"isCryptoKey"),Bn=o(e=>e?.[Symbol.toStringTag]==="KeyObject","isKeyObject"),zn=o(e=>vr(e)||Bn(e),"isKeyLike");function qn(e,t,...n){if(n.length>2){let r=n.pop();e+=`one of type ${n.join(", ")}, or ${r}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}o(qn,"message");function Tr(e,t,n){let r=["CryptoKey","KeyObject","JSON Web Key"];return n&&r.push("Uint8Array"),new TypeError(qn(`Key for the ${e} algorithm must be `,t,...r))}o(Tr,"invalidKeyType");var ot=o((e,t="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`),"unusable");function Gn(e,t){if(t&&!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}o(Gn,"checkUsage");function xr(e,t){let{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}o(xr,"checkModulusLength");function Yn(e,t,n){let r=e.algorithm;if(r.name!==t.name)throw ot(t.name);if(t.hash&&r.hash?.name!==t.hash)throw ot(t.hash,"algorithm.hash");if(t.namedCurve&&r.namedCurve!==t.namedCurve)throw ot(t.namedCurve,"algorithm.namedCurve");if(t.length!==void 0&&r.length!==t.length)throw ot(t.length,"algorithm.length");Gn(e,n)}o(Yn,"checkCryptoKey");function St(e){return{__proto__:null,...e}}o(St,"snapshotJwk");function Xn(e){let t=St(e);if(t.ext!==void 0&&typeof t.ext!="boolean")throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(t.key_ops!==void 0){let n=t.key_ops,r=Array.isArray(n)?[...n]:void 0;if(!r||r.some(s=>typeof s!="string")||new Set(r).size!==r.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=r}return t}o(Xn,"normalizeJwk");async function It(e,t,n){if(!e.kty.includes(t.kty))throw new X('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,s=!!(t.d||t.priv),i={...t,ext:n??t.ext};return i.kty!=="AKP"&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,i.ext??!s,t.key_ops??e.usages[s?1:0])}o(It,"jwkToKey");async function kr(e,t,n,r=!1){return e instanceof Uint8Array&&(e=await crypto.subtle.importKey("raw",e,t,r,[n])),Yn(e,t,n),e}o(kr,"rawKey");function Dr(e){let t={__proto__:null};for(let n in e)t[n]={...e[n],alg:n};return t}o(Dr,"table");var He=[["verify"],["sign"]];function Pt(e){let t={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:He}}o(Pt,"hmac");function Ie(e,t){let n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:n,signing:t?{...n,saltLength:t}:n,usages:He,minRsaBits:2048}}o(Ie,"rsa");function _t(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:He}}o(_t,"ecdsa");function Or(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:He}}o(Or,"eddsa");function Tt(e){let t={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:t,signing:t,usages:He}}o(Tt,"mldsa");var Ct=Dr({HS256:Pt(256),HS384:Pt(384),HS512:Pt(512),RS256:Ie(256),RS384:Ie(384),RS512:Ie(512),PS256:Ie(256,32),PS384:Ie(384,48),PS512:Ie(512,64),ES256:_t("P-256",256),ES384:_t("P-384",384),ES512:_t("P-521",512),EdDSA:Or(),Ed25519:Or(),"ML-DSA-44":Tt(44),"ML-DSA-65":Tt(65),"ML-DSA-87":Tt(87)});function Lr(e){let t=typeof e=="string"?Ct[e]:void 0;if(!t)throw new X(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}o(Lr,"jwsAlgorithm");function Nr(e){return[e&&Ir("algorithms",e.algorithms),e?.crit]}o(Nr,"prepareVerify");function Qn(e){return e===void 0?{}:Er(e,H,"JWS Protected Header is invalid")}o(Qn,"parseProtectedHeader");function Zn(e){try{return Re(e)}catch{throw new H("JWS Compact Serialization payload must use only ASCII characters")}}o(Zn,"encodeCompactUnencodedPayload");async function eo(e,t,n,r,s){let{protected:i,header:c,payload:d}=e,u=s??Qn(i);if(!Ar(u,c))throw new H("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let p={...u,...c},a=_r(u,Pr(H,Sr,t[1],u,p)),{alg:f}=p;if(typeof f!="string"||!f)throw new H('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(t[0]&&!t[0].has(f))throw new Ze('"alg" (Algorithm) Header Parameter value not allowed');if(a){if(typeof d!="string")throw new H("JWS Payload must be a string")}else if(typeof d!="string"&&!(d instanceof Uint8Array))throw new H("JWS Payload must be a string or an Uint8Array instance");let l=a||typeof d!="string"?d:r(d),b=!1;typeof n=="function"&&(n=await n(u,e),b=!0);let g=Lr(f),h=wr(i!==void 0?Re(i):new Uint8Array,Re("."),typeof l=="string"?t[2]??=Rr(l,"payload",H):l),L=Rt(e.signature,"signature",H),D=await Cr(g,n,"verify"),I=await kr(D,g.subtle,"verify");g.minRsaBits&&xr(g.alg,I);let _=!1;try{_=await crypto.subtle.verify(g.signing,I,L,h)}catch{}if(!_)throw new rt;let J={payload:typeof l=="string"?Rt(l,"payload",H):l};return i!==void 0&&(J.protectedHeader=u),c!==void 0&&(J.unprotectedHeader=c),b?[{...J,key:D},a]:[J,a]}o(eo,"verifySignature");async function Ur(e,t,n){if(e instanceof Uint8Array&&(e=Xe.decode(e)),typeof e!="string")throw new H("Compact JWS must be a string or Uint8Array");let{0:r,1:s,2:i,length:c}=e.split(".");if(c!==3)throw new H("Invalid Compact JWS");return eo({payload:s,protected:r,signature:i},t,n,Zn)}o(Ur,"verifyCompact");var to=o(e=>Math.floor(e.getTime()/1e3),"epoch"),ro={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},no=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Pe="check_failed";function vt(){throw new TypeError("Invalid time period format")}o(vt,"invalidDuration");function Mr(e){typeof e!="string"&&vt();let t=no.exec(e);(!t||t[4]&&t[1])&&vt();let n=parseFloat(t[2]),r=Math.round(n*ro[t[3][0].toLowerCase()]);return Number.isFinite(r)||vt(),t[1]==="-"||t[4]==="ago"?-r:r}o(Mr,"secs");function xt(e,t){if(!Number.isFinite(t))throw new TypeError(`Invalid ${e} input`);return t}o(xt,"validateInput");var Hr=o(e=>{let t=e.toLowerCase();return e.includes("/")?t:`application/${t}`},"normalizeTyp"),oo=o((e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(n=>e.includes(n)):!1,"checkAudiencePresence");function kt(e,t,n=!1){let r=e[t];if(!(r===void 0&&!n)){if(typeof r!="number")throw new re(`"${t}" claim must be a number`,e,t,"invalid");return r}}o(kt,"validateNumericDate");function Dt(e,t){throw new re(`unexpected "${t}" claim value`,e,t,Pe)}o(Dt,"unexpectedClaim");function $r(e,t,n={}){let r;try{r=JSON.parse(Qe.decode(t))}catch{}if(!ce(r))throw new Ee("JWT Claims Set must be a top-level JSON object");let{typ:s}=n;if(s!==void 0&&(typeof e.typ!="string"||Hr(e.typ)!==Hr(s)))throw new re('unexpected "typ" JWT header value',r,"typ",Pe);let{requiredClaims:i=[],issuer:c,subject:d,audience:u,maxTokenAge:p}=n,a=[...i];p!==void 0&&a.push("iat"),u!==void 0&&a.push("aud"),d!==void 0&&a.push("sub"),c!==void 0&&a.push("iss");for(let I of new Set(a.reverse()))if(!Object.hasOwn(r,I))throw new re(`missing required "${I}" claim`,r,I,"missing");c!==void 0&&!(Array.isArray(c)?c:[c]).includes(r.iss)&&Dt(r,"iss"),d!==void 0&&r.sub!==d&&Dt(r,"sub"),u!==void 0&&!oo(r.aud,typeof u=="string"?[u]:u)&&Dt(r,"aud");let{clockTolerance:f}=n,l=0;if(typeof f=="string")l=Mr(f);else if(f!==void 0){if(typeof f!="number")throw new TypeError("Invalid clockTolerance option type");l=f}xt("clockTolerance option",l);let{currentDate:b}=n,g=xt("currentDate option",to(b===void 0?new Date:b)),h=kt(r,"iat",p!==void 0),L=kt(r,"nbf");if(L!==void 0&&L>g+l)throw new re('"nbf" claim timestamp check failed',r,"nbf",Pe);let D=kt(r,"exp");if(D!==void 0&&D<=g-l)throw new Ne('"exp" claim timestamp check failed',r,"exp",Pe);if(p!==void 0){let I=g-h,_=xt("maxTokenAge option",typeof p=="number"?p:Mr(p));if(I-l>_)throw new Ne('"iat" claim timestamp check failed (too far in the past)',r,"iat",Pe);if(I<-l)throw new re('"iat" claim timestamp check failed (it should be in the past)',r,"iat",Pe)}return r}o($r,"validateClaimsSet");async function Ot(e,t,n){let[r,s]=await Ur(e,Nr(n),t);if(!s)throw new Ee("JWTs MUST NOT use unencoded payload");let i=$r(r.protectedHeader,r.payload,n);return{...r,payload:i}}o(Ot,"jwtVerify");function so(e,t,n,r){let{kty:s,key_ops:i,ext:c,kid:d,alg:u,use:p,crv:a}=e;return(c===void 0||typeof c=="boolean")&&(i===void 0||Array.isArray(i)&&i.every((f,l)=>typeof f=="string"&&i.indexOf(f)===l)&&i.includes("verify"))&&t.kty.includes(s)&&(r===void 0||typeof r=="string"&&r===d)&&(u===void 0?s!=="AKP":n===u)&&(p===void 0||p==="sig")&&(!t.crv||a===t.crv)}o(so,"isUsableJWK");async function Kr(e,t,n){let r=e.get(t)||e.set(t,{}).get(t),{alg:s}=n;if(r[s]===void 0){let i=It(n,t,!0).then(c=>{if(c.type!=="public")throw new Ue("JSON Web Key Set members must be public keys");return r[s]=c,c}).catch(c=>{throw r[s]===i&&delete r[s],c});r[s]=i}return r[s]}o(Kr,"importWithAlgCache");function Lt(e){let t;try{t=structuredClone(e)}catch{}if(!nt(t))throw new Ue("JSON Web Key Set malformed");let n=t.keys.map(s=>{let i=St(s);return Array.isArray(i.key_ops)&&(i.key_ops=[...i.key_ops]),i}),r=new WeakMap;return Object.defineProperty(async(s,i)=>{let{alg:c,kid:d}={...s,...i?.header},u=typeof c=="string"?Ct[c]:void 0;if(!u||u.secret)throw new X('Unsupported "alg" value for a JSON Web Key Set');let p=t.keys.filter((l,b)=>so(n[b],u,c,d)),{0:a,length:f}=p;if(!f)throw new Se;if(f!==1){let l=new et;throw l[Symbol.asyncIterator]=async function*(){for(let b of p)try{yield await Kr(r,b,u)}catch{}},l}return Kr(r,a,u)},"jwks",{value:o(()=>structuredClone(t),"value")})}o(Lt,"createLocalJWKSet");function io(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&!0||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}o(io,"isCloudflareWorkers");var Nt;(typeof navigator>"u"||!"Cloudflare-Workers"?.startsWith?.("Mozilla/5.0 "))&&(Nt="jose/v6.2.12");var st=Symbol();async function ao(e,t,n,r=fetch){let s=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(i=>{throw i.name==="TimeoutError"?new tt:i});if(s.status!==200)throw new K("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await s.json()}catch{throw new K("Failed to parse the JSON Web Key Set HTTP response as JSON")}}o(ao,"fetchJwks");var Vr=Symbol();function $e(e,t){return Number.isFinite(e)&&Date.now()<e+t}o($e,"isFreshFor");function Fr(e,t,n){if(Number.isNaN(e))throw new TypeError(`"${n}" option must not be NaN`);return typeof e=="number"?e:t}o(Fr,"validateDuration");function Ut(e,t){if(!(e instanceof URL))throw new TypeError("url must be an instance of URL");let n=new URL(e.href).href,r=t??{},s=r.timeoutDuration;if(typeof s=="number"&&(!Number.isInteger(s)||s<0))throw new TypeError('"timeoutDuration" option must be a non-negative integer');let i=typeof s=="number"?s:5e3,c=Fr(r.cooldownDuration,3e4,"cooldownDuration"),d=Fr(r.cacheMaxAge,6e5,"cacheMaxAge"),u=new Headers(r.headers);Nt&&!u.has("User-Agent")&&u.set("User-Agent",Nt),u.has("accept")||u.set("accept","application/json, application/jwk-set+json");let p=r[st],a=r[Vr],f,l,b=0,g=0,h;if(a&&typeof a=="object"){let{uat:D,jwks:I}=a;$e(D,d)&&nt(I)&&(f=D,h=Lt(I))}let L=o(async()=>{if(l&&io()&&(l=void 0),!l){let D=++b,I=l=ao(n,u,AbortSignal.timeout(i),p).then(_=>{let J=Lt(_);if(D<=g)return;h=J;let F=Date.now();a&&(a.uat=F,a.jwks=_),f=F,g=D}).finally(()=>{l===I&&(l=void 0)})}await l},"reload");return Object.defineProperties(async(D,I)=>{(!h||!$e(f,d))&&await L();try{return await h(D,I)}catch(_){if(_ instanceof Se&&!$e(f,c))return await L(),h(D,I);throw _}},{coolingDown:{get:o(()=>$e(f,c),"get"),enumerable:!0},fresh:{get:o(()=>$e(f,d),"get"),enumerable:!0},reload:{value:L,enumerable:!0},reloading:{get:o(()=>!!l,"get"),enumerable:!0},jwks:{value:o(()=>h?.jwks(),"value"),enumerable:!0}})}o(Ut,"createRemoteJWKSet");function jr(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),s=n.indexOf("*");if(s===-1)return n===r;let i=n.slice(0,s),c=n.slice(s+1);if(i.includes(".")||!c.startsWith(".")||c.includes("*")||!r.startsWith(i)||!r.endsWith(c))return!1;let d=r.slice(0,-c.length);return d.length>0&&!d.includes(".")}o(jr,"matchesHostname");function co(e,t){let n=t.audiences.find(r=>!r.hostname.includes("*")&&jr(r.hostname,e));return n?n.audience:t.audiences.find(r=>jr(r.hostname,e))?.audience??null}o(co,"resolveAccessAudience");var Mt=class{constructor(t=(n,r)=>fetch(n,r)){this.request=t}request;static{o(this,"ProjectAccessVerifier")}keys=new Map;async verify(t,n,r){try{let s=co(t,r);if(!s||!n||n.length>32*1024)return!1;let i=r.teamDomain.replace(/\/+$/,""),c=new URL(i);if(c.protocol!=="https:"||!c.hostname.endsWith(".cloudflareaccess.com")||c.origin!==i)return!1;let d=this.keys.get(i);d||(this.keys.size>=16&&this.keys.delete(this.keys.keys().next().value),d=Ut(new URL(`${i}/cdn-cgi/access/certs`),{timeoutDuration:1e4,[st]:async(p,a)=>{let f=await this.request(p,{...a,redirect:"manual"});if(f.status>=300&&f.status<400)throw await f.body?.cancel(),new Error("Access key endpoint redirected.");return f}}),this.keys.set(i,d));let{payload:u}=await Ot(n,d,{issuer:i,audience:s,algorithms:["RS256"],requiredClaims:["iss","aud","iat","exp","type"]});return u.type==="app"&&typeof u.iat=="number"&&u.iat<=Date.now()/1e3+30}catch{return!1}}},Wr=new Mt;var Ht='system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';function $t(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}o($t,"escapeHtml");function Jr(e,t,n=!1){let r=`${e}: ${t}`,s=`${e}: `;return`<!doctype html>
|
|
1
|
+
var $n=Object.defineProperty;var o=(e,t)=>$n(e,"name",{value:t,configurable:!0});var Fn=["github","google","oidc","cloudflare-access"];var Kn={ai:!0,customDomains:!1,email:!1,githubActions:!1,githubOAuth:!0,googleOAuth:!1,managedBuilds:!1,sandbox:!1},jn={apiHostname:null,dashboardHostname:null,proxyHostname:null};function Qe(e,t){if(typeof e!="string"||e.trim()==="")throw new Error(`${t} must be a non-empty string.`);return e}o(Qe,"requiredString$1");function fr(e){let t=e.trim().toLowerCase().replaceAll(/[^a-z0-9-]+/g,"-").replaceAll(/^-+|-+$/g,"").replaceAll(/-{2,}/g,"-");if(!t)throw new Error("The installation name must contain a letter or number.");if(t.length>40)throw new Error("The installation name must be 40 characters or fewer after normalization.");return t}o(fr,"normalizeInstallationSlug");function de(e){let t=e.trim().toLowerCase();if(t.endsWith(".")&&(t=t.slice(0,-1)),t.length>253||!t.includes(".")||t.split(".").some(r=>!/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(r)))throw new Error(`Invalid domain: ${JSON.stringify(e)}.`);return t}o(de,"normalizeApplicationDomain");function Vn(e){let t=e.trim(),r;try{r=new URL(t)}catch{throw new Error("The dashboard URL must be an HTTPS origin.")}if(!/^https:\/\/[^/?#]+\/?$/i.test(t)||/[\s\\]/.test(t)||r.protocol!=="https:"||r.username||r.password||r.pathname!=="/"||r.search||r.hash)throw new Error("The dashboard URL must be an HTTPS origin without credentials, a path, query, or fragment.");return r.hostname=de(r.hostname),r.origin}o(Vn,"normalizePlatformDashboardUrl");function Wn(e){let t=`void-${fr(e)}`,r=t.replaceAll("-","_");return{aiGateway:t,apiWorker:`${t}-api`,assetsBucket:`${t}-assets`,cronQueue:`${t}-cron-fires`,deploymentQueue:`${t}-deployments`,dashboardWorker:`${t}-dashboard`,dispatchNamespace:`${t}-users`,dispatchWorker:`${t}-dispatch`,emailGatewayWorker:`${t}-email-gateway`,hyperdrive:`${t}-database`,isrCacheKv:`${t}-isr-cache`,legacyAssetsKv:`${t}-legacy-assets`,logsDataset:`${r}_logs`,proxyWorker:`${t}-proxy`,requestsDataset:`${r}_requests`,routingKv:`${t}-routing`,tailWorker:`${t}-tail`,usageQueue:`${t}-usage-events`}}o(Wn,"createPlatformResourceNames");function Jn(e){if(!e.zoneName&&e.workersDev){if(e.dedicatedZone)throw new Error("workers.dev cannot use a dedicated-zone catch-all.");return[]}let t=de(e.baseDomain),r=de(e.zoneName);if(t!==r&&!t.endsWith(`.${r}`))throw new Error(`Application domain ${t} is not inside zone ${r}.`);let n=[{pattern:`*.${t}/*`,zoneName:r},{pattern:`*.${t}`,zoneName:r}];if(e.dedicatedZone){if(t!==r)throw new Error("A dedicated-zone catch-all requires the application domain to be the zone.");n.push({pattern:"*/*",zoneName:r},{pattern:"*",zoneName:r})}return n}o(Jn,"createApplicationRoutes");function Bn(e){if(e.emailSharedZoneId===void 0!=(e.emailSenderDomain===void 0))throw new Error("Shared email configuration requires both emailSenderDomain and emailSharedZoneId.");let t=fr(e.installationSlug),r=de(e.application.baseDomain),n=e.application.workersDev;if(n&&(!/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(n.subdomain)||!/^[a-z0-9][a-z0-9-]{0,80}$/.test(n.installationId)))throw new Error("Invalid workers.dev installation identity.");let s=n&&e.application.zoneName===""?"":de(e.application.zoneName);if(!s&&r!==`${n.subdomain}.workers.dev`)throw new Error("workers.dev application domain must match its account subdomain.");let i={...Wn(t),...e.resources},c={...Kn,...e.capabilities};if(c.managedBuilds&&!c.githubActions)throw new Error("Managed builds require the GitHub Actions capability.");if(e.appAccess!==void 0&&!["public","platform","custom"].includes(e.appAccess))throw new Error("appAccess must be public, platform, or custom.");let u=e.authentication?.providers??["github"];if(u.some(f=>!Fn.includes(f))||new Set(u).size!==u.length)throw new Error("Authentication providers must be unique supported login kinds.");let p=e.authentication?.configurable===!0||e.authentication?.accessProtection===!0||u.some(f=>f==="oidc"||f==="cloudflare-access");if(u.length===0)throw new Error("At least one authentication provider is required.");if(u.includes("github")!==c.githubOAuth)throw new Error("The GitHub provider and githubOAuth capability must agree.");if(u.includes("google")!==c.googleOAuth)throw new Error("The Google provider and googleOAuth capability must agree.");let d=e.controlPlane?.dashboardUrl===void 0?void 0:Vn(e.controlPlane.dashboardUrl),a={...e.appAccess!==void 0?{appAccess:e.appAccess}:{},application:{baseDomain:r,dedicatedZone:e.application.dedicatedZone??!1,zoneName:s,...n?{workersDev:{...n}}:{},...e.application.zoneId?{zoneId:Qe(e.application.zoneId,"application.zoneId")}:{}},authentication:{providers:[...u],...p?{configurable:!0}:{},...e.authentication?.accessProtection?{accessProtection:!0}:{}},capabilities:c,...e.emailSharedZoneId!==void 0?{emailSharedZoneId:Qe(e.emailSharedZoneId,"emailSharedZoneId")}:{},...e.emailSenderDomain!==void 0?{emailSenderDomain:de(e.emailSenderDomain)}:{},controlPlane:{...jn,...e.controlPlane,...d!==void 0?{dashboardUrl:d,dashboardHostname:e.controlPlane?.dashboardHostname??new URL(d).hostname}:{}},displayName:Qe(e.displayName,"displayName").trim(),installationSlug:t,resources:i,schemaVersion:e.appAccess!==void 0?4:p?3:n?2:1};Jn(a.application);for(let[f,l]of Object.entries(a.controlPlane))f!=="dashboardUrl"&&l!==null&&de(l);if(a.controlPlane.dashboardUrl){let f=new URL(a.controlPlane.dashboardUrl).hostname;if(a.controlPlane.dashboardHostname!==f)throw new Error("The dashboard URL and dashboard hostname must agree.")}for(let[f,l]of Object.entries(a.resources))Qe(l,`resources.${f}`);return a}o(Bn,"createPlatformDeploymentManifest");var mr=2;function ye(e){let t=e.SITE_DOMAIN??e.BASE_HOSTNAME??"void.app";return e.PLATFORM_APPLICATION?Bn({installationSlug:"runtime",displayName:"Runtime",application:JSON.parse(e.PLATFORM_APPLICATION)}).application:{baseDomain:t,zoneName:t,dedicatedZone:!1}}o(ye,"readPlatformApplication");function hr(e){return`workers-dev:${e}`}o(hr,"platformWorkersDevAliasKey");var zn="__void/platform/application/v1";async function gr(e){if(!e.PLATFORM_APPLICATION)return e;let t=await e.ROUTING.get(zn);if(!t)return e;let r=ye(e),n=ye({PLATFORM_APPLICATION:t});if(!r.workersDev||!n.workersDev||r.workersDev.installationId!==n.workersDev.installationId||r.workersDev.subdomain!==n.workersDev.subdomain)throw new Error("Application routing belongs to another platform installation.");return{...e,PLATFORM_APPLICATION:t,SITE_DOMAIN:n.baseDomain,BASE_HOSTNAME:n.baseDomain,...n.zoneId?{CF_ZONE_ID:n.zoneId}:{}}}o(gr,"resolvePlatformApplicationEnvironment");function qn(e){return`void-${e.installationId.slice(-12)}-`}o(qn,"platformProjectIngressPrefix");function Gn(e,t){if(!/^proj_[a-z0-9]{1,32}$/.test(e.id)||!/^[a-z0-9][a-z0-9-]*$/.test(e.slug))throw new Error("Invalid platform project identity.");let r=qn(t),n=`-${e.id.slice(5)}`;return`${r}${e.slug.slice(0,63-r.length-n.length).replace(/-+$/,"")}${n}`}o(Gn,"platformProjectIngressName");function yr(e,t){return`${Gn(e,t)}.${t.subdomain}.workers.dev`}o(yr,"platformProjectWorkersDevHostname");var At="void-platform-health";function wr(e){return e.zoneName?`${At}.${e.baseDomain}`:null}o(wr,"platformHealthHostname");var Xe=new TextEncoder,Ze=new TextDecoder,et=new TextDecoder("utf-8",{fatal:!0}),Ss=2**32;function br(...e){let t=e.reduce((s,{length:i})=>s+i,0),r=new Uint8Array(t),n=0;for(let s of e)r.set(s,n),n+=s.length;return r}o(br,"concat");var Yn=/[^\x00-\x7f]/;function we(e){if(typeof e=="string"&&e.length>=128){if(Yn.test(e))throw new TypeError("non-ASCII string encountered in encode()");return Xe.encode(e)}let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw new TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}o(we,"encode");function Ar(e,t=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e,{alphabet:t?"base64url":"base64"});if(t){if(e.includes("+")||e.includes("/"))throw new TypeError("Invalid base64url");e=e.replace(/-/g,"+").replace(/_/g,"/")}let r=atob(e),n=new Uint8Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);return n}o(Ar,"decodeBase64");var K=class extends Error{static{o(this,"JOSEError")}static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,r){super(t,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},te=class extends K{static{o(this,"JWTClaimValidationFailed")}static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(t,r,n="unspecified",s="unspecified"){super(t,{cause:{claim:n,reason:s,payload:r}}),this.claim=n,this.reason=s,this.payload=r}},De=class extends K{static{o(this,"JWTExpired")}static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(t,r,n="unspecified",s="unspecified"){super(t,{cause:{claim:n,reason:s,payload:r}}),this.claim=n,this.reason=s,this.payload=r}},tt=class extends K{static{o(this,"JOSEAlgNotAllowed")}static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},q=class extends K{static{o(this,"JOSENotSupported")}static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"};var F=class extends K{static{o(this,"JWSInvalid")}static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"},be=class extends K{static{o(this,"JWTInvalid")}static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};var Oe=class extends K{static{o(this,"JWKSInvalid")}static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"},Ae=class extends K{static{o(this,"JWKSNoMatchingKey")}static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(t="no applicable key found in the JSON Web Key Set",r){super(t,r)}},rt=class extends K{static{o(this,"JWKSMultipleMatchingKeys")}[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(t="multiple matching keys found in the JSON Web Key Set",r){super(t,r)}},nt=class extends K{static{o(this,"JWKSTimeout")}static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(t="request timed out",r){super(t,r)}},ot=class extends K{static{o(this,"JWSSignatureVerificationFailed")}static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(t="signature verification failed",r){super(t,r)}};var Qn="The input to be decoded is not correctly encoded.";function Le(e){try{return Ar(typeof e=="string"?e:Ze.decode(e),!0)}catch(t){throw new TypeError(Qn,{cause:t})}}o(Le,"decode");function ae(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}o(ae,"isObject");function st(e){return ae(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(ae)}o(st,"isJwkSet");function Rr(...e){let t=new Set;for(let r of e)if(r)for(let n of Object.keys(r)){if(t.has(n))return!1;t.add(n)}return!0}o(Rr,"isDisjoint");function Rt(e,t,r){try{return Le(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}o(Rt,"decodeBase64url");function Er(e,t,r){try{return we(e)}catch{throw new r(`The ${t} is not a valid base64url string`)}}o(Er,"encodeBase64url");function Sr(e,t,r){let n;try{n=JSON.parse(et.decode(Le(e)))}catch{throw new t(r)}if(!ae(n))throw new t(r);return n}o(Sr,"parseJoseHeader");var Ir={__proto__:null,b64:!0};function Pr(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some(r=>typeof r!="string")))throw new TypeError(`"${e}" option must be an array of strings`);return t===void 0?void 0:new Set(t)}o(Pr,"validateAlgorithms");function _r(e,t,r,n,s){if(s.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(c=>typeof c!="string"||c.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?t:{__proto__:null,...r,...t};for(let c of n.crit){if(!(c in i))throw new q(`Extension Header Parameter "${c}" is not recognized`);if(!Object.hasOwn(s,c)||s[c]===void 0)throw new e(`Extension Header Parameter "${c}" is missing`);if(i[c]&&(!Object.hasOwn(n,c)||n[c]===void 0))throw new e(`Extension Header Parameter "${c}" MUST be integrity protected`)}return n.crit}o(_r,"validateCrit");function Tr(e,t){if(t.includes("b64")){let r=e.b64;if(typeof r!="boolean")throw new F('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}o(Tr,"validateB64");var Xn=o(e=>e[Symbol.toStringTag],"tag"),Zn=o((e,t,r)=>{let{alg:n}=e;if(t.use!==void 0){let s=r==="sign"||r==="verify"?"sig":"enc";if(t.use!==s)throw new TypeError(`Invalid key for this operation, its "use" must be "${s}" when present`)}if(t.alg!==void 0&&t.alg!==n)throw new TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(t.key_ops)){let s=r==="encrypt"||r==="decrypt"?e.ops?.[r==="encrypt"?0:1]:r;if(s&&!t.key_ops.includes(s))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${s}" when present`)}},"jwkMatchesOp");async function vr(e,t,r){let{alg:n,secret:s}=e,i=r==="decrypt"||r==="sign";if(s&&t instanceof Uint8Array)return t;let c,u;if(ae(t)){if(c=io(t),typeof c.kty!="string")throw Cr(n,t,s);if(!(s?c.kty==="oct"&&typeof c.k=="string":c.kty!=="oct"&&(i?c.kty==="AKP"&&typeof c.priv=="string"||typeof c.d=="string":c.d===void 0&&c.priv===void 0)))throw new TypeError(s?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);if(Zn(e,c,r),c.kty==="oct")return Le(c.k);if(!Object.isFrozen(t)){let{key_ops:a}=t;Array.isArray(a)&&Object.freeze(a),Object.freeze(t)}}else{if(!ro(t))throw Cr(n,t,s);let a=s?"secret":i?"private":"public";if(t.type!==a&&(s||["secret","public","private"].includes(t.type)))throw new TypeError(`${Xn(t)} instances must be of type "${a}" for the ${n} algorithm`);if(xr(t))return t;if(u=t,u.type==="secret")return u.export()}Et||=new WeakMap;let p=t,d=Et.get(p);if(d?.[n])return d[n];if(d||Et.set(p,d={}),u&&typeof u.toCryptoKey=="function"){let a=u.type==="public",f=eo[u.asymmetricKeyDetails?.namedCurve],l=e.resolve?.({crv:f,asymmetricKeyType:u.asymmetricKeyType})??e.subtle;return d[n]=u.toCryptoKey(l,a,e.usages[a?0:1])}return c??=u.export({format:"jwk"}),c.alg=n,d[n]=await It(e,c)}o(vr,"prepareKey");var Et,eo={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};var xr=o(e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},"isCryptoKey"),to=o(e=>e?.[Symbol.toStringTag]==="KeyObject","isKeyObject"),ro=o(e=>xr(e)||to(e),"isKeyLike");function no(e,t,...r){if(r.length>2){let n=r.pop();e+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}o(no,"message");function Cr(e,t,r){let n=["CryptoKey","KeyObject","JSON Web Key"];return r&&n.push("Uint8Array"),new TypeError(no(`Key for the ${e} algorithm must be `,t,...n))}o(Cr,"invalidKeyType");var it=o((e,t="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`),"unusable");function oo(e,t){if(t&&!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}o(oo,"checkUsage");function kr(e,t){let{modulusLength:r}=t.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}o(kr,"checkModulusLength");function so(e,t,r){let n=e.algorithm;if(n.name!==t.name)throw it(t.name);if(t.hash&&n.hash?.name!==t.hash)throw it(t.hash,"algorithm.hash");if(t.namedCurve&&n.namedCurve!==t.namedCurve)throw it(t.namedCurve,"algorithm.namedCurve");if(t.length!==void 0&&n.length!==t.length)throw it(t.length,"algorithm.length");oo(e,r)}o(so,"checkCryptoKey");function St(e){return{__proto__:null,...e}}o(St,"snapshotJwk");function io(e){let t=St(e);if(t.ext!==void 0&&typeof t.ext!="boolean")throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(t.key_ops!==void 0){let r=t.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some(s=>typeof s!="string")||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}o(io,"normalizeJwk");async function It(e,t,r){if(!e.kty.includes(t.kty))throw new q('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let n=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,s=!!(t.d||t.priv),i={...t,ext:r??t.ext};return i.kty!=="AKP"&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,n,i.ext??!s,t.key_ops??e.usages[s?1:0])}o(It,"jwkToKey");async function Dr(e,t,r,n=!1){return e instanceof Uint8Array&&(e=await crypto.subtle.importKey("raw",e,t,n,[r])),so(e,t,r),e}o(Dr,"rawKey");function Or(e){let t={__proto__:null};for(let r in e)t[r]={...e[r],alg:r};return t}o(Or,"table");var Ne=[["verify"],["sign"]];function Pt(e){let t={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:Ne}}o(Pt,"hmac");function Re(e,t){let r={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:r,signing:t?{...r,saltLength:t}:r,usages:Ne,minRsaBits:2048}}o(Re,"rsa");function _t(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:Ne}}o(_t,"ecdsa");function Lr(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:Ne}}o(Lr,"eddsa");function Tt(e){let t={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:t,signing:t,usages:Ne}}o(Tt,"mldsa");var Ct=Or({HS256:Pt(256),HS384:Pt(384),HS512:Pt(512),RS256:Re(256),RS384:Re(384),RS512:Re(512),PS256:Re(256,32),PS384:Re(384,48),PS512:Re(512,64),ES256:_t("P-256",256),ES384:_t("P-384",384),ES512:_t("P-521",512),EdDSA:Lr(),Ed25519:Lr(),"ML-DSA-44":Tt(44),"ML-DSA-65":Tt(65),"ML-DSA-87":Tt(87)});function Nr(e){let t=typeof e=="string"?Ct[e]:void 0;if(!t)throw new q(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}o(Nr,"jwsAlgorithm");function Ur(e){return[e&&Pr("algorithms",e.algorithms),e?.crit]}o(Ur,"prepareVerify");function ao(e){return e===void 0?{}:Sr(e,F,"JWS Protected Header is invalid")}o(ao,"parseProtectedHeader");function co(e){try{return we(e)}catch{throw new F("JWS Compact Serialization payload must use only ASCII characters")}}o(co,"encodeCompactUnencodedPayload");async function lo(e,t,r,n,s){let{protected:i,header:c,payload:u}=e,p=s??ao(i);if(!Rr(p,c))throw new F("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let d={...p,...c},a=Tr(p,_r(F,Ir,t[1],p,d)),{alg:f}=d;if(typeof f!="string"||!f)throw new F('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(t[0]&&!t[0].has(f))throw new tt('"alg" (Algorithm) Header Parameter value not allowed');if(a){if(typeof u!="string")throw new F("JWS Payload must be a string")}else if(typeof u!="string"&&!(u instanceof Uint8Array))throw new F("JWS Payload must be a string or an Uint8Array instance");let l=a||typeof u!="string"?u:n(u),A=!1;typeof r=="function"&&(r=await r(p,e),A=!0);let h=Nr(f),y=br(i!==void 0?we(i):new Uint8Array,we("."),typeof l=="string"?t[2]??=Er(l,"payload",F):l),b=Rt(e.signature,"signature",F),U=await vr(h,r,"verify"),P=await Dr(U,h.subtle,"verify");h.minRsaBits&&kr(h.alg,P);let v=!1;try{v=await crypto.subtle.verify(h.signing,P,b,y)}catch{}if(!v)throw new ot;let M={payload:typeof l=="string"?Rt(l,"payload",F):l};return i!==void 0&&(M.protectedHeader=p),c!==void 0&&(M.unprotectedHeader=c),A?[{...M,key:U},a]:[M,a]}o(lo,"verifySignature");async function Mr(e,t,r){if(e instanceof Uint8Array&&(e=Ze.decode(e)),typeof e!="string")throw new F("Compact JWS must be a string or Uint8Array");let{0:n,1:s,2:i,length:c}=e.split(".");if(c!==3)throw new F("Invalid Compact JWS");return lo({payload:s,protected:n,signature:i},t,r,co)}o(Mr,"verifyCompact");var uo=o(e=>Math.floor(e.getTime()/1e3),"epoch"),po={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},fo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Ee="check_failed";function vt(){throw new TypeError("Invalid time period format")}o(vt,"invalidDuration");function Hr(e){typeof e!="string"&&vt();let t=fo.exec(e);(!t||t[4]&&t[1])&&vt();let r=parseFloat(t[2]),n=Math.round(r*po[t[3][0].toLowerCase()]);return Number.isFinite(n)||vt(),t[1]==="-"||t[4]==="ago"?-n:n}o(Hr,"secs");function xt(e,t){if(!Number.isFinite(t))throw new TypeError(`Invalid ${e} input`);return t}o(xt,"validateInput");var $r=o(e=>{let t=e.toLowerCase();return e.includes("/")?t:`application/${t}`},"normalizeTyp"),mo=o((e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(r=>e.includes(r)):!1,"checkAudiencePresence");function kt(e,t,r=!1){let n=e[t];if(!(n===void 0&&!r)){if(typeof n!="number")throw new te(`"${t}" claim must be a number`,e,t,"invalid");return n}}o(kt,"validateNumericDate");function Dt(e,t){throw new te(`unexpected "${t}" claim value`,e,t,Ee)}o(Dt,"unexpectedClaim");function Fr(e,t,r={}){let n;try{n=JSON.parse(et.decode(t))}catch{}if(!ae(n))throw new be("JWT Claims Set must be a top-level JSON object");let{typ:s}=r;if(s!==void 0&&(typeof e.typ!="string"||$r(e.typ)!==$r(s)))throw new te('unexpected "typ" JWT header value',n,"typ",Ee);let{requiredClaims:i=[],issuer:c,subject:u,audience:p,maxTokenAge:d}=r,a=[...i];d!==void 0&&a.push("iat"),p!==void 0&&a.push("aud"),u!==void 0&&a.push("sub"),c!==void 0&&a.push("iss");for(let P of new Set(a.reverse()))if(!Object.hasOwn(n,P))throw new te(`missing required "${P}" claim`,n,P,"missing");c!==void 0&&!(Array.isArray(c)?c:[c]).includes(n.iss)&&Dt(n,"iss"),u!==void 0&&n.sub!==u&&Dt(n,"sub"),p!==void 0&&!mo(n.aud,typeof p=="string"?[p]:p)&&Dt(n,"aud");let{clockTolerance:f}=r,l=0;if(typeof f=="string")l=Hr(f);else if(f!==void 0){if(typeof f!="number")throw new TypeError("Invalid clockTolerance option type");l=f}xt("clockTolerance option",l);let{currentDate:A}=r,h=xt("currentDate option",uo(A===void 0?new Date:A)),y=kt(n,"iat",d!==void 0),b=kt(n,"nbf");if(b!==void 0&&b>h+l)throw new te('"nbf" claim timestamp check failed',n,"nbf",Ee);let U=kt(n,"exp");if(U!==void 0&&U<=h-l)throw new De('"exp" claim timestamp check failed',n,"exp",Ee);if(d!==void 0){let P=h-y,v=xt("maxTokenAge option",typeof d=="number"?d:Hr(d));if(P-l>v)throw new De('"iat" claim timestamp check failed (too far in the past)',n,"iat",Ee);if(P<-l)throw new te('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Ee)}return n}o(Fr,"validateClaimsSet");async function Ot(e,t,r){let[n,s]=await Mr(e,Ur(r),t);if(!s)throw new be("JWTs MUST NOT use unencoded payload");let i=Fr(n.protectedHeader,n.payload,r);return{...n,payload:i}}o(Ot,"jwtVerify");function ho(e,t,r,n){let{kty:s,key_ops:i,ext:c,kid:u,alg:p,use:d,crv:a}=e;return(c===void 0||typeof c=="boolean")&&(i===void 0||Array.isArray(i)&&i.every((f,l)=>typeof f=="string"&&i.indexOf(f)===l)&&i.includes("verify"))&&t.kty.includes(s)&&(n===void 0||typeof n=="string"&&n===u)&&(p===void 0?s!=="AKP":r===p)&&(d===void 0||d==="sig")&&(!t.crv||a===t.crv)}o(ho,"isUsableJWK");async function Kr(e,t,r){let n=e.get(t)||e.set(t,{}).get(t),{alg:s}=r;if(n[s]===void 0){let i=It(r,t,!0).then(c=>{if(c.type!=="public")throw new Oe("JSON Web Key Set members must be public keys");return n[s]=c,c}).catch(c=>{throw n[s]===i&&delete n[s],c});n[s]=i}return n[s]}o(Kr,"importWithAlgCache");function Lt(e){let t;try{t=structuredClone(e)}catch{}if(!st(t))throw new Oe("JSON Web Key Set malformed");let r=t.keys.map(s=>{let i=St(s);return Array.isArray(i.key_ops)&&(i.key_ops=[...i.key_ops]),i}),n=new WeakMap;return Object.defineProperty(async(s,i)=>{let{alg:c,kid:u}={...s,...i?.header},p=typeof c=="string"?Ct[c]:void 0;if(!p||p.secret)throw new q('Unsupported "alg" value for a JSON Web Key Set');let d=t.keys.filter((l,A)=>ho(r[A],p,c,u)),{0:a,length:f}=d;if(!f)throw new Ae;if(f!==1){let l=new rt;throw l[Symbol.asyncIterator]=async function*(){for(let A of d)try{yield await Kr(n,A,p)}catch{}},l}return Kr(n,a,p)},"jwks",{value:o(()=>structuredClone(t),"value")})}o(Lt,"createLocalJWKSet");function go(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&!0||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}o(go,"isCloudflareWorkers");var Nt;(typeof navigator>"u"||!"Cloudflare-Workers"?.startsWith?.("Mozilla/5.0 "))&&(Nt="jose/v6.2.12");var at=Symbol();async function yo(e,t,r,n=fetch){let s=await n(e,{method:"GET",signal:r,redirect:"manual",headers:t}).catch(i=>{throw i.name==="TimeoutError"?new nt:i});if(s.status!==200)throw new K("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await s.json()}catch{throw new K("Failed to parse the JSON Web Key Set HTTP response as JSON")}}o(yo,"fetchJwks");var Vr=Symbol();function Ue(e,t){return Number.isFinite(e)&&Date.now()<e+t}o(Ue,"isFreshFor");function jr(e,t,r){if(Number.isNaN(e))throw new TypeError(`"${r}" option must not be NaN`);return typeof e=="number"?e:t}o(jr,"validateDuration");function Ut(e,t){if(!(e instanceof URL))throw new TypeError("url must be an instance of URL");let r=new URL(e.href).href,n=t??{},s=n.timeoutDuration;if(typeof s=="number"&&(!Number.isInteger(s)||s<0))throw new TypeError('"timeoutDuration" option must be a non-negative integer');let i=typeof s=="number"?s:5e3,c=jr(n.cooldownDuration,3e4,"cooldownDuration"),u=jr(n.cacheMaxAge,6e5,"cacheMaxAge"),p=new Headers(n.headers);Nt&&!p.has("User-Agent")&&p.set("User-Agent",Nt),p.has("accept")||p.set("accept","application/json, application/jwk-set+json");let d=n[at],a=n[Vr],f,l,A=0,h=0,y;if(a&&typeof a=="object"){let{uat:U,jwks:P}=a;Ue(U,u)&&st(P)&&(f=U,y=Lt(P))}let b=o(async()=>{if(l&&go()&&(l=void 0),!l){let U=++A,P=l=yo(r,p,AbortSignal.timeout(i),d).then(v=>{let M=Lt(v);if(U<=h)return;y=M;let W=Date.now();a&&(a.uat=W,a.jwks=v),f=W,h=U}).finally(()=>{l===P&&(l=void 0)})}await l},"reload");return Object.defineProperties(async(U,P)=>{(!y||!Ue(f,u))&&await b();try{return await y(U,P)}catch(v){if(v instanceof Ae&&!Ue(f,c))return await b(),y(U,P);throw v}},{coolingDown:{get:o(()=>Ue(f,c),"get"),enumerable:!0},fresh:{get:o(()=>Ue(f,u),"get"),enumerable:!0},reload:{value:b,enumerable:!0},reloading:{get:o(()=>!!l,"get"),enumerable:!0},jwks:{value:o(()=>y?.jwks(),"value"),enumerable:!0}})}o(Ut,"createRemoteJWKSet");function Wr(e,t){let r=e.toLowerCase(),n=t.toLowerCase(),s=r.indexOf("*");if(s===-1)return r===n;let i=r.slice(0,s),c=r.slice(s+1);if(i.includes(".")||!c.startsWith(".")||c.includes("*")||!n.startsWith(i)||!n.endsWith(c))return!1;let u=n.slice(0,-c.length);return u.length>0&&!u.includes(".")}o(Wr,"matchesHostname");function wo(e,t){let r=t.audiences.find(n=>!n.hostname.includes("*")&&Wr(n.hostname,e));return r?r.audience:t.audiences.find(n=>Wr(n.hostname,e))?.audience??null}o(wo,"resolveAccessAudience");var Mt=class{constructor(t=(r,n)=>fetch(r,n)){this.request=t}request;static{o(this,"ProjectAccessVerifier")}keys=new Map;async verify(t,r,n){try{let s=wo(t,n);if(!s||!r||r.length>32*1024)return!1;let i=n.teamDomain.replace(/\/+$/,""),c=new URL(i);if(c.protocol!=="https:"||!c.hostname.endsWith(".cloudflareaccess.com")||c.origin!==i)return!1;let u=this.keys.get(i);u||(this.keys.size>=16&&this.keys.delete(this.keys.keys().next().value),u=Ut(new URL(`${i}/cdn-cgi/access/certs`),{timeoutDuration:1e4,[at]:async(d,a)=>{let f=await this.request(d,{...a,redirect:"manual"});if(f.status>=300&&f.status<400)throw await f.body?.cancel(),new Error("Access key endpoint redirected.");return f}}),this.keys.set(i,u));let{payload:p}=await Ot(r,u,{issuer:i,audience:s,algorithms:["RS256"],requiredClaims:["iss","aud","iat","exp","type"]});return p.type==="app"&&typeof p.iat=="number"&&p.iat<=Date.now()/1e3+30}catch{return!1}}},Jr=new Mt;function Me(e){return e.slice(e.lastIndexOf("/")+1).includes(".")}o(Me,"hasExtension");function G(e){return e==="/api"||e.startsWith("/api/")}o(G,"isApiPath");function Ht(e,t,r=!1){return G(e)?"api":t&&(!Me(e)||r)?"ssr":null}o(Ht,"classifyDynamicRequestType");var $t='system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';function Ft(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}o(Ft,"escapeHtml");function Br(e,t,r=!1){let n=`${e}: ${t}`,s=`${e}: `;return`<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>${
|
|
6
|
+
<title>${Ft(n)}</title>
|
|
7
7
|
<style>
|
|
8
8
|
:root {
|
|
9
9
|
color-scheme: light;
|
|
10
|
-
font-family: ${
|
|
10
|
+
font-family: ${$t};
|
|
11
11
|
background: #f5f5f5;
|
|
12
12
|
color: #171717;
|
|
13
13
|
}
|
|
@@ -25,7 +25,7 @@ var xn=Object.defineProperty;var o=(e,t)=>xn(e,"name",{value:t,configurable:!0})
|
|
|
25
25
|
background:
|
|
26
26
|
radial-gradient(circle at top, rgba(255, 255, 255, 0.96), rgba(245, 245, 245, 0.96) 52%),
|
|
27
27
|
linear-gradient(180deg, #fafafa 0%, #f1f1f1 100%);
|
|
28
|
-
font: 500 16px/1.5 ${
|
|
28
|
+
font: 500 16px/1.5 ${$t};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
main {
|
|
@@ -41,7 +41,7 @@ var xn=Object.defineProperty;var o=(e,t)=>xn(e,"name",{value:t,configurable:!0})
|
|
|
41
41
|
|
|
42
42
|
h1 {
|
|
43
43
|
margin: 0;
|
|
44
|
-
font: 400 clamp(1.5rem, 1.2rem + 1vw, 2rem) / 1.1 ${
|
|
44
|
+
font: 400 clamp(1.5rem, 1.2rem + 1vw, 2rem) / 1.1 ${$t};
|
|
45
45
|
letter-spacing: -0.03em;
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -56,10 +56,10 @@ var xn=Object.defineProperty;var o=(e,t)=>xn(e,"name",{value:t,configurable:!0})
|
|
|
56
56
|
</head>
|
|
57
57
|
<body>
|
|
58
58
|
<main>
|
|
59
|
-
${
|
|
59
|
+
${r?`<h1>Temporarily unavailable</h1>
|
|
60
60
|
<p>This service is undergoing maintenance. Please try again in a moment.</p>
|
|
61
61
|
<a href="">Try again</a>
|
|
62
|
-
<small>If you submitted a form, check whether it succeeded before submitting it again.</small>`:`<h1><strong>${
|
|
62
|
+
<small>If you submitted a form, check whether it succeeded before submitting it again.</small>`:`<h1><strong>${Ft(s)}</strong>${Ft(t)}</h1>`}
|
|
63
63
|
</main>
|
|
64
64
|
</body>
|
|
65
|
-
</html>`}o(Jr,"renderDefaultErrorPage");function Br(e){let t=new Headers({"Cache-Control":"no-store","Retry-After":"30"});return it(e)?(t.set("Content-Type","text/html; charset=utf-8"),new Response(e.method==="HEAD"?null:Jr(503,"Temporarily unavailable",!0),{status:503,headers:t})):new Response(e.method==="HEAD"?null:"Platform disabled",{status:503,headers:t})}o(Br,"createMaintenanceResponse");function it(e){if(e.method!=="GET"&&e.method!=="HEAD")return!1;let t=new URL(e.url);if(t.pathname==="/api"||t.pathname.startsWith("/api/")||/\/[^/]+\.[^/]+$/.test(t.pathname))return!1;let n=e.headers.get("sec-fetch-dest");if(n&&n!=="document"&&n!=="empty")return!1;let r=e.headers.get("accept");return!r||r.includes("text/html")||r.includes("*/*")}o(it,"shouldServeHtmlErrorPage");function B(e,t,n,r){if(!it(e))return new Response(n,{status:t,headers:r});let s=new Headers(r);return s.set("content-type","text/html; charset=utf-8"),new Response(e.method==="HEAD"?null:Jr(t,n),{status:t,headers:s})}o(B,"createErrorResponse");var ue=new Map,lo=/[.+?^${}()|[\]\\]/,uo=/[A-Za-z0-9_]/;function at(e){let t=ue.get(e);if(t)return ue.delete(e),ue.set(e,t),t;let n=[],r=!1,s="",i=0;for(;i<e.length;){let d=e[i];if(d===":"){let u=i+1;for(;u<e.length&&uo.test(e[u]);)u++;let p=e.slice(i+1,u);if(!p){s+="\\:",i++;continue}e[u]==="*"?(n.push(p),s+=`(?<${p}>.*)`,i=u+1):(n.push(p),s+=`(?<${p}>[^/]+)`,i=u)}else d==="*"?(r?s+=".*":(n.push("splat"),s+="(?<splat>.*)",r=!0),i++):(lo.test(d)&&(s+="\\"),s+=d,i++)}let c={regex:new RegExp(`^${s}$`),paramNames:n};if(ue.size>=256){let d=ue.keys().next();d.done||ue.delete(d.value)}return ue.set(e,c),c}o(at,"compilePattern");var pe=new Map;function _e(e,t){let n=pe.get(e);if(n)pe.delete(e),pe.set(e,n);else{try{let r=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("*",".*");n=new RegExp(`^${r}$`)}catch{return!1}if(pe.size>=256){let r=pe.keys().next();r.done||pe.delete(r.value)}pe.set(e,n)}try{return n.test(t)}catch{return!1}}o(_e,"matchLiteralPattern");var fe=new Map;function ne(e,t){let n=fe.get(e);if(n)fe.delete(e),fe.set(e,n);else{try{let r=e.replace(/(^|\/):[^/{}]+\{\.\+\}(?=\/|$)/g,"$1\uE001").replace(/(^|\/):[^/]+(?=\/|$)/g,"$1\uE000").replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("*",".*").replaceAll("\uE000","[^/]+").replaceAll("\uE001",".+");n=new RegExp(`^${r}$`)}catch{return!1}if(fe.size>=256){let r=fe.keys().next();r.done||fe.delete(r.value)}fe.set(e,n)}try{return n.test(t)}catch{return!1}}o(ne,"matchSegmentPattern");function ct(e,t){return e.replace(/:([A-Za-z0-9_]+)\*?/g,(n,r)=>t[r]??n)}o(ct,"substituteParams");var po=new Set(["set-cookie"]);function fo(e){if(e.length<2||e[0]!=='"'||e[e.length-1]!=='"')return null;let t="";for(let n=1;n<e.length-1;n+=1){let r=e[n];if(r==="\\"){if(n+=1,n>=e.length-1)return null;t+=e[n]}else{if(r==='"')return null;t+=r}}return t}o(fo,"parseQuotedString");function Kt(e){let t=[],n=o(i=>{let c=i.trim();c.length>0&&t.push({raw:c,directive:fo(c)})},"pushMember"),r=0,s=!1;for(let i=0;i<e.length;i+=1){let c=e[i];s?c==="\\"?i+=1:c==='"'&&(s=!1):c==='"'?s=!0:c===","&&(n(e.slice(r,i)),r=i+1)}return n(e.slice(r)),t}o(Kt,"parseClearSiteData");function lt(e){let t=[];for(let{raw:n,directive:r}of Kt(e)){let s=r?.toLowerCase();if(s==="*")return null;r===null||s==="cookies"||t.push(n)}return t.length>0?t.join(", "):null}o(lt,"sanitizeClearSiteData");function Q(e,t,n,r){if(!n||n.length===0)return e;let s=[];for(let p of n)_e(p.pattern,t)&&s.push(...p.headers);if(s.length===0)return e;let i=new Response(e.body,e),c=r?.cookieIsolation!=="origin",d=c?e.headers.get("clear-site-data"):null,u=d===null?null:lt(d);for(let[p,a]of s){let f=p.toLowerCase();if(!(c&&po.has(f))){if(c&&f==="clear-site-data"){let l=lt(a);l!==null?i.headers.set(p,l):u!==null?i.headers.set(p,u):i.headers.delete(p);continue}i.headers.set(p,a)}}return i}o(Q,"applyHeaderRules");function oe(e,t,n){if(!t?.length)return null;for(let r of t){if(r.host&&r.host!==n)continue;let s;try{({regex:s}=at(r.source))}catch(d){console.warn(`[dispatch] skipping routing rule with invalid source ${JSON.stringify(r.source)}: ${d instanceof Error?d.message:String(d)}`);continue}let i=s.exec(e);if(!i)continue;let c=ct(r.destination,i.groups??{});return r.status===200?{type:"rewrite",destination:c}:{type:"redirect",destination:c,status:r.status}}return null}o(oe,"applyRoutingRules");function Ke(e,t){if(!t||t==="?")return e;let n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),s=n===-1?"":e.slice(n),i=r.indexOf("?");if(i===-1)return r+t+s;if(i===r.length-1)return r.slice(0,i)+s;let c=new URLSearchParams(t),d=new URLSearchParams(r.slice(i+1));for(let[u,p]of c)d.has(u)||d.append(u,p);return r.slice(0,i)+"?"+d.toString()+s}o(Ke,"mergeQueryIntoLocation");function Te(e){let t;try{t=decodeURIComponent(e)}catch{return e}if(t===e)return e;let n=Gr(t);return n===null?e:zr(n)===zr(e)?t:e}o(Te,"safeDecodePathname");function zr(e){return e.replace(/%[0-9a-fA-F]{2}/g,t=>t.toUpperCase())}o(zr,"normalizePercentCase");function Gr(e){try{let t=new URL("https://void.invalid/");return t.pathname=e,t.pathname}catch{return null}}o(Gr,"reencodePathname");function qr(e,t,n){if(t[e])return{path:e,hash:t[e]};switch(n){case"auto-trailing-slash":{let r=e+".html";if(t[r])return{path:r,hash:t[r]};let s=(e.endsWith("/")?e:e+"/")+"index.html";if(t[s])return{path:s,hash:t[s]};break}case"force-trailing-slash":{if(!e.endsWith("/")&&e!=="/"){let s=e+"/index.html";if(t[s])return{path:s,hash:t[s],redirect:e+"/"}}let r=e+"index.html";if(t[r])return{path:r,hash:t[r]};break}case"drop-trailing-slash":{if(e==="/"){if(t["/index.html"])return{path:"/index.html",hash:t["/index.html"]};break}if(e.endsWith("/")){let s=e.slice(0,-1),i=s+".html";if(t[i])return{path:i,hash:t[i],redirect:s}}let r=e+".html";if(t[r])return{path:r,hash:t[r]};break}case"none":break}return null}o(qr,"matchManifestEntry");function me(e,t,n){let r=n.html_handling??"auto-trailing-slash",s=qr(e,t,r);if(!s){let i=Te(e);if(i!==e&&(s=qr(i,t,r),s?.redirect!==void 0)){let c=Gr(s.redirect);c!==null&&(s={...s,redirect:c})}}if(s)return s;switch(n.not_found_handling??"none"){case"single-page-application":if(t["/index.html"])return{path:"/index.html",hash:t["/index.html"],spa:!0};break;case"404-page":if(t["/404.html"])return{path:"/404.html",hash:t["/404.html"],notFound:!0};break}return null}o(me,"resolveStaticPath");var mo={html:"text/html; charset=utf-8",htm:"text/html; charset=utf-8",css:"text/css; charset=utf-8",js:"text/javascript; charset=utf-8",mjs:"text/javascript; charset=utf-8",json:"application/json; charset=utf-8",xml:"application/xml; charset=utf-8",svg:"image/svg+xml; charset=utf-8",txt:"text/plain; charset=utf-8",csv:"text/csv; charset=utf-8",md:"text/markdown; charset=utf-8",markdown:"text/markdown; charset=utf-8",yaml:"text/yaml; charset=utf-8",yml:"text/yaml; charset=utf-8",toml:"application/toml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",ico:"image/x-icon",webp:"image/webp",avif:"image/avif",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject",pdf:"application/pdf",wasm:"application/wasm",webmanifest:"application/manifest+json; charset=utf-8",map:"application/json; charset=utf-8",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",ogg:"audio/ogg"};function Ft(e){let t=e.split(".").pop()?.toLowerCase()??"";return mo[t]??"application/octet-stream"}o(Ft,"getContentType");function Ce(e,t){if(e!=="application/null")return!e||e==="application/octet-stream"?Ft(t):e}o(Ce,"resolveAssetContentType");function Vt(e){let t=new Headers({"Cache-Control":"no-store"});return e.retryAt&&Number.isFinite(Date.parse(e.retryAt))&&t.set("Retry-After",String(Math.max(0,Math.ceil((Date.parse(e.retryAt)-Date.now())/1e3)))),Response.json(e,{status:429,headers:t})}o(Vt,"usageLimitResponse");function jt(e){let t=e;return t==="/"?t="__index__":(t=t.startsWith("/")?t.slice(1):t,t.endsWith("/")&&(t=t.slice(0,-1))),t}o(jt,"normalizeIsrPath");function yo(e){return e==="__index__"?"/":`/${e}`}o(yo,"denormalizeIsrPath");function wo(e){return yo(jt(e))}o(wo,"canonicalIsrPathname");function bo(e){return`${e}/isr/v3/`}o(bo,"isrCacheVersionPrefix");function Xr(e,t){return t!==void 0?`${bo(e)}${t}/`:`${e}/isr/`}o(Xr,"isrCachePrefix");var Qr="#rw=";function Fe(e,t,n,r,s){let i=`${Xr(e,t)}${n}/${jt(r)}`;return s?`${i}${Qr}${en(s)}`:i}o(Fe,"isrCacheKey");function Zr(e,t,n,r){return`${Xr(e,t)}${n}/${jt(r)}${Qr}`}o(Zr,"isrCacheVariantPrefix");var Ao=0xcbf29ce484222325n,Ro=0x100000001b3n,Yr=0xffffffffffffffffn;function en(e){let t=new TextEncoder().encode(e),n=Ao;for(let r=0;r<t.length;r++)n=(n^BigInt(t[r]))&Yr,n=n*Ro&Yr;return n.toString(16).padStart(16,"0")}o(en,"hashOriginalUrl");function Wt(e,t,n,r,s){return Eo(e,t,n,r,s?en(s):null)}o(Wt,"isrEdgeCacheUrl");function Eo(e,t,n,r,s){let i=wo(t),c=new URL(`https://${e}${i}`);return r==="json"&&c.searchParams.set("__void","json"),c.searchParams.set("__void_isr",n),s&&c.searchParams.set("__void_orig",s),c.toString()}o(Eo,"buildIsrEdgeCacheUrl");var ve=3,he="x-void-shared-cache-policy";function q(e){e.set(he,String(ve))}o(q,"markSharedCachePolicy");function je(e){return e.headers.get(he)===String(ve)}o(je,"hasCurrentSharedCachePolicy");var So=/<script\b[^>]*\bid=(["'])__VOID_PAGE_DATA__\1[^>]*>([\s\S]*?)<\/script>/i,Io=new Set(["cache-control","x-isr-cache","x-void-page-data","set-cookie"]);function xe(e,t,n){let r=new URL(e);if(!r.search)return r.toString();let s=Po(n,t);if(s.size===0)return r.search="",r.toString();let i=[...new Set(r.searchParams.keys())].filter(u=>s.has(u)).sort(),c=new URLSearchParams;for(let u of i)for(let p of r.searchParams.getAll(u))c.append(u,p);let d=c.toString();return r.search=d?`?${d}`:"",r.toString()}o(xe,"buildVariantOriginalUrl");function Jt(e){if(!e)return;let t=Object.fromEntries(Object.entries(e).filter(([n])=>!n.includes("*")));return Object.keys(t).length>0?t:void 0}o(Jt,"exactQueryAllowlist");function Po(e,t){if(!e)return new Set;for(let[n,r]of Object.entries(e))if(_e(n,t))return new Set(r);return new Set}o(Po,"resolveQueryAllowlist");function Bt(e,t){let n=new TextEncoder().encode(JSON.stringify(e)),r=new ArrayBuffer(4+n.byteLength+t.byteLength);return new DataView(r).setUint32(0,n.byteLength,!0),new Uint8Array(r,4,n.byteLength).set(n),new Uint8Array(r,4+n.byteLength).set(new Uint8Array(t)),r}o(Bt,"packIsrValue");function tn(e){if(e.byteLength<4)return null;let n=new DataView(e).getUint32(0,!0);if(e.byteLength<4+n)return null;try{let r=new Uint8Array(e,4,n),s=JSON.parse(new TextDecoder().decode(r));if(!s||typeof s!="object"||Array.isArray(s))return null;let i={};for(let[c,d]of Object.entries(s)){if(typeof d!="string")return null;i[c]=d}return{headers:i,body:e.slice(4+n)}}catch{return null}}o(tn,"unpackIsrValue");function rn(e,t){if(!e||!t)return null;let n=tn(e);if(!n||!Number.isInteger(t.s)||t.s<200||t.s>599||!Number.isFinite(t.c)||t.c<=0||!Number.isFinite(t.t)||t.t<=0||t.p!==ve)return null;try{new Headers(n.headers)}catch{return null}return{body:new ReadableStream({start(r){r.enqueue(new Uint8Array(n.body)),r.close()}}),status:t.s,headers:n.headers,createdAt:t.c,ttl:t.t}}o(rn,"decodeIsrCacheEntry");function zt(e,t=Date.now()){return t-e.createdAt>e.ttl*1e3}o(zt,"isStale");function qt(e,t,n=Date.now()){let r=new Headers(e.headers);if(r.set("x-isr-cache",t?"STALE":"HIT"),t)r.set("Cache-Control",`public, s-maxage=${Math.min(10,e.ttl)}, max-age=0, must-revalidate`);else{let s=Math.max(0,Math.floor((e.createdAt+e.ttl*1e3-n)/1e3));r.set("Cache-Control",`public, s-maxage=${s}, max-age=0, must-revalidate`)}return q(r),new Response(e.body,{status:e.status,headers:r})}o(qt,"isrCacheResponse");function ke(e,t){let n=e.headers.get("x-revalidate");if(n===null)return t;let r=Number.parseInt(n,10);return Number.isNaN(r)||r<0?t:r}o(ke,"resolveRevalidateTtl");function _o(e){return e.headers.get("Accept")?.toLowerCase().split(",").some(t=>t.split(";",1)[0]?.trim()==="text/event-stream")??!1}o(_o,"acceptsEventStream");function We(e){return e.headers.has("Cookie")||e.headers.has("Authorization")||e.headers.has("Cf-Access-Jwt-Assertion")||_o(e)}o(We,"shouldBypassIsr");function dt(e){if(e.method!=="GET"||e.headers.has("X-VoidPages")||new URL(e.url).pathname.startsWith("/__void/")||!e.headers.get("accept")?.split(",").some(s=>s.trim().toLowerCase().split(";",1)[0]==="text/html"))return!1;let n=e.headers.get("sec-fetch-mode")?.toLowerCase();if(n&&n!=="navigate")return!1;let r=e.headers.get("sec-fetch-dest")?.toLowerCase();return!(r&&r!=="document"||e.headers.has("rsc")||e.headers.has("x-nextjs-data"))}o(dt,"isFrameworkDocumentRequest");function se(e){if(e.headers.get("Vary")?.split(",").some(n=>{let r=n.trim().toLowerCase();return r!==""&&r!=="x-voidpages"})||e.headers.has("Set-Cookie"))return!0;let t=e.headers.get("Cache-Control");return t?t.split(",").some(n=>{let r=n.split("=",1)[0]?.trim().toLowerCase();return r==="private"||r==="no-store"||r==="no-cache"}):!1}o(se,"hasSharedCacheOptOut");function Ve(e,t){if(e==null)return 0;if(typeof e=="number")return e;for(let[n,r]of Object.entries(e))if(ne(n,t))return r;return 0}o(Ve,"resolvePathTtl");function Je(e,t,n,r){if(e){for(let s of e)if(ne(s.pattern,r))return s.revalidate===void 0?Ve(n,r):s.revalidate>0?s.revalidate:0}return Ve(t,r)}o(Je,"resolvePageTtl");function Gt(e){let t={};return e.headers.forEach((n,r)=>{Io.has(r.toLowerCase())||(t[r]=n)}),t}o(Gt,"serializeHeaders");function ut(e){try{let t=JSON.parse(e);return t.deferred===void 0&&t.deferredKeys===void 0?e:null}catch{return null}}o(ut,"normalizePageDataForJsonCache");function Yt(e){let t=e.match(So);return t?ut(t[2]):null}o(Yt,"extractPageDataFromHtml");var To=200;async function on(e,t,n,r,s,i){let c=Fe(t,n,r,s,i);try{let{value:d,metadata:u}=await e.ISR_CACHE.getWithMetadata(c,"arrayBuffer");return rn(d,u)}catch{return null}}o(on,"readIsrCache");async function Xt(e,t,n,r,s,i){let c=Fe(t,n,r,s,i);await e.ISR_CACHE.delete(c)}o(Xt,"deleteIsrCache");async function pt(e,t,n,r,s,i,c,d){let u=Fe(t,n,r,s,d),p=i.clone(),a=Gt(p),f=p.status;if(d&&!await Co(e,t,n,r,s,u))return;let l=await p.arrayBuffer(),b=Bt(a,l);await e.ISR_CACHE.put(u,b,{metadata:{s:f,c:Date.now(),t:c,p:ve}})}o(pt,"writeIsrCache");async function Co(e,t,n,r,s,i){let c=Zr(t,n,r,s),d=await e.ISR_CACHE.list({prefix:c,limit:1e3});return d.keys.length<To?!0:d.keys.some(u=>u.name===i)}o(Co,"isVariantWriteAllowed");function sn(e,t,n){return e.revalidate===void 0?Ve(t,n):e.revalidate>0?e.revalidate:0}o(sn,"matchedPageTtl");function vo(e){return!/[:{*]/.test(e)}o(vo,"isLiteralPattern");function an(e,t,n){if(!e)return!1;for(let r of e)if(ne(r.pattern,t))return vo(r.pattern)&&sn(r,n,t)>0;return!1}o(an,"matchesLiteralPage");function nn(e){return e.includes("*")||e.includes("{.+}")}o(nn,"isBroadCatchAll");function cn(e,t,n,r){if(e&&e.length>0){for(let s of e)if(ne(s.pattern,r))return sn(s,n,r)>0&&!nn(s.pattern)}if(t&&typeof t=="object"){for(let[s,i]of Object.entries(t))if(ne(s,r))return i>0&&!nn(s)}return!1}o(cn,"isDottedPathIsrEligible");function ln(e,t,n,r){return new Request(Wt(new URL(e.url).hostname,t,n,"html",r),{method:"GET"})}o(ln,"isrEdgeCacheKey");function Qt(e,t,n,r){return new Request(Wt(new URL(e.url).hostname,t,n,"json",r),{method:"GET"})}o(Qt,"isrEdgeCacheKeyJson");async function dn(e,t,n){let r=new Headers({"Cache-Control":"no-store",Vary:"Accept, Sec-Fetch-Dest, X-VoidPages"}),s=Vt(t),i=s.headers.get("retry-after");if(i&&r.set("Retry-After",i),e.headers.get("X-VoidPages")==="true"||!it(e))return r.set("Content-Type","application/json"),new Response(e.method==="HEAD"?null:s.body,{status:429,headers:r});try{let c=await n?.();if(c?.ok&&c.headers.get("content-type")?.includes("text/html"))return r.set("Content-Type","text/html; charset=utf-8"),r.set("X-Content-Type-Options","nosniff"),r.set("Content-Security-Policy","default-src 'none'; style-src 'unsafe-inline'; img-src data:; base-uri 'none'; form-action 'none'"),e.method==="HEAD"&&await c.body?.cancel(),new Response(e.method==="HEAD"?null:c.body,{status:429,headers:r});await c?.body?.cancel()}catch{}return B(e,429,t.message,r)}o(dn,"createLimitResponse");var un=fr,xo="__void:usage-signing-key:v1",wa=11520*6e4,pn=new TextEncoder;function ko(e){let t="";for(let n of new Uint8Array(e))t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}o(ko,"base64url");async function Do(e,t){let n=await crypto.subtle.importKey("raw",pn.encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return crypto.subtle.sign("HMAC",n,pn.encode(e))}o(Do,"hmac");async function fn(e){return e.get(xo,{cacheTtl:60})}o(fn,"readUsageSigningKey");function Oo(e,t,n,r){return JSON.stringify([e,t,n,r])}o(Oo,"signedPayload");async function mn(e,t,n,r){return{version:un,source:t,eventId:n,event:r,signature:ko(await Do(Oo(un,t,n,r),e))}}o(mn,"signUsageEvent");function gn(e,t){e.ANALYTICS.writeDataPoint({indexes:[t.projectId],blobs:[t.projectId,t.type,t.method,String(t.status),t.slug,t.failureKind??""],doubles:[1,t.responseBytes,t.durationMs]})}o(gn,"recordRequest");function Lo(e){if(!e.startsWith("user-"))return null;let t=e.lastIndexOf("-dpl_");return t>4?{projectKey:e.slice(0,t),deployId:e.slice(t+1)}:{projectKey:e,deployId:""}}o(Lo,"splitWorkerName");var No=2048,Uo=1024;function hn(e,t){let n=new TextEncoder().encode(e);if(n.length<=t)return e;let r="\u2026";if(t<3)return"";let s=t-3;for(;s>0&&(n[s]&192)===128;)s--;return new TextDecoder().decode(n.slice(0,s))+r}o(hn,"truncateUtf8");function yn(e,t){if(!t.workerName)return;let n=Lo(t.workerName);if(!n)return;let r=t.url;try{r=new URL(t.url).pathname}catch{}let s=`Void platform: your worker did not respond within ${t.timeoutMs} ms. ${t.method} ${hn(r,Uo)} was cut short and returned ${t.status}. The operation may still have side effects; check its outcome before retrying.`;try{e.LOGS.writeDataPoint({indexes:[n.projectKey],blobs:["canceled",JSON.stringify([{level:"error",message:[s],timestamp:Date.now()}]),"[]",hn(t.url,No),t.method,String(t.status),n.deployId],doubles:[Date.now(),t.status]})}catch{}}o(yn,"recordPlatformLog");async function wn(e,t){let n=await fn(e.ROUTING);if(!n)throw new Error("Usage metering is not initialized. Check the platform API /health endpoint.");let r=crypto.randomUUID();await e.USAGE_QUEUE.send(await mn(n,"dispatch",r,t))}o(wn,"sendUsageEvent");var Zt="__void/platform/disabled/v1",er="disabled";var bn="void.app";function An(e,t=bn){let n=`.${t}`;if(!e.endsWith(n))return null;let r=e.slice(0,-n.length);return!r||r.includes(".")||!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(r)?null:r}o(An,"extractSlug");async function Rn(e,t){let n=Ae(t);if(!(!!n.workersDev&&e.endsWith(`.${n.workersDev.subdomain}.workers.dev`)))return{slug:An(e,t.BASE_HOSTNAME),workersDev:!1};let s=await t.ROUTING.get(mr(e));if(s){let i=JSON.parse(s);if(gr(i,n.workersDev)===e)return{slug:i.slug,projectId:i.id,workersDev:!0}}return{slug:null,workersDev:!0}}o(Rn,"resolveProjectHostname");function tr(e){return new URL(typeof e=="string"||e instanceof URL?e:e.url).hostname.endsWith(".workers.dev")}o(tr,"isTestHostname");var Z={async match(e,t){return tr(e)?void 0:caches.default.match(e,t)},async put(e,t){tr(e)||await caches.default.put(e,t)},async delete(e,t){return tr(e)?!1:caches.default.delete(e,t)}};function ft(e){return e.slice(e.lastIndexOf("/")+1).includes(".")}o(ft,"hasExtension");function rr(e,t){return e.startsWith("/api/")||e==="/api"?"api":t&&!ft(e)?"ssr":null}o(rr,"classifyDynamicRequestType");var U=class extends Error{static{o(this,"DispatchTimeoutError")}label;constructor(t){super(`Dispatch operation timed out: ${t}`),this.name="DispatchTimeoutError",this.label=t}};function ge(e,t,n){if(!(t>0)||!Number.isFinite(t))return e;let r=null,s=new Promise((i,c)=>{r=setTimeout(()=>{c(new U(n))},t)});return Promise.race([e,s]).finally(()=>{clearTimeout(r)})}o(ge,"withTimeout");async function nr(e,t){let n=t.delayMs>0&&Number.isFinite(t.delayMs),r=t.timeoutMs>0&&Number.isFinite(t.timeoutMs),s=o(async()=>{try{return{ok:!0,value:await e()}}catch(S){return{ok:!1,error:S}}},"run"),i=[],c=o(()=>{let S={id:i.length+1,promise:s()};return i.push(S),S},"startAttempt"),d=null,u=n?new Promise(S=>{d=setTimeout(()=>S({kind:"hedge"}),t.delayMs)}):null,p=null,a=r?new Promise(S=>{p=setTimeout(()=>S({kind:"timeout"}),t.timeoutMs)}):null,f=o(()=>{clearTimeout(d),clearTimeout(p)},"clearTimers"),l=o(S=>{S.promise.then(async M=>{M.ok&&M.value!==null&&await t.discard?.(M.value)}).catch(()=>{})},"discardAttempt"),b=o(S=>{f();for(let M of i)M.id!==S&&l(M)},"finish"),g=o(()=>{throw b(),new U(t.label)},"timeout"),h=o(S=>S.promise.then(M=>({kind:"attempt",attempt:S,outcome:M})),"waitForAttempt"),L=c(),D=await Promise.race([h(L),...u?[u]:[],...a?[a]:[]]);if(D.kind==="timeout")return g();if(D.kind==="attempt"){if(clearTimeout(d),D.outcome.ok)return b(L.id),D.outcome.value;if(!n)throw b(),D.outcome.error;t.onHedge?.();let S=c(),M=await Promise.race([h(S),...a?[a]:[]]);if(M.kind==="timeout")return g();if(b(S.id),M.outcome.ok)return M.outcome.value;throw M.outcome.error}t.onHedge?.();let I=c(),_=await Promise.race([h(L),h(I),...a?[a]:[]]);if(_.kind==="timeout")return g();if(_.outcome.ok&&_.outcome.value!==null)return b(_.attempt.id),_.outcome.value;let J=_.attempt.id===L.id?I:L,F=await Promise.race([h(J),...a?[a]:[]]);if(F.kind==="timeout")return g();if(F.outcome.ok&&F.outcome.value!==null)return b(J.id),F.outcome.value;if(b(),_.outcome.ok||F.outcome.ok)return null;throw _.outcome.error}o(nr,"withDelayedHedge");function En(e,t=1e4){return e===void 0?t:Number(e)}o(En,"resolveTimeoutMs");var _n="public, max-age=0, must-revalidate",lr=1e3,De=300,j="platform-static-asset-timeout",G="platform-static-asset-error",Y="platform-static-asset-missing",Mo=86400;function Ho(e,t){return[e.url.replace(/^[a-z][a-z\d+.-]*:\/\/[^/\\?#]*/i,"").replace(/[?#].*$/s,""),t.pathname].some(r=>{let s=r;try{s=decodeURIComponent(r)}catch{}return s.replace(/[\\/]+/g,"/").toLowerCase().startsWith("/health")})}o(Ho,"platformHealthExceptionPath");function ie(e){let t=new Response(e.body,e);return t.headers.set("Cache-Control",_n),t.headers.delete(he),t}o(ie,"clientRevalidateResponse");function gt(e,t){return new Response(null,{status:e,headers:{"X-Void-Timeout":t,...e===503?{"Retry-After":"5"}:{}}})}o(gt,"timeoutResponse");function $(e){return e===j?gt(503,"static-asset"):new Response(null,{status:503,headers:{"X-Void-Storage-Error":e===Y?"static-asset-missing":"static-asset-read","Retry-After":"5"}})}o($,"staticAssetFailureResponse");function W(e){return e.headers.get("content-type")?.toLowerCase().split(";",1)[0]?.trim()==="text/event-stream"}o(W,"isEventStreamResponse");function we(e){return e.headers.get("content-type")?.toLowerCase().split(";",1)[0]?.trim()==="text/html"}o(we,"isHtmlResponse");function $o(e,t,n){let r=new Response(e,{headers:{"content-type":"application/json","X-VoidPages":"true",Vary:"X-VoidPages","Cache-Control":`public, s-maxage=${t}, max-age=0, must-revalidate`,"x-isr-cache":n}});return q(r.headers),r}o($o,"jsonCacheResponse");async function sr(e,t,n,r,s){let i=n.headers.get("x-void-page-data"),c=i?ut(i):Yt(await n.clone().text());c&&await e.put(t,$o(c,r,s))}o(sr,"populateJsonEdgeCache");async function Sn(e,t){await Promise.all([Xt(e,t.projectId,t.deploymentId,t.host,t.pathname,t.originalUrl),Z.delete(t.htmlKey),Z.delete(t.jsonKey)])}o(Sn,"deleteSharedIsrEntry");async function ir(e){if(e.response.status!==404||!e.routing.fallbackRules?.length)return{response:e.response,pathname:e.pathname,originalUrlVariant:e.originalUrlVariant,applied:!1};if(e.routing.type==="void"&&e.response.headers.get("X-Void-No-Match")!=="1")return{response:e.response,pathname:e.pathname,originalUrlVariant:e.originalUrlVariant,applied:!1};let t=oe(e.pathname,e.routing.fallbackRules,e.url.hostname);if(t?.type!=="rewrite")return{response:e.response,pathname:e.pathname,originalUrlVariant:e.originalUrlVariant,applied:!1};let n=e.originalUrlHeader??e.originalRequestUrl,r=e.originalUrlVariant??xe(e.originalRequestUrl,e.pathname,e.routing.queryAllowlist),s=new URL(e.url.toString());s.pathname=t.destination;let i=ze(e.dispatchReq,s.toString(),c=>c.set("X-Void-Original-URL",n));return{response:e.deadline===void 0?await e.worker.fetch(i):await ge(e.worker.fetch(i),z(e.deadline.startedAt,e.deadline.timeoutMs,"dispatch"),"dispatch"),pathname:t.destination,originalUrlVariant:r,applied:!0}}o(ir,"applyWorkerFallbackRules");function Ko(e,t,n,r,s){if(s||!r.fallbackRules?.length)return s;if(oe(t,r.fallbackRules,n)?.type==="rewrite")return xe(e,t,r.queryAllowlist)}o(Ko,"buildFallbackOriginalUrlVariant");function or(e,t,n){let r=oe(e,t.fallbackRules,n);return r?.type==="rewrite"?r.destination:void 0}o(or,"resolveCachedWfpFallbackPathname");var Fo="Assets have not yet been deployed to this script";function Vo(e){if(e.status!==200||!e.headers.get("content-type")?.toLowerCase()?.startsWith("text/plain"))return!1;let n=e.headers.get("content-length");if(!n)return!1;let r=Number.parseInt(n,10);return r>0&&r<200}o(Vo,"isLikelyCfAssetStub");function z(e,t,n="static-asset"){if(!(t>0&&Number.isFinite(t)))return t;let r=t-(Date.now()-e);if(r<=0)throw new U(n);return r}o(z,"remainingTimeoutBudget");async function Be(e,t,n,r){let s=r>0&&Number.isFinite(r)?Math.min(lr,r/2):0;try{let i=await nr(()=>e.ROUTING.get(`manifest:${t}`,{cacheTtl:86400}),{delayMs:s,timeoutMs:r,label:"static-asset",onHedge:o(()=>{console.warn(JSON.stringify({event:"wfp-asset-manifest-read-hedge",projectId:n,deploymentId:t,delayMs:s,ts:Date.now()}))},"onHedge")});return i?JSON.parse(i):null}catch(i){throw console.error(JSON.stringify({event:i instanceof U?"wfp-asset-manifest-timeout":"wfp-asset-manifest-read-error",projectId:n,deploymentId:t,error:i instanceof U?void 0:i instanceof Error?i.message:String(i),ts:Date.now()})),i instanceof U?i:new te(i)}}o(Be,"fetchAssetManifest");async function jo(e,t,n,r=1e4,s){if(!t.assetManifestId)return null;let i=Date.now(),c=await Be(e,t.assetManifestId,t.projectId,z(i,r));if(!c)return null;let d=t.assetConfig??{not_found_handling:"none"},u=n,p=me(n,c,d);if((!p||p.notFound)&&s&&s!==n){let f=me(s,c,d);f&&!f.notFound&&(p=f,u=s)}if(!p)return null;if(p.redirect)return{response:new Response(null,{status:308,headers:{Location:p.redirect}}),pathname:u};let a=await mt(e,p.hash,p.path,t.projectId,t.assetManifestId,z(i,r));return a?{response:new Response(a.body,{status:p.notFound?404:200,headers:a.headers}),pathname:u}:null}o(jo,"serveWfpAssetFallback");function Wo(e,t,n){console.log(JSON.stringify({event:"wfp-asset-fallback",projectId:e.projectId,deploymentId:e.assetManifestId,pathname:t,userAgent:n,ts:Date.now()}))}o(Wo,"logWfpAssetFallback");async function ee(e){let t=e.deadline?.startedAt??Date.now(),n=e.deadline?.timeoutMs??e.timeoutMs??1e4;if(W(e.response))return{response:e.response,pathname:e.pathname};if(!Vo(e.response))return{response:e.response,pathname:e.pathname};let r=!1,s;try{if(!(await ge(e.response.clone().text(),z(t,n),"static-asset")).includes(Fo))return{response:e.response,pathname:e.pathname};r=!0,s=await jo(e.env,e.routing,e.pathname,z(t,n),e.fallbackPathname)}catch(i){if(i instanceof U)return r?{response:$(j),failureKind:j,pathname:e.pathname}:{response:gt(503,"dispatch"),pathname:e.pathname};if(i instanceof te)return{response:$(G),failureKind:G,pathname:e.pathname};throw i}return s?(Wo(e.routing,s.pathname,e.userAgent),s):(console.error(JSON.stringify({event:"wfp-asset-fallback-missing",projectId:e.routing.projectId,deploymentId:e.routing.assetManifestId,pathname:e.pathname,ts:Date.now()})),{response:$(Y),failureKind:Y,pathname:e.pathname})}o(ee,"maybeServeWfpAssetFallback");function ze(e,t,n){let r=new Headers(e.headers);n(r);let s=e.cf;return e.bodyUsed||e.body?.locked?(r.delete("content-length"),r.delete("transfer-encoding"),new Request(t,{method:e.method,headers:r,cf:s})):e.method==="GET"||e.method==="HEAD"?new Request(t,{method:e.method,headers:r,cf:s}):new Request(t,{method:e.method,headers:r,body:e.body,cf:s,duplex:"half"})}o(ze,"rebuildRequest");var oc={async fetch(e,t,n){t=await hr(t);let r=new URL(e.url);if(!t.PLATFORM_INSTALLATION_ID&&r.pathname==="/health"&&e.headers.get("X-Health-Check")==="void-admin")return Response.json({ok:!0});if(t.PLATFORM_HEALTH_PROBE_TOKEN&&r.pathname==="/health"&&e.headers.get("X-Void-Platform-Probe")===t.PLATFORM_HEALTH_PROBE_TOKEN)return Response.json({ok:!0,...t.PLATFORM_APPLICATION?{installationId:t.PLATFORM_INSTALLATION_ID}:{}});if(r.hostname.startsWith(`${At}.`)&&r.hostname===yr(Ae(t))&&Ho(e,r))return B(e,404,"Not Found",{"Cache-Control":"no-store"});if(t.PLATFORM_TRAFFIC_STATE==="staging"||t.PLATFORM_TRAFFIC_STATE==="sandbox-drain"||t.PLATFORM_INSTALLATION_ID&&await t.ROUTING.get(Zt)===er)return Br(e);let s=Date.now(),i=En(t.DISPATCH_TIMEOUT_MS);if(r.pathname.startsWith("/__void/")||r.pathname==="/__scheduled"||r.pathname==="/__queue")return B(e,404,"Not Found");let c=await Rn(r.hostname,t),d=c.slug;if(c.workersDev&&!c.projectId)return B(e,404,"Not Found");let u=d??`domain:${r.hostname}`,p=await t.ROUTING.get(u,{cacheTtl:60});if(!p)return B(e,404,"Not Found",{"Cache-Control":"public, max-age=30"});let a=JSON.parse(p);if(c.projectId&&c.projectId!==a.projectId)return B(e,404,"Not Found");if(a.zeroTrust&&!await Wr.verify(r.hostname,e.headers.get("Cf-Access-Jwt-Assertion"),a.zeroTrust))return B(e,403,"Cloudflare Access authentication required",{"Cache-Control":"no-store"});let f=o(w=>dn(e,{code:"usage_limit",resource:w,reason:w==="requests"?"monthly_quota":"cpu",message:w==="requests"?"This app has reached its usage allowance. Please contact the app owner or try again later.":"This request exceeded its execution limit. Please try again."},async()=>{let T=a.staticDeploymentId??a.assetManifestId;if(!T)return null;let v=w==="requests"?"/usage-limit.html":"/execution-limit.html",m=(await Be(t,T,a.projectId,2e3))?.[v];return m?mt(t,m,v,a.projectId,T,2e3):null}),"limitResponse");if(a.suspended==="requests_exceeded")return f("requests");if(a.suspended)return Response.json({error:"usage limit exceeded",reason:a.suspended},{status:429,headers:{"Cache-Control":"public, s-maxage=30, max-age=0"}});e.headers.has("X-Void-Original-URL")&&(e=ze(e,e.url,w=>w.delete("X-Void-Original-URL")));let l=r.pathname,b,g=e.headers.get("upgrade")?.toLowerCase()==="websocket"?"websocket":"static",h=o((w,T)=>{let v=W(w)?0:Number(w.headers.get("content-length")??0);gn(t,{projectId:a.projectId,type:g,method:e.method,status:w.status,responseBytes:v,durationMs:Date.now()-s,slug:d??r.hostname,...T?.failureKind&&{failureKind:T.failureKind}}),a.userId&&n.waitUntil(wn(t,{projectId:a.projectId,userId:a.userId,slug:d??r.hostname,requests:1,responseBytes:v,...w.status>=500&&{status:w.status},...T?.failureKind&&{failureKind:T.failureKind}}));let x=new Response(w.body,w);return x.headers.delete("X-Void-No-Match"),x.headers.delete(he),x.headers.set("X-Hosted-By","void.cloud"),x},"meter"),L=o(()=>(yn(t,{workerName:a.workerName,method:e.method,url:e.url,status:503,timeoutMs:i}),h(gt(503,"dispatch"))),"meterWorkerTimeout"),D,I;if(a.redirectRules?.length){let w=oe(l,a.redirectRules,r.hostname);if(w?.type==="redirect"){let T=Ke(w.destination,r.search);return h(new Response(null,{status:w.status,headers:{Location:T}}))}w?.type==="rewrite"&&(I=e.url,D=xe(e.url,l,a.queryAllowlist),l=w.destination,r.pathname=l)}let _=e;if(I&&(_=ze(e,r.toString(),w=>w.set("X-Void-Original-URL",I))),a.hashedAssetsPrefix&&cr(e)){let w="/"+a.hashedAssetsPrefix+"/";if(l.startsWith(w)){let T=new URL(r.toString());T.search="";let v=new Request(T.toString()),x=["cache-control","content-type","content-encoding","content-length","content-range","accept-ranges","transfer-encoding"],m=o((E,C)=>{let A=Q(E,l,a.headerRules);if(A!==E)for(let R of x){let N=E.headers.get(R);N===null?A.headers.delete(R):A.headers.set(R,N)}return h(A,C?{failureKind:C}:void 0)},"finalizeAsset"),P=Z,O=await P.match(v);if(O?.headers.get("Cache-Control")?.includes("immutable")&&Pn(O)){if(!a.staticDeploymentId){let E=await ee({env:t,routing:a,pathname:l,response:O,userAgent:e.headers.get("user-agent"),timeoutMs:i});if(E.response!==O){if(ye(E.response)){let C=new Response(E.response.body,E.response);C.headers.set("Cache-Control","public, max-age=31536000, immutable"),q(C.headers);let A=C.clone();return n.waitUntil(P.delete(v).then(()=>P.put(v,A))),m(C,E.failureKind)}return n.waitUntil(P.delete(v)),m(E.response,E.failureKind)}}return m(O)}if(O&&await P.delete(v),a.staticDeploymentId){let E=Date.now(),C;try{C=await Be(t,a.staticDeploymentId,a.projectId,z(E,i))}catch(y){if(y instanceof U)return h($(j),{failureKind:j});if(y instanceof te)return h($(G),{failureKind:G});throw y}if(!C)return h($(Y),{failureKind:Y});let A=l,R=C[l];if(!R){let y=Te(l);y!==l&&C[y]&&(A=y,R=C[y])}let N;if(R)try{let y=await mt(t,R,A,a.projectId,a.staticDeploymentId,z(E,i));if(!y)return In(a,A,R),h($(Y),{failureKind:Y});N=y}catch(y){if(y instanceof U)return h($(j),{failureKind:j});if(y instanceof te)return h($(G),{failureKind:G});throw y}else N=B(e,404,"Not Found");if(ye(N)){let y=new Response(N.body,N);return y.headers.set("Cache-Control","public, max-age=31536000, immutable"),q(y.headers),n.waitUntil(P.put(v,y.clone())),m(y)}return m(N)}try{let E=ht(t,a),C=Date.now(),A=await ge(E.fetch(_),z(C,i),"static-asset"),R=await ee({env:t,routing:a,pathname:l,response:A,userAgent:e.headers.get("user-agent"),deadline:{startedAt:C,timeoutMs:i}});A=R.response;let N=R.failureKind;if(ye(A)){let y=new Response(A.body,A);return y.headers.set("Cache-Control","public, max-age=31536000, immutable"),q(y.headers),n.waitUntil(P.put(v,y.clone())),m(y,N)}return m(A,N)}catch(E){if(E instanceof U)return h($(j),{failureKind:j});if(E instanceof Error&&E.message.includes("Worker exceeded"))return h(await f("execution"));throw E}}}if(a.ssr===!0&&(a.type!=="framework"||dt(e))&&zo(l,a.pages,a.revalidate,a.pathRevalidate)&&(a.revalidate||a.pages?.length)){let w=Je(a.pages,a.revalidate,a.pathRevalidate,l);if(w>0&&e.method==="GET"&&!e.headers.has("Range")&&!We(e)){let T=e.headers.has("X-VoidPages"),v=a.version??"legacy",x=Z,m=Ko(e.url,l,r.hostname,a,D),P=ln(e,l,v,m),O=Qt(e,l,v,m);if(b={projectId:a.projectId,deploymentId:v,host:r.hostname,pathname:l,originalUrl:m,htmlKey:P,jsonKey:O},T){let E=await x.match(O);if(E&&je(E))return g="isr",h(ie(E));E&&await x.delete(O)}else{let E=o(async()=>{await Sn(t,b)},"purgePoisonedIsrEntry"),C=await x.match(P);if(C&&je(C)){g="isr";let k=await ee({env:t,routing:a,pathname:l,response:C,userAgent:e.headers.get("user-agent"),timeoutMs:i,fallbackPathname:or(l,a,r.hostname)});return k.response!==C?(n.waitUntil(E()),h(k.response.ok?ie(k.response):k.response,k.failureKind?{failureKind:k.failureKind}:void 0)):h(ie(C))}C&&await x.delete(P);let A=await on(t,a.projectId,v,r.hostname,l,m);if(A){let k=zt(A),V=qt(A,k),ae=await ee({env:t,routing:a,pathname:l,response:V,userAgent:e.headers.get("user-agent"),timeoutMs:i,fallbackPathname:or(l,a,r.hostname)});if(ae.response!==V)return n.waitUntil(E()),g="isr",h(ae.response.ok?ie(ae.response):ae.response,ae.failureKind?{failureKind:ae.failureKind}:void 0);if(k){let Le=V.clone();n.waitUntil(Bo(t,a,_,r.hostname,l,w,P,O,A.createdAt+A.ttl*1e3,m,i).then(async bt=>{bt||await x.put(P,Le)}))}return g="isr",k||n.waitUntil(x.put(P,V.clone())),h(ie(V))}g="isr";let R=ht(t,a),N=Date.now(),y;try{y=await ge(R.fetch(_),z(N,i,"dispatch"),"dispatch")}catch(k){if(k instanceof U)return L();throw k}let le=W(y),be,ur=l,Tn=m,Cn=P,vn=O,yt=ur,wt=!1;if(!le){let k=await ee({env:t,routing:a,pathname:l,response:y,userAgent:e.headers.get("user-agent"),deadline:{startedAt:N,timeoutMs:i}});y=k.response,be=k.failureKind,le=W(y)}if(!le){let k;try{k=await ir({response:y,worker:R,dispatchReq:_,routing:a,pathname:l,url:r,originalRequestUrl:e.url,originalUrlHeader:I,originalUrlVariant:m,deadline:{startedAt:N,timeoutMs:i}})}catch(V){if(V instanceof U)return L();throw V}if(k.applied&&(wt=!0,yt=k.pathname,y=k.response,le=W(y),!le)){let V=await ee({env:t,routing:a,pathname:k.pathname,response:y,userAgent:e.headers.get("user-agent"),deadline:{startedAt:N,timeoutMs:i}});y=V.response,be=V.failureKind,le=W(y)}}if(le)return h(y);let Oe=ke(y,w);if(Oe>0&&y.status===200&&(a.type!=="framework"||we(y))&&!qe(yt)&&!se(y)&&(!wt||ar(a.pages,yt,y,a.pathRevalidate))){n.waitUntil(pt(t,a.projectId,v,r.hostname,ur,y,Oe,Tn)),n.waitUntil(sr(x,vn,y,Oe,"HIT"));let k=new Headers(y.headers);k.set("Cache-Control",`public, s-maxage=${Oe}, max-age=0, must-revalidate`),k.set("x-isr-cache","MISS"),q(k),k.delete("x-void-page-data"),k.delete("set-cookie");let V=new Headers(k);V.set("x-isr-cache","HIT");let ae=new Response(y.clone().body,{status:y.status,headers:V});n.waitUntil(x.put(Cn,ae.clone()));let Le=new Headers(k);Le.set("Cache-Control",_n),Le.delete(he);let bt=new Response(y.body,{status:y.status,headers:Le});return h(bt,be?{failureKind:be}:void 0)}return y.status===200&&!wt&&(Oe===0||se(y)||a.type==="framework"&&!we(y))&&n.waitUntil(E()),h(y,be?{failureKind:be}:void 0)}}}let F=l,S=qo(e,F,a)&&await Go(t,F,a,i),M;if(S){let w=new URL(xe(e.url,new URL(e.url).pathname,Jt(a.queryAllowlist)));w.searchParams.set("_v",String(a.version));let T=new Request(w.toString());M=T;let v=Z,x=await v.match(T);if(x&&Pn(x)){if(g="static",!a.staticDeploymentId){let m=await ee({env:t,routing:a,pathname:l,response:x,userAgent:e.headers.get("user-agent"),timeoutMs:i,fallbackPathname:or(l,a,r.hostname)});if(m.response!==x){if(ye(m.response)){let P=Q(m.response,m.pathname,a.headerRules),O=new Response(P.clone().body,P);O.headers.set("Cache-Control","public, s-maxage=31536000, max-age=0, must-revalidate"),q(O.headers);let E=O.clone();return n.waitUntil(v.delete(T).then(()=>v.put(T,E))),h(ie(P))}return n.waitUntil(v.delete(T)),h(m.response,m.failureKind?{failureKind:m.failureKind}:void 0)}}return h(ie(x))}x&&await v.delete(T)}if(a.staticDeploymentId){let w=Date.now(),T;try{T=await Be(t,a.staticDeploymentId,a.projectId,z(w,i))}catch(R){if(R instanceof U)return h($(j),{failureKind:j});if(R instanceof te)return h($(G),{failureKind:G});throw R}if(!T)return h($(Y),{failureKind:Y});let v=a.assetConfig??{},x=l,m=me(l,T,v);if(!m&&a.fallbackRules?.length){let R=oe(l,a.fallbackRules,r.hostname);R?.type==="rewrite"&&(l=R.destination,r.pathname=l,m=me(l,T,v))}if(!m)return h(B(e,404,"Not Found"));if(m.redirect)return h(new Response(null,{status:308,headers:{Location:m.redirect}}));let P;try{P=await mt(t,m.hash,m.path,a.projectId,a.staticDeploymentId,z(w,i))}catch(R){if(R instanceof U)return h(gt(m.notFound?404:503,"static-asset"),m.notFound?void 0:{failureKind:j});if(R instanceof te)return h(m.notFound?B(e,404,"Not Found"):$(G),m.notFound?void 0:{failureKind:G});throw R}if(!P)return m.notFound?h(B(e,404,"Not Found")):(In(a,m.path,m.hash),h($(Y),{failureKind:Y}));let O=m.notFound?404:200,E=new Response(P.body,{status:O,headers:P.headers}),C=Q(E,l,a.headerRules),A=M??(cr(e)?new Request(`${r.origin}${x}?_v=${a.staticDeploymentId}`):void 0);if(A&&ye(C)){let R=new Response(C.clone().body,C);R.headers.set("Cache-Control","public, s-maxage=31536000, max-age=0, must-revalidate"),q(R.headers),n.waitUntil(Z.put(A,R.clone()))}return h(ie(C))}let dr=ht(t,a);try{let w=_;w.bodyUsed&&(w=ze(w,w.url,()=>{}));let v=w.method!=="GET"&&w.method!=="HEAD"&&a.fallbackRules?.length?w.clone():w,x=Date.now(),m=await ge(dr.fetch(w),z(x,i,"dispatch"),"dispatch"),P=W(m),O;if(!P){let A=await ee({env:t,routing:a,pathname:l,response:m,userAgent:e.headers.get("user-agent"),deadline:{startedAt:x,timeoutMs:i}});m=A.response,O=A.failureKind,P=W(m)}let E=!1;if(!P){let A=await ir({response:m,worker:dr,dispatchReq:v,routing:a,pathname:l,url:r,originalRequestUrl:e.url,originalUrlHeader:I,originalUrlVariant:D,deadline:{startedAt:x,timeoutMs:i}});if(A.applied&&(E=!0,l=A.pathname,r.pathname=l,D=A.originalUrlVariant,m=A.response,P=W(m),!P)){let R=await ee({env:t,routing:a,pathname:l,response:m,userAgent:e.headers.get("user-agent"),deadline:{startedAt:x,timeoutMs:i}});m=R.response,O=R.failureKind,P=W(m)}}if(b&&m.status===200&&!E&&(ke(m,Je(a.pages,a.revalidate,a.pathRevalidate,b.pathname))===0||se(m)||a.type==="framework"&&!we(m))&&n.waitUntil(Sn(t,b)),M&&!E&&ye(m)){let A=new Response(m.body,m);A.headers.delete("x-void-page-data");let R=Q(A,l,a.headerRules),N=new Response(R.clone().body,R);return N.headers.set("Cache-Control","public, s-maxage=31536000, max-age=0, must-revalidate"),q(N.headers),n.waitUntil(Z.put(M,N.clone())),h(ie(R),O?{failureKind:O}:void 0)}let C=rr(l,a.ssr);if(C&&(g=C),(a.revalidate||a.pages?.length)&&!P&&!e.headers.has("X-VoidPages")&&e.method==="GET"&&!e.headers.has("Range")&&(a.type!=="framework"||dt(e))&&!We(e)){let A=Je(a.pages,a.revalidate,a.pathRevalidate,l),R=A>0?ke(m,A):0;if(R>0&&m.status===200&&g==="ssr"&&(a.type!=="framework"||we(m))&&!se(m)&&(!E||ar(a.pages,l,m,a.pathRevalidate))){let N=a.version??"legacy";n.waitUntil(pt(t,a.projectId,N,r.hostname,l,m,R,D));let y=Qt(e,l,N,D);n.waitUntil(sr(Z,y,m,R,"HIT"))}}if(m.headers.has("x-void-page-data")){let A=new Response(m.body,m);return A.headers.delete("x-void-page-data"),h(Q(A,l,a.headerRules),O?{failureKind:O}:void 0)}return h(Q(m,l,a.headerRules),O?{failureKind:O}:void 0)}catch(w){if(w instanceof U){if(w.label==="static-asset")return h($(j),{failureKind:j});let T=rr(l,a.ssr);return T&&(g=T),L()}if(w instanceof te)return h($(G),{failureKind:G});if(w instanceof Error&&w.message.includes("Worker exceeded"))return h(await f("execution"));throw w}},async queue(e,t){if(t.PLATFORM_TRAFFIC_STATE==="staging"||t.PLATFORM_TRAFFIC_STATE==="sandbox-drain"){console.warn(`[queue-relay] platform traffic is staging; retrying queue="${e.queue}" in ${De}s`),e.retryAll({delaySeconds:De});return}if(t.PLATFORM_INSTALLATION_ID){let u;try{u=await t.ROUTING.get(Zt)}catch(p){let a=p instanceof Error?p.message:String(p);console.error(`[queue-relay] platform traffic gate read failed; retrying queue="${e.queue}" in ${De}s error=${JSON.stringify(a)}`),e.retryAll({delaySeconds:De});return}if(u===er){console.warn(`[queue-relay] platform traffic is disabled; retrying queue="${e.queue}" in ${De}s`),e.retryAll({delaySeconds:De});return}}let n=await t.ROUTING.get(`queue:${e.queue}`,{cacheTtl:60});if(!n){console.error(`[queue-relay] missing routing entry for queue="${e.queue}"; retrying all messages`),e.retryAll();return}let{workerName:r,queueName:s,proxyToken:i}=JSON.parse(n),c=Array.from(e.messages,u=>({id:u.id,timestamp:u.timestamp.toISOString(),body:u.body,attempts:u.attempts})),d=t.DISPATCH.get(r);try{let u=JSON.stringify({queue:s,messages:c}),p={"Content-Type":"application/json"};i&&(p["x-void-internal"]=i);let a=await d.fetch(new Request("https://internal/__void/queue",{method:"POST",headers:p,body:u}));if(a.status===404&&(a=await d.fetch(new Request("https://internal/__queue",{method:"POST",headers:p,body:u}))),!a.ok){let b="";try{b=(await a.clone().text()).slice(0,200)}catch{}console.error(`[queue-relay] relay failed queue="${s}" worker="${r}" status=${a.status} body=${JSON.stringify(b)}`),e.retryAll();return}let f;try{f=await a.json()}catch{e.ackAll();return}if(!f.decisions){f.ok!==!1?e.ackAll():e.retryAll();return}let l=new Map(e.messages.map(b=>[b.id,b]));for(let[b,g]of Object.entries(f.decisions)){let h=l.get(b);h&&(g.action==="ack"?h.ack():g.action==="retry"&&h.retry(g.delaySeconds!=null?{delaySeconds:g.delaySeconds}:void 0))}f.ok===!1&&e.retryAll()}catch(u){let p=u instanceof Error?u.message:String(u);console.error(`[queue-relay] relay threw queue="${s}" worker="${r}" error=${JSON.stringify(p)}`),e.retryAll()}}},te=class extends Error{static{o(this,"StaticAssetReadError")}constructor(t){super("Static asset storage read failed",{cause:t}),this.name="StaticAssetReadError"}};function In(e,t,n){console.error(JSON.stringify({event:"static-asset-missing",store:n.startsWith("!")?"r2":"kv",projectId:e.projectId,deploymentId:e.staticDeploymentId??e.assetManifestId,pathname:t,ts:Date.now()}))}o(In,"logStaticAssetMissing");async function mt(e,t,n,r,s,i=1e4){let c=i>0&&Number.isFinite(i)?Math.min(lr,i/2):0,d=Date.now(),u=!1;try{let p=await nr(()=>Jo(e,t,n,r),{delayMs:c,timeoutMs:i,label:"static-asset",discard:o(async a=>{await a.body?.cancel()},"discard"),onHedge:o(()=>{u=!0,console.warn(JSON.stringify({event:"static-asset-read-hedge",store:t.startsWith("!")?"r2":"kv",projectId:r,deploymentId:s,pathname:n,delayMs:c,ts:Date.now()}))},"onHedge")});return u&&console.warn(JSON.stringify({event:"static-asset-read-hedge-result",store:t.startsWith("!")?"r2":"kv",projectId:r,deploymentId:s,pathname:n,outcome:p===null?"miss":"hit",elapsedMs:Date.now()-d,ts:Date.now()})),p}catch(p){throw console.error(JSON.stringify({event:p instanceof U?"static-asset-timeout":"static-asset-read-error",store:t.startsWith("!")?"r2":"kv",projectId:r,deploymentId:s,pathname:n,hedged:u,elapsedMs:Date.now()-d,error:p instanceof U?void 0:p instanceof Error?p.message:String(p),ts:Date.now()})),p instanceof U?p:new te(p)}}o(mt,"fetchStaticAsset");async function Jo(e,t,n,r){let s=t.startsWith("!"),i=s?t.slice(1):t,c=r?`assets/${r}/${i}`:null,d=`assets/${i}`;if(s){let l=c?await e.STATIC_ASSETS_R2.get(c)??await e.STATIC_ASSETS_R2.get(d):await e.STATIC_ASSETS_R2.get(d);if(!l)return null;let b=Ce(l.httpMetadata?.contentType,n),g={ETag:l.httpEtag,...l.size?{"Content-Length":String(l.size)}:{}};return b&&(g["Content-Type"]=b),new Response(l.body,{headers:g})}if(c){let l=await e.STATIC_ASSETS.getWithMetadata(c,{type:"arrayBuffer",cacheTtl:86400});if(l.value){let b=Ce(l.metadata?.ct,n),g={"Content-Length":String(l.value.byteLength)};return b&&(g["Content-Type"]=b),new Response(l.value,{headers:g})}}let{value:u,metadata:p}=await e.STATIC_ASSETS.getWithMetadata(d,{type:"arrayBuffer",cacheTtl:86400});if(!u)return null;let a=Ce(p?.ct,n),f={"Content-Length":String(u.byteLength)};return a&&(f["Content-Type"]=a),new Response(u,{headers:f})}o(Jo,"fetchStaticAssetOnce");function ht(e,t){return t.limits?e.DISPATCH.get(t.workerName,{},{limits:t.limits}):e.DISPATCH.get(t.workerName)}o(ht,"getWorker");async function Bo(e,t,n,r,s,i,c,d,u,p,a=1e4){try{let f=ht(e,t),l=Date.now(),b=ze(n,n.url,S=>S.delete("X-VoidPages")),g=await ge(f.fetch(b),z(l,a,"dispatch"),"dispatch");if(W(g))return!1;let h=g.status,L=await ir({response:g,worker:f,dispatchReq:b,routing:t,pathname:s,url:new URL(b.url),originalRequestUrl:n.url,originalUrlHeader:n.headers.get("X-Void-Original-URL")??void 0,originalUrlVariant:p??void 0,deadline:{startedAt:l,timeoutMs:a}});if(g=L.response,W(g)||(g=(await ee({env:e,routing:t,pathname:L.pathname,response:g,userAgent:n.headers.get("user-agent"),deadline:{startedAt:l,timeoutMs:a}})).response,W(g)))return!1;let I=ke(g,i),_=Z,J=o(async()=>{await Xt(e,t.projectId,t.version??"legacy",r,s,p),await _.delete(c),await _.delete(d)},"evictSharedEntry"),F=L.applied?L.pathname:s;if(I>0&&g.status===200&&(t.type!=="framework"||we(g))&&!qe(F)&&!se(g)&&(!L.applied||ar(t.pages,F,g,t.pathRevalidate))){await pt(e,t.projectId,t.version??"legacy",r,s,g,I,p);let S=new Headers(g.headers);return S.set("x-isr-cache","HIT"),S.set("Cache-Control",`public, s-maxage=${I}, max-age=0, must-revalidate`),q(S),S.delete("set-cookie"),S.delete("x-void-page-data"),await _.put(c,new Response(g.clone().body,{status:g.status,headers:S})),await sr(_,d,g,I,"HIT"),!0}else if(g.status===200&&!qe(F)&&!L.applied&&(I===0||se(g)||t.type==="framework"&&!we(g))){try{await J()}catch(S){console.error("ISR privacy eviction failed:",S)}return!0}else if((h===404||h===410)&&Date.now()-u>Mo*1e3){try{await J()}catch(S){console.error("ISR stale-entry eviction failed:",S)}return!0}return!1}catch(f){return console.error("ISR revalidation failed:",f),!1}}o(Bo,"revalidateInBackground");function qe(e){return e==="/api"||e.startsWith("/api/")}o(qe,"isApiPath");function zo(e,t,n,r){return qe(e)?!1:ft(e)?cn(t,n,r,e):!0}o(zo,"isIsrEligiblePath");function ar(e,t,n,r){return we(n)&&an(e,t,r)}o(ar,"isFallbackTargetCacheable");function cr(e){return e.method==="GET"&&!e.headers.has("Range")&&!e.headers.has("X-VoidPages")&&!We(e)}o(cr,"isSharedStaticCacheRequestEligible");function qo(e,t,n){return!!(cr(e)&&n.version&&!qe(t)&&(ft(t)||!n.ssr))}o(qo,"isStaticCacheRequestEligible");async function Go(e,t,n,r){if(n.staticDeploymentId||!n.ssr)return!0;if(!n.assetManifestId)return!1;try{let s=await Be(e,n.assetManifestId,n.projectId,Math.min(r,lr));if(!s)return!1;if(Object.hasOwn(s,t))return!0;let i=Te(t);return i!==t&&Object.hasOwn(s,i)}catch{return!1}}o(Go,"isKnownStaticAssetPath");function ye(e){return e.status===200&&!W(e)&&!se(e)}o(ye,"isStaticCacheResponseEligible");function Pn(e){return je(e)&&ye(e)}o(Pn,"isCurrentStaticCacheResponse");export{oc as default,W as isEventStreamResponse,we as isHtmlResponse,ze as rebuildRequest};
|
|
65
|
+
</html>`}o(Br,"renderDefaultErrorPage");function zr(e){let t=new Headers({"Cache-Control":"no-store","Retry-After":"30"});return ct(e)?(t.set("Content-Type","text/html; charset=utf-8"),new Response(e.method==="HEAD"?null:Br(503,"Temporarily unavailable",!0),{status:503,headers:t})):new Response(e.method==="HEAD"?null:"Platform disabled",{status:503,headers:t})}o(zr,"createMaintenanceResponse");function ct(e){if(e.method!=="GET"&&e.method!=="HEAD")return!1;let t=new URL(e.url);if(G(t.pathname)||/\/[^/]+\.[^/]+$/.test(t.pathname))return!1;let r=e.headers.get("sec-fetch-dest");if(r&&r!=="document"&&r!=="empty")return!1;let n=e.headers.get("accept");return!n||n.includes("text/html")||n.includes("*/*")}o(ct,"shouldServeHtmlErrorPage");function J(e,t,r,n){if(!ct(e))return new Response(r,{status:t,headers:n});let s=new Headers(n);return s.set("content-type","text/html; charset=utf-8"),new Response(e.method==="HEAD"?null:Br(t,r),{status:t,headers:s})}o(J,"createErrorResponse");var qr=new Map,bo=/[.+?^${}()|[\]\\]/,Ao=/[A-Za-z0-9_]/;function Kt(e,t){let r=e.get(t);return r!==void 0&&(e.delete(t),e.set(t,r)),r}o(Kt,"lruGet");function jt(e,t,r){if(e.size>=256){let n=e.keys().next();n.done||e.delete(n.value)}e.set(t,r)}o(jt,"lruSet");function lt(e){let t=Kt(qr,e);if(t)return t;let r=[],n=!1,s="",i=0;for(;i<e.length;){let u=e[i];if(u===":"){let p=i+1;for(;p<e.length&&Ao.test(e[p]);)p++;let d=e.slice(i+1,p);if(!d){s+="\\:",i++;continue}r.push(d),e[p]==="*"?(s+=`(?<${d}>.*)`,i=p+1):(s+=`(?<${d}>[^/]+)`,i=p)}else u==="*"?(n?s+=".*":(r.push("splat"),s+="(?<splat>.*)",n=!0),i++):(bo.test(u)&&(s+="\\"),s+=u,i++)}let c={regex:new RegExp(`^${s}$`),paramNames:r};return jt(qr,e,c),c}o(lt,"compilePattern");var Gr=new Map;function Se(e,t){let r=Kt(Gr,e);if(!r){try{let n=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("*",".*");r=new RegExp(`^${n}$`)}catch{return!1}jt(Gr,e,r)}try{return r.test(t)}catch{return!1}}o(Se,"matchLiteralPattern");var Yr=new Map;function re(e,t){let r=Kt(Yr,e);if(!r){try{let n=e.replace(/(^|\/):[^/{}]+\{\.\+\}(?=\/|$)/g,"$1\uE001").replace(/(^|\/):[^/]+(?=\/|$)/g,"$1\uE000").replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("*",".*").replaceAll("\uE000","[^/]+").replaceAll("\uE001",".+");r=new RegExp(`^${n}$`)}catch{return!1}jt(Yr,e,r)}try{return r.test(t)}catch{return!1}}o(re,"matchSegmentPattern");function dt(e,t){let r=e.replace(/:([A-Za-z0-9_]+)\*?/g,(n,s)=>t[s]??n);return/^[/\\]{2}/.test(r)&&!/^[/\\]{2}/.test(e)?"/"+r.replace(/^[/\\]+/,""):r}o(dt,"substituteParams");var Ro=new Set(["set-cookie"]);function Eo(e){if(e.length<2||e[0]!=='"'||e[e.length-1]!=='"')return null;let t="";for(let r=1;r<e.length-1;r+=1){let n=e[r];if(n==="\\"){if(r+=1,r>=e.length-1)return null;t+=e[r]}else{if(n==='"')return null;t+=n}}return t}o(Eo,"parseQuotedString");function Vt(e){let t=[],r=o(i=>{let c=i.trim();c.length>0&&t.push({raw:c,directive:Eo(c)})},"pushMember"),n=0,s=!1;for(let i=0;i<e.length;i+=1){let c=e[i];s?c==="\\"?i+=1:c==='"'&&(s=!1):c==='"'?s=!0:c===","&&(r(e.slice(n,i)),n=i+1)}return r(e.slice(n)),t}o(Vt,"parseClearSiteData");function ut(e){let t=[];for(let{raw:r,directive:n}of Vt(e)){let s=n?.toLowerCase();if(s==="*")return null;n===null||s==="cookies"||t.push(r)}return t.length>0?t.join(", "):null}o(ut,"sanitizeClearSiteData");function Y(e,t,r,n){if(!r||r.length===0)return e;let s=[];for(let d of r)Se(d.pattern,t)&&s.push(...d.headers);if(s.length===0)return e;let i=new Response(e.body,e),c=n?.cookieIsolation!=="origin",u=c?e.headers.get("clear-site-data"):null,p=u===null?null:ut(u);for(let[d,a]of s){let f=d.toLowerCase();if(!(c&&Ro.has(f))){if(c&&f==="clear-site-data"){let l=ut(a);l!==null?i.headers.set(d,l):p!==null?i.headers.set(d,p):i.headers.delete(d);continue}i.headers.set(d,a)}}return i}o(Y,"applyHeaderRules");function ne(e,t,r){if(!t?.length)return null;for(let n of t){if(n.host&&n.host!==r)continue;let s;try{({regex:s}=lt(n.source))}catch(u){console.warn(`[dispatch] skipping routing rule with invalid source ${JSON.stringify(n.source)}: ${u instanceof Error?u.message:String(u)}`);continue}let i=s.exec(e);if(!i)continue;let c=dt(n.destination,i.groups??{});return n.status===200?{type:"rewrite",destination:c}:{type:"redirect",destination:c,status:n.status}}return null}o(ne,"applyRoutingRules");function He(e,t){if(!t||t==="?")return e;let r=e.indexOf("#"),n=r===-1?e:e.slice(0,r),s=r===-1?"":e.slice(r),i=n.indexOf("?");if(i===-1)return n+t+s;if(i===n.length-1)return n.slice(0,i)+s;let c=new URLSearchParams(t),u=new URLSearchParams(n.slice(i+1));for(let[p,d]of c)u.has(p)||u.append(p,d);return n.slice(0,i)+"?"+u.toString()+s}o(He,"mergeQueryIntoLocation");function Ie(e){let t;try{t=decodeURIComponent(e)}catch{return e}if(t===e)return e;let r=Zr(t);return r===null?e:Qr(r)===Qr(e)?t:e}o(Ie,"safeDecodePathname");function Qr(e){return e.replace(/%[0-9a-fA-F]{2}/g,t=>t.toUpperCase())}o(Qr,"normalizePercentCase");function Zr(e){try{let t=new URL("https://void.invalid/");return t.pathname=e,t.pathname}catch{return null}}o(Zr,"reencodePathname");function Xr(e,t,r){if(t[e])return{path:e,hash:t[e]};switch(r){case"auto-trailing-slash":{let n=e+".html";if(t[n])return{path:n,hash:t[n]};let s=(e.endsWith("/")?e:e+"/")+"index.html";if(t[s])return{path:s,hash:t[s]};break}case"force-trailing-slash":{if(!e.endsWith("/")&&e!=="/"){let s=e+"/index.html";if(t[s])return{path:s,hash:t[s],redirect:e+"/"}}let n=e+"index.html";if(t[n])return{path:n,hash:t[n]};break}case"drop-trailing-slash":{if(e==="/"){if(t["/index.html"])return{path:"/index.html",hash:t["/index.html"]};break}if(e.endsWith("/")){let s=e.slice(0,-1),i=s+".html";if(t[i])return{path:i,hash:t[i],redirect:s}}let n=e+".html";if(t[n])return{path:n,hash:t[n]};break}case"none":break}return null}o(Xr,"matchManifestEntry");function ue(e,t,r){let n=r.html_handling??"auto-trailing-slash",s=Xr(e,t,n);if(!s){let i=Ie(e);if(i!==e&&(s=Xr(i,t,n),s?.redirect!==void 0)){let c=Zr(s.redirect);c!==null&&(s={...s,redirect:c})}}if(s)return s;switch(r.not_found_handling??"none"){case"single-page-application":if(t["/index.html"])return{path:"/index.html",hash:t["/index.html"],spa:!0};break;case"404-page":if(t["/404.html"])return{path:"/404.html",hash:t["/404.html"],notFound:!0};break}return null}o(ue,"resolveStaticPath");var So={html:"text/html; charset=utf-8",htm:"text/html; charset=utf-8",css:"text/css; charset=utf-8",js:"text/javascript; charset=utf-8",mjs:"text/javascript; charset=utf-8",json:"application/json; charset=utf-8",xml:"application/xml; charset=utf-8",svg:"image/svg+xml; charset=utf-8",txt:"text/plain; charset=utf-8",csv:"text/csv; charset=utf-8",md:"text/markdown; charset=utf-8",markdown:"text/markdown; charset=utf-8",yaml:"text/yaml; charset=utf-8",yml:"text/yaml; charset=utf-8",toml:"application/toml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",ico:"image/x-icon",webp:"image/webp",avif:"image/avif",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject",pdf:"application/pdf",wasm:"application/wasm",webmanifest:"application/manifest+json; charset=utf-8",map:"application/json; charset=utf-8",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",ogg:"audio/ogg"};function Wt(e){let t=e.split(".").pop()?.toLowerCase()??"";return So[t]??"application/octet-stream"}o(Wt,"getContentType");function $e(e,t){if(e!=="application/null")return!e||e==="application/octet-stream"?Wt(t):e}o($e,"resolveAssetContentType");function Jt(e){let t=new Headers({"Cache-Control":"no-store"});return e.retryAt&&Number.isFinite(Date.parse(e.retryAt))&&t.set("Retry-After",String(Math.max(0,Math.ceil((Date.parse(e.retryAt)-Date.now())/1e3)))),Response.json(e,{status:429,headers:t})}o(Jt,"usageLimitResponse");function Bt(e){let t=e;return t==="/"?t="__index__":(t=t.startsWith("/")?t.slice(1):t,t.endsWith("/")&&(t=t.slice(0,-1))),t}o(Bt,"normalizeIsrPath");function _o(e){return e==="__index__"?"/":`/${e}`}o(_o,"denormalizeIsrPath");function To(e){return _o(Bt(e))}o(To,"canonicalIsrPathname");function Co(e,t,r){return r!==void 0?`${e}/isr/${t}/${r}/`:`${e}/isr/`}o(Co,"versionedIsrCachePrefix");function tn(e,t){return Co(e,"v3",t)}o(tn,"isrCachePrefix");var rn="#rw=";function Fe(e,t,r,n,s){let i=`${tn(e,t)}${r}/${Bt(n)}`;return s?`${i}${rn}${on(s)}`:i}o(Fe,"isrCacheKey");function nn(e,t,r,n){return`${tn(e,t)}${r}/${Bt(n)}${rn}`}o(nn,"isrCacheVariantPrefix");var vo=0xcbf29ce484222325n,xo=0x100000001b3n,en=0xffffffffffffffffn;function on(e){let t=new TextEncoder().encode(e),r=vo;for(let n=0;n<t.length;n++)r=(r^BigInt(t[n]))&en,r=r*xo&en;return r.toString(16).padStart(16,"0")}o(on,"hashOriginalUrl");function zt(e,t,r,n,s){return ko(e,t,r,n,s?on(s):null)}o(zt,"isrEdgeCacheUrl");function ko(e,t,r,n,s){let i=To(t),c=new URL(`https://${e}${i}`);return n==="json"&&c.searchParams.set("__void","json"),c.searchParams.set("__void_isr",r),s&&c.searchParams.set("__void_orig",s),c.toString()}o(ko,"buildIsrEdgeCacheUrl");var Pe=3,pe="x-void-shared-cache-policy";function z(e){e.set(pe,String(Pe))}o(z,"markSharedCachePolicy");function je(e){return e.headers.get(pe)===String(Pe)}o(je,"hasCurrentSharedCachePolicy");var Do=/<script\b[^>]*\bid=(["'])__VOID_PAGE_DATA__\1[^>]*>([\s\S]*?)<\/script>/i,Oo=new Set(["cache-control","x-isr-cache","x-void-page-data","set-cookie"]);function _e(e,t,r){let n=new URL(e);if(!n.search)return n.toString();let s=sn(r,t);if(s.size===0)return n.search="",n.toString();let i=[...new Set(n.searchParams.keys())].filter(p=>s.has(p)).sort(),c=new URLSearchParams;for(let p of i)for(let d of n.searchParams.getAll(p))c.append(p,d);let u=c.toString();return n.search=u?`?${u}`:"",n.toString()}o(_e,"buildVariantOriginalUrl");function qt(e,t,r){let n=new URL(e);if(!n.search)return!1;let s=sn(r,t);for(let i of n.searchParams.keys())if(!s.has(i))return!0;return!1}o(qt,"hasUnlistedQueryParams");function Gt(e){if(!e)return;let t=Object.fromEntries(Object.entries(e).filter(([r])=>!r.includes("*")));return Object.keys(t).length>0?t:void 0}o(Gt,"exactQueryAllowlist");function sn(e,t){if(!e)return new Set;for(let[r,n]of Object.entries(e))if(Se(r,t))return new Set(n);return new Set}o(sn,"resolveQueryAllowlist");function Yt(e,t){let r=new TextEncoder().encode(JSON.stringify(e)),n=new ArrayBuffer(4+r.byteLength+t.byteLength);return new DataView(n).setUint32(0,r.byteLength,!0),new Uint8Array(n,4,r.byteLength).set(r),new Uint8Array(n,4+r.byteLength).set(new Uint8Array(t)),n}o(Yt,"packIsrValue");function an(e){if(e.byteLength<4)return null;let r=new DataView(e).getUint32(0,!0);if(e.byteLength<4+r)return null;try{let n=new Uint8Array(e,4,r),s=JSON.parse(new TextDecoder().decode(n));if(!s||typeof s!="object"||Array.isArray(s))return null;let i={};for(let[c,u]of Object.entries(s)){if(typeof u!="string")return null;i[c]=u}return{headers:i,body:e.slice(4+r)}}catch{return null}}o(an,"unpackIsrValue");function cn(e,t){if(!e||!t)return null;let r=an(e);if(!r||!Number.isInteger(t.s)||t.s<200||t.s>599||!Number.isFinite(t.c)||t.c<=0||!Number.isFinite(t.t)||t.t<=0||t.p!==Pe)return null;try{new Headers(r.headers)}catch{return null}return{body:new ReadableStream({start(n){n.enqueue(new Uint8Array(r.body)),n.close()}}),status:t.s,headers:r.headers,createdAt:t.c,ttl:t.t}}o(cn,"decodeIsrCacheEntry");function Qt(e,t=Date.now()){return t-e.createdAt>e.ttl*1e3}o(Qt,"isStale");function Xt(e,t,r=Date.now()){let n=new Headers(e.headers);if(n.set("x-isr-cache",t?"STALE":"HIT"),t)n.set("Cache-Control",`public, s-maxage=${Math.min(10,e.ttl)}, max-age=0, must-revalidate`);else{let s=Math.max(0,Math.floor((e.createdAt+e.ttl*1e3-r)/1e3));n.set("Cache-Control",`public, s-maxage=${s}, max-age=0, must-revalidate`)}return z(n),new Response(e.body,{status:e.status,headers:n})}o(Xt,"isrCacheResponse");function Te(e,t){let r=e.headers.get("x-revalidate");if(r===null)return t;let n=Number.parseInt(r,10);return Number.isNaN(n)||n<0?t:n}o(Te,"resolveRevalidateTtl");function Lo(e){return e.headers.get("Accept")?.toLowerCase().split(",").some(t=>t.split(";",1)[0]?.trim()==="text/event-stream")??!1}o(Lo,"acceptsEventStream");function Ve(e){return e.headers.has("Cookie")||e.headers.has("Authorization")||e.headers.has("Cf-Access-Jwt-Assertion")||Lo(e)}o(Ve,"shouldBypassIsr");function pt(e){if(e.method!=="GET"||e.headers.has("X-VoidPages")||new URL(e.url).pathname.startsWith("/__void/")||!e.headers.get("accept")?.split(",").some(s=>s.trim().toLowerCase().split(";",1)[0]==="text/html"))return!1;let r=e.headers.get("sec-fetch-mode")?.toLowerCase();if(r&&r!=="navigate")return!1;let n=e.headers.get("sec-fetch-dest")?.toLowerCase();return!(n&&n!=="document"||e.headers.has("rsc")||e.headers.has("x-nextjs-data"))}o(pt,"isFrameworkDocumentRequest");function oe(e){if(e.headers.get("Vary")?.split(",").some(r=>{let n=r.trim().toLowerCase();return n!==""&&n!=="x-voidpages"})||e.headers.has("Set-Cookie"))return!0;let t=e.headers.get("Cache-Control");return t?t.split(",").some(r=>{let n=r.split("=",1)[0]?.trim().toLowerCase();return n==="private"||n==="no-store"||n==="no-cache"}):!1}o(oe,"hasSharedCacheOptOut");function Ke(e,t){if(e==null)return 0;if(typeof e=="number")return e;for(let[r,n]of Object.entries(e))if(re(r,t))return n;return 0}o(Ke,"resolvePathTtl");function We(e,t,r,n){if(e){for(let s of e)if(re(s.pattern,n))return s.revalidate===void 0?Ke(r,n):s.revalidate>0?s.revalidate:0}return Ke(t,n)}o(We,"resolvePageTtl");function Zt(e){let t={};return e.headers.forEach((r,n)=>{Oo.has(n.toLowerCase())||(t[n]=r)}),t}o(Zt,"serializeHeaders");function ft(e){try{let t=JSON.parse(e);return t.deferred===void 0&&t.deferredKeys===void 0?e:null}catch{return null}}o(ft,"normalizePageDataForJsonCache");function er(e){let t=e.match(Do);return t?ft(t[2]):null}o(er,"extractPageDataFromHtml");var No=200;async function dn(e,t,r,n,s,i){let c=Fe(t,r,n,s,i);try{let{value:u,metadata:p}=await e.ISR_CACHE.getWithMetadata(c,"arrayBuffer");return cn(u,p)}catch{return null}}o(dn,"readIsrCache");async function tr(e,t,r,n,s,i){let c=Fe(t,r,n,s,i);await e.ISR_CACHE.delete(c)}o(tr,"deleteIsrCache");async function mt(e,t,r,n,s,i,c,u){let p=Fe(t,r,n,s,u),d=i.clone(),a=Zt(d),f=d.status;if(u&&!await Uo(e,t,r,n,s,p))return;let l=await d.arrayBuffer(),A=Yt(a,l);await e.ISR_CACHE.put(p,A,{metadata:{s:f,c:Date.now(),t:c,p:Pe}})}o(mt,"writeIsrCache");async function Uo(e,t,r,n,s,i){let c=nn(t,r,n,s),u=await e.ISR_CACHE.list({prefix:c,limit:1e3});return u.keys.length<No?!0:u.keys.some(p=>p.name===i)}o(Uo,"isVariantWriteAllowed");function un(e,t,r){return e.revalidate===void 0?Ke(t,r):e.revalidate>0?e.revalidate:0}o(un,"matchedPageTtl");function Mo(e){return!/[:{*]/.test(e)}o(Mo,"isLiteralPattern");function pn(e,t,r){if(!e)return!1;for(let n of e)if(re(n.pattern,t))return Mo(n.pattern)&&un(n,r,t)>0;return!1}o(pn,"matchesLiteralPage");function ln(e){return e.includes("*")||e.includes("{.+}")}o(ln,"isBroadCatchAll");function fn(e,t,r,n){if(e&&e.length>0){for(let s of e)if(re(s.pattern,n))return un(s,r,n)>0&&!ln(s.pattern)}if(t&&typeof t=="object"){for(let[s,i]of Object.entries(t))if(re(s,n))return i>0&&!ln(s)}return!1}o(fn,"isDottedPathIsrEligible");function mn(e,t,r,n){return new Request(zt(new URL(e.url).hostname,t,r,"html",n),{method:"GET"})}o(mn,"isrEdgeCacheKey");function rr(e,t,r,n){return new Request(zt(new URL(e.url).hostname,t,r,"json",n),{method:"GET"})}o(rr,"isrEdgeCacheKeyJson");async function hn(e,t,r){let n=new Headers({"Cache-Control":"no-store",Vary:"Accept, Sec-Fetch-Dest, X-VoidPages"}),s=Jt(t),i=s.headers.get("retry-after");if(i&&n.set("Retry-After",i),e.headers.get("X-VoidPages")==="true"||!ct(e))return n.set("Content-Type","application/json"),new Response(e.method==="HEAD"?null:s.body,{status:429,headers:n});try{let c=await r?.();if(c?.ok&&c.headers.get("content-type")?.includes("text/html"))return n.set("Content-Type","text/html; charset=utf-8"),n.set("X-Content-Type-Options","nosniff"),n.set("Content-Security-Policy","default-src 'none'; style-src 'unsafe-inline'; img-src data:; base-uri 'none'; form-action 'none'"),e.method==="HEAD"&&await c.body?.cancel(),new Response(e.method==="HEAD"?null:c.body,{status:429,headers:n});await c?.body?.cancel()}catch{}return J(e,429,t.message,n)}o(hn,"createLimitResponse");var gn=mr,Ho="__void:usage-signing-key:v1",ka=11520*6e4,yn=new TextEncoder;function $o(e){let t="";for(let r of new Uint8Array(e))t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}o($o,"base64url");async function Fo(e,t){let r=await crypto.subtle.importKey("raw",yn.encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return crypto.subtle.sign("HMAC",r,yn.encode(e))}o(Fo,"hmac");async function wn(e){return e.get(Ho,{cacheTtl:60})}o(wn,"readUsageSigningKey");function Ko(e,t,r,n){return JSON.stringify([e,t,r,n])}o(Ko,"signedPayload");async function bn(e,t,r,n){return{version:gn,source:t,eventId:r,event:n,signature:$o(await Fo(Ko(gn,t,r,n),e))}}o(bn,"signUsageEvent");function Rn(e,t){e.ANALYTICS.writeDataPoint({indexes:[t.projectId],blobs:[t.projectId,t.type,t.method,String(t.status),t.slug,t.failureKind??""],doubles:[1,t.responseBytes,t.durationMs]})}o(Rn,"recordRequest");function jo(e){if(!e.startsWith("user-"))return null;let t=e.lastIndexOf("-dpl_");return t>4?{projectKey:e.slice(0,t),deployId:e.slice(t+1)}:{projectKey:e,deployId:""}}o(jo,"splitWorkerName");var Vo=2048,Wo=1024;function An(e,t){let r=new TextEncoder().encode(e);if(r.length<=t)return e;let n="\u2026";if(t<3)return"";let s=t-3;for(;s>0&&(r[s]&192)===128;)s--;return new TextDecoder().decode(r.slice(0,s))+n}o(An,"truncateUtf8");function En(e,t){if(!t.workerName)return;let r=jo(t.workerName);if(!r)return;let n=t.url;try{n=new URL(t.url).pathname}catch{}let s=`Void platform: your worker did not respond within ${t.timeoutMs} ms. ${t.method} ${An(n,Wo)} was cut short and returned ${t.status}. The operation may still have side effects; check its outcome before retrying.`;try{e.LOGS.writeDataPoint({indexes:[r.projectKey],blobs:["canceled",JSON.stringify([{level:"error",message:[s],timestamp:Date.now()}]),"[]",An(t.url,Vo),t.method,String(t.status),r.deployId],doubles:[Date.now(),t.status]})}catch{}}o(En,"recordPlatformLog");async function Sn(e,t){let r=await wn(e.ROUTING);if(!r)throw new Error("Usage metering is not initialized. Check the platform API /health endpoint.");let n=crypto.randomUUID();await e.USAGE_QUEUE.send(await bn(r,"dispatch",n,t))}o(Sn,"sendUsageEvent");var nr="__void/platform/disabled/v1",or="disabled";var In="void.app";function Pn(e,t=In){let r=`.${t}`;if(!e.endsWith(r))return null;let n=e.slice(0,-r.length);return!n||n.includes(".")||!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(n)?null:n}o(Pn,"extractSlug");async function _n(e,t){let r=ye(t);if(!(!!r.workersDev&&e.endsWith(`.${r.workersDev.subdomain}.workers.dev`)))return{slug:Pn(e,t.BASE_HOSTNAME),workersDev:!1};let s=await t.ROUTING.get(hr(e));if(s){let i=JSON.parse(s);if(yr(i,r.workersDev)===e)return{slug:i.slug,projectId:i.id,workersDev:!0}}return{slug:null,workersDev:!0}}o(_n,"resolveProjectHostname");function sr(e){return new URL(typeof e=="string"||e instanceof URL?e:e.url).hostname.endsWith(".workers.dev")}o(sr,"isTestHostname");var Q={async match(e,t){return sr(e)?void 0:caches.default.match(e,t)},async put(e,t){sr(e)||await caches.default.put(e,t)},async delete(e,t){return sr(e)?!1:caches.default.delete(e,t)}};var H=class extends Error{static{o(this,"DispatchTimeoutError")}label;constructor(t){super(`Dispatch operation timed out: ${t}`),this.name="DispatchTimeoutError",this.label=t}};function fe(e,t,r){if(!(t>0)||!Number.isFinite(t))return e;let n=null,s=new Promise((i,c)=>{n=setTimeout(()=>{c(new H(r))},t)});return Promise.race([e,s]).finally(()=>{clearTimeout(n)})}o(fe,"withTimeout");async function ir(e,t){let r=t.delayMs>0&&Number.isFinite(t.delayMs),n=t.timeoutMs>0&&Number.isFinite(t.timeoutMs),s=o(async()=>{try{return{ok:!0,value:await e()}}catch(R){return{ok:!1,error:R}}},"run"),i=[],c=o(()=>{let R={id:i.length+1,promise:s()};return i.push(R),R},"startAttempt"),u=null,p=r?new Promise(R=>{u=setTimeout(()=>R({kind:"hedge"}),t.delayMs)}):null,d=null,a=n?new Promise(R=>{d=setTimeout(()=>R({kind:"timeout"}),t.timeoutMs)}):null,f=o(()=>{clearTimeout(u),clearTimeout(d)},"clearTimers"),l=o(R=>{R.promise.then(async $=>{$.ok&&$.value!==null&&await t.discard?.($.value)}).catch(()=>{})},"discardAttempt"),A=o(R=>{f();for(let $ of i)$.id!==R&&l($)},"finish"),h=o(()=>{throw A(),new H(t.label)},"timeout"),y=o(R=>R.promise.then($=>({kind:"attempt",attempt:R,outcome:$})),"waitForAttempt"),b=c(),U=await Promise.race([y(b),...p?[p]:[],...a?[a]:[]]);if(U.kind==="timeout")return h();if(U.kind==="attempt"){if(clearTimeout(u),U.outcome.ok)return A(b.id),U.outcome.value;if(!r)throw A(),U.outcome.error;t.onHedge?.();let R=c(),$=await Promise.race([y(R),...a?[a]:[]]);if($.kind==="timeout")return h();if(A(R.id),$.outcome.ok)return $.outcome.value;throw $.outcome.error}t.onHedge?.();let P=c(),v=await Promise.race([y(b),y(P),...a?[a]:[]]);if(v.kind==="timeout")return h();if(v.outcome.ok&&v.outcome.value!==null)return A(v.attempt.id),v.outcome.value;let M=v.attempt.id===b.id?P:b,W=await Promise.race([y(M),...a?[a]:[]]);if(W.kind==="timeout")return h();if(W.outcome.ok&&W.outcome.value!==null)return A(M.id),W.outcome.value;if(A(),v.outcome.ok||W.outcome.ok)return null;throw v.outcome.error}o(ir,"withDelayedHedge");function Tn(e,t=1e4){return e===void 0?t:Number(e)}o(Tn,"resolveTimeoutMs");async function Jo(e,t){try{return await e.ROUTING.get(`project-suspended:${t}`,{cacheTtl:60})!==null}catch(r){return console.error(`[queue-relay] suspension check failed project="${t}"; relaying`,r),!1}}o(Jo,"isProjectSuspended");var Ln="public, max-age=0, must-revalidate",Nn=1e3,Ce=300,Cn=3600,Bo=120,ie="platform-static-asset-timeout",ce="platform-static-asset-error",he="platform-static-asset-missing",zo=86400;function qo(e,t){return[e.url.replace(/^[a-z][a-z\d+.-]*:\/\/[^/\\?#]*/i,"").replace(/[?#].*$/s,""),t.pathname].some(n=>{let s=n;try{s=decodeURIComponent(n)}catch{}return s.replace(/[\\/]+/g,"/").toLowerCase().startsWith("/health")})}o(qo,"platformHealthExceptionPath");function se(e){let t=new Response(e.body,e);return t.headers.set("Cache-Control",Ln),t.headers.delete(pe),t}o(se,"clientRevalidateResponse");function yt(e,t){return new Response(null,{status:e,headers:{"X-Void-Timeout":t,...e===503?{"Retry-After":"5"}:{}}})}o(yt,"timeoutResponse");function Je(e){return e===ie?yt(503,"static-asset"):new Response(null,{status:503,headers:{"X-Void-Storage-Error":e===he?"static-asset-missing":"static-asset-read","Retry-After":"5"}})}o(Je,"staticAssetFailureResponse");function V(e){return e.headers.get("content-type")?.toLowerCase().split(";",1)[0]?.trim()==="text/event-stream"}o(V,"isEventStreamResponse");function ge(e){return e.headers.get("content-type")?.toLowerCase().split(";",1)[0]?.trim()==="text/html"}o(ge,"isHtmlResponse");function Go(e,t,r){let n=new Response(e,{headers:{"content-type":"application/json","X-VoidPages":"true",Vary:"X-VoidPages","Cache-Control":`public, s-maxage=${t}, max-age=0, must-revalidate`,"x-isr-cache":r}});return z(n.headers),n}o(Go,"jsonCacheResponse");async function cr(e,t,r,n,s){let i=r.headers.get("x-void-page-data"),c=i?ft(i):er(await r.clone().text());c&&await e.put(t,Go(c,n,s))}o(cr,"populateJsonEdgeCache");async function vn(e,t){await Promise.all([tr(e,t.projectId,t.deploymentId,t.host,t.pathname,t.originalUrl),Q.delete(t.htmlKey),Q.delete(t.jsonKey)])}o(vn,"deleteSharedIsrEntry");async function lr(e){let t={response:e.response,pathname:e.pathname,originalUrlVariant:e.originalUrlVariant,applied:!1};if(e.response.status!==404||!e.routing.fallbackRules?.length||e.routing.type==="void"&&e.response.headers.get("X-Void-No-Match")!=="1")return t;let r=ne(e.pathname,e.routing.fallbackRules,e.url.hostname);if(r?.type!=="rewrite")return t;let n=e.originalUrlHeader??e.originalRequestUrl,s=e.originalUrlVariant??_e(e.originalRequestUrl,e.pathname,e.routing.queryAllowlist),i=new URL(e.url.toString());i.pathname=r.destination;let c=ve(e.dispatchReq,i.toString(),u=>u.set("X-Void-Original-URL",n));return{response:e.deadline===void 0?await e.worker.fetch(c):await fe(e.worker.fetch(c),B(e.deadline.startedAt,e.deadline.timeoutMs,"dispatch"),"dispatch"),pathname:r.destination,originalUrlVariant:s,applied:!0}}o(lr,"applyWorkerFallbackRules");function Yo(e,t,r,n,s){if(s)return s;let i=_e(e,t,n.queryAllowlist);return(n.fallbackRules?.length?ne(t,n.fallbackRules,r):void 0)?.type==="rewrite"||new URL(i).search?i:void 0}o(Yo,"buildFallbackOriginalUrlVariant");function ar(e,t,r){let n=ne(e,t.fallbackRules,r);return n?.type==="rewrite"?n.destination:void 0}o(ar,"resolveCachedWfpFallbackPathname");var Qo="Assets have not yet been deployed to this script";function Xo(e){if(e.status!==200||!e.headers.get("content-type")?.toLowerCase()?.startsWith("text/plain"))return!1;let r=e.headers.get("content-length");if(!r)return!1;let n=Number.parseInt(r,10);return n>0&&n<200}o(Xo,"isLikelyCfAssetStub");function B(e,t,r="static-asset"){if(!(t>0&&Number.isFinite(t)))return t;let n=t-(Date.now()-e);if(n<=0)throw new H(r);return n}o(B,"remainingTimeoutBudget");function Un(e){return e>0&&Number.isFinite(e)?Math.min(Nn,e/2):0}o(Un,"staticAssetHedgeDelayMs");async function Be(e,t,r,n){let s=Un(n);try{let i=await ir(()=>e.ROUTING.get(`manifest:${t}`,{cacheTtl:86400}),{delayMs:s,timeoutMs:n,label:"static-asset",onHedge:o(()=>{console.warn(JSON.stringify({event:"wfp-asset-manifest-read-hedge",projectId:r,deploymentId:t,delayMs:s,ts:Date.now()}))},"onHedge")});return i?JSON.parse(i):null}catch(i){throw console.error(JSON.stringify({event:i instanceof H?"wfp-asset-manifest-timeout":"wfp-asset-manifest-read-error",projectId:r,deploymentId:t,error:i instanceof H?void 0:i instanceof Error?i.message:String(i),ts:Date.now()})),i instanceof H?i:new Z(i)}}o(Be,"fetchAssetManifest");async function Zo(e,t,r,n=1e4,s){if(!t.assetManifestId)return null;let i=Date.now(),c=await Be(e,t.assetManifestId,t.projectId,B(i,n));if(!c)return null;let u=t.assetConfig??{not_found_handling:"none"},p=r,d=ue(r,c,u);if((!d||d.notFound)&&s&&s!==r){let f=ue(s,c,u);f&&!f.notFound&&(d=f,p=s)}if(!d)return null;if(d.redirect)return{response:new Response(null,{status:308,headers:{Location:d.redirect}}),pathname:p};let a=await ht(e,d.hash,d.path,t.projectId,t.assetManifestId,B(i,n));return a?{response:new Response(a.body,{status:d.notFound?404:200,headers:a.headers}),pathname:p}:null}o(Zo,"serveWfpAssetFallback");function es(e,t,r){console.log(JSON.stringify({event:"wfp-asset-fallback",projectId:e.projectId,deploymentId:e.assetManifestId,pathname:t,userAgent:r,ts:Date.now()}))}o(es,"logWfpAssetFallback");async function X(e){let t=e.deadline?.startedAt??Date.now(),r=e.deadline?.timeoutMs??e.timeoutMs??1e4;if(V(e.response))return{response:e.response,pathname:e.pathname};if(!Xo(e.response))return{response:e.response,pathname:e.pathname};let n=!1,s;try{if(!(await fe(e.response.clone().text(),B(t,r),"static-asset")).includes(Qo))return{response:e.response,pathname:e.pathname};n=!0,s=await Zo(e.env,e.routing,e.pathname,B(t,r),e.fallbackPathname)}catch(i){if(i instanceof H)return n?{response:Je(ie),failureKind:ie,pathname:e.pathname}:{response:yt(503,"dispatch"),pathname:e.pathname};if(i instanceof Z)return{response:Je(ce),failureKind:ce,pathname:e.pathname};throw i}return s?(es(e.routing,s.pathname,e.userAgent),s):(console.error(JSON.stringify({event:"wfp-asset-fallback-missing",projectId:e.routing.projectId,deploymentId:e.routing.assetManifestId,pathname:e.pathname,ts:Date.now()})),{response:Je(he),failureKind:he,pathname:e.pathname})}o(X,"maybeServeWfpAssetFallback");function ve(e,t,r){let n=new Headers(e.headers);r(n);let s=e.cf;return e.bodyUsed||e.body?.locked?(n.delete("content-length"),n.delete("transfer-encoding"),new Request(t,{method:e.method,headers:n,cf:s})):e.method==="GET"||e.method==="HEAD"?new Request(t,{method:e.method,headers:n,cf:s}):new Request(t,{method:e.method,headers:n,body:e.body,cf:s,duplex:"half"})}o(ve,"rebuildRequest");var hc={async fetch(e,t,r){t=await gr(t);let n=new URL(e.url);if(!t.PLATFORM_INSTALLATION_ID&&n.pathname==="/health"&&e.headers.get("X-Health-Check")==="void-admin")return Response.json({ok:!0});if(t.PLATFORM_HEALTH_PROBE_TOKEN&&n.pathname==="/health"&&e.headers.get("X-Void-Platform-Probe")===t.PLATFORM_HEALTH_PROBE_TOKEN)return Response.json({ok:!0,...t.PLATFORM_APPLICATION?{installationId:t.PLATFORM_INSTALLATION_ID}:{}});if(n.hostname.startsWith(`${At}.`)&&n.hostname===wr(ye(t))&&qo(e,n))return J(e,404,"Not Found",{"Cache-Control":"no-store"});if(t.PLATFORM_TRAFFIC_STATE==="staging"||t.PLATFORM_TRAFFIC_STATE==="sandbox-drain"||t.PLATFORM_INSTALLATION_ID&&await t.ROUTING.get(nr)===or)return zr(e);let s=Date.now(),i=Tn(t.DISPATCH_TIMEOUT_MS);if(n.pathname.startsWith("/__void/")||n.pathname==="/__scheduled"||n.pathname==="/__queue")return J(e,404,"Not Found");let c=await _n(n.hostname,t),u=c.slug;if(c.workersDev&&!c.projectId)return J(e,404,"Not Found");let p=u??`domain:${n.hostname}`,d=await t.ROUTING.get(p,{cacheTtl:60});if(!d)return J(e,404,"Not Found",{"Cache-Control":"public, max-age=30"});let a=JSON.parse(d);if(c.projectId&&c.projectId!==a.projectId)return J(e,404,"Not Found");if(a.zeroTrust&&!await Jr.verify(n.hostname,e.headers.get("Cf-Access-Jwt-Assertion"),a.zeroTrust))return J(e,403,"Cloudflare Access authentication required",{"Cache-Control":"no-store"});let f=o(g=>hn(e,{code:"usage_limit",resource:g,reason:g==="requests"?"monthly_quota":"cpu",message:g==="requests"?"This app has reached its usage allowance. Please contact the app owner or try again later.":"This request exceeded its execution limit. Please try again."},async()=>{let _=a.staticDeploymentId??a.assetManifestId;if(!_)return null;let x=g==="requests"?"/usage-limit.html":"/execution-limit.html",m=(await Be(t,_,a.projectId,2e3))?.[x];return m?ht(t,m,x,a.projectId,_,2e3):null}),"limitResponse");if(a.suspended==="requests_exceeded")return f("requests");if(a.suspended)return Response.json({error:"usage limit exceeded",reason:a.suspended},{status:429,headers:{"Cache-Control":"public, s-maxage=30, max-age=0"}});e.headers.has("X-Void-Original-URL")&&(e=ve(e,e.url,g=>g.delete("X-Void-Original-URL")));let l=n.pathname,A,h=e.headers.get("upgrade")?.toLowerCase()==="websocket"?"websocket":"static",y=o((g,_)=>{let x=V(g)?0:Number(g.headers.get("content-length")??0);Rn(t,{projectId:a.projectId,type:h,method:e.method,status:g.status,responseBytes:x,durationMs:Date.now()-s,slug:u??n.hostname,..._&&{failureKind:_}}),a.userId&&r.waitUntil(Sn(t,{projectId:a.projectId,userId:a.userId,slug:u??n.hostname,requests:1,responseBytes:x,...g.status>=500&&{status:g.status},..._&&{failureKind:_}}));let k=new Response(g.body,g);return k.headers.delete("X-Void-No-Match"),k.headers.delete(pe),k.headers.set("X-Hosted-By","void.cloud"),k},"meter"),b=o(g=>y(Je(g),g),"meterStaticAssetFailure"),U=o(()=>(En(t,{workerName:a.workerName,method:e.method,url:e.url,status:503,timeoutMs:i}),y(yt(503,"dispatch"))),"meterWorkerTimeout"),P,v;if(a.redirectRules?.length){let g=ne(l,a.redirectRules,n.hostname);if(g?.type==="redirect"){let _=He(g.destination,n.search);return y(new Response(null,{status:g.status,headers:{Location:_}}))}g?.type==="rewrite"&&(v=e.url,P=_e(e.url,l,a.queryAllowlist),l=g.destination,n.pathname=l)}let M=e;if(v&&(M=ve(e,n.toString(),g=>g.set("X-Void-Original-URL",v))),a.hashedAssetsPrefix&&ur(e)){let g="/"+a.hashedAssetsPrefix+"/";if(l.startsWith(g)){let _=new URL(n.toString());_.search="",_.searchParams.set("_p",a.projectId);let x=new Request(_.toString()),k=["cache-control","content-type","content-encoding","content-length","content-range","accept-ranges","transfer-encoding"],m=o((E,T)=>{let D=Y(E,l,a.headerRules);if(D!==E)for(let S of k){let C=E.headers.get(S);C===null?D.headers.delete(S):D.headers.set(S,C)}return y(D,T)},"finalizeAsset"),L=Q,N=await L.match(x);if(N?.headers.get("Cache-Control")?.includes("immutable")&&On(N)){if(!a.staticDeploymentId){let E=await X({env:t,routing:a,pathname:l,response:N,userAgent:e.headers.get("user-agent"),timeoutMs:i});if(E.response!==N){if(me(E.response)){let T=new Response(E.response.body,E.response);T.headers.set("Cache-Control","public, max-age=31536000, immutable"),z(T.headers);let D=T.clone();return r.waitUntil(L.delete(x).then(()=>L.put(x,D))),m(T,E.failureKind)}return r.waitUntil(L.delete(x)),m(E.response,E.failureKind)}}return m(N)}if(N&&await L.delete(x),a.staticDeploymentId){let E=Date.now(),T;try{T=await Be(t,a.staticDeploymentId,a.projectId,B(E,i))}catch(w){if(w instanceof H)return b(ie);if(w instanceof Z)return b(ce);throw w}if(!T)return b(he);let D=l,S=T[l];if(!S){let w=Ie(l);w!==l&&T[w]&&(D=w,S=T[w])}let C;if(S)try{let w=await ht(t,S,D,a.projectId,a.staticDeploymentId,B(E,i));if(!w)return xn(a,D,S),b(he);C=w}catch(w){if(w instanceof H)return b(ie);if(w instanceof Z)return b(ce);throw w}else C=J(e,404,"Not Found");if(me(C)){let w=new Response(C.body,C);return w.headers.set("Cache-Control","public, max-age=31536000, immutable"),z(w.headers),r.waitUntil(L.put(x,w.clone())),m(w)}return m(C)}try{let E=gt(t,a),T=Date.now(),D=await fe(E.fetch(M),B(T,i),"static-asset"),S=await X({env:t,routing:a,pathname:l,response:D,userAgent:e.headers.get("user-agent"),deadline:{startedAt:T,timeoutMs:i}});D=S.response;let C=S.failureKind;if(me(D)){let w=new Response(D.body,D);return w.headers.set("Cache-Control","public, max-age=31536000, immutable"),z(w.headers),r.waitUntil(L.put(x,w.clone())),m(w,C)}return m(D,C)}catch(E){if(E instanceof H)return b(ie);if(E instanceof Error&&E.message.includes("Worker exceeded"))return y(await f("execution"));throw E}}}if(a.ssr===!0&&(a.type!=="framework"||pt(e))&&ns(l,a.pages,a.revalidate,a.pathRevalidate)&&(a.revalidate||a.pages?.length)){let g=We(a.pages,a.revalidate,a.pathRevalidate,l);if(g>0&&e.method==="GET"&&!e.headers.has("Range")&&!Ve(e)){let _=e.headers.has("X-VoidPages"),x=a.version??"legacy",k=Q,m=Yo(e.url,l,n.hostname,a,P),L=qt(e.url,new URL(e.url).pathname,a.queryAllowlist),N=mn(e,l,x,m),E=rr(e,l,x,m);if(A={projectId:a.projectId,deploymentId:x,host:n.hostname,pathname:l,originalUrl:m,htmlKey:N,jsonKey:E},_){let T=await k.match(E);if(T&&je(T))return h="isr",y(se(T));T&&await k.delete(E)}else{let T=o(async()=>{await vn(t,A)},"purgePoisonedIsrEntry"),D=await k.match(N);if(D&&je(D)){h="isr";let O=await X({env:t,routing:a,pathname:l,response:D,userAgent:e.headers.get("user-agent"),timeoutMs:i,fallbackPathname:ar(l,a,n.hostname)});return O.response!==D?(r.waitUntil(T()),y(O.response.ok?se(O.response):O.response,O.failureKind)):y(se(D))}D&&await k.delete(N);let S=await dn(t,a.projectId,x,n.hostname,l,m);if(S){let O=Qt(S),j=Xt(S,O),le=await X({env:t,routing:a,pathname:l,response:j,userAgent:e.headers.get("user-agent"),timeoutMs:i,fallbackPathname:ar(l,a,n.hostname)});if(le.response!==j)return r.waitUntil(T()),h="isr",y(le.response.ok?se(le.response):le.response,le.failureKind);if(O){let ke=j.clone(),Ge=M;if(L){let Ye=new URL(M.url);Ye.search=m?new URL(m).search:"",Ge=ve(M,Ye.toString(),Hn=>{v&&m&&Hn.set("X-Void-Original-URL",m)})}r.waitUntil(rs(t,a,Ge,n.hostname,l,g,N,E,S.createdAt+S.ttl*1e3,m,i).then(async Ye=>{Ye||await k.put(N,ke)}))}return h="isr",O||r.waitUntil(k.put(N,j.clone())),y(se(j))}h="isr";let C=gt(t,a),w=Date.now(),I;try{I=await fe(C.fetch(M),B(w,i,"dispatch"),"dispatch")}catch(O){if(O instanceof H)return U();throw O}let ee=V(I),qe,wt=l,bt=!1;if(!ee){let O=await X({env:t,routing:a,pathname:l,response:I,userAgent:e.headers.get("user-agent"),deadline:{startedAt:w,timeoutMs:i}});I=O.response,qe=O.failureKind,ee=V(I)}if(!ee){let O;try{O=await lr({response:I,worker:C,dispatchReq:M,routing:a,pathname:l,url:n,originalRequestUrl:e.url,originalUrlHeader:v,originalUrlVariant:m,deadline:{startedAt:w,timeoutMs:i}})}catch(j){if(j instanceof H)return U();throw j}if(O.applied&&(bt=!0,wt=O.pathname,I=O.response,ee=V(I),!ee)){let j=await X({env:t,routing:a,pathname:O.pathname,response:I,userAgent:e.headers.get("user-agent"),deadline:{startedAt:w,timeoutMs:i}});I=j.response,qe=j.failureKind,ee=V(I)}}if(ee)return y(I);let xe=Te(I,g);if(!L&&xe>0&&I.status===200&&(a.type!=="framework"||ge(I))&&!G(wt)&&!oe(I)&&(!bt||dr(a.pages,wt,I,a.pathRevalidate))){r.waitUntil(mt(t,a.projectId,x,n.hostname,l,I,xe,m)),r.waitUntil(cr(k,E,I,xe,"HIT"));let O=new Headers(I.headers);O.set("Cache-Control",`public, s-maxage=${xe}, max-age=0, must-revalidate`),O.set("x-isr-cache","MISS"),z(O),O.delete("x-void-page-data"),O.delete("set-cookie");let j=new Headers(O);j.set("x-isr-cache","HIT");let le=new Response(I.clone().body,{status:I.status,headers:j});r.waitUntil(k.put(N,le.clone()));let ke=new Headers(O);ke.set("Cache-Control",Ln),ke.delete(pe);let Ge=new Response(I.body,{status:I.status,headers:ke});return y(Ge,qe)}return I.status===200&&!bt&&(xe===0||oe(I)||a.type==="framework"&&!ge(I))&&r.waitUntil(T()),y(I,qe)}}}let R=l,$=os(e,R,a)?await ss(t,R,a,i):void 0,Mn=$===!0,ze;if(Mn){let g=new URL(_e(e.url,new URL(e.url).pathname,Gt(a.queryAllowlist)));g.searchParams.set("_v",String(a.version));let _=new Request(g.toString());ze=_;let x=Q,k=await x.match(_);if(k&&On(k)){if(h="static",!a.staticDeploymentId){let m=await X({env:t,routing:a,pathname:l,response:k,userAgent:e.headers.get("user-agent"),timeoutMs:i,fallbackPathname:ar(l,a,n.hostname)});if(m.response!==k){if(me(m.response)){let L=Y(m.response,m.pathname,a.headerRules),N=new Response(L.clone().body,L);N.headers.set("Cache-Control","public, s-maxage=31536000, max-age=0, must-revalidate"),z(N.headers);let E=N.clone();return r.waitUntil(x.delete(_).then(()=>x.put(_,E))),y(se(L))}return r.waitUntil(x.delete(_)),y(m.response,m.failureKind)}}return y(se(k))}k&&await x.delete(_)}if(a.staticDeploymentId){let g=Date.now(),_;try{_=await Be(t,a.staticDeploymentId,a.projectId,B(g,i))}catch(S){if(S instanceof H)return b(ie);if(S instanceof Z)return b(ce);throw S}if(!_)return b(he);let x=a.assetConfig??{},k=l,m=ue(l,_,x);if(!m&&a.fallbackRules?.length){let S=ne(l,a.fallbackRules,n.hostname);S?.type==="rewrite"&&(l=S.destination,n.pathname=l,m=ue(l,_,x))}if(!m)return y(J(e,404,"Not Found"));if(m.redirect)return y(new Response(null,{status:308,headers:{Location:m.redirect}}));let L;try{L=await ht(t,m.hash,m.path,a.projectId,a.staticDeploymentId,B(g,i))}catch(S){if(S instanceof H)return y(yt(m.notFound?404:503,"static-asset"),m.notFound?void 0:ie);if(S instanceof Z)return y(m.notFound?J(e,404,"Not Found"):Je(ce),m.notFound?void 0:ce);throw S}if(!L)return m.notFound?y(J(e,404,"Not Found")):(xn(a,m.path,m.hash),b(he));let N=m.notFound?404:200,E=new Response(L.body,{status:N,headers:L.headers}),T=Y(E,l,a.headerRules),D=ze??(ur(e)?new Request(`${n.origin}${k}?_v=${a.staticDeploymentId}`):void 0);if(D&&me(T)){let S=new Response(T.clone().body,T);S.headers.set("Cache-Control","public, s-maxage=31536000, max-age=0, must-revalidate"),z(S.headers),r.waitUntil(Q.put(D,S.clone()))}return y(se(T))}let pr=gt(t,a);try{let g=M;g.bodyUsed&&(g=ve(g,g.url,()=>{}));let x=g.method!=="GET"&&g.method!=="HEAD"&&a.fallbackRules?.length?g.clone():g,k=Date.now(),m=await fe(pr.fetch(g),B(k,i,"dispatch"),"dispatch"),L=V(m),N;if(!L){let C=await X({env:t,routing:a,pathname:l,response:m,userAgent:e.headers.get("user-agent"),deadline:{startedAt:k,timeoutMs:i}});m=C.response,N=C.failureKind,L=V(m)}let E=!1;if(!L){let C=await lr({response:m,worker:pr,dispatchReq:x,routing:a,pathname:l,url:n,originalRequestUrl:e.url,originalUrlHeader:v,originalUrlVariant:P,deadline:{startedAt:k,timeoutMs:i}});if(C.applied&&(E=!0,l=C.pathname,n.pathname=l,P=C.originalUrlVariant,m=C.response,L=V(m),!L)){let w=await X({env:t,routing:a,pathname:l,response:m,userAgent:e.headers.get("user-agent"),deadline:{startedAt:k,timeoutMs:i}});m=w.response,N=w.failureKind,L=V(m)}}if(A&&m.status===200&&!E&&(Te(m,We(a.pages,a.revalidate,a.pathRevalidate,A.pathname))===0||oe(m)||a.type==="framework"&&!ge(m))&&r.waitUntil(vn(t,A)),ze&&!E&&me(m)){let C=new Response(m.body,m);C.headers.delete("x-void-page-data");let w=Y(C,l,a.headerRules),I=new Response(w.clone().body,w);return I.headers.set("Cache-Control","public, s-maxage=31536000, max-age=0, must-revalidate"),z(I.headers),r.waitUntil(Q.put(ze,I.clone())),y(se(w),N)}let T=l===R?$:void 0,D=!N&&Dn(a,T)&&(T===!1||m.status>=500),S=Ht(l,a.ssr,D);if(S&&(h=S),(a.revalidate||a.pages?.length)&&!L&&!e.headers.has("X-VoidPages")&&e.method==="GET"&&!e.headers.has("Range")&&(a.type!=="framework"||pt(e))&&!Ve(e)){let C=We(a.pages,a.revalidate,a.pathRevalidate,l),w=C>0?Te(m,C):0;if(w>0&&m.status===200&&a.ssr&&!G(l)&&!Me(l)&&(a.type!=="framework"||ge(m))&&!oe(m)&&(!E||dr(a.pages,l,m,a.pathRevalidate))){let I=a.version??"legacy";r.waitUntil(mt(t,a.projectId,I,n.hostname,l,m,w,P));let ee=rr(e,l,I,P);r.waitUntil(cr(Q,ee,m,w,"HIT"))}}if(m.headers.has("x-void-page-data")){let C=new Response(m.body,m);return C.headers.delete("x-void-page-data"),y(Y(C,l,a.headerRules),N)}return y(Y(m,l,a.headerRules),N)}catch(g){if(g instanceof H){if(g.label==="static-asset")return b(ie);let _=Ht(l,a.ssr,Dn(a,l===R?$:void 0));return _&&(h=_),U()}if(g instanceof Z)return b(ce);if(g instanceof Error&&g.message.includes("Worker exceeded"))return y(await f("execution"));throw g}},async queue(e,t){if(t.PLATFORM_TRAFFIC_STATE==="staging"||t.PLATFORM_TRAFFIC_STATE==="sandbox-drain"){console.warn(`[queue-relay] platform traffic is staging; retrying queue="${e.queue}" in ${Ce}s`),e.retryAll({delaySeconds:Ce});return}if(t.PLATFORM_INSTALLATION_ID){let d;try{d=await t.ROUTING.get(nr)}catch(a){let f=a instanceof Error?a.message:String(a);console.error(`[queue-relay] platform traffic gate read failed; retrying queue="${e.queue}" in ${Ce}s error=${JSON.stringify(f)}`),e.retryAll({delaySeconds:Ce});return}if(d===or){console.warn(`[queue-relay] platform traffic is disabled; retrying queue="${e.queue}" in ${Ce}s`),e.retryAll({delaySeconds:Ce});return}}let r=await t.ROUTING.get(`queue:${e.queue}`,{cacheTtl:60});if(!r){console.error(`[queue-relay] missing routing entry for queue="${e.queue}"; retrying all messages`),e.retryAll();return}let{workerName:n,projectId:s,queueName:i,proxyToken:c}=JSON.parse(r);if(s&&await Jo(t,s)){console.warn(`[queue-relay] project suspended; retrying queue="${e.queue}" in ${Cn}s`),e.retryAll({delaySeconds:Cn});return}let u=Array.from(e.messages,d=>({id:d.id,timestamp:d.timestamp.toISOString(),body:d.body,attempts:d.attempts})),p=t.DISPATCH.get(n);try{let d=JSON.stringify({queue:i,messages:u}),a={"Content-Type":"application/json"};c&&(a["x-void-internal"]=c);let f=await p.fetch(new Request("https://internal/__void/queue",{method:"POST",headers:a,body:d}));if(f.status===404&&(f=await p.fetch(new Request("https://internal/__queue",{method:"POST",headers:a,body:d}))),!f.ok){let h="";try{h=(await f.clone().text()).slice(0,200)}catch{}console.error(`[queue-relay] relay failed queue="${i}" worker="${n}" status=${f.status} body=${JSON.stringify(h)}`),f.status===401||f.status===403?e.retryAll({delaySeconds:Bo}):e.retryAll();return}let l;try{l=await f.json()}catch{e.ackAll();return}if(!l.decisions){l.ok!==!1?e.ackAll():e.retryAll();return}let A=new Map(e.messages.map(h=>[h.id,h]));for(let[h,y]of Object.entries(l.decisions)){let b=A.get(h);b&&(y.action==="ack"?b.ack():y.action==="retry"&&b.retry(y.delaySeconds!=null?{delaySeconds:y.delaySeconds}:void 0))}l.ok===!1&&e.retryAll()}catch(d){let a=d instanceof Error?d.message:String(d);console.error(`[queue-relay] relay threw queue="${i}" worker="${n}" error=${JSON.stringify(a)}`),e.retryAll()}}},Z=class extends Error{static{o(this,"StaticAssetReadError")}constructor(t){super("Static asset storage read failed",{cause:t}),this.name="StaticAssetReadError"}};function xn(e,t,r){console.error(JSON.stringify({event:"static-asset-missing",store:r.startsWith("!")?"r2":"kv",projectId:e.projectId,deploymentId:e.staticDeploymentId??e.assetManifestId,pathname:t,ts:Date.now()}))}o(xn,"logStaticAssetMissing");async function ht(e,t,r,n,s,i=1e4){let c=Un(i),u=Date.now(),p=!1;try{let d=await ir(()=>ts(e,t,r,n),{delayMs:c,timeoutMs:i,label:"static-asset",discard:o(async a=>{await a.body?.cancel()},"discard"),onHedge:o(()=>{p=!0,console.warn(JSON.stringify({event:"static-asset-read-hedge",store:t.startsWith("!")?"r2":"kv",projectId:n,deploymentId:s,pathname:r,delayMs:c,ts:Date.now()}))},"onHedge")});return p&&console.warn(JSON.stringify({event:"static-asset-read-hedge-result",store:t.startsWith("!")?"r2":"kv",projectId:n,deploymentId:s,pathname:r,outcome:d===null?"miss":"hit",elapsedMs:Date.now()-u,ts:Date.now()})),d}catch(d){throw console.error(JSON.stringify({event:d instanceof H?"static-asset-timeout":"static-asset-read-error",store:t.startsWith("!")?"r2":"kv",projectId:n,deploymentId:s,pathname:r,hedged:p,elapsedMs:Date.now()-u,error:d instanceof H?void 0:d instanceof Error?d.message:String(d),ts:Date.now()})),d instanceof H?d:new Z(d)}}o(ht,"fetchStaticAsset");async function ts(e,t,r,n){let s=t.startsWith("!"),i=s?t.slice(1):t,c=n?`assets/${n}/${i}`:null,u=`assets/${i}`;if(s){let d=c?await e.STATIC_ASSETS_R2.get(c)??await e.STATIC_ASSETS_R2.get(u):await e.STATIC_ASSETS_R2.get(u);if(!d)return null;let a=$e(d.httpMetadata?.contentType,r),f={ETag:d.httpEtag,...d.size?{"Content-Length":String(d.size)}:{}};return a&&(f["Content-Type"]=a),new Response(d.body,{headers:f})}let p=o(async d=>{let{value:a,metadata:f}=await e.STATIC_ASSETS.getWithMetadata(d,{type:"arrayBuffer",cacheTtl:86400});if(!a)return null;let l=$e(f?.ct,r),A={"Content-Length":String(a.byteLength)};return l&&(A["Content-Type"]=l),new Response(a,{headers:A})},"readKvAsset");return(c?await p(c):null)??p(u)}o(ts,"fetchStaticAssetOnce");function gt(e,t){return t.limits?e.DISPATCH.get(t.workerName,{},{limits:t.limits}):e.DISPATCH.get(t.workerName)}o(gt,"getWorker");async function rs(e,t,r,n,s,i,c,u,p,d,a=1e4){try{let f=gt(e,t),l=Date.now(),A=ve(r,r.url,R=>R.delete("X-VoidPages")),h=await fe(f.fetch(A),B(l,a,"dispatch"),"dispatch");if(V(h))return!1;let y=h.status,b=await lr({response:h,worker:f,dispatchReq:A,routing:t,pathname:s,url:new URL(A.url),originalRequestUrl:r.url,originalUrlHeader:r.headers.get("X-Void-Original-URL")??void 0,originalUrlVariant:d??void 0,deadline:{startedAt:l,timeoutMs:a}});if(h=b.response,V(h)||(h=(await X({env:e,routing:t,pathname:b.pathname,response:h,userAgent:r.headers.get("user-agent"),deadline:{startedAt:l,timeoutMs:a}})).response,V(h)))return!1;let P=Te(h,i),v=Q,M=o(async()=>{await tr(e,t.projectId,t.version??"legacy",n,s,d),await v.delete(c),await v.delete(u)},"evictSharedEntry"),W=b.applied?b.pathname:s;if(P>0&&h.status===200&&(t.type!=="framework"||ge(h))&&!G(W)&&!oe(h)&&(!b.applied||dr(t.pages,W,h,t.pathRevalidate))){await mt(e,t.projectId,t.version??"legacy",n,s,h,P,d);let R=new Headers(h.headers);return R.set("x-isr-cache","HIT"),R.set("Cache-Control",`public, s-maxage=${P}, max-age=0, must-revalidate`),z(R),R.delete("set-cookie"),R.delete("x-void-page-data"),await v.put(c,new Response(h.clone().body,{status:h.status,headers:R})),await cr(v,u,h,P,"HIT"),!0}else if(h.status===200&&!G(W)&&!b.applied&&(P===0||oe(h)||t.type==="framework"&&!ge(h))){try{await M()}catch(R){console.error("ISR privacy eviction failed:",R)}return!0}else if((y===404||y===410)&&Date.now()-p>zo*1e3){try{await M()}catch(R){console.error("ISR stale-entry eviction failed:",R)}return!0}return!1}catch(f){return console.error("ISR revalidation failed:",f),!1}}o(rs,"revalidateInBackground");function ns(e,t,r,n){return G(e)?!1:Me(e)?fn(t,r,n,e):!0}o(ns,"isIsrEligiblePath");function dr(e,t,r,n){return ge(r)&&pn(e,t,n)}o(dr,"isFallbackTargetCacheable");function ur(e){return e.method==="GET"&&!e.headers.has("Range")&&!e.headers.has("X-VoidPages")&&!Ve(e)}o(ur,"isSharedStaticCacheRequestEligible");function os(e,t,r){return!!(ur(e)&&r.version&&!G(t)&&(Me(t)||!r.ssr))}o(os,"isStaticCacheRequestEligible");async function ss(e,t,r,n){if(r.staticDeploymentId||!r.ssr)return!0;if(r.assetManifestId)try{let s=await Be(e,r.assetManifestId,r.projectId,Math.min(n,Nn));if(!s)return;if(Object.hasOwn(s,t))return!0;let i=Ie(t);return i!==t&&Object.hasOwn(s,i)?!0:(r.assetConfig?.html_handling??"auto-trailing-slash")!=="none"&&(kn(s,t)||kn(s,i))?void 0:!1}catch{return}}o(ss,"isKnownStaticAssetPath");function kn(e,t){let r=[`${t}.html`,`${t}/index.html`];if(t.endsWith(".html")){let n=t.slice(0,-5);r.push(`${n}/index.html`),n.endsWith("/index")&&r.push(`${n.slice(0,-6)}.html`)}return r.some(n=>Object.hasOwn(e,n))}o(kn,"hasHtmlHandlingSource");function Dn(e,t){if(!e.assetManifestId)return!0;let r=e.assetConfig?.run_worker_first;return r===!0||Array.isArray(r)&&r.includes("/**")?!0:t===!1&&(e.assetConfig?.not_found_handling??"none")==="none"}o(Dn,"workerAnsweredPath");function me(e){return e.status===200&&!V(e)&&!oe(e)}o(me,"isStaticCacheResponseEligible");function On(e){return je(e)&&me(e)}o(On,"isCurrentStaticCacheResponse");export{hc as default,V as isEventStreamResponse,ge as isHtmlResponse,ve as rebuildRequest};
|
|
@@ -57,6 +57,14 @@
|
|
|
57
57
|
{
|
|
58
58
|
"platformVersion": "0.24.0",
|
|
59
59
|
"schemaDigest": "3e3458ba1268853dc8e9a887270863557c2a4c5a5210f8615d247bf1f4bf6bcc"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"platformVersion": "0.25.0",
|
|
63
|
+
"schemaDigest": "7581930465664b7c578518bea54f36a83d20fcc47d9528183419033930d7ff4a"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"platformVersion": "0.26.0",
|
|
67
|
+
"schemaDigest": "7581930465664b7c578518bea54f36a83d20fcc47d9528183419033930d7ff4a"
|
|
60
68
|
}
|
|
61
69
|
]
|
|
62
70
|
}
|
|
@@ -358,6 +358,13 @@
|
|
|
358
358
|
"when": 1790912739624,
|
|
359
359
|
"tag": "0057_github_authority_constraints",
|
|
360
360
|
"breakpoints": true
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"idx": 58,
|
|
364
|
+
"version": "7",
|
|
365
|
+
"when": 1791311435335,
|
|
366
|
+
"tag": "0058_project_proxy_token_gen",
|
|
367
|
+
"breakpoints": true
|
|
361
368
|
}
|
|
362
369
|
]
|
|
363
370
|
}
|