@power-plant/schema 0.0.24 → 0.0.26

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/index.mjs CHANGED
@@ -1,12 +1,707 @@
1
- import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./constants-lk1mMbgx.mjs";import{$ as s,A as c,B as l,C as u,D as d,E as f,F as ee,G as te,H as ne,I as re,J as p,K as ie,L as ae,M as oe,N as se,O as ce,P as le,Q as ue,R as de,S as fe,T as pe,U as me,V as he,W as ge,X as _e,Y as m,Z as ve,_ as ye,a as be,b as xe,c as Se,d as Ce,et as we,f as Te,g as Ee,h as De,i as Oe,it as ke,j as Ae,k as je,l as Me,m as h,n as Ne,nt as Pe,o as Fe,p as Ie,q as Le,r as Re,rt as ze,s as Be,t as Ve,tt as He,u as Ue,v as We,w as Ge,x as Ke,y as qe,z as Je}from"./helpers-Km2QO1Vz.mjs";import{n as Ye,r as Xe,t as Ze}from"./storage-CwlNwPrn.mjs";import{builtinModules as Qe}from"node:module";import{isSetObject as g}from"@stryke/type-checks/is-set-object";import{isSetString as $e}from"@stryke/type-checks/is-set-string";import{isSetString as _}from"@stryke/type-checks";import{extractFileReference as et}from"@stryke/convert/extract-file-reference";import tt,{existsSync as nt,realpathSync as rt,statSync as it}from"node:fs";import{joinPaths as at}from"@stryke/path/join-paths";import{resolveParentPath as ot}from"@stryke/path/resolve-parent-path";import{toArray as st}from"@stryke/convert/to-array";import{cwd as ct}from"@stryke/path/cwd";import{findFolderName as lt}from"@stryke/path/file-path-fns";import ut,{join as dt}from"node:path";import{fileURLToPath as v,pathToFileURL as ft}from"node:url";import y from"node:assert";import b from"node:process";import pt from"node:v8";import{format as mt,inspect as ht}from"node:util";import{isSystemRoot as gt}from"@stryke/path/is-root-dir";import"@stryke/path";import{correctPath as _t,toAbsolutePath as vt}from"@stryke/path/correct-path";import{getUnique as yt}from"@stryke/helpers/get-unique";import{isAbsolutePath as bt,isNpmScopedPackage as xt}from"@stryke/path/is-type";import{murmurhash as x}from"@stryke/hash";import{deepClone as St}from"@stryke/helpers/deep-clone";import{isStandardJsonSchema as Ct}from"@stryke/json";import{findFileExtensionSafe as wt}from"@stryke/path/find";import{VALID_OBJECT_SOURCE_EXTENSIONS as Tt}from"@stryke/resolve/constants";import{loadSafe as Et}from"@stryke/resolve/load";import{list as Dt}from"@stryke/string-format/list";import{extractJsonSchema as Ot,isZod3Type as kt}from"@stryke/zod";import{toJsonSchema as At}from"@valibot/to-json-schema";import{createGenerator as jt}from"ts-json-schema-generator/dist/factory/generator.js";const Mt=new Set([...o,`default`,`examples`]);function Nt(e){return Mt.has(e)}function Pt(e){return!g(e)||e.type===`any`||Object.keys(e).filter(e=>!Nt(e)).length===0}function Ft(e){if(Pt(e))return`any`;let t=e.type;if($e(t))return[t];if(Array.isArray(t))return t.filter($e);let n=ke(e);return n.length>0?n:se(e)?[`object`]:We(e)?[`array`]:`any`}function It(e){return e.length>0?e:`schema`}function Lt(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Rt(e,t,n=``){let r=[];if(Pt(e)||Pt(t))return r;let i=Ft(e),a=Ft(t);if(i!==`any`&&a!==`any`&&i.filter(e=>a.includes(e)).length===0)return r.push(`${It(n)} has conflicting types: ${i.join(`|`)} vs ${a.join(`|`)}`),r;let o=e.const,s=t.const;o!==void 0&&s!==void 0&&!Lt(o,s)&&r.push(`${It(n)} has conflicting const values`);let c=e.enum,l=t.enum;if(c?.length&&l?.length&&(l.some(e=>c.some(t=>Lt(t,e)))||r.push(`${It(n)} has enum values that do not overlap`)),se(e)&&se(t)){let i=e.properties??{},a=t.properties??{};for(let[e,t]of Object.entries(a)){let a=i[e],o=n?`${n}.${e}`:e;a&&h(a)&&h(t)&&r.push(...Rt(a,t,o))}}if(We(e)&&We(t)){let i=e.items,a=t.items;i&&a&&h(i)&&h(a)&&r.push(...Rt(i,a,n?`${n}[]`:`items`));let o=e.prefixItems,s=t.prefixItems;if(Array.isArray(o)&&Array.isArray(s)){let e=Math.min(o.length,s.length);for(let t=0;t<e;t++){let e=o[t],i=s[t];h(e)&&h(i)&&r.push(...Rt(e,i,n?`${n}[${t}]`:`[${t}]`))}}}return r}function zt(e,t,n=`schema`){let r=Rt(e,t);if(r.length>0)throw Error(`The ${n} schema contradicts the generator schema:\n${r.map(e=>`- ${e}`).join(`
2
- `)}`)}function Bt(e){return nt(e)}function Vt(e,t){return!!it(t?at(t,e):e,{throwIfNoEntry:!1})?.isDirectory()}const Ht=(e,t=ct(),n={})=>{let r=n?.ignoreCase??!0,i=n?.skipCwd??!1,a=n?.includeNameInResults??!1,o=t;i&&(o=ot(t));let s=st(e);for(r&&(s=s.map(e=>e.toLowerCase()));;){let e=s.find(e=>nt(at(o,e)));if(e)return a||Vt(at(o,e))?at(o,e):o;let t=ot(o);if(t===o)return;o=t}};var Ut=30,Wt=0;function Gt(e,t=[],n=[]){let r=e??process.cwd();if(n.some(e=>nt(dt(r,e)))||t.some(e=>nt(dt(r,e))))return r;if(r!==`/`&&Wt++<Ut)return Gt(dt(r,`..`),t,n)}var Kt=/^[A-Za-z]:\//;function qt(e=``){return e&&e.replace(/\\/g,`/`).replace(Kt,e=>e.toUpperCase())}var Jt=/^[/\\]{2}/,Yt=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Xt=/^[A-Za-z]:$/,Zt=function(e){if(!e||e.length===0)return`.`;e=qt(e);let t=e?.match(Jt),n=$t(e),r=e[e.length-1]===`/`;return e=Qt(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Xt.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!$t(e)?`/${e}`:e)};function Qt(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(i!==s-1&&a!==1)if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}var $t=function(e){return Yt.test(e)},en=`storm-workspace.json,storm-workspace.yaml,storm-workspace.yml,storm-workspace.js,storm-workspace.ts,.storm-workspace.json,.storm-workspace.yaml,.storm-workspace.yml,.storm-workspace.js,.storm-workspace.ts,lerna.json,nx.json,turbo.json,npm-workspace.json,yarn-workspace.json,pnpm-workspace.json,npm-workspace.yaml,yarn-workspace.yaml,pnpm-workspace.yaml,npm-workspace.yml,yarn-workspace.yml,pnpm-workspace.yml,npm-lock.json,yarn-lock.json,pnpm-lock.json,npm-lock.yaml,yarn-lock.yaml,pnpm-lock.yaml,npm-lock.yml,yarn-lock.yml,pnpm-lock.yml,bun.lockb,bun.lock,bunfig.toml`.split(`,`),tn=[`.storm-workspace`,`.nx`,`.git`,`.github`,`.vscode`,`.verdaccio`];function nn(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?Zt(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):Zt(Gt(e??process.cwd(),en,tn))}const rn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,an=function(e){return rn.test(e)};var on=[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],sn=[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],cn=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,ln=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,un={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},dn=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,fn={5:dn,"5module":dn+` export import`,6:dn+` const class extends export import super`},pn=/^in(stanceof)?$/,mn=RegExp(`[`+ln+`]`),hn=RegExp(`[`+ln+cn+`]`);function gn(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function S(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&mn.test(String.fromCharCode(e)):t!==!1&&gn(e,sn)}function C(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&hn.test(String.fromCharCode(e)):t===!1?!1:gn(e,sn)||gn(e,on)}var w=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function T(e,t){return new w(e,{beforeExpr:!0,binop:t})}var E={beforeExpr:!0},D={startsExpr:!0},_n={};function O(e,t){return t===void 0&&(t={}),t.keyword=e,_n[e]=new w(e,t)}var k={num:new w(`num`,D),regexp:new w(`regexp`,D),string:new w(`string`,D),name:new w(`name`,D),privateId:new w(`privateId`,D),eof:new w(`eof`),bracketL:new w(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new w(`]`),braceL:new w(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new w(`}`),parenL:new w(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new w(`)`),comma:new w(`,`,E),semi:new w(`;`,E),colon:new w(`:`,E),dot:new w(`.`),question:new w(`?`,E),questionDot:new w(`?.`),arrow:new w(`=>`,E),template:new w(`template`),invalidTemplate:new w(`invalidTemplate`),ellipsis:new w(`...`,E),backQuote:new w("`",D),dollarBraceL:new w("${",{beforeExpr:!0,startsExpr:!0}),eq:new w(`=`,{beforeExpr:!0,isAssign:!0}),assign:new w(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new w(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new w(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:T(`||`,1),logicalAND:T(`&&`,2),bitwiseOR:T(`|`,3),bitwiseXOR:T(`^`,4),bitwiseAND:T(`&`,5),equality:T(`==/!=/===/!==`,6),relational:T(`</>/<=/>=`,7),bitShift:T(`<</>>/>>>`,8),plusMin:new w(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:T(`%`,10),star:T(`*`,10),slash:T(`/`,10),starstar:new w(`**`,{beforeExpr:!0}),coalesce:T(`??`,1),_break:O(`break`),_case:O(`case`,E),_catch:O(`catch`),_continue:O(`continue`),_debugger:O(`debugger`),_default:O(`default`,E),_do:O(`do`,{isLoop:!0,beforeExpr:!0}),_else:O(`else`,E),_finally:O(`finally`),_for:O(`for`,{isLoop:!0}),_function:O(`function`,D),_if:O(`if`),_return:O(`return`,E),_switch:O(`switch`),_throw:O(`throw`,E),_try:O(`try`),_var:O(`var`),_const:O(`const`),_while:O(`while`,{isLoop:!0}),_with:O(`with`),_new:O(`new`,{beforeExpr:!0,startsExpr:!0}),_this:O(`this`,D),_super:O(`super`,D),_class:O(`class`,D),_extends:O(`extends`,E),_export:O(`export`),_import:O(`import`,D),_null:O(`null`,D),_true:O(`true`,D),_false:O(`false`,D),_in:O(`in`,{beforeExpr:!0,binop:7}),_instanceof:O(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:O(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:O(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:O(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},A=/\r\n?|\n|\u2028|\u2029/,vn=new RegExp(A.source,`g`);function yn(e){return e===10||e===13||e===8232||e===8233}function bn(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(yn(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var xn=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,j=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Sn=Object.prototype,Cn=Sn.hasOwnProperty,wn=Sn.toString,Tn=Object.hasOwn||(function(e,t){return Cn.call(e,t)}),En=Array.isArray||(function(e){return wn.call(e)===`[object Array]`}),Dn=Object.create(null);function M(e){return Dn[e]||(Dn[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function N(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var On=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,kn=function(e,t){this.line=e,this.column=t};kn.prototype.offset=function(e){return new kn(this.line,this.column+e)};var An=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function jn(e,t){for(var n=1,r=0;;){var i=bn(e,r,t);if(i<0)return new kn(n,t-r);++n,r=i}}var Mn={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Nn=!1;function Pn(e){var t={};for(var n in Mn)t[n]=e&&Tn(e,n)?e[n]:Mn[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Nn&&typeof console==`object`&&console.warn&&(Nn=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
3
- Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),En(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(En(t.onComment)&&(t.onComment=Fn(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function Fn(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new An(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var P=1,In=2,Ln=4,Rn=8,zn=16,Bn=32,Vn=64,Hn=128,F=256,Un=512,Wn=1024,Gn=P|In|F;function Kn(e,t){return In|(e?Ln:0)|(t?Rn:0)}var qn=0,Jn=1,I=2,Yn=3,Xn=4,Zn=5,L=function(e,t,n){this.options=e=Pn(e),this.sourceFile=e.sourceFile,this.keywords=M(fn[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=un[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=M(r);var i=(r?r+` `:``)+un.strict;this.reservedWordsStrict=M(i),this.reservedWordsStrictBind=M(i+` `+un.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
4
- `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(A).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=k.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?In:P),this.regexpState=null,this.privateNameStack=[]},R={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};L.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},R.inFunction.get=function(){return(this.currentVarScope().flags&In)>0},R.inGenerator.get=function(){return(this.currentVarScope().flags&Rn)>0},R.inAsync.get=function(){return(this.currentVarScope().flags&Ln)>0},R.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(F|Un))return!1;if(t&In)return(t&Ln)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},R.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&P)},R.allowSuper.get=function(){return(this.currentThisScope().flags&Vn)>0||this.options.allowSuperOutsideMethod},R.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Hn)>0},R.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},R.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(F|Un)||t&In&&!(t&zn))return!0}return!1},R.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Wn||!this.inModule&&e&P)},R.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&F)>0},L.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},L.parse=function(e,t){return new this(t,e).parse()},L.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},L.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(L.prototype,R);var z=L.prototype,Qn=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;z.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){j.lastIndex=e,e+=j.exec(this.input)[0].length;var t=Qn.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){j.lastIndex=e+t[0].length;var n=j.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||A.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,j.lastIndex=e,e+=j.exec(this.input)[0].length,this.input[e]===`;`&&e++}},z.eat=function(e){return this.type===e?(this.next(),!0):!1},z.isContextual=function(e){return this.type===k.name&&this.value===e&&!this.containsEsc},z.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},z.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},z.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},z.canInsertSemicolon=function(){return this.type===k.eof||this.type===k.braceR||A.test(this.input.slice(this.lastTokEnd,this.start))},z.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},z.semicolon=function(){!this.eat(k.semi)&&!this.insertSemicolon()&&this.unexpected()},z.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},z.expect=function(e){this.eat(e)||this.unexpected()},z.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var $n=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};z.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},z.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},z.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},z.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var B=L.prototype;B.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==k.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var er={kind:`loop`},tr={kind:`switch`};B.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;j.lastIndex=this.pos;var t=j.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(S(r)){var i=n;do n+=r<=65535?1:2;while(C(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!pn.test(a))return!0}return!1},B.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;j.lastIndex=this.pos;var e=j.exec(this.input),t=this.pos+e[0].length,n;return!A.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(C(n=this.fullCharCodeAt(t+8))||n===92))},B.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;j.lastIndex=this.pos;var n=j.exec(this.input),r=this.pos+n[0].length;if(A.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||C(a=this.fullCharCodeAt(i))||a===92)return!1;j.lastIndex=i;var o=j.exec(this.input);if(r=i+o[0].length,o&&A.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!S(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(C(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(pn.test(l))return!1;if(t&&!e&&l===`of`){j.lastIndex=r;var u=j.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},B.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},B.isUsing=function(e){return this.isUsingKeyword(!1,e)},B.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=k._var,a=`let`),r){case k._break:case k._continue:return this.parseBreakContinueStatement(i,r.keyword);case k._debugger:return this.parseDebuggerStatement(i);case k._do:return this.parseDoStatement(i);case k._for:return this.parseForStatement(i);case k._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case k._class:return e&&this.unexpected(),this.parseClass(i,!0);case k._if:return this.parseIfStatement(i);case k._return:return this.parseReturnStatement(i);case k._switch:return this.parseSwitchStatement(i);case k._throw:return this.parseThrowStatement(i);case k._try:return this.parseTryStatement(i);case k._const:case k._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case k._while:return this.parseWhileStatement(i);case k._with:return this.parseWithStatement(i);case k.braceL:return this.parseBlock(!0,i);case k.semi:return this.parseEmptyStatement(i);case k._export:case k._import:if(this.options.ecmaVersion>10&&r===k._import){j.lastIndex=this.pos;var o=j.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===k._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===k.name&&d.type===`Identifier`&&this.eat(k.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},B.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(k.semi)||this.insertSemicolon()?e.label=null:this.type===k.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},B.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},B.parseDoStatement=function(e){return this.next(),this.labels.push(er),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(k._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(k.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},B.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(er),this.enterScope(0),this.expect(k.parenL),this.type===k.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===k._var||this.type===k._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new $n,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===k._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===k._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},B.parseForAfterInit=function(e,t,n){return(this.type===k._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===k._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},B.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,rr|(n?0:ir),!1,t)},B.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(k._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},B.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(k.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},B.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(k.braceL),this.labels.push(tr),this.enterScope(Wn);for(var t,n=!1;this.type!==k.braceR;)if(this.type===k._case||this.type===k._default){var r=this.type===k._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(k.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},B.parseThrowStatement=function(e){return this.next(),A.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var nr=[];B.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Bn:0),this.checkLValPattern(e,t?Xn:I),this.expect(k.parenR),e},B.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===k._catch){var t=this.startNode();this.next(),this.eat(k.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(k._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},B.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},B.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(er),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},B.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},B.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},B.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===k._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},B.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},B.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(k.braceL),e&&this.enterScope(0);this.type!==k.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},B.parseFor=function(e,t){return e.init=t,this.expect(k.semi),e.test=this.type===k.semi?null:this.parseExpression(),this.expect(k.semi),e.update=this.type===k.parenR?null:this.parseExpression(),this.expect(k.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},B.parseForIn=function(e,t){var n=this.type===k._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(k.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},B.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(k.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===k._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==k._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&!(t&&(this.type===k._in||this.isContextual(`of`)))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(k.comma))break}return e},B.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Jn:I,!1)};var rr=1,ir=2,ar=4;B.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===k.star&&t&ir&&this.unexpected(),e.generator=this.eat(k.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&rr&&(e.id=t&ar&&this.type!==k.name?null:this.parseIdent(),e.id&&!(t&ir)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Jn:I:Yn));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Kn(e.async,e.generator)),t&rr||(e.id=this.type===k.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&rr?`FunctionDeclaration`:`FunctionExpression`)},B.parseFunctionParams=function(e){this.expect(k.parenL),e.params=this.parseBindingList(k.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},B.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(k.braceL);this.type!==k.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&or(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},B.parseClassElement=function(e){if(this.eat(k.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(k.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===k.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===k.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(k.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===k.parenL||o!==`method`||i||a){var l=!n.static&&sr(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},B.isClassElementNameStart=function(){return this.type===k.name||this.type===k.privateId||this.type===k.num||this.type===k.string||this.type===k.bracketL||this.type.keyword},B.parseClassElementName=function(e){this.type===k.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},B.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&sr(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},B.parseClassField=function(e){return sr(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&sr(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(k.eq)?(this.enterScope(Un|Vn),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},B.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(F|Vn);this.type!==k.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},B.parseClassId=function(e,t){this.type===k.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,I,!1)):(t===!0&&this.unexpected(),e.id=null)},B.parseClassSuper=function(e){e.superClass=this.eat(k._extends)?this.parseExprSubscripts(null,!1):null},B.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},B.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];Tn(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function or(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function sr(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}B.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==k.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},B.parseExport=function(e,t){if(this.next(),this.eat(k.star))return this.parseExportAllDeclaration(e,t);if(this.eat(k._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==k.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},B.parseExportDeclaration=function(e){return this.parseStatement(null)},B.parseExportDefaultDeclaration=function(){var e;if(this.type===k._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,rr|ar,!1,e)}else if(this.type===k._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},B.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),Tn(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},B.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},B.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},B.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},B.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},B.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(k.braceL);!this.eat(k.braceR);){if(n)n=!1;else if(this.expect(k.comma),this.afterTrailingComma(k.braceR))break;t.push(this.parseExportSpecifier(e))}return t},B.parseImport=function(e){return this.next(),this.type===k.string?(e.specifiers=nr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===k.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},B.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,I),this.finishNode(e,`ImportSpecifier`)},B.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,I),this.finishNode(e,`ImportDefaultSpecifier`)},B.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,I),this.finishNode(e,`ImportNamespaceSpecifier`)},B.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===k.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(k.comma)))return e;if(this.type===k.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(k.braceL);!this.eat(k.braceR);){if(t)t=!1;else if(this.expect(k.comma),this.afterTrailingComma(k.braceR))break;e.push(this.parseImportSpecifier())}return e},B.parseWithClause=function(){var e=[];if(!this.eat(k._with))return e;this.expect(k.braceL);for(var t={},n=!0;!this.eat(k.braceR);){if(n)n=!1;else if(this.expect(k.comma),this.afterTrailingComma(k.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;Tn(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},B.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===k.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(k.colon),this.type!==k.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},B.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===k.string){var e=this.parseLiteral(this.value);return On.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},B.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},B.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var V=L.prototype;V.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},V.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},V.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},V.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==k.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},V.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case k.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(k.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case k.braceL:return this.parseObj(!0)}return this.parseIdent()},V.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(k.comma),t&&this.type===k.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===k.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===k.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},V.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},V.parseBindingListItem=function(e){return e},V.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(k.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},V.checkLValSimple=function(e,t,n){t===void 0&&(t=qn);var r=t!==qn;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===I&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(Tn(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Zn&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},V.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=qn),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},V.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=qn),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var H=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},U={b_stat:new H(`{`,!1),b_expr:new H(`{`,!0),b_tmpl:new H("${",!1),p_stat:new H(`(`,!1),p_expr:new H(`(`,!0),q_tmpl:new H("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new H(`function`,!1),f_expr:new H(`function`,!0),f_expr_gen:new H(`function`,!0,!1,null,!0),f_gen:new H(`function`,!1,!1,null,!0)},cr=L.prototype;cr.initialContext=function(){return[U.b_stat]},cr.curContext=function(){return this.context[this.context.length-1]},cr.braceIsBlock=function(e){var t=this.curContext();return t===U.f_expr||t===U.f_stat?!0:e===k.colon&&(t===U.b_stat||t===U.b_expr)?!t.isExpr:e===k._return||e===k.name&&this.exprAllowed?A.test(this.input.slice(this.lastTokEnd,this.start)):e===k._else||e===k.semi||e===k.eof||e===k.parenR||e===k.arrow?!0:e===k.braceL?t===U.b_stat:e===k._var||e===k._const||e===k.name?!1:!this.exprAllowed},cr.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},cr.updateContext=function(e){var t,n=this.type;n.keyword&&e===k.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},cr.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},k.parenR.updateContext=k.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===U.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},k.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?U.b_stat:U.b_expr),this.exprAllowed=!0},k.dollarBraceL.updateContext=function(){this.context.push(U.b_tmpl),this.exprAllowed=!0},k.parenL.updateContext=function(e){var t=e===k._if||e===k._for||e===k._with||e===k._while;this.context.push(t?U.p_stat:U.p_expr),this.exprAllowed=!0},k.incDec.updateContext=function(){},k._function.updateContext=k._class.updateContext=function(e){e.beforeExpr&&e!==k._else&&(e!==k.semi||this.curContext()===U.p_stat)&&!(e===k._return&&A.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==k.colon&&e!==k.braceL||this.curContext()!==U.b_stat)?this.context.push(U.f_expr):this.context.push(U.f_stat),this.exprAllowed=!1},k.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},k.backQuote.updateContext=function(){this.curContext()===U.q_tmpl?this.context.pop():this.context.push(U.q_tmpl),this.exprAllowed=!1},k.star.updateContext=function(e){if(e===k._function){var t=this.context.length-1;this.context[t]===U.f_expr?this.context[t]=U.f_expr_gen:this.context[t]=U.f_gen}this.exprAllowed=!0},k.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==k.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var W=L.prototype;W.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},W.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===k.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(k.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},W.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new $n,r=!0);var s=this.start,c=this.startLoc;(this.type===k.parenL||this.type===k.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===k.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===k.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}else r&&this.checkExpressionErrors(t,!0);return i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},W.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(k.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(k.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},W.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},W.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==k._in)&&a>r){var o=this.type===k.logicalOR||this.type===k.logicalAND,s=this.type===k.coalesce;s&&(a=k.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===k.coalesce||s&&(this.type===k.logicalOR||this.type===k.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},W.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},W.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===k.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&lr(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&ur(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===k.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==k._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(k.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1);else return o};function lr(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&lr(e.expression)}function ur(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&ur(e.expression)||e.type===`ParenthesizedExpression`&&ur(e.expression)}W.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},W.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},W.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(k.arrow)},W.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},W.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(k.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(k.bracketL);if(l||c&&this.type!==k.parenL&&this.type!==k.backQuote||this.eat(k.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(k.bracketR)):this.type===k.privateId&&e.type!==`Super`?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(k.parenL)){var d=new $n,f=this.yieldPos,ee=this.awaitPos,te=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var ne=this.parseExprList(k.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=ee,this.awaitIdentPos=te,this.parseSubscriptAsyncArrow(t,n,ne,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=ee||this.awaitPos,this.awaitIdentPos=te||this.awaitIdentPos;var re=this.startNodeAt(t,n);re.callee=e,re.arguments=ne,s&&(re.optional=c),e=this.finishNode(re,`CallExpression`)}else if(this.type===k.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var p=this.startNodeAt(t,n);p.tag=e,p.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(p,`TaggedTemplateExpression`)}return e},W.parseExprAtom=function(e,t,n){this.type===k.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case k._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===k.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==k.dot&&this.type!==k.bracketL&&this.type!==k.parenL&&this.unexpected(),this.finishNode(r,`Super`);case k._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case k.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(k._function))return this.overrideContext(U.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(k.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===k.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(k.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case k.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case k.num:case k.string:return this.parseLiteral(this.value);case k._null:case k._true:case k._false:return r=this.startNode(),r.value=this.type===k._null?null:this.type===k._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case k.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case k.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(k.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case k.braceL:return this.overrideContext(U.b_expr),this.parseObj(!1,e);case k._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case k._class:return this.parseClass(this.startNode(),!1);case k._new:return this.parseNew();case k.backQuote:return this.parseTemplate();case k._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},W.parseExprAtomDefault=function(){this.unexpected()},W.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===k.parenL&&!e)return this.parseDynamicImport(t);if(this.type===k.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}else this.unexpected()},W.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(k.parenR)?e.options=null:(this.expect(k.comma),this.afterTrailingComma(k.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(k.parenR)||(this.expect(k.comma),this.afterTrailingComma(k.parenR)||this.unexpected())));else if(!this.eat(k.parenR)){var t=this.start;this.eat(k.comma)&&this.eat(k.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},W.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},W.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},W.parseParenExpression=function(){this.expect(k.parenL);var e=this.parseExpression();return this.expect(k.parenR),e},W.shouldParseArrow=function(e){return!this.canInsertSemicolon()},W.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new $n,f=this.yieldPos,ee=this.awaitPos,te;for(this.yieldPos=0,this.awaitPos=0;this.type!==k.parenR;)if(l?l=!1:this.expect(k.comma),a&&this.afterTrailingComma(k.parenR,!0)){u=!0;break}else if(this.type===k.ellipsis){te=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===k.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}else c.push(this.parseMaybeAssign(!1,d,this.parseParenItem));var ne=this.lastTokEnd,re=this.lastTokEndLoc;if(this.expect(k.parenR),e&&this.shouldParseArrow(c)&&this.eat(k.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=ee,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),te&&this.unexpected(te),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=ee||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,ne,re)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var p=this.startNodeAt(n,r);return p.expression=i,this.finishNode(p,`ParenthesizedExpression`)}else return i},W.parseParenItem=function(e){return e},W.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var dr=[];W.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===k.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),this.eat(k.parenL)?e.arguments=this.parseExprList(k.parenR,this.options.ecmaVersion>=8,!1):e.arguments=dr,this.finishNode(e,`NewExpression`)},W.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===k.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
5
- `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
6
- `),cooked:this.value},this.next(),n.tail=this.type===k.backQuote,this.finishNode(n,`TemplateElement`)},W.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===k.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(k.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(k.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},W.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===k.name||this.type===k.num||this.type===k.string||this.type===k.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===k.star)&&!A.test(this.input.slice(this.lastTokEnd,this.start))},W.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(k.braceR);){if(r)r=!1;else if(this.expect(k.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(k.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},W.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(k.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===k.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===k.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(k.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(k.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},W.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},W.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===k.colon&&this.unexpected(),this.eat(k.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===k.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==k.comma&&this.type!==k.braceR&&this.type!==k.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===k.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},W.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(k.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(k.bracketR),e.key;e.computed=!1}return e.key=this.type===k.num||this.type===k.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},W.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},W.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Kn(t,r.generator)|Vn|(n?Hn:0)),this.expect(k.parenL),r.params=this.parseBindingList(k.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},W.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Kn(n,!1)|zn),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},W.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==k.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Zn),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},W.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},W.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,Jn,t?null:n)}},W.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(k.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===k.comma?o=null:this.type===k.ellipsis?(o=this.parseSpread(r),r&&this.type===k.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},W.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Gn)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},W.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},W.parseIdentNode=function(){var e=this.startNode();return this.type===k.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=k.name):this.unexpected(),e},W.parsePrivateIdent=function(){var e=this.startNode();return this.type===k.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},W.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===k.semi||this.canInsertSemicolon()||this.type!==k.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(k.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},W.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var fr=L.prototype;fr.raise=function(e,t){var n=jn(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},fr.raiseRecoverable=fr.raise,fr.curPosition=function(){if(this.options.locations)return new kn(this.curLine,this.pos-this.lineStart)};var G=L.prototype,pr=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};G.enterScope=function(e){this.scopeStack.push(new pr(e))},G.exitScope=function(){this.scopeStack.pop()},G.treatFunctionsAsVarInScope=function(e){return e.flags&In||!this.inModule&&e.flags&P},G.declareName=function(e,t,n){var r=!1;if(t===I){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&P&&delete this.undefinedExports[e]}else if(t===Xn)this.currentScope().lexical.push(e);else if(t===Yn){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Bn&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&P&&delete this.undefinedExports[e],s.flags&Gn)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},G.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},G.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},G.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Gn|Un|F))return t}},G.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Gn|Un|F)&&!(t.flags&zn))return t}};var mr=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new An(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},hr=L.prototype;hr.startNode=function(){return new mr(this,this.start,this.startLoc)},hr.startNodeAt=function(e,t){return new mr(this,e,t)};function gr(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}hr.finishNode=function(e,t){return gr.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},hr.finishNodeAt=function(e,t,n,r){return gr.call(this,e,t,n,r)},hr.copyNode=function(e){var t=new mr(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var _r=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,vr=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,yr=vr+` Extended_Pictographic`,br=yr,xr=br+` EBase EComp EMod EPres ExtPict`,Sr=xr,Cr={9:vr,10:yr,11:br,12:xr,13:Sr,14:Sr},wr={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},Tr=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Er=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,Dr=Er+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Or=Dr+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,kr=Or+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,Ar=kr+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,jr={9:Er,10:Dr,11:Or,12:kr,13:Ar,14:Ar+` `+_r},Mr={};function Nr(e){var t=Mr[e]={binary:M(Cr[e]+` `+Tr),binaryOfStrings:M(wr[e]),nonBinary:{General_Category:M(Tr),Script:M(jr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Pr=0,Fr=[9,10,11,12,13,14];Pr<Fr.length;Pr+=1){var Ir=Fr[Pr];Nr(Ir)}var K=L.prototype,Lr=function(e,t){this.parent=e,this.base=t||this};Lr.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Lr.prototype.sibling=function(){return new Lr(this.parent,this.base)};var q=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=Mr[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};q.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},q.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},q.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},q.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},q.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},q.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},q.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},q.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e?(this.advance(t),!0):!1},q.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},K.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function Rr(e){for(var t in e)return!0;return!1}K.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Rr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},K.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},K.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Lr(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},K.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},K.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},K.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},K.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},K.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},K.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},K.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},K.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},K.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},K.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},K.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&zr(n);)t+=N(n),e.advance();return t};function zr(e){return e===105||e===109||e===115}K.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},K.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},K.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Br(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Br(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}K.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!Br(n);)e.advance();return e.pos!==t},K.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},K.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`);t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},K.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},K.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=N(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=N(e.lastIntValue);return!0}return!1},K.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Vr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Vr(e){return S(e,!0)||e===36||e===95}K.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Hr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Hr(e){return C(e,!0)||e===36||e===95||e===8204||e===8205}K.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},K.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},K.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},K.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},K.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},K.regexp_eatZero=function(e){return e.current()===48&&!Qr(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},K.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},K.regexp_eatControlLetter=function(e){var t=e.current();return Ur(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ur(e){return e>=65&&e<=90||e>=97&&e<=122}K.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Wr(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function Wr(e){return e>=0&&e<=1114111}K.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},K.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Gr=0,J=1,Y=2;K.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Kr(t))return e.lastIntValue=-1,e.advance(),J;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Y&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return Gr};function Kr(e){return e===100||e===68||e===115||e===83||e===119||e===87}K.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),J}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Gr},K.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){Tn(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},K.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return J;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Y;e.raise(`Invalid property name`)},K.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;qr(t=e.current());)e.lastStringValue+=N(t),e.advance();return e.lastStringValue!==``};function qr(e){return Ur(e)||e===95}K.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;Jr(t=e.current());)e.lastStringValue+=N(t),e.advance();return e.lastStringValue!==``};function Jr(e){return qr(e)||Qr(e)}K.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},K.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Y&&e.raise(`Negated character class may contain strings`),!0}return!1},K.regexp_classContents=function(e){return e.current()===93?J:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),J)},K.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},K.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||ti(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r===93?!1:(e.lastIntValue=r,e.advance(),!0)},K.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},K.regexp_classSetExpression=function(e){var t=J,n;if(!this.regexp_eatClassSetRange(e))if(n=this.regexp_eatClassSetOperand(e)){n===Y&&(t=Y);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Y&&(t=J);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`);for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Y&&(t=Y)}},K.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},K.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?J:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},K.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Y&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},K.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},K.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Y&&(t=Y);return t},K.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?J:Y},K.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&Yr(n)||Xr(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function Yr(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Xr(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}K.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return Zr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Zr(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}K.regexp_eatClassControlLetter=function(e){var t=e.current();return Qr(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},K.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},K.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Qr(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function Qr(e){return e>=48&&e<=57}K.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;$r(n=e.current());)e.lastIntValue=16*e.lastIntValue+ei(n),e.advance();return e.pos!==t};function $r(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function ei(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}K.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+n*8+e.lastIntValue:e.lastIntValue=t*8+n}else e.lastIntValue=t;return!0}return!1},K.regexp_eatOctalDigit=function(e){var t=e.current();return ti(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function ti(e){return e>=48&&e<=55}K.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!$r(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+ei(i),e.advance()}return!0};var ni=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new An(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},X=L.prototype;X.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new ni(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},X.getToken=function(){return this.next(),new ni(this)},typeof Symbol<`u`&&(X[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===k.eof,value:t}}}}),X.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(k.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},X.readToken=function(e){return S(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},X.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},X.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},X.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=bn(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},X.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!yn(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},X.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&xn.test(String.fromCharCode(e)))++this.pos;else break loop}}},X.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},X.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(k.ellipsis)):(++this.pos,this.finishToken(k.dot))},X.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(k.assign,2):this.finishOp(k.slash,1)},X.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?k.star:k.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=k.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(k.assign,n+1):this.finishOp(r,n)},X.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(k.assign,3):this.finishOp(e===124?k.logicalOR:k.logicalAND,2):t===61?this.finishOp(k.assign,2):this.finishOp(e===124?k.bitwiseOR:k.bitwiseAND,1)},X.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(k.assign,2):this.finishOp(k.bitwiseXOR,1)},X.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||A.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(k.incDec,2):t===61?this.finishOp(k.assign,2):this.finishOp(k.plusMin,1)},X.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(k.assign,n+1):this.finishOp(k.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(k.relational,n))},X.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(k.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(k.arrow)):this.finishOp(e===61?k.eq:k.prefix,1)},X.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(k.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(k.assign,3):this.finishOp(k.coalesce,2)}return this.finishOp(k.question,1)},X.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),S(t,!0)||t===92))return this.finishToken(k.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+N(t)+`'`)},X.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(k.parenL);case 41:return++this.pos,this.finishToken(k.parenR);case 59:return++this.pos,this.finishToken(k.semi);case 44:return++this.pos,this.finishToken(k.comma);case 91:return++this.pos,this.finishToken(k.bracketL);case 93:return++this.pos,this.finishToken(k.bracketR);case 123:return++this.pos,this.finishToken(k.braceL);case 125:return++this.pos,this.finishToken(k.braceR);case 58:return++this.pos,this.finishToken(k.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(k.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(k.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+N(e)+`'`)},X.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},X.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(A.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new q(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(k.regexp,{pattern:i,flags:o,value:c})},X.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function ri(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function ii(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}X.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=ii(this.input.slice(t,this.pos)),++this.pos):S(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(k.num,n)},X.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=ii(this.input.slice(t,this.pos));return++this.pos,S(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(k.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),S(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=ri(this.input.slice(t,this.pos),n);return this.finishToken(k.num,a)},X.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},X.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(yn(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(k.string,t)};var ai={};X.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===ai)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},X.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ai;this.raise(e,t)},X.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===k.template||this.type===k.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(k.dollarBraceL)):(++this.pos,this.finishToken(k.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(k.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(yn(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
7
- `;break;default:e+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},X.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(k.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
8
- `&&++this.pos;case`
9
- `:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,`Unterminated template`)},X.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
10
- `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return N(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return yn(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},X.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},X.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(C(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?S:C)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=N(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},X.readWord=function(){var e=this.readWord1(),t=k.name;return this.keywords.test(e)&&(t=_n[e]),this.finishToken(t,e)},L.acorn={Parser:L,version:`8.17.0`,defaultOptions:Mn,Position:kn,SourceLocation:An,getLineInfo:jn,Node:mr,TokenType:w,tokTypes:k,keywordTypes:_n,TokContext:H,tokContexts:U,isIdentifierChar:C,isIdentifierStart:S,Token:ni,isNewLine:yn,lineBreak:A,lineBreakG:vn,nonASCIIwhitespace:xn},String.fromCharCode;const oi=/\/$|\/\?|\/#/,si=/^\.?\//;function ci(e=``,t){return t?oi.test(e):e.endsWith(`/`)}function li(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(ci(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function ui(e){return e&&e!==`/`}function di(e,...t){let n=e||``;for(let e of t.filter(e=>ui(e)))if(n){let t=e.replace(si,``);n=li(n)+t}else n=e;return n}const fi=new Set(Qe);function pi(e){return e.replace(/\\/g,`/`)}const mi={}.hasOwnProperty,hi=/^([A-Z][a-z\d]*)+$/,gi=new Set([`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`]),Z={};function _i(e,t=`and`){return e.length<3?e.join(` ${t} `):`${e.slice(0,-1).join(`, `)}, ${t} ${e[e.length-1]}`}const vi=new Map;let yi;Z.ERR_INVALID_ARG_TYPE=Q(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{y.ok(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let r=`The `;if(e.endsWith(` argument`))r+=`${e} `;else{let t=e.includes(`.`)?`property`:`argument`;r+=`"${e}" ${t} `}r+=`must be `;let i=[],a=[],o=[];for(let e of t)y.ok(typeof e==`string`,`All expected entries have to be of type string`),gi.has(e)?i.push(e.toLowerCase()):hi.exec(e)===null?(y.ok(e!==`object`,`The value "object" should be written as "Object"`),o.push(e)):a.push(e);if(a.length>0){let e=i.indexOf(`object`);e!==-1&&(i.slice(e,1),a.push(`Object`))}return i.length>0&&(r+=`${i.length>1?`one of type`:`of type`} ${_i(i,`or`)}`,(a.length>0||o.length>0)&&(r+=` or `)),a.length>0&&(r+=`an instance of ${_i(a,`or`)}`,o.length>0&&(r+=` or `)),o.length>0&&(o.length>1?r+=`one of ${_i(o,`or`)}`:(o[0].toLowerCase()!==o[0]&&(r+=`an `),r+=`${o[0]}`)),r+=`. Received ${Ti(n)}`,r},TypeError),Z.ERR_INVALID_MODULE_SPECIFIER=Q(`ERR_INVALID_MODULE_SPECIFIER`,(e,t,n=void 0)=>`Invalid module "${e}" ${t}${n?` imported from ${n}`:``}`,TypeError),Z.ERR_INVALID_PACKAGE_CONFIG=Q(`ERR_INVALID_PACKAGE_CONFIG`,(e,t,n)=>`Invalid package config ${e}${t?` while importing ${t}`:``}${n?`. ${n}`:``}`,Error),Z.ERR_INVALID_PACKAGE_TARGET=Q(`ERR_INVALID_PACKAGE_TARGET`,(e,t,n,r=!1,i=void 0)=>{let a=typeof n==`string`&&!r&&n.length>0&&!n.startsWith(`./`);return t===`.`?(y.ok(r===!1),`Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`):`Invalid "${r?`imports`:`exports`}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`},Error),Z.ERR_MODULE_NOT_FOUND=Q(`ERR_MODULE_NOT_FOUND`,(e,t,n=!1)=>`Cannot find ${n?`module`:`package`} '${e}' imported from ${t}`,Error),Z.ERR_NETWORK_IMPORT_DISALLOWED=Q(`ERR_NETWORK_IMPORT_DISALLOWED`,`import of '%s' by %s is not supported: %s`,Error),Z.ERR_PACKAGE_IMPORT_NOT_DEFINED=Q(`ERR_PACKAGE_IMPORT_NOT_DEFINED`,(e,t,n)=>`Package import specifier "${e}" is not defined${t?` in package ${t}package.json`:``} imported from ${n}`,TypeError),Z.ERR_PACKAGE_PATH_NOT_EXPORTED=Q(`ERR_PACKAGE_PATH_NOT_EXPORTED`,(e,t,n=void 0)=>t===`.`?`No "exports" main defined in ${e}package.json${n?` imported from ${n}`:``}`:`Package subpath '${t}' is not defined by "exports" in ${e}package.json${n?` imported from ${n}`:``}`,Error),Z.ERR_UNSUPPORTED_DIR_IMPORT=Q(`ERR_UNSUPPORTED_DIR_IMPORT`,`Directory import '%s' is not supported resolving ES modules imported from %s`,Error),Z.ERR_UNSUPPORTED_RESOLVE_REQUEST=Q(`ERR_UNSUPPORTED_RESOLVE_REQUEST`,`Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`,TypeError),Z.ERR_UNKNOWN_FILE_EXTENSION=Q(`ERR_UNKNOWN_FILE_EXTENSION`,(e,t)=>`Unknown file extension "${e}" for ${t}`,TypeError),Z.ERR_INVALID_ARG_VALUE=Q(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let r=ht(t);return r.length>128&&(r=`${r.slice(0,128)}...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${r}`},TypeError);function Q(e,t,n){return vi.set(e,t),bi(n,e)}function bi(e,t){return n;function n(...n){let r=Error.stackTraceLimit;xi()&&(Error.stackTraceLimit=0);let i=new e;xi()&&(Error.stackTraceLimit=r);let a=wi(t,n,i);return Object.defineProperties(i,{message:{value:a,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),Ci(i),i.code=t,i}}function xi(){try{if(pt.startupSnapshot.isBuildingSnapshot())return!1}catch{}let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):mi.call(e,`writable`)&&e.writable!==void 0?e.writable:e.set!==void 0}function Si(e){let t=`__node_internal_`+e.name;return Object.defineProperty(e,"name",{value:t}),e}const Ci=Si(function(e){let t=xi();return t&&(yi=Error.stackTraceLimit,Error.stackTraceLimit=1/0),Error.captureStackTrace(e),t&&(Error.stackTraceLimit=yi),e});function wi(e,t,n){let r=vi.get(e);if(y.ok(r!==void 0,"expected `message` to be found"),typeof r==`function`)return y.ok(r.length<=t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`),Reflect.apply(r,n,t);let i=/%[dfijoOs]/g,a=0;for(;i.exec(r)!==null;)a++;return y.ok(a===t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${a}).`),t.length===0?r:(t.unshift(r),Reflect.apply(mt,null,t))}function Ti(e){if(e==null)return String(e);if(typeof e==`function`&&e.name)return`function ${e.name}`;if(typeof e==`object`)return e.constructor&&e.constructor.name?`an instance of ${e.constructor.name}`:`${ht(e,{depth:-1})}`;let t=ht(e,{colors:!1});return t.length>28&&(t=`${t.slice(0,25)}...`),`type ${typeof e} (${t})`}const Ei={}.hasOwnProperty,{ERR_INVALID_PACKAGE_CONFIG:Di}=Z,Oi=new Map;function ki(e,{base:t,specifier:n}){let r=Oi.get(e);if(r)return r;let i;try{i=tt.readFileSync(ut.toNamespacedPath(e),`utf8`)}catch(e){let t=e;if(t.code!==`ENOENT`)throw t}let a={exists:!1,pjsonPath:e,main:void 0,name:void 0,type:`none`,exports:void 0,imports:void 0};if(i!==void 0){let r;try{r=JSON.parse(i)}catch(r){let i=r,a=new Di(e,(t?`"${n}" from `:``)+v(t||n),i.message);throw a.cause=i,a}a.exists=!0,Ei.call(r,`name`)&&typeof r.name==`string`&&(a.name=r.name),Ei.call(r,`main`)&&typeof r.main==`string`&&(a.main=r.main),Ei.call(r,`exports`)&&(a.exports=r.exports),Ei.call(r,`imports`)&&(a.imports=r.imports),Ei.call(r,`type`)&&(r.type===`commonjs`||r.type===`module`)&&(a.type=r.type)}return Oi.set(e,a),a}function Ai(e){let t=new URL(`package.json`,e);for(;!t.pathname.endsWith(`node_modules/package.json`);){let n=ki(v(t),{specifier:e});if(n.exists)return n;let r=t;if(t=new URL(`../package.json`,t),t.pathname===r.pathname)break}return{pjsonPath:v(t),exists:!1,type:`none`}}function ji(e){return Ai(e).type}const{ERR_UNKNOWN_FILE_EXTENSION:Mi}=Z,Ni={}.hasOwnProperty,Pi={__proto__:null,".cjs":`commonjs`,".js":`module`,".json":`json`,".mjs":`module`};function Fi(e){return e&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(e)?`module`:e===`application/json`?`json`:null}const Ii={__proto__:null,"data:":Li,"file:":zi,"http:":Bi,"https:":Bi,"node:"(){return`builtin`}};function Li(e){let{1:t}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(e.pathname)||[null,null,null];return Fi(t)}function Ri(e){let t=e.pathname,n=t.length;for(;n--;){let e=t.codePointAt(n);if(e===47)return``;if(e===46)return t.codePointAt(n-1)===47?``:t.slice(n)}return``}function zi(e,t,n){let r=Ri(e);if(r===`.js`){let t=ji(e);return t===`none`?`commonjs`:t}if(r===``){let t=ji(e);return t===`none`||t===`commonjs`?`commonjs`:`module`}let i=Pi[r];if(i)return i;if(n)return;let a=v(e);throw new Mi(r,a)}function Bi(){}function Vi(e,t){let n=e.protocol;return Ni.call(Ii,n)&&Ii[n](e,t,!0)||null}const Hi=Object.freeze([`node`,`import`]),Ui=new Set(Hi);function Wi(){return Ui}function Gi(e){return Wi()}const Ki=RegExp.prototype[Symbol.replace],{ERR_INVALID_MODULE_SPECIFIER:qi,ERR_INVALID_PACKAGE_CONFIG:Ji,ERR_INVALID_PACKAGE_TARGET:Yi,ERR_MODULE_NOT_FOUND:Xi,ERR_PACKAGE_IMPORT_NOT_DEFINED:Zi,ERR_PACKAGE_PATH_NOT_EXPORTED:Qi,ERR_UNSUPPORTED_DIR_IMPORT:$i,ERR_UNSUPPORTED_RESOLVE_REQUEST:ea}=Z,ta={}.hasOwnProperty,na=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,ra=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,ia=/^\.|%|\\/,aa=/\*/g,oa=/%2f|%5c/i,sa=new Set,ca=/[/\\]{2}/;function la(e,t,n,r,i,a,o){if(b.noDeprecation)return;let s=v(r),c=ca.exec(o?e:t)!==null;b.emitWarning(`Use of deprecated ${c?`double slash`:`leading or trailing slash matching`} resolving "${e}" for module request "${t}" ${t===n?``:`matched to "${n}" `}in the "${i?`imports`:`exports`}" field module resolution of the package at ${s}${a?` imported from ${v(a)}`:``}.`,`DeprecationWarning`,`DEP0166`)}function ua(e,t,n,r){if(b.noDeprecation||Vi(e,{parentURL:n.href})!==`module`)return;let i=v(e.href),a=v(new URL(`.`,t)),o=v(n);r?ut.resolve(a,r)!==i&&b.emitWarning(`Package ${a} has a "main" field set to "${r}", excluding the full filename and extension to the resolved file at "${i.slice(a.length)}", imported from ${o}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`):b.emitWarning(`No "main" or "exports" field defined in the package.json for ${a} resolving the main entry point "${i.slice(a.length)}", imported from ${o}.\nDefault "index" lookups for the main are deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`)}function da(e){try{return it(e)}catch{}}function fa(e){let t=it(e,{throwIfNoEntry:!1});return(t?t.isFile():void 0)??!1}function pa(e,t,n){let r;if(t.main!==void 0){if(r=new URL(t.main,e),fa(r))return r;let i=[`./${t.main}.js`,`./${t.main}.json`,`./${t.main}.node`,`./${t.main}/index.js`,`./${t.main}/index.json`,`./${t.main}/index.node`],a=-1;for(;++a<i.length&&(r=new URL(i[a],e),!fa(r));)r=void 0;if(r)return ua(r,e,n,t.main),r}let i=[`./index.js`,`./index.json`,`./index.node`],a=-1;for(;++a<i.length&&(r=new URL(i[a],e),!fa(r));)r=void 0;if(r)return ua(r,e,n,t.main),r;throw new Xi(v(new URL(`.`,e)),v(n))}function ma(e,t,n){if(oa.exec(e.pathname)!==null)throw new qi(e.pathname,`must not include encoded "/" or "\\" characters`,v(t));let r;try{r=v(e)}catch(n){let r=n;throw Object.defineProperty(r,"input",{value:String(e)}),Object.defineProperty(r,"module",{value:String(t)}),r}let i=da(r.endsWith(`/`)?r.slice(-1):r);if(i&&i.isDirectory()){let n=new $i(r,v(t));throw n.url=String(e),n}if(!i||!i.isFile()){let n=new Xi(r||e.pathname,t&&v(t),!0);throw n.url=String(e),n}{let t=rt(r),{search:n,hash:i}=e;e=ft(t+(r.endsWith(ut.sep)?`/`:``)),e.search=n,e.hash=i}return e}function ha(e,t,n){return new Zi(e,t&&v(new URL(`.`,t)),v(n))}function ga(e,t,n){return new Qi(v(new URL(`.`,t)),e,n&&v(n))}function _a(e,t,n,r,i){let a=`request is not a valid match in pattern "${t}" for the "${r?`imports`:`exports`}" resolution of ${v(n)}`;throw new qi(e,a,i&&v(i))}function va(e,t,n,r,i){return t=typeof t==`object`&&t?JSON.stringify(t,null,``):`${t}`,new Yi(v(new URL(`.`,n)),e,t,r,i&&v(i))}function ya(e,t,n,r,i,a,o,s,c){if(t!==``&&!a&&e[e.length-1]!==`/`)throw va(n,e,r,o,i);if(!e.startsWith(`./`)){if(o&&!e.startsWith(`../`)&&!e.startsWith(`/`)){let n=!1;try{new URL(e),n=!0}catch{}if(!n)return Oa(a?Ki.call(aa,e,()=>t):e+t,r,c)}throw va(n,e,r,o,i)}if(na.exec(e.slice(2))!==null)if(ra.exec(e.slice(2))===null){if(!s){let s=a?n.replace(`*`,()=>t):n+t;la(a?Ki.call(aa,e,()=>t):e,s,n,r,o,i,!0)}}else throw va(n,e,r,o,i);let l=new URL(e,r),u=l.pathname,d=new URL(`.`,r).pathname;if(!u.startsWith(d))throw va(n,e,r,o,i);if(t===``)return l;if(na.exec(t)!==null){let c=a?n.replace(`*`,()=>t):n+t;ra.exec(t)===null?s||la(a?Ki.call(aa,e,()=>t):e,c,n,r,o,i,!1):_a(c,n,r,o,i)}return a?new URL(Ki.call(aa,l.href,()=>t)):new URL(t,l)}function ba(e){let t=Number(e);return`${t}`===e&&t>=0&&t<4294967295}function xa(e,t,n,r,i,a,o,s,c){if(typeof t==`string`)return ya(t,n,r,e,i,a,o,s,c);if(Array.isArray(t)){let l=t;if(l.length===0)return null;let u,d=-1;for(;++d<l.length;){let t=l[d],f;try{f=xa(e,t,n,r,i,a,o,s,c)}catch(e){let t=e;if(u=t,t.code===`ERR_INVALID_PACKAGE_TARGET`)continue;throw e}if(f!==void 0){if(f===null){u=null;continue}return f}}if(u==null)return null;throw u}if(typeof t==`object`&&t){let l=Object.getOwnPropertyNames(t),u=-1;for(;++u<l.length;){let t=l[u];if(ba(t))throw new Ji(v(e),i,`"exports" cannot contain numeric property keys.`)}for(u=-1;++u<l.length;){let d=l[u];if(d==="default"||c&&c.has(d)){let l=t[d],u=xa(e,l,n,r,i,a,o,s,c);if(u===void 0)continue;return u}}return null}if(t===null)return null;throw va(r,t,e,o,i)}function Sa(e,t,n){if(typeof e==`string`||Array.isArray(e))return!0;if(typeof e!=`object`||!e)return!1;let r=Object.getOwnPropertyNames(e),i=!1,a=0,o=-1;for(;++o<r.length;){let e=r[o],s=e===``||e[0]!==`.`;if(a++===0)i=s;else if(i!==s)throw new Ji(v(t),n,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return i}function Ca(e,t,n){if(b.noDeprecation)return;let r=v(t);sa.has(r+`|`+e)||(sa.add(r+`|`+e),b.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n?` imported from ${v(n)}`:``}. Mapping specifiers ending in "/" is no longer supported.`,`DeprecationWarning`,`DEP0155`))}function wa(e,t,n,r,i){let a=n.exports;if(Sa(a,e,r)&&(a={".":a}),ta.call(a,t)&&!t.includes(`*`)&&!t.endsWith(`/`)){let n=a[t],o=xa(e,n,``,t,r,!1,!1,!1,i);if(o==null)throw ga(t,e,r);return o}let o=``,s=``,c=Object.getOwnPropertyNames(a),l=-1;for(;++l<c.length;){let n=c[l],i=n.indexOf(`*`);if(i!==-1&&t.startsWith(n.slice(0,i))){t.endsWith(`/`)&&Ca(t,e,r);let a=n.slice(i+1);t.length>=n.length&&t.endsWith(a)&&Ta(o,n)===1&&n.lastIndexOf(`*`)===i&&(o=n,s=t.slice(i,t.length-a.length))}}if(o){let n=a[o],c=xa(e,n,s,o,r,!0,!1,t.endsWith(`/`),i);if(c==null)throw ga(t,e,r);return c}throw ga(t,e,r)}function Ta(e,t){let n=e.indexOf(`*`),r=t.indexOf(`*`),i=n===-1?e.length:n+1,a=r===-1?t.length:r+1;return i>a?-1:a>i||n===-1?1:r===-1||e.length>t.length?-1:+(t.length>e.length)}function Ea(e,t,n){if(e===`#`||e.startsWith(`#/`)||e.endsWith(`/`))throw new qi(e,`is not a valid internal imports specifier name`,v(t));let r,i=Ai(t);if(i.exists){r=ft(i.pjsonPath);let a=i.imports;if(a)if(ta.call(a,e)&&!e.includes(`*`)){let i=xa(r,a[e],``,e,t,!1,!0,!1,n);if(i!=null)return i}else{let i=``,o=``,s=Object.getOwnPropertyNames(a),c=-1;for(;++c<s.length;){let t=s[c],n=t.indexOf(`*`);if(n!==-1&&e.startsWith(t.slice(0,-1))){let r=t.slice(n+1);e.length>=t.length&&e.endsWith(r)&&Ta(i,t)===1&&t.lastIndexOf(`*`)===n&&(i=t,o=e.slice(n,e.length-r.length))}}if(i){let e=a[i],s=xa(r,e,o,i,t,!0,!0,!1,n);if(s!=null)return s}}}throw ha(e,r,t)}function Da(e,t){let n=e.indexOf(`/`),r=!0,i=!1;e[0]===`@`&&(i=!0,n===-1||e.length===0?r=!1:n=e.indexOf(`/`,n+1));let a=n===-1?e:e.slice(0,n);if(ia.exec(a)!==null&&(r=!1),!r)throw new qi(e,`is not a valid package name`,v(t));return{packageName:a,packageSubpath:`.`+(n===-1?``:e.slice(n)),isScoped:i}}function Oa(e,t,n){if(Qe.includes(e))return new URL(`node:`+e);let{packageName:r,packageSubpath:i,isScoped:a}=Da(e,t),o=Ai(t);if(o.exists){let e=ft(o.pjsonPath);if(o.name===r&&o.exports!==void 0&&o.exports!==null)return wa(e,i,o,t,n)}let s=new URL(`./node_modules/`+r+`/package.json`,t),c=v(s),l;do{let o=da(c.slice(0,-13));if(!o||!o.isDirectory()){l=c,s=new URL((a?`../../../../node_modules/`:`../../../node_modules/`)+r+`/package.json`,s),c=v(s);continue}let u=ki(c,{base:t,specifier:e});return u.exports!==void 0&&u.exports!==null?wa(s,i,u,t,n):i===`.`?pa(s,u,t):new URL(i,s)}while(c.length!==l.length);throw new Xi(r,v(t),!1)}function ka(e){return!(e[0]!==`.`||e.length!==1&&e[1]!==`/`&&(e[1]!==`.`||e.length!==2&&e[2]!==`/`))}function Aa(e){return e===``?!1:e[0]===`/`||ka(e)}function ja(e,t,n,r){n===void 0&&(n=Gi());let i=t.protocol,a=i===`data:`||i===`http:`||i===`https:`,o;if(Aa(e))try{o=new URL(e,t)}catch(n){let r=new ea(e,t);throw r.cause=n,r}else if(i===`file:`&&e[0]===`#`)o=Ea(e,t,n);else try{o=new URL(e)}catch(r){if(a&&!Qe.includes(e)){let n=new ea(e,t);throw n.cause=r,n}o=Oa(e,t,n)}return y.ok(o!==void 0,`expected to be defined`),o.protocol===`file:`?ma(o,t):o}function Ma(e){return typeof e==`string`&&!e.startsWith(`file://`)?pi(e):pi(v(e))}function Na(e){return ft(Ma(e)).toString()}function Pa(e){return typeof e!=`string`&&(e=e.toString()),/(?:node|data|http|https|file):/.test(e)?e:fi.has(e)?`node:`+e:`file://`+encodeURI(pi(e))}const Fa=new Set([`node`,`import`]),Ia=[`.mjs`,`.cjs`,`.js`,`.json`],La=new Set([`ERR_MODULE_NOT_FOUND`,`ERR_UNSUPPORTED_DIR_IMPORT`,`MODULE_NOT_FOUND`,`ERR_PACKAGE_PATH_NOT_EXPORTED`]);function Ra(e,t,n){try{return ja(e,t,n)}catch(e){if(!La.has(e?.code))throw e}}function za(e,t={}){if(typeof e!=`string`)if(e instanceof URL)e=Ma(e);else throw TypeError("input must be a `string` or `URL`");if(/(?:node|data|http|https):/.test(e))return e;if(fi.has(e))return`node:`+e;if(e.startsWith(`file://`)&&(e=Ma(e)),an(e))try{if(it(e).isFile())return Na(e)}catch(e){if(e?.code!==`ENOENT`)throw e}let n=t.conditions?new Set(t.conditions):Fa,r=(Array.isArray(t.url)?t.url:[t.url]).filter(Boolean).map(e=>new URL(Pa(e.toString())));r.length===0&&r.push(new URL(Na(process.cwd())));let i=[...r];for(let e of r)e.protocol===`file:`&&i.push(new URL(`./`,e),new URL(di(e.pathname,`_index.js`),e),new URL(`node_modules`,e));let a;for(let r of i){if(a=Ra(e,r,n),a)break;for(let i of[``,`/index`]){for(let o of t.extensions||Ia)if(a=Ra(di(e,i)+o,r,n),a)break;if(a)break}if(a)break}if(!a){let t=Error(`Cannot find module ${e} imported from ${i.join(`, `)}`);throw t.code=`ERR_MODULE_NOT_FOUND`,t}return Na(a)}function Ba(e,t){return za(e,t)}function Va(e,t){return Ma(Ba(e,t))}function Ha(e,t){try{return Promise.resolve(Va(e,t))}catch(e){return Promise.reject(e)}}const Ua=`.all-contributorsrc,.commitlintrc,.github,.git,.husky,.huskyrc,.lintstagedrc,.log4brains.yml,.npmrc,.nx,.storm-workspace.js,.storm-workspace.json,.storm-workspace.ts,.storm-workspace.yaml,.storm-workspace.yml,.vscode,.whitesource,bun.lock,bun.lockb,lefthook.yaml,lefthook.yml,lerna.json,npm-lock.json,npm-lock.yaml,npm-lock.yml,npm-workspace.json,npm-workspace.yaml,npm-workspace.yml,nx.json,package-lock.json,patches,pnpm-lock.json,pnpm-lock.yaml,pnpm-lock.yml,pnpm-workspace.json,pnpm-workspace.yaml,pnpm-workspace.yml,socket.yaml,storm-workspace.js,storm-workspace.json,storm-workspace.ts,storm-workspace.yaml,storm-workspace.yml,syncpack.config.js,syncpack.json,turbo.json,yarn-lock.json,yarn-lock.yaml,yarn-lock.yml,yarn-workspace.json,yarn-workspace.yaml,yarn-workspace.yml,yarn.lock`.split(`,`);function Wa(e=ct()){if(process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH)return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH;let t=nn(e);if(t)return t;let n=Ht(Ua,e);if(n)return n;for(n=e;n&&!gt(n);)if(n=Ht(`storm-workspace.json`,n,{skipCwd:!0,includeNameInResults:!1}),n)return n;return e}const Ga=[`js`,`jsx`,`mjs`,`cjs`,`ts`,`tsx`,`mts`,`cts`,`json`,`jsonc`,`json5`,`node`];function Ka(e=[]){let t=e;t.includes(ct())||t.push(ct());let n=Wa();return t.includes(n)||t.push(n),t=yt(t.filter(Boolean).map(e=>_t(e)).reduce((e,t,r,i)=>(e.push(t),bt(t)||(e.push(vt(t,ct())),e.push(vt(t,n)),i.forEach(n=>{e.push(vt(t,n))})),e),[])),t}function qa(e=[]){return yt(e.reduce((e,t)=>(lt(t)===`node_modules`&&e.push(_t(t)),Bt(at(t,`node_modules`))&&e.push(_t(at(t,`node_modules`))),e),[]))}async function Ja(e,t={}){let n=Ka(t.paths);xt(e)?n=qa(n):n.push(...qa(n));let r,i;try{r=await Ha(e,{url:n,extensions:t.extensions??Ga,conditions:t.conditions,fs:t.fs?{statSync:t.fs.statSync,realpathSync:t.fs.realpathSync,readFileSync:t.fs.readFileSync,stat:t.fs.promises?.stat,realpath:t.fs.promises?.realpath,readFile:t.fs.promises?.readFile}:void 0})}catch(e){i=e}if(!r)throw Error(`Unable to resolve module "${e}". The following import paths were tried: \n${n.join(`
11
- `)}`,{cause:i});return _t(r)}async function Ya(e,t={}){try{return await Ja(e,t)}catch{return}}const Xa=`https://power-plant.invalid/`;function Za(e){return!(!g(e)||!(`schema`in e)||`hash`in e||`variant`in e||`source`in e)}function Qa(e){return Za(e)?e.schema:e}function $a(e){return e.endsWith(`#`)?e.slice(0,-1):e}function eo(e){let t=e.indexOf(`#`);return t>=0?e.slice(0,t):e}function to(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function no(e){return e.length===0?``:`/${e.map(e=>to(e)).join(`/`)}`}function ro(e,t){try{return $a(new URL(e,t).toString())}catch{return $a(e)}}function io(e,t,n,r,i){if(!g(e))return;let a=e,o=no(t),s=_(a.$id)?ro(a.$id,n):n,c=eo(s);if(r.set(s,o),r.set(c,o),_(a.$anchor)&&r.set(`${c}#${a.$anchor}`,o),_(a.$dynamicAnchor)){let e=`${c}#${a.$dynamicAnchor}`;r.set(e,o),i.set(e,`#${a.$dynamicAnchor}`)}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{io(n,[...t,e,String(a)],s,r,i)});continue}io(n,[...t,e],s,r,i)}}function ao(e,t,n,r,i){if(!g(e))return;let a=e,o=_(a.$id)?ro(a.$id,n):n;if(_(a.$ref)){let e=ro(a.$ref,o),t=r.get(e)??r.get(eo(e));t!==void 0&&(a.$ref=t.length>0?`#${t}`:`#`)}if(_(a.$dynamicRef)){let e=ro(a.$dynamicRef,o),t=i.get(e);if(t)a.$dynamicRef=t;else{let t=r.get(e)??r.get(eo(e));t!==void 0&&(a.$dynamicRef=t.length>0?`#${t}`:`#`)}}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{ao(n,[...t,e,String(a)],o,r,i)});continue}ao(n,[...t,e],o,r,i)}}function oo(e){if(!g(e))return e;let t=St(e),n=_(t.$id)?ro(t.$id,Xa):Xa,r=new Map,i=new Map;return io(t,[],n,r,i),ao(t,[],n,r,i),t}function so(e){if(s(e))return uo(e);if(g(e)){if(ve(e))return fo(e);let t=e;if(`$schema`in t&&s(t.$schema))return uo(t.$schema)}return e}function co(e){return Array.isArray(e)?e.map(e=>so(e)):e}function lo(e){return At(e,{target:`draft-2020-12`})}function uo(e){let t=e,n={};for(let[e,r]of Object.entries(t))if(e!==`tsType`&&e!==`markdownType`&&e!==`tags`&&e!==`args`&&e!==`resolve`){if(e===`id`&&_(r)){n.$id=r;continue}if(e===`properties`||e===`patternProperties`||e===`dependentSchemas`||e===`$defs`||e===`definitions`){if(!g(r)){n[e]=r;continue}n[e]=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,so(t)]));continue}if(e===`items`||e===`contains`||e===`if`||e===`then`||e===`else`||e===`not`||e===`propertyNames`||e===`additionalProperties`||e===`unevaluatedProperties`){n[e]=so(r);continue}if(e===`oneOf`||e===`anyOf`||e===`allOf`){n[e]=co(r);continue}n[e]=r}return n}function fo(e){let t=e,n=s(t.$schema)?uo(t.$schema):{},r={};for(let[e,n]of Object.entries(t)){if(e.startsWith(`$`)||!g(n))continue;if(ve(n)){r[e]=fo(n);continue}let t=n;if(`$schema`in t&&s(t.$schema)){r[e]=uo(t.$schema);continue}s(n)&&(r[e]=uo(n))}if(!se(n))throw Error(`Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`);let i={...g(n.properties)?n.properties:{},...r};return{...n,type:n.type??`object`,...Object.keys(i).length>0?{properties:i}:{}}}function $(e,t){let n=Qa(t);if(m(n)||ie(n))return x({variant:e,input:n.schema});if(_(n)||typeof n==`boolean`)return x({variant:e,input:n});if(g(n)){if(kt(n))return x({variant:e,input:n._def});if(Ct(n))return x({variant:e,input:n[`~standard`]});if(h(n))return x({variant:e,input:n});if(He(n))return x({variant:e,input:lo(n)});if(ve(n))return x({variant:e,input:fo(n)});if(s(n))return x({variant:e,input:uo(n)})}throw Error(`Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`)}function po(e){if(g(e)){if(kt(e))return Ot(e,{target:`draft-2020-12`});if(ue(e))return fo(e);if(we(e))return uo(e);if(Ct(e))return e[`~standard`].jsonSchema.input({target:`draft-2020-12`});if(He(e))return lo(e);if(h(e))return e}}function mo(e){if(g(e)){if(kt(e))return`zod3`;if(ue(e)||we(e))return`untyped`;if(Ct(e))return`standard-schema`;if(h(e))return`json-schema`;if(He(e))return`valibot`}throw Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`)}function ho(e){let t=Qa(e);return m(t)||ie(t)?t.variant:_(t)||Ie(t)?`file-reference`:mo(t)}async function go(e,t){if(m(e))return e.schema;let n=t??mo(e),r;if((n===`zod3`||n===`json-schema`||n===`standard-schema`||n===`untyped`||n===`valibot`)&&(r=po(e)),r)return oo(r);throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`)}function _o(e,t){if(e===`zod3`)return{hash:$(e,t),variant:`zod3`,schema:t};if(e===`untyped`)return{hash:$(e,t),variant:`untyped`,schema:t};if(e===`standard-schema`)return{hash:$(e,t),variant:`standard-schema`,schema:t};if(e===`json-schema`)return{hash:$(e,t),variant:`json-schema`,schema:t};if(e===`valibot`)return{hash:$(e,t),variant:`valibot`,schema:t};throw Error(`Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`)}async function vo(e,t={}){let n=et(e);if(!n)throw Error(`Failed to extract a file reference from the provided input. The input must be a string or an object with a "file" property that specifies the file path and optional export name.`);let r=n.export??`*`,i=await Ya(n.file,{fs:t.fs});try{return jt({path:i||n.file,type:r,expose:`all`,jsDoc:`extended`,markdownDescription:!0,fullDescription:!0,skipTypeCheck:!0,...t}).createSchema(r)}catch(e){throw Error(`Failed to generate a JSON schema for "${n.file}"${i&&i!==n.file?` (resolved: ${i})`:``} using the type "${r}". Error: ${e.message}`)}}async function yo(e,t={}){let n=Qa(e);if(m(n))return n;if(ie(n))return{...n,source:{hash:$(`json-schema`,n.schema),variant:`json-schema`,schema:n.schema}};let r,i=ho(n),a=$(i,n);if(i===`file-reference`){let e=et(n);if(!e)throw Error(`Failed to extract a valid file reference from the provided input "${JSON.stringify(n)}". Please ensure that the input is correctly formatted as a file reference (e.g. "./schema.ts#MySchema") and that the file exists at the specified path.`);let i=wt(e.file);if(i&&!Tt.includes(i))throw Error(`The provided schema file input "${e.file}" has an invalid file extension (.${i}). Please ensure that the file has one of the following extensions: ${Dt(Tt,{conjunction:`or`})}.`);let a;t.storage&&(a=Ze(t.storage));let o=await Et(n,{...t,fs:a});o??=await vo(n,{...t,fs:a});let s=Qa(o);r=m(s)?s.source:ie(s)?{hash:$(`json-schema`,s.schema),variant:`json-schema`,schema:s.schema}:_o(mo(s),s)}else if([`json-schema`,`standard-schema`,`zod3`,`untyped`,`valibot`,`reflection`].includes(i))r=_o(i,n);else throw Error(`Invalid schema definition input "${i}". The variant must be one of "file-reference", "json-schema", "standard-schema", "zod3", "valibot", "untyped", or "reflection".`);return{variant:i,source:r,schema:await go(r.schema,r.variant),hash:a}}async function bo(e,t={}){let n=Qa(e);if(m(n)||p(n))return n;let r=await yo(e,t);if(!r?.schema)throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);return r}export{o as JSON_SCHEMA_METADATA_KEYS,n as JSON_SCHEMA_PRIMITIVE_TYPES,i as JSON_SCHEMA_TYPES,t as JsonSchemaTypeNames,e as SCHEMA_ARRAY_CONCAT_KEYWORDS,r as SCHEMA_RECORD_KEYWORDS,a as SCHEMA_SINGLE_KEYWORDS,Ve as addProperty,Pe as applyJsonSchemaMetadata,zt as assertSchemasDoNotContradict,oo as bundleReferences,Ye as createStoragePromises,bo as extract,$ as extractHash,po as extractJsonSchema,mo as extractResolvedVariant,go as extractSchema,yo as extractSchemaWithSource,_o as extractSource,vo as extractTSType,ho as extractVariant,Rt as findSchemaContradictions,Ne as getJsonSchema,Re as getJsonSchemaObject,ze as getPrimarySchemaType,Oe as getProperties,be as getPropertiesList,Fe as getProperty,Ie as isFileReference,h as isJsonSchema,De as isJsonSchemaAllOf,Ee as isJsonSchemaAny,ye as isJsonSchemaAnyOf,We as isJsonSchemaArray,qe as isJsonSchemaBigint,xe as isJsonSchemaBoolean,Ke as isJsonSchemaDate,fe as isJsonSchemaDecimal,u as isJsonSchemaEnum,Ge as isJsonSchemaInteger,pe as isJsonSchemaKeywords,f as isJsonSchemaLiteral,d as isJsonSchemaMap,ce as isJsonSchemaNativeEnum,je as isJsonSchemaNever,c as isJsonSchemaNull,Ae as isJsonSchemaNullable,oe as isJsonSchemaNumber,se as isJsonSchemaObject,le as isJsonSchemaPrimitiveType,ee as isJsonSchemaPrimitiveUnion,re as isJsonSchemaRecord,ae as isJsonSchemaRef,de as isJsonSchemaSet,Je as isJsonSchemaString,l as isJsonSchemaTuple,he as isJsonSchemaType,ne as isJsonSchemaUndefined,me as isJsonSchemaUnion,ge as isJsonSchemaUnknown,te as isNullOnlyJsonSchema,Be as isPropertyOptional,ie as isSchema,Se as isSchemaNullable,Le as isSchemaObject,p as isSchemaOf,m as isSchemaWithSource,_e as isStandardSchema,ve as isUntypedConfig,ue as isUntypedConfigStrict,s as isUntypedSchema,we as isUntypedSchemaStrict,He as isValibotSchema,Me as isValidSchemaConfigFile,Ze as mapStorageToFileSystem,Ue as merge,Ce as mergeMetadata,Xe as normalizeKey,ke as readSchemaTypes,Te as traverseSchema};
1
+ import { a as SCHEMA_ARRAY_CONCAT_KEYWORDS, i as JsonSchemaTypeNames, n as JSON_SCHEMA_PRIMITIVE_TYPES, o as SCHEMA_RECORD_KEYWORDS, r as JSON_SCHEMA_TYPES, s as SCHEMA_SINGLE_KEYWORDS, t as JSON_SCHEMA_METADATA_KEYS } from "./constants-COGt3eeW.mjs";
2
+ import { $ as isUntypedSchema, A as isJsonSchemaNull, B as isJsonSchemaTuple, C as isJsonSchemaEnum, D as isJsonSchemaMap, E as isJsonSchemaLiteral, F as isJsonSchemaPrimitiveUnion, G as isNullOnlyJsonSchema, H as isJsonSchemaUndefined, I as isJsonSchemaRecord, J as isSchemaOf, K as isSchema, L as isJsonSchemaRef, M as isJsonSchemaNumber, N as isJsonSchemaObject, O as isJsonSchemaNativeEnum, P as isJsonSchemaPrimitiveType, Q as isUntypedConfigStrict, R as isJsonSchemaSet, S as isJsonSchemaDecimal, T as isJsonSchemaKeywords, U as isJsonSchemaUnion, V as isJsonSchemaType, W as isJsonSchemaUnknown, X as isStandardSchema, Y as isSchemaWithSource, Z as isUntypedConfig, _ as isJsonSchemaAnyOf, a as getPropertiesList, b as isJsonSchemaBoolean, c as isSchemaNullable, d as mergeMetadata, et as isUntypedSchemaStrict, f as traverseSchema, g as isJsonSchemaAny, h as isJsonSchemaAllOf, i as getProperties, it as readSchemaTypes, j as isJsonSchemaNullable, k as isJsonSchemaNever, l as isValidSchemaConfigFile, m as isJsonSchema, n as getJsonSchema, nt as applyJsonSchemaMetadata, o as getProperty, p as isFileReference, q as isSchemaObject, r as getJsonSchemaObject, rt as getPrimarySchemaType, s as isPropertyOptional, t as addProperty, tt as isValibotSchema, u as merge, v as isJsonSchemaArray, w as isJsonSchemaInteger, x as isJsonSchemaDate, y as isJsonSchemaBigint, z as isJsonSchemaString } from "./helpers-reqtcaa8.mjs";
3
+ import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "./storage-C3BT2Xh-.mjs";
4
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
5
+ import { isSetString } from "@stryke/type-checks/is-set-string";
6
+ import { isSetString as isSetString$1 } from "@stryke/type-checks";
7
+ import { extractFileReference } from "@stryke/convert/extract-file-reference";
8
+ import { resolveSafe } from "@stryke/fs/resolve";
9
+ import { murmurhash } from "@stryke/hash";
10
+ import { deepClone } from "@stryke/helpers/deep-clone";
11
+ import { isStandardJsonSchema } from "@stryke/json";
12
+ import { findFileExtensionSafe } from "@stryke/path/find";
13
+ import { VALID_OBJECT_SOURCE_EXTENSIONS } from "@stryke/resolve/constants";
14
+ import { loadSafe } from "@stryke/resolve/load";
15
+ import { list } from "@stryke/string-format/list";
16
+ import { extractJsonSchema as extractJsonSchema$1, isZod3Type } from "@stryke/zod";
17
+ import { createFSBackedSystem, createVirtualCompilerHost } from "@typescript/vfs";
18
+ import { toJsonSchema } from "@valibot/to-json-schema";
19
+ import { dirname } from "node:path";
20
+ import { createGenerator } from "ts-json-schema-generator/dist/factory/generator.js";
21
+ import ts from "typescript";
22
+
23
+ //#region src/compatibility.ts
24
+ const METADATA_KEYS = /* @__PURE__ */ new Set([
25
+ ...JSON_SCHEMA_METADATA_KEYS,
26
+ "default",
27
+ "examples"
28
+ ]);
29
+ function isMetadataKey(key) {
30
+ return METADATA_KEYS.has(key);
31
+ }
32
+ function isUnconstrainedSchema(schema) {
33
+ if (!isSetObject(schema)) return true;
34
+ if (schema.type === "any") return true;
35
+ return Object.keys(schema).filter((key) => !isMetadataKey(key)).length === 0;
36
+ }
37
+ function resolveSchemaTypes(schema) {
38
+ if (isUnconstrainedSchema(schema)) return "any";
39
+ const schemaType = schema.type;
40
+ if (isSetString(schemaType)) return [schemaType];
41
+ if (Array.isArray(schemaType)) return schemaType.filter(isSetString);
42
+ const primitiveTypes = readSchemaTypes(schema);
43
+ if (primitiveTypes.length > 0) return primitiveTypes;
44
+ if (isJsonSchemaObject(schema)) return ["object"];
45
+ if (isJsonSchemaArray(schema)) return ["array"];
46
+ return "any";
47
+ }
48
+ function formatPath(path) {
49
+ return path.length > 0 ? path : "schema";
50
+ }
51
+ function valuesEqual(left, right) {
52
+ return JSON.stringify(left) === JSON.stringify(right);
53
+ }
54
+ /**
55
+ * Finds structural contradictions between two JSON Schema fragments.
56
+ *
57
+ * @remarks
58
+ * Metadata-only keywords are ignored. Either schema may be unconstrained
59
+ * (`{}`, `{ type: "any" }`, or missing structural keywords) without
60
+ * producing contradictions.
61
+ *
62
+ * @param base - The base JSON Schema fragment.
63
+ * @param override - The JSON Schema fragment to compare against the base.
64
+ * @param path - Optional dot-separated path used in issue messages.
65
+ * @returns A list of human-readable contradiction descriptions.
66
+ */
67
+ function findSchemaContradictions(base, override, path = "") {
68
+ const issues = [];
69
+ if (isUnconstrainedSchema(base) || isUnconstrainedSchema(override)) return issues;
70
+ const baseTypes = resolveSchemaTypes(base);
71
+ const overrideTypes = resolveSchemaTypes(override);
72
+ if (baseTypes !== "any" && overrideTypes !== "any") {
73
+ if (baseTypes.filter((type) => overrideTypes.includes(type)).length === 0) {
74
+ issues.push(`${formatPath(path)} has conflicting types: ${baseTypes.join("|")} vs ${overrideTypes.join("|")}`);
75
+ return issues;
76
+ }
77
+ }
78
+ const baseConst = base.const;
79
+ const overrideConst = override.const;
80
+ if (baseConst !== void 0 && overrideConst !== void 0 && !valuesEqual(baseConst, overrideConst)) issues.push(`${formatPath(path)} has conflicting const values`);
81
+ const baseEnum = base.enum;
82
+ const overrideEnum = override.enum;
83
+ if (baseEnum?.length && overrideEnum?.length) {
84
+ if (!overrideEnum.some((value) => baseEnum.some((baseValue) => valuesEqual(baseValue, value)))) issues.push(`${formatPath(path)} has enum values that do not overlap`);
85
+ }
86
+ if (isJsonSchemaObject(base) && isJsonSchemaObject(override)) {
87
+ const baseProperties = base.properties ?? {};
88
+ const overrideProperties = override.properties ?? {};
89
+ for (const [key, overrideProperty] of Object.entries(overrideProperties)) {
90
+ const baseProperty = baseProperties[key];
91
+ const propertyPath = path ? `${path}.${key}` : key;
92
+ if (baseProperty && isJsonSchema(baseProperty) && isJsonSchema(overrideProperty)) issues.push(...findSchemaContradictions(baseProperty, overrideProperty, propertyPath));
93
+ }
94
+ }
95
+ if (isJsonSchemaArray(base) && isJsonSchemaArray(override)) {
96
+ const baseItems = base.items;
97
+ const overrideItems = override.items;
98
+ if (baseItems && overrideItems && isJsonSchema(baseItems) && isJsonSchema(overrideItems)) issues.push(...findSchemaContradictions(baseItems, overrideItems, path ? `${path}[]` : "items"));
99
+ const basePrefix = base.prefixItems;
100
+ const overridePrefix = override.prefixItems;
101
+ if (Array.isArray(basePrefix) && Array.isArray(overridePrefix)) {
102
+ const length = Math.min(basePrefix.length, overridePrefix.length);
103
+ for (let index = 0; index < length; index++) {
104
+ const baseItem = basePrefix[index];
105
+ const overrideItem = overridePrefix[index];
106
+ if (isJsonSchema(baseItem) && isJsonSchema(overrideItem)) issues.push(...findSchemaContradictions(baseItem, overrideItem, path ? `${path}[${index}]` : `[${index}]`));
107
+ }
108
+ }
109
+ }
110
+ return issues;
111
+ }
112
+ /**
113
+ * Asserts that two JSON Schema fragments do not structurally contradict each other.
114
+ *
115
+ * @param base - The base JSON Schema fragment.
116
+ * @param override - The JSON Schema fragment to compare against the base.
117
+ * @param label - A label used in the thrown error message.
118
+ * @throws {Error} When one or more structural contradictions are found.
119
+ */
120
+ function assertSchemasDoNotContradict(base, override, label = "schema") {
121
+ const issues = findSchemaContradictions(base, override);
122
+ if (issues.length > 0) throw new Error(`The ${label} schema contradicts the generator schema:\n${issues.map((issue) => `- ${issue}`).join("\n")}`);
123
+ }
124
+
125
+ //#endregion
126
+ //#region src/extract.ts
127
+ const SCHEMA_BUNDLE_BASE_URI = "https://power-plant.invalid/";
128
+ const DEFAULT_TS_COMPILER_OPTIONS = {
129
+ noEmit: true,
130
+ emitDecoratorMetadata: true,
131
+ experimentalDecorators: true,
132
+ target: ts.ScriptTarget.ES2022,
133
+ module: ts.ModuleKind.ESNext,
134
+ strictNullChecks: false,
135
+ skipLibCheck: true,
136
+ skipDefaultLibCheck: true,
137
+ esModuleInterop: true
138
+ };
139
+ function readFileAsString(fs, fileName) {
140
+ if (!fs.readFileSync) return;
141
+ try {
142
+ const content = fs.readFileSync(fileName, "utf8");
143
+ return typeof content === "string" ? content : void 0;
144
+ } catch {
145
+ return;
146
+ }
147
+ }
148
+ function fileExistsOnFs(fs, fileName) {
149
+ if (fs.existsSync) try {
150
+ return fs.existsSync(fileName);
151
+ } catch {
152
+ return false;
153
+ }
154
+ if (fs.statSync) try {
155
+ fs.statSync(fileName);
156
+ return true;
157
+ } catch {
158
+ return false;
159
+ }
160
+ return readFileAsString(fs, fileName) !== void 0;
161
+ }
162
+ /**
163
+ * Prefers `options.fs` for System I/O so virtual storage-backed files resolve
164
+ * through createFSBackedSystem instead of only the real disk.
165
+ */
166
+ function bindFileSystemToSystem(system, fs) {
167
+ const baseFileExists = system.fileExists.bind(system);
168
+ const baseReadFile = system.readFile.bind(system);
169
+ const baseDirectoryExists = system.directoryExists.bind(system);
170
+ const baseRealpath = system.realpath?.bind(system);
171
+ system.fileExists = (fileName) => fileExistsOnFs(fs, fileName) || baseFileExists(fileName);
172
+ system.readFile = (fileName) => {
173
+ if (fileExistsOnFs(fs, fileName)) {
174
+ const content = readFileAsString(fs, fileName);
175
+ if (content !== void 0) return content;
176
+ }
177
+ return baseReadFile(fileName);
178
+ };
179
+ system.directoryExists = (directory) => {
180
+ try {
181
+ if (fs.statSync) {
182
+ if (fs.statSync(directory)?.isDirectory?.()) return true;
183
+ } else if (fs.existsSync?.(directory)) return true;
184
+ } catch {}
185
+ return baseDirectoryExists(directory);
186
+ };
187
+ if (system.realpath && fs.realpathSync) system.realpath = (path) => {
188
+ try {
189
+ return String(fs.realpathSync(path));
190
+ } catch {
191
+ return baseRealpath?.(path) ?? path;
192
+ }
193
+ };
194
+ }
195
+ function resolveCompilerOptions(system, tsconfig, fs) {
196
+ if (!tsconfig) return { ...DEFAULT_TS_COMPILER_OPTIONS };
197
+ const raw = (fs ? readFileAsString(fs, tsconfig) : void 0) ?? ts.sys.readFile(tsconfig);
198
+ if (!raw) return { ...DEFAULT_TS_COMPILER_OPTIONS };
199
+ const parsed = ts.parseConfigFileTextToJson(tsconfig, raw);
200
+ if (!parsed.config) return { ...DEFAULT_TS_COMPILER_OPTIONS };
201
+ const options = {
202
+ ...ts.parseJsonConfigFileContent(parsed.config, system, dirname(tsconfig), {}, tsconfig).options,
203
+ noEmit: true
204
+ };
205
+ delete options.out;
206
+ delete options.outDir;
207
+ delete options.outFile;
208
+ delete options.declaration;
209
+ delete options.declarationDir;
210
+ delete options.declarationMap;
211
+ return options;
212
+ }
213
+ function createProgramFromFileSystem(rootFile, options) {
214
+ const projectRoot = options.cwd ?? dirname(rootFile);
215
+ const createSystem = createFSBackedSystem;
216
+ const createHost = createVirtualCompilerHost;
217
+ const system = createSystem(/* @__PURE__ */ new Map(), projectRoot, ts);
218
+ if (options.fs) bindFileSystemToSystem(system, options.fs);
219
+ const compilerOptions = resolveCompilerOptions(system, options.tsconfig, options.fs);
220
+ const { compilerHost } = createHost(system, compilerOptions, ts);
221
+ return ts.createProgram({
222
+ rootNames: [rootFile],
223
+ options: compilerOptions,
224
+ host: compilerHost
225
+ });
226
+ }
227
+ function isWrappedSchemaConfig(input) {
228
+ if (!isSetObject(input) || !("schema" in input)) return false;
229
+ if ("hash" in input || "variant" in input || "source" in input) return false;
230
+ return true;
231
+ }
232
+ function unwrapSchemaConfig(input) {
233
+ if (isWrappedSchemaConfig(input)) return input.schema;
234
+ return input;
235
+ }
236
+ function normalizeUri(uri) {
237
+ return uri.endsWith("#") ? uri.slice(0, -1) : uri;
238
+ }
239
+ function stripUriFragment(uri) {
240
+ const hashIndex = uri.indexOf("#");
241
+ return hashIndex >= 0 ? uri.slice(0, hashIndex) : uri;
242
+ }
243
+ function escapeJsonPointerToken(token) {
244
+ return token.replaceAll("~", "~0").replaceAll("/", "~1");
245
+ }
246
+ function toJsonPointer(path) {
247
+ if (path.length === 0) return "";
248
+ return `/${path.map((segment) => escapeJsonPointerToken(segment)).join("/")}`;
249
+ }
250
+ function resolveUri(reference, baseUri) {
251
+ try {
252
+ return normalizeUri(new URL(reference, baseUri).toString());
253
+ } catch {
254
+ return normalizeUri(reference);
255
+ }
256
+ }
257
+ function collectReferenceTargets(value, path, baseUri, uriToPointer, dynamicUriToFragment) {
258
+ if (!isSetObject(value)) return;
259
+ const schema = value;
260
+ const pointer = toJsonPointer(path);
261
+ const currentBaseUri = isSetString$1(schema.$id) ? resolveUri(schema.$id, baseUri) : baseUri;
262
+ const currentDocumentUri = stripUriFragment(currentBaseUri);
263
+ uriToPointer.set(currentBaseUri, pointer);
264
+ uriToPointer.set(currentDocumentUri, pointer);
265
+ if (isSetString$1(schema.$anchor)) uriToPointer.set(`${currentDocumentUri}#${schema.$anchor}`, pointer);
266
+ if (isSetString$1(schema.$dynamicAnchor)) {
267
+ const dynamicTarget = `${currentDocumentUri}#${schema.$dynamicAnchor}`;
268
+ uriToPointer.set(dynamicTarget, pointer);
269
+ dynamicUriToFragment.set(dynamicTarget, `#${schema.$dynamicAnchor}`);
270
+ }
271
+ for (const [key, child] of Object.entries(schema)) {
272
+ if (Array.isArray(child)) {
273
+ child.forEach((entry, index) => {
274
+ collectReferenceTargets(entry, [
275
+ ...path,
276
+ key,
277
+ String(index)
278
+ ], currentBaseUri, uriToPointer, dynamicUriToFragment);
279
+ });
280
+ continue;
281
+ }
282
+ collectReferenceTargets(child, [...path, key], currentBaseUri, uriToPointer, dynamicUriToFragment);
283
+ }
284
+ }
285
+ function rewriteReferenceTargets(value, path, baseUri, uriToPointer, dynamicUriToFragment) {
286
+ if (!isSetObject(value)) return;
287
+ const schema = value;
288
+ const currentBaseUri = isSetString$1(schema.$id) ? resolveUri(schema.$id, baseUri) : baseUri;
289
+ if (isSetString$1(schema.$ref)) {
290
+ const resolvedRefUri = resolveUri(schema.$ref, currentBaseUri);
291
+ const pointer = uriToPointer.get(resolvedRefUri) ?? uriToPointer.get(stripUriFragment(resolvedRefUri));
292
+ if (pointer !== void 0) schema.$ref = pointer.length > 0 ? `#${pointer}` : "#";
293
+ }
294
+ if (isSetString$1(schema.$dynamicRef)) {
295
+ const resolvedDynamicRefUri = resolveUri(schema.$dynamicRef, currentBaseUri);
296
+ const dynamicFragment = dynamicUriToFragment.get(resolvedDynamicRefUri);
297
+ if (dynamicFragment) schema.$dynamicRef = dynamicFragment;
298
+ else {
299
+ const pointer = uriToPointer.get(resolvedDynamicRefUri) ?? uriToPointer.get(stripUriFragment(resolvedDynamicRefUri));
300
+ if (pointer !== void 0) schema.$dynamicRef = pointer.length > 0 ? `#${pointer}` : "#";
301
+ }
302
+ }
303
+ for (const [key, child] of Object.entries(schema)) {
304
+ if (Array.isArray(child)) {
305
+ child.forEach((entry, index) => {
306
+ rewriteReferenceTargets(entry, [
307
+ ...path,
308
+ key,
309
+ String(index)
310
+ ], currentBaseUri, uriToPointer, dynamicUriToFragment);
311
+ });
312
+ continue;
313
+ }
314
+ rewriteReferenceTargets(child, [...path, key], currentBaseUri, uriToPointer, dynamicUriToFragment);
315
+ }
316
+ }
317
+ /**
318
+ * Bundles all external references in a JSON Schema into a single schema document by collecting all reference targets and rewriting the references to point to the bundled definitions. This ensures that the resulting schema is self-contained and can be used independently without relying on external documents.
319
+ *
320
+ * @param schema - The JSON Schema to bundle references for.
321
+ * @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.
322
+ */
323
+ function bundleReferences(schema) {
324
+ if (!isSetObject(schema)) return schema;
325
+ const bundledSchema = deepClone(schema);
326
+ const baseUri = isSetString$1(bundledSchema.$id) ? resolveUri(bundledSchema.$id, SCHEMA_BUNDLE_BASE_URI) : SCHEMA_BUNDLE_BASE_URI;
327
+ const uriToPointer = /* @__PURE__ */ new Map();
328
+ const dynamicUriToFragment = /* @__PURE__ */ new Map();
329
+ collectReferenceTargets(bundledSchema, [], baseUri, uriToPointer, dynamicUriToFragment);
330
+ rewriteReferenceTargets(bundledSchema, [], baseUri, uriToPointer, dynamicUriToFragment);
331
+ return bundledSchema;
332
+ }
333
+ function convertNestedUntypedSchema(value) {
334
+ if (isUntypedSchema(value)) return convertUntypedSchemaToJsonSchema(value);
335
+ if (isSetObject(value)) {
336
+ if (isUntypedConfig(value)) return convertUntypedConfigToJsonSchema(value);
337
+ const nested = value;
338
+ if ("$schema" in nested && isUntypedSchema(nested.$schema)) return convertUntypedSchemaToJsonSchema(nested.$schema);
339
+ }
340
+ return value;
341
+ }
342
+ function convertNestedUntypedSchemaArray(value) {
343
+ if (!Array.isArray(value)) return value;
344
+ return value.map((item) => convertNestedUntypedSchema(item));
345
+ }
346
+ function convertValibotSchemaToJsonSchema(schema) {
347
+ return toJsonSchema(schema, { target: "draft-2020-12" });
348
+ }
349
+ function convertUntypedSchemaToJsonSchema(schema) {
350
+ const source = schema;
351
+ const jsonSchema = {};
352
+ for (const [key, value] of Object.entries(source)) {
353
+ if (key === "tsType" || key === "markdownType" || key === "tags" || key === "args" || key === "resolve") continue;
354
+ if (key === "id" && isSetString$1(value)) {
355
+ jsonSchema.$id = value;
356
+ continue;
357
+ }
358
+ if (key === "properties" || key === "patternProperties" || key === "dependentSchemas" || key === "$defs" || key === "definitions") {
359
+ if (!isSetObject(value)) {
360
+ jsonSchema[key] = value;
361
+ continue;
362
+ }
363
+ jsonSchema[key] = Object.fromEntries(Object.entries(value).map(([propertyKey, propertyValue]) => [propertyKey, convertNestedUntypedSchema(propertyValue)]));
364
+ continue;
365
+ }
366
+ if (key === "items" || key === "contains" || key === "if" || key === "then" || key === "else" || key === "not" || key === "propertyNames" || key === "additionalProperties" || key === "unevaluatedProperties") {
367
+ jsonSchema[key] = convertNestedUntypedSchema(value);
368
+ continue;
369
+ }
370
+ if (key === "oneOf" || key === "anyOf" || key === "allOf") {
371
+ jsonSchema[key] = convertNestedUntypedSchemaArray(value);
372
+ continue;
373
+ }
374
+ jsonSchema[key] = value;
375
+ }
376
+ return jsonSchema;
377
+ }
378
+ function convertUntypedConfigToJsonSchema(input) {
379
+ const inputObject = input;
380
+ const base = isUntypedSchema(inputObject.$schema) ? convertUntypedSchemaToJsonSchema(inputObject.$schema) : {};
381
+ const properties = {};
382
+ for (const [key, value] of Object.entries(inputObject)) {
383
+ if (key.startsWith("$")) continue;
384
+ if (!isSetObject(value)) continue;
385
+ if (isUntypedConfig(value)) {
386
+ properties[key] = convertUntypedConfigToJsonSchema(value);
387
+ continue;
388
+ }
389
+ const nested = value;
390
+ if ("$schema" in nested && isUntypedSchema(nested.$schema)) {
391
+ properties[key] = convertUntypedSchemaToJsonSchema(nested.$schema);
392
+ continue;
393
+ }
394
+ if (isUntypedSchema(value)) properties[key] = convertUntypedSchemaToJsonSchema(value);
395
+ }
396
+ if (!isJsonSchemaObject(base)) throw new Error(`Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`);
397
+ const mergedProperties = {
398
+ ...isSetObject(base.properties) ? base.properties : {},
399
+ ...properties
400
+ };
401
+ return {
402
+ ...base,
403
+ type: base.type ?? "object",
404
+ ...Object.keys(mergedProperties).length > 0 ? { properties: mergedProperties } : {}
405
+ };
406
+ }
407
+ /**
408
+ * Creates a hash string for a given schema definition input.
409
+ */
410
+ function extractHash(variant, input) {
411
+ const unwrappedConfig = unwrapSchemaConfig(input);
412
+ if (isSchemaWithSource(unwrappedConfig) || isSchema(unwrappedConfig)) return murmurhash({
413
+ variant,
414
+ input: unwrappedConfig.schema
415
+ });
416
+ if (isSetString$1(unwrappedConfig)) return murmurhash({
417
+ variant,
418
+ input: unwrappedConfig
419
+ });
420
+ else if (typeof unwrappedConfig === "boolean") return murmurhash({
421
+ variant,
422
+ input: unwrappedConfig
423
+ });
424
+ else if (isSetObject(unwrappedConfig)) {
425
+ if (isZod3Type(unwrappedConfig)) return murmurhash({
426
+ variant,
427
+ input: unwrappedConfig._def
428
+ });
429
+ else if (isStandardJsonSchema(unwrappedConfig)) return murmurhash({
430
+ variant,
431
+ input: unwrappedConfig["~standard"]
432
+ });
433
+ else if (isJsonSchema(unwrappedConfig)) return murmurhash({
434
+ variant,
435
+ input: unwrappedConfig
436
+ });
437
+ else if (isValibotSchema(unwrappedConfig)) return murmurhash({
438
+ variant,
439
+ input: convertValibotSchemaToJsonSchema(unwrappedConfig)
440
+ });
441
+ else if (isUntypedConfig(unwrappedConfig)) return murmurhash({
442
+ variant,
443
+ input: convertUntypedConfigToJsonSchema(unwrappedConfig)
444
+ });
445
+ else if (isUntypedSchema(unwrappedConfig)) return murmurhash({
446
+ variant,
447
+ input: convertUntypedSchemaToJsonSchema(unwrappedConfig)
448
+ });
449
+ }
450
+ throw new Error(`Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`);
451
+ }
452
+ /**
453
+ * Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.
454
+ *
455
+ * @param schema - The schema input to extract a JSON Schema from.
456
+ * @returns The extracted JSON Schema, or `undefined` if the input is not a supported schema type.
457
+ */
458
+ function extractJsonSchema(schema) {
459
+ if (isSetObject(schema)) {
460
+ if (isZod3Type(schema)) return extractJsonSchema$1(schema, { target: "draft-2020-12" });
461
+ if (isUntypedConfigStrict(schema)) return convertUntypedConfigToJsonSchema(schema);
462
+ if (isUntypedSchemaStrict(schema)) return convertUntypedSchemaToJsonSchema(schema);
463
+ if (isStandardJsonSchema(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-2020-12" });
464
+ if (isValibotSchema(schema)) return convertValibotSchemaToJsonSchema(schema);
465
+ if (isJsonSchema(schema)) return schema;
466
+ }
467
+ }
468
+ /**
469
+ * Resolves the concrete source variant for a schema source input.
470
+ *
471
+ * @param input - The schema source input to inspect.
472
+ * @returns The resolved schema source variant.
473
+ * @throws Will throw an error when the input cannot be mapped to a supported source variant.
474
+ */
475
+ function extractResolvedVariant(input) {
476
+ if (isSetObject(input)) {
477
+ if (isZod3Type(input)) return "zod3";
478
+ else if (isUntypedConfigStrict(input) || isUntypedSchemaStrict(input)) return "untyped";
479
+ else if (isStandardJsonSchema(input)) return "standard-schema";
480
+ else if (isJsonSchema(input)) return "json-schema";
481
+ else if (isValibotSchema(input)) return "valibot";
482
+ }
483
+ throw new Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`);
484
+ }
485
+ /**
486
+ * Determines the top-level input variant for schema extraction.
487
+ *
488
+ * @param input - The schema input to classify.
489
+ * @returns The resolved schema input variant.
490
+ */
491
+ function extractVariant(input) {
492
+ const unwrappedConfig = unwrapSchemaConfig(input);
493
+ if (isSchemaWithSource(unwrappedConfig) || isSchema(unwrappedConfig)) return unwrappedConfig.variant;
494
+ if (isSetString$1(unwrappedConfig) || isFileReference(unwrappedConfig)) return "file-reference";
495
+ return extractResolvedVariant(unwrappedConfig);
496
+ }
497
+ /**
498
+ * Extracts and normalizes a JSON Schema from a concrete schema source input.
499
+ *
500
+ * @param input - The schema source input to extract from.
501
+ * @param variant - Optional source variant override. When omitted, the variant is inferred from the input.
502
+ * @returns A promise that resolves to a bundled JSON Schema.
503
+ * @throws Will throw an error if no valid JSON Schema can be extracted from the input.
504
+ */
505
+ async function extractSchema(input, variant) {
506
+ if (isSchemaWithSource(input)) return input.schema;
507
+ const resolvedVariant = variant ?? extractResolvedVariant(input);
508
+ let schema;
509
+ if (resolvedVariant === "zod3" || resolvedVariant === "json-schema" || resolvedVariant === "standard-schema" || resolvedVariant === "untyped" || resolvedVariant === "valibot") schema = extractJsonSchema(input);
510
+ if (schema) return bundleReferences(schema);
511
+ throw new Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`);
512
+ }
513
+ /**
514
+ * Builds source metadata for a schema input using a known source variant.
515
+ *
516
+ * @param variant - The schema source variant associated with the input.
517
+ * @param input - The schema source input to wrap.
518
+ * @returns The normalized schema source payload, including the source hash and variant.
519
+ * @throws Will throw an error if the provided variant is unsupported.
520
+ */
521
+ function extractSource(variant, input) {
522
+ if (variant === "zod3") return {
523
+ hash: extractHash(variant, input),
524
+ variant: "zod3",
525
+ schema: input
526
+ };
527
+ else if (variant === "untyped") return {
528
+ hash: extractHash(variant, input),
529
+ variant: "untyped",
530
+ schema: input
531
+ };
532
+ else if (variant === "standard-schema") return {
533
+ hash: extractHash(variant, input),
534
+ variant: "standard-schema",
535
+ schema: input
536
+ };
537
+ else if (variant === "json-schema") return {
538
+ hash: extractHash(variant, input),
539
+ variant: "json-schema",
540
+ schema: input
541
+ };
542
+ else if (variant === "valibot") return {
543
+ hash: extractHash(variant, input),
544
+ variant: "valibot",
545
+ schema: input
546
+ };
547
+ throw new Error(`Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);
548
+ }
549
+ /**
550
+ * Resolves a type definition to a JSON Schema. This function passes the provided file reference to ts-json-schema-generator, using the referenced export name as the target type when one is provided.
551
+ *
552
+ * @param input - The type definition to compile. This can be either a string or a {@link FileReference} object.
553
+ * @param options - Optional overrides reserved for API compatibility.
554
+ * @returns A promise that resolves to the generated JSON Schema.
555
+ */
556
+ async function extractTSType(input, options = {}) {
557
+ const fileReference = extractFileReference(input);
558
+ if (!fileReference) throw new Error(`Failed to extract a file reference from the provided input. The input must be a string or an object with a "file" property that specifies the file path and optional export name.`);
559
+ const exportName = fileReference.export ?? "*";
560
+ const resolvedPath = await resolveSafe(fileReference.file, { fs: options.fs });
561
+ const filePath = resolvedPath || fileReference.file;
562
+ try {
563
+ return createGenerator({
564
+ path: filePath,
565
+ type: exportName,
566
+ expose: "all",
567
+ jsDoc: "extended",
568
+ markdownDescription: true,
569
+ fullDescription: true,
570
+ skipTypeCheck: true,
571
+ tsProgram: createProgramFromFileSystem(filePath, options),
572
+ ...options
573
+ }).createSchema(exportName);
574
+ } catch (error) {
575
+ throw new Error(`Failed to generate a JSON schema for "${fileReference.file}"${resolvedPath && resolvedPath !== fileReference.file ? ` (resolved: ${resolvedPath})` : ""} using the type "${exportName}". Error: ${error.message}`);
576
+ }
577
+ }
578
+ /**
579
+ * Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator) to obtain the actual schema definition before extraction.
580
+ *
581
+ * @example
582
+ * ```ts
583
+ * Resolve a schema definition from a JSON schema file
584
+ * const schema1 = await extract(context, "./schemas/my-json-schema.json");
585
+ * // Resolve a schema definition from a TypeScript module export
586
+ * const schema2 = await extract(context, "./schemas.ts#MySchema");
587
+ * // Resolve a schema definition from a JSON Schema object
588
+ * const schema3 = await extract(context, schemaObject);
589
+ * // Resolve a schema definition from a Zod schema
590
+ * const schema4 = await extract(context, zodSchema);
591
+ * // Resolve a schema definition from a Valibot schema
592
+ * const schema5 = await extract(context, valibotSchema);
593
+ * // Resolve a schema definition from an untyped schema
594
+ * const schema6 = await extract(context, untypedSchema);
595
+ * ```
596
+ *
597
+ * @see https://zod.dev/
598
+ * @see https://valibot.dev/
599
+ * @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
600
+ * @see https://json-schema.org/
601
+ * @see https://ajv.js.org/json-type-definition.html
602
+ * @see https://github.com/vega/ts-json-schema-generator
603
+ * @see https://github.com/unjs/untyped
604
+ * @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
605
+ *
606
+ * @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options.
607
+ * @param options - Optional overrides for the configuration used during extraction.
608
+ * @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.
609
+ * @throws Will throw an error if the input is not a valid schema definition or if the extraction process fails to produce a valid schema.
610
+ */
611
+ async function extractSchemaWithSource(input, options = {}) {
612
+ const unwrappedConfig = unwrapSchemaConfig(input);
613
+ if (isSchemaWithSource(unwrappedConfig)) return unwrappedConfig;
614
+ if (isSchema(unwrappedConfig)) return {
615
+ ...unwrappedConfig,
616
+ source: {
617
+ hash: extractHash("json-schema", unwrappedConfig.schema),
618
+ variant: "json-schema",
619
+ schema: unwrappedConfig.schema
620
+ }
621
+ };
622
+ let source;
623
+ const variant = extractVariant(unwrappedConfig);
624
+ const hash = extractHash(variant, unwrappedConfig);
625
+ if (variant === "file-reference") {
626
+ const fileReference = extractFileReference(unwrappedConfig);
627
+ if (!fileReference) throw new Error(`Failed to extract a valid file reference from the provided input "${JSON.stringify(unwrappedConfig)}". Please ensure that the input is correctly formatted as a file reference (e.g. "./schema.ts#MySchema") and that the file exists at the specified path.`);
628
+ const extension = findFileExtensionSafe(fileReference.file);
629
+ if (extension && !VALID_OBJECT_SOURCE_EXTENSIONS.includes(extension)) throw new Error(`The provided schema file input "${fileReference.file}" has an invalid file extension (.${extension}). Please ensure that the file has one of the following extensions: ${list(VALID_OBJECT_SOURCE_EXTENSIONS, { conjunction: "or" })}.`);
630
+ let fs;
631
+ if (options.storage) fs = mapStorageToFileSystem(options.storage);
632
+ let resolved = await loadSafe(unwrappedConfig, {
633
+ ...options,
634
+ fs
635
+ });
636
+ resolved ??= await extractTSType(unwrappedConfig, {
637
+ ...options,
638
+ fs
639
+ });
640
+ const resolvedConfig = unwrapSchemaConfig(resolved);
641
+ if (isSchemaWithSource(resolvedConfig)) source = resolvedConfig.source;
642
+ else if (isSchema(resolvedConfig)) source = {
643
+ hash: extractHash("json-schema", resolvedConfig.schema),
644
+ variant: "json-schema",
645
+ schema: resolvedConfig.schema
646
+ };
647
+ else source = extractSource(extractResolvedVariant(resolvedConfig), resolvedConfig);
648
+ } else if ([
649
+ "json-schema",
650
+ "standard-schema",
651
+ "zod3",
652
+ "untyped",
653
+ "valibot",
654
+ "reflection"
655
+ ].includes(variant)) source = extractSource(variant, unwrappedConfig);
656
+ else throw new Error(`Invalid schema definition input "${variant}". The variant must be one of "file-reference", "json-schema", "standard-schema", "zod3", "valibot", "untyped", or "reflection".`);
657
+ return {
658
+ variant,
659
+ source,
660
+ schema: await extractSchema(source.schema, source.variant),
661
+ hash
662
+ };
663
+ }
664
+ /**
665
+ * Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator) to obtain the actual schema definition before extraction.
666
+ *
667
+ * @example
668
+ * ```ts
669
+ * Resolve a schema definition from a JSON schema file
670
+ * const schema1 = await extract(context, "./schemas/my-json-schema.json");
671
+ * // Resolve a schema definition from a TypeScript module export
672
+ * const schema2 = await extract(context, "./schemas.ts#MySchema");
673
+ * // Resolve a schema definition from a JSON Schema object
674
+ * const schema3 = await extract(context, schemaObject);
675
+ * // Resolve a schema definition from a Zod schema
676
+ * const schema4 = await extract(context, zodSchema);
677
+ * // Resolve a schema definition from a Valibot schema
678
+ * const schema5 = await extract(context, valibotSchema);
679
+ * // Resolve a schema definition from an untyped schema
680
+ * const schema6 = await extract(context, untypedSchema);
681
+ * ```
682
+ *
683
+ * @see https://zod.dev/
684
+ * @see https://valibot.dev/
685
+ * @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
686
+ * @see https://json-schema.org/
687
+ * @see https://ajv.js.org/json-type-definition.html
688
+ * @see https://github.com/vega/ts-json-schema-generator
689
+ * @see https://github.com/unjs/untyped
690
+ * @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
691
+ *
692
+ * @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options.
693
+ * @param options - Optional overrides for the configuration used during extraction.
694
+ * @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.
695
+ * @throws Will throw an error if the input is not a valid schema definition or if the extraction process fails to produce a valid schema.
696
+ */
697
+ async function extract(input, options = {}) {
698
+ const unwrappedConfig = unwrapSchemaConfig(input);
699
+ if (isSchemaWithSource(unwrappedConfig) || isSchemaOf(unwrappedConfig)) return unwrappedConfig;
700
+ const result = await extractSchemaWithSource(input, options);
701
+ if (!result?.schema) throw new Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);
702
+ return result;
703
+ }
704
+
705
+ //#endregion
706
+ export { JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchemaTypeNames, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, addProperty, applyJsonSchemaMetadata, assertSchemasDoNotContradict, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, findSchemaContradictions, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
12
707
  //# sourceMappingURL=index.mjs.map