@zuplo/runtime 6.64.38 → 6.64.39
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/out/esm/index.js +1 -1
- package/out/esm/index.js.map +1 -1
- package/package.json +1 -1
package/out/esm/index.js
CHANGED
|
@@ -52,7 +52,7 @@ import{a as Gt,d as Se,e as oR,f as Aa,g as Na,h as iR,i as sR}from"./chunk-6ZER
|
|
|
52
52
|
|
|
53
53
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);n.cycles==="ref"&&a(d);continue}if(p.count>1&&n.reused==="ref"){a(d);continue}}let c=s((d,p)=>{let m=this.seen.get(d),f=m.def??m.schema,g={...f};if(m.ref===null)return;let b=m.ref;if(m.ref=null,b){c(b,p);let h=this.seen.get(b).schema;h.$ref&&p.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(h)):(Object.assign(f,h),Object.assign(f,g))}m.isParent||this.override({zodSchema:d,jsonSchema:f})},"flattenRef");for(let d of[...this.seen.entries()].reverse())c(d[0],{target:this.target});let u={...o.def},l=n.external?.defs??{};for(let d of this.seen.entries()){let p=d[1];p.def&&p.defId&&(l[p.defId]=p.def)}!n.external&&Object.keys(l).length>0&&(this.target==="draft-2020-12"?u.$defs=l:u.definitions=l),this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}};s(fp,"toJSONSchema")});var Qb={};var Xb=te(()=>{});var Ft={};Lt(Ft,{$ZodAny:()=>yl,$ZodArray:()=>xl,$ZodAsyncError:()=>Et,$ZodBase64:()=>cl,$ZodBase64URL:()=>ul,$ZodBigInt:()=>ds,$ZodBigIntFormat:()=>ml,$ZodBoolean:()=>fo,$ZodCIDRv4:()=>il,$ZodCIDRv6:()=>sl,$ZodCUID:()=>Ju,$ZodCUID2:()=>Wu,$ZodCatch:()=>Ul,$ZodCheck:()=>Ne,$ZodCheckBigIntFormat:()=>Ru,$ZodCheckEndsWith:()=>Nu,$ZodCheckGreaterThan:()=>ss,$ZodCheckIncludes:()=>$u,$ZodCheckLengthEquals:()=>Eu,$ZodCheckLessThan:()=>is,$ZodCheckLowerCase:()=>Cu,$ZodCheckMaxLength:()=>ku,$ZodCheckMaxSize:()=>Pu,$ZodCheckMimeType:()=>Mu,$ZodCheckMinLength:()=>Tu,$ZodCheckMinSize:()=>Iu,$ZodCheckMultipleOf:()=>vu,$ZodCheckNumberFormat:()=>xu,$ZodCheckOverwrite:()=>Du,$ZodCheckProperty:()=>Lu,$ZodCheckRegex:()=>_u,$ZodCheckSizeEquals:()=>Su,$ZodCheckStartsWith:()=>Au,$ZodCheckStringFormat:()=>Kr,$ZodCheckUpperCase:()=>Ou,$ZodCustom:()=>Hl,$ZodDate:()=>vl,$ZodDefault:()=>Nl,$ZodDiscriminatedUnion:()=>Pl,$ZodE164:()=>ll,$ZodEmail:()=>Hu,$ZodEmoji:()=>Gu,$ZodEnum:()=>El,$ZodError:()=>ao,$ZodFile:()=>Cl,$ZodFunction:()=>Ls,$ZodGUID:()=>qu,$ZodIPv4:()=>nl,$ZodIPv6:()=>ol,$ZodISODate:()=>el,$ZodISODateTime:()=>Yu,$ZodISODuration:()=>rl,$ZodISOTime:()=>tl,$ZodIntersection:()=>Il,$ZodJWT:()=>dl,$ZodKSUID:()=>Xu,$ZodLazy:()=>Fl,$ZodLiteral:()=>_l,$ZodMap:()=>kl,$ZodNaN:()=>jl,$ZodNanoID:()=>Vu,$ZodNever:()=>bl,$ZodNonOptional:()=>Ml,$ZodNull:()=>hl,$ZodNullable:()=>Al,$ZodNumber:()=>ls,$ZodNumberFormat:()=>pl,$ZodObject:()=>Rl,$ZodOptional:()=>$l,$ZodPipe:()=>ho,$ZodPrefault:()=>Ll,$ZodPromise:()=>ql,$ZodReadonly:()=>zl,$ZodRealError:()=>Wr,$ZodRecord:()=>Sl,$ZodRegistry:()=>Qr,$ZodSet:()=>Tl,$ZodString:()=>mo,$ZodStringFormat:()=>_e,$ZodSuccess:()=>Dl,$ZodSymbol:()=>fl,$ZodTemplateLiteral:()=>Zl,$ZodTransform:()=>Ol,$ZodTuple:()=>Pr,$ZodType:()=>ue,$ZodULID:()=>Ku,$ZodURL:()=>Bu,$ZodUUID:()=>Fu,$ZodUndefined:()=>gl,$ZodUnion:()=>ps,$ZodUnknown:()=>go,$ZodVoid:()=>wl,$ZodXID:()=>Qu,$brand:()=>Bi,$constructor:()=>_,$input:()=>kd,$output:()=>Sd,Doc:()=>po,JSONSchema:()=>Qb,JSONSchemaGenerator:()=>No,_any:()=>Kd,_array:()=>cp,_base64:()=>Os,_base64url:()=>$s,_bigint:()=>Fd,_boolean:()=>Zd,_catch:()=>sT,_cidrv4:()=>_s,_cidrv6:()=>Cs,_coercedBigint:()=>Hd,_coercedBoolean:()=>qd,_coercedDate:()=>tp,_coercedNumber:()=>Ld,_coercedString:()=>_d,_cuid:()=>Rs,_cuid2:()=>Ps,_custom:()=>Ao,_date:()=>ep,_default:()=>nT,_discriminatedUnion:()=>Gk,_e164:()=>As,_email:()=>fs,_emoji:()=>vs,_endsWith:()=>To,_enum:()=>Qk,_file:()=>lp,_float32:()=>Dd,_float64:()=>Ud,_gt:()=>Zt,_gte:()=>Xe,_guid:()=>vo,_includes:()=>So,_int:()=>Md,_int32:()=>jd,_int64:()=>Bd,_intersection:()=>Vk,_ipv4:()=>Ts,_ipv6:()=>Es,_isoDate:()=>Od,_isoDateTime:()=>Cd,_isoDuration:()=>Ad,_isoTime:()=>$d,_jwt:()=>Ns,_ksuid:()=>ks,_lazy:()=>lT,_length:()=>en,_literal:()=>Yk,_lowercase:()=>Po,_lt:()=>zt,_lte:()=>mt,_map:()=>Wk,_max:()=>mt,_maxLength:()=>Yr,_maxSize:()=>Xr,_mime:()=>Eo,_min:()=>Xe,_minLength:()=>er,_minSize:()=>Sr,_multipleOf:()=>Ir,_nan:()=>rp,_nanoid:()=>xs,_nativeEnum:()=>Xk,_negative:()=>op,_never:()=>Xd,_nonnegative:()=>sp,_nonoptional:()=>oT,_nonpositive:()=>ip,_normalize:()=>_o,_null:()=>Wd,_nullable:()=>rT,_number:()=>Nd,_optional:()=>tT,_overwrite:()=>qt,_parse:()=>Ji,_parseAsync:()=>Ki,_pipe:()=>aT,_positive:()=>np,_promise:()=>dT,_property:()=>ap,_readonly:()=>cT,_record:()=>Jk,_refine:()=>pT,_regex:()=>Ro,_safeParse:()=>Xi,_safeParseAsync:()=>Yi,_set:()=>Kk,_size:()=>xo,_startsWith:()=>ko,_string:()=>Ed,_stringbool:()=>dp,_success:()=>iT,_symbol:()=>Vd,_templateLiteral:()=>uT,_toLowerCase:()=>Oo,_toUpperCase:()=>$o,_transform:()=>eT,_trim:()=>Co,_tuple:()=>up,_uint32:()=>zd,_uint64:()=>Gd,_ulid:()=>Is,_undefined:()=>Jd,_union:()=>Bk,_unknown:()=>Qd,_uppercase:()=>Io,_url:()=>ws,_uuid:()=>gs,_uuidv4:()=>hs,_uuidv6:()=>ys,_uuidv7:()=>bs,_void:()=>Yd,_xid:()=>Ss,clone:()=>st,config:()=>Ze,flattenError:()=>co,formatError:()=>uo,function:()=>mp,globalConfig:()=>Yn,globalRegistry:()=>Ct,isValidBase64:()=>al,isValidBase64URL:()=>_y,isValidJWT:()=>Cy,locales:()=>wo,parse:()=>Wi,parseAsync:()=>Qi,prettifyError:()=>Hc,regexes:()=>Rr,registry:()=>ms,safeParse:()=>Gc,safeParseAsync:()=>Vc,toDotPath:()=>dy,toJSONSchema:()=>fp,treeifyError:()=>Fc,util:()=>ee,version:()=>ju});var Ye=te(()=>{Jr();es();Bc();yo();as();zu();me();os();Jb();Td();Uu();Wb();pp();Kb();Xb()});var gp=te(()=>{Ye()});var Ms={};Lt(Ms,{ZodISODate:()=>ew,ZodISODateTime:()=>Yb,ZodISODuration:()=>rw,ZodISOTime:()=>tw,date:()=>yp,datetime:()=>hp,duration:()=>wp,time:()=>bp});function hp(t){return Cd(Yb,t)}function yp(t){return Od(ew,t)}function bp(t){return $d(tw,t)}function wp(t){return Ad(rw,t)}var Yb,ew,tw,rw,vp=te(()=>{Ye();Ds();Yb=_("ZodISODateTime",(t,e)=>{Yu.init(t,e),Ce.init(t,e)});s(hp,"datetime");ew=_("ZodISODate",(t,e)=>{el.init(t,e),Ce.init(t,e)});s(yp,"date");tw=_("ZodISOTime",(t,e)=>{tl.init(t,e),Ce.init(t,e)});s(bp,"time");rw=_("ZodISODuration",(t,e)=>{rl.init(t,e),Ce.init(t,e)});s(wp,"duration")});var ow,gT,tn,xp=te(()=>{Ye();Ye();ow=s((t,e)=>{ao.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:s(r=>uo(t,r),"value")},flatten:{value:s(r=>co(t,r),"value")},addIssue:{value:s(r=>t.issues.push(r),"value")},addIssues:{value:s(r=>t.issues.push(...r),"value")},isEmpty:{get(){return t.issues.length===0}}})},"initializer"),gT=_("ZodError",ow),tn=_("ZodError",ow,{Parent:Error})});var Rp,Pp,Ip,Sp,kp=te(()=>{Ye();xp();Rp=Ji(tn),Pp=Ki(tn),Ip=Xi(tn),Sp=Yi(tn)});var Tp={};Lt(Tp,{bigint:()=>vT,boolean:()=>wT,date:()=>xT,number:()=>bT,string:()=>yT});function yT(t){return _d(Us,t)}function bT(t){return Ld(Lo,t)}function wT(t){return qd(Mo,t)}function vT(t){return Hd(Do,t)}function xT(t){return tp(js,t)}var iw=te(()=>{Ye();Ds();s(yT,"string");s(bT,"number");s(wT,"boolean");s(vT,"bigint");s(xT,"date")});function Ep(t){return Ed(Us,t)}function RT(t){return fs(Op,t)}function PT(t){return vo(zs,t)}function IT(t){return gs(Ht,t)}function ST(t){return hs(Ht,t)}function kT(t){return ys(Ht,t)}function TT(t){return bs(Ht,t)}function ET(t){return ws($p,t)}function _T(t){return vs(Ap,t)}function CT(t){return xs(Np,t)}function OT(t){return Rs(Lp,t)}function $T(t){return Ps(Mp,t)}function AT(t){return Is(Dp,t)}function NT(t){return Ss(Up,t)}function LT(t){return ks(jp,t)}function MT(t){return Ts(zp,t)}function DT(t){return Es(Zp,t)}function UT(t){return _s(qp,t)}function jT(t){return Cs(Fp,t)}function zT(t){return Os(Hp,t)}function ZT(t){return $s(Bp,t)}function qT(t){return As(Gp,t)}function FT(t){return Ns(Vp,t)}function sw(t){return Nd(Lo,t)}function _p(t){return Md(rn,t)}function HT(t){return Dd(rn,t)}function BT(t){return Ud(rn,t)}function GT(t){return jd(rn,t)}function VT(t){return zd(rn,t)}function aw(t){return Zd(Mo,t)}function JT(t){return Fd(Do,t)}function WT(t){return Bd(Jp,t)}function KT(t){return Gd(Jp,t)}function QT(t){return Vd(cw,t)}function XT(t){return Jd(uw,t)}function dw(t){return Wd(lw,t)}function YT(){return Kd(pw)}function Zs(){return Qd(Wp)}function Bs(t){return Xd(mw,t)}function eE(t){return Yd(fw,t)}function tE(t){return ep(js,t)}function Kp(t,e){return cp(gw,t,e)}function rE(t){let e=t._zod.def.shape;return Sw(Object.keys(e))}function nE(t,e){let r={type:"object",get shape(){return ee.assignProp(this,"shape",{...t}),this.shape},...ee.normalizeParams(e)};return new Gs(r)}function oE(t,e){return new Gs({type:"object",get shape(){return ee.assignProp(this,"shape",{...t}),this.shape},catchall:Bs(),...ee.normalizeParams(e)})}function iE(t,e){return new Gs({type:"object",get shape(){return ee.assignProp(this,"shape",{...t}),this.shape},catchall:Zs(),...ee.normalizeParams(e)})}function Vs(t,e){return new Qp({type:"union",options:t,...ee.normalizeParams(e)})}function sE(t,e,r){return new hw({type:"union",options:e,discriminator:t,...ee.normalizeParams(r)})}function bw(t,e){return new yw({type:"intersection",left:t,right:e})}function aE(t,e,r){let n=e instanceof ue,o=n?r:e,i=n?e:null;return new ww({type:"tuple",items:t,rest:i,...ee.normalizeParams(o)})}function vw(t,e,r){return new Xp({type:"record",keyType:t,valueType:e,...ee.normalizeParams(r)})}function cE(t,e,r){return new Xp({type:"record",keyType:Vs([t,Bs()]),valueType:e,...ee.normalizeParams(r)})}function uE(t,e,r){return new xw({type:"map",keyType:t,valueType:e,...ee.normalizeParams(r)})}function lE(t,e){return new Rw({type:"set",valueType:t,...ee.normalizeParams(e)})}function Pw(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Uo({type:"enum",entries:r,...ee.normalizeParams(e)})}function dE(t,e){return new Uo({type:"enum",entries:t,...ee.normalizeParams(e)})}function Sw(t,e){return new Iw({type:"literal",values:Array.isArray(t)?t:[t],...ee.normalizeParams(e)})}function pE(t){return lp(kw,t)}function Yp(t){return new Tw({type:"transform",transform:t})}function qs(t){return new em({type:"optional",innerType:t})}function Fs(t){return new Ew({type:"nullable",innerType:t})}function mE(t){return qs(Fs(t))}function Cw(t,e){return new _w({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function $w(t,e){return new Ow({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function Aw(t,e){return new tm({type:"nonoptional",innerType:t,...ee.normalizeParams(e)})}function fE(t){return new Nw({type:"success",innerType:t})}function Mw(t,e){return new Lw({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function gE(t){return rp(Dw,t)}function Hs(t,e){return new rm({type:"pipe",in:t,out:e})}function jw(t){return new Uw({type:"readonly",innerType:t})}function hE(t,e){return new zw({type:"template_literal",parts:t,...ee.normalizeParams(e)})}function qw(t){return new Zw({type:"lazy",getter:t})}function yE(t){return new Fw({type:"promise",innerType:t})}function Hw(t,e){let r=new Ne({check:"custom",...ee.normalizeParams(e)});return r._zod.check=t,r}function bE(t,e){return Ao(Js,t??(()=>!0),e)}function Bw(t,e={}){return Ao(Js,t,e)}function Gw(t,e){let r=Hw(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ee.issue(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ee.issue(i))}},t(n.value,n)),e);return r}function wE(t,e={error:`Input not instance of ${t.name}`}){let r=new Js({type:"custom",check:"custom",fn:s(n=>n instanceof t,"fn"),abort:!0,...ee.normalizeParams(e)});return r._zod.bag.Class=t,r}function xE(t){let e=qw(()=>Vs([Ep(t),sw(),aw(),dw(),Kp(e),vw(Ep(),e)]));return e}function RE(t,e){return Hs(Yp(t),e)}var ge,Cp,Us,Ce,Op,zs,Ht,$p,Ap,Np,Lp,Mp,Dp,Up,jp,zp,Zp,qp,Fp,Hp,Bp,Gp,Vp,Lo,rn,Mo,Do,Jp,cw,uw,lw,pw,Wp,mw,fw,js,gw,Gs,Qp,hw,yw,ww,Xp,xw,Rw,Uo,Iw,kw,Tw,em,Ew,_w,Ow,tm,Nw,Lw,Dw,rm,Uw,zw,Zw,Fw,Js,vE,Ds=te(()=>{Ye();Ye();gp();vp();kp();vp();iw();ge=_("ZodType",(t,e)=>(ue.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>st(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>Rp(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Ip(t,r,n),t.parseAsync=async(r,n)=>Pp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Sp(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Bw(r,n)),t.superRefine=r=>t.check(Gw(r)),t.overwrite=r=>t.check(qt(r)),t.optional=()=>qs(t),t.nullable=()=>Fs(t),t.nullish=()=>qs(Fs(t)),t.nonoptional=r=>Aw(t,r),t.array=()=>Kp(t),t.or=r=>Vs([t,r]),t.and=r=>bw(t,r),t.transform=r=>Hs(t,Yp(r)),t.default=r=>Cw(t,r),t.prefault=r=>$w(t,r),t.catch=r=>Mw(t,r),t.pipe=r=>Hs(t,r),t.readonly=()=>jw(t),t.describe=r=>{let n=t.clone();return Ct.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ct.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ct.get(t);let n=t.clone();return Ct.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Cp=_("_ZodString",(t,e)=>{mo.init(t,e),ge.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Ro(...n)),t.includes=(...n)=>t.check(So(...n)),t.startsWith=n=>t.check(ko(n)),t.endsWith=n=>t.check(To(n)),t.min=(...n)=>t.check(er(...n)),t.max=(...n)=>t.check(Yr(...n)),t.length=(...n)=>t.check(en(...n)),t.nonempty=(...n)=>t.check(er(1,...n)),t.lowercase=n=>t.check(Po(n)),t.uppercase=n=>t.check(Io(n)),t.trim=()=>t.check(Co()),t.normalize=(...n)=>t.check(_o(...n)),t.toLowerCase=()=>t.check(Oo()),t.toUpperCase=()=>t.check($o())}),Us=_("ZodString",(t,e)=>{mo.init(t,e),Cp.init(t,e),t.email=r=>t.check(fs(Op,r)),t.url=r=>t.check(ws($p,r)),t.jwt=r=>t.check(Ns(Vp,r)),t.emoji=r=>t.check(vs(Ap,r)),t.guid=r=>t.check(vo(zs,r)),t.uuid=r=>t.check(gs(Ht,r)),t.uuidv4=r=>t.check(hs(Ht,r)),t.uuidv6=r=>t.check(ys(Ht,r)),t.uuidv7=r=>t.check(bs(Ht,r)),t.nanoid=r=>t.check(xs(Np,r)),t.guid=r=>t.check(vo(zs,r)),t.cuid=r=>t.check(Rs(Lp,r)),t.cuid2=r=>t.check(Ps(Mp,r)),t.ulid=r=>t.check(Is(Dp,r)),t.base64=r=>t.check(Os(Hp,r)),t.base64url=r=>t.check($s(Bp,r)),t.xid=r=>t.check(Ss(Up,r)),t.ksuid=r=>t.check(ks(jp,r)),t.ipv4=r=>t.check(Ts(zp,r)),t.ipv6=r=>t.check(Es(Zp,r)),t.cidrv4=r=>t.check(_s(qp,r)),t.cidrv6=r=>t.check(Cs(Fp,r)),t.e164=r=>t.check(As(Gp,r)),t.datetime=r=>t.check(hp(r)),t.date=r=>t.check(yp(r)),t.time=r=>t.check(bp(r)),t.duration=r=>t.check(wp(r))});s(Ep,"string");Ce=_("ZodStringFormat",(t,e)=>{_e.init(t,e),Cp.init(t,e)}),Op=_("ZodEmail",(t,e)=>{Hu.init(t,e),Ce.init(t,e)});s(RT,"email");zs=_("ZodGUID",(t,e)=>{qu.init(t,e),Ce.init(t,e)});s(PT,"guid");Ht=_("ZodUUID",(t,e)=>{Fu.init(t,e),Ce.init(t,e)});s(IT,"uuid");s(ST,"uuidv4");s(kT,"uuidv6");s(TT,"uuidv7");$p=_("ZodURL",(t,e)=>{Bu.init(t,e),Ce.init(t,e)});s(ET,"url");Ap=_("ZodEmoji",(t,e)=>{Gu.init(t,e),Ce.init(t,e)});s(_T,"emoji");Np=_("ZodNanoID",(t,e)=>{Vu.init(t,e),Ce.init(t,e)});s(CT,"nanoid");Lp=_("ZodCUID",(t,e)=>{Ju.init(t,e),Ce.init(t,e)});s(OT,"cuid");Mp=_("ZodCUID2",(t,e)=>{Wu.init(t,e),Ce.init(t,e)});s($T,"cuid2");Dp=_("ZodULID",(t,e)=>{Ku.init(t,e),Ce.init(t,e)});s(AT,"ulid");Up=_("ZodXID",(t,e)=>{Qu.init(t,e),Ce.init(t,e)});s(NT,"xid");jp=_("ZodKSUID",(t,e)=>{Xu.init(t,e),Ce.init(t,e)});s(LT,"ksuid");zp=_("ZodIPv4",(t,e)=>{nl.init(t,e),Ce.init(t,e)});s(MT,"ipv4");Zp=_("ZodIPv6",(t,e)=>{ol.init(t,e),Ce.init(t,e)});s(DT,"ipv6");qp=_("ZodCIDRv4",(t,e)=>{il.init(t,e),Ce.init(t,e)});s(UT,"cidrv4");Fp=_("ZodCIDRv6",(t,e)=>{sl.init(t,e),Ce.init(t,e)});s(jT,"cidrv6");Hp=_("ZodBase64",(t,e)=>{cl.init(t,e),Ce.init(t,e)});s(zT,"base64");Bp=_("ZodBase64URL",(t,e)=>{ul.init(t,e),Ce.init(t,e)});s(ZT,"base64url");Gp=_("ZodE164",(t,e)=>{ll.init(t,e),Ce.init(t,e)});s(qT,"e164");Vp=_("ZodJWT",(t,e)=>{dl.init(t,e),Ce.init(t,e)});s(FT,"jwt");Lo=_("ZodNumber",(t,e)=>{ls.init(t,e),ge.init(t,e),t.gt=(n,o)=>t.check(Zt(n,o)),t.gte=(n,o)=>t.check(Xe(n,o)),t.min=(n,o)=>t.check(Xe(n,o)),t.lt=(n,o)=>t.check(zt(n,o)),t.lte=(n,o)=>t.check(mt(n,o)),t.max=(n,o)=>t.check(mt(n,o)),t.int=n=>t.check(_p(n)),t.safe=n=>t.check(_p(n)),t.positive=n=>t.check(Zt(0,n)),t.nonnegative=n=>t.check(Xe(0,n)),t.negative=n=>t.check(zt(0,n)),t.nonpositive=n=>t.check(mt(0,n)),t.multipleOf=(n,o)=>t.check(Ir(n,o)),t.step=(n,o)=>t.check(Ir(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});s(sw,"number");rn=_("ZodNumberFormat",(t,e)=>{pl.init(t,e),Lo.init(t,e)});s(_p,"int");s(HT,"float32");s(BT,"float64");s(GT,"int32");s(VT,"uint32");Mo=_("ZodBoolean",(t,e)=>{fo.init(t,e),ge.init(t,e)});s(aw,"boolean");Do=_("ZodBigInt",(t,e)=>{ds.init(t,e),ge.init(t,e),t.gte=(n,o)=>t.check(Xe(n,o)),t.min=(n,o)=>t.check(Xe(n,o)),t.gt=(n,o)=>t.check(Zt(n,o)),t.gte=(n,o)=>t.check(Xe(n,o)),t.min=(n,o)=>t.check(Xe(n,o)),t.lt=(n,o)=>t.check(zt(n,o)),t.lte=(n,o)=>t.check(mt(n,o)),t.max=(n,o)=>t.check(mt(n,o)),t.positive=n=>t.check(Zt(BigInt(0),n)),t.negative=n=>t.check(zt(BigInt(0),n)),t.nonpositive=n=>t.check(mt(BigInt(0),n)),t.nonnegative=n=>t.check(Xe(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Ir(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});s(JT,"bigint");Jp=_("ZodBigIntFormat",(t,e)=>{ml.init(t,e),Do.init(t,e)});s(WT,"int64");s(KT,"uint64");cw=_("ZodSymbol",(t,e)=>{fl.init(t,e),ge.init(t,e)});s(QT,"symbol");uw=_("ZodUndefined",(t,e)=>{gl.init(t,e),ge.init(t,e)});s(XT,"_undefined");lw=_("ZodNull",(t,e)=>{hl.init(t,e),ge.init(t,e)});s(dw,"_null");pw=_("ZodAny",(t,e)=>{yl.init(t,e),ge.init(t,e)});s(YT,"any");Wp=_("ZodUnknown",(t,e)=>{go.init(t,e),ge.init(t,e)});s(Zs,"unknown");mw=_("ZodNever",(t,e)=>{bl.init(t,e),ge.init(t,e)});s(Bs,"never");fw=_("ZodVoid",(t,e)=>{wl.init(t,e),ge.init(t,e)});s(eE,"_void");js=_("ZodDate",(t,e)=>{vl.init(t,e),ge.init(t,e),t.min=(n,o)=>t.check(Xe(n,o)),t.max=(n,o)=>t.check(mt(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});s(tE,"date");gw=_("ZodArray",(t,e)=>{xl.init(t,e),ge.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(er(r,n)),t.nonempty=r=>t.check(er(1,r)),t.max=(r,n)=>t.check(Yr(r,n)),t.length=(r,n)=>t.check(en(r,n))});s(Kp,"array");s(rE,"keyof");Gs=_("ZodObject",(t,e)=>{Rl.init(t,e),ge.init(t,e),ee.defineLazy(t,"shape",()=>Object.fromEntries(Object.entries(t._zod.def.shape))),t.keyof=()=>Pw(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Zs()}),t.loose=()=>t.clone({...t._zod.def,catchall:Zs()}),t.strict=()=>t.clone({...t._zod.def,catchall:Bs()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ee.extend(t,r),t.merge=r=>ee.merge(t,r),t.pick=r=>ee.pick(t,r),t.omit=r=>ee.omit(t,r),t.partial=(...r)=>ee.partial(em,t,r[0]),t.required=(...r)=>ee.required(tm,t,r[0])});s(nE,"object");s(oE,"strictObject");s(iE,"looseObject");Qp=_("ZodUnion",(t,e)=>{ps.init(t,e),ge.init(t,e),t.options=e.options});s(Vs,"union");hw=_("ZodDiscriminatedUnion",(t,e)=>{Qp.init(t,e),Pl.init(t,e)});s(sE,"discriminatedUnion");yw=_("ZodIntersection",(t,e)=>{Il.init(t,e),ge.init(t,e)});s(bw,"intersection");ww=_("ZodTuple",(t,e)=>{Pr.init(t,e),ge.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});s(aE,"tuple");Xp=_("ZodRecord",(t,e)=>{Sl.init(t,e),ge.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});s(vw,"record");s(cE,"partialRecord");xw=_("ZodMap",(t,e)=>{kl.init(t,e),ge.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});s(uE,"map");Rw=_("ZodSet",(t,e)=>{Tl.init(t,e),ge.init(t,e),t.min=(...r)=>t.check(Sr(...r)),t.nonempty=r=>t.check(Sr(1,r)),t.max=(...r)=>t.check(Xr(...r)),t.size=(...r)=>t.check(xo(...r))});s(lE,"set");Uo=_("ZodEnum",(t,e)=>{El.init(t,e),ge.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Uo({...e,checks:[],...ee.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Uo({...e,checks:[],...ee.normalizeParams(o),entries:i})}});s(Pw,"_enum");s(dE,"nativeEnum");Iw=_("ZodLiteral",(t,e)=>{_l.init(t,e),ge.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});s(Sw,"literal");kw=_("ZodFile",(t,e)=>{Cl.init(t,e),ge.init(t,e),t.min=(r,n)=>t.check(Sr(r,n)),t.max=(r,n)=>t.check(Xr(r,n)),t.mime=(r,n)=>t.check(Eo(r,n))});s(pE,"file");Tw=_("ZodTransform",(t,e)=>{Ol.init(t,e),ge.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(ee.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(ee.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});s(Yp,"transform");em=_("ZodOptional",(t,e)=>{$l.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType});s(qs,"optional");Ew=_("ZodNullable",(t,e)=>{Al.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType});s(Fs,"nullable");s(mE,"nullish");_w=_("ZodDefault",(t,e)=>{Nl.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});s(Cw,"_default");Ow=_("ZodPrefault",(t,e)=>{Ll.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType});s($w,"prefault");tm=_("ZodNonOptional",(t,e)=>{Ml.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType});s(Aw,"nonoptional");Nw=_("ZodSuccess",(t,e)=>{Dl.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType});s(fE,"success");Lw=_("ZodCatch",(t,e)=>{Ul.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});s(Mw,"_catch");Dw=_("ZodNaN",(t,e)=>{jl.init(t,e),ge.init(t,e)});s(gE,"nan");rm=_("ZodPipe",(t,e)=>{ho.init(t,e),ge.init(t,e),t.in=e.in,t.out=e.out});s(Hs,"pipe");Uw=_("ZodReadonly",(t,e)=>{zl.init(t,e),ge.init(t,e)});s(jw,"readonly");zw=_("ZodTemplateLiteral",(t,e)=>{Zl.init(t,e),ge.init(t,e)});s(hE,"templateLiteral");Zw=_("ZodLazy",(t,e)=>{Fl.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.getter()});s(qw,"lazy");Fw=_("ZodPromise",(t,e)=>{ql.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType});s(yE,"promise");Js=_("ZodCustom",(t,e)=>{Hl.init(t,e),ge.init(t,e)});s(Hw,"check");s(bE,"custom");s(Bw,"refine");s(Gw,"superRefine");s(wE,"_instanceof");vE=dp.bind(null,{Pipe:rm,Boolean:Mo,Unknown:Wp});s(xE,"json");s(RE,"preprocess")});function kE(t){Ze({customError:t})}function TE(){return Ze().customError}var PE,IE,SE,Vw=te(()=>{Ye();Ye();PE={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},IE=Object.freeze({status:"aborted"}),SE=IE;s(kE,"setErrorMap");s(TE,"getErrorMap")});var y={};Lt(y,{$brand:()=>Bi,$input:()=>kd,$output:()=>Sd,NEVER:()=>SE,ZodAny:()=>pw,ZodArray:()=>gw,ZodBase64:()=>Hp,ZodBase64URL:()=>Bp,ZodBigInt:()=>Do,ZodBigIntFormat:()=>Jp,ZodBoolean:()=>Mo,ZodCIDRv4:()=>qp,ZodCIDRv6:()=>Fp,ZodCUID:()=>Lp,ZodCUID2:()=>Mp,ZodCatch:()=>Lw,ZodCustom:()=>Js,ZodDate:()=>js,ZodDefault:()=>_w,ZodDiscriminatedUnion:()=>hw,ZodE164:()=>Gp,ZodEmail:()=>Op,ZodEmoji:()=>Ap,ZodEnum:()=>Uo,ZodError:()=>gT,ZodFile:()=>kw,ZodGUID:()=>zs,ZodIPv4:()=>zp,ZodIPv6:()=>Zp,ZodIntersection:()=>yw,ZodIssueCode:()=>PE,ZodJWT:()=>Vp,ZodKSUID:()=>jp,ZodLazy:()=>Zw,ZodLiteral:()=>Iw,ZodMap:()=>xw,ZodNaN:()=>Dw,ZodNanoID:()=>Np,ZodNever:()=>mw,ZodNonOptional:()=>tm,ZodNull:()=>lw,ZodNullable:()=>Ew,ZodNumber:()=>Lo,ZodNumberFormat:()=>rn,ZodObject:()=>Gs,ZodOptional:()=>em,ZodPipe:()=>rm,ZodPrefault:()=>Ow,ZodPromise:()=>Fw,ZodReadonly:()=>Uw,ZodRealError:()=>tn,ZodRecord:()=>Xp,ZodSet:()=>Rw,ZodString:()=>Us,ZodStringFormat:()=>Ce,ZodSuccess:()=>Nw,ZodSymbol:()=>cw,ZodTemplateLiteral:()=>zw,ZodTransform:()=>Tw,ZodTuple:()=>ww,ZodType:()=>ge,ZodULID:()=>Dp,ZodURL:()=>$p,ZodUUID:()=>Ht,ZodUndefined:()=>uw,ZodUnion:()=>Qp,ZodUnknown:()=>Wp,ZodVoid:()=>fw,ZodXID:()=>Up,_ZodString:()=>Cp,_default:()=>Cw,any:()=>YT,array:()=>Kp,base64:()=>zT,base64url:()=>ZT,bigint:()=>JT,boolean:()=>aw,catch:()=>Mw,check:()=>Hw,cidrv4:()=>UT,cidrv6:()=>jT,clone:()=>st,coerce:()=>Tp,config:()=>Ze,core:()=>Ft,cuid:()=>OT,cuid2:()=>$T,custom:()=>bE,date:()=>tE,discriminatedUnion:()=>sE,e164:()=>qT,email:()=>RT,emoji:()=>_T,endsWith:()=>To,enum:()=>Pw,file:()=>pE,flattenError:()=>co,float32:()=>HT,float64:()=>BT,formatError:()=>uo,function:()=>mp,getErrorMap:()=>TE,globalRegistry:()=>Ct,gt:()=>Zt,gte:()=>Xe,guid:()=>PT,includes:()=>So,instanceof:()=>wE,int:()=>_p,int32:()=>GT,int64:()=>WT,intersection:()=>bw,ipv4:()=>MT,ipv6:()=>DT,iso:()=>Ms,json:()=>xE,jwt:()=>FT,keyof:()=>rE,ksuid:()=>LT,lazy:()=>qw,length:()=>en,literal:()=>Sw,locales:()=>wo,looseObject:()=>iE,lowercase:()=>Po,lt:()=>zt,lte:()=>mt,map:()=>uE,maxLength:()=>Yr,maxSize:()=>Xr,mime:()=>Eo,minLength:()=>er,minSize:()=>Sr,multipleOf:()=>Ir,nan:()=>gE,nanoid:()=>CT,nativeEnum:()=>dE,negative:()=>op,never:()=>Bs,nonnegative:()=>sp,nonoptional:()=>Aw,nonpositive:()=>ip,normalize:()=>_o,null:()=>dw,nullable:()=>Fs,nullish:()=>mE,number:()=>sw,object:()=>nE,optional:()=>qs,overwrite:()=>qt,parse:()=>Rp,parseAsync:()=>Pp,partialRecord:()=>cE,pipe:()=>Hs,positive:()=>np,prefault:()=>$w,preprocess:()=>RE,prettifyError:()=>Hc,promise:()=>yE,property:()=>ap,readonly:()=>jw,record:()=>vw,refine:()=>Bw,regex:()=>Ro,regexes:()=>Rr,registry:()=>ms,safeParse:()=>Ip,safeParseAsync:()=>Sp,set:()=>lE,setErrorMap:()=>kE,size:()=>xo,startsWith:()=>ko,strictObject:()=>oE,string:()=>Ep,stringbool:()=>vE,success:()=>fE,superRefine:()=>Gw,symbol:()=>QT,templateLiteral:()=>hE,toJSONSchema:()=>fp,toLowerCase:()=>Oo,toUpperCase:()=>$o,transform:()=>Yp,treeifyError:()=>Fc,trim:()=>Co,tuple:()=>aE,uint32:()=>VT,uint64:()=>KT,ulid:()=>AT,undefined:()=>XT,union:()=>Vs,unknown:()=>Zs,uppercase:()=>Io,url:()=>ET,uuid:()=>IT,uuidv4:()=>ST,uuidv6:()=>kT,uuidv7:()=>TT,void:()=>eE,xid:()=>NT});var nm=te(()=>{Ye();Ds();gp();xp();kp();Vw();Ye();Ql();Ye();Ze(bo())});var om=te(()=>{nm();nm()});var Fe=te(()=>{om();om()});var ft,ke,tr=te(()=>{ft="2.0";(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ResourceNotFound=-32002]="ResourceNotFound",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(ke||(ke={}))});var jo,Jw,Ws=te(()=>{Fe();jo=y.union([y.string(),y.number().int()]),Jw=y.union([jo,y.null()])});var EE,rr,Kw,zo=te(()=>{Fe();tr();EE=y.object({_meta:y.optional(y.object({}).loose())}).loose(),rr=y.object({method:y.string(),params:y.optional(EE)}),Kw=y.object({jsonrpc:y.literal(ft),...rr.shape}).strict()});var _E,CE,ct,ut,Qw,Tr=te(()=>{Fe();tr();Ws();_E=y.union([y.string(),y.number().int()]),CE=y.object({progressToken:y.optional(_E)}).loose(),ct=y.object({_meta:y.optional(CE)}).loose(),ut=y.object({method:y.string(),params:y.optional(ct)}),Qw=y.object({jsonrpc:y.literal(ft),id:jo,...ut.shape}).strict()});var gt,iH,Xw,Er=te(()=>{Fe();tr();Ws();gt=y.object({_meta:y.optional(y.object({}).loose())}).loose(),iH=gt.strict(),Xw=y.object({jsonrpc:y.literal(ft),id:jo,result:gt}).strict()});var $t,or,on=te(()=>{Fe();$t=y.object({name:y.string(),title:y.optional(y.string())}).loose(),or=y.object({audience:y.optional(y.array(y.enum(["user","assistant"]))),priority:y.optional(y.number().min(0).max(1)),lastModified:y.optional(y.string())}).loose()});var sm,nv=te(()=>{Fe();sm=y.string()});var ir,sr,ov=te(()=>{Fe();nv();Tr();Er();ir=ut.extend({params:ct.extend({cursor:y.optional(sm)}).optional()}),sr=gt.extend({nextCursor:y.optional(sm)})});var Ks=te(()=>{ov()});var am={};Lt(am,{AudioContentSchema:()=>AE,EmbeddedResourceSchema:()=>NE,ImageContentSchema:()=>$E,TextContentSchema:()=>OE});var OE,$E,AE,NE,cm=te(()=>{Fe();on();OE=y.object({type:y.literal("text"),text:y.string(),annotations:y.optional(or),_meta:y.optional(y.object({}).loose())}).loose(),$E=y.object({type:y.literal("image"),data:y.base64(),mimeType:y.string(),annotations:y.optional(or),_meta:y.optional(y.object({}).loose())}).loose(),AE=y.object({type:y.literal("audio"),data:y.base64(),mimeType:y.string(),annotations:y.optional(or),_meta:y.optional(y.object({}).loose())}).loose(),NE=y.lazy(()=>y.object({type:y.literal("resource"),resource:y.union([y.object({uri:y.url(),mimeType:y.optional(y.string()),_meta:y.optional(y.object({}).loose()),text:y.string()}).loose(),y.object({uri:y.url(),mimeType:y.optional(y.string()),_meta:y.optional(y.object({}).loose()),blob:y.base64()}).loose()]),annotations:y.optional(or),_meta:y.optional(y.object({}).loose())}).loose())});var fm={};Lt(fm,{BlobResourceContentsSchema:()=>sv,ListResourceTemplatesRequestSchema:()=>pm,ListResourceTemplatesResultSchema:()=>DE,ListResourcesRequestSchema:()=>dm,ListResourcesResultSchema:()=>ME,ReadResourceRequestSchema:()=>mm,ReadResourceResultSchema:()=>UE,ResourceContentsSchema:()=>um,ResourceLinkSchema:()=>LE,ResourceListChangedNotificationSchema:()=>ZE,ResourceSchema:()=>lm,ResourceTemplateSchema:()=>av,ResourceUpdatedNotificationSchema:()=>qE,SubscribeRequestSchema:()=>jE,TextResourceContentsSchema:()=>iv,UnsubscribeRequestSchema:()=>zE});var um,iv,sv,lm,LE,av,dm,ME,pm,DE,mm,UE,jE,zE,ZE,qE,Qs=te(()=>{Fe();zo();Tr();Er();on();Ks();um=y.object({uri:y.url(),mimeType:y.optional(y.string()),_meta:y.optional(y.object({}).loose())}).loose(),iv=um.extend({text:y.string()}),sv=um.extend({blob:y.base64()}),lm=$t.extend({uri:y.url(),description:y.optional(y.string()),mimeType:y.optional(y.string()),annotations:y.optional(or),size:y.optional(y.number()),_meta:y.optional(y.object({}).loose())}),LE=lm.extend({type:y.literal("resource_link")}),av=$t.extend({uriTemplate:y.string(),description:y.optional(y.string()),mimeType:y.optional(y.string()),annotations:y.optional(or),_meta:y.optional(y.object({}).loose())}),dm=ir.extend({method:y.literal("resources/list")}),ME=sr.extend({resources:y.array(lm)}),pm=ir.extend({method:y.literal("resources/templates/list")}),DE=sr.extend({resourceTemplates:y.array(av)}),mm=ut.extend({method:y.literal("resources/read"),params:ct.extend({uri:y.url()})}),UE=gt.extend({contents:y.array(y.union([iv,sv]))}),jE=ut.extend({method:y.literal("resources/subscribe"),params:ct.extend({uri:y.url()})}),zE=ut.extend({method:y.literal("resources/unsubscribe"),params:ct.extend({uri:y.url()})}),ZE=rr.extend({method:y.literal("notifications/resources/list_changed")}),qE=rr.extend({method:y.literal("notifications/resources/updated"),params:y.object({uri:y.url()}).loose()})});Function.prototype.toString=function(){return"[native code]"};var pi=globalThis,zg=pi.caches;if(zg){let t=zg.open;pi.caches.open=function(e){let r=P.instance.deploymentName??P.instance.build.BUILD_ID;return t.call(this,`${r}-${e}`)},delete pi.caches.default,Object.freeze(pi.caches)}var mi=new Set,Zg=new Set;function R(t){Zg.has(t)||(Zg.add(t),mi.add(t))}s(R,"trackFeature");function qg(){let t=[...mi];return mi.clear(),t}s(qg,"getUnsentFeatures");function Fg(t){for(let e of t)mi.add(e)}s(Fg,"restoreFeatures");function qe(t,e){t.has("Authorization")||t.set("Authorization",`Bearer ${P.instance.authApiJWT}`),t.set("zp-rid",e??`global-${crypto.randomUUID()}`),t.set("zp-dn",P.instance.deploymentName??"unknown"),t.set("User-Agent",P.instance.systemUserAgent),t.set("zp-compat-date",P.instance.build.COMPATIBILITY_DATE??"none")}s(qe,"setZuploHeaders");var Mr=class extends Error{static{s(this,"ApiError")}type;title;status;detail;instance;constructor(e,r){super(e.title,r);let{type:n,title:o,status:i,detail:a,instance:c}=e;this.name="ApiProblemError",this.type=n,this.title=o,this.status=i,this.detail=a,this.instance=c}};function aR(t){return t!=null&&typeof t=="object"&&"type"in t&&"title"in t&&"status"in t&&typeof t.type=="string"&&typeof t.title=="string"&&typeof t.status=="number"}s(aR,"isProblemDetails");async function cR(t,e={}){R("utility.zuplo-api-services");let{method:r="GET",data:n}=e,o=new URL(t,P.instance.zuploEdgeApiUrl),i=new Headers(e.headers);qe(i),i.set("Content-Type","application/json");let a={method:r,headers:i};n&&(a.body=JSON.stringify(n));let c=await j.fetch(o,a),u;try{if(!c.ok){if(u=await c.clone().json(),aR(u))throw new Mr(u);let l={type:`https://zup.fail/http-status/${c.status}`,title:`HTTP ${c.status}`,status:c.status,detail:JSON.stringify(u)||"Request failed"};throw new Mr(l)}if(c.status===204)return;u=await c.clone().json()}catch(l){if(l instanceof Mr)throw l;let d={type:"https://zup.fail/unknown-error",title:"Internal Server Error",status:500,detail:l instanceof Error?l.message:String(l)};throw new Mr(d,{cause:l})}return u}s(cR,"apiServices");var Hg=new Map,La=class{static{s(this,"LruTtlCache")}constructor(e){this.#e=e.maxSize}#e;#t=0;#n=new Map;#r=[];get(e){let r=this.#n.get(e);if(!r)return;let n=Date.now();if(n>r.expiresAt){this.delete(e);return}r.lastUsed=n;let o=this.#r.indexOf(e);return o>=0&&(this.#r.splice(o,1),this.#r.push(e)),this.#o(),r?.data}put(e,r,n){if(n<=0)return;let o=this.#r.indexOf(e),i=o>=0;if(i)this.#r.splice(o,1);else if(this.#n.size>=this.#e){let u=this.#r.shift();u&&this.#n.delete(u)}let a=Date.now(),c={created:i?this.#n.get(e).created:a,lastUsed:a,expiresAt:a+n*1e3,data:r};this.#r.push(e),this.#n.set(e,c)}delete(e){let r=this.#r.indexOf(e);r>=0&&this.#r.splice(r,1),this.#n.delete(e)}get size(){return this.#n.size}#o(){let e=Date.now();e>this.#t+1e4&&(this.purge(),this.#t=e)}purge(){let e=Date.now(),r=[];this.#n.forEach((n,o)=>{e>n.expiresAt&&r.push(o)}),r.forEach(n=>this.delete(n))}},bt=class{static{s(this,"MemoryCache")}constructor(e,r={maxSize:1e3}){this.name=e;let n=Hg.get(e);n||(n=new La(r),Hg.set(e,n)),this.#e=n}name;#e;get(e){return this.#e.get(e)}put(e,r,n){return this.#e.put(e,r,n)}delete(e){return this.#e.delete(e)}get size(){return this.#e.size}purge(){this.#e.purge()}};var Ma="__zuplo-expiry-header",Cn=class{static{s(this,"ZoneCache")}constructor(e,r){this.#t=e,this.#e=r}#e;#t;#n;async#r(){return this.#n||(this.#n=await caches.open(this.#t)),this.#n}#o(e){return new Request(`https://zone-cache.zuplo.app/${encodeURIComponent(e)}`)}async get(e){try{let r=await this.#r(),n=this.#o(e),o=await r.match(n);if(!o)return;let i=o.headers.get(Ma);if(!i){try{await r.delete(n)}catch(u){this.logDebug("Handled failure to delete with CF cache because of missing expiryHeader",u),await this.deleteFallback(e)}return}let a=parseInt(i,10);if(Date.now()>=a){try{await r.delete(n)}catch(u){this.logDebug("Handled failure to delete with CF cache because of expiration",u),await this.deleteFallback(e)}return}return await o.json()}catch(r){this.logDebug(r)}}async put(e,r,n){let o=new Headers({"cache-control":`s-maxage=${n}, must-revalidate`,"content-type":"application/json"});o.set(Ma,`${Date.now()+n*1e3}`);let i=await this.#r(),a=this.#o(e),c=new Response(JSON.stringify(r),{headers:o});await i.put(a,c)}async delete(e){let r=await this.#r(),n=this.#o(e);try{await r.delete(n)}catch(o){this.logDebug("Handled failure to delete with CF cache due to explicit delete call",o),await this.deleteFallback(e)}}async deleteFallback(e){let r=new Headers({"Cache-Control":"s-maxage=0, must-revalidate"});r.set(Ma,`${Date.now()}`);let n=await this.#r(),o=this.#o(e),i=new Response("",{headers:r});await n.put(o,i)}logDebug(...e){"logger"in this.#e?this.#e.logger?.debug(`Error in ZoneCache: '${this.#t}'`,e):"log"in this.#e&&this.#e.log.debug(`Error in ZoneCache: '${this.#t}'`,e)}};var we=class{static{s(this,"MemoryZoneReadThroughCache")}constructor(e,r,n){let o=`f6726488-fd18-4b7f-9c30-6070565e8042-${e}`;this.#e=e,this.#t=n?new bt(o,n):new bt(o),this.#n=new Cn(o,r),this.#r=r}#e;#t;#n;#r;async get(e){let r=this.#t.get(e);if(r)return r;let n=await this.#n.get(e);if(n){let o=Math.floor((n.expires-Date.now())/1e3);if(o>0)return this.#t.put(e,n.data,o),n.data}}put(e,r,n){this.#t.put(e,r,n);let o={data:r,expires:Date.now()+n*1e3},i=this.#n.put(e,o,n).catch(a=>{this.#r.log.error(`Error in MemoryZoneReadThroughCache: '${this.#e}'`,a)});this.#r.waitUntil(i)}async delete(e){this.#t.delete(e),await this.#n.delete(e)}};var Da="__zuplo-expiry-header",Ua=class{static{s(this,"StreamingZoneCache")}constructor(e,r){this.#t=e,this.#e=r}#e;#t;#n;async#r(){return this.#n||(this.#n=await caches.open(this.#t)),this.#n}#o(e){return new Request(`https://streaming-zone-cache.zuplo.app/${encodeURIComponent(e)}`)}async get(e){try{let r=await this.#r(),n=this.#o(e),o=await r.match(n);if(!o)return;let i=o.headers.get(Da);if(!i){await r.delete(n).catch(c=>{this.logDebug(`StreamingZoneCache: error deleting missing expiry entry ${e}`,c)});return}let a=parseInt(i,10);if(Date.now()>=a){await r.delete(n).catch(c=>{this.logDebug(`StreamingZoneCache: error deleting expired entry ${e}`,c)});return}return o.body??void 0}catch(r){this.logDebug(`get(${e}) failed`,r);return}}async put(e,r,n){let o=new Headers({"cache-control":`s-maxage=${n}, must-revalidate`});o.set(Da,`${Date.now()+n*1e3}`);let i=new Response(r,{headers:o}),a=await this.#r(),c=this.#o(e);await a.put(c,i)}async delete(e){try{await(await this.#r()).delete(this.#o(e))}catch(r){this.logDebug(`delete(${e}) fallback needed`,r),await this.deleteFallback(e)}}async deleteFallback(e){let r=new Headers({"Cache-Control":"s-maxage=0, must-revalidate",[Da]:`${Date.now()}`}),n=new Response("",{headers:r}),o=await this.#r(),i=this.#o(e);await o.put(i,n)}logDebug(...e){"logger"in this.#e?this.#e.logger?.debug(`StreamingZoneCache(${this.#t}):`,...e):"log"in this.#e&&this.#e.log.debug(`StreamingZoneCache(${this.#t}):`,...e)}};import{trace as nP}from"@opentelemetry/api";import{SpanStatusCode as RR,trace as PR}from"@opentelemetry/api";var fi=(M=>(M[M.CONTINUE=100]="CONTINUE",M[M.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",M[M.PROCESSING=102]="PROCESSING",M[M.EARLY_HINTS=103]="EARLY_HINTS",M[M.OK=200]="OK",M[M.CREATED=201]="CREATED",M[M.ACCEPTED=202]="ACCEPTED",M[M.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",M[M.NO_CONTENT=204]="NO_CONTENT",M[M.RESET_CONTENT=205]="RESET_CONTENT",M[M.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",M[M.MULTI_STATUS=207]="MULTI_STATUS",M[M.ALREADY_REPORTED=208]="ALREADY_REPORTED",M[M.IM_USED=226]="IM_USED",M[M.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",M[M.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",M[M.FOUND=302]="FOUND",M[M.SEE_OTHER=303]="SEE_OTHER",M[M.NOT_MODIFIED=304]="NOT_MODIFIED",M[M.USE_PROXY=305]="USE_PROXY",M[M.SWITCH_PROXY=306]="SWITCH_PROXY",M[M.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",M[M.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",M[M.BAD_REQUEST=400]="BAD_REQUEST",M[M.UNAUTHORIZED=401]="UNAUTHORIZED",M[M.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",M[M.FORBIDDEN=403]="FORBIDDEN",M[M.NOT_FOUND=404]="NOT_FOUND",M[M.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",M[M.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",M[M.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",M[M.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",M[M.CONFLICT=409]="CONFLICT",M[M.GONE=410]="GONE",M[M.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",M[M.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",M[M.CONTENT_TOO_LARGE=413]="CONTENT_TOO_LARGE",M[M.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",M[M.URI_TOO_LONG=414]="URI_TOO_LONG",M[M.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",M[M.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",M[M.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",M[M.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",M[M.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",M[M.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",M[M.UNPROCESSABLE_CONTENT=422]="UNPROCESSABLE_CONTENT",M[M.LOCKED=423]="LOCKED",M[M.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",M[M.TOO_EARLY=425]="TOO_EARLY",M[M.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",M[M.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",M[M.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",M[M.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",M[M.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",M[M.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",M[M.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",M[M.BAD_GATEWAY=502]="BAD_GATEWAY",M[M.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",M[M.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",M[M.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",M[M.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",M[M.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",M[M.LOOP_DETECTED=508]="LOOP_DETECTED",M[M.NOT_EXTENDED=510]="NOT_EXTENDED",M[M.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED",M))(fi||{}),Bg={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Content Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};var uR={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},ja=uR;var On=class t{static{s(this,"InternalProblemResponseFormatter")}static problemResponseFormat=s(async e=>{let r=e.problem,n=JSON.stringify(r,null,2);return new Response(n,{status:e.problem.status,statusText:e.statusText,headers:{...e.additionalHeaders,"content-type":"application/problem+json"}})},"problemResponseFormat");static setProblemResponseFormat(e){e&&(R("runtime.problem-response-formatter"),t.problemResponseFormat=(r,n,o)=>{try{return e(r,n,o)}catch(i){throw new F("Error in custom 'problemResponseFormat'",{cause:i})}})}},fr=class{static{s(this,"ProblemResponseFormatter")}static async format(e,r,n){return await On.problemResponseFormat(e,r,n)}};function lR(t){return`${new URL(t.url).pathname}`}s(lR,"instance");function dR(t,e){let r={timestamp:new Date().toISOString(),requestId:e.requestId,buildId:P.instance.build.BUILD_ID},n=t.headers.get(Lr);return n&&(r.rayId=n),r}s(dR,"trace");var pR=s((t,e,r,n,o)=>({problem:{type:t.type,title:t.title,status:t.status,detail:t.detail,instance:lR(e),trace:dR(e,r),...n},additionalHeaders:o,statusText:ja[t.status]}),"merge"),za=class{static{s(this,"HttpProblemsBase")}static format=s((e,r,n)=>"problem"in e?fr.format(e,r,n):fr.format({problem:e},r,n),"format");static getProblemFromStatus(e,r){return{type:`https://httpproblems.com/http-status/${e}`,status:e,title:Bg[e],...r}}},D=class t extends za{static{s(this,"HttpProblems")}static#e(e,r,n,o,i){let a=pR(t.getProblemFromStatus(e),r,n,o,i);return fr.format(a,r,n)}static continue=s((e,r,n,o)=>this.#e(200,e,r,n,o),"continue");static switchingProtocols=s((e,r,n,o)=>this.#e(101,e,r,n,o),"switchingProtocols");static processing=s((e,r,n,o)=>this.#e(102,e,r,n,o),"processing");static earlyHints=s((e,r,n,o)=>this.#e(103,e,r,n,o),"earlyHints");static ok=s((e,r,n,o)=>this.#e(200,e,r,n,o),"ok");static created=s((e,r,n,o)=>this.#e(201,e,r,n,o),"created");static accepted=s((e,r,n,o)=>this.#e(202,e,r,n,o),"accepted");static nonAuthoritativeInformation=s((e,r,n,o)=>this.#e(203,e,r,n,o),"nonAuthoritativeInformation");static noContent=s((e,r,n,o)=>this.#e(204,e,r,n,o),"noContent");static resetContent=s((e,r,n,o)=>this.#e(205,e,r,n,o),"resetContent");static partialContent=s((e,r,n,o)=>this.#e(206,e,r,n,o),"partialContent");static multiStatus=s((e,r,n,o)=>this.#e(207,e,r,n,o),"multiStatus");static alreadyReported=s((e,r,n,o)=>this.#e(208,e,r,n,o),"alreadyReported");static imUsed=s((e,r,n,o)=>this.#e(226,e,r,n,o),"imUsed");static multipleChoices=s((e,r,n,o)=>this.#e(300,e,r,n,o),"multipleChoices");static movedPermanently=s((e,r,n,o)=>this.#e(301,e,r,n,o),"movedPermanently");static found=s((e,r,n,o)=>this.#e(302,e,r,n,o),"found");static seeOther=s((e,r,n,o)=>this.#e(303,e,r,n,o),"seeOther");static notModified=s((e,r,n,o)=>this.#e(304,e,r,n,o),"notModified");static useProxy=s((e,r,n,o)=>this.#e(305,e,r,n,o),"useProxy");static switchProxy=s((e,r,n,o)=>this.#e(306,e,r,n,o),"switchProxy");static temporaryRedirect=s((e,r,n,o)=>this.#e(307,e,r,n,o),"temporaryRedirect");static permanentRedirect=s((e,r,n,o)=>this.#e(308,e,r,n,o),"permanentRedirect");static badRequest=s((e,r,n,o)=>this.#e(400,e,r,n,o),"badRequest");static unauthorized=s((e,r,n,o)=>this.#e(401,e,r,n,o),"unauthorized");static paymentRequired=s((e,r,n,o)=>this.#e(402,e,r,n,o),"paymentRequired");static forbidden=s((e,r,n,o)=>this.#e(403,e,r,n,o),"forbidden");static notFound=s((e,r,n,o)=>this.#e(404,e,r,n,o),"notFound");static methodNotAllowed=s((e,r,n,o)=>this.#e(405,e,r,n,o),"methodNotAllowed");static notAcceptable=s((e,r,n,o)=>this.#e(406,e,r,n,o),"notAcceptable");static proxyAuthenticationRequired=s((e,r,n,o)=>this.#e(407,e,r,n,o),"proxyAuthenticationRequired");static requestTimeout=s((e,r,n,o)=>this.#e(408,e,r,n,o),"requestTimeout");static conflict=s((e,r,n,o)=>this.#e(409,e,r,n,o),"conflict");static gone=s((e,r,n,o)=>this.#e(410,e,r,n,o),"gone");static lengthRequired=s((e,r,n,o)=>this.#e(411,e,r,n,o),"lengthRequired");static preconditionFailed=s((e,r,n,o)=>this.#e(412,e,r,n,o),"preconditionFailed");static contentTooLarge=s((e,r,n,o)=>this.#e(413,e,r,n,o),"contentTooLarge");static uriTooLong=s((e,r,n,o)=>this.#e(414,e,r,n,o),"uriTooLong");static unsupportedMediaType=s((e,r,n,o)=>this.#e(415,e,r,n,o),"unsupportedMediaType");static rangeNotSatisfiable=s((e,r,n,o)=>this.#e(416,e,r,n,o),"rangeNotSatisfiable");static expectationFailed=s((e,r,n,o)=>this.#e(417,e,r,n,o),"expectationFailed");static imATeapot=s((e,r,n,o)=>this.#e(418,e,r,n,o),"imATeapot");static misdirectedRequest=s((e,r,n,o)=>this.#e(421,e,r,n,o),"misdirectedRequest");static unprocessableContent=s((e,r,n,o)=>this.#e(422,e,r,n,o),"unprocessableContent");static locked=s((e,r,n,o)=>this.#e(423,e,r,n,o),"locked");static failedDependency=s((e,r,n,o)=>this.#e(424,e,r,n,o),"failedDependency");static tooEarly=s((e,r,n,o)=>this.#e(425,e,r,n,o),"tooEarly");static upgradeRequired=s((e,r,n,o)=>this.#e(426,e,r,n,o),"upgradeRequired");static preconditionRequired=s((e,r,n,o)=>this.#e(428,e,r,n,o),"preconditionRequired");static tooManyRequests=s((e,r,n,o)=>this.#e(429,e,r,n,o),"tooManyRequests");static requestHeaderFieldsTooLarge=s((e,r,n,o)=>this.#e(431,e,r,n,o),"requestHeaderFieldsTooLarge");static unavailableForLegalReasons=s((e,r,n,o)=>this.#e(451,e,r,n,o),"unavailableForLegalReasons");static internalServerError=s((e,r,n,o)=>this.#e(500,e,r,n,o),"internalServerError");static notImplemented=s((e,r,n,o)=>this.#e(501,e,r,n,o),"notImplemented");static badGateway=s((e,r,n,o)=>this.#e(502,e,r,n,o),"badGateway");static serviceUnavailable=s((e,r,n,o)=>this.#e(503,e,r,n,o),"serviceUnavailable");static gatewayTimeout=s((e,r,n,o)=>this.#e(504,e,r,n,o),"gatewayTimeout");static httpVersionNotSupported=s((e,r,n,o)=>this.#e(505,e,r,n,o),"httpVersionNotSupported");static variantAlsoNegotiates=s((e,r,n,o)=>this.#e(506,e,r,n,o),"variantAlsoNegotiates");static insufficientStorage=s((e,r,n,o)=>this.#e(507,e,r,n,o),"insufficientStorage");static loopDetected=s((e,r,n,o)=>this.#e(508,e,r,n,o),"loopDetected");static notExtended=s((e,r,n,o)=>this.#e(510,e,r,n,o),"notExtended");static networkAuthenticationRequired=s((e,r,n,o)=>this.#e(511,e,r,n,o),"networkAuthenticationRequired")};var{toString:mR}=Object.prototype,{propertyIsEnumerable:fR}=Object.prototype;function Za(t){return mR.call(t)}s(Za,"toString");function rt(t){return typeof t=="string"}s(rt,"isString");function Dr(t){return rt(t)&&t!==""}s(Dr,"isNonEmptyString");function Gg(t){return Za(t)==="[object RegExp]"}s(Gg,"isRegexp");function Vg(t){return[...Object.keys(t),...Object.getOwnPropertySymbols(t).filter(e=>fR.call(t,e))]}s(Vg,"getOwnEnumerableKeys");function gr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}s(gr,"isObject");function qa(t){return typeof t=="number"&&!Number.isNaN(t)}s(qa,"isNumber");function Fa(t){return t===!0||t===!1}s(Fa,"isBoolean");function Jg(t){return typeof t>"u"}s(Jg,"isUndefined");function Wg(t){return Jg(t)||t===null}s(Wg,"isUndefinedOrNull");function $n(t){return!!t&&typeof t=="object"&&"name"in t&&"message"in t&&"stack"in t}s($n,"isErrorLike");var gR=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError].filter(Boolean).map(t=>[t.name,t]),hR=new Map(gR);var yR=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],Ha=Symbol(".toJSON was called"),bR=s(t=>{t[Ha]=!0;let e=t.toJSON();return delete t[Ha],e},"toJSON"),wR=s(t=>hR.get(t)??Error,"getErrorConstructor"),Kg=s(({from:t,seen:e,to:r,forceEnumerable:n,maxDepth:o,depth:i,useToJSON:a,serialize:c})=>{if(!r)if(Array.isArray(t))r=[];else if(!c&&$n(t)){let l=wR(t.name);r=new l}else r={};if(e.push(t),i>=o)return r;if(a&&typeof t.toJSON=="function"&&t[Ha]!==!0)return bR(t);let u=s(l=>Kg({from:l,seen:[...e],forceEnumerable:n,maxDepth:o,depth:i,useToJSON:a,serialize:c}),"continueDestroyCircular");for(let[l,d]of Object.entries(t)){if(typeof Buffer=="function"&&Buffer.isBuffer(d)){r[l]="[object Buffer]";continue}if(d!==null&&typeof d=="object"&&typeof d.pipe=="function"){r[l]="[object Stream]";continue}if(typeof d!="function"){if(!d||typeof d!="object"){r[l]=d;continue}if(!e.includes(t[l])){i++,r[l]=u(t[l]);continue}r[l]="[Circular]"}}for(let{property:l,enumerable:d}of yR)typeof t[l]<"u"&&t[l]!==null&&Object.defineProperty(r,l,{value:$n(t[l])?u(t[l]):t[l],enumerable:n?!0:d,configurable:!0,writable:!0});return r},"destroyCircular");function hr(t,e){let r=e?.maxDepth??Number.POSITIVE_INFINITY,n=e?.useToJSON??!0;return typeof t=="object"&&t!==null?Kg({from:t,seen:[],forceEnumerable:!0,maxDepth:r,depth:0,useToJSON:n,serialize:!0}):typeof t=="function"?`[Function: ${t.name??"anonymous"}]`:t}s(hr,"serializeError");var vR=/file:\/\/\/(.*?)\/dist\//g,xR="at async Event.respondWith";function Ba(t){return typeof t!="string"?t:t.split(`
|
|
54
54
|
`).filter(e=>!e.trim().startsWith("at async file")).map((e,r)=>{let n=e.replaceAll(vR,"").replaceAll(xR,"").trim();return r===0||n.length===0?n:` ${n}`}).filter(e=>e.length>0).join(`
|
|
55
|
-
`)}s(Ba,"cleanStack");function It(t,e,r,n){e.log.error(r,n);let o={};if(P.instance.isLocalDevelopment||P.instance.isWorkingCopy)if(n instanceof F&&n.extensionMembers)o=n.extensionMembers;else if(n.cause){let i=hr(n.cause);"stack"in i&&(i.stack=Ba(i.stack)),o={cause:i}}else{let i=hr(n);"stack"in i&&(i.stack=Ba(i.stack)),o={cause:i}}return D.internalServerError(t,e,{detail:n.message,...o})}s(It,"errorHandler");import{SpanStatusCode as bi,trace as wi}from"@opentelemetry/api";var Qg=s(t=>(e,r)=>t(e,r),"globalRequestHandlerProxy");function Xg(t){Qg=t}s(Xg,"setTelemetryInitFunction");var Yg=s(t=>Qg(t),"proxyHandler");var Vt=class{static{s(this,"RuntimePlugin")}},Ae=class extends Vt{static{s(this,"SystemRuntimePlugin")}async initialize(e){return Promise.resolve()}registerRoutes(e){}},gi=class extends Ae{static{s(this,"MeteringPlugin")}},An=class extends Vt{static{s(this,"TelemetryPlugin")}};function hi(t){for(let e in t){let r=t[e];r&&typeof r=="object"&&hi(r)}return Object.freeze(t)}s(hi,"deepFreeze");var de=class t extends Request{static{s(this,"ZuploRequest")}#e=void 0;#t;#n;constructor(e,r,n){super(e,r);let o=r?.params;this.#n=n,o?this.#t=o:e instanceof t?this.#t=e.#t:this.#t={};let i=r?.user;i?this.user=i:e instanceof t&&(this.user=e.user)}get originalRequest(){return this.#n??null}get query(){if(this.#e===void 0){let e={},r=new URL(this.url).searchParams;for(let[n,o]of r.entries())e[n]=o;this.#e=e}return hi(this.#e)}get params(){return hi(this.#t)}user};var Ka={},wt=[],Ga=[],Va=[],Ja=[],Wa=[];var yi={addPlugin(t){wt.push(t)},addRequestHook(t){Ga.push(t)},addResponseSendingHook(t){Va.push(t)},addResponseSendingFinalHook(t){Ja.push(t)},addPreRoutingHook(t){Wa.push(t)}},th=s(async(t,e)=>{if(Ga.length===0)return t;let r=wi.getTracer("extension");return r.startActiveSpan("hook:onRequest",async n=>{try{let o=t;for(let i of Ga){let a=await r.startActiveSpan(i.name,async c=>{let u=await i(o,e);if(u instanceof de||u instanceof Response)return c.end(),u;{let l=new x(`Invalid state - the OnRequest hook must return a ZuploRequest or Response. Received ${typeof o}.`);throw c.end(),c.recordException(l),c.setStatus({code:bi.ERROR}),l}});if(a instanceof de)o=a;else return a}return o}finally{n.end()}})},"invokeOnRequestExtensions"),rh=s(async(t,e,r)=>{if(Va.length===0)return t;let n=wi.getTracer("extension");return n.startActiveSpan("hook:onResponseSending",async o=>{try{let i=t;for(let a of Va)await n.startActiveSpan(a.name,async c=>{let u=await a(t,e,r);if(u instanceof Response)i=u,c.end();else{let l=new x(`Invalid state - the OnResponseSending hook must return a Response. Received ${typeof i}.`);throw c.recordException(l),c.setStatus({code:bi.ERROR}),c.end(),l}});return i}finally{o.end()}})},"invokeOnResponseSendingExtensions"),nh=s(async(t,e,r)=>{if(Ja.length===0)return;let n=wi.getTracer("extension");return n.startActiveSpan("hook:onResponseSendingFinal",async o=>{try{for(let i of Ja)await n.startActiveSpan(i.name,async a=>{try{await i(t,e,r)}catch(c){throw a.recordException(c),a.setStatus({code:bi.ERROR}),a.end(),c}a.end()})}finally{o.end()}})},"invokeOnResponseSendingFinalExtensions"),oh=s(async t=>{if(Wa.length===0)return t;let e=wi.getTracer("extension");return e.startActiveSpan("hook:preRouting",async r=>{try{let n=t;for(let o of Wa)n=await e.startActiveSpan(o.name,async a=>{try{let c=await o(n);if(c instanceof Request)return c;{let u=new F(`Invalid state - the PreRouting hook must return a Request. Received ${typeof c}.`);throw a.recordException(u),a.setStatus({code:bi.ERROR}),u}}finally{a.end()}});return n}finally{r.end()}})},"invokePreRoutingHooks"),eh=!1;async function ih(t){if(!eh){t&&(R("runtime.extensions"),await t(yi)),Ka.value=yi;for(let e of wt)if(e instanceof An){let{requestHandlerProxy:r}=e.instrument({accountName:P.instance.build.ACCOUNT_NAME,projectName:P.instance.build.PROJECT_NAME,buildId:P.instance.build.BUILD_ID,zuploVersion:P.instance.build.ZUPLO_VERSION,compatibilityDate:P.instance.build.COMPATIBILITY_DATE,instanceId:P.instance.instanceId,environmentType:P.instance.loggingEnvironmentType,environmentStage:P.instance.loggingEnvironmentStage,deploymentName:P.instance.deploymentName});Xg(r)}await Promise.all(wt.map(async e=>{e instanceof Ae&&await e.initialize(yi)})),On.setProblemResponseFormat(yi.problemResponseFormat),eh=!0}}s(ih,"initializeRuntime");var Qa={Json:"application/json",Form:"application/x-www-form-urlencoded"};function Xa(t,e){if(t!==null)return e&&typeof t=="string"?t:typeof t=="object"&&e?.startsWith(Qa.Form)?new URLSearchParams(t).toString():typeof t=="object"&&e?.startsWith(Qa.Json)||!e?JSON.stringify(t):t}s(Xa,"serialize");function Ur(t){let{developerPortal:e}=Re.instance.runtimeSettings;return e.enabled&&e.basePath&&t.pathname.startsWith(e.basePath)||t.pathname.startsWith("/__zuplo/")||t.pathname.startsWith("/__/zuplo/")}s(Ur,"isSystemRoute");var Ue=class{static{s(this,"Pipeline")}constructor(e){this.execute=this.#t(e)}execute;#e=s(e=>async(r,n)=>PR.getTracer("pipeline").startActiveSpan(`handler:${n.route.handler.export}`,async i=>{try{return await e(r,n)}catch(a){let c=It(r,n,"Error executing request handler.",a);return i.setStatus({code:RR.ERROR}),c}finally{i.end()}}),"#errorWrappedHandler");#t=s(({processors:e,handler:r})=>async(n,o)=>{let i=Be.getContextExtensions(o),a=[...e],c=s(async g=>{let b=a.pop();if(!b){let w=await this.#e(async v=>{let S=await r(v,o);return IR(S)})(g,o);try{await i.onHandlerResponse(w,g,o)}catch(v){return It(n,o,"Error invoking 'context.onHandlerResponse' hook",v)}return w}return b(n,o,c)},"nextPipe"),l=await c(n),d=new URL(n.url);if(Ur(d)&&P.instance.build.COMPATIBILITY_FLAGS.doNotRunHooksOnSystemRoutes)return l;let p=new Nn(n,l);o.dispatchEvent(p);let m=i.latestRequest,f;try{f=await p.mutableResponse}catch(g){return It(n,o,"Error retrieving mutableResponse",g)}try{f=await i.onResponseSending(f,m,o)}catch(g){return It(n,o,"Error invoking 'context.onResponseSending' hook",g)}try{f=await rh(f,m,o)}catch(g){return It(n,o,"Error invoking 'context.onResponseSending' hook",g)}o.dispatchEvent(new Ln(n,f));try{await i.onResponseSendingFinal(l,m,o)}catch(g){throw o.log.error("Error invoking 'runtime.onResponseSending' hook",g),g}try{await nh(l,m,o)}catch(g){throw o.log.error("Error invoking 'runtime.onResponseSending' hook",g),g}return f},"#toZuploPipeline")};function IR(t){return t instanceof Response?t:typeof t>"u"?new Response:new Response(Xa(t),{headers:{"content-type":"application/json"}})}s(IR,"resultToResponse");var St=class extends Vt{static{s(this,"MetricsPlugin")}};var W=class t{static{s(this,"SystemLogMap")}static#e=new WeakMap;static getLogger(e){let r=t.#e.get(e);if(!r){let n=`No system logger found for context with requestId '${e.requestId}'`;throw j.console.error(n),new le(n)}return r}static addLogger(e,r){t.#e.set(e,r)}};var ce=class{static{s(this,"BatchDispatch")}constructor(e,r,n,o){this.#t=e,this.#i=r,this.#r=n,this.#n=o??j.console}#e=void 0;#t;#n;#r;#o=[];#i;enqueue=s(e=>{this.#o.push(e),this.#e||(this.#e=new Promise(r=>{setTimeout(()=>{if(this.#o.length>0){let n=[...this.#o];this.#o.length=0,this.#e=void 0,this.#r(n).catch(o=>{this.#n.error(`Uncaught error in BatchDispatcher named '${this.#t}'}`,o.message,o.stack)}).finally(()=>{r()})}},this.#i)}))},"enqueue");waitUntilFlushed=s(async()=>{if(this.#e)return this.#e},"waitUntilFlushed");get queueSize(){return this.#o.length}};async function Ee(t,e,r){for(let n=0;n<=t.retries;n++){try{let o=j.fetch(e,r);if(n===t.retries)return o;let i=await o;if(i.status<500&&i.status!==429)return i;t.logger?.error("Request failed, retrying",{method:typeof e=="string"?"GET":e.method,url:typeof e=="string"?e:e.url,status:i.status})}catch(o){if(n===t.retries)throw o;t.logger?.error("Request failed, retrying",{method:typeof e=="string"?"GET":e.method,url:typeof e=="string"?e:e.url,error:o})}await new Promise(o=>setTimeout(o,t.retryDelayMs*2**n))}throw new x("An unknown error occurred, ensure retries is not negative")}s(Ee,"fetchRetry");var vi=class{static{s(this,"ZuploMetricsTransport")}#e;#t;constructor(e){this.#e=e,this.#t=new ce("zuplo-metrics-transport",10,this.dispatchFunction,W.getLogger(e))}pushMetrics(e,r){this.#t.enqueue(e),r.waitUntil(this.#t.waitUntilFlushed())}dispatchFunction=s(async e=>{if(e.length!==0)try{let{remoteLogURL:r,deploymentName:n}=P.instance,{ACCOUNT_NAME:o,PROJECT_NAME:i}=P.instance.build,a=e.map(p=>{let m=Object.assign({},p);return delete m.requestContentLength,delete m.responseContentLength,m}),c=qg(),u={metadata:{timestamp:new Date,accountName:o,projectName:i,deploymentName:n},metrics:a,features:c},l=new Headers({"content-type":"application/json"});qe(l);let d=await Ee({retries:3,retryDelayMs:1e3,logger:j.console},`${r}/v2/runtime/metrics`,{method:"POST",body:JSON.stringify(u),headers:l});if(!d.ok){let p=await d.text();W.getLogger(this.#e).error(`Metrics POST responded ${d.status}: ${d.statusText}`,p),Fg(c)}}catch(r){W.getLogger(this.#e).error("Failed to send Zuplo metrics.",r)}},"dispatchFunction")};var jr="SYSTEM_IGNORED";var je=class{static{s(this,"SystemRouteConfiguration")}constructor({label:e,path:r,methods:n,systemRouteName:o,corsPolicy:i="none"}){this.label=e,this.path=r,this.methods=n,this.corsPolicy=i,this.handler={export:jr,module:jr},this.systemRouteName=o}label;path;methods;handler;corsPolicy;policies;systemRouteName;metadata;raw(){return{}}};var Ya="x-real-ip",SR="true-client-ip",kR="cf-connecting-ip",TR="x-forwarded-for";function dt(t){let e=t.headers,r=e.get(Ya)??e.get(SR)??e.get(kR);if(r)return r;let n=e.get(TR);if(n){let o=n.split(/,\s*/).map(i=>i.trim()).find(i=>i.length>0);if(o)return o}}s(dt,"getClientIp");var Ge=s(async(t,e,r)=>{let n=new Date,o=Date.now(),i=await r(t),a=t.headers.get(Lr)??void 0,c=dt(t),u=e.incomingRequestProperties,l;e.route instanceof je&&(l=e.route.systemRouteName);let d=Be.getContextExtensions(e).latestRequest,p={timestamp:n,statusCode:i.status,durationMs:Date.now()-o,requestContentLength:t.headers.get("content-length")?Number(t.headers.get("content-length")):void 0,responseContentLength:i.headers.get("content-length")?Number(i.headers.get("content-length")):void 0,routePath:e.route?.path??"SYSTEM_OR_NOT_FOUND",systemRouteName:l,contextId:e.contextId,parentContextId:e.parentContext?.contextId,requestId:e.requestId,parentRequestId:e.parentContext?.requestId,method:t.method,asn:u.asn,asOrganization:u.asOrganization,colo:u.colo,continent:u.continent,country:u.country,city:u.city,latitude:u.latitude,longitude:u.longitude,rayId:a,instanceId:P.instance.instanceId,userSub:d.user?.sub,clientIp:c},m=[];return!P.instance.isLocalDevelopment&&P.instance.remoteLogURL&&P.instance.remoteLogToken&&P.instance.loggingId&&m.push(new vi(e)),wt.forEach(f=>{if(f instanceof St){let g=f.getTransport();m.push(g)}}),m.forEach(f=>{f.pushMetrics(p,e)}),i},"metricsProcessor");var ec=s(t=>{let e=s(async(o,i)=>{let a=new URL(o.url),c=P.instance.build,u={buildId:c.BUILD_ID,zuploVersion:c.ZUPLO_VERSION,compatibilityDate:c.COMPATIBILITY_DATE,apiVersion:c.API_VERSION,gitSha:c.GIT_SHA,timestamp:c.TIMESTAMP,isProduction:c.ENVIRONMENT_TYPE==="PRODUCTION"};if(a.searchParams.get("system_log")==="true"&&W.getLogger(i).error("Test System Log",u),a.searchParams.get("error")==="true")throw new Error("this is an unhandled error");return new Response(JSON.stringify(u,null,2),{status:200,headers:{"content-type":"application/json"}})},"buildRouteHandler"),r=new Ue({processors:[Ge],handler:e}),n=new je({label:"SYSTEM_BUILD_ROUTE",methods:["GET"],path:"/__zuplo/build",systemRouteName:"build-data"});t.addRoute(n,r.execute)},"registerBuildRoute");var xi=class{static{s(this,"BoundedSet")}limit;items;constructor(e){this.limit=e,this.items=new Map}add(e){if(this.items.has(e))this.items.delete(e);else if(this.items.size>=this.limit){let r=this.items.keys().next().value;r&&this.items.delete(r)}this.items.set(e,!0)}has(e){return this.items.has(e)}values(){return Array.from(this.items.keys())}size(){return this.items.size}};var sh=new Map;function kt(t){if(Array.isArray(t)&&!t.some(o=>typeof o!="number"))return t;if(typeof t!="string")throw new Error("Input must be a string or an array of numbers");if(!/^\d+(?:-\d+)?(?:,\s*\d+(?:-\d+)?)*$/.test(t))throw new x("Malformed input string");let e=sh.get(t);if(e)return e;let r=t.split(","),n=[];for(let o of r){let i=o.split("-");if(i.length===2){let a=parseInt(i[0],10),c=parseInt(i[1],10);for(let u=a;u<=c;u++)n.push(u)}else n.push(parseInt(o,10))}return sh.set(t,n),n}s(kt,"statusCodesStringToNumberArray");function Mt(t,e,r){if(!e.startsWith("."))throw new x(`Invalid ${r} - must start with '.' - '${e}' does not`);let n=e.split(".").splice(1),o=t;return n.forEach(i=>{if(o===void 0)throw new F(`Error applying ${r} '${e}', reading '${i}'`);o=o[i]}),`${o}`}s(Mt,"getValueFromRequestUser");function ah(t,e){if(!e.startsWith("."))throw new x(`Invalid selector. must start with '.' - '${e}' does not`);let r=e.split(".").splice(1),n=t;return r.forEach(o=>{if(n===void 0)throw new F(`Error applying'${e}', reading '${o}'`);if(n&&typeof n=="object")n=Reflect.get(n,o);else throw new F(`Error applying'${e}', reading '${o}'`)}),`${n}`}s(ah,"selectPropertyUsingJsonPath");function Dt(t){if(Array.isArray(t)){if(t.includes(r=>typeof r!="string"))throw new x("Received an array that contains non-string values.");return t}if(rt(t))return t.includes(",")?t.split(",").map(r=>r.trim()).filter(r=>r!==","&&r!==""):[t];throw new x(`Expected type of string, received type '${typeof t}'`)}s(Dt,"parseValueToStringArray");function ch(t){if(t==null)return[];if(!Array.isArray(t))throw new x(`Invalid corsPolicy configuration. Expected an array of objects, received '${typeof t}'`);return t.map(r=>{if(!gr(r))throw new x(`Invalid custom cors policy is set. Expected an object, received '${typeof r}'`);if(!Dr(r.name))throw new x("Value of 'name' on custom cors policies must be a non-empty string.");if(r.maxAge!==void 0&&!qa(r.maxAge))throw new x(`Value of 'maxAge' on custom cors policies must be a non-empty string. Received type '${typeof r.maxAge}'`);if(r.allowCredentials!==void 0&&!Fa(r.allowCredentials))throw new x("Value of 'allowCredentials' on custom cors policies must be a boolean or not be set. If using an environment variable, check that it is set correctly.");let n=tc(r,"allowedHeaders"),o=tc(r,"allowedMethods"),i=tc(r,"exposeHeaders"),a;try{a=Dt(r.allowedOrigins)}catch(u){throw new x(`Value of 'allowedOrigins' on custom cors policies is invalid. ${u.message} If using an environment variable, check that it is set correctly.`)}return{name:r.name,allowCredentials:typeof r.allowCredentials=="boolean"?String(r.allowCredentials):void 0,allowedOrigins:a,allowedHeaders:n?n.join(", "):void 0,allowedMethods:o?o.join(", "):void 0,exposeHeaders:i?i.join(", "):void 0,maxAge:typeof r.maxAge=="number"?r.maxAge.toString():void 0}})}s(ch,"parseCorsPolicies");function tc(t,e){let r;if(t[e]!==void 0)try{r=Dt(t[e])}catch(n){throw new x(`Value of '${e}' on custom cors policies is invalid. ${n.message} If using an environment variable, check that it is set correctly.`)}return r}s(tc,"parseOptionalProperty");var rc=new Map,ER=s((t,e,r)=>{for(let n of t){let o=n.trim().toLowerCase();if(o==="*")return e;if(o.includes("*.")){let a=o.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*\\\./g,"[^.]+\\.");if(new RegExp(`^${a}$`).test(r))return e}else{let i=o.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*");if(new RegExp(`^${i}$`).test(r))return e}}},"testMatchinOrigin"),Ri=s((t,e,r)=>{if(r===null)return;let n=r.trim().toLowerCase(),o=rc.get(t);if(o?.has(n))return r;let i=ER(e,r,n);return i&&(o||rc.set(t,new xi(20)),rc.get(t)?.add(n)),i},"findMatchingOrigin"),Pi=s((t,e)=>{let r={"access-control-allow-origin":e};t.allowedHeaders&&(r["access-control-allow-headers"]=t.allowedHeaders),t.allowedMethods&&(r["access-control-allow-methods"]=t.allowedMethods),t.exposeHeaders&&(r["access-control-expose-headers"]=t.exposeHeaders);let n=t.allowCredentials;n&&(r["access-control-allow-credentials"]=n);let o=t.maxAge?.toString()??void 0;return o&&(r["access-control-max-age"]=o),r},"generateCorsHeaders"),Ii=s((t,e)=>{if(!t)return!1;let{developerPortal:r}=e;return r.enabled&&r.type==="zudoku"&&r.urls?r.urls.urls.includes(t):!1},"isDevPortalOrigin");var nc=s((t,e,r)=>{let n=s(async(a,c)=>{let u=new URL(a.url.toString()).pathname,l=a.headers.get("access-control-request-method"),d=a.headers.get("access-control-request-headers"),p=a.headers.get("origin");if(p===null||l===null)return D.badRequest(a,c,{detail:"Expect headers origin and access-control-request-method"});if(Ii(p,e)){let b={"access-control-allow-origin":p,"access-control-allow-methods":l,"access-control-allow-headers":d??"*","access-control-expose-headers":"*","access-control-allow-credentials":"true","access-control-max-age":"600"};return new Response(void 0,{status:200,statusText:"OK",headers:b})}let m=t.lookup(u,l);if(!m)return D.notFound(a,c);let f=m.routeConfiguration,g=_R({requestedMethod:l,requestedHeaders:d,requestedOrigin:p,routeConfig:f,customPolicies:r});return g.isValid?new Response(void 0,{status:200,statusText:"OK",headers:g.headers}):(g.error&&c.log.warn(g.error),D.notFound(a,c))},"optionsHandler"),o=new Ue({processors:[Ge],handler:n}),i=new je({label:"SYSTEM_CORS_ROUTE",methods:["OPTIONS"],path:"/(.*)",systemRouteName:"cors-preflight"});t.addRoute(i,o.execute)},"registerCorsRoute"),_R=s(({requestedMethod:t,requestedHeaders:e,requestedOrigin:r,routeConfig:n,customPolicies:o})=>{let i={isValid:!1,headers:{}};if(n.corsPolicy==="anything-goes")return{isValid:!0,headers:{"access-control-allow-origin":r,"access-control-allow-methods":t,"access-control-allow-headers":e??"*","access-control-expose-headers":"*","access-control-allow-credentials":"true","access-control-max-age":"600"}};if(n.corsPolicy==="none")return{...i,error:`No CORS policy set for the route '${n.pathPattern}'`};let a=o?.find(l=>l.name===n.corsPolicy);if(!a)throw new x(`Invalid Configuration - corsPolicy '${n.corsPolicy}' not found in *.oas.json 'corsPolicies' section.`);let c=Ri(a.name,a.allowedOrigins,r);return c?{isValid:!0,headers:Pi(a,c)}:{...i,error:`The CORS policy '${a.name}' does not allow the origin '${r}'`}},"validateAndBuildResponseHeaders");var uh=s(t=>{let e=s(async()=>new Response("You have no routes. Add a route in routes.oas.json to get started",{status:200}),"noRoutesHandler"),r=new Ue({processors:[Ge],handler:e}),n=new je({label:"SYSTEM_NO_ROUTES",methods:["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"],path:"/(.*)",systemRouteName:"empty-gateway-catchall"});t.addRoute(n,r.execute)},"registerNoRoutes");var Jt=class{static{s(this,"UserRouteConfiguration")}constructor(e){this.path=e.path,this.methods=e.methods,this.label=e.label,this.key=e.key,this.handler=e.handler,this.corsPolicy=e.corsPolicy,this.custom=e.custom,this.mcp=e.mcp,this.policies=e.policies,this.excludeFromOpenApi=e.excludeFromOpenApi,this.pathPattern=e.pathPattern,this.metadata=e.metadata,this.raw=e.raw}raw;get summary(){return this.raw()?.summary}get operationId(){return this.raw()?.operationId}get tags(){return this.raw()?.tags}get parameters(){return this.raw()?.parameters}get responses(){return this.raw()?.responses}label;key;path;excludeFromOpenApi;pathPattern;metadata;custom;mcp;methods;handler;corsPolicy;policies};var CR=new je({label:"SYSTEM_NOT_FOUND_ROUTE",methods:["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"],path:"/(.*)",systemRouteName:"unmatched-path"}),lh=s(t=>{let e=s(async(n,o)=>{let i=Ka.value?.notFoundHandler;if(i){let l=new URL(n.url);return i(n,o,{get routesMatchedByPathOnly(){return t.lookupByPathOnly(l.pathname).map(p=>p.routeConfiguration).filter(p=>p instanceof Jt)}})}let a=new URL(n.url);return t.lookupByPathOnly(a.pathname).filter(l=>l.routeConfiguration.handler?.export==="mcpServerHandler").length>0&&n.method!=="POST"?D.methodNotAllowed(n,o):D.notFound(n,o)},"notFoundHandler"),r=new Ue({processors:[Ge],handler:e});t.addRoute(CR,r.execute)},"registerNotMatchedHandler");var OR=["access-control-allow-origin","access-control-allow-headers","access-control-expose-headers","access-control-allow-credentials","access-control-max-age"],dh=s(t=>{OR.forEach(e=>t.delete(e))},"stripCorsHeaders"),zr=s(async(t,e,r)=>{let n=await r(t);if(P.instance.isDeno&&n.status===101&&[...n.headers.keys()].length===0&&!n.body)return n;let o=e.route,i=t.headers.get("origin"),a=Ii(i,Re.instance.runtimeSettings);if((!o.corsPolicy||o.corsPolicy==="none")&&!a){let p=new Headers(n.headers);return dh(p),new Response(n.body,{status:n.status,statusText:n.statusText,headers:p,webSocket:n.webSocket})}if(!(n instanceof Response))throw new le(`The CorsProcessor is in the wrong place in the pipeline. It should only receive HttpResponse type but got '${typeof n}'`);let c=$R(o,Re.instance.routeData.corsPolicies,a),u=AR(i,c),l=new Headers(n.headers);return dh(l),Object.entries(u).forEach(([p,m])=>{l.set(p,m)}),new Response(n.body,{status:n.status,statusText:n.statusText,headers:l,webSocket:n.webSocket})},"corsProcessor"),$R=s((t,e,r)=>{if(t.corsPolicy==="anything-goes")return{name:"anything-goes",allowedHeaders:"*",allowedOrigins:["*"],allowedMethods:t.methods.join(", "),exposeHeaders:"*",allowCredentials:"true",maxAge:"600"};if(r)return{name:"dev-portal-anything-goes",allowedHeaders:"*",allowedOrigins:["*"],allowedMethods:t.methods.join(", "),exposeHeaders:"*",allowCredentials:"true",maxAge:"600"};let n=e?.find(o=>o.name===t.corsPolicy);if(n===void 0)throw new x(`Invalid Configuration - no corsPolicy '${t.corsPolicy}' found in *.oas.json`);return n},"getCorsPolicy"),AR=s((t,e)=>{let r=Ri(e.name,e.allowedOrigins,t);return r?Pi(e,r):{}},"getCorsHeaders");var oc=s(t=>{let e=s(async()=>new Response(JSON.stringify({buildId:P.instance.build.BUILD_ID}),{status:200,headers:{"content-type":"application/json"}}),"pingRouteHandler"),r=new Ue({processors:[zr],handler:e}),n=new je({corsPolicy:"anything-goes",label:"SYSTEM_PING_ROUTE",methods:["GET"],path:"/__zuplo/ping",systemRouteName:"ping"});t.addRoute(n,r.execute)},"registerPingRoute");import{SpanStatusCode as ph,trace as mh}from"@opentelemetry/api";var Ut={RoutePathPattern:"zuplo.route.path_pattern",RouteOperationId:"zuplo.route.operation_id",RouteTrace:"zuplo.route.trace",RouteSystem:"zuplo.route.system",SystemTrace:"zuplo.system",PolicyName:"zuplo.policy.name",PolicyType:"zuplo.policy.type",ZuploBuildId:"zuplo.build.id",ZuploBuildVersion:"zuplo.build.version",ZuploBuildCompatibilityDate:"zuplo.build.compatibility_date",ZuploEnvironmentType:"zuplo.environment_type"};var Si=class{static{s(this,"PolicyBase")}options;policyName;policyType;constructor(e,r){if(!rt(r))throw new F(`The name of a policy must be a string. Received '${r}' of type '${typeof r}'`);this.options=e,this.policyName=r,this.policyType=Object.getPrototypeOf(this).constructor.name}},Pe=class extends Si{static{s(this,"InboundPolicy")}},Wt=class extends Si{static{s(this,"OutboundPolicy")}};var ac=class extends Pe{static{s(this,"InboundFunctionOnlyPolicy")}#e;constructor(e,r,n){super(r,n),this.policyType=e.name,this.#e=e}handler(e,r){return this.#e(e,r,this.options,this.policyName)}},cc=class extends Wt{static{s(this,"OutboundFunctionOnlyPolicy")}#e;constructor(e,r,n){super(r,n),this.policyType=e.name,this.#e=e}handler(e,r,n){return this.#e(e,r,n,this.options,this.policyName)}},ic=new Map;function Mn(t,e){let r,n;return Array.isArray(t)?r=t:(r=t.policies?.inbound??[],n=t.path),r.filter(i=>!ic.has(i)).forEach(i=>{let a=e?.find(l=>l.name===i);if(!a)throw new x(`Invalid state - no Policy with the name '${i}' ${n&&`on route '${n}'`} was found in the policies configuration (check case).`);if(typeof a.handler?.module!="object")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof a.handler?.module}')`);let c=a.handler?.module[a.handler.export];if(typeof c!="function")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof module '${typeof c}')`);let u;if(typeof c!="function")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof module '${typeof c}')`);if(c.prototype instanceof Pe)u=new c(a.handler.options,a.name);else if(typeof c=="function")u=new ac(c,a.handler.options,a.name);else throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof c}')`);if(typeof u.handler!="function")throw new x(`Invalid state - invalid handler on policy '${i}' on route '${n}' (typeof handler '${typeof u.handler}')`);ic.set(a.name,u)}),r.map(i=>{let a=ic.get(i);if(a===void 0)throw new F("Internal error. Policy not found in cache.");return a})}s(Mn,"getInboundPolicyInstances");var sc=new Map;function Dn(t,e){let r,n;return Array.isArray(t)?r=t:(r=t.policies?.outbound??[],n=t.path),r.filter(i=>!sc.has(i)).forEach(i=>{let a=e?.find(l=>l.name===i);if(!a)throw new x(`Invalid state - no Policy with the name '${i}' on route '${n}' was found in the policies configuration (check case).`);if(typeof a.handler?.module!="object")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof a.handler?.module}')`);let c=a.handler?.module[a.handler.export],u;if(typeof c!="function")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof module '${typeof c}')`);if(c.prototype instanceof Wt)u=new c(a.handler.options??{},a.name);else if(typeof c=="function")u=new cc(c,a.handler.options??{},a.name);else throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof c}')`);if(typeof u.handler!="function")throw new x(`Invalid state - invalid handler on policy '${i}' on route '${n}'`);sc.set(a.name,u)}),r.map(i=>{let a=sc.get(i);if(a===void 0)throw new F("Internal error. Policy not found in cache.");return a})}s(Dn,"getOutboundPolicyInstances");var uc=s(t=>async(e,r)=>{let n=Be.getContextExtensions(r),o=mh.getTracer("pipeline");return await o.startActiveSpan("policies:inbound",async i=>{try{let a=[...t],c=e;for(;a.length>0;){let u=a.shift();if(!u)return c;let l=await o.startActiveSpan(`policy:${u.policyName}`,async d=>{let p=await u.handler(c,r);if(p instanceof Request||p instanceof de||p instanceof Response){if(d.end(),p instanceof Response||p instanceof de)return p;{let m=c.user;return new de(p,{user:m})}}else{let m=new x(`Invalid state - invalid handler on policy '${u.policyName}' on route '${r.route.path}. The result of an inbound policy must be a Response or Request.`);throw d.end(),d.setStatus({code:ph.ERROR}),d.recordException(m),m}});if(l instanceof de)c=l;else if(l instanceof Request){let d=c.user;c=new de(l,{user:d})}else if(l instanceof Response)return l;n.latestRequest=c}return c}finally{i.end()}})},"toStackedInboundHandler"),lc=s(t=>async(e,r,n)=>{let o=mh.getTracer("pipeline");return await o.startActiveSpan("policies:outbound",async i=>{try{let a=[...t],c=e;for(;a.length>0;){let u=a.shift();if(!u)return c;c=await o.startActiveSpan(`policy:${u.policyName}`,async d=>{try{d.setAttribute(Ut.PolicyName,u.policyName),d.setAttribute(Ut.PolicyType,u.policyType);let p=await u.handler(c,r,n);if(p instanceof Response)return p;{let m=new x(`Invalid state - invalid handler on policy '${u.policyName}' on route '${n.route.path}. The result of an outbound policy must be a Response.`);throw d.setStatus({code:ph.ERROR}),d.recordException(m),m}}finally{d.end()}})}return c}finally{i.end()}})},"toStackedOutboundHandler"),ki=s(async(t,e,r)=>{let n=Mn(e.route,Re.instance.routeData.policies),o=Dn(e.route,Re.instance.routeData.policies);return gh({request:t,context:e,inboundPolicies:n,outboundPolicies:o,next:r})},"policyProcessor");function fh({inboundPolicies:t=[],outboundPolicies:e=[]}){return s(async(n,o,i)=>gh({request:n,context:o,inboundPolicies:t,outboundPolicies:e,next:i}),"policyProcessor")}s(fh,"createInternalPolicyProcessor");async function gh({request:t,context:e,inboundPolicies:r,outboundPolicies:n,next:o}){let i=uc(r);try{let a=await i(t,e);if(a instanceof Response)return a;let c=await o(a),u=lc(n),l;return P.instance.build.COMPATIBILITY_FLAGS.runOutboundPoliciesOnHandlerOnAllStatuses?l=u(c,t,e):l=c.ok?u(c,t,e):c,l}catch(a){return It(t,e,"Error executing policies",a)}}s(gh,"executePolicyProcessor");var wh=nR(bh(),1);function vh(t,e){try{let r=/v\d+(-\d+)?/g,o=(0,wh.parse)(e.get("Cookie")||"")["zp-dev-portal"];return o!==null&&o&&r.test(o)?`https://dev-portal-${o}.zuplo.com`:t}catch{}return t}s(vh,"devPortalBaseURL");var xh="/__zuplo/dev-portal",HR="dev-portal-id",BR="dev-portal-host",GR="zp-account",VR="zp-project",JR="dev-portal-build",WR=`
|
|
55
|
+
`)}s(Ba,"cleanStack");function It(t,e,r,n){e.log.error(r,n);let o={};if(P.instance.isLocalDevelopment||P.instance.isWorkingCopy)if(n instanceof F&&n.extensionMembers)o=n.extensionMembers;else if(n.cause){let i=hr(n.cause);"stack"in i&&(i.stack=Ba(i.stack)),o={cause:i}}else{let i=hr(n);"stack"in i&&(i.stack=Ba(i.stack)),o={cause:i}}return D.internalServerError(t,e,{detail:n.message,...o})}s(It,"errorHandler");import{SpanStatusCode as bi,trace as wi}from"@opentelemetry/api";var Qg=s(t=>(e,r)=>t(e,r),"globalRequestHandlerProxy");function Xg(t){Qg=t}s(Xg,"setTelemetryInitFunction");var Yg=s(t=>Qg(t),"proxyHandler");var Vt=class{static{s(this,"RuntimePlugin")}},Ae=class extends Vt{static{s(this,"SystemRuntimePlugin")}async initialize(e){return Promise.resolve()}registerRoutes(e){}},gi=class extends Ae{static{s(this,"MeteringPlugin")}},An=class extends Vt{static{s(this,"TelemetryPlugin")}};function hi(t){for(let e in t){let r=t[e];r&&typeof r=="object"&&hi(r)}return Object.freeze(t)}s(hi,"deepFreeze");var de=class t extends Request{static{s(this,"ZuploRequest")}#e=void 0;#t;#n;constructor(e,r,n){super(e,r);let o=r?.params;this.#n=n,o?this.#t=o:e instanceof t?this.#t=e.#t:this.#t={};let i=r?.user;i?this.user=i:e instanceof t&&(this.user=e.user)}get originalRequest(){return this.#n??null}get query(){if(this.#e===void 0){let e={},r=new URL(this.url).searchParams;for(let[n,o]of r.entries())e[n]=o;this.#e=e}return hi(this.#e)}get params(){return hi(this.#t)}user};var Ka={},wt=[],Ga=[],Va=[],Ja=[],Wa=[];var yi={addPlugin(t){wt.push(t)},addRequestHook(t){Ga.push(t)},addResponseSendingHook(t){Va.push(t)},addResponseSendingFinalHook(t){Ja.push(t)},addPreRoutingHook(t){Wa.push(t)}},th=s(async(t,e)=>{if(Ga.length===0)return t;let r=wi.getTracer("extension");return r.startActiveSpan("hook:onRequest",async n=>{try{let o=t;for(let i of Ga){let a=await r.startActiveSpan(i.name,async c=>{let u=await i(o,e);if(u instanceof de||u instanceof Response)return c.end(),u;{let l=new x(`Invalid state - the OnRequest hook must return a ZuploRequest or Response. Received ${typeof o}.`);throw c.end(),c.recordException(l),c.setStatus({code:bi.ERROR}),l}});if(a instanceof de)o=a;else return a}return o}finally{n.end()}})},"invokeOnRequestExtensions"),rh=s(async(t,e,r)=>{if(Va.length===0)return t;let n=wi.getTracer("extension");return n.startActiveSpan("hook:onResponseSending",async o=>{try{let i=t;for(let a of Va)await n.startActiveSpan(a.name,async c=>{let u=await a(t,e,r);if(u instanceof Response)i=u,c.end();else{let l=new x(`Invalid state - the OnResponseSending hook must return a Response. Received ${typeof i}.`);throw c.recordException(l),c.setStatus({code:bi.ERROR}),c.end(),l}});return i}finally{o.end()}})},"invokeOnResponseSendingExtensions"),nh=s(async(t,e,r)=>{if(Ja.length===0)return;let n=wi.getTracer("extension");return n.startActiveSpan("hook:onResponseSendingFinal",async o=>{try{for(let i of Ja)await n.startActiveSpan(i.name,async a=>{try{await i(t,e,r)}catch(c){throw a.recordException(c),a.setStatus({code:bi.ERROR}),a.end(),c}a.end()})}finally{o.end()}})},"invokeOnResponseSendingFinalExtensions"),oh=s(async t=>{if(Wa.length===0)return t;let e=wi.getTracer("extension");return e.startActiveSpan("hook:preRouting",async r=>{try{let n=t;for(let o of Wa)n=await e.startActiveSpan(o.name,async a=>{try{let c=await o(n);if(c instanceof Request)return c;{let u=new F(`Invalid state - the PreRouting hook must return a Request. Received ${typeof c}.`);throw a.recordException(u),a.setStatus({code:bi.ERROR}),u}}finally{a.end()}});return n}finally{r.end()}})},"invokePreRoutingHooks"),eh=!1;async function ih(t){if(!eh){t&&(R("runtime.extensions"),await t(yi)),Ka.value=yi;for(let e of wt)if(e instanceof An){let{requestHandlerProxy:r}=e.instrument({accountName:P.instance.build.ACCOUNT_NAME,projectName:P.instance.build.PROJECT_NAME,buildId:P.instance.build.BUILD_ID,zuploVersion:P.instance.build.ZUPLO_VERSION,compatibilityDate:P.instance.build.COMPATIBILITY_DATE,instanceId:P.instance.instanceId,environmentType:P.instance.loggingEnvironmentType,environmentStage:P.instance.loggingEnvironmentStage,deploymentName:P.instance.deploymentName});Xg(r)}await Promise.all(wt.map(async e=>{e instanceof Ae&&await e.initialize(yi)})),On.setProblemResponseFormat(yi.problemResponseFormat),eh=!0}}s(ih,"initializeRuntime");var Qa={Json:"application/json",Form:"application/x-www-form-urlencoded"};function Xa(t,e){if(t!==null)return e&&typeof t=="string"?t:typeof t=="object"&&e?.startsWith(Qa.Form)?new URLSearchParams(t).toString():typeof t=="object"&&e?.startsWith(Qa.Json)||!e?JSON.stringify(t):t}s(Xa,"serialize");function Ur(t){let{developerPortal:e}=Re.instance.runtimeSettings;return e.enabled&&e.basePath&&t.pathname.startsWith(e.basePath)||t.pathname.startsWith("/__zuplo/")||t.pathname.startsWith("/__/zuplo/")}s(Ur,"isSystemRoute");var Ue=class{static{s(this,"Pipeline")}constructor(e){this.execute=this.#t(e)}execute;#e=s(e=>async(r,n)=>PR.getTracer("pipeline").startActiveSpan(`handler:${n.route.handler.export}`,async i=>{try{return await e(r,n)}catch(a){let c=It(r,n,"Error executing request handler.",a);return i.setStatus({code:RR.ERROR}),c}finally{i.end()}}),"#errorWrappedHandler");#t=s(({processors:e,handler:r})=>async(n,o)=>{let i=Be.getContextExtensions(o),a=[...e],c=s(async g=>{let b=a.pop();if(!b){let w=await this.#e(async v=>{let S=await r(v,o);return IR(S)})(g,o);try{await i.onHandlerResponse(w,g,o)}catch(v){return It(n,o,"Error invoking 'context.onHandlerResponse' hook",v)}return w}return b(n,o,c)},"nextPipe"),l=await c(n),d=new URL(n.url);if(Ur(d)&&P.instance.build.COMPATIBILITY_FLAGS.doNotRunHooksOnSystemRoutes)return l;let p=new Nn(n,l);o.dispatchEvent(p);let m=i.latestRequest,f;try{f=await p.mutableResponse}catch(g){return It(n,o,"Error retrieving mutableResponse",g)}try{f=await i.onResponseSending(f,m,o)}catch(g){return It(n,o,"Error invoking 'context.onResponseSending' hook",g)}try{f=await rh(f,m,o)}catch(g){return It(n,o,"Error invoking 'context.onResponseSending' hook",g)}o.dispatchEvent(new Ln(n,f));try{await i.onResponseSendingFinal(l,m,o)}catch(g){throw o.log.error("Error invoking 'runtime.onResponseSending' hook",g),g}try{await nh(l,m,o)}catch(g){throw o.log.error("Error invoking 'runtime.onResponseSending' hook",g),g}return f},"#toZuploPipeline")};function IR(t){return t instanceof Response?t:typeof t>"u"?new Response:new Response(Xa(t),{headers:{"content-type":"application/json"}})}s(IR,"resultToResponse");var St=class extends Vt{static{s(this,"MetricsPlugin")}};var W=class t{static{s(this,"SystemLogMap")}static#e=new WeakMap;static getLogger(e){let r=t.#e.get(e);if(!r){let n=`No system logger found for context with requestId '${e.requestId}'`;throw j.console.error(n),new le(n)}return r}static addLogger(e,r){t.#e.set(e,r)}};var ce=class{static{s(this,"BatchDispatch")}constructor(e,r,n,o){this.#t=e,this.#i=r,this.#r=n,this.#n=o??j.console}#e=void 0;#t;#n;#r;#o=[];#i;enqueue=s(e=>{this.#o.push(e),this.#e||(this.#e=new Promise(r=>{setTimeout(()=>{if(this.#o.length>0){let n=[...this.#o];this.#o.length=0,this.#e=void 0,this.#r(n).catch(o=>{this.#n.error(`Uncaught error in BatchDispatcher named '${this.#t}'}`,o.message,o.stack)}).finally(()=>{r()})}},this.#i)}))},"enqueue");waitUntilFlushed=s(async()=>{if(this.#e)return this.#e},"waitUntilFlushed");get queueSize(){return this.#o.length}};async function Ee(t,e,r){for(let n=0;n<=t.retries;n++){try{let o=j.fetch(e,r);if(n===t.retries)return o;let i=await o;if(i.status<500&&i.status!==429)return i;i.body&&await i.body.cancel(),t.logger?.error("Request failed, retrying",{method:typeof e=="string"?"GET":e.method,url:typeof e=="string"?e:e.url,status:i.status})}catch(o){if(n===t.retries)throw o;t.logger?.error("Request failed, retrying",{method:typeof e=="string"?"GET":e.method,url:typeof e=="string"?e:e.url,error:o})}await new Promise(o=>setTimeout(o,t.retryDelayMs*2**n))}throw new x("An unknown error occurred, ensure retries is not negative")}s(Ee,"fetchRetry");var vi=class{static{s(this,"ZuploMetricsTransport")}#e;#t;constructor(e){this.#e=e,this.#t=new ce("zuplo-metrics-transport",10,this.dispatchFunction,W.getLogger(e))}pushMetrics(e,r){this.#t.enqueue(e),r.waitUntil(this.#t.waitUntilFlushed())}dispatchFunction=s(async e=>{if(e.length!==0)try{let{remoteLogURL:r,deploymentName:n}=P.instance,{ACCOUNT_NAME:o,PROJECT_NAME:i}=P.instance.build,a=e.map(p=>{let m=Object.assign({},p);return delete m.requestContentLength,delete m.responseContentLength,m}),c=qg(),u={metadata:{timestamp:new Date,accountName:o,projectName:i,deploymentName:n},metrics:a,features:c},l=new Headers({"content-type":"application/json"});qe(l);let d=await Ee({retries:3,retryDelayMs:1e3,logger:j.console},`${r}/v2/runtime/metrics`,{method:"POST",body:JSON.stringify(u),headers:l});if(!d.ok){let p=await d.text();W.getLogger(this.#e).error(`Metrics POST responded ${d.status}: ${d.statusText}`,p),Fg(c)}}catch(r){W.getLogger(this.#e).error("Failed to send Zuplo metrics.",r)}},"dispatchFunction")};var jr="SYSTEM_IGNORED";var je=class{static{s(this,"SystemRouteConfiguration")}constructor({label:e,path:r,methods:n,systemRouteName:o,corsPolicy:i="none"}){this.label=e,this.path=r,this.methods=n,this.corsPolicy=i,this.handler={export:jr,module:jr},this.systemRouteName=o}label;path;methods;handler;corsPolicy;policies;systemRouteName;metadata;raw(){return{}}};var Ya="x-real-ip",SR="true-client-ip",kR="cf-connecting-ip",TR="x-forwarded-for";function dt(t){let e=t.headers,r=e.get(Ya)??e.get(SR)??e.get(kR);if(r)return r;let n=e.get(TR);if(n){let o=n.split(/,\s*/).map(i=>i.trim()).find(i=>i.length>0);if(o)return o}}s(dt,"getClientIp");var Ge=s(async(t,e,r)=>{let n=new Date,o=Date.now(),i=await r(t),a=t.headers.get(Lr)??void 0,c=dt(t),u=e.incomingRequestProperties,l;e.route instanceof je&&(l=e.route.systemRouteName);let d=Be.getContextExtensions(e).latestRequest,p={timestamp:n,statusCode:i.status,durationMs:Date.now()-o,requestContentLength:t.headers.get("content-length")?Number(t.headers.get("content-length")):void 0,responseContentLength:i.headers.get("content-length")?Number(i.headers.get("content-length")):void 0,routePath:e.route?.path??"SYSTEM_OR_NOT_FOUND",systemRouteName:l,contextId:e.contextId,parentContextId:e.parentContext?.contextId,requestId:e.requestId,parentRequestId:e.parentContext?.requestId,method:t.method,asn:u.asn,asOrganization:u.asOrganization,colo:u.colo,continent:u.continent,country:u.country,city:u.city,latitude:u.latitude,longitude:u.longitude,rayId:a,instanceId:P.instance.instanceId,userSub:d.user?.sub,clientIp:c},m=[];return!P.instance.isLocalDevelopment&&P.instance.remoteLogURL&&P.instance.remoteLogToken&&P.instance.loggingId&&m.push(new vi(e)),wt.forEach(f=>{if(f instanceof St){let g=f.getTransport();m.push(g)}}),m.forEach(f=>{f.pushMetrics(p,e)}),i},"metricsProcessor");var ec=s(t=>{let e=s(async(o,i)=>{let a=new URL(o.url),c=P.instance.build,u={buildId:c.BUILD_ID,zuploVersion:c.ZUPLO_VERSION,compatibilityDate:c.COMPATIBILITY_DATE,apiVersion:c.API_VERSION,gitSha:c.GIT_SHA,timestamp:c.TIMESTAMP,isProduction:c.ENVIRONMENT_TYPE==="PRODUCTION"};if(a.searchParams.get("system_log")==="true"&&W.getLogger(i).error("Test System Log",u),a.searchParams.get("error")==="true")throw new Error("this is an unhandled error");return new Response(JSON.stringify(u,null,2),{status:200,headers:{"content-type":"application/json"}})},"buildRouteHandler"),r=new Ue({processors:[Ge],handler:e}),n=new je({label:"SYSTEM_BUILD_ROUTE",methods:["GET"],path:"/__zuplo/build",systemRouteName:"build-data"});t.addRoute(n,r.execute)},"registerBuildRoute");var xi=class{static{s(this,"BoundedSet")}limit;items;constructor(e){this.limit=e,this.items=new Map}add(e){if(this.items.has(e))this.items.delete(e);else if(this.items.size>=this.limit){let r=this.items.keys().next().value;r&&this.items.delete(r)}this.items.set(e,!0)}has(e){return this.items.has(e)}values(){return Array.from(this.items.keys())}size(){return this.items.size}};var sh=new Map;function kt(t){if(Array.isArray(t)&&!t.some(o=>typeof o!="number"))return t;if(typeof t!="string")throw new Error("Input must be a string or an array of numbers");if(!/^\d+(?:-\d+)?(?:,\s*\d+(?:-\d+)?)*$/.test(t))throw new x("Malformed input string");let e=sh.get(t);if(e)return e;let r=t.split(","),n=[];for(let o of r){let i=o.split("-");if(i.length===2){let a=parseInt(i[0],10),c=parseInt(i[1],10);for(let u=a;u<=c;u++)n.push(u)}else n.push(parseInt(o,10))}return sh.set(t,n),n}s(kt,"statusCodesStringToNumberArray");function Mt(t,e,r){if(!e.startsWith("."))throw new x(`Invalid ${r} - must start with '.' - '${e}' does not`);let n=e.split(".").splice(1),o=t;return n.forEach(i=>{if(o===void 0)throw new F(`Error applying ${r} '${e}', reading '${i}'`);o=o[i]}),`${o}`}s(Mt,"getValueFromRequestUser");function ah(t,e){if(!e.startsWith("."))throw new x(`Invalid selector. must start with '.' - '${e}' does not`);let r=e.split(".").splice(1),n=t;return r.forEach(o=>{if(n===void 0)throw new F(`Error applying'${e}', reading '${o}'`);if(n&&typeof n=="object")n=Reflect.get(n,o);else throw new F(`Error applying'${e}', reading '${o}'`)}),`${n}`}s(ah,"selectPropertyUsingJsonPath");function Dt(t){if(Array.isArray(t)){if(t.includes(r=>typeof r!="string"))throw new x("Received an array that contains non-string values.");return t}if(rt(t))return t.includes(",")?t.split(",").map(r=>r.trim()).filter(r=>r!==","&&r!==""):[t];throw new x(`Expected type of string, received type '${typeof t}'`)}s(Dt,"parseValueToStringArray");function ch(t){if(t==null)return[];if(!Array.isArray(t))throw new x(`Invalid corsPolicy configuration. Expected an array of objects, received '${typeof t}'`);return t.map(r=>{if(!gr(r))throw new x(`Invalid custom cors policy is set. Expected an object, received '${typeof r}'`);if(!Dr(r.name))throw new x("Value of 'name' on custom cors policies must be a non-empty string.");if(r.maxAge!==void 0&&!qa(r.maxAge))throw new x(`Value of 'maxAge' on custom cors policies must be a non-empty string. Received type '${typeof r.maxAge}'`);if(r.allowCredentials!==void 0&&!Fa(r.allowCredentials))throw new x("Value of 'allowCredentials' on custom cors policies must be a boolean or not be set. If using an environment variable, check that it is set correctly.");let n=tc(r,"allowedHeaders"),o=tc(r,"allowedMethods"),i=tc(r,"exposeHeaders"),a;try{a=Dt(r.allowedOrigins)}catch(u){throw new x(`Value of 'allowedOrigins' on custom cors policies is invalid. ${u.message} If using an environment variable, check that it is set correctly.`)}return{name:r.name,allowCredentials:typeof r.allowCredentials=="boolean"?String(r.allowCredentials):void 0,allowedOrigins:a,allowedHeaders:n?n.join(", "):void 0,allowedMethods:o?o.join(", "):void 0,exposeHeaders:i?i.join(", "):void 0,maxAge:typeof r.maxAge=="number"?r.maxAge.toString():void 0}})}s(ch,"parseCorsPolicies");function tc(t,e){let r;if(t[e]!==void 0)try{r=Dt(t[e])}catch(n){throw new x(`Value of '${e}' on custom cors policies is invalid. ${n.message} If using an environment variable, check that it is set correctly.`)}return r}s(tc,"parseOptionalProperty");var rc=new Map,ER=s((t,e,r)=>{for(let n of t){let o=n.trim().toLowerCase();if(o==="*")return e;if(o.includes("*.")){let a=o.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*\\\./g,"[^.]+\\.");if(new RegExp(`^${a}$`).test(r))return e}else{let i=o.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*");if(new RegExp(`^${i}$`).test(r))return e}}},"testMatchinOrigin"),Ri=s((t,e,r)=>{if(r===null)return;let n=r.trim().toLowerCase(),o=rc.get(t);if(o?.has(n))return r;let i=ER(e,r,n);return i&&(o||rc.set(t,new xi(20)),rc.get(t)?.add(n)),i},"findMatchingOrigin"),Pi=s((t,e)=>{let r={"access-control-allow-origin":e};t.allowedHeaders&&(r["access-control-allow-headers"]=t.allowedHeaders),t.allowedMethods&&(r["access-control-allow-methods"]=t.allowedMethods),t.exposeHeaders&&(r["access-control-expose-headers"]=t.exposeHeaders);let n=t.allowCredentials;n&&(r["access-control-allow-credentials"]=n);let o=t.maxAge?.toString()??void 0;return o&&(r["access-control-max-age"]=o),r},"generateCorsHeaders"),Ii=s((t,e)=>{if(!t)return!1;let{developerPortal:r}=e;return r.enabled&&r.type==="zudoku"&&r.urls?r.urls.urls.includes(t):!1},"isDevPortalOrigin");var nc=s((t,e,r)=>{let n=s(async(a,c)=>{let u=new URL(a.url.toString()).pathname,l=a.headers.get("access-control-request-method"),d=a.headers.get("access-control-request-headers"),p=a.headers.get("origin");if(p===null||l===null)return D.badRequest(a,c,{detail:"Expect headers origin and access-control-request-method"});if(Ii(p,e)){let b={"access-control-allow-origin":p,"access-control-allow-methods":l,"access-control-allow-headers":d??"*","access-control-expose-headers":"*","access-control-allow-credentials":"true","access-control-max-age":"600"};return new Response(void 0,{status:200,statusText:"OK",headers:b})}let m=t.lookup(u,l);if(!m)return D.notFound(a,c);let f=m.routeConfiguration,g=_R({requestedMethod:l,requestedHeaders:d,requestedOrigin:p,routeConfig:f,customPolicies:r});return g.isValid?new Response(void 0,{status:200,statusText:"OK",headers:g.headers}):(g.error&&c.log.warn(g.error),D.notFound(a,c))},"optionsHandler"),o=new Ue({processors:[Ge],handler:n}),i=new je({label:"SYSTEM_CORS_ROUTE",methods:["OPTIONS"],path:"/(.*)",systemRouteName:"cors-preflight"});t.addRoute(i,o.execute)},"registerCorsRoute"),_R=s(({requestedMethod:t,requestedHeaders:e,requestedOrigin:r,routeConfig:n,customPolicies:o})=>{let i={isValid:!1,headers:{}};if(n.corsPolicy==="anything-goes")return{isValid:!0,headers:{"access-control-allow-origin":r,"access-control-allow-methods":t,"access-control-allow-headers":e??"*","access-control-expose-headers":"*","access-control-allow-credentials":"true","access-control-max-age":"600"}};if(n.corsPolicy==="none")return{...i,error:`No CORS policy set for the route '${n.pathPattern}'`};let a=o?.find(l=>l.name===n.corsPolicy);if(!a)throw new x(`Invalid Configuration - corsPolicy '${n.corsPolicy}' not found in *.oas.json 'corsPolicies' section.`);let c=Ri(a.name,a.allowedOrigins,r);return c?{isValid:!0,headers:Pi(a,c)}:{...i,error:`The CORS policy '${a.name}' does not allow the origin '${r}'`}},"validateAndBuildResponseHeaders");var uh=s(t=>{let e=s(async()=>new Response("You have no routes. Add a route in routes.oas.json to get started",{status:200}),"noRoutesHandler"),r=new Ue({processors:[Ge],handler:e}),n=new je({label:"SYSTEM_NO_ROUTES",methods:["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"],path:"/(.*)",systemRouteName:"empty-gateway-catchall"});t.addRoute(n,r.execute)},"registerNoRoutes");var Jt=class{static{s(this,"UserRouteConfiguration")}constructor(e){this.path=e.path,this.methods=e.methods,this.label=e.label,this.key=e.key,this.handler=e.handler,this.corsPolicy=e.corsPolicy,this.custom=e.custom,this.mcp=e.mcp,this.policies=e.policies,this.excludeFromOpenApi=e.excludeFromOpenApi,this.pathPattern=e.pathPattern,this.metadata=e.metadata,this.raw=e.raw}raw;get summary(){return this.raw()?.summary}get operationId(){return this.raw()?.operationId}get tags(){return this.raw()?.tags}get parameters(){return this.raw()?.parameters}get responses(){return this.raw()?.responses}label;key;path;excludeFromOpenApi;pathPattern;metadata;custom;mcp;methods;handler;corsPolicy;policies};var CR=new je({label:"SYSTEM_NOT_FOUND_ROUTE",methods:["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"],path:"/(.*)",systemRouteName:"unmatched-path"}),lh=s(t=>{let e=s(async(n,o)=>{let i=Ka.value?.notFoundHandler;if(i){let l=new URL(n.url);return i(n,o,{get routesMatchedByPathOnly(){return t.lookupByPathOnly(l.pathname).map(p=>p.routeConfiguration).filter(p=>p instanceof Jt)}})}let a=new URL(n.url);return t.lookupByPathOnly(a.pathname).filter(l=>l.routeConfiguration.handler?.export==="mcpServerHandler").length>0&&n.method!=="POST"?D.methodNotAllowed(n,o):D.notFound(n,o)},"notFoundHandler"),r=new Ue({processors:[Ge],handler:e});t.addRoute(CR,r.execute)},"registerNotMatchedHandler");var OR=["access-control-allow-origin","access-control-allow-headers","access-control-expose-headers","access-control-allow-credentials","access-control-max-age"],dh=s(t=>{OR.forEach(e=>t.delete(e))},"stripCorsHeaders"),zr=s(async(t,e,r)=>{let n=await r(t);if(P.instance.isDeno&&n.status===101&&[...n.headers.keys()].length===0&&!n.body)return n;let o=e.route,i=t.headers.get("origin"),a=Ii(i,Re.instance.runtimeSettings);if((!o.corsPolicy||o.corsPolicy==="none")&&!a){let p=new Headers(n.headers);return dh(p),new Response(n.body,{status:n.status,statusText:n.statusText,headers:p,webSocket:n.webSocket})}if(!(n instanceof Response))throw new le(`The CorsProcessor is in the wrong place in the pipeline. It should only receive HttpResponse type but got '${typeof n}'`);let c=$R(o,Re.instance.routeData.corsPolicies,a),u=AR(i,c),l=new Headers(n.headers);return dh(l),Object.entries(u).forEach(([p,m])=>{l.set(p,m)}),new Response(n.body,{status:n.status,statusText:n.statusText,headers:l,webSocket:n.webSocket})},"corsProcessor"),$R=s((t,e,r)=>{if(t.corsPolicy==="anything-goes")return{name:"anything-goes",allowedHeaders:"*",allowedOrigins:["*"],allowedMethods:t.methods.join(", "),exposeHeaders:"*",allowCredentials:"true",maxAge:"600"};if(r)return{name:"dev-portal-anything-goes",allowedHeaders:"*",allowedOrigins:["*"],allowedMethods:t.methods.join(", "),exposeHeaders:"*",allowCredentials:"true",maxAge:"600"};let n=e?.find(o=>o.name===t.corsPolicy);if(n===void 0)throw new x(`Invalid Configuration - no corsPolicy '${t.corsPolicy}' found in *.oas.json`);return n},"getCorsPolicy"),AR=s((t,e)=>{let r=Ri(e.name,e.allowedOrigins,t);return r?Pi(e,r):{}},"getCorsHeaders");var oc=s(t=>{let e=s(async()=>new Response(JSON.stringify({buildId:P.instance.build.BUILD_ID}),{status:200,headers:{"content-type":"application/json"}}),"pingRouteHandler"),r=new Ue({processors:[zr],handler:e}),n=new je({corsPolicy:"anything-goes",label:"SYSTEM_PING_ROUTE",methods:["GET"],path:"/__zuplo/ping",systemRouteName:"ping"});t.addRoute(n,r.execute)},"registerPingRoute");import{SpanStatusCode as ph,trace as mh}from"@opentelemetry/api";var Ut={RoutePathPattern:"zuplo.route.path_pattern",RouteOperationId:"zuplo.route.operation_id",RouteTrace:"zuplo.route.trace",RouteSystem:"zuplo.route.system",SystemTrace:"zuplo.system",PolicyName:"zuplo.policy.name",PolicyType:"zuplo.policy.type",ZuploBuildId:"zuplo.build.id",ZuploBuildVersion:"zuplo.build.version",ZuploBuildCompatibilityDate:"zuplo.build.compatibility_date",ZuploEnvironmentType:"zuplo.environment_type"};var Si=class{static{s(this,"PolicyBase")}options;policyName;policyType;constructor(e,r){if(!rt(r))throw new F(`The name of a policy must be a string. Received '${r}' of type '${typeof r}'`);this.options=e,this.policyName=r,this.policyType=Object.getPrototypeOf(this).constructor.name}},Pe=class extends Si{static{s(this,"InboundPolicy")}},Wt=class extends Si{static{s(this,"OutboundPolicy")}};var ac=class extends Pe{static{s(this,"InboundFunctionOnlyPolicy")}#e;constructor(e,r,n){super(r,n),this.policyType=e.name,this.#e=e}handler(e,r){return this.#e(e,r,this.options,this.policyName)}},cc=class extends Wt{static{s(this,"OutboundFunctionOnlyPolicy")}#e;constructor(e,r,n){super(r,n),this.policyType=e.name,this.#e=e}handler(e,r,n){return this.#e(e,r,n,this.options,this.policyName)}},ic=new Map;function Mn(t,e){let r,n;return Array.isArray(t)?r=t:(r=t.policies?.inbound??[],n=t.path),r.filter(i=>!ic.has(i)).forEach(i=>{let a=e?.find(l=>l.name===i);if(!a)throw new x(`Invalid state - no Policy with the name '${i}' ${n&&`on route '${n}'`} was found in the policies configuration (check case).`);if(typeof a.handler?.module!="object")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof a.handler?.module}')`);let c=a.handler?.module[a.handler.export];if(typeof c!="function")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof module '${typeof c}')`);let u;if(typeof c!="function")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof module '${typeof c}')`);if(c.prototype instanceof Pe)u=new c(a.handler.options,a.name);else if(typeof c=="function")u=new ac(c,a.handler.options,a.name);else throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof c}')`);if(typeof u.handler!="function")throw new x(`Invalid state - invalid handler on policy '${i}' on route '${n}' (typeof handler '${typeof u.handler}')`);ic.set(a.name,u)}),r.map(i=>{let a=ic.get(i);if(a===void 0)throw new F("Internal error. Policy not found in cache.");return a})}s(Mn,"getInboundPolicyInstances");var sc=new Map;function Dn(t,e){let r,n;return Array.isArray(t)?r=t:(r=t.policies?.outbound??[],n=t.path),r.filter(i=>!sc.has(i)).forEach(i=>{let a=e?.find(l=>l.name===i);if(!a)throw new x(`Invalid state - no Policy with the name '${i}' on route '${n}' was found in the policies configuration (check case).`);if(typeof a.handler?.module!="object")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof a.handler?.module}')`);let c=a.handler?.module[a.handler.export],u;if(typeof c!="function")throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof module '${typeof c}')`);if(c.prototype instanceof Wt)u=new c(a.handler.options??{},a.name);else if(typeof c=="function")u=new cc(c,a.handler.options??{},a.name);else throw new x(`Invalid state - invalid policy '${i}' on route '${n}' (typeof policy '${typeof c}')`);if(typeof u.handler!="function")throw new x(`Invalid state - invalid handler on policy '${i}' on route '${n}'`);sc.set(a.name,u)}),r.map(i=>{let a=sc.get(i);if(a===void 0)throw new F("Internal error. Policy not found in cache.");return a})}s(Dn,"getOutboundPolicyInstances");var uc=s(t=>async(e,r)=>{let n=Be.getContextExtensions(r),o=mh.getTracer("pipeline");return await o.startActiveSpan("policies:inbound",async i=>{try{let a=[...t],c=e;for(;a.length>0;){let u=a.shift();if(!u)return c;let l=await o.startActiveSpan(`policy:${u.policyName}`,async d=>{let p=await u.handler(c,r);if(p instanceof Request||p instanceof de||p instanceof Response){if(d.end(),p instanceof Response||p instanceof de)return p;{let m=c.user;return new de(p,{user:m})}}else{let m=new x(`Invalid state - invalid handler on policy '${u.policyName}' on route '${r.route.path}. The result of an inbound policy must be a Response or Request.`);throw d.end(),d.setStatus({code:ph.ERROR}),d.recordException(m),m}});if(l instanceof de)c=l;else if(l instanceof Request){let d=c.user;c=new de(l,{user:d})}else if(l instanceof Response)return l;n.latestRequest=c}return c}finally{i.end()}})},"toStackedInboundHandler"),lc=s(t=>async(e,r,n)=>{let o=mh.getTracer("pipeline");return await o.startActiveSpan("policies:outbound",async i=>{try{let a=[...t],c=e;for(;a.length>0;){let u=a.shift();if(!u)return c;c=await o.startActiveSpan(`policy:${u.policyName}`,async d=>{try{d.setAttribute(Ut.PolicyName,u.policyName),d.setAttribute(Ut.PolicyType,u.policyType);let p=await u.handler(c,r,n);if(p instanceof Response)return p;{let m=new x(`Invalid state - invalid handler on policy '${u.policyName}' on route '${n.route.path}. The result of an outbound policy must be a Response.`);throw d.setStatus({code:ph.ERROR}),d.recordException(m),m}}finally{d.end()}})}return c}finally{i.end()}})},"toStackedOutboundHandler"),ki=s(async(t,e,r)=>{let n=Mn(e.route,Re.instance.routeData.policies),o=Dn(e.route,Re.instance.routeData.policies);return gh({request:t,context:e,inboundPolicies:n,outboundPolicies:o,next:r})},"policyProcessor");function fh({inboundPolicies:t=[],outboundPolicies:e=[]}){return s(async(n,o,i)=>gh({request:n,context:o,inboundPolicies:t,outboundPolicies:e,next:i}),"policyProcessor")}s(fh,"createInternalPolicyProcessor");async function gh({request:t,context:e,inboundPolicies:r,outboundPolicies:n,next:o}){let i=uc(r);try{let a=await i(t,e);if(a instanceof Response)return a;let c=await o(a),u=lc(n),l;return P.instance.build.COMPATIBILITY_FLAGS.runOutboundPoliciesOnHandlerOnAllStatuses?l=u(c,t,e):l=c.ok?u(c,t,e):c,l}catch(a){return It(t,e,"Error executing policies",a)}}s(gh,"executePolicyProcessor");var wh=nR(bh(),1);function vh(t,e){try{let r=/v\d+(-\d+)?/g,o=(0,wh.parse)(e.get("Cookie")||"")["zp-dev-portal"];return o!==null&&o&&r.test(o)?`https://dev-portal-${o}.zuplo.com`:t}catch{}return t}s(vh,"devPortalBaseURL");var xh="/__zuplo/dev-portal",HR="dev-portal-id",BR="dev-portal-host",GR="zp-account",VR="zp-project",JR="dev-portal-build",WR=`
|
|
56
56
|
<!DOCTYPE html>
|
|
57
57
|
<html lang="en">
|
|
58
58
|
<head>
|