@lightspeed/crane 3.4.5-rc.0 → 3.4.5-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,65 +1,87 @@
1
- import*as ft from"fs";import C,{existsSync as V,readFileSync as cn,statSync as Qe,promises as un,writeFileSync as ln,createReadStream as Oi,mkdtempSync as Ii,mkdirSync as wi,rmSync as po}from"fs";import*as ht from"path";import z,{resolve as T,dirname as fo,relative as ho,basename as vi,sep as dn,parse as mo,join as ne}from"path";import Ci from"cac";import{green as ce,yellow as Ri,red as bi,gray as Ai}from"kolorist";import Pe from"prompts";import Eo from"adm-zip";import{glob as I,globSync as go}from"glob";import ue from"typescript";import{normalizePath as Ni,build as ge,defineConfig as mt,createServer as $i}from"vite";import"vue";import"vue/server-renderer";import*as M from"process";import Et from"process";import{JSONPath as Li}from"jsonpath-plus";import{readFile as pn,writeFile as Di}from"fs/promises";import{pathToFileURL as _o,URL as ki}from"url";import fn,{AxiosError as yo}from"axios";import Pi from"tinycolor2";import{ButtonTypeEnum as gt}from"@lightspeed/crane-api";import{builtinModules as So}from"module";import{viteExternalsPlugin as To}from"vite-plugin-externals";import zi from"vite-plugin-compression";import ji from"@vitejs/plugin-vue";import Ui from"vite-tsconfig-paths";import Mi from"vite-plugin-checker";import{encode as Fi}from"@jridgewell/sourcemap-codec";import{promisify as Oo}from"node:util";import Io from"node:zlib";import L from"node:fs";import W from"node:path";import j from"node:process";import Gi from"micromatch";import{fileURLToPath as xi}from"node:url";import{ConcurrencyManager as Bi}from"axios-concurrency";import{inc as Zi}from"semver";import Hi from"cli-progress";import{WebSocketServer as Vi,WebSocket as Wi}from"ws";import*as Yi from"os";import{spawnSync as Ki}from"child_process";const Ji="3.4.5-rc.0";function l(e,t,n){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,d=Object.keys(u);for(let m=0;m<d.length;m++){const S=d[m];S in a||(a[S]=u[S].bind(a))}}const r=n?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ze extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class wo extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const hn={};function _e(e){return e&&Object.assign(hn,e),hn}function vo(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function mn(e,t){return typeof t=="bigint"?t.toString():t}function _t(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function En(e){return e==null}function gn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Xi(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){const c=o.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]))}const s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Co=Symbol("evaluating");function b(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==Co)return o===void 0&&(o=Co,o=n()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function be(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function we(...e){const t={};for(const n of e){const o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Ro(e){return JSON.stringify(e)}function Qi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const bo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function qe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const qi=_t(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function je(e){if(qe(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(qe(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ao(e){return je(e)?{...e}:Array.isArray(e)?[...e]:e}const ea=new Set(["string","number","symbol"]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ve(e,t,n){const o=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(o._zod.parent=e),o}function _(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ta(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const na={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 oa(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=we(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return be(this,"shape",i),i},checks:[]});return ve(e,s)}function ra(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=we(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return be(this,"shape",i),i},checks:[]});return ve(e,s)}function sa(e,t){if(!je(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=we(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return be(this,"shape",s),s}});return ve(e,r)}function ia(e,t){if(!je(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=we(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return be(this,"shape",o),o}});return ve(e,n)}function aa(e,t){const n=we(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return be(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return ve(e,n)}function ca(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=we(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return be(this,"shape",c),c},checks:[]});return ve(t,i)}function ua(e,t,n){const o=we(t._zod.def,{get shape(){const r=t._zod.def.shape,s={...r};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)s[i]=new e({type:"nonoptional",innerType:r[i]});return be(this,"shape",s),s}});return ve(t,o)}function Me(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Fe(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function yt(e){return typeof e=="string"?e:e?.message}function Ce(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=yt(e.inst?._zod.def?.error?.(e))??yt(t?.error?.(e))??yt(n.customError?.(e))??yt(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function _n(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function et(...e){const[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}const No=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$o=l("$ZodError",No),Lo=l("$ZodError",No,{Parent:Error});function la(e,t=n=>n.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}function da(e,t=n=>n.message){const n={_errors:[]},o=r=>{for(const s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return o(e),n}const yn=e=>(t,n,o,r)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new ze;if(i.issues.length){const a=new(r?.Err??e)(i.issues.map(c=>Ce(c,s,_e())));throw bo(a,r?.callee),a}return i.value},Sn=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(r?.Err??e)(i.issues.map(c=>Ce(c,s,_e())));throw bo(a,r?.callee),a}return i.value},St=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new ze;return s.issues.length?{success:!1,error:new(e??$o)(s.issues.map(i=>Ce(i,r,_e())))}:{success:!0,data:s.value}},pa=St(Lo),Tt=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ce(i,r,_e())))}:{success:!0,data:s.value}},fa=Tt(Lo),ha=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return yn(e)(t,n,r)},ma=e=>(t,n,o)=>yn(e)(t,n,o),Ea=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Sn(e)(t,n,r)},ga=e=>async(t,n,o)=>Sn(e)(t,n,o),_a=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return St(e)(t,n,r)},ya=e=>(t,n,o)=>St(e)(t,n,o),Sa=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Tt(e)(t,n,r)},Ta=e=>async(t,n,o)=>Tt(e)(t,n,o),Oa=/^[cC][^\s-]{8,}$/,Ia=/^[0-9a-z]+$/,wa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,va=/^[0-9a-vA-V]{20}$/,Ca=/^[A-Za-z0-9]{27}$/,Ra=/^[a-zA-Z0-9_-]{21}$/,ba=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Aa=/^([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})$/,Do=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)$/,Na=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$a="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function La(){return new RegExp($a,"u")}const Da=/^(?:(?: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])$/,ka=/^(([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}|:))$/,Pa=/^((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])$/,za=/^(([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])$/,ja=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ko=/^[A-Za-z0-9_-]*$/,Ua=/^\+[1-9]\d{6,14}$/,Po="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ma=new RegExp(`^${Po}$`);function zo(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fa(e){return new RegExp(`^${zo(e)}$`)}function Ga(e){const t=zo({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${Po}T(?:${o})$`)}const xa=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ba=/^-?\d+$/,jo=/^-?\d+(?:\.\d+)?$/,Za=/^(?:true|false)$/i,Ha=/^[^A-Z]*$/,Va=/^[^a-z]*$/,J=l("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Uo={number:"number",bigint:"bigint",object:"date"},Mo=l("$ZodCheckLessThan",(e,t)=>{J.init(e,t);const n=Uo[typeof t.value];e._zod.onattach.push(o=>{const r=o._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Fo=l("$ZodCheckGreaterThan",(e,t)=>{J.init(e,t);const n=Uo[typeof t.value];e._zod.onattach.push(o=>{const r=o._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wa=l("$ZodCheckMultipleOf",(e,t)=>{J.init(e,t),e._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Xi(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ya=l("$ZodCheckNumberFormat",(e,t)=>{J.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[r,s]=na[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=r,a.maximum=s,n&&(a.pattern=Ba)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<r&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Ka=l("$ZodCheckMaxLength",(e,t)=>{var n;J.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!En(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const r=o.value;if(r.length<=t.maximum)return;const i=_n(r);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ja=l("$ZodCheckMinLength",(e,t)=>{var n;J.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!En(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const r=o.value;if(r.length>=t.minimum)return;const i=_n(r);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xa=l("$ZodCheckLengthEquals",(e,t)=>{var n;J.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!En(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=o=>{const r=o.value,s=r.length;if(s===t.length)return;const i=_n(r),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ot=l("$ZodCheckStringFormat",(e,t)=>{var n,o;J.init(e,t),e._zod.onattach.push(r=>{const s=r._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Qa=l("$ZodCheckRegex",(e,t)=>{Ot.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qa=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ha),Ot.init(e,t)}),ec=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Va),Ot.init(e,t)}),tc=l("$ZodCheckIncludes",(e,t)=>{J.init(e,t);const n=Ue(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),nc=l("$ZodCheckStartsWith",(e,t)=>{J.init(e,t);const n=new RegExp(`^${Ue(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),oc=l("$ZodCheckEndsWith",(e,t)=>{J.init(e,t);const n=new RegExp(`.*${Ue(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),rc=l("$ZodCheckOverwrite",(e,t)=>{J.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class sc{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const o=t.split(`
2
- `).filter(i=>i),r=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(r)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,r=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,r.join(`
3
- `))}}const ic={major:4,minor:3,patch:6},D=l("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ic;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const r of o)for(const s of r._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const r=(i,a,c)=>{let u=Me(i),d;for(const m of a){if(m._zod.def.when){if(!m._zod.def.when(i))continue}else if(u)continue;const S=i.issues.length,O=m._zod.check(i);if(O instanceof Promise&&c?.async===!1)throw new ze;if(d||O instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await O,i.issues.length!==S&&(u||(u=Me(i,S)))});else{if(i.issues.length===S)continue;u||(u=Me(i,S))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(Me(i))return i.aborted=!0,i;const u=r(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new ze;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new ze;return c.then(u=>r(u,o,a))}return r(c,o,a)}}b(e,"~standard",()=>({validate:r=>{try{const s=pa(e,r);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return fa(e,r).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Tn=l("$ZodString",(e,t)=>{D.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??xa(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),$=l("$ZodStringFormat",(e,t)=>{Ot.init(e,t),Tn.init(e,t)}),ac=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Aa),$.init(e,t)}),cc=l("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Do(o))}else t.pattern??(t.pattern=Do());$.init(e,t)}),uc=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Na),$.init(e,t)}),lc=l("$ZodURL",(e,t)=>{$.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),dc=l("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=La()),$.init(e,t)}),pc=l("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ra),$.init(e,t)}),fc=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Oa),$.init(e,t)}),hc=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ia),$.init(e,t)}),mc=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=wa),$.init(e,t)}),Ec=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=va),$.init(e,t)}),gc=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ca),$.init(e,t)}),_c=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ga(t)),$.init(e,t)}),yc=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ma),$.init(e,t)}),Sc=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Fa(t)),$.init(e,t)}),Tc=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ba),$.init(e,t)}),Oc=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Da),$.init(e,t),e._zod.bag.format="ipv4"}),Ic=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ka),$.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),wc=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Pa),$.init(e,t)}),vc=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=za),$.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(o.length!==2)throw new Error;const[r,s]=o;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Go(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Cc=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ja),$.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Go(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Rc(e){if(!ko.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Go(n)}const bc=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ko),$.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Rc(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ac=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ua),$.init(e,t)});function Nc(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[o]=n;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const $c=l("$ZodJWT",(e,t)=>{$.init(e,t),e._zod.check=n=>{Nc(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),xo=l("$ZodNumber",(e,t)=>{D.init(e,t),e._zod.pattern=e._zod.bag.pattern??jo,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;const s=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),Lc=l("$ZodNumberFormat",(e,t)=>{Ya.init(e,t),xo.init(e,t)}),Dc=l("$ZodBoolean",(e,t)=>{D.init(e,t),e._zod.pattern=Za,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}const r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),kc=l("$ZodUnknown",(e,t)=>{D.init(e,t),e._zod.parse=n=>n}),Pc=l("$ZodNever",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Bo(e,t,n){e.issues.length&&t.issues.push(...Fe(n,e.issues)),t.value[n]=e.value}const zc=l("$ZodArray",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const s=[];for(let i=0;i<r.length;i++){const a=r[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>Bo(u,n,i))):Bo(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function It(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...Fe(n,e.issues))}e.value===void 0?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function Zo(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=ta(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ho(e,t,n,o,r,s){const i=[],a=r.keySet,c=r.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const m in t){if(a.has(m))continue;if(u==="never"){i.push(m);continue}const S=c.run({value:t[m],issues:[]},o);S instanceof Promise?e.push(S.then(O=>It(O,n,m,t,d))):It(S,n,m,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const jc=l("$ZodObject",(e,t)=>{if(D.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const o=_t(()=>Zo(t));b(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const m of d.values)c[u].add(m)}}return c});const r=qe,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=o.value);const u=a.value;if(!r(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const d=[],m=i.shape;for(const S of i.keys){const O=m[S],H=O._zod.optout==="optional",B=O._zod.run({value:u[S],issues:[]},c);B instanceof Promise?d.push(B.then(pt=>It(pt,a,S,u,H))):It(B,a,S,u,H)}return s?Ho(d,u,a,c,o.value,e):d.length?Promise.all(d).then(()=>a):a}}),Uc=l("$ZodObjectJIT",(e,t)=>{jc.init(e,t);const n=e._zod.parse,o=_t(()=>Zo(t)),r=S=>{const O=new sc(["shape","payload","ctx"]),H=o.value,B=fe=>{const K=Ro(fe);return`shape[${K}]._zod.run({ value: input[${K}], issues: [] }, ctx)`};O.write("const input = payload.value;");const pt=Object.create(null);let yi=0;for(const fe of H.keys)pt[fe]=`key_${yi++}`;O.write("const newResult = {};");for(const fe of H.keys){const K=pt[fe],ae=Ro(fe),Ti=S[fe]?._zod?.optout==="optional";O.write(`const ${K} = ${B(fe)};`),Ti?O.write(`
4
- if (${K}.issues.length) {
5
- if (${ae} in input) {
6
- payload.issues = payload.issues.concat(${K}.issues.map(iss => ({
1
+ import*as Js from"fs";import ee,{existsSync as De,readFileSync as xr,statSync as Ps,promises as Ir,writeFileSync as Pr,createReadStream as dp,mkdtempSync as fp,mkdirSync as mp,rmSync as Va}from"fs";import*as Xs from"path";import Te,{resolve as G,dirname as Ga,relative as Ha,basename as yp,sep as wr,parse as Za,join as We}from"path";import gp from"cac";import{green as et,yellow as Ep,red as Tp,gray as Sp}from"kolorist";import Jt from"prompts";import Wa from"adm-zip";import{glob as W,globSync as Ka}from"glob";import tt from"typescript";import{normalizePath as bp,build as ht,defineConfig as Qs,createServer as xp}from"vite";import"vue";import"vue/server-renderer";import*as xe from"process";import ei from"process";import{JSONPath as Ip}from"jsonpath-plus";import{readFile as Ar,writeFile as Pp}from"fs/promises";import{pathToFileURL as qa,URL as wp}from"url";import Cr,{AxiosError as Ya}from"axios";import Ap from"tinycolor2";import{ButtonTypeEnum as ti}from"@lightspeed/crane-api";import{builtinModules as Ja}from"module";import{viteExternalsPlugin as Xa}from"vite-plugin-externals";import Cp from"vite-plugin-compression";import vp from"@vitejs/plugin-vue";import Np from"vite-tsconfig-paths";import _p from"vite-plugin-checker";import{encode as Op}from"@jridgewell/sourcemap-codec";import{promisify as Qa}from"node:util";import eo from"node:zlib";import me from"node:fs";import Re from"node:path";import Se from"node:process";import Lp from"micromatch";import{fileURLToPath as kp}from"node:url";import{ConcurrencyManager as Dp}from"axios-concurrency";import{inc as Rp}from"semver";import Mp from"cli-progress";import{WebSocketServer as $p,WebSocket as Fp}from"ws";import*as Bp from"os";import{spawnSync as Up}from"child_process";const jp="3.4.5-rc.1";function w(e,s,i){function a(f,y){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:y,constr:h,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),s(f,y);const T=h.prototype,x=Object.keys(T);for(let P=0;P<x.length;P++){const L=x[P];L in f||(f[L]=T[L].bind(f))}}const c=i?.Parent??Object;class u extends c{}Object.defineProperty(u,"name",{value:e});function h(f){var y;const T=i?.Parent?new u:this;a(T,f),(y=T._zod).deferred??(y.deferred=[]);for(const x of T._zod.deferred)x();return T}return Object.defineProperty(h,"init",{value:a}),Object.defineProperty(h,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}class Xt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class to extends Error{constructor(s){super(`Encountered unidirectional transform during encode: ${s}`),this.name="ZodEncodeError"}}const vr={};function pt(e){return e&&Object.assign(vr,e),vr}function so(e){const s=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,c])=>s.indexOf(+a)===-1).map(([a,c])=>c)}function Nr(e,s){return typeof s=="bigint"?s.toString():s}function si(e){return{get value(){{const s=e();return Object.defineProperty(this,"value",{value:s}),s}}}}function _r(e){return e==null}function Or(e){const s=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(s,i)}function zp(e,s){const i=(e.toString().split(".")[1]||"").length,a=s.toString();let c=(a.split(".")[1]||"").length;if(c===0&&/\d?e-\d?/.test(a)){const y=a.match(/\d?e-(\d?)/);y?.[1]&&(c=Number.parseInt(y[1]))}const u=i>c?i:c,h=Number.parseInt(e.toFixed(u).replace(".","")),f=Number.parseInt(s.toFixed(u).replace(".",""));return h%f/10**u}const io=Symbol("evaluating");function re(e,s,i){let a;Object.defineProperty(e,s,{get(){if(a!==io)return a===void 0&&(a=io,a=i()),a},set(c){Object.defineProperty(e,s,{value:c})},configurable:!0})}function Mt(e,s,i){Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0})}function Ct(...e){const s={};for(const i of e){const a=Object.getOwnPropertyDescriptors(i);Object.assign(s,a)}return Object.defineProperties({},s)}function ro(e){return JSON.stringify(e)}function Vp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const no="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ws(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Gp=si(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Qt(e){if(ws(e)===!1)return!1;const s=e.constructor;if(s===void 0||typeof s!="function")return!0;const i=s.prototype;return!(ws(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function ao(e){return Qt(e)?{...e}:Array.isArray(e)?[...e]:e}const Hp=new Set(["string","number","symbol"]);function es(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vt(e,s,i){const a=new e._zod.constr(s??e._zod.def);return(!s||i?.parent)&&(a._zod.parent=e),a}function U(e){const s=e;if(!s)return{};if(typeof s=="string")return{error:()=>s};if(s?.message!==void 0){if(s?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");s.error=s.message}return delete s.message,typeof s.error=="string"?{...s,error:()=>s.error}:s}function Zp(e){return Object.keys(e).filter(s=>e[s]._zod.optin==="optional"&&e[s]._zod.optout==="optional")}const Wp={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Kp(e,s){const i=e._zod.def,a=i.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const u=Ct(e._zod.def,{get shape(){const h={};for(const f in s){if(!(f in i.shape))throw new Error(`Unrecognized key: "${f}"`);s[f]&&(h[f]=i.shape[f])}return Mt(this,"shape",h),h},checks:[]});return vt(e,u)}function qp(e,s){const i=e._zod.def,a=i.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const u=Ct(e._zod.def,{get shape(){const h={...e._zod.def.shape};for(const f in s){if(!(f in i.shape))throw new Error(`Unrecognized key: "${f}"`);s[f]&&delete h[f]}return Mt(this,"shape",h),h},checks:[]});return vt(e,u)}function Yp(e,s){if(!Qt(s))throw new Error("Invalid input to extend: expected a plain object");const i=e._zod.def.checks;if(i&&i.length>0){const u=e._zod.def.shape;for(const h in s)if(Object.getOwnPropertyDescriptor(u,h)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const c=Ct(e._zod.def,{get shape(){const u={...e._zod.def.shape,...s};return Mt(this,"shape",u),u}});return vt(e,c)}function Jp(e,s){if(!Qt(s))throw new Error("Invalid input to safeExtend: expected a plain object");const i=Ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...s};return Mt(this,"shape",a),a}});return vt(e,i)}function Xp(e,s){const i=Ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...s._zod.def.shape};return Mt(this,"shape",a),a},get catchall(){return s._zod.def.catchall},checks:[]});return vt(e,i)}function Qp(e,s,i){const c=s._zod.def.checks;if(c&&c.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const h=Ct(s._zod.def,{get shape(){const f=s._zod.def.shape,y={...f};if(i)for(const T in i){if(!(T in f))throw new Error(`Unrecognized key: "${T}"`);i[T]&&(y[T]=e?new e({type:"optional",innerType:f[T]}):f[T])}else for(const T in f)y[T]=e?new e({type:"optional",innerType:f[T]}):f[T];return Mt(this,"shape",y),y},checks:[]});return vt(s,h)}function ed(e,s,i){const a=Ct(s._zod.def,{get shape(){const c=s._zod.def.shape,u={...c};if(i)for(const h in i){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);i[h]&&(u[h]=new e({type:"nonoptional",innerType:c[h]}))}else for(const h in c)u[h]=new e({type:"nonoptional",innerType:c[h]});return Mt(this,"shape",u),u}});return vt(s,a)}function ts(e,s=0){if(e.aborted===!0)return!0;for(let i=s;i<e.issues.length;i++)if(e.issues[i]?.continue!==!0)return!0;return!1}function ss(e,s){return s.map(i=>{var a;return(a=i).path??(a.path=[]),i.path.unshift(e),i})}function ii(e){return typeof e=="string"?e:e?.message}function Nt(e,s,i){const a={...e,path:e.path??[]};if(!e.message){const c=ii(e.inst?._zod.def?.error?.(e))??ii(s?.error?.(e))??ii(i.customError?.(e))??ii(i.localeError?.(e))??"Invalid input";a.message=c}return delete a.inst,delete a.continue,s?.reportInput||delete a.input,a}function Lr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function As(...e){const[s,i,a]=e;return typeof s=="string"?{message:s,code:"custom",input:i,inst:a}:{...s}}const oo=(e,s)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:s,enumerable:!1}),e.message=JSON.stringify(s,Nr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},co=w("$ZodError",oo),lo=w("$ZodError",oo,{Parent:Error});function td(e,s=i=>i.message){const i={},a=[];for(const c of e.issues)c.path.length>0?(i[c.path[0]]=i[c.path[0]]||[],i[c.path[0]].push(s(c))):a.push(s(c));return{formErrors:a,fieldErrors:i}}function sd(e,s=i=>i.message){const i={_errors:[]},a=c=>{for(const u of c.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(h=>a({issues:h}));else if(u.code==="invalid_key")a({issues:u.issues});else if(u.code==="invalid_element")a({issues:u.issues});else if(u.path.length===0)i._errors.push(s(u));else{let h=i,f=0;for(;f<u.path.length;){const y=u.path[f];f===u.path.length-1?(h[y]=h[y]||{_errors:[]},h[y]._errors.push(s(u))):h[y]=h[y]||{_errors:[]},h=h[y],f++}}};return a(e),i}const kr=e=>(s,i,a,c)=>{const u=a?Object.assign(a,{async:!1}):{async:!1},h=s._zod.run({value:i,issues:[]},u);if(h instanceof Promise)throw new Xt;if(h.issues.length){const f=new(c?.Err??e)(h.issues.map(y=>Nt(y,u,pt())));throw no(f,c?.callee),f}return h.value},Dr=e=>async(s,i,a,c)=>{const u=a?Object.assign(a,{async:!0}):{async:!0};let h=s._zod.run({value:i,issues:[]},u);if(h instanceof Promise&&(h=await h),h.issues.length){const f=new(c?.Err??e)(h.issues.map(y=>Nt(y,u,pt())));throw no(f,c?.callee),f}return h.value},ri=e=>(s,i,a)=>{const c=a?{...a,async:!1}:{async:!1},u=s._zod.run({value:i,issues:[]},c);if(u instanceof Promise)throw new Xt;return u.issues.length?{success:!1,error:new(e??co)(u.issues.map(h=>Nt(h,c,pt())))}:{success:!0,data:u.value}},id=ri(lo),ni=e=>async(s,i,a)=>{const c=a?Object.assign(a,{async:!0}):{async:!0};let u=s._zod.run({value:i,issues:[]},c);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(h=>Nt(h,c,pt())))}:{success:!0,data:u.value}},rd=ni(lo),nd=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return kr(e)(s,i,c)},ad=e=>(s,i,a)=>kr(e)(s,i,a),od=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Dr(e)(s,i,c)},cd=e=>async(s,i,a)=>Dr(e)(s,i,a),ld=e=>(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ri(e)(s,i,c)},ud=e=>(s,i,a)=>ri(e)(s,i,a),hd=e=>async(s,i,a)=>{const c=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ni(e)(s,i,c)},pd=e=>async(s,i,a)=>ni(e)(s,i,a),dd=/^[cC][^\s-]{8,}$/,fd=/^[0-9a-z]+$/,md=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yd=/^[0-9a-vA-V]{20}$/,gd=/^[A-Za-z0-9]{27}$/,Ed=/^[a-zA-Z0-9_-]{21}$/,Td=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Sd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,uo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,bd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Id(){return new RegExp(xd,"u")}const Pd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ad=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ho=/^[A-Za-z0-9_-]*$/,Nd=/^\+[1-9]\d{6,14}$/,po="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",_d=new RegExp(`^${po}$`);function fo(e){const s="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${s}`:e.precision===0?`${s}:[0-5]\\d`:`${s}:[0-5]\\d\\.\\d{${e.precision}}`:`${s}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Od(e){return new RegExp(`^${fo(e)}$`)}function Ld(e){const s=fo({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${s}(?:${i.join("|")})`;return new RegExp(`^${po}T(?:${a})$`)}const kd=e=>{const s=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${s}$`)},Dd=/^-?\d+$/,mo=/^-?\d+(?:\.\d+)?$/,Rd=/^(?:true|false)$/i,Md=/^[^A-Z]*$/,$d=/^[^a-z]*$/,Fe=w("$ZodCheck",(e,s)=>{var i;e._zod??(e._zod={}),e._zod.def=s,(i=e._zod).onattach??(i.onattach=[])}),yo={number:"number",bigint:"bigint",object:"date"},go=w("$ZodCheckLessThan",(e,s)=>{Fe.init(e,s);const i=yo[typeof s.value];e._zod.onattach.push(a=>{const c=a._zod.bag,u=(s.inclusive?c.maximum:c.exclusiveMaximum)??Number.POSITIVE_INFINITY;s.value<u&&(s.inclusive?c.maximum=s.value:c.exclusiveMaximum=s.value)}),e._zod.check=a=>{(s.inclusive?a.value<=s.value:a.value<s.value)||a.issues.push({origin:i,code:"too_big",maximum:typeof s.value=="object"?s.value.getTime():s.value,input:a.value,inclusive:s.inclusive,inst:e,continue:!s.abort})}}),Eo=w("$ZodCheckGreaterThan",(e,s)=>{Fe.init(e,s);const i=yo[typeof s.value];e._zod.onattach.push(a=>{const c=a._zod.bag,u=(s.inclusive?c.minimum:c.exclusiveMinimum)??Number.NEGATIVE_INFINITY;s.value>u&&(s.inclusive?c.minimum=s.value:c.exclusiveMinimum=s.value)}),e._zod.check=a=>{(s.inclusive?a.value>=s.value:a.value>s.value)||a.issues.push({origin:i,code:"too_small",minimum:typeof s.value=="object"?s.value.getTime():s.value,input:a.value,inclusive:s.inclusive,inst:e,continue:!s.abort})}}),Fd=w("$ZodCheckMultipleOf",(e,s)=>{Fe.init(e,s),e._zod.onattach.push(i=>{var a;(a=i._zod.bag).multipleOf??(a.multipleOf=s.value)}),e._zod.check=i=>{if(typeof i.value!=typeof s.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?i.value%s.value===BigInt(0):zp(i.value,s.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:s.value,input:i.value,inst:e,continue:!s.abort})}}),Bd=w("$ZodCheckNumberFormat",(e,s)=>{Fe.init(e,s),s.format=s.format||"float64";const i=s.format?.includes("int"),a=i?"int":"number",[c,u]=Wp[s.format];e._zod.onattach.push(h=>{const f=h._zod.bag;f.format=s.format,f.minimum=c,f.maximum=u,i&&(f.pattern=Dd)}),e._zod.check=h=>{const f=h.value;if(i){if(!Number.isInteger(f)){h.issues.push({expected:a,format:s.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?h.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!s.abort}):h.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!s.abort});return}}f<c&&h.issues.push({origin:"number",input:f,code:"too_small",minimum:c,inclusive:!0,inst:e,continue:!s.abort}),f>u&&h.issues.push({origin:"number",input:f,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!s.abort})}}),Ud=w("$ZodCheckMaxLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!_r(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag.maximum??Number.POSITIVE_INFINITY;s.maximum<c&&(a._zod.bag.maximum=s.maximum)}),e._zod.check=a=>{const c=a.value;if(c.length<=s.maximum)return;const h=Lr(c);a.issues.push({origin:h,code:"too_big",maximum:s.maximum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),jd=w("$ZodCheckMinLength",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!_r(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;s.minimum>c&&(a._zod.bag.minimum=s.minimum)}),e._zod.check=a=>{const c=a.value;if(c.length>=s.minimum)return;const h=Lr(c);a.issues.push({origin:h,code:"too_small",minimum:s.minimum,inclusive:!0,input:c,inst:e,continue:!s.abort})}}),zd=w("$ZodCheckLengthEquals",(e,s)=>{var i;Fe.init(e,s),(i=e._zod.def).when??(i.when=a=>{const c=a.value;return!_r(c)&&c.length!==void 0}),e._zod.onattach.push(a=>{const c=a._zod.bag;c.minimum=s.length,c.maximum=s.length,c.length=s.length}),e._zod.check=a=>{const c=a.value,u=c.length;if(u===s.length)return;const h=Lr(c),f=u>s.length;a.issues.push({origin:h,...f?{code:"too_big",maximum:s.length}:{code:"too_small",minimum:s.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!s.abort})}}),ai=w("$ZodCheckStringFormat",(e,s)=>{var i,a;Fe.init(e,s),e._zod.onattach.push(c=>{const u=c._zod.bag;u.format=s.format,s.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(s.pattern))}),s.pattern?(i=e._zod).check??(i.check=c=>{s.pattern.lastIndex=0,!s.pattern.test(c.value)&&c.issues.push({origin:"string",code:"invalid_format",format:s.format,input:c.value,...s.pattern?{pattern:s.pattern.toString()}:{},inst:e,continue:!s.abort})}):(a=e._zod).check??(a.check=()=>{})}),Vd=w("$ZodCheckRegex",(e,s)=>{ai.init(e,s),e._zod.check=i=>{s.pattern.lastIndex=0,!s.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:s.pattern.toString(),inst:e,continue:!s.abort})}}),Gd=w("$ZodCheckLowerCase",(e,s)=>{s.pattern??(s.pattern=Md),ai.init(e,s)}),Hd=w("$ZodCheckUpperCase",(e,s)=>{s.pattern??(s.pattern=$d),ai.init(e,s)}),Zd=w("$ZodCheckIncludes",(e,s)=>{Fe.init(e,s);const i=es(s.includes),a=new RegExp(typeof s.position=="number"?`^.{${s.position}}${i}`:i);s.pattern=a,e._zod.onattach.push(c=>{const u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(a)}),e._zod.check=c=>{c.value.includes(s.includes,s.position)||c.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:s.includes,input:c.value,inst:e,continue:!s.abort})}}),Wd=w("$ZodCheckStartsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`^${es(s.prefix)}.*`);s.pattern??(s.pattern=i),e._zod.onattach.push(a=>{const c=a._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(i)}),e._zod.check=a=>{a.value.startsWith(s.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:s.prefix,input:a.value,inst:e,continue:!s.abort})}}),Kd=w("$ZodCheckEndsWith",(e,s)=>{Fe.init(e,s);const i=new RegExp(`.*${es(s.suffix)}$`);s.pattern??(s.pattern=i),e._zod.onattach.push(a=>{const c=a._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(i)}),e._zod.check=a=>{a.value.endsWith(s.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:s.suffix,input:a.value,inst:e,continue:!s.abort})}}),qd=w("$ZodCheckOverwrite",(e,s)=>{Fe.init(e,s),e._zod.check=i=>{i.value=s.tx(i.value)}});class Yd{constructor(s=[]){this.content=[],this.indent=0,this&&(this.args=s)}indented(s){this.indent+=1,s(this),this.indent-=1}write(s){if(typeof s=="function"){s(this,{execution:"sync"}),s(this,{execution:"async"});return}const a=s.split(`
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 Jd={major:4,minor:3,patch:6},ye=w("$ZodType",(e,s)=>{var i;e??(e={}),e._zod.def=s,e._zod.bag=e._zod.bag||{},e._zod.version=Jd;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=ts(h),x;for(const P of f){if(P._zod.def.when){if(!P._zod.def.when(h))continue}else if(T)continue;const L=h.issues.length,R=P._zod.check(h);if(R instanceof Promise&&y?.async===!1)throw new Xt;if(x||R instanceof Promise)x=(x??Promise.resolve()).then(async()=>{await R,h.issues.length!==L&&(T||(T=ts(h,L)))});else{if(h.issues.length===L)continue;T||(T=ts(h,L))}}return x?x.then(()=>h):h},u=(h,f,y)=>{if(ts(h))return h.aborted=!0,h;const T=c(f,a,y);if(T instanceof Promise){if(y.async===!1)throw new Xt;return T.then(x=>e._zod.parse(x,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(x=>u(x,h,f)):u(T,h,f)}const y=e._zod.parse(h,f);if(y instanceof Promise){if(f.async===!1)throw new Xt;return y.then(T=>c(T,a,f))}return c(y,a,f)}}re(e,"~standard",()=>({validate:c=>{try{const u=id(e,c);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return rd(e,c).then(h=>h.success?{value:h.data}:{issues:h.error?.issues})}},vendor:"zod",version:1}))}),Rr=w("$ZodString",(e,s)=>{ye.init(e,s),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??kd(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}}),pe=w("$ZodStringFormat",(e,s)=>{ai.init(e,s),Rr.init(e,s)}),Xd=w("$ZodGUID",(e,s)=>{s.pattern??(s.pattern=Sd),pe.init(e,s)}),Qd=w("$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=uo(a))}else s.pattern??(s.pattern=uo());pe.init(e,s)}),ef=w("$ZodEmail",(e,s)=>{s.pattern??(s.pattern=bd),pe.init(e,s)}),tf=w("$ZodURL",(e,s)=>{pe.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})}}}),sf=w("$ZodEmoji",(e,s)=>{s.pattern??(s.pattern=Id()),pe.init(e,s)}),rf=w("$ZodNanoID",(e,s)=>{s.pattern??(s.pattern=Ed),pe.init(e,s)}),nf=w("$ZodCUID",(e,s)=>{s.pattern??(s.pattern=dd),pe.init(e,s)}),af=w("$ZodCUID2",(e,s)=>{s.pattern??(s.pattern=fd),pe.init(e,s)}),of=w("$ZodULID",(e,s)=>{s.pattern??(s.pattern=md),pe.init(e,s)}),cf=w("$ZodXID",(e,s)=>{s.pattern??(s.pattern=yd),pe.init(e,s)}),lf=w("$ZodKSUID",(e,s)=>{s.pattern??(s.pattern=gd),pe.init(e,s)}),uf=w("$ZodISODateTime",(e,s)=>{s.pattern??(s.pattern=Ld(s)),pe.init(e,s)}),hf=w("$ZodISODate",(e,s)=>{s.pattern??(s.pattern=_d),pe.init(e,s)}),pf=w("$ZodISOTime",(e,s)=>{s.pattern??(s.pattern=Od(s)),pe.init(e,s)}),df=w("$ZodISODuration",(e,s)=>{s.pattern??(s.pattern=Td),pe.init(e,s)}),ff=w("$ZodIPv4",(e,s)=>{s.pattern??(s.pattern=Pd),pe.init(e,s),e._zod.bag.format="ipv4"}),mf=w("$ZodIPv6",(e,s)=>{s.pattern??(s.pattern=wd),pe.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})}}}),yf=w("$ZodCIDRv4",(e,s)=>{s.pattern??(s.pattern=Ad),pe.init(e,s)}),gf=w("$ZodCIDRv6",(e,s)=>{s.pattern??(s.pattern=Cd),pe.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 To(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ef=w("$ZodBase64",(e,s)=>{s.pattern??(s.pattern=vd),pe.init(e,s),e._zod.bag.contentEncoding="base64",e._zod.check=i=>{To(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!s.abort})}});function Tf(e){if(!ho.test(e))return!1;const s=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),i=s.padEnd(Math.ceil(s.length/4)*4,"=");return To(i)}const Sf=w("$ZodBase64URL",(e,s)=>{s.pattern??(s.pattern=ho),pe.init(e,s),e._zod.bag.contentEncoding="base64url",e._zod.check=i=>{Tf(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!s.abort})}}),bf=w("$ZodE164",(e,s)=>{s.pattern??(s.pattern=Nd),pe.init(e,s)});function xf(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 If=w("$ZodJWT",(e,s)=>{pe.init(e,s),e._zod.check=i=>{xf(i.value,s.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!s.abort})}}),So=w("$ZodNumber",(e,s)=>{ye.init(e,s),e._zod.pattern=e._zod.bag.pattern??mo,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}}),Pf=w("$ZodNumberFormat",(e,s)=>{Bd.init(e,s),So.init(e,s)}),wf=w("$ZodBoolean",(e,s)=>{ye.init(e,s),e._zod.pattern=Rd,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}}),Af=w("$ZodUnknown",(e,s)=>{ye.init(e,s),e._zod.parse=i=>i}),Cf=w("$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 bo(e,s,i){e.issues.length&&s.issues.push(...ss(i,e.issues)),s.value[i]=e.value}const vf=w("$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=>bo(T,i,h))):bo(y,i,h)}return u.length?Promise.all(u).then(()=>i):i}});function oi(e,s,i,a,c){if(e.issues.length){if(c&&!(i in a))return;s.issues.push(...ss(i,e.issues))}e.value===void 0?i in a&&(s.value[i]=void 0):s.value[i]=e.value}function xo(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=Zp(e.shape);return{...e,keys:s,keySet:new Set(s),numKeys:s.length,optionalKeys:new Set(i)}}function Io(e,s,i,a,c,u){const h=[],f=c.keySet,y=c.catchall._zod,T=y.def.type,x=y.optout==="optional";for(const P in s){if(f.has(P))continue;if(T==="never"){h.push(P);continue}const L=y.run({value:s[P],issues:[]},a);L instanceof Promise?e.push(L.then(R=>oi(R,i,P,s,x))):oi(L,i,P,s,x)}return h.length&&i.issues.push({code:"unrecognized_keys",keys:h,input:s,inst:u}),e.length?Promise.all(e).then(()=>i):i}const Nf=w("$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=si(()=>xo(s));re(e._zod,"propValues",()=>{const f=s.shape,y={};for(const T in f){const x=f[T]._zod;if(x.values){y[T]??(y[T]=new Set);for(const P of x.values)y[T].add(P)}}return y});const c=ws,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 x=[],P=h.shape;for(const L of h.keys){const R=P[L],ae=R._zod.optout==="optional",ce=R._zod.run({value:T[L],issues:[]},y);ce instanceof Promise?x.push(ce.then(Ce=>oi(Ce,f,L,T,ae))):oi(ce,f,L,T,ae)}return u?Io(x,T,f,y,a.value,e):x.length?Promise.all(x).then(()=>f):f}}),_f=w("$ZodObjectJIT",(e,s)=>{Nf.init(e,s);const i=e._zod.parse,a=si(()=>xo(s)),c=L=>{const R=new Yd(["shape","payload","ctx"]),ae=a.value,ce=$e=>{const Ae=ro($e);return`shape[${Ae}]._zod.run({ value: input[${Ae}], issues: [] }, ctx)`};R.write("const input = payload.value;");const Ce=Object.create(null);let S=0;for(const $e of ae.keys)Ce[$e]=`key_${S++}`;R.write("const newResult = {};");for(const $e of ae.keys){const Ae=Ce[$e],_e=ro($e),Wt=L[$e]?._zod?.optout==="optional";R.write(`const ${Ae} = ${ce($e)};`),Wt?R.write(`
4
+ if (${Ae}.issues.length) {
5
+ if (${_e} in input) {
6
+ payload.issues = payload.issues.concat(${Ae}.issues.map(iss => ({
7
7
  ...iss,
8
- path: iss.path ? [${ae}, ...iss.path] : [${ae}]
8
+ path: iss.path ? [${_e}, ...iss.path] : [${_e}]
9
9
  })));
10
10
  }
11
11
  }
12
12
 
13
- if (${K}.value === undefined) {
14
- if (${ae} in input) {
15
- newResult[${ae}] = undefined;
13
+ if (${Ae}.value === undefined) {
14
+ if (${_e} in input) {
15
+ newResult[${_e}] = undefined;
16
16
  }
17
17
  } else {
18
- newResult[${ae}] = ${K}.value;
18
+ newResult[${_e}] = ${Ae}.value;
19
19
  }
20
20
 
21
- `):O.write(`
22
- if (${K}.issues.length) {
23
- payload.issues = payload.issues.concat(${K}.issues.map(iss => ({
21
+ `):R.write(`
22
+ if (${Ae}.issues.length) {
23
+ payload.issues = payload.issues.concat(${Ae}.issues.map(iss => ({
24
24
  ...iss,
25
- path: iss.path ? [${ae}, ...iss.path] : [${ae}]
25
+ path: iss.path ? [${_e}, ...iss.path] : [${_e}]
26
26
  })));
27
27
  }
28
28
 
29
- if (${K}.value === undefined) {
30
- if (${ae} in input) {
31
- newResult[${ae}] = undefined;
29
+ if (${Ae}.value === undefined) {
30
+ if (${_e} in input) {
31
+ newResult[${_e}] = undefined;
32
32
  }
33
33
  } else {
34
- newResult[${ae}] = ${K}.value;
34
+ newResult[${_e}] = ${Ae}.value;
35
35
  }
36
36
 
37
- `)}O.write("payload.value = newResult;"),O.write("return payload;");const Si=O.compile();return(fe,K)=>Si(S,fe,K)};let s;const i=qe,a=!hn.jitless,u=a&&qi.value,d=t.catchall;let m;e._zod.parse=(S,O)=>{m??(m=o.value);const H=S.value;return i(H)?a&&u&&O?.async===!1&&O.jitless!==!0?(s||(s=r(t.shape)),S=s(S,O),d?Ho([],H,S,O,m,e):S):n(S,O):(S.issues.push({expected:"object",code:"invalid_type",input:H,inst:e}),S)}});function Vo(e,t,n,o){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const r=e.filter(s=>!Me(s));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>Ce(i,o,_e())))}),t)}const Wo=l("$ZodUnion",(e,t)=>{D.init(e,t),b(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),b(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),b(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),b(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>gn(s.source)).join("|")})$`)}});const n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(r,s)=>{if(n)return o(r,s);let i=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:r.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Vo(c,r,e,s)):Vo(a,r,e,s)}}),Mc=l("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Wo.init(e,t);const n=e._zod.parse;b(e._zod,"propValues",()=>{const r={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(i)){r[a]||(r[a]=new Set);for(const u of c)r[a].add(u)}}return r});const o=_t(()=>{const r=t.options,s=new Map;for(const i of r){const a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(r,s)=>{const i=r.value;if(!qe(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(r,s):t.unionFallback?n(r,s):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),r)}}),Fc=l("$ZodIntersection",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>{const r=n.value,s=t.left._zod.run({value:r,issues:[]},o),i=t.right._zod.run({value:r,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Yo(n,c,u)):Yo(n,s,i)}});function On(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(je(e)&&je(t)){const n=Object.keys(t),o=Object.keys(e).filter(s=>n.indexOf(s)!==-1),r={...e,...t};for(const s of o){const i=On(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};r[s]=i.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const r=e[o],s=t[o],i=On(r,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Yo(e,t,n){const o=new Map;let r;for(const a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);const s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&r&&e.issues.push({...r,keys:s}),Me(e))return e;const i=On(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Gc=l("$ZodRecord",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!je(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:r[u],issues:[]},o);d instanceof Promise?s.push(d.then(m=>{m.issues.length&&n.issues.push(...Fe(u,m.issues)),n.value[u]=m.value})):(d.issues.length&&n.issues.push(...Fe(u,d.issues)),n.value[u]=d.value)}let c;for(const u in r)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{n.value={};for(const a of Reflect.ownKeys(r)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&jo.test(a)&&c.issues.length){const m=t.keyType._zod.run({value:Number(a),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(c=m)}if(c.issues.length){t.mode==="loose"?n.value[a]=r[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(m=>Ce(m,o,_e())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:r[a],issues:[]},o);d instanceof Promise?s.push(d.then(m=>{m.issues.length&&n.issues.push(...Fe(a,m.issues)),n.value[c.value]=m.value})):(d.issues.length&&n.issues.push(...Fe(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),xc=l("$ZodEnum",(e,t)=>{D.init(e,t);const n=vo(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(r=>ea.has(typeof r)).map(r=>typeof r=="string"?Ue(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const i=r.value;return o.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),Bc=l("$ZodLiteral",(e,t)=>{if(D.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?Ue(o):o?Ue(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,r)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}}),Zc=l("$ZodTransform",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new wo(e.constructor.name);const r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then(i=>(n.value=i,n));if(r instanceof Promise)throw new ze;return n.value=r,n}});function Ko(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Jo=l("$ZodOptional",(e,t)=>{D.init(e,t),e._zod.optin="optional",e._zod.optout="optional",b(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),b(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${gn(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>Ko(s,n.value)):Ko(r,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,o)}}),Hc=l("$ZodExactOptional",(e,t)=>{Jo.init(e,t),b(e._zod,"values",()=>t.innerType._zod.values),b(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),Vc=l("$ZodNullable",(e,t)=>{D.init(e,t),b(e._zod,"optin",()=>t.innerType._zod.optin),b(e._zod,"optout",()=>t.innerType._zod.optout),b(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${gn(n.source)}|null)$`):void 0}),b(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>n.value===null?n:t.innerType._zod.run(n,o)}),Wc=l("$ZodDefault",(e,t)=>{D.init(e,t),e._zod.optin="optional",b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>Xo(s,t)):Xo(r,t)}});function Xo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Yc=l("$ZodPrefault",(e,t)=>{D.init(e,t),e._zod.optin="optional",b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>(o.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,o))}),Kc=l("$ZodNonOptional",(e,t)=>{D.init(e,t),b(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>Qo(s,e)):Qo(r,e)}});function Qo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Jc=l("$ZodCatch",(e,t)=>{D.init(e,t),b(e._zod,"optin",()=>t.innerType._zod.optin),b(e._zod,"optout",()=>t.innerType._zod.optout),b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Ce(i,o,_e()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(s=>Ce(s,o,_e()))},input:n.value}),n.issues=[]),n)}}),Xc=l("$ZodPipe",(e,t)=>{D.init(e,t),b(e._zod,"values",()=>t.in._zod.values),b(e._zod,"optin",()=>t.in._zod.optin),b(e._zod,"optout",()=>t.out._zod.optout),b(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){const s=t.out._zod.run(n,o);return s instanceof Promise?s.then(i=>wt(i,t.in,o)):wt(s,t.in,o)}const r=t.in._zod.run(n,o);return r instanceof Promise?r.then(s=>wt(s,t.out,o)):wt(r,t.out,o)}});function wt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Qc=l("$ZodReadonly",(e,t)=>{D.init(e,t),b(e._zod,"propValues",()=>t.innerType._zod.propValues),b(e._zod,"values",()=>t.innerType._zod.values),b(e._zod,"optin",()=>t.innerType?._zod?.optin),b(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(qo):qo(r)}});function qo(e){return e.value=Object.freeze(e.value),e}const qc=l("$ZodCustom",(e,t)=>{J.init(e,t),D.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then(s=>er(s,n,o,e));er(r,n,o,e)}});function er(e,t,n,o){if(!e){const r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),t.issues.push(et(r))}}var tr;class eu{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const o=n[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const o={...this.get(n)??{}};delete o.id;const r={...o,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function tu(){return new eu}(tr=globalThis).__zod_globalRegistry??(tr.__zod_globalRegistry=tu());const tt=globalThis.__zod_globalRegistry;function nu(e,t){return new e({type:"string",..._(t)})}function ou(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function nr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function ru(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function su(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function iu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function au(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function or(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function cu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function uu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function lu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function du(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function pu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function fu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function hu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function mu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Eu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function gu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function _u(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function yu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Su(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Tu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Ou(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function Iu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function wu(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function vu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Cu(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Ru(e,t){return new e({type:"number",checks:[],..._(t)})}function bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Au(e,t){return new e({type:"boolean",..._(t)})}function Nu(e){return new e({type:"unknown"})}function $u(e,t){return new e({type:"never",..._(t)})}function rr(e,t){return new Mo({check:"less_than",..._(t),value:e,inclusive:!1})}function In(e,t){return new Mo({check:"less_than",..._(t),value:e,inclusive:!0})}function sr(e,t){return new Fo({check:"greater_than",..._(t),value:e,inclusive:!1})}function wn(e,t){return new Fo({check:"greater_than",..._(t),value:e,inclusive:!0})}function ir(e,t){return new Wa({check:"multiple_of",..._(t),value:e})}function ar(e,t){return new Ka({check:"max_length",..._(t),maximum:e})}function vt(e,t){return new Ja({check:"min_length",..._(t),minimum:e})}function cr(e,t){return new Xa({check:"length_equals",..._(t),length:e})}function Lu(e,t){return new Qa({check:"string_format",format:"regex",..._(t),pattern:e})}function Du(e){return new qa({check:"string_format",format:"lowercase",..._(e)})}function ku(e){return new ec({check:"string_format",format:"uppercase",..._(e)})}function Pu(e,t){return new tc({check:"string_format",format:"includes",..._(t),includes:e})}function zu(e,t){return new nc({check:"string_format",format:"starts_with",..._(t),prefix:e})}function ju(e,t){return new oc({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Ge(e){return new rc({check:"overwrite",tx:e})}function Uu(e){return Ge(t=>t.normalize(e))}function Mu(){return Ge(e=>e.trim())}function Fu(){return Ge(e=>e.toLowerCase())}function Gu(){return Ge(e=>e.toUpperCase())}function xu(){return Ge(e=>Qi(e))}function Bu(e,t,n){return new e({type:"array",element:t,..._(n)})}function Zu(e,t,n){const o=_(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Hu(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function Vu(e){const t=Wu(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(et(o,n.value,t._zod.def));else{const r=o;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(et(r))}},e(n.value,n)));return t}function Wu(e,t){const n=new J({check:"custom",..._(t)});return n._zod.check=e,n}function ur(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??tt,target:t,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 F(e,t,n={path:[],schemaPath:[]}){var o;const r=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const S=i.schema,O=t.processors[r.type];if(!O)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);O(e,t,S,d)}const m=e._zod.parent;m&&(i.ref||(i.ref=m),F(m,t,d),t.seen.get(m).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&Y(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function lr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}const r=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(i[0])?.id,S=e.external.uri??(H=>H);if(m)return{ref:S(m)};const O=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=O,{defId:O,ref:`${S("__shared")}#/${a}/${O}`}}if(i[1]===n)return{ref:"#"};const u=`#/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=r(i);a.def={...a.schema},u&&(a.defId=u);const d=a.schema;for(const m in d)delete d[m];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
37
+ `)}R.write("payload.value = newResult;"),R.write("return payload;");const gs=R.compile();return($e,Ae)=>gs(L,$e,Ae)};let u;const h=ws,f=!vr.jitless,T=f&&Gp.value,x=s.catchall;let P;e._zod.parse=(L,R)=>{P??(P=a.value);const ae=L.value;return h(ae)?f&&T&&R?.async===!1&&R.jitless!==!0?(u||(u=c(s.shape)),L=u(L,R),x?Io([],ae,L,R,P,e):L):i(L,R):(L.issues.push({expected:"object",code:"invalid_type",input:ae,inst:e}),L)}});function Po(e,s,i,a){for(const u of e)if(u.issues.length===0)return s.value=u.value,s;const c=e.filter(u=>!ts(u));return c.length===1?(s.value=c[0].value,c[0]):(s.issues.push({code:"invalid_union",input:s.value,inst:i,errors:e.map(u=>u.issues.map(h=>Nt(h,a,pt())))}),s)}const wo=w("$ZodUnion",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.options.some(c=>c._zod.optin==="optional")?"optional":void 0),re(e._zod,"optout",()=>s.options.some(c=>c._zod.optout==="optional")?"optional":void 0),re(e._zod,"values",()=>{if(s.options.every(c=>c._zod.values))return new Set(s.options.flatMap(c=>Array.from(c._zod.values)))}),re(e._zod,"pattern",()=>{if(s.options.every(c=>c._zod.pattern)){const c=s.options.map(u=>u._zod.pattern);return new RegExp(`^(${c.map(u=>Or(u.source)).join("|")})$`)}});const i=s.options.length===1,a=s.options[0]._zod.run;e._zod.parse=(c,u)=>{if(i)return a(c,u);let h=!1;const f=[];for(const y of s.options){const T=y._zod.run({value:c.value,issues:[]},u);if(T instanceof Promise)f.push(T),h=!0;else{if(T.issues.length===0)return T;f.push(T)}}return h?Promise.all(f).then(y=>Po(y,c,e,u)):Po(f,c,e,u)}}),Of=w("$ZodDiscriminatedUnion",(e,s)=>{s.inclusive=!1,wo.init(e,s);const i=e._zod.parse;re(e._zod,"propValues",()=>{const c={};for(const u of s.options){const h=u._zod.propValues;if(!h||Object.keys(h).length===0)throw new Error(`Invalid discriminated union option at index "${s.options.indexOf(u)}"`);for(const[f,y]of Object.entries(h)){c[f]||(c[f]=new Set);for(const T of y)c[f].add(T)}}return c});const a=si(()=>{const c=s.options,u=new Map;for(const h of c){const f=h._zod.propValues?.[s.discriminator];if(!f||f.size===0)throw new Error(`Invalid discriminated union option at index "${s.options.indexOf(h)}"`);for(const y of f){if(u.has(y))throw new Error(`Duplicate discriminator value "${String(y)}"`);u.set(y,h)}}return u});e._zod.parse=(c,u)=>{const h=c.value;if(!ws(h))return c.issues.push({code:"invalid_type",expected:"object",input:h,inst:e}),c;const f=a.value.get(h?.[s.discriminator]);return f?f._zod.run(c,u):s.unionFallback?i(c,u):(c.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:s.discriminator,input:h,path:[s.discriminator],inst:e}),c)}}),Lf=w("$ZodIntersection",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value,u=s.left._zod.run({value:c,issues:[]},a),h=s.right._zod.run({value:c,issues:[]},a);return u instanceof Promise||h instanceof Promise?Promise.all([u,h]).then(([y,T])=>Ao(i,y,T)):Ao(i,u,h)}});function Mr(e,s){if(e===s)return{valid:!0,data:e};if(e instanceof Date&&s instanceof Date&&+e==+s)return{valid:!0,data:e};if(Qt(e)&&Qt(s)){const i=Object.keys(s),a=Object.keys(e).filter(u=>i.indexOf(u)!==-1),c={...e,...s};for(const u of a){const h=Mr(e[u],s[u]);if(!h.valid)return{valid:!1,mergeErrorPath:[u,...h.mergeErrorPath]};c[u]=h.data}return{valid:!0,data:c}}if(Array.isArray(e)&&Array.isArray(s)){if(e.length!==s.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let a=0;a<e.length;a++){const c=e[a],u=s[a],h=Mr(c,u);if(!h.valid)return{valid:!1,mergeErrorPath:[a,...h.mergeErrorPath]};i.push(h.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function Ao(e,s,i){const a=new Map;let c;for(const f of s.issues)if(f.code==="unrecognized_keys"){c??(c=f);for(const y of f.keys)a.has(y)||a.set(y,{}),a.get(y).l=!0}else e.issues.push(f);for(const f of i.issues)if(f.code==="unrecognized_keys")for(const y of f.keys)a.has(y)||a.set(y,{}),a.get(y).r=!0;else e.issues.push(f);const u=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(u.length&&c&&e.issues.push({...c,keys:u}),ts(e))return e;const h=Mr(s.value,i.value);if(!h.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(h.mergeErrorPath)}`);return e.value=h.data,e}const kf=w("$ZodRecord",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{const c=i.value;if(!Qt(c))return i.issues.push({expected:"record",code:"invalid_type",input:c,inst:e}),i;const u=[],h=s.keyType._zod.values;if(h){i.value={};const f=new Set;for(const T of h)if(typeof T=="string"||typeof T=="number"||typeof T=="symbol"){f.add(typeof T=="number"?T.toString():T);const x=s.valueType._zod.run({value:c[T],issues:[]},a);x instanceof Promise?u.push(x.then(P=>{P.issues.length&&i.issues.push(...ss(T,P.issues)),i.value[T]=P.value})):(x.issues.length&&i.issues.push(...ss(T,x.issues)),i.value[T]=x.value)}let y;for(const T in c)f.has(T)||(y=y??[],y.push(T));y&&y.length>0&&i.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:y})}else{i.value={};for(const f of Reflect.ownKeys(c)){if(f==="__proto__")continue;let y=s.keyType._zod.run({value:f,issues:[]},a);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&mo.test(f)&&y.issues.length){const P=s.keyType._zod.run({value:Number(f),issues:[]},a);if(P instanceof Promise)throw new Error("Async schemas not supported in object keys currently");P.issues.length===0&&(y=P)}if(y.issues.length){s.mode==="loose"?i.value[f]=c[f]:i.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(P=>Nt(P,a,pt())),input:f,path:[f],inst:e});continue}const x=s.valueType._zod.run({value:c[f],issues:[]},a);x instanceof Promise?u.push(x.then(P=>{P.issues.length&&i.issues.push(...ss(f,P.issues)),i.value[y.value]=P.value})):(x.issues.length&&i.issues.push(...ss(f,x.issues)),i.value[y.value]=x.value)}}return u.length?Promise.all(u).then(()=>i):i}}),Df=w("$ZodEnum",(e,s)=>{ye.init(e,s);const i=so(s.entries),a=new Set(i);e._zod.values=a,e._zod.pattern=new RegExp(`^(${i.filter(c=>Hp.has(typeof c)).map(c=>typeof c=="string"?es(c):c.toString()).join("|")})$`),e._zod.parse=(c,u)=>{const h=c.value;return a.has(h)||c.issues.push({code:"invalid_value",values:i,input:h,inst:e}),c}}),Rf=w("$ZodLiteral",(e,s)=>{if(ye.init(e,s),s.values.length===0)throw new Error("Cannot create literal schema with no valid values");const i=new Set(s.values);e._zod.values=i,e._zod.pattern=new RegExp(`^(${s.values.map(a=>typeof a=="string"?es(a):a?es(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,c)=>{const u=a.value;return i.has(u)||a.issues.push({code:"invalid_value",values:s.values,input:u,inst:e}),a}}),Mf=w("$ZodTransform",(e,s)=>{ye.init(e,s),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new to(e.constructor.name);const c=s.transform(i.value,i);if(a.async)return(c instanceof Promise?c:Promise.resolve(c)).then(h=>(i.value=h,i));if(c instanceof Promise)throw new Xt;return i.value=c,i}});function Co(e,s){return e.issues.length&&s===void 0?{issues:[],value:void 0}:e}const vo=w("$ZodOptional",(e,s)=>{ye.init(e,s),e._zod.optin="optional",e._zod.optout="optional",re(e._zod,"values",()=>s.innerType._zod.values?new Set([...s.innerType._zod.values,void 0]):void 0),re(e._zod,"pattern",()=>{const i=s.innerType._zod.pattern;return i?new RegExp(`^(${Or(i.source)})?$`):void 0}),e._zod.parse=(i,a)=>{if(s.innerType._zod.optin==="optional"){const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>Co(u,i.value)):Co(c,i.value)}return i.value===void 0?i:s.innerType._zod.run(i,a)}}),$f=w("$ZodExactOptional",(e,s)=>{vo.init(e,s),re(e._zod,"values",()=>s.innerType._zod.values),re(e._zod,"pattern",()=>s.innerType._zod.pattern),e._zod.parse=(i,a)=>s.innerType._zod.run(i,a)}),Ff=w("$ZodNullable",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.innerType._zod.optin),re(e._zod,"optout",()=>s.innerType._zod.optout),re(e._zod,"pattern",()=>{const i=s.innerType._zod.pattern;return i?new RegExp(`^(${Or(i.source)}|null)$`):void 0}),re(e._zod,"values",()=>s.innerType._zod.values?new Set([...s.innerType._zod.values,null]):void 0),e._zod.parse=(i,a)=>i.value===null?i:s.innerType._zod.run(i,a)}),Bf=w("$ZodDefault",(e,s)=>{ye.init(e,s),e._zod.optin="optional",re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);if(i.value===void 0)return i.value=s.defaultValue,i;const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>No(u,s)):No(c,s)}});function No(e,s){return e.value===void 0&&(e.value=s.defaultValue),e}const Uf=w("$ZodPrefault",(e,s)=>{ye.init(e,s),e._zod.optin="optional",re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>(a.direction==="backward"||i.value===void 0&&(i.value=s.defaultValue),s.innerType._zod.run(i,a))}),jf=w("$ZodNonOptional",(e,s)=>{ye.init(e,s),re(e._zod,"values",()=>{const i=s.innerType._zod.values;return i?new Set([...i].filter(a=>a!==void 0)):void 0}),e._zod.parse=(i,a)=>{const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>_o(u,e)):_o(c,e)}});function _o(e,s){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:s}),e}const zf=w("$ZodCatch",(e,s)=>{ye.init(e,s),re(e._zod,"optin",()=>s.innerType._zod.optin),re(e._zod,"optout",()=>s.innerType._zod.optout),re(e._zod,"values",()=>s.innerType._zod.values),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(u=>(i.value=u.value,u.issues.length&&(i.value=s.catchValue({...i,error:{issues:u.issues.map(h=>Nt(h,a,pt()))},input:i.value}),i.issues=[]),i)):(i.value=c.value,c.issues.length&&(i.value=s.catchValue({...i,error:{issues:c.issues.map(u=>Nt(u,a,pt()))},input:i.value}),i.issues=[]),i)}}),Vf=w("$ZodPipe",(e,s)=>{ye.init(e,s),re(e._zod,"values",()=>s.in._zod.values),re(e._zod,"optin",()=>s.in._zod.optin),re(e._zod,"optout",()=>s.out._zod.optout),re(e._zod,"propValues",()=>s.in._zod.propValues),e._zod.parse=(i,a)=>{if(a.direction==="backward"){const u=s.out._zod.run(i,a);return u instanceof Promise?u.then(h=>ci(h,s.in,a)):ci(u,s.in,a)}const c=s.in._zod.run(i,a);return c instanceof Promise?c.then(u=>ci(u,s.out,a)):ci(c,s.out,a)}});function ci(e,s,i){return e.issues.length?(e.aborted=!0,e):s._zod.run({value:e.value,issues:e.issues},i)}const Gf=w("$ZodReadonly",(e,s)=>{ye.init(e,s),re(e._zod,"propValues",()=>s.innerType._zod.propValues),re(e._zod,"values",()=>s.innerType._zod.values),re(e._zod,"optin",()=>s.innerType?._zod?.optin),re(e._zod,"optout",()=>s.innerType?._zod?.optout),e._zod.parse=(i,a)=>{if(a.direction==="backward")return s.innerType._zod.run(i,a);const c=s.innerType._zod.run(i,a);return c instanceof Promise?c.then(Oo):Oo(c)}});function Oo(e){return e.value=Object.freeze(e.value),e}const Hf=w("$ZodCustom",(e,s)=>{Fe.init(e,s),ye.init(e,s),e._zod.parse=(i,a)=>i,e._zod.check=i=>{const a=i.value,c=s.fn(a);if(c instanceof Promise)return c.then(u=>Lo(u,i,a,e));Lo(c,i,a,e)}});function Lo(e,s,i,a){if(!e){const c={code:"custom",input:i,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(c.params=a._zod.def.params),s.issues.push(As(c))}}var ko;class Zf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(s,...i){const a=i[0];return this._map.set(s,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,s),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(s){const i=this._map.get(s);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(s),this}get(s){const i=s._zod.parent;if(i){const a={...this.get(i)??{}};delete a.id;const c={...a,...this._map.get(s)};return Object.keys(c).length?c:void 0}return this._map.get(s)}has(s){return this._map.has(s)}}function Wf(){return new Zf}(ko=globalThis).__zod_globalRegistry??(ko.__zod_globalRegistry=Wf());const Cs=globalThis.__zod_globalRegistry;function Kf(e,s){return new e({type:"string",...U(s)})}function qf(e,s){return new e({type:"string",format:"email",check:"string_format",abort:!1,...U(s)})}function Do(e,s){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...U(s)})}function Yf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...U(s)})}function Jf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(s)})}function Xf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(s)})}function Qf(e,s){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(s)})}function Ro(e,s){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(s)})}function em(e,s){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...U(s)})}function tm(e,s){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(s)})}function sm(e,s){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...U(s)})}function im(e,s){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(s)})}function rm(e,s){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...U(s)})}function nm(e,s){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...U(s)})}function am(e,s){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(s)})}function om(e,s){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(s)})}function cm(e,s){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(s)})}function lm(e,s){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(s)})}function um(e,s){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(s)})}function hm(e,s){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...U(s)})}function pm(e,s){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...U(s)})}function dm(e,s){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...U(s)})}function fm(e,s){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...U(s)})}function mm(e,s){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(s)})}function ym(e,s){return new e({type:"string",format:"date",check:"string_format",...U(s)})}function gm(e,s){return new e({type:"string",format:"time",check:"string_format",precision:null,...U(s)})}function Em(e,s){return new e({type:"string",format:"duration",check:"string_format",...U(s)})}function Tm(e,s){return new e({type:"number",checks:[],...U(s)})}function Sm(e,s){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(s)})}function bm(e,s){return new e({type:"boolean",...U(s)})}function xm(e){return new e({type:"unknown"})}function Im(e,s){return new e({type:"never",...U(s)})}function Mo(e,s){return new go({check:"less_than",...U(s),value:e,inclusive:!1})}function $r(e,s){return new go({check:"less_than",...U(s),value:e,inclusive:!0})}function $o(e,s){return new Eo({check:"greater_than",...U(s),value:e,inclusive:!1})}function Fr(e,s){return new Eo({check:"greater_than",...U(s),value:e,inclusive:!0})}function Fo(e,s){return new Fd({check:"multiple_of",...U(s),value:e})}function Bo(e,s){return new Ud({check:"max_length",...U(s),maximum:e})}function li(e,s){return new jd({check:"min_length",...U(s),minimum:e})}function Uo(e,s){return new zd({check:"length_equals",...U(s),length:e})}function Pm(e,s){return new Vd({check:"string_format",format:"regex",...U(s),pattern:e})}function wm(e){return new Gd({check:"string_format",format:"lowercase",...U(e)})}function Am(e){return new Hd({check:"string_format",format:"uppercase",...U(e)})}function Cm(e,s){return new Zd({check:"string_format",format:"includes",...U(s),includes:e})}function vm(e,s){return new Wd({check:"string_format",format:"starts_with",...U(s),prefix:e})}function Nm(e,s){return new Kd({check:"string_format",format:"ends_with",...U(s),suffix:e})}function is(e){return new qd({check:"overwrite",tx:e})}function _m(e){return is(s=>s.normalize(e))}function Om(){return is(e=>e.trim())}function Lm(){return is(e=>e.toLowerCase())}function km(){return is(e=>e.toUpperCase())}function Dm(){return is(e=>Vp(e))}function Rm(e,s,i){return new e({type:"array",element:s,...U(i)})}function Mm(e,s,i){const a=U(i);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:s,...a})}function $m(e,s,i){return new e({type:"custom",check:"custom",fn:s,...U(i)})}function Fm(e){const s=Bm(i=>(i.addIssue=a=>{if(typeof a=="string")i.issues.push(As(a,i.value,s._zod.def));else{const c=a;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=i.value),c.inst??(c.inst=s),c.continue??(c.continue=!s._zod.def.abort),i.issues.push(As(c))}},e(i.value,i)));return s}function Bm(e,s){const i=new Fe({check:"custom",...U(s)});return i._zod.check=e,i}function jo(e){let s=e?.target??"draft-2020-12";return s==="draft-4"&&(s="draft-04"),s==="draft-7"&&(s="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Cs,target:s,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ie(e,s,i={path:[],schemaPath:[]}){var a;const c=e._zod.def,u=s.seen.get(e);if(u)return u.count++,i.schemaPath.includes(e)&&(u.cycle=i.path),u.schema;const h={schema:{},count:1,cycle:void 0,path:i.path};s.seen.set(e,h);const f=e._zod.toJSONSchema?.();if(f)h.schema=f;else{const x={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(s,h.schema,x);else{const L=h.schema,R=s.processors[c.type];if(!R)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${c.type}`);R(e,s,L,x)}const P=e._zod.parent;P&&(h.ref||(h.ref=P),Ie(P,s,x),s.seen.get(P).isParent=!0)}const y=s.metadataRegistry.get(e);return y&&Object.assign(h.schema,y),s.io==="input"&&Me(e)&&(delete h.schema.examples,delete h.schema.default),s.io==="input"&&h.schema._prefault&&((a=h.schema).default??(a.default=h.schema._prefault)),delete h.schema._prefault,s.seen.get(e).schema}function zo(e,s){const i=e.seen.get(s);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const h of e.seen.entries()){const f=e.metadataRegistry.get(h[0])?.id;if(f){const y=a.get(f);if(y&&y!==h[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(f,h[0])}}const c=h=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const P=e.external.registry.get(h[0])?.id,L=e.external.uri??(ae=>ae);if(P)return{ref:L(P)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${L("__shared")}#/${f}/${R}`}}if(h[1]===i)return{ref:"#"};const T=`#/${f}/`,x=h[1].schema.id??`__schema${e.counter++}`;return{defId:x,ref:T+x}},u=h=>{if(h[1].schema.$ref)return;const f=h[1],{ref:y,defId:T}=c(h);f.def={...f.schema},T&&(f.defId=T);const x=f.schema;for(const P in x)delete x[P];x.$ref=y};if(e.cycles==="throw")for(const h of e.seen.entries()){const f=h[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
38
38
 
39
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function dr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=i=>{const a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},d=a.ref;if(a.ref=null,d){o(d);const S=e.seen.get(d),O=S.schema;if(O.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(O)):Object.assign(c,O),Object.assign(c,u),i._zod.parent===d)for(const B in c)B==="$ref"||B==="allOf"||B in u||delete c[B];if(O.$ref&&S.def)for(const B in c)B==="$ref"||B==="allOf"||B in S.def&&JSON.stringify(c[B])===JSON.stringify(S.def[B])&&delete c[B]}const m=i._zod.parent;if(m&&m!==d){o(m);const S=e.seen.get(m);if(S?.schema.$ref&&(c.$ref=S.schema.$ref,S.def))for(const O in c)O==="$ref"||O==="allOf"||O in S.def&&JSON.stringify(c[O])===JSON.stringify(S.def[O])&&delete c[O]}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())o(i[0]);const r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(i)}Object.assign(r,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(s[a.defId]=a.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{const i=JSON.parse(JSON.stringify(r));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ct(t,"input",e.processors),output:Ct(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function Y(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Y(o.element,n);if(o.type==="set")return Y(o.valueType,n);if(o.type==="lazy")return Y(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Y(o.innerType,n);if(o.type==="intersection")return Y(o.left,n)||Y(o.right,n);if(o.type==="record"||o.type==="map")return Y(o.keyType,n)||Y(o.valueType,n);if(o.type==="pipe")return Y(o.in,n)||Y(o.out,n);if(o.type==="object"){for(const r in o.shape)if(Y(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(const r of o.options)if(Y(r,n))return!0;return!1}if(o.type==="tuple"){for(const r of o.items)if(Y(r,n))return!0;return!!(o.rest&&Y(o.rest,n))}return!1}const Yu=(e,t={})=>n=>{const o=ur({...n,processors:t});return F(e,o),lr(o,e),dr(o,e)},Ct=(e,t,n={})=>o=>{const{libraryOptions:r,target:s}=o??{},i=ur({...r??{},target:s,io:t,processors:n});return F(e,i),lr(i,e),dr(i,e)},Ku={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ju=(e,t,n,o)=>{const r=n;r.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(r.minLength=s),typeof i=="number"&&(r.maxLength=i),a&&(r.format=Ku[a]??a,r.format===""&&delete r.format,a==="time"&&delete r.format),u&&(r.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Xu=(e,t,n,o)=>{const r=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.includes("int")?r.type="integer":r.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.minimum=d,r.exclusiveMinimum=!0):r.exclusiveMinimum=d),typeof s=="number"&&(r.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete r.minimum:delete r.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.maximum=u,r.exclusiveMaximum=!0):r.exclusiveMaximum=u),typeof i=="number"&&(r.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete r.maximum:delete r.exclusiveMaximum)),typeof c=="number"&&(r.multipleOf=c)},Qu=(e,t,n,o)=>{n.type="boolean"},qu=(e,t,n,o)=>{n.not={}},el=(e,t,n,o)=>{},tl=(e,t,n,o)=>{const r=e._zod.def,s=vo(r.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},nl=(e,t,n,o)=>{const r=e._zod.def,s=[];for(const i of r.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},ol=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},rl=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},sl=(e,t,n,o)=>{const r=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(r.minItems=i),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=F(s.element,t,{...o,path:[...o.path,"items"]})},il=(e,t,n,o)=>{const r=n,s=e._zod.def;r.type="object",r.properties={};const i=s.shape;for(const u in i)r.properties[u]=F(i[u],t,{...o,path:[...o.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(r.required=Array.from(c)),s.catchall?._zod.def.type==="never"?r.additionalProperties=!1:s.catchall?s.catchall&&(r.additionalProperties=F(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},al=(e,t,n,o)=>{const r=e._zod.def,s=r.inclusive===!1,i=r.options.map((a,c)=>F(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},cl=(e,t,n,o)=>{const r=e._zod.def,s=F(r.left,t,{...o,path:[...o.path,"allOf",0]}),i=F(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},ul=(e,t,n,o)=>{const r=n,s=e._zod.def;r.type="object";const i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=F(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(const m of c)r.patternProperties[m.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=F(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=F(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(m=>typeof m=="string"||typeof m=="number");d.length>0&&(r.required=d)}},ll=(e,t,n,o)=>{const r=e._zod.def,s=F(r.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=r.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},dl=(e,t,n,o)=>{const r=e._zod.def;F(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType},pl=(e,t,n,o)=>{const r=e._zod.def;F(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},fl=(e,t,n,o)=>{const r=e._zod.def;F(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},hl=(e,t,n,o)=>{const r=e._zod.def;F(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType;let i;try{i=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},ml=(e,t,n,o)=>{const r=e._zod.def,s=t.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;F(s,t,o);const i=t.seen.get(e);i.ref=s},El=(e,t,n,o)=>{const r=e._zod.def;F(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0},pr=(e,t,n,o)=>{const r=e._zod.def;F(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType},gl=l("ZodISODateTime",(e,t)=>{_c.init(e,t),P.init(e,t)});function _l(e){return Iu(gl,e)}const yl=l("ZodISODate",(e,t)=>{yc.init(e,t),P.init(e,t)});function Sl(e){return wu(yl,e)}const Tl=l("ZodISOTime",(e,t)=>{Sc.init(e,t),P.init(e,t)});function Ol(e){return vu(Tl,e)}const Il=l("ZodISODuration",(e,t)=>{Tc.init(e,t),P.init(e,t)});function wl(e){return Cu(Il,e)}const vl=(e,t)=>{$o.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>da(e,n)},flatten:{value:n=>la(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,mn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,mn,2)}},isEmpty:{get(){return e.issues.length===0}}})},oe=l("ZodError",vl,{Parent:Error}),Cl=yn(oe),Rl=Sn(oe),bl=St(oe),Al=Tt(oe),Nl=ha(oe),$l=ma(oe),Ll=Ea(oe),Dl=ga(oe),kl=_a(oe),Pl=ya(oe),zl=Sa(oe),jl=Ta(oe),k=l("ZodType",(e,t)=>(D.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ct(e,"input"),output:Ct(e,"output")}}),e.toJSONSchema=Yu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(we(t,{checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(n,o)=>ve(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.parse=(n,o)=>Cl(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>bl(e,n,o),e.parseAsync=async(n,o)=>Rl(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>Al(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>Nl(e,n,o),e.decode=(n,o)=>$l(e,n,o),e.encodeAsync=async(n,o)=>Ll(e,n,o),e.decodeAsync=async(n,o)=>Dl(e,n,o),e.safeEncode=(n,o)=>kl(e,n,o),e.safeDecode=(n,o)=>Pl(e,n,o),e.safeEncodeAsync=async(n,o)=>zl(e,n,o),e.safeDecodeAsync=async(n,o)=>jl(e,n,o),e.refine=(n,o)=>e.check(Ad(n,o)),e.superRefine=n=>e.check(Nd(n)),e.overwrite=n=>e.check(Ge(n)),e.optional=()=>Tr(e),e.exactOptional=()=>gd(e),e.nullable=()=>Or(e),e.nullish=()=>Tr(Or(e)),e.nonoptional=n=>Id(e,n),e.array=()=>A(e),e.or=n=>cd([e,n]),e.and=n=>dd(e,n),e.transform=n=>wr(e,md(n)),e.default=n=>Sd(e,n),e.prefault=n=>Od(e,n),e.catch=n=>vd(e,n),e.pipe=n=>wr(e,n),e.readonly=()=>bd(e),e.describe=n=>{const o=e.clone();return tt.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return tt.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return tt.get(e);const o=e.clone();return tt.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),fr=l("_ZodString",(e,t)=>{Tn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(o,r,s)=>Ju(e,o,r);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(Lu(...o)),e.includes=(...o)=>e.check(Pu(...o)),e.startsWith=(...o)=>e.check(zu(...o)),e.endsWith=(...o)=>e.check(ju(...o)),e.min=(...o)=>e.check(vt(...o)),e.max=(...o)=>e.check(ar(...o)),e.length=(...o)=>e.check(cr(...o)),e.nonempty=(...o)=>e.check(vt(1,...o)),e.lowercase=o=>e.check(Du(o)),e.uppercase=o=>e.check(ku(o)),e.trim=()=>e.check(Mu()),e.normalize=(...o)=>e.check(Uu(...o)),e.toLowerCase=()=>e.check(Fu()),e.toUpperCase=()=>e.check(Gu()),e.slugify=()=>e.check(xu())}),Ul=l("ZodString",(e,t)=>{Tn.init(e,t),fr.init(e,t),e.email=n=>e.check(ou(Ml,n)),e.url=n=>e.check(or(mr,n)),e.jwt=n=>e.check(Ou(ed,n)),e.emoji=n=>e.check(cu(Fl,n)),e.guid=n=>e.check(nr(hr,n)),e.uuid=n=>e.check(ru(Rt,n)),e.uuidv4=n=>e.check(su(Rt,n)),e.uuidv6=n=>e.check(iu(Rt,n)),e.uuidv7=n=>e.check(au(Rt,n)),e.nanoid=n=>e.check(uu(Gl,n)),e.guid=n=>e.check(nr(hr,n)),e.cuid=n=>e.check(lu(xl,n)),e.cuid2=n=>e.check(du(Bl,n)),e.ulid=n=>e.check(pu(Zl,n)),e.base64=n=>e.check(yu(Xl,n)),e.base64url=n=>e.check(Su(Ql,n)),e.xid=n=>e.check(fu(Hl,n)),e.ksuid=n=>e.check(hu(Vl,n)),e.ipv4=n=>e.check(mu(Wl,n)),e.ipv6=n=>e.check(Eu(Yl,n)),e.cidrv4=n=>e.check(gu(Kl,n)),e.cidrv6=n=>e.check(_u(Jl,n)),e.e164=n=>e.check(Tu(ql,n)),e.datetime=n=>e.check(_l(n)),e.date=n=>e.check(Sl(n)),e.time=n=>e.check(Ol(n)),e.duration=n=>e.check(wl(n))});function h(e){return nu(Ul,e)}const P=l("ZodStringFormat",(e,t)=>{$.init(e,t),fr.init(e,t)}),Ml=l("ZodEmail",(e,t)=>{uc.init(e,t),P.init(e,t)}),hr=l("ZodGUID",(e,t)=>{ac.init(e,t),P.init(e,t)}),Rt=l("ZodUUID",(e,t)=>{cc.init(e,t),P.init(e,t)}),mr=l("ZodURL",(e,t)=>{lc.init(e,t),P.init(e,t)});function Er(e){return or(mr,e)}const Fl=l("ZodEmoji",(e,t)=>{dc.init(e,t),P.init(e,t)}),Gl=l("ZodNanoID",(e,t)=>{pc.init(e,t),P.init(e,t)}),xl=l("ZodCUID",(e,t)=>{fc.init(e,t),P.init(e,t)}),Bl=l("ZodCUID2",(e,t)=>{hc.init(e,t),P.init(e,t)}),Zl=l("ZodULID",(e,t)=>{mc.init(e,t),P.init(e,t)}),Hl=l("ZodXID",(e,t)=>{Ec.init(e,t),P.init(e,t)}),Vl=l("ZodKSUID",(e,t)=>{gc.init(e,t),P.init(e,t)}),Wl=l("ZodIPv4",(e,t)=>{Oc.init(e,t),P.init(e,t)}),Yl=l("ZodIPv6",(e,t)=>{Ic.init(e,t),P.init(e,t)}),Kl=l("ZodCIDRv4",(e,t)=>{wc.init(e,t),P.init(e,t)}),Jl=l("ZodCIDRv6",(e,t)=>{vc.init(e,t),P.init(e,t)}),Xl=l("ZodBase64",(e,t)=>{Cc.init(e,t),P.init(e,t)}),Ql=l("ZodBase64URL",(e,t)=>{bc.init(e,t),P.init(e,t)}),ql=l("ZodE164",(e,t)=>{Ac.init(e,t),P.init(e,t)}),ed=l("ZodJWT",(e,t)=>{$c.init(e,t),P.init(e,t)}),gr=l("ZodNumber",(e,t)=>{xo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(o,r,s)=>Xu(e,o,r),e.gt=(o,r)=>e.check(sr(o,r)),e.gte=(o,r)=>e.check(wn(o,r)),e.min=(o,r)=>e.check(wn(o,r)),e.lt=(o,r)=>e.check(rr(o,r)),e.lte=(o,r)=>e.check(In(o,r)),e.max=(o,r)=>e.check(In(o,r)),e.int=o=>e.check(he(o)),e.safe=o=>e.check(he(o)),e.positive=o=>e.check(sr(0,o)),e.nonnegative=o=>e.check(wn(0,o)),e.negative=o=>e.check(rr(0,o)),e.nonpositive=o=>e.check(In(0,o)),e.multipleOf=(o,r)=>e.check(ir(o,r)),e.step=(o,r)=>e.check(ir(o,r)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function bt(e){return Ru(gr,e)}const td=l("ZodNumberFormat",(e,t)=>{Lc.init(e,t),gr.init(e,t)});function he(e){return bu(td,e)}const nd=l("ZodBoolean",(e,t)=>{Dc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Qu(e,n,o)});function v(e){return Au(nd,e)}const od=l("ZodUnknown",(e,t)=>{kc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>el()});function _r(){return Nu(od)}const rd=l("ZodNever",(e,t)=>{Pc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qu(e,n,o)});function sd(e){return $u(rd,e)}const id=l("ZodArray",(e,t)=>{zc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>sl(e,n,o,r),e.element=t.element,e.min=(n,o)=>e.check(vt(n,o)),e.nonempty=n=>e.check(vt(1,n)),e.max=(n,o)=>e.check(ar(n,o)),e.length=(n,o)=>e.check(cr(n,o)),e.unwrap=()=>e.element});function A(e,t){return Bu(id,e,t)}const ad=l("ZodObject",(e,t)=>{Uc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>il(e,n,o,r),b(e,"shape",()=>t.shape),e.keyof=()=>U(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:_r()}),e.loose=()=>e.clone({...e._zod.def,catchall:_r()}),e.strict=()=>e.clone({...e._zod.def,catchall:sd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>sa(e,n),e.safeExtend=n=>ia(e,n),e.merge=n=>aa(e,n),e.pick=n=>oa(e,n),e.omit=n=>ra(e,n),e.partial=(...n)=>ca(Sr,e,n[0]),e.required=(...n)=>ua(Ir,e,n[0])});function p(e,t){const n={type:"object",shape:e??{},..._(t)};return new ad(n)}const yr=l("ZodUnion",(e,t)=>{Wo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>al(e,n,o,r),e.options=t.options});function cd(e,t){return new yr({type:"union",options:e,..._(t)})}const ud=l("ZodDiscriminatedUnion",(e,t)=>{yr.init(e,t),Mc.init(e,t)});function q(e,t,n){return new ud({type:"union",options:t,discriminator:e,..._(n)})}const ld=l("ZodIntersection",(e,t)=>{Fc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>cl(e,n,o,r)});function dd(e,t){return new ld({type:"intersection",left:e,right:t})}const pd=l("ZodRecord",(e,t)=>{Gc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ul(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function Z(e,t,n){return new pd({type:"record",keyType:e,valueType:t,..._(n)})}const vn=l("ZodEnum",(e,t)=>{xc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(o,r,s)=>tl(e,o,r),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{const s={};for(const i of o)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new vn({...t,checks:[],..._(r),entries:s})},e.exclude=(o,r)=>{const s={...t.entries};for(const i of o)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new vn({...t,checks:[],..._(r),entries:s})}});function U(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new vn({type:"enum",entries:n,..._(t)})}const fd=l("ZodLiteral",(e,t)=>{Bc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>nl(e,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function E(e,t){return new fd({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}const hd=l("ZodTransform",(e,t)=>{Zc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>rl(e,n),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new wo(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(et(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(et(i))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(s=>(n.value=s,n)):(n.value=r,n)}});function md(e){return new hd({type:"transform",transform:e})}const Sr=l("ZodOptional",(e,t)=>{Jo.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>pr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Tr(e){return new Sr({type:"optional",innerType:e})}const Ed=l("ZodExactOptional",(e,t)=>{Hc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>pr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function gd(e){return new Ed({type:"optional",innerType:e})}const _d=l("ZodNullable",(e,t)=>{Vc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ll(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Or(e){return new _d({type:"nullable",innerType:e})}const yd=l("ZodDefault",(e,t)=>{Wc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>pl(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sd(e,t){return new yd({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ao(t)}})}const Td=l("ZodPrefault",(e,t)=>{Yc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>fl(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Od(e,t){return new Td({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ao(t)}})}const Ir=l("ZodNonOptional",(e,t)=>{Kc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>dl(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Id(e,t){return new Ir({type:"nonoptional",innerType:e,..._(t)})}const wd=l("ZodCatch",(e,t)=>{Jc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>hl(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vd(e,t){return new wd({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Cd=l("ZodPipe",(e,t)=>{Xc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ml(e,n,o,r),e.in=t.in,e.out=t.out});function wr(e,t){return new Cd({type:"pipe",in:e,out:t})}const Rd=l("ZodReadonly",(e,t)=>{Qc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>El(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function bd(e){return new Rd({type:"readonly",innerType:e})}const vr=l("ZodCustom",(e,t)=>{qc.init(e,t),k.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ol(e,n)});function xe(e,t){return Zu(vr,e??(()=>!0),t)}function Ad(e,t={}){return Hu(vr,e,t)}function Nd(e){return Vu(e)}const ye={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"},$d=U(Object.values(ye)),At=ye,nt={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"},Ld=U(Object.values(nt)),Nt=nt,Cr={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"},Dd=U(Object.values(Cr)),kd=Cr,Rr={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"},Pd=U(Object.values(Rr)),zd=Rr,br={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"},jd=U(Object.values(br)),Ud=br,$t={COLOR:"COLOR",GRADIENT:"GRADIENT"},Md=U(Object.values($t)),Cn=$t,Ae={SECTION:"SECTION",HEADER:"HEADER",FOOTER:"FOOTER"},Fd=U(Object.values(Ae)),Se=Ae;var ee=(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))(ee||{}),N=(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))(N||{}),Gd=(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))(Gd||{});const g={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"};U(Object.values(g));const w={TEXT:"TEXT",BUTTON:"BUTTON",IMAGE:"IMAGE",TOGGLE:"TOGGLE",SELECTBOX:"SELECTBOX",BACKGROUND:"BACKGROUND",COLOR_PICKER:"COLOR_PICKER",LOGO:"LOGO",DIVIDER:"DIVIDER",INFO:"INFO",ACCORDION:"ACCORDION"};U(Object.values(w));const te=w,ot={CONTENT:"Content",DESIGN:"Design"};U(Object.values(ot));const xd={TEXT:"TEXT",IMAGE:"IMAGE"},Bd=U(Object.values(xd));var Zd=(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))(Zd||{}),Hd=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(Hd||{});const Vd={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"},Wd=U(Object.values(Vd)),G={[Se.SECTION]:{source:"sections",dist:"dist/sections"},[Se.HEADER]:{source:"headers",dist:"dist/headers"},[Se.FOOTER]:{source:"footers",dist:"dist/footers"}};var R=(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))(R||{});function Be(e){const t={};for(const[n,o]of Object.entries(e)){let r={...o};if(o.type==="DECK"&&o.cards&&typeof o.cards=="object"&&"defaultCardContent"in o.cards){const s=o.cards;s.defaultCardContent?.settings&&(r={...r,cards:{...s,defaultCardContent:{...s.defaultCardContent,settings:Be(s.defaultCardContent.settings)}}})}if(o.type==="ACCORDION"&&o.cards&&typeof o.cards=="object"&&!("defaultCardContent"in o.cards)){const s=o.cards,i={};for(const[a,c]of Object.entries(s))c.editors?i[a]={...c,editors:Be(c.editors)}:i[a]=c;r={...r,cards:i}}if(r.defaults&&typeof r.defaults=="object"&&!("type"in r.defaults)){const s=Object.assign({type:r.type},r.defaults);r={...r,defaults:s}}t[n]=r}return t}const Yd={url:"must be a valid URL",email:"must be a valid email address"},Kd=e=>{const t=e?.at(-1);return typeof t=="string"?`'${t}'`:"Field"},Jd=e=>e===null?"null":typeof e,Xd=e=>{switch(e.code){case"invalid_type":{const{input:t}=e;return t===void 0?{message:`${Kd(e.path)} is required`}:{message:`Expected ${String(e.expected)}, received ${Jd(t)}`}}case"invalid_format":{const t=Yd[e.format];return t?{message:t}:void 0}case"unrecognized_keys":return{message:`Unrecognized property: ${e.keys.map(t=>`'${t}'`).join(", ")}`};case"invalid_union":{const t=e.path?.at(-1);return typeof t=="string"?{message:`'${t}' is required or has invalid value`}:void 0}case"invalid_value":{const{values:t}=e;return t?{message:`Expected one of: ${t.map(n=>`'${String(n)}'`).join(", ")}`}:void 0}case"invalid_key":{const t=e.issues?.[0];return t?{message:t.message}:void 0}default:return}};U(["none","all","small"]);const Ne={PRODUCT:"PRODUCT",CATALOG:"CATALOG",CATEGORY:"CATEGORY",HOME:"HOME",CUSTOM:"CUSTOM"},Ar={HOME:"home",CATALOG:"catalog",CATEGORY:"category",PRODUCT:"product"},Qd=U(Object.values(Ne));U(Object.values(Ar));const qd={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"},ep=U(Object.values(qd)),tp={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"},np={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"},op=U(Object.values(np)),X={REQUIRED_HEADER_ID:()=>'Header section must have id "header" when type is "default"',REQUIRED_CUSTOM_HEADER:(...e)=>`Custom header section with id "${e[0]}" must exist in headers directory`,REQUIRED_CUSTOM_HEADER_TYPE:(...e)=>`Custom header section with id "${e[0]}" must be of type "HEADER"`,REQUIRED_FOOTER_ID:()=>'Footer section must have id "footer" when type is "default"',REQUIRED_CUSTOM_FOOTER:(...e)=>`Custom footer section with id "${e[0]}" must exist in footers directory`,REQUIRED_CUSTOM_FOOTER_TYPE:(...e)=>`Custom footer section with id "${e[0]}" must be of type "FOOTER"`,REQUIRED_PAGE_SECTION:(...e)=>`Custom section with id "${e[0]}" must exist in sections directory`,REQUIRED_PAGE_SECTION_TYPE:()=>'Section "header" or "footer" is not allowed among page sections',SHOWCASE_ID_NOT_FOUND:(...e)=>`Showcase with id "${e[0]}" must exist in section's showcase directory`,DUPLICATE_SHOWCASE_ID:(...e)=>`Showcase id "${e[0]}" must be unique within section showcases`,SHOWCASE_OVERRIDE_CONTENT:(...e)=>`Content editor "${e[0]}" in showcase_overrides must exist in section's content configuration file`,SHOWCASE_OVERRIDE_DESIGN:(...e)=>`Design editor "${e[0]}" in showcase_overrides must exist in section's design configuration file`,SHOWCASE_OVERRIDE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase_overrides must exist in section's layout configuration file`,SHOWCASE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase must exist in section's layout configuration file`,INVALID_SHOWCASE_CONTENT_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in content.ts`,SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but content.ts has type "${e[2]}"`,INVALID_SHOWCASE_DESIGN_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in design.ts`,SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but design.ts has type "${e[2]}"`,INVALID_DECK_CARD_SETTING:(...e)=>`Setting "${e[0]}" is not defined in content.ts defaultCardContent.settings`,DECK_SETTINGS_REQUIRED:()=>"settings must have at least one property",INVALID_SELECTBOX_OPTION:(...e)=>`Option value "${e[0]}" for element "${e[1]}" is not defined in content.ts options`,REQUIRED_STORE_LAYOUT:(...e)=>`Store section with id "${e[0]}" and page type "${e[1]}" must have a corresponding layout defined`,INVALID_STORE_SECTION_ID:(...e)=>`Store layout sectionId "${e[0]}" must be one of: ${e[1]}`,REQUIRED_SECTION_ASSET:(...e)=>`Asset size ${e[0]} exceeds threshold of ${e[1]}.`,REQUIRED_SERVER_SIZE:(...e)=>`Size of individual server file [${e[0]}] must not exceed threshold [${e[1]}].`,MISSING_IMAGE_ASSET:(...e)=>`Image ${e[0]} is missing from assets folder`,MANDATORY_SETTING_TYPE_MISMATCH:(...e)=>`Editor type "${e[0]}" for reserved key "${e[1]}" does not match the required type "${e[2]}".`,MANDATORY_SETTING_NAME_MISMATCH:(...e)=>`Editor key "${e[0]}" for overridden content type "${e[1]}" does not match the required key name "${e[2]}".`,DUPLICATED_MANDATORY_SETTING:(...e)=>`Editor type "${e[0]}" can only be used once.`,IMAGE_EDITOR_STATIC_MISMATCH:(...e)=>`Both "${e[0]}" content and design editor need to have same value for attribute static`,DUPLICATE_DESIGN_EDITOR_NAME:()=>"Non-unique design editor name detected",COLOR_REQUIRED_GRADIENT:()=>"color is required when overlay is GRADIENT",COLOR_MUST_BE_ARRAY_GRADIENT:()=>"color must be an array when overlay is GRADIENT",COLOR_ARRAY_LENGTH_GRADIENT:()=>"color array must have exactly 2 items when overlay is GRADIENT",COLOR_REQUIRED_COLOR:()=>"color is required when overlay is COLOR",COLOR_MUST_BE_SINGLE_COLOR:()=>"color must be a single value when overlay is COLOR",COLOR_MUST_BE_UNDEFINED_NONE:()=>"color must be undefined when overlay is NONE or not set",COLOR_REQUIRED_STYLE_GRADIENT:()=>"color is required when style is GRADIENT",COLOR_MUST_BE_ARRAY_STYLE_GRADIENT:()=>"color must be an array when style is GRADIENT",COLOR_ARRAY_LENGTH_STYLE_GRADIENT:()=>"color array must have exactly 2 items when style is GRADIENT",COLOR_REQUIRED_STYLE_COLOR:()=>"color is required when style is COLOR",COLOR_MUST_BE_SINGLE_STYLE_COLOR:()=>"color must be a single value when style is COLOR",BUTTON_LINK_REQUIRED:()=>"link is required when buttonType is HYPER_LINK",BUTTON_CATEGORY_ID_REQUIRED:()=>"categoryId is required when buttonType is GO_TO_CATEGORY or GO_TO_CATEGORY_LINK",BUTTON_EMAIL_REQUIRED:()=>"email is required when buttonType is MAIL_LINK",BUTTON_PHONE_REQUIRED:()=>"phone is required when buttonType is TEL_LINK",BUTTON_TILE_ID_REQUIRED:(...e)=>`${e[0]} is required when buttonType is SCROLL_TO_TILE`,BUTTON_PAGE_ID_REQUIRED:()=>"pageIdForNavigate is required when type is GO_TO_PAGE",TEMPLATE_PAGE_SECTIONS_REQUIRED:()=>"sections must contain at least one section",TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have exactly one section`,TEMPLATE_PAGE_STORE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have a section of type "store"`,TEMPLATE_PAGE_NO_STORE_SECTIONS:(...e)=>`Page type "${e[0]}" cannot contain store sections`,TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED:()=>'Page type "CUSTOM" must have a metadata property',TEMPLATE_PAGE_METADATA_NOT_ALLOWED:(...e)=>`Page type "${e[0]}" must not have a metadata property`,NON_NEGATIVE_INTEGER:()=>"must be a non-negative integer",INTEGER_RANGE:(...e)=>`must be between ${e[0]} and ${e[1]}`,VALID_HEX_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA)",VALID_GLOBAL_FONT:()=>"must be a valid global font reference (global.fontFamily.title or global.fontFamily.body)",VALID_GLOBAL_TEXT_SIZE:()=>"must be a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_GLOBAL_COLOR:()=>"must be a valid global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA) or global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_TEXT_SIZE:()=>"must be an integer of at least 1 or a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_LANGUAGE_CODE:()=>"must be a valid language code (e.g., en, nl, fr, en_US, en_GB, zh_Hans)",VALID_URL:()=>"must be a valid URL",VALID_EMAIL:()=>"must be a valid email address",ACCORDION_ITEM_POSITION_FIELD_REQUIRED:(...e)=>`Item "${e[0]}" must have positionFieldName when sortable is true`,ACCORDION_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor`,ACCORDION_SHOWCASE_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor override`,ACCORDION_DUPLICATE_POSITION_FIELD_NAME:()=>"positionFieldName must be unique across accordion items when sortable is true",REQUIRED_COLLECTION_NAME:()=>"Collection must have a name in metadata"},Nr=/^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,$r=/^global\.fontFamily\.(title|body)$/,Lr=/^global\.textSize\.(title|subtitle|body)$/,Dr=/^global\.color\.(title|body|button|link|background)$/,rp=/^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$/,Re=(e,t)=>{const n=X.INTEGER_RANGE(e.toString(),t.toString());return he().min(e,{message:n}).max(t,{message:n})},Rn=p({path:h(),size:bt().nonnegative()}).strict(),kr=p({size:bt().nonnegative()}).strict(),y=h().regex(/^\$.+/,{message:"must start with '$' followed by at least one character"}),sp=p({r:Re(0,255),g:Re(0,255),b:Re(0,255),a:Re(0,1)}).strict(),Pr=h().regex(Nr,{message:X.VALID_HEX_COLOR()});xe(e=>typeof e=="string"&&$r.test(e),{message:X.VALID_GLOBAL_FONT()});const bn=h().refine(e=>!e.startsWith("global.")||$r.test(e),{message:X.VALID_GLOBAL_FONT()});xe(e=>typeof e=="string"&&Dr.test(e),{message:X.VALID_GLOBAL_COLOR()});const le=xe(e=>typeof e=="string"&&(Nr.test(e)||Dr.test(e)),{message:X.VALID_COLOR()}),zr=xe(e=>typeof e=="string"?le.safeParse(e).success:Array.isArray(e)&&e.every(t=>le.safeParse(t).success),{message:X.VALID_COLOR()});xe(e=>typeof e=="string"&&Lr.test(e),{message:X.VALID_GLOBAL_TEXT_SIZE()});const jr=xe(e=>typeof e=="number"?Number.isInteger(e)&&e>=1:typeof e=="string"&&Lr.test(e),{message:X.VALID_TEXT_SIZE()}),rt=U(["catalog","category","product"]),Lt=h().refine(e=>e.startsWith("#")||Er().safeParse(e).success,{message:"must be a valid URL or a hash fragment starting with #"}),st=p({url:h(),width:he().min(0,{message:X.NON_NEGATIVE_INTEGER()}).optional(),height:he().min(0,{message:X.NON_NEGATIVE_INTEGER()}).optional()}).strict(),ip=p({homogeneity:v().optional(),color:sp.optional()}).strict(),ap=p({ORIGINAL:st.optional(),WEBP_LOW_RES:st.optional(),WEBP_HI_2X_RES:st.optional(),MOBILE_WEBP_LOW_RES:st.optional(),MOBILE_WEBP_HI_RES:st.optional()}).strict().refine(e=>Object.keys(e).length>=1,{message:"set must have at least one property"}),Dt=p({set:ap,borderInfo:ip.optional()}).strict(),An=p({type:E(g.IMAGE),imageData:Dt}).strict(),Ur=p({type:E(g.IMAGE),label:y,static:v().optional(),defaults:An.optional()}).strict(),cp=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Nn(e){return e===Ne.PRODUCT||e===Ne.CATALOG||e===Ne.CATEGORY}function Mr(e,t,n){if(!e)return;const o=Li({path:"$..set..url",json:e,resultType:"all"}),r=/^https?:\/\//;o.forEach(s=>{const i=s.value;if(!r.test(i)&&!t.includes(i)){const a=s.pointer.split("/").filter(c=>c.length>0);n.at(a).addIssue("MISSING_IMAGE_ASSET",i)}})}function Fr(e,t,n){e===ye.HYPER_LINK&&!t&&n.at("link").addIssue("BUTTON_LINK_REQUIRED")}function Gr(e,t,n){(e===ye.GO_TO_CATEGORY||e===ye.GO_TO_CATEGORY_LINK)&&!t&&n.at("categoryId").addIssue("BUTTON_CATEGORY_ID_REQUIRED")}function xr(e,t,n){e===ye.MAIL_LINK&&!t&&n.at("email").addIssue("BUTTON_EMAIL_REQUIRED")}function Br(e,t,n){e===ye.TEL_LINK&&!t&&n.at("phone").addIssue("BUTTON_PHONE_REQUIRED")}function Zr(e,t,n,o){if(e===ye.SCROLL_TO_TILE&&!(t??n)){const r=t?"tileId":"tileIdForScroll";o.at(r).addIssue("BUTTON_TILE_ID_REQUIRED",r)}}function up(e,t,n){e===ye.GO_TO_PAGE&&!t&&n.at("pageIdForNavigate").addIssue("BUTTON_PAGE_ID_REQUIRED")}const lp="custom";function x(e,t=[]){const n=r=>Array.isArray(r)?r:[r],o=n(t);return{raw:e,addIssue(r,...s){e.addIssue({code:lp,message:X[r](...s),path:o,params:{errorMessageKey:r}})},at(r){const s=o.concat(n(r));return x(e,s)}}}const $n=p({type:E(g.BUTTON),title:y,buttonType:$d,link:h().optional(),linkTarget:h().optional(),email:h().regex(cp,{message:X.VALID_EMAIL()}).optional(),phone:h().optional(),tileId:h().optional(),categoryId:bt().optional()}).strict().superRefine((e,t)=>{const n=x(t);Fr(e.buttonType,e.link,n),Gr(e.buttonType,e.categoryId,n),xr(e.buttonType,e.email,n),Br(e.buttonType,e.phone,n),Zr(e.buttonType,e.tileId,void 0,n)}),Hr=p({type:E(g.BUTTON),label:y,defaults:$n.optional()}).strict(),Ln=p({type:E(g.CATEGORY_SELECTOR)}).strict(),Vr=p({type:E(g.CATEGORY_SELECTOR),label:y,maxCategories:Re(1,32),defaults:Ln.optional()}).strict(),Dn=p({type:E(g.DIVIDER)}).strict(),Wr=p({type:E(g.DIVIDER),label:y,defaults:Dn.optional()}).strict(),dp=p({label:y,link:Lt}).strict(),pp=p({title:y.optional(),link:Lt.optional()}).strict(),kn=p({type:E(g.INFO),text:y.optional(),button:pp.optional()}).strict(),Yr=p({type:E(g.INFO),label:y,description:y,button:dp.optional(),defaults:kn.optional()}).strict(),Pn=p({type:E(g.INPUTBOX),text:y}).strict(),Kr=p({type:E(g.INPUTBOX),label:y,placeholder:y,defaults:Pn.optional()}).strict(),zn=p({type:E(g.PRODUCT_SELECTOR)}).strict(),Jr=p({type:E(g.PRODUCT_SELECTOR),label:y,maxProducts:Re(1,32),defaults:zn.optional()}).strict(),jn=p({type:E(g.SELECTBOX),value:h()}).strict(),fp=p({value:h().min(1,{message:"value must not be empty"}),label:y}).strict(),Xr=p({type:E(g.SELECTBOX),label:y,placeholder:y,description:y,options:A(fp).min(1,{message:"must have at least one option"}),defaults:jn.optional()}).strict(),Un=p({type:E(g.TEXTAREA),text:y}).strict(),Qr=p({type:E(g.TEXTAREA),label:y,placeholder:y,defaults:Un.optional()}).strict(),Mn=p({type:E(g.TOGGLE),enabled:v()}).strict(),qr=p({type:E(g.TOGGLE),label:y,description:y,defaults:Mn.optional()}).strict(),es=p({type:E(g.DECK)}).strict(),ts=[Pn,Un,$n,An,Mn,jn,Dn,kn,zn,Ln],hp=q("type",[...ts]),mp=p({type:E(g.DECK),cards:A(p({settings:Z(h(),hp).superRefine((e,t)=>{Object.keys(e).length<1&&x(t).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),Ep=q("type",[...ts,mp]),gp=p({type:E(g.DECK),cards:A(p({settings:Z(h(),Ep).superRefine((e,t)=>{Object.keys(e).length<1&&x(t).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),ns=[Kr,Qr,Hr,Ur,qr,Xr,Wr,Yr,Vr,Jr],_p=p({type:E(g.DECK),label:y,addButtonLabel:y,maxCards:he().min(1,{message:"must be a positive integer"}),cards:p({defaultCardContent:p({label:y,settings:Z(h(),q("type",[...ns])).superRefine((e,t)=>{Object.keys(e).length<1&&x(t).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:es.optional()}).strict(),yp=q("type",[...ns,_p]),Sp=p({type:E(g.DECK),label:y,addButtonLabel:y,maxCards:he().min(1,{message:"must be a positive integer"}),cards:p({defaultCardContent:p({label:y,settings:Z(h(),yp).superRefine((e,t)=>{Object.keys(e).length<1&&x(t).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:es.optional()}).strict(),os=p({type:E(g.LOGO),logoType:Bd.optional(),text:y.optional(),imageData:Dt.optional()}).strict(),Tp=p({type:E(g.LOGO),label:y.optional(),defaults:os.optional()}).strict(),rs=p({id:h(),title:h().optional(),type:h().optional(),link:h().optional(),email:h().optional(),phone:h().optional(),tileIdForScroll:h().optional(),pageIdForNavigate:h().optional(),showStoreCategories:v().optional(),isSubmenuOpened:v().optional(),categoryId:bt().optional()}).strict().superRefine((e,t)=>{const n=x(t);Fr(e.type,e.link,n),Gr(e.type,e.categoryId,n),xr(e.type,e.email,n),Br(e.type,e.phone,n),Zr(e.type,void 0,e.tileIdForScroll,n),up(e.type,e.pageIdForNavigate,n)}),ss=p({type:E(g.MENU),items:A(rs).optional()}).strict(),Op=p({type:E(g.MENU),label:y.optional(),defaults:ss.optional()}).strict(),is=p({type:E(g.NAVIGATION_MENU),items:A(rs).optional()}).strict(),Ip=p({type:E(g.NAVIGATION_MENU),defaults:is.optional()}).strict(),kt=p({type:E(w.BACKGROUND),style:Md.optional(),color:zr.optional()}).strict().superRefine((e,t)=>{const n=x(t).at("color");e.style===$t.GRADIENT?e.color===void 0?n.addIssue("COLOR_REQUIRED_STYLE_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&n.addIssue("COLOR_ARRAY_LENGTH_STYLE_GRADIENT"):n.addIssue("COLOR_MUST_BE_ARRAY_STYLE_GRADIENT"):e.style===$t.COLOR&&(e.color===void 0?n.addIssue("COLOR_REQUIRED_STYLE_COLOR"):Array.isArray(e.color)&&n.addIssue("COLOR_MUST_BE_SINGLE_STYLE_COLOR"))}),wp=p({type:E(w.BACKGROUND),fieldName:h(),defaults:kt.optional()}).strict(),as=p({type:E(w.BACKGROUND),label:y,colors:A(le).optional(),enableAlphaColor:v().optional(),enableAutoColor:v().optional(),defaults:kt.optional()}).strict(),Pt=p({type:E(w.BUTTON),appearance:Dd.optional(),size:Pd.optional(),shape:jd.optional(),font:bn.optional(),color:le.optional(),visible:v().optional()}).strict(),vp=p({type:E(w.BUTTON),fieldName:h(),defaults:Pt.optional()}).strict(),cs=p({type:E(w.BUTTON),label:y,colors:A(le).optional(),enableAutoColor:v().optional(),enableAlphaColor:v().optional(),hideVisibleToggle:v().optional(),hideSize:v().optional(),defaults:Pt.optional()}).strict(),zt=p({type:E(w.COLOR_PICKER),color:le.optional()}).strict(),Cp=p({type:E(w.COLOR_PICKER),fieldName:h(),defaults:zt.optional()}).strict(),us=p({type:E(w.COLOR_PICKER),label:y,description:y.optional(),colors:A(le).optional(),enableAlphaColor:v().optional(),enableAutoColor:v().optional(),defaults:zt.optional()}).strict(),jt=p({type:E(w.DIVIDER)}).strict(),Rp=p({type:E(w.DIVIDER),fieldName:h(),defaults:jt.optional()}).strict(),ls=p({type:E(w.DIVIDER),label:y,defaults:jt.optional()}).strict(),Ut=p({type:E(w.IMAGE),overlay:Ld.optional(),color:zr.optional(),visible:v().optional()}).strict().superRefine((e,t)=>{const n=x(t).at("color");e.overlay===nt.GRADIENT?e.color===void 0?n.addIssue("COLOR_REQUIRED_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&n.addIssue("COLOR_ARRAY_LENGTH_GRADIENT"):n.addIssue("COLOR_MUST_BE_ARRAY_GRADIENT"):e.overlay===nt.COLOR?e.color===void 0?n.addIssue("COLOR_REQUIRED_COLOR"):Array.isArray(e.color)&&n.addIssue("COLOR_MUST_BE_SINGLE_COLOR"):(e.overlay===nt.NONE||e.overlay===void 0)&&e.color!==void 0&&n.addIssue("COLOR_MUST_BE_UNDEFINED_NONE")}),bp=p({type:E(w.IMAGE),fieldName:h(),defaults:Ut.optional()}).strict(),ds=p({type:E(w.IMAGE),label:y,static:v().optional(),colors:A(Pr).optional(),enableAlphaColor:v().optional(),hideVisibleToggle:v().optional(),defaults:Ut.optional()}).strict(),Ap=p({label:y,link:Lt}).strict(),Np=p({label:y.optional(),link:Lt.optional()}).strict(),Mt=p({type:E(w.INFO),description:y.optional(),button:Np.optional()}).strict(),$p=p({type:E(w.INFO),fieldName:h(),defaults:Mt.optional()}).strict(),ps=p({type:E(w.INFO),label:y,description:y,button:Ap.optional(),defaults:Mt.optional()}).strict(),Lp=p({visible:v(),width:Re(1,49).optional(),color:le.optional()}).strict(),Ft=p({type:E(w.LOGO),font:bn.optional(),size:jr.optional(),bold:v().optional(),italic:v().optional(),color:le.optional(),visible:v().optional(),spacing:Re(1,9).optional(),frame:Lp.optional(),capitalization:U(["none","all","small"]).optional()}).strict(),Dp=p({type:E(w.LOGO),fieldName:h(),defaults:Ft.optional()}).strict(),fs=p({type:E(w.LOGO),label:y,colors:A(le).optional(),sizes:A(he().min(1,{message:"must be at least 1"})).optional(),defaults:Ft.optional()}).strict(),kp=p({value:h().optional(),label:y.optional()}).strict(),Gt=p({type:E(w.SELECTBOX),value:h().optional()}).strict(),Pp=p({type:E(w.SELECTBOX),fieldName:h(),defaults:Gt.optional()}).strict(),hs=p({type:E(w.SELECTBOX),label:y,description:y.optional(),options:A(kp).optional(),defaults:Gt.optional()}).strict(),xt=p({type:E(w.TEXT),font:bn.optional(),size:jr.optional(),bold:v().optional(),italic:v().optional(),color:le.optional(),visible:v().optional()}).strict(),zp=p({type:E(w.TEXT),fieldName:h(),defaults:xt.optional()}).strict(),ms=p({type:E(w.TEXT),label:y,colors:A(Pr).optional(),sizes:A(he().min(1,{message:"must be at least 1"})).optional(),enableAlphaColor:v().optional(),enableAutoColor:v().optional(),hideVisibleToggle:v().optional(),hideSize:v().optional(),defaults:xt.optional()}).strict(),Bt=p({type:E(w.TOGGLE),enabled:v().optional()}).strict(),jp=p({type:E(w.TOGGLE),fieldName:h(),defaults:Bt.optional()}).strict(),Es=p({type:E(w.TOGGLE),label:y,defaults:Bt.optional()}).strict();function Up(e,t){Object.keys(e).length===0&&t.at("items").addIssue("ACCORDION_SHOWCASE_ITEMS_REQUIRED")}function Mp(e,t){for(const[n,o]of Object.entries(e))Object.keys(o.editors).length===0&&t.at(["items",n,"editors"]).addIssue("ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED",n)}function Fp(e,t,n){Object.keys(e).length===0&&n.at("editors").addIssue("ACCORDION_ITEM_EDITORS_REQUIRED",t)}function Gp(e,t){Object.keys(e).length===0&&t.at("items").addIssue("ACCORDION_ITEMS_REQUIRED")}function xp(e,t){for(const[n,o]of Object.entries(e))o.positionFieldName||t.at(["items",n,"positionFieldName"]).addIssue("ACCORDION_ITEM_POSITION_FIELD_REQUIRED",n)}function Bp(e,t){const n=Object.values(e).map(o=>o.positionFieldName).filter(Boolean);new Set(n).size!==n.length&&t.at("items").addIssue("ACCORDION_DUPLICATE_POSITION_FIELD_NAME")}const gs=p({type:E(w.ACCORDION)}).strict(),Zp=q("type",[xt,Pt,Ut,Bt,Gt,kt,zt,Ft,jt,Mt]),Hp=p({editors:Z(h(),Zp)}).strict(),Vp=p({type:E(w.ACCORDION),items:Z(h(),Hp)}).strict().superRefine((e,t)=>{const n=x(t);Up(e.items,n),Mp(e.items,n)}),Wp=p({type:E(w.ACCORDION),fieldName:h(),defaults:gs.optional()}).strict(),Yp=q("type",[ms,cs,ds,Es,hs,as,us,fs,ls,ps]),Kp=p({label:y,positionFieldName:h().optional(),editors:Z(h(),Yp)}).strict().superRefine((e,t)=>{Fp(e.editors,e.label,x(t))}),Jp=p({type:E(w.ACCORDION),sortable:v().optional(),items:Z(h(),Kp),defaults:gs.optional()}).strict().superRefine((e,t)=>{const n=x(t);Gp(e.items,n),e.sortable===!0&&(xp(e.items,n),Bp(e.items,n))}),_s=q("type",[Pn,Un,$n,An,Mn,jn,ss,is,os,Dn,kn,gp,zn,Ln]),ys=q("type",[xt,Pt,Ut,Bt,Gt,kt,zt,Ft,jt,Vp,Mt]),Xp=p({showcaseId:h(),blockName:h(),previewImage:Dt,content:Z(h(),_s),design:Z(h(),ys),layoutId:h().optional()}).strict(),Qp=p({blockName:h(),content:Z(h(),_s).optional(),design:Z(h(),ys).optional(),layoutId:h().optional()}).strict();function qp(e,t){Nn(e.type)&&(e.sections.length!==1?t.at("sections").addIssue("TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED",e.type):e.sections[0]?.type!=="store"&&t.at(["sections",0,"type"]).addIssue("TEMPLATE_PAGE_STORE_SECTION_REQUIRED",e.type))}function ef(e,t){Nn(e.type)&&e.sections.length===0&&t.at("sections").addIssue("TEMPLATE_PAGE_SECTIONS_REQUIRED"),e.sections.forEach((n,o)=>{Nn(e.type)||n.type==="store"&&t.at(["sections",o,"type"]).addIssue("TEMPLATE_PAGE_NO_STORE_SECTIONS",e.type),n.type==="default"&&n.id&&(n.id==="header"||n.id==="footer")&&t.at(["sections",o,"id"]).addIssue("REQUIRED_PAGE_SECTION_TYPE")})}function tf(e,t){e.type==="CUSTOM"?e.metadata||t.at("metadata").addIssue("TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED"):e.metadata!==void 0&&t.at("metadata").addIssue("TEMPLATE_PAGE_METADATA_NOT_ALLOWED",e.type)}const nf=new RegExp(`^(${Object.values(tp).join("|")})(_\\d{3})?$`),of=h().regex(nf,"id must match pattern: [default_section_name] or [default_section_name]_XXX where XXX is three digits"),rf=h().regex(new RegExp("\\d{3}"),"showcase_id must be a three digit string"),Ss=p({type:E("default"),id:of,showcase_id:rf.optional()}).strict(),Fn=p({type:E("custom"),id:h(),showcase_id:h().optional(),showcase_overrides:Qp.optional(),category:op.optional()}).strict(),sf=p({type:E("store"),id:h().optional()}).strict(),af=q("type",[Ss,Fn,sf]),cf=p({title:h()}).strict(),uf=p({metadata:cf.optional(),sections:A(af)}).strict(),lf=uf.safeExtend({type:Qd,id:h().min(1,{message:"id is required"})}).strict().superRefine((e,t)=>{const n=x(t);ef(e,n),qp(e,n),tf(e,n)}),Ts=p({name:h().min(2,{message:"name must be at least 2 characters"}).max(60,{message:"name must be at most 60 characters"}),description:h().min(2,{message:"description must be at least 2 characters"}).max(150,{message:"description must be at most 150 characters"}),preview_url:Er({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:Dt,categories:A(Wd).refine(e=>new Set(e).size===e.length,{message:"categories must contain unique items"}).optional()}).strict(),df=Ss.extend({id:h()}),Os=q("type",[df,Fn]),pf=p({metadata:Ts,header:Os,footer:Os}).strict(),ff=p({id:h().min(1,{message:"id is required"}),assets:Rn.array().optional(),configuration:pf,pages:A(lf)}).strict(),Zt=2097152,Ht=512e3;function Te(e,t=2){if(!+e)return"0 Bytes";const n=1024,o=t<0?0:t,r=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],s=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/n**s).toFixed(o))} ${r[s]}`}const hf={menu:{type:g.NAVIGATION_MENU},logo:{type:g.LOGO}},mf={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 Is(e){switch(e){case Ae.HEADER:return hf;default:return{}}}function ws(e){switch(e){case Ae.HEADER:return mf;default:return{}}}function vs({validationType:e,sectionType:t}){switch(e){case ot.CONTENT:return Is(t);case ot.DESIGN:return ws(t);default:return{}}}const Ef=Fn.extend({id:h().min(1,{message:"section id is required"})}),gf=p({metadata:Ts,sections:A(Ef).min(1,{message:"sections must contain at least one section"}).max(20,{message:"sections must contain at most 20 sections"})}).strict().superRefine((e,t)=>{e.metadata.name.trim().length===0&&x(t).at(["collection","metadata","name"]).addIssue("REQUIRED_COLLECTION_NAME")}),_f=p({id:h().min(1,{message:"id is required"}),descriptor:gf}).strict(),yf=q("type",[Kr,Qr,Hr,Ur,qr,Xr,Sp,Op,Ip,Tp,Wr,Yr,Jr,Vr]),Gn=Z(h(),yf),Sf=q("type",[ms,cs,ds,Es,hs,as,us,fs,ls,Jp,ps]),xn=Z(h(),Sf),Tf=q("type",[zp,vp,bp,jp,Pp,wp,Cp,Dp,Rp,$p,Wp]),Bn=p({layoutId:h(),layoutIcon:ep.optional(),selectedContentSettings:A(h()),selectedDesignSettings:A(Tf)}).strict(),Of=h().regex(rp,X.VALID_LANGUAGE_CODE()),Vt=Z(Of,Z(y,h()));function Cs(e,t,n){if(!e||Object.keys(t).length===0)return;const o=Object.entries(t),r=o.map(([,{type:i}])=>i),s=Object.values(e).map(({type:i})=>i);Object.entries(e).forEach(([i,a])=>{const c=t[i];c&&"type"in c&&a.type!==c.type&&n.at(i).addIssue("MANDATORY_SETTING_TYPE_MISMATCH",a.type,i,c.type)}),Object.entries(e).forEach(([i,a])=>{const c=o.find(([,{type:u}])=>u===a.type)?.[0];c&&i!==c&&n.at(i).addIssue("MANDATORY_SETTING_NAME_MISMATCH",i,a.type,c)}),new Set(s.filter(i=>r.includes(i))).forEach(i=>{if(s.filter(a=>a===i).length>1){const a=o.findLast(([,{type:c}])=>c===i)?.[0];n.at(a).addIssue("DUPLICATED_MANDATORY_SETTING",i)}})}function Rs(e,t,n){Mr(e,t,n)}function bs(e,t,n){if(e.type!==g.DECK||t.type!==g.DECK)return;const o=t.cards?.defaultCardContent?.settings,r=e.cards;!o||!Array.isArray(r)||r.forEach((s,i)=>{s.settings&&Object.entries(s.settings).forEach(([a,c])=>{const u=o[a],d=n.at(["cards",i,"settings",a]);if(!u){d.addIssue("INVALID_DECK_CARD_SETTING",a);return}if(c.type!==u.type){d.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",a,c.type,u.type);return}c.type===g.DECK&&u.type===g.DECK&&bs(c,u,d)})})}function If(e,t,n){e.content&&Object.entries(e.content).forEach(([o,r])=>{const s=n.at(["content",o]),i=t[o];if(!i){s.addIssue("INVALID_SHOWCASE_CONTENT_ELEMENT",o);return}if(r.type!==i.type){s.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",o,r.type,i.type);return}if(r.type===g.SELECTBOX&&i.type===g.SELECTBOX){const a=i,c=r;a.options&&c.value!==void 0&&(new Set(a.options.map(u=>u.value)).has(c.value)||s.addIssue("INVALID_SELECTBOX_OPTION",c.value,o))}r.type===g.DECK&&bs(r,i,s)})}function wf(e,t,n){e.design&&Object.entries(e.design).forEach(([o,r])=>{const s=n.at(["design",o]),i=t[o];if(!i){s.addIssue("INVALID_SHOWCASE_DESIGN_ELEMENT",o);return}r.type!==i.type&&s.addIssue("SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH",o,r.type,i.type)})}function vf(e,t){Object.entries(e).flatMap(([n,o])=>{switch(o.type){case w.ACCORDION:return Object.entries(o.items).flatMap(([r,s])=>Object.keys(s.editors).map(i=>({name:i,path:[n,"items",r,"editors",i]})));default:return[{name:n,path:[n]}]}}).filter(({name:n},o,r)=>r.findIndex(s=>s.name===n)<o).forEach(({path:n})=>t.at(n).addIssue("DUPLICATE_DESIGN_EDITOR_NAME"))}function Cf(e,t,n){e.layoutId&&((t||[]).some(o=>o.layoutId===e.layoutId)||n.at("layoutId").addIssue("SHOWCASE_LAYOUT",e.layoutId))}function Rf(e,t){const n=new Set;e.forEach((o,r)=>{if(n.has(o.showcaseId)){t.at([r,"showcaseId"]).addIssue("DUPLICATE_SHOWCASE_ID",o.showcaseId);return}n.add(o.showcaseId)})}function As(e,t,n){for(const[o,r]of Object.entries(e)){const s=r;if(s.type===g.IMAGE){const i=t[o];if(i?.type===w.IMAGE){const a=s.static??!1,c=i.static??!1;a!==c&&n.at(o).addIssue("IMAGE_EDITOR_STATIC_MISMATCH",o)}}else if(s.type===g.DECK){const i=s;i.cards?.defaultCardContent?.settings&&As(i.cards.defaultCardContent.settings,t,n.at([o,"cards","defaultCardContent","settings"]))}}}function bf(e,t,n){t>Zt&&n.at(z.basename(e)).addIssue("REQUIRED_SECTION_ASSET",Te(t),Te(Zt))}function Af(e,t){e>Ht&&t.addIssue("REQUIRED_SERVER_SIZE",Te(e),Te(Ht))}const Nf=p({id:h(),type:Fd,name:h(),content:Gn,design:xn,layout:A(Bn).optional(),showcase:A(Xp),translationsSettings:Vt.optional(),translationsShowcases:Vt.optional(),assets:Rn.array().optional(),server:kr,previewCount:he().optional()}).strict().superRefine((e,t)=>{const n=x(t),o=vs({validationType:ot.CONTENT,sectionType:e.type}),r=vs({validationType:ot.DESIGN,sectionType:e.type});Cs(e.content,o,n.at("content")),Cs(e.design,r,n.at("design")),As(e.content,e.design,n.at("content")),vf(e.design,n.at("design")),e.assets&&e.assets.forEach(i=>{bf(i.path,i.size,n.at("assets"))}),Af(e.server.size,n.at("server"));const s=e.assets?.map(i=>i.path)??[];Rs(e.content,s,n.at("content")),Rf(e.showcase,n.at("showcase")),e.showcase.forEach((i,a)=>{const c=n.at(["showcase",a]);Rs(i,s,c),If(i,e.content,c),wf(i,e.design,c),Cf(i,e.layout,c)})}),$f=p({translations:Vt.optional()}).strict(),Lf=U(["products","category","product"]),Df=p({id:h(),sectionId:h(),assets:Rn.array().optional(),content:Gn.optional(),design:xn.optional(),translationsSettings:Vt.optional(),layouts:Bn.array().optional()}).strict().superRefine((e,t)=>{const n=x(t);rt.safeParse(e.sectionId).success||n.at(["sectionId"]).addIssue("INVALID_STORE_SECTION_ID",e.sectionId,rt.options.join(", ")),e.assets&&e.assets.forEach(o=>{o.size>Zt&&n.at(["assets",z.basename(o.path)]).addIssue("REQUIRED_SECTION_ASSET",Te(o.size),Te(Zt))})});p({id:h(),sectionId:rt,pageId:Lf,content:Gn.optional(),design:xn.optional(),layouts:Bn.array().optional()}).strict();const kf=p({id:h(),sectionId:h(),layoutId:h(),server:kr}).strict().superRefine((e,t)=>{const n=x(t);rt.safeParse(e.sectionId).success||n.at(["sectionId"]).addIssue("INVALID_STORE_SECTION_ID",e.sectionId,rt.options.join(", ")),e.server.size>Ht&&n.at("server").addIssue("REQUIRED_SERVER_SIZE",Te(e.server.size),Te(Ht))});function Pf(e,t,n){if(e){if(e.type==="default")e.id!=="header"&&n.at("id").addIssue("REQUIRED_HEADER_ID");else if(e.type==="custom"&&e.id){const o=t.find(r=>r.id===e.id);o?(o.type!=="HEADER"&&n.at("id").addIssue("REQUIRED_CUSTOM_HEADER_TYPE",e.id),e.showcase_id&&((o.showcase||[]).some(r=>r.showcaseId===e.showcase_id)||n.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):n.at("id").addIssue("REQUIRED_CUSTOM_HEADER",e.id)}}}function zf(e,t,n){if(e){if(e.type==="default")e.id!=="footer"&&n.at("id").addIssue("REQUIRED_FOOTER_ID");else if(e.type==="custom"&&e.id){const o=t.find(r=>r.id===e.id);o?(o.type!=="FOOTER"&&n.at("id").addIssue("REQUIRED_CUSTOM_FOOTER_TYPE",e.id),e.showcase_id&&((o.showcase||[]).some(r=>r.showcaseId===e.showcase_id)||n.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):n.at("id").addIssue("REQUIRED_CUSTOM_FOOTER",e.id)}}}function jf(e,t,n){if(!e)return;const o=n.at(["showcase_overrides"]);["content","design"].forEach(s=>{const i=e[s];if(i){const a=t[s]||{};Object.keys(i).forEach(c=>{if(!(c in a)){const u=s==="content"?"SHOWCASE_OVERRIDE_CONTENT":"SHOWCASE_OVERRIDE_DESIGN";o.at([s,c]).addIssue(u,c)}})}}),e.layoutId&&((t.layout||[]).some(s=>s.layoutId===e.layoutId)||o.at(["layoutId"]).addIssue("SHOWCASE_OVERRIDE_LAYOUT",e.layoutId));const r=t.assets?.map(s=>s.path)??[];e.content&&Mr(e.content,r,o.at(["content"]))}function Ns(e,t,n,o=!1){if(!e.id)return;const r=t.find(s=>s.id===e.id);if(!r){n.at("id").addIssue("REQUIRED_PAGE_SECTION",e.id);return}!o&&(r.type==="HEADER"||r.type==="FOOTER")&&n.at("id").addIssue("REQUIRED_PAGE_SECTION_TYPE"),jf(e.showcase_overrides,r,n),e.showcase_id&&((r.showcase||[]).some(s=>s.showcaseId===e.showcase_id)||n.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))}function Uf(e,t,n,o){e.id&&(n.some(r=>r.sectionId===t.type.toLowerCase()&&r.id===e.id)||o.at("id").addIssue("REQUIRED_STORE_LAYOUT",e.id,t.type.toLowerCase()))}const Mf=p({version:h(),name:h(),shared:$f.optional(),sections:A(Nf),templates:A(ff),layouts:A(Df),slots:A(kf),collections:A(_f),compressionEnabled:v(),externalizationEnabled:v(),vueVersion:h(),openSource:v().optional()}).strict().superRefine((e,t)=>{e.templates.forEach((n,o)=>{const r=x(t).at(["templates",o]);Pf(n.configuration.header,e.sections,r.at(["configuration","header"])),zf(n.configuration.footer,e.sections,r.at(["configuration","footer"])),n.pages.forEach((s,i)=>{const a=r.at(["pages",i]);s.sections.forEach((c,u)=>{const d=a.at(["sections",u]);c.type==="custom"?Ns(c,e.sections,d):c.type==="store"&&Uf(c,s,e.layouts,d)})})}),e.collections.forEach((n,o)=>{n.descriptor.sections.forEach((r,s)=>{const i=x(t).at(["collections",o,"sections",s]);Ns(r,e.sections,i,!0)})})});_e({customError:Xd});const f={error:e=>console.log(bi(e)),warn:e=>console.log(Ri(e)),info:e=>console.log(ce(e))},Ff="dist",Gf="dist/shared",me="dist/sections",Zn="dist/headers",Hn="dist/footers",Oe="dist/templates",Ze="layouts",$s="preview",Q=`dist/${Ze}`,it="dist/collections",Ls="dist/manifest.json",xf=[me,Zn,Hn,Oe,Q];function Wt(e){return!!e}function $e(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const Bf="Resource name can only contain alphanumeric characters, dashes, and underscores";function Zf(e){if(typeof e=="string"||typeof e=="number"){const t=/^[a-zA-Z0-9_-]+$/.test(e.toString());if(t)return{isValid:t,errorMessage:null}}return{isValid:!1,errorMessage:Bf}}function Hf(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}function Vf(e){return z.parse(e).name}function Wf(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}async function Yt(){const e=await pn(T(process.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function Yf(e){return e.includes(`
40
- `)}function Kf(e,t,n){return e.split(`
41
- `).map((o,r)=>r>=n?t+o:o).join(`
42
- `)}function Le(e,t){const n=[];if(e instanceof yo){e.response?.status!==void 0&&n.push(` HTTP Status Code: ${e.response.status}`);const s=e.response?.data;if(s?.errorCode&&n.push(` Error Code: ${s.errorCode}`),s?.errorMessage){const i=Yf(s.errorMessage)?Kf(s.errorMessage," ",1):s.errorMessage;n.push(` Error Message: ${i}`)}}const o=n.length>0?n.join(`
43
- `):e?.message??"Unknown error";if(!t||t.length===0)return o;const r=n.length>0?`
44
- `:" ";return`${t}${r}${o}`}function Vn(e,t){return Object.keys(e).reduce((n,o)=>{const r=e[o],s=t[o];return $e(r)&&$e(s)?n[o]=Vn(r,s):n[o]=r,n},{...t})}function Jf({contentSettings:e,sectionType:t}){const n=Is(t);return Vn(e,n)}function Xf({designSettings:e,sectionType:t}){const n=ws(t);return Vn(e,n)}async function re(e){return(await import(_o(e).href+`?t=${Date.now()}`)).default}function Wn(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function de(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Pi(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Ds(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 Qf(e){if(e!==void 0)return{...e,color:de(e.color)}}function De(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function qf(e){if(e!==void 0)switch(e){case Cn.COLOR:return"solid";case Cn.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Cn)}`)}}function eh({style:e,color:t}){const n=Array.isArray(t)?t:[t,t];return{background:{type:qf(e),solid:{color:de(n.at(0))},gradient:{fromColor:de(n.at(0)),toColor:de(n.at(1))}}}}function th(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(kd)}`)}}function nh(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(zd)}`)}}function oh(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(Ud)}`)}}function rh(e){return e===At.GO_TO_STORE?At.GO_TO_STORE_LINK:e===At.GO_TO_CATEGORY?At.GO_TO_CATEGORY_LINK:e}function sh(e){const t=th(e.appearance),n=nh(e.size),o=oh(e.shape),r=Wn(e.font),s=de(e.color),i=e.visible;return De({appearance:t,size:n,style:o,font:r,color:s,visible:i})}function ih(e){return{...e,buttonType:rh(e.buttonType)}}function ah(e){const t=de(e.color);return De({color:t})}function ch(e){if(e!==void 0)switch(e){case Nt.COLOR:return"solid";case Nt.GRADIENT:return"gradient";case Nt.NONE:return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(Nt)}`)}}function uh(e){const t=e.color,n=Array.isArray(t)?t:[t,t],o=e.visible,r={type:ch(e.overlay),solid:{color:de(n.at(0))},gradient:{fromColor:de(n.at(0)),toColor:de(n.at(1))}};return De({overlay:r,visible:o})}function lh(e){const t=Wn(e.font),n=de(e.color),o=Ds(e.size),r=e.bold,s=e.italic,i=e.spacing,a=e.capitalization,c=e.visible;return De({font:t,color:n,size:o,frame:Qf(e.frame),bold:r,italic:s,spacing:i,capitalization:a,visible:c})}function dh(e){const t=e.value;return De({value:t})}function ph(e){const t=Wn(e.font),n=de(e.color),o=Ds(e.size),r=e.bold,s=e.italic,i=e.visible;return De({font:t,color:n,size:o,bold:r,italic:s,visible:i})}function fh(e){const t=e.enabled;return De({enabled:t})}function hh(e){return e===gt.GO_TO_STORE_LINK?gt.GO_TO_STORE:e===gt.GO_TO_CATEGORY_LINK?gt.GO_TO_CATEGORY:e}function ks(e){return e.map(t=>t.type?{...t,type:hh(t.type)}:t)}function mh(e){return e.items?{...e,items:ks(e.items)}:e}function Eh(e){return e.items?{...e,items:ks(e.items)}:e}function gh(e){if(!e.cards)return e;const t=e.cards.map(n=>{if(!n.settings)return n;const o={};return Object.keys(n.settings).forEach(r=>{const s=n.settings[r],i=s.type,a=Kt(i,{defaults:s});a&&s?o[r]={...s,...a}:o[r]=s}),{...n,settings:o}});return{...e,cards:t}}function Yn(e,t){if(t.defaults===void 0)return;let n={};switch(e){case te.TEXT:{n=ph(t.defaults);break}case te.BUTTON:{n=sh(t.defaults);break}case te.IMAGE:{n=uh(t.defaults);break}case te.BACKGROUND:{n=eh(t.defaults);break}case te.COLOR_PICKER:{n=ah(t.defaults);break}case te.LOGO:{n=lh(t.defaults);break}case te.SELECTBOX:{n=dh(t.defaults);break}case te.TOGGLE:{n=fh(t.defaults);break}case te.DIVIDER:case te.INFO:break;case te.ACCORDION:return t.defaults;default:throw new Error(`Unknown design editor type: ${e}`)}return n}function Ps(e){const t={};return Object.keys(e).forEach(n=>{const o=e[n],r=o.type;if(r===te.ACCORDION){const i=Object.fromEntries(Object.entries(o.items).map(([a,c])=>[a,{...c,editors:Ps(c.editors)}]));t[n]={...o,items:i};return}const s=Yn(r,o);s&&o.defaults?t[n]={...o,defaults:s}:t[n]=o}),t}function _h(e){return e===void 0?e:e.map(t=>{if(t.type!==void 0&&t.defaults!==void 0&&t.fieldName!==void 0){const n={...Yn(t.type,t)??t.defaults,type:t.defaults.type??t.type};return{type:t.type,fieldName:t.fieldName,defaults:n}}return t})}function Kn(e){if(e===void 0)return;const t={};return Object.keys(e).forEach(n=>{const o=e[n],r=o.type;if(r===te.ACCORDION){const i=Object.fromEntries(Object.entries(o.items).map(([a,c])=>[a,{...c,editors:Kn(c.editors)??c.editors}]));t[n]={type:o.type,items:i};return}const s=Yn(r,{defaults:o});s!==void 0?t[n]={...o,...s,type:o.type}:t[n]=o}),t}function Kt(e,t){if(t.defaults!==void 0)switch(e){case g.BUTTON:return ih(t.defaults);case g.MENU:return mh(t.defaults);case g.NAVIGATION_MENU:return Eh(t.defaults);case g.DECK:return gh(t.defaults);case g.CATEGORY_SELECTOR:case g.DIVIDER:case g.IMAGE:case g.INPUTBOX:case g.INFO:case g.LOGO:case g.PRODUCT_SELECTOR:case g.SELECTBOX:case g.TEXTAREA:case g.TOGGLE:return{...t.defaults};default:throw new Error(`Unknown content editor type: ${e}`)}}function yh(e){const t={};return Object.keys(e).forEach(n=>{const o=e[n],r=o.type;if(r===g.DECK)t[n]=zs(o);else{const s=Kt(r,o);s&&o.defaults?t[n]={...o,defaults:s}:t[n]=o}}),t}function zs(e){const t=e.cards.defaultCardContent.settings,n=yh(t);return{...e,cards:{...e.cards,defaultCardContent:{...e.cards.defaultCardContent,settings:n}}}}function Sh(e){const t={};return Object.keys(e).forEach(n=>{const o=e[n],r=o.type;if(r===g.DECK)t[n]=zs(o);else{const s=Kt(r,o);s&&o.defaults?t[n]={...o,defaults:s}:t[n]=o}}),t}function Th(e){if(e===void 0)return;const t={};return Object.keys(e).forEach(n=>{const o=e[n],r=o.type,s=Kt(r,{defaults:o});s!==void 0?t[n]={...o,...s,type:o.type}:t[n]=o}),t}function Oh(e,t){if(!t)return;const n=e[t];return n===void 0?{en:t}:n}function Ih(e){const t={};for(const n in e){const o=e[n];for(const r in o){const s=t[r],i=o[r];if(s===void 0){const a={};a[n]=i,t[r]=a}else s[n]=i}}return t}function wh(e){return e.every(t=>t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean")}function He(e,t){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return wh(e)?e:e.map(r=>He(r,t));const n=e,o={};for(const r in n){const s=n[r];typeof s=="string"&&s.startsWith("$")?o[r]=Oh(t,s):typeof s=="object"&&s!==null?o[r]=He(s,t):o[r]=s}return o}async function at(e){return e?Ih(e):{}}async function vh(e,t=me){const n=T(process.cwd(),`${t}/${e}/js/settings/translations.mjs`);return await re(n)}async function Jt(e,t=me){const n=T(process.cwd(),`${t}/${e}/js/showcases/translations.mjs`);return await re(n)}async function Ch(e,t){const n=T(process.cwd(),`${Q}/${t}/${e}/js/settings/translations.mjs`);if(V(n))return await re(n)}async function Jn(e,t,n){const o=n?Jf({contentSettings:e,sectionType:n}):e,r=Sh(o);return He(r,t)}async function Rh(e,t=me){try{const n=T(M.cwd(),`${t}/${e}/js/settings/content.mjs`),o=await re(n);return Be(o)}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Xn(e,t,n){const o=n?Xf({designSettings:e,sectionType:n}):e,r=Ps(o);return He(r,t)}async function bh(e,t=me){try{const n=T(M.cwd(),`${t}/${e}/js/settings/design.mjs`),o=await re(n);return Be(o)}catch(n){const o=n;throw new Error(`Design settings is invalid or undefined. Error ${o.stack}`)}}async function Ah(e,t){return Promise.all(e.map(async n=>{const o=n.content?Th(n.content):void 0,r=n.design?Kn(n.design):void 0,s={...n,content:o??n.content,design:r??n.design};return He(s,t)}))}async function Nh(e,t=me){try{const n=await I("*.mjs",{cwd:T(M.cwd(),`${t}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(n.map(async o=>{const r=T(M.cwd(),`${t}/${e}/js/showcases/${o}`);return await re(r)}))}catch(n){throw new Error(`Showcases is invalid or undefined. Error ${n}`)}}async function js(e){return e?.map(t=>({...t,selectedDesignSettings:_h(t.selectedDesignSettings)??t.selectedDesignSettings}))??[]}async function $h(e,t=me){try{const n=T(M.cwd(),`${t}/${e}/js/settings/layout.mjs`);return V(n)?await re(n):[]}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}function Lh(e){let t={};const n=T(M.cwd(),`${$s}/shared/analytics.json`);if(!V(n))return 0;try{const o=cn(n,"utf-8");t=JSON.parse(o)}catch(o){console.warn("Error processing analytics.json file",o)}return t[e]||0}const Ve={Server:0,Client:1,SectionAsset:4,PageTemplateDescriptor:6,TemplateAsset:7,SharedTranslation:13},Qn="https://blockbuster.ecwid.com",Dh="/api/v1/custom-apps/resources/sections/upload",kh="/api/v1/custom-apps/resources/templates/upload",Ph="/api/v1/custom-apps/manifests/sections",zh="/api/v1/custom-apps/manifests/templates",jh=5,Uh=3,Mh=[R.Server,R.Client,R.ClientChunks,R.ClientAsset,R.Asset],Fh=[R.LayoutClient,R.LayoutAsset],Gh=[R.SlotServer,R.SlotClient,R.SlotClientChunks,R.SlotClientAsset],xh=[R.Dependency,R.TemplateAsset,R.SourceCode,R.CollectionAsset],We={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.`},Us={catalog:"products",category:"category",product:"product"},Ms=e=>Us[e],Fs=e=>e in Us;function Bh(e){return e.replace(/\\/g,"/")}function Zh(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function Xt(e){return Zh(Bh(e))}function Hh(e){const t=Xt(e).split("/");if(t.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[n,o]=t;if(!Fs(n))throw new Error(`Layout cannot be placed in a non-storefront section: ${n}`);const r=Ms(n);return{id:o,sectionId:n,pageId:r}}async function Vh(e){return Promise.all(e.map(async t=>{const n=t.sectionId,o=Ms(n),r=await at(t.translationsSettings),s=await Jn(t.content??{},r),i=await Xn(t.design??{},r),a=await js(t.layouts);return{id:t.id,sectionId:n,pageId:o,contentEditors:s,designEditors:i,layouts:a}}))}function Ye(e,t,...n){if(!e||!t)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${t}"`);return`${Q}/${e}/${t}/${n.join("/")}`}const ct=(e=Se.SECTION)=>G[e].dist,ut={[R.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:t})=>`${ct(t)}/${e}/js/main/server/`},[R.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ct(t)}/${e}/js/main/client/`},[R.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ct(t)}/${e}/js/main/client/chunks/`,fileName:"*"},[R.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ct(t)}/${e}/js/main/client/assets/`},[R.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ct(t)}/${e}/assets/`},[R.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${Oe}/assets/`},[R.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[R.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[R.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:t})=>Ye(e,t,"")},[R.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t})=>Ye(e,t,"assets/")},[R.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ye(e,t,"slots",n,"js/main/server/")},[R.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ye(e,t,"slots",n,"js/main/client/")},[R.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ye(e,t,"slots",n,"js/main/client/chunks/")},[R.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ye(e,t,"slots",n,"js/main/client/assets/")},[R.CollectionAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${it}/assets/`}};function Wh(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function qn(){const e=T(Et.cwd(),"package.json"),t=await pn(e),n=JSON.parse(t.toString());if(Wh(n))return n;throw new Error(`Package file located at path: ${e} does not contain a version field`)}const Yh={layout:e=>e.layoutId,showcase:e=>e.showcaseId,templates:e=>{const t=e.id;return t?.includes("_")?t.substring(t.indexOf("_")+1):t}};function Kh(e,t){const n=Yh[e];return n?n(t):t.id}const Jh=new Set(["content","design"]);function Qt(e,t,n=0,o=[]){if(n>=t.length)return o;const r=t[n],s=t[n+1];if(typeof r=="string"&&typeof s=="number"&&$e(e)){const i=e[r],a=Array.isArray(i)?i[s]:void 0;if($e(a)){const c=Kh(r,a);return o.push(`${r}[${c||s}]`),Qt(a,t,n+2,o)}}if(typeof r=="string"&&typeof s=="string"&&Jh.has(r)){o.push(`${r}[${s}]`);const i=$e(e)&&!Array.isArray(e)?e[r]:void 0,a=$e(i)&&!Array.isArray(i)?i[s]:void 0;return Qt(a,t,n+2,o)}return o.push(r),Qt($e(e)?e[r]:void 0,t,n+1,o)}function Xh(e){const t=e.errors.map(o=>Qt(e.manifest,o.path).join(".")),n={path:Math.max(...t.map(o=>o.length),0),message:Math.max(...e.errors.map(o=>o.message.length),0)};e.errors.map((o,r)=>{const s=o.params?.errorMessageKey||"GENERAL_ISSUE";return`${t[r].padEnd(n.path," ")} | ${o.message.padEnd(n.message," ")} | ${s}`}).forEach(o=>f.error(o))}async function Qh(e){const t=Mf.safeParse(e);return{manifest:e,errors:t.success?[]:t.error.issues}}const qh=`Build successful:
39
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const f=h[1];if(s===h[0]){u(h);continue}if(e.external){const T=e.external.registry.get(h[0])?.id;if(s!==h[0]&&T){u(h);continue}}if(e.metadataRegistry.get(h[0])?.id){u(h);continue}if(f.cycle){u(h);continue}if(f.count>1&&e.reused==="ref"){u(h);continue}}}function Vo(e,s){const i=e.seen.get(s);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const f=e.seen.get(h);if(f.ref===null)return;const y=f.def??f.schema,T={...y},x=f.ref;if(f.ref=null,x){a(x);const L=e.seen.get(x),R=L.schema;if(R.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(y.allOf=y.allOf??[],y.allOf.push(R)):Object.assign(y,R),Object.assign(y,T),h._zod.parent===x)for(const ce in y)ce==="$ref"||ce==="allOf"||ce in T||delete y[ce];if(R.$ref&&L.def)for(const ce in y)ce==="$ref"||ce==="allOf"||ce in L.def&&JSON.stringify(y[ce])===JSON.stringify(L.def[ce])&&delete y[ce]}const P=h._zod.parent;if(P&&P!==x){a(P);const L=e.seen.get(P);if(L?.schema.$ref&&(y.$ref=L.schema.$ref,L.def))for(const R in y)R==="$ref"||R==="allOf"||R in L.def&&JSON.stringify(y[R])===JSON.stringify(L.def[R])&&delete y[R]}e.override({zodSchema:h,jsonSchema:y,path:f.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const c={};if(e.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?c.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?c.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const h=e.external.registry.get(s)?.id;if(!h)throw new Error("Schema is missing an `id` property");c.$id=e.external.uri(h)}Object.assign(c,i.def??i.schema);const u=e.external?.defs??{};for(const h of e.seen.entries()){const f=h[1];f.def&&f.defId&&(u[f.defId]=f.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{const h=JSON.parse(JSON.stringify(c));return Object.defineProperty(h,"~standard",{value:{...s["~standard"],jsonSchema:{input:ui(s,"input",e.processors),output:ui(s,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Me(e,s){const i=s??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return Me(a.element,i);if(a.type==="set")return Me(a.valueType,i);if(a.type==="lazy")return Me(a.getter(),i);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return Me(a.innerType,i);if(a.type==="intersection")return Me(a.left,i)||Me(a.right,i);if(a.type==="record"||a.type==="map")return Me(a.keyType,i)||Me(a.valueType,i);if(a.type==="pipe")return Me(a.in,i)||Me(a.out,i);if(a.type==="object"){for(const c in a.shape)if(Me(a.shape[c],i))return!0;return!1}if(a.type==="union"){for(const c of a.options)if(Me(c,i))return!0;return!1}if(a.type==="tuple"){for(const c of a.items)if(Me(c,i))return!0;return!!(a.rest&&Me(a.rest,i))}return!1}const Um=(e,s={})=>i=>{const a=jo({...i,processors:s});return Ie(e,a),zo(a,e),Vo(a,e)},ui=(e,s,i={})=>a=>{const{libraryOptions:c,target:u}=a??{},h=jo({...c??{},target:u,io:s,processors:i});return Ie(e,h),zo(h,e),Vo(h,e)},jm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zm=(e,s,i,a)=>{const c=i;c.type="string";const{minimum:u,maximum:h,format:f,patterns:y,contentEncoding:T}=e._zod.bag;if(typeof u=="number"&&(c.minLength=u),typeof h=="number"&&(c.maxLength=h),f&&(c.format=jm[f]??f,c.format===""&&delete c.format,f==="time"&&delete c.format),T&&(c.contentEncoding=T),y&&y.size>0){const x=[...y];x.length===1?c.pattern=x[0].source:x.length>1&&(c.allOf=[...x.map(P=>({...s.target==="draft-07"||s.target==="draft-04"||s.target==="openapi-3.0"?{type:"string"}:{},pattern:P.source}))])}},Vm=(e,s,i,a)=>{const c=i,{minimum:u,maximum:h,format:f,multipleOf:y,exclusiveMaximum:T,exclusiveMinimum:x}=e._zod.bag;typeof f=="string"&&f.includes("int")?c.type="integer":c.type="number",typeof x=="number"&&(s.target==="draft-04"||s.target==="openapi-3.0"?(c.minimum=x,c.exclusiveMinimum=!0):c.exclusiveMinimum=x),typeof u=="number"&&(c.minimum=u,typeof x=="number"&&s.target!=="draft-04"&&(x>=u?delete c.minimum:delete c.exclusiveMinimum)),typeof T=="number"&&(s.target==="draft-04"||s.target==="openapi-3.0"?(c.maximum=T,c.exclusiveMaximum=!0):c.exclusiveMaximum=T),typeof h=="number"&&(c.maximum=h,typeof T=="number"&&s.target!=="draft-04"&&(T<=h?delete c.maximum:delete c.exclusiveMaximum)),typeof y=="number"&&(c.multipleOf=y)},Gm=(e,s,i,a)=>{i.type="boolean"},Hm=(e,s,i,a)=>{i.not={}},Zm=(e,s,i,a)=>{},Wm=(e,s,i,a)=>{const c=e._zod.def,u=so(c.entries);u.every(h=>typeof h=="number")&&(i.type="number"),u.every(h=>typeof h=="string")&&(i.type="string"),i.enum=u},Km=(e,s,i,a)=>{const c=e._zod.def,u=[];for(const h of c.values)if(h===void 0){if(s.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h=="bigint"){if(s.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");u.push(Number(h))}else u.push(h);if(u.length!==0)if(u.length===1){const h=u[0];i.type=h===null?"null":typeof h,s.target==="draft-04"||s.target==="openapi-3.0"?i.enum=[h]:i.const=h}else u.every(h=>typeof h=="number")&&(i.type="number"),u.every(h=>typeof h=="string")&&(i.type="string"),u.every(h=>typeof h=="boolean")&&(i.type="boolean"),u.every(h=>h===null)&&(i.type="null"),i.enum=u},qm=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ym=(e,s,i,a)=>{if(s.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Jm=(e,s,i,a)=>{const c=i,u=e._zod.def,{minimum:h,maximum:f}=e._zod.bag;typeof h=="number"&&(c.minItems=h),typeof f=="number"&&(c.maxItems=f),c.type="array",c.items=Ie(u.element,s,{...a,path:[...a.path,"items"]})},Xm=(e,s,i,a)=>{const c=i,u=e._zod.def;c.type="object",c.properties={};const h=u.shape;for(const T in h)c.properties[T]=Ie(h[T],s,{...a,path:[...a.path,"properties",T]});const f=new Set(Object.keys(h)),y=new Set([...f].filter(T=>{const x=u.shape[T]._zod;return s.io==="input"?x.optin===void 0:x.optout===void 0}));y.size>0&&(c.required=Array.from(y)),u.catchall?._zod.def.type==="never"?c.additionalProperties=!1:u.catchall?u.catchall&&(c.additionalProperties=Ie(u.catchall,s,{...a,path:[...a.path,"additionalProperties"]})):s.io==="output"&&(c.additionalProperties=!1)},Qm=(e,s,i,a)=>{const c=e._zod.def,u=c.inclusive===!1,h=c.options.map((f,y)=>Ie(f,s,{...a,path:[...a.path,u?"oneOf":"anyOf",y]}));u?i.oneOf=h:i.anyOf=h},ey=(e,s,i,a)=>{const c=e._zod.def,u=Ie(c.left,s,{...a,path:[...a.path,"allOf",0]}),h=Ie(c.right,s,{...a,path:[...a.path,"allOf",1]}),f=T=>"allOf"in T&&Object.keys(T).length===1,y=[...f(u)?u.allOf:[u],...f(h)?h.allOf:[h]];i.allOf=y},ty=(e,s,i,a)=>{const c=i,u=e._zod.def;c.type="object";const h=u.keyType,y=h._zod.bag?.patterns;if(u.mode==="loose"&&y&&y.size>0){const x=Ie(u.valueType,s,{...a,path:[...a.path,"patternProperties","*"]});c.patternProperties={};for(const P of y)c.patternProperties[P.source]=x}else(s.target==="draft-07"||s.target==="draft-2020-12")&&(c.propertyNames=Ie(u.keyType,s,{...a,path:[...a.path,"propertyNames"]})),c.additionalProperties=Ie(u.valueType,s,{...a,path:[...a.path,"additionalProperties"]});const T=h._zod.values;if(T){const x=[...T].filter(P=>typeof P=="string"||typeof P=="number");x.length>0&&(c.required=x)}},sy=(e,s,i,a)=>{const c=e._zod.def,u=Ie(c.innerType,s,a),h=s.seen.get(e);s.target==="openapi-3.0"?(h.ref=c.innerType,i.nullable=!0):i.anyOf=[u,{type:"null"}]},iy=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType},ry=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,i.default=JSON.parse(JSON.stringify(c.defaultValue))},ny=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,s.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(c.defaultValue)))},ay=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType;let h;try{h=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=h},oy=(e,s,i,a)=>{const c=e._zod.def,u=s.io==="input"?c.in._zod.def.type==="transform"?c.out:c.in:c.out;Ie(u,s,a);const h=s.seen.get(e);h.ref=u},cy=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType,i.readOnly=!0},Go=(e,s,i,a)=>{const c=e._zod.def;Ie(c.innerType,s,a);const u=s.seen.get(e);u.ref=c.innerType},ly=w("ZodISODateTime",(e,s)=>{uf.init(e,s),Ee.init(e,s)});function uy(e){return mm(ly,e)}const hy=w("ZodISODate",(e,s)=>{hf.init(e,s),Ee.init(e,s)});function py(e){return ym(hy,e)}const dy=w("ZodISOTime",(e,s)=>{pf.init(e,s),Ee.init(e,s)});function fy(e){return gm(dy,e)}const my=w("ZodISODuration",(e,s)=>{df.init(e,s),Ee.init(e,s)});function yy(e){return Em(my,e)}const gy=(e,s)=>{co.init(e,s),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>sd(e,i)},flatten:{value:i=>td(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,Nr,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,Nr,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ke=w("ZodError",gy,{Parent:Error}),Ey=kr(Ke),Ty=Dr(Ke),Sy=ri(Ke),by=ni(Ke),xy=nd(Ke),Iy=ad(Ke),Py=od(Ke),wy=cd(Ke),Ay=ld(Ke),Cy=ud(Ke),vy=hd(Ke),Ny=pd(Ke),ge=w("ZodType",(e,s)=>(ye.init(e,s),Object.assign(e["~standard"],{jsonSchema:{input:ui(e,"input"),output:ui(e,"output")}}),e.toJSONSchema=Um(e,{}),e.def=s,e.type=s.type,Object.defineProperty(e,"_def",{value:s}),e.check=(...i)=>e.clone(Ct(s,{checks:[...s.checks??[],...i.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(i,a)=>vt(e,i,a),e.brand=()=>e,e.register=((i,a)=>(i.add(e,a),e)),e.parse=(i,a)=>Ey(e,i,a,{callee:e.parse}),e.safeParse=(i,a)=>Sy(e,i,a),e.parseAsync=async(i,a)=>Ty(e,i,a,{callee:e.parseAsync}),e.safeParseAsync=async(i,a)=>by(e,i,a),e.spa=e.safeParseAsync,e.encode=(i,a)=>xy(e,i,a),e.decode=(i,a)=>Iy(e,i,a),e.encodeAsync=async(i,a)=>Py(e,i,a),e.decodeAsync=async(i,a)=>wy(e,i,a),e.safeEncode=(i,a)=>Ay(e,i,a),e.safeDecode=(i,a)=>Cy(e,i,a),e.safeEncodeAsync=async(i,a)=>vy(e,i,a),e.safeDecodeAsync=async(i,a)=>Ny(e,i,a),e.refine=(i,a)=>e.check(bg(i,a)),e.superRefine=i=>e.check(xg(i)),e.overwrite=i=>e.check(is(i)),e.optional=()=>Qo(e),e.exactOptional=()=>lg(e),e.nullable=()=>ec(e),e.nullish=()=>Qo(ec(e)),e.nonoptional=i=>mg(e,i),e.array=()=>ne(e),e.or=i=>eg([e,i]),e.and=i=>ig(e,i),e.transform=i=>sc(e,og(i)),e.default=i=>pg(e,i),e.prefault=i=>fg(e,i),e.catch=i=>gg(e,i),e.pipe=i=>sc(e,i),e.readonly=()=>Sg(e),e.describe=i=>{const a=e.clone();return Cs.add(a,{description:i}),a},Object.defineProperty(e,"description",{get(){return Cs.get(e)?.description},configurable:!0}),e.meta=(...i)=>{if(i.length===0)return Cs.get(e);const a=e.clone();return Cs.add(a,i[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=i=>i(e),e)),Ho=w("_ZodString",(e,s)=>{Rr.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>zm(e,a,c);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,e.regex=(...a)=>e.check(Pm(...a)),e.includes=(...a)=>e.check(Cm(...a)),e.startsWith=(...a)=>e.check(vm(...a)),e.endsWith=(...a)=>e.check(Nm(...a)),e.min=(...a)=>e.check(li(...a)),e.max=(...a)=>e.check(Bo(...a)),e.length=(...a)=>e.check(Uo(...a)),e.nonempty=(...a)=>e.check(li(1,...a)),e.lowercase=a=>e.check(wm(a)),e.uppercase=a=>e.check(Am(a)),e.trim=()=>e.check(Om()),e.normalize=(...a)=>e.check(_m(...a)),e.toLowerCase=()=>e.check(Lm()),e.toUpperCase=()=>e.check(km()),e.slugify=()=>e.check(Dm())}),_y=w("ZodString",(e,s)=>{Rr.init(e,s),Ho.init(e,s),e.email=i=>e.check(qf(Oy,i)),e.url=i=>e.check(Ro(Wo,i)),e.jwt=i=>e.check(fm(Zy,i)),e.emoji=i=>e.check(em(Ly,i)),e.guid=i=>e.check(Do(Zo,i)),e.uuid=i=>e.check(Yf(hi,i)),e.uuidv4=i=>e.check(Jf(hi,i)),e.uuidv6=i=>e.check(Xf(hi,i)),e.uuidv7=i=>e.check(Qf(hi,i)),e.nanoid=i=>e.check(tm(ky,i)),e.guid=i=>e.check(Do(Zo,i)),e.cuid=i=>e.check(sm(Dy,i)),e.cuid2=i=>e.check(im(Ry,i)),e.ulid=i=>e.check(rm(My,i)),e.base64=i=>e.check(hm(Vy,i)),e.base64url=i=>e.check(pm(Gy,i)),e.xid=i=>e.check(nm($y,i)),e.ksuid=i=>e.check(am(Fy,i)),e.ipv4=i=>e.check(om(By,i)),e.ipv6=i=>e.check(cm(Uy,i)),e.cidrv4=i=>e.check(lm(jy,i)),e.cidrv6=i=>e.check(um(zy,i)),e.e164=i=>e.check(dm(Hy,i)),e.datetime=i=>e.check(uy(i)),e.date=i=>e.check(py(i)),e.time=i=>e.check(fy(i)),e.duration=i=>e.check(yy(i))});function O(e){return Kf(_y,e)}const Ee=w("ZodStringFormat",(e,s)=>{pe.init(e,s),Ho.init(e,s)}),Oy=w("ZodEmail",(e,s)=>{ef.init(e,s),Ee.init(e,s)}),Zo=w("ZodGUID",(e,s)=>{Xd.init(e,s),Ee.init(e,s)}),hi=w("ZodUUID",(e,s)=>{Qd.init(e,s),Ee.init(e,s)}),Wo=w("ZodURL",(e,s)=>{tf.init(e,s),Ee.init(e,s)});function Ko(e){return Ro(Wo,e)}const Ly=w("ZodEmoji",(e,s)=>{sf.init(e,s),Ee.init(e,s)}),ky=w("ZodNanoID",(e,s)=>{rf.init(e,s),Ee.init(e,s)}),Dy=w("ZodCUID",(e,s)=>{nf.init(e,s),Ee.init(e,s)}),Ry=w("ZodCUID2",(e,s)=>{af.init(e,s),Ee.init(e,s)}),My=w("ZodULID",(e,s)=>{of.init(e,s),Ee.init(e,s)}),$y=w("ZodXID",(e,s)=>{cf.init(e,s),Ee.init(e,s)}),Fy=w("ZodKSUID",(e,s)=>{lf.init(e,s),Ee.init(e,s)}),By=w("ZodIPv4",(e,s)=>{ff.init(e,s),Ee.init(e,s)}),Uy=w("ZodIPv6",(e,s)=>{mf.init(e,s),Ee.init(e,s)}),jy=w("ZodCIDRv4",(e,s)=>{yf.init(e,s),Ee.init(e,s)}),zy=w("ZodCIDRv6",(e,s)=>{gf.init(e,s),Ee.init(e,s)}),Vy=w("ZodBase64",(e,s)=>{Ef.init(e,s),Ee.init(e,s)}),Gy=w("ZodBase64URL",(e,s)=>{Sf.init(e,s),Ee.init(e,s)}),Hy=w("ZodE164",(e,s)=>{bf.init(e,s),Ee.init(e,s)}),Zy=w("ZodJWT",(e,s)=>{If.init(e,s),Ee.init(e,s)}),qo=w("ZodNumber",(e,s)=>{So.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Vm(e,a,c),e.gt=(a,c)=>e.check($o(a,c)),e.gte=(a,c)=>e.check(Fr(a,c)),e.min=(a,c)=>e.check(Fr(a,c)),e.lt=(a,c)=>e.check(Mo(a,c)),e.lte=(a,c)=>e.check($r(a,c)),e.max=(a,c)=>e.check($r(a,c)),e.int=a=>e.check(at(a)),e.safe=a=>e.check(at(a)),e.positive=a=>e.check($o(0,a)),e.nonnegative=a=>e.check(Fr(0,a)),e.negative=a=>e.check(Mo(0,a)),e.nonpositive=a=>e.check($r(0,a)),e.multipleOf=(a,c)=>e.check(Fo(a,c)),e.step=(a,c)=>e.check(Fo(a,c)),e.finite=()=>e;const i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function pi(e){return Tm(qo,e)}const Wy=w("ZodNumberFormat",(e,s)=>{Pf.init(e,s),qo.init(e,s)});function at(e){return Sm(Wy,e)}const Ky=w("ZodBoolean",(e,s)=>{wf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Gm(e,i,a)});function te(e){return bm(Ky,e)}const qy=w("ZodUnknown",(e,s)=>{Af.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Zm()});function Yo(){return xm(qy)}const Yy=w("ZodNever",(e,s)=>{Cf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Hm(e,i,a)});function Jy(e){return Im(Yy,e)}const Xy=w("ZodArray",(e,s)=>{vf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Jm(e,i,a,c),e.element=s.element,e.min=(i,a)=>e.check(li(i,a)),e.nonempty=i=>e.check(li(1,i)),e.max=(i,a)=>e.check(Bo(i,a)),e.length=(i,a)=>e.check(Uo(i,a)),e.unwrap=()=>e.element});function ne(e,s){return Rm(Xy,e,s)}const Qy=w("ZodObject",(e,s)=>{_f.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Xm(e,i,a,c),re(e,"shape",()=>s.shape),e.keyof=()=>de(Object.keys(e._zod.def.shape)),e.catchall=i=>e.clone({...e._zod.def,catchall:i}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Yo()}),e.loose=()=>e.clone({...e._zod.def,catchall:Yo()}),e.strict=()=>e.clone({...e._zod.def,catchall:Jy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=i=>Yp(e,i),e.safeExtend=i=>Jp(e,i),e.merge=i=>Xp(e,i),e.pick=i=>Kp(e,i),e.omit=i=>qp(e,i),e.partial=(...i)=>Qp(Xo,e,i[0]),e.required=(...i)=>ed(tc,e,i[0])});function A(e,s){const i={type:"object",shape:e??{},...U(s)};return new Qy(i)}const Jo=w("ZodUnion",(e,s)=>{wo.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Qm(e,i,a,c),e.options=s.options});function eg(e,s){return new Jo({type:"union",options:e,...U(s)})}const tg=w("ZodDiscriminatedUnion",(e,s)=>{Jo.init(e,s),Of.init(e,s)});function Ve(e,s,i){return new tg({type:"union",options:s,discriminator:e,...U(i)})}const sg=w("ZodIntersection",(e,s)=>{Lf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ey(e,i,a,c)});function ig(e,s){return new sg({type:"intersection",left:e,right:s})}const rg=w("ZodRecord",(e,s)=>{kf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ty(e,i,a,c),e.keyType=s.keyType,e.valueType=s.valueType});function Oe(e,s,i){return new rg({type:"record",keyType:e,valueType:s,...U(i)})}const Br=w("ZodEnum",(e,s)=>{Df.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(a,c,u)=>Wm(e,a,c),e.enum=s.entries,e.options=Object.values(s.entries);const i=new Set(Object.keys(s.entries));e.extract=(a,c)=>{const u={};for(const h of a)if(i.has(h))u[h]=s.entries[h];else throw new Error(`Key ${h} not found in enum`);return new Br({...s,checks:[],...U(c),entries:u})},e.exclude=(a,c)=>{const u={...s.entries};for(const h of a)if(i.has(h))delete u[h];else throw new Error(`Key ${h} not found in enum`);return new Br({...s,checks:[],...U(c),entries:u})}});function de(e,s){const i=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Br({type:"enum",entries:i,...U(s)})}const ng=w("ZodLiteral",(e,s)=>{Rf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Km(e,i,a),e.values=new Set(s.values),Object.defineProperty(e,"value",{get(){if(s.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return s.values[0]}})});function k(e,s){return new ng({type:"literal",values:Array.isArray(e)?e:[e],...U(s)})}const ag=w("ZodTransform",(e,s)=>{Mf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Ym(e,i),e._zod.parse=(i,a)=>{if(a.direction==="backward")throw new to(e.constructor.name);i.addIssue=u=>{if(typeof u=="string")i.issues.push(As(u,i.value,s));else{const h=u;h.fatal&&(h.continue=!1),h.code??(h.code="custom"),h.input??(h.input=i.value),h.inst??(h.inst=e),i.issues.push(As(h))}};const c=s.transform(i.value,i);return c instanceof Promise?c.then(u=>(i.value=u,i)):(i.value=c,i)}});function og(e){return new ag({type:"transform",transform:e})}const Xo=w("ZodOptional",(e,s)=>{vo.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Go(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function Qo(e){return new Xo({type:"optional",innerType:e})}const cg=w("ZodExactOptional",(e,s)=>{$f.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>Go(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function lg(e){return new cg({type:"optional",innerType:e})}const ug=w("ZodNullable",(e,s)=>{Ff.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>sy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function ec(e){return new ug({type:"nullable",innerType:e})}const hg=w("ZodDefault",(e,s)=>{Bf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ry(e,i,a,c),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pg(e,s){return new hg({type:"default",innerType:e,get defaultValue(){return typeof s=="function"?s():ao(s)}})}const dg=w("ZodPrefault",(e,s)=>{Uf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ny(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function fg(e,s){return new dg({type:"prefault",innerType:e,get defaultValue(){return typeof s=="function"?s():ao(s)}})}const tc=w("ZodNonOptional",(e,s)=>{jf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>iy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function mg(e,s){return new tc({type:"nonoptional",innerType:e,...U(s)})}const yg=w("ZodCatch",(e,s)=>{zf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>ay(e,i,a,c),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gg(e,s){return new yg({type:"catch",innerType:e,catchValue:typeof s=="function"?s:()=>s})}const Eg=w("ZodPipe",(e,s)=>{Vf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>oy(e,i,a,c),e.in=s.in,e.out=s.out});function sc(e,s){return new Eg({type:"pipe",in:e,out:s})}const Tg=w("ZodReadonly",(e,s)=>{Gf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>cy(e,i,a,c),e.unwrap=()=>e._zod.def.innerType});function Sg(e){return new Tg({type:"readonly",innerType:e})}const ic=w("ZodCustom",(e,s)=>{Hf.init(e,s),ge.init(e,s),e._zod.processJSONSchema=(i,a,c)=>qm(e,i)});function rs(e,s){return Mm(ic,e??(()=>!0),s)}function bg(e,s={}){return $m(ic,e,s)}function xg(e){return Fm(e)}const dt={SCROLL_TO_TILE:"SCROLL_TO_TILE",HYPER_LINK:"HYPER_LINK",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"},Ig=de(Object.values(dt)),di=dt,vs={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"},Pg=de(Object.values(vs)),fi=vs,rc={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"},wg=de(Object.values(rc)),Ag=rc,nc={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"},Cg=de(Object.values(nc)),vg=nc,ac={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"},Ng=de(Object.values(ac)),_g=ac,mi={COLOR:"COLOR",GRADIENT:"GRADIENT"},Og=de(Object.values(mi)),Ur=mi,$t={SECTION:"SECTION",HEADER:"HEADER",FOOTER:"FOOTER"},Lg=de(Object.values($t)),ft=$t;var Ge=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(Ge||{}),he=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e[e.CollectionDescriptor=14]="CollectionDescriptor",e[e.CollectionAsset=15]="CollectionAsset",e))(he||{}),kg=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(kg||{});const F={TEXTAREA:"TEXTAREA",INPUTBOX:"INPUTBOX",SELECTBOX:"SELECTBOX",IMAGE:"IMAGE",TOGGLE:"TOGGLE",BUTTON:"BUTTON",DECK:"DECK",MENU:"MENU",NAVIGATION_MENU:"NAVIGATION_MENU",LOGO:"LOGO",INFO:"INFO",DIVIDER:"DIVIDER",PRODUCT_SELECTOR:"PRODUCT_SELECTOR",CATEGORY_SELECTOR:"CATEGORY_SELECTOR"};de(Object.values(F));const K={TEXT:"TEXT",BUTTON:"BUTTON",IMAGE:"IMAGE",TOGGLE:"TOGGLE",SELECTBOX:"SELECTBOX",BACKGROUND:"BACKGROUND",COLOR_PICKER:"COLOR_PICKER",LOGO:"LOGO",DIVIDER:"DIVIDER",INFO:"INFO",ACCORDION:"ACCORDION"};de(Object.values(K));const He=K,Ns={CONTENT:"Content",DESIGN:"Design"};de(Object.values(Ns));const Dg={TEXT:"TEXT",IMAGE:"IMAGE"},Rg=de(Object.values(Dg));var Mg=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(Mg||{}),$g=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))($g||{});const oc={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},cc={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},lc={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"};de(Object.values(oc)),de(Object.values(cc)),de(Object.values(lc));const Fg={TOP_BAR:["breadcrumbsPosition","showNavigationArrows"],GALLERY:["galleryLayout","showProductPhotoZoom","showAltTextAsDescription"],SIDEBAR:["showWeight","showAttributes","showProductDescription","showProductSku","showInStockLabel","showNumberOfItemsInStock","showQuantity","optionSize","optionShape","showOutlets","showDeliveryTime","showWholesalePrices","showReviewSection","favoritesEnabled","showShareButtons","showLoyalty","breadcrumbsPosition"],DESCRIPTION:["showWeight","showAttributes","showProductDescription"],REVIEW_LIST:["showReviewSection","showReviewsSectionInOneCardView"],RELATED_PRODUCTS:[],BOTTOM_BAR:[],CUSTOM_SLOT:[]},uc=["categoryViewMode","productFiltersVisibleOnCatalogPages","productFiltersPositionOnCatalogPages","productFiltersOpenedByDefaultOnCategoryPage","productFiltersOrientationPosition","showSortViewAsOptions","productCardSpacingType","productCardLayout","imageAspectRatio","imageSize","productTitleBehavior","productSubtitleBehavior","productPriceBehavior","productListSwatchesProductOptionBehavior","productSkuBehavior","productBuyButtonBehavior","productRatingSectionBehavior","productRatingViewBehavior","showProductRatingAvg","showProductTotalNumberOfReview","showProductFrame","showProductImages","showAdditionalImageOnHover","categoryTitleBehavior"],hc=["showFooterMenu","showSigninLink"],Bg={PRODUCT_LIST:uc,BOTTOM_BAR:hc,CUSTOM_SLOT:[]},Ug={CATEGORY_TITLE:[],PRODUCT_LIST:uc,BOTTOM_BAR:hc,CUSTOM_SLOT:[]},jg={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"},zg=de(Object.values(jg)),we={[ft.SECTION]:{source:"sections",dist:"dist/sections"},[ft.HEADER]:{source:"headers",dist:"dist/headers"},[ft.FOOTER]:{source:"footers",dist:"dist/footers"}};var se=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e[e.SourceCode=7]="SourceCode",e[e.LayoutClient=8]="LayoutClient",e[e.LayoutAsset=9]="LayoutAsset",e[e.SlotServer=10]="SlotServer",e[e.SlotClient=11]="SlotClient",e[e.SlotClientChunks=12]="SlotClientChunks",e[e.SlotClientAsset=13]="SlotClientAsset",e[e.CollectionAsset=14]="CollectionAsset",e))(se||{});function ns(e){const s={};for(const[i,a]of Object.entries(e)){let c={...a};if(a.type==="DECK"&&a.cards&&typeof a.cards=="object"&&"defaultCardContent"in a.cards){const u=a.cards;u.defaultCardContent?.settings&&(c={...c,cards:{...u,defaultCardContent:{...u.defaultCardContent,settings:ns(u.defaultCardContent.settings)}}})}if(a.type==="ACCORDION"&&a.cards&&typeof a.cards=="object"&&!("defaultCardContent"in a.cards)){const u=a.cards,h={};for(const[f,y]of Object.entries(u))y.editors?h[f]={...y,editors:ns(y.editors)}:h[f]=y;c={...c,cards:h}}if(c.defaults&&typeof c.defaults=="object"&&!("type"in c.defaults)){const u=Object.assign({type:c.type},c.defaults);c={...c,defaults:u}}s[i]=c}return s}const Vg={url:"must be a valid URL",email:"must be a valid email address"},Gg=e=>{const s=e?.at(-1);return typeof s=="string"?`'${s}'`:"Field"},Hg=e=>e===null?"null":typeof e,Zg=e=>{switch(e.code){case"invalid_type":{const{input:s}=e;return s===void 0?{message:`${Gg(e.path)} is required`}:{message:`Expected ${String(e.expected)}, received ${Hg(s)}`}}case"invalid_format":{const s=Vg[e.format];return s?{message:s}:void 0}case"unrecognized_keys":return{message:`Unrecognized property: ${e.keys.map(s=>`'${s}'`).join(", ")}`};case"invalid_union":{const s=e.path?.at(-1);return typeof s=="string"?{message:`'${s}' is required or has invalid value`}:void 0}case"invalid_value":{const{values:s}=e;return s?{message:`Expected one of: ${s.map(i=>`'${String(i)}'`).join(", ")}`}:void 0}case"invalid_key":{const s=e.issues?.[0];return s?{message:s.message}:void 0}default:return}};de(["none","all","small"]);const Ft={PRODUCT:"PRODUCT",CATALOG:"CATALOG",CATEGORY:"CATEGORY",HOME:"HOME",CUSTOM:"CUSTOM"},pc={HOME:"home",CATALOG:"catalog",CATEGORY:"category",PRODUCT:"product"},Wg=de(Object.values(Ft));de(Object.values(pc));const Kg={HEADER_LEFT:"HEADER_LEFT",HEADER_CENTER_LOGO_BURGER:"HEADER_CENTER_LOGO_BURGER",HEADER_CENTER_LOGO_COMPACT:"HEADER_CENTER_LOGO_COMPACT",HEADER_CENTER_LOGO_DETAILED:"HEADER_CENTER_LOGO_DETAILED",HEADER_LEFT_LOGO_BURGER:"HEADER_LEFT_LOGO_BURGER",HEADER_LEFT_LOGO_COMPACT:"HEADER_LEFT_LOGO_COMPACT",HEADER_LEFT_LOGO_DETAILED:"HEADER_LEFT_LOGO_DETAILED",HEADER_LEFT_LOGO_SEARCH:"HEADER_LEFT_LOGO_SEARCH",HEADER_LEFT_LOGO_TEXT:"HEADER_LEFT_LOGO_TEXT",TEXT_ONE_COLUMN:"TEXT_ONE_COLUMN",TEXT_TITLE_LEFT:"TEXT_TITLE_LEFT",TEXT_SUBTITLE_RIGHT:"TEXT_SUBTITLE_RIGHT",TEXT_TWO_COLUMNS:"TEXT_TWO_COLUMNS",TEXT_CENTER:"TEXT_CENTER",TEXT_DESCRIPTION_RIGHT:"TEXT_DESCRIPTION_RIGHT",CTA_BANNER_LEFT:"CTA_BANNER_LEFT",CTA_BANNER_RIGHT:"CTA_BANNER_RIGHT",CTA_BANNER_CENTER:"CTA_BANNER_CENTER",CTA_BANNER_BOTTOM:"CTA_BANNER_BOTTOM",CTA_PROMO_BAR_LEFT:"CTA_PROMO_BAR_LEFT",CTA_PROMO_BAR_RIGHT:"CTA_PROMO_BAR_RIGHT",CTA_STORY_LEFT:"CTA_STORY_LEFT",CTA_STORY_RIGHT:"CTA_STORY_RIGHT",CTA_FULLWIDTH_CENTER:"CTA_FULLWIDTH_CENTER",CTA_FULLWIDTH_LEFT:"CTA_FULLWIDTH_LEFT",CTA_FULLWIDTH_NO_IMAGE:"CTA_FULLWIDTH_NO_IMAGE",COVER_FULLSCREEN_CENTER:"COVER_FULLSCREEN_CENTER",COVER_FULLSCREEN_LEFT:"COVER_FULLSCREEN_LEFT",COVER_FULLSCREEN_CENTER_LEFT:"COVER_FULLSCREEN_CENTER_LEFT",COVER_FULLSCREEN_RIGHT:"COVER_FULLSCREEN_RIGHT",COVER_FULLSCREEN_BOTTOM:"COVER_FULLSCREEN_BOTTOM",COVER_FULLSCREEN_BOTTOM_RIGHT:"COVER_FULLSCREEN_BOTTOM_RIGHT",COVER_FULLSCREEN_BOTTOM_LEFT:"COVER_FULLSCREEN_BOTTOM_LEFT",COVER_FULLSCREEN_TOP:"COVER_FULLSCREEN_TOP",COVER_SIDEBAR_RIGHT:"COVER_SIDEBAR_RIGHT",COVER_SIDEBAR_LEFT:"COVER_SIDEBAR_LEFT",COVER_HALFSCREEN_LEFT:"COVER_HALFSCREEN_LEFT",COVER_HALFSCREEN_CENTER:"COVER_HALFSCREEN_CENTER",COVER_COLLAGE_BOTTOM:"COVER_COLLAGE_BOTTOM",COVER_COLLAGE_LEFT:"COVER_COLLAGE_LEFT",IMAGE_SUBTITLE_RIGHT:"IMAGE_SUBTITLE_RIGHT",IMAGE_TITLE_LEFT:"IMAGE_TITLE_LEFT",IMAGE_LEFT:"IMAGE_LEFT",IMAGE_RIGHT:"IMAGE_RIGHT",IMAGE_CENTER:"IMAGE_CENTER",IMAGE_SIDE_TITLE:"IMAGE_SIDE_TITLE",LOCATION_MAP_RIGHT:"LOCATION_MAP_RIGHT",LOCATION_MAP_LEFT:"LOCATION_MAP_LEFT",LOCATION_IMAGE_RIGHT:"LOCATION_IMAGE_RIGHT",LOCATION_IMAGE_LEFT:"LOCATION_IMAGE_LEFT",LOCATION_BACKGROUND_RIGHT:"LOCATION_BACKGROUND_RIGHT",LOCATION_BACKGROUND_LEFT:"LOCATION_BACKGROUND_LEFT",LOCATION_FULL:"LOCATION_FULL",LOCATION_SHORT:"LOCATION_SHORT",REVIEWS_MINIMAL:"REVIEWS_MINIMAL",REVIEWS_CARDS:"REVIEWS_CARDS",REVIEWS:"REVIEWS",REVIEWS_CLASSIC:"REVIEWS_CLASSIC",REVIEWS_FULLSCREEN_BG:"REVIEWS_FULLSCREEN_BG",REVIEWS_FULLSCREEN_SIDEBAR_LEFT:"REVIEWS_FULLSCREEN_SIDEBAR_LEFT",REVIEWS_FULLSCREEN_SIDEBAR_RIGHT:"REVIEWS_FULLSCREEN_SIDEBAR_RIGHT",REVIEWS_CARDS_PHOTO:"REVIEWS_CARDS_PHOTO",REVIEWS_PHOTO_SPEECH_RIGHT:"REVIEWS_PHOTO_SPEECH_RIGHT",REVIEWS_PHOTO_SPEECH_LEFT:"REVIEWS_PHOTO_SPEECH_LEFT",REVIEWS_SOCIAL_FEED:"REVIEWS_SOCIAL_FEED",REVIEWS_ADAPTIVE:"REVIEWS_ADAPTIVE",FEATURES_CLASSIC_CENTER:"FEATURES_CLASSIC_CENTER",FEATURES_CLASSIC_LEFT:"FEATURES_CLASSIC_LEFT",FEATURES_ACCORDION:"FEATURES_ACCORDION",FEATURES_MINIMAL:"FEATURES_MINIMAL",FEATURES_SMALL_ICONS:"FEATURES_SMALL_ICONS",FEATURES_CAROUSEL:"FEATURES_CAROUSEL",FEATURES_IMAGE_LEFT:"FEATURES_IMAGE_LEFT",FEATURES_IMAGE_RIGHT:"FEATURES_IMAGE_RIGHT",ANNOUNCEMENT_CENTER:"ANNOUNCEMENT_CENTER",TWO_COLUMNS_SIDEBAR_ON_THE_LEFT:"TWO_COLUMNS_SIDEBAR_ON_THE_LEFT",TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT:"TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT",THREE_COLUMNS_SIDEBAR_ON_THE_RIGHT:"THREE_COLUMNS_SIDEBAR_ON_THE_RIGHT",THREE_COLUMNS_SIDEBAR_ON_THE_LEFT:"THREE_COLUMNS_SIDEBAR_ON_THE_LEFT",TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT_DESCRIPTION_UNDER_IMAGE:"TWO_COLUMNS_SIDEBAR_ON_THE_RIGHT_DESCRIPTION_UNDER_IMAGE",SLIDER_FULLSCREEN_CENTER:"SLIDER_FULLSCREEN_CENTER",SLIDER_FULLSCREEN_LEFT:"SLIDER_FULLSCREEN_LEFT",SLIDER_BASIC:"SLIDER_BASIC",SLIDER_CAROUSEL:"SLIDER_CAROUSEL",SLIDER_CAROUSEL_PORTRAIT:"SLIDER_CAROUSEL_PORTRAIT",SLIDER_SPLIT:"SLIDER_SPLIT",SLIDER_SPLIT_REVERSE:"SLIDER_SPLIT_REVERSE"},qg=de(Object.values(Kg)),Yg={HEADER:"header",COVER:"cover",ANNOUNCEMENT_BAR:"announcement_bar",SLIDER:"slider",SPECIAL_OFFER:"special_offer",CUSTOMER_REVIEW:"customer_review",COMPANY_INFO:"company_info",SHIPPING_PAYMENT:"shipping_payment",LOCATION:"location",STORE:"store",FOOTER:"footer",VIDEO:"video",IMAGE_GALLERY:"image_gallery",CONTACT_INFO:"contact_info",CONTACTS_WIDGET_WHATSAPP:"contacts_widget_whatsapp",CONTACTS_WIDGET_INSTAGRAM:"contacts_widget_instagram",CONTACTS_WIDGET_FACEBOOK:"contacts_widget_facebook",CONTACTS_WIDGET_PHONE:"contacts_widget_phone"},Jg={COVER:"COVER",ANNOUNCEMENT:"ANNOUNCEMENT",STORE:"STORE",SLIDER:"SLIDER",VIDEO:"VIDEO",SPECIAL_OFFER:"SPECIAL_OFFER",CUSTOMER_REVIEW:"CUSTOMER_REVIEW",COMPANY_INFO:"COMPANY_INFO",SHIPPING_PAYMENT:"SHIPPING_PAYMENT",LOCATION:"LOCATION",COLLECTIONS:"COLLECTIONS",BRANDS:"BRANDS",CONTACT_INFO:"CONTACT_INFO"},Xg=de(Object.values(Jg)),Be={REQUIRED_HEADER_ID:()=>'Header section must have id "header" when type is "default"',REQUIRED_CUSTOM_HEADER:(...e)=>`Custom header section with id "${e[0]}" must exist in headers directory`,REQUIRED_CUSTOM_HEADER_TYPE:(...e)=>`Custom header section with id "${e[0]}" must be of type "HEADER"`,REQUIRED_FOOTER_ID:()=>'Footer section must have id "footer" when type is "default"',REQUIRED_CUSTOM_FOOTER:(...e)=>`Custom footer section with id "${e[0]}" must exist in footers directory`,REQUIRED_CUSTOM_FOOTER_TYPE:(...e)=>`Custom footer section with id "${e[0]}" must be of type "FOOTER"`,REQUIRED_PAGE_SECTION:(...e)=>`Custom section with id "${e[0]}" must exist in sections directory`,REQUIRED_PAGE_SECTION_TYPE:()=>'Section "header" or "footer" is not allowed among page sections',SHOWCASE_ID_NOT_FOUND:(...e)=>`Showcase with id "${e[0]}" must exist in section's showcase directory`,DUPLICATE_SHOWCASE_ID:(...e)=>`Showcase id "${e[0]}" must be unique within section showcases`,SHOWCASE_OVERRIDE_CONTENT:(...e)=>`Content editor "${e[0]}" in showcase_overrides must exist in section's content configuration file`,SHOWCASE_OVERRIDE_DESIGN:(...e)=>`Design editor "${e[0]}" in showcase_overrides must exist in section's design configuration file`,SHOWCASE_OVERRIDE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase_overrides must exist in section's layout configuration file`,SHOWCASE_LAYOUT:(...e)=>`LayoutId "${e[0]}" in showcase must exist in section's layout configuration file`,INVALID_SHOWCASE_CONTENT_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in content.ts`,SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but content.ts has type "${e[2]}"`,INVALID_SHOWCASE_DESIGN_ELEMENT:(...e)=>`Element "${e[0]}" is not defined in design.ts`,SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH:(...e)=>`Element "${e[0]}" type mismatch: showcase has type "${e[1]}" but design.ts has type "${e[2]}"`,INVALID_DECK_CARD_SETTING:(...e)=>`Setting "${e[0]}" is not defined in content.ts defaultCardContent.settings`,DECK_SETTINGS_REQUIRED:()=>"settings must have at least one property",INVALID_SELECTBOX_OPTION:(...e)=>`Option value "${e[0]}" for element "${e[1]}" is not defined in content.ts options`,REQUIRED_STORE_LAYOUT:(...e)=>`Store section with id "${e[0]}" and page type "${e[1]}" must have a corresponding layout defined`,INVALID_STORE_SECTION_ID:(...e)=>`Store layout sectionId "${e[0]}" must be one of: ${e[1]}`,REQUIRED_SECTION_ASSET:(...e)=>`Asset size ${e[0]} exceeds threshold of ${e[1]}.`,REQUIRED_SERVER_SIZE:(...e)=>`Size of individual server file [${e[0]}] must not exceed threshold [${e[1]}].`,MISSING_IMAGE_ASSET:(...e)=>`Image ${e[0]} is missing from assets folder`,MANDATORY_SETTING_TYPE_MISMATCH:(...e)=>`Editor type "${e[0]}" for reserved key "${e[1]}" does not match the required type "${e[2]}".`,MANDATORY_SETTING_NAME_MISMATCH:(...e)=>`Editor key "${e[0]}" for overridden content type "${e[1]}" does not match the required key name "${e[2]}".`,DUPLICATED_MANDATORY_SETTING:(...e)=>`Editor type "${e[0]}" can only be used once.`,IMAGE_EDITOR_STATIC_MISMATCH:(...e)=>`Both "${e[0]}" content and design editor need to have same value for attribute static`,DUPLICATE_DESIGN_EDITOR_NAME:()=>"Non-unique design editor name detected",COLOR_REQUIRED_GRADIENT:()=>"color is required when overlay is GRADIENT",COLOR_MUST_BE_ARRAY_GRADIENT:()=>"color must be an array when overlay is GRADIENT",COLOR_ARRAY_LENGTH_GRADIENT:()=>"color array must have exactly 2 items when overlay is GRADIENT",COLOR_REQUIRED_COLOR:()=>"color is required when overlay is COLOR",COLOR_MUST_BE_SINGLE_COLOR:()=>"color must be a single value when overlay is COLOR",COLOR_MUST_BE_UNDEFINED_NONE:()=>"color must be undefined when overlay is NONE or not set",COLOR_REQUIRED_STYLE_GRADIENT:()=>"color is required when style is GRADIENT",COLOR_MUST_BE_ARRAY_STYLE_GRADIENT:()=>"color must be an array when style is GRADIENT",COLOR_ARRAY_LENGTH_STYLE_GRADIENT:()=>"color array must have exactly 2 items when style is GRADIENT",COLOR_REQUIRED_STYLE_COLOR:()=>"color is required when style is COLOR",COLOR_MUST_BE_SINGLE_STYLE_COLOR:()=>"color must be a single value when style is COLOR",BUTTON_LINK_REQUIRED:()=>"link is required when buttonType is HYPER_LINK",BUTTON_CATEGORY_ID_REQUIRED:()=>"categoryId is required when buttonType is GO_TO_CATEGORY or GO_TO_CATEGORY_LINK",BUTTON_EMAIL_REQUIRED:()=>"email is required when buttonType is MAIL_LINK",BUTTON_PHONE_REQUIRED:()=>"phone is required when buttonType is TEL_LINK",BUTTON_TILE_ID_REQUIRED:(...e)=>`${e[0]} is required when buttonType is SCROLL_TO_TILE`,BUTTON_PAGE_ID_REQUIRED:()=>"pageIdForNavigate is required when type is GO_TO_PAGE",TEMPLATE_PAGE_SECTIONS_REQUIRED:()=>"sections must contain at least one section",TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have exactly one section`,TEMPLATE_PAGE_STORE_SECTION_REQUIRED:(...e)=>`Page type "${e[0]}" must have a section of type "store"`,TEMPLATE_PAGE_NO_STORE_SECTIONS:(...e)=>`Page type "${e[0]}" cannot contain store sections`,TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED:()=>'Page type "CUSTOM" must have a metadata property',TEMPLATE_PAGE_METADATA_NOT_ALLOWED:(...e)=>`Page type "${e[0]}" must not have a metadata property`,NON_NEGATIVE_INTEGER:()=>"must be a non-negative integer",INTEGER_RANGE:(...e)=>`must be between ${e[0]} and ${e[1]}`,VALID_HEX_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA)",VALID_GLOBAL_FONT:()=>"must be a valid global font reference (global.fontFamily.title or global.fontFamily.body)",VALID_GLOBAL_TEXT_SIZE:()=>"must be a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_GLOBAL_COLOR:()=>"must be a valid global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_COLOR:()=>"must be a valid hex color (#RGB, #RRGGBB, or #RRGGBBAA) or global color reference (global.color.title, global.color.body, global.color.button, global.color.link, or global.color.background)",VALID_TEXT_SIZE:()=>"must be an integer of at least 1 or a valid global text size reference (global.textSize.title, global.textSize.subtitle, or global.textSize.body)",VALID_LANGUAGE_CODE:()=>"must be a valid language code (e.g., en, nl, fr, en_US, en_GB, zh_Hans)",VALID_URL:()=>"must be a valid URL",VALID_EMAIL:()=>"must be a valid email address",ACCORDION_ITEM_POSITION_FIELD_REQUIRED:(...e)=>`Item "${e[0]}" must have positionFieldName when sortable is true`,ACCORDION_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor`,ACCORDION_SHOWCASE_ITEMS_REQUIRED:()=>"items must have at least one item",ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED:(...e)=>`Item "${e[0]}" must have at least one editor override`,ACCORDION_DUPLICATE_POSITION_FIELD_NAME:()=>"positionFieldName must be unique across accordion items when sortable is true",MISSING_SLOT_DESIGN_SETTINGS:(...e)=>`Slot "${e[0]}" cannot be used because required design settings are missing: ${e[1]}. Check the original example and add the missing settings.`,REQUIRED_COLLECTION_NAME:()=>"Collection must have a name in metadata"},dc=/^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,fc=/^global\.fontFamily\.(title|body)$/,mc=/^global\.textSize\.(title|subtitle|body)$/,yc=/^global\.color\.(title|body|button|link|background)$/,Qg=/^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$/,_t=(e,s)=>{const i=Be.INTEGER_RANGE(e.toString(),s.toString());return at().min(e,{message:i}).max(s,{message:i})},jr=A({path:O(),size:pi().nonnegative()}).strict(),gc=A({size:pi().nonnegative()}).strict(),V=O().regex(/^\$.+/,{message:"must start with '$' followed by at least one character"}),eE=A({r:_t(0,255),g:_t(0,255),b:_t(0,255),a:_t(0,1)}).strict(),Ec=O().regex(dc,{message:Be.VALID_HEX_COLOR()});rs(e=>typeof e=="string"&&fc.test(e),{message:Be.VALID_GLOBAL_FONT()});const zr=O().refine(e=>!e.startsWith("global.")||fc.test(e),{message:Be.VALID_GLOBAL_FONT()});rs(e=>typeof e=="string"&&yc.test(e),{message:Be.VALID_GLOBAL_COLOR()});const st=rs(e=>typeof e=="string"&&(dc.test(e)||yc.test(e)),{message:Be.VALID_COLOR()}),Tc=rs(e=>typeof e=="string"?st.safeParse(e).success:Array.isArray(e)&&e.every(s=>st.safeParse(s).success),{message:Be.VALID_COLOR()});rs(e=>typeof e=="string"&&mc.test(e),{message:Be.VALID_GLOBAL_TEXT_SIZE()});const Sc=rs(e=>typeof e=="number"?Number.isInteger(e)&&e>=1:typeof e=="string"&&mc.test(e),{message:Be.VALID_TEXT_SIZE()}),_s=de(["catalog","category","product"]),yi=O().refine(e=>e.startsWith("#")||Ko().safeParse(e).success,{message:"must be a valid URL or a hash fragment starting with #"}),Os=A({url:O(),width:at().min(0,{message:Be.NON_NEGATIVE_INTEGER()}).optional(),height:at().min(0,{message:Be.NON_NEGATIVE_INTEGER()}).optional()}).strict(),tE=A({homogeneity:te().optional(),color:eE.optional()}).strict(),sE=A({ORIGINAL:Os.optional(),WEBP_LOW_RES:Os.optional(),WEBP_HI_2X_RES:Os.optional(),MOBILE_WEBP_LOW_RES:Os.optional(),MOBILE_WEBP_HI_RES:Os.optional()}).strict().refine(e=>Object.keys(e).length>=1,{message:"set must have at least one property"}),gi=A({set:sE,borderInfo:tE.optional()}).strict(),Vr=A({type:k(F.IMAGE),imageData:gi}).strict(),bc=A({type:k(F.IMAGE),label:V,static:te().optional(),defaults:Vr.optional()}).strict(),iE=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Gr(e){return e===Ft.PRODUCT||e===Ft.CATALOG||e===Ft.CATEGORY}function xc(e,s,i){if(!e)return;const a=Ip({path:"$..set..url",json:e,resultType:"all"}),c=/^https?:\/\//;a.forEach(u=>{const h=u.value;if(!c.test(h)&&!s.includes(h)){const f=u.pointer.split("/").filter(y=>y.length>0);i.at(f).addIssue("MISSING_IMAGE_ASSET",h)}})}function Ic(e,s,i){e===dt.HYPER_LINK&&!s&&i.at("link").addIssue("BUTTON_LINK_REQUIRED")}function Pc(e,s,i){(e===dt.GO_TO_CATEGORY||e===dt.GO_TO_CATEGORY_LINK)&&!s&&i.at("categoryId").addIssue("BUTTON_CATEGORY_ID_REQUIRED")}function wc(e,s,i){e===dt.MAIL_LINK&&!s&&i.at("email").addIssue("BUTTON_EMAIL_REQUIRED")}function Ac(e,s,i){e===dt.TEL_LINK&&!s&&i.at("phone").addIssue("BUTTON_PHONE_REQUIRED")}function Cc(e,s,i,a){if(e===dt.SCROLL_TO_TILE&&!(s??i)){const c=s?"tileId":"tileIdForScroll";a.at(c).addIssue("BUTTON_TILE_ID_REQUIRED",c)}}function rE(e,s,i){e===dt.GO_TO_PAGE&&!s&&i.at("pageIdForNavigate").addIssue("BUTTON_PAGE_ID_REQUIRED")}const nE="custom";function be(e,s=[]){const i=c=>Array.isArray(c)?c:[c],a=i(s);return{raw:e,addIssue(c,...u){e.addIssue({code:nE,message:Be[c](...u),path:a,params:{errorMessageKey:c}})},at(c){const u=a.concat(i(c));return be(e,u)}}}const Hr=A({type:k(F.BUTTON),title:V,buttonType:Ig,link:O().optional(),linkTarget:O().optional(),email:O().regex(iE,{message:Be.VALID_EMAIL()}).optional(),phone:O().optional(),tileId:O().optional(),categoryId:pi().optional()}).strict().superRefine((e,s)=>{const i=be(s);Ic(e.buttonType,e.link,i),Pc(e.buttonType,e.categoryId,i),wc(e.buttonType,e.email,i),Ac(e.buttonType,e.phone,i),Cc(e.buttonType,e.tileId,void 0,i)}),vc=A({type:k(F.BUTTON),label:V,defaults:Hr.optional()}).strict(),Zr=A({type:k(F.CATEGORY_SELECTOR)}).strict(),Nc=A({type:k(F.CATEGORY_SELECTOR),label:V,maxCategories:_t(1,32),defaults:Zr.optional()}).strict(),Wr=A({type:k(F.DIVIDER)}).strict(),_c=A({type:k(F.DIVIDER),label:V,defaults:Wr.optional()}).strict(),aE=A({label:V,link:yi}).strict(),oE=A({title:V.optional(),link:yi.optional()}).strict(),Kr=A({type:k(F.INFO),text:V.optional(),button:oE.optional()}).strict(),Oc=A({type:k(F.INFO),label:V,description:V,button:aE.optional(),defaults:Kr.optional()}).strict(),qr=A({type:k(F.INPUTBOX),text:V}).strict(),Lc=A({type:k(F.INPUTBOX),label:V,placeholder:V,defaults:qr.optional()}).strict(),Yr=A({type:k(F.PRODUCT_SELECTOR)}).strict(),kc=A({type:k(F.PRODUCT_SELECTOR),label:V,maxProducts:_t(1,32),defaults:Yr.optional()}).strict(),Jr=A({type:k(F.SELECTBOX),value:O()}).strict(),cE=A({value:O().min(1,{message:"value must not be empty"}),label:V}).strict(),Dc=A({type:k(F.SELECTBOX),label:V,placeholder:V,description:V,options:ne(cE).min(1,{message:"must have at least one option"}),defaults:Jr.optional()}).strict(),Xr=A({type:k(F.TEXTAREA),text:V}).strict(),Rc=A({type:k(F.TEXTAREA),label:V,placeholder:V,defaults:Xr.optional()}).strict(),Qr=A({type:k(F.TOGGLE),enabled:te()}).strict(),Mc=A({type:k(F.TOGGLE),label:V,description:V,defaults:Qr.optional()}).strict(),$c=A({type:k(F.DECK)}).strict(),Fc=[qr,Xr,Hr,Vr,Qr,Jr,Wr,Kr,Yr,Zr],lE=Ve("type",[...Fc]),uE=A({type:k(F.DECK),cards:ne(A({settings:Oe(O(),lE).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),hE=Ve("type",[...Fc,uE]),pE=A({type:k(F.DECK),cards:ne(A({settings:Oe(O(),hE).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()).min(1,{message:"cards must have at least one card"})}).strict(),Bc=[Lc,Rc,vc,bc,Mc,Dc,_c,Oc,Nc,kc],dE=A({type:k(F.DECK),label:V,addButtonLabel:V,maxCards:at().min(1,{message:"must be a positive integer"}),cards:A({defaultCardContent:A({label:V,settings:Oe(O(),Ve("type",[...Bc])).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:$c.optional()}).strict(),fE=Ve("type",[...Bc,dE]),mE=A({type:k(F.DECK),label:V,addButtonLabel:V,maxCards:at().min(1,{message:"must be a positive integer"}),cards:A({defaultCardContent:A({label:V,settings:Oe(O(),fE).superRefine((e,s)=>{Object.keys(e).length<1&&be(s).addIssue("DECK_SETTINGS_REQUIRED")})}).strict()}).strict(),defaults:$c.optional()}).strict(),Uc=A({type:k(F.LOGO),logoType:Rg.optional(),text:V.optional(),imageData:gi.optional()}).strict(),yE=A({type:k(F.LOGO),label:V.optional(),defaults:Uc.optional()}).strict(),jc=A({id:O(),title:O().optional(),type:O().optional(),link:O().optional(),email:O().optional(),phone:O().optional(),tileIdForScroll:O().optional(),pageIdForNavigate:O().optional(),showStoreCategories:te().optional(),isSubmenuOpened:te().optional(),categoryId:pi().optional()}).strict().superRefine((e,s)=>{const i=be(s);Ic(e.type,e.link,i),Pc(e.type,e.categoryId,i),wc(e.type,e.email,i),Ac(e.type,e.phone,i),Cc(e.type,void 0,e.tileIdForScroll,i),rE(e.type,e.pageIdForNavigate,i)}),zc=A({type:k(F.MENU),items:ne(jc).optional()}).strict(),gE=A({type:k(F.MENU),label:V.optional(),defaults:zc.optional()}).strict(),Vc=A({type:k(F.NAVIGATION_MENU),items:ne(jc).optional()}).strict(),EE=A({type:k(F.NAVIGATION_MENU),defaults:Vc.optional()}).strict(),Ei=A({type:k(K.BACKGROUND),style:Og.optional(),color:Tc.optional()}).strict().superRefine((e,s)=>{const i=be(s).at("color");e.style===mi.GRADIENT?e.color===void 0?i.addIssue("COLOR_REQUIRED_STYLE_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&i.addIssue("COLOR_ARRAY_LENGTH_STYLE_GRADIENT"):i.addIssue("COLOR_MUST_BE_ARRAY_STYLE_GRADIENT"):e.style===mi.COLOR&&(e.color===void 0?i.addIssue("COLOR_REQUIRED_STYLE_COLOR"):Array.isArray(e.color)&&i.addIssue("COLOR_MUST_BE_SINGLE_STYLE_COLOR"))}),TE=A({type:k(K.BACKGROUND),fieldName:O(),defaults:Ei.optional()}).strict(),Gc=A({type:k(K.BACKGROUND),label:V,colors:ne(st).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Ei.optional()}).strict(),Ti=A({type:k(K.BUTTON),appearance:wg.optional(),size:Cg.optional(),shape:Ng.optional(),font:zr.optional(),color:st.optional(),visible:te().optional()}).strict(),SE=A({type:k(K.BUTTON),fieldName:O(),defaults:Ti.optional()}).strict(),Hc=A({type:k(K.BUTTON),label:V,colors:ne(st).optional(),enableAutoColor:te().optional(),enableAlphaColor:te().optional(),hideVisibleToggle:te().optional(),hideSize:te().optional(),defaults:Ti.optional()}).strict(),Si=A({type:k(K.COLOR_PICKER),color:st.optional()}).strict(),bE=A({type:k(K.COLOR_PICKER),fieldName:O(),defaults:Si.optional()}).strict(),Zc=A({type:k(K.COLOR_PICKER),label:V,description:V.optional(),colors:ne(st).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),defaults:Si.optional()}).strict(),bi=A({type:k(K.DIVIDER)}).strict(),xE=A({type:k(K.DIVIDER),fieldName:O(),defaults:bi.optional()}).strict(),Wc=A({type:k(K.DIVIDER),label:V,defaults:bi.optional()}).strict(),xi=A({type:k(K.IMAGE),overlay:Pg.optional(),color:Tc.optional(),visible:te().optional()}).strict().superRefine((e,s)=>{const i=be(s).at("color");e.overlay===vs.GRADIENT?e.color===void 0?i.addIssue("COLOR_REQUIRED_GRADIENT"):Array.isArray(e.color)?e.color.length!==2&&i.addIssue("COLOR_ARRAY_LENGTH_GRADIENT"):i.addIssue("COLOR_MUST_BE_ARRAY_GRADIENT"):e.overlay===vs.COLOR?e.color===void 0?i.addIssue("COLOR_REQUIRED_COLOR"):Array.isArray(e.color)&&i.addIssue("COLOR_MUST_BE_SINGLE_COLOR"):(e.overlay===vs.NONE||e.overlay===void 0)&&e.color!==void 0&&i.addIssue("COLOR_MUST_BE_UNDEFINED_NONE")}),IE=A({type:k(K.IMAGE),fieldName:O(),defaults:xi.optional()}).strict(),Kc=A({type:k(K.IMAGE),label:V,static:te().optional(),colors:ne(Ec).optional(),enableAlphaColor:te().optional(),hideVisibleToggle:te().optional(),defaults:xi.optional()}).strict(),PE=A({label:V,link:yi}).strict(),wE=A({label:V.optional(),link:yi.optional()}).strict(),Ii=A({type:k(K.INFO),description:V.optional(),button:wE.optional()}).strict(),AE=A({type:k(K.INFO),fieldName:O(),defaults:Ii.optional()}).strict(),qc=A({type:k(K.INFO),label:V,description:V,button:PE.optional(),defaults:Ii.optional()}).strict(),CE=A({visible:te(),width:_t(1,49).optional(),color:st.optional()}).strict(),Pi=A({type:k(K.LOGO),font:zr.optional(),size:Sc.optional(),bold:te().optional(),italic:te().optional(),color:st.optional(),visible:te().optional(),spacing:_t(1,9).optional(),frame:CE.optional(),capitalization:de(["none","all","small"]).optional()}).strict(),vE=A({type:k(K.LOGO),fieldName:O(),defaults:Pi.optional()}).strict(),Yc=A({type:k(K.LOGO),label:V,colors:ne(st).optional(),sizes:ne(at().min(1,{message:"must be at least 1"})).optional(),defaults:Pi.optional()}).strict(),NE=A({value:O().optional(),label:V.optional()}).strict(),wi=A({type:k(K.SELECTBOX),value:O().optional()}).strict(),_E=A({type:k(K.SELECTBOX),fieldName:O(),defaults:wi.optional()}).strict(),Jc=A({type:k(K.SELECTBOX),label:V,description:V.optional(),options:ne(NE).optional(),defaults:wi.optional()}).strict(),Ai=A({type:k(K.TEXT),font:zr.optional(),size:Sc.optional(),bold:te().optional(),italic:te().optional(),color:st.optional(),visible:te().optional()}).strict(),OE=A({type:k(K.TEXT),fieldName:O(),defaults:Ai.optional()}).strict(),Xc=A({type:k(K.TEXT),label:V,colors:ne(Ec).optional(),sizes:ne(at().min(1,{message:"must be at least 1"})).optional(),enableAlphaColor:te().optional(),enableAutoColor:te().optional(),hideVisibleToggle:te().optional(),hideSize:te().optional(),defaults:Ai.optional()}).strict(),Ci=A({type:k(K.TOGGLE),enabled:te().optional()}).strict(),LE=A({type:k(K.TOGGLE),fieldName:O(),defaults:Ci.optional()}).strict(),Qc=A({type:k(K.TOGGLE),label:V,defaults:Ci.optional()}).strict();function kE(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_SHOWCASE_ITEMS_REQUIRED")}function DE(e,s){for(const[i,a]of Object.entries(e))Object.keys(a.editors).length===0&&s.at(["items",i,"editors"]).addIssue("ACCORDION_SHOWCASE_ITEM_EDITORS_REQUIRED",i)}function RE(e,s,i){Object.keys(e).length===0&&i.at("editors").addIssue("ACCORDION_ITEM_EDITORS_REQUIRED",s)}function ME(e,s){Object.keys(e).length===0&&s.at("items").addIssue("ACCORDION_ITEMS_REQUIRED")}function $E(e,s){for(const[i,a]of Object.entries(e))a.positionFieldName||s.at(["items",i,"positionFieldName"]).addIssue("ACCORDION_ITEM_POSITION_FIELD_REQUIRED",i)}function FE(e,s){const i=Object.values(e).map(a=>a.positionFieldName).filter(Boolean);new Set(i).size!==i.length&&s.at("items").addIssue("ACCORDION_DUPLICATE_POSITION_FIELD_NAME")}const el=A({type:k(K.ACCORDION)}).strict(),BE=Ve("type",[Ai,Ti,xi,Ci,wi,Ei,Si,Pi,bi,Ii]),UE=A({editors:Oe(O(),BE)}).strict(),jE=A({type:k(K.ACCORDION),items:Oe(O(),UE)}).strict().superRefine((e,s)=>{const i=be(s);kE(e.items,i),DE(e.items,i)}),zE=A({type:k(K.ACCORDION),fieldName:O(),defaults:el.optional()}).strict(),VE=Ve("type",[Xc,Hc,Kc,Qc,Jc,Gc,Zc,Yc,Wc,qc]),GE=A({label:V,positionFieldName:O().optional(),editors:Oe(O(),VE)}).strict().superRefine((e,s)=>{RE(e.editors,e.label,be(s))}),HE=A({type:k(K.ACCORDION),sortable:te().optional(),items:Oe(O(),GE),defaults:el.optional()}).strict().superRefine((e,s)=>{const i=be(s);ME(e.items,i),e.sortable===!0&&($E(e.items,i),FE(e.items,i))}),tl=Ve("type",[qr,Xr,Hr,Vr,Qr,Jr,zc,Vc,Uc,Wr,Kr,pE,Yr,Zr]),sl=Ve("type",[Ai,Ti,xi,Ci,wi,Ei,Si,Pi,bi,jE,Ii]),ZE=A({showcaseId:O(),blockName:O(),previewImage:gi,content:Oe(O(),tl),design:Oe(O(),sl),layoutId:O().optional()}).strict(),WE=A({blockName:O(),content:Oe(O(),tl).optional(),design:Oe(O(),sl).optional(),layoutId:O().optional()}).strict();function KE(e,s){Gr(e.type)&&(e.sections.length!==1?s.at("sections").addIssue("TEMPLATE_PAGE_SINGLE_SECTION_REQUIRED",e.type):e.sections[0]?.type!=="store"&&s.at(["sections",0,"type"]).addIssue("TEMPLATE_PAGE_STORE_SECTION_REQUIRED",e.type))}function qE(e,s){Gr(e.type)&&e.sections.length===0&&s.at("sections").addIssue("TEMPLATE_PAGE_SECTIONS_REQUIRED"),e.sections.forEach((i,a)=>{Gr(e.type)||i.type==="store"&&s.at(["sections",a,"type"]).addIssue("TEMPLATE_PAGE_NO_STORE_SECTIONS",e.type),i.type==="default"&&i.id&&(i.id==="header"||i.id==="footer")&&s.at(["sections",a,"id"]).addIssue("REQUIRED_PAGE_SECTION_TYPE")})}function YE(e,s){e.type==="CUSTOM"?e.metadata||s.at("metadata").addIssue("TEMPLATE_PAGE_CUSTOM_METADATA_REQUIRED"):e.metadata!==void 0&&s.at("metadata").addIssue("TEMPLATE_PAGE_METADATA_NOT_ALLOWED",e.type)}const JE=new RegExp(`^(${Object.values(Yg).join("|")})(_\\d{3})?$`),XE=O().regex(JE,"id must match pattern: [default_section_name] or [default_section_name]_XXX where XXX is three digits"),QE=O().regex(new RegExp("\\d{3}"),"showcase_id must be a three digit string"),il=A({type:k("default"),id:XE,showcase_id:QE.optional()}).strict(),en=A({type:k("custom"),id:O(),showcase_id:O().optional(),showcase_overrides:WE.optional(),category:Xg.optional()}).strict(),eT=A({type:k("store"),id:O().optional()}).strict(),tT=Ve("type",[il,en,eT]),sT=A({title:O()}).strict(),iT=A({metadata:sT.optional(),sections:ne(tT)}).strict(),rT=iT.safeExtend({type:Wg,id:O().min(1,{message:"id is required"})}).strict().superRefine((e,s)=>{const i=be(s);qE(e,i),KE(e,i),YE(e,i)}),rl=A({name:O().min(2,{message:"name must be at least 2 characters"}).max(60,{message:"name must be at most 60 characters"}),description:O().min(2,{message:"description must be at least 2 characters"}).max(150,{message:"description must be at most 150 characters"}),preview_url:Ko({message:"preview_url must be a valid URL"}).regex(/^(https?):\/\/([^.]+?\.)?(company\.site|ecwid\.qa)($|\/[A-Za-z0-9\-._~:/?#\[\]@!$&'()*+,;=]*)?$/,"preview_url must match pattern: (https?)://([^.]+?\\.)?(company\\.site|ecwid\\.qa)(...)?").optional(),cover_image:gi,categories:ne(zg).refine(e=>new Set(e).size===e.length,{message:"categories must contain unique items"}).optional()}).strict(),nT=il.extend({id:O()}),nl=Ve("type",[nT,en]),aT=A({metadata:rl,header:nl,footer:nl}).strict(),oT=A({id:O().min(1,{message:"id is required"}),assets:jr.array().optional(),configuration:aT,pages:ne(rT)}).strict(),vi=2097152,Ni=512e3;function mt(e,s=2){if(!+e)return"0 Bytes";const i=1024,a=s<0?0:s,c=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],u=Math.floor(Math.log(e)/Math.log(i));return`${parseFloat((e/i**u).toFixed(a))} ${c[u]}`}const cT={menu:{type:F.NAVIGATION_MENU},logo:{type:F.LOGO}},lT={logo:{type:"LOGO",label:"$label.logo.label",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{type:"LOGO",font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function al(e){switch(e){case $t.HEADER:return cT;default:return{}}}function ol(e){switch(e){case $t.HEADER:return lT;default:return{}}}function cl({validationType:e,sectionType:s}){switch(e){case Ns.CONTENT:return al(s);case Ns.DESIGN:return ol(s);default:return{}}}const uT=en.extend({id:O().min(1,{message:"section id is required"})}),hT=A({metadata:rl,sections:ne(uT).min(1,{message:"sections must contain at least one section"}).max(20,{message:"sections must contain at most 20 sections"})}).strict().superRefine((e,s)=>{e.metadata.name.trim().length===0&&be(s).at(["collection","metadata","name"]).addIssue("REQUIRED_COLLECTION_NAME")}),pT=A({id:O().min(1,{message:"id is required"}),descriptor:hT}).strict(),dT=Ve("type",[Lc,Rc,vc,bc,Mc,Dc,mE,gE,EE,yE,_c,Oc,kc,Nc]),tn=Oe(O(),dT),fT=Ve("type",[Xc,Hc,Kc,Qc,Jc,Gc,Zc,Yc,Wc,HE,qc]),sn=Oe(O(),fT),mT=Ve("type",[OE,SE,IE,LE,_E,TE,bE,vE,xE,AE,zE]),rn=A({layoutId:O(),layoutIcon:qg.optional(),selectedContentSettings:ne(O()),selectedDesignSettings:ne(mT)}).strict(),yT=O().regex(Qg,Be.VALID_LANGUAGE_CODE()),_i=Oe(yT,Oe(V,O()));function ll(e,s,i){if(!e||Object.keys(s).length===0)return;const a=Object.entries(s),c=a.map(([,{type:h}])=>h),u=Object.values(e).map(({type:h})=>h);Object.entries(e).forEach(([h,f])=>{const y=s[h];y&&"type"in y&&f.type!==y.type&&i.at(h).addIssue("MANDATORY_SETTING_TYPE_MISMATCH",f.type,h,y.type)}),Object.entries(e).forEach(([h,f])=>{const y=a.find(([,{type:T}])=>T===f.type)?.[0];y&&h!==y&&i.at(h).addIssue("MANDATORY_SETTING_NAME_MISMATCH",h,f.type,y)}),new Set(u.filter(h=>c.includes(h))).forEach(h=>{if(u.filter(f=>f===h).length>1){const f=a.findLast(([,{type:y}])=>y===h)?.[0];i.at(f).addIssue("DUPLICATED_MANDATORY_SETTING",h)}})}function ul(e,s,i){xc(e,s,i)}function hl(e,s,i){if(e.type!==F.DECK||s.type!==F.DECK)return;const a=s.cards?.defaultCardContent?.settings,c=e.cards;!a||!Array.isArray(c)||c.forEach((u,h)=>{u.settings&&Object.entries(u.settings).forEach(([f,y])=>{const T=a[f],x=i.at(["cards",h,"settings",f]);if(!T){x.addIssue("INVALID_DECK_CARD_SETTING",f);return}if(y.type!==T.type){x.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",f,y.type,T.type);return}y.type===F.DECK&&T.type===F.DECK&&hl(y,T,x)})})}function gT(e,s,i){e.content&&Object.entries(e.content).forEach(([a,c])=>{const u=i.at(["content",a]),h=s[a];if(!h){u.addIssue("INVALID_SHOWCASE_CONTENT_ELEMENT",a);return}if(c.type!==h.type){u.addIssue("SHOWCASE_CONTENT_ELEMENT_TYPE_MISMATCH",a,c.type,h.type);return}if(c.type===F.SELECTBOX&&h.type===F.SELECTBOX){const f=h,y=c;f.options&&y.value!==void 0&&(new Set(f.options.map(T=>T.value)).has(y.value)||u.addIssue("INVALID_SELECTBOX_OPTION",y.value,a))}c.type===F.DECK&&hl(c,h,u)})}function ET(e,s,i){e.design&&Object.entries(e.design).forEach(([a,c])=>{const u=i.at(["design",a]),h=s[a];if(!h){u.addIssue("INVALID_SHOWCASE_DESIGN_ELEMENT",a);return}c.type!==h.type&&u.addIssue("SHOWCASE_DESIGN_ELEMENT_TYPE_MISMATCH",a,c.type,h.type)})}function TT(e,s){Object.entries(e).flatMap(([i,a])=>{switch(a.type){case K.ACCORDION:return Object.entries(a.items).flatMap(([c,u])=>Object.keys(u.editors).map(h=>({name:h,path:[i,"items",c,"editors",h]})));default:return[{name:i,path:[i]}]}}).filter(({name:i},a,c)=>c.findIndex(u=>u.name===i)<a).forEach(({path:i})=>s.at(i).addIssue("DUPLICATE_DESIGN_EDITOR_NAME"))}function ST(e,s,i){e.layoutId&&((s||[]).some(a=>a.layoutId===e.layoutId)||i.at("layoutId").addIssue("SHOWCASE_LAYOUT",e.layoutId))}function bT(e,s){const i=new Set;e.forEach((a,c)=>{if(i.has(a.showcaseId)){s.at([c,"showcaseId"]).addIssue("DUPLICATE_SHOWCASE_ID",a.showcaseId);return}i.add(a.showcaseId)})}function pl(e,s,i){for(const[a,c]of Object.entries(e)){const u=c;if(u.type===F.IMAGE){const h=s[a];if(h?.type===K.IMAGE){const f=u.static??!1,y=h.static??!1;f!==y&&i.at(a).addIssue("IMAGE_EDITOR_STATIC_MISMATCH",a)}}else if(u.type===F.DECK){const h=u;h.cards?.defaultCardContent?.settings&&pl(h.cards.defaultCardContent.settings,s,i.at([a,"cards","defaultCardContent","settings"]))}}}function xT(e,s,i){s>vi&&i.at(Te.basename(e)).addIssue("REQUIRED_SECTION_ASSET",mt(s),mt(vi))}function IT(e,s){e>Ni&&s.addIssue("REQUIRED_SERVER_SIZE",mt(e),mt(Ni))}const PT=A({id:O(),type:Lg,name:O(),content:tn,design:sn,layout:ne(rn).optional(),showcase:ne(ZE),translationsSettings:_i.optional(),translationsShowcases:_i.optional(),assets:jr.array().optional(),server:gc,previewCount:at().optional()}).strict().superRefine((e,s)=>{const i=be(s),a=cl({validationType:Ns.CONTENT,sectionType:e.type}),c=cl({validationType:Ns.DESIGN,sectionType:e.type});ll(e.content,a,i.at("content")),ll(e.design,c,i.at("design")),pl(e.content,e.design,i.at("content")),TT(e.design,i.at("design")),e.assets&&e.assets.forEach(h=>{xT(h.path,h.size,i.at("assets"))}),IT(e.server.size,i.at("server"));const u=e.assets?.map(h=>h.path)??[];ul(e.content,u,i.at("content")),bT(e.showcase,i.at("showcase")),e.showcase.forEach((h,f)=>{const y=i.at(["showcase",f]);ul(h,u,y),gT(h,e.content,y),ET(h,e.design,y),ST(h,e.layout,y)})}),wT=A({translations:_i.optional()}).strict();function AT(e){return typeof e=="object"&&e!==null&&e.type==="ACCORDION"}function CT(e){const s=[];for(const[i,a]of Object.entries(e))if(s.push(i),AT(a)){const c=a.items;if(c!==void 0)for(const u of Object.values(c)){const h=u.editors;h!==void 0&&s.push(...Object.keys(h))}}return s}var as={},dl;function vT(){if(dl)return as;dl=1,Object.defineProperty(as,"__esModule",{value:!0});function e(p,r){if(p==null)return{};var t={};for(var n in p)if({}.hasOwnProperty.call(p,n)){if(r.indexOf(n)!==-1)continue;t[n]=p[n]}return t}class s{constructor(r,t,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=r,this.column=t,this.index=n}}class i{constructor(r,t){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=r,this.end=t}}function a(p,r){const{line:t,column:n,index:o}=p;return new s(t,n+r,o+r)}const c="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";var u={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:c},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:c}};const h={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},f=p=>p.type==="UpdateExpression"?h.UpdateExpression[`${p.prefix}`]:h[p.type];var y={AccessorIsGenerator:({kind:p})=>`A ${p}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:p})=>`Missing initializer in ${p} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:p})=>`\`${p}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:p,exportName:r})=>`A string literal cannot be used as an exported binding without \`from\`.
40
+ - Did you mean \`export { '${p}' as '${r}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:p})=>`'${p==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:p})=>`Unsyntactic ${p==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:p})=>`A string literal cannot be used as an imported binding.
41
+ - Did you mean \`import { "${p}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:p})=>`Expected number in radix ${p}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:p})=>`Escape sequence in keyword ${p}.`,InvalidIdentifier:({identifierName:p})=>`Invalid identifier ${p}.`,InvalidLhs:({ancestor:p})=>`Invalid left-hand side in ${f(p)}.`,InvalidLhsBinding:({ancestor:p})=>`Binding invalid left-hand side in ${f(p)}.`,InvalidLhsOptionalChaining:({ancestor:p})=>`Invalid optional chaining in the left-hand side of ${f(p)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:p})=>`Unexpected character '${p}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:p})=>`Private name #${p} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:p})=>`Label '${p}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:p})=>`This experimental syntax requires enabling the parser plugin: ${p.map(r=>JSON.stringify(r)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:p})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${p.map(r=>JSON.stringify(r)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:p})=>`Duplicate key "${p}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:p})=>`An export name cannot include a lone surrogate, found '\\u${p.toString(16)}'.`,ModuleExportUndefined:({localName:p})=>`Export '${p}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:p})=>`Private names are only allowed in property accesses (\`obj.#${p}\`) or in \`in\` expressions (\`#${p} in obj\`).`,PrivateNameRedeclaration:({identifierName:p})=>`Duplicate private name #${p}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:p})=>`Unexpected keyword '${p}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:p})=>`Unexpected reserved word '${p}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:p,unexpected:r})=>`Unexpected token${r?` '${r}'.`:""}${p?`, expected "${p}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:p,onlyValidPropertyName:r})=>`The only valid meta property for ${p} is ${p}.${r}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:p})=>`Identifier '${p}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},T={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:p})=>`Assigning to '${p}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:p})=>`Binding '${p}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},x={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:p})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(p)}\`.`};const P=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var L=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:p})=>`Invalid topic token ${p}. In order to use ${p} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${p}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:p})=>`Hack-style pipe body cannot be an unparenthesized ${f({type:p})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'});const R=["message"];function ae(p,r,t){Object.defineProperty(p,r,{enumerable:!1,configurable:!0,value:t})}function ce({toMessage:p,code:r,reasonCode:t,syntaxPlugin:n}){const o=t==="MissingPlugin"||t==="MissingOneOfPlugins",l={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return l[t]&&(t=l[t]),function d(m,g){const E=new SyntaxError;return E.code=r,E.reasonCode=t,E.loc=m,E.pos=m.index,E.syntaxPlugin=n,o&&(E.missingPlugin=g.missingPlugin),ae(E,"clone",function(I={}){var C;const{line:N,column:M,index:Q}=(C=I.loc)!=null?C:m;return d(new s(N,M,Q),Object.assign({},g,I.details))}),ae(E,"details",g),Object.defineProperty(E,"message",{configurable:!0,get(){const b=`${p(g)} (${m.line}:${m.column})`;return this.message=b,b},set(b){Object.defineProperty(this,"message",{value:b,writable:!0})}}),E}}function Ce(p,r){if(Array.isArray(p))return n=>Ce(n,p[0]);const t={};for(const n of Object.keys(p)){const o=p[n],l=typeof o=="string"?{message:()=>o}:typeof o=="function"?{message:o}:o,{message:d}=l,m=e(l,R),g=typeof d=="string"?()=>d:d;t[n]=ce(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:n,toMessage:g},r?{syntaxPlugin:r}:{},m))}return t}const S=Object.assign({},Ce(u),Ce(y),Ce(T),Ce(x),Ce`pipelineOperator`(L));function gs(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function $e(p){const r=gs();if(p==null)return r;if(p.annexB!=null&&p.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(const t of Object.keys(r))p[t]!=null&&(r[t]=p[t]);if(r.startLine===1)p.startIndex==null&&r.startColumn>0?r.startIndex=r.startColumn:p.startColumn==null&&r.startIndex>0&&(r.startColumn=r.startIndex);else if((p.startColumn==null||p.startIndex==null)&&p.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(r.sourceType==="commonjs"){if(p.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(p.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(p.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return r}const{defineProperty:Ae}=Object,_e=(p,r)=>{p&&Ae(p,r,{enumerable:!1,value:p[r]})};function bt(p){return _e(p.loc.start,"index"),_e(p.loc.end,"index"),p}var Wt=p=>class extends p{parse(){const t=bt(super.parse());return this.optionFlags&256&&(t.tokens=t.tokens.map(bt)),t}parseRegExpLiteral({pattern:t,flags:n}){let o=null;try{o=new RegExp(t,n)}catch{}const l=this.estreeParseLiteral(o);return l.regex={pattern:t,flags:n},l}parseBigIntLiteral(t){let n;try{n=BigInt(t)}catch{n=null}const o=this.estreeParseLiteral(n);return o.bigint=String(o.value||t),o}parseDecimalLiteral(t){const o=this.estreeParseLiteral(null);return o.decimal=String(o.value||t),o}estreeParseLiteral(t){return this.parseLiteral(t,"Literal")}parseStringLiteral(t){return this.estreeParseLiteral(t)}parseNumericLiteral(t){return this.estreeParseLiteral(t)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(t){return this.estreeParseLiteral(t)}estreeParseChainExpression(t,n){const o=this.startNodeAtNode(t);return o.expression=t,this.finishNodeAt(o,"ChainExpression",n)}directiveToStmt(t){const n=t.value;delete t.value,this.castNodeTo(n,"Literal"),n.raw=n.extra.raw,n.value=n.extra.expressionValue;const o=this.castNodeTo(t,"ExpressionStatement");return o.expression=n,o.directive=n.extra.rawValue,delete n.extra,o}fillOptionalPropertiesForTSESLint(t){}cloneEstreeStringLiteral(t){const{start:n,end:o,loc:l,range:d,raw:m,value:g}=t,E=Object.create(t.constructor.prototype);return E.type="Literal",E.start=n,E.end=o,E.loc=l,E.range=d,E.raw=m,E.value=g,E}initFunction(t,n){super.initFunction(t,n),t.expression=!1}checkDeclaration(t){t!=null&&this.isObjectProperty(t)?this.checkDeclaration(t.value):super.checkDeclaration(t)}getObjectOrClassMethodParams(t){return t.value.params}isValidDirective(t){var n;return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&!((n=t.expression.extra)!=null&&n.parenthesized)}parseBlockBody(t,n,o,l,d){super.parseBlockBody(t,n,o,l,d);const m=t.directives.map(g=>this.directiveToStmt(g));t.body=m.concat(t.body),delete t.directives}parsePrivateName(){const t=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(t):t}convertPrivateNameToPrivateIdentifier(t){const n=super.getPrivateNameSV(t);return delete t.id,t.name=n,this.castNodeTo(t,"PrivateIdentifier")}isPrivateName(t){return this.getPluginOption("estree","classFeatures")?t.type==="PrivateIdentifier":super.isPrivateName(t)}getPrivateNameSV(t){return this.getPluginOption("estree","classFeatures")?t.name:super.getPrivateNameSV(t)}parseLiteral(t,n){const o=super.parseLiteral(t,n);return o.raw=o.extra.raw,delete o.extra,o}parseFunctionBody(t,n,o=!1){super.parseFunctionBody(t,n,o),t.expression=t.body.type!=="BlockStatement"}parseMethod(t,n,o,l,d,m,g=!1){let E=this.startNode();E.kind=t.kind,E=super.parseMethod(E,n,o,l,d,m,g),delete E.kind;const{typeParameters:b}=t;b&&(delete t.typeParameters,E.typeParameters=b,this.resetStartLocationFromNode(E,b));const I=this.castNodeTo(E,"FunctionExpression");return t.value=I,m==="ClassPrivateMethod"&&(t.computed=!1),m==="ObjectMethod"?(t.kind==="method"&&(t.kind="init"),t.shorthand=!1,this.finishNode(t,"Property")):this.finishNode(t,"MethodDefinition")}nameIsConstructor(t){return t.type==="Literal"?t.value==="constructor":super.nameIsConstructor(t)}parseClassProperty(...t){const n=super.parseClassProperty(...t);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(n,"PropertyDefinition"),n}parseClassPrivateProperty(...t){const n=super.parseClassPrivateProperty(...t);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(n,"PropertyDefinition"),n.computed=!1),n}parseClassAccessorProperty(t){const n=super.parseClassAccessorProperty(t);return this.getPluginOption("estree","classFeatures")&&(n.abstract&&this.hasPlugin("typescript")?(delete n.abstract,this.castNodeTo(n,"TSAbstractAccessorProperty")):this.castNodeTo(n,"AccessorProperty")),n}parseObjectProperty(t,n,o,l){const d=super.parseObjectProperty(t,n,o,l);return d&&(d.kind="init",this.castNodeTo(d,"Property")),d}finishObjectProperty(t){return t.kind="init",this.finishNode(t,"Property")}isValidLVal(t,n,o,l){return t==="Property"?"value":super.isValidLVal(t,n,o,l)}isAssignable(t,n){return t!=null&&this.isObjectProperty(t)?this.isAssignable(t.value,n):super.isAssignable(t,n)}toAssignable(t,n=!1){if(t!=null&&this.isObjectProperty(t)){const{key:o,value:l}=t;this.isPrivateName(o)&&this.classScope.usePrivateName(this.getPrivateNameSV(o),o.loc.start),this.toAssignable(l,n)}else super.toAssignable(t,n)}toAssignableObjectExpressionProp(t,n,o){t.type==="Property"&&(t.kind==="get"||t.kind==="set")?this.raise(S.PatternHasAccessor,t.key):t.type==="Property"&&t.method?this.raise(S.PatternHasMethod,t.key):super.toAssignableObjectExpressionProp(t,n,o)}finishCallExpression(t,n){const o=super.finishCallExpression(t,n);if(o.callee.type==="Import"){var l,d;this.castNodeTo(o,"ImportExpression"),o.source=o.arguments[0],o.options=(l=o.arguments[1])!=null?l:null,o.attributes=(d=o.arguments[1])!=null?d:null,delete o.arguments,delete o.callee}else o.type==="OptionalCallExpression"?this.castNodeTo(o,"CallExpression"):o.optional=!1;return o}toReferencedArguments(t){t.type!=="ImportExpression"&&super.toReferencedArguments(t)}parseExport(t,n){const o=this.state.lastTokStartLoc,l=super.parseExport(t,n);switch(l.type){case"ExportAllDeclaration":l.exported=null;break;case"ExportNamedDeclaration":l.specifiers.length===1&&l.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(l,"ExportAllDeclaration"),l.exported=l.specifiers[0].exported,delete l.specifiers);case"ExportDefaultDeclaration":{var d;const{declaration:m}=l;m?.type==="ClassDeclaration"&&((d=m.decorators)==null?void 0:d.length)>0&&m.start===l.start&&this.resetStartLocation(l,o)}break}return l}stopParseSubscript(t,n){const o=super.stopParseSubscript(t,n);return n.optionalChainMember?this.estreeParseChainExpression(o,t.loc.end):o}parseMember(t,n,o,l,d){const m=super.parseMember(t,n,o,l,d);return m.type==="OptionalMemberExpression"?this.castNodeTo(m,"MemberExpression"):m.optional=!1,m}isOptionalMemberExpression(t){return t.type==="ChainExpression"?t.expression.type==="MemberExpression":super.isOptionalMemberExpression(t)}hasPropertyAsPrivateName(t){return t.type==="ChainExpression"&&(t=t.expression),super.hasPropertyAsPrivateName(t)}isObjectProperty(t){return t.type==="Property"&&t.kind==="init"&&!t.method}isObjectMethod(t){return t.type==="Property"&&(t.method||t.kind==="get"||t.kind==="set")}castNodeTo(t,n){const o=super.castNodeTo(t,n);return this.fillOptionalPropertiesForTSESLint(o),o}cloneIdentifier(t){const n=super.cloneIdentifier(t);return this.fillOptionalPropertiesForTSESLint(n),n}cloneStringLiteral(t){return t.type==="Literal"?this.cloneEstreeStringLiteral(t):super.cloneStringLiteral(t)}finishNodeAt(t,n,o){return bt(super.finishNodeAt(t,n,o))}finishNode(t,n){const o=super.finishNode(t,n);return this.fillOptionalPropertiesForTSESLint(o),o}resetStartLocation(t,n){super.resetStartLocation(t,n),bt(t)}resetEndLocation(t,n=this.state.lastTokEndLoc){super.resetEndLocation(t,n),bt(t)}};class X{constructor(r,t){this.token=void 0,this.preserveSpace=void 0,this.token=r,this.preserveSpace=!!t}}const $={brace:new X("{"),j_oTag:new X("<tag"),j_cTag:new X("</tag"),j_expr:new X("<tag>...</tag>",!0)};$.template=new X("`",!0);const z=!0,v=!0,Kt=!0,Es=!0,xt=!0,Zu=!0;class Bn{constructor(r,t={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=r,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop!=null?t.binop:null,this.updateContext=null}}const tr=new Map;function Y(p,r={}){r.keyword=p;const t=B(p,r);return tr.set(p,t),t}function ke(p,r){return B(p,{beforeExpr:z,binop:r})}let Ts=-1;const lt=[],sr=[],ir=[],rr=[],nr=[],ar=[];function B(p,r={}){var t,n,o,l;return++Ts,sr.push(p),ir.push((t=r.binop)!=null?t:-1),rr.push((n=r.beforeExpr)!=null?n:!1),nr.push((o=r.startsExpr)!=null?o:!1),ar.push((l=r.prefix)!=null?l:!1),lt.push(new Bn(p,r)),Ts}function Z(p,r={}){var t,n,o,l;return++Ts,tr.set(p,Ts),sr.push(p),ir.push((t=r.binop)!=null?t:-1),rr.push((n=r.beforeExpr)!=null?n:!1),nr.push((o=r.startsExpr)!=null?o:!1),ar.push((l=r.prefix)!=null?l:!1),lt.push(new Bn("name",r)),Ts}const Wu={bracketL:B("[",{beforeExpr:z,startsExpr:v}),bracketHashL:B("#[",{beforeExpr:z,startsExpr:v}),bracketBarL:B("[|",{beforeExpr:z,startsExpr:v}),bracketR:B("]"),bracketBarR:B("|]"),braceL:B("{",{beforeExpr:z,startsExpr:v}),braceBarL:B("{|",{beforeExpr:z,startsExpr:v}),braceHashL:B("#{",{beforeExpr:z,startsExpr:v}),braceR:B("}"),braceBarR:B("|}"),parenL:B("(",{beforeExpr:z,startsExpr:v}),parenR:B(")"),comma:B(",",{beforeExpr:z}),semi:B(";",{beforeExpr:z}),colon:B(":",{beforeExpr:z}),doubleColon:B("::",{beforeExpr:z}),dot:B("."),question:B("?",{beforeExpr:z}),questionDot:B("?."),arrow:B("=>",{beforeExpr:z}),template:B("template"),ellipsis:B("...",{beforeExpr:z}),backQuote:B("`",{startsExpr:v}),dollarBraceL:B("${",{beforeExpr:z,startsExpr:v}),templateTail:B("...`",{startsExpr:v}),templateNonTail:B("...${",{beforeExpr:z,startsExpr:v}),at:B("@"),hash:B("#",{startsExpr:v}),interpreterDirective:B("#!..."),eq:B("=",{beforeExpr:z,isAssign:Es}),assign:B("_=",{beforeExpr:z,isAssign:Es}),slashAssign:B("_=",{beforeExpr:z,isAssign:Es}),xorAssign:B("_=",{beforeExpr:z,isAssign:Es}),moduloAssign:B("_=",{beforeExpr:z,isAssign:Es}),incDec:B("++/--",{prefix:xt,postfix:Zu,startsExpr:v}),bang:B("!",{beforeExpr:z,prefix:xt,startsExpr:v}),tilde:B("~",{beforeExpr:z,prefix:xt,startsExpr:v}),doubleCaret:B("^^",{startsExpr:v}),doubleAt:B("@@",{startsExpr:v}),pipeline:ke("|>",0),nullishCoalescing:ke("??",1),logicalOR:ke("||",1),logicalAND:ke("&&",2),bitwiseOR:ke("|",3),bitwiseXOR:ke("^",4),bitwiseAND:ke("&",5),equality:ke("==/!=/===/!==",6),lt:ke("</>/<=/>=",7),gt:ke("</>/<=/>=",7),relational:ke("</>/<=/>=",7),bitShift:ke("<</>>/>>>",8),bitShiftL:ke("<</>>/>>>",8),bitShiftR:ke("<</>>/>>>",8),plusMin:B("+/-",{beforeExpr:z,binop:9,prefix:xt,startsExpr:v}),modulo:B("%",{binop:10,startsExpr:v}),star:B("*",{binop:10}),slash:ke("/",10),exponent:B("**",{beforeExpr:z,binop:11,rightAssociative:!0}),_in:Y("in",{beforeExpr:z,binop:7}),_instanceof:Y("instanceof",{beforeExpr:z,binop:7}),_break:Y("break"),_case:Y("case",{beforeExpr:z}),_catch:Y("catch"),_continue:Y("continue"),_debugger:Y("debugger"),_default:Y("default",{beforeExpr:z}),_else:Y("else",{beforeExpr:z}),_finally:Y("finally"),_function:Y("function",{startsExpr:v}),_if:Y("if"),_return:Y("return",{beforeExpr:z}),_switch:Y("switch"),_throw:Y("throw",{beforeExpr:z,prefix:xt,startsExpr:v}),_try:Y("try"),_var:Y("var"),_const:Y("const"),_with:Y("with"),_new:Y("new",{beforeExpr:z,startsExpr:v}),_this:Y("this",{startsExpr:v}),_super:Y("super",{startsExpr:v}),_class:Y("class",{startsExpr:v}),_extends:Y("extends",{beforeExpr:z}),_export:Y("export"),_import:Y("import",{startsExpr:v}),_null:Y("null",{startsExpr:v}),_true:Y("true",{startsExpr:v}),_false:Y("false",{startsExpr:v}),_typeof:Y("typeof",{beforeExpr:z,prefix:xt,startsExpr:v}),_void:Y("void",{beforeExpr:z,prefix:xt,startsExpr:v}),_delete:Y("delete",{beforeExpr:z,prefix:xt,startsExpr:v}),_do:Y("do",{isLoop:Kt,beforeExpr:z}),_for:Y("for",{isLoop:Kt}),_while:Y("while",{isLoop:Kt}),_as:Z("as",{startsExpr:v}),_assert:Z("assert",{startsExpr:v}),_async:Z("async",{startsExpr:v}),_await:Z("await",{startsExpr:v}),_defer:Z("defer",{startsExpr:v}),_from:Z("from",{startsExpr:v}),_get:Z("get",{startsExpr:v}),_let:Z("let",{startsExpr:v}),_meta:Z("meta",{startsExpr:v}),_of:Z("of",{startsExpr:v}),_sent:Z("sent",{startsExpr:v}),_set:Z("set",{startsExpr:v}),_source:Z("source",{startsExpr:v}),_static:Z("static",{startsExpr:v}),_using:Z("using",{startsExpr:v}),_yield:Z("yield",{startsExpr:v}),_asserts:Z("asserts",{startsExpr:v}),_checks:Z("checks",{startsExpr:v}),_exports:Z("exports",{startsExpr:v}),_global:Z("global",{startsExpr:v}),_implements:Z("implements",{startsExpr:v}),_intrinsic:Z("intrinsic",{startsExpr:v}),_infer:Z("infer",{startsExpr:v}),_is:Z("is",{startsExpr:v}),_mixins:Z("mixins",{startsExpr:v}),_proto:Z("proto",{startsExpr:v}),_require:Z("require",{startsExpr:v}),_satisfies:Z("satisfies",{startsExpr:v}),_keyof:Z("keyof",{startsExpr:v}),_readonly:Z("readonly",{startsExpr:v}),_unique:Z("unique",{startsExpr:v}),_abstract:Z("abstract",{startsExpr:v}),_declare:Z("declare",{startsExpr:v}),_enum:Z("enum",{startsExpr:v}),_module:Z("module",{startsExpr:v}),_namespace:Z("namespace",{startsExpr:v}),_interface:Z("interface",{startsExpr:v}),_type:Z("type",{startsExpr:v}),_opaque:Z("opaque",{startsExpr:v}),name:B("name",{startsExpr:v}),placeholder:B("%%",{startsExpr:v}),string:B("string",{startsExpr:v}),num:B("num",{startsExpr:v}),bigint:B("bigint",{startsExpr:v}),decimal:B("decimal",{startsExpr:v}),regexp:B("regexp",{startsExpr:v}),privateName:B("#name",{startsExpr:v}),eof:B("eof"),jsxName:B("jsxName"),jsxText:B("jsxText",{beforeExpr:z}),jsxTagStart:B("jsxTagStart",{startsExpr:v}),jsxTagEnd:B("jsxTagEnd")};function ie(p){return p>=93&&p<=133}function Ku(p){return p<=92}function Xe(p){return p>=58&&p<=133}function Un(p){return p>=58&&p<=137}function qu(p){return rr[p]}function Ss(p){return nr[p]}function Yu(p){return p>=29&&p<=33}function jn(p){return p>=129&&p<=131}function Ju(p){return p>=90&&p<=92}function or(p){return p>=58&&p<=92}function Xu(p){return p>=39&&p<=59}function Qu(p){return p===34}function eh(p){return ar[p]}function th(p){return p>=121&&p<=123}function sh(p){return p>=124&&p<=130}function It(p){return sr[p]}function Vs(p){return ir[p]}function ih(p){return p===57}function Gs(p){return p>=24&&p<=25}function ut(p){return lt[p]}lt[8].updateContext=p=>{p.pop()},lt[5].updateContext=lt[7].updateContext=lt[23].updateContext=p=>{p.push($.brace)},lt[22].updateContext=p=>{p[p.length-1]===$.template?p.pop():p.push($.template)},lt[143].updateContext=p=>{p.push($.j_expr,$.j_oTag)};let cr="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",zn="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";const rh=new RegExp("["+cr+"]"),nh=new RegExp("["+cr+zn+"]");cr=zn=null;const Vn=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],ah=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function lr(p,r){let t=65536;for(let n=0,o=r.length;n<o;n+=2){if(t+=r[n],t>p)return!1;if(t+=r[n+1],t>=p)return!0}return!1}function nt(p){return p<65?p===36:p<=90?!0:p<97?p===95:p<=122?!0:p<=65535?p>=170&&rh.test(String.fromCharCode(p)):lr(p,Vn)}function kt(p){return p<48?p===36:p<58?!0:p<65?!1:p<=90?!0:p<97?p===95:p<=122?!0:p<=65535?p>=170&&nh.test(String.fromCharCode(p)):lr(p,Vn)||lr(p,ah)}const ur={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},oh=new Set(ur.keyword),ch=new Set(ur.strict),lh=new Set(ur.strictBind);function Gn(p,r){return r&&p==="await"||p==="enum"}function Hn(p,r){return Gn(p,r)||ch.has(p)}function Zn(p){return lh.has(p)}function Wn(p,r){return Hn(p,r)||Zn(p)}function uh(p){return oh.has(p)}function hh(p,r,t){return p===64&&r===64&&nt(t)}const ph=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function dh(p){return ph.has(p)}class hr{constructor(r){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=r}}class pr{constructor(r,t){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=r,this.inModule=t}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){const r=this.currentThisScopeFlags();return(r&64)>0&&(r&2)===0}get inStaticBlock(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&128)return!0;if(t&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(r){return new hr(r)}enter(r){this.scopeStack.push(this.createScope(r))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(r){return!!(r.flags&130||!this.parser.inModule&&r.flags&1)}declareName(r,t,n){let o=this.currentScope();if(t&8||t&16){this.checkRedeclarationInScope(o,r,t,n);let l=o.names.get(r)||0;t&16?l=l|4:(o.firstLexicalName||(o.firstLexicalName=r),l=l|2),o.names.set(r,l),t&8&&this.maybeExportDefined(o,r)}else if(t&4)for(let l=this.scopeStack.length-1;l>=0&&(o=this.scopeStack[l],this.checkRedeclarationInScope(o,r,t,n),o.names.set(r,(o.names.get(r)||0)|1),this.maybeExportDefined(o,r),!(o.flags&1667));--l);this.parser.inModule&&o.flags&1&&this.undefinedExports.delete(r)}maybeExportDefined(r,t){this.parser.inModule&&r.flags&1&&this.undefinedExports.delete(t)}checkRedeclarationInScope(r,t,n,o){this.isRedeclaredInScope(r,t,n)&&this.parser.raise(S.VarRedeclaration,o,{identifierName:t})}isRedeclaredInScope(r,t,n){if(!(n&1))return!1;if(n&8)return r.names.has(t);const o=r.names.get(t)||0;return n&16?(o&2)>0||!this.treatFunctionsAsVarInScope(r)&&(o&1)>0:(o&2)>0&&!(r.flags&8&&r.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(r)&&(o&4)>0}checkLocalExport(r){const{name:t}=r;this.scopeStack[0].names.has(t)||this.undefinedExports.set(t,r.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&1667)return t}}currentThisScopeFlags(){for(let r=this.scopeStack.length-1;;r--){const{flags:t}=this.scopeStack[r];if(t&1731&&!(t&4))return t}}}class fh extends hr{constructor(...r){super(...r),this.declareFunctions=new Set}}class mh extends pr{createScope(r){return new fh(r)}declareName(r,t,n){const o=this.currentScope();if(t&2048){this.checkRedeclarationInScope(o,r,t,n),this.maybeExportDefined(o,r),o.declareFunctions.add(r);return}super.declareName(r,t,n)}isRedeclaredInScope(r,t,n){if(super.isRedeclaredInScope(r,t,n))return!0;if(n&2048&&!r.declareFunctions.has(t)){const o=r.names.get(t);return(o&4)>0||(o&2)>0}return!1}checkLocalExport(r){this.scopeStack[0].declareFunctions.has(r.name)||super.checkLocalExport(r)}}const yh=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),j=Ce`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:p})=>`Cannot overwrite reserved type ${p}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:p,enumName:r})=>`Boolean enum members need to be initialized. Use either \`${p} = true,\` or \`${p} = false,\` in enum \`${r}\`.`,EnumDuplicateMemberName:({memberName:p,enumName:r})=>`Enum member names need to be unique, but the name \`${p}\` has already been used before in enum \`${r}\`.`,EnumInconsistentMemberValues:({enumName:p})=>`Enum \`${p}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:p,enumName:r})=>`Enum type \`${p}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${r}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:p})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${p}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:p,memberName:r,explicitType:t})=>`Enum \`${p}\` has type \`${t}\`, so the initializer of \`${r}\` needs to be a ${t} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:p,memberName:r})=>`Symbol enum members cannot be initialized. Use \`${r},\` in enum \`${p}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:p,memberName:r})=>`The enum member initializer for \`${r}\` needs to be a literal (either a boolean, number, or string) in enum \`${p}\`.`,EnumInvalidMemberName:({enumName:p,memberName:r,suggestion:t})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${r}\`, consider using \`${t}\`, in enum \`${p}\`.`,EnumNumberMemberNotInitialized:({enumName:p,memberName:r})=>`Number enum members need to be initialized, e.g. \`${r} = 1\` in enum \`${p}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:p})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${p}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:p})=>`Unexpected reserved type ${p}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:p,suggestion:r})=>`\`declare export ${p}\` is not supported. Use \`${r}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function gh(p){return p.type==="DeclareExportAllDeclaration"||p.type==="DeclareExportDeclaration"&&(!p.declaration||p.declaration.type!=="TypeAlias"&&p.declaration.type!=="InterfaceDeclaration")}function Kn(p){return p.importKind==="type"||p.importKind==="typeof"}const Eh={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function Th(p,r){const t=[],n=[];for(let o=0;o<p.length;o++)(r(p[o],o,p)?t:n).push(p[o]);return[t,n]}const Sh=/\*?\s*@((?:no)?flow)\b/;var bh=p=>class extends p{constructor(...t){super(...t),this.flowPragma=void 0}getScopeHandler(){return mh}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(t,n){t!==134&&t!==13&&t!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(t,n)}addComment(t){if(this.flowPragma===void 0){const n=Sh.exec(t.value);if(n)if(n[1]==="flow")this.flowPragma="flow";else if(n[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(t)}flowParseTypeInitialiser(t){const n=this.state.inType;this.state.inType=!0,this.expect(t||14);const o=this.flowParseType();return this.state.inType=n,o}flowParsePredicate(){const t=this.startNode(),n=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>n.index+1&&this.raise(j.UnexpectedSpaceBetweenModuloChecks,n),this.eat(10)?(t.value=super.parseExpression(),this.expect(11),this.finishNode(t,"DeclaredPredicate")):this.finishNode(t,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){const t=this.state.inType;this.state.inType=!0,this.expect(14);let n=null,o=null;return this.match(54)?(this.state.inType=t,o=this.flowParsePredicate()):(n=this.flowParseType(),this.state.inType=t,this.match(54)&&(o=this.flowParsePredicate())),[n,o]}flowParseDeclareClass(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")}flowParseDeclareFunction(t){this.next();const n=t.id=this.parseIdentifier(),o=this.startNode(),l=this.startNode();this.match(47)?o.typeParameters=this.flowParseTypeParameterDeclaration():o.typeParameters=null,this.expect(10);const d=this.flowParseFunctionTypeParams();return o.params=d.params,o.rest=d.rest,o.this=d._this,this.expect(11),[o.returnType,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),l.typeAnnotation=this.finishNode(o,"FunctionTypeAnnotation"),n.typeAnnotation=this.finishNode(l,"TypeAnnotation"),this.resetEndLocation(n),this.semicolon(),this.scope.declareName(t.id.name,2048,t.id.loc.start),this.finishNode(t,"DeclareFunction")}flowParseDeclare(t,n){if(this.match(80))return this.flowParseDeclareClass(t);if(this.match(68))return this.flowParseDeclareFunction(t);if(this.match(74))return this.flowParseDeclareVariable(t);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(t):(n&&this.raise(j.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(t));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(t);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(t);if(this.isContextual(129))return this.flowParseDeclareInterface(t);if(this.match(82))return this.flowParseDeclareExportDeclaration(t,n);throw this.unexpected()}flowParseDeclareVariable(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(t.id.name,5,t.id.loc.start),this.semicolon(),this.finishNode(t,"DeclareVariable")}flowParseDeclareModule(t){this.scope.enter(0),this.match(134)?t.id=super.parseExprAtom():t.id=this.parseIdentifier();const n=t.body=this.startNode(),o=n.body=[];for(this.expect(5);!this.match(8);){const m=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(j.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),o.push(super.parseImport(m))):(this.expectContextual(125,j.UnsupportedStatementInDeclareModule),o.push(this.flowParseDeclare(m,!0)))}this.scope.exit(),this.expect(8),this.finishNode(n,"BlockStatement");let l=null,d=!1;return o.forEach(m=>{gh(m)?(l==="CommonJS"&&this.raise(j.AmbiguousDeclareModuleKind,m),l="ES"):m.type==="DeclareModuleExports"&&(d&&this.raise(j.DuplicateDeclareModuleExports,m),l==="ES"&&this.raise(j.AmbiguousDeclareModuleKind,m),l="CommonJS",d=!0)}),t.kind=l||"CommonJS",this.finishNode(t,"DeclareModule")}flowParseDeclareExportDeclaration(t,n){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?t.declaration=this.flowParseDeclare(this.startNode()):(t.declaration=this.flowParseType(),this.semicolon()),t.default=!0,this.finishNode(t,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!n){const o=this.state.value;throw this.raise(j.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:o,suggestion:Eh[o]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return t.declaration=this.flowParseDeclare(this.startNode()),t.default=!1,this.finishNode(t,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return t=this.parseExport(t,null),t.type==="ExportNamedDeclaration"?(t.default=!1,delete t.exportKind,this.castNodeTo(t,"DeclareExportDeclaration")):this.castNodeTo(t,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(t){return this.next(),this.expectContextual(111),t.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(t,"DeclareModuleExports")}flowParseDeclareTypeAlias(t){this.next();const n=this.flowParseTypeAlias(t);return this.castNodeTo(n,"DeclareTypeAlias"),n}flowParseDeclareOpaqueType(t){this.next();const n=this.flowParseOpaqueType(t,!0);return this.castNodeTo(n,"DeclareOpaqueType"),n}flowParseDeclareInterface(t){return this.next(),this.flowParseInterfaceish(t,!1),this.finishNode(t,"DeclareInterface")}flowParseInterfaceish(t,n){if(t.id=this.flowParseRestrictedIdentifier(!n,!0),this.scope.declareName(t.id.name,n?17:8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.extends=[],this.eat(81))do t.extends.push(this.flowParseInterfaceExtends());while(!n&&this.eat(12));if(n){if(t.implements=[],t.mixins=[],this.eatContextual(117))do t.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do t.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}t.body=this.flowParseObjectType({allowStatic:n,allowExact:!1,allowSpread:!1,allowProto:n,allowInexact:!1})}flowParseInterfaceExtends(){const t=this.startNode();return t.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"InterfaceExtends")}flowParseInterface(t){return this.flowParseInterfaceish(t,!1),this.finishNode(t,"InterfaceDeclaration")}checkNotUnderscore(t){t==="_"&&this.raise(j.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(t,n,o){yh.has(t)&&this.raise(o?j.AssignReservedType:j.UnexpectedReservedType,n,{reservedType:t})}flowParseRestrictedIdentifierName(t,n){return this.checkReservedType(this.state.value,this.state.startLoc,n),this.parseIdentifierName(t)}flowParseRestrictedIdentifier(t,n){const o=this.startNode(),l=this.flowParseRestrictedIdentifierName(t,n);return this.createIdentifier(o,l)}flowParseTypeAlias(t){return t.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(t.id.name,8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(t,"TypeAlias")}flowParseOpaqueType(t,n){return this.expectContextual(130),t.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(t.id.name,8201,t.id.loc.start),this.match(47)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.supertype=null,this.match(14)&&(t.supertype=this.flowParseTypeInitialiser(14)),t.impltype=null,n||(t.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(t,"OpaqueType")}flowParseTypeParameterBound(){if(this.match(14)||this.isContextual(81)){const t=this.startNode();return this.next(),t.typeAnnotation=this.flowParseType(),this.finishNode(t,"TypeAnnotation")}}flowParseTypeParameter(t=!1){const n=this.state.startLoc,o=this.startNode(),l=this.flowParseVariance();return o.name=this.flowParseRestrictedIdentifierName(),o.variance=l,o.bound=this.flowParseTypeParameterBound(),this.match(29)?(this.eat(29),o.default=this.flowParseType()):t&&this.raise(j.MissingTypeParamDefault,n),this.finishNode(o,"TypeParameter")}flowParseTypeParameterDeclaration(){const t=this.state.inType,n=this.startNode();n.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let o=!1;do{const l=this.flowParseTypeParameter(o);n.params.push(l),l.default&&(o=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=t,this.finishNode(n,"TypeParameterDeclaration")}flowInTopLevelContext(t){if(this.curContext()!==$.brace){const n=this.state.context;this.state.context=[n[0]];try{return t()}finally{this.state.context=n}}else return t()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){const t=this.startNode(),n=this.state.inType;return this.state.inType=!0,t.params=[],this.flowInTopLevelContext(()=>{this.expect(47);const o=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)t.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=o}),this.state.inType=n,!this.state.inType&&this.curContext()===$.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;const t=this.startNode(),n=this.state.inType;for(t.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)t.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=n,this.finishNode(t,"TypeParameterInstantiation")}flowParseInterfaceType(){const t=this.startNode();if(this.expectContextual(129),t.extends=[],this.eat(81))do t.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return t.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(t,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(t,n,o){return t.static=n,this.lookahead().type===14?(t.id=this.flowParseObjectPropertyKey(),t.key=this.flowParseTypeInitialiser()):(t.id=null,t.key=this.flowParseType()),this.expect(3),t.value=this.flowParseTypeInitialiser(),t.variance=o,this.finishNode(t,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(t,n){return t.static=n,t.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(t.method=!0,t.optional=!1,t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.loc.start))):(t.method=!1,this.eat(17)&&(t.optional=!0),t.value=this.flowParseTypeInitialiser()),this.finishNode(t,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(t){for(t.params=[],t.rest=null,t.typeParameters=null,t.this=null,this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(t.this=this.flowParseFunctionTypeParam(!0),t.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)t.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(t.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(t,n){const o=this.startNode();return t.static=n,t.value=this.flowParseObjectTypeMethodish(o),this.finishNode(t,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:t,allowExact:n,allowSpread:o,allowProto:l,allowInexact:d}){const m=this.state.inType;this.state.inType=!0;const g=this.startNode();g.callProperties=[],g.properties=[],g.indexers=[],g.internalSlots=[];let E,b,I=!1;for(n&&this.match(6)?(this.expect(6),E=9,b=!0):(this.expect(5),E=8,b=!1),g.exact=b;!this.match(E);){let N=!1,M=null,Q=null;const le=this.startNode();if(l&&this.isContextual(118)){const oe=this.lookahead();oe.type!==14&&oe.type!==17&&(this.next(),M=this.state.startLoc,t=!1)}if(t&&this.isContextual(106)){const oe=this.lookahead();oe.type!==14&&oe.type!==17&&(this.next(),N=!0)}const H=this.flowParseVariance();if(this.eat(0))M!=null&&this.unexpected(M),this.eat(0)?(H&&this.unexpected(H.loc.start),g.internalSlots.push(this.flowParseObjectTypeInternalSlot(le,N))):g.indexers.push(this.flowParseObjectTypeIndexer(le,N,H));else if(this.match(10)||this.match(47))M!=null&&this.unexpected(M),H&&this.unexpected(H.loc.start),g.callProperties.push(this.flowParseObjectTypeCallProperty(le,N));else{let oe="init";if(this.isContextual(99)||this.isContextual(104)){const At=this.lookahead();Un(At.type)&&(oe=this.state.value,this.next())}const Rt=this.flowParseObjectTypeProperty(le,N,M,H,oe,o,d??!b);Rt===null?(I=!0,Q=this.state.lastTokStartLoc):g.properties.push(Rt)}this.flowObjectTypeSemicolon(),Q&&!this.match(8)&&!this.match(9)&&this.raise(j.UnexpectedExplicitInexactInObject,Q)}this.expect(E),o&&(g.inexact=I);const C=this.finishNode(g,"ObjectTypeAnnotation");return this.state.inType=m,C}flowParseObjectTypeProperty(t,n,o,l,d,m,g){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(m?g||this.raise(j.InexactInsideExact,this.state.lastTokStartLoc):this.raise(j.InexactInsideNonObject,this.state.lastTokStartLoc),l&&this.raise(j.InexactVariance,l),null):(m||this.raise(j.UnexpectedSpreadType,this.state.lastTokStartLoc),o!=null&&this.unexpected(o),l&&this.raise(j.SpreadVariance,l),t.argument=this.flowParseType(),this.finishNode(t,"ObjectTypeSpreadProperty"));{t.key=this.flowParseObjectPropertyKey(),t.static=n,t.proto=o!=null,t.kind=d;let E=!1;return this.match(47)||this.match(10)?(t.method=!0,o!=null&&this.unexpected(o),l&&this.unexpected(l.loc.start),t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.loc.start)),(d==="get"||d==="set")&&this.flowCheckGetterSetterParams(t),!m&&t.key.name==="constructor"&&t.value.this&&this.raise(j.ThisParamBannedInConstructor,t.value.this)):(d!=="init"&&this.unexpected(),t.method=!1,this.eat(17)&&(E=!0),t.value=this.flowParseTypeInitialiser(),t.variance=l),t.optional=E,this.finishNode(t,"ObjectTypeProperty")}}flowCheckGetterSetterParams(t){const n=t.kind==="get"?0:1,o=t.value.params.length+(t.value.rest?1:0);t.value.this&&this.raise(t.kind==="get"?j.GetterMayNotHaveThisParam:j.SetterMayNotHaveThisParam,t.value.this),o!==n&&this.raise(t.kind==="get"?S.BadGetterArity:S.BadSetterArity,t),t.kind==="set"&&t.value.rest&&this.raise(S.BadSetterRestParameter,t)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(t,n){t??(t=this.state.startLoc);let o=n||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){const l=this.startNodeAt(t);l.qualification=o,l.id=this.flowParseRestrictedIdentifier(!0),o=this.finishNode(l,"QualifiedTypeIdentifier")}return o}flowParseGenericType(t,n){const o=this.startNodeAt(t);return o.typeParameters=null,o.id=this.flowParseQualifiedTypeIdentifier(t,n),this.match(47)&&(o.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(o,"GenericTypeAnnotation")}flowParseTypeofType(){const t=this.startNode();return this.expect(87),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")}flowParseTupleType(){const t=this.startNode();for(t.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(t.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(t,"TupleTypeAnnotation")}flowParseFunctionTypeParam(t){let n=null,o=!1,l=null;const d=this.startNode(),m=this.lookahead(),g=this.state.type===78;return m.type===14||m.type===17?(g&&!t&&this.raise(j.ThisParamMustBeFirst,d),n=this.parseIdentifier(g),this.eat(17)&&(o=!0,g&&this.raise(j.ThisParamMayNotBeOptional,d)),l=this.flowParseTypeInitialiser()):l=this.flowParseType(),d.name=n,d.optional=o,d.typeAnnotation=l,this.finishNode(d,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(t){const n=this.startNodeAt(t.loc.start);return n.name=null,n.optional=!1,n.typeAnnotation=t,this.finishNode(n,"FunctionTypeParam")}flowParseFunctionTypeParams(t=[]){let n=null,o=null;for(this.match(78)&&(o=this.flowParseFunctionTypeParam(!0),o.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)t.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(n=this.flowParseFunctionTypeParam(!1)),{params:t,rest:n,_this:o}}flowIdentToTypeAnnotation(t,n,o){switch(o.name){case"any":return this.finishNode(n,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(n,"BooleanTypeAnnotation");case"mixed":return this.finishNode(n,"MixedTypeAnnotation");case"empty":return this.finishNode(n,"EmptyTypeAnnotation");case"number":return this.finishNode(n,"NumberTypeAnnotation");case"string":return this.finishNode(n,"StringTypeAnnotation");case"symbol":return this.finishNode(n,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(o.name),this.flowParseGenericType(t,o)}}flowParsePrimaryType(){const t=this.state.startLoc,n=this.startNode();let o,l,d=!1;const m=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,l=this.flowParseTupleType(),this.state.noAnonFunctionType=m,l;case 47:{const g=this.startNode();return g.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),o=this.flowParseFunctionTypeParams(),g.params=o.params,g.rest=o.rest,g.this=o._this,this.expect(11),this.expect(19),g.returnType=this.flowParseType(),this.finishNode(g,"FunctionTypeAnnotation")}case 10:{const g=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if(ie(this.state.type)||this.match(78)){const E=this.lookahead().type;d=E!==17&&E!==14}else d=!0;if(d){if(this.state.noAnonFunctionType=!1,l=this.flowParseType(),this.state.noAnonFunctionType=m,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),l;this.eat(12)}return l?o=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(l)]):o=this.flowParseFunctionTypeParams(),g.params=o.params,g.rest=o.rest,g.this=o._this,this.expect(11),this.expect(19),g.returnType=this.flowParseType(),g.typeParameters=null,this.finishNode(g,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return n.value=this.match(85),this.next(),this.finishNode(n,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",n);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",n);throw this.raise(j.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(n,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(n,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(n,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(n,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(or(this.state.type)){const g=It(this.state.type);return this.next(),super.createIdentifier(n,g)}else if(ie(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(t,n,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){const t=this.state.startLoc;let n=this.flowParsePrimaryType(),o=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){const l=this.startNodeAt(t),d=this.eat(18);o=o||d,this.expect(0),!d&&this.match(3)?(l.elementType=n,this.next(),n=this.finishNode(l,"ArrayTypeAnnotation")):(l.objectType=n,l.indexType=this.flowParseType(),this.expect(3),o?(l.optional=d,n=this.finishNode(l,"OptionalIndexedAccessType")):n=this.finishNode(l,"IndexedAccessType"))}return n}flowParsePrefixType(){const t=this.startNode();return this.eat(17)?(t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){const t=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){const n=this.startNodeAt(t.loc.start);return n.params=[this.reinterpretTypeAsFunctionTypeParam(t)],n.rest=null,n.this=null,n.returnType=this.flowParseType(),n.typeParameters=null,this.finishNode(n,"FunctionTypeAnnotation")}return t}flowParseIntersectionType(){const t=this.startNode();this.eat(45);const n=this.flowParseAnonFunctionWithoutParens();for(t.types=[n];this.eat(45);)t.types.push(this.flowParseAnonFunctionWithoutParens());return t.types.length===1?n:this.finishNode(t,"IntersectionTypeAnnotation")}flowParseUnionType(){const t=this.startNode();this.eat(43);const n=this.flowParseIntersectionType();for(t.types=[n];this.eat(43);)t.types.push(this.flowParseIntersectionType());return t.types.length===1?n:this.finishNode(t,"UnionTypeAnnotation")}flowParseType(){const t=this.state.inType;this.state.inType=!0;const n=this.flowParseUnionType();return this.state.inType=t,n}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){const t=this.state.startLoc,n=this.parseIdentifier();return this.flowParseGenericType(t,n)}else return this.flowParseType()}flowParseTypeAnnotation(){const t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(){const t=this.startNode(),n=this.parseIdentifierName();return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),this.createIdentifier(t,n)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.loc.end),t.expression}flowParseVariance(){let t=null;return this.match(53)?(t=this.startNode(),this.state.value==="+"?t.kind="plus":t.kind="minus",this.next(),this.finishNode(t,"Variance")):t}parseFunctionBody(t,n,o=!1){if(n){this.forwardNoArrowParamsConversionAt(t,()=>super.parseFunctionBody(t,!0,o));return}super.parseFunctionBody(t,!1,o)}parseFunctionBodyAndFinish(t,n,o=!1){if(this.match(14)){const l=this.startNode();[l.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),t.returnType=l.typeAnnotation?this.finishNode(l,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(t,n,o)}parseStatementLike(t){if(this.state.strict&&this.isContextual(129)){const o=this.lookahead();if(Xe(o.type)){const l=this.startNode();return this.next(),this.flowParseInterface(l)}}else if(this.isContextual(126)){const o=this.startNode();return this.next(),this.flowParseEnumDeclaration(o)}const n=super.parseStatementLike(t);return this.flowPragma===void 0&&!this.isValidDirective(n)&&(this.flowPragma=null),n}parseExpressionStatement(t,n,o){if(n.type==="Identifier"){if(n.name==="declare"){if(this.match(80)||ie(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(t)}else if(ie(this.state.type)){if(n.name==="interface")return this.flowParseInterface(t);if(n.name==="type")return this.flowParseTypeAlias(t);if(n.name==="opaque")return this.flowParseOpaqueType(t,!1)}}return super.parseExpressionStatement(t,n,o)}shouldParseExportDeclaration(){const{type:t}=this.state;return t===126||jn(t)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:t}=this.state;return t===126||jn(t)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){const t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDefaultExpression()}parseConditional(t,n,o){if(!this.match(17))return t;if(this.state.maybeInArrowParameters){const C=this.lookaheadCharCode();if(C===44||C===61||C===58||C===41)return this.setOptionalParametersError(o),t}this.expect(17);const l=this.state.clone(),d=this.state.noArrowAt,m=this.startNodeAt(n);let{consequent:g,failed:E}=this.tryParseConditionalConsequent(),[b,I]=this.getArrowLikeExpressions(g);if(E||I.length>0){const C=[...d];if(I.length>0){this.state=l,this.state.noArrowAt=C;for(let N=0;N<I.length;N++)C.push(I[N].start);({consequent:g,failed:E}=this.tryParseConditionalConsequent()),[b,I]=this.getArrowLikeExpressions(g)}E&&b.length>1&&this.raise(j.AmbiguousConditionalArrow,l.startLoc),E&&b.length===1&&(this.state=l,C.push(b[0].start),this.state.noArrowAt=C,{consequent:g,failed:E}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(g,!0),this.state.noArrowAt=d,this.expect(14),m.test=t,m.consequent=g,m.alternate=this.forwardNoArrowParamsConversionAt(m,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(m,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);const t=this.parseMaybeAssignAllowIn(),n=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:t,failed:n}}getArrowLikeExpressions(t,n){const o=[t],l=[];for(;o.length!==0;){const d=o.pop();d.type==="ArrowFunctionExpression"&&d.body.type!=="BlockStatement"?(d.typeParameters||!d.returnType?this.finishArrowValidation(d):l.push(d),o.push(d.body)):d.type==="ConditionalExpression"&&(o.push(d.consequent),o.push(d.alternate))}return n?(l.forEach(d=>this.finishArrowValidation(d)),[l,[]]):Th(l,d=>d.params.every(m=>this.isAssignable(m,!0)))}finishArrowValidation(t){var n;this.toAssignableList(t.params,(n=t.extra)==null?void 0:n.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(t,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(t,n){let o;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),o=n(),this.state.noArrowParamsConversionAt.pop()):o=n(),o}parseParenItem(t,n){const o=super.parseParenItem(t,n);if(this.eat(17)&&(o.optional=!0,this.resetEndLocation(t)),this.match(14)){const l=this.startNodeAt(n);return l.expression=o,l.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(l,"TypeCastExpression")}return o}assertModuleNodeAllowed(t){t.type==="ImportDeclaration"&&(t.importKind==="type"||t.importKind==="typeof")||t.type==="ExportNamedDeclaration"&&t.exportKind==="type"||t.type==="ExportAllDeclaration"&&t.exportKind==="type"||super.assertModuleNodeAllowed(t)}parseExportDeclaration(t){if(this.isContextual(130)){t.exportKind="type";const n=this.startNode();return this.next(),this.match(5)?(t.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(t),null):this.flowParseTypeAlias(n)}else if(this.isContextual(131)){t.exportKind="type";const n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}else if(this.isContextual(129)){t.exportKind="type";const n=this.startNode();return this.next(),this.flowParseInterface(n)}else if(this.isContextual(126)){t.exportKind="value";const n=this.startNode();return this.next(),this.flowParseEnumDeclaration(n)}else return super.parseExportDeclaration(t)}eatExportStar(t){return super.eatExportStar(t)?!0:this.isContextual(130)&&this.lookahead().type===55?(t.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(t){const{startLoc:n}=this.state,o=super.maybeParseExportNamespaceSpecifier(t);return o&&t.exportKind==="type"&&this.unexpected(n),o}parseClassId(t,n,o){super.parseClassId(t,n,o),this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(t,n,o){const{startLoc:l}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(t,n))return;n.declare=!0}super.parseClassMember(t,n,o),n.declare&&(n.type!=="ClassProperty"&&n.type!=="ClassPrivateProperty"&&n.type!=="PropertyDefinition"?this.raise(j.DeclareClassElement,l):n.value&&this.raise(j.DeclareClassFieldInitializer,n.value))}isIterator(t){return t==="iterator"||t==="asyncIterator"}readIterator(){const t=super.readWord1(),n="@@"+t;(!this.isIterator(t)||!this.state.inType)&&this.raise(S.InvalidIdentifier,this.state.curPosition(),{identifierName:n}),this.finishToken(132,n)}getTokenFromCode(t){const n=this.input.charCodeAt(this.state.pos+1);t===123&&n===124?this.finishOp(6,2):this.state.inType&&(t===62||t===60)?this.finishOp(t===62?48:47,1):this.state.inType&&t===63?n===46?this.finishOp(18,2):this.finishOp(17,1):hh(t,n,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(t)}isAssignable(t,n){return t.type==="TypeCastExpression"?this.isAssignable(t.expression,n):super.isAssignable(t,n)}toAssignable(t,n=!1){!n&&t.type==="AssignmentExpression"&&t.left.type==="TypeCastExpression"&&(t.left=this.typeCastToParameter(t.left)),super.toAssignable(t,n)}toAssignableList(t,n,o){for(let l=0;l<t.length;l++){const d=t[l];d?.type==="TypeCastExpression"&&(t[l]=this.typeCastToParameter(d))}super.toAssignableList(t,n,o)}toReferencedList(t,n){for(let l=0;l<t.length;l++){var o;const d=t[l];d&&d.type==="TypeCastExpression"&&!((o=d.extra)!=null&&o.parenthesized)&&(t.length>1||!n)&&this.raise(j.TypeCastInPattern,d.typeAnnotation)}return t}parseArrayLike(t,n,o){const l=super.parseArrayLike(t,n,o);return o!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(l.elements),l}isValidLVal(t,n,o,l){return t==="TypeCastExpression"||super.isValidLVal(t,n,o,l)}parseClassProperty(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(t)}parseClassPrivateProperty(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(t)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(t){return!this.match(14)&&super.isNonstaticConstructor(t)}pushClassMethod(t,n,o,l,d,m){if(n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(t,n,o,l,d,m),n.params&&d){const g=n.params;g.length>0&&this.isThisParam(g[0])&&this.raise(j.ThisParamBannedInConstructor,n)}else if(n.type==="MethodDefinition"&&d&&n.value.params){const g=n.value.params;g.length>0&&this.isThisParam(g[0])&&this.raise(j.ThisParamBannedInConstructor,n)}}pushClassPrivateMethod(t,n,o,l){n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(t,n,o,l)}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass&&(this.match(47)||this.match(51))&&(t.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();const n=t.implements=[];do{const o=this.startNode();o.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?o.typeParameters=this.flowParseTypeParameterInstantiation():o.typeParameters=null,n.push(this.finishNode(o,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(t){super.checkGetterSetterParams(t);const n=this.getObjectOrClassMethodParams(t);if(n.length>0){const o=n[0];this.isThisParam(o)&&t.kind==="get"?this.raise(j.GetterMayNotHaveThisParam,o):this.isThisParam(o)&&this.raise(j.SetterMayNotHaveThisParam,o)}}parsePropertyNamePrefixOperator(t){t.variance=this.flowParseVariance()}parseObjPropValue(t,n,o,l,d,m,g){t.variance&&this.unexpected(t.variance.loc.start),delete t.variance;let E;this.match(47)&&!m&&(E=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());const b=super.parseObjPropValue(t,n,o,l,d,m,g);return E&&((b.value||b).typeParameters=E),b}parseFunctionParamType(t){return this.eat(17)&&(t.type!=="Identifier"&&this.raise(j.PatternIsOptional,t),this.isThisParam(t)&&this.raise(j.ThisParamMayNotBeOptional,t),t.optional=!0),this.match(14)?t.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(t)&&this.raise(j.ThisParamAnnotationRequired,t),this.match(29)&&this.isThisParam(t)&&this.raise(j.ThisParamNoDefault,t),this.resetEndLocation(t),t}parseMaybeDefault(t,n){const o=super.parseMaybeDefault(t,n);return o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start&&this.raise(j.TypeBeforeInitializer,o.typeAnnotation),o}checkImportReflection(t){super.checkImportReflection(t),t.module&&t.importKind!=="value"&&this.raise(j.ImportReflectionHasImportType,t.specifiers[0].loc.start)}parseImportSpecifierLocal(t,n,o){n.local=Kn(t)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(n,o))}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(130)){if(!t)return!0;const n=this.lookaheadCharCode();return n===123||n===42}return!t&&this.isContextual(87)}applyImportPhase(t,n,o,l){if(super.applyImportPhase(t,n,o,l),n){if(!o&&this.match(65))return;t.exportKind=o==="type"?o:"value"}else o==="type"&&this.match(55)&&this.unexpected(),t.importKind=o==="type"||o==="typeof"?o:"value"}parseImportSpecifier(t,n,o,l,d){const m=t.imported;let g=null;m.type==="Identifier"&&(m.name==="type"?g="type":m.name==="typeof"&&(g="typeof"));let E=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){const I=this.parseIdentifier(!0);g!==null&&!Xe(this.state.type)?(t.imported=I,t.importKind=g,t.local=this.cloneIdentifier(I)):(t.imported=m,t.importKind=null,t.local=this.parseIdentifier())}else{if(g!==null&&Xe(this.state.type))t.imported=this.parseIdentifier(!0),t.importKind=g;else{if(n)throw this.raise(S.ImportBindingIsString,t,{importName:m.value});t.imported=m,t.importKind=null}this.eatContextual(93)?t.local=this.parseIdentifier():(E=!0,t.local=this.cloneIdentifier(t.imported))}const b=Kn(t);return o&&b&&this.raise(j.ImportTypeShorthandOnlyInPureImport,t),(o||b)&&this.checkReservedType(t.local.name,t.local.loc.start,!0),E&&!o&&!b&&this.checkReservedWord(t.local.name,t.loc.start,!0,!0),this.finishImportSpecifier(t,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(t,n){const o=t.kind;o!=="get"&&o!=="set"&&this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(t,n)}parseVarId(t,n){super.parseVarId(t,n),this.match(14)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,n){if(this.match(14)){const o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=o}return super.parseAsyncArrowFromCallExpression(t,n)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(t,n){var o;let l=null,d;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(l=this.state.clone(),d=this.tryParse(()=>super.parseMaybeAssign(t,n),l),!d.error)return d.node;const{context:E}=this.state,b=E[E.length-1];(b===$.j_oTag||b===$.j_expr)&&E.pop()}if((o=d)!=null&&o.error||this.match(47)){var m,g;l=l||this.state.clone();let E;const b=this.tryParse(C=>{var N;E=this.flowParseTypeParameterDeclaration();const M=this.forwardNoArrowParamsConversionAt(E,()=>{const le=super.parseMaybeAssign(t,n);return this.resetStartLocationFromNode(le,E),le});(N=M.extra)!=null&&N.parenthesized&&C();const Q=this.maybeUnwrapTypeCastExpression(M);return Q.type!=="ArrowFunctionExpression"&&C(),Q.typeParameters=E,this.resetStartLocationFromNode(Q,E),M},l);let I=null;if(b.node&&this.maybeUnwrapTypeCastExpression(b.node).type==="ArrowFunctionExpression"){if(!b.error&&!b.aborted)return b.node.async&&this.raise(j.UnexpectedTypeParameterBeforeAsyncArrowFunction,E),b.node;I=b.node}if((m=d)!=null&&m.node)return this.state=d.failState,d.node;if(I)return this.state=b.failState,I;throw(g=d)!=null&&g.thrown?d.error:b.thrown?b.error:this.raise(j.UnexpectedTokenAfterTypeParameter,E)}return super.parseMaybeAssign(t,n)}parseArrow(t){if(this.match(14)){const n=this.tryParse(()=>{const o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;const l=this.startNode();return[l.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=o,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),l});if(n.thrown)return null;n.error&&(this.state=n.failState),t.returnType=n.node.typeAnnotation?this.finishNode(n.node,"TypeAnnotation"):null}return super.parseArrow(t)}shouldParseArrow(t){return this.match(14)||super.shouldParseArrow(t)}setArrowFunctionParameters(t,n){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?t.params=n:super.setArrowFunctionParameters(t,n)}checkParams(t,n,o,l=!0){if(!(o&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))){for(let d=0;d<t.params.length;d++)this.isThisParam(t.params[d])&&d>0&&this.raise(j.ThisParamMustBeFirst,t.params[d]);super.checkParams(t,n,o,l)}}parseParenAndDistinguishExpression(t){return super.parseParenAndDistinguishExpression(t&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(t,n,o){if(t.type==="Identifier"&&t.name==="async"&&this.state.noArrowAt.includes(n.index)){this.next();const l=this.startNodeAt(n);l.callee=t,l.arguments=super.parseCallExpressionArguments(),t=this.finishNode(l,"CallExpression")}else if(t.type==="Identifier"&&t.name==="async"&&this.match(47)){const l=this.state.clone(),d=this.tryParse(g=>this.parseAsyncArrowWithTypeParameters(n)||g(),l);if(!d.error&&!d.aborted)return d.node;const m=this.tryParse(()=>super.parseSubscripts(t,n,o),l);if(m.node&&!m.error)return m.node;if(d.node)return this.state=d.failState,d.node;if(m.node)return this.state=m.failState,m.node;throw d.error||m.error}return super.parseSubscripts(t,n,o)}parseSubscript(t,n,o,l){if(this.match(18)&&this.isLookaheadToken_lt()){if(l.optionalChainMember=!0,o)return l.stop=!0,t;this.next();const d=this.startNodeAt(n);return d.callee=t,d.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),d.arguments=this.parseCallExpressionArguments(),d.optional=!0,this.finishCallExpression(d,!0)}else if(!o&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){const d=this.startNodeAt(n);d.callee=t;const m=this.tryParse(()=>(d.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),d.arguments=super.parseCallExpressionArguments(),l.optionalChainMember&&(d.optional=!1),this.finishCallExpression(d,l.optionalChainMember)));if(m.node)return m.error&&(this.state=m.failState),m.node}return super.parseSubscript(t,n,o,l)}parseNewCallee(t){super.parseNewCallee(t);let n=null;this.shouldParseTypes()&&this.match(47)&&(n=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),t.typeArguments=n}parseAsyncArrowWithTypeParameters(t){const n=this.startNodeAt(t);if(this.parseFunctionParams(n,!1),!!this.parseArrow(n))return super.parseArrowExpression(n,void 0,!0)}readToken_mult_modulo(t){const n=this.input.charCodeAt(this.state.pos+1);if(t===42&&n===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(t)}readToken_pipe_amp(t){const n=this.input.charCodeAt(this.state.pos+1);if(t===124&&n===125){this.finishOp(9,2);return}super.readToken_pipe_amp(t)}parseTopLevel(t,n){const o=super.parseTopLevel(t,n);return this.state.hasFlowComment&&this.raise(j.UnterminatedFlowComment,this.state.curPosition()),o}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(j.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();const t=this.skipFlowComment();t&&(this.state.pos+=t,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){const{pos:t}=this.state;let n=2;for(;[32,9].includes(this.input.charCodeAt(t+n));)n++;const o=this.input.charCodeAt(n+t),l=this.input.charCodeAt(n+t+1);return o===58&&l===58?n+2:this.input.slice(n+t,n+t+12)==="flow-include"?n+12:o===58&&l!==58?n:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(S.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(t,{enumName:n,memberName:o}){this.raise(j.EnumBooleanMemberNotInitialized,t,{memberName:o,enumName:n})}flowEnumErrorInvalidMemberInitializer(t,n){return this.raise(n.explicitType?n.explicitType==="symbol"?j.EnumInvalidMemberInitializerSymbolType:j.EnumInvalidMemberInitializerPrimaryType:j.EnumInvalidMemberInitializerUnknownType,t,n)}flowEnumErrorNumberMemberNotInitialized(t,n){this.raise(j.EnumNumberMemberNotInitialized,t,n)}flowEnumErrorStringMemberInconsistentlyInitialized(t,n){this.raise(j.EnumStringMemberInconsistentlyInitialized,t,n)}flowEnumMemberInit(){const t=this.state.startLoc,n=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{const o=this.parseNumericLiteral(this.state.value);return n()?{type:"number",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}case 134:{const o=this.parseStringLiteral(this.state.value);return n()?{type:"string",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}case 85:case 86:{const o=this.parseBooleanLiteral(this.match(85));return n()?{type:"boolean",loc:o.loc.start,value:o}:{type:"invalid",loc:t}}default:return{type:"invalid",loc:t}}}flowEnumMemberRaw(){const t=this.state.startLoc,n=this.parseIdentifier(!0),o=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:t};return{id:n,init:o}}flowEnumCheckExplicitTypeMismatch(t,n,o){const{explicitType:l}=n;l!==null&&l!==o&&this.flowEnumErrorInvalidMemberInitializer(t,n)}flowEnumMembers({enumName:t,explicitType:n}){const o=new Set,l={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]};let d=!1;for(;!this.match(8);){if(this.eat(21)){d=!0;break}const m=this.startNode(),{id:g,init:E}=this.flowEnumMemberRaw(),b=g.name;if(b==="")continue;/^[a-z]/.test(b)&&this.raise(j.EnumInvalidMemberName,g,{memberName:b,suggestion:b[0].toUpperCase()+b.slice(1),enumName:t}),o.has(b)&&this.raise(j.EnumDuplicateMemberName,g,{memberName:b,enumName:t}),o.add(b);const I={enumName:t,explicitType:n,memberName:b};switch(m.id=g,E.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(E.loc,I,"boolean"),m.init=E.value,l.booleanMembers.push(this.finishNode(m,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(E.loc,I,"number"),m.init=E.value,l.numberMembers.push(this.finishNode(m,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(E.loc,I,"string"),m.init=E.value,l.stringMembers.push(this.finishNode(m,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(E.loc,I);case"none":switch(n){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(E.loc,I);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(E.loc,I);break;default:l.defaultedMembers.push(this.finishNode(m,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:l,hasUnknownMembers:d}}flowEnumStringMembers(t,n,{enumName:o}){if(t.length===0)return n;if(n.length===0)return t;if(n.length>t.length){for(const l of t)this.flowEnumErrorStringMemberInconsistentlyInitialized(l,{enumName:o});return n}else{for(const l of n)this.flowEnumErrorStringMemberInconsistentlyInitialized(l,{enumName:o});return t}}flowEnumParseExplicitType({enumName:t}){if(!this.eatContextual(102))return null;if(!ie(this.state.type))throw this.raise(j.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:t});const{value:n}=this.state;return this.next(),n!=="boolean"&&n!=="number"&&n!=="string"&&n!=="symbol"&&this.raise(j.EnumInvalidExplicitType,this.state.startLoc,{enumName:t,invalidEnumType:n}),n}flowEnumBody(t,n){const o=n.name,l=n.loc.start,d=this.flowEnumParseExplicitType({enumName:o});this.expect(5);const{members:m,hasUnknownMembers:g}=this.flowEnumMembers({enumName:o,explicitType:d});switch(t.hasUnknownMembers=g,d){case"boolean":return t.explicitType=!0,t.members=m.booleanMembers,this.expect(8),this.finishNode(t,"EnumBooleanBody");case"number":return t.explicitType=!0,t.members=m.numberMembers,this.expect(8),this.finishNode(t,"EnumNumberBody");case"string":return t.explicitType=!0,t.members=this.flowEnumStringMembers(m.stringMembers,m.defaultedMembers,{enumName:o}),this.expect(8),this.finishNode(t,"EnumStringBody");case"symbol":return t.members=m.defaultedMembers,this.expect(8),this.finishNode(t,"EnumSymbolBody");default:{const E=()=>(t.members=[],this.expect(8),this.finishNode(t,"EnumStringBody"));t.explicitType=!1;const b=m.booleanMembers.length,I=m.numberMembers.length,C=m.stringMembers.length,N=m.defaultedMembers.length;if(!b&&!I&&!C&&!N)return E();if(!b&&!I)return t.members=this.flowEnumStringMembers(m.stringMembers,m.defaultedMembers,{enumName:o}),this.expect(8),this.finishNode(t,"EnumStringBody");if(!I&&!C&&b>=N){for(const M of m.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(M.loc.start,{enumName:o,memberName:M.id.name});return t.members=m.booleanMembers,this.expect(8),this.finishNode(t,"EnumBooleanBody")}else if(!b&&!C&&I>=N){for(const M of m.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(M.loc.start,{enumName:o,memberName:M.id.name});return t.members=m.numberMembers,this.expect(8),this.finishNode(t,"EnumNumberBody")}else return this.raise(j.EnumInconsistentMemberValues,l,{enumName:o}),E()}}}flowParseEnumDeclaration(t){const n=this.parseIdentifier();return t.id=n,t.body=this.flowEnumBody(this.startNode(),n),this.finishNode(t,"EnumDeclaration")}jsxParseOpeningElementAfterName(t){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(t.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(t)}isLookaheadToken_lt(){const t=this.nextTokenStart();if(this.input.charCodeAt(t)===60){const n=this.input.charCodeAt(t+1);return n!==60&&n!==61}return!1}reScan_lt_gt(){const{type:t}=this.state;t===47?(this.state.pos-=1,this.readToken_lt()):t===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:t}=this.state;return t===51?(this.state.pos-=2,this.finishOp(47,1),47):t}maybeUnwrapTypeCastExpression(t){return t.type==="TypeCastExpression"?t.expression:t}};const xh={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},Ih=/\r\n|[\r\n\u2028\u2029]/,Hs=new RegExp(Ih.source,"g");function qt(p){switch(p){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function qn(p,r,t){for(let n=r;n<t;n++)if(qt(p.charCodeAt(n)))return!0;return!1}const dr=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,fr=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function Ph(p){switch(p){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}const Dt=Ce`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:p})=>`Expected corresponding JSX closing tag for <${p}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:p,HTMLEntity:r})=>`Unexpected token \`${p}\`. Did you mean \`${r}\` or \`{'${p}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function Pt(p){return p?p.type==="JSXOpeningFragment"||p.type==="JSXClosingFragment":!1}function Yt(p){if(p.type==="JSXIdentifier")return p.name;if(p.type==="JSXNamespacedName")return p.namespace.name+":"+p.name.name;if(p.type==="JSXMemberExpression")return Yt(p.object)+"."+Yt(p.property);throw new Error("Node had unexpected type: "+p.type)}var wh=p=>class extends p{jsxReadToken(){let t="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Dt.UnterminatedJsxContent,this.state.startLoc);const o=this.input.charCodeAt(this.state.pos);switch(o){case 60:case 123:if(this.state.pos===this.state.start){o===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(o);return}t+=this.input.slice(n,this.state.pos),this.finishToken(142,t);return;case 38:t+=this.input.slice(n,this.state.pos),t+=this.jsxReadEntity(),n=this.state.pos;break;case 62:case 125:default:qt(o)?(t+=this.input.slice(n,this.state.pos),t+=this.jsxReadNewLine(!0),n=this.state.pos):++this.state.pos}}}jsxReadNewLine(t){const n=this.input.charCodeAt(this.state.pos);let o;return++this.state.pos,n===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,o=t?`
42
+ `:`\r
43
+ `):o=String.fromCharCode(n),++this.state.curLine,this.state.lineStart=this.state.pos,o}jsxReadString(t){let n="",o=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(S.UnterminatedString,this.state.startLoc);const l=this.input.charCodeAt(this.state.pos);if(l===t)break;l===38?(n+=this.input.slice(o,this.state.pos),n+=this.jsxReadEntity(),o=this.state.pos):qt(l)?(n+=this.input.slice(o,this.state.pos),n+=this.jsxReadNewLine(!1),o=this.state.pos):++this.state.pos}n+=this.input.slice(o,this.state.pos++),this.finishToken(134,n)}jsxReadEntity(){const t=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let n=10;this.codePointAtPos(this.state.pos)===120&&(n=16,++this.state.pos);const o=this.readInt(n,void 0,!1,"bail");if(o!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(o)}else{let n=0,o=!1;for(;n++<10&&this.state.pos<this.length&&!(o=this.codePointAtPos(this.state.pos)===59);)++this.state.pos;if(o){const l=this.input.slice(t,this.state.pos),d=xh[l];if(++this.state.pos,d)return d}}return this.state.pos=t,"&"}jsxReadWord(){let t;const n=this.state.pos;do t=this.input.charCodeAt(++this.state.pos);while(kt(t)||t===45);this.finishToken(141,this.input.slice(n,this.state.pos))}jsxParseIdentifier(){const t=this.startNode();return this.match(141)?t.name=this.state.value:or(this.state.type)?t.name=It(this.state.type):this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")}jsxParseNamespacedName(){const t=this.state.startLoc,n=this.jsxParseIdentifier();if(!this.eat(14))return n;const o=this.startNodeAt(t);return o.namespace=n,o.name=this.jsxParseIdentifier(),this.finishNode(o,"JSXNamespacedName")}jsxParseElementName(){const t=this.state.startLoc;let n=this.jsxParseNamespacedName();if(n.type==="JSXNamespacedName")return n;for(;this.eat(16);){const o=this.startNodeAt(t);o.object=n,o.property=this.jsxParseIdentifier(),n=this.finishNode(o,"JSXMemberExpression")}return n}jsxParseAttributeValue(){let t;switch(this.state.type){case 5:return t=this.startNode(),this.setContext($.brace),this.next(),t=this.jsxParseExpressionContainer(t,$.j_oTag),t.expression.type==="JSXEmptyExpression"&&this.raise(Dt.AttributeIsEmpty,t),t;case 143:case 134:return this.parseExprAtom();default:throw this.raise(Dt.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){const t=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(t){return this.next(),t.expression=this.parseExpression(),this.setContext($.j_expr),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXSpreadChild")}jsxParseExpressionContainer(t,n){if(this.match(8))t.expression=this.jsxParseEmptyExpression();else{const o=this.parseExpression();t.expression=o}return this.setContext(n),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXExpressionContainer")}jsxParseAttribute(){const t=this.startNode();return this.match(5)?(this.setContext($.brace),this.next(),this.expect(21),t.argument=this.parseMaybeAssignAllowIn(),this.setContext($.j_oTag),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(t,"JSXSpreadAttribute")):(t.name=this.jsxParseNamespacedName(),t.value=this.eat(29)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute"))}jsxParseOpeningElementAt(t){const n=this.startNodeAt(t);return this.eat(144)?this.finishNode(n,"JSXOpeningFragment"):(n.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(n))}jsxParseOpeningElementAfterName(t){const n=[];for(;!this.match(56)&&!this.match(144);)n.push(this.jsxParseAttribute());return t.attributes=n,t.selfClosing=this.eat(56),this.expect(144),this.finishNode(t,"JSXOpeningElement")}jsxParseClosingElementAt(t){const n=this.startNodeAt(t);return this.eat(144)?this.finishNode(n,"JSXClosingFragment"):(n.name=this.jsxParseElementName(),this.expect(144),this.finishNode(n,"JSXClosingElement"))}jsxParseElementAt(t){const n=this.startNodeAt(t),o=[],l=this.jsxParseOpeningElementAt(t);let d=null;if(!l.selfClosing){e:for(;;)switch(this.state.type){case 143:if(t=this.state.startLoc,this.next(),this.eat(56)){d=this.jsxParseClosingElementAt(t);break e}o.push(this.jsxParseElementAt(t));break;case 142:o.push(this.parseLiteral(this.state.value,"JSXText"));break;case 5:{const m=this.startNode();this.setContext($.brace),this.next(),this.match(21)?o.push(this.jsxParseSpreadChild(m)):o.push(this.jsxParseExpressionContainer(m,$.j_expr));break}default:this.unexpected()}Pt(l)&&!Pt(d)&&d!==null?this.raise(Dt.MissingClosingTagFragment,d):!Pt(l)&&Pt(d)?this.raise(Dt.MissingClosingTagElement,d,{openingTagName:Yt(l.name)}):!Pt(l)&&!Pt(d)&&Yt(d.name)!==Yt(l.name)&&this.raise(Dt.MissingClosingTagElement,d,{openingTagName:Yt(l.name)})}if(Pt(l)?(n.openingFragment=l,n.closingFragment=d):(n.openingElement=l,n.closingElement=d),n.children=o,this.match(47))throw this.raise(Dt.UnwrappedAdjacentJSXElements,this.state.startLoc);return Pt(l)?this.finishNode(n,"JSXFragment"):this.finishNode(n,"JSXElement")}jsxParseElement(){const t=this.state.startLoc;return this.next(),this.jsxParseElementAt(t)}setContext(t){const{context:n}=this.state;n[n.length-1]=t}parseExprAtom(t){return this.match(143)?this.jsxParseElement():this.match(47)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(143),this.jsxParseElement()):super.parseExprAtom(t)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(t){const n=this.curContext();if(n===$.j_expr){this.jsxReadToken();return}if(n===$.j_oTag||n===$.j_cTag){if(nt(t)){this.jsxReadWord();return}if(t===62){++this.state.pos,this.finishToken(144);return}if((t===34||t===39)&&n===$.j_oTag){this.jsxReadString(t);return}}if(t===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(143);return}super.getTokenFromCode(t)}updateContext(t){const{context:n,type:o}=this.state;if(o===56&&t===143)n.splice(-2,2,$.j_cTag),this.state.canStartJSXElement=!1;else if(o===143)n.push($.j_oTag);else if(o===144){const l=n[n.length-1];l===$.j_oTag&&t===56||l===$.j_cTag?(n.pop(),this.state.canStartJSXElement=n[n.length-1]===$.j_expr):(this.setContext($.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=qu(o)}};class Ah extends hr{constructor(...r){super(...r),this.tsNames=new Map}}class Ch extends pr{constructor(...r){super(...r),this.importsStack=[]}createScope(r){return this.importsStack.push(new Set),new Ah(r)}enter(r){r===1024&&this.importsStack.push(new Set),super.enter(r)}exit(){const r=super.exit();return r===1024&&this.importsStack.pop(),r}hasImport(r,t){const n=this.importsStack.length;if(this.importsStack[n-1].has(r))return!0;if(!t&&n>1){for(let o=0;o<n-1;o++)if(this.importsStack[o].has(r))return!0}return!1}declareName(r,t,n){if(t&4096){this.hasImport(r,!0)&&this.parser.raise(S.VarRedeclaration,n,{identifierName:r}),this.importsStack[this.importsStack.length-1].add(r);return}const o=this.currentScope();let l=o.tsNames.get(r)||0;if(t&1024){this.maybeExportDefined(o,r),o.tsNames.set(r,l|16);return}super.declareName(r,t,n),t&2&&(t&1||(this.checkRedeclarationInScope(o,r,t,n),this.maybeExportDefined(o,r)),l=l|1),t&256&&(l=l|2),t&512&&(l=l|4),t&128&&(l=l|8),l&&o.tsNames.set(r,l)}isRedeclaredInScope(r,t,n){const o=r.tsNames.get(t);if((o&2)>0){if(n&256){const l=!!(n&512),d=(o&4)>0;return l!==d}return!0}return n&128&&(o&8)>0?r.names.get(t)&2?!!(n&1):!1:n&2&&(o&1)>0?!0:super.isRedeclaredInScope(r,t,n)}checkLocalExport(r){const{name:t}=r;if(this.hasImport(t))return;const n=this.scopeStack.length;for(let o=n-1;o>=0;o--){const d=this.scopeStack[o].tsNames.get(t);if((d&1)>0||(d&16)>0)return}super.checkLocalExport(r)}}class vh{constructor(){this.stacks=[]}enter(r){this.stacks.push(r)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}}function Zs(p,r){return(p?2:0)|(r?1:0)}class Nh{constructor(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}sourceToOffsetPos(r){return r+this.startIndex}offsetToSourcePos(r){return r-this.startIndex}hasPlugin(r){if(typeof r=="string")return this.plugins.has(r);{const[t,n]=r;if(!this.hasPlugin(t))return!1;const o=this.plugins.get(t);for(const l of Object.keys(n))if(o?.[l]!==n[l])return!1;return!0}}getPluginOption(r,t){var n;return(n=this.plugins.get(r))==null?void 0:n[t]}}function Yn(p,r){p.trailingComments===void 0?p.trailingComments=r:p.trailingComments.unshift(...r)}function _h(p,r){p.leadingComments===void 0?p.leadingComments=r:p.leadingComments.unshift(...r)}function bs(p,r){p.innerComments===void 0?p.innerComments=r:p.innerComments.unshift(...r)}function Qe(p,r,t){let n=null,o=r.length;for(;n===null&&o>0;)n=r[--o];n===null||n.start>t.start?bs(p,t.comments):Yn(n,t.comments)}class Oh extends Nh{addComment(r){this.filename&&(r.loc.filename=this.filename);const{commentsLen:t}=this.state;this.comments.length!==t&&(this.comments.length=t),this.comments.push(r),this.state.commentsLen++}processComment(r){const{commentStack:t}=this.state,n=t.length;if(n===0)return;let o=n-1;const l=t[o];l.start===r.end&&(l.leadingNode=r,o--);const{start:d}=r;for(;o>=0;o--){const m=t[o],g=m.end;if(g>d)m.containingNode=r,this.finalizeComment(m),t.splice(o,1);else{g===d&&(m.trailingNode=r);break}}}finalizeComment(r){var t;const{comments:n}=r;if(r.leadingNode!==null||r.trailingNode!==null)r.leadingNode!==null&&Yn(r.leadingNode,n),r.trailingNode!==null&&_h(r.trailingNode,n);else{const o=r.containingNode,l=r.start;if(this.input.charCodeAt(this.offsetToSourcePos(l)-1)===44)switch(o.type){case"ObjectExpression":case"ObjectPattern":Qe(o,o.properties,r);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":Qe(o,o.arguments,r);break;case"ImportExpression":Qe(o,[o.source,(t=o.options)!=null?t:null],r);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":Qe(o,o.params,r);break;case"ArrayExpression":case"ArrayPattern":Qe(o,o.elements,r);break;case"ExportNamedDeclaration":case"ImportDeclaration":Qe(o,o.specifiers,r);break;case"TSEnumDeclaration":Qe(o,o.members,r);break;case"TSEnumBody":Qe(o,o.members,r);break;case"TSInterfaceBody":Qe(o,o.body,r);break;default:{if(o.type==="RecordExpression"){Qe(o,o.properties,r);break}if(o.type==="TupleExpression"){Qe(o,o.elements,r);break}bs(o,n)}}else bs(o,n)}}finalizeRemainingComments(){const{commentStack:r}=this.state;for(let t=r.length-1;t>=0;t--)this.finalizeComment(r[t]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(r){const{commentStack:t}=this.state,{length:n}=t;if(n===0)return;const o=t[n-1];o.leadingNode===r&&(o.leadingNode=null)}takeSurroundingComments(r,t,n){const{commentStack:o}=this.state,l=o.length;if(l===0)return;let d=l-1;for(;d>=0;d--){const m=o[d],g=m.end;if(m.start===n)m.leadingNode=r;else if(g===t)m.trailingNode=r;else if(g<t)break}}}class mr{constructor(){this.flags=1024,this.startIndex=void 0,this.curLine=void 0,this.lineStart=void 0,this.startLoc=void 0,this.endLoc=void 0,this.errors=[],this.potentialArrowAt=-1,this.noArrowAt=[],this.noArrowParamsConversionAt=[],this.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null},this.labels=[],this.commentsLen=0,this.commentStack=[],this.pos=0,this.type=140,this.value=null,this.start=0,this.end=0,this.lastTokEndLoc=null,this.lastTokStartLoc=null,this.context=[$.brace],this.firstInvalidTemplateEscapePos=null,this.strictErrors=new Map,this.tokensLength=0}get strict(){return(this.flags&1)>0}set strict(r){r?this.flags|=1:this.flags&=-2}init({strictMode:r,sourceType:t,startIndex:n,startLine:o,startColumn:l}){this.strict=r===!1?!1:r===!0?!0:t==="module",this.startIndex=n,this.curLine=o,this.lineStart=-l,this.startLoc=this.endLoc=new s(o,l,n)}get maybeInArrowParameters(){return(this.flags&2)>0}set maybeInArrowParameters(r){r?this.flags|=2:this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(r){r?this.flags|=4:this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(r){r?this.flags|=8:this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(r){r?this.flags|=16:this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(r){r?this.flags|=32:this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(r){r?this.flags|=64:this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(r){r?this.flags|=128:this.flags&=-129}get soloAwait(){return(this.flags&256)>0}set soloAwait(r){r?this.flags|=256:this.flags&=-257}get inFSharpPipelineDirectBody(){return(this.flags&512)>0}set inFSharpPipelineDirectBody(r){r?this.flags|=512:this.flags&=-513}get canStartJSXElement(){return(this.flags&1024)>0}set canStartJSXElement(r){r?this.flags|=1024:this.flags&=-1025}get containsEsc(){return(this.flags&2048)>0}set containsEsc(r){r?this.flags|=2048:this.flags&=-2049}get hasTopLevelAwait(){return(this.flags&4096)>0}set hasTopLevelAwait(r){r?this.flags|=4096:this.flags&=-4097}curPosition(){return new s(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){const r=new mr;return r.flags=this.flags,r.startIndex=this.startIndex,r.curLine=this.curLine,r.lineStart=this.lineStart,r.startLoc=this.startLoc,r.endLoc=this.endLoc,r.errors=this.errors.slice(),r.potentialArrowAt=this.potentialArrowAt,r.noArrowAt=this.noArrowAt.slice(),r.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),r.topicContext=this.topicContext,r.labels=this.labels.slice(),r.commentsLen=this.commentsLen,r.commentStack=this.commentStack.slice(),r.pos=this.pos,r.type=this.type,r.value=this.value,r.start=this.start,r.end=this.end,r.lastTokEndLoc=this.lastTokEndLoc,r.lastTokStartLoc=this.lastTokStartLoc,r.context=this.context.slice(),r.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,r.strictErrors=this.strictErrors,r.tokensLength=this.tokensLength,r}}var Lh=function(r){return r>=48&&r<=57};const Jn={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},Ws={bin:p=>p===48||p===49,oct:p=>p>=48&&p<=55,dec:p=>p>=48&&p<=57,hex:p=>p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102};function Xn(p,r,t,n,o,l){const d=t,m=n,g=o;let E="",b=null,I=t;const{length:C}=r;for(;;){if(t>=C){l.unterminated(d,m,g),E+=r.slice(I,t);break}const N=r.charCodeAt(t);if(kh(p,N,r,t)){E+=r.slice(I,t);break}if(N===92){E+=r.slice(I,t);const M=Dh(r,t,n,o,p==="template",l);M.ch===null&&!b?b={pos:t,lineStart:n,curLine:o}:E+=M.ch,{pos:t,lineStart:n,curLine:o}=M,I=t}else N===8232||N===8233?(++t,++o,n=t):N===10||N===13?p==="template"?(E+=r.slice(I,t)+`
44
+ `,++t,N===13&&r.charCodeAt(t)===10&&++t,++o,I=n=t):l.unterminated(d,m,g):++t}return{pos:t,str:E,firstInvalidLoc:b,lineStart:n,curLine:o,containsInvalid:!!b}}function kh(p,r,t,n){return p==="template"?r===96||r===36&&t.charCodeAt(n+1)===123:r===(p==="double"?34:39)}function Dh(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}=yr(p,r,t,n,2,!1,d,l),m(E===null?null:String.fromCharCode(E))}case 117:{let E;return{code:E,pos:r}=ea(p,r,t,n,d,l),m(E===null?null:String.fromCodePoint(E))}case 116:return m(" ");case 98:return m("\b");case 118:return m("\v");case 102:return m("\f");case 13:p.charCodeAt(r)===10&&++r;case 10:t=r,++n;case 8232:case 8233:return m("");case 56:case 57:if(o)return m(null);l.strictNumericEscape(r-1,t,n);default:if(g>=48&&g<=55){const E=r-1;let I=/^[0-7]+/.exec(p.slice(E,r+2))[0],C=parseInt(I,8);C>255&&(I=I.slice(0,-1),C=parseInt(I,8)),r+=I.length-1;const N=p.charCodeAt(r);if(I!=="0"||N===56||N===57){if(o)return m(null);l.strictNumericEscape(E,t,n)}return m(String.fromCharCode(C))}return m(String.fromCharCode(g))}}function yr(p,r,t,n,o,l,d,m){const g=r;let E;return{n:E,pos:r}=Qn(p,r,t,n,16,o,l,!1,m,!d),E===null&&(d?m.invalidEscapeSequence(g,t,n):r=g-1),{code:E,pos:r}}function Qn(p,r,t,n,o,l,d,m,g,E){const b=r,I=o===16?Jn.hex:Jn.decBinOct,C=o===16?Ws.hex:o===10?Ws.dec:o===8?Ws.oct:Ws.bin;let N=!1,M=0;for(let Q=0,le=l??1/0;Q<le;++Q){const H=p.charCodeAt(r);let oe;if(H===95&&m!=="bail"){const Rt=p.charCodeAt(r-1),At=p.charCodeAt(r+1);if(m){if(Number.isNaN(At)||!C(At)||I.has(Rt)||I.has(At)){if(E)return{n:null,pos:r};g.unexpectedNumericSeparator(r,t,n)}}else{if(E)return{n:null,pos:r};g.numericSeparatorInEscapeSequence(r,t,n)}++r;continue}if(H>=97?oe=H-97+10:H>=65?oe=H-65+10:Lh(H)?oe=H-48:oe=1/0,oe>=o){if(oe<=9&&E)return{n:null,pos:r};if(oe<=9&&g.invalidDigit(r,t,n,o))oe=0;else if(d)oe=0,N=!0;else break}++r,M=M*o+oe}return r===b||l!=null&&r-b!==l||N?{n:null,pos:r}:{n:M,pos:r}}function ea(p,r,t,n,o,l){const d=p.charCodeAt(r);let m;if(d===123){if(++r,{code:m,pos:r}=yr(p,r,t,n,p.indexOf("}",r)-r,!0,o,l),++r,m!==null&&m>1114111)if(o)l.invalidCodePoint(r,t,n);else return{code:null,pos:r}}else({code:m,pos:r}=yr(p,r,t,n,4,!1,o,l));return{code:m,pos:r}}function xs(p,r,t){return new s(t,p-r,p)}const Rh=new Set([103,109,115,105,121,117,100,118]);class wt{constructor(r){const t=r.startIndex||0;this.type=r.type,this.value=r.value,this.start=t+r.start,this.end=t+r.end,this.loc=new i(r.startLoc,r.endLoc)}}class Mh extends Oh{constructor(r,t){super(),this.isLookahead=void 0,this.tokens=[],this.errorHandlers_readInt={invalidDigit:(n,o,l,d)=>this.optionFlags&2048?(this.raise(S.InvalidDigit,xs(n,o,l),{radix:d}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(S.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(S.UnexpectedNumericSeparator)},this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(S.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(S.InvalidCodePoint)}),this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(n,o,l)=>{this.recordStrictModeErrors(S.StrictNumericEscape,xs(n,o,l))},unterminated:(n,o,l)=>{throw this.raise(S.UnterminatedString,xs(n-1,o,l))}}),this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(S.StrictNumericEscape),unterminated:(n,o,l)=>{throw this.raise(S.UnterminatedTemplate,xs(n,o,l))}}),this.state=new mr,this.state.init(r),this.input=t,this.length=t.length,this.comments=[],this.isLookahead=!1}pushToken(r){this.tokens.length=this.state.tokensLength,this.tokens.push(r),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&256&&this.pushToken(new wt(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(r){return this.match(r)?(this.next(),!0):!1}match(r){return this.state.type===r}createLookaheadState(r){return{pos:r.pos,value:null,type:r.type,start:r.start,end:r.end,context:[this.curContext()],inType:r.inType,startLoc:r.startLoc,lastTokEndLoc:r.lastTokEndLoc,curLine:r.curLine,lineStart:r.lineStart,curPosition:r.curPosition}}lookahead(){const r=this.state;this.state=this.createLookaheadState(r),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;const t=this.state;return this.state=r,t}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(r){return dr.lastIndex=r,dr.test(this.input)?dr.lastIndex:r}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(r){return this.input.charCodeAt(this.nextTokenStartSince(r))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(r){return fr.lastIndex=r,fr.test(this.input)?fr.lastIndex:r}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(r){let t=this.input.charCodeAt(r);if((t&64512)===55296&&++r<this.input.length){const n=this.input.charCodeAt(r);(n&64512)===56320&&(t=65536+((t&1023)<<10)+(n&1023))}return t}setStrict(r){this.state.strict=r,r&&(this.state.strictErrors.forEach(([t,n])=>this.raise(t,n)),this.state.strictErrors.clear())}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){if(this.skipSpace(),this.state.start=this.state.pos,this.isLookahead||(this.state.startLoc=this.state.curPosition()),this.state.pos>=this.length){this.finishToken(140);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(r){let t;this.isLookahead||(t=this.state.curPosition());const n=this.state.pos,o=this.input.indexOf(r,n+2);if(o===-1)throw this.raise(S.UnterminatedComment,this.state.curPosition());for(this.state.pos=o+r.length,Hs.lastIndex=n+2;Hs.test(this.input)&&Hs.lastIndex<=o;)++this.state.curLine,this.state.lineStart=Hs.lastIndex;if(this.isLookahead)return;const l={type:"CommentBlock",value:this.input.slice(n+2,o),start:this.sourceToOffsetPos(n),end:this.sourceToOffsetPos(o+r.length),loc:new i(t,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(l),l}skipLineComment(r){const t=this.state.pos;let n;this.isLookahead||(n=this.state.curPosition());let o=this.input.charCodeAt(this.state.pos+=r);if(this.state.pos<this.length)for(;!qt(o)&&++this.state.pos<this.length;)o=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;const l=this.state.pos,m={type:"CommentLine",value:this.input.slice(t+r,l),start:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(l),loc:new i(n,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(m),m}skipSpace(){const r=this.state.pos,t=this.optionFlags&4096?[]:null;e:for(;this.state.pos<this.length;){const n=this.input.charCodeAt(this.state.pos);switch(n){case 32:case 160:case 9:++this.state.pos;break;case 13:this.input.charCodeAt(this.state.pos+1)===10&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:{const o=this.skipBlockComment("*/");o!==void 0&&(this.addComment(o),t?.push(o));break}case 47:{const o=this.skipLineComment(2);o!==void 0&&(this.addComment(o),t?.push(o));break}default:break e}break;default:if(Ph(n))++this.state.pos;else if(n===45&&!this.inModule&&this.optionFlags&8192){const o=this.state.pos;if(this.input.charCodeAt(o+1)===45&&this.input.charCodeAt(o+2)===62&&(r===0||this.state.lineStart>r)){const l=this.skipLineComment(3);l!==void 0&&(this.addComment(l),t?.push(l))}else break e}else if(n===60&&!this.inModule&&this.optionFlags&8192){const o=this.state.pos;if(this.input.charCodeAt(o+1)===33&&this.input.charCodeAt(o+2)===45&&this.input.charCodeAt(o+3)===45){const l=this.skipLineComment(4);l!==void 0&&(this.addComment(l),t?.push(l))}else break e}else break e}}if(t?.length>0){const n=this.state.pos,o={start:this.sourceToOffsetPos(r),end:this.sourceToOffsetPos(n),comments:t,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(o)}}finishToken(r,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();const n=this.state.type;this.state.type=r,this.state.value=t,this.isLookahead||this.updateContext(n)}replaceToken(r){this.state.type=r,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;const r=this.state.pos+1,t=this.codePointAtPos(r);if(t>=48&&t<=57)throw this.raise(S.UnexpectedDigitAfterHash,this.state.curPosition());if(t===123||t===91&&this.hasPlugin("recordAndTuple")){if(this.expectPlugin("recordAndTuple"),this.getPluginOption("recordAndTuple","syntaxType")==="bar")throw this.raise(t===123?S.RecordExpressionHashIncorrectStartSyntaxType:S.TupleExpressionHashIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,t===123?this.finishToken(7):this.finishToken(1)}else nt(t)?(++this.state.pos,this.finishToken(139,this.readWord1(t))):t===92?(++this.state.pos,this.finishToken(139,this.readWord1())):this.finishOp(27,1)}readToken_dot(){const r=this.input.charCodeAt(this.state.pos+1);if(r>=48&&r<=57){this.readNumber(!0);return}r===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(31,2):this.finishOp(56,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let r=this.input.charCodeAt(this.state.pos+1);if(r!==33)return!1;const t=this.state.pos;for(this.state.pos+=1;!qt(r)&&++this.state.pos<this.length;)r=this.input.charCodeAt(this.state.pos);const n=this.input.slice(t+2,this.state.pos);return this.finishToken(28,n),!0}readToken_mult_modulo(r){let t=r===42?55:54,n=1,o=this.input.charCodeAt(this.state.pos+1);r===42&&o===42&&(n++,o=this.input.charCodeAt(this.state.pos+2),t=57),o===61&&!this.state.inType&&(n++,t=r===37?33:30),this.finishOp(t,n)}readToken_pipe_amp(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===r){this.input.charCodeAt(this.state.pos+2)===61?this.finishOp(30,3):this.finishOp(r===124?41:42,2);return}if(r===124){if(t===62){this.finishOp(39,2);return}if(this.hasPlugin("recordAndTuple")&&t===125){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.RecordExpressionBarIncorrectEndSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(9);return}if(this.hasPlugin("recordAndTuple")&&t===93){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.TupleExpressionBarIncorrectEndSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(4);return}}if(t===61){this.finishOp(30,2);return}this.finishOp(r===124?43:45,1)}readToken_caret(){const r=this.input.charCodeAt(this.state.pos+1);r===61&&!this.state.inType?this.finishOp(32,2):r===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])?(this.finishOp(37,2),this.input.codePointAt(this.state.pos)===94&&this.unexpected()):this.finishOp(44,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])?this.finishOp(38,2):this.finishOp(26,1)}readToken_plus_min(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===r){this.finishOp(34,2);return}t===61?this.finishOp(30,2):this.finishOp(53,1)}readToken_lt(){const{pos:r}=this.state,t=this.input.charCodeAt(r+1);if(t===60){if(this.input.charCodeAt(r+2)===61){this.finishOp(30,3);return}this.finishOp(51,2);return}if(t===61){this.finishOp(49,2);return}this.finishOp(47,1)}readToken_gt(){const{pos:r}=this.state,t=this.input.charCodeAt(r+1);if(t===62){const n=this.input.charCodeAt(r+2)===62?3:2;if(this.input.charCodeAt(r+n)===61){this.finishOp(30,n+1);return}this.finishOp(52,n);return}if(t===61){this.finishOp(49,2);return}this.finishOp(48,1)}readToken_eq_excl(r){const t=this.input.charCodeAt(this.state.pos+1);if(t===61){this.finishOp(46,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(r===61&&t===62){this.state.pos+=2,this.finishToken(19);return}this.finishOp(r===61?29:35,1)}readToken_question(){const r=this.input.charCodeAt(this.state.pos+1),t=this.input.charCodeAt(this.state.pos+2);r===63?t===61?this.finishOp(30,3):this.finishOp(40,2):r===46&&!(t>=48&&t<=57)?(this.state.pos+=2,this.finishToken(18)):(++this.state.pos,this.finishToken(17))}getTokenFromCode(r){switch(r){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(10);return;case 41:++this.state.pos,this.finishToken(11);return;case 59:++this.state.pos,this.finishToken(13);return;case 44:++this.state.pos,this.finishToken(12);return;case 91:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.TupleExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(2)}else++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(3);return;case 123:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(S.RecordExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(6)}else++this.state.pos,this.finishToken(5);return;case 125:++this.state.pos,this.finishToken(8);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(15,2):(++this.state.pos,this.finishToken(14));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{const t=this.input.charCodeAt(this.state.pos+1);if(t===120||t===88){this.readRadixNumber(16);return}if(t===111||t===79){this.readRadixNumber(8);return}if(t===98||t===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(!1);return;case 34:case 39:this.readString(r);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(r);return;case 124:case 38:this.readToken_pipe_amp(r);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(r);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(r);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(nt(r)){this.readWord(r);return}}throw this.raise(S.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(r)})}finishOp(r,t){const n=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t,this.finishToken(r,n)}readRegexp(){const r=this.state.startLoc,t=this.state.start+1;let n,o,{pos:l}=this.state;for(;;++l){if(l>=this.length)throw this.raise(S.UnterminatedRegExp,a(r,1));const E=this.input.charCodeAt(l);if(qt(E))throw this.raise(S.UnterminatedRegExp,a(r,1));if(n)n=!1;else{if(E===91)o=!0;else if(E===93&&o)o=!1;else if(E===47&&!o)break;n=E===92}}const d=this.input.slice(t,l);++l;let m="";const g=()=>a(r,l+2-t);for(;l<this.length;){const E=this.codePointAtPos(l),b=String.fromCharCode(E);if(Rh.has(E))E===118?m.includes("u")&&this.raise(S.IncompatibleRegExpUVFlags,g()):E===117&&m.includes("v")&&this.raise(S.IncompatibleRegExpUVFlags,g()),m.includes(b)&&this.raise(S.DuplicateRegExpFlags,g());else if(kt(E)||E===92)this.raise(S.MalformedRegExpFlags,g());else break;++l,m+=b}this.state.pos=l,this.finishToken(138,{pattern:d,flags:m})}readInt(r,t,n=!1,o=!0){const{n:l,pos:d}=Qn(this.input,this.state.pos,this.state.lineStart,this.state.curLine,r,t,n,o,this.errorHandlers_readInt,!1);return this.state.pos=d,l}readRadixNumber(r){const t=this.state.pos,n=this.state.curPosition();let o=!1;this.state.pos+=2;const l=this.readInt(r);l==null&&this.raise(S.InvalidDigit,a(n,2),{radix:r});const d=this.input.charCodeAt(this.state.pos);if(d===110)++this.state.pos,o=!0;else if(d===109)throw this.raise(S.InvalidDecimal,n);if(nt(this.codePointAtPos(this.state.pos)))throw this.raise(S.NumberIdentifier,this.state.curPosition());if(o){const m=this.input.slice(t,this.state.pos).replace(/[_n]/g,"");this.finishToken(136,m);return}this.finishToken(135,l)}readNumber(r){const t=this.state.pos,n=this.state.curPosition();let o=!1,l=!1,d=!1,m=!1;!r&&this.readInt(10)===null&&this.raise(S.InvalidNumber,this.state.curPosition());const g=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(g){const N=this.input.slice(t,this.state.pos);if(this.recordStrictModeErrors(S.StrictOctalLiteral,n),!this.state.strict){const M=N.indexOf("_");M>0&&this.raise(S.ZeroDigitNumericSeparator,a(n,M))}m=g&&!/[89]/.test(N)}let E=this.input.charCodeAt(this.state.pos);if(E===46&&!m&&(++this.state.pos,this.readInt(10),o=!0,E=this.input.charCodeAt(this.state.pos)),(E===69||E===101)&&!m&&(E=this.input.charCodeAt(++this.state.pos),(E===43||E===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(S.InvalidOrMissingExponent,n),o=!0,d=!0,E=this.input.charCodeAt(this.state.pos)),E===110&&((o||g)&&this.raise(S.InvalidBigIntLiteral,n),++this.state.pos,l=!0),E===109){this.expectPlugin("decimal",this.state.curPosition()),(d||g)&&this.raise(S.InvalidDecimal,n),++this.state.pos;var b=!0}if(nt(this.codePointAtPos(this.state.pos)))throw this.raise(S.NumberIdentifier,this.state.curPosition());const I=this.input.slice(t,this.state.pos).replace(/[_mn]/g,"");if(l){this.finishToken(136,I);return}if(b){this.finishToken(137,I);return}const C=m?parseInt(I,8):parseFloat(I);this.finishToken(135,C)}readCodePoint(r){const{code:t,pos:n}=ea(this.input,this.state.pos,this.state.lineStart,this.state.curLine,r,this.errorHandlers_readCodePoint);return this.state.pos=n,t}readString(r){const{str:t,pos:n,curLine:o,lineStart:l}=Xn(r===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=n+1,this.state.lineStart=l,this.state.curLine=o,this.finishToken(134,t)}readTemplateContinuation(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()}readTemplateToken(){const r=this.input[this.state.pos],{str:t,firstInvalidLoc:n,pos:o,curLine:l,lineStart:d}=Xn("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=o+1,this.state.lineStart=d,this.state.curLine=l,n&&(this.state.firstInvalidTemplateEscapePos=new s(n.curLine,n.pos-n.lineStart,this.sourceToOffsetPos(n.pos))),this.input.codePointAt(o)===96?this.finishToken(24,n?null:r+t+"`"):(this.state.pos++,this.finishToken(25,n?null:r+t+"${"))}recordStrictModeErrors(r,t){const n=t.index;this.state.strict&&!this.state.strictErrors.has(n)?this.raise(r,t):this.state.strictErrors.set(n,[r,t])}readWord1(r){this.state.containsEsc=!1;let t="";const n=this.state.pos;let o=this.state.pos;for(r!==void 0&&(this.state.pos+=r<=65535?1:2);this.state.pos<this.length;){const l=this.codePointAtPos(this.state.pos);if(kt(l))this.state.pos+=l<=65535?1:2;else if(l===92){this.state.containsEsc=!0,t+=this.input.slice(o,this.state.pos);const d=this.state.curPosition(),m=this.state.pos===n?nt:kt;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(S.MissingUnicodeEscape,this.state.curPosition()),o=this.state.pos-1;continue}++this.state.pos;const g=this.readCodePoint(!0);g!==null&&(m(g)||this.raise(S.EscapedCharNotAnIdentifier,d),t+=String.fromCodePoint(g)),o=this.state.pos}else break}return t+this.input.slice(o,this.state.pos)}readWord(r){const t=this.readWord1(r),n=tr.get(t);n!==void 0?this.finishToken(n,It(n)):this.finishToken(132,t)}checkKeywordEscapes(){const{type:r}=this.state;or(r)&&this.state.containsEsc&&this.raise(S.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:It(r)})}raise(r,t,n={}){const o=t instanceof s?t:t.loc.start,l=r(o,n);if(!(this.optionFlags&2048))throw l;return this.isLookahead||this.state.errors.push(l),l}raiseOverwrite(r,t,n={}){const o=t instanceof s?t:t.loc.start,l=o.index,d=this.state.errors;for(let m=d.length-1;m>=0;m--){const g=d[m];if(g.loc.index===l)return d[m]=r(o,n);if(g.loc.index<l)break}return this.raise(r,t,n)}updateContext(r){}unexpected(r,t){throw this.raise(S.UnexpectedToken,r??this.state.startLoc,{expected:t?It(t):null})}expectPlugin(r,t){if(this.hasPlugin(r))return!0;throw this.raise(S.MissingPlugin,t??this.state.startLoc,{missingPlugin:[r]})}expectOnePlugin(r){if(!r.some(t=>this.hasPlugin(t)))throw this.raise(S.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:r})}errorBuilder(r){return(t,n,o)=>{this.raise(r,xs(t,n,o))}}}class $h{constructor(){this.privateNames=new Set,this.loneAccessors=new Map,this.undefinedPrivateNames=new Map}}class Fh{constructor(r){this.parser=void 0,this.stack=[],this.undefinedPrivateNames=new Map,this.parser=r}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new $h)}exit(){const r=this.stack.pop(),t=this.current();for(const[n,o]of Array.from(r.undefinedPrivateNames))t?t.undefinedPrivateNames.has(n)||t.undefinedPrivateNames.set(n,o):this.parser.raise(S.InvalidPrivateFieldResolution,o,{identifierName:n})}declarePrivateName(r,t,n){const{privateNames:o,loneAccessors:l,undefinedPrivateNames:d}=this.current();let m=o.has(r);if(t&3){const g=m&&l.get(r);if(g){const E=g&4,b=t&4,I=g&3,C=t&3;m=I===C||E!==b,m||l.delete(r)}else m||l.set(r,t)}m&&this.parser.raise(S.PrivateNameRedeclaration,n,{identifierName:r}),o.add(r),d.delete(r)}usePrivateName(r,t){let n;for(n of this.stack)if(n.privateNames.has(r))return;n?n.undefinedPrivateNames.set(r,t):this.parser.raise(S.InvalidPrivateFieldResolution,t,{identifierName:r})}}class Ks{constructor(r=0){this.type=r}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}}class ta extends Ks{constructor(r){super(r),this.declarationErrors=new Map}recordDeclarationError(r,t){const n=t.index;this.declarationErrors.set(n,[r,t])}clearDeclarationError(r){this.declarationErrors.delete(r)}iterateErrors(r){this.declarationErrors.forEach(r)}}class Bh{constructor(r){this.parser=void 0,this.stack=[new Ks],this.parser=r}enter(r){this.stack.push(r)}exit(){this.stack.pop()}recordParameterInitializerError(r,t){const n=t.loc.start,{stack:o}=this;let l=o.length-1,d=o[l];for(;!d.isCertainlyParameterDeclaration();){if(d.canBeArrowParameterDeclaration())d.recordDeclarationError(r,n);else return;d=o[--l]}this.parser.raise(r,n)}recordArrowParameterBindingError(r,t){const{stack:n}=this,o=n[n.length-1],l=t.loc.start;if(o.isCertainlyParameterDeclaration())this.parser.raise(r,l);else if(o.canBeArrowParameterDeclaration())o.recordDeclarationError(r,l);else return}recordAsyncArrowParametersError(r){const{stack:t}=this;let n=t.length-1,o=t[n];for(;o.canBeArrowParameterDeclaration();)o.type===2&&o.recordDeclarationError(S.AwaitBindingIdentifier,r),o=t[--n]}validateAsPattern(){const{stack:r}=this,t=r[r.length-1];t.canBeArrowParameterDeclaration()&&t.iterateErrors(([n,o])=>{this.parser.raise(n,o);let l=r.length-2,d=r[l];for(;d.canBeArrowParameterDeclaration();)d.clearDeclarationError(o.index),d=r[--l]})}}function Uh(){return new Ks(3)}function jh(){return new ta(1)}function zh(){return new ta(2)}function sa(){return new Ks}class Vh extends Mh{addExtra(r,t,n,o=!0){if(!r)return;let{extra:l}=r;l==null&&(l={},r.extra=l),o?l[t]=n:Object.defineProperty(l,t,{enumerable:o,value:n})}isContextual(r){return this.state.type===r&&!this.state.containsEsc}isUnparsedContextual(r,t){if(this.input.startsWith(t,r)){const n=this.input.charCodeAt(r+t.length);return!(kt(n)||(n&64512)===55296)}return!1}isLookaheadContextual(r){const t=this.nextTokenStart();return this.isUnparsedContextual(t,r)}eatContextual(r){return this.isContextual(r)?(this.next(),!0):!1}expectContextual(r,t){if(!this.eatContextual(r)){if(t!=null)throw this.raise(t,this.state.startLoc);this.unexpected(null,r)}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return qn(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return qn(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(r=!0){(r?this.isLineTerminator():this.eat(13))||this.raise(S.MissingSemicolon,this.state.lastTokEndLoc)}expect(r,t){this.eat(r)||this.unexpected(t,r)}tryParse(r,t=this.state.clone()){const n={node:null};try{const o=r((l=null)=>{throw n.node=l,n});if(this.state.errors.length>t.errors.length){const l=this.state;return this.state=t,this.state.tokensLength=l.tokensLength,{node:o,error:l.errors[t.errors.length],thrown:!1,aborted:!1,failState:l}}return{node:o,error:null,thrown:!1,aborted:!1,failState:null}}catch(o){const l=this.state;if(this.state=t,o instanceof SyntaxError)return{node:null,error:o,thrown:!0,aborted:!1,failState:l};if(o===n)return{node:n.node,error:null,thrown:!1,aborted:!0,failState:l};throw o}}checkExpressionErrors(r,t){if(!r)return!1;const{shorthandAssignLoc:n,doubleProtoLoc:o,privateKeyLoc:l,optionalParametersLoc:d,voidPatternLoc:m}=r,g=!!n||!!o||!!d||!!l||!!m;if(!t)return g;n!=null&&this.raise(S.InvalidCoverInitializedName,n),o!=null&&this.raise(S.DuplicateProto,o),l!=null&&this.raise(S.UnexpectedPrivateField,l),d!=null&&this.unexpected(d),m!=null&&this.raise(S.InvalidCoverDiscardElement,m)}isLiteralPropertyName(){return Un(this.state.type)}isPrivateName(r){return r.type==="PrivateName"}getPrivateNameSV(r){return r.id.name}hasPropertyAsPrivateName(r){return(r.type==="MemberExpression"||r.type==="OptionalMemberExpression")&&this.isPrivateName(r.property)}isObjectProperty(r){return r.type==="ObjectProperty"}isObjectMethod(r){return r.type==="ObjectMethod"}initializeScopes(r=this.options.sourceType==="module"){const t=this.state.labels;this.state.labels=[];const n=this.exportedIdentifiers;this.exportedIdentifiers=new Set;const o=this.inModule;this.inModule=r;const l=this.scope,d=this.getScopeHandler();this.scope=new d(this,r);const m=this.prodParam;this.prodParam=new vh;const g=this.classScope;this.classScope=new Fh(this);const E=this.expressionScope;return this.expressionScope=new Bh(this),()=>{this.state.labels=t,this.exportedIdentifiers=n,this.inModule=o,this.scope=l,this.prodParam=m,this.classScope=g,this.expressionScope=E}}enterInitialScopes(){let r=0;(this.inModule||this.optionFlags&1)&&(r|=2),this.optionFlags&32&&(r|=1);const t=!this.inModule&&this.options.sourceType==="commonjs";(t||this.optionFlags&2)&&(r|=4),this.prodParam.enter(r);let n=t?514:1;this.optionFlags&4&&(n|=512),this.scope.enter(n)}checkDestructuringPrivate(r){const{privateKeyLoc:t}=r;t!==null&&this.expectPlugin("destructuringPrivate",t)}}class qs{constructor(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null,this.voidPatternLoc=null}}class Ys{constructor(r,t,n){this.type="",this.start=t,this.end=0,this.loc=new i(n),r?.optionFlags&128&&(this.range=[t,0]),r!=null&&r.filename&&(this.loc.filename=r.filename)}}const gr=Ys.prototype;gr.__clone=function(){const p=new Ys(void 0,this.start,this.loc.start),r=Object.keys(this);for(let t=0,n=r.length;t<n;t++){const o=r[t];o!=="leadingComments"&&o!=="trailingComments"&&o!=="innerComments"&&(p[o]=this[o])}return p};class Gh extends Vh{startNode(){const r=this.state.startLoc;return new Ys(this,r.index,r)}startNodeAt(r){return new Ys(this,r.index,r)}startNodeAtNode(r){return this.startNodeAt(r.loc.start)}finishNode(r,t){return this.finishNodeAt(r,t,this.state.lastTokEndLoc)}finishNodeAt(r,t,n){return r.type=t,r.end=n.index,r.loc.end=n,this.optionFlags&128&&(r.range[1]=n.index),this.optionFlags&4096&&this.processComment(r),r}resetStartLocation(r,t){r.start=t.index,r.loc.start=t,this.optionFlags&128&&(r.range[0]=t.index)}resetEndLocation(r,t=this.state.lastTokEndLoc){r.end=t.index,r.loc.end=t,this.optionFlags&128&&(r.range[1]=t.index)}resetStartLocationFromNode(r,t){this.resetStartLocation(r,t.loc.start)}castNodeTo(r,t){return r.type=t,r}cloneIdentifier(r){const{type:t,start:n,end:o,loc:l,range:d,name:m}=r,g=Object.create(gr);return g.type=t,g.start=n,g.end=o,g.loc=l,g.range=d,g.name=m,r.extra&&(g.extra=r.extra),g}cloneStringLiteral(r){const{type:t,start:n,end:o,loc:l,range:d,extra:m}=r,g=Object.create(gr);return g.type=t,g.start=n,g.end=o,g.loc=l,g.range=d,g.extra=m,g.value=r.value,g}}const Er=p=>p.type==="ParenthesizedExpression"?Er(p.expression):p;class Hh extends Gh{toAssignable(r,t=!1){var n,o;let l;switch((r.type==="ParenthesizedExpression"||(n=r.extra)!=null&&n.parenthesized)&&(l=Er(r),t?l.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(S.InvalidParenthesizedAssignment,r):l.type!=="CallExpression"&&l.type!=="MemberExpression"&&!this.isOptionalMemberExpression(l)&&this.raise(S.InvalidParenthesizedAssignment,r):this.raise(S.InvalidParenthesizedAssignment,r)),r.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(r,"ObjectPattern");for(let m=0,g=r.properties.length,E=g-1;m<g;m++){var d;const b=r.properties[m],I=m===E;this.toAssignableObjectExpressionProp(b,I,t),I&&b.type==="RestElement"&&(d=r.extra)!=null&&d.trailingCommaLoc&&this.raise(S.RestTrailingComma,r.extra.trailingCommaLoc)}break;case"ObjectProperty":{const{key:m,value:g}=r;this.isPrivateName(m)&&this.classScope.usePrivateName(this.getPrivateNameSV(m),m.loc.start),this.toAssignable(g,t);break}case"SpreadElement":throw new Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");case"ArrayExpression":this.castNodeTo(r,"ArrayPattern"),this.toAssignableList(r.elements,(o=r.extra)==null?void 0:o.trailingCommaLoc,t);break;case"AssignmentExpression":r.operator!=="="&&this.raise(S.MissingEqInAssignment,r.left.loc.end),this.castNodeTo(r,"AssignmentPattern"),delete r.operator,r.left.type==="VoidPattern"&&this.raise(S.VoidPatternInitializer,r.left),this.toAssignable(r.left,t);break;case"ParenthesizedExpression":this.toAssignable(l,t);break}}toAssignableObjectExpressionProp(r,t,n){if(r.type==="ObjectMethod")this.raise(r.kind==="get"||r.kind==="set"?S.PatternHasAccessor:S.PatternHasMethod,r.key);else if(r.type==="SpreadElement"){this.castNodeTo(r,"RestElement");const o=r.argument;this.checkToRestConversion(o,!1),this.toAssignable(o,n),t||this.raise(S.RestTrailingComma,r)}else this.toAssignable(r,n)}toAssignableList(r,t,n){const o=r.length-1;for(let l=0;l<=o;l++){const d=r[l];d&&(this.toAssignableListItem(r,l,n),d.type==="RestElement"&&(l<o?this.raise(S.RestTrailingComma,d):t&&this.raise(S.RestTrailingComma,t)))}}toAssignableListItem(r,t,n){const o=r[t];if(o.type==="SpreadElement"){this.castNodeTo(o,"RestElement");const l=o.argument;this.checkToRestConversion(l,!0),this.toAssignable(l,n)}else this.toAssignable(o,n)}isAssignable(r,t){switch(r.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":return!0;case"ObjectExpression":{const n=r.properties.length-1;return r.properties.every((o,l)=>o.type!=="ObjectMethod"&&(l===n||o.type!=="SpreadElement")&&this.isAssignable(o))}case"ObjectProperty":return this.isAssignable(r.value);case"SpreadElement":return this.isAssignable(r.argument);case"ArrayExpression":return r.elements.every(n=>n===null||this.isAssignable(n));case"AssignmentExpression":return r.operator==="=";case"ParenthesizedExpression":return this.isAssignable(r.expression);case"MemberExpression":case"OptionalMemberExpression":return!t;default:return!1}}toReferencedList(r,t){return r}toReferencedListDeep(r,t){this.toReferencedList(r,t);for(const n of r)n?.type==="ArrayExpression"&&this.toReferencedListDeep(n.elements)}parseSpread(r){const t=this.startNode();return this.next(),t.argument=this.parseMaybeAssignAllowIn(r,void 0),this.finishNode(t,"SpreadElement")}parseRestBinding(){const r=this.startNode();this.next();const t=this.parseBindingAtom();return t.type==="VoidPattern"&&this.raise(S.UnexpectedVoidPattern,t),r.argument=t,this.finishNode(r,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{const r=this.startNode();return this.next(),r.elements=this.parseBindingList(3,93,1),this.finishNode(r,"ArrayPattern")}case 5:return this.parseObjectLike(8,!0);case 88:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(r,t,n){const o=n&1,l=[];let d=!0;for(;!this.eat(r);)if(d?d=!1:this.expect(12),o&&this.match(12))l.push(null);else{if(this.eat(r))break;if(this.match(21)){let m=this.parseRestBinding();if((this.hasPlugin("flow")||n&2)&&(m=this.parseFunctionParamType(m)),l.push(m),!this.checkCommaAfterRest(t)){this.expect(r);break}}else{const m=[];if(n&2)for(this.match(26)&&this.hasPlugin("decorators")&&this.raise(S.UnsupportedParameterDecorator,this.state.startLoc);this.match(26);)m.push(this.parseDecorator());l.push(this.parseBindingElement(n,m))}}return l}parseBindingRestProperty(r){return this.next(),this.hasPlugin("discardBinding")&&this.match(88)?(r.argument=this.parseVoidPattern(null),this.raise(S.UnexpectedVoidPattern,r.argument)):r.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(r,"RestElement")}parseBindingProperty(){const{type:r,startLoc:t}=this.state;if(r===21)return this.parseBindingRestProperty(this.startNode());const n=this.startNode();return r===139?(this.expectPlugin("destructuringPrivate",t),this.classScope.usePrivateName(this.state.value,t),n.key=this.parsePrivateName()):this.parsePropertyName(n),n.method=!1,this.parseObjPropValue(n,t,!1,!1,!0,!1)}parseBindingElement(r,t){const n=this.parseMaybeDefault();return(this.hasPlugin("flow")||r&2)&&this.parseFunctionParamType(n),t.length&&(n.decorators=t,this.resetStartLocationFromNode(n,t[0])),this.parseMaybeDefault(n.loc.start,n)}parseFunctionParamType(r){return r}parseMaybeDefault(r,t){if(r??(r=this.state.startLoc),t=t??this.parseBindingAtom(),!this.eat(29))return t;const n=this.startNodeAt(r);return t.type==="VoidPattern"&&this.raise(S.VoidPatternInitializer,t),n.left=t,n.right=this.parseMaybeAssignAllowIn(),this.finishNode(n,"AssignmentPattern")}isValidLVal(r,t,n,o){switch(r){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";case"VoidPattern":return!0;case"CallExpression":if(!t&&!this.state.strict&&this.optionFlags&8192)return!0}return!1}isOptionalMemberExpression(r){return r.type==="OptionalMemberExpression"}checkLVal(r,t,n=64,o=!1,l=!1,d=!1,m=!1){var g;const E=r.type;if(this.isObjectMethod(r))return;const b=this.isOptionalMemberExpression(r);if(b||E==="MemberExpression"){b&&(this.expectPlugin("optionalChainingAssign",r.loc.start),t.type!=="AssignmentExpression"&&this.raise(S.InvalidLhsOptionalChaining,r,{ancestor:t})),n!==64&&this.raise(S.InvalidPropertyBindingPattern,r);return}if(E==="Identifier"){this.checkIdentifier(r,n,l);const{name:H}=r;o&&(o.has(H)?this.raise(S.ParamDupe,r):o.add(H));return}else E==="VoidPattern"&&t.type==="CatchClause"&&this.raise(S.VoidPatternCatchClauseParam,r);const I=Er(r);m||(m=I.type==="CallExpression"&&(I.callee.type==="Import"||I.callee.type==="Super"));const C=this.isValidLVal(E,m,!(d||(g=r.extra)!=null&&g.parenthesized)&&t.type==="AssignmentExpression",n);if(C===!0)return;if(C===!1){const H=n===64?S.InvalidLhs:S.InvalidLhsBinding;this.raise(H,r,{ancestor:t});return}let N,M;typeof C=="string"?(N=C,M=E==="ParenthesizedExpression"):[N,M]=C;const Q=E==="ArrayPattern"||E==="ObjectPattern"?{type:E}:t,le=r[N];if(Array.isArray(le))for(const H of le)H&&this.checkLVal(H,Q,n,o,l,M,!0);else le&&this.checkLVal(le,Q,n,o,l,M,m)}checkIdentifier(r,t,n=!1){this.state.strict&&(n?Wn(r.name,this.inModule):Zn(r.name))&&(t===64?this.raise(S.StrictEvalArguments,r,{referenceName:r.name}):this.raise(S.StrictEvalArgumentsBinding,r,{bindingName:r.name})),t&8192&&r.name==="let"&&this.raise(S.LetInLexicalBinding,r),t&64||this.declareNameFromIdentifier(r,t)}declareNameFromIdentifier(r,t){this.scope.declareName(r.name,t,r.loc.start)}checkToRestConversion(r,t){switch(r.type){case"ParenthesizedExpression":this.checkToRestConversion(r.expression,t);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(t)break;default:this.raise(S.InvalidRestAssignmentPattern,r)}}checkCommaAfterRest(r){return this.match(12)?(this.raise(this.lookaheadCharCode()===r?S.RestTrailingComma:S.ElementAfterRest,this.state.startLoc),!0):!1}}const Tr=/in(?:stanceof)?|as|satisfies/y;function Zh(p){if(p==null)throw new Error(`Unexpected ${p} value.`);return p}function ia(p){if(!p)throw new Error("Assert fail")}const D=Ce`typescript`({AbstractMethodHasImplementation:({methodName:p})=>`Method '${p}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:p})=>`Property '${p}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind:p})=>`'declare' is not allowed in ${p}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:p})=>`Accessibility modifier already seen: '${p}'.`,DuplicateModifier:({modifier:p})=>`Duplicate modifier: '${p}'.`,EmptyHeritageClauseType:({token:p})=>`'${p}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:p})=>`'${p[0]}' modifier cannot be used with '${p[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:p})=>`Index signatures cannot have an accessibility modifier ('${p}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token:p})=>`'${p}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:p=>`'${p}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:p})=>`'${p}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:p})=>`'${p}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:p})=>`'${p}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:p=>`'${p}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:p})=>`'${p[0]}' modifier must precede '${p[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:p})=>`Private elements cannot have an accessibility modifier ('${p}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:p})=>`Single type parameter ${p} should have a trailing comma. Example usage: <${p},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:p})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${p}.`,UsingDeclarationInAmbientContext:p=>`'${p}' declarations are not allowed in ambient contexts.`});function Wh(p){switch(p){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function ra(p){return p==="private"||p==="public"||p==="protected"}function Kh(p){return p==="in"||p==="out"}var qh=p=>class extends p{constructor(...t){super(...t),this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:D.InvalidModifierOnTypeParameter}),this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:D.InvalidModifierOnTypeParameterPositions}),this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:D.InvalidModifierOnTypeParameter})}getScopeHandler(){return Ch}tsIsIdentifier(){return ie(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(139)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){return this.next(),this.hasPrecedingLineBreak()?!1:this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){return this.match(106)?(this.next(),this.tsTokenCanFollowModifier()):this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(t,n,o){if(!ie(this.state.type)&&this.state.type!==58&&this.state.type!==75)return;const l=this.state.value;if(t.includes(l)){if(o&&this.match(106)||n&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return l}}tsParseModifiers({allowedModifiers:t,disallowedModifiers:n,stopOnStartOfClassStaticBlock:o,errorTemplate:l=D.InvalidModifierOnTypeMember},d){const m=(E,b,I,C)=>{b===I&&d[C]&&this.raise(D.InvalidModifiersOrder,E,{orderedModifiers:[I,C]})},g=(E,b,I,C)=>{(d[I]&&b===C||d[C]&&b===I)&&this.raise(D.IncompatibleModifiers,E,{modifiers:[I,C]})};for(;;){const{startLoc:E}=this.state,b=this.tsParseModifier(t.concat(n??[]),o,d.static);if(!b)break;ra(b)?d.accessibility?this.raise(D.DuplicateAccessibilityModifier,E,{modifier:b}):(m(E,b,b,"override"),m(E,b,b,"static"),m(E,b,b,"readonly"),d.accessibility=b):Kh(b)?(d[b]&&this.raise(D.DuplicateModifier,E,{modifier:b}),d[b]=!0,m(E,b,"in","out")):(hasOwnProperty.call(d,b)?this.raise(D.DuplicateModifier,E,{modifier:b}):(m(E,b,"static","readonly"),m(E,b,"static","override"),m(E,b,"override","readonly"),m(E,b,"abstract","override"),g(E,b,"declare","override"),g(E,b,"static","abstract")),d[b]=!0),n!=null&&n.includes(b)&&this.raise(l,E,{modifier:b})}}tsIsListTerminator(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48)}}tsParseList(t,n){const o=[];for(;!this.tsIsListTerminator(t);)o.push(n());return o}tsParseDelimitedList(t,n,o){return Zh(this.tsParseDelimitedListWorker(t,n,!0,o))}tsParseDelimitedListWorker(t,n,o,l){const d=[];let m=-1;for(;!this.tsIsListTerminator(t);){m=-1;const g=n();if(g==null)return;if(d.push(g),this.eat(12)){m=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(t))break;o&&this.expect(12);return}return l&&(l.value=m),d}tsParseBracketedList(t,n,o,l,d){l||(o?this.expect(0):this.expect(47));const m=this.tsParseDelimitedList(t,n,d);return o?this.expect(3):this.expect(48),m}tsParseImportType(){const t=this.startNode();return this.expect(83),this.expect(10),this.match(134)?t.argument=this.parseStringLiteral(this.state.value):(this.raise(D.UnsupportedImportTypeArgument,this.state.startLoc),t.argument=super.parseExprAtom()),this.eat(12)?t.options=this.tsParseImportTypeOptions():t.options=null,this.expect(11),this.eat(16)&&(t.qualifier=this.tsParseEntityName(3)),this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")}tsParseImportTypeOptions(){const t=this.startNode();this.expect(5);const n=this.startNode();return this.isContextual(76)?(n.method=!1,n.key=this.parseIdentifier(!0),n.computed=!1,n.shorthand=!1):this.unexpected(null,76),this.expect(14),n.value=this.tsParseImportTypeWithPropertyValue(),t.properties=[this.finishObjectProperty(n)],this.eat(12),this.expect(8),this.finishNode(t,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){const t=this.startNode(),n=[];for(this.expect(5);!this.match(8);){const o=this.state.type;ie(o)||o===134?n.push(super.parsePropertyDefinition(null)):this.unexpected(),this.eat(12)}return t.properties=n,this.next(),this.finishNode(t,"ObjectExpression")}tsParseEntityName(t){let n;if(t&1&&this.match(78))if(t&2)n=this.parseIdentifier(!0);else{const o=this.startNode();this.next(),n=this.finishNode(o,"ThisExpression")}else n=this.parseIdentifier(!!(t&1));for(;this.eat(16);){const o=this.startNodeAtNode(n);o.left=n,o.right=this.parseIdentifier(!!(t&1)),n=this.finishNode(o,"TSQualifiedName")}return n}tsParseTypeReference(){const t=this.startNode();return t.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")}tsParseThisTypePredicate(t){this.next();const n=this.startNodeAtNode(t);return n.parameterName=t,n.typeAnnotation=this.tsParseTypeAnnotation(!1),n.asserts=!1,this.finishNode(n,"TSTypePredicate")}tsParseThisTypeNode(){const t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")}tsParseTypeQuery(){const t=this.startNode();return this.expect(87),this.match(83)?t.exprName=this.tsParseImportType():t.exprName=this.tsParseEntityName(3),!this.hasPrecedingLineBreak()&&this.match(47)&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeQuery")}tsParseTypeParameter(t){const n=this.startNode();return t(n),n.name=this.tsParseTypeParameterName(),n.constraint=this.tsEatThenParseType(81),n.default=this.tsEatThenParseType(29),this.finishNode(n,"TSTypeParameter")}tsTryParseTypeParameters(t){if(this.match(47))return this.tsParseTypeParameters(t)}tsParseTypeParameters(t){const n=this.startNode();this.match(47)||this.match(143)?this.next():this.unexpected();const o={value:-1};return n.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,t),!1,!0,o),n.params.length===0&&this.raise(D.EmptyTypeParameters,n),o.value!==-1&&this.addExtra(n,"trailingComma",o.value),this.finishNode(n,"TSTypeParameterDeclaration")}tsFillSignature(t,n){const o=t===19,l="parameters",d="typeAnnotation";n.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(10),n[l]=this.tsParseBindingListForSignature(),o?n[d]=this.tsParseTypeOrTypePredicateAnnotation(t):this.match(t)&&(n[d]=this.tsParseTypeOrTypePredicateAnnotation(t))}tsParseBindingListForSignature(){const t=super.parseBindingList(11,41,2);for(const n of t){const{type:o}=n;(o==="AssignmentPattern"||o==="TSParameterProperty")&&this.raise(D.UnsupportedSignatureParameterKind,n,{type:o})}return t}tsParseTypeMemberSemicolon(){!this.eat(12)&&!this.isLineTerminator()&&this.expect(13)}tsParseSignatureMember(t,n){return this.tsFillSignature(14,n),this.tsParseTypeMemberSemicolon(),this.finishNode(n,t)}tsIsUnambiguouslyIndexSignature(){return this.next(),ie(this.state.type)?(this.next(),this.match(14)):!1}tsTryParseIndexSignature(t){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);const n=this.parseIdentifier();n.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(n),this.expect(3),t.parameters=[n];const o=this.tsTryParseTypeAnnotation();return o&&(t.typeAnnotation=o),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSIndexSignature")}tsParsePropertyOrMethodSignature(t,n){if(this.eat(17)&&(t.optional=!0),this.match(10)||this.match(47)){n&&this.raise(D.ReadonlyForMethodSignature,t);const o=t;o.kind&&this.match(47)&&this.raise(D.AccessorCannotHaveTypeParameters,this.state.curPosition()),this.tsFillSignature(14,o),this.tsParseTypeMemberSemicolon();const l="parameters",d="typeAnnotation";if(o.kind==="get")o[l].length>0&&(this.raise(S.BadGetterArity,this.state.curPosition()),this.isThisParam(o[l][0])&&this.raise(D.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if(o.kind==="set"){if(o[l].length!==1)this.raise(S.BadSetterArity,this.state.curPosition());else{const m=o[l][0];this.isThisParam(m)&&this.raise(D.AccessorCannotDeclareThisParameter,this.state.curPosition()),m.type==="Identifier"&&m.optional&&this.raise(D.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),m.type==="RestElement"&&this.raise(D.SetAccessorCannotHaveRestParameter,this.state.curPosition())}o[d]&&this.raise(D.SetAccessorCannotHaveReturnType,o[d])}else o.kind="method";return this.finishNode(o,"TSMethodSignature")}else{const o=t;n&&(o.readonly=!0);const l=this.tsTryParseTypeAnnotation();return l&&(o.typeAnnotation=l),this.tsParseTypeMemberSemicolon(),this.finishNode(o,"TSPropertySignature")}}tsParseTypeMember(){const t=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(77)){const o=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",t):(t.key=this.createIdentifier(o,"new"),this.tsParsePropertyOrMethodSignature(t,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},t);const n=this.tsTryParseIndexSignature(t);return n||(super.parsePropertyName(t),!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.tsTokenCanFollowModifier()&&(t.kind=t.key.name,super.parsePropertyName(t),!this.match(10)&&!this.match(47)&&this.unexpected(null,10)),this.tsParsePropertyOrMethodSignature(t,!!t.readonly))}tsParseTypeLiteral(){const t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(5);const t=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(8),t}tsIsStartOfMappedType(){return this.next(),this.eat(53)?this.isContextual(122):(this.isContextual(122)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(58)))}tsParseMappedType(){const t=this.startNode();this.expect(5),this.match(53)?(t.readonly=this.state.value,this.next(),this.expectContextual(122)):this.eatContextual(122)&&(t.readonly=!0),this.expect(0);const n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsExpectThenParseType(58),t.typeParameter=this.finishNode(n,"TSTypeParameter"),t.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(t.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(t,"TSMappedType")}tsParseTupleType(){const t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let n=!1;return t.elementTypes.forEach(o=>{const{type:l}=o;n&&l!=="TSRestType"&&l!=="TSOptionalType"&&!(l==="TSNamedTupleMember"&&o.optional)&&this.raise(D.OptionalTypeBeforeRequired,o),n||(n=l==="TSNamedTupleMember"&&o.optional||l==="TSOptionalType")}),this.finishNode(t,"TSTupleType")}tsParseTupleElementType(){const t=this.state.startLoc,n=this.eat(21),{startLoc:o}=this.state;let l,d,m,g;const b=Xe(this.state.type)?this.lookaheadCharCode():null;if(b===58)l=!0,m=!1,d=this.parseIdentifier(!0),this.expect(14),g=this.tsParseType();else if(b===63){m=!0;const I=this.state.value,C=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(l=!0,d=this.createIdentifier(this.startNodeAt(o),I),this.expect(17),this.expect(14),g=this.tsParseType()):(l=!1,g=C,this.expect(17))}else g=this.tsParseType(),m=this.eat(17),l=this.eat(14);if(l){let I;d?(I=this.startNodeAt(o),I.optional=m,I.label=d,I.elementType=g,this.eat(17)&&(I.optional=!0,this.raise(D.TupleOptionalAfterType,this.state.lastTokStartLoc))):(I=this.startNodeAt(o),I.optional=m,this.raise(D.InvalidTupleMemberLabel,g),I.label=g,I.elementType=this.tsParseType()),g=this.finishNode(I,"TSNamedTupleMember")}else if(m){const I=this.startNodeAt(o);I.typeAnnotation=g,g=this.finishNode(I,"TSOptionalType")}if(n){const I=this.startNodeAt(t);I.typeAnnotation=g,g=this.finishNode(I,"TSRestType")}return g}tsParseParenthesizedType(){const t=this.startNode();return this.expect(10),t.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(t,"TSParenthesizedType")}tsParseFunctionOrConstructorType(t,n){const o=this.startNode();return t==="TSConstructorType"&&(o.abstract=!!n,n&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,o)),this.finishNode(o,t)}tsParseLiteralTypeNode(){const t=this.startNode();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:t.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(t,"TSLiteralType")}tsParseTemplateLiteralType(){const t=this.startNode();return t.literal=super.parseTemplate(!1),this.finishNode(t,"TSLiteralType")}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){const t=this.tsParseThisTypeNode();return this.isContextual(116)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const t=this.startNode(),n=this.lookahead();return n.type!==135&&n.type!==136&&this.unexpected(),t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{const{type:t}=this.state;if(ie(t)||t===88||t===84){const n=t===88?"TSVoidKeyword":t===84?"TSNullKeyword":Wh(this.state.value);if(n!==void 0&&this.lookaheadCharCode()!==46){const o=this.startNode();return this.next(),this.finishNode(o,n)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){const{startLoc:t}=this.state;let n=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){const o=this.startNodeAt(t);o.elementType=n,this.expect(3),n=this.finishNode(o,"TSArrayType")}else{const o=this.startNodeAt(t);o.objectType=n,o.indexType=this.tsParseType(),this.expect(3),n=this.finishNode(o,"TSIndexedAccessType")}return n}tsParseTypeOperator(){const t=this.startNode(),n=this.state.value;return this.next(),t.operator=n,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),n==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(t),this.finishNode(t,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(D.UnexpectedReadonly,t)}}tsParseInferType(){const t=this.startNode();this.expectContextual(115);const n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),t.typeParameter=this.finishNode(n,"TSTypeParameter"),this.finishNode(t,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(81)){const t=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17))return t}}tsParseTypeOperatorOrHigher(){return th(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(t,n,o){const l=this.startNode(),d=this.eat(o),m=[];do m.push(n());while(this.eat(o));return m.length===1&&!d?m[0]:(l.types=m,this.finishNode(l,t))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){return this.match(47)?!0:this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(ie(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){const{errors:t}=this.state,n=t.length;try{return this.parseObjectLike(8,!0),t.length===n}catch{return!1}}if(this.match(0)){this.next();const{errors:t}=this.state,n=t.length;try{return super.parseBindingList(3,93,1),t.length===n}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(11)||this.match(21)||this.tsSkipParameterStart()&&(this.match(14)||this.match(12)||this.match(17)||this.match(29)||this.match(11)&&(this.next(),this.match(19))))}tsParseTypeOrTypePredicateAnnotation(t){return this.tsInType(()=>{const n=this.startNode();this.expect(t);const o=this.startNode(),l=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(l&&this.match(78)){let g=this.tsParseThisTypeOrThisTypePredicate();return g.type==="TSThisType"?(o.parameterName=g,o.asserts=!0,o.typeAnnotation=null,g=this.finishNode(o,"TSTypePredicate")):(this.resetStartLocationFromNode(g,o),g.asserts=!0),n.typeAnnotation=g,this.finishNode(n,"TSTypeAnnotation")}const d=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!d)return l?(o.parameterName=this.parseIdentifier(),o.asserts=l,o.typeAnnotation=null,n.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,n);const m=this.tsParseTypeAnnotation(!1);return o.parameterName=d,o.typeAnnotation=m,o.asserts=l,n.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(14))return this.tsParseTypeOrTypePredicateAnnotation(14)}tsTryParseTypeAnnotation(){if(this.match(14))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){const t=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak())return this.next(),t}tsParseTypePredicateAsserts(){if(this.state.type!==109)return!1;const t=this.state.containsEsc;return this.next(),!ie(this.state.type)&&!this.match(78)?!1:(t&&this.raise(S.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(t=!0,n=this.startNode()){return this.tsInType(()=>{t&&this.expect(14),n.typeAnnotation=this.tsParseType()}),this.finishNode(n,"TSTypeAnnotation")}tsParseType(){ia(this.state.inType);const t=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return t;const n=this.startNodeAtNode(t);return n.checkType=t,n.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(17),n.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(14),n.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(n,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(124)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(77)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(D.ReservedTypeAssertion,this.state.startLoc);const t=this.startNode();return t.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?this.tsParseTypeReference():this.tsParseType())),this.expect(48),t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")}tsParseHeritageClause(t){const n=this.state.startLoc,o=this.tsParseDelimitedList("HeritageClauseElement",()=>{const l=this.startNode();return l.expression=this.tsParseEntityName(3),this.match(47)&&(l.typeParameters=this.tsParseTypeArguments()),this.finishNode(l,"TSExpressionWithTypeArguments")});return o.length||this.raise(D.EmptyHeritageClauseType,n,{token:t}),o}tsParseInterfaceDeclaration(t,n={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129),n.declare&&(t.declare=!0),ie(this.state.type)?(t.id=this.parseIdentifier(),this.checkIdentifier(t.id,130)):(t.id=null,this.raise(D.MissingInterfaceName,this.state.startLoc)),t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(t.extends=this.tsParseHeritageClause("extends"));const o=this.startNode();return o.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),t.body=this.finishNode(o,"TSInterfaceBody"),this.finishNode(t,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(t){return t.id=this.parseIdentifier(),this.checkIdentifier(t.id,2),t.typeAnnotation=this.tsInType(()=>{if(t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(29),this.isContextual(114)&&this.lookaheadCharCode()!==46){const n=this.startNode();return this.next(),this.finishNode(n,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(t,"TSTypeAliasDeclaration")}tsInTopLevelContext(t){if(this.curContext()!==$.brace){const n=this.state.context;this.state.context=[n[0]];try{return t()}finally{this.state.context=n}}else return t()}tsInType(t){const n=this.state.inType;this.state.inType=!0;try{return t()}finally{this.state.inType=n}}tsInDisallowConditionalTypesContext(t){const n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.state.inDisallowConditionalTypesContext=n}}tsInAllowConditionalTypesContext(t){const n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.state.inDisallowConditionalTypesContext=n}}tsEatThenParseType(t){if(this.match(t))return this.tsNextThenParseType()}tsExpectThenParseType(t){return this.tsInType(()=>(this.expect(t),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){const t=this.startNode();return t.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(29)&&(t.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(t,"TSEnumMember")}tsParseEnumDeclaration(t,n={}){return n.const&&(t.const=!0),n.declare&&(t.declare=!0),this.expectContextual(126),t.id=this.parseIdentifier(),this.checkIdentifier(t.id,t.const?8971:8459),this.expect(5),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(t,"TSEnumDeclaration")}tsParseEnumBody(){const t=this.startNode();return this.expect(5),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(t,"TSEnumBody")}tsParseModuleBlock(){const t=this.startNode();return this.scope.enter(0),this.expect(5),super.parseBlockOrModuleBlockBody(t.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(t,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(t,n=!1){if(t.id=this.parseIdentifier(),n||this.checkIdentifier(t.id,1024),this.eat(16)){const o=this.startNode();this.tsParseModuleOrNamespaceDeclaration(o,!0),t.body=o}else this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit();return this.finishNode(t,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(t){return this.isContextual(112)?(t.kind="global",t.global=!0,t.id=this.parseIdentifier()):this.match(134)?(t.kind="module",t.id=super.parseStringLiteral(this.state.value)):this.unexpected(),this.match(5)?(this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(t,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(t,n,o){t.isExport=o||!1,t.id=n||this.parseIdentifier(),this.checkIdentifier(t.id,4096),this.expect(29);const l=this.tsParseModuleReference();return t.importKind==="type"&&l.type!=="TSExternalModuleReference"&&this.raise(D.ImportAliasHasImportType,l),t.moduleReference=l,this.semicolon(),this.finishNode(t,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){const t=this.startNode();return this.expectContextual(119),this.expect(10),this.match(134)||this.unexpected(),t.expression=super.parseExprAtom(),this.expect(11),this.sawUnambiguousESM=!0,this.finishNode(t,"TSExternalModuleReference")}tsLookAhead(t){const n=this.state.clone(),o=t();return this.state=n,o}tsTryParseAndCatch(t){const n=this.tryParse(o=>t()||o());if(!(n.aborted||!n.node))return n.error&&(this.state=n.failState),n.node}tsTryParse(t){const n=this.state.clone(),o=t();if(o!==void 0&&o!==!1)return o;this.state=n}tsTryParseDeclare(t){if(this.isLineTerminator())return;const n=this.state.type;return this.tsInAmbientContext(()=>{switch(n){case 68:return t.declare=!0,super.parseFunctionStatement(t,!1,!1);case 80:return t.declare=!0,this.parseClass(t,!0,!1);case 126:return this.tsParseEnumDeclaration(t,{declare:!0});case 112:return this.tsParseAmbientExternalModuleDeclaration(t);case 100:if(this.state.containsEsc)return;case 75:case 74:return!this.match(75)||!this.isLookaheadContextual("enum")?(t.declare=!0,this.parseVarStatement(t,this.state.value,!0)):(this.expect(75),this.tsParseEnumDeclaration(t,{const:!0,declare:!0}));case 107:if(this.isUsing())return this.raise(D.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.parseVarStatement(t,"using",!0);break;case 96:if(this.isAwaitUsing())return this.raise(D.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.next(),this.parseVarStatement(t,"await using",!0);break;case 129:{const o=this.tsParseInterfaceDeclaration(t,{declare:!0});if(o)return o}default:if(ie(n))return this.tsParseDeclaration(t,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(t,n,o,l){switch(n){case 124:if(this.tsCheckLineTerminator(o)&&(this.match(80)||ie(this.state.type)))return this.tsParseAbstractDeclaration(t,l);break;case 127:if(this.tsCheckLineTerminator(o)){if(this.match(134))return this.tsParseAmbientExternalModuleDeclaration(t);if(ie(this.state.type))return t.kind="module",this.tsParseModuleOrNamespaceDeclaration(t)}break;case 128:if(this.tsCheckLineTerminator(o)&&ie(this.state.type))return t.kind="namespace",this.tsParseModuleOrNamespaceDeclaration(t);break;case 130:if(this.tsCheckLineTerminator(o)&&ie(this.state.type))return this.tsParseTypeAliasDeclaration(t);break}}tsCheckLineTerminator(t){return t?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(t){if(!this.match(47))return;const n=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;const o=this.tsTryParseAndCatch(()=>{const l=this.startNodeAt(t);return l.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(l),l.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(19),l});if(this.state.maybeInArrowParameters=n,!!o)return super.parseArrowExpression(o,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===47)return this.tsParseTypeArguments()}tsParseTypeArguments(){const t=this.startNode();return t.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(47),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),t.params.length===0?this.raise(D.EmptyTypeArguments,t):!this.state.inType&&this.curContext()===$.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return sh(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseBindingElement(t,n){const o=n.length?n[0].loc.start:this.state.startLoc,l={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},l);const d=l.accessibility,m=l.override,g=l.readonly;!(t&4)&&(d||g||m)&&this.raise(D.UnexpectedParameterModifier,o);const E=this.parseMaybeDefault();t&2&&this.parseFunctionParamType(E);const b=this.parseMaybeDefault(E.loc.start,E);if(d||g||m){const I=this.startNodeAt(o);return n.length&&(I.decorators=n),d&&(I.accessibility=d),g&&(I.readonly=g),m&&(I.override=m),b.type!=="Identifier"&&b.type!=="AssignmentPattern"&&this.raise(D.UnsupportedParameterPropertyKind,I),I.parameter=b,this.finishNode(I,"TSParameterProperty")}return n.length&&(E.decorators=n),b}isSimpleParameter(t){return t.type==="TSParameterProperty"&&super.isSimpleParameter(t.parameter)||super.isSimpleParameter(t)}tsDisallowOptionalPattern(t){for(const n of t.params)n.type!=="Identifier"&&n.optional&&!this.state.isAmbientContext&&this.raise(D.PatternIsOptional,n)}setArrowFunctionParameters(t,n,o){super.setArrowFunctionParameters(t,n,o),this.tsDisallowOptionalPattern(t)}parseFunctionBodyAndFinish(t,n,o=!1){this.match(14)&&(t.returnType=this.tsParseTypeOrTypePredicateAnnotation(14));const l=n==="FunctionDeclaration"?"TSDeclareFunction":n==="ClassMethod"||n==="ClassPrivateMethod"?"TSDeclareMethod":void 0;return l&&!this.match(5)&&this.isLineTerminator()?this.finishNode(t,l):l==="TSDeclareFunction"&&this.state.isAmbientContext&&(this.raise(D.DeclareFunctionHasImplementation,t),t.declare)?super.parseFunctionBodyAndFinish(t,l,o):(this.tsDisallowOptionalPattern(t),super.parseFunctionBodyAndFinish(t,n,o))}registerFunctionStatementId(t){!t.body&&t.id?this.checkIdentifier(t.id,1024):super.registerFunctionStatementId(t)}tsCheckForInvalidTypeCasts(t){t.forEach(n=>{n?.type==="TSTypeCastExpression"&&this.raise(D.UnexpectedTypeAnnotation,n.typeAnnotation)})}toReferencedList(t,n){return this.tsCheckForInvalidTypeCasts(t),t}parseArrayLike(t,n,o){const l=super.parseArrayLike(t,n,o);return l.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(l.elements),l}parseSubscript(t,n,o,l){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=!1,this.next();const m=this.startNodeAt(n);return m.expression=t,this.finishNode(m,"TSNonNullExpression")}let d=!1;if(this.match(18)&&this.lookaheadCharCode()===60){if(o)return l.stop=!0,t;l.optionalChainMember=d=!0,this.next()}if(this.match(47)||this.match(51)){let m;const g=this.tsTryParseAndCatch(()=>{if(!o&&this.atPossibleAsyncArrow(t)){const C=this.tsTryParseGenericAsyncArrowFunction(n);if(C)return l.stop=!0,C}const E=this.tsParseTypeArgumentsInExpression();if(!E)return;if(d&&!this.match(10)){m=this.state.curPosition();return}if(Gs(this.state.type)){const C=super.parseTaggedTemplateExpression(t,n,l);return C.typeParameters=E,C}if(!o&&this.eat(10)){const C=this.startNodeAt(n);return C.callee=t,C.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(C.arguments),C.typeParameters=E,l.optionalChainMember&&(C.optional=d),this.finishCallExpression(C,l.optionalChainMember)}const b=this.state.type;if(b===48||b===52||b!==10&&b!==93&&b!==120&&Ss(b)&&!this.hasPrecedingLineBreak())return;const I=this.startNodeAt(n);return I.expression=t,I.typeParameters=E,this.finishNode(I,"TSInstantiationExpression")});if(m&&this.unexpected(m,10),g)return g.type==="TSInstantiationExpression"&&((this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40)&&this.raise(D.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc),!this.match(16)&&!this.match(18)&&(g.expression=super.stopParseSubscript(t,l))),g}return super.parseSubscript(t,n,o,l)}parseNewCallee(t){var n;super.parseNewCallee(t);const{callee:o}=t;o.type==="TSInstantiationExpression"&&!((n=o.extra)!=null&&n.parenthesized)&&(t.typeParameters=o.typeParameters,t.callee=o.expression)}parseExprOp(t,n,o){let l;if(Vs(58)>o&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(l=this.isContextual(120)))){const d=this.startNodeAt(n);return d.expression=t,d.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?(l&&this.raise(S.UnexpectedKeyword,this.state.startLoc,{keyword:"const"}),this.tsParseTypeReference()):this.tsParseType())),this.finishNode(d,l?"TSSatisfiesExpression":"TSAsExpression"),this.reScan_lt_gt(),this.parseExprOp(d,n,o)}return super.parseExprOp(t,n,o)}checkReservedWord(t,n,o,l){this.state.isAmbientContext||super.checkReservedWord(t,n,o,l)}checkImportReflection(t){super.checkImportReflection(t),t.module&&t.importKind!=="value"&&this.raise(D.ImportReflectionHasImportType,t.specifiers[0].loc.start)}checkDuplicateExports(){}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(130)){const n=this.lookaheadCharCode();return t?n===123||n===42:n!==61}return!t&&this.isContextual(87)}applyImportPhase(t,n,o,l){super.applyImportPhase(t,n,o,l),n?t.exportKind=o==="type"?"type":"value":t.importKind=o==="type"||o==="typeof"?o:"value"}parseImport(t){if(this.match(134))return t.importKind="value",super.parseImport(t);let n;if(ie(this.state.type)&&this.lookaheadCharCode()===61)return t.importKind="value",this.tsParseImportEqualsDeclaration(t);if(this.isContextual(130)){const o=this.parseMaybeImportPhase(t,!1);if(this.lookaheadCharCode()===61)return this.tsParseImportEqualsDeclaration(t,o);n=super.parseImportSpecifiersAndAfter(t,o)}else n=super.parseImport(t);return n.importKind==="type"&&n.specifiers.length>1&&n.specifiers[0].type==="ImportDefaultSpecifier"&&this.raise(D.TypeImportCannotSpecifyDefaultAndNamed,n),n}parseExport(t,n){if(this.match(83)){const o=t;this.next();let l=null;return this.isContextual(130)&&this.isPotentialImportPhase(!1)?l=this.parseMaybeImportPhase(o,!1):o.importKind="value",this.tsParseImportEqualsDeclaration(o,l,!0)}else if(this.eat(29)){const o=t;return o.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(o,"TSExportAssignment")}else if(this.eatContextual(93)){const o=t;return this.expectContextual(128),o.id=this.parseIdentifier(),this.semicolon(),this.finishNode(o,"TSNamespaceExportDeclaration")}else return super.parseExport(t,n)}isAbstractClass(){return this.isContextual(124)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){const t=this.startNode();return this.next(),t.abstract=!0,this.parseClass(t,!0,!0)}if(this.match(129)){const t=this.tsParseInterfaceDeclaration(this.startNode());if(t)return t}return super.parseExportDefaultExpression()}parseVarStatement(t,n,o=!1){const{isAmbientContext:l}=this.state,d=super.parseVarStatement(t,n,o||l);if(!l)return d;if(!t.declare&&(n==="using"||n==="await using"))return this.raiseOverwrite(D.UsingDeclarationInAmbientContext,t,n),d;for(const{id:m,init:g}of d.declarations)g&&(n==="var"||n==="let"||m.typeAnnotation?this.raise(D.InitializerNotAllowedInAmbientContext,g):Jh(g,this.hasPlugin("estree"))||this.raise(D.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,g));return d}parseStatementContent(t,n){if(!this.state.containsEsc)switch(this.state.type){case 75:{if(this.isLookaheadContextual("enum")){const o=this.startNode();return this.expect(75),this.tsParseEnumDeclaration(o,{const:!0})}break}case 124:case 125:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){const o=this.state.type,l=this.startNode();this.next();const d=o===125?this.tsTryParseDeclare(l):this.tsParseAbstractDeclaration(l,n);return d?(o===125&&(d.declare=!0),d):(l.expression=this.createIdentifier(this.startNodeAt(l.loc.start),o===125?"declare":"abstract"),this.semicolon(!1),this.finishNode(l,"ExpressionStatement"))}break}case 126:return this.tsParseEnumDeclaration(this.startNode());case 112:{if(this.lookaheadCharCode()===123){const l=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(l)}break}case 129:{const o=this.tsParseInterfaceDeclaration(this.startNode());if(o)return o;break}case 127:{if(this.nextTokenIsIdentifierOrStringLiteralOnSameLine()){const o=this.startNode();return this.next(),this.tsParseDeclaration(o,127,!1,n)}break}case 128:{if(this.nextTokenIsIdentifierOnSameLine()){const o=this.startNode();return this.next(),this.tsParseDeclaration(o,128,!1,n)}break}case 130:{if(this.nextTokenIsIdentifierOnSameLine()){const o=this.startNode();return this.next(),this.tsParseTypeAliasDeclaration(o)}break}}return super.parseStatementContent(t,n)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(t,n){return n.some(o=>ra(o)?t.accessibility===o:!!t[o])}tsIsStartOfStaticBlocks(){return this.isContextual(106)&&this.lookaheadCharCode()===123}parseClassMember(t,n,o){const l=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:l,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:D.InvalidModifierOnTypeParameterPositions},n);const d=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(n,l)&&this.raise(D.StaticBlockCannotHaveModifier,this.state.curPosition()),super.parseClassStaticBlock(t,n)):this.parseClassMemberWithIsStatic(t,n,o,!!n.static)};n.declare?this.tsInAmbientContext(d):d()}parseClassMemberWithIsStatic(t,n,o,l){const d=this.tsTryParseIndexSignature(n);if(d){t.body.push(d),n.abstract&&this.raise(D.IndexSignatureHasAbstract,n),n.accessibility&&this.raise(D.IndexSignatureHasAccessibility,n,{modifier:n.accessibility}),n.declare&&this.raise(D.IndexSignatureHasDeclare,n),n.override&&this.raise(D.IndexSignatureHasOverride,n);return}!this.state.inAbstractClass&&n.abstract&&this.raise(D.NonAbstractClassHasAbstractMethod,n),n.override&&(o.hadSuperClass||this.raise(D.OverrideNotInSubClass,n)),super.parseClassMemberWithIsStatic(t,n,o,l)}parsePostMemberNameModifiers(t){this.eat(17)&&(t.optional=!0),t.readonly&&this.match(10)&&this.raise(D.ClassMethodHasReadonly,t),t.declare&&this.match(10)&&this.raise(D.ClassMethodHasDeclare,t)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(t,n,o){if(!this.match(17))return t;if(this.state.maybeInArrowParameters){const l=this.lookaheadCharCode();if(l===44||l===61||l===58||l===41)return this.setOptionalParametersError(o),t}return super.parseConditional(t,n,o)}parseParenItem(t,n){const o=super.parseParenItem(t,n);if(this.eat(17)&&(o.optional=!0,this.resetEndLocation(t)),this.match(14)){const l=this.startNodeAt(n);return l.expression=t,l.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(l,"TSTypeCastExpression")}return t}parseExportDeclaration(t){if(!this.state.isAmbientContext&&this.isContextual(125))return this.tsInAmbientContext(()=>this.parseExportDeclaration(t));const n=this.state.startLoc,o=this.eatContextual(125);if(o&&(this.isContextual(125)||!this.shouldParseExportDeclaration()))throw this.raise(D.ExpectedAmbientAfterExportDeclare,this.state.startLoc);const d=ie(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(t);return d?((d.type==="TSInterfaceDeclaration"||d.type==="TSTypeAliasDeclaration"||o)&&(t.exportKind="type"),o&&d.type!=="TSImportEqualsDeclaration"&&(this.resetStartLocation(d,n),d.declare=!0),d):null}parseClassId(t,n,o,l){if((!n||o)&&this.isContextual(113))return;super.parseClassId(t,n,o,t.declare?1024:8331);const d=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);d&&(t.typeParameters=d)}parseClassPropertyAnnotation(t){t.optional||(this.eat(35)?t.definite=!0:this.eat(17)&&(t.optional=!0));const n=this.tsTryParseTypeAnnotation();n&&(t.typeAnnotation=n)}parseClassProperty(t){if(this.parseClassPropertyAnnotation(t),this.state.isAmbientContext&&!(t.readonly&&!t.typeAnnotation)&&this.match(29)&&this.raise(D.DeclareClassFieldHasInitializer,this.state.startLoc),t.abstract&&this.match(29)){const{key:n}=t;this.raise(D.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:n.type==="Identifier"&&!t.computed?n.name:`[${this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end))}]`})}return super.parseClassProperty(t)}parseClassPrivateProperty(t){return t.abstract&&this.raise(D.PrivateElementHasAbstract,t),t.accessibility&&this.raise(D.PrivateElementHasAccessibility,t,{modifier:t.accessibility}),this.parseClassPropertyAnnotation(t),super.parseClassPrivateProperty(t)}parseClassAccessorProperty(t){return this.parseClassPropertyAnnotation(t),t.optional&&this.raise(D.AccessorCannotBeOptional,t),super.parseClassAccessorProperty(t)}pushClassMethod(t,n,o,l,d,m){const g=this.tsTryParseTypeParameters(this.tsParseConstModifier);g&&d&&this.raise(D.ConstructorHasTypeParameters,g);const{declare:E=!1,kind:b}=n;E&&(b==="get"||b==="set")&&this.raise(D.DeclareAccessor,n,{kind:b}),g&&(n.typeParameters=g),super.pushClassMethod(t,n,o,l,d,m)}pushClassPrivateMethod(t,n,o,l){const d=this.tsTryParseTypeParameters(this.tsParseConstModifier);d&&(n.typeParameters=d),super.pushClassPrivateMethod(t,n,o,l)}declareClassPrivateMethodInScope(t,n){t.type!=="TSDeclareMethod"&&(t.type==="MethodDefinition"&&t.value.body==null||super.declareClassPrivateMethodInScope(t,n))}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass)if(t.superClass.type==="TSInstantiationExpression"){const n=t.superClass,o=n.expression;this.takeSurroundingComments(o,o.start,o.end);const l=n.typeParameters;this.takeSurroundingComments(l,l.start,l.end),t.superClass=o,t.superTypeParameters=l}else(this.match(47)||this.match(51))&&(t.superTypeParameters=this.tsParseTypeArgumentsInExpression());this.eatContextual(113)&&(t.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(t,n,o,l,d,m,g){const E=this.tsTryParseTypeParameters(this.tsParseConstModifier);return E&&(t.typeParameters=E),super.parseObjPropValue(t,n,o,l,d,m,g)}parseFunctionParams(t,n){const o=this.tsTryParseTypeParameters(this.tsParseConstModifier);o&&(t.typeParameters=o),super.parseFunctionParams(t,n)}parseVarId(t,n){super.parseVarId(t,n),t.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)&&(t.definite=!0);const o=this.tsTryParseTypeAnnotation();o&&(t.id.typeAnnotation=o,this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,n){return this.match(14)&&(t.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(t,n)}parseMaybeAssign(t,n){var o,l,d,m,g;let E,b,I;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(E=this.state.clone(),b=this.tryParse(()=>super.parseMaybeAssign(t,n),E),!b.error)return b.node;const{context:M}=this.state,Q=M[M.length-1];(Q===$.j_oTag||Q===$.j_expr)&&M.pop()}if(!((o=b)!=null&&o.error)&&!this.match(47))return super.parseMaybeAssign(t,n);(!E||E===this.state)&&(E=this.state.clone());let C;const N=this.tryParse(M=>{var Q,le;C=this.tsParseTypeParameters(this.tsParseConstModifier);const H=super.parseMaybeAssign(t,n);return(H.type!=="ArrowFunctionExpression"||(Q=H.extra)!=null&&Q.parenthesized)&&M(),((le=C)==null?void 0:le.params.length)!==0&&this.resetStartLocationFromNode(H,C),H.typeParameters=C,H},E);if(!N.error&&!N.aborted)return C&&this.reportReservedArrowTypeParam(C),N.node;if(!b&&(ia(!this.hasPlugin("jsx")),I=this.tryParse(()=>super.parseMaybeAssign(t,n),E),!I.error))return I.node;if((l=b)!=null&&l.node)return this.state=b.failState,b.node;if(N.node)return this.state=N.failState,C&&this.reportReservedArrowTypeParam(C),N.node;if((d=I)!=null&&d.node)return this.state=I.failState,I.node;throw((m=b)==null?void 0:m.error)||N.error||((g=I)==null?void 0:g.error)}reportReservedArrowTypeParam(t){var n;t.params.length===1&&!t.params[0].constraint&&!((n=t.extra)!=null&&n.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(D.ReservedArrowTypeParam,t)}parseMaybeUnary(t,n){return!this.hasPlugin("jsx")&&this.match(47)?this.tsParseTypeAssertion():super.parseMaybeUnary(t,n)}parseArrow(t){if(this.match(14)){const n=this.tryParse(o=>{const l=this.tsParseTypeOrTypePredicateAnnotation(14);return(this.canInsertSemicolon()||!this.match(19))&&o(),l});if(n.aborted)return;n.thrown||(n.error&&(this.state=n.failState),t.returnType=n.node)}return super.parseArrow(t)}parseFunctionParamType(t){this.eat(17)&&(t.optional=!0);const n=this.tsTryParseTypeAnnotation();return n&&(t.typeAnnotation=n),this.resetEndLocation(t),t}isAssignable(t,n){switch(t.type){case"TSTypeCastExpression":return this.isAssignable(t.expression,n);case"TSParameterProperty":return!0;default:return super.isAssignable(t,n)}}toAssignable(t,n=!1){switch(t.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(t,n);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":n?this.expressionScope.recordArrowParameterBindingError(D.UnexpectedTypeCastInParameter,t):this.raise(D.UnexpectedTypeCastInParameter,t),this.toAssignable(t.expression,n);break;case"AssignmentExpression":!n&&t.left.type==="TSTypeCastExpression"&&(t.left=this.typeCastToParameter(t.left));default:super.toAssignable(t,n)}}toAssignableParenthesizedExpression(t,n){switch(t.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(t.expression,n);break;default:super.toAssignable(t,n)}}checkToRestConversion(t,n){switch(t.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(t.expression,!1);break;default:super.checkToRestConversion(t,n)}}isValidLVal(t,n,o,l){switch(t){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(l!==64||!o)&&["expression",!0];default:return super.isValidLVal(t,n,o,l)}}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(t,n){if(this.match(47)||this.match(51)){const o=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const l=super.parseMaybeDecoratorArguments(t,n);return l.typeParameters=o,l}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(t,n)}checkCommaAfterRest(t){return this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===t?(this.next(),!1):super.checkCommaAfterRest(t)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(t,n){const o=super.parseMaybeDefault(t,n);return o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start&&this.raise(D.TypeAnnotationAfterAssign,o.typeAnnotation),o}getTokenFromCode(t){if(this.state.inType){if(t===62){this.finishOp(48,1);return}if(t===60){this.finishOp(47,1);return}}super.getTokenFromCode(t)}reScan_lt_gt(){const{type:t}=this.state;t===47?(this.state.pos-=1,this.readToken_lt()):t===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){const{type:t}=this.state;return t===51?(this.state.pos-=2,this.finishOp(47,1),47):t}toAssignableListItem(t,n,o){const l=t[n];l.type==="TSTypeCastExpression"&&(t[n]=this.typeCastToParameter(l)),super.toAssignableListItem(t,n,o)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.loc.end),t.expression}shouldParseArrow(t){return this.match(14)?t.every(n=>this.isAssignable(n,!0)):super.shouldParseArrow(t)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(t){if(this.match(47)||this.match(51)){const n=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());n&&(t.typeParameters=n)}return super.jsxParseOpeningElementAfterName(t)}getGetterSetterExpectedParamCount(t){const n=super.getGetterSetterExpectedParamCount(t),l=this.getObjectOrClassMethodParams(t)[0];return l&&this.isThisParam(l)?n+1:n}parseCatchClauseParam(){const t=super.parseCatchClauseParam(),n=this.tsTryParseTypeAnnotation();return n&&(t.typeAnnotation=n,this.resetEndLocation(t)),t}tsInAmbientContext(t){const{isAmbientContext:n,strict:o}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return t()}finally{this.state.isAmbientContext=n,this.state.strict=o}}parseClass(t,n,o){const l=this.state.inAbstractClass;this.state.inAbstractClass=!!t.abstract;try{return super.parseClass(t,n,o)}finally{this.state.inAbstractClass=l}}tsParseAbstractDeclaration(t,n){if(this.match(80))return t.abstract=!0,this.maybeTakeDecorators(n,this.parseClass(t,!0,!1));if(this.isContextual(129))return this.hasFollowingLineBreak()?null:(t.abstract=!0,this.raise(D.NonClassMethodPropertyHasAbstractModifier,t),this.tsParseInterfaceDeclaration(t));throw this.unexpected(null,80)}parseMethod(t,n,o,l,d,m,g){const E=super.parseMethod(t,n,o,l,d,m,g);if((E.abstract||E.type==="TSAbstractMethodDefinition")&&(this.hasPlugin("estree")?E.value:E).body){const{key:C}=E;this.raise(D.AbstractMethodHasImplementation,E,{methodName:C.type==="Identifier"&&!E.computed?C.name:`[${this.input.slice(this.offsetToSourcePos(C.start),this.offsetToSourcePos(C.end))}]`})}return E}tsParseTypeParameterName(){return this.parseIdentifier().name}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(t,n,o,l){return!n&&l?(this.parseTypeOnlyImportExportSpecifier(t,!1,o),this.finishNode(t,"ExportSpecifier")):(t.exportKind="value",super.parseExportSpecifier(t,n,o,l))}parseImportSpecifier(t,n,o,l,d){return!n&&l?(this.parseTypeOnlyImportExportSpecifier(t,!0,o),this.finishNode(t,"ImportSpecifier")):(t.importKind="value",super.parseImportSpecifier(t,n,o,l,o?4098:4096))}parseTypeOnlyImportExportSpecifier(t,n,o){const l=n?"imported":"local",d=n?"local":"exported";let m=t[l],g,E=!1,b=!0;const I=m.loc.start;if(this.isContextual(93)){const N=this.parseIdentifier();if(this.isContextual(93)){const M=this.parseIdentifier();Xe(this.state.type)?(E=!0,m=N,g=n?this.parseIdentifier():this.parseModuleExportName(),b=!1):(g=M,b=!1)}else Xe(this.state.type)?(b=!1,g=n?this.parseIdentifier():this.parseModuleExportName()):(E=!0,m=N)}else Xe(this.state.type)&&(E=!0,n?(m=this.parseIdentifier(!0),this.isContextual(93)||this.checkReservedWord(m.name,m.loc.start,!0,!0)):m=this.parseModuleExportName());E&&o&&this.raise(n?D.TypeModifierIsUsedInTypeImports:D.TypeModifierIsUsedInTypeExports,I),t[l]=m,t[d]=g;const C=n?"importKind":"exportKind";t[C]=E?"type":"value",b&&this.eatContextual(93)&&(t[d]=n?this.parseIdentifier():this.parseModuleExportName()),t[d]||(t[d]=this.cloneIdentifier(t[l])),n&&this.checkIdentifier(t[d],E?4098:4096)}fillOptionalPropertiesForTSESLint(t){var n,o,l,d,m,g,E,b,I,C,N,M,Q,le,H,oe,Rt,At,da,fa,ma,ya,ga,Ea,Ta,Sa,ba,xa,Ia,Pa,wa,Aa,Ca,va,Na,_a,Oa,La,ka,Da,Ra,Ma,$a,Fa,Ba,Ua,ja,za;switch(t.type){case"ExpressionStatement":(n=t.directive)!=null||(t.directive=void 0);return;case"RestElement":t.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":(o=t.decorators)!=null||(t.decorators=[]),(l=t.optional)!=null||(t.optional=!1),(d=t.typeAnnotation)!=null||(t.typeAnnotation=void 0);return;case"TSParameterProperty":(m=t.accessibility)!=null||(t.accessibility=void 0),(g=t.decorators)!=null||(t.decorators=[]),(E=t.override)!=null||(t.override=!1),(b=t.readonly)!=null||(t.readonly=!1),(I=t.static)!=null||(t.static=!1);return;case"TSEmptyBodyFunctionExpression":t.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":(C=t.declare)!=null||(t.declare=!1),(N=t.returnType)!=null||(t.returnType=void 0),(M=t.typeParameters)!=null||(t.typeParameters=void 0);return;case"Property":(Q=t.optional)!=null||(t.optional=!1);return;case"TSMethodSignature":case"TSPropertySignature":(le=t.optional)!=null||(t.optional=!1);case"TSIndexSignature":(H=t.accessibility)!=null||(t.accessibility=void 0),(oe=t.readonly)!=null||(t.readonly=!1),(Rt=t.static)!=null||(t.static=!1);return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(At=t.declare)!=null||(t.declare=!1),(da=t.definite)!=null||(t.definite=!1),(fa=t.readonly)!=null||(t.readonly=!1),(ma=t.typeAnnotation)!=null||(t.typeAnnotation=void 0);case"TSAbstractMethodDefinition":case"MethodDefinition":(ya=t.accessibility)!=null||(t.accessibility=void 0),(ga=t.decorators)!=null||(t.decorators=[]),(Ea=t.override)!=null||(t.override=!1),(Ta=t.optional)!=null||(t.optional=!1);return;case"ClassExpression":(Sa=t.id)!=null||(t.id=null);case"ClassDeclaration":(ba=t.abstract)!=null||(t.abstract=!1),(xa=t.declare)!=null||(t.declare=!1),(Ia=t.decorators)!=null||(t.decorators=[]),(Pa=t.implements)!=null||(t.implements=[]),(wa=t.superTypeArguments)!=null||(t.superTypeArguments=void 0),(Aa=t.typeParameters)!=null||(t.typeParameters=void 0);return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(Ca=t.declare)!=null||(t.declare=!1);return;case"VariableDeclarator":(va=t.definite)!=null||(t.definite=!1);return;case"TSEnumDeclaration":(Na=t.const)!=null||(t.const=!1),(_a=t.declare)!=null||(t.declare=!1);return;case"TSEnumMember":(Oa=t.computed)!=null||(t.computed=!1);return;case"TSImportType":(La=t.qualifier)!=null||(t.qualifier=null),(ka=t.options)!=null||(t.options=null);return;case"TSInterfaceDeclaration":(Da=t.declare)!=null||(t.declare=!1),(Ra=t.extends)!=null||(t.extends=[]);return;case"TSMappedType":(Ma=t.optional)!=null||(t.optional=!1),($a=t.readonly)!=null||(t.readonly=void 0);return;case"TSModuleDeclaration":(Fa=t.declare)!=null||(t.declare=!1),(Ba=t.global)!=null||(t.global=t.kind==="global");return;case"TSTypeParameter":(Ua=t.const)!=null||(t.const=!1),(ja=t.in)!=null||(t.in=!1),(za=t.out)!=null||(t.out=!1);return}}chStartsBindingIdentifierAndNotRelationalOperator(t,n){if(nt(t)){if(Tr.lastIndex=n,Tr.test(this.input)){const o=this.codePointAtPos(Tr.lastIndex);if(!kt(o)&&o!==92)return!1}return!0}else return t===92}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){const t=this.nextTokenInLineStart(),n=this.codePointAtPos(t);return this.chStartsBindingIdentifierAndNotRelationalOperator(n,t)}nextTokenIsIdentifierOrStringLiteralOnSameLine(){const t=this.nextTokenInLineStart(),n=this.codePointAtPos(t);return this.chStartsBindingIdentifier(n,t)||n===34||n===39}};function Yh(p){if(p.type!=="MemberExpression")return!1;const{computed:r,property:t}=p;return r&&t.type!=="StringLiteral"&&(t.type!=="TemplateLiteral"||t.expressions.length>0)?!1:aa(p.object)}function Jh(p,r){var t;const{type:n}=p;if((t=p.extra)!=null&&t.parenthesized)return!1;if(r){if(n==="Literal"){const{value:o}=p;if(typeof o=="string"||typeof o=="boolean")return!0}}else if(n==="StringLiteral"||n==="BooleanLiteral")return!0;return!!(na(p,r)||Xh(p,r)||n==="TemplateLiteral"&&p.expressions.length===0||Yh(p))}function na(p,r){return r?p.type==="Literal"&&(typeof p.value=="number"||"bigint"in p):p.type==="NumericLiteral"||p.type==="BigIntLiteral"}function Xh(p,r){if(p.type==="UnaryExpression"){const{operator:t,argument:n}=p;if(t==="-"&&na(n,r))return!0}return!1}function aa(p){return p.type==="Identifier"?!0:p.type!=="MemberExpression"||p.computed?!1:aa(p.object)}const oa=Ce`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var Qh=p=>class extends p{parsePlaceholder(t){if(this.match(133)){const n=this.startNode();return this.next(),this.assertNoSpace(),n.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(133),this.finishPlaceholder(n,t)}}finishPlaceholder(t,n){let o=t;return(!o.expectedNode||!o.type)&&(o=this.finishNode(o,"Placeholder")),o.expectedNode=n,o}getTokenFromCode(t){t===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(133,2):super.getTokenFromCode(t)}parseExprAtom(t){return this.parsePlaceholder("Expression")||super.parseExprAtom(t)}parseIdentifier(t){return this.parsePlaceholder("Identifier")||super.parseIdentifier(t)}checkReservedWord(t,n,o,l){t!==void 0&&super.checkReservedWord(t,n,o,l)}cloneIdentifier(t){const n=super.cloneIdentifier(t);return n.type==="Placeholder"&&(n.expectedNode=t.expectedNode),n}cloneStringLiteral(t){return t.type==="Placeholder"?this.cloneIdentifier(t):super.cloneStringLiteral(t)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(t,n,o,l){return t==="Placeholder"||super.isValidLVal(t,n,o,l)}toAssignable(t,n){t&&t.type==="Placeholder"&&t.expectedNode==="Expression"?t.expectedNode="Pattern":super.toAssignable(t,n)}chStartsBindingIdentifier(t,n){if(super.chStartsBindingIdentifier(t,n))return!0;const o=this.nextTokenStart();return this.input.charCodeAt(o)===37&&this.input.charCodeAt(o+1)===37}verifyBreakContinue(t,n){var o;((o=t.label)==null?void 0:o.type)!=="Placeholder"&&super.verifyBreakContinue(t,n)}parseExpressionStatement(t,n){var o;if(n.type!=="Placeholder"||(o=n.extra)!=null&&o.parenthesized)return super.parseExpressionStatement(t,n);if(this.match(14)){const d=t;return d.label=this.finishPlaceholder(n,"Identifier"),this.next(),d.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(d,"LabeledStatement")}this.semicolon();const l=t;return l.name=n.name,this.finishPlaceholder(l,"Statement")}parseBlock(t,n,o){return this.parsePlaceholder("BlockStatement")||super.parseBlock(t,n,o)}parseFunctionId(t){return this.parsePlaceholder("Identifier")||super.parseFunctionId(t)}parseClass(t,n,o){const l=n?"ClassDeclaration":"ClassExpression";this.next();const d=this.state.strict,m=this.parsePlaceholder("Identifier");if(m)if(this.match(81)||this.match(133)||this.match(5))t.id=m;else{if(o||!n)return t.id=null,t.body=this.finishPlaceholder(m,"ClassBody"),this.finishNode(t,l);throw this.raise(oa.ClassNameIsRequired,this.state.startLoc)}else this.parseClassId(t,n,o);return super.parseClassSuper(t),t.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!t.superClass,d),this.finishNode(t,l)}parseExport(t,n){const o=this.parsePlaceholder("Identifier");if(!o)return super.parseExport(t,n);const l=t;if(!this.isContextual(98)&&!this.match(12))return l.specifiers=[],l.source=null,l.declaration=this.finishPlaceholder(o,"Declaration"),this.finishNode(l,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");const d=this.startNode();return d.exported=o,l.specifiers=[this.finishNode(d,"ExportDefaultSpecifier")],super.parseExport(l,n)}isExportDefaultSpecifier(){if(this.match(65)){const t=this.nextTokenStart();if(this.isUnparsedContextual(t,"from")&&this.input.startsWith(It(133),this.nextTokenStartSince(t+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(t,n){var o;return(o=t.specifiers)!=null&&o.length?!0:super.maybeParseExportDefaultSpecifier(t,n)}checkExport(t){const{specifiers:n}=t;n!=null&&n.length&&(t.specifiers=n.filter(o=>o.exported.type==="Placeholder")),super.checkExport(t),t.specifiers=n}parseImport(t){const n=this.parsePlaceholder("Identifier");if(!n)return super.parseImport(t);if(t.specifiers=[],!this.isContextual(98)&&!this.match(12))return t.source=this.finishPlaceholder(n,"StringLiteral"),this.semicolon(),this.finishNode(t,"ImportDeclaration");const o=this.startNodeAtNode(n);return o.local=n,t.specifiers.push(this.finishNode(o,"ImportDefaultSpecifier")),this.eat(12)&&(this.maybeParseStarImportSpecifier(t)||this.parseNamedImportSpecifiers(t)),this.expectContextual(98),t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(oa.UnexpectedSpace,this.state.lastTokEndLoc)}},ep=p=>class extends p{parseV8Intrinsic(){if(this.match(54)){const t=this.state.startLoc,n=this.startNode();if(this.next(),ie(this.state.type)){const o=this.parseIdentifierName(),l=this.createIdentifier(n,o);if(this.castNodeTo(l,"V8IntrinsicIdentifier"),this.match(10))return l}this.unexpected(t)}}parseExprAtom(t){return this.parseV8Intrinsic()||super.parseExprAtom(t)}};const ca=["minimal","fsharp","hack","smart"],la=["^^","@@","^","%","#"];function tp(p){if(p.has("decorators")){if(p.has("decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");const n=p.get("decorators").decoratorsBeforeExport;if(n!=null&&typeof n!="boolean")throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");const o=p.get("decorators").allowCallParenthesized;if(o!=null&&typeof o!="boolean")throw new Error("'allowCallParenthesized' must be a boolean.")}if(p.has("flow")&&p.has("typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(p.has("placeholders")&&p.has("v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(p.has("pipelineOperator")){var r;const n=p.get("pipelineOperator").proposal;if(!ca.includes(n)){const o=ca.map(l=>`"${l}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${o}.`)}if(n==="hack"){var t;if(p.has("placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(p.has("v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");const o=p.get("pipelineOperator").topicToken;if(!la.includes(o)){const l=la.map(d=>`"${d}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${l}.`)}if(o==="#"&&((t=p.get("recordAndTuple"))==null?void 0:t.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple",p.get("recordAndTuple")])}\`.`)}else if(n==="smart"&&((r=p.get("recordAndTuple"))==null?void 0:r.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple",p.get("recordAndTuple")])}\`.`)}if(p.has("moduleAttributes")){if(p.has("deprecatedImportAssert")||p.has("importAssertions"))throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");if(p.get("moduleAttributes").version!=="may-2020")throw new Error("The 'moduleAttributes' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is 'may-2020'.")}if(p.has("importAssertions")&&p.has("deprecatedImportAssert"))throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");if(p.has("deprecatedImportAssert")||p.has("importAttributes")&&p.get("importAttributes").deprecatedAssertSyntax&&p.set("deprecatedImportAssert",{}),p.has("recordAndTuple")){const n=p.get("recordAndTuple").syntaxType;if(n!=null){const o=["hash","bar"];if(!o.includes(n))throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+o.map(l=>`'${l}'`).join(", "))}}if(p.has("asyncDoExpressions")&&!p.has("doExpressions")){const n=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw n.missingPlugins="doExpressions",n}if(p.has("optionalChainingAssign")&&p.get("optionalChainingAssign").version!=="2023-07")throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");if(p.has("discardBinding")&&p.get("discardBinding").syntaxType!=="void")throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.")}const ua={estree:Wt,jsx:wh,flow:bh,typescript:qh,v8intrinsic:ep,placeholders:Qh},sp=Object.keys(ua);class ip extends Hh{checkProto(r,t,n,o){if(r.type==="SpreadElement"||this.isObjectMethod(r)||r.computed||r.shorthand)return n;const l=r.key;return(l.type==="Identifier"?l.name:l.value)==="__proto__"?t?(this.raise(S.RecordNoProto,l),!0):(n&&(o?o.doubleProtoLoc===null&&(o.doubleProtoLoc=l.loc.start):this.raise(S.DuplicateProto,l)),!0):n}shouldExitDescending(r,t){return r.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(r.start)===t}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(140))throw this.raise(S.ParseExpressionEmptyInput,this.state.startLoc);const r=this.parseExpression();if(!this.match(140))throw this.raise(S.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),r.comments=this.comments,r.errors=this.state.errors,this.optionFlags&256&&(r.tokens=this.tokens),r}parseExpression(r,t){return r?this.disallowInAnd(()=>this.parseExpressionBase(t)):this.allowInAnd(()=>this.parseExpressionBase(t))}parseExpressionBase(r){const t=this.state.startLoc,n=this.parseMaybeAssign(r);if(this.match(12)){const o=this.startNodeAt(t);for(o.expressions=[n];this.eat(12);)o.expressions.push(this.parseMaybeAssign(r));return this.toReferencedList(o.expressions),this.finishNode(o,"SequenceExpression")}return n}parseMaybeAssignDisallowIn(r,t){return this.disallowInAnd(()=>this.parseMaybeAssign(r,t))}parseMaybeAssignAllowIn(r,t){return this.allowInAnd(()=>this.parseMaybeAssign(r,t))}setOptionalParametersError(r){r.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(r,t){const n=this.state.startLoc,o=this.isContextual(108);if(o&&this.prodParam.hasYield){this.next();let g=this.parseYield(n);return t&&(g=t.call(this,g,n)),g}let l;r?l=!1:(r=new qs,l=!0);const{type:d}=this.state;(d===10||ie(d))&&(this.state.potentialArrowAt=this.state.start);let m=this.parseMaybeConditional(r);if(t&&(m=t.call(this,m,n)),Yu(this.state.type)){const g=this.startNodeAt(n),E=this.state.value;if(g.operator=E,this.match(29)){this.toAssignable(m,!0),g.left=m;const b=n.index;r.doubleProtoLoc!=null&&r.doubleProtoLoc.index>=b&&(r.doubleProtoLoc=null),r.shorthandAssignLoc!=null&&r.shorthandAssignLoc.index>=b&&(r.shorthandAssignLoc=null),r.privateKeyLoc!=null&&r.privateKeyLoc.index>=b&&(this.checkDestructuringPrivate(r),r.privateKeyLoc=null),r.voidPatternLoc!=null&&r.voidPatternLoc.index>=b&&(r.voidPatternLoc=null)}else g.left=m;return this.next(),g.right=this.parseMaybeAssign(),this.checkLVal(m,this.finishNode(g,"AssignmentExpression"),void 0,void 0,void 0,void 0,E==="||="||E==="&&="||E==="??="),g}else l&&this.checkExpressionErrors(r,!0);if(o){const{type:g}=this.state;if((this.hasPlugin("v8intrinsic")?Ss(g):Ss(g)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(S.YieldNotInGeneratorFunction,n),this.parseYield(n)}return m}parseMaybeConditional(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseExprOps(r);return this.shouldExitDescending(o,n)?o:this.parseConditional(o,t,r)}parseConditional(r,t,n){if(this.eat(17)){const o=this.startNodeAt(t);return o.test=r,o.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),o.alternate=this.parseMaybeAssign(),this.finishNode(o,"ConditionalExpression")}return r}parseMaybeUnaryOrPrivate(r){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(r)}parseExprOps(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseMaybeUnaryOrPrivate(r);return this.shouldExitDescending(o,n)?o:this.parseExprOp(o,t,-1)}parseExprOp(r,t,n){if(this.isPrivateName(r)){const l=this.getPrivateNameSV(r);(n>=Vs(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(S.PrivateInExpectedIn,r,{identifierName:l}),this.classScope.usePrivateName(l,r.loc.start)}const o=this.state.type;if(Xu(o)&&(this.prodParam.hasIn||!this.match(58))){let l=Vs(o);if(l>n){if(o===39){if(this.expectPlugin("pipelineOperator"),this.state.inFSharpPipelineDirectBody)return r;this.checkPipelineAtInfixOperator(r,t)}const d=this.startNodeAt(t);d.left=r,d.operator=this.state.value;const m=o===41||o===42,g=o===40;if(g&&(l=Vs(42)),this.next(),o===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])&&this.state.type===96&&this.prodParam.hasAwait)throw this.raise(S.UnexpectedAwaitAfterPipelineBody,this.state.startLoc);d.right=this.parseExprOpRightExpr(o,l);const E=this.finishNode(d,m||g?"LogicalExpression":"BinaryExpression"),b=this.state.type;if(g&&(b===41||b===42)||m&&b===40)throw this.raise(S.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(E,t,n)}}return r}parseExprOpRightExpr(r,t){const n=this.state.startLoc;switch(r){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"fsharp":return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(t))}if(this.getPluginOption("pipelineOperator","proposal")==="smart")return this.withTopicBindingContext(()=>{if(this.prodParam.hasYield&&this.isContextual(108))throw this.raise(S.PipeBodyIsTighter,this.state.startLoc);return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(r,t),n)});default:return this.parseExprOpBaseRightExpr(r,t)}}parseExprOpBaseRightExpr(r,t){const n=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),n,ih(r)?t-1:t)}parseHackPipeBody(){var r;const{startLoc:t}=this.state,n=this.parseMaybeAssign();return P.has(n.type)&&!((r=n.extra)!=null&&r.parenthesized)&&this.raise(S.PipeUnparenthesizedBody,t,{type:n.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(S.PipeTopicUnused,t),n}checkExponentialAfterUnary(r){this.match(57)&&this.raise(S.UnexpectedTokenUnaryExponentiation,r.argument)}parseMaybeUnary(r,t){const n=this.state.startLoc,o=this.isContextual(96);if(o&&this.recordAwaitIfAllowed()){this.next();const g=this.parseAwait(n);return t||this.checkExponentialAfterUnary(g),g}const l=this.match(34),d=this.startNode();if(eh(this.state.type)){d.operator=this.state.value,d.prefix=!0,this.match(72)&&this.expectPlugin("throwExpressions");const g=this.match(89);if(this.next(),d.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(r,!0),this.state.strict&&g){const E=d.argument;E.type==="Identifier"?this.raise(S.StrictDelete,d):this.hasPropertyAsPrivateName(E)&&this.raise(S.DeletePrivateField,d)}if(!l)return t||this.checkExponentialAfterUnary(d),this.finishNode(d,"UnaryExpression")}const m=this.parseUpdate(d,l,r);if(o){const{type:g}=this.state;if((this.hasPlugin("v8intrinsic")?Ss(g):Ss(g)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(S.AwaitNotInAsyncContext,n),this.parseAwait(n)}return m}parseUpdate(r,t,n){if(t){const d=r;return this.checkLVal(d.argument,this.finishNode(d,"UpdateExpression")),r}const o=this.state.startLoc;let l=this.parseExprSubscripts(n);if(this.checkExpressionErrors(n,!1))return l;for(;Qu(this.state.type)&&!this.canInsertSemicolon();){const d=this.startNodeAt(o);d.operator=this.state.value,d.prefix=!1,d.argument=l,this.next(),this.checkLVal(l,l=this.finishNode(d,"UpdateExpression"))}return l}parseExprSubscripts(r){const t=this.state.startLoc,n=this.state.potentialArrowAt,o=this.parseExprAtom(r);return this.shouldExitDescending(o,n)?o:this.parseSubscripts(o,t)}parseSubscripts(r,t,n){const o={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(r),stop:!1};do r=this.parseSubscript(r,t,n,o),o.maybeAsyncArrow=!1;while(!o.stop);return r}parseSubscript(r,t,n,o){const{type:l}=this.state;if(!n&&l===15)return this.parseBind(r,t,n,o);if(Gs(l))return this.parseTaggedTemplateExpression(r,t,o);let d=!1;if(l===18){if(n&&(this.raise(S.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40))return this.stopParseSubscript(r,o);o.optionalChainMember=d=!0,this.next()}if(!n&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(r,t,o,d);{const m=this.eat(0);return m||d||this.eat(16)?this.parseMember(r,t,o,m,d):this.stopParseSubscript(r,o)}}stopParseSubscript(r,t){return t.stop=!0,r}parseMember(r,t,n,o,l){const d=this.startNodeAt(t);return d.object=r,d.computed=o,o?(d.property=this.parseExpression(),this.expect(3)):this.match(139)?(r.type==="Super"&&this.raise(S.SuperPrivateField,t),this.classScope.usePrivateName(this.state.value,this.state.startLoc),d.property=this.parsePrivateName()):d.property=this.parseIdentifier(!0),n.optionalChainMember?(d.optional=l,this.finishNode(d,"OptionalMemberExpression")):this.finishNode(d,"MemberExpression")}parseBind(r,t,n,o){const l=this.startNodeAt(t);return l.object=r,this.next(),l.callee=this.parseNoCallExpr(),o.stop=!0,this.parseSubscripts(this.finishNode(l,"BindExpression"),t,n)}parseCoverCallAndAsyncArrowHead(r,t,n,o){const l=this.state.maybeInArrowParameters;let d=null;this.state.maybeInArrowParameters=!0,this.next();const m=this.startNodeAt(t);m.callee=r;const{maybeAsyncArrow:g,optionalChainMember:E}=n;g&&(this.expressionScope.enter(zh()),d=new qs),E&&(m.optional=o),o?m.arguments=this.parseCallExpressionArguments():m.arguments=this.parseCallExpressionArguments(r.type!=="Super",m,d);let b=this.finishCallExpression(m,E);return g&&this.shouldParseAsyncArrow()&&!o?(n.stop=!0,this.checkDestructuringPrivate(d),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),b=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),b)):(g&&(this.checkExpressionErrors(d,!0),this.expressionScope.exit()),this.toReferencedArguments(b)),this.state.maybeInArrowParameters=l,b}toReferencedArguments(r,t){this.toReferencedListDeep(r.arguments,t)}parseTaggedTemplateExpression(r,t,n){const o=this.startNodeAt(t);return o.tag=r,o.quasi=this.parseTemplate(!0),n.optionalChainMember&&this.raise(S.OptionalChainingNoTemplate,t),this.finishNode(o,"TaggedTemplateExpression")}atPossibleAsyncArrow(r){return r.type==="Identifier"&&r.name==="async"&&this.state.lastTokEndLoc.index===r.end&&!this.canInsertSemicolon()&&r.end-r.start===5&&this.offsetToSourcePos(r.start)===this.state.potentialArrowAt}finishCallExpression(r,t){if(r.callee.type==="Import")if(r.arguments.length===0||r.arguments.length>2)this.raise(S.ImportCallArity,r);else for(const n of r.arguments)n.type==="SpreadElement"&&this.raise(S.ImportCallSpreadArgument,n);return this.finishNode(r,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(r,t,n){const o=[];let l=!0;const d=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(11);){if(l)l=!1;else if(this.expect(12),this.match(11)){t&&this.addTrailingCommaExtraToNode(t),this.next();break}o.push(this.parseExprListItem(11,!1,n,r))}return this.state.inFSharpPipelineDirectBody=d,o}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(r,t){var n;return this.resetPreviousNodeTrailingComments(t),this.expect(19),this.parseArrowExpression(r,t.arguments,!0,(n=t.extra)==null?void 0:n.trailingCommaLoc),t.innerComments&&bs(r,t.innerComments),t.callee.trailingComments&&bs(r,t.callee.trailingComments),r}parseNoCallExpr(){const r=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),r,!0)}parseExprAtom(r){let t,n=null;const{type:o}=this.state;switch(o){case 79:return this.parseSuper();case 83:return t=this.startNode(),this.next(),this.match(16)?this.parseImportMetaPropertyOrPhaseCall(t):this.match(10)?this.optionFlags&512?this.parseImportCall(t):this.finishNode(t,"Import"):(this.raise(S.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(t,"Import"));case 78:return t=this.startNode(),this.next(),this.finishNode(t,"ThisExpression");case 90:return this.parseDo(this.startNode(),!1);case 56:case 31:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(!0);case 86:return this.parseBooleanLiteral(!1);case 10:{const l=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(l)}case 0:return this.parseArrayLike(3,!1,r);case 5:return this.parseObjectLike(8,!1,!1,r);case 68:return this.parseFunctionOrFunctionSent();case 26:n=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(n,this.startNode()),!1);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(!1);case 15:{t=this.startNode(),this.next(),t.object=null;const l=t.callee=this.parseNoCallExpr();if(l.type==="MemberExpression")return this.finishNode(t,"BindExpression");throw this.raise(S.UnsupportedBind,l)}case 139:return this.raise(S.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 33:return this.parseTopicReferenceThenEqualsSign(54,"%");case 32:return this.parseTopicReferenceThenEqualsSign(44,"^");case 37:case 38:return this.parseTopicReference("hack");case 44:case 54:case 27:{const l=this.getPluginOption("pipelineOperator","proposal");if(l)return this.parseTopicReference(l);throw this.unexpected()}case 47:{const l=this.input.codePointAt(this.nextTokenStart());throw nt(l)||l===62?this.expectOnePlugin(["jsx","flow","typescript"]):this.unexpected()}default:if(o===137)return this.parseDecimalLiteral(this.state.value);if(o===2||o===1)return this.parseArrayLike(this.state.type===2?4:3,!0);if(o===6||o===7)return this.parseObjectLike(this.state.type===6?9:8,!1,!0);if(ie(o)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();const l=this.state.potentialArrowAt===this.state.start,d=this.state.containsEsc,m=this.parseIdentifier();if(!d&&m.name==="async"&&!this.canInsertSemicolon()){const{type:g}=this.state;if(g===68)return this.resetPreviousNodeTrailingComments(m),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(m));if(ie(g))return l&&this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(m)):m;if(g===90)return this.resetPreviousNodeTrailingComments(m),this.parseDo(this.startNodeAtNode(m),!0)}return l&&this.match(19)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(m),[m],!1)):m}else throw this.unexpected()}}parseTopicReferenceThenEqualsSign(r,t){const n=this.getPluginOption("pipelineOperator","proposal");if(n)return this.state.type=r,this.state.value=t,this.state.pos--,this.state.end--,this.state.endLoc=a(this.state.endLoc,-1),this.parseTopicReference(n);throw this.unexpected()}parseTopicReference(r){const t=this.startNode(),n=this.state.startLoc,o=this.state.type;return this.next(),this.finishTopicReference(t,n,r,o)}finishTopicReference(r,t,n,o){if(this.testTopicReferenceConfiguration(n,t,o))return n==="hack"?(this.topicReferenceIsAllowedInCurrentContext()||this.raise(S.PipeTopicUnbound,t),this.registerTopicReference(),this.finishNode(r,"TopicReference")):(this.topicReferenceIsAllowedInCurrentContext()||this.raise(S.PrimaryTopicNotAllowed,t),this.registerTopicReference(),this.finishNode(r,"PipelinePrimaryTopicReference"));throw this.raise(S.PipeTopicUnconfiguredToken,t,{token:It(o)})}testTopicReferenceConfiguration(r,t,n){switch(r){case"hack":return this.hasPlugin(["pipelineOperator",{topicToken:It(n)}]);case"smart":return n===27;default:throw this.raise(S.PipeTopicRequiresHackPipes,t)}}parseAsyncArrowUnaryFunction(r){this.prodParam.enter(Zs(!0,this.prodParam.hasYield));const t=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(S.LineTerminatorBeforeArrow,this.state.curPosition()),this.expect(19),this.parseArrowExpression(r,t,!0)}parseDo(r,t){this.expectPlugin("doExpressions"),t&&this.expectPlugin("asyncDoExpressions"),r.async=t,this.next();const n=this.state.labels;return this.state.labels=[],t?(this.prodParam.enter(2),r.body=this.parseBlock(),this.prodParam.exit()):r.body=this.parseBlock(),this.state.labels=n,this.finishNode(r,"DoExpression")}parseSuper(){const r=this.startNode();return this.next(),this.match(10)&&!this.scope.allowDirectSuper?this.optionFlags&16||this.raise(S.SuperNotAllowed,r):this.scope.allowSuper||this.optionFlags&16||this.raise(S.UnexpectedSuper,r),!this.match(10)&&!this.match(0)&&!this.match(16)&&this.raise(S.UnsupportedSuper,r),this.finishNode(r,"Super")}parsePrivateName(){const r=this.startNode(),t=this.startNodeAt(a(this.state.startLoc,1)),n=this.state.value;return this.next(),r.id=this.createIdentifier(t,n),this.finishNode(r,"PrivateName")}parseFunctionOrFunctionSent(){const r=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(r),"function");return this.next(),this.match(103)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(r,t,"sent")}return this.parseFunction(r)}parseMetaProperty(r,t,n){r.meta=t;const o=this.state.containsEsc;return r.property=this.parseIdentifier(!0),(r.property.name!==n||o)&&this.raise(S.UnsupportedMetaProperty,r.property,{target:t.name,onlyValidPropertyName:n}),this.finishNode(r,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(r){if(this.next(),this.isContextual(105)||this.isContextual(97)){const t=this.isContextual(105);return this.expectPlugin(t?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),r.phase=t?"source":"defer",this.parseImportCall(r)}else{const t=this.createIdentifierAt(this.startNodeAtNode(r),"import",this.state.lastTokStartLoc);return this.isContextual(101)&&(this.inModule||this.raise(S.ImportMetaOutsideModule,t),this.sawUnambiguousESM=!0),this.parseMetaProperty(r,t,"meta")}}parseLiteralAtNode(r,t,n){return this.addExtra(n,"rawValue",r),this.addExtra(n,"raw",this.input.slice(this.offsetToSourcePos(n.start),this.state.end)),n.value=r,this.next(),this.finishNode(n,t)}parseLiteral(r,t){const n=this.startNode();return this.parseLiteralAtNode(r,t,n)}parseStringLiteral(r){return this.parseLiteral(r,"StringLiteral")}parseNumericLiteral(r){return this.parseLiteral(r,"NumericLiteral")}parseBigIntLiteral(r){return this.parseLiteral(r,"BigIntLiteral")}parseDecimalLiteral(r){return this.parseLiteral(r,"DecimalLiteral")}parseRegExpLiteral(r){const t=this.startNode();return this.addExtra(t,"raw",this.input.slice(this.offsetToSourcePos(t.start),this.state.end)),t.pattern=r.pattern,t.flags=r.flags,this.next(),this.finishNode(t,"RegExpLiteral")}parseBooleanLiteral(r){const t=this.startNode();return t.value=r,this.next(),this.finishNode(t,"BooleanLiteral")}parseNullLiteral(){const r=this.startNode();return this.next(),this.finishNode(r,"NullLiteral")}parseParenAndDistinguishExpression(r){const t=this.state.startLoc;let n;this.next(),this.expressionScope.enter(jh());const o=this.state.maybeInArrowParameters,l=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.inFSharpPipelineDirectBody=!1;const d=this.state.startLoc,m=[],g=new qs;let E=!0,b,I;for(;!this.match(11);){if(E)E=!1;else if(this.expect(12,g.optionalParametersLoc===null?null:g.optionalParametersLoc),this.match(11)){I=this.state.startLoc;break}if(this.match(21)){const M=this.state.startLoc;if(b=this.state.startLoc,m.push(this.parseParenItem(this.parseRestBinding(),M)),!this.checkCommaAfterRest(41))break}else m.push(this.parseMaybeAssignAllowInOrVoidPattern(11,g,this.parseParenItem))}const C=this.state.lastTokEndLoc;this.expect(11),this.state.maybeInArrowParameters=o,this.state.inFSharpPipelineDirectBody=l;let N=this.startNodeAt(t);return r&&this.shouldParseArrow(m)&&(N=this.parseArrow(N))?(this.checkDestructuringPrivate(g),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(N,m,!1),N):(this.expressionScope.exit(),m.length||this.unexpected(this.state.lastTokStartLoc),I&&this.unexpected(I),b&&this.unexpected(b),this.checkExpressionErrors(g,!0),this.toReferencedListDeep(m,!0),m.length>1?(n=this.startNodeAt(d),n.expressions=m,this.finishNode(n,"SequenceExpression"),this.resetEndLocation(n,C)):n=m[0],this.wrapParenthesis(t,n))}wrapParenthesis(r,t){if(!(this.optionFlags&1024))return this.addExtra(t,"parenthesized",!0),this.addExtra(t,"parenStart",r.index),this.takeSurroundingComments(t,r.index,this.state.lastTokEndLoc.index),t;const n=this.startNodeAt(r);return n.expression=t,this.finishNode(n,"ParenthesizedExpression")}shouldParseArrow(r){return!this.canInsertSemicolon()}parseArrow(r){if(this.eat(19))return r}parseParenItem(r,t){return r}parseNewOrNewTarget(){const r=this.startNode();if(this.next(),this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(r),"new");this.next();const n=this.parseMetaProperty(r,t,"target");return this.scope.allowNewTarget||this.raise(S.UnexpectedNewTarget,n),n}return this.parseNew(r)}parseNew(r){if(this.parseNewCallee(r),this.eat(10)){const t=this.parseExprList(11);this.toReferencedList(t),r.arguments=t}else r.arguments=[];return this.finishNode(r,"NewExpression")}parseNewCallee(r){const t=this.match(83),n=this.parseNoCallExpr();r.callee=n,t&&(n.type==="Import"||n.type==="ImportExpression")&&this.raise(S.ImportCallNotNewExpression,n)}parseTemplateElement(r){const{start:t,startLoc:n,end:o,value:l}=this.state,d=t+1,m=this.startNodeAt(a(n,1));l===null&&(r||this.raise(S.InvalidEscapeSequenceTemplate,a(this.state.firstInvalidTemplateEscapePos,1)));const g=this.match(24),E=g?-1:-2,b=o+E;m.value={raw:this.input.slice(d,b).replace(/\r\n?/g,`
46
+ `),cooked:l===null?null:l.slice(1,E)},m.tail=g,this.next();const I=this.finishNode(m,"TemplateElement");return this.resetEndLocation(I,a(this.state.lastTokEndLoc,E)),I}parseTemplate(r){const t=this.startNode();let n=this.parseTemplateElement(r);const o=[n],l=[];for(;!n.tail;)l.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),o.push(n=this.parseTemplateElement(r));return t.expressions=l,t.quasis=o,this.finishNode(t,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(r,t,n,o){n&&this.expectPlugin("recordAndTuple");const l=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let d=!1,m=!0;const g=this.startNode();for(g.properties=[],this.next();!this.match(r);){if(m)m=!1;else if(this.expect(12),this.match(r)){this.addTrailingCommaExtraToNode(g);break}let b;t?b=this.parseBindingProperty():(b=this.parsePropertyDefinition(o),d=this.checkProto(b,n,d,o)),n&&!this.isObjectProperty(b)&&b.type!=="SpreadElement"&&this.raise(S.InvalidRecordProperty,b),b.shorthand&&this.addExtra(b,"shorthand",!0),g.properties.push(b)}this.next(),this.state.inFSharpPipelineDirectBody=l;let E="ObjectExpression";return t?E="ObjectPattern":n&&(E="RecordExpression"),this.finishNode(g,E)}addTrailingCommaExtraToNode(r){this.addExtra(r,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(r,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(r){return!r.computed&&r.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(r){let t=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(S.UnsupportedPropertyDecorator,this.state.startLoc);this.match(26);)t.push(this.parseDecorator());const n=this.startNode();let o=!1,l=!1,d;if(this.match(21))return t.length&&this.unexpected(),this.parseSpread();t.length&&(n.decorators=t,t=[]),n.method=!1,r&&(d=this.state.startLoc);let m=this.eat(55);this.parsePropertyNamePrefixOperator(n);const g=this.state.containsEsc;if(this.parsePropertyName(n,r),!m&&!g&&this.maybeAsyncOrAccessorProp(n)){const{key:E}=n,b=E.name;b==="async"&&!this.hasPrecedingLineBreak()&&(o=!0,this.resetPreviousNodeTrailingComments(E),m=this.eat(55),this.parsePropertyName(n)),(b==="get"||b==="set")&&(l=!0,this.resetPreviousNodeTrailingComments(E),n.kind=b,this.match(55)&&(m=!0,this.raise(S.AccessorIsGenerator,this.state.curPosition(),{kind:b}),this.next()),this.parsePropertyName(n))}return this.parseObjPropValue(n,d,m,o,!1,l,r)}getGetterSetterExpectedParamCount(r){return r.kind==="get"?0:1}getObjectOrClassMethodParams(r){return r.params}checkGetterSetterParams(r){var t;const n=this.getGetterSetterExpectedParamCount(r),o=this.getObjectOrClassMethodParams(r);o.length!==n&&this.raise(r.kind==="get"?S.BadGetterArity:S.BadSetterArity,r),r.kind==="set"&&((t=o[o.length-1])==null?void 0:t.type)==="RestElement"&&this.raise(S.BadSetterRestParameter,r)}parseObjectMethod(r,t,n,o,l){if(l){const d=this.parseMethod(r,t,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(d),d}if(n||t||this.match(10))return o&&this.unexpected(),r.kind="method",r.method=!0,this.parseMethod(r,t,n,!1,!1,"ObjectMethod")}parseObjectProperty(r,t,n,o){if(r.shorthand=!1,this.eat(14))return r.value=n?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(8,o),this.finishObjectProperty(r);if(!r.computed&&r.key.type==="Identifier"){if(this.checkReservedWord(r.key.name,r.key.loc.start,!0,!1),n)r.value=this.parseMaybeDefault(t,this.cloneIdentifier(r.key));else if(this.match(29)){const l=this.state.startLoc;o!=null?o.shorthandAssignLoc===null&&(o.shorthandAssignLoc=l):this.raise(S.InvalidCoverInitializedName,l),r.value=this.parseMaybeDefault(t,this.cloneIdentifier(r.key))}else r.value=this.cloneIdentifier(r.key);return r.shorthand=!0,this.finishObjectProperty(r)}}finishObjectProperty(r){return this.finishNode(r,"ObjectProperty")}parseObjPropValue(r,t,n,o,l,d,m){const g=this.parseObjectMethod(r,n,o,l,d)||this.parseObjectProperty(r,t,l,m);return g||this.unexpected(),g}parsePropertyName(r,t){if(this.eat(0))r.computed=!0,r.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{const{type:n,value:o}=this.state;let l;if(Xe(n))l=this.parseIdentifier(!0);else switch(n){case 135:l=this.parseNumericLiteral(o);break;case 134:l=this.parseStringLiteral(o);break;case 136:l=this.parseBigIntLiteral(o);break;case 139:{const d=this.state.startLoc;t!=null?t.privateKeyLoc===null&&(t.privateKeyLoc=d):this.raise(S.UnexpectedPrivateField,d),l=this.parsePrivateName();break}default:if(n===137){l=this.parseDecimalLiteral(o);break}this.unexpected()}r.key=l,n!==139&&(r.computed=!1)}}initFunction(r,t){r.id=null,r.generator=!1,r.async=t}parseMethod(r,t,n,o,l,d,m=!1){this.initFunction(r,n),r.generator=t,this.scope.enter(530|(m?576:0)|(l?32:0)),this.prodParam.enter(Zs(n,r.generator)),this.parseFunctionParams(r,o);const g=this.parseFunctionBodyAndFinish(r,d,!0);return this.prodParam.exit(),this.scope.exit(),g}parseArrayLike(r,t,n){t&&this.expectPlugin("recordAndTuple");const o=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;const l=this.startNode();return this.next(),l.elements=this.parseExprList(r,!t,n,l),this.state.inFSharpPipelineDirectBody=o,this.finishNode(l,t?"TupleExpression":"ArrayExpression")}parseArrowExpression(r,t,n,o){this.scope.enter(518);let l=Zs(n,!1);!this.match(5)&&this.prodParam.hasIn&&(l|=8),this.prodParam.enter(l),this.initFunction(r,n);const d=this.state.maybeInArrowParameters;return t&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(r,t,o)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(r,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=d,this.finishNode(r,"ArrowFunctionExpression")}setArrowFunctionParameters(r,t,n){this.toAssignableList(t,n,!1),r.params=t}parseFunctionBodyAndFinish(r,t,n=!1){return this.parseFunctionBody(r,!1,n),this.finishNode(r,t)}parseFunctionBody(r,t,n=!1){const o=t&&!this.match(5);if(this.expressionScope.enter(sa()),o)r.body=this.parseMaybeAssign(),this.checkParams(r,!1,t,!1);else{const l=this.state.strict,d=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),r.body=this.parseBlock(!0,!1,m=>{const g=!this.isSimpleParamList(r.params);m&&g&&this.raise(S.IllegalLanguageModeDirective,(r.kind==="method"||r.kind==="constructor")&&r.key?r.key.loc.end:r);const E=!l&&this.state.strict;this.checkParams(r,!this.state.strict&&!t&&!n&&!g,t,E),this.state.strict&&r.id&&this.checkIdentifier(r.id,65,E)}),this.prodParam.exit(),this.state.labels=d}this.expressionScope.exit()}isSimpleParameter(r){return r.type==="Identifier"}isSimpleParamList(r){for(let t=0,n=r.length;t<n;t++)if(!this.isSimpleParameter(r[t]))return!1;return!0}checkParams(r,t,n,o=!0){const l=!t&&new Set,d={type:"FormalParameters"};for(const m of r.params)this.checkLVal(m,d,5,l,o)}parseExprList(r,t,n,o){const l=[];let d=!0;for(;!this.eat(r);){if(d)d=!1;else if(this.expect(12),this.match(r)){o&&this.addTrailingCommaExtraToNode(o),this.next();break}l.push(this.parseExprListItem(r,t,n))}return l}parseExprListItem(r,t,n,o){let l;if(this.match(12))t||this.raise(S.UnexpectedToken,this.state.curPosition(),{unexpected:","}),l=null;else if(this.match(21)){const d=this.state.startLoc;l=this.parseParenItem(this.parseSpread(n),d)}else if(this.match(17)){this.expectPlugin("partialApplication"),o||this.raise(S.UnexpectedArgumentPlaceholder,this.state.startLoc);const d=this.startNode();this.next(),l=this.finishNode(d,"ArgumentPlaceholder")}else l=this.parseMaybeAssignAllowInOrVoidPattern(r,n,this.parseParenItem);return l}parseIdentifier(r){const t=this.startNode(),n=this.parseIdentifierName(r);return this.createIdentifier(t,n)}createIdentifier(r,t){return r.name=t,r.loc.identifierName=t,this.finishNode(r,"Identifier")}createIdentifierAt(r,t,n){return r.name=t,r.loc.identifierName=t,this.finishNodeAt(r,"Identifier",n)}parseIdentifierName(r){let t;const{startLoc:n,type:o}=this.state;Xe(o)?t=this.state.value:this.unexpected();const l=Ku(o);return r?l&&this.replaceToken(132):this.checkReservedWord(t,n,l,!1),this.next(),t}checkReservedWord(r,t,n,o){if(r.length>10||!dh(r))return;if(n&&uh(r)){this.raise(S.UnexpectedKeyword,t,{keyword:r});return}if((this.state.strict?o?Wn:Hn:Gn)(r,this.inModule)){this.raise(S.UnexpectedReservedWord,t,{reservedWord:r});return}else if(r==="yield"){if(this.prodParam.hasYield){this.raise(S.YieldBindingIdentifier,t);return}}else if(r==="await"){if(this.prodParam.hasAwait){this.raise(S.AwaitBindingIdentifier,t);return}if(this.scope.inStaticBlock){this.raise(S.AwaitBindingIdentifierInStaticBlock,t);return}this.expressionScope.recordAsyncArrowParametersError(t)}else if(r==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(S.ArgumentsInClass,t);return}}recordAwaitIfAllowed(){const r=this.prodParam.hasAwait;return r&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),r}parseAwait(r){const t=this.startNodeAt(r);return this.expressionScope.recordParameterInitializerError(S.AwaitExpressionFormalParameter,t),this.eat(55)&&this.raise(S.ObsoleteAwaitStar,t),!this.scope.inFunction&&!(this.optionFlags&1)&&(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(t.argument=this.parseMaybeUnary(null,!0)),this.finishNode(t,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;const{type:r}=this.state;return r===53||r===10||r===0||Gs(r)||r===102&&!this.state.containsEsc||r===138||r===56||this.hasPlugin("v8intrinsic")&&r===54}parseYield(r){const t=this.startNodeAt(r);this.expressionScope.recordParameterInitializerError(S.YieldInParameter,t);let n=!1,o=null;if(!this.hasPrecedingLineBreak())switch(n=this.eat(55),this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!n)break;default:o=this.parseMaybeAssign()}return t.delegate=n,t.argument=o,this.finishNode(t,"YieldExpression")}parseImportCall(r){if(this.next(),r.source=this.parseMaybeAssignAllowIn(),r.options=null,this.eat(12)){if(this.match(11))this.addTrailingCommaExtraToNode(r.source);else if(r.options=this.parseMaybeAssignAllowIn(),this.eat(12)&&(this.addTrailingCommaExtraToNode(r.options),!this.match(11))){do this.parseMaybeAssignAllowIn();while(this.eat(12)&&!this.match(11));this.raise(S.ImportCallArity,r)}}return this.expect(11),this.finishNode(r,"ImportExpression")}checkPipelineAtInfixOperator(r,t){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&r.type==="SequenceExpression"&&this.raise(S.PipelineHeadSequenceExpression,t)}parseSmartPipelineBodyInStyle(r,t){if(this.isSimpleReference(r)){const n=this.startNodeAt(t);return n.callee=r,this.finishNode(n,"PipelineBareFunction")}else{const n=this.startNodeAt(t);return this.checkSmartPipeTopicBodyEarlyErrors(t),n.expression=r,this.finishNode(n,"PipelineTopicExpression")}}isSimpleReference(r){switch(r.type){case"MemberExpression":return!r.computed&&this.isSimpleReference(r.object);case"Identifier":return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(r){if(this.match(19))throw this.raise(S.PipelineBodyNoArrow,this.state.startLoc);this.topicReferenceWasUsedInCurrentContext()||this.raise(S.PipelineTopicUnused,r)}withTopicBindingContext(r){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return r()}finally{this.state.topicContext=t}}withSmartMixTopicForbiddingContext(r){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return r()}finally{this.state.topicContext=t}}else return r()}withSoloAwaitPermittingContext(r){const t=this.state.soloAwait;this.state.soloAwait=!0;try{return r()}finally{this.state.soloAwait=t}}allowInAnd(r){const t=this.prodParam.currentFlags();if(8&~t){this.prodParam.enter(t|8);try{return r()}finally{this.prodParam.exit()}}return r()}disallowInAnd(r){const t=this.prodParam.currentFlags();if(8&t){this.prodParam.enter(t&-9);try{return r()}finally{this.prodParam.exit()}}return r()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(r){const t=this.state.startLoc;this.state.potentialArrowAt=this.state.start;const n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;const o=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,r);return this.state.inFSharpPipelineDirectBody=n,o}parseModuleExpression(){this.expectPlugin("moduleBlocks");const r=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);const t=this.startNodeAt(this.state.endLoc);this.next();const n=this.initializeScopes(!0);this.enterInitialScopes();try{r.body=this.parseProgram(t,8,"module")}finally{n()}return this.finishNode(r,"ModuleExpression")}parseVoidPattern(r){this.expectPlugin("discardBinding");const t=this.startNode();return r!=null&&(r.voidPatternLoc=this.state.startLoc),this.next(),this.finishNode(t,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(r,t,n){if(t!=null&&this.match(88)){const o=this.lookaheadCharCode();if(o===44||o===(r===3?93:r===8?125:41)||o===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(t))}return this.parseMaybeAssignAllowIn(t,n)}parsePropertyNamePrefixOperator(r){}}const Sr={kind:1},rp={kind:2},np=/[\uD800-\uDFFF]/u,br=/in(?:stanceof)?/y;function ap(p,r,t){for(let n=0;n<p.length;n++){const o=p[n],{type:l}=o;if(typeof l=="number"){if(l===139){const{loc:d,start:m,value:g,end:E}=o,b=m+1,I=a(d.start,1);p.splice(n,1,new wt({type:ut(27),value:"#",start:m,end:b,startLoc:d.start,endLoc:I}),new wt({type:ut(132),value:g,start:b,end:E,startLoc:I,endLoc:d.end})),n++;continue}if(Gs(l)){const{loc:d,start:m,value:g,end:E}=o,b=m+1,I=a(d.start,1);let C;r.charCodeAt(m-t)===96?C=new wt({type:ut(22),value:"`",start:m,end:b,startLoc:d.start,endLoc:I}):C=new wt({type:ut(8),value:"}",start:m,end:b,startLoc:d.start,endLoc:I});let N,M,Q,le;l===24?(M=E-1,Q=a(d.end,-1),N=g===null?null:g.slice(1,-1),le=new wt({type:ut(22),value:"`",start:M,end:E,startLoc:Q,endLoc:d.end})):(M=E-2,Q=a(d.end,-2),N=g===null?null:g.slice(1,-2),le=new wt({type:ut(23),value:"${",start:M,end:E,startLoc:Q,endLoc:d.end})),p.splice(n,1,C,new wt({type:ut(20),value:N,start:b,end:M,startLoc:I,endLoc:Q}),le),n+=2;continue}o.type=ut(l)}}return p}class op extends ip{parseTopLevel(r,t){return r.program=this.parseProgram(t,140,this.options.sourceType==="module"?"module":"script"),r.comments=this.comments,this.optionFlags&256&&(r.tokens=ap(this.tokens,this.input,this.startIndex)),this.finishNode(r,"File")}parseProgram(r,t,n){if(r.sourceType=n,r.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(r,!0,!0,t),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(const[l,d]of Array.from(this.scope.undefinedExports))this.raise(S.ModuleExportUndefined,d,{localName:l});this.addExtra(r,"topLevelAwait",this.state.hasTopLevelAwait)}let o;return t===140?o=this.finishNode(r,"Program"):o=this.finishNodeAt(r,"Program",a(this.state.startLoc,-1)),o}stmtToDirective(r){const t=this.castNodeTo(r,"Directive"),n=this.castNodeTo(r.expression,"DirectiveLiteral"),o=n.value,l=this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end)),d=n.value=l.slice(1,-1);return this.addExtra(n,"raw",l),this.addExtra(n,"rawValue",d),this.addExtra(n,"expressionValue",o),t.value=n,delete r.expression,t}parseInterpreterDirective(){if(!this.match(28))return null;const r=this.startNode();return r.value=this.state.value,this.next(),this.finishNode(r,"InterpreterDirective")}isLet(){return this.isContextual(100)?this.hasFollowingBindingAtom():!1}isUsing(){return this.isContextual(107)?this.nextTokenIsIdentifierOnSameLine():!1}isForUsing(){if(!this.isContextual(107))return!1;const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);if(this.isUnparsedContextual(r,"of")){const n=this.lookaheadCharCodeSince(r+2);if(n!==61&&n!==58&&n!==59)return!1}return!!(this.chStartsBindingIdentifier(t,r)||this.isUnparsedContextual(r,"void"))}nextTokenIsIdentifierOnSameLine(){const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);return this.chStartsBindingIdentifier(t,r)}isAwaitUsing(){if(!this.isContextual(96))return!1;let r=this.nextTokenInLineStart();if(this.isUnparsedContextual(r,"using")){r=this.nextTokenInLineStartSince(r+5);const t=this.codePointAtPos(r);if(this.chStartsBindingIdentifier(t,r))return!0}return!1}chStartsBindingIdentifier(r,t){if(nt(r)){if(br.lastIndex=t,br.test(this.input)){const n=this.codePointAtPos(br.lastIndex);if(!kt(n)&&n!==92)return!1}return!0}else return r===92}chStartsBindingPattern(r){return r===91||r===123}hasFollowingBindingAtom(){const r=this.nextTokenStart(),t=this.codePointAtPos(r);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,r)}hasInLineFollowingBindingIdentifierOrBrace(){const r=this.nextTokenInLineStart(),t=this.codePointAtPos(r);return t===123||this.chStartsBindingIdentifier(t,r)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(r=!1){let t=0;return this.options.annexB&&!this.state.strict&&(t|=4,r&&(t|=8)),this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(r){let t=null;return this.match(26)&&(t=this.parseDecorators(!0)),this.parseStatementContent(r,t)}parseStatementContent(r,t){const n=this.state.type,o=this.startNode(),l=!!(r&2),d=!!(r&4),m=r&1;switch(n){case 60:return this.parseBreakContinueStatement(o,!0);case 63:return this.parseBreakContinueStatement(o,!1);case 64:return this.parseDebuggerStatement(o);case 90:return this.parseDoWhileStatement(o);case 91:return this.parseForStatement(o);case 68:if(this.lookaheadCharCode()===46)break;return d||this.raise(this.state.strict?S.StrictFunction:this.options.annexB?S.SloppyFunctionAnnexB:S.SloppyFunction,this.state.startLoc),this.parseFunctionStatement(o,!1,!l&&d);case 80:return l||this.unexpected(),this.parseClass(this.maybeTakeDecorators(t,o),!0);case 69:return this.parseIfStatement(o);case 70:return this.parseReturnStatement(o);case 71:return this.parseSwitchStatement(o);case 72:return this.parseThrowStatement(o);case 73:return this.parseTryStatement(o);case 96:if(this.isAwaitUsing())return this.allowsUsing()?l?this.recordAwaitIfAllowed()||this.raise(S.AwaitUsingNotInAsyncContext,o):this.raise(S.UnexpectedLexicalDeclaration,o):this.raise(S.UnexpectedUsingDeclaration,o),this.next(),this.parseVarStatement(o,"await using");break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;return this.allowsUsing()?l||this.raise(S.UnexpectedLexicalDeclaration,this.state.startLoc):this.raise(S.UnexpectedUsingDeclaration,this.state.startLoc),this.parseVarStatement(o,"using");case 100:{if(this.state.containsEsc)break;const b=this.nextTokenStart(),I=this.codePointAtPos(b);if(I!==91&&(!l&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(I,b)&&I!==123))break}case 75:l||this.raise(S.UnexpectedLexicalDeclaration,this.state.startLoc);case 74:{const b=this.state.value;return this.parseVarStatement(o,b)}case 92:return this.parseWhileStatement(o);case 76:return this.parseWithStatement(o);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(o);case 83:{const b=this.lookaheadCharCode();if(b===40||b===46)break}case 82:{!(this.optionFlags&8)&&!m&&this.raise(S.UnexpectedImportExport,this.state.startLoc),this.next();let b;return n===83?b=this.parseImport(o):b=this.parseExport(o,t),this.assertModuleNodeAllowed(b),b}default:if(this.isAsyncFunction())return l||this.raise(S.AsyncFunctionInSingleStatementContext,this.state.startLoc),this.next(),this.parseFunctionStatement(o,!0,!l&&d)}const g=this.state.value,E=this.parseExpression();return ie(n)&&E.type==="Identifier"&&this.eat(14)?this.parseLabeledStatement(o,g,E,r):this.parseExpressionStatement(o,E,t)}assertModuleNodeAllowed(r){!(this.optionFlags&8)&&!this.inModule&&this.raise(S.ImportOutsideModule,r)}decoratorsEnabledBeforeExport(){return this.hasPlugin("decorators-legacy")?!0:this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==!1}maybeTakeDecorators(r,t,n){if(r){var o;(o=t.decorators)!=null&&o.length?(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!="boolean"&&this.raise(S.DecoratorsBeforeAfterExport,t.decorators[0]),t.decorators.unshift(...r)):t.decorators=r,this.resetStartLocationFromNode(t,r[0]),n&&this.resetStartLocationFromNode(n,t)}return t}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(r){const t=[];do t.push(this.parseDecorator());while(this.match(26));if(this.match(82))r||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(S.DecoratorExportClass,this.state.startLoc);else if(!this.canHaveLeadingDecorator())throw this.raise(S.UnexpectedLeadingDecorator,this.state.startLoc);return t}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);const r=this.startNode();if(this.next(),this.hasPlugin("decorators")){const t=this.state.startLoc;let n;if(this.match(10)){const o=this.state.startLoc;this.next(),n=this.parseExpression(),this.expect(11),n=this.wrapParenthesis(o,n);const l=this.state.startLoc;r.expression=this.parseMaybeDecoratorArguments(n,o),this.getPluginOption("decorators","allowCallParenthesized")===!1&&r.expression!==n&&this.raise(S.DecoratorArgumentsOutsideParentheses,l)}else{for(n=this.parseIdentifier(!1);this.eat(16);){const o=this.startNodeAt(t);o.object=n,this.match(139)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),o.property=this.parsePrivateName()):o.property=this.parseIdentifier(!0),o.computed=!1,n=this.finishNode(o,"MemberExpression")}r.expression=this.parseMaybeDecoratorArguments(n,t)}}else r.expression=this.parseExprSubscripts();return this.finishNode(r,"Decorator")}parseMaybeDecoratorArguments(r,t){if(this.eat(10)){const n=this.startNodeAt(t);return n.callee=r,n.arguments=this.parseCallExpressionArguments(),this.toReferencedList(n.arguments),this.finishNode(n,"CallExpression")}return r}parseBreakContinueStatement(r,t){return this.next(),this.isLineTerminator()?r.label=null:(r.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(r,t),this.finishNode(r,t?"BreakStatement":"ContinueStatement")}verifyBreakContinue(r,t){let n;for(n=0;n<this.state.labels.length;++n){const o=this.state.labels[n];if((r.label==null||o.name===r.label.name)&&(o.kind!=null&&(t||o.kind===1)||r.label&&t))break}if(n===this.state.labels.length){const o=t?"BreakStatement":"ContinueStatement";this.raise(S.IllegalBreakContinue,r,{type:o})}}parseDebuggerStatement(r){return this.next(),this.semicolon(),this.finishNode(r,"DebuggerStatement")}parseHeaderExpression(){this.expect(10);const r=this.parseExpression();return this.expect(11),r}parseDoWhileStatement(r){return this.next(),this.state.labels.push(Sr),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.expect(92),r.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(r,"DoWhileStatement")}parseForStatement(r){this.next(),this.state.labels.push(Sr);let t=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()&&(t=this.state.startLoc,this.next()),this.scope.enter(0),this.expect(10),this.match(13))return t!==null&&this.unexpected(t),this.parseFor(r,null);const n=this.isContextual(100);{const g=this.isAwaitUsing(),E=g||this.isForUsing(),b=n&&this.hasFollowingBindingAtom()||E;if(this.match(74)||this.match(75)||b){const I=this.startNode();let C;g?(C="await using",this.recordAwaitIfAllowed()||this.raise(S.AwaitUsingNotInAsyncContext,this.state.startLoc),this.next()):C=this.state.value,this.next(),this.parseVar(I,!0,C);const N=this.finishNode(I,"VariableDeclaration"),M=this.match(58);return M&&E&&this.raise(S.ForInUsing,N),(M||this.isContextual(102))&&N.declarations.length===1?this.parseForIn(r,N,t):(t!==null&&this.unexpected(t),this.parseFor(r,N))}}const o=this.isContextual(95),l=new qs,d=this.parseExpression(!0,l),m=this.isContextual(102);if(m&&(n&&this.raise(S.ForOfLet,d),t===null&&o&&d.type==="Identifier"&&this.raise(S.ForOfAsync,d)),m||this.match(58)){this.checkDestructuringPrivate(l),this.toAssignable(d,!0);const g=m?"ForOfStatement":"ForInStatement";return this.checkLVal(d,{type:g}),this.parseForIn(r,d,t)}else this.checkExpressionErrors(l,!0);return t!==null&&this.unexpected(t),this.parseFor(r,d)}parseFunctionStatement(r,t,n){return this.next(),this.parseFunction(r,1|(n?2:0)|(t?8:0))}parseIfStatement(r){return this.next(),r.test=this.parseHeaderExpression(),r.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),r.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(r,"IfStatement")}parseReturnStatement(r){return this.prodParam.hasReturn||this.raise(S.IllegalReturn,this.state.startLoc),this.next(),this.isLineTerminator()?r.argument=null:(r.argument=this.parseExpression(),this.semicolon()),this.finishNode(r,"ReturnStatement")}parseSwitchStatement(r){this.next(),r.discriminant=this.parseHeaderExpression();const t=r.cases=[];this.expect(5),this.state.labels.push(rp),this.scope.enter(256);let n;for(let o;!this.match(8);)if(this.match(61)||this.match(65)){const l=this.match(61);n&&this.finishNode(n,"SwitchCase"),t.push(n=this.startNode()),n.consequent=[],this.next(),l?n.test=this.parseExpression():(o&&this.raise(S.MultipleDefaultsInSwitch,this.state.lastTokStartLoc),o=!0,n.test=null),this.expect(14)}else n?n.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),n&&this.finishNode(n,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(r,"SwitchStatement")}parseThrowStatement(r){return this.next(),this.hasPrecedingLineBreak()&&this.raise(S.NewlineAfterThrow,this.state.lastTokEndLoc),r.argument=this.parseExpression(),this.semicolon(),this.finishNode(r,"ThrowStatement")}parseCatchClauseParam(){const r=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&r.type==="Identifier"?8:0),this.checkLVal(r,{type:"CatchClause"},9),r}parseTryStatement(r){if(this.next(),r.block=this.parseBlock(),r.handler=null,this.match(62)){const t=this.startNode();this.next(),this.match(10)?(this.expect(10),t.param=this.parseCatchClauseParam(),this.expect(11)):(t.param=null,this.scope.enter(0)),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),r.handler=this.finishNode(t,"CatchClause")}return r.finalizer=this.eat(67)?this.parseBlock():null,!r.handler&&!r.finalizer&&this.raise(S.NoCatchOrFinally,r),this.finishNode(r,"TryStatement")}parseVarStatement(r,t,n=!1){return this.next(),this.parseVar(r,!1,t,n),this.semicolon(),this.finishNode(r,"VariableDeclaration")}parseWhileStatement(r){return this.next(),r.test=this.parseHeaderExpression(),this.state.labels.push(Sr),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(r,"WhileStatement")}parseWithStatement(r){return this.state.strict&&this.raise(S.StrictWith,this.state.startLoc),this.next(),r.object=this.parseHeaderExpression(),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(r,"WithStatement")}parseEmptyStatement(r){return this.next(),this.finishNode(r,"EmptyStatement")}parseLabeledStatement(r,t,n,o){for(const d of this.state.labels)d.name===t&&this.raise(S.LabelRedeclaration,n,{labelName:t});const l=Ju(this.state.type)?1:this.match(71)?2:null;for(let d=this.state.labels.length-1;d>=0;d--){const m=this.state.labels[d];if(m.statementStart===r.start)m.statementStart=this.sourceToOffsetPos(this.state.start),m.kind=l;else break}return this.state.labels.push({name:t,kind:l,statementStart:this.sourceToOffsetPos(this.state.start)}),r.body=o&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),r.label=n,this.finishNode(r,"LabeledStatement")}parseExpressionStatement(r,t,n){return r.expression=t,this.semicolon(),this.finishNode(r,"ExpressionStatement")}parseBlock(r=!1,t=!0,n){const o=this.startNode();return r&&this.state.strictErrors.clear(),this.expect(5),t&&this.scope.enter(0),this.parseBlockBody(o,r,!1,8,n),t&&this.scope.exit(),this.finishNode(o,"BlockStatement")}isValidDirective(r){return r.type==="ExpressionStatement"&&r.expression.type==="StringLiteral"&&!r.expression.extra.parenthesized}parseBlockBody(r,t,n,o,l){const d=r.body=[],m=r.directives=[];this.parseBlockOrModuleBlockBody(d,t?m:void 0,n,o,l)}parseBlockOrModuleBlockBody(r,t,n,o,l){const d=this.state.strict;let m=!1,g=!1;for(;!this.match(o);){const E=n?this.parseModuleItem():this.parseStatementListItem();if(t&&!g){if(this.isValidDirective(E)){const b=this.stmtToDirective(E);t.push(b),!m&&b.value.value==="use strict"&&(m=!0,this.setStrict(!0));continue}g=!0,this.state.strictErrors.clear()}r.push(E)}l?.call(this,m),d||this.setStrict(!1),this.next()}parseFor(r,t){return r.init=t,this.semicolon(!1),r.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),r.update=this.match(11)?null:this.parseExpression(),this.expect(11),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(r,"ForStatement")}parseForIn(r,t,n){const o=this.match(58);return this.next(),o?n!==null&&this.unexpected(n):r.await=n!==null,t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!o||!this.options.annexB||this.state.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(S.ForInOfLoopInitializer,t,{type:o?"ForInStatement":"ForOfStatement"}),t.type==="AssignmentPattern"&&this.raise(S.InvalidLhs,t,{ancestor:{type:"ForStatement"}}),r.left=t,r.right=o?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(r,o?"ForInStatement":"ForOfStatement")}parseVar(r,t,n,o=!1){const l=r.declarations=[];for(r.kind=n;;){const d=this.startNode();if(this.parseVarId(d,n),d.init=this.eat(29)?t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,d.init===null&&!o&&(d.id.type!=="Identifier"&&!(t&&(this.match(58)||this.isContextual(102)))?this.raise(S.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"}):(n==="const"||n==="using"||n==="await using")&&!(this.match(58)||this.isContextual(102))&&this.raise(S.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:n})),l.push(this.finishNode(d,"VariableDeclarator")),!this.eat(12))break}return r}parseVarId(r,t){const n=this.parseBindingAtom();t==="using"||t==="await using"?(n.type==="ArrayPattern"||n.type==="ObjectPattern")&&this.raise(S.UsingDeclarationHasBindingPattern,n.loc.start):n.type==="VoidPattern"&&this.raise(S.UnexpectedVoidPattern,n.loc.start),this.checkLVal(n,{type:"VariableDeclarator"},t==="var"?5:8201),r.id=n}parseAsyncFunctionExpression(r){return this.parseFunction(r,8)}parseFunction(r,t=0){const n=t&2,o=!!(t&1),l=o&&!(t&4),d=!!(t&8);this.initFunction(r,d),this.match(55)&&(n&&this.raise(S.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),r.generator=!0),o&&(r.id=this.parseFunctionId(l));const m=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(514),this.prodParam.enter(Zs(d,r.generator)),o||(r.id=this.parseFunctionId()),this.parseFunctionParams(r,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(r,o?"FunctionDeclaration":"FunctionExpression")}),this.prodParam.exit(),this.scope.exit(),o&&!n&&this.registerFunctionStatementId(r),this.state.maybeInArrowParameters=m,r}parseFunctionId(r){return r||ie(this.state.type)?this.parseIdentifier():null}parseFunctionParams(r,t){this.expect(10),this.expressionScope.enter(Uh()),r.params=this.parseBindingList(11,41,2|(t?4:0)),this.expressionScope.exit()}registerFunctionStatementId(r){r.id&&this.scope.declareName(r.id.name,!this.options.annexB||this.state.strict||r.generator||r.async?this.scope.treatFunctionsAsVar?5:8201:17,r.id.loc.start)}parseClass(r,t,n){this.next();const o=this.state.strict;return this.state.strict=!0,this.parseClassId(r,t,n),this.parseClassSuper(r),r.body=this.parseClassBody(!!r.superClass,o),this.finishNode(r,t?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}nameIsConstructor(r){return r.type==="Identifier"&&r.name==="constructor"||r.type==="StringLiteral"&&r.value==="constructor"}isNonstaticConstructor(r){return!r.computed&&!r.static&&this.nameIsConstructor(r.key)}parseClassBody(r,t){this.classScope.enter();const n={hadConstructor:!1,hadSuperClass:r};let o=[];const l=this.startNode();if(l.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(o.length>0)throw this.raise(S.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(26)){o.push(this.parseDecorator());continue}const d=this.startNode();o.length&&(d.decorators=o,this.resetStartLocationFromNode(d,o[0]),o=[]),this.parseClassMember(l,d,n),d.kind==="constructor"&&d.decorators&&d.decorators.length>0&&this.raise(S.DecoratorConstructor,d)}}),this.state.strict=t,this.next(),o.length)throw this.raise(S.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(l,"ClassBody")}parseClassMemberFromModifier(r,t){const n=this.parseIdentifier(!0);if(this.isClassMethod()){const o=t;return o.kind="method",o.computed=!1,o.key=n,o.static=!1,this.pushClassMethod(r,o,!1,!1,!1,!1),!0}else if(this.isClassProperty()){const o=t;return o.computed=!1,o.key=n,o.static=!1,r.body.push(this.parseClassProperty(o)),!0}return this.resetPreviousNodeTrailingComments(n),!1}parseClassMember(r,t,n){const o=this.isContextual(106);if(o){if(this.parseClassMemberFromModifier(r,t))return;if(this.eat(5)){this.parseClassStaticBlock(r,t);return}}this.parseClassMemberWithIsStatic(r,t,n,o)}parseClassMemberWithIsStatic(r,t,n,o){const l=t,d=t,m=t,g=t,E=t,b=l,I=l;if(t.static=o,this.parsePropertyNamePrefixOperator(t),this.eat(55)){b.kind="method";const H=this.match(139);if(this.parseClassElementName(b),this.parsePostMemberNameModifiers(b),H){this.pushClassPrivateMethod(r,d,!0,!1);return}this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsGenerator,l.key),this.pushClassMethod(r,l,!0,!1,!1,!1);return}const C=!this.state.containsEsc&&ie(this.state.type),N=this.parseClassElementName(t),M=C?N.name:null,Q=this.isPrivateName(N),le=this.state.startLoc;if(this.parsePostMemberNameModifiers(I),this.isClassMethod()){if(b.kind="method",Q){this.pushClassPrivateMethod(r,d,!1,!1);return}const H=this.isNonstaticConstructor(l);let oe=!1;H&&(l.kind="constructor",n.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(S.DuplicateConstructor,N),H&&this.hasPlugin("typescript")&&t.override&&this.raise(S.OverrideOnConstructor,N),n.hadConstructor=!0,oe=n.hadSuperClass),this.pushClassMethod(r,l,!1,!1,H,oe)}else if(this.isClassProperty())Q?this.pushClassPrivateProperty(r,g):this.pushClassProperty(r,m);else if(M==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(N);const H=this.eat(55);I.optional&&this.unexpected(le),b.kind="method";const oe=this.match(139);this.parseClassElementName(b),this.parsePostMemberNameModifiers(I),oe?this.pushClassPrivateMethod(r,d,H,!0):(this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsAsync,l.key),this.pushClassMethod(r,l,H,!0,!1,!1))}else if((M==="get"||M==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(N),b.kind=M;const H=this.match(139);this.parseClassElementName(l),H?this.pushClassPrivateMethod(r,d,!1,!1):(this.isNonstaticConstructor(l)&&this.raise(S.ConstructorIsAccessor,l.key),this.pushClassMethod(r,l,!1,!1,!1,!1)),this.checkGetterSetterParams(l)}else if(M==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(N);const H=this.match(139);this.parseClassElementName(m),this.pushClassAccessorProperty(r,E,H)}else this.isLineTerminator()?Q?this.pushClassPrivateProperty(r,g):this.pushClassProperty(r,m):this.unexpected()}parseClassElementName(r){const{type:t,value:n}=this.state;if((t===132||t===134)&&r.static&&n==="prototype"&&this.raise(S.StaticPrototype,this.state.startLoc),t===139){n==="constructor"&&this.raise(S.ConstructorClassPrivateField,this.state.startLoc);const o=this.parsePrivateName();return r.key=o,o}return this.parsePropertyName(r),r.key}parseClassStaticBlock(r,t){var n;this.scope.enter(720);const o=this.state.labels;this.state.labels=[],this.prodParam.enter(0);const l=t.body=[];this.parseBlockOrModuleBlockBody(l,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=o,r.body.push(this.finishNode(t,"StaticBlock")),(n=t.decorators)!=null&&n.length&&this.raise(S.DecoratorStaticBlock,t)}pushClassProperty(r,t){!t.computed&&this.nameIsConstructor(t.key)&&this.raise(S.ConstructorClassField,t.key),r.body.push(this.parseClassProperty(t))}pushClassPrivateProperty(r,t){const n=this.parseClassPrivateProperty(t);r.body.push(n),this.classScope.declarePrivateName(this.getPrivateNameSV(n.key),0,n.key.loc.start)}pushClassAccessorProperty(r,t,n){!n&&!t.computed&&this.nameIsConstructor(t.key)&&this.raise(S.ConstructorClassField,t.key);const o=this.parseClassAccessorProperty(t);r.body.push(o),n&&this.classScope.declarePrivateName(this.getPrivateNameSV(o.key),0,o.key.loc.start)}pushClassMethod(r,t,n,o,l,d){r.body.push(this.parseMethod(t,n,o,l,d,"ClassMethod",!0))}pushClassPrivateMethod(r,t,n,o){const l=this.parseMethod(t,n,o,!1,!1,"ClassPrivateMethod",!0);r.body.push(l);const d=l.kind==="get"?l.static?6:2:l.kind==="set"?l.static?5:1:0;this.declareClassPrivateMethodInScope(l,d)}declareClassPrivateMethodInScope(r,t){this.classScope.declarePrivateName(this.getPrivateNameSV(r.key),t,r.key.loc.start)}parsePostMemberNameModifiers(r){}parseClassPrivateProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassPrivateProperty")}parseClassProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassProperty")}parseClassAccessorProperty(r){return this.parseInitializer(r),this.semicolon(),this.finishNode(r,"ClassAccessorProperty")}parseInitializer(r){this.scope.enter(592),this.expressionScope.enter(sa()),this.prodParam.enter(0),r.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(r,t,n,o=8331){if(ie(this.state.type))r.id=this.parseIdentifier(),t&&this.declareNameFromIdentifier(r.id,o);else if(n||!t)r.id=null;else throw this.raise(S.MissingClassName,this.state.startLoc)}parseClassSuper(r){r.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(r,t){const n=this.parseMaybeImportPhase(r,!0),o=this.maybeParseExportDefaultSpecifier(r,n),l=!o||this.eat(12),d=l&&this.eatExportStar(r),m=d&&this.maybeParseExportNamespaceSpecifier(r),g=l&&(!m||this.eat(12)),E=o||d;if(d&&!m){if(o&&this.unexpected(),t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.parseExportFrom(r,!0),this.sawUnambiguousESM=!0,this.finishNode(r,"ExportAllDeclaration")}const b=this.maybeParseExportNamedSpecifiers(r);o&&l&&!d&&!b&&this.unexpected(null,5),m&&g&&this.unexpected(null,98);let I;if(E||b){if(I=!1,t)throw this.raise(S.UnsupportedDecoratorExport,r);this.parseExportFrom(r,E)}else I=this.maybeParseExportDeclaration(r);if(E||b||I){var C;const N=r;if(this.checkExport(N,!0,!1,!!N.source),((C=N.declaration)==null?void 0:C.type)==="ClassDeclaration")this.maybeTakeDecorators(t,N.declaration,N);else if(t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.sawUnambiguousESM=!0,this.finishNode(N,"ExportNamedDeclaration")}if(this.eat(65)){const N=r,M=this.parseExportDefaultExpression();if(N.declaration=M,M.type==="ClassDeclaration")this.maybeTakeDecorators(t,M,N);else if(t)throw this.raise(S.UnsupportedDecoratorExport,r);return this.checkExport(N,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(N,"ExportDefaultDeclaration")}throw this.unexpected(null,5)}eatExportStar(r){return this.eat(55)}maybeParseExportDefaultSpecifier(r,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",t?.loc.start);const n=t||this.parseIdentifier(!0),o=this.startNodeAtNode(n);return o.exported=n,r.specifiers=[this.finishNode(o,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(r){if(this.isContextual(93)){var t,n;(n=(t=r).specifiers)!=null||(t.specifiers=[]);const o=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),o.exported=this.parseModuleExportName(),r.specifiers.push(this.finishNode(o,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(r){if(this.match(5)){const t=r;t.specifiers||(t.specifiers=[]);const n=t.exportKind==="type";return t.specifiers.push(...this.parseExportSpecifiers(n)),t.source=null,this.hasPlugin("importAssertions")?t.assertions=[]:t.attributes=[],t.declaration=null,!0}return!1}maybeParseExportDeclaration(r){return this.shouldParseExportDeclaration()?(r.specifiers=[],r.source=null,this.hasPlugin("importAssertions")?r.assertions=[]:r.attributes=[],r.declaration=this.parseExportDeclaration(r),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;const r=this.nextTokenInLineStart();return this.isUnparsedContextual(r,"function")}parseExportDefaultExpression(){const r=this.startNode();if(this.match(68))return this.next(),this.parseFunction(r,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(r,13);if(this.match(80))return this.parseClass(r,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(S.DecoratorBeforeExport,this.state.startLoc),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(S.UnsupportedDefaultExport,this.state.startLoc);const t=this.parseMaybeAssignAllowIn();return this.semicolon(),t}parseExportDeclaration(r){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){const{type:r}=this.state;if(ie(r)){if(r===95&&!this.state.containsEsc||r===100)return!1;if((r===130||r===129)&&!this.state.containsEsc){const o=this.nextTokenStart(),l=this.input.charCodeAt(o);if(l===123||this.chStartsBindingIdentifier(l,o)&&!this.input.startsWith("from",o))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;const t=this.nextTokenStart(),n=this.isUnparsedContextual(t,"from");if(this.input.charCodeAt(t)===44||ie(this.state.type)&&n)return!0;if(this.match(65)&&n){const o=this.input.charCodeAt(this.nextTokenStartSince(t+4));return o===34||o===39}return!1}parseExportFrom(r,t){this.eatContextual(98)?(r.source=this.parseImportSource(),this.checkExport(r),this.maybeParseImportAttributes(r),this.checkJSONModuleImport(r)):t&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){const{type:r}=this.state;return r===26&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?(this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(S.DecoratorBeforeExport,this.state.startLoc),!0):this.isUsing()?(this.raise(S.UsingDeclarationExport,this.state.startLoc),!0):this.isAwaitUsing()?(this.raise(S.UsingDeclarationExport,this.state.startLoc),!0):r===74||r===75||r===68||r===80||this.isLet()||this.isAsyncFunction()}checkExport(r,t,n,o){if(t){var l;if(n){if(this.checkDuplicateExports(r,"default"),this.hasPlugin("exportDefaultFrom")){var d;const m=r.declaration;m.type==="Identifier"&&m.name==="from"&&m.end-m.start===4&&!((d=m.extra)!=null&&d.parenthesized)&&this.raise(S.ExportDefaultFromAsIdentifier,m)}}else if((l=r.specifiers)!=null&&l.length)for(const m of r.specifiers){const{exported:g}=m,E=g.type==="Identifier"?g.name:g.value;if(this.checkDuplicateExports(m,E),!o&&m.local){const{local:b}=m;b.type!=="Identifier"?this.raise(S.ExportBindingIsString,m,{localName:b.value,exportName:E}):(this.checkReservedWord(b.name,b.loc.start,!0,!1),this.scope.checkLocalExport(b))}}else if(r.declaration){const m=r.declaration;if(m.type==="FunctionDeclaration"||m.type==="ClassDeclaration"){const{id:g}=m;if(!g)throw new Error("Assertion failure");this.checkDuplicateExports(r,g.name)}else if(m.type==="VariableDeclaration")for(const g of m.declarations)this.checkDeclaration(g.id)}}}checkDeclaration(r){if(r.type==="Identifier")this.checkDuplicateExports(r,r.name);else if(r.type==="ObjectPattern")for(const t of r.properties)this.checkDeclaration(t);else if(r.type==="ArrayPattern")for(const t of r.elements)t&&this.checkDeclaration(t);else r.type==="ObjectProperty"?this.checkDeclaration(r.value):r.type==="RestElement"?this.checkDeclaration(r.argument):r.type==="AssignmentPattern"&&this.checkDeclaration(r.left)}checkDuplicateExports(r,t){this.exportedIdentifiers.has(t)&&(t==="default"?this.raise(S.DuplicateDefaultExport,r):this.raise(S.DuplicateExport,r,{exportName:t})),this.exportedIdentifiers.add(t)}parseExportSpecifiers(r){const t=[];let n=!0;for(this.expect(5);!this.eat(8);){if(n)n=!1;else if(this.expect(12),this.eat(8))break;const o=this.isContextual(130),l=this.match(134),d=this.startNode();d.local=this.parseModuleExportName(),t.push(this.parseExportSpecifier(d,l,r,o))}return t}parseExportSpecifier(r,t,n,o){return this.eatContextual(93)?r.exported=this.parseModuleExportName():t?r.exported=this.cloneStringLiteral(r.local):r.exported||(r.exported=this.cloneIdentifier(r.local)),this.finishNode(r,"ExportSpecifier")}parseModuleExportName(){if(this.match(134)){const r=this.parseStringLiteral(this.state.value),t=np.exec(r.value);return t&&this.raise(S.ModuleExportNameHasLoneSurrogate,r,{surrogateCharCode:t[0].charCodeAt(0)}),r}return this.parseIdentifier(!0)}isJSONModuleImport(r){return r.assertions!=null?r.assertions.some(({key:t,value:n})=>n.value==="json"&&(t.type==="Identifier"?t.name==="type":t.value==="type")):!1}checkImportReflection(r){const{specifiers:t}=r,n=t.length===1?t[0].type:null;if(r.phase==="source")n!=="ImportDefaultSpecifier"&&this.raise(S.SourcePhaseImportRequiresDefault,t[0].loc.start);else if(r.phase==="defer")n!=="ImportNamespaceSpecifier"&&this.raise(S.DeferImportRequiresNamespace,t[0].loc.start);else if(r.module){var o;n!=="ImportDefaultSpecifier"&&this.raise(S.ImportReflectionNotBinding,t[0].loc.start),((o=r.assertions)==null?void 0:o.length)>0&&this.raise(S.ImportReflectionHasAssertion,t[0].loc.start)}}checkJSONModuleImport(r){if(this.isJSONModuleImport(r)&&r.type!=="ExportAllDeclaration"){const{specifiers:t}=r;if(t!=null){const n=t.find(o=>{let l;if(o.type==="ExportSpecifier"?l=o.local:o.type==="ImportSpecifier"&&(l=o.imported),l!==void 0)return l.type==="Identifier"?l.name!=="default":l.value!=="default"});n!==void 0&&this.raise(S.ImportJSONBindingNotDefault,n.loc.start)}}}isPotentialImportPhase(r){return r?!1:this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(r,t,n,o){t||(n==="module"?(this.expectPlugin("importReflection",o),r.module=!0):this.hasPlugin("importReflection")&&(r.module=!1),n==="source"?(this.expectPlugin("sourcePhaseImports",o),r.phase="source"):n==="defer"?(this.expectPlugin("deferredImportEvaluation",o),r.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(r.phase=null))}parseMaybeImportPhase(r,t){if(!this.isPotentialImportPhase(t))return this.applyImportPhase(r,t,null),null;const n=this.startNode(),o=this.parseIdentifierName(!0),{type:l}=this.state;return(Xe(l)?l!==98||this.lookaheadCharCode()===102:l!==12)?(this.applyImportPhase(r,t,o,n.loc.start),null):(this.applyImportPhase(r,t,null),this.createIdentifier(n,o))}isPrecedingIdImportPhase(r){const{type:t}=this.state;return ie(t)?t!==98||this.lookaheadCharCode()===102:t!==12}parseImport(r){return this.match(134)?this.parseImportSourceAndAttributes(r):this.parseImportSpecifiersAndAfter(r,this.parseMaybeImportPhase(r,!1))}parseImportSpecifiersAndAfter(r,t){r.specifiers=[];const o=!this.maybeParseDefaultImportSpecifier(r,t)||this.eat(12),l=o&&this.maybeParseStarImportSpecifier(r);return o&&!l&&this.parseNamedImportSpecifiers(r),this.expectContextual(98),this.parseImportSourceAndAttributes(r)}parseImportSourceAndAttributes(r){var t;return(t=r.specifiers)!=null||(r.specifiers=[]),r.source=this.parseImportSource(),this.maybeParseImportAttributes(r),this.checkImportReflection(r),this.checkJSONModuleImport(r),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(r,"ImportDeclaration")}parseImportSource(){return this.match(134)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(r,t,n){t.local=this.parseIdentifier(),r.specifiers.push(this.finishImportSpecifier(t,n))}finishImportSpecifier(r,t,n=8201){return this.checkLVal(r.local,{type:t},n),this.finishNode(r,t)}parseImportAttributes(){this.expect(5);const r=[],t=new Set;do{if(this.match(8))break;const n=this.startNode(),o=this.state.value;if(t.has(o)&&this.raise(S.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:o}),t.add(o),this.match(134)?n.key=this.parseStringLiteral(o):n.key=this.parseIdentifier(!0),this.expect(14),!this.match(134))throw this.raise(S.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),r.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return this.expect(8),r}parseModuleAttributes(){const r=[],t=new Set;do{const n=this.startNode();if(n.key=this.parseIdentifier(!0),n.key.name!=="type"&&this.raise(S.ModuleAttributeDifferentFromType,n.key),t.has(n.key.name)&&this.raise(S.ModuleAttributesWithDuplicateKeys,n.key,{key:n.key.name}),t.add(n.key.name),this.expect(14),!this.match(134))throw this.raise(S.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),r.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return r}maybeParseImportAttributes(r){let t;var n=!1;if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),this.hasPlugin("moduleAttributes")?(t=this.parseModuleAttributes(),this.addExtra(r,"deprecatedWithLegacySyntax",!0)):t=this.parseImportAttributes(),n=!0}else this.isContextual(94)&&!this.hasPrecedingLineBreak()?(!this.hasPlugin("deprecatedImportAssert")&&!this.hasPlugin("importAssertions")&&this.raise(S.ImportAttributesUseAssert,this.state.startLoc),this.hasPlugin("importAssertions")||this.addExtra(r,"deprecatedAssertSyntax",!0),this.next(),t=this.parseImportAttributes()):t=[];!n&&this.hasPlugin("importAssertions")?r.assertions=t:r.attributes=t}maybeParseDefaultImportSpecifier(r,t){if(t){const n=this.startNodeAtNode(t);return n.local=t,r.specifiers.push(this.finishImportSpecifier(n,"ImportDefaultSpecifier")),!0}else if(Xe(this.state.type))return this.parseImportSpecifierLocal(r,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(r){if(this.match(55)){const t=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(r,t,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(r){let t=!0;for(this.expect(5);!this.eat(8);){if(t)t=!1;else{if(this.eat(14))throw this.raise(S.DestructureNamedImport,this.state.startLoc);if(this.expect(12),this.eat(8))break}const n=this.startNode(),o=this.match(134),l=this.isContextual(130);n.imported=this.parseModuleExportName();const d=this.parseImportSpecifier(n,o,r.importKind==="type"||r.importKind==="typeof",l,void 0);r.specifiers.push(d)}}parseImportSpecifier(r,t,n,o,l){if(this.eatContextual(93))r.local=this.parseIdentifier();else{const{imported:d}=r;if(t)throw this.raise(S.ImportBindingIsString,r,{importName:d.value});this.checkReservedWord(d.name,r.loc.start,!0,!0),r.local||(r.local=this.cloneIdentifier(d))}return this.finishImportSpecifier(r,"ImportSpecifier",l)}isThisParam(r){return r.type==="Identifier"&&r.name==="this"}}class ha extends op{constructor(r,t,n){const o=$e(r);super(o,t),this.options=o,this.initializeScopes(),this.plugins=n,this.filename=o.sourceFilename,this.startIndex=o.startIndex;let l=0;o.allowAwaitOutsideFunction&&(l|=1),o.allowReturnOutsideFunction&&(l|=2),o.allowImportExportEverywhere&&(l|=8),o.allowSuperOutsideMethod&&(l|=16),o.allowUndeclaredExports&&(l|=64),o.allowNewTargetOutsideFunction&&(l|=4),o.allowYieldOutsideFunction&&(l|=32),o.ranges&&(l|=128),o.tokens&&(l|=256),o.createImportExpressions&&(l|=512),o.createParenthesizedExpressions&&(l|=1024),o.errorRecovery&&(l|=2048),o.attachComment&&(l|=4096),o.annexB&&(l|=8192),this.optionFlags=l}getScopeHandler(){return pr}parse(){this.enterInitialScopes();const r=this.startNode(),t=this.startNode();this.nextToken(),r.errors=null;const n=this.parseTopLevel(r,t);return n.errors=this.state.errors,n.comments.length=this.state.commentsLen,n}}function cp(p,r){var t;if(((t=r)==null?void 0:t.sourceType)==="unambiguous"){r=Object.assign({},r);try{r.sourceType="module";const n=Is(r,p),o=n.parse();if(n.sawUnambiguousESM)return o;if(n.ambiguousScriptDifferentAst)try{return r.sourceType="script",Is(r,p).parse()}catch{}else o.program.sourceType="script";return o}catch(n){try{return r.sourceType="script",Is(r,p).parse()}catch{}throw n}}else return Is(r,p).parse()}function lp(p,r){const t=Is(r,p);return t.options.strictMode&&(t.state.strict=!0),t.getExpression()}function up(p){const r={};for(const t of Object.keys(p))r[t]=ut(p[t]);return r}const hp=up(Wu);function Is(p,r){let t=ha;const n=new Map;if(p!=null&&p.plugins){for(const o of p.plugins){let l,d;typeof o=="string"?l=o:[l,d]=o,n.has(l)||n.set(l,d||{})}tp(n),t=pp(n)}return new t(p,r,n)}const pa=new Map;function pp(p){const r=[];for(const o of sp)p.has(o)&&r.push(o);const t=r.join("|");let n=pa.get(t);if(!n){n=ha;for(const o of r)n=ua[o](n);pa.set(t,n)}return n}return as.parse=cp,as.parseExpression=lp,as.tokTypes=hp,as}var NT=vT();/**
47
+ * @vue/shared v3.5.28
48
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
49
+ * @license MIT
50
+ **/function Oi(e){const s=Object.create(null);for(const i of e.split(","))s[i]=1;return i=>i in s}const _T=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const nn=()=>{},Li=()=>!1,ki=Object.assign,Ls=Array.isArray,ks=e=>typeof e=="string",OT=e=>typeof e=="symbol",fl=e=>{const s=Object.create(null);return(i=>s[i]||(s[i]=e(i)))},LT=/-\w/g,kT=fl(e=>e.replace(LT,s=>s.slice(1).toUpperCase())),DT=fl(e=>e.charAt(0).toUpperCase()+e.slice(1)),RT={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"},MT=/;(?![^(]*\))/g,$T=/:([^]+)/,FT=/\/\*[^]*?\*\//g;function BT(e){const s={};return e.replace(FT,"").split(MT).forEach(i=>{if(i){const a=i.split($T);a.length>1&&(s[a[0].trim()]=a[1].trim())}}),s}const UT="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",jT="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",zT="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",VT="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",GT=Oi(UT),HT=Oi(jT),ZT=Oi(zT),WT=Oi(VT);/**
51
+ * @vue/compiler-core v3.5.28
52
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
53
+ * @license MIT
54
+ **/const ml=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),yl=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),gl=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),El=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),Tl=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),Di=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),Sl=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),bl=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),xl=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),Il=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),Pl=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),KT=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),qT=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),YT=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),JT=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),XT=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),QT=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),eS=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),tS=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),sS=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),iS=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),wl=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),rS=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),Al=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),Cl=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),vl=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Nl=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),nS=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),aS=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),oS=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),cS=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),lS=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),uS=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),hS=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),pS=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),dS=Symbol(process.env.NODE_ENV!=="production"?"unref":""),fS=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),mS=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),yS=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),_l={[ml]:"Fragment",[yl]:"Teleport",[gl]:"Suspense",[El]:"KeepAlive",[Tl]:"BaseTransition",[Di]:"openBlock",[Sl]:"createBlock",[bl]:"createElementBlock",[xl]:"createVNode",[Il]:"createElementVNode",[Pl]:"createCommentVNode",[KT]:"createTextVNode",[qT]:"createStaticVNode",[YT]:"resolveComponent",[JT]:"resolveDynamicComponent",[XT]:"resolveDirective",[QT]:"resolveFilter",[eS]:"withDirectives",[tS]:"renderList",[sS]:"renderSlot",[iS]:"createSlots",[wl]:"toDisplayString",[rS]:"mergeProps",[Al]:"normalizeClass",[Cl]:"normalizeStyle",[vl]:"normalizeProps",[Nl]:"guardReactiveProps",[nS]:"toHandlers",[aS]:"camelize",[oS]:"capitalize",[cS]:"toHandlerKey",[lS]:"setBlockTracking",[uS]:"pushScopeId",[hS]:"popScopeId",[pS]:"withCtx",[dS]:"unref",[fS]:"isRef",[mS]:"withMemo",[yS]:"isMemoSame"};function gS(e){Object.getOwnPropertySymbols(e).forEach(s=>{_l[s]=e[s]})}const Ds={ELEMENT:1,SIMPLE_EXPRESSION:4,ATTRIBUTE:6,DIRECTIVE:7},Rs={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function ES(e,s=""){return{type:0,source:s,children:e,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:Rs}}function TS(e,s,i,a,c,u,h,f=!1,y=!1,T=!1,x=Rs){return e&&(f?(e.helper(Di),e.helper(cn(e.inSSR,T))):e.helper(on(e.inSSR,T))),{type:13,tag:s,props:i,children:a,patchFlag:c,dynamicProps:u,directives:h,isBlock:f,disableTracking:y,isComponent:T,loc:x}}function an(e,s=Rs){return{type:17,loc:s,elements:e}}function Bt(e,s=!1,i=Rs,a=0){return{type:4,loc:i,content:e,isStatic:s,constType:s?3:a}}function SS(e,s,i=!1,a=!1){return{type:20,index:e,value:s,needPauseTracking:i,inVOnce:a,needArraySpread:!1,loc:Rs}}function on(e,s){return e||s?xl:Il}function cn(e,s){return e||s?Sl:bl}function bS(e,{helper:s,removeHelper:i,inSSR:a}){e.isBlock||(e.isBlock=!0,i(on(a,e.isComponent)),s(Di),s(cn(a,e.isComponent)))}const Ol=new Uint8Array([123,123]),Ll=new Uint8Array([125,125]);function kl(e){return e>=97&&e<=122||e>=65&&e<=90}function Ze(e){return e===32||e===10||e===9||e===12||e===13}function Ot(e){return e===47||e===62||Ze(e)}function Ri(e){const s=new Uint8Array(e.length);for(let i=0;i<e.length;i++)s[i]=e.charCodeAt(i);return s}const ve={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class xS{constructor(s,i){this.stack=s,this.cbs=i,this.state=1,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=1,this.inRCDATA=!1,this.inXML=!1,this.inVPre=!1,this.newlines=[],this.mode=0,this.delimiterOpen=Ol,this.delimiterClose=Ll,this.delimiterIndex=-1,this.currentSequence=void 0,this.sequenceIndex=0}get inSFCRoot(){return this.mode===2&&this.stack.length===0}reset(){this.state=1,this.mode=0,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=1,this.inRCDATA=!1,this.currentSequence=void 0,this.newlines.length=0,this.delimiterOpen=Ol,this.delimiterClose=Ll}getPos(s){let i=1,a=s+1;const c=this.newlines.length;let u=-1;if(c>100){let h=-1,f=c;for(;h+1<f;){const y=h+f>>>1;this.newlines[y]<s?h=y:f=y}u=h}else for(let h=c-1;h>=0;h--)if(s>this.newlines[h]){u=h;break}return u>=0&&(i=u+2,a=s-this.newlines[u]),{column:a,line:i,offset:s}}peek(){return this.buffer.charCodeAt(this.index+1)}stateText(s){s===60?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=5,this.sectionStart=this.index):!this.inVPre&&s===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(s))}stateInterpolationOpen(s){if(s===this.delimiterOpen[this.delimiterIndex])if(this.delimiterIndex===this.delimiterOpen.length-1){const i=this.index+1-this.delimiterOpen.length;i>this.sectionStart&&this.cbs.ontext(this.sectionStart,i),this.state=3,this.sectionStart=i}else this.delimiterIndex++;else this.inRCDATA?(this.state=32,this.stateInRCDATA(s)):(this.state=1,this.stateText(s))}stateInterpolation(s){s===this.delimiterClose[0]&&(this.state=4,this.delimiterIndex=0,this.stateInterpolationClose(s))}stateInterpolationClose(s){s===this.delimiterClose[this.delimiterIndex]?this.delimiterIndex===this.delimiterClose.length-1?(this.cbs.oninterpolation(this.sectionStart,this.index+1),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):this.delimiterIndex++:(this.state=3,this.stateInterpolation(s))}stateSpecialStartSequence(s){const i=this.sequenceIndex===this.currentSequence.length;if(!(i?Ot(s):(s|32)===this.currentSequence[this.sequenceIndex]))this.inRCDATA=!1;else if(!i){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=6,this.stateInTagName(s)}stateInRCDATA(s){if(this.sequenceIndex===this.currentSequence.length){if(s===62||Ze(s)){const i=this.index-this.currentSequence.length;if(this.sectionStart<i){const a=this.index;this.index=i,this.cbs.ontext(this.sectionStart,i),this.index=a}this.sectionStart=i+2,this.stateInClosingTagName(s),this.inRCDATA=!1;return}this.sequenceIndex=0}(s|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===ve.TitleEnd||this.currentSequence===ve.TextareaEnd&&!this.inSFCRoot?!this.inVPre&&s===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(s)):this.fastForwardTo(60)&&(this.sequenceIndex=1):this.sequenceIndex=+(s===60)}stateCDATASequence(s){s===ve.Cdata[this.sequenceIndex]?++this.sequenceIndex===ve.Cdata.length&&(this.state=28,this.currentSequence=ve.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=23,this.stateInDeclaration(s))}fastForwardTo(s){for(;++this.index<this.buffer.length;){const i=this.buffer.charCodeAt(this.index);if(i===10&&this.newlines.push(this.index),i===s)return!0}return this.index=this.buffer.length-1,!1}stateInCommentLike(s){s===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===ve.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index-2):this.cbs.oncomment(this.sectionStart,this.index-2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=1):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):s!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}startSpecial(s,i){this.enterRCDATA(s,i),this.state=31}enterRCDATA(s,i){this.inRCDATA=!0,this.currentSequence=s,this.sequenceIndex=i}stateBeforeTagName(s){s===33?(this.state=22,this.sectionStart=this.index+1):s===63?(this.state=24,this.sectionStart=this.index+1):kl(s)?(this.sectionStart=this.index,this.mode===0?this.state=6:this.inSFCRoot?this.state=34:this.inXML?this.state=6:s===116?this.state=30:this.state=s===115?29:6):s===47?this.state=8:(this.state=1,this.stateText(s))}stateInTagName(s){Ot(s)&&this.handleTagName(s)}stateInSFCRootTagName(s){if(Ot(s)){const i=this.buffer.slice(this.sectionStart,this.index);i!=="template"&&this.enterRCDATA(Ri("</"+i),0),this.handleTagName(s)}}handleTagName(s){this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(s)}stateBeforeClosingTagName(s){Ze(s)||(s===62?(process.env.NODE_ENV!=="production"&&this.cbs.onerr(14,this.index),this.state=1,this.sectionStart=this.index+1):(this.state=kl(s)?9:27,this.sectionStart=this.index))}stateInClosingTagName(s){(s===62||Ze(s))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=10,this.stateAfterClosingTagName(s))}stateAfterClosingTagName(s){s===62&&(this.state=1,this.sectionStart=this.index+1)}stateBeforeAttrName(s){s===62?(this.cbs.onopentagend(this.index),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):s===47?(this.state=7,process.env.NODE_ENV!=="production"&&this.peek()!==62&&this.cbs.onerr(22,this.index)):s===60&&this.peek()===47?(this.cbs.onopentagend(this.index),this.state=5,this.sectionStart=this.index):Ze(s)||(process.env.NODE_ENV!=="production"&&s===61&&this.cbs.onerr(19,this.index),this.handleAttrStart(s))}handleAttrStart(s){s===118&&this.peek()===45?(this.state=13,this.sectionStart=this.index):s===46||s===58||s===64||s===35?(this.cbs.ondirname(this.index,this.index+1),this.state=14,this.sectionStart=this.index+1):(this.state=12,this.sectionStart=this.index)}stateInSelfClosingTag(s){s===62?(this.cbs.onselfclosingtag(this.index),this.state=1,this.sectionStart=this.index+1,this.inRCDATA=!1):Ze(s)||(this.state=11,this.stateBeforeAttrName(s))}stateInAttrName(s){s===61||Ot(s)?(this.cbs.onattribname(this.sectionStart,this.index),this.handleAttrNameEnd(s)):process.env.NODE_ENV!=="production"&&(s===34||s===39||s===60)&&this.cbs.onerr(17,this.index)}stateInDirName(s){s===61||Ot(s)?(this.cbs.ondirname(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===58?(this.cbs.ondirname(this.sectionStart,this.index),this.state=14,this.sectionStart=this.index+1):s===46&&(this.cbs.ondirname(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDirArg(s){s===61||Ot(s)?(this.cbs.ondirarg(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===91?this.state=15:s===46&&(this.cbs.ondirarg(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDynamicDirArg(s){s===93?this.state=14:(s===61||Ot(s))&&(this.cbs.ondirarg(this.sectionStart,this.index+1),this.handleAttrNameEnd(s),process.env.NODE_ENV!=="production"&&this.cbs.onerr(27,this.index))}stateInDirModifier(s){s===61||Ot(s)?(this.cbs.ondirmodifier(this.sectionStart,this.index),this.handleAttrNameEnd(s)):s===46&&(this.cbs.ondirmodifier(this.sectionStart,this.index),this.sectionStart=this.index+1)}handleAttrNameEnd(s){this.sectionStart=this.index,this.state=17,this.cbs.onattribnameend(this.index),this.stateAfterAttrName(s)}stateAfterAttrName(s){s===61?this.state=18:s===47||s===62?(this.cbs.onattribend(0,this.sectionStart),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(s)):Ze(s)||(this.cbs.onattribend(0,this.sectionStart),this.handleAttrStart(s))}stateBeforeAttrValue(s){s===34?(this.state=19,this.sectionStart=this.index+1):s===39?(this.state=20,this.sectionStart=this.index+1):Ze(s)||(this.sectionStart=this.index,this.state=21,this.stateInAttrValueNoQuotes(s))}handleInAttrValue(s,i){(s===i||this.fastForwardTo(i))&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(i===34?3:2,this.index+1),this.state=11)}stateInAttrValueDoubleQuotes(s){this.handleInAttrValue(s,34)}stateInAttrValueSingleQuotes(s){this.handleInAttrValue(s,39)}stateInAttrValueNoQuotes(s){Ze(s)||s===62?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(1,this.index),this.state=11,this.stateBeforeAttrName(s)):(process.env.NODE_ENV!=="production"&&s===34||s===39||s===60||s===61||s===96)&&this.cbs.onerr(18,this.index)}stateBeforeDeclaration(s){s===91?(this.state=26,this.sequenceIndex=0):this.state=s===45?25:23}stateInDeclaration(s){(s===62||this.fastForwardTo(62))&&(this.state=1,this.sectionStart=this.index+1)}stateInProcessingInstruction(s){(s===62||this.fastForwardTo(62))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeComment(s){s===45?(this.state=28,this.currentSequence=ve.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=23}stateInSpecialComment(s){(s===62||this.fastForwardTo(62))&&(this.cbs.oncomment(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeSpecialS(s){s===ve.ScriptEnd[3]?this.startSpecial(ve.ScriptEnd,4):s===ve.StyleEnd[3]?this.startSpecial(ve.StyleEnd,4):(this.state=6,this.stateInTagName(s))}stateBeforeSpecialT(s){s===ve.TitleEnd[3]?this.startSpecial(ve.TitleEnd,4):s===ve.TextareaEnd[3]?this.startSpecial(ve.TextareaEnd,4):(this.state=6,this.stateInTagName(s))}startEntity(){}stateInEntity(){}parse(s){for(this.buffer=s;this.index<this.buffer.length;){const i=this.buffer.charCodeAt(this.index);switch(i===10&&this.state!==33&&this.newlines.push(this.index),this.state){case 1:{this.stateText(i);break}case 2:{this.stateInterpolationOpen(i);break}case 3:{this.stateInterpolation(i);break}case 4:{this.stateInterpolationClose(i);break}case 31:{this.stateSpecialStartSequence(i);break}case 32:{this.stateInRCDATA(i);break}case 26:{this.stateCDATASequence(i);break}case 19:{this.stateInAttrValueDoubleQuotes(i);break}case 12:{this.stateInAttrName(i);break}case 13:{this.stateInDirName(i);break}case 14:{this.stateInDirArg(i);break}case 15:{this.stateInDynamicDirArg(i);break}case 16:{this.stateInDirModifier(i);break}case 28:{this.stateInCommentLike(i);break}case 27:{this.stateInSpecialComment(i);break}case 11:{this.stateBeforeAttrName(i);break}case 6:{this.stateInTagName(i);break}case 34:{this.stateInSFCRootTagName(i);break}case 9:{this.stateInClosingTagName(i);break}case 5:{this.stateBeforeTagName(i);break}case 17:{this.stateAfterAttrName(i);break}case 20:{this.stateInAttrValueSingleQuotes(i);break}case 18:{this.stateBeforeAttrValue(i);break}case 8:{this.stateBeforeClosingTagName(i);break}case 10:{this.stateAfterClosingTagName(i);break}case 29:{this.stateBeforeSpecialS(i);break}case 30:{this.stateBeforeSpecialT(i);break}case 21:{this.stateInAttrValueNoQuotes(i);break}case 7:{this.stateInSelfClosingTag(i);break}case 23:{this.stateInDeclaration(i);break}case 22:{this.stateBeforeDeclaration(i);break}case 25:{this.stateBeforeComment(i);break}case 24:{this.stateInProcessingInstruction(i);break}case 33:{this.stateInEntity();break}}this.index++}this.cleanup(),this.finish()}cleanup(){this.sectionStart!==this.index&&(this.state===1||this.state===32&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===19||this.state===20||this.state===21)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}finish(){this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const s=this.buffer.length;this.sectionStart>=s||(this.state===28?this.currentSequence===ve.CdataEnd?this.cbs.oncdata(this.sectionStart,s):this.cbs.oncomment(this.sectionStart,s):this.state===6||this.state===11||this.state===18||this.state===17||this.state===12||this.state===13||this.state===14||this.state===15||this.state===16||this.state===20||this.state===19||this.state===21||this.state===9||this.cbs.ontext(this.sectionStart,s))}emitCodePoint(s,i){}}const IS={COMPILER_IS_ON_ELEMENT:{message:'Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".',link:"https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html"},COMPILER_V_BIND_SYNC:{message:e=>`.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${e}.sync\` should be changed to \`v-model:${e}\`.`,link:"https://v3-migration.vuejs.org/breaking-changes/v-model.html"},COMPILER_V_BIND_OBJECT_ORDER:{message:'v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.',link:"https://v3-migration.vuejs.org/breaking-changes/v-bind.html"},COMPILER_V_ON_NATIVE:{message:".native modifier for v-on has been removed as is no longer necessary.",link:"https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html"},COMPILER_V_IF_V_FOR_PRECEDENCE:{message:"v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.",link:"https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html"},COMPILER_NATIVE_TEMPLATE:{message:"<template> with no special directives will render as a native template element instead of its inner content in Vue 3."},COMPILER_INLINE_TEMPLATE:{message:'"inline-template" has been removed in Vue 3.',link:"https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html"},COMPILER_FILTERS:{message:'filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.',link:"https://v3-migration.vuejs.org/breaking-changes/filters.html"}};function ln(e,{compatConfig:s}){const i=s&&s[e];return e==="MODE"?i||3:i}function un(e,s){const i=ln("MODE",s),a=ln(e,s);return i===3?a===!0:a!==!1}function Mi(e,s,i,...a){const c=un(e,s);return process.env.NODE_ENV!=="production"&&c&&hn(e,s,i,...a),c}function hn(e,s,i,...a){if(ln(e,s)==="suppress-warning")return;const{message:u,link:h}=IS[e],f=`(deprecation ${e}) ${typeof u=="function"?u(...a):u}${h?`
55
+ Details: ${h}`:""}`,y=new SyntaxError(f);y.code=e,i&&(y.loc=i),s.onWarn(y)}function Dl(e){throw e}function Rl(e){process.env.NODE_ENV!=="production"&&console.warn(`[Vue warn] ${e.message}`)}function Ml(e,s,i,a){const c=process.env.NODE_ENV!=="production"?(i||PS)[e]+(a||""):`https://vuejs.org/error-reference/#compiler-${e}`,u=new SyntaxError(String(c));return u.code=e,u.loc=s,u}const PS={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 '&lt;' 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:""},wS=e=>e.type===4&&e.isStatic;function AS(e){switch(e){case"Teleport":case"teleport":return yl;case"Suspense":case"suspense":return gl;case"KeepAlive":case"keep-alive":return El;case"BaseTransition":case"base-transition":return Tl}}function CS(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)&&(ks(s)?c.name===s:s.test(c.name)))return c}}function vS(e,s){return!!(e&&wS(e)&&e.content===s)}function $l(e){return e.type===7&&e.name==="pre"}function NS(e){return e.type===1&&e.tagType===2}const _S=/([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;function Fl(e){for(let s=0;s<e.length;s++)if(!Ze(e.charCodeAt(s)))return!1;return!0}function Bl(e){return e.type===2&&Fl(e.content)||e.type===12&&Bl(e.content)}function OS(e){return e.type===3||Bl(e)}const Ul={parseMode:"base",ns:0,delimiters:["{{","}}"],getNamespace:()=>0,isVoidTag:Li,isPreTag:Li,isIgnoreNewlineTag:Li,isCustomElement:Li,onError:Dl,onWarn:Rl,comments:process.env.NODE_ENV!=="production",prefixIdentifiers:!1};let J=Ul,Ms=null,yt="",Le=null,q=null,Ue="",gt=-1,Ut=-1,pn=0,Lt=!1,dn=null;const fe=[],ue=new xS(fe,{onerr:je,ontext(e,s){$i(Ne(e,s),e,s)},ontextentity(e,s,i){$i(e,s,i)},oninterpolation(e,s){if(Lt)return $i(Ne(e,s),e,s);let i=e+ue.delimiterOpen.length,a=s-ue.delimiterClose.length;for(;Ze(yt.charCodeAt(i));)i++;for(;Ze(yt.charCodeAt(a-1));)a--;let c=Ne(i,a);c.includes("&")&&(c=J.decodeEntities(c,!1)),fn({type:5,content:Bi(c,!1,Pe(i,a)),loc:Pe(e,s)})},onopentagname(e,s){const i=Ne(e,s);Le={type:1,tag:i,ns:J.getNamespace(i,fe[0],J.ns),tagType:0,props:[],children:[],loc:Pe(e-1,s),codegenNode:void 0}},onopentagend(e){zl(e)},onclosetag(e,s){const i=Ne(e,s);if(!J.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();Fi(f,s,h<c)}break}a||je(23,Vl(e,60))}},onselfclosingtag(e){const s=Le.tag;Le.isSelfClosing=!0,zl(e),fe[0]&&fe[0].tag===s&&Fi(fe.shift(),e)},onattribname(e,s){q={type:6,name:Ne(e,s),nameLoc:Pe(e,s),value:void 0,loc:Pe(e)}},ondirname(e,s){const i=Ne(e,s),a=i==="."||i===":"?"bind":i==="@"?"on":i==="#"?"slot":i.slice(2);if(!Lt&&a===""&&je(26,e),Lt||a==="")q={type:6,name:i,nameLoc:Pe(e,s),value:void 0,loc:Pe(e)};else if(q={type:7,name:a,rawName:i,exp:void 0,arg:void 0,modifiers:i==="."?[Bt("prop")]:[],loc:Pe(e)},a==="pre"){Lt=ue.inVPre=!0,dn=Le;const c=Le.props;for(let u=0;u<c.length;u++)c[u].type===7&&(c[u]=US(c[u]))}},ondirarg(e,s){if(e===s)return;const i=Ne(e,s);if(Lt&&!$l(q))q.name+=i,jt(q.nameLoc,s);else{const a=i[0]!=="[";q.arg=Bi(a?i:i.slice(1,-1),a,Pe(e,s),a?3:0)}},ondirmodifier(e,s){const i=Ne(e,s);if(Lt&&!$l(q))q.name+="."+i,jt(q.nameLoc,s);else if(q.name==="slot"){const a=q.arg;a&&(a.content+="."+i,jt(a.loc,s))}else{const a=Bt(i,!0,Pe(e,s));q.modifiers.push(a)}},onattribdata(e,s){Ue+=Ne(e,s),gt<0&&(gt=e),Ut=s},onattribentity(e,s,i){Ue+=e,gt<0&&(gt=s),Ut=i},onattribnameend(e){const s=q.loc.start.offset,i=Ne(s,e);q.type===7&&(q.rawName=i),Le.props.some(a=>(a.type===7?a.rawName:a.name)===i)&&je(2,s)},onattribend(e,s){if(Le&&q){if(jt(q.loc,s),e!==0)if(Ue.includes("&")&&(Ue=J.decodeEntities(Ue,!0)),q.type===6)q.name==="class"&&(Ue=Zl(Ue).trim()),e===1&&!Ue&&je(13,s),q.value={type:2,content:Ue,loc:e===1?Pe(gt,Ut):Pe(gt-1,Ut+1)},ue.inSFCRoot&&Le.tag==="template"&&q.name==="lang"&&Ue&&Ue!=="html"&&ue.enterRCDATA(Ri("</template"),0);else{let i=0;q.exp=Bi(Ue,!1,Pe(gt,Ut),0,i),q.name==="for"&&(q.forParseResult=kS(q.exp));let a=-1;q.name==="bind"&&(a=q.modifiers.findIndex(c=>c.content==="sync"))>-1&&Mi("COMPILER_V_BIND_SYNC",J,q.loc,q.arg.loc.source)&&(q.name="model",q.modifiers.splice(a,1))}(q.type!==7||q.name!=="pre")&&Le.props.push(q)}Ue="",gt=Ut=-1},oncomment(e,s){J.comments&&fn({type:3,content:Ne(e,s),loc:Pe(e-4,s+3)})},onend(){const e=yt.length;if(process.env.NODE_ENV!=="production"&&ue.state!==1)switch(ue.state){case 5:case 8:je(5,e);break;case 3:case 4:je(25,ue.sectionStart);break;case 28:ue.currentSequence===ve.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++)Fi(fe[s],e-1),je(24,fe[s].loc.start.offset)},oncdata(e,s){fe[0].ns!==0?$i(Ne(e,s),e,s):je(1,e-9)},onprocessinginstruction(e){(fe[0]?fe[0].ns:J.ns)===0&&je(21,e-1)}}),jl=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,LS=/^\(|\)$/g;function kS(e){const s=e.loc,i=e.content,a=i.match(_S);if(!a)return;const[,c,u]=a,h=(P,L,R=!1)=>{const ae=s.start.offset+L,ce=ae+P.length;return Bi(P,!1,Pe(ae,ce),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(LS,"").trim();const T=c.indexOf(y),x=y.match(jl);if(x){y=y.replace(jl,"").trim();const P=x[1].trim();let L;if(P&&(L=i.indexOf(P,T+y.length),f.key=h(P,L,!0)),x[2]){const R=x[2].trim();R&&(f.index=h(R,i.indexOf(R,f.key?L+P.length:T+y.length),!0))}}return y&&(f.value=h(y,T,!0)),f}function Ne(e,s){return yt.slice(e,s)}function zl(e){ue.inSFCRoot&&(Le.innerLoc=Pe(e+1,e+1)),fn(Le);const{tag:s,ns:i}=Le;i===0&&J.isPreTag(s)&&pn++,J.isVoidTag(s)?Fi(Le,e):(fe.unshift(Le),(i===1||i===2)&&(ue.inXML=!0)),Le=null}function $i(e,s,i){{const u=fe[0]&&fe[0].tag;u!=="script"&&u!=="style"&&e.includes("&")&&(e=J.decodeEntities(e,!1))}const a=fe[0]||Ms,c=a.children[a.children.length-1];c&&c.type===2?(c.content+=e,jt(c.loc,i)):a.children.push({type:2,content:e,loc:Pe(s,i)})}function Fi(e,s,i=!1){i?jt(e.loc,Vl(s,60)):jt(e.loc,DS(s,62)+1),ue.inSFCRoot&&(e.children.length?e.innerLoc.end=ki({},e.children[e.children.length-1].loc.end):e.innerLoc.end=ki({},e.innerLoc.start),e.innerLoc.source=Ne(e.innerLoc.start.offset,e.innerLoc.end.offset));const{tag:a,ns:c,children:u}=e;if(Lt||(a==="slot"?e.tagType=2:Gl(e)?e.tagType=3:MS(e)&&(e.tagType=1)),ue.inRCDATA||(e.children=Hl(u)),c===0&&J.isIgnoreNewlineTag(a)){const h=u[0];h&&h.type===2&&(h.content=h.content.replace(/^\r?\n/,""))}c===0&&J.isPreTag(a)&&pn--,dn===e&&(Lt=ue.inVPre=!1,dn=null),ue.inXML&&(fe[0]?fe[0].ns:J.ns)===0&&(ue.inXML=!1);{const h=e.props;if(process.env.NODE_ENV!=="production"&&un("COMPILER_V_IF_V_FOR_PRECEDENCE",J)){let y=!1,T=!1;for(let x=0;x<h.length;x++){const P=h[x];if(P.type===7&&(P.name==="if"?y=!0:P.name==="for"&&(T=!0)),y&&T){hn("COMPILER_V_IF_V_FOR_PRECEDENCE",J,e.loc);break}}}if(!ue.inSFCRoot&&un("COMPILER_NATIVE_TEMPLATE",J)&&e.tag==="template"&&!Gl(e)){process.env.NODE_ENV!=="production"&&hn("COMPILER_NATIVE_TEMPLATE",J,e.loc);const y=fe[0]||Ms,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&&Mi("COMPILER_INLINE_TEMPLATE",J,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 DS(e,s){let i=e;for(;yt.charCodeAt(i)!==s&&i<yt.length-1;)i++;return i}function Vl(e,s){let i=e;for(;yt.charCodeAt(i)!==s&&i>=0;)i--;return i}const RS=new Set(["if","else","else-if","for","slot"]);function Gl({tag:e,props:s}){if(e==="template"){for(let i=0;i<s.length;i++)if(s[i].type===7&&RS.has(s[i].name))return!0}return!1}function MS({tag:e,props:s}){if(J.isCustomElement(e))return!1;if(e==="component"||$S(e.charCodeAt(0))||AS(e)||J.isBuiltInComponent&&J.isBuiltInComponent(e)||J.isNativeTag&&!J.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(Mi("COMPILER_IS_ON_ELEMENT",J,a.loc))return!0}}else if(a.name==="bind"&&vS(a.arg,"is")&&Mi("COMPILER_IS_ON_ELEMENT",J,a.loc))return!0}return!1}function $S(e){return e>64&&e<91}const FS=/\r\n/g;function Hl(e){const s=J.whitespace!=="preserve";let i=!1;for(let a=0;a<e.length;a++){const c=e[a];if(c.type===2)if(pn)c.content=c.content.replace(FS,`
57
+ `);else if(Fl(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&&BS(c.content)))?(i=!0,e[a]=null):c.content=" "}else s&&(c.content=Zl(c.content))}return i?e.filter(Boolean):e}function BS(e){for(let s=0;s<e.length;s++){const i=e.charCodeAt(s);if(i===10||i===13)return!0}return!1}function Zl(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 fn(e){(fe[0]||Ms).children.push(e)}function Pe(e,s){return{start:ue.getPos(e),end:s==null?s:ue.getPos(s),source:s==null?s:Ne(e,s)}}function jt(e,s){e.end=ue.getPos(s),e.source=Ne(e.start.offset,s)}function US(e){const s={type:6,name:e.rawName,nameLoc:Pe(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 Bi(e,s=!1,i,a=0,c=0){return Bt(e,s,i,a)}function je(e,s,i){J.onError(Ml(e,Pe(s,s),void 0,i))}function jS(){ue.reset(),Le=null,q=null,Ue="",gt=-1,Ut=-1,fe.length=0}function zS(e,s){if(jS(),yt=e,J=ki({},Ul),s){let c;for(c in s)s[c]!=null&&(J[c]=s[c])}if(process.env.NODE_ENV!=="production"&&!J.decodeEntities)throw new Error("[@vue/compiler-core] decodeEntities option is required in browser builds.");ue.mode=J.parseMode==="html"?1:J.parseMode==="sfc"?2:0,ue.inXML=J.ns===1||J.ns===2;const i=s&&s.delimiters;i&&(ue.delimiterOpen=Ri(i[0]),ue.delimiterClose=Ri(i[1]));const a=Ms=ES([],e);return ue.parse(yt),a.loc=Pe(0,e.length),a.children=Hl(a.children),Ms=null,a}function VS(e,s){Ui(e,void 0,s,!!Wl(e))}function Wl(e){const s=e.children.filter(i=>i.type!==3);return s.length===1&&s[0].type===1&&!NS(s[0])?s[0]:null}function Ui(e,s,i,a=!1,c=!1){const{children:u}=e,h=[];for(let x=0;x<u.length;x++){const P=u[x];if(P.type===1&&P.tagType===0){const L=a?0:Et(P,i);if(L>0){if(L>=2){P.codegenNode.patchFlag=-1,h.push(P);continue}}else{const R=P.codegenNode;if(R.type===13){const ae=R.patchFlag;if((ae===void 0||ae===512||ae===1)&&ql(P,i)>=2){const ce=Yl(P);ce&&(R.props=i.hoist(ce))}R.dynamicProps&&(R.dynamicProps=i.hoist(R.dynamicProps))}}}else if(P.type===12&&(a?0:Et(P,i))>=2){P.codegenNode.type===14&&P.codegenNode.arguments.length>0&&P.codegenNode.arguments.push(-1+(process.env.NODE_ENV!=="production"?` /* ${RT[-1]} */`:"")),h.push(P);continue}if(P.type===1){const L=P.tagType===1;L&&i.scopes.vSlot++,Ui(P,e,i,!1,c),L&&i.scopes.vSlot--}else if(P.type===11)Ui(P,e,i,P.children.length===1,!0);else if(P.type===9)for(let L=0;L<P.branches.length;L++)Ui(P.branches[L],e,i,P.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&&Ls(e.codegenNode.children))e.codegenNode.children=y(an(e.codegenNode.children)),f=!0;else if(e.tagType===1&&e.codegenNode&&e.codegenNode.type===13&&e.codegenNode.children&&!Ls(e.codegenNode.children)&&e.codegenNode.children.type===15){const x=T(e.codegenNode,"default");x&&(x.returns=y(an(x.returns)),f=!0)}else if(e.tagType===3&&s&&s.type===1&&s.tagType===1&&s.codegenNode&&s.codegenNode.type===13&&s.codegenNode.children&&!Ls(s.codegenNode.children)&&s.codegenNode.children.type===15){const x=CS(e,"slot",!0),P=x&&x.arg&&T(s.codegenNode,x.arg);P&&(P.returns=y(an(P.returns)),f=!0)}}if(!f)for(const x of h)x.codegenNode=i.cache(x.codegenNode);function y(x){const P=i.cache(x);return P.needArraySpread=!0,P}function T(x,P){if(x.children&&!Ls(x.children)&&x.children.type===15){const L=x.children.properties.find(R=>R.key===P||R.key.content===P);return L&&L.value}}h.length&&i.transformHoist&&i.transformHoist(u,i,e)}function Et(e,s){const{constantCache:i}=s;switch(e.type){case 1:if(e.tagType!==0)return 0;const a=i.get(e);if(a!==void 0)return a;const c=e.codegenNode;if(c.type!==13||c.isBlock&&e.tag!=="svg"&&e.tag!=="foreignObject"&&e.tag!=="math")return 0;if(c.patchFlag===void 0){let h=3;const f=ql(e,s);if(f===0)return i.set(e,0),0;f<h&&(h=f);for(let y=0;y<e.children.length;y++){const T=Et(e.children[y],s);if(T===0)return i.set(e,0),0;T<h&&(h=T)}if(h>1)for(let y=0;y<e.props.length;y++){const T=e.props[y];if(T.type===7&&T.name==="bind"&&T.exp){const x=Et(T.exp,s);if(x===0)return i.set(e,0),0;x<h&&(h=x)}}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(Di),s.removeHelper(cn(s.inSSR,c.isComponent)),c.isBlock=!1,s.helper(on(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(ks(f)||OT(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 GS=new Set([Al,Cl,vl,Nl]);function Kl(e,s){if(e.type===14&&!ks(e.callee)&&GS.has(e.callee)){const i=e.arguments[0];if(i.type===4)return Et(i,s);if(i.type===14)return Kl(i,s)}return 0}function ql(e,s){let i=3;const a=Yl(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=Kl(f,s):T=0,T===0)return T;T<i&&(i=T)}}return i}function Yl(e){const s=e.codegenNode;if(s.type===13)return s.props}function HS(e,{filename:s="",prefixIdentifiers:i=!1,hoistStatic:a=!1,hmr:c=!1,cacheHandlers:u=!1,nodeTransforms:h=[],directiveTransforms:f={},transformHoist:y=null,isBuiltInComponent:T=nn,isCustomElement:x=nn,expressionPlugins:P=[],scopeId:L=null,slotted:R=!0,ssr:ae=!1,inSSR:ce=!1,ssrCssVars:Ce="",bindingMetadata:S=_T,inline:gs=!1,isTS:$e=!1,onError:Ae=Dl,onWarn:_e=Rl,compatConfig:bt}){const Wt=s.replace(/\?.*$/,"").match(/([^/\\]+)\.\w+$/),X={filename:s,selfName:Wt&&DT(kT(Wt[1])),prefixIdentifiers:i,hoistStatic:a,hmr:c,cacheHandlers:u,nodeTransforms:h,directiveTransforms:f,transformHoist:y,isBuiltInComponent:T,isCustomElement:x,expressionPlugins:P,scopeId:L,slotted:R,ssr:ae,inSSR:ce,ssrCssVars:Ce,bindingMetadata:S,inline:gs,isTS:$e,onError:Ae,onWarn:_e,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=X.helpers.get($)||0;return X.helpers.set($,z+1),$},removeHelper($){const z=X.helpers.get($);if(z){const v=z-1;v?X.helpers.set($,v):X.helpers.delete($)}},helperString($){return`_${_l[X.helper($)]}`},replaceNode($){if(process.env.NODE_ENV!=="production"){if(!X.currentNode)throw new Error("Node being replaced is already removed.");if(!X.parent)throw new Error("Cannot replace root node.")}X.parent.children[X.childIndex]=X.currentNode=$},removeNode($){if(process.env.NODE_ENV!=="production"&&!X.parent)throw new Error("Cannot remove root node.");const z=X.parent.children,v=$?z.indexOf($):X.currentNode?X.childIndex:-1;if(process.env.NODE_ENV!=="production"&&v<0)throw new Error("node being removed is not a child of current parent");!$||$===X.currentNode?(X.currentNode=null,X.onNodeRemoved()):X.childIndex>v&&(X.childIndex--,X.onNodeRemoved()),X.parent.children.splice(v,1)},onNodeRemoved:nn,addIdentifiers($){},removeIdentifiers($){},hoist($){ks($)&&($=Bt($)),X.hoists.push($);const z=Bt(`_hoisted_${X.hoists.length}`,!1,$.loc,2);return z.hoisted=$,z},cache($,z=!1,v=!1){const Kt=SS(X.cached.length,$,z,v);return X.cached.push(Kt),Kt}};return X.filters=new Set,X}function ZS(e,s){const i=HS(e,s);mn(e,i),s.hoistStatic&&VS(e,i),s.ssr||WS(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 WS(e,s){const{helper:i}=s,{children:a}=e;if(a.length===1){const c=Wl(e);if(c&&c.codegenNode){const u=c.codegenNode;u.type===13&&bS(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=TS(s,i(ml),void 0,e.children,c,void 0,void 0,!0,void 0,!1)}}function KS(e,s){let i=0;const a=()=>{i--};for(;i<e.children.length;i++){const c=e.children[i];ks(c)||(s.grandParent=s.parent,s.parent=e,s.childIndex=i,s.onNodeRemoved=a,mn(c,s))}}function mn(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&&(Ls(h)?a.push(...h):a.push(h)),s.currentNode)e=s.currentNode;else return}switch(e.type){case 3:s.ssr||s.helper(Pl);break;case 5:s.ssr||s.helper(wl);break;case 9:for(let u=0;u<e.branches.length;u++)mn(e.branches[u],s);break;case 10:case 11:case 1:case 0:KS(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
+ * @vue/compiler-dom v3.5.28
59
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
60
+ * @license MIT
61
+ **/const qS=Symbol(process.env.NODE_ENV!=="production"?"vModelRadio":""),YS=Symbol(process.env.NODE_ENV!=="production"?"vModelCheckbox":""),JS=Symbol(process.env.NODE_ENV!=="production"?"vModelText":""),XS=Symbol(process.env.NODE_ENV!=="production"?"vModelSelect":""),QS=Symbol(process.env.NODE_ENV!=="production"?"vModelDynamic":""),eb=Symbol(process.env.NODE_ENV!=="production"?"vOnModifiersGuard":""),tb=Symbol(process.env.NODE_ENV!=="production"?"vOnKeysGuard":""),sb=Symbol(process.env.NODE_ENV!=="production"?"vShow":""),yn=Symbol(process.env.NODE_ENV!=="production"?"Transition":""),Jl=Symbol(process.env.NODE_ENV!=="production"?"TransitionGroup":"");gS({[qS]:"vModelRadio",[YS]:"vModelCheckbox",[JS]:"vModelText",[XS]:"vModelSelect",[QS]:"vModelDynamic",[eb]:"withModifiers",[tb]:"withKeys",[sb]:"vShow",[yn]:"Transition",[Jl]:"TransitionGroup"});let os;function ib(e,s=!1){return os||(os=document.createElement("div")),s?(os.innerHTML=`<div foo="${e.replace(/"/g,"&quot;")}">`,os.children[0].getAttribute("foo")):(os.innerHTML=e,os.textContent)}const rb={parseMode:"html",isVoidTag:WT,isNativeTag:e=>GT(e)||HT(e)||ZT(e),isPreTag:e=>e==="pre",isIgnoreNewlineTag:e=>e==="pre"||e==="textarea",decodeEntities:ib,isBuiltInComponent:e=>{if(e==="Transition"||e==="transition")return yn;if(e==="TransitionGroup"||e==="transition-group")return Jl},getNamespace(e,s,i){let a=s?s.ns:i;if(s&&a===2)if(s.tag==="annotation-xml"){if(e==="svg")return 1;s.props.some(c=>c.type===6&&c.name==="encoding"&&c.value!=null&&(c.value.content==="text/html"||c.value.content==="application/xhtml+xml"))&&(a=0)}else/^m(?:[ions]|text)$/.test(s.tag)&&e!=="mglyph"&&e!=="malignmark"&&(a=0);else s&&a===1&&(s.tag==="foreignObject"||s.tag==="desc"||s.tag==="title")&&(a=0);if(a===0){if(e==="svg")return 1;if(e==="math")return 2}return a}},nb=e=>{e.type===1&&e.props.forEach((s,i)=>{s.type===6&&s.name==="style"&&s.value&&(e.props[i]={type:7,name:"bind",arg:Bt("style",!0,s.loc),exp:ab(s.value.content,s.loc),modifiers:[],loc:s.loc})})},ab=(e,s)=>{const i=BT(e);return Bt(JSON.stringify(i),!1,s,3)};function ob(e,s){return Ml(e,s,process.env.NODE_ENV!=="production"?cb:void 0)}const cb={54:"v-html is missing expression.",55:"v-html will override element children.",56:"v-text is missing expression.",57:"v-text will override element children.",58:"v-model can only be used on <input>, <textarea> and <select> elements.",59:"v-model argument is not supported on plain elements.",60:"v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.",61:"Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.",62:"v-show is missing expression.",63:"<Transition> expects exactly one child element or component.",64:"Tags with side effect (<script> and <style>) are ignored in client component templates."},lb=(e,s)=>{if(e.type===1&&e.tagType===1&&s.isBuiltInComponent(e.tag)===yn)return()=>{if(!e.children.length)return;Xl(e)&&s.onError(ob(63,{start:e.children[0].loc.start,end:e.children[e.children.length-1].loc.end,source:""}));const a=e.children[0];if(a.type===1)for(const c of a.props)c.type===7&&c.name==="show"&&e.props.push({type:6,name:"persisted",nameLoc:e.loc,value:void 0,loc:e.loc})}};function Xl(e){const s=e.children=e.children.filter(a=>!OS(a)),i=s[0];return s.length!==1||i.type===11||i.type===9&&i.branches.some(Xl)}function ub(e,s){return e==="template"?!0:e in Ql?Ql[e].has(s):s in eu?eu[s].has(e):!(e in tu&&tu[e].has(s)||s in su&&su[s].has(e))}const cs=new Set(["h1","h2","h3","h4","h5","h6"]),zt=new Set([]),Ql={head:new Set(["base","basefront","bgsound","link","meta","title","noscript","noframes","style","script","template"]),optgroup:new Set(["option"]),select:new Set(["optgroup","option","hr"]),table:new Set(["caption","colgroup","tbody","tfoot","thead"]),tr:new Set(["td","th"]),colgroup:new Set(["col"]),tbody:new Set(["tr"]),thead:new Set(["tr"]),tfoot:new Set(["tr"]),script:zt,iframe:zt,option:zt,textarea:zt,style:zt,title:zt},eu={html:zt,body:new Set(["html"]),head:new Set(["html"]),td:new Set(["tr"]),colgroup:new Set(["table"]),caption:new Set(["table"]),tbody:new Set(["table"]),tfoot:new Set(["table"]),col:new Set(["colgroup"]),th:new Set(["tr"]),thead:new Set(["table"]),tr:new Set(["tbody","thead","tfoot"]),dd:new Set(["dl","div"]),dt:new Set(["dl","div"]),figcaption:new Set(["figure"]),summary:new Set(["details"]),area:new Set(["map"])},tu={p:new Set(["address","article","aside","blockquote","center","details","dialog","dir","div","dl","fieldset","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","menu","ol","p","pre","section","table","ul"]),svg:new Set(["b","blockquote","br","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","hr","i","img","li","menu","meta","ol","p","pre","ruby","s","small","span","strong","sub","sup","table","u","ul","var"])},su={a:new Set(["a"]),button:new Set(["button"]),dd:new Set(["dd","dt"]),dt:new Set(["dd","dt"]),form:new Set(["form"]),li:new Set(["li"]),h1:cs,h2:cs,h3:cs,h4:cs,h5:cs,h6:cs},hb=(e,s)=>{if(e.type===1&&e.tagType===0&&s.parent&&s.parent.type===1&&s.parent.tagType===0&&!ub(s.parent.tag,e.tag)){const i=new SyntaxError(`<${e.tag}> cannot be child of <${s.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);i.loc=e.loc,s.onWarn(i)}};[...process.env.NODE_ENV!=="production"?[lb,hb]:[]];function pb(e,s={}){return zS(e,ki({},rb,s))}function db(e){try{const s=NT.parseExpression(e);if(s.type==="StringLiteral")return s.value;if(s.type==="MemberExpression"&&!s.computed&&s.property.type==="Identifier")return s.property.name}catch{return}}function fb(e){for(const s of e.props){if(s.type===Ds.ATTRIBUTE&&s.name==="name")return s.value?.content;if(s.type===Ds.DIRECTIVE&&s.name==="bind"&&s.arg?.type===Ds.SIMPLE_EXPRESSION&&s.arg.content==="name"&&s.exp?.type===Ds.SIMPLE_EXPRESSION)return db(s.exp.content)}}function mb(e){const s=new Set,i=pb(e,{onError:()=>{}});return ZS(i,{nodeTransforms:[a=>{if(a.type===Ds.ELEMENT&&a.tag==="slot"){const c=fb(a);c!==void 0&&s.add(c)}}]}),[...s]}const yb={catalog:Bg,category:Ug,product:Fg};function gn(e){const s={};for(const[i,a]of Object.entries(e))s[i]=i,s[a]=i;return s}const gb={catalog:gn(oc),category:gn(cc),product:gn(lc)};function Eb(e,s,i,a){const c=yb[s];if(c===void 0)return;const u=new Set(a);for(const h of i){const f=gb[s][h]??h,y=c[f];if(y!==void 0&&y.length>0){const T=[];for(const x of y)u.has(x)||T.push(x);T.length>0&&e.at(["design"]).addIssue("MISSING_SLOT_DESIGN_SETTINGS",f,T.join(", "))}}}const Tb=de(["products","category","product"]),Sb=O().superRefine((e,s)=>{_s.safeParse(e).success||be(s).addIssue("INVALID_STORE_SECTION_ID",e,_s.options.join(", "))}).transform(e=>e),bb=A({id:O(),sectionId:Sb,assets:jr.array().optional(),templateContent:O().optional(),content:tn.optional(),design:sn.optional(),translationsSettings:_i.optional(),layouts:rn.array().optional()}).strict().superRefine((e,s)=>{const i=be(s);e.assets&&e.assets.forEach(a=>{a.size>vi&&i.at(["assets",Te.basename(a.path)]).addIssue("REQUIRED_SECTION_ASSET",mt(a.size),mt(vi))})});function xb(e,s){if(s.templateContent===void 0)return;const i=mb(s.templateContent),a=CT(s.design??{});Eb(e,s.sectionId,i,a)}A({id:O(),sectionId:_s,pageId:Tb,content:tn.optional(),design:sn.optional(),layouts:rn.array().optional()}).strict();const Ib=A({id:O(),sectionId:O(),layoutId:O(),server:gc}).strict().superRefine((e,s)=>{const i=be(s);_s.safeParse(e.sectionId).success||i.at(["sectionId"]).addIssue("INVALID_STORE_SECTION_ID",e.sectionId,_s.options.join(", ")),e.server.size>Ni&&i.at("server").addIssue("REQUIRED_SERVER_SIZE",mt(e.server.size),mt(Ni))});function Pb(e,s,i){if(e){if(e.type==="default")e.id!=="header"&&i.at("id").addIssue("REQUIRED_HEADER_ID");else if(e.type==="custom"&&e.id){const a=s.find(c=>c.id===e.id);a?(a.type!=="HEADER"&&i.at("id").addIssue("REQUIRED_CUSTOM_HEADER_TYPE",e.id),e.showcase_id&&((a.showcase||[]).some(c=>c.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):i.at("id").addIssue("REQUIRED_CUSTOM_HEADER",e.id)}}}function wb(e,s,i){if(e){if(e.type==="default")e.id!=="footer"&&i.at("id").addIssue("REQUIRED_FOOTER_ID");else if(e.type==="custom"&&e.id){const a=s.find(c=>c.id===e.id);a?(a.type!=="FOOTER"&&i.at("id").addIssue("REQUIRED_CUSTOM_FOOTER_TYPE",e.id),e.showcase_id&&((a.showcase||[]).some(c=>c.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))):i.at("id").addIssue("REQUIRED_CUSTOM_FOOTER",e.id)}}}function Ab(e,s,i){if(!e)return;const a=i.at(["showcase_overrides"]);["content","design"].forEach(u=>{const h=e[u];if(h){const f=s[u]||{};Object.keys(h).forEach(y=>{if(!(y in f)){const T=u==="content"?"SHOWCASE_OVERRIDE_CONTENT":"SHOWCASE_OVERRIDE_DESIGN";a.at([u,y]).addIssue(T,y)}})}}),e.layoutId&&((s.layout||[]).some(u=>u.layoutId===e.layoutId)||a.at(["layoutId"]).addIssue("SHOWCASE_OVERRIDE_LAYOUT",e.layoutId));const c=s.assets?.map(u=>u.path)??[];e.content&&xc(e.content,c,a.at(["content"]))}function iu(e,s,i,a=!1){if(!e.id)return;const c=s.find(u=>u.id===e.id);if(!c){i.at("id").addIssue("REQUIRED_PAGE_SECTION",e.id);return}!a&&(c.type==="HEADER"||c.type==="FOOTER")&&i.at("id").addIssue("REQUIRED_PAGE_SECTION_TYPE"),Ab(e.showcase_overrides,c,i),e.showcase_id&&((c.showcase||[]).some(u=>u.showcaseId===e.showcase_id)||i.at("showcase_id").addIssue("SHOWCASE_ID_NOT_FOUND",e.showcase_id))}function Cb(e,s,i,a){e.id&&(i.some(c=>c.sectionId===s.type.toLowerCase()&&c.id===e.id)||a.at("id").addIssue("REQUIRED_STORE_LAYOUT",e.id,s.type.toLowerCase()))}const vb=A({version:O(),name:O(),shared:wT.optional(),sections:ne(PT),templates:ne(oT),layouts:ne(bb),slots:ne(Ib),collections:ne(pT),compressionEnabled:te(),externalizationEnabled:te(),vueVersion:O(),openSource:te().optional()}).strict().superRefine((e,s)=>{const i=new Set;e.templates.forEach((a,c)=>{const u=be(s).at(["templates",c]);Pb(a.configuration.header,e.sections,u.at(["configuration","header"])),wb(a.configuration.footer,e.sections,u.at(["configuration","footer"])),a.pages.forEach((h,f)=>{const y=u.at(["pages",f]);h.sections.forEach((T,x)=>{const P=y.at(["sections",x]);T.type==="custom"?iu(T,e.sections,P):T.type==="store"&&(T.id&&i.add(`${h.type.toLowerCase()}:${T.id}`),Cb(T,h,e.layouts,P))})})}),e.layouts.forEach((a,c)=>{i.has(`${a.sectionId}:${a.id}`)&&xb(be(s).at(["layouts",c]),a)}),e.collections.forEach((a,c)=>{a.descriptor.sections.forEach((u,h)=>{const f=be(s).at(["collections",c,"sections",h]);iu(u,e.sections,f,!0)})})});pt({customError:Zg});const _={error:e=>console.log(Tp(e)),warn:e=>console.log(Ep(e)),info:e=>console.log(et(e))},Nb="dist",_b="dist/shared",ot="dist/sections",En="dist/headers",Tn="dist/footers",Tt="dist/templates",ls="layouts",ru="preview",ze=`dist/${ls}`,$s="dist/collections",nu="dist/manifest.json",Ob=[ot,En,Tn,Tt,ze];function ji(e){return!!e}function Vt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const Lb="Resource name can only contain alphanumeric characters, dashes, and underscores";function kb(e){if(typeof e=="string"||typeof e=="number"){const s=/^[a-zA-Z0-9_-]+$/.test(e.toString());if(s)return{isValid:s,errorMessage:null}}return{isValid:!1,errorMessage:Lb}}function Db(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}function Rb(e){return Te.parse(e).name}function Mb(e){return e.split("-").filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}async function zi(){const e=await Ar(G(process.cwd(),"crane.config.json")),s=JSON.parse(e.toString());return{appClientId:s.app_client_id,appSecretKey:btoa(s.app_secret_key)}}function $b(e){return e.includes(`
62
+ `)}function Fb(e,s,i){return e.split(`
63
+ `).map((a,c)=>c>=i?s+a:a).join(`
64
+ `)}function Gt(e,s){const i=[];if(e instanceof Ya){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=$b(u.errorMessage)?Fb(u.errorMessage," ",1):u.errorMessage;i.push(` Error Message: ${h}`)}}const a=i.length>0?i.join(`
65
+ `):e?.message??"Unknown error";if(!s||s.length===0)return a;const c=i.length>0?`
66
+ `:" ";return`${s}${c}${a}`}function Sn(e,s){return Object.keys(e).reduce((i,a)=>{const c=e[a],u=s[a];return Vt(c)&&Vt(u)?i[a]=Sn(c,u):i[a]=c,i},{...s})}function Bb({contentSettings:e,sectionType:s}){const i=al(s);return Sn(e,i)}function Ub({designSettings:e,sectionType:s}){const i=ol(s);return Sn(e,i)}async function qe(e){return(await import(qa(e).href+`?t=${Date.now()}`)).default}function bn(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function it(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const s=Ap(e);return{type:"STRUCTURED_COLOR",raw:e,hex:s.toHex8String(),hsl:s.toHsl(),rgba:s.toRgb(),auto:!1}}function au(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}function jb(e){if(e!==void 0)return{...e,color:it(e.color)}}function Ht(e){return Object.fromEntries(Object.entries(e).filter(([s,i])=>i!==void 0))}function zb(e){if(e!==void 0)switch(e){case Ur.COLOR:return"solid";case Ur.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Ur)}`)}}function Vb({style:e,color:s}){const i=Array.isArray(s)?s:[s,s];return{background:{type:zb(e),solid:{color:it(i.at(0))},gradient:{fromColor:it(i.at(0)),toColor:it(i.at(1))}}}}function Gb(e){if(e!==void 0)switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(Ag)}`)}}function Hb(e){if(e!==void 0)switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(vg)}`)}}function Zb(e){if(e!==void 0)switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(_g)}`)}}function Wb(e){return e===di.GO_TO_STORE?di.GO_TO_STORE_LINK:e===di.GO_TO_CATEGORY?di.GO_TO_CATEGORY_LINK:e}function Kb(e){const s=Gb(e.appearance),i=Hb(e.size),a=Zb(e.shape),c=bn(e.font),u=it(e.color),h=e.visible;return Ht({appearance:s,size:i,style:a,font:c,color:u,visible:h})}function qb(e){return{...e,buttonType:Wb(e.buttonType)}}function Yb(e){const s=it(e.color);return Ht({color:s})}function Jb(e){if(e!==void 0)switch(e){case fi.COLOR:return"solid";case fi.GRADIENT:return"gradient";case fi.NONE:return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(fi)}`)}}function Xb(e){const s=e.color,i=Array.isArray(s)?s:[s,s],a=e.visible,c={type:Jb(e.overlay),solid:{color:it(i.at(0))},gradient:{fromColor:it(i.at(0)),toColor:it(i.at(1))}};return Ht({overlay:c,visible:a})}function Qb(e){const s=bn(e.font),i=it(e.color),a=au(e.size),c=e.bold,u=e.italic,h=e.spacing,f=e.capitalization,y=e.visible;return Ht({font:s,color:i,size:a,frame:jb(e.frame),bold:c,italic:u,spacing:h,capitalization:f,visible:y})}function ex(e){const s=e.value;return Ht({value:s})}function tx(e){const s=bn(e.font),i=it(e.color),a=au(e.size),c=e.bold,u=e.italic,h=e.visible;return Ht({font:s,color:i,size:a,bold:c,italic:u,visible:h})}function sx(e){const s=e.enabled;return Ht({enabled:s})}function ix(e){return e===ti.GO_TO_STORE_LINK?ti.GO_TO_STORE:e===ti.GO_TO_CATEGORY_LINK?ti.GO_TO_CATEGORY:e}function ou(e){return e.map(s=>s.type?{...s,type:ix(s.type)}:s)}function rx(e){return e.items?{...e,items:ou(e.items)}:e}function nx(e){return e.items?{...e,items:ou(e.items)}:e}function ax(e){if(!e.cards)return e;const s=e.cards.map(i=>{if(!i.settings)return i;const a={};return Object.keys(i.settings).forEach(c=>{const u=i.settings[c],h=u.type,f=Vi(h,{defaults:u});f&&u?a[c]={...u,...f}:a[c]=u}),{...i,settings:a}});return{...e,cards:s}}function xn(e,s){if(s.defaults===void 0)return;let i={};switch(e){case He.TEXT:{i=tx(s.defaults);break}case He.BUTTON:{i=Kb(s.defaults);break}case He.IMAGE:{i=Xb(s.defaults);break}case He.BACKGROUND:{i=Vb(s.defaults);break}case He.COLOR_PICKER:{i=Yb(s.defaults);break}case He.LOGO:{i=Qb(s.defaults);break}case He.SELECTBOX:{i=ex(s.defaults);break}case He.TOGGLE:{i=sx(s.defaults);break}case He.DIVIDER:case He.INFO:break;case He.ACCORDION:return s.defaults;default:throw new Error(`Unknown design editor type: ${e}`)}return i}function cu(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===He.ACCORDION){const h=Object.fromEntries(Object.entries(a.items).map(([f,y])=>[f,{...y,editors:cu(y.editors)}]));s[i]={...a,items:h};return}const u=xn(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}),s}function ox(e){return e===void 0?e:e.map(s=>{if(s.type!==void 0&&s.defaults!==void 0&&s.fieldName!==void 0){const i={...xn(s.type,s)??s.defaults,type:s.defaults.type??s.type};return{type:s.type,fieldName:s.fieldName,defaults:i}}return s})}function In(e){if(e===void 0)return;const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===He.ACCORDION){const h=Object.fromEntries(Object.entries(a.items).map(([f,y])=>[f,{...y,editors:In(y.editors)??y.editors}]));s[i]={type:a.type,items:h};return}const u=xn(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function Vi(e,s){if(s.defaults!==void 0)switch(e){case F.BUTTON:return qb(s.defaults);case F.MENU:return rx(s.defaults);case F.NAVIGATION_MENU:return nx(s.defaults);case F.DECK:return ax(s.defaults);case F.CATEGORY_SELECTOR:case F.DIVIDER:case F.IMAGE:case F.INPUTBOX:case F.INFO:case F.LOGO:case F.PRODUCT_SELECTOR:case F.SELECTBOX:case F.TEXTAREA:case F.TOGGLE:return{...s.defaults};default:throw new Error(`Unknown content editor type: ${e}`)}}function cx(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=lu(a);else{const u=Vi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function lu(e){const s=e.cards.defaultCardContent.settings,i=cx(s);return{...e,cards:{...e.cards,defaultCardContent:{...e.cards.defaultCardContent,settings:i}}}}function lx(e){const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type;if(c===F.DECK)s[i]=lu(a);else{const u=Vi(c,a);u&&a.defaults?s[i]={...a,defaults:u}:s[i]=a}}),s}function ux(e){if(e===void 0)return;const s={};return Object.keys(e).forEach(i=>{const a=e[i],c=a.type,u=Vi(c,{defaults:a});u!==void 0?s[i]={...a,...u,type:a.type}:s[i]=a}),s}function hx(e,s){if(!s)return;const i=e[s];return i===void 0?{en:s}:i}function px(e){const s={};for(const i in e){const a=e[i];for(const c in a){const u=s[c],h=a[c];if(u===void 0){const f={};f[i]=h,s[c]=f}else u[i]=h}}return s}function dx(e){return e.every(s=>s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean")}function us(e,s){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return dx(e)?e:e.map(c=>us(c,s));const i=e,a={};for(const c in i){const u=i[c];typeof u=="string"&&u.startsWith("$")?a[c]=hx(s,u):typeof u=="object"&&u!==null?a[c]=us(u,s):a[c]=u}return a}async function Fs(e){return e?px(e):{}}async function fx(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/settings/translations.mjs`);return await qe(i)}async function Gi(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/showcases/translations.mjs`);return await qe(i)}async function mx(e,s){const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/translations.mjs`);if(De(i))return await qe(i)}async function Pn(e,s,i){const a=i?Bb({contentSettings:e,sectionType:i}):e,c=lx(a);return us(c,s)}async function yx(e,s=ot){try{const i=G(xe.cwd(),`${s}/${e}/js/settings/content.mjs`),a=await qe(i);return ns(a)}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function wn(e,s,i){const a=i?Ub({designSettings:e,sectionType:i}):e,c=cu(a);return us(c,s)}async function gx(e,s=ot){try{const i=G(xe.cwd(),`${s}/${e}/js/settings/design.mjs`),a=await qe(i);return ns(a)}catch(i){const a=i;throw new Error(`Design settings is invalid or undefined. Error ${a.stack}`)}}async function Ex(e,s){return Promise.all(e.map(async i=>{const a=i.content?ux(i.content):void 0,c=i.design?In(i.design):void 0,u={...i,content:a??i.content,design:c??i.design};return us(u,s)}))}async function Tx(e,s=ot){try{const i=await W("*.mjs",{cwd:G(xe.cwd(),`${s}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(i.map(async a=>{const c=G(xe.cwd(),`${s}/${e}/js/showcases/${a}`);return await qe(c)}))}catch(i){throw new Error(`Showcases is invalid or undefined. Error ${i}`)}}async function uu(e){return e?.map(s=>({...s,selectedDesignSettings:ox(s.selectedDesignSettings)??s.selectedDesignSettings}))??[]}async function Sx(e,s=ot){try{const i=G(xe.cwd(),`${s}/${e}/js/settings/layout.mjs`);return De(i)?await qe(i):[]}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}function bx(e){let s={};const i=G(xe.cwd(),`${ru}/shared/analytics.json`);if(!De(i))return 0;try{const a=xr(i,"utf-8");s=JSON.parse(a)}catch(a){console.warn("Error processing analytics.json file",a)}return s[e]||0}const hs={Server:0,Client:1,SectionAsset:4,PageTemplateDescriptor:6,TemplateAsset:7,SharedTranslation:13},An="https://blockbuster.ecwid.com",xx="/api/v1/custom-apps/resources/sections/upload",Ix="/api/v1/custom-apps/resources/templates/upload",Px="/api/v1/custom-apps/manifests/sections",wx="/api/v1/custom-apps/manifests/templates",Ax=5,Cx=3,vx=[se.Server,se.Client,se.ClientChunks,se.ClientAsset,se.Asset],Nx=[se.LayoutClient,se.LayoutAsset],_x=[se.SlotServer,se.SlotClient,se.SlotClientChunks,se.SlotClientAsset],Ox=[se.Dependency,se.TemplateAsset,se.SourceCode,se.CollectionAsset],ps={DEFAULT:"Error while deploying:",ASSET_FILES_UPLOAD:"Error while uploading asset files:",MANIFEST_DEPLOYMENT:"Error while deploying manifest file:",DEPRECATED_VERSION_DEPLOYMENT:"You are using a non-supported version of crane. Please update to the latest crane version to continue.",INCORRECT_DISTRIBUTION_FOLDER:e=>`Distribution folder [${e}] is not found or has incorrect structure, please execute the build command first.`},hu={catalog:"products",category:"category",product:"product"},pu=e=>hu[e],du=e=>e in hu;function Lx(e){return e.replace(/\\/g,"/")}function kx(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function Hi(e){return kx(Lx(e))}function Dx(e){const s=Hi(e).split("/");if(s.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[i,a]=s;if(!du(i))throw new Error(`Layout cannot be placed in a non-storefront section: ${i}`);const c=pu(i);return{id:a,sectionId:i,pageId:c}}async function Rx(e){return Promise.all(e.map(async s=>{const i=s.sectionId,a=pu(i),c=await Fs(s.translationsSettings),u=await Pn(s.content??{},c),h=await wn(s.design??{},c),f=await uu(s.layouts);return{id:s.id,sectionId:i,pageId:a,contentEditors:u,designEditors:h,layouts:f}}))}function ds(e,s,...i){if(!e||!s)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${s}"`);return`${ze}/${e}/${s}/${i.join("/")}`}const Bs=(e=ft.SECTION)=>we[e].dist,Us={[se.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/server/`},[se.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/client/`},[se.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/client/chunks/`,fileName:"*"},[se.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/js/main/client/assets/`},[se.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:s})=>`${Bs(s)}/${e}/assets/`},[se.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${Tt}/assets/`},[se.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[se.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[se.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:s})=>ds(e,s,"")},[se.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s})=>ds(e,s,"assets/")},[se.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/server/")},[se.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/client/")},[se.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/client/chunks/")},[se.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:s,slotId:i})=>ds(e,s,"slots",i,"js/main/client/assets/")},[se.CollectionAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${$s}/assets/`}};function Mx(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Cn(){const e=G(ei.cwd(),"package.json"),s=await Ar(e),i=JSON.parse(s.toString());if(Mx(i))return i;throw new Error(`Package file located at path: ${e} does not contain a version field`)}const $x={layout:e=>e.layoutId,showcase:e=>e.showcaseId,templates:e=>{const s=e.id;return s?.includes("_")?s.substring(s.indexOf("_")+1):s}};function Fx(e,s){const i=$x[e];return i?i(s):s.id}const Bx=new Set(["content","design"]);function Zi(e,s,i=0,a=[]){if(i>=s.length)return a;const c=s[i],u=s[i+1];if(typeof c=="string"&&typeof u=="number"&&Vt(e)){const h=e[c],f=Array.isArray(h)?h[u]:void 0;if(Vt(f)){const y=Fx(c,f);return a.push(`${c}[${y||u}]`),Zi(f,s,i+2,a)}}if(typeof c=="string"&&typeof u=="string"&&Bx.has(c)){a.push(`${c}[${u}]`);const h=Vt(e)&&!Array.isArray(e)?e[c]:void 0,f=Vt(h)&&!Array.isArray(h)?h[u]:void 0;return Zi(f,s,i+2,a)}return a.push(c),Zi(Vt(e)?e[c]:void 0,s,i+1,a)}function Ux(e){const s=e.errors.map(a=>Zi(e.manifest,a.path).join(".")),i={path:Math.max(...s.map(a=>a.length),0),message:Math.max(...e.errors.map(a=>a.message.length),0)};e.errors.map((a,c)=>{const u=a.params?.errorMessageKey||"GENERAL_ISSUE";return`${s[c].padEnd(i.path," ")} | ${a.message.padEnd(i.message," ")} | ${u}`}).forEach(a=>_.error(a))}async function jx(e){const s=vb.safeParse(e);return{manifest:e,errors:s.success?[]:s.error.issues}}const zx=`Build successful:
45
67
  For preview run: npx @lightspeed/crane@latest preview
46
- For deploy run: npx @lightspeed/crane@latest deploy`;function em(e,t){if(e.errors.length===0){f.info(qh);return}f.error("Invalid configuration detected:"),Xh(e),t||process.exit(1)}const Gs={"process.env":{NODE_ENV:"production"}},tm=[...So,...So.map(e=>`node:${e}`)],nm=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],xs=e=>({pluginType:ee.Server,define:Gs,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...tm,...nm],inlineDynamicImports:!0,...e,outDir:e.outDir}),Bs=e=>({pluginType:ee.Client,define:Gs,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),Ke=e=>({pluginType:ee.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),om=e=>({pluginType:ee.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),qt=e=>({pluginType:ee.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir});let en=!1;function rm(e){en=e}function eo(){return en}const Zs=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],sm=80,im="\x1B[?25l",am="\x1B[?25h",cm="\x1B[2K\r",um=44;let lm=class{frameIndex=0;timer=null;realWrite=null;buffer=[];start(){en||(this.frameIndex=0,this.buffer=[],this.realWrite=process.stdout.write.bind(process.stdout),process.stdout.write=((t,n,o)=>(this.buffer.push(typeof t=="string"?t:String(t)),typeof n=="function"&&(o=n),o&&o(),!0)),this.realWrite(im),this.render(),this.timer=setInterval(()=>this.render(),sm))}render(){if(!this.realWrite)return;const t=" Build is in progress...".padEnd(um-1," "),n=ce(Zs[this.frameIndex]+t);this.realWrite(`\r${n}`),this.frameIndex=(this.frameIndex+1)%Zs.length}stop(){if(!en&&(this.timer&&(clearInterval(this.timer),this.timer=null),this.realWrite)){process.stdout.write=this.realWrite,this.realWrite(`${cm}${am}`);for(const t of this.buffer)this.realWrite(t);this.buffer=[],this.realWrite=null}}};const Hs=new lm,dm=()=>zi({ext:".gz",algorithm:"gzip",verbose:eo()}),pm="/* EXTERNAL_IMPORTS_START */",fm="/* EXTERNAL_IMPORTS_END */",hm=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const n of Object.keys(t)){const o=t[n];if(o.type==="chunk"){const r=/import.*\?commonjs-external["'];/g,s=o.code.match(r);if(s!==null){const i=s.join(""),a=pm+i+fm,c=o.code.replace(r,"");o.code=a+c}}}}}),mm=()=>({name:"disable-json-plugin",enforce:"pre",apply:"build",configResolved(e){const t=e.plugins?.findIndex(n=>n?.name==="vite:json");t!==-1&&(e.plugins[t]={name:"vite:json",load:()=>null,transform:()=>null})}}),Em=()=>{const e=process.env.npm_lifecycle_event;return Mi({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"`}})},pe={vue:()=>ji(),tsconfigPaths:()=>Ui(),checker:()=>Em()};class an{constructor(t){this.bits=t instanceof an?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class dt{constructor(t,n,o){this.start=t,this.end=n,this.original=o,this.intro="",this.outro="",this.content=o,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(t){this.outro+=t}appendRight(t){this.intro=this.intro+t}clone(){const t=new dt(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(t){return this.start<t&&t<this.end}eachNext(t){let n=this;for(;n;)t(n),n=n.next}eachPrevious(t){let n=this;for(;n;)t(n),n=n.previous}edit(t,n,o){return this.content=t,o||(this.intro="",this.outro=""),this.storeName=n,this.edited=!0,this}prependLeft(t){this.outro=t+this.outro}prependRight(t){this.intro=t+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(t){const n=t-this.start,o=this.original.slice(0,n),r=this.original.slice(n);this.original=o;const s=new dt(t,this.end,r);return s.outro=this.outro,this.outro="",this.end=t,this.edited?(s.edit("",!1),this.content=""):this.content=o,s.next=this.next,s.next&&(s.next.previous=s),s.previous=this,this.next=s,s}toString(){return this.intro+this.content+this.outro}trimEnd(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return!0;const n=this.content.replace(t,"");if(n.length)return n!==this.content&&(this.split(this.start+n.length).edit("",void 0,!0),this.edited&&this.edit(n,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(t,""),this.intro.length)return!0}trimStart(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return!0;const n=this.content.replace(t,"");if(n.length){if(n!==this.content){const o=this.split(this.end-n.length);this.edited&&o.edit(n,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(t,""),this.outro.length)return!0}}function gm(){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 _m=gm();class ym{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=Fi(t.mappings),typeof t.x_google_ignoreList<"u"&&(this.x_google_ignoreList=t.x_google_ignoreList)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+_m(this.toString())}}function Sm(e){const t=e.split(`
47
- `),n=t.filter(s=>/^\t+/.test(s)),o=t.filter(s=>/^ {2,}/.test(s));if(n.length===0&&o.length===0)return null;if(n.length>=o.length)return" ";const r=o.reduce((s,i)=>{const a=/^ +/.exec(i)[0].length;return Math.min(a,s)},1/0);return new Array(r+1).join(" ")}function Tm(e,t){const n=e.split(/[/\\]/),o=t.split(/[/\\]/);for(n.pop();n[0]===o[0];)n.shift(),o.shift();if(n.length){let r=n.length;for(;r--;)n[r]=".."}return n.concat(o).join("/")}const Om=Object.prototype.toString;function Im(e){return Om.call(e)==="[object Object]"}function Vs(e){const t=e.split(`
48
- `),n=[];for(let o=0,r=0;o<t.length;o++)n.push(r),r+=t[o].length+1;return function(r){let s=0,i=n.length;for(;s<i;){const u=s+i>>1;r<n[u]?i=u:s=u+1}const a=s-1,c=r-n[a];return{line:a,column:c}}}const wm=/\w/;class vm{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(t,n,o,r){if(n.length){const s=n.length-1;let i=n.indexOf(`
49
- `,0),a=-1;for(;i>=0&&s>i;){const u=[this.generatedCodeColumn,t,o.line,o.column];r>=0&&u.push(r),this.rawSegments.push(u),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=i,i=n.indexOf(`
50
- `,i+1)}const c=[this.generatedCodeColumn,t,o.line,o.column];r>=0&&c.push(r),this.rawSegments.push(c),this.advance(n.slice(a+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(n));this.pending=null}addUneditedChunk(t,n,o,r,s){let i=n.start,a=!0,c=!1;for(;i<n.end;){if(this.hires||a||s.has(i)){const u=[this.generatedCodeColumn,t,r.line,r.column];this.hires==="boundary"?wm.test(o[i])?c||(this.rawSegments.push(u),c=!0):(this.rawSegments.push(u),c=!1):this.rawSegments.push(u)}o[i]===`
51
- `?(r.line+=1,r.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=!0):(r.column+=1,this.generatedCodeColumn+=1,a=!1),i+=1}this.pending=null}advance(t){if(!t)return;const n=t.split(`
52
- `);if(n.length>1){for(let o=0;o<n.length-1;o++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=n[n.length-1].length}}const lt=`
53
- `,Je={insertLeft:!1,insertRight:!1,storeName:!1};class lo{constructor(t,n={}){const o=new dt(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:o},lastChunk:{writable:!0,value:o},lastSearchedChunk:{writable:!0,value:o},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:n.filename},indentExclusionRanges:{writable:!0,value:n.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new an},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:n.ignoreList}}),this.byStart[0]=o,this.byEnd[t.length]=o}addSourcemapLocation(t){this.sourcemapLocations.add(t)}append(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.outro+=t,this}appendLeft(t,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byEnd[t];return o?o.appendLeft(n):this.intro+=n,this}appendRight(t,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byStart[t];return o?o.appendRight(n):this.outro+=n,this}clone(){const t=new lo(this.original,{filename:this.filename});let n=this.firstChunk,o=t.firstChunk=t.lastSearchedChunk=n.clone();for(;n;){t.byStart[o.start]=o,t.byEnd[o.end]=o;const r=n.next,s=r&&r.clone();s&&(o.next=s,s.previous=o,o=s),n=r}return t.lastChunk=o,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new an(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(t){t=t||{};const n=0,o=Object.keys(this.storedNames),r=new vm(t.hires),s=Vs(this.original);return this.intro&&r.advance(this.intro),this.firstChunk.eachNext(i=>{const a=s(i.start);i.intro.length&&r.advance(i.intro),i.edited?r.addEdit(n,i.content,a,i.storeName?o.indexOf(i.original):-1):r.addUneditedChunk(n,i,this.original,a,this.sourcemapLocations),i.outro.length&&r.advance(i.outro)}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?Tm(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:o,mappings:r.raw,x_google_ignoreList:this.ignoreList?[n]:void 0}}generateMap(t){return new ym(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=Sm(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,n){const o=/^[^\r\n]/gm;if(Im(t)&&(n=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;n=n||{};const r={};n.exclude&&(typeof n.exclude[0]=="number"?[n.exclude]:n.exclude).forEach(d=>{for(let m=d[0];m<d[1];m+=1)r[m]=!0});let s=n.indentStart!==!1;const i=u=>s?`${t}${u}`:(s=!0,u);this.intro=this.intro.replace(o,i);let a=0,c=this.firstChunk;for(;c;){const u=c.end;if(c.edited)r[a]||(c.content=c.content.replace(o,i),c.content.length&&(s=c.content[c.content.length-1]===`
54
- `));else for(a=c.start;a<u;){if(!r[a]){const d=this.original[a];d===`
55
- `?s=!0:d!=="\r"&&s&&(s=!1,a===c.start||(this._splitChunk(c,a),c=c.next),c.prependRight(t))}a+=1}a=c.end,c=c.next}return this.outro=this.outro.replace(o,i),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,n){return Je.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Je.insertLeft=!0),this.appendLeft(t,n)}insertRight(t,n){return Je.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Je.insertRight=!0),this.prependRight(t,n)}move(t,n,o){if(o>=t&&o<=n)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(n),this._split(o);const r=this.byStart[t],s=this.byEnd[n],i=r.previous,a=s.next,c=this.byStart[o];if(!c&&s===this.lastChunk)return this;const u=c?c.previous:this.lastChunk;return i&&(i.next=a),a&&(a.previous=i),u&&(u.next=r),c&&(c.previous=s),r.previous||(this.firstChunk=s.next),s.next||(this.lastChunk=r.previous,this.lastChunk.next=null),r.previous=u,s.next=c||null,u||(this.firstChunk=r),c||(this.lastChunk=s),this}overwrite(t,n,o,r){return r=r||{},this.update(t,n,o,{...r,overwrite:!r.contentOnly})}update(t,n,o,r){if(typeof o!="string")throw new TypeError("replacement content must be a string");for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;if(n>this.original.length)throw new Error("end is out of bounds");if(t===n)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(t),this._split(n),r===!0&&(Je.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Je.storeName=!0),r={storeName:!0});const s=r!==void 0?r.storeName:!1,i=r!==void 0?r.overwrite:!1;if(s){const u=this.original.slice(t,n);Object.defineProperty(this.storedNames,u,{writable:!0,value:!0,enumerable:!0})}const a=this.byStart[t],c=this.byEnd[n];if(a){let u=a;for(;u!==c;){if(u.next!==this.byStart[u.end])throw new Error("Cannot overwrite across a split point");u=u.next,u.edit("",!1)}a.edit(o,s,!i)}else{const u=new dt(t,n,"").edit(o,s);c.next=u,u.previous=c}return this}prepend(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this}prependLeft(t,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byEnd[t];return o?o.prependLeft(n):this.intro=n+this.intro,this}prependRight(t,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byStart[t];return o?o.prependRight(n):this.outro=n+this.outro,this}remove(t,n){for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;if(t===n)return this;if(t<0||n>this.original.length)throw new Error("Character is out of bounds");if(t>n)throw new Error("end must be greater than start");this._split(t),this._split(n);let o=this.byStart[t];for(;o;)o.intro="",o.outro="",o.edit(""),o=n>o.end?this.byStart[o.end]:null;return this}reset(t,n){for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;if(t===n)return this;if(t<0||n>this.original.length)throw new Error("Character is out of bounds");if(t>n)throw new Error("end must be greater than start");this._split(t),this._split(n);let o=this.byStart[t];for(;o;)o.reset(),o=n>o.end?this.byStart[o.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let t=this.outro.lastIndexOf(lt);if(t!==-1)return this.outro.substr(t+1);let n=this.outro,o=this.lastChunk;do{if(o.outro.length>0){if(t=o.outro.lastIndexOf(lt),t!==-1)return o.outro.substr(t+1)+n;n=o.outro+n}if(o.content.length>0){if(t=o.content.lastIndexOf(lt),t!==-1)return o.content.substr(t+1)+n;n=o.content+n}if(o.intro.length>0){if(t=o.intro.lastIndexOf(lt),t!==-1)return o.intro.substr(t+1)+n;n=o.intro+n}}while(o=o.previous);return t=this.intro.lastIndexOf(lt),t!==-1?this.intro.substr(t+1)+n:this.intro+n}slice(t=0,n=this.original.length){for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;let o="",r=this.firstChunk;for(;r&&(r.start>t||r.end<=t);){if(r.start<n&&r.end>=n)return o;r=r.next}if(r&&r.edited&&r.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const s=r;for(;r;){r.intro&&(s!==r||r.start===t)&&(o+=r.intro);const i=r.start<n&&r.end>=n;if(i&&r.edited&&r.end!==n)throw new Error(`Cannot use replaced character ${n} as slice end anchor.`);const a=s===r?t-r.start:0,c=i?r.content.length+n-r.end:r.content.length;if(o+=r.content.slice(a,c),r.outro&&(!i||r.end===n)&&(o+=r.outro),i)break;r=r.next}return o}snip(t,n){const o=this.clone();return o.remove(0,t),o.remove(n,o.original.length),o}_split(t){if(this.byStart[t]||this.byEnd[t])return;let n=this.lastSearchedChunk;const o=t>n.end;for(;n;){if(n.contains(t))return this._splitChunk(n,t);n=o?this.byStart[n.end]:this.byEnd[n.start]}}_splitChunk(t,n){if(t.edited&&t.content.length){const r=Vs(this.original)(n);throw new Error(`Cannot split a chunk that has already been edited (${r.line}:${r.column} \u2013 "${t.original}")`)}const o=t.split(n);return this.byEnd[n]=t,this.byStart[n]=o,this.byEnd[o.end]=o,t===this.lastChunk&&(this.lastChunk=o),this.lastSearchedChunk=t,!0}toString(){let t=this.intro,n=this.firstChunk;for(;n;)t+=n.toString(),n=n.next;return t+this.outro}isEmpty(){let t=this.firstChunk;do if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return!1;while(t=t.next);return!0}length(){let t=this.firstChunk,n=0;do n+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return n}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const n=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(n,""),this.outro.length)return!0;let o=this.lastChunk;do{const r=o.end,s=o.trimEnd(n);if(o.end!==r&&(this.lastChunk===o&&(this.lastChunk=o.next),this.byEnd[o.end]=o,this.byStart[o.next.start]=o.next,this.byEnd[o.next.end]=o.next),s)return!0;o=o.previous}while(o);return!1}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){const n=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(n,""),this.intro.length)return!0;let o=this.firstChunk;do{const r=o.end,s=o.trimStart(n);if(o.end!==r&&(o===this.lastChunk&&(this.lastChunk=o.next),this.byEnd[o.end]=o,this.byStart[o.next.start]=o.next,this.byEnd[o.next.end]=o.next),s)return!0;o=o.next}while(o);return!1}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,n){function o(s,i){return typeof n=="string"?n.replace(/\$(\$|&|\d+)/g,(a,c)=>c==="$"?"$":c==="&"?s[0]:+c<s.length?s[+c]:`$${c}`):n(...s,s.index,i,s.groups)}function r(s,i){let a;const c=[];for(;a=s.exec(i);)c.push(a);return c}if(t.global)r(t,this.original).forEach(i=>{if(i.index!=null){const a=o(i,this.original);a!==i[0]&&this.overwrite(i.index,i.index+i[0].length,a)}});else{const s=this.original.match(t);if(s&&s.index!=null){const i=o(s,this.original);i!==s[0]&&this.overwrite(s.index,s.index+s[0].length,i)}}return this}_replaceString(t,n){const{original:o}=this,r=o.indexOf(t);return r!==-1&&this.overwrite(r,r+t.length,n),this}replace(t,n){return typeof t=="string"?this._replaceString(t,n):this._replaceRegexp(t,n)}_replaceAllString(t,n){const{original:o}=this,r=t.length;for(let s=o.indexOf(t);s!==-1;s=o.indexOf(t,s+r))o.slice(s,s+r)!==n&&this.overwrite(s,s+r,n);return this}replaceAll(t,n){if(typeof t=="string")return this._replaceAllString(t,n);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,n)}}const Ws=T(process.cwd(),"shared/translation.ts"),Ys="globalThis.craneSharedTranslation = translation",Cm=e=>`import translation from '${e}';
56
- ${Ys};
57
- `,Rm=(e,t)=>{const n=e.split("?")[0],o=vi(n);return(o==="server.ts"||o==="client.ts")&&!t.includes(Ys)},Ks=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=V(Ws)},transform(t,n){if(!e||!Rm(n,t))return null;const o=n.split("?")[0],r=fo(o),s=Ni(ho(r,Ws)),i=Cm(s),a=new lo(t);return a.prepend(i),{code:a.toString()}}}},Js={[ee.Server]:()=>[pe.vue(),pe.tsconfigPaths(),hm(),dm(),Ks()],[ee.Client]:()=>[pe.vue(),pe.tsconfigPaths(),To({vue:"EcVue"}),Ks()],[ee.Misc]:()=>[pe.tsconfigPaths()],[ee.Layout]:()=>[pe.vue(),pe.tsconfigPaths(),To({vue:["EcExternals","Vue"]})],[ee.Asset]:()=>[mm()],[ee.SharedFiles]:()=>[pe.tsconfigPaths()]},Xs={[N.Server]:xs({outDir:({name:e,sectionType:t})=>`./${G[t].dist}/${e}/js/main/server`}),[N.Client]:Bs({outDir:({name:e,sectionType:t})=>`./${G[t].dist}/${e}/js/main/client`}),[N.SectionSetting]:Ke({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${G[t].dist}/${e}/js/settings`}),[N.SectionShowcase]:Ke({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${G[t].dist}/${e}/js/showcases`}),[N.SectionAsset]:qt({outDir:({name:e,sectionType:t})=>`./${G[t].dist}/${e}/assets`}),[N.TemplateDescriptor]:Ke({entryFileNames:"[name].mjs",outDir:()=>`./${Oe}/js`}),[N.PageTemplateDescriptor]:Ke({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${Oe}/${e}`}),[N.TemplateAsset]:qt({outDir:()=>`./${Oe}/assets`}),[N.Layout]:om({outDir:({name:e,sectionId:t})=>`./${Q}/${t}/${e}`}),[N.LayoutSettings]:Ke({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:t})=>`./${Q}/${t}/${e}/js/settings`}),[N.LayoutAsset]:qt({outDir:({name:e,sectionId:t})=>`./${Q}/${t}/${e}/assets`}),[N.SlotServer]:xs({outDir:({name:e,layoutId:t,sectionId:n})=>`./${Q}/${n}/${t}/slots/${e}/js/main/server`}),[N.SlotClient]:Bs({outDir:({name:e,layoutId:t,sectionId:n})=>`./${Q}/${n}/${t}/slots/${e}/js/main/client`}),[N.CollectionDescriptor]:Ke({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${it}/${e}`}),[N.CollectionAsset]:qt({outDir:()=>`./${it}/assets`}),[N.SharedTranslation]:{pluginType:ee.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function bm(e){switch(typeof e){case"string":return[T(process.cwd(),e)];case"object":return e.map(t=>T(process.cwd(),t));default:return[]}}function Qs({name:e,entryPoints:t,configType:n,layoutId:o,sectionId:r,sectionType:s=Se.SECTION}){const i=Xs[n],a=i.define,c=i.ssrOptions,u=i.entryFileNames,d=i.chunkFileNames,m=i.assetFileNames,S=i.inlineDynamicImports,O=i.externalOption;return{logLevel:eo()?void 0:"silent",plugins:Js[i.pluginType](),ssr:c,define:a,resolve:{alias:{"@":"/src"}},build:{ssr:i.ssr,outDir:i.outDir({name:e,sectionType:s,layoutId:o,sectionId:r}),emptyOutDir:!0,minify:i.ssr?"terser":"esbuild",...i.ssr&&{terserOptions:{mangle:{reserved:["gc"]}}},rollupOptions:{external:O,preserveEntrySignatures:"strict",input:bm(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:S,entryFileNames:u,chunkFileNames:d,assetFileNames:m}}},assetsInclude:["**/*.json"]}}const Am=Object.values(G).map(e=>e.source).join("|");function qs(e,t,n){if(!e)return`${t}.mjs`;const o=ho(process.cwd(),e).replace(/\\/g,"/").match(`^(${Am})/([^/]+)/${n}/([^/.]+)`);return o?`${o[1]}/${o[2]}/js/${n}/${o[3]}.mjs`:`${t}.mjs`}function ei(e,t){const n=Xs[N.SectionSetting];return{logLevel:eo()?void 0:"silent",plugins:Js[n.pluginType](),define:n.define,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:n.ssr,outDir:"./dist",emptyOutDir:!1,minify:"esbuild",rollupOptions:{external:n.externalOption,preserveEntrySignatures:"strict",input:e.map(o=>T(process.cwd(),o)),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:n.inlineDynamicImports,entryFileNames:t,chunkFileNames:"chunks/[name]-[hash].js",assetFileNames:n.assetFileNames}}},assetsInclude:["**/*.json"]}}function Nm(e){return ei(e,t=>qs(t.facadeModuleId??void 0,t.name,"settings"))}function $m(e){return ei(e,t=>qs(t.facadeModuleId??void 0,t.name,"showcases"))}async function Lm(){const e={ignore:["node_modules/**","dist/**"]},t=await I(`./${Ze}/{product,category,catalog}/*/client.{js,ts}`,e);return await Promise.all(t.map(async n=>{const{id:o,sectionId:r,pageId:s}=Hh(n),[i,a]=await Promise.all([I(`./${Ze}/${r}/${o}/settings/{content,design,translations,layout}.{js,ts}`,e),I(`./${Ze}/${r}/${o}/assets/*`,e)]);return{name:o,sectionId:r,pageId:s,clientEntrypoint:n,settingsEntryPoints:i,assetsEntrypoints:a}}))}async function Dm(e){await se({entryPoints:[e.clientEntrypoint],configType:N.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([se({entryPoints:e.settingsEntryPoints,configType:N.LayoutSettings,name:e.name,sectionId:e.sectionId}),se({entryPoints:e.assetsEntrypoints,configType:N.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function km(e){e===void 0||e.length===0||await Promise.all(e.map(t=>Dm(t)))}async function Pm(e){const t=e.flatMap(o=>o.settingsEntryPoints),n=e.flatMap(o=>o.showcaseEntryPoints);t.length>0&&await ge({configFile:!1,...mt(Nm(t))}),n.length>0&&await ge({configFile:!1,...mt($m(n))})}async function zm(e){await Promise.all([ge({configFile:!1,...mt(Qs({name:e.name,entryPoints:e.serverEntrypoint,configType:Ve.Server,sectionType:e.type}))}),se({entryPoints:e.clientEntrypoint,configType:Ve.Client,name:e.name,sectionType:e.type}),se({entryPoints:e.assetEntryPoints,configType:Ve.SectionAsset,name:e.name,sectionType:e.type})])}async function jm(){const e=T(process.cwd(),"shared/translation.ts");V(e)&&await se({entryPoints:["shared/translation.ts"],configType:Ve.SharedTranslation})}async function ti(e){await Promise.all([Pm(e),...e.map(zm)])}function Um(e){const t=Xt(e).split("/");if(t.length<4||t[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[n,o,,r]=t;if(!Fs(n))throw new Error(`Slot cannot be placed in a non-storefront section: ${n}`);return{id:r,sectionId:n,layoutId:o}}async function Mm(e,t){return Promise.all(e.map(async n=>{const o=t.find(a=>a.id===n.layoutId&&a.sectionId===n.sectionId),r=await at(o?.translationsSettings),s=await Jn(o?.content??{},r),i=await Xn(o?.design??{},r);return{id:n.id,sectionId:n.sectionId,layoutId:n.layoutId,contentEditors:s,designEditors:i}}))}async function Fm(){const e={ignore:["node_modules/**","dist/**"]},t=await I(`${Ze}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(t.map(async n=>{const{id:o,sectionId:r,layoutId:s}=Um(n),i=(await I(`${Ze}/${r}/${s}/slots/${o}/client.{js,ts}`,e))[0];if(i===void 0)throw new Error(`Cannot find client entrypoint file for slot ${o} of section ${r}`);return{id:o,sectionId:r,layoutId:s,serverEntrypoint:n,clientEntrypoint:i}}))}async function Gm(e){const t={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await Promise.all([se({entryPoints:[e.serverEntrypoint],configType:N.SlotServer,...t}),se({entryPoints:[e.clientEntrypoint],configType:N.SlotClient,...t})])}async function xm(e){e?.length&&await Promise.all(e.map(Gm))}async function Bm(e){return(await I(`**/${e}/pages/*.{js,ts}`,{ignore:["node_modules/**","dist/**"]})).filter(t=>{const n=mo(t).name.toLowerCase();return!Object.values(Ar).includes(n)})}async function Zm(){const e=await I("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(t=>(f.error(`Error while getting page template entry points: ${t}`),[]));return Promise.all(e.map(async t=>{const n=t.split(dn),o=n.pop()??"default";if(n.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const r=await I(`**/templates/${o}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),s=await I(`**/templates/${o}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await I(`**/templates/${o}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await I(`**/templates/${o}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await I(`**/templates/${o}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await Bm(o);return{name:o,configurationEntrypoint:r.at(0),homeEntrypoint:s.at(0),categoryEntrypoint:i.at(0),catalogEntrypoint:a.at(0),productEntrypoint:c.at(0),customEntrypoint:u.length>0?u:void 0}}))}async function Hm(){const e=await I("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await I("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Zm(),templates:e,assets:t}}async function Vm({templateBuildConfig:e}){await Promise.all([se({entryPoints:e.assets,configType:Ve.TemplateAsset}),...e.pageTemplates?.map(async t=>{const n=[t.configurationEntrypoint,t.homeEntrypoint,t.categoryEntrypoint,t.catalogEntrypoint,t.productEntrypoint,...t.customEntrypoint??[]].filter(Wt);if(n.length===0)throw new Error("No entry points provided for page template");await se({entryPoints:n,configType:Ve.PageTemplateDescriptor,name:t.name})})||[]])}async function Wm(){const e=await Hm();await Vm({templateBuildConfig:e})}async function Ym(){const e=await I("./collections/*",{ignore:["collections/assets/**","collections/**.{js,ts}","node_modules/**","dist/**"]}).catch(n=>(f.error(`Error while getting collection entry points: ${n}`),[])),t=await I("./collections/assets/*",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async n=>{const o=n.split(dn),r=o.pop()??"default";if(o.pop()===void 0)throw new Error("Cannot determine collection, outer directory is undefined");const s=await I(`**/collections/${r}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:r,configurationEntrypoint:s.at(0),assetsEntrypoints:t}}))}async function Km(){const e=await Ym();e.length!==0&&await Promise.all(e.flatMap(t=>[se({entryPoints:t.assetsEntrypoints,configType:N.CollectionAsset,name:t.name}),se({entryPoints:t.configurationEntrypoint?[t.configurationEntrypoint]:[],configType:N.CollectionDescriptor,name:t.name})]))}function ni(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(Wt).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(Wt),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(Wt),assetEntryPoints:e.assetsEntrypoints??[]}}function oi(e){return e.map(t=>({...t,selectedDesignSettings:t.selectedDesignSettings.map(n=>{const o=n.defaults;return o&&typeof o=="object"&&!("type"in o)?{...n,defaults:{type:n.type,...o}}:n})}))}async function Jm(e,t=me){const n=T(process.cwd(),`${t}/${e}/js/main/server/server.js.gz`),o=Oo(Io.gunzip),r=await C.promises.readFile(n);return{size:(await o(r)).length}}async function Xm(e,t=me){try{const n=T(process.cwd(),`${t}/${e}/assets/`);return(await I("*",{cwd:n})).map(o=>{const r=T(n,o);return{path:o,size:Qe(r).size}})}catch{throw new Error(`Asset files for section [${e}] is either invalid or undefined`)}}async function to(e,t){const n=await vh(e,G[t].dist),o=await Jt(e,G[t].dist),r=await Rh(e,G[t].dist),s=await bh(e,G[t].dist),i=await Nh(e,G[t].dist),a=await $h(e,G[t].dist),c=oi(a),u=await Xm(e,G[t].dist),d=await Jm(e,G[t].dist),m=Lh(e);return{id:e,type:t,name:e,content:r,design:s,layout:c,showcase:i,translationsSettings:n,translationsShowcases:o,assets:u,server:d,previewCount:m}}async function Qm(){const e=await I("*/",{cwd:T(process.cwd(),`${me}/`)}),t=await I("*/",{cwd:T(process.cwd(),`${Zn}/`)}),n=await I("*/",{cwd:T(process.cwd(),`${Hn}/`)});return Promise.all([...e.map(async o=>to(o,Ae.SECTION)),...t.map(async o=>to(o,Ae.HEADER)),...n.map(async o=>to(o,Ae.FOOTER))])}async function qm(e){try{const t=T(process.cwd(),`${e}/assets/`);return(await I("*",{cwd:t})).map(n=>{const o=T(t,n);return{path:n,size:Qe(o).size}})}catch{throw new Error("Asset files for layouts are either invalid or undefined")}}async function eE(e){const t=Xt(e).split("/");if(t.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[n,o]=t,[r,s,i,a,c]=await Promise.all([nE(o,n),oE(o,n),Ch(o,n),qm(e),rE(o,n)]);return{id:o,sectionId:n,content:r,design:s,translationsSettings:i,assets:a,layouts:c}}async function tE(){const e=`${Q}/{product,catalog,category}/*`,t=await I(e,{ignore:["node_modules/**"]});return Promise.all(t.map(eE))}async function nE(e,t){try{const n=T(process.cwd(),`${Q}/${t}/${e}/js/settings/content.mjs`),o=await re(n);return Be(o)}catch(n){throw new Error(`Content descriptor for layout [${e}] is either invalid or undefined: ${n}`)}}async function oE(e,t){try{const n=T(process.cwd(),`${Q}/${t}/${e}/js/settings/design.mjs`),o=await re(n);return Be(o)}catch(n){throw new Error(`Design descriptor for layout [${e}] is either invalid or undefined: ${n}`)}}async function rE(e,t){try{const n=T(process.cwd(),`${Q}/${t}/${e}/js/settings/layout.mjs`);if(!C.existsSync(n))return[];const o=await re(n);return oi(o)}catch(n){throw new Error(`Layout settings descriptor for layout [${e}] in section [${t}] is either invalid or undefined: ${n}`)}}async function sE(e,t,n){const o=T(process.cwd(),`${Q}/${n}/${t}/slots/${e}/js/main/server/server.js.gz`),r=Oo(Io.gunzip),s=await C.promises.readFile(o);return{size:(await r(s)).length}}async function iE(e){const t=Xt(e).split("/");if(t.length<4||t[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[n,o,,r]=t,s=await sE(r,o,n);return{id:r,sectionId:n,layoutId:o,server:s}}async function aE(){const e=`${Q}/{product,catalog,category}/*/slots/*`,t=await I(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(iE))}async function cE(){try{const e=T(process.cwd(),`${Oe}/assets/`);return(await I("*",{cwd:e})).map(t=>{const n=T(e,t);return{path:t,size:Qe(n).size}})}catch{throw new Error("Asset files for templates are either invalid or undefined")}}function uE(e){return e in Ne?Ne[e]:Ne.CUSTOM}async function lE(e){const t=await I(`${Oe}/${e}/*.mjs`,{ignore:[`${Oe}/${e}/configuration*.mjs`]});return Promise.all(t.map(async n=>{const{sections:o,metadata:r}=await no(n),s=Vf(n);return{type:uE(s.toUpperCase()),id:s,metadata:r,sections:o}}))}async function no(e){try{return await re(T(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function dE(e){const t=await I(`${Oe}/**/configuration*.mjs`,{});return Promise.all(t.map(async n=>{const o=z.basename(z.dirname(n));return{id:`${e}_${o}`,assets:await cE(),configuration:await no(n),pages:await lE(o)}}))}async function pE(e){return await dE(e)}async function fE(){const e=T(process.cwd(),`${Gf}/translation.mjs`);return await re(e)}async function hE(){return{translations:await fE()}}async function mE(e){const t=await I(`${it}/*/configuration*.mjs`,{ignore:["node_modules/**",`${it}/assets/**`]});return Promise.all(t.map(async n=>{const o=z.basename(z.dirname(n)),r=await no(n);return{id:`${e}_${o}`,descriptor:r}}))}async function ri(){const e=await Yt(),[t,n,o,r,s,i,a]=await Promise.all([qn(),hE(),Qm(),tE(),aE(),pE(e.appClientId),mE(e.appClientId)]);return{version:t.version,name:"Custom Block App",shared:n,sections:o,templates:i,layouts:r,slots:s,collections:a,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:t.dependencies.vue,openSource:t.openSource}}function oo(e){return V(`${Zn}/${e}`)?Se.HEADER:V(`${Hn}/${e}`)?Se.FOOTER:Se.SECTION}async function ro(e,t){const n=e.design?Kn(e.design):void 0,o={...e,design:n??e.design},r=await at(t);return He(o,r)}function so(e){return e.type==="custom"&&e.id!==void 0&&e.showcase_overrides!==void 0}async function si(e){if(so(e)){const t=await Jt(e.id,G[oo(e.id)].dist);return{...e,showcase_overrides:await ro(e.showcase_overrides,t)}}return e}async function EE(e){const t=so(e.header)?{...e.header,showcase_overrides:await ro(e.header.showcase_overrides,await Jt(e.header.id,G[oo(e.header.id)].dist))}:e.header,n=so(e.footer)?{...e.footer,showcase_overrides:await ro(e.footer.showcase_overrides,await Jt(e.footer.id,G[oo(e.footer.id)].dist))}:e.footer;return{...e,header:t,footer:n}}async function gE(e){const t=await Promise.all(e.pages.map(async o=>({...o,sections:await Promise.all(o.sections.map(r=>si(r)))}))),n=await EE(e.configuration);return{id:e.id,descriptor:{...n,pages:t}}}async function _E(e){return Promise.all(e.map(t=>gE(t)))}async function yE(e){const t=new Map;return await Promise.all(e.map(async n=>{const[o,r]=await Promise.all([at(n.translationsSettings),at(n.translationsShowcases)]);t.set(n.id,{settings:o,showcases:r})})),t}async function SE(e,t,n){const[o,r,s,i]=await Promise.all([Jn(e.content,t,e.type),Xn(e.design,t,e.type),Ah(e.showcase,n),js(e.layout)]);return{id:e.id,type:e.type,name:{en:e.name},contentEditors:o,designEditors:r,layouts:i,showcases:s,previewCount:e.previewCount}}async function TE(e,t){return Promise.all(e.map(async n=>{const o=t.get(n.id)??{settings:{},showcases:{}};return SE(n,o.settings,o.showcases)}))}async function OE(e){return Promise.all(e.map(async t=>{const n=await Promise.all(t.descriptor.sections.map(o=>si(o)));return{...t,descriptor:{...t.descriptor,sections:n}}}))}async function ii(e){const t=await yE(e.sections),[n,o,r,s,i]=await Promise.all([TE(e.sections,t),Vh(e.layouts),Mm(e.slots,e.layouts),_E(e.templates),OE(e.collections)]);return{version:e.version,name:e.name,blocks:n,templates:s,layouts:o,slots:r,compressionEnabled:e.compressionEnabled,externalizationEnabled:e.externalizationEnabled,vueVersion:e.vueVersion,collections:i,openSource:e.openSource}}async function IE(e){const t=T(Et.cwd(),Ls);return Di(t,JSON.stringify(e))}function wE(e){return Object.entries(G).find(t=>t[1].source===e)?.[0]}async function ai(){const e=await I("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**","collections/**"]});return Promise.all(e.map(async t=>{const n=fo(t).split(dn),o=n.pop()??"default",r=n.pop();if(r===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const s=["node_modules/**","dist/**"],[i,a,c,u,d,m,S,O]=await Promise.all([I(`**/${o}/client.{js,ts}`,{ignore:s}),I(`**/${o}/settings/content.{js,ts}`,{ignore:s}),I(`**/${o}/settings/design.{js,ts}`,{ignore:s}),I(`**/${o}/settings/layout.{js,ts}`,{ignore:s}),I(`**/${o}/settings/translations.{js,ts}`,{ignore:s}),I(`**/${o}/showcases/*.{js,ts}`,{ignore:[...s,`**/${o}/showcases/translations.{js,ts}`]}),I(`**/${o}/showcases/translations.{js,ts}`,{ignore:s}),I(`**/${o}/assets/*`,{ignore:s})]);return{name:o,type:wE(r),serverEntrypoint:t,clientEntrypoint:i.at(0),contentSettingsEntrypoint:a.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:u.at(0),settingsTranslationsEntrypoint:d.at(0),showcasesEntrypoints:m,showcasesTranslationsEntrypoint:S.at(0),assetsEntrypoints:O}}))}const vE=["/settings/","/showcases/"];function CE(e){return vE.some(t=>e.includes(t))}function RE(){const e=ue.findConfigFile(process.cwd(),ue.sys.fileExists,"tsconfig.json");if(!e)return;const t=ue.readConfigFile(e,ue.sys.readFile),n=ue.parseJsonConfigFileContent(t.config,ue.sys,process.cwd()),o=ue.createProgram(n.fileNames,n.options),r=ue.getPreEmitDiagnostics(o).filter(s=>!s.file||!CE(s.file.fileName));if(r.length>0){const s={getCanonicalFileName:i=>i,getCurrentDirectory:ue.sys.getCurrentDirectory,getNewLine:()=>ue.sys.newLine};throw console.error(ue.formatDiagnosticsWithColorAndContext(r,s)),new Error(`TypeScript found ${r.length} error(s)`)}}async function bE(e){RE(),await ge({configFile:!1,logLevel:"error",plugins:[pe.vue(),pe.tsconfigPaths(),pe.checker()],build:{write:!1,rollupOptions:{input:T(process.cwd(),e)}}})}function AE(){return Promise.all([un.rm("dist",{recursive:!0,force:!0}),un.rm("source-code",{recursive:!0,force:!0}),un.rm("source-code.zip",{force:!0})])}async function NE(){const e=new Eo,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"];(await qn()).openSource===!0&&t.splice(t.indexOf("**/assets/**/*"),1);const n=await I("**/*",{cwd:T(process.cwd()),ignore:t,dot:!0,nodir:!0});try{n.forEach(s=>{const i=T(process.cwd(),s);e.addLocalFile(i,mo(s).dir)});const o=ut[R.SourceCode].fileName,r=T(process.cwd(),o);await e.writeZipPromise(r)}catch(o){throw f.error("Error while zipping source files"),o}}async function tn(e=!1,t=!1){rm(t),Hs.start(),await AE();try{const[n,o,r]=await Promise.all([Lm(),ai(),Fm()]),s=o.map(ni);o.length>0&&await bE(o[0].serverEntrypoint);try{await Promise.all([jm(),ti(s),Wm(),Km(),km(n),xm(r),NE()])}finally{Hs.stop()}const i=await ri(),a=await Qh(i);em(a,e);const c=await ii(i);await IE(c)}catch(n){f.error(`Error while building: ${n.message}`),e||process.exit(1)}}async function se({entryPoints:e,configType:t,name:n,sectionType:o,sectionId:r,layoutId:s}){if(e.length!==0){const i=mt(Qs({name:n,entryPoints:e,configType:t,sectionType:o,sectionId:r,layoutId:s}));await ge({configFile:!1,...i})}}function ci(e,t,n){ft.statSync(e).isDirectory()?(ft.mkdirSync(t,{recursive:!0}),ft.readdirSync(e).forEach(o=>{const r=ht.resolve(e,o),s=ht.resolve(t,o);ci(r,s,n)})):Gi.isMatch(e,n,{dot:!0})||ft.copyFileSync(e,t)}function Ie(e,t,n,o,r=[]){const s=ht.join(e,o?.[n]??n);ci(ht.join(t,n),s,r)}function $E(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>f.info(`Template [${e}] with pages structure named has been created`)}}function Ee(e){return W.resolve(xi(import.meta.url),"../..",e)}function LE(){const e=Ee("package.json");return e!==""?JSON.parse(L.readFileSync(e,"utf8")):{}}async function DE(e){try{const t=e,n=j.cwd(),o=W.join(n,t),r=["templates","headers","preview","footers","reference","page-templates","layouts","collections","blank"],s={_gitignore:".gitignore"};L.existsSync(o)?(f.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),j.exit(1)):L.mkdirSync(o);const i=Ee("template");L.readdirSync(i).filter(d=>d!=="package.json").filter(d=>!r.includes(d)).forEach(async d=>Ie(o,i,d,s));const a=JSON.parse(L.readFileSync(W.join(i,"package.json"),"utf-8"));a.name=e;const c=LE();c.version&&(a.dependencies["@lightspeed/crane-api"]=c.dependencies["@lightspeed/crane-api"]),c.dependencies["@lightspeed/eslint-config-crane"]&&(a.dependencies["@lightspeed/eslint-config-crane"]=c.dependencies["@lightspeed/eslint-config-crane"]);const u=W.join(o,"package.json");L.writeFileSync(u,`${JSON.stringify(a,null,2)}
58
- `),f.info(`App ${e} created`)}catch(t){f.error(`Error while creating app: ${t.message}`),j.exit(1)}}function io(e,t,n,o){try{const r=j.cwd(),s=z.join(r,t);C.existsSync(s)||C.mkdirSync(s);const i=z.join(r,t,n);C.existsSync(i)?(f.error(`${o} with the name: ${n} already exists. If you'd like to override it, delete previous version first`),j.exit(1)):C.mkdirSync(i);const a=Ee(e);C.readdirSync(a).forEach(async c=>Ie(i,a,c)),f.info(`${o} ${n} created`)}catch(r){f.error(`Error while creating ${o}: ${r.message}`),j.exit(1)}}function ao(e){const t=j.cwd(),n=Ee(`template/${e}`),o=z.join(t,e);C.existsSync(o)||(C.mkdirSync(o),C.readdirSync(n).forEach(async r=>Ie(o,n,r)))}async function kE(e,t,n,o){if(!C.existsSync(n)){C.copyFileSync(t,n);return}const r=C.readFileSync(t),s=C.readFileSync(n);r.equals(s)||(o?(await Pe({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"?(C.copyFileSync(t,n),f.info(`Replaced "${e.name}" with template version.`)):f.info(`Kept existing "${e.name}".`):f.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`))}async function nn(e,t,n=!1){async function o(s,i,a){const c=z.join(i,s.name),u=z.join(a,s.name);s.isDirectory()?await nn(c,u,n):await kE(s,c,u,n)}const r=C.readdirSync(e,{withFileTypes:!0});C.existsSync(t)||C.mkdirSync(t,{recursive:!0}),await r.reduce(async(s,i)=>(await s,o(i,e,t)),Promise.resolve())}async function co(e=!1){try{const t=j.cwd(),n=z.join(t,"shared"),o=Ee("template/shared");if(!C.existsSync(o))return;await nn(o,n,e)}catch(t){f.error(`Error while processing shared folder: ${t.message}`),j.exit(1)}}async function PE(e,t){await co(),io(`${`template${t?"/blank":""}`}/sections/${`${t?"blank-section":"example-section"}`}`,"sections",e,"Section")}function zE(e){return{renameFiles:{"example-collection":`${e}`},targetPath:e,sourcePath:"template/collections",onCollectionCreated:()=>f.info(`Collection [${e}] has been created`)}}async function jE(e){const{targetPath:t,renameFiles:n,sourcePath:o,onCollectionCreated:r}=zE(e);try{const s=j.cwd(),i=W.join(s,"collections"),a=Ee(o),c=L.readdirSync(a);L.existsSync(i)?L.existsSync(W.join(i,t))&&(f.error(`Collection with the name: ${e} already exists. If you'd like to override it, delete previous version first`),j.exit(1)):L.mkdirSync(i),c.forEach(u=>Ie(i,a,u,n)),r()}catch(s){f.error(`Error while creating collection: ${s.message}`),j.exit(1)}}async function UE(e){await co(),io("template/footers/example-footer","footers",e,"Footer")}async function ME(e){await co(),io("template/headers/example-header","headers",e,"Header")}async function FE(e,t){try{const n=j.cwd(),o=W.join(n,"templates"),r=Ee("template/page-templates/example-template/pages");L.existsSync(W.join(o,e))||(f.error(`Template with the name: [${e}] doesn't exists. Please create a template first.`),j.exit(1)),L.existsSync(W.join(o,e,"pages",`${t}.ts`))&&(f.error(`Page with the name: [${t}.ts] already exists. If you'd like to override it, delete previous version first`),j.exit(1));const s=L.readFileSync(W.join(r,"custom.ts"),"utf-8").replace(/title\s*:\s*'Custom Page'/,`title: '${Wf(t)}'`),i=W.join(o,e,"pages",`${t}.ts`);L.writeFileSync(i,s),f.info(`Page [${t}.ts] created for template ${e}`)}catch(n){f.error(`Error while creating page: ${n.message}`),j.exit(1)}}async function GE(){try{const e=j.cwd(),t=Ee("template/reference"),n=L.readdirSync(t);let o=!1;for(const r of n){const s=W.join(t,r),i=W.join(e,r);L.existsSync(i)||L.mkdirSync(i,{recursive:!0});const a=L.readdirSync(s),c=L.readdirSync(i);if(r==="shared"){a.forEach(u=>{Ie(i,s,u)});continue}for(const u of a){if(u==="assets"){Ie(i,s,u);continue}if(c.includes(u)){const{name:d}=await Pe({type:"text",name:"name",message:`The "${u}" already exists in ${r} directory: provide a new name to keep both or press Esc to skip this one.`});d?(Ie(i,s,u,{[u]:d}),o=!0):f.info(`Skipped: ${u}`)}else Ie(i,s,u)}}f.info("Reference templates have been added to the app"),o&&f.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){f.error(`Error while creating template descriptors: ${e.message}`),j.exit(1)}}const xE=["**/example-template/pages/custom.ts"];async function BE(e){const{targetPath:t,renameFiles:n,sourcePath:o,onTemplateCreated:r}=$E(e);try{const s=j.cwd(),i=W.join(s,"templates"),a=Ee(o),c=L.readdirSync(a);L.existsSync(i)?L.existsSync(W.join(i,t))&&(f.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),j.exit(1)):L.mkdirSync(i),c.forEach(u=>Ie(i,a,u,n,xE)),ao("headers"),ao("footers"),ao("layouts"),r()}catch(s){f.error(`Error while creating template descriptors: ${s.message}`),j.exit(1)}}function ZE(){try{const e=T(Et.cwd(),`${$s}/shared/analytics.json`);V(e)&&ln(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}function on({deploymentContext:e,sectionType:t=Se.SECTION}){const n=e.pathContext,o=n.toPath({sectionId:e.currentSection,sectionType:t,layoutId:e.layoutId,slotId:e.slotId}),r=o===void 0?go(n.fileName):go(n.fileName,{cwd:T(process.cwd(),o),ignore:n.ignore});return(n.isSingleton?r.splice(0):r).map(s=>({url:s,sectionType:t,context:e}))}const HE=e=>e.app.manifest.blocks.flatMap(t=>Mh.flatMap(n=>{const o={config:e,currentSection:t.id,pathContext:ut[n]};return on({deploymentContext:o,sectionType:t.type})})),VE=e=>xh.flatMap(t=>{const n={config:e,pathContext:ut[t]};return on({deploymentContext:n})}),WE=e=>e.app.manifest.layouts.flatMap(t=>Fh.flatMap(n=>{const o={config:e,pathContext:ut[n],currentSection:t.sectionId,layoutId:t.id};return on({deploymentContext:o})})),YE=e=>e.app.manifest.slots.flatMap(t=>Gh.flatMap(n=>{const o={config:e,pathContext:ut[n],currentSection:t.sectionId,layoutId:t.layoutId,slotId:t.id};return on({deploymentContext:o})})),KE=e=>`\x1B[32m${e}\x1B[0m`,JE=(e,t,n,o,r)=>{if(!e.total)return;const{loaded:s}=e,i=(Date.now()-r)/1e3;n.value+=s-o.value,o.value=s,t.update({speed:`${Te(n.value/i,2)}/s`})},XE=()=>new Hi.SingleBar({format:`|${KE("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});async function ui(e){await new Promise(t=>setTimeout(t,e))}const li="Please ensure you have built your application before deploying.";async function QE(){try{const e=await pn(T(Et.cwd(),Ls));return JSON.parse(e.toString())}catch(e){throw e.code==="ENOENT"?new Error(`Manifest file not found. ${li}`):e instanceof SyntaxError?new Error(`Manifest file is not valid. ${li}`):e}}const qE={value:0},ie=XE();let di=Date.now();const pi=e=>2**e*500;async function eg(e){const t=Zi(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,ln(T(M.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
59
- `)}function tg(e){return e instanceof yo&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function fi(e,t){return e<Uh&&tg(t)}async function hi(e,t,n,o){const r={value:0},s=e.config.app.manifest.templates.length>0||e.config.app.manifest.collections.length>0?kh:Dh;return e.config.axios.post(s,{file:Oi(T(M.cwd(),n!==void 0?n+t:t))},{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:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:i=>JE(i,ie,qE,r,di)}).then(i=>(ie.increment(),i)).catch(async i=>{if(fi(o,i))return await ui(pi(o)),hi(e,t,n,o+1);throw ie.increment(),i})}function ng(e){return ie.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const n=t.context,o=n.pathContext.toPath({sectionId:n.currentSection,sectionType:t.sectionType,layoutId:n.layoutId,slotId:n.slotId});return hi(n,t.url,o,0)})}function og(e){const t=[...HE(e),...VE(e),...WE(e),...YE(e)];return ng(t)}async function mi(e,t=0){const n=e.app.manifest.templates.length>0||e.app.manifest.collections.length>0?zh:Ph;return e.axios.post(n,e.app.manifest,{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async o=>{if(fi(t,o))return await ui(pi(t)),mi(e,t+1);throw o})}async function rg(e){try{if(!xf.some(i=>V(T(M.cwd(),i))))throw new Error(We.INCORRECT_DISTRIBUTION_FOLDER(Ff));const t=e??Qn;f.info("Custom application deployment :: Started");const n=fn.create({baseURL:t});Bi(n,jh),f.info("Loading configuration files ...");const o=await Promise.all([Yt(),qn(),QE()]).then(([i,a,c])=>({axios:n,app:{crane:i,packageJson:a,manifest:c}}));f.info("Uploading files ..."),di=Date.now(),await Promise.all(og(o)).catch(i=>{ie.stop(),i.response?.status===404?f.error(Le(i,We.DEPRECATED_VERSION_DEPLOYMENT)):f.error(Le(i,We.ASSET_FILES_UPLOAD)),M.exit(1)}).finally(()=>{ie.increment(),ie.stop()}),ie.update({speed:"N/A",status:"Finalising deployment"}),await mi(o).catch(i=>{ie.stop(),i.response?.status===404?f.error(Le(i,We.DEPRECATED_VERSION_DEPLOYMENT)):f.error(Le(i,We.MANIFEST_DEPLOYMENT)),M.exit(1)}).finally(()=>{ie.increment(),ie.stop()});const r=o.app.manifest.blocks.map(i=>i.id),s=o.app.packageJson.version;f.info("Custom application deployment :: Successful"),f.info(`Current app version: ${s}`),f.info(`Deployed sections: ${r.sort().join(", ")}`),await eg(o.app.packageJson),o.app.manifest.templates.length>0&&f.info(`Deployed templates: ${o.app.manifest.templates.map(i=>i.id).sort().join(", ")}`),o.app.manifest.slots.length>0&&f.info(`Deployed slots: ${o.app.manifest.slots.map(i=>i.id).sort().join(", ")}`),o.app.manifest.collections.length>0&&f.info(`Deployed collections: ${o.app.manifest.collections.map(i=>i.id).sort().join(", ")}`)}catch(t){ie.stop(),f.error(Le(t,We.DEFAULT)),M.exit(1)}finally{ZE()}}function sg(){process.env.CRANE_DEBUG_ENABLED="true"}function ig(){return process.env.CRANE_DEBUG_ENABLED==="true"}function ag(e,...t){ig()&&console.debug(Ai(`[DEBUG] ${e}`),...t)}function cg(){return{name:"app-block-api",configureServer(e){e.middlewares.use(async(t,n,o)=>{e.moduleGraph.invalidateAll();const r=new ki(t.url||"",`http://${t.headers.host}`);if(r.pathname==="/api/v1/block-config"&&t.method==="GET"){const s=r.searchParams.get("section");if(!s){n.statusCode=400,n.setHeader("Content-Type","application/json"),n.end(JSON.stringify({error:"Missing blockId parameter"}));return}try{const i=await ri(),a=(await ii(i)).blocks.find(c=>c.id===s);n.statusCode=200,n.setHeader("Content-Type","application/json"),n.end(JSON.stringify(a))}catch(i){n.statusCode=500,n.setHeader("Content-Type","application/json"),n.end(JSON.stringify({error:i.message}))}return}o()})}}}let ke=null;function ug(){ke&&ke.clients.forEach(e=>{e.readyState===Wi.OPEN&&e.send(JSON.stringify({type:"full-reload"}))})}async function lg(e,t){const n=T(`${e}/ssr-server.ts`),o=T(t);await ge({build:{lib:{entry:n,formats:["es"],fileName:()=>"ssr-server.mjs"},outDir:o,emptyOutDir:!1,minify:!1,rollupOptions:{external:["http","fs","@swc/core","module-from-string","linkedom"],output:{entryFileNames:"ssr-server.mjs"}},target:"esnext"}})}async function dg(e,t){const n=T(`${e}/shared/preview.ts`),o=T(`${e}/shared/utils.ts`),r=T(`${e}/shared/api-routes.ts`),s=T(t);await ge({build:{lib:{entry:n,formats:["es"],fileName:()=>"preview.js"},outDir:s,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await ge({build:{lib:{entry:o,formats:["es"],fileName:()=>"utils.js"},outDir:s,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await ge({build:{lib:{entry:r,formats:["es"],fileName:()=>"api-routes.js"},outDir:s,emptyOutDir:!1,minify:!1,rollupOptions:{external:["path","fs","http","https","url","stream","util","events","buffer"],output:{entryFileNames:"api-routes.js"}},target:"esnext"}})}async function pg(){const e="preview",t=`${e}/shared`,n="vite.config.js",o=`${e}/sections`,r=`${o}/preview.html`;[e,o].forEach(c=>{C.existsSync(c)||C.mkdirSync(c,{recursive:!0})});const s=Ee("template/preview");C.copyFileSync(`${s}/${n}`,`${e}/${n}`),await lg(s,e),C.copyFileSync(`${s}/sections/preview.html`,r);const i=`${s}/assets`,a=`${e}/assets`;C.existsSync(i)&&(C.mkdirSync(a,{recursive:!0}),C.readdirSync(i).forEach(c=>{C.copyFileSync(`${i}/${c}`,`${a}/${c}`)})),C.existsSync(t)||C.mkdirSync(t),await dg(s,t)}function fg(e){const t=e.replace(/\\/g,"/").match(/(?:sections|headers|footers)\/([^/]+)/);return t?t[1]:null}function hg(e){const t=e.replace(/\\/g,"/");return t.includes("shared")&&!t.includes("sections")&&!t.includes("headers")&&!t.includes("footers")}async function mg(e){const t=(await ai()).find(o=>o.name===e);if(!t){console.warn(`Block ${e} not found, falling back to full build`),await tn(!0);return}const n=ni(t);await ti([n]),console.log(`Block ${e} rebuilt successfully`)}var Eg=(e=>(e.FULL="full",e.INCREMENTAL="incremental",e))(Eg||{});function gg(){return{timeout:null,inProgress:!1,pendingBuild:null}}function _g(e,t){const n=async o=>{e.inProgress=!0;try{o.type==="incremental"&&o.blockName?await mg(o.blockName):await tn(!0),t.ws.send({type:"full-reload",path:"*"}),ug()}catch(r){console.error("Build error:",r)}finally{if(e.inProgress=!1,e.pendingBuild){const r=e.pendingBuild;e.pendingBuild=null,setTimeout(()=>n(r),0)}}};return async o=>{if(e.inProgress){o.type==="full"||e.pendingBuild?.type==="full"?e.pendingBuild={type:"full"}:e.pendingBuild=o;return}await n(o)}}function yg(e){const t=e.replace(/\\/g,"/"),n=t.match(/sections\/([^/]+)/),o=t.match(/headers\/([^/]+)/),r=t.match(/footers\/([^/]+)/),s=t.match(/shared\//);return!!(n||o||r||s)}function Sg(e,t){return async n=>{if(!yg(n))return;e.timeout&&clearTimeout(e.timeout);const o=fg(n),r=hg(n);e.timeout=setTimeout(async()=>{r?await t({type:"full"}):o&&await t({type:"incremental",blockName:o})},1e3)}}function Tg(e,t){const n=gg(),o=_g(n,e),r=Sg(n,o);e.watcher.add(t),e.watcher.on("add",r),e.watcher.on("change",r),e.watcher.on("unlink",r)}async function Og(){const e=z.resolve(process.cwd(),"preview/ssr-server.mjs");if(!C.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 t=e;process.platform==="win32"&&(t=_o(e).href);const n=await import(t),{server:o,port:r}=await n.startServer();return{server:o,port:r}}function Ig(){ke=new Vi({port:0}),ke.on("listening",()=>{const e=ke?.address();if(e&&typeof e=="object"){const t=e.port;process.env.CRANE_WEBSOCKET_PORT=String(t)}})}async function wg(){const e=z.resolve(process.cwd(),"preview/vite.config.js"),t=z.resolve(process.cwd(),"sections/**/*"),n=z.resolve(process.cwd(),"headers/**/*"),o=z.resolve(process.cwd(),"footers/**/*"),r=z.resolve(process.cwd(),"shared/**/*"),s=await $i({configFile:e,root:process.cwd(),plugins:[cg()]});return await s.listen(),Tg(s,[t,n,o,r]),s}async function vg(){await tn(),await pg(),console.log(`
68
+ For deploy run: npx @lightspeed/crane@latest deploy`;function Vx(e,s){if(e.errors.length===0){_.info(zx);return}_.error("Invalid configuration detected:"),Ux(e),s||process.exit(1)}const fu={"process.env":{NODE_ENV:"production"}},Gx=[...Ja,...Ja.map(e=>`node:${e}`)],Hx=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],mu=e=>({pluginType:Ge.Server,define:fu,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...Gx,...Hx],inlineDynamicImports:!0,...e,outDir:e.outDir}),yu=e=>({pluginType:Ge.Client,define:fu,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),fs=e=>({pluginType:Ge.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),Zx=e=>({pluginType:Ge.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),Wi=e=>({pluginType:Ge.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir});let Ki=!1;function Wx(e){Ki=e}function vn(){return Ki}const gu=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Kx=80,qx="\x1B[?25l",Yx="\x1B[?25h",Jx="\x1B[2K\r",Xx=44;let Qx=class{frameIndex=0;timer=null;realWrite=null;buffer=[];start(){Ki||(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(qx),this.render(),this.timer=setInterval(()=>this.render(),Kx))}render(){if(!this.realWrite)return;const s=" Build is in progress...".padEnd(Xx-1," "),i=et(gu[this.frameIndex]+s);this.realWrite(`\r${i}`),this.frameIndex=(this.frameIndex+1)%gu.length}stop(){if(!Ki&&(this.timer&&(clearInterval(this.timer),this.timer=null),this.realWrite)){process.stdout.write=this.realWrite,this.realWrite(`${Jx}${Yx}`);for(const s of this.buffer)this.realWrite(s);this.buffer=[],this.realWrite=null}}};const Eu=new Qx,eI=()=>Cp({ext:".gz",algorithm:"gzip",verbose:vn()}),tI="/* EXTERNAL_IMPORTS_START */",sI="/* EXTERNAL_IMPORTS_END */",iI=()=>({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=tI+h+sI,y=a.code.replace(c,"");a.code=f+y}}}}}),rI=()=>({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})}}),nI=()=>{const e=process.env.npm_lifecycle_event;return _p({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"`}})},rt={vue:()=>vp(),tsconfigPaths:()=>Np(),checker:()=>nI()};class er{constructor(s){this.bits=s instanceof er?s.bits.slice():[]}add(s){this.bits[s>>5]|=1<<(s&31)}has(s){return!!(this.bits[s>>5]&1<<(s&31))}}class zs{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 zs(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 zs(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 aI(){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 oI=aI();class cI{constructor(s){this.version=3,this.file=s.file,this.sources=s.sources,this.sourcesContent=s.sourcesContent,this.names=s.names,this.mappings=Op(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,"+oI(this.toString())}}function lI(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 uI(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 hI=Object.prototype.toString;function pI(e){return hI.call(e)==="[object Object]"}function Tu(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 dI=/\w/;class fI{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
+ `,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"?dI.test(a[h])?y||(this.rawSegments.push(T),y=!0):(this.rawSegments.push(T),y=!1):this.rawSegments.push(T)}a[h]===`
73
+ `?(c.line+=1,c.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,f=!0):(c.column+=1,this.generatedCodeColumn+=1,f=!1),h+=1}this.pending=null}advance(s){if(!s)return;const i=s.split(`
74
+ `);if(i.length>1){for(let a=0;a<i.length-1;a++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=i[i.length-1].length}}const js=`
75
+ `,ms={insertLeft:!1,insertRight:!1,storeName:!1};class Fn{constructor(s,i={}){const a=new zs(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 er},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 Fn(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 er(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 fI(s.hires),u=Tu(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?uI(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 cI(this.generateDecodedMap(s))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=lI(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(pI(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(x=>{for(let P=x[0];P<x[1];P+=1)c[P]=!0});let u=i.indentStart!==!1;const h=T=>u?`${s}${T}`:(u=!0,T);this.intro=this.intro.replace(a,h);let f=0,y=this.firstChunk;for(;y;){const T=y.end;if(y.edited)c[f]||(y.content=y.content.replace(a,h),y.content.length&&(u=y.content[y.content.length-1]===`
76
+ `));else for(f=y.start;f<T;){if(!c[f]){const x=this.original[f];x===`
77
+ `?u=!0:x!=="\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 ms.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),ms.insertLeft=!0),this.appendLeft(s,i)}insertRight(s,i){return ms.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),ms.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&&(ms.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),ms.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 zs(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(js);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(js),s!==-1)return a.outro.substr(s+1)+i;i=a.outro+i}if(a.content.length>0){if(s=a.content.lastIndexOf(js),s!==-1)return a.content.substr(s+1)+i;i=a.content+i}if(a.intro.length>0){if(s=a.intro.lastIndexOf(js),s!==-1)return a.intro.substr(s+1)+i;i=a.intro+i}}while(a=a.previous);return s=this.intro.lastIndexOf(js),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=Tu(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 Su=G(process.cwd(),"shared/translation.ts"),bu="globalThis.craneSharedTranslation = translation",mI=e=>`import translation from '${e}';
78
+ ${bu};
79
+ `,yI=(e,s)=>{const i=e.split("?")[0],a=yp(i);return(a==="server.ts"||a==="client.ts")&&!s.includes(bu)},xu=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=De(Su)},transform(s,i){if(!e||!yI(i,s))return null;const a=i.split("?")[0],c=Ga(a),u=bp(Ha(c,Su)),h=mI(u),f=new Fn(s);return f.prepend(h),{code:f.toString()}}}},Iu={[Ge.Server]:()=>[rt.vue(),rt.tsconfigPaths(),iI(),eI(),xu()],[Ge.Client]:()=>[rt.vue(),rt.tsconfigPaths(),Xa({vue:"EcVue"}),xu()],[Ge.Misc]:()=>[rt.tsconfigPaths()],[Ge.Layout]:()=>[rt.vue(),rt.tsconfigPaths(),Xa({vue:["EcExternals","Vue"]})],[Ge.Asset]:()=>[rI()],[Ge.SharedFiles]:()=>[rt.tsconfigPaths()]},Pu={[he.Server]:mu({outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/main/server`}),[he.Client]:yu({outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/main/client`}),[he.SectionSetting]:fs({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/settings`}),[he.SectionShowcase]:fs({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/js/showcases`}),[he.SectionAsset]:Wi({outDir:({name:e,sectionType:s})=>`./${we[s].dist}/${e}/assets`}),[he.TemplateDescriptor]:fs({entryFileNames:"[name].mjs",outDir:()=>`./${Tt}/js`}),[he.PageTemplateDescriptor]:fs({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${Tt}/${e}`}),[he.TemplateAsset]:Wi({outDir:()=>`./${Tt}/assets`}),[he.Layout]:Zx({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}`}),[he.LayoutSettings]:fs({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/js/settings`}),[he.LayoutAsset]:Wi({outDir:({name:e,sectionId:s})=>`./${ze}/${s}/${e}/assets`}),[he.SlotServer]:mu({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/server`}),[he.SlotClient]:yu({outDir:({name:e,layoutId:s,sectionId:i})=>`./${ze}/${i}/${s}/slots/${e}/js/main/client`}),[he.CollectionDescriptor]:fs({entryFileNames:"[name].mjs",outDir:({name:e})=>`./${$s}/${e}`}),[he.CollectionAsset]:Wi({outDir:()=>`./${$s}/assets`}),[he.SharedTranslation]:{pluginType:Ge.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function gI(e){switch(typeof e){case"string":return[G(process.cwd(),e)];case"object":return e.map(s=>G(process.cwd(),s));default:return[]}}function wu({name:e,entryPoints:s,configType:i,layoutId:a,sectionId:c,sectionType:u=ft.SECTION}){const h=Pu[i],f=h.define,y=h.ssrOptions,T=h.entryFileNames,x=h.chunkFileNames,P=h.assetFileNames,L=h.inlineDynamicImports,R=h.externalOption;return{logLevel:vn()?void 0:"silent",plugins:Iu[h.pluginType](),ssr:y,define:f,resolve:{alias:{"@":"/src"}},build:{ssr:h.ssr,outDir:h.outDir({name:e,sectionType:u,layoutId:a,sectionId:c}),emptyOutDir:!0,minify:h.ssr?"terser":"esbuild",...h.ssr&&{terserOptions:{mangle:{reserved:["gc"]}}},rollupOptions:{external:R,preserveEntrySignatures:"strict",input:gI(s),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:L,entryFileNames:T,chunkFileNames:x,assetFileNames:P}}},assetsInclude:["**/*.json"]}}const EI=Object.values(we).map(e=>e.source).join("|");function Au(e,s,i){if(!e)return`${s}.mjs`;const a=Ha(process.cwd(),e).replace(/\\/g,"/").match(`^(${EI})/([^/]+)/${i}/([^/.]+)`);return a?`${a[1]}/${a[2]}/js/${i}/${a[3]}.mjs`:`${s}.mjs`}function Cu(e,s){const i=Pu[he.SectionSetting];return{logLevel:vn()?void 0:"silent",plugins:Iu[i.pluginType](),define:i.define,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:i.ssr,outDir:"./dist",emptyOutDir:!1,minify:"esbuild",rollupOptions:{external:i.externalOption,preserveEntrySignatures:"strict",input:e.map(a=>G(process.cwd(),a)),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:i.inlineDynamicImports,entryFileNames:s,chunkFileNames:"chunks/[name]-[hash].js",assetFileNames:i.assetFileNames}}},assetsInclude:["**/*.json"]}}function TI(e){return Cu(e,s=>Au(s.facadeModuleId??void 0,s.name,"settings"))}function SI(e){return Cu(e,s=>Au(s.facadeModuleId??void 0,s.name,"showcases"))}async function bI(){const e={ignore:["node_modules/**","dist/**"]},s=await W(`./${ls}/{product,category,catalog}/*/client.{js,ts}`,e);return await Promise.all(s.map(async i=>{const{id:a,sectionId:c,pageId:u}=Dx(i),[h,f]=await Promise.all([W(`./${ls}/${c}/${a}/settings/{content,design,translations,layout}.{js,ts}`,e),W(`./${ls}/${c}/${a}/assets/*`,e)]);return{name:a,sectionId:c,pageId:u,clientEntrypoint:i,settingsEntryPoints:h,assetsEntrypoints:f}}))}async function xI(e){await Ye({entryPoints:[e.clientEntrypoint],configType:he.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([Ye({entryPoints:e.settingsEntryPoints,configType:he.LayoutSettings,name:e.name,sectionId:e.sectionId}),Ye({entryPoints:e.assetsEntrypoints,configType:he.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function II(e){e===void 0||e.length===0||await Promise.all(e.map(s=>xI(s)))}async function PI(e){const s=e.flatMap(a=>a.settingsEntryPoints),i=e.flatMap(a=>a.showcaseEntryPoints);s.length>0&&await ht({configFile:!1,...Qs(TI(s))}),i.length>0&&await ht({configFile:!1,...Qs(SI(i))})}async function wI(e){await Promise.all([ht({configFile:!1,...Qs(wu({name:e.name,entryPoints:e.serverEntrypoint,configType:hs.Server,sectionType:e.type}))}),Ye({entryPoints:e.clientEntrypoint,configType:hs.Client,name:e.name,sectionType:e.type}),Ye({entryPoints:e.assetEntryPoints,configType:hs.SectionAsset,name:e.name,sectionType:e.type})])}async function AI(){const e=G(process.cwd(),"shared/translation.ts");De(e)&&await Ye({entryPoints:["shared/translation.ts"],configType:hs.SharedTranslation})}async function vu(e){await Promise.all([PI(e),...e.map(wI)])}function CI(e){const s=Hi(e).split("/");if(s.length<4||s[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[i,a,,c]=s;if(!du(i))throw new Error(`Slot cannot be placed in a non-storefront section: ${i}`);return{id:c,sectionId:i,layoutId:a}}async function vI(e,s){return Promise.all(e.map(async i=>{const a=s.find(f=>f.id===i.layoutId&&f.sectionId===i.sectionId),c=await Fs(a?.translationsSettings),u=await Pn(a?.content??{},c),h=await wn(a?.design??{},c);return{id:i.id,sectionId:i.sectionId,layoutId:i.layoutId,contentEditors:u,designEditors:h}}))}async function NI(){const e={ignore:["node_modules/**","dist/**"]},s=await W(`${ls}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(s.map(async i=>{const{id:a,sectionId:c,layoutId:u}=CI(i),h=(await W(`${ls}/${c}/${u}/slots/${a}/client.{js,ts}`,e))[0];if(h===void 0)throw new Error(`Cannot find client entrypoint file for slot ${a} of section ${c}`);return{id:a,sectionId:c,layoutId:u,serverEntrypoint:i,clientEntrypoint:h}}))}async function _I(e){const s={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await Promise.all([Ye({entryPoints:[e.serverEntrypoint],configType:he.SlotServer,...s}),Ye({entryPoints:[e.clientEntrypoint],configType:he.SlotClient,...s})])}async function OI(e){e?.length&&await Promise.all(e.map(_I))}async function LI(e){return(await W(`**/${e}/pages/*.{js,ts}`,{ignore:["node_modules/**","dist/**"]})).filter(s=>{const i=Za(s).name.toLowerCase();return!Object.values(pc).includes(i)})}async function kI(){const e=await W("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(s=>(_.error(`Error while getting page template entry points: ${s}`),[]));return Promise.all(e.map(async s=>{const i=s.split(wr),a=i.pop()??"default";if(i.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const c=await W(`**/templates/${a}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await W(`**/templates/${a}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),h=await W(`**/templates/${a}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await W(`**/templates/${a}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await W(`**/templates/${a}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),T=await LI(a);return{name:a,configurationEntrypoint:c.at(0),homeEntrypoint:u.at(0),categoryEntrypoint:h.at(0),catalogEntrypoint:f.at(0),productEntrypoint:y.at(0),customEntrypoint:T.length>0?T:void 0}}))}async function DI(){const e=await W("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),s=await W("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await kI(),templates:e,assets:s}}async function RI({templateBuildConfig:e}){await Promise.all([Ye({entryPoints:e.assets,configType:hs.TemplateAsset}),...e.pageTemplates?.map(async s=>{const i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint,...s.customEntrypoint??[]].filter(ji);if(i.length===0)throw new Error("No entry points provided for page template");await Ye({entryPoints:i,configType:hs.PageTemplateDescriptor,name:s.name})})||[]])}async function MI(){const e=await DI();await RI({templateBuildConfig:e})}async function $I(){const e=await W("./collections/*",{ignore:["collections/assets/**","collections/**.{js,ts}","node_modules/**","dist/**"]}).catch(i=>(_.error(`Error while getting collection entry points: ${i}`),[])),s=await W("./collections/assets/*",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async i=>{const a=i.split(wr),c=a.pop()??"default";if(a.pop()===void 0)throw new Error("Cannot determine collection, outer directory is undefined");const u=await W(`**/collections/${c}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:c,configurationEntrypoint:u.at(0),assetsEntrypoints:s}}))}async function FI(){const e=await $I();e.length!==0&&await Promise.all(e.flatMap(s=>[Ye({entryPoints:s.assetsEntrypoints,configType:he.CollectionAsset,name:s.name}),Ye({entryPoints:s.configurationEntrypoint?[s.configurationEntrypoint]:[],configType:he.CollectionDescriptor,name:s.name})]))}function Nu(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(ji).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(ji),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(ji),assetEntryPoints:e.assetsEntrypoints??[]}}function _u(e){return e.map(s=>({...s,selectedDesignSettings:s.selectedDesignSettings.map(i=>{const a=i.defaults;return a&&typeof a=="object"&&!("type"in a)?{...i,defaults:{type:i.type,...a}}:i})}))}async function BI(e,s=ot){const i=G(process.cwd(),`${s}/${e}/js/main/server/server.js.gz`),a=Qa(eo.gunzip),c=await ee.promises.readFile(i);return{size:(await a(c)).length}}async function UI(e,s=ot){try{const i=G(process.cwd(),`${s}/${e}/assets/`);return(await W("*",{cwd:i})).map(a=>{const c=G(i,a);return{path:a,size:Ps(c).size}})}catch{throw new Error(`Asset files for section [${e}] is either invalid or undefined`)}}async function Nn(e,s){const i=await fx(e,we[s].dist),a=await Gi(e,we[s].dist),c=await yx(e,we[s].dist),u=await gx(e,we[s].dist),h=await Tx(e,we[s].dist),f=await Sx(e,we[s].dist),y=_u(f),T=await UI(e,we[s].dist),x=await BI(e,we[s].dist),P=bx(e);return{id:e,type:s,name:e,content:c,design:u,layout:y,showcase:h,translationsSettings:i,translationsShowcases:a,assets:T,server:x,previewCount:P}}async function jI(){const e=await W("*/",{cwd:G(process.cwd(),`${ot}/`)}),s=await W("*/",{cwd:G(process.cwd(),`${En}/`)}),i=await W("*/",{cwd:G(process.cwd(),`${Tn}/`)});return Promise.all([...e.map(async a=>Nn(a,$t.SECTION)),...s.map(async a=>Nn(a,$t.HEADER)),...i.map(async a=>Nn(a,$t.FOOTER))])}async function zI(e){try{const s=G(process.cwd(),`${e}/assets/`);return(await W("*",{cwd:s})).map(i=>{const a=G(s,i);return{path:i,size:Ps(a).size}})}catch{throw new Error("Asset files for layouts are either invalid or undefined")}}async function VI(e){const s=Hi(e).split("/");if(s.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[i,a]=s,[c,u,h,f,y,T]=await Promise.all([WI(a,i),KI(a,i),mx(a,i),zI(e),ZI(i,a),qI(a,i)]);return{id:a,sectionId:i,content:c,design:u,translationsSettings:h,assets:f,layouts:T,templateContent:y}}async function GI(){const e=`${ze}/{product,catalog,category}/*`,s=await W(e,{ignore:["node_modules/**"]});return Promise.all(s.map(VI))}function HI(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}async function ZI(e,s){const i=`layouts/${e}/${s}/Main.vue`;try{const a=G(process.cwd(),i);return await ee.promises.readFile(a,"utf-8")}catch(a){if(HI(a)){_.warn(`Custom storefront layout is missing: [${i}]. If you created this layout manually, check that the file is named Main.vue.`);return}throw a}}async function WI(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/content.mjs`),a=await qe(i);return ns(a)}catch(i){throw new Error(`Content descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function KI(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/design.mjs`),a=await qe(i);return ns(a)}catch(i){throw new Error(`Design descriptor for layout [${e}] is either invalid or undefined: ${i}`)}}async function qI(e,s){try{const i=G(process.cwd(),`${ze}/${s}/${e}/js/settings/layout.mjs`);if(!ee.existsSync(i))return[];const a=await qe(i);return _u(a)}catch(i){throw new Error(`Layout settings descriptor for layout [${e}] in section [${s}] is either invalid or undefined: ${i}`)}}async function YI(e,s,i){const a=G(process.cwd(),`${ze}/${i}/${s}/slots/${e}/js/main/server/server.js.gz`),c=Qa(eo.gunzip),u=await ee.promises.readFile(a);return{size:(await c(u)).length}}async function JI(e){const s=Hi(e).split("/");if(s.length<4||s[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[i,a,,c]=s,u=await YI(c,a,i);return{id:c,sectionId:i,layoutId:a,server:u}}async function XI(){const e=`${ze}/{product,catalog,category}/*/slots/*`,s=await W(e,{ignore:["node_modules/**"]});return await Promise.all(s.map(JI))}async function QI(){try{const e=G(process.cwd(),`${Tt}/assets/`);return(await W("*",{cwd:e})).map(s=>{const i=G(e,s);return{path:s,size:Ps(i).size}})}catch{throw new Error("Asset files for templates are either invalid or undefined")}}function eP(e){return e in Ft?Ft[e]:Ft.CUSTOM}async function tP(e){const s=await W(`${Tt}/${e}/*.mjs`,{ignore:[`${Tt}/${e}/configuration*.mjs`]});return Promise.all(s.map(async i=>{const{sections:a,metadata:c}=await _n(i),u=Rb(i);return{type:eP(u.toUpperCase()),id:u,metadata:c,sections:a}}))}async function _n(e){try{return await qe(G(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function sP(e){const s=await W(`${Tt}/**/configuration*.mjs`,{});return Promise.all(s.map(async i=>{const a=Te.basename(Te.dirname(i));return{id:`${e}_${a}`,assets:await QI(),configuration:await _n(i),pages:await tP(a)}}))}async function iP(e){return await sP(e)}async function rP(){const e=G(process.cwd(),`${_b}/translation.mjs`);return await qe(e)}async function nP(){return{translations:await rP()}}async function aP(e){const s=await W(`${$s}/*/configuration*.mjs`,{ignore:["node_modules/**",`${$s}/assets/**`]});return Promise.all(s.map(async i=>{const a=Te.basename(Te.dirname(i)),c=await _n(i);return{id:`${e}_${a}`,descriptor:c}}))}async function Ou(){const e=await zi(),[s,i,a,c,u,h,f]=await Promise.all([Cn(),nP(),jI(),GI(),XI(),iP(e.appClientId),aP(e.appClientId)]);return{version:s.version,name:"Custom Block App",shared:i,sections:a,templates:h,layouts:c,slots:u,collections:f,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:s.dependencies.vue,openSource:s.openSource}}function On(e){return De(`${En}/${e}`)?ft.HEADER:De(`${Tn}/${e}`)?ft.FOOTER:ft.SECTION}async function Ln(e,s){const i=e.design?In(e.design):void 0,a={...e,design:i??e.design},c=await Fs(s);return us(a,c)}function kn(e){return e.type==="custom"&&e.id!==void 0&&e.showcase_overrides!==void 0}async function Lu(e){if(kn(e)){const s=await Gi(e.id,we[On(e.id)].dist);return{...e,showcase_overrides:await Ln(e.showcase_overrides,s)}}return e}async function oP(e){const s=kn(e.header)?{...e.header,showcase_overrides:await Ln(e.header.showcase_overrides,await Gi(e.header.id,we[On(e.header.id)].dist))}:e.header,i=kn(e.footer)?{...e.footer,showcase_overrides:await Ln(e.footer.showcase_overrides,await Gi(e.footer.id,we[On(e.footer.id)].dist))}:e.footer;return{...e,header:s,footer:i}}async function cP(e){const s=await Promise.all(e.pages.map(async a=>({...a,sections:await Promise.all(a.sections.map(c=>Lu(c)))}))),i=await oP(e.configuration);return{id:e.id,descriptor:{...i,pages:s}}}async function lP(e){return Promise.all(e.map(s=>cP(s)))}async function uP(e){const s=new Map;return await Promise.all(e.map(async i=>{const[a,c]=await Promise.all([Fs(i.translationsSettings),Fs(i.translationsShowcases)]);s.set(i.id,{settings:a,showcases:c})})),s}async function hP(e,s,i){const[a,c,u,h]=await Promise.all([Pn(e.content,s,e.type),wn(e.design,s,e.type),Ex(e.showcase,i),uu(e.layout)]);return{id:e.id,type:e.type,name:{en:e.name},contentEditors:a,designEditors:c,layouts:h,showcases:u,previewCount:e.previewCount}}async function pP(e,s){return Promise.all(e.map(async i=>{const a=s.get(i.id)??{settings:{},showcases:{}};return hP(i,a.settings,a.showcases)}))}async function dP(e){return Promise.all(e.map(async s=>{const i=await Promise.all(s.descriptor.sections.map(a=>Lu(a)));return{...s,descriptor:{...s.descriptor,sections:i}}}))}async function ku(e){const s=await uP(e.sections),[i,a,c,u,h]=await Promise.all([pP(e.sections,s),Rx(e.layouts),vI(e.slots,e.layouts),lP(e.templates),dP(e.collections)]);return{version:e.version,name:e.name,blocks:i,templates:u,layouts:a,slots:c,compressionEnabled:e.compressionEnabled,externalizationEnabled:e.externalizationEnabled,vueVersion:e.vueVersion,collections:h,openSource:e.openSource}}async function fP(e){const s=G(ei.cwd(),nu);return Pp(s,JSON.stringify(e))}function mP(e){return Object.entries(we).find(s=>s[1].source===e)?.[0]}async function Du(){const e=await W("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**","collections/**"]});return Promise.all(e.map(async s=>{const i=Ga(s).split(wr),a=i.pop()??"default",c=i.pop();if(c===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const u=["node_modules/**","dist/**"],[h,f,y,T,x,P,L,R]=await Promise.all([W(`**/${a}/client.{js,ts}`,{ignore:u}),W(`**/${a}/settings/content.{js,ts}`,{ignore:u}),W(`**/${a}/settings/design.{js,ts}`,{ignore:u}),W(`**/${a}/settings/layout.{js,ts}`,{ignore:u}),W(`**/${a}/settings/translations.{js,ts}`,{ignore:u}),W(`**/${a}/showcases/*.{js,ts}`,{ignore:[...u,`**/${a}/showcases/translations.{js,ts}`]}),W(`**/${a}/showcases/translations.{js,ts}`,{ignore:u}),W(`**/${a}/assets/*`,{ignore:u})]);return{name:a,type:mP(c),serverEntrypoint:s,clientEntrypoint:h.at(0),contentSettingsEntrypoint:f.at(0),designSettingsEntrypoint:y.at(0),layoutSettingsEntrypoint:T.at(0),settingsTranslationsEntrypoint:x.at(0),showcasesEntrypoints:P,showcasesTranslationsEntrypoint:L.at(0),assetsEntrypoints:R}}))}const yP=["/settings/","/showcases/"];function gP(e){return yP.some(s=>e.includes(s))}function EP(){const e=tt.findConfigFile(process.cwd(),tt.sys.fileExists,"tsconfig.json");if(!e)return;const s=tt.readConfigFile(e,tt.sys.readFile),i=tt.parseJsonConfigFileContent(s.config,tt.sys,process.cwd()),a=tt.createProgram(i.fileNames,i.options),c=tt.getPreEmitDiagnostics(a).filter(u=>!u.file||!gP(u.file.fileName));if(c.length>0){const u={getCanonicalFileName:h=>h,getCurrentDirectory:tt.sys.getCurrentDirectory,getNewLine:()=>tt.sys.newLine};throw console.error(tt.formatDiagnosticsWithColorAndContext(c,u)),new Error(`TypeScript found ${c.length} error(s)`)}}async function TP(e){EP(),await ht({configFile:!1,logLevel:"error",plugins:[rt.vue(),rt.tsconfigPaths(),rt.checker()],build:{write:!1,rollupOptions:{input:G(process.cwd(),e)}}})}function SP(){return Promise.all([Ir.rm("dist",{recursive:!0,force:!0}),Ir.rm("source-code",{recursive:!0,force:!0}),Ir.rm("source-code.zip",{force:!0})])}async function bP(){const e=new Wa,s=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"];(await Cn()).openSource===!0&&s.splice(s.indexOf("**/assets/**/*"),1);const i=await W("**/*",{cwd:G(process.cwd()),ignore:s,dot:!0,nodir:!0});try{i.forEach(u=>{const h=G(process.cwd(),u);e.addLocalFile(h,Za(u).dir)});const a=Us[se.SourceCode].fileName,c=G(process.cwd(),a);await e.writeZipPromise(c)}catch(a){throw _.error("Error while zipping source files"),a}}async function qi(e=!1,s=!1){Wx(s),Eu.start(),await SP();try{const[i,a,c]=await Promise.all([bI(),Du(),NI()]),u=a.map(Nu);a.length>0&&await TP(a[0].serverEntrypoint);try{await Promise.all([AI(),vu(u),MI(),FI(),II(i),OI(c),bP()])}finally{Eu.stop()}const h=await Ou(),f=await jx(h);Vx(f,e);const y=await ku(h);await fP(y)}catch(i){_.error(`Error while building: ${i.message}`),e||process.exit(1)}}async function Ye({entryPoints:e,configType:s,name:i,sectionType:a,sectionId:c,layoutId:u}){if(e.length!==0){const h=Qs(wu({name:i,entryPoints:e,configType:s,sectionType:a,sectionId:c,layoutId:u}));await ht({configFile:!1,...h})}}function Ru(e,s,i){Js.statSync(e).isDirectory()?(Js.mkdirSync(s,{recursive:!0}),Js.readdirSync(e).forEach(a=>{const c=Xs.resolve(e,a),u=Xs.resolve(s,a);Ru(c,u,i)})):Lp.isMatch(e,i,{dot:!0})||Js.copyFileSync(e,s)}function St(e,s,i,a,c=[]){const u=Xs.join(e,a?.[i]??i);Ru(Xs.join(s,i),u,c)}function xP(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>_.info(`Template [${e}] with pages structure named has been created`)}}function ct(e){return Re.resolve(kp(import.meta.url),"../..",e)}function IP(){const e=ct("package.json");return e!==""?JSON.parse(me.readFileSync(e,"utf8")):{}}async function PP(e){try{const s=e,i=Se.cwd(),a=Re.join(i,s),c=["templates","headers","preview","footers","reference","page-templates","layouts","collections","blank"],u={_gitignore:".gitignore"};me.existsSync(a)?(_.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),Se.exit(1)):me.mkdirSync(a);const h=ct("template");me.readdirSync(h).filter(x=>x!=="package.json").filter(x=>!c.includes(x)).forEach(async x=>St(a,h,x,u));const f=JSON.parse(me.readFileSync(Re.join(h,"package.json"),"utf-8"));f.name=e;const y=IP();y.version&&(f.dependencies["@lightspeed/crane-api"]=y.dependencies["@lightspeed/crane-api"]),y.dependencies["@lightspeed/eslint-config-crane"]&&(f.dependencies["@lightspeed/eslint-config-crane"]=y.dependencies["@lightspeed/eslint-config-crane"]);const T=Re.join(a,"package.json");me.writeFileSync(T,`${JSON.stringify(f,null,2)}
80
+ `),_.info(`App ${e} created`)}catch(s){_.error(`Error while creating app: ${s.message}`),Se.exit(1)}}function Dn(e,s,i,a){try{const c=Se.cwd(),u=Te.join(c,s);ee.existsSync(u)||ee.mkdirSync(u);const h=Te.join(c,s,i);ee.existsSync(h)?(_.error(`${a} with the name: ${i} already exists. If you'd like to override it, delete previous version first`),Se.exit(1)):ee.mkdirSync(h);const f=ct(e);ee.readdirSync(f).forEach(async y=>St(h,f,y)),_.info(`${a} ${i} created`)}catch(c){_.error(`Error while creating ${a}: ${c.message}`),Se.exit(1)}}function Rn(e){const s=Se.cwd(),i=ct(`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 wP(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 Jt({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),_.info(`Replaced "${e.name}" with template version.`)):_.info(`Kept existing "${e.name}".`):_.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`))}async function Yi(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 Yi(y,T,i):await wP(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 Mn(e=!1){try{const s=Se.cwd(),i=Te.join(s,"shared"),a=ct("template/shared");if(!ee.existsSync(a))return;await Yi(a,i,e)}catch(s){_.error(`Error while processing shared folder: ${s.message}`),Se.exit(1)}}async function AP(e,s){await Mn(),Dn(`${`template${s?"/blank":""}`}/sections/${`${s?"blank-section":"example-section"}`}`,"sections",e,"Section")}function CP(e){return{renameFiles:{"example-collection":`${e}`},targetPath:e,sourcePath:"template/collections",onCollectionCreated:()=>_.info(`Collection [${e}] has been created`)}}async function vP(e){const{targetPath:s,renameFiles:i,sourcePath:a,onCollectionCreated:c}=CP(e);try{const u=Se.cwd(),h=Re.join(u,"collections"),f=ct(a),y=me.readdirSync(f);me.existsSync(h)?me.existsSync(Re.join(h,s))&&(_.error(`Collection with the name: ${e} already exists. If you'd like to override it, delete previous version first`),Se.exit(1)):me.mkdirSync(h),y.forEach(T=>St(h,f,T,i)),c()}catch(u){_.error(`Error while creating collection: ${u.message}`),Se.exit(1)}}async function NP(e){await Mn(),Dn("template/footers/example-footer","footers",e,"Footer")}async function _P(e){await Mn(),Dn("template/headers/example-header","headers",e,"Header")}async function OP(e,s){try{const i=Se.cwd(),a=Re.join(i,"templates"),c=ct("template/page-templates/example-template/pages");me.existsSync(Re.join(a,e))||(_.error(`Template with the name: [${e}] doesn't exists. Please create a template first.`),Se.exit(1)),me.existsSync(Re.join(a,e,"pages",`${s}.ts`))&&(_.error(`Page with the name: [${s}.ts] already exists. If you'd like to override it, delete previous version first`),Se.exit(1));const u=me.readFileSync(Re.join(c,"custom.ts"),"utf-8").replace(/title\s*:\s*'Custom Page'/,`title: '${Mb(s)}'`),h=Re.join(a,e,"pages",`${s}.ts`);me.writeFileSync(h,u),_.info(`Page [${s}.ts] created for template ${e}`)}catch(i){_.error(`Error while creating page: ${i.message}`),Se.exit(1)}}async function LP(){try{const e=Se.cwd(),s=ct("template/reference"),i=me.readdirSync(s);let a=!1;for(const c of i){const u=Re.join(s,c),h=Re.join(e,c);me.existsSync(h)||me.mkdirSync(h,{recursive:!0});const f=me.readdirSync(u),y=me.readdirSync(h);if(c==="shared"){f.forEach(T=>{St(h,u,T)});continue}for(const T of f){if(T==="assets"){St(h,u,T);continue}if(y.includes(T)){const{name:x}=await Jt({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.`});x?(St(h,u,T,{[T]:x}),a=!0):_.info(`Skipped: ${T}`)}else St(h,u,T)}}_.info("Reference templates have been added to the app"),a&&_.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){_.error(`Error while creating template descriptors: ${e.message}`),Se.exit(1)}}const kP=["**/example-template/pages/custom.ts"];async function DP(e){const{targetPath:s,renameFiles:i,sourcePath:a,onTemplateCreated:c}=xP(e);try{const u=Se.cwd(),h=Re.join(u,"templates"),f=ct(a),y=me.readdirSync(f);me.existsSync(h)?me.existsSync(Re.join(h,s))&&(_.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),Se.exit(1)):me.mkdirSync(h),y.forEach(T=>St(h,f,T,i,kP)),Rn("headers"),Rn("footers"),Rn("layouts"),c()}catch(u){_.error(`Error while creating template descriptors: ${u.message}`),Se.exit(1)}}function RP(){try{const e=G(ei.cwd(),`${ru}/shared/analytics.json`);De(e)&&Pr(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}function Ji({deploymentContext:e,sectionType:s=ft.SECTION}){const i=e.pathContext,a=i.toPath({sectionId:e.currentSection,sectionType:s,layoutId:e.layoutId,slotId:e.slotId}),c=a===void 0?Ka(i.fileName):Ka(i.fileName,{cwd:G(process.cwd(),a),ignore:i.ignore});return(i.isSingleton?c.splice(0):c).map(u=>({url:u,sectionType:s,context:e}))}const MP=e=>e.app.manifest.blocks.flatMap(s=>vx.flatMap(i=>{const a={config:e,currentSection:s.id,pathContext:Us[i]};return Ji({deploymentContext:a,sectionType:s.type})})),$P=e=>Ox.flatMap(s=>{const i={config:e,pathContext:Us[s]};return Ji({deploymentContext:i})}),FP=e=>e.app.manifest.layouts.flatMap(s=>Nx.flatMap(i=>{const a={config:e,pathContext:Us[i],currentSection:s.sectionId,layoutId:s.id};return Ji({deploymentContext:a})})),BP=e=>e.app.manifest.slots.flatMap(s=>_x.flatMap(i=>{const a={config:e,pathContext:Us[i],currentSection:s.sectionId,layoutId:s.layoutId,slotId:s.id};return Ji({deploymentContext:a})})),UP=e=>`\x1B[32m${e}\x1B[0m`,jP=(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`})},zP=()=>new Mp.SingleBar({format:`|${UP("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});async function Mu(e){await new Promise(s=>setTimeout(s,e))}const $u="Please ensure you have built your application before deploying.";async function VP(){try{const e=await Ar(G(ei.cwd(),nu));return JSON.parse(e.toString())}catch(e){throw e.code==="ENOENT"?new Error(`Manifest file not found. ${$u}`):e instanceof SyntaxError?new Error(`Manifest file is not valid. ${$u}`):e}}const GP={value:0},Je=zP();let Fu=Date.now();const Bu=e=>2**e*500;async function HP(e){const s=Rp(e.version,"patch");if(s===null)throw Error("Error while incrementing app version");e.version=s,Pr(G(xe.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
81
+ `)}function ZP(e){return e instanceof Ya&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function Uu(e,s){return e<Cx&&ZP(s)}async function ju(e,s,i,a){const c={value:0},u=e.config.app.manifest.templates.length>0||e.config.app.manifest.collections.length>0?Ix:xx;return e.config.axios.post(u,{file:dp(G(xe.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=>jP(h,Je,GP,c,Fu)}).then(h=>(Je.increment(),h)).catch(async h=>{if(Uu(a,h))return await Mu(Bu(a)),ju(e,s,i,a+1);throw Je.increment(),h})}function WP(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 ju(i,s.url,a,0)})}function KP(e){const s=[...MP(e),...$P(e),...FP(e),...BP(e)];return WP(s)}async function zu(e,s=0){const i=e.app.manifest.templates.length>0||e.app.manifest.collections.length>0?wx:Px;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(Uu(s,a))return await Mu(Bu(s)),zu(e,s+1);throw a})}async function qP(e){try{if(!Ob.some(h=>De(G(xe.cwd(),h))))throw new Error(ps.INCORRECT_DISTRIBUTION_FOLDER(Nb));const s=e??An;_.info("Custom application deployment :: Started");const i=Cr.create({baseURL:s});Dp(i,Ax),_.info("Loading configuration files ...");const a=await Promise.all([zi(),Cn(),VP()]).then(([h,f,y])=>({axios:i,app:{crane:h,packageJson:f,manifest:y}}));_.info("Uploading files ..."),Fu=Date.now(),await Promise.all(KP(a)).catch(h=>{Je.stop(),h.response?.status===404?_.error(Gt(h,ps.DEPRECATED_VERSION_DEPLOYMENT)):_.error(Gt(h,ps.ASSET_FILES_UPLOAD)),xe.exit(1)}).finally(()=>{Je.increment(),Je.stop()}),Je.update({speed:"N/A",status:"Finalising deployment"}),await zu(a).catch(h=>{Je.stop(),h.response?.status===404?_.error(Gt(h,ps.DEPRECATED_VERSION_DEPLOYMENT)):_.error(Gt(h,ps.MANIFEST_DEPLOYMENT)),xe.exit(1)}).finally(()=>{Je.increment(),Je.stop()});const c=a.app.manifest.blocks.map(h=>h.id),u=a.app.packageJson.version;_.info("Custom application deployment :: Successful"),_.info(`Current app version: ${u}`),_.info(`Deployed sections: ${c.sort().join(", ")}`),await HP(a.app.packageJson),a.app.manifest.templates.length>0&&_.info(`Deployed templates: ${a.app.manifest.templates.map(h=>h.id).sort().join(", ")}`),a.app.manifest.slots.length>0&&_.info(`Deployed slots: ${a.app.manifest.slots.map(h=>h.id).sort().join(", ")}`),a.app.manifest.collections.length>0&&_.info(`Deployed collections: ${a.app.manifest.collections.map(h=>h.id).sort().join(", ")}`)}catch(s){Je.stop(),_.error(Gt(s,ps.DEFAULT)),xe.exit(1)}finally{RP()}}function YP(){process.env.CRANE_DEBUG_ENABLED="true"}function JP(){return process.env.CRANE_DEBUG_ENABLED==="true"}function XP(e,...s){JP()&&console.debug(Sp(`[DEBUG] ${e}`),...s)}function QP(){return{name:"app-block-api",configureServer(e){e.middlewares.use(async(s,i,a)=>{e.moduleGraph.invalidateAll();const c=new wp(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 Ou(),f=(await ku(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 Zt=null;function ew(){Zt&&Zt.clients.forEach(e=>{e.readyState===Fp.OPEN&&e.send(JSON.stringify({type:"full-reload"}))})}async function tw(e,s){const i=G(`${e}/ssr-server.ts`),a=G(s);await ht({build:{lib:{entry:i,formats:["es"],fileName:()=>"ssr-server.mjs"},outDir:a,emptyOutDir:!1,minify:!1,rollupOptions:{external:["http","fs","@swc/core","module-from-string","linkedom"],output:{entryFileNames:"ssr-server.mjs"}},target:"esnext"}})}async function sw(e,s){const i=G(`${e}/shared/preview.ts`),a=G(`${e}/shared/utils.ts`),c=G(`${e}/shared/api-routes.ts`),u=G(s);await ht({build:{lib:{entry:i,formats:["es"],fileName:()=>"preview.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await ht({build:{lib:{entry:a,formats:["es"],fileName:()=>"utils.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await ht({build:{lib:{entry:c,formats:["es"],fileName:()=>"api-routes.js"},outDir:u,emptyOutDir:!1,minify:!1,rollupOptions:{external:["path","fs","http","https","url","stream","util","events","buffer"],output:{entryFileNames:"api-routes.js"}},target:"esnext"}})}async function iw(){const e="preview",s=`${e}/shared`,i="vite.config.js",a=`${e}/sections`,c=`${a}/preview.html`;[e,a].forEach(y=>{ee.existsSync(y)||ee.mkdirSync(y,{recursive:!0})});const u=ct("template/preview");ee.copyFileSync(`${u}/${i}`,`${e}/${i}`),await tw(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 sw(u,s)}function rw(e){const s=e.replace(/\\/g,"/").match(/(?:sections|headers|footers)\/([^/]+)/);return s?s[1]:null}function nw(e){const s=e.replace(/\\/g,"/");return s.includes("shared")&&!s.includes("sections")&&!s.includes("headers")&&!s.includes("footers")}async function aw(e){const s=(await Du()).find(a=>a.name===e);if(!s){console.warn(`Block ${e} not found, falling back to full build`),await qi(!0);return}const i=Nu(s);await vu([i]),console.log(`Block ${e} rebuilt successfully`)}var ow=(e=>(e.FULL="full",e.INCREMENTAL="incremental",e))(ow||{});function cw(){return{timeout:null,inProgress:!1,pendingBuild:null}}function lw(e,s){const i=async a=>{e.inProgress=!0;try{a.type==="incremental"&&a.blockName?await aw(a.blockName):await qi(!0),s.ws.send({type:"full-reload",path:"*"}),ew()}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 uw(e){const s=e.replace(/\\/g,"/"),i=s.match(/sections\/([^/]+)/),a=s.match(/headers\/([^/]+)/),c=s.match(/footers\/([^/]+)/),u=s.match(/shared\//);return!!(i||a||c||u)}function hw(e,s){return async i=>{if(!uw(i))return;e.timeout&&clearTimeout(e.timeout);const a=rw(i),c=nw(i);e.timeout=setTimeout(async()=>{c?await s({type:"full"}):a&&await s({type:"incremental",blockName:a})},1e3)}}function pw(e,s){const i=cw(),a=lw(i,e),c=hw(i,a);e.watcher.add(s),e.watcher.on("add",c),e.watcher.on("change",c),e.watcher.on("unlink",c)}async function dw(){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=qa(e).href);const i=await import(s),{server:a,port:c}=await i.startServer();return{server:a,port:c}}function fw(){Zt=new $p({port:0}),Zt.on("listening",()=>{const e=Zt?.address();if(e&&typeof e=="object"){const s=e.port;process.env.CRANE_WEBSOCKET_PORT=String(s)}})}async function mw(){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(),"shared/**/*"),u=await xp({configFile:e,root:process.cwd(),plugins:[QP()]});return await u.listen(),pw(u,[s,i,a,c]),u}async function yw(){await qi(),await iw(),console.log(`
60
82
  \u{1F4E6} Starting preview servers...
61
- `);let e=null,t=null;ag("Starting SSR server");const n=await Og();e=n.server,t=n.port,process.env.PREVIEW_SSR_PORT=String(t),Ig();const o=await wg(),r=()=>{e&&e.close(),ke&&ke.close(),o.close(),process.exit(0)};return process.on("SIGINT",r),process.on("SIGTERM",r),o}const Cg=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i,Rg=/^[-a-zA-Z0-9_.^~<>=|* +]+$/;function Ei({name:e,version:t}){return Cg.test(e)&&Rg.test(t)}function rn(e){if(!V(e))return{dependencies:{},devDependencies:{},overrides:{}};let t;try{t=JSON.parse(cn(e,"utf-8"))}catch{return{dependencies:{},devDependencies:{},overrides:{}}}const n=t.overrides??{},o=Object.fromEntries(Object.entries(n).filter(r=>typeof r[1]=="string"));return{dependencies:t.dependencies??{},devDependencies:t.devDependencies??{},overrides:o}}function bg(e,t){const n=rn(ne(e,"package.json")),o=rn(ne(t,"package.json")),r={...o.dependencies,...o.devDependencies},s=[];for(const[i,a]of Object.entries(n.dependencies))r[i]||s.push({name:i,version:a,isDev:!1});for(const[i,a]of Object.entries(n.devDependencies))r[i]||s.push({name:i,version:a,isDev:!0});return s.sort((i,a)=>i.name.localeCompare(a.name))}function Ag(e,t){const n=rn(ne(e,"package.json")).overrides,o=rn(ne(t,"package.json")).overrides;return Object.fromEntries(Object.entries(n).filter(([r,s])=>o[r]!==s))}function Ng(e){const t=Object.entries(e);if(t.length!==0){f.warn(`
62
- The pulled source code defines npm overrides not present in your project:`);for(const[n,o]of t)f.warn(` - ${n}: "${o}"`);f.warn('Review these and add them to your package.json "overrides" section if needed.')}}function gi(e){return e.map(t=>`${t.name}@${t.version}`).join(" ")}function $g(e){const t=e.filter(r=>!r.isDev),n=e.filter(r=>r.isDev),o=[];return t.length>0&&o.push(`npm install ${gi(t)}`),n.length>0&&o.push(`npm install -D ${gi(n)}`),o}function Lg(e,t){const n=[{args:["install"],specs:e.filter(o=>!o.isDev).map(o=>`${o.name}@${o.version}`)},{args:["install","-D"],specs:e.filter(o=>o.isDev).map(o=>`${o.name}@${o.version}`)}];for(const{args:o,specs:r}of n){if(r.length===0)continue;const s=[...o,...r];f.info(`Running: npm ${s.join(" ")}`);const i=Ki("npm",s,{cwd:t,stdio:"inherit"});if(i.status!==0)throw new Error(`npm ${o.join(" ")} exited with code ${i.status}`)}}async function Dg(e,t){if(e.length===0)return;const n=e.filter(c=>!Ei(c));if(n.length>0){f.warn("Skipping dependencies with unsafe names/versions:");for(const c of n)f.warn(` - ${c.name}@${c.version}`)}const o=e.filter(Ei);if(o.length===0)return;const r=o.length===1?"dependency":"dependencies";f.warn(`
63
- The pulled source code uses ${o.length} ${r} not found in your project:`);const s=o.filter(c=>!c.isDev),i=o.filter(c=>c.isDev);if(s.length>0){f.warn(" dependencies:");for(const c of s)f.warn(` - ${c.name}@${c.version}`)}if(i.length>0){f.warn(" devDependencies:");for(const c of i)f.warn(` - ${c.name}@${c.version}`)}const a=$g(o);switch((await Pe({type:"select",name:"value",message:"How would you like to handle these dependencies?",choices:[{title:"Install dependencies now",value:"install",description:`Runs: ${a.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{Lg(o,t),f.info("Dependencies installed successfully.")}catch{f.error("Failed to install dependencies. You can try running the commands manually:");for(const c of a)f.warn(` ${c}`)}break;case"add":{const c=ne(t,"package.json"),u=JSON.parse(cn(c,"utf-8"));if(s.length>0){u.dependencies||(u.dependencies={});for(const d of s)u.dependencies[d.name]=d.version;u.dependencies=Object.fromEntries(Object.entries(u.dependencies).sort(([d],[m])=>d.localeCompare(m)))}if(i.length>0){u.devDependencies||(u.devDependencies={});for(const d of i)u.devDependencies[d.name]=d.version;u.devDependencies=Object.fromEntries(Object.entries(u.devDependencies).sort(([d],[m])=>d.localeCompare(m)))}ln(c,`${JSON.stringify(u,null,2)}
64
- `),f.info('Dependencies added to package.json. Run "npm install" to install them.');break}case"show":f.info(`
65
- Run the following command(s) to install the dependencies:`);for(const c of a)f.info(` ${c}`);break;default:f.info("Skipping dependency installation.");break}}async function kg(e,t,n){const o=t.split("_").pop()??t,r=ne(e,"sections",o),s=ne(e,o);let i=null;if(V(r)&&Qe(r).isDirectory()?i=r:V(s)&&Qe(s).isDirectory()&&(i=s),i){const a=ne(n,o);V(a)&&((await Pe({type:"confirm",name:"value",message:`Section directory [sections/${o}/] already exists. Do you want to overwrite it?`,initial:!1})).value||(f.error("Operation cancelled. Section directory already exists."),M.exit(1)),f.info(`Deleting existing section directory [sections/${o}/]...`),po(a,{recursive:!0,force:!0})),f.info(`Copying section [sections/${o}/]...`),await nn(i,a,!1)}else f.error(`Section directory [sections/${o}/] not found in source code.`),M.exit(1)}async function Pg(e,t,n){const o=Ii(ne(Yi.tmpdir(),"crane-source-"));new Eo(Buffer.from(e)).extractAllTo(o,!0);try{const r=M.cwd(),s=ne(r,"sections");V(s)||wi(s,{recursive:!0}),await kg(o,t,s);const i=ne(o,"shared");if(V(i)){const c=ne(r,"shared");f.info("Copying shared folder..."),await nn(i,c,!0)}const a=bg(o,r);await Dg(a,r),Ng(Ag(o,r)),f.info(`Source code for section [${n}] has been copied.`)}finally{po(o,{recursive:!0,force:!0})}}async function _i(e){const t=e??Qn,n=fn.create({baseURL:t}),o=await Yt();return[...(await n.get("/api/v1/custom-apps/manifests/collections/sections",{params:{appClientId:o.appClientId},headers:{Authorization:`Bearer ${o.appSecretKey}`}})).data.sections]}async function zg(e,t){const n=(await _i(t)).find(o=>o.sectionId===e);return n||(f.error(`Section [${e}] not found in collection sections list.`),M.exit(1)),n}async function jg(e,t,n){const o=n??Qn,r=fn.create({baseURL:o}),s=await Yt();f.info(`Downloading source code for section [${e}]...`);const i=await r.get(`/api/v1/custom-apps/manifests/collections/sections/${e}/source-code`,{params:{appClientId:s.appClientId},headers:{Authorization:`Bearer ${s.appSecretKey}`},responseType:"arraybuffer"});await Pg(i.data,t,e)}async function Ug(e){try{f.info("Fetching sections list...");const t=await _i(e);f.info("Sections list retrieved successfully:");const n=t.map(o=>({sectionId:o.sectionId,openSource:o.openSource,type:o.type}));console.log(JSON.stringify({sections:n},null,2))}catch(t){f.error(Le(t,"Error while fetching sections list")),M.exit(1)}}async function Mg(e,t){try{const n=await zg(e,t);n.openSource||(f.error(`Section [${e}] is not open source. Only open source sections can be pulled.`),M.exit(1)),await jg(e,n.sectionId,t)}catch(n){f.error(Le(n,"Error while pulling section")),M.exit(1)}}async function Fg(e,t){const{list:n,section:o}=e;if(n){await Ug(t);return}if(o){await Mg(o,t);return}f.error("Please specify an action. Use --list to fetch sections list or --section to pull a section."),M.exit(1)}const Gg={deploy:["url"],pull:["url"],init:[""],build:["generatePreview"]},xg=["preview","build","deploy","pull"];function Bg(e,t){return xg.includes(e.rawName)?!1:e.options.length!==0&&Object.keys(t).length===1}function Zg(e){return e.includes("-h")||e.includes("--help")}function Hg(e,t){return Object.keys(t).some(n=>n!=="--"&&!e.hasOption(n)&&!Gg[e.rawName]?.includes(n))}function Vg(e){return e.length!==0}function Wg(e,t,n){return e.matchedCommand!==void 0&&(Bg(e.matchedCommand,n)||Zg(e.rawArgs)||Hg(e.matchedCommand,e.options)||Vg(t))}function Yg(e,t,n){e.matchedCommand&&!Wg(e,t,n)?e.runMatchedCommand():e.outputHelp()}function sn(e){if(Hf(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:n}=Zf(e);return n&&console.log(n),t}async function uo(e){const t=await Pe({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(t.name!==void 0){const n=z.basename(t.name);return sn(n)?n:uo(e)}}async function Kg(e,t,n,o){const r=await uo(t);return r===void 0?(console.log(`You can use ${n} to directly specify the name of the ${t}.`),e.outputHelp()):o(r)}async function Xe(e,t,n,o,r){if(r!==void 0)if(!sn(r))await Kg(e,t,n,o);else{const s=z.basename(r.toString());await o(s)}}function Jg(){C.existsSync("./templates")||(f.error(`No template found. Please create a template first using ${ce("init --template <name>")}`),process.exit(1));const e=C.readdirSync("./templates",{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name).filter(t=>t!=="assets");return e.length===0&&(f.error(`No template found. Please create a template first using ${ce("init --template <name>")}`),process.exit(1)),e}async function Xg(e){const t=Jg();if(typeof e=="string"||typeof e=="number"){if(t.includes(e.toString()))return e.toString();sn(e)?f.warn(`Template [${e}] doesn't exist`):f.error(`[${e}] is an invalid template name.`)}const n=await Pe({type:"select",name:"choice",message:"Please choose a template:",choices:t.map(o=>({title:o,value:o}))});return n.choice||(f.error("No template selected"),process.exit(1)),n.choice}async function Qg(e,t){if(typeof t=="string"||typeof t=="number"){if(sn(t))return t.toString();f.error(`${t} is invalid name.`)}return uo(e)}async function qg(e,t,n){const o=await Xg(t),r=await Qg("page",n);if(r===void 0)return console.log(`You can use ${ce("init --page <name>")} to directly specify the name of the page.`),e.outputHelp();await FE(o,r)}async function e_(e,t){try{const{app:n,section:o,header:r,footer:s,template:i,referenceTemplate:a,page:c,blank:u,collection:d}=e;await Xe(t,"app",ce("init --app <name>"),DE,n),await Xe(t,"section",ce(`init --section <name>${u?" --blank":""}`),m=>PE(m,u===!0),o),await Xe(t,"header",ce("init --header <name>"),ME,r),await Xe(t,"footer",ce("init --footer <name>"),UE,s),c===void 0?await Xe(t,"template",ce("init --template <name>"),BE,i):await qg(t,i,c),await Xe(t,"collection",ce("init --collection <name>"),jE,d),a&&await GE()}catch(n){f.error(`Error while executing init operation: ${n.message}`),process.exit(1)}}function t_(){try{const e=Ci("crane");e.option("-h, --help","Display this message"),e.command("init","Initialize a new resource in the form of a directory.").option("--app [name]","Creates an app folder inside your current directory.").option("--section [name]","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header [name]","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer [name]","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template [name]","Creates the directory and files necessary to build a custom template inside your app folder.").option("--collection [name]","Creates a collection folder containing custom sections, headers, and footers.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").option("--page [name]","Create the file necessary for one custom page with the given name, this can be repeated for each custom page.").option("--blank","Creates an empty resource with minimal files (use with section).").allowUnknownOptions().action(async n=>e_(n,e)),e.command("build","Builds your resource code").option("-v, --verbose","Show detailed build output").allowUnknownOptions().action(n=>tn(!1,n.verbose===!0)),e.command("preview","Runs a local server to preview resources").option("--verbose","Show debug logs").allowUnknownOptions().action(async n=>{n.verbose&&sg(),await vg()}),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>rg(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 n=>Fg(n,e.options.url)),e.version(Ji),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});Yg(e,t.args,t.options)}catch(e){f.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{t_ as run};
83
+ `);let e=null,s=null;XP("Starting SSR server");const i=await dw();e=i.server,s=i.port,process.env.PREVIEW_SSR_PORT=String(s),fw();const a=await mw(),c=()=>{e&&e.close(),Zt&&Zt.close(),a.close(),process.exit(0)};return process.on("SIGINT",c),process.on("SIGTERM",c),a}const gw=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i,Ew=/^[-a-zA-Z0-9_.^~<>=|* +]+$/;function Vu({name:e,version:s}){return gw.test(e)&&Ew.test(s)}function Xi(e){if(!De(e))return{dependencies:{},devDependencies:{},overrides:{}};let s;try{s=JSON.parse(xr(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 Tw(e,s){const i=Xi(We(e,"package.json")),a=Xi(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 Sw(e,s){const i=Xi(We(e,"package.json")).overrides,a=Xi(We(s,"package.json")).overrides;return Object.fromEntries(Object.entries(i).filter(([c,u])=>a[c]!==u))}function bw(e){const s=Object.entries(e);if(s.length!==0){_.warn(`
84
+ The pulled source code defines npm overrides not present in your project:`);for(const[i,a]of s)_.warn(` - ${i}: "${a}"`);_.warn('Review these and add them to your package.json "overrides" section if needed.')}}function Gu(e){return e.map(s=>`${s.name}@${s.version}`).join(" ")}function xw(e){const s=e.filter(c=>!c.isDev),i=e.filter(c=>c.isDev),a=[];return s.length>0&&a.push(`npm install ${Gu(s)}`),i.length>0&&a.push(`npm install -D ${Gu(i)}`),a}function Iw(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];_.info(`Running: npm ${u.join(" ")}`);const h=Up("npm",u,{cwd:s,stdio:"inherit"});if(h.status!==0)throw new Error(`npm ${a.join(" ")} exited with code ${h.status}`)}}async function Pw(e,s){if(e.length===0)return;const i=e.filter(y=>!Vu(y));if(i.length>0){_.warn("Skipping dependencies with unsafe names/versions:");for(const y of i)_.warn(` - ${y.name}@${y.version}`)}const a=e.filter(Vu);if(a.length===0)return;const c=a.length===1?"dependency":"dependencies";_.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){_.warn(" dependencies:");for(const y of u)_.warn(` - ${y.name}@${y.version}`)}if(h.length>0){_.warn(" devDependencies:");for(const y of h)_.warn(` - ${y.name}@${y.version}`)}const f=xw(a);switch((await Jt({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{Iw(a,s),_.info("Dependencies installed successfully.")}catch{_.error("Failed to install dependencies. You can try running the commands manually:");for(const y of f)_.warn(` ${y}`)}break;case"add":{const y=We(s,"package.json"),T=JSON.parse(xr(y,"utf-8"));if(u.length>0){T.dependencies||(T.dependencies={});for(const x of u)T.dependencies[x.name]=x.version;T.dependencies=Object.fromEntries(Object.entries(T.dependencies).sort(([x],[P])=>x.localeCompare(P)))}if(h.length>0){T.devDependencies||(T.devDependencies={});for(const x of h)T.devDependencies[x.name]=x.version;T.devDependencies=Object.fromEntries(Object.entries(T.devDependencies).sort(([x],[P])=>x.localeCompare(P)))}Pr(y,`${JSON.stringify(T,null,2)}
86
+ `),_.info('Dependencies added to package.json. Run "npm install" to install them.');break}case"show":_.info(`
87
+ Run the following command(s) to install the dependencies:`);for(const y of f)_.info(` ${y}`);break;default:_.info("Skipping dependency installation.");break}}async function ww(e,s,i){const a=s.split("_").pop()??s,c=We(e,"sections",a),u=We(e,a);let h=null;if(De(c)&&Ps(c).isDirectory()?h=c:De(u)&&Ps(u).isDirectory()&&(h=u),h){const f=We(i,a);De(f)&&((await Jt({type:"confirm",name:"value",message:`Section directory [sections/${a}/] already exists. Do you want to overwrite it?`,initial:!1})).value||(_.error("Operation cancelled. Section directory already exists."),xe.exit(1)),_.info(`Deleting existing section directory [sections/${a}/]...`),Va(f,{recursive:!0,force:!0})),_.info(`Copying section [sections/${a}/]...`),await Yi(h,f,!1)}else _.error(`Section directory [sections/${a}/] not found in source code.`),xe.exit(1)}async function Aw(e,s,i){const a=fp(We(Bp.tmpdir(),"crane-source-"));new Wa(Buffer.from(e)).extractAllTo(a,!0);try{const c=xe.cwd(),u=We(c,"sections");De(u)||mp(u,{recursive:!0}),await ww(a,s,u);const h=We(a,"shared");if(De(h)){const y=We(c,"shared");_.info("Copying shared folder..."),await Yi(h,y,!0)}const f=Tw(a,c);await Pw(f,c),bw(Sw(a,c)),_.info(`Source code for section [${i}] has been copied.`)}finally{Va(a,{recursive:!0,force:!0})}}async function Hu(e){const s=e??An,i=Cr.create({baseURL:s}),a=await zi();return[...(await i.get("/api/v1/custom-apps/manifests/collections/sections",{params:{appClientId:a.appClientId},headers:{Authorization:`Bearer ${a.appSecretKey}`}})).data.sections]}async function Cw(e,s){const i=(await Hu(s)).find(a=>a.sectionId===e);return i||(_.error(`Section [${e}] not found in collection sections list.`),xe.exit(1)),i}async function vw(e,s,i){const a=i??An,c=Cr.create({baseURL:a}),u=await zi();_.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 Aw(h.data,s,e)}async function Nw(e){try{_.info("Fetching sections list...");const s=await Hu(e);_.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){_.error(Gt(s,"Error while fetching sections list")),xe.exit(1)}}async function _w(e,s){try{const i=await Cw(e,s);i.openSource||(_.error(`Section [${e}] is not open source. Only open source sections can be pulled.`),xe.exit(1)),await vw(e,i.sectionId,s)}catch(i){_.error(Gt(i,"Error while pulling section")),xe.exit(1)}}async function Ow(e,s){const{list:i,section:a}=e;if(i){await Nw(s);return}if(a){await _w(a,s);return}_.error("Please specify an action. Use --list to fetch sections list or --section to pull a section."),xe.exit(1)}const Lw={deploy:["url"],pull:["url"],init:[""],build:["generatePreview"]},kw=["preview","build","deploy","pull"];function Dw(e,s){return kw.includes(e.rawName)?!1:e.options.length!==0&&Object.keys(s).length===1}function Rw(e){return e.includes("-h")||e.includes("--help")}function Mw(e,s){return Object.keys(s).some(i=>i!=="--"&&!e.hasOption(i)&&!Lw[e.rawName]?.includes(i))}function $w(e){return e.length!==0}function Fw(e,s,i){return e.matchedCommand!==void 0&&(Dw(e.matchedCommand,i)||Rw(e.rawArgs)||Mw(e.matchedCommand,e.options)||$w(s))}function Bw(e,s,i){e.matchedCommand&&!Fw(e,s,i)?e.runMatchedCommand():e.outputHelp()}function Qi(e){if(Db(e))return console.log("Please specify a name for your resource."),!1;const{isValid:s,errorMessage:i}=kb(e);return i&&console.log(i),s}async function $n(e){const s=await Jt({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(s.name!==void 0){const i=Te.basename(s.name);return Qi(i)?i:$n(e)}}async function Uw(e,s,i,a){const c=await $n(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 ys(e,s,i,a,c){if(c!==void 0)if(!Qi(c))await Uw(e,s,i,a);else{const u=Te.basename(c.toString());await a(u)}}function jw(){ee.existsSync("./templates")||(_.error(`No template found. Please create a template first using ${et("init --template <name>")}`),process.exit(1));const e=ee.readdirSync("./templates",{withFileTypes:!0}).filter(s=>s.isDirectory()).map(s=>s.name).filter(s=>s!=="assets");return e.length===0&&(_.error(`No template found. Please create a template first using ${et("init --template <name>")}`),process.exit(1)),e}async function zw(e){const s=jw();if(typeof e=="string"||typeof e=="number"){if(s.includes(e.toString()))return e.toString();Qi(e)?_.warn(`Template [${e}] doesn't exist`):_.error(`[${e}] is an invalid template name.`)}const i=await Jt({type:"select",name:"choice",message:"Please choose a template:",choices:s.map(a=>({title:a,value:a}))});return i.choice||(_.error("No template selected"),process.exit(1)),i.choice}async function Vw(e,s){if(typeof s=="string"||typeof s=="number"){if(Qi(s))return s.toString();_.error(`${s} is invalid name.`)}return $n(e)}async function Gw(e,s,i){const a=await zw(s),c=await Vw("page",i);if(c===void 0)return console.log(`You can use ${et("init --page <name>")} to directly specify the name of the page.`),e.outputHelp();await OP(a,c)}async function Hw(e,s){try{const{app:i,section:a,header:c,footer:u,template:h,referenceTemplate:f,page:y,blank:T,collection:x}=e;await ys(s,"app",et("init --app <name>"),PP,i),await ys(s,"section",et(`init --section <name>${T?" --blank":""}`),P=>AP(P,T===!0),a),await ys(s,"header",et("init --header <name>"),_P,c),await ys(s,"footer",et("init --footer <name>"),NP,u),y===void 0?await ys(s,"template",et("init --template <name>"),DP,h):await Gw(s,h,y),await ys(s,"collection",et("init --collection <name>"),vP,x),f&&await LP()}catch(i){_.error(`Error while executing init operation: ${i.message}`),process.exit(1)}}function Zw(){try{const e=gp("crane");e.option("-h, --help","Display this message"),e.command("init","Initialize a new resource in the form of a directory.").option("--app [name]","Creates an app folder inside your current directory.").option("--section [name]","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header [name]","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer [name]","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template [name]","Creates the directory and files necessary to build a custom template inside your app folder.").option("--collection [name]","Creates a collection folder containing custom sections, headers, and footers.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").option("--page [name]","Create the file necessary for one custom page with the given name, this can be repeated for each custom page.").option("--blank","Creates an empty resource with minimal files (use with section).").allowUnknownOptions().action(async i=>Hw(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&&YP(),await yw()}),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>qP(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=>Ow(i,e.options.url)),e.version(jp),e.usage("<action> <resource>");const s=e.parse(process.argv,{run:!1});Bw(e,s.args,s.options)}catch(e){_.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{Zw as run};