@lightspeed/crane 3.4.5-rc.1 → 3.5.0-rc.0
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/CHANGELOG.md +3 -6
- package/dist/cli.mjs +50 -50
- package/package.json +2 -2
- package/template/page-templates/example-template/configuration.ts +50 -0
- package/template/reference/templates/reference-template-apparel/configuration.ts +50 -0
- package/template/reference/templates/reference-template-bike/configuration.ts +50 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import*as Js from"fs";import ee,{existsSync as De,readFileSync as xr,statSync as Ps,promises as Ir,writeFileSync as Pr,createReadStream as dp,mkdtempSync as fp,mkdirSync as mp,rmSync as Va}from"fs";import*as Xs from"path";import Te,{resolve as G,dirname as Ga,relative as Ha,basename as yp,sep as wr,parse as Za,join as We}from"path";import gp from"cac";import{green as et,yellow as Ep,red as Tp,gray as Sp}from"kolorist";import Jt from"prompts";import Wa from"adm-zip";import{glob as W,globSync as Ka}from"glob";import tt from"typescript";import{normalizePath as bp,build as ht,defineConfig as Qs,createServer as xp}from"vite";import"vue";import"vue/server-renderer";import*as xe from"process";import ei from"process";import{JSONPath as Ip}from"jsonpath-plus";import{readFile as Ar,writeFile as Pp}from"fs/promises";import{pathToFileURL as qa,URL as wp}from"url";import Cr,{AxiosError as Ya}from"axios";import Ap from"tinycolor2";import{ButtonTypeEnum as ti}from"@lightspeed/crane-api";import{builtinModules as Ja}from"module";import{viteExternalsPlugin as Xa}from"vite-plugin-externals";import Cp from"vite-plugin-compression";import vp from"@vitejs/plugin-vue";import Np from"vite-tsconfig-paths";import _p from"vite-plugin-checker";import{encode as Op}from"@jridgewell/sourcemap-codec";import{promisify as Qa}from"node:util";import eo from"node:zlib";import me from"node:fs";import Re from"node:path";import Se from"node:process";import Lp from"micromatch";import{fileURLToPath as kp}from"node:url";import{ConcurrencyManager as Dp}from"axios-concurrency";import{inc as Rp}from"semver";import Mp from"cli-progress";import{WebSocketServer as $p,WebSocket as Fp}from"ws";import*as Bp from"os";import{spawnSync as Up}from"child_process";const jp="3.4.5-rc.1";function w(e,s,i){function a(f,y){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:y,constr:h,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),s(f,y);const T=h.prototype,x=Object.keys(T);for(let P=0;P<x.length;P++){const L=x[P];L in f||(f[L]=T[L].bind(f))}}const c=i?.Parent??Object;class u extends c{}Object.defineProperty(u,"name",{value:e});function h(f){var y;const T=i?.Parent?new u:this;a(T,f),(y=T._zod).deferred??(y.deferred=[]);for(const x of T._zod.deferred)x();return T}return Object.defineProperty(h,"init",{value:a}),Object.defineProperty(h,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}class Xt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class to extends Error{constructor(s){super(`Encountered unidirectional transform during encode: ${s}`),this.name="ZodEncodeError"}}const vr={};function pt(e){return e&&Object.assign(vr,e),vr}function so(e){const s=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,c])=>s.indexOf(+a)===-1).map(([a,c])=>c)}function Nr(e,s){return typeof s=="bigint"?s.toString():s}function si(e){return{get value(){{const s=e();return Object.defineProperty(this,"value",{value:s}),s}}}}function _r(e){return e==null}function Or(e){const s=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(s,i)}function zp(e,s){const i=(e.toString().split(".")[1]||"").length,a=s.toString();let c=(a.split(".")[1]||"").length;if(c===0&&/\d?e-\d?/.test(a)){const y=a.match(/\d?e-(\d?)/);y?.[1]&&(c=Number.parseInt(y[1]))}const u=i>c?i:c,h=Number.parseInt(e.toFixed(u).replace(".","")),f=Number.parseInt(s.toFixed(u).replace(".",""));return h%f/10**u}const io=Symbol("evaluating");function re(e,s,i){let a;Object.defineProperty(e,s,{get(){if(a!==io)return a===void 0&&(a=io,a=i()),a},set(c){Object.defineProperty(e,s,{value:c})},configurable:!0})}function Mt(e,s,i){Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0})}function Ct(...e){const s={};for(const i of e){const a=Object.getOwnPropertyDescriptors(i);Object.assign(s,a)}return Object.defineProperties({},s)}function ro(e){return JSON.stringify(e)}function Vp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const no="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ws(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Gp=si(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Qt(e){if(ws(e)===!1)return!1;const s=e.constructor;if(s===void 0||typeof s!="function")return!0;const i=s.prototype;return!(ws(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function ao(e){return Qt(e)?{...e}:Array.isArray(e)?[...e]:e}const Hp=new Set(["string","number","symbol"]);function es(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vt(e,s,i){const a=new e._zod.constr(s??e._zod.def);return(!s||i?.parent)&&(a._zod.parent=e),a}function U(e){const s=e;if(!s)return{};if(typeof s=="string")return{error:()=>s};if(s?.message!==void 0){if(s?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");s.error=s.message}return delete s.message,typeof s.error=="string"?{...s,error:()=>s.error}:s}function Zp(e){return Object.keys(e).filter(s=>e[s]._zod.optin==="optional"&&e[s]._zod.optout==="optional")}const Wp={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Kp(e,s){const i=e._zod.def,a=i.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const u=Ct(e._zod.def,{get shape(){const h={};for(const f in s){if(!(f in i.shape))throw new Error(`Unrecognized key: "${f}"`);s[f]&&(h[f]=i.shape[f])}return Mt(this,"shape",h),h},checks:[]});return vt(e,u)}function qp(e,s){const i=e._zod.def,a=i.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const u=Ct(e._zod.def,{get shape(){const h={...e._zod.def.shape};for(const f in s){if(!(f in i.shape))throw new Error(`Unrecognized key: "${f}"`);s[f]&&delete h[f]}return Mt(this,"shape",h),h},checks:[]});return vt(e,u)}function Yp(e,s){if(!Qt(s))throw new Error("Invalid input to extend: expected a plain object");const i=e._zod.def.checks;if(i&&i.length>0){const u=e._zod.def.shape;for(const h in s)if(Object.getOwnPropertyDescriptor(u,h)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const c=Ct(e._zod.def,{get shape(){const u={...e._zod.def.shape,...s};return Mt(this,"shape",u),u}});return vt(e,c)}function Jp(e,s){if(!Qt(s))throw new Error("Invalid input to safeExtend: expected a plain object");const i=Ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...s};return Mt(this,"shape",a),a}});return vt(e,i)}function Xp(e,s){const i=Ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...s._zod.def.shape};return Mt(this,"shape",a),a},get catchall(){return s._zod.def.catchall},checks:[]});return vt(e,i)}function Qp(e,s,i){const c=s._zod.def.checks;if(c&&c.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const h=Ct(s._zod.def,{get shape(){const f=s._zod.def.shape,y={...f};if(i)for(const T in i){if(!(T in f))throw new Error(`Unrecognized key: "${T}"`);i[T]&&(y[T]=e?new e({type:"optional",innerType:f[T]}):f[T])}else for(const T in f)y[T]=e?new e({type:"optional",innerType:f[T]}):f[T];return Mt(this,"shape",y),y},checks:[]});return vt(s,h)}function ed(e,s,i){const a=Ct(s._zod.def,{get shape(){const c=s._zod.def.shape,u={...c};if(i)for(const h in i){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);i[h]&&(u[h]=new e({type:"nonoptional",innerType:c[h]}))}else for(const h in c)u[h]=new e({type:"nonoptional",innerType:c[h]});return Mt(this,"shape",u),u}});return vt(s,a)}function ts(e,s=0){if(e.aborted===!0)return!0;for(let i=s;i<e.issues.length;i++)if(e.issues[i]?.continue!==!0)return!0;return!1}function ss(e,s){return s.map(i=>{var a;return(a=i).path??(a.path=[]),i.path.unshift(e),i})}function ii(e){return typeof e=="string"?e:e?.message}function Nt(e,s,i){const a={...e,path:e.path??[]};if(!e.message){const c=ii(e.inst?._zod.def?.error?.(e))??ii(s?.error?.(e))??ii(i.customError?.(e))??ii(i.localeError?.(e))??"Invalid input";a.message=c}return delete a.inst,delete a.continue,s?.reportInput||delete a.input,a}function Lr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function As(...e){const[s,i,a]=e;return typeof s=="string"?{message:s,code:"custom",input:i,inst:a}:{...s}}const oo=(e,s)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:s,enumerable:!1}),e.message=JSON.stringify(s,Nr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},co=w("$ZodError",oo),lo=w("$ZodError",oo,{Parent:Error});function td(e,s=i=>i.message){const i={},a=[];for(const c of e.issues)c.path.length>0?(i[c.path[0]]=i[c.path[0]]||[],i[c.path[0]].push(s(c))):a.push(s(c));return{formErrors:a,fieldErrors:i}}function sd(e,s=i=>i.message){const i={_errors:[]},a=c=>{for(const u of c.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(h=>a({issues:h}));else if(u.code==="invalid_key")a({issues:u.issues});else if(u.code==="invalid_element")a({issues:u.issues});else if(u.path.length===0)i._errors.push(s(u));else{let h=i,f=0;for(;f<u.path.length;){const y=u.path[f];f===u.path.length-1?(h[y]=h[y]||{_errors:[]},h[y]._errors.push(s(u))):h[y]=h[y]||{_errors:[]},h=h[y],f++}}};return a(e),i}const kr=e=>(s,i,a,c)=>{const u=a?Object.assign(a,{async:!1}):{async:!1},h=s._zod.run({value:i,issues:[]},u);if(h instanceof Promise)throw new Xt;if(h.issues.length){const f=new(c?.Err??e)(h.issues.map(y=>Nt(y,u,pt())));throw no(f,c?.callee),f}return h.value},Dr=e=>async(s,i,a,c)=>{const u=a?Object.assign(a,{async:!0}):{async:!0};let h=s._zod.run({value:i,issues:[]},u);if(h instanceof Promise&&(h=await h),h.issues.length){const f=new(c?.Err??e)(h.issues.map(y=>Nt(y,u,pt())));throw no(f,c?.callee),f}return h.value},ri=e=>(s,i,a)=>{const c=a?{...a,async:!1}:{async:!1},u=s._zod.run({value:i,issues:[]},c);if(u instanceof Promise)throw new Xt;return u.issues.length?{success:!1,error:new(e??co)(u.issues.map(h=>Nt(h,c,pt())))}:{success:!0,data:u.value}},id=ri(lo),ni=e=>async(s,i,a)=>{const c=a?Object.assign(a,{async:!0}):{async:!0};let u=s._zod.run({value:i,issues:[]},c);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(h=>Nt(h,c,pt())))}:{success:!0,data:u.value}},rd=ni(lo),nd=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return kr(e)(s,i,c)},ad=e=>(s,i,a)=>kr(e)(s,i,a),od=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Dr(e)(s,i,c)},cd=e=>async(s,i,a)=>Dr(e)(s,i,a),ld=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ri(e)(s,i,c)},ud=e=>(s,i,a)=>ri(e)(s,i,a),hd=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ni(e)(s,i,c)},pd=e=>async(s,i,a)=>ni(e)(s,i,a),dd=/^[cC][^\s-]{8,}$/,fd=/^[0-9a-z]+$/,md=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yd=/^[0-9a-vA-V]{20}$/,gd=/^[A-Za-z0-9]{27}$/,Ed=/^[a-zA-Z0-9_-]{21}$/,Td=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Sd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,uo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,bd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Id(){return new RegExp(xd,"u")}const Pd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ad=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ho=/^[A-Za-z0-9_-]*$/,Nd=/^\+[1-9]\d{6,14}$/,po="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",_d=new RegExp(`^${po}$`);function fo(e){const s="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${s}`:e.precision===0?`${s}:[0-5]\\d`:`${s}:[0-5]\\d\\.\\d{${e.precision}}`:`${s}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Od(e){return new RegExp(`^${fo(e)}$`)}function Ld(e){const s=fo({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${s}(?:${i.join("|")})`;return new RegExp(`^${po}T(?:${a})$`)}const kd=e=>{const s=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${s}$`)},Dd=/^-?\d+$/,mo=/^-?\d+(?:\.\d+)?$/,Rd=/^(?:true|false)$/i,Md=/^[^A-Z]*$/,$d=/^[^a-z]*$/,Fe=w("$ZodCheck",(e,s)=>{var i;e._zod??(e._zod={}),e._zod.def=s,(i=e._zod).onattach??(i.onattach=[])}),yo={number:"number",bigint:"bigint",object:"date"},go=w("$ZodCheckLessThan",(e,s)=>{Fe.init(e,s);const i=yo[typeof s.value];e._zod.onattach.push(a=>{const c=a._zod.bag,u=(s.inclusive?c.maximum:c.exclusiveMaximum)??Number.POSITIVE_INFINITY;s.value<u&&(s.inclusive?c.maximum=s.value:c.exclusiveMaximum=s.value)}),e._zod.check=a=>{(s.inclusive?a.value<=s.value:a.value<s.value)||a.issues.push({origin:i,code:"too_big",maximum:typeof s.value=="object"?s.value.getTime():s.value,input:a.value,inclusive:s.inclusive,inst:e,continue:!s.abort})}}),Eo=w("$ZodCheckGreaterThan",(e,s)=>{Fe.init(e,s);const i=yo[typeof s.value];e._zod.onattach.push(a=>{const c=a._zod.bag,u=(s.inclusive?c.minimum:c.exclusiveMinimum)??Number.NEGATIVE_INFINITY;s.value>u&&(s.inclusive?c.minimum=s.value:c.exclusiveMinimum=s.value)}),e._zod.check=a=>{(s.inclusive?a.value>=s.value:a.value>s.value)||a.issues.push({origin:i,code:"too_small",minimum:typeof s.value=="object"?s.value.getTime():s.value,input:a.value,inclusive:s.inclusive,inst:e,continue:!s.abort})}}),Fd=w("$ZodCheckMultipleOf",(e,s)=>{Fe.init(e,s),e._zod.onattach.push(i=>{var a;(a=i._zod.bag).multipleOf??(a.multipleOf=s.value)}),e._zod.check=i=>{if(typeof i.value!=typeof s.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?i.value%s.value===BigInt(0):zp(i.value,s.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:s.value,input:i.value,inst:e,continue:!s.abort})}}),Bd=w("$ZodCheckNumberFormat",(e,s)=>{Fe.init(e,s),s.format=s.format||"float64";const i=s.format?.includes("int"),a=i?"int":"number",[c,u]=Wp[s.format];e._zod.onattach.push(h=>{const f=h._zod.bag;f.format=s.format,f.minimum=c,f.maximum=u,i&&(f.pattern=Dd)}),e._zod.check=h=>{const f=h.value;if(i){if(!Number.isInteger(f)){h.issues.push({expected:a,format:s.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?h.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!s.abort}):h.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!s.abort});return}}f<c&&h.issues.push({origin:"number",input:f,code:"too_small",minimum:c,inclusive:!0,inst:e,continue:!s.abort}),f>u&&h.issues.push({origin:"number",input:f,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!s.abort})}}),Ud=w("$ZodCheckMaxLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!_r(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag.maximum??Number.POSITIVE_INFINITY;s.maximum<c&&(a._zod.bag.maximum=s.maximum)}),e._zod.check=a=>{const c=a.value;if(c.length<=s.maximum)return;const h=Lr(c);a.issues.push({origin:h,code:"too_big",maximum:s.maximum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),jd=w("$ZodCheckMinLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!_r(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;s.minimum>c&&(a._zod.bag.minimum=s.minimum)}),e._zod.check=a=>{const c=a.value;if(c.length>=s.minimum)return;const h=Lr(c);a.issues.push({origin:h,code:"too_small",minimum:s.minimum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),zd=w("$ZodCheckLengthEquals",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!_r(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag;c.minimum=s.length,c.maximum=s.length,c.length=s.length}),e._zod.check=a=>{const c=a.value,u=c.length;if(u===s.length)return;const h=Lr(c),f=u>s.length;a.issues.push({origin:h,...f?{code:"too_big",maximum:s.length}:{code:"too_small",minimum:s.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!s.abort})}}),ai=w("$ZodCheckStringFormat",(e,s)=>{var i,a;Fe.init(e,s),e._zod.onattach.push(c=>{const u=c._zod.bag;u.format=s.format,s.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(s.pattern))}),s.pattern?(i=e._zod).check??(i.check=c=>{s.pattern.lastIndex=0,!s.pattern.test(c.value)&&c.issues.push({origin:"string",code:"invalid_format",format:s.format,input:c.value,...s.pattern?{pattern:s.pattern.toString()}:{},inst:e,continue:!s.abort})}):(a=e._zod).check??(a.check=()=>{})}),Vd=w("$ZodCheckRegex",(e,s)=>{ai.init(e,s),e._zod.check=i=>{s.pattern.lastIndex=0,!s.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:s.pattern.toString(),inst:e,continue:!s.abort})}}),Gd=w("$ZodCheckLowerCase",(e,s)=>{s.pattern??(s.pattern=Md),ai.init(e,s)}),Hd=w("$ZodCheckUpperCase",(e,s)=>{s.pattern??(s.pattern=$d),ai.init(e,s)}),Zd=w("$ZodCheckIncludes",(e,s)=>{Fe.init(e,s);const i=es(s.includes),a=new RegExp(typeof s.position=="number"?`^.{${s.position}}${i}`:i);s.pattern=a,e._zod.onattach.push(c=>{const u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(a)}),e._zod.check=c=>{c.value.includes(s.includes,s.position)||c.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:s.includes,input:c.value,inst:e,continue:!s.abort})}}),Wd=w("$ZodCheckStartsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`^${es(s.prefix)}.*`);s.pattern??(s.pattern=i),e._zod.onattach.push(a=>{const c=a._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(i)}),e._zod.check=a=>{a.value.startsWith(s.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:s.prefix,input:a.value,inst:e,continue:!s.abort})}}),Kd=w("$ZodCheckEndsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`.*${es(s.suffix)}$`);s.pattern??(s.pattern=i),e._zod.onattach.push(a=>{const c=a._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(i)}),e._zod.check=a=>{a.value.endsWith(s.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:s.suffix,input:a.value,inst:e,continue:!s.abort})}}),qd=w("$ZodCheckOverwrite",(e,s)=>{Fe.init(e,s),e._zod.check=i=>{i.value=s.tx(i.value)}});class Yd{constructor(s=[]){this.content=[],this.indent=0,this&&(this.args=s)}indented(s){this.indent+=1,s(this),this.indent-=1}write(s){if(typeof s=="function"){s(this,{execution:"sync"}),s(this,{execution:"async"});return}const a=s.split(`
|
|
1
|
+
import*as Qs from"fs";import ee,{existsSync as ke,readFileSync as Ar,statSync as ws,promises as Pr,writeFileSync as wr,createReadStream as gp,mkdtempSync as Ep,mkdirSync as Tp,rmSync as Za}from"fs";import*as ei from"path";import Se,{resolve as G,dirname as Wa,relative as Ka,basename as Sp,sep as Cr,parse as qa,join as We}from"path";import bp from"cac";import{green as et,yellow as Ip,red as xp,gray as Ap}from"kolorist";import Qt from"prompts";import Ya from"adm-zip";import{glob as W,globSync as Xa}from"glob";import tt from"typescript";import{normalizePath as Pp,build as ht,defineConfig as ti,createServer as wp}from"vite";import"vue";import"vue/server-renderer";import*as Ie from"process";import si from"process";import{JSONPath as Cp}from"jsonpath-plus";import{readFile as _r,writeFile as _p}from"fs/promises";import{pathToFileURL as Ja,URL as vp}from"url";import vr,{AxiosError as Qa}from"axios";import Np from"tinycolor2";import{ButtonTypeEnum as ii}from"@lightspeed/crane-api";import{builtinModules as eo}from"module";import{viteExternalsPlugin as to}from"vite-plugin-externals";import Op from"vite-plugin-compression";import Lp from"@vitejs/plugin-vue";import Dp from"vite-tsconfig-paths";import kp from"vite-plugin-checker";import{encode as Rp}from"@jridgewell/sourcemap-codec";import{promisify as so}from"node:util";import io from"node:zlib";import me from"node:fs";import Re from"node:path";import be from"node:process";import Mp from"micromatch";import{fileURLToPath as $p}from"node:url";import{ConcurrencyManager as Fp}from"axios-concurrency";import{inc as Bp}from"semver";import Up from"cli-progress";import{WebSocketServer as jp,WebSocket as zp}from"ws";import*as Vp from"os";import{spawnSync as Gp}from"child_process";const Hp="3.5.0-rc.0";function P(e,s,i){function a(f,y){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:y,constr:h,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),s(f,y);const T=h.prototype,I=Object.keys(T);for(let A=0;A<I.length;A++){const L=I[A];L in f||(f[L]=T[L].bind(f))}}const c=i?.Parent??Object;class u extends c{}Object.defineProperty(u,"name",{value:e});function h(f){var y;const T=i?.Parent?new u:this;a(T,f),(y=T._zod).deferred??(y.deferred=[]);for(const I of T._zod.deferred)I();return T}return Object.defineProperty(h,"init",{value:a}),Object.defineProperty(h,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}class es extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ro extends Error{constructor(s){super(`Encountered unidirectional transform during encode: ${s}`),this.name="ZodEncodeError"}}const Nr={};function pt(e){return e&&Object.assign(Nr,e),Nr}function no(e){const s=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,c])=>s.indexOf(+a)===-1).map(([a,c])=>c)}function Or(e,s){return typeof s=="bigint"?s.toString():s}function ri(e){return{get value(){{const s=e();return Object.defineProperty(this,"value",{value:s}),s}}}}function Lr(e){return e==null}function Dr(e){const s=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(s,i)}function Zp(e,s){const i=(e.toString().split(".")[1]||"").length,a=s.toString();let c=(a.split(".")[1]||"").length;if(c===0&&/\d?e-\d?/.test(a)){const y=a.match(/\d?e-(\d?)/);y?.[1]&&(c=Number.parseInt(y[1]))}const u=i>c?i:c,h=Number.parseInt(e.toFixed(u).replace(".","")),f=Number.parseInt(s.toFixed(u).replace(".",""));return h%f/10**u}const ao=Symbol("evaluating");function re(e,s,i){let a;Object.defineProperty(e,s,{get(){if(a!==ao)return a===void 0&&(a=ao,a=i()),a},set(c){Object.defineProperty(e,s,{value:c})},configurable:!0})}function Ft(e,s,i){Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0})}function Ct(...e){const s={};for(const i of e){const a=Object.getOwnPropertyDescriptors(i);Object.assign(s,a)}return Object.defineProperties({},s)}function oo(e){return JSON.stringify(e)}function Wp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const co="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Cs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Kp=ri(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ts(e){if(Cs(e)===!1)return!1;const s=e.constructor;if(s===void 0||typeof s!="function")return!0;const i=s.prototype;return!(Cs(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function lo(e){return ts(e)?{...e}:Array.isArray(e)?[...e]:e}const qp=new Set(["string","number","symbol"]);function ss(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _t(e,s,i){const a=new e._zod.constr(s??e._zod.def);return(!s||i?.parent)&&(a._zod.parent=e),a}function U(e){const s=e;if(!s)return{};if(typeof s=="string")return{error:()=>s};if(s?.message!==void 0){if(s?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");s.error=s.message}return delete s.message,typeof s.error=="string"?{...s,error:()=>s.error}:s}function Yp(e){return Object.keys(e).filter(s=>e[s]._zod.optin==="optional"&&e[s]._zod.optout==="optional")}const Xp={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Jp(e,s){const i=e._zod.def,a=i.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const u=Ct(e._zod.def,{get shape(){const h={};for(const f in s){if(!(f in i.shape))throw new Error(`Unrecognized key: "${f}"`);s[f]&&(h[f]=i.shape[f])}return Ft(this,"shape",h),h},checks:[]});return _t(e,u)}function Qp(e,s){const i=e._zod.def,a=i.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const u=Ct(e._zod.def,{get shape(){const h={...e._zod.def.shape};for(const f in s){if(!(f in i.shape))throw new Error(`Unrecognized key: "${f}"`);s[f]&&delete h[f]}return Ft(this,"shape",h),h},checks:[]});return _t(e,u)}function ed(e,s){if(!ts(s))throw new Error("Invalid input to extend: expected a plain object");const i=e._zod.def.checks;if(i&&i.length>0){const u=e._zod.def.shape;for(const h in s)if(Object.getOwnPropertyDescriptor(u,h)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const c=Ct(e._zod.def,{get shape(){const u={...e._zod.def.shape,...s};return Ft(this,"shape",u),u}});return _t(e,c)}function td(e,s){if(!ts(s))throw new Error("Invalid input to safeExtend: expected a plain object");const i=Ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...s};return Ft(this,"shape",a),a}});return _t(e,i)}function sd(e,s){const i=Ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...s._zod.def.shape};return Ft(this,"shape",a),a},get catchall(){return s._zod.def.catchall},checks:[]});return _t(e,i)}function id(e,s,i){const c=s._zod.def.checks;if(c&&c.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const h=Ct(s._zod.def,{get shape(){const f=s._zod.def.shape,y={...f};if(i)for(const T in i){if(!(T in f))throw new Error(`Unrecognized key: "${T}"`);i[T]&&(y[T]=e?new e({type:"optional",innerType:f[T]}):f[T])}else for(const T in f)y[T]=e?new e({type:"optional",innerType:f[T]}):f[T];return Ft(this,"shape",y),y},checks:[]});return _t(s,h)}function rd(e,s,i){const a=Ct(s._zod.def,{get shape(){const c=s._zod.def.shape,u={...c};if(i)for(const h in i){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);i[h]&&(u[h]=new e({type:"nonoptional",innerType:c[h]}))}else for(const h in c)u[h]=new e({type:"nonoptional",innerType:c[h]});return Ft(this,"shape",u),u}});return _t(s,a)}function is(e,s=0){if(e.aborted===!0)return!0;for(let i=s;i<e.issues.length;i++)if(e.issues[i]?.continue!==!0)return!0;return!1}function rs(e,s){return s.map(i=>{var a;return(a=i).path??(a.path=[]),i.path.unshift(e),i})}function ni(e){return typeof e=="string"?e:e?.message}function vt(e,s,i){const a={...e,path:e.path??[]};if(!e.message){const c=ni(e.inst?._zod.def?.error?.(e))??ni(s?.error?.(e))??ni(i.customError?.(e))??ni(i.localeError?.(e))??"Invalid input";a.message=c}return delete a.inst,delete a.continue,s?.reportInput||delete a.input,a}function kr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _s(...e){const[s,i,a]=e;return typeof s=="string"?{message:s,code:"custom",input:i,inst:a}:{...s}}const uo=(e,s)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:s,enumerable:!1}),e.message=JSON.stringify(s,Or,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ho=P("$ZodError",uo),po=P("$ZodError",uo,{Parent:Error});function nd(e,s=i=>i.message){const i={},a=[];for(const c of e.issues)c.path.length>0?(i[c.path[0]]=i[c.path[0]]||[],i[c.path[0]].push(s(c))):a.push(s(c));return{formErrors:a,fieldErrors:i}}function ad(e,s=i=>i.message){const i={_errors:[]},a=c=>{for(const u of c.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(h=>a({issues:h}));else if(u.code==="invalid_key")a({issues:u.issues});else if(u.code==="invalid_element")a({issues:u.issues});else if(u.path.length===0)i._errors.push(s(u));else{let h=i,f=0;for(;f<u.path.length;){const y=u.path[f];f===u.path.length-1?(h[y]=h[y]||{_errors:[]},h[y]._errors.push(s(u))):h[y]=h[y]||{_errors:[]},h=h[y],f++}}};return a(e),i}const Rr=e=>(s,i,a,c)=>{const u=a?Object.assign(a,{async:!1}):{async:!1},h=s._zod.run({value:i,issues:[]},u);if(h instanceof Promise)throw new es;if(h.issues.length){const f=new(c?.Err??e)(h.issues.map(y=>vt(y,u,pt())));throw co(f,c?.callee),f}return h.value},Mr=e=>async(s,i,a,c)=>{const u=a?Object.assign(a,{async:!0}):{async:!0};let h=s._zod.run({value:i,issues:[]},u);if(h instanceof Promise&&(h=await h),h.issues.length){const f=new(c?.Err??e)(h.issues.map(y=>vt(y,u,pt())));throw co(f,c?.callee),f}return h.value},ai=e=>(s,i,a)=>{const c=a?{...a,async:!1}:{async:!1},u=s._zod.run({value:i,issues:[]},c);if(u instanceof Promise)throw new es;return u.issues.length?{success:!1,error:new(e??ho)(u.issues.map(h=>vt(h,c,pt())))}:{success:!0,data:u.value}},od=ai(po),oi=e=>async(s,i,a)=>{const c=a?Object.assign(a,{async:!0}):{async:!0};let u=s._zod.run({value:i,issues:[]},c);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(h=>vt(h,c,pt())))}:{success:!0,data:u.value}},cd=oi(po),ld=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Rr(e)(s,i,c)},ud=e=>(s,i,a)=>Rr(e)(s,i,a),hd=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Mr(e)(s,i,c)},pd=e=>async(s,i,a)=>Mr(e)(s,i,a),dd=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ai(e)(s,i,c)},fd=e=>(s,i,a)=>ai(e)(s,i,a),md=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return oi(e)(s,i,c)},yd=e=>async(s,i,a)=>oi(e)(s,i,a),gd=/^[cC][^\s-]{8,}$/,Ed=/^[0-9a-z]+$/,Td=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Sd=/^[0-9a-vA-V]{20}$/,bd=/^[A-Za-z0-9]{27}$/,Id=/^[a-zA-Z0-9_-]{21}$/,xd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ad=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Cd(){return new RegExp(wd,"u")}const _d=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Nd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Od=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ld=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mo=/^[A-Za-z0-9_-]*$/,Dd=/^\+[1-9]\d{6,14}$/,yo="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",kd=new RegExp(`^${yo}$`);function go(e){const s="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${s}`:e.precision===0?`${s}:[0-5]\\d`:`${s}:[0-5]\\d\\.\\d{${e.precision}}`:`${s}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Rd(e){return new RegExp(`^${go(e)}$`)}function Md(e){const s=go({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${s}(?:${i.join("|")})`;return new RegExp(`^${yo}T(?:${a})$`)}const $d=e=>{const s=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${s}$`)},Fd=/^-?\d+$/,Eo=/^-?\d+(?:\.\d+)?$/,Bd=/^(?:true|false)$/i,Ud=/^[^A-Z]*$/,jd=/^[^a-z]*$/,Fe=P("$ZodCheck",(e,s)=>{var i;e._zod??(e._zod={}),e._zod.def=s,(i=e._zod).onattach??(i.onattach=[])}),To={number:"number",bigint:"bigint",object:"date"},So=P("$ZodCheckLessThan",(e,s)=>{Fe.init(e,s);const i=To[typeof s.value];e._zod.onattach.push(a=>{const c=a._zod.bag,u=(s.inclusive?c.maximum:c.exclusiveMaximum)??Number.POSITIVE_INFINITY;s.value<u&&(s.inclusive?c.maximum=s.value:c.exclusiveMaximum=s.value)}),e._zod.check=a=>{(s.inclusive?a.value<=s.value:a.value<s.value)||a.issues.push({origin:i,code:"too_big",maximum:typeof s.value=="object"?s.value.getTime():s.value,input:a.value,inclusive:s.inclusive,inst:e,continue:!s.abort})}}),bo=P("$ZodCheckGreaterThan",(e,s)=>{Fe.init(e,s);const i=To[typeof s.value];e._zod.onattach.push(a=>{const c=a._zod.bag,u=(s.inclusive?c.minimum:c.exclusiveMinimum)??Number.NEGATIVE_INFINITY;s.value>u&&(s.inclusive?c.minimum=s.value:c.exclusiveMinimum=s.value)}),e._zod.check=a=>{(s.inclusive?a.value>=s.value:a.value>s.value)||a.issues.push({origin:i,code:"too_small",minimum:typeof s.value=="object"?s.value.getTime():s.value,input:a.value,inclusive:s.inclusive,inst:e,continue:!s.abort})}}),zd=P("$ZodCheckMultipleOf",(e,s)=>{Fe.init(e,s),e._zod.onattach.push(i=>{var a;(a=i._zod.bag).multipleOf??(a.multipleOf=s.value)}),e._zod.check=i=>{if(typeof i.value!=typeof s.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?i.value%s.value===BigInt(0):Zp(i.value,s.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:s.value,input:i.value,inst:e,continue:!s.abort})}}),Vd=P("$ZodCheckNumberFormat",(e,s)=>{Fe.init(e,s),s.format=s.format||"float64";const i=s.format?.includes("int"),a=i?"int":"number",[c,u]=Xp[s.format];e._zod.onattach.push(h=>{const f=h._zod.bag;f.format=s.format,f.minimum=c,f.maximum=u,i&&(f.pattern=Fd)}),e._zod.check=h=>{const f=h.value;if(i){if(!Number.isInteger(f)){h.issues.push({expected:a,format:s.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?h.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!s.abort}):h.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!s.abort});return}}f<c&&h.issues.push({origin:"number",input:f,code:"too_small",minimum:c,inclusive:!0,inst:e,continue:!s.abort}),f>u&&h.issues.push({origin:"number",input:f,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!s.abort})}}),Gd=P("$ZodCheckMaxLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!Lr(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag.maximum??Number.POSITIVE_INFINITY;s.maximum<c&&(a._zod.bag.maximum=s.maximum)}),e._zod.check=a=>{const c=a.value;if(c.length<=s.maximum)return;const h=kr(c);a.issues.push({origin:h,code:"too_big",maximum:s.maximum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),Hd=P("$ZodCheckMinLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!Lr(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;s.minimum>c&&(a._zod.bag.minimum=s.minimum)}),e._zod.check=a=>{const c=a.value;if(c.length>=s.minimum)return;const h=kr(c);a.issues.push({origin:h,code:"too_small",minimum:s.minimum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),Zd=P("$ZodCheckLengthEquals",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!Lr(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag;c.minimum=s.length,c.maximum=s.length,c.length=s.length}),e._zod.check=a=>{const c=a.value,u=c.length;if(u===s.length)return;const h=kr(c),f=u>s.length;a.issues.push({origin:h,...f?{code:"too_big",maximum:s.length}:{code:"too_small",minimum:s.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!s.abort})}}),ci=P("$ZodCheckStringFormat",(e,s)=>{var i,a;Fe.init(e,s),e._zod.onattach.push(c=>{const u=c._zod.bag;u.format=s.format,s.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(s.pattern))}),s.pattern?(i=e._zod).check??(i.check=c=>{s.pattern.lastIndex=0,!s.pattern.test(c.value)&&c.issues.push({origin:"string",code:"invalid_format",format:s.format,input:c.value,...s.pattern?{pattern:s.pattern.toString()}:{},inst:e,continue:!s.abort})}):(a=e._zod).check??(a.check=()=>{})}),Wd=P("$ZodCheckRegex",(e,s)=>{ci.init(e,s),e._zod.check=i=>{s.pattern.lastIndex=0,!s.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:s.pattern.toString(),inst:e,continue:!s.abort})}}),Kd=P("$ZodCheckLowerCase",(e,s)=>{s.pattern??(s.pattern=Ud),ci.init(e,s)}),qd=P("$ZodCheckUpperCase",(e,s)=>{s.pattern??(s.pattern=jd),ci.init(e,s)}),Yd=P("$ZodCheckIncludes",(e,s)=>{Fe.init(e,s);const i=ss(s.includes),a=new RegExp(typeof s.position=="number"?`^.{${s.position}}${i}`:i);s.pattern=a,e._zod.onattach.push(c=>{const u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(a)}),e._zod.check=c=>{c.value.includes(s.includes,s.position)||c.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:s.includes,input:c.value,inst:e,continue:!s.abort})}}),Xd=P("$ZodCheckStartsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`^${ss(s.prefix)}.*`);s.pattern??(s.pattern=i),e._zod.onattach.push(a=>{const c=a._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(i)}),e._zod.check=a=>{a.value.startsWith(s.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:s.prefix,input:a.value,inst:e,continue:!s.abort})}}),Jd=P("$ZodCheckEndsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`.*${ss(s.suffix)}$`);s.pattern??(s.pattern=i),e._zod.onattach.push(a=>{const c=a._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(i)}),e._zod.check=a=>{a.value.endsWith(s.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:s.suffix,input:a.value,inst:e,continue:!s.abort})}}),Qd=P("$ZodCheckOverwrite",(e,s)=>{Fe.init(e,s),e._zod.check=i=>{i.value=s.tx(i.value)}});class ef{constructor(s=[]){this.content=[],this.indent=0,this&&(this.args=s)}indented(s){this.indent+=1,s(this),this.indent-=1}write(s){if(typeof s=="function"){s(this,{execution:"sync"}),s(this,{execution:"async"});return}const a=s.split(`
|
|
2
2
|
`).filter(h=>h),c=Math.min(...a.map(h=>h.length-h.trimStart().length)),u=a.map(h=>h.slice(c)).map(h=>" ".repeat(this.indent*2)+h);for(const h of u)this.content.push(h)}compile(){const s=Function,i=this?.args,c=[...(this?.content??[""]).map(u=>` ${u}`)];return new s(...i,c.join(`
|
|
3
|
-
`))}}const
|
|
4
|
-
if (${
|
|
5
|
-
if (${
|
|
6
|
-
payload.issues = payload.issues.concat(${
|
|
3
|
+
`))}}const tf={major:4,minor:3,patch:6},ye=P("$ZodType",(e,s)=>{var i;e??(e={}),e._zod.def=s,e._zod.bag=e._zod.bag||{},e._zod.version=tf;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const c of a)for(const u of c._zod.onattach)u(e);if(a.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const c=(h,f,y)=>{let T=is(h),I;for(const A of f){if(A._zod.def.when){if(!A._zod.def.when(h))continue}else if(T)continue;const L=h.issues.length,R=A._zod.check(h);if(R instanceof Promise&&y?.async===!1)throw new es;if(I||R instanceof Promise)I=(I??Promise.resolve()).then(async()=>{await R,h.issues.length!==L&&(T||(T=is(h,L)))});else{if(h.issues.length===L)continue;T||(T=is(h,L))}}return I?I.then(()=>h):h},u=(h,f,y)=>{if(is(h))return h.aborted=!0,h;const T=c(f,a,y);if(T instanceof Promise){if(y.async===!1)throw new es;return T.then(I=>e._zod.parse(I,y))}return e._zod.parse(T,y)};e._zod.run=(h,f)=>{if(f.skipChecks)return e._zod.parse(h,f);if(f.direction==="backward"){const T=e._zod.parse({value:h.value,issues:[]},{...f,skipChecks:!0});return T instanceof Promise?T.then(I=>u(I,h,f)):u(T,h,f)}const y=e._zod.parse(h,f);if(y instanceof Promise){if(f.async===!1)throw new es;return y.then(T=>c(T,a,f))}return c(y,a,f)}}re(e,"~standard",()=>({validate:c=>{try{const u=od(e,c);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return cd(e,c).then(h=>h.success?{value:h.data}:{issues:h.error?.issues})}},vendor:"zod",version:1}))}),$r=P("$ZodString",(e,s)=>{ye.init(e,s),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$d(e._zod.bag),e._zod.parse=(i,a)=>{if(s.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),de=P("$ZodStringFormat",(e,s)=>{ci.init(e,s),$r.init(e,s)}),sf=P("$ZodGUID",(e,s)=>{s.pattern??(s.pattern=Ad),de.init(e,s)}),rf=P("$ZodUUID",(e,s)=>{if(s.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[s.version];if(a===void 0)throw new Error(`Invalid UUID version: "${s.version}"`);s.pattern??(s.pattern=fo(a))}else s.pattern??(s.pattern=fo());de.init(e,s)}),nf=P("$ZodEmail",(e,s)=>{s.pattern??(s.pattern=Pd),de.init(e,s)}),af=P("$ZodURL",(e,s)=>{de.init(e,s),e._zod.check=i=>{try{const a=i.value.trim(),c=new URL(a);s.hostname&&(s.hostname.lastIndex=0,s.hostname.test(c.hostname)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:s.hostname.source,input:i.value,inst:e,continue:!s.abort})),s.protocol&&(s.protocol.lastIndex=0,s.protocol.test(c.protocol.endsWith(":")?c.protocol.slice(0,-1):c.protocol)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:s.protocol.source,input:i.value,inst:e,continue:!s.abort})),s.normalize?i.value=c.href:i.value=a;return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!s.abort})}}}),of=P("$ZodEmoji",(e,s)=>{s.pattern??(s.pattern=Cd()),de.init(e,s)}),cf=P("$ZodNanoID",(e,s)=>{s.pattern??(s.pattern=Id),de.init(e,s)}),lf=P("$ZodCUID",(e,s)=>{s.pattern??(s.pattern=gd),de.init(e,s)}),uf=P("$ZodCUID2",(e,s)=>{s.pattern??(s.pattern=Ed),de.init(e,s)}),hf=P("$ZodULID",(e,s)=>{s.pattern??(s.pattern=Td),de.init(e,s)}),pf=P("$ZodXID",(e,s)=>{s.pattern??(s.pattern=Sd),de.init(e,s)}),df=P("$ZodKSUID",(e,s)=>{s.pattern??(s.pattern=bd),de.init(e,s)}),ff=P("$ZodISODateTime",(e,s)=>{s.pattern??(s.pattern=Md(s)),de.init(e,s)}),mf=P("$ZodISODate",(e,s)=>{s.pattern??(s.pattern=kd),de.init(e,s)}),yf=P("$ZodISOTime",(e,s)=>{s.pattern??(s.pattern=Rd(s)),de.init(e,s)}),gf=P("$ZodISODuration",(e,s)=>{s.pattern??(s.pattern=xd),de.init(e,s)}),Ef=P("$ZodIPv4",(e,s)=>{s.pattern??(s.pattern=_d),de.init(e,s),e._zod.bag.format="ipv4"}),Tf=P("$ZodIPv6",(e,s)=>{s.pattern??(s.pattern=vd),de.init(e,s),e._zod.bag.format="ipv6",e._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!s.abort})}}}),Sf=P("$ZodCIDRv4",(e,s)=>{s.pattern??(s.pattern=Nd),de.init(e,s)}),bf=P("$ZodCIDRv6",(e,s)=>{s.pattern??(s.pattern=Od),de.init(e,s),e._zod.check=i=>{const a=i.value.split("/");try{if(a.length!==2)throw new Error;const[c,u]=a;if(!u)throw new Error;const h=Number(u);if(`${h}`!==u)throw new Error;if(h<0||h>128)throw new Error;new URL(`http://[${c}]`)}catch{i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!s.abort})}}});function Io(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const If=P("$ZodBase64",(e,s)=>{s.pattern??(s.pattern=Ld),de.init(e,s),e._zod.bag.contentEncoding="base64",e._zod.check=i=>{Io(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!s.abort})}});function xf(e){if(!mo.test(e))return!1;const s=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),i=s.padEnd(Math.ceil(s.length/4)*4,"=");return Io(i)}const Af=P("$ZodBase64URL",(e,s)=>{s.pattern??(s.pattern=mo),de.init(e,s),e._zod.bag.contentEncoding="base64url",e._zod.check=i=>{xf(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!s.abort})}}),Pf=P("$ZodE164",(e,s)=>{s.pattern??(s.pattern=Dd),de.init(e,s)});function wf(e,s=null){try{const i=e.split(".");if(i.length!==3)return!1;const[a]=i;if(!a)return!1;const c=JSON.parse(atob(a));return!("typ"in c&&c?.typ!=="JWT"||!c.alg||s&&(!("alg"in c)||c.alg!==s))}catch{return!1}}const Cf=P("$ZodJWT",(e,s)=>{de.init(e,s),e._zod.check=i=>{wf(i.value,s.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!s.abort})}}),xo=P("$ZodNumber",(e,s)=>{ye.init(e,s),e._zod.pattern=e._zod.bag.pattern??Eo,e._zod.parse=(i,a)=>{if(s.coerce)try{i.value=Number(i.value)}catch{}const c=i.value;if(typeof c=="number"&&!Number.isNaN(c)&&Number.isFinite(c))return i;const u=typeof c=="number"?Number.isNaN(c)?"NaN":Number.isFinite(c)?void 0:"Infinity":void 0;return i.issues.push({expected:"number",code:"invalid_type",input:c,inst:e,...u?{received:u}:{}}),i}}),_f=P("$ZodNumberFormat",(e,s)=>{Vd.init(e,s),xo.init(e,s)}),vf=P("$ZodBoolean",(e,s)=>{ye.init(e,s),e._zod.pattern=Bd,e._zod.parse=(i,a)=>{if(s.coerce)try{i.value=!!i.value}catch{}const c=i.value;return typeof c=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:c,inst:e}),i}}),Nf=P("$ZodUnknown",(e,s)=>{ye.init(e,s),e._zod.parse=i=>i}),Of=P("$ZodNever",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)});function Ao(e,s,i){e.issues.length&&s.issues.push(...rs(i,e.issues)),s.value[i]=e.value}const Lf=P("$ZodArray",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value;if(!Array.isArray(c))return i.issues.push({expected:"array",code:"invalid_type",input:c,inst:e}),i;i.value=Array(c.length);const u=[];for(let h=0;h<c.length;h++){const f=c[h],y=s.element._zod.run({value:f,issues:[]},a);y instanceof Promise?u.push(y.then(T=>Ao(T,i,h))):Ao(y,i,h)}return u.length?Promise.all(u).then(()=>i):i}});function li(e,s,i,a,c){if(e.issues.length){if(c&&!(i in a))return;s.issues.push(...rs(i,e.issues))}e.value===void 0?i in a&&(s.value[i]=void 0):s.value[i]=e.value}function Po(e){const s=Object.keys(e.shape);for(const a of s)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const i=Yp(e.shape);return{...e,keys:s,keySet:new Set(s),numKeys:s.length,optionalKeys:new Set(i)}}function wo(e,s,i,a,c,u){const h=[],f=c.keySet,y=c.catchall._zod,T=y.def.type,I=y.optout==="optional";for(const A in s){if(f.has(A))continue;if(T==="never"){h.push(A);continue}const L=y.run({value:s[A],issues:[]},a);L instanceof Promise?e.push(L.then(R=>li(R,i,A,s,I))):li(L,i,A,s,I)}return h.length&&i.issues.push({code:"unrecognized_keys",keys:h,input:s,inst:u}),e.length?Promise.all(e).then(()=>i):i}const Df=P("$ZodObject",(e,s)=>{if(ye.init(e,s),!Object.getOwnPropertyDescriptor(s,"shape")?.get){const f=s.shape;Object.defineProperty(s,"shape",{get:()=>{const y={...f};return Object.defineProperty(s,"shape",{value:y}),y}})}const a=ri(()=>Po(s));re(e._zod,"propValues",()=>{const f=s.shape,y={};for(const T in f){const I=f[T]._zod;if(I.values){y[T]??(y[T]=new Set);for(const A of I.values)y[T].add(A)}}return y});const c=Cs,u=s.catchall;let h;e._zod.parse=(f,y)=>{h??(h=a.value);const T=f.value;if(!c(T))return f.issues.push({expected:"object",code:"invalid_type",input:T,inst:e}),f;f.value={};const I=[],A=h.shape;for(const L of h.keys){const R=A[L],oe=R._zod.optout==="optional",le=R._zod.run({value:T[L],issues:[]},y);le instanceof Promise?I.push(le.then(Ce=>li(Ce,f,L,T,oe))):li(le,f,L,T,oe)}return u?wo(I,T,f,y,a.value,e):I.length?Promise.all(I).then(()=>f):f}}),kf=P("$ZodObjectJIT",(e,s)=>{Df.init(e,s);const i=e._zod.parse,a=ri(()=>Po(s)),c=L=>{const R=new ef(["shape","payload","ctx"]),oe=a.value,le=$e=>{const we=oo($e);return`shape[${we}]._zod.run({ value: input[${we}], issues: [] }, ctx)`};R.write("const input = payload.value;");const Ce=Object.create(null);let S=0;for(const $e of oe.keys)Ce[$e]=`key_${S++}`;R.write("const newResult = {};");for(const $e of oe.keys){const we=Ce[$e],Ne=oo($e),qt=L[$e]?._zod?.optout==="optional";R.write(`const ${we} = ${le($e)};`),qt?R.write(`
|
|
4
|
+
if (${we}.issues.length) {
|
|
5
|
+
if (${Ne} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${we}.issues.map(iss => ({
|
|
7
7
|
...iss,
|
|
8
|
-
path: iss.path ? [${
|
|
8
|
+
path: iss.path ? [${Ne}, ...iss.path] : [${Ne}]
|
|
9
9
|
})));
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
if (${
|
|
14
|
-
if (${
|
|
15
|
-
newResult[${
|
|
13
|
+
if (${we}.value === undefined) {
|
|
14
|
+
if (${Ne} in input) {
|
|
15
|
+
newResult[${Ne}] = undefined;
|
|
16
16
|
}
|
|
17
17
|
} else {
|
|
18
|
-
newResult[${
|
|
18
|
+
newResult[${Ne}] = ${we}.value;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
`):R.write(`
|
|
22
|
-
if (${
|
|
23
|
-
payload.issues = payload.issues.concat(${
|
|
22
|
+
if (${we}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${we}.issues.map(iss => ({
|
|
24
24
|
...iss,
|
|
25
|
-
path: iss.path ? [${
|
|
25
|
+
path: iss.path ? [${Ne}, ...iss.path] : [${Ne}]
|
|
26
26
|
})));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (${
|
|
30
|
-
if (${
|
|
31
|
-
newResult[${
|
|
29
|
+
if (${we}.value === undefined) {
|
|
30
|
+
if (${Ne} in input) {
|
|
31
|
+
newResult[${Ne}] = undefined;
|
|
32
32
|
}
|
|
33
33
|
} else {
|
|
34
|
-
newResult[${
|
|
34
|
+
newResult[${Ne}] = ${we}.value;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
`)}R.write("payload.value = newResult;"),R.write("return payload;");const gs=R.compile();return($e,Ae)=>gs(L,$e,Ae)};let u;const h=ws,f=!vr.jitless,T=f&&Gp.value,x=s.catchall;let P;e._zod.parse=(L,R)=>{P??(P=a.value);const ae=L.value;return h(ae)?f&&T&&R?.async===!1&&R.jitless!==!0?(u||(u=c(s.shape)),L=u(L,R),x?Io([],ae,L,R,P,e):L):i(L,R):(L.issues.push({expected:"object",code:"invalid_type",input:ae,inst:e}),L)}});function Po(e,s,i,a){for(const u of e)if(u.issues.length===0)return s.value=u.value,s;const c=e.filter(u=>!ts(u));return c.length===1?(s.value=c[0].value,c[0]):(s.issues.push({code:"invalid_union",input:s.value,inst:i,errors:e.map(u=>u.issues.map(h=>Nt(h,a,pt())))}),s)}const wo=w("$ZodUnion",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.options.some(c=>c._zod.optin==="optional")?"optional":void 0),re(e._zod,"optout",()=>s.options.some(c=>c._zod.optout==="optional")?"optional":void 0),re(e._zod,"values",()=>{if(s.options.every(c=>c._zod.values))return new Set(s.options.flatMap(c=>Array.from(c._zod.values)))}),re(e._zod,"pattern",()=>{if(s.options.every(c=>c._zod.pattern)){const c=s.options.map(u=>u._zod.pattern);return new RegExp(`^(${c.map(u=>Or(u.source)).join("|")})$`)}});const i=s.options.length===1,a=s.options[0]._zod.run;e._zod.parse=(c,u)=>{if(i)return a(c,u);let h=!1;const f=[];for(const y of s.options){const T=y._zod.run({value:c.value,issues:[]},u);if(T instanceof Promise)f.push(T),h=!0;else{if(T.issues.length===0)return T;f.push(T)}}return h?Promise.all(f).then(y=>Po(y,c,e,u)):Po(f,c,e,u)}}),Of=w("$ZodDiscriminatedUnion",(e,s)=>{s.inclusive=!1,wo.init(e,s);const i=e._zod.parse;re(e._zod,"propValues",()=>{const c={};for(const u of s.options){const h=u._zod.propValues;if(!h||Object.keys(h).length===0)throw new Error(`Invalid discriminated union option at index "${s.options.indexOf(u)}"`);for(const[f,y]of Object.entries(h)){c[f]||(c[f]=new Set);for(const T of y)c[f].add(T)}}return c});const a=si(()=>{const c=s.options,u=new Map;for(const h of c){const f=h._zod.propValues?.[s.discriminator];if(!f||f.size===0)throw new Error(`Invalid discriminated union option at index "${s.options.indexOf(h)}"`);for(const y of f){if(u.has(y))throw new Error(`Duplicate discriminator value "${String(y)}"`);u.set(y,h)}}return u});e._zod.parse=(c,u)=>{const h=c.value;if(!ws(h))return c.issues.push({code:"invalid_type",expected:"object",input:h,inst:e}),c;const f=a.value.get(h?.[s.discriminator]);return f?f._zod.run(c,u):s.unionFallback?i(c,u):(c.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:s.discriminator,input:h,path:[s.discriminator],inst:e}),c)}}),Lf=w("$ZodIntersection",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value,u=s.left._zod.run({value:c,issues:[]},a),h=s.right._zod.run({value:c,issues:[]},a);return u instanceof Promise||h instanceof Promise?Promise.all([u,h]).then(([y,T])=>Ao(i,y,T)):Ao(i,u,h)}});function Mr(e,s){if(e===s)return{valid:!0,data:e};if(e instanceof Date&&s instanceof Date&&+e==+s)return{valid:!0,data:e};if(Qt(e)&&Qt(s)){const i=Object.keys(s),a=Object.keys(e).filter(u=>i.indexOf(u)!==-1),c={...e,...s};for(const u of a){const h=Mr(e[u],s[u]);if(!h.valid)return{valid:!1,mergeErrorPath:[u,...h.mergeErrorPath]};c[u]=h.data}return{valid:!0,data:c}}if(Array.isArray(e)&&Array.isArray(s)){if(e.length!==s.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let a=0;a<e.length;a++){const c=e[a],u=s[a],h=Mr(c,u);if(!h.valid)return{valid:!1,mergeErrorPath:[a,...h.mergeErrorPath]};i.push(h.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function Ao(e,s,i){const a=new Map;let c;for(const f of s.issues)if(f.code==="unrecognized_keys"){c??(c=f);for(const y of f.keys)a.has(y)||a.set(y,{}),a.get(y).l=!0}else e.issues.push(f);for(const f of i.issues)if(f.code==="unrecognized_keys")for(const y of f.keys)a.has(y)||a.set(y,{}),a.get(y).r=!0;else e.issues.push(f);const u=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(u.length&&c&&e.issues.push({...c,keys:u}),ts(e))return e;const h=Mr(s.value,i.value);if(!h.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(h.mergeErrorPath)}`);return e.value=h.data,e}const kf=w("$ZodRecord",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value;if(!Qt(c))return i.issues.push({expected:"record",code:"invalid_type",input:c,inst:e}),i;const u=[],h=s.keyType._zod.values;if(h){i.value={};const f=new Set;for(const T of h)if(typeof T=="string"||typeof T=="number"||typeof T=="symbol"){f.add(typeof T=="number"?T.toString():T);const x=s.valueType._zod.run({value:c[T],issues:[]},a);x instanceof Promise?u.push(x.then(P=>{P.issues.length&&i.issues.push(...ss(T,P.issues)),i.value[T]=P.value})):(x.issues.length&&i.issues.push(...ss(T,x.issues)),i.value[T]=x.value)}let y;for(const T in c)f.has(T)||(y=y??[],y.push(T));y&&y.length>0&&i.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:y})}else{i.value={};for(const f of Reflect.ownKeys(c)){if(f==="__proto__")continue;let y=s.keyType._zod.run({value:f,issues:[]},a);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&mo.test(f)&&y.issues.length){const P=s.keyType._zod.run({value:Number(f),issues:[]},a);if(P instanceof Promise)throw new Error("Async schemas not supported in object keys currently");P.issues.length===0&&(y=P)}if(y.issues.length){s.mode==="loose"?i.value[f]=c[f]:i.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(P=>Nt(P,a,pt())),input:f,path:[f],inst:e});continue}const x=s.valueType._zod.run({value:c[f],issues:[]},a);x instanceof Promise?u.push(x.then(P=>{P.issues.length&&i.issues.push(...ss(f,P.issues)),i.value[y.value]=P.value})):(x.issues.length&&i.issues.push(...ss(f,x.issues)),i.value[y.value]=x.value)}}return u.length?Promise.all(u).then(()=>i):i}}),Df=w("$ZodEnum",(e,s)=>{ye.init(e,s);const i=so(s.entries),a=new Set(i);e._zod.values=a,e._zod.pattern=new RegExp(`^(${i.filter(c=>Hp.has(typeof c)).map(c=>typeof c=="string"?es(c):c.toString()).join("|")})$`),e._zod.parse=(c,u)=>{const h=c.value;return a.has(h)||c.issues.push({code:"invalid_value",values:i,input:h,inst:e}),c}}),Rf=w("$ZodLiteral",(e,s)=>{if(ye.init(e,s),s.values.length===0)throw new Error("Cannot create literal schema with no valid values");const i=new Set(s.values);e._zod.values=i,e._zod.pattern=new RegExp(`^(${s.values.map(a=>typeof a=="string"?es(a):a?es(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,c)=>{const u=a.value;return i.has(u)||a.issues.push({code:"invalid_value",values:s.values,input:u,inst:e}),a}}),Mf=w("$ZodTransform",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new to(e.constructor.name);const c=s.transform(i.value,i);if(a.async)return(c instanceof Promise?c:Promise.resolve(c)).then(h=>(i.value=h,i));if(c instanceof Promise)throw new Xt;return i.value=c,i}});function Co(e,s){return e.issues.length&&s===void 0?{issues:[],value:void 0}:e}const vo=w("$ZodOptional",(e,s)=>{ye.init(e,s),e._zod.optin="optional",e._zod.optout="optional",re(e._zod,"values",()=>s.innerType._zod.values?new Set([...s.innerType._zod.values,void 0]):void 0),re(e._zod,"pattern",()=>{const i=s.innerType._zod.pattern;return i?new RegExp(`^(${Or(i.source)})?$`):void 0}),e._zod.parse=(i,a)=>{if(s.innerType._zod.optin==="optional"){const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>Co(u,i.value)):Co(c,i.value)}return i.value===void 0?i:s.innerType._zod.run(i,a)}}),$f=w("$ZodExactOptional",(e,s)=>{vo.init(e,s),re(e._zod,"values",()=>s.innerType._zod.values),re(e._zod,"pattern",()=>s.innerType._zod.pattern),e._zod.parse=(i,a)=>s.innerType._zod.run(i,a)}),Ff=w("$ZodNullable",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.innerType._zod.optin),re(e._zod,"optout",()=>s.innerType._zod.optout),re(e._zod,"pattern",()=>{const i=s.innerType._zod.pattern;return i?new RegExp(`^(${Or(i.source)}|null)$`):void 0}),re(e._zod,"values",()=>s.innerType._zod.values?new Set([...s.innerType._zod.values,null]):void 0),e._zod.parse=(i,a)=>i.value===null?i:s.innerType._zod.run(i,a)}),Bf=w("$ZodDefault",(e,s)=>{ye.init(e,s),e._zod.optin="optional",re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);if(i.value===void 0)return i.value=s.defaultValue,i;const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>No(u,s)):No(c,s)}});function No(e,s){return e.value===void 0&&(e.value=s.defaultValue),e}const Uf=w("$ZodPrefault",(e,s)=>{ye.init(e,s),e._zod.optin="optional",re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>(a.direction==="backward"||i.value===void 0&&(i.value=s.defaultValue),s.innerType._zod.run(i,a))}),jf=w("$ZodNonOptional",(e,s)=>{ye.init(e,s),re(e._zod,"values",()=>{const i=s.innerType._zod.values;return i?new Set([...i].filter(a=>a!==void 0)):void 0}),e._zod.parse=(i,a)=>{const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>_o(u,e)):_o(c,e)}});function _o(e,s){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:s}),e}const zf=w("$ZodCatch",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.innerType._zod.optin),re(e._zod,"optout",()=>s.innerType._zod.optout),re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>(i.value=u.value,u.issues.length&&(i.value=s.catchValue({...i,error:{issues:u.issues.map(h=>Nt(h,a,pt()))},input:i.value}),i.issues=[]),i)):(i.value=c.value,c.issues.length&&(i.value=s.catchValue({...i,error:{issues:c.issues.map(u=>Nt(u,a,pt()))},input:i.value}),i.issues=[]),i)}}),Vf=w("$ZodPipe",(e,s)=>{ye.init(e,s),re(e._zod,"values",()=>s.in._zod.values),re(e._zod,"optin",()=>s.in._zod.optin),re(e._zod,"optout",()=>s.out._zod.optout),re(e._zod,"propValues",()=>s.in._zod.propValues),e._zod.parse=(i,a)=>{if(a.direction==="backward"){const u=s.out._zod.run(i,a);return u instanceof Promise?u.then(h=>ci(h,s.in,a)):ci(u,s.in,a)}const c=s.in._zod.run(i,a);return c instanceof Promise?c.then(u=>ci(u,s.out,a)):ci(c,s.out,a)}});function ci(e,s,i){return e.issues.length?(e.aborted=!0,e):s._zod.run({value:e.value,issues:e.issues},i)}const Gf=w("$ZodReadonly",(e,s)=>{ye.init(e,s),re(e._zod,"propValues",()=>s.innerType._zod.propValues),re(e._zod,"values",()=>s.innerType._zod.values),re(e._zod,"optin",()=>s.innerType?._zod?.optin),re(e._zod,"optout",()=>s.innerType?._zod?.optout),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(Oo):Oo(c)}});function Oo(e){return e.value=Object.freeze(e.value),e}const Hf=w("$ZodCustom",(e,s)=>{Fe.init(e,s),ye.init(e,s),e._zod.parse=(i,a)=>i,e._zod.check=i=>{const a=i.value,c=s.fn(a);if(c instanceof Promise)return c.then(u=>Lo(u,i,a,e));Lo(c,i,a,e)}});function Lo(e,s,i,a){if(!e){const c={code:"custom",input:i,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(c.params=a._zod.def.params),s.issues.push(As(c))}}var ko;class Zf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(s,...i){const a=i[0];return this._map.set(s,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,s),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(s){const i=this._map.get(s);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(s),this}get(s){const i=s._zod.parent;if(i){const a={...this.get(i)??{}};delete a.id;const c={...a,...this._map.get(s)};return Object.keys(c).length?c:void 0}return this._map.get(s)}has(s){return this._map.has(s)}}function Wf(){return new Zf}(ko=globalThis).__zod_globalRegistry??(ko.__zod_globalRegistry=Wf());const Cs=globalThis.__zod_globalRegistry;function Kf(e,s){return new e({type:"string",...U(s)})}function qf(e,s){return new e({type:"string",format:"email",check:"string_format",abort:!1,...U(s)})}function Do(e,s){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...U(s)})}function Yf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...U(s)})}function Jf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(s)})}function Xf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(s)})}function Qf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(s)})}function Ro(e,s){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(s)})}function em(e,s){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...U(s)})}function tm(e,s){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(s)})}function sm(e,s){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...U(s)})}function im(e,s){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(s)})}function rm(e,s){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...U(s)})}function nm(e,s){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...U(s)})}function am(e,s){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(s)})}function om(e,s){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(s)})}function cm(e,s){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(s)})}function lm(e,s){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(s)})}function um(e,s){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(s)})}function hm(e,s){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...U(s)})}function pm(e,s){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...U(s)})}function dm(e,s){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...U(s)})}function fm(e,s){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...U(s)})}function mm(e,s){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(s)})}function ym(e,s){return new e({type:"string",format:"date",check:"string_format",...U(s)})}function gm(e,s){return new e({type:"string",format:"time",check:"string_format",precision:null,...U(s)})}function Em(e,s){return new e({type:"string",format:"duration",check:"string_format",...U(s)})}function Tm(e,s){return new e({type:"number",checks:[],...U(s)})}function Sm(e,s){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(s)})}function bm(e,s){return new e({type:"boolean",...U(s)})}function xm(e){return new e({type:"unknown"})}function Im(e,s){return new e({type:"never",...U(s)})}function Mo(e,s){return new go({check:"less_than",...U(s),value:e,inclusive:!1})}function $r(e,s){return new go({check:"less_than",...U(s),value:e,inclusive:!0})}function $o(e,s){return new Eo({check:"greater_than",...U(s),value:e,inclusive:!1})}function Fr(e,s){return new Eo({check:"greater_than",...U(s),value:e,inclusive:!0})}function Fo(e,s){return new Fd({check:"multiple_of",...U(s),value:e})}function Bo(e,s){return new Ud({check:"max_length",...U(s),maximum:e})}function li(e,s){return new jd({check:"min_length",...U(s),minimum:e})}function Uo(e,s){return new zd({check:"length_equals",...U(s),length:e})}function Pm(e,s){return new Vd({check:"string_format",format:"regex",...U(s),pattern:e})}function wm(e){return new Gd({check:"string_format",format:"lowercase",...U(e)})}function Am(e){return new Hd({check:"string_format",format:"uppercase",...U(e)})}function Cm(e,s){return new Zd({check:"string_format",format:"includes",...U(s),includes:e})}function vm(e,s){return new Wd({check:"string_format",format:"starts_with",...U(s),prefix:e})}function Nm(e,s){return new Kd({check:"string_format",format:"ends_with",...U(s),suffix:e})}function is(e){return new qd({check:"overwrite",tx:e})}function _m(e){return is(s=>s.normalize(e))}function Om(){return is(e=>e.trim())}function Lm(){return is(e=>e.toLowerCase())}function km(){return is(e=>e.toUpperCase())}function Dm(){return is(e=>Vp(e))}function Rm(e,s,i){return new e({type:"array",element:s,...U(i)})}function Mm(e,s,i){const a=U(i);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:s,...a})}function $m(e,s,i){return new e({type:"custom",check:"custom",fn:s,...U(i)})}function Fm(e){const s=Bm(i=>(i.addIssue=a=>{if(typeof a=="string")i.issues.push(As(a,i.value,s._zod.def));else{const c=a;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=i.value),c.inst??(c.inst=s),c.continue??(c.continue=!s._zod.def.abort),i.issues.push(As(c))}},e(i.value,i)));return s}function Bm(e,s){const i=new Fe({check:"custom",...U(s)});return i._zod.check=e,i}function jo(e){let s=e?.target??"draft-2020-12";return s==="draft-4"&&(s="draft-04"),s==="draft-7"&&(s="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Cs,target:s,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ie(e,s,i={path:[],schemaPath:[]}){var a;const c=e._zod.def,u=s.seen.get(e);if(u)return u.count++,i.schemaPath.includes(e)&&(u.cycle=i.path),u.schema;const h={schema:{},count:1,cycle:void 0,path:i.path};s.seen.set(e,h);const f=e._zod.toJSONSchema?.();if(f)h.schema=f;else{const x={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(s,h.schema,x);else{const L=h.schema,R=s.processors[c.type];if(!R)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${c.type}`);R(e,s,L,x)}const P=e._zod.parent;P&&(h.ref||(h.ref=P),Ie(P,s,x),s.seen.get(P).isParent=!0)}const y=s.metadataRegistry.get(e);return y&&Object.assign(h.schema,y),s.io==="input"&&Me(e)&&(delete h.schema.examples,delete h.schema.default),s.io==="input"&&h.schema._prefault&&((a=h.schema).default??(a.default=h.schema._prefault)),delete h.schema._prefault,s.seen.get(e).schema}function zo(e,s){const i=e.seen.get(s);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const h of e.seen.entries()){const f=e.metadataRegistry.get(h[0])?.id;if(f){const y=a.get(f);if(y&&y!==h[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(f,h[0])}}const c=h=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const P=e.external.registry.get(h[0])?.id,L=e.external.uri??(ae=>ae);if(P)return{ref:L(P)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${L("__shared")}#/${f}/${R}`}}if(h[1]===i)return{ref:"#"};const T=`#/${f}/`,x=h[1].schema.id??`__schema${e.counter++}`;return{defId:x,ref:T+x}},u=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:y,defId:T}=c(h);f.def={...f.schema},T&&(f.defId=T);const x=f.schema;for(const P in x)delete x[P];x.$ref=y};if(e.cycles==="throw")for(const h of e.seen.entries()){const f=h[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
|
|
37
|
+
`)}R.write("payload.value = newResult;"),R.write("return payload;");const Ts=R.compile();return($e,we)=>Ts(L,$e,we)};let u;const h=Cs,f=!Nr.jitless,T=f&&Kp.value,I=s.catchall;let A;e._zod.parse=(L,R)=>{A??(A=a.value);const oe=L.value;return h(oe)?f&&T&&R?.async===!1&&R.jitless!==!0?(u||(u=c(s.shape)),L=u(L,R),I?wo([],oe,L,R,A,e):L):i(L,R):(L.issues.push({expected:"object",code:"invalid_type",input:oe,inst:e}),L)}});function Co(e,s,i,a){for(const u of e)if(u.issues.length===0)return s.value=u.value,s;const c=e.filter(u=>!is(u));return c.length===1?(s.value=c[0].value,c[0]):(s.issues.push({code:"invalid_union",input:s.value,inst:i,errors:e.map(u=>u.issues.map(h=>vt(h,a,pt())))}),s)}const _o=P("$ZodUnion",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.options.some(c=>c._zod.optin==="optional")?"optional":void 0),re(e._zod,"optout",()=>s.options.some(c=>c._zod.optout==="optional")?"optional":void 0),re(e._zod,"values",()=>{if(s.options.every(c=>c._zod.values))return new Set(s.options.flatMap(c=>Array.from(c._zod.values)))}),re(e._zod,"pattern",()=>{if(s.options.every(c=>c._zod.pattern)){const c=s.options.map(u=>u._zod.pattern);return new RegExp(`^(${c.map(u=>Dr(u.source)).join("|")})$`)}});const i=s.options.length===1,a=s.options[0]._zod.run;e._zod.parse=(c,u)=>{if(i)return a(c,u);let h=!1;const f=[];for(const y of s.options){const T=y._zod.run({value:c.value,issues:[]},u);if(T instanceof Promise)f.push(T),h=!0;else{if(T.issues.length===0)return T;f.push(T)}}return h?Promise.all(f).then(y=>Co(y,c,e,u)):Co(f,c,e,u)}}),Rf=P("$ZodDiscriminatedUnion",(e,s)=>{s.inclusive=!1,_o.init(e,s);const i=e._zod.parse;re(e._zod,"propValues",()=>{const c={};for(const u of s.options){const h=u._zod.propValues;if(!h||Object.keys(h).length===0)throw new Error(`Invalid discriminated union option at index "${s.options.indexOf(u)}"`);for(const[f,y]of Object.entries(h)){c[f]||(c[f]=new Set);for(const T of y)c[f].add(T)}}return c});const a=ri(()=>{const c=s.options,u=new Map;for(const h of c){const f=h._zod.propValues?.[s.discriminator];if(!f||f.size===0)throw new Error(`Invalid discriminated union option at index "${s.options.indexOf(h)}"`);for(const y of f){if(u.has(y))throw new Error(`Duplicate discriminator value "${String(y)}"`);u.set(y,h)}}return u});e._zod.parse=(c,u)=>{const h=c.value;if(!Cs(h))return c.issues.push({code:"invalid_type",expected:"object",input:h,inst:e}),c;const f=a.value.get(h?.[s.discriminator]);return f?f._zod.run(c,u):s.unionFallback?i(c,u):(c.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:s.discriminator,input:h,path:[s.discriminator],inst:e}),c)}}),Mf=P("$ZodIntersection",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value,u=s.left._zod.run({value:c,issues:[]},a),h=s.right._zod.run({value:c,issues:[]},a);return u instanceof Promise||h instanceof Promise?Promise.all([u,h]).then(([y,T])=>vo(i,y,T)):vo(i,u,h)}});function Fr(e,s){if(e===s)return{valid:!0,data:e};if(e instanceof Date&&s instanceof Date&&+e==+s)return{valid:!0,data:e};if(ts(e)&&ts(s)){const i=Object.keys(s),a=Object.keys(e).filter(u=>i.indexOf(u)!==-1),c={...e,...s};for(const u of a){const h=Fr(e[u],s[u]);if(!h.valid)return{valid:!1,mergeErrorPath:[u,...h.mergeErrorPath]};c[u]=h.data}return{valid:!0,data:c}}if(Array.isArray(e)&&Array.isArray(s)){if(e.length!==s.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let a=0;a<e.length;a++){const c=e[a],u=s[a],h=Fr(c,u);if(!h.valid)return{valid:!1,mergeErrorPath:[a,...h.mergeErrorPath]};i.push(h.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function vo(e,s,i){const a=new Map;let c;for(const f of s.issues)if(f.code==="unrecognized_keys"){c??(c=f);for(const y of f.keys)a.has(y)||a.set(y,{}),a.get(y).l=!0}else e.issues.push(f);for(const f of i.issues)if(f.code==="unrecognized_keys")for(const y of f.keys)a.has(y)||a.set(y,{}),a.get(y).r=!0;else e.issues.push(f);const u=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(u.length&&c&&e.issues.push({...c,keys:u}),is(e))return e;const h=Fr(s.value,i.value);if(!h.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(h.mergeErrorPath)}`);return e.value=h.data,e}const $f=P("$ZodRecord",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value;if(!ts(c))return i.issues.push({expected:"record",code:"invalid_type",input:c,inst:e}),i;const u=[],h=s.keyType._zod.values;if(h){i.value={};const f=new Set;for(const T of h)if(typeof T=="string"||typeof T=="number"||typeof T=="symbol"){f.add(typeof T=="number"?T.toString():T);const I=s.valueType._zod.run({value:c[T],issues:[]},a);I instanceof Promise?u.push(I.then(A=>{A.issues.length&&i.issues.push(...rs(T,A.issues)),i.value[T]=A.value})):(I.issues.length&&i.issues.push(...rs(T,I.issues)),i.value[T]=I.value)}let y;for(const T in c)f.has(T)||(y=y??[],y.push(T));y&&y.length>0&&i.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:y})}else{i.value={};for(const f of Reflect.ownKeys(c)){if(f==="__proto__")continue;let y=s.keyType._zod.run({value:f,issues:[]},a);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&Eo.test(f)&&y.issues.length){const A=s.keyType._zod.run({value:Number(f),issues:[]},a);if(A instanceof Promise)throw new Error("Async schemas not supported in object keys currently");A.issues.length===0&&(y=A)}if(y.issues.length){s.mode==="loose"?i.value[f]=c[f]:i.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(A=>vt(A,a,pt())),input:f,path:[f],inst:e});continue}const I=s.valueType._zod.run({value:c[f],issues:[]},a);I instanceof Promise?u.push(I.then(A=>{A.issues.length&&i.issues.push(...rs(f,A.issues)),i.value[y.value]=A.value})):(I.issues.length&&i.issues.push(...rs(f,I.issues)),i.value[y.value]=I.value)}}return u.length?Promise.all(u).then(()=>i):i}}),Ff=P("$ZodEnum",(e,s)=>{ye.init(e,s);const i=no(s.entries),a=new Set(i);e._zod.values=a,e._zod.pattern=new RegExp(`^(${i.filter(c=>qp.has(typeof c)).map(c=>typeof c=="string"?ss(c):c.toString()).join("|")})$`),e._zod.parse=(c,u)=>{const h=c.value;return a.has(h)||c.issues.push({code:"invalid_value",values:i,input:h,inst:e}),c}}),Bf=P("$ZodLiteral",(e,s)=>{if(ye.init(e,s),s.values.length===0)throw new Error("Cannot create literal schema with no valid values");const i=new Set(s.values);e._zod.values=i,e._zod.pattern=new RegExp(`^(${s.values.map(a=>typeof a=="string"?ss(a):a?ss(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,c)=>{const u=a.value;return i.has(u)||a.issues.push({code:"invalid_value",values:s.values,input:u,inst:e}),a}}),Uf=P("$ZodTransform",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new ro(e.constructor.name);const c=s.transform(i.value,i);if(a.async)return(c instanceof Promise?c:Promise.resolve(c)).then(h=>(i.value=h,i));if(c instanceof Promise)throw new es;return i.value=c,i}});function No(e,s){return e.issues.length&&s===void 0?{issues:[],value:void 0}:e}const Oo=P("$ZodOptional",(e,s)=>{ye.init(e,s),e._zod.optin="optional",e._zod.optout="optional",re(e._zod,"values",()=>s.innerType._zod.values?new Set([...s.innerType._zod.values,void 0]):void 0),re(e._zod,"pattern",()=>{const i=s.innerType._zod.pattern;return i?new RegExp(`^(${Dr(i.source)})?$`):void 0}),e._zod.parse=(i,a)=>{if(s.innerType._zod.optin==="optional"){const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>No(u,i.value)):No(c,i.value)}return i.value===void 0?i:s.innerType._zod.run(i,a)}}),jf=P("$ZodExactOptional",(e,s)=>{Oo.init(e,s),re(e._zod,"values",()=>s.innerType._zod.values),re(e._zod,"pattern",()=>s.innerType._zod.pattern),e._zod.parse=(i,a)=>s.innerType._zod.run(i,a)}),zf=P("$ZodNullable",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.innerType._zod.optin),re(e._zod,"optout",()=>s.innerType._zod.optout),re(e._zod,"pattern",()=>{const i=s.innerType._zod.pattern;return i?new RegExp(`^(${Dr(i.source)}|null)$`):void 0}),re(e._zod,"values",()=>s.innerType._zod.values?new Set([...s.innerType._zod.values,null]):void 0),e._zod.parse=(i,a)=>i.value===null?i:s.innerType._zod.run(i,a)}),Vf=P("$ZodDefault",(e,s)=>{ye.init(e,s),e._zod.optin="optional",re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);if(i.value===void 0)return i.value=s.defaultValue,i;const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>Lo(u,s)):Lo(c,s)}});function Lo(e,s){return e.value===void 0&&(e.value=s.defaultValue),e}const Gf=P("$ZodPrefault",(e,s)=>{ye.init(e,s),e._zod.optin="optional",re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>(a.direction==="backward"||i.value===void 0&&(i.value=s.defaultValue),s.innerType._zod.run(i,a))}),Hf=P("$ZodNonOptional",(e,s)=>{ye.init(e,s),re(e._zod,"values",()=>{const i=s.innerType._zod.values;return i?new Set([...i].filter(a=>a!==void 0)):void 0}),e._zod.parse=(i,a)=>{const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>Do(u,e)):Do(c,e)}});function Do(e,s){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:s}),e}const Zf=P("$ZodCatch",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.innerType._zod.optin),re(e._zod,"optout",()=>s.innerType._zod.optout),re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>(i.value=u.value,u.issues.length&&(i.value=s.catchValue({...i,error:{issues:u.issues.map(h=>vt(h,a,pt()))},input:i.value}),i.issues=[]),i)):(i.value=c.value,c.issues.length&&(i.value=s.catchValue({...i,error:{issues:c.issues.map(u=>vt(u,a,pt()))},input:i.value}),i.issues=[]),i)}}),Wf=P("$ZodPipe",(e,s)=>{ye.init(e,s),re(e._zod,"values",()=>s.in._zod.values),re(e._zod,"optin",()=>s.in._zod.optin),re(e._zod,"optout",()=>s.out._zod.optout),re(e._zod,"propValues",()=>s.in._zod.propValues),e._zod.parse=(i,a)=>{if(a.direction==="backward"){const u=s.out._zod.run(i,a);return u instanceof Promise?u.then(h=>ui(h,s.in,a)):ui(u,s.in,a)}const c=s.in._zod.run(i,a);return c instanceof Promise?c.then(u=>ui(u,s.out,a)):ui(c,s.out,a)}});function ui(e,s,i){return e.issues.length?(e.aborted=!0,e):s._zod.run({value:e.value,issues:e.issues},i)}const Kf=P("$ZodReadonly",(e,s)=>{ye.init(e,s),re(e._zod,"propValues",()=>s.innerType._zod.propValues),re(e._zod,"values",()=>s.innerType._zod.values),re(e._zod,"optin",()=>s.innerType?._zod?.optin),re(e._zod,"optout",()=>s.innerType?._zod?.optout),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(ko):ko(c)}});function ko(e){return e.value=Object.freeze(e.value),e}const qf=P("$ZodCustom",(e,s)=>{Fe.init(e,s),ye.init(e,s),e._zod.parse=(i,a)=>i,e._zod.check=i=>{const a=i.value,c=s.fn(a);if(c instanceof Promise)return c.then(u=>Ro(u,i,a,e));Ro(c,i,a,e)}});function Ro(e,s,i,a){if(!e){const c={code:"custom",input:i,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(c.params=a._zod.def.params),s.issues.push(_s(c))}}var Mo;class Yf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(s,...i){const a=i[0];return this._map.set(s,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,s),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(s){const i=this._map.get(s);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(s),this}get(s){const i=s._zod.parent;if(i){const a={...this.get(i)??{}};delete a.id;const c={...a,...this._map.get(s)};return Object.keys(c).length?c:void 0}return this._map.get(s)}has(s){return this._map.has(s)}}function Xf(){return new Yf}(Mo=globalThis).__zod_globalRegistry??(Mo.__zod_globalRegistry=Xf());const vs=globalThis.__zod_globalRegistry;function Jf(e,s){return new e({type:"string",...U(s)})}function Qf(e,s){return new e({type:"string",format:"email",check:"string_format",abort:!1,...U(s)})}function $o(e,s){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...U(s)})}function em(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...U(s)})}function tm(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(s)})}function sm(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(s)})}function im(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(s)})}function Fo(e,s){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(s)})}function rm(e,s){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...U(s)})}function nm(e,s){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(s)})}function am(e,s){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...U(s)})}function om(e,s){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(s)})}function cm(e,s){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...U(s)})}function lm(e,s){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...U(s)})}function um(e,s){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(s)})}function hm(e,s){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(s)})}function pm(e,s){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(s)})}function dm(e,s){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(s)})}function fm(e,s){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(s)})}function mm(e,s){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...U(s)})}function ym(e,s){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...U(s)})}function gm(e,s){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...U(s)})}function Em(e,s){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...U(s)})}function Tm(e,s){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(s)})}function Sm(e,s){return new e({type:"string",format:"date",check:"string_format",...U(s)})}function bm(e,s){return new e({type:"string",format:"time",check:"string_format",precision:null,...U(s)})}function Im(e,s){return new e({type:"string",format:"duration",check:"string_format",...U(s)})}function xm(e,s){return new e({type:"number",checks:[],...U(s)})}function Am(e,s){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(s)})}function Pm(e,s){return new e({type:"boolean",...U(s)})}function wm(e){return new e({type:"unknown"})}function Cm(e,s){return new e({type:"never",...U(s)})}function Bo(e,s){return new So({check:"less_than",...U(s),value:e,inclusive:!1})}function Br(e,s){return new So({check:"less_than",...U(s),value:e,inclusive:!0})}function Uo(e,s){return new bo({check:"greater_than",...U(s),value:e,inclusive:!1})}function Ur(e,s){return new bo({check:"greater_than",...U(s),value:e,inclusive:!0})}function jo(e,s){return new zd({check:"multiple_of",...U(s),value:e})}function zo(e,s){return new Gd({check:"max_length",...U(s),maximum:e})}function hi(e,s){return new Hd({check:"min_length",...U(s),minimum:e})}function Vo(e,s){return new Zd({check:"length_equals",...U(s),length:e})}function _m(e,s){return new Wd({check:"string_format",format:"regex",...U(s),pattern:e})}function vm(e){return new Kd({check:"string_format",format:"lowercase",...U(e)})}function Nm(e){return new qd({check:"string_format",format:"uppercase",...U(e)})}function Om(e,s){return new Yd({check:"string_format",format:"includes",...U(s),includes:e})}function Lm(e,s){return new Xd({check:"string_format",format:"starts_with",...U(s),prefix:e})}function Dm(e,s){return new Jd({check:"string_format",format:"ends_with",...U(s),suffix:e})}function ns(e){return new Qd({check:"overwrite",tx:e})}function km(e){return ns(s=>s.normalize(e))}function Rm(){return ns(e=>e.trim())}function Mm(){return ns(e=>e.toLowerCase())}function $m(){return ns(e=>e.toUpperCase())}function Fm(){return ns(e=>Wp(e))}function Bm(e,s,i){return new e({type:"array",element:s,...U(i)})}function Um(e,s,i){const a=U(i);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:s,...a})}function jm(e,s,i){return new e({type:"custom",check:"custom",fn:s,...U(i)})}function zm(e){const s=Vm(i=>(i.addIssue=a=>{if(typeof a=="string")i.issues.push(_s(a,i.value,s._zod.def));else{const c=a;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=i.value),c.inst??(c.inst=s),c.continue??(c.continue=!s._zod.def.abort),i.issues.push(_s(c))}},e(i.value,i)));return s}function Vm(e,s){const i=new Fe({check:"custom",...U(s)});return i._zod.check=e,i}function Go(e){let s=e?.target??"draft-2020-12";return s==="draft-4"&&(s="draft-04"),s==="draft-7"&&(s="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??vs,target:s,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function xe(e,s,i={path:[],schemaPath:[]}){var a;const c=e._zod.def,u=s.seen.get(e);if(u)return u.count++,i.schemaPath.includes(e)&&(u.cycle=i.path),u.schema;const h={schema:{},count:1,cycle:void 0,path:i.path};s.seen.set(e,h);const f=e._zod.toJSONSchema?.();if(f)h.schema=f;else{const I={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(s,h.schema,I);else{const L=h.schema,R=s.processors[c.type];if(!R)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${c.type}`);R(e,s,L,I)}const A=e._zod.parent;A&&(h.ref||(h.ref=A),xe(A,s,I),s.seen.get(A).isParent=!0)}const y=s.metadataRegistry.get(e);return y&&Object.assign(h.schema,y),s.io==="input"&&Me(e)&&(delete h.schema.examples,delete h.schema.default),s.io==="input"&&h.schema._prefault&&((a=h.schema).default??(a.default=h.schema._prefault)),delete h.schema._prefault,s.seen.get(e).schema}function Ho(e,s){const i=e.seen.get(s);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const h of e.seen.entries()){const f=e.metadataRegistry.get(h[0])?.id;if(f){const y=a.get(f);if(y&&y!==h[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(f,h[0])}}const c=h=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const A=e.external.registry.get(h[0])?.id,L=e.external.uri??(oe=>oe);if(A)return{ref:L(A)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${L("__shared")}#/${f}/${R}`}}if(h[1]===i)return{ref:"#"};const T=`#/${f}/`,I=h[1].schema.id??`__schema${e.counter++}`;return{defId:I,ref:T+I}},u=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:y,defId:T}=c(h);f.def={...f.schema},T&&(f.defId=T);const I=f.schema;for(const A in I)delete I[A];I.$ref=y};if(e.cycles==="throw")for(const h of e.seen.entries()){const f=h[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
|
|
38
38
|
|
|
39
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const f=h[1];if(s===h[0]){u(h);continue}if(e.external){const T=e.external.registry.get(h[0])?.id;if(s!==h[0]&&T){u(h);continue}}if(e.metadataRegistry.get(h[0])?.id){u(h);continue}if(f.cycle){u(h);continue}if(f.count>1&&e.reused==="ref"){u(h);continue}}}function Vo(e,s){const i=e.seen.get(s);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const f=e.seen.get(h);if(f.ref===null)return;const y=f.def??f.schema,T={...y},x=f.ref;if(f.ref=null,x){a(x);const L=e.seen.get(x),R=L.schema;if(R.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(y.allOf=y.allOf??[],y.allOf.push(R)):Object.assign(y,R),Object.assign(y,T),h._zod.parent===x)for(const ce in y)ce==="$ref"||ce==="allOf"||ce in T||delete y[ce];if(R.$ref&&L.def)for(const ce in y)ce==="$ref"||ce==="allOf"||ce in L.def&&JSON.stringify(y[ce])===JSON.stringify(L.def[ce])&&delete y[ce]}const P=h._zod.parent;if(P&&P!==x){a(P);const L=e.seen.get(P);if(L?.schema.$ref&&(y.$ref=L.schema.$ref,L.def))for(const R in y)R==="$ref"||R==="allOf"||R in L.def&&JSON.stringify(y[R])===JSON.stringify(L.def[R])&&delete y[R]}e.override({zodSchema:h,jsonSchema:y,path:f.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const c={};if(e.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?c.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?c.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const h=e.external.registry.get(s)?.id;if(!h)throw new Error("Schema is missing an `id` property");c.$id=e.external.uri(h)}Object.assign(c,i.def??i.schema);const u=e.external?.defs??{};for(const h of e.seen.entries()){const f=h[1];f.def&&f.defId&&(u[f.defId]=f.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{const h=JSON.parse(JSON.stringify(c));return Object.defineProperty(h,"~standard",{value:{...s["~standard"],jsonSchema:{input:ui(s,"input",e.processors),output:ui(s,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Me(e,s){const i=s??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return Me(a.element,i);if(a.type==="set")return Me(a.valueType,i);if(a.type==="lazy")return Me(a.getter(),i);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return Me(a.innerType,i);if(a.type==="intersection")return Me(a.left,i)||Me(a.right,i);if(a.type==="record"||a.type==="map")return Me(a.keyType,i)||Me(a.valueType,i);if(a.type==="pipe")return Me(a.in,i)||Me(a.out,i);if(a.type==="object"){for(const c in a.shape)if(Me(a.shape[c],i))return!0;return!1}if(a.type==="union"){for(const c of a.options)if(Me(c,i))return!0;return!1}if(a.type==="tuple"){for(const c of a.items)if(Me(c,i))return!0;return!!(a.rest&&Me(a.rest,i))}return!1}const Um=(e,s={})=>i=>{const a=jo({...i,processors:s});return Ie(e,a),zo(a,e),Vo(a,e)},ui=(e,s,i={})=>a=>{const{libraryOptions:c,target:u}=a??{},h=jo({...c??{},target:u,io:s,processors:i});return Ie(e,h),zo(h,e),Vo(h,e)},jm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zm=(e,s,i,a)=>{const c=i;c.type="string";const{minimum:u,maximum:h,format:f,patterns:y,contentEncoding:T}=e._zod.bag;if(typeof u=="number"&&(c.minLength=u),typeof h=="number"&&(c.maxLength=h),f&&(c.format=jm[f]??f,c.format===""&&delete c.format,f==="time"&&delete c.format),T&&(c.contentEncoding=T),y&&y.size>0){const x=[...y];x.length===1?c.pattern=x[0].source:x.length>1&&(c.allOf=[...x.map(P=>({...s.target==="draft-07"||s.target==="draft-04"||s.target==="openapi-3.0"?{type:"string"}:{},pattern:P.source}))])}},Vm=(e,s,i,a)=>{const c=i,{minimum:u,maximum:h,format:f,multipleOf:y,exclusiveMaximum:T,exclusiveMinimum:x}=e._zod.bag;typeof f=="string"&&f.includes("int")?c.type="integer":c.type="number",typeof x=="number"&&(s.target==="draft-04"||s.target==="openapi-3.0"?(c.minimum=x,c.exclusiveMinimum=!0):c.exclusiveMinimum=x),typeof u=="number"&&(c.minimum=u,typeof x=="number"&&s.target!=="draft-04"&&(x>=u?delete c.minimum:delete c.exclusiveMinimum)),typeof T=="number"&&(s.target==="draft-04"||s.target==="openapi-3.0"?(c.maximum=T,c.exclusiveMaximum=!0):c.exclusiveMaximum=T),typeof h=="number"&&(c.maximum=h,typeof T=="number"&&s.target!=="draft-04"&&(T<=h?delete c.maximum:delete c.exclusiveMaximum)),typeof y=="number"&&(c.multipleOf=y)},Gm=(e,s,i,a)=>{i.type="boolean"},Hm=(e,s,i,a)=>{i.not={}},Zm=(e,s,i,a)=>{},Wm=(e,s,i,a)=>{const c=e._zod.def,u=so(c.entries);u.every(h=>typeof h=="number")&&(i.type="number"),u.every(h=>typeof h=="string")&&(i.type="string"),i.enum=u},Km=(e,s,i,a)=>{const c=e._zod.def,u=[];for(const h of c.values)if(h===void 0){if(s.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h=="bigint"){if(s.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");u.push(Number(h))}else u.push(h);if(u.length!==0)if(u.length===1){const h=u[0];i.type=h===null?"null":typeof h,s.target==="draft-04"||s.target==="openapi-3.0"?i.enum=[h]:i.const=h}else u.every(h=>typeof h=="number")&&(i.type="number"),u.every(h=>typeof h=="string")&&(i.type="string"),u.every(h=>typeof h=="boolean")&&(i.type="boolean"),u.every(h=>h===null)&&(i.type="null"),i.enum=u},qm=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ym=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Jm=(e,s,i,a)=>{const c=i,u=e._zod.def,{minimum:h,maximum:f}=e._zod.bag;typeof h=="number"&&(c.minItems=h),typeof f=="number"&&(c.maxItems=f),c.type="array",c.items=Ie(u.element,s,{...a,path:[...a.path,"items"]})},Xm=(e,s,i,a)=>{const c=i,u=e._zod.def;c.type="object",c.properties={};const h=u.shape;for(const T in h)c.properties[T]=Ie(h[T],s,{...a,path:[...a.path,"properties",T]});const f=new Set(Object.keys(h)),y=new Set([...f].filter(T=>{const x=u.shape[T]._zod;return s.io==="input"?x.optin===void 0:x.optout===void 0}));y.size>0&&(c.required=Array.from(y)),u.catchall?._zod.def.type==="never"?c.additionalProperties=!1:u.catchall?u.catchall&&(c.additionalProperties=Ie(u.catchall,s,{...a,path:[...a.path,"additionalProperties"]})):s.io==="output"&&(c.additionalProperties=!1)},Qm=(e,s,i,a)=>{const c=e._zod.def,u=c.inclusive===!1,h=c.options.map((f,y)=>Ie(f,s,{...a,path:[...a.path,u?"oneOf":"anyOf",y]}));u?i.oneOf=h:i.anyOf=h},ey=(e,s,i,a)=>{const c=e._zod.def,u=Ie(c.left,s,{...a,path:[...a.path,"allOf",0]}),h=Ie(c.right,s,{...a,path:[...a.path,"allOf",1]}),f=T=>"allOf"in T&&Object.keys(T).length===1,y=[...f(u)?u.allOf:[u],...f(h)?h.allOf:[h]];i.allOf=y},ty=(e,s,i,a)=>{const c=i,u=e._zod.def;c.type="object";const h=u.keyType,y=h._zod.bag?.patterns;if(u.mode==="loose"&&y&&y.size>0){const x=Ie(u.valueType,s,{...a,path:[...a.path,"patternProperties","*"]});c.patternProperties={};for(const P of y)c.patternProperties[P.source]=x}else(s.target==="draft-07"||s.target==="draft-2020-12")&&(c.propertyNames=Ie(u.keyType,s,{...a,path:[...a.path,"propertyNames"]})),c.additionalProperties=Ie(u.valueType,s,{...a,path:[...a.path,"additionalProperties"]});const T=h._zod.values;if(T){const x=[...T].filter(P=>typeof P=="string"||typeof P=="number");x.length>0&&(c.required=x)}},sy=(e,s,i,a)=>{const c=e._zod.def,u=Ie(c.innerType,s,a),h=s.seen.get(e);s.target==="openapi-3.0"?(h.ref=c.innerType,i.nullable=!0):i.anyOf=[u,{type:"null"}]},iy=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType},ry=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,i.default=JSON.parse(JSON.stringify(c.defaultValue))},ny=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,s.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(c.defaultValue)))},ay=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType;let h;try{h=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=h},oy=(e,s,i,a)=>{const c=e._zod.def,u=s.io==="input"?c.in._zod.def.type==="transform"?c.out:c.in:c.out;Ie(u,s,a);const h=s.seen.get(e);h.ref=u},cy=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,i.readOnly=!0},Go=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType},ly=w("ZodISODateTime",(e,s)=>{uf.init(e,s),Ee.init(e,s)});function uy(e){return mm(ly,e)}const hy=w("ZodISODate",(e,s)=>{hf.init(e,s),Ee.init(e,s)});function py(e){return ym(hy,e)}const dy=w("ZodISOTime",(e,s)=>{pf.init(e,s),Ee.init(e,s)});function fy(e){return gm(dy,e)}const my=w("ZodISODuration",(e,s)=>{df.init(e,s),Ee.init(e,s)});function yy(e){return Em(my,e)}const gy=(e,s)=>{co.init(e,s),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>sd(e,i)},flatten:{value:i=>td(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,Nr,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,Nr,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ke=w("ZodError",gy,{Parent:Error}),Ey=kr(Ke),Ty=Dr(Ke),Sy=ri(Ke),by=ni(Ke),xy=nd(Ke),Iy=ad(Ke),Py=od(Ke),wy=cd(Ke),Ay=ld(Ke),Cy=ud(Ke),vy=hd(Ke),Ny=pd(Ke),ge=w("ZodType",(e,s)=>(ye.init(e,s),Object.assign(e["~standard"],{jsonSchema:{input:ui(e,"input"),output:ui(e,"output")}}),e.toJSONSchema=Um(e,{}),e.def=s,e.type=s.type,Object.defineProperty(e,"_def",{value:s}),e.check=(...i)=>e.clone(Ct(s,{checks:[...s.checks??[],...i.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(i,a)=>vt(e,i,a),e.brand=()=>e,e.register=((i,a)=>(i.add(e,a),e)),e.parse=(i,a)=>Ey(e,i,a,{callee:e.parse}),e.safeParse=(i,a)=>Sy(e,i,a),e.parseAsync=async(i,a)=>Ty(e,i,a,{callee:e.parseAsync}),e.safeParseAsync=async(i,a)=>by(e,i,a),e.spa=e.safeParseAsync,e.encode=(i,a)=>xy(e,i,a),e.decode=(i,a)=>Iy(e,i,a),e.encodeAsync=async(i,a)=>Py(e,i,a),e.decodeAsync=async(i,a)=>wy(e,i,a),e.safeEncode=(i,a)=>Ay(e,i,a),e.safeDecode=(i,a)=>Cy(e,i,a),e.safeEncodeAsync=async(i,a)=>vy(e,i,a),e.safeDecodeAsync=async(i,a)=>Ny(e,i,a),e.refine=(i,a)=>e.check(bg(i,a)),e.superRefine=i=>e.check(xg(i)),e.overwrite=i=>e.check(is(i)),e.optional=()=>Qo(e),e.exactOptional=()=>lg(e),e.nullable=()=>ec(e),e.nullish=()=>Qo(ec(e)),e.nonoptional=i=>mg(e,i),e.array=()=>ne(e),e.or=i=>eg([e,i]),e.and=i=>ig(e,i),e.transform=i=>sc(e,og(i)),e.default=i=>pg(e,i),e.prefault=i=>fg(e,i),e.catch=i=>gg(e,i),e.pipe=i=>sc(e,i),e.readonly=()=>Sg(e),e.describe=i=>{const a=e.clone();return Cs.add(a,{description:i}),a},Object.defineProperty(e,"description",{get(){return Cs.get(e)?.description},configurable:!0}),e.meta=(...i)=>{if(i.length===0)return Cs.get(e);const a=e.clone();return Cs.add(a,i[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=i=>i(e),e)),Ho=w("_ZodString",(e,s)=>{Rr.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>zm(e,a,c);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,e.regex=(...a)=>e.check(Pm(...a)),e.includes=(...a)=>e.check(Cm(...a)),e.startsWith=(...a)=>e.check(vm(...a)),e.endsWith=(...a)=>e.check(Nm(...a)),e.min=(...a)=>e.check(li(...a)),e.max=(...a)=>e.check(Bo(...a)),e.length=(...a)=>e.check(Uo(...a)),e.nonempty=(...a)=>e.check(li(1,...a)),e.lowercase=a=>e.check(wm(a)),e.uppercase=a=>e.check(Am(a)),e.trim=()=>e.check(Om()),e.normalize=(...a)=>e.check(_m(...a)),e.toLowerCase=()=>e.check(Lm()),e.toUpperCase=()=>e.check(km()),e.slugify=()=>e.check(Dm())}),_y=w("ZodString",(e,s)=>{Rr.init(e,s),Ho.init(e,s),e.email=i=>e.check(qf(Oy,i)),e.url=i=>e.check(Ro(Wo,i)),e.jwt=i=>e.check(fm(Zy,i)),e.emoji=i=>e.check(em(Ly,i)),e.guid=i=>e.check(Do(Zo,i)),e.uuid=i=>e.check(Yf(hi,i)),e.uuidv4=i=>e.check(Jf(hi,i)),e.uuidv6=i=>e.check(Xf(hi,i)),e.uuidv7=i=>e.check(Qf(hi,i)),e.nanoid=i=>e.check(tm(ky,i)),e.guid=i=>e.check(Do(Zo,i)),e.cuid=i=>e.check(sm(Dy,i)),e.cuid2=i=>e.check(im(Ry,i)),e.ulid=i=>e.check(rm(My,i)),e.base64=i=>e.check(hm(Vy,i)),e.base64url=i=>e.check(pm(Gy,i)),e.xid=i=>e.check(nm($y,i)),e.ksuid=i=>e.check(am(Fy,i)),e.ipv4=i=>e.check(om(By,i)),e.ipv6=i=>e.check(cm(Uy,i)),e.cidrv4=i=>e.check(lm(jy,i)),e.cidrv6=i=>e.check(um(zy,i)),e.e164=i=>e.check(dm(Hy,i)),e.datetime=i=>e.check(uy(i)),e.date=i=>e.check(py(i)),e.time=i=>e.check(fy(i)),e.duration=i=>e.check(yy(i))});function O(e){return Kf(_y,e)}const Ee=w("ZodStringFormat",(e,s)=>{pe.init(e,s),Ho.init(e,s)}),Oy=w("ZodEmail",(e,s)=>{ef.init(e,s),Ee.init(e,s)}),Zo=w("ZodGUID",(e,s)=>{Xd.init(e,s),Ee.init(e,s)}),hi=w("ZodUUID",(e,s)=>{Qd.init(e,s),Ee.init(e,s)}),Wo=w("ZodURL",(e,s)=>{tf.init(e,s),Ee.init(e,s)});function Ko(e){return Ro(Wo,e)}const Ly=w("ZodEmoji",(e,s)=>{sf.init(e,s),Ee.init(e,s)}),ky=w("ZodNanoID",(e,s)=>{rf.init(e,s),Ee.init(e,s)}),Dy=w("ZodCUID",(e,s)=>{nf.init(e,s),Ee.init(e,s)}),Ry=w("ZodCUID2",(e,s)=>{af.init(e,s),Ee.init(e,s)}),My=w("ZodULID",(e,s)=>{of.init(e,s),Ee.init(e,s)}),$y=w("ZodXID",(e,s)=>{cf.init(e,s),Ee.init(e,s)}),Fy=w("ZodKSUID",(e,s)=>{lf.init(e,s),Ee.init(e,s)}),By=w("ZodIPv4",(e,s)=>{ff.init(e,s),Ee.init(e,s)}),Uy=w("ZodIPv6",(e,s)=>{mf.init(e,s),Ee.init(e,s)}),jy=w("ZodCIDRv4",(e,s)=>{yf.init(e,s),Ee.init(e,s)}),zy=w("ZodCIDRv6",(e,s)=>{gf.init(e,s),Ee.init(e,s)}),Vy=w("ZodBase64",(e,s)=>{Ef.init(e,s),Ee.init(e,s)}),Gy=w("ZodBase64URL",(e,s)=>{Sf.init(e,s),Ee.init(e,s)}),Hy=w("ZodE164",(e,s)=>{bf.init(e,s),Ee.init(e,s)}),Zy=w("ZodJWT",(e,s)=>{If.init(e,s),Ee.init(e,s)}),qo=w("ZodNumber",(e,s)=>{So.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Vm(e,a,c),e.gt=(a,c)=>e.check($o(a,c)),e.gte=(a,c)=>e.check(Fr(a,c)),e.min=(a,c)=>e.check(Fr(a,c)),e.lt=(a,c)=>e.check(Mo(a,c)),e.lte=(a,c)=>e.check($r(a,c)),e.max=(a,c)=>e.check($r(a,c)),e.int=a=>e.check(at(a)),e.safe=a=>e.check(at(a)),e.positive=a=>e.check($o(0,a)),e.nonnegative=a=>e.check(Fr(0,a)),e.negative=a=>e.check(Mo(0,a)),e.nonpositive=a=>e.check($r(0,a)),e.multipleOf=(a,c)=>e.check(Fo(a,c)),e.step=(a,c)=>e.check(Fo(a,c)),e.finite=()=>e;const i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function pi(e){return Tm(qo,e)}const Wy=w("ZodNumberFormat",(e,s)=>{Pf.init(e,s),qo.init(e,s)});function at(e){return Sm(Wy,e)}const Ky=w("ZodBoolean",(e,s)=>{wf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Gm(e,i,a)});function te(e){return bm(Ky,e)}const qy=w("ZodUnknown",(e,s)=>{Af.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Zm()});function Yo(){return xm(qy)}const Yy=w("ZodNever",(e,s)=>{Cf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Hm(e,i,a)});function Jy(e){return Im(Yy,e)}const Xy=w("ZodArray",(e,s)=>{vf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Jm(e,i,a,c),e.element=s.element,e.min=(i,a)=>e.check(li(i,a)),e.nonempty=i=>e.check(li(1,i)),e.max=(i,a)=>e.check(Bo(i,a)),e.length=(i,a)=>e.check(Uo(i,a)),e.unwrap=()=>e.element});function ne(e,s){return Rm(Xy,e,s)}const Qy=w("ZodObject",(e,s)=>{_f.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Xm(e,i,a,c),re(e,"shape",()=>s.shape),e.keyof=()=>de(Object.keys(e._zod.def.shape)),e.catchall=i=>e.clone({...e._zod.def,catchall:i}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Yo()}),e.loose=()=>e.clone({...e._zod.def,catchall:Yo()}),e.strict=()=>e.clone({...e._zod.def,catchall:Jy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=i=>Yp(e,i),e.safeExtend=i=>Jp(e,i),e.merge=i=>Xp(e,i),e.pick=i=>Kp(e,i),e.omit=i=>qp(e,i),e.partial=(...i)=>Qp(Xo,e,i[0]),e.required=(...i)=>ed(tc,e,i[0])});function A(e,s){const i={type:"object",shape:e??{},...U(s)};return new Qy(i)}const Jo=w("ZodUnion",(e,s)=>{wo.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Qm(e,i,a,c),e.options=s.options});function eg(e,s){return new Jo({type:"union",options:e,...U(s)})}const tg=w("ZodDiscriminatedUnion",(e,s)=>{Jo.init(e,s),Of.init(e,s)});function Ve(e,s,i){return new tg({type:"union",options:s,discriminator:e,...U(i)})}const sg=w("ZodIntersection",(e,s)=>{Lf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ey(e,i,a,c)});function ig(e,s){return new sg({type:"intersection",left:e,right:s})}const rg=w("ZodRecord",(e,s)=>{kf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ty(e,i,a,c),e.keyType=s.keyType,e.valueType=s.valueType});function Oe(e,s,i){return new rg({type:"record",keyType:e,valueType:s,...U(i)})}const Br=w("ZodEnum",(e,s)=>{Df.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Wm(e,a,c),e.enum=s.entries,e.options=Object.values(s.entries);const i=new Set(Object.keys(s.entries));e.extract=(a,c)=>{const u={};for(const h of a)if(i.has(h))u[h]=s.entries[h];else throw new Error(`Key ${h} not found in enum`);return new Br({...s,checks:[],...U(c),entries:u})},e.exclude=(a,c)=>{const u={...s.entries};for(const h of a)if(i.has(h))delete u[h];else throw new Error(`Key ${h} not found in enum`);return new Br({...s,checks:[],...U(c),entries:u})}});function de(e,s){const i=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Br({type:"enum",entries:i,...U(s)})}const ng=w("ZodLiteral",(e,s)=>{Rf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Km(e,i,a),e.values=new Set(s.values),Object.defineProperty(e,"value",{get(){if(s.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return s.values[0]}})});function k(e,s){return new ng({type:"literal",values:Array.isArray(e)?e:[e],...U(s)})}const ag=w("ZodTransform",(e,s)=>{Mf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Ym(e,i),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new to(e.constructor.name);i.addIssue=u=>{if(typeof u=="string")i.issues.push(As(u,i.value,s));else{const h=u;h.fatal&&(h.continue=!1),h.code??(h.code="custom"),h.input??(h.input=i.value),h.inst??(h.inst=e),i.issues.push(As(h))}};const c=s.transform(i.value,i);return c instanceof Promise?c.then(u=>(i.value=u,i)):(i.value=c,i)}});function og(e){return new ag({type:"transform",transform:e})}const Xo=w("ZodOptional",(e,s)=>{vo.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Go(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function Qo(e){return new Xo({type:"optional",innerType:e})}const cg=w("ZodExactOptional",(e,s)=>{$f.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Go(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function lg(e){return new cg({type:"optional",innerType:e})}const ug=w("ZodNullable",(e,s)=>{Ff.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>sy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function ec(e){return new ug({type:"nullable",innerType:e})}const hg=w("ZodDefault",(e,s)=>{Bf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ry(e,i,a,c),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pg(e,s){return new hg({type:"default",innerType:e,get defaultValue(){return typeof s=="function"?s():ao(s)}})}const dg=w("ZodPrefault",(e,s)=>{Uf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ny(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function fg(e,s){return new dg({type:"prefault",innerType:e,get defaultValue(){return typeof s=="function"?s():ao(s)}})}const tc=w("ZodNonOptional",(e,s)=>{jf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>iy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function mg(e,s){return new tc({type:"nonoptional",innerType:e,...U(s)})}const yg=w("ZodCatch",(e,s)=>{zf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ay(e,i,a,c),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gg(e,s){return new yg({type:"catch",innerType:e,catchValue:typeof s=="function"?s:()=>s})}const Eg=w("ZodPipe",(e,s)=>{Vf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>oy(e,i,a,c),e.in=s.in,e.out=s.out});function sc(e,s){return new Eg({type:"pipe",in:e,out:s})}const Tg=w("ZodReadonly",(e,s)=>{Gf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>cy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function Sg(e){return new Tg({type:"readonly",innerType:e})}const ic=w("ZodCustom",(e,s)=>{Hf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>qm(e,i)});function rs(e,s){return Mm(ic,e??(()=>!0),s)}function bg(e,s={}){return $m(ic,e,s)}function xg(e){return Fm(e)}const dt={SCROLL_TO_TILE:"SCROLL_TO_TILE",HYPER_LINK:"HYPER_LINK",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"},Ig=de(Object.values(dt)),di=dt,vs={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"},Pg=de(Object.values(vs)),fi=vs,rc={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"},wg=de(Object.values(rc)),Ag=rc,nc={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"},Cg=de(Object.values(nc)),vg=nc,ac={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"},Ng=de(Object.values(ac)),_g=ac,mi={COLOR:"COLOR",GRADIENT:"GRADIENT"},Og=de(Object.values(mi)),Ur=mi,$t={SECTION:"SECTION",HEADER:"HEADER",FOOTER:"FOOTER"},Lg=de(Object.values($t)),ft=$t;var Ge=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(Ge||{}),he=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e[e.CollectionDescriptor=14]="CollectionDescriptor",e[e.CollectionAsset=15]="CollectionAsset",e))(he||{}),kg=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(kg||{});const F={TEXTAREA:"TEXTAREA",INPUTBOX:"INPUTBOX",SELECTBOX:"SELECTBOX",IMAGE:"IMAGE",TOGGLE:"TOGGLE",BUTTON:"BUTTON",DECK:"DECK",MENU:"MENU",NAVIGATION_MENU:"NAVIGATION_MENU",LOGO:"LOGO",INFO:"INFO",DIVIDER:"DIVIDER",PRODUCT_SELECTOR:"PRODUCT_SELECTOR",CATEGORY_SELECTOR:"CATEGORY_SELECTOR"};de(Object.values(F));const K={TEXT:"TEXT",BUTTON:"BUTTON",IMAGE:"IMAGE",TOGGLE:"TOGGLE",SELECTBOX:"SELECTBOX",BACKGROUND:"BACKGROUND",COLOR_PICKER:"COLOR_PICKER",LOGO:"LOGO",DIVIDER:"DIVIDER",INFO:"INFO",ACCORDION:"ACCORDION"};de(Object.values(K));const He=K,Ns={CONTENT:"Content",DESIGN:"Design"};de(Object.values(Ns));const Dg={TEXT:"TEXT",IMAGE:"IMAGE"},Rg=de(Object.values(Dg));var Mg=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(Mg||{}),$g=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))($g||{});const oc={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},cc={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},lc={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"};de(Object.values(oc)),de(Object.values(cc)),de(Object.values(lc));const Fg={TOP_BAR:["breadcrumbsPosition","showNavigationArrows"],GALLERY:["galleryLayout","showProductPhotoZoom","showAltTextAsDescription"],SIDEBAR:["showWeight","showAttributes","showProductDescription","showProductSku","showInStockLabel","showNumberOfItemsInStock","showQuantity","optionSize","optionShape","showOutlets","showDeliveryTime","showWholesalePrices","showReviewSection","favoritesEnabled","showShareButtons","showLoyalty","breadcrumbsPosition"],DESCRIPTION:["showWeight","showAttributes","showProductDescription"],REVIEW_LIST:["showReviewSection","showReviewsSectionInOneCardView"],RELATED_PRODUCTS:[],BOTTOM_BAR:[],CUSTOM_SLOT:[]},uc=["categoryViewMode","productFiltersVisibleOnCatalogPages","productFiltersPositionOnCatalogPages","productFiltersOpenedByDefaultOnCategoryPage","productFiltersOrientationPosition","showSortViewAsOptions","productCardSpacingType","productCardLayout","imageAspectRatio","imageSize","productTitleBehavior","productSubtitleBehavior","productPriceBehavior","productListSwatchesProductOptionBehavior","productSkuBehavior","productBuyButtonBehavior","productRatingSectionBehavior","productRatingViewBehavior","showProductRatingAvg","showProductTotalNumberOfReview","showProductFrame","showProductImages","showAdditionalImageOnHover","categoryTitleBehavior"],hc=["showFooterMenu","showSigninLink"],Bg={PRODUCT_LIST:uc,BOTTOM_BAR:hc,CUSTOM_SLOT:[]},Ug={CATEGORY_TITLE:[],PRODUCT_LIST:uc,BOTTOM_BAR:hc,CUSTOM_SLOT:[]},jg={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"},zg=de(Object.values(jg)),we={[ft.SECTION]:{source:"sections",dist:"dist/sections"},[ft.HEADER]:{source:"headers",dist:"dist/headers"},[ft.FOOTER]:{source:"footers",dist:"dist/footers"}};var se=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e[e.SourceCode=7]="SourceCode",e[e.LayoutClient=8]="LayoutClient",e[e.LayoutAsset=9]="LayoutAsset",e[e.SlotServer=10]="SlotServer",e[e.SlotClient=11]="SlotClient",e[e.SlotClientChunks=12]="SlotClientChunks",e[e.SlotClientAsset=13]="SlotClientAsset",e[e.CollectionAsset=14]="CollectionAsset",e))(se||{});function ns(e){const s={};for(const[i,a]of Object.entries(e)){let c={...a};if(a.type==="DECK"&&a.cards&&typeof a.cards=="object"&&"defaultCardContent"in a.cards){const u=a.cards;u.defaultCardContent?.settings&&(c={...c,cards:{...u,defaultCardContent:{...u.defaultCardContent,settings:ns(u.defaultCardContent.settings)}}})}if(a.type==="ACCORDION"&&a.cards&&typeof a.cards=="object"&&!("defaultCardContent"in a.cards)){const u=a.cards,h={};for(const[f,y]of Object.entries(u))y.editors?h[f]={...y,editors:ns(y.editors)}:h[f]=y;c={...c,cards:h}}if(c.defaults&&typeof c.defaults=="object"&&!("type"in c.defaults)){const u=Object.assign({type:c.type},c.defaults);c={...c,defaults:u}}s[i]=c}return s}const Vg={url:"must be a valid URL",email:"must be a valid email address"},Gg=e=>{const s=e?.at(-1);return typeof s=="string"?`'${s}'`:"Field"},Hg=e=>e===null?"null":typeof e,Zg=e=>{switch(e.code){case"invalid_type":{const{input:s}=e;return s===void 0?{message:`${Gg(e.path)} is required`}:{message:`Expected ${String(e.expected)}, received ${Hg(s)}`}}case"invalid_format":{const s=Vg[e.format];return s?{message:s}:void 0}case"unrecognized_keys":return{message:`Unrecognized property: ${e.keys.map(s=>`'${s}'`).join(", ")}`};case"invalid_union":{const s=e.path?.at(-1);return typeof s=="string"?{message:`'${s}' is required or has invalid value`}:void 0}case"invalid_value":{const{values:s}=e;return s?{message:`Expected one of: ${s.map(i=>`'${String(i)}'`).join(", ")}`}:void 0}case"invalid_key":{const s=e.issues?.[0];return s?{message:s.message}:void 0}default:return}};de(["none","all","small"]);const Ft={PRODUCT:"PRODUCT",CATALOG:"CATALOG",CATEGORY:"CATEGORY",HOME:"HOME",CUSTOM:"CUSTOM"},pc={HOME:"home",CATALOG:"catalog",CATEGORY:"category",PRODUCT:"product"},Wg=de(Object.values(Ft));de(Object.values(pc));const Kg={HEADER_LEFT:"HEADER_LEFT",HEADER_CENTER_LOGO_BURGER:"HEADER_CENTER_LOGO_BURGER",HEADER_CENTER_LOGO_COMPACT:"HEADER_CENTER_LOGO_COMPACT",HEADER_CENTER_LOGO_DETAILED:"HEADER_CENTER_LOGO_DETAILED",HEADER_LEFT_LOGO_BURGER:"HEADER_LEFT_LOGO_BURGER",HEADER_LEFT_LOGO_COMPACT:"HEADER_LEFT_LOGO_COMPACT",HEADER_LEFT_LOGO_DETAILED:"HEADER_LEFT_LOGO_DETAILED",HEADER_LEFT_LOGO_SEARCH:"HEADER_LEFT_LOGO_SEARCH",HEADER_LEFT_LOGO_TEXT:"HEADER_LEFT_LOGO_TEXT",TEXT_ONE_COLUMN:"TEXT_ONE_COLUMN",TEXT_TITLE_LEFT:"TEXT_TITLE_LEFT",TEXT_SUBTITLE_RIGHT:"TEXT_SUBTITLE_RIGHT",TEXT_TWO_COLUMNS:"TEXT_TWO_COLUMNS",TEXT_CENTER:"TEXT_CENTER",TEXT_DESCRIPTION_RIGHT:"TEXT_DESCRIPTION_RIGHT",CTA_BANNER_LEFT:"CTA_BANNER_LEFT",CTA_BANNER_RIGHT:"CTA_BANNER_RIGHT",CTA_BANNER_CENTER:"CTA_BANNER_CENTER",CTA_BANNER_BOTTOM:"CTA_BANNER_BOTTOM",CTA_PROMO_BAR_LEFT:"CTA_PROMO_BAR_LEFT",CTA_PROMO_BAR_RIGHT:"CTA_PROMO_BAR_RIGHT",CTA_STORY_LEFT:"CTA_STORY_LEFT",CTA_STORY_RIGHT:"CTA_STORY_RIGHT",CTA_FULLWIDTH_CENTER:"CTA_FULLWIDTH_CENTER",CTA_FULLWIDTH_LEFT:"CTA_FULLWIDTH_LEFT",CTA_FULLWIDTH_NO_IMAGE:"CTA_FULLWIDTH_NO_IMAGE",COVER_FULLSCREEN_CENTER:"COVER_FULLSCREEN_CENTER",COVER_FULLSCREEN_LEFT:"COVER_FULLSCREEN_LEFT",COVER_FULLSCREEN_CENTER_LEFT:"COVER_FULLSCREEN_CENTER_LEFT",COVER_FULLSCREEN_RIGHT:"COVER_FULLSCREEN_RIGHT",COVER_FULLSCREEN_BOTTOM:"COVER_FULLSCREEN_BOTTOM",COVER_FULLSCREEN_BOTTOM_RIGHT:"COVER_FULLSCREEN_BOTTOM_RIGHT",COVER_FULLSCREEN_BOTTOM_LEFT:"COVER_FULLSCREEN_BOTTOM_LEFT",COVER_FULLSCREEN_TOP:"COVER_FULLSCREEN_TOP",COVER_SIDEBAR_RIGHT:"COVER_SIDEBAR_RIGHT",COVER_SIDEBAR_LEFT:"COVER_SIDEBAR_LEFT",COVER_HALFSCREEN_LEFT:"COVER_HALFSCREEN_LEFT",COVER_HALFSCREEN_CENTER:"COVER_HALFSCREEN_CENTER",COVER_COLLAGE_BOTTOM:"COVER_COLLAGE_BOTTOM",COVER_COLLAGE_LEFT:"COVER_COLLAGE_LEFT",IMAGE_SUBTITLE_RIGHT:"IMAGE_SUBTITLE_RIGHT",IMAGE_TITLE_LEFT:"IMAGE_TITLE_LEFT",IMAGE_LEFT:"IMAGE_LEFT",IMAGE_RIGHT:"IMAGE_RIGHT",IMAGE_CENTER:"IMAGE_CENTER",IMAGE_SIDE_TITLE:"IMAGE_SIDE_TITLE",LOCATION_MAP_RIGHT:"LOCATION_MAP_RIGHT",LOCATION_MAP_LEFT:"LOCATION_MAP_LEFT",LOCATION_IMAGE_RIGHT:"LOCATION_IMAGE_RIGHT",LOCATION_IMAGE_LEFT:"LOCATION_IMAGE_LEFT",LOCATION_BACKGROUND_RIGHT:"LOCATION_BACKGROUND_RIGHT",LOCATION_BACKGROUND_LEFT:"LOCATION_BACKGROUND_LEFT",LOCATION_FULL:"LOCATION_FULL",LOCATION_SHORT:"LOCATION_SHORT",REVIEWS_MINIMAL:"REVIEWS_MINIMAL",REVIEWS_CARDS:"REVIEWS_CARDS",REVIEWS:"REVIEWS",REVIEWS_CLASSIC:"REVIEWS_CLASSIC",REVIEWS_FULLSCREEN_BG:"REVIEWS_FULLSCREEN_BG",REVIEWS_FULLSCREEN_SIDEBAR_LEFT:"REVIEWS_FULLSCREEN_SIDEBAR_LEFT",REVIEWS_FULLSCREEN_SIDEBAR_RIGHT:"REVIEWS_FULLSCREEN_SIDEBAR_RIGHT",REVIEWS_CARDS_PHOTO:"REVIEWS_CARDS_PHOTO",REVIEWS_PHOTO_SPEECH_RIGHT:"REVIEWS_PHOTO_SPEECH_RIGHT",REVIEWS_PHOTO_SPEECH_LEFT:"REVIEWS_PHOTO_SPEECH_LEFT",REVIEWS_SOCIAL_FEED:"REVIEWS_SOCIAL_FEED",REVIEWS_ADAPTIVE:"REVIEWS_ADAPTIVE",FEATURES_CLASSIC_CENTER:"FEATURES_CLASSIC_CENTER",FEATURES_CLASSIC_LEFT:"FEATURES_CLASSIC_LEFT",FEATURES_ACCORDION:"FEATURES_ACCORDION",FEATURES_MINIMAL:"FEATURES_MINIMAL",FEATURES_SMALL_ICONS:"FEATURES_SMALL_ICONS",FEATURES_CAROUSEL:"FEATURES_CAROUSEL",FEATURES_IMAGE_LEFT:"FEATURES_IMAGE_LEFT",FEATURES_IMAGE_RIGHT:"FEATURES_IMAGE_RIGHT",ANNOUNCEMENT_CENTER:"ANNOUNCEMENT_CENTER",TWO_COLUMNS_SIDEBAR_ON_THE_LEFT:"TWO_COLUMNS_SIDEBAR_ON_THE_LEFT",TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT:"TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT",THREE_COLUMNS_SIDEBAR_ON_THE_RIGHT:"THREE_COLUMNS_SIDEBAR_ON_THE_RIGHT",THREE_COLUMNS_SIDEBAR_ON_THE_LEFT:"THREE_COLUMNS_SIDEBAR_ON_THE_LEFT",TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT_DESCRIPTION_UNDER_IMAGE:"TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT_DESCRIPTION_UNDER_IMAGE",SLIDER_FULLSCREEN_CENTER:"SLIDER_FULLSCREEN_CENTER",SLIDER_FULLSCREEN_LEFT:"SLIDER_FULLSCREEN_LEFT",SLIDER_BASIC:"SLIDER_BASIC",SLIDER_CAROUSEL:"SLIDER_CAROUSEL",SLIDER_CAROUSEL_PORTRAIT:"SLIDER_CAROUSEL_PORTRAIT",SLIDER_SPLIT:"SLIDER_SPLIT",SLIDER_SPLIT_REVERSE:"SLIDER_SPLIT_REVERSE"},qg=de(Object.values(Kg)),Yg={HEADER:"header",COVER:"cover",ANNOUNCEMENT_BAR:"announcement_bar",SLIDER:"slider",SPECIAL_OFFER:"special_offer",CUSTOMER_REVIEW:"customer_review",COMPANY_INFO:"company_info",SHIPPING_PAYMENT:"shipping_payment",LOCATION:"location",STORE:"store",FOOTER:"footer",VIDEO:"video",IMAGE_GALLERY:"image_gallery",CONTACT_INFO:"contact_info",CONTACTS_WIDGET_WHATSAPP:"contacts_widget_whatsapp",CONTACTS_WIDGET_INSTAGRAM:"contacts_widget_instagram",CONTACTS_WIDGET_FACEBOOK:"contacts_widget_facebook",CONTACTS_WIDGET_PHONE:"contacts_widget_phone"},Jg={COVER:"COVER",ANNOUNCEMENT:"ANNOUNCEMENT",STORE:"STORE",SLIDER:"SLIDER",VIDEO:"VIDEO",SPECIAL_OFFER:"SPECIAL_OFFER",CUSTOMER_REVIEW:"CUSTOMER_REVIEW",COMPANY_INFO:"COMPANY_INFO",SHIPPING_PAYMENT:"SHIPPING_PAYMENT",LOCATION:"LOCATION",COLLECTIONS:"COLLECTIONS",BRANDS:"BRANDS",CONTACT_INFO:"CONTACT_INFO"},Xg=de(Object.values(Jg)),Be={REQUIRED_HEADER_ID:()=>'Header section must have id "header" when type is "default"',REQUIRED_CUSTOM_HEADER:(...e)=>`Custom header section with id "${e[0]}" must exist in headers directory`,REQUIRED_CUSTOM_HEADER_TYPE:(...e)=>`Custom header section with id "${e[0]}" must be of type "HEADER"`,REQUIRED_FOOTER_ID:()=>'Footer section must have id "footer" when type is "default"',REQUIRED_CUSTOM_FOOTER:(...e)=>`Custom footer section with id "${e[0]}" must exist in footers directory`,REQUIRED_CUSTOM_FOOTER_TYPE:(...e)=>`Custom footer section with id "${e[0]}" must be of type "FOOTER"`,REQUIRED_PAGE_SECTION:(...e)=>`Custom section with id "${e[0]}" must exist in sections directory`,REQUIRED_PAGE_SECTION_TYPE:()=>'Section "header" or "footer" is not allowed among page sections',SHOWCASE_ID_NOT_FOUND:(...e)=>`Showcase with id "${e[0]}" must exist in section's showcase directory`,DUPLICATE_SHOWCASE_ID:(...e)=>`Showcase id "${e[0]}" must be unique within section showcases`,SHOWCASE_OVERRIDE_CONTENT:(...e)=>`Content editor "${e[0]}" in showcase_overrides must exist in section's content configuration file`,SHOWCASE_OVERRIDE_DESIGN:(...e)=>`Design editor "${e[0]}" in showcase_overrides must exist in section's design configuration file`,SHOWCASE_OVERRIDE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase_overrides must exist in section's layout configuration file`,SHOWCASE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase must exist in section's layout configuration file`,INVALID_SHOWCASE_CONTENT_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in content.ts`,SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but content.ts has type "${e[2]}"`,INVALID_SHOWCASE_DESIGN_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in design.ts`,SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but design.ts has type "${e[2]}"`,INVALID_DECK_CARD_SETTING:(...e)=>`Setting "${e[0]}" is not defined in content.ts defaultCardContent.settings`,DECK_SETTINGS_REQUIRED:()=>"settings must have at least one property",INVALID_SELECTBOX_OPTION:(...e)=>`Option value "${e[0]}" for element "${e[1]}" is not defined in content.ts options`,REQUIRED_STORE_LAYOUT:(...e)=>`Store section with id "${e[0]}" and page type "${e[1]}" must have a corresponding layout defined`,INVALID_STORE_SECTION_ID:(...e)=>`Store layout sectionId "${e[0]}" must be one of: ${e[1]}`,REQUIRED_SECTION_ASSET:(...e)=>`Asset size ${e[0]} exceeds threshold of ${e[1]}.`,REQUIRED_SERVER_SIZE:(...e)=>`Size of individual server file [${e[0]}] must not exceed threshold [${e[1]}].`,MISSING_IMAGE_ASSET:(...e)=>`Image ${e[0]} is missing from assets folder`,MANDATORY_SETTING_TYPE_MISMATCH:(...e)=>`Editor type "${e[0]}" for reserved key "${e[1]}" does not match the required type "${e[2]}".`,MANDATORY_SETTING_NAME_MISMATCH:(...e)=>`Editor key "${e[0]}" for overridden content type "${e[1]}" does not match the required key name "${e[2]}".`,DUPLICATED_MANDATORY_SETTING:(...e)=>`Editor type "${e[0]}" can only be used once.`,IMAGE_EDITOR_STATIC_MISMATCH:(...e)=>`Both "${e[0]}" content and design editor need to have same value for attribute static`,DUPLICATE_DESIGN_EDITOR_NAME:()=>"Non-unique design editor name detected",COLOR_REQUIRED_GRADIENT:()=>"color is required when overlay is GRADIENT",COLOR_MUST_BE_ARRAY_GRADIENT:()=>"color must be an array when overlay is GRADIENT",COLOR_ARRAY_LENGTH_GRADIENT:()=>"color array must have exactly 2 items when overlay is GRADIENT",COLOR_REQUIRED_COLOR:()=>"color is required when overlay is COLOR",COLOR_MUST_BE_SINGLE_COLOR:()=>"color must be a single value when overlay is COLOR",COLOR_MUST_BE_UNDEFINED_NONE:()=>"color must be undefined when overlay is NONE or not set",COLOR_REQUIRED_STYLE_GRADIENT:()=>"color is required when style is GRADIENT",COLOR_MUST_BE_ARRAY_STYLE_GRADIENT:()=>"color must be an array when style is GRADIENT",COLOR_ARRAY_LENGTH_STYLE_GRADIENT:()=>"color array must have exactly 2 items when style is GRADIENT",COLOR_REQUIRED_STYLE_COLOR:()=>"color is required when style is COLOR",COLOR_MUST_BE_SINGLE_STYLE_COLOR:()=>"color must be a single value when style is COLOR",BUTTON_LINK_REQUIRED:()=>"link is required when buttonType is HYPER_LINK",BUTTON_CATEGORY_ID_REQUIRED:()=>"categoryId is required when buttonType is GO_TO_CATEGORY or GO_TO_CATEGORY_LINK",BUTTON_EMAIL_REQUIRED:()=>"email is required when buttonType is MAIL_LINK",BUTTON_PHONE_REQUIRED:()=>"phone is required when buttonType is TEL_LINK",BUTTON_TILE_ID_REQUIRED:(...e)=>`${e[0]} is required when buttonType is SCROLL_TO_TILE`,BUTTON_PAGE_ID_REQUIRED:()=>"pageIdForNavigate is required when type is GO_TO_PAGE",TEMPLATE_PAGE_SECTIONS_REQUIRED:()=>"sections must contain at least one section",TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have exactly one section`,TEMPLATE_PAGE_STORE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have a section of type "store"`,TEMPLATE_PAGE_NO_STORE_SECTIONS:(...e)=>`Page type "${e[0]}" cannot contain store sections`,TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED:()=>'Page type "CUSTOM" must have a metadata property',TEMPLATE_PAGE_METADATA_NOT_ALLOWED:(...e)=>`Page type "${e[0]}" must not have a metadata property`,NON_NEGATIVE_INTEGER:()=>"must be a non-negative integer",INTEGER_RANGE:(...e)=>`must be between ${e[0]} and ${e[1]}`,VALID_HEX_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA)",VALID_GLOBAL_FONT:()=>"must be a valid global font reference (global.fontFamily.title or global.fontFamily.body)",VALID_GLOBAL_TEXT_SIZE:()=>"must be a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_GLOBAL_COLOR:()=>"must be a valid global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA) or global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_TEXT_SIZE:()=>"must be an integer of at least 1 or a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_LANGUAGE_CODE:()=>"must be a valid language code (e.g., en, nl, fr, en_US, en_GB, zh_Hans)",VALID_URL:()=>"must be a valid URL",VALID_EMAIL:()=>"must be a valid email address",ACCORDION_ITEM_POSITION_FIELD_REQUIRED:(...e)=>`Item "${e[0]}" must have positionFieldName when sortable is true`,ACCORDION_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor`,ACCORDION_SHOWCASE_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor override`,ACCORDION_DUPLICATE_POSITION_FIELD_NAME:()=>"positionFieldName must be unique across accordion items when sortable is true",MISSING_SLOT_DESIGN_SETTINGS:(...e)=>`Slot "${e[0]}" cannot be used because required design settings are missing: ${e[1]}. Check the original example and add the missing settings.`,REQUIRED_COLLECTION_NAME:()=>"Collection must have a name in metadata"},dc=/^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,fc=/^global\.fontFamily\.(title|body)$/,mc=/^global\.textSize\.(title|subtitle|body)$/,yc=/^global\.color\.(title|body|button|link|background)$/,Qg=/^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$/,_t=(e,s)=>{const i=Be.INTEGER_RANGE(e.toString(),s.toString());return at().min(e,{message:i}).max(s,{message:i})},jr=A({path:O(),size:pi().nonnegative()}).strict(),gc=A({size:pi().nonnegative()}).strict(),V=O().regex(/^\$.+/,{message:"must start with '$' followed by at least one character"}),eE=A({r:_t(0,255),g:_t(0,255),b:_t(0,255),a:_t(0,1)}).strict(),Ec=O().regex(dc,{message:Be.VALID_HEX_COLOR()});rs(e=>typeof e=="string"&&fc.test(e),{message:Be.VALID_GLOBAL_FONT()});const zr=O().refine(e=>!e.startsWith("global.")||fc.test(e),{message:Be.VALID_GLOBAL_FONT()});rs(e=>typeof e=="string"&&yc.test(e),{message:Be.VALID_GLOBAL_COLOR()});const st=rs(e=>typeof e=="string"&&(dc.test(e)||yc.test(e)),{message:Be.VALID_COLOR()}),Tc=rs(e=>typeof e=="string"?st.safeParse(e).success:Array.isArray(e)&&e.every(s=>st.safeParse(s).success),{message:Be.VALID_COLOR()});rs(e=>typeof e=="string"&&mc.test(e),{message:Be.VALID_GLOBAL_TEXT_SIZE()});const Sc=rs(e=>typeof e=="number"?Number.isInteger(e)&&e>=1:typeof e=="string"&&mc.test(e),{message:Be.VALID_TEXT_SIZE()}),_s=de(["catalog","category","product"]),yi=O().refine(e=>e.startsWith("#")||Ko().safeParse(e).success,{message:"must be a valid URL or a hash fragment starting with #"}),Os=A({url:O(),width:at().min(0,{message:Be.NON_NEGATIVE_INTEGER()}).optional(),height:at().min(0,{message:Be.NON_NEGATIVE_INTEGER()}).optional()}).strict(),tE=A({homogeneity:te().optional(),color:eE.optional()}).strict(),sE=A({ORIGINAL:Os.optional(),WEBP_LOW_RES:Os.optional(),WEBP_HI_2X_RES:Os.optional(),MOBILE_WEBP_LOW_RES:Os.optional(),MOBILE_WEBP_HI_RES:Os.optional()}).strict().refine(e=>Object.keys(e).length>=1,{message:"set must have at least one property"}),gi=A({set:sE,borderInfo:tE.optional()}).strict(),Vr=A({type:k(F.IMAGE),imageData:gi}).strict(),bc=A({type:k(F.IMAGE),label:V,static:te().optional(),defaults:Vr.optional()}).strict(),iE=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Gr(e){return e===Ft.PRODUCT||e===Ft.CATALOG||e===Ft.CATEGORY}function xc(e,s,i){if(!e)return;const a=Ip({path:"$..set..url",json:e,resultType:"all"}),c=/^https?:\/\//;a.forEach(u=>{const h=u.value;if(!c.test(h)&&!s.includes(h)){const f=u.pointer.split("/").filter(y=>y.length>0);i.at(f).addIssue("MISSING_IMAGE_ASSET",h)}})}function Ic(e,s,i){e===dt.HYPER_LINK&&!s&&i.at("link").addIssue("BUTTON_LINK_REQUIRED")}function Pc(e,s,i){(e===dt.GO_TO_CATEGORY||e===dt.GO_TO_CATEGORY_LINK)&&!s&&i.at("categoryId").addIssue("BUTTON_CATEGORY_ID_REQUIRED")}function wc(e,s,i){e===dt.MAIL_LINK&&!s&&i.at("email").addIssue("BUTTON_EMAIL_REQUIRED")}function Ac(e,s,i){e===dt.TEL_LINK&&!s&&i.at("phone").addIssue("BUTTON_PHONE_REQUIRED")}function Cc(e,s,i,a){if(e===dt.SCROLL_TO_TILE&&!(s??i)){const c=s?"tileId":"tileIdForScroll";a.at(c).addIssue("BUTTON_TILE_ID_REQUIRED",c)}}function rE(e,s,i){e===dt.GO_TO_PAGE&&!s&&i.at("pageIdForNavigate").addIssue("BUTTON_PAGE_ID_REQUIRED")}const nE="custom";function be(e,s=[]){const i=c=>Array.isArray(c)?c:[c],a=i(s);return{raw:e,addIssue(c,...u){e.addIssue({code:nE,message:Be[c](...u),path:a,params:{errorMessageKey:c}})},at(c){const u=a.concat(i(c));return be(e,u)}}}const Hr=A({type:k(F.BUTTON),title:V,buttonType:Ig,link:O().optional(),linkTarget:O().optional(),email:O().regex(iE,{message:Be.VALID_EMAIL()}).optional(),phone:O().optional(),tileId:O().optional(),categoryId:pi().optional()}).strict().superRefine((e,s)=>{const i=be(s);Ic(e.buttonType,e.link,i),Pc(e.buttonType,e.categoryId,i),wc(e.buttonType,e.email,i),Ac(e.buttonType,e.phone,i),Cc(e.buttonType,e.tileId,void 0,i)}),vc=A({type:k(F.BUTTON),label:V,defaults:Hr.optional()}).strict(),Zr=A({type:k(F.CATEGORY_SELECTOR)}).strict(),Nc=A({type:k(F.CATEGORY_SELECTOR),label:V,maxCategories:_t(1,32),defaults:Zr.optional()}).strict(),Wr=A({type:k(F.DIVIDER)}).strict(),_c=A({type:k(F.DIVIDER),label:V,defaults:Wr.optional()}).strict(),aE=A({label:V,link:yi}).strict(),oE=A({title:V.optional(),link:yi.optional()}).strict(),Kr=A({type:k(F.INFO),text:V.optional(),button:oE.optional()}).strict(),Oc=A({type:k(F.INFO),label:V,description:V,button:aE.optional(),defaults:Kr.optional()}).strict(),qr=A({type:k(F.INPUTBOX),text:V}).strict(),Lc=A({type:k(F.INPUTBOX),label:V,placeholder:V,defaults:qr.optional()}).strict(),Yr=A({type:k(F.PRODUCT_SELECTOR)}).strict(),kc=A({type:k(F.PRODUCT_SELECTOR),label:V,maxProducts:_t(1,32),defaults:Yr.optional()}).strict(),Jr=A({type:k(F.SELECTBOX),value:O()}).strict(),cE=A({value:O().min(1,{message:"value must not be empty"}),label:V}).strict(),Dc=A({type:k(F.SELECTBOX),label:V,placeholder:V,description:V,options:ne(cE).min(1,{message:"must have at least one option"}),defaults:Jr.optional()}).strict(),Xr=A({type:k(F.TEXTAREA),text:V}).strict(),Rc=A({type:k(F.TEXTAREA),label:V,placeholder:V,defaults:Xr.optional()}).strict(),Qr=A({type:k(F.TOGGLE),enabled:te()}).strict(),Mc=A({type:k(F.TOGGLE),label:V,description:V,defaults:Qr.optional()}).strict(),$c=A({type:k(F.DECK)}).strict(),Fc=[qr,Xr,Hr,Vr,Qr,Jr,Wr,Kr,Yr,Zr],lE=Ve("type",[...Fc]),uE=A({type:k(F.DECK),cards:ne(A({settings:Oe(O(),lE).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),hE=Ve("type",[...Fc,uE]),pE=A({type:k(F.DECK),cards:ne(A({settings:Oe(O(),hE).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),Bc=[Lc,Rc,vc,bc,Mc,Dc,_c,Oc,Nc,kc],dE=A({type:k(F.DECK),label:V,addButtonLabel:V,maxCards:at().min(1,{message:"must be a positive integer"}),cards:A({defaultCardContent:A({label:V,settings:Oe(O(),Ve("type",[...Bc])).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:$c.optional()}).strict(),fE=Ve("type",[...Bc,dE]),mE=A({type:k(F.DECK),label:V,addButtonLabel:V,maxCards:at().min(1,{message:"must be a positive integer"}),cards:A({defaultCardContent:A({label:V,settings:Oe(O(),fE).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:$c.optional()}).strict(),Uc=A({type:k(F.LOGO),logoType:Rg.optional(),text:V.optional(),imageData:gi.optional()}).strict(),yE=A({type:k(F.LOGO),label:V.optional(),defaults:Uc.optional()}).strict(),jc=A({id:O(),title:O().optional(),type:O().optional(),link:O().optional(),email:O().optional(),phone:O().optional(),tileIdForScroll:O().optional(),pageIdForNavigate:O().optional(),showStoreCategories:te().optional(),isSubmenuOpened:te().optional(),categoryId:pi().optional()}).strict().superRefine((e,s)=>{const i=be(s);Ic(e.type,e.link,i),Pc(e.type,e.categoryId,i),wc(e.type,e.email,i),Ac(e.type,e.phone,i),Cc(e.type,void 0,e.tileIdForScroll,i),rE(e.type,e.pageIdForNavigate,i)}),zc=A({type:k(F.MENU),items:ne(jc).optional()}).strict(),gE=A({type:k(F.MENU),label:V.optional(),defaults:zc.optional()}).strict(),Vc=A({type:k(F.NAVIGATION_MENU),items:ne(jc).optional()}).strict(),EE=A({type:k(F.NAVIGATION_MENU),defaults:Vc.optional()}).strict(),Ei=A({type:k(K.BACKGROUND),style:Og.optional(),color:Tc.optional()}).strict().superRefine((e,s)=>{const i=be(s).at("color");e.style===mi.GRADIENT?e.color===void 0?i.addIssue("COLOR_REQUIRED_STYLE_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&i.addIssue("COLOR_ARRAY_LENGTH_STYLE_GRADIENT"):i.addIssue("COLOR_MUST_BE_ARRAY_STYLE_GRADIENT"):e.style===mi.COLOR&&(e.color===void 0?i.addIssue("COLOR_REQUIRED_STYLE_COLOR"):Array.isArray(e.color)&&i.addIssue("COLOR_MUST_BE_SINGLE_STYLE_COLOR"))}),TE=A({type:k(K.BACKGROUND),fieldName:O(),defaults:Ei.optional()}).strict(),Gc=A({type:k(K.BACKGROUND),label:V,colors:ne(st).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Ei.optional()}).strict(),Ti=A({type:k(K.BUTTON),appearance:wg.optional(),size:Cg.optional(),shape:Ng.optional(),font:zr.optional(),color:st.optional(),visible:te().optional()}).strict(),SE=A({type:k(K.BUTTON),fieldName:O(),defaults:Ti.optional()}).strict(),Hc=A({type:k(K.BUTTON),label:V,colors:ne(st).optional(),enableAutoColor:te().optional(),enableAlphaColor:te().optional(),hideVisibleToggle:te().optional(),hideSize:te().optional(),defaults:Ti.optional()}).strict(),Si=A({type:k(K.COLOR_PICKER),color:st.optional()}).strict(),bE=A({type:k(K.COLOR_PICKER),fieldName:O(),defaults:Si.optional()}).strict(),Zc=A({type:k(K.COLOR_PICKER),label:V,description:V.optional(),colors:ne(st).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Si.optional()}).strict(),bi=A({type:k(K.DIVIDER)}).strict(),xE=A({type:k(K.DIVIDER),fieldName:O(),defaults:bi.optional()}).strict(),Wc=A({type:k(K.DIVIDER),label:V,defaults:bi.optional()}).strict(),xi=A({type:k(K.IMAGE),overlay:Pg.optional(),color:Tc.optional(),visible:te().optional()}).strict().superRefine((e,s)=>{const i=be(s).at("color");e.overlay===vs.GRADIENT?e.color===void 0?i.addIssue("COLOR_REQUIRED_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&i.addIssue("COLOR_ARRAY_LENGTH_GRADIENT"):i.addIssue("COLOR_MUST_BE_ARRAY_GRADIENT"):e.overlay===vs.COLOR?e.color===void 0?i.addIssue("COLOR_REQUIRED_COLOR"):Array.isArray(e.color)&&i.addIssue("COLOR_MUST_BE_SINGLE_COLOR"):(e.overlay===vs.NONE||e.overlay===void 0)&&e.color!==void 0&&i.addIssue("COLOR_MUST_BE_UNDEFINED_NONE")}),IE=A({type:k(K.IMAGE),fieldName:O(),defaults:xi.optional()}).strict(),Kc=A({type:k(K.IMAGE),label:V,static:te().optional(),colors:ne(Ec).optional(),enableAlphaColor:te().optional(),hideVisibleToggle:te().optional(),defaults:xi.optional()}).strict(),PE=A({label:V,link:yi}).strict(),wE=A({label:V.optional(),link:yi.optional()}).strict(),Ii=A({type:k(K.INFO),description:V.optional(),button:wE.optional()}).strict(),AE=A({type:k(K.INFO),fieldName:O(),defaults:Ii.optional()}).strict(),qc=A({type:k(K.INFO),label:V,description:V,button:PE.optional(),defaults:Ii.optional()}).strict(),CE=A({visible:te(),width:_t(1,49).optional(),color:st.optional()}).strict(),Pi=A({type:k(K.LOGO),font:zr.optional(),size:Sc.optional(),bold:te().optional(),italic:te().optional(),color:st.optional(),visible:te().optional(),spacing:_t(1,9).optional(),frame:CE.optional(),capitalization:de(["none","all","small"]).optional()}).strict(),vE=A({type:k(K.LOGO),fieldName:O(),defaults:Pi.optional()}).strict(),Yc=A({type:k(K.LOGO),label:V,colors:ne(st).optional(),sizes:ne(at().min(1,{message:"must be at least 1"})).optional(),defaults:Pi.optional()}).strict(),NE=A({value:O().optional(),label:V.optional()}).strict(),wi=A({type:k(K.SELECTBOX),value:O().optional()}).strict(),_E=A({type:k(K.SELECTBOX),fieldName:O(),defaults:wi.optional()}).strict(),Jc=A({type:k(K.SELECTBOX),label:V,description:V.optional(),options:ne(NE).optional(),defaults:wi.optional()}).strict(),Ai=A({type:k(K.TEXT),font:zr.optional(),size:Sc.optional(),bold:te().optional(),italic:te().optional(),color:st.optional(),visible:te().optional()}).strict(),OE=A({type:k(K.TEXT),fieldName:O(),defaults:Ai.optional()}).strict(),Xc=A({type:k(K.TEXT),label:V,colors:ne(Ec).optional(),sizes:ne(at().min(1,{message:"must be at least 1"})).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),hideVisibleToggle:te().optional(),hideSize:te().optional(),defaults:Ai.optional()}).strict(),Ci=A({type:k(K.TOGGLE),enabled:te().optional()}).strict(),LE=A({type:k(K.TOGGLE),fieldName:O(),defaults:Ci.optional()}).strict(),Qc=A({type:k(K.TOGGLE),label:V,defaults:Ci.optional()}).strict();function kE(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_SHOWCASE_ITEMS_REQUIRED")}function DE(e,s){for(const[i,a]of Object.entries(e))Object.keys(a.editors).length===0&&s.at(["items",i,"editors"]).addIssue("ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED",i)}function RE(e,s,i){Object.keys(e).length===0&&i.at("editors").addIssue("ACCORDION_ITEM_EDITORS_REQUIRED",s)}function ME(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_ITEMS_REQUIRED")}function $E(e,s){for(const[i,a]of Object.entries(e))a.positionFieldName||s.at(["items",i,"positionFieldName"]).addIssue("ACCORDION_ITEM_POSITION_FIELD_REQUIRED",i)}function FE(e,s){const i=Object.values(e).map(a=>a.positionFieldName).filter(Boolean);new Set(i).size!==i.length&&s.at("items").addIssue("ACCORDION_DUPLICATE_POSITION_FIELD_NAME")}const el=A({type:k(K.ACCORDION)}).strict(),BE=Ve("type",[Ai,Ti,xi,Ci,wi,Ei,Si,Pi,bi,Ii]),UE=A({editors:Oe(O(),BE)}).strict(),jE=A({type:k(K.ACCORDION),items:Oe(O(),UE)}).strict().superRefine((e,s)=>{const i=be(s);kE(e.items,i),DE(e.items,i)}),zE=A({type:k(K.ACCORDION),fieldName:O(),defaults:el.optional()}).strict(),VE=Ve("type",[Xc,Hc,Kc,Qc,Jc,Gc,Zc,Yc,Wc,qc]),GE=A({label:V,positionFieldName:O().optional(),editors:Oe(O(),VE)}).strict().superRefine((e,s)=>{RE(e.editors,e.label,be(s))}),HE=A({type:k(K.ACCORDION),sortable:te().optional(),items:Oe(O(),GE),defaults:el.optional()}).strict().superRefine((e,s)=>{const i=be(s);ME(e.items,i),e.sortable===!0&&($E(e.items,i),FE(e.items,i))}),tl=Ve("type",[qr,Xr,Hr,Vr,Qr,Jr,zc,Vc,Uc,Wr,Kr,pE,Yr,Zr]),sl=Ve("type",[Ai,Ti,xi,Ci,wi,Ei,Si,Pi,bi,jE,Ii]),ZE=A({showcaseId:O(),blockName:O(),previewImage:gi,content:Oe(O(),tl),design:Oe(O(),sl),layoutId:O().optional()}).strict(),WE=A({blockName:O(),content:Oe(O(),tl).optional(),design:Oe(O(),sl).optional(),layoutId:O().optional()}).strict();function KE(e,s){Gr(e.type)&&(e.sections.length!==1?s.at("sections").addIssue("TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED",e.type):e.sections[0]?.type!=="store"&&s.at(["sections",0,"type"]).addIssue("TEMPLATE_PAGE_STORE_SECTION_REQUIRED",e.type))}function qE(e,s){Gr(e.type)&&e.sections.length===0&&s.at("sections").addIssue("TEMPLATE_PAGE_SECTIONS_REQUIRED"),e.sections.forEach((i,a)=>{Gr(e.type)||i.type==="store"&&s.at(["sections",a,"type"]).addIssue("TEMPLATE_PAGE_NO_STORE_SECTIONS",e.type),i.type==="default"&&i.id&&(i.id==="header"||i.id==="footer")&&s.at(["sections",a,"id"]).addIssue("REQUIRED_PAGE_SECTION_TYPE")})}function YE(e,s){e.type==="CUSTOM"?e.metadata||s.at("metadata").addIssue("TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED"):e.metadata!==void 0&&s.at("metadata").addIssue("TEMPLATE_PAGE_METADATA_NOT_ALLOWED",e.type)}const JE=new RegExp(`^(${Object.values(Yg).join("|")})(_\\d{3})?$`),XE=O().regex(JE,"id must match pattern: [default_section_name] or [default_section_name]_XXX where XXX is three digits"),QE=O().regex(new RegExp("\\d{3}"),"showcase_id must be a three digit string"),il=A({type:k("default"),id:XE,showcase_id:QE.optional()}).strict(),en=A({type:k("custom"),id:O(),showcase_id:O().optional(),showcase_overrides:WE.optional(),category:Xg.optional()}).strict(),eT=A({type:k("store"),id:O().optional()}).strict(),tT=Ve("type",[il,en,eT]),sT=A({title:O()}).strict(),iT=A({metadata:sT.optional(),sections:ne(tT)}).strict(),rT=iT.safeExtend({type:Wg,id:O().min(1,{message:"id is required"})}).strict().superRefine((e,s)=>{const i=be(s);qE(e,i),KE(e,i),YE(e,i)}),rl=A({name:O().min(2,{message:"name must be at least 2 characters"}).max(60,{message:"name must be at most 60 characters"}),description:O().min(2,{message:"description must be at least 2 characters"}).max(150,{message:"description must be at most 150 characters"}),preview_url:Ko({message:"preview_url must be a valid URL"}).regex(/^(https?):\/\/([^.]+?\.)?(company\.site|ecwid\.qa)($|\/[A-Za-z0-9\-._~:/?#\[\]@!$&'()*+,;=]*)?$/,"preview_url must match pattern: (https?)://([^.]+?\\.)?(company\\.site|ecwid\\.qa)(...)?").optional(),cover_image:gi,categories:ne(zg).refine(e=>new Set(e).size===e.length,{message:"categories must contain unique items"}).optional()}).strict(),nT=il.extend({id:O()}),nl=Ve("type",[nT,en]),aT=A({metadata:rl,header:nl,footer:nl}).strict(),oT=A({id:O().min(1,{message:"id is required"}),assets:jr.array().optional(),configuration:aT,pages:ne(rT)}).strict(),vi=2097152,Ni=512e3;function mt(e,s=2){if(!+e)return"0 Bytes";const i=1024,a=s<0?0:s,c=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],u=Math.floor(Math.log(e)/Math.log(i));return`${parseFloat((e/i**u).toFixed(a))} ${c[u]}`}const cT={menu:{type:F.NAVIGATION_MENU},logo:{type:F.LOGO}},lT={logo:{type:"LOGO",label:"$label.logo.label",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{type:"LOGO",font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function al(e){switch(e){case $t.HEADER:return cT;default:return{}}}function ol(e){switch(e){case $t.HEADER:return lT;default:return{}}}function cl({validationType:e,sectionType:s}){switch(e){case Ns.CONTENT:return al(s);case Ns.DESIGN:return ol(s);default:return{}}}const uT=en.extend({id:O().min(1,{message:"section id is required"})}),hT=A({metadata:rl,sections:ne(uT).min(1,{message:"sections must contain at least one section"}).max(20,{message:"sections must contain at most 20 sections"})}).strict().superRefine((e,s)=>{e.metadata.name.trim().length===0&&be(s).at(["collection","metadata","name"]).addIssue("REQUIRED_COLLECTION_NAME")}),pT=A({id:O().min(1,{message:"id is required"}),descriptor:hT}).strict(),dT=Ve("type",[Lc,Rc,vc,bc,Mc,Dc,mE,gE,EE,yE,_c,Oc,kc,Nc]),tn=Oe(O(),dT),fT=Ve("type",[Xc,Hc,Kc,Qc,Jc,Gc,Zc,Yc,Wc,HE,qc]),sn=Oe(O(),fT),mT=Ve("type",[OE,SE,IE,LE,_E,TE,bE,vE,xE,AE,zE]),rn=A({layoutId:O(),layoutIcon:qg.optional(),selectedContentSettings:ne(O()),selectedDesignSettings:ne(mT)}).strict(),yT=O().regex(Qg,Be.VALID_LANGUAGE_CODE()),_i=Oe(yT,Oe(V,O()));function ll(e,s,i){if(!e||Object.keys(s).length===0)return;const a=Object.entries(s),c=a.map(([,{type:h}])=>h),u=Object.values(e).map(({type:h})=>h);Object.entries(e).forEach(([h,f])=>{const y=s[h];y&&"type"in y&&f.type!==y.type&&i.at(h).addIssue("MANDATORY_SETTING_TYPE_MISMATCH",f.type,h,y.type)}),Object.entries(e).forEach(([h,f])=>{const y=a.find(([,{type:T}])=>T===f.type)?.[0];y&&h!==y&&i.at(h).addIssue("MANDATORY_SETTING_NAME_MISMATCH",h,f.type,y)}),new Set(u.filter(h=>c.includes(h))).forEach(h=>{if(u.filter(f=>f===h).length>1){const f=a.findLast(([,{type:y}])=>y===h)?.[0];i.at(f).addIssue("DUPLICATED_MANDATORY_SETTING",h)}})}function ul(e,s,i){xc(e,s,i)}function hl(e,s,i){if(e.type!==F.DECK||s.type!==F.DECK)return;const a=s.cards?.defaultCardContent?.settings,c=e.cards;!a||!Array.isArray(c)||c.forEach((u,h)=>{u.settings&&Object.entries(u.settings).forEach(([f,y])=>{const T=a[f],x=i.at(["cards",h,"settings",f]);if(!T){x.addIssue("INVALID_DECK_CARD_SETTING",f);return}if(y.type!==T.type){x.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",f,y.type,T.type);return}y.type===F.DECK&&T.type===F.DECK&&hl(y,T,x)})})}function gT(e,s,i){e.content&&Object.entries(e.content).forEach(([a,c])=>{const u=i.at(["content",a]),h=s[a];if(!h){u.addIssue("INVALID_SHOWCASE_CONTENT_ELEMENT",a);return}if(c.type!==h.type){u.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",a,c.type,h.type);return}if(c.type===F.SELECTBOX&&h.type===F.SELECTBOX){const f=h,y=c;f.options&&y.value!==void 0&&(new Set(f.options.map(T=>T.value)).has(y.value)||u.addIssue("INVALID_SELECTBOX_OPTION",y.value,a))}c.type===F.DECK&&hl(c,h,u)})}function ET(e,s,i){e.design&&Object.entries(e.design).forEach(([a,c])=>{const u=i.at(["design",a]),h=s[a];if(!h){u.addIssue("INVALID_SHOWCASE_DESIGN_ELEMENT",a);return}c.type!==h.type&&u.addIssue("SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH",a,c.type,h.type)})}function TT(e,s){Object.entries(e).flatMap(([i,a])=>{switch(a.type){case K.ACCORDION:return Object.entries(a.items).flatMap(([c,u])=>Object.keys(u.editors).map(h=>({name:h,path:[i,"items",c,"editors",h]})));default:return[{name:i,path:[i]}]}}).filter(({name:i},a,c)=>c.findIndex(u=>u.name===i)<a).forEach(({path:i})=>s.at(i).addIssue("DUPLICATE_DESIGN_EDITOR_NAME"))}function ST(e,s,i){e.layoutId&&((s||[]).some(a=>a.layoutId===e.layoutId)||i.at("layoutId").addIssue("SHOWCASE_LAYOUT",e.layoutId))}function bT(e,s){const i=new Set;e.forEach((a,c)=>{if(i.has(a.showcaseId)){s.at([c,"showcaseId"]).addIssue("DUPLICATE_SHOWCASE_ID",a.showcaseId);return}i.add(a.showcaseId)})}function pl(e,s,i){for(const[a,c]of Object.entries(e)){const u=c;if(u.type===F.IMAGE){const h=s[a];if(h?.type===K.IMAGE){const f=u.static??!1,y=h.static??!1;f!==y&&i.at(a).addIssue("IMAGE_EDITOR_STATIC_MISMATCH",a)}}else if(u.type===F.DECK){const h=u;h.cards?.defaultCardContent?.settings&&pl(h.cards.defaultCardContent.settings,s,i.at([a,"cards","defaultCardContent","settings"]))}}}function xT(e,s,i){s>vi&&i.at(Te.basename(e)).addIssue("REQUIRED_SECTION_ASSET",mt(s),mt(vi))}function IT(e,s){e>Ni&&s.addIssue("REQUIRED_SERVER_SIZE",mt(e),mt(Ni))}const PT=A({id:O(),type:Lg,name:O(),content:tn,design:sn,layout:ne(rn).optional(),showcase:ne(ZE),translationsSettings:_i.optional(),translationsShowcases:_i.optional(),assets:jr.array().optional(),server:gc,previewCount:at().optional()}).strict().superRefine((e,s)=>{const i=be(s),a=cl({validationType:Ns.CONTENT,sectionType:e.type}),c=cl({validationType:Ns.DESIGN,sectionType:e.type});ll(e.content,a,i.at("content")),ll(e.design,c,i.at("design")),pl(e.content,e.design,i.at("content")),TT(e.design,i.at("design")),e.assets&&e.assets.forEach(h=>{xT(h.path,h.size,i.at("assets"))}),IT(e.server.size,i.at("server"));const u=e.assets?.map(h=>h.path)??[];ul(e.content,u,i.at("content")),bT(e.showcase,i.at("showcase")),e.showcase.forEach((h,f)=>{const y=i.at(["showcase",f]);ul(h,u,y),gT(h,e.content,y),ET(h,e.design,y),ST(h,e.layout,y)})}),wT=A({translations:_i.optional()}).strict();function AT(e){return typeof e=="object"&&e!==null&&e.type==="ACCORDION"}function CT(e){const s=[];for(const[i,a]of Object.entries(e))if(s.push(i),AT(a)){const c=a.items;if(c!==void 0)for(const u of Object.values(c)){const h=u.editors;h!==void 0&&s.push(...Object.keys(h))}}return s}var as={},dl;function vT(){if(dl)return as;dl=1,Object.defineProperty(as,"__esModule",{value:!0});function e(p,r){if(p==null)return{};var t={};for(var n in p)if({}.hasOwnProperty.call(p,n)){if(r.indexOf(n)!==-1)continue;t[n]=p[n]}return t}class s{constructor(r,t,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=r,this.column=t,this.index=n}}class i{constructor(r,t){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=r,this.end=t}}function a(p,r){const{line:t,column:n,index:o}=p;return new s(t,n+r,o+r)}const c="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";var u={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:c},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:c}};const h={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},f=p=>p.type==="UpdateExpression"?h.UpdateExpression[`${p.prefix}`]:h[p.type];var y={AccessorIsGenerator:({kind:p})=>`A ${p}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:p})=>`Missing initializer in ${p} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:p})=>`\`${p}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:p,exportName:r})=>`A string literal cannot be used as an exported binding without \`from\`.
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const f=h[1];if(s===h[0]){u(h);continue}if(e.external){const T=e.external.registry.get(h[0])?.id;if(s!==h[0]&&T){u(h);continue}}if(e.metadataRegistry.get(h[0])?.id){u(h);continue}if(f.cycle){u(h);continue}if(f.count>1&&e.reused==="ref"){u(h);continue}}}function Zo(e,s){const i=e.seen.get(s);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const f=e.seen.get(h);if(f.ref===null)return;const y=f.def??f.schema,T={...y},I=f.ref;if(f.ref=null,I){a(I);const L=e.seen.get(I),R=L.schema;if(R.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(y.allOf=y.allOf??[],y.allOf.push(R)):Object.assign(y,R),Object.assign(y,T),h._zod.parent===I)for(const le in y)le==="$ref"||le==="allOf"||le in T||delete y[le];if(R.$ref&&L.def)for(const le in y)le==="$ref"||le==="allOf"||le in L.def&&JSON.stringify(y[le])===JSON.stringify(L.def[le])&&delete y[le]}const A=h._zod.parent;if(A&&A!==I){a(A);const L=e.seen.get(A);if(L?.schema.$ref&&(y.$ref=L.schema.$ref,L.def))for(const R in y)R==="$ref"||R==="allOf"||R in L.def&&JSON.stringify(y[R])===JSON.stringify(L.def[R])&&delete y[R]}e.override({zodSchema:h,jsonSchema:y,path:f.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const c={};if(e.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?c.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?c.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const h=e.external.registry.get(s)?.id;if(!h)throw new Error("Schema is missing an `id` property");c.$id=e.external.uri(h)}Object.assign(c,i.def??i.schema);const u=e.external?.defs??{};for(const h of e.seen.entries()){const f=h[1];f.def&&f.defId&&(u[f.defId]=f.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{const h=JSON.parse(JSON.stringify(c));return Object.defineProperty(h,"~standard",{value:{...s["~standard"],jsonSchema:{input:pi(s,"input",e.processors),output:pi(s,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Me(e,s){const i=s??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return Me(a.element,i);if(a.type==="set")return Me(a.valueType,i);if(a.type==="lazy")return Me(a.getter(),i);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return Me(a.innerType,i);if(a.type==="intersection")return Me(a.left,i)||Me(a.right,i);if(a.type==="record"||a.type==="map")return Me(a.keyType,i)||Me(a.valueType,i);if(a.type==="pipe")return Me(a.in,i)||Me(a.out,i);if(a.type==="object"){for(const c in a.shape)if(Me(a.shape[c],i))return!0;return!1}if(a.type==="union"){for(const c of a.options)if(Me(c,i))return!0;return!1}if(a.type==="tuple"){for(const c of a.items)if(Me(c,i))return!0;return!!(a.rest&&Me(a.rest,i))}return!1}const Gm=(e,s={})=>i=>{const a=Go({...i,processors:s});return xe(e,a),Ho(a,e),Zo(a,e)},pi=(e,s,i={})=>a=>{const{libraryOptions:c,target:u}=a??{},h=Go({...c??{},target:u,io:s,processors:i});return xe(e,h),Ho(h,e),Zo(h,e)},Hm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zm=(e,s,i,a)=>{const c=i;c.type="string";const{minimum:u,maximum:h,format:f,patterns:y,contentEncoding:T}=e._zod.bag;if(typeof u=="number"&&(c.minLength=u),typeof h=="number"&&(c.maxLength=h),f&&(c.format=Hm[f]??f,c.format===""&&delete c.format,f==="time"&&delete c.format),T&&(c.contentEncoding=T),y&&y.size>0){const I=[...y];I.length===1?c.pattern=I[0].source:I.length>1&&(c.allOf=[...I.map(A=>({...s.target==="draft-07"||s.target==="draft-04"||s.target==="openapi-3.0"?{type:"string"}:{},pattern:A.source}))])}},Wm=(e,s,i,a)=>{const c=i,{minimum:u,maximum:h,format:f,multipleOf:y,exclusiveMaximum:T,exclusiveMinimum:I}=e._zod.bag;typeof f=="string"&&f.includes("int")?c.type="integer":c.type="number",typeof I=="number"&&(s.target==="draft-04"||s.target==="openapi-3.0"?(c.minimum=I,c.exclusiveMinimum=!0):c.exclusiveMinimum=I),typeof u=="number"&&(c.minimum=u,typeof I=="number"&&s.target!=="draft-04"&&(I>=u?delete c.minimum:delete c.exclusiveMinimum)),typeof T=="number"&&(s.target==="draft-04"||s.target==="openapi-3.0"?(c.maximum=T,c.exclusiveMaximum=!0):c.exclusiveMaximum=T),typeof h=="number"&&(c.maximum=h,typeof T=="number"&&s.target!=="draft-04"&&(T<=h?delete c.maximum:delete c.exclusiveMaximum)),typeof y=="number"&&(c.multipleOf=y)},Km=(e,s,i,a)=>{i.type="boolean"},qm=(e,s,i,a)=>{i.not={}},Ym=(e,s,i,a)=>{},Xm=(e,s,i,a)=>{const c=e._zod.def,u=no(c.entries);u.every(h=>typeof h=="number")&&(i.type="number"),u.every(h=>typeof h=="string")&&(i.type="string"),i.enum=u},Jm=(e,s,i,a)=>{const c=e._zod.def,u=[];for(const h of c.values)if(h===void 0){if(s.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h=="bigint"){if(s.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");u.push(Number(h))}else u.push(h);if(u.length!==0)if(u.length===1){const h=u[0];i.type=h===null?"null":typeof h,s.target==="draft-04"||s.target==="openapi-3.0"?i.enum=[h]:i.const=h}else u.every(h=>typeof h=="number")&&(i.type="number"),u.every(h=>typeof h=="string")&&(i.type="string"),u.every(h=>typeof h=="boolean")&&(i.type="boolean"),u.every(h=>h===null)&&(i.type="null"),i.enum=u},Qm=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},ey=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},ty=(e,s,i,a)=>{const c=i,u=e._zod.def,{minimum:h,maximum:f}=e._zod.bag;typeof h=="number"&&(c.minItems=h),typeof f=="number"&&(c.maxItems=f),c.type="array",c.items=xe(u.element,s,{...a,path:[...a.path,"items"]})},sy=(e,s,i,a)=>{const c=i,u=e._zod.def;c.type="object",c.properties={};const h=u.shape;for(const T in h)c.properties[T]=xe(h[T],s,{...a,path:[...a.path,"properties",T]});const f=new Set(Object.keys(h)),y=new Set([...f].filter(T=>{const I=u.shape[T]._zod;return s.io==="input"?I.optin===void 0:I.optout===void 0}));y.size>0&&(c.required=Array.from(y)),u.catchall?._zod.def.type==="never"?c.additionalProperties=!1:u.catchall?u.catchall&&(c.additionalProperties=xe(u.catchall,s,{...a,path:[...a.path,"additionalProperties"]})):s.io==="output"&&(c.additionalProperties=!1)},iy=(e,s,i,a)=>{const c=e._zod.def,u=c.inclusive===!1,h=c.options.map((f,y)=>xe(f,s,{...a,path:[...a.path,u?"oneOf":"anyOf",y]}));u?i.oneOf=h:i.anyOf=h},ry=(e,s,i,a)=>{const c=e._zod.def,u=xe(c.left,s,{...a,path:[...a.path,"allOf",0]}),h=xe(c.right,s,{...a,path:[...a.path,"allOf",1]}),f=T=>"allOf"in T&&Object.keys(T).length===1,y=[...f(u)?u.allOf:[u],...f(h)?h.allOf:[h]];i.allOf=y},ny=(e,s,i,a)=>{const c=i,u=e._zod.def;c.type="object";const h=u.keyType,y=h._zod.bag?.patterns;if(u.mode==="loose"&&y&&y.size>0){const I=xe(u.valueType,s,{...a,path:[...a.path,"patternProperties","*"]});c.patternProperties={};for(const A of y)c.patternProperties[A.source]=I}else(s.target==="draft-07"||s.target==="draft-2020-12")&&(c.propertyNames=xe(u.keyType,s,{...a,path:[...a.path,"propertyNames"]})),c.additionalProperties=xe(u.valueType,s,{...a,path:[...a.path,"additionalProperties"]});const T=h._zod.values;if(T){const I=[...T].filter(A=>typeof A=="string"||typeof A=="number");I.length>0&&(c.required=I)}},ay=(e,s,i,a)=>{const c=e._zod.def,u=xe(c.innerType,s,a),h=s.seen.get(e);s.target==="openapi-3.0"?(h.ref=c.innerType,i.nullable=!0):i.anyOf=[u,{type:"null"}]},oy=(e,s,i,a)=>{const c=e._zod.def;xe(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType},cy=(e,s,i,a)=>{const c=e._zod.def;xe(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,i.default=JSON.parse(JSON.stringify(c.defaultValue))},ly=(e,s,i,a)=>{const c=e._zod.def;xe(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,s.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(c.defaultValue)))},uy=(e,s,i,a)=>{const c=e._zod.def;xe(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType;let h;try{h=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=h},hy=(e,s,i,a)=>{const c=e._zod.def,u=s.io==="input"?c.in._zod.def.type==="transform"?c.out:c.in:c.out;xe(u,s,a);const h=s.seen.get(e);h.ref=u},py=(e,s,i,a)=>{const c=e._zod.def;xe(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,i.readOnly=!0},Wo=(e,s,i,a)=>{const c=e._zod.def;xe(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType},dy=P("ZodISODateTime",(e,s)=>{ff.init(e,s),Ee.init(e,s)});function fy(e){return Tm(dy,e)}const my=P("ZodISODate",(e,s)=>{mf.init(e,s),Ee.init(e,s)});function yy(e){return Sm(my,e)}const gy=P("ZodISOTime",(e,s)=>{yf.init(e,s),Ee.init(e,s)});function Ey(e){return bm(gy,e)}const Ty=P("ZodISODuration",(e,s)=>{gf.init(e,s),Ee.init(e,s)});function Sy(e){return Im(Ty,e)}const by=(e,s)=>{ho.init(e,s),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>ad(e,i)},flatten:{value:i=>nd(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,Or,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,Or,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ke=P("ZodError",by,{Parent:Error}),Iy=Rr(Ke),xy=Mr(Ke),Ay=ai(Ke),Py=oi(Ke),wy=ld(Ke),Cy=ud(Ke),_y=hd(Ke),vy=pd(Ke),Ny=dd(Ke),Oy=fd(Ke),Ly=md(Ke),Dy=yd(Ke),ge=P("ZodType",(e,s)=>(ye.init(e,s),Object.assign(e["~standard"],{jsonSchema:{input:pi(e,"input"),output:pi(e,"output")}}),e.toJSONSchema=Gm(e,{}),e.def=s,e.type=s.type,Object.defineProperty(e,"_def",{value:s}),e.check=(...i)=>e.clone(Ct(s,{checks:[...s.checks??[],...i.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(i,a)=>_t(e,i,a),e.brand=()=>e,e.register=((i,a)=>(i.add(e,a),e)),e.parse=(i,a)=>Iy(e,i,a,{callee:e.parse}),e.safeParse=(i,a)=>Ay(e,i,a),e.parseAsync=async(i,a)=>xy(e,i,a,{callee:e.parseAsync}),e.safeParseAsync=async(i,a)=>Py(e,i,a),e.spa=e.safeParseAsync,e.encode=(i,a)=>wy(e,i,a),e.decode=(i,a)=>Cy(e,i,a),e.encodeAsync=async(i,a)=>_y(e,i,a),e.decodeAsync=async(i,a)=>vy(e,i,a),e.safeEncode=(i,a)=>Ny(e,i,a),e.safeDecode=(i,a)=>Oy(e,i,a),e.safeEncodeAsync=async(i,a)=>Ly(e,i,a),e.safeDecodeAsync=async(i,a)=>Dy(e,i,a),e.refine=(i,a)=>e.check(Ag(i,a)),e.superRefine=i=>e.check(Pg(i)),e.overwrite=i=>e.check(ns(i)),e.optional=()=>sc(e),e.exactOptional=()=>pg(e),e.nullable=()=>ic(e),e.nullish=()=>sc(ic(e)),e.nonoptional=i=>Eg(e,i),e.array=()=>ae(e),e.or=i=>jr([e,i]),e.and=i=>ag(e,i),e.transform=i=>nc(e,ug(i)),e.default=i=>mg(e,i),e.prefault=i=>gg(e,i),e.catch=i=>Sg(e,i),e.pipe=i=>nc(e,i),e.readonly=()=>xg(e),e.describe=i=>{const a=e.clone();return vs.add(a,{description:i}),a},Object.defineProperty(e,"description",{get(){return vs.get(e)?.description},configurable:!0}),e.meta=(...i)=>{if(i.length===0)return vs.get(e);const a=e.clone();return vs.add(a,i[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=i=>i(e),e)),Ko=P("_ZodString",(e,s)=>{$r.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Zm(e,a,c);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,e.regex=(...a)=>e.check(_m(...a)),e.includes=(...a)=>e.check(Om(...a)),e.startsWith=(...a)=>e.check(Lm(...a)),e.endsWith=(...a)=>e.check(Dm(...a)),e.min=(...a)=>e.check(hi(...a)),e.max=(...a)=>e.check(zo(...a)),e.length=(...a)=>e.check(Vo(...a)),e.nonempty=(...a)=>e.check(hi(1,...a)),e.lowercase=a=>e.check(vm(a)),e.uppercase=a=>e.check(Nm(a)),e.trim=()=>e.check(Rm()),e.normalize=(...a)=>e.check(km(...a)),e.toLowerCase=()=>e.check(Mm()),e.toUpperCase=()=>e.check($m()),e.slugify=()=>e.check(Fm())}),ky=P("ZodString",(e,s)=>{$r.init(e,s),Ko.init(e,s),e.email=i=>e.check(Qf(Ry,i)),e.url=i=>e.check(Fo(Yo,i)),e.jwt=i=>e.check(Em(Yy,i)),e.emoji=i=>e.check(rm(My,i)),e.guid=i=>e.check($o(qo,i)),e.uuid=i=>e.check(em(di,i)),e.uuidv4=i=>e.check(tm(di,i)),e.uuidv6=i=>e.check(sm(di,i)),e.uuidv7=i=>e.check(im(di,i)),e.nanoid=i=>e.check(nm($y,i)),e.guid=i=>e.check($o(qo,i)),e.cuid=i=>e.check(am(Fy,i)),e.cuid2=i=>e.check(om(By,i)),e.ulid=i=>e.check(cm(Uy,i)),e.base64=i=>e.check(mm(Wy,i)),e.base64url=i=>e.check(ym(Ky,i)),e.xid=i=>e.check(lm(jy,i)),e.ksuid=i=>e.check(um(zy,i)),e.ipv4=i=>e.check(hm(Vy,i)),e.ipv6=i=>e.check(pm(Gy,i)),e.cidrv4=i=>e.check(dm(Hy,i)),e.cidrv6=i=>e.check(fm(Zy,i)),e.e164=i=>e.check(gm(qy,i)),e.datetime=i=>e.check(fy(i)),e.date=i=>e.check(yy(i)),e.time=i=>e.check(Ey(i)),e.duration=i=>e.check(Sy(i))});function O(e){return Jf(ky,e)}const Ee=P("ZodStringFormat",(e,s)=>{de.init(e,s),Ko.init(e,s)}),Ry=P("ZodEmail",(e,s)=>{nf.init(e,s),Ee.init(e,s)}),qo=P("ZodGUID",(e,s)=>{sf.init(e,s),Ee.init(e,s)}),di=P("ZodUUID",(e,s)=>{rf.init(e,s),Ee.init(e,s)}),Yo=P("ZodURL",(e,s)=>{af.init(e,s),Ee.init(e,s)});function Xo(e){return Fo(Yo,e)}const My=P("ZodEmoji",(e,s)=>{of.init(e,s),Ee.init(e,s)}),$y=P("ZodNanoID",(e,s)=>{cf.init(e,s),Ee.init(e,s)}),Fy=P("ZodCUID",(e,s)=>{lf.init(e,s),Ee.init(e,s)}),By=P("ZodCUID2",(e,s)=>{uf.init(e,s),Ee.init(e,s)}),Uy=P("ZodULID",(e,s)=>{hf.init(e,s),Ee.init(e,s)}),jy=P("ZodXID",(e,s)=>{pf.init(e,s),Ee.init(e,s)}),zy=P("ZodKSUID",(e,s)=>{df.init(e,s),Ee.init(e,s)}),Vy=P("ZodIPv4",(e,s)=>{Ef.init(e,s),Ee.init(e,s)}),Gy=P("ZodIPv6",(e,s)=>{Tf.init(e,s),Ee.init(e,s)}),Hy=P("ZodCIDRv4",(e,s)=>{Sf.init(e,s),Ee.init(e,s)}),Zy=P("ZodCIDRv6",(e,s)=>{bf.init(e,s),Ee.init(e,s)}),Wy=P("ZodBase64",(e,s)=>{If.init(e,s),Ee.init(e,s)}),Ky=P("ZodBase64URL",(e,s)=>{Af.init(e,s),Ee.init(e,s)}),qy=P("ZodE164",(e,s)=>{Pf.init(e,s),Ee.init(e,s)}),Yy=P("ZodJWT",(e,s)=>{Cf.init(e,s),Ee.init(e,s)}),Jo=P("ZodNumber",(e,s)=>{xo.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Wm(e,a,c),e.gt=(a,c)=>e.check(Uo(a,c)),e.gte=(a,c)=>e.check(Ur(a,c)),e.min=(a,c)=>e.check(Ur(a,c)),e.lt=(a,c)=>e.check(Bo(a,c)),e.lte=(a,c)=>e.check(Br(a,c)),e.max=(a,c)=>e.check(Br(a,c)),e.int=a=>e.check(st(a)),e.safe=a=>e.check(st(a)),e.positive=a=>e.check(Uo(0,a)),e.nonnegative=a=>e.check(Ur(0,a)),e.negative=a=>e.check(Bo(0,a)),e.nonpositive=a=>e.check(Br(0,a)),e.multipleOf=(a,c)=>e.check(jo(a,c)),e.step=(a,c)=>e.check(jo(a,c)),e.finite=()=>e;const i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function fi(e){return xm(Jo,e)}const Xy=P("ZodNumberFormat",(e,s)=>{_f.init(e,s),Jo.init(e,s)});function st(e){return Am(Xy,e)}const Jy=P("ZodBoolean",(e,s)=>{vf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Km(e,i,a)});function te(e){return Pm(Jy,e)}const Qy=P("ZodUnknown",(e,s)=>{Nf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Ym()});function Qo(){return wm(Qy)}const eg=P("ZodNever",(e,s)=>{Of.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>qm(e,i,a)});function tg(e){return Cm(eg,e)}const sg=P("ZodArray",(e,s)=>{Lf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ty(e,i,a,c),e.element=s.element,e.min=(i,a)=>e.check(hi(i,a)),e.nonempty=i=>e.check(hi(1,i)),e.max=(i,a)=>e.check(zo(i,a)),e.length=(i,a)=>e.check(Vo(i,a)),e.unwrap=()=>e.element});function ae(e,s){return Bm(sg,e,s)}const ig=P("ZodObject",(e,s)=>{kf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>sy(e,i,a,c),re(e,"shape",()=>s.shape),e.keyof=()=>ne(Object.keys(e._zod.def.shape)),e.catchall=i=>e.clone({...e._zod.def,catchall:i}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Qo()}),e.loose=()=>e.clone({...e._zod.def,catchall:Qo()}),e.strict=()=>e.clone({...e._zod.def,catchall:tg()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=i=>ed(e,i),e.safeExtend=i=>td(e,i),e.merge=i=>sd(e,i),e.pick=i=>Jp(e,i),e.omit=i=>Qp(e,i),e.partial=(...i)=>id(tc,e,i[0]),e.required=(...i)=>rd(rc,e,i[0])});function w(e,s){const i={type:"object",shape:e??{},...U(s)};return new ig(i)}const ec=P("ZodUnion",(e,s)=>{_o.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>iy(e,i,a,c),e.options=s.options});function jr(e,s){return new ec({type:"union",options:e,...U(s)})}const rg=P("ZodDiscriminatedUnion",(e,s)=>{ec.init(e,s),Rf.init(e,s)});function Ve(e,s,i){return new rg({type:"union",options:s,discriminator:e,...U(i)})}const ng=P("ZodIntersection",(e,s)=>{Mf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ry(e,i,a,c)});function ag(e,s){return new ng({type:"intersection",left:e,right:s})}const og=P("ZodRecord",(e,s)=>{$f.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ny(e,i,a,c),e.keyType=s.keyType,e.valueType=s.valueType});function Oe(e,s,i){return new og({type:"record",keyType:e,valueType:s,...U(i)})}const zr=P("ZodEnum",(e,s)=>{Ff.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Xm(e,a,c),e.enum=s.entries,e.options=Object.values(s.entries);const i=new Set(Object.keys(s.entries));e.extract=(a,c)=>{const u={};for(const h of a)if(i.has(h))u[h]=s.entries[h];else throw new Error(`Key ${h} not found in enum`);return new zr({...s,checks:[],...U(c),entries:u})},e.exclude=(a,c)=>{const u={...s.entries};for(const h of a)if(i.has(h))delete u[h];else throw new Error(`Key ${h} not found in enum`);return new zr({...s,checks:[],...U(c),entries:u})}});function ne(e,s){const i=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new zr({type:"enum",entries:i,...U(s)})}const cg=P("ZodLiteral",(e,s)=>{Bf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Jm(e,i,a),e.values=new Set(s.values),Object.defineProperty(e,"value",{get(){if(s.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return s.values[0]}})});function D(e,s){return new cg({type:"literal",values:Array.isArray(e)?e:[e],...U(s)})}const lg=P("ZodTransform",(e,s)=>{Uf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ey(e,i),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new ro(e.constructor.name);i.addIssue=u=>{if(typeof u=="string")i.issues.push(_s(u,i.value,s));else{const h=u;h.fatal&&(h.continue=!1),h.code??(h.code="custom"),h.input??(h.input=i.value),h.inst??(h.inst=e),i.issues.push(_s(h))}};const c=s.transform(i.value,i);return c instanceof Promise?c.then(u=>(i.value=u,i)):(i.value=c,i)}});function ug(e){return new lg({type:"transform",transform:e})}const tc=P("ZodOptional",(e,s)=>{Oo.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Wo(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new tc({type:"optional",innerType:e})}const hg=P("ZodExactOptional",(e,s)=>{jf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Wo(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function pg(e){return new hg({type:"optional",innerType:e})}const dg=P("ZodNullable",(e,s)=>{zf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ay(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function ic(e){return new dg({type:"nullable",innerType:e})}const fg=P("ZodDefault",(e,s)=>{Vf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>cy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mg(e,s){return new fg({type:"default",innerType:e,get defaultValue(){return typeof s=="function"?s():lo(s)}})}const yg=P("ZodPrefault",(e,s)=>{Gf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ly(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function gg(e,s){return new yg({type:"prefault",innerType:e,get defaultValue(){return typeof s=="function"?s():lo(s)}})}const rc=P("ZodNonOptional",(e,s)=>{Hf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>oy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function Eg(e,s){return new rc({type:"nonoptional",innerType:e,...U(s)})}const Tg=P("ZodCatch",(e,s)=>{Zf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>uy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Sg(e,s){return new Tg({type:"catch",innerType:e,catchValue:typeof s=="function"?s:()=>s})}const bg=P("ZodPipe",(e,s)=>{Wf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>hy(e,i,a,c),e.in=s.in,e.out=s.out});function nc(e,s){return new bg({type:"pipe",in:e,out:s})}const Ig=P("ZodReadonly",(e,s)=>{Kf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>py(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function xg(e){return new Ig({type:"readonly",innerType:e})}const ac=P("ZodCustom",(e,s)=>{qf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Qm(e,i)});function as(e,s){return Um(ac,e??(()=>!0),s)}function Ag(e,s={}){return jm(ac,e,s)}function Pg(e){return zm(e)}const dt={SCROLL_TO_TILE:"SCROLL_TO_TILE",HYPER_LINK:"HYPER_LINK",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"},wg=ne(Object.values(dt)),mi=dt,Ns={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"},Cg=ne(Object.values(Ns)),yi=Ns,oc={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"},_g=ne(Object.values(oc)),vg=oc,cc={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"},Ng=ne(Object.values(cc)),Og=cc,lc={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"},Lg=ne(Object.values(lc)),Dg=lc,gi={COLOR:"COLOR",GRADIENT:"GRADIENT"},kg=ne(Object.values(gi)),Vr=gi,Bt={SECTION:"SECTION",HEADER:"HEADER",FOOTER:"FOOTER"},Rg=ne(Object.values(Bt)),ft=Bt;var Ge=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(Ge||{}),pe=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e[e.CollectionDescriptor=14]="CollectionDescriptor",e[e.CollectionAsset=15]="CollectionAsset",e))(pe||{}),Mg=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(Mg||{});const F={TEXTAREA:"TEXTAREA",INPUTBOX:"INPUTBOX",SELECTBOX:"SELECTBOX",IMAGE:"IMAGE",TOGGLE:"TOGGLE",BUTTON:"BUTTON",DECK:"DECK",MENU:"MENU",NAVIGATION_MENU:"NAVIGATION_MENU",LOGO:"LOGO",INFO:"INFO",DIVIDER:"DIVIDER",PRODUCT_SELECTOR:"PRODUCT_SELECTOR",CATEGORY_SELECTOR:"CATEGORY_SELECTOR"};ne(Object.values(F));const K={TEXT:"TEXT",BUTTON:"BUTTON",IMAGE:"IMAGE",TOGGLE:"TOGGLE",SELECTBOX:"SELECTBOX",BACKGROUND:"BACKGROUND",COLOR_PICKER:"COLOR_PICKER",LOGO:"LOGO",DIVIDER:"DIVIDER",INFO:"INFO",ACCORDION:"ACCORDION"};ne(Object.values(K));const He=K,Os={CONTENT:"Content",DESIGN:"Design"};ne(Object.values(Os));const $g={TEXT:"TEXT",IMAGE:"IMAGE"},Fg=ne(Object.values($g));var Bg=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(Bg||{}),Ug=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(Ug||{});const uc={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},hc={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},pc={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"};ne(Object.values(uc)),ne(Object.values(hc)),ne(Object.values(pc));const jg={TOP_BAR:["breadcrumbsPosition","showNavigationArrows"],GALLERY:["galleryLayout","showProductPhotoZoom","showAltTextAsDescription"],SIDEBAR:["showWeight","showAttributes","showProductDescription","showProductSku","showInStockLabel","showNumberOfItemsInStock","showQuantity","optionSize","optionShape","showOutlets","showDeliveryTime","showWholesalePrices","showReviewSection","favoritesEnabled","showShareButtons","showLoyalty","breadcrumbsPosition"],DESCRIPTION:["showWeight","showAttributes","showProductDescription"],REVIEW_LIST:["showReviewSection","showReviewsSectionInOneCardView"],RELATED_PRODUCTS:[],BOTTOM_BAR:[],CUSTOM_SLOT:[]},dc=["categoryViewMode","productFiltersVisibleOnCatalogPages","productFiltersPositionOnCatalogPages","productFiltersOpenedByDefaultOnCategoryPage","productFiltersOrientationPosition","showSortViewAsOptions","productCardSpacingType","productCardLayout","imageAspectRatio","imageSize","productTitleBehavior","productSubtitleBehavior","productPriceBehavior","productListSwatchesProductOptionBehavior","productSkuBehavior","productBuyButtonBehavior","productRatingSectionBehavior","productRatingViewBehavior","showProductRatingAvg","showProductTotalNumberOfReview","showProductFrame","showProductImages","showAdditionalImageOnHover","categoryTitleBehavior"],fc=["showFooterMenu","showSigninLink"],zg={PRODUCT_LIST:dc,BOTTOM_BAR:fc,CUSTOM_SLOT:[]},Vg={CATEGORY_TITLE:[],PRODUCT_LIST:dc,BOTTOM_BAR:fc,CUSTOM_SLOT:[]},Gg={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"},Hg=ne(Object.values(Gg)),Pe={[ft.SECTION]:{source:"sections",dist:"dist/sections"},[ft.HEADER]:{source:"headers",dist:"dist/headers"},[ft.FOOTER]:{source:"footers",dist:"dist/footers"}};var se=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e[e.SourceCode=7]="SourceCode",e[e.LayoutClient=8]="LayoutClient",e[e.LayoutAsset=9]="LayoutAsset",e[e.SlotServer=10]="SlotServer",e[e.SlotClient=11]="SlotClient",e[e.SlotClientChunks=12]="SlotClientChunks",e[e.SlotClientAsset=13]="SlotClientAsset",e[e.CollectionAsset=14]="CollectionAsset",e))(se||{});function os(e){const s={};for(const[i,a]of Object.entries(e)){let c={...a};if(a.type==="DECK"&&a.cards&&typeof a.cards=="object"&&"defaultCardContent"in a.cards){const u=a.cards;u.defaultCardContent?.settings&&(c={...c,cards:{...u,defaultCardContent:{...u.defaultCardContent,settings:os(u.defaultCardContent.settings)}}})}if(a.type==="ACCORDION"&&a.cards&&typeof a.cards=="object"&&!("defaultCardContent"in a.cards)){const u=a.cards,h={};for(const[f,y]of Object.entries(u))y.editors?h[f]={...y,editors:os(y.editors)}:h[f]=y;c={...c,cards:h}}if(c.defaults&&typeof c.defaults=="object"&&!("type"in c.defaults)){const u=Object.assign({type:c.type},c.defaults);c={...c,defaults:u}}s[i]=c}return s}const Zg={url:"must be a valid URL",email:"must be a valid email address"},Wg=e=>{const s=e?.at(-1);return typeof s=="string"?`'${s}'`:"Field"},Kg=e=>e===null?"null":typeof e,qg=e=>{switch(e.code){case"invalid_type":{const{input:s}=e;return s===void 0?{message:`${Wg(e.path)} is required`}:{message:`Expected ${String(e.expected)}, received ${Kg(s)}`}}case"invalid_format":{const s=Zg[e.format];return s?{message:s}:void 0}case"unrecognized_keys":return{message:`Unrecognized property: ${e.keys.map(s=>`'${s}'`).join(", ")}`};case"invalid_union":{const s=e.path?.at(-1);return typeof s=="string"?{message:`'${s}' is required or has invalid value`}:void 0}case"invalid_value":{const{values:s}=e;return s?{message:`Expected one of: ${s.map(i=>`'${String(i)}'`).join(", ")}`}:void 0}case"invalid_key":{const s=e.issues?.[0];return s?{message:s.message}:void 0}default:return}},Yg={ARIAL:"arial",GEORGIA:"georgia",HELVETICA:"helvetica",TIMES_NEW_ROMAN:"times_new_roman"},Xg=ne(Object.values(Yg)),Jg={ABEEZEE:"abeezee",ABEL:"abel",ABRIL_FATFACE:"abril_fatface",ACME:"acme",ACTOR:"actor",ADAMINA:"adamina",ALEGREYA:"alegreya",ALICE:"alice",ANTON:"anton",ARCHIVO:"archivo",ARIMO:"arimo",ARSENAL:"arsenal",ARVO:"arvo",AVERAGE_SANS:"average_sans",BASIC:"basic",BITTER:"bitter",CABIN:"cabin",CHIVO:"chivo",CINZEL:"cinzel",COMFORTAA:"comfortaa",CORMORANT_GARAMOND:"cormorant_garamond",DIDACT_GOTHIC:"didact_gothic",DM_MONO:"dm_mono",DM_SANS:"dm_sans",DM_SERIF_TEXT:"dm_serif_text",EXO_TWO:"exo_two",FIRA_SANS:"fira_sans",FIRA_SANS_EXTRA_CONDENSED:"fira_sans_extra_condensed",GRANDSTANDER:"grandstander",HIND:"hind",IBM_PLEX_MONO:"ibm_plex_mono",IBM_PLEX_SANS:"ibm_plex_sans",IBM_PLEX_SERIF:"ibm_plex_serif",INKNUT_ANTIQUA:"inknut_antiqua",INSTRUMENT_SERIF:"instrument_serif",INTER:"inter",JOSEFIN_SANS:"josefin_sans",KARLA:"karla",KRONA_ONE:"krona_one",LATO:"lato",LORA:"lora",LUCKIEST_GUY:"luckiest_guy",MANROPE:"manrope",MERRIWEATHER:"merriweather",MERRIWEATHER_SANS:"merriweather_sans",MONTSERRAT:"montserrat",MULISH:"mulish",NOTO_SANS:"noto_sans",NOTO_SERIF:"noto_serif",NUNITO:"nunito",OLD_STANDARD_TT:"old_standard_tt",OPEN_SANS:"open_sans",OPEN_SANS_CONDENSED:"open_sans_condensed",ORIENTA:"orienta",OSWALD:"oswald",OXYGEN:"oxygen",PIAZZOLLA:"piazzolla",PLAYFAIR_DISPLAY:"playfair_display",POPPINS:"poppins",PRATA:"prata",PT_MONO:"pt_mono",PT_SANS:"pt_sans",PT_SERIF:"pt_serif",PT_SERIF_CAPTION:"pt_serif_caption",QUATTROCENTO:"quattrocento",QUESTRIAL:"questrial",QUICKSAND:"quicksand",RALEWAY:"raleway",ROBOTO:"roboto",ROBOTO_CONDENSED:"roboto_condensed",ROBOTO_FLEX:"roboto_flex",ROBOTO_MONO:"roboto_mono",ROBOTO_SLAB:"roboto_slab",RUBIK:"rubik",SMOOCH:"smooch",SORA:"sora",SOURCE_SANS_PRO:"source_sans_pro",SPACE_GROTESK:"space_grotesk",SPECTRAL:"spectral",SYNE:"syne",TENOR_SANS:"tenor_sans",UBUNTU:"ubuntu",WORK_SANS:"work_sans",YANONE_KAFFEESATZ:"yanone_kaffeesatz",YESEVA_ONE:"yeseva_one"},Qg=ne(Object.values(Jg)),eE={AMBIDEXTER:"ambidexter",AUTHENTIC_SANS:"authentic_sans",AVARA:"avara",CLASH_DISPLAY:"clash_display",FUNGIS:"fungis",GENERAL_SANS:"general_sans",GOLOS:"golos",LE_MURMURE:"le_murmure",MATTONE:"mattone",MESSAPIA:"messapia",ORTICA_LINEAR:"ortica_linear",SPORTING_GROTESQUE:"sporting_grotesque",SPRAT:"sprat",SPRAT_CONDENSED:"sprat_condensed",SPRAT_EXTENDED:"sprat_extended",STANDARD:"standard",TECHNOR:"technor",TERMINAL_GROTESQUE:"terminal_grotesque",WREMENA:"wremena"},tE=ne(Object.values(eE)),mc=jr([Xg,Qg,tE]),sE={REGULAR:"regular",MEDIUM:"medium",SEMIBOLD:"semibold",BOLD:"bold",REGULAR_ITALIC:"regular-italic",MEDIUM_ITALIC:"medium-italic",SEMIBOLD_ITALIC:"semibold-italic",BOLD_ITALIC:"bold-italic"},yc=ne(Object.values(sE));ne(["none","all","small"]);const Ut={PRODUCT:"PRODUCT",CATALOG:"CATALOG",CATEGORY:"CATEGORY",HOME:"HOME",CUSTOM:"CUSTOM"},gc={HOME:"home",CATALOG:"catalog",CATEGORY:"category",PRODUCT:"product"},iE=ne(Object.values(Ut));ne(Object.values(gc));const rE={HEADER_LEFT:"HEADER_LEFT",HEADER_CENTER_LOGO_BURGER:"HEADER_CENTER_LOGO_BURGER",HEADER_CENTER_LOGO_COMPACT:"HEADER_CENTER_LOGO_COMPACT",HEADER_CENTER_LOGO_DETAILED:"HEADER_CENTER_LOGO_DETAILED",HEADER_LEFT_LOGO_BURGER:"HEADER_LEFT_LOGO_BURGER",HEADER_LEFT_LOGO_COMPACT:"HEADER_LEFT_LOGO_COMPACT",HEADER_LEFT_LOGO_DETAILED:"HEADER_LEFT_LOGO_DETAILED",HEADER_LEFT_LOGO_SEARCH:"HEADER_LEFT_LOGO_SEARCH",HEADER_LEFT_LOGO_TEXT:"HEADER_LEFT_LOGO_TEXT",TEXT_ONE_COLUMN:"TEXT_ONE_COLUMN",TEXT_TITLE_LEFT:"TEXT_TITLE_LEFT",TEXT_SUBTITLE_RIGHT:"TEXT_SUBTITLE_RIGHT",TEXT_TWO_COLUMNS:"TEXT_TWO_COLUMNS",TEXT_CENTER:"TEXT_CENTER",TEXT_DESCRIPTION_RIGHT:"TEXT_DESCRIPTION_RIGHT",CTA_BANNER_LEFT:"CTA_BANNER_LEFT",CTA_BANNER_RIGHT:"CTA_BANNER_RIGHT",CTA_BANNER_CENTER:"CTA_BANNER_CENTER",CTA_BANNER_BOTTOM:"CTA_BANNER_BOTTOM",CTA_PROMO_BAR_LEFT:"CTA_PROMO_BAR_LEFT",CTA_PROMO_BAR_RIGHT:"CTA_PROMO_BAR_RIGHT",CTA_STORY_LEFT:"CTA_STORY_LEFT",CTA_STORY_RIGHT:"CTA_STORY_RIGHT",CTA_FULLWIDTH_CENTER:"CTA_FULLWIDTH_CENTER",CTA_FULLWIDTH_LEFT:"CTA_FULLWIDTH_LEFT",CTA_FULLWIDTH_NO_IMAGE:"CTA_FULLWIDTH_NO_IMAGE",COVER_FULLSCREEN_CENTER:"COVER_FULLSCREEN_CENTER",COVER_FULLSCREEN_LEFT:"COVER_FULLSCREEN_LEFT",COVER_FULLSCREEN_CENTER_LEFT:"COVER_FULLSCREEN_CENTER_LEFT",COVER_FULLSCREEN_RIGHT:"COVER_FULLSCREEN_RIGHT",COVER_FULLSCREEN_BOTTOM:"COVER_FULLSCREEN_BOTTOM",COVER_FULLSCREEN_BOTTOM_RIGHT:"COVER_FULLSCREEN_BOTTOM_RIGHT",COVER_FULLSCREEN_BOTTOM_LEFT:"COVER_FULLSCREEN_BOTTOM_LEFT",COVER_FULLSCREEN_TOP:"COVER_FULLSCREEN_TOP",COVER_SIDEBAR_RIGHT:"COVER_SIDEBAR_RIGHT",COVER_SIDEBAR_LEFT:"COVER_SIDEBAR_LEFT",COVER_HALFSCREEN_LEFT:"COVER_HALFSCREEN_LEFT",COVER_HALFSCREEN_CENTER:"COVER_HALFSCREEN_CENTER",COVER_COLLAGE_BOTTOM:"COVER_COLLAGE_BOTTOM",COVER_COLLAGE_LEFT:"COVER_COLLAGE_LEFT",IMAGE_SUBTITLE_RIGHT:"IMAGE_SUBTITLE_RIGHT",IMAGE_TITLE_LEFT:"IMAGE_TITLE_LEFT",IMAGE_LEFT:"IMAGE_LEFT",IMAGE_RIGHT:"IMAGE_RIGHT",IMAGE_CENTER:"IMAGE_CENTER",IMAGE_SIDE_TITLE:"IMAGE_SIDE_TITLE",LOCATION_MAP_RIGHT:"LOCATION_MAP_RIGHT",LOCATION_MAP_LEFT:"LOCATION_MAP_LEFT",LOCATION_IMAGE_RIGHT:"LOCATION_IMAGE_RIGHT",LOCATION_IMAGE_LEFT:"LOCATION_IMAGE_LEFT",LOCATION_BACKGROUND_RIGHT:"LOCATION_BACKGROUND_RIGHT",LOCATION_BACKGROUND_LEFT:"LOCATION_BACKGROUND_LEFT",LOCATION_FULL:"LOCATION_FULL",LOCATION_SHORT:"LOCATION_SHORT",REVIEWS_MINIMAL:"REVIEWS_MINIMAL",REVIEWS_CARDS:"REVIEWS_CARDS",REVIEWS:"REVIEWS",REVIEWS_CLASSIC:"REVIEWS_CLASSIC",REVIEWS_FULLSCREEN_BG:"REVIEWS_FULLSCREEN_BG",REVIEWS_FULLSCREEN_SIDEBAR_LEFT:"REVIEWS_FULLSCREEN_SIDEBAR_LEFT",REVIEWS_FULLSCREEN_SIDEBAR_RIGHT:"REVIEWS_FULLSCREEN_SIDEBAR_RIGHT",REVIEWS_CARDS_PHOTO:"REVIEWS_CARDS_PHOTO",REVIEWS_PHOTO_SPEECH_RIGHT:"REVIEWS_PHOTO_SPEECH_RIGHT",REVIEWS_PHOTO_SPEECH_LEFT:"REVIEWS_PHOTO_SPEECH_LEFT",REVIEWS_SOCIAL_FEED:"REVIEWS_SOCIAL_FEED",REVIEWS_ADAPTIVE:"REVIEWS_ADAPTIVE",FEATURES_CLASSIC_CENTER:"FEATURES_CLASSIC_CENTER",FEATURES_CLASSIC_LEFT:"FEATURES_CLASSIC_LEFT",FEATURES_ACCORDION:"FEATURES_ACCORDION",FEATURES_MINIMAL:"FEATURES_MINIMAL",FEATURES_SMALL_ICONS:"FEATURES_SMALL_ICONS",FEATURES_CAROUSEL:"FEATURES_CAROUSEL",FEATURES_IMAGE_LEFT:"FEATURES_IMAGE_LEFT",FEATURES_IMAGE_RIGHT:"FEATURES_IMAGE_RIGHT",ANNOUNCEMENT_CENTER:"ANNOUNCEMENT_CENTER",TWO_COLUMNS_SIDEBAR_ON_THE_LEFT:"TWO_COLUMNS_SIDEBAR_ON_THE_LEFT",TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT:"TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT",THREE_COLUMNS_SIDEBAR_ON_THE_RIGHT:"THREE_COLUMNS_SIDEBAR_ON_THE_RIGHT",THREE_COLUMNS_SIDEBAR_ON_THE_LEFT:"THREE_COLUMNS_SIDEBAR_ON_THE_LEFT",TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT_DESCRIPTION_UNDER_IMAGE:"TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT_DESCRIPTION_UNDER_IMAGE",SLIDER_FULLSCREEN_CENTER:"SLIDER_FULLSCREEN_CENTER",SLIDER_FULLSCREEN_LEFT:"SLIDER_FULLSCREEN_LEFT",SLIDER_BASIC:"SLIDER_BASIC",SLIDER_CAROUSEL:"SLIDER_CAROUSEL",SLIDER_CAROUSEL_PORTRAIT:"SLIDER_CAROUSEL_PORTRAIT",SLIDER_SPLIT:"SLIDER_SPLIT",SLIDER_SPLIT_REVERSE:"SLIDER_SPLIT_REVERSE"},nE=ne(Object.values(rE)),aE={HEADER:"header",COVER:"cover",ANNOUNCEMENT_BAR:"announcement_bar",SLIDER:"slider",SPECIAL_OFFER:"special_offer",CUSTOMER_REVIEW:"customer_review",COMPANY_INFO:"company_info",SHIPPING_PAYMENT:"shipping_payment",LOCATION:"location",STORE:"store",FOOTER:"footer",VIDEO:"video",IMAGE_GALLERY:"image_gallery",CONTACT_INFO:"contact_info",CONTACTS_WIDGET_WHATSAPP:"contacts_widget_whatsapp",CONTACTS_WIDGET_INSTAGRAM:"contacts_widget_instagram",CONTACTS_WIDGET_FACEBOOK:"contacts_widget_facebook",CONTACTS_WIDGET_PHONE:"contacts_widget_phone"},oE={COVER:"COVER",ANNOUNCEMENT:"ANNOUNCEMENT",STORE:"STORE",SLIDER:"SLIDER",VIDEO:"VIDEO",SPECIAL_OFFER:"SPECIAL_OFFER",CUSTOMER_REVIEW:"CUSTOMER_REVIEW",COMPANY_INFO:"COMPANY_INFO",SHIPPING_PAYMENT:"SHIPPING_PAYMENT",LOCATION:"LOCATION",COLLECTIONS:"COLLECTIONS",BRANDS:"BRANDS",CONTACT_INFO:"CONTACT_INFO"},cE=ne(Object.values(oE)),lE={LEFT:"left",CENTER:"center"},uE=ne(Object.values(lE)),hE={SHARP:"sharp",SOFTENED:"softened",SLIGHTLY_ROUNDED:"slightly_rounded",ROUNDED:"rounded",GREATLY_ROUNDED:"greatly_rounded"},pE=ne(Object.values(hE)),Be={REQUIRED_HEADER_ID:()=>'Header section must have id "header" when type is "default"',REQUIRED_CUSTOM_HEADER:(...e)=>`Custom header section with id "${e[0]}" must exist in headers directory`,REQUIRED_CUSTOM_HEADER_TYPE:(...e)=>`Custom header section with id "${e[0]}" must be of type "HEADER"`,REQUIRED_FOOTER_ID:()=>'Footer section must have id "footer" when type is "default"',REQUIRED_CUSTOM_FOOTER:(...e)=>`Custom footer section with id "${e[0]}" must exist in footers directory`,REQUIRED_CUSTOM_FOOTER_TYPE:(...e)=>`Custom footer section with id "${e[0]}" must be of type "FOOTER"`,REQUIRED_PAGE_SECTION:(...e)=>`Custom section with id "${e[0]}" must exist in sections directory`,REQUIRED_PAGE_SECTION_TYPE:()=>'Section "header" or "footer" is not allowed among page sections',SHOWCASE_ID_NOT_FOUND:(...e)=>`Showcase with id "${e[0]}" must exist in section's showcase directory`,DUPLICATE_SHOWCASE_ID:(...e)=>`Showcase id "${e[0]}" must be unique within section showcases`,SHOWCASE_OVERRIDE_CONTENT:(...e)=>`Content editor "${e[0]}" in showcase_overrides must exist in section's content configuration file`,SHOWCASE_OVERRIDE_DESIGN:(...e)=>`Design editor "${e[0]}" in showcase_overrides must exist in section's design configuration file`,SHOWCASE_OVERRIDE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase_overrides must exist in section's layout configuration file`,SHOWCASE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase must exist in section's layout configuration file`,INVALID_SHOWCASE_CONTENT_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in content.ts`,SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but content.ts has type "${e[2]}"`,INVALID_SHOWCASE_DESIGN_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in design.ts`,SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but design.ts has type "${e[2]}"`,INVALID_DECK_CARD_SETTING:(...e)=>`Setting "${e[0]}" is not defined in content.ts defaultCardContent.settings`,DECK_SETTINGS_REQUIRED:()=>"settings must have at least one property",INVALID_SELECTBOX_OPTION:(...e)=>`Option value "${e[0]}" for element "${e[1]}" is not defined in content.ts options`,REQUIRED_STORE_LAYOUT:(...e)=>`Store section with id "${e[0]}" and page type "${e[1]}" must have a corresponding layout defined`,INVALID_STORE_SECTION_ID:(...e)=>`Store layout sectionId "${e[0]}" must be one of: ${e[1]}`,REQUIRED_SECTION_ASSET:(...e)=>`Asset size ${e[0]} exceeds threshold of ${e[1]}.`,REQUIRED_SERVER_SIZE:(...e)=>`Size of individual server file [${e[0]}] must not exceed threshold [${e[1]}].`,MISSING_IMAGE_ASSET:(...e)=>`Image ${e[0]} is missing from assets folder`,MANDATORY_SETTING_TYPE_MISMATCH:(...e)=>`Editor type "${e[0]}" for reserved key "${e[1]}" does not match the required type "${e[2]}".`,MANDATORY_SETTING_NAME_MISMATCH:(...e)=>`Editor key "${e[0]}" for overridden content type "${e[1]}" does not match the required key name "${e[2]}".`,DUPLICATED_MANDATORY_SETTING:(...e)=>`Editor type "${e[0]}" can only be used once.`,IMAGE_EDITOR_STATIC_MISMATCH:(...e)=>`Both "${e[0]}" content and design editor need to have same value for attribute static`,DUPLICATE_DESIGN_EDITOR_NAME:()=>"Non-unique design editor name detected",COLOR_REQUIRED_GRADIENT:()=>"color is required when overlay is GRADIENT",COLOR_MUST_BE_ARRAY_GRADIENT:()=>"color must be an array when overlay is GRADIENT",COLOR_ARRAY_LENGTH_GRADIENT:()=>"color array must have exactly 2 items when overlay is GRADIENT",COLOR_REQUIRED_COLOR:()=>"color is required when overlay is COLOR",COLOR_MUST_BE_SINGLE_COLOR:()=>"color must be a single value when overlay is COLOR",COLOR_MUST_BE_UNDEFINED_NONE:()=>"color must be undefined when overlay is NONE or not set",COLOR_REQUIRED_STYLE_GRADIENT:()=>"color is required when style is GRADIENT",COLOR_MUST_BE_ARRAY_STYLE_GRADIENT:()=>"color must be an array when style is GRADIENT",COLOR_ARRAY_LENGTH_STYLE_GRADIENT:()=>"color array must have exactly 2 items when style is GRADIENT",COLOR_REQUIRED_STYLE_COLOR:()=>"color is required when style is COLOR",COLOR_MUST_BE_SINGLE_STYLE_COLOR:()=>"color must be a single value when style is COLOR",BUTTON_LINK_REQUIRED:()=>"link is required when buttonType is HYPER_LINK",BUTTON_CATEGORY_ID_REQUIRED:()=>"categoryId is required when buttonType is GO_TO_CATEGORY or GO_TO_CATEGORY_LINK",BUTTON_EMAIL_REQUIRED:()=>"email is required when buttonType is MAIL_LINK",BUTTON_PHONE_REQUIRED:()=>"phone is required when buttonType is TEL_LINK",BUTTON_TILE_ID_REQUIRED:(...e)=>`${e[0]} is required when buttonType is SCROLL_TO_TILE`,BUTTON_PAGE_ID_REQUIRED:()=>"pageIdForNavigate is required when type is GO_TO_PAGE",TEMPLATE_PAGE_SECTIONS_REQUIRED:()=>"sections must contain at least one section",TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have exactly one section`,TEMPLATE_PAGE_STORE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have a section of type "store"`,TEMPLATE_PAGE_NO_STORE_SECTIONS:(...e)=>`Page type "${e[0]}" cannot contain store sections`,TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED:()=>'Page type "CUSTOM" must have a metadata property',TEMPLATE_PAGE_METADATA_NOT_ALLOWED:(...e)=>`Page type "${e[0]}" must not have a metadata property`,TEMPLATE_CONFIGURATION_GLOBAL_SETTINGS_REQUIRED:()=>"globalSettings is required when styleId is provided",TEMPLATE_CONFIGURATION_STYLE_ID_REQUIRED:()=>"styleId is required when globalSettings is provided",NON_NEGATIVE_INTEGER:()=>"must be a non-negative integer",INTEGER_RANGE:(...e)=>`must be between ${e[0]} and ${e[1]}`,VALID_HEX_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA)",VALID_GLOBAL_FONT:()=>"must be a valid global font reference (global.fontFamily.title or global.fontFamily.body)",VALID_GLOBAL_TEXT_SIZE:()=>"must be a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_GLOBAL_COLOR:()=>"must be a valid global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA) or global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_TEXT_SIZE:()=>"must be an integer of at least 1 or a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_LANGUAGE_CODE:()=>"must be a valid language code (e.g., en, nl, fr, en_US, en_GB, zh_Hans)",VALID_URL:()=>"must be a valid URL",VALID_EMAIL:()=>"must be a valid email address",ACCORDION_ITEM_POSITION_FIELD_REQUIRED:(...e)=>`Item "${e[0]}" must have positionFieldName when sortable is true`,ACCORDION_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor`,ACCORDION_SHOWCASE_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor override`,ACCORDION_DUPLICATE_POSITION_FIELD_NAME:()=>"positionFieldName must be unique across accordion items when sortable is true",MISSING_SLOT_DESIGN_SETTINGS:(...e)=>`Slot "${e[0]}" cannot be used because required design settings are missing: ${e[1]}. Check the original example and add the missing settings.`,REQUIRED_COLLECTION_NAME:()=>"Collection must have a name in metadata"},Ec=/^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,Tc=/^global\.fontFamily\.(title|body)$/,Sc=/^global\.textSize\.(title|subtitle|body)$/,bc=/^global\.color\.(title|body|button|link|background)$/,dE=/^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$/,Nt=(e,s)=>{const i=Be.INTEGER_RANGE(e.toString(),s.toString());return st().min(e,{message:i}).max(s,{message:i})},Gr=w({path:O(),size:fi().nonnegative()}).strict(),Ic=w({size:fi().nonnegative()}).strict(),V=O().regex(/^\$.+/,{message:"must start with '$' followed by at least one character"}),fE=w({r:Nt(0,255),g:Nt(0,255),b:Nt(0,255),a:Nt(0,1)}).strict(),Ot=O().regex(Ec,{message:Be.VALID_HEX_COLOR()});as(e=>typeof e=="string"&&Tc.test(e),{message:Be.VALID_GLOBAL_FONT()});const Hr=O().refine(e=>!e.startsWith("global.")||Tc.test(e),{message:Be.VALID_GLOBAL_FONT()});as(e=>typeof e=="string"&&bc.test(e),{message:Be.VALID_GLOBAL_COLOR()});const it=as(e=>typeof e=="string"&&(Ec.test(e)||bc.test(e)),{message:Be.VALID_COLOR()}),xc=as(e=>typeof e=="string"?it.safeParse(e).success:Array.isArray(e)&&e.every(s=>it.safeParse(s).success),{message:Be.VALID_COLOR()});as(e=>typeof e=="string"&&Sc.test(e),{message:Be.VALID_GLOBAL_TEXT_SIZE()});const Ac=as(e=>typeof e=="number"?Number.isInteger(e)&&e>=1:typeof e=="string"&&Sc.test(e),{message:Be.VALID_TEXT_SIZE()}),Ls=ne(["catalog","category","product"]),Ei=O().refine(e=>e.startsWith("#")||Xo().safeParse(e).success,{message:"must be a valid URL or a hash fragment starting with #"}),mE=e=>{const s=e.map(i=>D(i));return jr(s)},Ds=w({url:O(),width:st().min(0,{message:Be.NON_NEGATIVE_INTEGER()}).optional(),height:st().min(0,{message:Be.NON_NEGATIVE_INTEGER()}).optional()}).strict(),yE=w({homogeneity:te().optional(),color:fE.optional()}).strict(),gE=w({ORIGINAL:Ds.optional(),WEBP_LOW_RES:Ds.optional(),WEBP_HI_2X_RES:Ds.optional(),MOBILE_WEBP_LOW_RES:Ds.optional(),MOBILE_WEBP_HI_RES:Ds.optional()}).strict().refine(e=>Object.keys(e).length>=1,{message:"set must have at least one property"}),Ti=w({set:gE,borderInfo:yE.optional()}).strict(),Zr=w({type:D(F.IMAGE),imageData:Ti}).strict(),Pc=w({type:D(F.IMAGE),label:V,static:te().optional(),defaults:Zr.optional()}).strict(),EE=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Wr(e){return e===Ut.PRODUCT||e===Ut.CATALOG||e===Ut.CATEGORY}function wc(e,s,i){if(!e)return;const a=Cp({path:"$..set..url",json:e,resultType:"all"}),c=/^https?:\/\//;a.forEach(u=>{const h=u.value;if(!c.test(h)&&!s.includes(h)){const f=u.pointer.split("/").filter(y=>y.length>0);i.at(f).addIssue("MISSING_IMAGE_ASSET",h)}})}function Cc(e,s,i){e===dt.HYPER_LINK&&!s&&i.at("link").addIssue("BUTTON_LINK_REQUIRED")}function _c(e,s,i){(e===dt.GO_TO_CATEGORY||e===dt.GO_TO_CATEGORY_LINK)&&!s&&i.at("categoryId").addIssue("BUTTON_CATEGORY_ID_REQUIRED")}function vc(e,s,i){e===dt.MAIL_LINK&&!s&&i.at("email").addIssue("BUTTON_EMAIL_REQUIRED")}function Nc(e,s,i){e===dt.TEL_LINK&&!s&&i.at("phone").addIssue("BUTTON_PHONE_REQUIRED")}function Oc(e,s,i,a){if(e===dt.SCROLL_TO_TILE&&!(s??i)){const c=s?"tileId":"tileIdForScroll";a.at(c).addIssue("BUTTON_TILE_ID_REQUIRED",c)}}function TE(e,s,i){e===dt.GO_TO_PAGE&&!s&&i.at("pageIdForNavigate").addIssue("BUTTON_PAGE_ID_REQUIRED")}const SE="custom";function Te(e,s=[]){const i=c=>Array.isArray(c)?c:[c],a=i(s);return{raw:e,addIssue(c,...u){e.addIssue({code:SE,message:Be[c](...u),path:a,params:{errorMessageKey:c}})},at(c){const u=a.concat(i(c));return Te(e,u)}}}const Kr=w({type:D(F.BUTTON),title:V,buttonType:wg,link:O().optional(),linkTarget:O().optional(),email:O().regex(EE,{message:Be.VALID_EMAIL()}).optional(),phone:O().optional(),tileId:O().optional(),categoryId:fi().optional()}).strict().superRefine((e,s)=>{const i=Te(s);Cc(e.buttonType,e.link,i),_c(e.buttonType,e.categoryId,i),vc(e.buttonType,e.email,i),Nc(e.buttonType,e.phone,i),Oc(e.buttonType,e.tileId,void 0,i)}),Lc=w({type:D(F.BUTTON),label:V,defaults:Kr.optional()}).strict(),qr=w({type:D(F.CATEGORY_SELECTOR)}).strict(),Dc=w({type:D(F.CATEGORY_SELECTOR),label:V,maxCategories:Nt(1,32),defaults:qr.optional()}).strict(),Yr=w({type:D(F.DIVIDER)}).strict(),kc=w({type:D(F.DIVIDER),label:V,defaults:Yr.optional()}).strict(),bE=w({label:V,link:Ei}).strict(),IE=w({title:V.optional(),link:Ei.optional()}).strict(),Xr=w({type:D(F.INFO),text:V.optional(),button:IE.optional()}).strict(),Rc=w({type:D(F.INFO),label:V,description:V,button:bE.optional(),defaults:Xr.optional()}).strict(),Jr=w({type:D(F.INPUTBOX),text:V}).strict(),Mc=w({type:D(F.INPUTBOX),label:V,placeholder:V,defaults:Jr.optional()}).strict(),Qr=w({type:D(F.PRODUCT_SELECTOR)}).strict(),$c=w({type:D(F.PRODUCT_SELECTOR),label:V,maxProducts:Nt(1,32),defaults:Qr.optional()}).strict(),en=w({type:D(F.SELECTBOX),value:O()}).strict(),xE=w({value:O().min(1,{message:"value must not be empty"}),label:V}).strict(),Fc=w({type:D(F.SELECTBOX),label:V,placeholder:V,description:V,options:ae(xE).min(1,{message:"must have at least one option"}),defaults:en.optional()}).strict(),tn=w({type:D(F.TEXTAREA),text:V}).strict(),Bc=w({type:D(F.TEXTAREA),label:V,placeholder:V,defaults:tn.optional()}).strict(),sn=w({type:D(F.TOGGLE),enabled:te()}).strict(),Uc=w({type:D(F.TOGGLE),label:V,description:V,defaults:sn.optional()}).strict(),jc=w({type:D(F.DECK)}).strict(),zc=[Jr,tn,Kr,Zr,sn,en,Yr,Xr,Qr,qr],AE=Ve("type",[...zc]),PE=w({type:D(F.DECK),cards:ae(w({settings:Oe(O(),AE).superRefine((e,s)=>{Object.keys(e).length<1&&Te(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),wE=Ve("type",[...zc,PE]),CE=w({type:D(F.DECK),cards:ae(w({settings:Oe(O(),wE).superRefine((e,s)=>{Object.keys(e).length<1&&Te(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),Vc=[Mc,Bc,Lc,Pc,Uc,Fc,kc,Rc,Dc,$c],_E=w({type:D(F.DECK),label:V,addButtonLabel:V,maxCards:st().min(1,{message:"must be a positive integer"}),cards:w({defaultCardContent:w({label:V,settings:Oe(O(),Ve("type",[...Vc])).superRefine((e,s)=>{Object.keys(e).length<1&&Te(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:jc.optional()}).strict(),vE=Ve("type",[...Vc,_E]),NE=w({type:D(F.DECK),label:V,addButtonLabel:V,maxCards:st().min(1,{message:"must be a positive integer"}),cards:w({defaultCardContent:w({label:V,settings:Oe(O(),vE).superRefine((e,s)=>{Object.keys(e).length<1&&Te(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:jc.optional()}).strict(),Gc=w({type:D(F.LOGO),logoType:Fg.optional(),text:V.optional(),imageData:Ti.optional()}).strict(),OE=w({type:D(F.LOGO),label:V.optional(),defaults:Gc.optional()}).strict(),Hc=w({id:O(),title:O().optional(),type:O().optional(),link:O().optional(),email:O().optional(),phone:O().optional(),tileIdForScroll:O().optional(),pageIdForNavigate:O().optional(),showStoreCategories:te().optional(),isSubmenuOpened:te().optional(),categoryId:fi().optional()}).strict().superRefine((e,s)=>{const i=Te(s);Cc(e.type,e.link,i),_c(e.type,e.categoryId,i),vc(e.type,e.email,i),Nc(e.type,e.phone,i),Oc(e.type,void 0,e.tileIdForScroll,i),TE(e.type,e.pageIdForNavigate,i)}),Zc=w({type:D(F.MENU),items:ae(Hc).optional()}).strict(),LE=w({type:D(F.MENU),label:V.optional(),defaults:Zc.optional()}).strict(),Wc=w({type:D(F.NAVIGATION_MENU),items:ae(Hc).optional()}).strict(),DE=w({type:D(F.NAVIGATION_MENU),defaults:Wc.optional()}).strict(),Si=w({type:D(K.BACKGROUND),style:kg.optional(),color:xc.optional()}).strict().superRefine((e,s)=>{const i=Te(s).at("color");e.style===gi.GRADIENT?e.color===void 0?i.addIssue("COLOR_REQUIRED_STYLE_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&i.addIssue("COLOR_ARRAY_LENGTH_STYLE_GRADIENT"):i.addIssue("COLOR_MUST_BE_ARRAY_STYLE_GRADIENT"):e.style===gi.COLOR&&(e.color===void 0?i.addIssue("COLOR_REQUIRED_STYLE_COLOR"):Array.isArray(e.color)&&i.addIssue("COLOR_MUST_BE_SINGLE_STYLE_COLOR"))}),kE=w({type:D(K.BACKGROUND),fieldName:O(),defaults:Si.optional()}).strict(),Kc=w({type:D(K.BACKGROUND),label:V,colors:ae(it).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Si.optional()}).strict(),bi=w({type:D(K.BUTTON),appearance:_g.optional(),size:Ng.optional(),shape:Lg.optional(),font:Hr.optional(),color:it.optional(),visible:te().optional()}).strict(),RE=w({type:D(K.BUTTON),fieldName:O(),defaults:bi.optional()}).strict(),qc=w({type:D(K.BUTTON),label:V,colors:ae(it).optional(),enableAutoColor:te().optional(),enableAlphaColor:te().optional(),hideVisibleToggle:te().optional(),hideSize:te().optional(),defaults:bi.optional()}).strict(),Ii=w({type:D(K.COLOR_PICKER),color:it.optional()}).strict(),ME=w({type:D(K.COLOR_PICKER),fieldName:O(),defaults:Ii.optional()}).strict(),Yc=w({type:D(K.COLOR_PICKER),label:V,description:V.optional(),colors:ae(it).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Ii.optional()}).strict(),xi=w({type:D(K.DIVIDER)}).strict(),$E=w({type:D(K.DIVIDER),fieldName:O(),defaults:xi.optional()}).strict(),Xc=w({type:D(K.DIVIDER),label:V,defaults:xi.optional()}).strict(),Ai=w({type:D(K.IMAGE),overlay:Cg.optional(),color:xc.optional(),visible:te().optional()}).strict().superRefine((e,s)=>{const i=Te(s).at("color");e.overlay===Ns.GRADIENT?e.color===void 0?i.addIssue("COLOR_REQUIRED_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&i.addIssue("COLOR_ARRAY_LENGTH_GRADIENT"):i.addIssue("COLOR_MUST_BE_ARRAY_GRADIENT"):e.overlay===Ns.COLOR?e.color===void 0?i.addIssue("COLOR_REQUIRED_COLOR"):Array.isArray(e.color)&&i.addIssue("COLOR_MUST_BE_SINGLE_COLOR"):(e.overlay===Ns.NONE||e.overlay===void 0)&&e.color!==void 0&&i.addIssue("COLOR_MUST_BE_UNDEFINED_NONE")}),FE=w({type:D(K.IMAGE),fieldName:O(),defaults:Ai.optional()}).strict(),Jc=w({type:D(K.IMAGE),label:V,static:te().optional(),colors:ae(Ot).optional(),enableAlphaColor:te().optional(),hideVisibleToggle:te().optional(),defaults:Ai.optional()}).strict(),BE=w({label:V,link:Ei}).strict(),UE=w({label:V.optional(),link:Ei.optional()}).strict(),Pi=w({type:D(K.INFO),description:V.optional(),button:UE.optional()}).strict(),jE=w({type:D(K.INFO),fieldName:O(),defaults:Pi.optional()}).strict(),Qc=w({type:D(K.INFO),label:V,description:V,button:BE.optional(),defaults:Pi.optional()}).strict(),zE=w({visible:te(),width:Nt(1,49).optional(),color:it.optional()}).strict(),wi=w({type:D(K.LOGO),font:Hr.optional(),size:Ac.optional(),bold:te().optional(),italic:te().optional(),color:it.optional(),visible:te().optional(),spacing:Nt(1,9).optional(),frame:zE.optional(),capitalization:ne(["none","all","small"]).optional()}).strict(),VE=w({type:D(K.LOGO),fieldName:O(),defaults:wi.optional()}).strict(),el=w({type:D(K.LOGO),label:V,colors:ae(it).optional(),sizes:ae(st().min(1,{message:"must be at least 1"})).optional(),defaults:wi.optional()}).strict(),GE=w({value:O().optional(),label:V.optional()}).strict(),Ci=w({type:D(K.SELECTBOX),value:O().optional()}).strict(),HE=w({type:D(K.SELECTBOX),fieldName:O(),defaults:Ci.optional()}).strict(),tl=w({type:D(K.SELECTBOX),label:V,description:V.optional(),options:ae(GE).optional(),defaults:Ci.optional()}).strict(),_i=w({type:D(K.TEXT),font:Hr.optional(),size:Ac.optional(),bold:te().optional(),italic:te().optional(),color:it.optional(),visible:te().optional()}).strict(),ZE=w({type:D(K.TEXT),fieldName:O(),defaults:_i.optional()}).strict(),sl=w({type:D(K.TEXT),label:V,colors:ae(Ot).optional(),sizes:ae(st().min(1,{message:"must be at least 1"})).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),hideVisibleToggle:te().optional(),hideSize:te().optional(),defaults:_i.optional()}).strict(),vi=w({type:D(K.TOGGLE),enabled:te().optional()}).strict(),WE=w({type:D(K.TOGGLE),fieldName:O(),defaults:vi.optional()}).strict(),il=w({type:D(K.TOGGLE),label:V,defaults:vi.optional()}).strict();function KE(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_SHOWCASE_ITEMS_REQUIRED")}function qE(e,s){for(const[i,a]of Object.entries(e))Object.keys(a.editors).length===0&&s.at(["items",i,"editors"]).addIssue("ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED",i)}function YE(e,s,i){Object.keys(e).length===0&&i.at("editors").addIssue("ACCORDION_ITEM_EDITORS_REQUIRED",s)}function XE(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_ITEMS_REQUIRED")}function JE(e,s){for(const[i,a]of Object.entries(e))a.positionFieldName||s.at(["items",i,"positionFieldName"]).addIssue("ACCORDION_ITEM_POSITION_FIELD_REQUIRED",i)}function QE(e,s){const i=Object.values(e).map(a=>a.positionFieldName).filter(Boolean);new Set(i).size!==i.length&&s.at("items").addIssue("ACCORDION_DUPLICATE_POSITION_FIELD_NAME")}const rl=w({type:D(K.ACCORDION)}).strict(),eT=Ve("type",[_i,bi,Ai,vi,Ci,Si,Ii,wi,xi,Pi]),tT=w({editors:Oe(O(),eT)}).strict(),sT=w({type:D(K.ACCORDION),items:Oe(O(),tT)}).strict().superRefine((e,s)=>{const i=Te(s);KE(e.items,i),qE(e.items,i)}),iT=w({type:D(K.ACCORDION),fieldName:O(),defaults:rl.optional()}).strict(),rT=Ve("type",[sl,qc,Jc,il,tl,Kc,Yc,el,Xc,Qc]),nT=w({label:V,positionFieldName:O().optional(),editors:Oe(O(),rT)}).strict().superRefine((e,s)=>{YE(e.editors,e.label,Te(s))}),aT=w({type:D(K.ACCORDION),sortable:te().optional(),items:Oe(O(),nT),defaults:rl.optional()}).strict().superRefine((e,s)=>{const i=Te(s);XE(e.items,i),e.sortable===!0&&(JE(e.items,i),QE(e.items,i))}),nl=Ve("type",[Jr,tn,Kr,Zr,sn,en,Zc,Wc,Gc,Yr,Xr,CE,Qr,qr]),al=Ve("type",[_i,bi,Ai,vi,Ci,Si,Ii,wi,xi,sT,Pi]),oT=w({showcaseId:O(),blockName:O(),previewImage:Ti,content:Oe(O(),nl),design:Oe(O(),al),layoutId:O().optional()}).strict(),cT=w({blockName:O(),content:Oe(O(),nl).optional(),design:Oe(O(),al).optional(),layoutId:O().optional()}).strict();function lT(e,s){Wr(e.type)&&(e.sections.length!==1?s.at("sections").addIssue("TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED",e.type):e.sections[0]?.type!=="store"&&s.at(["sections",0,"type"]).addIssue("TEMPLATE_PAGE_STORE_SECTION_REQUIRED",e.type))}function uT(e,s){Wr(e.type)&&e.sections.length===0&&s.at("sections").addIssue("TEMPLATE_PAGE_SECTIONS_REQUIRED"),e.sections.forEach((i,a)=>{Wr(e.type)||i.type==="store"&&s.at(["sections",a,"type"]).addIssue("TEMPLATE_PAGE_NO_STORE_SECTIONS",e.type),i.type==="default"&&i.id&&(i.id==="header"||i.id==="footer")&&s.at(["sections",a,"id"]).addIssue("REQUIRED_PAGE_SECTION_TYPE")})}function hT(e,s){e.type==="CUSTOM"?e.metadata||s.at("metadata").addIssue("TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED"):e.metadata!==void 0&&s.at("metadata").addIssue("TEMPLATE_PAGE_METADATA_NOT_ALLOWED",e.type)}const pT=new RegExp(`^(${Object.values(aE).join("|")})(_\\d{3})?$`),dT=O().regex(pT,"id must match pattern: [default_section_name] or [default_section_name]_XXX where XXX is three digits"),fT=O().regex(new RegExp("\\d{3}"),"showcase_id must be a three digit string"),ol=w({type:D("default"),id:dT,showcase_id:fT.optional()}).strict(),rn=w({type:D("custom"),id:O(),showcase_id:O().optional(),showcase_overrides:cT.optional(),category:cE.optional()}).strict(),mT=w({type:D("store"),id:O().optional()}).strict(),yT=Ve("type",[ol,rn,mT]),gT=w({title:O()}).strict(),ET=w({metadata:gT.optional(),sections:ae(yT)}).strict(),TT=ET.safeExtend({type:iE,id:O().min(1,{message:"id is required"})}).strict().superRefine((e,s)=>{const i=Te(s);uT(e,i),lT(e,i),hT(e,i)}),cl=w({name:O().min(2,{message:"name must be at least 2 characters"}).max(60,{message:"name must be at most 60 characters"}),description:O().min(2,{message:"description must be at least 2 characters"}).max(150,{message:"description must be at most 150 characters"}),preview_url:Xo({message:"preview_url must be a valid URL"}).regex(/^(https?):\/\/([^.]+?\.)?(company\.site|ecwid\.qa)($|\/[A-Za-z0-9\-._~:/?#\[\]@!$&'()*+,;=]*)?$/,"preview_url must match pattern: (https?)://([^.]+?\\.)?(company\\.site|ecwid\\.qa)(...)?").optional(),cover_image:Ti,categories:ae(Hg).refine(e=>new Set(e).size===e.length,{message:"categories must contain unique items"}).optional()}).strict(),ST=ol.extend({id:O()}),ll=Ve("type",[ST,rn]),bT=w({colorA:Ot,colorB:Ot,colorC:Ot,colorD:Ot,colorE:Ot,colorF:Ot}).strict(),IT=w({headingFont:mc,headingFontStyle:yc,bodyFont:mc,bodyFontStyle:yc}).strict(),xT=[12,14,16,18,20,24,32,36,40,48,56,64,80,96,112],AT=mE(xT),Lt=w({fontSize:AT}).strict(),PT=w({heading1:Lt,heading2:Lt,heading3:Lt,heading4:Lt,body1:Lt,body2:Lt,body3:Lt,body4:Lt}).strict(),wT=w({fontPair:IT,general:PT}).strict(),CT=w({contentWidth:st()}).strict(),_T=w({colorPalette:bT,fonts:wT,alignment:uE,pageLayout:CT,cornerRadius:pE}).strict(),vT=w({metadata:cl,header:ll,footer:ll,styleId:O().optional(),globalSettings:_T.optional()}).strict().superRefine((e,s)=>{const i=Te(s);e.styleId!==void 0&&e.globalSettings===void 0&&i.at("globalSettings").addIssue("TEMPLATE_CONFIGURATION_GLOBAL_SETTINGS_REQUIRED"),e.globalSettings!==void 0&&e.styleId===void 0&&i.at("styleId").addIssue("TEMPLATE_CONFIGURATION_STYLE_ID_REQUIRED")}),NT=w({id:O().min(1,{message:"id is required"}),assets:Gr.array().optional(),configuration:vT,pages:ae(TT)}).strict(),Ni=2097152,Oi=512e3;function mt(e,s=2){if(!+e)return"0 Bytes";const i=1024,a=s<0?0:s,c=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],u=Math.floor(Math.log(e)/Math.log(i));return`${parseFloat((e/i**u).toFixed(a))} ${c[u]}`}const OT={menu:{type:F.NAVIGATION_MENU},logo:{type:F.LOGO}},LT={logo:{type:"LOGO",label:"$label.logo.label",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{type:"LOGO",font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function ul(e){switch(e){case Bt.HEADER:return OT;default:return{}}}function hl(e){switch(e){case Bt.HEADER:return LT;default:return{}}}function pl({validationType:e,sectionType:s}){switch(e){case Os.CONTENT:return ul(s);case Os.DESIGN:return hl(s);default:return{}}}const DT=rn.extend({id:O().min(1,{message:"section id is required"})}),kT=w({metadata:cl,sections:ae(DT).min(1,{message:"sections must contain at least one section"}).max(20,{message:"sections must contain at most 20 sections"})}).strict().superRefine((e,s)=>{e.metadata.name.trim().length===0&&Te(s).at(["collection","metadata","name"]).addIssue("REQUIRED_COLLECTION_NAME")}),RT=w({id:O().min(1,{message:"id is required"}),descriptor:kT}).strict(),MT=Ve("type",[Mc,Bc,Lc,Pc,Uc,Fc,NE,LE,DE,OE,kc,Rc,$c,Dc]),nn=Oe(O(),MT),$T=Ve("type",[sl,qc,Jc,il,tl,Kc,Yc,el,Xc,aT,Qc]),an=Oe(O(),$T),FT=Ve("type",[ZE,RE,FE,WE,HE,kE,ME,VE,$E,jE,iT]),on=w({layoutId:O(),layoutIcon:nE.optional(),selectedContentSettings:ae(O()),selectedDesignSettings:ae(FT)}).strict(),BT=O().regex(dE,Be.VALID_LANGUAGE_CODE()),Li=Oe(BT,Oe(V,O()));function dl(e,s,i){if(!e||Object.keys(s).length===0)return;const a=Object.entries(s),c=a.map(([,{type:h}])=>h),u=Object.values(e).map(({type:h})=>h);Object.entries(e).forEach(([h,f])=>{const y=s[h];y&&"type"in y&&f.type!==y.type&&i.at(h).addIssue("MANDATORY_SETTING_TYPE_MISMATCH",f.type,h,y.type)}),Object.entries(e).forEach(([h,f])=>{const y=a.find(([,{type:T}])=>T===f.type)?.[0];y&&h!==y&&i.at(h).addIssue("MANDATORY_SETTING_NAME_MISMATCH",h,f.type,y)}),new Set(u.filter(h=>c.includes(h))).forEach(h=>{if(u.filter(f=>f===h).length>1){const f=a.findLast(([,{type:y}])=>y===h)?.[0];i.at(f).addIssue("DUPLICATED_MANDATORY_SETTING",h)}})}function fl(e,s,i){wc(e,s,i)}function ml(e,s,i){if(e.type!==F.DECK||s.type!==F.DECK)return;const a=s.cards?.defaultCardContent?.settings,c=e.cards;!a||!Array.isArray(c)||c.forEach((u,h)=>{u.settings&&Object.entries(u.settings).forEach(([f,y])=>{const T=a[f],I=i.at(["cards",h,"settings",f]);if(!T){I.addIssue("INVALID_DECK_CARD_SETTING",f);return}if(y.type!==T.type){I.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",f,y.type,T.type);return}y.type===F.DECK&&T.type===F.DECK&&ml(y,T,I)})})}function UT(e,s,i){e.content&&Object.entries(e.content).forEach(([a,c])=>{const u=i.at(["content",a]),h=s[a];if(!h){u.addIssue("INVALID_SHOWCASE_CONTENT_ELEMENT",a);return}if(c.type!==h.type){u.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",a,c.type,h.type);return}if(c.type===F.SELECTBOX&&h.type===F.SELECTBOX){const f=h,y=c;f.options&&y.value!==void 0&&(new Set(f.options.map(T=>T.value)).has(y.value)||u.addIssue("INVALID_SELECTBOX_OPTION",y.value,a))}c.type===F.DECK&&ml(c,h,u)})}function jT(e,s,i){e.design&&Object.entries(e.design).forEach(([a,c])=>{const u=i.at(["design",a]),h=s[a];if(!h){u.addIssue("INVALID_SHOWCASE_DESIGN_ELEMENT",a);return}c.type!==h.type&&u.addIssue("SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH",a,c.type,h.type)})}function zT(e,s){Object.entries(e).flatMap(([i,a])=>{switch(a.type){case K.ACCORDION:return Object.entries(a.items).flatMap(([c,u])=>Object.keys(u.editors).map(h=>({name:h,path:[i,"items",c,"editors",h]})));default:return[{name:i,path:[i]}]}}).filter(({name:i},a,c)=>c.findIndex(u=>u.name===i)<a).forEach(({path:i})=>s.at(i).addIssue("DUPLICATE_DESIGN_EDITOR_NAME"))}function VT(e,s,i){e.layoutId&&((s||[]).some(a=>a.layoutId===e.layoutId)||i.at("layoutId").addIssue("SHOWCASE_LAYOUT",e.layoutId))}function GT(e,s){const i=new Set;e.forEach((a,c)=>{if(i.has(a.showcaseId)){s.at([c,"showcaseId"]).addIssue("DUPLICATE_SHOWCASE_ID",a.showcaseId);return}i.add(a.showcaseId)})}function yl(e,s,i){for(const[a,c]of Object.entries(e)){const u=c;if(u.type===F.IMAGE){const h=s[a];if(h?.type===K.IMAGE){const f=u.static??!1,y=h.static??!1;f!==y&&i.at(a).addIssue("IMAGE_EDITOR_STATIC_MISMATCH",a)}}else if(u.type===F.DECK){const h=u;h.cards?.defaultCardContent?.settings&&yl(h.cards.defaultCardContent.settings,s,i.at([a,"cards","defaultCardContent","settings"]))}}}function HT(e,s,i){s>Ni&&i.at(Se.basename(e)).addIssue("REQUIRED_SECTION_ASSET",mt(s),mt(Ni))}function ZT(e,s){e>Oi&&s.addIssue("REQUIRED_SERVER_SIZE",mt(e),mt(Oi))}const WT=w({id:O(),type:Rg,name:O(),content:nn,design:an,layout:ae(on).optional(),showcase:ae(oT),translationsSettings:Li.optional(),translationsShowcases:Li.optional(),assets:Gr.array().optional(),server:Ic,previewCount:st().optional()}).strict().superRefine((e,s)=>{const i=Te(s),a=pl({validationType:Os.CONTENT,sectionType:e.type}),c=pl({validationType:Os.DESIGN,sectionType:e.type});dl(e.content,a,i.at("content")),dl(e.design,c,i.at("design")),yl(e.content,e.design,i.at("content")),zT(e.design,i.at("design")),e.assets&&e.assets.forEach(h=>{HT(h.path,h.size,i.at("assets"))}),ZT(e.server.size,i.at("server"));const u=e.assets?.map(h=>h.path)??[];fl(e.content,u,i.at("content")),GT(e.showcase,i.at("showcase")),e.showcase.forEach((h,f)=>{const y=i.at(["showcase",f]);fl(h,u,y),UT(h,e.content,y),jT(h,e.design,y),VT(h,e.layout,y)})}),KT=w({translations:Li.optional()}).strict();function qT(e){return typeof e=="object"&&e!==null&&e.type==="ACCORDION"}function YT(e){const s=[];for(const[i,a]of Object.entries(e))if(s.push(i),qT(a)){const c=a.items;if(c!==void 0)for(const u of Object.values(c)){const h=u.editors;h!==void 0&&s.push(...Object.keys(h))}}return s}var cs={},gl;function XT(){if(gl)return cs;gl=1,Object.defineProperty(cs,"__esModule",{value:!0});function e(p,r){if(p==null)return{};var t={};for(var n in p)if({}.hasOwnProperty.call(p,n)){if(r.indexOf(n)!==-1)continue;t[n]=p[n]}return t}class s{constructor(r,t,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=r,this.column=t,this.index=n}}class i{constructor(r,t){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=r,this.end=t}}function a(p,r){const{line:t,column:n,index:o}=p;return new s(t,n+r,o+r)}const c="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";var u={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:c},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:c}};const h={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},f=p=>p.type==="UpdateExpression"?h.UpdateExpression[`${p.prefix}`]:h[p.type];var y={AccessorIsGenerator:({kind:p})=>`A ${p}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:p})=>`Missing initializer in ${p} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:p})=>`\`${p}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:p,exportName:r})=>`A string literal cannot be used as an exported binding without \`from\`.
|
|
40
40
|
- Did you mean \`export { '${p}' as '${r}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:p})=>`'${p==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:p})=>`Unsyntactic ${p==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:p})=>`A string literal cannot be used as an imported binding.
|
|
41
|
-
- Did you mean \`import { "${p}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:p})=>`Expected number in radix ${p}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:p})=>`Escape sequence in keyword ${p}.`,InvalidIdentifier:({identifierName:p})=>`Invalid identifier ${p}.`,InvalidLhs:({ancestor:p})=>`Invalid left-hand side in ${f(p)}.`,InvalidLhsBinding:({ancestor:p})=>`Binding invalid left-hand side in ${f(p)}.`,InvalidLhsOptionalChaining:({ancestor:p})=>`Invalid optional chaining in the left-hand side of ${f(p)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:p})=>`Unexpected character '${p}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:p})=>`Private name #${p} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:p})=>`Label '${p}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:p})=>`This experimental syntax requires enabling the parser plugin: ${p.map(r=>JSON.stringify(r)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:p})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${p.map(r=>JSON.stringify(r)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:p})=>`Duplicate key "${p}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:p})=>`An export name cannot include a lone surrogate, found '\\u${p.toString(16)}'.`,ModuleExportUndefined:({localName:p})=>`Export '${p}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:p})=>`Private names are only allowed in property accesses (\`obj.#${p}\`) or in \`in\` expressions (\`#${p} in obj\`).`,PrivateNameRedeclaration:({identifierName:p})=>`Duplicate private name #${p}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:p})=>`Unexpected keyword '${p}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:p})=>`Unexpected reserved word '${p}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:p,unexpected:r})=>`Unexpected token${r?` '${r}'.`:""}${p?`, expected "${p}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:p,onlyValidPropertyName:r})=>`The only valid meta property for ${p} is ${p}.${r}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:p})=>`Identifier '${p}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},T={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:p})=>`Assigning to '${p}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:p})=>`Binding '${p}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},x={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:p})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(p)}\`.`};const P=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var L=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:p})=>`Invalid topic token ${p}. In order to use ${p} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${p}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:p})=>`Hack-style pipe body cannot be an unparenthesized ${f({type:p})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'});const R=["message"];function ae(p,r,t){Object.defineProperty(p,r,{enumerable:!1,configurable:!0,value:t})}function ce({toMessage:p,code:r,reasonCode:t,syntaxPlugin:n}){const o=t==="MissingPlugin"||t==="MissingOneOfPlugins",l={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return l[t]&&(t=l[t]),function d(m,g){const E=new SyntaxError;return E.code=r,E.reasonCode=t,E.loc=m,E.pos=m.index,E.syntaxPlugin=n,o&&(E.missingPlugin=g.missingPlugin),ae(E,"clone",function(I={}){var C;const{line:N,column:M,index:Q}=(C=I.loc)!=null?C:m;return d(new s(N,M,Q),Object.assign({},g,I.details))}),ae(E,"details",g),Object.defineProperty(E,"message",{configurable:!0,get(){const b=`${p(g)} (${m.line}:${m.column})`;return this.message=b,b},set(b){Object.defineProperty(this,"message",{value:b,writable:!0})}}),E}}function Ce(p,r){if(Array.isArray(p))return n=>Ce(n,p[0]);const t={};for(const n of Object.keys(p)){const o=p[n],l=typeof o=="string"?{message:()=>o}:typeof o=="function"?{message:o}:o,{message:d}=l,m=e(l,R),g=typeof d=="string"?()=>d:d;t[n]=ce(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:n,toMessage:g},r?{syntaxPlugin:r}:{},m))}return t}const S=Object.assign({},Ce(u),Ce(y),Ce(T),Ce(x),Ce`pipelineOperator`(L));function gs(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function $e(p){const r=gs();if(p==null)return r;if(p.annexB!=null&&p.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(const t of Object.keys(r))p[t]!=null&&(r[t]=p[t]);if(r.startLine===1)p.startIndex==null&&r.startColumn>0?r.startIndex=r.startColumn:p.startColumn==null&&r.startIndex>0&&(r.startColumn=r.startIndex);else if((p.startColumn==null||p.startIndex==null)&&p.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(r.sourceType==="commonjs"){if(p.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(p.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(p.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return r}const{defineProperty:Ae}=Object,_e=(p,r)=>{p&&Ae(p,r,{enumerable:!1,value:p[r]})};function bt(p){return _e(p.loc.start,"index"),_e(p.loc.end,"index"),p}var Wt=p=>class extends p{parse(){const t=bt(super.parse());return this.optionFlags&256&&(t.tokens=t.tokens.map(bt)),t}parseRegExpLiteral({pattern:t,flags:n}){let o=null;try{o=new RegExp(t,n)}catch{}const l=this.estreeParseLiteral(o);return l.regex={pattern:t,flags:n},l}parseBigIntLiteral(t){let n;try{n=BigInt(t)}catch{n=null}const o=this.estreeParseLiteral(n);return o.bigint=String(o.value||t),o}parseDecimalLiteral(t){const o=this.estreeParseLiteral(null);return o.decimal=String(o.value||t),o}estreeParseLiteral(t){return this.parseLiteral(t,"Literal")}parseStringLiteral(t){return this.estreeParseLiteral(t)}parseNumericLiteral(t){return this.estreeParseLiteral(t)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(t){return this.estreeParseLiteral(t)}estreeParseChainExpression(t,n){const o=this.startNodeAtNode(t);return o.expression=t,this.finishNodeAt(o,"ChainExpression",n)}directiveToStmt(t){const n=t.value;delete t.value,this.castNodeTo(n,"Literal"),n.raw=n.extra.raw,n.value=n.extra.expressionValue;const o=this.castNodeTo(t,"ExpressionStatement");return o.expression=n,o.directive=n.extra.rawValue,delete n.extra,o}fillOptionalPropertiesForTSESLint(t){}cloneEstreeStringLiteral(t){const{start:n,end:o,loc:l,range:d,raw:m,value:g}=t,E=Object.create(t.constructor.prototype);return E.type="Literal",E.start=n,E.end=o,E.loc=l,E.range=d,E.raw=m,E.value=g,E}initFunction(t,n){super.initFunction(t,n),t.expression=!1}checkDeclaration(t){t!=null&&this.isObjectProperty(t)?this.checkDeclaration(t.value):super.checkDeclaration(t)}getObjectOrClassMethodParams(t){return t.value.params}isValidDirective(t){var n;return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&!((n=t.expression.extra)!=null&&n.parenthesized)}parseBlockBody(t,n,o,l,d){super.parseBlockBody(t,n,o,l,d);const m=t.directives.map(g=>this.directiveToStmt(g));t.body=m.concat(t.body),delete t.directives}parsePrivateName(){const t=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(t):t}convertPrivateNameToPrivateIdentifier(t){const n=super.getPrivateNameSV(t);return delete t.id,t.name=n,this.castNodeTo(t,"PrivateIdentifier")}isPrivateName(t){return this.getPluginOption("estree","classFeatures")?t.type==="PrivateIdentifier":super.isPrivateName(t)}getPrivateNameSV(t){return this.getPluginOption("estree","classFeatures")?t.name:super.getPrivateNameSV(t)}parseLiteral(t,n){const o=super.parseLiteral(t,n);return o.raw=o.extra.raw,delete o.extra,o}parseFunctionBody(t,n,o=!1){super.parseFunctionBody(t,n,o),t.expression=t.body.type!=="BlockStatement"}parseMethod(t,n,o,l,d,m,g=!1){let E=this.startNode();E.kind=t.kind,E=super.parseMethod(E,n,o,l,d,m,g),delete E.kind;const{typeParameters:b}=t;b&&(delete t.typeParameters,E.typeParameters=b,this.resetStartLocationFromNode(E,b));const I=this.castNodeTo(E,"FunctionExpression");return t.value=I,m==="ClassPrivateMethod"&&(t.computed=!1),m==="ObjectMethod"?(t.kind==="method"&&(t.kind="init"),t.shorthand=!1,this.finishNode(t,"Property")):this.finishNode(t,"MethodDefinition")}nameIsConstructor(t){return t.type==="Literal"?t.value==="constructor":super.nameIsConstructor(t)}parseClassProperty(...t){const n=super.parseClassProperty(...t);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(n,"PropertyDefinition"),n}parseClassPrivateProperty(...t){const n=super.parseClassPrivateProperty(...t);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(n,"PropertyDefinition"),n.computed=!1),n}parseClassAccessorProperty(t){const n=super.parseClassAccessorProperty(t);return this.getPluginOption("estree","classFeatures")&&(n.abstract&&this.hasPlugin("typescript")?(delete n.abstract,this.castNodeTo(n,"TSAbstractAccessorProperty")):this.castNodeTo(n,"AccessorProperty")),n}parseObjectProperty(t,n,o,l){const d=super.parseObjectProperty(t,n,o,l);return d&&(d.kind="init",this.castNodeTo(d,"Property")),d}finishObjectProperty(t){return t.kind="init",this.finishNode(t,"Property")}isValidLVal(t,n,o,l){return t==="Property"?"value":super.isValidLVal(t,n,o,l)}isAssignable(t,n){return t!=null&&this.isObjectProperty(t)?this.isAssignable(t.value,n):super.isAssignable(t,n)}toAssignable(t,n=!1){if(t!=null&&this.isObjectProperty(t)){const{key:o,value:l}=t;this.isPrivateName(o)&&this.classScope.usePrivateName(this.getPrivateNameSV(o),o.loc.start),this.toAssignable(l,n)}else super.toAssignable(t,n)}toAssignableObjectExpressionProp(t,n,o){t.type==="Property"&&(t.kind==="get"||t.kind==="set")?this.raise(S.PatternHasAccessor,t.key):t.type==="Property"&&t.method?this.raise(S.PatternHasMethod,t.key):super.toAssignableObjectExpressionProp(t,n,o)}finishCallExpression(t,n){const o=super.finishCallExpression(t,n);if(o.callee.type==="Import"){var l,d;this.castNodeTo(o,"ImportExpression"),o.source=o.arguments[0],o.options=(l=o.arguments[1])!=null?l:null,o.attributes=(d=o.arguments[1])!=null?d:null,delete o.arguments,delete o.callee}else o.type==="OptionalCallExpression"?this.castNodeTo(o,"CallExpression"):o.optional=!1;return o}toReferencedArguments(t){t.type!=="ImportExpression"&&super.toReferencedArguments(t)}parseExport(t,n){const o=this.state.lastTokStartLoc,l=super.parseExport(t,n);switch(l.type){case"ExportAllDeclaration":l.exported=null;break;case"ExportNamedDeclaration":l.specifiers.length===1&&l.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(l,"ExportAllDeclaration"),l.exported=l.specifiers[0].exported,delete l.specifiers);case"ExportDefaultDeclaration":{var d;const{declaration:m}=l;m?.type==="ClassDeclaration"&&((d=m.decorators)==null?void 0:d.length)>0&&m.start===l.start&&this.resetStartLocation(l,o)}break}return l}stopParseSubscript(t,n){const o=super.stopParseSubscript(t,n);return n.optionalChainMember?this.estreeParseChainExpression(o,t.loc.end):o}parseMember(t,n,o,l,d){const m=super.parseMember(t,n,o,l,d);return m.type==="OptionalMemberExpression"?this.castNodeTo(m,"MemberExpression"):m.optional=!1,m}isOptionalMemberExpression(t){return t.type==="ChainExpression"?t.expression.type==="MemberExpression":super.isOptionalMemberExpression(t)}hasPropertyAsPrivateName(t){return t.type==="ChainExpression"&&(t=t.expression),super.hasPropertyAsPrivateName(t)}isObjectProperty(t){return t.type==="Property"&&t.kind==="init"&&!t.method}isObjectMethod(t){return t.type==="Property"&&(t.method||t.kind==="get"||t.kind==="set")}castNodeTo(t,n){const o=super.castNodeTo(t,n);return this.fillOptionalPropertiesForTSESLint(o),o}cloneIdentifier(t){const n=super.cloneIdentifier(t);return this.fillOptionalPropertiesForTSESLint(n),n}cloneStringLiteral(t){return t.type==="Literal"?this.cloneEstreeStringLiteral(t):super.cloneStringLiteral(t)}finishNodeAt(t,n,o){return bt(super.finishNodeAt(t,n,o))}finishNode(t,n){const o=super.finishNode(t,n);return this.fillOptionalPropertiesForTSESLint(o),o}resetStartLocation(t,n){super.resetStartLocation(t,n),bt(t)}resetEndLocation(t,n=this.state.lastTokEndLoc){super.resetEndLocation(t,n),bt(t)}};class X{constructor(r,t){this.token=void 0,this.preserveSpace=void 0,this.token=r,this.preserveSpace=!!t}}const $={brace:new X("{"),j_oTag:new X("<tag"),j_cTag:new X("</tag"),j_expr:new X("<tag>...</tag>",!0)};$.template=new X("`",!0);const z=!0,v=!0,Kt=!0,Es=!0,xt=!0,Zu=!0;class Bn{constructor(r,t={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=r,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop!=null?t.binop:null,this.updateContext=null}}const tr=new Map;function Y(p,r={}){r.keyword=p;const t=B(p,r);return tr.set(p,t),t}function ke(p,r){return B(p,{beforeExpr:z,binop:r})}let Ts=-1;const lt=[],sr=[],ir=[],rr=[],nr=[],ar=[];function B(p,r={}){var t,n,o,l;return++Ts,sr.push(p),ir.push((t=r.binop)!=null?t:-1),rr.push((n=r.beforeExpr)!=null?n:!1),nr.push((o=r.startsExpr)!=null?o:!1),ar.push((l=r.prefix)!=null?l:!1),lt.push(new Bn(p,r)),Ts}function Z(p,r={}){var t,n,o,l;return++Ts,tr.set(p,Ts),sr.push(p),ir.push((t=r.binop)!=null?t:-1),rr.push((n=r.beforeExpr)!=null?n:!1),nr.push((o=r.startsExpr)!=null?o:!1),ar.push((l=r.prefix)!=null?l:!1),lt.push(new Bn("name",r)),Ts}const Wu={bracketL:B("[",{beforeExpr:z,startsExpr:v}),bracketHashL:B("#[",{beforeExpr:z,startsExpr:v}),bracketBarL:B("[|",{beforeExpr:z,startsExpr:v}),bracketR:B("]"),bracketBarR:B("|]"),braceL:B("{",{beforeExpr:z,startsExpr:v}),braceBarL:B("{|",{beforeExpr:z,startsExpr:v}),braceHashL:B("#{",{beforeExpr:z,startsExpr:v}),braceR:B("}"),braceBarR:B("|}"),parenL:B("(",{beforeExpr:z,startsExpr:v}),parenR:B(")"),comma:B(",",{beforeExpr:z}),semi:B(";",{beforeExpr:z}),colon:B(":",{beforeExpr:z}),doubleColon:B("::",{beforeExpr:z}),dot:B("."),question:B("?",{beforeExpr:z}),questionDot:B("?."),arrow:B("=>",{beforeExpr:z}),template:B("template"),ellipsis:B("...",{beforeExpr:z}),backQuote:B("`",{startsExpr:v}),dollarBraceL:B("${",{beforeExpr:z,startsExpr:v}),templateTail:B("...`",{startsExpr:v}),templateNonTail:B("...${",{beforeExpr:z,startsExpr:v}),at:B("@"),hash:B("#",{startsExpr:v}),interpreterDirective:B("#!..."),eq:B("=",{beforeExpr:z,isAssign:Es}),assign:B("_=",{beforeExpr:z,isAssign:Es}),slashAssign:B("_=",{beforeExpr:z,isAssign:Es}),xorAssign:B("_=",{beforeExpr:z,isAssign:Es}),moduloAssign:B("_=",{beforeExpr:z,isAssign:Es}),incDec:B("++/--",{prefix:xt,postfix:Zu,startsExpr:v}),bang:B("!",{beforeExpr:z,prefix:xt,startsExpr:v}),tilde:B("~",{beforeExpr:z,prefix:xt,startsExpr:v}),doubleCaret:B("^^",{startsExpr:v}),doubleAt:B("@@",{startsExpr:v}),pipeline:ke("|>",0),nullishCoalescing:ke("??",1),logicalOR:ke("||",1),logicalAND:ke("&&",2),bitwiseOR:ke("|",3),bitwiseXOR:ke("^",4),bitwiseAND:ke("&",5),equality:ke("==/!=/===/!==",6),lt:ke("</>/<=/>=",7),gt:ke("</>/<=/>=",7),relational:ke("</>/<=/>=",7),bitShift:ke("<</>>/>>>",8),bitShiftL:ke("<</>>/>>>",8),bitShiftR:ke("<</>>/>>>",8),plusMin:B("+/-",{beforeExpr:z,binop:9,prefix:xt,startsExpr:v}),modulo:B("%",{binop:10,startsExpr:v}),star:B("*",{binop:10}),slash:ke("/",10),exponent:B("**",{beforeExpr:z,binop:11,rightAssociative:!0}),_in:Y("in",{beforeExpr:z,binop:7}),_instanceof:Y("instanceof",{beforeExpr:z,binop:7}),_break:Y("break"),_case:Y("case",{beforeExpr:z}),_catch:Y("catch"),_continue:Y("continue"),_debugger:Y("debugger"),_default:Y("default",{beforeExpr:z}),_else:Y("else",{beforeExpr:z}),_finally:Y("finally"),_function:Y("function",{startsExpr:v}),_if:Y("if"),_return:Y("return",{beforeExpr:z}),_switch:Y("switch"),_throw:Y("throw",{beforeExpr:z,prefix:xt,startsExpr:v}),_try:Y("try"),_var:Y("var"),_const:Y("const"),_with:Y("with"),_new:Y("new",{beforeExpr:z,startsExpr:v}),_this:Y("this",{startsExpr:v}),_super:Y("super",{startsExpr:v}),_class:Y("class",{startsExpr:v}),_extends:Y("extends",{beforeExpr:z}),_export:Y("export"),_import:Y("import",{startsExpr:v}),_null:Y("null",{startsExpr:v}),_true:Y("true",{startsExpr:v}),_false:Y("false",{startsExpr:v}),_typeof:Y("typeof",{beforeExpr:z,prefix:xt,startsExpr:v}),_void:Y("void",{beforeExpr:z,prefix:xt,startsExpr:v}),_delete:Y("delete",{beforeExpr:z,prefix:xt,startsExpr:v}),_do:Y("do",{isLoop:Kt,beforeExpr:z}),_for:Y("for",{isLoop:Kt}),_while:Y("while",{isLoop:Kt}),_as:Z("as",{startsExpr:v}),_assert:Z("assert",{startsExpr:v}),_async:Z("async",{startsExpr:v}),_await:Z("await",{startsExpr:v}),_defer:Z("defer",{startsExpr:v}),_from:Z("from",{startsExpr:v}),_get:Z("get",{startsExpr:v}),_let:Z("let",{startsExpr:v}),_meta:Z("meta",{startsExpr:v}),_of:Z("of",{startsExpr:v}),_sent:Z("sent",{startsExpr:v}),_set:Z("set",{startsExpr:v}),_source:Z("source",{startsExpr:v}),_static:Z("static",{startsExpr:v}),_using:Z("using",{startsExpr:v}),_yield:Z("yield",{startsExpr:v}),_asserts:Z("asserts",{startsExpr:v}),_checks:Z("checks",{startsExpr:v}),_exports:Z("exports",{startsExpr:v}),_global:Z("global",{startsExpr:v}),_implements:Z("implements",{startsExpr:v}),_intrinsic:Z("intrinsic",{startsExpr:v}),_infer:Z("infer",{startsExpr:v}),_is:Z("is",{startsExpr:v}),_mixins:Z("mixins",{startsExpr:v}),_proto:Z("proto",{startsExpr:v}),_require:Z("require",{startsExpr:v}),_satisfies:Z("satisfies",{startsExpr:v}),_keyof:Z("keyof",{startsExpr:v}),_readonly:Z("readonly",{startsExpr:v}),_unique:Z("unique",{startsExpr:v}),_abstract:Z("abstract",{startsExpr:v}),_declare:Z("declare",{startsExpr:v}),_enum:Z("enum",{startsExpr:v}),_module:Z("module",{startsExpr:v}),_namespace:Z("namespace",{startsExpr:v}),_interface:Z("interface",{startsExpr:v}),_type:Z("type",{startsExpr:v}),_opaque:Z("opaque",{startsExpr:v}),name:B("name",{startsExpr:v}),placeholder:B("%%",{startsExpr:v}),string:B("string",{startsExpr:v}),num:B("num",{startsExpr:v}),bigint:B("bigint",{startsExpr:v}),decimal:B("decimal",{startsExpr:v}),regexp:B("regexp",{startsExpr:v}),privateName:B("#name",{startsExpr:v}),eof:B("eof"),jsxName:B("jsxName"),jsxText:B("jsxText",{beforeExpr:z}),jsxTagStart:B("jsxTagStart",{startsExpr:v}),jsxTagEnd:B("jsxTagEnd")};function ie(p){return p>=93&&p<=133}function Ku(p){return p<=92}function Xe(p){return p>=58&&p<=133}function Un(p){return p>=58&&p<=137}function qu(p){return rr[p]}function Ss(p){return nr[p]}function Yu(p){return p>=29&&p<=33}function jn(p){return p>=129&&p<=131}function Ju(p){return p>=90&&p<=92}function or(p){return p>=58&&p<=92}function Xu(p){return p>=39&&p<=59}function Qu(p){return p===34}function eh(p){return ar[p]}function th(p){return p>=121&&p<=123}function sh(p){return p>=124&&p<=130}function It(p){return sr[p]}function Vs(p){return ir[p]}function ih(p){return p===57}function Gs(p){return p>=24&&p<=25}function ut(p){return lt[p]}lt[8].updateContext=p=>{p.pop()},lt[5].updateContext=lt[7].updateContext=lt[23].updateContext=p=>{p.push($.brace)},lt[22].updateContext=p=>{p[p.length-1]===$.template?p.pop():p.push($.template)},lt[143].updateContext=p=>{p.push($.j_expr,$.j_oTag)};let cr="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",zn="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";const rh=new RegExp("["+cr+"]"),nh=new RegExp("["+cr+zn+"]");cr=zn=null;const Vn=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],ah=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function lr(p,r){let t=65536;for(let n=0,o=r.length;n<o;n+=2){if(t+=r[n],t>p)return!1;if(t+=r[n+1],t>=p)return!0}return!1}function nt(p){return p<65?p===36:p<=90?!0:p<97?p===95:p<=122?!0:p<=65535?p>=170&&rh.test(String.fromCharCode(p)):lr(p,Vn)}function kt(p){return p<48?p===36:p<58?!0:p<65?!1:p<=90?!0:p<97?p===95:p<=122?!0:p<=65535?p>=170&&nh.test(String.fromCharCode(p)):lr(p,Vn)||lr(p,ah)}const ur={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},oh=new Set(ur.keyword),ch=new Set(ur.strict),lh=new Set(ur.strictBind);function Gn(p,r){return r&&p==="await"||p==="enum"}function Hn(p,r){return Gn(p,r)||ch.has(p)}function Zn(p){return lh.has(p)}function Wn(p,r){return Hn(p,r)||Zn(p)}function uh(p){return oh.has(p)}function hh(p,r,t){return p===64&&r===64&&nt(t)}const ph=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function dh(p){return ph.has(p)}class hr{constructor(r){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=r}}class pr{constructor(r,t){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=r,this.inModule=t}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){const r=this.currentThisScopeFlags();return(r&64)>0&&(r&2)===0}get inStaticBlock(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&128)return!0;if(t&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(r){return new hr(r)}enter(r){this.scopeStack.push(this.createScope(r))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(r){return!!(r.flags&130||!this.parser.inModule&&r.flags&1)}declareName(r,t,n){let o=this.currentScope();if(t&8||t&16){this.checkRedeclarationInScope(o,r,t,n);let l=o.names.get(r)||0;t&16?l=l|4:(o.firstLexicalName||(o.firstLexicalName=r),l=l|2),o.names.set(r,l),t&8&&this.maybeExportDefined(o,r)}else if(t&4)for(let l=this.scopeStack.length-1;l>=0&&(o=this.scopeStack[l],this.checkRedeclarationInScope(o,r,t,n),o.names.set(r,(o.names.get(r)||0)|1),this.maybeExportDefined(o,r),!(o.flags&1667));--l);this.parser.inModule&&o.flags&1&&this.undefinedExports.delete(r)}maybeExportDefined(r,t){this.parser.inModule&&r.flags&1&&this.undefinedExports.delete(t)}checkRedeclarationInScope(r,t,n,o){this.isRedeclaredInScope(r,t,n)&&this.parser.raise(S.VarRedeclaration,o,{identifierName:t})}isRedeclaredInScope(r,t,n){if(!(n&1))return!1;if(n&8)return r.names.has(t);const o=r.names.get(t)||0;return n&16?(o&2)>0||!this.treatFunctionsAsVarInScope(r)&&(o&1)>0:(o&2)>0&&!(r.flags&8&&r.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(r)&&(o&4)>0}checkLocalExport(r){const{name:t}=r;this.scopeStack[0].names.has(t)||this.undefinedExports.set(t,r.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&1667)return t}}currentThisScopeFlags(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&1731&&!(t&4))return t}}}class fh extends hr{constructor(...r){super(...r),this.declareFunctions=new Set}}class mh extends pr{createScope(r){return new fh(r)}declareName(r,t,n){const o=this.currentScope();if(t&2048){this.checkRedeclarationInScope(o,r,t,n),this.maybeExportDefined(o,r),o.declareFunctions.add(r);return}super.declareName(r,t,n)}isRedeclaredInScope(r,t,n){if(super.isRedeclaredInScope(r,t,n))return!0;if(n&2048&&!r.declareFunctions.has(t)){const o=r.names.get(t);return(o&4)>0||(o&2)>0}return!1}checkLocalExport(r){this.scopeStack[0].declareFunctions.has(r.name)||super.checkLocalExport(r)}}const yh=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),j=Ce`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:p})=>`Cannot overwrite reserved type ${p}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:p,enumName:r})=>`Boolean enum members need to be initialized. Use either \`${p} = true,\` or \`${p} = false,\` in enum \`${r}\`.`,EnumDuplicateMemberName:({memberName:p,enumName:r})=>`Enum member names need to be unique, but the name \`${p}\` has already been used before in enum \`${r}\`.`,EnumInconsistentMemberValues:({enumName:p})=>`Enum \`${p}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:p,enumName:r})=>`Enum type \`${p}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${r}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:p})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${p}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:p,memberName:r,explicitType:t})=>`Enum \`${p}\` has type \`${t}\`, so the initializer of \`${r}\` needs to be a ${t} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:p,memberName:r})=>`Symbol enum members cannot be initialized. Use \`${r},\` in enum \`${p}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:p,memberName:r})=>`The enum member initializer for \`${r}\` needs to be a literal (either a boolean, number, or string) in enum \`${p}\`.`,EnumInvalidMemberName:({enumName:p,memberName:r,suggestion:t})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${r}\`, consider using \`${t}\`, in enum \`${p}\`.`,EnumNumberMemberNotInitialized:({enumName:p,memberName:r})=>`Number enum members need to be initialized, e.g. \`${r} = 1\` in enum \`${p}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:p})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${p}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:p})=>`Unexpected reserved type ${p}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:p,suggestion:r})=>`\`declare export ${p}\` is not supported. Use \`${r}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function gh(p){return p.type==="DeclareExportAllDeclaration"||p.type==="DeclareExportDeclaration"&&(!p.declaration||p.declaration.type!=="TypeAlias"&&p.declaration.type!=="InterfaceDeclaration")}function Kn(p){return p.importKind==="type"||p.importKind==="typeof"}const Eh={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function Th(p,r){const t=[],n=[];for(let o=0;o<p.length;o++)(r(p[o],o,p)?t:n).push(p[o]);return[t,n]}const Sh=/\*?\s*@((?:no)?flow)\b/;var bh=p=>class extends p{constructor(...t){super(...t),this.flowPragma=void 0}getScopeHandler(){return mh}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(t,n){t!==134&&t!==13&&t!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(t,n)}addComment(t){if(this.flowPragma===void 0){const n=Sh.exec(t.value);if(n)if(n[1]==="flow")this.flowPragma="flow";else if(n[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(t)}flowParseTypeInitialiser(t){const n=this.state.inType;this.state.inType=!0,this.expect(t||14);const o=this.flowParseType();return this.state.inType=n,o}flowParsePredicate(){const t=this.startNode(),n=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>n.index+1&&this.raise(j.UnexpectedSpaceBetweenModuloChecks,n),this.eat(10)?(t.value=super.parseExpression(),this.expect(11),this.finishNode(t,"DeclaredPredicate")):this.finishNode(t,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){const t=this.state.inType;this.state.inType=!0,this.expect(14);let n=null,o=null;return this.match(54)?(this.state.inType=t,o=this.flowParsePredicate()):(n=this.flowParseType(),this.state.inType=t,this.match(54)&&(o=this.flowParsePredicate())),[n,o]}flowParseDeclareClass(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")}flowParseDeclareFunction(t){this.next();const n=t.id=this.parseIdentifier(),o=this.startNode(),l=this.startNode();this.match(47)?o.typeParameters=this.flowParseTypeParameterDeclaration():o.typeParameters=null,this.expect(10);const d=this.flowParseFunctionTypeParams();return o.params=d.params,o.rest=d.rest,o.this=d._this,this.expect(11),[o.returnType,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),l.typeAnnotation=this.finishNode(o,"FunctionTypeAnnotation"),n.typeAnnotation=this.finishNode(l,"TypeAnnotation"),this.resetEndLocation(n),this.semicolon(),this.scope.declareName(t.id.name,2048,t.id.loc.start),this.finishNode(t,"DeclareFunction")}flowParseDeclare(t,n){if(this.match(80))return this.flowParseDeclareClass(t);if(this.match(68))return this.flowParseDeclareFunction(t);if(this.match(74))return this.flowParseDeclareVariable(t);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(t):(n&&this.raise(j.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(t));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(t);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(t);if(this.isContextual(129))return this.flowParseDeclareInterface(t);if(this.match(82))return this.flowParseDeclareExportDeclaration(t,n);throw this.unexpected()}flowParseDeclareVariable(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(t.id.name,5,t.id.loc.start),this.semicolon(),this.finishNode(t,"DeclareVariable")}flowParseDeclareModule(t){this.scope.enter(0),this.match(134)?t.id=super.parseExprAtom():t.id=this.parseIdentifier();const n=t.body=this.startNode(),o=n.body=[];for(this.expect(5);!this.match(8);){const m=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(j.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),o.push(super.parseImport(m))):(this.expectContextual(125,j.UnsupportedStatementInDeclareModule),o.push(this.flowParseDeclare(m,!0)))}this.scope.exit(),this.expect(8),this.finishNode(n,"BlockStatement");let l=null,d=!1;return o.forEach(m=>{gh(m)?(l==="CommonJS"&&this.raise(j.AmbiguousDeclareModuleKind,m),l="ES"):m.type==="DeclareModuleExports"&&(d&&this.raise(j.DuplicateDeclareModuleExports,m),l==="ES"&&this.raise(j.AmbiguousDeclareModuleKind,m),l="CommonJS",d=!0)}),t.kind=l||"CommonJS",this.finishNode(t,"DeclareModule")}flowParseDeclareExportDeclaration(t,n){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?t.declaration=this.flowParseDeclare(this.startNode()):(t.declaration=this.flowParseType(),this.semicolon()),t.default=!0,this.finishNode(t,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!n){const o=this.state.value;throw this.raise(j.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:o,suggestion:Eh[o]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return t.declaration=this.flowParseDeclare(this.startNode()),t.default=!1,this.finishNode(t,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return t=this.parseExport(t,null),t.type==="ExportNamedDeclaration"?(t.default=!1,delete t.exportKind,this.castNodeTo(t,"DeclareExportDeclaration")):this.castNodeTo(t,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(t){return this.next(),this.expectContextual(111),t.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(t,"DeclareModuleExports")}flowParseDeclareTypeAlias(t){this.next();const n=this.flowParseTypeAlias(t);return this.castNodeTo(n,"DeclareTypeAlias"),n}flowParseDeclareOpaqueType(t){this.next();const n=this.flowParseOpaqueType(t,!0);return this.castNodeTo(n,"DeclareOpaqueType"),n}flowParseDeclareInterface(t){return this.next(),this.flowParseInterfaceish(t,!1),this.finishNode(t,"DeclareInterface")}flowParseInterfaceish(t,n){if(t.id=this.flowParseRestrictedIdentifier(!n,!0),this.scope.declareName(t.id.name,n?17:8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.extends=[],this.eat(81))do t.extends.push(this.flowParseInterfaceExtends());while(!n&&this.eat(12));if(n){if(t.implements=[],t.mixins=[],this.eatContextual(117))do t.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do t.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}t.body=this.flowParseObjectType({allowStatic:n,allowExact:!1,allowSpread:!1,allowProto:n,allowInexact:!1})}flowParseInterfaceExtends(){const t=this.startNode();return t.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"InterfaceExtends")}flowParseInterface(t){return this.flowParseInterfaceish(t,!1),this.finishNode(t,"InterfaceDeclaration")}checkNotUnderscore(t){t==="_"&&this.raise(j.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(t,n,o){yh.has(t)&&this.raise(o?j.AssignReservedType:j.UnexpectedReservedType,n,{reservedType:t})}flowParseRestrictedIdentifierName(t,n){return this.checkReservedType(this.state.value,this.state.startLoc,n),this.parseIdentifierName(t)}flowParseRestrictedIdentifier(t,n){const o=this.startNode(),l=this.flowParseRestrictedIdentifierName(t,n);return this.createIdentifier(o,l)}flowParseTypeAlias(t){return t.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(t.id.name,8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(t,"TypeAlias")}flowParseOpaqueType(t,n){return this.expectContextual(130),t.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(t.id.name,8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.supertype=null,this.match(14)&&(t.supertype=this.flowParseTypeInitialiser(14)),t.impltype=null,n||(t.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(t,"OpaqueType")}flowParseTypeParameterBound(){if(this.match(14)||this.isContextual(81)){const t=this.startNode();return this.next(),t.typeAnnotation=this.flowParseType(),this.finishNode(t,"TypeAnnotation")}}flowParseTypeParameter(t=!1){const n=this.state.startLoc,o=this.startNode(),l=this.flowParseVariance();return o.name=this.flowParseRestrictedIdentifierName(),o.variance=l,o.bound=this.flowParseTypeParameterBound(),this.match(29)?(this.eat(29),o.default=this.flowParseType()):t&&this.raise(j.MissingTypeParamDefault,n),this.finishNode(o,"TypeParameter")}flowParseTypeParameterDeclaration(){const t=this.state.inType,n=this.startNode();n.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let o=!1;do{const l=this.flowParseTypeParameter(o);n.params.push(l),l.default&&(o=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=t,this.finishNode(n,"TypeParameterDeclaration")}flowInTopLevelContext(t){if(this.curContext()!==$.brace){const n=this.state.context;this.state.context=[n[0]];try{return t()}finally{this.state.context=n}}else return t()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){const t=this.startNode(),n=this.state.inType;return this.state.inType=!0,t.params=[],this.flowInTopLevelContext(()=>{this.expect(47);const o=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)t.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=o}),this.state.inType=n,!this.state.inType&&this.curContext()===$.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;const t=this.startNode(),n=this.state.inType;for(t.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)t.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=n,this.finishNode(t,"TypeParameterInstantiation")}flowParseInterfaceType(){const t=this.startNode();if(this.expectContextual(129),t.extends=[],this.eat(81))do t.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return t.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(t,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(t,n,o){return t.static=n,this.lookahead().type===14?(t.id=this.flowParseObjectPropertyKey(),t.key=this.flowParseTypeInitialiser()):(t.id=null,t.key=this.flowParseType()),this.expect(3),t.value=this.flowParseTypeInitialiser(),t.variance=o,this.finishNode(t,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(t,n){return t.static=n,t.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(t.method=!0,t.optional=!1,t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.loc.start))):(t.method=!1,this.eat(17)&&(t.optional=!0),t.value=this.flowParseTypeInitialiser()),this.finishNode(t,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(t){for(t.params=[],t.rest=null,t.typeParameters=null,t.this=null,this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(t.this=this.flowParseFunctionTypeParam(!0),t.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)t.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(t.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(t,n){const o=this.startNode();return t.static=n,t.value=this.flowParseObjectTypeMethodish(o),this.finishNode(t,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:t,allowExact:n,allowSpread:o,allowProto:l,allowInexact:d}){const m=this.state.inType;this.state.inType=!0;const g=this.startNode();g.callProperties=[],g.properties=[],g.indexers=[],g.internalSlots=[];let E,b,I=!1;for(n&&this.match(6)?(this.expect(6),E=9,b=!0):(this.expect(5),E=8,b=!1),g.exact=b;!this.match(E);){let N=!1,M=null,Q=null;const le=this.startNode();if(l&&this.isContextual(118)){const oe=this.lookahead();oe.type!==14&&oe.type!==17&&(this.next(),M=this.state.startLoc,t=!1)}if(t&&this.isContextual(106)){const oe=this.lookahead();oe.type!==14&&oe.type!==17&&(this.next(),N=!0)}const H=this.flowParseVariance();if(this.eat(0))M!=null&&this.unexpected(M),this.eat(0)?(H&&this.unexpected(H.loc.start),g.internalSlots.push(this.flowParseObjectTypeInternalSlot(le,N))):g.indexers.push(this.flowParseObjectTypeIndexer(le,N,H));else if(this.match(10)||this.match(47))M!=null&&this.unexpected(M),H&&this.unexpected(H.loc.start),g.callProperties.push(this.flowParseObjectTypeCallProperty(le,N));else{let oe="init";if(this.isContextual(99)||this.isContextual(104)){const At=this.lookahead();Un(At.type)&&(oe=this.state.value,this.next())}const Rt=this.flowParseObjectTypeProperty(le,N,M,H,oe,o,d??!b);Rt===null?(I=!0,Q=this.state.lastTokStartLoc):g.properties.push(Rt)}this.flowObjectTypeSemicolon(),Q&&!this.match(8)&&!this.match(9)&&this.raise(j.UnexpectedExplicitInexactInObject,Q)}this.expect(E),o&&(g.inexact=I);const C=this.finishNode(g,"ObjectTypeAnnotation");return this.state.inType=m,C}flowParseObjectTypeProperty(t,n,o,l,d,m,g){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(m?g||this.raise(j.InexactInsideExact,this.state.lastTokStartLoc):this.raise(j.InexactInsideNonObject,this.state.lastTokStartLoc),l&&this.raise(j.InexactVariance,l),null):(m||this.raise(j.UnexpectedSpreadType,this.state.lastTokStartLoc),o!=null&&this.unexpected(o),l&&this.raise(j.SpreadVariance,l),t.argument=this.flowParseType(),this.finishNode(t,"ObjectTypeSpreadProperty"));{t.key=this.flowParseObjectPropertyKey(),t.static=n,t.proto=o!=null,t.kind=d;let E=!1;return this.match(47)||this.match(10)?(t.method=!0,o!=null&&this.unexpected(o),l&&this.unexpected(l.loc.start),t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.loc.start)),(d==="get"||d==="set")&&this.flowCheckGetterSetterParams(t),!m&&t.key.name==="constructor"&&t.value.this&&this.raise(j.ThisParamBannedInConstructor,t.value.this)):(d!=="init"&&this.unexpected(),t.method=!1,this.eat(17)&&(E=!0),t.value=this.flowParseTypeInitialiser(),t.variance=l),t.optional=E,this.finishNode(t,"ObjectTypeProperty")}}flowCheckGetterSetterParams(t){const n=t.kind==="get"?0:1,o=t.value.params.length+(t.value.rest?1:0);t.value.this&&this.raise(t.kind==="get"?j.GetterMayNotHaveThisParam:j.SetterMayNotHaveThisParam,t.value.this),o!==n&&this.raise(t.kind==="get"?S.BadGetterArity:S.BadSetterArity,t),t.kind==="set"&&t.value.rest&&this.raise(S.BadSetterRestParameter,t)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(t,n){t??(t=this.state.startLoc);let o=n||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){const l=this.startNodeAt(t);l.qualification=o,l.id=this.flowParseRestrictedIdentifier(!0),o=this.finishNode(l,"QualifiedTypeIdentifier")}return o}flowParseGenericType(t,n){const o=this.startNodeAt(t);return o.typeParameters=null,o.id=this.flowParseQualifiedTypeIdentifier(t,n),this.match(47)&&(o.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(o,"GenericTypeAnnotation")}flowParseTypeofType(){const t=this.startNode();return this.expect(87),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")}flowParseTupleType(){const t=this.startNode();for(t.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(t.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(t,"TupleTypeAnnotation")}flowParseFunctionTypeParam(t){let n=null,o=!1,l=null;const d=this.startNode(),m=this.lookahead(),g=this.state.type===78;return m.type===14||m.type===17?(g&&!t&&this.raise(j.ThisParamMustBeFirst,d),n=this.parseIdentifier(g),this.eat(17)&&(o=!0,g&&this.raise(j.ThisParamMayNotBeOptional,d)),l=this.flowParseTypeInitialiser()):l=this.flowParseType(),d.name=n,d.optional=o,d.typeAnnotation=l,this.finishNode(d,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(t){const n=this.startNodeAt(t.loc.start);return n.name=null,n.optional=!1,n.typeAnnotation=t,this.finishNode(n,"FunctionTypeParam")}flowParseFunctionTypeParams(t=[]){let n=null,o=null;for(this.match(78)&&(o=this.flowParseFunctionTypeParam(!0),o.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)t.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(n=this.flowParseFunctionTypeParam(!1)),{params:t,rest:n,_this:o}}flowIdentToTypeAnnotation(t,n,o){switch(o.name){case"any":return this.finishNode(n,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(n,"BooleanTypeAnnotation");case"mixed":return this.finishNode(n,"MixedTypeAnnotation");case"empty":return this.finishNode(n,"EmptyTypeAnnotation");case"number":return this.finishNode(n,"NumberTypeAnnotation");case"string":return this.finishNode(n,"StringTypeAnnotation");case"symbol":return this.finishNode(n,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(o.name),this.flowParseGenericType(t,o)}}flowParsePrimaryType(){const t=this.state.startLoc,n=this.startNode();let o,l,d=!1;const m=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,l=this.flowParseTupleType(),this.state.noAnonFunctionType=m,l;case 47:{const g=this.startNode();return g.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),o=this.flowParseFunctionTypeParams(),g.params=o.params,g.rest=o.rest,g.this=o._this,this.expect(11),this.expect(19),g.returnType=this.flowParseType(),this.finishNode(g,"FunctionTypeAnnotation")}case 10:{const g=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if(ie(this.state.type)||this.match(78)){const E=this.lookahead().type;d=E!==17&&E!==14}else d=!0;if(d){if(this.state.noAnonFunctionType=!1,l=this.flowParseType(),this.state.noAnonFunctionType=m,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),l;this.eat(12)}return l?o=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(l)]):o=this.flowParseFunctionTypeParams(),g.params=o.params,g.rest=o.rest,g.this=o._this,this.expect(11),this.expect(19),g.returnType=this.flowParseType(),g.typeParameters=null,this.finishNode(g,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return n.value=this.match(85),this.next(),this.finishNode(n,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",n);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",n);throw this.raise(j.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(n,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(n,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(n,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(n,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(or(this.state.type)){const g=It(this.state.type);return this.next(),super.createIdentifier(n,g)}else if(ie(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(t,n,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){const t=this.state.startLoc;let n=this.flowParsePrimaryType(),o=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){const l=this.startNodeAt(t),d=this.eat(18);o=o||d,this.expect(0),!d&&this.match(3)?(l.elementType=n,this.next(),n=this.finishNode(l,"ArrayTypeAnnotation")):(l.objectType=n,l.indexType=this.flowParseType(),this.expect(3),o?(l.optional=d,n=this.finishNode(l,"OptionalIndexedAccessType")):n=this.finishNode(l,"IndexedAccessType"))}return n}flowParsePrefixType(){const t=this.startNode();return this.eat(17)?(t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){const t=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){const n=this.startNodeAt(t.loc.start);return n.params=[this.reinterpretTypeAsFunctionTypeParam(t)],n.rest=null,n.this=null,n.returnType=this.flowParseType(),n.typeParameters=null,this.finishNode(n,"FunctionTypeAnnotation")}return t}flowParseIntersectionType(){const t=this.startNode();this.eat(45);const n=this.flowParseAnonFunctionWithoutParens();for(t.types=[n];this.eat(45);)t.types.push(this.flowParseAnonFunctionWithoutParens());return t.types.length===1?n:this.finishNode(t,"IntersectionTypeAnnotation")}flowParseUnionType(){const t=this.startNode();this.eat(43);const n=this.flowParseIntersectionType();for(t.types=[n];this.eat(43);)t.types.push(this.flowParseIntersectionType());return t.types.length===1?n:this.finishNode(t,"UnionTypeAnnotation")}flowParseType(){const t=this.state.inType;this.state.inType=!0;const n=this.flowParseUnionType();return this.state.inType=t,n}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){const t=this.state.startLoc,n=this.parseIdentifier();return this.flowParseGenericType(t,n)}else return this.flowParseType()}flowParseTypeAnnotation(){const t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(){const t=this.startNode(),n=this.parseIdentifierName();return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),this.createIdentifier(t,n)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.loc.end),t.expression}flowParseVariance(){let t=null;return this.match(53)?(t=this.startNode(),this.state.value==="+"?t.kind="plus":t.kind="minus",this.next(),this.finishNode(t,"Variance")):t}parseFunctionBody(t,n,o=!1){if(n){this.forwardNoArrowParamsConversionAt(t,()=>super.parseFunctionBody(t,!0,o));return}super.parseFunctionBody(t,!1,o)}parseFunctionBodyAndFinish(t,n,o=!1){if(this.match(14)){const l=this.startNode();[l.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),t.returnType=l.typeAnnotation?this.finishNode(l,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(t,n,o)}parseStatementLike(t){if(this.state.strict&&this.isContextual(129)){const o=this.lookahead();if(Xe(o.type)){const l=this.startNode();return this.next(),this.flowParseInterface(l)}}else if(this.isContextual(126)){const o=this.startNode();return this.next(),this.flowParseEnumDeclaration(o)}const n=super.parseStatementLike(t);return this.flowPragma===void 0&&!this.isValidDirective(n)&&(this.flowPragma=null),n}parseExpressionStatement(t,n,o){if(n.type==="Identifier"){if(n.name==="declare"){if(this.match(80)||ie(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(t)}else if(ie(this.state.type)){if(n.name==="interface")return this.flowParseInterface(t);if(n.name==="type")return this.flowParseTypeAlias(t);if(n.name==="opaque")return this.flowParseOpaqueType(t,!1)}}return super.parseExpressionStatement(t,n,o)}shouldParseExportDeclaration(){const{type:t}=this.state;return t===126||jn(t)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:t}=this.state;return t===126||jn(t)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){const t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDefaultExpression()}parseConditional(t,n,o){if(!this.match(17))return t;if(this.state.maybeInArrowParameters){const C=this.lookaheadCharCode();if(C===44||C===61||C===58||C===41)return this.setOptionalParametersError(o),t}this.expect(17);const l=this.state.clone(),d=this.state.noArrowAt,m=this.startNodeAt(n);let{consequent:g,failed:E}=this.tryParseConditionalConsequent(),[b,I]=this.getArrowLikeExpressions(g);if(E||I.length>0){const C=[...d];if(I.length>0){this.state=l,this.state.noArrowAt=C;for(let N=0;N<I.length;N++)C.push(I[N].start);({consequent:g,failed:E}=this.tryParseConditionalConsequent()),[b,I]=this.getArrowLikeExpressions(g)}E&&b.length>1&&this.raise(j.AmbiguousConditionalArrow,l.startLoc),E&&b.length===1&&(this.state=l,C.push(b[0].start),this.state.noArrowAt=C,{consequent:g,failed:E}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(g,!0),this.state.noArrowAt=d,this.expect(14),m.test=t,m.consequent=g,m.alternate=this.forwardNoArrowParamsConversionAt(m,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(m,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);const t=this.parseMaybeAssignAllowIn(),n=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:t,failed:n}}getArrowLikeExpressions(t,n){const o=[t],l=[];for(;o.length!==0;){const d=o.pop();d.type==="ArrowFunctionExpression"&&d.body.type!=="BlockStatement"?(d.typeParameters||!d.returnType?this.finishArrowValidation(d):l.push(d),o.push(d.body)):d.type==="ConditionalExpression"&&(o.push(d.consequent),o.push(d.alternate))}return n?(l.forEach(d=>this.finishArrowValidation(d)),[l,[]]):Th(l,d=>d.params.every(m=>this.isAssignable(m,!0)))}finishArrowValidation(t){var n;this.toAssignableList(t.params,(n=t.extra)==null?void 0:n.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(t,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(t,n){let o;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),o=n(),this.state.noArrowParamsConversionAt.pop()):o=n(),o}parseParenItem(t,n){const o=super.parseParenItem(t,n);if(this.eat(17)&&(o.optional=!0,this.resetEndLocation(t)),this.match(14)){const l=this.startNodeAt(n);return l.expression=o,l.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(l,"TypeCastExpression")}return o}assertModuleNodeAllowed(t){t.type==="ImportDeclaration"&&(t.importKind==="type"||t.importKind==="typeof")||t.type==="ExportNamedDeclaration"&&t.exportKind==="type"||t.type==="ExportAllDeclaration"&&t.exportKind==="type"||super.assertModuleNodeAllowed(t)}parseExportDeclaration(t){if(this.isContextual(130)){t.exportKind="type";const n=this.startNode();return this.next(),this.match(5)?(t.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(t),null):this.flowParseTypeAlias(n)}else if(this.isContextual(131)){t.exportKind="type";const n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}else if(this.isContextual(129)){t.exportKind="type";const n=this.startNode();return this.next(),this.flowParseInterface(n)}else if(this.isContextual(126)){t.exportKind="value";const n=this.startNode();return this.next(),this.flowParseEnumDeclaration(n)}else return super.parseExportDeclaration(t)}eatExportStar(t){return super.eatExportStar(t)?!0:this.isContextual(130)&&this.lookahead().type===55?(t.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(t){const{startLoc:n}=this.state,o=super.maybeParseExportNamespaceSpecifier(t);return o&&t.exportKind==="type"&&this.unexpected(n),o}parseClassId(t,n,o){super.parseClassId(t,n,o),this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(t,n,o){const{startLoc:l}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(t,n))return;n.declare=!0}super.parseClassMember(t,n,o),n.declare&&(n.type!=="ClassProperty"&&n.type!=="ClassPrivateProperty"&&n.type!=="PropertyDefinition"?this.raise(j.DeclareClassElement,l):n.value&&this.raise(j.DeclareClassFieldInitializer,n.value))}isIterator(t){return t==="iterator"||t==="asyncIterator"}readIterator(){const t=super.readWord1(),n="@@"+t;(!this.isIterator(t)||!this.state.inType)&&this.raise(S.InvalidIdentifier,this.state.curPosition(),{identifierName:n}),this.finishToken(132,n)}getTokenFromCode(t){const n=this.input.charCodeAt(this.state.pos+1);t===123&&n===124?this.finishOp(6,2):this.state.inType&&(t===62||t===60)?this.finishOp(t===62?48:47,1):this.state.inType&&t===63?n===46?this.finishOp(18,2):this.finishOp(17,1):hh(t,n,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(t)}isAssignable(t,n){return t.type==="TypeCastExpression"?this.isAssignable(t.expression,n):super.isAssignable(t,n)}toAssignable(t,n=!1){!n&&t.type==="AssignmentExpression"&&t.left.type==="TypeCastExpression"&&(t.left=this.typeCastToParameter(t.left)),super.toAssignable(t,n)}toAssignableList(t,n,o){for(let l=0;l<t.length;l++){const d=t[l];d?.type==="TypeCastExpression"&&(t[l]=this.typeCastToParameter(d))}super.toAssignableList(t,n,o)}toReferencedList(t,n){for(let l=0;l<t.length;l++){var o;const d=t[l];d&&d.type==="TypeCastExpression"&&!((o=d.extra)!=null&&o.parenthesized)&&(t.length>1||!n)&&this.raise(j.TypeCastInPattern,d.typeAnnotation)}return t}parseArrayLike(t,n,o){const l=super.parseArrayLike(t,n,o);return o!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(l.elements),l}isValidLVal(t,n,o,l){return t==="TypeCastExpression"||super.isValidLVal(t,n,o,l)}parseClassProperty(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(t)}parseClassPrivateProperty(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(t)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(t){return!this.match(14)&&super.isNonstaticConstructor(t)}pushClassMethod(t,n,o,l,d,m){if(n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(t,n,o,l,d,m),n.params&&d){const g=n.params;g.length>0&&this.isThisParam(g[0])&&this.raise(j.ThisParamBannedInConstructor,n)}else if(n.type==="MethodDefinition"&&d&&n.value.params){const g=n.value.params;g.length>0&&this.isThisParam(g[0])&&this.raise(j.ThisParamBannedInConstructor,n)}}pushClassPrivateMethod(t,n,o,l){n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(t,n,o,l)}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass&&(this.match(47)||this.match(51))&&(t.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();const n=t.implements=[];do{const o=this.startNode();o.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?o.typeParameters=this.flowParseTypeParameterInstantiation():o.typeParameters=null,n.push(this.finishNode(o,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(t){super.checkGetterSetterParams(t);const n=this.getObjectOrClassMethodParams(t);if(n.length>0){const o=n[0];this.isThisParam(o)&&t.kind==="get"?this.raise(j.GetterMayNotHaveThisParam,o):this.isThisParam(o)&&this.raise(j.SetterMayNotHaveThisParam,o)}}parsePropertyNamePrefixOperator(t){t.variance=this.flowParseVariance()}parseObjPropValue(t,n,o,l,d,m,g){t.variance&&this.unexpected(t.variance.loc.start),delete t.variance;let E;this.match(47)&&!m&&(E=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());const b=super.parseObjPropValue(t,n,o,l,d,m,g);return E&&((b.value||b).typeParameters=E),b}parseFunctionParamType(t){return this.eat(17)&&(t.type!=="Identifier"&&this.raise(j.PatternIsOptional,t),this.isThisParam(t)&&this.raise(j.ThisParamMayNotBeOptional,t),t.optional=!0),this.match(14)?t.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(t)&&this.raise(j.ThisParamAnnotationRequired,t),this.match(29)&&this.isThisParam(t)&&this.raise(j.ThisParamNoDefault,t),this.resetEndLocation(t),t}parseMaybeDefault(t,n){const o=super.parseMaybeDefault(t,n);return o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start&&this.raise(j.TypeBeforeInitializer,o.typeAnnotation),o}checkImportReflection(t){super.checkImportReflection(t),t.module&&t.importKind!=="value"&&this.raise(j.ImportReflectionHasImportType,t.specifiers[0].loc.start)}parseImportSpecifierLocal(t,n,o){n.local=Kn(t)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(n,o))}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(130)){if(!t)return!0;const n=this.lookaheadCharCode();return n===123||n===42}return!t&&this.isContextual(87)}applyImportPhase(t,n,o,l){if(super.applyImportPhase(t,n,o,l),n){if(!o&&this.match(65))return;t.exportKind=o==="type"?o:"value"}else o==="type"&&this.match(55)&&this.unexpected(),t.importKind=o==="type"||o==="typeof"?o:"value"}parseImportSpecifier(t,n,o,l,d){const m=t.imported;let g=null;m.type==="Identifier"&&(m.name==="type"?g="type":m.name==="typeof"&&(g="typeof"));let E=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){const I=this.parseIdentifier(!0);g!==null&&!Xe(this.state.type)?(t.imported=I,t.importKind=g,t.local=this.cloneIdentifier(I)):(t.imported=m,t.importKind=null,t.local=this.parseIdentifier())}else{if(g!==null&&Xe(this.state.type))t.imported=this.parseIdentifier(!0),t.importKind=g;else{if(n)throw this.raise(S.ImportBindingIsString,t,{importName:m.value});t.imported=m,t.importKind=null}this.eatContextual(93)?t.local=this.parseIdentifier():(E=!0,t.local=this.cloneIdentifier(t.imported))}const b=Kn(t);return o&&b&&this.raise(j.ImportTypeShorthandOnlyInPureImport,t),(o||b)&&this.checkReservedType(t.local.name,t.local.loc.start,!0),E&&!o&&!b&&this.checkReservedWord(t.local.name,t.loc.start,!0,!0),this.finishImportSpecifier(t,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(t,n){const o=t.kind;o!=="get"&&o!=="set"&&this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(t,n)}parseVarId(t,n){super.parseVarId(t,n),this.match(14)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,n){if(this.match(14)){const o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=o}return super.parseAsyncArrowFromCallExpression(t,n)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(t,n){var o;let l=null,d;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(l=this.state.clone(),d=this.tryParse(()=>super.parseMaybeAssign(t,n),l),!d.error)return d.node;const{context:E}=this.state,b=E[E.length-1];(b===$.j_oTag||b===$.j_expr)&&E.pop()}if((o=d)!=null&&o.error||this.match(47)){var m,g;l=l||this.state.clone();let E;const b=this.tryParse(C=>{var N;E=this.flowParseTypeParameterDeclaration();const M=this.forwardNoArrowParamsConversionAt(E,()=>{const le=super.parseMaybeAssign(t,n);return this.resetStartLocationFromNode(le,E),le});(N=M.extra)!=null&&N.parenthesized&&C();const Q=this.maybeUnwrapTypeCastExpression(M);return Q.type!=="ArrowFunctionExpression"&&C(),Q.typeParameters=E,this.resetStartLocationFromNode(Q,E),M},l);let I=null;if(b.node&&this.maybeUnwrapTypeCastExpression(b.node).type==="ArrowFunctionExpression"){if(!b.error&&!b.aborted)return b.node.async&&this.raise(j.UnexpectedTypeParameterBeforeAsyncArrowFunction,E),b.node;I=b.node}if((m=d)!=null&&m.node)return this.state=d.failState,d.node;if(I)return this.state=b.failState,I;throw(g=d)!=null&&g.thrown?d.error:b.thrown?b.error:this.raise(j.UnexpectedTokenAfterTypeParameter,E)}return super.parseMaybeAssign(t,n)}parseArrow(t){if(this.match(14)){const n=this.tryParse(()=>{const o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;const l=this.startNode();return[l.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=o,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),l});if(n.thrown)return null;n.error&&(this.state=n.failState),t.returnType=n.node.typeAnnotation?this.finishNode(n.node,"TypeAnnotation"):null}return super.parseArrow(t)}shouldParseArrow(t){return this.match(14)||super.shouldParseArrow(t)}setArrowFunctionParameters(t,n){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?t.params=n:super.setArrowFunctionParameters(t,n)}checkParams(t,n,o,l=!0){if(!(o&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))){for(let d=0;d<t.params.length;d++)this.isThisParam(t.params[d])&&d>0&&this.raise(j.ThisParamMustBeFirst,t.params[d]);super.checkParams(t,n,o,l)}}parseParenAndDistinguishExpression(t){return super.parseParenAndDistinguishExpression(t&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(t,n,o){if(t.type==="Identifier"&&t.name==="async"&&this.state.noArrowAt.includes(n.index)){this.next();const l=this.startNodeAt(n);l.callee=t,l.arguments=super.parseCallExpressionArguments(),t=this.finishNode(l,"CallExpression")}else if(t.type==="Identifier"&&t.name==="async"&&this.match(47)){const l=this.state.clone(),d=this.tryParse(g=>this.parseAsyncArrowWithTypeParameters(n)||g(),l);if(!d.error&&!d.aborted)return d.node;const m=this.tryParse(()=>super.parseSubscripts(t,n,o),l);if(m.node&&!m.error)return m.node;if(d.node)return this.state=d.failState,d.node;if(m.node)return this.state=m.failState,m.node;throw d.error||m.error}return super.parseSubscripts(t,n,o)}parseSubscript(t,n,o,l){if(this.match(18)&&this.isLookaheadToken_lt()){if(l.optionalChainMember=!0,o)return l.stop=!0,t;this.next();const d=this.startNodeAt(n);return d.callee=t,d.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),d.arguments=this.parseCallExpressionArguments(),d.optional=!0,this.finishCallExpression(d,!0)}else if(!o&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){const d=this.startNodeAt(n);d.callee=t;const m=this.tryParse(()=>(d.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),d.arguments=super.parseCallExpressionArguments(),l.optionalChainMember&&(d.optional=!1),this.finishCallExpression(d,l.optionalChainMember)));if(m.node)return m.error&&(this.state=m.failState),m.node}return super.parseSubscript(t,n,o,l)}parseNewCallee(t){super.parseNewCallee(t);let n=null;this.shouldParseTypes()&&this.match(47)&&(n=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),t.typeArguments=n}parseAsyncArrowWithTypeParameters(t){const n=this.startNodeAt(t);if(this.parseFunctionParams(n,!1),!!this.parseArrow(n))return super.parseArrowExpression(n,void 0,!0)}readToken_mult_modulo(t){const n=this.input.charCodeAt(this.state.pos+1);if(t===42&&n===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(t)}readToken_pipe_amp(t){const n=this.input.charCodeAt(this.state.pos+1);if(t===124&&n===125){this.finishOp(9,2);return}super.readToken_pipe_amp(t)}parseTopLevel(t,n){const o=super.parseTopLevel(t,n);return this.state.hasFlowComment&&this.raise(j.UnterminatedFlowComment,this.state.curPosition()),o}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(j.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();const t=this.skipFlowComment();t&&(this.state.pos+=t,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){const{pos:t}=this.state;let n=2;for(;[32,9].includes(this.input.charCodeAt(t+n));)n++;const o=this.input.charCodeAt(n+t),l=this.input.charCodeAt(n+t+1);return o===58&&l===58?n+2:this.input.slice(n+t,n+t+12)==="flow-include"?n+12:o===58&&l!==58?n:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(S.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(t,{enumName:n,memberName:o}){this.raise(j.EnumBooleanMemberNotInitialized,t,{memberName:o,enumName:n})}flowEnumErrorInvalidMemberInitializer(t,n){return this.raise(n.explicitType?n.explicitType==="symbol"?j.EnumInvalidMemberInitializerSymbolType:j.EnumInvalidMemberInitializerPrimaryType:j.EnumInvalidMemberInitializerUnknownType,t,n)}flowEnumErrorNumberMemberNotInitialized(t,n){this.raise(j.EnumNumberMemberNotInitialized,t,n)}flowEnumErrorStringMemberInconsistentlyInitialized(t,n){this.raise(j.EnumStringMemberInconsistentlyInitialized,t,n)}flowEnumMemberInit(){const t=this.state.startLoc,n=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{const o=this.parseNumericLiteral(this.state.value);return n()?{type:"number",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}case 134:{const o=this.parseStringLiteral(this.state.value);return n()?{type:"string",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}case 85:case 86:{const o=this.parseBooleanLiteral(this.match(85));return n()?{type:"boolean",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}default:return{type:"invalid",loc:t}}}flowEnumMemberRaw(){const t=this.state.startLoc,n=this.parseIdentifier(!0),o=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:t};return{id:n,init:o}}flowEnumCheckExplicitTypeMismatch(t,n,o){const{explicitType:l}=n;l!==null&&l!==o&&this.flowEnumErrorInvalidMemberInitializer(t,n)}flowEnumMembers({enumName:t,explicitType:n}){const o=new Set,l={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]};let d=!1;for(;!this.match(8);){if(this.eat(21)){d=!0;break}const m=this.startNode(),{id:g,init:E}=this.flowEnumMemberRaw(),b=g.name;if(b==="")continue;/^[a-z]/.test(b)&&this.raise(j.EnumInvalidMemberName,g,{memberName:b,suggestion:b[0].toUpperCase()+b.slice(1),enumName:t}),o.has(b)&&this.raise(j.EnumDuplicateMemberName,g,{memberName:b,enumName:t}),o.add(b);const I={enumName:t,explicitType:n,memberName:b};switch(m.id=g,E.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(E.loc,I,"boolean"),m.init=E.value,l.booleanMembers.push(this.finishNode(m,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(E.loc,I,"number"),m.init=E.value,l.numberMembers.push(this.finishNode(m,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(E.loc,I,"string"),m.init=E.value,l.stringMembers.push(this.finishNode(m,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(E.loc,I);case"none":switch(n){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(E.loc,I);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(E.loc,I);break;default:l.defaultedMembers.push(this.finishNode(m,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:l,hasUnknownMembers:d}}flowEnumStringMembers(t,n,{enumName:o}){if(t.length===0)return n;if(n.length===0)return t;if(n.length>t.length){for(const l of t)this.flowEnumErrorStringMemberInconsistentlyInitialized(l,{enumName:o});return n}else{for(const l of n)this.flowEnumErrorStringMemberInconsistentlyInitialized(l,{enumName:o});return t}}flowEnumParseExplicitType({enumName:t}){if(!this.eatContextual(102))return null;if(!ie(this.state.type))throw this.raise(j.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:t});const{value:n}=this.state;return this.next(),n!=="boolean"&&n!=="number"&&n!=="string"&&n!=="symbol"&&this.raise(j.EnumInvalidExplicitType,this.state.startLoc,{enumName:t,invalidEnumType:n}),n}flowEnumBody(t,n){const o=n.name,l=n.loc.start,d=this.flowEnumParseExplicitType({enumName:o});this.expect(5);const{members:m,hasUnknownMembers:g}=this.flowEnumMembers({enumName:o,explicitType:d});switch(t.hasUnknownMembers=g,d){case"boolean":return t.explicitType=!0,t.members=m.booleanMembers,this.expect(8),this.finishNode(t,"EnumBooleanBody");case"number":return t.explicitType=!0,t.members=m.numberMembers,this.expect(8),this.finishNode(t,"EnumNumberBody");case"string":return t.explicitType=!0,t.members=this.flowEnumStringMembers(m.stringMembers,m.defaultedMembers,{enumName:o}),this.expect(8),this.finishNode(t,"EnumStringBody");case"symbol":return t.members=m.defaultedMembers,this.expect(8),this.finishNode(t,"EnumSymbolBody");default:{const E=()=>(t.members=[],this.expect(8),this.finishNode(t,"EnumStringBody"));t.explicitType=!1;const b=m.booleanMembers.length,I=m.numberMembers.length,C=m.stringMembers.length,N=m.defaultedMembers.length;if(!b&&!I&&!C&&!N)return E();if(!b&&!I)return t.members=this.flowEnumStringMembers(m.stringMembers,m.defaultedMembers,{enumName:o}),this.expect(8),this.finishNode(t,"EnumStringBody");if(!I&&!C&&b>=N){for(const M of m.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(M.loc.start,{enumName:o,memberName:M.id.name});return t.members=m.booleanMembers,this.expect(8),this.finishNode(t,"EnumBooleanBody")}else if(!b&&!C&&I>=N){for(const M of m.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(M.loc.start,{enumName:o,memberName:M.id.name});return t.members=m.numberMembers,this.expect(8),this.finishNode(t,"EnumNumberBody")}else return this.raise(j.EnumInconsistentMemberValues,l,{enumName:o}),E()}}}flowParseEnumDeclaration(t){const n=this.parseIdentifier();return t.id=n,t.body=this.flowEnumBody(this.startNode(),n),this.finishNode(t,"EnumDeclaration")}jsxParseOpeningElementAfterName(t){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(t.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(t)}isLookaheadToken_lt(){const t=this.nextTokenStart();if(this.input.charCodeAt(t)===60){const n=this.input.charCodeAt(t+1);return n!==60&&n!==61}return!1}reScan_lt_gt(){const{type:t}=this.state;t===47?(this.state.pos-=1,this.readToken_lt()):t===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:t}=this.state;return t===51?(this.state.pos-=2,this.finishOp(47,1),47):t}maybeUnwrapTypeCastExpression(t){return t.type==="TypeCastExpression"?t.expression:t}};const xh={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},Ih=/\r\n|[\r\n\u2028\u2029]/,Hs=new RegExp(Ih.source,"g");function qt(p){switch(p){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function qn(p,r,t){for(let n=r;n<t;n++)if(qt(p.charCodeAt(n)))return!0;return!1}const dr=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,fr=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function Ph(p){switch(p){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}const Dt=Ce`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:p})=>`Expected corresponding JSX closing tag for <${p}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:p,HTMLEntity:r})=>`Unexpected token \`${p}\`. Did you mean \`${r}\` or \`{'${p}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function Pt(p){return p?p.type==="JSXOpeningFragment"||p.type==="JSXClosingFragment":!1}function Yt(p){if(p.type==="JSXIdentifier")return p.name;if(p.type==="JSXNamespacedName")return p.namespace.name+":"+p.name.name;if(p.type==="JSXMemberExpression")return Yt(p.object)+"."+Yt(p.property);throw new Error("Node had unexpected type: "+p.type)}var wh=p=>class extends p{jsxReadToken(){let t="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Dt.UnterminatedJsxContent,this.state.startLoc);const o=this.input.charCodeAt(this.state.pos);switch(o){case 60:case 123:if(this.state.pos===this.state.start){o===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(o);return}t+=this.input.slice(n,this.state.pos),this.finishToken(142,t);return;case 38:t+=this.input.slice(n,this.state.pos),t+=this.jsxReadEntity(),n=this.state.pos;break;case 62:case 125:default:qt(o)?(t+=this.input.slice(n,this.state.pos),t+=this.jsxReadNewLine(!0),n=this.state.pos):++this.state.pos}}}jsxReadNewLine(t){const n=this.input.charCodeAt(this.state.pos);let o;return++this.state.pos,n===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,o=t?`
|
|
41
|
+
- Did you mean \`import { "${p}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:p})=>`Expected number in radix ${p}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:p})=>`Escape sequence in keyword ${p}.`,InvalidIdentifier:({identifierName:p})=>`Invalid identifier ${p}.`,InvalidLhs:({ancestor:p})=>`Invalid left-hand side in ${f(p)}.`,InvalidLhsBinding:({ancestor:p})=>`Binding invalid left-hand side in ${f(p)}.`,InvalidLhsOptionalChaining:({ancestor:p})=>`Invalid optional chaining in the left-hand side of ${f(p)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:p})=>`Unexpected character '${p}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:p})=>`Private name #${p} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:p})=>`Label '${p}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:p})=>`This experimental syntax requires enabling the parser plugin: ${p.map(r=>JSON.stringify(r)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:p})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${p.map(r=>JSON.stringify(r)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:p})=>`Duplicate key "${p}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:p})=>`An export name cannot include a lone surrogate, found '\\u${p.toString(16)}'.`,ModuleExportUndefined:({localName:p})=>`Export '${p}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:p})=>`Private names are only allowed in property accesses (\`obj.#${p}\`) or in \`in\` expressions (\`#${p} in obj\`).`,PrivateNameRedeclaration:({identifierName:p})=>`Duplicate private name #${p}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:p})=>`Unexpected keyword '${p}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:p})=>`Unexpected reserved word '${p}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:p,unexpected:r})=>`Unexpected token${r?` '${r}'.`:""}${p?`, expected "${p}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:p,onlyValidPropertyName:r})=>`The only valid meta property for ${p} is ${p}.${r}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:p})=>`Identifier '${p}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},T={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:p})=>`Assigning to '${p}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:p})=>`Binding '${p}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},I={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:p})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(p)}\`.`};const A=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var L=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:p})=>`Invalid topic token ${p}. In order to use ${p} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${p}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:p})=>`Hack-style pipe body cannot be an unparenthesized ${f({type:p})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'});const R=["message"];function oe(p,r,t){Object.defineProperty(p,r,{enumerable:!1,configurable:!0,value:t})}function le({toMessage:p,code:r,reasonCode:t,syntaxPlugin:n}){const o=t==="MissingPlugin"||t==="MissingOneOfPlugins",l={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return l[t]&&(t=l[t]),function d(m,g){const E=new SyntaxError;return E.code=r,E.reasonCode=t,E.loc=m,E.pos=m.index,E.syntaxPlugin=n,o&&(E.missingPlugin=g.missingPlugin),oe(E,"clone",function(x={}){var C;const{line:v,column:M,index:Q}=(C=x.loc)!=null?C:m;return d(new s(v,M,Q),Object.assign({},g,x.details))}),oe(E,"details",g),Object.defineProperty(E,"message",{configurable:!0,get(){const b=`${p(g)} (${m.line}:${m.column})`;return this.message=b,b},set(b){Object.defineProperty(this,"message",{value:b,writable:!0})}}),E}}function Ce(p,r){if(Array.isArray(p))return n=>Ce(n,p[0]);const t={};for(const n of Object.keys(p)){const o=p[n],l=typeof o=="string"?{message:()=>o}:typeof o=="function"?{message:o}:o,{message:d}=l,m=e(l,R),g=typeof d=="string"?()=>d:d;t[n]=le(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:n,toMessage:g},r?{syntaxPlugin:r}:{},m))}return t}const S=Object.assign({},Ce(u),Ce(y),Ce(T),Ce(I),Ce`pipelineOperator`(L));function Ts(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function $e(p){const r=Ts();if(p==null)return r;if(p.annexB!=null&&p.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(const t of Object.keys(r))p[t]!=null&&(r[t]=p[t]);if(r.startLine===1)p.startIndex==null&&r.startColumn>0?r.startIndex=r.startColumn:p.startColumn==null&&r.startIndex>0&&(r.startColumn=r.startIndex);else if((p.startColumn==null||p.startIndex==null)&&p.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(r.sourceType==="commonjs"){if(p.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(p.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(p.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return r}const{defineProperty:we}=Object,Ne=(p,r)=>{p&&we(p,r,{enumerable:!1,value:p[r]})};function bt(p){return Ne(p.loc.start,"index"),Ne(p.loc.end,"index"),p}var qt=p=>class extends p{parse(){const t=bt(super.parse());return this.optionFlags&256&&(t.tokens=t.tokens.map(bt)),t}parseRegExpLiteral({pattern:t,flags:n}){let o=null;try{o=new RegExp(t,n)}catch{}const l=this.estreeParseLiteral(o);return l.regex={pattern:t,flags:n},l}parseBigIntLiteral(t){let n;try{n=BigInt(t)}catch{n=null}const o=this.estreeParseLiteral(n);return o.bigint=String(o.value||t),o}parseDecimalLiteral(t){const o=this.estreeParseLiteral(null);return o.decimal=String(o.value||t),o}estreeParseLiteral(t){return this.parseLiteral(t,"Literal")}parseStringLiteral(t){return this.estreeParseLiteral(t)}parseNumericLiteral(t){return this.estreeParseLiteral(t)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(t){return this.estreeParseLiteral(t)}estreeParseChainExpression(t,n){const o=this.startNodeAtNode(t);return o.expression=t,this.finishNodeAt(o,"ChainExpression",n)}directiveToStmt(t){const n=t.value;delete t.value,this.castNodeTo(n,"Literal"),n.raw=n.extra.raw,n.value=n.extra.expressionValue;const o=this.castNodeTo(t,"ExpressionStatement");return o.expression=n,o.directive=n.extra.rawValue,delete n.extra,o}fillOptionalPropertiesForTSESLint(t){}cloneEstreeStringLiteral(t){const{start:n,end:o,loc:l,range:d,raw:m,value:g}=t,E=Object.create(t.constructor.prototype);return E.type="Literal",E.start=n,E.end=o,E.loc=l,E.range=d,E.raw=m,E.value=g,E}initFunction(t,n){super.initFunction(t,n),t.expression=!1}checkDeclaration(t){t!=null&&this.isObjectProperty(t)?this.checkDeclaration(t.value):super.checkDeclaration(t)}getObjectOrClassMethodParams(t){return t.value.params}isValidDirective(t){var n;return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&!((n=t.expression.extra)!=null&&n.parenthesized)}parseBlockBody(t,n,o,l,d){super.parseBlockBody(t,n,o,l,d);const m=t.directives.map(g=>this.directiveToStmt(g));t.body=m.concat(t.body),delete t.directives}parsePrivateName(){const t=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(t):t}convertPrivateNameToPrivateIdentifier(t){const n=super.getPrivateNameSV(t);return delete t.id,t.name=n,this.castNodeTo(t,"PrivateIdentifier")}isPrivateName(t){return this.getPluginOption("estree","classFeatures")?t.type==="PrivateIdentifier":super.isPrivateName(t)}getPrivateNameSV(t){return this.getPluginOption("estree","classFeatures")?t.name:super.getPrivateNameSV(t)}parseLiteral(t,n){const o=super.parseLiteral(t,n);return o.raw=o.extra.raw,delete o.extra,o}parseFunctionBody(t,n,o=!1){super.parseFunctionBody(t,n,o),t.expression=t.body.type!=="BlockStatement"}parseMethod(t,n,o,l,d,m,g=!1){let E=this.startNode();E.kind=t.kind,E=super.parseMethod(E,n,o,l,d,m,g),delete E.kind;const{typeParameters:b}=t;b&&(delete t.typeParameters,E.typeParameters=b,this.resetStartLocationFromNode(E,b));const x=this.castNodeTo(E,"FunctionExpression");return t.value=x,m==="ClassPrivateMethod"&&(t.computed=!1),m==="ObjectMethod"?(t.kind==="method"&&(t.kind="init"),t.shorthand=!1,this.finishNode(t,"Property")):this.finishNode(t,"MethodDefinition")}nameIsConstructor(t){return t.type==="Literal"?t.value==="constructor":super.nameIsConstructor(t)}parseClassProperty(...t){const n=super.parseClassProperty(...t);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(n,"PropertyDefinition"),n}parseClassPrivateProperty(...t){const n=super.parseClassPrivateProperty(...t);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(n,"PropertyDefinition"),n.computed=!1),n}parseClassAccessorProperty(t){const n=super.parseClassAccessorProperty(t);return this.getPluginOption("estree","classFeatures")&&(n.abstract&&this.hasPlugin("typescript")?(delete n.abstract,this.castNodeTo(n,"TSAbstractAccessorProperty")):this.castNodeTo(n,"AccessorProperty")),n}parseObjectProperty(t,n,o,l){const d=super.parseObjectProperty(t,n,o,l);return d&&(d.kind="init",this.castNodeTo(d,"Property")),d}finishObjectProperty(t){return t.kind="init",this.finishNode(t,"Property")}isValidLVal(t,n,o,l){return t==="Property"?"value":super.isValidLVal(t,n,o,l)}isAssignable(t,n){return t!=null&&this.isObjectProperty(t)?this.isAssignable(t.value,n):super.isAssignable(t,n)}toAssignable(t,n=!1){if(t!=null&&this.isObjectProperty(t)){const{key:o,value:l}=t;this.isPrivateName(o)&&this.classScope.usePrivateName(this.getPrivateNameSV(o),o.loc.start),this.toAssignable(l,n)}else super.toAssignable(t,n)}toAssignableObjectExpressionProp(t,n,o){t.type==="Property"&&(t.kind==="get"||t.kind==="set")?this.raise(S.PatternHasAccessor,t.key):t.type==="Property"&&t.method?this.raise(S.PatternHasMethod,t.key):super.toAssignableObjectExpressionProp(t,n,o)}finishCallExpression(t,n){const o=super.finishCallExpression(t,n);if(o.callee.type==="Import"){var l,d;this.castNodeTo(o,"ImportExpression"),o.source=o.arguments[0],o.options=(l=o.arguments[1])!=null?l:null,o.attributes=(d=o.arguments[1])!=null?d:null,delete o.arguments,delete o.callee}else o.type==="OptionalCallExpression"?this.castNodeTo(o,"CallExpression"):o.optional=!1;return o}toReferencedArguments(t){t.type!=="ImportExpression"&&super.toReferencedArguments(t)}parseExport(t,n){const o=this.state.lastTokStartLoc,l=super.parseExport(t,n);switch(l.type){case"ExportAllDeclaration":l.exported=null;break;case"ExportNamedDeclaration":l.specifiers.length===1&&l.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(l,"ExportAllDeclaration"),l.exported=l.specifiers[0].exported,delete l.specifiers);case"ExportDefaultDeclaration":{var d;const{declaration:m}=l;m?.type==="ClassDeclaration"&&((d=m.decorators)==null?void 0:d.length)>0&&m.start===l.start&&this.resetStartLocation(l,o)}break}return l}stopParseSubscript(t,n){const o=super.stopParseSubscript(t,n);return n.optionalChainMember?this.estreeParseChainExpression(o,t.loc.end):o}parseMember(t,n,o,l,d){const m=super.parseMember(t,n,o,l,d);return m.type==="OptionalMemberExpression"?this.castNodeTo(m,"MemberExpression"):m.optional=!1,m}isOptionalMemberExpression(t){return t.type==="ChainExpression"?t.expression.type==="MemberExpression":super.isOptionalMemberExpression(t)}hasPropertyAsPrivateName(t){return t.type==="ChainExpression"&&(t=t.expression),super.hasPropertyAsPrivateName(t)}isObjectProperty(t){return t.type==="Property"&&t.kind==="init"&&!t.method}isObjectMethod(t){return t.type==="Property"&&(t.method||t.kind==="get"||t.kind==="set")}castNodeTo(t,n){const o=super.castNodeTo(t,n);return this.fillOptionalPropertiesForTSESLint(o),o}cloneIdentifier(t){const n=super.cloneIdentifier(t);return this.fillOptionalPropertiesForTSESLint(n),n}cloneStringLiteral(t){return t.type==="Literal"?this.cloneEstreeStringLiteral(t):super.cloneStringLiteral(t)}finishNodeAt(t,n,o){return bt(super.finishNodeAt(t,n,o))}finishNode(t,n){const o=super.finishNode(t,n);return this.fillOptionalPropertiesForTSESLint(o),o}resetStartLocation(t,n){super.resetStartLocation(t,n),bt(t)}resetEndLocation(t,n=this.state.lastTokEndLoc){super.resetEndLocation(t,n),bt(t)}};class J{constructor(r,t){this.token=void 0,this.preserveSpace=void 0,this.token=r,this.preserveSpace=!!t}}const $={brace:new J("{"),j_oTag:new J("<tag"),j_cTag:new J("</tag"),j_expr:new J("<tag>...</tag>",!0)};$.template=new J("`",!0);const z=!0,_=!0,Yt=!0,Ss=!0,It=!0,Yu=!0;class zn{constructor(r,t={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=r,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop!=null?t.binop:null,this.updateContext=null}}const ir=new Map;function Y(p,r={}){r.keyword=p;const t=B(p,r);return ir.set(p,t),t}function De(p,r){return B(p,{beforeExpr:z,binop:r})}let bs=-1;const lt=[],rr=[],nr=[],ar=[],or=[],cr=[];function B(p,r={}){var t,n,o,l;return++bs,rr.push(p),nr.push((t=r.binop)!=null?t:-1),ar.push((n=r.beforeExpr)!=null?n:!1),or.push((o=r.startsExpr)!=null?o:!1),cr.push((l=r.prefix)!=null?l:!1),lt.push(new zn(p,r)),bs}function Z(p,r={}){var t,n,o,l;return++bs,ir.set(p,bs),rr.push(p),nr.push((t=r.binop)!=null?t:-1),ar.push((n=r.beforeExpr)!=null?n:!1),or.push((o=r.startsExpr)!=null?o:!1),cr.push((l=r.prefix)!=null?l:!1),lt.push(new zn("name",r)),bs}const Xu={bracketL:B("[",{beforeExpr:z,startsExpr:_}),bracketHashL:B("#[",{beforeExpr:z,startsExpr:_}),bracketBarL:B("[|",{beforeExpr:z,startsExpr:_}),bracketR:B("]"),bracketBarR:B("|]"),braceL:B("{",{beforeExpr:z,startsExpr:_}),braceBarL:B("{|",{beforeExpr:z,startsExpr:_}),braceHashL:B("#{",{beforeExpr:z,startsExpr:_}),braceR:B("}"),braceBarR:B("|}"),parenL:B("(",{beforeExpr:z,startsExpr:_}),parenR:B(")"),comma:B(",",{beforeExpr:z}),semi:B(";",{beforeExpr:z}),colon:B(":",{beforeExpr:z}),doubleColon:B("::",{beforeExpr:z}),dot:B("."),question:B("?",{beforeExpr:z}),questionDot:B("?."),arrow:B("=>",{beforeExpr:z}),template:B("template"),ellipsis:B("...",{beforeExpr:z}),backQuote:B("`",{startsExpr:_}),dollarBraceL:B("${",{beforeExpr:z,startsExpr:_}),templateTail:B("...`",{startsExpr:_}),templateNonTail:B("...${",{beforeExpr:z,startsExpr:_}),at:B("@"),hash:B("#",{startsExpr:_}),interpreterDirective:B("#!..."),eq:B("=",{beforeExpr:z,isAssign:Ss}),assign:B("_=",{beforeExpr:z,isAssign:Ss}),slashAssign:B("_=",{beforeExpr:z,isAssign:Ss}),xorAssign:B("_=",{beforeExpr:z,isAssign:Ss}),moduloAssign:B("_=",{beforeExpr:z,isAssign:Ss}),incDec:B("++/--",{prefix:It,postfix:Yu,startsExpr:_}),bang:B("!",{beforeExpr:z,prefix:It,startsExpr:_}),tilde:B("~",{beforeExpr:z,prefix:It,startsExpr:_}),doubleCaret:B("^^",{startsExpr:_}),doubleAt:B("@@",{startsExpr:_}),pipeline:De("|>",0),nullishCoalescing:De("??",1),logicalOR:De("||",1),logicalAND:De("&&",2),bitwiseOR:De("|",3),bitwiseXOR:De("^",4),bitwiseAND:De("&",5),equality:De("==/!=/===/!==",6),lt:De("</>/<=/>=",7),gt:De("</>/<=/>=",7),relational:De("</>/<=/>=",7),bitShift:De("<</>>/>>>",8),bitShiftL:De("<</>>/>>>",8),bitShiftR:De("<</>>/>>>",8),plusMin:B("+/-",{beforeExpr:z,binop:9,prefix:It,startsExpr:_}),modulo:B("%",{binop:10,startsExpr:_}),star:B("*",{binop:10}),slash:De("/",10),exponent:B("**",{beforeExpr:z,binop:11,rightAssociative:!0}),_in:Y("in",{beforeExpr:z,binop:7}),_instanceof:Y("instanceof",{beforeExpr:z,binop:7}),_break:Y("break"),_case:Y("case",{beforeExpr:z}),_catch:Y("catch"),_continue:Y("continue"),_debugger:Y("debugger"),_default:Y("default",{beforeExpr:z}),_else:Y("else",{beforeExpr:z}),_finally:Y("finally"),_function:Y("function",{startsExpr:_}),_if:Y("if"),_return:Y("return",{beforeExpr:z}),_switch:Y("switch"),_throw:Y("throw",{beforeExpr:z,prefix:It,startsExpr:_}),_try:Y("try"),_var:Y("var"),_const:Y("const"),_with:Y("with"),_new:Y("new",{beforeExpr:z,startsExpr:_}),_this:Y("this",{startsExpr:_}),_super:Y("super",{startsExpr:_}),_class:Y("class",{startsExpr:_}),_extends:Y("extends",{beforeExpr:z}),_export:Y("export"),_import:Y("import",{startsExpr:_}),_null:Y("null",{startsExpr:_}),_true:Y("true",{startsExpr:_}),_false:Y("false",{startsExpr:_}),_typeof:Y("typeof",{beforeExpr:z,prefix:It,startsExpr:_}),_void:Y("void",{beforeExpr:z,prefix:It,startsExpr:_}),_delete:Y("delete",{beforeExpr:z,prefix:It,startsExpr:_}),_do:Y("do",{isLoop:Yt,beforeExpr:z}),_for:Y("for",{isLoop:Yt}),_while:Y("while",{isLoop:Yt}),_as:Z("as",{startsExpr:_}),_assert:Z("assert",{startsExpr:_}),_async:Z("async",{startsExpr:_}),_await:Z("await",{startsExpr:_}),_defer:Z("defer",{startsExpr:_}),_from:Z("from",{startsExpr:_}),_get:Z("get",{startsExpr:_}),_let:Z("let",{startsExpr:_}),_meta:Z("meta",{startsExpr:_}),_of:Z("of",{startsExpr:_}),_sent:Z("sent",{startsExpr:_}),_set:Z("set",{startsExpr:_}),_source:Z("source",{startsExpr:_}),_static:Z("static",{startsExpr:_}),_using:Z("using",{startsExpr:_}),_yield:Z("yield",{startsExpr:_}),_asserts:Z("asserts",{startsExpr:_}),_checks:Z("checks",{startsExpr:_}),_exports:Z("exports",{startsExpr:_}),_global:Z("global",{startsExpr:_}),_implements:Z("implements",{startsExpr:_}),_intrinsic:Z("intrinsic",{startsExpr:_}),_infer:Z("infer",{startsExpr:_}),_is:Z("is",{startsExpr:_}),_mixins:Z("mixins",{startsExpr:_}),_proto:Z("proto",{startsExpr:_}),_require:Z("require",{startsExpr:_}),_satisfies:Z("satisfies",{startsExpr:_}),_keyof:Z("keyof",{startsExpr:_}),_readonly:Z("readonly",{startsExpr:_}),_unique:Z("unique",{startsExpr:_}),_abstract:Z("abstract",{startsExpr:_}),_declare:Z("declare",{startsExpr:_}),_enum:Z("enum",{startsExpr:_}),_module:Z("module",{startsExpr:_}),_namespace:Z("namespace",{startsExpr:_}),_interface:Z("interface",{startsExpr:_}),_type:Z("type",{startsExpr:_}),_opaque:Z("opaque",{startsExpr:_}),name:B("name",{startsExpr:_}),placeholder:B("%%",{startsExpr:_}),string:B("string",{startsExpr:_}),num:B("num",{startsExpr:_}),bigint:B("bigint",{startsExpr:_}),decimal:B("decimal",{startsExpr:_}),regexp:B("regexp",{startsExpr:_}),privateName:B("#name",{startsExpr:_}),eof:B("eof"),jsxName:B("jsxName"),jsxText:B("jsxText",{beforeExpr:z}),jsxTagStart:B("jsxTagStart",{startsExpr:_}),jsxTagEnd:B("jsxTagEnd")};function ie(p){return p>=93&&p<=133}function Ju(p){return p<=92}function Je(p){return p>=58&&p<=133}function Vn(p){return p>=58&&p<=137}function Qu(p){return ar[p]}function Is(p){return or[p]}function eh(p){return p>=29&&p<=33}function Gn(p){return p>=129&&p<=131}function th(p){return p>=90&&p<=92}function lr(p){return p>=58&&p<=92}function sh(p){return p>=39&&p<=59}function ih(p){return p===34}function rh(p){return cr[p]}function nh(p){return p>=121&&p<=123}function ah(p){return p>=124&&p<=130}function xt(p){return rr[p]}function Hs(p){return nr[p]}function oh(p){return p===57}function Zs(p){return p>=24&&p<=25}function ut(p){return lt[p]}lt[8].updateContext=p=>{p.pop()},lt[5].updateContext=lt[7].updateContext=lt[23].updateContext=p=>{p.push($.brace)},lt[22].updateContext=p=>{p[p.length-1]===$.template?p.pop():p.push($.template)},lt[143].updateContext=p=>{p.push($.j_expr,$.j_oTag)};let ur="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Hn="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";const ch=new RegExp("["+ur+"]"),lh=new RegExp("["+ur+Hn+"]");ur=Hn=null;const Zn=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],uh=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function hr(p,r){let t=65536;for(let n=0,o=r.length;n<o;n+=2){if(t+=r[n],t>p)return!1;if(t+=r[n+1],t>=p)return!0}return!1}function at(p){return p<65?p===36:p<=90?!0:p<97?p===95:p<=122?!0:p<=65535?p>=170&&ch.test(String.fromCharCode(p)):hr(p,Zn)}function Rt(p){return p<48?p===36:p<58?!0:p<65?!1:p<=90?!0:p<97?p===95:p<=122?!0:p<=65535?p>=170&&lh.test(String.fromCharCode(p)):hr(p,Zn)||hr(p,uh)}const pr={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},hh=new Set(pr.keyword),ph=new Set(pr.strict),dh=new Set(pr.strictBind);function Wn(p,r){return r&&p==="await"||p==="enum"}function Kn(p,r){return Wn(p,r)||ph.has(p)}function qn(p){return dh.has(p)}function Yn(p,r){return Kn(p,r)||qn(p)}function fh(p){return hh.has(p)}function mh(p,r,t){return p===64&&r===64&&at(t)}const yh=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function gh(p){return yh.has(p)}class dr{constructor(r){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=r}}class fr{constructor(r,t){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=r,this.inModule=t}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){const r=this.currentThisScopeFlags();return(r&64)>0&&(r&2)===0}get inStaticBlock(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&128)return!0;if(t&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(r){return new dr(r)}enter(r){this.scopeStack.push(this.createScope(r))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(r){return!!(r.flags&130||!this.parser.inModule&&r.flags&1)}declareName(r,t,n){let o=this.currentScope();if(t&8||t&16){this.checkRedeclarationInScope(o,r,t,n);let l=o.names.get(r)||0;t&16?l=l|4:(o.firstLexicalName||(o.firstLexicalName=r),l=l|2),o.names.set(r,l),t&8&&this.maybeExportDefined(o,r)}else if(t&4)for(let l=this.scopeStack.length-1;l>=0&&(o=this.scopeStack[l],this.checkRedeclarationInScope(o,r,t,n),o.names.set(r,(o.names.get(r)||0)|1),this.maybeExportDefined(o,r),!(o.flags&1667));--l);this.parser.inModule&&o.flags&1&&this.undefinedExports.delete(r)}maybeExportDefined(r,t){this.parser.inModule&&r.flags&1&&this.undefinedExports.delete(t)}checkRedeclarationInScope(r,t,n,o){this.isRedeclaredInScope(r,t,n)&&this.parser.raise(S.VarRedeclaration,o,{identifierName:t})}isRedeclaredInScope(r,t,n){if(!(n&1))return!1;if(n&8)return r.names.has(t);const o=r.names.get(t)||0;return n&16?(o&2)>0||!this.treatFunctionsAsVarInScope(r)&&(o&1)>0:(o&2)>0&&!(r.flags&8&&r.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(r)&&(o&4)>0}checkLocalExport(r){const{name:t}=r;this.scopeStack[0].names.has(t)||this.undefinedExports.set(t,r.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&1667)return t}}currentThisScopeFlags(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&1731&&!(t&4))return t}}}class Eh extends dr{constructor(...r){super(...r),this.declareFunctions=new Set}}class Th extends fr{createScope(r){return new Eh(r)}declareName(r,t,n){const o=this.currentScope();if(t&2048){this.checkRedeclarationInScope(o,r,t,n),this.maybeExportDefined(o,r),o.declareFunctions.add(r);return}super.declareName(r,t,n)}isRedeclaredInScope(r,t,n){if(super.isRedeclaredInScope(r,t,n))return!0;if(n&2048&&!r.declareFunctions.has(t)){const o=r.names.get(t);return(o&4)>0||(o&2)>0}return!1}checkLocalExport(r){this.scopeStack[0].declareFunctions.has(r.name)||super.checkLocalExport(r)}}const Sh=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),j=Ce`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:p})=>`Cannot overwrite reserved type ${p}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:p,enumName:r})=>`Boolean enum members need to be initialized. Use either \`${p} = true,\` or \`${p} = false,\` in enum \`${r}\`.`,EnumDuplicateMemberName:({memberName:p,enumName:r})=>`Enum member names need to be unique, but the name \`${p}\` has already been used before in enum \`${r}\`.`,EnumInconsistentMemberValues:({enumName:p})=>`Enum \`${p}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:p,enumName:r})=>`Enum type \`${p}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${r}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:p})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${p}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:p,memberName:r,explicitType:t})=>`Enum \`${p}\` has type \`${t}\`, so the initializer of \`${r}\` needs to be a ${t} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:p,memberName:r})=>`Symbol enum members cannot be initialized. Use \`${r},\` in enum \`${p}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:p,memberName:r})=>`The enum member initializer for \`${r}\` needs to be a literal (either a boolean, number, or string) in enum \`${p}\`.`,EnumInvalidMemberName:({enumName:p,memberName:r,suggestion:t})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${r}\`, consider using \`${t}\`, in enum \`${p}\`.`,EnumNumberMemberNotInitialized:({enumName:p,memberName:r})=>`Number enum members need to be initialized, e.g. \`${r} = 1\` in enum \`${p}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:p})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${p}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:p})=>`Unexpected reserved type ${p}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:p,suggestion:r})=>`\`declare export ${p}\` is not supported. Use \`${r}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function bh(p){return p.type==="DeclareExportAllDeclaration"||p.type==="DeclareExportDeclaration"&&(!p.declaration||p.declaration.type!=="TypeAlias"&&p.declaration.type!=="InterfaceDeclaration")}function Xn(p){return p.importKind==="type"||p.importKind==="typeof"}const Ih={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function xh(p,r){const t=[],n=[];for(let o=0;o<p.length;o++)(r(p[o],o,p)?t:n).push(p[o]);return[t,n]}const Ah=/\*?\s*@((?:no)?flow)\b/;var Ph=p=>class extends p{constructor(...t){super(...t),this.flowPragma=void 0}getScopeHandler(){return Th}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(t,n){t!==134&&t!==13&&t!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(t,n)}addComment(t){if(this.flowPragma===void 0){const n=Ah.exec(t.value);if(n)if(n[1]==="flow")this.flowPragma="flow";else if(n[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(t)}flowParseTypeInitialiser(t){const n=this.state.inType;this.state.inType=!0,this.expect(t||14);const o=this.flowParseType();return this.state.inType=n,o}flowParsePredicate(){const t=this.startNode(),n=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>n.index+1&&this.raise(j.UnexpectedSpaceBetweenModuloChecks,n),this.eat(10)?(t.value=super.parseExpression(),this.expect(11),this.finishNode(t,"DeclaredPredicate")):this.finishNode(t,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){const t=this.state.inType;this.state.inType=!0,this.expect(14);let n=null,o=null;return this.match(54)?(this.state.inType=t,o=this.flowParsePredicate()):(n=this.flowParseType(),this.state.inType=t,this.match(54)&&(o=this.flowParsePredicate())),[n,o]}flowParseDeclareClass(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")}flowParseDeclareFunction(t){this.next();const n=t.id=this.parseIdentifier(),o=this.startNode(),l=this.startNode();this.match(47)?o.typeParameters=this.flowParseTypeParameterDeclaration():o.typeParameters=null,this.expect(10);const d=this.flowParseFunctionTypeParams();return o.params=d.params,o.rest=d.rest,o.this=d._this,this.expect(11),[o.returnType,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),l.typeAnnotation=this.finishNode(o,"FunctionTypeAnnotation"),n.typeAnnotation=this.finishNode(l,"TypeAnnotation"),this.resetEndLocation(n),this.semicolon(),this.scope.declareName(t.id.name,2048,t.id.loc.start),this.finishNode(t,"DeclareFunction")}flowParseDeclare(t,n){if(this.match(80))return this.flowParseDeclareClass(t);if(this.match(68))return this.flowParseDeclareFunction(t);if(this.match(74))return this.flowParseDeclareVariable(t);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(t):(n&&this.raise(j.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(t));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(t);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(t);if(this.isContextual(129))return this.flowParseDeclareInterface(t);if(this.match(82))return this.flowParseDeclareExportDeclaration(t,n);throw this.unexpected()}flowParseDeclareVariable(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(t.id.name,5,t.id.loc.start),this.semicolon(),this.finishNode(t,"DeclareVariable")}flowParseDeclareModule(t){this.scope.enter(0),this.match(134)?t.id=super.parseExprAtom():t.id=this.parseIdentifier();const n=t.body=this.startNode(),o=n.body=[];for(this.expect(5);!this.match(8);){const m=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(j.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),o.push(super.parseImport(m))):(this.expectContextual(125,j.UnsupportedStatementInDeclareModule),o.push(this.flowParseDeclare(m,!0)))}this.scope.exit(),this.expect(8),this.finishNode(n,"BlockStatement");let l=null,d=!1;return o.forEach(m=>{bh(m)?(l==="CommonJS"&&this.raise(j.AmbiguousDeclareModuleKind,m),l="ES"):m.type==="DeclareModuleExports"&&(d&&this.raise(j.DuplicateDeclareModuleExports,m),l==="ES"&&this.raise(j.AmbiguousDeclareModuleKind,m),l="CommonJS",d=!0)}),t.kind=l||"CommonJS",this.finishNode(t,"DeclareModule")}flowParseDeclareExportDeclaration(t,n){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?t.declaration=this.flowParseDeclare(this.startNode()):(t.declaration=this.flowParseType(),this.semicolon()),t.default=!0,this.finishNode(t,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!n){const o=this.state.value;throw this.raise(j.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:o,suggestion:Ih[o]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return t.declaration=this.flowParseDeclare(this.startNode()),t.default=!1,this.finishNode(t,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return t=this.parseExport(t,null),t.type==="ExportNamedDeclaration"?(t.default=!1,delete t.exportKind,this.castNodeTo(t,"DeclareExportDeclaration")):this.castNodeTo(t,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(t){return this.next(),this.expectContextual(111),t.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(t,"DeclareModuleExports")}flowParseDeclareTypeAlias(t){this.next();const n=this.flowParseTypeAlias(t);return this.castNodeTo(n,"DeclareTypeAlias"),n}flowParseDeclareOpaqueType(t){this.next();const n=this.flowParseOpaqueType(t,!0);return this.castNodeTo(n,"DeclareOpaqueType"),n}flowParseDeclareInterface(t){return this.next(),this.flowParseInterfaceish(t,!1),this.finishNode(t,"DeclareInterface")}flowParseInterfaceish(t,n){if(t.id=this.flowParseRestrictedIdentifier(!n,!0),this.scope.declareName(t.id.name,n?17:8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.extends=[],this.eat(81))do t.extends.push(this.flowParseInterfaceExtends());while(!n&&this.eat(12));if(n){if(t.implements=[],t.mixins=[],this.eatContextual(117))do t.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do t.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}t.body=this.flowParseObjectType({allowStatic:n,allowExact:!1,allowSpread:!1,allowProto:n,allowInexact:!1})}flowParseInterfaceExtends(){const t=this.startNode();return t.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"InterfaceExtends")}flowParseInterface(t){return this.flowParseInterfaceish(t,!1),this.finishNode(t,"InterfaceDeclaration")}checkNotUnderscore(t){t==="_"&&this.raise(j.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(t,n,o){Sh.has(t)&&this.raise(o?j.AssignReservedType:j.UnexpectedReservedType,n,{reservedType:t})}flowParseRestrictedIdentifierName(t,n){return this.checkReservedType(this.state.value,this.state.startLoc,n),this.parseIdentifierName(t)}flowParseRestrictedIdentifier(t,n){const o=this.startNode(),l=this.flowParseRestrictedIdentifierName(t,n);return this.createIdentifier(o,l)}flowParseTypeAlias(t){return t.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(t.id.name,8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(t,"TypeAlias")}flowParseOpaqueType(t,n){return this.expectContextual(130),t.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(t.id.name,8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.supertype=null,this.match(14)&&(t.supertype=this.flowParseTypeInitialiser(14)),t.impltype=null,n||(t.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(t,"OpaqueType")}flowParseTypeParameterBound(){if(this.match(14)||this.isContextual(81)){const t=this.startNode();return this.next(),t.typeAnnotation=this.flowParseType(),this.finishNode(t,"TypeAnnotation")}}flowParseTypeParameter(t=!1){const n=this.state.startLoc,o=this.startNode(),l=this.flowParseVariance();return o.name=this.flowParseRestrictedIdentifierName(),o.variance=l,o.bound=this.flowParseTypeParameterBound(),this.match(29)?(this.eat(29),o.default=this.flowParseType()):t&&this.raise(j.MissingTypeParamDefault,n),this.finishNode(o,"TypeParameter")}flowParseTypeParameterDeclaration(){const t=this.state.inType,n=this.startNode();n.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let o=!1;do{const l=this.flowParseTypeParameter(o);n.params.push(l),l.default&&(o=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=t,this.finishNode(n,"TypeParameterDeclaration")}flowInTopLevelContext(t){if(this.curContext()!==$.brace){const n=this.state.context;this.state.context=[n[0]];try{return t()}finally{this.state.context=n}}else return t()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){const t=this.startNode(),n=this.state.inType;return this.state.inType=!0,t.params=[],this.flowInTopLevelContext(()=>{this.expect(47);const o=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)t.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=o}),this.state.inType=n,!this.state.inType&&this.curContext()===$.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;const t=this.startNode(),n=this.state.inType;for(t.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)t.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=n,this.finishNode(t,"TypeParameterInstantiation")}flowParseInterfaceType(){const t=this.startNode();if(this.expectContextual(129),t.extends=[],this.eat(81))do t.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return t.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(t,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(t,n,o){return t.static=n,this.lookahead().type===14?(t.id=this.flowParseObjectPropertyKey(),t.key=this.flowParseTypeInitialiser()):(t.id=null,t.key=this.flowParseType()),this.expect(3),t.value=this.flowParseTypeInitialiser(),t.variance=o,this.finishNode(t,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(t,n){return t.static=n,t.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(t.method=!0,t.optional=!1,t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.loc.start))):(t.method=!1,this.eat(17)&&(t.optional=!0),t.value=this.flowParseTypeInitialiser()),this.finishNode(t,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(t){for(t.params=[],t.rest=null,t.typeParameters=null,t.this=null,this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(t.this=this.flowParseFunctionTypeParam(!0),t.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)t.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(t.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(t,n){const o=this.startNode();return t.static=n,t.value=this.flowParseObjectTypeMethodish(o),this.finishNode(t,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:t,allowExact:n,allowSpread:o,allowProto:l,allowInexact:d}){const m=this.state.inType;this.state.inType=!0;const g=this.startNode();g.callProperties=[],g.properties=[],g.indexers=[],g.internalSlots=[];let E,b,x=!1;for(n&&this.match(6)?(this.expect(6),E=9,b=!0):(this.expect(5),E=8,b=!1),g.exact=b;!this.match(E);){let v=!1,M=null,Q=null;const ue=this.startNode();if(l&&this.isContextual(118)){const ce=this.lookahead();ce.type!==14&&ce.type!==17&&(this.next(),M=this.state.startLoc,t=!1)}if(t&&this.isContextual(106)){const ce=this.lookahead();ce.type!==14&&ce.type!==17&&(this.next(),v=!0)}const H=this.flowParseVariance();if(this.eat(0))M!=null&&this.unexpected(M),this.eat(0)?(H&&this.unexpected(H.loc.start),g.internalSlots.push(this.flowParseObjectTypeInternalSlot(ue,v))):g.indexers.push(this.flowParseObjectTypeIndexer(ue,v,H));else if(this.match(10)||this.match(47))M!=null&&this.unexpected(M),H&&this.unexpected(H.loc.start),g.callProperties.push(this.flowParseObjectTypeCallProperty(ue,v));else{let ce="init";if(this.isContextual(99)||this.isContextual(104)){const wt=this.lookahead();Vn(wt.type)&&(ce=this.state.value,this.next())}const $t=this.flowParseObjectTypeProperty(ue,v,M,H,ce,o,d??!b);$t===null?(x=!0,Q=this.state.lastTokStartLoc):g.properties.push($t)}this.flowObjectTypeSemicolon(),Q&&!this.match(8)&&!this.match(9)&&this.raise(j.UnexpectedExplicitInexactInObject,Q)}this.expect(E),o&&(g.inexact=x);const C=this.finishNode(g,"ObjectTypeAnnotation");return this.state.inType=m,C}flowParseObjectTypeProperty(t,n,o,l,d,m,g){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(m?g||this.raise(j.InexactInsideExact,this.state.lastTokStartLoc):this.raise(j.InexactInsideNonObject,this.state.lastTokStartLoc),l&&this.raise(j.InexactVariance,l),null):(m||this.raise(j.UnexpectedSpreadType,this.state.lastTokStartLoc),o!=null&&this.unexpected(o),l&&this.raise(j.SpreadVariance,l),t.argument=this.flowParseType(),this.finishNode(t,"ObjectTypeSpreadProperty"));{t.key=this.flowParseObjectPropertyKey(),t.static=n,t.proto=o!=null,t.kind=d;let E=!1;return this.match(47)||this.match(10)?(t.method=!0,o!=null&&this.unexpected(o),l&&this.unexpected(l.loc.start),t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.loc.start)),(d==="get"||d==="set")&&this.flowCheckGetterSetterParams(t),!m&&t.key.name==="constructor"&&t.value.this&&this.raise(j.ThisParamBannedInConstructor,t.value.this)):(d!=="init"&&this.unexpected(),t.method=!1,this.eat(17)&&(E=!0),t.value=this.flowParseTypeInitialiser(),t.variance=l),t.optional=E,this.finishNode(t,"ObjectTypeProperty")}}flowCheckGetterSetterParams(t){const n=t.kind==="get"?0:1,o=t.value.params.length+(t.value.rest?1:0);t.value.this&&this.raise(t.kind==="get"?j.GetterMayNotHaveThisParam:j.SetterMayNotHaveThisParam,t.value.this),o!==n&&this.raise(t.kind==="get"?S.BadGetterArity:S.BadSetterArity,t),t.kind==="set"&&t.value.rest&&this.raise(S.BadSetterRestParameter,t)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(t,n){t??(t=this.state.startLoc);let o=n||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){const l=this.startNodeAt(t);l.qualification=o,l.id=this.flowParseRestrictedIdentifier(!0),o=this.finishNode(l,"QualifiedTypeIdentifier")}return o}flowParseGenericType(t,n){const o=this.startNodeAt(t);return o.typeParameters=null,o.id=this.flowParseQualifiedTypeIdentifier(t,n),this.match(47)&&(o.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(o,"GenericTypeAnnotation")}flowParseTypeofType(){const t=this.startNode();return this.expect(87),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")}flowParseTupleType(){const t=this.startNode();for(t.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(t.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(t,"TupleTypeAnnotation")}flowParseFunctionTypeParam(t){let n=null,o=!1,l=null;const d=this.startNode(),m=this.lookahead(),g=this.state.type===78;return m.type===14||m.type===17?(g&&!t&&this.raise(j.ThisParamMustBeFirst,d),n=this.parseIdentifier(g),this.eat(17)&&(o=!0,g&&this.raise(j.ThisParamMayNotBeOptional,d)),l=this.flowParseTypeInitialiser()):l=this.flowParseType(),d.name=n,d.optional=o,d.typeAnnotation=l,this.finishNode(d,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(t){const n=this.startNodeAt(t.loc.start);return n.name=null,n.optional=!1,n.typeAnnotation=t,this.finishNode(n,"FunctionTypeParam")}flowParseFunctionTypeParams(t=[]){let n=null,o=null;for(this.match(78)&&(o=this.flowParseFunctionTypeParam(!0),o.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)t.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(n=this.flowParseFunctionTypeParam(!1)),{params:t,rest:n,_this:o}}flowIdentToTypeAnnotation(t,n,o){switch(o.name){case"any":return this.finishNode(n,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(n,"BooleanTypeAnnotation");case"mixed":return this.finishNode(n,"MixedTypeAnnotation");case"empty":return this.finishNode(n,"EmptyTypeAnnotation");case"number":return this.finishNode(n,"NumberTypeAnnotation");case"string":return this.finishNode(n,"StringTypeAnnotation");case"symbol":return this.finishNode(n,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(o.name),this.flowParseGenericType(t,o)}}flowParsePrimaryType(){const t=this.state.startLoc,n=this.startNode();let o,l,d=!1;const m=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,l=this.flowParseTupleType(),this.state.noAnonFunctionType=m,l;case 47:{const g=this.startNode();return g.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),o=this.flowParseFunctionTypeParams(),g.params=o.params,g.rest=o.rest,g.this=o._this,this.expect(11),this.expect(19),g.returnType=this.flowParseType(),this.finishNode(g,"FunctionTypeAnnotation")}case 10:{const g=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if(ie(this.state.type)||this.match(78)){const E=this.lookahead().type;d=E!==17&&E!==14}else d=!0;if(d){if(this.state.noAnonFunctionType=!1,l=this.flowParseType(),this.state.noAnonFunctionType=m,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),l;this.eat(12)}return l?o=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(l)]):o=this.flowParseFunctionTypeParams(),g.params=o.params,g.rest=o.rest,g.this=o._this,this.expect(11),this.expect(19),g.returnType=this.flowParseType(),g.typeParameters=null,this.finishNode(g,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return n.value=this.match(85),this.next(),this.finishNode(n,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",n);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",n);throw this.raise(j.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(n,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(n,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(n,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(n,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(lr(this.state.type)){const g=xt(this.state.type);return this.next(),super.createIdentifier(n,g)}else if(ie(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(t,n,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){const t=this.state.startLoc;let n=this.flowParsePrimaryType(),o=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){const l=this.startNodeAt(t),d=this.eat(18);o=o||d,this.expect(0),!d&&this.match(3)?(l.elementType=n,this.next(),n=this.finishNode(l,"ArrayTypeAnnotation")):(l.objectType=n,l.indexType=this.flowParseType(),this.expect(3),o?(l.optional=d,n=this.finishNode(l,"OptionalIndexedAccessType")):n=this.finishNode(l,"IndexedAccessType"))}return n}flowParsePrefixType(){const t=this.startNode();return this.eat(17)?(t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){const t=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){const n=this.startNodeAt(t.loc.start);return n.params=[this.reinterpretTypeAsFunctionTypeParam(t)],n.rest=null,n.this=null,n.returnType=this.flowParseType(),n.typeParameters=null,this.finishNode(n,"FunctionTypeAnnotation")}return t}flowParseIntersectionType(){const t=this.startNode();this.eat(45);const n=this.flowParseAnonFunctionWithoutParens();for(t.types=[n];this.eat(45);)t.types.push(this.flowParseAnonFunctionWithoutParens());return t.types.length===1?n:this.finishNode(t,"IntersectionTypeAnnotation")}flowParseUnionType(){const t=this.startNode();this.eat(43);const n=this.flowParseIntersectionType();for(t.types=[n];this.eat(43);)t.types.push(this.flowParseIntersectionType());return t.types.length===1?n:this.finishNode(t,"UnionTypeAnnotation")}flowParseType(){const t=this.state.inType;this.state.inType=!0;const n=this.flowParseUnionType();return this.state.inType=t,n}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){const t=this.state.startLoc,n=this.parseIdentifier();return this.flowParseGenericType(t,n)}else return this.flowParseType()}flowParseTypeAnnotation(){const t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(){const t=this.startNode(),n=this.parseIdentifierName();return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),this.createIdentifier(t,n)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.loc.end),t.expression}flowParseVariance(){let t=null;return this.match(53)?(t=this.startNode(),this.state.value==="+"?t.kind="plus":t.kind="minus",this.next(),this.finishNode(t,"Variance")):t}parseFunctionBody(t,n,o=!1){if(n){this.forwardNoArrowParamsConversionAt(t,()=>super.parseFunctionBody(t,!0,o));return}super.parseFunctionBody(t,!1,o)}parseFunctionBodyAndFinish(t,n,o=!1){if(this.match(14)){const l=this.startNode();[l.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),t.returnType=l.typeAnnotation?this.finishNode(l,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(t,n,o)}parseStatementLike(t){if(this.state.strict&&this.isContextual(129)){const o=this.lookahead();if(Je(o.type)){const l=this.startNode();return this.next(),this.flowParseInterface(l)}}else if(this.isContextual(126)){const o=this.startNode();return this.next(),this.flowParseEnumDeclaration(o)}const n=super.parseStatementLike(t);return this.flowPragma===void 0&&!this.isValidDirective(n)&&(this.flowPragma=null),n}parseExpressionStatement(t,n,o){if(n.type==="Identifier"){if(n.name==="declare"){if(this.match(80)||ie(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(t)}else if(ie(this.state.type)){if(n.name==="interface")return this.flowParseInterface(t);if(n.name==="type")return this.flowParseTypeAlias(t);if(n.name==="opaque")return this.flowParseOpaqueType(t,!1)}}return super.parseExpressionStatement(t,n,o)}shouldParseExportDeclaration(){const{type:t}=this.state;return t===126||Gn(t)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:t}=this.state;return t===126||Gn(t)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){const t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDefaultExpression()}parseConditional(t,n,o){if(!this.match(17))return t;if(this.state.maybeInArrowParameters){const C=this.lookaheadCharCode();if(C===44||C===61||C===58||C===41)return this.setOptionalParametersError(o),t}this.expect(17);const l=this.state.clone(),d=this.state.noArrowAt,m=this.startNodeAt(n);let{consequent:g,failed:E}=this.tryParseConditionalConsequent(),[b,x]=this.getArrowLikeExpressions(g);if(E||x.length>0){const C=[...d];if(x.length>0){this.state=l,this.state.noArrowAt=C;for(let v=0;v<x.length;v++)C.push(x[v].start);({consequent:g,failed:E}=this.tryParseConditionalConsequent()),[b,x]=this.getArrowLikeExpressions(g)}E&&b.length>1&&this.raise(j.AmbiguousConditionalArrow,l.startLoc),E&&b.length===1&&(this.state=l,C.push(b[0].start),this.state.noArrowAt=C,{consequent:g,failed:E}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(g,!0),this.state.noArrowAt=d,this.expect(14),m.test=t,m.consequent=g,m.alternate=this.forwardNoArrowParamsConversionAt(m,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(m,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);const t=this.parseMaybeAssignAllowIn(),n=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:t,failed:n}}getArrowLikeExpressions(t,n){const o=[t],l=[];for(;o.length!==0;){const d=o.pop();d.type==="ArrowFunctionExpression"&&d.body.type!=="BlockStatement"?(d.typeParameters||!d.returnType?this.finishArrowValidation(d):l.push(d),o.push(d.body)):d.type==="ConditionalExpression"&&(o.push(d.consequent),o.push(d.alternate))}return n?(l.forEach(d=>this.finishArrowValidation(d)),[l,[]]):xh(l,d=>d.params.every(m=>this.isAssignable(m,!0)))}finishArrowValidation(t){var n;this.toAssignableList(t.params,(n=t.extra)==null?void 0:n.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(t,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(t,n){let o;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),o=n(),this.state.noArrowParamsConversionAt.pop()):o=n(),o}parseParenItem(t,n){const o=super.parseParenItem(t,n);if(this.eat(17)&&(o.optional=!0,this.resetEndLocation(t)),this.match(14)){const l=this.startNodeAt(n);return l.expression=o,l.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(l,"TypeCastExpression")}return o}assertModuleNodeAllowed(t){t.type==="ImportDeclaration"&&(t.importKind==="type"||t.importKind==="typeof")||t.type==="ExportNamedDeclaration"&&t.exportKind==="type"||t.type==="ExportAllDeclaration"&&t.exportKind==="type"||super.assertModuleNodeAllowed(t)}parseExportDeclaration(t){if(this.isContextual(130)){t.exportKind="type";const n=this.startNode();return this.next(),this.match(5)?(t.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(t),null):this.flowParseTypeAlias(n)}else if(this.isContextual(131)){t.exportKind="type";const n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}else if(this.isContextual(129)){t.exportKind="type";const n=this.startNode();return this.next(),this.flowParseInterface(n)}else if(this.isContextual(126)){t.exportKind="value";const n=this.startNode();return this.next(),this.flowParseEnumDeclaration(n)}else return super.parseExportDeclaration(t)}eatExportStar(t){return super.eatExportStar(t)?!0:this.isContextual(130)&&this.lookahead().type===55?(t.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(t){const{startLoc:n}=this.state,o=super.maybeParseExportNamespaceSpecifier(t);return o&&t.exportKind==="type"&&this.unexpected(n),o}parseClassId(t,n,o){super.parseClassId(t,n,o),this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(t,n,o){const{startLoc:l}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(t,n))return;n.declare=!0}super.parseClassMember(t,n,o),n.declare&&(n.type!=="ClassProperty"&&n.type!=="ClassPrivateProperty"&&n.type!=="PropertyDefinition"?this.raise(j.DeclareClassElement,l):n.value&&this.raise(j.DeclareClassFieldInitializer,n.value))}isIterator(t){return t==="iterator"||t==="asyncIterator"}readIterator(){const t=super.readWord1(),n="@@"+t;(!this.isIterator(t)||!this.state.inType)&&this.raise(S.InvalidIdentifier,this.state.curPosition(),{identifierName:n}),this.finishToken(132,n)}getTokenFromCode(t){const n=this.input.charCodeAt(this.state.pos+1);t===123&&n===124?this.finishOp(6,2):this.state.inType&&(t===62||t===60)?this.finishOp(t===62?48:47,1):this.state.inType&&t===63?n===46?this.finishOp(18,2):this.finishOp(17,1):mh(t,n,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(t)}isAssignable(t,n){return t.type==="TypeCastExpression"?this.isAssignable(t.expression,n):super.isAssignable(t,n)}toAssignable(t,n=!1){!n&&t.type==="AssignmentExpression"&&t.left.type==="TypeCastExpression"&&(t.left=this.typeCastToParameter(t.left)),super.toAssignable(t,n)}toAssignableList(t,n,o){for(let l=0;l<t.length;l++){const d=t[l];d?.type==="TypeCastExpression"&&(t[l]=this.typeCastToParameter(d))}super.toAssignableList(t,n,o)}toReferencedList(t,n){for(let l=0;l<t.length;l++){var o;const d=t[l];d&&d.type==="TypeCastExpression"&&!((o=d.extra)!=null&&o.parenthesized)&&(t.length>1||!n)&&this.raise(j.TypeCastInPattern,d.typeAnnotation)}return t}parseArrayLike(t,n,o){const l=super.parseArrayLike(t,n,o);return o!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(l.elements),l}isValidLVal(t,n,o,l){return t==="TypeCastExpression"||super.isValidLVal(t,n,o,l)}parseClassProperty(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(t)}parseClassPrivateProperty(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(t)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(t){return!this.match(14)&&super.isNonstaticConstructor(t)}pushClassMethod(t,n,o,l,d,m){if(n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(t,n,o,l,d,m),n.params&&d){const g=n.params;g.length>0&&this.isThisParam(g[0])&&this.raise(j.ThisParamBannedInConstructor,n)}else if(n.type==="MethodDefinition"&&d&&n.value.params){const g=n.value.params;g.length>0&&this.isThisParam(g[0])&&this.raise(j.ThisParamBannedInConstructor,n)}}pushClassPrivateMethod(t,n,o,l){n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(t,n,o,l)}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass&&(this.match(47)||this.match(51))&&(t.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();const n=t.implements=[];do{const o=this.startNode();o.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?o.typeParameters=this.flowParseTypeParameterInstantiation():o.typeParameters=null,n.push(this.finishNode(o,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(t){super.checkGetterSetterParams(t);const n=this.getObjectOrClassMethodParams(t);if(n.length>0){const o=n[0];this.isThisParam(o)&&t.kind==="get"?this.raise(j.GetterMayNotHaveThisParam,o):this.isThisParam(o)&&this.raise(j.SetterMayNotHaveThisParam,o)}}parsePropertyNamePrefixOperator(t){t.variance=this.flowParseVariance()}parseObjPropValue(t,n,o,l,d,m,g){t.variance&&this.unexpected(t.variance.loc.start),delete t.variance;let E;this.match(47)&&!m&&(E=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());const b=super.parseObjPropValue(t,n,o,l,d,m,g);return E&&((b.value||b).typeParameters=E),b}parseFunctionParamType(t){return this.eat(17)&&(t.type!=="Identifier"&&this.raise(j.PatternIsOptional,t),this.isThisParam(t)&&this.raise(j.ThisParamMayNotBeOptional,t),t.optional=!0),this.match(14)?t.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(t)&&this.raise(j.ThisParamAnnotationRequired,t),this.match(29)&&this.isThisParam(t)&&this.raise(j.ThisParamNoDefault,t),this.resetEndLocation(t),t}parseMaybeDefault(t,n){const o=super.parseMaybeDefault(t,n);return o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start&&this.raise(j.TypeBeforeInitializer,o.typeAnnotation),o}checkImportReflection(t){super.checkImportReflection(t),t.module&&t.importKind!=="value"&&this.raise(j.ImportReflectionHasImportType,t.specifiers[0].loc.start)}parseImportSpecifierLocal(t,n,o){n.local=Xn(t)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(n,o))}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(130)){if(!t)return!0;const n=this.lookaheadCharCode();return n===123||n===42}return!t&&this.isContextual(87)}applyImportPhase(t,n,o,l){if(super.applyImportPhase(t,n,o,l),n){if(!o&&this.match(65))return;t.exportKind=o==="type"?o:"value"}else o==="type"&&this.match(55)&&this.unexpected(),t.importKind=o==="type"||o==="typeof"?o:"value"}parseImportSpecifier(t,n,o,l,d){const m=t.imported;let g=null;m.type==="Identifier"&&(m.name==="type"?g="type":m.name==="typeof"&&(g="typeof"));let E=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){const x=this.parseIdentifier(!0);g!==null&&!Je(this.state.type)?(t.imported=x,t.importKind=g,t.local=this.cloneIdentifier(x)):(t.imported=m,t.importKind=null,t.local=this.parseIdentifier())}else{if(g!==null&&Je(this.state.type))t.imported=this.parseIdentifier(!0),t.importKind=g;else{if(n)throw this.raise(S.ImportBindingIsString,t,{importName:m.value});t.imported=m,t.importKind=null}this.eatContextual(93)?t.local=this.parseIdentifier():(E=!0,t.local=this.cloneIdentifier(t.imported))}const b=Xn(t);return o&&b&&this.raise(j.ImportTypeShorthandOnlyInPureImport,t),(o||b)&&this.checkReservedType(t.local.name,t.local.loc.start,!0),E&&!o&&!b&&this.checkReservedWord(t.local.name,t.loc.start,!0,!0),this.finishImportSpecifier(t,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(t,n){const o=t.kind;o!=="get"&&o!=="set"&&this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(t,n)}parseVarId(t,n){super.parseVarId(t,n),this.match(14)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,n){if(this.match(14)){const o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=o}return super.parseAsyncArrowFromCallExpression(t,n)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(t,n){var o;let l=null,d;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(l=this.state.clone(),d=this.tryParse(()=>super.parseMaybeAssign(t,n),l),!d.error)return d.node;const{context:E}=this.state,b=E[E.length-1];(b===$.j_oTag||b===$.j_expr)&&E.pop()}if((o=d)!=null&&o.error||this.match(47)){var m,g;l=l||this.state.clone();let E;const b=this.tryParse(C=>{var v;E=this.flowParseTypeParameterDeclaration();const M=this.forwardNoArrowParamsConversionAt(E,()=>{const ue=super.parseMaybeAssign(t,n);return this.resetStartLocationFromNode(ue,E),ue});(v=M.extra)!=null&&v.parenthesized&&C();const Q=this.maybeUnwrapTypeCastExpression(M);return Q.type!=="ArrowFunctionExpression"&&C(),Q.typeParameters=E,this.resetStartLocationFromNode(Q,E),M},l);let x=null;if(b.node&&this.maybeUnwrapTypeCastExpression(b.node).type==="ArrowFunctionExpression"){if(!b.error&&!b.aborted)return b.node.async&&this.raise(j.UnexpectedTypeParameterBeforeAsyncArrowFunction,E),b.node;x=b.node}if((m=d)!=null&&m.node)return this.state=d.failState,d.node;if(x)return this.state=b.failState,x;throw(g=d)!=null&&g.thrown?d.error:b.thrown?b.error:this.raise(j.UnexpectedTokenAfterTypeParameter,E)}return super.parseMaybeAssign(t,n)}parseArrow(t){if(this.match(14)){const n=this.tryParse(()=>{const o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;const l=this.startNode();return[l.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=o,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),l});if(n.thrown)return null;n.error&&(this.state=n.failState),t.returnType=n.node.typeAnnotation?this.finishNode(n.node,"TypeAnnotation"):null}return super.parseArrow(t)}shouldParseArrow(t){return this.match(14)||super.shouldParseArrow(t)}setArrowFunctionParameters(t,n){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?t.params=n:super.setArrowFunctionParameters(t,n)}checkParams(t,n,o,l=!0){if(!(o&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))){for(let d=0;d<t.params.length;d++)this.isThisParam(t.params[d])&&d>0&&this.raise(j.ThisParamMustBeFirst,t.params[d]);super.checkParams(t,n,o,l)}}parseParenAndDistinguishExpression(t){return super.parseParenAndDistinguishExpression(t&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(t,n,o){if(t.type==="Identifier"&&t.name==="async"&&this.state.noArrowAt.includes(n.index)){this.next();const l=this.startNodeAt(n);l.callee=t,l.arguments=super.parseCallExpressionArguments(),t=this.finishNode(l,"CallExpression")}else if(t.type==="Identifier"&&t.name==="async"&&this.match(47)){const l=this.state.clone(),d=this.tryParse(g=>this.parseAsyncArrowWithTypeParameters(n)||g(),l);if(!d.error&&!d.aborted)return d.node;const m=this.tryParse(()=>super.parseSubscripts(t,n,o),l);if(m.node&&!m.error)return m.node;if(d.node)return this.state=d.failState,d.node;if(m.node)return this.state=m.failState,m.node;throw d.error||m.error}return super.parseSubscripts(t,n,o)}parseSubscript(t,n,o,l){if(this.match(18)&&this.isLookaheadToken_lt()){if(l.optionalChainMember=!0,o)return l.stop=!0,t;this.next();const d=this.startNodeAt(n);return d.callee=t,d.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),d.arguments=this.parseCallExpressionArguments(),d.optional=!0,this.finishCallExpression(d,!0)}else if(!o&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){const d=this.startNodeAt(n);d.callee=t;const m=this.tryParse(()=>(d.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),d.arguments=super.parseCallExpressionArguments(),l.optionalChainMember&&(d.optional=!1),this.finishCallExpression(d,l.optionalChainMember)));if(m.node)return m.error&&(this.state=m.failState),m.node}return super.parseSubscript(t,n,o,l)}parseNewCallee(t){super.parseNewCallee(t);let n=null;this.shouldParseTypes()&&this.match(47)&&(n=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),t.typeArguments=n}parseAsyncArrowWithTypeParameters(t){const n=this.startNodeAt(t);if(this.parseFunctionParams(n,!1),!!this.parseArrow(n))return super.parseArrowExpression(n,void 0,!0)}readToken_mult_modulo(t){const n=this.input.charCodeAt(this.state.pos+1);if(t===42&&n===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(t)}readToken_pipe_amp(t){const n=this.input.charCodeAt(this.state.pos+1);if(t===124&&n===125){this.finishOp(9,2);return}super.readToken_pipe_amp(t)}parseTopLevel(t,n){const o=super.parseTopLevel(t,n);return this.state.hasFlowComment&&this.raise(j.UnterminatedFlowComment,this.state.curPosition()),o}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(j.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();const t=this.skipFlowComment();t&&(this.state.pos+=t,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){const{pos:t}=this.state;let n=2;for(;[32,9].includes(this.input.charCodeAt(t+n));)n++;const o=this.input.charCodeAt(n+t),l=this.input.charCodeAt(n+t+1);return o===58&&l===58?n+2:this.input.slice(n+t,n+t+12)==="flow-include"?n+12:o===58&&l!==58?n:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(S.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(t,{enumName:n,memberName:o}){this.raise(j.EnumBooleanMemberNotInitialized,t,{memberName:o,enumName:n})}flowEnumErrorInvalidMemberInitializer(t,n){return this.raise(n.explicitType?n.explicitType==="symbol"?j.EnumInvalidMemberInitializerSymbolType:j.EnumInvalidMemberInitializerPrimaryType:j.EnumInvalidMemberInitializerUnknownType,t,n)}flowEnumErrorNumberMemberNotInitialized(t,n){this.raise(j.EnumNumberMemberNotInitialized,t,n)}flowEnumErrorStringMemberInconsistentlyInitialized(t,n){this.raise(j.EnumStringMemberInconsistentlyInitialized,t,n)}flowEnumMemberInit(){const t=this.state.startLoc,n=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{const o=this.parseNumericLiteral(this.state.value);return n()?{type:"number",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}case 134:{const o=this.parseStringLiteral(this.state.value);return n()?{type:"string",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}case 85:case 86:{const o=this.parseBooleanLiteral(this.match(85));return n()?{type:"boolean",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}default:return{type:"invalid",loc:t}}}flowEnumMemberRaw(){const t=this.state.startLoc,n=this.parseIdentifier(!0),o=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:t};return{id:n,init:o}}flowEnumCheckExplicitTypeMismatch(t,n,o){const{explicitType:l}=n;l!==null&&l!==o&&this.flowEnumErrorInvalidMemberInitializer(t,n)}flowEnumMembers({enumName:t,explicitType:n}){const o=new Set,l={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]};let d=!1;for(;!this.match(8);){if(this.eat(21)){d=!0;break}const m=this.startNode(),{id:g,init:E}=this.flowEnumMemberRaw(),b=g.name;if(b==="")continue;/^[a-z]/.test(b)&&this.raise(j.EnumInvalidMemberName,g,{memberName:b,suggestion:b[0].toUpperCase()+b.slice(1),enumName:t}),o.has(b)&&this.raise(j.EnumDuplicateMemberName,g,{memberName:b,enumName:t}),o.add(b);const x={enumName:t,explicitType:n,memberName:b};switch(m.id=g,E.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(E.loc,x,"boolean"),m.init=E.value,l.booleanMembers.push(this.finishNode(m,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(E.loc,x,"number"),m.init=E.value,l.numberMembers.push(this.finishNode(m,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(E.loc,x,"string"),m.init=E.value,l.stringMembers.push(this.finishNode(m,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(E.loc,x);case"none":switch(n){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(E.loc,x);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(E.loc,x);break;default:l.defaultedMembers.push(this.finishNode(m,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:l,hasUnknownMembers:d}}flowEnumStringMembers(t,n,{enumName:o}){if(t.length===0)return n;if(n.length===0)return t;if(n.length>t.length){for(const l of t)this.flowEnumErrorStringMemberInconsistentlyInitialized(l,{enumName:o});return n}else{for(const l of n)this.flowEnumErrorStringMemberInconsistentlyInitialized(l,{enumName:o});return t}}flowEnumParseExplicitType({enumName:t}){if(!this.eatContextual(102))return null;if(!ie(this.state.type))throw this.raise(j.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:t});const{value:n}=this.state;return this.next(),n!=="boolean"&&n!=="number"&&n!=="string"&&n!=="symbol"&&this.raise(j.EnumInvalidExplicitType,this.state.startLoc,{enumName:t,invalidEnumType:n}),n}flowEnumBody(t,n){const o=n.name,l=n.loc.start,d=this.flowEnumParseExplicitType({enumName:o});this.expect(5);const{members:m,hasUnknownMembers:g}=this.flowEnumMembers({enumName:o,explicitType:d});switch(t.hasUnknownMembers=g,d){case"boolean":return t.explicitType=!0,t.members=m.booleanMembers,this.expect(8),this.finishNode(t,"EnumBooleanBody");case"number":return t.explicitType=!0,t.members=m.numberMembers,this.expect(8),this.finishNode(t,"EnumNumberBody");case"string":return t.explicitType=!0,t.members=this.flowEnumStringMembers(m.stringMembers,m.defaultedMembers,{enumName:o}),this.expect(8),this.finishNode(t,"EnumStringBody");case"symbol":return t.members=m.defaultedMembers,this.expect(8),this.finishNode(t,"EnumSymbolBody");default:{const E=()=>(t.members=[],this.expect(8),this.finishNode(t,"EnumStringBody"));t.explicitType=!1;const b=m.booleanMembers.length,x=m.numberMembers.length,C=m.stringMembers.length,v=m.defaultedMembers.length;if(!b&&!x&&!C&&!v)return E();if(!b&&!x)return t.members=this.flowEnumStringMembers(m.stringMembers,m.defaultedMembers,{enumName:o}),this.expect(8),this.finishNode(t,"EnumStringBody");if(!x&&!C&&b>=v){for(const M of m.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(M.loc.start,{enumName:o,memberName:M.id.name});return t.members=m.booleanMembers,this.expect(8),this.finishNode(t,"EnumBooleanBody")}else if(!b&&!C&&x>=v){for(const M of m.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(M.loc.start,{enumName:o,memberName:M.id.name});return t.members=m.numberMembers,this.expect(8),this.finishNode(t,"EnumNumberBody")}else return this.raise(j.EnumInconsistentMemberValues,l,{enumName:o}),E()}}}flowParseEnumDeclaration(t){const n=this.parseIdentifier();return t.id=n,t.body=this.flowEnumBody(this.startNode(),n),this.finishNode(t,"EnumDeclaration")}jsxParseOpeningElementAfterName(t){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(t.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(t)}isLookaheadToken_lt(){const t=this.nextTokenStart();if(this.input.charCodeAt(t)===60){const n=this.input.charCodeAt(t+1);return n!==60&&n!==61}return!1}reScan_lt_gt(){const{type:t}=this.state;t===47?(this.state.pos-=1,this.readToken_lt()):t===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:t}=this.state;return t===51?(this.state.pos-=2,this.finishOp(47,1),47):t}maybeUnwrapTypeCastExpression(t){return t.type==="TypeCastExpression"?t.expression:t}};const wh={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},Ch=/\r\n|[\r\n\u2028\u2029]/,Ws=new RegExp(Ch.source,"g");function Xt(p){switch(p){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function Jn(p,r,t){for(let n=r;n<t;n++)if(Xt(p.charCodeAt(n)))return!0;return!1}const mr=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,yr=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function _h(p){switch(p){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}const Mt=Ce`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:p})=>`Expected corresponding JSX closing tag for <${p}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:p,HTMLEntity:r})=>`Unexpected token \`${p}\`. Did you mean \`${r}\` or \`{'${p}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function At(p){return p?p.type==="JSXOpeningFragment"||p.type==="JSXClosingFragment":!1}function Jt(p){if(p.type==="JSXIdentifier")return p.name;if(p.type==="JSXNamespacedName")return p.namespace.name+":"+p.name.name;if(p.type==="JSXMemberExpression")return Jt(p.object)+"."+Jt(p.property);throw new Error("Node had unexpected type: "+p.type)}var vh=p=>class extends p{jsxReadToken(){let t="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Mt.UnterminatedJsxContent,this.state.startLoc);const o=this.input.charCodeAt(this.state.pos);switch(o){case 60:case 123:if(this.state.pos===this.state.start){o===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(o);return}t+=this.input.slice(n,this.state.pos),this.finishToken(142,t);return;case 38:t+=this.input.slice(n,this.state.pos),t+=this.jsxReadEntity(),n=this.state.pos;break;case 62:case 125:default:Xt(o)?(t+=this.input.slice(n,this.state.pos),t+=this.jsxReadNewLine(!0),n=this.state.pos):++this.state.pos}}}jsxReadNewLine(t){const n=this.input.charCodeAt(this.state.pos);let o;return++this.state.pos,n===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,o=t?`
|
|
42
42
|
`:`\r
|
|
43
|
-
`):o=String.fromCharCode(n),++this.state.curLine,this.state.lineStart=this.state.pos,o}jsxReadString(t){let n="",o=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(S.UnterminatedString,this.state.startLoc);const l=this.input.charCodeAt(this.state.pos);if(l===t)break;l===38?(n+=this.input.slice(o,this.state.pos),n+=this.jsxReadEntity(),o=this.state.pos):qt(l)?(n+=this.input.slice(o,this.state.pos),n+=this.jsxReadNewLine(!1),o=this.state.pos):++this.state.pos}n+=this.input.slice(o,this.state.pos++),this.finishToken(134,n)}jsxReadEntity(){const t=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let n=10;this.codePointAtPos(this.state.pos)===120&&(n=16,++this.state.pos);const o=this.readInt(n,void 0,!1,"bail");if(o!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(o)}else{let n=0,o=!1;for(;n++<10&&this.state.pos<this.length&&!(o=this.codePointAtPos(this.state.pos)===59);)++this.state.pos;if(o){const l=this.input.slice(t,this.state.pos),d=xh[l];if(++this.state.pos,d)return d}}return this.state.pos=t,"&"}jsxReadWord(){let t;const n=this.state.pos;do t=this.input.charCodeAt(++this.state.pos);while(kt(t)||t===45);this.finishToken(141,this.input.slice(n,this.state.pos))}jsxParseIdentifier(){const t=this.startNode();return this.match(141)?t.name=this.state.value:or(this.state.type)?t.name=It(this.state.type):this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")}jsxParseNamespacedName(){const t=this.state.startLoc,n=this.jsxParseIdentifier();if(!this.eat(14))return n;const o=this.startNodeAt(t);return o.namespace=n,o.name=this.jsxParseIdentifier(),this.finishNode(o,"JSXNamespacedName")}jsxParseElementName(){const t=this.state.startLoc;let n=this.jsxParseNamespacedName();if(n.type==="JSXNamespacedName")return n;for(;this.eat(16);){const o=this.startNodeAt(t);o.object=n,o.property=this.jsxParseIdentifier(),n=this.finishNode(o,"JSXMemberExpression")}return n}jsxParseAttributeValue(){let t;switch(this.state.type){case 5:return t=this.startNode(),this.setContext($.brace),this.next(),t=this.jsxParseExpressionContainer(t,$.j_oTag),t.expression.type==="JSXEmptyExpression"&&this.raise(Dt.AttributeIsEmpty,t),t;case 143:case 134:return this.parseExprAtom();default:throw this.raise(Dt.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){const t=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(t){return this.next(),t.expression=this.parseExpression(),this.setContext($.j_expr),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXSpreadChild")}jsxParseExpressionContainer(t,n){if(this.match(8))t.expression=this.jsxParseEmptyExpression();else{const o=this.parseExpression();t.expression=o}return this.setContext(n),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXExpressionContainer")}jsxParseAttribute(){const t=this.startNode();return this.match(5)?(this.setContext($.brace),this.next(),this.expect(21),t.argument=this.parseMaybeAssignAllowIn(),this.setContext($.j_oTag),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXSpreadAttribute")):(t.name=this.jsxParseNamespacedName(),t.value=this.eat(29)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute"))}jsxParseOpeningElementAt(t){const n=this.startNodeAt(t);return this.eat(144)?this.finishNode(n,"JSXOpeningFragment"):(n.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(n))}jsxParseOpeningElementAfterName(t){const n=[];for(;!this.match(56)&&!this.match(144);)n.push(this.jsxParseAttribute());return t.attributes=n,t.selfClosing=this.eat(56),this.expect(144),this.finishNode(t,"JSXOpeningElement")}jsxParseClosingElementAt(t){const n=this.startNodeAt(t);return this.eat(144)?this.finishNode(n,"JSXClosingFragment"):(n.name=this.jsxParseElementName(),this.expect(144),this.finishNode(n,"JSXClosingElement"))}jsxParseElementAt(t){const n=this.startNodeAt(t),o=[],l=this.jsxParseOpeningElementAt(t);let d=null;if(!l.selfClosing){e:for(;;)switch(this.state.type){case 143:if(t=this.state.startLoc,this.next(),this.eat(56)){d=this.jsxParseClosingElementAt(t);break e}o.push(this.jsxParseElementAt(t));break;case 142:o.push(this.parseLiteral(this.state.value,"JSXText"));break;case 5:{const m=this.startNode();this.setContext($.brace),this.next(),this.match(21)?o.push(this.jsxParseSpreadChild(m)):o.push(this.jsxParseExpressionContainer(m,$.j_expr));break}default:this.unexpected()}Pt(l)&&!Pt(d)&&d!==null?this.raise(Dt.MissingClosingTagFragment,d):!Pt(l)&&Pt(d)?this.raise(Dt.MissingClosingTagElement,d,{openingTagName:Yt(l.name)}):!Pt(l)&&!Pt(d)&&Yt(d.name)!==Yt(l.name)&&this.raise(Dt.MissingClosingTagElement,d,{openingTagName:Yt(l.name)})}if(Pt(l)?(n.openingFragment=l,n.closingFragment=d):(n.openingElement=l,n.closingElement=d),n.children=o,this.match(47))throw this.raise(Dt.UnwrappedAdjacentJSXElements,this.state.startLoc);return Pt(l)?this.finishNode(n,"JSXFragment"):this.finishNode(n,"JSXElement")}jsxParseElement(){const t=this.state.startLoc;return this.next(),this.jsxParseElementAt(t)}setContext(t){const{context:n}=this.state;n[n.length-1]=t}parseExprAtom(t){return this.match(143)?this.jsxParseElement():this.match(47)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(143),this.jsxParseElement()):super.parseExprAtom(t)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(t){const n=this.curContext();if(n===$.j_expr){this.jsxReadToken();return}if(n===$.j_oTag||n===$.j_cTag){if(nt(t)){this.jsxReadWord();return}if(t===62){++this.state.pos,this.finishToken(144);return}if((t===34||t===39)&&n===$.j_oTag){this.jsxReadString(t);return}}if(t===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(143);return}super.getTokenFromCode(t)}updateContext(t){const{context:n,type:o}=this.state;if(o===56&&t===143)n.splice(-2,2,$.j_cTag),this.state.canStartJSXElement=!1;else if(o===143)n.push($.j_oTag);else if(o===144){const l=n[n.length-1];l===$.j_oTag&&t===56||l===$.j_cTag?(n.pop(),this.state.canStartJSXElement=n[n.length-1]===$.j_expr):(this.setContext($.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=qu(o)}};class Ah extends hr{constructor(...r){super(...r),this.tsNames=new Map}}class Ch extends pr{constructor(...r){super(...r),this.importsStack=[]}createScope(r){return this.importsStack.push(new Set),new Ah(r)}enter(r){r===1024&&this.importsStack.push(new Set),super.enter(r)}exit(){const r=super.exit();return r===1024&&this.importsStack.pop(),r}hasImport(r,t){const n=this.importsStack.length;if(this.importsStack[n-1].has(r))return!0;if(!t&&n>1){for(let o=0;o<n-1;o++)if(this.importsStack[o].has(r))return!0}return!1}declareName(r,t,n){if(t&4096){this.hasImport(r,!0)&&this.parser.raise(S.VarRedeclaration,n,{identifierName:r}),this.importsStack[this.importsStack.length-1].add(r);return}const o=this.currentScope();let l=o.tsNames.get(r)||0;if(t&1024){this.maybeExportDefined(o,r),o.tsNames.set(r,l|16);return}super.declareName(r,t,n),t&2&&(t&1||(this.checkRedeclarationInScope(o,r,t,n),this.maybeExportDefined(o,r)),l=l|1),t&256&&(l=l|2),t&512&&(l=l|4),t&128&&(l=l|8),l&&o.tsNames.set(r,l)}isRedeclaredInScope(r,t,n){const o=r.tsNames.get(t);if((o&2)>0){if(n&256){const l=!!(n&512),d=(o&4)>0;return l!==d}return!0}return n&128&&(o&8)>0?r.names.get(t)&2?!!(n&1):!1:n&2&&(o&1)>0?!0:super.isRedeclaredInScope(r,t,n)}checkLocalExport(r){const{name:t}=r;if(this.hasImport(t))return;const n=this.scopeStack.length;for(let o=n-1;o>=0;o--){const d=this.scopeStack[o].tsNames.get(t);if((d&1)>0||(d&16)>0)return}super.checkLocalExport(r)}}class vh{constructor(){this.stacks=[]}enter(r){this.stacks.push(r)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}}function Zs(p,r){return(p?2:0)|(r?1:0)}class Nh{constructor(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}sourceToOffsetPos(r){return r+this.startIndex}offsetToSourcePos(r){return r-this.startIndex}hasPlugin(r){if(typeof r=="string")return this.plugins.has(r);{const[t,n]=r;if(!this.hasPlugin(t))return!1;const o=this.plugins.get(t);for(const l of Object.keys(n))if(o?.[l]!==n[l])return!1;return!0}}getPluginOption(r,t){var n;return(n=this.plugins.get(r))==null?void 0:n[t]}}function Yn(p,r){p.trailingComments===void 0?p.trailingComments=r:p.trailingComments.unshift(...r)}function _h(p,r){p.leadingComments===void 0?p.leadingComments=r:p.leadingComments.unshift(...r)}function bs(p,r){p.innerComments===void 0?p.innerComments=r:p.innerComments.unshift(...r)}function Qe(p,r,t){let n=null,o=r.length;for(;n===null&&o>0;)n=r[--o];n===null||n.start>t.start?bs(p,t.comments):Yn(n,t.comments)}class Oh extends Nh{addComment(r){this.filename&&(r.loc.filename=this.filename);const{commentsLen:t}=this.state;this.comments.length!==t&&(this.comments.length=t),this.comments.push(r),this.state.commentsLen++}processComment(r){const{commentStack:t}=this.state,n=t.length;if(n===0)return;let o=n-1;const l=t[o];l.start===r.end&&(l.leadingNode=r,o--);const{start:d}=r;for(;o>=0;o--){const m=t[o],g=m.end;if(g>d)m.containingNode=r,this.finalizeComment(m),t.splice(o,1);else{g===d&&(m.trailingNode=r);break}}}finalizeComment(r){var t;const{comments:n}=r;if(r.leadingNode!==null||r.trailingNode!==null)r.leadingNode!==null&&Yn(r.leadingNode,n),r.trailingNode!==null&&_h(r.trailingNode,n);else{const o=r.containingNode,l=r.start;if(this.input.charCodeAt(this.offsetToSourcePos(l)-1)===44)switch(o.type){case"ObjectExpression":case"ObjectPattern":Qe(o,o.properties,r);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":Qe(o,o.arguments,r);break;case"ImportExpression":Qe(o,[o.source,(t=o.options)!=null?t:null],r);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":Qe(o,o.params,r);break;case"ArrayExpression":case"ArrayPattern":Qe(o,o.elements,r);break;case"ExportNamedDeclaration":case"ImportDeclaration":Qe(o,o.specifiers,r);break;case"TSEnumDeclaration":Qe(o,o.members,r);break;case"TSEnumBody":Qe(o,o.members,r);break;case"TSInterfaceBody":Qe(o,o.body,r);break;default:{if(o.type==="RecordExpression"){Qe(o,o.properties,r);break}if(o.type==="TupleExpression"){Qe(o,o.elements,r);break}bs(o,n)}}else bs(o,n)}}finalizeRemainingComments(){const{commentStack:r}=this.state;for(let t=r.length-1;t>=0;t--)this.finalizeComment(r[t]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(r){const{commentStack:t}=this.state,{length:n}=t;if(n===0)return;const o=t[n-1];o.leadingNode===r&&(o.leadingNode=null)}takeSurroundingComments(r,t,n){const{commentStack:o}=this.state,l=o.length;if(l===0)return;let d=l-1;for(;d>=0;d--){const m=o[d],g=m.end;if(m.start===n)m.leadingNode=r;else if(g===t)m.trailingNode=r;else if(g<t)break}}}class mr{constructor(){this.flags=1024,this.startIndex=void 0,this.curLine=void 0,this.lineStart=void 0,this.startLoc=void 0,this.endLoc=void 0,this.errors=[],this.potentialArrowAt=-1,this.noArrowAt=[],this.noArrowParamsConversionAt=[],this.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null},this.labels=[],this.commentsLen=0,this.commentStack=[],this.pos=0,this.type=140,this.value=null,this.start=0,this.end=0,this.lastTokEndLoc=null,this.lastTokStartLoc=null,this.context=[$.brace],this.firstInvalidTemplateEscapePos=null,this.strictErrors=new Map,this.tokensLength=0}get strict(){return(this.flags&1)>0}set strict(r){r?this.flags|=1:this.flags&=-2}init({strictMode:r,sourceType:t,startIndex:n,startLine:o,startColumn:l}){this.strict=r===!1?!1:r===!0?!0:t==="module",this.startIndex=n,this.curLine=o,this.lineStart=-l,this.startLoc=this.endLoc=new s(o,l,n)}get maybeInArrowParameters(){return(this.flags&2)>0}set maybeInArrowParameters(r){r?this.flags|=2:this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(r){r?this.flags|=4:this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(r){r?this.flags|=8:this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(r){r?this.flags|=16:this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(r){r?this.flags|=32:this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(r){r?this.flags|=64:this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(r){r?this.flags|=128:this.flags&=-129}get soloAwait(){return(this.flags&256)>0}set soloAwait(r){r?this.flags|=256:this.flags&=-257}get inFSharpPipelineDirectBody(){return(this.flags&512)>0}set inFSharpPipelineDirectBody(r){r?this.flags|=512:this.flags&=-513}get canStartJSXElement(){return(this.flags&1024)>0}set canStartJSXElement(r){r?this.flags|=1024:this.flags&=-1025}get containsEsc(){return(this.flags&2048)>0}set containsEsc(r){r?this.flags|=2048:this.flags&=-2049}get hasTopLevelAwait(){return(this.flags&4096)>0}set hasTopLevelAwait(r){r?this.flags|=4096:this.flags&=-4097}curPosition(){return new s(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){const r=new mr;return r.flags=this.flags,r.startIndex=this.startIndex,r.curLine=this.curLine,r.lineStart=this.lineStart,r.startLoc=this.startLoc,r.endLoc=this.endLoc,r.errors=this.errors.slice(),r.potentialArrowAt=this.potentialArrowAt,r.noArrowAt=this.noArrowAt.slice(),r.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),r.topicContext=this.topicContext,r.labels=this.labels.slice(),r.commentsLen=this.commentsLen,r.commentStack=this.commentStack.slice(),r.pos=this.pos,r.type=this.type,r.value=this.value,r.start=this.start,r.end=this.end,r.lastTokEndLoc=this.lastTokEndLoc,r.lastTokStartLoc=this.lastTokStartLoc,r.context=this.context.slice(),r.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,r.strictErrors=this.strictErrors,r.tokensLength=this.tokensLength,r}}var Lh=function(r){return r>=48&&r<=57};const Jn={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},Ws={bin:p=>p===48||p===49,oct:p=>p>=48&&p<=55,dec:p=>p>=48&&p<=57,hex:p=>p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102};function Xn(p,r,t,n,o,l){const d=t,m=n,g=o;let E="",b=null,I=t;const{length:C}=r;for(;;){if(t>=C){l.unterminated(d,m,g),E+=r.slice(I,t);break}const N=r.charCodeAt(t);if(kh(p,N,r,t)){E+=r.slice(I,t);break}if(N===92){E+=r.slice(I,t);const M=Dh(r,t,n,o,p==="template",l);M.ch===null&&!b?b={pos:t,lineStart:n,curLine:o}:E+=M.ch,{pos:t,lineStart:n,curLine:o}=M,I=t}else N===8232||N===8233?(++t,++o,n=t):N===10||N===13?p==="template"?(E+=r.slice(I,t)+`
|
|
44
|
-
`,++t,
|
|
45
|
-
`);case 114:return m("\r");case 120:{let E;return{code:E,pos:r}=yr(p,r,t,n,2,!1,d,l),m(E===null?null:String.fromCharCode(E))}case 117:{let E;return{code:E,pos:r}=ea(p,r,t,n,d,l),m(E===null?null:String.fromCodePoint(E))}case 116:return m(" ");case 98:return m("\b");case 118:return m("\v");case 102:return m("\f");case 13:p.charCodeAt(r)===10&&++r;case 10:t=r,++n;case 8232:case 8233:return m("");case 56:case 57:if(o)return m(null);l.strictNumericEscape(r-1,t,n);default:if(g>=48&&g<=55){const E=r-1;let I=/^[0-7]+/.exec(p.slice(E,r+2))[0],C=parseInt(I,8);C>255&&(I=I.slice(0,-1),C=parseInt(I,8)),r+=I.length-1;const N=p.charCodeAt(r);if(I!=="0"||N===56||N===57){if(o)return m(null);l.strictNumericEscape(E,t,n)}return m(String.fromCharCode(C))}return m(String.fromCharCode(g))}}function yr(p,r,t,n,o,l,d,m){const g=r;let E;return{n:E,pos:r}=Qn(p,r,t,n,16,o,l,!1,m,!d),E===null&&(d?m.invalidEscapeSequence(g,t,n):r=g-1),{code:E,pos:r}}function Qn(p,r,t,n,o,l,d,m,g,E){const b=r,I=o===16?Jn.hex:Jn.decBinOct,C=o===16?Ws.hex:o===10?Ws.dec:o===8?Ws.oct:Ws.bin;let N=!1,M=0;for(let Q=0,le=l??1/0;Q<le;++Q){const H=p.charCodeAt(r);let oe;if(H===95&&m!=="bail"){const Rt=p.charCodeAt(r-1),At=p.charCodeAt(r+1);if(m){if(Number.isNaN(At)||!C(At)||I.has(Rt)||I.has(At)){if(E)return{n:null,pos:r};g.unexpectedNumericSeparator(r,t,n)}}else{if(E)return{n:null,pos:r};g.numericSeparatorInEscapeSequence(r,t,n)}++r;continue}if(H>=97?oe=H-97+10:H>=65?oe=H-65+10:Lh(H)?oe=H-48:oe=1/0,oe>=o){if(oe<=9&&E)return{n:null,pos:r};if(oe<=9&&g.invalidDigit(r,t,n,o))oe=0;else if(d)oe=0,N=!0;else break}++r,M=M*o+oe}return r===b||l!=null&&r-b!==l||N?{n:null,pos:r}:{n:M,pos:r}}function ea(p,r,t,n,o,l){const d=p.charCodeAt(r);let m;if(d===123){if(++r,{code:m,pos:r}=yr(p,r,t,n,p.indexOf("}",r)-r,!0,o,l),++r,m!==null&&m>1114111)if(o)l.invalidCodePoint(r,t,n);else return{code:null,pos:r}}else({code:m,pos:r}=yr(p,r,t,n,4,!1,o,l));return{code:m,pos:r}}function xs(p,r,t){return new s(t,p-r,p)}const Rh=new Set([103,109,115,105,121,117,100,118]);class wt{constructor(r){const t=r.startIndex||0;this.type=r.type,this.value=r.value,this.start=t+r.start,this.end=t+r.end,this.loc=new i(r.startLoc,r.endLoc)}}class Mh extends Oh{constructor(r,t){super(),this.isLookahead=void 0,this.tokens=[],this.errorHandlers_readInt={invalidDigit:(n,o,l,d)=>this.optionFlags&2048?(this.raise(S.InvalidDigit,xs(n,o,l),{radix:d}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(S.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(S.UnexpectedNumericSeparator)},this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(S.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(S.InvalidCodePoint)}),this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(n,o,l)=>{this.recordStrictModeErrors(S.StrictNumericEscape,xs(n,o,l))},unterminated:(n,o,l)=>{throw this.raise(S.UnterminatedString,xs(n-1,o,l))}}),this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(S.StrictNumericEscape),unterminated:(n,o,l)=>{throw this.raise(S.UnterminatedTemplate,xs(n,o,l))}}),this.state=new mr,this.state.init(r),this.input=t,this.length=t.length,this.comments=[],this.isLookahead=!1}pushToken(r){this.tokens.length=this.state.tokensLength,this.tokens.push(r),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&256&&this.pushToken(new wt(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(r){return this.match(r)?(this.next(),!0):!1}match(r){return this.state.type===r}createLookaheadState(r){return{pos:r.pos,value:null,type:r.type,start:r.start,end:r.end,context:[this.curContext()],inType:r.inType,startLoc:r.startLoc,lastTokEndLoc:r.lastTokEndLoc,curLine:r.curLine,lineStart:r.lineStart,curPosition:r.curPosition}}lookahead(){const r=this.state;this.state=this.createLookaheadState(r),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;const t=this.state;return this.state=r,t}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(r){return dr.lastIndex=r,dr.test(this.input)?dr.lastIndex:r}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(r){return this.input.charCodeAt(this.nextTokenStartSince(r))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(r){return fr.lastIndex=r,fr.test(this.input)?fr.lastIndex:r}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(r){let t=this.input.charCodeAt(r);if((t&64512)===55296&&++r<this.input.length){const n=this.input.charCodeAt(r);(n&64512)===56320&&(t=65536+((t&1023)<<10)+(n&1023))}return t}setStrict(r){this.state.strict=r,r&&(this.state.strictErrors.forEach(([t,n])=>this.raise(t,n)),this.state.strictErrors.clear())}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){if(this.skipSpace(),this.state.start=this.state.pos,this.isLookahead||(this.state.startLoc=this.state.curPosition()),this.state.pos>=this.length){this.finishToken(140);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(r){let t;this.isLookahead||(t=this.state.curPosition());const n=this.state.pos,o=this.input.indexOf(r,n+2);if(o===-1)throw this.raise(S.UnterminatedComment,this.state.curPosition());for(this.state.pos=o+r.length,Hs.lastIndex=n+2;Hs.test(this.input)&&Hs.lastIndex<=o;)++this.state.curLine,this.state.lineStart=Hs.lastIndex;if(this.isLookahead)return;const l={type:"CommentBlock",value:this.input.slice(n+2,o),start:this.sourceToOffsetPos(n),end:this.sourceToOffsetPos(o+r.length),loc:new i(t,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(l),l}skipLineComment(r){const t=this.state.pos;let n;this.isLookahead||(n=this.state.curPosition());let o=this.input.charCodeAt(this.state.pos+=r);if(this.state.pos<this.length)for(;!qt(o)&&++this.state.pos<this.length;)o=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;const l=this.state.pos,m={type:"CommentLine",value:this.input.slice(t+r,l),start:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(l),loc:new i(n,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(m),m}skipSpace(){const r=this.state.pos,t=this.optionFlags&4096?[]:null;e:for(;this.state.pos<this.length;){const n=this.input.charCodeAt(this.state.pos);switch(n){case 32:case 160:case 9:++this.state.pos;break;case 13:this.input.charCodeAt(this.state.pos+1)===10&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:{const o=this.skipBlockComment("*/");o!==void 0&&(this.addComment(o),t?.push(o));break}case 47:{const o=this.skipLineComment(2);o!==void 0&&(this.addComment(o),t?.push(o));break}default:break e}break;default:if(Ph(n))++this.state.pos;else if(n===45&&!this.inModule&&this.optionFlags&8192){const o=this.state.pos;if(this.input.charCodeAt(o+1)===45&&this.input.charCodeAt(o+2)===62&&(r===0||this.state.lineStart>r)){const l=this.skipLineComment(3);l!==void 0&&(this.addComment(l),t?.push(l))}else break e}else if(n===60&&!this.inModule&&this.optionFlags&8192){const o=this.state.pos;if(this.input.charCodeAt(o+1)===33&&this.input.charCodeAt(o+2)===45&&this.input.charCodeAt(o+3)===45){const l=this.skipLineComment(4);l!==void 0&&(this.addComment(l),t?.push(l))}else break e}else break e}}if(t?.length>0){const n=this.state.pos,o={start:this.sourceToOffsetPos(r),end:this.sourceToOffsetPos(n),comments:t,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(o)}}finishToken(r,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();const n=this.state.type;this.state.type=r,this.state.value=t,this.isLookahead||this.updateContext(n)}replaceToken(r){this.state.type=r,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;const r=this.state.pos+1,t=this.codePointAtPos(r);if(t>=48&&t<=57)throw this.raise(S.UnexpectedDigitAfterHash,this.state.curPosition());if(t===123||t===91&&this.hasPlugin("recordAndTuple")){if(this.expectPlugin("recordAndTuple"),this.getPluginOption("recordAndTuple","syntaxType")==="bar")throw this.raise(t===123?S.RecordExpressionHashIncorrectStartSyntaxType:S.TupleExpressionHashIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,t===123?this.finishToken(7):this.finishToken(1)}else nt(t)?(++this.state.pos,this.finishToken(139,this.readWord1(t))):t===92?(++this.state.pos,this.finishToken(139,this.readWord1())):this.finishOp(27,1)}readToken_dot(){const r=this.input.charCodeAt(this.state.pos+1);if(r>=48&&r<=57){this.readNumber(!0);return}r===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(31,2):this.finishOp(56,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let r=this.input.charCodeAt(this.state.pos+1);if(r!==33)return!1;const t=this.state.pos;for(this.state.pos+=1;!qt(r)&&++this.state.pos<this.length;)r=this.input.charCodeAt(this.state.pos);const n=this.input.slice(t+2,this.state.pos);return this.finishToken(28,n),!0}readToken_mult_modulo(r){let t=r===42?55:54,n=1,o=this.input.charCodeAt(this.state.pos+1);r===42&&o===42&&(n++,o=this.input.charCodeAt(this.state.pos+2),t=57),o===61&&!this.state.inType&&(n++,t=r===37?33:30),this.finishOp(t,n)}readToken_pipe_amp(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===r){this.input.charCodeAt(this.state.pos+2)===61?this.finishOp(30,3):this.finishOp(r===124?41:42,2);return}if(r===124){if(t===62){this.finishOp(39,2);return}if(this.hasPlugin("recordAndTuple")&&t===125){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.RecordExpressionBarIncorrectEndSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(9);return}if(this.hasPlugin("recordAndTuple")&&t===93){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.TupleExpressionBarIncorrectEndSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(4);return}}if(t===61){this.finishOp(30,2);return}this.finishOp(r===124?43:45,1)}readToken_caret(){const r=this.input.charCodeAt(this.state.pos+1);r===61&&!this.state.inType?this.finishOp(32,2):r===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])?(this.finishOp(37,2),this.input.codePointAt(this.state.pos)===94&&this.unexpected()):this.finishOp(44,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])?this.finishOp(38,2):this.finishOp(26,1)}readToken_plus_min(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===r){this.finishOp(34,2);return}t===61?this.finishOp(30,2):this.finishOp(53,1)}readToken_lt(){const{pos:r}=this.state,t=this.input.charCodeAt(r+1);if(t===60){if(this.input.charCodeAt(r+2)===61){this.finishOp(30,3);return}this.finishOp(51,2);return}if(t===61){this.finishOp(49,2);return}this.finishOp(47,1)}readToken_gt(){const{pos:r}=this.state,t=this.input.charCodeAt(r+1);if(t===62){const n=this.input.charCodeAt(r+2)===62?3:2;if(this.input.charCodeAt(r+n)===61){this.finishOp(30,n+1);return}this.finishOp(52,n);return}if(t===61){this.finishOp(49,2);return}this.finishOp(48,1)}readToken_eq_excl(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===61){this.finishOp(46,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(r===61&&t===62){this.state.pos+=2,this.finishToken(19);return}this.finishOp(r===61?29:35,1)}readToken_question(){const r=this.input.charCodeAt(this.state.pos+1),t=this.input.charCodeAt(this.state.pos+2);r===63?t===61?this.finishOp(30,3):this.finishOp(40,2):r===46&&!(t>=48&&t<=57)?(this.state.pos+=2,this.finishToken(18)):(++this.state.pos,this.finishToken(17))}getTokenFromCode(r){switch(r){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(10);return;case 41:++this.state.pos,this.finishToken(11);return;case 59:++this.state.pos,this.finishToken(13);return;case 44:++this.state.pos,this.finishToken(12);return;case 91:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.TupleExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(2)}else++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(3);return;case 123:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.RecordExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(6)}else++this.state.pos,this.finishToken(5);return;case 125:++this.state.pos,this.finishToken(8);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(15,2):(++this.state.pos,this.finishToken(14));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{const t=this.input.charCodeAt(this.state.pos+1);if(t===120||t===88){this.readRadixNumber(16);return}if(t===111||t===79){this.readRadixNumber(8);return}if(t===98||t===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(!1);return;case 34:case 39:this.readString(r);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(r);return;case 124:case 38:this.readToken_pipe_amp(r);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(r);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(r);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(nt(r)){this.readWord(r);return}}throw this.raise(S.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(r)})}finishOp(r,t){const n=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t,this.finishToken(r,n)}readRegexp(){const r=this.state.startLoc,t=this.state.start+1;let n,o,{pos:l}=this.state;for(;;++l){if(l>=this.length)throw this.raise(S.UnterminatedRegExp,a(r,1));const E=this.input.charCodeAt(l);if(qt(E))throw this.raise(S.UnterminatedRegExp,a(r,1));if(n)n=!1;else{if(E===91)o=!0;else if(E===93&&o)o=!1;else if(E===47&&!o)break;n=E===92}}const d=this.input.slice(t,l);++l;let m="";const g=()=>a(r,l+2-t);for(;l<this.length;){const E=this.codePointAtPos(l),b=String.fromCharCode(E);if(Rh.has(E))E===118?m.includes("u")&&this.raise(S.IncompatibleRegExpUVFlags,g()):E===117&&m.includes("v")&&this.raise(S.IncompatibleRegExpUVFlags,g()),m.includes(b)&&this.raise(S.DuplicateRegExpFlags,g());else if(kt(E)||E===92)this.raise(S.MalformedRegExpFlags,g());else break;++l,m+=b}this.state.pos=l,this.finishToken(138,{pattern:d,flags:m})}readInt(r,t,n=!1,o=!0){const{n:l,pos:d}=Qn(this.input,this.state.pos,this.state.lineStart,this.state.curLine,r,t,n,o,this.errorHandlers_readInt,!1);return this.state.pos=d,l}readRadixNumber(r){const t=this.state.pos,n=this.state.curPosition();let o=!1;this.state.pos+=2;const l=this.readInt(r);l==null&&this.raise(S.InvalidDigit,a(n,2),{radix:r});const d=this.input.charCodeAt(this.state.pos);if(d===110)++this.state.pos,o=!0;else if(d===109)throw this.raise(S.InvalidDecimal,n);if(nt(this.codePointAtPos(this.state.pos)))throw this.raise(S.NumberIdentifier,this.state.curPosition());if(o){const m=this.input.slice(t,this.state.pos).replace(/[_n]/g,"");this.finishToken(136,m);return}this.finishToken(135,l)}readNumber(r){const t=this.state.pos,n=this.state.curPosition();let o=!1,l=!1,d=!1,m=!1;!r&&this.readInt(10)===null&&this.raise(S.InvalidNumber,this.state.curPosition());const g=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(g){const N=this.input.slice(t,this.state.pos);if(this.recordStrictModeErrors(S.StrictOctalLiteral,n),!this.state.strict){const M=N.indexOf("_");M>0&&this.raise(S.ZeroDigitNumericSeparator,a(n,M))}m=g&&!/[89]/.test(N)}let E=this.input.charCodeAt(this.state.pos);if(E===46&&!m&&(++this.state.pos,this.readInt(10),o=!0,E=this.input.charCodeAt(this.state.pos)),(E===69||E===101)&&!m&&(E=this.input.charCodeAt(++this.state.pos),(E===43||E===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(S.InvalidOrMissingExponent,n),o=!0,d=!0,E=this.input.charCodeAt(this.state.pos)),E===110&&((o||g)&&this.raise(S.InvalidBigIntLiteral,n),++this.state.pos,l=!0),E===109){this.expectPlugin("decimal",this.state.curPosition()),(d||g)&&this.raise(S.InvalidDecimal,n),++this.state.pos;var b=!0}if(nt(this.codePointAtPos(this.state.pos)))throw this.raise(S.NumberIdentifier,this.state.curPosition());const I=this.input.slice(t,this.state.pos).replace(/[_mn]/g,"");if(l){this.finishToken(136,I);return}if(b){this.finishToken(137,I);return}const C=m?parseInt(I,8):parseFloat(I);this.finishToken(135,C)}readCodePoint(r){const{code:t,pos:n}=ea(this.input,this.state.pos,this.state.lineStart,this.state.curLine,r,this.errorHandlers_readCodePoint);return this.state.pos=n,t}readString(r){const{str:t,pos:n,curLine:o,lineStart:l}=Xn(r===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=n+1,this.state.lineStart=l,this.state.curLine=o,this.finishToken(134,t)}readTemplateContinuation(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()}readTemplateToken(){const r=this.input[this.state.pos],{str:t,firstInvalidLoc:n,pos:o,curLine:l,lineStart:d}=Xn("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=o+1,this.state.lineStart=d,this.state.curLine=l,n&&(this.state.firstInvalidTemplateEscapePos=new s(n.curLine,n.pos-n.lineStart,this.sourceToOffsetPos(n.pos))),this.input.codePointAt(o)===96?this.finishToken(24,n?null:r+t+"`"):(this.state.pos++,this.finishToken(25,n?null:r+t+"${"))}recordStrictModeErrors(r,t){const n=t.index;this.state.strict&&!this.state.strictErrors.has(n)?this.raise(r,t):this.state.strictErrors.set(n,[r,t])}readWord1(r){this.state.containsEsc=!1;let t="";const n=this.state.pos;let o=this.state.pos;for(r!==void 0&&(this.state.pos+=r<=65535?1:2);this.state.pos<this.length;){const l=this.codePointAtPos(this.state.pos);if(kt(l))this.state.pos+=l<=65535?1:2;else if(l===92){this.state.containsEsc=!0,t+=this.input.slice(o,this.state.pos);const d=this.state.curPosition(),m=this.state.pos===n?nt:kt;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(S.MissingUnicodeEscape,this.state.curPosition()),o=this.state.pos-1;continue}++this.state.pos;const g=this.readCodePoint(!0);g!==null&&(m(g)||this.raise(S.EscapedCharNotAnIdentifier,d),t+=String.fromCodePoint(g)),o=this.state.pos}else break}return t+this.input.slice(o,this.state.pos)}readWord(r){const t=this.readWord1(r),n=tr.get(t);n!==void 0?this.finishToken(n,It(n)):this.finishToken(132,t)}checkKeywordEscapes(){const{type:r}=this.state;or(r)&&this.state.containsEsc&&this.raise(S.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:It(r)})}raise(r,t,n={}){const o=t instanceof s?t:t.loc.start,l=r(o,n);if(!(this.optionFlags&2048))throw l;return this.isLookahead||this.state.errors.push(l),l}raiseOverwrite(r,t,n={}){const o=t instanceof s?t:t.loc.start,l=o.index,d=this.state.errors;for(let m=d.length-1;m>=0;m--){const g=d[m];if(g.loc.index===l)return d[m]=r(o,n);if(g.loc.index<l)break}return this.raise(r,t,n)}updateContext(r){}unexpected(r,t){throw this.raise(S.UnexpectedToken,r??this.state.startLoc,{expected:t?It(t):null})}expectPlugin(r,t){if(this.hasPlugin(r))return!0;throw this.raise(S.MissingPlugin,t??this.state.startLoc,{missingPlugin:[r]})}expectOnePlugin(r){if(!r.some(t=>this.hasPlugin(t)))throw this.raise(S.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:r})}errorBuilder(r){return(t,n,o)=>{this.raise(r,xs(t,n,o))}}}class $h{constructor(){this.privateNames=new Set,this.loneAccessors=new Map,this.undefinedPrivateNames=new Map}}class Fh{constructor(r){this.parser=void 0,this.stack=[],this.undefinedPrivateNames=new Map,this.parser=r}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new $h)}exit(){const r=this.stack.pop(),t=this.current();for(const[n,o]of Array.from(r.undefinedPrivateNames))t?t.undefinedPrivateNames.has(n)||t.undefinedPrivateNames.set(n,o):this.parser.raise(S.InvalidPrivateFieldResolution,o,{identifierName:n})}declarePrivateName(r,t,n){const{privateNames:o,loneAccessors:l,undefinedPrivateNames:d}=this.current();let m=o.has(r);if(t&3){const g=m&&l.get(r);if(g){const E=g&4,b=t&4,I=g&3,C=t&3;m=I===C||E!==b,m||l.delete(r)}else m||l.set(r,t)}m&&this.parser.raise(S.PrivateNameRedeclaration,n,{identifierName:r}),o.add(r),d.delete(r)}usePrivateName(r,t){let n;for(n of this.stack)if(n.privateNames.has(r))return;n?n.undefinedPrivateNames.set(r,t):this.parser.raise(S.InvalidPrivateFieldResolution,t,{identifierName:r})}}class Ks{constructor(r=0){this.type=r}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}}class ta extends Ks{constructor(r){super(r),this.declarationErrors=new Map}recordDeclarationError(r,t){const n=t.index;this.declarationErrors.set(n,[r,t])}clearDeclarationError(r){this.declarationErrors.delete(r)}iterateErrors(r){this.declarationErrors.forEach(r)}}class Bh{constructor(r){this.parser=void 0,this.stack=[new Ks],this.parser=r}enter(r){this.stack.push(r)}exit(){this.stack.pop()}recordParameterInitializerError(r,t){const n=t.loc.start,{stack:o}=this;let l=o.length-1,d=o[l];for(;!d.isCertainlyParameterDeclaration();){if(d.canBeArrowParameterDeclaration())d.recordDeclarationError(r,n);else return;d=o[--l]}this.parser.raise(r,n)}recordArrowParameterBindingError(r,t){const{stack:n}=this,o=n[n.length-1],l=t.loc.start;if(o.isCertainlyParameterDeclaration())this.parser.raise(r,l);else if(o.canBeArrowParameterDeclaration())o.recordDeclarationError(r,l);else return}recordAsyncArrowParametersError(r){const{stack:t}=this;let n=t.length-1,o=t[n];for(;o.canBeArrowParameterDeclaration();)o.type===2&&o.recordDeclarationError(S.AwaitBindingIdentifier,r),o=t[--n]}validateAsPattern(){const{stack:r}=this,t=r[r.length-1];t.canBeArrowParameterDeclaration()&&t.iterateErrors(([n,o])=>{this.parser.raise(n,o);let l=r.length-2,d=r[l];for(;d.canBeArrowParameterDeclaration();)d.clearDeclarationError(o.index),d=r[--l]})}}function Uh(){return new Ks(3)}function jh(){return new ta(1)}function zh(){return new ta(2)}function sa(){return new Ks}class Vh extends Mh{addExtra(r,t,n,o=!0){if(!r)return;let{extra:l}=r;l==null&&(l={},r.extra=l),o?l[t]=n:Object.defineProperty(l,t,{enumerable:o,value:n})}isContextual(r){return this.state.type===r&&!this.state.containsEsc}isUnparsedContextual(r,t){if(this.input.startsWith(t,r)){const n=this.input.charCodeAt(r+t.length);return!(kt(n)||(n&64512)===55296)}return!1}isLookaheadContextual(r){const t=this.nextTokenStart();return this.isUnparsedContextual(t,r)}eatContextual(r){return this.isContextual(r)?(this.next(),!0):!1}expectContextual(r,t){if(!this.eatContextual(r)){if(t!=null)throw this.raise(t,this.state.startLoc);this.unexpected(null,r)}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return qn(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return qn(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(r=!0){(r?this.isLineTerminator():this.eat(13))||this.raise(S.MissingSemicolon,this.state.lastTokEndLoc)}expect(r,t){this.eat(r)||this.unexpected(t,r)}tryParse(r,t=this.state.clone()){const n={node:null};try{const o=r((l=null)=>{throw n.node=l,n});if(this.state.errors.length>t.errors.length){const l=this.state;return this.state=t,this.state.tokensLength=l.tokensLength,{node:o,error:l.errors[t.errors.length],thrown:!1,aborted:!1,failState:l}}return{node:o,error:null,thrown:!1,aborted:!1,failState:null}}catch(o){const l=this.state;if(this.state=t,o instanceof SyntaxError)return{node:null,error:o,thrown:!0,aborted:!1,failState:l};if(o===n)return{node:n.node,error:null,thrown:!1,aborted:!0,failState:l};throw o}}checkExpressionErrors(r,t){if(!r)return!1;const{shorthandAssignLoc:n,doubleProtoLoc:o,privateKeyLoc:l,optionalParametersLoc:d,voidPatternLoc:m}=r,g=!!n||!!o||!!d||!!l||!!m;if(!t)return g;n!=null&&this.raise(S.InvalidCoverInitializedName,n),o!=null&&this.raise(S.DuplicateProto,o),l!=null&&this.raise(S.UnexpectedPrivateField,l),d!=null&&this.unexpected(d),m!=null&&this.raise(S.InvalidCoverDiscardElement,m)}isLiteralPropertyName(){return Un(this.state.type)}isPrivateName(r){return r.type==="PrivateName"}getPrivateNameSV(r){return r.id.name}hasPropertyAsPrivateName(r){return(r.type==="MemberExpression"||r.type==="OptionalMemberExpression")&&this.isPrivateName(r.property)}isObjectProperty(r){return r.type==="ObjectProperty"}isObjectMethod(r){return r.type==="ObjectMethod"}initializeScopes(r=this.options.sourceType==="module"){const t=this.state.labels;this.state.labels=[];const n=this.exportedIdentifiers;this.exportedIdentifiers=new Set;const o=this.inModule;this.inModule=r;const l=this.scope,d=this.getScopeHandler();this.scope=new d(this,r);const m=this.prodParam;this.prodParam=new vh;const g=this.classScope;this.classScope=new Fh(this);const E=this.expressionScope;return this.expressionScope=new Bh(this),()=>{this.state.labels=t,this.exportedIdentifiers=n,this.inModule=o,this.scope=l,this.prodParam=m,this.classScope=g,this.expressionScope=E}}enterInitialScopes(){let r=0;(this.inModule||this.optionFlags&1)&&(r|=2),this.optionFlags&32&&(r|=1);const t=!this.inModule&&this.options.sourceType==="commonjs";(t||this.optionFlags&2)&&(r|=4),this.prodParam.enter(r);let n=t?514:1;this.optionFlags&4&&(n|=512),this.scope.enter(n)}checkDestructuringPrivate(r){const{privateKeyLoc:t}=r;t!==null&&this.expectPlugin("destructuringPrivate",t)}}class qs{constructor(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null,this.voidPatternLoc=null}}class Ys{constructor(r,t,n){this.type="",this.start=t,this.end=0,this.loc=new i(n),r?.optionFlags&128&&(this.range=[t,0]),r!=null&&r.filename&&(this.loc.filename=r.filename)}}const gr=Ys.prototype;gr.__clone=function(){const p=new Ys(void 0,this.start,this.loc.start),r=Object.keys(this);for(let t=0,n=r.length;t<n;t++){const o=r[t];o!=="leadingComments"&&o!=="trailingComments"&&o!=="innerComments"&&(p[o]=this[o])}return p};class Gh extends Vh{startNode(){const r=this.state.startLoc;return new Ys(this,r.index,r)}startNodeAt(r){return new Ys(this,r.index,r)}startNodeAtNode(r){return this.startNodeAt(r.loc.start)}finishNode(r,t){return this.finishNodeAt(r,t,this.state.lastTokEndLoc)}finishNodeAt(r,t,n){return r.type=t,r.end=n.index,r.loc.end=n,this.optionFlags&128&&(r.range[1]=n.index),this.optionFlags&4096&&this.processComment(r),r}resetStartLocation(r,t){r.start=t.index,r.loc.start=t,this.optionFlags&128&&(r.range[0]=t.index)}resetEndLocation(r,t=this.state.lastTokEndLoc){r.end=t.index,r.loc.end=t,this.optionFlags&128&&(r.range[1]=t.index)}resetStartLocationFromNode(r,t){this.resetStartLocation(r,t.loc.start)}castNodeTo(r,t){return r.type=t,r}cloneIdentifier(r){const{type:t,start:n,end:o,loc:l,range:d,name:m}=r,g=Object.create(gr);return g.type=t,g.start=n,g.end=o,g.loc=l,g.range=d,g.name=m,r.extra&&(g.extra=r.extra),g}cloneStringLiteral(r){const{type:t,start:n,end:o,loc:l,range:d,extra:m}=r,g=Object.create(gr);return g.type=t,g.start=n,g.end=o,g.loc=l,g.range=d,g.extra=m,g.value=r.value,g}}const Er=p=>p.type==="ParenthesizedExpression"?Er(p.expression):p;class Hh extends Gh{toAssignable(r,t=!1){var n,o;let l;switch((r.type==="ParenthesizedExpression"||(n=r.extra)!=null&&n.parenthesized)&&(l=Er(r),t?l.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(S.InvalidParenthesizedAssignment,r):l.type!=="CallExpression"&&l.type!=="MemberExpression"&&!this.isOptionalMemberExpression(l)&&this.raise(S.InvalidParenthesizedAssignment,r):this.raise(S.InvalidParenthesizedAssignment,r)),r.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(r,"ObjectPattern");for(let m=0,g=r.properties.length,E=g-1;m<g;m++){var d;const b=r.properties[m],I=m===E;this.toAssignableObjectExpressionProp(b,I,t),I&&b.type==="RestElement"&&(d=r.extra)!=null&&d.trailingCommaLoc&&this.raise(S.RestTrailingComma,r.extra.trailingCommaLoc)}break;case"ObjectProperty":{const{key:m,value:g}=r;this.isPrivateName(m)&&this.classScope.usePrivateName(this.getPrivateNameSV(m),m.loc.start),this.toAssignable(g,t);break}case"SpreadElement":throw new Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");case"ArrayExpression":this.castNodeTo(r,"ArrayPattern"),this.toAssignableList(r.elements,(o=r.extra)==null?void 0:o.trailingCommaLoc,t);break;case"AssignmentExpression":r.operator!=="="&&this.raise(S.MissingEqInAssignment,r.left.loc.end),this.castNodeTo(r,"AssignmentPattern"),delete r.operator,r.left.type==="VoidPattern"&&this.raise(S.VoidPatternInitializer,r.left),this.toAssignable(r.left,t);break;case"ParenthesizedExpression":this.toAssignable(l,t);break}}toAssignableObjectExpressionProp(r,t,n){if(r.type==="ObjectMethod")this.raise(r.kind==="get"||r.kind==="set"?S.PatternHasAccessor:S.PatternHasMethod,r.key);else if(r.type==="SpreadElement"){this.castNodeTo(r,"RestElement");const o=r.argument;this.checkToRestConversion(o,!1),this.toAssignable(o,n),t||this.raise(S.RestTrailingComma,r)}else this.toAssignable(r,n)}toAssignableList(r,t,n){const o=r.length-1;for(let l=0;l<=o;l++){const d=r[l];d&&(this.toAssignableListItem(r,l,n),d.type==="RestElement"&&(l<o?this.raise(S.RestTrailingComma,d):t&&this.raise(S.RestTrailingComma,t)))}}toAssignableListItem(r,t,n){const o=r[t];if(o.type==="SpreadElement"){this.castNodeTo(o,"RestElement");const l=o.argument;this.checkToRestConversion(l,!0),this.toAssignable(l,n)}else this.toAssignable(o,n)}isAssignable(r,t){switch(r.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":return!0;case"ObjectExpression":{const n=r.properties.length-1;return r.properties.every((o,l)=>o.type!=="ObjectMethod"&&(l===n||o.type!=="SpreadElement")&&this.isAssignable(o))}case"ObjectProperty":return this.isAssignable(r.value);case"SpreadElement":return this.isAssignable(r.argument);case"ArrayExpression":return r.elements.every(n=>n===null||this.isAssignable(n));case"AssignmentExpression":return r.operator==="=";case"ParenthesizedExpression":return this.isAssignable(r.expression);case"MemberExpression":case"OptionalMemberExpression":return!t;default:return!1}}toReferencedList(r,t){return r}toReferencedListDeep(r,t){this.toReferencedList(r,t);for(const n of r)n?.type==="ArrayExpression"&&this.toReferencedListDeep(n.elements)}parseSpread(r){const t=this.startNode();return this.next(),t.argument=this.parseMaybeAssignAllowIn(r,void 0),this.finishNode(t,"SpreadElement")}parseRestBinding(){const r=this.startNode();this.next();const t=this.parseBindingAtom();return t.type==="VoidPattern"&&this.raise(S.UnexpectedVoidPattern,t),r.argument=t,this.finishNode(r,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{const r=this.startNode();return this.next(),r.elements=this.parseBindingList(3,93,1),this.finishNode(r,"ArrayPattern")}case 5:return this.parseObjectLike(8,!0);case 88:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(r,t,n){const o=n&1,l=[];let d=!0;for(;!this.eat(r);)if(d?d=!1:this.expect(12),o&&this.match(12))l.push(null);else{if(this.eat(r))break;if(this.match(21)){let m=this.parseRestBinding();if((this.hasPlugin("flow")||n&2)&&(m=this.parseFunctionParamType(m)),l.push(m),!this.checkCommaAfterRest(t)){this.expect(r);break}}else{const m=[];if(n&2)for(this.match(26)&&this.hasPlugin("decorators")&&this.raise(S.UnsupportedParameterDecorator,this.state.startLoc);this.match(26);)m.push(this.parseDecorator());l.push(this.parseBindingElement(n,m))}}return l}parseBindingRestProperty(r){return this.next(),this.hasPlugin("discardBinding")&&this.match(88)?(r.argument=this.parseVoidPattern(null),this.raise(S.UnexpectedVoidPattern,r.argument)):r.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(r,"RestElement")}parseBindingProperty(){const{type:r,startLoc:t}=this.state;if(r===21)return this.parseBindingRestProperty(this.startNode());const n=this.startNode();return r===139?(this.expectPlugin("destructuringPrivate",t),this.classScope.usePrivateName(this.state.value,t),n.key=this.parsePrivateName()):this.parsePropertyName(n),n.method=!1,this.parseObjPropValue(n,t,!1,!1,!0,!1)}parseBindingElement(r,t){const n=this.parseMaybeDefault();return(this.hasPlugin("flow")||r&2)&&this.parseFunctionParamType(n),t.length&&(n.decorators=t,this.resetStartLocationFromNode(n,t[0])),this.parseMaybeDefault(n.loc.start,n)}parseFunctionParamType(r){return r}parseMaybeDefault(r,t){if(r??(r=this.state.startLoc),t=t??this.parseBindingAtom(),!this.eat(29))return t;const n=this.startNodeAt(r);return t.type==="VoidPattern"&&this.raise(S.VoidPatternInitializer,t),n.left=t,n.right=this.parseMaybeAssignAllowIn(),this.finishNode(n,"AssignmentPattern")}isValidLVal(r,t,n,o){switch(r){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";case"VoidPattern":return!0;case"CallExpression":if(!t&&!this.state.strict&&this.optionFlags&8192)return!0}return!1}isOptionalMemberExpression(r){return r.type==="OptionalMemberExpression"}checkLVal(r,t,n=64,o=!1,l=!1,d=!1,m=!1){var g;const E=r.type;if(this.isObjectMethod(r))return;const b=this.isOptionalMemberExpression(r);if(b||E==="MemberExpression"){b&&(this.expectPlugin("optionalChainingAssign",r.loc.start),t.type!=="AssignmentExpression"&&this.raise(S.InvalidLhsOptionalChaining,r,{ancestor:t})),n!==64&&this.raise(S.InvalidPropertyBindingPattern,r);return}if(E==="Identifier"){this.checkIdentifier(r,n,l);const{name:H}=r;o&&(o.has(H)?this.raise(S.ParamDupe,r):o.add(H));return}else E==="VoidPattern"&&t.type==="CatchClause"&&this.raise(S.VoidPatternCatchClauseParam,r);const I=Er(r);m||(m=I.type==="CallExpression"&&(I.callee.type==="Import"||I.callee.type==="Super"));const C=this.isValidLVal(E,m,!(d||(g=r.extra)!=null&&g.parenthesized)&&t.type==="AssignmentExpression",n);if(C===!0)return;if(C===!1){const H=n===64?S.InvalidLhs:S.InvalidLhsBinding;this.raise(H,r,{ancestor:t});return}let N,M;typeof C=="string"?(N=C,M=E==="ParenthesizedExpression"):[N,M]=C;const Q=E==="ArrayPattern"||E==="ObjectPattern"?{type:E}:t,le=r[N];if(Array.isArray(le))for(const H of le)H&&this.checkLVal(H,Q,n,o,l,M,!0);else le&&this.checkLVal(le,Q,n,o,l,M,m)}checkIdentifier(r,t,n=!1){this.state.strict&&(n?Wn(r.name,this.inModule):Zn(r.name))&&(t===64?this.raise(S.StrictEvalArguments,r,{referenceName:r.name}):this.raise(S.StrictEvalArgumentsBinding,r,{bindingName:r.name})),t&8192&&r.name==="let"&&this.raise(S.LetInLexicalBinding,r),t&64||this.declareNameFromIdentifier(r,t)}declareNameFromIdentifier(r,t){this.scope.declareName(r.name,t,r.loc.start)}checkToRestConversion(r,t){switch(r.type){case"ParenthesizedExpression":this.checkToRestConversion(r.expression,t);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(t)break;default:this.raise(S.InvalidRestAssignmentPattern,r)}}checkCommaAfterRest(r){return this.match(12)?(this.raise(this.lookaheadCharCode()===r?S.RestTrailingComma:S.ElementAfterRest,this.state.startLoc),!0):!1}}const Tr=/in(?:stanceof)?|as|satisfies/y;function Zh(p){if(p==null)throw new Error(`Unexpected ${p} value.`);return p}function ia(p){if(!p)throw new Error("Assert fail")}const D=Ce`typescript`({AbstractMethodHasImplementation:({methodName:p})=>`Method '${p}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:p})=>`Property '${p}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind:p})=>`'declare' is not allowed in ${p}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:p})=>`Accessibility modifier already seen: '${p}'.`,DuplicateModifier:({modifier:p})=>`Duplicate modifier: '${p}'.`,EmptyHeritageClauseType:({token:p})=>`'${p}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:p})=>`'${p[0]}' modifier cannot be used with '${p[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:p})=>`Index signatures cannot have an accessibility modifier ('${p}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token:p})=>`'${p}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:p=>`'${p}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:p})=>`'${p}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:p})=>`'${p}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:p})=>`'${p}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:p=>`'${p}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:p})=>`'${p[0]}' modifier must precede '${p[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:p})=>`Private elements cannot have an accessibility modifier ('${p}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:p})=>`Single type parameter ${p} should have a trailing comma. Example usage: <${p},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:p})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${p}.`,UsingDeclarationInAmbientContext:p=>`'${p}' declarations are not allowed in ambient contexts.`});function Wh(p){switch(p){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function ra(p){return p==="private"||p==="public"||p==="protected"}function Kh(p){return p==="in"||p==="out"}var qh=p=>class extends p{constructor(...t){super(...t),this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:D.InvalidModifierOnTypeParameter}),this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:D.InvalidModifierOnTypeParameterPositions}),this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:D.InvalidModifierOnTypeParameter})}getScopeHandler(){return Ch}tsIsIdentifier(){return ie(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(139)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){return this.next(),this.hasPrecedingLineBreak()?!1:this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){return this.match(106)?(this.next(),this.tsTokenCanFollowModifier()):this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(t,n,o){if(!ie(this.state.type)&&this.state.type!==58&&this.state.type!==75)return;const l=this.state.value;if(t.includes(l)){if(o&&this.match(106)||n&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return l}}tsParseModifiers({allowedModifiers:t,disallowedModifiers:n,stopOnStartOfClassStaticBlock:o,errorTemplate:l=D.InvalidModifierOnTypeMember},d){const m=(E,b,I,C)=>{b===I&&d[C]&&this.raise(D.InvalidModifiersOrder,E,{orderedModifiers:[I,C]})},g=(E,b,I,C)=>{(d[I]&&b===C||d[C]&&b===I)&&this.raise(D.IncompatibleModifiers,E,{modifiers:[I,C]})};for(;;){const{startLoc:E}=this.state,b=this.tsParseModifier(t.concat(n??[]),o,d.static);if(!b)break;ra(b)?d.accessibility?this.raise(D.DuplicateAccessibilityModifier,E,{modifier:b}):(m(E,b,b,"override"),m(E,b,b,"static"),m(E,b,b,"readonly"),d.accessibility=b):Kh(b)?(d[b]&&this.raise(D.DuplicateModifier,E,{modifier:b}),d[b]=!0,m(E,b,"in","out")):(hasOwnProperty.call(d,b)?this.raise(D.DuplicateModifier,E,{modifier:b}):(m(E,b,"static","readonly"),m(E,b,"static","override"),m(E,b,"override","readonly"),m(E,b,"abstract","override"),g(E,b,"declare","override"),g(E,b,"static","abstract")),d[b]=!0),n!=null&&n.includes(b)&&this.raise(l,E,{modifier:b})}}tsIsListTerminator(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48)}}tsParseList(t,n){const o=[];for(;!this.tsIsListTerminator(t);)o.push(n());return o}tsParseDelimitedList(t,n,o){return Zh(this.tsParseDelimitedListWorker(t,n,!0,o))}tsParseDelimitedListWorker(t,n,o,l){const d=[];let m=-1;for(;!this.tsIsListTerminator(t);){m=-1;const g=n();if(g==null)return;if(d.push(g),this.eat(12)){m=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(t))break;o&&this.expect(12);return}return l&&(l.value=m),d}tsParseBracketedList(t,n,o,l,d){l||(o?this.expect(0):this.expect(47));const m=this.tsParseDelimitedList(t,n,d);return o?this.expect(3):this.expect(48),m}tsParseImportType(){const t=this.startNode();return this.expect(83),this.expect(10),this.match(134)?t.argument=this.parseStringLiteral(this.state.value):(this.raise(D.UnsupportedImportTypeArgument,this.state.startLoc),t.argument=super.parseExprAtom()),this.eat(12)?t.options=this.tsParseImportTypeOptions():t.options=null,this.expect(11),this.eat(16)&&(t.qualifier=this.tsParseEntityName(3)),this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")}tsParseImportTypeOptions(){const t=this.startNode();this.expect(5);const n=this.startNode();return this.isContextual(76)?(n.method=!1,n.key=this.parseIdentifier(!0),n.computed=!1,n.shorthand=!1):this.unexpected(null,76),this.expect(14),n.value=this.tsParseImportTypeWithPropertyValue(),t.properties=[this.finishObjectProperty(n)],this.eat(12),this.expect(8),this.finishNode(t,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){const t=this.startNode(),n=[];for(this.expect(5);!this.match(8);){const o=this.state.type;ie(o)||o===134?n.push(super.parsePropertyDefinition(null)):this.unexpected(),this.eat(12)}return t.properties=n,this.next(),this.finishNode(t,"ObjectExpression")}tsParseEntityName(t){let n;if(t&1&&this.match(78))if(t&2)n=this.parseIdentifier(!0);else{const o=this.startNode();this.next(),n=this.finishNode(o,"ThisExpression")}else n=this.parseIdentifier(!!(t&1));for(;this.eat(16);){const o=this.startNodeAtNode(n);o.left=n,o.right=this.parseIdentifier(!!(t&1)),n=this.finishNode(o,"TSQualifiedName")}return n}tsParseTypeReference(){const t=this.startNode();return t.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")}tsParseThisTypePredicate(t){this.next();const n=this.startNodeAtNode(t);return n.parameterName=t,n.typeAnnotation=this.tsParseTypeAnnotation(!1),n.asserts=!1,this.finishNode(n,"TSTypePredicate")}tsParseThisTypeNode(){const t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")}tsParseTypeQuery(){const t=this.startNode();return this.expect(87),this.match(83)?t.exprName=this.tsParseImportType():t.exprName=this.tsParseEntityName(3),!this.hasPrecedingLineBreak()&&this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeQuery")}tsParseTypeParameter(t){const n=this.startNode();return t(n),n.name=this.tsParseTypeParameterName(),n.constraint=this.tsEatThenParseType(81),n.default=this.tsEatThenParseType(29),this.finishNode(n,"TSTypeParameter")}tsTryParseTypeParameters(t){if(this.match(47))return this.tsParseTypeParameters(t)}tsParseTypeParameters(t){const n=this.startNode();this.match(47)||this.match(143)?this.next():this.unexpected();const o={value:-1};return n.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,t),!1,!0,o),n.params.length===0&&this.raise(D.EmptyTypeParameters,n),o.value!==-1&&this.addExtra(n,"trailingComma",o.value),this.finishNode(n,"TSTypeParameterDeclaration")}tsFillSignature(t,n){const o=t===19,l="parameters",d="typeAnnotation";n.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(10),n[l]=this.tsParseBindingListForSignature(),o?n[d]=this.tsParseTypeOrTypePredicateAnnotation(t):this.match(t)&&(n[d]=this.tsParseTypeOrTypePredicateAnnotation(t))}tsParseBindingListForSignature(){const t=super.parseBindingList(11,41,2);for(const n of t){const{type:o}=n;(o==="AssignmentPattern"||o==="TSParameterProperty")&&this.raise(D.UnsupportedSignatureParameterKind,n,{type:o})}return t}tsParseTypeMemberSemicolon(){!this.eat(12)&&!this.isLineTerminator()&&this.expect(13)}tsParseSignatureMember(t,n){return this.tsFillSignature(14,n),this.tsParseTypeMemberSemicolon(),this.finishNode(n,t)}tsIsUnambiguouslyIndexSignature(){return this.next(),ie(this.state.type)?(this.next(),this.match(14)):!1}tsTryParseIndexSignature(t){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);const n=this.parseIdentifier();n.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(n),this.expect(3),t.parameters=[n];const o=this.tsTryParseTypeAnnotation();return o&&(t.typeAnnotation=o),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSIndexSignature")}tsParsePropertyOrMethodSignature(t,n){if(this.eat(17)&&(t.optional=!0),this.match(10)||this.match(47)){n&&this.raise(D.ReadonlyForMethodSignature,t);const o=t;o.kind&&this.match(47)&&this.raise(D.AccessorCannotHaveTypeParameters,this.state.curPosition()),this.tsFillSignature(14,o),this.tsParseTypeMemberSemicolon();const l="parameters",d="typeAnnotation";if(o.kind==="get")o[l].length>0&&(this.raise(S.BadGetterArity,this.state.curPosition()),this.isThisParam(o[l][0])&&this.raise(D.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if(o.kind==="set"){if(o[l].length!==1)this.raise(S.BadSetterArity,this.state.curPosition());else{const m=o[l][0];this.isThisParam(m)&&this.raise(D.AccessorCannotDeclareThisParameter,this.state.curPosition()),m.type==="Identifier"&&m.optional&&this.raise(D.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),m.type==="RestElement"&&this.raise(D.SetAccessorCannotHaveRestParameter,this.state.curPosition())}o[d]&&this.raise(D.SetAccessorCannotHaveReturnType,o[d])}else o.kind="method";return this.finishNode(o,"TSMethodSignature")}else{const o=t;n&&(o.readonly=!0);const l=this.tsTryParseTypeAnnotation();return l&&(o.typeAnnotation=l),this.tsParseTypeMemberSemicolon(),this.finishNode(o,"TSPropertySignature")}}tsParseTypeMember(){const t=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(77)){const o=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",t):(t.key=this.createIdentifier(o,"new"),this.tsParsePropertyOrMethodSignature(t,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},t);const n=this.tsTryParseIndexSignature(t);return n||(super.parsePropertyName(t),!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.tsTokenCanFollowModifier()&&(t.kind=t.key.name,super.parsePropertyName(t),!this.match(10)&&!this.match(47)&&this.unexpected(null,10)),this.tsParsePropertyOrMethodSignature(t,!!t.readonly))}tsParseTypeLiteral(){const t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(5);const t=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(8),t}tsIsStartOfMappedType(){return this.next(),this.eat(53)?this.isContextual(122):(this.isContextual(122)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(58)))}tsParseMappedType(){const t=this.startNode();this.expect(5),this.match(53)?(t.readonly=this.state.value,this.next(),this.expectContextual(122)):this.eatContextual(122)&&(t.readonly=!0),this.expect(0);const n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsExpectThenParseType(58),t.typeParameter=this.finishNode(n,"TSTypeParameter"),t.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(t.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(t,"TSMappedType")}tsParseTupleType(){const t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let n=!1;return t.elementTypes.forEach(o=>{const{type:l}=o;n&&l!=="TSRestType"&&l!=="TSOptionalType"&&!(l==="TSNamedTupleMember"&&o.optional)&&this.raise(D.OptionalTypeBeforeRequired,o),n||(n=l==="TSNamedTupleMember"&&o.optional||l==="TSOptionalType")}),this.finishNode(t,"TSTupleType")}tsParseTupleElementType(){const t=this.state.startLoc,n=this.eat(21),{startLoc:o}=this.state;let l,d,m,g;const b=Xe(this.state.type)?this.lookaheadCharCode():null;if(b===58)l=!0,m=!1,d=this.parseIdentifier(!0),this.expect(14),g=this.tsParseType();else if(b===63){m=!0;const I=this.state.value,C=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(l=!0,d=this.createIdentifier(this.startNodeAt(o),I),this.expect(17),this.expect(14),g=this.tsParseType()):(l=!1,g=C,this.expect(17))}else g=this.tsParseType(),m=this.eat(17),l=this.eat(14);if(l){let I;d?(I=this.startNodeAt(o),I.optional=m,I.label=d,I.elementType=g,this.eat(17)&&(I.optional=!0,this.raise(D.TupleOptionalAfterType,this.state.lastTokStartLoc))):(I=this.startNodeAt(o),I.optional=m,this.raise(D.InvalidTupleMemberLabel,g),I.label=g,I.elementType=this.tsParseType()),g=this.finishNode(I,"TSNamedTupleMember")}else if(m){const I=this.startNodeAt(o);I.typeAnnotation=g,g=this.finishNode(I,"TSOptionalType")}if(n){const I=this.startNodeAt(t);I.typeAnnotation=g,g=this.finishNode(I,"TSRestType")}return g}tsParseParenthesizedType(){const t=this.startNode();return this.expect(10),t.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(t,"TSParenthesizedType")}tsParseFunctionOrConstructorType(t,n){const o=this.startNode();return t==="TSConstructorType"&&(o.abstract=!!n,n&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,o)),this.finishNode(o,t)}tsParseLiteralTypeNode(){const t=this.startNode();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:t.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(t,"TSLiteralType")}tsParseTemplateLiteralType(){const t=this.startNode();return t.literal=super.parseTemplate(!1),this.finishNode(t,"TSLiteralType")}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){const t=this.tsParseThisTypeNode();return this.isContextual(116)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const t=this.startNode(),n=this.lookahead();return n.type!==135&&n.type!==136&&this.unexpected(),t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{const{type:t}=this.state;if(ie(t)||t===88||t===84){const n=t===88?"TSVoidKeyword":t===84?"TSNullKeyword":Wh(this.state.value);if(n!==void 0&&this.lookaheadCharCode()!==46){const o=this.startNode();return this.next(),this.finishNode(o,n)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){const{startLoc:t}=this.state;let n=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){const o=this.startNodeAt(t);o.elementType=n,this.expect(3),n=this.finishNode(o,"TSArrayType")}else{const o=this.startNodeAt(t);o.objectType=n,o.indexType=this.tsParseType(),this.expect(3),n=this.finishNode(o,"TSIndexedAccessType")}return n}tsParseTypeOperator(){const t=this.startNode(),n=this.state.value;return this.next(),t.operator=n,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),n==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(t),this.finishNode(t,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(D.UnexpectedReadonly,t)}}tsParseInferType(){const t=this.startNode();this.expectContextual(115);const n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),t.typeParameter=this.finishNode(n,"TSTypeParameter"),this.finishNode(t,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(81)){const t=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17))return t}}tsParseTypeOperatorOrHigher(){return th(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(t,n,o){const l=this.startNode(),d=this.eat(o),m=[];do m.push(n());while(this.eat(o));return m.length===1&&!d?m[0]:(l.types=m,this.finishNode(l,t))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){return this.match(47)?!0:this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(ie(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){const{errors:t}=this.state,n=t.length;try{return this.parseObjectLike(8,!0),t.length===n}catch{return!1}}if(this.match(0)){this.next();const{errors:t}=this.state,n=t.length;try{return super.parseBindingList(3,93,1),t.length===n}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(11)||this.match(21)||this.tsSkipParameterStart()&&(this.match(14)||this.match(12)||this.match(17)||this.match(29)||this.match(11)&&(this.next(),this.match(19))))}tsParseTypeOrTypePredicateAnnotation(t){return this.tsInType(()=>{const n=this.startNode();this.expect(t);const o=this.startNode(),l=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(l&&this.match(78)){let g=this.tsParseThisTypeOrThisTypePredicate();return g.type==="TSThisType"?(o.parameterName=g,o.asserts=!0,o.typeAnnotation=null,g=this.finishNode(o,"TSTypePredicate")):(this.resetStartLocationFromNode(g,o),g.asserts=!0),n.typeAnnotation=g,this.finishNode(n,"TSTypeAnnotation")}const d=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!d)return l?(o.parameterName=this.parseIdentifier(),o.asserts=l,o.typeAnnotation=null,n.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,n);const m=this.tsParseTypeAnnotation(!1);return o.parameterName=d,o.typeAnnotation=m,o.asserts=l,n.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(14))return this.tsParseTypeOrTypePredicateAnnotation(14)}tsTryParseTypeAnnotation(){if(this.match(14))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){const t=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak())return this.next(),t}tsParseTypePredicateAsserts(){if(this.state.type!==109)return!1;const t=this.state.containsEsc;return this.next(),!ie(this.state.type)&&!this.match(78)?!1:(t&&this.raise(S.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(t=!0,n=this.startNode()){return this.tsInType(()=>{t&&this.expect(14),n.typeAnnotation=this.tsParseType()}),this.finishNode(n,"TSTypeAnnotation")}tsParseType(){ia(this.state.inType);const t=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return t;const n=this.startNodeAtNode(t);return n.checkType=t,n.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(17),n.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(14),n.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(n,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(124)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(77)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(D.ReservedTypeAssertion,this.state.startLoc);const t=this.startNode();return t.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?this.tsParseTypeReference():this.tsParseType())),this.expect(48),t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")}tsParseHeritageClause(t){const n=this.state.startLoc,o=this.tsParseDelimitedList("HeritageClauseElement",()=>{const l=this.startNode();return l.expression=this.tsParseEntityName(3),this.match(47)&&(l.typeParameters=this.tsParseTypeArguments()),this.finishNode(l,"TSExpressionWithTypeArguments")});return o.length||this.raise(D.EmptyHeritageClauseType,n,{token:t}),o}tsParseInterfaceDeclaration(t,n={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129),n.declare&&(t.declare=!0),ie(this.state.type)?(t.id=this.parseIdentifier(),this.checkIdentifier(t.id,130)):(t.id=null,this.raise(D.MissingInterfaceName,this.state.startLoc)),t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(t.extends=this.tsParseHeritageClause("extends"));const o=this.startNode();return o.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),t.body=this.finishNode(o,"TSInterfaceBody"),this.finishNode(t,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(t){return t.id=this.parseIdentifier(),this.checkIdentifier(t.id,2),t.typeAnnotation=this.tsInType(()=>{if(t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(29),this.isContextual(114)&&this.lookaheadCharCode()!==46){const n=this.startNode();return this.next(),this.finishNode(n,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(t,"TSTypeAliasDeclaration")}tsInTopLevelContext(t){if(this.curContext()!==$.brace){const n=this.state.context;this.state.context=[n[0]];try{return t()}finally{this.state.context=n}}else return t()}tsInType(t){const n=this.state.inType;this.state.inType=!0;try{return t()}finally{this.state.inType=n}}tsInDisallowConditionalTypesContext(t){const n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.state.inDisallowConditionalTypesContext=n}}tsInAllowConditionalTypesContext(t){const n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.state.inDisallowConditionalTypesContext=n}}tsEatThenParseType(t){if(this.match(t))return this.tsNextThenParseType()}tsExpectThenParseType(t){return this.tsInType(()=>(this.expect(t),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){const t=this.startNode();return t.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(29)&&(t.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(t,"TSEnumMember")}tsParseEnumDeclaration(t,n={}){return n.const&&(t.const=!0),n.declare&&(t.declare=!0),this.expectContextual(126),t.id=this.parseIdentifier(),this.checkIdentifier(t.id,t.const?8971:8459),this.expect(5),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(t,"TSEnumDeclaration")}tsParseEnumBody(){const t=this.startNode();return this.expect(5),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(t,"TSEnumBody")}tsParseModuleBlock(){const t=this.startNode();return this.scope.enter(0),this.expect(5),super.parseBlockOrModuleBlockBody(t.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(t,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(t,n=!1){if(t.id=this.parseIdentifier(),n||this.checkIdentifier(t.id,1024),this.eat(16)){const o=this.startNode();this.tsParseModuleOrNamespaceDeclaration(o,!0),t.body=o}else this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit();return this.finishNode(t,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(t){return this.isContextual(112)?(t.kind="global",t.global=!0,t.id=this.parseIdentifier()):this.match(134)?(t.kind="module",t.id=super.parseStringLiteral(this.state.value)):this.unexpected(),this.match(5)?(this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(t,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(t,n,o){t.isExport=o||!1,t.id=n||this.parseIdentifier(),this.checkIdentifier(t.id,4096),this.expect(29);const l=this.tsParseModuleReference();return t.importKind==="type"&&l.type!=="TSExternalModuleReference"&&this.raise(D.ImportAliasHasImportType,l),t.moduleReference=l,this.semicolon(),this.finishNode(t,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){const t=this.startNode();return this.expectContextual(119),this.expect(10),this.match(134)||this.unexpected(),t.expression=super.parseExprAtom(),this.expect(11),this.sawUnambiguousESM=!0,this.finishNode(t,"TSExternalModuleReference")}tsLookAhead(t){const n=this.state.clone(),o=t();return this.state=n,o}tsTryParseAndCatch(t){const n=this.tryParse(o=>t()||o());if(!(n.aborted||!n.node))return n.error&&(this.state=n.failState),n.node}tsTryParse(t){const n=this.state.clone(),o=t();if(o!==void 0&&o!==!1)return o;this.state=n}tsTryParseDeclare(t){if(this.isLineTerminator())return;const n=this.state.type;return this.tsInAmbientContext(()=>{switch(n){case 68:return t.declare=!0,super.parseFunctionStatement(t,!1,!1);case 80:return t.declare=!0,this.parseClass(t,!0,!1);case 126:return this.tsParseEnumDeclaration(t,{declare:!0});case 112:return this.tsParseAmbientExternalModuleDeclaration(t);case 100:if(this.state.containsEsc)return;case 75:case 74:return!this.match(75)||!this.isLookaheadContextual("enum")?(t.declare=!0,this.parseVarStatement(t,this.state.value,!0)):(this.expect(75),this.tsParseEnumDeclaration(t,{const:!0,declare:!0}));case 107:if(this.isUsing())return this.raise(D.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.parseVarStatement(t,"using",!0);break;case 96:if(this.isAwaitUsing())return this.raise(D.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.next(),this.parseVarStatement(t,"await using",!0);break;case 129:{const o=this.tsParseInterfaceDeclaration(t,{declare:!0});if(o)return o}default:if(ie(n))return this.tsParseDeclaration(t,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(t,n,o,l){switch(n){case 124:if(this.tsCheckLineTerminator(o)&&(this.match(80)||ie(this.state.type)))return this.tsParseAbstractDeclaration(t,l);break;case 127:if(this.tsCheckLineTerminator(o)){if(this.match(134))return this.tsParseAmbientExternalModuleDeclaration(t);if(ie(this.state.type))return t.kind="module",this.tsParseModuleOrNamespaceDeclaration(t)}break;case 128:if(this.tsCheckLineTerminator(o)&&ie(this.state.type))return t.kind="namespace",this.tsParseModuleOrNamespaceDeclaration(t);break;case 130:if(this.tsCheckLineTerminator(o)&&ie(this.state.type))return this.tsParseTypeAliasDeclaration(t);break}}tsCheckLineTerminator(t){return t?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(t){if(!this.match(47))return;const n=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;const o=this.tsTryParseAndCatch(()=>{const l=this.startNodeAt(t);return l.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(l),l.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(19),l});if(this.state.maybeInArrowParameters=n,!!o)return super.parseArrowExpression(o,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===47)return this.tsParseTypeArguments()}tsParseTypeArguments(){const t=this.startNode();return t.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(47),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),t.params.length===0?this.raise(D.EmptyTypeArguments,t):!this.state.inType&&this.curContext()===$.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return sh(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseBindingElement(t,n){const o=n.length?n[0].loc.start:this.state.startLoc,l={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},l);const d=l.accessibility,m=l.override,g=l.readonly;!(t&4)&&(d||g||m)&&this.raise(D.UnexpectedParameterModifier,o);const E=this.parseMaybeDefault();t&2&&this.parseFunctionParamType(E);const b=this.parseMaybeDefault(E.loc.start,E);if(d||g||m){const I=this.startNodeAt(o);return n.length&&(I.decorators=n),d&&(I.accessibility=d),g&&(I.readonly=g),m&&(I.override=m),b.type!=="Identifier"&&b.type!=="AssignmentPattern"&&this.raise(D.UnsupportedParameterPropertyKind,I),I.parameter=b,this.finishNode(I,"TSParameterProperty")}return n.length&&(E.decorators=n),b}isSimpleParameter(t){return t.type==="TSParameterProperty"&&super.isSimpleParameter(t.parameter)||super.isSimpleParameter(t)}tsDisallowOptionalPattern(t){for(const n of t.params)n.type!=="Identifier"&&n.optional&&!this.state.isAmbientContext&&this.raise(D.PatternIsOptional,n)}setArrowFunctionParameters(t,n,o){super.setArrowFunctionParameters(t,n,o),this.tsDisallowOptionalPattern(t)}parseFunctionBodyAndFinish(t,n,o=!1){this.match(14)&&(t.returnType=this.tsParseTypeOrTypePredicateAnnotation(14));const l=n==="FunctionDeclaration"?"TSDeclareFunction":n==="ClassMethod"||n==="ClassPrivateMethod"?"TSDeclareMethod":void 0;return l&&!this.match(5)&&this.isLineTerminator()?this.finishNode(t,l):l==="TSDeclareFunction"&&this.state.isAmbientContext&&(this.raise(D.DeclareFunctionHasImplementation,t),t.declare)?super.parseFunctionBodyAndFinish(t,l,o):(this.tsDisallowOptionalPattern(t),super.parseFunctionBodyAndFinish(t,n,o))}registerFunctionStatementId(t){!t.body&&t.id?this.checkIdentifier(t.id,1024):super.registerFunctionStatementId(t)}tsCheckForInvalidTypeCasts(t){t.forEach(n=>{n?.type==="TSTypeCastExpression"&&this.raise(D.UnexpectedTypeAnnotation,n.typeAnnotation)})}toReferencedList(t,n){return this.tsCheckForInvalidTypeCasts(t),t}parseArrayLike(t,n,o){const l=super.parseArrayLike(t,n,o);return l.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(l.elements),l}parseSubscript(t,n,o,l){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=!1,this.next();const m=this.startNodeAt(n);return m.expression=t,this.finishNode(m,"TSNonNullExpression")}let d=!1;if(this.match(18)&&this.lookaheadCharCode()===60){if(o)return l.stop=!0,t;l.optionalChainMember=d=!0,this.next()}if(this.match(47)||this.match(51)){let m;const g=this.tsTryParseAndCatch(()=>{if(!o&&this.atPossibleAsyncArrow(t)){const C=this.tsTryParseGenericAsyncArrowFunction(n);if(C)return l.stop=!0,C}const E=this.tsParseTypeArgumentsInExpression();if(!E)return;if(d&&!this.match(10)){m=this.state.curPosition();return}if(Gs(this.state.type)){const C=super.parseTaggedTemplateExpression(t,n,l);return C.typeParameters=E,C}if(!o&&this.eat(10)){const C=this.startNodeAt(n);return C.callee=t,C.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(C.arguments),C.typeParameters=E,l.optionalChainMember&&(C.optional=d),this.finishCallExpression(C,l.optionalChainMember)}const b=this.state.type;if(b===48||b===52||b!==10&&b!==93&&b!==120&&Ss(b)&&!this.hasPrecedingLineBreak())return;const I=this.startNodeAt(n);return I.expression=t,I.typeParameters=E,this.finishNode(I,"TSInstantiationExpression")});if(m&&this.unexpected(m,10),g)return g.type==="TSInstantiationExpression"&&((this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40)&&this.raise(D.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc),!this.match(16)&&!this.match(18)&&(g.expression=super.stopParseSubscript(t,l))),g}return super.parseSubscript(t,n,o,l)}parseNewCallee(t){var n;super.parseNewCallee(t);const{callee:o}=t;o.type==="TSInstantiationExpression"&&!((n=o.extra)!=null&&n.parenthesized)&&(t.typeParameters=o.typeParameters,t.callee=o.expression)}parseExprOp(t,n,o){let l;if(Vs(58)>o&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(l=this.isContextual(120)))){const d=this.startNodeAt(n);return d.expression=t,d.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?(l&&this.raise(S.UnexpectedKeyword,this.state.startLoc,{keyword:"const"}),this.tsParseTypeReference()):this.tsParseType())),this.finishNode(d,l?"TSSatisfiesExpression":"TSAsExpression"),this.reScan_lt_gt(),this.parseExprOp(d,n,o)}return super.parseExprOp(t,n,o)}checkReservedWord(t,n,o,l){this.state.isAmbientContext||super.checkReservedWord(t,n,o,l)}checkImportReflection(t){super.checkImportReflection(t),t.module&&t.importKind!=="value"&&this.raise(D.ImportReflectionHasImportType,t.specifiers[0].loc.start)}checkDuplicateExports(){}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(130)){const n=this.lookaheadCharCode();return t?n===123||n===42:n!==61}return!t&&this.isContextual(87)}applyImportPhase(t,n,o,l){super.applyImportPhase(t,n,o,l),n?t.exportKind=o==="type"?"type":"value":t.importKind=o==="type"||o==="typeof"?o:"value"}parseImport(t){if(this.match(134))return t.importKind="value",super.parseImport(t);let n;if(ie(this.state.type)&&this.lookaheadCharCode()===61)return t.importKind="value",this.tsParseImportEqualsDeclaration(t);if(this.isContextual(130)){const o=this.parseMaybeImportPhase(t,!1);if(this.lookaheadCharCode()===61)return this.tsParseImportEqualsDeclaration(t,o);n=super.parseImportSpecifiersAndAfter(t,o)}else n=super.parseImport(t);return n.importKind==="type"&&n.specifiers.length>1&&n.specifiers[0].type==="ImportDefaultSpecifier"&&this.raise(D.TypeImportCannotSpecifyDefaultAndNamed,n),n}parseExport(t,n){if(this.match(83)){const o=t;this.next();let l=null;return this.isContextual(130)&&this.isPotentialImportPhase(!1)?l=this.parseMaybeImportPhase(o,!1):o.importKind="value",this.tsParseImportEqualsDeclaration(o,l,!0)}else if(this.eat(29)){const o=t;return o.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(o,"TSExportAssignment")}else if(this.eatContextual(93)){const o=t;return this.expectContextual(128),o.id=this.parseIdentifier(),this.semicolon(),this.finishNode(o,"TSNamespaceExportDeclaration")}else return super.parseExport(t,n)}isAbstractClass(){return this.isContextual(124)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){const t=this.startNode();return this.next(),t.abstract=!0,this.parseClass(t,!0,!0)}if(this.match(129)){const t=this.tsParseInterfaceDeclaration(this.startNode());if(t)return t}return super.parseExportDefaultExpression()}parseVarStatement(t,n,o=!1){const{isAmbientContext:l}=this.state,d=super.parseVarStatement(t,n,o||l);if(!l)return d;if(!t.declare&&(n==="using"||n==="await using"))return this.raiseOverwrite(D.UsingDeclarationInAmbientContext,t,n),d;for(const{id:m,init:g}of d.declarations)g&&(n==="var"||n==="let"||m.typeAnnotation?this.raise(D.InitializerNotAllowedInAmbientContext,g):Jh(g,this.hasPlugin("estree"))||this.raise(D.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,g));return d}parseStatementContent(t,n){if(!this.state.containsEsc)switch(this.state.type){case 75:{if(this.isLookaheadContextual("enum")){const o=this.startNode();return this.expect(75),this.tsParseEnumDeclaration(o,{const:!0})}break}case 124:case 125:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){const o=this.state.type,l=this.startNode();this.next();const d=o===125?this.tsTryParseDeclare(l):this.tsParseAbstractDeclaration(l,n);return d?(o===125&&(d.declare=!0),d):(l.expression=this.createIdentifier(this.startNodeAt(l.loc.start),o===125?"declare":"abstract"),this.semicolon(!1),this.finishNode(l,"ExpressionStatement"))}break}case 126:return this.tsParseEnumDeclaration(this.startNode());case 112:{if(this.lookaheadCharCode()===123){const l=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(l)}break}case 129:{const o=this.tsParseInterfaceDeclaration(this.startNode());if(o)return o;break}case 127:{if(this.nextTokenIsIdentifierOrStringLiteralOnSameLine()){const o=this.startNode();return this.next(),this.tsParseDeclaration(o,127,!1,n)}break}case 128:{if(this.nextTokenIsIdentifierOnSameLine()){const o=this.startNode();return this.next(),this.tsParseDeclaration(o,128,!1,n)}break}case 130:{if(this.nextTokenIsIdentifierOnSameLine()){const o=this.startNode();return this.next(),this.tsParseTypeAliasDeclaration(o)}break}}return super.parseStatementContent(t,n)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(t,n){return n.some(o=>ra(o)?t.accessibility===o:!!t[o])}tsIsStartOfStaticBlocks(){return this.isContextual(106)&&this.lookaheadCharCode()===123}parseClassMember(t,n,o){const l=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:l,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:D.InvalidModifierOnTypeParameterPositions},n);const d=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(n,l)&&this.raise(D.StaticBlockCannotHaveModifier,this.state.curPosition()),super.parseClassStaticBlock(t,n)):this.parseClassMemberWithIsStatic(t,n,o,!!n.static)};n.declare?this.tsInAmbientContext(d):d()}parseClassMemberWithIsStatic(t,n,o,l){const d=this.tsTryParseIndexSignature(n);if(d){t.body.push(d),n.abstract&&this.raise(D.IndexSignatureHasAbstract,n),n.accessibility&&this.raise(D.IndexSignatureHasAccessibility,n,{modifier:n.accessibility}),n.declare&&this.raise(D.IndexSignatureHasDeclare,n),n.override&&this.raise(D.IndexSignatureHasOverride,n);return}!this.state.inAbstractClass&&n.abstract&&this.raise(D.NonAbstractClassHasAbstractMethod,n),n.override&&(o.hadSuperClass||this.raise(D.OverrideNotInSubClass,n)),super.parseClassMemberWithIsStatic(t,n,o,l)}parsePostMemberNameModifiers(t){this.eat(17)&&(t.optional=!0),t.readonly&&this.match(10)&&this.raise(D.ClassMethodHasReadonly,t),t.declare&&this.match(10)&&this.raise(D.ClassMethodHasDeclare,t)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(t,n,o){if(!this.match(17))return t;if(this.state.maybeInArrowParameters){const l=this.lookaheadCharCode();if(l===44||l===61||l===58||l===41)return this.setOptionalParametersError(o),t}return super.parseConditional(t,n,o)}parseParenItem(t,n){const o=super.parseParenItem(t,n);if(this.eat(17)&&(o.optional=!0,this.resetEndLocation(t)),this.match(14)){const l=this.startNodeAt(n);return l.expression=t,l.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(l,"TSTypeCastExpression")}return t}parseExportDeclaration(t){if(!this.state.isAmbientContext&&this.isContextual(125))return this.tsInAmbientContext(()=>this.parseExportDeclaration(t));const n=this.state.startLoc,o=this.eatContextual(125);if(o&&(this.isContextual(125)||!this.shouldParseExportDeclaration()))throw this.raise(D.ExpectedAmbientAfterExportDeclare,this.state.startLoc);const d=ie(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(t);return d?((d.type==="TSInterfaceDeclaration"||d.type==="TSTypeAliasDeclaration"||o)&&(t.exportKind="type"),o&&d.type!=="TSImportEqualsDeclaration"&&(this.resetStartLocation(d,n),d.declare=!0),d):null}parseClassId(t,n,o,l){if((!n||o)&&this.isContextual(113))return;super.parseClassId(t,n,o,t.declare?1024:8331);const d=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);d&&(t.typeParameters=d)}parseClassPropertyAnnotation(t){t.optional||(this.eat(35)?t.definite=!0:this.eat(17)&&(t.optional=!0));const n=this.tsTryParseTypeAnnotation();n&&(t.typeAnnotation=n)}parseClassProperty(t){if(this.parseClassPropertyAnnotation(t),this.state.isAmbientContext&&!(t.readonly&&!t.typeAnnotation)&&this.match(29)&&this.raise(D.DeclareClassFieldHasInitializer,this.state.startLoc),t.abstract&&this.match(29)){const{key:n}=t;this.raise(D.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:n.type==="Identifier"&&!t.computed?n.name:`[${this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end))}]`})}return super.parseClassProperty(t)}parseClassPrivateProperty(t){return t.abstract&&this.raise(D.PrivateElementHasAbstract,t),t.accessibility&&this.raise(D.PrivateElementHasAccessibility,t,{modifier:t.accessibility}),this.parseClassPropertyAnnotation(t),super.parseClassPrivateProperty(t)}parseClassAccessorProperty(t){return this.parseClassPropertyAnnotation(t),t.optional&&this.raise(D.AccessorCannotBeOptional,t),super.parseClassAccessorProperty(t)}pushClassMethod(t,n,o,l,d,m){const g=this.tsTryParseTypeParameters(this.tsParseConstModifier);g&&d&&this.raise(D.ConstructorHasTypeParameters,g);const{declare:E=!1,kind:b}=n;E&&(b==="get"||b==="set")&&this.raise(D.DeclareAccessor,n,{kind:b}),g&&(n.typeParameters=g),super.pushClassMethod(t,n,o,l,d,m)}pushClassPrivateMethod(t,n,o,l){const d=this.tsTryParseTypeParameters(this.tsParseConstModifier);d&&(n.typeParameters=d),super.pushClassPrivateMethod(t,n,o,l)}declareClassPrivateMethodInScope(t,n){t.type!=="TSDeclareMethod"&&(t.type==="MethodDefinition"&&t.value.body==null||super.declareClassPrivateMethodInScope(t,n))}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass)if(t.superClass.type==="TSInstantiationExpression"){const n=t.superClass,o=n.expression;this.takeSurroundingComments(o,o.start,o.end);const l=n.typeParameters;this.takeSurroundingComments(l,l.start,l.end),t.superClass=o,t.superTypeParameters=l}else(this.match(47)||this.match(51))&&(t.superTypeParameters=this.tsParseTypeArgumentsInExpression());this.eatContextual(113)&&(t.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(t,n,o,l,d,m,g){const E=this.tsTryParseTypeParameters(this.tsParseConstModifier);return E&&(t.typeParameters=E),super.parseObjPropValue(t,n,o,l,d,m,g)}parseFunctionParams(t,n){const o=this.tsTryParseTypeParameters(this.tsParseConstModifier);o&&(t.typeParameters=o),super.parseFunctionParams(t,n)}parseVarId(t,n){super.parseVarId(t,n),t.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)&&(t.definite=!0);const o=this.tsTryParseTypeAnnotation();o&&(t.id.typeAnnotation=o,this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,n){return this.match(14)&&(t.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(t,n)}parseMaybeAssign(t,n){var o,l,d,m,g;let E,b,I;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(E=this.state.clone(),b=this.tryParse(()=>super.parseMaybeAssign(t,n),E),!b.error)return b.node;const{context:M}=this.state,Q=M[M.length-1];(Q===$.j_oTag||Q===$.j_expr)&&M.pop()}if(!((o=b)!=null&&o.error)&&!this.match(47))return super.parseMaybeAssign(t,n);(!E||E===this.state)&&(E=this.state.clone());let C;const N=this.tryParse(M=>{var Q,le;C=this.tsParseTypeParameters(this.tsParseConstModifier);const H=super.parseMaybeAssign(t,n);return(H.type!=="ArrowFunctionExpression"||(Q=H.extra)!=null&&Q.parenthesized)&&M(),((le=C)==null?void 0:le.params.length)!==0&&this.resetStartLocationFromNode(H,C),H.typeParameters=C,H},E);if(!N.error&&!N.aborted)return C&&this.reportReservedArrowTypeParam(C),N.node;if(!b&&(ia(!this.hasPlugin("jsx")),I=this.tryParse(()=>super.parseMaybeAssign(t,n),E),!I.error))return I.node;if((l=b)!=null&&l.node)return this.state=b.failState,b.node;if(N.node)return this.state=N.failState,C&&this.reportReservedArrowTypeParam(C),N.node;if((d=I)!=null&&d.node)return this.state=I.failState,I.node;throw((m=b)==null?void 0:m.error)||N.error||((g=I)==null?void 0:g.error)}reportReservedArrowTypeParam(t){var n;t.params.length===1&&!t.params[0].constraint&&!((n=t.extra)!=null&&n.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(D.ReservedArrowTypeParam,t)}parseMaybeUnary(t,n){return!this.hasPlugin("jsx")&&this.match(47)?this.tsParseTypeAssertion():super.parseMaybeUnary(t,n)}parseArrow(t){if(this.match(14)){const n=this.tryParse(o=>{const l=this.tsParseTypeOrTypePredicateAnnotation(14);return(this.canInsertSemicolon()||!this.match(19))&&o(),l});if(n.aborted)return;n.thrown||(n.error&&(this.state=n.failState),t.returnType=n.node)}return super.parseArrow(t)}parseFunctionParamType(t){this.eat(17)&&(t.optional=!0);const n=this.tsTryParseTypeAnnotation();return n&&(t.typeAnnotation=n),this.resetEndLocation(t),t}isAssignable(t,n){switch(t.type){case"TSTypeCastExpression":return this.isAssignable(t.expression,n);case"TSParameterProperty":return!0;default:return super.isAssignable(t,n)}}toAssignable(t,n=!1){switch(t.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(t,n);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":n?this.expressionScope.recordArrowParameterBindingError(D.UnexpectedTypeCastInParameter,t):this.raise(D.UnexpectedTypeCastInParameter,t),this.toAssignable(t.expression,n);break;case"AssignmentExpression":!n&&t.left.type==="TSTypeCastExpression"&&(t.left=this.typeCastToParameter(t.left));default:super.toAssignable(t,n)}}toAssignableParenthesizedExpression(t,n){switch(t.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(t.expression,n);break;default:super.toAssignable(t,n)}}checkToRestConversion(t,n){switch(t.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(t.expression,!1);break;default:super.checkToRestConversion(t,n)}}isValidLVal(t,n,o,l){switch(t){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(l!==64||!o)&&["expression",!0];default:return super.isValidLVal(t,n,o,l)}}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(t,n){if(this.match(47)||this.match(51)){const o=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const l=super.parseMaybeDecoratorArguments(t,n);return l.typeParameters=o,l}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(t,n)}checkCommaAfterRest(t){return this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===t?(this.next(),!1):super.checkCommaAfterRest(t)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(t,n){const o=super.parseMaybeDefault(t,n);return o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start&&this.raise(D.TypeAnnotationAfterAssign,o.typeAnnotation),o}getTokenFromCode(t){if(this.state.inType){if(t===62){this.finishOp(48,1);return}if(t===60){this.finishOp(47,1);return}}super.getTokenFromCode(t)}reScan_lt_gt(){const{type:t}=this.state;t===47?(this.state.pos-=1,this.readToken_lt()):t===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:t}=this.state;return t===51?(this.state.pos-=2,this.finishOp(47,1),47):t}toAssignableListItem(t,n,o){const l=t[n];l.type==="TSTypeCastExpression"&&(t[n]=this.typeCastToParameter(l)),super.toAssignableListItem(t,n,o)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.loc.end),t.expression}shouldParseArrow(t){return this.match(14)?t.every(n=>this.isAssignable(n,!0)):super.shouldParseArrow(t)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(t){if(this.match(47)||this.match(51)){const n=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());n&&(t.typeParameters=n)}return super.jsxParseOpeningElementAfterName(t)}getGetterSetterExpectedParamCount(t){const n=super.getGetterSetterExpectedParamCount(t),l=this.getObjectOrClassMethodParams(t)[0];return l&&this.isThisParam(l)?n+1:n}parseCatchClauseParam(){const t=super.parseCatchClauseParam(),n=this.tsTryParseTypeAnnotation();return n&&(t.typeAnnotation=n,this.resetEndLocation(t)),t}tsInAmbientContext(t){const{isAmbientContext:n,strict:o}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return t()}finally{this.state.isAmbientContext=n,this.state.strict=o}}parseClass(t,n,o){const l=this.state.inAbstractClass;this.state.inAbstractClass=!!t.abstract;try{return super.parseClass(t,n,o)}finally{this.state.inAbstractClass=l}}tsParseAbstractDeclaration(t,n){if(this.match(80))return t.abstract=!0,this.maybeTakeDecorators(n,this.parseClass(t,!0,!1));if(this.isContextual(129))return this.hasFollowingLineBreak()?null:(t.abstract=!0,this.raise(D.NonClassMethodPropertyHasAbstractModifier,t),this.tsParseInterfaceDeclaration(t));throw this.unexpected(null,80)}parseMethod(t,n,o,l,d,m,g){const E=super.parseMethod(t,n,o,l,d,m,g);if((E.abstract||E.type==="TSAbstractMethodDefinition")&&(this.hasPlugin("estree")?E.value:E).body){const{key:C}=E;this.raise(D.AbstractMethodHasImplementation,E,{methodName:C.type==="Identifier"&&!E.computed?C.name:`[${this.input.slice(this.offsetToSourcePos(C.start),this.offsetToSourcePos(C.end))}]`})}return E}tsParseTypeParameterName(){return this.parseIdentifier().name}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(t,n,o,l){return!n&&l?(this.parseTypeOnlyImportExportSpecifier(t,!1,o),this.finishNode(t,"ExportSpecifier")):(t.exportKind="value",super.parseExportSpecifier(t,n,o,l))}parseImportSpecifier(t,n,o,l,d){return!n&&l?(this.parseTypeOnlyImportExportSpecifier(t,!0,o),this.finishNode(t,"ImportSpecifier")):(t.importKind="value",super.parseImportSpecifier(t,n,o,l,o?4098:4096))}parseTypeOnlyImportExportSpecifier(t,n,o){const l=n?"imported":"local",d=n?"local":"exported";let m=t[l],g,E=!1,b=!0;const I=m.loc.start;if(this.isContextual(93)){const N=this.parseIdentifier();if(this.isContextual(93)){const M=this.parseIdentifier();Xe(this.state.type)?(E=!0,m=N,g=n?this.parseIdentifier():this.parseModuleExportName(),b=!1):(g=M,b=!1)}else Xe(this.state.type)?(b=!1,g=n?this.parseIdentifier():this.parseModuleExportName()):(E=!0,m=N)}else Xe(this.state.type)&&(E=!0,n?(m=this.parseIdentifier(!0),this.isContextual(93)||this.checkReservedWord(m.name,m.loc.start,!0,!0)):m=this.parseModuleExportName());E&&o&&this.raise(n?D.TypeModifierIsUsedInTypeImports:D.TypeModifierIsUsedInTypeExports,I),t[l]=m,t[d]=g;const C=n?"importKind":"exportKind";t[C]=E?"type":"value",b&&this.eatContextual(93)&&(t[d]=n?this.parseIdentifier():this.parseModuleExportName()),t[d]||(t[d]=this.cloneIdentifier(t[l])),n&&this.checkIdentifier(t[d],E?4098:4096)}fillOptionalPropertiesForTSESLint(t){var n,o,l,d,m,g,E,b,I,C,N,M,Q,le,H,oe,Rt,At,da,fa,ma,ya,ga,Ea,Ta,Sa,ba,xa,Ia,Pa,wa,Aa,Ca,va,Na,_a,Oa,La,ka,Da,Ra,Ma,$a,Fa,Ba,Ua,ja,za;switch(t.type){case"ExpressionStatement":(n=t.directive)!=null||(t.directive=void 0);return;case"RestElement":t.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":(o=t.decorators)!=null||(t.decorators=[]),(l=t.optional)!=null||(t.optional=!1),(d=t.typeAnnotation)!=null||(t.typeAnnotation=void 0);return;case"TSParameterProperty":(m=t.accessibility)!=null||(t.accessibility=void 0),(g=t.decorators)!=null||(t.decorators=[]),(E=t.override)!=null||(t.override=!1),(b=t.readonly)!=null||(t.readonly=!1),(I=t.static)!=null||(t.static=!1);return;case"TSEmptyBodyFunctionExpression":t.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":(C=t.declare)!=null||(t.declare=!1),(N=t.returnType)!=null||(t.returnType=void 0),(M=t.typeParameters)!=null||(t.typeParameters=void 0);return;case"Property":(Q=t.optional)!=null||(t.optional=!1);return;case"TSMethodSignature":case"TSPropertySignature":(le=t.optional)!=null||(t.optional=!1);case"TSIndexSignature":(H=t.accessibility)!=null||(t.accessibility=void 0),(oe=t.readonly)!=null||(t.readonly=!1),(Rt=t.static)!=null||(t.static=!1);return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(At=t.declare)!=null||(t.declare=!1),(da=t.definite)!=null||(t.definite=!1),(fa=t.readonly)!=null||(t.readonly=!1),(ma=t.typeAnnotation)!=null||(t.typeAnnotation=void 0);case"TSAbstractMethodDefinition":case"MethodDefinition":(ya=t.accessibility)!=null||(t.accessibility=void 0),(ga=t.decorators)!=null||(t.decorators=[]),(Ea=t.override)!=null||(t.override=!1),(Ta=t.optional)!=null||(t.optional=!1);return;case"ClassExpression":(Sa=t.id)!=null||(t.id=null);case"ClassDeclaration":(ba=t.abstract)!=null||(t.abstract=!1),(xa=t.declare)!=null||(t.declare=!1),(Ia=t.decorators)!=null||(t.decorators=[]),(Pa=t.implements)!=null||(t.implements=[]),(wa=t.superTypeArguments)!=null||(t.superTypeArguments=void 0),(Aa=t.typeParameters)!=null||(t.typeParameters=void 0);return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(Ca=t.declare)!=null||(t.declare=!1);return;case"VariableDeclarator":(va=t.definite)!=null||(t.definite=!1);return;case"TSEnumDeclaration":(Na=t.const)!=null||(t.const=!1),(_a=t.declare)!=null||(t.declare=!1);return;case"TSEnumMember":(Oa=t.computed)!=null||(t.computed=!1);return;case"TSImportType":(La=t.qualifier)!=null||(t.qualifier=null),(ka=t.options)!=null||(t.options=null);return;case"TSInterfaceDeclaration":(Da=t.declare)!=null||(t.declare=!1),(Ra=t.extends)!=null||(t.extends=[]);return;case"TSMappedType":(Ma=t.optional)!=null||(t.optional=!1),($a=t.readonly)!=null||(t.readonly=void 0);return;case"TSModuleDeclaration":(Fa=t.declare)!=null||(t.declare=!1),(Ba=t.global)!=null||(t.global=t.kind==="global");return;case"TSTypeParameter":(Ua=t.const)!=null||(t.const=!1),(ja=t.in)!=null||(t.in=!1),(za=t.out)!=null||(t.out=!1);return}}chStartsBindingIdentifierAndNotRelationalOperator(t,n){if(nt(t)){if(Tr.lastIndex=n,Tr.test(this.input)){const o=this.codePointAtPos(Tr.lastIndex);if(!kt(o)&&o!==92)return!1}return!0}else return t===92}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){const t=this.nextTokenInLineStart(),n=this.codePointAtPos(t);return this.chStartsBindingIdentifierAndNotRelationalOperator(n,t)}nextTokenIsIdentifierOrStringLiteralOnSameLine(){const t=this.nextTokenInLineStart(),n=this.codePointAtPos(t);return this.chStartsBindingIdentifier(n,t)||n===34||n===39}};function Yh(p){if(p.type!=="MemberExpression")return!1;const{computed:r,property:t}=p;return r&&t.type!=="StringLiteral"&&(t.type!=="TemplateLiteral"||t.expressions.length>0)?!1:aa(p.object)}function Jh(p,r){var t;const{type:n}=p;if((t=p.extra)!=null&&t.parenthesized)return!1;if(r){if(n==="Literal"){const{value:o}=p;if(typeof o=="string"||typeof o=="boolean")return!0}}else if(n==="StringLiteral"||n==="BooleanLiteral")return!0;return!!(na(p,r)||Xh(p,r)||n==="TemplateLiteral"&&p.expressions.length===0||Yh(p))}function na(p,r){return r?p.type==="Literal"&&(typeof p.value=="number"||"bigint"in p):p.type==="NumericLiteral"||p.type==="BigIntLiteral"}function Xh(p,r){if(p.type==="UnaryExpression"){const{operator:t,argument:n}=p;if(t==="-"&&na(n,r))return!0}return!1}function aa(p){return p.type==="Identifier"?!0:p.type!=="MemberExpression"||p.computed?!1:aa(p.object)}const oa=Ce`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var Qh=p=>class extends p{parsePlaceholder(t){if(this.match(133)){const n=this.startNode();return this.next(),this.assertNoSpace(),n.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(133),this.finishPlaceholder(n,t)}}finishPlaceholder(t,n){let o=t;return(!o.expectedNode||!o.type)&&(o=this.finishNode(o,"Placeholder")),o.expectedNode=n,o}getTokenFromCode(t){t===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(133,2):super.getTokenFromCode(t)}parseExprAtom(t){return this.parsePlaceholder("Expression")||super.parseExprAtom(t)}parseIdentifier(t){return this.parsePlaceholder("Identifier")||super.parseIdentifier(t)}checkReservedWord(t,n,o,l){t!==void 0&&super.checkReservedWord(t,n,o,l)}cloneIdentifier(t){const n=super.cloneIdentifier(t);return n.type==="Placeholder"&&(n.expectedNode=t.expectedNode),n}cloneStringLiteral(t){return t.type==="Placeholder"?this.cloneIdentifier(t):super.cloneStringLiteral(t)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(t,n,o,l){return t==="Placeholder"||super.isValidLVal(t,n,o,l)}toAssignable(t,n){t&&t.type==="Placeholder"&&t.expectedNode==="Expression"?t.expectedNode="Pattern":super.toAssignable(t,n)}chStartsBindingIdentifier(t,n){if(super.chStartsBindingIdentifier(t,n))return!0;const o=this.nextTokenStart();return this.input.charCodeAt(o)===37&&this.input.charCodeAt(o+1)===37}verifyBreakContinue(t,n){var o;((o=t.label)==null?void 0:o.type)!=="Placeholder"&&super.verifyBreakContinue(t,n)}parseExpressionStatement(t,n){var o;if(n.type!=="Placeholder"||(o=n.extra)!=null&&o.parenthesized)return super.parseExpressionStatement(t,n);if(this.match(14)){const d=t;return d.label=this.finishPlaceholder(n,"Identifier"),this.next(),d.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(d,"LabeledStatement")}this.semicolon();const l=t;return l.name=n.name,this.finishPlaceholder(l,"Statement")}parseBlock(t,n,o){return this.parsePlaceholder("BlockStatement")||super.parseBlock(t,n,o)}parseFunctionId(t){return this.parsePlaceholder("Identifier")||super.parseFunctionId(t)}parseClass(t,n,o){const l=n?"ClassDeclaration":"ClassExpression";this.next();const d=this.state.strict,m=this.parsePlaceholder("Identifier");if(m)if(this.match(81)||this.match(133)||this.match(5))t.id=m;else{if(o||!n)return t.id=null,t.body=this.finishPlaceholder(m,"ClassBody"),this.finishNode(t,l);throw this.raise(oa.ClassNameIsRequired,this.state.startLoc)}else this.parseClassId(t,n,o);return super.parseClassSuper(t),t.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!t.superClass,d),this.finishNode(t,l)}parseExport(t,n){const o=this.parsePlaceholder("Identifier");if(!o)return super.parseExport(t,n);const l=t;if(!this.isContextual(98)&&!this.match(12))return l.specifiers=[],l.source=null,l.declaration=this.finishPlaceholder(o,"Declaration"),this.finishNode(l,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");const d=this.startNode();return d.exported=o,l.specifiers=[this.finishNode(d,"ExportDefaultSpecifier")],super.parseExport(l,n)}isExportDefaultSpecifier(){if(this.match(65)){const t=this.nextTokenStart();if(this.isUnparsedContextual(t,"from")&&this.input.startsWith(It(133),this.nextTokenStartSince(t+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(t,n){var o;return(o=t.specifiers)!=null&&o.length?!0:super.maybeParseExportDefaultSpecifier(t,n)}checkExport(t){const{specifiers:n}=t;n!=null&&n.length&&(t.specifiers=n.filter(o=>o.exported.type==="Placeholder")),super.checkExport(t),t.specifiers=n}parseImport(t){const n=this.parsePlaceholder("Identifier");if(!n)return super.parseImport(t);if(t.specifiers=[],!this.isContextual(98)&&!this.match(12))return t.source=this.finishPlaceholder(n,"StringLiteral"),this.semicolon(),this.finishNode(t,"ImportDeclaration");const o=this.startNodeAtNode(n);return o.local=n,t.specifiers.push(this.finishNode(o,"ImportDefaultSpecifier")),this.eat(12)&&(this.maybeParseStarImportSpecifier(t)||this.parseNamedImportSpecifiers(t)),this.expectContextual(98),t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(oa.UnexpectedSpace,this.state.lastTokEndLoc)}},ep=p=>class extends p{parseV8Intrinsic(){if(this.match(54)){const t=this.state.startLoc,n=this.startNode();if(this.next(),ie(this.state.type)){const o=this.parseIdentifierName(),l=this.createIdentifier(n,o);if(this.castNodeTo(l,"V8IntrinsicIdentifier"),this.match(10))return l}this.unexpected(t)}}parseExprAtom(t){return this.parseV8Intrinsic()||super.parseExprAtom(t)}};const ca=["minimal","fsharp","hack","smart"],la=["^^","@@","^","%","#"];function tp(p){if(p.has("decorators")){if(p.has("decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");const n=p.get("decorators").decoratorsBeforeExport;if(n!=null&&typeof n!="boolean")throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");const o=p.get("decorators").allowCallParenthesized;if(o!=null&&typeof o!="boolean")throw new Error("'allowCallParenthesized' must be a boolean.")}if(p.has("flow")&&p.has("typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(p.has("placeholders")&&p.has("v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(p.has("pipelineOperator")){var r;const n=p.get("pipelineOperator").proposal;if(!ca.includes(n)){const o=ca.map(l=>`"${l}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${o}.`)}if(n==="hack"){var t;if(p.has("placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(p.has("v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");const o=p.get("pipelineOperator").topicToken;if(!la.includes(o)){const l=la.map(d=>`"${d}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${l}.`)}if(o==="#"&&((t=p.get("recordAndTuple"))==null?void 0:t.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple",p.get("recordAndTuple")])}\`.`)}else if(n==="smart"&&((r=p.get("recordAndTuple"))==null?void 0:r.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple",p.get("recordAndTuple")])}\`.`)}if(p.has("moduleAttributes")){if(p.has("deprecatedImportAssert")||p.has("importAssertions"))throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");if(p.get("moduleAttributes").version!=="may-2020")throw new Error("The 'moduleAttributes' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is 'may-2020'.")}if(p.has("importAssertions")&&p.has("deprecatedImportAssert"))throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");if(p.has("deprecatedImportAssert")||p.has("importAttributes")&&p.get("importAttributes").deprecatedAssertSyntax&&p.set("deprecatedImportAssert",{}),p.has("recordAndTuple")){const n=p.get("recordAndTuple").syntaxType;if(n!=null){const o=["hash","bar"];if(!o.includes(n))throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+o.map(l=>`'${l}'`).join(", "))}}if(p.has("asyncDoExpressions")&&!p.has("doExpressions")){const n=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw n.missingPlugins="doExpressions",n}if(p.has("optionalChainingAssign")&&p.get("optionalChainingAssign").version!=="2023-07")throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");if(p.has("discardBinding")&&p.get("discardBinding").syntaxType!=="void")throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.")}const ua={estree:Wt,jsx:wh,flow:bh,typescript:qh,v8intrinsic:ep,placeholders:Qh},sp=Object.keys(ua);class ip extends Hh{checkProto(r,t,n,o){if(r.type==="SpreadElement"||this.isObjectMethod(r)||r.computed||r.shorthand)return n;const l=r.key;return(l.type==="Identifier"?l.name:l.value)==="__proto__"?t?(this.raise(S.RecordNoProto,l),!0):(n&&(o?o.doubleProtoLoc===null&&(o.doubleProtoLoc=l.loc.start):this.raise(S.DuplicateProto,l)),!0):n}shouldExitDescending(r,t){return r.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(r.start)===t}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(140))throw this.raise(S.ParseExpressionEmptyInput,this.state.startLoc);const r=this.parseExpression();if(!this.match(140))throw this.raise(S.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),r.comments=this.comments,r.errors=this.state.errors,this.optionFlags&256&&(r.tokens=this.tokens),r}parseExpression(r,t){return r?this.disallowInAnd(()=>this.parseExpressionBase(t)):this.allowInAnd(()=>this.parseExpressionBase(t))}parseExpressionBase(r){const t=this.state.startLoc,n=this.parseMaybeAssign(r);if(this.match(12)){const o=this.startNodeAt(t);for(o.expressions=[n];this.eat(12);)o.expressions.push(this.parseMaybeAssign(r));return this.toReferencedList(o.expressions),this.finishNode(o,"SequenceExpression")}return n}parseMaybeAssignDisallowIn(r,t){return this.disallowInAnd(()=>this.parseMaybeAssign(r,t))}parseMaybeAssignAllowIn(r,t){return this.allowInAnd(()=>this.parseMaybeAssign(r,t))}setOptionalParametersError(r){r.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(r,t){const n=this.state.startLoc,o=this.isContextual(108);if(o&&this.prodParam.hasYield){this.next();let g=this.parseYield(n);return t&&(g=t.call(this,g,n)),g}let l;r?l=!1:(r=new qs,l=!0);const{type:d}=this.state;(d===10||ie(d))&&(this.state.potentialArrowAt=this.state.start);let m=this.parseMaybeConditional(r);if(t&&(m=t.call(this,m,n)),Yu(this.state.type)){const g=this.startNodeAt(n),E=this.state.value;if(g.operator=E,this.match(29)){this.toAssignable(m,!0),g.left=m;const b=n.index;r.doubleProtoLoc!=null&&r.doubleProtoLoc.index>=b&&(r.doubleProtoLoc=null),r.shorthandAssignLoc!=null&&r.shorthandAssignLoc.index>=b&&(r.shorthandAssignLoc=null),r.privateKeyLoc!=null&&r.privateKeyLoc.index>=b&&(this.checkDestructuringPrivate(r),r.privateKeyLoc=null),r.voidPatternLoc!=null&&r.voidPatternLoc.index>=b&&(r.voidPatternLoc=null)}else g.left=m;return this.next(),g.right=this.parseMaybeAssign(),this.checkLVal(m,this.finishNode(g,"AssignmentExpression"),void 0,void 0,void 0,void 0,E==="||="||E==="&&="||E==="??="),g}else l&&this.checkExpressionErrors(r,!0);if(o){const{type:g}=this.state;if((this.hasPlugin("v8intrinsic")?Ss(g):Ss(g)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(S.YieldNotInGeneratorFunction,n),this.parseYield(n)}return m}parseMaybeConditional(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseExprOps(r);return this.shouldExitDescending(o,n)?o:this.parseConditional(o,t,r)}parseConditional(r,t,n){if(this.eat(17)){const o=this.startNodeAt(t);return o.test=r,o.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),o.alternate=this.parseMaybeAssign(),this.finishNode(o,"ConditionalExpression")}return r}parseMaybeUnaryOrPrivate(r){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(r)}parseExprOps(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseMaybeUnaryOrPrivate(r);return this.shouldExitDescending(o,n)?o:this.parseExprOp(o,t,-1)}parseExprOp(r,t,n){if(this.isPrivateName(r)){const l=this.getPrivateNameSV(r);(n>=Vs(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(S.PrivateInExpectedIn,r,{identifierName:l}),this.classScope.usePrivateName(l,r.loc.start)}const o=this.state.type;if(Xu(o)&&(this.prodParam.hasIn||!this.match(58))){let l=Vs(o);if(l>n){if(o===39){if(this.expectPlugin("pipelineOperator"),this.state.inFSharpPipelineDirectBody)return r;this.checkPipelineAtInfixOperator(r,t)}const d=this.startNodeAt(t);d.left=r,d.operator=this.state.value;const m=o===41||o===42,g=o===40;if(g&&(l=Vs(42)),this.next(),o===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])&&this.state.type===96&&this.prodParam.hasAwait)throw this.raise(S.UnexpectedAwaitAfterPipelineBody,this.state.startLoc);d.right=this.parseExprOpRightExpr(o,l);const E=this.finishNode(d,m||g?"LogicalExpression":"BinaryExpression"),b=this.state.type;if(g&&(b===41||b===42)||m&&b===40)throw this.raise(S.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(E,t,n)}}return r}parseExprOpRightExpr(r,t){const n=this.state.startLoc;switch(r){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"fsharp":return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(t))}if(this.getPluginOption("pipelineOperator","proposal")==="smart")return this.withTopicBindingContext(()=>{if(this.prodParam.hasYield&&this.isContextual(108))throw this.raise(S.PipeBodyIsTighter,this.state.startLoc);return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(r,t),n)});default:return this.parseExprOpBaseRightExpr(r,t)}}parseExprOpBaseRightExpr(r,t){const n=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),n,ih(r)?t-1:t)}parseHackPipeBody(){var r;const{startLoc:t}=this.state,n=this.parseMaybeAssign();return P.has(n.type)&&!((r=n.extra)!=null&&r.parenthesized)&&this.raise(S.PipeUnparenthesizedBody,t,{type:n.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(S.PipeTopicUnused,t),n}checkExponentialAfterUnary(r){this.match(57)&&this.raise(S.UnexpectedTokenUnaryExponentiation,r.argument)}parseMaybeUnary(r,t){const n=this.state.startLoc,o=this.isContextual(96);if(o&&this.recordAwaitIfAllowed()){this.next();const g=this.parseAwait(n);return t||this.checkExponentialAfterUnary(g),g}const l=this.match(34),d=this.startNode();if(eh(this.state.type)){d.operator=this.state.value,d.prefix=!0,this.match(72)&&this.expectPlugin("throwExpressions");const g=this.match(89);if(this.next(),d.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(r,!0),this.state.strict&&g){const E=d.argument;E.type==="Identifier"?this.raise(S.StrictDelete,d):this.hasPropertyAsPrivateName(E)&&this.raise(S.DeletePrivateField,d)}if(!l)return t||this.checkExponentialAfterUnary(d),this.finishNode(d,"UnaryExpression")}const m=this.parseUpdate(d,l,r);if(o){const{type:g}=this.state;if((this.hasPlugin("v8intrinsic")?Ss(g):Ss(g)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(S.AwaitNotInAsyncContext,n),this.parseAwait(n)}return m}parseUpdate(r,t,n){if(t){const d=r;return this.checkLVal(d.argument,this.finishNode(d,"UpdateExpression")),r}const o=this.state.startLoc;let l=this.parseExprSubscripts(n);if(this.checkExpressionErrors(n,!1))return l;for(;Qu(this.state.type)&&!this.canInsertSemicolon();){const d=this.startNodeAt(o);d.operator=this.state.value,d.prefix=!1,d.argument=l,this.next(),this.checkLVal(l,l=this.finishNode(d,"UpdateExpression"))}return l}parseExprSubscripts(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseExprAtom(r);return this.shouldExitDescending(o,n)?o:this.parseSubscripts(o,t)}parseSubscripts(r,t,n){const o={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(r),stop:!1};do r=this.parseSubscript(r,t,n,o),o.maybeAsyncArrow=!1;while(!o.stop);return r}parseSubscript(r,t,n,o){const{type:l}=this.state;if(!n&&l===15)return this.parseBind(r,t,n,o);if(Gs(l))return this.parseTaggedTemplateExpression(r,t,o);let d=!1;if(l===18){if(n&&(this.raise(S.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40))return this.stopParseSubscript(r,o);o.optionalChainMember=d=!0,this.next()}if(!n&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(r,t,o,d);{const m=this.eat(0);return m||d||this.eat(16)?this.parseMember(r,t,o,m,d):this.stopParseSubscript(r,o)}}stopParseSubscript(r,t){return t.stop=!0,r}parseMember(r,t,n,o,l){const d=this.startNodeAt(t);return d.object=r,d.computed=o,o?(d.property=this.parseExpression(),this.expect(3)):this.match(139)?(r.type==="Super"&&this.raise(S.SuperPrivateField,t),this.classScope.usePrivateName(this.state.value,this.state.startLoc),d.property=this.parsePrivateName()):d.property=this.parseIdentifier(!0),n.optionalChainMember?(d.optional=l,this.finishNode(d,"OptionalMemberExpression")):this.finishNode(d,"MemberExpression")}parseBind(r,t,n,o){const l=this.startNodeAt(t);return l.object=r,this.next(),l.callee=this.parseNoCallExpr(),o.stop=!0,this.parseSubscripts(this.finishNode(l,"BindExpression"),t,n)}parseCoverCallAndAsyncArrowHead(r,t,n,o){const l=this.state.maybeInArrowParameters;let d=null;this.state.maybeInArrowParameters=!0,this.next();const m=this.startNodeAt(t);m.callee=r;const{maybeAsyncArrow:g,optionalChainMember:E}=n;g&&(this.expressionScope.enter(zh()),d=new qs),E&&(m.optional=o),o?m.arguments=this.parseCallExpressionArguments():m.arguments=this.parseCallExpressionArguments(r.type!=="Super",m,d);let b=this.finishCallExpression(m,E);return g&&this.shouldParseAsyncArrow()&&!o?(n.stop=!0,this.checkDestructuringPrivate(d),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),b=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),b)):(g&&(this.checkExpressionErrors(d,!0),this.expressionScope.exit()),this.toReferencedArguments(b)),this.state.maybeInArrowParameters=l,b}toReferencedArguments(r,t){this.toReferencedListDeep(r.arguments,t)}parseTaggedTemplateExpression(r,t,n){const o=this.startNodeAt(t);return o.tag=r,o.quasi=this.parseTemplate(!0),n.optionalChainMember&&this.raise(S.OptionalChainingNoTemplate,t),this.finishNode(o,"TaggedTemplateExpression")}atPossibleAsyncArrow(r){return r.type==="Identifier"&&r.name==="async"&&this.state.lastTokEndLoc.index===r.end&&!this.canInsertSemicolon()&&r.end-r.start===5&&this.offsetToSourcePos(r.start)===this.state.potentialArrowAt}finishCallExpression(r,t){if(r.callee.type==="Import")if(r.arguments.length===0||r.arguments.length>2)this.raise(S.ImportCallArity,r);else for(const n of r.arguments)n.type==="SpreadElement"&&this.raise(S.ImportCallSpreadArgument,n);return this.finishNode(r,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(r,t,n){const o=[];let l=!0;const d=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(11);){if(l)l=!1;else if(this.expect(12),this.match(11)){t&&this.addTrailingCommaExtraToNode(t),this.next();break}o.push(this.parseExprListItem(11,!1,n,r))}return this.state.inFSharpPipelineDirectBody=d,o}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(r,t){var n;return this.resetPreviousNodeTrailingComments(t),this.expect(19),this.parseArrowExpression(r,t.arguments,!0,(n=t.extra)==null?void 0:n.trailingCommaLoc),t.innerComments&&bs(r,t.innerComments),t.callee.trailingComments&&bs(r,t.callee.trailingComments),r}parseNoCallExpr(){const r=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),r,!0)}parseExprAtom(r){let t,n=null;const{type:o}=this.state;switch(o){case 79:return this.parseSuper();case 83:return t=this.startNode(),this.next(),this.match(16)?this.parseImportMetaPropertyOrPhaseCall(t):this.match(10)?this.optionFlags&512?this.parseImportCall(t):this.finishNode(t,"Import"):(this.raise(S.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(t,"Import"));case 78:return t=this.startNode(),this.next(),this.finishNode(t,"ThisExpression");case 90:return this.parseDo(this.startNode(),!1);case 56:case 31:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(!0);case 86:return this.parseBooleanLiteral(!1);case 10:{const l=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(l)}case 0:return this.parseArrayLike(3,!1,r);case 5:return this.parseObjectLike(8,!1,!1,r);case 68:return this.parseFunctionOrFunctionSent();case 26:n=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(n,this.startNode()),!1);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(!1);case 15:{t=this.startNode(),this.next(),t.object=null;const l=t.callee=this.parseNoCallExpr();if(l.type==="MemberExpression")return this.finishNode(t,"BindExpression");throw this.raise(S.UnsupportedBind,l)}case 139:return this.raise(S.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 33:return this.parseTopicReferenceThenEqualsSign(54,"%");case 32:return this.parseTopicReferenceThenEqualsSign(44,"^");case 37:case 38:return this.parseTopicReference("hack");case 44:case 54:case 27:{const l=this.getPluginOption("pipelineOperator","proposal");if(l)return this.parseTopicReference(l);throw this.unexpected()}case 47:{const l=this.input.codePointAt(this.nextTokenStart());throw nt(l)||l===62?this.expectOnePlugin(["jsx","flow","typescript"]):this.unexpected()}default:if(o===137)return this.parseDecimalLiteral(this.state.value);if(o===2||o===1)return this.parseArrayLike(this.state.type===2?4:3,!0);if(o===6||o===7)return this.parseObjectLike(this.state.type===6?9:8,!1,!0);if(ie(o)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();const l=this.state.potentialArrowAt===this.state.start,d=this.state.containsEsc,m=this.parseIdentifier();if(!d&&m.name==="async"&&!this.canInsertSemicolon()){const{type:g}=this.state;if(g===68)return this.resetPreviousNodeTrailingComments(m),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(m));if(ie(g))return l&&this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(m)):m;if(g===90)return this.resetPreviousNodeTrailingComments(m),this.parseDo(this.startNodeAtNode(m),!0)}return l&&this.match(19)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(m),[m],!1)):m}else throw this.unexpected()}}parseTopicReferenceThenEqualsSign(r,t){const n=this.getPluginOption("pipelineOperator","proposal");if(n)return this.state.type=r,this.state.value=t,this.state.pos--,this.state.end--,this.state.endLoc=a(this.state.endLoc,-1),this.parseTopicReference(n);throw this.unexpected()}parseTopicReference(r){const t=this.startNode(),n=this.state.startLoc,o=this.state.type;return this.next(),this.finishTopicReference(t,n,r,o)}finishTopicReference(r,t,n,o){if(this.testTopicReferenceConfiguration(n,t,o))return n==="hack"?(this.topicReferenceIsAllowedInCurrentContext()||this.raise(S.PipeTopicUnbound,t),this.registerTopicReference(),this.finishNode(r,"TopicReference")):(this.topicReferenceIsAllowedInCurrentContext()||this.raise(S.PrimaryTopicNotAllowed,t),this.registerTopicReference(),this.finishNode(r,"PipelinePrimaryTopicReference"));throw this.raise(S.PipeTopicUnconfiguredToken,t,{token:It(o)})}testTopicReferenceConfiguration(r,t,n){switch(r){case"hack":return this.hasPlugin(["pipelineOperator",{topicToken:It(n)}]);case"smart":return n===27;default:throw this.raise(S.PipeTopicRequiresHackPipes,t)}}parseAsyncArrowUnaryFunction(r){this.prodParam.enter(Zs(!0,this.prodParam.hasYield));const t=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(S.LineTerminatorBeforeArrow,this.state.curPosition()),this.expect(19),this.parseArrowExpression(r,t,!0)}parseDo(r,t){this.expectPlugin("doExpressions"),t&&this.expectPlugin("asyncDoExpressions"),r.async=t,this.next();const n=this.state.labels;return this.state.labels=[],t?(this.prodParam.enter(2),r.body=this.parseBlock(),this.prodParam.exit()):r.body=this.parseBlock(),this.state.labels=n,this.finishNode(r,"DoExpression")}parseSuper(){const r=this.startNode();return this.next(),this.match(10)&&!this.scope.allowDirectSuper?this.optionFlags&16||this.raise(S.SuperNotAllowed,r):this.scope.allowSuper||this.optionFlags&16||this.raise(S.UnexpectedSuper,r),!this.match(10)&&!this.match(0)&&!this.match(16)&&this.raise(S.UnsupportedSuper,r),this.finishNode(r,"Super")}parsePrivateName(){const r=this.startNode(),t=this.startNodeAt(a(this.state.startLoc,1)),n=this.state.value;return this.next(),r.id=this.createIdentifier(t,n),this.finishNode(r,"PrivateName")}parseFunctionOrFunctionSent(){const r=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(r),"function");return this.next(),this.match(103)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(r,t,"sent")}return this.parseFunction(r)}parseMetaProperty(r,t,n){r.meta=t;const o=this.state.containsEsc;return r.property=this.parseIdentifier(!0),(r.property.name!==n||o)&&this.raise(S.UnsupportedMetaProperty,r.property,{target:t.name,onlyValidPropertyName:n}),this.finishNode(r,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(r){if(this.next(),this.isContextual(105)||this.isContextual(97)){const t=this.isContextual(105);return this.expectPlugin(t?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),r.phase=t?"source":"defer",this.parseImportCall(r)}else{const t=this.createIdentifierAt(this.startNodeAtNode(r),"import",this.state.lastTokStartLoc);return this.isContextual(101)&&(this.inModule||this.raise(S.ImportMetaOutsideModule,t),this.sawUnambiguousESM=!0),this.parseMetaProperty(r,t,"meta")}}parseLiteralAtNode(r,t,n){return this.addExtra(n,"rawValue",r),this.addExtra(n,"raw",this.input.slice(this.offsetToSourcePos(n.start),this.state.end)),n.value=r,this.next(),this.finishNode(n,t)}parseLiteral(r,t){const n=this.startNode();return this.parseLiteralAtNode(r,t,n)}parseStringLiteral(r){return this.parseLiteral(r,"StringLiteral")}parseNumericLiteral(r){return this.parseLiteral(r,"NumericLiteral")}parseBigIntLiteral(r){return this.parseLiteral(r,"BigIntLiteral")}parseDecimalLiteral(r){return this.parseLiteral(r,"DecimalLiteral")}parseRegExpLiteral(r){const t=this.startNode();return this.addExtra(t,"raw",this.input.slice(this.offsetToSourcePos(t.start),this.state.end)),t.pattern=r.pattern,t.flags=r.flags,this.next(),this.finishNode(t,"RegExpLiteral")}parseBooleanLiteral(r){const t=this.startNode();return t.value=r,this.next(),this.finishNode(t,"BooleanLiteral")}parseNullLiteral(){const r=this.startNode();return this.next(),this.finishNode(r,"NullLiteral")}parseParenAndDistinguishExpression(r){const t=this.state.startLoc;let n;this.next(),this.expressionScope.enter(jh());const o=this.state.maybeInArrowParameters,l=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.inFSharpPipelineDirectBody=!1;const d=this.state.startLoc,m=[],g=new qs;let E=!0,b,I;for(;!this.match(11);){if(E)E=!1;else if(this.expect(12,g.optionalParametersLoc===null?null:g.optionalParametersLoc),this.match(11)){I=this.state.startLoc;break}if(this.match(21)){const M=this.state.startLoc;if(b=this.state.startLoc,m.push(this.parseParenItem(this.parseRestBinding(),M)),!this.checkCommaAfterRest(41))break}else m.push(this.parseMaybeAssignAllowInOrVoidPattern(11,g,this.parseParenItem))}const C=this.state.lastTokEndLoc;this.expect(11),this.state.maybeInArrowParameters=o,this.state.inFSharpPipelineDirectBody=l;let N=this.startNodeAt(t);return r&&this.shouldParseArrow(m)&&(N=this.parseArrow(N))?(this.checkDestructuringPrivate(g),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(N,m,!1),N):(this.expressionScope.exit(),m.length||this.unexpected(this.state.lastTokStartLoc),I&&this.unexpected(I),b&&this.unexpected(b),this.checkExpressionErrors(g,!0),this.toReferencedListDeep(m,!0),m.length>1?(n=this.startNodeAt(d),n.expressions=m,this.finishNode(n,"SequenceExpression"),this.resetEndLocation(n,C)):n=m[0],this.wrapParenthesis(t,n))}wrapParenthesis(r,t){if(!(this.optionFlags&1024))return this.addExtra(t,"parenthesized",!0),this.addExtra(t,"parenStart",r.index),this.takeSurroundingComments(t,r.index,this.state.lastTokEndLoc.index),t;const n=this.startNodeAt(r);return n.expression=t,this.finishNode(n,"ParenthesizedExpression")}shouldParseArrow(r){return!this.canInsertSemicolon()}parseArrow(r){if(this.eat(19))return r}parseParenItem(r,t){return r}parseNewOrNewTarget(){const r=this.startNode();if(this.next(),this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(r),"new");this.next();const n=this.parseMetaProperty(r,t,"target");return this.scope.allowNewTarget||this.raise(S.UnexpectedNewTarget,n),n}return this.parseNew(r)}parseNew(r){if(this.parseNewCallee(r),this.eat(10)){const t=this.parseExprList(11);this.toReferencedList(t),r.arguments=t}else r.arguments=[];return this.finishNode(r,"NewExpression")}parseNewCallee(r){const t=this.match(83),n=this.parseNoCallExpr();r.callee=n,t&&(n.type==="Import"||n.type==="ImportExpression")&&this.raise(S.ImportCallNotNewExpression,n)}parseTemplateElement(r){const{start:t,startLoc:n,end:o,value:l}=this.state,d=t+1,m=this.startNodeAt(a(n,1));l===null&&(r||this.raise(S.InvalidEscapeSequenceTemplate,a(this.state.firstInvalidTemplateEscapePos,1)));const g=this.match(24),E=g?-1:-2,b=o+E;m.value={raw:this.input.slice(d,b).replace(/\r\n?/g,`
|
|
46
|
-
`),cooked:l===null?null:l.slice(1,E)},m.tail=g,this.next();const I=this.finishNode(m,"TemplateElement");return this.resetEndLocation(I,a(this.state.lastTokEndLoc,E)),I}parseTemplate(r){const t=this.startNode();let n=this.parseTemplateElement(r);const o=[n],l=[];for(;!n.tail;)l.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),o.push(n=this.parseTemplateElement(r));return t.expressions=l,t.quasis=o,this.finishNode(t,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(r,t,n,o){n&&this.expectPlugin("recordAndTuple");const l=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let d=!1,m=!0;const g=this.startNode();for(g.properties=[],this.next();!this.match(r);){if(m)m=!1;else if(this.expect(12),this.match(r)){this.addTrailingCommaExtraToNode(g);break}let b;t?b=this.parseBindingProperty():(b=this.parsePropertyDefinition(o),d=this.checkProto(b,n,d,o)),n&&!this.isObjectProperty(b)&&b.type!=="SpreadElement"&&this.raise(S.InvalidRecordProperty,b),b.shorthand&&this.addExtra(b,"shorthand",!0),g.properties.push(b)}this.next(),this.state.inFSharpPipelineDirectBody=l;let E="ObjectExpression";return t?E="ObjectPattern":n&&(E="RecordExpression"),this.finishNode(g,E)}addTrailingCommaExtraToNode(r){this.addExtra(r,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(r,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(r){return!r.computed&&r.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(r){let t=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(S.UnsupportedPropertyDecorator,this.state.startLoc);this.match(26);)t.push(this.parseDecorator());const n=this.startNode();let o=!1,l=!1,d;if(this.match(21))return t.length&&this.unexpected(),this.parseSpread();t.length&&(n.decorators=t,t=[]),n.method=!1,r&&(d=this.state.startLoc);let m=this.eat(55);this.parsePropertyNamePrefixOperator(n);const g=this.state.containsEsc;if(this.parsePropertyName(n,r),!m&&!g&&this.maybeAsyncOrAccessorProp(n)){const{key:E}=n,b=E.name;b==="async"&&!this.hasPrecedingLineBreak()&&(o=!0,this.resetPreviousNodeTrailingComments(E),m=this.eat(55),this.parsePropertyName(n)),(b==="get"||b==="set")&&(l=!0,this.resetPreviousNodeTrailingComments(E),n.kind=b,this.match(55)&&(m=!0,this.raise(S.AccessorIsGenerator,this.state.curPosition(),{kind:b}),this.next()),this.parsePropertyName(n))}return this.parseObjPropValue(n,d,m,o,!1,l,r)}getGetterSetterExpectedParamCount(r){return r.kind==="get"?0:1}getObjectOrClassMethodParams(r){return r.params}checkGetterSetterParams(r){var t;const n=this.getGetterSetterExpectedParamCount(r),o=this.getObjectOrClassMethodParams(r);o.length!==n&&this.raise(r.kind==="get"?S.BadGetterArity:S.BadSetterArity,r),r.kind==="set"&&((t=o[o.length-1])==null?void 0:t.type)==="RestElement"&&this.raise(S.BadSetterRestParameter,r)}parseObjectMethod(r,t,n,o,l){if(l){const d=this.parseMethod(r,t,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(d),d}if(n||t||this.match(10))return o&&this.unexpected(),r.kind="method",r.method=!0,this.parseMethod(r,t,n,!1,!1,"ObjectMethod")}parseObjectProperty(r,t,n,o){if(r.shorthand=!1,this.eat(14))return r.value=n?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(8,o),this.finishObjectProperty(r);if(!r.computed&&r.key.type==="Identifier"){if(this.checkReservedWord(r.key.name,r.key.loc.start,!0,!1),n)r.value=this.parseMaybeDefault(t,this.cloneIdentifier(r.key));else if(this.match(29)){const l=this.state.startLoc;o!=null?o.shorthandAssignLoc===null&&(o.shorthandAssignLoc=l):this.raise(S.InvalidCoverInitializedName,l),r.value=this.parseMaybeDefault(t,this.cloneIdentifier(r.key))}else r.value=this.cloneIdentifier(r.key);return r.shorthand=!0,this.finishObjectProperty(r)}}finishObjectProperty(r){return this.finishNode(r,"ObjectProperty")}parseObjPropValue(r,t,n,o,l,d,m){const g=this.parseObjectMethod(r,n,o,l,d)||this.parseObjectProperty(r,t,l,m);return g||this.unexpected(),g}parsePropertyName(r,t){if(this.eat(0))r.computed=!0,r.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{const{type:n,value:o}=this.state;let l;if(Xe(n))l=this.parseIdentifier(!0);else switch(n){case 135:l=this.parseNumericLiteral(o);break;case 134:l=this.parseStringLiteral(o);break;case 136:l=this.parseBigIntLiteral(o);break;case 139:{const d=this.state.startLoc;t!=null?t.privateKeyLoc===null&&(t.privateKeyLoc=d):this.raise(S.UnexpectedPrivateField,d),l=this.parsePrivateName();break}default:if(n===137){l=this.parseDecimalLiteral(o);break}this.unexpected()}r.key=l,n!==139&&(r.computed=!1)}}initFunction(r,t){r.id=null,r.generator=!1,r.async=t}parseMethod(r,t,n,o,l,d,m=!1){this.initFunction(r,n),r.generator=t,this.scope.enter(530|(m?576:0)|(l?32:0)),this.prodParam.enter(Zs(n,r.generator)),this.parseFunctionParams(r,o);const g=this.parseFunctionBodyAndFinish(r,d,!0);return this.prodParam.exit(),this.scope.exit(),g}parseArrayLike(r,t,n){t&&this.expectPlugin("recordAndTuple");const o=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;const l=this.startNode();return this.next(),l.elements=this.parseExprList(r,!t,n,l),this.state.inFSharpPipelineDirectBody=o,this.finishNode(l,t?"TupleExpression":"ArrayExpression")}parseArrowExpression(r,t,n,o){this.scope.enter(518);let l=Zs(n,!1);!this.match(5)&&this.prodParam.hasIn&&(l|=8),this.prodParam.enter(l),this.initFunction(r,n);const d=this.state.maybeInArrowParameters;return t&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(r,t,o)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(r,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=d,this.finishNode(r,"ArrowFunctionExpression")}setArrowFunctionParameters(r,t,n){this.toAssignableList(t,n,!1),r.params=t}parseFunctionBodyAndFinish(r,t,n=!1){return this.parseFunctionBody(r,!1,n),this.finishNode(r,t)}parseFunctionBody(r,t,n=!1){const o=t&&!this.match(5);if(this.expressionScope.enter(sa()),o)r.body=this.parseMaybeAssign(),this.checkParams(r,!1,t,!1);else{const l=this.state.strict,d=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),r.body=this.parseBlock(!0,!1,m=>{const g=!this.isSimpleParamList(r.params);m&&g&&this.raise(S.IllegalLanguageModeDirective,(r.kind==="method"||r.kind==="constructor")&&r.key?r.key.loc.end:r);const E=!l&&this.state.strict;this.checkParams(r,!this.state.strict&&!t&&!n&&!g,t,E),this.state.strict&&r.id&&this.checkIdentifier(r.id,65,E)}),this.prodParam.exit(),this.state.labels=d}this.expressionScope.exit()}isSimpleParameter(r){return r.type==="Identifier"}isSimpleParamList(r){for(let t=0,n=r.length;t<n;t++)if(!this.isSimpleParameter(r[t]))return!1;return!0}checkParams(r,t,n,o=!0){const l=!t&&new Set,d={type:"FormalParameters"};for(const m of r.params)this.checkLVal(m,d,5,l,o)}parseExprList(r,t,n,o){const l=[];let d=!0;for(;!this.eat(r);){if(d)d=!1;else if(this.expect(12),this.match(r)){o&&this.addTrailingCommaExtraToNode(o),this.next();break}l.push(this.parseExprListItem(r,t,n))}return l}parseExprListItem(r,t,n,o){let l;if(this.match(12))t||this.raise(S.UnexpectedToken,this.state.curPosition(),{unexpected:","}),l=null;else if(this.match(21)){const d=this.state.startLoc;l=this.parseParenItem(this.parseSpread(n),d)}else if(this.match(17)){this.expectPlugin("partialApplication"),o||this.raise(S.UnexpectedArgumentPlaceholder,this.state.startLoc);const d=this.startNode();this.next(),l=this.finishNode(d,"ArgumentPlaceholder")}else l=this.parseMaybeAssignAllowInOrVoidPattern(r,n,this.parseParenItem);return l}parseIdentifier(r){const t=this.startNode(),n=this.parseIdentifierName(r);return this.createIdentifier(t,n)}createIdentifier(r,t){return r.name=t,r.loc.identifierName=t,this.finishNode(r,"Identifier")}createIdentifierAt(r,t,n){return r.name=t,r.loc.identifierName=t,this.finishNodeAt(r,"Identifier",n)}parseIdentifierName(r){let t;const{startLoc:n,type:o}=this.state;Xe(o)?t=this.state.value:this.unexpected();const l=Ku(o);return r?l&&this.replaceToken(132):this.checkReservedWord(t,n,l,!1),this.next(),t}checkReservedWord(r,t,n,o){if(r.length>10||!dh(r))return;if(n&&uh(r)){this.raise(S.UnexpectedKeyword,t,{keyword:r});return}if((this.state.strict?o?Wn:Hn:Gn)(r,this.inModule)){this.raise(S.UnexpectedReservedWord,t,{reservedWord:r});return}else if(r==="yield"){if(this.prodParam.hasYield){this.raise(S.YieldBindingIdentifier,t);return}}else if(r==="await"){if(this.prodParam.hasAwait){this.raise(S.AwaitBindingIdentifier,t);return}if(this.scope.inStaticBlock){this.raise(S.AwaitBindingIdentifierInStaticBlock,t);return}this.expressionScope.recordAsyncArrowParametersError(t)}else if(r==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(S.ArgumentsInClass,t);return}}recordAwaitIfAllowed(){const r=this.prodParam.hasAwait;return r&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),r}parseAwait(r){const t=this.startNodeAt(r);return this.expressionScope.recordParameterInitializerError(S.AwaitExpressionFormalParameter,t),this.eat(55)&&this.raise(S.ObsoleteAwaitStar,t),!this.scope.inFunction&&!(this.optionFlags&1)&&(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(t.argument=this.parseMaybeUnary(null,!0)),this.finishNode(t,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;const{type:r}=this.state;return r===53||r===10||r===0||Gs(r)||r===102&&!this.state.containsEsc||r===138||r===56||this.hasPlugin("v8intrinsic")&&r===54}parseYield(r){const t=this.startNodeAt(r);this.expressionScope.recordParameterInitializerError(S.YieldInParameter,t);let n=!1,o=null;if(!this.hasPrecedingLineBreak())switch(n=this.eat(55),this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!n)break;default:o=this.parseMaybeAssign()}return t.delegate=n,t.argument=o,this.finishNode(t,"YieldExpression")}parseImportCall(r){if(this.next(),r.source=this.parseMaybeAssignAllowIn(),r.options=null,this.eat(12)){if(this.match(11))this.addTrailingCommaExtraToNode(r.source);else if(r.options=this.parseMaybeAssignAllowIn(),this.eat(12)&&(this.addTrailingCommaExtraToNode(r.options),!this.match(11))){do this.parseMaybeAssignAllowIn();while(this.eat(12)&&!this.match(11));this.raise(S.ImportCallArity,r)}}return this.expect(11),this.finishNode(r,"ImportExpression")}checkPipelineAtInfixOperator(r,t){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&r.type==="SequenceExpression"&&this.raise(S.PipelineHeadSequenceExpression,t)}parseSmartPipelineBodyInStyle(r,t){if(this.isSimpleReference(r)){const n=this.startNodeAt(t);return n.callee=r,this.finishNode(n,"PipelineBareFunction")}else{const n=this.startNodeAt(t);return this.checkSmartPipeTopicBodyEarlyErrors(t),n.expression=r,this.finishNode(n,"PipelineTopicExpression")}}isSimpleReference(r){switch(r.type){case"MemberExpression":return!r.computed&&this.isSimpleReference(r.object);case"Identifier":return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(r){if(this.match(19))throw this.raise(S.PipelineBodyNoArrow,this.state.startLoc);this.topicReferenceWasUsedInCurrentContext()||this.raise(S.PipelineTopicUnused,r)}withTopicBindingContext(r){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return r()}finally{this.state.topicContext=t}}withSmartMixTopicForbiddingContext(r){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return r()}finally{this.state.topicContext=t}}else return r()}withSoloAwaitPermittingContext(r){const t=this.state.soloAwait;this.state.soloAwait=!0;try{return r()}finally{this.state.soloAwait=t}}allowInAnd(r){const t=this.prodParam.currentFlags();if(8&~t){this.prodParam.enter(t|8);try{return r()}finally{this.prodParam.exit()}}return r()}disallowInAnd(r){const t=this.prodParam.currentFlags();if(8&t){this.prodParam.enter(t&-9);try{return r()}finally{this.prodParam.exit()}}return r()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(r){const t=this.state.startLoc;this.state.potentialArrowAt=this.state.start;const n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;const o=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,r);return this.state.inFSharpPipelineDirectBody=n,o}parseModuleExpression(){this.expectPlugin("moduleBlocks");const r=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);const t=this.startNodeAt(this.state.endLoc);this.next();const n=this.initializeScopes(!0);this.enterInitialScopes();try{r.body=this.parseProgram(t,8,"module")}finally{n()}return this.finishNode(r,"ModuleExpression")}parseVoidPattern(r){this.expectPlugin("discardBinding");const t=this.startNode();return r!=null&&(r.voidPatternLoc=this.state.startLoc),this.next(),this.finishNode(t,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(r,t,n){if(t!=null&&this.match(88)){const o=this.lookaheadCharCode();if(o===44||o===(r===3?93:r===8?125:41)||o===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(t))}return this.parseMaybeAssignAllowIn(t,n)}parsePropertyNamePrefixOperator(r){}}const Sr={kind:1},rp={kind:2},np=/[\uD800-\uDFFF]/u,br=/in(?:stanceof)?/y;function ap(p,r,t){for(let n=0;n<p.length;n++){const o=p[n],{type:l}=o;if(typeof l=="number"){if(l===139){const{loc:d,start:m,value:g,end:E}=o,b=m+1,I=a(d.start,1);p.splice(n,1,new wt({type:ut(27),value:"#",start:m,end:b,startLoc:d.start,endLoc:I}),new wt({type:ut(132),value:g,start:b,end:E,startLoc:I,endLoc:d.end})),n++;continue}if(Gs(l)){const{loc:d,start:m,value:g,end:E}=o,b=m+1,I=a(d.start,1);let C;r.charCodeAt(m-t)===96?C=new wt({type:ut(22),value:"`",start:m,end:b,startLoc:d.start,endLoc:I}):C=new wt({type:ut(8),value:"}",start:m,end:b,startLoc:d.start,endLoc:I});let N,M,Q,le;l===24?(M=E-1,Q=a(d.end,-1),N=g===null?null:g.slice(1,-1),le=new wt({type:ut(22),value:"`",start:M,end:E,startLoc:Q,endLoc:d.end})):(M=E-2,Q=a(d.end,-2),N=g===null?null:g.slice(1,-2),le=new wt({type:ut(23),value:"${",start:M,end:E,startLoc:Q,endLoc:d.end})),p.splice(n,1,C,new wt({type:ut(20),value:N,start:b,end:M,startLoc:I,endLoc:Q}),le),n+=2;continue}o.type=ut(l)}}return p}class op extends ip{parseTopLevel(r,t){return r.program=this.parseProgram(t,140,this.options.sourceType==="module"?"module":"script"),r.comments=this.comments,this.optionFlags&256&&(r.tokens=ap(this.tokens,this.input,this.startIndex)),this.finishNode(r,"File")}parseProgram(r,t,n){if(r.sourceType=n,r.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(r,!0,!0,t),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(const[l,d]of Array.from(this.scope.undefinedExports))this.raise(S.ModuleExportUndefined,d,{localName:l});this.addExtra(r,"topLevelAwait",this.state.hasTopLevelAwait)}let o;return t===140?o=this.finishNode(r,"Program"):o=this.finishNodeAt(r,"Program",a(this.state.startLoc,-1)),o}stmtToDirective(r){const t=this.castNodeTo(r,"Directive"),n=this.castNodeTo(r.expression,"DirectiveLiteral"),o=n.value,l=this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end)),d=n.value=l.slice(1,-1);return this.addExtra(n,"raw",l),this.addExtra(n,"rawValue",d),this.addExtra(n,"expressionValue",o),t.value=n,delete r.expression,t}parseInterpreterDirective(){if(!this.match(28))return null;const r=this.startNode();return r.value=this.state.value,this.next(),this.finishNode(r,"InterpreterDirective")}isLet(){return this.isContextual(100)?this.hasFollowingBindingAtom():!1}isUsing(){return this.isContextual(107)?this.nextTokenIsIdentifierOnSameLine():!1}isForUsing(){if(!this.isContextual(107))return!1;const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);if(this.isUnparsedContextual(r,"of")){const n=this.lookaheadCharCodeSince(r+2);if(n!==61&&n!==58&&n!==59)return!1}return!!(this.chStartsBindingIdentifier(t,r)||this.isUnparsedContextual(r,"void"))}nextTokenIsIdentifierOnSameLine(){const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);return this.chStartsBindingIdentifier(t,r)}isAwaitUsing(){if(!this.isContextual(96))return!1;let r=this.nextTokenInLineStart();if(this.isUnparsedContextual(r,"using")){r=this.nextTokenInLineStartSince(r+5);const t=this.codePointAtPos(r);if(this.chStartsBindingIdentifier(t,r))return!0}return!1}chStartsBindingIdentifier(r,t){if(nt(r)){if(br.lastIndex=t,br.test(this.input)){const n=this.codePointAtPos(br.lastIndex);if(!kt(n)&&n!==92)return!1}return!0}else return r===92}chStartsBindingPattern(r){return r===91||r===123}hasFollowingBindingAtom(){const r=this.nextTokenStart(),t=this.codePointAtPos(r);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,r)}hasInLineFollowingBindingIdentifierOrBrace(){const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);return t===123||this.chStartsBindingIdentifier(t,r)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(r=!1){let t=0;return this.options.annexB&&!this.state.strict&&(t|=4,r&&(t|=8)),this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(r){let t=null;return this.match(26)&&(t=this.parseDecorators(!0)),this.parseStatementContent(r,t)}parseStatementContent(r,t){const n=this.state.type,o=this.startNode(),l=!!(r&2),d=!!(r&4),m=r&1;switch(n){case 60:return this.parseBreakContinueStatement(o,!0);case 63:return this.parseBreakContinueStatement(o,!1);case 64:return this.parseDebuggerStatement(o);case 90:return this.parseDoWhileStatement(o);case 91:return this.parseForStatement(o);case 68:if(this.lookaheadCharCode()===46)break;return d||this.raise(this.state.strict?S.StrictFunction:this.options.annexB?S.SloppyFunctionAnnexB:S.SloppyFunction,this.state.startLoc),this.parseFunctionStatement(o,!1,!l&&d);case 80:return l||this.unexpected(),this.parseClass(this.maybeTakeDecorators(t,o),!0);case 69:return this.parseIfStatement(o);case 70:return this.parseReturnStatement(o);case 71:return this.parseSwitchStatement(o);case 72:return this.parseThrowStatement(o);case 73:return this.parseTryStatement(o);case 96:if(this.isAwaitUsing())return this.allowsUsing()?l?this.recordAwaitIfAllowed()||this.raise(S.AwaitUsingNotInAsyncContext,o):this.raise(S.UnexpectedLexicalDeclaration,o):this.raise(S.UnexpectedUsingDeclaration,o),this.next(),this.parseVarStatement(o,"await using");break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;return this.allowsUsing()?l||this.raise(S.UnexpectedLexicalDeclaration,this.state.startLoc):this.raise(S.UnexpectedUsingDeclaration,this.state.startLoc),this.parseVarStatement(o,"using");case 100:{if(this.state.containsEsc)break;const b=this.nextTokenStart(),I=this.codePointAtPos(b);if(I!==91&&(!l&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(I,b)&&I!==123))break}case 75:l||this.raise(S.UnexpectedLexicalDeclaration,this.state.startLoc);case 74:{const b=this.state.value;return this.parseVarStatement(o,b)}case 92:return this.parseWhileStatement(o);case 76:return this.parseWithStatement(o);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(o);case 83:{const b=this.lookaheadCharCode();if(b===40||b===46)break}case 82:{!(this.optionFlags&8)&&!m&&this.raise(S.UnexpectedImportExport,this.state.startLoc),this.next();let b;return n===83?b=this.parseImport(o):b=this.parseExport(o,t),this.assertModuleNodeAllowed(b),b}default:if(this.isAsyncFunction())return l||this.raise(S.AsyncFunctionInSingleStatementContext,this.state.startLoc),this.next(),this.parseFunctionStatement(o,!0,!l&&d)}const g=this.state.value,E=this.parseExpression();return ie(n)&&E.type==="Identifier"&&this.eat(14)?this.parseLabeledStatement(o,g,E,r):this.parseExpressionStatement(o,E,t)}assertModuleNodeAllowed(r){!(this.optionFlags&8)&&!this.inModule&&this.raise(S.ImportOutsideModule,r)}decoratorsEnabledBeforeExport(){return this.hasPlugin("decorators-legacy")?!0:this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==!1}maybeTakeDecorators(r,t,n){if(r){var o;(o=t.decorators)!=null&&o.length?(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!="boolean"&&this.raise(S.DecoratorsBeforeAfterExport,t.decorators[0]),t.decorators.unshift(...r)):t.decorators=r,this.resetStartLocationFromNode(t,r[0]),n&&this.resetStartLocationFromNode(n,t)}return t}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(r){const t=[];do t.push(this.parseDecorator());while(this.match(26));if(this.match(82))r||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(S.DecoratorExportClass,this.state.startLoc);else if(!this.canHaveLeadingDecorator())throw this.raise(S.UnexpectedLeadingDecorator,this.state.startLoc);return t}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);const r=this.startNode();if(this.next(),this.hasPlugin("decorators")){const t=this.state.startLoc;let n;if(this.match(10)){const o=this.state.startLoc;this.next(),n=this.parseExpression(),this.expect(11),n=this.wrapParenthesis(o,n);const l=this.state.startLoc;r.expression=this.parseMaybeDecoratorArguments(n,o),this.getPluginOption("decorators","allowCallParenthesized")===!1&&r.expression!==n&&this.raise(S.DecoratorArgumentsOutsideParentheses,l)}else{for(n=this.parseIdentifier(!1);this.eat(16);){const o=this.startNodeAt(t);o.object=n,this.match(139)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),o.property=this.parsePrivateName()):o.property=this.parseIdentifier(!0),o.computed=!1,n=this.finishNode(o,"MemberExpression")}r.expression=this.parseMaybeDecoratorArguments(n,t)}}else r.expression=this.parseExprSubscripts();return this.finishNode(r,"Decorator")}parseMaybeDecoratorArguments(r,t){if(this.eat(10)){const n=this.startNodeAt(t);return n.callee=r,n.arguments=this.parseCallExpressionArguments(),this.toReferencedList(n.arguments),this.finishNode(n,"CallExpression")}return r}parseBreakContinueStatement(r,t){return this.next(),this.isLineTerminator()?r.label=null:(r.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(r,t),this.finishNode(r,t?"BreakStatement":"ContinueStatement")}verifyBreakContinue(r,t){let n;for(n=0;n<this.state.labels.length;++n){const o=this.state.labels[n];if((r.label==null||o.name===r.label.name)&&(o.kind!=null&&(t||o.kind===1)||r.label&&t))break}if(n===this.state.labels.length){const o=t?"BreakStatement":"ContinueStatement";this.raise(S.IllegalBreakContinue,r,{type:o})}}parseDebuggerStatement(r){return this.next(),this.semicolon(),this.finishNode(r,"DebuggerStatement")}parseHeaderExpression(){this.expect(10);const r=this.parseExpression();return this.expect(11),r}parseDoWhileStatement(r){return this.next(),this.state.labels.push(Sr),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.expect(92),r.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(r,"DoWhileStatement")}parseForStatement(r){this.next(),this.state.labels.push(Sr);let t=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()&&(t=this.state.startLoc,this.next()),this.scope.enter(0),this.expect(10),this.match(13))return t!==null&&this.unexpected(t),this.parseFor(r,null);const n=this.isContextual(100);{const g=this.isAwaitUsing(),E=g||this.isForUsing(),b=n&&this.hasFollowingBindingAtom()||E;if(this.match(74)||this.match(75)||b){const I=this.startNode();let C;g?(C="await using",this.recordAwaitIfAllowed()||this.raise(S.AwaitUsingNotInAsyncContext,this.state.startLoc),this.next()):C=this.state.value,this.next(),this.parseVar(I,!0,C);const N=this.finishNode(I,"VariableDeclaration"),M=this.match(58);return M&&E&&this.raise(S.ForInUsing,N),(M||this.isContextual(102))&&N.declarations.length===1?this.parseForIn(r,N,t):(t!==null&&this.unexpected(t),this.parseFor(r,N))}}const o=this.isContextual(95),l=new qs,d=this.parseExpression(!0,l),m=this.isContextual(102);if(m&&(n&&this.raise(S.ForOfLet,d),t===null&&o&&d.type==="Identifier"&&this.raise(S.ForOfAsync,d)),m||this.match(58)){this.checkDestructuringPrivate(l),this.toAssignable(d,!0);const g=m?"ForOfStatement":"ForInStatement";return this.checkLVal(d,{type:g}),this.parseForIn(r,d,t)}else this.checkExpressionErrors(l,!0);return t!==null&&this.unexpected(t),this.parseFor(r,d)}parseFunctionStatement(r,t,n){return this.next(),this.parseFunction(r,1|(n?2:0)|(t?8:0))}parseIfStatement(r){return this.next(),r.test=this.parseHeaderExpression(),r.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),r.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(r,"IfStatement")}parseReturnStatement(r){return this.prodParam.hasReturn||this.raise(S.IllegalReturn,this.state.startLoc),this.next(),this.isLineTerminator()?r.argument=null:(r.argument=this.parseExpression(),this.semicolon()),this.finishNode(r,"ReturnStatement")}parseSwitchStatement(r){this.next(),r.discriminant=this.parseHeaderExpression();const t=r.cases=[];this.expect(5),this.state.labels.push(rp),this.scope.enter(256);let n;for(let o;!this.match(8);)if(this.match(61)||this.match(65)){const l=this.match(61);n&&this.finishNode(n,"SwitchCase"),t.push(n=this.startNode()),n.consequent=[],this.next(),l?n.test=this.parseExpression():(o&&this.raise(S.MultipleDefaultsInSwitch,this.state.lastTokStartLoc),o=!0,n.test=null),this.expect(14)}else n?n.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),n&&this.finishNode(n,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(r,"SwitchStatement")}parseThrowStatement(r){return this.next(),this.hasPrecedingLineBreak()&&this.raise(S.NewlineAfterThrow,this.state.lastTokEndLoc),r.argument=this.parseExpression(),this.semicolon(),this.finishNode(r,"ThrowStatement")}parseCatchClauseParam(){const r=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&r.type==="Identifier"?8:0),this.checkLVal(r,{type:"CatchClause"},9),r}parseTryStatement(r){if(this.next(),r.block=this.parseBlock(),r.handler=null,this.match(62)){const t=this.startNode();this.next(),this.match(10)?(this.expect(10),t.param=this.parseCatchClauseParam(),this.expect(11)):(t.param=null,this.scope.enter(0)),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),r.handler=this.finishNode(t,"CatchClause")}return r.finalizer=this.eat(67)?this.parseBlock():null,!r.handler&&!r.finalizer&&this.raise(S.NoCatchOrFinally,r),this.finishNode(r,"TryStatement")}parseVarStatement(r,t,n=!1){return this.next(),this.parseVar(r,!1,t,n),this.semicolon(),this.finishNode(r,"VariableDeclaration")}parseWhileStatement(r){return this.next(),r.test=this.parseHeaderExpression(),this.state.labels.push(Sr),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(r,"WhileStatement")}parseWithStatement(r){return this.state.strict&&this.raise(S.StrictWith,this.state.startLoc),this.next(),r.object=this.parseHeaderExpression(),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(r,"WithStatement")}parseEmptyStatement(r){return this.next(),this.finishNode(r,"EmptyStatement")}parseLabeledStatement(r,t,n,o){for(const d of this.state.labels)d.name===t&&this.raise(S.LabelRedeclaration,n,{labelName:t});const l=Ju(this.state.type)?1:this.match(71)?2:null;for(let d=this.state.labels.length-1;d>=0;d--){const m=this.state.labels[d];if(m.statementStart===r.start)m.statementStart=this.sourceToOffsetPos(this.state.start),m.kind=l;else break}return this.state.labels.push({name:t,kind:l,statementStart:this.sourceToOffsetPos(this.state.start)}),r.body=o&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),r.label=n,this.finishNode(r,"LabeledStatement")}parseExpressionStatement(r,t,n){return r.expression=t,this.semicolon(),this.finishNode(r,"ExpressionStatement")}parseBlock(r=!1,t=!0,n){const o=this.startNode();return r&&this.state.strictErrors.clear(),this.expect(5),t&&this.scope.enter(0),this.parseBlockBody(o,r,!1,8,n),t&&this.scope.exit(),this.finishNode(o,"BlockStatement")}isValidDirective(r){return r.type==="ExpressionStatement"&&r.expression.type==="StringLiteral"&&!r.expression.extra.parenthesized}parseBlockBody(r,t,n,o,l){const d=r.body=[],m=r.directives=[];this.parseBlockOrModuleBlockBody(d,t?m:void 0,n,o,l)}parseBlockOrModuleBlockBody(r,t,n,o,l){const d=this.state.strict;let m=!1,g=!1;for(;!this.match(o);){const E=n?this.parseModuleItem():this.parseStatementListItem();if(t&&!g){if(this.isValidDirective(E)){const b=this.stmtToDirective(E);t.push(b),!m&&b.value.value==="use strict"&&(m=!0,this.setStrict(!0));continue}g=!0,this.state.strictErrors.clear()}r.push(E)}l?.call(this,m),d||this.setStrict(!1),this.next()}parseFor(r,t){return r.init=t,this.semicolon(!1),r.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),r.update=this.match(11)?null:this.parseExpression(),this.expect(11),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(r,"ForStatement")}parseForIn(r,t,n){const o=this.match(58);return this.next(),o?n!==null&&this.unexpected(n):r.await=n!==null,t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!o||!this.options.annexB||this.state.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(S.ForInOfLoopInitializer,t,{type:o?"ForInStatement":"ForOfStatement"}),t.type==="AssignmentPattern"&&this.raise(S.InvalidLhs,t,{ancestor:{type:"ForStatement"}}),r.left=t,r.right=o?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(r,o?"ForInStatement":"ForOfStatement")}parseVar(r,t,n,o=!1){const l=r.declarations=[];for(r.kind=n;;){const d=this.startNode();if(this.parseVarId(d,n),d.init=this.eat(29)?t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,d.init===null&&!o&&(d.id.type!=="Identifier"&&!(t&&(this.match(58)||this.isContextual(102)))?this.raise(S.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"}):(n==="const"||n==="using"||n==="await using")&&!(this.match(58)||this.isContextual(102))&&this.raise(S.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:n})),l.push(this.finishNode(d,"VariableDeclarator")),!this.eat(12))break}return r}parseVarId(r,t){const n=this.parseBindingAtom();t==="using"||t==="await using"?(n.type==="ArrayPattern"||n.type==="ObjectPattern")&&this.raise(S.UsingDeclarationHasBindingPattern,n.loc.start):n.type==="VoidPattern"&&this.raise(S.UnexpectedVoidPattern,n.loc.start),this.checkLVal(n,{type:"VariableDeclarator"},t==="var"?5:8201),r.id=n}parseAsyncFunctionExpression(r){return this.parseFunction(r,8)}parseFunction(r,t=0){const n=t&2,o=!!(t&1),l=o&&!(t&4),d=!!(t&8);this.initFunction(r,d),this.match(55)&&(n&&this.raise(S.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),r.generator=!0),o&&(r.id=this.parseFunctionId(l));const m=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(514),this.prodParam.enter(Zs(d,r.generator)),o||(r.id=this.parseFunctionId()),this.parseFunctionParams(r,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(r,o?"FunctionDeclaration":"FunctionExpression")}),this.prodParam.exit(),this.scope.exit(),o&&!n&&this.registerFunctionStatementId(r),this.state.maybeInArrowParameters=m,r}parseFunctionId(r){return r||ie(this.state.type)?this.parseIdentifier():null}parseFunctionParams(r,t){this.expect(10),this.expressionScope.enter(Uh()),r.params=this.parseBindingList(11,41,2|(t?4:0)),this.expressionScope.exit()}registerFunctionStatementId(r){r.id&&this.scope.declareName(r.id.name,!this.options.annexB||this.state.strict||r.generator||r.async?this.scope.treatFunctionsAsVar?5:8201:17,r.id.loc.start)}parseClass(r,t,n){this.next();const o=this.state.strict;return this.state.strict=!0,this.parseClassId(r,t,n),this.parseClassSuper(r),r.body=this.parseClassBody(!!r.superClass,o),this.finishNode(r,t?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}nameIsConstructor(r){return r.type==="Identifier"&&r.name==="constructor"||r.type==="StringLiteral"&&r.value==="constructor"}isNonstaticConstructor(r){return!r.computed&&!r.static&&this.nameIsConstructor(r.key)}parseClassBody(r,t){this.classScope.enter();const n={hadConstructor:!1,hadSuperClass:r};let o=[];const l=this.startNode();if(l.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(o.length>0)throw this.raise(S.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(26)){o.push(this.parseDecorator());continue}const d=this.startNode();o.length&&(d.decorators=o,this.resetStartLocationFromNode(d,o[0]),o=[]),this.parseClassMember(l,d,n),d.kind==="constructor"&&d.decorators&&d.decorators.length>0&&this.raise(S.DecoratorConstructor,d)}}),this.state.strict=t,this.next(),o.length)throw this.raise(S.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(l,"ClassBody")}parseClassMemberFromModifier(r,t){const n=this.parseIdentifier(!0);if(this.isClassMethod()){const o=t;return o.kind="method",o.computed=!1,o.key=n,o.static=!1,this.pushClassMethod(r,o,!1,!1,!1,!1),!0}else if(this.isClassProperty()){const o=t;return o.computed=!1,o.key=n,o.static=!1,r.body.push(this.parseClassProperty(o)),!0}return this.resetPreviousNodeTrailingComments(n),!1}parseClassMember(r,t,n){const o=this.isContextual(106);if(o){if(this.parseClassMemberFromModifier(r,t))return;if(this.eat(5)){this.parseClassStaticBlock(r,t);return}}this.parseClassMemberWithIsStatic(r,t,n,o)}parseClassMemberWithIsStatic(r,t,n,o){const l=t,d=t,m=t,g=t,E=t,b=l,I=l;if(t.static=o,this.parsePropertyNamePrefixOperator(t),this.eat(55)){b.kind="method";const H=this.match(139);if(this.parseClassElementName(b),this.parsePostMemberNameModifiers(b),H){this.pushClassPrivateMethod(r,d,!0,!1);return}this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsGenerator,l.key),this.pushClassMethod(r,l,!0,!1,!1,!1);return}const C=!this.state.containsEsc&&ie(this.state.type),N=this.parseClassElementName(t),M=C?N.name:null,Q=this.isPrivateName(N),le=this.state.startLoc;if(this.parsePostMemberNameModifiers(I),this.isClassMethod()){if(b.kind="method",Q){this.pushClassPrivateMethod(r,d,!1,!1);return}const H=this.isNonstaticConstructor(l);let oe=!1;H&&(l.kind="constructor",n.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(S.DuplicateConstructor,N),H&&this.hasPlugin("typescript")&&t.override&&this.raise(S.OverrideOnConstructor,N),n.hadConstructor=!0,oe=n.hadSuperClass),this.pushClassMethod(r,l,!1,!1,H,oe)}else if(this.isClassProperty())Q?this.pushClassPrivateProperty(r,g):this.pushClassProperty(r,m);else if(M==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(N);const H=this.eat(55);I.optional&&this.unexpected(le),b.kind="method";const oe=this.match(139);this.parseClassElementName(b),this.parsePostMemberNameModifiers(I),oe?this.pushClassPrivateMethod(r,d,H,!0):(this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsAsync,l.key),this.pushClassMethod(r,l,H,!0,!1,!1))}else if((M==="get"||M==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(N),b.kind=M;const H=this.match(139);this.parseClassElementName(l),H?this.pushClassPrivateMethod(r,d,!1,!1):(this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsAccessor,l.key),this.pushClassMethod(r,l,!1,!1,!1,!1)),this.checkGetterSetterParams(l)}else if(M==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(N);const H=this.match(139);this.parseClassElementName(m),this.pushClassAccessorProperty(r,E,H)}else this.isLineTerminator()?Q?this.pushClassPrivateProperty(r,g):this.pushClassProperty(r,m):this.unexpected()}parseClassElementName(r){const{type:t,value:n}=this.state;if((t===132||t===134)&&r.static&&n==="prototype"&&this.raise(S.StaticPrototype,this.state.startLoc),t===139){n==="constructor"&&this.raise(S.ConstructorClassPrivateField,this.state.startLoc);const o=this.parsePrivateName();return r.key=o,o}return this.parsePropertyName(r),r.key}parseClassStaticBlock(r,t){var n;this.scope.enter(720);const o=this.state.labels;this.state.labels=[],this.prodParam.enter(0);const l=t.body=[];this.parseBlockOrModuleBlockBody(l,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=o,r.body.push(this.finishNode(t,"StaticBlock")),(n=t.decorators)!=null&&n.length&&this.raise(S.DecoratorStaticBlock,t)}pushClassProperty(r,t){!t.computed&&this.nameIsConstructor(t.key)&&this.raise(S.ConstructorClassField,t.key),r.body.push(this.parseClassProperty(t))}pushClassPrivateProperty(r,t){const n=this.parseClassPrivateProperty(t);r.body.push(n),this.classScope.declarePrivateName(this.getPrivateNameSV(n.key),0,n.key.loc.start)}pushClassAccessorProperty(r,t,n){!n&&!t.computed&&this.nameIsConstructor(t.key)&&this.raise(S.ConstructorClassField,t.key);const o=this.parseClassAccessorProperty(t);r.body.push(o),n&&this.classScope.declarePrivateName(this.getPrivateNameSV(o.key),0,o.key.loc.start)}pushClassMethod(r,t,n,o,l,d){r.body.push(this.parseMethod(t,n,o,l,d,"ClassMethod",!0))}pushClassPrivateMethod(r,t,n,o){const l=this.parseMethod(t,n,o,!1,!1,"ClassPrivateMethod",!0);r.body.push(l);const d=l.kind==="get"?l.static?6:2:l.kind==="set"?l.static?5:1:0;this.declareClassPrivateMethodInScope(l,d)}declareClassPrivateMethodInScope(r,t){this.classScope.declarePrivateName(this.getPrivateNameSV(r.key),t,r.key.loc.start)}parsePostMemberNameModifiers(r){}parseClassPrivateProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassPrivateProperty")}parseClassProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassProperty")}parseClassAccessorProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassAccessorProperty")}parseInitializer(r){this.scope.enter(592),this.expressionScope.enter(sa()),this.prodParam.enter(0),r.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(r,t,n,o=8331){if(ie(this.state.type))r.id=this.parseIdentifier(),t&&this.declareNameFromIdentifier(r.id,o);else if(n||!t)r.id=null;else throw this.raise(S.MissingClassName,this.state.startLoc)}parseClassSuper(r){r.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(r,t){const n=this.parseMaybeImportPhase(r,!0),o=this.maybeParseExportDefaultSpecifier(r,n),l=!o||this.eat(12),d=l&&this.eatExportStar(r),m=d&&this.maybeParseExportNamespaceSpecifier(r),g=l&&(!m||this.eat(12)),E=o||d;if(d&&!m){if(o&&this.unexpected(),t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.parseExportFrom(r,!0),this.sawUnambiguousESM=!0,this.finishNode(r,"ExportAllDeclaration")}const b=this.maybeParseExportNamedSpecifiers(r);o&&l&&!d&&!b&&this.unexpected(null,5),m&&g&&this.unexpected(null,98);let I;if(E||b){if(I=!1,t)throw this.raise(S.UnsupportedDecoratorExport,r);this.parseExportFrom(r,E)}else I=this.maybeParseExportDeclaration(r);if(E||b||I){var C;const N=r;if(this.checkExport(N,!0,!1,!!N.source),((C=N.declaration)==null?void 0:C.type)==="ClassDeclaration")this.maybeTakeDecorators(t,N.declaration,N);else if(t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.sawUnambiguousESM=!0,this.finishNode(N,"ExportNamedDeclaration")}if(this.eat(65)){const N=r,M=this.parseExportDefaultExpression();if(N.declaration=M,M.type==="ClassDeclaration")this.maybeTakeDecorators(t,M,N);else if(t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.checkExport(N,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(N,"ExportDefaultDeclaration")}throw this.unexpected(null,5)}eatExportStar(r){return this.eat(55)}maybeParseExportDefaultSpecifier(r,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",t?.loc.start);const n=t||this.parseIdentifier(!0),o=this.startNodeAtNode(n);return o.exported=n,r.specifiers=[this.finishNode(o,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(r){if(this.isContextual(93)){var t,n;(n=(t=r).specifiers)!=null||(t.specifiers=[]);const o=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),o.exported=this.parseModuleExportName(),r.specifiers.push(this.finishNode(o,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(r){if(this.match(5)){const t=r;t.specifiers||(t.specifiers=[]);const n=t.exportKind==="type";return t.specifiers.push(...this.parseExportSpecifiers(n)),t.source=null,this.hasPlugin("importAssertions")?t.assertions=[]:t.attributes=[],t.declaration=null,!0}return!1}maybeParseExportDeclaration(r){return this.shouldParseExportDeclaration()?(r.specifiers=[],r.source=null,this.hasPlugin("importAssertions")?r.assertions=[]:r.attributes=[],r.declaration=this.parseExportDeclaration(r),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;const r=this.nextTokenInLineStart();return this.isUnparsedContextual(r,"function")}parseExportDefaultExpression(){const r=this.startNode();if(this.match(68))return this.next(),this.parseFunction(r,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(r,13);if(this.match(80))return this.parseClass(r,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(S.DecoratorBeforeExport,this.state.startLoc),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(S.UnsupportedDefaultExport,this.state.startLoc);const t=this.parseMaybeAssignAllowIn();return this.semicolon(),t}parseExportDeclaration(r){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){const{type:r}=this.state;if(ie(r)){if(r===95&&!this.state.containsEsc||r===100)return!1;if((r===130||r===129)&&!this.state.containsEsc){const o=this.nextTokenStart(),l=this.input.charCodeAt(o);if(l===123||this.chStartsBindingIdentifier(l,o)&&!this.input.startsWith("from",o))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;const t=this.nextTokenStart(),n=this.isUnparsedContextual(t,"from");if(this.input.charCodeAt(t)===44||ie(this.state.type)&&n)return!0;if(this.match(65)&&n){const o=this.input.charCodeAt(this.nextTokenStartSince(t+4));return o===34||o===39}return!1}parseExportFrom(r,t){this.eatContextual(98)?(r.source=this.parseImportSource(),this.checkExport(r),this.maybeParseImportAttributes(r),this.checkJSONModuleImport(r)):t&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){const{type:r}=this.state;return r===26&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?(this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(S.DecoratorBeforeExport,this.state.startLoc),!0):this.isUsing()?(this.raise(S.UsingDeclarationExport,this.state.startLoc),!0):this.isAwaitUsing()?(this.raise(S.UsingDeclarationExport,this.state.startLoc),!0):r===74||r===75||r===68||r===80||this.isLet()||this.isAsyncFunction()}checkExport(r,t,n,o){if(t){var l;if(n){if(this.checkDuplicateExports(r,"default"),this.hasPlugin("exportDefaultFrom")){var d;const m=r.declaration;m.type==="Identifier"&&m.name==="from"&&m.end-m.start===4&&!((d=m.extra)!=null&&d.parenthesized)&&this.raise(S.ExportDefaultFromAsIdentifier,m)}}else if((l=r.specifiers)!=null&&l.length)for(const m of r.specifiers){const{exported:g}=m,E=g.type==="Identifier"?g.name:g.value;if(this.checkDuplicateExports(m,E),!o&&m.local){const{local:b}=m;b.type!=="Identifier"?this.raise(S.ExportBindingIsString,m,{localName:b.value,exportName:E}):(this.checkReservedWord(b.name,b.loc.start,!0,!1),this.scope.checkLocalExport(b))}}else if(r.declaration){const m=r.declaration;if(m.type==="FunctionDeclaration"||m.type==="ClassDeclaration"){const{id:g}=m;if(!g)throw new Error("Assertion failure");this.checkDuplicateExports(r,g.name)}else if(m.type==="VariableDeclaration")for(const g of m.declarations)this.checkDeclaration(g.id)}}}checkDeclaration(r){if(r.type==="Identifier")this.checkDuplicateExports(r,r.name);else if(r.type==="ObjectPattern")for(const t of r.properties)this.checkDeclaration(t);else if(r.type==="ArrayPattern")for(const t of r.elements)t&&this.checkDeclaration(t);else r.type==="ObjectProperty"?this.checkDeclaration(r.value):r.type==="RestElement"?this.checkDeclaration(r.argument):r.type==="AssignmentPattern"&&this.checkDeclaration(r.left)}checkDuplicateExports(r,t){this.exportedIdentifiers.has(t)&&(t==="default"?this.raise(S.DuplicateDefaultExport,r):this.raise(S.DuplicateExport,r,{exportName:t})),this.exportedIdentifiers.add(t)}parseExportSpecifiers(r){const t=[];let n=!0;for(this.expect(5);!this.eat(8);){if(n)n=!1;else if(this.expect(12),this.eat(8))break;const o=this.isContextual(130),l=this.match(134),d=this.startNode();d.local=this.parseModuleExportName(),t.push(this.parseExportSpecifier(d,l,r,o))}return t}parseExportSpecifier(r,t,n,o){return this.eatContextual(93)?r.exported=this.parseModuleExportName():t?r.exported=this.cloneStringLiteral(r.local):r.exported||(r.exported=this.cloneIdentifier(r.local)),this.finishNode(r,"ExportSpecifier")}parseModuleExportName(){if(this.match(134)){const r=this.parseStringLiteral(this.state.value),t=np.exec(r.value);return t&&this.raise(S.ModuleExportNameHasLoneSurrogate,r,{surrogateCharCode:t[0].charCodeAt(0)}),r}return this.parseIdentifier(!0)}isJSONModuleImport(r){return r.assertions!=null?r.assertions.some(({key:t,value:n})=>n.value==="json"&&(t.type==="Identifier"?t.name==="type":t.value==="type")):!1}checkImportReflection(r){const{specifiers:t}=r,n=t.length===1?t[0].type:null;if(r.phase==="source")n!=="ImportDefaultSpecifier"&&this.raise(S.SourcePhaseImportRequiresDefault,t[0].loc.start);else if(r.phase==="defer")n!=="ImportNamespaceSpecifier"&&this.raise(S.DeferImportRequiresNamespace,t[0].loc.start);else if(r.module){var o;n!=="ImportDefaultSpecifier"&&this.raise(S.ImportReflectionNotBinding,t[0].loc.start),((o=r.assertions)==null?void 0:o.length)>0&&this.raise(S.ImportReflectionHasAssertion,t[0].loc.start)}}checkJSONModuleImport(r){if(this.isJSONModuleImport(r)&&r.type!=="ExportAllDeclaration"){const{specifiers:t}=r;if(t!=null){const n=t.find(o=>{let l;if(o.type==="ExportSpecifier"?l=o.local:o.type==="ImportSpecifier"&&(l=o.imported),l!==void 0)return l.type==="Identifier"?l.name!=="default":l.value!=="default"});n!==void 0&&this.raise(S.ImportJSONBindingNotDefault,n.loc.start)}}}isPotentialImportPhase(r){return r?!1:this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(r,t,n,o){t||(n==="module"?(this.expectPlugin("importReflection",o),r.module=!0):this.hasPlugin("importReflection")&&(r.module=!1),n==="source"?(this.expectPlugin("sourcePhaseImports",o),r.phase="source"):n==="defer"?(this.expectPlugin("deferredImportEvaluation",o),r.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(r.phase=null))}parseMaybeImportPhase(r,t){if(!this.isPotentialImportPhase(t))return this.applyImportPhase(r,t,null),null;const n=this.startNode(),o=this.parseIdentifierName(!0),{type:l}=this.state;return(Xe(l)?l!==98||this.lookaheadCharCode()===102:l!==12)?(this.applyImportPhase(r,t,o,n.loc.start),null):(this.applyImportPhase(r,t,null),this.createIdentifier(n,o))}isPrecedingIdImportPhase(r){const{type:t}=this.state;return ie(t)?t!==98||this.lookaheadCharCode()===102:t!==12}parseImport(r){return this.match(134)?this.parseImportSourceAndAttributes(r):this.parseImportSpecifiersAndAfter(r,this.parseMaybeImportPhase(r,!1))}parseImportSpecifiersAndAfter(r,t){r.specifiers=[];const o=!this.maybeParseDefaultImportSpecifier(r,t)||this.eat(12),l=o&&this.maybeParseStarImportSpecifier(r);return o&&!l&&this.parseNamedImportSpecifiers(r),this.expectContextual(98),this.parseImportSourceAndAttributes(r)}parseImportSourceAndAttributes(r){var t;return(t=r.specifiers)!=null||(r.specifiers=[]),r.source=this.parseImportSource(),this.maybeParseImportAttributes(r),this.checkImportReflection(r),this.checkJSONModuleImport(r),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(r,"ImportDeclaration")}parseImportSource(){return this.match(134)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(r,t,n){t.local=this.parseIdentifier(),r.specifiers.push(this.finishImportSpecifier(t,n))}finishImportSpecifier(r,t,n=8201){return this.checkLVal(r.local,{type:t},n),this.finishNode(r,t)}parseImportAttributes(){this.expect(5);const r=[],t=new Set;do{if(this.match(8))break;const n=this.startNode(),o=this.state.value;if(t.has(o)&&this.raise(S.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:o}),t.add(o),this.match(134)?n.key=this.parseStringLiteral(o):n.key=this.parseIdentifier(!0),this.expect(14),!this.match(134))throw this.raise(S.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),r.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return this.expect(8),r}parseModuleAttributes(){const r=[],t=new Set;do{const n=this.startNode();if(n.key=this.parseIdentifier(!0),n.key.name!=="type"&&this.raise(S.ModuleAttributeDifferentFromType,n.key),t.has(n.key.name)&&this.raise(S.ModuleAttributesWithDuplicateKeys,n.key,{key:n.key.name}),t.add(n.key.name),this.expect(14),!this.match(134))throw this.raise(S.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),r.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return r}maybeParseImportAttributes(r){let t;var n=!1;if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),this.hasPlugin("moduleAttributes")?(t=this.parseModuleAttributes(),this.addExtra(r,"deprecatedWithLegacySyntax",!0)):t=this.parseImportAttributes(),n=!0}else this.isContextual(94)&&!this.hasPrecedingLineBreak()?(!this.hasPlugin("deprecatedImportAssert")&&!this.hasPlugin("importAssertions")&&this.raise(S.ImportAttributesUseAssert,this.state.startLoc),this.hasPlugin("importAssertions")||this.addExtra(r,"deprecatedAssertSyntax",!0),this.next(),t=this.parseImportAttributes()):t=[];!n&&this.hasPlugin("importAssertions")?r.assertions=t:r.attributes=t}maybeParseDefaultImportSpecifier(r,t){if(t){const n=this.startNodeAtNode(t);return n.local=t,r.specifiers.push(this.finishImportSpecifier(n,"ImportDefaultSpecifier")),!0}else if(Xe(this.state.type))return this.parseImportSpecifierLocal(r,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(r){if(this.match(55)){const t=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(r,t,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(r){let t=!0;for(this.expect(5);!this.eat(8);){if(t)t=!1;else{if(this.eat(14))throw this.raise(S.DestructureNamedImport,this.state.startLoc);if(this.expect(12),this.eat(8))break}const n=this.startNode(),o=this.match(134),l=this.isContextual(130);n.imported=this.parseModuleExportName();const d=this.parseImportSpecifier(n,o,r.importKind==="type"||r.importKind==="typeof",l,void 0);r.specifiers.push(d)}}parseImportSpecifier(r,t,n,o,l){if(this.eatContextual(93))r.local=this.parseIdentifier();else{const{imported:d}=r;if(t)throw this.raise(S.ImportBindingIsString,r,{importName:d.value});this.checkReservedWord(d.name,r.loc.start,!0,!0),r.local||(r.local=this.cloneIdentifier(d))}return this.finishImportSpecifier(r,"ImportSpecifier",l)}isThisParam(r){return r.type==="Identifier"&&r.name==="this"}}class ha extends op{constructor(r,t,n){const o=$e(r);super(o,t),this.options=o,this.initializeScopes(),this.plugins=n,this.filename=o.sourceFilename,this.startIndex=o.startIndex;let l=0;o.allowAwaitOutsideFunction&&(l|=1),o.allowReturnOutsideFunction&&(l|=2),o.allowImportExportEverywhere&&(l|=8),o.allowSuperOutsideMethod&&(l|=16),o.allowUndeclaredExports&&(l|=64),o.allowNewTargetOutsideFunction&&(l|=4),o.allowYieldOutsideFunction&&(l|=32),o.ranges&&(l|=128),o.tokens&&(l|=256),o.createImportExpressions&&(l|=512),o.createParenthesizedExpressions&&(l|=1024),o.errorRecovery&&(l|=2048),o.attachComment&&(l|=4096),o.annexB&&(l|=8192),this.optionFlags=l}getScopeHandler(){return pr}parse(){this.enterInitialScopes();const r=this.startNode(),t=this.startNode();this.nextToken(),r.errors=null;const n=this.parseTopLevel(r,t);return n.errors=this.state.errors,n.comments.length=this.state.commentsLen,n}}function cp(p,r){var t;if(((t=r)==null?void 0:t.sourceType)==="unambiguous"){r=Object.assign({},r);try{r.sourceType="module";const n=Is(r,p),o=n.parse();if(n.sawUnambiguousESM)return o;if(n.ambiguousScriptDifferentAst)try{return r.sourceType="script",Is(r,p).parse()}catch{}else o.program.sourceType="script";return o}catch(n){try{return r.sourceType="script",Is(r,p).parse()}catch{}throw n}}else return Is(r,p).parse()}function lp(p,r){const t=Is(r,p);return t.options.strictMode&&(t.state.strict=!0),t.getExpression()}function up(p){const r={};for(const t of Object.keys(p))r[t]=ut(p[t]);return r}const hp=up(Wu);function Is(p,r){let t=ha;const n=new Map;if(p!=null&&p.plugins){for(const o of p.plugins){let l,d;typeof o=="string"?l=o:[l,d]=o,n.has(l)||n.set(l,d||{})}tp(n),t=pp(n)}return new t(p,r,n)}const pa=new Map;function pp(p){const r=[];for(const o of sp)p.has(o)&&r.push(o);const t=r.join("|");let n=pa.get(t);if(!n){n=ha;for(const o of r)n=ua[o](n);pa.set(t,n)}return n}return as.parse=cp,as.parseExpression=lp,as.tokTypes=hp,as}var NT=vT();/**
|
|
43
|
+
`):o=String.fromCharCode(n),++this.state.curLine,this.state.lineStart=this.state.pos,o}jsxReadString(t){let n="",o=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(S.UnterminatedString,this.state.startLoc);const l=this.input.charCodeAt(this.state.pos);if(l===t)break;l===38?(n+=this.input.slice(o,this.state.pos),n+=this.jsxReadEntity(),o=this.state.pos):Xt(l)?(n+=this.input.slice(o,this.state.pos),n+=this.jsxReadNewLine(!1),o=this.state.pos):++this.state.pos}n+=this.input.slice(o,this.state.pos++),this.finishToken(134,n)}jsxReadEntity(){const t=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let n=10;this.codePointAtPos(this.state.pos)===120&&(n=16,++this.state.pos);const o=this.readInt(n,void 0,!1,"bail");if(o!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(o)}else{let n=0,o=!1;for(;n++<10&&this.state.pos<this.length&&!(o=this.codePointAtPos(this.state.pos)===59);)++this.state.pos;if(o){const l=this.input.slice(t,this.state.pos),d=wh[l];if(++this.state.pos,d)return d}}return this.state.pos=t,"&"}jsxReadWord(){let t;const n=this.state.pos;do t=this.input.charCodeAt(++this.state.pos);while(Rt(t)||t===45);this.finishToken(141,this.input.slice(n,this.state.pos))}jsxParseIdentifier(){const t=this.startNode();return this.match(141)?t.name=this.state.value:lr(this.state.type)?t.name=xt(this.state.type):this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")}jsxParseNamespacedName(){const t=this.state.startLoc,n=this.jsxParseIdentifier();if(!this.eat(14))return n;const o=this.startNodeAt(t);return o.namespace=n,o.name=this.jsxParseIdentifier(),this.finishNode(o,"JSXNamespacedName")}jsxParseElementName(){const t=this.state.startLoc;let n=this.jsxParseNamespacedName();if(n.type==="JSXNamespacedName")return n;for(;this.eat(16);){const o=this.startNodeAt(t);o.object=n,o.property=this.jsxParseIdentifier(),n=this.finishNode(o,"JSXMemberExpression")}return n}jsxParseAttributeValue(){let t;switch(this.state.type){case 5:return t=this.startNode(),this.setContext($.brace),this.next(),t=this.jsxParseExpressionContainer(t,$.j_oTag),t.expression.type==="JSXEmptyExpression"&&this.raise(Mt.AttributeIsEmpty,t),t;case 143:case 134:return this.parseExprAtom();default:throw this.raise(Mt.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){const t=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(t){return this.next(),t.expression=this.parseExpression(),this.setContext($.j_expr),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXSpreadChild")}jsxParseExpressionContainer(t,n){if(this.match(8))t.expression=this.jsxParseEmptyExpression();else{const o=this.parseExpression();t.expression=o}return this.setContext(n),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXExpressionContainer")}jsxParseAttribute(){const t=this.startNode();return this.match(5)?(this.setContext($.brace),this.next(),this.expect(21),t.argument=this.parseMaybeAssignAllowIn(),this.setContext($.j_oTag),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXSpreadAttribute")):(t.name=this.jsxParseNamespacedName(),t.value=this.eat(29)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute"))}jsxParseOpeningElementAt(t){const n=this.startNodeAt(t);return this.eat(144)?this.finishNode(n,"JSXOpeningFragment"):(n.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(n))}jsxParseOpeningElementAfterName(t){const n=[];for(;!this.match(56)&&!this.match(144);)n.push(this.jsxParseAttribute());return t.attributes=n,t.selfClosing=this.eat(56),this.expect(144),this.finishNode(t,"JSXOpeningElement")}jsxParseClosingElementAt(t){const n=this.startNodeAt(t);return this.eat(144)?this.finishNode(n,"JSXClosingFragment"):(n.name=this.jsxParseElementName(),this.expect(144),this.finishNode(n,"JSXClosingElement"))}jsxParseElementAt(t){const n=this.startNodeAt(t),o=[],l=this.jsxParseOpeningElementAt(t);let d=null;if(!l.selfClosing){e:for(;;)switch(this.state.type){case 143:if(t=this.state.startLoc,this.next(),this.eat(56)){d=this.jsxParseClosingElementAt(t);break e}o.push(this.jsxParseElementAt(t));break;case 142:o.push(this.parseLiteral(this.state.value,"JSXText"));break;case 5:{const m=this.startNode();this.setContext($.brace),this.next(),this.match(21)?o.push(this.jsxParseSpreadChild(m)):o.push(this.jsxParseExpressionContainer(m,$.j_expr));break}default:this.unexpected()}At(l)&&!At(d)&&d!==null?this.raise(Mt.MissingClosingTagFragment,d):!At(l)&&At(d)?this.raise(Mt.MissingClosingTagElement,d,{openingTagName:Jt(l.name)}):!At(l)&&!At(d)&&Jt(d.name)!==Jt(l.name)&&this.raise(Mt.MissingClosingTagElement,d,{openingTagName:Jt(l.name)})}if(At(l)?(n.openingFragment=l,n.closingFragment=d):(n.openingElement=l,n.closingElement=d),n.children=o,this.match(47))throw this.raise(Mt.UnwrappedAdjacentJSXElements,this.state.startLoc);return At(l)?this.finishNode(n,"JSXFragment"):this.finishNode(n,"JSXElement")}jsxParseElement(){const t=this.state.startLoc;return this.next(),this.jsxParseElementAt(t)}setContext(t){const{context:n}=this.state;n[n.length-1]=t}parseExprAtom(t){return this.match(143)?this.jsxParseElement():this.match(47)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(143),this.jsxParseElement()):super.parseExprAtom(t)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(t){const n=this.curContext();if(n===$.j_expr){this.jsxReadToken();return}if(n===$.j_oTag||n===$.j_cTag){if(at(t)){this.jsxReadWord();return}if(t===62){++this.state.pos,this.finishToken(144);return}if((t===34||t===39)&&n===$.j_oTag){this.jsxReadString(t);return}}if(t===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(143);return}super.getTokenFromCode(t)}updateContext(t){const{context:n,type:o}=this.state;if(o===56&&t===143)n.splice(-2,2,$.j_cTag),this.state.canStartJSXElement=!1;else if(o===143)n.push($.j_oTag);else if(o===144){const l=n[n.length-1];l===$.j_oTag&&t===56||l===$.j_cTag?(n.pop(),this.state.canStartJSXElement=n[n.length-1]===$.j_expr):(this.setContext($.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=Qu(o)}};class Nh extends dr{constructor(...r){super(...r),this.tsNames=new Map}}class Oh extends fr{constructor(...r){super(...r),this.importsStack=[]}createScope(r){return this.importsStack.push(new Set),new Nh(r)}enter(r){r===1024&&this.importsStack.push(new Set),super.enter(r)}exit(){const r=super.exit();return r===1024&&this.importsStack.pop(),r}hasImport(r,t){const n=this.importsStack.length;if(this.importsStack[n-1].has(r))return!0;if(!t&&n>1){for(let o=0;o<n-1;o++)if(this.importsStack[o].has(r))return!0}return!1}declareName(r,t,n){if(t&4096){this.hasImport(r,!0)&&this.parser.raise(S.VarRedeclaration,n,{identifierName:r}),this.importsStack[this.importsStack.length-1].add(r);return}const o=this.currentScope();let l=o.tsNames.get(r)||0;if(t&1024){this.maybeExportDefined(o,r),o.tsNames.set(r,l|16);return}super.declareName(r,t,n),t&2&&(t&1||(this.checkRedeclarationInScope(o,r,t,n),this.maybeExportDefined(o,r)),l=l|1),t&256&&(l=l|2),t&512&&(l=l|4),t&128&&(l=l|8),l&&o.tsNames.set(r,l)}isRedeclaredInScope(r,t,n){const o=r.tsNames.get(t);if((o&2)>0){if(n&256){const l=!!(n&512),d=(o&4)>0;return l!==d}return!0}return n&128&&(o&8)>0?r.names.get(t)&2?!!(n&1):!1:n&2&&(o&1)>0?!0:super.isRedeclaredInScope(r,t,n)}checkLocalExport(r){const{name:t}=r;if(this.hasImport(t))return;const n=this.scopeStack.length;for(let o=n-1;o>=0;o--){const d=this.scopeStack[o].tsNames.get(t);if((d&1)>0||(d&16)>0)return}super.checkLocalExport(r)}}class Lh{constructor(){this.stacks=[]}enter(r){this.stacks.push(r)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}}function Ks(p,r){return(p?2:0)|(r?1:0)}class Dh{constructor(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}sourceToOffsetPos(r){return r+this.startIndex}offsetToSourcePos(r){return r-this.startIndex}hasPlugin(r){if(typeof r=="string")return this.plugins.has(r);{const[t,n]=r;if(!this.hasPlugin(t))return!1;const o=this.plugins.get(t);for(const l of Object.keys(n))if(o?.[l]!==n[l])return!1;return!0}}getPluginOption(r,t){var n;return(n=this.plugins.get(r))==null?void 0:n[t]}}function Qn(p,r){p.trailingComments===void 0?p.trailingComments=r:p.trailingComments.unshift(...r)}function kh(p,r){p.leadingComments===void 0?p.leadingComments=r:p.leadingComments.unshift(...r)}function xs(p,r){p.innerComments===void 0?p.innerComments=r:p.innerComments.unshift(...r)}function Qe(p,r,t){let n=null,o=r.length;for(;n===null&&o>0;)n=r[--o];n===null||n.start>t.start?xs(p,t.comments):Qn(n,t.comments)}class Rh extends Dh{addComment(r){this.filename&&(r.loc.filename=this.filename);const{commentsLen:t}=this.state;this.comments.length!==t&&(this.comments.length=t),this.comments.push(r),this.state.commentsLen++}processComment(r){const{commentStack:t}=this.state,n=t.length;if(n===0)return;let o=n-1;const l=t[o];l.start===r.end&&(l.leadingNode=r,o--);const{start:d}=r;for(;o>=0;o--){const m=t[o],g=m.end;if(g>d)m.containingNode=r,this.finalizeComment(m),t.splice(o,1);else{g===d&&(m.trailingNode=r);break}}}finalizeComment(r){var t;const{comments:n}=r;if(r.leadingNode!==null||r.trailingNode!==null)r.leadingNode!==null&&Qn(r.leadingNode,n),r.trailingNode!==null&&kh(r.trailingNode,n);else{const o=r.containingNode,l=r.start;if(this.input.charCodeAt(this.offsetToSourcePos(l)-1)===44)switch(o.type){case"ObjectExpression":case"ObjectPattern":Qe(o,o.properties,r);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":Qe(o,o.arguments,r);break;case"ImportExpression":Qe(o,[o.source,(t=o.options)!=null?t:null],r);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":Qe(o,o.params,r);break;case"ArrayExpression":case"ArrayPattern":Qe(o,o.elements,r);break;case"ExportNamedDeclaration":case"ImportDeclaration":Qe(o,o.specifiers,r);break;case"TSEnumDeclaration":Qe(o,o.members,r);break;case"TSEnumBody":Qe(o,o.members,r);break;case"TSInterfaceBody":Qe(o,o.body,r);break;default:{if(o.type==="RecordExpression"){Qe(o,o.properties,r);break}if(o.type==="TupleExpression"){Qe(o,o.elements,r);break}xs(o,n)}}else xs(o,n)}}finalizeRemainingComments(){const{commentStack:r}=this.state;for(let t=r.length-1;t>=0;t--)this.finalizeComment(r[t]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(r){const{commentStack:t}=this.state,{length:n}=t;if(n===0)return;const o=t[n-1];o.leadingNode===r&&(o.leadingNode=null)}takeSurroundingComments(r,t,n){const{commentStack:o}=this.state,l=o.length;if(l===0)return;let d=l-1;for(;d>=0;d--){const m=o[d],g=m.end;if(m.start===n)m.leadingNode=r;else if(g===t)m.trailingNode=r;else if(g<t)break}}}class gr{constructor(){this.flags=1024,this.startIndex=void 0,this.curLine=void 0,this.lineStart=void 0,this.startLoc=void 0,this.endLoc=void 0,this.errors=[],this.potentialArrowAt=-1,this.noArrowAt=[],this.noArrowParamsConversionAt=[],this.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null},this.labels=[],this.commentsLen=0,this.commentStack=[],this.pos=0,this.type=140,this.value=null,this.start=0,this.end=0,this.lastTokEndLoc=null,this.lastTokStartLoc=null,this.context=[$.brace],this.firstInvalidTemplateEscapePos=null,this.strictErrors=new Map,this.tokensLength=0}get strict(){return(this.flags&1)>0}set strict(r){r?this.flags|=1:this.flags&=-2}init({strictMode:r,sourceType:t,startIndex:n,startLine:o,startColumn:l}){this.strict=r===!1?!1:r===!0?!0:t==="module",this.startIndex=n,this.curLine=o,this.lineStart=-l,this.startLoc=this.endLoc=new s(o,l,n)}get maybeInArrowParameters(){return(this.flags&2)>0}set maybeInArrowParameters(r){r?this.flags|=2:this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(r){r?this.flags|=4:this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(r){r?this.flags|=8:this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(r){r?this.flags|=16:this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(r){r?this.flags|=32:this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(r){r?this.flags|=64:this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(r){r?this.flags|=128:this.flags&=-129}get soloAwait(){return(this.flags&256)>0}set soloAwait(r){r?this.flags|=256:this.flags&=-257}get inFSharpPipelineDirectBody(){return(this.flags&512)>0}set inFSharpPipelineDirectBody(r){r?this.flags|=512:this.flags&=-513}get canStartJSXElement(){return(this.flags&1024)>0}set canStartJSXElement(r){r?this.flags|=1024:this.flags&=-1025}get containsEsc(){return(this.flags&2048)>0}set containsEsc(r){r?this.flags|=2048:this.flags&=-2049}get hasTopLevelAwait(){return(this.flags&4096)>0}set hasTopLevelAwait(r){r?this.flags|=4096:this.flags&=-4097}curPosition(){return new s(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){const r=new gr;return r.flags=this.flags,r.startIndex=this.startIndex,r.curLine=this.curLine,r.lineStart=this.lineStart,r.startLoc=this.startLoc,r.endLoc=this.endLoc,r.errors=this.errors.slice(),r.potentialArrowAt=this.potentialArrowAt,r.noArrowAt=this.noArrowAt.slice(),r.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),r.topicContext=this.topicContext,r.labels=this.labels.slice(),r.commentsLen=this.commentsLen,r.commentStack=this.commentStack.slice(),r.pos=this.pos,r.type=this.type,r.value=this.value,r.start=this.start,r.end=this.end,r.lastTokEndLoc=this.lastTokEndLoc,r.lastTokStartLoc=this.lastTokStartLoc,r.context=this.context.slice(),r.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,r.strictErrors=this.strictErrors,r.tokensLength=this.tokensLength,r}}var Mh=function(r){return r>=48&&r<=57};const ea={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},qs={bin:p=>p===48||p===49,oct:p=>p>=48&&p<=55,dec:p=>p>=48&&p<=57,hex:p=>p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102};function ta(p,r,t,n,o,l){const d=t,m=n,g=o;let E="",b=null,x=t;const{length:C}=r;for(;;){if(t>=C){l.unterminated(d,m,g),E+=r.slice(x,t);break}const v=r.charCodeAt(t);if($h(p,v,r,t)){E+=r.slice(x,t);break}if(v===92){E+=r.slice(x,t);const M=Fh(r,t,n,o,p==="template",l);M.ch===null&&!b?b={pos:t,lineStart:n,curLine:o}:E+=M.ch,{pos:t,lineStart:n,curLine:o}=M,x=t}else v===8232||v===8233?(++t,++o,n=t):v===10||v===13?p==="template"?(E+=r.slice(x,t)+`
|
|
44
|
+
`,++t,v===13&&r.charCodeAt(t)===10&&++t,++o,x=n=t):l.unterminated(d,m,g):++t}return{pos:t,str:E,firstInvalidLoc:b,lineStart:n,curLine:o,containsInvalid:!!b}}function $h(p,r,t,n){return p==="template"?r===96||r===36&&t.charCodeAt(n+1)===123:r===(p==="double"?34:39)}function Fh(p,r,t,n,o,l){const d=!o;r++;const m=E=>({pos:r,ch:E,lineStart:t,curLine:n}),g=p.charCodeAt(r++);switch(g){case 110:return m(`
|
|
45
|
+
`);case 114:return m("\r");case 120:{let E;return{code:E,pos:r}=Er(p,r,t,n,2,!1,d,l),m(E===null?null:String.fromCharCode(E))}case 117:{let E;return{code:E,pos:r}=ia(p,r,t,n,d,l),m(E===null?null:String.fromCodePoint(E))}case 116:return m(" ");case 98:return m("\b");case 118:return m("\v");case 102:return m("\f");case 13:p.charCodeAt(r)===10&&++r;case 10:t=r,++n;case 8232:case 8233:return m("");case 56:case 57:if(o)return m(null);l.strictNumericEscape(r-1,t,n);default:if(g>=48&&g<=55){const E=r-1;let x=/^[0-7]+/.exec(p.slice(E,r+2))[0],C=parseInt(x,8);C>255&&(x=x.slice(0,-1),C=parseInt(x,8)),r+=x.length-1;const v=p.charCodeAt(r);if(x!=="0"||v===56||v===57){if(o)return m(null);l.strictNumericEscape(E,t,n)}return m(String.fromCharCode(C))}return m(String.fromCharCode(g))}}function Er(p,r,t,n,o,l,d,m){const g=r;let E;return{n:E,pos:r}=sa(p,r,t,n,16,o,l,!1,m,!d),E===null&&(d?m.invalidEscapeSequence(g,t,n):r=g-1),{code:E,pos:r}}function sa(p,r,t,n,o,l,d,m,g,E){const b=r,x=o===16?ea.hex:ea.decBinOct,C=o===16?qs.hex:o===10?qs.dec:o===8?qs.oct:qs.bin;let v=!1,M=0;for(let Q=0,ue=l??1/0;Q<ue;++Q){const H=p.charCodeAt(r);let ce;if(H===95&&m!=="bail"){const $t=p.charCodeAt(r-1),wt=p.charCodeAt(r+1);if(m){if(Number.isNaN(wt)||!C(wt)||x.has($t)||x.has(wt)){if(E)return{n:null,pos:r};g.unexpectedNumericSeparator(r,t,n)}}else{if(E)return{n:null,pos:r};g.numericSeparatorInEscapeSequence(r,t,n)}++r;continue}if(H>=97?ce=H-97+10:H>=65?ce=H-65+10:Mh(H)?ce=H-48:ce=1/0,ce>=o){if(ce<=9&&E)return{n:null,pos:r};if(ce<=9&&g.invalidDigit(r,t,n,o))ce=0;else if(d)ce=0,v=!0;else break}++r,M=M*o+ce}return r===b||l!=null&&r-b!==l||v?{n:null,pos:r}:{n:M,pos:r}}function ia(p,r,t,n,o,l){const d=p.charCodeAt(r);let m;if(d===123){if(++r,{code:m,pos:r}=Er(p,r,t,n,p.indexOf("}",r)-r,!0,o,l),++r,m!==null&&m>1114111)if(o)l.invalidCodePoint(r,t,n);else return{code:null,pos:r}}else({code:m,pos:r}=Er(p,r,t,n,4,!1,o,l));return{code:m,pos:r}}function As(p,r,t){return new s(t,p-r,p)}const Bh=new Set([103,109,115,105,121,117,100,118]);class Pt{constructor(r){const t=r.startIndex||0;this.type=r.type,this.value=r.value,this.start=t+r.start,this.end=t+r.end,this.loc=new i(r.startLoc,r.endLoc)}}class Uh extends Rh{constructor(r,t){super(),this.isLookahead=void 0,this.tokens=[],this.errorHandlers_readInt={invalidDigit:(n,o,l,d)=>this.optionFlags&2048?(this.raise(S.InvalidDigit,As(n,o,l),{radix:d}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(S.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(S.UnexpectedNumericSeparator)},this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(S.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(S.InvalidCodePoint)}),this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(n,o,l)=>{this.recordStrictModeErrors(S.StrictNumericEscape,As(n,o,l))},unterminated:(n,o,l)=>{throw this.raise(S.UnterminatedString,As(n-1,o,l))}}),this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(S.StrictNumericEscape),unterminated:(n,o,l)=>{throw this.raise(S.UnterminatedTemplate,As(n,o,l))}}),this.state=new gr,this.state.init(r),this.input=t,this.length=t.length,this.comments=[],this.isLookahead=!1}pushToken(r){this.tokens.length=this.state.tokensLength,this.tokens.push(r),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&256&&this.pushToken(new Pt(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(r){return this.match(r)?(this.next(),!0):!1}match(r){return this.state.type===r}createLookaheadState(r){return{pos:r.pos,value:null,type:r.type,start:r.start,end:r.end,context:[this.curContext()],inType:r.inType,startLoc:r.startLoc,lastTokEndLoc:r.lastTokEndLoc,curLine:r.curLine,lineStart:r.lineStart,curPosition:r.curPosition}}lookahead(){const r=this.state;this.state=this.createLookaheadState(r),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;const t=this.state;return this.state=r,t}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(r){return mr.lastIndex=r,mr.test(this.input)?mr.lastIndex:r}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(r){return this.input.charCodeAt(this.nextTokenStartSince(r))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(r){return yr.lastIndex=r,yr.test(this.input)?yr.lastIndex:r}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(r){let t=this.input.charCodeAt(r);if((t&64512)===55296&&++r<this.input.length){const n=this.input.charCodeAt(r);(n&64512)===56320&&(t=65536+((t&1023)<<10)+(n&1023))}return t}setStrict(r){this.state.strict=r,r&&(this.state.strictErrors.forEach(([t,n])=>this.raise(t,n)),this.state.strictErrors.clear())}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){if(this.skipSpace(),this.state.start=this.state.pos,this.isLookahead||(this.state.startLoc=this.state.curPosition()),this.state.pos>=this.length){this.finishToken(140);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(r){let t;this.isLookahead||(t=this.state.curPosition());const n=this.state.pos,o=this.input.indexOf(r,n+2);if(o===-1)throw this.raise(S.UnterminatedComment,this.state.curPosition());for(this.state.pos=o+r.length,Ws.lastIndex=n+2;Ws.test(this.input)&&Ws.lastIndex<=o;)++this.state.curLine,this.state.lineStart=Ws.lastIndex;if(this.isLookahead)return;const l={type:"CommentBlock",value:this.input.slice(n+2,o),start:this.sourceToOffsetPos(n),end:this.sourceToOffsetPos(o+r.length),loc:new i(t,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(l),l}skipLineComment(r){const t=this.state.pos;let n;this.isLookahead||(n=this.state.curPosition());let o=this.input.charCodeAt(this.state.pos+=r);if(this.state.pos<this.length)for(;!Xt(o)&&++this.state.pos<this.length;)o=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;const l=this.state.pos,m={type:"CommentLine",value:this.input.slice(t+r,l),start:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(l),loc:new i(n,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(m),m}skipSpace(){const r=this.state.pos,t=this.optionFlags&4096?[]:null;e:for(;this.state.pos<this.length;){const n=this.input.charCodeAt(this.state.pos);switch(n){case 32:case 160:case 9:++this.state.pos;break;case 13:this.input.charCodeAt(this.state.pos+1)===10&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:{const o=this.skipBlockComment("*/");o!==void 0&&(this.addComment(o),t?.push(o));break}case 47:{const o=this.skipLineComment(2);o!==void 0&&(this.addComment(o),t?.push(o));break}default:break e}break;default:if(_h(n))++this.state.pos;else if(n===45&&!this.inModule&&this.optionFlags&8192){const o=this.state.pos;if(this.input.charCodeAt(o+1)===45&&this.input.charCodeAt(o+2)===62&&(r===0||this.state.lineStart>r)){const l=this.skipLineComment(3);l!==void 0&&(this.addComment(l),t?.push(l))}else break e}else if(n===60&&!this.inModule&&this.optionFlags&8192){const o=this.state.pos;if(this.input.charCodeAt(o+1)===33&&this.input.charCodeAt(o+2)===45&&this.input.charCodeAt(o+3)===45){const l=this.skipLineComment(4);l!==void 0&&(this.addComment(l),t?.push(l))}else break e}else break e}}if(t?.length>0){const n=this.state.pos,o={start:this.sourceToOffsetPos(r),end:this.sourceToOffsetPos(n),comments:t,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(o)}}finishToken(r,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();const n=this.state.type;this.state.type=r,this.state.value=t,this.isLookahead||this.updateContext(n)}replaceToken(r){this.state.type=r,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;const r=this.state.pos+1,t=this.codePointAtPos(r);if(t>=48&&t<=57)throw this.raise(S.UnexpectedDigitAfterHash,this.state.curPosition());if(t===123||t===91&&this.hasPlugin("recordAndTuple")){if(this.expectPlugin("recordAndTuple"),this.getPluginOption("recordAndTuple","syntaxType")==="bar")throw this.raise(t===123?S.RecordExpressionHashIncorrectStartSyntaxType:S.TupleExpressionHashIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,t===123?this.finishToken(7):this.finishToken(1)}else at(t)?(++this.state.pos,this.finishToken(139,this.readWord1(t))):t===92?(++this.state.pos,this.finishToken(139,this.readWord1())):this.finishOp(27,1)}readToken_dot(){const r=this.input.charCodeAt(this.state.pos+1);if(r>=48&&r<=57){this.readNumber(!0);return}r===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(31,2):this.finishOp(56,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let r=this.input.charCodeAt(this.state.pos+1);if(r!==33)return!1;const t=this.state.pos;for(this.state.pos+=1;!Xt(r)&&++this.state.pos<this.length;)r=this.input.charCodeAt(this.state.pos);const n=this.input.slice(t+2,this.state.pos);return this.finishToken(28,n),!0}readToken_mult_modulo(r){let t=r===42?55:54,n=1,o=this.input.charCodeAt(this.state.pos+1);r===42&&o===42&&(n++,o=this.input.charCodeAt(this.state.pos+2),t=57),o===61&&!this.state.inType&&(n++,t=r===37?33:30),this.finishOp(t,n)}readToken_pipe_amp(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===r){this.input.charCodeAt(this.state.pos+2)===61?this.finishOp(30,3):this.finishOp(r===124?41:42,2);return}if(r===124){if(t===62){this.finishOp(39,2);return}if(this.hasPlugin("recordAndTuple")&&t===125){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.RecordExpressionBarIncorrectEndSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(9);return}if(this.hasPlugin("recordAndTuple")&&t===93){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.TupleExpressionBarIncorrectEndSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(4);return}}if(t===61){this.finishOp(30,2);return}this.finishOp(r===124?43:45,1)}readToken_caret(){const r=this.input.charCodeAt(this.state.pos+1);r===61&&!this.state.inType?this.finishOp(32,2):r===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])?(this.finishOp(37,2),this.input.codePointAt(this.state.pos)===94&&this.unexpected()):this.finishOp(44,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])?this.finishOp(38,2):this.finishOp(26,1)}readToken_plus_min(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===r){this.finishOp(34,2);return}t===61?this.finishOp(30,2):this.finishOp(53,1)}readToken_lt(){const{pos:r}=this.state,t=this.input.charCodeAt(r+1);if(t===60){if(this.input.charCodeAt(r+2)===61){this.finishOp(30,3);return}this.finishOp(51,2);return}if(t===61){this.finishOp(49,2);return}this.finishOp(47,1)}readToken_gt(){const{pos:r}=this.state,t=this.input.charCodeAt(r+1);if(t===62){const n=this.input.charCodeAt(r+2)===62?3:2;if(this.input.charCodeAt(r+n)===61){this.finishOp(30,n+1);return}this.finishOp(52,n);return}if(t===61){this.finishOp(49,2);return}this.finishOp(48,1)}readToken_eq_excl(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===61){this.finishOp(46,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(r===61&&t===62){this.state.pos+=2,this.finishToken(19);return}this.finishOp(r===61?29:35,1)}readToken_question(){const r=this.input.charCodeAt(this.state.pos+1),t=this.input.charCodeAt(this.state.pos+2);r===63?t===61?this.finishOp(30,3):this.finishOp(40,2):r===46&&!(t>=48&&t<=57)?(this.state.pos+=2,this.finishToken(18)):(++this.state.pos,this.finishToken(17))}getTokenFromCode(r){switch(r){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(10);return;case 41:++this.state.pos,this.finishToken(11);return;case 59:++this.state.pos,this.finishToken(13);return;case 44:++this.state.pos,this.finishToken(12);return;case 91:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.TupleExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(2)}else++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(3);return;case 123:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.RecordExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(6)}else++this.state.pos,this.finishToken(5);return;case 125:++this.state.pos,this.finishToken(8);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(15,2):(++this.state.pos,this.finishToken(14));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{const t=this.input.charCodeAt(this.state.pos+1);if(t===120||t===88){this.readRadixNumber(16);return}if(t===111||t===79){this.readRadixNumber(8);return}if(t===98||t===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(!1);return;case 34:case 39:this.readString(r);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(r);return;case 124:case 38:this.readToken_pipe_amp(r);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(r);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(r);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(at(r)){this.readWord(r);return}}throw this.raise(S.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(r)})}finishOp(r,t){const n=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t,this.finishToken(r,n)}readRegexp(){const r=this.state.startLoc,t=this.state.start+1;let n,o,{pos:l}=this.state;for(;;++l){if(l>=this.length)throw this.raise(S.UnterminatedRegExp,a(r,1));const E=this.input.charCodeAt(l);if(Xt(E))throw this.raise(S.UnterminatedRegExp,a(r,1));if(n)n=!1;else{if(E===91)o=!0;else if(E===93&&o)o=!1;else if(E===47&&!o)break;n=E===92}}const d=this.input.slice(t,l);++l;let m="";const g=()=>a(r,l+2-t);for(;l<this.length;){const E=this.codePointAtPos(l),b=String.fromCharCode(E);if(Bh.has(E))E===118?m.includes("u")&&this.raise(S.IncompatibleRegExpUVFlags,g()):E===117&&m.includes("v")&&this.raise(S.IncompatibleRegExpUVFlags,g()),m.includes(b)&&this.raise(S.DuplicateRegExpFlags,g());else if(Rt(E)||E===92)this.raise(S.MalformedRegExpFlags,g());else break;++l,m+=b}this.state.pos=l,this.finishToken(138,{pattern:d,flags:m})}readInt(r,t,n=!1,o=!0){const{n:l,pos:d}=sa(this.input,this.state.pos,this.state.lineStart,this.state.curLine,r,t,n,o,this.errorHandlers_readInt,!1);return this.state.pos=d,l}readRadixNumber(r){const t=this.state.pos,n=this.state.curPosition();let o=!1;this.state.pos+=2;const l=this.readInt(r);l==null&&this.raise(S.InvalidDigit,a(n,2),{radix:r});const d=this.input.charCodeAt(this.state.pos);if(d===110)++this.state.pos,o=!0;else if(d===109)throw this.raise(S.InvalidDecimal,n);if(at(this.codePointAtPos(this.state.pos)))throw this.raise(S.NumberIdentifier,this.state.curPosition());if(o){const m=this.input.slice(t,this.state.pos).replace(/[_n]/g,"");this.finishToken(136,m);return}this.finishToken(135,l)}readNumber(r){const t=this.state.pos,n=this.state.curPosition();let o=!1,l=!1,d=!1,m=!1;!r&&this.readInt(10)===null&&this.raise(S.InvalidNumber,this.state.curPosition());const g=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(g){const v=this.input.slice(t,this.state.pos);if(this.recordStrictModeErrors(S.StrictOctalLiteral,n),!this.state.strict){const M=v.indexOf("_");M>0&&this.raise(S.ZeroDigitNumericSeparator,a(n,M))}m=g&&!/[89]/.test(v)}let E=this.input.charCodeAt(this.state.pos);if(E===46&&!m&&(++this.state.pos,this.readInt(10),o=!0,E=this.input.charCodeAt(this.state.pos)),(E===69||E===101)&&!m&&(E=this.input.charCodeAt(++this.state.pos),(E===43||E===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(S.InvalidOrMissingExponent,n),o=!0,d=!0,E=this.input.charCodeAt(this.state.pos)),E===110&&((o||g)&&this.raise(S.InvalidBigIntLiteral,n),++this.state.pos,l=!0),E===109){this.expectPlugin("decimal",this.state.curPosition()),(d||g)&&this.raise(S.InvalidDecimal,n),++this.state.pos;var b=!0}if(at(this.codePointAtPos(this.state.pos)))throw this.raise(S.NumberIdentifier,this.state.curPosition());const x=this.input.slice(t,this.state.pos).replace(/[_mn]/g,"");if(l){this.finishToken(136,x);return}if(b){this.finishToken(137,x);return}const C=m?parseInt(x,8):parseFloat(x);this.finishToken(135,C)}readCodePoint(r){const{code:t,pos:n}=ia(this.input,this.state.pos,this.state.lineStart,this.state.curLine,r,this.errorHandlers_readCodePoint);return this.state.pos=n,t}readString(r){const{str:t,pos:n,curLine:o,lineStart:l}=ta(r===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=n+1,this.state.lineStart=l,this.state.curLine=o,this.finishToken(134,t)}readTemplateContinuation(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()}readTemplateToken(){const r=this.input[this.state.pos],{str:t,firstInvalidLoc:n,pos:o,curLine:l,lineStart:d}=ta("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=o+1,this.state.lineStart=d,this.state.curLine=l,n&&(this.state.firstInvalidTemplateEscapePos=new s(n.curLine,n.pos-n.lineStart,this.sourceToOffsetPos(n.pos))),this.input.codePointAt(o)===96?this.finishToken(24,n?null:r+t+"`"):(this.state.pos++,this.finishToken(25,n?null:r+t+"${"))}recordStrictModeErrors(r,t){const n=t.index;this.state.strict&&!this.state.strictErrors.has(n)?this.raise(r,t):this.state.strictErrors.set(n,[r,t])}readWord1(r){this.state.containsEsc=!1;let t="";const n=this.state.pos;let o=this.state.pos;for(r!==void 0&&(this.state.pos+=r<=65535?1:2);this.state.pos<this.length;){const l=this.codePointAtPos(this.state.pos);if(Rt(l))this.state.pos+=l<=65535?1:2;else if(l===92){this.state.containsEsc=!0,t+=this.input.slice(o,this.state.pos);const d=this.state.curPosition(),m=this.state.pos===n?at:Rt;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(S.MissingUnicodeEscape,this.state.curPosition()),o=this.state.pos-1;continue}++this.state.pos;const g=this.readCodePoint(!0);g!==null&&(m(g)||this.raise(S.EscapedCharNotAnIdentifier,d),t+=String.fromCodePoint(g)),o=this.state.pos}else break}return t+this.input.slice(o,this.state.pos)}readWord(r){const t=this.readWord1(r),n=ir.get(t);n!==void 0?this.finishToken(n,xt(n)):this.finishToken(132,t)}checkKeywordEscapes(){const{type:r}=this.state;lr(r)&&this.state.containsEsc&&this.raise(S.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:xt(r)})}raise(r,t,n={}){const o=t instanceof s?t:t.loc.start,l=r(o,n);if(!(this.optionFlags&2048))throw l;return this.isLookahead||this.state.errors.push(l),l}raiseOverwrite(r,t,n={}){const o=t instanceof s?t:t.loc.start,l=o.index,d=this.state.errors;for(let m=d.length-1;m>=0;m--){const g=d[m];if(g.loc.index===l)return d[m]=r(o,n);if(g.loc.index<l)break}return this.raise(r,t,n)}updateContext(r){}unexpected(r,t){throw this.raise(S.UnexpectedToken,r??this.state.startLoc,{expected:t?xt(t):null})}expectPlugin(r,t){if(this.hasPlugin(r))return!0;throw this.raise(S.MissingPlugin,t??this.state.startLoc,{missingPlugin:[r]})}expectOnePlugin(r){if(!r.some(t=>this.hasPlugin(t)))throw this.raise(S.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:r})}errorBuilder(r){return(t,n,o)=>{this.raise(r,As(t,n,o))}}}class jh{constructor(){this.privateNames=new Set,this.loneAccessors=new Map,this.undefinedPrivateNames=new Map}}class zh{constructor(r){this.parser=void 0,this.stack=[],this.undefinedPrivateNames=new Map,this.parser=r}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new jh)}exit(){const r=this.stack.pop(),t=this.current();for(const[n,o]of Array.from(r.undefinedPrivateNames))t?t.undefinedPrivateNames.has(n)||t.undefinedPrivateNames.set(n,o):this.parser.raise(S.InvalidPrivateFieldResolution,o,{identifierName:n})}declarePrivateName(r,t,n){const{privateNames:o,loneAccessors:l,undefinedPrivateNames:d}=this.current();let m=o.has(r);if(t&3){const g=m&&l.get(r);if(g){const E=g&4,b=t&4,x=g&3,C=t&3;m=x===C||E!==b,m||l.delete(r)}else m||l.set(r,t)}m&&this.parser.raise(S.PrivateNameRedeclaration,n,{identifierName:r}),o.add(r),d.delete(r)}usePrivateName(r,t){let n;for(n of this.stack)if(n.privateNames.has(r))return;n?n.undefinedPrivateNames.set(r,t):this.parser.raise(S.InvalidPrivateFieldResolution,t,{identifierName:r})}}class Ys{constructor(r=0){this.type=r}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}}class ra extends Ys{constructor(r){super(r),this.declarationErrors=new Map}recordDeclarationError(r,t){const n=t.index;this.declarationErrors.set(n,[r,t])}clearDeclarationError(r){this.declarationErrors.delete(r)}iterateErrors(r){this.declarationErrors.forEach(r)}}class Vh{constructor(r){this.parser=void 0,this.stack=[new Ys],this.parser=r}enter(r){this.stack.push(r)}exit(){this.stack.pop()}recordParameterInitializerError(r,t){const n=t.loc.start,{stack:o}=this;let l=o.length-1,d=o[l];for(;!d.isCertainlyParameterDeclaration();){if(d.canBeArrowParameterDeclaration())d.recordDeclarationError(r,n);else return;d=o[--l]}this.parser.raise(r,n)}recordArrowParameterBindingError(r,t){const{stack:n}=this,o=n[n.length-1],l=t.loc.start;if(o.isCertainlyParameterDeclaration())this.parser.raise(r,l);else if(o.canBeArrowParameterDeclaration())o.recordDeclarationError(r,l);else return}recordAsyncArrowParametersError(r){const{stack:t}=this;let n=t.length-1,o=t[n];for(;o.canBeArrowParameterDeclaration();)o.type===2&&o.recordDeclarationError(S.AwaitBindingIdentifier,r),o=t[--n]}validateAsPattern(){const{stack:r}=this,t=r[r.length-1];t.canBeArrowParameterDeclaration()&&t.iterateErrors(([n,o])=>{this.parser.raise(n,o);let l=r.length-2,d=r[l];for(;d.canBeArrowParameterDeclaration();)d.clearDeclarationError(o.index),d=r[--l]})}}function Gh(){return new Ys(3)}function Hh(){return new ra(1)}function Zh(){return new ra(2)}function na(){return new Ys}class Wh extends Uh{addExtra(r,t,n,o=!0){if(!r)return;let{extra:l}=r;l==null&&(l={},r.extra=l),o?l[t]=n:Object.defineProperty(l,t,{enumerable:o,value:n})}isContextual(r){return this.state.type===r&&!this.state.containsEsc}isUnparsedContextual(r,t){if(this.input.startsWith(t,r)){const n=this.input.charCodeAt(r+t.length);return!(Rt(n)||(n&64512)===55296)}return!1}isLookaheadContextual(r){const t=this.nextTokenStart();return this.isUnparsedContextual(t,r)}eatContextual(r){return this.isContextual(r)?(this.next(),!0):!1}expectContextual(r,t){if(!this.eatContextual(r)){if(t!=null)throw this.raise(t,this.state.startLoc);this.unexpected(null,r)}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return Jn(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return Jn(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(r=!0){(r?this.isLineTerminator():this.eat(13))||this.raise(S.MissingSemicolon,this.state.lastTokEndLoc)}expect(r,t){this.eat(r)||this.unexpected(t,r)}tryParse(r,t=this.state.clone()){const n={node:null};try{const o=r((l=null)=>{throw n.node=l,n});if(this.state.errors.length>t.errors.length){const l=this.state;return this.state=t,this.state.tokensLength=l.tokensLength,{node:o,error:l.errors[t.errors.length],thrown:!1,aborted:!1,failState:l}}return{node:o,error:null,thrown:!1,aborted:!1,failState:null}}catch(o){const l=this.state;if(this.state=t,o instanceof SyntaxError)return{node:null,error:o,thrown:!0,aborted:!1,failState:l};if(o===n)return{node:n.node,error:null,thrown:!1,aborted:!0,failState:l};throw o}}checkExpressionErrors(r,t){if(!r)return!1;const{shorthandAssignLoc:n,doubleProtoLoc:o,privateKeyLoc:l,optionalParametersLoc:d,voidPatternLoc:m}=r,g=!!n||!!o||!!d||!!l||!!m;if(!t)return g;n!=null&&this.raise(S.InvalidCoverInitializedName,n),o!=null&&this.raise(S.DuplicateProto,o),l!=null&&this.raise(S.UnexpectedPrivateField,l),d!=null&&this.unexpected(d),m!=null&&this.raise(S.InvalidCoverDiscardElement,m)}isLiteralPropertyName(){return Vn(this.state.type)}isPrivateName(r){return r.type==="PrivateName"}getPrivateNameSV(r){return r.id.name}hasPropertyAsPrivateName(r){return(r.type==="MemberExpression"||r.type==="OptionalMemberExpression")&&this.isPrivateName(r.property)}isObjectProperty(r){return r.type==="ObjectProperty"}isObjectMethod(r){return r.type==="ObjectMethod"}initializeScopes(r=this.options.sourceType==="module"){const t=this.state.labels;this.state.labels=[];const n=this.exportedIdentifiers;this.exportedIdentifiers=new Set;const o=this.inModule;this.inModule=r;const l=this.scope,d=this.getScopeHandler();this.scope=new d(this,r);const m=this.prodParam;this.prodParam=new Lh;const g=this.classScope;this.classScope=new zh(this);const E=this.expressionScope;return this.expressionScope=new Vh(this),()=>{this.state.labels=t,this.exportedIdentifiers=n,this.inModule=o,this.scope=l,this.prodParam=m,this.classScope=g,this.expressionScope=E}}enterInitialScopes(){let r=0;(this.inModule||this.optionFlags&1)&&(r|=2),this.optionFlags&32&&(r|=1);const t=!this.inModule&&this.options.sourceType==="commonjs";(t||this.optionFlags&2)&&(r|=4),this.prodParam.enter(r);let n=t?514:1;this.optionFlags&4&&(n|=512),this.scope.enter(n)}checkDestructuringPrivate(r){const{privateKeyLoc:t}=r;t!==null&&this.expectPlugin("destructuringPrivate",t)}}class Xs{constructor(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null,this.voidPatternLoc=null}}class Js{constructor(r,t,n){this.type="",this.start=t,this.end=0,this.loc=new i(n),r?.optionFlags&128&&(this.range=[t,0]),r!=null&&r.filename&&(this.loc.filename=r.filename)}}const Tr=Js.prototype;Tr.__clone=function(){const p=new Js(void 0,this.start,this.loc.start),r=Object.keys(this);for(let t=0,n=r.length;t<n;t++){const o=r[t];o!=="leadingComments"&&o!=="trailingComments"&&o!=="innerComments"&&(p[o]=this[o])}return p};class Kh extends Wh{startNode(){const r=this.state.startLoc;return new Js(this,r.index,r)}startNodeAt(r){return new Js(this,r.index,r)}startNodeAtNode(r){return this.startNodeAt(r.loc.start)}finishNode(r,t){return this.finishNodeAt(r,t,this.state.lastTokEndLoc)}finishNodeAt(r,t,n){return r.type=t,r.end=n.index,r.loc.end=n,this.optionFlags&128&&(r.range[1]=n.index),this.optionFlags&4096&&this.processComment(r),r}resetStartLocation(r,t){r.start=t.index,r.loc.start=t,this.optionFlags&128&&(r.range[0]=t.index)}resetEndLocation(r,t=this.state.lastTokEndLoc){r.end=t.index,r.loc.end=t,this.optionFlags&128&&(r.range[1]=t.index)}resetStartLocationFromNode(r,t){this.resetStartLocation(r,t.loc.start)}castNodeTo(r,t){return r.type=t,r}cloneIdentifier(r){const{type:t,start:n,end:o,loc:l,range:d,name:m}=r,g=Object.create(Tr);return g.type=t,g.start=n,g.end=o,g.loc=l,g.range=d,g.name=m,r.extra&&(g.extra=r.extra),g}cloneStringLiteral(r){const{type:t,start:n,end:o,loc:l,range:d,extra:m}=r,g=Object.create(Tr);return g.type=t,g.start=n,g.end=o,g.loc=l,g.range=d,g.extra=m,g.value=r.value,g}}const Sr=p=>p.type==="ParenthesizedExpression"?Sr(p.expression):p;class qh extends Kh{toAssignable(r,t=!1){var n,o;let l;switch((r.type==="ParenthesizedExpression"||(n=r.extra)!=null&&n.parenthesized)&&(l=Sr(r),t?l.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(S.InvalidParenthesizedAssignment,r):l.type!=="CallExpression"&&l.type!=="MemberExpression"&&!this.isOptionalMemberExpression(l)&&this.raise(S.InvalidParenthesizedAssignment,r):this.raise(S.InvalidParenthesizedAssignment,r)),r.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(r,"ObjectPattern");for(let m=0,g=r.properties.length,E=g-1;m<g;m++){var d;const b=r.properties[m],x=m===E;this.toAssignableObjectExpressionProp(b,x,t),x&&b.type==="RestElement"&&(d=r.extra)!=null&&d.trailingCommaLoc&&this.raise(S.RestTrailingComma,r.extra.trailingCommaLoc)}break;case"ObjectProperty":{const{key:m,value:g}=r;this.isPrivateName(m)&&this.classScope.usePrivateName(this.getPrivateNameSV(m),m.loc.start),this.toAssignable(g,t);break}case"SpreadElement":throw new Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");case"ArrayExpression":this.castNodeTo(r,"ArrayPattern"),this.toAssignableList(r.elements,(o=r.extra)==null?void 0:o.trailingCommaLoc,t);break;case"AssignmentExpression":r.operator!=="="&&this.raise(S.MissingEqInAssignment,r.left.loc.end),this.castNodeTo(r,"AssignmentPattern"),delete r.operator,r.left.type==="VoidPattern"&&this.raise(S.VoidPatternInitializer,r.left),this.toAssignable(r.left,t);break;case"ParenthesizedExpression":this.toAssignable(l,t);break}}toAssignableObjectExpressionProp(r,t,n){if(r.type==="ObjectMethod")this.raise(r.kind==="get"||r.kind==="set"?S.PatternHasAccessor:S.PatternHasMethod,r.key);else if(r.type==="SpreadElement"){this.castNodeTo(r,"RestElement");const o=r.argument;this.checkToRestConversion(o,!1),this.toAssignable(o,n),t||this.raise(S.RestTrailingComma,r)}else this.toAssignable(r,n)}toAssignableList(r,t,n){const o=r.length-1;for(let l=0;l<=o;l++){const d=r[l];d&&(this.toAssignableListItem(r,l,n),d.type==="RestElement"&&(l<o?this.raise(S.RestTrailingComma,d):t&&this.raise(S.RestTrailingComma,t)))}}toAssignableListItem(r,t,n){const o=r[t];if(o.type==="SpreadElement"){this.castNodeTo(o,"RestElement");const l=o.argument;this.checkToRestConversion(l,!0),this.toAssignable(l,n)}else this.toAssignable(o,n)}isAssignable(r,t){switch(r.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":return!0;case"ObjectExpression":{const n=r.properties.length-1;return r.properties.every((o,l)=>o.type!=="ObjectMethod"&&(l===n||o.type!=="SpreadElement")&&this.isAssignable(o))}case"ObjectProperty":return this.isAssignable(r.value);case"SpreadElement":return this.isAssignable(r.argument);case"ArrayExpression":return r.elements.every(n=>n===null||this.isAssignable(n));case"AssignmentExpression":return r.operator==="=";case"ParenthesizedExpression":return this.isAssignable(r.expression);case"MemberExpression":case"OptionalMemberExpression":return!t;default:return!1}}toReferencedList(r,t){return r}toReferencedListDeep(r,t){this.toReferencedList(r,t);for(const n of r)n?.type==="ArrayExpression"&&this.toReferencedListDeep(n.elements)}parseSpread(r){const t=this.startNode();return this.next(),t.argument=this.parseMaybeAssignAllowIn(r,void 0),this.finishNode(t,"SpreadElement")}parseRestBinding(){const r=this.startNode();this.next();const t=this.parseBindingAtom();return t.type==="VoidPattern"&&this.raise(S.UnexpectedVoidPattern,t),r.argument=t,this.finishNode(r,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{const r=this.startNode();return this.next(),r.elements=this.parseBindingList(3,93,1),this.finishNode(r,"ArrayPattern")}case 5:return this.parseObjectLike(8,!0);case 88:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(r,t,n){const o=n&1,l=[];let d=!0;for(;!this.eat(r);)if(d?d=!1:this.expect(12),o&&this.match(12))l.push(null);else{if(this.eat(r))break;if(this.match(21)){let m=this.parseRestBinding();if((this.hasPlugin("flow")||n&2)&&(m=this.parseFunctionParamType(m)),l.push(m),!this.checkCommaAfterRest(t)){this.expect(r);break}}else{const m=[];if(n&2)for(this.match(26)&&this.hasPlugin("decorators")&&this.raise(S.UnsupportedParameterDecorator,this.state.startLoc);this.match(26);)m.push(this.parseDecorator());l.push(this.parseBindingElement(n,m))}}return l}parseBindingRestProperty(r){return this.next(),this.hasPlugin("discardBinding")&&this.match(88)?(r.argument=this.parseVoidPattern(null),this.raise(S.UnexpectedVoidPattern,r.argument)):r.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(r,"RestElement")}parseBindingProperty(){const{type:r,startLoc:t}=this.state;if(r===21)return this.parseBindingRestProperty(this.startNode());const n=this.startNode();return r===139?(this.expectPlugin("destructuringPrivate",t),this.classScope.usePrivateName(this.state.value,t),n.key=this.parsePrivateName()):this.parsePropertyName(n),n.method=!1,this.parseObjPropValue(n,t,!1,!1,!0,!1)}parseBindingElement(r,t){const n=this.parseMaybeDefault();return(this.hasPlugin("flow")||r&2)&&this.parseFunctionParamType(n),t.length&&(n.decorators=t,this.resetStartLocationFromNode(n,t[0])),this.parseMaybeDefault(n.loc.start,n)}parseFunctionParamType(r){return r}parseMaybeDefault(r,t){if(r??(r=this.state.startLoc),t=t??this.parseBindingAtom(),!this.eat(29))return t;const n=this.startNodeAt(r);return t.type==="VoidPattern"&&this.raise(S.VoidPatternInitializer,t),n.left=t,n.right=this.parseMaybeAssignAllowIn(),this.finishNode(n,"AssignmentPattern")}isValidLVal(r,t,n,o){switch(r){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";case"VoidPattern":return!0;case"CallExpression":if(!t&&!this.state.strict&&this.optionFlags&8192)return!0}return!1}isOptionalMemberExpression(r){return r.type==="OptionalMemberExpression"}checkLVal(r,t,n=64,o=!1,l=!1,d=!1,m=!1){var g;const E=r.type;if(this.isObjectMethod(r))return;const b=this.isOptionalMemberExpression(r);if(b||E==="MemberExpression"){b&&(this.expectPlugin("optionalChainingAssign",r.loc.start),t.type!=="AssignmentExpression"&&this.raise(S.InvalidLhsOptionalChaining,r,{ancestor:t})),n!==64&&this.raise(S.InvalidPropertyBindingPattern,r);return}if(E==="Identifier"){this.checkIdentifier(r,n,l);const{name:H}=r;o&&(o.has(H)?this.raise(S.ParamDupe,r):o.add(H));return}else E==="VoidPattern"&&t.type==="CatchClause"&&this.raise(S.VoidPatternCatchClauseParam,r);const x=Sr(r);m||(m=x.type==="CallExpression"&&(x.callee.type==="Import"||x.callee.type==="Super"));const C=this.isValidLVal(E,m,!(d||(g=r.extra)!=null&&g.parenthesized)&&t.type==="AssignmentExpression",n);if(C===!0)return;if(C===!1){const H=n===64?S.InvalidLhs:S.InvalidLhsBinding;this.raise(H,r,{ancestor:t});return}let v,M;typeof C=="string"?(v=C,M=E==="ParenthesizedExpression"):[v,M]=C;const Q=E==="ArrayPattern"||E==="ObjectPattern"?{type:E}:t,ue=r[v];if(Array.isArray(ue))for(const H of ue)H&&this.checkLVal(H,Q,n,o,l,M,!0);else ue&&this.checkLVal(ue,Q,n,o,l,M,m)}checkIdentifier(r,t,n=!1){this.state.strict&&(n?Yn(r.name,this.inModule):qn(r.name))&&(t===64?this.raise(S.StrictEvalArguments,r,{referenceName:r.name}):this.raise(S.StrictEvalArgumentsBinding,r,{bindingName:r.name})),t&8192&&r.name==="let"&&this.raise(S.LetInLexicalBinding,r),t&64||this.declareNameFromIdentifier(r,t)}declareNameFromIdentifier(r,t){this.scope.declareName(r.name,t,r.loc.start)}checkToRestConversion(r,t){switch(r.type){case"ParenthesizedExpression":this.checkToRestConversion(r.expression,t);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(t)break;default:this.raise(S.InvalidRestAssignmentPattern,r)}}checkCommaAfterRest(r){return this.match(12)?(this.raise(this.lookaheadCharCode()===r?S.RestTrailingComma:S.ElementAfterRest,this.state.startLoc),!0):!1}}const br=/in(?:stanceof)?|as|satisfies/y;function Yh(p){if(p==null)throw new Error(`Unexpected ${p} value.`);return p}function aa(p){if(!p)throw new Error("Assert fail")}const k=Ce`typescript`({AbstractMethodHasImplementation:({methodName:p})=>`Method '${p}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:p})=>`Property '${p}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind:p})=>`'declare' is not allowed in ${p}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:p})=>`Accessibility modifier already seen: '${p}'.`,DuplicateModifier:({modifier:p})=>`Duplicate modifier: '${p}'.`,EmptyHeritageClauseType:({token:p})=>`'${p}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:p})=>`'${p[0]}' modifier cannot be used with '${p[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:p})=>`Index signatures cannot have an accessibility modifier ('${p}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token:p})=>`'${p}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:p=>`'${p}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:p})=>`'${p}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:p})=>`'${p}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:p})=>`'${p}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:p=>`'${p}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:p})=>`'${p[0]}' modifier must precede '${p[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:p})=>`Private elements cannot have an accessibility modifier ('${p}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:p})=>`Single type parameter ${p} should have a trailing comma. Example usage: <${p},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:p})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${p}.`,UsingDeclarationInAmbientContext:p=>`'${p}' declarations are not allowed in ambient contexts.`});function Xh(p){switch(p){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function oa(p){return p==="private"||p==="public"||p==="protected"}function Jh(p){return p==="in"||p==="out"}var Qh=p=>class extends p{constructor(...t){super(...t),this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:k.InvalidModifierOnTypeParameter}),this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:k.InvalidModifierOnTypeParameterPositions}),this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:k.InvalidModifierOnTypeParameter})}getScopeHandler(){return Oh}tsIsIdentifier(){return ie(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(139)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){return this.next(),this.hasPrecedingLineBreak()?!1:this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){return this.match(106)?(this.next(),this.tsTokenCanFollowModifier()):this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(t,n,o){if(!ie(this.state.type)&&this.state.type!==58&&this.state.type!==75)return;const l=this.state.value;if(t.includes(l)){if(o&&this.match(106)||n&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return l}}tsParseModifiers({allowedModifiers:t,disallowedModifiers:n,stopOnStartOfClassStaticBlock:o,errorTemplate:l=k.InvalidModifierOnTypeMember},d){const m=(E,b,x,C)=>{b===x&&d[C]&&this.raise(k.InvalidModifiersOrder,E,{orderedModifiers:[x,C]})},g=(E,b,x,C)=>{(d[x]&&b===C||d[C]&&b===x)&&this.raise(k.IncompatibleModifiers,E,{modifiers:[x,C]})};for(;;){const{startLoc:E}=this.state,b=this.tsParseModifier(t.concat(n??[]),o,d.static);if(!b)break;oa(b)?d.accessibility?this.raise(k.DuplicateAccessibilityModifier,E,{modifier:b}):(m(E,b,b,"override"),m(E,b,b,"static"),m(E,b,b,"readonly"),d.accessibility=b):Jh(b)?(d[b]&&this.raise(k.DuplicateModifier,E,{modifier:b}),d[b]=!0,m(E,b,"in","out")):(hasOwnProperty.call(d,b)?this.raise(k.DuplicateModifier,E,{modifier:b}):(m(E,b,"static","readonly"),m(E,b,"static","override"),m(E,b,"override","readonly"),m(E,b,"abstract","override"),g(E,b,"declare","override"),g(E,b,"static","abstract")),d[b]=!0),n!=null&&n.includes(b)&&this.raise(l,E,{modifier:b})}}tsIsListTerminator(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48)}}tsParseList(t,n){const o=[];for(;!this.tsIsListTerminator(t);)o.push(n());return o}tsParseDelimitedList(t,n,o){return Yh(this.tsParseDelimitedListWorker(t,n,!0,o))}tsParseDelimitedListWorker(t,n,o,l){const d=[];let m=-1;for(;!this.tsIsListTerminator(t);){m=-1;const g=n();if(g==null)return;if(d.push(g),this.eat(12)){m=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(t))break;o&&this.expect(12);return}return l&&(l.value=m),d}tsParseBracketedList(t,n,o,l,d){l||(o?this.expect(0):this.expect(47));const m=this.tsParseDelimitedList(t,n,d);return o?this.expect(3):this.expect(48),m}tsParseImportType(){const t=this.startNode();return this.expect(83),this.expect(10),this.match(134)?t.argument=this.parseStringLiteral(this.state.value):(this.raise(k.UnsupportedImportTypeArgument,this.state.startLoc),t.argument=super.parseExprAtom()),this.eat(12)?t.options=this.tsParseImportTypeOptions():t.options=null,this.expect(11),this.eat(16)&&(t.qualifier=this.tsParseEntityName(3)),this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")}tsParseImportTypeOptions(){const t=this.startNode();this.expect(5);const n=this.startNode();return this.isContextual(76)?(n.method=!1,n.key=this.parseIdentifier(!0),n.computed=!1,n.shorthand=!1):this.unexpected(null,76),this.expect(14),n.value=this.tsParseImportTypeWithPropertyValue(),t.properties=[this.finishObjectProperty(n)],this.eat(12),this.expect(8),this.finishNode(t,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){const t=this.startNode(),n=[];for(this.expect(5);!this.match(8);){const o=this.state.type;ie(o)||o===134?n.push(super.parsePropertyDefinition(null)):this.unexpected(),this.eat(12)}return t.properties=n,this.next(),this.finishNode(t,"ObjectExpression")}tsParseEntityName(t){let n;if(t&1&&this.match(78))if(t&2)n=this.parseIdentifier(!0);else{const o=this.startNode();this.next(),n=this.finishNode(o,"ThisExpression")}else n=this.parseIdentifier(!!(t&1));for(;this.eat(16);){const o=this.startNodeAtNode(n);o.left=n,o.right=this.parseIdentifier(!!(t&1)),n=this.finishNode(o,"TSQualifiedName")}return n}tsParseTypeReference(){const t=this.startNode();return t.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")}tsParseThisTypePredicate(t){this.next();const n=this.startNodeAtNode(t);return n.parameterName=t,n.typeAnnotation=this.tsParseTypeAnnotation(!1),n.asserts=!1,this.finishNode(n,"TSTypePredicate")}tsParseThisTypeNode(){const t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")}tsParseTypeQuery(){const t=this.startNode();return this.expect(87),this.match(83)?t.exprName=this.tsParseImportType():t.exprName=this.tsParseEntityName(3),!this.hasPrecedingLineBreak()&&this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeQuery")}tsParseTypeParameter(t){const n=this.startNode();return t(n),n.name=this.tsParseTypeParameterName(),n.constraint=this.tsEatThenParseType(81),n.default=this.tsEatThenParseType(29),this.finishNode(n,"TSTypeParameter")}tsTryParseTypeParameters(t){if(this.match(47))return this.tsParseTypeParameters(t)}tsParseTypeParameters(t){const n=this.startNode();this.match(47)||this.match(143)?this.next():this.unexpected();const o={value:-1};return n.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,t),!1,!0,o),n.params.length===0&&this.raise(k.EmptyTypeParameters,n),o.value!==-1&&this.addExtra(n,"trailingComma",o.value),this.finishNode(n,"TSTypeParameterDeclaration")}tsFillSignature(t,n){const o=t===19,l="parameters",d="typeAnnotation";n.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(10),n[l]=this.tsParseBindingListForSignature(),o?n[d]=this.tsParseTypeOrTypePredicateAnnotation(t):this.match(t)&&(n[d]=this.tsParseTypeOrTypePredicateAnnotation(t))}tsParseBindingListForSignature(){const t=super.parseBindingList(11,41,2);for(const n of t){const{type:o}=n;(o==="AssignmentPattern"||o==="TSParameterProperty")&&this.raise(k.UnsupportedSignatureParameterKind,n,{type:o})}return t}tsParseTypeMemberSemicolon(){!this.eat(12)&&!this.isLineTerminator()&&this.expect(13)}tsParseSignatureMember(t,n){return this.tsFillSignature(14,n),this.tsParseTypeMemberSemicolon(),this.finishNode(n,t)}tsIsUnambiguouslyIndexSignature(){return this.next(),ie(this.state.type)?(this.next(),this.match(14)):!1}tsTryParseIndexSignature(t){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);const n=this.parseIdentifier();n.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(n),this.expect(3),t.parameters=[n];const o=this.tsTryParseTypeAnnotation();return o&&(t.typeAnnotation=o),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSIndexSignature")}tsParsePropertyOrMethodSignature(t,n){if(this.eat(17)&&(t.optional=!0),this.match(10)||this.match(47)){n&&this.raise(k.ReadonlyForMethodSignature,t);const o=t;o.kind&&this.match(47)&&this.raise(k.AccessorCannotHaveTypeParameters,this.state.curPosition()),this.tsFillSignature(14,o),this.tsParseTypeMemberSemicolon();const l="parameters",d="typeAnnotation";if(o.kind==="get")o[l].length>0&&(this.raise(S.BadGetterArity,this.state.curPosition()),this.isThisParam(o[l][0])&&this.raise(k.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if(o.kind==="set"){if(o[l].length!==1)this.raise(S.BadSetterArity,this.state.curPosition());else{const m=o[l][0];this.isThisParam(m)&&this.raise(k.AccessorCannotDeclareThisParameter,this.state.curPosition()),m.type==="Identifier"&&m.optional&&this.raise(k.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),m.type==="RestElement"&&this.raise(k.SetAccessorCannotHaveRestParameter,this.state.curPosition())}o[d]&&this.raise(k.SetAccessorCannotHaveReturnType,o[d])}else o.kind="method";return this.finishNode(o,"TSMethodSignature")}else{const o=t;n&&(o.readonly=!0);const l=this.tsTryParseTypeAnnotation();return l&&(o.typeAnnotation=l),this.tsParseTypeMemberSemicolon(),this.finishNode(o,"TSPropertySignature")}}tsParseTypeMember(){const t=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(77)){const o=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",t):(t.key=this.createIdentifier(o,"new"),this.tsParsePropertyOrMethodSignature(t,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},t);const n=this.tsTryParseIndexSignature(t);return n||(super.parsePropertyName(t),!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.tsTokenCanFollowModifier()&&(t.kind=t.key.name,super.parsePropertyName(t),!this.match(10)&&!this.match(47)&&this.unexpected(null,10)),this.tsParsePropertyOrMethodSignature(t,!!t.readonly))}tsParseTypeLiteral(){const t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(5);const t=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(8),t}tsIsStartOfMappedType(){return this.next(),this.eat(53)?this.isContextual(122):(this.isContextual(122)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(58)))}tsParseMappedType(){const t=this.startNode();this.expect(5),this.match(53)?(t.readonly=this.state.value,this.next(),this.expectContextual(122)):this.eatContextual(122)&&(t.readonly=!0),this.expect(0);const n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsExpectThenParseType(58),t.typeParameter=this.finishNode(n,"TSTypeParameter"),t.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(t.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(t,"TSMappedType")}tsParseTupleType(){const t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let n=!1;return t.elementTypes.forEach(o=>{const{type:l}=o;n&&l!=="TSRestType"&&l!=="TSOptionalType"&&!(l==="TSNamedTupleMember"&&o.optional)&&this.raise(k.OptionalTypeBeforeRequired,o),n||(n=l==="TSNamedTupleMember"&&o.optional||l==="TSOptionalType")}),this.finishNode(t,"TSTupleType")}tsParseTupleElementType(){const t=this.state.startLoc,n=this.eat(21),{startLoc:o}=this.state;let l,d,m,g;const b=Je(this.state.type)?this.lookaheadCharCode():null;if(b===58)l=!0,m=!1,d=this.parseIdentifier(!0),this.expect(14),g=this.tsParseType();else if(b===63){m=!0;const x=this.state.value,C=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(l=!0,d=this.createIdentifier(this.startNodeAt(o),x),this.expect(17),this.expect(14),g=this.tsParseType()):(l=!1,g=C,this.expect(17))}else g=this.tsParseType(),m=this.eat(17),l=this.eat(14);if(l){let x;d?(x=this.startNodeAt(o),x.optional=m,x.label=d,x.elementType=g,this.eat(17)&&(x.optional=!0,this.raise(k.TupleOptionalAfterType,this.state.lastTokStartLoc))):(x=this.startNodeAt(o),x.optional=m,this.raise(k.InvalidTupleMemberLabel,g),x.label=g,x.elementType=this.tsParseType()),g=this.finishNode(x,"TSNamedTupleMember")}else if(m){const x=this.startNodeAt(o);x.typeAnnotation=g,g=this.finishNode(x,"TSOptionalType")}if(n){const x=this.startNodeAt(t);x.typeAnnotation=g,g=this.finishNode(x,"TSRestType")}return g}tsParseParenthesizedType(){const t=this.startNode();return this.expect(10),t.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(t,"TSParenthesizedType")}tsParseFunctionOrConstructorType(t,n){const o=this.startNode();return t==="TSConstructorType"&&(o.abstract=!!n,n&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,o)),this.finishNode(o,t)}tsParseLiteralTypeNode(){const t=this.startNode();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:t.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(t,"TSLiteralType")}tsParseTemplateLiteralType(){const t=this.startNode();return t.literal=super.parseTemplate(!1),this.finishNode(t,"TSLiteralType")}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){const t=this.tsParseThisTypeNode();return this.isContextual(116)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const t=this.startNode(),n=this.lookahead();return n.type!==135&&n.type!==136&&this.unexpected(),t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{const{type:t}=this.state;if(ie(t)||t===88||t===84){const n=t===88?"TSVoidKeyword":t===84?"TSNullKeyword":Xh(this.state.value);if(n!==void 0&&this.lookaheadCharCode()!==46){const o=this.startNode();return this.next(),this.finishNode(o,n)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){const{startLoc:t}=this.state;let n=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){const o=this.startNodeAt(t);o.elementType=n,this.expect(3),n=this.finishNode(o,"TSArrayType")}else{const o=this.startNodeAt(t);o.objectType=n,o.indexType=this.tsParseType(),this.expect(3),n=this.finishNode(o,"TSIndexedAccessType")}return n}tsParseTypeOperator(){const t=this.startNode(),n=this.state.value;return this.next(),t.operator=n,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),n==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(t),this.finishNode(t,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(k.UnexpectedReadonly,t)}}tsParseInferType(){const t=this.startNode();this.expectContextual(115);const n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),t.typeParameter=this.finishNode(n,"TSTypeParameter"),this.finishNode(t,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(81)){const t=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17))return t}}tsParseTypeOperatorOrHigher(){return nh(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(t,n,o){const l=this.startNode(),d=this.eat(o),m=[];do m.push(n());while(this.eat(o));return m.length===1&&!d?m[0]:(l.types=m,this.finishNode(l,t))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){return this.match(47)?!0:this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(ie(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){const{errors:t}=this.state,n=t.length;try{return this.parseObjectLike(8,!0),t.length===n}catch{return!1}}if(this.match(0)){this.next();const{errors:t}=this.state,n=t.length;try{return super.parseBindingList(3,93,1),t.length===n}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(11)||this.match(21)||this.tsSkipParameterStart()&&(this.match(14)||this.match(12)||this.match(17)||this.match(29)||this.match(11)&&(this.next(),this.match(19))))}tsParseTypeOrTypePredicateAnnotation(t){return this.tsInType(()=>{const n=this.startNode();this.expect(t);const o=this.startNode(),l=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(l&&this.match(78)){let g=this.tsParseThisTypeOrThisTypePredicate();return g.type==="TSThisType"?(o.parameterName=g,o.asserts=!0,o.typeAnnotation=null,g=this.finishNode(o,"TSTypePredicate")):(this.resetStartLocationFromNode(g,o),g.asserts=!0),n.typeAnnotation=g,this.finishNode(n,"TSTypeAnnotation")}const d=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!d)return l?(o.parameterName=this.parseIdentifier(),o.asserts=l,o.typeAnnotation=null,n.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,n);const m=this.tsParseTypeAnnotation(!1);return o.parameterName=d,o.typeAnnotation=m,o.asserts=l,n.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(14))return this.tsParseTypeOrTypePredicateAnnotation(14)}tsTryParseTypeAnnotation(){if(this.match(14))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){const t=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak())return this.next(),t}tsParseTypePredicateAsserts(){if(this.state.type!==109)return!1;const t=this.state.containsEsc;return this.next(),!ie(this.state.type)&&!this.match(78)?!1:(t&&this.raise(S.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(t=!0,n=this.startNode()){return this.tsInType(()=>{t&&this.expect(14),n.typeAnnotation=this.tsParseType()}),this.finishNode(n,"TSTypeAnnotation")}tsParseType(){aa(this.state.inType);const t=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return t;const n=this.startNodeAtNode(t);return n.checkType=t,n.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(17),n.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(14),n.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(n,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(124)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(77)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(k.ReservedTypeAssertion,this.state.startLoc);const t=this.startNode();return t.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?this.tsParseTypeReference():this.tsParseType())),this.expect(48),t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")}tsParseHeritageClause(t){const n=this.state.startLoc,o=this.tsParseDelimitedList("HeritageClauseElement",()=>{const l=this.startNode();return l.expression=this.tsParseEntityName(3),this.match(47)&&(l.typeParameters=this.tsParseTypeArguments()),this.finishNode(l,"TSExpressionWithTypeArguments")});return o.length||this.raise(k.EmptyHeritageClauseType,n,{token:t}),o}tsParseInterfaceDeclaration(t,n={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129),n.declare&&(t.declare=!0),ie(this.state.type)?(t.id=this.parseIdentifier(),this.checkIdentifier(t.id,130)):(t.id=null,this.raise(k.MissingInterfaceName,this.state.startLoc)),t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(t.extends=this.tsParseHeritageClause("extends"));const o=this.startNode();return o.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),t.body=this.finishNode(o,"TSInterfaceBody"),this.finishNode(t,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(t){return t.id=this.parseIdentifier(),this.checkIdentifier(t.id,2),t.typeAnnotation=this.tsInType(()=>{if(t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(29),this.isContextual(114)&&this.lookaheadCharCode()!==46){const n=this.startNode();return this.next(),this.finishNode(n,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(t,"TSTypeAliasDeclaration")}tsInTopLevelContext(t){if(this.curContext()!==$.brace){const n=this.state.context;this.state.context=[n[0]];try{return t()}finally{this.state.context=n}}else return t()}tsInType(t){const n=this.state.inType;this.state.inType=!0;try{return t()}finally{this.state.inType=n}}tsInDisallowConditionalTypesContext(t){const n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.state.inDisallowConditionalTypesContext=n}}tsInAllowConditionalTypesContext(t){const n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.state.inDisallowConditionalTypesContext=n}}tsEatThenParseType(t){if(this.match(t))return this.tsNextThenParseType()}tsExpectThenParseType(t){return this.tsInType(()=>(this.expect(t),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){const t=this.startNode();return t.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(29)&&(t.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(t,"TSEnumMember")}tsParseEnumDeclaration(t,n={}){return n.const&&(t.const=!0),n.declare&&(t.declare=!0),this.expectContextual(126),t.id=this.parseIdentifier(),this.checkIdentifier(t.id,t.const?8971:8459),this.expect(5),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(t,"TSEnumDeclaration")}tsParseEnumBody(){const t=this.startNode();return this.expect(5),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(t,"TSEnumBody")}tsParseModuleBlock(){const t=this.startNode();return this.scope.enter(0),this.expect(5),super.parseBlockOrModuleBlockBody(t.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(t,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(t,n=!1){if(t.id=this.parseIdentifier(),n||this.checkIdentifier(t.id,1024),this.eat(16)){const o=this.startNode();this.tsParseModuleOrNamespaceDeclaration(o,!0),t.body=o}else this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit();return this.finishNode(t,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(t){return this.isContextual(112)?(t.kind="global",t.global=!0,t.id=this.parseIdentifier()):this.match(134)?(t.kind="module",t.id=super.parseStringLiteral(this.state.value)):this.unexpected(),this.match(5)?(this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(t,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(t,n,o){t.isExport=o||!1,t.id=n||this.parseIdentifier(),this.checkIdentifier(t.id,4096),this.expect(29);const l=this.tsParseModuleReference();return t.importKind==="type"&&l.type!=="TSExternalModuleReference"&&this.raise(k.ImportAliasHasImportType,l),t.moduleReference=l,this.semicolon(),this.finishNode(t,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){const t=this.startNode();return this.expectContextual(119),this.expect(10),this.match(134)||this.unexpected(),t.expression=super.parseExprAtom(),this.expect(11),this.sawUnambiguousESM=!0,this.finishNode(t,"TSExternalModuleReference")}tsLookAhead(t){const n=this.state.clone(),o=t();return this.state=n,o}tsTryParseAndCatch(t){const n=this.tryParse(o=>t()||o());if(!(n.aborted||!n.node))return n.error&&(this.state=n.failState),n.node}tsTryParse(t){const n=this.state.clone(),o=t();if(o!==void 0&&o!==!1)return o;this.state=n}tsTryParseDeclare(t){if(this.isLineTerminator())return;const n=this.state.type;return this.tsInAmbientContext(()=>{switch(n){case 68:return t.declare=!0,super.parseFunctionStatement(t,!1,!1);case 80:return t.declare=!0,this.parseClass(t,!0,!1);case 126:return this.tsParseEnumDeclaration(t,{declare:!0});case 112:return this.tsParseAmbientExternalModuleDeclaration(t);case 100:if(this.state.containsEsc)return;case 75:case 74:return!this.match(75)||!this.isLookaheadContextual("enum")?(t.declare=!0,this.parseVarStatement(t,this.state.value,!0)):(this.expect(75),this.tsParseEnumDeclaration(t,{const:!0,declare:!0}));case 107:if(this.isUsing())return this.raise(k.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.parseVarStatement(t,"using",!0);break;case 96:if(this.isAwaitUsing())return this.raise(k.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.next(),this.parseVarStatement(t,"await using",!0);break;case 129:{const o=this.tsParseInterfaceDeclaration(t,{declare:!0});if(o)return o}default:if(ie(n))return this.tsParseDeclaration(t,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(t,n,o,l){switch(n){case 124:if(this.tsCheckLineTerminator(o)&&(this.match(80)||ie(this.state.type)))return this.tsParseAbstractDeclaration(t,l);break;case 127:if(this.tsCheckLineTerminator(o)){if(this.match(134))return this.tsParseAmbientExternalModuleDeclaration(t);if(ie(this.state.type))return t.kind="module",this.tsParseModuleOrNamespaceDeclaration(t)}break;case 128:if(this.tsCheckLineTerminator(o)&&ie(this.state.type))return t.kind="namespace",this.tsParseModuleOrNamespaceDeclaration(t);break;case 130:if(this.tsCheckLineTerminator(o)&&ie(this.state.type))return this.tsParseTypeAliasDeclaration(t);break}}tsCheckLineTerminator(t){return t?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(t){if(!this.match(47))return;const n=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;const o=this.tsTryParseAndCatch(()=>{const l=this.startNodeAt(t);return l.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(l),l.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(19),l});if(this.state.maybeInArrowParameters=n,!!o)return super.parseArrowExpression(o,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===47)return this.tsParseTypeArguments()}tsParseTypeArguments(){const t=this.startNode();return t.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(47),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),t.params.length===0?this.raise(k.EmptyTypeArguments,t):!this.state.inType&&this.curContext()===$.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return ah(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseBindingElement(t,n){const o=n.length?n[0].loc.start:this.state.startLoc,l={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},l);const d=l.accessibility,m=l.override,g=l.readonly;!(t&4)&&(d||g||m)&&this.raise(k.UnexpectedParameterModifier,o);const E=this.parseMaybeDefault();t&2&&this.parseFunctionParamType(E);const b=this.parseMaybeDefault(E.loc.start,E);if(d||g||m){const x=this.startNodeAt(o);return n.length&&(x.decorators=n),d&&(x.accessibility=d),g&&(x.readonly=g),m&&(x.override=m),b.type!=="Identifier"&&b.type!=="AssignmentPattern"&&this.raise(k.UnsupportedParameterPropertyKind,x),x.parameter=b,this.finishNode(x,"TSParameterProperty")}return n.length&&(E.decorators=n),b}isSimpleParameter(t){return t.type==="TSParameterProperty"&&super.isSimpleParameter(t.parameter)||super.isSimpleParameter(t)}tsDisallowOptionalPattern(t){for(const n of t.params)n.type!=="Identifier"&&n.optional&&!this.state.isAmbientContext&&this.raise(k.PatternIsOptional,n)}setArrowFunctionParameters(t,n,o){super.setArrowFunctionParameters(t,n,o),this.tsDisallowOptionalPattern(t)}parseFunctionBodyAndFinish(t,n,o=!1){this.match(14)&&(t.returnType=this.tsParseTypeOrTypePredicateAnnotation(14));const l=n==="FunctionDeclaration"?"TSDeclareFunction":n==="ClassMethod"||n==="ClassPrivateMethod"?"TSDeclareMethod":void 0;return l&&!this.match(5)&&this.isLineTerminator()?this.finishNode(t,l):l==="TSDeclareFunction"&&this.state.isAmbientContext&&(this.raise(k.DeclareFunctionHasImplementation,t),t.declare)?super.parseFunctionBodyAndFinish(t,l,o):(this.tsDisallowOptionalPattern(t),super.parseFunctionBodyAndFinish(t,n,o))}registerFunctionStatementId(t){!t.body&&t.id?this.checkIdentifier(t.id,1024):super.registerFunctionStatementId(t)}tsCheckForInvalidTypeCasts(t){t.forEach(n=>{n?.type==="TSTypeCastExpression"&&this.raise(k.UnexpectedTypeAnnotation,n.typeAnnotation)})}toReferencedList(t,n){return this.tsCheckForInvalidTypeCasts(t),t}parseArrayLike(t,n,o){const l=super.parseArrayLike(t,n,o);return l.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(l.elements),l}parseSubscript(t,n,o,l){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=!1,this.next();const m=this.startNodeAt(n);return m.expression=t,this.finishNode(m,"TSNonNullExpression")}let d=!1;if(this.match(18)&&this.lookaheadCharCode()===60){if(o)return l.stop=!0,t;l.optionalChainMember=d=!0,this.next()}if(this.match(47)||this.match(51)){let m;const g=this.tsTryParseAndCatch(()=>{if(!o&&this.atPossibleAsyncArrow(t)){const C=this.tsTryParseGenericAsyncArrowFunction(n);if(C)return l.stop=!0,C}const E=this.tsParseTypeArgumentsInExpression();if(!E)return;if(d&&!this.match(10)){m=this.state.curPosition();return}if(Zs(this.state.type)){const C=super.parseTaggedTemplateExpression(t,n,l);return C.typeParameters=E,C}if(!o&&this.eat(10)){const C=this.startNodeAt(n);return C.callee=t,C.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(C.arguments),C.typeParameters=E,l.optionalChainMember&&(C.optional=d),this.finishCallExpression(C,l.optionalChainMember)}const b=this.state.type;if(b===48||b===52||b!==10&&b!==93&&b!==120&&Is(b)&&!this.hasPrecedingLineBreak())return;const x=this.startNodeAt(n);return x.expression=t,x.typeParameters=E,this.finishNode(x,"TSInstantiationExpression")});if(m&&this.unexpected(m,10),g)return g.type==="TSInstantiationExpression"&&((this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40)&&this.raise(k.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc),!this.match(16)&&!this.match(18)&&(g.expression=super.stopParseSubscript(t,l))),g}return super.parseSubscript(t,n,o,l)}parseNewCallee(t){var n;super.parseNewCallee(t);const{callee:o}=t;o.type==="TSInstantiationExpression"&&!((n=o.extra)!=null&&n.parenthesized)&&(t.typeParameters=o.typeParameters,t.callee=o.expression)}parseExprOp(t,n,o){let l;if(Hs(58)>o&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(l=this.isContextual(120)))){const d=this.startNodeAt(n);return d.expression=t,d.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?(l&&this.raise(S.UnexpectedKeyword,this.state.startLoc,{keyword:"const"}),this.tsParseTypeReference()):this.tsParseType())),this.finishNode(d,l?"TSSatisfiesExpression":"TSAsExpression"),this.reScan_lt_gt(),this.parseExprOp(d,n,o)}return super.parseExprOp(t,n,o)}checkReservedWord(t,n,o,l){this.state.isAmbientContext||super.checkReservedWord(t,n,o,l)}checkImportReflection(t){super.checkImportReflection(t),t.module&&t.importKind!=="value"&&this.raise(k.ImportReflectionHasImportType,t.specifiers[0].loc.start)}checkDuplicateExports(){}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(130)){const n=this.lookaheadCharCode();return t?n===123||n===42:n!==61}return!t&&this.isContextual(87)}applyImportPhase(t,n,o,l){super.applyImportPhase(t,n,o,l),n?t.exportKind=o==="type"?"type":"value":t.importKind=o==="type"||o==="typeof"?o:"value"}parseImport(t){if(this.match(134))return t.importKind="value",super.parseImport(t);let n;if(ie(this.state.type)&&this.lookaheadCharCode()===61)return t.importKind="value",this.tsParseImportEqualsDeclaration(t);if(this.isContextual(130)){const o=this.parseMaybeImportPhase(t,!1);if(this.lookaheadCharCode()===61)return this.tsParseImportEqualsDeclaration(t,o);n=super.parseImportSpecifiersAndAfter(t,o)}else n=super.parseImport(t);return n.importKind==="type"&&n.specifiers.length>1&&n.specifiers[0].type==="ImportDefaultSpecifier"&&this.raise(k.TypeImportCannotSpecifyDefaultAndNamed,n),n}parseExport(t,n){if(this.match(83)){const o=t;this.next();let l=null;return this.isContextual(130)&&this.isPotentialImportPhase(!1)?l=this.parseMaybeImportPhase(o,!1):o.importKind="value",this.tsParseImportEqualsDeclaration(o,l,!0)}else if(this.eat(29)){const o=t;return o.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(o,"TSExportAssignment")}else if(this.eatContextual(93)){const o=t;return this.expectContextual(128),o.id=this.parseIdentifier(),this.semicolon(),this.finishNode(o,"TSNamespaceExportDeclaration")}else return super.parseExport(t,n)}isAbstractClass(){return this.isContextual(124)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){const t=this.startNode();return this.next(),t.abstract=!0,this.parseClass(t,!0,!0)}if(this.match(129)){const t=this.tsParseInterfaceDeclaration(this.startNode());if(t)return t}return super.parseExportDefaultExpression()}parseVarStatement(t,n,o=!1){const{isAmbientContext:l}=this.state,d=super.parseVarStatement(t,n,o||l);if(!l)return d;if(!t.declare&&(n==="using"||n==="await using"))return this.raiseOverwrite(k.UsingDeclarationInAmbientContext,t,n),d;for(const{id:m,init:g}of d.declarations)g&&(n==="var"||n==="let"||m.typeAnnotation?this.raise(k.InitializerNotAllowedInAmbientContext,g):tp(g,this.hasPlugin("estree"))||this.raise(k.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,g));return d}parseStatementContent(t,n){if(!this.state.containsEsc)switch(this.state.type){case 75:{if(this.isLookaheadContextual("enum")){const o=this.startNode();return this.expect(75),this.tsParseEnumDeclaration(o,{const:!0})}break}case 124:case 125:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){const o=this.state.type,l=this.startNode();this.next();const d=o===125?this.tsTryParseDeclare(l):this.tsParseAbstractDeclaration(l,n);return d?(o===125&&(d.declare=!0),d):(l.expression=this.createIdentifier(this.startNodeAt(l.loc.start),o===125?"declare":"abstract"),this.semicolon(!1),this.finishNode(l,"ExpressionStatement"))}break}case 126:return this.tsParseEnumDeclaration(this.startNode());case 112:{if(this.lookaheadCharCode()===123){const l=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(l)}break}case 129:{const o=this.tsParseInterfaceDeclaration(this.startNode());if(o)return o;break}case 127:{if(this.nextTokenIsIdentifierOrStringLiteralOnSameLine()){const o=this.startNode();return this.next(),this.tsParseDeclaration(o,127,!1,n)}break}case 128:{if(this.nextTokenIsIdentifierOnSameLine()){const o=this.startNode();return this.next(),this.tsParseDeclaration(o,128,!1,n)}break}case 130:{if(this.nextTokenIsIdentifierOnSameLine()){const o=this.startNode();return this.next(),this.tsParseTypeAliasDeclaration(o)}break}}return super.parseStatementContent(t,n)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(t,n){return n.some(o=>oa(o)?t.accessibility===o:!!t[o])}tsIsStartOfStaticBlocks(){return this.isContextual(106)&&this.lookaheadCharCode()===123}parseClassMember(t,n,o){const l=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:l,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:k.InvalidModifierOnTypeParameterPositions},n);const d=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(n,l)&&this.raise(k.StaticBlockCannotHaveModifier,this.state.curPosition()),super.parseClassStaticBlock(t,n)):this.parseClassMemberWithIsStatic(t,n,o,!!n.static)};n.declare?this.tsInAmbientContext(d):d()}parseClassMemberWithIsStatic(t,n,o,l){const d=this.tsTryParseIndexSignature(n);if(d){t.body.push(d),n.abstract&&this.raise(k.IndexSignatureHasAbstract,n),n.accessibility&&this.raise(k.IndexSignatureHasAccessibility,n,{modifier:n.accessibility}),n.declare&&this.raise(k.IndexSignatureHasDeclare,n),n.override&&this.raise(k.IndexSignatureHasOverride,n);return}!this.state.inAbstractClass&&n.abstract&&this.raise(k.NonAbstractClassHasAbstractMethod,n),n.override&&(o.hadSuperClass||this.raise(k.OverrideNotInSubClass,n)),super.parseClassMemberWithIsStatic(t,n,o,l)}parsePostMemberNameModifiers(t){this.eat(17)&&(t.optional=!0),t.readonly&&this.match(10)&&this.raise(k.ClassMethodHasReadonly,t),t.declare&&this.match(10)&&this.raise(k.ClassMethodHasDeclare,t)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(t,n,o){if(!this.match(17))return t;if(this.state.maybeInArrowParameters){const l=this.lookaheadCharCode();if(l===44||l===61||l===58||l===41)return this.setOptionalParametersError(o),t}return super.parseConditional(t,n,o)}parseParenItem(t,n){const o=super.parseParenItem(t,n);if(this.eat(17)&&(o.optional=!0,this.resetEndLocation(t)),this.match(14)){const l=this.startNodeAt(n);return l.expression=t,l.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(l,"TSTypeCastExpression")}return t}parseExportDeclaration(t){if(!this.state.isAmbientContext&&this.isContextual(125))return this.tsInAmbientContext(()=>this.parseExportDeclaration(t));const n=this.state.startLoc,o=this.eatContextual(125);if(o&&(this.isContextual(125)||!this.shouldParseExportDeclaration()))throw this.raise(k.ExpectedAmbientAfterExportDeclare,this.state.startLoc);const d=ie(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(t);return d?((d.type==="TSInterfaceDeclaration"||d.type==="TSTypeAliasDeclaration"||o)&&(t.exportKind="type"),o&&d.type!=="TSImportEqualsDeclaration"&&(this.resetStartLocation(d,n),d.declare=!0),d):null}parseClassId(t,n,o,l){if((!n||o)&&this.isContextual(113))return;super.parseClassId(t,n,o,t.declare?1024:8331);const d=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);d&&(t.typeParameters=d)}parseClassPropertyAnnotation(t){t.optional||(this.eat(35)?t.definite=!0:this.eat(17)&&(t.optional=!0));const n=this.tsTryParseTypeAnnotation();n&&(t.typeAnnotation=n)}parseClassProperty(t){if(this.parseClassPropertyAnnotation(t),this.state.isAmbientContext&&!(t.readonly&&!t.typeAnnotation)&&this.match(29)&&this.raise(k.DeclareClassFieldHasInitializer,this.state.startLoc),t.abstract&&this.match(29)){const{key:n}=t;this.raise(k.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:n.type==="Identifier"&&!t.computed?n.name:`[${this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end))}]`})}return super.parseClassProperty(t)}parseClassPrivateProperty(t){return t.abstract&&this.raise(k.PrivateElementHasAbstract,t),t.accessibility&&this.raise(k.PrivateElementHasAccessibility,t,{modifier:t.accessibility}),this.parseClassPropertyAnnotation(t),super.parseClassPrivateProperty(t)}parseClassAccessorProperty(t){return this.parseClassPropertyAnnotation(t),t.optional&&this.raise(k.AccessorCannotBeOptional,t),super.parseClassAccessorProperty(t)}pushClassMethod(t,n,o,l,d,m){const g=this.tsTryParseTypeParameters(this.tsParseConstModifier);g&&d&&this.raise(k.ConstructorHasTypeParameters,g);const{declare:E=!1,kind:b}=n;E&&(b==="get"||b==="set")&&this.raise(k.DeclareAccessor,n,{kind:b}),g&&(n.typeParameters=g),super.pushClassMethod(t,n,o,l,d,m)}pushClassPrivateMethod(t,n,o,l){const d=this.tsTryParseTypeParameters(this.tsParseConstModifier);d&&(n.typeParameters=d),super.pushClassPrivateMethod(t,n,o,l)}declareClassPrivateMethodInScope(t,n){t.type!=="TSDeclareMethod"&&(t.type==="MethodDefinition"&&t.value.body==null||super.declareClassPrivateMethodInScope(t,n))}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass)if(t.superClass.type==="TSInstantiationExpression"){const n=t.superClass,o=n.expression;this.takeSurroundingComments(o,o.start,o.end);const l=n.typeParameters;this.takeSurroundingComments(l,l.start,l.end),t.superClass=o,t.superTypeParameters=l}else(this.match(47)||this.match(51))&&(t.superTypeParameters=this.tsParseTypeArgumentsInExpression());this.eatContextual(113)&&(t.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(t,n,o,l,d,m,g){const E=this.tsTryParseTypeParameters(this.tsParseConstModifier);return E&&(t.typeParameters=E),super.parseObjPropValue(t,n,o,l,d,m,g)}parseFunctionParams(t,n){const o=this.tsTryParseTypeParameters(this.tsParseConstModifier);o&&(t.typeParameters=o),super.parseFunctionParams(t,n)}parseVarId(t,n){super.parseVarId(t,n),t.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)&&(t.definite=!0);const o=this.tsTryParseTypeAnnotation();o&&(t.id.typeAnnotation=o,this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,n){return this.match(14)&&(t.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(t,n)}parseMaybeAssign(t,n){var o,l,d,m,g;let E,b,x;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(E=this.state.clone(),b=this.tryParse(()=>super.parseMaybeAssign(t,n),E),!b.error)return b.node;const{context:M}=this.state,Q=M[M.length-1];(Q===$.j_oTag||Q===$.j_expr)&&M.pop()}if(!((o=b)!=null&&o.error)&&!this.match(47))return super.parseMaybeAssign(t,n);(!E||E===this.state)&&(E=this.state.clone());let C;const v=this.tryParse(M=>{var Q,ue;C=this.tsParseTypeParameters(this.tsParseConstModifier);const H=super.parseMaybeAssign(t,n);return(H.type!=="ArrowFunctionExpression"||(Q=H.extra)!=null&&Q.parenthesized)&&M(),((ue=C)==null?void 0:ue.params.length)!==0&&this.resetStartLocationFromNode(H,C),H.typeParameters=C,H},E);if(!v.error&&!v.aborted)return C&&this.reportReservedArrowTypeParam(C),v.node;if(!b&&(aa(!this.hasPlugin("jsx")),x=this.tryParse(()=>super.parseMaybeAssign(t,n),E),!x.error))return x.node;if((l=b)!=null&&l.node)return this.state=b.failState,b.node;if(v.node)return this.state=v.failState,C&&this.reportReservedArrowTypeParam(C),v.node;if((d=x)!=null&&d.node)return this.state=x.failState,x.node;throw((m=b)==null?void 0:m.error)||v.error||((g=x)==null?void 0:g.error)}reportReservedArrowTypeParam(t){var n;t.params.length===1&&!t.params[0].constraint&&!((n=t.extra)!=null&&n.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(k.ReservedArrowTypeParam,t)}parseMaybeUnary(t,n){return!this.hasPlugin("jsx")&&this.match(47)?this.tsParseTypeAssertion():super.parseMaybeUnary(t,n)}parseArrow(t){if(this.match(14)){const n=this.tryParse(o=>{const l=this.tsParseTypeOrTypePredicateAnnotation(14);return(this.canInsertSemicolon()||!this.match(19))&&o(),l});if(n.aborted)return;n.thrown||(n.error&&(this.state=n.failState),t.returnType=n.node)}return super.parseArrow(t)}parseFunctionParamType(t){this.eat(17)&&(t.optional=!0);const n=this.tsTryParseTypeAnnotation();return n&&(t.typeAnnotation=n),this.resetEndLocation(t),t}isAssignable(t,n){switch(t.type){case"TSTypeCastExpression":return this.isAssignable(t.expression,n);case"TSParameterProperty":return!0;default:return super.isAssignable(t,n)}}toAssignable(t,n=!1){switch(t.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(t,n);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":n?this.expressionScope.recordArrowParameterBindingError(k.UnexpectedTypeCastInParameter,t):this.raise(k.UnexpectedTypeCastInParameter,t),this.toAssignable(t.expression,n);break;case"AssignmentExpression":!n&&t.left.type==="TSTypeCastExpression"&&(t.left=this.typeCastToParameter(t.left));default:super.toAssignable(t,n)}}toAssignableParenthesizedExpression(t,n){switch(t.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(t.expression,n);break;default:super.toAssignable(t,n)}}checkToRestConversion(t,n){switch(t.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(t.expression,!1);break;default:super.checkToRestConversion(t,n)}}isValidLVal(t,n,o,l){switch(t){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(l!==64||!o)&&["expression",!0];default:return super.isValidLVal(t,n,o,l)}}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(t,n){if(this.match(47)||this.match(51)){const o=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const l=super.parseMaybeDecoratorArguments(t,n);return l.typeParameters=o,l}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(t,n)}checkCommaAfterRest(t){return this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===t?(this.next(),!1):super.checkCommaAfterRest(t)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(t,n){const o=super.parseMaybeDefault(t,n);return o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start&&this.raise(k.TypeAnnotationAfterAssign,o.typeAnnotation),o}getTokenFromCode(t){if(this.state.inType){if(t===62){this.finishOp(48,1);return}if(t===60){this.finishOp(47,1);return}}super.getTokenFromCode(t)}reScan_lt_gt(){const{type:t}=this.state;t===47?(this.state.pos-=1,this.readToken_lt()):t===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:t}=this.state;return t===51?(this.state.pos-=2,this.finishOp(47,1),47):t}toAssignableListItem(t,n,o){const l=t[n];l.type==="TSTypeCastExpression"&&(t[n]=this.typeCastToParameter(l)),super.toAssignableListItem(t,n,o)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.loc.end),t.expression}shouldParseArrow(t){return this.match(14)?t.every(n=>this.isAssignable(n,!0)):super.shouldParseArrow(t)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(t){if(this.match(47)||this.match(51)){const n=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());n&&(t.typeParameters=n)}return super.jsxParseOpeningElementAfterName(t)}getGetterSetterExpectedParamCount(t){const n=super.getGetterSetterExpectedParamCount(t),l=this.getObjectOrClassMethodParams(t)[0];return l&&this.isThisParam(l)?n+1:n}parseCatchClauseParam(){const t=super.parseCatchClauseParam(),n=this.tsTryParseTypeAnnotation();return n&&(t.typeAnnotation=n,this.resetEndLocation(t)),t}tsInAmbientContext(t){const{isAmbientContext:n,strict:o}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return t()}finally{this.state.isAmbientContext=n,this.state.strict=o}}parseClass(t,n,o){const l=this.state.inAbstractClass;this.state.inAbstractClass=!!t.abstract;try{return super.parseClass(t,n,o)}finally{this.state.inAbstractClass=l}}tsParseAbstractDeclaration(t,n){if(this.match(80))return t.abstract=!0,this.maybeTakeDecorators(n,this.parseClass(t,!0,!1));if(this.isContextual(129))return this.hasFollowingLineBreak()?null:(t.abstract=!0,this.raise(k.NonClassMethodPropertyHasAbstractModifier,t),this.tsParseInterfaceDeclaration(t));throw this.unexpected(null,80)}parseMethod(t,n,o,l,d,m,g){const E=super.parseMethod(t,n,o,l,d,m,g);if((E.abstract||E.type==="TSAbstractMethodDefinition")&&(this.hasPlugin("estree")?E.value:E).body){const{key:C}=E;this.raise(k.AbstractMethodHasImplementation,E,{methodName:C.type==="Identifier"&&!E.computed?C.name:`[${this.input.slice(this.offsetToSourcePos(C.start),this.offsetToSourcePos(C.end))}]`})}return E}tsParseTypeParameterName(){return this.parseIdentifier().name}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(t,n,o,l){return!n&&l?(this.parseTypeOnlyImportExportSpecifier(t,!1,o),this.finishNode(t,"ExportSpecifier")):(t.exportKind="value",super.parseExportSpecifier(t,n,o,l))}parseImportSpecifier(t,n,o,l,d){return!n&&l?(this.parseTypeOnlyImportExportSpecifier(t,!0,o),this.finishNode(t,"ImportSpecifier")):(t.importKind="value",super.parseImportSpecifier(t,n,o,l,o?4098:4096))}parseTypeOnlyImportExportSpecifier(t,n,o){const l=n?"imported":"local",d=n?"local":"exported";let m=t[l],g,E=!1,b=!0;const x=m.loc.start;if(this.isContextual(93)){const v=this.parseIdentifier();if(this.isContextual(93)){const M=this.parseIdentifier();Je(this.state.type)?(E=!0,m=v,g=n?this.parseIdentifier():this.parseModuleExportName(),b=!1):(g=M,b=!1)}else Je(this.state.type)?(b=!1,g=n?this.parseIdentifier():this.parseModuleExportName()):(E=!0,m=v)}else Je(this.state.type)&&(E=!0,n?(m=this.parseIdentifier(!0),this.isContextual(93)||this.checkReservedWord(m.name,m.loc.start,!0,!0)):m=this.parseModuleExportName());E&&o&&this.raise(n?k.TypeModifierIsUsedInTypeImports:k.TypeModifierIsUsedInTypeExports,x),t[l]=m,t[d]=g;const C=n?"importKind":"exportKind";t[C]=E?"type":"value",b&&this.eatContextual(93)&&(t[d]=n?this.parseIdentifier():this.parseModuleExportName()),t[d]||(t[d]=this.cloneIdentifier(t[l])),n&&this.checkIdentifier(t[d],E?4098:4096)}fillOptionalPropertiesForTSESLint(t){var n,o,l,d,m,g,E,b,x,C,v,M,Q,ue,H,ce,$t,wt,ya,ga,Ea,Ta,Sa,ba,Ia,xa,Aa,Pa,wa,Ca,_a,va,Na,Oa,La,Da,ka,Ra,Ma,$a,Fa,Ba,Ua,ja,za,Va,Ga,Ha;switch(t.type){case"ExpressionStatement":(n=t.directive)!=null||(t.directive=void 0);return;case"RestElement":t.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":(o=t.decorators)!=null||(t.decorators=[]),(l=t.optional)!=null||(t.optional=!1),(d=t.typeAnnotation)!=null||(t.typeAnnotation=void 0);return;case"TSParameterProperty":(m=t.accessibility)!=null||(t.accessibility=void 0),(g=t.decorators)!=null||(t.decorators=[]),(E=t.override)!=null||(t.override=!1),(b=t.readonly)!=null||(t.readonly=!1),(x=t.static)!=null||(t.static=!1);return;case"TSEmptyBodyFunctionExpression":t.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":(C=t.declare)!=null||(t.declare=!1),(v=t.returnType)!=null||(t.returnType=void 0),(M=t.typeParameters)!=null||(t.typeParameters=void 0);return;case"Property":(Q=t.optional)!=null||(t.optional=!1);return;case"TSMethodSignature":case"TSPropertySignature":(ue=t.optional)!=null||(t.optional=!1);case"TSIndexSignature":(H=t.accessibility)!=null||(t.accessibility=void 0),(ce=t.readonly)!=null||(t.readonly=!1),($t=t.static)!=null||(t.static=!1);return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(wt=t.declare)!=null||(t.declare=!1),(ya=t.definite)!=null||(t.definite=!1),(ga=t.readonly)!=null||(t.readonly=!1),(Ea=t.typeAnnotation)!=null||(t.typeAnnotation=void 0);case"TSAbstractMethodDefinition":case"MethodDefinition":(Ta=t.accessibility)!=null||(t.accessibility=void 0),(Sa=t.decorators)!=null||(t.decorators=[]),(ba=t.override)!=null||(t.override=!1),(Ia=t.optional)!=null||(t.optional=!1);return;case"ClassExpression":(xa=t.id)!=null||(t.id=null);case"ClassDeclaration":(Aa=t.abstract)!=null||(t.abstract=!1),(Pa=t.declare)!=null||(t.declare=!1),(wa=t.decorators)!=null||(t.decorators=[]),(Ca=t.implements)!=null||(t.implements=[]),(_a=t.superTypeArguments)!=null||(t.superTypeArguments=void 0),(va=t.typeParameters)!=null||(t.typeParameters=void 0);return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(Na=t.declare)!=null||(t.declare=!1);return;case"VariableDeclarator":(Oa=t.definite)!=null||(t.definite=!1);return;case"TSEnumDeclaration":(La=t.const)!=null||(t.const=!1),(Da=t.declare)!=null||(t.declare=!1);return;case"TSEnumMember":(ka=t.computed)!=null||(t.computed=!1);return;case"TSImportType":(Ra=t.qualifier)!=null||(t.qualifier=null),(Ma=t.options)!=null||(t.options=null);return;case"TSInterfaceDeclaration":($a=t.declare)!=null||(t.declare=!1),(Fa=t.extends)!=null||(t.extends=[]);return;case"TSMappedType":(Ba=t.optional)!=null||(t.optional=!1),(Ua=t.readonly)!=null||(t.readonly=void 0);return;case"TSModuleDeclaration":(ja=t.declare)!=null||(t.declare=!1),(za=t.global)!=null||(t.global=t.kind==="global");return;case"TSTypeParameter":(Va=t.const)!=null||(t.const=!1),(Ga=t.in)!=null||(t.in=!1),(Ha=t.out)!=null||(t.out=!1);return}}chStartsBindingIdentifierAndNotRelationalOperator(t,n){if(at(t)){if(br.lastIndex=n,br.test(this.input)){const o=this.codePointAtPos(br.lastIndex);if(!Rt(o)&&o!==92)return!1}return!0}else return t===92}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){const t=this.nextTokenInLineStart(),n=this.codePointAtPos(t);return this.chStartsBindingIdentifierAndNotRelationalOperator(n,t)}nextTokenIsIdentifierOrStringLiteralOnSameLine(){const t=this.nextTokenInLineStart(),n=this.codePointAtPos(t);return this.chStartsBindingIdentifier(n,t)||n===34||n===39}};function ep(p){if(p.type!=="MemberExpression")return!1;const{computed:r,property:t}=p;return r&&t.type!=="StringLiteral"&&(t.type!=="TemplateLiteral"||t.expressions.length>0)?!1:la(p.object)}function tp(p,r){var t;const{type:n}=p;if((t=p.extra)!=null&&t.parenthesized)return!1;if(r){if(n==="Literal"){const{value:o}=p;if(typeof o=="string"||typeof o=="boolean")return!0}}else if(n==="StringLiteral"||n==="BooleanLiteral")return!0;return!!(ca(p,r)||sp(p,r)||n==="TemplateLiteral"&&p.expressions.length===0||ep(p))}function ca(p,r){return r?p.type==="Literal"&&(typeof p.value=="number"||"bigint"in p):p.type==="NumericLiteral"||p.type==="BigIntLiteral"}function sp(p,r){if(p.type==="UnaryExpression"){const{operator:t,argument:n}=p;if(t==="-"&&ca(n,r))return!0}return!1}function la(p){return p.type==="Identifier"?!0:p.type!=="MemberExpression"||p.computed?!1:la(p.object)}const ua=Ce`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var ip=p=>class extends p{parsePlaceholder(t){if(this.match(133)){const n=this.startNode();return this.next(),this.assertNoSpace(),n.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(133),this.finishPlaceholder(n,t)}}finishPlaceholder(t,n){let o=t;return(!o.expectedNode||!o.type)&&(o=this.finishNode(o,"Placeholder")),o.expectedNode=n,o}getTokenFromCode(t){t===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(133,2):super.getTokenFromCode(t)}parseExprAtom(t){return this.parsePlaceholder("Expression")||super.parseExprAtom(t)}parseIdentifier(t){return this.parsePlaceholder("Identifier")||super.parseIdentifier(t)}checkReservedWord(t,n,o,l){t!==void 0&&super.checkReservedWord(t,n,o,l)}cloneIdentifier(t){const n=super.cloneIdentifier(t);return n.type==="Placeholder"&&(n.expectedNode=t.expectedNode),n}cloneStringLiteral(t){return t.type==="Placeholder"?this.cloneIdentifier(t):super.cloneStringLiteral(t)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(t,n,o,l){return t==="Placeholder"||super.isValidLVal(t,n,o,l)}toAssignable(t,n){t&&t.type==="Placeholder"&&t.expectedNode==="Expression"?t.expectedNode="Pattern":super.toAssignable(t,n)}chStartsBindingIdentifier(t,n){if(super.chStartsBindingIdentifier(t,n))return!0;const o=this.nextTokenStart();return this.input.charCodeAt(o)===37&&this.input.charCodeAt(o+1)===37}verifyBreakContinue(t,n){var o;((o=t.label)==null?void 0:o.type)!=="Placeholder"&&super.verifyBreakContinue(t,n)}parseExpressionStatement(t,n){var o;if(n.type!=="Placeholder"||(o=n.extra)!=null&&o.parenthesized)return super.parseExpressionStatement(t,n);if(this.match(14)){const d=t;return d.label=this.finishPlaceholder(n,"Identifier"),this.next(),d.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(d,"LabeledStatement")}this.semicolon();const l=t;return l.name=n.name,this.finishPlaceholder(l,"Statement")}parseBlock(t,n,o){return this.parsePlaceholder("BlockStatement")||super.parseBlock(t,n,o)}parseFunctionId(t){return this.parsePlaceholder("Identifier")||super.parseFunctionId(t)}parseClass(t,n,o){const l=n?"ClassDeclaration":"ClassExpression";this.next();const d=this.state.strict,m=this.parsePlaceholder("Identifier");if(m)if(this.match(81)||this.match(133)||this.match(5))t.id=m;else{if(o||!n)return t.id=null,t.body=this.finishPlaceholder(m,"ClassBody"),this.finishNode(t,l);throw this.raise(ua.ClassNameIsRequired,this.state.startLoc)}else this.parseClassId(t,n,o);return super.parseClassSuper(t),t.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!t.superClass,d),this.finishNode(t,l)}parseExport(t,n){const o=this.parsePlaceholder("Identifier");if(!o)return super.parseExport(t,n);const l=t;if(!this.isContextual(98)&&!this.match(12))return l.specifiers=[],l.source=null,l.declaration=this.finishPlaceholder(o,"Declaration"),this.finishNode(l,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");const d=this.startNode();return d.exported=o,l.specifiers=[this.finishNode(d,"ExportDefaultSpecifier")],super.parseExport(l,n)}isExportDefaultSpecifier(){if(this.match(65)){const t=this.nextTokenStart();if(this.isUnparsedContextual(t,"from")&&this.input.startsWith(xt(133),this.nextTokenStartSince(t+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(t,n){var o;return(o=t.specifiers)!=null&&o.length?!0:super.maybeParseExportDefaultSpecifier(t,n)}checkExport(t){const{specifiers:n}=t;n!=null&&n.length&&(t.specifiers=n.filter(o=>o.exported.type==="Placeholder")),super.checkExport(t),t.specifiers=n}parseImport(t){const n=this.parsePlaceholder("Identifier");if(!n)return super.parseImport(t);if(t.specifiers=[],!this.isContextual(98)&&!this.match(12))return t.source=this.finishPlaceholder(n,"StringLiteral"),this.semicolon(),this.finishNode(t,"ImportDeclaration");const o=this.startNodeAtNode(n);return o.local=n,t.specifiers.push(this.finishNode(o,"ImportDefaultSpecifier")),this.eat(12)&&(this.maybeParseStarImportSpecifier(t)||this.parseNamedImportSpecifiers(t)),this.expectContextual(98),t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(ua.UnexpectedSpace,this.state.lastTokEndLoc)}},rp=p=>class extends p{parseV8Intrinsic(){if(this.match(54)){const t=this.state.startLoc,n=this.startNode();if(this.next(),ie(this.state.type)){const o=this.parseIdentifierName(),l=this.createIdentifier(n,o);if(this.castNodeTo(l,"V8IntrinsicIdentifier"),this.match(10))return l}this.unexpected(t)}}parseExprAtom(t){return this.parseV8Intrinsic()||super.parseExprAtom(t)}};const ha=["minimal","fsharp","hack","smart"],pa=["^^","@@","^","%","#"];function np(p){if(p.has("decorators")){if(p.has("decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");const n=p.get("decorators").decoratorsBeforeExport;if(n!=null&&typeof n!="boolean")throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");const o=p.get("decorators").allowCallParenthesized;if(o!=null&&typeof o!="boolean")throw new Error("'allowCallParenthesized' must be a boolean.")}if(p.has("flow")&&p.has("typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(p.has("placeholders")&&p.has("v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(p.has("pipelineOperator")){var r;const n=p.get("pipelineOperator").proposal;if(!ha.includes(n)){const o=ha.map(l=>`"${l}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${o}.`)}if(n==="hack"){var t;if(p.has("placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(p.has("v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");const o=p.get("pipelineOperator").topicToken;if(!pa.includes(o)){const l=pa.map(d=>`"${d}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${l}.`)}if(o==="#"&&((t=p.get("recordAndTuple"))==null?void 0:t.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple",p.get("recordAndTuple")])}\`.`)}else if(n==="smart"&&((r=p.get("recordAndTuple"))==null?void 0:r.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple",p.get("recordAndTuple")])}\`.`)}if(p.has("moduleAttributes")){if(p.has("deprecatedImportAssert")||p.has("importAssertions"))throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");if(p.get("moduleAttributes").version!=="may-2020")throw new Error("The 'moduleAttributes' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is 'may-2020'.")}if(p.has("importAssertions")&&p.has("deprecatedImportAssert"))throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");if(p.has("deprecatedImportAssert")||p.has("importAttributes")&&p.get("importAttributes").deprecatedAssertSyntax&&p.set("deprecatedImportAssert",{}),p.has("recordAndTuple")){const n=p.get("recordAndTuple").syntaxType;if(n!=null){const o=["hash","bar"];if(!o.includes(n))throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+o.map(l=>`'${l}'`).join(", "))}}if(p.has("asyncDoExpressions")&&!p.has("doExpressions")){const n=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw n.missingPlugins="doExpressions",n}if(p.has("optionalChainingAssign")&&p.get("optionalChainingAssign").version!=="2023-07")throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");if(p.has("discardBinding")&&p.get("discardBinding").syntaxType!=="void")throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.")}const da={estree:qt,jsx:vh,flow:Ph,typescript:Qh,v8intrinsic:rp,placeholders:ip},ap=Object.keys(da);class op extends qh{checkProto(r,t,n,o){if(r.type==="SpreadElement"||this.isObjectMethod(r)||r.computed||r.shorthand)return n;const l=r.key;return(l.type==="Identifier"?l.name:l.value)==="__proto__"?t?(this.raise(S.RecordNoProto,l),!0):(n&&(o?o.doubleProtoLoc===null&&(o.doubleProtoLoc=l.loc.start):this.raise(S.DuplicateProto,l)),!0):n}shouldExitDescending(r,t){return r.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(r.start)===t}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(140))throw this.raise(S.ParseExpressionEmptyInput,this.state.startLoc);const r=this.parseExpression();if(!this.match(140))throw this.raise(S.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),r.comments=this.comments,r.errors=this.state.errors,this.optionFlags&256&&(r.tokens=this.tokens),r}parseExpression(r,t){return r?this.disallowInAnd(()=>this.parseExpressionBase(t)):this.allowInAnd(()=>this.parseExpressionBase(t))}parseExpressionBase(r){const t=this.state.startLoc,n=this.parseMaybeAssign(r);if(this.match(12)){const o=this.startNodeAt(t);for(o.expressions=[n];this.eat(12);)o.expressions.push(this.parseMaybeAssign(r));return this.toReferencedList(o.expressions),this.finishNode(o,"SequenceExpression")}return n}parseMaybeAssignDisallowIn(r,t){return this.disallowInAnd(()=>this.parseMaybeAssign(r,t))}parseMaybeAssignAllowIn(r,t){return this.allowInAnd(()=>this.parseMaybeAssign(r,t))}setOptionalParametersError(r){r.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(r,t){const n=this.state.startLoc,o=this.isContextual(108);if(o&&this.prodParam.hasYield){this.next();let g=this.parseYield(n);return t&&(g=t.call(this,g,n)),g}let l;r?l=!1:(r=new Xs,l=!0);const{type:d}=this.state;(d===10||ie(d))&&(this.state.potentialArrowAt=this.state.start);let m=this.parseMaybeConditional(r);if(t&&(m=t.call(this,m,n)),eh(this.state.type)){const g=this.startNodeAt(n),E=this.state.value;if(g.operator=E,this.match(29)){this.toAssignable(m,!0),g.left=m;const b=n.index;r.doubleProtoLoc!=null&&r.doubleProtoLoc.index>=b&&(r.doubleProtoLoc=null),r.shorthandAssignLoc!=null&&r.shorthandAssignLoc.index>=b&&(r.shorthandAssignLoc=null),r.privateKeyLoc!=null&&r.privateKeyLoc.index>=b&&(this.checkDestructuringPrivate(r),r.privateKeyLoc=null),r.voidPatternLoc!=null&&r.voidPatternLoc.index>=b&&(r.voidPatternLoc=null)}else g.left=m;return this.next(),g.right=this.parseMaybeAssign(),this.checkLVal(m,this.finishNode(g,"AssignmentExpression"),void 0,void 0,void 0,void 0,E==="||="||E==="&&="||E==="??="),g}else l&&this.checkExpressionErrors(r,!0);if(o){const{type:g}=this.state;if((this.hasPlugin("v8intrinsic")?Is(g):Is(g)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(S.YieldNotInGeneratorFunction,n),this.parseYield(n)}return m}parseMaybeConditional(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseExprOps(r);return this.shouldExitDescending(o,n)?o:this.parseConditional(o,t,r)}parseConditional(r,t,n){if(this.eat(17)){const o=this.startNodeAt(t);return o.test=r,o.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),o.alternate=this.parseMaybeAssign(),this.finishNode(o,"ConditionalExpression")}return r}parseMaybeUnaryOrPrivate(r){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(r)}parseExprOps(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseMaybeUnaryOrPrivate(r);return this.shouldExitDescending(o,n)?o:this.parseExprOp(o,t,-1)}parseExprOp(r,t,n){if(this.isPrivateName(r)){const l=this.getPrivateNameSV(r);(n>=Hs(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(S.PrivateInExpectedIn,r,{identifierName:l}),this.classScope.usePrivateName(l,r.loc.start)}const o=this.state.type;if(sh(o)&&(this.prodParam.hasIn||!this.match(58))){let l=Hs(o);if(l>n){if(o===39){if(this.expectPlugin("pipelineOperator"),this.state.inFSharpPipelineDirectBody)return r;this.checkPipelineAtInfixOperator(r,t)}const d=this.startNodeAt(t);d.left=r,d.operator=this.state.value;const m=o===41||o===42,g=o===40;if(g&&(l=Hs(42)),this.next(),o===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])&&this.state.type===96&&this.prodParam.hasAwait)throw this.raise(S.UnexpectedAwaitAfterPipelineBody,this.state.startLoc);d.right=this.parseExprOpRightExpr(o,l);const E=this.finishNode(d,m||g?"LogicalExpression":"BinaryExpression"),b=this.state.type;if(g&&(b===41||b===42)||m&&b===40)throw this.raise(S.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(E,t,n)}}return r}parseExprOpRightExpr(r,t){const n=this.state.startLoc;switch(r){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"fsharp":return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(t))}if(this.getPluginOption("pipelineOperator","proposal")==="smart")return this.withTopicBindingContext(()=>{if(this.prodParam.hasYield&&this.isContextual(108))throw this.raise(S.PipeBodyIsTighter,this.state.startLoc);return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(r,t),n)});default:return this.parseExprOpBaseRightExpr(r,t)}}parseExprOpBaseRightExpr(r,t){const n=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),n,oh(r)?t-1:t)}parseHackPipeBody(){var r;const{startLoc:t}=this.state,n=this.parseMaybeAssign();return A.has(n.type)&&!((r=n.extra)!=null&&r.parenthesized)&&this.raise(S.PipeUnparenthesizedBody,t,{type:n.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(S.PipeTopicUnused,t),n}checkExponentialAfterUnary(r){this.match(57)&&this.raise(S.UnexpectedTokenUnaryExponentiation,r.argument)}parseMaybeUnary(r,t){const n=this.state.startLoc,o=this.isContextual(96);if(o&&this.recordAwaitIfAllowed()){this.next();const g=this.parseAwait(n);return t||this.checkExponentialAfterUnary(g),g}const l=this.match(34),d=this.startNode();if(rh(this.state.type)){d.operator=this.state.value,d.prefix=!0,this.match(72)&&this.expectPlugin("throwExpressions");const g=this.match(89);if(this.next(),d.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(r,!0),this.state.strict&&g){const E=d.argument;E.type==="Identifier"?this.raise(S.StrictDelete,d):this.hasPropertyAsPrivateName(E)&&this.raise(S.DeletePrivateField,d)}if(!l)return t||this.checkExponentialAfterUnary(d),this.finishNode(d,"UnaryExpression")}const m=this.parseUpdate(d,l,r);if(o){const{type:g}=this.state;if((this.hasPlugin("v8intrinsic")?Is(g):Is(g)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(S.AwaitNotInAsyncContext,n),this.parseAwait(n)}return m}parseUpdate(r,t,n){if(t){const d=r;return this.checkLVal(d.argument,this.finishNode(d,"UpdateExpression")),r}const o=this.state.startLoc;let l=this.parseExprSubscripts(n);if(this.checkExpressionErrors(n,!1))return l;for(;ih(this.state.type)&&!this.canInsertSemicolon();){const d=this.startNodeAt(o);d.operator=this.state.value,d.prefix=!1,d.argument=l,this.next(),this.checkLVal(l,l=this.finishNode(d,"UpdateExpression"))}return l}parseExprSubscripts(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseExprAtom(r);return this.shouldExitDescending(o,n)?o:this.parseSubscripts(o,t)}parseSubscripts(r,t,n){const o={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(r),stop:!1};do r=this.parseSubscript(r,t,n,o),o.maybeAsyncArrow=!1;while(!o.stop);return r}parseSubscript(r,t,n,o){const{type:l}=this.state;if(!n&&l===15)return this.parseBind(r,t,n,o);if(Zs(l))return this.parseTaggedTemplateExpression(r,t,o);let d=!1;if(l===18){if(n&&(this.raise(S.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40))return this.stopParseSubscript(r,o);o.optionalChainMember=d=!0,this.next()}if(!n&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(r,t,o,d);{const m=this.eat(0);return m||d||this.eat(16)?this.parseMember(r,t,o,m,d):this.stopParseSubscript(r,o)}}stopParseSubscript(r,t){return t.stop=!0,r}parseMember(r,t,n,o,l){const d=this.startNodeAt(t);return d.object=r,d.computed=o,o?(d.property=this.parseExpression(),this.expect(3)):this.match(139)?(r.type==="Super"&&this.raise(S.SuperPrivateField,t),this.classScope.usePrivateName(this.state.value,this.state.startLoc),d.property=this.parsePrivateName()):d.property=this.parseIdentifier(!0),n.optionalChainMember?(d.optional=l,this.finishNode(d,"OptionalMemberExpression")):this.finishNode(d,"MemberExpression")}parseBind(r,t,n,o){const l=this.startNodeAt(t);return l.object=r,this.next(),l.callee=this.parseNoCallExpr(),o.stop=!0,this.parseSubscripts(this.finishNode(l,"BindExpression"),t,n)}parseCoverCallAndAsyncArrowHead(r,t,n,o){const l=this.state.maybeInArrowParameters;let d=null;this.state.maybeInArrowParameters=!0,this.next();const m=this.startNodeAt(t);m.callee=r;const{maybeAsyncArrow:g,optionalChainMember:E}=n;g&&(this.expressionScope.enter(Zh()),d=new Xs),E&&(m.optional=o),o?m.arguments=this.parseCallExpressionArguments():m.arguments=this.parseCallExpressionArguments(r.type!=="Super",m,d);let b=this.finishCallExpression(m,E);return g&&this.shouldParseAsyncArrow()&&!o?(n.stop=!0,this.checkDestructuringPrivate(d),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),b=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),b)):(g&&(this.checkExpressionErrors(d,!0),this.expressionScope.exit()),this.toReferencedArguments(b)),this.state.maybeInArrowParameters=l,b}toReferencedArguments(r,t){this.toReferencedListDeep(r.arguments,t)}parseTaggedTemplateExpression(r,t,n){const o=this.startNodeAt(t);return o.tag=r,o.quasi=this.parseTemplate(!0),n.optionalChainMember&&this.raise(S.OptionalChainingNoTemplate,t),this.finishNode(o,"TaggedTemplateExpression")}atPossibleAsyncArrow(r){return r.type==="Identifier"&&r.name==="async"&&this.state.lastTokEndLoc.index===r.end&&!this.canInsertSemicolon()&&r.end-r.start===5&&this.offsetToSourcePos(r.start)===this.state.potentialArrowAt}finishCallExpression(r,t){if(r.callee.type==="Import")if(r.arguments.length===0||r.arguments.length>2)this.raise(S.ImportCallArity,r);else for(const n of r.arguments)n.type==="SpreadElement"&&this.raise(S.ImportCallSpreadArgument,n);return this.finishNode(r,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(r,t,n){const o=[];let l=!0;const d=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(11);){if(l)l=!1;else if(this.expect(12),this.match(11)){t&&this.addTrailingCommaExtraToNode(t),this.next();break}o.push(this.parseExprListItem(11,!1,n,r))}return this.state.inFSharpPipelineDirectBody=d,o}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(r,t){var n;return this.resetPreviousNodeTrailingComments(t),this.expect(19),this.parseArrowExpression(r,t.arguments,!0,(n=t.extra)==null?void 0:n.trailingCommaLoc),t.innerComments&&xs(r,t.innerComments),t.callee.trailingComments&&xs(r,t.callee.trailingComments),r}parseNoCallExpr(){const r=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),r,!0)}parseExprAtom(r){let t,n=null;const{type:o}=this.state;switch(o){case 79:return this.parseSuper();case 83:return t=this.startNode(),this.next(),this.match(16)?this.parseImportMetaPropertyOrPhaseCall(t):this.match(10)?this.optionFlags&512?this.parseImportCall(t):this.finishNode(t,"Import"):(this.raise(S.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(t,"Import"));case 78:return t=this.startNode(),this.next(),this.finishNode(t,"ThisExpression");case 90:return this.parseDo(this.startNode(),!1);case 56:case 31:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(!0);case 86:return this.parseBooleanLiteral(!1);case 10:{const l=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(l)}case 0:return this.parseArrayLike(3,!1,r);case 5:return this.parseObjectLike(8,!1,!1,r);case 68:return this.parseFunctionOrFunctionSent();case 26:n=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(n,this.startNode()),!1);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(!1);case 15:{t=this.startNode(),this.next(),t.object=null;const l=t.callee=this.parseNoCallExpr();if(l.type==="MemberExpression")return this.finishNode(t,"BindExpression");throw this.raise(S.UnsupportedBind,l)}case 139:return this.raise(S.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 33:return this.parseTopicReferenceThenEqualsSign(54,"%");case 32:return this.parseTopicReferenceThenEqualsSign(44,"^");case 37:case 38:return this.parseTopicReference("hack");case 44:case 54:case 27:{const l=this.getPluginOption("pipelineOperator","proposal");if(l)return this.parseTopicReference(l);throw this.unexpected()}case 47:{const l=this.input.codePointAt(this.nextTokenStart());throw at(l)||l===62?this.expectOnePlugin(["jsx","flow","typescript"]):this.unexpected()}default:if(o===137)return this.parseDecimalLiteral(this.state.value);if(o===2||o===1)return this.parseArrayLike(this.state.type===2?4:3,!0);if(o===6||o===7)return this.parseObjectLike(this.state.type===6?9:8,!1,!0);if(ie(o)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();const l=this.state.potentialArrowAt===this.state.start,d=this.state.containsEsc,m=this.parseIdentifier();if(!d&&m.name==="async"&&!this.canInsertSemicolon()){const{type:g}=this.state;if(g===68)return this.resetPreviousNodeTrailingComments(m),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(m));if(ie(g))return l&&this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(m)):m;if(g===90)return this.resetPreviousNodeTrailingComments(m),this.parseDo(this.startNodeAtNode(m),!0)}return l&&this.match(19)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(m),[m],!1)):m}else throw this.unexpected()}}parseTopicReferenceThenEqualsSign(r,t){const n=this.getPluginOption("pipelineOperator","proposal");if(n)return this.state.type=r,this.state.value=t,this.state.pos--,this.state.end--,this.state.endLoc=a(this.state.endLoc,-1),this.parseTopicReference(n);throw this.unexpected()}parseTopicReference(r){const t=this.startNode(),n=this.state.startLoc,o=this.state.type;return this.next(),this.finishTopicReference(t,n,r,o)}finishTopicReference(r,t,n,o){if(this.testTopicReferenceConfiguration(n,t,o))return n==="hack"?(this.topicReferenceIsAllowedInCurrentContext()||this.raise(S.PipeTopicUnbound,t),this.registerTopicReference(),this.finishNode(r,"TopicReference")):(this.topicReferenceIsAllowedInCurrentContext()||this.raise(S.PrimaryTopicNotAllowed,t),this.registerTopicReference(),this.finishNode(r,"PipelinePrimaryTopicReference"));throw this.raise(S.PipeTopicUnconfiguredToken,t,{token:xt(o)})}testTopicReferenceConfiguration(r,t,n){switch(r){case"hack":return this.hasPlugin(["pipelineOperator",{topicToken:xt(n)}]);case"smart":return n===27;default:throw this.raise(S.PipeTopicRequiresHackPipes,t)}}parseAsyncArrowUnaryFunction(r){this.prodParam.enter(Ks(!0,this.prodParam.hasYield));const t=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(S.LineTerminatorBeforeArrow,this.state.curPosition()),this.expect(19),this.parseArrowExpression(r,t,!0)}parseDo(r,t){this.expectPlugin("doExpressions"),t&&this.expectPlugin("asyncDoExpressions"),r.async=t,this.next();const n=this.state.labels;return this.state.labels=[],t?(this.prodParam.enter(2),r.body=this.parseBlock(),this.prodParam.exit()):r.body=this.parseBlock(),this.state.labels=n,this.finishNode(r,"DoExpression")}parseSuper(){const r=this.startNode();return this.next(),this.match(10)&&!this.scope.allowDirectSuper?this.optionFlags&16||this.raise(S.SuperNotAllowed,r):this.scope.allowSuper||this.optionFlags&16||this.raise(S.UnexpectedSuper,r),!this.match(10)&&!this.match(0)&&!this.match(16)&&this.raise(S.UnsupportedSuper,r),this.finishNode(r,"Super")}parsePrivateName(){const r=this.startNode(),t=this.startNodeAt(a(this.state.startLoc,1)),n=this.state.value;return this.next(),r.id=this.createIdentifier(t,n),this.finishNode(r,"PrivateName")}parseFunctionOrFunctionSent(){const r=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(r),"function");return this.next(),this.match(103)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(r,t,"sent")}return this.parseFunction(r)}parseMetaProperty(r,t,n){r.meta=t;const o=this.state.containsEsc;return r.property=this.parseIdentifier(!0),(r.property.name!==n||o)&&this.raise(S.UnsupportedMetaProperty,r.property,{target:t.name,onlyValidPropertyName:n}),this.finishNode(r,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(r){if(this.next(),this.isContextual(105)||this.isContextual(97)){const t=this.isContextual(105);return this.expectPlugin(t?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),r.phase=t?"source":"defer",this.parseImportCall(r)}else{const t=this.createIdentifierAt(this.startNodeAtNode(r),"import",this.state.lastTokStartLoc);return this.isContextual(101)&&(this.inModule||this.raise(S.ImportMetaOutsideModule,t),this.sawUnambiguousESM=!0),this.parseMetaProperty(r,t,"meta")}}parseLiteralAtNode(r,t,n){return this.addExtra(n,"rawValue",r),this.addExtra(n,"raw",this.input.slice(this.offsetToSourcePos(n.start),this.state.end)),n.value=r,this.next(),this.finishNode(n,t)}parseLiteral(r,t){const n=this.startNode();return this.parseLiteralAtNode(r,t,n)}parseStringLiteral(r){return this.parseLiteral(r,"StringLiteral")}parseNumericLiteral(r){return this.parseLiteral(r,"NumericLiteral")}parseBigIntLiteral(r){return this.parseLiteral(r,"BigIntLiteral")}parseDecimalLiteral(r){return this.parseLiteral(r,"DecimalLiteral")}parseRegExpLiteral(r){const t=this.startNode();return this.addExtra(t,"raw",this.input.slice(this.offsetToSourcePos(t.start),this.state.end)),t.pattern=r.pattern,t.flags=r.flags,this.next(),this.finishNode(t,"RegExpLiteral")}parseBooleanLiteral(r){const t=this.startNode();return t.value=r,this.next(),this.finishNode(t,"BooleanLiteral")}parseNullLiteral(){const r=this.startNode();return this.next(),this.finishNode(r,"NullLiteral")}parseParenAndDistinguishExpression(r){const t=this.state.startLoc;let n;this.next(),this.expressionScope.enter(Hh());const o=this.state.maybeInArrowParameters,l=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.inFSharpPipelineDirectBody=!1;const d=this.state.startLoc,m=[],g=new Xs;let E=!0,b,x;for(;!this.match(11);){if(E)E=!1;else if(this.expect(12,g.optionalParametersLoc===null?null:g.optionalParametersLoc),this.match(11)){x=this.state.startLoc;break}if(this.match(21)){const M=this.state.startLoc;if(b=this.state.startLoc,m.push(this.parseParenItem(this.parseRestBinding(),M)),!this.checkCommaAfterRest(41))break}else m.push(this.parseMaybeAssignAllowInOrVoidPattern(11,g,this.parseParenItem))}const C=this.state.lastTokEndLoc;this.expect(11),this.state.maybeInArrowParameters=o,this.state.inFSharpPipelineDirectBody=l;let v=this.startNodeAt(t);return r&&this.shouldParseArrow(m)&&(v=this.parseArrow(v))?(this.checkDestructuringPrivate(g),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(v,m,!1),v):(this.expressionScope.exit(),m.length||this.unexpected(this.state.lastTokStartLoc),x&&this.unexpected(x),b&&this.unexpected(b),this.checkExpressionErrors(g,!0),this.toReferencedListDeep(m,!0),m.length>1?(n=this.startNodeAt(d),n.expressions=m,this.finishNode(n,"SequenceExpression"),this.resetEndLocation(n,C)):n=m[0],this.wrapParenthesis(t,n))}wrapParenthesis(r,t){if(!(this.optionFlags&1024))return this.addExtra(t,"parenthesized",!0),this.addExtra(t,"parenStart",r.index),this.takeSurroundingComments(t,r.index,this.state.lastTokEndLoc.index),t;const n=this.startNodeAt(r);return n.expression=t,this.finishNode(n,"ParenthesizedExpression")}shouldParseArrow(r){return!this.canInsertSemicolon()}parseArrow(r){if(this.eat(19))return r}parseParenItem(r,t){return r}parseNewOrNewTarget(){const r=this.startNode();if(this.next(),this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(r),"new");this.next();const n=this.parseMetaProperty(r,t,"target");return this.scope.allowNewTarget||this.raise(S.UnexpectedNewTarget,n),n}return this.parseNew(r)}parseNew(r){if(this.parseNewCallee(r),this.eat(10)){const t=this.parseExprList(11);this.toReferencedList(t),r.arguments=t}else r.arguments=[];return this.finishNode(r,"NewExpression")}parseNewCallee(r){const t=this.match(83),n=this.parseNoCallExpr();r.callee=n,t&&(n.type==="Import"||n.type==="ImportExpression")&&this.raise(S.ImportCallNotNewExpression,n)}parseTemplateElement(r){const{start:t,startLoc:n,end:o,value:l}=this.state,d=t+1,m=this.startNodeAt(a(n,1));l===null&&(r||this.raise(S.InvalidEscapeSequenceTemplate,a(this.state.firstInvalidTemplateEscapePos,1)));const g=this.match(24),E=g?-1:-2,b=o+E;m.value={raw:this.input.slice(d,b).replace(/\r\n?/g,`
|
|
46
|
+
`),cooked:l===null?null:l.slice(1,E)},m.tail=g,this.next();const x=this.finishNode(m,"TemplateElement");return this.resetEndLocation(x,a(this.state.lastTokEndLoc,E)),x}parseTemplate(r){const t=this.startNode();let n=this.parseTemplateElement(r);const o=[n],l=[];for(;!n.tail;)l.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),o.push(n=this.parseTemplateElement(r));return t.expressions=l,t.quasis=o,this.finishNode(t,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(r,t,n,o){n&&this.expectPlugin("recordAndTuple");const l=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let d=!1,m=!0;const g=this.startNode();for(g.properties=[],this.next();!this.match(r);){if(m)m=!1;else if(this.expect(12),this.match(r)){this.addTrailingCommaExtraToNode(g);break}let b;t?b=this.parseBindingProperty():(b=this.parsePropertyDefinition(o),d=this.checkProto(b,n,d,o)),n&&!this.isObjectProperty(b)&&b.type!=="SpreadElement"&&this.raise(S.InvalidRecordProperty,b),b.shorthand&&this.addExtra(b,"shorthand",!0),g.properties.push(b)}this.next(),this.state.inFSharpPipelineDirectBody=l;let E="ObjectExpression";return t?E="ObjectPattern":n&&(E="RecordExpression"),this.finishNode(g,E)}addTrailingCommaExtraToNode(r){this.addExtra(r,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(r,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(r){return!r.computed&&r.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(r){let t=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(S.UnsupportedPropertyDecorator,this.state.startLoc);this.match(26);)t.push(this.parseDecorator());const n=this.startNode();let o=!1,l=!1,d;if(this.match(21))return t.length&&this.unexpected(),this.parseSpread();t.length&&(n.decorators=t,t=[]),n.method=!1,r&&(d=this.state.startLoc);let m=this.eat(55);this.parsePropertyNamePrefixOperator(n);const g=this.state.containsEsc;if(this.parsePropertyName(n,r),!m&&!g&&this.maybeAsyncOrAccessorProp(n)){const{key:E}=n,b=E.name;b==="async"&&!this.hasPrecedingLineBreak()&&(o=!0,this.resetPreviousNodeTrailingComments(E),m=this.eat(55),this.parsePropertyName(n)),(b==="get"||b==="set")&&(l=!0,this.resetPreviousNodeTrailingComments(E),n.kind=b,this.match(55)&&(m=!0,this.raise(S.AccessorIsGenerator,this.state.curPosition(),{kind:b}),this.next()),this.parsePropertyName(n))}return this.parseObjPropValue(n,d,m,o,!1,l,r)}getGetterSetterExpectedParamCount(r){return r.kind==="get"?0:1}getObjectOrClassMethodParams(r){return r.params}checkGetterSetterParams(r){var t;const n=this.getGetterSetterExpectedParamCount(r),o=this.getObjectOrClassMethodParams(r);o.length!==n&&this.raise(r.kind==="get"?S.BadGetterArity:S.BadSetterArity,r),r.kind==="set"&&((t=o[o.length-1])==null?void 0:t.type)==="RestElement"&&this.raise(S.BadSetterRestParameter,r)}parseObjectMethod(r,t,n,o,l){if(l){const d=this.parseMethod(r,t,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(d),d}if(n||t||this.match(10))return o&&this.unexpected(),r.kind="method",r.method=!0,this.parseMethod(r,t,n,!1,!1,"ObjectMethod")}parseObjectProperty(r,t,n,o){if(r.shorthand=!1,this.eat(14))return r.value=n?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(8,o),this.finishObjectProperty(r);if(!r.computed&&r.key.type==="Identifier"){if(this.checkReservedWord(r.key.name,r.key.loc.start,!0,!1),n)r.value=this.parseMaybeDefault(t,this.cloneIdentifier(r.key));else if(this.match(29)){const l=this.state.startLoc;o!=null?o.shorthandAssignLoc===null&&(o.shorthandAssignLoc=l):this.raise(S.InvalidCoverInitializedName,l),r.value=this.parseMaybeDefault(t,this.cloneIdentifier(r.key))}else r.value=this.cloneIdentifier(r.key);return r.shorthand=!0,this.finishObjectProperty(r)}}finishObjectProperty(r){return this.finishNode(r,"ObjectProperty")}parseObjPropValue(r,t,n,o,l,d,m){const g=this.parseObjectMethod(r,n,o,l,d)||this.parseObjectProperty(r,t,l,m);return g||this.unexpected(),g}parsePropertyName(r,t){if(this.eat(0))r.computed=!0,r.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{const{type:n,value:o}=this.state;let l;if(Je(n))l=this.parseIdentifier(!0);else switch(n){case 135:l=this.parseNumericLiteral(o);break;case 134:l=this.parseStringLiteral(o);break;case 136:l=this.parseBigIntLiteral(o);break;case 139:{const d=this.state.startLoc;t!=null?t.privateKeyLoc===null&&(t.privateKeyLoc=d):this.raise(S.UnexpectedPrivateField,d),l=this.parsePrivateName();break}default:if(n===137){l=this.parseDecimalLiteral(o);break}this.unexpected()}r.key=l,n!==139&&(r.computed=!1)}}initFunction(r,t){r.id=null,r.generator=!1,r.async=t}parseMethod(r,t,n,o,l,d,m=!1){this.initFunction(r,n),r.generator=t,this.scope.enter(530|(m?576:0)|(l?32:0)),this.prodParam.enter(Ks(n,r.generator)),this.parseFunctionParams(r,o);const g=this.parseFunctionBodyAndFinish(r,d,!0);return this.prodParam.exit(),this.scope.exit(),g}parseArrayLike(r,t,n){t&&this.expectPlugin("recordAndTuple");const o=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;const l=this.startNode();return this.next(),l.elements=this.parseExprList(r,!t,n,l),this.state.inFSharpPipelineDirectBody=o,this.finishNode(l,t?"TupleExpression":"ArrayExpression")}parseArrowExpression(r,t,n,o){this.scope.enter(518);let l=Ks(n,!1);!this.match(5)&&this.prodParam.hasIn&&(l|=8),this.prodParam.enter(l),this.initFunction(r,n);const d=this.state.maybeInArrowParameters;return t&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(r,t,o)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(r,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=d,this.finishNode(r,"ArrowFunctionExpression")}setArrowFunctionParameters(r,t,n){this.toAssignableList(t,n,!1),r.params=t}parseFunctionBodyAndFinish(r,t,n=!1){return this.parseFunctionBody(r,!1,n),this.finishNode(r,t)}parseFunctionBody(r,t,n=!1){const o=t&&!this.match(5);if(this.expressionScope.enter(na()),o)r.body=this.parseMaybeAssign(),this.checkParams(r,!1,t,!1);else{const l=this.state.strict,d=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),r.body=this.parseBlock(!0,!1,m=>{const g=!this.isSimpleParamList(r.params);m&&g&&this.raise(S.IllegalLanguageModeDirective,(r.kind==="method"||r.kind==="constructor")&&r.key?r.key.loc.end:r);const E=!l&&this.state.strict;this.checkParams(r,!this.state.strict&&!t&&!n&&!g,t,E),this.state.strict&&r.id&&this.checkIdentifier(r.id,65,E)}),this.prodParam.exit(),this.state.labels=d}this.expressionScope.exit()}isSimpleParameter(r){return r.type==="Identifier"}isSimpleParamList(r){for(let t=0,n=r.length;t<n;t++)if(!this.isSimpleParameter(r[t]))return!1;return!0}checkParams(r,t,n,o=!0){const l=!t&&new Set,d={type:"FormalParameters"};for(const m of r.params)this.checkLVal(m,d,5,l,o)}parseExprList(r,t,n,o){const l=[];let d=!0;for(;!this.eat(r);){if(d)d=!1;else if(this.expect(12),this.match(r)){o&&this.addTrailingCommaExtraToNode(o),this.next();break}l.push(this.parseExprListItem(r,t,n))}return l}parseExprListItem(r,t,n,o){let l;if(this.match(12))t||this.raise(S.UnexpectedToken,this.state.curPosition(),{unexpected:","}),l=null;else if(this.match(21)){const d=this.state.startLoc;l=this.parseParenItem(this.parseSpread(n),d)}else if(this.match(17)){this.expectPlugin("partialApplication"),o||this.raise(S.UnexpectedArgumentPlaceholder,this.state.startLoc);const d=this.startNode();this.next(),l=this.finishNode(d,"ArgumentPlaceholder")}else l=this.parseMaybeAssignAllowInOrVoidPattern(r,n,this.parseParenItem);return l}parseIdentifier(r){const t=this.startNode(),n=this.parseIdentifierName(r);return this.createIdentifier(t,n)}createIdentifier(r,t){return r.name=t,r.loc.identifierName=t,this.finishNode(r,"Identifier")}createIdentifierAt(r,t,n){return r.name=t,r.loc.identifierName=t,this.finishNodeAt(r,"Identifier",n)}parseIdentifierName(r){let t;const{startLoc:n,type:o}=this.state;Je(o)?t=this.state.value:this.unexpected();const l=Ju(o);return r?l&&this.replaceToken(132):this.checkReservedWord(t,n,l,!1),this.next(),t}checkReservedWord(r,t,n,o){if(r.length>10||!gh(r))return;if(n&&fh(r)){this.raise(S.UnexpectedKeyword,t,{keyword:r});return}if((this.state.strict?o?Yn:Kn:Wn)(r,this.inModule)){this.raise(S.UnexpectedReservedWord,t,{reservedWord:r});return}else if(r==="yield"){if(this.prodParam.hasYield){this.raise(S.YieldBindingIdentifier,t);return}}else if(r==="await"){if(this.prodParam.hasAwait){this.raise(S.AwaitBindingIdentifier,t);return}if(this.scope.inStaticBlock){this.raise(S.AwaitBindingIdentifierInStaticBlock,t);return}this.expressionScope.recordAsyncArrowParametersError(t)}else if(r==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(S.ArgumentsInClass,t);return}}recordAwaitIfAllowed(){const r=this.prodParam.hasAwait;return r&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),r}parseAwait(r){const t=this.startNodeAt(r);return this.expressionScope.recordParameterInitializerError(S.AwaitExpressionFormalParameter,t),this.eat(55)&&this.raise(S.ObsoleteAwaitStar,t),!this.scope.inFunction&&!(this.optionFlags&1)&&(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(t.argument=this.parseMaybeUnary(null,!0)),this.finishNode(t,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;const{type:r}=this.state;return r===53||r===10||r===0||Zs(r)||r===102&&!this.state.containsEsc||r===138||r===56||this.hasPlugin("v8intrinsic")&&r===54}parseYield(r){const t=this.startNodeAt(r);this.expressionScope.recordParameterInitializerError(S.YieldInParameter,t);let n=!1,o=null;if(!this.hasPrecedingLineBreak())switch(n=this.eat(55),this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!n)break;default:o=this.parseMaybeAssign()}return t.delegate=n,t.argument=o,this.finishNode(t,"YieldExpression")}parseImportCall(r){if(this.next(),r.source=this.parseMaybeAssignAllowIn(),r.options=null,this.eat(12)){if(this.match(11))this.addTrailingCommaExtraToNode(r.source);else if(r.options=this.parseMaybeAssignAllowIn(),this.eat(12)&&(this.addTrailingCommaExtraToNode(r.options),!this.match(11))){do this.parseMaybeAssignAllowIn();while(this.eat(12)&&!this.match(11));this.raise(S.ImportCallArity,r)}}return this.expect(11),this.finishNode(r,"ImportExpression")}checkPipelineAtInfixOperator(r,t){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&r.type==="SequenceExpression"&&this.raise(S.PipelineHeadSequenceExpression,t)}parseSmartPipelineBodyInStyle(r,t){if(this.isSimpleReference(r)){const n=this.startNodeAt(t);return n.callee=r,this.finishNode(n,"PipelineBareFunction")}else{const n=this.startNodeAt(t);return this.checkSmartPipeTopicBodyEarlyErrors(t),n.expression=r,this.finishNode(n,"PipelineTopicExpression")}}isSimpleReference(r){switch(r.type){case"MemberExpression":return!r.computed&&this.isSimpleReference(r.object);case"Identifier":return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(r){if(this.match(19))throw this.raise(S.PipelineBodyNoArrow,this.state.startLoc);this.topicReferenceWasUsedInCurrentContext()||this.raise(S.PipelineTopicUnused,r)}withTopicBindingContext(r){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return r()}finally{this.state.topicContext=t}}withSmartMixTopicForbiddingContext(r){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return r()}finally{this.state.topicContext=t}}else return r()}withSoloAwaitPermittingContext(r){const t=this.state.soloAwait;this.state.soloAwait=!0;try{return r()}finally{this.state.soloAwait=t}}allowInAnd(r){const t=this.prodParam.currentFlags();if(8&~t){this.prodParam.enter(t|8);try{return r()}finally{this.prodParam.exit()}}return r()}disallowInAnd(r){const t=this.prodParam.currentFlags();if(8&t){this.prodParam.enter(t&-9);try{return r()}finally{this.prodParam.exit()}}return r()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(r){const t=this.state.startLoc;this.state.potentialArrowAt=this.state.start;const n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;const o=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,r);return this.state.inFSharpPipelineDirectBody=n,o}parseModuleExpression(){this.expectPlugin("moduleBlocks");const r=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);const t=this.startNodeAt(this.state.endLoc);this.next();const n=this.initializeScopes(!0);this.enterInitialScopes();try{r.body=this.parseProgram(t,8,"module")}finally{n()}return this.finishNode(r,"ModuleExpression")}parseVoidPattern(r){this.expectPlugin("discardBinding");const t=this.startNode();return r!=null&&(r.voidPatternLoc=this.state.startLoc),this.next(),this.finishNode(t,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(r,t,n){if(t!=null&&this.match(88)){const o=this.lookaheadCharCode();if(o===44||o===(r===3?93:r===8?125:41)||o===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(t))}return this.parseMaybeAssignAllowIn(t,n)}parsePropertyNamePrefixOperator(r){}}const Ir={kind:1},cp={kind:2},lp=/[\uD800-\uDFFF]/u,xr=/in(?:stanceof)?/y;function up(p,r,t){for(let n=0;n<p.length;n++){const o=p[n],{type:l}=o;if(typeof l=="number"){if(l===139){const{loc:d,start:m,value:g,end:E}=o,b=m+1,x=a(d.start,1);p.splice(n,1,new Pt({type:ut(27),value:"#",start:m,end:b,startLoc:d.start,endLoc:x}),new Pt({type:ut(132),value:g,start:b,end:E,startLoc:x,endLoc:d.end})),n++;continue}if(Zs(l)){const{loc:d,start:m,value:g,end:E}=o,b=m+1,x=a(d.start,1);let C;r.charCodeAt(m-t)===96?C=new Pt({type:ut(22),value:"`",start:m,end:b,startLoc:d.start,endLoc:x}):C=new Pt({type:ut(8),value:"}",start:m,end:b,startLoc:d.start,endLoc:x});let v,M,Q,ue;l===24?(M=E-1,Q=a(d.end,-1),v=g===null?null:g.slice(1,-1),ue=new Pt({type:ut(22),value:"`",start:M,end:E,startLoc:Q,endLoc:d.end})):(M=E-2,Q=a(d.end,-2),v=g===null?null:g.slice(1,-2),ue=new Pt({type:ut(23),value:"${",start:M,end:E,startLoc:Q,endLoc:d.end})),p.splice(n,1,C,new Pt({type:ut(20),value:v,start:b,end:M,startLoc:x,endLoc:Q}),ue),n+=2;continue}o.type=ut(l)}}return p}class hp extends op{parseTopLevel(r,t){return r.program=this.parseProgram(t,140,this.options.sourceType==="module"?"module":"script"),r.comments=this.comments,this.optionFlags&256&&(r.tokens=up(this.tokens,this.input,this.startIndex)),this.finishNode(r,"File")}parseProgram(r,t,n){if(r.sourceType=n,r.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(r,!0,!0,t),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(const[l,d]of Array.from(this.scope.undefinedExports))this.raise(S.ModuleExportUndefined,d,{localName:l});this.addExtra(r,"topLevelAwait",this.state.hasTopLevelAwait)}let o;return t===140?o=this.finishNode(r,"Program"):o=this.finishNodeAt(r,"Program",a(this.state.startLoc,-1)),o}stmtToDirective(r){const t=this.castNodeTo(r,"Directive"),n=this.castNodeTo(r.expression,"DirectiveLiteral"),o=n.value,l=this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end)),d=n.value=l.slice(1,-1);return this.addExtra(n,"raw",l),this.addExtra(n,"rawValue",d),this.addExtra(n,"expressionValue",o),t.value=n,delete r.expression,t}parseInterpreterDirective(){if(!this.match(28))return null;const r=this.startNode();return r.value=this.state.value,this.next(),this.finishNode(r,"InterpreterDirective")}isLet(){return this.isContextual(100)?this.hasFollowingBindingAtom():!1}isUsing(){return this.isContextual(107)?this.nextTokenIsIdentifierOnSameLine():!1}isForUsing(){if(!this.isContextual(107))return!1;const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);if(this.isUnparsedContextual(r,"of")){const n=this.lookaheadCharCodeSince(r+2);if(n!==61&&n!==58&&n!==59)return!1}return!!(this.chStartsBindingIdentifier(t,r)||this.isUnparsedContextual(r,"void"))}nextTokenIsIdentifierOnSameLine(){const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);return this.chStartsBindingIdentifier(t,r)}isAwaitUsing(){if(!this.isContextual(96))return!1;let r=this.nextTokenInLineStart();if(this.isUnparsedContextual(r,"using")){r=this.nextTokenInLineStartSince(r+5);const t=this.codePointAtPos(r);if(this.chStartsBindingIdentifier(t,r))return!0}return!1}chStartsBindingIdentifier(r,t){if(at(r)){if(xr.lastIndex=t,xr.test(this.input)){const n=this.codePointAtPos(xr.lastIndex);if(!Rt(n)&&n!==92)return!1}return!0}else return r===92}chStartsBindingPattern(r){return r===91||r===123}hasFollowingBindingAtom(){const r=this.nextTokenStart(),t=this.codePointAtPos(r);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,r)}hasInLineFollowingBindingIdentifierOrBrace(){const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);return t===123||this.chStartsBindingIdentifier(t,r)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(r=!1){let t=0;return this.options.annexB&&!this.state.strict&&(t|=4,r&&(t|=8)),this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(r){let t=null;return this.match(26)&&(t=this.parseDecorators(!0)),this.parseStatementContent(r,t)}parseStatementContent(r,t){const n=this.state.type,o=this.startNode(),l=!!(r&2),d=!!(r&4),m=r&1;switch(n){case 60:return this.parseBreakContinueStatement(o,!0);case 63:return this.parseBreakContinueStatement(o,!1);case 64:return this.parseDebuggerStatement(o);case 90:return this.parseDoWhileStatement(o);case 91:return this.parseForStatement(o);case 68:if(this.lookaheadCharCode()===46)break;return d||this.raise(this.state.strict?S.StrictFunction:this.options.annexB?S.SloppyFunctionAnnexB:S.SloppyFunction,this.state.startLoc),this.parseFunctionStatement(o,!1,!l&&d);case 80:return l||this.unexpected(),this.parseClass(this.maybeTakeDecorators(t,o),!0);case 69:return this.parseIfStatement(o);case 70:return this.parseReturnStatement(o);case 71:return this.parseSwitchStatement(o);case 72:return this.parseThrowStatement(o);case 73:return this.parseTryStatement(o);case 96:if(this.isAwaitUsing())return this.allowsUsing()?l?this.recordAwaitIfAllowed()||this.raise(S.AwaitUsingNotInAsyncContext,o):this.raise(S.UnexpectedLexicalDeclaration,o):this.raise(S.UnexpectedUsingDeclaration,o),this.next(),this.parseVarStatement(o,"await using");break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;return this.allowsUsing()?l||this.raise(S.UnexpectedLexicalDeclaration,this.state.startLoc):this.raise(S.UnexpectedUsingDeclaration,this.state.startLoc),this.parseVarStatement(o,"using");case 100:{if(this.state.containsEsc)break;const b=this.nextTokenStart(),x=this.codePointAtPos(b);if(x!==91&&(!l&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(x,b)&&x!==123))break}case 75:l||this.raise(S.UnexpectedLexicalDeclaration,this.state.startLoc);case 74:{const b=this.state.value;return this.parseVarStatement(o,b)}case 92:return this.parseWhileStatement(o);case 76:return this.parseWithStatement(o);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(o);case 83:{const b=this.lookaheadCharCode();if(b===40||b===46)break}case 82:{!(this.optionFlags&8)&&!m&&this.raise(S.UnexpectedImportExport,this.state.startLoc),this.next();let b;return n===83?b=this.parseImport(o):b=this.parseExport(o,t),this.assertModuleNodeAllowed(b),b}default:if(this.isAsyncFunction())return l||this.raise(S.AsyncFunctionInSingleStatementContext,this.state.startLoc),this.next(),this.parseFunctionStatement(o,!0,!l&&d)}const g=this.state.value,E=this.parseExpression();return ie(n)&&E.type==="Identifier"&&this.eat(14)?this.parseLabeledStatement(o,g,E,r):this.parseExpressionStatement(o,E,t)}assertModuleNodeAllowed(r){!(this.optionFlags&8)&&!this.inModule&&this.raise(S.ImportOutsideModule,r)}decoratorsEnabledBeforeExport(){return this.hasPlugin("decorators-legacy")?!0:this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==!1}maybeTakeDecorators(r,t,n){if(r){var o;(o=t.decorators)!=null&&o.length?(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!="boolean"&&this.raise(S.DecoratorsBeforeAfterExport,t.decorators[0]),t.decorators.unshift(...r)):t.decorators=r,this.resetStartLocationFromNode(t,r[0]),n&&this.resetStartLocationFromNode(n,t)}return t}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(r){const t=[];do t.push(this.parseDecorator());while(this.match(26));if(this.match(82))r||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(S.DecoratorExportClass,this.state.startLoc);else if(!this.canHaveLeadingDecorator())throw this.raise(S.UnexpectedLeadingDecorator,this.state.startLoc);return t}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);const r=this.startNode();if(this.next(),this.hasPlugin("decorators")){const t=this.state.startLoc;let n;if(this.match(10)){const o=this.state.startLoc;this.next(),n=this.parseExpression(),this.expect(11),n=this.wrapParenthesis(o,n);const l=this.state.startLoc;r.expression=this.parseMaybeDecoratorArguments(n,o),this.getPluginOption("decorators","allowCallParenthesized")===!1&&r.expression!==n&&this.raise(S.DecoratorArgumentsOutsideParentheses,l)}else{for(n=this.parseIdentifier(!1);this.eat(16);){const o=this.startNodeAt(t);o.object=n,this.match(139)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),o.property=this.parsePrivateName()):o.property=this.parseIdentifier(!0),o.computed=!1,n=this.finishNode(o,"MemberExpression")}r.expression=this.parseMaybeDecoratorArguments(n,t)}}else r.expression=this.parseExprSubscripts();return this.finishNode(r,"Decorator")}parseMaybeDecoratorArguments(r,t){if(this.eat(10)){const n=this.startNodeAt(t);return n.callee=r,n.arguments=this.parseCallExpressionArguments(),this.toReferencedList(n.arguments),this.finishNode(n,"CallExpression")}return r}parseBreakContinueStatement(r,t){return this.next(),this.isLineTerminator()?r.label=null:(r.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(r,t),this.finishNode(r,t?"BreakStatement":"ContinueStatement")}verifyBreakContinue(r,t){let n;for(n=0;n<this.state.labels.length;++n){const o=this.state.labels[n];if((r.label==null||o.name===r.label.name)&&(o.kind!=null&&(t||o.kind===1)||r.label&&t))break}if(n===this.state.labels.length){const o=t?"BreakStatement":"ContinueStatement";this.raise(S.IllegalBreakContinue,r,{type:o})}}parseDebuggerStatement(r){return this.next(),this.semicolon(),this.finishNode(r,"DebuggerStatement")}parseHeaderExpression(){this.expect(10);const r=this.parseExpression();return this.expect(11),r}parseDoWhileStatement(r){return this.next(),this.state.labels.push(Ir),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.expect(92),r.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(r,"DoWhileStatement")}parseForStatement(r){this.next(),this.state.labels.push(Ir);let t=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()&&(t=this.state.startLoc,this.next()),this.scope.enter(0),this.expect(10),this.match(13))return t!==null&&this.unexpected(t),this.parseFor(r,null);const n=this.isContextual(100);{const g=this.isAwaitUsing(),E=g||this.isForUsing(),b=n&&this.hasFollowingBindingAtom()||E;if(this.match(74)||this.match(75)||b){const x=this.startNode();let C;g?(C="await using",this.recordAwaitIfAllowed()||this.raise(S.AwaitUsingNotInAsyncContext,this.state.startLoc),this.next()):C=this.state.value,this.next(),this.parseVar(x,!0,C);const v=this.finishNode(x,"VariableDeclaration"),M=this.match(58);return M&&E&&this.raise(S.ForInUsing,v),(M||this.isContextual(102))&&v.declarations.length===1?this.parseForIn(r,v,t):(t!==null&&this.unexpected(t),this.parseFor(r,v))}}const o=this.isContextual(95),l=new Xs,d=this.parseExpression(!0,l),m=this.isContextual(102);if(m&&(n&&this.raise(S.ForOfLet,d),t===null&&o&&d.type==="Identifier"&&this.raise(S.ForOfAsync,d)),m||this.match(58)){this.checkDestructuringPrivate(l),this.toAssignable(d,!0);const g=m?"ForOfStatement":"ForInStatement";return this.checkLVal(d,{type:g}),this.parseForIn(r,d,t)}else this.checkExpressionErrors(l,!0);return t!==null&&this.unexpected(t),this.parseFor(r,d)}parseFunctionStatement(r,t,n){return this.next(),this.parseFunction(r,1|(n?2:0)|(t?8:0))}parseIfStatement(r){return this.next(),r.test=this.parseHeaderExpression(),r.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),r.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(r,"IfStatement")}parseReturnStatement(r){return this.prodParam.hasReturn||this.raise(S.IllegalReturn,this.state.startLoc),this.next(),this.isLineTerminator()?r.argument=null:(r.argument=this.parseExpression(),this.semicolon()),this.finishNode(r,"ReturnStatement")}parseSwitchStatement(r){this.next(),r.discriminant=this.parseHeaderExpression();const t=r.cases=[];this.expect(5),this.state.labels.push(cp),this.scope.enter(256);let n;for(let o;!this.match(8);)if(this.match(61)||this.match(65)){const l=this.match(61);n&&this.finishNode(n,"SwitchCase"),t.push(n=this.startNode()),n.consequent=[],this.next(),l?n.test=this.parseExpression():(o&&this.raise(S.MultipleDefaultsInSwitch,this.state.lastTokStartLoc),o=!0,n.test=null),this.expect(14)}else n?n.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),n&&this.finishNode(n,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(r,"SwitchStatement")}parseThrowStatement(r){return this.next(),this.hasPrecedingLineBreak()&&this.raise(S.NewlineAfterThrow,this.state.lastTokEndLoc),r.argument=this.parseExpression(),this.semicolon(),this.finishNode(r,"ThrowStatement")}parseCatchClauseParam(){const r=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&r.type==="Identifier"?8:0),this.checkLVal(r,{type:"CatchClause"},9),r}parseTryStatement(r){if(this.next(),r.block=this.parseBlock(),r.handler=null,this.match(62)){const t=this.startNode();this.next(),this.match(10)?(this.expect(10),t.param=this.parseCatchClauseParam(),this.expect(11)):(t.param=null,this.scope.enter(0)),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),r.handler=this.finishNode(t,"CatchClause")}return r.finalizer=this.eat(67)?this.parseBlock():null,!r.handler&&!r.finalizer&&this.raise(S.NoCatchOrFinally,r),this.finishNode(r,"TryStatement")}parseVarStatement(r,t,n=!1){return this.next(),this.parseVar(r,!1,t,n),this.semicolon(),this.finishNode(r,"VariableDeclaration")}parseWhileStatement(r){return this.next(),r.test=this.parseHeaderExpression(),this.state.labels.push(Ir),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(r,"WhileStatement")}parseWithStatement(r){return this.state.strict&&this.raise(S.StrictWith,this.state.startLoc),this.next(),r.object=this.parseHeaderExpression(),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(r,"WithStatement")}parseEmptyStatement(r){return this.next(),this.finishNode(r,"EmptyStatement")}parseLabeledStatement(r,t,n,o){for(const d of this.state.labels)d.name===t&&this.raise(S.LabelRedeclaration,n,{labelName:t});const l=th(this.state.type)?1:this.match(71)?2:null;for(let d=this.state.labels.length-1;d>=0;d--){const m=this.state.labels[d];if(m.statementStart===r.start)m.statementStart=this.sourceToOffsetPos(this.state.start),m.kind=l;else break}return this.state.labels.push({name:t,kind:l,statementStart:this.sourceToOffsetPos(this.state.start)}),r.body=o&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),r.label=n,this.finishNode(r,"LabeledStatement")}parseExpressionStatement(r,t,n){return r.expression=t,this.semicolon(),this.finishNode(r,"ExpressionStatement")}parseBlock(r=!1,t=!0,n){const o=this.startNode();return r&&this.state.strictErrors.clear(),this.expect(5),t&&this.scope.enter(0),this.parseBlockBody(o,r,!1,8,n),t&&this.scope.exit(),this.finishNode(o,"BlockStatement")}isValidDirective(r){return r.type==="ExpressionStatement"&&r.expression.type==="StringLiteral"&&!r.expression.extra.parenthesized}parseBlockBody(r,t,n,o,l){const d=r.body=[],m=r.directives=[];this.parseBlockOrModuleBlockBody(d,t?m:void 0,n,o,l)}parseBlockOrModuleBlockBody(r,t,n,o,l){const d=this.state.strict;let m=!1,g=!1;for(;!this.match(o);){const E=n?this.parseModuleItem():this.parseStatementListItem();if(t&&!g){if(this.isValidDirective(E)){const b=this.stmtToDirective(E);t.push(b),!m&&b.value.value==="use strict"&&(m=!0,this.setStrict(!0));continue}g=!0,this.state.strictErrors.clear()}r.push(E)}l?.call(this,m),d||this.setStrict(!1),this.next()}parseFor(r,t){return r.init=t,this.semicolon(!1),r.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),r.update=this.match(11)?null:this.parseExpression(),this.expect(11),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(r,"ForStatement")}parseForIn(r,t,n){const o=this.match(58);return this.next(),o?n!==null&&this.unexpected(n):r.await=n!==null,t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!o||!this.options.annexB||this.state.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(S.ForInOfLoopInitializer,t,{type:o?"ForInStatement":"ForOfStatement"}),t.type==="AssignmentPattern"&&this.raise(S.InvalidLhs,t,{ancestor:{type:"ForStatement"}}),r.left=t,r.right=o?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(r,o?"ForInStatement":"ForOfStatement")}parseVar(r,t,n,o=!1){const l=r.declarations=[];for(r.kind=n;;){const d=this.startNode();if(this.parseVarId(d,n),d.init=this.eat(29)?t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,d.init===null&&!o&&(d.id.type!=="Identifier"&&!(t&&(this.match(58)||this.isContextual(102)))?this.raise(S.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"}):(n==="const"||n==="using"||n==="await using")&&!(this.match(58)||this.isContextual(102))&&this.raise(S.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:n})),l.push(this.finishNode(d,"VariableDeclarator")),!this.eat(12))break}return r}parseVarId(r,t){const n=this.parseBindingAtom();t==="using"||t==="await using"?(n.type==="ArrayPattern"||n.type==="ObjectPattern")&&this.raise(S.UsingDeclarationHasBindingPattern,n.loc.start):n.type==="VoidPattern"&&this.raise(S.UnexpectedVoidPattern,n.loc.start),this.checkLVal(n,{type:"VariableDeclarator"},t==="var"?5:8201),r.id=n}parseAsyncFunctionExpression(r){return this.parseFunction(r,8)}parseFunction(r,t=0){const n=t&2,o=!!(t&1),l=o&&!(t&4),d=!!(t&8);this.initFunction(r,d),this.match(55)&&(n&&this.raise(S.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),r.generator=!0),o&&(r.id=this.parseFunctionId(l));const m=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(514),this.prodParam.enter(Ks(d,r.generator)),o||(r.id=this.parseFunctionId()),this.parseFunctionParams(r,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(r,o?"FunctionDeclaration":"FunctionExpression")}),this.prodParam.exit(),this.scope.exit(),o&&!n&&this.registerFunctionStatementId(r),this.state.maybeInArrowParameters=m,r}parseFunctionId(r){return r||ie(this.state.type)?this.parseIdentifier():null}parseFunctionParams(r,t){this.expect(10),this.expressionScope.enter(Gh()),r.params=this.parseBindingList(11,41,2|(t?4:0)),this.expressionScope.exit()}registerFunctionStatementId(r){r.id&&this.scope.declareName(r.id.name,!this.options.annexB||this.state.strict||r.generator||r.async?this.scope.treatFunctionsAsVar?5:8201:17,r.id.loc.start)}parseClass(r,t,n){this.next();const o=this.state.strict;return this.state.strict=!0,this.parseClassId(r,t,n),this.parseClassSuper(r),r.body=this.parseClassBody(!!r.superClass,o),this.finishNode(r,t?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}nameIsConstructor(r){return r.type==="Identifier"&&r.name==="constructor"||r.type==="StringLiteral"&&r.value==="constructor"}isNonstaticConstructor(r){return!r.computed&&!r.static&&this.nameIsConstructor(r.key)}parseClassBody(r,t){this.classScope.enter();const n={hadConstructor:!1,hadSuperClass:r};let o=[];const l=this.startNode();if(l.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(o.length>0)throw this.raise(S.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(26)){o.push(this.parseDecorator());continue}const d=this.startNode();o.length&&(d.decorators=o,this.resetStartLocationFromNode(d,o[0]),o=[]),this.parseClassMember(l,d,n),d.kind==="constructor"&&d.decorators&&d.decorators.length>0&&this.raise(S.DecoratorConstructor,d)}}),this.state.strict=t,this.next(),o.length)throw this.raise(S.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(l,"ClassBody")}parseClassMemberFromModifier(r,t){const n=this.parseIdentifier(!0);if(this.isClassMethod()){const o=t;return o.kind="method",o.computed=!1,o.key=n,o.static=!1,this.pushClassMethod(r,o,!1,!1,!1,!1),!0}else if(this.isClassProperty()){const o=t;return o.computed=!1,o.key=n,o.static=!1,r.body.push(this.parseClassProperty(o)),!0}return this.resetPreviousNodeTrailingComments(n),!1}parseClassMember(r,t,n){const o=this.isContextual(106);if(o){if(this.parseClassMemberFromModifier(r,t))return;if(this.eat(5)){this.parseClassStaticBlock(r,t);return}}this.parseClassMemberWithIsStatic(r,t,n,o)}parseClassMemberWithIsStatic(r,t,n,o){const l=t,d=t,m=t,g=t,E=t,b=l,x=l;if(t.static=o,this.parsePropertyNamePrefixOperator(t),this.eat(55)){b.kind="method";const H=this.match(139);if(this.parseClassElementName(b),this.parsePostMemberNameModifiers(b),H){this.pushClassPrivateMethod(r,d,!0,!1);return}this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsGenerator,l.key),this.pushClassMethod(r,l,!0,!1,!1,!1);return}const C=!this.state.containsEsc&&ie(this.state.type),v=this.parseClassElementName(t),M=C?v.name:null,Q=this.isPrivateName(v),ue=this.state.startLoc;if(this.parsePostMemberNameModifiers(x),this.isClassMethod()){if(b.kind="method",Q){this.pushClassPrivateMethod(r,d,!1,!1);return}const H=this.isNonstaticConstructor(l);let ce=!1;H&&(l.kind="constructor",n.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(S.DuplicateConstructor,v),H&&this.hasPlugin("typescript")&&t.override&&this.raise(S.OverrideOnConstructor,v),n.hadConstructor=!0,ce=n.hadSuperClass),this.pushClassMethod(r,l,!1,!1,H,ce)}else if(this.isClassProperty())Q?this.pushClassPrivateProperty(r,g):this.pushClassProperty(r,m);else if(M==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(v);const H=this.eat(55);x.optional&&this.unexpected(ue),b.kind="method";const ce=this.match(139);this.parseClassElementName(b),this.parsePostMemberNameModifiers(x),ce?this.pushClassPrivateMethod(r,d,H,!0):(this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsAsync,l.key),this.pushClassMethod(r,l,H,!0,!1,!1))}else if((M==="get"||M==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(v),b.kind=M;const H=this.match(139);this.parseClassElementName(l),H?this.pushClassPrivateMethod(r,d,!1,!1):(this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsAccessor,l.key),this.pushClassMethod(r,l,!1,!1,!1,!1)),this.checkGetterSetterParams(l)}else if(M==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(v);const H=this.match(139);this.parseClassElementName(m),this.pushClassAccessorProperty(r,E,H)}else this.isLineTerminator()?Q?this.pushClassPrivateProperty(r,g):this.pushClassProperty(r,m):this.unexpected()}parseClassElementName(r){const{type:t,value:n}=this.state;if((t===132||t===134)&&r.static&&n==="prototype"&&this.raise(S.StaticPrototype,this.state.startLoc),t===139){n==="constructor"&&this.raise(S.ConstructorClassPrivateField,this.state.startLoc);const o=this.parsePrivateName();return r.key=o,o}return this.parsePropertyName(r),r.key}parseClassStaticBlock(r,t){var n;this.scope.enter(720);const o=this.state.labels;this.state.labels=[],this.prodParam.enter(0);const l=t.body=[];this.parseBlockOrModuleBlockBody(l,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=o,r.body.push(this.finishNode(t,"StaticBlock")),(n=t.decorators)!=null&&n.length&&this.raise(S.DecoratorStaticBlock,t)}pushClassProperty(r,t){!t.computed&&this.nameIsConstructor(t.key)&&this.raise(S.ConstructorClassField,t.key),r.body.push(this.parseClassProperty(t))}pushClassPrivateProperty(r,t){const n=this.parseClassPrivateProperty(t);r.body.push(n),this.classScope.declarePrivateName(this.getPrivateNameSV(n.key),0,n.key.loc.start)}pushClassAccessorProperty(r,t,n){!n&&!t.computed&&this.nameIsConstructor(t.key)&&this.raise(S.ConstructorClassField,t.key);const o=this.parseClassAccessorProperty(t);r.body.push(o),n&&this.classScope.declarePrivateName(this.getPrivateNameSV(o.key),0,o.key.loc.start)}pushClassMethod(r,t,n,o,l,d){r.body.push(this.parseMethod(t,n,o,l,d,"ClassMethod",!0))}pushClassPrivateMethod(r,t,n,o){const l=this.parseMethod(t,n,o,!1,!1,"ClassPrivateMethod",!0);r.body.push(l);const d=l.kind==="get"?l.static?6:2:l.kind==="set"?l.static?5:1:0;this.declareClassPrivateMethodInScope(l,d)}declareClassPrivateMethodInScope(r,t){this.classScope.declarePrivateName(this.getPrivateNameSV(r.key),t,r.key.loc.start)}parsePostMemberNameModifiers(r){}parseClassPrivateProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassPrivateProperty")}parseClassProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassProperty")}parseClassAccessorProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassAccessorProperty")}parseInitializer(r){this.scope.enter(592),this.expressionScope.enter(na()),this.prodParam.enter(0),r.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(r,t,n,o=8331){if(ie(this.state.type))r.id=this.parseIdentifier(),t&&this.declareNameFromIdentifier(r.id,o);else if(n||!t)r.id=null;else throw this.raise(S.MissingClassName,this.state.startLoc)}parseClassSuper(r){r.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(r,t){const n=this.parseMaybeImportPhase(r,!0),o=this.maybeParseExportDefaultSpecifier(r,n),l=!o||this.eat(12),d=l&&this.eatExportStar(r),m=d&&this.maybeParseExportNamespaceSpecifier(r),g=l&&(!m||this.eat(12)),E=o||d;if(d&&!m){if(o&&this.unexpected(),t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.parseExportFrom(r,!0),this.sawUnambiguousESM=!0,this.finishNode(r,"ExportAllDeclaration")}const b=this.maybeParseExportNamedSpecifiers(r);o&&l&&!d&&!b&&this.unexpected(null,5),m&&g&&this.unexpected(null,98);let x;if(E||b){if(x=!1,t)throw this.raise(S.UnsupportedDecoratorExport,r);this.parseExportFrom(r,E)}else x=this.maybeParseExportDeclaration(r);if(E||b||x){var C;const v=r;if(this.checkExport(v,!0,!1,!!v.source),((C=v.declaration)==null?void 0:C.type)==="ClassDeclaration")this.maybeTakeDecorators(t,v.declaration,v);else if(t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.sawUnambiguousESM=!0,this.finishNode(v,"ExportNamedDeclaration")}if(this.eat(65)){const v=r,M=this.parseExportDefaultExpression();if(v.declaration=M,M.type==="ClassDeclaration")this.maybeTakeDecorators(t,M,v);else if(t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.checkExport(v,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(v,"ExportDefaultDeclaration")}throw this.unexpected(null,5)}eatExportStar(r){return this.eat(55)}maybeParseExportDefaultSpecifier(r,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",t?.loc.start);const n=t||this.parseIdentifier(!0),o=this.startNodeAtNode(n);return o.exported=n,r.specifiers=[this.finishNode(o,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(r){if(this.isContextual(93)){var t,n;(n=(t=r).specifiers)!=null||(t.specifiers=[]);const o=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),o.exported=this.parseModuleExportName(),r.specifiers.push(this.finishNode(o,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(r){if(this.match(5)){const t=r;t.specifiers||(t.specifiers=[]);const n=t.exportKind==="type";return t.specifiers.push(...this.parseExportSpecifiers(n)),t.source=null,this.hasPlugin("importAssertions")?t.assertions=[]:t.attributes=[],t.declaration=null,!0}return!1}maybeParseExportDeclaration(r){return this.shouldParseExportDeclaration()?(r.specifiers=[],r.source=null,this.hasPlugin("importAssertions")?r.assertions=[]:r.attributes=[],r.declaration=this.parseExportDeclaration(r),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;const r=this.nextTokenInLineStart();return this.isUnparsedContextual(r,"function")}parseExportDefaultExpression(){const r=this.startNode();if(this.match(68))return this.next(),this.parseFunction(r,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(r,13);if(this.match(80))return this.parseClass(r,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(S.DecoratorBeforeExport,this.state.startLoc),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(S.UnsupportedDefaultExport,this.state.startLoc);const t=this.parseMaybeAssignAllowIn();return this.semicolon(),t}parseExportDeclaration(r){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){const{type:r}=this.state;if(ie(r)){if(r===95&&!this.state.containsEsc||r===100)return!1;if((r===130||r===129)&&!this.state.containsEsc){const o=this.nextTokenStart(),l=this.input.charCodeAt(o);if(l===123||this.chStartsBindingIdentifier(l,o)&&!this.input.startsWith("from",o))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;const t=this.nextTokenStart(),n=this.isUnparsedContextual(t,"from");if(this.input.charCodeAt(t)===44||ie(this.state.type)&&n)return!0;if(this.match(65)&&n){const o=this.input.charCodeAt(this.nextTokenStartSince(t+4));return o===34||o===39}return!1}parseExportFrom(r,t){this.eatContextual(98)?(r.source=this.parseImportSource(),this.checkExport(r),this.maybeParseImportAttributes(r),this.checkJSONModuleImport(r)):t&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){const{type:r}=this.state;return r===26&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?(this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(S.DecoratorBeforeExport,this.state.startLoc),!0):this.isUsing()?(this.raise(S.UsingDeclarationExport,this.state.startLoc),!0):this.isAwaitUsing()?(this.raise(S.UsingDeclarationExport,this.state.startLoc),!0):r===74||r===75||r===68||r===80||this.isLet()||this.isAsyncFunction()}checkExport(r,t,n,o){if(t){var l;if(n){if(this.checkDuplicateExports(r,"default"),this.hasPlugin("exportDefaultFrom")){var d;const m=r.declaration;m.type==="Identifier"&&m.name==="from"&&m.end-m.start===4&&!((d=m.extra)!=null&&d.parenthesized)&&this.raise(S.ExportDefaultFromAsIdentifier,m)}}else if((l=r.specifiers)!=null&&l.length)for(const m of r.specifiers){const{exported:g}=m,E=g.type==="Identifier"?g.name:g.value;if(this.checkDuplicateExports(m,E),!o&&m.local){const{local:b}=m;b.type!=="Identifier"?this.raise(S.ExportBindingIsString,m,{localName:b.value,exportName:E}):(this.checkReservedWord(b.name,b.loc.start,!0,!1),this.scope.checkLocalExport(b))}}else if(r.declaration){const m=r.declaration;if(m.type==="FunctionDeclaration"||m.type==="ClassDeclaration"){const{id:g}=m;if(!g)throw new Error("Assertion failure");this.checkDuplicateExports(r,g.name)}else if(m.type==="VariableDeclaration")for(const g of m.declarations)this.checkDeclaration(g.id)}}}checkDeclaration(r){if(r.type==="Identifier")this.checkDuplicateExports(r,r.name);else if(r.type==="ObjectPattern")for(const t of r.properties)this.checkDeclaration(t);else if(r.type==="ArrayPattern")for(const t of r.elements)t&&this.checkDeclaration(t);else r.type==="ObjectProperty"?this.checkDeclaration(r.value):r.type==="RestElement"?this.checkDeclaration(r.argument):r.type==="AssignmentPattern"&&this.checkDeclaration(r.left)}checkDuplicateExports(r,t){this.exportedIdentifiers.has(t)&&(t==="default"?this.raise(S.DuplicateDefaultExport,r):this.raise(S.DuplicateExport,r,{exportName:t})),this.exportedIdentifiers.add(t)}parseExportSpecifiers(r){const t=[];let n=!0;for(this.expect(5);!this.eat(8);){if(n)n=!1;else if(this.expect(12),this.eat(8))break;const o=this.isContextual(130),l=this.match(134),d=this.startNode();d.local=this.parseModuleExportName(),t.push(this.parseExportSpecifier(d,l,r,o))}return t}parseExportSpecifier(r,t,n,o){return this.eatContextual(93)?r.exported=this.parseModuleExportName():t?r.exported=this.cloneStringLiteral(r.local):r.exported||(r.exported=this.cloneIdentifier(r.local)),this.finishNode(r,"ExportSpecifier")}parseModuleExportName(){if(this.match(134)){const r=this.parseStringLiteral(this.state.value),t=lp.exec(r.value);return t&&this.raise(S.ModuleExportNameHasLoneSurrogate,r,{surrogateCharCode:t[0].charCodeAt(0)}),r}return this.parseIdentifier(!0)}isJSONModuleImport(r){return r.assertions!=null?r.assertions.some(({key:t,value:n})=>n.value==="json"&&(t.type==="Identifier"?t.name==="type":t.value==="type")):!1}checkImportReflection(r){const{specifiers:t}=r,n=t.length===1?t[0].type:null;if(r.phase==="source")n!=="ImportDefaultSpecifier"&&this.raise(S.SourcePhaseImportRequiresDefault,t[0].loc.start);else if(r.phase==="defer")n!=="ImportNamespaceSpecifier"&&this.raise(S.DeferImportRequiresNamespace,t[0].loc.start);else if(r.module){var o;n!=="ImportDefaultSpecifier"&&this.raise(S.ImportReflectionNotBinding,t[0].loc.start),((o=r.assertions)==null?void 0:o.length)>0&&this.raise(S.ImportReflectionHasAssertion,t[0].loc.start)}}checkJSONModuleImport(r){if(this.isJSONModuleImport(r)&&r.type!=="ExportAllDeclaration"){const{specifiers:t}=r;if(t!=null){const n=t.find(o=>{let l;if(o.type==="ExportSpecifier"?l=o.local:o.type==="ImportSpecifier"&&(l=o.imported),l!==void 0)return l.type==="Identifier"?l.name!=="default":l.value!=="default"});n!==void 0&&this.raise(S.ImportJSONBindingNotDefault,n.loc.start)}}}isPotentialImportPhase(r){return r?!1:this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(r,t,n,o){t||(n==="module"?(this.expectPlugin("importReflection",o),r.module=!0):this.hasPlugin("importReflection")&&(r.module=!1),n==="source"?(this.expectPlugin("sourcePhaseImports",o),r.phase="source"):n==="defer"?(this.expectPlugin("deferredImportEvaluation",o),r.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(r.phase=null))}parseMaybeImportPhase(r,t){if(!this.isPotentialImportPhase(t))return this.applyImportPhase(r,t,null),null;const n=this.startNode(),o=this.parseIdentifierName(!0),{type:l}=this.state;return(Je(l)?l!==98||this.lookaheadCharCode()===102:l!==12)?(this.applyImportPhase(r,t,o,n.loc.start),null):(this.applyImportPhase(r,t,null),this.createIdentifier(n,o))}isPrecedingIdImportPhase(r){const{type:t}=this.state;return ie(t)?t!==98||this.lookaheadCharCode()===102:t!==12}parseImport(r){return this.match(134)?this.parseImportSourceAndAttributes(r):this.parseImportSpecifiersAndAfter(r,this.parseMaybeImportPhase(r,!1))}parseImportSpecifiersAndAfter(r,t){r.specifiers=[];const o=!this.maybeParseDefaultImportSpecifier(r,t)||this.eat(12),l=o&&this.maybeParseStarImportSpecifier(r);return o&&!l&&this.parseNamedImportSpecifiers(r),this.expectContextual(98),this.parseImportSourceAndAttributes(r)}parseImportSourceAndAttributes(r){var t;return(t=r.specifiers)!=null||(r.specifiers=[]),r.source=this.parseImportSource(),this.maybeParseImportAttributes(r),this.checkImportReflection(r),this.checkJSONModuleImport(r),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(r,"ImportDeclaration")}parseImportSource(){return this.match(134)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(r,t,n){t.local=this.parseIdentifier(),r.specifiers.push(this.finishImportSpecifier(t,n))}finishImportSpecifier(r,t,n=8201){return this.checkLVal(r.local,{type:t},n),this.finishNode(r,t)}parseImportAttributes(){this.expect(5);const r=[],t=new Set;do{if(this.match(8))break;const n=this.startNode(),o=this.state.value;if(t.has(o)&&this.raise(S.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:o}),t.add(o),this.match(134)?n.key=this.parseStringLiteral(o):n.key=this.parseIdentifier(!0),this.expect(14),!this.match(134))throw this.raise(S.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),r.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return this.expect(8),r}parseModuleAttributes(){const r=[],t=new Set;do{const n=this.startNode();if(n.key=this.parseIdentifier(!0),n.key.name!=="type"&&this.raise(S.ModuleAttributeDifferentFromType,n.key),t.has(n.key.name)&&this.raise(S.ModuleAttributesWithDuplicateKeys,n.key,{key:n.key.name}),t.add(n.key.name),this.expect(14),!this.match(134))throw this.raise(S.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),r.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return r}maybeParseImportAttributes(r){let t;var n=!1;if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),this.hasPlugin("moduleAttributes")?(t=this.parseModuleAttributes(),this.addExtra(r,"deprecatedWithLegacySyntax",!0)):t=this.parseImportAttributes(),n=!0}else this.isContextual(94)&&!this.hasPrecedingLineBreak()?(!this.hasPlugin("deprecatedImportAssert")&&!this.hasPlugin("importAssertions")&&this.raise(S.ImportAttributesUseAssert,this.state.startLoc),this.hasPlugin("importAssertions")||this.addExtra(r,"deprecatedAssertSyntax",!0),this.next(),t=this.parseImportAttributes()):t=[];!n&&this.hasPlugin("importAssertions")?r.assertions=t:r.attributes=t}maybeParseDefaultImportSpecifier(r,t){if(t){const n=this.startNodeAtNode(t);return n.local=t,r.specifiers.push(this.finishImportSpecifier(n,"ImportDefaultSpecifier")),!0}else if(Je(this.state.type))return this.parseImportSpecifierLocal(r,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(r){if(this.match(55)){const t=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(r,t,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(r){let t=!0;for(this.expect(5);!this.eat(8);){if(t)t=!1;else{if(this.eat(14))throw this.raise(S.DestructureNamedImport,this.state.startLoc);if(this.expect(12),this.eat(8))break}const n=this.startNode(),o=this.match(134),l=this.isContextual(130);n.imported=this.parseModuleExportName();const d=this.parseImportSpecifier(n,o,r.importKind==="type"||r.importKind==="typeof",l,void 0);r.specifiers.push(d)}}parseImportSpecifier(r,t,n,o,l){if(this.eatContextual(93))r.local=this.parseIdentifier();else{const{imported:d}=r;if(t)throw this.raise(S.ImportBindingIsString,r,{importName:d.value});this.checkReservedWord(d.name,r.loc.start,!0,!0),r.local||(r.local=this.cloneIdentifier(d))}return this.finishImportSpecifier(r,"ImportSpecifier",l)}isThisParam(r){return r.type==="Identifier"&&r.name==="this"}}class fa extends hp{constructor(r,t,n){const o=$e(r);super(o,t),this.options=o,this.initializeScopes(),this.plugins=n,this.filename=o.sourceFilename,this.startIndex=o.startIndex;let l=0;o.allowAwaitOutsideFunction&&(l|=1),o.allowReturnOutsideFunction&&(l|=2),o.allowImportExportEverywhere&&(l|=8),o.allowSuperOutsideMethod&&(l|=16),o.allowUndeclaredExports&&(l|=64),o.allowNewTargetOutsideFunction&&(l|=4),o.allowYieldOutsideFunction&&(l|=32),o.ranges&&(l|=128),o.tokens&&(l|=256),o.createImportExpressions&&(l|=512),o.createParenthesizedExpressions&&(l|=1024),o.errorRecovery&&(l|=2048),o.attachComment&&(l|=4096),o.annexB&&(l|=8192),this.optionFlags=l}getScopeHandler(){return fr}parse(){this.enterInitialScopes();const r=this.startNode(),t=this.startNode();this.nextToken(),r.errors=null;const n=this.parseTopLevel(r,t);return n.errors=this.state.errors,n.comments.length=this.state.commentsLen,n}}function pp(p,r){var t;if(((t=r)==null?void 0:t.sourceType)==="unambiguous"){r=Object.assign({},r);try{r.sourceType="module";const n=Ps(r,p),o=n.parse();if(n.sawUnambiguousESM)return o;if(n.ambiguousScriptDifferentAst)try{return r.sourceType="script",Ps(r,p).parse()}catch{}else o.program.sourceType="script";return o}catch(n){try{return r.sourceType="script",Ps(r,p).parse()}catch{}throw n}}else return Ps(r,p).parse()}function dp(p,r){const t=Ps(r,p);return t.options.strictMode&&(t.state.strict=!0),t.getExpression()}function fp(p){const r={};for(const t of Object.keys(p))r[t]=ut(p[t]);return r}const mp=fp(Xu);function Ps(p,r){let t=fa;const n=new Map;if(p!=null&&p.plugins){for(const o of p.plugins){let l,d;typeof o=="string"?l=o:[l,d]=o,n.has(l)||n.set(l,d||{})}np(n),t=yp(n)}return new t(p,r,n)}const ma=new Map;function yp(p){const r=[];for(const o of ap)p.has(o)&&r.push(o);const t=r.join("|");let n=ma.get(t);if(!n){n=fa;for(const o of r)n=da[o](n);ma.set(t,n)}return n}return cs.parse=pp,cs.parseExpression=dp,cs.tokTypes=mp,cs}var JT=XT();/**
|
|
47
47
|
* @vue/shared v3.5.28
|
|
48
48
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
49
49
|
* @license MIT
|
|
50
|
-
**/function
|
|
50
|
+
**/function Di(e){const s=Object.create(null);for(const i of e.split(","))s[i]=1;return i=>i in s}const QT=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const cn=()=>{},ki=()=>!1,Ri=Object.assign,ks=Array.isArray,Rs=e=>typeof e=="string",eS=e=>typeof e=="symbol",El=e=>{const s=Object.create(null);return(i=>s[i]||(s[i]=e(i)))},tS=/-\w/g,sS=El(e=>e.replace(tS,s=>s.slice(1).toUpperCase())),iS=El(e=>e.charAt(0).toUpperCase()+e.slice(1)),rS={1:"TEXT",2:"CLASS",4:"STYLE",8:"PROPS",16:"FULL_PROPS",32:"NEED_HYDRATION",64:"STABLE_FRAGMENT",128:"KEYED_FRAGMENT",256:"UNKEYED_FRAGMENT",512:"NEED_PATCH",1024:"DYNAMIC_SLOTS",2048:"DEV_ROOT_FRAGMENT",[-1]:"CACHED",[-2]:"BAIL"},nS=/;(?![^(]*\))/g,aS=/:([^]+)/,oS=/\/\*[^]*?\*\//g;function cS(e){const s={};return e.replace(oS,"").split(nS).forEach(i=>{if(i){const a=i.split(aS);a.length>1&&(s[a[0].trim()]=a[1].trim())}}),s}const lS="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",uS="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",hS="annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics",pS="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",dS=Di(lS),fS=Di(uS),mS=Di(hS),yS=Di(pS);/**
|
|
51
51
|
* @vue/compiler-core v3.5.28
|
|
52
52
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
53
53
|
* @license MIT
|
|
54
|
-
**/const ml=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),yl=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),gl=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),El=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),Tl=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),Di=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),Sl=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),bl=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),xl=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),Il=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),Pl=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),KT=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),qT=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),YT=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),JT=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),XT=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),QT=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),eS=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),tS=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),sS=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),iS=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),wl=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),rS=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),Al=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),Cl=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),vl=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Nl=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),nS=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),aS=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),oS=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),cS=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),lS=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),uS=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),hS=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),pS=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),dS=Symbol(process.env.NODE_ENV!=="production"?"unref":""),fS=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),mS=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),yS=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),_l={[ml]:"Fragment",[yl]:"Teleport",[gl]:"Suspense",[El]:"KeepAlive",[Tl]:"BaseTransition",[Di]:"openBlock",[Sl]:"createBlock",[bl]:"createElementBlock",[xl]:"createVNode",[Il]:"createElementVNode",[Pl]:"createCommentVNode",[KT]:"createTextVNode",[qT]:"createStaticVNode",[YT]:"resolveComponent",[JT]:"resolveDynamicComponent",[XT]:"resolveDirective",[QT]:"resolveFilter",[eS]:"withDirectives",[tS]:"renderList",[sS]:"renderSlot",[iS]:"createSlots",[wl]:"toDisplayString",[rS]:"mergeProps",[Al]:"normalizeClass",[Cl]:"normalizeStyle",[vl]:"normalizeProps",[Nl]:"guardReactiveProps",[nS]:"toHandlers",[aS]:"camelize",[oS]:"capitalize",[cS]:"toHandlerKey",[lS]:"setBlockTracking",[uS]:"pushScopeId",[hS]:"popScopeId",[pS]:"withCtx",[dS]:"unref",[fS]:"isRef",[mS]:"withMemo",[yS]:"isMemoSame"};function gS(e){Object.getOwnPropertySymbols(e).forEach(s=>{_l[s]=e[s]})}const Ds={ELEMENT:1,SIMPLE_EXPRESSION:4,ATTRIBUTE:6,DIRECTIVE:7},Rs={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function ES(e,s=""){return{type:0,source:s,children:e,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:Rs}}function TS(e,s,i,a,c,u,h,f=!1,y=!1,T=!1,x=Rs){return e&&(f?(e.helper(Di),e.helper(cn(e.inSSR,T))):e.helper(on(e.inSSR,T))),{type:13,tag:s,props:i,children:a,patchFlag:c,dynamicProps:u,directives:h,isBlock:f,disableTracking:y,isComponent:T,loc:x}}function an(e,s=Rs){return{type:17,loc:s,elements:e}}function Bt(e,s=!1,i=Rs,a=0){return{type:4,loc:i,content:e,isStatic:s,constType:s?3:a}}function SS(e,s,i=!1,a=!1){return{type:20,index:e,value:s,needPauseTracking:i,inVOnce:a,needArraySpread:!1,loc:Rs}}function on(e,s){return e||s?xl:Il}function cn(e,s){return e||s?Sl:bl}function bS(e,{helper:s,removeHelper:i,inSSR:a}){e.isBlock||(e.isBlock=!0,i(on(a,e.isComponent)),s(Di),s(cn(a,e.isComponent)))}const Ol=new Uint8Array([123,123]),Ll=new Uint8Array([125,125]);function kl(e){return e>=97&&e<=122||e>=65&&e<=90}function Ze(e){return e===32||e===10||e===9||e===12||e===13}function Ot(e){return e===47||e===62||Ze(e)}function Ri(e){const s=new Uint8Array(e.length);for(let i=0;i<e.length;i++)s[i]=e.charCodeAt(i);return s}const ve={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class xS{constructor(s,i){this.stack=s,this.cbs=i,this.state=1,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=1,this.inRCDATA=!1,this.inXML=!1,this.inVPre=!1,this.newlines=[],this.mode=0,this.delimiterOpen=Ol,this.delimiterClose=Ll,this.delimiterIndex=-1,this.currentSequence=void 0,this.sequenceIndex=0}get inSFCRoot(){return this.mode===2&&this.stack.length===0}reset(){this.state=1,this.mode=0,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=1,this.inRCDATA=!1,this.currentSequence=void 0,this.newlines.length=0,this.delimiterOpen=Ol,this.delimiterClose=Ll}getPos(s){let i=1,a=s+1;const c=this.newlines.length;let u=-1;if(c>100){let h=-1,f=c;for(;h+1<f;){const y=h+f>>>1;this.newlines[y]<s?h=y:f=y}u=h}else for(let h=c-1;h>=0;h--)if(s>this.newlines[h]){u=h;break}return u>=0&&(i=u+2,a=s-this.newlines[u]),{column:a,line:i,offset:s}}peek(){return this.buffer.charCodeAt(this.index+1)}stateText(s){s===60?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=5,this.sectionStart=this.index):!this.inVPre&&s===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(s))}stateInterpolationOpen(s){if(s===this.delimiterOpen[this.delimiterIndex])if(this.delimiterIndex===this.delimiterOpen.length-1){const i=this.index+1-this.delimiterOpen.length;i>this.sectionStart&&this.cbs.ontext(this.sectionStart,i),this.state=3,this.sectionStart=i}else this.delimiterIndex++;else this.inRCDATA?(this.state=32,this.stateInRCDATA(s)):(this.state=1,this.stateText(s))}stateInterpolation(s){s===this.delimiterClose[0]&&(this.state=4,this.delimiterIndex=0,this.stateInterpolationClose(s))}stateInterpolationClose(s){s===this.delimiterClose[this.delimiterIndex]?this.delimiterIndex===this.delimiterClose.length-1?(this.cbs.oninterpolation(this.sectionStart,this.index+1),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):this.delimiterIndex++:(this.state=3,this.stateInterpolation(s))}stateSpecialStartSequence(s){const i=this.sequenceIndex===this.currentSequence.length;if(!(i?Ot(s):(s|32)===this.currentSequence[this.sequenceIndex]))this.inRCDATA=!1;else if(!i){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=6,this.stateInTagName(s)}stateInRCDATA(s){if(this.sequenceIndex===this.currentSequence.length){if(s===62||Ze(s)){const i=this.index-this.currentSequence.length;if(this.sectionStart<i){const a=this.index;this.index=i,this.cbs.ontext(this.sectionStart,i),this.index=a}this.sectionStart=i+2,this.stateInClosingTagName(s),this.inRCDATA=!1;return}this.sequenceIndex=0}(s|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===ve.TitleEnd||this.currentSequence===ve.TextareaEnd&&!this.inSFCRoot?!this.inVPre&&s===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(s)):this.fastForwardTo(60)&&(this.sequenceIndex=1):this.sequenceIndex=+(s===60)}stateCDATASequence(s){s===ve.Cdata[this.sequenceIndex]?++this.sequenceIndex===ve.Cdata.length&&(this.state=28,this.currentSequence=ve.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=23,this.stateInDeclaration(s))}fastForwardTo(s){for(;++this.index<this.buffer.length;){const i=this.buffer.charCodeAt(this.index);if(i===10&&this.newlines.push(this.index),i===s)return!0}return this.index=this.buffer.length-1,!1}stateInCommentLike(s){s===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===ve.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index-2):this.cbs.oncomment(this.sectionStart,this.index-2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=1):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):s!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}startSpecial(s,i){this.enterRCDATA(s,i),this.state=31}enterRCDATA(s,i){this.inRCDATA=!0,this.currentSequence=s,this.sequenceIndex=i}stateBeforeTagName(s){s===33?(this.state=22,this.sectionStart=this.index+1):s===63?(this.state=24,this.sectionStart=this.index+1):kl(s)?(this.sectionStart=this.index,this.mode===0?this.state=6:this.inSFCRoot?this.state=34:this.inXML?this.state=6:s===116?this.state=30:this.state=s===115?29:6):s===47?this.state=8:(this.state=1,this.stateText(s))}stateInTagName(s){Ot(s)&&this.handleTagName(s)}stateInSFCRootTagName(s){if(Ot(s)){const i=this.buffer.slice(this.sectionStart,this.index);i!=="template"&&this.enterRCDATA(Ri("</"+i),0),this.handleTagName(s)}}handleTagName(s){this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(s)}stateBeforeClosingTagName(s){Ze(s)||(s===62?(process.env.NODE_ENV!=="production"&&this.cbs.onerr(14,this.index),this.state=1,this.sectionStart=this.index+1):(this.state=kl(s)?9:27,this.sectionStart=this.index))}stateInClosingTagName(s){(s===62||Ze(s))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=10,this.stateAfterClosingTagName(s))}stateAfterClosingTagName(s){s===62&&(this.state=1,this.sectionStart=this.index+1)}stateBeforeAttrName(s){s===62?(this.cbs.onopentagend(this.index),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):s===47?(this.state=7,process.env.NODE_ENV!=="production"&&this.peek()!==62&&this.cbs.onerr(22,this.index)):s===60&&this.peek()===47?(this.cbs.onopentagend(this.index),this.state=5,this.sectionStart=this.index):Ze(s)||(process.env.NODE_ENV!=="production"&&s===61&&this.cbs.onerr(19,this.index),this.handleAttrStart(s))}handleAttrStart(s){s===118&&this.peek()===45?(this.state=13,this.sectionStart=this.index):s===46||s===58||s===64||s===35?(this.cbs.ondirname(this.index,this.index+1),this.state=14,this.sectionStart=this.index+1):(this.state=12,this.sectionStart=this.index)}stateInSelfClosingTag(s){s===62?(this.cbs.onselfclosingtag(this.index),this.state=1,this.sectionStart=this.index+1,this.inRCDATA=!1):Ze(s)||(this.state=11,this.stateBeforeAttrName(s))}stateInAttrName(s){s===61||Ot(s)?(this.cbs.onattribname(this.sectionStart,this.index),this.handleAttrNameEnd(s)):process.env.NODE_ENV!=="production"&&(s===34||s===39||s===60)&&this.cbs.onerr(17,this.index)}stateInDirName(s){s===61||Ot(s)?(this.cbs.ondirname(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===58?(this.cbs.ondirname(this.sectionStart,this.index),this.state=14,this.sectionStart=this.index+1):s===46&&(this.cbs.ondirname(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDirArg(s){s===61||Ot(s)?(this.cbs.ondirarg(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===91?this.state=15:s===46&&(this.cbs.ondirarg(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDynamicDirArg(s){s===93?this.state=14:(s===61||Ot(s))&&(this.cbs.ondirarg(this.sectionStart,this.index+1),this.handleAttrNameEnd(s),process.env.NODE_ENV!=="production"&&this.cbs.onerr(27,this.index))}stateInDirModifier(s){s===61||Ot(s)?(this.cbs.ondirmodifier(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===46&&(this.cbs.ondirmodifier(this.sectionStart,this.index),this.sectionStart=this.index+1)}handleAttrNameEnd(s){this.sectionStart=this.index,this.state=17,this.cbs.onattribnameend(this.index),this.stateAfterAttrName(s)}stateAfterAttrName(s){s===61?this.state=18:s===47||s===62?(this.cbs.onattribend(0,this.sectionStart),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(s)):Ze(s)||(this.cbs.onattribend(0,this.sectionStart),this.handleAttrStart(s))}stateBeforeAttrValue(s){s===34?(this.state=19,this.sectionStart=this.index+1):s===39?(this.state=20,this.sectionStart=this.index+1):Ze(s)||(this.sectionStart=this.index,this.state=21,this.stateInAttrValueNoQuotes(s))}handleInAttrValue(s,i){(s===i||this.fastForwardTo(i))&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(i===34?3:2,this.index+1),this.state=11)}stateInAttrValueDoubleQuotes(s){this.handleInAttrValue(s,34)}stateInAttrValueSingleQuotes(s){this.handleInAttrValue(s,39)}stateInAttrValueNoQuotes(s){Ze(s)||s===62?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(1,this.index),this.state=11,this.stateBeforeAttrName(s)):(process.env.NODE_ENV!=="production"&&s===34||s===39||s===60||s===61||s===96)&&this.cbs.onerr(18,this.index)}stateBeforeDeclaration(s){s===91?(this.state=26,this.sequenceIndex=0):this.state=s===45?25:23}stateInDeclaration(s){(s===62||this.fastForwardTo(62))&&(this.state=1,this.sectionStart=this.index+1)}stateInProcessingInstruction(s){(s===62||this.fastForwardTo(62))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeComment(s){s===45?(this.state=28,this.currentSequence=ve.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=23}stateInSpecialComment(s){(s===62||this.fastForwardTo(62))&&(this.cbs.oncomment(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeSpecialS(s){s===ve.ScriptEnd[3]?this.startSpecial(ve.ScriptEnd,4):s===ve.StyleEnd[3]?this.startSpecial(ve.StyleEnd,4):(this.state=6,this.stateInTagName(s))}stateBeforeSpecialT(s){s===ve.TitleEnd[3]?this.startSpecial(ve.TitleEnd,4):s===ve.TextareaEnd[3]?this.startSpecial(ve.TextareaEnd,4):(this.state=6,this.stateInTagName(s))}startEntity(){}stateInEntity(){}parse(s){for(this.buffer=s;this.index<this.buffer.length;){const i=this.buffer.charCodeAt(this.index);switch(i===10&&this.state!==33&&this.newlines.push(this.index),this.state){case 1:{this.stateText(i);break}case 2:{this.stateInterpolationOpen(i);break}case 3:{this.stateInterpolation(i);break}case 4:{this.stateInterpolationClose(i);break}case 31:{this.stateSpecialStartSequence(i);break}case 32:{this.stateInRCDATA(i);break}case 26:{this.stateCDATASequence(i);break}case 19:{this.stateInAttrValueDoubleQuotes(i);break}case 12:{this.stateInAttrName(i);break}case 13:{this.stateInDirName(i);break}case 14:{this.stateInDirArg(i);break}case 15:{this.stateInDynamicDirArg(i);break}case 16:{this.stateInDirModifier(i);break}case 28:{this.stateInCommentLike(i);break}case 27:{this.stateInSpecialComment(i);break}case 11:{this.stateBeforeAttrName(i);break}case 6:{this.stateInTagName(i);break}case 34:{this.stateInSFCRootTagName(i);break}case 9:{this.stateInClosingTagName(i);break}case 5:{this.stateBeforeTagName(i);break}case 17:{this.stateAfterAttrName(i);break}case 20:{this.stateInAttrValueSingleQuotes(i);break}case 18:{this.stateBeforeAttrValue(i);break}case 8:{this.stateBeforeClosingTagName(i);break}case 10:{this.stateAfterClosingTagName(i);break}case 29:{this.stateBeforeSpecialS(i);break}case 30:{this.stateBeforeSpecialT(i);break}case 21:{this.stateInAttrValueNoQuotes(i);break}case 7:{this.stateInSelfClosingTag(i);break}case 23:{this.stateInDeclaration(i);break}case 22:{this.stateBeforeDeclaration(i);break}case 25:{this.stateBeforeComment(i);break}case 24:{this.stateInProcessingInstruction(i);break}case 33:{this.stateInEntity();break}}this.index++}this.cleanup(),this.finish()}cleanup(){this.sectionStart!==this.index&&(this.state===1||this.state===32&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===19||this.state===20||this.state===21)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}finish(){this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const s=this.buffer.length;this.sectionStart>=s||(this.state===28?this.currentSequence===ve.CdataEnd?this.cbs.oncdata(this.sectionStart,s):this.cbs.oncomment(this.sectionStart,s):this.state===6||this.state===11||this.state===18||this.state===17||this.state===12||this.state===13||this.state===14||this.state===15||this.state===16||this.state===20||this.state===19||this.state===21||this.state===9||this.cbs.ontext(this.sectionStart,s))}emitCodePoint(s,i){}}const IS={COMPILER_IS_ON_ELEMENT:{message:'Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".',link:"https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html"},COMPILER_V_BIND_SYNC:{message:e=>`.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${e}.sync\` should be changed to \`v-model:${e}\`.`,link:"https://v3-migration.vuejs.org/breaking-changes/v-model.html"},COMPILER_V_BIND_OBJECT_ORDER:{message:'v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.',link:"https://v3-migration.vuejs.org/breaking-changes/v-bind.html"},COMPILER_V_ON_NATIVE:{message:".native modifier for v-on has been removed as is no longer necessary.",link:"https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html"},COMPILER_V_IF_V_FOR_PRECEDENCE:{message:"v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.",link:"https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html"},COMPILER_NATIVE_TEMPLATE:{message:"<template> with no special directives will render as a native template element instead of its inner content in Vue 3."},COMPILER_INLINE_TEMPLATE:{message:'"inline-template" has been removed in Vue 3.',link:"https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html"},COMPILER_FILTERS:{message:'filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.',link:"https://v3-migration.vuejs.org/breaking-changes/filters.html"}};function ln(e,{compatConfig:s}){const i=s&&s[e];return e==="MODE"?i||3:i}function un(e,s){const i=ln("MODE",s),a=ln(e,s);return i===3?a===!0:a!==!1}function Mi(e,s,i,...a){const c=un(e,s);return process.env.NODE_ENV!=="production"&&c&&hn(e,s,i,...a),c}function hn(e,s,i,...a){if(ln(e,s)==="suppress-warning")return;const{message:u,link:h}=IS[e],f=`(deprecation ${e}) ${typeof u=="function"?u(...a):u}${h?`
|
|
55
|
-
Details: ${h}`:""}`,y=new SyntaxError(f);y.code=e,i&&(y.loc=i),s.onWarn(y)}function
|
|
56
|
-
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,45:"v-model cannot be used on a const binding because it is not writable.",46:"Error parsing JavaScript expression: ",47:"<KeepAlive> expects exactly one child component.",52:"@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.",48:'"prefixIdentifiers" option is not supported in this build of compiler.',49:"ES module mode is not supported in this build of compiler.",50:'"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.',51:'"scopeId" option is only supported in module mode.',54:""},
|
|
57
|
-
`);else if(
|
|
54
|
+
**/const Tl=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),Sl=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),bl=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),Il=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),xl=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),Mi=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),Al=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),Pl=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),wl=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),Cl=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),_l=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),gS=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),ES=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),TS=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),SS=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),bS=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),IS=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),xS=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),AS=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),PS=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),wS=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),vl=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),CS=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),Nl=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),Ol=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),Ll=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Dl=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),_S=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),vS=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),NS=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),OS=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),LS=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),DS=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),kS=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),RS=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),MS=Symbol(process.env.NODE_ENV!=="production"?"unref":""),$S=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),FS=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),BS=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),kl={[Tl]:"Fragment",[Sl]:"Teleport",[bl]:"Suspense",[Il]:"KeepAlive",[xl]:"BaseTransition",[Mi]:"openBlock",[Al]:"createBlock",[Pl]:"createElementBlock",[wl]:"createVNode",[Cl]:"createElementVNode",[_l]:"createCommentVNode",[gS]:"createTextVNode",[ES]:"createStaticVNode",[TS]:"resolveComponent",[SS]:"resolveDynamicComponent",[bS]:"resolveDirective",[IS]:"resolveFilter",[xS]:"withDirectives",[AS]:"renderList",[PS]:"renderSlot",[wS]:"createSlots",[vl]:"toDisplayString",[CS]:"mergeProps",[Nl]:"normalizeClass",[Ol]:"normalizeStyle",[Ll]:"normalizeProps",[Dl]:"guardReactiveProps",[_S]:"toHandlers",[vS]:"camelize",[NS]:"capitalize",[OS]:"toHandlerKey",[LS]:"setBlockTracking",[DS]:"pushScopeId",[kS]:"popScopeId",[RS]:"withCtx",[MS]:"unref",[$S]:"isRef",[FS]:"withMemo",[BS]:"isMemoSame"};function US(e){Object.getOwnPropertySymbols(e).forEach(s=>{kl[s]=e[s]})}const Ms={ELEMENT:1,SIMPLE_EXPRESSION:4,ATTRIBUTE:6,DIRECTIVE:7},$s={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function jS(e,s=""){return{type:0,source:s,children:e,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:$s}}function zS(e,s,i,a,c,u,h,f=!1,y=!1,T=!1,I=$s){return e&&(f?(e.helper(Mi),e.helper(hn(e.inSSR,T))):e.helper(un(e.inSSR,T))),{type:13,tag:s,props:i,children:a,patchFlag:c,dynamicProps:u,directives:h,isBlock:f,disableTracking:y,isComponent:T,loc:I}}function ln(e,s=$s){return{type:17,loc:s,elements:e}}function jt(e,s=!1,i=$s,a=0){return{type:4,loc:i,content:e,isStatic:s,constType:s?3:a}}function VS(e,s,i=!1,a=!1){return{type:20,index:e,value:s,needPauseTracking:i,inVOnce:a,needArraySpread:!1,loc:$s}}function un(e,s){return e||s?wl:Cl}function hn(e,s){return e||s?Al:Pl}function GS(e,{helper:s,removeHelper:i,inSSR:a}){e.isBlock||(e.isBlock=!0,i(un(a,e.isComponent)),s(Mi),s(hn(a,e.isComponent)))}const Rl=new Uint8Array([123,123]),Ml=new Uint8Array([125,125]);function $l(e){return e>=97&&e<=122||e>=65&&e<=90}function Ze(e){return e===32||e===10||e===9||e===12||e===13}function Dt(e){return e===47||e===62||Ze(e)}function $i(e){const s=new Uint8Array(e.length);for(let i=0;i<e.length;i++)s[i]=e.charCodeAt(i);return s}const _e={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class HS{constructor(s,i){this.stack=s,this.cbs=i,this.state=1,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=1,this.inRCDATA=!1,this.inXML=!1,this.inVPre=!1,this.newlines=[],this.mode=0,this.delimiterOpen=Rl,this.delimiterClose=Ml,this.delimiterIndex=-1,this.currentSequence=void 0,this.sequenceIndex=0}get inSFCRoot(){return this.mode===2&&this.stack.length===0}reset(){this.state=1,this.mode=0,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=1,this.inRCDATA=!1,this.currentSequence=void 0,this.newlines.length=0,this.delimiterOpen=Rl,this.delimiterClose=Ml}getPos(s){let i=1,a=s+1;const c=this.newlines.length;let u=-1;if(c>100){let h=-1,f=c;for(;h+1<f;){const y=h+f>>>1;this.newlines[y]<s?h=y:f=y}u=h}else for(let h=c-1;h>=0;h--)if(s>this.newlines[h]){u=h;break}return u>=0&&(i=u+2,a=s-this.newlines[u]),{column:a,line:i,offset:s}}peek(){return this.buffer.charCodeAt(this.index+1)}stateText(s){s===60?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=5,this.sectionStart=this.index):!this.inVPre&&s===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(s))}stateInterpolationOpen(s){if(s===this.delimiterOpen[this.delimiterIndex])if(this.delimiterIndex===this.delimiterOpen.length-1){const i=this.index+1-this.delimiterOpen.length;i>this.sectionStart&&this.cbs.ontext(this.sectionStart,i),this.state=3,this.sectionStart=i}else this.delimiterIndex++;else this.inRCDATA?(this.state=32,this.stateInRCDATA(s)):(this.state=1,this.stateText(s))}stateInterpolation(s){s===this.delimiterClose[0]&&(this.state=4,this.delimiterIndex=0,this.stateInterpolationClose(s))}stateInterpolationClose(s){s===this.delimiterClose[this.delimiterIndex]?this.delimiterIndex===this.delimiterClose.length-1?(this.cbs.oninterpolation(this.sectionStart,this.index+1),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):this.delimiterIndex++:(this.state=3,this.stateInterpolation(s))}stateSpecialStartSequence(s){const i=this.sequenceIndex===this.currentSequence.length;if(!(i?Dt(s):(s|32)===this.currentSequence[this.sequenceIndex]))this.inRCDATA=!1;else if(!i){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=6,this.stateInTagName(s)}stateInRCDATA(s){if(this.sequenceIndex===this.currentSequence.length){if(s===62||Ze(s)){const i=this.index-this.currentSequence.length;if(this.sectionStart<i){const a=this.index;this.index=i,this.cbs.ontext(this.sectionStart,i),this.index=a}this.sectionStart=i+2,this.stateInClosingTagName(s),this.inRCDATA=!1;return}this.sequenceIndex=0}(s|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===_e.TitleEnd||this.currentSequence===_e.TextareaEnd&&!this.inSFCRoot?!this.inVPre&&s===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(s)):this.fastForwardTo(60)&&(this.sequenceIndex=1):this.sequenceIndex=+(s===60)}stateCDATASequence(s){s===_e.Cdata[this.sequenceIndex]?++this.sequenceIndex===_e.Cdata.length&&(this.state=28,this.currentSequence=_e.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=23,this.stateInDeclaration(s))}fastForwardTo(s){for(;++this.index<this.buffer.length;){const i=this.buffer.charCodeAt(this.index);if(i===10&&this.newlines.push(this.index),i===s)return!0}return this.index=this.buffer.length-1,!1}stateInCommentLike(s){s===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===_e.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index-2):this.cbs.oncomment(this.sectionStart,this.index-2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=1):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):s!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}startSpecial(s,i){this.enterRCDATA(s,i),this.state=31}enterRCDATA(s,i){this.inRCDATA=!0,this.currentSequence=s,this.sequenceIndex=i}stateBeforeTagName(s){s===33?(this.state=22,this.sectionStart=this.index+1):s===63?(this.state=24,this.sectionStart=this.index+1):$l(s)?(this.sectionStart=this.index,this.mode===0?this.state=6:this.inSFCRoot?this.state=34:this.inXML?this.state=6:s===116?this.state=30:this.state=s===115?29:6):s===47?this.state=8:(this.state=1,this.stateText(s))}stateInTagName(s){Dt(s)&&this.handleTagName(s)}stateInSFCRootTagName(s){if(Dt(s)){const i=this.buffer.slice(this.sectionStart,this.index);i!=="template"&&this.enterRCDATA($i("</"+i),0),this.handleTagName(s)}}handleTagName(s){this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(s)}stateBeforeClosingTagName(s){Ze(s)||(s===62?(process.env.NODE_ENV!=="production"&&this.cbs.onerr(14,this.index),this.state=1,this.sectionStart=this.index+1):(this.state=$l(s)?9:27,this.sectionStart=this.index))}stateInClosingTagName(s){(s===62||Ze(s))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=10,this.stateAfterClosingTagName(s))}stateAfterClosingTagName(s){s===62&&(this.state=1,this.sectionStart=this.index+1)}stateBeforeAttrName(s){s===62?(this.cbs.onopentagend(this.index),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):s===47?(this.state=7,process.env.NODE_ENV!=="production"&&this.peek()!==62&&this.cbs.onerr(22,this.index)):s===60&&this.peek()===47?(this.cbs.onopentagend(this.index),this.state=5,this.sectionStart=this.index):Ze(s)||(process.env.NODE_ENV!=="production"&&s===61&&this.cbs.onerr(19,this.index),this.handleAttrStart(s))}handleAttrStart(s){s===118&&this.peek()===45?(this.state=13,this.sectionStart=this.index):s===46||s===58||s===64||s===35?(this.cbs.ondirname(this.index,this.index+1),this.state=14,this.sectionStart=this.index+1):(this.state=12,this.sectionStart=this.index)}stateInSelfClosingTag(s){s===62?(this.cbs.onselfclosingtag(this.index),this.state=1,this.sectionStart=this.index+1,this.inRCDATA=!1):Ze(s)||(this.state=11,this.stateBeforeAttrName(s))}stateInAttrName(s){s===61||Dt(s)?(this.cbs.onattribname(this.sectionStart,this.index),this.handleAttrNameEnd(s)):process.env.NODE_ENV!=="production"&&(s===34||s===39||s===60)&&this.cbs.onerr(17,this.index)}stateInDirName(s){s===61||Dt(s)?(this.cbs.ondirname(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===58?(this.cbs.ondirname(this.sectionStart,this.index),this.state=14,this.sectionStart=this.index+1):s===46&&(this.cbs.ondirname(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDirArg(s){s===61||Dt(s)?(this.cbs.ondirarg(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===91?this.state=15:s===46&&(this.cbs.ondirarg(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDynamicDirArg(s){s===93?this.state=14:(s===61||Dt(s))&&(this.cbs.ondirarg(this.sectionStart,this.index+1),this.handleAttrNameEnd(s),process.env.NODE_ENV!=="production"&&this.cbs.onerr(27,this.index))}stateInDirModifier(s){s===61||Dt(s)?(this.cbs.ondirmodifier(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===46&&(this.cbs.ondirmodifier(this.sectionStart,this.index),this.sectionStart=this.index+1)}handleAttrNameEnd(s){this.sectionStart=this.index,this.state=17,this.cbs.onattribnameend(this.index),this.stateAfterAttrName(s)}stateAfterAttrName(s){s===61?this.state=18:s===47||s===62?(this.cbs.onattribend(0,this.sectionStart),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(s)):Ze(s)||(this.cbs.onattribend(0,this.sectionStart),this.handleAttrStart(s))}stateBeforeAttrValue(s){s===34?(this.state=19,this.sectionStart=this.index+1):s===39?(this.state=20,this.sectionStart=this.index+1):Ze(s)||(this.sectionStart=this.index,this.state=21,this.stateInAttrValueNoQuotes(s))}handleInAttrValue(s,i){(s===i||this.fastForwardTo(i))&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(i===34?3:2,this.index+1),this.state=11)}stateInAttrValueDoubleQuotes(s){this.handleInAttrValue(s,34)}stateInAttrValueSingleQuotes(s){this.handleInAttrValue(s,39)}stateInAttrValueNoQuotes(s){Ze(s)||s===62?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(1,this.index),this.state=11,this.stateBeforeAttrName(s)):(process.env.NODE_ENV!=="production"&&s===34||s===39||s===60||s===61||s===96)&&this.cbs.onerr(18,this.index)}stateBeforeDeclaration(s){s===91?(this.state=26,this.sequenceIndex=0):this.state=s===45?25:23}stateInDeclaration(s){(s===62||this.fastForwardTo(62))&&(this.state=1,this.sectionStart=this.index+1)}stateInProcessingInstruction(s){(s===62||this.fastForwardTo(62))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeComment(s){s===45?(this.state=28,this.currentSequence=_e.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=23}stateInSpecialComment(s){(s===62||this.fastForwardTo(62))&&(this.cbs.oncomment(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeSpecialS(s){s===_e.ScriptEnd[3]?this.startSpecial(_e.ScriptEnd,4):s===_e.StyleEnd[3]?this.startSpecial(_e.StyleEnd,4):(this.state=6,this.stateInTagName(s))}stateBeforeSpecialT(s){s===_e.TitleEnd[3]?this.startSpecial(_e.TitleEnd,4):s===_e.TextareaEnd[3]?this.startSpecial(_e.TextareaEnd,4):(this.state=6,this.stateInTagName(s))}startEntity(){}stateInEntity(){}parse(s){for(this.buffer=s;this.index<this.buffer.length;){const i=this.buffer.charCodeAt(this.index);switch(i===10&&this.state!==33&&this.newlines.push(this.index),this.state){case 1:{this.stateText(i);break}case 2:{this.stateInterpolationOpen(i);break}case 3:{this.stateInterpolation(i);break}case 4:{this.stateInterpolationClose(i);break}case 31:{this.stateSpecialStartSequence(i);break}case 32:{this.stateInRCDATA(i);break}case 26:{this.stateCDATASequence(i);break}case 19:{this.stateInAttrValueDoubleQuotes(i);break}case 12:{this.stateInAttrName(i);break}case 13:{this.stateInDirName(i);break}case 14:{this.stateInDirArg(i);break}case 15:{this.stateInDynamicDirArg(i);break}case 16:{this.stateInDirModifier(i);break}case 28:{this.stateInCommentLike(i);break}case 27:{this.stateInSpecialComment(i);break}case 11:{this.stateBeforeAttrName(i);break}case 6:{this.stateInTagName(i);break}case 34:{this.stateInSFCRootTagName(i);break}case 9:{this.stateInClosingTagName(i);break}case 5:{this.stateBeforeTagName(i);break}case 17:{this.stateAfterAttrName(i);break}case 20:{this.stateInAttrValueSingleQuotes(i);break}case 18:{this.stateBeforeAttrValue(i);break}case 8:{this.stateBeforeClosingTagName(i);break}case 10:{this.stateAfterClosingTagName(i);break}case 29:{this.stateBeforeSpecialS(i);break}case 30:{this.stateBeforeSpecialT(i);break}case 21:{this.stateInAttrValueNoQuotes(i);break}case 7:{this.stateInSelfClosingTag(i);break}case 23:{this.stateInDeclaration(i);break}case 22:{this.stateBeforeDeclaration(i);break}case 25:{this.stateBeforeComment(i);break}case 24:{this.stateInProcessingInstruction(i);break}case 33:{this.stateInEntity();break}}this.index++}this.cleanup(),this.finish()}cleanup(){this.sectionStart!==this.index&&(this.state===1||this.state===32&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===19||this.state===20||this.state===21)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}finish(){this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const s=this.buffer.length;this.sectionStart>=s||(this.state===28?this.currentSequence===_e.CdataEnd?this.cbs.oncdata(this.sectionStart,s):this.cbs.oncomment(this.sectionStart,s):this.state===6||this.state===11||this.state===18||this.state===17||this.state===12||this.state===13||this.state===14||this.state===15||this.state===16||this.state===20||this.state===19||this.state===21||this.state===9||this.cbs.ontext(this.sectionStart,s))}emitCodePoint(s,i){}}const ZS={COMPILER_IS_ON_ELEMENT:{message:'Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".',link:"https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html"},COMPILER_V_BIND_SYNC:{message:e=>`.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${e}.sync\` should be changed to \`v-model:${e}\`.`,link:"https://v3-migration.vuejs.org/breaking-changes/v-model.html"},COMPILER_V_BIND_OBJECT_ORDER:{message:'v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.',link:"https://v3-migration.vuejs.org/breaking-changes/v-bind.html"},COMPILER_V_ON_NATIVE:{message:".native modifier for v-on has been removed as is no longer necessary.",link:"https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html"},COMPILER_V_IF_V_FOR_PRECEDENCE:{message:"v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.",link:"https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html"},COMPILER_NATIVE_TEMPLATE:{message:"<template> with no special directives will render as a native template element instead of its inner content in Vue 3."},COMPILER_INLINE_TEMPLATE:{message:'"inline-template" has been removed in Vue 3.',link:"https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html"},COMPILER_FILTERS:{message:'filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.',link:"https://v3-migration.vuejs.org/breaking-changes/filters.html"}};function pn(e,{compatConfig:s}){const i=s&&s[e];return e==="MODE"?i||3:i}function dn(e,s){const i=pn("MODE",s),a=pn(e,s);return i===3?a===!0:a!==!1}function Fi(e,s,i,...a){const c=dn(e,s);return process.env.NODE_ENV!=="production"&&c&&fn(e,s,i,...a),c}function fn(e,s,i,...a){if(pn(e,s)==="suppress-warning")return;const{message:u,link:h}=ZS[e],f=`(deprecation ${e}) ${typeof u=="function"?u(...a):u}${h?`
|
|
55
|
+
Details: ${h}`:""}`,y=new SyntaxError(f);y.code=e,i&&(y.loc=i),s.onWarn(y)}function Fl(e){throw e}function Bl(e){process.env.NODE_ENV!=="production"&&console.warn(`[Vue warn] ${e.message}`)}function Ul(e,s,i,a){const c=process.env.NODE_ENV!=="production"?(i||WS)[e]+(a||""):`https://vuejs.org/error-reference/#compiler-${e}`,u=new SyntaxError(String(c));return u.code=e,u.loc=s,u}const WS={0:"Illegal comment.",1:"CDATA section is allowed only in XML context.",2:"Duplicate attribute.",3:"End tag cannot have attributes.",4:"Illegal '/' in tags.",5:"Unexpected EOF in tag.",6:"Unexpected EOF in CDATA section.",7:"Unexpected EOF in comment.",8:"Unexpected EOF in script.",9:"Unexpected EOF in tag.",10:"Incorrectly closed comment.",11:"Incorrectly opened comment.",12:"Illegal tag name. Use '<' to print '<'.",13:"Attribute value was expected.",14:"End tag name was expected.",15:"Whitespace was expected.",16:"Unexpected '<!--' in comment.",17:`Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,18:"Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",19:"Attribute name cannot start with '='.",21:"'<?' is allowed only in XML context.",20:"Unexpected null character.",22:"Illegal '/' in tags.",23:"Invalid end tag.",24:"Element is missing end tag.",25:"Interpolation end sign was not found.",27:"End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",26:"Legal directive name was expected.",28:"v-if/v-else-if is missing expression.",29:"v-if/else branches must use unique keys.",30:"v-else/v-else-if has no adjacent v-if or v-else-if.",31:"v-for is missing expression.",32:"v-for has invalid expression.",33:"<template v-for> key should be placed on the <template> tag.",34:"v-bind is missing expression.",53:"v-bind with same-name shorthand only allows static argument.",35:"v-on is missing expression.",36:"Unexpected custom directive on <slot> outlet.",37:"Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.",38:"Duplicate slot names found. ",39:"Extraneous children found when component already has explicitly named default slot. These children will be ignored.",40:"v-slot can only be used on components or <template> tags.",41:"v-model is missing expression.",42:"v-model value must be a valid JavaScript member expression.",43:"v-model cannot be used on v-for or v-slot scope variables because they are not writable.",44:`v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
56
|
+
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,45:"v-model cannot be used on a const binding because it is not writable.",46:"Error parsing JavaScript expression: ",47:"<KeepAlive> expects exactly one child component.",52:"@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.",48:'"prefixIdentifiers" option is not supported in this build of compiler.',49:"ES module mode is not supported in this build of compiler.",50:'"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.',51:'"scopeId" option is only supported in module mode.',54:""},KS=e=>e.type===4&&e.isStatic;function qS(e){switch(e){case"Teleport":case"teleport":return Sl;case"Suspense":case"suspense":return bl;case"KeepAlive":case"keep-alive":return Il;case"BaseTransition":case"base-transition":return xl}}function YS(e,s,i=!1){for(let a=0;a<e.props.length;a++){const c=e.props[a];if(c.type===7&&(i||c.exp)&&(Rs(s)?c.name===s:s.test(c.name)))return c}}function XS(e,s){return!!(e&&KS(e)&&e.content===s)}function jl(e){return e.type===7&&e.name==="pre"}function JS(e){return e.type===1&&e.tagType===2}const QS=/([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;function zl(e){for(let s=0;s<e.length;s++)if(!Ze(e.charCodeAt(s)))return!1;return!0}function Vl(e){return e.type===2&&zl(e.content)||e.type===12&&Vl(e.content)}function eb(e){return e.type===3||Vl(e)}const Gl={parseMode:"base",ns:0,delimiters:["{{","}}"],getNamespace:()=>0,isVoidTag:ki,isPreTag:ki,isIgnoreNewlineTag:ki,isCustomElement:ki,onError:Fl,onWarn:Bl,comments:process.env.NODE_ENV!=="production",prefixIdentifiers:!1};let X=Gl,Fs=null,yt="",Le=null,q=null,Ue="",gt=-1,zt=-1,mn=0,kt=!1,yn=null;const fe=[],he=new HS(fe,{onerr:je,ontext(e,s){Bi(ve(e,s),e,s)},ontextentity(e,s,i){Bi(e,s,i)},oninterpolation(e,s){if(kt)return Bi(ve(e,s),e,s);let i=e+he.delimiterOpen.length,a=s-he.delimiterClose.length;for(;Ze(yt.charCodeAt(i));)i++;for(;Ze(yt.charCodeAt(a-1));)a--;let c=ve(i,a);c.includes("&")&&(c=X.decodeEntities(c,!1)),gn({type:5,content:ji(c,!1,Ae(i,a)),loc:Ae(e,s)})},onopentagname(e,s){const i=ve(e,s);Le={type:1,tag:i,ns:X.getNamespace(i,fe[0],X.ns),tagType:0,props:[],children:[],loc:Ae(e-1,s),codegenNode:void 0}},onopentagend(e){Zl(e)},onclosetag(e,s){const i=ve(e,s);if(!X.isVoidTag(i)){let a=!1;for(let c=0;c<fe.length;c++)if(fe[c].tag.toLowerCase()===i.toLowerCase()){a=!0,c>0&&je(24,fe[0].loc.start.offset);for(let h=0;h<=c;h++){const f=fe.shift();Ui(f,s,h<c)}break}a||je(23,Wl(e,60))}},onselfclosingtag(e){const s=Le.tag;Le.isSelfClosing=!0,Zl(e),fe[0]&&fe[0].tag===s&&Ui(fe.shift(),e)},onattribname(e,s){q={type:6,name:ve(e,s),nameLoc:Ae(e,s),value:void 0,loc:Ae(e)}},ondirname(e,s){const i=ve(e,s),a=i==="."||i===":"?"bind":i==="@"?"on":i==="#"?"slot":i.slice(2);if(!kt&&a===""&&je(26,e),kt||a==="")q={type:6,name:i,nameLoc:Ae(e,s),value:void 0,loc:Ae(e)};else if(q={type:7,name:a,rawName:i,exp:void 0,arg:void 0,modifiers:i==="."?[jt("prop")]:[],loc:Ae(e)},a==="pre"){kt=he.inVPre=!0,yn=Le;const c=Le.props;for(let u=0;u<c.length;u++)c[u].type===7&&(c[u]=lb(c[u]))}},ondirarg(e,s){if(e===s)return;const i=ve(e,s);if(kt&&!jl(q))q.name+=i,Vt(q.nameLoc,s);else{const a=i[0]!=="[";q.arg=ji(a?i:i.slice(1,-1),a,Ae(e,s),a?3:0)}},ondirmodifier(e,s){const i=ve(e,s);if(kt&&!jl(q))q.name+="."+i,Vt(q.nameLoc,s);else if(q.name==="slot"){const a=q.arg;a&&(a.content+="."+i,Vt(a.loc,s))}else{const a=jt(i,!0,Ae(e,s));q.modifiers.push(a)}},onattribdata(e,s){Ue+=ve(e,s),gt<0&&(gt=e),zt=s},onattribentity(e,s,i){Ue+=e,gt<0&&(gt=s),zt=i},onattribnameend(e){const s=q.loc.start.offset,i=ve(s,e);q.type===7&&(q.rawName=i),Le.props.some(a=>(a.type===7?a.rawName:a.name)===i)&&je(2,s)},onattribend(e,s){if(Le&&q){if(Vt(q.loc,s),e!==0)if(Ue.includes("&")&&(Ue=X.decodeEntities(Ue,!0)),q.type===6)q.name==="class"&&(Ue=Yl(Ue).trim()),e===1&&!Ue&&je(13,s),q.value={type:2,content:Ue,loc:e===1?Ae(gt,zt):Ae(gt-1,zt+1)},he.inSFCRoot&&Le.tag==="template"&&q.name==="lang"&&Ue&&Ue!=="html"&&he.enterRCDATA($i("</template"),0);else{let i=0;q.exp=ji(Ue,!1,Ae(gt,zt),0,i),q.name==="for"&&(q.forParseResult=sb(q.exp));let a=-1;q.name==="bind"&&(a=q.modifiers.findIndex(c=>c.content==="sync"))>-1&&Fi("COMPILER_V_BIND_SYNC",X,q.loc,q.arg.loc.source)&&(q.name="model",q.modifiers.splice(a,1))}(q.type!==7||q.name!=="pre")&&Le.props.push(q)}Ue="",gt=zt=-1},oncomment(e,s){X.comments&&gn({type:3,content:ve(e,s),loc:Ae(e-4,s+3)})},onend(){const e=yt.length;if(process.env.NODE_ENV!=="production"&&he.state!==1)switch(he.state){case 5:case 8:je(5,e);break;case 3:case 4:je(25,he.sectionStart);break;case 28:he.currentSequence===_e.CdataEnd?je(6,e):je(7,e);break;case 6:case 7:case 9:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:je(9,e);break}for(let s=0;s<fe.length;s++)Ui(fe[s],e-1),je(24,fe[s].loc.start.offset)},oncdata(e,s){fe[0].ns!==0?Bi(ve(e,s),e,s):je(1,e-9)},onprocessinginstruction(e){(fe[0]?fe[0].ns:X.ns)===0&&je(21,e-1)}}),Hl=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,tb=/^\(|\)$/g;function sb(e){const s=e.loc,i=e.content,a=i.match(QS);if(!a)return;const[,c,u]=a,h=(A,L,R=!1)=>{const oe=s.start.offset+L,le=oe+A.length;return ji(A,!1,Ae(oe,le),0,R?1:0)},f={source:h(u.trim(),i.indexOf(u,c.length)),value:void 0,key:void 0,index:void 0,finalized:!1};let y=c.trim().replace(tb,"").trim();const T=c.indexOf(y),I=y.match(Hl);if(I){y=y.replace(Hl,"").trim();const A=I[1].trim();let L;if(A&&(L=i.indexOf(A,T+y.length),f.key=h(A,L,!0)),I[2]){const R=I[2].trim();R&&(f.index=h(R,i.indexOf(R,f.key?L+A.length:T+y.length),!0))}}return y&&(f.value=h(y,T,!0)),f}function ve(e,s){return yt.slice(e,s)}function Zl(e){he.inSFCRoot&&(Le.innerLoc=Ae(e+1,e+1)),gn(Le);const{tag:s,ns:i}=Le;i===0&&X.isPreTag(s)&&mn++,X.isVoidTag(s)?Ui(Le,e):(fe.unshift(Le),(i===1||i===2)&&(he.inXML=!0)),Le=null}function Bi(e,s,i){{const u=fe[0]&&fe[0].tag;u!=="script"&&u!=="style"&&e.includes("&")&&(e=X.decodeEntities(e,!1))}const a=fe[0]||Fs,c=a.children[a.children.length-1];c&&c.type===2?(c.content+=e,Vt(c.loc,i)):a.children.push({type:2,content:e,loc:Ae(s,i)})}function Ui(e,s,i=!1){i?Vt(e.loc,Wl(s,60)):Vt(e.loc,ib(s,62)+1),he.inSFCRoot&&(e.children.length?e.innerLoc.end=Ri({},e.children[e.children.length-1].loc.end):e.innerLoc.end=Ri({},e.innerLoc.start),e.innerLoc.source=ve(e.innerLoc.start.offset,e.innerLoc.end.offset));const{tag:a,ns:c,children:u}=e;if(kt||(a==="slot"?e.tagType=2:Kl(e)?e.tagType=3:nb(e)&&(e.tagType=1)),he.inRCDATA||(e.children=ql(u)),c===0&&X.isIgnoreNewlineTag(a)){const h=u[0];h&&h.type===2&&(h.content=h.content.replace(/^\r?\n/,""))}c===0&&X.isPreTag(a)&&mn--,yn===e&&(kt=he.inVPre=!1,yn=null),he.inXML&&(fe[0]?fe[0].ns:X.ns)===0&&(he.inXML=!1);{const h=e.props;if(process.env.NODE_ENV!=="production"&&dn("COMPILER_V_IF_V_FOR_PRECEDENCE",X)){let y=!1,T=!1;for(let I=0;I<h.length;I++){const A=h[I];if(A.type===7&&(A.name==="if"?y=!0:A.name==="for"&&(T=!0)),y&&T){fn("COMPILER_V_IF_V_FOR_PRECEDENCE",X,e.loc);break}}}if(!he.inSFCRoot&&dn("COMPILER_NATIVE_TEMPLATE",X)&&e.tag==="template"&&!Kl(e)){process.env.NODE_ENV!=="production"&&fn("COMPILER_NATIVE_TEMPLATE",X,e.loc);const y=fe[0]||Fs,T=y.children.indexOf(e);y.children.splice(T,1,...e.children)}const f=h.find(y=>y.type===6&&y.name==="inline-template");f&&Fi("COMPILER_INLINE_TEMPLATE",X,f.loc)&&e.children.length&&(f.value={type:2,content:ve(e.children[0].loc.start.offset,e.children[e.children.length-1].loc.end.offset),loc:f.loc})}}function ib(e,s){let i=e;for(;yt.charCodeAt(i)!==s&&i<yt.length-1;)i++;return i}function Wl(e,s){let i=e;for(;yt.charCodeAt(i)!==s&&i>=0;)i--;return i}const rb=new Set(["if","else","else-if","for","slot"]);function Kl({tag:e,props:s}){if(e==="template"){for(let i=0;i<s.length;i++)if(s[i].type===7&&rb.has(s[i].name))return!0}return!1}function nb({tag:e,props:s}){if(X.isCustomElement(e))return!1;if(e==="component"||ab(e.charCodeAt(0))||qS(e)||X.isBuiltInComponent&&X.isBuiltInComponent(e)||X.isNativeTag&&!X.isNativeTag(e))return!0;for(let i=0;i<s.length;i++){const a=s[i];if(a.type===6){if(a.name==="is"&&a.value){if(a.value.content.startsWith("vue:"))return!0;if(Fi("COMPILER_IS_ON_ELEMENT",X,a.loc))return!0}}else if(a.name==="bind"&&XS(a.arg,"is")&&Fi("COMPILER_IS_ON_ELEMENT",X,a.loc))return!0}return!1}function ab(e){return e>64&&e<91}const ob=/\r\n/g;function ql(e){const s=X.whitespace!=="preserve";let i=!1;for(let a=0;a<e.length;a++){const c=e[a];if(c.type===2)if(mn)c.content=c.content.replace(ob,`
|
|
57
|
+
`);else if(zl(c.content)){const u=e[a-1]&&e[a-1].type,h=e[a+1]&&e[a+1].type;!u||!h||s&&(u===3&&(h===3||h===1)||u===1&&(h===3||h===1&&cb(c.content)))?(i=!0,e[a]=null):c.content=" "}else s&&(c.content=Yl(c.content))}return i?e.filter(Boolean):e}function cb(e){for(let s=0;s<e.length;s++){const i=e.charCodeAt(s);if(i===10||i===13)return!0}return!1}function Yl(e){let s="",i=!1;for(let a=0;a<e.length;a++)Ze(e.charCodeAt(a))?i||(s+=" ",i=!0):(s+=e[a],i=!1);return s}function gn(e){(fe[0]||Fs).children.push(e)}function Ae(e,s){return{start:he.getPos(e),end:s==null?s:he.getPos(s),source:s==null?s:ve(e,s)}}function Vt(e,s){e.end=he.getPos(s),e.source=ve(e.start.offset,s)}function lb(e){const s={type:6,name:e.rawName,nameLoc:Ae(e.loc.start.offset,e.loc.start.offset+e.rawName.length),value:void 0,loc:e.loc};if(e.exp){const i=e.exp.loc;i.end.offset<e.loc.end.offset&&(i.start.offset--,i.start.column--,i.end.offset++,i.end.column++),s.value={type:2,content:e.exp.content,loc:i}}return s}function ji(e,s=!1,i,a=0,c=0){return jt(e,s,i,a)}function je(e,s,i){X.onError(Ul(e,Ae(s,s),void 0,i))}function ub(){he.reset(),Le=null,q=null,Ue="",gt=-1,zt=-1,fe.length=0}function hb(e,s){if(ub(),yt=e,X=Ri({},Gl),s){let c;for(c in s)s[c]!=null&&(X[c]=s[c])}if(process.env.NODE_ENV!=="production"&&!X.decodeEntities)throw new Error("[@vue/compiler-core] decodeEntities option is required in browser builds.");he.mode=X.parseMode==="html"?1:X.parseMode==="sfc"?2:0,he.inXML=X.ns===1||X.ns===2;const i=s&&s.delimiters;i&&(he.delimiterOpen=$i(i[0]),he.delimiterClose=$i(i[1]));const a=Fs=jS([],e);return he.parse(yt),a.loc=Ae(0,e.length),a.children=ql(a.children),Fs=null,a}function pb(e,s){zi(e,void 0,s,!!Xl(e))}function Xl(e){const s=e.children.filter(i=>i.type!==3);return s.length===1&&s[0].type===1&&!JS(s[0])?s[0]:null}function zi(e,s,i,a=!1,c=!1){const{children:u}=e,h=[];for(let I=0;I<u.length;I++){const A=u[I];if(A.type===1&&A.tagType===0){const L=a?0:Et(A,i);if(L>0){if(L>=2){A.codegenNode.patchFlag=-1,h.push(A);continue}}else{const R=A.codegenNode;if(R.type===13){const oe=R.patchFlag;if((oe===void 0||oe===512||oe===1)&&Ql(A,i)>=2){const le=eu(A);le&&(R.props=i.hoist(le))}R.dynamicProps&&(R.dynamicProps=i.hoist(R.dynamicProps))}}}else if(A.type===12&&(a?0:Et(A,i))>=2){A.codegenNode.type===14&&A.codegenNode.arguments.length>0&&A.codegenNode.arguments.push(-1+(process.env.NODE_ENV!=="production"?` /* ${rS[-1]} */`:"")),h.push(A);continue}if(A.type===1){const L=A.tagType===1;L&&i.scopes.vSlot++,zi(A,e,i,!1,c),L&&i.scopes.vSlot--}else if(A.type===11)zi(A,e,i,A.children.length===1,!0);else if(A.type===9)for(let L=0;L<A.branches.length;L++)zi(A.branches[L],e,i,A.branches[L].children.length===1,c)}let f=!1;if(h.length===u.length&&e.type===1){if(e.tagType===0&&e.codegenNode&&e.codegenNode.type===13&&ks(e.codegenNode.children))e.codegenNode.children=y(ln(e.codegenNode.children)),f=!0;else if(e.tagType===1&&e.codegenNode&&e.codegenNode.type===13&&e.codegenNode.children&&!ks(e.codegenNode.children)&&e.codegenNode.children.type===15){const I=T(e.codegenNode,"default");I&&(I.returns=y(ln(I.returns)),f=!0)}else if(e.tagType===3&&s&&s.type===1&&s.tagType===1&&s.codegenNode&&s.codegenNode.type===13&&s.codegenNode.children&&!ks(s.codegenNode.children)&&s.codegenNode.children.type===15){const I=YS(e,"slot",!0),A=I&&I.arg&&T(s.codegenNode,I.arg);A&&(A.returns=y(ln(A.returns)),f=!0)}}if(!f)for(const I of h)I.codegenNode=i.cache(I.codegenNode);function y(I){const A=i.cache(I);return A.needArraySpread=!0,A}function T(I,A){if(I.children&&!ks(I.children)&&I.children.type===15){const L=I.children.properties.find(R=>R.key===A||R.key.content===A);return L&&L.value}}h.length&&i.transformHoist&&i.transformHoist(u,i,e)}function Et(e,s){const{constantCache:i}=s;switch(e.type){case 1:if(e.tagType!==0)return 0;const a=i.get(e);if(a!==void 0)return a;const c=e.codegenNode;if(c.type!==13||c.isBlock&&e.tag!=="svg"&&e.tag!=="foreignObject"&&e.tag!=="math")return 0;if(c.patchFlag===void 0){let h=3;const f=Ql(e,s);if(f===0)return i.set(e,0),0;f<h&&(h=f);for(let y=0;y<e.children.length;y++){const T=Et(e.children[y],s);if(T===0)return i.set(e,0),0;T<h&&(h=T)}if(h>1)for(let y=0;y<e.props.length;y++){const T=e.props[y];if(T.type===7&&T.name==="bind"&&T.exp){const I=Et(T.exp,s);if(I===0)return i.set(e,0),0;I<h&&(h=I)}}if(c.isBlock){for(let y=0;y<e.props.length;y++)if(e.props[y].type===7)return i.set(e,0),0;s.removeHelper(Mi),s.removeHelper(hn(s.inSSR,c.isComponent)),c.isBlock=!1,s.helper(un(s.inSSR,c.isComponent))}return i.set(e,h),h}else return i.set(e,0),0;case 2:case 3:return 3;case 9:case 11:case 10:return 0;case 5:case 12:return Et(e.content,s);case 4:return e.constType;case 8:let u=3;for(let h=0;h<e.children.length;h++){const f=e.children[h];if(Rs(f)||eS(f))continue;const y=Et(f,s);if(y===0)return 0;y<u&&(u=y)}return u;case 20:return 2;default:return process.env.NODE_ENV,0}}const db=new Set([Nl,Ol,Ll,Dl]);function Jl(e,s){if(e.type===14&&!Rs(e.callee)&&db.has(e.callee)){const i=e.arguments[0];if(i.type===4)return Et(i,s);if(i.type===14)return Jl(i,s)}return 0}function Ql(e,s){let i=3;const a=eu(e);if(a&&a.type===15){const{properties:c}=a;for(let u=0;u<c.length;u++){const{key:h,value:f}=c[u],y=Et(h,s);if(y===0)return y;y<i&&(i=y);let T;if(f.type===4?T=Et(f,s):f.type===14?T=Jl(f,s):T=0,T===0)return T;T<i&&(i=T)}}return i}function eu(e){const s=e.codegenNode;if(s.type===13)return s.props}function fb(e,{filename:s="",prefixIdentifiers:i=!1,hoistStatic:a=!1,hmr:c=!1,cacheHandlers:u=!1,nodeTransforms:h=[],directiveTransforms:f={},transformHoist:y=null,isBuiltInComponent:T=cn,isCustomElement:I=cn,expressionPlugins:A=[],scopeId:L=null,slotted:R=!0,ssr:oe=!1,inSSR:le=!1,ssrCssVars:Ce="",bindingMetadata:S=QT,inline:Ts=!1,isTS:$e=!1,onError:we=Fl,onWarn:Ne=Bl,compatConfig:bt}){const qt=s.replace(/\?.*$/,"").match(/([^/\\]+)\.\w+$/),J={filename:s,selfName:qt&&iS(sS(qt[1])),prefixIdentifiers:i,hoistStatic:a,hmr:c,cacheHandlers:u,nodeTransforms:h,directiveTransforms:f,transformHoist:y,isBuiltInComponent:T,isCustomElement:I,expressionPlugins:A,scopeId:L,slotted:R,ssr:oe,inSSR:le,ssrCssVars:Ce,bindingMetadata:S,inline:Ts,isTS:$e,onError:we,onWarn:Ne,compatConfig:bt,root:e,helpers:new Map,components:new Set,directives:new Set,hoists:[],imports:[],cached:[],constantCache:new WeakMap,temps:0,identifiers:Object.create(null),scopes:{vFor:0,vSlot:0,vPre:0,vOnce:0},parent:null,grandParent:null,currentNode:e,childIndex:0,inVOnce:!1,helper($){const z=J.helpers.get($)||0;return J.helpers.set($,z+1),$},removeHelper($){const z=J.helpers.get($);if(z){const _=z-1;_?J.helpers.set($,_):J.helpers.delete($)}},helperString($){return`_${kl[J.helper($)]}`},replaceNode($){if(process.env.NODE_ENV!=="production"){if(!J.currentNode)throw new Error("Node being replaced is already removed.");if(!J.parent)throw new Error("Cannot replace root node.")}J.parent.children[J.childIndex]=J.currentNode=$},removeNode($){if(process.env.NODE_ENV!=="production"&&!J.parent)throw new Error("Cannot remove root node.");const z=J.parent.children,_=$?z.indexOf($):J.currentNode?J.childIndex:-1;if(process.env.NODE_ENV!=="production"&&_<0)throw new Error("node being removed is not a child of current parent");!$||$===J.currentNode?(J.currentNode=null,J.onNodeRemoved()):J.childIndex>_&&(J.childIndex--,J.onNodeRemoved()),J.parent.children.splice(_,1)},onNodeRemoved:cn,addIdentifiers($){},removeIdentifiers($){},hoist($){Rs($)&&($=jt($)),J.hoists.push($);const z=jt(`_hoisted_${J.hoists.length}`,!1,$.loc,2);return z.hoisted=$,z},cache($,z=!1,_=!1){const Yt=VS(J.cached.length,$,z,_);return J.cached.push(Yt),Yt}};return J.filters=new Set,J}function mb(e,s){const i=fb(e,s);En(e,i),s.hoistStatic&&pb(e,i),s.ssr||yb(e,i),e.helpers=new Set([...i.helpers.keys()]),e.components=[...i.components],e.directives=[...i.directives],e.imports=i.imports,e.hoists=i.hoists,e.temps=i.temps,e.cached=i.cached,e.transformed=!0,e.filters=[...i.filters]}function yb(e,s){const{helper:i}=s,{children:a}=e;if(a.length===1){const c=Xl(e);if(c&&c.codegenNode){const u=c.codegenNode;u.type===13&&GS(u,s),e.codegenNode=u}else e.codegenNode=a[0]}else if(a.length>1){let c=64;process.env.NODE_ENV!=="production"&&a.filter(u=>u.type!==3).length===1&&(c|=2048),e.codegenNode=zS(s,i(Tl),void 0,e.children,c,void 0,void 0,!0,void 0,!1)}}function gb(e,s){let i=0;const a=()=>{i--};for(;i<e.children.length;i++){const c=e.children[i];Rs(c)||(s.grandParent=s.parent,s.parent=e,s.childIndex=i,s.onNodeRemoved=a,En(c,s))}}function En(e,s){s.currentNode=e;const{nodeTransforms:i}=s,a=[];for(let u=0;u<i.length;u++){const h=i[u](e,s);if(h&&(ks(h)?a.push(...h):a.push(h)),s.currentNode)e=s.currentNode;else return}switch(e.type){case 3:s.ssr||s.helper(_l);break;case 5:s.ssr||s.helper(vl);break;case 9:for(let u=0;u<e.branches.length;u++)En(e.branches[u],s);break;case 10:case 11:case 1:case 0:gb(e,s);break}s.currentNode=e;let c=a.length;for(;c--;)a[c]()}new RegExp("\\b"+"arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b")+"\\b");/**
|
|
58
58
|
* @vue/compiler-dom v3.5.28
|
|
59
59
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
60
60
|
* @license MIT
|
|
61
|
-
**/const qS=Symbol(process.env.NODE_ENV!=="production"?"vModelRadio":""),YS=Symbol(process.env.NODE_ENV!=="production"?"vModelCheckbox":""),JS=Symbol(process.env.NODE_ENV!=="production"?"vModelText":""),XS=Symbol(process.env.NODE_ENV!=="production"?"vModelSelect":""),QS=Symbol(process.env.NODE_ENV!=="production"?"vModelDynamic":""),eb=Symbol(process.env.NODE_ENV!=="production"?"vOnModifiersGuard":""),tb=Symbol(process.env.NODE_ENV!=="production"?"vOnKeysGuard":""),sb=Symbol(process.env.NODE_ENV!=="production"?"vShow":""),yn=Symbol(process.env.NODE_ENV!=="production"?"Transition":""),Jl=Symbol(process.env.NODE_ENV!=="production"?"TransitionGroup":"");gS({[qS]:"vModelRadio",[YS]:"vModelCheckbox",[JS]:"vModelText",[XS]:"vModelSelect",[QS]:"vModelDynamic",[eb]:"withModifiers",[tb]:"withKeys",[sb]:"vShow",[yn]:"Transition",[Jl]:"TransitionGroup"});let os;function ib(e,s=!1){return os||(os=document.createElement("div")),s?(os.innerHTML=`<div foo="${e.replace(/"/g,""")}">`,os.children[0].getAttribute("foo")):(os.innerHTML=e,os.textContent)}const rb={parseMode:"html",isVoidTag:WT,isNativeTag:e=>GT(e)||HT(e)||ZT(e),isPreTag:e=>e==="pre",isIgnoreNewlineTag:e=>e==="pre"||e==="textarea",decodeEntities:ib,isBuiltInComponent:e=>{if(e==="Transition"||e==="transition")return yn;if(e==="TransitionGroup"||e==="transition-group")return Jl},getNamespace(e,s,i){let a=s?s.ns:i;if(s&&a===2)if(s.tag==="annotation-xml"){if(e==="svg")return 1;s.props.some(c=>c.type===6&&c.name==="encoding"&&c.value!=null&&(c.value.content==="text/html"||c.value.content==="application/xhtml+xml"))&&(a=0)}else/^m(?:[ions]|text)$/.test(s.tag)&&e!=="mglyph"&&e!=="malignmark"&&(a=0);else s&&a===1&&(s.tag==="foreignObject"||s.tag==="desc"||s.tag==="title")&&(a=0);if(a===0){if(e==="svg")return 1;if(e==="math")return 2}return a}},nb=e=>{e.type===1&&e.props.forEach((s,i)=>{s.type===6&&s.name==="style"&&s.value&&(e.props[i]={type:7,name:"bind",arg:Bt("style",!0,s.loc),exp:ab(s.value.content,s.loc),modifiers:[],loc:s.loc})})},ab=(e,s)=>{const i=BT(e);return Bt(JSON.stringify(i),!1,s,3)};function ob(e,s){return Ml(e,s,process.env.NODE_ENV!=="production"?cb:void 0)}const cb={54:"v-html is missing expression.",55:"v-html will override element children.",56:"v-text is missing expression.",57:"v-text will override element children.",58:"v-model can only be used on <input>, <textarea> and <select> elements.",59:"v-model argument is not supported on plain elements.",60:"v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.",61:"Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.",62:"v-show is missing expression.",63:"<Transition> expects exactly one child element or component.",64:"Tags with side effect (<script> and <style>) are ignored in client component templates."},lb=(e,s)=>{if(e.type===1&&e.tagType===1&&s.isBuiltInComponent(e.tag)===yn)return()=>{if(!e.children.length)return;Xl(e)&&s.onError(ob(63,{start:e.children[0].loc.start,end:e.children[e.children.length-1].loc.end,source:""}));const a=e.children[0];if(a.type===1)for(const c of a.props)c.type===7&&c.name==="show"&&e.props.push({type:6,name:"persisted",nameLoc:e.loc,value:void 0,loc:e.loc})}};function Xl(e){const s=e.children=e.children.filter(a=>!OS(a)),i=s[0];return s.length!==1||i.type===11||i.type===9&&i.branches.some(Xl)}function ub(e,s){return e==="template"?!0:e in Ql?Ql[e].has(s):s in eu?eu[s].has(e):!(e in tu&&tu[e].has(s)||s in su&&su[s].has(e))}const cs=new Set(["h1","h2","h3","h4","h5","h6"]),zt=new Set([]),Ql={head:new Set(["base","basefront","bgsound","link","meta","title","noscript","noframes","style","script","template"]),optgroup:new Set(["option"]),select:new Set(["optgroup","option","hr"]),table:new Set(["caption","colgroup","tbody","tfoot","thead"]),tr:new Set(["td","th"]),colgroup:new Set(["col"]),tbody:new Set(["tr"]),thead:new Set(["tr"]),tfoot:new Set(["tr"]),script:zt,iframe:zt,option:zt,textarea:zt,style:zt,title:zt},eu={html:zt,body:new Set(["html"]),head:new Set(["html"]),td:new Set(["tr"]),colgroup:new Set(["table"]),caption:new Set(["table"]),tbody:new Set(["table"]),tfoot:new Set(["table"]),col:new Set(["colgroup"]),th:new Set(["tr"]),thead:new Set(["table"]),tr:new Set(["tbody","thead","tfoot"]),dd:new Set(["dl","div"]),dt:new Set(["dl","div"]),figcaption:new Set(["figure"]),summary:new Set(["details"]),area:new Set(["map"])},tu={p:new Set(["address","article","aside","blockquote","center","details","dialog","dir","div","dl","fieldset","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","menu","ol","p","pre","section","table","ul"]),svg:new Set(["b","blockquote","br","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","hr","i","img","li","menu","meta","ol","p","pre","ruby","s","small","span","strong","sub","sup","table","u","ul","var"])},su={a:new Set(["a"]),button:new Set(["button"]),dd:new Set(["dd","dt"]),dt:new Set(["dd","dt"]),form:new Set(["form"]),li:new Set(["li"]),h1:cs,h2:cs,h3:cs,h4:cs,h5:cs,h6:cs},hb=(e,s)=>{if(e.type===1&&e.tagType===0&&s.parent&&s.parent.type===1&&s.parent.tagType===0&&!ub(s.parent.tag,e.tag)){const i=new SyntaxError(`<${e.tag}> cannot be child of <${s.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);i.loc=e.loc,s.onWarn(i)}};[...process.env.NODE_ENV!=="production"?[lb,hb]:[]];function pb(e,s={}){return zS(e,ki({},rb,s))}function db(e){try{const s=NT.parseExpression(e);if(s.type==="StringLiteral")return s.value;if(s.type==="MemberExpression"&&!s.computed&&s.property.type==="Identifier")return s.property.name}catch{return}}function fb(e){for(const s of e.props){if(s.type===Ds.ATTRIBUTE&&s.name==="name")return s.value?.content;if(s.type===Ds.DIRECTIVE&&s.name==="bind"&&s.arg?.type===Ds.SIMPLE_EXPRESSION&&s.arg.content==="name"&&s.exp?.type===Ds.SIMPLE_EXPRESSION)return db(s.exp.content)}}function mb(e){const s=new Set,i=pb(e,{onError:()=>{}});return ZS(i,{nodeTransforms:[a=>{if(a.type===Ds.ELEMENT&&a.tag==="slot"){const c=fb(a);c!==void 0&&s.add(c)}}]}),[...s]}const yb={catalog:Bg,category:Ug,product:Fg};function gn(e){const s={};for(const[i,a]of Object.entries(e))s[i]=i,s[a]=i;return s}const gb={catalog:gn(oc),category:gn(cc),product:gn(lc)};function Eb(e,s,i,a){const c=yb[s];if(c===void 0)return;const u=new Set(a);for(const h of i){const f=gb[s][h]??h,y=c[f];if(y!==void 0&&y.length>0){const T=[];for(const x of y)u.has(x)||T.push(x);T.length>0&&e.at(["design"]).addIssue("MISSING_SLOT_DESIGN_SETTINGS",f,T.join(", "))}}}const Tb=de(["products","category","product"]),Sb=O().superRefine((e,s)=>{_s.safeParse(e).success||be(s).addIssue("INVALID_STORE_SECTION_ID",e,_s.options.join(", "))}).transform(e=>e),bb=A({id:O(),sectionId:Sb,assets:jr.array().optional(),templateContent:O().optional(),content:tn.optional(),design:sn.optional(),translationsSettings:_i.optional(),layouts:rn.array().optional()}).strict().superRefine((e,s)=>{const i=be(s);e.assets&&e.assets.forEach(a=>{a.size>vi&&i.at(["assets",Te.basename(a.path)]).addIssue("REQUIRED_SECTION_ASSET",mt(a.size),mt(vi))})});function xb(e,s){if(s.templateContent===void 0)return;const i=mb(s.templateContent),a=CT(s.design??{});Eb(e,s.sectionId,i,a)}A({id:O(),sectionId:_s,pageId:Tb,content:tn.optional(),design:sn.optional(),layouts:rn.array().optional()}).strict();const Ib=A({id:O(),sectionId:O(),layoutId:O(),server:gc}).strict().superRefine((e,s)=>{const i=be(s);_s.safeParse(e.sectionId).success||i.at(["sectionId"]).addIssue("INVALID_STORE_SECTION_ID",e.sectionId,_s.options.join(", ")),e.server.size>Ni&&i.at("server").addIssue("REQUIRED_SERVER_SIZE",mt(e.server.size),mt(Ni))});function Pb(e,s,i){if(e){if(e.type==="default")e.id!=="header"&&i.at("id").addIssue("REQUIRED_HEADER_ID");else if(e.type==="custom"&&e.id){const a=s.find(c=>c.id===e.id);a?(a.type!=="HEADER"&&i.at("id").addIssue("REQUIRED_CUSTOM_HEADER_TYPE",e.id),e.showcase_id&&((a.showcase||[]).some(c=>c.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):i.at("id").addIssue("REQUIRED_CUSTOM_HEADER",e.id)}}}function wb(e,s,i){if(e){if(e.type==="default")e.id!=="footer"&&i.at("id").addIssue("REQUIRED_FOOTER_ID");else if(e.type==="custom"&&e.id){const a=s.find(c=>c.id===e.id);a?(a.type!=="FOOTER"&&i.at("id").addIssue("REQUIRED_CUSTOM_FOOTER_TYPE",e.id),e.showcase_id&&((a.showcase||[]).some(c=>c.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):i.at("id").addIssue("REQUIRED_CUSTOM_FOOTER",e.id)}}}function Ab(e,s,i){if(!e)return;const a=i.at(["showcase_overrides"]);["content","design"].forEach(u=>{const h=e[u];if(h){const f=s[u]||{};Object.keys(h).forEach(y=>{if(!(y in f)){const T=u==="content"?"SHOWCASE_OVERRIDE_CONTENT":"SHOWCASE_OVERRIDE_DESIGN";a.at([u,y]).addIssue(T,y)}})}}),e.layoutId&&((s.layout||[]).some(u=>u.layoutId===e.layoutId)||a.at(["layoutId"]).addIssue("SHOWCASE_OVERRIDE_LAYOUT",e.layoutId));const c=s.assets?.map(u=>u.path)??[];e.content&&xc(e.content,c,a.at(["content"]))}function iu(e,s,i,a=!1){if(!e.id)return;const c=s.find(u=>u.id===e.id);if(!c){i.at("id").addIssue("REQUIRED_PAGE_SECTION",e.id);return}!a&&(c.type==="HEADER"||c.type==="FOOTER")&&i.at("id").addIssue("REQUIRED_PAGE_SECTION_TYPE"),Ab(e.showcase_overrides,c,i),e.showcase_id&&((c.showcase||[]).some(u=>u.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))}function Cb(e,s,i,a){e.id&&(i.some(c=>c.sectionId===s.type.toLowerCase()&&c.id===e.id)||a.at("id").addIssue("REQUIRED_STORE_LAYOUT",e.id,s.type.toLowerCase()))}const vb=A({version:O(),name:O(),shared:wT.optional(),sections:ne(PT),templates:ne(oT),layouts:ne(bb),slots:ne(Ib),collections:ne(pT),compressionEnabled:te(),externalizationEnabled:te(),vueVersion:O(),openSource:te().optional()}).strict().superRefine((e,s)=>{const i=new Set;e.templates.forEach((a,c)=>{const u=be(s).at(["templates",c]);Pb(a.configuration.header,e.sections,u.at(["configuration","header"])),wb(a.configuration.footer,e.sections,u.at(["configuration","footer"])),a.pages.forEach((h,f)=>{const y=u.at(["pages",f]);h.sections.forEach((T,x)=>{const P=y.at(["sections",x]);T.type==="custom"?iu(T,e.sections,P):T.type==="store"&&(T.id&&i.add(`${h.type.toLowerCase()}:${T.id}`),Cb(T,h,e.layouts,P))})})}),e.layouts.forEach((a,c)=>{i.has(`${a.sectionId}:${a.id}`)&&xb(be(s).at(["layouts",c]),a)}),e.collections.forEach((a,c)=>{a.descriptor.sections.forEach((u,h)=>{const f=be(s).at(["collections",c,"sections",h]);iu(u,e.sections,f,!0)})})});pt({customError:Zg});const _={error:e=>console.log(Tp(e)),warn:e=>console.log(Ep(e)),info:e=>console.log(et(e))},Nb="dist",_b="dist/shared",ot="dist/sections",En="dist/headers",Tn="dist/footers",Tt="dist/templates",ls="layouts",ru="preview",ze=`dist/${ls}`,$s="dist/collections",nu="dist/manifest.json",Ob=[ot,En,Tn,Tt,ze];function ji(e){return!!e}function Vt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const Lb="Resource name can only contain alphanumeric characters, dashes, and underscores";function kb(e){if(typeof e=="string"||typeof e=="number"){const s=/^[a-zA-Z0-9_-]+$/.test(e.toString());if(s)return{isValid:s,errorMessage:null}}return{isValid:!1,errorMessage:Lb}}function Db(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}function Rb(e){return Te.parse(e).name}function Mb(e){return e.split("-").filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}async function zi(){const e=await Ar(G(process.cwd(),"crane.config.json")),s=JSON.parse(e.toString());return{appClientId:s.app_client_id,appSecretKey:btoa(s.app_secret_key)}}function $b(e){return e.includes(`
|
|
62
|
-
`)}function
|
|
61
|
+
**/const Eb=Symbol(process.env.NODE_ENV!=="production"?"vModelRadio":""),Tb=Symbol(process.env.NODE_ENV!=="production"?"vModelCheckbox":""),Sb=Symbol(process.env.NODE_ENV!=="production"?"vModelText":""),bb=Symbol(process.env.NODE_ENV!=="production"?"vModelSelect":""),Ib=Symbol(process.env.NODE_ENV!=="production"?"vModelDynamic":""),xb=Symbol(process.env.NODE_ENV!=="production"?"vOnModifiersGuard":""),Ab=Symbol(process.env.NODE_ENV!=="production"?"vOnKeysGuard":""),Pb=Symbol(process.env.NODE_ENV!=="production"?"vShow":""),Tn=Symbol(process.env.NODE_ENV!=="production"?"Transition":""),tu=Symbol(process.env.NODE_ENV!=="production"?"TransitionGroup":"");US({[Eb]:"vModelRadio",[Tb]:"vModelCheckbox",[Sb]:"vModelText",[bb]:"vModelSelect",[Ib]:"vModelDynamic",[xb]:"withModifiers",[Ab]:"withKeys",[Pb]:"vShow",[Tn]:"Transition",[tu]:"TransitionGroup"});let ls;function wb(e,s=!1){return ls||(ls=document.createElement("div")),s?(ls.innerHTML=`<div foo="${e.replace(/"/g,""")}">`,ls.children[0].getAttribute("foo")):(ls.innerHTML=e,ls.textContent)}const Cb={parseMode:"html",isVoidTag:yS,isNativeTag:e=>dS(e)||fS(e)||mS(e),isPreTag:e=>e==="pre",isIgnoreNewlineTag:e=>e==="pre"||e==="textarea",decodeEntities:wb,isBuiltInComponent:e=>{if(e==="Transition"||e==="transition")return Tn;if(e==="TransitionGroup"||e==="transition-group")return tu},getNamespace(e,s,i){let a=s?s.ns:i;if(s&&a===2)if(s.tag==="annotation-xml"){if(e==="svg")return 1;s.props.some(c=>c.type===6&&c.name==="encoding"&&c.value!=null&&(c.value.content==="text/html"||c.value.content==="application/xhtml+xml"))&&(a=0)}else/^m(?:[ions]|text)$/.test(s.tag)&&e!=="mglyph"&&e!=="malignmark"&&(a=0);else s&&a===1&&(s.tag==="foreignObject"||s.tag==="desc"||s.tag==="title")&&(a=0);if(a===0){if(e==="svg")return 1;if(e==="math")return 2}return a}},_b=e=>{e.type===1&&e.props.forEach((s,i)=>{s.type===6&&s.name==="style"&&s.value&&(e.props[i]={type:7,name:"bind",arg:jt("style",!0,s.loc),exp:vb(s.value.content,s.loc),modifiers:[],loc:s.loc})})},vb=(e,s)=>{const i=cS(e);return jt(JSON.stringify(i),!1,s,3)};function Nb(e,s){return Ul(e,s,process.env.NODE_ENV!=="production"?Ob:void 0)}const Ob={54:"v-html is missing expression.",55:"v-html will override element children.",56:"v-text is missing expression.",57:"v-text will override element children.",58:"v-model can only be used on <input>, <textarea> and <select> elements.",59:"v-model argument is not supported on plain elements.",60:"v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.",61:"Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.",62:"v-show is missing expression.",63:"<Transition> expects exactly one child element or component.",64:"Tags with side effect (<script> and <style>) are ignored in client component templates."},Lb=(e,s)=>{if(e.type===1&&e.tagType===1&&s.isBuiltInComponent(e.tag)===Tn)return()=>{if(!e.children.length)return;su(e)&&s.onError(Nb(63,{start:e.children[0].loc.start,end:e.children[e.children.length-1].loc.end,source:""}));const a=e.children[0];if(a.type===1)for(const c of a.props)c.type===7&&c.name==="show"&&e.props.push({type:6,name:"persisted",nameLoc:e.loc,value:void 0,loc:e.loc})}};function su(e){const s=e.children=e.children.filter(a=>!eb(a)),i=s[0];return s.length!==1||i.type===11||i.type===9&&i.branches.some(su)}function Db(e,s){return e==="template"?!0:e in iu?iu[e].has(s):s in ru?ru[s].has(e):!(e in nu&&nu[e].has(s)||s in au&&au[s].has(e))}const us=new Set(["h1","h2","h3","h4","h5","h6"]),Gt=new Set([]),iu={head:new Set(["base","basefront","bgsound","link","meta","title","noscript","noframes","style","script","template"]),optgroup:new Set(["option"]),select:new Set(["optgroup","option","hr"]),table:new Set(["caption","colgroup","tbody","tfoot","thead"]),tr:new Set(["td","th"]),colgroup:new Set(["col"]),tbody:new Set(["tr"]),thead:new Set(["tr"]),tfoot:new Set(["tr"]),script:Gt,iframe:Gt,option:Gt,textarea:Gt,style:Gt,title:Gt},ru={html:Gt,body:new Set(["html"]),head:new Set(["html"]),td:new Set(["tr"]),colgroup:new Set(["table"]),caption:new Set(["table"]),tbody:new Set(["table"]),tfoot:new Set(["table"]),col:new Set(["colgroup"]),th:new Set(["tr"]),thead:new Set(["table"]),tr:new Set(["tbody","thead","tfoot"]),dd:new Set(["dl","div"]),dt:new Set(["dl","div"]),figcaption:new Set(["figure"]),summary:new Set(["details"]),area:new Set(["map"])},nu={p:new Set(["address","article","aside","blockquote","center","details","dialog","dir","div","dl","fieldset","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","menu","ol","p","pre","section","table","ul"]),svg:new Set(["b","blockquote","br","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","hr","i","img","li","menu","meta","ol","p","pre","ruby","s","small","span","strong","sub","sup","table","u","ul","var"])},au={a:new Set(["a"]),button:new Set(["button"]),dd:new Set(["dd","dt"]),dt:new Set(["dd","dt"]),form:new Set(["form"]),li:new Set(["li"]),h1:us,h2:us,h3:us,h4:us,h5:us,h6:us},kb=(e,s)=>{if(e.type===1&&e.tagType===0&&s.parent&&s.parent.type===1&&s.parent.tagType===0&&!Db(s.parent.tag,e.tag)){const i=new SyntaxError(`<${e.tag}> cannot be child of <${s.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);i.loc=e.loc,s.onWarn(i)}};[...process.env.NODE_ENV!=="production"?[Lb,kb]:[]];function Rb(e,s={}){return hb(e,Ri({},Cb,s))}function Mb(e){try{const s=JT.parseExpression(e);if(s.type==="StringLiteral")return s.value;if(s.type==="MemberExpression"&&!s.computed&&s.property.type==="Identifier")return s.property.name}catch{return}}function $b(e){for(const s of e.props){if(s.type===Ms.ATTRIBUTE&&s.name==="name")return s.value?.content;if(s.type===Ms.DIRECTIVE&&s.name==="bind"&&s.arg?.type===Ms.SIMPLE_EXPRESSION&&s.arg.content==="name"&&s.exp?.type===Ms.SIMPLE_EXPRESSION)return Mb(s.exp.content)}}function Fb(e){const s=new Set,i=Rb(e,{onError:()=>{}});return mb(i,{nodeTransforms:[a=>{if(a.type===Ms.ELEMENT&&a.tag==="slot"){const c=$b(a);c!==void 0&&s.add(c)}}]}),[...s]}const Bb={catalog:zg,category:Vg,product:jg};function Sn(e){const s={};for(const[i,a]of Object.entries(e))s[i]=i,s[a]=i;return s}const Ub={catalog:Sn(uc),category:Sn(hc),product:Sn(pc)};function jb(e,s,i,a){const c=Bb[s];if(c===void 0)return;const u=new Set(a);for(const h of i){const f=Ub[s][h]??h,y=c[f];if(y!==void 0&&y.length>0){const T=[];for(const I of y)u.has(I)||T.push(I);T.length>0&&e.at(["design"]).addIssue("MISSING_SLOT_DESIGN_SETTINGS",f,T.join(", "))}}}const zb=ne(["products","category","product"]),Vb=O().superRefine((e,s)=>{Ls.safeParse(e).success||Te(s).addIssue("INVALID_STORE_SECTION_ID",e,Ls.options.join(", "))}).transform(e=>e),Gb=w({id:O(),sectionId:Vb,assets:Gr.array().optional(),templateContent:O().optional(),content:nn.optional(),design:an.optional(),translationsSettings:Li.optional(),layouts:on.array().optional()}).strict().superRefine((e,s)=>{const i=Te(s);e.assets&&e.assets.forEach(a=>{a.size>Ni&&i.at(["assets",Se.basename(a.path)]).addIssue("REQUIRED_SECTION_ASSET",mt(a.size),mt(Ni))})});function Hb(e,s){if(s.templateContent===void 0)return;const i=Fb(s.templateContent),a=YT(s.design??{});jb(e,s.sectionId,i,a)}w({id:O(),sectionId:Ls,pageId:zb,content:nn.optional(),design:an.optional(),layouts:on.array().optional()}).strict();const Zb=w({id:O(),sectionId:O(),layoutId:O(),server:Ic}).strict().superRefine((e,s)=>{const i=Te(s);Ls.safeParse(e.sectionId).success||i.at(["sectionId"]).addIssue("INVALID_STORE_SECTION_ID",e.sectionId,Ls.options.join(", ")),e.server.size>Oi&&i.at("server").addIssue("REQUIRED_SERVER_SIZE",mt(e.server.size),mt(Oi))});function Wb(e,s,i){if(e){if(e.type==="default")e.id!=="header"&&i.at("id").addIssue("REQUIRED_HEADER_ID");else if(e.type==="custom"&&e.id){const a=s.find(c=>c.id===e.id);a?(a.type!=="HEADER"&&i.at("id").addIssue("REQUIRED_CUSTOM_HEADER_TYPE",e.id),e.showcase_id&&((a.showcase||[]).some(c=>c.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):i.at("id").addIssue("REQUIRED_CUSTOM_HEADER",e.id)}}}function Kb(e,s,i){if(e){if(e.type==="default")e.id!=="footer"&&i.at("id").addIssue("REQUIRED_FOOTER_ID");else if(e.type==="custom"&&e.id){const a=s.find(c=>c.id===e.id);a?(a.type!=="FOOTER"&&i.at("id").addIssue("REQUIRED_CUSTOM_FOOTER_TYPE",e.id),e.showcase_id&&((a.showcase||[]).some(c=>c.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):i.at("id").addIssue("REQUIRED_CUSTOM_FOOTER",e.id)}}}function qb(e,s,i){if(!e)return;const a=i.at(["showcase_overrides"]);["content","design"].forEach(u=>{const h=e[u];if(h){const f=s[u]||{};Object.keys(h).forEach(y=>{if(!(y in f)){const T=u==="content"?"SHOWCASE_OVERRIDE_CONTENT":"SHOWCASE_OVERRIDE_DESIGN";a.at([u,y]).addIssue(T,y)}})}}),e.layoutId&&((s.layout||[]).some(u=>u.layoutId===e.layoutId)||a.at(["layoutId"]).addIssue("SHOWCASE_OVERRIDE_LAYOUT",e.layoutId));const c=s.assets?.map(u=>u.path)??[];e.content&&wc(e.content,c,a.at(["content"]))}function ou(e,s,i,a=!1){if(!e.id)return;const c=s.find(u=>u.id===e.id);if(!c){i.at("id").addIssue("REQUIRED_PAGE_SECTION",e.id);return}!a&&(c.type==="HEADER"||c.type==="FOOTER")&&i.at("id").addIssue("REQUIRED_PAGE_SECTION_TYPE"),qb(e.showcase_overrides,c,i),e.showcase_id&&((c.showcase||[]).some(u=>u.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))}function Yb(e,s,i,a){e.id&&(i.some(c=>c.sectionId===s.type.toLowerCase()&&c.id===e.id)||a.at("id").addIssue("REQUIRED_STORE_LAYOUT",e.id,s.type.toLowerCase()))}const Xb=w({version:O(),name:O(),shared:KT.optional(),sections:ae(WT),templates:ae(NT),layouts:ae(Gb),slots:ae(Zb),collections:ae(RT),compressionEnabled:te(),externalizationEnabled:te(),vueVersion:O(),openSource:te().optional()}).strict().superRefine((e,s)=>{const i=new Set;e.templates.forEach((a,c)=>{const u=Te(s).at(["templates",c]);Wb(a.configuration.header,e.sections,u.at(["configuration","header"])),Kb(a.configuration.footer,e.sections,u.at(["configuration","footer"])),a.pages.forEach((h,f)=>{const y=u.at(["pages",f]);h.sections.forEach((T,I)=>{const A=y.at(["sections",I]);T.type==="custom"?ou(T,e.sections,A):T.type==="store"&&(T.id&&i.add(`${h.type.toLowerCase()}:${T.id}`),Yb(T,h,e.layouts,A))})})}),e.layouts.forEach((a,c)=>{i.has(`${a.sectionId}:${a.id}`)&&Hb(Te(s).at(["layouts",c]),a)}),e.collections.forEach((a,c)=>{a.descriptor.sections.forEach((u,h)=>{const f=Te(s).at(["collections",c,"sections",h]);ou(u,e.sections,f,!0)})})});pt({customError:qg});const N={error:e=>console.log(xp(e)),warn:e=>console.log(Ip(e)),info:e=>console.log(et(e))},Jb="dist",Qb="dist/shared",ot="dist/sections",bn="dist/headers",In="dist/footers",Tt="dist/templates",hs="layouts",cu="preview",ze=`dist/${hs}`,Bs="dist/collections",lu="dist/manifest.json",eI=[ot,bn,In,Tt,ze];function Vi(e){return!!e}function Ht(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const tI="Resource name can only contain alphanumeric characters, dashes, and underscores";function sI(e){if(typeof e=="string"||typeof e=="number"){const s=/^[a-zA-Z0-9_-]+$/.test(e.toString());if(s)return{isValid:s,errorMessage:null}}return{isValid:!1,errorMessage:tI}}function iI(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}function rI(e){return Se.parse(e).name}function nI(e){return e.split("-").filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}async function Gi(){const e=await _r(G(process.cwd(),"crane.config.json")),s=JSON.parse(e.toString());return{appClientId:s.app_client_id,appSecretKey:btoa(s.app_secret_key)}}function aI(e){return e.includes(`
|
|
62
|
+
`)}function oI(e,s,i){return e.split(`
|
|
63
63
|
`).map((a,c)=>c>=i?s+a:a).join(`
|
|
64
|
-
`)}function
|
|
64
|
+
`)}function Zt(e,s){const i=[];if(e instanceof Qa){e.response?.status!==void 0&&i.push(` HTTP Status Code: ${e.response.status}`);const u=e.response?.data;if(u?.errorCode&&i.push(` Error Code: ${u.errorCode}`),u?.errorMessage){const h=aI(u.errorMessage)?oI(u.errorMessage," ",1):u.errorMessage;i.push(` Error Message: ${h}`)}}const a=i.length>0?i.join(`
|
|
65
65
|
`):e?.message??"Unknown error";if(!s||s.length===0)return a;const c=i.length>0?`
|
|
66
|
-
`:" ";return`${s}${c}${a}`}function Sn(e,s){return Object.keys(e).reduce((i,a)=>{const c=e[a],u=s[a];return Vt(c)&&Vt(u)?i[a]=Sn(c,u):i[a]=c,i},{...s})}function Bb({contentSettings:e,sectionType:s}){const i=al(s);return Sn(e,i)}function Ub({designSettings:e,sectionType:s}){const i=ol(s);return Sn(e,i)}async function qe(e){return(await import(qa(e).href+`?t=${Date.now()}`)).default}function bn(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function it(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const s=Ap(e);return{type:"STRUCTURED_COLOR",raw:e,hex:s.toHex8String(),hsl:s.toHsl(),rgba:s.toRgb(),auto:!1}}function au(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}function jb(e){if(e!==void 0)return{...e,color:it(e.color)}}function Ht(e){return Object.fromEntries(Object.entries(e).filter(([s,i])=>i!==void 0))}function zb(e){if(e!==void 0)switch(e){case Ur.COLOR:return"solid";case Ur.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Ur)}`)}}function Vb({style:e,color:s}){const i=Array.isArray(s)?s:[s,s];return{background:{type:zb(e),solid:{color:it(i.at(0))},gradient:{fromColor:it(i.at(0)),toColor:it(i.at(1))}}}}function Gb(e){if(e!==void 0)switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(Ag)}`)}}function Hb(e){if(e!==void 0)switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(vg)}`)}}function Zb(e){if(e!==void 0)switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(_g)}`)}}function Wb(e){return e===di.GO_TO_STORE?di.GO_TO_STORE_LINK:e===di.GO_TO_CATEGORY?di.GO_TO_CATEGORY_LINK:e}function Kb(e){const s=Gb(e.appearance),i=Hb(e.size),a=Zb(e.shape),c=bn(e.font),u=it(e.color),h=e.visible;return Ht({appearance:s,size:i,style:a,font:c,color:u,visible:h})}function qb(e){return{...e,buttonType:Wb(e.buttonType)}}function Yb(e){const s=it(e.color);return Ht({color:s})}function Jb(e){if(e!==void 0)switch(e){case fi.COLOR:return"solid";case fi.GRADIENT:return"gradient";case fi.NONE:return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(fi)}`)}}function Xb(e){const s=e.color,i=Array.isArray(s)?s:[s,s],a=e.visible,c={type:Jb(e.overlay),solid:{color:it(i.at(0))},gradient:{fromColor:it(i.at(0)),toColor:it(i.at(1))}};return Ht({overlay:c,visible:a})}function Qb(e){const s=bn(e.font),i=it(e.color),a=au(e.size),c=e.bold,u=e.italic,h=e.spacing,f=e.capitalization,y=e.visible;return Ht({font:s,color:i,size:a,frame:jb(e.frame),bold:c,italic:u,spacing:h,capitalization:f,visible:y})}function ex(e){const s=e.value;return Ht({value:s})}function tx(e){const s=bn(e.font),i=it(e.color),a=au(e.size),c=e.bold,u=e.italic,h=e.visible;return Ht({font:s,color:i,size:a,bold:c,italic:u,visible:h})}function sx(e){const s=e.enabled;return Ht({enabled:s})}function ix(e){return e===ti.GO_TO_STORE_LINK?ti.GO_TO_STORE:e===ti.GO_TO_CATEGORY_LINK?ti.GO_TO_CATEGORY:e}function ou(e){return e.map(s=>s.type?{...s,type:ix(s.type)}:s)}function rx(e){return e.items?{...e,items:ou(e.items)}:e}function nx(e){return e.items?{...e,items:ou(e.items)}:e}function ax(e){if(!e.cards)return e;const s=e.cards.map(i=>{if(!i.settings)return i;const a={};return Object.keys(i.settings).forEach(c=>{const u=i.settings[c],h=u.type,f=Vi(h,{defaults:u});f&&u?a[c]={...u,...f}:a[c]=u}),{...i,settings:a}});return{...e,cards:s}}function xn(e,s){if(s.defaults===void 0)return;let i={};switch(e){case He.TEXT:{i=tx(s.defaults);break}case He.BUTTON:{i=Kb(s.defaults);break}case He.IMAGE:{i=Xb(s.defaults);break}case He.BACKGROUND:{i=Vb(s.defaults);break}case He.COLOR_PICKER:{i=Yb(s.defaults);break}case He.LOGO:{i=Qb(s.defaults);break}case He.SELECTBOX:{i=ex(s.defaults);break}case He.TOGGLE:{i=sx(s.defaults);break}case He.DIVIDER:case He.INFO:break;case He.ACCORDION:return s.defaults;default:throw new Error(`Unknown design editor type: ${e}`)}return i}function cu(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===He.ACCORDION){const h=Object.fromEntries(Object.entries(a.items).map(([f,y])=>[f,{...y,editors:cu(y.editors)}]));s[i]={...a,items:h};return}const u=xn(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}),s}function ox(e){return e===void 0?e:e.map(s=>{if(s.type!==void 0&&s.defaults!==void 0&&s.fieldName!==void 0){const i={...xn(s.type,s)??s.defaults,type:s.defaults.type??s.type};return{type:s.type,fieldName:s.fieldName,defaults:i}}return s})}function In(e){if(e===void 0)return;const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===He.ACCORDION){const h=Object.fromEntries(Object.entries(a.items).map(([f,y])=>[f,{...y,editors:In(y.editors)??y.editors}]));s[i]={type:a.type,items:h};return}const u=xn(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function Vi(e,s){if(s.defaults!==void 0)switch(e){case F.BUTTON:return qb(s.defaults);case F.MENU:return rx(s.defaults);case F.NAVIGATION_MENU:return nx(s.defaults);case F.DECK:return ax(s.defaults);case F.CATEGORY_SELECTOR:case F.DIVIDER:case F.IMAGE:case F.INPUTBOX:case F.INFO:case F.LOGO:case F.PRODUCT_SELECTOR:case F.SELECTBOX:case F.TEXTAREA:case F.TOGGLE:return{...s.defaults};default:throw new Error(`Unknown content editor type: ${e}`)}}function cx(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=lu(a);else{const u=Vi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function lu(e){const s=e.cards.defaultCardContent.settings,i=cx(s);return{...e,cards:{...e.cards,defaultCardContent:{...e.cards.defaultCardContent,settings:i}}}}function lx(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=lu(a);else{const u=Vi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function ux(e){if(e===void 0)return;const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type,u=Vi(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function hx(e,s){if(!s)return;const i=e[s];return i===void 0?{en:s}:i}function px(e){const s={};for(const i in e){const a=e[i];for(const c in a){const u=s[c],h=a[c];if(u===void 0){const f={};f[i]=h,s[c]=f}else u[i]=h}}return s}function dx(e){return e.every(s=>s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean")}function us(e,s){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return dx(e)?e:e.map(c=>us(c,s));const i=e,a={};for(const c in i){const u=i[c];typeof u=="string"&&u.startsWith("$")?a[c]=hx(s,u):typeof u=="object"&&u!==null?a[c]=us(u,s):a[c]=u}return a}async function Fs(e){return e?px(e):{}}async function fx(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/settings/translations.mjs`);return await qe(i)}async function Gi(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/showcases/translations.mjs`);return await qe(i)}async function mx(e,s){const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/translations.mjs`);if(De(i))return await qe(i)}async function Pn(e,s,i){const a=i?Bb({contentSettings:e,sectionType:i}):e,c=lx(a);return us(c,s)}async function yx(e,s=ot){try{const i=G(xe.cwd(),`${s}/${e}/js/settings/content.mjs`),a=await qe(i);return ns(a)}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function wn(e,s,i){const a=i?Ub({designSettings:e,sectionType:i}):e,c=cu(a);return us(c,s)}async function gx(e,s=ot){try{const i=G(xe.cwd(),`${s}/${e}/js/settings/design.mjs`),a=await qe(i);return ns(a)}catch(i){const a=i;throw new Error(`Design settings is invalid or undefined. Error ${a.stack}`)}}async function Ex(e,s){return Promise.all(e.map(async i=>{const a=i.content?ux(i.content):void 0,c=i.design?In(i.design):void 0,u={...i,content:a??i.content,design:c??i.design};return us(u,s)}))}async function Tx(e,s=ot){try{const i=await W("*.mjs",{cwd:G(xe.cwd(),`${s}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(i.map(async a=>{const c=G(xe.cwd(),`${s}/${e}/js/showcases/${a}`);return await qe(c)}))}catch(i){throw new Error(`Showcases is invalid or undefined. Error ${i}`)}}async function uu(e){return e?.map(s=>({...s,selectedDesignSettings:ox(s.selectedDesignSettings)??s.selectedDesignSettings}))??[]}async function Sx(e,s=ot){try{const i=G(xe.cwd(),`${s}/${e}/js/settings/layout.mjs`);return De(i)?await qe(i):[]}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}function bx(e){let s={};const i=G(xe.cwd(),`${ru}/shared/analytics.json`);if(!De(i))return 0;try{const a=xr(i,"utf-8");s=JSON.parse(a)}catch(a){console.warn("Error processing analytics.json file",a)}return s[e]||0}const hs={Server:0,Client:1,SectionAsset:4,PageTemplateDescriptor:6,TemplateAsset:7,SharedTranslation:13},An="https://blockbuster.ecwid.com",xx="/api/v1/custom-apps/resources/sections/upload",Ix="/api/v1/custom-apps/resources/templates/upload",Px="/api/v1/custom-apps/manifests/sections",wx="/api/v1/custom-apps/manifests/templates",Ax=5,Cx=3,vx=[se.Server,se.Client,se.ClientChunks,se.ClientAsset,se.Asset],Nx=[se.LayoutClient,se.LayoutAsset],_x=[se.SlotServer,se.SlotClient,se.SlotClientChunks,se.SlotClientAsset],Ox=[se.Dependency,se.TemplateAsset,se.SourceCode,se.CollectionAsset],ps={DEFAULT:"Error while deploying:",ASSET_FILES_UPLOAD:"Error while uploading asset files:",MANIFEST_DEPLOYMENT:"Error while deploying manifest file:",DEPRECATED_VERSION_DEPLOYMENT:"You are using a non-supported version of crane. Please update to the latest crane version to continue.",INCORRECT_DISTRIBUTION_FOLDER:e=>`Distribution folder [${e}] is not found or has incorrect structure, please execute the build command first.`},hu={catalog:"products",category:"category",product:"product"},pu=e=>hu[e],du=e=>e in hu;function Lx(e){return e.replace(/\\/g,"/")}function kx(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function Hi(e){return kx(Lx(e))}function Dx(e){const s=Hi(e).split("/");if(s.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[i,a]=s;if(!du(i))throw new Error(`Layout cannot be placed in a non-storefront section: ${i}`);const c=pu(i);return{id:a,sectionId:i,pageId:c}}async function Rx(e){return Promise.all(e.map(async s=>{const i=s.sectionId,a=pu(i),c=await Fs(s.translationsSettings),u=await Pn(s.content??{},c),h=await wn(s.design??{},c),f=await uu(s.layouts);return{id:s.id,sectionId:i,pageId:a,contentEditors:u,designEditors:h,layouts:f}}))}function ds(e,s,...i){if(!e||!s)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${s}"`);return`${ze}/${e}/${s}/${i.join("/")}`}const Bs=(e=ft.SECTION)=>we[e].dist,Us={[se.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/server/`},[se.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/client/`},[se.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/client/chunks/`,fileName:"*"},[se.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/client/assets/`},[se.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/assets/`},[se.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${Tt}/assets/`},[se.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[se.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[se.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:s})=>ds(e,s,"")},[se.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s})=>ds(e,s,"assets/")},[se.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/server/")},[se.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/client/")},[se.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/client/chunks/")},[se.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/client/assets/")},[se.CollectionAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${$s}/assets/`}};function Mx(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Cn(){const e=G(ei.cwd(),"package.json"),s=await Ar(e),i=JSON.parse(s.toString());if(Mx(i))return i;throw new Error(`Package file located at path: ${e} does not contain a version field`)}const $x={layout:e=>e.layoutId,showcase:e=>e.showcaseId,templates:e=>{const s=e.id;return s?.includes("_")?s.substring(s.indexOf("_")+1):s}};function Fx(e,s){const i=$x[e];return i?i(s):s.id}const Bx=new Set(["content","design"]);function Zi(e,s,i=0,a=[]){if(i>=s.length)return a;const c=s[i],u=s[i+1];if(typeof c=="string"&&typeof u=="number"&&Vt(e)){const h=e[c],f=Array.isArray(h)?h[u]:void 0;if(Vt(f)){const y=Fx(c,f);return a.push(`${c}[${y||u}]`),Zi(f,s,i+2,a)}}if(typeof c=="string"&&typeof u=="string"&&Bx.has(c)){a.push(`${c}[${u}]`);const h=Vt(e)&&!Array.isArray(e)?e[c]:void 0,f=Vt(h)&&!Array.isArray(h)?h[u]:void 0;return Zi(f,s,i+2,a)}return a.push(c),Zi(Vt(e)?e[c]:void 0,s,i+1,a)}function Ux(e){const s=e.errors.map(a=>Zi(e.manifest,a.path).join(".")),i={path:Math.max(...s.map(a=>a.length),0),message:Math.max(...e.errors.map(a=>a.message.length),0)};e.errors.map((a,c)=>{const u=a.params?.errorMessageKey||"GENERAL_ISSUE";return`${s[c].padEnd(i.path," ")} | ${a.message.padEnd(i.message," ")} | ${u}`}).forEach(a=>_.error(a))}async function jx(e){const s=vb.safeParse(e);return{manifest:e,errors:s.success?[]:s.error.issues}}const zx=`Build successful:
|
|
66
|
+
`:" ";return`${s}${c}${a}`}function xn(e,s){return Object.keys(e).reduce((i,a)=>{const c=e[a],u=s[a];return Ht(c)&&Ht(u)?i[a]=xn(c,u):i[a]=c,i},{...s})}function cI({contentSettings:e,sectionType:s}){const i=ul(s);return xn(e,i)}function lI({designSettings:e,sectionType:s}){const i=hl(s);return xn(e,i)}async function qe(e){return(await import(Ja(e).href+`?t=${Date.now()}`)).default}function An(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function rt(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const s=Np(e);return{type:"STRUCTURED_COLOR",raw:e,hex:s.toHex8String(),hsl:s.toHsl(),rgba:s.toRgb(),auto:!1}}function uu(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}function uI(e){if(e!==void 0)return{...e,color:rt(e.color)}}function Wt(e){return Object.fromEntries(Object.entries(e).filter(([s,i])=>i!==void 0))}function hI(e){if(e!==void 0)switch(e){case Vr.COLOR:return"solid";case Vr.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Vr)}`)}}function pI({style:e,color:s}){const i=Array.isArray(s)?s:[s,s];return{background:{type:hI(e),solid:{color:rt(i.at(0))},gradient:{fromColor:rt(i.at(0)),toColor:rt(i.at(1))}}}}function dI(e){if(e!==void 0)switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(vg)}`)}}function fI(e){if(e!==void 0)switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(Og)}`)}}function mI(e){if(e!==void 0)switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(Dg)}`)}}function yI(e){return e===mi.GO_TO_STORE?mi.GO_TO_STORE_LINK:e===mi.GO_TO_CATEGORY?mi.GO_TO_CATEGORY_LINK:e}function gI(e){const s=dI(e.appearance),i=fI(e.size),a=mI(e.shape),c=An(e.font),u=rt(e.color),h=e.visible;return Wt({appearance:s,size:i,style:a,font:c,color:u,visible:h})}function EI(e){return{...e,buttonType:yI(e.buttonType)}}function TI(e){const s=rt(e.color);return Wt({color:s})}function SI(e){if(e!==void 0)switch(e){case yi.COLOR:return"solid";case yi.GRADIENT:return"gradient";case yi.NONE:return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(yi)}`)}}function bI(e){const s=e.color,i=Array.isArray(s)?s:[s,s],a=e.visible,c={type:SI(e.overlay),solid:{color:rt(i.at(0))},gradient:{fromColor:rt(i.at(0)),toColor:rt(i.at(1))}};return Wt({overlay:c,visible:a})}function II(e){const s=An(e.font),i=rt(e.color),a=uu(e.size),c=e.bold,u=e.italic,h=e.spacing,f=e.capitalization,y=e.visible;return Wt({font:s,color:i,size:a,frame:uI(e.frame),bold:c,italic:u,spacing:h,capitalization:f,visible:y})}function xI(e){const s=e.value;return Wt({value:s})}function AI(e){const s=An(e.font),i=rt(e.color),a=uu(e.size),c=e.bold,u=e.italic,h=e.visible;return Wt({font:s,color:i,size:a,bold:c,italic:u,visible:h})}function PI(e){const s=e.enabled;return Wt({enabled:s})}function wI(e){return e===ii.GO_TO_STORE_LINK?ii.GO_TO_STORE:e===ii.GO_TO_CATEGORY_LINK?ii.GO_TO_CATEGORY:e}function hu(e){return e.map(s=>s.type?{...s,type:wI(s.type)}:s)}function CI(e){return e.items?{...e,items:hu(e.items)}:e}function _I(e){return e.items?{...e,items:hu(e.items)}:e}function vI(e){if(!e.cards)return e;const s=e.cards.map(i=>{if(!i.settings)return i;const a={};return Object.keys(i.settings).forEach(c=>{const u=i.settings[c],h=u.type,f=Hi(h,{defaults:u});f&&u?a[c]={...u,...f}:a[c]=u}),{...i,settings:a}});return{...e,cards:s}}function Pn(e,s){if(s.defaults===void 0)return;let i={};switch(e){case He.TEXT:{i=AI(s.defaults);break}case He.BUTTON:{i=gI(s.defaults);break}case He.IMAGE:{i=bI(s.defaults);break}case He.BACKGROUND:{i=pI(s.defaults);break}case He.COLOR_PICKER:{i=TI(s.defaults);break}case He.LOGO:{i=II(s.defaults);break}case He.SELECTBOX:{i=xI(s.defaults);break}case He.TOGGLE:{i=PI(s.defaults);break}case He.DIVIDER:case He.INFO:break;case He.ACCORDION:return s.defaults;default:throw new Error(`Unknown design editor type: ${e}`)}return i}function pu(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===He.ACCORDION){const h=Object.fromEntries(Object.entries(a.items).map(([f,y])=>[f,{...y,editors:pu(y.editors)}]));s[i]={...a,items:h};return}const u=Pn(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}),s}function NI(e){return e===void 0?e:e.map(s=>{if(s.type!==void 0&&s.defaults!==void 0&&s.fieldName!==void 0){const i={...Pn(s.type,s)??s.defaults,type:s.defaults.type??s.type};return{type:s.type,fieldName:s.fieldName,defaults:i}}return s})}function wn(e){if(e===void 0)return;const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===He.ACCORDION){const h=Object.fromEntries(Object.entries(a.items).map(([f,y])=>[f,{...y,editors:wn(y.editors)??y.editors}]));s[i]={type:a.type,items:h};return}const u=Pn(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function Hi(e,s){if(s.defaults!==void 0)switch(e){case F.BUTTON:return EI(s.defaults);case F.MENU:return CI(s.defaults);case F.NAVIGATION_MENU:return _I(s.defaults);case F.DECK:return vI(s.defaults);case F.CATEGORY_SELECTOR:case F.DIVIDER:case F.IMAGE:case F.INPUTBOX:case F.INFO:case F.LOGO:case F.PRODUCT_SELECTOR:case F.SELECTBOX:case F.TEXTAREA:case F.TOGGLE:return{...s.defaults};default:throw new Error(`Unknown content editor type: ${e}`)}}function OI(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=du(a);else{const u=Hi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function du(e){const s=e.cards.defaultCardContent.settings,i=OI(s);return{...e,cards:{...e.cards,defaultCardContent:{...e.cards.defaultCardContent,settings:i}}}}function LI(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=du(a);else{const u=Hi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function DI(e){if(e===void 0)return;const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type,u=Hi(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function kI(e,s){if(!s)return;const i=e[s];return i===void 0?{en:s}:i}function RI(e){const s={};for(const i in e){const a=e[i];for(const c in a){const u=s[c],h=a[c];if(u===void 0){const f={};f[i]=h,s[c]=f}else u[i]=h}}return s}function MI(e){return e.every(s=>s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean")}function ps(e,s){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return MI(e)?e:e.map(c=>ps(c,s));const i=e,a={};for(const c in i){const u=i[c];typeof u=="string"&&u.startsWith("$")?a[c]=kI(s,u):typeof u=="object"&&u!==null?a[c]=ps(u,s):a[c]=u}return a}async function Us(e){return e?RI(e):{}}async function $I(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/settings/translations.mjs`);return await qe(i)}async function Zi(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/showcases/translations.mjs`);return await qe(i)}async function FI(e,s){const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/translations.mjs`);if(ke(i))return await qe(i)}async function Cn(e,s,i){const a=i?cI({contentSettings:e,sectionType:i}):e,c=LI(a);return ps(c,s)}async function BI(e,s=ot){try{const i=G(Ie.cwd(),`${s}/${e}/js/settings/content.mjs`),a=await qe(i);return os(a)}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function _n(e,s,i){const a=i?lI({designSettings:e,sectionType:i}):e,c=pu(a);return ps(c,s)}async function UI(e,s=ot){try{const i=G(Ie.cwd(),`${s}/${e}/js/settings/design.mjs`),a=await qe(i);return os(a)}catch(i){const a=i;throw new Error(`Design settings is invalid or undefined. Error ${a.stack}`)}}async function jI(e,s){return Promise.all(e.map(async i=>{const a=i.content?DI(i.content):void 0,c=i.design?wn(i.design):void 0,u={...i,content:a??i.content,design:c??i.design};return ps(u,s)}))}async function zI(e,s=ot){try{const i=await W("*.mjs",{cwd:G(Ie.cwd(),`${s}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(i.map(async a=>{const c=G(Ie.cwd(),`${s}/${e}/js/showcases/${a}`);return await qe(c)}))}catch(i){throw new Error(`Showcases is invalid or undefined. Error ${i}`)}}async function fu(e){return e?.map(s=>({...s,selectedDesignSettings:NI(s.selectedDesignSettings)??s.selectedDesignSettings}))??[]}async function VI(e,s=ot){try{const i=G(Ie.cwd(),`${s}/${e}/js/settings/layout.mjs`);return ke(i)?await qe(i):[]}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}function GI(e){let s={};const i=G(Ie.cwd(),`${cu}/shared/analytics.json`);if(!ke(i))return 0;try{const a=Ar(i,"utf-8");s=JSON.parse(a)}catch(a){console.warn("Error processing analytics.json file",a)}return s[e]||0}const ds={Server:0,Client:1,SectionAsset:4,PageTemplateDescriptor:6,TemplateAsset:7,SharedTranslation:13},vn="https://blockbuster.ecwid.com",HI="/api/v1/custom-apps/resources/sections/upload",ZI="/api/v1/custom-apps/resources/templates/upload",WI="/api/v1/custom-apps/manifests/sections",KI="/api/v1/custom-apps/manifests/templates",qI=5,YI=3,XI=[se.Server,se.Client,se.ClientChunks,se.ClientAsset,se.Asset],JI=[se.LayoutClient,se.LayoutAsset],QI=[se.SlotServer,se.SlotClient,se.SlotClientChunks,se.SlotClientAsset],ex=[se.Dependency,se.TemplateAsset,se.SourceCode,se.CollectionAsset],fs={DEFAULT:"Error while deploying:",ASSET_FILES_UPLOAD:"Error while uploading asset files:",MANIFEST_DEPLOYMENT:"Error while deploying manifest file:",DEPRECATED_VERSION_DEPLOYMENT:"You are using a non-supported version of crane. Please update to the latest crane version to continue.",INCORRECT_DISTRIBUTION_FOLDER:e=>`Distribution folder [${e}] is not found or has incorrect structure, please execute the build command first.`},mu={catalog:"products",category:"category",product:"product"},yu=e=>mu[e],gu=e=>e in mu;function tx(e){return e.replace(/\\/g,"/")}function sx(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function Wi(e){return sx(tx(e))}function ix(e){const s=Wi(e).split("/");if(s.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[i,a]=s;if(!gu(i))throw new Error(`Layout cannot be placed in a non-storefront section: ${i}`);const c=yu(i);return{id:a,sectionId:i,pageId:c}}async function rx(e){return Promise.all(e.map(async s=>{const i=s.sectionId,a=yu(i),c=await Us(s.translationsSettings),u=await Cn(s.content??{},c),h=await _n(s.design??{},c),f=await fu(s.layouts);return{id:s.id,sectionId:i,pageId:a,contentEditors:u,designEditors:h,layouts:f}}))}function ms(e,s,...i){if(!e||!s)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${s}"`);return`${ze}/${e}/${s}/${i.join("/")}`}const js=(e=ft.SECTION)=>Pe[e].dist,zs={[se.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:s})=>`${js(s)}/${e}/js/main/server/`},[se.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${js(s)}/${e}/js/main/client/`},[se.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${js(s)}/${e}/js/main/client/chunks/`,fileName:"*"},[se.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${js(s)}/${e}/js/main/client/assets/`},[se.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${js(s)}/${e}/assets/`},[se.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${Tt}/assets/`},[se.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[se.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[se.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:s})=>ms(e,s,"")},[se.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s})=>ms(e,s,"assets/")},[se.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:s,slotId:i})=>ms(e,s,"slots",i,"js/main/server/")},[se.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ms(e,s,"slots",i,"js/main/client/")},[se.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ms(e,s,"slots",i,"js/main/client/chunks/")},[se.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ms(e,s,"slots",i,"js/main/client/assets/")},[se.CollectionAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${Bs}/assets/`}};function nx(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Nn(){const e=G(si.cwd(),"package.json"),s=await _r(e),i=JSON.parse(s.toString());if(nx(i))return i;throw new Error(`Package file located at path: ${e} does not contain a version field`)}const ax={layout:e=>e.layoutId,showcase:e=>e.showcaseId,templates:e=>{const s=e.id;return s?.includes("_")?s.substring(s.indexOf("_")+1):s}};function ox(e,s){const i=ax[e];return i?i(s):s.id}const cx=new Set(["content","design"]);function Ki(e,s,i=0,a=[]){if(i>=s.length)return a;const c=s[i],u=s[i+1];if(typeof c=="string"&&typeof u=="number"&&Ht(e)){const h=e[c],f=Array.isArray(h)?h[u]:void 0;if(Ht(f)){const y=ox(c,f);return a.push(`${c}[${y||u}]`),Ki(f,s,i+2,a)}}if(typeof c=="string"&&typeof u=="string"&&cx.has(c)){a.push(`${c}[${u}]`);const h=Ht(e)&&!Array.isArray(e)?e[c]:void 0,f=Ht(h)&&!Array.isArray(h)?h[u]:void 0;return Ki(f,s,i+2,a)}return a.push(c),Ki(Ht(e)?e[c]:void 0,s,i+1,a)}function lx(e){const s=e.errors.map(a=>Ki(e.manifest,a.path).join(".")),i={path:Math.max(...s.map(a=>a.length),0),message:Math.max(...e.errors.map(a=>a.message.length),0)};e.errors.map((a,c)=>{const u=a.params?.errorMessageKey||"GENERAL_ISSUE";return`${s[c].padEnd(i.path," ")} | ${a.message.padEnd(i.message," ")} | ${u}`}).forEach(a=>N.error(a))}async function ux(e){const s=Xb.safeParse(e);return{manifest:e,errors:s.success?[]:s.error.issues}}const hx=`Build successful:
|
|
67
67
|
For preview run: npx @lightspeed/crane@latest preview
|
|
68
|
-
For deploy run: npx @lightspeed/crane@latest deploy`;function
|
|
69
|
-
`),i=s.filter(u=>/^\t+/.test(u)),a=s.filter(u=>/^ {2,}/.test(u));if(i.length===0&&a.length===0)return null;if(i.length>=a.length)return" ";const c=a.reduce((u,h)=>{const f=/^ +/.exec(h)[0].length;return Math.min(f,u)},1/0);return new Array(c+1).join(" ")}function
|
|
70
|
-
`),i=[];for(let a=0,c=0;a<s.length;a++)i.push(c),c+=s[a].length+1;return function(c){let u=0,h=i.length;for(;u<h;){const T=u+h>>1;c<i[T]?h=T:u=T+1}const f=u-1,y=c-i[f];return{line:f,column:y}}}const
|
|
68
|
+
For deploy run: npx @lightspeed/crane@latest deploy`;function px(e,s){if(e.errors.length===0){N.info(hx);return}N.error("Invalid configuration detected:"),lx(e),s||process.exit(1)}const Eu={"process.env":{NODE_ENV:"production"}},dx=[...eo,...eo.map(e=>`node:${e}`)],fx=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],Tu=e=>({pluginType:Ge.Server,define:Eu,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...dx,...fx],inlineDynamicImports:!0,...e,outDir:e.outDir}),Su=e=>({pluginType:Ge.Client,define:Eu,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),ys=e=>({pluginType:Ge.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),mx=e=>({pluginType:Ge.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),qi=e=>({pluginType:Ge.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir});let Yi=!1;function yx(e){Yi=e}function On(){return Yi}const bu=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],gx=80,Ex="\x1B[?25l",Tx="\x1B[?25h",Sx="\x1B[2K\r",bx=44;let Ix=class{frameIndex=0;timer=null;realWrite=null;buffer=[];start(){Yi||(this.frameIndex=0,this.buffer=[],this.realWrite=process.stdout.write.bind(process.stdout),process.stdout.write=((s,i,a)=>(this.buffer.push(typeof s=="string"?s:String(s)),typeof i=="function"&&(a=i),a&&a(),!0)),this.realWrite(Ex),this.render(),this.timer=setInterval(()=>this.render(),gx))}render(){if(!this.realWrite)return;const s=" Build is in progress...".padEnd(bx-1," "),i=et(bu[this.frameIndex]+s);this.realWrite(`\r${i}`),this.frameIndex=(this.frameIndex+1)%bu.length}stop(){if(!Yi&&(this.timer&&(clearInterval(this.timer),this.timer=null),this.realWrite)){process.stdout.write=this.realWrite,this.realWrite(`${Sx}${Tx}`);for(const s of this.buffer)this.realWrite(s);this.buffer=[],this.realWrite=null}}};const Iu=new Ix,xx=()=>Op({ext:".gz",algorithm:"gzip",verbose:On()}),Ax="/* EXTERNAL_IMPORTS_START */",Px="/* EXTERNAL_IMPORTS_END */",wx=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,s){for(const i of Object.keys(s)){const a=s[i];if(a.type==="chunk"){const c=/import.*\?commonjs-external["'];/g,u=a.code.match(c);if(u!==null){const h=u.join(""),f=Ax+h+Px,y=a.code.replace(c,"");a.code=f+y}}}}}),Cx=()=>({name:"disable-json-plugin",enforce:"pre",apply:"build",configResolved(e){const s=e.plugins?.findIndex(i=>i?.name==="vite:json");s!==-1&&(e.plugins[s]={name:"vite:json",load:()=>null,transform:()=>null})}}),_x=()=>{const e=process.env.npm_lifecycle_event;return kp({typescript:!1,vueTsc:!1,eslint:e?.startsWith("test")?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},nt={vue:()=>Lp(),tsconfigPaths:()=>Dp(),checker:()=>_x()};class sr{constructor(s){this.bits=s instanceof sr?s.bits.slice():[]}add(s){this.bits[s>>5]|=1<<(s&31)}has(s){return!!(this.bits[s>>5]&1<<(s&31))}}class Gs{constructor(s,i,a){this.start=s,this.end=i,this.original=a,this.intro="",this.outro="",this.content=a,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(s){this.outro+=s}appendRight(s){this.intro=this.intro+s}clone(){const s=new Gs(this.start,this.end,this.original);return s.intro=this.intro,s.outro=this.outro,s.content=this.content,s.storeName=this.storeName,s.edited=this.edited,s}contains(s){return this.start<s&&s<this.end}eachNext(s){let i=this;for(;i;)s(i),i=i.next}eachPrevious(s){let i=this;for(;i;)s(i),i=i.previous}edit(s,i,a){return this.content=s,a||(this.intro="",this.outro=""),this.storeName=i,this.edited=!0,this}prependLeft(s){this.outro=s+this.outro}prependRight(s){this.intro=s+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(s){const i=s-this.start,a=this.original.slice(0,i),c=this.original.slice(i);this.original=a;const u=new Gs(s,this.end,c);return u.outro=this.outro,this.outro="",this.end=s,this.edited?(u.edit("",!1),this.content=""):this.content=a,u.next=this.next,u.next&&(u.next.previous=u),u.previous=this,this.next=u,u}toString(){return this.intro+this.content+this.outro}trimEnd(s){if(this.outro=this.outro.replace(s,""),this.outro.length)return!0;const i=this.content.replace(s,"");if(i.length)return i!==this.content&&(this.split(this.start+i.length).edit("",void 0,!0),this.edited&&this.edit(i,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(s,""),this.intro.length)return!0}trimStart(s){if(this.intro=this.intro.replace(s,""),this.intro.length)return!0;const i=this.content.replace(s,"");if(i.length){if(i!==this.content){const a=this.split(this.end-i.length);this.edited&&a.edit(i,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(s,""),this.outro.length)return!0}}function vx(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?e=>globalThis.btoa(unescape(encodeURIComponent(e))):typeof Buffer=="function"?e=>Buffer.from(e,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}const Nx=vx();class Ox{constructor(s){this.version=3,this.file=s.file,this.sources=s.sources,this.sourcesContent=s.sourcesContent,this.names=s.names,this.mappings=Rp(s.mappings),typeof s.x_google_ignoreList<"u"&&(this.x_google_ignoreList=s.x_google_ignoreList)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+Nx(this.toString())}}function Lx(e){const s=e.split(`
|
|
69
|
+
`),i=s.filter(u=>/^\t+/.test(u)),a=s.filter(u=>/^ {2,}/.test(u));if(i.length===0&&a.length===0)return null;if(i.length>=a.length)return" ";const c=a.reduce((u,h)=>{const f=/^ +/.exec(h)[0].length;return Math.min(f,u)},1/0);return new Array(c+1).join(" ")}function Dx(e,s){const i=e.split(/[/\\]/),a=s.split(/[/\\]/);for(i.pop();i[0]===a[0];)i.shift(),a.shift();if(i.length){let c=i.length;for(;c--;)i[c]=".."}return i.concat(a).join("/")}const kx=Object.prototype.toString;function Rx(e){return kx.call(e)==="[object Object]"}function xu(e){const s=e.split(`
|
|
70
|
+
`),i=[];for(let a=0,c=0;a<s.length;a++)i.push(c),c+=s[a].length+1;return function(c){let u=0,h=i.length;for(;u<h;){const T=u+h>>1;c<i[T]?h=T:u=T+1}const f=u-1,y=c-i[f];return{line:f,column:y}}}const Mx=/\w/;class $x{constructor(s){this.hires=s,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(s,i,a,c){if(i.length){const u=i.length-1;let h=i.indexOf(`
|
|
71
71
|
`,0),f=-1;for(;h>=0&&u>h;){const T=[this.generatedCodeColumn,s,a.line,a.column];c>=0&&T.push(c),this.rawSegments.push(T),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,f=h,h=i.indexOf(`
|
|
72
|
-
`,h+1)}const y=[this.generatedCodeColumn,s,a.line,a.column];c>=0&&y.push(c),this.rawSegments.push(y),this.advance(i.slice(f+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(i));this.pending=null}addUneditedChunk(s,i,a,c,u){let h=i.start,f=!0,y=!1;for(;h<i.end;){if(this.hires||f||u.has(h)){const T=[this.generatedCodeColumn,s,c.line,c.column];this.hires==="boundary"?
|
|
72
|
+
`,h+1)}const y=[this.generatedCodeColumn,s,a.line,a.column];c>=0&&y.push(c),this.rawSegments.push(y),this.advance(i.slice(f+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(i));this.pending=null}addUneditedChunk(s,i,a,c,u){let h=i.start,f=!0,y=!1;for(;h<i.end;){if(this.hires||f||u.has(h)){const T=[this.generatedCodeColumn,s,c.line,c.column];this.hires==="boundary"?Mx.test(a[h])?y||(this.rawSegments.push(T),y=!0):(this.rawSegments.push(T),y=!1):this.rawSegments.push(T)}a[h]===`
|
|
73
73
|
`?(c.line+=1,c.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,f=!0):(c.column+=1,this.generatedCodeColumn+=1,f=!1),h+=1}this.pending=null}advance(s){if(!s)return;const i=s.split(`
|
|
74
|
-
`);if(i.length>1){for(let a=0;a<i.length-1;a++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=i[i.length-1].length}}const
|
|
75
|
-
`,
|
|
76
|
-
`));else for(f=y.start;f<T;){if(!c[f]){const
|
|
77
|
-
`?u=!0:
|
|
78
|
-
${
|
|
79
|
-
`,yI=(e,s)=>{const i=e.split("?")[0],a=yp(i);return(a==="server.ts"||a==="client.ts")&&!s.includes(bu)},xu=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=De(Su)},transform(s,i){if(!e||!yI(i,s))return null;const a=i.split("?")[0],c=Ga(a),u=bp(Ha(c,Su)),h=mI(u),f=new Fn(s);return f.prepend(h),{code:f.toString()}}}},Iu={[Ge.Server]:()=>[rt.vue(),rt.tsconfigPaths(),iI(),eI(),xu()],[Ge.Client]:()=>[rt.vue(),rt.tsconfigPaths(),Xa({vue:"EcVue"}),xu()],[Ge.Misc]:()=>[rt.tsconfigPaths()],[Ge.Layout]:()=>[rt.vue(),rt.tsconfigPaths(),Xa({vue:["EcExternals","Vue"]})],[Ge.Asset]:()=>[rI()],[Ge.SharedFiles]:()=>[rt.tsconfigPaths()]},Pu={[he.Server]:mu({outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/main/server`}),[he.Client]:yu({outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/main/client`}),[he.SectionSetting]:fs({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/settings`}),[he.SectionShowcase]:fs({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/showcases`}),[he.SectionAsset]:Wi({outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/assets`}),[he.TemplateDescriptor]:fs({entryFileNames:"[name].mjs",outDir:()=>`./${Tt}/js`}),[he.PageTemplateDescriptor]:fs({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${Tt}/${e}`}),[he.TemplateAsset]:Wi({outDir:()=>`./${Tt}/assets`}),[he.Layout]:Zx({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}`}),[he.LayoutSettings]:fs({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/js/settings`}),[he.LayoutAsset]:Wi({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/assets`}),[he.SlotServer]:mu({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/server`}),[he.SlotClient]:yu({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/client`}),[he.CollectionDescriptor]:fs({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${$s}/${e}`}),[he.CollectionAsset]:Wi({outDir:()=>`./${$s}/assets`}),[he.SharedTranslation]:{pluginType:Ge.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function gI(e){switch(typeof e){case"string":return[G(process.cwd(),e)];case"object":return e.map(s=>G(process.cwd(),s));default:return[]}}function wu({name:e,entryPoints:s,configType:i,layoutId:a,sectionId:c,sectionType:u=ft.SECTION}){const h=Pu[i],f=h.define,y=h.ssrOptions,T=h.entryFileNames,x=h.chunkFileNames,P=h.assetFileNames,L=h.inlineDynamicImports,R=h.externalOption;return{logLevel:vn()?void 0:"silent",plugins:Iu[h.pluginType](),ssr:y,define:f,resolve:{alias:{"@":"/src"}},build:{ssr:h.ssr,outDir:h.outDir({name:e,sectionType:u,layoutId:a,sectionId:c}),emptyOutDir:!0,minify:h.ssr?"terser":"esbuild",...h.ssr&&{terserOptions:{mangle:{reserved:["gc"]}}},rollupOptions:{external:R,preserveEntrySignatures:"strict",input:gI(s),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:L,entryFileNames:T,chunkFileNames:x,assetFileNames:P}}},assetsInclude:["**/*.json"]}}const EI=Object.values(we).map(e=>e.source).join("|");function Au(e,s,i){if(!e)return`${s}.mjs`;const a=Ha(process.cwd(),e).replace(/\\/g,"/").match(`^(${EI})/([^/]+)/${i}/([^/.]+)`);return a?`${a[1]}/${a[2]}/js/${i}/${a[3]}.mjs`:`${s}.mjs`}function Cu(e,s){const i=Pu[he.SectionSetting];return{logLevel:vn()?void 0:"silent",plugins:Iu[i.pluginType](),define:i.define,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:i.ssr,outDir:"./dist",emptyOutDir:!1,minify:"esbuild",rollupOptions:{external:i.externalOption,preserveEntrySignatures:"strict",input:e.map(a=>G(process.cwd(),a)),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:i.inlineDynamicImports,entryFileNames:s,chunkFileNames:"chunks/[name]-[hash].js",assetFileNames:i.assetFileNames}}},assetsInclude:["**/*.json"]}}function TI(e){return Cu(e,s=>Au(s.facadeModuleId??void 0,s.name,"settings"))}function SI(e){return Cu(e,s=>Au(s.facadeModuleId??void 0,s.name,"showcases"))}async function bI(){const e={ignore:["node_modules/**","dist/**"]},s=await W(`./${ls}/{product,category,catalog}/*/client.{js,ts}`,e);return await Promise.all(s.map(async i=>{const{id:a,sectionId:c,pageId:u}=Dx(i),[h,f]=await Promise.all([W(`./${ls}/${c}/${a}/settings/{content,design,translations,layout}.{js,ts}`,e),W(`./${ls}/${c}/${a}/assets/*`,e)]);return{name:a,sectionId:c,pageId:u,clientEntrypoint:i,settingsEntryPoints:h,assetsEntrypoints:f}}))}async function xI(e){await Ye({entryPoints:[e.clientEntrypoint],configType:he.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([Ye({entryPoints:e.settingsEntryPoints,configType:he.LayoutSettings,name:e.name,sectionId:e.sectionId}),Ye({entryPoints:e.assetsEntrypoints,configType:he.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function II(e){e===void 0||e.length===0||await Promise.all(e.map(s=>xI(s)))}async function PI(e){const s=e.flatMap(a=>a.settingsEntryPoints),i=e.flatMap(a=>a.showcaseEntryPoints);s.length>0&&await ht({configFile:!1,...Qs(TI(s))}),i.length>0&&await ht({configFile:!1,...Qs(SI(i))})}async function wI(e){await Promise.all([ht({configFile:!1,...Qs(wu({name:e.name,entryPoints:e.serverEntrypoint,configType:hs.Server,sectionType:e.type}))}),Ye({entryPoints:e.clientEntrypoint,configType:hs.Client,name:e.name,sectionType:e.type}),Ye({entryPoints:e.assetEntryPoints,configType:hs.SectionAsset,name:e.name,sectionType:e.type})])}async function AI(){const e=G(process.cwd(),"shared/translation.ts");De(e)&&await Ye({entryPoints:["shared/translation.ts"],configType:hs.SharedTranslation})}async function vu(e){await Promise.all([PI(e),...e.map(wI)])}function CI(e){const s=Hi(e).split("/");if(s.length<4||s[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[i,a,,c]=s;if(!du(i))throw new Error(`Slot cannot be placed in a non-storefront section: ${i}`);return{id:c,sectionId:i,layoutId:a}}async function vI(e,s){return Promise.all(e.map(async i=>{const a=s.find(f=>f.id===i.layoutId&&f.sectionId===i.sectionId),c=await Fs(a?.translationsSettings),u=await Pn(a?.content??{},c),h=await wn(a?.design??{},c);return{id:i.id,sectionId:i.sectionId,layoutId:i.layoutId,contentEditors:u,designEditors:h}}))}async function NI(){const e={ignore:["node_modules/**","dist/**"]},s=await W(`${ls}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(s.map(async i=>{const{id:a,sectionId:c,layoutId:u}=CI(i),h=(await W(`${ls}/${c}/${u}/slots/${a}/client.{js,ts}`,e))[0];if(h===void 0)throw new Error(`Cannot find client entrypoint file for slot ${a} of section ${c}`);return{id:a,sectionId:c,layoutId:u,serverEntrypoint:i,clientEntrypoint:h}}))}async function _I(e){const s={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await Promise.all([Ye({entryPoints:[e.serverEntrypoint],configType:he.SlotServer,...s}),Ye({entryPoints:[e.clientEntrypoint],configType:he.SlotClient,...s})])}async function OI(e){e?.length&&await Promise.all(e.map(_I))}async function LI(e){return(await W(`**/${e}/pages/*.{js,ts}`,{ignore:["node_modules/**","dist/**"]})).filter(s=>{const i=Za(s).name.toLowerCase();return!Object.values(pc).includes(i)})}async function kI(){const e=await W("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(s=>(_.error(`Error while getting page template entry points: ${s}`),[]));return Promise.all(e.map(async s=>{const i=s.split(wr),a=i.pop()??"default";if(i.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const c=await W(`**/templates/${a}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await W(`**/templates/${a}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),h=await W(`**/templates/${a}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await W(`**/templates/${a}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await W(`**/templates/${a}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),T=await LI(a);return{name:a,configurationEntrypoint:c.at(0),homeEntrypoint:u.at(0),categoryEntrypoint:h.at(0),catalogEntrypoint:f.at(0),productEntrypoint:y.at(0),customEntrypoint:T.length>0?T:void 0}}))}async function DI(){const e=await W("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),s=await W("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await kI(),templates:e,assets:s}}async function RI({templateBuildConfig:e}){await Promise.all([Ye({entryPoints:e.assets,configType:hs.TemplateAsset}),...e.pageTemplates?.map(async s=>{const i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint,...s.customEntrypoint??[]].filter(ji);if(i.length===0)throw new Error("No entry points provided for page template");await Ye({entryPoints:i,configType:hs.PageTemplateDescriptor,name:s.name})})||[]])}async function MI(){const e=await DI();await RI({templateBuildConfig:e})}async function $I(){const e=await W("./collections/*",{ignore:["collections/assets/**","collections/**.{js,ts}","node_modules/**","dist/**"]}).catch(i=>(_.error(`Error while getting collection entry points: ${i}`),[])),s=await W("./collections/assets/*",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async i=>{const a=i.split(wr),c=a.pop()??"default";if(a.pop()===void 0)throw new Error("Cannot determine collection, outer directory is undefined");const u=await W(`**/collections/${c}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:c,configurationEntrypoint:u.at(0),assetsEntrypoints:s}}))}async function FI(){const e=await $I();e.length!==0&&await Promise.all(e.flatMap(s=>[Ye({entryPoints:s.assetsEntrypoints,configType:he.CollectionAsset,name:s.name}),Ye({entryPoints:s.configurationEntrypoint?[s.configurationEntrypoint]:[],configType:he.CollectionDescriptor,name:s.name})]))}function Nu(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(ji).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(ji),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(ji),assetEntryPoints:e.assetsEntrypoints??[]}}function _u(e){return e.map(s=>({...s,selectedDesignSettings:s.selectedDesignSettings.map(i=>{const a=i.defaults;return a&&typeof a=="object"&&!("type"in a)?{...i,defaults:{type:i.type,...a}}:i})}))}async function BI(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/main/server/server.js.gz`),a=Qa(eo.gunzip),c=await ee.promises.readFile(i);return{size:(await a(c)).length}}async function UI(e,s=ot){try{const i=G(process.cwd(),`${s}/${e}/assets/`);return(await W("*",{cwd:i})).map(a=>{const c=G(i,a);return{path:a,size:Ps(c).size}})}catch{throw new Error(`Asset files for section [${e}] is either invalid or undefined`)}}async function Nn(e,s){const i=await fx(e,we[s].dist),a=await Gi(e,we[s].dist),c=await yx(e,we[s].dist),u=await gx(e,we[s].dist),h=await Tx(e,we[s].dist),f=await Sx(e,we[s].dist),y=_u(f),T=await UI(e,we[s].dist),x=await BI(e,we[s].dist),P=bx(e);return{id:e,type:s,name:e,content:c,design:u,layout:y,showcase:h,translationsSettings:i,translationsShowcases:a,assets:T,server:x,previewCount:P}}async function jI(){const e=await W("*/",{cwd:G(process.cwd(),`${ot}/`)}),s=await W("*/",{cwd:G(process.cwd(),`${En}/`)}),i=await W("*/",{cwd:G(process.cwd(),`${Tn}/`)});return Promise.all([...e.map(async a=>Nn(a,$t.SECTION)),...s.map(async a=>Nn(a,$t.HEADER)),...i.map(async a=>Nn(a,$t.FOOTER))])}async function zI(e){try{const s=G(process.cwd(),`${e}/assets/`);return(await W("*",{cwd:s})).map(i=>{const a=G(s,i);return{path:i,size:Ps(a).size}})}catch{throw new Error("Asset files for layouts are either invalid or undefined")}}async function VI(e){const s=Hi(e).split("/");if(s.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[i,a]=s,[c,u,h,f,y,T]=await Promise.all([WI(a,i),KI(a,i),mx(a,i),zI(e),ZI(i,a),qI(a,i)]);return{id:a,sectionId:i,content:c,design:u,translationsSettings:h,assets:f,layouts:T,templateContent:y}}async function GI(){const e=`${ze}/{product,catalog,category}/*`,s=await W(e,{ignore:["node_modules/**"]});return Promise.all(s.map(VI))}function HI(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}async function ZI(e,s){const i=`layouts/${e}/${s}/Main.vue`;try{const a=G(process.cwd(),i);return await ee.promises.readFile(a,"utf-8")}catch(a){if(HI(a)){_.warn(`Custom storefront layout is missing: [${i}]. If you created this layout manually, check that the file is named Main.vue.`);return}throw a}}async function WI(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/content.mjs`),a=await qe(i);return ns(a)}catch(i){throw new Error(`Content descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function KI(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/design.mjs`),a=await qe(i);return ns(a)}catch(i){throw new Error(`Design descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function qI(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/layout.mjs`);if(!ee.existsSync(i))return[];const a=await qe(i);return _u(a)}catch(i){throw new Error(`Layout settings descriptor for layout [${e}] in section [${s}] is either invalid or undefined: ${i}`)}}async function YI(e,s,i){const a=G(process.cwd(),`${ze}/${i}/${s}/slots/${e}/js/main/server/server.js.gz`),c=Qa(eo.gunzip),u=await ee.promises.readFile(a);return{size:(await c(u)).length}}async function JI(e){const s=Hi(e).split("/");if(s.length<4||s[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[i,a,,c]=s,u=await YI(c,a,i);return{id:c,sectionId:i,layoutId:a,server:u}}async function XI(){const e=`${ze}/{product,catalog,category}/*/slots/*`,s=await W(e,{ignore:["node_modules/**"]});return await Promise.all(s.map(JI))}async function QI(){try{const e=G(process.cwd(),`${Tt}/assets/`);return(await W("*",{cwd:e})).map(s=>{const i=G(e,s);return{path:s,size:Ps(i).size}})}catch{throw new Error("Asset files for templates are either invalid or undefined")}}function eP(e){return e in Ft?Ft[e]:Ft.CUSTOM}async function tP(e){const s=await W(`${Tt}/${e}/*.mjs`,{ignore:[`${Tt}/${e}/configuration*.mjs`]});return Promise.all(s.map(async i=>{const{sections:a,metadata:c}=await _n(i),u=Rb(i);return{type:eP(u.toUpperCase()),id:u,metadata:c,sections:a}}))}async function _n(e){try{return await qe(G(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function sP(e){const s=await W(`${Tt}/**/configuration*.mjs`,{});return Promise.all(s.map(async i=>{const a=Te.basename(Te.dirname(i));return{id:`${e}_${a}`,assets:await QI(),configuration:await _n(i),pages:await tP(a)}}))}async function iP(e){return await sP(e)}async function rP(){const e=G(process.cwd(),`${_b}/translation.mjs`);return await qe(e)}async function nP(){return{translations:await rP()}}async function aP(e){const s=await W(`${$s}/*/configuration*.mjs`,{ignore:["node_modules/**",`${$s}/assets/**`]});return Promise.all(s.map(async i=>{const a=Te.basename(Te.dirname(i)),c=await _n(i);return{id:`${e}_${a}`,descriptor:c}}))}async function Ou(){const e=await zi(),[s,i,a,c,u,h,f]=await Promise.all([Cn(),nP(),jI(),GI(),XI(),iP(e.appClientId),aP(e.appClientId)]);return{version:s.version,name:"Custom Block App",shared:i,sections:a,templates:h,layouts:c,slots:u,collections:f,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:s.dependencies.vue,openSource:s.openSource}}function On(e){return De(`${En}/${e}`)?ft.HEADER:De(`${Tn}/${e}`)?ft.FOOTER:ft.SECTION}async function Ln(e,s){const i=e.design?In(e.design):void 0,a={...e,design:i??e.design},c=await Fs(s);return us(a,c)}function kn(e){return e.type==="custom"&&e.id!==void 0&&e.showcase_overrides!==void 0}async function Lu(e){if(kn(e)){const s=await Gi(e.id,we[On(e.id)].dist);return{...e,showcase_overrides:await Ln(e.showcase_overrides,s)}}return e}async function oP(e){const s=kn(e.header)?{...e.header,showcase_overrides:await Ln(e.header.showcase_overrides,await Gi(e.header.id,we[On(e.header.id)].dist))}:e.header,i=kn(e.footer)?{...e.footer,showcase_overrides:await Ln(e.footer.showcase_overrides,await Gi(e.footer.id,we[On(e.footer.id)].dist))}:e.footer;return{...e,header:s,footer:i}}async function cP(e){const s=await Promise.all(e.pages.map(async a=>({...a,sections:await Promise.all(a.sections.map(c=>Lu(c)))}))),i=await oP(e.configuration);return{id:e.id,descriptor:{...i,pages:s}}}async function lP(e){return Promise.all(e.map(s=>cP(s)))}async function uP(e){const s=new Map;return await Promise.all(e.map(async i=>{const[a,c]=await Promise.all([Fs(i.translationsSettings),Fs(i.translationsShowcases)]);s.set(i.id,{settings:a,showcases:c})})),s}async function hP(e,s,i){const[a,c,u,h]=await Promise.all([Pn(e.content,s,e.type),wn(e.design,s,e.type),Ex(e.showcase,i),uu(e.layout)]);return{id:e.id,type:e.type,name:{en:e.name},contentEditors:a,designEditors:c,layouts:h,showcases:u,previewCount:e.previewCount}}async function pP(e,s){return Promise.all(e.map(async i=>{const a=s.get(i.id)??{settings:{},showcases:{}};return hP(i,a.settings,a.showcases)}))}async function dP(e){return Promise.all(e.map(async s=>{const i=await Promise.all(s.descriptor.sections.map(a=>Lu(a)));return{...s,descriptor:{...s.descriptor,sections:i}}}))}async function ku(e){const s=await uP(e.sections),[i,a,c,u,h]=await Promise.all([pP(e.sections,s),Rx(e.layouts),vI(e.slots,e.layouts),lP(e.templates),dP(e.collections)]);return{version:e.version,name:e.name,blocks:i,templates:u,layouts:a,slots:c,compressionEnabled:e.compressionEnabled,externalizationEnabled:e.externalizationEnabled,vueVersion:e.vueVersion,collections:h,openSource:e.openSource}}async function fP(e){const s=G(ei.cwd(),nu);return Pp(s,JSON.stringify(e))}function mP(e){return Object.entries(we).find(s=>s[1].source===e)?.[0]}async function Du(){const e=await W("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**","collections/**"]});return Promise.all(e.map(async s=>{const i=Ga(s).split(wr),a=i.pop()??"default",c=i.pop();if(c===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const u=["node_modules/**","dist/**"],[h,f,y,T,x,P,L,R]=await Promise.all([W(`**/${a}/client.{js,ts}`,{ignore:u}),W(`**/${a}/settings/content.{js,ts}`,{ignore:u}),W(`**/${a}/settings/design.{js,ts}`,{ignore:u}),W(`**/${a}/settings/layout.{js,ts}`,{ignore:u}),W(`**/${a}/settings/translations.{js,ts}`,{ignore:u}),W(`**/${a}/showcases/*.{js,ts}`,{ignore:[...u,`**/${a}/showcases/translations.{js,ts}`]}),W(`**/${a}/showcases/translations.{js,ts}`,{ignore:u}),W(`**/${a}/assets/*`,{ignore:u})]);return{name:a,type:mP(c),serverEntrypoint:s,clientEntrypoint:h.at(0),contentSettingsEntrypoint:f.at(0),designSettingsEntrypoint:y.at(0),layoutSettingsEntrypoint:T.at(0),settingsTranslationsEntrypoint:x.at(0),showcasesEntrypoints:P,showcasesTranslationsEntrypoint:L.at(0),assetsEntrypoints:R}}))}const yP=["/settings/","/showcases/"];function gP(e){return yP.some(s=>e.includes(s))}function EP(){const e=tt.findConfigFile(process.cwd(),tt.sys.fileExists,"tsconfig.json");if(!e)return;const s=tt.readConfigFile(e,tt.sys.readFile),i=tt.parseJsonConfigFileContent(s.config,tt.sys,process.cwd()),a=tt.createProgram(i.fileNames,i.options),c=tt.getPreEmitDiagnostics(a).filter(u=>!u.file||!gP(u.file.fileName));if(c.length>0){const u={getCanonicalFileName:h=>h,getCurrentDirectory:tt.sys.getCurrentDirectory,getNewLine:()=>tt.sys.newLine};throw console.error(tt.formatDiagnosticsWithColorAndContext(c,u)),new Error(`TypeScript found ${c.length} error(s)`)}}async function TP(e){EP(),await ht({configFile:!1,logLevel:"error",plugins:[rt.vue(),rt.tsconfigPaths(),rt.checker()],build:{write:!1,rollupOptions:{input:G(process.cwd(),e)}}})}function SP(){return Promise.all([Ir.rm("dist",{recursive:!0,force:!0}),Ir.rm("source-code",{recursive:!0,force:!0}),Ir.rm("source-code.zip",{force:!0})])}async function bP(){const e=new Wa,s=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"];(await Cn()).openSource===!0&&s.splice(s.indexOf("**/assets/**/*"),1);const i=await W("**/*",{cwd:G(process.cwd()),ignore:s,dot:!0,nodir:!0});try{i.forEach(u=>{const h=G(process.cwd(),u);e.addLocalFile(h,Za(u).dir)});const a=Us[se.SourceCode].fileName,c=G(process.cwd(),a);await e.writeZipPromise(c)}catch(a){throw _.error("Error while zipping source files"),a}}async function qi(e=!1,s=!1){Wx(s),Eu.start(),await SP();try{const[i,a,c]=await Promise.all([bI(),Du(),NI()]),u=a.map(Nu);a.length>0&&await TP(a[0].serverEntrypoint);try{await Promise.all([AI(),vu(u),MI(),FI(),II(i),OI(c),bP()])}finally{Eu.stop()}const h=await Ou(),f=await jx(h);Vx(f,e);const y=await ku(h);await fP(y)}catch(i){_.error(`Error while building: ${i.message}`),e||process.exit(1)}}async function Ye({entryPoints:e,configType:s,name:i,sectionType:a,sectionId:c,layoutId:u}){if(e.length!==0){const h=Qs(wu({name:i,entryPoints:e,configType:s,sectionType:a,sectionId:c,layoutId:u}));await ht({configFile:!1,...h})}}function Ru(e,s,i){Js.statSync(e).isDirectory()?(Js.mkdirSync(s,{recursive:!0}),Js.readdirSync(e).forEach(a=>{const c=Xs.resolve(e,a),u=Xs.resolve(s,a);Ru(c,u,i)})):Lp.isMatch(e,i,{dot:!0})||Js.copyFileSync(e,s)}function St(e,s,i,a,c=[]){const u=Xs.join(e,a?.[i]??i);Ru(Xs.join(s,i),u,c)}function xP(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>_.info(`Template [${e}] with pages structure named has been created`)}}function ct(e){return Re.resolve(kp(import.meta.url),"../..",e)}function IP(){const e=ct("package.json");return e!==""?JSON.parse(me.readFileSync(e,"utf8")):{}}async function PP(e){try{const s=e,i=Se.cwd(),a=Re.join(i,s),c=["templates","headers","preview","footers","reference","page-templates","layouts","collections","blank"],u={_gitignore:".gitignore"};me.existsSync(a)?(_.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),Se.exit(1)):me.mkdirSync(a);const h=ct("template");me.readdirSync(h).filter(x=>x!=="package.json").filter(x=>!c.includes(x)).forEach(async x=>St(a,h,x,u));const f=JSON.parse(me.readFileSync(Re.join(h,"package.json"),"utf-8"));f.name=e;const y=IP();y.version&&(f.dependencies["@lightspeed/crane-api"]=y.dependencies["@lightspeed/crane-api"]),y.dependencies["@lightspeed/eslint-config-crane"]&&(f.dependencies["@lightspeed/eslint-config-crane"]=y.dependencies["@lightspeed/eslint-config-crane"]);const T=Re.join(a,"package.json");me.writeFileSync(T,`${JSON.stringify(f,null,2)}
|
|
80
|
-
`),
|
|
81
|
-
`)}function
|
|
74
|
+
`);if(i.length>1){for(let a=0;a<i.length-1;a++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=i[i.length-1].length}}const Vs=`
|
|
75
|
+
`,gs={insertLeft:!1,insertRight:!1,storeName:!1};class jn{constructor(s,i={}){const a=new Gs(0,s.length,s);Object.defineProperties(this,{original:{writable:!0,value:s},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:a},lastChunk:{writable:!0,value:a},lastSearchedChunk:{writable:!0,value:a},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:i.filename},indentExclusionRanges:{writable:!0,value:i.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new sr},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:i.ignoreList}}),this.byStart[0]=a,this.byEnd[s.length]=a}addSourcemapLocation(s){this.sourcemapLocations.add(s)}append(s){if(typeof s!="string")throw new TypeError("outro content must be a string");return this.outro+=s,this}appendLeft(s,i){if(typeof i!="string")throw new TypeError("inserted content must be a string");this._split(s);const a=this.byEnd[s];return a?a.appendLeft(i):this.intro+=i,this}appendRight(s,i){if(typeof i!="string")throw new TypeError("inserted content must be a string");this._split(s);const a=this.byStart[s];return a?a.appendRight(i):this.outro+=i,this}clone(){const s=new jn(this.original,{filename:this.filename});let i=this.firstChunk,a=s.firstChunk=s.lastSearchedChunk=i.clone();for(;i;){s.byStart[a.start]=a,s.byEnd[a.end]=a;const c=i.next,u=c&&c.clone();u&&(a.next=u,u.previous=a,a=u),i=c}return s.lastChunk=a,this.indentExclusionRanges&&(s.indentExclusionRanges=this.indentExclusionRanges.slice()),s.sourcemapLocations=new sr(this.sourcemapLocations),s.intro=this.intro,s.outro=this.outro,s}generateDecodedMap(s){s=s||{};const i=0,a=Object.keys(this.storedNames),c=new $x(s.hires),u=xu(this.original);return this.intro&&c.advance(this.intro),this.firstChunk.eachNext(h=>{const f=u(h.start);h.intro.length&&c.advance(h.intro),h.edited?c.addEdit(i,h.content,f,h.storeName?a.indexOf(h.original):-1):c.addUneditedChunk(i,h,this.original,f,this.sourcemapLocations),h.outro.length&&c.advance(h.outro)}),{file:s.file?s.file.split(/[/\\]/).pop():void 0,sources:[s.source?Dx(s.file||"",s.source):s.file||""],sourcesContent:s.includeContent?[this.original]:void 0,names:a,mappings:c.raw,x_google_ignoreList:this.ignoreList?[i]:void 0}}generateMap(s){return new Ox(this.generateDecodedMap(s))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=Lx(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(s,i){const a=/^[^\r\n]/gm;if(Rx(s)&&(i=s,s=void 0),s===void 0&&(this._ensureindentStr(),s=this.indentStr||" "),s==="")return this;i=i||{};const c={};i.exclude&&(typeof i.exclude[0]=="number"?[i.exclude]:i.exclude).forEach(I=>{for(let A=I[0];A<I[1];A+=1)c[A]=!0});let u=i.indentStart!==!1;const h=T=>u?`${s}${T}`:(u=!0,T);this.intro=this.intro.replace(a,h);let f=0,y=this.firstChunk;for(;y;){const T=y.end;if(y.edited)c[f]||(y.content=y.content.replace(a,h),y.content.length&&(u=y.content[y.content.length-1]===`
|
|
76
|
+
`));else for(f=y.start;f<T;){if(!c[f]){const I=this.original[f];I===`
|
|
77
|
+
`?u=!0:I!=="\r"&&u&&(u=!1,f===y.start||(this._splitChunk(y,f),y=y.next),y.prependRight(s))}f+=1}f=y.end,y=y.next}return this.outro=this.outro.replace(a,h),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(s,i){return gs.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),gs.insertLeft=!0),this.appendLeft(s,i)}insertRight(s,i){return gs.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),gs.insertRight=!0),this.prependRight(s,i)}move(s,i,a){if(a>=s&&a<=i)throw new Error("Cannot move a selection inside itself");this._split(s),this._split(i),this._split(a);const c=this.byStart[s],u=this.byEnd[i],h=c.previous,f=u.next,y=this.byStart[a];if(!y&&u===this.lastChunk)return this;const T=y?y.previous:this.lastChunk;return h&&(h.next=f),f&&(f.previous=h),T&&(T.next=c),y&&(y.previous=u),c.previous||(this.firstChunk=u.next),u.next||(this.lastChunk=c.previous,this.lastChunk.next=null),c.previous=T,u.next=y||null,T||(this.firstChunk=c),y||(this.lastChunk=u),this}overwrite(s,i,a,c){return c=c||{},this.update(s,i,a,{...c,overwrite:!c.contentOnly})}update(s,i,a,c){if(typeof a!="string")throw new TypeError("replacement content must be a string");for(;s<0;)s+=this.original.length;for(;i<0;)i+=this.original.length;if(i>this.original.length)throw new Error("end is out of bounds");if(s===i)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(s),this._split(i),c===!0&&(gs.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),gs.storeName=!0),c={storeName:!0});const u=c!==void 0?c.storeName:!1,h=c!==void 0?c.overwrite:!1;if(u){const T=this.original.slice(s,i);Object.defineProperty(this.storedNames,T,{writable:!0,value:!0,enumerable:!0})}const f=this.byStart[s],y=this.byEnd[i];if(f){let T=f;for(;T!==y;){if(T.next!==this.byStart[T.end])throw new Error("Cannot overwrite across a split point");T=T.next,T.edit("",!1)}f.edit(a,u,!h)}else{const T=new Gs(s,i,"").edit(a,u);y.next=T,T.previous=y}return this}prepend(s){if(typeof s!="string")throw new TypeError("outro content must be a string");return this.intro=s+this.intro,this}prependLeft(s,i){if(typeof i!="string")throw new TypeError("inserted content must be a string");this._split(s);const a=this.byEnd[s];return a?a.prependLeft(i):this.intro=i+this.intro,this}prependRight(s,i){if(typeof i!="string")throw new TypeError("inserted content must be a string");this._split(s);const a=this.byStart[s];return a?a.prependRight(i):this.outro=i+this.outro,this}remove(s,i){for(;s<0;)s+=this.original.length;for(;i<0;)i+=this.original.length;if(s===i)return this;if(s<0||i>this.original.length)throw new Error("Character is out of bounds");if(s>i)throw new Error("end must be greater than start");this._split(s),this._split(i);let a=this.byStart[s];for(;a;)a.intro="",a.outro="",a.edit(""),a=i>a.end?this.byStart[a.end]:null;return this}reset(s,i){for(;s<0;)s+=this.original.length;for(;i<0;)i+=this.original.length;if(s===i)return this;if(s<0||i>this.original.length)throw new Error("Character is out of bounds");if(s>i)throw new Error("end must be greater than start");this._split(s),this._split(i);let a=this.byStart[s];for(;a;)a.reset(),a=i>a.end?this.byStart[a.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let s=this.lastChunk;do{if(s.outro.length)return s.outro[s.outro.length-1];if(s.content.length)return s.content[s.content.length-1];if(s.intro.length)return s.intro[s.intro.length-1]}while(s=s.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let s=this.outro.lastIndexOf(Vs);if(s!==-1)return this.outro.substr(s+1);let i=this.outro,a=this.lastChunk;do{if(a.outro.length>0){if(s=a.outro.lastIndexOf(Vs),s!==-1)return a.outro.substr(s+1)+i;i=a.outro+i}if(a.content.length>0){if(s=a.content.lastIndexOf(Vs),s!==-1)return a.content.substr(s+1)+i;i=a.content+i}if(a.intro.length>0){if(s=a.intro.lastIndexOf(Vs),s!==-1)return a.intro.substr(s+1)+i;i=a.intro+i}}while(a=a.previous);return s=this.intro.lastIndexOf(Vs),s!==-1?this.intro.substr(s+1)+i:this.intro+i}slice(s=0,i=this.original.length){for(;s<0;)s+=this.original.length;for(;i<0;)i+=this.original.length;let a="",c=this.firstChunk;for(;c&&(c.start>s||c.end<=s);){if(c.start<i&&c.end>=i)return a;c=c.next}if(c&&c.edited&&c.start!==s)throw new Error(`Cannot use replaced character ${s} as slice start anchor.`);const u=c;for(;c;){c.intro&&(u!==c||c.start===s)&&(a+=c.intro);const h=c.start<i&&c.end>=i;if(h&&c.edited&&c.end!==i)throw new Error(`Cannot use replaced character ${i} as slice end anchor.`);const f=u===c?s-c.start:0,y=h?c.content.length+i-c.end:c.content.length;if(a+=c.content.slice(f,y),c.outro&&(!h||c.end===i)&&(a+=c.outro),h)break;c=c.next}return a}snip(s,i){const a=this.clone();return a.remove(0,s),a.remove(i,a.original.length),a}_split(s){if(this.byStart[s]||this.byEnd[s])return;let i=this.lastSearchedChunk;const a=s>i.end;for(;i;){if(i.contains(s))return this._splitChunk(i,s);i=a?this.byStart[i.end]:this.byEnd[i.start]}}_splitChunk(s,i){if(s.edited&&s.content.length){const c=xu(this.original)(i);throw new Error(`Cannot split a chunk that has already been edited (${c.line}:${c.column} \u2013 "${s.original}")`)}const a=s.split(i);return this.byEnd[i]=s,this.byStart[i]=a,this.byEnd[a.end]=a,s===this.lastChunk&&(this.lastChunk=a),this.lastSearchedChunk=s,!0}toString(){let s=this.intro,i=this.firstChunk;for(;i;)s+=i.toString(),i=i.next;return s+this.outro}isEmpty(){let s=this.firstChunk;do if(s.intro.length&&s.intro.trim()||s.content.length&&s.content.trim()||s.outro.length&&s.outro.trim())return!1;while(s=s.next);return!0}length(){let s=this.firstChunk,i=0;do i+=s.intro.length+s.content.length+s.outro.length;while(s=s.next);return i}trimLines(){return this.trim("[\\r\\n]")}trim(s){return this.trimStart(s).trimEnd(s)}trimEndAborted(s){const i=new RegExp((s||"\\s")+"+$");if(this.outro=this.outro.replace(i,""),this.outro.length)return!0;let a=this.lastChunk;do{const c=a.end,u=a.trimEnd(i);if(a.end!==c&&(this.lastChunk===a&&(this.lastChunk=a.next),this.byEnd[a.end]=a,this.byStart[a.next.start]=a.next,this.byEnd[a.next.end]=a.next),u)return!0;a=a.previous}while(a);return!1}trimEnd(s){return this.trimEndAborted(s),this}trimStartAborted(s){const i=new RegExp("^"+(s||"\\s")+"+");if(this.intro=this.intro.replace(i,""),this.intro.length)return!0;let a=this.firstChunk;do{const c=a.end,u=a.trimStart(i);if(a.end!==c&&(a===this.lastChunk&&(this.lastChunk=a.next),this.byEnd[a.end]=a,this.byStart[a.next.start]=a.next,this.byEnd[a.next.end]=a.next),u)return!0;a=a.next}while(a);return!1}trimStart(s){return this.trimStartAborted(s),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(s,i){function a(u,h){return typeof i=="string"?i.replace(/\$(\$|&|\d+)/g,(f,y)=>y==="$"?"$":y==="&"?u[0]:+y<u.length?u[+y]:`$${y}`):i(...u,u.index,h,u.groups)}function c(u,h){let f;const y=[];for(;f=u.exec(h);)y.push(f);return y}if(s.global)c(s,this.original).forEach(h=>{if(h.index!=null){const f=a(h,this.original);f!==h[0]&&this.overwrite(h.index,h.index+h[0].length,f)}});else{const u=this.original.match(s);if(u&&u.index!=null){const h=a(u,this.original);h!==u[0]&&this.overwrite(u.index,u.index+u[0].length,h)}}return this}_replaceString(s,i){const{original:a}=this,c=a.indexOf(s);return c!==-1&&this.overwrite(c,c+s.length,i),this}replace(s,i){return typeof s=="string"?this._replaceString(s,i):this._replaceRegexp(s,i)}_replaceAllString(s,i){const{original:a}=this,c=s.length;for(let u=a.indexOf(s);u!==-1;u=a.indexOf(s,u+c))a.slice(u,u+c)!==i&&this.overwrite(u,u+c,i);return this}replaceAll(s,i){if(typeof s=="string")return this._replaceAllString(s,i);if(!s.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(s,i)}}const Au=G(process.cwd(),"shared/translation.ts"),Pu="globalThis.craneSharedTranslation = translation",Fx=e=>`import translation from '${e}';
|
|
78
|
+
${Pu};
|
|
79
|
+
`,Bx=(e,s)=>{const i=e.split("?")[0],a=Sp(i);return(a==="server.ts"||a==="client.ts")&&!s.includes(Pu)},wu=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=ke(Au)},transform(s,i){if(!e||!Bx(i,s))return null;const a=i.split("?")[0],c=Wa(a),u=Pp(Ka(c,Au)),h=Fx(u),f=new jn(s);return f.prepend(h),{code:f.toString()}}}},Cu={[Ge.Server]:()=>[nt.vue(),nt.tsconfigPaths(),wx(),xx(),wu()],[Ge.Client]:()=>[nt.vue(),nt.tsconfigPaths(),to({vue:"EcVue"}),wu()],[Ge.Misc]:()=>[nt.tsconfigPaths()],[Ge.Layout]:()=>[nt.vue(),nt.tsconfigPaths(),to({vue:["EcExternals","Vue"]})],[Ge.Asset]:()=>[Cx()],[Ge.SharedFiles]:()=>[nt.tsconfigPaths()]},_u={[pe.Server]:Tu({outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/main/server`}),[pe.Client]:Su({outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/main/client`}),[pe.SectionSetting]:ys({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/settings`}),[pe.SectionShowcase]:ys({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/showcases`}),[pe.SectionAsset]:qi({outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/assets`}),[pe.TemplateDescriptor]:ys({entryFileNames:"[name].mjs",outDir:()=>`./${Tt}/js`}),[pe.PageTemplateDescriptor]:ys({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${Tt}/${e}`}),[pe.TemplateAsset]:qi({outDir:()=>`./${Tt}/assets`}),[pe.Layout]:mx({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}`}),[pe.LayoutSettings]:ys({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/js/settings`}),[pe.LayoutAsset]:qi({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/assets`}),[pe.SlotServer]:Tu({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/server`}),[pe.SlotClient]:Su({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/client`}),[pe.CollectionDescriptor]:ys({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${Bs}/${e}`}),[pe.CollectionAsset]:qi({outDir:()=>`./${Bs}/assets`}),[pe.SharedTranslation]:{pluginType:Ge.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function Ux(e){switch(typeof e){case"string":return[G(process.cwd(),e)];case"object":return e.map(s=>G(process.cwd(),s));default:return[]}}function vu({name:e,entryPoints:s,configType:i,layoutId:a,sectionId:c,sectionType:u=ft.SECTION}){const h=_u[i],f=h.define,y=h.ssrOptions,T=h.entryFileNames,I=h.chunkFileNames,A=h.assetFileNames,L=h.inlineDynamicImports,R=h.externalOption;return{logLevel:On()?void 0:"silent",plugins:Cu[h.pluginType](),ssr:y,define:f,resolve:{alias:{"@":"/src"}},build:{ssr:h.ssr,outDir:h.outDir({name:e,sectionType:u,layoutId:a,sectionId:c}),emptyOutDir:!0,minify:h.ssr?"terser":"esbuild",...h.ssr&&{terserOptions:{mangle:{reserved:["gc"]}}},rollupOptions:{external:R,preserveEntrySignatures:"strict",input:Ux(s),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:L,entryFileNames:T,chunkFileNames:I,assetFileNames:A}}},assetsInclude:["**/*.json"]}}const jx=Object.values(Pe).map(e=>e.source).join("|");function Nu(e,s,i){if(!e)return`${s}.mjs`;const a=Ka(process.cwd(),e).replace(/\\/g,"/").match(`^(${jx})/([^/]+)/${i}/([^/.]+)`);return a?`${a[1]}/${a[2]}/js/${i}/${a[3]}.mjs`:`${s}.mjs`}function Ou(e,s){const i=_u[pe.SectionSetting];return{logLevel:On()?void 0:"silent",plugins:Cu[i.pluginType](),define:i.define,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:i.ssr,outDir:"./dist",emptyOutDir:!1,minify:"esbuild",rollupOptions:{external:i.externalOption,preserveEntrySignatures:"strict",input:e.map(a=>G(process.cwd(),a)),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:i.inlineDynamicImports,entryFileNames:s,chunkFileNames:"chunks/[name]-[hash].js",assetFileNames:i.assetFileNames}}},assetsInclude:["**/*.json"]}}function zx(e){return Ou(e,s=>Nu(s.facadeModuleId??void 0,s.name,"settings"))}function Vx(e){return Ou(e,s=>Nu(s.facadeModuleId??void 0,s.name,"showcases"))}async function Gx(){const e={ignore:["node_modules/**","dist/**"]},s=await W(`./${hs}/{product,category,catalog}/*/client.{js,ts}`,e);return await Promise.all(s.map(async i=>{const{id:a,sectionId:c,pageId:u}=ix(i),[h,f]=await Promise.all([W(`./${hs}/${c}/${a}/settings/{content,design,translations,layout}.{js,ts}`,e),W(`./${hs}/${c}/${a}/assets/*`,e)]);return{name:a,sectionId:c,pageId:u,clientEntrypoint:i,settingsEntryPoints:h,assetsEntrypoints:f}}))}async function Hx(e){await Ye({entryPoints:[e.clientEntrypoint],configType:pe.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([Ye({entryPoints:e.settingsEntryPoints,configType:pe.LayoutSettings,name:e.name,sectionId:e.sectionId}),Ye({entryPoints:e.assetsEntrypoints,configType:pe.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function Zx(e){e===void 0||e.length===0||await Promise.all(e.map(s=>Hx(s)))}async function Wx(e){const s=e.flatMap(a=>a.settingsEntryPoints),i=e.flatMap(a=>a.showcaseEntryPoints);s.length>0&&await ht({configFile:!1,...ti(zx(s))}),i.length>0&&await ht({configFile:!1,...ti(Vx(i))})}async function Kx(e){await Promise.all([ht({configFile:!1,...ti(vu({name:e.name,entryPoints:e.serverEntrypoint,configType:ds.Server,sectionType:e.type}))}),Ye({entryPoints:e.clientEntrypoint,configType:ds.Client,name:e.name,sectionType:e.type}),Ye({entryPoints:e.assetEntryPoints,configType:ds.SectionAsset,name:e.name,sectionType:e.type})])}async function qx(){const e=G(process.cwd(),"shared/translation.ts");ke(e)&&await Ye({entryPoints:["shared/translation.ts"],configType:ds.SharedTranslation})}async function Lu(e){await Promise.all([Wx(e),...e.map(Kx)])}function Yx(e){const s=Wi(e).split("/");if(s.length<4||s[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[i,a,,c]=s;if(!gu(i))throw new Error(`Slot cannot be placed in a non-storefront section: ${i}`);return{id:c,sectionId:i,layoutId:a}}async function Xx(e,s){return Promise.all(e.map(async i=>{const a=s.find(f=>f.id===i.layoutId&&f.sectionId===i.sectionId),c=await Us(a?.translationsSettings),u=await Cn(a?.content??{},c),h=await _n(a?.design??{},c);return{id:i.id,sectionId:i.sectionId,layoutId:i.layoutId,contentEditors:u,designEditors:h}}))}async function Jx(){const e={ignore:["node_modules/**","dist/**"]},s=await W(`${hs}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(s.map(async i=>{const{id:a,sectionId:c,layoutId:u}=Yx(i),h=(await W(`${hs}/${c}/${u}/slots/${a}/client.{js,ts}`,e))[0];if(h===void 0)throw new Error(`Cannot find client entrypoint file for slot ${a} of section ${c}`);return{id:a,sectionId:c,layoutId:u,serverEntrypoint:i,clientEntrypoint:h}}))}async function Qx(e){const s={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await Promise.all([Ye({entryPoints:[e.serverEntrypoint],configType:pe.SlotServer,...s}),Ye({entryPoints:[e.clientEntrypoint],configType:pe.SlotClient,...s})])}async function eA(e){e?.length&&await Promise.all(e.map(Qx))}async function tA(e){return(await W(`**/${e}/pages/*.{js,ts}`,{ignore:["node_modules/**","dist/**"]})).filter(s=>{const i=qa(s).name.toLowerCase();return!Object.values(gc).includes(i)})}async function sA(){const e=await W("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(s=>(N.error(`Error while getting page template entry points: ${s}`),[]));return Promise.all(e.map(async s=>{const i=s.split(Cr),a=i.pop()??"default";if(i.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const c=await W(`**/templates/${a}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await W(`**/templates/${a}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),h=await W(`**/templates/${a}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await W(`**/templates/${a}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await W(`**/templates/${a}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),T=await tA(a);return{name:a,configurationEntrypoint:c.at(0),homeEntrypoint:u.at(0),categoryEntrypoint:h.at(0),catalogEntrypoint:f.at(0),productEntrypoint:y.at(0),customEntrypoint:T.length>0?T:void 0}}))}async function iA(){const e=await W("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),s=await W("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await sA(),templates:e,assets:s}}async function rA({templateBuildConfig:e}){await Promise.all([Ye({entryPoints:e.assets,configType:ds.TemplateAsset}),...e.pageTemplates?.map(async s=>{const i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint,...s.customEntrypoint??[]].filter(Vi);if(i.length===0)throw new Error("No entry points provided for page template");await Ye({entryPoints:i,configType:ds.PageTemplateDescriptor,name:s.name})})||[]])}async function nA(){const e=await iA();await rA({templateBuildConfig:e})}async function aA(){const e=await W("./collections/*",{ignore:["collections/assets/**","collections/**.{js,ts}","node_modules/**","dist/**"]}).catch(i=>(N.error(`Error while getting collection entry points: ${i}`),[])),s=await W("./collections/assets/*",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async i=>{const a=i.split(Cr),c=a.pop()??"default";if(a.pop()===void 0)throw new Error("Cannot determine collection, outer directory is undefined");const u=await W(`**/collections/${c}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:c,configurationEntrypoint:u.at(0),assetsEntrypoints:s}}))}async function oA(){const e=await aA();e.length!==0&&await Promise.all(e.flatMap(s=>[Ye({entryPoints:s.assetsEntrypoints,configType:pe.CollectionAsset,name:s.name}),Ye({entryPoints:s.configurationEntrypoint?[s.configurationEntrypoint]:[],configType:pe.CollectionDescriptor,name:s.name})]))}function Du(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(Vi).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(Vi),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(Vi),assetEntryPoints:e.assetsEntrypoints??[]}}function ku(e){return e.map(s=>({...s,selectedDesignSettings:s.selectedDesignSettings.map(i=>{const a=i.defaults;return a&&typeof a=="object"&&!("type"in a)?{...i,defaults:{type:i.type,...a}}:i})}))}async function cA(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/main/server/server.js.gz`),a=so(io.gunzip),c=await ee.promises.readFile(i);return{size:(await a(c)).length}}async function lA(e,s=ot){try{const i=G(process.cwd(),`${s}/${e}/assets/`);return(await W("*",{cwd:i})).map(a=>{const c=G(i,a);return{path:a,size:ws(c).size}})}catch{throw new Error(`Asset files for section [${e}] is either invalid or undefined`)}}async function Ln(e,s){const i=await $I(e,Pe[s].dist),a=await Zi(e,Pe[s].dist),c=await BI(e,Pe[s].dist),u=await UI(e,Pe[s].dist),h=await zI(e,Pe[s].dist),f=await VI(e,Pe[s].dist),y=ku(f),T=await lA(e,Pe[s].dist),I=await cA(e,Pe[s].dist),A=GI(e);return{id:e,type:s,name:e,content:c,design:u,layout:y,showcase:h,translationsSettings:i,translationsShowcases:a,assets:T,server:I,previewCount:A}}async function uA(){const e=await W("*/",{cwd:G(process.cwd(),`${ot}/`)}),s=await W("*/",{cwd:G(process.cwd(),`${bn}/`)}),i=await W("*/",{cwd:G(process.cwd(),`${In}/`)});return Promise.all([...e.map(async a=>Ln(a,Bt.SECTION)),...s.map(async a=>Ln(a,Bt.HEADER)),...i.map(async a=>Ln(a,Bt.FOOTER))])}async function hA(e){try{const s=G(process.cwd(),`${e}/assets/`);return(await W("*",{cwd:s})).map(i=>{const a=G(s,i);return{path:i,size:ws(a).size}})}catch{throw new Error("Asset files for layouts are either invalid or undefined")}}async function pA(e){const s=Wi(e).split("/");if(s.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[i,a]=s,[c,u,h,f,y,T]=await Promise.all([yA(a,i),gA(a,i),FI(a,i),hA(e),mA(i,a),EA(a,i)]);return{id:a,sectionId:i,content:c,design:u,translationsSettings:h,assets:f,layouts:T,templateContent:y}}async function dA(){const e=`${ze}/{product,catalog,category}/*`,s=await W(e,{ignore:["node_modules/**"]});return Promise.all(s.map(pA))}function fA(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}async function mA(e,s){const i=`layouts/${e}/${s}/Main.vue`;try{const a=G(process.cwd(),i);return await ee.promises.readFile(a,"utf-8")}catch(a){if(fA(a)){N.warn(`Custom storefront layout is missing: [${i}]. If you created this layout manually, check that the file is named Main.vue.`);return}throw a}}async function yA(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/content.mjs`),a=await qe(i);return os(a)}catch(i){throw new Error(`Content descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function gA(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/design.mjs`),a=await qe(i);return os(a)}catch(i){throw new Error(`Design descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function EA(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/layout.mjs`);if(!ee.existsSync(i))return[];const a=await qe(i);return ku(a)}catch(i){throw new Error(`Layout settings descriptor for layout [${e}] in section [${s}] is either invalid or undefined: ${i}`)}}async function TA(e,s,i){const a=G(process.cwd(),`${ze}/${i}/${s}/slots/${e}/js/main/server/server.js.gz`),c=so(io.gunzip),u=await ee.promises.readFile(a);return{size:(await c(u)).length}}async function SA(e){const s=Wi(e).split("/");if(s.length<4||s[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[i,a,,c]=s,u=await TA(c,a,i);return{id:c,sectionId:i,layoutId:a,server:u}}async function bA(){const e=`${ze}/{product,catalog,category}/*/slots/*`,s=await W(e,{ignore:["node_modules/**"]});return await Promise.all(s.map(SA))}async function IA(){try{const e=G(process.cwd(),`${Tt}/assets/`);return(await W("*",{cwd:e})).map(s=>{const i=G(e,s);return{path:s,size:ws(i).size}})}catch{throw new Error("Asset files for templates are either invalid or undefined")}}function xA(e){return e in Ut?Ut[e]:Ut.CUSTOM}async function AA(e){const s=await W(`${Tt}/${e}/*.mjs`,{ignore:[`${Tt}/${e}/configuration*.mjs`]});return Promise.all(s.map(async i=>{const{sections:a,metadata:c}=await Dn(i),u=rI(i);return{type:xA(u.toUpperCase()),id:u,metadata:c,sections:a}}))}async function Dn(e){try{return await qe(G(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function PA(e){const s=await W(`${Tt}/**/configuration*.mjs`,{});return Promise.all(s.map(async i=>{const a=Se.basename(Se.dirname(i));return{id:`${e}_${a}`,assets:await IA(),configuration:await Dn(i),pages:await AA(a)}}))}async function wA(e){return await PA(e)}async function CA(){const e=G(process.cwd(),`${Qb}/translation.mjs`);return await qe(e)}async function _A(){return{translations:await CA()}}async function vA(e){const s=await W(`${Bs}/*/configuration*.mjs`,{ignore:["node_modules/**",`${Bs}/assets/**`]});return Promise.all(s.map(async i=>{const a=Se.basename(Se.dirname(i)),c=await Dn(i);return{id:`${e}_${a}`,descriptor:c}}))}async function Ru(){const e=await Gi(),[s,i,a,c,u,h,f]=await Promise.all([Nn(),_A(),uA(),dA(),bA(),wA(e.appClientId),vA(e.appClientId)]);return{version:s.version,name:"Custom Block App",shared:i,sections:a,templates:h,layouts:c,slots:u,collections:f,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:s.dependencies.vue,openSource:s.openSource}}function kn(e){return ke(`${bn}/${e}`)?ft.HEADER:ke(`${In}/${e}`)?ft.FOOTER:ft.SECTION}async function Rn(e,s){const i=e.design?wn(e.design):void 0,a={...e,design:i??e.design},c=await Us(s);return ps(a,c)}function Mn(e){return e.type==="custom"&&e.id!==void 0&&e.showcase_overrides!==void 0}async function Mu(e){if(Mn(e)){const s=await Zi(e.id,Pe[kn(e.id)].dist);return{...e,showcase_overrides:await Rn(e.showcase_overrides,s)}}return e}async function NA(e){const s=Mn(e.header)?{...e.header,showcase_overrides:await Rn(e.header.showcase_overrides,await Zi(e.header.id,Pe[kn(e.header.id)].dist))}:e.header,i=Mn(e.footer)?{...e.footer,showcase_overrides:await Rn(e.footer.showcase_overrides,await Zi(e.footer.id,Pe[kn(e.footer.id)].dist))}:e.footer;return{...e,header:s,footer:i}}async function OA(e){const s=await Promise.all(e.pages.map(async a=>({...a,sections:await Promise.all(a.sections.map(c=>Mu(c)))}))),i=await NA(e.configuration);return{id:e.id,descriptor:{...i,pages:s}}}async function LA(e){return Promise.all(e.map(s=>OA(s)))}async function DA(e){const s=new Map;return await Promise.all(e.map(async i=>{const[a,c]=await Promise.all([Us(i.translationsSettings),Us(i.translationsShowcases)]);s.set(i.id,{settings:a,showcases:c})})),s}async function kA(e,s,i){const[a,c,u,h]=await Promise.all([Cn(e.content,s,e.type),_n(e.design,s,e.type),jI(e.showcase,i),fu(e.layout)]);return{id:e.id,type:e.type,name:{en:e.name},contentEditors:a,designEditors:c,layouts:h,showcases:u,previewCount:e.previewCount}}async function RA(e,s){return Promise.all(e.map(async i=>{const a=s.get(i.id)??{settings:{},showcases:{}};return kA(i,a.settings,a.showcases)}))}async function MA(e){return Promise.all(e.map(async s=>{const i=await Promise.all(s.descriptor.sections.map(a=>Mu(a)));return{...s,descriptor:{...s.descriptor,sections:i}}}))}async function $u(e){const s=await DA(e.sections),[i,a,c,u,h]=await Promise.all([RA(e.sections,s),rx(e.layouts),Xx(e.slots,e.layouts),LA(e.templates),MA(e.collections)]);return{version:e.version,name:e.name,blocks:i,templates:u,layouts:a,slots:c,compressionEnabled:e.compressionEnabled,externalizationEnabled:e.externalizationEnabled,vueVersion:e.vueVersion,collections:h,openSource:e.openSource}}async function $A(e){const s=G(si.cwd(),lu);return _p(s,JSON.stringify(e))}function FA(e){return Object.entries(Pe).find(s=>s[1].source===e)?.[0]}async function Fu(){const e=await W("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**","collections/**"]});return Promise.all(e.map(async s=>{const i=Wa(s).split(Cr),a=i.pop()??"default",c=i.pop();if(c===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const u=["node_modules/**","dist/**"],[h,f,y,T,I,A,L,R]=await Promise.all([W(`**/${a}/client.{js,ts}`,{ignore:u}),W(`**/${a}/settings/content.{js,ts}`,{ignore:u}),W(`**/${a}/settings/design.{js,ts}`,{ignore:u}),W(`**/${a}/settings/layout.{js,ts}`,{ignore:u}),W(`**/${a}/settings/translations.{js,ts}`,{ignore:u}),W(`**/${a}/showcases/*.{js,ts}`,{ignore:[...u,`**/${a}/showcases/translations.{js,ts}`]}),W(`**/${a}/showcases/translations.{js,ts}`,{ignore:u}),W(`**/${a}/assets/*`,{ignore:u})]);return{name:a,type:FA(c),serverEntrypoint:s,clientEntrypoint:h.at(0),contentSettingsEntrypoint:f.at(0),designSettingsEntrypoint:y.at(0),layoutSettingsEntrypoint:T.at(0),settingsTranslationsEntrypoint:I.at(0),showcasesEntrypoints:A,showcasesTranslationsEntrypoint:L.at(0),assetsEntrypoints:R}}))}const BA=["/settings/","/showcases/"];function UA(e){return BA.some(s=>e.includes(s))}function jA(){const e=tt.findConfigFile(process.cwd(),tt.sys.fileExists,"tsconfig.json");if(!e)return;const s=tt.readConfigFile(e,tt.sys.readFile),i=tt.parseJsonConfigFileContent(s.config,tt.sys,process.cwd()),a=tt.createProgram(i.fileNames,i.options),c=tt.getPreEmitDiagnostics(a).filter(u=>!u.file||!UA(u.file.fileName));if(c.length>0){const u={getCanonicalFileName:h=>h,getCurrentDirectory:tt.sys.getCurrentDirectory,getNewLine:()=>tt.sys.newLine};throw console.error(tt.formatDiagnosticsWithColorAndContext(c,u)),new Error(`TypeScript found ${c.length} error(s)`)}}async function zA(e){jA(),await ht({configFile:!1,logLevel:"error",plugins:[nt.vue(),nt.tsconfigPaths(),nt.checker()],build:{write:!1,rollupOptions:{input:G(process.cwd(),e)}}})}function VA(){return Promise.all([Pr.rm("dist",{recursive:!0,force:!0}),Pr.rm("source-code",{recursive:!0,force:!0}),Pr.rm("source-code.zip",{force:!0})])}async function GA(){const e=new Ya,s=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"];(await Nn()).openSource===!0&&s.splice(s.indexOf("**/assets/**/*"),1);const i=await W("**/*",{cwd:G(process.cwd()),ignore:s,dot:!0,nodir:!0});try{i.forEach(u=>{const h=G(process.cwd(),u);e.addLocalFile(h,qa(u).dir)});const a=zs[se.SourceCode].fileName,c=G(process.cwd(),a);await e.writeZipPromise(c)}catch(a){throw N.error("Error while zipping source files"),a}}async function Xi(e=!1,s=!1){yx(s),Iu.start(),await VA();try{const[i,a,c]=await Promise.all([Gx(),Fu(),Jx()]),u=a.map(Du);a.length>0&&await zA(a[0].serverEntrypoint);try{await Promise.all([qx(),Lu(u),nA(),oA(),Zx(i),eA(c),GA()])}finally{Iu.stop()}const h=await Ru(),f=await ux(h);px(f,e);const y=await $u(h);await $A(y)}catch(i){N.error(`Error while building: ${i.message}`),e||process.exit(1)}}async function Ye({entryPoints:e,configType:s,name:i,sectionType:a,sectionId:c,layoutId:u}){if(e.length!==0){const h=ti(vu({name:i,entryPoints:e,configType:s,sectionType:a,sectionId:c,layoutId:u}));await ht({configFile:!1,...h})}}function Bu(e,s,i){Qs.statSync(e).isDirectory()?(Qs.mkdirSync(s,{recursive:!0}),Qs.readdirSync(e).forEach(a=>{const c=ei.resolve(e,a),u=ei.resolve(s,a);Bu(c,u,i)})):Mp.isMatch(e,i,{dot:!0})||Qs.copyFileSync(e,s)}function St(e,s,i,a,c=[]){const u=ei.join(e,a?.[i]??i);Bu(ei.join(s,i),u,c)}function HA(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>N.info(`Template [${e}] with pages structure named has been created`)}}function ct(e){return Re.resolve($p(import.meta.url),"../..",e)}function ZA(){const e=ct("package.json");return e!==""?JSON.parse(me.readFileSync(e,"utf8")):{}}async function WA(e){try{const s=e,i=be.cwd(),a=Re.join(i,s),c=["templates","headers","preview","footers","reference","page-templates","layouts","collections","blank"],u={_gitignore:".gitignore"};me.existsSync(a)?(N.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),be.exit(1)):me.mkdirSync(a);const h=ct("template");me.readdirSync(h).filter(I=>I!=="package.json").filter(I=>!c.includes(I)).forEach(async I=>St(a,h,I,u));const f=JSON.parse(me.readFileSync(Re.join(h,"package.json"),"utf-8"));f.name=e;const y=ZA();y.version&&(f.dependencies["@lightspeed/crane-api"]=y.dependencies["@lightspeed/crane-api"]),y.dependencies["@lightspeed/eslint-config-crane"]&&(f.dependencies["@lightspeed/eslint-config-crane"]=y.dependencies["@lightspeed/eslint-config-crane"]);const T=Re.join(a,"package.json");me.writeFileSync(T,`${JSON.stringify(f,null,2)}
|
|
80
|
+
`),N.info(`App ${e} created`)}catch(s){N.error(`Error while creating app: ${s.message}`),be.exit(1)}}function $n(e,s,i,a){try{const c=be.cwd(),u=Se.join(c,s);ee.existsSync(u)||ee.mkdirSync(u);const h=Se.join(c,s,i);ee.existsSync(h)?(N.error(`${a} with the name: ${i} already exists. If you'd like to override it, delete previous version first`),be.exit(1)):ee.mkdirSync(h);const f=ct(e);ee.readdirSync(f).forEach(async y=>St(h,f,y)),N.info(`${a} ${i} created`)}catch(c){N.error(`Error while creating ${a}: ${c.message}`),be.exit(1)}}function Fn(e){const s=be.cwd(),i=ct(`template/${e}`),a=Se.join(s,e);ee.existsSync(a)||(ee.mkdirSync(a),ee.readdirSync(i).forEach(async c=>St(a,i,c)))}async function KA(e,s,i,a){if(!ee.existsSync(i)){ee.copyFileSync(s,i);return}const c=ee.readFileSync(s),u=ee.readFileSync(i);c.equals(u)||(a?(await Qt({type:"select",name:"value",message:`File "${e.name}" exists but differs from template. What would you like to do?`,choices:[{title:"Keep existing file",value:"keep"},{title:"Replace with template version",value:"replace"}],initial:0})).value==="replace"?(ee.copyFileSync(s,i),N.info(`Replaced "${e.name}" with template version.`)):N.info(`Kept existing "${e.name}".`):N.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`))}async function Ji(e,s,i=!1){async function a(u,h,f){const y=Se.join(h,u.name),T=Se.join(f,u.name);u.isDirectory()?await Ji(y,T,i):await KA(u,y,T,i)}const c=ee.readdirSync(e,{withFileTypes:!0});ee.existsSync(s)||ee.mkdirSync(s,{recursive:!0}),await c.reduce(async(u,h)=>(await u,a(h,e,s)),Promise.resolve())}async function Bn(e=!1){try{const s=be.cwd(),i=Se.join(s,"shared"),a=ct("template/shared");if(!ee.existsSync(a))return;await Ji(a,i,e)}catch(s){N.error(`Error while processing shared folder: ${s.message}`),be.exit(1)}}async function qA(e,s){await Bn(),$n(`${`template${s?"/blank":""}`}/sections/${`${s?"blank-section":"example-section"}`}`,"sections",e,"Section")}function YA(e){return{renameFiles:{"example-collection":`${e}`},targetPath:e,sourcePath:"template/collections",onCollectionCreated:()=>N.info(`Collection [${e}] has been created`)}}async function XA(e){const{targetPath:s,renameFiles:i,sourcePath:a,onCollectionCreated:c}=YA(e);try{const u=be.cwd(),h=Re.join(u,"collections"),f=ct(a),y=me.readdirSync(f);me.existsSync(h)?me.existsSync(Re.join(h,s))&&(N.error(`Collection with the name: ${e} already exists. If you'd like to override it, delete previous version first`),be.exit(1)):me.mkdirSync(h),y.forEach(T=>St(h,f,T,i)),c()}catch(u){N.error(`Error while creating collection: ${u.message}`),be.exit(1)}}async function JA(e){await Bn(),$n("template/footers/example-footer","footers",e,"Footer")}async function QA(e){await Bn(),$n("template/headers/example-header","headers",e,"Header")}async function eP(e,s){try{const i=be.cwd(),a=Re.join(i,"templates"),c=ct("template/page-templates/example-template/pages");me.existsSync(Re.join(a,e))||(N.error(`Template with the name: [${e}] doesn't exists. Please create a template first.`),be.exit(1)),me.existsSync(Re.join(a,e,"pages",`${s}.ts`))&&(N.error(`Page with the name: [${s}.ts] already exists. If you'd like to override it, delete previous version first`),be.exit(1));const u=me.readFileSync(Re.join(c,"custom.ts"),"utf-8").replace(/title\s*:\s*'Custom Page'/,`title: '${nI(s)}'`),h=Re.join(a,e,"pages",`${s}.ts`);me.writeFileSync(h,u),N.info(`Page [${s}.ts] created for template ${e}`)}catch(i){N.error(`Error while creating page: ${i.message}`),be.exit(1)}}async function tP(){try{const e=be.cwd(),s=ct("template/reference"),i=me.readdirSync(s);let a=!1;for(const c of i){const u=Re.join(s,c),h=Re.join(e,c);me.existsSync(h)||me.mkdirSync(h,{recursive:!0});const f=me.readdirSync(u),y=me.readdirSync(h);if(c==="shared"){f.forEach(T=>{St(h,u,T)});continue}for(const T of f){if(T==="assets"){St(h,u,T);continue}if(y.includes(T)){const{name:I}=await Qt({type:"text",name:"name",message:`The "${T}" already exists in ${c} directory: provide a new name to keep both or press Esc to skip this one.`});I?(St(h,u,T,{[T]:I}),a=!0):N.info(`Skipped: ${T}`)}else St(h,u,T)}}N.info("Reference templates have been added to the app"),a&&N.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){N.error(`Error while creating template descriptors: ${e.message}`),be.exit(1)}}const sP=["**/example-template/pages/custom.ts"];async function iP(e){const{targetPath:s,renameFiles:i,sourcePath:a,onTemplateCreated:c}=HA(e);try{const u=be.cwd(),h=Re.join(u,"templates"),f=ct(a),y=me.readdirSync(f);me.existsSync(h)?me.existsSync(Re.join(h,s))&&(N.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),be.exit(1)):me.mkdirSync(h),y.forEach(T=>St(h,f,T,i,sP)),Fn("headers"),Fn("footers"),Fn("layouts"),c()}catch(u){N.error(`Error while creating template descriptors: ${u.message}`),be.exit(1)}}function rP(){try{const e=G(si.cwd(),`${cu}/shared/analytics.json`);ke(e)&&wr(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}function Qi({deploymentContext:e,sectionType:s=ft.SECTION}){const i=e.pathContext,a=i.toPath({sectionId:e.currentSection,sectionType:s,layoutId:e.layoutId,slotId:e.slotId}),c=a===void 0?Xa(i.fileName):Xa(i.fileName,{cwd:G(process.cwd(),a),ignore:i.ignore});return(i.isSingleton?c.splice(0):c).map(u=>({url:u,sectionType:s,context:e}))}const nP=e=>e.app.manifest.blocks.flatMap(s=>XI.flatMap(i=>{const a={config:e,currentSection:s.id,pathContext:zs[i]};return Qi({deploymentContext:a,sectionType:s.type})})),aP=e=>ex.flatMap(s=>{const i={config:e,pathContext:zs[s]};return Qi({deploymentContext:i})}),oP=e=>e.app.manifest.layouts.flatMap(s=>JI.flatMap(i=>{const a={config:e,pathContext:zs[i],currentSection:s.sectionId,layoutId:s.id};return Qi({deploymentContext:a})})),cP=e=>e.app.manifest.slots.flatMap(s=>QI.flatMap(i=>{const a={config:e,pathContext:zs[i],currentSection:s.sectionId,layoutId:s.layoutId,slotId:s.id};return Qi({deploymentContext:a})})),lP=e=>`\x1B[32m${e}\x1B[0m`,uP=(e,s,i,a,c)=>{if(!e.total)return;const{loaded:u}=e,h=(Date.now()-c)/1e3;i.value+=u-a.value,a.value=u,s.update({speed:`${mt(i.value/h,2)}/s`})},hP=()=>new Up.SingleBar({format:`|${lP("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});async function Uu(e){await new Promise(s=>setTimeout(s,e))}const ju="Please ensure you have built your application before deploying.";async function pP(){try{const e=await _r(G(si.cwd(),lu));return JSON.parse(e.toString())}catch(e){throw e.code==="ENOENT"?new Error(`Manifest file not found. ${ju}`):e instanceof SyntaxError?new Error(`Manifest file is not valid. ${ju}`):e}}const dP={value:0},Xe=hP();let zu=Date.now();const Vu=e=>2**e*500;async function fP(e){const s=Bp(e.version,"patch");if(s===null)throw Error("Error while incrementing app version");e.version=s,wr(G(Ie.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
81
|
+
`)}function mP(e){return e instanceof Qa&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function Gu(e,s){return e<YI&&mP(s)}async function Hu(e,s,i,a){const c={value:0},u=e.config.app.manifest.templates.length>0||e.config.app.manifest.collections.length>0?ZI:HI;return e.config.axios.post(u,{file:gp(G(Ie.cwd(),i!==void 0?i+s:s))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.layoutId!==void 0&&{layoutId:e.layoutId},...e.slotId!==void 0&&{slotId:e.slotId},...!["dependencies","source_code"].includes(e.pathContext.type)&&{fileName:s}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:h=>uP(h,Xe,dP,c,zu)}).then(h=>(Xe.increment(),h)).catch(async h=>{if(Gu(a,h))return await Uu(Vu(a)),Hu(e,s,i,a+1);throw Xe.increment(),h})}function yP(e){return Xe.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(s=>{const i=s.context,a=i.pathContext.toPath({sectionId:i.currentSection,sectionType:s.sectionType,layoutId:i.layoutId,slotId:i.slotId});return Hu(i,s.url,a,0)})}function gP(e){const s=[...nP(e),...aP(e),...oP(e),...cP(e)];return yP(s)}async function Zu(e,s=0){const i=e.app.manifest.templates.length>0||e.app.manifest.collections.length>0?KI:WI;return e.axios.post(i,e.app.manifest,{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async a=>{if(Gu(s,a))return await Uu(Vu(s)),Zu(e,s+1);throw a})}async function EP(e){try{if(!eI.some(h=>ke(G(Ie.cwd(),h))))throw new Error(fs.INCORRECT_DISTRIBUTION_FOLDER(Jb));const s=e??vn;N.info("Custom application deployment :: Started");const i=vr.create({baseURL:s});Fp(i,qI),N.info("Loading configuration files ...");const a=await Promise.all([Gi(),Nn(),pP()]).then(([h,f,y])=>({axios:i,app:{crane:h,packageJson:f,manifest:y}}));N.info("Uploading files ..."),zu=Date.now(),await Promise.all(gP(a)).catch(h=>{Xe.stop(),h.response?.status===404?N.error(Zt(h,fs.DEPRECATED_VERSION_DEPLOYMENT)):N.error(Zt(h,fs.ASSET_FILES_UPLOAD)),Ie.exit(1)}).finally(()=>{Xe.increment(),Xe.stop()}),Xe.update({speed:"N/A",status:"Finalising deployment"}),await Zu(a).catch(h=>{Xe.stop(),h.response?.status===404?N.error(Zt(h,fs.DEPRECATED_VERSION_DEPLOYMENT)):N.error(Zt(h,fs.MANIFEST_DEPLOYMENT)),Ie.exit(1)}).finally(()=>{Xe.increment(),Xe.stop()});const c=a.app.manifest.blocks.map(h=>h.id),u=a.app.packageJson.version;N.info("Custom application deployment :: Successful"),N.info(`Current app version: ${u}`),N.info(`Deployed sections: ${c.sort().join(", ")}`),await fP(a.app.packageJson),a.app.manifest.templates.length>0&&N.info(`Deployed templates: ${a.app.manifest.templates.map(h=>h.id).sort().join(", ")}`),a.app.manifest.slots.length>0&&N.info(`Deployed slots: ${a.app.manifest.slots.map(h=>h.id).sort().join(", ")}`),a.app.manifest.collections.length>0&&N.info(`Deployed collections: ${a.app.manifest.collections.map(h=>h.id).sort().join(", ")}`)}catch(s){Xe.stop(),N.error(Zt(s,fs.DEFAULT)),Ie.exit(1)}finally{rP()}}function TP(){process.env.CRANE_DEBUG_ENABLED="true"}function SP(){return process.env.CRANE_DEBUG_ENABLED==="true"}function bP(e,...s){SP()&&console.debug(Ap(`[DEBUG] ${e}`),...s)}function IP(){return{name:"app-block-api",configureServer(e){e.middlewares.use(async(s,i,a)=>{e.moduleGraph.invalidateAll();const c=new vp(s.url||"",`http://${s.headers.host}`);if(c.pathname==="/api/v1/block-config"&&s.method==="GET"){const u=c.searchParams.get("section");if(!u){i.statusCode=400,i.setHeader("Content-Type","application/json"),i.end(JSON.stringify({error:"Missing blockId parameter"}));return}try{const h=await Ru(),f=(await $u(h)).blocks.find(y=>y.id===u);i.statusCode=200,i.setHeader("Content-Type","application/json"),i.end(JSON.stringify(f))}catch(h){i.statusCode=500,i.setHeader("Content-Type","application/json"),i.end(JSON.stringify({error:h.message}))}return}a()})}}}let Kt=null;function xP(){Kt&&Kt.clients.forEach(e=>{e.readyState===zp.OPEN&&e.send(JSON.stringify({type:"full-reload"}))})}async function AP(e,s){const i=G(`${e}/ssr-server.ts`),a=G(s);await ht({build:{lib:{entry:i,formats:["es"],fileName:()=>"ssr-server.mjs"},outDir:a,emptyOutDir:!1,minify:!1,rollupOptions:{external:["http","fs","@swc/core","module-from-string","linkedom"],output:{entryFileNames:"ssr-server.mjs"}},target:"esnext"}})}async function PP(e,s){const i=G(`${e}/shared/preview.ts`),a=G(`${e}/shared/utils.ts`),c=G(`${e}/shared/api-routes.ts`),u=G(s);await ht({build:{lib:{entry:i,formats:["es"],fileName:()=>"preview.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await ht({build:{lib:{entry:a,formats:["es"],fileName:()=>"utils.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await ht({build:{lib:{entry:c,formats:["es"],fileName:()=>"api-routes.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{external:["path","fs","http","https","url","stream","util","events","buffer"],output:{entryFileNames:"api-routes.js"}},target:"esnext"}})}async function wP(){const e="preview",s=`${e}/shared`,i="vite.config.js",a=`${e}/sections`,c=`${a}/preview.html`;[e,a].forEach(y=>{ee.existsSync(y)||ee.mkdirSync(y,{recursive:!0})});const u=ct("template/preview");ee.copyFileSync(`${u}/${i}`,`${e}/${i}`),await AP(u,e),ee.copyFileSync(`${u}/sections/preview.html`,c);const h=`${u}/assets`,f=`${e}/assets`;ee.existsSync(h)&&(ee.mkdirSync(f,{recursive:!0}),ee.readdirSync(h).forEach(y=>{ee.copyFileSync(`${h}/${y}`,`${f}/${y}`)})),ee.existsSync(s)||ee.mkdirSync(s),await PP(u,s)}function CP(e){const s=e.replace(/\\/g,"/").match(/(?:sections|headers|footers)\/([^/]+)/);return s?s[1]:null}function _P(e){const s=e.replace(/\\/g,"/");return s.includes("shared")&&!s.includes("sections")&&!s.includes("headers")&&!s.includes("footers")}async function vP(e){const s=(await Fu()).find(a=>a.name===e);if(!s){console.warn(`Block ${e} not found, falling back to full build`),await Xi(!0);return}const i=Du(s);await Lu([i]),console.log(`Block ${e} rebuilt successfully`)}var NP=(e=>(e.FULL="full",e.INCREMENTAL="incremental",e))(NP||{});function OP(){return{timeout:null,inProgress:!1,pendingBuild:null}}function LP(e,s){const i=async a=>{e.inProgress=!0;try{a.type==="incremental"&&a.blockName?await vP(a.blockName):await Xi(!0),s.ws.send({type:"full-reload",path:"*"}),xP()}catch(c){console.error("Build error:",c)}finally{if(e.inProgress=!1,e.pendingBuild){const c=e.pendingBuild;e.pendingBuild=null,setTimeout(()=>i(c),0)}}};return async a=>{if(e.inProgress){a.type==="full"||e.pendingBuild?.type==="full"?e.pendingBuild={type:"full"}:e.pendingBuild=a;return}await i(a)}}function DP(e){const s=e.replace(/\\/g,"/"),i=s.match(/sections\/([^/]+)/),a=s.match(/headers\/([^/]+)/),c=s.match(/footers\/([^/]+)/),u=s.match(/shared\//);return!!(i||a||c||u)}function kP(e,s){return async i=>{if(!DP(i))return;e.timeout&&clearTimeout(e.timeout);const a=CP(i),c=_P(i);e.timeout=setTimeout(async()=>{c?await s({type:"full"}):a&&await s({type:"incremental",blockName:a})},1e3)}}function RP(e,s){const i=OP(),a=LP(i,e),c=kP(i,a);e.watcher.add(s),e.watcher.on("add",c),e.watcher.on("change",c),e.watcher.on("unlink",c)}async function MP(){const e=Se.resolve(process.cwd(),"preview/ssr-server.mjs");if(!ee.existsSync(e))throw console.warn(`\u26A0\uFE0F SSR server not found at ${e}`),new Error(`SSR server not found at ${e}`);process.env.PREVIEW_SSR_PORT="0";let s=e;process.platform==="win32"&&(s=Ja(e).href);const i=await import(s),{server:a,port:c}=await i.startServer();return{server:a,port:c}}function $P(){Kt=new jp({port:0}),Kt.on("listening",()=>{const e=Kt?.address();if(e&&typeof e=="object"){const s=e.port;process.env.CRANE_WEBSOCKET_PORT=String(s)}})}async function FP(){const e=Se.resolve(process.cwd(),"preview/vite.config.js"),s=Se.resolve(process.cwd(),"sections/**/*"),i=Se.resolve(process.cwd(),"headers/**/*"),a=Se.resolve(process.cwd(),"footers/**/*"),c=Se.resolve(process.cwd(),"shared/**/*"),u=await wp({configFile:e,root:process.cwd(),plugins:[IP()]});return await u.listen(),RP(u,[s,i,a,c]),u}async function BP(){await Xi(),await wP(),console.log(`
|
|
82
82
|
\u{1F4E6} Starting preview servers...
|
|
83
|
-
`);let e=null,s=null;
|
|
84
|
-
The pulled source code defines npm overrides not present in your project:`);for(const[i,a]of s)
|
|
85
|
-
The pulled source code uses ${a.length} ${c} not found in your project:`);const u=a.filter(y=>!y.isDev),h=a.filter(y=>y.isDev);if(u.length>0){
|
|
86
|
-
`),
|
|
87
|
-
Run the following command(s) to install the dependencies:`);for(const y of f)
|
|
83
|
+
`);let e=null,s=null;bP("Starting SSR server");const i=await MP();e=i.server,s=i.port,process.env.PREVIEW_SSR_PORT=String(s),$P();const a=await FP(),c=()=>{e&&e.close(),Kt&&Kt.close(),a.close(),process.exit(0)};return process.on("SIGINT",c),process.on("SIGTERM",c),a}const UP=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i,jP=/^[-a-zA-Z0-9_.^~<>=|* +]+$/;function Wu({name:e,version:s}){return UP.test(e)&&jP.test(s)}function er(e){if(!ke(e))return{dependencies:{},devDependencies:{},overrides:{}};let s;try{s=JSON.parse(Ar(e,"utf-8"))}catch{return{dependencies:{},devDependencies:{},overrides:{}}}const i=s.overrides??{},a=Object.fromEntries(Object.entries(i).filter(c=>typeof c[1]=="string"));return{dependencies:s.dependencies??{},devDependencies:s.devDependencies??{},overrides:a}}function zP(e,s){const i=er(We(e,"package.json")),a=er(We(s,"package.json")),c={...a.dependencies,...a.devDependencies},u=[];for(const[h,f]of Object.entries(i.dependencies))c[h]||u.push({name:h,version:f,isDev:!1});for(const[h,f]of Object.entries(i.devDependencies))c[h]||u.push({name:h,version:f,isDev:!0});return u.sort((h,f)=>h.name.localeCompare(f.name))}function VP(e,s){const i=er(We(e,"package.json")).overrides,a=er(We(s,"package.json")).overrides;return Object.fromEntries(Object.entries(i).filter(([c,u])=>a[c]!==u))}function GP(e){const s=Object.entries(e);if(s.length!==0){N.warn(`
|
|
84
|
+
The pulled source code defines npm overrides not present in your project:`);for(const[i,a]of s)N.warn(` - ${i}: "${a}"`);N.warn('Review these and add them to your package.json "overrides" section if needed.')}}function Ku(e){return e.map(s=>`${s.name}@${s.version}`).join(" ")}function HP(e){const s=e.filter(c=>!c.isDev),i=e.filter(c=>c.isDev),a=[];return s.length>0&&a.push(`npm install ${Ku(s)}`),i.length>0&&a.push(`npm install -D ${Ku(i)}`),a}function ZP(e,s){const i=[{args:["install"],specs:e.filter(a=>!a.isDev).map(a=>`${a.name}@${a.version}`)},{args:["install","-D"],specs:e.filter(a=>a.isDev).map(a=>`${a.name}@${a.version}`)}];for(const{args:a,specs:c}of i){if(c.length===0)continue;const u=[...a,...c];N.info(`Running: npm ${u.join(" ")}`);const h=Gp("npm",u,{cwd:s,stdio:"inherit"});if(h.status!==0)throw new Error(`npm ${a.join(" ")} exited with code ${h.status}`)}}async function WP(e,s){if(e.length===0)return;const i=e.filter(y=>!Wu(y));if(i.length>0){N.warn("Skipping dependencies with unsafe names/versions:");for(const y of i)N.warn(` - ${y.name}@${y.version}`)}const a=e.filter(Wu);if(a.length===0)return;const c=a.length===1?"dependency":"dependencies";N.warn(`
|
|
85
|
+
The pulled source code uses ${a.length} ${c} not found in your project:`);const u=a.filter(y=>!y.isDev),h=a.filter(y=>y.isDev);if(u.length>0){N.warn(" dependencies:");for(const y of u)N.warn(` - ${y.name}@${y.version}`)}if(h.length>0){N.warn(" devDependencies:");for(const y of h)N.warn(` - ${y.name}@${y.version}`)}const f=HP(a);switch((await Qt({type:"select",name:"value",message:"How would you like to handle these dependencies?",choices:[{title:"Install dependencies now",value:"install",description:`Runs: ${f.join(" && ")}`},{title:"Add to package.json without installing",value:"add"},{title:"Show install command (copy & run later)",value:"show"},{title:"Skip",value:"skip"}],initial:0})).value){case"install":try{ZP(a,s),N.info("Dependencies installed successfully.")}catch{N.error("Failed to install dependencies. You can try running the commands manually:");for(const y of f)N.warn(` ${y}`)}break;case"add":{const y=We(s,"package.json"),T=JSON.parse(Ar(y,"utf-8"));if(u.length>0){T.dependencies||(T.dependencies={});for(const I of u)T.dependencies[I.name]=I.version;T.dependencies=Object.fromEntries(Object.entries(T.dependencies).sort(([I],[A])=>I.localeCompare(A)))}if(h.length>0){T.devDependencies||(T.devDependencies={});for(const I of h)T.devDependencies[I.name]=I.version;T.devDependencies=Object.fromEntries(Object.entries(T.devDependencies).sort(([I],[A])=>I.localeCompare(A)))}wr(y,`${JSON.stringify(T,null,2)}
|
|
86
|
+
`),N.info('Dependencies added to package.json. Run "npm install" to install them.');break}case"show":N.info(`
|
|
87
|
+
Run the following command(s) to install the dependencies:`);for(const y of f)N.info(` ${y}`);break;default:N.info("Skipping dependency installation.");break}}async function KP(e,s,i){const a=s.split("_").pop()??s,c=We(e,"sections",a),u=We(e,a);let h=null;if(ke(c)&&ws(c).isDirectory()?h=c:ke(u)&&ws(u).isDirectory()&&(h=u),h){const f=We(i,a);ke(f)&&((await Qt({type:"confirm",name:"value",message:`Section directory [sections/${a}/] already exists. Do you want to overwrite it?`,initial:!1})).value||(N.error("Operation cancelled. Section directory already exists."),Ie.exit(1)),N.info(`Deleting existing section directory [sections/${a}/]...`),Za(f,{recursive:!0,force:!0})),N.info(`Copying section [sections/${a}/]...`),await Ji(h,f,!1)}else N.error(`Section directory [sections/${a}/] not found in source code.`),Ie.exit(1)}async function qP(e,s,i){const a=Ep(We(Vp.tmpdir(),"crane-source-"));new Ya(Buffer.from(e)).extractAllTo(a,!0);try{const c=Ie.cwd(),u=We(c,"sections");ke(u)||Tp(u,{recursive:!0}),await KP(a,s,u);const h=We(a,"shared");if(ke(h)){const y=We(c,"shared");N.info("Copying shared folder..."),await Ji(h,y,!0)}const f=zP(a,c);await WP(f,c),GP(VP(a,c)),N.info(`Source code for section [${i}] has been copied.`)}finally{Za(a,{recursive:!0,force:!0})}}async function qu(e){const s=e??vn,i=vr.create({baseURL:s}),a=await Gi();return[...(await i.get("/api/v1/custom-apps/manifests/collections/sections",{params:{appClientId:a.appClientId},headers:{Authorization:`Bearer ${a.appSecretKey}`}})).data.sections]}async function YP(e,s){const i=(await qu(s)).find(a=>a.sectionId===e);return i||(N.error(`Section [${e}] not found in collection sections list.`),Ie.exit(1)),i}async function XP(e,s,i){const a=i??vn,c=vr.create({baseURL:a}),u=await Gi();N.info(`Downloading source code for section [${e}]...`);const h=await c.get(`/api/v1/custom-apps/manifests/collections/sections/${e}/source-code`,{params:{appClientId:u.appClientId},headers:{Authorization:`Bearer ${u.appSecretKey}`},responseType:"arraybuffer"});await qP(h.data,s,e)}async function JP(e){try{N.info("Fetching sections list...");const s=await qu(e);N.info("Sections list retrieved successfully:");const i=s.map(a=>({sectionId:a.sectionId,openSource:a.openSource,type:a.type}));console.log(JSON.stringify({sections:i},null,2))}catch(s){N.error(Zt(s,"Error while fetching sections list")),Ie.exit(1)}}async function QP(e,s){try{const i=await YP(e,s);i.openSource||(N.error(`Section [${e}] is not open source. Only open source sections can be pulled.`),Ie.exit(1)),await XP(e,i.sectionId,s)}catch(i){N.error(Zt(i,"Error while pulling section")),Ie.exit(1)}}async function ew(e,s){const{list:i,section:a}=e;if(i){await JP(s);return}if(a){await QP(a,s);return}N.error("Please specify an action. Use --list to fetch sections list or --section to pull a section."),Ie.exit(1)}const tw={deploy:["url"],pull:["url"],init:[""],build:["generatePreview"]},sw=["preview","build","deploy","pull"];function iw(e,s){return sw.includes(e.rawName)?!1:e.options.length!==0&&Object.keys(s).length===1}function rw(e){return e.includes("-h")||e.includes("--help")}function nw(e,s){return Object.keys(s).some(i=>i!=="--"&&!e.hasOption(i)&&!tw[e.rawName]?.includes(i))}function aw(e){return e.length!==0}function ow(e,s,i){return e.matchedCommand!==void 0&&(iw(e.matchedCommand,i)||rw(e.rawArgs)||nw(e.matchedCommand,e.options)||aw(s))}function cw(e,s,i){e.matchedCommand&&!ow(e,s,i)?e.runMatchedCommand():e.outputHelp()}function tr(e){if(iI(e))return console.log("Please specify a name for your resource."),!1;const{isValid:s,errorMessage:i}=sI(e);return i&&console.log(i),s}async function Un(e){const s=await Qt({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(s.name!==void 0){const i=Se.basename(s.name);return tr(i)?i:Un(e)}}async function lw(e,s,i,a){const c=await Un(s);return c===void 0?(console.log(`You can use ${i} to directly specify the name of the ${s}.`),e.outputHelp()):a(c)}async function Es(e,s,i,a,c){if(c!==void 0)if(!tr(c))await lw(e,s,i,a);else{const u=Se.basename(c.toString());await a(u)}}function uw(){ee.existsSync("./templates")||(N.error(`No template found. Please create a template first using ${et("init --template <name>")}`),process.exit(1));const e=ee.readdirSync("./templates",{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name).filter(s=>s!=="assets");return e.length===0&&(N.error(`No template found. Please create a template first using ${et("init --template <name>")}`),process.exit(1)),e}async function hw(e){const s=uw();if(typeof e=="string"||typeof e=="number"){if(s.includes(e.toString()))return e.toString();tr(e)?N.warn(`Template [${e}] doesn't exist`):N.error(`[${e}] is an invalid template name.`)}const i=await Qt({type:"select",name:"choice",message:"Please choose a template:",choices:s.map(a=>({title:a,value:a}))});return i.choice||(N.error("No template selected"),process.exit(1)),i.choice}async function pw(e,s){if(typeof s=="string"||typeof s=="number"){if(tr(s))return s.toString();N.error(`${s} is invalid name.`)}return Un(e)}async function dw(e,s,i){const a=await hw(s),c=await pw("page",i);if(c===void 0)return console.log(`You can use ${et("init --page <name>")} to directly specify the name of the page.`),e.outputHelp();await eP(a,c)}async function fw(e,s){try{const{app:i,section:a,header:c,footer:u,template:h,referenceTemplate:f,page:y,blank:T,collection:I}=e;await Es(s,"app",et("init --app <name>"),WA,i),await Es(s,"section",et(`init --section <name>${T?" --blank":""}`),A=>qA(A,T===!0),a),await Es(s,"header",et("init --header <name>"),QA,c),await Es(s,"footer",et("init --footer <name>"),JA,u),y===void 0?await Es(s,"template",et("init --template <name>"),iP,h):await dw(s,h,y),await Es(s,"collection",et("init --collection <name>"),XA,I),f&&await tP()}catch(i){N.error(`Error while executing init operation: ${i.message}`),process.exit(1)}}function mw(){try{const e=bp("crane");e.option("-h, --help","Display this message"),e.command("init","Initialize a new resource in the form of a directory.").option("--app [name]","Creates an app folder inside your current directory.").option("--section [name]","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header [name]","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer [name]","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template [name]","Creates the directory and files necessary to build a custom template inside your app folder.").option("--collection [name]","Creates a collection folder containing custom sections, headers, and footers.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").option("--page [name]","Create the file necessary for one custom page with the given name, this can be repeated for each custom page.").option("--blank","Creates an empty resource with minimal files (use with section).").allowUnknownOptions().action(async i=>fw(i,e)),e.command("build","Builds your resource code").option("-v, --verbose","Show detailed build output").allowUnknownOptions().action(i=>Xi(!1,i.verbose===!0)),e.command("preview","Runs a local server to preview resources").option("--verbose","Show debug logs").allowUnknownOptions().action(async i=>{i.verbose&&TP(),await BP()}),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>EP(e.options.url)),e.command("pull","Pulls resources from the API").option("--list","Fetches the list of sections from the API").option("--section [name]","Downloads source code for an open source section").allowUnknownOptions().action(async i=>ew(i,e.options.url)),e.version(Hp),e.usage("<action> <resource>");const s=e.parse(process.argv,{run:!1});cw(e,s.args,s.options)}catch(e){N.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{mw as run};
|