@lightspeed/crane 3.5.1-rc.1 → 3.6.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 +9 -1
- package/dist/cli.mjs +42 -42
- package/package.json +2 -2
- package/template/announcement-bars/example-announcement-bar/ExampleAnnouncementBar.vue +35 -0
- package/template/announcement-bars/example-announcement-bar/assets/example_announcement_bar_showcase_1_preview.png +0 -0
- package/template/announcement-bars/example-announcement-bar/assets/example_announcement_bar_showcase_2_preview.png +0 -0
- package/template/announcement-bars/example-announcement-bar/client.ts +6 -0
- package/template/announcement-bars/example-announcement-bar/server.ts +6 -0
- package/template/announcement-bars/example-announcement-bar/settings/content.ts +8 -0
- package/template/announcement-bars/example-announcement-bar/settings/design.ts +16 -0
- package/template/announcement-bars/example-announcement-bar/settings/layout.ts +1 -0
- package/template/announcement-bars/example-announcement-bar/settings/translations.ts +17 -0
- package/template/announcement-bars/example-announcement-bar/showcases/1.ts +33 -0
- package/template/announcement-bars/example-announcement-bar/showcases/2.ts +33 -0
- package/template/announcement-bars/example-announcement-bar/showcases/translations.ts +17 -0
- package/template/announcement-bars/example-announcement-bar/type.ts +5 -0
- package/template/preview/sections/preview.html +1 -0
- package/template/preview/shared/preview.ts +4 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
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.1-rc.1";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(`
|
|
1
|
+
import*as Qs from"fs";import ee,{existsSync as Oe,readFileSync as _r,statSync as ws,promises as Nr,writeFileSync as vr,createReadStream as Tp,mkdtempSync as Sp,mkdirSync as bp,rmSync as Ka}from"fs";import*as ei from"path";import Te,{resolve as V,dirname as qa,relative as Ya,basename as Ip,sep as Or,parse as Xa,join as We}from"path";import xp from"cac";import{green as Ke,yellow as Ap,red as Pp,gray as wp}from"kolorist";import es from"prompts";import Ja from"adm-zip";import{glob as Z,globSync as Qa}from"glob";import tt from"typescript";import{normalizePath as Cp,build as pt,defineConfig as ti,createServer as _p}from"vite";import"vue";import"vue/server-renderer";import*as Ie from"process";import si from"process";import{JSONPath as Np}from"jsonpath-plus";import{readFile as Lr,writeFile as vp}from"fs/promises";import{pathToFileURL as eo,URL as Op}from"url";import Dr,{AxiosError as to}from"axios";import Lp from"tinycolor2";import{ButtonTypeEnum as ii}from"@lightspeed/crane-api";import{builtinModules as so}from"module";import{viteExternalsPlugin as io}from"vite-plugin-externals";import Dp from"vite-plugin-compression";import kp from"@vitejs/plugin-vue";import Rp from"vite-tsconfig-paths";import Mp from"vite-plugin-checker";import{encode as $p}from"@jridgewell/sourcemap-codec";import{promisify as ro}from"node:util";import no from"node:zlib";import be from"node:process";import Fp from"micromatch";import Re from"node:path";import{fileURLToPath as Bp}from"node:url";import me from"node:fs";import{ConcurrencyManager as Up}from"axios-concurrency";import{inc as jp}from"semver";import zp from"cli-progress";import{WebSocketServer as Vp,WebSocket as Gp}from"ws";import*as Hp from"os";import{spawnSync as Zp}from"child_process";const Wp="3.6.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 ts extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ao extends Error{constructor(s){super(`Encountered unidirectional transform during encode: ${s}`),this.name="ZodEncodeError"}}const kr={};function dt(e){return e&&Object.assign(kr,e),kr}function oo(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 Rr(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 Mr(e){return e==null}function $r(e){const s=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(s,i)}function Kp(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 co=Symbol("evaluating");function re(e,s,i){let a;Object.defineProperty(e,s,{get(){if(a!==co)return a===void 0&&(a=co,a=i()),a},set(c){Object.defineProperty(e,s,{value:c})},configurable:!0})}function Bt(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 lo(e){return JSON.stringify(e)}function qp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const uo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Cs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Yp=ri(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ss(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 ho(e){return ss(e)?{...e}:Array.isArray(e)?[...e]:e}const Xp=new Set(["string","number","symbol"]);function is(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 Jp(e){return Object.keys(e).filter(s=>e[s]._zod.optin==="optional"&&e[s]._zod.optout==="optional")}const Qp={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 ed(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 Bt(this,"shape",h),h},checks:[]});return _t(e,u)}function td(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 Bt(this,"shape",h),h},checks:[]});return _t(e,u)}function sd(e,s){if(!ss(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 Bt(this,"shape",u),u}});return _t(e,c)}function id(e,s){if(!ss(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 Bt(this,"shape",a),a}});return _t(e,i)}function rd(e,s){const i=Ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...s._zod.def.shape};return Bt(this,"shape",a),a},get catchall(){return s._zod.def.catchall},checks:[]});return _t(e,i)}function nd(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 Bt(this,"shape",y),y},checks:[]});return _t(s,h)}function ad(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 Bt(this,"shape",u),u}});return _t(s,a)}function rs(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 ns(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 Nt(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 Fr(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 po=(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,Rr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fo=P("$ZodError",po),mo=P("$ZodError",po,{Parent:Error});function od(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 cd(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 Br=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 ts;if(h.issues.length){const f=new(c?.Err??e)(h.issues.map(y=>Nt(y,u,dt())));throw uo(f,c?.callee),f}return h.value},Ur=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,dt())));throw uo(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 ts;return u.issues.length?{success:!1,error:new(e??fo)(u.issues.map(h=>Nt(h,c,dt())))}:{success:!0,data:u.value}},ld=ai(mo),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=>Nt(h,c,dt())))}:{success:!0,data:u.value}},ud=oi(mo),hd=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Br(e)(s,i,c)},pd=e=>(s,i,a)=>Br(e)(s,i,a),dd=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ur(e)(s,i,c)},fd=e=>async(s,i,a)=>Ur(e)(s,i,a),md=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ai(e)(s,i,c)},yd=e=>(s,i,a)=>ai(e)(s,i,a),gd=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return oi(e)(s,i,c)},Ed=e=>async(s,i,a)=>oi(e)(s,i,a),Td=/^[cC][^\s-]{8,}$/,Sd=/^[0-9a-z]+$/,bd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Id=/^[0-9a-vA-V]{20}$/,xd=/^[A-Za-z0-9]{27}$/,Ad=/^[a-zA-Z0-9_-]{21}$/,Pd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,wd=/^([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})$/,yo=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)$/,Cd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_d="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Nd(){return new RegExp(_d,"u")}const vd=/^(?:(?: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])$/,Od=/^(([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}|:))$/,Ld=/^((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])$/,Dd=/^(([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])$/,kd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,go=/^[A-Za-z0-9_-]*$/,Rd=/^\+[1-9]\d{6,14}$/,Eo="(?:(?:\\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])))",Md=new RegExp(`^${Eo}$`);function To(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 $d(e){return new RegExp(`^${To(e)}$`)}function Fd(e){const s=To({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(`^${Eo}T(?:${a})$`)}const Bd=e=>{const s=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${s}$`)},Ud=/^-?\d+$/,So=/^-?\d+(?:\.\d+)?$/,jd=/^(?:true|false)$/i,zd=/^[^A-Z]*$/,Vd=/^[^a-z]*$/,Fe=P("$ZodCheck",(e,s)=>{var i;e._zod??(e._zod={}),e._zod.def=s,(i=e._zod).onattach??(i.onattach=[])}),bo={number:"number",bigint:"bigint",object:"date"},Io=P("$ZodCheckLessThan",(e,s)=>{Fe.init(e,s);const i=bo[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})}}),xo=P("$ZodCheckGreaterThan",(e,s)=>{Fe.init(e,s);const i=bo[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})}}),Gd=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):Kp(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})}}),Hd=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]=Qp[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=Ud)}),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})}}),Zd=P("$ZodCheckMaxLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!Mr(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=Fr(c);a.issues.push({origin:h,code:"too_big",maximum:s.maximum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),Wd=P("$ZodCheckMinLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!Mr(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=Fr(c);a.issues.push({origin:h,code:"too_small",minimum:s.minimum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),Kd=P("$ZodCheckLengthEquals",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!Mr(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=Fr(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=()=>{})}),qd=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})}}),Yd=P("$ZodCheckLowerCase",(e,s)=>{s.pattern??(s.pattern=zd),ci.init(e,s)}),Xd=P("$ZodCheckUpperCase",(e,s)=>{s.pattern??(s.pattern=Vd),ci.init(e,s)}),Jd=P("$ZodCheckIncludes",(e,s)=>{Fe.init(e,s);const i=is(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})}}),Qd=P("$ZodCheckStartsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`^${is(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})}}),ef=P("$ZodCheckEndsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`.*${is(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})}}),tf=P("$ZodCheckOverwrite",(e,s)=>{Fe.init(e,s),e._zod.check=i=>{i.value=s.tx(i.value)}});class sf{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
|
|
3
|
+
`))}}const rf={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=rf;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=rs(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 ts;if(I||R instanceof Promise)I=(I??Promise.resolve()).then(async()=>{await R,h.issues.length!==L&&(T||(T=rs(h,L)))});else{if(h.issues.length===L)continue;T||(T=rs(h,L))}}return I?I.then(()=>h):h},u=(h,f,y)=>{if(rs(h))return h.aborted=!0,h;const T=c(f,a,y);if(T instanceof Promise){if(y.async===!1)throw new ts;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 ts;return y.then(T=>c(T,a,f))}return c(y,a,f)}}re(e,"~standard",()=>({validate:c=>{try{const u=ld(e,c);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return ud(e,c).then(h=>h.success?{value:h.data}:{issues:h.error?.issues})}},vendor:"zod",version:1}))}),jr=P("$ZodString",(e,s)=>{ye.init(e,s),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Bd(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),jr.init(e,s)}),nf=P("$ZodGUID",(e,s)=>{s.pattern??(s.pattern=wd),de.init(e,s)}),af=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=yo(a))}else s.pattern??(s.pattern=yo());de.init(e,s)}),of=P("$ZodEmail",(e,s)=>{s.pattern??(s.pattern=Cd),de.init(e,s)}),cf=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})}}}),lf=P("$ZodEmoji",(e,s)=>{s.pattern??(s.pattern=Nd()),de.init(e,s)}),uf=P("$ZodNanoID",(e,s)=>{s.pattern??(s.pattern=Ad),de.init(e,s)}),hf=P("$ZodCUID",(e,s)=>{s.pattern??(s.pattern=Td),de.init(e,s)}),pf=P("$ZodCUID2",(e,s)=>{s.pattern??(s.pattern=Sd),de.init(e,s)}),df=P("$ZodULID",(e,s)=>{s.pattern??(s.pattern=bd),de.init(e,s)}),ff=P("$ZodXID",(e,s)=>{s.pattern??(s.pattern=Id),de.init(e,s)}),mf=P("$ZodKSUID",(e,s)=>{s.pattern??(s.pattern=xd),de.init(e,s)}),yf=P("$ZodISODateTime",(e,s)=>{s.pattern??(s.pattern=Fd(s)),de.init(e,s)}),gf=P("$ZodISODate",(e,s)=>{s.pattern??(s.pattern=Md),de.init(e,s)}),Ef=P("$ZodISOTime",(e,s)=>{s.pattern??(s.pattern=$d(s)),de.init(e,s)}),Tf=P("$ZodISODuration",(e,s)=>{s.pattern??(s.pattern=Pd),de.init(e,s)}),Sf=P("$ZodIPv4",(e,s)=>{s.pattern??(s.pattern=vd),de.init(e,s),e._zod.bag.format="ipv4"}),bf=P("$ZodIPv6",(e,s)=>{s.pattern??(s.pattern=Od),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})}}}),If=P("$ZodCIDRv4",(e,s)=>{s.pattern??(s.pattern=Ld),de.init(e,s)}),xf=P("$ZodCIDRv6",(e,s)=>{s.pattern??(s.pattern=Dd),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 Ao(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Af=P("$ZodBase64",(e,s)=>{s.pattern??(s.pattern=kd),de.init(e,s),e._zod.bag.contentEncoding="base64",e._zod.check=i=>{Ao(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!s.abort})}});function Pf(e){if(!go.test(e))return!1;const s=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),i=s.padEnd(Math.ceil(s.length/4)*4,"=");return Ao(i)}const wf=P("$ZodBase64URL",(e,s)=>{s.pattern??(s.pattern=go),de.init(e,s),e._zod.bag.contentEncoding="base64url",e._zod.check=i=>{Pf(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!s.abort})}}),Cf=P("$ZodE164",(e,s)=>{s.pattern??(s.pattern=Rd),de.init(e,s)});function _f(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 Nf=P("$ZodJWT",(e,s)=>{de.init(e,s),e._zod.check=i=>{_f(i.value,s.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!s.abort})}}),Po=P("$ZodNumber",(e,s)=>{ye.init(e,s),e._zod.pattern=e._zod.bag.pattern??So,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}}),vf=P("$ZodNumberFormat",(e,s)=>{Hd.init(e,s),Po.init(e,s)}),Of=P("$ZodBoolean",(e,s)=>{ye.init(e,s),e._zod.pattern=jd,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}}),Lf=P("$ZodUnknown",(e,s)=>{ye.init(e,s),e._zod.parse=i=>i}),Df=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 wo(e,s,i){e.issues.length&&s.issues.push(...ns(i,e.issues)),s.value[i]=e.value}const kf=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=>wo(T,i,h))):wo(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(...ns(i,e.issues))}e.value===void 0?i in a&&(s.value[i]=void 0):s.value[i]=e.value}function Co(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=Jp(e.shape);return{...e,keys:s,keySet:new Set(s),numKeys:s.length,optionalKeys:new Set(i)}}function _o(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 Rf=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(()=>Co(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?_o(I,T,f,y,a.value,e):I.length?Promise.all(I).then(()=>f):f}}),Mf=P("$ZodObjectJIT",(e,s)=>{Rf.init(e,s);const i=e._zod.parse,a=ri(()=>Co(s)),c=L=>{const R=new sf(["shape","payload","ctx"]),oe=a.value,le=$e=>{const we=lo($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],ve=lo($e),Yt=L[$e]?._zod?.optout==="optional";R.write(`const ${we} = ${le($e)};`),Yt?R.write(`
|
|
4
4
|
if (${we}.issues.length) {
|
|
5
|
-
if (${
|
|
5
|
+
if (${ve} in input) {
|
|
6
6
|
payload.issues = payload.issues.concat(${we}.issues.map(iss => ({
|
|
7
7
|
...iss,
|
|
8
|
-
path: iss.path ? [${
|
|
8
|
+
path: iss.path ? [${ve}, ...iss.path] : [${ve}]
|
|
9
9
|
})));
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
if (${we}.value === undefined) {
|
|
14
|
-
if (${
|
|
15
|
-
newResult[${
|
|
14
|
+
if (${ve} in input) {
|
|
15
|
+
newResult[${ve}] = undefined;
|
|
16
16
|
}
|
|
17
17
|
} else {
|
|
18
|
-
newResult[${
|
|
18
|
+
newResult[${ve}] = ${we}.value;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
`):R.write(`
|
|
22
22
|
if (${we}.issues.length) {
|
|
23
23
|
payload.issues = payload.issues.concat(${we}.issues.map(iss => ({
|
|
24
24
|
...iss,
|
|
25
|
-
path: iss.path ? [${
|
|
25
|
+
path: iss.path ? [${ve}, ...iss.path] : [${ve}]
|
|
26
26
|
})));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (${we}.value === undefined) {
|
|
30
|
-
if (${
|
|
31
|
-
newResult[${
|
|
30
|
+
if (${ve} in input) {
|
|
31
|
+
newResult[${ve}] = undefined;
|
|
32
32
|
}
|
|
33
33
|
} else {
|
|
34
|
-
newResult[${
|
|
34
|
+
newResult[${ve}] = ${we}.value;
|
|
35
35
|
}
|
|
36
36
|
|
|
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>
|
|
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=!kr.jitless,T=f&&Yp.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?_o([],oe,L,R,A,e):L):i(L,R):(L.issues.push({expected:"object",code:"invalid_type",input:oe,inst:e}),L)}});function No(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=>!rs(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,dt())))}),s)}const vo=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=>$r(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=>No(y,c,e,u)):No(f,c,e,u)}}),$f=P("$ZodDiscriminatedUnion",(e,s)=>{s.inclusive=!1,vo.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)}}),Ff=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])=>Oo(i,y,T)):Oo(i,u,h)}});function zr(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(ss(e)&&ss(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=zr(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=zr(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 Oo(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}),rs(e))return e;const h=zr(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 Bf=P("$ZodRecord",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value;if(!ss(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(...ns(T,A.issues)),i.value[T]=A.value})):(I.issues.length&&i.issues.push(...ns(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"&&So.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=>Nt(A,a,dt())),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(...ns(f,A.issues)),i.value[y.value]=A.value})):(I.issues.length&&i.issues.push(...ns(f,I.issues)),i.value[y.value]=I.value)}}return u.length?Promise.all(u).then(()=>i):i}}),Uf=P("$ZodEnum",(e,s)=>{ye.init(e,s);const i=oo(s.entries),a=new Set(i);e._zod.values=a,e._zod.pattern=new RegExp(`^(${i.filter(c=>Xp.has(typeof c)).map(c=>typeof c=="string"?is(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}}),jf=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"?is(a):a?is(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}}),zf=P("$ZodTransform",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new ao(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 ts;return i.value=c,i}});function Lo(e,s){return e.issues.length&&s===void 0?{issues:[],value:void 0}:e}const Do=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(`^(${$r(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=>Lo(u,i.value)):Lo(c,i.value)}return i.value===void 0?i:s.innerType._zod.run(i,a)}}),Vf=P("$ZodExactOptional",(e,s)=>{Do.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)}),Gf=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(`^(${$r(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)}),Hf=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=>ko(u,s)):ko(c,s)}});function ko(e,s){return e.value===void 0&&(e.value=s.defaultValue),e}const Zf=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))}),Wf=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=>Ro(u,e)):Ro(c,e)}});function Ro(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 Kf=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=>Nt(h,a,dt()))},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,dt()))},input:i.value}),i.issues=[]),i)}}),qf=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 Yf=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(Mo):Mo(c)}});function Mo(e){return e.value=Object.freeze(e.value),e}const Xf=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=>$o(u,i,a,e));$o(c,i,a,e)}});function $o(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 Fo;class Jf{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 Qf(){return new Jf}(Fo=globalThis).__zod_globalRegistry??(Fo.__zod_globalRegistry=Qf());const Ns=globalThis.__zod_globalRegistry;function em(e,s){return new e({type:"string",...U(s)})}function tm(e,s){return new e({type:"string",format:"email",check:"string_format",abort:!1,...U(s)})}function Bo(e,s){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...U(s)})}function sm(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...U(s)})}function im(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(s)})}function rm(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(s)})}function nm(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(s)})}function Uo(e,s){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(s)})}function am(e,s){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...U(s)})}function om(e,s){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(s)})}function cm(e,s){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...U(s)})}function lm(e,s){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(s)})}function um(e,s){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...U(s)})}function hm(e,s){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...U(s)})}function pm(e,s){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(s)})}function dm(e,s){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(s)})}function fm(e,s){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(s)})}function mm(e,s){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(s)})}function ym(e,s){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(s)})}function gm(e,s){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...U(s)})}function Em(e,s){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...U(s)})}function Tm(e,s){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...U(s)})}function Sm(e,s){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...U(s)})}function bm(e,s){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(s)})}function Im(e,s){return new e({type:"string",format:"date",check:"string_format",...U(s)})}function xm(e,s){return new e({type:"string",format:"time",check:"string_format",precision:null,...U(s)})}function Am(e,s){return new e({type:"string",format:"duration",check:"string_format",...U(s)})}function Pm(e,s){return new e({type:"number",checks:[],...U(s)})}function wm(e,s){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(s)})}function Cm(e,s){return new e({type:"boolean",...U(s)})}function _m(e){return new e({type:"unknown"})}function Nm(e,s){return new e({type:"never",...U(s)})}function jo(e,s){return new Io({check:"less_than",...U(s),value:e,inclusive:!1})}function Vr(e,s){return new Io({check:"less_than",...U(s),value:e,inclusive:!0})}function zo(e,s){return new xo({check:"greater_than",...U(s),value:e,inclusive:!1})}function Gr(e,s){return new xo({check:"greater_than",...U(s),value:e,inclusive:!0})}function Vo(e,s){return new Gd({check:"multiple_of",...U(s),value:e})}function Go(e,s){return new Zd({check:"max_length",...U(s),maximum:e})}function hi(e,s){return new Wd({check:"min_length",...U(s),minimum:e})}function Ho(e,s){return new Kd({check:"length_equals",...U(s),length:e})}function vm(e,s){return new qd({check:"string_format",format:"regex",...U(s),pattern:e})}function Om(e){return new Yd({check:"string_format",format:"lowercase",...U(e)})}function Lm(e){return new Xd({check:"string_format",format:"uppercase",...U(e)})}function Dm(e,s){return new Jd({check:"string_format",format:"includes",...U(s),includes:e})}function km(e,s){return new Qd({check:"string_format",format:"starts_with",...U(s),prefix:e})}function Rm(e,s){return new ef({check:"string_format",format:"ends_with",...U(s),suffix:e})}function as(e){return new tf({check:"overwrite",tx:e})}function Mm(e){return as(s=>s.normalize(e))}function $m(){return as(e=>e.trim())}function Fm(){return as(e=>e.toLowerCase())}function Bm(){return as(e=>e.toUpperCase())}function Um(){return as(e=>qp(e))}function jm(e,s,i){return new e({type:"array",element:s,...U(i)})}function zm(e,s,i){const a=U(i);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:s,...a})}function Vm(e,s,i){return new e({type:"custom",check:"custom",fn:s,...U(i)})}function Gm(e){const s=Hm(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 Hm(e,s){const i=new Fe({check:"custom",...U(s)});return i._zod.check=e,i}function Zo(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??Ns,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 Wo(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 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\`.
|
|
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 Ko(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 Zm=(e,s={})=>i=>{const a=Zo({...i,processors:s});return xe(e,a),Wo(a,e),Ko(a,e)},pi=(e,s,i={})=>a=>{const{libraryOptions:c,target:u}=a??{},h=Zo({...c??{},target:u,io:s,processors:i});return xe(e,h),Wo(h,e),Ko(h,e)},Wm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Km=(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=Wm[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}))])}},qm=(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)},Ym=(e,s,i,a)=>{i.type="boolean"},Xm=(e,s,i,a)=>{i.not={}},Jm=(e,s,i,a)=>{},Qm=(e,s,i,a)=>{const c=e._zod.def,u=oo(c.entries);u.every(h=>typeof h=="number")&&(i.type="number"),u.every(h=>typeof h=="string")&&(i.type="string"),i.enum=u},ey=(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},ty=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},sy=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},iy=(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"]})},ry=(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)},ny=(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},ay=(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},oy=(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)}},cy=(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"}]},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},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,i.default=JSON.parse(JSON.stringify(c.defaultValue))},hy=(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)))},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;let h;try{h=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=h},dy=(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},fy=(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},qo=(e,s,i,a)=>{const c=e._zod.def;xe(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType},my=P("ZodISODateTime",(e,s)=>{yf.init(e,s),Ee.init(e,s)});function yy(e){return bm(my,e)}const gy=P("ZodISODate",(e,s)=>{gf.init(e,s),Ee.init(e,s)});function Ey(e){return Im(gy,e)}const Ty=P("ZodISOTime",(e,s)=>{Ef.init(e,s),Ee.init(e,s)});function Sy(e){return xm(Ty,e)}const by=P("ZodISODuration",(e,s)=>{Tf.init(e,s),Ee.init(e,s)});function Iy(e){return Am(by,e)}const xy=(e,s)=>{fo.init(e,s),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>cd(e,i)},flatten:{value:i=>od(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,Rr,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,Rr,2)}},isEmpty:{get(){return e.issues.length===0}}})},qe=P("ZodError",xy,{Parent:Error}),Ay=Br(qe),Py=Ur(qe),wy=ai(qe),Cy=oi(qe),_y=hd(qe),Ny=pd(qe),vy=dd(qe),Oy=fd(qe),Ly=md(qe),Dy=yd(qe),ky=gd(qe),Ry=Ed(qe),ge=P("ZodType",(e,s)=>(ye.init(e,s),Object.assign(e["~standard"],{jsonSchema:{input:pi(e,"input"),output:pi(e,"output")}}),e.toJSONSchema=Zm(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)=>Ay(e,i,a,{callee:e.parse}),e.safeParse=(i,a)=>wy(e,i,a),e.parseAsync=async(i,a)=>Py(e,i,a,{callee:e.parseAsync}),e.safeParseAsync=async(i,a)=>Cy(e,i,a),e.spa=e.safeParseAsync,e.encode=(i,a)=>_y(e,i,a),e.decode=(i,a)=>Ny(e,i,a),e.encodeAsync=async(i,a)=>vy(e,i,a),e.decodeAsync=async(i,a)=>Oy(e,i,a),e.safeEncode=(i,a)=>Ly(e,i,a),e.safeDecode=(i,a)=>Dy(e,i,a),e.safeEncodeAsync=async(i,a)=>ky(e,i,a),e.safeDecodeAsync=async(i,a)=>Ry(e,i,a),e.refine=(i,a)=>e.check(wg(i,a)),e.superRefine=i=>e.check(Cg(i)),e.overwrite=i=>e.check(as(i)),e.optional=()=>rc(e),e.exactOptional=()=>fg(e),e.nullable=()=>nc(e),e.nullish=()=>rc(nc(e)),e.nonoptional=i=>Sg(e,i),e.array=()=>ae(e),e.or=i=>Hr([e,i]),e.and=i=>cg(e,i),e.transform=i=>oc(e,pg(i)),e.default=i=>gg(e,i),e.prefault=i=>Tg(e,i),e.catch=i=>Ig(e,i),e.pipe=i=>oc(e,i),e.readonly=()=>Pg(e),e.describe=i=>{const a=e.clone();return Ns.add(a,{description:i}),a},Object.defineProperty(e,"description",{get(){return Ns.get(e)?.description},configurable:!0}),e.meta=(...i)=>{if(i.length===0)return Ns.get(e);const a=e.clone();return Ns.add(a,i[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=i=>i(e),e)),Yo=P("_ZodString",(e,s)=>{jr.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Km(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(vm(...a)),e.includes=(...a)=>e.check(Dm(...a)),e.startsWith=(...a)=>e.check(km(...a)),e.endsWith=(...a)=>e.check(Rm(...a)),e.min=(...a)=>e.check(hi(...a)),e.max=(...a)=>e.check(Go(...a)),e.length=(...a)=>e.check(Ho(...a)),e.nonempty=(...a)=>e.check(hi(1,...a)),e.lowercase=a=>e.check(Om(a)),e.uppercase=a=>e.check(Lm(a)),e.trim=()=>e.check($m()),e.normalize=(...a)=>e.check(Mm(...a)),e.toLowerCase=()=>e.check(Fm()),e.toUpperCase=()=>e.check(Bm()),e.slugify=()=>e.check(Um())}),My=P("ZodString",(e,s)=>{jr.init(e,s),Yo.init(e,s),e.email=i=>e.check(tm($y,i)),e.url=i=>e.check(Uo(Jo,i)),e.jwt=i=>e.check(Sm(Jy,i)),e.emoji=i=>e.check(am(Fy,i)),e.guid=i=>e.check(Bo(Xo,i)),e.uuid=i=>e.check(sm(di,i)),e.uuidv4=i=>e.check(im(di,i)),e.uuidv6=i=>e.check(rm(di,i)),e.uuidv7=i=>e.check(nm(di,i)),e.nanoid=i=>e.check(om(By,i)),e.guid=i=>e.check(Bo(Xo,i)),e.cuid=i=>e.check(cm(Uy,i)),e.cuid2=i=>e.check(lm(jy,i)),e.ulid=i=>e.check(um(zy,i)),e.base64=i=>e.check(gm(qy,i)),e.base64url=i=>e.check(Em(Yy,i)),e.xid=i=>e.check(hm(Vy,i)),e.ksuid=i=>e.check(pm(Gy,i)),e.ipv4=i=>e.check(dm(Hy,i)),e.ipv6=i=>e.check(fm(Zy,i)),e.cidrv4=i=>e.check(mm(Wy,i)),e.cidrv6=i=>e.check(ym(Ky,i)),e.e164=i=>e.check(Tm(Xy,i)),e.datetime=i=>e.check(yy(i)),e.date=i=>e.check(Ey(i)),e.time=i=>e.check(Sy(i)),e.duration=i=>e.check(Iy(i))});function O(e){return em(My,e)}const Ee=P("ZodStringFormat",(e,s)=>{de.init(e,s),Yo.init(e,s)}),$y=P("ZodEmail",(e,s)=>{of.init(e,s),Ee.init(e,s)}),Xo=P("ZodGUID",(e,s)=>{nf.init(e,s),Ee.init(e,s)}),di=P("ZodUUID",(e,s)=>{af.init(e,s),Ee.init(e,s)}),Jo=P("ZodURL",(e,s)=>{cf.init(e,s),Ee.init(e,s)});function Qo(e){return Uo(Jo,e)}const Fy=P("ZodEmoji",(e,s)=>{lf.init(e,s),Ee.init(e,s)}),By=P("ZodNanoID",(e,s)=>{uf.init(e,s),Ee.init(e,s)}),Uy=P("ZodCUID",(e,s)=>{hf.init(e,s),Ee.init(e,s)}),jy=P("ZodCUID2",(e,s)=>{pf.init(e,s),Ee.init(e,s)}),zy=P("ZodULID",(e,s)=>{df.init(e,s),Ee.init(e,s)}),Vy=P("ZodXID",(e,s)=>{ff.init(e,s),Ee.init(e,s)}),Gy=P("ZodKSUID",(e,s)=>{mf.init(e,s),Ee.init(e,s)}),Hy=P("ZodIPv4",(e,s)=>{Sf.init(e,s),Ee.init(e,s)}),Zy=P("ZodIPv6",(e,s)=>{bf.init(e,s),Ee.init(e,s)}),Wy=P("ZodCIDRv4",(e,s)=>{If.init(e,s),Ee.init(e,s)}),Ky=P("ZodCIDRv6",(e,s)=>{xf.init(e,s),Ee.init(e,s)}),qy=P("ZodBase64",(e,s)=>{Af.init(e,s),Ee.init(e,s)}),Yy=P("ZodBase64URL",(e,s)=>{wf.init(e,s),Ee.init(e,s)}),Xy=P("ZodE164",(e,s)=>{Cf.init(e,s),Ee.init(e,s)}),Jy=P("ZodJWT",(e,s)=>{Nf.init(e,s),Ee.init(e,s)}),ec=P("ZodNumber",(e,s)=>{Po.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>qm(e,a,c),e.gt=(a,c)=>e.check(zo(a,c)),e.gte=(a,c)=>e.check(Gr(a,c)),e.min=(a,c)=>e.check(Gr(a,c)),e.lt=(a,c)=>e.check(jo(a,c)),e.lte=(a,c)=>e.check(Vr(a,c)),e.max=(a,c)=>e.check(Vr(a,c)),e.int=a=>e.check(st(a)),e.safe=a=>e.check(st(a)),e.positive=a=>e.check(zo(0,a)),e.nonnegative=a=>e.check(Gr(0,a)),e.negative=a=>e.check(jo(0,a)),e.nonpositive=a=>e.check(Vr(0,a)),e.multipleOf=(a,c)=>e.check(Vo(a,c)),e.step=(a,c)=>e.check(Vo(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 Pm(ec,e)}const Qy=P("ZodNumberFormat",(e,s)=>{vf.init(e,s),ec.init(e,s)});function st(e){return wm(Qy,e)}const eg=P("ZodBoolean",(e,s)=>{Of.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Ym(e,i,a)});function te(e){return Cm(eg,e)}const tg=P("ZodUnknown",(e,s)=>{Lf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Jm()});function tc(){return _m(tg)}const sg=P("ZodNever",(e,s)=>{Df.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Xm(e,i,a)});function ig(e){return Nm(sg,e)}const rg=P("ZodArray",(e,s)=>{kf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>iy(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(Go(i,a)),e.length=(i,a)=>e.check(Ho(i,a)),e.unwrap=()=>e.element});function ae(e,s){return jm(rg,e,s)}const ng=P("ZodObject",(e,s)=>{Mf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ry(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:tc()}),e.loose=()=>e.clone({...e._zod.def,catchall:tc()}),e.strict=()=>e.clone({...e._zod.def,catchall:ig()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=i=>sd(e,i),e.safeExtend=i=>id(e,i),e.merge=i=>rd(e,i),e.pick=i=>ed(e,i),e.omit=i=>td(e,i),e.partial=(...i)=>nd(ic,e,i[0]),e.required=(...i)=>ad(ac,e,i[0])});function w(e,s){const i={type:"object",shape:e??{},...U(s)};return new ng(i)}const sc=P("ZodUnion",(e,s)=>{vo.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ny(e,i,a,c),e.options=s.options});function Hr(e,s){return new sc({type:"union",options:e,...U(s)})}const ag=P("ZodDiscriminatedUnion",(e,s)=>{sc.init(e,s),$f.init(e,s)});function Ve(e,s,i){return new ag({type:"union",options:s,discriminator:e,...U(i)})}const og=P("ZodIntersection",(e,s)=>{Ff.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ay(e,i,a,c)});function cg(e,s){return new og({type:"intersection",left:e,right:s})}const lg=P("ZodRecord",(e,s)=>{Bf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>oy(e,i,a,c),e.keyType=s.keyType,e.valueType=s.valueType});function Le(e,s,i){return new lg({type:"record",keyType:e,valueType:s,...U(i)})}const Zr=P("ZodEnum",(e,s)=>{Uf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Qm(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 ug=P("ZodLiteral",(e,s)=>{jf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ey(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 ug({type:"literal",values:Array.isArray(e)?e:[e],...U(s)})}const hg=P("ZodTransform",(e,s)=>{zf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>sy(e,i),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new ao(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 pg(e){return new hg({type:"transform",transform:e})}const ic=P("ZodOptional",(e,s)=>{Do.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>qo(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function rc(e){return new ic({type:"optional",innerType:e})}const dg=P("ZodExactOptional",(e,s)=>{Vf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>qo(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function fg(e){return new dg({type:"optional",innerType:e})}const mg=P("ZodNullable",(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 nc(e){return new mg({type:"nullable",innerType:e})}const yg=P("ZodDefault",(e,s)=>{Hf.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.removeDefault=e.unwrap});function gg(e,s){return new yg({type:"default",innerType:e,get defaultValue(){return typeof s=="function"?s():ho(s)}})}const Eg=P("ZodPrefault",(e,s)=>{Zf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>hy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function Tg(e,s){return new Eg({type:"prefault",innerType:e,get defaultValue(){return typeof s=="function"?s():ho(s)}})}const ac=P("ZodNonOptional",(e,s)=>{Wf.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 Sg(e,s){return new ac({type:"nonoptional",innerType:e,...U(s)})}const bg=P("ZodCatch",(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,e.removeCatch=e.unwrap});function Ig(e,s){return new bg({type:"catch",innerType:e,catchValue:typeof s=="function"?s:()=>s})}const xg=P("ZodPipe",(e,s)=>{qf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>dy(e,i,a,c),e.in=s.in,e.out=s.out});function oc(e,s){return new xg({type:"pipe",in:e,out:s})}const Ag=P("ZodReadonly",(e,s)=>{Yf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>fy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function Pg(e){return new Ag({type:"readonly",innerType:e})}const cc=P("ZodCustom",(e,s)=>{Xf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ty(e,i)});function os(e,s){return zm(cc,e??(()=>!0),s)}function wg(e,s={}){return Vm(cc,e,s)}function Cg(e){return Gm(e)}const ft={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"},_g=ne(Object.values(ft)),mi=ft,vs={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"},Ng=ne(Object.values(vs)),yi=vs,lc={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"},vg=ne(Object.values(lc)),Og=lc,uc={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"},Lg=ne(Object.values(uc)),Dg=uc,hc={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"},kg=ne(Object.values(hc)),Rg=hc,gi={COLOR:"COLOR",GRADIENT:"GRADIENT"},Mg=ne(Object.values(gi)),Wr=gi,vt={SECTION:"SECTION",HEADER:"HEADER",FOOTER:"FOOTER",ANNOUNCEMENT_BAR:"ANNOUNCEMENT_BAR"},$g=ne(Object.values(vt)),it=vt;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||{}),Fg=(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))(Fg||{});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 Bg={TEXT:"TEXT",IMAGE:"IMAGE"},Ug=ne(Object.values(Bg));var jg=(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))(jg||{}),zg=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(zg||{});const pc={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},dc={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},fc={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(pc)),ne(Object.values(dc)),ne(Object.values(fc));const Vg={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:[]},mc=["categoryViewMode","productFiltersVisibleOnCatalogPages","productFiltersPositionOnCatalogPages","productFiltersOpenedByDefaultOnCategoryPage","productFiltersOrientationPosition","showSortViewAsOptions","productCardSpacingType","productCardLayout","imageAspectRatio","imageSize","productTitleBehavior","productSubtitleBehavior","productPriceBehavior","productListSwatchesProductOptionBehavior","productSkuBehavior","productBuyButtonBehavior","productRatingSectionBehavior","productRatingViewBehavior","showProductRatingAvg","showProductTotalNumberOfReview","showProductFrame","showProductImages","showAdditionalImageOnHover","categoryTitleBehavior"],yc=["showFooterMenu","showSigninLink"],Gg={PRODUCT_LIST:mc,BOTTOM_BAR:yc,CUSTOM_SLOT:[]},Hg={CATEGORY_TITLE:[],PRODUCT_LIST:mc,BOTTOM_BAR:yc,CUSTOM_SLOT:[]},Zg={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"},Wg=ne(Object.values(Zg)),Pe={[it.SECTION]:{source:"sections",dist:"dist/sections"},[it.HEADER]:{source:"headers",dist:"dist/headers"},[it.FOOTER]:{source:"footers",dist:"dist/footers"},[it.ANNOUNCEMENT_BAR]:{source:"announcement-bars",dist:"dist/announcement-bars"}};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 cs(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:cs(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:cs(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 Kg={url:"must be a valid URL",email:"must be a valid email address"},qg=e=>{const s=e?.at(-1);return typeof s=="string"?`'${s}'`:"Field"},Yg=e=>e===null?"null":typeof e,Xg=e=>{switch(e.code){case"invalid_type":{const{input:s}=e;return s===void 0?{message:`${qg(e.path)} is required`}:{message:`Expected ${String(e.expected)}, received ${Yg(s)}`}}case"invalid_format":{const s=Kg[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}},Jg={ARIAL:"arial",GEORGIA:"georgia",HELVETICA:"helvetica",TIMES_NEW_ROMAN:"times_new_roman"},Qg=ne(Object.values(Jg)),eE={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"},tE=ne(Object.values(eE)),sE={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"},iE=ne(Object.values(sE)),gc=Hr([Qg,tE,iE]),rE={REGULAR:"regular",MEDIUM:"medium",SEMIBOLD:"semibold",BOLD:"bold",REGULAR_ITALIC:"regular-italic",MEDIUM_ITALIC:"medium-italic",SEMIBOLD_ITALIC:"semibold-italic",BOLD_ITALIC:"bold-italic"},Ec=ne(Object.values(rE));ne(["none","all","small"]);const Ut={PRODUCT:"PRODUCT",CATALOG:"CATALOG",CATEGORY:"CATEGORY",HOME:"HOME",CUSTOM:"CUSTOM"},Tc={HOME:"home",CATALOG:"catalog",CATEGORY:"category",PRODUCT:"product"},nE=ne(Object.values(Ut));ne(Object.values(Tc));const aE={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"},oE=ne(Object.values(aE)),cE={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"},lE={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"},uE=ne(Object.values(lE)),hE={LEFT:"left",CENTER:"center"},pE=ne(Object.values(hE)),dE={SHARP:"sharp",SOFTENED:"softened",SLIGHTLY_ROUNDED:"slightly_rounded",ROUNDED:"rounded",GREATLY_ROUNDED:"greatly_rounded"},fE=ne(Object.values(dE)),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_CUSTOM_ANNOUNCEMENT_BAR:(...e)=>`Custom announcement bar section with id "${e[0]}" must exist in announcement-bars directory`,REQUIRED_CUSTOM_ANNOUNCEMENT_BAR_TYPE:(...e)=>`Custom announcement bar section with id "${e[0]}" must be of type "ANNOUNCEMENT_BAR"`,REQUIRED_PAGE_SECTION:(...e)=>`Custom section with id "${e[0]}" must exist in sections directory`,REQUIRED_PAGE_SECTION_TYPE:()=>'Section "header", "footer" or "announcement bar" 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"},Sc=/^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,bc=/^global\.fontFamily\.(title|body)$/,Ic=/^global\.textSize\.(title|subtitle|body)$/,xc=/^global\.color\.(title|body|button|link|background)$/,mE=/^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$/,Ot=(e,s)=>{const i=Be.INTEGER_RANGE(e.toString(),s.toString());return st().min(e,{message:i}).max(s,{message:i})},Kr=w({path:O(),size:fi().nonnegative()}).strict(),Ac=w({size:fi().nonnegative()}).strict(),G=O().regex(/^\$.+/,{message:"must start with '$' followed by at least one character"}),yE=w({r:Ot(0,255),g:Ot(0,255),b:Ot(0,255),a:Ot(0,1)}).strict(),Lt=O().regex(Sc,{message:Be.VALID_HEX_COLOR()});os(e=>typeof e=="string"&&bc.test(e),{message:Be.VALID_GLOBAL_FONT()});const qr=O().refine(e=>!e.startsWith("global.")||bc.test(e),{message:Be.VALID_GLOBAL_FONT()});os(e=>typeof e=="string"&&xc.test(e),{message:Be.VALID_GLOBAL_COLOR()});const rt=os(e=>typeof e=="string"&&(Sc.test(e)||xc.test(e)),{message:Be.VALID_COLOR()}),Pc=os(e=>typeof e=="string"?rt.safeParse(e).success:Array.isArray(e)&&e.every(s=>rt.safeParse(s).success),{message:Be.VALID_COLOR()});os(e=>typeof e=="string"&&Ic.test(e),{message:Be.VALID_GLOBAL_TEXT_SIZE()});const wc=os(e=>typeof e=="number"?Number.isInteger(e)&&e>=1:typeof e=="string"&&Ic.test(e),{message:Be.VALID_TEXT_SIZE()}),Ls=ne(["catalog","category","product"]),Ei=O().refine(e=>e.startsWith("#")||Qo().safeParse(e).success,{message:"must be a valid URL or a hash fragment starting with #"}),gE=e=>{const s=e.map(i=>D(i));return Hr(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(),EE=w({homogeneity:te().optional(),color:yE.optional()}).strict(),TE=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:TE,borderInfo:EE.optional()}).strict(),Yr=w({type:D(F.IMAGE),imageData:Ti}).strict(),Cc=w({type:D(F.IMAGE),label:G,static:te().optional(),defaults:Yr.optional()}).strict(),SE=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Xr(e){return e===Ut.PRODUCT||e===Ut.CATALOG||e===Ut.CATEGORY}function _c(e,s,i){if(!e)return;const a=Np({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 Nc(e,s,i){e===ft.HYPER_LINK&&!s&&i.at("link").addIssue("BUTTON_LINK_REQUIRED")}function vc(e,s,i){(e===ft.GO_TO_CATEGORY||e===ft.GO_TO_CATEGORY_LINK)&&!s&&i.at("categoryId").addIssue("BUTTON_CATEGORY_ID_REQUIRED")}function Oc(e,s,i){e===ft.MAIL_LINK&&!s&&i.at("email").addIssue("BUTTON_EMAIL_REQUIRED")}function Lc(e,s,i){e===ft.TEL_LINK&&!s&&i.at("phone").addIssue("BUTTON_PHONE_REQUIRED")}function Dc(e,s,i,a){if(e===ft.SCROLL_TO_TILE&&!(s??i)){const c=s?"tileId":"tileIdForScroll";a.at(c).addIssue("BUTTON_TILE_ID_REQUIRED",c)}}function bE(e,s,i){e===ft.GO_TO_PAGE&&!s&&i.at("pageIdForNavigate").addIssue("BUTTON_PAGE_ID_REQUIRED")}const IE="custom";function Se(e,s=[]){const i=c=>Array.isArray(c)?c:[c],a=i(s);return{raw:e,addIssue(c,...u){e.addIssue({code:IE,message:Be[c](...u),path:a,params:{errorMessageKey:c}})},at(c){const u=a.concat(i(c));return Se(e,u)}}}const Jr=w({type:D(F.BUTTON),title:G,buttonType:_g,link:O().optional(),linkTarget:O().optional(),email:O().regex(SE,{message:Be.VALID_EMAIL()}).optional(),phone:O().optional(),tileId:O().optional(),categoryId:fi().optional()}).strict().superRefine((e,s)=>{const i=Se(s);Nc(e.buttonType,e.link,i),vc(e.buttonType,e.categoryId,i),Oc(e.buttonType,e.email,i),Lc(e.buttonType,e.phone,i),Dc(e.buttonType,e.tileId,void 0,i)}),kc=w({type:D(F.BUTTON),label:G,defaults:Jr.optional()}).strict(),Qr=w({type:D(F.CATEGORY_SELECTOR)}).strict(),Rc=w({type:D(F.CATEGORY_SELECTOR),label:G,maxCategories:Ot(1,32),defaults:Qr.optional()}).strict(),en=w({type:D(F.DIVIDER)}).strict(),Mc=w({type:D(F.DIVIDER),label:G,defaults:en.optional()}).strict(),xE=w({label:G,link:Ei}).strict(),AE=w({title:G.optional(),link:Ei.optional()}).strict(),tn=w({type:D(F.INFO),text:G.optional(),button:AE.optional()}).strict(),$c=w({type:D(F.INFO),label:G,description:G,button:xE.optional(),defaults:tn.optional()}).strict(),sn=w({type:D(F.INPUTBOX),text:G}).strict(),Fc=w({type:D(F.INPUTBOX),label:G,placeholder:G,defaults:sn.optional()}).strict(),rn=w({type:D(F.PRODUCT_SELECTOR)}).strict(),Bc=w({type:D(F.PRODUCT_SELECTOR),label:G,maxProducts:Ot(1,32),defaults:rn.optional()}).strict(),nn=w({type:D(F.SELECTBOX),value:O()}).strict(),PE=w({value:O().min(1,{message:"value must not be empty"}),label:G}).strict(),Uc=w({type:D(F.SELECTBOX),label:G,placeholder:G,description:G,options:ae(PE).min(1,{message:"must have at least one option"}),defaults:nn.optional()}).strict(),an=w({type:D(F.TEXTAREA),text:G}).strict(),jc=w({type:D(F.TEXTAREA),label:G,placeholder:G,defaults:an.optional()}).strict(),on=w({type:D(F.TOGGLE),enabled:te()}).strict(),zc=w({type:D(F.TOGGLE),label:G,description:G,defaults:on.optional()}).strict(),Vc=w({type:D(F.DECK)}).strict(),Gc=[sn,an,Jr,Yr,on,nn,en,tn,rn,Qr],wE=Ve("type",[...Gc]),CE=w({type:D(F.DECK),cards:ae(w({settings:Le(O(),wE).superRefine((e,s)=>{Object.keys(e).length<1&&Se(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),_E=Ve("type",[...Gc,CE]),NE=w({type:D(F.DECK),cards:ae(w({settings:Le(O(),_E).superRefine((e,s)=>{Object.keys(e).length<1&&Se(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),Hc=[Fc,jc,kc,Cc,zc,Uc,Mc,$c,Rc,Bc],vE=w({type:D(F.DECK),label:G,addButtonLabel:G,maxCards:st().min(1,{message:"must be a positive integer"}),cards:w({defaultCardContent:w({label:G,settings:Le(O(),Ve("type",[...Hc])).superRefine((e,s)=>{Object.keys(e).length<1&&Se(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:Vc.optional()}).strict(),OE=Ve("type",[...Hc,vE]),LE=w({type:D(F.DECK),label:G,addButtonLabel:G,maxCards:st().min(1,{message:"must be a positive integer"}),cards:w({defaultCardContent:w({label:G,settings:Le(O(),OE).superRefine((e,s)=>{Object.keys(e).length<1&&Se(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:Vc.optional()}).strict(),Zc=w({type:D(F.LOGO),logoType:Ug.optional(),text:G.optional(),imageData:Ti.optional()}).strict(),DE=w({type:D(F.LOGO),label:G.optional(),defaults:Zc.optional()}).strict(),Wc=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=Se(s);Nc(e.type,e.link,i),vc(e.type,e.categoryId,i),Oc(e.type,e.email,i),Lc(e.type,e.phone,i),Dc(e.type,void 0,e.tileIdForScroll,i),bE(e.type,e.pageIdForNavigate,i)}),Kc=w({type:D(F.MENU),items:ae(Wc).optional()}).strict(),kE=w({type:D(F.MENU),label:G.optional(),defaults:Kc.optional()}).strict(),qc=w({type:D(F.NAVIGATION_MENU),items:ae(Wc).optional()}).strict(),RE=w({type:D(F.NAVIGATION_MENU),defaults:qc.optional()}).strict(),Si=w({type:D(K.BACKGROUND),style:Mg.optional(),color:Pc.optional()}).strict().superRefine((e,s)=>{const i=Se(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"))}),ME=w({type:D(K.BACKGROUND),fieldName:O(),defaults:Si.optional()}).strict(),Yc=w({type:D(K.BACKGROUND),label:G,colors:ae(rt).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Si.optional()}).strict(),bi=w({type:D(K.BUTTON),appearance:vg.optional(),size:Lg.optional(),shape:kg.optional(),font:qr.optional(),color:rt.optional(),visible:te().optional()}).strict(),$E=w({type:D(K.BUTTON),fieldName:O(),defaults:bi.optional()}).strict(),Xc=w({type:D(K.BUTTON),label:G,colors:ae(rt).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:rt.optional()}).strict(),FE=w({type:D(K.COLOR_PICKER),fieldName:O(),defaults:Ii.optional()}).strict(),Jc=w({type:D(K.COLOR_PICKER),label:G,description:G.optional(),colors:ae(rt).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Ii.optional()}).strict(),xi=w({type:D(K.DIVIDER)}).strict(),BE=w({type:D(K.DIVIDER),fieldName:O(),defaults:xi.optional()}).strict(),Qc=w({type:D(K.DIVIDER),label:G,defaults:xi.optional()}).strict(),Ai=w({type:D(K.IMAGE),overlay:Ng.optional(),color:Pc.optional(),visible:te().optional()}).strict().superRefine((e,s)=>{const i=Se(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")}),UE=w({type:D(K.IMAGE),fieldName:O(),defaults:Ai.optional()}).strict(),el=w({type:D(K.IMAGE),label:G,static:te().optional(),colors:ae(Lt).optional(),enableAlphaColor:te().optional(),hideVisibleToggle:te().optional(),defaults:Ai.optional()}).strict(),jE=w({label:G,link:Ei}).strict(),zE=w({label:G.optional(),link:Ei.optional()}).strict(),Pi=w({type:D(K.INFO),description:G.optional(),button:zE.optional()}).strict(),VE=w({type:D(K.INFO),fieldName:O(),defaults:Pi.optional()}).strict(),tl=w({type:D(K.INFO),label:G,description:G,button:jE.optional(),defaults:Pi.optional()}).strict(),GE=w({visible:te(),width:Ot(1,49).optional(),color:rt.optional()}).strict(),wi=w({type:D(K.LOGO),font:qr.optional(),size:wc.optional(),bold:te().optional(),italic:te().optional(),color:rt.optional(),visible:te().optional(),spacing:Ot(1,9).optional(),frame:GE.optional(),capitalization:ne(["none","all","small"]).optional()}).strict(),HE=w({type:D(K.LOGO),fieldName:O(),defaults:wi.optional()}).strict(),sl=w({type:D(K.LOGO),label:G,colors:ae(rt).optional(),sizes:ae(st().min(1,{message:"must be at least 1"})).optional(),defaults:wi.optional()}).strict(),ZE=w({value:O().optional(),label:G.optional()}).strict(),Ci=w({type:D(K.SELECTBOX),value:O().optional()}).strict(),WE=w({type:D(K.SELECTBOX),fieldName:O(),defaults:Ci.optional()}).strict(),il=w({type:D(K.SELECTBOX),label:G,description:G.optional(),options:ae(ZE).optional(),defaults:Ci.optional()}).strict(),_i=w({type:D(K.TEXT),font:qr.optional(),size:wc.optional(),bold:te().optional(),italic:te().optional(),color:rt.optional(),visible:te().optional()}).strict(),KE=w({type:D(K.TEXT),fieldName:O(),defaults:_i.optional()}).strict(),rl=w({type:D(K.TEXT),label:G,colors:ae(Lt).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(),Ni=w({type:D(K.TOGGLE),enabled:te().optional()}).strict(),qE=w({type:D(K.TOGGLE),fieldName:O(),defaults:Ni.optional()}).strict(),nl=w({type:D(K.TOGGLE),label:G,defaults:Ni.optional()}).strict();function YE(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_SHOWCASE_ITEMS_REQUIRED")}function XE(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 JE(e,s,i){Object.keys(e).length===0&&i.at("editors").addIssue("ACCORDION_ITEM_EDITORS_REQUIRED",s)}function QE(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_ITEMS_REQUIRED")}function eT(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 tT(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 al=w({type:D(K.ACCORDION)}).strict(),sT=Ve("type",[_i,bi,Ai,Ni,Ci,Si,Ii,wi,xi,Pi]),iT=w({editors:Le(O(),sT)}).strict(),rT=w({type:D(K.ACCORDION),items:Le(O(),iT)}).strict().superRefine((e,s)=>{const i=Se(s);YE(e.items,i),XE(e.items,i)}),nT=w({type:D(K.ACCORDION),fieldName:O(),defaults:al.optional()}).strict(),aT=Ve("type",[rl,Xc,el,nl,il,Yc,Jc,sl,Qc,tl]),oT=w({label:G,positionFieldName:O().optional(),editors:Le(O(),aT)}).strict().superRefine((e,s)=>{JE(e.editors,e.label,Se(s))}),cT=w({type:D(K.ACCORDION),sortable:te().optional(),items:Le(O(),oT),defaults:al.optional()}).strict().superRefine((e,s)=>{const i=Se(s);QE(e.items,i),e.sortable===!0&&(eT(e.items,i),tT(e.items,i))}),ol=Ve("type",[sn,an,Jr,Yr,on,nn,Kc,qc,Zc,en,tn,NE,rn,Qr]),cl=Ve("type",[_i,bi,Ai,Ni,Ci,Si,Ii,wi,xi,rT,Pi]),lT=w({showcaseId:O(),blockName:O(),previewImage:Ti,content:Le(O(),ol),design:Le(O(),cl),layoutId:O().optional()}).strict(),uT=w({blockName:O(),content:Le(O(),ol).optional(),design:Le(O(),cl).optional(),layoutId:O().optional()}).strict();function hT(e,s){Xr(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 pT(e,s){Xr(e.type)&&e.sections.length===0&&s.at("sections").addIssue("TEMPLATE_PAGE_SECTIONS_REQUIRED"),e.sections.forEach((i,a)=>{Xr(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 dT(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 fT=new RegExp(`^(${Object.values(cE).join("|")})(_\\d{3})?$`),mT=O().regex(fT,"id must match pattern: [default_section_name] or [default_section_name]_XXX where XXX is three digits"),yT=O().regex(new RegExp("\\d{3}"),"showcase_id must be a three digit string"),ll=w({type:D("default"),id:mT,showcase_id:yT.optional()}).strict(),vi=w({type:D("custom"),id:O(),showcase_id:O().optional(),showcase_overrides:uT.optional(),category:uE.optional()}).strict(),gT=vi,ET=w({type:D("store"),id:O().optional()}).strict(),TT=Ve("type",[ll,vi,ET]),ST=w({title:O()}).strict(),bT=w({metadata:ST.optional(),sections:ae(TT)}).strict(),IT=bT.safeExtend({type:nE,id:O().min(1,{message:"id is required"})}).strict().superRefine((e,s)=>{const i=Se(s);pT(e,i),hT(e,i),dT(e,i)}),ul=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:Qo({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(Wg).refine(e=>new Set(e).size===e.length,{message:"categories must contain unique items"}).optional()}).strict(),xT=ll.extend({id:O()}),hl=Ve("type",[xT,vi]),AT=w({colorA:Lt,colorB:Lt,colorC:Lt,colorD:Lt,colorE:Lt,colorF:Lt}).strict(),PT=w({headingFont:gc,headingFontStyle:Ec,bodyFont:gc,bodyFontStyle:Ec}).strict(),wT=[12,14,16,18,20,24,32,36,40,48,56,64,80,96,112],CT=gE(wT),Dt=w({fontSize:CT}).strict(),_T=w({heading1:Dt,heading2:Dt,heading3:Dt,heading4:Dt,body1:Dt,body2:Dt,body3:Dt,body4:Dt}).strict(),NT=w({fontPair:PT,general:_T}).strict(),vT=w({contentWidth:st()}).strict(),OT=w({colorPalette:AT,fonts:NT,alignment:pE,pageLayout:vT,cornerRadius:fE}).strict(),LT=w({metadata:ul,header:hl,footer:hl,styleId:O().optional(),globalSettings:OT.optional(),announcementBars:ae(gT).optional()}).strict().superRefine((e,s)=>{const i=Se(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")}),DT=w({id:O().min(1,{message:"id is required"}),assets:Kr.array().optional(),configuration:LT,pages:ae(IT)}).strict(),Oi=2097152,Li=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 kT={menu:{type:F.NAVIGATION_MENU},logo:{type:F.LOGO}},RT={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 pl(e){switch(e){case vt.HEADER:return kT;default:return{}}}function dl(e){switch(e){case vt.HEADER:return RT;default:return{}}}function fl({validationType:e,sectionType:s}){switch(e){case Os.CONTENT:return pl(s);case Os.DESIGN:return dl(s);default:return{}}}const MT=vi.extend({id:O().min(1,{message:"section id is required"})}),$T=w({metadata:ul,sections:ae(MT).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&&Se(s).at(["collection","metadata","name"]).addIssue("REQUIRED_COLLECTION_NAME")}),FT=w({id:O().min(1,{message:"id is required"}),descriptor:$T}).strict(),BT=Ve("type",[Fc,jc,kc,Cc,zc,Uc,LE,kE,RE,DE,Mc,$c,Bc,Rc]),cn=Le(O(),BT),UT=Ve("type",[rl,Xc,el,nl,il,Yc,Jc,sl,Qc,cT,tl]),ln=Le(O(),UT),jT=Ve("type",[KE,$E,UE,qE,WE,ME,FE,HE,BE,VE,nT]),un=w({layoutId:O(),layoutIcon:oE.optional(),selectedContentSettings:ae(O()),selectedDesignSettings:ae(jT)}).strict(),zT=O().regex(mE,Be.VALID_LANGUAGE_CODE()),Di=Le(zT,Le(G,O()));function ml(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 yl(e,s,i){_c(e,s,i)}function gl(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&&gl(y,T,I)})})}function VT(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&&gl(c,h,u)})}function GT(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 HT(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 ZT(e,s,i){e.layoutId&&((s||[]).some(a=>a.layoutId===e.layoutId)||i.at("layoutId").addIssue("SHOWCASE_LAYOUT",e.layoutId))}function WT(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 El(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&&El(h.cards.defaultCardContent.settings,s,i.at([a,"cards","defaultCardContent","settings"]))}}}function KT(e,s,i){s>Oi&&i.at(Te.basename(e)).addIssue("REQUIRED_SECTION_ASSET",mt(s),mt(Oi))}function qT(e,s){e>Li&&s.addIssue("REQUIRED_SERVER_SIZE",mt(e),mt(Li))}const YT=w({id:O(),type:$g,name:O(),content:cn,design:ln,layout:ae(un).optional(),showcase:ae(lT),translationsSettings:Di.optional(),translationsShowcases:Di.optional(),assets:Kr.array().optional(),server:Ac,previewCount:st().optional()}).strict().superRefine((e,s)=>{const i=Se(s),a=fl({validationType:Os.CONTENT,sectionType:e.type}),c=fl({validationType:Os.DESIGN,sectionType:e.type});ml(e.content,a,i.at("content")),ml(e.design,c,i.at("design")),El(e.content,e.design,i.at("content")),HT(e.design,i.at("design")),e.assets&&e.assets.forEach(h=>{KT(h.path,h.size,i.at("assets"))}),qT(e.server.size,i.at("server"));const u=e.assets?.map(h=>h.path)??[];yl(e.content,u,i.at("content")),WT(e.showcase,i.at("showcase")),e.showcase.forEach((h,f)=>{const y=i.at(["showcase",f]);yl(h,u,y),VT(h,e.content,y),GT(h,e.design,y),ZT(h,e.layout,y)})}),XT=w({translations:Di.optional()}).strict();function JT(e){return typeof e=="object"&&e!==null&&e.type==="ACCORDION"}function QT(e){const s=[];for(const[i,a]of Object.entries(e))if(s.push(i),JT(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 ls={},Tl;function eS(){if(Tl)return ls;Tl=1,Object.defineProperty(ls,"__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."},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?`
|
|
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:N,column:M,index:Q}=(C=x.loc)!=null?C:m;return d(new s(N,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,ve=(p,r)=>{p&&we(p,r,{enumerable:!1,value:p[r]})};function bt(p){return ve(p.loc.start,"index"),ve(p.loc.end,"index"),p}var Yt=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,Xt=!0,Ss=!0,It=!0,Ju=!0;class Gn{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 or=new Map;function Y(p,r={}){r.keyword=p;const t=B(p,r);return or.set(p,t),t}function ke(p,r){return B(p,{beforeExpr:z,binop:r})}let bs=-1;const ut=[],cr=[],lr=[],ur=[],hr=[],pr=[];function B(p,r={}){var t,n,o,l;return++bs,cr.push(p),lr.push((t=r.binop)!=null?t:-1),ur.push((n=r.beforeExpr)!=null?n:!1),hr.push((o=r.startsExpr)!=null?o:!1),pr.push((l=r.prefix)!=null?l:!1),ut.push(new Gn(p,r)),bs}function W(p,r={}){var t,n,o,l;return++bs,or.set(p,bs),cr.push(p),lr.push((t=r.binop)!=null?t:-1),ur.push((n=r.beforeExpr)!=null?n:!1),hr.push((o=r.startsExpr)!=null?o:!1),pr.push((l=r.prefix)!=null?l:!1),ut.push(new Gn("name",r)),bs}const Qu={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:Ju,startsExpr:_}),bang:B("!",{beforeExpr:z,prefix:It,startsExpr:_}),tilde:B("~",{beforeExpr:z,prefix:It,startsExpr:_}),doubleCaret:B("^^",{startsExpr:_}),doubleAt:B("@@",{startsExpr:_}),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:It,startsExpr:_}),modulo:B("%",{binop:10,startsExpr:_}),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:_}),_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:Xt,beforeExpr:z}),_for:Y("for",{isLoop:Xt}),_while:Y("while",{isLoop:Xt}),_as:W("as",{startsExpr:_}),_assert:W("assert",{startsExpr:_}),_async:W("async",{startsExpr:_}),_await:W("await",{startsExpr:_}),_defer:W("defer",{startsExpr:_}),_from:W("from",{startsExpr:_}),_get:W("get",{startsExpr:_}),_let:W("let",{startsExpr:_}),_meta:W("meta",{startsExpr:_}),_of:W("of",{startsExpr:_}),_sent:W("sent",{startsExpr:_}),_set:W("set",{startsExpr:_}),_source:W("source",{startsExpr:_}),_static:W("static",{startsExpr:_}),_using:W("using",{startsExpr:_}),_yield:W("yield",{startsExpr:_}),_asserts:W("asserts",{startsExpr:_}),_checks:W("checks",{startsExpr:_}),_exports:W("exports",{startsExpr:_}),_global:W("global",{startsExpr:_}),_implements:W("implements",{startsExpr:_}),_intrinsic:W("intrinsic",{startsExpr:_}),_infer:W("infer",{startsExpr:_}),_is:W("is",{startsExpr:_}),_mixins:W("mixins",{startsExpr:_}),_proto:W("proto",{startsExpr:_}),_require:W("require",{startsExpr:_}),_satisfies:W("satisfies",{startsExpr:_}),_keyof:W("keyof",{startsExpr:_}),_readonly:W("readonly",{startsExpr:_}),_unique:W("unique",{startsExpr:_}),_abstract:W("abstract",{startsExpr:_}),_declare:W("declare",{startsExpr:_}),_enum:W("enum",{startsExpr:_}),_module:W("module",{startsExpr:_}),_namespace:W("namespace",{startsExpr:_}),_interface:W("interface",{startsExpr:_}),_type:W("type",{startsExpr:_}),_opaque:W("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 eh(p){return p<=92}function Qe(p){return p>=58&&p<=133}function Hn(p){return p>=58&&p<=137}function th(p){return ur[p]}function Is(p){return hr[p]}function sh(p){return p>=29&&p<=33}function Zn(p){return p>=129&&p<=131}function ih(p){return p>=90&&p<=92}function dr(p){return p>=58&&p<=92}function rh(p){return p>=39&&p<=59}function nh(p){return p===34}function ah(p){return pr[p]}function oh(p){return p>=121&&p<=123}function ch(p){return p>=124&&p<=130}function xt(p){return cr[p]}function Hs(p){return lr[p]}function lh(p){return p===57}function Zs(p){return p>=24&&p<=25}function ht(p){return ut[p]}ut[8].updateContext=p=>{p.pop()},ut[5].updateContext=ut[7].updateContext=ut[23].updateContext=p=>{p.push($.brace)},ut[22].updateContext=p=>{p[p.length-1]===$.template?p.pop():p.push($.template)},ut[143].updateContext=p=>{p.push($.j_expr,$.j_oTag)};let fr="\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",Wn="\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 uh=new RegExp("["+fr+"]"),hh=new RegExp("["+fr+Wn+"]");fr=Wn=null;const Kn=[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],ph=[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 mr(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 ot(p){return p<65?p===36:p<=90?!0:p<97?p===95:p<=122?!0:p<=65535?p>=170&&uh.test(String.fromCharCode(p)):mr(p,Kn)}function Mt(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&&hh.test(String.fromCharCode(p)):mr(p,Kn)||mr(p,ph)}const yr={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"]},dh=new Set(yr.keyword),fh=new Set(yr.strict),mh=new Set(yr.strictBind);function qn(p,r){return r&&p==="await"||p==="enum"}function Yn(p,r){return qn(p,r)||fh.has(p)}function Xn(p){return mh.has(p)}function Jn(p,r){return Yn(p,r)||Xn(p)}function yh(p){return dh.has(p)}function gh(p,r,t){return p===64&&r===64&&ot(t)}const Eh=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 Th(p){return Eh.has(p)}class gr{constructor(r){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=r}}class Er{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 gr(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 Sh extends gr{constructor(...r){super(...r),this.declareFunctions=new Set}}class bh extends Er{createScope(r){return new Sh(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 Ih=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 xh(p){return p.type==="DeclareExportAllDeclaration"||p.type==="DeclareExportDeclaration"&&(!p.declaration||p.declaration.type!=="TypeAlias"&&p.declaration.type!=="InterfaceDeclaration")}function Qn(p){return p.importKind==="type"||p.importKind==="typeof"}const Ah={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function Ph(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 wh=/\*?\s*@((?:no)?flow)\b/;var Ch=p=>class extends p{constructor(...t){super(...t),this.flowPragma=void 0}getScopeHandler(){return bh}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=wh.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=>{xh(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:Ah[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){Ih.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 N=!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(),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(ue,N))):g.indexers.push(this.flowParseObjectTypeIndexer(ue,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(ue,N));else{let ce="init";if(this.isContextual(99)||this.isContextual(104)){const wt=this.lookahead();Hn(wt.type)&&(ce=this.state.value,this.next())}const Ft=this.flowParseObjectTypeProperty(ue,N,M,H,ce,o,d??!b);Ft===null?(x=!0,Q=this.state.lastTokStartLoc):g.properties.push(Ft)}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(dr(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(Qe(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||Zn(t)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:t}=this.state;return t===126||Zn(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 N=0;N<x.length;N++)C.push(x[N].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,[]]):Ph(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):gh(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=Qn(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&&!Qe(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&&Qe(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=Qn(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 ue=super.parseMaybeAssign(t,n);return this.resetStartLocationFromNode(ue,E),ue});(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 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,N=m.defaultedMembers.length;if(!b&&!x&&!C&&!N)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>=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&&x>=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 _h={__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"},Nh=/\r\n|[\r\n\u2028\u2029]/,Ws=new RegExp(Nh.source,"g");function Jt(p){switch(p){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function ea(p,r,t){for(let n=r;n<t;n++)if(Jt(p.charCodeAt(n)))return!0;return!1}const Tr=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Sr=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function vh(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 $t=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 Qt(p){if(p.type==="JSXIdentifier")return p.name;if(p.type==="JSXNamespacedName")return p.namespace.name+":"+p.name.name;if(p.type==="JSXMemberExpression")return Qt(p.object)+"."+Qt(p.property);throw new Error("Node had unexpected type: "+p.type)}var Oh=p=>class extends p{jsxReadToken(){let t="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise($t.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:Jt(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):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,
|
|
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();/**
|
|
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):Jt(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=_h[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(Mt(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:dr(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($t.AttributeIsEmpty,t),t;case 143:case 134:return this.parseExprAtom();default:throw this.raise($t.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($t.MissingClosingTagFragment,d):!At(l)&&At(d)?this.raise($t.MissingClosingTagElement,d,{openingTagName:Qt(l.name)}):!At(l)&&!At(d)&&Qt(d.name)!==Qt(l.name)&&this.raise($t.MissingClosingTagElement,d,{openingTagName:Qt(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($t.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(ot(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=th(o)}};class Lh extends gr{constructor(...r){super(...r),this.tsNames=new Map}}class Dh extends Er{constructor(...r){super(...r),this.importsStack=[]}createScope(r){return this.importsStack.push(new Set),new Lh(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 kh{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 Rh{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 ta(p,r){p.trailingComments===void 0?p.trailingComments=r:p.trailingComments.unshift(...r)}function Mh(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 et(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):ta(n,t.comments)}class $h extends Rh{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&&ta(r.leadingNode,n),r.trailingNode!==null&&Mh(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":et(o,o.properties,r);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":et(o,o.arguments,r);break;case"ImportExpression":et(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":et(o,o.params,r);break;case"ArrayExpression":case"ArrayPattern":et(o,o.elements,r);break;case"ExportNamedDeclaration":case"ImportDeclaration":et(o,o.specifiers,r);break;case"TSEnumDeclaration":et(o,o.members,r);break;case"TSEnumBody":et(o,o.members,r);break;case"TSInterfaceBody":et(o,o.body,r);break;default:{if(o.type==="RecordExpression"){et(o,o.properties,r);break}if(o.type==="TupleExpression"){et(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 br{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 br;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 Fh=function(r){return r>=48&&r<=57};const sa={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 ia(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 N=r.charCodeAt(t);if(Bh(p,N,r,t)){E+=r.slice(x,t);break}if(N===92){E+=r.slice(x,t);const M=Uh(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 N===8232||N===8233?(++t,++o,n=t):N===10||N===13?p==="template"?(E+=r.slice(x,t)+`
|
|
44
|
+
`,++t,N===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 Bh(p,r,t,n){return p==="template"?r===96||r===36&&t.charCodeAt(n+1)===123:r===(p==="double"?34:39)}function Uh(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}=Ir(p,r,t,n,2,!1,d,l),m(E===null?null:String.fromCharCode(E))}case 117:{let E;return{code:E,pos:r}=na(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 N=p.charCodeAt(r);if(x!=="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 Ir(p,r,t,n,o,l,d,m){const g=r;let E;return{n:E,pos:r}=ra(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 ra(p,r,t,n,o,l,d,m,g,E){const b=r,x=o===16?sa.hex:sa.decBinOct,C=o===16?qs.hex:o===10?qs.dec:o===8?qs.oct:qs.bin;let N=!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 Ft=p.charCodeAt(r-1),wt=p.charCodeAt(r+1);if(m){if(Number.isNaN(wt)||!C(wt)||x.has(Ft)||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:Fh(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,N=!0;else break}++r,M=M*o+ce}return r===b||l!=null&&r-b!==l||N?{n:null,pos:r}:{n:M,pos:r}}function na(p,r,t,n,o,l){const d=p.charCodeAt(r);let m;if(d===123){if(++r,{code:m,pos:r}=Ir(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}=Ir(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 jh=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 zh extends $h{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 br,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 Tr.lastIndex=r,Tr.test(this.input)?Tr.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 Sr.lastIndex=r,Sr.test(this.input)?Sr.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(;!Jt(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(vh(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 ot(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;!Jt(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(ot(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(Jt(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(jh.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(Mt(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}=ra(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(ot(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(ot(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}=na(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}=ia(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}=ia("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(Mt(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?ot:Mt;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=or.get(t);n!==void 0?this.finishToken(n,xt(n)):this.finishToken(132,t)}checkKeywordEscapes(){const{type:r}=this.state;dr(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 Vh{constructor(){this.privateNames=new Set,this.loneAccessors=new Map,this.undefinedPrivateNames=new Map}}class Gh{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 Vh)}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 aa 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 Hh{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 Zh(){return new Ys(3)}function Wh(){return new aa(1)}function Kh(){return new aa(2)}function oa(){return new Ys}class qh extends zh{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!(Mt(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 ea(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return ea(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 Hn(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 kh;const g=this.classScope;this.classScope=new Gh(this);const E=this.expressionScope;return this.expressionScope=new Hh(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 xr=Js.prototype;xr.__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 Yh extends qh{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(xr);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(xr);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 Ar=p=>p.type==="ParenthesizedExpression"?Ar(p.expression):p;class Xh extends Yh{toAssignable(r,t=!1){var n,o;let l;switch((r.type==="ParenthesizedExpression"||(n=r.extra)!=null&&n.parenthesized)&&(l=Ar(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=Ar(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 N,M;typeof C=="string"?(N=C,M=E==="ParenthesizedExpression"):[N,M]=C;const Q=E==="ArrayPattern"||E==="ObjectPattern"?{type:E}:t,ue=r[N];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?Jn(r.name,this.inModule):Xn(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 Pr=/in(?:stanceof)?|as|satisfies/y;function Jh(p){if(p==null)throw new Error(`Unexpected ${p} value.`);return p}function ca(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 Qh(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 la(p){return p==="private"||p==="public"||p==="protected"}function ep(p){return p==="in"||p==="out"}var tp=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 Dh}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;la(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):ep(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 Jh(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=Qe(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":Qh(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 oh(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(){ca(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 ch(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):ip(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=>la(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 N=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(!N.error&&!N.aborted)return C&&this.reportReservedArrowTypeParam(C),N.node;if(!b&&(ca(!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(N.node)return this.state=N.failState,C&&this.reportReservedArrowTypeParam(C),N.node;if((d=x)!=null&&d.node)return this.state=x.failState,x.node;throw((m=b)==null?void 0:m.error)||N.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 N=this.parseIdentifier();if(this.isContextual(93)){const M=this.parseIdentifier();Qe(this.state.type)?(E=!0,m=N,g=n?this.parseIdentifier():this.parseModuleExportName(),b=!1):(g=M,b=!1)}else Qe(this.state.type)?(b=!1,g=n?this.parseIdentifier():this.parseModuleExportName()):(E=!0,m=N)}else Qe(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,N,M,Q,ue,H,ce,Ft,wt,Ea,Ta,Sa,ba,Ia,xa,Aa,Pa,wa,Ca,_a,Na,va,Oa,La,Da,ka,Ra,Ma,$a,Fa,Ba,Ua,ja,za,Va,Ga,Ha,Za,Wa;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),(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":(ue=t.optional)!=null||(t.optional=!1);case"TSIndexSignature":(H=t.accessibility)!=null||(t.accessibility=void 0),(ce=t.readonly)!=null||(t.readonly=!1),(Ft=t.static)!=null||(t.static=!1);return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(wt=t.declare)!=null||(t.declare=!1),(Ea=t.definite)!=null||(t.definite=!1),(Ta=t.readonly)!=null||(t.readonly=!1),(Sa=t.typeAnnotation)!=null||(t.typeAnnotation=void 0);case"TSAbstractMethodDefinition":case"MethodDefinition":(ba=t.accessibility)!=null||(t.accessibility=void 0),(Ia=t.decorators)!=null||(t.decorators=[]),(xa=t.override)!=null||(t.override=!1),(Aa=t.optional)!=null||(t.optional=!1);return;case"ClassExpression":(Pa=t.id)!=null||(t.id=null);case"ClassDeclaration":(wa=t.abstract)!=null||(t.abstract=!1),(Ca=t.declare)!=null||(t.declare=!1),(_a=t.decorators)!=null||(t.decorators=[]),(Na=t.implements)!=null||(t.implements=[]),(va=t.superTypeArguments)!=null||(t.superTypeArguments=void 0),(Oa=t.typeParameters)!=null||(t.typeParameters=void 0);return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(La=t.declare)!=null||(t.declare=!1);return;case"VariableDeclarator":(Da=t.definite)!=null||(t.definite=!1);return;case"TSEnumDeclaration":(ka=t.const)!=null||(t.const=!1),(Ra=t.declare)!=null||(t.declare=!1);return;case"TSEnumMember":(Ma=t.computed)!=null||(t.computed=!1);return;case"TSImportType":($a=t.qualifier)!=null||(t.qualifier=null),(Fa=t.options)!=null||(t.options=null);return;case"TSInterfaceDeclaration":(Ba=t.declare)!=null||(t.declare=!1),(Ua=t.extends)!=null||(t.extends=[]);return;case"TSMappedType":(ja=t.optional)!=null||(t.optional=!1),(za=t.readonly)!=null||(t.readonly=void 0);return;case"TSModuleDeclaration":(Va=t.declare)!=null||(t.declare=!1),(Ga=t.global)!=null||(t.global=t.kind==="global");return;case"TSTypeParameter":(Ha=t.const)!=null||(t.const=!1),(Za=t.in)!=null||(t.in=!1),(Wa=t.out)!=null||(t.out=!1);return}}chStartsBindingIdentifierAndNotRelationalOperator(t,n){if(ot(t)){if(Pr.lastIndex=n,Pr.test(this.input)){const o=this.codePointAtPos(Pr.lastIndex);if(!Mt(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 sp(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:ha(p.object)}function ip(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!!(ua(p,r)||rp(p,r)||n==="TemplateLiteral"&&p.expressions.length===0||sp(p))}function ua(p,r){return r?p.type==="Literal"&&(typeof p.value=="number"||"bigint"in p):p.type==="NumericLiteral"||p.type==="BigIntLiteral"}function rp(p,r){if(p.type==="UnaryExpression"){const{operator:t,argument:n}=p;if(t==="-"&&ua(n,r))return!0}return!1}function ha(p){return p.type==="Identifier"?!0:p.type!=="MemberExpression"||p.computed?!1:ha(p.object)}const pa=Ce`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var np=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(pa.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(pa.UnexpectedSpace,this.state.lastTokEndLoc)}},ap=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 da=["minimal","fsharp","hack","smart"],fa=["^^","@@","^","%","#"];function op(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(!da.includes(n)){const o=da.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(!fa.includes(o)){const l=fa.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 ma={estree:Yt,jsx:Oh,flow:Ch,typescript:tp,v8intrinsic:ap,placeholders:np},cp=Object.keys(ma);class lp extends Xh{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)),sh(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(rh(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,lh(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(ah(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(;nh(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(Kh()),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 ot(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(Wh());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 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),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(Qe(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(oa()),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;Qe(o)?t=this.state.value:this.unexpected();const l=eh(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||!Th(r))return;if(n&&yh(r)){this.raise(S.UnexpectedKeyword,t,{keyword:r});return}if((this.state.strict?o?Jn:Yn:qn)(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 wr={kind:1},up={kind:2},hp=/[\uD800-\uDFFF]/u,Cr=/in(?:stanceof)?/y;function pp(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:ht(27),value:"#",start:m,end:b,startLoc:d.start,endLoc:x}),new Pt({type:ht(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:ht(22),value:"`",start:m,end:b,startLoc:d.start,endLoc:x}):C=new Pt({type:ht(8),value:"}",start:m,end:b,startLoc:d.start,endLoc:x});let N,M,Q,ue;l===24?(M=E-1,Q=a(d.end,-1),N=g===null?null:g.slice(1,-1),ue=new Pt({type:ht(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),ue=new Pt({type:ht(23),value:"${",start:M,end:E,startLoc:Q,endLoc:d.end})),p.splice(n,1,C,new Pt({type:ht(20),value:N,start:b,end:M,startLoc:x,endLoc:Q}),ue),n+=2;continue}o.type=ht(l)}}return p}class dp extends lp{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=pp(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(ot(r)){if(Cr.lastIndex=t,Cr.test(this.input)){const n=this.codePointAtPos(Cr.lastIndex);if(!Mt(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(wr),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(wr);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 N=this.finishNode(x,"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 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(up),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(wr),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=ih(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(Zh()),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),N=this.parseClassElementName(t),M=C?N.name:null,Q=this.isPrivateName(N),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,N),H&&this.hasPlugin("typescript")&&t.override&&this.raise(S.OverrideOnConstructor,N),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(N);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(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(oa()),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 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=hp.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(Qe(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(Qe(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 ya extends dp{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 Er}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 fp(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 mp(p,r){const t=Ps(r,p);return t.options.strictMode&&(t.state.strict=!0),t.getExpression()}function yp(p){const r={};for(const t of Object.keys(p))r[t]=ht(p[t]);return r}const gp=yp(Qu);function Ps(p,r){let t=ya;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||{})}op(n),t=Ep(n)}return new t(p,r,n)}const ga=new Map;function Ep(p){const r=[];for(const o of cp)p.has(o)&&r.push(o);const t=r.join("|");let n=ga.get(t);if(!n){n=ya;for(const o of r)n=ma[o](n);ga.set(t,n)}return n}return ls.parse=fp,ls.parseExpression=mp,ls.tokTypes=gp,ls}var tS=eS();/**
|
|
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 ki(e){const s=Object.create(null);for(const i of e.split(","))s[i]=1;return i=>i in s}const sS=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const hn=()=>{},Ri=()=>!1,Mi=Object.assign,ks=Array.isArray,Rs=e=>typeof e=="string",iS=e=>typeof e=="symbol",Sl=e=>{const s=Object.create(null);return(i=>s[i]||(s[i]=e(i)))},rS=/-\w/g,nS=Sl(e=>e.replace(rS,s=>s.slice(1).toUpperCase())),aS=Sl(e=>e.charAt(0).toUpperCase()+e.slice(1)),oS={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"},cS=/;(?![^(]*\))/g,lS=/:([^]+)/,uS=/\/\*[^]*?\*\//g;function hS(e){const s={};return e.replace(uS,"").split(cS).forEach(i=>{if(i){const a=i.split(lS);a.length>1&&(s[a[0].trim()]=a[1].trim())}}),s}const pS="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",dS="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",fS="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",mS="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",yS=ki(pS),gS=ki(dS),ES=ki(fS),TS=ki(mS);/**
|
|
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 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
|
|
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 bl=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),Il=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),xl=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),Al=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),Pl=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),$i=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),wl=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),Cl=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),_l=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),Nl=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),vl=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),SS=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),bS=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),IS=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),xS=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),AS=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),PS=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),wS=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),CS=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),_S=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),NS=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),Ol=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),vS=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),Ll=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),Dl=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),kl=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Rl=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),OS=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),LS=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),DS=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),kS=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),RS=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),MS=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),$S=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),FS=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),BS=Symbol(process.env.NODE_ENV!=="production"?"unref":""),US=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),jS=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),zS=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),Ml={[bl]:"Fragment",[Il]:"Teleport",[xl]:"Suspense",[Al]:"KeepAlive",[Pl]:"BaseTransition",[$i]:"openBlock",[wl]:"createBlock",[Cl]:"createElementBlock",[_l]:"createVNode",[Nl]:"createElementVNode",[vl]:"createCommentVNode",[SS]:"createTextVNode",[bS]:"createStaticVNode",[IS]:"resolveComponent",[xS]:"resolveDynamicComponent",[AS]:"resolveDirective",[PS]:"resolveFilter",[wS]:"withDirectives",[CS]:"renderList",[_S]:"renderSlot",[NS]:"createSlots",[Ol]:"toDisplayString",[vS]:"mergeProps",[Ll]:"normalizeClass",[Dl]:"normalizeStyle",[kl]:"normalizeProps",[Rl]:"guardReactiveProps",[OS]:"toHandlers",[LS]:"camelize",[DS]:"capitalize",[kS]:"toHandlerKey",[RS]:"setBlockTracking",[MS]:"pushScopeId",[$S]:"popScopeId",[FS]:"withCtx",[BS]:"unref",[US]:"isRef",[jS]:"withMemo",[zS]:"isMemoSame"};function VS(e){Object.getOwnPropertySymbols(e).forEach(s=>{Ml[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 GS(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 HS(e,s,i,a,c,u,h,f=!1,y=!1,T=!1,I=$s){return e&&(f?(e.helper($i),e.helper(fn(e.inSSR,T))):e.helper(dn(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 pn(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 ZS(e,s,i=!1,a=!1){return{type:20,index:e,value:s,needPauseTracking:i,inVOnce:a,needArraySpread:!1,loc:$s}}function dn(e,s){return e||s?_l:Nl}function fn(e,s){return e||s?wl:Cl}function WS(e,{helper:s,removeHelper:i,inSSR:a}){e.isBlock||(e.isBlock=!0,i(dn(a,e.isComponent)),s($i),s(fn(a,e.isComponent)))}const $l=new Uint8Array([123,123]),Fl=new Uint8Array([125,125]);function Bl(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 kt(e){return e===47||e===62||Ze(e)}function Fi(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 KS{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=$l,this.delimiterClose=Fl,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=$l,this.delimiterClose=Fl}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?kt(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):Bl(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){kt(s)&&this.handleTagName(s)}stateInSFCRootTagName(s){if(kt(s)){const i=this.buffer.slice(this.sectionStart,this.index);i!=="template"&&this.enterRCDATA(Fi("</"+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=Bl(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||kt(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||kt(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||kt(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||kt(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||kt(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 qS={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 mn(e,{compatConfig:s}){const i=s&&s[e];return e==="MODE"?i||3:i}function yn(e,s){const i=mn("MODE",s),a=mn(e,s);return i===3?a===!0:a!==!1}function Bi(e,s,i,...a){const c=yn(e,s);return process.env.NODE_ENV!=="production"&&c&&gn(e,s,i,...a),c}function gn(e,s,i,...a){if(mn(e,s)==="suppress-warning")return;const{message:u,link:h}=qS[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 Ul(e){throw e}function jl(e){process.env.NODE_ENV!=="production"&&console.warn(`[Vue warn] ${e.message}`)}function zl(e,s,i,a){const c=process.env.NODE_ENV!=="production"?(i||YS)[e]+(a||""):`https://vuejs.org/error-reference/#compiler-${e}`,u=new SyntaxError(String(c));return u.code=e,u.loc=s,u}const YS={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:""},XS=e=>e.type===4&&e.isStatic;function JS(e){switch(e){case"Teleport":case"teleport":return Il;case"Suspense":case"suspense":return xl;case"KeepAlive":case"keep-alive":return Al;case"BaseTransition":case"base-transition":return Pl}}function QS(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 eb(e,s){return!!(e&&XS(e)&&e.content===s)}function Vl(e){return e.type===7&&e.name==="pre"}function tb(e){return e.type===1&&e.tagType===2}const sb=/([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;function Gl(e){for(let s=0;s<e.length;s++)if(!Ze(e.charCodeAt(s)))return!1;return!0}function Hl(e){return e.type===2&&Gl(e.content)||e.type===12&&Hl(e.content)}function ib(e){return e.type===3||Hl(e)}const Zl={parseMode:"base",ns:0,delimiters:["{{","}}"],getNamespace:()=>0,isVoidTag:Ri,isPreTag:Ri,isIgnoreNewlineTag:Ri,isCustomElement:Ri,onError:Ul,onWarn:jl,comments:process.env.NODE_ENV!=="production",prefixIdentifiers:!1};let X=Zl,Fs=null,yt="",De=null,q=null,Ue="",gt=-1,zt=-1,En=0,Rt=!1,Tn=null;const fe=[],he=new KS(fe,{onerr:je,ontext(e,s){Ui(Ne(e,s),e,s)},ontextentity(e,s,i){Ui(e,s,i)},oninterpolation(e,s){if(Rt)return Ui(Ne(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=Ne(i,a);c.includes("&")&&(c=X.decodeEntities(c,!1)),Sn({type:5,content:zi(c,!1,Ae(i,a)),loc:Ae(e,s)})},onopentagname(e,s){const i=Ne(e,s);De={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){Kl(e)},onclosetag(e,s){const i=Ne(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();ji(f,s,h<c)}break}a||je(23,ql(e,60))}},onselfclosingtag(e){const s=De.tag;De.isSelfClosing=!0,Kl(e),fe[0]&&fe[0].tag===s&&ji(fe.shift(),e)},onattribname(e,s){q={type:6,name:Ne(e,s),nameLoc:Ae(e,s),value:void 0,loc:Ae(e)}},ondirname(e,s){const i=Ne(e,s),a=i==="."||i===":"?"bind":i==="@"?"on":i==="#"?"slot":i.slice(2);if(!Rt&&a===""&&je(26,e),Rt||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"){Rt=he.inVPre=!0,Tn=De;const c=De.props;for(let u=0;u<c.length;u++)c[u].type===7&&(c[u]=pb(c[u]))}},ondirarg(e,s){if(e===s)return;const i=Ne(e,s);if(Rt&&!Vl(q))q.name+=i,Vt(q.nameLoc,s);else{const a=i[0]!=="[";q.arg=zi(a?i:i.slice(1,-1),a,Ae(e,s),a?3:0)}},ondirmodifier(e,s){const i=Ne(e,s);if(Rt&&!Vl(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+=Ne(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=Ne(s,e);q.type===7&&(q.rawName=i),De.props.some(a=>(a.type===7?a.rawName:a.name)===i)&&je(2,s)},onattribend(e,s){if(De&&q){if(Vt(q.loc,s),e!==0)if(Ue.includes("&")&&(Ue=X.decodeEntities(Ue,!0)),q.type===6)q.name==="class"&&(Ue=Jl(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&&De.tag==="template"&&q.name==="lang"&&Ue&&Ue!=="html"&&he.enterRCDATA(Fi("</template"),0);else{let i=0;q.exp=zi(Ue,!1,Ae(gt,zt),0,i),q.name==="for"&&(q.forParseResult=nb(q.exp));let a=-1;q.name==="bind"&&(a=q.modifiers.findIndex(c=>c.content==="sync"))>-1&&Bi("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")&&De.props.push(q)}Ue="",gt=zt=-1},oncomment(e,s){X.comments&&Sn({type:3,content:Ne(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++)ji(fe[s],e-1),je(24,fe[s].loc.start.offset)},oncdata(e,s){fe[0].ns!==0?Ui(Ne(e,s),e,s):je(1,e-9)},onprocessinginstruction(e){(fe[0]?fe[0].ns:X.ns)===0&&je(21,e-1)}}),Wl=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,rb=/^\(|\)$/g;function nb(e){const s=e.loc,i=e.content,a=i.match(sb);if(!a)return;const[,c,u]=a,h=(A,L,R=!1)=>{const oe=s.start.offset+L,le=oe+A.length;return zi(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(rb,"").trim();const T=c.indexOf(y),I=y.match(Wl);if(I){y=y.replace(Wl,"").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 Ne(e,s){return yt.slice(e,s)}function Kl(e){he.inSFCRoot&&(De.innerLoc=Ae(e+1,e+1)),Sn(De);const{tag:s,ns:i}=De;i===0&&X.isPreTag(s)&&En++,X.isVoidTag(s)?ji(De,e):(fe.unshift(De),(i===1||i===2)&&(he.inXML=!0)),De=null}function Ui(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 ji(e,s,i=!1){i?Vt(e.loc,ql(s,60)):Vt(e.loc,ab(s,62)+1),he.inSFCRoot&&(e.children.length?e.innerLoc.end=Mi({},e.children[e.children.length-1].loc.end):e.innerLoc.end=Mi({},e.innerLoc.start),e.innerLoc.source=Ne(e.innerLoc.start.offset,e.innerLoc.end.offset));const{tag:a,ns:c,children:u}=e;if(Rt||(a==="slot"?e.tagType=2:Yl(e)?e.tagType=3:cb(e)&&(e.tagType=1)),he.inRCDATA||(e.children=Xl(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)&&En--,Tn===e&&(Rt=he.inVPre=!1,Tn=null),he.inXML&&(fe[0]?fe[0].ns:X.ns)===0&&(he.inXML=!1);{const h=e.props;if(process.env.NODE_ENV!=="production"&&yn("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){gn("COMPILER_V_IF_V_FOR_PRECEDENCE",X,e.loc);break}}}if(!he.inSFCRoot&&yn("COMPILER_NATIVE_TEMPLATE",X)&&e.tag==="template"&&!Yl(e)){process.env.NODE_ENV!=="production"&&gn("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&&Bi("COMPILER_INLINE_TEMPLATE",X,f.loc)&&e.children.length&&(f.value={type:2,content:Ne(e.children[0].loc.start.offset,e.children[e.children.length-1].loc.end.offset),loc:f.loc})}}function ab(e,s){let i=e;for(;yt.charCodeAt(i)!==s&&i<yt.length-1;)i++;return i}function ql(e,s){let i=e;for(;yt.charCodeAt(i)!==s&&i>=0;)i--;return i}const ob=new Set(["if","else","else-if","for","slot"]);function Yl({tag:e,props:s}){if(e==="template"){for(let i=0;i<s.length;i++)if(s[i].type===7&&ob.has(s[i].name))return!0}return!1}function cb({tag:e,props:s}){if(X.isCustomElement(e))return!1;if(e==="component"||lb(e.charCodeAt(0))||JS(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(Bi("COMPILER_IS_ON_ELEMENT",X,a.loc))return!0}}else if(a.name==="bind"&&eb(a.arg,"is")&&Bi("COMPILER_IS_ON_ELEMENT",X,a.loc))return!0}return!1}function lb(e){return e>64&&e<91}const ub=/\r\n/g;function Xl(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(En)c.content=c.content.replace(ub,`
|
|
57
|
+
`);else if(Gl(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&&hb(c.content)))?(i=!0,e[a]=null):c.content=" "}else s&&(c.content=Jl(c.content))}return i?e.filter(Boolean):e}function hb(e){for(let s=0;s<e.length;s++){const i=e.charCodeAt(s);if(i===10||i===13)return!0}return!1}function Jl(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 Sn(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:Ne(e,s)}}function Vt(e,s){e.end=he.getPos(s),e.source=Ne(e.start.offset,s)}function pb(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 zi(e,s=!1,i,a=0,c=0){return jt(e,s,i,a)}function je(e,s,i){X.onError(zl(e,Ae(s,s),void 0,i))}function db(){he.reset(),De=null,q=null,Ue="",gt=-1,zt=-1,fe.length=0}function fb(e,s){if(db(),yt=e,X=Mi({},Zl),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=Fi(i[0]),he.delimiterClose=Fi(i[1]));const a=Fs=GS([],e);return he.parse(yt),a.loc=Ae(0,e.length),a.children=Xl(a.children),Fs=null,a}function mb(e,s){Vi(e,void 0,s,!!Ql(e))}function Ql(e){const s=e.children.filter(i=>i.type!==3);return s.length===1&&s[0].type===1&&!tb(s[0])?s[0]:null}function Vi(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)&&tu(A,i)>=2){const le=su(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"?` /* ${oS[-1]} */`:"")),h.push(A);continue}if(A.type===1){const L=A.tagType===1;L&&i.scopes.vSlot++,Vi(A,e,i,!1,c),L&&i.scopes.vSlot--}else if(A.type===11)Vi(A,e,i,A.children.length===1,!0);else if(A.type===9)for(let L=0;L<A.branches.length;L++)Vi(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(pn(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(pn(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=QS(e,"slot",!0),A=I&&I.arg&&T(s.codegenNode,I.arg);A&&(A.returns=y(pn(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=tu(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($i),s.removeHelper(fn(s.inSSR,c.isComponent)),c.isBlock=!1,s.helper(dn(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)||iS(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 yb=new Set([Ll,Dl,kl,Rl]);function eu(e,s){if(e.type===14&&!Rs(e.callee)&&yb.has(e.callee)){const i=e.arguments[0];if(i.type===4)return Et(i,s);if(i.type===14)return eu(i,s)}return 0}function tu(e,s){let i=3;const a=su(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=eu(f,s):T=0,T===0)return T;T<i&&(i=T)}}return i}function su(e){const s=e.codegenNode;if(s.type===13)return s.props}function gb(e,{filename:s="",prefixIdentifiers:i=!1,hoistStatic:a=!1,hmr:c=!1,cacheHandlers:u=!1,nodeTransforms:h=[],directiveTransforms:f={},transformHoist:y=null,isBuiltInComponent:T=hn,isCustomElement:I=hn,expressionPlugins:A=[],scopeId:L=null,slotted:R=!0,ssr:oe=!1,inSSR:le=!1,ssrCssVars:Ce="",bindingMetadata:S=sS,inline:Ts=!1,isTS:$e=!1,onError:we=Ul,onWarn:ve=jl,compatConfig:bt}){const Yt=s.replace(/\?.*$/,"").match(/([^/\\]+)\.\w+$/),J={filename:s,selfName:Yt&&aS(nS(Yt[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:ve,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`_${Ml[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:hn,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 Xt=ZS(J.cached.length,$,z,_);return J.cached.push(Xt),Xt}};return J.filters=new Set,J}function Eb(e,s){const i=gb(e,s);bn(e,i),s.hoistStatic&&mb(e,i),s.ssr||Tb(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 Tb(e,s){const{helper:i}=s,{children:a}=e;if(a.length===1){const c=Ql(e);if(c&&c.codegenNode){const u=c.codegenNode;u.type===13&&WS(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=HS(s,i(bl),void 0,e.children,c,void 0,void 0,!0,void 0,!1)}}function Sb(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,bn(c,s))}}function bn(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(vl);break;case 5:s.ssr||s.helper(Ol);break;case 9:for(let u=0;u<e.branches.length;u++)bn(e.branches[u],s);break;case 10:case 11:case 1:case 0:Sb(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 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
|
|
61
|
+
**/const bb=Symbol(process.env.NODE_ENV!=="production"?"vModelRadio":""),Ib=Symbol(process.env.NODE_ENV!=="production"?"vModelCheckbox":""),xb=Symbol(process.env.NODE_ENV!=="production"?"vModelText":""),Ab=Symbol(process.env.NODE_ENV!=="production"?"vModelSelect":""),Pb=Symbol(process.env.NODE_ENV!=="production"?"vModelDynamic":""),wb=Symbol(process.env.NODE_ENV!=="production"?"vOnModifiersGuard":""),Cb=Symbol(process.env.NODE_ENV!=="production"?"vOnKeysGuard":""),_b=Symbol(process.env.NODE_ENV!=="production"?"vShow":""),In=Symbol(process.env.NODE_ENV!=="production"?"Transition":""),iu=Symbol(process.env.NODE_ENV!=="production"?"TransitionGroup":"");VS({[bb]:"vModelRadio",[Ib]:"vModelCheckbox",[xb]:"vModelText",[Ab]:"vModelSelect",[Pb]:"vModelDynamic",[wb]:"withModifiers",[Cb]:"withKeys",[_b]:"vShow",[In]:"Transition",[iu]:"TransitionGroup"});let us;function Nb(e,s=!1){return us||(us=document.createElement("div")),s?(us.innerHTML=`<div foo="${e.replace(/"/g,""")}">`,us.children[0].getAttribute("foo")):(us.innerHTML=e,us.textContent)}const vb={parseMode:"html",isVoidTag:TS,isNativeTag:e=>yS(e)||gS(e)||ES(e),isPreTag:e=>e==="pre",isIgnoreNewlineTag:e=>e==="pre"||e==="textarea",decodeEntities:Nb,isBuiltInComponent:e=>{if(e==="Transition"||e==="transition")return In;if(e==="TransitionGroup"||e==="transition-group")return iu},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}},Ob=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:Lb(s.value.content,s.loc),modifiers:[],loc:s.loc})})},Lb=(e,s)=>{const i=hS(e);return jt(JSON.stringify(i),!1,s,3)};function Db(e,s){return zl(e,s,process.env.NODE_ENV!=="production"?kb:void 0)}const kb={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."},Rb=(e,s)=>{if(e.type===1&&e.tagType===1&&s.isBuiltInComponent(e.tag)===In)return()=>{if(!e.children.length)return;ru(e)&&s.onError(Db(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 ru(e){const s=e.children=e.children.filter(a=>!ib(a)),i=s[0];return s.length!==1||i.type===11||i.type===9&&i.branches.some(ru)}function Mb(e,s){return e==="template"?!0:e in nu?nu[e].has(s):s in au?au[s].has(e):!(e in ou&&ou[e].has(s)||s in cu&&cu[s].has(e))}const hs=new Set(["h1","h2","h3","h4","h5","h6"]),Gt=new Set([]),nu={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},au={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"])},ou={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"])},cu={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:hs,h2:hs,h3:hs,h4:hs,h5:hs,h6:hs},$b=(e,s)=>{if(e.type===1&&e.tagType===0&&s.parent&&s.parent.type===1&&s.parent.tagType===0&&!Mb(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"?[Rb,$b]:[]];function Fb(e,s={}){return fb(e,Mi({},vb,s))}function Bb(e){try{const s=tS.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 Ub(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 Bb(s.exp.content)}}function jb(e){const s=new Set,i=Fb(e,{onError:()=>{}});return Eb(i,{nodeTransforms:[a=>{if(a.type===Ms.ELEMENT&&a.tag==="slot"){const c=Ub(a);c!==void 0&&s.add(c)}}]}),[...s]}const zb={catalog:Gg,category:Hg,product:Vg};function xn(e){const s={};for(const[i,a]of Object.entries(e))s[i]=i,s[a]=i;return s}const Vb={catalog:xn(pc),category:xn(dc),product:xn(fc)};function Gb(e,s,i,a){const c=zb[s];if(c===void 0)return;const u=new Set(a);for(const h of i){const f=Vb[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 Hb=ne(["products","category","product"]),Zb=O().superRefine((e,s)=>{Ls.safeParse(e).success||Se(s).addIssue("INVALID_STORE_SECTION_ID",e,Ls.options.join(", "))}).transform(e=>e),Wb=w({id:O(),sectionId:Zb,assets:Kr.array().optional(),templateContent:O().optional(),content:cn.optional(),design:ln.optional(),translationsSettings:Di.optional(),layouts:un.array().optional()}).strict().superRefine((e,s)=>{const i=Se(s);e.assets&&e.assets.forEach(a=>{a.size>Oi&&i.at(["assets",Te.basename(a.path)]).addIssue("REQUIRED_SECTION_ASSET",mt(a.size),mt(Oi))})});function Kb(e,s){if(s.templateContent===void 0)return;const i=jb(s.templateContent),a=QT(s.design??{});Gb(e,s.sectionId,i,a)}w({id:O(),sectionId:Ls,pageId:Hb,content:cn.optional(),design:ln.optional(),layouts:un.array().optional()}).strict();const qb=w({id:O(),sectionId:O(),layoutId:O(),server:Ac}).strict().superRefine((e,s)=>{const i=Se(s);Ls.safeParse(e.sectionId).success||i.at(["sectionId"]).addIssue("INVALID_STORE_SECTION_ID",e.sectionId,Ls.options.join(", ")),e.server.size>Li&&i.at("server").addIssue("REQUIRED_SERVER_SIZE",mt(e.server.size),mt(Li))});function Yb(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 Xb(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 lu(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&&_c(e.content,c,a.at(["content"]))}function Jb(e,s,i){if(!e.id)return;const a=s.find(c=>c.id===e.id);if(!a){i.at("id").addIssue("REQUIRED_CUSTOM_ANNOUNCEMENT_BAR",e.id);return}a.type!=="ANNOUNCEMENT_BAR"&&i.at("id").addIssue("REQUIRED_CUSTOM_ANNOUNCEMENT_BAR_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)),lu(e.showcase_overrides,a,i)}function uu(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"||c.type==="ANNOUNCEMENT_BAR")&&i.at("id").addIssue("REQUIRED_PAGE_SECTION_TYPE"),lu(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 Qb(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 eI=w({version:O(),name:O(),shared:XT.optional(),sections:ae(YT),templates:ae(DT),layouts:ae(Wb),slots:ae(qb),collections:ae(FT),compressionEnabled:te(),externalizationEnabled:te(),vueVersion:O(),openSource:te().optional()}).strict().superRefine((e,s)=>{const i=new Set;e.templates.forEach((a,c)=>{const u=Se(s).at(["templates",c]);Yb(a.configuration.header,e.sections,u.at(["configuration","header"])),Xb(a.configuration.footer,e.sections,u.at(["configuration","footer"])),a.configuration.announcementBars?.forEach((h,f)=>{Jb(h,e.sections,u.at(["configuration","announcementBars",f]))}),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"?uu(T,e.sections,A):T.type==="store"&&(T.id&&i.add(`${h.type.toLowerCase()}:${T.id}`),Qb(T,h,e.layouts,A))})})}),e.layouts.forEach((a,c)=>{i.has(`${a.sectionId}:${a.id}`)&&Kb(Se(s).at(["layouts",c]),a)}),e.collections.forEach((a,c)=>{a.descriptor.sections.forEach((u,h)=>{const f=Se(s).at(["collections",c,"sections",h]);uu(u,e.sections,f,!0)})})});dt({customError:Xg});const v={error:e=>console.log(Pp(e)),warn:e=>console.log(Ap(e)),info:e=>console.log(Ke(e))},tI="dist",sI="dist/shared",ct="dist/sections",An="dist/headers",Pn="dist/footers",wn="dist/announcement-bars",Tt="dist/templates",ps="layouts",hu="preview",ze=`dist/${ps}`,Bs="dist/collections",pu="dist/manifest.json",iI=[ct,An,Pn,wn,Tt,ze];function Gi(e){return!!e}function Ht(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const rI="Resource name can only contain alphanumeric characters, dashes, and underscores";function nI(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:rI}}function aI(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}function oI(e){return Te.parse(e).name}function cI(e){return e.split("-").filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}async function Hi(){const e=await Lr(V(process.cwd(),"crane.config.json")),s=JSON.parse(e.toString());return{appClientId:s.app_client_id,appSecretKey:btoa(s.app_secret_key)}}function lI(e){return e.includes(`
|
|
62
|
+
`)}function uI(e,s,i){return e.split(`
|
|
63
63
|
`).map((a,c)=>c>=i?s+a:a).join(`
|
|
64
|
-
`)}function Zt(e,s){const i=[];if(e instanceof
|
|
64
|
+
`)}function Zt(e,s){const i=[];if(e instanceof to){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=lI(u.errorMessage)?uI(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 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:
|
|
66
|
+
`:" ";return`${s}${c}${a}`}function Cn(e,s){return Object.keys(e).reduce((i,a)=>{const c=e[a],u=s[a];return Ht(c)&&Ht(u)?i[a]=Cn(c,u):i[a]=c,i},{...s})}function hI({contentSettings:e,sectionType:s}){const i=pl(s);return Cn(e,i)}function pI({designSettings:e,sectionType:s}){const i=dl(s);return Cn(e,i)}async function Ye(e){return(await import(eo(e).href+`?t=${Date.now()}`)).default}function _n(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function nt(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const s=Lp(e);return{type:"STRUCTURED_COLOR",raw:e,hex:s.toHex8String(),hsl:s.toHsl(),rgba:s.toRgb(),auto:!1}}function du(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 dI(e){if(e!==void 0)return{...e,color:nt(e.color)}}function Wt(e){return Object.fromEntries(Object.entries(e).filter(([s,i])=>i!==void 0))}function fI(e){if(e!==void 0)switch(e){case Wr.COLOR:return"solid";case Wr.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Wr)}`)}}function mI({style:e,color:s}){const i=Array.isArray(s)?s:[s,s];return{background:{type:fI(e),solid:{color:nt(i.at(0))},gradient:{fromColor:nt(i.at(0)),toColor:nt(i.at(1))}}}}function yI(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(Og)}`)}}function gI(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(Dg)}`)}}function EI(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(Rg)}`)}}function TI(e){return e===mi.GO_TO_STORE?mi.GO_TO_STORE_LINK:e===mi.GO_TO_CATEGORY?mi.GO_TO_CATEGORY_LINK:e}function SI(e){const s=yI(e.appearance),i=gI(e.size),a=EI(e.shape),c=_n(e.font),u=nt(e.color),h=e.visible;return Wt({appearance:s,size:i,style:a,font:c,color:u,visible:h})}function bI(e){return{...e,buttonType:TI(e.buttonType)}}function II(e){const s=nt(e.color);return Wt({color:s})}function xI(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 AI(e){const s=e.color,i=Array.isArray(s)?s:[s,s],a=e.visible,c={type:xI(e.overlay),solid:{color:nt(i.at(0))},gradient:{fromColor:nt(i.at(0)),toColor:nt(i.at(1))}};return Wt({overlay:c,visible:a})}function PI(e){const s=_n(e.font),i=nt(e.color),a=du(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:dI(e.frame),bold:c,italic:u,spacing:h,capitalization:f,visible:y})}function wI(e){const s=e.value;return Wt({value:s})}function CI(e){const s=_n(e.font),i=nt(e.color),a=du(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 _I(e){const s=e.enabled;return Wt({enabled:s})}function NI(e){return e===ii.GO_TO_STORE_LINK?ii.GO_TO_STORE:e===ii.GO_TO_CATEGORY_LINK?ii.GO_TO_CATEGORY:e}function fu(e){return e.map(s=>s.type?{...s,type:NI(s.type)}:s)}function vI(e){return e.items?{...e,items:fu(e.items)}:e}function OI(e){return e.items?{...e,items:fu(e.items)}:e}function LI(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=Zi(h,{defaults:u});f&&u?a[c]={...u,...f}:a[c]=u}),{...i,settings:a}});return{...e,cards:s}}function Nn(e,s){if(s.defaults===void 0)return;let i={};switch(e){case He.TEXT:{i=CI(s.defaults);break}case He.BUTTON:{i=SI(s.defaults);break}case He.IMAGE:{i=AI(s.defaults);break}case He.BACKGROUND:{i=mI(s.defaults);break}case He.COLOR_PICKER:{i=II(s.defaults);break}case He.LOGO:{i=PI(s.defaults);break}case He.SELECTBOX:{i=wI(s.defaults);break}case He.TOGGLE:{i=_I(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 mu(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:mu(y.editors)}]));s[i]={...a,items:h};return}const u=Nn(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}),s}function DI(e){return e===void 0?e:e.map(s=>{if(s.type!==void 0&&s.defaults!==void 0&&s.fieldName!==void 0){const i={...Nn(s.type,s)??s.defaults,type:s.defaults.type??s.type};return{type:s.type,fieldName:s.fieldName,defaults:i}}return s})}function vn(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:vn(y.editors)??y.editors}]));s[i]={type:a.type,items:h};return}const u=Nn(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function Zi(e,s){if(s.defaults!==void 0)switch(e){case F.BUTTON:return bI(s.defaults);case F.MENU:return vI(s.defaults);case F.NAVIGATION_MENU:return OI(s.defaults);case F.DECK:return LI(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 kI(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=yu(a);else{const u=Zi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function yu(e){const s=e.cards.defaultCardContent.settings,i=kI(s);return{...e,cards:{...e.cards,defaultCardContent:{...e.cards.defaultCardContent,settings:i}}}}function RI(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=yu(a);else{const u=Zi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function MI(e){if(e===void 0)return;const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type,u=Zi(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function $I(e,s){if(!s)return;const i=e[s];return i===void 0?{en:s}:i}function FI(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 BI(e){return e.every(s=>s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean")}function ds(e,s){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return BI(e)?e:e.map(c=>ds(c,s));const i=e,a={};for(const c in i){const u=i[c];typeof u=="string"&&u.startsWith("$")?a[c]=$I(s,u):typeof u=="object"&&u!==null?a[c]=ds(u,s):a[c]=u}return a}async function Us(e){return e?FI(e):{}}async function UI(e,s=ct){const i=V(process.cwd(),`${s}/${e}/js/settings/translations.mjs`);return await Ye(i)}async function Wi(e,s=ct){const i=V(process.cwd(),`${s}/${e}/js/showcases/translations.mjs`);return await Ye(i)}async function jI(e,s){const i=V(process.cwd(),`${ze}/${s}/${e}/js/settings/translations.mjs`);if(Oe(i))return await Ye(i)}async function On(e,s,i){const a=i?hI({contentSettings:e,sectionType:i}):e,c=RI(a);return ds(c,s)}async function zI(e,s=ct){try{const i=V(Ie.cwd(),`${s}/${e}/js/settings/content.mjs`),a=await Ye(i);return cs(a)}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Ln(e,s,i){const a=i?pI({designSettings:e,sectionType:i}):e,c=mu(a);return ds(c,s)}async function VI(e,s=ct){try{const i=V(Ie.cwd(),`${s}/${e}/js/settings/design.mjs`),a=await Ye(i);return cs(a)}catch(i){const a=i;throw new Error(`Design settings is invalid or undefined. Error ${a.stack}`)}}async function GI(e,s){return Promise.all(e.map(async i=>{const a=i.content?MI(i.content):void 0,c=i.design?vn(i.design):void 0,u={...i,content:a??i.content,design:c??i.design};return ds(u,s)}))}async function HI(e,s=ct){try{const i=await Z("*.mjs",{cwd:V(Ie.cwd(),`${s}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(i.map(async a=>{const c=V(Ie.cwd(),`${s}/${e}/js/showcases/${a}`);return await Ye(c)}))}catch(i){throw new Error(`Showcases is invalid or undefined. Error ${i}`)}}async function gu(e){return e?.map(s=>({...s,selectedDesignSettings:DI(s.selectedDesignSettings)??s.selectedDesignSettings}))??[]}async function ZI(e,s=ct){try{const i=V(Ie.cwd(),`${s}/${e}/js/settings/layout.mjs`);return Oe(i)?await Ye(i):[]}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}function WI(e){let s={};const i=V(Ie.cwd(),`${hu}/shared/analytics.json`);if(!Oe(i))return 0;try{const a=_r(i,"utf-8");s=JSON.parse(a)}catch(a){console.warn("Error processing analytics.json file",a)}return s[e]||0}const fs={Server:0,Client:1,SectionAsset:4,PageTemplateDescriptor:6,TemplateAsset:7,SharedTranslation:13},Dn="https://blockbuster.ecwid.com",KI="/api/v1/custom-apps/resources/sections/upload",qI="/api/v1/custom-apps/resources/templates/upload",YI="/api/v1/custom-apps/manifests/sections",XI="/api/v1/custom-apps/manifests/templates",JI=5,QI=3,ex=[se.Server,se.Client,se.ClientChunks,se.ClientAsset,se.Asset],tx=[se.LayoutClient,se.LayoutAsset],sx=[se.SlotServer,se.SlotClient,se.SlotClientChunks,se.SlotClientAsset],ix=[se.Dependency,se.TemplateAsset,se.SourceCode,se.CollectionAsset],ms={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.`},Eu={catalog:"products",category:"category",product:"product"},Tu=e=>Eu[e],Su=e=>e in Eu;function rx(e){return e.replace(/\\/g,"/")}function nx(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function Ki(e){return nx(rx(e))}function ax(e){const s=Ki(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(!Su(i))throw new Error(`Layout cannot be placed in a non-storefront section: ${i}`);const c=Tu(i);return{id:a,sectionId:i,pageId:c}}async function ox(e){return Promise.all(e.map(async s=>{const i=s.sectionId,a=Tu(i),c=await Us(s.translationsSettings),u=await On(s.content??{},c),h=await Ln(s.design??{},c),f=await gu(s.layouts);return{id:s.id,sectionId:i,pageId:a,contentEditors:u,designEditors:h,layouts:f}}))}function ys(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=it.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})=>ys(e,s,"")},[se.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s})=>ys(e,s,"assets/")},[se.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:s,slotId:i})=>ys(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})=>ys(e,s,"slots",i,"js/main/client/")},[se.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ys(e,s,"slots",i,"js/main/client/chunks/")},[se.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ys(e,s,"slots",i,"js/main/client/assets/")},[se.CollectionAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${Bs}/assets/`}};function cx(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function kn(){const e=V(si.cwd(),"package.json"),s=await Lr(e),i=JSON.parse(s.toString());if(cx(i))return i;throw new Error(`Package file located at path: ${e} does not contain a version field`)}const lx={layout:e=>e.layoutId,showcase:e=>e.showcaseId,templates:e=>{const s=e.id;return s?.includes("_")?s.substring(s.indexOf("_")+1):s}};function ux(e,s){const i=lx[e];return i?i(s):s.id}const hx=new Set(["content","design"]);function qi(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=ux(c,f);return a.push(`${c}[${y||u}]`),qi(f,s,i+2,a)}}if(typeof c=="string"&&typeof u=="string"&&hx.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 qi(f,s,i+2,a)}return a.push(c),qi(Ht(e)?e[c]:void 0,s,i+1,a)}function px(e){const s=e.errors.map(a=>qi(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=>v.error(a))}async function dx(e){const s=eI.safeParse(e);return{manifest:e,errors:s.success?[]:s.error.issues}}const fx=`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 mx(e,s){if(e.errors.length===0){v.info(fx);return}v.error("Invalid configuration detected:"),px(e),s||process.exit(1)}const bu={"process.env":{NODE_ENV:"production"}},yx=[...so,...so.map(e=>`node:${e}`)],gx=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],Iu=e=>({pluginType:Ge.Server,define:bu,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...yx,...gx],inlineDynamicImports:!0,...e,outDir:e.outDir}),xu=e=>({pluginType:Ge.Client,define:bu,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),gs=e=>({pluginType:Ge.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),Ex=e=>({pluginType:Ge.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),Yi=e=>({pluginType:Ge.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir});let Xi=!1;function Tx(e){Xi=e}function Rn(){return Xi}const Au=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Sx=80,bx="\x1B[?25l",Ix="\x1B[?25h",xx="\x1B[2K\r",Ax=44;let Px=class{frameIndex=0;timer=null;realWrite=null;buffer=[];start(){Xi||(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(bx),this.render(),this.timer=setInterval(()=>this.render(),Sx))}render(){if(!this.realWrite)return;const s=" Build is in progress...".padEnd(Ax-1," "),i=Ke(Au[this.frameIndex]+s);this.realWrite(`\r${i}`),this.frameIndex=(this.frameIndex+1)%Au.length}stop(){if(!Xi&&(this.timer&&(clearInterval(this.timer),this.timer=null),this.realWrite)){process.stdout.write=this.realWrite,this.realWrite(`${xx}${Ix}`);for(const s of this.buffer)this.realWrite(s);this.buffer=[],this.realWrite=null}}};const Pu=new Px,wx=()=>Dp({ext:".gz",algorithm:"gzip",verbose:Rn()}),Cx="/* EXTERNAL_IMPORTS_START */",_x="/* EXTERNAL_IMPORTS_END */",Nx=()=>({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=Cx+h+_x,y=a.code.replace(c,"");a.code=f+y}}}}}),vx=()=>({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})}}),Ox=()=>{const e=process.env.npm_lifecycle_event;return Mp({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"`}})},at={vue:()=>kp(),tsconfigPaths:()=>Rp(),checker:()=>Ox()};class ar{constructor(s){this.bits=s instanceof ar?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 Lx(){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 Dx=Lx();class kx{constructor(s){this.version=3,this.file=s.file,this.sources=s.sources,this.sourcesContent=s.sourcesContent,this.names=s.names,this.mappings=$p(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,"+Dx(this.toString())}}function Rx(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 Mx(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 $x=Object.prototype.toString;function Fx(e){return $x.call(e)==="[object Object]"}function wu(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 Bx=/\w/;class Ux{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"?Bx.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
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
|
-
`,
|
|
75
|
+
`,Es={insertLeft:!1,insertRight:!1,storeName:!1};class Vn{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 ar},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 Vn(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 ar(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 Ux(s.hires),u=wu(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?Mx(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 kx(this.generateDecodedMap(s))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=Rx(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(Fx(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
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
|
|
78
|
-
${
|
|
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
|
-
`),
|
|
81
|
-
`)}function
|
|
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 Es.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Es.insertLeft=!0),this.appendLeft(s,i)}insertRight(s,i){return Es.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Es.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&&(Es.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Es.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=wu(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 Cu=V(process.cwd(),"shared/translation.ts"),_u="globalThis.craneSharedTranslation = translation",jx=e=>`import translation from '${e}';
|
|
78
|
+
${_u};
|
|
79
|
+
`,zx=(e,s)=>{const i=e.split("?")[0],a=Ip(i);return(a==="server.ts"||a==="client.ts")&&!s.includes(_u)},Nu=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=Oe(Cu)},transform(s,i){if(!e||!zx(i,s))return null;const a=i.split("?")[0],c=qa(a),u=Cp(Ya(c,Cu)),h=jx(u),f=new Vn(s);return f.prepend(h),{code:f.toString()}}}},vu={[Ge.Server]:()=>[at.vue(),at.tsconfigPaths(),Nx(),wx(),Nu()],[Ge.Client]:()=>[at.vue(),at.tsconfigPaths(),io({vue:"EcVue"}),Nu()],[Ge.Misc]:()=>[at.tsconfigPaths()],[Ge.Layout]:()=>[at.vue(),at.tsconfigPaths(),io({vue:["EcExternals","Vue"]})],[Ge.Asset]:()=>[vx()],[Ge.SharedFiles]:()=>[at.tsconfigPaths()]},Ou={[pe.Server]:Iu({outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/main/server`}),[pe.Client]:xu({outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/main/client`}),[pe.SectionSetting]:gs({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/settings`}),[pe.SectionShowcase]:gs({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/js/showcases`}),[pe.SectionAsset]:Yi({outDir:({name:e,sectionType:s})=>`./${Pe[s].dist}/${e}/assets`}),[pe.TemplateDescriptor]:gs({entryFileNames:"[name].mjs",outDir:()=>`./${Tt}/js`}),[pe.PageTemplateDescriptor]:gs({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${Tt}/${e}`}),[pe.TemplateAsset]:Yi({outDir:()=>`./${Tt}/assets`}),[pe.Layout]:Ex({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}`}),[pe.LayoutSettings]:gs({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/js/settings`}),[pe.LayoutAsset]:Yi({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/assets`}),[pe.SlotServer]:Iu({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/server`}),[pe.SlotClient]:xu({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/client`}),[pe.CollectionDescriptor]:gs({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${Bs}/${e}`}),[pe.CollectionAsset]:Yi({outDir:()=>`./${Bs}/assets`}),[pe.SharedTranslation]:{pluginType:Ge.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function Vx(e){switch(typeof e){case"string":return[V(process.cwd(),e)];case"object":return e.map(s=>V(process.cwd(),s));default:return[]}}function Lu({name:e,entryPoints:s,configType:i,layoutId:a,sectionId:c,sectionType:u=it.SECTION}){const h=Ou[i],f=h.define,y=h.ssrOptions,T=h.entryFileNames,I=h.chunkFileNames,A=h.assetFileNames,L=h.inlineDynamicImports,R=h.externalOption;return{logLevel:Rn()?void 0:"silent",plugins:vu[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:Vx(s),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:L,entryFileNames:T,chunkFileNames:I,assetFileNames:A}}},assetsInclude:["**/*.json"]}}const Gx=Object.values(Pe).map(e=>e.source).join("|");function Du(e,s,i){if(!e)return`${s}.mjs`;const a=Ya(process.cwd(),e).replace(/\\/g,"/").match(`^(${Gx})/([^/]+)/${i}/([^/.]+)`);return a?`${a[1]}/${a[2]}/js/${i}/${a[3]}.mjs`:`${s}.mjs`}function ku(e,s){const i=Ou[pe.SectionSetting];return{logLevel:Rn()?void 0:"silent",plugins:vu[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=>V(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 Hx(e){return ku(e,s=>Du(s.facadeModuleId??void 0,s.name,"settings"))}function Zx(e){return ku(e,s=>Du(s.facadeModuleId??void 0,s.name,"showcases"))}async function Wx(){const e={ignore:["node_modules/**","dist/**"]},s=await Z(`./${ps}/{product,category,catalog}/*/client.{js,ts}`,e);return await Promise.all(s.map(async i=>{const{id:a,sectionId:c,pageId:u}=ax(i),[h,f]=await Promise.all([Z(`./${ps}/${c}/${a}/settings/{content,design,translations,layout}.{js,ts}`,e),Z(`./${ps}/${c}/${a}/assets/*`,e)]);return{name:a,sectionId:c,pageId:u,clientEntrypoint:i,settingsEntryPoints:h,assetsEntrypoints:f}}))}async function Kx(e){await Xe({entryPoints:[e.clientEntrypoint],configType:pe.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([Xe({entryPoints:e.settingsEntryPoints,configType:pe.LayoutSettings,name:e.name,sectionId:e.sectionId}),Xe({entryPoints:e.assetsEntrypoints,configType:pe.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function qx(e){e===void 0||e.length===0||await Promise.all(e.map(s=>Kx(s)))}async function Yx(e){const s=e.flatMap(a=>a.settingsEntryPoints),i=e.flatMap(a=>a.showcaseEntryPoints);s.length>0&&await pt({configFile:!1,...ti(Hx(s))}),i.length>0&&await pt({configFile:!1,...ti(Zx(i))})}async function Xx(e){await Promise.all([pt({configFile:!1,...ti(Lu({name:e.name,entryPoints:e.serverEntrypoint,configType:fs.Server,sectionType:e.type}))}),Xe({entryPoints:e.clientEntrypoint,configType:fs.Client,name:e.name,sectionType:e.type}),Xe({entryPoints:e.assetEntryPoints,configType:fs.SectionAsset,name:e.name,sectionType:e.type})])}async function Jx(){const e=V(process.cwd(),"shared/translation.ts");Oe(e)&&await Xe({entryPoints:["shared/translation.ts"],configType:fs.SharedTranslation})}async function Ru(e){await Promise.all([Yx(e),...e.map(Xx)])}function Qx(e){const s=Ki(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(!Su(i))throw new Error(`Slot cannot be placed in a non-storefront section: ${i}`);return{id:c,sectionId:i,layoutId:a}}async function eA(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 On(a?.content??{},c),h=await Ln(a?.design??{},c);return{id:i.id,sectionId:i.sectionId,layoutId:i.layoutId,contentEditors:u,designEditors:h}}))}async function tA(){const e={ignore:["node_modules/**","dist/**"]},s=await Z(`${ps}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(s.map(async i=>{const{id:a,sectionId:c,layoutId:u}=Qx(i),h=(await Z(`${ps}/${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 sA(e){const s={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await Promise.all([Xe({entryPoints:[e.serverEntrypoint],configType:pe.SlotServer,...s}),Xe({entryPoints:[e.clientEntrypoint],configType:pe.SlotClient,...s})])}async function iA(e){e?.length&&await Promise.all(e.map(sA))}async function rA(e){return(await Z(`**/${e}/pages/*.{js,ts}`,{ignore:["node_modules/**","dist/**"]})).filter(s=>{const i=Xa(s).name.toLowerCase();return!Object.values(Tc).includes(i)})}async function nA(){const e=await Z("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(s=>(v.error(`Error while getting page template entry points: ${s}`),[]));return Promise.all(e.map(async s=>{const i=s.split(Or),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 Z(`**/templates/${a}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await Z(`**/templates/${a}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),h=await Z(`**/templates/${a}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await Z(`**/templates/${a}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await Z(`**/templates/${a}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),T=await rA(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 aA(){const e=await Z("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),s=await Z("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await nA(),templates:e,assets:s}}async function oA({templateBuildConfig:e}){await Promise.all([Xe({entryPoints:e.assets,configType:fs.TemplateAsset}),...e.pageTemplates?.map(async s=>{const i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint,...s.customEntrypoint??[]].filter(Gi);if(i.length===0)throw new Error("No entry points provided for page template");await Xe({entryPoints:i,configType:fs.PageTemplateDescriptor,name:s.name})})||[]])}async function cA(){const e=await aA();await oA({templateBuildConfig:e})}async function lA(){const e=await Z("./collections/*",{ignore:["collections/assets/**","collections/**.{js,ts}","node_modules/**","dist/**"]}).catch(i=>(v.error(`Error while getting collection entry points: ${i}`),[])),s=await Z("./collections/assets/*",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async i=>{const a=i.split(Or),c=a.pop()??"default";if(a.pop()===void 0)throw new Error("Cannot determine collection, outer directory is undefined");const u=await Z(`**/collections/${c}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:c,configurationEntrypoint:u.at(0),assetsEntrypoints:s}}))}async function uA(){const e=await lA();e.length!==0&&await Promise.all(e.flatMap(s=>[Xe({entryPoints:s.assetsEntrypoints,configType:pe.CollectionAsset,name:s.name}),Xe({entryPoints:s.configurationEntrypoint?[s.configurationEntrypoint]:[],configType:pe.CollectionDescriptor,name:s.name})]))}function Mu(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(Gi).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(Gi),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(Gi),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 hA(e,s=ct){const i=V(process.cwd(),`${s}/${e}/js/main/server/server.js.gz`),a=ro(no.gunzip),c=await ee.promises.readFile(i);return{size:(await a(c)).length}}async function pA(e,s=ct){try{const i=V(process.cwd(),`${s}/${e}/assets/`);return(await Z("*",{cwd:i})).map(a=>{const c=V(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 Ji(e,s){const i=await UI(e,Pe[s].dist),a=await Wi(e,Pe[s].dist),c=await zI(e,Pe[s].dist),u=await VI(e,Pe[s].dist),h=await HI(e,Pe[s].dist),f=await ZI(e,Pe[s].dist),y=$u(f),T=await pA(e,Pe[s].dist),I=await hA(e,Pe[s].dist),A=WI(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 dA(){const e=await Z("*/",{cwd:V(process.cwd(),`${ct}/`)}),s=await Z("*/",{cwd:V(process.cwd(),`${An}/`)}),i=await Z("*/",{cwd:V(process.cwd(),`${Pn}/`)}),a=await Z("*/",{cwd:V(process.cwd(),`${wn}/`)});return Promise.all([...e.map(async c=>Ji(c,vt.SECTION)),...s.map(async c=>Ji(c,vt.HEADER)),...i.map(async c=>Ji(c,vt.FOOTER)),...a.map(async c=>Ji(c,vt.ANNOUNCEMENT_BAR))])}async function fA(e){try{const s=V(process.cwd(),`${e}/assets/`);return(await Z("*",{cwd:s})).map(i=>{const a=V(s,i);return{path:i,size:ws(a).size}})}catch{throw new Error("Asset files for layouts are either invalid or undefined")}}async function mA(e){const s=Ki(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([TA(a,i),SA(a,i),jI(a,i),fA(e),EA(i,a),bA(a,i)]);return{id:a,sectionId:i,content:c,design:u,translationsSettings:h,assets:f,layouts:T,templateContent:y}}async function yA(){const e=`${ze}/{product,catalog,category}/*`,s=await Z(e,{ignore:["node_modules/**"]});return Promise.all(s.map(mA))}function gA(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}async function EA(e,s){const i=`layouts/${e}/${s}/Main.vue`;try{const a=V(process.cwd(),i);return await ee.promises.readFile(a,"utf-8")}catch(a){if(gA(a)){v.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 TA(e,s){try{const i=V(process.cwd(),`${ze}/${s}/${e}/js/settings/content.mjs`),a=await Ye(i);return cs(a)}catch(i){throw new Error(`Content descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function SA(e,s){try{const i=V(process.cwd(),`${ze}/${s}/${e}/js/settings/design.mjs`),a=await Ye(i);return cs(a)}catch(i){throw new Error(`Design descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function bA(e,s){try{const i=V(process.cwd(),`${ze}/${s}/${e}/js/settings/layout.mjs`);if(!ee.existsSync(i))return[];const a=await Ye(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 IA(e,s,i){const a=V(process.cwd(),`${ze}/${i}/${s}/slots/${e}/js/main/server/server.js.gz`),c=ro(no.gunzip),u=await ee.promises.readFile(a);return{size:(await c(u)).length}}async function xA(e){const s=Ki(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 IA(c,a,i);return{id:c,sectionId:i,layoutId:a,server:u}}async function AA(){const e=`${ze}/{product,catalog,category}/*/slots/*`,s=await Z(e,{ignore:["node_modules/**"]});return await Promise.all(s.map(xA))}async function PA(){try{const e=V(process.cwd(),`${Tt}/assets/`);return(await Z("*",{cwd:e})).map(s=>{const i=V(e,s);return{path:s,size:ws(i).size}})}catch{throw new Error("Asset files for templates are either invalid or undefined")}}function wA(e){return e in Ut?Ut[e]:Ut.CUSTOM}async function CA(e){const s=await Z(`${Tt}/${e}/*.mjs`,{ignore:[`${Tt}/${e}/configuration*.mjs`]});return Promise.all(s.map(async i=>{const{sections:a,metadata:c}=await Mn(i),u=oI(i);return{type:wA(u.toUpperCase()),id:u,metadata:c,sections:a}}))}async function Mn(e){try{return await Ye(V(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function _A(e){const s=await Z(`${Tt}/**/configuration*.mjs`,{});return Promise.all(s.map(async i=>{const a=Te.basename(Te.dirname(i));return{id:`${e}_${a}`,assets:await PA(),configuration:await Mn(i),pages:await CA(a)}}))}async function NA(e){return await _A(e)}async function vA(){const e=V(process.cwd(),`${sI}/translation.mjs`);return await Ye(e)}async function OA(){return{translations:await vA()}}async function LA(e){const s=await Z(`${Bs}/*/configuration*.mjs`,{ignore:["node_modules/**",`${Bs}/assets/**`]});return Promise.all(s.map(async i=>{const a=Te.basename(Te.dirname(i)),c=await Mn(i);return{id:`${e}_${a}`,descriptor:c}}))}async function Fu(){const e=await Hi(),[s,i,a,c,u,h,f]=await Promise.all([kn(),OA(),dA(),yA(),AA(),NA(e.appClientId),LA(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 $n(e){return Oe(`${An}/${e}`)?it.HEADER:Oe(`${Pn}/${e}`)?it.FOOTER:Oe(`${wn}/${e}`)?it.ANNOUNCEMENT_BAR:it.SECTION}async function Fn(e,s){const i=e.design?vn(e.design):void 0,a={...e,design:i??e.design},c=await Us(s);return ds(a,c)}function Bn(e){return e.type==="custom"&&e.id!==void 0&&e.showcase_overrides!==void 0}async function Un(e){if(Bn(e)){const s=await Wi(e.id,Pe[$n(e.id)].dist);return{...e,showcase_overrides:await Fn(e.showcase_overrides,s)}}return e}async function DA(e){const s=Bn(e.header)?{...e.header,showcase_overrides:await Fn(e.header.showcase_overrides,await Wi(e.header.id,Pe[$n(e.header.id)].dist))}:e.header,i=Bn(e.footer)?{...e.footer,showcase_overrides:await Fn(e.footer.showcase_overrides,await Wi(e.footer.id,Pe[$n(e.footer.id)].dist))}:e.footer,a=e.announcementBars?await Promise.all(e.announcementBars.map(c=>Un(c))):void 0;return{...e,header:s,footer:i,...a?{announcementBars:a}:{}}}async function kA(e){const s=await Promise.all(e.pages.map(async a=>({...a,sections:await Promise.all(a.sections.map(c=>Un(c)))}))),i=await DA(e.configuration);return{id:e.id,descriptor:{...i,pages:s}}}async function RA(e){return Promise.all(e.map(s=>kA(s)))}async function MA(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 $A(e,s,i){const[a,c,u,h]=await Promise.all([On(e.content,s,e.type),Ln(e.design,s,e.type),GI(e.showcase,i),gu(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 FA(e,s){return Promise.all(e.map(async i=>{const a=s.get(i.id)??{settings:{},showcases:{}};return $A(i,a.settings,a.showcases)}))}async function BA(e){return Promise.all(e.map(async s=>{const i=await Promise.all(s.descriptor.sections.map(a=>Un(a)));return{...s,descriptor:{...s.descriptor,sections:i}}}))}async function Bu(e){const s=await MA(e.sections),[i,a,c,u,h]=await Promise.all([FA(e.sections,s),ox(e.layouts),eA(e.slots,e.layouts),RA(e.templates),BA(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 UA(e){const s=V(si.cwd(),pu);return vp(s,JSON.stringify(e))}function jA(e){return Object.entries(Pe).find(s=>s[1].source===e)?.[0]}async function Uu(){const e=await Z("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**","collections/**"]});return Promise.all(e.map(async s=>{const i=qa(s).split(Or),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([Z(`**/${a}/client.{js,ts}`,{ignore:u}),Z(`**/${a}/settings/content.{js,ts}`,{ignore:u}),Z(`**/${a}/settings/design.{js,ts}`,{ignore:u}),Z(`**/${a}/settings/layout.{js,ts}`,{ignore:u}),Z(`**/${a}/settings/translations.{js,ts}`,{ignore:u}),Z(`**/${a}/showcases/*.{js,ts}`,{ignore:[...u,`**/${a}/showcases/translations.{js,ts}`]}),Z(`**/${a}/showcases/translations.{js,ts}`,{ignore:u}),Z(`**/${a}/assets/*`,{ignore:u})]);return{name:a,type:jA(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 zA=["/settings/","/showcases/"];function VA(e){return zA.some(s=>e.includes(s))}function GA(){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||!VA(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 HA(e){GA(),await pt({configFile:!1,logLevel:"error",plugins:[at.vue(),at.tsconfigPaths(),at.checker()],build:{write:!1,rollupOptions:{input:V(process.cwd(),e)}}})}function ZA(){return Promise.all([Nr.rm("dist",{recursive:!0,force:!0}),Nr.rm("source-code",{recursive:!0,force:!0}),Nr.rm("source-code.zip",{force:!0})])}async function WA(){const e=new Ja,s=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"];(await kn()).openSource===!0&&s.splice(s.indexOf("**/assets/**/*"),1);const i=await Z("**/*",{cwd:V(process.cwd()),ignore:s,dot:!0,nodir:!0});try{i.forEach(u=>{const h=V(process.cwd(),u);e.addLocalFile(h,Xa(u).dir)});const a=zs[se.SourceCode].fileName,c=V(process.cwd(),a);await e.writeZipPromise(c)}catch(a){throw v.error("Error while zipping source files"),a}}async function Qi(e=!1,s=!1){Tx(s),Pu.start(),await ZA();try{const[i,a,c]=await Promise.all([Wx(),Uu(),tA()]),u=a.map(Mu);a.length>0&&await HA(a[0].serverEntrypoint);try{await Promise.all([Jx(),Ru(u),cA(),uA(),qx(i),iA(c),WA()])}finally{Pu.stop()}const h=await Fu(),f=await dx(h);mx(f,e);const y=await Bu(h);await UA(y)}catch(i){v.error(`Error while building: ${i.message}`),e||process.exit(1)}}async function Xe({entryPoints:e,configType:s,name:i,sectionType:a,sectionId:c,layoutId:u}){if(e.length!==0){const h=ti(Lu({name:i,entryPoints:e,configType:s,sectionType:a,sectionId:c,layoutId:u}));await pt({configFile:!1,...h})}}function ju(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);ju(c,u,i)})):Fp.isMatch(e,i,{dot:!0})||Qs.copyFileSync(e,s)}function St(e,s,i,a,c=[]){const u=ei.join(e,a?.[i]??i);ju(ei.join(s,i),u,c)}function KA(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>v.info(`Template [${e}] with pages structure named has been created`)}}function lt(e){return Re.resolve(Bp(import.meta.url),"../..",e)}function er(e,s,i,a){try{const c=be.cwd(),u=Te.join(c,s);ee.existsSync(u)||ee.mkdirSync(u);const h=Te.join(c,s,i);ee.existsSync(h)?(v.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=lt(e);ee.readdirSync(f).forEach(async y=>St(h,f,y)),v.info(`${a} ${i} created`)}catch(c){v.error(`Error while creating ${a}: ${c.message}`),be.exit(1)}}function jn(e){const s=be.cwd(),i=lt(`template/${e}`),a=Te.join(s,e);ee.existsSync(a)||(ee.mkdirSync(a),ee.readdirSync(i).forEach(async c=>St(a,i,c)))}async function qA(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 es({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),v.info(`Replaced "${e.name}" with template version.`)):v.info(`Kept existing "${e.name}".`):v.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`))}async function tr(e,s,i=!1){async function a(u,h,f){const y=Te.join(h,u.name),T=Te.join(f,u.name);u.isDirectory()?await tr(y,T,i):await qA(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 sr(e=!1){try{const s=be.cwd(),i=Te.join(s,"shared"),a=lt("template/shared");if(!ee.existsSync(a))return;await tr(a,i,e)}catch(s){v.error(`Error while processing shared folder: ${s.message}`),be.exit(1)}}async function YA(e){await sr(),er("template/announcement-bars/example-announcement-bar","announcement-bars",e,"Announcement bar")}function XA(){const e=lt("package.json");return e!==""?JSON.parse(me.readFileSync(e,"utf8")):{}}async function JA(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)?(v.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=lt("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=XA();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
|
+
`),v.info(`App ${e} created`)}catch(s){v.error(`Error while creating app: ${s.message}`),be.exit(1)}}async function QA(e,s){await sr(),er(`${`template${s?"/blank":""}`}/sections/${`${s?"blank-section":"example-section"}`}`,"sections",e,"Section")}function eP(e){return{renameFiles:{"example-collection":`${e}`},targetPath:e,sourcePath:"template/collections",onCollectionCreated:()=>v.info(`Collection [${e}] has been created`)}}async function tP(e){const{targetPath:s,renameFiles:i,sourcePath:a,onCollectionCreated:c}=eP(e);try{const u=be.cwd(),h=Re.join(u,"collections"),f=lt(a),y=me.readdirSync(f);me.existsSync(h)?me.existsSync(Re.join(h,s))&&(v.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){v.error(`Error while creating collection: ${u.message}`),be.exit(1)}}async function sP(e){await sr(),er("template/footers/example-footer","footers",e,"Footer")}async function iP(e){await sr(),er("template/headers/example-header","headers",e,"Header")}async function rP(e,s){try{const i=be.cwd(),a=Re.join(i,"templates"),c=lt("template/page-templates/example-template/pages");me.existsSync(Re.join(a,e))||(v.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`))&&(v.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: '${cI(s)}'`),h=Re.join(a,e,"pages",`${s}.ts`);me.writeFileSync(h,u),v.info(`Page [${s}.ts] created for template ${e}`)}catch(i){v.error(`Error while creating page: ${i.message}`),be.exit(1)}}async function nP(){try{const e=be.cwd(),s=lt("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 es({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):v.info(`Skipped: ${T}`)}else St(h,u,T)}}v.info("Reference templates have been added to the app"),a&&v.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){v.error(`Error while creating template descriptors: ${e.message}`),be.exit(1)}}const aP=["**/example-template/pages/custom.ts"];async function oP(e){const{targetPath:s,renameFiles:i,sourcePath:a,onTemplateCreated:c}=KA(e);try{const u=be.cwd(),h=Re.join(u,"templates"),f=lt(a),y=me.readdirSync(f);me.existsSync(h)?me.existsSync(Re.join(h,s))&&(v.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,aP)),jn("headers"),jn("footers"),jn("layouts"),c()}catch(u){v.error(`Error while creating template descriptors: ${u.message}`),be.exit(1)}}function cP(){try{const e=V(si.cwd(),`${hu}/shared/analytics.json`);Oe(e)&&vr(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}function ir({deploymentContext:e,sectionType:s=it.SECTION}){const i=e.pathContext,a=i.toPath({sectionId:e.currentSection,sectionType:s,layoutId:e.layoutId,slotId:e.slotId}),c=a===void 0?Qa(i.fileName):Qa(i.fileName,{cwd:V(process.cwd(),a),ignore:i.ignore});return(i.isSingleton?c.splice(0):c).map(u=>({url:u,sectionType:s,context:e}))}const lP=e=>e.app.manifest.blocks.flatMap(s=>ex.flatMap(i=>{const a={config:e,currentSection:s.id,pathContext:zs[i]};return ir({deploymentContext:a,sectionType:s.type})})),uP=e=>ix.flatMap(s=>{const i={config:e,pathContext:zs[s]};return ir({deploymentContext:i})}),hP=e=>e.app.manifest.layouts.flatMap(s=>tx.flatMap(i=>{const a={config:e,pathContext:zs[i],currentSection:s.sectionId,layoutId:s.id};return ir({deploymentContext:a})})),pP=e=>e.app.manifest.slots.flatMap(s=>sx.flatMap(i=>{const a={config:e,pathContext:zs[i],currentSection:s.sectionId,layoutId:s.layoutId,slotId:s.id};return ir({deploymentContext:a})})),dP=e=>`\x1B[32m${e}\x1B[0m`,fP=(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`})},mP=()=>new zp.SingleBar({format:`|${dP("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});async function zu(e){await new Promise(s=>setTimeout(s,e))}const Vu="Please ensure you have built your application before deploying.";async function yP(){try{const e=await Lr(V(si.cwd(),pu));return JSON.parse(e.toString())}catch(e){throw e.code==="ENOENT"?new Error(`Manifest file not found. ${Vu}`):e instanceof SyntaxError?new Error(`Manifest file is not valid. ${Vu}`):e}}const gP={value:0},Je=mP();let Gu=Date.now();const Hu=e=>2**e*500;async function EP(e){const s=jp(e.version,"patch");if(s===null)throw Error("Error while incrementing app version");e.version=s,vr(V(Ie.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
81
|
+
`)}function TP(e){return e instanceof to&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function Zu(e,s){return e<QI&&TP(s)}async function Wu(e,s,i,a){const c={value:0},u=e.config.app.manifest.templates.length>0||e.config.app.manifest.collections.length>0?qI:KI;return e.config.axios.post(u,{file:Tp(V(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=>fP(h,Je,gP,c,Gu)}).then(h=>(Je.increment(),h)).catch(async h=>{if(Zu(a,h))return await zu(Hu(a)),Wu(e,s,i,a+1);throw Je.increment(),h})}function SP(e){return Je.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 Wu(i,s.url,a,0)})}function bP(e){const s=[...lP(e),...uP(e),...hP(e),...pP(e)];return SP(s)}async function Ku(e,s=0){const i=e.app.manifest.templates.length>0||e.app.manifest.collections.length>0?XI:YI;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(Zu(s,a))return await zu(Hu(s)),Ku(e,s+1);throw a})}async function IP(e){try{if(!iI.some(h=>Oe(V(Ie.cwd(),h))))throw new Error(ms.INCORRECT_DISTRIBUTION_FOLDER(tI));const s=e??Dn;v.info("Custom application deployment :: Started");const i=Dr.create({baseURL:s});Up(i,JI),v.info("Loading configuration files ...");const a=await Promise.all([Hi(),kn(),yP()]).then(([h,f,y])=>({axios:i,app:{crane:h,packageJson:f,manifest:y}}));v.info("Uploading files ..."),Gu=Date.now(),await Promise.all(bP(a)).catch(h=>{Je.stop(),h.response?.status===404?v.error(Zt(h,ms.DEPRECATED_VERSION_DEPLOYMENT)):v.error(Zt(h,ms.ASSET_FILES_UPLOAD)),Ie.exit(1)}).finally(()=>{Je.increment(),Je.stop()}),Je.update({speed:"N/A",status:"Finalising deployment"}),await Ku(a).catch(h=>{Je.stop(),h.response?.status===404?v.error(Zt(h,ms.DEPRECATED_VERSION_DEPLOYMENT)):v.error(Zt(h,ms.MANIFEST_DEPLOYMENT)),Ie.exit(1)}).finally(()=>{Je.increment(),Je.stop()});const c=a.app.manifest.blocks.map(h=>h.id),u=a.app.packageJson.version;v.info("Custom application deployment :: Successful"),v.info(`Current app version: ${u}`),v.info(`Deployed sections: ${c.sort().join(", ")}`),await EP(a.app.packageJson),a.app.manifest.templates.length>0&&v.info(`Deployed templates: ${a.app.manifest.templates.map(h=>h.id).sort().join(", ")}`),a.app.manifest.slots.length>0&&v.info(`Deployed slots: ${a.app.manifest.slots.map(h=>h.id).sort().join(", ")}`),a.app.manifest.collections.length>0&&v.info(`Deployed collections: ${a.app.manifest.collections.map(h=>h.id).sort().join(", ")}`)}catch(s){Je.stop(),v.error(Zt(s,ms.DEFAULT)),Ie.exit(1)}finally{cP()}}function xP(){process.env.CRANE_DEBUG_ENABLED="true"}function AP(){return process.env.CRANE_DEBUG_ENABLED==="true"}function PP(e,...s){AP()&&console.debug(wp(`[DEBUG] ${e}`),...s)}function wP(){return{name:"app-block-api",configureServer(e){e.middlewares.use(async(s,i,a)=>{e.moduleGraph.invalidateAll();const c=new Op(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 Fu(),f=(await Bu(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 CP(){Kt&&Kt.clients.forEach(e=>{e.readyState===Gp.OPEN&&e.send(JSON.stringify({type:"full-reload"}))})}async function _P(e,s){const i=V(`${e}/ssr-server.ts`),a=V(s);await pt({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 NP(e,s){const i=V(`${e}/shared/preview.ts`),a=V(`${e}/shared/utils.ts`),c=V(`${e}/shared/api-routes.ts`),u=V(s);await pt({build:{lib:{entry:i,formats:["es"],fileName:()=>"preview.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await pt({build:{lib:{entry:a,formats:["es"],fileName:()=>"utils.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await pt({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 vP(){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=lt("template/preview");ee.copyFileSync(`${u}/${i}`,`${e}/${i}`),await _P(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 NP(u,s)}function OP(e){const s=e.replace(/\\/g,"/").match(/(?:sections|headers|footers|announcement-bars)\/([^/]+)/);return s?s[1]:null}function LP(e){const s=e.replace(/\\/g,"/");return s.includes("shared")&&!s.includes("sections")&&!s.includes("headers")&&!s.includes("footers")&&!s.includes("announcement-bars")}async function DP(e){const s=(await Uu()).find(a=>a.name===e);if(!s){console.warn(`Block ${e} not found, falling back to full build`),await Qi(!0);return}const i=Mu(s);await Ru([i]),console.log(`Block ${e} rebuilt successfully`)}var kP=(e=>(e.FULL="full",e.INCREMENTAL="incremental",e))(kP||{});function RP(){return{timeout:null,inProgress:!1,pendingBuild:null}}function MP(e,s){const i=async a=>{e.inProgress=!0;try{a.type==="incremental"&&a.blockName?await DP(a.blockName):await Qi(!0),s.ws.send({type:"full-reload",path:"*"}),CP()}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 $P(e){const s=e.replace(/\\/g,"/"),i=s.match(/sections\/([^/]+)/),a=s.match(/headers\/([^/]+)/),c=s.match(/footers\/([^/]+)/),u=s.match(/announcement-bars\/([^/]+)/),h=s.match(/shared\//);return!!(i||a||c||u||h)}function FP(e,s){return async i=>{if(!$P(i))return;e.timeout&&clearTimeout(e.timeout);const a=OP(i),c=LP(i);e.timeout=setTimeout(async()=>{c?await s({type:"full"}):a&&await s({type:"incremental",blockName:a})},1e3)}}function BP(e,s){const i=RP(),a=MP(i,e),c=FP(i,a);e.watcher.add(s),e.watcher.on("add",c),e.watcher.on("change",c),e.watcher.on("unlink",c)}async function UP(){const e=Te.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=eo(e).href);const i=await import(s),{server:a,port:c}=await i.startServer();return{server:a,port:c}}function jP(){Kt=new Vp({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 zP(){const e=Te.resolve(process.cwd(),"preview/vite.config.js"),s=Te.resolve(process.cwd(),"sections/**/*"),i=Te.resolve(process.cwd(),"headers/**/*"),a=Te.resolve(process.cwd(),"footers/**/*"),c=Te.resolve(process.cwd(),"announcement-bars/**/*"),u=Te.resolve(process.cwd(),"shared/**/*"),h=await _p({configFile:e,root:process.cwd(),plugins:[wP()]});return await h.listen(),BP(h,[s,i,a,c,u]),h}async function VP(){await Qi(),await vP(),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;PP("Starting SSR server");const i=await UP();e=i.server,s=i.port,process.env.PREVIEW_SSR_PORT=String(s),jP();const a=await zP(),c=()=>{e&&e.close(),Kt&&Kt.close(),a.close(),process.exit(0)};return process.on("SIGINT",c),process.on("SIGTERM",c),a}const GP=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i,HP=/^[-a-zA-Z0-9_.^~<>=|* +]+$/;function qu({name:e,version:s}){return GP.test(e)&&HP.test(s)}function rr(e){if(!Oe(e))return{dependencies:{},devDependencies:{},overrides:{}};let s;try{s=JSON.parse(_r(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=rr(We(e,"package.json")),a=rr(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 WP(e,s){const i=rr(We(e,"package.json")).overrides,a=rr(We(s,"package.json")).overrides;return Object.fromEntries(Object.entries(i).filter(([c,u])=>a[c]!==u))}function KP(e){const s=Object.entries(e);if(s.length!==0){v.warn(`
|
|
84
|
+
The pulled source code defines npm overrides not present in your project:`);for(const[i,a]of s)v.warn(` - ${i}: "${a}"`);v.warn('Review these and add them to your package.json "overrides" section if needed.')}}function Yu(e){return e.map(s=>`${s.name}@${s.version}`).join(" ")}function qP(e){const s=e.filter(c=>!c.isDev),i=e.filter(c=>c.isDev),a=[];return s.length>0&&a.push(`npm install ${Yu(s)}`),i.length>0&&a.push(`npm install -D ${Yu(i)}`),a}function YP(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];v.info(`Running: npm ${u.join(" ")}`);const h=Zp("npm",u,{cwd:s,stdio:"inherit"});if(h.status!==0)throw new Error(`npm ${a.join(" ")} exited with code ${h.status}`)}}async function XP(e,s){if(e.length===0)return;const i=e.filter(y=>!qu(y));if(i.length>0){v.warn("Skipping dependencies with unsafe names/versions:");for(const y of i)v.warn(` - ${y.name}@${y.version}`)}const a=e.filter(qu);if(a.length===0)return;const c=a.length===1?"dependency":"dependencies";v.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){v.warn(" dependencies:");for(const y of u)v.warn(` - ${y.name}@${y.version}`)}if(h.length>0){v.warn(" devDependencies:");for(const y of h)v.warn(` - ${y.name}@${y.version}`)}const f=qP(a);switch((await es({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{YP(a,s),v.info("Dependencies installed successfully.")}catch{v.error("Failed to install dependencies. You can try running the commands manually:");for(const y of f)v.warn(` ${y}`)}break;case"add":{const y=We(s,"package.json"),T=JSON.parse(_r(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)))}vr(y,`${JSON.stringify(T,null,2)}
|
|
86
|
+
`),v.info('Dependencies added to package.json. Run "npm install" to install them.');break}case"show":v.info(`
|
|
87
|
+
Run the following command(s) to install the dependencies:`);for(const y of f)v.info(` ${y}`);break;default:v.info("Skipping dependency installation.");break}}async function JP(e,s,i){const a=s.split("_").pop()??s,c=We(e,"sections",a),u=We(e,a);let h=null;if(Oe(c)&&ws(c).isDirectory()?h=c:Oe(u)&&ws(u).isDirectory()&&(h=u),h){const f=We(i,a);Oe(f)&&((await es({type:"confirm",name:"value",message:`Section directory [sections/${a}/] already exists. Do you want to overwrite it?`,initial:!1})).value||(v.error("Operation cancelled. Section directory already exists."),Ie.exit(1)),v.info(`Deleting existing section directory [sections/${a}/]...`),Ka(f,{recursive:!0,force:!0})),v.info(`Copying section [sections/${a}/]...`),await tr(h,f,!1)}else v.error(`Section directory [sections/${a}/] not found in source code.`),Ie.exit(1)}async function QP(e,s,i){const a=Sp(We(Hp.tmpdir(),"crane-source-"));new Ja(Buffer.from(e)).extractAllTo(a,!0);try{const c=Ie.cwd(),u=We(c,"sections");Oe(u)||bp(u,{recursive:!0}),await JP(a,s,u);const h=We(a,"shared");if(Oe(h)){const y=We(c,"shared");v.info("Copying shared folder..."),await tr(h,y,!0)}const f=ZP(a,c);await XP(f,c),KP(WP(a,c)),v.info(`Source code for section [${i}] has been copied.`)}finally{Ka(a,{recursive:!0,force:!0})}}async function Xu(e){const s=e??Dn,i=Dr.create({baseURL:s}),a=await Hi();return[...(await i.get("/api/v1/custom-apps/manifests/collections/sections",{params:{appClientId:a.appClientId},headers:{Authorization:`Bearer ${a.appSecretKey}`}})).data.sections]}async function ew(e,s){const i=(await Xu(s)).find(a=>a.sectionId===e);return i||(v.error(`Section [${e}] not found in collection sections list.`),Ie.exit(1)),i}async function tw(e,s,i){const a=i??Dn,c=Dr.create({baseURL:a}),u=await Hi();v.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 sw(e){try{v.info("Fetching sections list...");const s=await Xu(e);v.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){v.error(Zt(s,"Error while fetching sections list")),Ie.exit(1)}}async function iw(e,s){try{const i=await ew(e,s);i.openSource||(v.error(`Section [${e}] is not open source. Only open source sections can be pulled.`),Ie.exit(1)),await tw(e,i.sectionId,s)}catch(i){v.error(Zt(i,"Error while pulling section")),Ie.exit(1)}}async function rw(e,s){const{list:i,section:a}=e;if(i){await sw(s);return}if(a){await iw(a,s);return}v.error("Please specify an action. Use --list to fetch sections list or --section to pull a section."),Ie.exit(1)}const nw={deploy:["url"],pull:["url"],init:[""],build:["generatePreview"]},aw=["preview","build","deploy","pull"];function ow(e,s){return aw.includes(e.rawName)?!1:e.options.length!==0&&Object.keys(s).length===1}function cw(e){return e.includes("-h")||e.includes("--help")}function lw(e,s){return Object.keys(s).some(i=>i!=="--"&&!e.hasOption(i)&&!nw[e.rawName]?.includes(i))}function uw(e){return e.length!==0}function hw(e,s,i){return e.matchedCommand!==void 0&&(ow(e.matchedCommand,i)||cw(e.rawArgs)||lw(e.matchedCommand,e.options)||uw(s))}function pw(e,s,i){e.matchedCommand&&!hw(e,s,i)?e.runMatchedCommand():e.outputHelp()}function nr(e){if(aI(e))return console.log("Please specify a name for your resource."),!1;const{isValid:s,errorMessage:i}=nI(e);return i&&console.log(i),s}async function zn(e){const s=await es({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(s.name!==void 0){const i=Te.basename(s.name);return nr(i)?i:zn(e)}}async function dw(e,s,i,a){const c=await zn(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 qt(e,s,i,a,c){if(c!==void 0)if(!nr(c))await dw(e,s,i,a);else{const u=Te.basename(c.toString());await a(u)}}function fw(){ee.existsSync("./templates")||(v.error(`No template found. Please create a template first using ${Ke("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&&(v.error(`No template found. Please create a template first using ${Ke("init --template <name>")}`),process.exit(1)),e}async function mw(e){const s=fw();if(typeof e=="string"||typeof e=="number"){if(s.includes(e.toString()))return e.toString();nr(e)?v.warn(`Template [${e}] doesn't exist`):v.error(`[${e}] is an invalid template name.`)}const i=await es({type:"select",name:"choice",message:"Please choose a template:",choices:s.map(a=>({title:a,value:a}))});return i.choice||(v.error("No template selected"),process.exit(1)),i.choice}async function yw(e,s){if(typeof s=="string"||typeof s=="number"){if(nr(s))return s.toString();v.error(`${s} is invalid name.`)}return zn(e)}async function gw(e,s,i){const a=await mw(s),c=await yw("page",i);if(c===void 0)return console.log(`You can use ${Ke("init --page <name>")} to directly specify the name of the page.`),e.outputHelp();await rP(a,c)}async function Ew(e,s){try{const{app:i,section:a,header:c,footer:u,announcementBar:h,template:f,referenceTemplate:y,page:T,blank:I,collection:A}=e;await qt(s,"app",Ke("init --app <name>"),JA,i),await qt(s,"section",Ke(`init --section <name>${I?" --blank":""}`),L=>QA(L,I===!0),a),await qt(s,"header",Ke("init --header <name>"),iP,c),await qt(s,"footer",Ke("init --footer <name>"),sP,u),await qt(s,"announcement bar",Ke("init --announcement-bar <name>"),YA,h),T===void 0?await qt(s,"template",Ke("init --template <name>"),oP,f):await gw(s,f,T),await qt(s,"collection",Ke("init --collection <name>"),tP,A),y&&await nP()}catch(i){v.error(`Error while executing init operation: ${i.message}`),process.exit(1)}}function Tw(){try{const e=xp("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("--announcement-bar [name]","Creates the files necessary for one custom announcement bar with the given name.").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=>Ew(i,e)),e.command("build","Builds your resource code").option("-v, --verbose","Show detailed build output").allowUnknownOptions().action(i=>Qi(!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&&xP(),await VP()}),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>IP(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=>rw(i,e.options.url)),e.version(Wp),e.usage("<action> <resource>");const s=e.parse(process.argv,{run:!1});pw(e,s.args,s.options)}catch(e){v.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{Tw as run};
|