@frontfriend/sdk 1.2.3 → 1.2.4

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.
@@ -1,28 +1,28 @@
1
- var As=Object.create;var It=Object.defineProperty;var _s=Object.getOwnPropertyDescriptor;var Es=Object.getOwnPropertyNames;var Ps=Object.getPrototypeOf,Rs=Object.prototype.hasOwnProperty;var Yi=(r,s)=>()=>(r&&(s=r(r=0)),s);var Ie=(r,s)=>()=>(s||r((s={exports:{}}).exports,s),s.exports),Qt=(r,s)=>{for(var c in s)It(r,c,{get:s[c],enumerable:!0})},Xi=(r,s,c,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let l of Es(s))!Rs.call(r,l)&&l!==c&&It(r,l,{get:()=>s[l],enumerable:!(u=_s(s,l))||u.enumerable});return r};var et=(r,s,c)=>(c=r!=null?As(Ps(r)):{},Xi(s||!r||!r.__esModule?It(c,"default",{value:r,enumerable:!0}):c,r)),ut=r=>Xi(It({},"__esModule",{value:!0}),r);var tr={};Qt(tr,{ProjectTargetError:()=>Be,SUPPORTED_PROJECT_TARGETS:()=>Zi,assertMatchingProjectTargets:()=>er,defaultV4ProjectTarget:()=>Ts,parseProjectTarget:()=>be,projectTargetKey:()=>Ve,registryRoute:()=>Os,resolveProjectTarget:()=>Ls});function Ve(r){return`${r.framework}/${r.primitive}`}function be(r,s="Project target"){let c=r,u=typeof c?.framework=="string"?c.framework.trim().toLowerCase():"",l=typeof c?.primitive=="string"?c.primitive.trim().toLowerCase():"",p=`${u}/${l}`;if(!u||!l||!Ns.has(p))throw new Be("INVALID_PROJECT_TARGET",`${s} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${p}.`,{framework:u||null,primitive:l||null});return{framework:u,primitive:l}}function Ts(r="react"){return be({framework:r,primitive:r==="vue"?"reka":"base"})}function er(r){let s=Object.entries(r).filter(([,l])=>l!=null).map(([l,p])=>[l,be(p,l)]);if(s.length===0)throw new Be("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let c=Ve(s[0][1]);if(s.find(([,l])=>Ve(l)!==c))throw new Be("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${s.map(([l,p])=>`${l}=${Ve(p)}`).join(", ")}.`,{targets:Object.fromEntries(s)});return s[0][1]}function Ls({persisted:r,configured:s,app:c,release:u,lock:l,proposed:p}={}){let h={persisted:r,configured:s,app:c,release:u,lock:l};if(Object.values(h).some(f=>f!=null))return er(h);if(p)return be(p,"migration proposal");throw new Be("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function Os(r,s){throw be(r),String(s||"").trim(),new Be("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var Zi,Ns,Be,At=Yi(()=>{Zi=Object.freeze([Object.freeze({framework:"react",primitive:"radix"}),Object.freeze({framework:"react",primitive:"base"}),Object.freeze({framework:"react",primitive:"aria"}),Object.freeze({framework:"vue",primitive:"reka"})]),Ns=new Set(Zi.map(r=>`${r.framework}/${r.primitive}`)),Be=class extends Error{constructor(s,c,u={}){super(c),this.name="ProjectTargetError",this.code=s,Object.assign(this,u)}}});var ii=Ie((ia,or)=>{var Fe=require("fs"),Pe=require("path"),{createHash:nr}=require("crypto"),Fs=".frontfriend/design",Ds=".frontfriend/.gitignore";function Ms(){return["# Managed by `frontfriend design sync`.","# audit/ holds regenerable capture artifacts (screenshots, probes) \u2014 never commit.","# design/ is the committed read-only contract mirror \u2014 keep it tracked.","audit/","# design-working/ is an explicit, disposable working preview.","design-working/",""].join(`
2
- `)}function ht(r){return typeof r!="string"||r.length===0||r.startsWith("/")||r.includes("\\")?!1:r.split("/").every(s=>s!==""&&s!=="."&&s!=="..")}function Zt(r){let s=r.body.endsWith(`
3
- `)?r.body.slice(0,-1):r.body;return["<!-- frontfriend design mirror \u2014 DO NOT EDIT (overwritten by `frontfriend design sync`)",`slug: ${r.slug}`,`maturity: ${r.maturity}`,`implemented: ${r.implemented}`,`implementation: ${r.implementation||"unknown"}`,`version: ${r.version}`,"-->","",s,""].join(`
4
- `)}function ei(r){return[`# Frontfriend design mirror \u2014 ${r.name}`,"","This directory is a READ-ONLY mirror of the Design System design contracts",`(Design System "${r.name}", ff-id \`${r.ff_id}\`) managed on the Frontfriend platform.`,"","Every file here is overwritten by `frontfriend design sync`. Do not edit by","hand: local changes are discarded on the next sync, and files whose contract","was removed upstream are deleted. Edit contracts on the platform instead.",""].join(`
5
- `)}function ar({design_system:r,contracts:s}){let c=[...s].filter(l=>ht(l.slug)).sort((l,p)=>l.kind.localeCompare(p.kind)||l.slug.localeCompare(p.slug)),u={"README.md":ei(r)};for(let l of c)u[l.slug]=Zt(l);return u}function Xt(r,s){let c={};for(let[l,p]of Object.entries(r))s[l]!==p&&(c[l]=p);let u=Object.keys(s).filter(l=>!(l in r)).sort();return{writes:c,deletes:u}}var ti=r=>nr("sha256").update(r).digest("hex");function Bs(r){return Object.fromEntries(Object.entries(r).filter(([s])=>s!=="README.md"&&ht(s)).map(([s,c])=>[s,ti(c)]))}function $s(r,s){let c=()=>{throw new Error("Invalid or incomplete mirror response. No local files were changed; retry sync.")};(!r||typeof r.design_system?.ff_id!="string"||typeof r.design_system?.name!="string"||!Array.isArray(r.contracts))&&c();let u=new Map;for(let h of r.contracts)(!h||!ht(h.slug)||h.slug==="README.md"||typeof h.body!="string"||typeof h.kind!="string"||typeof h.maturity!="string"||typeof h.implemented!="boolean"||!Number.isSafeInteger(h.version)||h.version<1||u.has(h.slug))&&c(),u.set(h.slug,Zt(h));if(r.protocol===void 0)return r.manifest!==void 0&&c(),Xt(ar(r),s);(r.protocol!==1||!Array.isArray(r.manifest))&&c();let l={"README.md":ei(r.design_system)},p=new Set;for(let h of r.manifest){(!h||!ht(h.slug)||h.slug==="README.md"||!/^[a-f0-9]{64}$/.test(h.hash)||p.has(h.slug))&&c(),p.add(h.slug);let f=u.get(h.slug)??s[h.slug];(typeof f!="string"||ti(f)!==h.hash)&&c(),Object.defineProperty(l,h.slug,{value:f,enumerable:!0})}return[...u.keys()].some(h=>!p.has(h))&&c(),Xt(l,s)}function Us(r){let s={};if(!Fe.existsSync(r))return s;let c=u=>{for(let l of Fe.readdirSync(u,{withFileTypes:!0})){let p=Pe.join(u,l.name);if(l.isDirectory())c(p);else if(l.isFile()){let h=Pe.relative(r,p).split(Pe.sep).join("/");s[h]=Fe.readFileSync(p,"utf8")}}};return c(r),s}function qs(r,s){for(let[c,u]of Object.entries(s.writes)){let l=Pe.join(r,...c.split("/"));Fe.mkdirSync(Pe.dirname(l),{recursive:!0}),Fe.writeFileSync(l,u)}for(let c of s.deletes){let u=Pe.join(r,...c.split("/"));Fe.rmSync(u,{force:!0});let l=Pe.dirname(u),p=Pe.resolve(r);for(;Pe.resolve(l)!==p&&Fe.existsSync(l)&&Fe.readdirSync(l).length===0;)Fe.rmdirSync(l),l=Pe.dirname(l)}}function Ws(r,s,c){if(!s||r.contract_selection!==1||r.selection?.design_snapshot_id!==s.snapshotId||r.selection?.digest!==s.snapshotDigest||r.app?.id!==s.appId||r.design_system?.ff_id!==c)throw new Error("Contract mirror does not match the selected App snapshot.");let u=[...s.sharedContracts,...s.contracts],l=r.manifest??r.contracts,p=new Map(u.map(h=>[h.slug,h]));if(!Array.isArray(l)||!Array.isArray(r.contracts)||l.length!==u.length||new Set(l.map(h=>h.slug)).size!==u.length||l.some(h=>!p.has(h.slug)))throw new Error("Contract mirror inventory does not match the snapshot.");for(let h of r.contracts){let f=p.get(h.slug);if(!f||h.revision_id!==f.revisionId||h.digest!==f.digest||h.version!==f.version||h.kind!==f.kind)throw new Error("Contract body identity does not match its snapshot pin.");let m={appId:s.contracts.some(w=>w.slug===f.slug)?s.appId:null,body:h.body,designSystemId:s.designSystemId,kind:h.kind,maturity:h.maturity,slug:h.slug,title:h.title};if(nr("sha256").update(JSON.stringify(m)).digest("hex")!==f.digest)throw new Error("Contract content does not match its immutable digest.")}return u}or.exports={validatePinnedMirror:Ws,MIRROR_DIR:Fs,FRONTFRIEND_GITIGNORE_PATH:Ds,renderFrontfriendGitignore:Ms,isSafeSlug:ht,renderContractFile:Zt,renderMirrorReadme:ei,buildMirrorTree:ar,planMirrorSync:Xt,hashMirrorFile:ti,knownMirrorHashes:Bs,planMirrorResponse:$s,readMirrorTree:Us,applyMirrorPlan:qs}});var ni=Ie((oa,fr)=>{var si=require("fs"),le=require("path");function ur(r,s="JSON"){let c="",u=0,l=r.charCodeAt(0)===65279?r.slice(1):r;for(;u<l.length;){let h=l[u];if(h==='"'){let f=u+1;for(;f<l.length&&l[f]!=='"';)f+=l[f]==="\\"?2:1;c+=l.slice(u,f+1),u=f+1}else if(h==="/"&&l[u+1]==="/")for(;u<l.length&&l[u]!==`
6
- `;)u+=1;else if(h==="/"&&l[u+1]==="*"){let f=l.indexOf("*/",u+2);if(f===-1)throw new Error(`Cannot read ${s}: unterminated comment.`);c+=l.slice(u,f+2).replace(/[^\n]/g," "),u=f+2}else c+=h,u+=1}let p="";for(let h=0;h<c.length;h+=1){let f=c[h];if(f==='"'){let m=h+1;for(;m<c.length&&c[m]!=='"';)m+=c[m]==="\\"?2:1;p+=c.slice(h,m+1),h=m;continue}if(f===","){let m=h+1;for(;m<c.length&&/\s/.test(c[m]);)m+=1;if(c[m]==="}"||c[m]==="]")continue}p+=f}try{return p.trim()?JSON.parse(p):{}}catch(h){throw new Error(`Cannot read ${s}: ${h.message}`)}}function lr(r){return ur(si.readFileSync(r,"utf8"),r)}var Rt=r=>{try{return si.statSync(r).isFile()}catch{return!1}};function hr(r,s){if(typeof r!="string"||!r)throw new Error('tsconfig "extends" must be a non-empty string.');let c=u=>Rt(u)?u:!u.endsWith(".json")&&Rt(`${u}.json`)?`${u}.json`:null;if(r.startsWith(".")||le.isAbsolute(r)){let u=c(le.resolve(s,r));if(u)return u;throw new Error(`File '${r}' not found (tsconfig extends, from ${s}).`)}for(let u=s;;u=le.dirname(u)){let l=le.join(u,"node_modules",r),p=c(l);if(p)return p;let h=null;try{h=JSON.parse(si.readFileSync(le.join(l,"package.json"),"utf8"))}catch{h=null}if(h&&typeof h.tsconfig=="string"&&Rt(le.join(l,h.tsconfig)))return le.join(l,h.tsconfig);if(Rt(le.join(l,"tsconfig.json")))return le.join(l,"tsconfig.json");if(le.dirname(u)===u)break}for(let u of[r,`${r}/tsconfig.json`,`${r}.json`])try{return require.resolve(u,{paths:[s]})}catch{}throw new Error(`File '${r}' not found (tsconfig extends, from ${s}).`)}function pr(r,s,c=new Set){let u=le.resolve(r);if(c.has(u))throw new Error(`Circularity detected while resolving configuration: ${u}`);let l=new Set(c).add(u),p=lr(u),h=le.dirname(u),f={},m=p.extends===void 0?[]:Array.isArray(p.extends)?p.extends:[p.extends];for(let I of m)f={...f,...pr(hr(I,h),s,l)};let x=p.compilerOptions&&typeof p.compilerOptions=="object"?p.compilerOptions:{},w=I=>typeof I=="string"?I.replace(/\$\{configDir\}/g,s):I;return typeof x.baseUrl=="string"&&(f.baseUrl=le.resolve(h,w(x.baseUrl))),x.paths&&typeof x.paths=="object"&&(f.paths=Object.fromEntries(Object.entries(x.paths).map(([I,A])=>[I,Array.isArray(A)?A.map(w):A])),f.pathsBasePath=h),f}function zs(r){let s=pr(r,le.dirname(le.resolve(r)));return s.paths?{base:s.baseUrl||s.pathsBasePath||le.dirname(r),paths:s.paths}:null}fr.exports={parseJsonc:ur,readJsonc:lr,resolveExtends:hr,readConfigPaths:zs}});var Tt={};Qt(Tt,{materializeInstallationPath:()=>oi,readProjectPaths:()=>mr,resolveCanonicalUiDirectory:()=>gr,resolveConfiguredAlias:()=>Nt});function dr(r){try{return JSON.parse(tt.default.readFileSync(r,"utf8"))}catch{return null}}function mr(r){for(let s of["tsconfig.json","tsconfig.app.json","jsconfig.json"]){let c=pe.default.join(r,s);if(!tt.default.existsSync(c))continue;let u=Gs(c);if(u)return u}return{base:r,paths:{"@/*":[tt.default.existsSync(pe.default.join(r,"src"))?"src/*":"*"]}}}function Nt(r,s,c=mr(r)){for(let[u,l]of Object.entries(c.paths)){if(!Array.isArray(l)||typeof l[0]!="string")continue;let[p,h=""]=u.split("*");if(!s.startsWith(p)||!s.endsWith(h)||!u.includes("*")&&s!==u)continue;let f=s.slice(p.length,h?-h.length:void 0);return pe.default.resolve(c.base,l[0].replace("*",f))}return s.startsWith("@/")?pe.default.resolve(r,tt.default.existsSync(pe.default.join(r,"src"))?"src":".",s.slice(2)):pe.default.resolve(r,s)}function ai(r,s){let c=pe.default.relative(r,s).replace(/\\/g,"/");if(!c||c===".."||c.startsWith("../")||pe.default.posix.isAbsolute(c))throw new Error("The canonical ui alias must stay inside the Application root.");return c}function gr(r,s){if(s)return ai(r,Nt(r,s));let u=dr(pe.default.join(r,"components.json"))?.aliases?.ui;return typeof u=="string"&&u?ai(r,Nt(r,u)):tt.default.existsSync(pe.default.join(r,"src"))?"src/components/ui":"components/ui"}function oi(r){if(r.installationLayout==="shadcn"&&/^(?:lib|hooks|components)\//.test(r.path)){let u=dr(pe.default.join(r.root,"components.json"))?.aliases||{},l=/^lib\/utils\.[^.]+$/.test(r.path),p=r.path.split("/")[0],h=l&&u.utils?u.utils:u[p]||`@/${p}`,f=Nt(r.root,h);return ai(r.root,l&&u.utils?f+pe.default.extname(r.path):pe.default.join(f,r.path.slice(p.length+1)))}if(r.source!=="canonical"&&r.installationLayout!=="shadcn"||!r.path.startsWith("ui/"))return r.path;let s=r.path.slice(3);return pe.default.posix.join(gr(r.root,r.configuredUiPath),s)}var tt,pe,Gs,pt=Yi(()=>{tt=et(require("node:fs")),pe=et(require("node:path")),{readConfigPaths:Gs}=ni()});var xr=Ie((ua,Qs)=>{Qs.exports={name:"@frontfriend/sdk",version:"1.2.3"}});var br=Ie((la,yr)=>{var{name:Ys}=xr();yr.exports={PACKAGE_NAME:Ys}});var ui=Ie((ha,Sr)=>{var{PACKAGE_NAME:Lt}=br(),De=require("fs"),Xs=require("http"),Zs=require("https"),ve=require("path"),Ot=["contracts","tokens","components"],en=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],tn={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},rn=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],sn=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function wr(r){try{return JSON.parse(De.readFileSync(r,"utf8"))}catch{return{}}}function ci(r){if(r===void 0)return null;if(!Array.isArray(r)){let u=new Error("`adopt` in frontfriend.config.js must be an array.");throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let s=r.filter(u=>!Ot.includes(u));if(s.length>0){let u=new Error(`Unknown Frontfriend adoption level: ${s.join(", ")}.`);throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let c=r.includes("components")?2:r.includes("tokens")?1:0;return Ot.slice(0,c+1)}function nn(r){for(let[s,c]of Object.entries(tn)){let u=c.find(p=>De.existsSync(ve.join(r,p)));if(!u)continue;let l=De.readFileSync(ve.join(r,u),"utf8");return{buildTool:s,present:l.includes(`${Lt}/${s}`)}}return{buildTool:null,present:!1}}function an(r){let s=[ve.join(r,"components","ui"),ve.join(r,"src","components","ui"),ve.join(r,"app","components","ui")].filter(l=>De.existsSync(l)),c=new Set;function u(l){for(let p of De.readdirSync(l,{withFileTypes:!0})){let h=ve.join(l,p.name);if(p.isDirectory())u(h);else if(/\.(js|jsx|ts|tsx|vue)$/.test(p.name)){if(!De.readFileSync(h,"utf8").includes(Lt))continue;let m=ve.basename(p.name,ve.extname(p.name));c.add(m.toLowerCase()==="index"?ve.basename(l):m.toLowerCase())}}}return s.forEach(u),[...c].sort()}function on(r){let s=wr(ve.join(r,"package.json")),c={...s.dependencies||{},...s.devDependencies||{}},u=c.tailwindcss||null,p=[wr(ve.join(r,"components.json"))?.tailwind?.css,...en].filter(Boolean).find(m=>De.existsSync(ve.join(r,m))),h=p?De.readFileSync(ve.join(r,p),"utf8"):"",f=sn.filter(m=>c[m]);return!f.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(h)&&!h.includes(`${Lt}/theme.css`)&&f.push("css-custom-properties"),{nativeTokens:{present:h.includes("/* Frontfriend managed native tokens: start */"),file:p||null},tailwind:{present:!!u,version:u,major:u&&Number((String(u).match(/\d+/)||[])[0])||null},componentsJson:De.existsSync(ve.join(r,"components.json")),themeImport:{present:h.includes(`${Lt}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(h),file:p||null},plugin:nn(r),frontfriendComponents:an(r),foreignComponentLibraries:rn.filter(m=>c[m]),foreignTokenSystems:f}}function cn(r,s){let c=ci(r)||Ot,u=c.includes("tokens"),l=c.includes("components"),p=[];return u&&!s.themeImport.present&&!s.nativeTokens?.present&&p.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!u&&s.themeImport.present&&p.push("Frontfriend tokens are present in CSS but are not adopted in config."),l&&!s.componentsJson&&p.push("Config adopts components, but components.json was not observed."),!l&&s.frontfriendComponents.length>0&&p.push("Frontfriend components are installed but are not adopted in config."),p}function un({apiUrl:r,token:s,ffId:c,name:u,adopt:l,observed:p,framework:h,primitive:f}){if(!r||!s||!c||!u||!h||f===void 0)return Promise.resolve({reported:!1,unavailable:!0});let m=new URL("/api/apps/sync",r),x=JSON.stringify({ffId:c,name:u,adopt:ci(l),observed:p,runtime:"sdk",framework:h,primitive:f}),w=m.protocol==="https:"?Zs:Xs;return new Promise(I=>{let A=w.request(m,{method:"POST",headers:{authorization:`Bearer ${s}`,"content-type":"application/json","content-length":Buffer.byteLength(x)}},B=>{B.resume(),B.on("end",()=>{B.statusCode>=200&&B.statusCode<300?I({reported:!0,unavailable:!1}):I({reported:!1,unavailable:!0})})});A.on("error",()=>I({reported:!1,unavailable:!0})),A.setTimeout(1500,()=>{A.destroy(),I({reported:!1,unavailable:!0})}),A.end(x)})}Sr.exports={ADOPTION_LEVELS:Ot,normalizeAdopt:ci,probeAdoption:on,adoptionWarnings:cn,reportAdoption:un}});var Cr=Ie((jt,kr)=>{(function(r,s){typeof jt=="object"&&typeof kr<"u"?s(jt):typeof define=="function"&&define.amd?define(["exports"],s):(r=typeof globalThis<"u"?globalThis:r||self,s(r.acorn={}))})(jt,function(r){"use strict";var s=[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],c=[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],u="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",l="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",p={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"},h="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",f={5:h,"5module":h+" export import",6:h+" const class extends export import super"},m=/^in(stanceof)?$/,x=new RegExp("["+l+"]"),w=new RegExp("["+l+u+"]");function I(e,t){for(var i=65536,n=0;n<t.length;n+=2){if(i+=t[n],i>e)return!1;if(i+=t[n+1],i>=e)return!0}return!1}function A(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&x.test(String.fromCharCode(e)):t===!1?!1:I(e,c)}function B(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&&w.test(String.fromCharCode(e)):t===!1?!1:I(e,c)||I(e,s)}var _=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function T(e,t){return new _(e,{beforeExpr:!0,binop:t})}var R={beforeExpr:!0},E={startsExpr:!0},ne={};function O(e,t){return t===void 0&&(t={}),t.keyword=e,ne[e]=new _(e,t)}var a={num:new _("num",E),regexp:new _("regexp",E),string:new _("string",E),name:new _("name",E),privateId:new _("privateId",E),eof:new _("eof"),bracketL:new _("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new _("]"),braceL:new _("{",{beforeExpr:!0,startsExpr:!0}),braceR:new _("}"),parenL:new _("(",{beforeExpr:!0,startsExpr:!0}),parenR:new _(")"),comma:new _(",",R),semi:new _(";",R),colon:new _(":",R),dot:new _("."),question:new _("?",R),questionDot:new _("?."),arrow:new _("=>",R),template:new _("template"),invalidTemplate:new _("invalidTemplate"),ellipsis:new _("...",R),backQuote:new _("`",E),dollarBraceL:new _("${",{beforeExpr:!0,startsExpr:!0}),eq:new _("=",{beforeExpr:!0,isAssign:!0}),assign:new _("_=",{beforeExpr:!0,isAssign:!0}),incDec:new _("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new _("!/~",{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 _("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:T("%",10),star:T("*",10),slash:T("/",10),starstar:new _("**",{beforeExpr:!0}),coalesce:T("??",1),_break:O("break"),_case:O("case",R),_catch:O("catch"),_continue:O("continue"),_debugger:O("debugger"),_default:O("default",R),_do:O("do",{isLoop:!0,beforeExpr:!0}),_else:O("else",R),_finally:O("finally"),_for:O("for",{isLoop:!0}),_function:O("function",E),_if:O("if"),_return:O("return",R),_switch:O("switch"),_throw:O("throw",R),_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",E),_super:O("super",E),_class:O("class",E),_extends:O("extends",R),_export:O("export"),_import:O("import",E),_null:O("null",E),_true:O("true",E),_false:O("false",E),_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})},b=/\r\n?|\n|\u2028|\u2029/,j=new RegExp(b.source,"g");function V(e){return e===10||e===13||e===8232||e===8233}function z(e,t,i){i===void 0&&(i=e.length);for(var n=t;n<i;n++){var o=e.charCodeAt(n);if(V(o))return n<i-1&&o===13&&e.charCodeAt(n+1)===10?n+2:n+1}return-1}var X=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,W=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,G=Object.prototype,st=G.hasOwnProperty,He=G.toString,ae=Object.hasOwn||function(e,t){return st.call(e,t)},Wt=Array.isArray||function(e){return He.call(e)==="[object Array]"},vt=Object.create(null);function he(e){return vt[e]||(vt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function S(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var U=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Y=function(t,i){this.line=t,this.column=i};Y.prototype.offset=function(t){return new Y(this.line,this.column+t)};var xe=function(t,i,n){this.start=i,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function _e(e,t){for(var i=1,n=0;;){var o=z(e,n,t);if(o<0)return new Y(i,t-n);++i,n=o}}var te={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},Ne=!1;function Te(e){var t={};for(var i in te)t[i]=e&&ae(e,i)?e[i]:te[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Ne&&typeof console=="object"&&console.warn&&(Ne=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
7
- Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Wt(t.onToken)){var n=t.onToken;t.onToken=function(o){return n.push(o)}}if(Wt(t.onComment)&&(t.onComment=se(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function se(e,t){return function(i,n,o,d,g,v){var y={type:i?"Block":"Line",value:n,start:o,end:d};e.locations&&(y.loc=new xe(this,g,v)),e.ranges&&(y.range=[o,d]),t.push(y)}}var H=1,q=2,ye=4,Ae=8,We=16,ze=32,me=64,Ge=128,ie=256,Le=512,oe=1024,re=H|q|ie;function Je(e,t){return q|(e?ye:0)|(t?Ae:0)}var Ke=0,Ht=1,Oe=2,Si=3,ki=4,Ci=5,Z=function(t,i,n){this.options=t=Te(t),this.sourceFile=t.sourceFile,this.keywords=he(f[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var o="";t.allowReserved!==!0&&(o=p[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(o+=" await")),this.reservedWords=he(o);var d=(o?o+" ":"")+p.strict;this.reservedWordsStrict=he(d),this.reservedWordsStrictBind=he(d+" "+p.strictBind),this.input=String(i),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
8
- `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(b).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.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=t.sourceType==="module",this.strict=this.inModule||t.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&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?q:H),this.regexpState=null,this.privateNameStack=[]},we={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}};Z.prototype.parse=function(){var t=this,i=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return t.parseTopLevel(i)})},we.inFunction.get=function(){return(this.currentVarScope().flags&q)>0},we.inGenerator.get=function(){return(this.currentVarScope().flags&Ae)>0},we.inAsync.get=function(){return(this.currentVarScope().flags&ye)>0},we.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(ie|Le))return!1;if(i&q)return(i&ye)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},we.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&H)},we.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&me)>0||this.options.allowSuperOutsideMethod},we.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ge)>0},we.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},we.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(ie|Le)||i&q&&!(i&We))return!0}return!1},we.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&oe||!this.inModule&&t&H)},we.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ie)>0},Z.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var n=this,o=0;o<t.length;o++)n=t[o](n);return n},Z.parse=function(t,i){return new this(i,t).parse()},Z.parseExpressionAt=function(t,i,n){var o=new this(n,t,i);return o.nextToken(),o.parseExpression()},Z.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(Z.prototype,we);var ce=Z.prototype,Yr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ce.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){W.lastIndex=e,e+=W.exec(this.input)[0].length;var t=Yr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){W.lastIndex=e+t[0].length;var i=W.exec(this.input),n=i.index+i[0].length,o=this.input.charAt(n);return o===";"||o==="}"||b.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(o)||o==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,W.lastIndex=e,e+=W.exec(this.input)[0].length,this.input[e]===";"&&e++}},ce.eat=function(e){return this.type===e?(this.next(),!0):!1},ce.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc},ce.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},ce.catchStackOverflow=function(e){try{return e()}catch(t){if(t instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(t.message)||/\btoo much recursion\b/i.test(t.message)))this.raise(this.start,"Not enough stack space to parse input");else throw t}},ce.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},ce.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||b.test(this.input.slice(this.lastTokEnd,this.start))},ce.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ce.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()},ce.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},ce.expect=function(e){this.eat(e)||this.unexpected()},ce.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var xt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ce.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},ce.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,n=e.doubleProto;if(!t)return i>=0||n>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},ce.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")},ce.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var C=Z.prototype;C.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==a.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var n=0,o=Object.keys(this.undefinedExports);n<o.length;n+=1){var d=o[n];this.raiseRecoverable(this.undefinedExports[d].start,"Export '"+d+"' 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 zt={kind:"loop"},Xr={kind:"switch"};C.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;W.lastIndex=this.pos;var t=W.exec(this.input),i=this.pos+t[0].length,n=this.fullCharCodeAt(i);if(n===91||n===92)return!0;if(e)return!1;if(n===123)return!0;if(A(n)){var o=i;do i+=n<=65535?1:2;while(B(n=this.fullCharCodeAt(i)));if(n===92)return!0;var d=this.input.slice(o,i);if(!m.test(d))return!0}return!1},C.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;W.lastIndex=this.pos;var e=W.exec(this.input),t=this.pos+e[0].length,i;return!b.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(B(i=this.fullCharCodeAt(t+8))||i===92))},C.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;W.lastIndex=this.pos;var i=W.exec(this.input),n=this.pos+i[0].length;if(b.test(this.input.slice(this.pos,n)))return!1;if(e){var o=n+5,d;if(this.input.slice(n,o)!=="using"||o===this.input.length||B(d=this.fullCharCodeAt(o))||d===92)return!1;W.lastIndex=o;var g=W.exec(this.input);if(n=o+g[0].length,g&&b.test(this.input.slice(o,n)))return!1}var v=this.fullCharCodeAt(n);if(!A(v)&&v!==92)return!1;var y=n;do n+=v<=65535?1:2;while(B(v=this.fullCharCodeAt(n)));if(v===92)return!0;var N=this.input.slice(y,n);if(m.test(N))return!1;if(t&&!e&&N==="of"){W.lastIndex=n;var M=W.exec(this.input);if(n=n+M[0].length,this.input.charCodeAt(n)!==61||(v=this.input.charCodeAt(n+1))===61||v===62)return!1}return!0},C.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},C.isUsing=function(e){return this.isUsingKeyword(!1,e)},C.parseStatement=function(e,t,i){var n=this.type,o=this.startNode(),d;switch(this.isLet(e)&&(n=a._var,d="let"),n){case a._break:case a._continue:return this.parseBreakContinueStatement(o,n.keyword);case a._debugger:return this.parseDebuggerStatement(o);case a._do:return this.parseDoStatement(o);case a._for:return this.parseForStatement(o);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(o,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(o,!0);case a._if:return this.parseIfStatement(o);case a._return:return this.parseReturnStatement(o);case a._switch:return this.parseSwitchStatement(o);case a._throw:return this.parseThrowStatement(o);case a._try:return this.parseTryStatement(o);case a._const:case a._var:return d=d||this.value,e&&d!=="var"&&this.unexpected(),this.parseVarStatement(o,d);case a._while:return this.parseWhileStatement(o);case a._with:return this.parseWithStatement(o);case a.braceL:return this.parseBlock(!0,o);case a.semi:return this.parseEmptyStatement(o);case a._export:case a._import:if(this.options.ecmaVersion>10&&n===a._import){W.lastIndex=this.pos;var g=W.exec(this.input),v=this.pos+g[0].length,y=this.input.charCodeAt(v);if(y===40||y===46)return this.parseExpressionStatement(o,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'")),n===a._import?this.parseImport(o):this.parseExport(o,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(o,!0,!e);var N=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(N)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"),N==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(o,!1,N),this.semicolon(),this.finishNode(o,"VariableDeclaration");var M=this.value,Q=this.parseExpression();return n===a.name&&Q.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(o,M,Q,e):this.parseExpressionStatement(o,Q)}},C.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n<this.labels.length;++n){var o=this.labels[n];if((e.label==null||o.name===e.label.name)&&(o.kind!=null&&(i||o.kind==="loop")||e.label&&i))break}return n===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},C.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},C.parseDoStatement=function(e){return this.next(),this.labels.push(zt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(a._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},C.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(zt),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var n=this.startNode(),o=i?"let":this.value;return this.next(),this.parseVar(n,!0,o),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var d=this.isContextual("let"),g=!1,v=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(v){var y=this.startNode();return this.next(),v==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(y,!0,v),this.finishNode(y,"VariableDeclaration"),this.parseForAfterInit(e,y,t)}var N=this.containsEsc,M=new xt,Q=this.start,ue=t>-1?this.parseExprSubscripts(M,"await"):this.parseExpression(!0,M);return this.type===a._in||(g=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===a._in&&this.unexpected(t),e.await=!0):g&&this.options.ecmaVersion>=8&&(ue.start===Q&&!N&&ue.type==="Identifier"&&ue.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),d&&g&&this.raise(ue.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(ue,!1,M),this.checkLValPattern(ue),this.parseForIn(e,ue)):(this.checkExpressionErrors(M,!0),t>-1&&this.unexpected(t),this.parseFor(e,ue))},C.parseForAfterInit=function(e,t,i){return(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.type===a._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&&i>-1&&this.unexpected(i)):this.options.ecmaVersion>=9&&(e.await=i>-1),this.parseForIn(e,t)):(i>-1&&this.unexpected(i),this.parseFor(e,t))},C.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,nt|(i?0:Gt),!1,t)},C.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},C.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},C.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(Xr),this.enterScope(oe);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var n=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.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")},C.parseThrowStatement=function(e){return this.next(),b.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 Zr=[];C.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?ze:0),this.checkLValPattern(e,t?ki:Oe),this.expect(a.parenR),e},C.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.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(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},C.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},C.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(zt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},C.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")},C.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},C.parseLabeledStatement=function(e,t,i,n){for(var o=0,d=this.labels;o<d.length;o+=1){var g=d[o];g.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var v=this.type.isLoop?"loop":this.type===a._switch?"switch":null,y=this.labels.length-1;y>=0;y--){var N=this.labels[y];if(N.statementStart===e.start)N.statementStart=this.start,N.kind=v;else break}return this.labels.push({name:t,kind:v,statementStart:this.start}),e.body=this.parseStatement(n?n.indexOf("label")===-1?n+"label":n:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},C.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},C.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var n=this.parseStatement(null);t.body.push(n)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},C.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},C.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},C.parseVar=function(e,t,i,n){for(e.declarations=[],e.kind=i;;){var o=this.startNode();if(this.parseVarId(o,i),this.eat(a.eq)?o.init=this.parseMaybeAssign(t):!n&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!n&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==a._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!n&&o.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):o.init=null,e.declarations.push(this.finishNode(o,"VariableDeclarator")),!this.eat(a.comma))break}return e},C.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Ht:Oe,!1)};var nt=1,Gt=2,Ii=4;C.parseFunction=function(e,t,i,n,o){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===a.star&&t&Gt&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&nt&&(e.id=t&Ii&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Gt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ht:Oe:Si));var d=this.yieldPos,g=this.awaitPos,v=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Je(e.async,e.generator)),t&nt||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,o),this.yieldPos=d,this.awaitPos=g,this.awaitIdentPos=v,this.finishNode(e,t&nt?"FunctionDeclaration":"FunctionExpression")},C.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},C.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),o=this.startNode(),d=!1;for(o.body=[],this.expect(a.braceL);this.type!==a.braceR;){var g=this.parseClassElement(e.superClass!==null);g&&(o.body.push(g),g.type==="MethodDefinition"&&g.kind==="constructor"?(d&&this.raiseRecoverable(g.start,"Duplicate constructor in the same class"),d=!0):g.key&&g.key.type==="PrivateIdentifier"&&es(n,g)&&this.raiseRecoverable(g.key.start,"Identifier '#"+g.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(o,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},C.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),n="",o=!1,d=!1,g="method",v=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?v=!0:n="static"}if(i.static=v,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?d=!0:n="async"),!n&&(t>=9||!d)&&this.eat(a.star)&&(o=!0),!n&&!d&&!o){var y=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?g=y:n=y)}if(n?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=n,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||g!=="method"||o||d){var N=!i.static&&yt(i,"constructor"),M=N&&e;N&&g!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=N?"constructor":g,this.parseClassMethod(i,o,d,M)}else this.parseClassField(i);return i},C.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword},C.parseClassElementName=function(e){this.type===a.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)},C.parseClassMethod=function(e,t,i,n){var o=e.key;e.kind==="constructor"?(t&&this.raise(o.start,"Constructor can't be a generator"),i&&this.raise(o.start,"Constructor can't be an async method")):e.static&&yt(e,"prototype")&&this.raise(o.start,"Classes may not have a static property named prototype");var d=e.value=this.parseMethod(t,i,n);return e.kind==="get"&&d.params.length!==0&&this.raiseRecoverable(d.start,"getter should have no params"),e.kind==="set"&&d.params.length!==1&&this.raiseRecoverable(d.start,"setter should have exactly one param"),e.kind==="set"&&d.params[0].type==="RestElement"&&this.raiseRecoverable(d.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},C.parseClassField=function(e){return yt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&yt(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)?(this.enterScope(Le|me),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},C.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(ie|me);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},C.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Oe,!1)):(t===!0&&this.unexpected(),e.id=null)},C.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null},C.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},C.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,o=n===0?null:this.privateNameStack[n-1],d=0;d<i.length;++d){var g=i[d];ae(t,g.name)||(o?o.used.push(g):this.raiseRecoverable(g.start,"Private field '#"+g.name+"' must be declared in an enclosing class"))}};function es(e,t){var i=t.key.name,n=e[i],o="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(o=(t.static?"s":"i")+t.kind),n==="iget"&&o==="iset"||n==="iset"&&o==="iget"||n==="sget"&&o==="sset"||n==="sset"&&o==="sget"?(e[i]="true",!1):n?!0:(e[i]=o,!1)}function yt(e,t){var i=e.computed,n=e.key;return!i&&(n.type==="Identifier"&&n.name===t||n.type==="Literal"&&n.value===t)}C.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!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},C.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._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!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,n=e.specifiers;i<n.length;i+=1){var o=n[i];this.checkUnreserved(o.local),this.checkLocalExport(o.local),o.local.type==="Literal"&&this.raise(o.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")},C.parseExportDeclaration=function(e){return this.parseStatement(null)},C.parseExportDefaultDeclaration=function(){var e;if(this.type===a._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,nt|Ii,!1,e)}else if(this.type===a._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var n=this.parseMaybeAssign();return this.semicolon(),n}},C.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),ae(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},C.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var n=0,o=t.properties;n<o.length;n+=1){var d=o[n];this.checkPatternExport(e,d)}else if(i==="ArrayPattern")for(var g=0,v=t.elements;g<v.length;g+=1){var y=v[g];y&&this.checkPatternExport(e,y)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},C.checkVariableExport=function(e,t){if(e)for(var i=0,n=t;i<n.length;i+=1){var o=n[i];this.checkPatternExport(e,o.id)}},C.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},C.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")},C.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(a.braceL);!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;t.push(this.parseExportSpecifier(e))}return t},C.parseImport=function(e){return this.next(),this.type===a.string?(e.specifiers=Zr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===a.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},C.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,Oe),this.finishNode(e,"ImportSpecifier")},C.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Oe),this.finishNode(e,"ImportDefaultSpecifier")},C.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Oe),this.finishNode(e,"ImportNamespaceSpecifier")},C.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===a.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(a.comma)))return e;if(this.type===a.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(a.braceL);!this.eat(a.braceR);){if(t)t=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;e.push(this.parseImportSpecifier())}return e},C.parseWithClause=function(){var e=[];if(!this.eat(a._with))return e;this.expect(a.braceL);for(var t={},i=!0;!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;var n=this.parseImportAttribute(),o=n.key.type==="Identifier"?n.key.name:n.key.value;ae(t,o)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+o+"'"),t[o]=!0,e.push(n)}return e},C.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(a.colon),this.type!==a.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},C.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===a.string){var e=this.parseLiteral(this.value);return U.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},C.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)},C.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 Se=Z.prototype;Se.toAssignable=function(e,t,i){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",i&&this.checkPatternErrors(i,!0);for(var n=0,o=e.properties;n<o.length;n+=1){var d=o[n];this.toAssignable(d,t),d.type==="RestElement"&&(d.argument.type==="ArrayPattern"||d.argument.type==="ObjectPattern")&&this.raise(d.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",i&&this.checkPatternErrors(i,!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,i);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 i&&this.checkPatternErrors(i,!0);return e},Se.toAssignableList=function(e,t){for(var i=e.length,n=0;n<i;n++){var o=e[n];o&&this.toAssignable(o,t)}if(i){var d=e[i-1];this.options.ecmaVersion===6&&t&&d&&d.type==="RestElement"&&d.argument.type!=="Identifier"&&this.unexpected(d.argument.start)}return e},Se.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},Se.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==a.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},Se.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()},Se.parseBindingList=function(e,t,i,n){for(var o=[],d=!0;!this.eat(e);)if(d?d=!1:this.expect(a.comma),t&&this.type===a.comma)o.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var g=this.parseRestBinding();this.parseBindingListItem(g),o.push(g),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else o.push(this.parseAssignableListItem(n))}return o},Se.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Se.parseBindingListItem=function(e){return e},Se.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var n=this.startNodeAt(e,t);return n.left=i,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},Se.checkLValSimple=function(e,t,i){t===void 0&&(t=Ke);var n=t!==Ke;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===Oe&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(ae(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==Ci&&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":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},Se.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=Ke),e.type){case"ObjectPattern":for(var n=0,o=e.properties;n<o.length;n+=1){var d=o[n];this.checkLValInnerPattern(d,t,i)}break;case"ArrayPattern":for(var g=0,v=e.elements;g<v.length;g+=1){var y=v[g];y&&this.checkLValInnerPattern(y,t,i)}break;default:this.checkLValSimple(e,t,i)}},Se.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=Ke),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var ke=function(t,i,n,o,d){this.token=t,this.isExpr=!!i,this.preserveSpace=!!n,this.override=o,this.generator=!!d},K={b_stat:new ke("{",!1),b_expr:new ke("{",!0),b_tmpl:new ke("${",!1),p_stat:new ke("(",!1),p_expr:new ke("(",!0),q_tmpl:new ke("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new ke("function",!1),f_expr:new ke("function",!0),f_expr_gen:new ke("function",!0,!1,null,!0),f_gen:new ke("function",!1,!1,null,!0)},Qe=Z.prototype;Qe.initialContext=function(){return[K.b_stat]},Qe.curContext=function(){return this.context[this.context.length-1]},Qe.braceIsBlock=function(e){var t=this.curContext();return t===K.f_expr||t===K.f_stat?!0:e===a.colon&&(t===K.b_stat||t===K.b_expr)?!t.isExpr:e===a._return||e===a.name&&this.exprAllowed?b.test(this.input.slice(this.lastTokEnd,this.start)):e===a._else||e===a.semi||e===a.eof||e===a.parenR||e===a.arrow?!0:e===a.braceL?t===K.b_stat:e===a._var||e===a._const||e===a.name?!1:!this.exprAllowed},Qe.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},Qe.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},Qe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===K.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?K.b_stat:K.b_expr),this.exprAllowed=!0},a.dollarBraceL.updateContext=function(){this.context.push(K.b_tmpl),this.exprAllowed=!0},a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?K.p_stat:K.p_expr),this.exprAllowed=!0},a.incDec.updateContext=function(){},a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==K.p_stat)&&!(e===a._return&&b.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===K.b_stat)?this.context.push(K.f_expr):this.context.push(K.f_stat),this.exprAllowed=!1},a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},a.backQuote.updateContext=function(){this.curContext()===K.q_tmpl?this.context.pop():this.context.push(K.q_tmpl),this.exprAllowed=!1},a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===K.f_expr?this.context[t]=K.f_expr_gen:this.context[t]=K.f_gen}this.exprAllowed=!0},a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var L=Z.prototype;L.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n=e.key,o;switch(n.type){case"Identifier":o=n.name;break;case"Literal":o=String(n.value);break;default:return}var d=e.kind;if(this.options.ecmaVersion>=6){o==="__proto__"&&d==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0);return}o="$"+o;var g=t[o];if(g){var v;d==="init"?v=this.strict&&g.init||g.get||g.set:v=g.init||g[d],v&&this.raiseRecoverable(n.start,"Redefinition of property")}else g=t[o]={init:!1,get:!1,set:!1};g[d]=!0}},L.parseExpression=function(e,t){var i=this;return this.catchStackOverflow(function(){var n=i.start,o=i.startLoc,d=i.parseMaybeAssign(e,t);if(i.type===a.comma){var g=i.startNodeAt(n,o);for(g.expressions=[d];i.eat(a.comma);)g.expressions.push(i.parseMaybeAssign(e,t));return i.finishNode(g,"SequenceExpression")}return d})},L.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,o=-1,d=-1,g=-1;t?(o=t.parenthesizedAssign,d=t.trailingComma,g=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new xt,n=!0);var v=this.start,y=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var N=this.parseMaybeConditional(e,t);if(i&&(N=i.call(this,N,v,y)),this.type.isAssign){var M=this.startNodeAt(v,y);return M.operator=this.value,this.type===a.eq&&(N=this.toAssignable(N,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=N.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(N):this.checkLValSimple(N),M.left=N,this.next(),M.right=this.parseMaybeAssign(e),g>-1&&(t.doubleProto=g),this.finishNode(M,"AssignmentExpression")}else n&&this.checkExpressionErrors(t,!0);return o>-1&&(t.parenthesizedAssign=o),d>-1&&(t.trailingComma=d),N},L.parseMaybeConditional=function(e,t){var i=this.start,n=this.startLoc,o=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return o;if(!(o.type==="ArrowFunctionExpression"&&o.start===i)&&this.eat(a.question)){var d=this.startNodeAt(i,n);return d.test=o,d.consequent=this.parseMaybeAssign(),this.expect(a.colon),d.alternate=this.parseMaybeAssign(e),this.finishNode(d,"ConditionalExpression")}return o},L.parseExprOps=function(e,t){var i=this.start,n=this.startLoc,o=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||o.start===i&&o.type==="ArrowFunctionExpression"?o:this.parseExprOp(o,i,n,-1,e)},L.parseExprOp=function(e,t,i,n,o){var d=this.type.binop;if(d!=null&&(!o||this.type!==a._in)&&d>n){var g=this.type===a.logicalOR||this.type===a.logicalAND,v=this.type===a.coalesce;v&&(d=a.logicalAND.binop);var y=this.value;this.next();var N=this.start,M=this.startLoc,Q=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,o),N,M,d,o),ue=this.buildBinary(t,i,e,Q,y,g||v);return(g&&this.type===a.coalesce||v&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(ue,t,i,n,o)}return e},L.buildBinary=function(e,t,i,n,o,d){n.type==="PrivateIdentifier"&&this.raise(n.start,"Private identifier can only be left side of binary expression");var g=this.startNodeAt(e,t);return g.left=i,g.operator=o,g.right=n,this.finishNode(g,d?"LogicalExpression":"BinaryExpression")},L.parseMaybeUnary=function(e,t,i,n){var o=this.start,d=this.startLoc,g;if(this.isContextual("await")&&this.canAwait)g=this.parseAwait(n),t=!0;else if(this.type.prefix){var v=this.startNode(),y=this.type===a.incDec;v.operator=this.value,v.prefix=!0,this.next(),v.argument=this.parseMaybeUnary(null,!0,y,n),this.checkExpressionErrors(e,!0),y?this.checkLValSimple(v.argument):this.strict&&v.operator==="delete"&&Ai(v.argument)?this.raiseRecoverable(v.start,"Deleting local variable in strict mode"):v.operator==="delete"&&Jt(v.argument)?this.raiseRecoverable(v.start,"Private fields can not be deleted"):t=!0,g=this.finishNode(v,y?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(n||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),g=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(g=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return g;for(;this.type.postfix&&!this.canInsertSemicolon();){var N=this.startNodeAt(o,d);N.operator=this.value,N.prefix=!1,N.argument=g,this.checkLValSimple(g),this.next(),g=this.finishNode(N,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(o,d,g,this.parseMaybeUnary(null,!1,!1,n),"**",!1);else return g};function Ai(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Ai(e.expression)}function Jt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Jt(e.expression)||e.type==="ParenthesizedExpression"&&Jt(e.expression)}L.parseExprSubscripts=function(e,t){var i=this.start,n=this.startLoc,o=this.parseExprAtom(e,t);if(o.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return o;var d=this.parseSubscripts(o,i,n,!1,t);return e&&d.type==="MemberExpression"&&(e.parenthesizedAssign>=d.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=d.start&&(e.parenthesizedBind=-1),e.trailingComma>=d.start&&(e.trailingComma=-1)),d},L.parseSubscripts=function(e,t,i,n,o){for(var d=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,g=!1;;){var v=this.parseSubscript(e,t,i,n,d,g,o);if(v.optional&&(g=!0),v===e||v.type==="ArrowFunctionExpression"){if(g){var y=this.startNodeAt(t,i);y.expression=v,v=this.finishNode(y,"ChainExpression")}return v}e=v}},L.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)},L.parseSubscriptAsyncArrow=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,n)},L.parseSubscript=function(e,t,i,n,o,d,g){var v=this.options.ecmaVersion>=11,y=v&&this.eat(a.questionDot);n&&y&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var N=this.eat(a.bracketL);if(N||y&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var M=this.startNodeAt(t,i);M.object=e,N?(M.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?M.property=this.parsePrivateIdent():M.property=this.parseIdent(this.options.allowReserved!=="never"),M.computed=!!N,v&&(M.optional=y),e=this.finishNode(M,"MemberExpression")}else if(!n&&this.eat(a.parenL)){var Q=new xt,ue=this.yieldPos,ct=this.awaitPos,Ye=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Ct=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,Q);if(o&&!y&&this.shouldParseAsyncArrow())return this.checkPatternErrors(Q,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=ue,this.awaitPos=ct,this.awaitIdentPos=Ye,this.parseSubscriptAsyncArrow(t,i,Ct,g);this.checkExpressionErrors(Q,!0),this.yieldPos=ue||this.yieldPos,this.awaitPos=ct||this.awaitPos,this.awaitIdentPos=Ye||this.awaitIdentPos;var Xe=this.startNodeAt(t,i);Xe.callee=e,Xe.arguments=Ct,v&&(Xe.optional=y),e=this.finishNode(Xe,"CallExpression")}else if(this.type===a.backQuote){(y||d)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Ze=this.startNodeAt(t,i);Ze.tag=e,Ze.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(Ze,"TaggedTemplateExpression")}return e},L.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var n,o=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(n,"Super");case a._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case a.name:var d=this.start,g=this.startLoc,v=this.containsEsc,y=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!v&&y.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(K.f_expr),this.parseFunction(this.startNodeAt(d,g),0,!1,!0,t);if(o&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(d,g),[y],!1,t);if(this.options.ecmaVersion>=8&&y.name==="async"&&this.type===a.name&&!v&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return y=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(d,g),[y],!0,t)}return y;case a.regexp:var N=this.value;return n=this.parseLiteral(N.value),n.regex={pattern:N.pattern,flags:N.flags},n;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return n=this.startNode(),n.value=this.type===a._null?null:this.type===a._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case a.parenL:var M=this.start,Q=this.parseParenAndDistinguishExpression(o,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Q)&&(e.parenthesizedAssign=M),e.parenthesizedBind<0&&(e.parenthesizedBind=M)),Q;case a.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case a.braceL:return this.overrideContext(K.b_expr),this.parseObj(!1,e);case a._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},L.parseExprAtomDefault=function(){this.unexpected()},L.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()},L.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(a.parenR)?e.options=null:(this.expect(a.comma),this.afterTrailingComma(a.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(a.parenR)||(this.expect(a.comma),this.afterTrailingComma(a.parenR)||this.unexpected())));else if(!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},L.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")},L.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.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},L.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e},L.shouldParseArrow=function(e){return!this.canInsertSemicolon()},L.parseParenAndDistinguishExpression=function(e,t){var i=this.start,n=this.startLoc,o,d=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var g=this.start,v=this.startLoc,y=[],N=!0,M=!1,Q=new xt,ue=this.yieldPos,ct=this.awaitPos,Ye;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(N?N=!1:this.expect(a.comma),d&&this.afterTrailingComma(a.parenR,!0)){M=!0;break}else if(this.type===a.ellipsis){Ye=this.start,y.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else y.push(this.parseMaybeAssign(!1,Q,this.parseParenItem));var Ct=this.lastTokEnd,Xe=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(y)&&this.eat(a.arrow))return this.checkPatternErrors(Q,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=ue,this.awaitPos=ct,this.parseParenArrowList(i,n,y,t);(!y.length||M)&&this.unexpected(this.lastTokStart),Ye&&this.unexpected(Ye),this.checkExpressionErrors(Q,!0),this.yieldPos=ue||this.yieldPos,this.awaitPos=ct||this.awaitPos,y.length>1?(o=this.startNodeAt(g,v),o.expressions=y,this.finishNodeAt(o,"SequenceExpression",Ct,Xe)):o=y[0]}else o=this.parseParenExpression();if(this.options.preserveParens){var Ze=this.startNodeAt(i,n);return Ze.expression=o,this.finishNode(Ze,"ParenthesizedExpression")}else return o},L.parseParenItem=function(e){return e},L.parseParenArrowList=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,n)};var ts=[];L.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===a.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=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'"),i&&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 n=this.start,o=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,o,!0,!1),e.callee.type==="Super"&&this.raiseRecoverable(n,"Invalid use of 'super'"),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=ts,this.finishNode(e,"NewExpression")},L.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
1
+ var Rr=Object.create;var Et=Object.defineProperty;var Nr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,Or=Object.prototype.hasOwnProperty;var Zi=(s,r)=>()=>(s&&(r=s(s=0)),r);var _e=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports),Qt=(s,r)=>{for(var o in r)Et(s,o,{get:r[o],enumerable:!0})},es=(s,r,o,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of Tr(r))!Or.call(s,l)&&l!==o&&Et(s,l,{get:()=>r[l],enumerable:!(u=Nr(r,l))||u.enumerable});return s};var et=(s,r,o)=>(o=s!=null?Rr(Lr(s)):{},es(r||!s||!s.__esModule?Et(o,"default",{value:s,enumerable:!0}):o,s)),lt=s=>es(Et({},"__esModule",{value:!0}),s);var ss={};Qt(ss,{ProjectTargetError:()=>We,SUPPORTED_PROJECT_TARGETS:()=>ts,assertMatchingProjectTargets:()=>is,defaultV4ProjectTarget:()=>Vr,parseProjectTarget:()=>we,projectTargetKey:()=>De,registryRoute:()=>Fr,resolveProjectTarget:()=>Dr});function De(s){return`${s.framework}/${s.primitive}`}function we(s,r="Project target"){let o=s,u=typeof o?.framework=="string"?o.framework.trim().toLowerCase():"",l=typeof o?.primitive=="string"?o.primitive.trim().toLowerCase():"",p=`${u}/${l}`;if(!u||!l||!jr.has(p))throw new We("INVALID_PROJECT_TARGET",`${r} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${p}.`,{framework:u||null,primitive:l||null});return{framework:u,primitive:l}}function Vr(s="react"){return we({framework:s,primitive:s==="vue"?"reka":"base"})}function is(s){let r=Object.entries(s).filter(([,l])=>l!=null).map(([l,p])=>[l,we(p,l)]);if(r.length===0)throw new We("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let o=De(r[0][1]);if(r.find(([,l])=>De(l)!==o))throw new We("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${r.map(([l,p])=>`${l}=${De(p)}`).join(", ")}.`,{targets:Object.fromEntries(r)});return r[0][1]}function Dr({persisted:s,configured:r,app:o,release:u,lock:l,proposed:p}={}){let h={persisted:s,configured:r,app:o,release:u,lock:l};if(Object.values(h).some(f=>f!=null))return is(h);if(p)return we(p,"migration proposal");throw new We("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function Fr(s,r){throw we(s),String(r||"").trim(),new We("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var ts,jr,We,Pt=Zi(()=>{ts=Object.freeze([Object.freeze({framework:"react",primitive:"radix"}),Object.freeze({framework:"react",primitive:"base"}),Object.freeze({framework:"react",primitive:"aria"}),Object.freeze({framework:"vue",primitive:"reka"})]),jr=new Set(ts.map(s=>`${s.framework}/${s.primitive}`)),We=class extends Error{constructor(r,o,u={}){super(o),this.name="ProjectTargetError",this.code=r,Object.assign(this,u)}}});var ii=_e((ua,us)=>{var Fe=require("fs"),Te=require("path"),{createHash:os}=require("crypto"),$r=".frontfriend/design",Ur=".frontfriend/.gitignore";function qr(){return["# Managed by `frontfriend design sync`.","# audit/ holds regenerable capture artifacts (screenshots, probes) \u2014 never commit.","# design/ is the committed read-only contract mirror \u2014 keep it tracked.","audit/","# design-working/ is an explicit, disposable working preview.","design-working/",""].join(`
2
+ `)}function pt(s){return typeof s!="string"||s.length===0||s.startsWith("/")||s.includes("\\")?!1:s.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}function Zt(s){let r=s.body.endsWith(`
3
+ `)?s.body.slice(0,-1):s.body;return["<!-- frontfriend design mirror \u2014 DO NOT EDIT (overwritten by `frontfriend design sync`)",`slug: ${s.slug}`,`maturity: ${s.maturity}`,`implemented: ${s.implemented}`,`implementation: ${s.implementation||"unknown"}`,`version: ${s.version}`,"-->","",r,""].join(`
4
+ `)}function ei(s){return[`# Frontfriend design mirror \u2014 ${s.name}`,"","This directory is a READ-ONLY mirror of the Design System design contracts",`(Design System "${s.name}", ff-id \`${s.ff_id}\`) managed on the Frontfriend platform.`,"","Every file here is overwritten by `frontfriend design sync`. Do not edit by","hand: local changes are discarded on the next sync, and files whose contract","was removed upstream are deleted. Edit contracts on the platform instead.",""].join(`
5
+ `)}function cs({design_system:s,contracts:r}){let o=[...r].filter(l=>pt(l.slug)).sort((l,p)=>l.kind.localeCompare(p.kind)||l.slug.localeCompare(p.slug)),u={"README.md":ei(s)};for(let l of o)u[l.slug]=Zt(l);return u}function Xt(s,r){let o={};for(let[l,p]of Object.entries(s))r[l]!==p&&(o[l]=p);let u=Object.keys(r).filter(l=>!(l in s)).sort();return{writes:o,deletes:u}}var ti=s=>os("sha256").update(s).digest("hex");function Wr(s){return Object.fromEntries(Object.entries(s).filter(([r])=>r!=="README.md"&&pt(r)).map(([r,o])=>[r,ti(o)]))}function Hr(s,r){let o=()=>{throw new Error("Invalid or incomplete mirror response. No local files were changed; retry sync.")};(!s||typeof s.design_system?.ff_id!="string"||typeof s.design_system?.name!="string"||!Array.isArray(s.contracts))&&o();let u=new Map;for(let h of s.contracts)(!h||!pt(h.slug)||h.slug==="README.md"||typeof h.body!="string"||typeof h.kind!="string"||typeof h.maturity!="string"||typeof h.implemented!="boolean"||!Number.isSafeInteger(h.version)||h.version<1||u.has(h.slug))&&o(),u.set(h.slug,Zt(h));if(s.protocol===void 0)return s.manifest!==void 0&&o(),Xt(cs(s),r);(s.protocol!==1||!Array.isArray(s.manifest))&&o();let l={"README.md":ei(s.design_system)},p=new Set;for(let h of s.manifest){(!h||!pt(h.slug)||h.slug==="README.md"||!/^[a-f0-9]{64}$/.test(h.hash)||p.has(h.slug))&&o(),p.add(h.slug);let f=u.get(h.slug)??r[h.slug];(typeof f!="string"||ti(f)!==h.hash)&&o(),Object.defineProperty(l,h.slug,{value:f,enumerable:!0})}return[...u.keys()].some(h=>!p.has(h))&&o(),Xt(l,r)}function zr(s){let r={};if(!Fe.existsSync(s))return r;let o=u=>{for(let l of Fe.readdirSync(u,{withFileTypes:!0})){let p=Te.join(u,l.name);if(l.isDirectory())o(p);else if(l.isFile()){let h=Te.relative(s,p).split(Te.sep).join("/");r[h]=Fe.readFileSync(p,"utf8")}}};return o(s),r}function Gr(s,r){for(let[o,u]of Object.entries(r.writes)){let l=Te.join(s,...o.split("/"));Fe.mkdirSync(Te.dirname(l),{recursive:!0}),Fe.writeFileSync(l,u)}for(let o of r.deletes){let u=Te.join(s,...o.split("/"));Fe.rmSync(u,{force:!0});let l=Te.dirname(u),p=Te.resolve(s);for(;Te.resolve(l)!==p&&Fe.existsSync(l)&&Fe.readdirSync(l).length===0;)Fe.rmdirSync(l),l=Te.dirname(l)}}function Jr(s,r,o){if(!r||s.contract_selection!==1||s.selection?.design_snapshot_id!==r.snapshotId||s.selection?.digest!==r.snapshotDigest||s.app?.id!==r.appId||s.design_system?.ff_id!==o)throw new Error("Contract mirror does not match the selected App snapshot.");let u=[...r.sharedContracts,...r.contracts],l=s.manifest??s.contracts,p=new Map(u.map(h=>[h.slug,h]));if(!Array.isArray(l)||!Array.isArray(s.contracts)||l.length!==u.length||new Set(l.map(h=>h.slug)).size!==u.length||l.some(h=>!p.has(h.slug)))throw new Error("Contract mirror inventory does not match the snapshot.");for(let h of s.contracts){let f=p.get(h.slug);if(!f||h.revision_id!==f.revisionId||h.digest!==f.digest||h.version!==f.version||h.kind!==f.kind)throw new Error("Contract body identity does not match its snapshot pin.");let m={appId:r.contracts.some(w=>w.slug===f.slug)?r.appId:null,body:h.body,designSystemId:r.designSystemId,kind:h.kind,maturity:h.maturity,slug:h.slug,title:h.title};if(os("sha256").update(JSON.stringify(m)).digest("hex")!==f.digest)throw new Error("Contract content does not match its immutable digest.")}return u}us.exports={validatePinnedMirror:Jr,MIRROR_DIR:$r,FRONTFRIEND_GITIGNORE_PATH:Ur,renderFrontfriendGitignore:qr,isSafeSlug:pt,renderContractFile:Zt,renderMirrorReadme:ei,buildMirrorTree:cs,planMirrorSync:Xt,hashMirrorFile:ti,knownMirrorHashes:Wr,planMirrorResponse:Hr,readMirrorTree:zr,applyMirrorPlan:Gr}});var oi=_e((da,vs)=>{var ai=require("fs"),pe=require("path");function fs(s,r="JSON"){let o="",u=0,l=s.charCodeAt(0)===65279?s.slice(1):s;for(;u<l.length;){let h=l[u];if(h==='"'){let f=u+1;for(;f<l.length&&l[f]!=='"';)f+=l[f]==="\\"?2:1;o+=l.slice(u,f+1),u=f+1}else if(h==="/"&&l[u+1]==="/")for(;u<l.length&&l[u]!==`
6
+ `;)u+=1;else if(h==="/"&&l[u+1]==="*"){let f=l.indexOf("*/",u+2);if(f===-1)throw new Error(`Cannot read ${r}: unterminated comment.`);o+=l.slice(u,f+2).replace(/[^\n]/g," "),u=f+2}else o+=h,u+=1}let p="";for(let h=0;h<o.length;h+=1){let f=o[h];if(f==='"'){let m=h+1;for(;m<o.length&&o[m]!=='"';)m+=o[m]==="\\"?2:1;p+=o.slice(h,m+1),h=m;continue}if(f===","){let m=h+1;for(;m<o.length&&/\s/.test(o[m]);)m+=1;if(o[m]==="}"||o[m]==="]")continue}p+=f}try{return p.trim()?JSON.parse(p):{}}catch(h){throw new Error(`Cannot read ${r}: ${h.message}`)}}function ds(s){return fs(ai.readFileSync(s,"utf8"),s)}var Nt=s=>{try{return ai.statSync(s).isFile()}catch{return!1}};function ms(s,r){if(typeof s!="string"||!s)throw new Error('tsconfig "extends" must be a non-empty string.');let o=u=>Nt(u)?u:!u.endsWith(".json")&&Nt(`${u}.json`)?`${u}.json`:null;if(s.startsWith(".")||pe.isAbsolute(s)){let u=o(pe.resolve(r,s));if(u)return u;throw new Error(`File '${s}' not found (tsconfig extends, from ${r}).`)}for(let u=r;;u=pe.dirname(u)){let l=pe.join(u,"node_modules",s),p=o(l);if(p)return p;let h=null;try{h=JSON.parse(ai.readFileSync(pe.join(l,"package.json"),"utf8"))}catch{h=null}if(h&&typeof h.tsconfig=="string"&&Nt(pe.join(l,h.tsconfig)))return pe.join(l,h.tsconfig);if(Nt(pe.join(l,"tsconfig.json")))return pe.join(l,"tsconfig.json");if(pe.dirname(u)===u)break}for(let u of[s,`${s}/tsconfig.json`,`${s}.json`])try{return require.resolve(u,{paths:[r]})}catch{}throw new Error(`File '${s}' not found (tsconfig extends, from ${r}).`)}function gs(s,r,o=new Set){let u=pe.resolve(s);if(o.has(u))throw new Error(`Circularity detected while resolving configuration: ${u}`);let l=new Set(o).add(u),p=ds(u),h=pe.dirname(u),f={},m=p.extends===void 0?[]:Array.isArray(p.extends)?p.extends:[p.extends];for(let I of m)f={...f,...gs(ms(I,h),r,l)};let x=p.compilerOptions&&typeof p.compilerOptions=="object"?p.compilerOptions:{},w=I=>typeof I=="string"?I.replace(/\$\{configDir\}/g,r):I;return typeof x.baseUrl=="string"&&(f.baseUrl=pe.resolve(h,w(x.baseUrl))),x.paths&&typeof x.paths=="object"&&(f.paths=Object.fromEntries(Object.entries(x.paths).map(([I,A])=>[I,Array.isArray(A)?A.map(w):A])),f.pathsBasePath=h),f}function Zr(s){let r=gs(s,pe.dirname(pe.resolve(s)));return r.paths?{base:r.baseUrl||r.pathsBasePath||pe.dirname(s),paths:r.paths}:null}vs.exports={parseJsonc:fs,readJsonc:ds,resolveExtends:ms,readConfigPaths:Zr}});var Lt={};Qt(Lt,{materializeInstallationPath:()=>ui,readProjectPaths:()=>ys,resolveCanonicalUiDirectory:()=>bs,resolveConfiguredAlias:()=>Tt});function xs(s){try{return JSON.parse(it.default.readFileSync(s,"utf8"))}catch{return null}}function ys(s){for(let r of["tsconfig.json","tsconfig.app.json","jsconfig.json"]){let o=me.default.join(s,r);if(!it.default.existsSync(o))continue;let u=en(o);if(u)return u}return{base:s,paths:{"@/*":[it.default.existsSync(me.default.join(s,"src"))?"src/*":"*"]}}}function Tt(s,r,o=ys(s)){for(let[u,l]of Object.entries(o.paths)){if(!Array.isArray(l)||typeof l[0]!="string")continue;let[p,h=""]=u.split("*");if(!r.startsWith(p)||!r.endsWith(h)||!u.includes("*")&&r!==u)continue;let f=r.slice(p.length,h?-h.length:void 0);return me.default.resolve(o.base,l[0].replace("*",f))}return r.startsWith("@/")?me.default.resolve(s,it.default.existsSync(me.default.join(s,"src"))?"src":".",r.slice(2)):me.default.resolve(s,r)}function ci(s,r){let o=me.default.relative(s,r).replace(/\\/g,"/");if(!o||o===".."||o.startsWith("../")||me.default.posix.isAbsolute(o))throw new Error("The canonical ui alias must stay inside the Application root.");return o}function bs(s,r){if(r)return ci(s,Tt(s,r));let u=xs(me.default.join(s,"components.json"))?.aliases?.ui;return typeof u=="string"&&u?ci(s,Tt(s,u)):it.default.existsSync(me.default.join(s,"src"))?"src/components/ui":"components/ui"}function ui(s){if(s.installationLayout==="shadcn"&&/^(?:lib|hooks|components)\//.test(s.path)){let u=xs(me.default.join(s.root,"components.json"))?.aliases||{},l=/^lib\/utils\.[^.]+$/.test(s.path),p=s.path.split("/")[0],h=l&&u.utils?u.utils:u[p]||`@/${p}`,f=Tt(s.root,h);return ci(s.root,l&&u.utils?f+me.default.extname(s.path):me.default.join(f,s.path.slice(p.length+1)))}if(s.source!=="canonical"&&s.installationLayout!=="shadcn"||!s.path.startsWith("ui/"))return s.path;let r=s.path.slice(3);return me.default.posix.join(bs(s.root,s.configuredUiPath),r)}var it,me,en,dt=Zi(()=>{it=et(require("node:fs")),me=et(require("node:path")),{readConfigPaths:en}=oi()});var Ss=_e((ga,rn)=>{rn.exports={name:"@frontfriend/sdk",version:"1.2.4"}});var Cs=_e((va,ks)=>{var{name:nn}=Ss();ks.exports={PACKAGE_NAME:nn}});var hi=_e((xa,As)=>{var{PACKAGE_NAME:Ot}=Cs(),Me=require("fs"),an=require("http"),on=require("https"),ye=require("path"),jt=["contracts","tokens","components"],cn=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],un={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},ln=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],hn=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function Is(s){try{return JSON.parse(Me.readFileSync(s,"utf8"))}catch{return{}}}function li(s){if(s===void 0)return null;if(!Array.isArray(s)){let u=new Error("`adopt` in frontfriend.config.js must be an array.");throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let r=s.filter(u=>!jt.includes(u));if(r.length>0){let u=new Error(`Unknown Frontfriend adoption level: ${r.join(", ")}.`);throw u.code="FRONTFRIEND_CONFIG_VALIDATION",u}let o=s.includes("components")?2:s.includes("tokens")?1:0;return jt.slice(0,o+1)}function pn(s){for(let[r,o]of Object.entries(un)){let u=o.find(p=>Me.existsSync(ye.join(s,p)));if(!u)continue;let l=Me.readFileSync(ye.join(s,u),"utf8");return{buildTool:r,present:l.includes(`${Ot}/${r}`)}}return{buildTool:null,present:!1}}function fn(s){let r=[ye.join(s,"components","ui"),ye.join(s,"src","components","ui"),ye.join(s,"app","components","ui")].filter(l=>Me.existsSync(l)),o=new Set;function u(l){for(let p of Me.readdirSync(l,{withFileTypes:!0})){let h=ye.join(l,p.name);if(p.isDirectory())u(h);else if(/\.(js|jsx|ts|tsx|vue)$/.test(p.name)){if(!Me.readFileSync(h,"utf8").includes(Ot))continue;let m=ye.basename(p.name,ye.extname(p.name));o.add(m.toLowerCase()==="index"?ye.basename(l):m.toLowerCase())}}}return r.forEach(u),[...o].sort()}function dn(s){let r=Is(ye.join(s,"package.json")),o={...r.dependencies||{},...r.devDependencies||{}},u=o.tailwindcss||null,p=[Is(ye.join(s,"components.json"))?.tailwind?.css,...cn].filter(Boolean).find(m=>Me.existsSync(ye.join(s,m))),h=p?Me.readFileSync(ye.join(s,p),"utf8"):"",f=hn.filter(m=>o[m]);return!f.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(h)&&!h.includes(`${Ot}/theme.css`)&&f.push("css-custom-properties"),{nativeTokens:{present:h.includes("/* Frontfriend managed native tokens: start */"),file:p||null},tailwind:{present:!!u,version:u,major:u&&Number((String(u).match(/\d+/)||[])[0])||null},componentsJson:Me.existsSync(ye.join(s,"components.json")),themeImport:{present:h.includes(`${Ot}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(h),file:p||null},plugin:pn(s),frontfriendComponents:fn(s),foreignComponentLibraries:ln.filter(m=>o[m]),foreignTokenSystems:f}}function mn(s,r){let o=li(s)||jt,u=o.includes("tokens"),l=o.includes("components"),p=[];return u&&!r.themeImport.present&&!r.nativeTokens?.present&&p.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!u&&r.themeImport.present&&p.push("Frontfriend tokens are present in CSS but are not adopted in config."),l&&!r.componentsJson&&p.push("Config adopts components, but components.json was not observed."),!l&&r.frontfriendComponents.length>0&&p.push("Frontfriend components are installed but are not adopted in config."),p}function gn({apiUrl:s,token:r,ffId:o,name:u,adopt:l,observed:p,framework:h,primitive:f}){if(!s||!r||!o||!u||!h||f===void 0)return Promise.resolve({reported:!1,unavailable:!0});let m=new URL("/api/apps/sync",s),x=JSON.stringify({ffId:o,name:u,adopt:li(l),observed:p,runtime:"sdk",framework:h,primitive:f}),w=m.protocol==="https:"?on:an;return new Promise(I=>{let A=w.request(m,{method:"POST",headers:{authorization:`Bearer ${r}`,"content-type":"application/json","content-length":Buffer.byteLength(x)}},B=>{B.resume(),B.on("end",()=>{B.statusCode>=200&&B.statusCode<300?I({reported:!0,unavailable:!1}):I({reported:!1,unavailable:!0})})});A.on("error",()=>I({reported:!1,unavailable:!0})),A.setTimeout(1500,()=>{A.destroy(),I({reported:!1,unavailable:!0})}),A.end(x)})}As.exports={ADOPTION_LEVELS:jt,normalizeAdopt:li,probeAdoption:dn,adoptionWarnings:mn,reportAdoption:gn}});var Es=_e((Vt,_s)=>{(function(s,r){typeof Vt=="object"&&typeof _s<"u"?r(Vt):typeof define=="function"&&define.amd?define(["exports"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.acorn={}))})(Vt,function(s){"use strict";var r=[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],o=[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],u="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",l="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",p={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"},h="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",f={5:h,"5module":h+" export import",6:h+" const class extends export import super"},m=/^in(stanceof)?$/,x=new RegExp("["+l+"]"),w=new RegExp("["+l+u+"]");function I(e,t){for(var i=65536,n=0;n<t.length;n+=2){if(i+=t[n],i>e)return!1;if(i+=t[n+1],i>=e)return!0}return!1}function A(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&x.test(String.fromCharCode(e)):t===!1?!1:I(e,o)}function B(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&&w.test(String.fromCharCode(e)):t===!1?!1:I(e,o)||I(e,r)}var _=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function T(e,t){return new _(e,{beforeExpr:!0,binop:t})}var R={beforeExpr:!0},E={startsExpr:!0},ae={};function O(e,t){return t===void 0&&(t={}),t.keyword=e,ae[e]=new _(e,t)}var a={num:new _("num",E),regexp:new _("regexp",E),string:new _("string",E),name:new _("name",E),privateId:new _("privateId",E),eof:new _("eof"),bracketL:new _("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new _("]"),braceL:new _("{",{beforeExpr:!0,startsExpr:!0}),braceR:new _("}"),parenL:new _("(",{beforeExpr:!0,startsExpr:!0}),parenR:new _(")"),comma:new _(",",R),semi:new _(";",R),colon:new _(":",R),dot:new _("."),question:new _("?",R),questionDot:new _("?."),arrow:new _("=>",R),template:new _("template"),invalidTemplate:new _("invalidTemplate"),ellipsis:new _("...",R),backQuote:new _("`",E),dollarBraceL:new _("${",{beforeExpr:!0,startsExpr:!0}),eq:new _("=",{beforeExpr:!0,isAssign:!0}),assign:new _("_=",{beforeExpr:!0,isAssign:!0}),incDec:new _("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new _("!/~",{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 _("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:T("%",10),star:T("*",10),slash:T("/",10),starstar:new _("**",{beforeExpr:!0}),coalesce:T("??",1),_break:O("break"),_case:O("case",R),_catch:O("catch"),_continue:O("continue"),_debugger:O("debugger"),_default:O("default",R),_do:O("do",{isLoop:!0,beforeExpr:!0}),_else:O("else",R),_finally:O("finally"),_for:O("for",{isLoop:!0}),_function:O("function",E),_if:O("if"),_return:O("return",R),_switch:O("switch"),_throw:O("throw",R),_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",E),_super:O("super",E),_class:O("class",E),_extends:O("extends",R),_export:O("export"),_import:O("import",E),_null:O("null",E),_true:O("true",E),_false:O("false",E),_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})},b=/\r\n?|\n|\u2028|\u2029/,j=new RegExp(b.source,"g");function V(e){return e===10||e===13||e===8232||e===8233}function W(e,t,i){i===void 0&&(i=e.length);for(var n=t;n<i;n++){var c=e.charCodeAt(n);if(V(c))return n<i-1&&c===13&&e.charCodeAt(n+1)===10?n+2:n+1}return-1}var Y=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,q=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ee=Object.prototype,xe=ee.hasOwnProperty,nt=ee.toString,se=Object.hasOwn||function(e,t){return xe.call(e,t)},yt=Array.isArray||function(e){return nt.call(e)==="[object Array]"},Ht=Object.create(null);function Re(e){return Ht[e]||(Ht[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function ce(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var bt=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,S=function(t,i){this.line=t,this.column=i};S.prototype.offset=function(t){return new S(this.line,this.column+t)};var $=function(t,i,n){this.start=i,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function te(e,t){for(var i=1,n=0;;){var c=W(e,n,t);if(c<0)return new S(i,t-n);++i,n=c}}var Se={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},Oe=!1;function re(e){var t={};for(var i in Se)t[i]=e&&se(e,i)?e[i]:Se[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Oe&&typeof console=="object"&&console.warn&&(Oe=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
7
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),yt(t.onToken)){var n=t.onToken;t.onToken=function(c){return n.push(c)}}if(yt(t.onComment)&&(t.onComment=Be(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function Be(e,t){return function(i,n,c,d,g,v){var y={type:i?"Block":"Line",value:n,start:c,end:d};e.locations&&(y.loc=new $(this,g,v)),e.ranges&&(y.range=[c,d]),t.push(y)}}var fe=1,Q=2,H=4,z=8,be=16,Ee=32,$e=64,Je=128,oe=256,je=512,ue=1024,Ue=fe|Q|oe;function ne(e,t){return Q|(e?H:0)|(t?z:0)}var ie=0,Ke=1,Pe=2,Ci=3,Ii=4,Ai=5,X=function(t,i,n){this.options=t=re(t),this.sourceFile=t.sourceFile,this.keywords=Re(f[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var c="";t.allowReserved!==!0&&(c=p[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(c+=" await")),this.reservedWords=Re(c);var d=(c?c+" ":"")+p.strict;this.reservedWordsStrict=Re(d),this.reservedWordsStrictBind=Re(d+" "+p.strictBind),this.input=String(i),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
8
+ `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(b).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.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=t.sourceType==="module",this.strict=this.inModule||t.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&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Q:fe),this.regexpState=null,this.privateNameStack=[]},ke={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}};X.prototype.parse=function(){var t=this,i=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return t.parseTopLevel(i)})},ke.inFunction.get=function(){return(this.currentVarScope().flags&Q)>0},ke.inGenerator.get=function(){return(this.currentVarScope().flags&z)>0},ke.inAsync.get=function(){return(this.currentVarScope().flags&H)>0},ke.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(oe|je))return!1;if(i&Q)return(i&H)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ke.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&fe)},ke.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&$e)>0||this.options.allowSuperOutsideMethod},ke.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Je)>0},ke.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ke.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(oe|je)||i&Q&&!(i&be))return!0}return!1},ke.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&ue||!this.inModule&&t&fe)},ke.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&oe)>0},X.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var n=this,c=0;c<t.length;c++)n=t[c](n);return n},X.parse=function(t,i){return new this(i,t).parse()},X.parseExpressionAt=function(t,i,n){var c=new this(n,t,i);return c.nextToken(),c.parseExpression()},X.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(X.prototype,ke);var le=X.prototype,tr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;le.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){q.lastIndex=e,e+=q.exec(this.input)[0].length;var t=tr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){q.lastIndex=e+t[0].length;var i=q.exec(this.input),n=i.index+i[0].length,c=this.input.charAt(n);return c===";"||c==="}"||b.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(c)||c==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,q.lastIndex=e,e+=q.exec(this.input)[0].length,this.input[e]===";"&&e++}},le.eat=function(e){return this.type===e?(this.next(),!0):!1},le.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc},le.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},le.catchStackOverflow=function(e){try{return e()}catch(t){if(t instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(t.message)||/\btoo much recursion\b/i.test(t.message)))this.raise(this.start,"Not enough stack space to parse input");else throw t}},le.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},le.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||b.test(this.input.slice(this.lastTokEnd,this.start))},le.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},le.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()},le.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},le.expect=function(e){this.eat(e)||this.unexpected()},le.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var wt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};le.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},le.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,n=e.doubleProto;if(!t)return i>=0||n>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},le.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")},le.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var C=X.prototype;C.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==a.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var n=0,c=Object.keys(this.undefinedExports);n<c.length;n+=1){var d=c[n];this.raiseRecoverable(this.undefinedExports[d].start,"Export '"+d+"' 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 zt={kind:"loop"},ir={kind:"switch"};C.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;q.lastIndex=this.pos;var t=q.exec(this.input),i=this.pos+t[0].length,n=this.fullCharCodeAt(i);if(n===91||n===92)return!0;if(e)return!1;if(n===123)return!0;if(A(n)){var c=i;do i+=n<=65535?1:2;while(B(n=this.fullCharCodeAt(i)));if(n===92)return!0;var d=this.input.slice(c,i);if(!m.test(d))return!0}return!1},C.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;q.lastIndex=this.pos;var e=q.exec(this.input),t=this.pos+e[0].length,i;return!b.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(B(i=this.fullCharCodeAt(t+8))||i===92))},C.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;q.lastIndex=this.pos;var i=q.exec(this.input),n=this.pos+i[0].length;if(b.test(this.input.slice(this.pos,n)))return!1;if(e){var c=n+5,d;if(this.input.slice(n,c)!=="using"||c===this.input.length||B(d=this.fullCharCodeAt(c))||d===92)return!1;q.lastIndex=c;var g=q.exec(this.input);if(n=c+g[0].length,g&&b.test(this.input.slice(c,n)))return!1}var v=this.fullCharCodeAt(n);if(!A(v)&&v!==92)return!1;var y=n;do n+=v<=65535?1:2;while(B(v=this.fullCharCodeAt(n)));if(v===92)return!0;var N=this.input.slice(y,n);if(m.test(N))return!1;if(t&&!e&&N==="of"){q.lastIndex=n;var M=q.exec(this.input);if(n=n+M[0].length,this.input.charCodeAt(n)!==61||(v=this.input.charCodeAt(n+1))===61||v===62)return!1}return!0},C.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},C.isUsing=function(e){return this.isUsingKeyword(!1,e)},C.parseStatement=function(e,t,i){var n=this.type,c=this.startNode(),d;switch(this.isLet(e)&&(n=a._var,d="let"),n){case a._break:case a._continue:return this.parseBreakContinueStatement(c,n.keyword);case a._debugger:return this.parseDebuggerStatement(c);case a._do:return this.parseDoStatement(c);case a._for:return this.parseForStatement(c);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(c,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(c,!0);case a._if:return this.parseIfStatement(c);case a._return:return this.parseReturnStatement(c);case a._switch:return this.parseSwitchStatement(c);case a._throw:return this.parseThrowStatement(c);case a._try:return this.parseTryStatement(c);case a._const:case a._var:return d=d||this.value,e&&d!=="var"&&this.unexpected(),this.parseVarStatement(c,d);case a._while:return this.parseWhileStatement(c);case a._with:return this.parseWithStatement(c);case a.braceL:return this.parseBlock(!0,c);case a.semi:return this.parseEmptyStatement(c);case a._export:case a._import:if(this.options.ecmaVersion>10&&n===a._import){q.lastIndex=this.pos;var g=q.exec(this.input),v=this.pos+g[0].length,y=this.input.charCodeAt(v);if(y===40||y===46)return this.parseExpressionStatement(c,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'")),n===a._import?this.parseImport(c):this.parseExport(c,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(c,!0,!e);var N=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(N)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"),N==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(c,!1,N),this.semicolon(),this.finishNode(c,"VariableDeclaration");var M=this.value,K=this.parseExpression();return n===a.name&&K.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(c,M,K,e):this.parseExpressionStatement(c,K)}},C.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n<this.labels.length;++n){var c=this.labels[n];if((e.label==null||c.name===e.label.name)&&(c.kind!=null&&(i||c.kind==="loop")||e.label&&i))break}return n===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},C.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},C.parseDoStatement=function(e){return this.next(),this.labels.push(zt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(a._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},C.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(zt),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var n=this.startNode(),c=i?"let":this.value;return this.next(),this.parseVar(n,!0,c),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var d=this.isContextual("let"),g=!1,v=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(v){var y=this.startNode();return this.next(),v==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(y,!0,v),this.finishNode(y,"VariableDeclaration"),this.parseForAfterInit(e,y,t)}var N=this.containsEsc,M=new wt,K=this.start,he=t>-1?this.parseExprSubscripts(M,"await"):this.parseExpression(!0,M);return this.type===a._in||(g=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===a._in&&this.unexpected(t),e.await=!0):g&&this.options.ecmaVersion>=8&&(he.start===K&&!N&&he.type==="Identifier"&&he.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),d&&g&&this.raise(he.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(he,!1,M),this.checkLValPattern(he),this.parseForIn(e,he)):(this.checkExpressionErrors(M,!0),t>-1&&this.unexpected(t),this.parseFor(e,he))},C.parseForAfterInit=function(e,t,i){return(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.type===a._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&&i>-1&&this.unexpected(i)):this.options.ecmaVersion>=9&&(e.await=i>-1),this.parseForIn(e,t)):(i>-1&&this.unexpected(i),this.parseFor(e,t))},C.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,at|(i?0:Gt),!1,t)},C.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},C.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},C.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(ir),this.enterScope(ue);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var n=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.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")},C.parseThrowStatement=function(e){return this.next(),b.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 sr=[];C.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Ee:0),this.checkLValPattern(e,t?Ii:Pe),this.expect(a.parenR),e},C.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.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(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},C.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},C.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(zt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},C.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")},C.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},C.parseLabeledStatement=function(e,t,i,n){for(var c=0,d=this.labels;c<d.length;c+=1){var g=d[c];g.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var v=this.type.isLoop?"loop":this.type===a._switch?"switch":null,y=this.labels.length-1;y>=0;y--){var N=this.labels[y];if(N.statementStart===e.start)N.statementStart=this.start,N.kind=v;else break}return this.labels.push({name:t,kind:v,statementStart:this.start}),e.body=this.parseStatement(n?n.indexOf("label")===-1?n+"label":n:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},C.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},C.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var n=this.parseStatement(null);t.body.push(n)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},C.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},C.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},C.parseVar=function(e,t,i,n){for(e.declarations=[],e.kind=i;;){var c=this.startNode();if(this.parseVarId(c,i),this.eat(a.eq)?c.init=this.parseMaybeAssign(t):!n&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!n&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==a._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!n&&c.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):c.init=null,e.declarations.push(this.finishNode(c,"VariableDeclarator")),!this.eat(a.comma))break}return e},C.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Ke:Pe,!1)};var at=1,Gt=2,_i=4;C.parseFunction=function(e,t,i,n,c){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===a.star&&t&Gt&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&at&&(e.id=t&_i&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Gt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ke:Pe:Ci));var d=this.yieldPos,g=this.awaitPos,v=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ne(e.async,e.generator)),t&at||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,c),this.yieldPos=d,this.awaitPos=g,this.awaitIdentPos=v,this.finishNode(e,t&at?"FunctionDeclaration":"FunctionExpression")},C.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},C.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),c=this.startNode(),d=!1;for(c.body=[],this.expect(a.braceL);this.type!==a.braceR;){var g=this.parseClassElement(e.superClass!==null);g&&(c.body.push(g),g.type==="MethodDefinition"&&g.kind==="constructor"?(d&&this.raiseRecoverable(g.start,"Duplicate constructor in the same class"),d=!0):g.key&&g.key.type==="PrivateIdentifier"&&rr(n,g)&&this.raiseRecoverable(g.key.start,"Identifier '#"+g.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(c,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},C.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),n="",c=!1,d=!1,g="method",v=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?v=!0:n="static"}if(i.static=v,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?d=!0:n="async"),!n&&(t>=9||!d)&&this.eat(a.star)&&(c=!0),!n&&!d&&!c){var y=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?g=y:n=y)}if(n?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=n,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||g!=="method"||c||d){var N=!i.static&&St(i,"constructor"),M=N&&e;N&&g!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=N?"constructor":g,this.parseClassMethod(i,c,d,M)}else this.parseClassField(i);return i},C.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword},C.parseClassElementName=function(e){this.type===a.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)},C.parseClassMethod=function(e,t,i,n){var c=e.key;e.kind==="constructor"?(t&&this.raise(c.start,"Constructor can't be a generator"),i&&this.raise(c.start,"Constructor can't be an async method")):e.static&&St(e,"prototype")&&this.raise(c.start,"Classes may not have a static property named prototype");var d=e.value=this.parseMethod(t,i,n);return e.kind==="get"&&d.params.length!==0&&this.raiseRecoverable(d.start,"getter should have no params"),e.kind==="set"&&d.params.length!==1&&this.raiseRecoverable(d.start,"setter should have exactly one param"),e.kind==="set"&&d.params[0].type==="RestElement"&&this.raiseRecoverable(d.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},C.parseClassField=function(e){return St(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&St(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)?(this.enterScope(je|$e),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},C.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(oe|$e);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},C.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Pe,!1)):(t===!0&&this.unexpected(),e.id=null)},C.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null},C.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},C.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,c=n===0?null:this.privateNameStack[n-1],d=0;d<i.length;++d){var g=i[d];se(t,g.name)||(c?c.used.push(g):this.raiseRecoverable(g.start,"Private field '#"+g.name+"' must be declared in an enclosing class"))}};function rr(e,t){var i=t.key.name,n=e[i],c="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(c=(t.static?"s":"i")+t.kind),n==="iget"&&c==="iset"||n==="iset"&&c==="iget"||n==="sget"&&c==="sset"||n==="sset"&&c==="sget"?(e[i]="true",!1):n?!0:(e[i]=c,!1)}function St(e,t){var i=e.computed,n=e.key;return!i&&(n.type==="Identifier"&&n.name===t||n.type==="Literal"&&n.value===t)}C.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!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},C.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._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!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,n=e.specifiers;i<n.length;i+=1){var c=n[i];this.checkUnreserved(c.local),this.checkLocalExport(c.local),c.local.type==="Literal"&&this.raise(c.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")},C.parseExportDeclaration=function(e){return this.parseStatement(null)},C.parseExportDefaultDeclaration=function(){var e;if(this.type===a._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,at|_i,!1,e)}else if(this.type===a._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var n=this.parseMaybeAssign();return this.semicolon(),n}},C.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),se(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},C.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var n=0,c=t.properties;n<c.length;n+=1){var d=c[n];this.checkPatternExport(e,d)}else if(i==="ArrayPattern")for(var g=0,v=t.elements;g<v.length;g+=1){var y=v[g];y&&this.checkPatternExport(e,y)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},C.checkVariableExport=function(e,t){if(e)for(var i=0,n=t;i<n.length;i+=1){var c=n[i];this.checkPatternExport(e,c.id)}},C.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},C.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")},C.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(a.braceL);!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;t.push(this.parseExportSpecifier(e))}return t},C.parseImport=function(e){return this.next(),this.type===a.string?(e.specifiers=sr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===a.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},C.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,Pe),this.finishNode(e,"ImportSpecifier")},C.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Pe),this.finishNode(e,"ImportDefaultSpecifier")},C.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Pe),this.finishNode(e,"ImportNamespaceSpecifier")},C.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===a.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(a.comma)))return e;if(this.type===a.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(a.braceL);!this.eat(a.braceR);){if(t)t=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;e.push(this.parseImportSpecifier())}return e},C.parseWithClause=function(){var e=[];if(!this.eat(a._with))return e;this.expect(a.braceL);for(var t={},i=!0;!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.afterTrailingComma(a.braceR))break;var n=this.parseImportAttribute(),c=n.key.type==="Identifier"?n.key.name:n.key.value;se(t,c)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+c+"'"),t[c]=!0,e.push(n)}return e},C.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(a.colon),this.type!==a.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},C.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===a.string){var e=this.parseLiteral(this.value);return bt.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},C.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)},C.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 Ce=X.prototype;Ce.toAssignable=function(e,t,i){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",i&&this.checkPatternErrors(i,!0);for(var n=0,c=e.properties;n<c.length;n+=1){var d=c[n];this.toAssignable(d,t),d.type==="RestElement"&&(d.argument.type==="ArrayPattern"||d.argument.type==="ObjectPattern")&&this.raise(d.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",i&&this.checkPatternErrors(i,!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,i);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 i&&this.checkPatternErrors(i,!0);return e},Ce.toAssignableList=function(e,t){for(var i=e.length,n=0;n<i;n++){var c=e[n];c&&this.toAssignable(c,t)}if(i){var d=e[i-1];this.options.ecmaVersion===6&&t&&d&&d.type==="RestElement"&&d.argument.type!=="Identifier"&&this.unexpected(d.argument.start)}return e},Ce.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},Ce.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==a.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},Ce.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()},Ce.parseBindingList=function(e,t,i,n){for(var c=[],d=!0;!this.eat(e);)if(d?d=!1:this.expect(a.comma),t&&this.type===a.comma)c.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var g=this.parseRestBinding();this.parseBindingListItem(g),c.push(g),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else c.push(this.parseAssignableListItem(n))}return c},Ce.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Ce.parseBindingListItem=function(e){return e},Ce.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var n=this.startNodeAt(e,t);return n.left=i,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},Ce.checkLValSimple=function(e,t,i){t===void 0&&(t=ie);var n=t!==ie;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===Pe&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(se(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==Ai&&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":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},Ce.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=ie),e.type){case"ObjectPattern":for(var n=0,c=e.properties;n<c.length;n+=1){var d=c[n];this.checkLValInnerPattern(d,t,i)}break;case"ArrayPattern":for(var g=0,v=e.elements;g<v.length;g+=1){var y=v[g];y&&this.checkLValInnerPattern(y,t,i)}break;default:this.checkLValSimple(e,t,i)}},Ce.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=ie),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var Ie=function(t,i,n,c,d){this.token=t,this.isExpr=!!i,this.preserveSpace=!!n,this.override=c,this.generator=!!d},J={b_stat:new Ie("{",!1),b_expr:new Ie("{",!0),b_tmpl:new Ie("${",!1),p_stat:new Ie("(",!1),p_expr:new Ie("(",!0),q_tmpl:new Ie("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Ie("function",!1),f_expr:new Ie("function",!0),f_expr_gen:new Ie("function",!0,!1,null,!0),f_gen:new Ie("function",!1,!1,null,!0)},Qe=X.prototype;Qe.initialContext=function(){return[J.b_stat]},Qe.curContext=function(){return this.context[this.context.length-1]},Qe.braceIsBlock=function(e){var t=this.curContext();return t===J.f_expr||t===J.f_stat?!0:e===a.colon&&(t===J.b_stat||t===J.b_expr)?!t.isExpr:e===a._return||e===a.name&&this.exprAllowed?b.test(this.input.slice(this.lastTokEnd,this.start)):e===a._else||e===a.semi||e===a.eof||e===a.parenR||e===a.arrow?!0:e===a.braceL?t===J.b_stat:e===a._var||e===a._const||e===a.name?!1:!this.exprAllowed},Qe.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},Qe.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},Qe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===J.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?J.b_stat:J.b_expr),this.exprAllowed=!0},a.dollarBraceL.updateContext=function(){this.context.push(J.b_tmpl),this.exprAllowed=!0},a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?J.p_stat:J.p_expr),this.exprAllowed=!0},a.incDec.updateContext=function(){},a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==J.p_stat)&&!(e===a._return&&b.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===J.b_stat)?this.context.push(J.f_expr):this.context.push(J.f_stat),this.exprAllowed=!1},a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},a.backQuote.updateContext=function(){this.curContext()===J.q_tmpl?this.context.pop():this.context.push(J.q_tmpl),this.exprAllowed=!1},a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===J.f_expr?this.context[t]=J.f_expr_gen:this.context[t]=J.f_gen}this.exprAllowed=!0},a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var L=X.prototype;L.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n=e.key,c;switch(n.type){case"Identifier":c=n.name;break;case"Literal":c=String(n.value);break;default:return}var d=e.kind;if(this.options.ecmaVersion>=6){c==="__proto__"&&d==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0);return}c="$"+c;var g=t[c];if(g){var v;d==="init"?v=this.strict&&g.init||g.get||g.set:v=g.init||g[d],v&&this.raiseRecoverable(n.start,"Redefinition of property")}else g=t[c]={init:!1,get:!1,set:!1};g[d]=!0}},L.parseExpression=function(e,t){var i=this;return this.catchStackOverflow(function(){var n=i.start,c=i.startLoc,d=i.parseMaybeAssign(e,t);if(i.type===a.comma){var g=i.startNodeAt(n,c);for(g.expressions=[d];i.eat(a.comma);)g.expressions.push(i.parseMaybeAssign(e,t));return i.finishNode(g,"SequenceExpression")}return d})},L.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,c=-1,d=-1,g=-1;t?(c=t.parenthesizedAssign,d=t.trailingComma,g=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new wt,n=!0);var v=this.start,y=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var N=this.parseMaybeConditional(e,t);if(i&&(N=i.call(this,N,v,y)),this.type.isAssign){var M=this.startNodeAt(v,y);return M.operator=this.value,this.type===a.eq&&(N=this.toAssignable(N,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=N.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(N):this.checkLValSimple(N),M.left=N,this.next(),M.right=this.parseMaybeAssign(e),g>-1&&(t.doubleProto=g),this.finishNode(M,"AssignmentExpression")}else n&&this.checkExpressionErrors(t,!0);return c>-1&&(t.parenthesizedAssign=c),d>-1&&(t.trailingComma=d),N},L.parseMaybeConditional=function(e,t){var i=this.start,n=this.startLoc,c=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return c;if(!(c.type==="ArrowFunctionExpression"&&c.start===i)&&this.eat(a.question)){var d=this.startNodeAt(i,n);return d.test=c,d.consequent=this.parseMaybeAssign(),this.expect(a.colon),d.alternate=this.parseMaybeAssign(e),this.finishNode(d,"ConditionalExpression")}return c},L.parseExprOps=function(e,t){var i=this.start,n=this.startLoc,c=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||c.start===i&&c.type==="ArrowFunctionExpression"?c:this.parseExprOp(c,i,n,-1,e)},L.parseExprOp=function(e,t,i,n,c){var d=this.type.binop;if(d!=null&&(!c||this.type!==a._in)&&d>n){var g=this.type===a.logicalOR||this.type===a.logicalAND,v=this.type===a.coalesce;v&&(d=a.logicalAND.binop);var y=this.value;this.next();var N=this.start,M=this.startLoc,K=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,c),N,M,d,c),he=this.buildBinary(t,i,e,K,y,g||v);return(g&&this.type===a.coalesce||v&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(he,t,i,n,c)}return e},L.buildBinary=function(e,t,i,n,c,d){n.type==="PrivateIdentifier"&&this.raise(n.start,"Private identifier can only be left side of binary expression");var g=this.startNodeAt(e,t);return g.left=i,g.operator=c,g.right=n,this.finishNode(g,d?"LogicalExpression":"BinaryExpression")},L.parseMaybeUnary=function(e,t,i,n){var c=this.start,d=this.startLoc,g;if(this.isContextual("await")&&this.canAwait)g=this.parseAwait(n),t=!0;else if(this.type.prefix){var v=this.startNode(),y=this.type===a.incDec;v.operator=this.value,v.prefix=!0,this.next(),v.argument=this.parseMaybeUnary(null,!0,y,n),this.checkExpressionErrors(e,!0),y?this.checkLValSimple(v.argument):this.strict&&v.operator==="delete"&&Ei(v.argument)?this.raiseRecoverable(v.start,"Deleting local variable in strict mode"):v.operator==="delete"&&Jt(v.argument)?this.raiseRecoverable(v.start,"Private fields can not be deleted"):t=!0,g=this.finishNode(v,y?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(n||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),g=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(g=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return g;for(;this.type.postfix&&!this.canInsertSemicolon();){var N=this.startNodeAt(c,d);N.operator=this.value,N.prefix=!1,N.argument=g,this.checkLValSimple(g),this.next(),g=this.finishNode(N,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(c,d,g,this.parseMaybeUnary(null,!1,!1,n),"**",!1);else return g};function Ei(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Ei(e.expression)}function Jt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Jt(e.expression)||e.type==="ParenthesizedExpression"&&Jt(e.expression)}L.parseExprSubscripts=function(e,t){var i=this.start,n=this.startLoc,c=this.parseExprAtom(e,t);if(c.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return c;var d=this.parseSubscripts(c,i,n,!1,t);return e&&d.type==="MemberExpression"&&(e.parenthesizedAssign>=d.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=d.start&&(e.parenthesizedBind=-1),e.trailingComma>=d.start&&(e.trailingComma=-1)),d},L.parseSubscripts=function(e,t,i,n,c){for(var d=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,g=!1;;){var v=this.parseSubscript(e,t,i,n,d,g,c);if(v.optional&&(g=!0),v===e||v.type==="ArrowFunctionExpression"){if(g){var y=this.startNodeAt(t,i);y.expression=v,v=this.finishNode(y,"ChainExpression")}return v}e=v}},L.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)},L.parseSubscriptAsyncArrow=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,n)},L.parseSubscript=function(e,t,i,n,c,d,g){var v=this.options.ecmaVersion>=11,y=v&&this.eat(a.questionDot);n&&y&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var N=this.eat(a.bracketL);if(N||y&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var M=this.startNodeAt(t,i);M.object=e,N?(M.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?M.property=this.parsePrivateIdent():M.property=this.parseIdent(this.options.allowReserved!=="never"),M.computed=!!N,v&&(M.optional=y),e=this.finishNode(M,"MemberExpression")}else if(!n&&this.eat(a.parenL)){var K=new wt,he=this.yieldPos,ut=this.awaitPos,Ye=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var _t=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,K);if(c&&!y&&this.shouldParseAsyncArrow())return this.checkPatternErrors(K,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=he,this.awaitPos=ut,this.awaitIdentPos=Ye,this.parseSubscriptAsyncArrow(t,i,_t,g);this.checkExpressionErrors(K,!0),this.yieldPos=he||this.yieldPos,this.awaitPos=ut||this.awaitPos,this.awaitIdentPos=Ye||this.awaitIdentPos;var Xe=this.startNodeAt(t,i);Xe.callee=e,Xe.arguments=_t,v&&(Xe.optional=y),e=this.finishNode(Xe,"CallExpression")}else if(this.type===a.backQuote){(y||d)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Ze=this.startNodeAt(t,i);Ze.tag=e,Ze.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(Ze,"TaggedTemplateExpression")}return e},L.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var n,c=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(n,"Super");case a._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case a.name:var d=this.start,g=this.startLoc,v=this.containsEsc,y=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!v&&y.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(J.f_expr),this.parseFunction(this.startNodeAt(d,g),0,!1,!0,t);if(c&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(d,g),[y],!1,t);if(this.options.ecmaVersion>=8&&y.name==="async"&&this.type===a.name&&!v&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return y=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(d,g),[y],!0,t)}return y;case a.regexp:var N=this.value;return n=this.parseLiteral(N.value),n.regex={pattern:N.pattern,flags:N.flags},n;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return n=this.startNode(),n.value=this.type===a._null?null:this.type===a._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case a.parenL:var M=this.start,K=this.parseParenAndDistinguishExpression(c,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(K)&&(e.parenthesizedAssign=M),e.parenthesizedBind<0&&(e.parenthesizedBind=M)),K;case a.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case a.braceL:return this.overrideContext(J.b_expr),this.parseObj(!1,e);case a._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},L.parseExprAtomDefault=function(){this.unexpected()},L.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()},L.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(a.parenR)?e.options=null:(this.expect(a.comma),this.afterTrailingComma(a.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(a.parenR)||(this.expect(a.comma),this.afterTrailingComma(a.parenR)||this.unexpected())));else if(!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},L.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")},L.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.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},L.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e},L.shouldParseArrow=function(e){return!this.canInsertSemicolon()},L.parseParenAndDistinguishExpression=function(e,t){var i=this.start,n=this.startLoc,c,d=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var g=this.start,v=this.startLoc,y=[],N=!0,M=!1,K=new wt,he=this.yieldPos,ut=this.awaitPos,Ye;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(N?N=!1:this.expect(a.comma),d&&this.afterTrailingComma(a.parenR,!0)){M=!0;break}else if(this.type===a.ellipsis){Ye=this.start,y.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else y.push(this.parseMaybeAssign(!1,K,this.parseParenItem));var _t=this.lastTokEnd,Xe=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(y)&&this.eat(a.arrow))return this.checkPatternErrors(K,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=he,this.awaitPos=ut,this.parseParenArrowList(i,n,y,t);(!y.length||M)&&this.unexpected(this.lastTokStart),Ye&&this.unexpected(Ye),this.checkExpressionErrors(K,!0),this.yieldPos=he||this.yieldPos,this.awaitPos=ut||this.awaitPos,y.length>1?(c=this.startNodeAt(g,v),c.expressions=y,this.finishNodeAt(c,"SequenceExpression",_t,Xe)):c=y[0]}else c=this.parseParenExpression();if(this.options.preserveParens){var Ze=this.startNodeAt(i,n);return Ze.expression=c,this.finishNode(Ze,"ParenthesizedExpression")}else return c},L.parseParenItem=function(e){return e},L.parseParenArrowList=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,n)};var nr=[];L.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===a.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=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'"),i&&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 n=this.start,c=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,c,!0,!1),e.callee.type==="Super"&&this.raiseRecoverable(n,"Invalid use of 'super'"),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=nr,this.finishNode(e,"NewExpression")},L.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
9
9
  `),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
10
- `),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")},L.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(i.quasis=[n];!n.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},L.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!b.test(this.input.slice(this.lastTokEnd,this.start))},L.parseObj=function(e,t){var i=this.startNode(),n=!0,o={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(n)n=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var d=this.parseProperty(e,t);e||this.checkPropClash(d,o,t),i.properties.push(d)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},L.parseProperty=function(e,t){var i=this.startNode(),n,o,d,g;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(d=this.start,g=this.startLoc),e||(n=this.eat(a.star)));var v=this.containsEsc;return this.parsePropertyName(i),!e&&!v&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(i)?(o=!0,n=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):o=!1,this.parsePropertyValue(i,e,n,o,d,g,t,v),this.finishNode(i,"Property")},L.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var i=e.kind==="get"?0:1;if(e.value.params.length!==i){var n=e.value.start;e.kind==="get"?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"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")},L.parsePropertyValue=function(e,t,i,n,o,d,g,v){(i||n)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,g),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(i,n),e.kind="init"):!t&&!v&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||n)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||n)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=o),t?e.value=this.parseMaybeDefault(o,d,this.copyNode(e.key)):this.type===a.eq&&g?(g.shorthandAssign<0&&(g.shorthandAssign=this.start),e.value=this.parseMaybeDefault(o,d,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()},L.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},L.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},L.parseMethod=function(e,t,i){var n=this.startNode(),o=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Je(t,n.generator)|me|(i?Ge:0)),this.expect(a.parenL),n.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=o,this.awaitPos=d,this.awaitIdentPos=g,this.finishNode(n,"FunctionExpression")},L.parseArrowExpression=function(e,t,i,n){var o=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;return this.enterScope(Je(i,!1)|We),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=o,this.awaitPos=d,this.awaitIdentPos=g,this.finishNode(e,"ArrowFunctionExpression")},L.parseFunctionBody=function(e,t,i,n){var o=t&&this.type!==a.braceL,d=this.strict,g=!1;if(o)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var v=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!d||v)&&(g=this.strictDirective(this.end),g&&v&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var y=this.labels;this.labels=[],g&&(this.strict=!0),this.checkParams(e,!d&&!g&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ci),e.body=this.parseBlock(!1,void 0,g&&!d),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=y}this.exitScope()},L.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var n=i[t];if(n.type!=="Identifier")return!1}return!0},L.checkParams=function(e,t){for(var i=Object.create(null),n=0,o=e.params;n<o.length;n+=1){var d=o[n];this.checkLValInnerPattern(d,Ht,t?null:i)}},L.parseExprList=function(e,t,i,n){for(var o=[],d=!0;!this.eat(e);){if(d)d=!1;else if(this.expect(a.comma),t&&this.afterTrailingComma(e))break;var g=void 0;i&&this.type===a.comma?g=null:this.type===a.ellipsis?(g=this.parseSpread(n),n&&this.type===a.comma&&n.trailingComma<0&&(n.trailingComma=this.start)):g=this.parseMaybeAssign(!1,n),o.push(g)}return o},L.checkUnreserved=function(e){var t=e.start,i=e.end,n=e.name;if(this.inGenerator&&n==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&n==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&re)&&n==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(n==="arguments"||n==="await")&&this.raise(t,"Cannot use "+n+" in class static initialization block"),this.keywords.test(n)&&this.raise(t,"Unexpected keyword '"+n+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var o=this.strict?this.reservedWordsStrict:this.reservedWords;o.test(n)&&(!this.inAsync&&n==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+n+"' is reserved"))}},L.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},L.parseIdentNode=function(){var e=this.startNode();return this.type===a.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=a.name):this.unexpected(),e},L.parsePrivateIdent=function(){var e=this.startNode();return this.type===a.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},L.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===a.semi||this.canInsertSemicolon()||this.type!==a.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(a.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},L.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var bt=Z.prototype;bt.raise=function(e,t){var i=_e(this.input,e);t+=" ("+i.line+":"+i.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var n=new SyntaxError(t);throw n.pos=e,n.loc=i,n.raisedAt=this.pos,n},bt.raiseRecoverable=bt.raise,bt.curPosition=function(){if(this.options.locations)return new Y(this.curLine,this.pos-this.lineStart)};var Me=Z.prototype,is=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};Me.enterScope=function(e){this.scopeStack.push(new is(e))},Me.exitScope=function(){this.scopeStack.pop()},Me.treatFunctionsAsVarInScope=function(e){return e.flags&q||!this.inModule&&e.flags&H},Me.declareName=function(e,t,i){var n=!1;if(t===Oe){var o=this.currentScope();n=o.lexical.indexOf(e)>-1||o.functions.indexOf(e)>-1||o.var.indexOf(e)>-1,o.lexical.push(e),this.inModule&&o.flags&H&&delete this.undefinedExports[e]}else if(t===ki){var d=this.currentScope();d.lexical.push(e)}else if(t===Si){var g=this.currentScope();this.treatFunctionsAsVar?n=g.lexical.indexOf(e)>-1:n=g.lexical.indexOf(e)>-1||g.var.indexOf(e)>-1,g.functions.push(e)}else for(var v=this.scopeStack.length-1;v>=0;--v){var y=this.scopeStack[v];if(y.lexical.indexOf(e)>-1&&!(y.flags&ze&&y.lexical[0]===e)||!this.treatFunctionsAsVarInScope(y)&&y.functions.indexOf(e)>-1){n=!0;break}if(y.var.push(e),this.inModule&&y.flags&H&&delete this.undefinedExports[e],y.flags&re)break}n&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Me.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Me.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Me.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(re|Le|ie))return t}},Me.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(re|Le|ie)&&!(t.flags&We))return t}};var at=function(t,i,n){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new xe(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ot=Z.prototype;ot.startNode=function(){return new at(this,this.start,this.startLoc)},ot.startNodeAt=function(e,t){return new at(this,e,t)};function _i(e,t,i,n){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=i),e}ot.finishNode=function(e,t){return _i.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ot.finishNodeAt=function(e,t,i,n){return _i.call(this,e,t,i,n)},ot.copyNode=function(e){var t=new at(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var rs="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",Ei="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",Pi=Ei+" Extended_Pictographic",Ri=Pi,Ni=Ri+" EBase EComp EMod EPres ExtPict",Ti=Ni,ss=Ti,ns={9:Ei,10:Pi,11:Ri,12:Ni,13:Ti,14:ss},as="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",os={9:"",10:"",11:"",12:"",13:"",14:as},Li="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",Oi="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",ji=Oi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Vi=ji+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Fi=Vi+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Di=Fi+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",cs=Di+" "+rs,us={9:Oi,10:ji,11:Vi,12:Fi,13:Di,14:cs},Mi={};function ls(e){var t=Mi[e]={binary:he(ns[e]+" "+Li),binaryOfStrings:he(os[e]),nonBinary:{General_Category:he(Li),Script:he(us[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 Kt=0,Bi=[9,10,11,12,13,14];Kt<Bi.length;Kt+=1){var hs=Bi[Kt];ls(hs)}var k=Z.prototype,wt=function(t,i){this.parent=t,this.base=i||this};wt.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var n=t;n;n=n.parent)if(i.base===n.base&&i!==n)return!0;return!1},wt.prototype.sibling=function(){return new wt(this.parent,this.base)};var Ee=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Mi[t.options.ecmaVersion>=14?14:t.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};Ee.prototype.reset=function(t,i,n){var o=n.indexOf("v")!==-1,d=n.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=n,o&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=d&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=d&&this.parser.options.ecmaVersion>=9)},Ee.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Ee.prototype.at=function(t,i){i===void 0&&(i=!1);var n=this.source,o=n.length;if(t>=o)return-1;var d=n.charCodeAt(t);if(!(i||this.switchU)||d<=55295||d>=57344||t+1>=o)return d;var g=n.charCodeAt(t+1);return g>=56320&&g<=57343?(d<<10)+g-56613888:d},Ee.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var n=this.source,o=n.length;if(t>=o)return o;var d=n.charCodeAt(t),g;return!(i||this.switchU)||d<=55295||d>=57344||t+1>=o||(g=n.charCodeAt(t+1))<56320||g>57343?t+1:t+2},Ee.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},Ee.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Ee.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Ee.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},Ee.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var n=this.pos,o=0,d=t;o<d.length;o+=1){var g=d[o],v=this.at(n,i);if(v===-1||v!==g)return!1;n=this.nextIndex(n,i)}return this.pos=n,!0},k.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,n=!1,o=!1,d=0;d<i.length;d++){var g=i.charAt(d);t.indexOf(g)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(g,d+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),g==="u"&&(n=!0),g==="v"&&(o=!0)}this.options.ecmaVersion>=15&&n&&o&&this.raise(e.start,"Invalid regular expression flag")};function ps(e){for(var t in e)return!0;return!1}k.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&ps(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,i=e.backReferenceNames;t<i.length;t+=1){var n=i[t];e.groupNames[n]||e.raise("Invalid named capture referenced")}},k.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new wt(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 i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!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 i=e.pos;if(e.eat(123)){var n=0,o=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(o=e.lastIntValue),e.eat(125)))return o!==-1&&o<n&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}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 i=this.regexp_eatModifiers(e),n=e.eat(45);if(i||n){for(var o=0;o<i.length;o++){var d=i.charAt(o);i.indexOf(d,o+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(n){var g=this.regexp_eatModifiers(e);!i&&!g&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var v=0;v<g.length;v++){var y=g.charAt(v);(g.indexOf(y,v+1)>-1||i.indexOf(y)>-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="",i=0;(i=e.current())!==-1&&fs(i);)t+=S(i),e.advance();return t};function fs(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 $i(t)?(e.lastIntValue=t,e.advance(),!0):!1};function $i(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,i=0;(i=e.current())!==-1&&!$i(i);)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,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var n=0,o=i;n<o.length;n+=1){var d=o[n];d.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(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+=S(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=S(e.lastIntValue);return!0}return!1},k.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),ds(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function ds(e){return A(e,!0)||e===36||e===95}k.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),ms(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function ms(e){return B(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 i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=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&&!St(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 Ui(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ui(e){return e>=65&&e<=90||e>=97&&e<=122}k.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(n&&o>=55296&&o<=56319){var d=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var g=e.lastIntValue;if(g>=56320&&g<=57343)return e.lastIntValue=(o-55296)*1024+(g-56320)+65536,!0}e.pos=d,e.lastIntValue=o}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&gs(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function gs(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 qi=0,je=1,Ce=2;k.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(vs(t))return e.lastIntValue=-1,e.advance(),je;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var n;if(e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&n===Ce&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return qi};function vs(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 i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,n),je}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var o=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,o)}return qi},k.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){ae(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},k.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return je;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Ce;e.raise("Invalid property name")},k.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Wi(t=e.current());)e.lastStringValue+=S(t),e.advance();return e.lastStringValue!==""};function Wi(e){return Ui(e)||e===95}k.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";xs(t=e.current());)e.lastStringValue+=S(t),e.advance();return e.lastStringValue!==""};function xs(e){return Wi(e)||St(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),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===Ce&&e.raise("Negated character class may contain strings"),!0}return!1},k.regexp_classContents=function(e){return e.current()===93?je:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),je)},k.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&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 i=e.current();(i===99||Gi(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return n!==93?(e.lastIntValue=n,e.advance(),!0):!1},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=je,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===Ce&&(t=Ce);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==Ce&&(t=je);continue}e.raise("Invalid character in character class")}if(n!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===Ce&&(t=Ce)}},k.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return i!==-1&&n!==-1&&i>n&&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)?je:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},k.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return i&&n===Ce&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var o=this.regexp_eatCharacterClassEscape(e);if(o)return o;e.pos=t}return null},k.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}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)===Ce&&(t=Ce);return t},k.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?je:Ce},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 i=e.current();return i<0||i===e.lookahead()&&ys(i)||bs(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function ys(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 bs(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 ws(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ws(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 St(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,i=0;for(e.lastIntValue=0;St(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function St(e){return e>=48&&e<=57}k.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Hi(i=e.current());)e.lastIntValue=16*e.lastIntValue+zi(i),e.advance();return e.pos!==t};function Hi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function zi(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 i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1},k.regexp_eatOctalDigit=function(e){var t=e.current();return Gi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Gi(e){return e>=48&&e<=55}k.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var n=0;n<t;++n){var o=e.current();if(!Hi(o))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+zi(o),e.advance()}return!0};var kt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new xe(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},$=Z.prototype;$.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 kt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},$.getToken=function(){return this.next(),new kt(this)},typeof Symbol<"u"&&($[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===a.eof,value:t}}}}),$.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(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},$.readToken=function(e){return A(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},$.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var i=this.input.charCodeAt(e+1);return i<=56319||i>=57344?t:(t<<10)+i-56613888},$.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},$.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var n=void 0,o=t;(n=z(this.input,o,this.pos))>-1;)++this.curLine,o=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},$.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!V(n);)n=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},$.skipSpace=function(){e: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 e}break;default:if(e>8&&e<14||e>=5760&&X.test(String.fromCharCode(e)))++this.pos;else break e}}},$.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},$.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(a.ellipsis)):(++this.pos,this.finishToken(a.dot))},$.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)},$.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,n=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,n=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(n,i)},$.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)},$.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)},$.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||b.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)},$.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):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&&(i=2),this.finishOp(a.relational,i))},$.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)},$.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)},$.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),A(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+S(t)+"'")},$.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.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(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+S(e)+"'")},$.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},$.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(b.test(n)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(n==="[")t=!0;else if(n==="]"&&t)t=!1;else if(n==="/"&&!t)break;e=n==="\\"}++this.pos}var o=this.input.slice(i,this.pos);++this.pos;var d=this.pos,g=this.readWord1();this.containsEsc&&this.unexpected(d);var v=this.regexpState||(this.regexpState=new Ee(this));v.reset(i,o,g),this.validateRegExpFlags(v),this.validateRegExpPattern(v);var y=null;try{y=new RegExp(o,g)}catch{}return this.finishToken(a.regexp,{pattern:o,flags:g,value:y})},$.readInt=function(e,t,i){for(var n=this.options.ecmaVersion>=12&&t===void 0,o=i&&this.input.charCodeAt(this.pos)===48,d=this.pos,g=0,v=0,y=0,N=t??1/0;y<N;++y,++this.pos){var M=this.input.charCodeAt(this.pos),Q=void 0;if(n&&M===95){o&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),v===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),y===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),v=M;continue}if(M>=97?Q=M-97+10:M>=65?Q=M-65+10:M>=48&&M<=57?Q=M-48:Q=1/0,Q>=e)break;v=M,g=g*e+Q}return n&&v===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===d||t!=null&&this.pos-d!==t?null:g};function Ss(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ji(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}$.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Ji(this.input.slice(t,this.pos)),++this.pos):A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)},$.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&n===110){var o=Ji(this.input.slice(t,this.pos));return++this.pos,A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,o)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),n===46&&!i&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(n===69||n===101)&&!i&&(n=this.input.charCodeAt(++this.pos),(n===43||n===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var d=Ss(this.input.slice(t,this.pos),i);return this.finishToken(a.num,d)},$.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t},$.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;n===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):n===8232||n===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(V(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var Ki={};$.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ki)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},$.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ki;this.raise(e,t)},$.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(V(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
11
- `;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},$.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(a.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
10
+ `),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")},L.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(i.quasis=[n];!n.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},L.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!b.test(this.input.slice(this.lastTokEnd,this.start))},L.parseObj=function(e,t){var i=this.startNode(),n=!0,c={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(n)n=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var d=this.parseProperty(e,t);e||this.checkPropClash(d,c,t),i.properties.push(d)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},L.parseProperty=function(e,t){var i=this.startNode(),n,c,d,g;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(d=this.start,g=this.startLoc),e||(n=this.eat(a.star)));var v=this.containsEsc;return this.parsePropertyName(i),!e&&!v&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(i)?(c=!0,n=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):c=!1,this.parsePropertyValue(i,e,n,c,d,g,t,v),this.finishNode(i,"Property")},L.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var i=e.kind==="get"?0:1;if(e.value.params.length!==i){var n=e.value.start;e.kind==="get"?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"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")},L.parsePropertyValue=function(e,t,i,n,c,d,g,v){(i||n)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,g),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(i,n),e.kind="init"):!t&&!v&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||n)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||n)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=c),t?e.value=this.parseMaybeDefault(c,d,this.copyNode(e.key)):this.type===a.eq&&g?(g.shorthandAssign<0&&(g.shorthandAssign=this.start),e.value=this.parseMaybeDefault(c,d,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()},L.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},L.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},L.parseMethod=function(e,t,i){var n=this.startNode(),c=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ne(t,n.generator)|$e|(i?Je:0)),this.expect(a.parenL),n.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=c,this.awaitPos=d,this.awaitIdentPos=g,this.finishNode(n,"FunctionExpression")},L.parseArrowExpression=function(e,t,i,n){var c=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;return this.enterScope(ne(i,!1)|be),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=c,this.awaitPos=d,this.awaitIdentPos=g,this.finishNode(e,"ArrowFunctionExpression")},L.parseFunctionBody=function(e,t,i,n){var c=t&&this.type!==a.braceL,d=this.strict,g=!1;if(c)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var v=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!d||v)&&(g=this.strictDirective(this.end),g&&v&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var y=this.labels;this.labels=[],g&&(this.strict=!0),this.checkParams(e,!d&&!g&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ai),e.body=this.parseBlock(!1,void 0,g&&!d),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=y}this.exitScope()},L.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var n=i[t];if(n.type!=="Identifier")return!1}return!0},L.checkParams=function(e,t){for(var i=Object.create(null),n=0,c=e.params;n<c.length;n+=1){var d=c[n];this.checkLValInnerPattern(d,Ke,t?null:i)}},L.parseExprList=function(e,t,i,n){for(var c=[],d=!0;!this.eat(e);){if(d)d=!1;else if(this.expect(a.comma),t&&this.afterTrailingComma(e))break;var g=void 0;i&&this.type===a.comma?g=null:this.type===a.ellipsis?(g=this.parseSpread(n),n&&this.type===a.comma&&n.trailingComma<0&&(n.trailingComma=this.start)):g=this.parseMaybeAssign(!1,n),c.push(g)}return c},L.checkUnreserved=function(e){var t=e.start,i=e.end,n=e.name;if(this.inGenerator&&n==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&n==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Ue)&&n==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(n==="arguments"||n==="await")&&this.raise(t,"Cannot use "+n+" in class static initialization block"),this.keywords.test(n)&&this.raise(t,"Unexpected keyword '"+n+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var c=this.strict?this.reservedWordsStrict:this.reservedWords;c.test(n)&&(!this.inAsync&&n==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+n+"' is reserved"))}},L.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},L.parseIdentNode=function(){var e=this.startNode();return this.type===a.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=a.name):this.unexpected(),e},L.parsePrivateIdent=function(){var e=this.startNode();return this.type===a.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},L.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===a.semi||this.canInsertSemicolon()||this.type!==a.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(a.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},L.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var kt=X.prototype;kt.raise=function(e,t){var i=te(this.input,e);t+=" ("+i.line+":"+i.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var n=new SyntaxError(t);throw n.pos=e,n.loc=i,n.raisedAt=this.pos,n},kt.raiseRecoverable=kt.raise,kt.curPosition=function(){if(this.options.locations)return new S(this.curLine,this.pos-this.lineStart)};var qe=X.prototype,ar=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};qe.enterScope=function(e){this.scopeStack.push(new ar(e))},qe.exitScope=function(){this.scopeStack.pop()},qe.treatFunctionsAsVarInScope=function(e){return e.flags&Q||!this.inModule&&e.flags&fe},qe.declareName=function(e,t,i){var n=!1;if(t===Pe){var c=this.currentScope();n=c.lexical.indexOf(e)>-1||c.functions.indexOf(e)>-1||c.var.indexOf(e)>-1,c.lexical.push(e),this.inModule&&c.flags&fe&&delete this.undefinedExports[e]}else if(t===Ii){var d=this.currentScope();d.lexical.push(e)}else if(t===Ci){var g=this.currentScope();this.treatFunctionsAsVar?n=g.lexical.indexOf(e)>-1:n=g.lexical.indexOf(e)>-1||g.var.indexOf(e)>-1,g.functions.push(e)}else for(var v=this.scopeStack.length-1;v>=0;--v){var y=this.scopeStack[v];if(y.lexical.indexOf(e)>-1&&!(y.flags&Ee&&y.lexical[0]===e)||!this.treatFunctionsAsVarInScope(y)&&y.functions.indexOf(e)>-1){n=!0;break}if(y.var.push(e),this.inModule&&y.flags&fe&&delete this.undefinedExports[e],y.flags&Ue)break}n&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},qe.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},qe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},qe.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ue|je|oe))return t}},qe.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ue|je|oe)&&!(t.flags&be))return t}};var ot=function(t,i,n){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new $(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ct=X.prototype;ct.startNode=function(){return new ot(this,this.start,this.startLoc)},ct.startNodeAt=function(e,t){return new ot(this,e,t)};function Pi(e,t,i,n){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=i),e}ct.finishNode=function(e,t){return Pi.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ct.finishNodeAt=function(e,t,i,n){return Pi.call(this,e,t,i,n)},ct.copyNode=function(e){var t=new ot(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var or="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",Ri="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",Ni=Ri+" Extended_Pictographic",Ti=Ni,Li=Ti+" EBase EComp EMod EPres ExtPict",Oi=Li,cr=Oi,ur={9:Ri,10:Ni,11:Ti,12:Li,13:Oi,14:cr},lr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",hr={9:"",10:"",11:"",12:"",13:"",14:lr},ji="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",Vi="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",Di=Vi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Fi=Di+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Mi=Fi+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Bi=Mi+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",pr=Bi+" "+or,fr={9:Vi,10:Di,11:Fi,12:Mi,13:Bi,14:pr},$i={};function dr(e){var t=$i[e]={binary:Re(ur[e]+" "+ji),binaryOfStrings:Re(hr[e]),nonBinary:{General_Category:Re(ji),Script:Re(fr[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 Kt=0,Ui=[9,10,11,12,13,14];Kt<Ui.length;Kt+=1){var mr=Ui[Kt];dr(mr)}var k=X.prototype,Ct=function(t,i){this.parent=t,this.base=i||this};Ct.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var n=t;n;n=n.parent)if(i.base===n.base&&i!==n)return!0;return!1},Ct.prototype.sibling=function(){return new Ct(this.parent,this.base)};var Ne=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=$i[t.options.ecmaVersion>=14?14:t.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};Ne.prototype.reset=function(t,i,n){var c=n.indexOf("v")!==-1,d=n.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=n,c&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=d&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=d&&this.parser.options.ecmaVersion>=9)},Ne.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Ne.prototype.at=function(t,i){i===void 0&&(i=!1);var n=this.source,c=n.length;if(t>=c)return-1;var d=n.charCodeAt(t);if(!(i||this.switchU)||d<=55295||d>=57344||t+1>=c)return d;var g=n.charCodeAt(t+1);return g>=56320&&g<=57343?(d<<10)+g-56613888:d},Ne.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var n=this.source,c=n.length;if(t>=c)return c;var d=n.charCodeAt(t),g;return!(i||this.switchU)||d<=55295||d>=57344||t+1>=c||(g=n.charCodeAt(t+1))<56320||g>57343?t+1:t+2},Ne.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},Ne.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Ne.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Ne.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},Ne.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var n=this.pos,c=0,d=t;c<d.length;c+=1){var g=d[c],v=this.at(n,i);if(v===-1||v!==g)return!1;n=this.nextIndex(n,i)}return this.pos=n,!0},k.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,n=!1,c=!1,d=0;d<i.length;d++){var g=i.charAt(d);t.indexOf(g)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(g,d+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),g==="u"&&(n=!0),g==="v"&&(c=!0)}this.options.ecmaVersion>=15&&n&&c&&this.raise(e.start,"Invalid regular expression flag")};function gr(e){for(var t in e)return!0;return!1}k.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&gr(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,i=e.backReferenceNames;t<i.length;t+=1){var n=i[t];e.groupNames[n]||e.raise("Invalid named capture referenced")}},k.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ct(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 i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!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 i=e.pos;if(e.eat(123)){var n=0,c=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(c=e.lastIntValue),e.eat(125)))return c!==-1&&c<n&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}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 i=this.regexp_eatModifiers(e),n=e.eat(45);if(i||n){for(var c=0;c<i.length;c++){var d=i.charAt(c);i.indexOf(d,c+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(n){var g=this.regexp_eatModifiers(e);!i&&!g&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var v=0;v<g.length;v++){var y=g.charAt(v);(g.indexOf(y,v+1)>-1||i.indexOf(y)>-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="",i=0;(i=e.current())!==-1&&vr(i);)t+=ce(i),e.advance();return t};function vr(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 qi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function qi(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,i=0;(i=e.current())!==-1&&!qi(i);)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,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var n=0,c=i;n<c.length;n+=1){var d=c[n];d.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(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+=ce(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ce(e.lastIntValue);return!0}return!1},k.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),xr(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function xr(e){return A(e,!0)||e===36||e===95}k.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),yr(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function yr(e){return B(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 i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=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&&!It(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 Wi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Wi(e){return e>=65&&e<=90||e>=97&&e<=122}k.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var c=e.lastIntValue;if(n&&c>=55296&&c<=56319){var d=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var g=e.lastIntValue;if(g>=56320&&g<=57343)return e.lastIntValue=(c-55296)*1024+(g-56320)+65536,!0}e.pos=d,e.lastIntValue=c}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&br(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function br(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 Hi=0,Ve=1,Ae=2;k.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(wr(t))return e.lastIntValue=-1,e.advance(),Ve;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var n;if(e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&n===Ae&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return Hi};function wr(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 i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,n),Ve}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var c=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,c)}return Hi},k.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){se(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},k.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ve;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Ae;e.raise("Invalid property name")},k.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";zi(t=e.current());)e.lastStringValue+=ce(t),e.advance();return e.lastStringValue!==""};function zi(e){return Wi(e)||e===95}k.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Sr(t=e.current());)e.lastStringValue+=ce(t),e.advance();return e.lastStringValue!==""};function Sr(e){return zi(e)||It(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),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===Ae&&e.raise("Negated character class may contain strings"),!0}return!1},k.regexp_classContents=function(e){return e.current()===93?Ve:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ve)},k.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&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 i=e.current();(i===99||Ki(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return n!==93?(e.lastIntValue=n,e.advance(),!0):!1},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=Ve,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===Ae&&(t=Ae);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==Ae&&(t=Ve);continue}e.raise("Invalid character in character class")}if(n!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===Ae&&(t=Ae)}},k.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return i!==-1&&n!==-1&&i>n&&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)?Ve:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},k.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return i&&n===Ae&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var c=this.regexp_eatCharacterClassEscape(e);if(c)return c;e.pos=t}return null},k.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}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)===Ae&&(t=Ae);return t},k.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ve:Ae},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 i=e.current();return i<0||i===e.lookahead()&&kr(i)||Cr(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function kr(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 Cr(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 Ir(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Ir(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 It(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,i=0;for(e.lastIntValue=0;It(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function It(e){return e>=48&&e<=57}k.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Gi(i=e.current());)e.lastIntValue=16*e.lastIntValue+Ji(i),e.advance();return e.pos!==t};function Gi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ji(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 i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1},k.regexp_eatOctalDigit=function(e){var t=e.current();return Ki(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Ki(e){return e>=48&&e<=55}k.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var n=0;n<t;++n){var c=e.current();if(!Gi(c))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Ji(c),e.advance()}return!0};var At=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new $(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},U=X.prototype;U.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 At(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},U.getToken=function(){return this.next(),new At(this)},typeof Symbol<"u"&&(U[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===a.eof,value:t}}}}),U.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(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},U.readToken=function(e){return A(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},U.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var i=this.input.charCodeAt(e+1);return i<=56319||i>=57344?t:(t<<10)+i-56613888},U.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},U.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var n=void 0,c=t;(n=W(this.input,c,this.pos))>-1;)++this.curLine,c=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},U.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!V(n);)n=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},U.skipSpace=function(){e: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 e}break;default:if(e>8&&e<14||e>=5760&&Y.test(String.fromCharCode(e)))++this.pos;else break e}}},U.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},U.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(a.ellipsis)):(++this.pos,this.finishToken(a.dot))},U.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)},U.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,n=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,n=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(n,i)},U.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)},U.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)},U.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||b.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)},U.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):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&&(i=2),this.finishOp(a.relational,i))},U.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)},U.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)},U.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),A(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+ce(t)+"'")},U.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.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(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ce(e)+"'")},U.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},U.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(b.test(n)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(n==="[")t=!0;else if(n==="]"&&t)t=!1;else if(n==="/"&&!t)break;e=n==="\\"}++this.pos}var c=this.input.slice(i,this.pos);++this.pos;var d=this.pos,g=this.readWord1();this.containsEsc&&this.unexpected(d);var v=this.regexpState||(this.regexpState=new Ne(this));v.reset(i,c,g),this.validateRegExpFlags(v),this.validateRegExpPattern(v);var y=null;try{y=new RegExp(c,g)}catch{}return this.finishToken(a.regexp,{pattern:c,flags:g,value:y})},U.readInt=function(e,t,i){for(var n=this.options.ecmaVersion>=12&&t===void 0,c=i&&this.input.charCodeAt(this.pos)===48,d=this.pos,g=0,v=0,y=0,N=t??1/0;y<N;++y,++this.pos){var M=this.input.charCodeAt(this.pos),K=void 0;if(n&&M===95){c&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),v===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),y===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),v=M;continue}if(M>=97?K=M-97+10:M>=65?K=M-65+10:M>=48&&M<=57?K=M-48:K=1/0,K>=e)break;v=M,g=g*e+K}return n&&v===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===d||t!=null&&this.pos-d!==t?null:g};function Ar(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Qi(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}U.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Qi(this.input.slice(t,this.pos)),++this.pos):A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)},U.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&n===110){var c=Qi(this.input.slice(t,this.pos));return++this.pos,A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,c)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),n===46&&!i&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(n===69||n===101)&&!i&&(n=this.input.charCodeAt(++this.pos),(n===43||n===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var d=Ar(this.input.slice(t,this.pos),i);return this.finishToken(a.num,d)},U.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t},U.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;n===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):n===8232||n===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(V(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var Yi={};U.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Yi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},U.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Yi;this.raise(e,t)},U.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(V(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
11
+ `;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},U.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(a.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
12
12
  `&&++this.pos;case`
13
- `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},$.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
14
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return S(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 i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],o=parseInt(n,8);return o>255&&(n=n.slice(0,-1),o=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),(n!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(o)}return V(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},$.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i},$.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,n=this.options.ecmaVersion>=6;this.pos<this.input.length;){var o=this.fullCharCodeAtPos();if(B(o,n))this.pos+=o<=65535?1:2;else if(o===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var g=this.readCodePoint();(t?A:B)(g,n)||this.invalidStringToken(d,"Invalid Unicode escape"),e+=S(g),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)},$.readWord=function(){var e=this.readWord1(),t=a.name;return this.keywords.test(e)&&(t=ne[e]),this.finishToken(t,e)};var Qi="8.17.0";Z.acorn={Parser:Z,version:Qi,defaultOptions:te,Position:Y,SourceLocation:xe,getLineInfo:_e,Node:at,TokenType:_,tokTypes:a,keywordTypes:ne,TokContext:ke,tokContexts:K,isIdentifierChar:B,isIdentifierStart:A,Token:kt,isNewLine:V,lineBreak:b,lineBreakG:j,nonASCIIwhitespace:X};function ks(e,t){return Z.parse(e,t)}function Cs(e,t,i){return Z.parseExpressionAt(e,t,i)}function Is(e,t){return Z.tokenizer(e,t)}r.Node=at,r.Parser=Z,r.Position=Y,r.SourceLocation=xe,r.TokContext=ke,r.Token=kt,r.TokenType=_,r.defaultOptions=te,r.getLineInfo=_e,r.isIdentifierChar=B,r.isIdentifierStart=A,r.isNewLine=V,r.keywordTypes=ne,r.lineBreak=b,r.lineBreakG=j,r.nonASCIIwhitespace=X,r.parse=ks,r.parseExpressionAt=Cs,r.tokContexts=K,r.tokTypes=a,r.tokenizer=Is,r.version=Qi})});var Er=Ie((pa,_r)=>{var{parse:ln}=Cr();function it(){let r=new Error("Configuration reads require a data-only object export. Remove executable statements from frontfriend.config.js.");return r.code="FRONTFRIEND_CONFIG_VALIDATION",r}function Ar(r){if(r.type!=="Property"||r.computed||r.method||r.kind!=="init")throw it();let s=r.key.type==="Identifier"?r.key.name:r.key.value;if(typeof s!="string"||["__proto__","constructor","prototype"].includes(s))throw it();return s}function Ir(r){if(r.type==="ExportDefaultDeclaration")return r.declaration;let s=r.type==="ExpressionStatement"?r.expression:null;return s?.type==="AssignmentExpression"&&s.operator==="="&&s.left.type==="MemberExpression"&&!s.left.computed&&s.left.object.name==="module"&&s.left.property.name==="exports"?s.right:null}function hn(r,s){if(r.type!=="VariableDeclaration"||r.declarations.length!==1)return null;let[c]=r.declarations;return c.id.type!=="Identifier"||s?.type!=="Identifier"||s.name!==c.id.name?null:c.init}function pn(r){let c=ln(r,{ecmaVersion:"latest",sourceType:"module"}).body.filter(p=>p.type!=="EmptyStatement"&&!p.directive),u=c.length===1?Ir(c[0]):c.length===2?hn(c[0],Ir(c[1])):null;if(u?.type!=="ObjectExpression")throw it();function l(p,h=0){if(h>64)throw it();if(p.type==="Literal"&&(p.value===null||["string","number","boolean"].includes(typeof p.value)))return p.value;if(p.type==="ArrayExpression")return p.elements.map(f=>{if(!f)throw it();return l(f,h+1)});if(p.type==="ObjectExpression")return Object.fromEntries(p.properties.map(f=>[Ar(f),l(f.value,h+1)]));if(p.type==="UnaryExpression"&&["-","+"].includes(p.operator)&&p.argument.type==="Literal"&&typeof p.argument.value=="number")return p.operator==="-"?-p.argument.value:p.argument.value;if(p.type==="TemplateLiteral"&&p.expressions.length===0)return p.quasis[0].value.cooked;if(p.type==="MemberExpression"&&!p.computed&&p.object.type==="MemberExpression"&&!p.object.computed&&p.object.object.name==="process"&&p.object.property.name==="env")return process.env[p.property.name];if(p.type==="LogicalExpression"&&["||","??"].includes(p.operator)){let f=l(p.left,h+1);return p.operator==="||"?f||l(p.right,h+1):f??l(p.right,h+1)}throw it()}return{config:l(u),expression:u}}_r.exports={parseStaticConfig:pn,propertyName:Ar}});var Rr=Ie((fa,Pr)=>{var ee=require("fs");function fn(r){try{let s=ee.readFileSync(r,"utf8");return JSON.parse(s)}catch(s){if(s.code==="ENOENT")return null;throw s}}function dn(r){try{return ee.readFileSync(r,"utf8").replace(/^\uFEFF/,"")}catch(s){if(s.code==="ENOENT")return null;throw s}}function mn(r,s,c=2){let u=JSON.stringify(s,null,c);ee.writeFileSync(r,u,"utf8")}function gn(r,s){ee.writeFileSync(r,s,"utf8")}function vn(r,s){if(s==null||typeof s=="object"&&Object.keys(s).length===0||Array.isArray(s)&&s.length===0){let u=`module.exports = ${Array.isArray(s)?"[]":"{}"};`;ee.writeFileSync(r,u,"utf8")}else{let c=`module.exports = ${JSON.stringify(s,null,2)};`;ee.writeFileSync(r,c,"utf8")}}function xn(r){return ee.existsSync(r)}function yn(r){ee.mkdirSync(r,{recursive:!0})}function bn(r){ee.rmSync(r,{recursive:!0,force:!0})}function wn(r){ee.rmSync(r,{force:!0})}function Sn(r,s){ee.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let c=`${r}.${process.pid}.${Date.now()}.tmp`;try{ee.writeFileSync(c,`${JSON.stringify(s,null,2)}
15
- `,{mode:384}),ee.renameSync(c,r);try{ee.chmodSync(r,384)}catch{}}finally{ee.rmSync(c,{force:!0})}}async function kn(r,s,c){ee.mkdirSync(require("path").dirname(r),{recursive:!0,mode:448});let u=`${r}.lock`,l=Date.now()+2e4,p;for(;p===void 0;)try{p=ee.openSync(u,"wx",384),ee.writeFileSync(p,String(process.pid))}catch(h){if(h.code!=="EEXIST")throw h;try{let f=Number(ee.readFileSync(u,"utf8"));if(Number.isInteger(f)&&f>0)try{process.kill(f,0)}catch(m){if(m.code==="ESRCH"){ee.unlinkSync(u);continue}}}catch(f){if(f.code==="ENOENT")continue}if(Date.now()>=l)throw c();await new Promise(f=>setTimeout(f,50))}try{return await s()}finally{ee.closeSync(p),ee.unlinkSync(u)}}Pr.exports={writePrivateJsonFileAtomic:Sn,withPrivateFileLock:kn,readJsonFileSafe:fn,readFileSafe:dn,writeJsonFile:mn,writeTextFile:gn,writeModuleExportsFile:vn,fileExists:xn,ensureDirectoryExists:yn,removeDirectory:bn,removeFile:wn}});var jr=Ie((da,Or)=>{var{parseStaticConfig:li,propertyName:Vt}=Er(),{fileExists:Nr,readFileSafe:hi,writeTextFile:pi,readJsonFileSafe:Cn}=Rr(),rt=require("path"),{normalizeAdopt:Tr}=ui(),{parseProjectTarget:In}=(At(),ut(tr));function Lr(r){try{return Cn(r)??{}}catch{return{}}}function An(r){return Lr(rt.join(r,"package.json")).name||rt.basename(r)}function _n(r={}){let s={...r};return delete s.ffId,delete s.appRoot,delete s.adoptExplicit,delete s["auth-token"],delete s.authToken,s}function En(r,s,{ffId:c,name:u,adopt:l,framework:p,primitive:h,apiUrl:f,baseLibrary:m,tag:x}){let w=In({framework:p,primitive:h},"Setup Project target"),I=_n(s),A={name:u.trim(),"ff-id":c.trim(),adopt:Tr(l),framework:w.framework,primitive:w.primitive};if(x!==void 0){if(typeof x!="string"||!x.trim())throw new Error("Release tag must not be empty.");A.tag=x.trim()}if(m!==void 0){if(!["frontfriend","shadcn"].includes(m))throw new Error("Base library must be frontfriend or shadcn.");A.baseLibrary=m}f&&(A["api-url"]=String(f).replace(/\/+$/,""),delete I.apiUrl);for(let[T,R]of Object.entries(I))T in A||(A[T]=R);let B=rt.join(r,"frontfriend.config.js"),_;if(Nr(B)){let T=hi(B),{expression:R}=li(T),E=new Set(["name","ff-id","adopt","framework","primitive",...x!==void 0?["tag","releaseTagId"]:[],...f?["api-url","apiUrl"]:[],...m!==void 0?["baseLibrary"]:[]]),ne=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),O=R.properties.filter(b=>!E.has(Vt(b))&&!ne.has(Vt(b))).map(b=>T.slice(b.start,b.end));_=[...Object.entries(A).filter(([b])=>E.has(b)).map(([b,j])=>`${JSON.stringify(b)}: ${JSON.stringify(j)}`),...O]}else _=Object.entries(A).map(([T,R])=>`${JSON.stringify(T)}: ${JSON.stringify(R)}`);return pi(B,fi(r,_)),A}function fi(r,s){let c=`{
16
- ${s.join(`,
13
+ `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},U.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
14
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ce(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 i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],c=parseInt(n,8);return c>255&&(n=n.slice(0,-1),c=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),(n!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(c)}return V(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},U.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i},U.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,n=this.options.ecmaVersion>=6;this.pos<this.input.length;){var c=this.fullCharCodeAtPos();if(B(c,n))this.pos+=c<=65535?1:2;else if(c===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var g=this.readCodePoint();(t?A:B)(g,n)||this.invalidStringToken(d,"Invalid Unicode escape"),e+=ce(g),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)},U.readWord=function(){var e=this.readWord1(),t=a.name;return this.keywords.test(e)&&(t=ae[e]),this.finishToken(t,e)};var Xi="8.17.0";X.acorn={Parser:X,version:Xi,defaultOptions:Se,Position:S,SourceLocation:$,getLineInfo:te,Node:ot,TokenType:_,tokTypes:a,keywordTypes:ae,TokContext:Ie,tokContexts:J,isIdentifierChar:B,isIdentifierStart:A,Token:At,isNewLine:V,lineBreak:b,lineBreakG:j,nonASCIIwhitespace:Y};function _r(e,t){return X.parse(e,t)}function Er(e,t,i){return X.parseExpressionAt(e,t,i)}function Pr(e,t){return X.tokenizer(e,t)}s.Node=ot,s.Parser=X,s.Position=S,s.SourceLocation=$,s.TokContext=Ie,s.Token=At,s.TokenType=_,s.defaultOptions=Se,s.getLineInfo=te,s.isIdentifierChar=B,s.isIdentifierStart=A,s.isNewLine=V,s.keywordTypes=ae,s.lineBreak=b,s.lineBreakG=j,s.nonASCIIwhitespace=Y,s.parse=_r,s.parseExpressionAt=Er,s.tokContexts=J,s.tokTypes=a,s.tokenizer=Pr,s.version=Xi})});var Ts=_e((ya,Ns)=>{var{parse:vn}=Es();function st(){let s=new Error("Configuration reads require a data-only object export. Remove executable statements from frontfriend.config.js.");return s.code="FRONTFRIEND_CONFIG_VALIDATION",s}function Rs(s){if(s.type!=="Property"||s.computed||s.method||s.kind!=="init")throw st();let r=s.key.type==="Identifier"?s.key.name:s.key.value;if(typeof r!="string"||["__proto__","constructor","prototype"].includes(r))throw st();return r}function Ps(s){if(s.type==="ExportDefaultDeclaration")return s.declaration;let r=s.type==="ExpressionStatement"?s.expression:null;return r?.type==="AssignmentExpression"&&r.operator==="="&&r.left.type==="MemberExpression"&&!r.left.computed&&r.left.object.name==="module"&&r.left.property.name==="exports"?r.right:null}function xn(s,r){if(s.type!=="VariableDeclaration"||s.declarations.length!==1)return null;let[o]=s.declarations;return o.id.type!=="Identifier"||r?.type!=="Identifier"||r.name!==o.id.name?null:o.init}function yn(s){let o=vn(s,{ecmaVersion:"latest",sourceType:"module"}).body.filter(p=>p.type!=="EmptyStatement"&&!p.directive),u=o.length===1?Ps(o[0]):o.length===2?xn(o[0],Ps(o[1])):null;if(u?.type!=="ObjectExpression")throw st();function l(p,h=0){if(h>64)throw st();if(p.type==="Literal"&&(p.value===null||["string","number","boolean"].includes(typeof p.value)))return p.value;if(p.type==="ArrayExpression")return p.elements.map(f=>{if(!f)throw st();return l(f,h+1)});if(p.type==="ObjectExpression")return Object.fromEntries(p.properties.map(f=>[Rs(f),l(f.value,h+1)]));if(p.type==="UnaryExpression"&&["-","+"].includes(p.operator)&&p.argument.type==="Literal"&&typeof p.argument.value=="number")return p.operator==="-"?-p.argument.value:p.argument.value;if(p.type==="TemplateLiteral"&&p.expressions.length===0)return p.quasis[0].value.cooked;if(p.type==="MemberExpression"&&!p.computed&&p.object.type==="MemberExpression"&&!p.object.computed&&p.object.object.name==="process"&&p.object.property.name==="env")return process.env[p.property.name];if(p.type==="LogicalExpression"&&["||","??"].includes(p.operator)){let f=l(p.left,h+1);return p.operator==="||"?f||l(p.right,h+1):f??l(p.right,h+1)}throw st()}return{config:l(u),expression:u}}Ns.exports={parseStaticConfig:yn,propertyName:Rs}});var Os=_e((ba,Ls)=>{var Z=require("fs");function bn(s){try{let r=Z.readFileSync(s,"utf8");return JSON.parse(r)}catch(r){if(r.code==="ENOENT")return null;throw r}}function wn(s){try{return Z.readFileSync(s,"utf8").replace(/^\uFEFF/,"")}catch(r){if(r.code==="ENOENT")return null;throw r}}function Sn(s,r,o=2){let u=JSON.stringify(r,null,o);Z.writeFileSync(s,u,"utf8")}function kn(s,r){Z.writeFileSync(s,r,"utf8")}function Cn(s,r){if(r==null||typeof r=="object"&&Object.keys(r).length===0||Array.isArray(r)&&r.length===0){let u=`module.exports = ${Array.isArray(r)?"[]":"{}"};`;Z.writeFileSync(s,u,"utf8")}else{let o=`module.exports = ${JSON.stringify(r,null,2)};`;Z.writeFileSync(s,o,"utf8")}}function In(s){return Z.existsSync(s)}function An(s){Z.mkdirSync(s,{recursive:!0})}function _n(s){Z.rmSync(s,{recursive:!0,force:!0})}function En(s){Z.rmSync(s,{force:!0})}function Pn(s,r){Z.mkdirSync(require("path").dirname(s),{recursive:!0,mode:448});let o=`${s}.${process.pid}.${Date.now()}.tmp`;try{Z.writeFileSync(o,`${JSON.stringify(r,null,2)}
15
+ `,{mode:384}),Z.renameSync(o,s);try{Z.chmodSync(s,384)}catch{}}finally{Z.rmSync(o,{force:!0})}}async function Rn(s,r,o){Z.mkdirSync(require("path").dirname(s),{recursive:!0,mode:448});let u=`${s}.lock`,l=Date.now()+2e4,p;for(;p===void 0;)try{p=Z.openSync(u,"wx",384),Z.writeFileSync(p,String(process.pid))}catch(h){if(h.code!=="EEXIST")throw h;try{let f=Number(Z.readFileSync(u,"utf8"));if(Number.isInteger(f)&&f>0)try{process.kill(f,0)}catch(m){if(m.code==="ESRCH"){Z.unlinkSync(u);continue}}}catch(f){if(f.code==="ENOENT")continue}if(Date.now()>=l)throw o();await new Promise(f=>setTimeout(f,50))}try{return await r()}finally{Z.closeSync(p),Z.unlinkSync(u)}}Ls.exports={writePrivateJsonFileAtomic:Pn,withPrivateFileLock:Rn,readJsonFileSafe:bn,readFileSafe:wn,writeJsonFile:Sn,writeTextFile:kn,writeModuleExportsFile:Cn,fileExists:In,ensureDirectoryExists:An,removeDirectory:_n,removeFile:En}});var Ms=_e((wa,Fs)=>{var{parseStaticConfig:pi,propertyName:Dt}=Ts(),{fileExists:js,readFileSafe:fi,writeTextFile:di,readJsonFileSafe:Nn}=Os(),rt=require("path"),{normalizeAdopt:Vs}=hi(),{parseProjectTarget:Tn}=(Pt(),lt(ss));function Ds(s){try{return Nn(s)??{}}catch{return{}}}function Ln(s){return Ds(rt.join(s,"package.json")).name||rt.basename(s)}function On(s={}){let r={...s};return delete r.ffId,delete r.appRoot,delete r.adoptExplicit,delete r["auth-token"],delete r.authToken,r}function jn(s,r,{ffId:o,name:u,adopt:l,framework:p,primitive:h,apiUrl:f,baseLibrary:m,tag:x}){let w=Tn({framework:p,primitive:h},"Setup Project target"),I=On(r),A={name:u.trim(),"ff-id":o.trim(),adopt:Vs(l),framework:w.framework,primitive:w.primitive};if(x!==void 0){if(typeof x!="string"||!x.trim())throw new Error("Release tag must not be empty.");A.tag=x.trim()}if(m!==void 0){if(!["frontfriend","shadcn"].includes(m))throw new Error("Base library must be frontfriend or shadcn.");A.baseLibrary=m}f&&(A["api-url"]=String(f).replace(/\/+$/,""),delete I.apiUrl);for(let[T,R]of Object.entries(I))T in A||(A[T]=R);let B=rt.join(s,"frontfriend.config.js"),_;if(js(B)){let T=fi(B),{expression:R}=pi(T),E=new Set(["name","ff-id","adopt","framework","primitive",...x!==void 0?["tag","releaseTagId"]:[],...f?["api-url","apiUrl"]:[],...m!==void 0?["baseLibrary"]:[]]),ae=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),O=R.properties.filter(b=>!E.has(Dt(b))&&!ae.has(Dt(b))).map(b=>T.slice(b.start,b.end));_=[...Object.entries(A).filter(([b])=>E.has(b)).map(([b,j])=>`${JSON.stringify(b)}: ${JSON.stringify(j)}`),...O]}else _=Object.entries(A).map(([T,R])=>`${JSON.stringify(T)}: ${JSON.stringify(R)}`);return di(B,mi(s,_)),A}function mi(s,r){let o=`{
16
+ ${r.join(`,
17
17
  `)}
18
- }`;return Lr(rt.join(r,"package.json")).type==="module"?`const config = ${c};
18
+ }`;return Ds(rt.join(s,"package.json")).type==="module"?`const config = ${o};
19
19
 
20
20
  export default config;
21
- `:`module.exports = ${c};
22
- `}function Pn(r,s){let c=rt.join(r,"frontfriend.config.js");if(!s||!Nr(c))return!1;let u=hi(c),{config:l,expression:p}=li(u);if(l["api-url"]||l.apiUrl)return!1;let h=[...p.properties.map(f=>u.slice(f.start,f.end)),`${JSON.stringify("api-url")}: ${JSON.stringify(String(s).replace(/\/+$/,""))}`];return pi(c,fi(r,h)),!0}function Rn(r,s){let c=rt.join(r,"frontfriend.config.js"),u=hi(c),{expression:l}=li(u),p=Tr(s),h=`${JSON.stringify("adopt")}: ${JSON.stringify(p)}`,f=l.properties.map(m=>Vt(m)==="adopt"?h:u.slice(m.start,m.end));return l.properties.some(m=>Vt(m)==="adopt")||f.push(h),pi(c,fi(r,f)),p}Or.exports={defaultAppName:An,writeSetupConfig:En,writeConfigApiUrl:Pn,writeConfigAdopt:Rn}});var Dr=Ie((ma,Fr)=>{var Vr=require("path"),{createRequire:Nn}=require("module"),Ft;function Tn(r){if(Ft)return Ft;let s=[null,r&&Vr.isAbsolute(r)?r:null,Vr.join(process.cwd(),"package.json")];for(let u of s)try{return Ft=u?Nn(u)("typescript"):require("typescript"),Ft}catch{}let c=new Error("Reading component source or build configuration needs TypeScript: install it in the Application (npm i -D typescript).");throw c.code="FF_TYPESCRIPT_UNAVAILABLE",c}Fr.exports={loadTypeScript:Tn}});var $r=Ie((va,Br)=>{var ga=require("path"),{loadTypeScript:Ln}=Dr(),Dt={ui:"@/components/ui",components:"@/components",utils:"@/lib/utils",lib:"@/lib",hooks:"@/hooks"};function di(r,s){if(s.endsWith(".vue"))return[...r.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)].flatMap(h=>{let f=h.index+h[0].indexOf(">")+1;return di(h[1],`${s}.ts`).map(m=>({...m,start:m.start+f,end:m.end+f}))});let c=Ln(s),u=c.createSourceFile(s,r,c.ScriptTarget.Latest,!0,s.endsWith(".tsx")?c.ScriptKind.TSX:c.ScriptKind.TS),l=[],p=h=>{let f=c.isImportDeclaration(h)||c.isExportDeclaration(h)?h.moduleSpecifier:c.isCallExpression(h)&&(h.expression.kind===c.SyntaxKind.ImportKeyword||h.expression.getText(u)==="require")?h.arguments[0]:null;f&&c.isStringLiteral(f)&&l.push({value:f.text,start:f.getStart(u),end:f.end}),c.forEachChild(h,p)};return p(u),l}function Mr(r,s,c,u){let l=di(r,s).map(h=>{let f=h.value.replace(/^@\/registry\/(?:bases\/)?[^/]+\/(ui|lib|hooks|components)\//,(m,x)=>`${Dt[x]}/`);for(let[m,x]of Object.entries(c).sort((w,I)=>String(I[1]).length-String(w[1]).length))if(Dt[m]&&(f===x||f.startsWith(`${x}/`))){f=Dt[m]+f.slice(x.length);break}return{...h,normalized:f}}),p=r;for(let h of l.reverse())(u||h.value!==h.normalized)&&(p=p.slice(0,h.start)+JSON.stringify(h.normalized)+p.slice(h.end));return u?p.replace(/\r\n/g,`
23
- `):p}function On(r,s,c={}){return Mr(r,s,c,!0)}function jn(r,s={}){return Mr(r.content,r.path,s,!1)}Br.exports={PORTABLE_ALIASES:Dt,importStrings:di,normalizedSource:On,normalizeNativeImports:jn}});var Wr=Ie((xa,qr)=>{var fe=require("fs"),J=require("path"),{normalizeAdopt:Vn,ADOPTION_LEVELS:Fn}=ui(),{readJsonc:Dn}=ni(),{defaultAppName:Mn}=jr(),{PORTABLE_ALIASES:mi,importStrings:Bt,normalizedSource:ft}=$r(),{readProjectPaths:Ur,resolveConfiguredAlias:Bn}=(pt(),ut(Tt));function $t(r){try{return Dn(r)}catch{throw new Error(`Cannot read ${r}.`)}}function qe(r,s){let c=J.relative(r,s);if(!c||c.startsWith(`..${J.sep}`)||c===".."||J.isAbsolute(c))throw new Error(`Source must stay inside the Application: ${s}`);if(fe.existsSync(s)&&fe.realpathSync(s)!==J.join(fe.realpathSync(r),c))throw new Error(`Linked source cannot be imported: ${c}`);return c.replace(/\\/g,"/")}function Mt(r,s,c){let u=Bn(r,s,c);return qe(r,u),u}function $n(r,s,c,u={},l=s){let p=ft(r,s,u);for(let h of Bt(p,s).reverse()){if(h.value.startsWith("@frontfriend-local/")){let m=h.value.slice(19);if(!m||m.split("/").some(w=>w===".."||w==="."))throw new Error("Unsafe local source dependency.");let x=J.posix.relative(J.posix.dirname(l),m);x.startsWith(".")||(x=`./${x}`),p=p.slice(0,h.start)+JSON.stringify(x)+p.slice(h.end);continue}let f=Object.entries(mi).sort((m,x)=>x[1].length-m[1].length).find(([m,x])=>c[m]&&(h.value===x||h.value.startsWith(`${x}/`)));f&&(p=p.slice(0,h.start)+JSON.stringify(c[f[0]]+h.value.slice(f[1].length))+p.slice(h.end))}return p}function gi(r){return fe.existsSync(r)?fe.readdirSync(r,{withFileTypes:!0}).sort((s,c)=>s.name.localeCompare(c.name)).flatMap(s=>{let c=J.join(r,s.name);if(s.isSymbolicLink())throw new Error(`Linked source cannot be imported: ${c}`);return s.isDirectory()?gi(c):/\.(?:[cm]?[jt]sx?|vue|css)$/.test(s.name)?[c]:[]}):[]}function Un(r,s,c){let{materializeInstallationPath:u}=(pt(),ut(Tt)),l=Ur(r),p=s.aliases||{},h=Mt(r,p.ui||"@/components/ui",l);if(!fe.existsSync(h)||!fe.statSync(h).isDirectory())throw new Error("The configured UI directory does not exist. Check components.json and TypeScript aliases before import.");let f=new Map((c.canonical||[]).map(a=>[a.canonicalName,a])),m=new Map([...f.values()].flatMap(a=>(a.files||[]).map(b=>[b.path,b]))),x=["",".ts",".tsx",".js",".jsx",".vue","/index.ts","/index.tsx"],w=a=>{let b=a.replace(/\.(?:[cm]?[jt]sx?)$/,"");return b.startsWith("ui/")?`@/components/${b}`:/^(lib|hooks|components)\//.test(b)?`@/${b}`:`@frontfriend-local/${a}`},I=a=>{let b=ft(a.content,a.path,{});for(let j of Bt(b,a.path).reverse()){let V=j.value.startsWith(".")?J.posix.normalize(J.posix.join(J.posix.dirname(a.path),j.value)):j.value.startsWith("@/components/ui/")?j.value.slice(13):j.value.startsWith("@/")?j.value.slice(2):null,z=V&&x.map(X=>V+X).find(X=>m.has(X));z&&(b=b.slice(0,j.start)+JSON.stringify(w(z))+b.slice(j.end))}return b},A=new Map,B=new Map,_={...$t(J.join(r,"package.json")).devDependencies,...$t(J.join(r,"package.json")).dependencies},T=(a,b)=>({source:qe(r,a),target:b,content:fe.readFileSync(a,"utf8")}),R=(a,b,j=f.get(a))=>{let V={name:a,files:b,standard:j,dependencies:new Set,npm:new Set};A.set(a,V);for(let z of b){let X=B.get(z.source);if(X&&X!==a)throw new Error(`Source has two component owners: ${z.source}`);B.set(z.source,a)}return V},E=new Map;for(let a of gi(h)){let b=J.relative(h,a).replace(/\\/g,"/"),j=(b.includes("/")?b.split("/")[0]:b.replace(/\.[^.]+$/,"")).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase(),V=E.get(j)||[];V.push(T(a,`ui/${b}`)),E.set(j,V)}for(let[a,b]of E)R(a,b);for(let[a,b]of f){if(A.has(a)||!b.files?.length||b.files.some(V=>V.path.startsWith("ui/")))continue;let j=b.files.map(V=>({file:V,relative:u({root:r,source:"canonical",path:V.path,installationLayout:"shadcn"})}));j.every(V=>fe.existsSync(J.join(r,V.relative)))&&R(a,j.map(V=>T(J.join(r,V.relative),V.file.path)),b)}let ne=a=>{let b=qe(r,a);for(let[j,V]of Object.entries(p).sort((z,X)=>String(X[1]).length-String(z[1]).length)){if(!mi[j])continue;let z=Mt(r,V,l);if(j==="utils"&&a===z+J.extname(a))return`lib/utils${J.extname(a)}`;if(a.startsWith(`${z}${J.sep}`))return`${j}/${J.relative(z,a).replace(/\\/g,"/")}`}return b},O=(a,b)=>{let j=ft(`import ${JSON.stringify(a)}`,b.source,p).slice(7).trim(),V=JSON.parse(j),z=Object.keys(l.paths).some(G=>a.startsWith(G.split("*")[0]));if(!a.startsWith(".")&&!V.startsWith("@/")&&!z)return null;let X=a.startsWith(".")?J.resolve(r,J.dirname(b.source),a):Mt(r,a,l),W=x.map(G=>X+G).find(G=>fe.existsSync(G)&&fe.statSync(G).isFile());if(!W)throw new Error(`Missing local dependency ${a} in ${b.source}.`);return W};for(let a of A.values()){for(let b of a.files){let j=[];for(let z of Bt(b.content,b.source)){let X=O(z.value,b);if(!X){let ae=z.value.startsWith("@")?z.value.split("/").slice(0,2).join("/"):z.value.split("/")[0];_[ae]&&a.npm.add(`${ae}@${_[ae]}`);continue}let W=qe(r,X),G=B.get(W);if(!G){let ae=ne(X);if(G=`support/${ae.replace(/\.[^.]+$/,"").replace(/[^a-z0-9/_-]/gi,"-").toLowerCase()}`,A.has(G))throw new Error(`Source address collision: custom/${G}`);R(G,[T(X,ae)],null)}G!==a.name&&a.dependencies.add(G);let st=A.get(G).files.find(ae=>ae.source===W),He=w(st.target);j.push({...z,value:He})}let V=b.content;for(let z of j.reverse())V=V.slice(0,z.start)+JSON.stringify(z.value)+V.slice(z.end);b.portable=ft(V,b.source,p)}a.identical=!!(a.standard&&a.files.length===a.standard.files.length&&a.files.every(b=>{let j=a.standard.files.find(V=>V.path===b.target);return j&&b.portable===I(j)}))}return[...A.values()].filter(a=>!a.identical).map(a=>({name:a.name,address:`custom/${a.name}`,semver:"1.0.0",changelog:"Import the existing Application source.",...a.standard?{replacesCanonical:a.standard.canonicalName}:{},installationLayout:"shadcn",sourceAliases:mi,files:a.files.map(({portable:b,...j})=>({...j,content:b})),npmDependencies:[...a.npm].sort(),componentRequirements:[...a.dependencies].sort().map(b=>{let j=A.get(b);return j.standard&&j.identical?{kind:"canonical",name:j.standard.canonicalName,range:"*",framework:c.projectTarget.framework,primitive:c.projectTarget.primitive}:{kind:"private",name:`custom/${b}`,range:"1.0.0"}})}))}async function qn({config:r,client:s,dryRun:c=!1}){let u=Vn(r.adopt)||Fn,l=$t(J.join(r.appRoot,"components.json")),p={appName:r.name||Mn(r.appRoot),framework:r.framework,primitive:r.primitive,style:l.style,adopt:u},h=await s.importShadcn({phase:"prepare",...p});if(h.initialized)return{...h,skipped:!0};let f=h.release;if(!f?.releaseId||f.baseLibrary!=="shadcn")throw new Error("Initial import requires a pinned shadcn Release.");if(f.projectTarget.framework!==r.framework||f.projectTarget.primitive!==r.primitive)throw new Error("Import target differs from the pinned shadcn Release.");if(f.baseProvenance?.style&&f.baseProvenance.style!==l.style)throw new Error("Import style differs from the pinned shadcn Release.");let m=l.tailwind?.css,x="";if(u.includes("tokens")){if(!m)throw new Error("components.json must declare tailwind.css for native token import.");let I=J.resolve(r.appRoot,m);qe(r.appRoot,I),x=fe.readFileSync(I,"utf8")}let w={phase:"complete",...p,sourceReleaseId:f.releaseId,themeCss:x,componentsJson:l,components:u.includes("components")?Un(r.appRoot,l,f):[]};return c?{dryRun:!0,payload:w}:s.importShadcn(w)}function Wn(r,s){let{materializeInstallationPath:c}=(pt(),ut(Tt)),u=$t(J.join(r.appRoot,"components.json")),l=Mt(r.appRoot,u.aliases?.ui||"@/components/ui",Ur(r.appRoot)),p=new Map(gi(l).map(h=>{let f=J.relative(l,h).replace(/\\/g,"/"),m=qe(r.appRoot,h);return[m,{path:m,target:`ui/${f}`,component:f.split("/")[0].replace(/\.[^.]+$/,""),content:fe.readFileSync(h,"utf8")}]}));for(let h of[...s.canonical||[],...s.private||[]])for(let f of h.files||[]){let m=c({root:r.appRoot,source:h.kind,path:f.path,configuredUiPath:r.aliases?.ui,installationLayout:h.installationLayout||(h.source==="shadcn"?"shadcn":void 0)}),x=J.join(r.appRoot,m);fe.existsSync(x)&&(qe(r.appRoot,x),p.set(m,{path:m,target:f.path,component:h.address||h.canonicalName,content:fe.readFileSync(x,"utf8")}))}return[...p.values()]}qr.exports={importShadcnApplication:qn,collectNativeMigrationFiles:Wn,normalizedSource:ft,materializeSource:$n,importStrings:Bt,inside:qe}});var Xn={};Qt(Xn,{AdoptionConflictError:()=>P,ApplicationAdoption:()=>yi,COMPONENT_DELETED:()=>qt,adoptionDigest:()=>Pt,deletedComponentLocation:()=>wi,deletedComponentMessage:()=>Qn,deletedComponentsForLock:()=>Jr,deletedPinMessage:()=>Kr,deletedVersionIds:()=>gt,hashContent:()=>ge,parseApplicationLock:()=>Ue,serializeApplicationLock:()=>ri,threeWayMerge:()=>Yt,validateInstallationPath:()=>de,withdrawalWarningsForLock:()=>Yn});module.exports=ut(Xn);var bi=et(require("node:crypto")),D=et(require("node:fs")),F=et(require("node:path"));At();function $e(r){return r&&typeof r=="object"&&"code"in r?String(r.code):void 0}function _t(r){return r instanceof Error?r.message:String(r)}var P=class extends Error{constructor(c,u=[]){super(c);this.code="ADOPTION_CONFLICT";this.name="AdoptionConflictError",this.conflicts=u}};At();var sr=et(require("node:crypto")),js=2e6,ir=1e5;function ge(r){return sr.default.createHash("sha256").update(Buffer.from(r)).digest("hex")}function lt(r){return String(r).match(/.*(?:\n|$)/g).filter(s=>s!=="")}function rr(r,s){let c=lt(r),u=lt(s),l=Array.from({length:c.length+1},()=>new Uint32Array(u.length+1));for(let w=c.length-1;w>=0;w-=1)for(let I=u.length-1;I>=0;I-=1)l[w][I]=c[w]===u[I]?l[w+1][I+1]+1:Math.max(l[w+1][I],l[w][I+1]);let p=[],h=0,f=0,m=null,x=()=>{m&&p.push(m),m=null};for(;h<c.length||f<u.length;)h<c.length&&f<u.length&&c[h]===u[f]?(x(),h+=1,f+=1):f<u.length&&(h===c.length||l[h][f+1]>l[h+1][f])?(m||={start:h,end:h,replacement:[]},m.replacement.push(u[f]),f+=1):(m||={start:h,end:h,replacement:[]},h+=1,m.end=h);return x(),{base:c,hunks:p}}function Vs(r,s){return r.start===r.end&&s.start===s.end?r.start===s.start:r.start===r.end?r.start>=s.start&&r.start<s.end:s.start===s.end?s.start>=r.start&&s.start<r.end:r.start<s.end&&s.start<r.end}function Yt(r,s,c){let u=lt(r).length,l=Math.max(lt(s).length,lt(c).length);if(u>ir||l>ir||(u+1)*(l+1)>js)return null;let p=rr(r,s),h=rr(r,c),f=[...p.hunks];for(let w of h.hunks){let I=f.find(A=>Vs(A,w));if(I){if(I.start===w.start&&I.end===w.end&&I.replacement.join("")===w.replacement.join(""))continue;return null}f.push(w)}let m="",x=0;for(let w of f.sort((I,A)=>I.start-A.start||I.end-A.end))m+=p.base.slice(x,w.start).join(""),m+=w.replacement.join(""),x=w.end;return m+p.base.slice(x).join("")}var{isSafeSlug:Hs}=ii();function Re(r){return Object.fromEntries(Object.entries(r).sort(([s],[c])=>s.localeCompare(c)).map(([s,c])=>[s,c&&typeof c=="object"&&!Array.isArray(c)?{...c,...Array.isArray(c.files)?{files:[...c.files].sort((u,l)=>u.path.localeCompare(l.path))}:{}}:c]))}function Et(r){return Array.isArray(r)?r.map(Et):r&&typeof r=="object"?Object.fromEntries(Object.keys(r).filter(s=>s!=="adoptionDigest").sort().map(s=>[s,Et(r[s])])):r}function Pt(r){return ge(JSON.stringify(Et(r)))}function cr(r){let s=r;if(!s||![1,2,3].includes(Number(s.schemaVersion))||typeof s.components!="object"||s.components===null)throw new P("Unsupported or malformed frontfriend.lock.json.");let c=Object.fromEntries(Object.entries(s.components).map(([f,m])=>{let x=m;if(!x||!["canonical","private"].includes(String(x.source))||typeof x.versionId!="string"||typeof x.semver!="string")throw new P(`Unsupported source kind for ${f}.`);return[f,x]})),u={releaseId:s.releaseId==null?null:String(s.releaseId),tokenVersionId:String(s.tokenVersionId),projectTarget:s.schemaVersion===3&&s.projectTarget===null&&Object.keys(c).length===0?null:be(s.projectTarget,"Application lock target"),components:c};for(let f of Object.values(c)){if(!f.projectTarget)continue;let m=be(f.projectTarget,"Component adoption target");if(!u.projectTarget||m.framework!==u.projectTarget.framework||m.primitive!==u.projectTarget.primitive)throw new P("Component adoption belongs to another Project target.")}if(s.schemaVersion===1)return{...u,projectTarget:be(s.projectTarget,"Application lock target"),schemaVersion:1,components:c};if(typeof s.designSystemId!="string"||!s.designSystemId||typeof s.ffId!="string"||!s.ffId||typeof s.adoptionDigest!="string"||!s.adoptionDigest||typeof s.tokenSourceReleaseId!="string"||!s.tokenSourceReleaseId||!Array.isArray(s.sourceReleaseIds))throw new P("Malformed v2 Frontfriend adoption snapshot.");let l={...u,schemaVersion:s.schemaVersion===3?3:2,...s.schemaVersion===3?{design:s.design}:{},designSystemId:s.designSystemId,ffId:s.ffId,...s.baseLibrary!==void 0?{baseLibrary:s.baseLibrary}:{},...s.baseProvenance!==void 0?{baseProvenance:s.baseProvenance}:{},...s.replacements!==void 0?{replacements:s.replacements}:{},adoptionDigest:s.adoptionDigest,tokenSourceReleaseId:s.tokenSourceReleaseId,sourceReleaseIds:[...new Set(s.sourceReleaseIds.map(String))].sort(),components:c};if(l.baseLibrary!==void 0&&!["frontfriend","shadcn"].includes(l.baseLibrary))throw new P("Unsupported base library in Application lock.");if(l.schemaVersion===3){let f=l.design;if(!f||f.designSystemId!==l.designSystemId||!f.appId||!f.snapshotId||!f.sharedSourceReleaseId||!Array.isArray(f.contracts)||!Array.isArray(f.sharedContracts))throw new P("Malformed Application design adoption.");let m=[...f.sharedContracts,...f.contracts];if(new Set(m.map(w=>w.slug)).size!==m.length||m.some(w=>w.designSystemId!==l.designSystemId||!w.revisionId||!w.contractId||!Hs(w.slug)||!w.slug.endsWith(".md")||!Number.isInteger(w.version)||w.version<1||!/^[a-f0-9]{64}$/.test(w.digest)))throw new P("Invalid contract revision pins in the Application lock.");if(f.sharedContracts.some(w=>!["guidelines","design-context","guideline-chapter","layout","pattern"].includes(w.kind))||f.contracts.some(w=>!["app-context","page"].includes(w.kind)))throw new P("Contract pins have invalid shared or App ownership.");if(ge(JSON.stringify(Et({schemaVersion:1,appId:f.appId,sharedSourceReleaseId:f.sharedSourceReleaseId,contracts:[...f.contracts].sort((w,I)=>w.slug.localeCompare(I.slug))})))!==f.snapshotDigest)throw new P("Application design snapshot digest does not match its manifest.")}else if(s.design!==void 0)throw new P("Contract pins require a schema version 3 Application lock.");let p=Object.values(l.components).map(f=>{if(typeof f.sourceReleaseId!="string"||!f.sourceReleaseId)throw new P("Every v2 component adoption must identify its immutable source Release.");return f.sourceReleaseId}),h=[...new Set([l.tokenSourceReleaseId,...p,...l.design?[l.design.sharedSourceReleaseId]:[]])].sort();if(JSON.stringify(h)!==JSON.stringify(l.sourceReleaseIds))throw new P("The adoption source Releases do not match the token and component provenance.");if(l.releaseId&&(h.length!==1||h[0]!==l.releaseId))throw new P("A lock may reference a Release only when its complete closure matches that Release.");if(Pt(l)!==l.adoptionDigest)throw new P("The adoption snapshot digest does not match its manifest.");return l}function Ue(r){try{return cr(typeof r=="string"?JSON.parse(r):r)}catch(s){throw s instanceof P?s:new P(`Invalid frontfriend.lock.json: ${s instanceof Error?s.message:String(s)}`)}}function ri(r){let s=cr(r);return`${JSON.stringify({...s,components:Re(s.components)},null,2)}
24
- `}pt();function Js(r){let s=r.projectTarget;return(r.replacements||[]).filter(c=>!s||c.framework===s.framework&&c.primitive===s.primitive)}function vr(r){let s=Js(r),c=new Map(s.map(l=>[`${l.framework}/${l.primitive}/${l.canonicalName}`,l.privateAddress]));for(let l of s)if(!(r.private||[]).some(p=>p.address===l.privateAddress))throw new Error(`Replacement ${l.privateAddress} is absent from the selected Release.`);let u=new Set;return(r.installOrder||[...r.canonical||[],...r.private||[]]).filter(l=>{let p=r.projectTarget;if(l.projectTarget&&p&&(l.projectTarget.framework!==p.framework||l.projectTarget.primitive!==p.primitive)||l.kind==="canonical"&&c.has(`${l.framework}/${l.primitive}/${l.canonicalName}`))return!1;let h=Ks(l);return u.has(h)?!1:(u.add(h),!0)})}function Ks(r){return r.kind==="private"?`private:${r.address}`:`canonical:${r.framework}/${r.primitive}/${r.canonicalName}`}var{planMirrorResponse:Hn,readMirrorTree:zn,validatePinnedMirror:Gn,MIRROR_DIR:Ut}=ii(),{materializeSource:Jn}=Wr(),Kn=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i;function de(r){if(typeof r!="string"||!r||r.includes("\0"))throw new P("Installation paths must be non-empty and contain no null bytes.");let s=r.replace(/\\/g,"/"),c=s.split("/");if(F.default.posix.isAbsolute(s)||/^[A-Za-z]:\//.test(s)||c.some(u=>!u||u==="."||u==="..")||c.some(u=>Kn.test(u)))throw new P(`Unsafe installation path: ${r}`);return s}function xi(r){return r.kind==="private"?r.address:r.canonicalName}function vi(r){return r.kind==="private"?"private":"canonical"}function mt(r){return vr(r)}var qt="COMPONENT_DELETED";function gt(r,s=[]){let c=new Set(s);for(let u of r)for(let l of u?.warnings??[])l?.reason===qt&&typeof l.versionId=="string"&&c.add(l.versionId);return c}function Jr(r,s){if(!r)return[];let c=Ue(r),u=s instanceof Set?s:gt(s);return Object.entries(c.components).filter(([,l])=>l.source==="private"&&u.has(l.versionId)).map(([l,p])=>({component:l,versionId:p.versionId,semver:p.semver,paths:(p.files||[]).map(h=>h.path).sort()})).sort((l,p)=>l.component.localeCompare(p.component))}function wi(r){if(r.length<=1)return r[0]??"";let s=r.map(l=>F.default.posix.dirname(l).split("/")),c=[];for(let[l,p]of s[0].entries()){if(s.some(h=>h[l]!==p))break;c.push(p)}let u=c.join("/");return u&&u!=="."?u:r.join(", ")}function Qn(r){return r.paths.length?`${r.component} was deleted from the design system. Its files in ${wi(r.paths)} were kept; remove them and their imports if you no longer use them.`:`${r.component} was deleted from the design system. Remove its imports if you no longer use it.`}function Kr(r){let s=wi(r.paths);return`${r.component}@${r.semver} was deleted from the design system. Run \`frontfriend update\` to drop it from frontfriend.lock.json${s?`; its files in ${s} stay until you remove them and their imports.`:"."}`}function Yn(r,s){let c=Ue(r),u=new Map(Object.entries(c.components).map(([p,h])=>[h.versionId,p])),l=new Map;for(let p of s){for(let h of p.warnings??[]){let f=u.get(h.versionId);if(!(!f||h.code!=="WITHDRAWN_HISTORICAL_VERSION"||h.severity!=="urgent")){if(h.reason===qt){let m=c.components[f];l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,reason:qt,message:Kr({component:f,versionId:m.versionId,semver:m.semver,paths:(m.files||[]).map(x=>x.path).sort()})});continue}l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,message:`${f}@${c.components[f].semver} is withdrawn: ${h.message}${h.correctedVersionId?` Use corrected version ${h.correctedVersionId}.`:""}`})}}for(let h of mt(p)){let f=u.get(h.id);if(!f||!h.withdrawnAt)continue;let m=`${f}@${h.semver} is withdrawn${h.withdrawalReason?`: ${h.withdrawalReason}.`:"."}${h.correctedVersionId?` Use corrected version ${h.correctedVersionId}.`:""}`;l.set(h.id,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.id,message:m})}}return[...l.values()].sort((p,h)=>p.identity.localeCompare(h.identity))}function Hr(r){if(!r.designSystemId||!r.ffId||!r.releaseId||!r.tokenVersionId)throw new P("Resolved Releases must include their Release, token, Design System id and ff-id.")}function dt(r){return`${r.framework}/${r.primitive}/${r.canonicalName}`}function Qr(r,s,c=gt([s])){if(s.contractsOnly||r.tokenVersionId!==s.tokenVersionId||"baseLibrary"in r&&r.baseLibrary!==(s.baseLibrary||"frontfriend")||"baseProvenance"in r&&JSON.stringify(Re(r.baseProvenance||{}))!==JSON.stringify(Re(s.baseProvenance||{})))return!1;let u=new Map(mt(s).map(m=>[xi(m),m.id])),l=new Set(Object.entries(r.components).filter(([m,x])=>x.source==="private"&&c.has(x.versionId)&&!u.has(m)).map(([m])=>m)),p=(m=[])=>Re(Object.fromEntries(m.filter(x=>!l.has(x.privateAddress)).map(x=>[dt(x),x.privateAddress])));if("replacements"in r&&JSON.stringify(p(r.replacements))!==JSON.stringify(p(s.replacements))||r.schemaVersion!==1&&r.sourceReleaseIds.some(m=>m!==s.releaseId))return!1;if(r.schemaVersion!==1&&r.design){if(r.design.sharedSourceReleaseId!==s.releaseId||JSON.stringify(Re(Object.fromEntries(r.design.sharedContracts.map(m=>[m.slug,m]))))!==JSON.stringify(Re(Object.fromEntries((s.contracts??[]).map(m=>[m.slug,m])))))return!1}else if(s.contracts!==void 0)return!1;let h=Object.entries(r.components).filter(([m])=>!l.has(m)),f="replacements"in r?(r.replacements||[]).filter(m=>l.has(m.privateAddress)).map(m=>m.canonicalName).filter(m=>!r.components[m]):[];for(let m of f)u.delete(m);return h.length===u.size&&h.every(([m,x])=>u.get(m)===x.versionId)}function zr(r,s,c){if(!s.contractsOnly&&r&&r.schemaVersion!==1&&r.releaseId===s.releaseId&&!Qr(r,s,c))throw new P("The same immutable Release cannot resolve to a different token or component closure.")}function Gr(r,s,c=[]){for(let u of[...c].reverse()){let l=F.default.join(r,de(u.from)),p=F.default.join(r,de(u.to));if(!D.default.existsSync(p))continue;let h=F.default.join(s,`case-rollback-${bi.default.randomBytes(6).toString("hex")}`);D.default.renameSync(p,h),D.default.mkdirSync(F.default.dirname(l),{recursive:!0}),D.default.renameSync(h,l)}}var yi=class{constructor(s={}){this.root=F.default.resolve(s.root||process.cwd()),this.canonicalUiPath=s.canonicalUiPath??null,this.usesFilesystem=!s.readFile&&!s.writeFile,this.mutationLockDepth=0,this.mutationLockFd=null,this.readFile=s.readFile||(c=>{let u=F.default.join(this.root,de(c));try{return D.default.readFileSync(u,"utf8")}catch(l){if($e(l)==="ENOENT")return null;throw l}}),this.writeFile=s.writeFile||((c,u)=>{let l=F.default.join(this.root,de(c));D.default.mkdirSync(F.default.dirname(l),{recursive:!0}),D.default.writeFileSync(l,u)})}installationPath(s,c){return de(oi({root:this.root,source:vi(s),path:de(c),configuredUiPath:this.canonicalUiPath,installationLayout:s.installationLayout||(s.source==="shadcn"?"shadcn":void 0)}))}installationSource(s,c,u){if(s.source!=="shadcn"&&s.installationLayout!=="shadcn")return u;let l={};try{l=JSON.parse(D.default.readFileSync(F.default.join(this.root,"components.json"),"utf8")).aliases||{}}catch{}return Jn(u,c,l,s.sourceAliases,this.installationPath(s,c))}acquireMutationLock(){if(!this.usesFilesystem)return()=>{};if(this.mutationLockDepth>0)return this.mutationLockDepth+=1,()=>{this.mutationLockDepth-=1};D.default.mkdirSync(this.root,{recursive:!0});let s=F.default.join(this.root,".frontfriend-update.lock"),c=l=>{try{let p=D.default.openSync(s,"wx");return D.default.writeFileSync(p,`${JSON.stringify({schemaVersion:1,pid:process.pid})}
25
- `),p}catch(p){if($e(p)!=="EEXIST"||!l)throw p;let h;try{h=JSON.parse(D.default.readFileSync(s,"utf8"))}catch{throw new P("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.")}if(h?.schemaVersion!==1||!Number.isInteger(h.pid))throw new P("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.");try{throw process.kill(h.pid,0),new P(`Another Frontfriend update is active (pid ${h.pid}).`)}catch(f){if(f instanceof P||$e(f)!=="ESRCH")throw f}return D.default.unlinkSync(s),c(!1)}};try{this.mutationLockFd=c(!0)}catch(l){throw l instanceof P?l:new P(`Could not acquire the application update lock: ${_t(l)}`)}this.mutationLockDepth=1;let u=!1;return()=>{u||(u=!0,this.mutationLockDepth-=1,this.mutationLockDepth===0&&(D.default.closeSync(this.mutationLockFd),this.mutationLockFd=null,D.default.unlinkSync(s)))}}recoverPendingTransactions(){if(this.usesFilesystem&&this.mutationLockDepth===0)throw new P("Recovery requires the exclusive application update lock.");if(D.default.existsSync(this.root))for(let s of D.default.readdirSync(this.root)){if(!/^\.frontfriend-transaction-\d+-[0-9a-f]{12}$/.test(s))continue;let c=F.default.join(this.root,s),u=F.default.join(c,"journal.json"),l;try{l=JSON.parse(D.default.readFileSync(u,"utf8"))}catch{throw new P(`Cannot recover ${s}: its transaction journal is missing or corrupt.`)}if(l?.schemaVersion!==1||!["prepared","committing","committed"].includes(l.state)||!Array.isArray(l.paths)||l.renames!=null&&!Array.isArray(l.renames))throw new P(`Cannot recover ${s}: invalid transaction journal.`);if(l.state==="committing"){for(let p of l.paths||[]){let h=de(p.path),f=F.default.join(this.root,h),m=F.default.join(c,"backup",h);if(p.existed)D.default.mkdirSync(F.default.dirname(f),{recursive:!0}),D.default.copyFileSync(m,f);else try{D.default.unlinkSync(f)}catch(x){if($e(x)!=="ENOENT")throw x}}Gr(this.root,c,l.renames)}D.default.rmSync(c,{recursive:!0,force:!0})}}inspect(s,c={}){Hr(s);let u=be(s.projectTarget,"Resolved Release target"),l=null;if(c.currentLock){if(l=Ue(c.currentLock),l.projectTarget&&Ve(l.projectTarget)!==Ve(u))throw new P("Project target mismatch between Release and lock.");if(l.schemaVersion!==1&&(l.designSystemId!==s.designSystemId||l.ffId!==s.ffId))throw new P("Design System mismatch between Release and lock.");zr(l,s,gt([s],c.deletedVersionIds))}let p={},h=[],f=[];for(let m of mt(s)){let x=xi(m),w=l?.components?.[x]||null,I=m.files.map(R=>{let E=this.installationPath(m,R.path),ne=this.readFile(E);return{path:E,status:ne==null?"available":ge(ne)===ge(this.installationSource(m,R.path,R.content))?"exact":"drifted"}}),A=new Set(I.map(R=>R.status)),B=w&&(w.files||[]).some(R=>{let E=this.readFile(R.path);return E==null||ge(E)!==R.baselineHash}),_=w&&w.versionId!==m.id,T=B?"drifted":_?"update-available":A.has("drifted")?"drifted":A.has("available")?"available":"exact";p[x]={source:vi(m),status:T,versionId:m.id,semver:m.semver,changelog:m.changelog,files:I},(!w||_)&&m.changelog&&!h.includes(m.changelog)&&h.push(m.changelog),m.withdrawnAt&&f.push(`${x}@${m.semver} is withdrawn${m.withdrawalReason?`: ${m.withdrawalReason}`:"."}${m.correctedVersionId?` Use corrected version ${m.correctedVersionId}.`:""}`)}return{releaseId:s.releaseId,tokenVersionId:s.tokenVersionId,projectTarget:u,token:{versionId:s.tokenVersionId,status:l?l.tokenVersionId===s.tokenVersionId?"exact":"update-available":"available"},components:p,changelogs:h,warnings:f}}diff(s){let c=Ue(s),u=[];for(let[l,p]of Object.entries(c.components))for(let h of p.files||[]){let f=this.readFile(h.path);u.push({component:l,source:p.source,path:h.path,baselineHash:h.baselineHash,currentHash:f==null?null:ge(f),status:f==null?"missing":ge(f)===h.baselineHash?"unchanged":"modified"})}return u.sort((l,p)=>l.path.localeCompare(p.path))}planUpdate(s,c={}){Hr(s);let u=c.currentLock?Ue(c.currentLock):null;if(s.contractsOnly&&(!c.design||c.components?.length!==0||mt(s).length))throw new P("Contract-only resolution requires an exact design selection and no incoming component source.");let l=s.contractsOnly?u?.projectTarget??null:be(s.projectTarget,"Resolved Release target");if(!s.contractsOnly&&l&&u?.projectTarget&&Ve(u.projectTarget)!==Ve(l))throw new P("Project target mismatch between config, Release and lock.");if(u&&u.schemaVersion!==1&&(u.designSystemId!==s.designSystemId||u.ffId!==s.ffId))throw new P("Design System mismatch between config, Release and lock.");let p=gt([s],c.deletedVersionIds);zr(u,s,p);let h=c.components?new Set(c.components):null,f=new Set,m=u?{...u.components}:{},x={},w=new Set,I=[],A=[],B=new Set,_=[],T=[],R=[],E=[],ne=new Map,O=new Map,a=new Map;for(let[S,U]of Object.entries(u?.components||{}))for(let Y of U.files||[])a.set(Y.path.toLocaleLowerCase("en-US"),S);for(let S of mt(s)){let U=xi(S);if(h&&!h.has(U))continue;let Y=u?.components?.[U]||null,xe=!Y||Y.versionId!==S.id,_e=!1;if(S.kind==="private"&&s.capabilities?.freshPrivateSelection!==!0&&Y?.versionId!==S.id){E.push({component:U,reason:"the current subscription permits only the exact private version already pinned in frontfriend.lock.json"});continue}if(S.kind==="canonical"&&!s.capabilities?.freshCanonicalSelection?.includes(U)&&Y?.versionId!==S.id){E.push({component:U,reason:"the current catalogue permits only the exact canonical version already pinned in frontfriend.lock.json"});continue}if(S.withdrawnAt&&Y?.versionId!==S.id){E.push({component:U,reason:`${U}@${S.semver} is withdrawn and cannot be freshly installed${S.withdrawalReason?`: ${S.withdrawalReason}`:""}`});continue}let te=[];for(let se of S.files){let H={...se,content:this.installationSource(S,se.path,se.content)},q=this.installationPath(S,H.path),ye=q.toLocaleLowerCase("en-US"),Ae=a.get(ye);if(Ae&&Ae!==U){if(!c.allowReplacement){E.push({path:q,reason:`owned by ${Ae}; explicit replacement is required`});continue}let re=m[Ae];if(re){let Je=(re.files||[]).filter(Ke=>Ke.path.toLocaleLowerCase("en-US")!==ye);Je.length===0?delete m[Ae]:m[Ae]={...re,files:Je}}}let We=ne.get(ye),ze=O.get(ye);if(ze&&ze!==U){E.push({path:q,reason:`also claimed by ${ze}`});continue}if(We&&We!==q){E.push({path:q,reason:`case collision with ${We}`});continue}ne.set(ye,q),O.set(ye,U);let me=Y?.files?.find(re=>re.path===q)||Y?.files?.find(re=>re.path.toLocaleLowerCase("en-US")===ye)||(c.allowReplacement&&Ae?u?.components?.[Ae]?.files?.find(re=>re.path.toLocaleLowerCase("en-US")===ye):null),Ge=me&&me.path!==q&&me.path.toLocaleLowerCase("en-US")===ye;if(Ge&&F.default.posix.dirname(me.path)!==F.default.posix.dirname(q)){E.push({path:q,reason:"case-only parent directory renames require an explicit filesystem migration"});continue}let ie=this.readFile(Ge?me.path:q),Le=me?.baseline??null,oe=ie;if(ie==null)x[q]=H.content,oe=H.content;else if(me)if(ie===H.content)oe=ie;else if(ge(ie)===me.baselineHash)x[q]=H.content,oe=H.content;else if(Le===H.content)oe=ie;else{let re=Le==null?null:Yt(Le,ie,H.content);re==null?E.push({path:q,reason:"local and incoming source both changed"}):(re!==ie&&(x[q]=re),oe=re)}else ie===H.content?oe=ie:c.allowReplacement?(x[q]=H.content,oe=H.content):E.push({path:q,reason:"unmanaged file already exists"});Ge&&oe!=null&&(x[q]=oe,I.push({from:me.path,to:q})),oe!=null&&oe!==H.content&&(_e=!0),x[q]===void 0&&ie!=null&&(ie===H.content?T.push(q):oe===ie&&R.push(q)),te.push({path:q,installedHash:oe==null?null:ge(oe),baselineHash:ge(H.content),baseline:H.content})}let Ne=new Set(te.map(se=>se.path.toLocaleLowerCase("en-US")));for(let se of Y?.files||[]){if(Ne.has(se.path.toLocaleLowerCase("en-US")))continue;let H=this.readFile(se.path);H!=null&&(ge(H)===se.baselineHash?w.add(se.path):E.push({path:se.path,reason:"removed upstream but modified locally"}))}m[U]={source:vi(S),versionId:S.id,semver:S.semver,manifestHash:S.digest,sourceReleaseId:s.releaseId,...S.projectTarget?{projectTarget:be(S.projectTarget,"Component Project target")}:{},files:te},f.add(U),xe&&A.push(S.changelog);let Te=S.npmDependencies||[];if(Te.length&&(xe||!_e)){let se=xe&&!_e;if(_.push({component:`${U}@${S.semver}`,dependencies:[...Te],required:se}),se)for(let H of Te)B.add(H)}}if(E.length>0)throw new P(`Update plan has conflicts; files and lock were not changed: ${E[0].reason}.`,E);let b=Jr(u,p).filter(S=>!f.has(S.component));for(let S of b)delete m[S.component];let j=!!h,V=j&&u&&!c.adoptTokens,z=V?u.tokenVersionId:s.tokenVersionId,X=V&&(("tokenSourceReleaseId"in u?u.tokenSourceReleaseId:void 0)||u.releaseId)||s.releaseId,W=u&&u.schemaVersion!==1?u.design:void 0,G=c.design??(j?W:void 0);if(!j&&s.contracts!==void 0&&!G)throw new P("Select an exact Application design snapshot before adopting this Release.");if(!j&&W&&!G)throw new P("A Release without contract pins cannot silently remove adopted contract pins.");if(G&&G.designSystemId!==s.designSystemId)throw new P("Design snapshot belongs to another Design System.");if(c.design&&JSON.stringify(Re(Object.fromEntries(c.design.sharedContracts.map(S=>[S.slug,S]))))!==JSON.stringify(Re(Object.fromEntries((s.contracts??[]).map(S=>[S.slug,S])))))throw new P("Design snapshot does not match the selected Release contract set.");let st=[...new Set([X,...G?[G.sharedSourceReleaseId]:[],...Object.values(m).map(S=>S.sourceReleaseId||u?.releaseId||s.releaseId)].filter(Boolean))].sort(),He=(s.replacements||[]).filter(S=>{let U=m[S.privateAddress],Y=s.private?.find(xe=>xe.address===S.privateAddress);return S.framework===l?.framework&&S.primitive===l?.primitive&&U?.source==="private"&&U.sourceReleaseId===s.releaseId&&U.versionId===Y?.id}),ae=new Set(He.map(dt)),vt=[...(u&&"replacements"in u?u.replacements||[]:[]).filter(S=>{let U=m[S.privateAddress],Y=u?.components[S.privateAddress];return U?.source==="private"&&U.versionId===Y?.versionId&&U.sourceReleaseId===Y?.sourceReleaseId&&!f.has(S.privateAddress)&&!f.has(S.canonicalName)&&!ae.has(dt(S))}),...He].sort((S,U)=>dt(S).localeCompare(dt(U))),he={schemaVersion:G?3:2,...G?{design:G}:{},...s.replacements!==void 0||u&&"replacements"in u?{replacements:vt}:{},designSystemId:s.designSystemId,ffId:s.ffId,...(V&&"baseLibrary"in u?u.baseLibrary:s.baseLibrary)?{baseLibrary:V&&"baseLibrary"in u?u.baseLibrary:s.baseLibrary}:{},...(V&&"baseProvenance"in u?u.baseProvenance:s.baseProvenance)?{baseProvenance:V&&"baseProvenance"in u?u.baseProvenance:s.baseProvenance}:{},releaseId:null,tokenVersionId:z,tokenSourceReleaseId:X,sourceReleaseIds:st,projectTarget:l,components:m,adoptionDigest:""};if(Qr(he,s)&&(he.releaseId=s.releaseId),he.adoptionDigest=Pt(he),Ue(he),c.designMirror){let S=c.designMirror,U;try{U=Gn(S,G,s.ffId)}catch(te){throw new P(_t(te))}let Y=new Set([...Object.keys(zn(F.default.join(this.root,Ut))),...W?[...W.sharedContracts,...W.contracts].map(te=>te.slug):[],...U.map(te=>te.slug),"README.md"]),xe=Object.fromEntries([...Y].flatMap(te=>{let Ne=this.readFile(`${Ut}/${te}`);return Ne===null?[]:[[te,Ne]]})),_e=Hn(S,xe);for(let[te,Ne]of Object.entries(_e.writes)){let Te=de(`${Ut}/${te}`);if(x[Te]!==void 0||Object.values(m).some(se=>se.files?.some(H=>H.path===Te)))throw new P("A component cannot own a contract mirror path.");x[Te]=Ne}for(let te of _e.deletes)w.add(de(`${Ut}/${te}`))}else if(c.design&&(c.design.contracts.length||c.design.sharedContracts.length))throw new P("Fetch the exact contract mirror before applying a new design adoption.");return{valid:!0,writes:Re(x),deletes:[...w].filter(S=>!Object.keys(x).some(U=>U.toLocaleLowerCase("en-US")===S.toLocaleLowerCase("en-US"))).sort(),renames:I.sort((S,U)=>S.from.localeCompare(U.from)),nextLock:he,changelogs:A.filter(Boolean),npmDependencies:[...B].sort(),npmDeclarations:_,unchanged:T.sort(),kept:R.sort(),removed:b}}apply(s,c={}){if(!s?.valid)throw new P("Only a validated update plan can be applied.");let u=this.mutationLockDepth===0?this.acquireMutationLock():()=>{};try{this.usesFilesystem&&this.recoverPendingTransactions();let l="frontfriend.lock.json",p=[...new Set([...Object.keys(s.writes),...s.deletes||[],...(s.renames||[]).flatMap(I=>[I.from,I.to]),l])],h=F.default.join(this.root,`.frontfriend-transaction-${process.pid}-${bi.default.randomBytes(6).toString("hex")}`),f=F.default.join(h,"stage"),m=F.default.join(h,"backup"),x=p.map(I=>({path:de(I),existed:this.readFile(I)!=null})),w=!1;try{D.default.mkdirSync(f,{recursive:!0});for(let[T,R]of Object.entries(s.writes)){let E=F.default.join(f,de(T));D.default.mkdirSync(F.default.dirname(E),{recursive:!0}),D.default.writeFileSync(E,R)}D.default.writeFileSync(F.default.join(f,l),ri(s.nextLock));for(let T of x){if(!T.existed)continue;let R=F.default.join(m,T.path);D.default.mkdirSync(F.default.dirname(R),{recursive:!0}),D.default.copyFileSync(F.default.join(this.root,T.path),R)}let I=F.default.join(h,"journal.json"),A={schemaVersion:1,state:"prepared",paths:x,renames:s.renames||[]};D.default.writeFileSync(I,`${JSON.stringify(A)}
26
- `),D.default.writeFileSync(I,`${JSON.stringify({...A,state:"committing"})}
27
- `);let B=0,_=new Set;for(let T of s.renames||[]){let R=de(T.from),E=de(T.to);c.beforeCommitFile?.(E,B);try{D.default.unlinkSync(F.default.join(this.root,R))}catch(O){if($e(O)!=="ENOENT")throw O}let ne=F.default.join(this.root,E);D.default.mkdirSync(F.default.dirname(ne),{recursive:!0}),D.default.renameSync(F.default.join(f,E),ne),_.add(E),B+=1}for(let T of Object.keys(s.writes)){if(_.has(T))continue;c.beforeCommitFile?.(T,B);let R=F.default.join(this.root,T);D.default.mkdirSync(F.default.dirname(R),{recursive:!0}),D.default.renameSync(F.default.join(f,T),R),B+=1}for(let T of s.deletes||[]){c.beforeCommitFile?.(T,B);try{D.default.unlinkSync(F.default.join(this.root,de(T)))}catch(R){if($e(R)!=="ENOENT")throw R}B+=1}return c.beforeCommitFile?.(l,B),D.default.renameSync(F.default.join(f,l),F.default.join(this.root,l)),D.default.writeFileSync(I,`${JSON.stringify({...A,state:"committed"})}
28
- `),w=!0,s.nextLock}catch(I){try{for(let A of x){let B=F.default.join(this.root,A.path);if(A.existed){let _=F.default.join(m,A.path);D.default.mkdirSync(F.default.dirname(B),{recursive:!0}),D.default.copyFileSync(_,B)}else try{D.default.unlinkSync(B)}catch(_){if($e(_)!=="ENOENT")throw _}}Gr(this.root,h,s.renames),w=!0}catch(A){throw new P(`Update failed and rollback could not complete; recovery data was preserved at ${h}: ${_t(A)}`)}throw I}finally{w&&D.default.rmSync(h,{recursive:!0,force:!0})}}finally{u()}}};0&&(module.exports={AdoptionConflictError,ApplicationAdoption,COMPONENT_DELETED,adoptionDigest,deletedComponentLocation,deletedComponentMessage,deletedComponentsForLock,deletedPinMessage,deletedVersionIds,hashContent,parseApplicationLock,serializeApplicationLock,threeWayMerge,validateInstallationPath,withdrawalWarningsForLock});
21
+ `:`module.exports = ${o};
22
+ `}function Vn(s,r){let o=rt.join(s,"frontfriend.config.js");if(!r||!js(o))return!1;let u=fi(o),{config:l,expression:p}=pi(u);if(l["api-url"]||l.apiUrl)return!1;let h=[...p.properties.map(f=>u.slice(f.start,f.end)),`${JSON.stringify("api-url")}: ${JSON.stringify(String(r).replace(/\/+$/,""))}`];return di(o,mi(s,h)),!0}function Dn(s,r){let o=rt.join(s,"frontfriend.config.js"),u=fi(o),{expression:l}=pi(u),p=Vs(r),h=`${JSON.stringify("adopt")}: ${JSON.stringify(p)}`,f=l.properties.map(m=>Dt(m)==="adopt"?h:u.slice(m.start,m.end));return l.properties.some(m=>Dt(m)==="adopt")||f.push(h),di(o,mi(s,f)),p}Fs.exports={defaultAppName:Ln,writeSetupConfig:jn,writeConfigApiUrl:Vn,writeConfigAdopt:Dn}});var Us=_e((Sa,$s)=>{var Bs=require("path"),{createRequire:Fn}=require("module"),Ft;function Mn(s){if(Ft)return Ft;let r=[null,s&&Bs.isAbsolute(s)?s:null,Bs.join(process.cwd(),"package.json")];for(let u of r)try{return Ft=u?Fn(u)("typescript"):require("typescript"),Ft}catch{}let o=new Error("Reading component source or build configuration needs TypeScript: install it in the Application (npm i -D typescript).");throw o.code="FF_TYPESCRIPT_UNAVAILABLE",o}$s.exports={loadTypeScript:Mn}});var Hs=_e((Ca,Ws)=>{var ka=require("path"),{loadTypeScript:Bn}=Us(),Mt={ui:"@/components/ui",components:"@/components",utils:"@/lib/utils",lib:"@/lib",hooks:"@/hooks"};function gi(s,r){if(r.endsWith(".vue"))return[...s.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)].flatMap(h=>{let f=h.index+h[0].indexOf(">")+1;return gi(h[1],`${r}.ts`).map(m=>({...m,start:m.start+f,end:m.end+f}))});let o=Bn(r),u=o.createSourceFile(r,s,o.ScriptTarget.Latest,!0,r.endsWith(".tsx")?o.ScriptKind.TSX:o.ScriptKind.TS),l=[],p=h=>{let f=o.isImportDeclaration(h)||o.isExportDeclaration(h)?h.moduleSpecifier:o.isCallExpression(h)&&(h.expression.kind===o.SyntaxKind.ImportKeyword||h.expression.getText(u)==="require")?h.arguments[0]:null;f&&o.isStringLiteral(f)&&l.push({value:f.text,start:f.getStart(u),end:f.end}),o.forEachChild(h,p)};return p(u),l}function qs(s,r,o,u){let l=gi(s,r).map(h=>{let f=h.value.replace(/^@\/registry\/(?:bases\/)?[^/]+\/(ui|lib|hooks|components)\//,(m,x)=>`${Mt[x]}/`);for(let[m,x]of Object.entries(o).sort((w,I)=>String(I[1]).length-String(w[1]).length))if(Mt[m]&&(f===x||f.startsWith(`${x}/`))){f=Mt[m]+f.slice(x.length);break}return{...h,normalized:f}}),p=s;for(let h of l.reverse())(u||h.value!==h.normalized)&&(p=p.slice(0,h.start)+JSON.stringify(h.normalized)+p.slice(h.end));return u?p.replace(/\r\n/g,`
23
+ `):p}function $n(s,r,o={}){return qs(s,r,o,!0)}function Un(s,r={}){return qs(s.content,s.path,r,!1)}Ws.exports={PORTABLE_ALIASES:Mt,importStrings:gi,normalizedSource:$n,normalizeNativeImports:Un}});var Js=_e((Ia,Gs)=>{var ge=require("fs"),G=require("path"),{normalizeAdopt:qn,ADOPTION_LEVELS:Wn}=hi(),{readJsonc:Hn}=oi(),{defaultAppName:zn}=Ms(),{PORTABLE_ALIASES:vi,importStrings:$t,normalizedSource:mt}=Hs(),{readProjectPaths:zs,resolveConfiguredAlias:Gn}=(dt(),lt(Lt));function Ut(s){try{return Hn(s)}catch{throw new Error(`Cannot read ${s}.`)}}function Ge(s,r){let o=G.relative(s,r);if(!o||o.startsWith(`..${G.sep}`)||o===".."||G.isAbsolute(o))throw new Error(`Source must stay inside the Application: ${r}`);if(ge.existsSync(r)&&ge.realpathSync(r)!==G.join(ge.realpathSync(s),o))throw new Error(`Linked source cannot be imported: ${o}`);return o.replace(/\\/g,"/")}function Bt(s,r,o){let u=Gn(s,r,o);return Ge(s,u),u}function Jn(s,r,o,u={},l=r){let p=mt(s,r,u);for(let h of $t(p,r).reverse()){if(h.value.startsWith("@frontfriend-local/")){let m=h.value.slice(19);if(!m||m.split("/").some(w=>w===".."||w==="."))throw new Error("Unsafe local source dependency.");let x=G.posix.relative(G.posix.dirname(l),m);x.startsWith(".")||(x=`./${x}`),p=p.slice(0,h.start)+JSON.stringify(x)+p.slice(h.end);continue}let f=Object.entries(vi).sort((m,x)=>x[1].length-m[1].length).find(([m,x])=>o[m]&&(h.value===x||h.value.startsWith(`${x}/`)));f&&(p=p.slice(0,h.start)+JSON.stringify(o[f[0]]+h.value.slice(f[1].length))+p.slice(h.end))}return p}function xi(s){return ge.existsSync(s)?ge.readdirSync(s,{withFileTypes:!0}).sort((r,o)=>r.name.localeCompare(o.name)).flatMap(r=>{let o=G.join(s,r.name);if(r.isSymbolicLink())throw new Error(`Linked source cannot be imported: ${o}`);return r.isDirectory()?xi(o):/\.(?:[cm]?[jt]sx?|vue|css)$/.test(r.name)?[o]:[]}):[]}function Kn(s,r,o){let{materializeInstallationPath:u}=(dt(),lt(Lt)),l=zs(s),p=r.aliases||{},h=Bt(s,p.ui||"@/components/ui",l);if(!ge.existsSync(h)||!ge.statSync(h).isDirectory())throw new Error("The configured UI directory does not exist. Check components.json and TypeScript aliases before import.");let f=new Map((o.canonical||[]).map(a=>[a.canonicalName,a])),m=new Map([...f.values()].flatMap(a=>(a.files||[]).map(b=>[b.path,b]))),x=["",".ts",".tsx",".js",".jsx",".vue","/index.ts","/index.tsx"],w=a=>{let b=a.replace(/\.(?:[cm]?[jt]sx?)$/,"");return b.startsWith("ui/")?`@/components/${b}`:/^(lib|hooks|components)\//.test(b)?`@/${b}`:`@frontfriend-local/${a}`},I=a=>{let b=mt(a.content,a.path,{});for(let j of $t(b,a.path).reverse()){let V=j.value.startsWith(".")?G.posix.normalize(G.posix.join(G.posix.dirname(a.path),j.value)):j.value.startsWith("@/components/ui/")?j.value.slice(13):j.value.startsWith("@/")?j.value.slice(2):null,W=V&&x.map(Y=>V+Y).find(Y=>m.has(Y));W&&(b=b.slice(0,j.start)+JSON.stringify(w(W))+b.slice(j.end))}return b},A=new Map,B=new Map,_={...Ut(G.join(s,"package.json")).devDependencies,...Ut(G.join(s,"package.json")).dependencies},T=(a,b)=>({source:Ge(s,a),target:b,content:ge.readFileSync(a,"utf8")}),R=(a,b,j=f.get(a))=>{let V={name:a,files:b,standard:j,dependencies:new Set,npm:new Set};A.set(a,V);for(let W of b){let Y=B.get(W.source);if(Y&&Y!==a)throw new Error(`Source has two component owners: ${W.source}`);B.set(W.source,a)}return V},E=new Map;for(let a of xi(h)){let b=G.relative(h,a).replace(/\\/g,"/"),j=(b.includes("/")?b.split("/")[0]:b.replace(/\.[^.]+$/,"")).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase(),V=E.get(j)||[];V.push(T(a,`ui/${b}`)),E.set(j,V)}for(let[a,b]of E)R(a,b);for(let[a,b]of f){if(A.has(a)||!b.files?.length||b.files.some(V=>V.path.startsWith("ui/")))continue;let j=b.files.map(V=>({file:V,relative:u({root:s,source:"canonical",path:V.path,installationLayout:"shadcn"})}));j.every(V=>ge.existsSync(G.join(s,V.relative)))&&R(a,j.map(V=>T(G.join(s,V.relative),V.file.path)),b)}let ae=a=>{let b=Ge(s,a);for(let[j,V]of Object.entries(p).sort((W,Y)=>String(Y[1]).length-String(W[1]).length)){if(!vi[j])continue;let W=Bt(s,V,l);if(j==="utils"&&a===W+G.extname(a))return`lib/utils${G.extname(a)}`;if(a.startsWith(`${W}${G.sep}`))return`${j}/${G.relative(W,a).replace(/\\/g,"/")}`}return b},O=(a,b)=>{let j=mt(`import ${JSON.stringify(a)}`,b.source,p).slice(7).trim(),V=JSON.parse(j),W=Object.keys(l.paths).some(ee=>a.startsWith(ee.split("*")[0]));if(!a.startsWith(".")&&!V.startsWith("@/")&&!W)return null;let Y=a.startsWith(".")?G.resolve(s,G.dirname(b.source),a):Bt(s,a,l),q=x.map(ee=>Y+ee).find(ee=>ge.existsSync(ee)&&ge.statSync(ee).isFile());if(!q)throw new Error(`Missing local dependency ${a} in ${b.source}.`);return q};for(let a of A.values()){for(let b of a.files){let j=[];for(let W of $t(b.content,b.source)){let Y=O(W.value,b);if(!Y){let se=W.value.startsWith("@")?W.value.split("/").slice(0,2).join("/"):W.value.split("/")[0];_[se]&&a.npm.add(`${se}@${_[se]}`);continue}let q=Ge(s,Y),ee=B.get(q);if(!ee){let se=ae(Y);if(ee=`support/${se.replace(/\.[^.]+$/,"").replace(/[^a-z0-9/_-]/gi,"-").toLowerCase()}`,A.has(ee))throw new Error(`Source address collision: custom/${ee}`);R(ee,[T(Y,se)],null)}ee!==a.name&&a.dependencies.add(ee);let xe=A.get(ee).files.find(se=>se.source===q),nt=w(xe.target);j.push({...W,value:nt})}let V=b.content;for(let W of j.reverse())V=V.slice(0,W.start)+JSON.stringify(W.value)+V.slice(W.end);b.portable=mt(V,b.source,p)}a.identical=!!(a.standard&&a.files.length===a.standard.files.length&&a.files.every(b=>{let j=a.standard.files.find(V=>V.path===b.target);return j&&b.portable===I(j)}))}return[...A.values()].filter(a=>!a.identical).map(a=>({name:a.name,address:`custom/${a.name}`,semver:"1.0.0",changelog:"Import the existing Application source.",...a.standard?{replacesCanonical:a.standard.canonicalName}:{},installationLayout:"shadcn",sourceAliases:vi,files:a.files.map(({portable:b,...j})=>({...j,content:b})),npmDependencies:[...a.npm].sort(),componentRequirements:[...a.dependencies].sort().map(b=>{let j=A.get(b);return j.standard&&j.identical?{kind:"canonical",name:j.standard.canonicalName,range:"*",framework:o.projectTarget.framework,primitive:o.projectTarget.primitive}:{kind:"private",name:`custom/${b}`,range:"1.0.0"}})}))}async function Qn({config:s,client:r,dryRun:o=!1}){let u=qn(s.adopt)||Wn,l=Ut(G.join(s.appRoot,"components.json")),p={appName:s.name||zn(s.appRoot),framework:s.framework,primitive:s.primitive,style:l.style,adopt:u},h=await r.importShadcn({phase:"prepare",...p});if(h.initialized)return{...h,skipped:!0};let f=h.release;if(!f?.releaseId||f.baseLibrary!=="shadcn")throw new Error("Initial import requires a pinned shadcn Release.");if(f.projectTarget.framework!==s.framework||f.projectTarget.primitive!==s.primitive)throw new Error("Import target differs from the pinned shadcn Release.");if(f.baseProvenance?.style&&f.baseProvenance.style!==l.style)throw new Error("Import style differs from the pinned shadcn Release.");let m=l.tailwind?.css,x="";if(u.includes("tokens")){if(!m)throw new Error("components.json must declare tailwind.css for native token import.");let I=G.resolve(s.appRoot,m);Ge(s.appRoot,I),x=ge.readFileSync(I,"utf8")}let w={phase:"complete",...p,sourceReleaseId:f.releaseId,themeCss:x,componentsJson:l,components:u.includes("components")?Kn(s.appRoot,l,f):[]};return o?{dryRun:!0,payload:w}:r.importShadcn(w)}function Yn(s,r){let{materializeInstallationPath:o}=(dt(),lt(Lt)),u=Ut(G.join(s.appRoot,"components.json")),l=Bt(s.appRoot,u.aliases?.ui||"@/components/ui",zs(s.appRoot)),p=new Map(xi(l).map(h=>{let f=G.relative(l,h).replace(/\\/g,"/"),m=Ge(s.appRoot,h);return[m,{path:m,target:`ui/${f}`,component:f.split("/")[0].replace(/\.[^.]+$/,""),content:ge.readFileSync(h,"utf8")}]}));for(let h of[...r.canonical||[],...r.private||[]])for(let f of h.files||[]){let m=o({root:s.appRoot,source:h.kind,path:f.path,configuredUiPath:s.aliases?.ui,installationLayout:h.installationLayout||(h.source==="shadcn"?"shadcn":void 0)}),x=G.join(s.appRoot,m);ge.existsSync(x)&&(Ge(s.appRoot,x),p.set(m,{path:m,target:f.path,component:h.address||h.canonicalName,content:ge.readFileSync(x,"utf8")}))}return[...p.values()]}Gs.exports={importShadcnApplication:Qn,collectNativeMigrationFiles:Yn,normalizedSource:mt,materializeSource:Jn,importStrings:$t,inside:Ge}});var na={};Qt(na,{AdoptionConflictError:()=>P,ApplicationAdoption:()=>wi,COMPONENT_DELETED:()=>Wt,adoptionDigest:()=>tt,deletedComponentLocation:()=>ki,deletedComponentMessage:()=>sa,deletedComponentsForLock:()=>Xs,deletedPinMessage:()=>Zs,deletedVersionIds:()=>xt,hashContent:()=>de,parseApplicationLock:()=>ze,serializeApplicationLock:()=>ni,threeWayMerge:()=>Yt,validateInstallationPath:()=>ve,withdrawalWarningsForLock:()=>ra});module.exports=lt(na);var Si=et(require("node:crypto")),F=et(require("node:fs")),D=et(require("node:path"));Pt();function He(s){return s&&typeof s=="object"&&"code"in s?String(s.code):void 0}function Rt(s){return s instanceof Error?s.message:String(s)}var P=class extends Error{constructor(o,u=[]){super(o);this.code="ADOPTION_CONFLICT";this.name="AdoptionConflictError",this.conflicts=u}};Pt();var as=et(require("node:crypto")),Mr=2e6,rs=1e5;function de(s){return as.default.createHash("sha256").update(Buffer.from(s)).digest("hex")}function ht(s){return String(s).match(/.*(?:\n|$)/g).filter(r=>r!=="")}function ns(s,r){let o=ht(s),u=ht(r),l=Array.from({length:o.length+1},()=>new Uint32Array(u.length+1));for(let w=o.length-1;w>=0;w-=1)for(let I=u.length-1;I>=0;I-=1)l[w][I]=o[w]===u[I]?l[w+1][I+1]+1:Math.max(l[w+1][I],l[w][I+1]);let p=[],h=0,f=0,m=null,x=()=>{m&&p.push(m),m=null};for(;h<o.length||f<u.length;)h<o.length&&f<u.length&&o[h]===u[f]?(x(),h+=1,f+=1):f<u.length&&(h===o.length||l[h][f+1]>l[h+1][f])?(m||={start:h,end:h,replacement:[]},m.replacement.push(u[f]),f+=1):(m||={start:h,end:h,replacement:[]},h+=1,m.end=h);return x(),{base:o,hunks:p}}function Br(s,r){return s.start===s.end&&r.start===r.end?s.start===r.start:s.start===s.end?s.start>=r.start&&s.start<r.end:r.start===r.end?r.start>=s.start&&r.start<s.end:s.start<r.end&&r.start<s.end}function Yt(s,r,o){let u=ht(s).length,l=Math.max(ht(r).length,ht(o).length);if(u>rs||l>rs||(u+1)*(l+1)>Mr)return null;let p=ns(s,r),h=ns(s,o),f=[...p.hunks];for(let w of h.hunks){let I=f.find(A=>Br(A,w));if(I){if(I.start===w.start&&I.end===w.end&&I.replacement.join("")===w.replacement.join(""))continue;return null}f.push(w)}let m="",x=0;for(let w of f.sort((I,A)=>I.start-A.start||I.end-A.end))m+=p.base.slice(x,w.start).join(""),m+=w.replacement.join(""),x=w.end;return m+p.base.slice(x).join("")}var{isSafeSlug:Kr}=ii();function Le(s){return Object.fromEntries(Object.entries(s).sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>[r,o&&typeof o=="object"&&!Array.isArray(o)?{...o,...Array.isArray(o.files)?{files:[...o.files].sort((u,l)=>u.path.localeCompare(l.path))}:{}}:o]))}function ft(s){return Array.isArray(s)?s.map(ft):s&&typeof s=="object"?Object.fromEntries(Object.keys(s).filter(r=>r!=="adoptionDigest").sort().map(r=>[r,ft(s[r])])):s}var si=(s,r)=>s<r?-1:s>r?1:0;function ls(s){return[...s].sort((r,o)=>si(r.slug,o.slug)||si(r.kind,o.kind))}function ri(s){return{...s,contracts:ls(s.contracts),sharedContracts:ls(s.sharedContracts)}}function Qr(s){return{...s,...s.design?{design:ri(s.design)}:{},...Array.isArray(s.sourceReleaseIds)?{sourceReleaseIds:[...new Set(s.sourceReleaseIds)].sort(si)}:{},...s.components?{components:Object.fromEntries(Object.entries(s.components).map(([r,o])=>[r,Array.isArray(o?.files)?{...o,files:[...o.files].sort((u,l)=>u.path.localeCompare(l.path))}:o]))}:{}}}function tt(s){return de(JSON.stringify(ft(Qr(s))))}function Yr(s){return de(JSON.stringify(ft(s)))}function Xr(s){return typeof s.adoptionDigest=="string"&&(tt(s)===s.adoptionDigest||Yr(s)===s.adoptionDigest)}function hs(s,r){return tt(s)===tt(r)}function ps(s){let r=s;if(!r||![1,2,3].includes(Number(r.schemaVersion))||typeof r.components!="object"||r.components===null)throw new P("Unsupported or malformed frontfriend.lock.json.");let o=Object.fromEntries(Object.entries(r.components).map(([f,m])=>{let x=m;if(!x||!["canonical","private"].includes(String(x.source))||typeof x.versionId!="string"||typeof x.semver!="string")throw new P(`Unsupported source kind for ${f}.`);return[f,x]})),u={releaseId:r.releaseId==null?null:String(r.releaseId),tokenVersionId:String(r.tokenVersionId),projectTarget:r.schemaVersion===3&&r.projectTarget===null&&Object.keys(o).length===0?null:we(r.projectTarget,"Application lock target"),components:o};for(let f of Object.values(o)){if(!f.projectTarget)continue;let m=we(f.projectTarget,"Component adoption target");if(!u.projectTarget||m.framework!==u.projectTarget.framework||m.primitive!==u.projectTarget.primitive)throw new P("Component adoption belongs to another Project target.")}if(r.schemaVersion===1)return{...u,projectTarget:we(r.projectTarget,"Application lock target"),schemaVersion:1,components:o};if(typeof r.designSystemId!="string"||!r.designSystemId||typeof r.ffId!="string"||!r.ffId||typeof r.adoptionDigest!="string"||!r.adoptionDigest||typeof r.tokenSourceReleaseId!="string"||!r.tokenSourceReleaseId||!Array.isArray(r.sourceReleaseIds))throw new P("Malformed v2 Frontfriend adoption snapshot.");let l={...u,schemaVersion:r.schemaVersion===3?3:2,...r.schemaVersion===3?{design:r.design}:{},designSystemId:r.designSystemId,ffId:r.ffId,...r.baseLibrary!==void 0?{baseLibrary:r.baseLibrary}:{},...r.baseProvenance!==void 0?{baseProvenance:r.baseProvenance}:{},...r.replacements!==void 0?{replacements:r.replacements}:{},adoptionDigest:r.adoptionDigest,tokenSourceReleaseId:r.tokenSourceReleaseId,sourceReleaseIds:[...new Set(r.sourceReleaseIds.map(String))].sort(),components:o};if(l.baseLibrary!==void 0&&!["frontfriend","shadcn"].includes(l.baseLibrary))throw new P("Unsupported base library in Application lock.");if(l.schemaVersion===3){let f=l.design;if(!f||f.designSystemId!==l.designSystemId||!f.appId||!f.snapshotId||!f.sharedSourceReleaseId||!Array.isArray(f.contracts)||!Array.isArray(f.sharedContracts))throw new P("Malformed Application design adoption.");let m=[...f.sharedContracts,...f.contracts];if(new Set(m.map(w=>w.slug)).size!==m.length||m.some(w=>w.designSystemId!==l.designSystemId||!w.revisionId||!w.contractId||!Kr(w.slug)||!w.slug.endsWith(".md")||!Number.isInteger(w.version)||w.version<1||!/^[a-f0-9]{64}$/.test(w.digest)))throw new P("Invalid contract revision pins in the Application lock.");if(f.sharedContracts.some(w=>!["guidelines","design-context","guideline-chapter","layout","pattern"].includes(w.kind))||f.contracts.some(w=>!["app-context","page"].includes(w.kind)))throw new P("Contract pins have invalid shared or App ownership.");if(de(JSON.stringify(ft({schemaVersion:1,appId:f.appId,sharedSourceReleaseId:f.sharedSourceReleaseId,contracts:[...f.contracts].sort((w,I)=>w.slug.localeCompare(I.slug))})))!==f.snapshotDigest)throw new P("Application design snapshot digest does not match its manifest.")}else if(r.design!==void 0)throw new P("Contract pins require a schema version 3 Application lock.");let p=Object.values(l.components).map(f=>{if(typeof f.sourceReleaseId!="string"||!f.sourceReleaseId)throw new P("Every v2 component adoption must identify its immutable source Release.");return f.sourceReleaseId}),h=[...new Set([l.tokenSourceReleaseId,...p,...l.design?[l.design.sharedSourceReleaseId]:[]])].sort();if(JSON.stringify(h)!==JSON.stringify(l.sourceReleaseIds))throw new P("The adoption source Releases do not match the token and component provenance.");if(l.releaseId&&(h.length!==1||h[0]!==l.releaseId))throw new P("A lock may reference a Release only when its complete closure matches that Release.");if(!Xr(l))throw new P("The adoption snapshot digest does not match its manifest.");return l}function ze(s){try{return ps(typeof s=="string"?JSON.parse(s):s)}catch(r){throw r instanceof P?r:new P(`Invalid frontfriend.lock.json: ${r instanceof Error?r.message:String(r)}`)}}function ni(s){let r=ps(s);return`${JSON.stringify({...r,components:Le(r.components)},null,2)}
24
+ `}dt();function tn(s){let r=s.projectTarget;return(s.replacements||[]).filter(o=>!r||o.framework===r.framework&&o.primitive===r.primitive)}function ws(s){let r=tn(s),o=new Map(r.map(l=>[`${l.framework}/${l.primitive}/${l.canonicalName}`,l.privateAddress]));for(let l of r)if(!(s.private||[]).some(p=>p.address===l.privateAddress))throw new Error(`Replacement ${l.privateAddress} is absent from the selected Release.`);let u=new Set;return(s.installOrder||[...s.canonical||[],...s.private||[]]).filter(l=>{let p=s.projectTarget;if(l.projectTarget&&p&&(l.projectTarget.framework!==p.framework||l.projectTarget.primitive!==p.primitive)||l.kind==="canonical"&&o.has(`${l.framework}/${l.primitive}/${l.canonicalName}`))return!1;let h=sn(l);return u.has(h)?!1:(u.add(h),!0)})}function sn(s){return s.kind==="private"?`private:${s.address}`:`canonical:${s.framework}/${s.primitive}/${s.canonicalName}`}var{planMirrorResponse:Xn,readMirrorTree:Zn,validatePinnedMirror:ea,MIRROR_DIR:qt}=ii(),{materializeSource:ta}=Js(),ia=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i;function ve(s){if(typeof s!="string"||!s||s.includes("\0"))throw new P("Installation paths must be non-empty and contain no null bytes.");let r=s.replace(/\\/g,"/"),o=r.split("/");if(D.default.posix.isAbsolute(r)||/^[A-Za-z]:\//.test(r)||o.some(u=>!u||u==="."||u==="..")||o.some(u=>ia.test(u)))throw new P(`Unsafe installation path: ${s}`);return r}function bi(s){return s.kind==="private"?s.address:s.canonicalName}function yi(s){return s.kind==="private"?"private":"canonical"}function vt(s){return ws(s)}var Wt="COMPONENT_DELETED";function xt(s,r=[]){let o=new Set(r);for(let u of s)for(let l of u?.warnings??[])l?.reason===Wt&&typeof l.versionId=="string"&&o.add(l.versionId);return o}function Xs(s,r){if(!s)return[];let o=ze(s),u=r instanceof Set?r:xt(r);return Object.entries(o.components).filter(([,l])=>l.source==="private"&&u.has(l.versionId)).map(([l,p])=>({component:l,versionId:p.versionId,semver:p.semver,paths:(p.files||[]).map(h=>h.path).sort()})).sort((l,p)=>l.component.localeCompare(p.component))}function ki(s){if(s.length<=1)return s[0]??"";let r=s.map(l=>D.default.posix.dirname(l).split("/")),o=[];for(let[l,p]of r[0].entries()){if(r.some(h=>h[l]!==p))break;o.push(p)}let u=o.join("/");return u&&u!=="."?u:s.join(", ")}function sa(s){return s.paths.length?`${s.component} was deleted from the design system. Its files in ${ki(s.paths)} were kept; remove them and their imports if you no longer use them.`:`${s.component} was deleted from the design system. Remove its imports if you no longer use it.`}function Zs(s){let r=ki(s.paths);return`${s.component}@${s.semver} was deleted from the design system. Run \`frontfriend update\` to drop it from frontfriend.lock.json${r?`; its files in ${r} stay until you remove them and their imports.`:"."}`}function ra(s,r){let o=ze(s),u=new Map(Object.entries(o.components).map(([p,h])=>[h.versionId,p])),l=new Map;for(let p of r){for(let h of p.warnings??[]){let f=u.get(h.versionId);if(!(!f||h.code!=="WITHDRAWN_HISTORICAL_VERSION"||h.severity!=="urgent")){if(h.reason===Wt){let m=o.components[f];l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,reason:Wt,message:Zs({component:f,versionId:m.versionId,semver:m.semver,paths:(m.files||[]).map(x=>x.path).sort()})});continue}l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,message:`${f}@${o.components[f].semver} is withdrawn: ${h.message}${h.correctedVersionId?` Use corrected version ${h.correctedVersionId}.`:""}`})}}for(let h of vt(p)){let f=u.get(h.id);if(!f||!h.withdrawnAt)continue;let m=`${f}@${h.semver} is withdrawn${h.withdrawalReason?`: ${h.withdrawalReason}.`:"."}${h.correctedVersionId?` Use corrected version ${h.correctedVersionId}.`:""}`;l.set(h.id,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.id,message:m})}}return[...l.values()].sort((p,h)=>p.identity.localeCompare(h.identity))}function Ks(s){if(!s.designSystemId||!s.ffId||!s.releaseId||!s.tokenVersionId)throw new P("Resolved Releases must include their Release, token, Design System id and ff-id.")}function gt(s){return`${s.framework}/${s.primitive}/${s.canonicalName}`}function er(s,r,o=xt([r])){if(r.contractsOnly||s.tokenVersionId!==r.tokenVersionId||"baseLibrary"in s&&s.baseLibrary!==(r.baseLibrary||"frontfriend")||"baseProvenance"in s&&JSON.stringify(Le(s.baseProvenance||{}))!==JSON.stringify(Le(r.baseProvenance||{})))return!1;let u=new Map(vt(r).map(m=>[bi(m),m.id])),l=new Set(Object.entries(s.components).filter(([m,x])=>x.source==="private"&&o.has(x.versionId)&&!u.has(m)).map(([m])=>m)),p=(m=[])=>Le(Object.fromEntries(m.filter(x=>!l.has(x.privateAddress)).map(x=>[gt(x),x.privateAddress])));if("replacements"in s&&JSON.stringify(p(s.replacements))!==JSON.stringify(p(r.replacements))||s.schemaVersion!==1&&s.sourceReleaseIds.some(m=>m!==r.releaseId))return!1;if(s.schemaVersion!==1&&s.design){if(s.design.sharedSourceReleaseId!==r.releaseId||JSON.stringify(Le(Object.fromEntries(s.design.sharedContracts.map(m=>[m.slug,m]))))!==JSON.stringify(Le(Object.fromEntries((r.contracts??[]).map(m=>[m.slug,m])))))return!1}else if(r.contracts!==void 0)return!1;let h=Object.entries(s.components).filter(([m])=>!l.has(m)),f="replacements"in s?(s.replacements||[]).filter(m=>l.has(m.privateAddress)).map(m=>m.canonicalName).filter(m=>!s.components[m]):[];for(let m of f)u.delete(m);return h.length===u.size&&h.every(([m,x])=>u.get(m)===x.versionId)}function Qs(s,r,o){if(!r.contractsOnly&&s&&s.schemaVersion!==1&&s.releaseId===r.releaseId&&!er(s,r,o))throw new P("The same immutable Release cannot resolve to a different token or component closure.")}function Ys(s,r,o=[]){for(let u of[...o].reverse()){let l=D.default.join(s,ve(u.from)),p=D.default.join(s,ve(u.to));if(!F.default.existsSync(p))continue;let h=D.default.join(r,`case-rollback-${Si.default.randomBytes(6).toString("hex")}`);F.default.renameSync(p,h),F.default.mkdirSync(D.default.dirname(l),{recursive:!0}),F.default.renameSync(h,l)}}var wi=class{constructor(r={}){this.root=D.default.resolve(r.root||process.cwd()),this.canonicalUiPath=r.canonicalUiPath??null,this.usesFilesystem=!r.readFile&&!r.writeFile,this.mutationLockDepth=0,this.mutationLockFd=null,this.readFile=r.readFile||(o=>{let u=D.default.join(this.root,ve(o));try{return F.default.readFileSync(u,"utf8")}catch(l){if(He(l)==="ENOENT")return null;throw l}}),this.writeFile=r.writeFile||((o,u)=>{let l=D.default.join(this.root,ve(o));F.default.mkdirSync(D.default.dirname(l),{recursive:!0}),F.default.writeFileSync(l,u)})}installationPath(r,o){return ve(ui({root:this.root,source:yi(r),path:ve(o),configuredUiPath:this.canonicalUiPath,installationLayout:r.installationLayout||(r.source==="shadcn"?"shadcn":void 0)}))}installationSource(r,o,u){if(r.source!=="shadcn"&&r.installationLayout!=="shadcn")return u;let l={};try{l=JSON.parse(F.default.readFileSync(D.default.join(this.root,"components.json"),"utf8")).aliases||{}}catch{}return ta(u,o,l,r.sourceAliases,this.installationPath(r,o))}acquireMutationLock(){if(!this.usesFilesystem)return()=>{};if(this.mutationLockDepth>0)return this.mutationLockDepth+=1,()=>{this.mutationLockDepth-=1};F.default.mkdirSync(this.root,{recursive:!0});let r=D.default.join(this.root,".frontfriend-update.lock"),o=l=>{try{let p=F.default.openSync(r,"wx");return F.default.writeFileSync(p,`${JSON.stringify({schemaVersion:1,pid:process.pid})}
25
+ `),p}catch(p){if(He(p)!=="EEXIST"||!l)throw p;let h;try{h=JSON.parse(F.default.readFileSync(r,"utf8"))}catch{throw new P("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.")}if(h?.schemaVersion!==1||!Number.isInteger(h.pid))throw new P("Another update holds an invalid mutation lock; remove it only after verifying no updater is active.");try{throw process.kill(h.pid,0),new P(`Another Frontfriend update is active (pid ${h.pid}).`)}catch(f){if(f instanceof P||He(f)!=="ESRCH")throw f}return F.default.unlinkSync(r),o(!1)}};try{this.mutationLockFd=o(!0)}catch(l){throw l instanceof P?l:new P(`Could not acquire the application update lock: ${Rt(l)}`)}this.mutationLockDepth=1;let u=!1;return()=>{u||(u=!0,this.mutationLockDepth-=1,this.mutationLockDepth===0&&(F.default.closeSync(this.mutationLockFd),this.mutationLockFd=null,F.default.unlinkSync(r)))}}recoverPendingTransactions(){if(this.usesFilesystem&&this.mutationLockDepth===0)throw new P("Recovery requires the exclusive application update lock.");if(F.default.existsSync(this.root))for(let r of F.default.readdirSync(this.root)){if(!/^\.frontfriend-transaction-\d+-[0-9a-f]{12}$/.test(r))continue;let o=D.default.join(this.root,r),u=D.default.join(o,"journal.json"),l;try{l=JSON.parse(F.default.readFileSync(u,"utf8"))}catch{throw new P(`Cannot recover ${r}: its transaction journal is missing or corrupt.`)}if(l?.schemaVersion!==1||!["prepared","committing","committed"].includes(l.state)||!Array.isArray(l.paths)||l.renames!=null&&!Array.isArray(l.renames))throw new P(`Cannot recover ${r}: invalid transaction journal.`);if(l.state==="committing"){for(let p of l.paths||[]){let h=ve(p.path),f=D.default.join(this.root,h),m=D.default.join(o,"backup",h);if(p.existed)F.default.mkdirSync(D.default.dirname(f),{recursive:!0}),F.default.copyFileSync(m,f);else try{F.default.unlinkSync(f)}catch(x){if(He(x)!=="ENOENT")throw x}}Ys(this.root,o,l.renames)}F.default.rmSync(o,{recursive:!0,force:!0})}}inspect(r,o={}){Ks(r);let u=we(r.projectTarget,"Resolved Release target"),l=null;if(o.currentLock){if(l=ze(o.currentLock),l.projectTarget&&De(l.projectTarget)!==De(u))throw new P("Project target mismatch between Release and lock.");if(l.schemaVersion!==1&&(l.designSystemId!==r.designSystemId||l.ffId!==r.ffId))throw new P("Design System mismatch between Release and lock.");Qs(l,r,xt([r],o.deletedVersionIds))}let p={},h=[],f=[];for(let m of vt(r)){let x=bi(m),w=l?.components?.[x]||null,I=m.files.map(R=>{let E=this.installationPath(m,R.path),ae=this.readFile(E);return{path:E,status:ae==null?"available":de(ae)===de(this.installationSource(m,R.path,R.content))?"exact":"drifted"}}),A=new Set(I.map(R=>R.status)),B=w&&(w.files||[]).some(R=>{let E=this.readFile(R.path);return E==null||de(E)!==R.baselineHash}),_=w&&w.versionId!==m.id,T=B?"drifted":_?"update-available":A.has("drifted")?"drifted":A.has("available")?"available":"exact";p[x]={source:yi(m),status:T,versionId:m.id,semver:m.semver,changelog:m.changelog,files:I},(!w||_)&&m.changelog&&!h.includes(m.changelog)&&h.push(m.changelog),m.withdrawnAt&&f.push(`${x}@${m.semver} is withdrawn${m.withdrawalReason?`: ${m.withdrawalReason}`:"."}${m.correctedVersionId?` Use corrected version ${m.correctedVersionId}.`:""}`)}return{releaseId:r.releaseId,tokenVersionId:r.tokenVersionId,projectTarget:u,token:{versionId:r.tokenVersionId,status:l?l.tokenVersionId===r.tokenVersionId?"exact":"update-available":"available"},components:p,changelogs:h,warnings:f}}diff(r){let o=ze(r),u=[];for(let[l,p]of Object.entries(o.components))for(let h of p.files||[]){let f=this.readFile(h.path);u.push({component:l,source:p.source,path:h.path,baselineHash:h.baselineHash,currentHash:f==null?null:de(f),status:f==null?"missing":de(f)===h.baselineHash?"unchanged":"modified"})}return u.sort((l,p)=>l.path.localeCompare(p.path))}planUpdate(r,o={}){Ks(r);let u=o.currentLock?ze(o.currentLock):null;if(r.contractsOnly&&(!o.design||o.components?.length!==0||vt(r).length))throw new P("Contract-only resolution requires an exact design selection and no incoming component source.");let l=r.contractsOnly?u?.projectTarget??null:we(r.projectTarget,"Resolved Release target");if(!r.contractsOnly&&l&&u?.projectTarget&&De(u.projectTarget)!==De(l))throw new P("Project target mismatch between config, Release and lock.");if(u&&u.schemaVersion!==1&&(u.designSystemId!==r.designSystemId||u.ffId!==r.ffId))throw new P("Design System mismatch between config, Release and lock.");let p=xt([r],o.deletedVersionIds);Qs(u,r,p);let h=o.components?new Set(o.components):null,f=new Set,m=u?{...u.components}:{},x={},w=new Set,I=[],A=[],B=new Set,_=[],T=[],R=[],E=[],ae=new Map,O=new Map,a=new Map;for(let[S,$]of Object.entries(u?.components||{}))for(let te of $.files||[])a.set(te.path.toLocaleLowerCase("en-US"),S);for(let S of vt(r)){let $=bi(S);if(h&&!h.has($))continue;let te=u?.components?.[$]||null,Se=!te||te.versionId!==S.id,Oe=!1;if(S.kind==="private"&&r.capabilities?.freshPrivateSelection!==!0&&te?.versionId!==S.id){E.push({component:$,reason:"the current subscription permits only the exact private version already pinned in frontfriend.lock.json"});continue}if(S.kind==="canonical"&&!r.capabilities?.freshCanonicalSelection?.includes($)&&te?.versionId!==S.id){E.push({component:$,reason:"the current catalogue permits only the exact canonical version already pinned in frontfriend.lock.json"});continue}if(S.withdrawnAt&&te?.versionId!==S.id){E.push({component:$,reason:`${$}@${S.semver} is withdrawn and cannot be freshly installed${S.withdrawalReason?`: ${S.withdrawalReason}`:""}`});continue}let re=[];for(let Q of S.files){let H={...Q,content:this.installationSource(S,Q.path,Q.content)},z=this.installationPath(S,H.path),be=z.toLocaleLowerCase("en-US"),Ee=a.get(be);if(Ee&&Ee!==$){if(!o.allowReplacement){E.push({path:z,reason:`owned by ${Ee}; explicit replacement is required`});continue}let ie=m[Ee];if(ie){let Ke=(ie.files||[]).filter(Pe=>Pe.path.toLocaleLowerCase("en-US")!==be);Ke.length===0?delete m[Ee]:m[Ee]={...ie,files:Ke}}}let $e=ae.get(be),Je=O.get(be);if(Je&&Je!==$){E.push({path:z,reason:`also claimed by ${Je}`});continue}if($e&&$e!==z){E.push({path:z,reason:`case collision with ${$e}`});continue}ae.set(be,z),O.set(be,$);let oe=te?.files?.find(ie=>ie.path===z)||te?.files?.find(ie=>ie.path.toLocaleLowerCase("en-US")===be)||(o.allowReplacement&&Ee?u?.components?.[Ee]?.files?.find(ie=>ie.path.toLocaleLowerCase("en-US")===be):null),je=oe&&oe.path!==z&&oe.path.toLocaleLowerCase("en-US")===be;if(je&&D.default.posix.dirname(oe.path)!==D.default.posix.dirname(z)){E.push({path:z,reason:"case-only parent directory renames require an explicit filesystem migration"});continue}let ue=this.readFile(je?oe.path:z),Ue=oe?.baseline??null,ne=ue;if(ue==null)x[z]=H.content,ne=H.content;else if(oe)if(ue===H.content)ne=ue;else if(de(ue)===oe.baselineHash)x[z]=H.content,ne=H.content;else if(Ue===H.content)ne=ue;else{let ie=Ue==null?null:Yt(Ue,ue,H.content);ie==null?E.push({path:z,reason:"local and incoming source both changed"}):(ie!==ue&&(x[z]=ie),ne=ie)}else ue===H.content?ne=ue:o.allowReplacement?(x[z]=H.content,ne=H.content):E.push({path:z,reason:"unmanaged file already exists"});je&&ne!=null&&(x[z]=ne,I.push({from:oe.path,to:z})),ne!=null&&ne!==H.content&&(Oe=!0),x[z]===void 0&&ue!=null&&(ue===H.content?T.push(z):ne===ue&&R.push(z)),re.push({path:z,installedHash:ne==null?null:de(ne),baselineHash:de(H.content),baseline:H.content})}let Be=new Set(re.map(Q=>Q.path.toLocaleLowerCase("en-US")));for(let Q of te?.files||[]){if(Be.has(Q.path.toLocaleLowerCase("en-US")))continue;let H=this.readFile(Q.path);H!=null&&(de(H)===Q.baselineHash?w.add(Q.path):E.push({path:Q.path,reason:"removed upstream but modified locally"}))}m[$]={source:yi(S),versionId:S.id,semver:S.semver,manifestHash:S.digest,sourceReleaseId:r.releaseId,...S.projectTarget?{projectTarget:we(S.projectTarget,"Component Project target")}:{},files:re},f.add($),Se&&A.push(S.changelog);let fe=S.npmDependencies||[];if(fe.length&&(Se||!Oe)){let Q=Se&&!Oe;if(_.push({component:`${$}@${S.semver}`,dependencies:[...fe],required:Q}),Q)for(let H of fe)B.add(H)}}if(E.length>0)throw new P(`Update plan has conflicts; files and lock were not changed: ${E[0].reason}.`,E);let b=Xs(u,p).filter(S=>!f.has(S.component));for(let S of b)delete m[S.component];let j=!!h,V=j&&u&&!o.adoptTokens,W=V?u.tokenVersionId:r.tokenVersionId,Y=V&&(("tokenSourceReleaseId"in u?u.tokenSourceReleaseId:void 0)||u.releaseId)||r.releaseId,q=u&&u.schemaVersion!==1?u.design:void 0,ee=o.design??(j?q:void 0),xe=ee?ri(ee):void 0;if(!j&&r.contracts!==void 0&&!xe)throw new P("Select an exact Application design snapshot before adopting this Release.");if(!j&&q&&!xe)throw new P("A Release without contract pins cannot silently remove adopted contract pins.");if(xe&&xe.designSystemId!==r.designSystemId)throw new P("Design snapshot belongs to another Design System.");if(o.design&&JSON.stringify(Le(Object.fromEntries(o.design.sharedContracts.map(S=>[S.slug,S]))))!==JSON.stringify(Le(Object.fromEntries((r.contracts??[]).map(S=>[S.slug,S])))))throw new P("Design snapshot does not match the selected Release contract set.");let nt=[...new Set([Y,...xe?[xe.sharedSourceReleaseId]:[],...Object.values(m).map(S=>S.sourceReleaseId||u?.releaseId||r.releaseId)].filter(Boolean))].sort(),se=(r.replacements||[]).filter(S=>{let $=m[S.privateAddress],te=r.private?.find(Se=>Se.address===S.privateAddress);return S.framework===l?.framework&&S.primitive===l?.primitive&&$?.source==="private"&&$.sourceReleaseId===r.releaseId&&$.versionId===te?.id}),yt=new Set(se.map(gt)),Re=[...(u&&"replacements"in u?u.replacements||[]:[]).filter(S=>{let $=m[S.privateAddress],te=u?.components[S.privateAddress];return $?.source==="private"&&$.versionId===te?.versionId&&$.sourceReleaseId===te?.sourceReleaseId&&!f.has(S.privateAddress)&&!f.has(S.canonicalName)&&!yt.has(gt(S))}),...se].sort((S,$)=>gt(S).localeCompare(gt($))),ce={schemaVersion:xe?3:2,...xe?{design:xe}:{},...r.replacements!==void 0||u&&"replacements"in u?{replacements:Re}:{},designSystemId:r.designSystemId,ffId:r.ffId,...(V&&"baseLibrary"in u?u.baseLibrary:r.baseLibrary)?{baseLibrary:V&&"baseLibrary"in u?u.baseLibrary:r.baseLibrary}:{},...(V&&"baseProvenance"in u?u.baseProvenance:r.baseProvenance)?{baseProvenance:V&&"baseProvenance"in u?u.baseProvenance:r.baseProvenance}:{},releaseId:null,tokenVersionId:W,tokenSourceReleaseId:Y,sourceReleaseIds:nt,projectTarget:l,components:m,adoptionDigest:""};er(ce,r)&&(ce.releaseId=r.releaseId),ce.adoptionDigest=tt(ce);let bt=u&&u.schemaVersion!==1&&hs(u,ce)?JSON.parse(JSON.stringify(u)):ce;if(ze(bt),o.designMirror){let S=o.designMirror,$;try{$=ea(S,xe,r.ffId)}catch(re){throw new P(Rt(re))}let te=new Set([...Object.keys(Zn(D.default.join(this.root,qt))),...q?[...q.sharedContracts,...q.contracts].map(re=>re.slug):[],...$.map(re=>re.slug),"README.md"]),Se=Object.fromEntries([...te].flatMap(re=>{let Be=this.readFile(`${qt}/${re}`);return Be===null?[]:[[re,Be]]})),Oe=Xn(S,Se);for(let[re,Be]of Object.entries(Oe.writes)){let fe=ve(`${qt}/${re}`);if(x[fe]!==void 0||Object.values(m).some(Q=>Q.files?.some(H=>H.path===fe)))throw new P("A component cannot own a contract mirror path.");x[fe]=Be}for(let re of Oe.deletes)w.add(ve(`${qt}/${re}`))}else if(o.design&&(o.design.contracts.length||o.design.sharedContracts.length))throw new P("Fetch the exact contract mirror before applying a new design adoption.");return{valid:!0,writes:Le(x),deletes:[...w].filter(S=>!Object.keys(x).some($=>$.toLocaleLowerCase("en-US")===S.toLocaleLowerCase("en-US"))).sort(),renames:I.sort((S,$)=>S.from.localeCompare($.from)),nextLock:bt,changelogs:A.filter(Boolean),npmDependencies:[...B].sort(),npmDeclarations:_,unchanged:T.sort(),kept:R.sort(),removed:b}}apply(r,o={}){if(!r?.valid)throw new P("Only a validated update plan can be applied.");let u=this.mutationLockDepth===0?this.acquireMutationLock():()=>{};try{this.usesFilesystem&&this.recoverPendingTransactions();let l="frontfriend.lock.json",p=[...new Set([...Object.keys(r.writes),...r.deletes||[],...(r.renames||[]).flatMap(I=>[I.from,I.to]),l])],h=D.default.join(this.root,`.frontfriend-transaction-${process.pid}-${Si.default.randomBytes(6).toString("hex")}`),f=D.default.join(h,"stage"),m=D.default.join(h,"backup"),x=p.map(I=>({path:ve(I),existed:this.readFile(I)!=null})),w=!1;try{F.default.mkdirSync(f,{recursive:!0});for(let[T,R]of Object.entries(r.writes)){let E=D.default.join(f,ve(T));F.default.mkdirSync(D.default.dirname(E),{recursive:!0}),F.default.writeFileSync(E,R)}F.default.writeFileSync(D.default.join(f,l),ni(r.nextLock));for(let T of x){if(!T.existed)continue;let R=D.default.join(m,T.path);F.default.mkdirSync(D.default.dirname(R),{recursive:!0}),F.default.copyFileSync(D.default.join(this.root,T.path),R)}let I=D.default.join(h,"journal.json"),A={schemaVersion:1,state:"prepared",paths:x,renames:r.renames||[]};F.default.writeFileSync(I,`${JSON.stringify(A)}
26
+ `),F.default.writeFileSync(I,`${JSON.stringify({...A,state:"committing"})}
27
+ `);let B=0,_=new Set;for(let T of r.renames||[]){let R=ve(T.from),E=ve(T.to);o.beforeCommitFile?.(E,B);try{F.default.unlinkSync(D.default.join(this.root,R))}catch(O){if(He(O)!=="ENOENT")throw O}let ae=D.default.join(this.root,E);F.default.mkdirSync(D.default.dirname(ae),{recursive:!0}),F.default.renameSync(D.default.join(f,E),ae),_.add(E),B+=1}for(let T of Object.keys(r.writes)){if(_.has(T))continue;o.beforeCommitFile?.(T,B);let R=D.default.join(this.root,T);F.default.mkdirSync(D.default.dirname(R),{recursive:!0}),F.default.renameSync(D.default.join(f,T),R),B+=1}for(let T of r.deletes||[]){o.beforeCommitFile?.(T,B);try{F.default.unlinkSync(D.default.join(this.root,ve(T)))}catch(R){if(He(R)!=="ENOENT")throw R}B+=1}return o.beforeCommitFile?.(l,B),F.default.renameSync(D.default.join(f,l),D.default.join(this.root,l)),F.default.writeFileSync(I,`${JSON.stringify({...A,state:"committed"})}
28
+ `),w=!0,r.nextLock}catch(I){try{for(let A of x){let B=D.default.join(this.root,A.path);if(A.existed){let _=D.default.join(m,A.path);F.default.mkdirSync(D.default.dirname(B),{recursive:!0}),F.default.copyFileSync(_,B)}else try{F.default.unlinkSync(B)}catch(_){if(He(_)!=="ENOENT")throw _}}Ys(this.root,h,r.renames),w=!0}catch(A){throw new P(`Update failed and rollback could not complete; recovery data was preserved at ${h}: ${Rt(A)}`)}throw I}finally{w&&F.default.rmSync(h,{recursive:!0,force:!0})}}finally{u()}}};0&&(module.exports={AdoptionConflictError,ApplicationAdoption,COMPONENT_DELETED,adoptionDigest,deletedComponentLocation,deletedComponentMessage,deletedComponentsForLock,deletedPinMessage,deletedVersionIds,hashContent,parseApplicationLock,serializeApplicationLock,threeWayMerge,validateInstallationPath,withdrawalWarningsForLock});