@frontfriend/sdk 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,28 @@
1
- var Rr=Object.create;var Pt=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 Ee=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports),Yt=(s,r)=>{for(var o in r)Pt(s,o,{get:r[o],enumerable:!0})},es=(s,r,o,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of Tr(r))!Or.call(s,l)&&l!==o&&Pt(s,l,{get:()=>r[l],enumerable:!(c=Nr(r,l))||c.enumerable});return s};var Ze=(s,r,o)=>(o=s!=null?Rr(Lr(s)):{},es(r||!s||!s.__esModule?Pt(o,"default",{value:s,enumerable:!0}):o,s)),ht=s=>es(Pt({},"__esModule",{value:!0}),s);var ss={};Yt(ss,{ProjectTargetError:()=>He,SUPPORTED_PROJECT_TARGETS:()=>ts,assertMatchingProjectTargets:()=>is,defaultV4ProjectTarget:()=>Vr,parseProjectTarget:()=>we,projectTargetKey:()=>De,registryRoute:()=>Dr,resolveProjectTarget:()=>Fr});function De(s){return`${s.framework}/${s.primitive}`}function we(s,r="Project target"){let o=s,c=typeof o?.framework=="string"?o.framework.trim().toLowerCase():"",l=typeof o?.primitive=="string"?o.primitive.trim().toLowerCase():"",p=`${c}/${l}`;if(!c||!l||!jr.has(p))throw new He("INVALID_PROJECT_TARGET",`${r} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${p}.`,{framework:c||null,primitive:l||null});return{framework:c,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 He("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 He("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${r.map(([l,p])=>`${l}=${De(p)}`).join(", ")}.`,{targets:Object.fromEntries(r)});return r[0][1]}function Fr({persisted:s,configured:r,app:o,release:c,lock:l,proposed:p}={}){let h={persisted:s,configured:r,app:o,release:c,lock:l};if(Object.values(h).some(f=>f!=null))return is(h);if(p)return we(p,"migration proposal");throw new He("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function Dr(s,r){throw we(s),String(r||"").trim(),new He("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var ts,jr,He,Rt=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}`)),He=class extends Error{constructor(r,o,c={}){super(o),this.name="ProjectTargetError",this.code=r,Object.assign(this,c)}}});var si=Ee((ha,us)=>{var Me=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 ft(s){return typeof s!="string"||s.length===0||s.startsWith("/")||s.includes("\\")?!1:s.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}function ei(s){let r=s.body.endsWith(`
1
+ var Rr=Object.create;var Rt=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 Pe=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports),Xt=(s,r)=>{for(var o in r)Rt(s,o,{get:r[o],enumerable:!0})},es=(s,r,o,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of Tr(r))!Or.call(s,l)&&l!==o&&Rt(s,l,{get:()=>r[l],enumerable:!(c=Nr(r,l))||c.enumerable});return s};var et=(s,r,o)=>(o=s!=null?Rr(Lr(s)):{},es(r||!s||!s.__esModule?Rt(o,"default",{value:s,enumerable:!0}):o,s)),ht=s=>es(Rt({},"__esModule",{value:!0}),s);var ss={};Xt(ss,{ProjectTargetError:()=>Ge,SUPPORTED_PROJECT_TARGETS:()=>ts,assertMatchingProjectTargets:()=>is,defaultV4ProjectTarget:()=>Vr,parseProjectTarget:()=>Se,projectTargetKey:()=>Me,registryRoute:()=>Dr,resolveProjectTarget:()=>Fr});function Me(s){return`${s.framework}/${s.primitive}`}function Se(s,r="Project target"){let o=s,c=typeof o?.framework=="string"?o.framework.trim().toLowerCase():"",l=typeof o?.primitive=="string"?o.primitive.trim().toLowerCase():"",p=`${c}/${l}`;if(!c||!l||!jr.has(p))throw new Ge("INVALID_PROJECT_TARGET",`${r} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${p}.`,{framework:c||null,primitive:l||null});return{framework:c,primitive:l}}function Vr(s="react"){return Se({framework:s,primitive:s==="vue"?"reka":"base"})}function is(s){let r=Object.entries(s).filter(([,l])=>l!=null).map(([l,p])=>[l,Se(p,l)]);if(r.length===0)throw new Ge("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let o=Me(r[0][1]);if(r.find(([,l])=>Me(l)!==o))throw new Ge("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${r.map(([l,p])=>`${l}=${Me(p)}`).join(", ")}.`,{targets:Object.fromEntries(r)});return r[0][1]}function Fr({persisted:s,configured:r,app:o,release:c,lock:l,proposed:p}={}){let h={persisted:s,configured:r,app:o,release:c,lock:l};if(Object.values(h).some(f=>f!=null))return is(h);if(p)return Se(p,"migration proposal");throw new Ge("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function Dr(s,r){throw Se(s),String(r||"").trim(),new Ge("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var ts,jr,Ge,Nt=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}`)),Ge=class extends Error{constructor(r,o,c={}){super(o),this.name="ProjectTargetError",this.code=r,Object.assign(this,c)}}});var ri=Pe((ha,us)=>{var Be=require("fs"),Oe=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 ft(s){return typeof s!="string"||s.length===0||s.startsWith("/")||s.includes("\\")?!1:s.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}function ti(s){let r=s.body.endsWith(`
3
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 ti(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=>ft(l.slug)).sort((l,p)=>l.kind.localeCompare(p.kind)||l.slug.localeCompare(p.slug)),c={"README.md":ti(s)};for(let l of o)c[l.slug]=ei(l);return c}function Zt(s,r){let o={};for(let[l,p]of Object.entries(s))r[l]!==p&&(o[l]=p);let c=Object.keys(r).filter(l=>!(l in s)).sort();return{writes:o,deletes:c}}var ii=s=>os("sha256").update(s).digest("hex");function Wr(s){return Object.fromEntries(Object.entries(s).filter(([r])=>r!=="README.md"&&ft(r)).map(([r,o])=>[r,ii(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 c=new Map;for(let h of s.contracts)(!h||!ft(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||c.has(h.slug))&&o(),c.set(h.slug,ei(h));if(s.protocol===void 0)return s.manifest!==void 0&&o(),Zt(cs(s),r);(s.protocol!==1||!Array.isArray(s.manifest))&&o();let l={"README.md":ti(s.design_system)},p=new Set;for(let h of s.manifest){(!h||!ft(h.slug)||h.slug==="README.md"||!/^[a-f0-9]{64}$/.test(h.hash)||p.has(h.slug))&&o(),p.add(h.slug);let f=c.get(h.slug)??r[h.slug];(typeof f!="string"||ii(f)!==h.hash)&&o(),Object.defineProperty(l,h.slug,{value:f,enumerable:!0})}return[...c.keys()].some(h=>!p.has(h))&&o(),Zt(l,r)}function zr(s){let r={};if(!Me.existsSync(s))return r;let o=c=>{for(let l of Me.readdirSync(c,{withFileTypes:!0})){let p=Te.join(c,l.name);if(l.isDirectory())o(p);else if(l.isFile()){let h=Te.relative(s,p).split(Te.sep).join("/");r[h]=Me.readFileSync(p,"utf8")}}};return o(s),r}function Gr(s,r){for(let[o,c]of Object.entries(r.writes)){let l=Te.join(s,...o.split("/"));Me.mkdirSync(Te.dirname(l),{recursive:!0}),Me.writeFileSync(l,c)}for(let o of r.deletes){let c=Te.join(s,...o.split("/"));Me.rmSync(c,{force:!0});let l=Te.dirname(c),p=Te.resolve(s);for(;Te.resolve(l)!==p&&Me.existsSync(l)&&Me.readdirSync(l).length===0;)Me.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 c=[...r.sharedContracts,...r.contracts],l=s.manifest??s.contracts,p=new Map(c.map(h=>[h.slug,h]));if(!Array.isArray(l)||!Array.isArray(s.contracts)||l.length!==c.length||new Set(l.map(h=>h.slug)).size!==c.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 d={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(d)).digest("hex")!==f.digest)throw new Error("Contract content does not match its immutable digest.")}return c}us.exports={validatePinnedMirror:Jr,MIRROR_DIR:$r,FRONTFRIEND_GITIGNORE_PATH:Ur,renderFrontfriendGitignore:qr,isSafeSlug:ft,renderContractFile:ei,renderMirrorReadme:ti,buildMirrorTree:cs,planMirrorSync:Zt,hashMirrorFile:ii,knownMirrorHashes:Wr,planMirrorResponse:Hr,readMirrorTree:zr,applyMirrorPlan:Gr}});var ci=Ee((ga,vs)=>{var oi=require("fs"),fe=require("path");function fs(s,r="JSON"){let o="",c=0,l=s.charCodeAt(0)===65279?s.slice(1):s;for(;c<l.length;){let h=l[c];if(h==='"'){let f=c+1;for(;f<l.length&&l[f]!=='"';)f+=l[f]==="\\"?2:1;o+=l.slice(c,f+1),c=f+1}else if(h==="/"&&l[c+1]==="/")for(;c<l.length&&l[c]!==`
6
- `;)c+=1;else if(h==="/"&&l[c+1]==="*"){let f=l.indexOf("*/",c+2);if(f===-1)throw new Error(`Cannot read ${r}: unterminated comment.`);o+=l.slice(c,f+2).replace(/[^\n]/g," "),c=f+2}else o+=h,c+=1}let p="";for(let h=0;h<o.length;h+=1){let f=o[h];if(f==='"'){let d=h+1;for(;d<o.length&&o[d]!=='"';)d+=o[d]==="\\"?2:1;p+=o.slice(h,d+1),h=d;continue}if(f===","){let d=h+1;for(;d<o.length&&/\s/.test(o[d]);)d+=1;if(o[d]==="}"||o[d]==="]")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(oi.readFileSync(s,"utf8"),s)}var Tt=s=>{try{return oi.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=c=>Tt(c)?c:!c.endsWith(".json")&&Tt(`${c}.json`)?`${c}.json`:null;if(s.startsWith(".")||fe.isAbsolute(s)){let c=o(fe.resolve(r,s));if(c)return c;throw new Error(`File '${s}' not found (tsconfig extends, from ${r}).`)}for(let c=r;;c=fe.dirname(c)){let l=fe.join(c,"node_modules",s),p=o(l);if(p)return p;let h=null;try{h=JSON.parse(oi.readFileSync(fe.join(l,"package.json"),"utf8"))}catch{h=null}if(h&&typeof h.tsconfig=="string"&&Tt(fe.join(l,h.tsconfig)))return fe.join(l,h.tsconfig);if(Tt(fe.join(l,"tsconfig.json")))return fe.join(l,"tsconfig.json");if(fe.dirname(c)===c)break}for(let c of[s,`${s}/tsconfig.json`,`${s}.json`])try{return require.resolve(c,{paths:[r]})}catch{}throw new Error(`File '${s}' not found (tsconfig extends, from ${r}).`)}function gs(s,r,o=new Set){let c=fe.resolve(s);if(o.has(c))throw new Error(`Circularity detected while resolving configuration: ${c}`);let l=new Set(o).add(c),p=ds(c),h=fe.dirname(c),f={},d=p.extends===void 0?[]:Array.isArray(p.extends)?p.extends:[p.extends];for(let I of d)f={...f,...gs(ms(I,h),r,l)};let v=p.compilerOptions&&typeof p.compilerOptions=="object"?p.compilerOptions:{},w=I=>typeof I=="string"?I.replace(/\$\{configDir\}/g,r):I;return typeof v.baseUrl=="string"&&(f.baseUrl=fe.resolve(h,w(v.baseUrl))),v.paths&&typeof v.paths=="object"&&(f.paths=Object.fromEntries(Object.entries(v.paths).map(([I,A])=>[I,Array.isArray(A)?A.map(w):A])),f.pathsBasePath=h),f}function Zr(s){let r=gs(s,fe.dirname(fe.resolve(s)));return r.paths?{base:r.baseUrl||r.pathsBasePath||fe.dirname(s),paths:r.paths}:null}vs.exports={parseJsonc:fs,readJsonc:ds,resolveExtends:ms,readConfigPaths:Zr}});var Ot={};Yt(Ot,{materializeInstallationPath:()=>li,readProjectPaths:()=>ys,resolveCanonicalUiDirectory:()=>bs,resolveConfiguredAlias:()=>Lt});function xs(s){try{return JSON.parse(tt.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(!tt.default.existsSync(o))continue;let c=en(o);if(c)return c}return{base:s,paths:{"@/*":[tt.default.existsSync(me.default.join(s,"src"))?"src/*":"*"]}}}function Lt(s,r,o=ys(s)){for(let[c,l]of Object.entries(o.paths)){if(!Array.isArray(l)||typeof l[0]!="string")continue;let[p,h=""]=c.split("*");if(!r.startsWith(p)||!r.endsWith(h)||!c.includes("*")&&r!==c)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,tt.default.existsSync(me.default.join(s,"src"))?"src":".",r.slice(2)):me.default.resolve(s,r)}function ui(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 ui(s,Lt(s,r));let c=xs(me.default.join(s,"components.json"))?.aliases?.ui;return typeof c=="string"&&c?ui(s,Lt(s,c)):tt.default.existsSync(me.default.join(s,"src"))?"src/components/ui":"components/ui"}function li(s){if(s.installationLayout==="shadcn"&&/^(?:lib|hooks|components)\//.test(s.path)){let c=xs(me.default.join(s.root,"components.json"))?.aliases||{},l=/^lib\/utils\.[^.]+$/.test(s.path),p=s.path.split("/")[0],h=l&&c.utils?c.utils:c[p]||`@/${p}`,f=Lt(s.root,h);return ui(s.root,l&&c.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 tt,me,en,mt=Zi(()=>{tt=Ze(require("node:fs")),me=Ze(require("node:path")),{readConfigPaths:en}=ci()});var Ss=Ee((xa,rn)=>{rn.exports={name:"@frontfriend/sdk",version:"1.3.0"}});var Cs=Ee((ya,ks)=>{var{name:nn}=Ss();ks.exports={PACKAGE_NAME:nn}});var pi=Ee((ba,As)=>{var{PACKAGE_NAME:jt}=Cs(),$e=require("fs"),an=require("http"),on=require("https"),ye=require("path"),Vt=["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($e.readFileSync(s,"utf8"))}catch{return{}}}function hi(s){if(s===void 0)return null;if(!Array.isArray(s)){let c=new Error("`adopt` in frontfriend.config.js must be an array.");throw c.code="FRONTFRIEND_CONFIG_VALIDATION",c}let r=s.filter(c=>!Vt.includes(c));if(r.length>0){let c=new Error(`Unknown Frontfriend adoption level: ${r.join(", ")}.`);throw c.code="FRONTFRIEND_CONFIG_VALIDATION",c}let o=s.includes("components")?2:s.includes("tokens")?1:0;return Vt.slice(0,o+1)}function pn(s){for(let[r,o]of Object.entries(un)){let c=o.find(p=>$e.existsSync(ye.join(s,p)));if(!c)continue;let l=$e.readFileSync(ye.join(s,c),"utf8");return{buildTool:r,present:l.includes(`${jt}/${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=>$e.existsSync(l)),o=new Set;function c(l){for(let p of $e.readdirSync(l,{withFileTypes:!0})){let h=ye.join(l,p.name);if(p.isDirectory())c(h);else if(/\.(js|jsx|ts|tsx|vue)$/.test(p.name)){if(!$e.readFileSync(h,"utf8").includes(jt))continue;let d=ye.basename(p.name,ye.extname(p.name));o.add(d.toLowerCase()==="index"?ye.basename(l):d.toLowerCase())}}}return r.forEach(c),[...o].sort()}function dn(s){let r=Is(ye.join(s,"package.json")),o={...r.dependencies||{},...r.devDependencies||{}},c=o.tailwindcss||null,p=[Is(ye.join(s,"components.json"))?.tailwind?.css,...cn].filter(Boolean).find(d=>$e.existsSync(ye.join(s,d))),h=p?$e.readFileSync(ye.join(s,p),"utf8"):"",f=hn.filter(d=>o[d]);return!f.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(h)&&!h.includes(`${jt}/theme.css`)&&f.push("css-custom-properties"),{nativeTokens:{present:h.includes("/* Frontfriend managed native tokens: start */"),file:p||null},tailwind:{present:!!c,version:c,major:c&&Number((String(c).match(/\d+/)||[])[0])||null},componentsJson:$e.existsSync(ye.join(s,"components.json")),themeImport:{present:h.includes(`${jt}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(h),file:p||null},plugin:pn(s),frontfriendComponents:fn(s),foreignComponentLibraries:ln.filter(d=>o[d]),foreignTokenSystems:f}}function mn(s,r,{baseLibrary:o}={}){let c=hi(s)||Vt,l=c.includes("tokens"),p=c.includes("components"),h=[];return l&&!r.themeImport.present&&!r.nativeTokens?.present&&h.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!l&&r.themeImport.present&&h.push("Frontfriend tokens are present in CSS but are not adopted in config."),p&&o==="shadcn"&&!r.componentsJson&&h.push("Config adopts components, but components.json was not observed."),!p&&r.frontfriendComponents.length>0&&h.push("Frontfriend components are installed but are not adopted in config."),h}function gn({apiUrl:s,token:r,ffId:o,name:c,adopt:l,observed:p,framework:h,primitive:f}){if(!s||!r||!o||!c||!h||f===void 0)return Promise.resolve({reported:!1,unavailable:!0});let d=new URL("/api/apps/sync",s),v=JSON.stringify({ffId:o,name:c,adopt:hi(l),observed:p,runtime:"sdk",framework:h,primitive:f}),w=d.protocol==="https:"?on:an;return new Promise(I=>{let A=w.request(d,{method:"POST",headers:{authorization:`Bearer ${r}`,"content-type":"application/json","content-length":Buffer.byteLength(v)}},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(v)})}As.exports={ADOPTION_LEVELS:Vt,normalizeAdopt:hi,probeAdoption:dn,adoptionWarnings:mn,reportAdoption:gn}});var Es=Ee((Ft,_s)=>{(function(s,r){typeof Ft=="object"&&typeof _s<"u"?r(Ft):typeof define=="function"&&define.amd?define(["exports"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.acorn={}))})(Ft,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],c="\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"},d=/^in(stanceof)?$/,v=new RegExp("["+l+"]"),w=new RegExp("["+l+c+"]");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&&v.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},oe={};function O(e,t){return t===void 0&&(t={}),t.keyword=e,oe[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 u=e.charCodeAt(n);if(V(u))return n<i-1&&u===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,re=Object.hasOwn||function(e,t){return xe.call(e,t)},bt=Array.isArray||function(e){return nt.call(e)==="[object Array]"},zt=Object.create(null);function Re(e){return zt[e]||(zt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function ue(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var wt=/(?:[\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 u=W(e,n,t);if(u<0)return new S(i,t-n);++i,n=u}}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 ne(e){var t={};for(var i in Se)t[i]=e&&re(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),bt(t.onToken)){var n=t.onToken;t.onToken=function(u){return n.push(u)}}if(bt(t.onComment)&&(t.onComment=Ue(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function Ue(e,t){return function(i,n,u,m,g,x){var y={type:i?"Block":"Line",value:n,start:u,end:m};e.locations&&(y.loc=new $(this,g,x)),e.ranges&&(y.range=[u,m]),t.push(y)}}var de=1,Q=2,G=4,H=8,be=16,Pe=32,qe=64,Je=128,ae=256,je=512,le=1024,ie=de|Q|ae;function ce(e,t){return Q|(e?G:0)|(t?H:0)}var ke=0,at=1,Ve=2,Ci=3,Ii=4,Ai=5,X=function(t,i,n){this.options=t=ne(t),this.sourceFile=t.sourceFile,this.keywords=Re(f[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var u="";t.allowReserved!==!0&&(u=p[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(u+=" await")),this.reservedWords=Re(u);var m=(u?u+" ":"")+p.strict;this.reservedWordsStrict=Re(m),this.reservedWordsStrictBind=Re(m+" "+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:de),this.regexpState=null,this.privateNameStack=[]},Ce={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)})},Ce.inFunction.get=function(){return(this.currentVarScope().flags&Q)>0},Ce.inGenerator.get=function(){return(this.currentVarScope().flags&H)>0},Ce.inAsync.get=function(){return(this.currentVarScope().flags&G)>0},Ce.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(ae|je))return!1;if(i&Q)return(i&G)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Ce.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&de)},Ce.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&qe)>0||this.options.allowSuperOutsideMethod},Ce.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Je)>0},Ce.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Ce.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(ae|je)||i&Q&&!(i&be))return!0}return!1},Ce.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&le||!this.inModule&&t&de)},Ce.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ae)>0},X.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var n=this,u=0;u<t.length;u++)n=t[u](n);return n},X.parse=function(t,i){return new this(i,t).parse()},X.parseExpressionAt=function(t,i,n){var u=new this(n,t,i);return u.nextToken(),u.parseExpression()},X.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(X.prototype,Ce);var he=X.prototype,tr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;he.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,u=this.input.charAt(n);return u===";"||u==="}"||b.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(u)||u==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,q.lastIndex=e,e+=q.exec(this.input)[0].length,this.input[e]===";"&&e++}},he.eat=function(e){return this.type===e?(this.next(),!0):!1},he.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc},he.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},he.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}},he.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},he.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||b.test(this.input.slice(this.lastTokEnd,this.start))},he.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},he.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()},he.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},he.expect=function(e){this.eat(e)||this.unexpected()},he.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var St=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};he.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")}},he.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")},he.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")},he.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,u=Object.keys(this.undefinedExports);n<u.length;n+=1){var m=u[n];this.raiseRecoverable(this.undefinedExports[m].start,"Export '"+m+"' 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 Gt={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 u=i;do i+=n<=65535?1:2;while(B(n=this.fullCharCodeAt(i)));if(n===92)return!0;var m=this.input.slice(u,i);if(!d.test(m))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 u=n+5,m;if(this.input.slice(n,u)!=="using"||u===this.input.length||B(m=this.fullCharCodeAt(u))||m===92)return!1;q.lastIndex=u;var g=q.exec(this.input);if(n=u+g[0].length,g&&b.test(this.input.slice(u,n)))return!1}var x=this.fullCharCodeAt(n);if(!A(x)&&x!==92)return!1;var y=n;do n+=x<=65535?1:2;while(B(x=this.fullCharCodeAt(n)));if(x===92)return!0;var N=this.input.slice(y,n);if(d.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||(x=this.input.charCodeAt(n+1))===61||x===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,u=this.startNode(),m;switch(this.isLet(e)&&(n=a._var,m="let"),n){case a._break:case a._continue:return this.parseBreakContinueStatement(u,n.keyword);case a._debugger:return this.parseDebuggerStatement(u);case a._do:return this.parseDoStatement(u);case a._for:return this.parseForStatement(u);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(u,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(u,!0);case a._if:return this.parseIfStatement(u);case a._return:return this.parseReturnStatement(u);case a._switch:return this.parseSwitchStatement(u);case a._throw:return this.parseThrowStatement(u);case a._try:return this.parseTryStatement(u);case a._const:case a._var:return m=m||this.value,e&&m!=="var"&&this.unexpected(),this.parseVarStatement(u,m);case a._while:return this.parseWhileStatement(u);case a._with:return this.parseWithStatement(u);case a.braceL:return this.parseBlock(!0,u);case a.semi:return this.parseEmptyStatement(u);case a._export:case a._import:if(this.options.ecmaVersion>10&&n===a._import){q.lastIndex=this.pos;var g=q.exec(this.input),x=this.pos+g[0].length,y=this.input.charCodeAt(x);if(y===40||y===46)return this.parseExpressionStatement(u,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(u):this.parseExport(u,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(u,!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(u,!1,N),this.semicolon(),this.finishNode(u,"VariableDeclaration");var M=this.value,K=this.parseExpression();return n===a.name&&K.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(u,M,K,e):this.parseExpressionStatement(u,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 u=this.labels[n];if((e.label==null||u.name===e.label.name)&&(u.kind!=null&&(i||u.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(Gt),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(Gt),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(),u=i?"let":this.value;return this.next(),this.parseVar(n,!0,u),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var m=this.isContextual("let"),g=!1,x=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(x){var y=this.startNode();return this.next(),x==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(y,!0,x),this.finishNode(y,"VariableDeclaration"),this.parseForAfterInit(e,y,t)}var N=this.containsEsc,M=new St,K=this.start,pe=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&&(pe.start===K&&!N&&pe.type==="Identifier"&&pe.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),m&&g&&this.raise(pe.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(pe,!1,M),this.checkLValPattern(pe),this.parseForIn(e,pe)):(this.checkExpressionErrors(M,!0),t>-1&&this.unexpected(t),this.parseFor(e,pe))},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,ot|(i?0:Jt),!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(le);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?Pe:0),this.checkLValPattern(e,t?Ii:Ve),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(Gt),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 u=0,m=this.labels;u<m.length;u+=1){var g=m[u];g.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var x=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=x;else break}return this.labels.push({name:t,kind:x,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 u=this.startNode();if(this.parseVarId(u,i),this.eat(a.eq)?u.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&&u.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):u.init=null,e.declarations.push(this.finishNode(u,"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"?at:Ve,!1)};var ot=1,Jt=2,_i=4;C.parseFunction=function(e,t,i,n,u){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===a.star&&t&Jt&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&ot&&(e.id=t&_i&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Jt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?at:Ve:Ci));var m=this.yieldPos,g=this.awaitPos,x=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ce(e.async,e.generator)),t&ot||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,u),this.yieldPos=m,this.awaitPos=g,this.awaitIdentPos=x,this.finishNode(e,t&ot?"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(),u=this.startNode(),m=!1;for(u.body=[],this.expect(a.braceL);this.type!==a.braceR;){var g=this.parseClassElement(e.superClass!==null);g&&(u.body.push(g),g.type==="MethodDefinition"&&g.kind==="constructor"?(m&&this.raiseRecoverable(g.start,"Duplicate constructor in the same class"),m=!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(u,"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="",u=!1,m=!1,g="method",x=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?x=!0:n="static"}if(i.static=x,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?m=!0:n="async"),!n&&(t>=9||!m)&&this.eat(a.star)&&(u=!0),!n&&!m&&!u){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"||u||m){var N=!i.static&&kt(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,u,m,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 u=e.key;e.kind==="constructor"?(t&&this.raise(u.start,"Constructor can't be a generator"),i&&this.raise(u.start,"Constructor can't be an async method")):e.static&&kt(e,"prototype")&&this.raise(u.start,"Classes may not have a static property named prototype");var m=e.value=this.parseMethod(t,i,n);return e.kind==="get"&&m.params.length!==0&&this.raiseRecoverable(m.start,"getter should have no params"),e.kind==="set"&&m.params.length!==1&&this.raiseRecoverable(m.start,"setter should have exactly one param"),e.kind==="set"&&m.params[0].type==="RestElement"&&this.raiseRecoverable(m.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},C.parseClassField=function(e){return kt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&kt(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)?(this.enterScope(je|qe),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(ae|qe);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,Ve,!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,u=n===0?null:this.privateNameStack[n-1],m=0;m<i.length;++m){var g=i[m];re(t,g.name)||(u?u.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],u="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(u=(t.static?"s":"i")+t.kind),n==="iget"&&u==="iset"||n==="iset"&&u==="iget"||n==="sget"&&u==="sset"||n==="sset"&&u==="sget"?(e[i]="true",!1):n?!0:(e[i]=u,!1)}function kt(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 u=n[i];this.checkUnreserved(u.local),this.checkLocalExport(u.local),u.local.type==="Literal"&&this.raise(u.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,ot|_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),re(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,u=t.properties;n<u.length;n+=1){var m=u[n];this.checkPatternExport(e,m)}else if(i==="ArrayPattern")for(var g=0,x=t.elements;g<x.length;g+=1){var y=x[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 u=n[i];this.checkPatternExport(e,u.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,Ve),this.finishNode(e,"ImportSpecifier")},C.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Ve),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,Ve),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(),u=n.key.type==="Identifier"?n.key.name:n.key.value;re(t,u)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+u+"'"),t[u]=!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 wt.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 Ie=X.prototype;Ie.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,u=e.properties;n<u.length;n+=1){var m=u[n];this.toAssignable(m,t),m.type==="RestElement"&&(m.argument.type==="ArrayPattern"||m.argument.type==="ObjectPattern")&&this.raise(m.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},Ie.toAssignableList=function(e,t){for(var i=e.length,n=0;n<i;n++){var u=e[n];u&&this.toAssignable(u,t)}if(i){var m=e[i-1];this.options.ecmaVersion===6&&t&&m&&m.type==="RestElement"&&m.argument.type!=="Identifier"&&this.unexpected(m.argument.start)}return e},Ie.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},Ie.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")},Ie.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()},Ie.parseBindingList=function(e,t,i,n){for(var u=[],m=!0;!this.eat(e);)if(m?m=!1:this.expect(a.comma),t&&this.type===a.comma)u.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var g=this.parseRestBinding();this.parseBindingListItem(g),u.push(g),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else u.push(this.parseAssignableListItem(n))}return u},Ie.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Ie.parseBindingListItem=function(e){return e},Ie.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")},Ie.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===Ve&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(re(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")}},Ie.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=ke),e.type){case"ObjectPattern":for(var n=0,u=e.properties;n<u.length;n+=1){var m=u[n];this.checkLValInnerPattern(m,t,i)}break;case"ArrayPattern":for(var g=0,x=e.elements;g<x.length;g+=1){var y=x[g];y&&this.checkLValInnerPattern(y,t,i)}break;default:this.checkLValSimple(e,t,i)}},Ie.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 Ae=function(t,i,n,u,m){this.token=t,this.isExpr=!!i,this.preserveSpace=!!n,this.override=u,this.generator=!!m},J={b_stat:new Ae("{",!1),b_expr:new Ae("{",!0),b_tmpl:new Ae("${",!1),p_stat:new Ae("(",!1),p_expr:new Ae("(",!0),q_tmpl:new Ae("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Ae("function",!1),f_expr:new Ae("function",!0),f_expr_gen:new Ae("function",!0,!1,null,!0),f_gen:new Ae("function",!1,!1,null,!0)},Ke=X.prototype;Ke.initialContext=function(){return[J.b_stat]},Ke.curContext=function(){return this.context[this.context.length-1]},Ke.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},Ke.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},Ke.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},Ke.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,u;switch(n.type){case"Identifier":u=n.name;break;case"Literal":u=String(n.value);break;default:return}var m=e.kind;if(this.options.ecmaVersion>=6){u==="__proto__"&&m==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0);return}u="$"+u;var g=t[u];if(g){var x;m==="init"?x=this.strict&&g.init||g.get||g.set:x=g.init||g[m],x&&this.raiseRecoverable(n.start,"Redefinition of property")}else g=t[u]={init:!1,get:!1,set:!1};g[m]=!0}},L.parseExpression=function(e,t){var i=this;return this.catchStackOverflow(function(){var n=i.start,u=i.startLoc,m=i.parseMaybeAssign(e,t);if(i.type===a.comma){var g=i.startNodeAt(n,u);for(g.expressions=[m];i.eat(a.comma);)g.expressions.push(i.parseMaybeAssign(e,t));return i.finishNode(g,"SequenceExpression")}return m})},L.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,u=-1,m=-1,g=-1;t?(u=t.parenthesizedAssign,m=t.trailingComma,g=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new St,n=!0);var x=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,x,y)),this.type.isAssign){var M=this.startNodeAt(x,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 u>-1&&(t.parenthesizedAssign=u),m>-1&&(t.trailingComma=m),N},L.parseMaybeConditional=function(e,t){var i=this.start,n=this.startLoc,u=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return u;if(!(u.type==="ArrowFunctionExpression"&&u.start===i)&&this.eat(a.question)){var m=this.startNodeAt(i,n);return m.test=u,m.consequent=this.parseMaybeAssign(),this.expect(a.colon),m.alternate=this.parseMaybeAssign(e),this.finishNode(m,"ConditionalExpression")}return u},L.parseExprOps=function(e,t){var i=this.start,n=this.startLoc,u=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||u.start===i&&u.type==="ArrowFunctionExpression"?u:this.parseExprOp(u,i,n,-1,e)},L.parseExprOp=function(e,t,i,n,u){var m=this.type.binop;if(m!=null&&(!u||this.type!==a._in)&&m>n){var g=this.type===a.logicalOR||this.type===a.logicalAND,x=this.type===a.coalesce;x&&(m=a.logicalAND.binop);var y=this.value;this.next();var N=this.start,M=this.startLoc,K=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,u),N,M,m,u),pe=this.buildBinary(t,i,e,K,y,g||x);return(g&&this.type===a.coalesce||x&&(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(pe,t,i,n,u)}return e},L.buildBinary=function(e,t,i,n,u,m){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=u,g.right=n,this.finishNode(g,m?"LogicalExpression":"BinaryExpression")},L.parseMaybeUnary=function(e,t,i,n){var u=this.start,m=this.startLoc,g;if(this.isContextual("await")&&this.canAwait)g=this.parseAwait(n),t=!0;else if(this.type.prefix){var x=this.startNode(),y=this.type===a.incDec;x.operator=this.value,x.prefix=!0,this.next(),x.argument=this.parseMaybeUnary(null,!0,y,n),this.checkExpressionErrors(e,!0),y?this.checkLValSimple(x.argument):this.strict&&x.operator==="delete"&&Ei(x.argument)?this.raiseRecoverable(x.start,"Deleting local variable in strict mode"):x.operator==="delete"&&Kt(x.argument)?this.raiseRecoverable(x.start,"Private fields can not be deleted"):t=!0,g=this.finishNode(x,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(u,m);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(u,m,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 Kt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Kt(e.expression)||e.type==="ParenthesizedExpression"&&Kt(e.expression)}L.parseExprSubscripts=function(e,t){var i=this.start,n=this.startLoc,u=this.parseExprAtom(e,t);if(u.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return u;var m=this.parseSubscripts(u,i,n,!1,t);return e&&m.type==="MemberExpression"&&(e.parenthesizedAssign>=m.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=m.start&&(e.parenthesizedBind=-1),e.trailingComma>=m.start&&(e.trailingComma=-1)),m},L.parseSubscripts=function(e,t,i,n,u){for(var m=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 x=this.parseSubscript(e,t,i,n,m,g,u);if(x.optional&&(g=!0),x===e||x.type==="ArrowFunctionExpression"){if(g){var y=this.startNodeAt(t,i);y.expression=x,x=this.finishNode(y,"ChainExpression")}return x}e=x}},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,u,m,g){var x=this.options.ecmaVersion>=11,y=x&&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,x&&(M.optional=y),e=this.finishNode(M,"MemberExpression")}else if(!n&&this.eat(a.parenL)){var K=new St,pe=this.yieldPos,lt=this.awaitPos,Qe=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Et=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,K);if(u&&!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=pe,this.awaitPos=lt,this.awaitIdentPos=Qe,this.parseSubscriptAsyncArrow(t,i,Et,g);this.checkExpressionErrors(K,!0),this.yieldPos=pe||this.yieldPos,this.awaitPos=lt||this.awaitPos,this.awaitIdentPos=Qe||this.awaitIdentPos;var Ye=this.startNodeAt(t,i);Ye.callee=e,Ye.arguments=Et,x&&(Ye.optional=y),e=this.finishNode(Ye,"CallExpression")}else if(this.type===a.backQuote){(y||m)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Xe=this.startNodeAt(t,i);Xe.tag=e,Xe.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(Xe,"TaggedTemplateExpression")}return e},L.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var n,u=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 m=this.start,g=this.startLoc,x=this.containsEsc,y=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!x&&y.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(J.f_expr),this.parseFunction(this.startNodeAt(m,g),0,!1,!0,t);if(u&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(m,g),[y],!1,t);if(this.options.ecmaVersion>=8&&y.name==="async"&&this.type===a.name&&!x&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return y=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(m,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(u,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,u,m=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var g=this.start,x=this.startLoc,y=[],N=!0,M=!1,K=new St,pe=this.yieldPos,lt=this.awaitPos,Qe;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(N?N=!1:this.expect(a.comma),m&&this.afterTrailingComma(a.parenR,!0)){M=!0;break}else if(this.type===a.ellipsis){Qe=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 Et=this.lastTokEnd,Ye=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(y)&&this.eat(a.arrow))return this.checkPatternErrors(K,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=pe,this.awaitPos=lt,this.parseParenArrowList(i,n,y,t);(!y.length||M)&&this.unexpected(this.lastTokStart),Qe&&this.unexpected(Qe),this.checkExpressionErrors(K,!0),this.yieldPos=pe||this.yieldPos,this.awaitPos=lt||this.awaitPos,y.length>1?(u=this.startNodeAt(g,x),u.expressions=y,this.finishNodeAt(u,"SequenceExpression",Et,Ye)):u=y[0]}else u=this.parseParenExpression();if(this.options.preserveParens){var Xe=this.startNodeAt(i,n);return Xe.expression=u,this.finishNode(Xe,"ParenthesizedExpression")}else return u},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,u=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,u,!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,`
4
+ `)}function ii(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=>ft(l.slug)).sort((l,p)=>l.kind.localeCompare(p.kind)||l.slug.localeCompare(p.slug)),c={"README.md":ii(s)};for(let l of o)c[l.slug]=ti(l);return c}function ei(s,r){let o={};for(let[l,p]of Object.entries(s))r[l]!==p&&(o[l]=p);let c=Object.keys(r).filter(l=>!(l in s)).sort();return{writes:o,deletes:c}}var si=s=>os("sha256").update(s).digest("hex");function Wr(s){return Object.fromEntries(Object.entries(s).filter(([r])=>r!=="README.md"&&ft(r)).map(([r,o])=>[r,si(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 c=new Map;for(let h of s.contracts)(!h||!ft(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||c.has(h.slug))&&o(),c.set(h.slug,ti(h));if(s.protocol===void 0)return s.manifest!==void 0&&o(),ei(cs(s),r);(s.protocol!==1||!Array.isArray(s.manifest))&&o();let l={"README.md":ii(s.design_system)},p=new Set;for(let h of s.manifest){(!h||!ft(h.slug)||h.slug==="README.md"||!/^[a-f0-9]{64}$/.test(h.hash)||p.has(h.slug))&&o(),p.add(h.slug);let f=c.get(h.slug)??r[h.slug];(typeof f!="string"||si(f)!==h.hash)&&o(),Object.defineProperty(l,h.slug,{value:f,enumerable:!0})}return[...c.keys()].some(h=>!p.has(h))&&o(),ei(l,r)}function zr(s){let r={};if(!Be.existsSync(s))return r;let o=c=>{for(let l of Be.readdirSync(c,{withFileTypes:!0})){let p=Oe.join(c,l.name);if(l.isDirectory())o(p);else if(l.isFile()){let h=Oe.relative(s,p).split(Oe.sep).join("/");r[h]=Be.readFileSync(p,"utf8")}}};return o(s),r}function Gr(s,r){for(let[o,c]of Object.entries(r.writes)){let l=Oe.join(s,...o.split("/"));Be.mkdirSync(Oe.dirname(l),{recursive:!0}),Be.writeFileSync(l,c)}for(let o of r.deletes){let c=Oe.join(s,...o.split("/"));Be.rmSync(c,{force:!0});let l=Oe.dirname(c),p=Oe.resolve(s);for(;Oe.resolve(l)!==p&&Be.existsSync(l)&&Be.readdirSync(l).length===0;)Be.rmdirSync(l),l=Oe.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 c=[...r.sharedContracts,...r.contracts],l=s.manifest??s.contracts,p=new Map(c.map(h=>[h.slug,h]));if(!Array.isArray(l)||!Array.isArray(s.contracts)||l.length!==c.length||new Set(l.map(h=>h.slug)).size!==c.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 d={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(d)).digest("hex")!==f.digest)throw new Error("Contract content does not match its immutable digest.")}return c}us.exports={validatePinnedMirror:Jr,MIRROR_DIR:$r,FRONTFRIEND_GITIGNORE_PATH:Ur,renderFrontfriendGitignore:qr,isSafeSlug:ft,renderContractFile:ti,renderMirrorReadme:ii,buildMirrorTree:cs,planMirrorSync:ei,hashMirrorFile:si,knownMirrorHashes:Wr,planMirrorResponse:Hr,readMirrorTree:zr,applyMirrorPlan:Gr}});var ui=Pe((ga,vs)=>{var ci=require("fs"),fe=require("path");function fs(s,r="JSON"){let o="",c=0,l=s.charCodeAt(0)===65279?s.slice(1):s;for(;c<l.length;){let h=l[c];if(h==='"'){let f=c+1;for(;f<l.length&&l[f]!=='"';)f+=l[f]==="\\"?2:1;o+=l.slice(c,f+1),c=f+1}else if(h==="/"&&l[c+1]==="/")for(;c<l.length&&l[c]!==`
6
+ `;)c+=1;else if(h==="/"&&l[c+1]==="*"){let f=l.indexOf("*/",c+2);if(f===-1)throw new Error(`Cannot read ${r}: unterminated comment.`);o+=l.slice(c,f+2).replace(/[^\n]/g," "),c=f+2}else o+=h,c+=1}let p="";for(let h=0;h<o.length;h+=1){let f=o[h];if(f==='"'){let d=h+1;for(;d<o.length&&o[d]!=='"';)d+=o[d]==="\\"?2:1;p+=o.slice(h,d+1),h=d;continue}if(f===","){let d=h+1;for(;d<o.length&&/\s/.test(o[d]);)d+=1;if(o[d]==="}"||o[d]==="]")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(ci.readFileSync(s,"utf8"),s)}var Lt=s=>{try{return ci.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=c=>Lt(c)?c:!c.endsWith(".json")&&Lt(`${c}.json`)?`${c}.json`:null;if(s.startsWith(".")||fe.isAbsolute(s)){let c=o(fe.resolve(r,s));if(c)return c;throw new Error(`File '${s}' not found (tsconfig extends, from ${r}).`)}for(let c=r;;c=fe.dirname(c)){let l=fe.join(c,"node_modules",s),p=o(l);if(p)return p;let h=null;try{h=JSON.parse(ci.readFileSync(fe.join(l,"package.json"),"utf8"))}catch{h=null}if(h&&typeof h.tsconfig=="string"&&Lt(fe.join(l,h.tsconfig)))return fe.join(l,h.tsconfig);if(Lt(fe.join(l,"tsconfig.json")))return fe.join(l,"tsconfig.json");if(fe.dirname(c)===c)break}for(let c of[s,`${s}/tsconfig.json`,`${s}.json`])try{return require.resolve(c,{paths:[r]})}catch{}throw new Error(`File '${s}' not found (tsconfig extends, from ${r}).`)}function gs(s,r,o=new Set){let c=fe.resolve(s);if(o.has(c))throw new Error(`Circularity detected while resolving configuration: ${c}`);let l=new Set(o).add(c),p=ds(c),h=fe.dirname(c),f={},d=p.extends===void 0?[]:Array.isArray(p.extends)?p.extends:[p.extends];for(let I of d)f={...f,...gs(ms(I,h),r,l)};let v=p.compilerOptions&&typeof p.compilerOptions=="object"?p.compilerOptions:{},w=I=>typeof I=="string"?I.replace(/\$\{configDir\}/g,r):I;return typeof v.baseUrl=="string"&&(f.baseUrl=fe.resolve(h,w(v.baseUrl))),v.paths&&typeof v.paths=="object"&&(f.paths=Object.fromEntries(Object.entries(v.paths).map(([I,A])=>[I,Array.isArray(A)?A.map(w):A])),f.pathsBasePath=h),f}function Zr(s){let r=gs(s,fe.dirname(fe.resolve(s)));return r.paths?{base:r.baseUrl||r.pathsBasePath||fe.dirname(s),paths:r.paths}:null}vs.exports={parseJsonc:fs,readJsonc:ds,resolveExtends:ms,readConfigPaths:Zr}});var jt={};Xt(jt,{materializeInstallationPath:()=>hi,readProjectPaths:()=>ys,resolveCanonicalUiDirectory:()=>bs,resolveConfiguredAlias:()=>Ot});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 c=en(o);if(c)return c}return{base:s,paths:{"@/*":[it.default.existsSync(me.default.join(s,"src"))?"src/*":"*"]}}}function Ot(s,r,o=ys(s)){for(let[c,l]of Object.entries(o.paths)){if(!Array.isArray(l)||typeof l[0]!="string")continue;let[p,h=""]=c.split("*");if(!r.startsWith(p)||!r.endsWith(h)||!c.includes("*")&&r!==c)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 li(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 li(s,Ot(s,r));let c=xs(me.default.join(s,"components.json"))?.aliases?.ui;return typeof c=="string"&&c?li(s,Ot(s,c)):it.default.existsSync(me.default.join(s,"src"))?"src/components/ui":"components/ui"}function hi(s){if(s.installationLayout==="shadcn"&&/^(?:lib|hooks|components)\//.test(s.path)){let c=xs(me.default.join(s.root,"components.json"))?.aliases||{},l=/^lib\/utils\.[^.]+$/.test(s.path),p=s.path.split("/")[0],h=l&&c.utils?c.utils:c[p]||`@/${p}`,f=Ot(s.root,h);return li(s.root,l&&c.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,mt=Zi(()=>{it=et(require("node:fs")),me=et(require("node:path")),{readConfigPaths:en}=ui()});var Ss=Pe((xa,rn)=>{rn.exports={name:"@frontfriend/sdk",version:"1.4.1"}});var Cs=Pe((ya,ks)=>{var{name:nn}=Ss();ks.exports={PACKAGE_NAME:nn}});var fi=Pe((ba,As)=>{var{PACKAGE_NAME:Vt}=Cs(),Ue=require("fs"),an=require("http"),on=require("https"),be=require("path"),Ft=["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(Ue.readFileSync(s,"utf8"))}catch{return{}}}function pi(s){if(s===void 0)return null;if(!Array.isArray(s)){let c=new Error("`adopt` in frontfriend.config.js must be an array.");throw c.code="FRONTFRIEND_CONFIG_VALIDATION",c}let r=s.filter(c=>!Ft.includes(c));if(r.length>0){let c=new Error(`Unknown Frontfriend adoption level: ${r.join(", ")}.`);throw c.code="FRONTFRIEND_CONFIG_VALIDATION",c}let o=s.includes("components")?2:s.includes("tokens")?1:0;return Ft.slice(0,o+1)}function pn(s){for(let[r,o]of Object.entries(un)){let c=o.find(p=>Ue.existsSync(be.join(s,p)));if(!c)continue;let l=Ue.readFileSync(be.join(s,c),"utf8");return{buildTool:r,present:l.includes(`${Vt}/${r}`)}}return{buildTool:null,present:!1}}function fn(s){let r=[be.join(s,"components","ui"),be.join(s,"src","components","ui"),be.join(s,"app","components","ui")].filter(l=>Ue.existsSync(l)),o=new Set;function c(l){for(let p of Ue.readdirSync(l,{withFileTypes:!0})){let h=be.join(l,p.name);if(p.isDirectory())c(h);else if(/\.(js|jsx|ts|tsx|vue)$/.test(p.name)){if(!Ue.readFileSync(h,"utf8").includes(Vt))continue;let d=be.basename(p.name,be.extname(p.name));o.add(d.toLowerCase()==="index"?be.basename(l):d.toLowerCase())}}}return r.forEach(c),[...o].sort()}function dn(s){let r=Is(be.join(s,"package.json")),o={...r.dependencies||{},...r.devDependencies||{}},c=o.tailwindcss||null,p=[Is(be.join(s,"components.json"))?.tailwind?.css,...cn].filter(Boolean).find(d=>Ue.existsSync(be.join(s,d))),h=p?Ue.readFileSync(be.join(s,p),"utf8"):"",f=hn.filter(d=>o[d]);return!f.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(h)&&!h.includes(`${Vt}/theme.css`)&&f.push("css-custom-properties"),{nativeTokens:{present:h.includes("/* Frontfriend managed native tokens: start */"),file:p||null},tailwind:{present:!!c,version:c,major:c&&Number((String(c).match(/\d+/)||[])[0])||null},componentsJson:Ue.existsSync(be.join(s,"components.json")),themeImport:{present:h.includes(`${Vt}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(h),file:p||null},plugin:pn(s),frontfriendComponents:fn(s),foreignComponentLibraries:ln.filter(d=>o[d]),foreignTokenSystems:f}}function mn(s,r,{baseLibrary:o}={}){let c=pi(s)||Ft,l=c.includes("tokens"),p=c.includes("components"),h=[];return l&&!r.themeImport.present&&!r.nativeTokens?.present&&h.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!l&&r.themeImport.present&&h.push("Frontfriend tokens are present in CSS but are not adopted in config."),p&&o==="shadcn"&&!r.componentsJson&&h.push("Config adopts components, but components.json was not observed."),!p&&r.frontfriendComponents.length>0&&h.push("Frontfriend components are installed but are not adopted in config."),h}function gn({apiUrl:s,token:r,ffId:o,name:c,adopt:l,observed:p,framework:h,primitive:f}){if(!s||!r||!o||!c||!h||f===void 0)return Promise.resolve({reported:!1,unavailable:!0});let d=new URL("/api/apps/sync",s),v=JSON.stringify({ffId:o,name:c,adopt:pi(l),observed:p,runtime:"sdk",framework:h,primitive:f}),w=d.protocol==="https:"?on:an;return new Promise(I=>{let A=w.request(d,{method:"POST",headers:{authorization:`Bearer ${r}`,"content-type":"application/json","content-length":Buffer.byteLength(v)}},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(v)})}As.exports={ADOPTION_LEVELS:Ft,normalizeAdopt:pi,probeAdoption:dn,adoptionWarnings:mn,reportAdoption:gn}});var Es=Pe((Dt,_s)=>{(function(s,r){typeof Dt=="object"&&typeof _s<"u"?r(Dt):typeof define=="function"&&define.amd?define(["exports"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.acorn={}))})(Dt,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],c="\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"},d=/^in(stanceof)?$/,v=new RegExp("["+l+"]"),w=new RegExp("["+l+c+"]");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&&v.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 u=e.charCodeAt(n);if(V(u))return n<i-1&&u===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,at=ee.toString,ne=Object.hasOwn||function(e,t){return xe.call(e,t)},bt=Array.isArray||function(e){return at.call(e)==="[object Array]"},Gt=Object.create(null);function Te(e){return Gt[e]||(Gt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function le(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var wt=/(?:[\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 Q(e,t){for(var i=1,n=0;;){var u=W(e,n,t);if(u<0)return new S(i,t-n);++i,n=u}}var ke={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},Ve=!1;function te(e){var t={};for(var i in ke)t[i]=e&&ne(e,i)?e[i]:ke[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Ve&&typeof console=="object"&&console.warn&&(Ve=!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),bt(t.onToken)){var n=t.onToken;t.onToken=function(u){return n.push(u)}}if(bt(t.onComment)&&(t.onComment=qe(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function qe(e,t){return function(i,n,u,m,g,x){var y={type:i?"Block":"Line",value:n,start:u,end:m};e.locations&&(y.loc=new $(this,g,x)),e.ranges&&(y.range=[u,m]),t.push(y)}}var de=1,Ce=2,We=4,ie=8,G=16,H=32,ye=64,Re=128,Ne=256,Fe=512,we=1024,He=de|Ce|Ne;function oe(e,t){return Ce|(e?We:0)|(t?ie:0)}var se=0,ce=1,ue=2,St=3,Ii=4,Ai=5,X=function(t,i,n){this.options=t=te(t),this.sourceFile=t.sourceFile,this.keywords=Te(f[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var u="";t.allowReserved!==!0&&(u=p[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(u+=" await")),this.reservedWords=Te(u);var m=(u?u+" ":"")+p.strict;this.reservedWordsStrict=Te(m),this.reservedWordsStrictBind=Te(m+" "+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"?Ce:de),this.regexpState=null,this.privateNameStack=[]},Ie={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)})},Ie.inFunction.get=function(){return(this.currentVarScope().flags&Ce)>0},Ie.inGenerator.get=function(){return(this.currentVarScope().flags&ie)>0},Ie.inAsync.get=function(){return(this.currentVarScope().flags&We)>0},Ie.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(Ne|Fe))return!1;if(i&Ce)return(i&We)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Ie.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&de)},Ie.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&ye)>0||this.options.allowSuperOutsideMethod},Ie.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Re)>0},Ie.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Ie.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(Ne|Fe)||i&Ce&&!(i&G))return!0}return!1},Ie.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&we||!this.inModule&&t&de)},Ie.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ne)>0},X.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var n=this,u=0;u<t.length;u++)n=t[u](n);return n},X.parse=function(t,i){return new this(i,t).parse()},X.parseExpressionAt=function(t,i,n){var u=new this(n,t,i);return u.nextToken(),u.parseExpression()},X.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(X.prototype,Ie);var he=X.prototype,tr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;he.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,u=this.input.charAt(n);return u===";"||u==="}"||b.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(u)||u==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,q.lastIndex=e,e+=q.exec(this.input)[0].length,this.input[e]===";"&&e++}},he.eat=function(e){return this.type===e?(this.next(),!0):!1},he.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc},he.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},he.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}},he.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},he.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||b.test(this.input.slice(this.lastTokEnd,this.start))},he.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},he.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()},he.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},he.expect=function(e){this.eat(e)||this.unexpected()},he.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var kt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};he.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")}},he.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")},he.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")},he.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,u=Object.keys(this.undefinedExports);n<u.length;n+=1){var m=u[n];this.raiseRecoverable(this.undefinedExports[m].start,"Export '"+m+"' 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 Jt={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 u=i;do i+=n<=65535?1:2;while(B(n=this.fullCharCodeAt(i)));if(n===92)return!0;var m=this.input.slice(u,i);if(!d.test(m))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 u=n+5,m;if(this.input.slice(n,u)!=="using"||u===this.input.length||B(m=this.fullCharCodeAt(u))||m===92)return!1;q.lastIndex=u;var g=q.exec(this.input);if(n=u+g[0].length,g&&b.test(this.input.slice(u,n)))return!1}var x=this.fullCharCodeAt(n);if(!A(x)&&x!==92)return!1;var y=n;do n+=x<=65535?1:2;while(B(x=this.fullCharCodeAt(n)));if(x===92)return!0;var N=this.input.slice(y,n);if(d.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||(x=this.input.charCodeAt(n+1))===61||x===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,u=this.startNode(),m;switch(this.isLet(e)&&(n=a._var,m="let"),n){case a._break:case a._continue:return this.parseBreakContinueStatement(u,n.keyword);case a._debugger:return this.parseDebuggerStatement(u);case a._do:return this.parseDoStatement(u);case a._for:return this.parseForStatement(u);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(u,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(u,!0);case a._if:return this.parseIfStatement(u);case a._return:return this.parseReturnStatement(u);case a._switch:return this.parseSwitchStatement(u);case a._throw:return this.parseThrowStatement(u);case a._try:return this.parseTryStatement(u);case a._const:case a._var:return m=m||this.value,e&&m!=="var"&&this.unexpected(),this.parseVarStatement(u,m);case a._while:return this.parseWhileStatement(u);case a._with:return this.parseWithStatement(u);case a.braceL:return this.parseBlock(!0,u);case a.semi:return this.parseEmptyStatement(u);case a._export:case a._import:if(this.options.ecmaVersion>10&&n===a._import){q.lastIndex=this.pos;var g=q.exec(this.input),x=this.pos+g[0].length,y=this.input.charCodeAt(x);if(y===40||y===46)return this.parseExpressionStatement(u,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(u):this.parseExport(u,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(u,!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(u,!1,N),this.semicolon(),this.finishNode(u,"VariableDeclaration");var M=this.value,K=this.parseExpression();return n===a.name&&K.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(u,M,K,e):this.parseExpressionStatement(u,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 u=this.labels[n];if((e.label==null||u.name===e.label.name)&&(u.kind!=null&&(i||u.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(Jt),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(Jt),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(),u=i?"let":this.value;return this.next(),this.parseVar(n,!0,u),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var m=this.isContextual("let"),g=!1,x=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(x){var y=this.startNode();return this.next(),x==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(y,!0,x),this.finishNode(y,"VariableDeclaration"),this.parseForAfterInit(e,y,t)}var N=this.containsEsc,M=new kt,K=this.start,pe=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&&(pe.start===K&&!N&&pe.type==="Identifier"&&pe.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),m&&g&&this.raise(pe.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(pe,!1,M),this.checkLValPattern(pe),this.parseForIn(e,pe)):(this.checkExpressionErrors(M,!0),t>-1&&this.unexpected(t),this.parseFor(e,pe))},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,ot|(i?0:Kt),!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(we);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?H:0),this.checkLValPattern(e,t?Ii:ue),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(Jt),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 u=0,m=this.labels;u<m.length;u+=1){var g=m[u];g.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var x=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=x;else break}return this.labels.push({name:t,kind:x,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 u=this.startNode();if(this.parseVarId(u,i),this.eat(a.eq)?u.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&&u.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):u.init=null,e.declarations.push(this.finishNode(u,"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"?ce:ue,!1)};var ot=1,Kt=2,_i=4;C.parseFunction=function(e,t,i,n,u){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===a.star&&t&Kt&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&ot&&(e.id=t&_i&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Kt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?ce:ue:St));var m=this.yieldPos,g=this.awaitPos,x=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(oe(e.async,e.generator)),t&ot||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,u),this.yieldPos=m,this.awaitPos=g,this.awaitIdentPos=x,this.finishNode(e,t&ot?"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(),u=this.startNode(),m=!1;for(u.body=[],this.expect(a.braceL);this.type!==a.braceR;){var g=this.parseClassElement(e.superClass!==null);g&&(u.body.push(g),g.type==="MethodDefinition"&&g.kind==="constructor"?(m&&this.raiseRecoverable(g.start,"Duplicate constructor in the same class"),m=!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(u,"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="",u=!1,m=!1,g="method",x=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?x=!0:n="static"}if(i.static=x,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?m=!0:n="async"),!n&&(t>=9||!m)&&this.eat(a.star)&&(u=!0),!n&&!m&&!u){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"||u||m){var N=!i.static&&Ct(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,u,m,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 u=e.key;e.kind==="constructor"?(t&&this.raise(u.start,"Constructor can't be a generator"),i&&this.raise(u.start,"Constructor can't be an async method")):e.static&&Ct(e,"prototype")&&this.raise(u.start,"Classes may not have a static property named prototype");var m=e.value=this.parseMethod(t,i,n);return e.kind==="get"&&m.params.length!==0&&this.raiseRecoverable(m.start,"getter should have no params"),e.kind==="set"&&m.params.length!==1&&this.raiseRecoverable(m.start,"setter should have exactly one param"),e.kind==="set"&&m.params[0].type==="RestElement"&&this.raiseRecoverable(m.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},C.parseClassField=function(e){return Ct(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Ct(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)?(this.enterScope(Fe|ye),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(Ne|ye);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,ue,!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,u=n===0?null:this.privateNameStack[n-1],m=0;m<i.length;++m){var g=i[m];ne(t,g.name)||(u?u.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],u="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(u=(t.static?"s":"i")+t.kind),n==="iget"&&u==="iset"||n==="iset"&&u==="iget"||n==="sget"&&u==="sset"||n==="sset"&&u==="sget"?(e[i]="true",!1):n?!0:(e[i]=u,!1)}function Ct(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 u=n[i];this.checkUnreserved(u.local),this.checkLocalExport(u.local),u.local.type==="Literal"&&this.raise(u.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,ot|_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),ne(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,u=t.properties;n<u.length;n+=1){var m=u[n];this.checkPatternExport(e,m)}else if(i==="ArrayPattern")for(var g=0,x=t.elements;g<x.length;g+=1){var y=x[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 u=n[i];this.checkPatternExport(e,u.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,ue),this.finishNode(e,"ImportSpecifier")},C.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,ue),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,ue),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(),u=n.key.type==="Identifier"?n.key.name:n.key.value;ne(t,u)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+u+"'"),t[u]=!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 wt.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 Ae=X.prototype;Ae.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,u=e.properties;n<u.length;n+=1){var m=u[n];this.toAssignable(m,t),m.type==="RestElement"&&(m.argument.type==="ArrayPattern"||m.argument.type==="ObjectPattern")&&this.raise(m.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},Ae.toAssignableList=function(e,t){for(var i=e.length,n=0;n<i;n++){var u=e[n];u&&this.toAssignable(u,t)}if(i){var m=e[i-1];this.options.ecmaVersion===6&&t&&m&&m.type==="RestElement"&&m.argument.type!=="Identifier"&&this.unexpected(m.argument.start)}return e},Ae.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},Ae.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")},Ae.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()},Ae.parseBindingList=function(e,t,i,n){for(var u=[],m=!0;!this.eat(e);)if(m?m=!1:this.expect(a.comma),t&&this.type===a.comma)u.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var g=this.parseRestBinding();this.parseBindingListItem(g),u.push(g),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else u.push(this.parseAssignableListItem(n))}return u},Ae.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Ae.parseBindingListItem=function(e){return e},Ae.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")},Ae.checkLValSimple=function(e,t,i){t===void 0&&(t=se);var n=t!==se;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===ue&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(ne(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")}},Ae.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=se),e.type){case"ObjectPattern":for(var n=0,u=e.properties;n<u.length;n+=1){var m=u[n];this.checkLValInnerPattern(m,t,i)}break;case"ArrayPattern":for(var g=0,x=e.elements;g<x.length;g+=1){var y=x[g];y&&this.checkLValInnerPattern(y,t,i)}break;default:this.checkLValSimple(e,t,i)}},Ae.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=se),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 _e=function(t,i,n,u,m){this.token=t,this.isExpr=!!i,this.preserveSpace=!!n,this.override=u,this.generator=!!m},J={b_stat:new _e("{",!1),b_expr:new _e("{",!0),b_tmpl:new _e("${",!1),p_stat:new _e("(",!1),p_expr:new _e("(",!0),q_tmpl:new _e("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new _e("function",!1),f_expr:new _e("function",!0),f_expr_gen:new _e("function",!0,!1,null,!0),f_gen:new _e("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,u;switch(n.type){case"Identifier":u=n.name;break;case"Literal":u=String(n.value);break;default:return}var m=e.kind;if(this.options.ecmaVersion>=6){u==="__proto__"&&m==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0);return}u="$"+u;var g=t[u];if(g){var x;m==="init"?x=this.strict&&g.init||g.get||g.set:x=g.init||g[m],x&&this.raiseRecoverable(n.start,"Redefinition of property")}else g=t[u]={init:!1,get:!1,set:!1};g[m]=!0}},L.parseExpression=function(e,t){var i=this;return this.catchStackOverflow(function(){var n=i.start,u=i.startLoc,m=i.parseMaybeAssign(e,t);if(i.type===a.comma){var g=i.startNodeAt(n,u);for(g.expressions=[m];i.eat(a.comma);)g.expressions.push(i.parseMaybeAssign(e,t));return i.finishNode(g,"SequenceExpression")}return m})},L.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,u=-1,m=-1,g=-1;t?(u=t.parenthesizedAssign,m=t.trailingComma,g=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new kt,n=!0);var x=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,x,y)),this.type.isAssign){var M=this.startNodeAt(x,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 u>-1&&(t.parenthesizedAssign=u),m>-1&&(t.trailingComma=m),N},L.parseMaybeConditional=function(e,t){var i=this.start,n=this.startLoc,u=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return u;if(!(u.type==="ArrowFunctionExpression"&&u.start===i)&&this.eat(a.question)){var m=this.startNodeAt(i,n);return m.test=u,m.consequent=this.parseMaybeAssign(),this.expect(a.colon),m.alternate=this.parseMaybeAssign(e),this.finishNode(m,"ConditionalExpression")}return u},L.parseExprOps=function(e,t){var i=this.start,n=this.startLoc,u=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||u.start===i&&u.type==="ArrowFunctionExpression"?u:this.parseExprOp(u,i,n,-1,e)},L.parseExprOp=function(e,t,i,n,u){var m=this.type.binop;if(m!=null&&(!u||this.type!==a._in)&&m>n){var g=this.type===a.logicalOR||this.type===a.logicalAND,x=this.type===a.coalesce;x&&(m=a.logicalAND.binop);var y=this.value;this.next();var N=this.start,M=this.startLoc,K=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,u),N,M,m,u),pe=this.buildBinary(t,i,e,K,y,g||x);return(g&&this.type===a.coalesce||x&&(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(pe,t,i,n,u)}return e},L.buildBinary=function(e,t,i,n,u,m){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=u,g.right=n,this.finishNode(g,m?"LogicalExpression":"BinaryExpression")},L.parseMaybeUnary=function(e,t,i,n){var u=this.start,m=this.startLoc,g;if(this.isContextual("await")&&this.canAwait)g=this.parseAwait(n),t=!0;else if(this.type.prefix){var x=this.startNode(),y=this.type===a.incDec;x.operator=this.value,x.prefix=!0,this.next(),x.argument=this.parseMaybeUnary(null,!0,y,n),this.checkExpressionErrors(e,!0),y?this.checkLValSimple(x.argument):this.strict&&x.operator==="delete"&&Ei(x.argument)?this.raiseRecoverable(x.start,"Deleting local variable in strict mode"):x.operator==="delete"&&Qt(x.argument)?this.raiseRecoverable(x.start,"Private fields can not be deleted"):t=!0,g=this.finishNode(x,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(u,m);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(u,m,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 Qt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Qt(e.expression)||e.type==="ParenthesizedExpression"&&Qt(e.expression)}L.parseExprSubscripts=function(e,t){var i=this.start,n=this.startLoc,u=this.parseExprAtom(e,t);if(u.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return u;var m=this.parseSubscripts(u,i,n,!1,t);return e&&m.type==="MemberExpression"&&(e.parenthesizedAssign>=m.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=m.start&&(e.parenthesizedBind=-1),e.trailingComma>=m.start&&(e.trailingComma=-1)),m},L.parseSubscripts=function(e,t,i,n,u){for(var m=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 x=this.parseSubscript(e,t,i,n,m,g,u);if(x.optional&&(g=!0),x===e||x.type==="ArrowFunctionExpression"){if(g){var y=this.startNodeAt(t,i);y.expression=x,x=this.finishNode(y,"ChainExpression")}return x}e=x}},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,u,m,g){var x=this.options.ecmaVersion>=11,y=x&&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,x&&(M.optional=y),e=this.finishNode(M,"MemberExpression")}else if(!n&&this.eat(a.parenL)){var K=new kt,pe=this.yieldPos,lt=this.awaitPos,Ye=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Pt=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,K);if(u&&!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=pe,this.awaitPos=lt,this.awaitIdentPos=Ye,this.parseSubscriptAsyncArrow(t,i,Pt,g);this.checkExpressionErrors(K,!0),this.yieldPos=pe||this.yieldPos,this.awaitPos=lt||this.awaitPos,this.awaitIdentPos=Ye||this.awaitIdentPos;var Xe=this.startNodeAt(t,i);Xe.callee=e,Xe.arguments=Pt,x&&(Xe.optional=y),e=this.finishNode(Xe,"CallExpression")}else if(this.type===a.backQuote){(y||m)&&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,u=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 m=this.start,g=this.startLoc,x=this.containsEsc,y=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!x&&y.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(J.f_expr),this.parseFunction(this.startNodeAt(m,g),0,!1,!0,t);if(u&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(m,g),[y],!1,t);if(this.options.ecmaVersion>=8&&y.name==="async"&&this.type===a.name&&!x&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return y=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(m,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(u,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,u,m=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var g=this.start,x=this.startLoc,y=[],N=!0,M=!1,K=new kt,pe=this.yieldPos,lt=this.awaitPos,Ye;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(N?N=!1:this.expect(a.comma),m&&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 Pt=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=pe,this.awaitPos=lt,this.parseParenArrowList(i,n,y,t);(!y.length||M)&&this.unexpected(this.lastTokStart),Ye&&this.unexpected(Ye),this.checkExpressionErrors(K,!0),this.yieldPos=pe||this.yieldPos,this.awaitPos=lt||this.awaitPos,y.length>1?(u=this.startNodeAt(g,x),u.expressions=y,this.finishNodeAt(u,"SequenceExpression",Pt,Xe)):u=y[0]}else u=this.parseParenExpression();if(this.options.preserveParens){var Ze=this.startNodeAt(i,n);return Ze.expression=u,this.finishNode(Ze,"ParenthesizedExpression")}else return u},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,u=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,u,!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,u={};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 m=this.parseProperty(e,t);e||this.checkPropClash(m,u,t),i.properties.push(m)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},L.parseProperty=function(e,t){var i=this.startNode(),n,u,m,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)&&(m=this.start,g=this.startLoc),e||(n=this.eat(a.star)));var x=this.containsEsc;return this.parsePropertyName(i),!e&&!x&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(i)?(u=!0,n=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):u=!1,this.parsePropertyValue(i,e,n,u,m,g,t,x),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,u,m,g,x){(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&&!x&&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=u),t?e.value=this.parseMaybeDefault(u,m,this.copyNode(e.key)):this.type===a.eq&&g?(g.shorthandAssign<0&&(g.shorthandAssign=this.start),e.value=this.parseMaybeDefault(u,m,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(),u=this.yieldPos,m=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(ce(t,n.generator)|qe|(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=u,this.awaitPos=m,this.awaitIdentPos=g,this.finishNode(n,"FunctionExpression")},L.parseArrowExpression=function(e,t,i,n){var u=this.yieldPos,m=this.awaitPos,g=this.awaitIdentPos;return this.enterScope(ce(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=u,this.awaitPos=m,this.awaitIdentPos=g,this.finishNode(e,"ArrowFunctionExpression")},L.parseFunctionBody=function(e,t,i,n){var u=t&&this.type!==a.braceL,m=this.strict,g=!1;if(u)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var x=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!m||x)&&(g=this.strictDirective(this.end),g&&x&&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,!m&&!g&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ai),e.body=this.parseBlock(!1,void 0,g&&!m),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,u=e.params;n<u.length;n+=1){var m=u[n];this.checkLValInnerPattern(m,at,t?null:i)}},L.parseExprList=function(e,t,i,n){for(var u=[],m=!0;!this.eat(e);){if(m)m=!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),u.push(g)}return u},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&ie)&&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 u=this.strict?this.reservedWordsStrict:this.reservedWords;u.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 Ct=X.prototype;Ct.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},Ct.raiseRecoverable=Ct.raise,Ct.curPosition=function(){if(this.options.locations)return new S(this.curLine,this.pos-this.lineStart)};var We=X.prototype,ar=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};We.enterScope=function(e){this.scopeStack.push(new ar(e))},We.exitScope=function(){this.scopeStack.pop()},We.treatFunctionsAsVarInScope=function(e){return e.flags&Q||!this.inModule&&e.flags&de},We.declareName=function(e,t,i){var n=!1;if(t===Ve){var u=this.currentScope();n=u.lexical.indexOf(e)>-1||u.functions.indexOf(e)>-1||u.var.indexOf(e)>-1,u.lexical.push(e),this.inModule&&u.flags&de&&delete this.undefinedExports[e]}else if(t===Ii){var m=this.currentScope();m.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 x=this.scopeStack.length-1;x>=0;--x){var y=this.scopeStack[x];if(y.lexical.indexOf(e)>-1&&!(y.flags&Pe&&y.lexical[0]===e)||!this.treatFunctionsAsVarInScope(y)&&y.functions.indexOf(e)>-1){n=!0;break}if(y.var.push(e),this.inModule&&y.flags&de&&delete this.undefinedExports[e],y.flags&ie)break}n&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},We.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},We.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},We.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(ie|je|ae))return t}},We.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(ie|je|ae)&&!(t.flags&be))return t}};var ct=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])},ut=X.prototype;ut.startNode=function(){return new ct(this,this.start,this.startLoc)},ut.startNodeAt=function(e,t){return new ct(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}ut.finishNode=function(e,t){return Pi.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ut.finishNodeAt=function(e,t,i,n){return Pi.call(this,e,t,i,n)},ut.copyNode=function(e){var t=new ct(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",Fi=Vi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Di=Fi+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Mi=Di+" 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:Fi,11:Di,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 Qt=0,Ui=[9,10,11,12,13,14];Qt<Ui.length;Qt+=1){var mr=Ui[Qt];dr(mr)}var k=X.prototype,It=function(t,i){this.parent=t,this.base=i||this};It.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},It.prototype.sibling=function(){return new It(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 u=n.indexOf("v")!==-1,m=n.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=n,u&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=m&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=m&&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,u=n.length;if(t>=u)return-1;var m=n.charCodeAt(t);if(!(i||this.switchU)||m<=55295||m>=57344||t+1>=u)return m;var g=n.charCodeAt(t+1);return g>=56320&&g<=57343?(m<<10)+g-56613888:m},Ne.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var n=this.source,u=n.length;if(t>=u)return u;var m=n.charCodeAt(t),g;return!(i||this.switchU)||m<=55295||m>=57344||t+1>=u||(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,u=0,m=t;u<m.length;u+=1){var g=m[u],x=this.at(n,i);if(x===-1||x!==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,u=!1,m=0;m<i.length;m++){var g=i.charAt(m);t.indexOf(g)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(g,m+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),g==="u"&&(n=!0),g==="v"&&(u=!0)}this.options.ecmaVersion>=15&&n&&u&&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 It(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,u=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(u=e.lastIntValue),e.eat(125)))return u!==-1&&u<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 u=0;u<i.length;u++){var m=i.charAt(u);i.indexOf(m,u+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 x=0;x<g.length;x++){var y=g.charAt(x);(g.indexOf(y,x+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+=ue(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,u=i;n<u.length;n+=1){var m=u[n];m.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+=ue(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=ue(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&&!At(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 u=e.lastIntValue;if(n&&u>=55296&&u<=56319){var m=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=(u-55296)*1024+(g-56320)+65536,!0}e.pos=m,e.lastIntValue=u}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,Fe=1,_e=2;k.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(wr(t))return e.lastIntValue=-1,e.advance(),Fe;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===_e&&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),Fe}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var u=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,u)}return Hi},k.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){re(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 Fe;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return _e;e.raise("Invalid property name")},k.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";zi(t=e.current());)e.lastStringValue+=ue(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+=ue(t),e.advance();return e.lastStringValue!==""};function Sr(e){return zi(e)||At(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===_e&&e.raise("Negated character class may contain strings"),!0}return!1},k.regexp_classContents=function(e){return e.current()===93?Fe:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Fe)},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=Fe,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===_e&&(t=_e);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==_e&&(t=Fe);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===_e&&(t=_e)}},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)?Fe: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===_e&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var u=this.regexp_eatCharacterClassEscape(e);if(u)return u;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)===_e&&(t=_e);return t},k.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Fe:_e},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 At(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;At(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function At(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 u=e.current();if(!Gi(u))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Ji(u),e.advance()}return!0};var _t=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 _t(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 _t(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,u=t;(n=W(this.input,u,this.pos))>-1;)++this.curLine,u=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 '"+ue(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 '"+ue(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 u=this.input.slice(i,this.pos);++this.pos;var m=this.pos,g=this.readWord1();this.containsEsc&&this.unexpected(m);var x=this.regexpState||(this.regexpState=new Ne(this));x.reset(i,u,g),this.validateRegExpFlags(x),this.validateRegExpPattern(x);var y=null;try{y=new RegExp(u,g)}catch{}return this.finishToken(a.regexp,{pattern:u,flags:g,value:y})},U.readInt=function(e,t,i){for(var n=this.options.ecmaVersion>=12&&t===void 0,u=i&&this.input.charCodeAt(this.pos)===48,m=this.pos,g=0,x=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){u&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),x===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"),x=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;x=M,g=g*e+K}return n&&x===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===m||t!=null&&this.pos-m!==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 u=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,u)}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 m=Ar(this.input.slice(t,this.pos),i);return this.finishToken(a.num,m)},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+=`
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,u={};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 m=this.parseProperty(e,t);e||this.checkPropClash(m,u,t),i.properties.push(m)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},L.parseProperty=function(e,t){var i=this.startNode(),n,u,m,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)&&(m=this.start,g=this.startLoc),e||(n=this.eat(a.star)));var x=this.containsEsc;return this.parsePropertyName(i),!e&&!x&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(i)?(u=!0,n=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):u=!1,this.parsePropertyValue(i,e,n,u,m,g,t,x),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,u,m,g,x){(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&&!x&&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=u),t?e.value=this.parseMaybeDefault(u,m,this.copyNode(e.key)):this.type===a.eq&&g?(g.shorthandAssign<0&&(g.shorthandAssign=this.start),e.value=this.parseMaybeDefault(u,m,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(),u=this.yieldPos,m=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(oe(t,n.generator)|ye|(i?Re: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=u,this.awaitPos=m,this.awaitIdentPos=g,this.finishNode(n,"FunctionExpression")},L.parseArrowExpression=function(e,t,i,n){var u=this.yieldPos,m=this.awaitPos,g=this.awaitIdentPos;return this.enterScope(oe(i,!1)|G),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=u,this.awaitPos=m,this.awaitIdentPos=g,this.finishNode(e,"ArrowFunctionExpression")},L.parseFunctionBody=function(e,t,i,n){var u=t&&this.type!==a.braceL,m=this.strict,g=!1;if(u)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var x=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!m||x)&&(g=this.strictDirective(this.end),g&&x&&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,!m&&!g&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ai),e.body=this.parseBlock(!1,void 0,g&&!m),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,u=e.params;n<u.length;n+=1){var m=u[n];this.checkLValInnerPattern(m,ce,t?null:i)}},L.parseExprList=function(e,t,i,n){for(var u=[],m=!0;!this.eat(e);){if(m)m=!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),u.push(g)}return u},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&He)&&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 u=this.strict?this.reservedWordsStrict:this.reservedWords;u.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 It=X.prototype;It.raise=function(e,t){var i=Q(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},It.raiseRecoverable=It.raise,It.curPosition=function(){if(this.options.locations)return new S(this.curLine,this.pos-this.lineStart)};var ze=X.prototype,ar=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};ze.enterScope=function(e){this.scopeStack.push(new ar(e))},ze.exitScope=function(){this.scopeStack.pop()},ze.treatFunctionsAsVarInScope=function(e){return e.flags&Ce||!this.inModule&&e.flags&de},ze.declareName=function(e,t,i){var n=!1;if(t===ue){var u=this.currentScope();n=u.lexical.indexOf(e)>-1||u.functions.indexOf(e)>-1||u.var.indexOf(e)>-1,u.lexical.push(e),this.inModule&&u.flags&de&&delete this.undefinedExports[e]}else if(t===Ii){var m=this.currentScope();m.lexical.push(e)}else if(t===St){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 x=this.scopeStack.length-1;x>=0;--x){var y=this.scopeStack[x];if(y.lexical.indexOf(e)>-1&&!(y.flags&H&&y.lexical[0]===e)||!this.treatFunctionsAsVarInScope(y)&&y.functions.indexOf(e)>-1){n=!0;break}if(y.var.push(e),this.inModule&&y.flags&de&&delete this.undefinedExports[e],y.flags&He)break}n&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},ze.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},ze.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},ze.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(He|Fe|Ne))return t}},ze.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(He|Fe|Ne)&&!(t.flags&G))return t}};var ct=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])},ut=X.prototype;ut.startNode=function(){return new ct(this,this.start,this.startLoc)},ut.startNodeAt=function(e,t){return new ct(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}ut.finishNode=function(e,t){return Pi.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},ut.finishNodeAt=function(e,t,i,n){return Pi.call(this,e,t,i,n)},ut.copyNode=function(e){var t=new ct(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",Fi=Vi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Di=Fi+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Mi=Di+" 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:Fi,11:Di,12:Mi,13:Bi,14:pr},$i={};function dr(e){var t=$i[e]={binary:Te(ur[e]+" "+ji),binaryOfStrings:Te(hr[e]),nonBinary:{General_Category:Te(ji),Script:Te(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 Yt=0,Ui=[9,10,11,12,13,14];Yt<Ui.length;Yt+=1){var mr=Ui[Yt];dr(mr)}var k=X.prototype,At=function(t,i){this.parent=t,this.base=i||this};At.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},At.prototype.sibling=function(){return new At(this.parent,this.base)};var Le=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};Le.prototype.reset=function(t,i,n){var u=n.indexOf("v")!==-1,m=n.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=n,u&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=m&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=m&&this.parser.options.ecmaVersion>=9)},Le.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Le.prototype.at=function(t,i){i===void 0&&(i=!1);var n=this.source,u=n.length;if(t>=u)return-1;var m=n.charCodeAt(t);if(!(i||this.switchU)||m<=55295||m>=57344||t+1>=u)return m;var g=n.charCodeAt(t+1);return g>=56320&&g<=57343?(m<<10)+g-56613888:m},Le.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var n=this.source,u=n.length;if(t>=u)return u;var m=n.charCodeAt(t),g;return!(i||this.switchU)||m<=55295||m>=57344||t+1>=u||(g=n.charCodeAt(t+1))<56320||g>57343?t+1:t+2},Le.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},Le.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Le.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Le.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},Le.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var n=this.pos,u=0,m=t;u<m.length;u+=1){var g=m[u],x=this.at(n,i);if(x===-1||x!==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,u=!1,m=0;m<i.length;m++){var g=i.charAt(m);t.indexOf(g)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(g,m+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),g==="u"&&(n=!0),g==="v"&&(u=!0)}this.options.ecmaVersion>=15&&n&&u&&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 At(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,u=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(u=e.lastIntValue),e.eat(125)))return u!==-1&&u<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 u=0;u<i.length;u++){var m=i.charAt(u);i.indexOf(m,u+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 x=0;x<g.length;x++){var y=g.charAt(x);(g.indexOf(y,x+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+=le(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,u=i;n<u.length;n+=1){var m=u[n];m.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+=le(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=le(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&&!_t(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 u=e.lastIntValue;if(n&&u>=55296&&u<=56319){var m=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=(u-55296)*1024+(g-56320)+65536,!0}e.pos=m,e.lastIntValue=u}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,De=1,Ee=2;k.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(wr(t))return e.lastIntValue=-1,e.advance(),De;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===Ee&&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),De}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var u=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,u)}return Hi},k.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){ne(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 De;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Ee;e.raise("Invalid property name")},k.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";zi(t=e.current());)e.lastStringValue+=le(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+=le(t),e.advance();return e.lastStringValue!==""};function Sr(e){return zi(e)||_t(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===Ee&&e.raise("Negated character class may contain strings"),!0}return!1},k.regexp_classContents=function(e){return e.current()===93?De:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),De)},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=De,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===Ee&&(t=Ee);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==Ee&&(t=De);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===Ee&&(t=Ee)}},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)?De: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===Ee&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var u=this.regexp_eatCharacterClassEscape(e);if(u)return u;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)===Ee&&(t=Ee);return t},k.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?De:Ee},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 _t(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;_t(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function _t(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 u=e.current();if(!Gi(u))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Ji(u),e.advance()}return!0};var Et=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 Et(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 Et(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,u=t;(n=W(this.input,u,this.pos))>-1;)++this.curLine,u=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 '"+le(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 '"+le(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 u=this.input.slice(i,this.pos);++this.pos;var m=this.pos,g=this.readWord1();this.containsEsc&&this.unexpected(m);var x=this.regexpState||(this.regexpState=new Le(this));x.reset(i,u,g),this.validateRegExpFlags(x),this.validateRegExpPattern(x);var y=null;try{y=new RegExp(u,g)}catch{}return this.finishToken(a.regexp,{pattern:u,flags:g,value:y})},U.readInt=function(e,t,i){for(var n=this.options.ecmaVersion>=12&&t===void 0,u=i&&this.input.charCodeAt(this.pos)===48,m=this.pos,g=0,x=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){u&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),x===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"),x=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;x=M,g=g*e+K}return n&&x===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===m||t!=null&&this.pos-m!==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 u=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,u)}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 m=Ar(this.input.slice(t,this.pos),i);return this.finishToken(a.num,m)},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
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
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 ue(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],u=parseInt(n,8);return u>255&&(n=n.slice(0,-1),u=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(u)}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 u=this.fullCharCodeAtPos();if(B(u,n))this.pos+=u<=65535?1:2;else if(u===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var m=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(m,"Invalid Unicode escape"),e+=ue(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=oe[e]),this.finishToken(t,e)};var Xi="8.17.0";X.acorn={Parser:X,version:Xi,defaultOptions:Se,Position:S,SourceLocation:$,getLineInfo:te,Node:ct,TokenType:_,tokTypes:a,keywordTypes:oe,TokContext:Ae,tokContexts:J,isIdentifierChar:B,isIdentifierStart:A,Token:_t,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=ct,s.Parser=X,s.Position=S,s.SourceLocation=$,s.TokContext=Ae,s.Token=_t,s.TokenType=_,s.defaultOptions=Se,s.getLineInfo=te,s.isIdentifierChar=B,s.isIdentifierStart=A,s.isNewLine=V,s.keywordTypes=oe,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=Ee((wa,Ns)=>{var{parse:vn}=Es();function it(){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 it();let r=s.key.type==="Identifier"?s.key.name:s.key.value;if(typeof r!="string"||["__proto__","constructor","prototype"].includes(r))throw it();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),c=o.length===1?Ps(o[0]):o.length===2?xn(o[0],Ps(o[1])):null;if(c?.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=>[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 it()}return{config:l(c),expression:c}}Ns.exports={parseStaticConfig:yn,propertyName:Rs}});var Os=Ee((Sa,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 c=JSON.stringify(r,null,o);Z.writeFileSync(s,c,"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 c=`module.exports = ${Array.isArray(r)?"[]":"{}"};`;Z.writeFileSync(s,c,"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 c=`${s}.lock`,l=Date.now()+2e4,p;for(;p===void 0;)try{p=Z.openSync(c,"wx",384),Z.writeFileSync(p,String(process.pid))}catch(h){if(h.code!=="EEXIST")throw h;try{let f=Number(Z.readFileSync(c,"utf8"));if(Number.isInteger(f)&&f>0)try{process.kill(f,0)}catch(d){if(d.code==="ESRCH"){Z.unlinkSync(c);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(c)}}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=Ee((ka,Ds)=>{var{parseStaticConfig:fi,propertyName:Dt}=Ts(),{fileExists:js,readFileSafe:di,writeTextFile:mi,readJsonFileSafe:Nn}=Os(),st=require("path"),{normalizeAdopt:Vs}=pi(),{parseProjectTarget:Tn}=(Rt(),ht(ss));function Fs(s){try{return Nn(s)??{}}catch{return{}}}function Ln(s){return Fs(st.join(s,"package.json")).name||st.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:c,adopt:l,framework:p,primitive:h,apiUrl:f,baseLibrary:d,tag:v}){let w=Tn({framework:p,primitive:h},"Setup Project target"),I=On(r),A={name:c.trim(),"ff-id":o.trim(),adopt:Vs(l),framework:w.framework,primitive:w.primitive};if(v!==void 0){if(typeof v!="string"||!v.trim())throw new Error("Release tag must not be empty.");A.tag=v.trim()}if(d!==void 0){if(!["frontfriend","shadcn"].includes(d))throw new Error("Base library must be frontfriend or shadcn.");A.baseLibrary=d}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=st.join(s,"frontfriend.config.js"),_;if(js(B)){let T=di(B),{expression:R}=fi(T),E=new Set(["name","ff-id","adopt","framework","primitive",...v!==void 0?["tag","releaseTagId"]:[],...f?["api-url","apiUrl"]:[],...d!==void 0?["baseLibrary"]:[]]),oe=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),O=R.properties.filter(b=>!E.has(Dt(b))&&!oe.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 mi(B,gi(s,_)),A}function gi(s,r){let o=`{
14
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return le(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],u=parseInt(n,8);return u>255&&(n=n.slice(0,-1),u=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(u)}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 u=this.fullCharCodeAtPos();if(B(u,n))this.pos+=u<=65535?1:2;else if(u===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var m=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(m,"Invalid Unicode escape"),e+=le(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:ke,Position:S,SourceLocation:$,getLineInfo:Q,Node:ct,TokenType:_,tokTypes:a,keywordTypes:ae,TokContext:_e,tokContexts:J,isIdentifierChar:B,isIdentifierStart:A,Token:Et,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=ct,s.Parser=X,s.Position=S,s.SourceLocation=$,s.TokContext=_e,s.Token=Et,s.TokenType=_,s.defaultOptions=ke,s.getLineInfo=Q,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=Pe((wa,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),c=o.length===1?Ps(o[0]):o.length===2?xn(o[0],Ps(o[1])):null;if(c?.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(c),expression:c}}Ns.exports={parseStaticConfig:yn,propertyName:Rs}});var Os=Pe((Sa,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 c=JSON.stringify(r,null,o);Z.writeFileSync(s,c,"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 c=`module.exports = ${Array.isArray(r)?"[]":"{}"};`;Z.writeFileSync(s,c,"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 c=`${s}.lock`,l=Date.now()+2e4,p;for(;p===void 0;)try{p=Z.openSync(c,"wx",384),Z.writeFileSync(p,String(process.pid))}catch(h){if(h.code!=="EEXIST")throw h;try{let f=Number(Z.readFileSync(c,"utf8"));if(Number.isInteger(f)&&f>0)try{process.kill(f,0)}catch(d){if(d.code==="ESRCH"){Z.unlinkSync(c);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(c)}}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=Pe((ka,Ds)=>{var{parseStaticConfig:di,propertyName:Mt}=Ts(),{fileExists:js,readFileSafe:mi,writeTextFile:gi,readJsonFileSafe:Nn}=Os(),rt=require("path"),{normalizeAdopt:Vs}=fi(),{parseProjectTarget:Tn}=(Nt(),ht(ss));function Fs(s){try{return Nn(s)??{}}catch{return{}}}function Ln(s){return Fs(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:c,adopt:l,framework:p,primitive:h,apiUrl:f,baseLibrary:d,tag:v}){let w=Tn({framework:p,primitive:h},"Setup Project target"),I=On(r),A={name:c.trim(),"ff-id":o.trim(),adopt:Vs(l),framework:w.framework,primitive:w.primitive};if(v!==void 0){if(typeof v!="string"||!v.trim())throw new Error("Release tag must not be empty.");A.tag=v.trim()}if(d!==void 0){if(!["frontfriend","shadcn"].includes(d))throw new Error("Base library must be frontfriend or shadcn.");A.baseLibrary=d}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=mi(B),{expression:R}=di(T),E=new Set(["name","ff-id","adopt","framework","primitive",...v!==void 0?["tag","releaseTagId"]:[],...f?["api-url","apiUrl"]:[],...d!==void 0?["baseLibrary"]:[]]),ae=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),O=R.properties.filter(b=>!E.has(Mt(b))&&!ae.has(Mt(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 gi(B,vi(s,_)),A}function vi(s,r){let o=`{
16
16
  ${r.join(`,
17
17
  `)}
18
- }`;return Fs(st.join(s,"package.json")).type==="module"?`const config = ${o};
18
+ }`;return Fs(rt.join(s,"package.json")).type==="module"?`const config = ${o};
19
19
 
20
20
  export default config;
21
21
  `:`module.exports = ${o};
22
- `}function Vn(s,r){let o=st.join(s,"frontfriend.config.js");if(!r||!js(o))return!1;let c=di(o),{config:l,expression:p}=fi(c);if(l["api-url"]||l.apiUrl)return!1;let h=[...p.properties.map(f=>c.slice(f.start,f.end)),`${JSON.stringify("api-url")}: ${JSON.stringify(String(r).replace(/\/+$/,""))}`];return mi(o,gi(s,h)),!0}function Fn(s,r){let o=st.join(s,"frontfriend.config.js"),c=di(o),{expression:l}=fi(c),p=Vs(r),h=`${JSON.stringify("adopt")}: ${JSON.stringify(p)}`,f=l.properties.map(d=>Dt(d)==="adopt"?h:c.slice(d.start,d.end));return l.properties.some(d=>Dt(d)==="adopt")||f.push(h),mi(o,gi(s,f)),p}Ds.exports={defaultAppName:Ln,writeSetupConfig:jn,writeConfigApiUrl:Vn,writeConfigAdopt:Fn}});var Us=Ee((Ca,$s)=>{var Bs=require("path"),{createRequire:Dn}=require("module"),Mt;function Mn(s){if(Mt)return Mt;let r=[null,s&&Bs.isAbsolute(s)?s:null,Bs.join(process.cwd(),"package.json")];for(let c of r)try{return Mt=c?Dn(c)("typescript"):require("typescript"),Mt}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=Ee((Aa,Ws)=>{var Ia=require("path"),{loadTypeScript:Bn}=Us(),Bt={ui:"@/components/ui",components:"@/components",utils:"@/lib/utils",lib:"@/lib",hooks:"@/hooks"};function vi(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 vi(h[1],`${r}.ts`).map(d=>({...d,start:d.start+f,end:d.end+f}))});let o=Bn(r),c=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(c)==="require")?h.arguments[0]:null;f&&o.isStringLiteral(f)&&l.push({value:f.text,start:f.getStart(c),end:f.end}),o.forEachChild(h,p)};return p(c),l}function qs(s,r,o,c){let l=vi(s,r).map(h=>{let f=h.value.replace(/^@\/registry\/(?:bases\/)?[^/]+\/(ui|lib|hooks|components)\//,(d,v)=>`${Bt[v]}/`);for(let[d,v]of Object.entries(o).sort((w,I)=>String(I[1]).length-String(w[1]).length))if(Bt[d]&&(f===v||f.startsWith(`${v}/`))){f=Bt[d]+f.slice(v.length);break}return{...h,normalized:f}}),p=s;for(let h of l.reverse())(c||h.value!==h.normalized)&&(p=p.slice(0,h.start)+JSON.stringify(h.normalized)+p.slice(h.end));return c?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:Bt,importStrings:vi,normalizedSource:$n,normalizeNativeImports:Un}});var Js=Ee((_a,Gs)=>{var ge=require("fs"),z=require("path"),{normalizeAdopt:qn,ADOPTION_LEVELS:Wn}=pi(),{readJsonc:Hn}=ci(),{defaultAppName:zn}=Ms(),{PORTABLE_ALIASES:xi,importStrings:Ut,normalizedSource:gt}=Hs(),{readProjectPaths:zs,resolveConfiguredAlias:Gn}=(mt(),ht(Ot));function qt(s){try{return Hn(s)}catch{throw new Error(`Cannot read ${s}.`)}}function Ge(s,r){let o=z.relative(s,r);if(!o||o.startsWith(`..${z.sep}`)||o===".."||z.isAbsolute(o))throw new Error(`Source must stay inside the Application: ${r}`);if(ge.existsSync(r)&&ge.realpathSync(r)!==z.join(ge.realpathSync(s),o))throw new Error(`Linked source cannot be imported: ${o}`);return o.replace(/\\/g,"/")}function $t(s,r,o){let c=Gn(s,r,o);return Ge(s,c),c}function Jn(s,r,o,c={},l=r){let p=gt(s,r,c);for(let h of Ut(p,r).reverse()){if(h.value.startsWith("@frontfriend-local/")){let d=h.value.slice(19);if(!d||d.split("/").some(w=>w===".."||w==="."))throw new Error("Unsafe local source dependency.");let v=z.posix.relative(z.posix.dirname(l),d);v.startsWith(".")||(v=`./${v}`),p=p.slice(0,h.start)+JSON.stringify(v)+p.slice(h.end);continue}let f=Object.entries(xi).sort((d,v)=>v[1].length-d[1].length).find(([d,v])=>o[d]&&(h.value===v||h.value.startsWith(`${v}/`)));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 yi(s){return ge.existsSync(s)?ge.readdirSync(s,{withFileTypes:!0}).sort((r,o)=>r.name.localeCompare(o.name)).flatMap(r=>{let o=z.join(s,r.name);if(r.isSymbolicLink())throw new Error(`Linked source cannot be imported: ${o}`);return r.isDirectory()?yi(o):/\.(?:[cm]?[jt]sx?|vue|css)$/.test(r.name)?[o]:[]}):[]}function Kn(s,r,o){let{materializeInstallationPath:c}=(mt(),ht(Ot)),l=zs(s),p=r.aliases||{},h=$t(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])),d=new Map([...f.values()].flatMap(a=>(a.files||[]).map(b=>[b.path,b]))),v=["",".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=gt(a.content,a.path,{});for(let j of Ut(b,a.path).reverse()){let V=j.value.startsWith(".")?z.posix.normalize(z.posix.join(z.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&&v.map(Y=>V+Y).find(Y=>d.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,_={...qt(z.join(s,"package.json")).devDependencies,...qt(z.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 yi(h)){let b=z.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:c({root:s,source:"canonical",path:V.path,installationLayout:"shadcn"})}));j.every(V=>ge.existsSync(z.join(s,V.relative)))&&R(a,j.map(V=>T(z.join(s,V.relative),V.file.path)),b)}let oe=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(!xi[j])continue;let W=$t(s,V,l);if(j==="utils"&&a===W+z.extname(a))return`lib/utils${z.extname(a)}`;if(a.startsWith(`${W}${z.sep}`))return`${j}/${z.relative(W,a).replace(/\\/g,"/")}`}return b},O=(a,b)=>{let j=gt(`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(".")?z.resolve(s,z.dirname(b.source),a):$t(s,a,l),q=v.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 Ut(b.content,b.source)){let Y=O(W.value,b);if(!Y){let re=W.value.startsWith("@")?W.value.split("/").slice(0,2).join("/"):W.value.split("/")[0];_[re]&&a.npm.add(`${re}@${_[re]}`);continue}let q=Ge(s,Y),ee=B.get(q);if(!ee){let re=oe(Y);if(ee=`support/${re.replace(/\.[^.]+$/,"").replace(/[^a-z0-9/_-]/gi,"-").toLowerCase()}`,A.has(ee))throw new Error(`Source address collision: custom/${ee}`);R(ee,[T(Y,re)],null)}ee!==a.name&&a.dependencies.add(ee);let xe=A.get(ee).files.find(re=>re.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=gt(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:xi,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 c=qn(s.adopt)||Wn,l=qt(z.join(s.appRoot,"components.json")),p={appName:s.name||zn(s.appRoot),framework:s.framework,primitive:s.primitive,style:l.style,adopt:c},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 d=l.tailwind?.css,v="";if(c.includes("tokens")){if(!d)throw new Error("components.json must declare tailwind.css for native token import.");let I=z.resolve(s.appRoot,d);Ge(s.appRoot,I),v=ge.readFileSync(I,"utf8")}let w={phase:"complete",...p,sourceReleaseId:f.releaseId,themeCss:v,componentsJson:l,components:c.includes("components")?Kn(s.appRoot,l,f):[]};return o?{dryRun:!0,payload:w}:r.importShadcn(w)}function Yn(s,r){let{materializeInstallationPath:o}=(mt(),ht(Ot)),c=qt(z.join(s.appRoot,"components.json")),l=$t(s.appRoot,c.aliases?.ui||"@/components/ui",zs(s.appRoot)),p=new Map(yi(l).map(h=>{let f=z.relative(l,h).replace(/\\/g,"/"),d=Ge(s.appRoot,h);return[d,{path:d,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 d=o({root:s.appRoot,source:h.kind,path:f.path,configuredUiPath:s.aliases?.ui,installationLayout:h.installationLayout||(h.source==="shadcn"?"shadcn":void 0)}),v=z.join(s.appRoot,d);ge.existsSync(v)&&(Ge(s.appRoot,v),p.set(d,{path:d,target:f.path,component:h.address||h.canonicalName,content:ge.readFileSync(v,"utf8")}))}return[...p.values()]}Gs.exports={importShadcnApplication:Qn,collectNativeMigrationFiles:Yn,normalizedSource:gt,materializeSource:Jn,importStrings:Ut,inside:Ge}});var oa={};Yt(oa,{AdoptionConflictError:()=>P,ApplicationAdoption:()=>wi,COMPONENT_DELETED:()=>Ht,adoptionDigest:()=>et,deletedComponentLocation:()=>ki,deletedComponentMessage:()=>na,deletedComponentsForLock:()=>Xs,deletedPinMessage:()=>Zs,deletedVersionIds:()=>yt,hashContent:()=>se,parseApplicationLock:()=>Be,serializeApplicationLock:()=>ai,threeWayMerge:()=>Xt,validateInstallationPath:()=>ve,withdrawalWarningsForLock:()=>aa});module.exports=ht(oa);var Si=Ze(require("node:crypto")),D=Ze(require("node:fs")),F=Ze(require("node:path"));Rt();function ze(s){return s&&typeof s=="object"&&"code"in s?String(s.code):void 0}function Nt(s){return s instanceof Error?s.message:String(s)}var P=class extends Error{constructor(o,c=[]){super(o);this.code="ADOPTION_CONFLICT";this.name="AdoptionConflictError",this.conflicts=c}};Rt();var as=Ze(require("node:crypto")),Mr=2e6,rs=1e5;function se(s){return as.default.createHash("sha256").update(Buffer.from(s)).digest("hex")}function pt(s){return String(s).match(/.*(?:\n|$)/g).filter(r=>r!=="")}function ns(s,r){let o=pt(s),c=pt(r),l=Array.from({length:o.length+1},()=>new Uint32Array(c.length+1));for(let w=o.length-1;w>=0;w-=1)for(let I=c.length-1;I>=0;I-=1)l[w][I]=o[w]===c[I]?l[w+1][I+1]+1:Math.max(l[w+1][I],l[w][I+1]);let p=[],h=0,f=0,d=null,v=()=>{d&&p.push(d),d=null};for(;h<o.length||f<c.length;)h<o.length&&f<c.length&&o[h]===c[f]?(v(),h+=1,f+=1):f<c.length&&(h===o.length||l[h][f+1]>l[h+1][f])?(d||={start:h,end:h,replacement:[]},d.replacement.push(c[f]),f+=1):(d||={start:h,end:h,replacement:[]},h+=1,d.end=h);return v(),{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 Xt(s,r,o){let c=pt(s).length,l=Math.max(pt(r).length,pt(o).length);if(c>rs||l>rs||(c+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 d="",v=0;for(let w of f.sort((I,A)=>I.start-A.start||I.end-A.end))d+=p.base.slice(v,w.start).join(""),d+=w.replacement.join(""),v=w.end;return d+p.base.slice(v).join("")}var{isSafeSlug:Kr}=si();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((c,l)=>c.path.localeCompare(l.path))}:{}}:o]))}function dt(s){return Array.isArray(s)?s.map(dt):s&&typeof s=="object"?Object.fromEntries(Object.keys(s).filter(r=>r!=="adoptionDigest").sort().map(r=>[r,dt(s[r])])):s}var ri=(s,r)=>s<r?-1:s>r?1:0;function ls(s){return[...s].sort((r,o)=>ri(r.slug,o.slug)||ri(r.kind,o.kind))}function ni(s){return{...s,contracts:ls(s.contracts),sharedContracts:ls(s.sharedContracts)}}function Qr(s){return{...s,...s.design?{design:ni(s.design)}:{},...Array.isArray(s.sourceReleaseIds)?{sourceReleaseIds:[...new Set(s.sourceReleaseIds)].sort(ri)}:{},...s.components?{components:Object.fromEntries(Object.entries(s.components).map(([r,o])=>[r,Array.isArray(o?.files)?{...o,files:[...o.files].sort((c,l)=>c.path.localeCompare(l.path))}:o]))}:{}}}function et(s){return se(JSON.stringify(dt(Qr(s))))}function Yr(s){return se(JSON.stringify(dt(s)))}function Xr(s){return typeof s.adoptionDigest=="string"&&(et(s)===s.adoptionDigest||Yr(s)===s.adoptionDigest)}function hs(s,r){return et(s)===et(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,d])=>{let v=d;if(!v||!["canonical","private"].includes(String(v.source))||typeof v.versionId!="string"||typeof v.semver!="string")throw new P(`Unsupported source kind for ${f}.`);return[f,v]})),c={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 d=we(f.projectTarget,"Component adoption target");if(!c.projectTarget||d.framework!==c.projectTarget.framework||d.primitive!==c.projectTarget.primitive)throw new P("Component adoption belongs to another Project target.")}if(r.schemaVersion===1)return{...c,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={...c,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 d=[...f.sharedContracts,...f.contracts];if(new Set(d.map(w=>w.slug)).size!==d.length||d.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(se(JSON.stringify(dt({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 Be(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 ai(s){let r=ps(s);return`${JSON.stringify({...r,components:Le(r.components)},null,2)}
24
- `}mt();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 c=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 c.has(h)?!1:(c.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:Wt}=si(),{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(F.default.posix.isAbsolute(r)||/^[A-Za-z]:\//.test(r)||o.some(c=>!c||c==="."||c==="..")||o.some(c=>ia.test(c)))throw new P(`Unsafe installation path: ${s}`);return r}function vt(s){return s.kind==="private"?s.address:s.canonicalName}function bi(s){return s.kind==="private"?"private":"canonical"}function rt(s){return ws(s)}function sa(s,r={}){if(typeof s.baseline=="string")return s.baseline;let o=r[s.baselineHash];return typeof o=="string"&&se(o)===s.baselineHash?o:null}function ra(s){return Object.fromEntries(Object.entries(s).map(([r,o])=>[r,o.files?{...o,files:o.files.map(c=>({path:c.path,installedHash:c.installedHash,baselineHash:c.baselineHash}))}:o]))}var Ht="COMPONENT_DELETED";function yt(s,r=[]){let o=new Set(r);for(let c of s)for(let l of c?.warnings??[])l?.reason===Ht&&typeof l.versionId=="string"&&o.add(l.versionId);return o}function Xs(s,r){if(!s)return[];let o=Be(s),c=r instanceof Set?r:yt(r);return Object.entries(o.components).filter(([,l])=>l.source==="private"&&c.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=>F.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 c=o.join("/");return c&&c!=="."?c:s.join(", ")}function na(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 aa(s,r){let o=Be(s),c=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=c.get(h.versionId);if(!(!f||h.code!=="WITHDRAWN_HISTORICAL_VERSION"||h.severity!=="urgent")){if(h.reason===Ht){let d=o.components[f];l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,reason:Ht,message:Zs({component:f,versionId:d.versionId,semver:d.semver,paths:(d.files||[]).map(v=>v.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 rt(p)){let f=c.get(h.id);if(!f||!h.withdrawnAt)continue;let d=`${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:d})}}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 xt(s){return`${s.framework}/${s.primitive}/${s.canonicalName}`}function er(s,r,o=yt([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 c=new Map(rt(r).map(d=>[vt(d),d.id])),l=new Set(Object.entries(s.components).filter(([d,v])=>v.source==="private"&&o.has(v.versionId)&&!c.has(d)).map(([d])=>d)),p=(d=[])=>Le(Object.fromEntries(d.filter(v=>!l.has(v.privateAddress)).map(v=>[xt(v),v.privateAddress])));if("replacements"in s&&JSON.stringify(p(s.replacements))!==JSON.stringify(p(r.replacements))||s.schemaVersion!==1&&s.sourceReleaseIds.some(d=>d!==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(d=>[d.slug,d]))))!==JSON.stringify(Le(Object.fromEntries((r.contracts??[]).map(d=>[d.slug,d])))))return!1}else if(r.contracts!==void 0)return!1;let h=Object.entries(s.components).filter(([d])=>!l.has(d)),f="replacements"in s?(s.replacements||[]).filter(d=>l.has(d.privateAddress)).map(d=>d.canonicalName).filter(d=>!s.components[d]):[];for(let d of f)c.delete(d);return h.length===c.size&&h.every(([d,v])=>c.get(d)===v.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 c of[...o].reverse()){let l=F.default.join(s,ve(c.from)),p=F.default.join(s,ve(c.to));if(!D.default.existsSync(p))continue;let h=F.default.join(r,`case-rollback-${Si.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 wi=class{constructor(r={}){this.root=F.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 c=F.default.join(this.root,ve(o));try{return D.default.readFileSync(c,"utf8")}catch(l){if(ze(l)==="ENOENT")return null;throw l}}),this.writeFile=r.writeFile||((o,c)=>{let l=F.default.join(this.root,ve(o));D.default.mkdirSync(F.default.dirname(l),{recursive:!0}),D.default.writeFileSync(l,c)})}installationPath(r,o){return ve(li({root:this.root,source:bi(r),path:ve(o),configuredUiPath:this.canonicalUiPath,installationLayout:r.installationLayout||(r.source==="shadcn"?"shadcn":void 0)}))}installationSource(r,o,c){if(r.source!=="shadcn"&&r.installationLayout!=="shadcn")return c;let l={};try{l=JSON.parse(D.default.readFileSync(F.default.join(this.root,"components.json"),"utf8")).aliases||{}}catch{}return ta(c,o,l,r.sourceAliases,this.installationPath(r,o))}acquireMutationLock(){if(!this.usesFilesystem)return()=>{};if(this.mutationLockDepth>0)return this.mutationLockDepth+=1,()=>{this.mutationLockDepth-=1};D.default.mkdirSync(this.root,{recursive:!0});let r=F.default.join(this.root,".frontfriend-update.lock"),o=l=>{try{let p=D.default.openSync(r,"wx");return D.default.writeFileSync(p,`${JSON.stringify({schemaVersion:1,pid:process.pid})}
25
- `),p}catch(p){if(ze(p)!=="EEXIST"||!l)throw p;let h;try{h=JSON.parse(D.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||ze(f)!=="ESRCH")throw f}return D.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: ${Nt(l)}`)}this.mutationLockDepth=1;let c=!1;return()=>{c||(c=!0,this.mutationLockDepth-=1,this.mutationLockDepth===0&&(D.default.closeSync(this.mutationLockFd),this.mutationLockFd=null,D.default.unlinkSync(r)))}}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 r of D.default.readdirSync(this.root)){if(!/^\.frontfriend-transaction-\d+-[0-9a-f]{12}$/.test(r))continue;let o=F.default.join(this.root,r),c=F.default.join(o,"journal.json"),l;try{l=JSON.parse(D.default.readFileSync(c,"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=F.default.join(this.root,h),d=F.default.join(o,"backup",h);if(p.existed)D.default.mkdirSync(F.default.dirname(f),{recursive:!0}),D.default.copyFileSync(d,f);else try{D.default.unlinkSync(f)}catch(v){if(ze(v)!=="ENOENT")throw v}}Ys(this.root,o,l.renames)}D.default.rmSync(o,{recursive:!0,force:!0})}}inspect(r,o={}){Ks(r);let c=we(r.projectTarget,"Resolved Release target"),l=null;if(o.currentLock){if(l=Be(o.currentLock),l.projectTarget&&De(l.projectTarget)!==De(c))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,yt([r],o.deletedVersionIds))}let p={},h=[],f=[];for(let d of rt(r)){let v=vt(d),w=l?.components?.[v]||null,I=d.files.map(R=>{let E=this.installationPath(d,R.path),oe=this.readFile(E);return{path:E,status:oe==null?"available":se(oe)===se(this.installationSource(d,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||se(E)!==R.baselineHash}),_=w&&w.versionId!==d.id,T=B?"drifted":_?"update-available":A.has("drifted")?"drifted":A.has("available")?"available":"exact";p[v]={source:bi(d),status:T,versionId:d.id,semver:d.semver,changelog:d.changelog,files:I},(!w||_)&&d.changelog&&!h.includes(d.changelog)&&h.push(d.changelog),d.withdrawnAt&&f.push(`${v}@${d.semver} is withdrawn${d.withdrawalReason?`: ${d.withdrawalReason}`:"."}${d.correctedVersionId?` Use corrected version ${d.correctedVersionId}.`:""}`)}return{releaseId:r.releaseId,tokenVersionId:r.tokenVersionId,projectTarget:c,token:{versionId:r.tokenVersionId,status:l?l.tokenVersionId===r.tokenVersionId?"exact":"update-available":"available"},components:p,changelogs:h,warnings:f}}missingBaselines(r,o){if(r.contractsOnly)return[];let c=Be(o),l=new Map(rt(r).map(h=>[vt(h),h.id])),p=[];for(let[h,f]of Object.entries(c.components)){if(l.get(h)===f.versionId)continue;let d=(f.files||[]).filter(v=>{if(typeof v.baseline=="string")return!1;let w=this.readFile(v.path);return w!=null&&se(w)!==v.baselineHash}).map(v=>v.baselineHash);d.length!==0&&p.push({identity:h,versionId:f.versionId,sourceReleaseId:f.sourceReleaseId||c.releaseId||null,baselineHashes:d})}return p}baselinesFrom(r,o){let c=new Map(o.map(p=>[`${p.identity}@${p.versionId}`,new Set(p.baselineHashes)])),l={};for(let p of[...r.installOrder||[],...r.canonical||[],...r.private||[]]){let h=c.get(`${vt(p)}@${p.id}`);if(h)for(let f of p.files||[]){let d=this.installationSource(p,f.path,f.content),v=se(d);h.has(v)&&(l[v]=d)}}return l}diff(r){let o=Be(r),c=[];for(let[l,p]of Object.entries(o.components))for(let h of p.files||[]){let f=this.readFile(h.path);c.push({component:l,source:p.source,path:h.path,baselineHash:h.baselineHash,currentHash:f==null?null:se(f),status:f==null?"missing":se(f)===h.baselineHash?"unchanged":"modified"})}return c.sort((l,p)=>l.path.localeCompare(p.path))}planUpdate(r,o={}){Ks(r);let c=o.currentLock?Be(o.currentLock):null;if(r.contractsOnly&&(!o.design||o.components?.length!==0||rt(r).length))throw new P("Contract-only resolution requires an exact design selection and no incoming component source.");let l=r.contractsOnly?c?.projectTarget??null:we(r.projectTarget,"Resolved Release target");if(!r.contractsOnly&&l&&c?.projectTarget&&De(c.projectTarget)!==De(l))throw new P("Project target mismatch between config, Release and lock.");if(c&&c.schemaVersion!==1&&(c.designSystemId!==r.designSystemId||c.ffId!==r.ffId))throw new P("Design System mismatch between config, Release and lock.");let p=yt([r],o.deletedVersionIds);Qs(c,r,p);let h=o.components?new Set(o.components):null,f=new Set,d=c?{...c.components}:{},v={},w=new Set,I=[],A=[],B=new Set,_=[],T=[],R=[],E=[],oe=new Map,O=new Map,a=new Map;for(let[S,$]of Object.entries(c?.components||{}))for(let te of $.files||[])a.set(te.path.toLocaleLowerCase("en-US"),S);for(let S of rt(r)){let $=vt(S);if(h&&!h.has($))continue;let te=c?.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 ne=[];for(let Q of S.files){let G={...Q,content:this.installationSource(S,Q.path,Q.content)},H=this.installationPath(S,G.path),be=H.toLocaleLowerCase("en-US"),Pe=a.get(be);if(Pe&&Pe!==$){if(!o.allowReplacement){E.push({path:H,reason:`owned by ${Pe}; explicit replacement is required`});continue}let ce=d[Pe];if(ce){let ke=(ce.files||[]).filter(at=>at.path.toLocaleLowerCase("en-US")!==be);ke.length===0?delete d[Pe]:d[Pe]={...ce,files:ke}}}let qe=oe.get(be),Je=O.get(be);if(Je&&Je!==$){E.push({path:H,reason:`also claimed by ${Je}`});continue}if(qe&&qe!==H){E.push({path:H,reason:`case collision with ${qe}`});continue}oe.set(be,H),O.set(be,$);let ae=te?.files?.find(ce=>ce.path===H)||te?.files?.find(ce=>ce.path.toLocaleLowerCase("en-US")===be)||(o.allowReplacement&&Pe?c?.components?.[Pe]?.files?.find(ce=>ce.path.toLocaleLowerCase("en-US")===be):null),je=ae&&ae.path!==H&&ae.path.toLocaleLowerCase("en-US")===be;if(je&&F.default.posix.dirname(ae.path)!==F.default.posix.dirname(H)){E.push({path:H,reason:"case-only parent directory renames require an explicit filesystem migration"});continue}let le=this.readFile(je?ae.path:H),ie=le;if(le==null)v[H]=G.content,ie=G.content;else if(ae)if(le===G.content)ie=le;else if(se(le)===ae.baselineHash)v[H]=G.content,ie=G.content;else if(se(G.content)===ae.baselineHash)ie=le;else{let ce=sa(ae,o.baselines),ke=ce==null?null:Xt(ce,le,G.content);ke==null?E.push({path:H,reason:ce==null?"local and incoming source both changed, and the previously adopted source is unavailable to merge them":"local and incoming source both changed"}):(ke!==le&&(v[H]=ke),ie=ke)}else le===G.content?ie=le:o.allowReplacement?(v[H]=G.content,ie=G.content):E.push({path:H,reason:"unmanaged file already exists"});je&&ie!=null&&(v[H]=ie,I.push({from:ae.path,to:H})),ie!=null&&ie!==G.content&&(Oe=!0),v[H]===void 0&&le!=null&&(le===G.content?T.push(H):ie===le&&R.push(H)),ne.push({path:H,installedHash:ie==null?null:se(ie),baselineHash:se(G.content)})}let Ue=new Set(ne.map(Q=>Q.path.toLocaleLowerCase("en-US")));for(let Q of te?.files||[]){if(Ue.has(Q.path.toLocaleLowerCase("en-US")))continue;let G=this.readFile(Q.path);G!=null&&(se(G)===Q.baselineHash?w.add(Q.path):E.push({path:Q.path,reason:"removed upstream but modified locally"}))}d[$]={source:bi(S),versionId:S.id,semver:S.semver,manifestHash:S.digest,sourceReleaseId:r.releaseId,...S.projectTarget?{projectTarget:we(S.projectTarget,"Component Project target")}:{},files:ne},f.add($),Se&&A.push(S.changelog);let de=S.npmDependencies||[];if(de.length&&(Se||!Oe)){let Q=Se&&!Oe;if(_.push({component:`${$}@${S.semver}`,dependencies:[...de],required:Q}),Q)for(let G of de)B.add(G)}}if(E.length>0)throw new P(`Update plan has conflicts; files and lock were not changed: ${E[0].reason}.`,E);let b=Xs(c,p).filter(S=>!f.has(S.component));for(let S of b)delete d[S.component];let j=!!h,V=j&&c&&!o.adoptTokens,W=V?c.tokenVersionId:r.tokenVersionId,Y=V&&(("tokenSourceReleaseId"in c?c.tokenSourceReleaseId:void 0)||c.releaseId)||r.releaseId,q=c&&c.schemaVersion!==1?c.design:void 0,ee=o.design??(j?q:void 0),xe=ee?ni(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(d).map(S=>S.sourceReleaseId||c?.releaseId||r.releaseId)].filter(Boolean))].sort(),re=(r.replacements||[]).filter(S=>{let $=d[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}),bt=new Set(re.map(xt)),Re=[...(c&&"replacements"in c?c.replacements||[]:[]).filter(S=>{let $=d[S.privateAddress],te=c?.components[S.privateAddress];return $?.source==="private"&&$.versionId===te?.versionId&&$.sourceReleaseId===te?.sourceReleaseId&&!f.has(S.privateAddress)&&!f.has(S.canonicalName)&&!bt.has(xt(S))}),...re].sort((S,$)=>xt(S).localeCompare(xt($))),ue={schemaVersion:xe?3:2,...xe?{design:xe}:{},...r.replacements!==void 0||c&&"replacements"in c?{replacements:Re}:{},designSystemId:r.designSystemId,ffId:r.ffId,...(V&&"baseLibrary"in c?c.baseLibrary:r.baseLibrary)?{baseLibrary:V&&"baseLibrary"in c?c.baseLibrary:r.baseLibrary}:{},...(V&&"baseProvenance"in c?c.baseProvenance:r.baseProvenance)?{baseProvenance:V&&"baseProvenance"in c?c.baseProvenance:r.baseProvenance}:{},releaseId:null,tokenVersionId:W,tokenSourceReleaseId:Y,sourceReleaseIds:nt,projectTarget:l,components:ra(d),adoptionDigest:""};er(ue,r)&&(ue.releaseId=r.releaseId),ue.adoptionDigest=et(ue);let wt=c&&c.schemaVersion!==1&&hs(c,ue)?JSON.parse(JSON.stringify(c)):ue;if(Be(wt),o.designMirror){let S=o.designMirror,$;try{$=ea(S,xe,r.ffId)}catch(ne){throw new P(Nt(ne))}let te=new Set([...Object.keys(Zn(F.default.join(this.root,Wt))),...q?[...q.sharedContracts,...q.contracts].map(ne=>ne.slug):[],...$.map(ne=>ne.slug),"README.md"]),Se=Object.fromEntries([...te].flatMap(ne=>{let Ue=this.readFile(`${Wt}/${ne}`);return Ue===null?[]:[[ne,Ue]]})),Oe=Xn(S,Se);for(let[ne,Ue]of Object.entries(Oe.writes)){let de=ve(`${Wt}/${ne}`);if(v[de]!==void 0||Object.values(d).some(Q=>Q.files?.some(G=>G.path===de)))throw new P("A component cannot own a contract mirror path.");v[de]=Ue}for(let ne of Oe.deletes)w.add(ve(`${Wt}/${ne}`))}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(v),deletes:[...w].filter(S=>!Object.keys(v).some($=>$.toLocaleLowerCase("en-US")===S.toLocaleLowerCase("en-US"))).sort(),renames:I.sort((S,$)=>S.from.localeCompare($.from)),nextLock:wt,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 c=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=F.default.join(this.root,`.frontfriend-transaction-${process.pid}-${Si.default.randomBytes(6).toString("hex")}`),f=F.default.join(h,"stage"),d=F.default.join(h,"backup"),v=p.map(I=>({path:ve(I),existed:this.readFile(I)!=null})),w=!1;try{D.default.mkdirSync(f,{recursive:!0});for(let[T,R]of Object.entries(r.writes)){let E=F.default.join(f,ve(T));D.default.mkdirSync(F.default.dirname(E),{recursive:!0}),D.default.writeFileSync(E,R)}D.default.writeFileSync(F.default.join(f,l),ai(r.nextLock));for(let T of v){if(!T.existed)continue;let R=F.default.join(d,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:v,renames:r.renames||[]};D.default.writeFileSync(I,`${JSON.stringify(A)}
22
+ `}function Vn(s,r){let o=rt.join(s,"frontfriend.config.js");if(!r||!js(o))return!1;let c=mi(o),{config:l,expression:p}=di(c);if(l["api-url"]||l.apiUrl)return!1;let h=[...p.properties.map(f=>c.slice(f.start,f.end)),`${JSON.stringify("api-url")}: ${JSON.stringify(String(r).replace(/\/+$/,""))}`];return gi(o,vi(s,h)),!0}function Fn(s,r){let o=rt.join(s,"frontfriend.config.js"),c=mi(o),{expression:l}=di(c),p=Vs(r),h=`${JSON.stringify("adopt")}: ${JSON.stringify(p)}`,f=l.properties.map(d=>Mt(d)==="adopt"?h:c.slice(d.start,d.end));return l.properties.some(d=>Mt(d)==="adopt")||f.push(h),gi(o,vi(s,f)),p}Ds.exports={defaultAppName:Ln,writeSetupConfig:jn,writeConfigApiUrl:Vn,writeConfigAdopt:Fn}});var Us=Pe((Ca,$s)=>{var Bs=require("path"),{createRequire:Dn}=require("module"),Bt;function Mn(s){if(Bt)return Bt;let r=[null,s&&Bs.isAbsolute(s)?s:null,Bs.join(process.cwd(),"package.json")];for(let c of r)try{let l=c?Dn(c)("typescript"):require("typescript");if(typeof l?.createSourceFile!="function")continue;return Bt=l,Bt}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=Pe((Aa,Ws)=>{var Ia=require("path"),{loadTypeScript:Bn}=Us(),$t={ui:"@/components/ui",components:"@/components",utils:"@/lib/utils",lib:"@/lib",hooks:"@/hooks"};function xi(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 xi(h[1],`${r}.ts`).map(d=>({...d,start:d.start+f,end:d.end+f}))});let o=Bn(r),c=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(c)==="require")?h.arguments[0]:null;f&&o.isStringLiteral(f)&&l.push({value:f.text,start:f.getStart(c),end:f.end}),o.forEachChild(h,p)};return p(c),l}function qs(s,r,o,c){let l=xi(s,r).map(h=>{let f=h.value.replace(/^@\/registry\/(?:bases\/)?[^/]+\/(ui|lib|hooks|components)\//,(d,v)=>`${$t[v]}/`);for(let[d,v]of Object.entries(o).sort((w,I)=>String(I[1]).length-String(w[1]).length))if($t[d]&&(f===v||f.startsWith(`${v}/`))){f=$t[d]+f.slice(v.length);break}return{...h,normalized:f}}),p=s;for(let h of l.reverse())(c||h.value!==h.normalized)&&(p=p.slice(0,h.start)+JSON.stringify(h.normalized)+p.slice(h.end));return c?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:$t,importStrings:xi,normalizedSource:$n,normalizeNativeImports:Un}});var Js=Pe((_a,Gs)=>{var ge=require("fs"),z=require("path"),{normalizeAdopt:qn,ADOPTION_LEVELS:Wn}=fi(),{readJsonc:Hn}=ui(),{defaultAppName:zn}=Ms(),{PORTABLE_ALIASES:yi,importStrings:qt,normalizedSource:gt}=Hs(),{readProjectPaths:zs,resolveConfiguredAlias:Gn}=(mt(),ht(jt));function Wt(s){try{return Hn(s)}catch{throw new Error(`Cannot read ${s}.`)}}function Ke(s,r){let o=z.relative(s,r);if(!o||o.startsWith(`..${z.sep}`)||o===".."||z.isAbsolute(o))throw new Error(`Source must stay inside the Application: ${r}`);if(ge.existsSync(r)&&ge.realpathSync(r)!==z.join(ge.realpathSync(s),o))throw new Error(`Linked source cannot be imported: ${o}`);return o.replace(/\\/g,"/")}function Ut(s,r,o){let c=Gn(s,r,o);return Ke(s,c),c}function Jn(s,r,o,c={},l=r){let p=gt(s,r,c);for(let h of qt(p,r).reverse()){if(h.value.startsWith("@frontfriend-local/")){let d=h.value.slice(19);if(!d||d.split("/").some(w=>w===".."||w==="."))throw new Error("Unsafe local source dependency.");let v=z.posix.relative(z.posix.dirname(l),d);v.startsWith(".")||(v=`./${v}`),p=p.slice(0,h.start)+JSON.stringify(v)+p.slice(h.end);continue}let f=Object.entries(yi).sort((d,v)=>v[1].length-d[1].length).find(([d,v])=>o[d]&&(h.value===v||h.value.startsWith(`${v}/`)));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 bi(s){return ge.existsSync(s)?ge.readdirSync(s,{withFileTypes:!0}).sort((r,o)=>r.name.localeCompare(o.name)).flatMap(r=>{let o=z.join(s,r.name);if(r.isSymbolicLink())throw new Error(`Linked source cannot be imported: ${o}`);return r.isDirectory()?bi(o):/\.(?:[cm]?[jt]sx?|vue|css)$/.test(r.name)?[o]:[]}):[]}function Kn(s,r,o){let{materializeInstallationPath:c}=(mt(),ht(jt)),l=zs(s),p=r.aliases||{},h=Ut(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])),d=new Map([...f.values()].flatMap(a=>(a.files||[]).map(b=>[b.path,b]))),v=["",".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=gt(a.content,a.path,{});for(let j of qt(b,a.path).reverse()){let V=j.value.startsWith(".")?z.posix.normalize(z.posix.join(z.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&&v.map(Y=>V+Y).find(Y=>d.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,_={...Wt(z.join(s,"package.json")).devDependencies,...Wt(z.join(s,"package.json")).dependencies},T=(a,b)=>({source:Ke(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 bi(h)){let b=z.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:c({root:s,source:"canonical",path:V.path,installationLayout:"shadcn"})}));j.every(V=>ge.existsSync(z.join(s,V.relative)))&&R(a,j.map(V=>T(z.join(s,V.relative),V.file.path)),b)}let ae=a=>{let b=Ke(s,a);for(let[j,V]of Object.entries(p).sort((W,Y)=>String(Y[1]).length-String(W[1]).length)){if(!yi[j])continue;let W=Ut(s,V,l);if(j==="utils"&&a===W+z.extname(a))return`lib/utils${z.extname(a)}`;if(a.startsWith(`${W}${z.sep}`))return`${j}/${z.relative(W,a).replace(/\\/g,"/")}`}return b},O=(a,b)=>{let j=gt(`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(".")?z.resolve(s,z.dirname(b.source),a):Ut(s,a,l),q=v.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 qt(b.content,b.source)){let Y=O(W.value,b);if(!Y){let ne=W.value.startsWith("@")?W.value.split("/").slice(0,2).join("/"):W.value.split("/")[0];_[ne]&&a.npm.add(`${ne}@${_[ne]}`);continue}let q=Ke(s,Y),ee=B.get(q);if(!ee){let ne=ae(Y);if(ee=`support/${ne.replace(/\.[^.]+$/,"").replace(/[^a-z0-9/_-]/gi,"-").toLowerCase()}`,A.has(ee))throw new Error(`Source address collision: custom/${ee}`);R(ee,[T(Y,ne)],null)}ee!==a.name&&a.dependencies.add(ee);let xe=A.get(ee).files.find(ne=>ne.source===q),at=w(xe.target);j.push({...W,value:at})}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=gt(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:yi,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 c=qn(s.adopt)||Wn,l=Wt(z.join(s.appRoot,"components.json")),p={appName:s.name||zn(s.appRoot),framework:s.framework,primitive:s.primitive,style:l.style,adopt:c},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 d=l.tailwind?.css,v="";if(c.includes("tokens")){if(!d)throw new Error("components.json must declare tailwind.css for native token import.");let I=z.resolve(s.appRoot,d);Ke(s.appRoot,I),v=ge.readFileSync(I,"utf8")}let w={phase:"complete",...p,sourceReleaseId:f.releaseId,themeCss:v,componentsJson:l,components:c.includes("components")?Kn(s.appRoot,l,f):[]};return o?{dryRun:!0,payload:w}:r.importShadcn(w)}function Yn(s,r){let{materializeInstallationPath:o}=(mt(),ht(jt)),c=Wt(z.join(s.appRoot,"components.json")),l=Ut(s.appRoot,c.aliases?.ui||"@/components/ui",zs(s.appRoot)),p=new Map(bi(l).map(h=>{let f=z.relative(l,h).replace(/\\/g,"/"),d=Ke(s.appRoot,h);return[d,{path:d,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 d=o({root:s.appRoot,source:h.kind,path:f.path,configuredUiPath:s.aliases?.ui,installationLayout:h.installationLayout||(h.source==="shadcn"?"shadcn":void 0)}),v=z.join(s.appRoot,d);ge.existsSync(v)&&(Ke(s.appRoot,v),p.set(d,{path:d,target:f.path,component:h.address||h.canonicalName,content:ge.readFileSync(v,"utf8")}))}return[...p.values()]}Gs.exports={importShadcnApplication:Qn,collectNativeMigrationFiles:Yn,normalizedSource:gt,materializeSource:Jn,importStrings:qt,inside:Ke}});var oa={};Xt(oa,{AdoptionConflictError:()=>P,ApplicationAdoption:()=>Si,COMPONENT_DELETED:()=>zt,adoptionDigest:()=>tt,deletedComponentLocation:()=>Ci,deletedComponentMessage:()=>na,deletedComponentsForLock:()=>Xs,deletedPinMessage:()=>Zs,deletedVersionIds:()=>yt,hashContent:()=>re,parseApplicationLock:()=>$e,serializeApplicationLock:()=>oi,threeWayMerge:()=>Zt,validateInstallationPath:()=>ve,withdrawalWarningsForLock:()=>aa});module.exports=ht(oa);var ki=et(require("node:crypto")),D=et(require("node:fs")),F=et(require("node:path"));Nt();function Je(s){return s&&typeof s=="object"&&"code"in s?String(s.code):void 0}function Tt(s){return s instanceof Error?s.message:String(s)}var P=class extends Error{constructor(o,c=[]){super(o);this.code="ADOPTION_CONFLICT";this.name="AdoptionConflictError",this.conflicts=c}};Nt();var as=et(require("node:crypto")),Mr=2e6,rs=1e5;function re(s){return as.default.createHash("sha256").update(Buffer.from(s)).digest("hex")}function pt(s){return String(s).match(/.*(?:\n|$)/g).filter(r=>r!=="")}function ns(s,r){let o=pt(s),c=pt(r),l=Array.from({length:o.length+1},()=>new Uint32Array(c.length+1));for(let w=o.length-1;w>=0;w-=1)for(let I=c.length-1;I>=0;I-=1)l[w][I]=o[w]===c[I]?l[w+1][I+1]+1:Math.max(l[w+1][I],l[w][I+1]);let p=[],h=0,f=0,d=null,v=()=>{d&&p.push(d),d=null};for(;h<o.length||f<c.length;)h<o.length&&f<c.length&&o[h]===c[f]?(v(),h+=1,f+=1):f<c.length&&(h===o.length||l[h][f+1]>l[h+1][f])?(d||={start:h,end:h,replacement:[]},d.replacement.push(c[f]),f+=1):(d||={start:h,end:h,replacement:[]},h+=1,d.end=h);return v(),{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 Zt(s,r,o){let c=pt(s).length,l=Math.max(pt(r).length,pt(o).length);if(c>rs||l>rs||(c+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 d="",v=0;for(let w of f.sort((I,A)=>I.start-A.start||I.end-A.end))d+=p.base.slice(v,w.start).join(""),d+=w.replacement.join(""),v=w.end;return d+p.base.slice(v).join("")}var{isSafeSlug:Kr}=ri();function je(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((c,l)=>c.path.localeCompare(l.path))}:{}}:o]))}function dt(s){return Array.isArray(s)?s.map(dt):s&&typeof s=="object"?Object.fromEntries(Object.keys(s).filter(r=>r!=="adoptionDigest").sort().map(r=>[r,dt(s[r])])):s}var ni=(s,r)=>s<r?-1:s>r?1:0;function ls(s){return[...s].sort((r,o)=>ni(r.slug,o.slug)||ni(r.kind,o.kind))}function ai(s){return{...s,contracts:ls(s.contracts),sharedContracts:ls(s.sharedContracts)}}function Qr(s){return{...s,...s.design?{design:ai(s.design)}:{},...Array.isArray(s.sourceReleaseIds)?{sourceReleaseIds:[...new Set(s.sourceReleaseIds)].sort(ni)}:{},...s.components?{components:Object.fromEntries(Object.entries(s.components).map(([r,o])=>[r,Array.isArray(o?.files)?{...o,files:[...o.files].sort((c,l)=>c.path.localeCompare(l.path))}:o]))}:{}}}function tt(s){return re(JSON.stringify(dt(Qr(s))))}function Yr(s){return re(JSON.stringify(dt(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,d])=>{let v=d;if(!v||!["canonical","private"].includes(String(v.source))||typeof v.versionId!="string"||typeof v.semver!="string")throw new P(`Unsupported source kind for ${f}.`);return[f,v]})),c={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:Se(r.projectTarget,"Application lock target"),components:o};for(let f of Object.values(o)){if(!f.projectTarget)continue;let d=Se(f.projectTarget,"Component adoption target");if(!c.projectTarget||d.framework!==c.projectTarget.framework||d.primitive!==c.projectTarget.primitive)throw new P("Component adoption belongs to another Project target.")}if(r.schemaVersion===1)return{...c,projectTarget:Se(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={...c,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 d=[...f.sharedContracts,...f.contracts];if(new Set(d.map(w=>w.slug)).size!==d.length||d.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(re(JSON.stringify(dt({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 $e(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 oi(s){let r=ps(s);return`${JSON.stringify({...r,components:je(r.components)},null,2)}
24
+ `}mt();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 c=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 c.has(h)?!1:(c.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:Ht}=ri(),{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(F.default.posix.isAbsolute(r)||/^[A-Za-z]:\//.test(r)||o.some(c=>!c||c==="."||c==="..")||o.some(c=>ia.test(c)))throw new P(`Unsafe installation path: ${s}`);return r}function vt(s){return s.kind==="private"?s.address:s.canonicalName}function wi(s){return s.kind==="private"?"private":"canonical"}function nt(s){return ws(s)}function sa(s,r={}){if(typeof s.baseline=="string")return s.baseline;let o=r[s.baselineHash];return typeof o=="string"&&re(o)===s.baselineHash?o:null}function ra(s){return Object.fromEntries(Object.entries(s).map(([r,o])=>[r,o.files?{...o,files:o.files.map(c=>({path:c.path,installedHash:c.installedHash,baselineHash:c.baselineHash}))}:o]))}var zt="COMPONENT_DELETED";function yt(s,r=[]){let o=new Set(r);for(let c of s)for(let l of c?.warnings??[])l?.reason===zt&&typeof l.versionId=="string"&&o.add(l.versionId);return o}function Xs(s,r){if(!s)return[];let o=$e(s),c=r instanceof Set?r:yt(r);return Object.entries(o.components).filter(([,l])=>l.source==="private"&&c.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 Ci(s){if(s.length<=1)return s[0]??"";let r=s.map(l=>F.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 c=o.join("/");return c&&c!=="."?c:s.join(", ")}function na(s){return s.paths.length?`${s.component} was deleted from the design system. Its files in ${Ci(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=Ci(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 aa(s,r){let o=$e(s),c=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=c.get(h.versionId);if(!(!f||h.code!=="WITHDRAWN_HISTORICAL_VERSION"||h.severity!=="urgent")){if(h.reason===zt){let d=o.components[f];l.set(h.versionId,{code:"WITHDRAWN_HISTORICAL_VERSION",severity:"urgent",identity:f,versionId:h.versionId,reason:zt,message:Zs({component:f,versionId:d.versionId,semver:d.semver,paths:(d.files||[]).map(v=>v.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 nt(p)){let f=c.get(h.id);if(!f||!h.withdrawnAt)continue;let d=`${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:d})}}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 xt(s){return`${s.framework}/${s.primitive}/${s.canonicalName}`}function er(s,r,o=yt([r])){if(r.contractsOnly||s.tokenVersionId!==r.tokenVersionId||"baseLibrary"in s&&s.baseLibrary!==(r.baseLibrary||"frontfriend")||"baseProvenance"in s&&JSON.stringify(je(s.baseProvenance||{}))!==JSON.stringify(je(r.baseProvenance||{})))return!1;let c=new Map(nt(r).map(d=>[vt(d),d.id])),l=new Set(Object.entries(s.components).filter(([d,v])=>v.source==="private"&&o.has(v.versionId)&&!c.has(d)).map(([d])=>d)),p=(d=[])=>je(Object.fromEntries(d.filter(v=>!l.has(v.privateAddress)).map(v=>[xt(v),v.privateAddress])));if("replacements"in s&&JSON.stringify(p(s.replacements))!==JSON.stringify(p(r.replacements))||s.schemaVersion!==1&&s.sourceReleaseIds.some(d=>d!==r.releaseId))return!1;if(s.schemaVersion!==1&&s.design){if(s.design.sharedSourceReleaseId!==r.releaseId||JSON.stringify(je(Object.fromEntries(s.design.sharedContracts.map(d=>[d.slug,d]))))!==JSON.stringify(je(Object.fromEntries((r.contracts??[]).map(d=>[d.slug,d])))))return!1}else if(r.contracts!==void 0)return!1;let h=Object.entries(s.components).filter(([d])=>!l.has(d)),f="replacements"in s?(s.replacements||[]).filter(d=>l.has(d.privateAddress)).map(d=>d.canonicalName).filter(d=>!s.components[d]):[];for(let d of f)c.delete(d);return h.length===c.size&&h.every(([d,v])=>c.get(d)===v.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 c of[...o].reverse()){let l=F.default.join(s,ve(c.from)),p=F.default.join(s,ve(c.to));if(!D.default.existsSync(p))continue;let h=F.default.join(r,`case-rollback-${ki.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 Si=class{constructor(r={}){this.root=F.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 c=F.default.join(this.root,ve(o));try{return D.default.readFileSync(c,"utf8")}catch(l){if(Je(l)==="ENOENT")return null;throw l}}),this.writeFile=r.writeFile||((o,c)=>{let l=F.default.join(this.root,ve(o));D.default.mkdirSync(F.default.dirname(l),{recursive:!0}),D.default.writeFileSync(l,c)})}installationPath(r,o){return ve(hi({root:this.root,source:wi(r),path:ve(o),configuredUiPath:this.canonicalUiPath,installationLayout:r.installationLayout||(r.source==="shadcn"?"shadcn":void 0)}))}installationSource(r,o,c){if(r.source!=="shadcn"&&r.installationLayout!=="shadcn")return c;let l={};try{l=JSON.parse(D.default.readFileSync(F.default.join(this.root,"components.json"),"utf8")).aliases||{}}catch{}return ta(c,o,l,r.sourceAliases,this.installationPath(r,o))}acquireMutationLock(){if(!this.usesFilesystem)return()=>{};if(this.mutationLockDepth>0)return this.mutationLockDepth+=1,()=>{this.mutationLockDepth-=1};D.default.mkdirSync(this.root,{recursive:!0});let r=F.default.join(this.root,".frontfriend-update.lock"),o=l=>{try{let p=D.default.openSync(r,"wx");return D.default.writeFileSync(p,`${JSON.stringify({schemaVersion:1,pid:process.pid})}
25
+ `),p}catch(p){if(Je(p)!=="EEXIST"||!l)throw p;let h;try{h=JSON.parse(D.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||Je(f)!=="ESRCH")throw f}return D.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: ${Tt(l)}`)}this.mutationLockDepth=1;let c=!1;return()=>{c||(c=!0,this.mutationLockDepth-=1,this.mutationLockDepth===0&&(D.default.closeSync(this.mutationLockFd),this.mutationLockFd=null,D.default.unlinkSync(r)))}}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 r of D.default.readdirSync(this.root)){if(!/^\.frontfriend-transaction-\d+-[0-9a-f]{12}$/.test(r))continue;let o=F.default.join(this.root,r),c=F.default.join(o,"journal.json"),l;try{l=JSON.parse(D.default.readFileSync(c,"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=F.default.join(this.root,h),d=F.default.join(o,"backup",h);if(p.existed)D.default.mkdirSync(F.default.dirname(f),{recursive:!0}),D.default.copyFileSync(d,f);else try{D.default.unlinkSync(f)}catch(v){if(Je(v)!=="ENOENT")throw v}}Ys(this.root,o,l.renames)}D.default.rmSync(o,{recursive:!0,force:!0})}}inspect(r,o={}){Ks(r);let c=Se(r.projectTarget,"Resolved Release target"),l=null;if(o.currentLock){if(l=$e(o.currentLock),l.projectTarget&&Me(l.projectTarget)!==Me(c))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,yt([r],o.deletedVersionIds))}let p={},h=[],f=[];for(let d of nt(r)){let v=vt(d),w=l?.components?.[v]||null,I=d.files.map(R=>{let E=this.installationPath(d,R.path),ae=this.readFile(E);return{path:E,status:ae==null?"available":re(ae)===re(this.installationSource(d,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||re(E)!==R.baselineHash}),_=w&&w.versionId!==d.id,T=B?"drifted":_?"update-available":A.has("drifted")?"drifted":A.has("available")?"available":"exact";p[v]={source:wi(d),status:T,versionId:d.id,semver:d.semver,changelog:d.changelog,files:I},(!w||_)&&d.changelog&&!h.includes(d.changelog)&&h.push(d.changelog),d.withdrawnAt&&f.push(`${v}@${d.semver} is withdrawn${d.withdrawalReason?`: ${d.withdrawalReason}`:"."}${d.correctedVersionId?` Use corrected version ${d.correctedVersionId}.`:""}`)}return{releaseId:r.releaseId,tokenVersionId:r.tokenVersionId,projectTarget:c,token:{versionId:r.tokenVersionId,status:l?l.tokenVersionId===r.tokenVersionId?"exact":"update-available":"available"},components:p,changelogs:h,warnings:f}}missingBaselines(r,o){if(r.contractsOnly)return[];let c=$e(o),l=new Map(nt(r).map(h=>[vt(h),h.id])),p=[];for(let[h,f]of Object.entries(c.components)){if(l.get(h)===f.versionId)continue;let d=(f.files||[]).filter(v=>{if(typeof v.baseline=="string")return!1;let w=this.readFile(v.path);return w!=null&&re(w)!==v.baselineHash}).map(v=>v.baselineHash);d.length!==0&&p.push({identity:h,versionId:f.versionId,sourceReleaseId:f.sourceReleaseId||c.releaseId||null,baselineHashes:d})}return p}baselinesFrom(r,o){let c=new Map(o.map(p=>[`${p.identity}@${p.versionId}`,new Set(p.baselineHashes)])),l={};for(let p of[...r.installOrder||[],...r.canonical||[],...r.private||[]]){let h=c.get(`${vt(p)}@${p.id}`);if(h)for(let f of p.files||[]){let d=this.installationSource(p,f.path,f.content),v=re(d);h.has(v)&&(l[v]=d)}}return l}diff(r){let o=$e(r),c=[];for(let[l,p]of Object.entries(o.components))for(let h of p.files||[]){let f=this.readFile(h.path);c.push({component:l,source:p.source,path:h.path,baselineHash:h.baselineHash,currentHash:f==null?null:re(f),status:f==null?"missing":re(f)===h.baselineHash?"unchanged":"modified"})}return c.sort((l,p)=>l.path.localeCompare(p.path))}planUpdate(r,o={}){Ks(r);let c=o.currentLock?$e(o.currentLock):null;if(r.contractsOnly&&(!o.design||o.components?.length!==0||nt(r).length))throw new P("Contract-only resolution requires an exact design selection and no incoming component source.");let l=r.contractsOnly?c?.projectTarget??null:Se(r.projectTarget,"Resolved Release target");if(!r.contractsOnly&&l&&c?.projectTarget&&Me(c.projectTarget)!==Me(l))throw new P("Project target mismatch between config, Release and lock.");if(c&&c.schemaVersion!==1&&(c.designSystemId!==r.designSystemId||c.ffId!==r.ffId))throw new P("Design System mismatch between config, Release and lock.");let p=yt([r],o.deletedVersionIds);Qs(c,r,p);let h=o.components?new Set(o.components):null,f=new Set,d=c?{...c.components}:{},v={},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(c?.components||{}))for(let Q of $.files||[])a.set(Q.path.toLocaleLowerCase("en-US"),S);for(let S of nt(r)){let $=vt(S);if(h&&!h.has($))continue;let Q=c?.components?.[$]||null,ke=!Q||Q.versionId!==S.id,Ve=!1;if(S.kind==="private"&&r.capabilities?.freshPrivateSelection!==!0&&Q?.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($)&&Q?.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&&Q?.versionId!==S.id){E.push({component:$,reason:`${$}@${S.semver} is withdrawn and cannot be freshly installed${S.withdrawalReason?`: ${S.withdrawalReason}`:""}`});continue}let te=[];for(let ie of S.files){let G={...ie,content:this.installationSource(S,ie.path,ie.content)},H=this.installationPath(S,G.path),ye=H.toLocaleLowerCase("en-US"),Re=a.get(ye);if(Re&&Re!==$){if(!o.allowReplacement){E.push({path:H,reason:`owned by ${Re}; explicit replacement is required`});continue}let ce=d[Re];if(ce){let ue=(ce.files||[]).filter(St=>St.path.toLocaleLowerCase("en-US")!==ye);ue.length===0?delete d[Re]:d[Re]={...ce,files:ue}}}let Ne=ae.get(ye),Fe=O.get(ye);if(Fe&&Fe!==$){E.push({path:H,reason:`also claimed by ${Fe}`});continue}if(Ne&&Ne!==H){E.push({path:H,reason:`case collision with ${Ne}`});continue}ae.set(ye,H),O.set(ye,$);let we=Q?.files?.find(ce=>ce.path===H)||Q?.files?.find(ce=>ce.path.toLocaleLowerCase("en-US")===ye)||(o.allowReplacement&&Re?c?.components?.[Re]?.files?.find(ce=>ce.path.toLocaleLowerCase("en-US")===ye):null),He=we&&we.path!==H&&we.path.toLocaleLowerCase("en-US")===ye;if(He&&F.default.posix.dirname(we.path)!==F.default.posix.dirname(H)){E.push({path:H,reason:"case-only parent directory renames require an explicit filesystem migration"});continue}let oe=this.readFile(He?we.path:H),se=oe;if(oe==null)v[H]=G.content,se=G.content;else if(we)if(oe===G.content)se=oe;else if(re(oe)===we.baselineHash)v[H]=G.content,se=G.content;else if(re(G.content)===we.baselineHash)se=oe;else{let ce=sa(we,o.baselines),ue=ce==null?null:Zt(ce,oe,G.content);ue==null?E.push({path:H,reason:ce==null?"local and incoming source both changed, and the previously adopted source is unavailable to merge them":"local and incoming source both changed"}):(ue!==oe&&(v[H]=ue),se=ue)}else oe===G.content?se=oe:o.allowReplacement?(v[H]=G.content,se=G.content):E.push({path:H,reason:"unmanaged file already exists"});He&&se!=null&&(v[H]=se,I.push({from:we.path,to:H})),se!=null&&se!==G.content&&(Ve=!0),v[H]===void 0&&oe!=null&&(oe===G.content?T.push(H):se===oe&&R.push(H)),te.push({path:H,installedHash:se==null?null:re(se),baselineHash:re(G.content)})}let qe=new Set(te.map(ie=>ie.path.toLocaleLowerCase("en-US")));for(let ie of Q?.files||[]){if(qe.has(ie.path.toLocaleLowerCase("en-US")))continue;let G=this.readFile(ie.path);G!=null&&(re(G)===ie.baselineHash?w.add(ie.path):E.push({path:ie.path,reason:"removed upstream but modified locally"}))}d[$]={source:wi(S),versionId:S.id,semver:S.semver,manifestHash:S.digest,sourceReleaseId:r.releaseId,...S.projectTarget?{projectTarget:Se(S.projectTarget,"Component Project target")}:{},files:te},f.add($),ke&&A.push(S.changelog);let de=S.npmDependencies||[],Ce=Q?.files||[],We=!!Q&&(Ce.length!==te.length||te.some(ie=>Ce.find(G=>G.path===ie.path)?.baselineHash!==ie.baselineHash));if(de.length&&(ke||We||!Ve)){let ie=(ke||We)&&!Ve;if(_.push({component:`${$}@${S.semver}`,dependencies:[...de],required:ie}),ie)for(let G of de)B.add(G)}}if(E.length>0)throw new P(`Update plan has conflicts; files and lock were not changed: ${E[0].reason}.`,E);let b=Xs(c,p).filter(S=>!f.has(S.component));for(let S of b)delete d[S.component];let j=!!h,V=j&&c&&!o.adoptTokens,W=V?c.tokenVersionId:r.tokenVersionId,Y=V&&(("tokenSourceReleaseId"in c?c.tokenSourceReleaseId:void 0)||c.releaseId)||r.releaseId,q=c&&c.schemaVersion!==1?c.design:void 0,ee=o.design??(j?q:void 0),xe=ee?ai(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(je(Object.fromEntries(o.design.sharedContracts.map(S=>[S.slug,S]))))!==JSON.stringify(je(Object.fromEntries((r.contracts??[]).map(S=>[S.slug,S])))))throw new P("Design snapshot does not match the selected Release contract set.");let at=[...new Set([Y,...xe?[xe.sharedSourceReleaseId]:[],...Object.values(d).map(S=>S.sourceReleaseId||c?.releaseId||r.releaseId)].filter(Boolean))].sort(),ne=(r.replacements||[]).filter(S=>{let $=d[S.privateAddress],Q=r.private?.find(ke=>ke.address===S.privateAddress);return S.framework===l?.framework&&S.primitive===l?.primitive&&$?.source==="private"&&$.sourceReleaseId===r.releaseId&&$.versionId===Q?.id}),bt=new Set(ne.map(xt)),Te=[...(c&&"replacements"in c?c.replacements||[]:[]).filter(S=>{let $=d[S.privateAddress],Q=c?.components[S.privateAddress];return $?.source==="private"&&$.versionId===Q?.versionId&&$.sourceReleaseId===Q?.sourceReleaseId&&!f.has(S.privateAddress)&&!f.has(S.canonicalName)&&!bt.has(xt(S))}),...ne].sort((S,$)=>xt(S).localeCompare(xt($))),le={schemaVersion:xe?3:2,...xe?{design:xe}:{},...r.replacements!==void 0||c&&"replacements"in c?{replacements:Te}:{},designSystemId:r.designSystemId,ffId:r.ffId,...(V&&"baseLibrary"in c?c.baseLibrary:r.baseLibrary)?{baseLibrary:V&&"baseLibrary"in c?c.baseLibrary:r.baseLibrary}:{},...(V&&"baseProvenance"in c?c.baseProvenance:r.baseProvenance)?{baseProvenance:V&&"baseProvenance"in c?c.baseProvenance:r.baseProvenance}:{},releaseId:null,tokenVersionId:W,tokenSourceReleaseId:Y,sourceReleaseIds:at,projectTarget:l,components:ra(d),adoptionDigest:""};er(le,r)&&(le.releaseId=r.releaseId),le.adoptionDigest=tt(le);let wt=c&&c.schemaVersion!==1&&hs(c,le)?JSON.parse(JSON.stringify(c)):le;if($e(wt),o.designMirror){let S=o.designMirror,$;try{$=ea(S,xe,r.ffId)}catch(te){throw new P(Tt(te))}let Q=new Set([...Object.keys(Zn(F.default.join(this.root,Ht))),...q?[...q.sharedContracts,...q.contracts].map(te=>te.slug):[],...$.map(te=>te.slug),"README.md"]),ke=Object.fromEntries([...Q].flatMap(te=>{let qe=this.readFile(`${Ht}/${te}`);return qe===null?[]:[[te,qe]]})),Ve=Xn(S,ke);for(let[te,qe]of Object.entries(Ve.writes)){let de=ve(`${Ht}/${te}`);if(v[de]!==void 0||Object.values(d).some(Ce=>Ce.files?.some(We=>We.path===de)))throw new P("A component cannot own a contract mirror path.");v[de]=qe}for(let te of Ve.deletes)w.add(ve(`${Ht}/${te}`))}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:je(v),deletes:[...w].filter(S=>!Object.keys(v).some($=>$.toLocaleLowerCase("en-US")===S.toLocaleLowerCase("en-US"))).sort(),renames:I.sort((S,$)=>S.from.localeCompare($.from)),nextLock:wt,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 c=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=F.default.join(this.root,`.frontfriend-transaction-${process.pid}-${ki.default.randomBytes(6).toString("hex")}`),f=F.default.join(h,"stage"),d=F.default.join(h,"backup"),v=p.map(I=>({path:ve(I),existed:this.readFile(I)!=null})),w=!1;try{D.default.mkdirSync(f,{recursive:!0});for(let[T,R]of Object.entries(r.writes)){let E=F.default.join(f,ve(T));D.default.mkdirSync(F.default.dirname(E),{recursive:!0}),D.default.writeFileSync(E,R)}D.default.writeFileSync(F.default.join(f,l),oi(r.nextLock));for(let T of v){if(!T.existed)continue;let R=F.default.join(d,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:v,renames:r.renames||[]};D.default.writeFileSync(I,`${JSON.stringify(A)}
26
26
  `),D.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{D.default.unlinkSync(F.default.join(this.root,R))}catch(O){if(ze(O)!=="ENOENT")throw O}let oe=F.default.join(this.root,E);D.default.mkdirSync(F.default.dirname(oe),{recursive:!0}),D.default.renameSync(F.default.join(f,E),oe),_.add(E),B+=1}for(let T of Object.keys(r.writes)){if(_.has(T))continue;o.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 r.deletes||[]){o.beforeCommitFile?.(T,B);try{D.default.unlinkSync(F.default.join(this.root,ve(T)))}catch(R){if(ze(R)!=="ENOENT")throw R}B+=1}return o.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,r.nextLock}catch(I){try{for(let A of v){let B=F.default.join(this.root,A.path);if(A.existed){let _=F.default.join(d,A.path);D.default.mkdirSync(F.default.dirname(B),{recursive:!0}),D.default.copyFileSync(_,B)}else try{D.default.unlinkSync(B)}catch(_){if(ze(_)!=="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}: ${Nt(A)}`)}throw I}finally{w&&D.default.rmSync(h,{recursive:!0,force:!0})}}finally{c()}}};0&&(module.exports={AdoptionConflictError,ApplicationAdoption,COMPONENT_DELETED,adoptionDigest,deletedComponentLocation,deletedComponentMessage,deletedComponentsForLock,deletedPinMessage,deletedVersionIds,hashContent,parseApplicationLock,serializeApplicationLock,threeWayMerge,validateInstallationPath,withdrawalWarningsForLock});
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{D.default.unlinkSync(F.default.join(this.root,R))}catch(O){if(Je(O)!=="ENOENT")throw O}let ae=F.default.join(this.root,E);D.default.mkdirSync(F.default.dirname(ae),{recursive:!0}),D.default.renameSync(F.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=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 r.deletes||[]){o.beforeCommitFile?.(T,B);try{D.default.unlinkSync(F.default.join(this.root,ve(T)))}catch(R){if(Je(R)!=="ENOENT")throw R}B+=1}return o.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,r.nextLock}catch(I){try{for(let A of v){let B=F.default.join(this.root,A.path);if(A.existed){let _=F.default.join(d,A.path);D.default.mkdirSync(F.default.dirname(B),{recursive:!0}),D.default.copyFileSync(_,B)}else try{D.default.unlinkSync(B)}catch(_){if(Je(_)!=="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}: ${Tt(A)}`)}throw I}finally{w&&D.default.rmSync(h,{recursive:!0,force:!0})}}finally{c()}}};0&&(module.exports={AdoptionConflictError,ApplicationAdoption,COMPONENT_DELETED,adoptionDigest,deletedComponentLocation,deletedComponentMessage,deletedComponentsForLock,deletedPinMessage,deletedVersionIds,hashContent,parseApplicationLock,serializeApplicationLock,threeWayMerge,validateInstallationPath,withdrawalWarningsForLock});