create-prisma-php-app 5.0.0-alpha.1 → 5.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{execSync,spawnSync}from"child_process";import fs from"fs";import{fileURLToPath}from"url";import path from"path";import chalk from"chalk";import prompts from"prompts";import https from"https";import{randomBytes}from"crypto";const __filename=fileURLToPath(import.meta.url),__dirname=path.dirname(__filename);let updateAnswer=null;const nonBackendFiles=["favicon.ico","\\src\\app\\index.php","metadata.php","not-found.php","error.php"],STARTER_KITS={basic:{id:"basic",name:"Basic PHP Application",description:"Simple PHP backend with minimal dependencies",features:{backendOnly:!0,tailwindcss:!1,websocket:!1,prisma:!1,swaggerDocs:!1,mcp:!1},requiredFiles:["bootstrap.php",".htaccess","src/app/layout.php","src/app/index.php"]},fullstack:{id:"fullstack",name:"Full-Stack Application",description:"Complete web application with frontend and backend",features:{backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1},requiredFiles:["bootstrap.php",".htaccess","postcss.config.js","src/app/layout.php","src/app/index.php","public/js/main.js","src/app/globals.css"]},api:{id:"api",name:"REST API",description:"Backend API with database and documentation",features:{backendOnly:!0,tailwindcss:!1,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1},requiredFiles:["bootstrap.php",".htaccess"]},realtime:{id:"realtime",name:"Real-time Application",description:"Application with WebSocket support and MCP",features:{backendOnly:!1,tailwindcss:!0,websocket:!0,prisma:!0,swaggerDocs:!0,mcp:!0},requiredFiles:["bootstrap.php",".htaccess","postcss.config.js","src/lib/websocket","src/lib/mcp"]},ecommerce:{id:"ecommerce",name:"E-commerce Starter",description:"Full e-commerce application with cart, payments, and admin",features:{backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1},requiredFiles:[],source:{type:"git",url:"https://github.com/your-org/prisma-php-ecommerce-starter",branch:"main"}},blog:{id:"blog",name:"Blog CMS",description:"Blog content management system",features:{backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!1,mcp:!1},requiredFiles:[],source:{type:"git",url:"https://github.com/your-org/prisma-php-blog-starter"}}};function bsConfigUrls(e){const s=e.indexOf("\\htdocs\\");if(-1===s)return console.error("Invalid PROJECT_ROOT_PATH. The path does not contain \\htdocs\\"),{bsTarget:"",bsPathRewrite:{}};const t=e.substring(0,s+8).replace(/\\/g,"\\\\"),n=e.replace(new RegExp(`^${t}`),"").replace(/\\/g,"/");let c=`http://localhost/${n}`;c=c.endsWith("/")?c.slice(0,-1):c;const o=c.replace(/(?<!:)(\/\/+)/g,"/"),r=n.replace(/\/\/+/g,"/");return{bsTarget:`${o}/`,bsPathRewrite:{"^/":`/${r.startsWith("/")?r.substring(1):r}/`}}}async function updatePackageJson(e,s){const t=path.join(e,"package.json");if(checkExcludeFiles(t))return;const n=JSON.parse(fs.readFileSync(t,"utf8"));n.scripts={...n.scripts,projectName:"tsx settings/project-name.ts"};let c=[];if(s.tailwindcss&&(n.scripts={...n.scripts,tailwind:"postcss src/app/globals.css -o public/css/styles.css --watch","tailwind:build":"postcss src/app/globals.css -o public/css/styles.css"},c.push("tailwind")),s.typescript&&!s.backendOnly&&(n.scripts={...n.scripts,"ts:watch":"vite build --watch","ts:build":"vite build"},c.push("ts:watch")),s.websocket&&(n.scripts={...n.scripts,websocket:"tsx settings/restart-websocket.ts"},c.push("websocket")),s.mcp&&(n.scripts={...n.scripts,mcp:"tsx settings/restart-mcp.ts"},c.push("mcp")),s.swaggerDocs){const e=s.prisma?"tsx settings/auto-swagger-docs.ts":"tsx settings/swagger-config.ts";n.scripts={...n.scripts,"create-swagger-docs":e}}let o={...n.scripts};o.browserSync="tsx settings/bs-config.ts",o["browserSync:build"]="tsx settings/build.ts",o.dev=`npm-run-all projectName -p browserSync ${c.join(" ")}`;let r=["browserSync:build"];s.tailwindcss&&r.unshift("tailwind:build"),s.typescript&&!s.backendOnly&&r.unshift("ts:build"),o.build=`npm-run-all ${r.join(" ")}`,n.scripts=o,n.type="module",fs.writeFileSync(t,JSON.stringify(n,null,2))}async function updateComposerJson(e){checkExcludeFiles(path.join(e,"composer.json"))}async function updateIndexJsForWebSocket(e,s){if(!s.websocket)return;const t=path.join(e,"public","js","main.js");if(checkExcludeFiles(t))return;let n=fs.readFileSync(t,"utf8");n+='\nwindow.ws = new WebSocket("ws://localhost:8080");\n',fs.writeFileSync(t,n,"utf8")}function generateAuthSecret(){return randomBytes(33).toString("base64")}function generateHexEncodedKey(e=16){return randomBytes(e).toString("hex")}function copyRecursiveSync(e,s,t){const n=fs.existsSync(e),c=n&&fs.statSync(e);if(n&&c&&c.isDirectory()){const n=s.toLowerCase();if(!t.websocket&&n.includes("src\\lib\\websocket"))return;if(!t.mcp&&n.includes("src\\lib\\mcp"))return;if((!t.typescript||t.backendOnly)&&(n.endsWith("\\ts")||n.includes("\\ts\\")))return;if((!t.typescript||t.backendOnly)&&(n.endsWith("\\vite-plugins")||n.includes("\\vite-plugins\\")||n.includes("\\vite-plugins")))return;if(t.backendOnly&&n.includes("public\\js")||t.backendOnly&&n.includes("public\\css")||t.backendOnly&&n.includes("public\\assets"))return;if(!t.swaggerDocs&&n.includes("src\\app\\swagger-docs"))return;const c=s.replace(/\\/g,"/");if(updateAnswer?.excludeFilePath?.includes(c))return;fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0}),fs.readdirSync(e).forEach(n=>{copyRecursiveSync(path.join(e,n),path.join(s,n),t)})}else{if(checkExcludeFiles(s))return;if(!t.tailwindcss&&(s.includes("globals.css")||s.includes("styles.css")))return;if(!t.websocket&&s.includes("restart-websocket.ts"))return;if(!t.mcp&&s.includes("restart-mcp.ts"))return;if(t.backendOnly&&nonBackendFiles.some(e=>s.includes(e)))return;if(!t.backendOnly&&s.includes("route.php"))return;if(t.backendOnly&&!t.swaggerDocs&&s.includes("layout.php"))return;if(!t.swaggerDocs&&s.includes("swagger-config.ts"))return;if(t.tailwindcss&&s.includes("index.css"))return;if((!t.swaggerDocs||!t.prisma)&&(s.includes("auto-swagger-docs.ts")||s.includes("prisma-schema-config.json")))return;fs.copyFileSync(e,s,0)}}async function executeCopy(e,s,t){s.forEach(({src:s,dest:n})=>{copyRecursiveSync(path.join(__dirname,s),path.join(e,n),t)})}function modifyPostcssConfig(e){const s=path.join(e,"postcss.config.js");if(checkExcludeFiles(s))return;fs.writeFileSync(s,'export default {\n plugins: {\n "@tailwindcss/postcss": {},\n cssnano: {},\n },\n};',{flag:"w"})}function modifyLayoutPHP(e,s){const t=path.join(e,"src","app","layout.php");if(!checkExcludeFiles(t))try{let e=fs.readFileSync(t,"utf8"),n="";s.backendOnly||(s.tailwindcss||(n='\n <link href="/css/index.css" rel="stylesheet" />'),n+='\n <script type="module" src="/js/main.js"><\/script>');let c="";s.backendOnly||(c=s.tailwindcss?` <link href="/css/styles.css" rel="stylesheet" /> ${n}`:n),e=e.replace("</head>",`${c}\n</head>`),fs.writeFileSync(t,e,{flag:"w"})}catch(e){console.error(chalk.red("Error modifying layout.php:"),e)}}async function createOrUpdateEnvFile(e,s){const t=path.join(e,".env");fs.existsSync(t)&&checkExcludeFiles(t)||fs.writeFileSync(t,s,{flag:"w"})}function checkExcludeFiles(e){if(!updateAnswer?.isUpdate)return!1;const s=e.replace(/\\/g,"/");return!!updateAnswer?.excludeFilePath?.includes(s)||!!updateAnswer?.excludeFiles&&updateAnswer.excludeFiles.some(e=>{const t=e.replace(/\\/g,"/");return s.endsWith("/"+t)||s===t})}async function createDirectoryStructure(e,s){const t=[{src:"/bootstrap.php",dest:"/bootstrap.php"},{src:"/.htaccess",dest:"/.htaccess"},{src:"/tsconfig.json",dest:"/tsconfig.json"},{src:"/app-gitignore",dest:"/.gitignore"},{src:"/CLAUDE.md",dest:"/CLAUDE.md"},{src:"/AGENTS.md",dest:"/AGENTS.md"}];s.tailwindcss&&t.push({src:"/postcss.config.js",dest:"/postcss.config.js"}),s.typescript&&!s.backendOnly&&t.push({src:"/vite.config.ts",dest:"/vite.config.ts"});const n=[{src:"/settings",dest:"/settings"},{src:"/src",dest:"/src"},{src:"/public",dest:"/public"}];s.typescript&&!s.backendOnly&&n.push({src:"/ts",dest:"/ts"}),t.forEach(({src:s,dest:t})=>{const n=path.join(__dirname,s),c=path.join(e,t);if(checkExcludeFiles(c))return;const o=fs.readFileSync(n,"utf8");fs.writeFileSync(c,o,{flag:"w"})}),await executeCopy(e,n,s),await updatePackageJson(e,s),await updateComposerJson(e),s.backendOnly||await updateIndexJsForWebSocket(e,s),s.tailwindcss&&modifyPostcssConfig(e),(s.tailwindcss||!s.backendOnly||s.swaggerDocs)&&modifyLayoutPHP(e,s);const c=generateAuthSecret(),o=generateHexEncodedKey(),r=`# Authentication secret key for JWT or session encryption.\nAUTH_SECRET="${c}"\n# Name of the authentication cookie.\nAUTH_COOKIE_NAME="${generateHexEncodedKey(8)}"\n\n# Show errors in the browser (development only). Set to false in production.\nSHOW_ERRORS="true"\n\n# Application timezone (default: UTC)\nAPP_TIMEZONE="UTC"\n\n# Application environment (development or production)\nAPP_ENV="development"\n\n# Enable or disable application cache (default: false)\nCACHE_ENABLED="false"\n# Cache time-to-live in seconds (default: 600)\nCACHE_TTL="600"\n\n# Local storage key for browser storage (auto-generated if not set).\n# Spaces will be replaced with underscores and converted to lowercase.\nLOCALSTORE_KEY="${o}"\n\n# Secret key for encrypting function calls.\nFUNCTION_CALL_SECRET="${generateHexEncodedKey(32)}"\n\n# Single or multiple origins (CSV or JSON array)\nCORS_ALLOWED_ORIGINS=[]\n\n# If you need cookies/Authorization across origins, keep this true\nCORS_ALLOW_CREDENTIALS="true"\n\n# Optional tuning\nCORS_ALLOWED_METHODS="GET,POST,PUT,PATCH,DELETE,OPTIONS"\nCORS_ALLOWED_HEADERS="Content-Type,Authorization,X-Requested-With"\nCORS_EXPOSE_HEADERS=""\nCORS_MAX_AGE="86400"\n\n# Rate Limiting\nRATE_LIMIT_DEFAULT="200 per minute"\nRATE_LIMIT_RPC="60 per minute"\nRATE_LIMIT_AUTH="60 per minute"`;if(s.prisma){const s=`${'# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\nDATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"'}\n\n${r}`;await createOrUpdateEnvFile(e,s)}else await createOrUpdateEnvFile(e,r)}async function getAnswer(e={},s=!1){if(s)return{projectName:e.projectName??"my-app",backendOnly:e.backendOnly??!1,swaggerDocs:e.swaggerDocs??!1,tailwindcss:e.tailwindcss??!1,typescript:e.typescript??!1,websocket:e.websocket??!1,mcp:e.mcp??!1,prisma:e.prisma??!1};if(e.starterKit){const s=e.starterKit;let t=null;if(STARTER_KITS[s]&&(t=STARTER_KITS[s]),t){const n={projectName:e.projectName??"my-app",starterKit:s,starterKitSource:e.starterKitSource,backendOnly:t.features.backendOnly??!1,tailwindcss:t.features.tailwindcss??!1,websocket:t.features.websocket??!1,prisma:t.features.prisma??!1,swaggerDocs:t.features.swaggerDocs??!1,mcp:t.features.mcp??!1,typescript:t.features.typescript??!1},c=process.argv.slice(2);return c.includes("--backend-only")&&(n.backendOnly=!0),c.includes("--swagger-docs")&&(n.swaggerDocs=!0),c.includes("--tailwindcss")&&(n.tailwindcss=!0),c.includes("--websocket")&&(n.websocket=!0),c.includes("--mcp")&&(n.mcp=!0),c.includes("--prisma")&&(n.prisma=!0),c.includes("--typescript")&&(n.typescript=!0),n}if(e.starterKitSource){const t={projectName:e.projectName??"my-app",starterKit:s,starterKitSource:e.starterKitSource,backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1,typescript:!1},n=process.argv.slice(2);return n.includes("--backend-only")&&(t.backendOnly=!0),n.includes("--swagger-docs")&&(t.swaggerDocs=!0),n.includes("--tailwindcss")&&(t.tailwindcss=!0),n.includes("--websocket")&&(t.websocket=!0),n.includes("--mcp")&&(t.mcp=!0),n.includes("--prisma")&&(t.prisma=!0),n.includes("--typescript")&&(t.typescript=!0),t}}const t=[];e.projectName||t.push({type:"text",name:"projectName",message:"What is your project named?",initial:"my-app"}),e.backendOnly||updateAnswer?.isUpdate||t.push({type:"toggle",name:"backendOnly",message:`Would you like to create a ${chalk.blue("backend-only project")}?`,initial:!1,active:"Yes",inactive:"No"});const n=()=>{console.warn(chalk.red("Operation cancelled by the user.")),process.exit(0)},c=await prompts(t,{onCancel:n}),o=[];c.backendOnly??e.backendOnly??!1?(e.swaggerDocs||o.push({type:"toggle",name:"swaggerDocs",message:`Would you like to use ${chalk.blue("Swagger Docs")}?`,initial:!1,active:"Yes",inactive:"No"}),e.websocket||o.push({type:"toggle",name:"websocket",message:`Would you like to use ${chalk.blue("Websocket")}?`,initial:!1,active:"Yes",inactive:"No"}),e.mcp||o.push({type:"toggle",name:"mcp",message:`Would you like to use ${chalk.blue("MCP (Model Context Protocol)")}?`,initial:!1,active:"Yes",inactive:"No"}),e.prisma||o.push({type:"toggle",name:"prisma",message:`Would you like to use ${chalk.blue("Prisma ORM")}?`,initial:!1,active:"Yes",inactive:"No"})):(e.swaggerDocs||o.push({type:"toggle",name:"swaggerDocs",message:`Would you like to use ${chalk.blue("Swagger Docs")}?`,initial:!1,active:"Yes",inactive:"No"}),e.tailwindcss||o.push({type:"toggle",name:"tailwindcss",message:`Would you like to use ${chalk.blue("Tailwind CSS")}?`,initial:!1,active:"Yes",inactive:"No"}),e.typescript||o.push({type:"toggle",name:"typescript",message:`Would you like to use ${chalk.blue("TypeScript")}?`,initial:!1,active:"Yes",inactive:"No"}),e.websocket||o.push({type:"toggle",name:"websocket",message:`Would you like to use ${chalk.blue("Websocket")}?`,initial:!1,active:"Yes",inactive:"No"}),e.mcp||o.push({type:"toggle",name:"mcp",message:`Would you like to use ${chalk.blue("MCP (Model Context Protocol)")}?`,initial:!1,active:"Yes",inactive:"No"}),e.prisma||o.push({type:"toggle",name:"prisma",message:`Would you like to use ${chalk.blue("Prisma ORM")}?`,initial:!1,active:"Yes",inactive:"No"}));const r=await prompts(o,{onCancel:n});return{projectName:c.projectName?String(c.projectName).trim().replace(/ /g,"-"):e.projectName??"my-app",backendOnly:c.backendOnly??e.backendOnly??!1,swaggerDocs:r.swaggerDocs??e.swaggerDocs??!1,tailwindcss:r.tailwindcss??e.tailwindcss??!1,typescript:r.typescript??e.typescript??!1,websocket:r.websocket??e.websocket??!1,mcp:r.mcp??e.mcp??!1,prisma:r.prisma??e.prisma??!1}}async function uninstallNpmDependencies(e,s,t=!1){console.log("Uninstalling Node dependencies:"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));const n=`npm uninstall ${t?"--save-dev":"--save"} ${s.join(" ")}`;execSync(n,{stdio:"inherit",cwd:e})}async function uninstallComposerDependencies(e,s){console.log("Uninstalling Composer dependencies:"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));const t=`C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar remove ${s.join(" ")}`;execSync(t,{stdio:"inherit",cwd:e})}function fetchPackageVersion(e){return new Promise((s,t)=>{https.get(`https://registry.npmjs.org/${e}`,e=>{let n="";e.on("data",e=>n+=e),e.on("end",()=>{try{const e=JSON.parse(n);s(e["dist-tags"].latest)}catch(e){t(new Error("Failed to parse JSON response"))}})}).on("error",e=>t(e))})}const readJsonFile=e=>{const s=fs.readFileSync(e,"utf8");return JSON.parse(s)};function compareVersions(e,s){const t=e.split(".").map(Number),n=s.split(".").map(Number);for(let e=0;e<t.length;e++){if(t[e]>n[e])return 1;if(t[e]<n[e])return-1}return 0}function getInstalledPackageVersion(e){try{const s=execSync(`npm list -g ${e} --depth=0`).toString().match(new RegExp(`${e}@(\\d+\\.\\d+\\.\\d+)`));return s?s[1]:(console.error(`Package ${e} is not installed`),null)}catch(e){return console.error(e instanceof Error?e.message:String(e)),null}}async function installNpmDependencies(e,s,t=!1){fs.existsSync(path.join(e,"package.json"))?console.log("Updating existing Node.js project..."):console.log("Initializing new Node.js project..."),fs.existsSync(path.join(e,"package.json"))||execSync("npm init -y",{stdio:"inherit",cwd:e}),console.log((t?"Installing development dependencies":"Installing dependencies")+":"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));const n=`npm install ${t?"--save-dev":""} ${s.join(" ")}`;execSync(n,{stdio:"inherit",cwd:e})}function getComposerCmd(){try{return execSync("composer --version",{stdio:"ignore"}),console.log("✓ Using global composer command"),{cmd:"composer",baseArgs:[]}}catch{const e="C:\\xampp\\php\\php.exe",s="C:\\ProgramData\\ComposerSetup\\bin\\composer.phar";if(!fs.existsSync(e))throw console.error(`✗ PHP not found at ${e}`),new Error(`PHP executable not found at ${e}`);if(!fs.existsSync(s))throw console.error(`✗ Composer not found at ${s}`),new Error(`Composer phar not found at ${s}`);return console.log("✓ Using XAMPP PHP with Composer phar"),{cmd:e,baseArgs:[s]}}}export async function installComposerDependencies(e,s){const{cmd:t,baseArgs:n}=getComposerCmd(),c=path.join(e,"composer.json"),o=fs.existsSync(c);if(console.log(chalk.green("Composer project initialization: "+(o?"Updating existing project…":"Setting up new project…"))),fs.existsSync(e)||(console.log(`Creating base directory: ${e}`),fs.mkdirSync(e,{recursive:!0})),!o){const s=[...n,"init","--no-interaction","--name","tsnc/prisma-php-app","--require","php:^8.2","--type","project","--version","1.0.0"];console.log("Attempting composer init...");const o=spawnSync(t,s,{cwd:e,stdio:["ignore","pipe","pipe"],encoding:"utf8"}),r=fs.existsSync(c);if(0===o.status&&r)console.log("✓ Composer init successful and composer.json created");else{0!==o.status?(console.log(`Composer init failed with status ${o.status}`),o.stderr&&console.log(`Stderr: ${o.stderr}`)):console.log("Composer init reported success but didn't create composer.json"),console.log("Creating composer.json manually...");const s={name:"tsnc/prisma-php-app",type:"project",version:"1.0.0",require:{php:"^8.2"},autoload:{"psr-4":{"":"src/"}}};try{const t=path.resolve(e,"composer.json");if(console.log(`Writing composer.json to: ${t}`),fs.writeFileSync(t,JSON.stringify(s,null,2),{encoding:"utf8"}),!fs.existsSync(t))throw new Error("File creation appeared to succeed but file doesn't exist");console.log("✓ Successfully created composer.json")}catch(s){if(console.error("✗ Failed to create composer.json:",s),console.error(`Base directory: ${e}`),console.error(`Absolute base directory: ${path.resolve(e)}`),console.error(`Target file path: ${c}`),console.error(`Absolute target file path: ${path.resolve(c)}`),console.error(`Current working directory: ${process.cwd()}`),console.error(`Base directory exists: ${fs.existsSync(e)}`),fs.existsSync(e))try{const s=fs.statSync(e);console.error(`Base directory is writable: ${s.isDirectory()}`)}catch(e){console.error(`Cannot stat base directory: ${e}`)}throw new Error(`Cannot create composer.json: ${s}`)}}}const r=path.resolve(e,"composer.json");if(!fs.existsSync(r))throw console.error(`✗ composer.json still not found at ${r}`),console.error("Directory contents:",fs.readdirSync(e)),new Error("Failed to create composer.json - file does not exist after all attempts");let i;try{const e=fs.readFileSync(r,"utf8");console.log("✓ Successfully read composer.json"),i=JSON.parse(e)}catch(e){throw console.error("✗ Failed to read/parse composer.json:",e),new Error(`Cannot read composer.json: ${e}`)}i.autoload??={},i.autoload["psr-4"]??={},i.autoload["psr-4"][""]??="src/";try{fs.writeFileSync(r,JSON.stringify(i,null,2)),console.log("✓ Updated composer.json with PSR-4 autoload")}catch(e){throw console.error("✗ Failed to update composer.json:",e),e}if(s.length){console.log("Installing Composer dependencies:"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));try{const c=`${t} ${[...n,"require","--no-interaction","-W",...s].join(" ")}`;execSync(c,{stdio:"inherit",cwd:e,env:{...process.env}}),console.log("✓ Composer dependencies installed")}catch(e){throw console.error("✗ Failed to install composer dependencies:",e),e}}if(o)try{execSync(`${t} ${[...n,"update","--lock","--no-install","--no-interaction"].join(" ")}`,{stdio:"inherit",cwd:e}),console.log("✓ Composer lock updated")}catch(e){throw console.error("✗ Failed to update composer lock:",e),e}try{execSync(`${t} ${[...n,"dump-autoload","--quiet"].join(" ")}`,{stdio:"inherit",cwd:e}),console.log("✓ Composer autoloader regenerated")}catch(e){throw console.error("✗ Failed to regenerate autoloader:",e),e}}const npmPinnedVersions={"@tailwindcss/postcss":"4.2.2","@types/browser-sync":"2.29.1","@types/node":"25.5.2","@types/prompts":"2.4.9","browser-sync":"3.0.4",chalk:"5.6.2","chokidar-cli":"3.0.0",cssnano:"7.1.4","http-proxy-middleware":"3.0.5","npm-run-all":"4.1.5","php-parser":"3.5.1",postcss:"8.5.9","postcss-cli":"11.0.1",prompts:"2.4.2",tailwindcss:"4.2.2",tsx:"4.21.0",typescript:"6.0.2",vite:"7.3.0","fast-glob":"3.3.3","prisma-php":"0.0.1"};function npmPkg(e){return npmPinnedVersions[e]?`${e}@${npmPinnedVersions[e]}`:e}const composerPinnedVersions={"vlucas/phpdotenv":"5.6.3","firebase/php-jwt":"7.0.5","phpmailer/phpmailer":"7.0.1","guzzlehttp/guzzle":"7.10.0","symfony/uid":"7.4.8","brick/math":"0.17.0","cboden/ratchet":"0.4.4","tsnc/prisma-php":"2.0.0","php-mcp/server":"3.3.0","gehrisandro/tailwind-merge-php":"1.2.0"};function composerPkg(e){return composerPinnedVersions[e]?`${e}:${composerPinnedVersions[e]}`:e}function removeDirectorySafe(e){if(fs.existsSync(e))try{return void fs.rmSync(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:250})}catch(s){const t=s;if("win32"===globalThis.process?.platform&&("EPERM"===t.code||"EACCES"===t.code)){try{spawnSync("cmd",["/c","attrib","-R","-H","-S","/S","/D",`${e}\\*`],{stdio:"ignore"})}catch{}return void spawnSync("cmd",["/c","rd","/s","/q",e],{stdio:"ignore"})}throw s}}async function setupStarterKit(e,s){if(!s.starterKit)return;let t=null;if(STARTER_KITS[s.starterKit]?t=STARTER_KITS[s.starterKit]:s.starterKitSource&&(t={id:s.starterKit,name:`Custom Starter Kit (${s.starterKit})`,description:"Custom starter kit from external source",features:{},requiredFiles:[],source:{type:"git",url:s.starterKitSource}}),t){if(console.log(chalk.green(`Setting up ${t.name}...`)),t.source)try{const n=t.source.branch?`git clone -b ${t.source.branch} --depth 1 ${t.source.url} "${e}"`:`git clone --depth 1 ${t.source.url} "${e}"`;execSync(n,{stdio:"inherit"});removeDirectorySafe(path.join(e,".git")),console.log(chalk.blue("Starter kit cloned successfully!"));const c=path.join(e,"prisma-php.json");if(fs.existsSync(c))try{const t=JSON.parse(fs.readFileSync(c,"utf8")),n=e,o=bsConfigUrls(n);t.projectName=s.projectName,t.projectRootPath=n,t.bsTarget=o.bsTarget,t.bsPathRewrite=o.bsPathRewrite;const r=await fetchPackageVersion("create-prisma-php-app");t.version=t.version||r,fs.writeFileSync(c,JSON.stringify(t,null,2)),console.log(chalk.green("Updated prisma-php.json with new project details"))}catch(e){console.warn(chalk.yellow("Failed to update prisma-php.json, will create new one"))}}catch(e){throw console.error(chalk.red(`Failed to setup starter kit: ${e}`)),e}t.customSetup&&await t.customSetup(e,s),console.log(chalk.green(`✓ ${t.name} setup complete!`))}else console.warn(chalk.yellow(`Starter kit '${s.starterKit}' not found. Skipping...`))}function showStarterKits(){console.log(chalk.blue("\n🚀 Available Starter Kits:\n")),Object.values(STARTER_KITS).forEach(e=>{const s=e.source?" (Custom)":" (Built-in)";console.log(chalk.green(` ${e.id}${chalk.gray(s)}`)),console.log(` ${e.name}`),console.log(chalk.gray(` ${e.description}`)),e.source&&console.log(chalk.cyan(` Source: ${e.source.url}`));const t=Object.entries(e.features).filter(([,e])=>!0===e).map(([e])=>e).join(", ");t&&console.log(chalk.magenta(` Features: ${t}`)),console.log()}),console.log(chalk.yellow("Usage:")),console.log(" npx create-prisma-php-app my-project --starter-kit=basic"),console.log(" npx create-prisma-php-app my-project --starter-kit=custom --starter-kit-source=https://github.com/user/repo"),console.log()}async function main(){try{const e=process.argv.slice(2),s=e.includes("-y");let t=e[0];const n=e.find(e=>e.startsWith("--starter-kit=")),c=n?.split("=")[1],o=e.find(e=>e.startsWith("--starter-kit-source=")),r=o?.split("=")[1];if(e.includes("--list-starter-kits"))return void showStarterKits();let i=null,a=!1;if(t){const n=process.cwd(),o=path.join(n,"prisma-php.json");if(c&&r){a=!0;const n={projectName:t,starterKit:c,starterKitSource:r,backendOnly:e.includes("--backend-only"),swaggerDocs:e.includes("--swagger-docs"),tailwindcss:e.includes("--tailwindcss"),typescript:e.includes("--typescript"),websocket:e.includes("--websocket"),mcp:e.includes("--mcp"),prisma:e.includes("--prisma")};i=await getAnswer(n,s)}else if(fs.existsSync(o)){const c=readJsonFile(o);let r=[];c.excludeFiles?.map(e=>{const s=path.join(n,e);fs.existsSync(s)&&r.push(s.replace(/\\/g,"/"))}),updateAnswer={projectName:t,backendOnly:c.backendOnly,swaggerDocs:c.swaggerDocs,tailwindcss:c.tailwindcss,websocket:c.websocket,mcp:c.mcp,prisma:c.prisma,typescript:c.typescript,isUpdate:!0,componentScanDirs:c.componentScanDirs??[],excludeFiles:c.excludeFiles??[],excludeFilePath:r??[],filePath:n};const a={projectName:t,backendOnly:e.includes("--backend-only")||c.backendOnly,swaggerDocs:e.includes("--swagger-docs")||c.swaggerDocs,tailwindcss:e.includes("--tailwindcss")||c.tailwindcss,typescript:e.includes("--typescript")||c.typescript,websocket:e.includes("--websocket")||c.websocket,prisma:e.includes("--prisma")||c.prisma,mcp:e.includes("--mcp")||c.mcp};i=await getAnswer(a,s),null!==i&&(updateAnswer={projectName:t,backendOnly:i.backendOnly,swaggerDocs:i.swaggerDocs,tailwindcss:i.tailwindcss,websocket:i.websocket,mcp:i.mcp,prisma:i.prisma,typescript:i.typescript,isUpdate:!0,componentScanDirs:c.componentScanDirs??[],excludeFiles:c.excludeFiles??[],excludeFilePath:r??[],filePath:n})}else{const n={projectName:t,starterKit:c,starterKitSource:r,backendOnly:e.includes("--backend-only"),swaggerDocs:e.includes("--swagger-docs"),tailwindcss:e.includes("--tailwindcss"),typescript:e.includes("--typescript"),websocket:e.includes("--websocket"),mcp:e.includes("--mcp"),prisma:e.includes("--prisma")};i=await getAnswer(n,s)}if(null===i)return void console.log(chalk.red("Installation cancelled."))}else i=await getAnswer({},s);if(null===i)return void console.warn(chalk.red("Installation cancelled."));const p=await fetchPackageVersion("create-prisma-php-app"),l=getInstalledPackageVersion("create-prisma-php-app");l?-1===compareVersions(l,p)&&(execSync("npm uninstall -g create-prisma-php-app",{stdio:"inherit"}),execSync("npm install -g create-prisma-php-app",{stdio:"inherit"})):execSync("npm install -g create-prisma-php-app",{stdio:"inherit"});const d=process.cwd();let u;if(t)if(a){const s=path.join(d,t);fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0}),u=s,await setupStarterKit(u,i),process.chdir(u);const n=path.join(u,"prisma-php.json");if(fs.existsSync(n)){const s=JSON.parse(fs.readFileSync(n,"utf8"));e.includes("--backend-only")&&(s.backendOnly=!0),e.includes("--swagger-docs")&&(s.swaggerDocs=!0),e.includes("--tailwindcss")&&(s.tailwindcss=!0),e.includes("--typescript")&&(s.typescript=!0),e.includes("--websocket")&&(s.websocket=!0),e.includes("--mcp")&&(s.mcp=!0),e.includes("--prisma")&&(s.prisma=!0),i={...i,backendOnly:s.backendOnly,swaggerDocs:s.swaggerDocs,tailwindcss:s.tailwindcss,typescript:s.typescript,websocket:s.websocket,mcp:s.mcp,prisma:s.prisma};let t=[];s.excludeFiles?.map(e=>{const s=path.join(u,e);fs.existsSync(s)&&t.push(s.replace(/\\/g,"/"))}),updateAnswer={...i,isUpdate:!0,componentScanDirs:s.componentScanDirs??[],excludeFiles:s.excludeFiles??[],excludeFilePath:t??[],filePath:u}}}else{const e=path.join(d,"prisma-php.json"),s=path.join(d,t),n=path.join(s,"prisma-php.json");fs.existsSync(e)?u=d:fs.existsSync(s)&&fs.existsSync(n)?(u=s,process.chdir(s)):(fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0}),u=s,process.chdir(s))}else fs.mkdirSync(i.projectName,{recursive:!0}),u=path.join(d,i.projectName),process.chdir(i.projectName);let m=[npmPkg("typescript"),npmPkg("@types/node"),npmPkg("tsx"),npmPkg("http-proxy-middleware"),npmPkg("chalk"),npmPkg("npm-run-all"),npmPkg("browser-sync"),npmPkg("@types/browser-sync"),npmPkg("php-parser"),npmPkg("prisma-php")],g=[composerPkg("vlucas/phpdotenv"),composerPkg("firebase/php-jwt"),composerPkg("phpmailer/phpmailer"),composerPkg("guzzlehttp/guzzle"),composerPkg("symfony/uid"),composerPkg("brick/math"),composerPkg("tsnc/prisma-php")];if(i.swaggerDocs&&m.push(npmPkg("swagger-jsdoc"),npmPkg("@types/swagger-jsdoc")),i.swaggerDocs&&i.prisma&&m.push(npmPkg("prompts"),npmPkg("@types/prompts")),i.tailwindcss&&(m.push(npmPkg("tailwindcss"),npmPkg("postcss"),npmPkg("postcss-cli"),npmPkg("@tailwindcss/postcss"),npmPkg("cssnano")),g.push("gehrisandro/tailwind-merge-php")),i.websocket&&g.push("cboden/ratchet"),i.mcp&&g.push("php-mcp/server"),i.prisma&&execSync("npm install -g prisma-client-php@latest",{stdio:"inherit"}),i.typescript&&!i.backendOnly&&m.push(npmPkg("vite"),npmPkg("fast-glob")),i.starterKit&&!a&&await setupStarterKit(u,i),await installNpmDependencies(u,m,!0),await installComposerDependencies(u,g),t||execSync("npx tsc --init",{stdio:"inherit"}),await createDirectoryStructure(u,i),i.prisma&&execSync("npx ppo init --prisma-php",{stdio:"inherit"}),i.swaggerDocs){const e=path.join(u,"src","app","swagger-docs"),s=path.join(e,"apis"),t=path.join(u,"public","assets"),n=path.join(t,"dist");fs.existsSync(e)&&fs.readdirSync(e).length>0&&(console.log("Removing existing swagger-docs directory..."),fs.rmSync(e,{recursive:!0,force:!0})),console.log(chalk.blue("Cloning swagger-docs repository...")),execSync(`git clone https://github.com/TheSteelNinjaCode/prisma-php-swagger-docs.git ${e}`,{stdio:"inherit"});const c=path.join(e,".git");fs.existsSync(c)&&fs.rmSync(c,{recursive:!0,force:!0}),fs.existsSync(t)||(console.log(chalk.blue("Creating public/assets directory...")),fs.mkdirSync(t,{recursive:!0}));const o=path.join(e,"dist");fs.existsSync(o)?(console.log(chalk.blue("Moving dist folder to public/assets/dist...")),fs.existsSync(n)&&fs.rmSync(n,{recursive:!0,force:!0}),fs.renameSync(o,n),console.log(chalk.green("✓ Moved dist to public/assets/dist"))):console.warn(chalk.yellow("Warning: dist folder not found in cloned repository")),fs.existsSync(s)?console.log(chalk.green("✓ APIs folder preserved in src/app/swagger-docs/apis")):console.warn(chalk.yellow("Warning: apis folder not found in cloned repository")),console.log(chalk.green("✓ Swagger docs setup complete"))}if(updateAnswer?.isUpdate){const e=[],s=[],t=e=>{try{const s=path.join(u,"composer.json");if(fs.existsSync(s)){const t=JSON.parse(fs.readFileSync(s,"utf8"));return!(!t.require||!t.require[e])}return!1}catch{return!1}},n=e=>{try{const s=path.join(u,"package.json");if(fs.existsSync(s)){const t=JSON.parse(fs.readFileSync(s,"utf8"));return!!(t.dependencies&&t.dependencies[e]||t.devDependencies&&t.devDependencies[e])}return!1}catch{return!1}};if(updateAnswer.backendOnly){nonBackendFiles.forEach(e=>{const s=path.join(u,"src","app",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});["js","css"].forEach(e=>{const s=path.join(u,"src","app",e);fs.existsSync(s)&&(fs.rmSync(s,{recursive:!0,force:!0}),console.log(`${e} was deleted successfully.`))})}if(!updateAnswer.swaggerDocs){const s=path.join(u,"src","app","swagger-docs");fs.existsSync(s)&&(fs.rmSync(s,{recursive:!0,force:!0}),console.log("swagger-docs was deleted successfully."));["swagger-config.ts"].forEach(e=>{const s=path.join(u,"settings",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))}),n("swagger-jsdoc")&&e.push("swagger-jsdoc"),n("@types/swagger-jsdoc")&&e.push("@types/swagger-jsdoc"),n("prompts")&&e.push("prompts"),n("@types/prompts")&&e.push("@types/prompts")}if(!updateAnswer.tailwindcss){["postcss.config.js"].forEach(e=>{const s=path.join(u,e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});["tailwindcss","postcss","postcss-cli","@tailwindcss/postcss","cssnano"].forEach(s=>{n(s)&&e.push(s)});const c="gehrisandro/tailwind-merge-php";t(c)&&s.push(c)}if(!updateAnswer.websocket){["restart-websocket.ts"].forEach(e=>{const s=path.join(u,"settings",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});const e=path.join(u,"src","Lib","Websocket");fs.existsSync(e)&&(fs.rmSync(e,{recursive:!0,force:!0}),console.log("Websocket folder was deleted successfully.")),t("cboden/ratchet")&&s.push("cboden/ratchet")}if(!updateAnswer.mcp){["restart-mcp.ts"].forEach(e=>{const s=path.join(u,"settings",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});const e=path.join(u,"src","Lib","MCP");fs.existsSync(e)&&(fs.rmSync(e,{recursive:!0,force:!0}),console.log("MCP folder was deleted successfully.")),t("php-mcp/server")&&s.push("php-mcp/server")}if(!updateAnswer.prisma){["prisma","@prisma/client","@prisma/internals","better-sqlite3","@prisma/adapter-better-sqlite3","mariadb","@prisma/adapter-mariadb","pg","@prisma/adapter-pg","@types/pg"].forEach(s=>{n(s)&&e.push(s)})}if(!updateAnswer.typescript||updateAnswer.backendOnly){["vite.config.ts"].forEach(e=>{const s=path.join(u,e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});const s=path.join(u,"ts");fs.existsSync(s)&&(fs.rmSync(s,{recursive:!0,force:!0}),console.log("ts folder was deleted successfully."));const t=path.join(u,"settings","vite-plugins");fs.existsSync(t)&&(fs.rmSync(t,{recursive:!0,force:!0}),console.log("settings/vite-plugins folder was deleted successfully."));["vite","fast-glob"].forEach(s=>{n(s)&&e.push(s)})}const c=e=>Array.from(new Set(e)),o=c(e),r=c(s);o.length>0&&(console.log(`Uninstalling npm packages: ${o.join(", ")}`),await uninstallNpmDependencies(u,o,!0)),r.length>0&&(console.log(`Uninstalling composer packages: ${r.join(", ")}`),await uninstallComposerDependencies(u,r))}if(!a||!fs.existsSync(path.join(u,"prisma-php.json"))){const e=u.replace(/\\/g,"\\"),s=bsConfigUrls(e),t={projectName:i.projectName,projectRootPath:e,phpEnvironment:"XAMPP",phpRootPathExe:"C:\\xampp\\php\\php.exe",bsTarget:s.bsTarget,bsPathRewrite:s.bsPathRewrite,backendOnly:i.backendOnly,swaggerDocs:i.swaggerDocs,tailwindcss:i.tailwindcss,websocket:i.websocket,mcp:i.mcp,prisma:i.prisma,typescript:i.typescript,version:p,componentScanDirs:updateAnswer?.componentScanDirs??["src","vendor/tsnc/prisma-php/src"],excludeFiles:updateAnswer?.excludeFiles??[]};fs.writeFileSync(path.join(u,"prisma-php.json"),JSON.stringify(t,null,2),{flag:"w"})}execSync(updateAnswer?.isUpdate?"C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar update":"C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar install",{stdio:"inherit"}),console.log("\n=========================\n"),console.log(`${chalk.green("Success!")} Prisma PHP project successfully created in ${chalk.green(u.replace(/\\/g,"/"))}!`),console.log("\n=========================")}catch(e){console.error("Error while creating the project:",e),process.exit(1)}}main();
2
+ import{execSync,spawnSync}from"child_process";import fs from"fs";import{fileURLToPath}from"url";import path from"path";import chalk from"chalk";import prompts from"prompts";import https from"https";import{randomBytes}from"crypto";const __filename=fileURLToPath(import.meta.url),__dirname=path.dirname(__filename);let updateAnswer=null;const nonBackendFiles=["favicon.ico","\\src\\app\\index.php","metadata.php","not-found.php","error.php"],STARTER_KITS={basic:{id:"basic",name:"Basic PHP Application",description:"Simple PHP backend with minimal dependencies",features:{backendOnly:!0,tailwindcss:!1,websocket:!1,prisma:!1,swaggerDocs:!1,mcp:!1},requiredFiles:["bootstrap.php",".htaccess","src/app/layout.php","src/app/index.php"]},fullstack:{id:"fullstack",name:"Full-Stack Application",description:"Complete web application with frontend and backend",features:{backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1},requiredFiles:["bootstrap.php",".htaccess","postcss.config.js","src/app/layout.php","src/app/index.php","public/js/main.js","src/app/globals.css"]},api:{id:"api",name:"REST API",description:"Backend API with database and documentation",features:{backendOnly:!0,tailwindcss:!1,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1},requiredFiles:["bootstrap.php",".htaccess"]},realtime:{id:"realtime",name:"Real-time Application",description:"Application with WebSocket support and MCP",features:{backendOnly:!1,tailwindcss:!0,websocket:!0,prisma:!0,swaggerDocs:!0,mcp:!0},requiredFiles:["bootstrap.php",".htaccess","postcss.config.js","src/lib/websocket","src/lib/mcp"]},ecommerce:{id:"ecommerce",name:"E-commerce Starter",description:"Full e-commerce application with cart, payments, and admin",features:{backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1},requiredFiles:[],source:{type:"git",url:"https://github.com/your-org/prisma-php-ecommerce-starter",branch:"main"}},blog:{id:"blog",name:"Blog CMS",description:"Blog content management system",features:{backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!1,mcp:!1},requiredFiles:[],source:{type:"git",url:"https://github.com/your-org/prisma-php-blog-starter"}}};function bsConfigUrls(e){const s=e.indexOf("\\htdocs\\");if(-1===s)return console.error("Invalid PROJECT_ROOT_PATH. The path does not contain \\htdocs\\"),{bsTarget:"",bsPathRewrite:{}};const t=e.substring(0,s+8).replace(/\\/g,"\\\\"),n=e.replace(new RegExp(`^${t}`),"").replace(/\\/g,"/");let c=`http://localhost/${n}`;c=c.endsWith("/")?c.slice(0,-1):c;const o=c.replace(/(?<!:)(\/\/+)/g,"/"),r=n.replace(/\/\/+/g,"/");return{bsTarget:`${o}/`,bsPathRewrite:{"^/":`/${r.startsWith("/")?r.substring(1):r}/`}}}async function updatePackageJson(e,s){const t=path.join(e,"package.json");if(checkExcludeFiles(t))return;const n=JSON.parse(fs.readFileSync(t,"utf8"));n.scripts={...n.scripts,projectName:"tsx settings/project-name.ts"};let c=[];if(s.tailwindcss&&(n.scripts={...n.scripts,tailwind:"postcss src/app/globals.css -o public/css/styles.css --watch","tailwind:build":"postcss src/app/globals.css -o public/css/styles.css"},c.push("tailwind")),s.typescript&&!s.backendOnly&&(n.scripts={...n.scripts,"ts:watch":"vite build --watch","ts:build":"vite build"},c.push("ts:watch")),s.websocket&&(n.scripts={...n.scripts,websocket:"tsx settings/restart-websocket.ts"},c.push("websocket")),s.mcp&&(n.scripts={...n.scripts,mcp:"tsx settings/restart-mcp.ts"},c.push("mcp")),s.swaggerDocs){const e=s.prisma?"tsx settings/auto-swagger-docs.ts":"tsx settings/swagger-config.ts";n.scripts={...n.scripts,"create-swagger-docs":e}}let o={...n.scripts};o.browserSync="tsx settings/bs-config.ts",o["browserSync:build"]="tsx settings/build.ts",o.dev=`npm-run-all projectName -p browserSync ${c.join(" ")}`;let r=["browserSync:build"];s.tailwindcss&&r.unshift("tailwind:build"),s.typescript&&!s.backendOnly&&r.unshift("ts:build"),o.build=`npm-run-all ${r.join(" ")}`,n.scripts=o,n.type="module",fs.writeFileSync(t,JSON.stringify(n,null,2))}async function updateComposerJson(e){checkExcludeFiles(path.join(e,"composer.json"))}async function updateIndexJsForWebSocket(e,s){if(!s.websocket)return;const t=path.join(e,"public","js","main.js");if(checkExcludeFiles(t))return;let n=fs.readFileSync(t,"utf8");n+='\nwindow.ws = new WebSocket("ws://localhost:8080");\n',fs.writeFileSync(t,n,"utf8")}function generateAuthSecret(){return randomBytes(33).toString("base64")}function generateHexEncodedKey(e=16){return randomBytes(e).toString("hex")}function copyRecursiveSync(e,s,t){const n=fs.existsSync(e),c=n&&fs.statSync(e);if(n&&c&&c.isDirectory()){const n=s.toLowerCase();if(!t.websocket&&n.includes("src\\lib\\websocket"))return;if(!t.mcp&&n.includes("src\\lib\\mcp"))return;if((!t.typescript||t.backendOnly)&&(n.endsWith("\\ts")||n.includes("\\ts\\")))return;if((!t.typescript||t.backendOnly)&&(n.endsWith("\\vite-plugins")||n.includes("\\vite-plugins\\")||n.includes("\\vite-plugins")))return;if(t.backendOnly&&n.includes("public\\js")||t.backendOnly&&n.includes("public\\css")||t.backendOnly&&n.includes("public\\assets"))return;if(!t.swaggerDocs&&n.includes("src\\app\\swagger-docs"))return;const c=s.replace(/\\/g,"/");if(updateAnswer?.excludeFilePath?.includes(c))return;fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0}),fs.readdirSync(e).forEach(n=>{copyRecursiveSync(path.join(e,n),path.join(s,n),t)})}else{if(checkExcludeFiles(s))return;if(!t.tailwindcss&&(s.includes("globals.css")||s.includes("styles.css")))return;if(!t.websocket&&s.includes("restart-websocket.ts"))return;if(!t.mcp&&s.includes("restart-mcp.ts"))return;if(t.backendOnly&&nonBackendFiles.some(e=>s.includes(e)))return;if(!t.backendOnly&&s.includes("route.php"))return;if(t.backendOnly&&!t.swaggerDocs&&s.includes("layout.php"))return;if(!t.swaggerDocs&&s.includes("swagger-config.ts"))return;if(t.tailwindcss&&s.includes("index.css"))return;if((!t.swaggerDocs||!t.prisma)&&(s.includes("auto-swagger-docs.ts")||s.includes("prisma-schema-config.json")))return;fs.copyFileSync(e,s,0)}}async function executeCopy(e,s,t){s.forEach(({src:s,dest:n})=>{copyRecursiveSync(path.join(__dirname,s),path.join(e,n),t)})}function modifyPostcssConfig(e){const s=path.join(e,"postcss.config.js");if(checkExcludeFiles(s))return;fs.writeFileSync(s,'export default {\n plugins: {\n "@tailwindcss/postcss": {},\n cssnano: {},\n },\n};',{flag:"w"})}function modifyLayoutPHP(e,s){const t=path.join(e,"src","app","layout.php");if(!checkExcludeFiles(t))try{let e=fs.readFileSync(t,"utf8"),n="";s.backendOnly||(s.tailwindcss||(n='\n <link href="/css/index.css" rel="stylesheet" />'),n+='\n <script type="module" src="/js/main.js"><\/script>');let c="";s.backendOnly||(c=s.tailwindcss?` <link href="/css/styles.css" rel="stylesheet" /> ${n}`:n),e=e.replace("</head>",`${c}\n</head>`),fs.writeFileSync(t,e,{flag:"w"})}catch(e){console.error(chalk.red("Error modifying layout.php:"),e)}}async function createOrUpdateEnvFile(e,s){const t=path.join(e,".env");fs.existsSync(t)&&checkExcludeFiles(t)||fs.writeFileSync(t,s,{flag:"w"})}function checkExcludeFiles(e){if(!updateAnswer?.isUpdate)return!1;const s=e.replace(/\\/g,"/");return!!updateAnswer?.excludeFilePath?.includes(s)||!!updateAnswer?.excludeFiles&&updateAnswer.excludeFiles.some(e=>{const t=e.replace(/\\/g,"/");return s.endsWith("/"+t)||s===t})}async function createDirectoryStructure(e,s){const t=[{src:"/bootstrap.php",dest:"/bootstrap.php"},{src:"/.htaccess",dest:"/.htaccess"},{src:"/tsconfig.json",dest:"/tsconfig.json"},{src:"/app-gitignore",dest:"/.gitignore"},{src:"/CLAUDE.md",dest:"/CLAUDE.md"},{src:"/AGENTS.md",dest:"/AGENTS.md"}];s.tailwindcss&&t.push({src:"/postcss.config.js",dest:"/postcss.config.js"}),s.typescript&&!s.backendOnly&&t.push({src:"/vite.config.ts",dest:"/vite.config.ts"});const n=[{src:"/settings",dest:"/settings"},{src:"/src",dest:"/src"},{src:"/public",dest:"/public"}];s.typescript&&!s.backendOnly&&n.push({src:"/ts",dest:"/ts"}),t.forEach(({src:s,dest:t})=>{const n=path.join(__dirname,s),c=path.join(e,t);if(checkExcludeFiles(c))return;const o=fs.readFileSync(n,"utf8");fs.writeFileSync(c,o,{flag:"w"})}),await executeCopy(e,n,s),await updatePackageJson(e,s),await updateComposerJson(e),s.backendOnly||await updateIndexJsForWebSocket(e,s),s.tailwindcss&&modifyPostcssConfig(e),(s.tailwindcss||!s.backendOnly||s.swaggerDocs)&&modifyLayoutPHP(e,s);const c=generateAuthSecret(),o=generateHexEncodedKey(),r=`# Authentication secret key for JWT or session encryption.\nAUTH_SECRET="${c}"\n# Name of the authentication cookie.\nAUTH_COOKIE_NAME="${generateHexEncodedKey(8)}"\n\n# Show errors in the browser (development only). Set to false in production.\nSHOW_ERRORS="true"\n\n# Application timezone (default: UTC)\nAPP_TIMEZONE="UTC"\n\n# Application environment (development or production)\nAPP_ENV="development"\n\n# Enable or disable application cache (default: false)\nCACHE_ENABLED="false"\n# Cache time-to-live in seconds (default: 600)\nCACHE_TTL="600"\n\n# Local storage key for browser storage (auto-generated if not set).\n# Spaces will be replaced with underscores and converted to lowercase.\nLOCALSTORE_KEY="${o}"\n\n# Secret key for encrypting function calls.\nFUNCTION_CALL_SECRET="${generateHexEncodedKey(32)}"\n\n# Single or multiple origins (CSV or JSON array)\nCORS_ALLOWED_ORIGINS=[]\n\n# If you need cookies/Authorization across origins, keep this true\nCORS_ALLOW_CREDENTIALS="true"\n\n# Optional tuning\nCORS_ALLOWED_METHODS="GET,POST,PUT,PATCH,DELETE,OPTIONS"\nCORS_ALLOWED_HEADERS="Content-Type,Authorization,X-Requested-With"\nCORS_EXPOSE_HEADERS=""\nCORS_MAX_AGE="86400"\n\n# Rate Limiting\nRATE_LIMIT_DEFAULT="200 per minute"\nRATE_LIMIT_RPC="60 per minute"\nRATE_LIMIT_AUTH="60 per minute"`;if(s.prisma){const s=`${'# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\nDATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"'}\n\n${r}`;await createOrUpdateEnvFile(e,s)}else await createOrUpdateEnvFile(e,r)}async function getAnswer(e={},s=!1){if(s)return{projectName:e.projectName??"my-app",backendOnly:e.backendOnly??!1,swaggerDocs:e.swaggerDocs??!1,tailwindcss:e.tailwindcss??!1,typescript:e.typescript??!1,websocket:e.websocket??!1,mcp:e.mcp??!1,prisma:e.prisma??!1};if(e.starterKit){const s=e.starterKit;let t=null;if(STARTER_KITS[s]&&(t=STARTER_KITS[s]),t){const n={projectName:e.projectName??"my-app",starterKit:s,starterKitSource:e.starterKitSource,backendOnly:t.features.backendOnly??!1,tailwindcss:t.features.tailwindcss??!1,websocket:t.features.websocket??!1,prisma:t.features.prisma??!1,swaggerDocs:t.features.swaggerDocs??!1,mcp:t.features.mcp??!1,typescript:t.features.typescript??!1},c=process.argv.slice(2);return c.includes("--backend-only")&&(n.backendOnly=!0),c.includes("--swagger-docs")&&(n.swaggerDocs=!0),c.includes("--tailwindcss")&&(n.tailwindcss=!0),c.includes("--websocket")&&(n.websocket=!0),c.includes("--mcp")&&(n.mcp=!0),c.includes("--prisma")&&(n.prisma=!0),c.includes("--typescript")&&(n.typescript=!0),n}if(e.starterKitSource){const t={projectName:e.projectName??"my-app",starterKit:s,starterKitSource:e.starterKitSource,backendOnly:!1,tailwindcss:!0,websocket:!1,prisma:!0,swaggerDocs:!0,mcp:!1,typescript:!1},n=process.argv.slice(2);return n.includes("--backend-only")&&(t.backendOnly=!0),n.includes("--swagger-docs")&&(t.swaggerDocs=!0),n.includes("--tailwindcss")&&(t.tailwindcss=!0),n.includes("--websocket")&&(t.websocket=!0),n.includes("--mcp")&&(t.mcp=!0),n.includes("--prisma")&&(t.prisma=!0),n.includes("--typescript")&&(t.typescript=!0),t}}const t=[];e.projectName||t.push({type:"text",name:"projectName",message:"What is your project named?",initial:"my-app"}),e.backendOnly||updateAnswer?.isUpdate||t.push({type:"toggle",name:"backendOnly",message:`Would you like to create a ${chalk.blue("backend-only project")}?`,initial:!1,active:"Yes",inactive:"No"});const n=()=>{console.warn(chalk.red("Operation cancelled by the user.")),process.exit(0)},c=await prompts(t,{onCancel:n}),o=[];c.backendOnly??e.backendOnly??!1?(e.swaggerDocs||o.push({type:"toggle",name:"swaggerDocs",message:`Would you like to use ${chalk.blue("Swagger Docs")}?`,initial:!1,active:"Yes",inactive:"No"}),e.websocket||o.push({type:"toggle",name:"websocket",message:`Would you like to use ${chalk.blue("Websocket")}?`,initial:!1,active:"Yes",inactive:"No"}),e.mcp||o.push({type:"toggle",name:"mcp",message:`Would you like to use ${chalk.blue("MCP (Model Context Protocol)")}?`,initial:!1,active:"Yes",inactive:"No"}),e.prisma||o.push({type:"toggle",name:"prisma",message:`Would you like to use ${chalk.blue("Prisma ORM")}?`,initial:!1,active:"Yes",inactive:"No"})):(e.swaggerDocs||o.push({type:"toggle",name:"swaggerDocs",message:`Would you like to use ${chalk.blue("Swagger Docs")}?`,initial:!1,active:"Yes",inactive:"No"}),e.tailwindcss||o.push({type:"toggle",name:"tailwindcss",message:`Would you like to use ${chalk.blue("Tailwind CSS")}?`,initial:!1,active:"Yes",inactive:"No"}),e.typescript||o.push({type:"toggle",name:"typescript",message:`Would you like to use ${chalk.blue("TypeScript")}?`,initial:!1,active:"Yes",inactive:"No"}),e.websocket||o.push({type:"toggle",name:"websocket",message:`Would you like to use ${chalk.blue("Websocket")}?`,initial:!1,active:"Yes",inactive:"No"}),e.mcp||o.push({type:"toggle",name:"mcp",message:`Would you like to use ${chalk.blue("MCP (Model Context Protocol)")}?`,initial:!1,active:"Yes",inactive:"No"}),e.prisma||o.push({type:"toggle",name:"prisma",message:`Would you like to use ${chalk.blue("Prisma ORM")}?`,initial:!1,active:"Yes",inactive:"No"}));const r=await prompts(o,{onCancel:n});return{projectName:c.projectName?String(c.projectName).trim().replace(/ /g,"-"):e.projectName??"my-app",backendOnly:c.backendOnly??e.backendOnly??!1,swaggerDocs:r.swaggerDocs??e.swaggerDocs??!1,tailwindcss:r.tailwindcss??e.tailwindcss??!1,typescript:r.typescript??e.typescript??!1,websocket:r.websocket??e.websocket??!1,mcp:r.mcp??e.mcp??!1,prisma:r.prisma??e.prisma??!1}}async function uninstallNpmDependencies(e,s,t=!1){console.log("Uninstalling Node dependencies:"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));const n=`npm uninstall ${t?"--save-dev":"--save"} ${s.join(" ")}`;execSync(n,{stdio:"inherit",cwd:e})}async function uninstallComposerDependencies(e,s){console.log("Uninstalling Composer dependencies:"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));const t=`C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar remove ${s.join(" ")}`;execSync(t,{stdio:"inherit",cwd:e})}function fetchPackageVersion(e){return new Promise((s,t)=>{https.get(`https://registry.npmjs.org/${e}`,e=>{let n="";e.on("data",e=>n+=e),e.on("end",()=>{try{const e=JSON.parse(n);s(e["dist-tags"].latest)}catch(e){t(new Error("Failed to parse JSON response"))}})}).on("error",e=>t(e))})}const readJsonFile=e=>{const s=fs.readFileSync(e,"utf8");return JSON.parse(s)};function compareVersions(e,s){const t=e.split(".").map(Number),n=s.split(".").map(Number);for(let e=0;e<t.length;e++){if(t[e]>n[e])return 1;if(t[e]<n[e])return-1}return 0}function getInstalledPackageVersion(e){try{const s=execSync(`npm list -g ${e} --depth=0`).toString().match(new RegExp(`${e}@(\\d+\\.\\d+\\.\\d+)`));return s?s[1]:(console.error(`Package ${e} is not installed`),null)}catch(e){return console.error(e instanceof Error?e.message:String(e)),null}}async function installNpmDependencies(e,s,t=!1){fs.existsSync(path.join(e,"package.json"))?console.log("Updating existing Node.js project..."):console.log("Initializing new Node.js project..."),fs.existsSync(path.join(e,"package.json"))||execSync("npm init -y",{stdio:"inherit",cwd:e}),console.log((t?"Installing development dependencies":"Installing dependencies")+":"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));const n=`npm install ${t?"--save-dev":""} ${s.join(" ")}`;execSync(n,{stdio:"inherit",cwd:e})}function getComposerCmd(){try{return execSync("composer --version",{stdio:"ignore"}),console.log("✓ Using global composer command"),{cmd:"composer",baseArgs:[]}}catch{const e="C:\\xampp\\php\\php.exe",s="C:\\ProgramData\\ComposerSetup\\bin\\composer.phar";if(!fs.existsSync(e))throw console.error(`✗ PHP not found at ${e}`),new Error(`PHP executable not found at ${e}`);if(!fs.existsSync(s))throw console.error(`✗ Composer not found at ${s}`),new Error(`Composer phar not found at ${s}`);return console.log("✓ Using XAMPP PHP with Composer phar"),{cmd:e,baseArgs:[s]}}}export async function installComposerDependencies(e,s){const{cmd:t,baseArgs:n}=getComposerCmd(),c=path.join(e,"composer.json"),o=fs.existsSync(c);if(console.log(chalk.green("Composer project initialization: "+(o?"Updating existing project…":"Setting up new project…"))),fs.existsSync(e)||(console.log(`Creating base directory: ${e}`),fs.mkdirSync(e,{recursive:!0})),!o){const s=[...n,"init","--no-interaction","--name","tsnc/prisma-php-app","--require","php:^8.2","--type","project","--version","1.0.0"];console.log("Attempting composer init...");const o=spawnSync(t,s,{cwd:e,stdio:["ignore","pipe","pipe"],encoding:"utf8"}),r=fs.existsSync(c);if(0===o.status&&r)console.log("✓ Composer init successful and composer.json created");else{0!==o.status?(console.log(`Composer init failed with status ${o.status}`),o.stderr&&console.log(`Stderr: ${o.stderr}`)):console.log("Composer init reported success but didn't create composer.json"),console.log("Creating composer.json manually...");const s={name:"tsnc/prisma-php-app",type:"project",version:"1.0.0",require:{php:"^8.2"},autoload:{"psr-4":{"":"src/"}}};try{const t=path.resolve(e,"composer.json");if(console.log(`Writing composer.json to: ${t}`),fs.writeFileSync(t,JSON.stringify(s,null,2),{encoding:"utf8"}),!fs.existsSync(t))throw new Error("File creation appeared to succeed but file doesn't exist");console.log("✓ Successfully created composer.json")}catch(s){if(console.error("✗ Failed to create composer.json:",s),console.error(`Base directory: ${e}`),console.error(`Absolute base directory: ${path.resolve(e)}`),console.error(`Target file path: ${c}`),console.error(`Absolute target file path: ${path.resolve(c)}`),console.error(`Current working directory: ${process.cwd()}`),console.error(`Base directory exists: ${fs.existsSync(e)}`),fs.existsSync(e))try{const s=fs.statSync(e);console.error(`Base directory is writable: ${s.isDirectory()}`)}catch(e){console.error(`Cannot stat base directory: ${e}`)}throw new Error(`Cannot create composer.json: ${s}`)}}}const r=path.resolve(e,"composer.json");if(!fs.existsSync(r))throw console.error(`✗ composer.json still not found at ${r}`),console.error("Directory contents:",fs.readdirSync(e)),new Error("Failed to create composer.json - file does not exist after all attempts");let i;try{const e=fs.readFileSync(r,"utf8");console.log("✓ Successfully read composer.json"),i=JSON.parse(e)}catch(e){throw console.error("✗ Failed to read/parse composer.json:",e),new Error(`Cannot read composer.json: ${e}`)}i.autoload??={},i.autoload["psr-4"]??={},i.autoload["psr-4"][""]??="src/";try{fs.writeFileSync(r,JSON.stringify(i,null,2)),console.log("✓ Updated composer.json with PSR-4 autoload")}catch(e){throw console.error("✗ Failed to update composer.json:",e),e}if(s.length){console.log("Installing Composer dependencies:"),s.forEach(e=>console.log(`- ${chalk.blue(e)}`));try{const c=`${t} ${[...n,"require","--no-interaction","-W",...s].join(" ")}`;execSync(c,{stdio:"inherit",cwd:e,env:{...process.env}}),console.log("✓ Composer dependencies installed")}catch(e){throw console.error("✗ Failed to install composer dependencies:",e),e}}if(o)try{execSync(`${t} ${[...n,"update","--lock","--no-install","--no-interaction"].join(" ")}`,{stdio:"inherit",cwd:e}),console.log("✓ Composer lock updated")}catch(e){throw console.error("✗ Failed to update composer lock:",e),e}try{execSync(`${t} ${[...n,"dump-autoload","--quiet"].join(" ")}`,{stdio:"inherit",cwd:e}),console.log("✓ Composer autoloader regenerated")}catch(e){throw console.error("✗ Failed to regenerate autoloader:",e),e}}const npmPinnedVersions={"@tailwindcss/postcss":"4.2.2","@types/browser-sync":"2.29.1","@types/node":"25.5.2","@types/prompts":"2.4.9","browser-sync":"3.0.4",chalk:"5.6.2","chokidar-cli":"3.0.0",cssnano:"7.1.4","http-proxy-middleware":"3.0.5","npm-run-all":"4.1.5","php-parser":"3.5.1",postcss:"8.5.9","postcss-cli":"11.0.1",prompts:"2.4.2",tailwindcss:"4.2.2",tsx:"4.21.0",typescript:"6.0.2",vite:"7.3.0","fast-glob":"3.3.3","prisma-php":"0.0.2"};function npmPkg(e){return npmPinnedVersions[e]?`${e}@${npmPinnedVersions[e]}`:e}const composerPinnedVersions={"vlucas/phpdotenv":"5.6.3","firebase/php-jwt":"7.0.5","phpmailer/phpmailer":"7.0.1","guzzlehttp/guzzle":"7.10.0","symfony/uid":"7.4.8","brick/math":"0.17.0","cboden/ratchet":"0.4.4","tsnc/prisma-php":"2.0.0","php-mcp/server":"3.3.0","gehrisandro/tailwind-merge-php":"1.2.0"};function composerPkg(e){return composerPinnedVersions[e]?`${e}:${composerPinnedVersions[e]}`:e}function removeDirectorySafe(e){if(fs.existsSync(e))try{return void fs.rmSync(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:250})}catch(s){const t=s;if("win32"===globalThis.process?.platform&&("EPERM"===t.code||"EACCES"===t.code)){try{spawnSync("cmd",["/c","attrib","-R","-H","-S","/S","/D",`${e}\\*`],{stdio:"ignore"})}catch{}return void spawnSync("cmd",["/c","rd","/s","/q",e],{stdio:"ignore"})}throw s}}async function setupStarterKit(e,s){if(!s.starterKit)return;let t=null;if(STARTER_KITS[s.starterKit]?t=STARTER_KITS[s.starterKit]:s.starterKitSource&&(t={id:s.starterKit,name:`Custom Starter Kit (${s.starterKit})`,description:"Custom starter kit from external source",features:{},requiredFiles:[],source:{type:"git",url:s.starterKitSource}}),t){if(console.log(chalk.green(`Setting up ${t.name}...`)),t.source)try{const n=t.source.branch?`git clone -b ${t.source.branch} --depth 1 ${t.source.url} "${e}"`:`git clone --depth 1 ${t.source.url} "${e}"`;execSync(n,{stdio:"inherit"});removeDirectorySafe(path.join(e,".git")),console.log(chalk.blue("Starter kit cloned successfully!"));const c=path.join(e,"prisma-php.json");if(fs.existsSync(c))try{const t=JSON.parse(fs.readFileSync(c,"utf8")),n=e,o=bsConfigUrls(n);t.projectName=s.projectName,t.projectRootPath=n,t.bsTarget=o.bsTarget,t.bsPathRewrite=o.bsPathRewrite;const r=await fetchPackageVersion("create-prisma-php-app");t.version=t.version||r,fs.writeFileSync(c,JSON.stringify(t,null,2)),console.log(chalk.green("Updated prisma-php.json with new project details"))}catch(e){console.warn(chalk.yellow("Failed to update prisma-php.json, will create new one"))}}catch(e){throw console.error(chalk.red(`Failed to setup starter kit: ${e}`)),e}t.customSetup&&await t.customSetup(e,s),console.log(chalk.green(`✓ ${t.name} setup complete!`))}else console.warn(chalk.yellow(`Starter kit '${s.starterKit}' not found. Skipping...`))}function showStarterKits(){console.log(chalk.blue("\n🚀 Available Starter Kits:\n")),Object.values(STARTER_KITS).forEach(e=>{const s=e.source?" (Custom)":" (Built-in)";console.log(chalk.green(` ${e.id}${chalk.gray(s)}`)),console.log(` ${e.name}`),console.log(chalk.gray(` ${e.description}`)),e.source&&console.log(chalk.cyan(` Source: ${e.source.url}`));const t=Object.entries(e.features).filter(([,e])=>!0===e).map(([e])=>e).join(", ");t&&console.log(chalk.magenta(` Features: ${t}`)),console.log()}),console.log(chalk.yellow("Usage:")),console.log(" npx create-prisma-php-app my-project --starter-kit=basic"),console.log(" npx create-prisma-php-app my-project --starter-kit=custom --starter-kit-source=https://github.com/user/repo"),console.log()}async function main(){try{const e=process.argv.slice(2),s=e.includes("-y");let t=e[0];const n=e.find(e=>e.startsWith("--starter-kit=")),c=n?.split("=")[1],o=e.find(e=>e.startsWith("--starter-kit-source=")),r=o?.split("=")[1];if(e.includes("--list-starter-kits"))return void showStarterKits();let i=null,a=!1;if(t){const n=process.cwd(),o=path.join(n,"prisma-php.json");if(c&&r){a=!0;const n={projectName:t,starterKit:c,starterKitSource:r,backendOnly:e.includes("--backend-only"),swaggerDocs:e.includes("--swagger-docs"),tailwindcss:e.includes("--tailwindcss"),typescript:e.includes("--typescript"),websocket:e.includes("--websocket"),mcp:e.includes("--mcp"),prisma:e.includes("--prisma")};i=await getAnswer(n,s)}else if(fs.existsSync(o)){const c=readJsonFile(o);let r=[];c.excludeFiles?.map(e=>{const s=path.join(n,e);fs.existsSync(s)&&r.push(s.replace(/\\/g,"/"))}),updateAnswer={projectName:t,backendOnly:c.backendOnly,swaggerDocs:c.swaggerDocs,tailwindcss:c.tailwindcss,websocket:c.websocket,mcp:c.mcp,prisma:c.prisma,typescript:c.typescript,isUpdate:!0,componentScanDirs:c.componentScanDirs??[],excludeFiles:c.excludeFiles??[],excludeFilePath:r??[],filePath:n};const a={projectName:t,backendOnly:e.includes("--backend-only")||c.backendOnly,swaggerDocs:e.includes("--swagger-docs")||c.swaggerDocs,tailwindcss:e.includes("--tailwindcss")||c.tailwindcss,typescript:e.includes("--typescript")||c.typescript,websocket:e.includes("--websocket")||c.websocket,prisma:e.includes("--prisma")||c.prisma,mcp:e.includes("--mcp")||c.mcp};i=await getAnswer(a,s),null!==i&&(updateAnswer={projectName:t,backendOnly:i.backendOnly,swaggerDocs:i.swaggerDocs,tailwindcss:i.tailwindcss,websocket:i.websocket,mcp:i.mcp,prisma:i.prisma,typescript:i.typescript,isUpdate:!0,componentScanDirs:c.componentScanDirs??[],excludeFiles:c.excludeFiles??[],excludeFilePath:r??[],filePath:n})}else{const n={projectName:t,starterKit:c,starterKitSource:r,backendOnly:e.includes("--backend-only"),swaggerDocs:e.includes("--swagger-docs"),tailwindcss:e.includes("--tailwindcss"),typescript:e.includes("--typescript"),websocket:e.includes("--websocket"),mcp:e.includes("--mcp"),prisma:e.includes("--prisma")};i=await getAnswer(n,s)}if(null===i)return void console.log(chalk.red("Installation cancelled."))}else i=await getAnswer({},s);if(null===i)return void console.warn(chalk.red("Installation cancelled."));const p=await fetchPackageVersion("create-prisma-php-app"),l=getInstalledPackageVersion("create-prisma-php-app");l?-1===compareVersions(l,p)&&(execSync("npm uninstall -g create-prisma-php-app",{stdio:"inherit"}),execSync("npm install -g create-prisma-php-app",{stdio:"inherit"})):execSync("npm install -g create-prisma-php-app",{stdio:"inherit"});const d=process.cwd();let u;if(t)if(a){const s=path.join(d,t);fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0}),u=s,await setupStarterKit(u,i),process.chdir(u);const n=path.join(u,"prisma-php.json");if(fs.existsSync(n)){const s=JSON.parse(fs.readFileSync(n,"utf8"));e.includes("--backend-only")&&(s.backendOnly=!0),e.includes("--swagger-docs")&&(s.swaggerDocs=!0),e.includes("--tailwindcss")&&(s.tailwindcss=!0),e.includes("--typescript")&&(s.typescript=!0),e.includes("--websocket")&&(s.websocket=!0),e.includes("--mcp")&&(s.mcp=!0),e.includes("--prisma")&&(s.prisma=!0),i={...i,backendOnly:s.backendOnly,swaggerDocs:s.swaggerDocs,tailwindcss:s.tailwindcss,typescript:s.typescript,websocket:s.websocket,mcp:s.mcp,prisma:s.prisma};let t=[];s.excludeFiles?.map(e=>{const s=path.join(u,e);fs.existsSync(s)&&t.push(s.replace(/\\/g,"/"))}),updateAnswer={...i,isUpdate:!0,componentScanDirs:s.componentScanDirs??[],excludeFiles:s.excludeFiles??[],excludeFilePath:t??[],filePath:u}}}else{const e=path.join(d,"prisma-php.json"),s=path.join(d,t),n=path.join(s,"prisma-php.json");fs.existsSync(e)?u=d:fs.existsSync(s)&&fs.existsSync(n)?(u=s,process.chdir(s)):(fs.existsSync(s)||fs.mkdirSync(s,{recursive:!0}),u=s,process.chdir(s))}else fs.mkdirSync(i.projectName,{recursive:!0}),u=path.join(d,i.projectName),process.chdir(i.projectName);let m=[npmPkg("typescript"),npmPkg("@types/node"),npmPkg("tsx"),npmPkg("http-proxy-middleware"),npmPkg("chalk"),npmPkg("npm-run-all"),npmPkg("browser-sync"),npmPkg("@types/browser-sync"),npmPkg("php-parser"),npmPkg("prisma-php")],g=[composerPkg("vlucas/phpdotenv"),composerPkg("firebase/php-jwt"),composerPkg("phpmailer/phpmailer"),composerPkg("guzzlehttp/guzzle"),composerPkg("symfony/uid"),composerPkg("brick/math"),composerPkg("tsnc/prisma-php")];if(i.swaggerDocs&&m.push(npmPkg("swagger-jsdoc"),npmPkg("@types/swagger-jsdoc")),i.swaggerDocs&&i.prisma&&m.push(npmPkg("prompts"),npmPkg("@types/prompts")),i.tailwindcss&&(m.push(npmPkg("tailwindcss"),npmPkg("postcss"),npmPkg("postcss-cli"),npmPkg("@tailwindcss/postcss"),npmPkg("cssnano")),g.push("gehrisandro/tailwind-merge-php")),i.websocket&&g.push("cboden/ratchet"),i.mcp&&g.push("php-mcp/server"),i.prisma&&execSync("npm install -g prisma-client-php@latest",{stdio:"inherit"}),i.typescript&&!i.backendOnly&&m.push(npmPkg("vite"),npmPkg("fast-glob")),i.starterKit&&!a&&await setupStarterKit(u,i),await installNpmDependencies(u,m,!0),await installComposerDependencies(u,g),t||execSync("npx tsc --init",{stdio:"inherit"}),await createDirectoryStructure(u,i),i.prisma&&execSync("npx ppo init --prisma-php",{stdio:"inherit"}),i.swaggerDocs){const e=path.join(u,"src","app","swagger-docs"),s=path.join(e,"apis"),t=path.join(u,"public","assets"),n=path.join(t,"dist");fs.existsSync(e)&&fs.readdirSync(e).length>0&&(console.log("Removing existing swagger-docs directory..."),fs.rmSync(e,{recursive:!0,force:!0})),console.log(chalk.blue("Cloning swagger-docs repository...")),execSync(`git clone https://github.com/TheSteelNinjaCode/prisma-php-swagger-docs.git ${e}`,{stdio:"inherit"});const c=path.join(e,".git");fs.existsSync(c)&&fs.rmSync(c,{recursive:!0,force:!0}),fs.existsSync(t)||(console.log(chalk.blue("Creating public/assets directory...")),fs.mkdirSync(t,{recursive:!0}));const o=path.join(e,"dist");fs.existsSync(o)?(console.log(chalk.blue("Moving dist folder to public/assets/dist...")),fs.existsSync(n)&&fs.rmSync(n,{recursive:!0,force:!0}),fs.renameSync(o,n),console.log(chalk.green("✓ Moved dist to public/assets/dist"))):console.warn(chalk.yellow("Warning: dist folder not found in cloned repository")),fs.existsSync(s)?console.log(chalk.green("✓ APIs folder preserved in src/app/swagger-docs/apis")):console.warn(chalk.yellow("Warning: apis folder not found in cloned repository")),console.log(chalk.green("✓ Swagger docs setup complete"))}if(updateAnswer?.isUpdate){const e=[],s=[],t=e=>{try{const s=path.join(u,"composer.json");if(fs.existsSync(s)){const t=JSON.parse(fs.readFileSync(s,"utf8"));return!(!t.require||!t.require[e])}return!1}catch{return!1}},n=e=>{try{const s=path.join(u,"package.json");if(fs.existsSync(s)){const t=JSON.parse(fs.readFileSync(s,"utf8"));return!!(t.dependencies&&t.dependencies[e]||t.devDependencies&&t.devDependencies[e])}return!1}catch{return!1}};if(updateAnswer.backendOnly){nonBackendFiles.forEach(e=>{const s=path.join(u,"src","app",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});["js","css"].forEach(e=>{const s=path.join(u,"src","app",e);fs.existsSync(s)&&(fs.rmSync(s,{recursive:!0,force:!0}),console.log(`${e} was deleted successfully.`))})}if(!updateAnswer.swaggerDocs){const s=path.join(u,"src","app","swagger-docs");fs.existsSync(s)&&(fs.rmSync(s,{recursive:!0,force:!0}),console.log("swagger-docs was deleted successfully."));["swagger-config.ts"].forEach(e=>{const s=path.join(u,"settings",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))}),n("swagger-jsdoc")&&e.push("swagger-jsdoc"),n("@types/swagger-jsdoc")&&e.push("@types/swagger-jsdoc"),n("prompts")&&e.push("prompts"),n("@types/prompts")&&e.push("@types/prompts")}if(!updateAnswer.tailwindcss){["postcss.config.js"].forEach(e=>{const s=path.join(u,e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});["tailwindcss","postcss","postcss-cli","@tailwindcss/postcss","cssnano"].forEach(s=>{n(s)&&e.push(s)});const c="gehrisandro/tailwind-merge-php";t(c)&&s.push(c)}if(!updateAnswer.websocket){["restart-websocket.ts"].forEach(e=>{const s=path.join(u,"settings",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});const e=path.join(u,"src","Lib","Websocket");fs.existsSync(e)&&(fs.rmSync(e,{recursive:!0,force:!0}),console.log("Websocket folder was deleted successfully.")),t("cboden/ratchet")&&s.push("cboden/ratchet")}if(!updateAnswer.mcp){["restart-mcp.ts"].forEach(e=>{const s=path.join(u,"settings",e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});const e=path.join(u,"src","Lib","MCP");fs.existsSync(e)&&(fs.rmSync(e,{recursive:!0,force:!0}),console.log("MCP folder was deleted successfully.")),t("php-mcp/server")&&s.push("php-mcp/server")}if(!updateAnswer.prisma){["prisma","@prisma/client","@prisma/internals","better-sqlite3","@prisma/adapter-better-sqlite3","mariadb","@prisma/adapter-mariadb","pg","@prisma/adapter-pg","@types/pg"].forEach(s=>{n(s)&&e.push(s)})}if(!updateAnswer.typescript||updateAnswer.backendOnly){["vite.config.ts"].forEach(e=>{const s=path.join(u,e);fs.existsSync(s)&&(fs.unlinkSync(s),console.log(`${e} was deleted successfully.`))});const s=path.join(u,"ts");fs.existsSync(s)&&(fs.rmSync(s,{recursive:!0,force:!0}),console.log("ts folder was deleted successfully."));const t=path.join(u,"settings","vite-plugins");fs.existsSync(t)&&(fs.rmSync(t,{recursive:!0,force:!0}),console.log("settings/vite-plugins folder was deleted successfully."));["vite","fast-glob"].forEach(s=>{n(s)&&e.push(s)})}const c=e=>Array.from(new Set(e)),o=c(e),r=c(s);o.length>0&&(console.log(`Uninstalling npm packages: ${o.join(", ")}`),await uninstallNpmDependencies(u,o,!0)),r.length>0&&(console.log(`Uninstalling composer packages: ${r.join(", ")}`),await uninstallComposerDependencies(u,r))}if(!a||!fs.existsSync(path.join(u,"prisma-php.json"))){const e=u.replace(/\\/g,"\\"),s=bsConfigUrls(e),t={projectName:i.projectName,projectRootPath:e,phpEnvironment:"XAMPP",phpRootPathExe:"C:\\xampp\\php\\php.exe",bsTarget:s.bsTarget,bsPathRewrite:s.bsPathRewrite,backendOnly:i.backendOnly,swaggerDocs:i.swaggerDocs,tailwindcss:i.tailwindcss,websocket:i.websocket,mcp:i.mcp,prisma:i.prisma,typescript:i.typescript,version:p,componentScanDirs:updateAnswer?.componentScanDirs??["src","vendor/tsnc/prisma-php/src"],excludeFiles:updateAnswer?.excludeFiles??[]};fs.writeFileSync(path.join(u,"prisma-php.json"),JSON.stringify(t,null,2),{flag:"w"})}execSync(updateAnswer?.isUpdate?"C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar update":"C:\\xampp\\php\\php.exe C:\\ProgramData\\ComposerSetup\\bin\\composer.phar install",{stdio:"inherit"}),console.log("\n=========================\n"),console.log(`${chalk.green("Success!")} Prisma PHP project successfully created in ${chalk.green(u.replace(/\\/g,"/"))}!`),console.log("\n=========================")}catch(e){console.error("Error while creating the project:",e),process.exit(1)}}main();
@@ -1 +1 @@
1
- var $t=Object.defineProperty,zt=(t,e,s)=>e in t?$t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,x=(t,e,s)=>zt(t,"symbol"!=typeof e?e+"":e,s);class Gt{constructor(t){x(this,"hooks",[]),x(this,"currentIndex",0),x(this,"onStateChange"),x(this,"pendingEffects",[]),x(this,"pendingUpdate",!1),x(this,"hasScheduledRender",!1),x(this,"batchedUpdates",new Set),x(this,"portalRegistrations",[]),x(this,"disposed",!1),this.onStateChange=t}loadState(t){this.hooks=[...t]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.pendingEffects=[],this.portalRegistrations=[])}runEffects(){this.disposed||this.pendingEffects.forEach(t=>t()),this.pendingEffects=[]}dispose(){this.disposed||(this.disposed=!0,this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[],this.hooks.forEach(t=>{if(!t||"object"!=typeof t)return;const e=t.cleanup;if("function"==typeof e)try{e()}finally{t.cleanup=void 0}}),this.hooks=[],this.currentIndex=0)}usePortal(t,e){const s=this.currentIndex++;void 0===this.hooks[s]&&(this.hooks[s]={sourceParent:null});const i=this.hooks[s];return this.portalRegistrations.push({ref:t,target:e??null,info:i}),i}getPortalRegistrations(){return this.portalRegistrations}useState(t){const e=this.currentIndex++;if(void 0===this.hooks[e]){const s=this.hooks,i=e,n=this.batchedUpdates,r=()=>this.scheduleUpdate(),a=t=>{let e=t;"function"==typeof t&&(e=t(s[i].__state)),s[i].__state!==e&&(s[i].__state=e,n.add(i),r())};this.hooks[e]={__state:t,__setter:a}}const s=this.hooks[e];if("object"!=typeof s||null===s||!("__state"in s)){const t=s,i=this.hooks,n=e,r=this.batchedUpdates,a=()=>this.scheduleUpdate(),o=t=>{let e=t;"function"==typeof t&&(e=t(i[n].__state)),i[n].__state!==e&&(i[n].__state=e,r.add(n),a())};this.hooks[e]={__state:t,__setter:o}}return[this.hooks[e].__state,this.hooks[e].__setter]}scheduleUpdate(){this.disposed||(this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,queueMicrotask(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())})))}useRef(t=null){const e=this.currentIndex++;return void 0===this.hooks[e]&&(this.hooks[e]={current:t}),this.hooks[e]}useMemo(t,e){const s=this.currentIndex++,i=this.hooks[s];if(!i||this.areDepsDifferent(i.deps,e)){const i=t();return this.hooks[s]={value:i,deps:e},i}return i.value}useCallback(t,e){const s=this.currentIndex++,i=this.hooks[s];return!i||this.areDepsDifferent(i.deps,e)?(this.hooks[s]={callback:t,deps:e},t):i.callback}useReducer(t,e){const s=this.currentIndex++;if(void 0===this.hooks[s]){const i={state:e,reducer:t,dispatch:null};i.dispatch=t=>{const e=i.reducer(i.state,t);i.state!==e&&(i.state=e,this.scheduleUpdate())},this.hooks[s]=i}const i=this.hooks[s];return[i.state,i.dispatch]}useEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e))&&this.pendingEffects.push(()=>{null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}})}useLayoutEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];if(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e)){null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}}}areDepsDifferent(t,e){return t.length!==e.length||e.some((e,s)=>!Object.is(e,t[s]))}}class P{static saveState(t,e){t&&this.states.set(t,e)}static getState(t){return this.states.get(t)}static removeState(t){this.states.delete(t)}static saveScope(t,e){this.scopes.set(t,e)}static getScope(t){return this.scopes.get(t)}static removeScope(t){this.scopes.delete(t)}static registerInstance(t,e){var s;const i=this.instances.get(t);i&&i!==e&&(null==(s=i.destroy)||s.call(i)),this.instances.set(t,e)}static getInstance(t){return this.instances.get(t)}static removeInstance(t){this.instances.delete(t)}static saveTemplate(t,e){this.templates.has(t)||this.templates.set(t,e)}static getTemplate(t){return this.templates.get(t)}static saveOwnedTemplates(t,e){this.ownedTemplateData.has(t)||this.ownedTemplateData.set(t,e)}static getOwnedTemplates(t){return this.ownedTemplateData.get(t)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.templates.clear(),this.ownedTemplateData.clear()}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size}}}x(P,"states",new Map),x(P,"scopes",new Map),x(P,"instances",new Map),x(P,"templates",new Map),x(P,"ownedTemplateData",new Map);class Xt{constructor(t,e){x(this,"root"),x(this,"getScope"),x(this,"handlerCache",new Map),this.root=t,this.getScope=e}clearCache(){this.handlerCache.clear()}bindEvents(t){(t||this.fallbackCollectEventElements()).forEach(t=>{var e;if(t===this.root)return void this.bindElementEvents(t);let s=t.closest("[pp-component]");t===s&&(s=(null==(e=t.parentElement)?void 0:e.closest("[pp-component]"))??null),s===this.root&&this.bindElementEvents(t)})}bindElementEvents(t){const e=t.getAttribute("pp-event-owner");e&&t.removeAttribute("pp-event-owner");const s=[];Array.from(t.attributes).forEach(i=>{if(i.name.startsWith("on")&&!i.name.includes("-")){const n=i.name.slice(2).toLowerCase();let r=i.value.trim();const a=r.match(/^\{([\s\S]*)\}$/);a&&(r=a[1].trim()),s.push(i.name);const o=`__pp_bound_${n}`;if(t[o]===r)return;t[o]=r;const h=t[`__pp_handler_${n}`];h&&t.removeEventListener(n,h);const c=s=>{var i;if(e){const i=P.getScope(e);if(i)return void this.executeHandlerWithScope(r,s,i,t)}let n=t.closest("[pp-component]");n===t&&(n=(null==(i=t.parentElement)?void 0:i.closest("[pp-component]"))??null);const a=(null==n?void 0:n.getAttribute("pp-component"))||null;if(a){const e=P.getScope(a);if(e)return void this.executeHandlerWithScope(r,s,e,t)}this.executeHandler(r,s,t)};t[`__pp_handler_${n}`]=c,t.addEventListener(n,c)}}),s.forEach(e=>{t.removeAttribute(e)})}fallbackCollectEventElements(){const t=new Set,e=this.root.attributes;for(let s=0;s<e.length;s++)if(e[s].name.startsWith("on")&&!e[s].name.includes("-")){t.add(this.root);break}const s=this.root.querySelectorAll("*");for(let e=0;e<s.length;e++){const i=s[e],n=i.attributes;for(let e=0;e<n.length;e++)if(n[e].name.startsWith("on")&&!n[e].name.includes("-")){t.add(i);break}}return t}executeHandler(t,e,s){this.executeHandlerWithScope(t,e,this.getScope(),s)}executeHandlerWithScope(t,e,s,i){const n=Object.keys(s),r=Object.values(s);try{const s=this.getCompiledHandler(t,n).call(i??e.currentTarget??null,...r,e);"function"==typeof s&&s(e)}catch(e){console.error("[PP-ERROR] Handler failed:",e),console.error("Code:",t)}}getCompiledHandler(t,e){const s=t+"|"+e.join(",");if(!this.handlerCache.has(s)){if(this.handlerCache.size>500){const t=this.handlerCache.keys().next().value;t&&this.handlerCache.delete(t)}const i="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";let n;try{n=new Function(...e,"event",`"use strict";${i} return (${t})`)}catch{n=new Function(...e,"event",`"use strict";${i} ${t}`)}this.handlerCache.set(s,n)}return this.handlerCache.get(s)}}var Qt=[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,80,3,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,343,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,330,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,726,6,110,6,6,9,4759,9,787719,239],ct=[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,71,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,2,60,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,328,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,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,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,496,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,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Zt="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",ht="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Le={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"},Ve="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",Yt={5:Ve,"5module":Ve+" export import",6:Ve+" const class extends export import super"},Jt=/^in(stanceof)?$/,ei=new RegExp("["+ht+"]"),ti=new RegExp("["+ht+Zt+"]");function Be(t,e){for(var s=65536,i=0;i<e.length;i+=2){if((s+=e[i])>t)return!1;if((s+=e[i+1])>=t)return!0}return!1}function G(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&ei.test(String.fromCharCode(t)):!1!==e&&Be(t,ct)))}function se(t,e){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&ti.test(String.fromCharCode(t)):!1!==e&&(Be(t,ct)||Be(t,Qt)))))}var _=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function U(t,e){return new _(t,{beforeExpr:!0,binop:e})}var j={beforeExpr:!0},D={startsExpr:!0},Ke={};function C(t,e){return void 0===e&&(e={}),e.keyword=t,Ke[t]=new _(t,e)}var o={num:new _("num",D),regexp:new _("regexp",D),string:new _("string",D),name:new _("name",D),privateId:new _("privateId",D),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 _(",",j),semi:new _(";",j),colon:new _(":",j),dot:new _("."),question:new _("?",j),questionDot:new _("?."),arrow:new _("=>",j),template:new _("template"),invalidTemplate:new _("invalidTemplate"),ellipsis:new _("...",j),backQuote:new _("`",D),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:U("||",1),logicalAND:U("&&",2),bitwiseOR:U("|",3),bitwiseXOR:U("^",4),bitwiseAND:U("&",5),equality:U("==/!=/===/!==",6),relational:U("</>/<=/>=",7),bitShift:U("<</>>/>>>",8),plusMin:new _("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:U("%",10),star:U("*",10),slash:U("/",10),starstar:new _("**",{beforeExpr:!0}),coalesce:U("??",1),_break:C("break"),_case:C("case",j),_catch:C("catch"),_continue:C("continue"),_debugger:C("debugger"),_default:C("default",j),_do:C("do",{isLoop:!0,beforeExpr:!0}),_else:C("else",j),_finally:C("finally"),_for:C("for",{isLoop:!0}),_function:C("function",D),_if:C("if"),_return:C("return",j),_switch:C("switch"),_throw:C("throw",j),_try:C("try"),_var:C("var"),_const:C("const"),_while:C("while",{isLoop:!0}),_with:C("with"),_new:C("new",{beforeExpr:!0,startsExpr:!0}),_this:C("this",D),_super:C("super",D),_class:C("class",D),_extends:C("extends",j),_export:C("export"),_import:C("import",D),_null:C("null",D),_true:C("true",D),_false:C("false",D),_in:C("in",{beforeExpr:!0,binop:7}),_instanceof:C("instanceof",{beforeExpr:!0,binop:7}),_typeof:C("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:C("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:C("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},B=/\r\n?|\n|\u2028|\u2029/,ii=new RegExp(B.source,"g");function pe(t){return 10===t||13===t||8232===t||8233===t}function lt(t,e,s){void 0===s&&(s=t.length);for(var i=e;i<s;i++){var n=t.charCodeAt(i);if(pe(n))return i<s-1&&13===n&&10===t.charCodeAt(i+1)?i+2:i+1}return-1}var pt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,L=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ft=Object.prototype,si=ft.hasOwnProperty,ri=ft.toString,fe=Object.hasOwn||function(t,e){return si.call(t,e)},Je=Array.isArray||function(t){return"[object Array]"===ri.call(t)},et=Object.create(null);function ie(t){return et[t]||(et[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function J(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}var ni=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ve=function(t,e){this.line=t,this.column=e};ve.prototype.offset=function(t){return new ve(this.line,this.column+t)};var Ae=function(t,e,s){this.start=e,this.end=s,null!==t.sourceFile&&(this.source=t.sourceFile)};function dt(t,e){for(var s=1,i=0;;){var n=lt(t,i,e);if(n<0)return new ve(s,e-i);++s,i=n}}var He={ecmaVersion:null,sourceType:"script",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},tt=!1;function ai(t){var e={};for(var s in He)e[s]=t&&fe(t,s)?t[s]:He[s];if("latest"===e.ecmaVersion?e.ecmaVersion=1e8:null==e.ecmaVersion?(!tt&&"object"==typeof console&&console.warn&&(tt=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),(!t||null==t.allowHashBang)&&(e.allowHashBang=e.ecmaVersion>=14),Je(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return Je(e.onComment)&&(e.onComment=oi(e,e.onComment)),e}function oi(t,e){return function(s,i,n,r,a,o){var h={type:s?"Block":"Line",value:i,start:n,end:r};t.locations&&(h.loc=new Ae(this,a,o)),t.ranges&&(h.range=[n,r]),e.push(h)}}var be=1,de=2,$e=4,mt=8,ze=16,gt=32,Pe=64,xt=128,oe=256,ye=512,Ie=be|de|oe;function Ge(t,e){return de|(t?$e:0)|(e?mt:0)}var we=0,Xe=1,te=2,vt=3,bt=4,yt=5,R=function(t,e,s){this.options=t=ai(t),this.sourceFile=t.sourceFile,this.keywords=ie(Yt[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";!0!==t.allowReserved&&(i=Le[t.ecmaVersion>=6?6:5===t.ecmaVersion?5:3],"module"===t.sourceType&&(i+=" await")),this.reservedWords=ie(i);var n=(i?i+" ":"")+Le.strict;this.reservedWordsStrict=ie(n),this.reservedWordsStrictBind=ie(n+" "+Le.strictBind),this.input=String(e),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(B).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.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="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(be),this.regexpState=null,this.privateNameStack=[]},X={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};R.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},X.inFunction.get=function(){return(this.currentVarScope().flags&de)>0},X.inGenerator.get=function(){return(this.currentVarScope().flags&mt)>0},X.inAsync.get=function(){return(this.currentVarScope().flags&$e)>0},X.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(oe|ye))return!1;if(e&de)return(e&$e)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},X.allowSuper.get=function(){return(this.currentThisScope().flags&Pe)>0||this.options.allowSuperOutsideMethod},X.allowDirectSuper.get=function(){return(this.currentThisScope().flags&xt)>0},X.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},X.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(oe|ye)||e&de&&!(e&ze))return!0}return!1},X.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&oe)>0},R.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var s=this,i=0;i<t.length;i++)s=t[i](s);return s},R.parse=function(t,e){return new this(e,t).parse()},R.parseExpressionAt=function(t,e,s){var i=new this(s,t,e);return i.nextToken(),i.parseExpression()},R.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(R.prototype,X);var M=R.prototype,ui=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;M.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){L.lastIndex=t,t+=L.exec(this.input)[0].length;var e=ui.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){L.lastIndex=t+e[0].length;var s=L.exec(this.input),i=s.index+s[0].length,n=this.input.charAt(i);return";"===n||"}"===n||B.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||"!"===n&&"="===this.input.charAt(i+1))}t+=e[0].length,L.lastIndex=t,t+=L.exec(this.input)[0].length,";"===this.input[t]&&t++}},M.eat=function(t){return this.type===t&&(this.next(),!0)},M.isContextual=function(t){return this.type===o.name&&this.value===t&&!this.containsEsc},M.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},M.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},M.canInsertSemicolon=function(){return this.type===o.eof||this.type===o.braceR||B.test(this.input.slice(this.lastTokEnd,this.start))},M.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},M.semicolon=function(){!this.eat(o.semi)&&!this.insertSemicolon()&&this.unexpected()},M.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},M.expect=function(t){this.eat(t)||this.unexpected()},M.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Te=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};M.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,e?"Assigning to rvalue":"Parenthesized pattern")}},M.checkExpressionErrors=function(t,e){if(!t)return!1;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},M.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")},M.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var b=R.prototype;b.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==o.eof;){var s=this.parseStatement(null,!0,e);t.body.push(s)}if(this.inModule)for(var i=0,n=Object.keys(this.undefinedExports);i<n.length;i+=1){var r=n[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var Qe={kind:"loop"},ci={kind:"switch"};b.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;L.lastIndex=this.pos;var e=L.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(91===i||92===i)return!0;if(t)return!1;if(123===i||i>55295&&i<56320)return!0;if(G(i,!0)){for(var n=s+1;se(i=this.input.charCodeAt(n),!0);)++n;if(92===i||i>55295&&i<56320)return!0;var r=this.input.slice(s,n);if(!Jt.test(r))return!0}return!1},b.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;L.lastIndex=this.pos;var t,e=L.exec(this.input),s=this.pos+e[0].length;return!(B.test(this.input.slice(this.pos,s))||"function"!==this.input.slice(s,s+8)||s+8!==this.input.length&&(se(t=this.input.charCodeAt(s+8))||t>55295&&t<56320))},b.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;L.lastIndex=this.pos;var s=L.exec(this.input),i=this.pos+s[0].length;if(B.test(this.input.slice(this.pos,i)))return!1;if(t){var n,r=i+5;if("using"!==this.input.slice(i,r)||r===this.input.length||se(n=this.input.charCodeAt(r))||n>55295&&n<56320)return!1;L.lastIndex=r;var a=L.exec(this.input);if(a&&B.test(this.input.slice(r,r+a[0].length)))return!1}if(e){var o,h=i+2;if(!("of"!==this.input.slice(i,h)||h!==this.input.length&&(se(o=this.input.charCodeAt(h))||o>55295&&o<56320)))return!1}var c=this.input.charCodeAt(i);return G(c,!0)||92===c},b.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)},b.isUsing=function(t){return this.isUsingKeyword(!1,t)},b.parseStatement=function(t,e,s){var i,n=this.type,r=this.startNode();switch(this.isLet(t)&&(n=o._var,i="let"),n){case o._break:case o._continue:return this.parseBreakContinueStatement(r,n.keyword);case o._debugger:return this.parseDebuggerStatement(r);case o._do:return this.parseDoStatement(r);case o._for:return this.parseForStatement(r);case o._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case o._class:return t&&this.unexpected(),this.parseClass(r,!0);case o._if:return this.parseIfStatement(r);case o._return:return this.parseReturnStatement(r);case o._switch:return this.parseSwitchStatement(r);case o._throw:return this.parseThrowStatement(r);case o._try:return this.parseTryStatement(r);case o._const:case o._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(r,i);case o._while:return this.parseWhileStatement(r);case o._with:return this.parseWithStatement(r);case o.braceL:return this.parseBlock(!0,r);case o.semi:return this.parseEmptyStatement(r);case o._export:case o._import:if(this.options.ecmaVersion>10&&n===o._import){L.lastIndex=this.pos;var a=L.exec(this.input),h=this.pos+a[0].length,c=this.input.charCodeAt(h);if(40===c||46===c)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||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===o._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var l=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(l)return e&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===l&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,l),this.semicolon(),this.finishNode(r,"VariableDeclaration");var p=this.value,u=this.parseExpression();return n===o.name&&"Identifier"===u.type&&this.eat(o.colon)?this.parseLabeledStatement(r,p,u,t):this.parseExpressionStatement(r,u)}},b.parseBreakContinueStatement=function(t,e){var s="break"===e;this.next(),this.eat(o.semi)||this.insertSemicolon()?t.label=null:this.type!==o.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var n=this.labels[i];if((null==t.label||n.name===t.label.name)&&(null!=n.kind&&(s||"loop"===n.kind)||t.label&&s))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")},b.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},b.parseDoStatement=function(t){return this.next(),this.labels.push(Qe),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(o._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(o.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},b.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Qe),this.enterScope(0),this.expect(o.parenL),this.type===o.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===o._var||this.type===o._const||s){var i=this.startNode(),n=s?"let":this.value;return this.next(),this.parseVar(i,!0,n),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var r=this.isContextual("let"),a=!1,h=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(h){var c=this.startNode();return this.next(),"await using"===h&&this.next(),this.parseVar(c,!0,h),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var l=this.containsEsc,p=new Te,u=this.start,d=e>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===o._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===o._in&&this.unexpected(e),t.await=!0):a&&this.options.ecmaVersion>=8&&(d.start!==u||l||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(t.await=!1):this.unexpected()),r&&a&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,p),this.checkLValPattern(d),this.parseForIn(t,d)):(this.checkExpressionErrors(p,!0),e>-1&&this.unexpected(e),this.parseFor(t,d))},b.parseForAfterInit=function(t,e,s){return(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===e.declarations.length?(this.options.ecmaVersion>=9&&(this.type===o._in?s>-1&&this.unexpected(s):t.await=s>-1),this.parseForIn(t,e)):(s>-1&&this.unexpected(s),this.parseFor(t,e))},b.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,xe|(s?0:Ue),!1,e)},b.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(o._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},b.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(o.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},b.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(o.braceL),this.labels.push(ci),this.enterScope(0);for(var e,s=!1;this.type!==o.braceR;)if(this.type===o._case||this.type===o._default){var i=this.type===o._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!0,e.test=null),this.expect(o.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},b.parseThrowStatement=function(t){return this.next(),B.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var hi=[];b.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e="Identifier"===t.type;return this.enterScope(e?gt:0),this.checkLValPattern(t,e?bt:te),this.expect(o.parenR),t},b.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===o._catch){var e=this.startNode();this.next(),this.eat(o.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(o._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},b.parseVarStatement=function(t,e,s){return this.next(),this.parseVar(t,!1,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")},b.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(Qe),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},b.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},b.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},b.parseLabeledStatement=function(t,e,s,i){for(var n=0,r=this.labels;n<r.length;n+=1){r[n].name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===o._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var c=this.labels[h];if(c.statementStart!==t.start)break;c.statementStart=this.start,c.kind=a}return this.labels.push({name:e,kind:a,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")},b.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},b.parseBlock=function(t,e,s){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect(o.braceL),t&&this.enterScope(0);this.type!==o.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},b.parseFor=function(t,e){return t.init=e,this.expect(o.semi),t.test=this.type===o.semi?null:this.parseExpression(),this.expect(o.semi),t.update=this.type===o.parenR?null:this.parseExpression(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},b.parseForIn=function(t,e){var s=this.type===o._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)&&this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")},b.parseVar=function(t,e,s,i){for(t.declarations=[],t.kind=s;;){var n=this.startNode();if(this.parseVarId(n,s),this.eat(o.eq)?n.init=this.parseMaybeAssign(e):i||"const"!==s||this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"using"!==s&&"await using"!==s||!(this.options.ecmaVersion>=17)||this.type===o._in||this.isContextual("of")?i||"Identifier"===n.id.type||e&&(this.type===o._in||this.isContextual("of"))?n.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+s+" declaration"):this.unexpected(),t.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(o.comma))break}return t},b.parseVarId=function(t,e){t.id="using"===e||"await using"===e?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,"var"===e?Xe:te,!1)};var xe=1,Ue=2,St=4;function li(t,e){var s=e.key.name,i=t[s],n="true";return"MethodDefinition"===e.type&&("get"===e.kind||"set"===e.kind)&&(n=(e.static?"s":"i")+e.kind),"iget"===i&&"iset"===n||"iset"===i&&"iget"===n||"sget"===i&&"sset"===n||"sset"===i&&"sget"===n?(t[s]="true",!1):!!i||(t[s]=n,!1)}function Ce(t,e){var s=t.computed,i=t.key;return!s&&("Identifier"===i.type&&i.name===e||"Literal"===i.type&&i.value===e)}b.parseFunction=function(t,e,s,i,n){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===o.star&&e&Ue&&this.unexpected(),t.generator=this.eat(o.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&xe&&(t.id=e&St&&this.type!==o.name?null:this.parseIdent(),t.id&&!(e&Ue)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?Xe:te:vt));var r=this.yieldPos,a=this.awaitPos,h=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ge(t.async,t.generator)),e&xe||(t.id=this.type===o.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,!1,n),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=h,this.finishNode(t,e&xe?"FunctionDeclaration":"FunctionExpression")},b.parseFunctionParams=function(t){this.expect(o.parenL),t.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},b.parseClass=function(t,e){this.next();var s=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),n=this.startNode(),r=!1;for(n.body=[],this.expect(o.braceL);this.type!==o.braceR;){var a=this.parseClassElement(null!==t.superClass);a&&(n.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&"PrivateIdentifier"===a.key.type&&li(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=s,this.next(),t.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},b.parseClassElement=function(t){if(this.eat(o.semi))return null;var e=this.options.ecmaVersion,s=this.startNode(),i="",n=!1,r=!1,a="method",h=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(o.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===o.star?h=!0:i="static"}if(s.static=h,!i&&e>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==o.star||this.canInsertSemicolon()?i="async":r=!0),!i&&(e>=9||!r)&&this.eat(o.star)&&(n=!0),!i&&!r&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:i=c)}if(i?(s.computed=!1,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=i,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),e<13||this.type===o.parenL||"method"!==a||n||r){var l=!s.static&&Ce(s,"constructor"),p=l&&t;l&&"method"!==a&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=l?"constructor":a,this.parseClassMethod(s,n,r,p)}else this.parseClassField(s);return s},b.isClassElementNameStart=function(){return this.type===o.name||this.type===o.privateId||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword},b.parseClassElementName=function(t){this.type===o.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)},b.parseClassMethod=function(t,e,s,i){var n=t.key;"constructor"===t.kind?(e&&this.raise(n.start,"Constructor can't be a generator"),s&&this.raise(n.start,"Constructor can't be an async method")):t.static&&Ce(t,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var r=t.value=this.parseMethod(e,s,i);return"get"===t.kind&&0!==r.params.length&&this.raiseRecoverable(r.start,"getter should have no params"),"set"===t.kind&&1!==r.params.length&&this.raiseRecoverable(r.start,"setter should have exactly one param"),"set"===t.kind&&"RestElement"===r.params[0].type&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")},b.parseClassField=function(t){return Ce(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Ce(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(o.eq)?(this.enterScope(ye|Pe),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")},b.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(oe|Pe);this.type!==o.braceR;){var s=this.parseStatement(null);t.body.push(s)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")},b.parseClassId=function(t,e){this.type===o.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,te,!1)):(!0===e&&this.unexpected(),t.id=null)},b.parseClassSuper=function(t){t.superClass=this.eat(o._extends)?this.parseExprSubscripts(null,!1):null},b.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared},b.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,s=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,n=0===i?null:this.privateNameStack[i-1],r=0;r<s.length;++r){var a=s[r];fe(e,a.name)||(n?n.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},b.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")},b.parseExport=function(t,e){if(this.next(),this.eat(o.star))return this.parseExportAllDeclaration(t,e);if(this.eat(o._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var s=0,i=t.specifiers;s<i.length;s+=1){var n=i[s];this.checkUnreserved(n.local),this.checkLocalExport(n.local),"Literal"===n.local.type&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},b.parseExportDeclaration=function(t){return this.parseStatement(null)},b.parseExportDefaultDeclaration=function(){var t;if(this.type===o._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,xe|St,!1,t)}if(this.type===o._class){var s=this.startNode();return this.parseClass(s,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},b.checkExport=function(t,e,s){t&&("string"!=typeof e&&(e="Identifier"===e.type?e.name:e.value),fe(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=!0)},b.checkPatternExport=function(t,e){var s=e.type;if("Identifier"===s)this.checkExport(t,e,e.start);else if("ObjectPattern"===s)for(var i=0,n=e.properties;i<n.length;i+=1){var r=n[i];this.checkPatternExport(t,r)}else if("ArrayPattern"===s)for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(t,h)}else"Property"===s?this.checkPatternExport(t,e.value):"AssignmentPattern"===s?this.checkPatternExport(t,e.left):"RestElement"===s&&this.checkPatternExport(t,e.argument)},b.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var n=i[s];this.checkPatternExport(t,n.id)}},b.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},b.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")},b.parseExportSpecifiers=function(t){var e=[],s=!0;for(this.expect(o.braceL);!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;e.push(this.parseExportSpecifier(t))}return e},b.parseImport=function(t){return this.next(),this.type===o.string?(t.specifiers=hi,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===o.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},b.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,te),this.finishNode(t,"ImportSpecifier")},b.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,te),this.finishNode(t,"ImportDefaultSpecifier")},b.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,te),this.finishNode(t,"ImportNamespaceSpecifier")},b.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===o.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(o.comma)))return t;if(this.type===o.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(o.braceL);!this.eat(o.braceR);){if(e)e=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;t.push(this.parseImportSpecifier())}return t},b.parseWithClause=function(){var t=[];if(!this.eat(o._with))return t;this.expect(o.braceL);for(var e={},s=!0;!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var i=this.parseImportAttribute(),n="Identifier"===i.key.type?i.key.name:i.key.value;fe(e,n)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+n+"'"),e[n]=!0,t.push(i)}return t},b.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(o.colon),this.type!==o.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")},b.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===o.string){var t=this.parseLiteral(this.value);return ni.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)},b.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},b.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var W=R.prototype;W.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,!0);for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.toAssignable(r,e),"RestElement"===r.type&&("ArrayPattern"===r.argument.type||"ObjectPattern"===r.argument.type)&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,!0);return t},W.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var n=t[i];n&&this.toAssignable(n,e)}if(s){var r=t[s-1];6===this.options.ecmaVersion&&e&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return t},W.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},W.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==o.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},W.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case o.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(o.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case o.braceL:return this.parseObj(!0)}return this.parseIdent()},W.parseBindingList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(o.comma),e&&this.type===o.comma)n.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===o.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}n.push(this.parseAssignableListItem(i))}return n},W.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e},W.parseBindingListItem=function(t){return t},W.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(o.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},W.checkLValSimple=function(t,e,s){void 0===e&&(e=we);var i=e!==we;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===te&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),s&&(fe(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=!0),e!==yt&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,s);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}},W.checkLValPattern=function(t,e,s){switch(void 0===e&&(e=we),t.type){case"ObjectPattern":for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,e,s)}break;case"ArrayPattern":for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,e,s)}break;default:this.checkLValSimple(t,e,s)}},W.checkLValInnerPattern=function(t,e,s){switch(void 0===e&&(e=we),t.type){case"Property":this.checkLValInnerPattern(t.value,e,s);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,s);break;case"RestElement":this.checkLValPattern(t.argument,e,s);break;default:this.checkLValPattern(t,e,s)}};var K=function(t,e,s,i,n){this.token=t,this.isExpr=!!e,this.preserveSpace=!!s,this.override=i,this.generator=!!n},I={b_stat:new K("{",!1),b_expr:new K("{",!0),b_tmpl:new K("${",!1),p_stat:new K("(",!1),p_expr:new K("(",!0),q_tmpl:new K("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new K("function",!1),f_expr:new K("function",!0),f_expr_gen:new K("function",!0,!1,null,!0),f_gen:new K("function",!1,!1,null,!0)},me=R.prototype;me.initialContext=function(){return[I.b_stat]},me.curContext=function(){return this.context[this.context.length-1]},me.braceIsBlock=function(t){var e=this.curContext();return e===I.f_expr||e===I.f_stat||(t!==o.colon||e!==I.b_stat&&e!==I.b_expr?t===o._return||t===o.name&&this.exprAllowed?B.test(this.input.slice(this.lastTokEnd,this.start)):t===o._else||t===o.semi||t===o.eof||t===o.parenR||t===o.arrow||(t===o.braceL?e===I.b_stat:t!==o._var&&t!==o._const&&t!==o.name&&!this.exprAllowed):!e.isExpr)},me.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if("function"===e.token)return e.generator}return!1},me.updateContext=function(t){var e,s=this.type;s.keyword&&t===o.dot?this.exprAllowed=!1:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr},me.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)},o.parenR.updateContext=o.braceR.updateContext=function(){if(1!==this.context.length){var t=this.context.pop();t===I.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr}else this.exprAllowed=!0},o.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?I.b_stat:I.b_expr),this.exprAllowed=!0},o.dollarBraceL.updateContext=function(){this.context.push(I.b_tmpl),this.exprAllowed=!0},o.parenL.updateContext=function(t){var e=t===o._if||t===o._for||t===o._with||t===o._while;this.context.push(e?I.p_stat:I.p_expr),this.exprAllowed=!0},o.incDec.updateContext=function(){},o._function.updateContext=o._class.updateContext=function(t){!t.beforeExpr||t===o._else||t===o.semi&&this.curContext()!==I.p_stat||t===o._return&&B.test(this.input.slice(this.lastTokEnd,this.start))||(t===o.colon||t===o.braceL)&&this.curContext()===I.b_stat?this.context.push(I.f_stat):this.context.push(I.f_expr),this.exprAllowed=!1},o.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},o.backQuote.updateContext=function(){this.curContext()===I.q_tmpl?this.context.pop():this.context.push(I.q_tmpl),this.exprAllowed=!1},o.star.updateContext=function(t){if(t===o._function){var e=this.context.length-1;this.context[e]===I.f_expr?this.context[e]=I.f_expr_gen:this.context[e]=I.f_gen}this.exprAllowed=!0},o.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==o.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var y=R.prototype;function Et(t){return"Identifier"===t.type||"ParenthesizedExpression"===t.type&&Et(t.expression)}function je(t){return"MemberExpression"===t.type&&"PrivateIdentifier"===t.property.type||"ChainExpression"===t.type&&je(t.expression)||"ParenthesizedExpression"===t.type&&je(t.expression)}y.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,n=t.key;switch(n.type){case"Identifier":i=n.name;break;case"Literal":i=String(n.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===i&&"init"===r&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),e.proto=!0));var a=e[i="$"+i];if(a)("init"===r?this.strict&&a.init||a.get||a.set:a.init||a[r])&&this.raiseRecoverable(n.start,"Redefinition of property");else a=e[i]={init:!1,get:!1,set:!1};a[r]=!0}},y.parseExpression=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeAssign(t,e);if(this.type===o.comma){var r=this.startNodeAt(s,i);for(r.expressions=[n];this.eat(o.comma);)r.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(r,"SequenceExpression")}return n},y.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,n=-1,r=-1,a=-1;e?(n=e.parenthesizedAssign,r=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Te,i=!0);var h=this.start,c=this.startLoc;(this.type===o.parenL||this.type===o.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===t);var l=this.parseMaybeConditional(t,e);if(s&&(l=s.call(this,l,h,c)),this.type.isAssign){var p=this.startNodeAt(h,c);return p.operator=this.value,this.type===o.eq&&(l=this.toAssignable(l,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=l.start&&(e.shorthandAssign=-1),this.type===o.eq?this.checkLValPattern(l):this.checkLValSimple(l),p.left=l,this.next(),p.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(p,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),n>-1&&(e.parenthesizedAssign=n),r>-1&&(e.trailingComma=r),l},y.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return n;if(this.eat(o.question)){var r=this.startNodeAt(s,i);return r.test=n,r.consequent=this.parseMaybeAssign(),this.expect(o.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return n},y.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||n.start===s&&"ArrowFunctionExpression"===n.type?n:this.parseExprOp(n,s,i,-1,t)},y.parseExprOp=function(t,e,s,i,n){var r=this.type.binop;if(null!=r&&(!n||this.type!==o._in)&&r>i){var a=this.type===o.logicalOR||this.type===o.logicalAND,h=this.type===o.coalesce;h&&(r=o.logicalAND.binop);var c=this.value;this.next();var l=this.start,p=this.startLoc,u=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),l,p,r,n),d=this.buildBinary(e,s,t,u,c,a||h);return(a&&this.type===o.coalesce||h&&(this.type===o.logicalOR||this.type===o.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,e,s,i,n)}return t},y.buildBinary=function(t,e,s,i,n,r){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(t,e);return a.left=s,a.operator=n,a.right=i,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},y.parseMaybeUnary=function(t,e,s,i){var n,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(i),e=!0;else if(this.type.prefix){var h=this.startNode(),c=this.type===o.incDec;h.operator=this.value,h.prefix=!0,this.next(),h.argument=this.parseMaybeUnary(null,!0,c,i),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(h.argument):this.strict&&"delete"===h.operator&&Et(h.argument)?this.raiseRecoverable(h.start,"Deleting local variable in strict mode"):"delete"===h.operator&&je(h.argument)?this.raiseRecoverable(h.start,"Private fields can not be deleted"):e=!0,n=this.finishNode(h,c?"UpdateExpression":"UnaryExpression")}else if(e||this.type!==o.privateId){if(n=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,a);l.operator=this.value,l.prefix=!1,l.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(l,"UpdateExpression")}}else(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==o._in&&this.unexpected();return s||!this.eat(o.starstar)?n:e?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,n,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},y.parseExprSubscripts=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprAtom(t,e);if("ArrowFunctionExpression"===n.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return n;var r=this.parseSubscripts(n,s,i,!1,e);return t&&"MemberExpression"===r.type&&(t.parenthesizedAssign>=r.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=r.start&&(t.parenthesizedBind=-1),t.trailingComma>=r.start&&(t.trailingComma=-1)),r},y.parseSubscripts=function(t,e,s,i,n){for(var r=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,a=!1;;){var o=this.parseSubscript(t,e,s,i,r,a,n);if(o.optional&&(a=!0),o===t||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(e,s);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}t=o}},y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(o.arrow)},y.parseSubscriptAsyncArrow=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!0,i)},y.parseSubscript=function(t,e,s,i,n,r,a){var h=this.options.ecmaVersion>=11,c=h&&this.eat(o.questionDot);i&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(o.bracketL);if(l||c&&this.type!==o.parenL&&this.type!==o.backQuote||this.eat(o.dot)){var p=this.startNodeAt(e,s);p.object=t,l?(p.property=this.parseExpression(),this.expect(o.bracketR)):this.type===o.privateId&&"Super"!==t.type?p.property=this.parsePrivateIdent():p.property=this.parseIdent("never"!==this.options.allowReserved),p.computed=!!l,h&&(p.optional=c),t=this.finishNode(p,"MemberExpression")}else if(!i&&this.eat(o.parenL)){var u=new Te,d=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1,u);if(n&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(e,s,g,a);this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var v=this.startNodeAt(e,s);v.callee=t,v.arguments=g,h&&(v.optional=c),t=this.finishNode(v,"CallExpression")}else if(this.type===o.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var x=this.startNodeAt(e,s);x.tag=t,x.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(x,"TaggedTemplateExpression")}return t},y.parseExprAtom=function(t,e,s){this.type===o.slash&&this.readRegexp();var i,n=this.potentialArrowAt===this.start;switch(this.type){case o._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===o.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==o.dot&&this.type!==o.bracketL&&this.type!==o.parenL&&this.unexpected(),this.finishNode(i,"Super");case o._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case o.name:var r=this.start,a=this.startLoc,h=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!h&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(o._function))return this.overrideContext(I.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,e);if(n&&!this.canInsertSemicolon()){if(this.eat(o.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[c],!1,e);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===o.name&&!h&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(o.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,e)}return c;case o.regexp:var l=this.value;return(i=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},i;case o.num:case o.string:return this.parseLiteral(this.value);case o._null:case o._true:case o._false:return(i=this.startNode()).value=this.type===o._null?null:this.type===o._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case o.parenL:var p=this.start,u=this.parseParenAndDistinguishExpression(n,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(t.parenthesizedAssign=p),t.parenthesizedBind<0&&(t.parenthesizedBind=p)),u;case o.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(o.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case o.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,t);case o._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case o._class:return this.parseClass(this.startNode(),!1);case o._new:return this.parseNew();case o.backQuote:return this.parseTemplate();case o._import:return this.options.ecmaVersion>=11?this.parseExprImport(s):this.unexpected();default:return this.parseExprAtomDefault()}},y.parseExprAtomDefault=function(){this.unexpected()},y.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===o.parenL&&!t)return this.parseDynamicImport(e);if(this.type===o.dot){var s=this.startNodeAt(e.start,e.loc&&e.loc.start);return s.name="import",e.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(e)}this.unexpected()},y.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(o.parenR)?t.options=null:(this.expect(o.comma),this.afterTrailingComma(o.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(o.parenR)||(this.expect(o.comma),this.afterTrailingComma(o.parenR)||this.unexpected())));else if(!this.eat(o.parenR)){var e=this.start;this.eat(o.comma)&&this.eat(o.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},y.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},y.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=null!=e.value?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},y.parseParenExpression=function(){this.expect(o.parenL);var t=this.parseExpression();return this.expect(o.parenR),t},y.shouldParseArrow=function(t){return!this.canInsertSemicolon()},y.parseParenAndDistinguishExpression=function(t,e){var s,i=this.start,n=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,h=this.start,c=this.startLoc,l=[],p=!0,u=!1,d=new Te,f=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==o.parenR;){if(p?p=!1:this.expect(o.comma),r&&this.afterTrailingComma(o.parenR,!0)){u=!0;break}if(this.type===o.ellipsis){a=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}l.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(o.parenR),t&&this.shouldParseArrow(l)&&this.eat(o.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=m,this.parseParenArrowList(i,n,l,e);(!l.length||u)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=m||this.awaitPos,l.length>1?((s=this.startNodeAt(h,c)).expressions=l,this.finishNodeAt(s,"SequenceExpression",g,v)):s=l[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var x=this.startNodeAt(i,n);return x.expression=s,this.finishNode(x,"ParenthesizedExpression")}return s},y.parseParenItem=function(t){return t},y.parseParenArrowList=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!1,i)};var pi=[];y.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===o.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var s=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,n=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,n,!0,!1),this.eat(o.parenL)?t.arguments=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1):t.arguments=pi,this.finishNode(t,"NewExpression")},y.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===o.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===o.backQuote,this.finishNode(s,"TemplateElement")},y.parseTemplate=function(t){void 0===t&&(t={});var e=t.isTagged;void 0===e&&(e=!1);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===o.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(o.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(o.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")},y.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===o.name||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===o.star)&&!B.test(this.input.slice(this.lastTokEnd,this.start))},y.parseObj=function(t,e){var s=this.startNode(),i=!0,n={};for(s.properties=[],this.next();!this.eat(o.braceR);){if(i)i=!1;else if(this.expect(o.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(o.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,n,e),s.properties.push(r)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")},y.parseProperty=function(t,e){var s,i,n,r,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(o.ellipsis))return t?(a.argument=this.parseIdent(!1),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,e),this.type===o.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(t||e)&&(n=this.start,r=this.startLoc),t||(s=this.eat(o.star)));var h=this.containsEsc;return this.parsePropertyName(a),!t&&!h&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(a)?(i=!0,s=this.options.ecmaVersion>=9&&this.eat(o.star),this.parsePropertyName(a)):i=!1,this.parsePropertyValue(a,t,s,i,n,r,e,h),this.finishNode(a,"Property")},y.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var s="get"===t.kind?0:1;if(t.value.params.length!==s){var i=t.value.start;"get"===t.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")},y.parsePropertyValue=function(t,e,s,i,n,r,a,h){(s||i)&&this.type===o.colon&&this.unexpected(),this.eat(o.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===o.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(s,i),t.kind="init"):e||h||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type===o.comma||this.type===o.braceR||this.type===o.eq?this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),"await"===t.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=n),e?t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key)):this.type===o.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected():((s||i)&&this.unexpected(),this.parseGetterSetter(t))},y.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(o.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(o.bracketR),t.key;t.computed=!1}return t.key=this.type===o.num||this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},y.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},y.parseMethod=function(t,e,s){var i=this.startNode(),n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ge(e,i.generator)|Pe|(s?xt:0)),this.expect(o.parenL),i.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")},y.parseArrowExpression=function(t,e,s,i){var n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Ge(s,!1)|ze),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(t,"ArrowFunctionExpression")},y.parseFunctionBody=function(t,e,s,i){var n=e&&this.type!==o.braceL,r=this.strict,a=!1;if(n)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var h=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||h)&&((a=this.strictDirective(this.end))&&h&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(t,!r&&!a&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,yt),t.body=this.parseBlock(!1,void 0,a&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()},y.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){if("Identifier"!==s[e].type)return!1}return!0},y.checkParams=function(t,e){for(var s=Object.create(null),i=0,n=t.params;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,Xe,e?null:s)}},y.parseExprList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect(o.comma),e&&this.afterTrailingComma(t))break;var a=void 0;s&&this.type===o.comma?a=null:this.type===o.ellipsis?(a=this.parseSpread(i),i&&this.type===o.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),n.push(a)}return n},y.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Ie)&&"arguments"===i&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===i||"await"===i)&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(e,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(!this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))},y.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),"await"===e.name&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e},y.parseIdentNode=function(){var t=this.startNode();return this.type===o.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,("class"===t.name||"function"===t.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=o.name):this.unexpected(),t},y.parsePrivateIdent=function(){var t=this.startNode();return this.type===o.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t},y.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===o.semi||this.canInsertSemicolon()||this.type!==o.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(o.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")},y.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var _e=R.prototype;_e.raise=function(t,e){var s=dt(this.input,t);e+=" ("+s.line+":"+s.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i},_e.raiseRecoverable=_e.raise,_e.curPosition=function(){if(this.options.locations)return new ve(this.curLine,this.pos-this.lineStart)};var re=R.prototype,fi=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};re.enterScope=function(t){this.scopeStack.push(new fi(t))},re.exitScope=function(){this.scopeStack.pop()},re.treatFunctionsAsVarInScope=function(t){return t.flags&de||!this.inModule&&t.flags&be},re.declareName=function(t,e,s){var i=!1;if(e===te){var n=this.currentScope();i=n.lexical.indexOf(t)>-1||n.functions.indexOf(t)>-1||n.var.indexOf(t)>-1,n.lexical.push(t),this.inModule&&n.flags&be&&delete this.undefinedExports[t]}else if(e===bt){this.currentScope().lexical.push(t)}else if(e===vt){var r=this.currentScope();i=this.treatFunctionsAsVar?r.lexical.indexOf(t)>-1:r.lexical.indexOf(t)>-1||r.var.indexOf(t)>-1,r.functions.push(t)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(t)>-1&&!(o.flags&gt&&o.lexical[0]===t)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(t)>-1){i=!0;break}if(o.var.push(t),this.inModule&&o.flags&be&&delete this.undefinedExports[t],o.flags&Ie)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")},re.checkLocalExport=function(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&(this.undefinedExports[t.name]=t)},re.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},re.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Ie|ye|oe))return e}},re.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Ie|ye|oe)&&!(e.flags&ze))return e}};var Ne=function(t,e,s){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new Ae(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},Se=R.prototype;function wt(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}Se.startNode=function(){return new Ne(this,this.start,this.startLoc)},Se.startNodeAt=function(t,e){return new Ne(this,t,e)},Se.finishNode=function(t,e){return wt.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},Se.finishNodeAt=function(t,e,s,i){return wt.call(this,t,e,s,i)},Se.copyNode=function(t){var e=new Ne(this,t.start,this.startLoc);for(var s in t)e[s]=t[s];return e};var di="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",Ct="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",_t=Ct+" Extended_Pictographic",kt=_t,At=_t+" EBase EComp EMod EPres ExtPict",Pt=At,mi=At,gi={9:Ct,10:_t,11:_t,12:At,13:At,14:mi},xi="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",vi={9:"",10:"",11:"",12:"",13:"",14:xi},it="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",It="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",Tt=It+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Nt=Tt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Rt=Nt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Lt=Rt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",bi=Lt+" "+di,yi={9:It,10:Tt,11:Nt,12:Rt,13:Lt,14:bi},Vt={};function Si(t){var e=Vt[t]={binary:ie(gi[t]+" "+it),binaryOfStrings:ie(vi[t]),nonBinary:{General_Category:ie(it),Script:ie(yi[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var Oe=0,st=[9,10,11,12,13,14];Oe<st.length;Oe+=1){var Ei=st[Oe];Si(Ei)}var v=R.prototype,ke=function(t,e){this.parent=t,this.base=e||this};ke.prototype.separatedFrom=function(t){for(var e=this;e;e=e.parent)for(var s=t;s;s=s.parent)if(e.base===s.base&&e!==s)return!0;return!1},ke.prototype.sibling=function(){return new ke(this.parent,this.base)};var Q=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=Vt[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};function wi(t){for(var e in t)return!0;return!1}function Ci(t){return 105===t||109===t||115===t}function Ot(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function _i(t){return G(t,!0)||36===t||95===t}function ki(t){return se(t,!0)||36===t||95===t||8204===t||8205===t}function Mt(t){return t>=65&&t<=90||t>=97&&t<=122}function Ai(t){return t>=0&&t<=1114111}Q.prototype.reset=function(t,e,s){var i=-1!==s.indexOf("v"),n=-1!==s.indexOf("u");this.start=0|t,this.source=e+"",this.flags=s,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},Q.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Q.prototype.at=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return-1;var n=s.charCodeAt(t);if(!e&&!this.switchU||n<=55295||n>=57344||t+1>=i)return n;var r=s.charCodeAt(t+1);return r>=56320&&r<=57343?(n<<10)+r-56613888:n},Q.prototype.nextIndex=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return i;var n,r=s.charCodeAt(t);return!e&&!this.switchU||r<=55295||r>=57344||t+1>=i||(n=s.charCodeAt(t+1))<56320||n>57343?t+1:t+2},Q.prototype.current=function(t){return void 0===t&&(t=!1),this.at(this.pos,t)},Q.prototype.lookahead=function(t){return void 0===t&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Q.prototype.advance=function(t){void 0===t&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Q.prototype.eat=function(t,e){return void 0===e&&(e=!1),this.current(e)===t&&(this.advance(e),!0)},Q.prototype.eatChars=function(t,e){void 0===e&&(e=!1);for(var s=this.pos,i=0,n=t;i<n.length;i+=1){var r=n[i],a=this.at(s,e);if(-1===a||a!==r)return!1;s=this.nextIndex(s,e)}return this.pos=s,!0},v.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=!1,n=!1,r=0;r<s.length;r++){var a=s.charAt(r);-1===e.indexOf(a)&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(a,r+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),"u"===a&&(i=!0),"v"===a&&(n=!0)}this.options.ecmaVersion>=15&&i&&n&&this.raise(t.start,"Invalid regular expression flag")},v.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&wi(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))},v.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}},v.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new ke(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},v.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},v.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!!(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},v.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=!1;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,!0}return t.pos=e,!1},v.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},v.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},v.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,n=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(n=t.lastIntValue),t.eat(125)))return-1!==n&&n<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return!1},v.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},v.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},v.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(t),i=t.eat(45);if(s||i){for(var n=0;n<s.length;n++){var r=s.charAt(n);s.indexOf(r,n+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(t);!s&&!a&&58===t.current()&&t.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||s.indexOf(h)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1},v.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},v.regexp_eatModifiers=function(t){for(var e="",s=0;-1!==(s=t.current())&&Ci(s);)e+=J(s),t.advance();return e},v.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},v.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},v.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!Ot(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;-1!==(s=t.current())&&!Ot(s);)t.advance();return t.pos!==e},v.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(-1===e||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e)&&(t.advance(),!0)},v.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,s=t.groupNames[t.lastStringValue];if(s)if(e)for(var i=0,n=s;i<n.length;i+=1){n[i].separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(s||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}},v.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},v.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=J(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=J(t.lastIntValue);return!0}return!1},v.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),_i(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),ki(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},v.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),!0;if(s<=t.numCapturingParens)return!0;t.pos=e}return!1},v.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},v.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},v.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},v.regexp_eatZero=function(t){return 48===t.current()&&!Re(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},v.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},v.regexp_eatControlLetter=function(t){var e=t.current();return!!Mt(e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){void 0===e&&(e=!1);var s=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var n=t.lastIntValue;if(i&&n>=55296&&n<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=1024*(n-55296)+(a-56320)+65536,!0}t.pos=r,t.lastIntValue=n}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Ai(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=s}return!1},v.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do{t.lastIntValue=10*t.lastIntValue+(e-48),t.advance()}while((e=t.current())>=48&&e<=57);return!0}return!1};var Ft=0,ee=1,q=2;function Pi(t){return 100===t||68===t||115===t||83===t||119===t||87===t}function Dt(t){return Mt(t)||95===t}function Ii(t){return Dt(t)||Re(t)}function Ti(t){return 33===t||t>=35&&t<=38||t>=42&&t<=44||46===t||t>=58&&t<=64||94===t||96===t||126===t}function Ni(t){return 40===t||41===t||45===t||47===t||t>=91&&t<=93||t>=123&&t<=125}function Ri(t){return 33===t||35===t||37===t||38===t||44===t||45===t||t>=58&&t<=62||64===t||96===t||126===t}function Re(t){return t>=48&&t<=57}function Bt(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function Ht(t){return t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:t-48}function Ut(t){return t>=48&&t<=55}v.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Pi(e))return t.lastIntValue=-1,t.advance(),ee;var s=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((s=80===e)||112===e)){var i;if(t.lastIntValue=-1,t.advance(),t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return s&&i===q&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return Ft},v.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),ee}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var n=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,n)}return Ft},v.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){fe(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")},v.regexp_validateUnicodePropertyNameOrValue=function(t,e){return t.unicodeProperties.binary.test(e)?ee:t.switchV&&t.unicodeProperties.binaryOfStrings.test(e)?q:void t.raise("Invalid property name")},v.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Dt(e=t.current());)t.lastStringValue+=J(e),t.advance();return""!==t.lastStringValue},v.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Ii(e=t.current());)t.lastStringValue+=J(e),t.advance();return""!==t.lastStringValue},v.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},v.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),s=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&s===q&&t.raise("Negated character class may contain strings"),!0}return!1},v.regexp_classContents=function(t){return 93===t.current()?ee:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),ee)},v.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;t.switchU&&(-1===e||-1===s)&&t.raise("Invalid character class"),-1!==e&&-1!==s&&e>s&&t.raise("Range out of order in character class")}}},v.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var s=t.current();(99===s||Ut(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return 93!==i&&(t.lastIntValue=i,t.advance(),!0)},v.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},v.regexp_classSetExpression=function(t){var e,s=ee;if(!this.regexp_eatClassSetRange(t))if(e=this.regexp_eatClassSetOperand(t)){e===q&&(s=q);for(var i=t.pos;t.eatChars([38,38]);)38!==t.current()&&(e=this.regexp_eatClassSetOperand(t))?e!==q&&(s=ee):t.raise("Invalid character in character class");if(i!==t.pos)return s;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return s}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(!(e=this.regexp_eatClassSetOperand(t)))return s;e===q&&(s=q)}},v.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var s=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return-1!==s&&-1!==i&&s>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1},v.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?ee:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)},v.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var s=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return s&&i===q&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var n=this.regexp_eatCharacterClassEscape(t);if(n)return n;t.pos=e}return null},v.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var s=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return s}else t.raise("Invalid escape");t.pos=e}return null},v.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===q&&(e=q);return e},v.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return 1===e?ee:q},v.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return!(!this.regexp_eatCharacterEscape(t)&&!this.regexp_eatClassSetReservedPunctuator(t))||(t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1));var s=t.current();return!(s<0||s===t.lookahead()&&Ti(s)||Ni(s))&&(t.advance(),t.lastIntValue=s,!0)},v.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return!!Ri(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!Re(e)&&95!==e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},v.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Re(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e},v.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Bt(s=t.current());)t.lastIntValue=16*t.lastIntValue+Ht(s),t.advance();return t.pos!==e},v.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*s+t.lastIntValue:t.lastIntValue=8*e+s}else t.lastIntValue=e;return!0}return!1},v.regexp_eatOctalDigit=function(t){var e=t.current();return Ut(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},v.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var n=t.current();if(!Bt(n))return t.pos=s,!1;t.lastIntValue=16*t.lastIntValue+Ht(n),t.advance()}return!0};var Ze=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new Ae(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},E=R.prototype;function Li(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function jt(t){return"function"!=typeof BigInt?null:BigInt(t.replace(/_/g,""))}E.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ze(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},E.getToken=function(){return this.next(),new Ze(this)},typeof Symbol<"u"&&(E[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===o.eof,value:e}}}}),E.nextToken=function(){var t=this.curContext();return(!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(o.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},E.readToken=function(t){return G(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},E.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888},E.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i=void 0,n=e;(i=lt(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())},E.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!pe(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())},E.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++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 t}break;default:if(!(t>8&&t<14||t>=5760&&pt.test(String.fromCharCode(t))))break t;++this.pos}}},E.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)},E.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken(o.ellipsis)):(++this.pos,this.finishToken(o.dot))},E.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp(o.assign,2):this.finishOp(o.slash,1)},E.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=42===t?o.star:o.modulo;return this.options.ecmaVersion>=7&&42===t&&42===e&&(++s,i=o.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp(o.assign,s+1):this.finishOp(i,s)},E.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(124===t?o.logicalOR:o.logicalAND,2)}return 61===e?this.finishOp(o.assign,2):this.finishOp(124===t?o.bitwiseOR:o.bitwiseAND,1)},E.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(o.assign,2):this.finishOp(o.bitwiseXOR,1)},E.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!==e||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!B.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(o.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp(o.assign,2):this.finishOp(o.plusMin,1)},E.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp(o.assign,s+1):this.finishOp(o.bitShift,s)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===e&&(s=2),this.finishOp(o.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},E.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(o.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(o.arrow)):this.finishOp(61===t?o.eq:o.prefix,1)},E.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(46===e){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(o.questionDot,2)}if(63===e){if(t>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(o.coalesce,2)}}return this.finishOp(o.question,1)},E.readToken_numberSign=function(){var t=35;if(this.options.ecmaVersion>=13&&(++this.pos,G(t=this.fullCharCodeAtPos(),!0)||92===t))return this.finishToken(o.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+J(t)+"'")},E.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(o.parenL);case 41:return++this.pos,this.finishToken(o.parenR);case 59:return++this.pos,this.finishToken(o.semi);case 44:return++this.pos,this.finishToken(o.comma);case 91:return++this.pos,this.finishToken(o.bracketL);case 93:return++this.pos,this.finishToken(o.bracketR);case 123:return++this.pos,this.finishToken(o.braceL);case 125:return++this.pos,this.finishToken(o.braceR);case 58:return++this.pos,this.finishToken(o.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(o.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)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(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(o.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+J(t)+"'")},E.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)},E.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(B.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++this.pos}var n=this.input.slice(s,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var h=this.regexpState||(this.regexpState=new Q(this));h.reset(s,n,a),this.validateRegExpFlags(h),this.validateRegExpPattern(h);var c=null;try{c=new RegExp(n,a)}catch{}return this.finishToken(o.regexp,{pattern:n,flags:a,value:c})},E.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&void 0===e,n=s&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,h=0,c=e??1/0;h<c;++h,++this.pos){var l=this.input.charCodeAt(this.pos),p=void 0;if(i&&95===l)n&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;else{if((p=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=t)break;o=l,a=a*t+p}}return i&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=e&&this.pos-r!==e?null:a},E.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return null==s&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=jt(this.input.slice(e,this.pos)),++this.pos):G(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,s)},E.readNumber=function(t){var e=this.pos;!t&&null===this.readInt(10,void 0,!0)&&this.raise(e,"Invalid number");var s=this.pos-e>=2&&48===this.input.charCodeAt(e);s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&110===i){var n=jt(this.input.slice(e,this.pos));return++this.pos,G(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,n)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=!1),46===i&&!s&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(69===i||101===i)&&!s&&((43===(i=this.input.charCodeAt(++this.pos))||45===i)&&++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),G(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=Li(this.input.slice(e,this.pos),s);return this.finishToken(o.num,r)},E.readCodePoint=function(){var t;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var e=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(e,"Code point out of bounds")}else t=this.readHexChar(4);return t},E.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;92===i?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(!1),s=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(pe(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken(o.string,e)};var qt={};E.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==qt)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},E.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw qt;this.raise(t,e)},E.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==o.template&&this.type!==o.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken(o.template,t)):36===s?(this.pos+=2,this.finishToken(o.dollarBraceL)):(++this.pos,this.finishToken(o.backQuote));if(92===s)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(pe(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},E.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(o.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},E.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return J(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++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"),t){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(i,8);return n>255&&(i=i.slice(0,-1),n=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),("0"!==i||56===e||57===e)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return pe(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},E.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return null===s&&this.invalidStringToken(e,"Bad character escape sequence"),s},E.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(se(n,i))this.pos+=n<=65535?1:2;else{if(92!==n)break;this.containsEsc=!0,t+=this.input.slice(s,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(e?G:se)(a,i)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=J(a),s=this.pos}e=!1}return t+this.input.slice(s,this.pos)},E.readWord=function(){var t=this.readWord1(),e=o.name;return this.keywords.test(t)&&(e=Ke[t]),this.finishToken(e,t)};var Vi="8.15.0";function Me(t,e){return R.parse(t,e)}function Oi(t,e,s){return R.parseExpressionAt(t,e,s)}function Fe(t,e,s,i,n){var r=[];s||(s=g),function t(i,n,a){var o=a||i.type,h=i!==r[r.length-1];h&&r.push(i),s[o](i,n,t),e[o]&&e[o](i,n||r,r),h&&r.pop()}(t,i,n)}function Ye(t,e,s){s(t,e)}function ue(t,e,s){}R.acorn={Parser:R,version:Vi,defaultOptions:He,Position:ve,SourceLocation:Ae,getLineInfo:dt,Node:Ne,TokenType:_,tokTypes:o,keywordTypes:Ke,TokContext:K,tokContexts:I,isIdentifierChar:se,isIdentifierStart:G,Token:Ze,isNewLine:pe,lineBreak:B,lineBreakG:ii,nonASCIIwhitespace:pt};var g={};g.Program=g.BlockStatement=g.StaticBlock=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e,"Statement")}},g.Statement=Ye,g.EmptyStatement=ue,g.ExpressionStatement=g.ParenthesizedExpression=g.ChainExpression=function(t,e,s){return s(t.expression,e,"Expression")},g.IfStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Statement"),t.alternate&&s(t.alternate,e,"Statement")},g.LabeledStatement=function(t,e,s){return s(t.body,e,"Statement")},g.BreakStatement=g.ContinueStatement=ue,g.WithStatement=function(t,e,s){s(t.object,e,"Expression"),s(t.body,e,"Statement")},g.SwitchStatement=function(t,e,s){s(t.discriminant,e,"Expression");for(var i=0,n=t.cases;i<n.length;i+=1){s(n[i],e)}},g.SwitchCase=function(t,e,s){t.test&&s(t.test,e,"Expression");for(var i=0,n=t.consequent;i<n.length;i+=1){s(n[i],e,"Statement")}},g.ReturnStatement=g.YieldExpression=g.AwaitExpression=function(t,e,s){t.argument&&s(t.argument,e,"Expression")},g.ThrowStatement=g.SpreadElement=function(t,e,s){return s(t.argument,e,"Expression")},g.TryStatement=function(t,e,s){s(t.block,e,"Statement"),t.handler&&s(t.handler,e),t.finalizer&&s(t.finalizer,e,"Statement")},g.CatchClause=function(t,e,s){t.param&&s(t.param,e,"Pattern"),s(t.body,e,"Statement")},g.WhileStatement=g.DoWhileStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.body,e,"Statement")},g.ForStatement=function(t,e,s){t.init&&s(t.init,e,"ForInit"),t.test&&s(t.test,e,"Expression"),t.update&&s(t.update,e,"Expression"),s(t.body,e,"Statement")},g.ForInStatement=g.ForOfStatement=function(t,e,s){s(t.left,e,"ForInit"),s(t.right,e,"Expression"),s(t.body,e,"Statement")},g.ForInit=function(t,e,s){"VariableDeclaration"===t.type?s(t,e):s(t,e,"Expression")},g.DebuggerStatement=ue,g.FunctionDeclaration=function(t,e,s){return s(t,e,"Function")},g.VariableDeclaration=function(t,e,s){for(var i=0,n=t.declarations;i<n.length;i+=1){s(n[i],e)}},g.VariableDeclarator=function(t,e,s){s(t.id,e,"Pattern"),t.init&&s(t.init,e,"Expression")},g.Function=function(t,e,s){t.id&&s(t.id,e,"Pattern");for(var i=0,n=t.params;i<n.length;i+=1){s(n[i],e,"Pattern")}s(t.body,e,t.expression?"Expression":"Statement")},g.Pattern=function(t,e,s){"Identifier"===t.type?s(t,e,"VariablePattern"):"MemberExpression"===t.type?s(t,e,"MemberPattern"):s(t,e)},g.VariablePattern=ue,g.MemberPattern=Ye,g.RestElement=function(t,e,s){return s(t.argument,e,"Pattern")},g.ArrayPattern=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Pattern")}},g.ObjectPattern=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];"Property"===r.type?(r.computed&&s(r.key,e,"Expression"),s(r.value,e,"Pattern")):"RestElement"===r.type&&s(r.argument,e,"Pattern")}},g.Expression=Ye,g.ThisExpression=g.Super=g.MetaProperty=ue,g.ArrayExpression=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Expression")}},g.ObjectExpression=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){s(n[i],e)}},g.FunctionExpression=g.ArrowFunctionExpression=g.FunctionDeclaration,g.SequenceExpression=function(t,e,s){for(var i=0,n=t.expressions;i<n.length;i+=1){s(n[i],e,"Expression")}},g.TemplateLiteral=function(t,e,s){for(var i=0,n=t.quasis;i<n.length;i+=1){s(n[i],e)}for(var r=0,a=t.expressions;r<a.length;r+=1){s(a[r],e,"Expression")}},g.TemplateElement=ue,g.UnaryExpression=g.UpdateExpression=function(t,e,s){s(t.argument,e,"Expression")},g.BinaryExpression=g.LogicalExpression=function(t,e,s){s(t.left,e,"Expression"),s(t.right,e,"Expression")},g.AssignmentExpression=g.AssignmentPattern=function(t,e,s){s(t.left,e,"Pattern"),s(t.right,e,"Expression")},g.ConditionalExpression=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Expression"),s(t.alternate,e,"Expression")},g.NewExpression=g.CallExpression=function(t,e,s){if(s(t.callee,e,"Expression"),t.arguments)for(var i=0,n=t.arguments;i<n.length;i+=1){s(n[i],e,"Expression")}},g.MemberExpression=function(t,e,s){s(t.object,e,"Expression"),t.computed&&s(t.property,e,"Expression")},g.ExportNamedDeclaration=g.ExportDefaultDeclaration=function(t,e,s){t.declaration&&s(t.declaration,e,"ExportNamedDeclaration"===t.type||t.declaration.id?"Statement":"Expression"),t.source&&s(t.source,e,"Expression")},g.ExportAllDeclaration=function(t,e,s){t.exported&&s(t.exported,e),s(t.source,e,"Expression")},g.ImportDeclaration=function(t,e,s){for(var i=0,n=t.specifiers;i<n.length;i+=1){s(n[i],e)}s(t.source,e,"Expression")},g.ImportExpression=function(t,e,s){s(t.source,e,"Expression")},g.ImportSpecifier=g.ImportDefaultSpecifier=g.ImportNamespaceSpecifier=g.Identifier=g.PrivateIdentifier=g.Literal=ue,g.TaggedTemplateExpression=function(t,e,s){s(t.tag,e,"Expression"),s(t.quasi,e,"Expression")},g.ClassDeclaration=g.ClassExpression=function(t,e,s){return s(t,e,"Class")},g.Class=function(t,e,s){t.id&&s(t.id,e,"Pattern"),t.superClass&&s(t.superClass,e,"Expression"),s(t.body,e)},g.ClassBody=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e)}},g.MethodDefinition=g.PropertyDefinition=g.Property=function(t,e,s){t.computed&&s(t.key,e,"Expression"),t.value&&s(t.value,e,"Expression")};class H{static pruneCache(t){t.size>this.MAX_CACHE_SIZE&&Array.from(t.keys()).slice(0,t.size-this.MAX_CACHE_SIZE/2).forEach(e=>t.delete(e))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];const e=new Set;try{Fe(Me(t,{ecmaVersion:2020}),{FunctionDeclaration(t,s){s.length<=2&&t.id&&t.id.name&&e.add(t.id.name)},VariableDeclaration(t,s){s.length>2||t.declarations.forEach(t=>{var s,i,n,r,a;"CallExpression"!==(null==(s=t.init)?void 0:s.type)||"pp"!==(null==(n=null==(i=t.init.callee)?void 0:i.object)?void 0:n.name)||"state"!==(null==(a=null==(r=t.init.callee)?void 0:r.property)?void 0:a.name)?("Identifier"===t.id.type&&e.add(t.id.name),"ObjectPattern"===t.id.type&&t.id.properties.forEach(t=>{var s,i;"Property"===t.type&&"Identifier"===(null==(s=t.value)?void 0:s.type)&&e.add(t.value.name),"RestElement"===t.type&&"Identifier"===(null==(i=t.argument)?void 0:i.type)&&e.add(t.argument.name)})):"ArrayPattern"===t.id.type&&t.id.elements.forEach(t=>{"Identifier"===(null==t?void 0:t.type)&&e.add(t.name)})})}})}catch(t){console.error("[PP-ERROR] AstParser Failed",t)}const s=Array.from(e);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,s),s}static extractUsedVariables(t,e){const s=t+"|"+Array.from(e).sort().join(",");if(this.variableCache.has(s))return new Set(this.variableCache.get(s));const i=new Set;try{Fe(Me(`(${t})`,{ecmaVersion:2020}),{Identifier(t,s){if(!e.has(t.name)){if(s.length>1){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return}i.add(t.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(s,i),new Set(i)}static isValidExpression(t){if(!t.trim())return!1;if(this.expressionCache.has(t))return this.expressionCache.get(t);let e=!1;try{Oi(`(${t})`,0,{ecmaVersion:2020}),e=!0}catch{e=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(t,e),e}static analyzeLoopVariableUsage(t,e){const s=t+"|"+e;if(this.loopVariableCache.has(s))return[...this.loopVariableCache.get(s)];const i=[];try{Fe(Me(t,{ecmaVersion:2020}),{Identifier(t,s){if(t.name!==e)return;let n=!1,r=!1,a=t.start,o=t.end;if(s.length>=2){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return;if("Property"===e.type&&e.shorthand&&(n=!0,s.length>=3)){const t=s[s.length-3];"ObjectExpression"===t.type&&1===t.properties.length&&(r=!0,a=t.start,o=t.end)}}i.push({start:a,end:o,isShorthand:n,isUnwrap:r})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(s,i),[...i]}}x(H,"expressionCache",new Map),x(H,"variableCache",new Map),x(H,"bindingsCache",new Map),x(H,"loopVariableCache",new Map),x(H,"MAX_CACHE_SIZE",1e3);const rt=new Set(["class","for","while","if","else","return","function","var","let","const","import","export","this","debugger","delete","typeof","void","new","in","instanceof","do","try","catch","finally","switch","case","default","break","continue","yield","await","with","super","enum","extends","implements","interface","package","private","protected","public","static"]),Mi=new Set(["Array","Object","String","Number","Boolean","Math","JSON","Date","RegExp","Error","Map","Set","WeakMap","WeakSet","Promise","Symbol","BigInt","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","console","window","document","undefined","null","NaN","Infinity","pp","true","false","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","alert","confirm","prompt"]),Wt=new Set(["hidden","disabled","checked","selected","readonly","required","open","autofocus","multiple","ismap","noValidate","defer","async","autoplay","controls","loop","muted","default","reversed","scoped","seamless","sortable","translate","draggable","contenteditable","spellcheck"]);function nt(t){return t.includes("-")?t.replace(/-([a-z])/g,t=>t[1].toUpperCase()):t}const ce=new Map,Fi=500;let De=null;function Y(t){if(!t.includes("&"))return t;if(ce.has(t))return ce.get(t);De||(De=document.createElement("textarea"));const e=De;e.innerHTML=t;let s=e.value,i=0;for(;s.includes("&")&&i++<10;){e.innerHTML=s;const t=e.value;if(t===s)break;s=t}if(ce.size>=Fi){const t=ce.keys().next().value;void 0!==t&&ce.delete(t)}return ce.set(t,s),s}function Di(t,e){if(t===e)return!0;if(!t||!e||"object"!=typeof t||"object"!=typeof e)return!1;const s=Object.keys(t),i=s.length;let n=0;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(n++,n>i))return!1;if(n!==i)return!1;for(let n=0;n<i;n++){const i=s[n];if(t[i]!==e[i])return!1}return!0}class le{static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){const t=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2);let e=0;for(const s of this.cache.keys()){if(e>=t)break;this.cache.delete(s),e++}}}static transformSpreadAttributes(t){const e=new Map;let s=0;const i=document.createElement("template");i.innerHTML=t;const n=t=>{if(t.nodeType===Node.ELEMENT_NODE){const i=t;if(Array.from(i.childNodes).forEach(n),i.hasAttribute("pp-spread")){const t=i.getAttribute("pp-spread")||"";i.removeAttribute("pp-spread");const n=t.match(/^\s*\{\s*\.\.\.(.+?)\s*\}\s*$/);if(n){const t=Y(n[1].trim()),r=`___pp_spread_${s++}___`,a=`\${ (() => {\n const __obj = ${t};\n if (!__obj || typeof __obj !== 'object') return '';\n return Object.entries(__obj)\n .map(([k, v]) => v == null ? '' : k + '="' + String(v).replace(/"/g, '&quot;') + '"')\n .filter(Boolean)\n .join(' ');\n })() }`;e.set(r,a),i.setAttribute(r,"")}}}};Array.from(i.content.childNodes).forEach(n);let r=i.innerHTML;return e.forEach((t,e)=>{r=r.replace(new RegExp(`${e}=""`,"g"),t),r=r.replace(new RegExp(`${e}`,"g"),t)}),{html:r,spreadReplacements:e}}static transformRefAttributes(t){if(!t.includes("pp-ref"))return t;const e=document.createElement("template");e.innerHTML=t;const s=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT);let i=s.nextNode();for(;i;){const t=i;if(t.hasAttribute("pp-ref")){const e=(t.getAttribute("pp-ref")||"").match(/^\s*\{([\s\S]+)\}\s*$/);if(e){const s=Y(e[1].trim());t.removeAttribute("pp-ref"),t.setAttribute("data-pp-ref",`{ __pp_ref(${s}) }`)}}i=s.nextNode()}return e.innerHTML}static transformComponentTags(t){const e=document.createElement("template");e.innerHTML=t;const s=t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const e=t,i=e.tagName.toLowerCase();if(Array.from(e.childNodes).forEach(s),i.includes(".")){const t=document.createDocumentFragment();for(t.appendChild(document.createTextNode(`{${i}}`));e.firstChild;)t.appendChild(e.firstChild);e.replaceWith(t)}};return Array.from(e.content.childNodes).forEach(s),e.innerHTML}static compile(t,e){const s=(t||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),i=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16).padStart(8,"0")},n=e.join("\0"),r=`t${i(s)}|k${i(n)}|n${e.length}`;if(this.cache.has(r))return this.cache.get(r);const{maskedTemplate:a,placeholders:o}=this.maskComplexComponents(s),h=this.transformComponentTags(a),{html:c}=this.transformSpreadAttributes(h),l=this.transformRefAttributes(c),{html:p,loopReplacements:u}=this.processStructuralDirectives(l);let d=this.transformBooleanAttributes(p);(()=>{let t=!0;for(;t;)t=!1,u.forEach((e,s)=>{const i=d;d=d.split("${"+s+"}").join("${"+e+"}"),d=d.split(s).join("{ "+e+" }"),d!==i&&(t=!0)})})();const f=new Set;let m="return `",g=0,v="";for(;g<d.length;){const t=d[g];if("`"!==t){if("o"===t||"O"===t){const t=d.slice(g,g+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(t){const e=d.slice(g,g+t[0].length),s=e[e.length-1];let i=g+t[0].length;for(;i<d.length&&(d[i]!==s||"\\"===d[i-1]);)i++;v+=d.slice(g,i+1),g=i+1;continue}}if("{"===t){const t=this.findClosingBrace(d,g);if(-1!==t){const e=d.slice(g+1,t),s=Y(e);if(H.isValidExpression(s)){m+=v,v="";const e=H.extractUsedVariables(s,Mi);for(const t of e)/^___PP_LOOP_\d+___$/.test(t)||f.add(t);const i=s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");m+=`\${ (() => {\n try {\n const __res = (${s});\n // React pattern: ignore booleans, null, and undefined\n if (typeof __res === 'boolean' || __res == null) return '';\n // React pattern: join arrays without commas\n if (Array.isArray(__res)) return __res.join('');\n return __res;\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${i}\\"", e);\n return '';\n }\n })() }`,g=t+1;continue}e.trim().length>0&&console.warn(`[PP-WARN] Interpolation skipped. Invalid Syntax in: "{${s}}"`)}}v+=t,g++}else v+="\\`",g++}m+=v,m+="`;";const x=Array.from(new Set([...e,...f]));try{const t=new Function(...x,m),e=(...e)=>{let s=t(...e);return o.forEach((t,e)=>{s=s.replace(e,t)}),s};return this.pruneCache(),this.cache.set(r,e),e}catch(t){return console.error("[PP-ERROR] Compilation Failed",t),()=>"Error in Template"}}static transformBooleanAttributes(t){let e="",s=0;for(;s<t.length;){let i=!1;for(const n of Wt){const r=`${n}="{`,a=`${n}='{`;if(t.startsWith(r,s)){i=!0;const a=s+r.length-1,o=this.findClosingBrace(t,a);if(-1!==o&&'"'===t[o+1]){e+=`{ (${Y(t.slice(a+1,o))}) ? '${n}' : '' }`,s=o+2;break}}else if(t.startsWith(a,s)){i=!0;const r=s+a.length-1,o=this.findClosingBrace(t,r);if(-1!==o&&"'"===t[o+1]){e+=`{ (${Y(t.slice(r+1,o))}) ? '${n}' : '' }`,s=o+2;break}}}i||(e+=t[s],s++)}return e}static captureLoopVariablesInEventHandlers(t,e,s,i,n=!1){let r="",a=0;for(;a<t.length;){const o=t.slice(a,a+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(o){const h=o[0].length,c=t.slice(a,a+h),l=c[c.length-1],p=a+h;let u=p;for(;u<t.length&&(t[u]!==l||"\\"===t[u-1]);)u++;const d=c.slice(0,-2).trim();let f=t.slice(p,u);f=this.rewriteLoopEventHandlerCode(f,e,s,i,n),r+=`${d}=${l}${f}${l}`,a=u+1;continue}r+=t[a],a++}return r}static rewriteLoopEventHandlerCode(t,e,s,i,n){const r=t.match(/^\{([\s\S]*)\}$/),a=`__PP_LOOP_IDX_${i}__`;let o=r?r[1]:t;return n&&(o=this.replaceLoopIdentifierUsages(o,i,a)),o=this.replaceLoopIdentifierUsages(o,e,`(${s})[${a}]`),o=o.split(a).join(`\${${i}}`),r?`{${o}}`:o}static replaceLoopIdentifierUsages(t,e,s){const i=H.analyzeLoopVariableUsage(t,e).slice().sort((t,e)=>e.start-t.start);if(0===i.length)return t;let n=t;return i.forEach(t=>{const i=t.isShorthand?this.buildShorthandReplacement(e,s,t.isUnwrap):s;n=n.slice(0,t.start)+i+n.slice(t.end)}),n}static buildShorthandReplacement(t,e,s){return s?`{ ${t}: ${e} }`:`${t}: ${e}`}static processStructuralDirectives(t){if(!t.includes("pp-for"))return{html:t,loopReplacements:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0;const n=t=>{const e=Array.from(t.childNodes);for(const t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;const e=t;if("TEMPLATE"===e.tagName){const t=e;if(n(t.content),t.hasAttribute("pp-for")){const e=t.getAttribute("pp-for")||"",n=e.match(/^\s*\(\s*(.+?)\s*,\s*(.+?)\s*\)\s+in\s+(.+?)\s*$/),r=e.match(/^\s*(.+?)\s+in\s+(.+?)\s*$/);let a,o,h,c=!1;if(n)a=n[1].trim(),o=n[2].trim(),h=n[3].trim(),c=!0;else{if(!r)continue;a=r[1].trim(),h=r[2].trim(),o=`__pp_idx_${i}`}let l=t.innerHTML;l=this.transformComponentTags(l),l=this.transformRefAttributes(l),l=this.captureLoopVariablesInEventHandlers(l,a,h,o,c),l=l.replace(/___PP_LOOP_\d+___/g,t=>"${"+t+"}"),l=l.replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,""),l=this.transformBooleanAttributes(l),l=this.transformInterpolations(l);const p=`(Array.isArray(${h}) ? ${h} : []).map(${`(${a}, ${o})`} => \`${l}\`).join('')`,u=`___PP_LOOP_${i++}___`;s.set(u,p),t.replaceWith(document.createTextNode(u));continue}continue}n(e)}};return n(e.content),{html:e.innerHTML,loopReplacements:s}}static transformInterpolations(t){let e="",s=0;for(;s<t.length;){if("o"===t[s]||"O"===t[s]){const i=t.slice(s,s+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(i){const n=t.slice(s,s+i[0].length),r=n[n.length-1];let a=s+i[0].length;for(;a<t.length&&(t[a]!==r||"\\"===t[a-1]);)a++;e+=t.slice(s,a+1),s=a+1;continue}}if("{"===t[s]){if(s>0&&"$"===t[s-1]){e+="{",s++;continue}const i=this.findClosingBrace(t,s);if(-1!==i){const n=Y(t.slice(s+1,i));if(H.isValidExpression(n)){e+="${"+n+"}",s=i+1;continue}}}e+=t[s],s++}return e}static maskComplexComponents(t){if(!t.includes("pp-component="))return{maskedTemplate:t,placeholders:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0;const n=t=>{if(t instanceof Element&&t.hasAttribute("pp-component")&&t.querySelector('script[type="text/pp"]')){const e=`__PP_CHILD_${i++}__`;return s.set(e,t.outerHTML),void t.replaceWith(document.createTextNode(e))}Array.from(t.children).forEach(t=>n(t))};return n(e.content),{maskedTemplate:e.innerHTML,placeholders:s}}static findClosingBrace(t,e){let s=0,i=null;for(let n=e;n<t.length;n++){const e=t[n];let r=!1;if(n>0&&"\\"===t[n-1]){let e=0,s=n-1;for(;s>=0&&"\\"===t[s];)e++,s--;e%2!=0&&(r=!0)}if(i)e===i&&!r&&(i=null);else if(r||'"'!==e&&"'"!==e&&"`"!==e)if("{"!==e||r){if("}"===e&&!r&&(s--,0===s))return n}else s++;else i=e}return-1}}x(le,"cache",new Map),x(le,"MAX_CACHE_SIZE",200);const at=new Set(["data-state","style"]),Bi=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","effects","total"];function ot(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}const O=class t{constructor(t){var e;x(this,"el"),x(this,"id"),x(this,"rawTemplate"),x(this,"renderFunction"),x(this,"templateFn",null),x(this,"hooksSystem"),x(this,"eventManager"),x(this,"latestScope",{}),x(this,"__ppRefStore",new Map),x(this,"__ppPrevRefStore",null),x(this,"__ppRefSeq",0),x(this,"isRendering",!1),x(this,"props",{}),x(this,"ownedChildren",new Map),x(this,"lastRenderedHtml",""),x(this,"renderCount",0),x(this,"trackedPortals",new Map),x(this,"parentId",null),x(this,"initialChildrenHtml",""),x(this,"pendingEventElements",new Set),x(this,"traversalCache",null),x(this,"_lastScopeKeySig",""),x(this,"_lastSortedKeys",[]),x(this,"_cachedHooksAPI",null),x(this,"_propFnCache",new Map),x(this,"_interpolationFnCache",new Map),x(this,"_scopeEvalFnCache",new Map),x(this,"_refEvalFnCache",new Map),this.el=t,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),this.props=Array.from(this.el.attributes).reduce((t,e)=>{const s=e.name;if(s.startsWith("on")||"pp-component"===s)return t;const i=nt(s);return rt.has(i)||(t[i]=e.value),t},{}),P.registerInstance(this.id,this);const s=null==(e=this.el.parentElement)?void 0:e.closest("[pp-component]");this.parentId=s?s.getAttribute("pp-component"):null,this.props=this.computePropsFromAttributes();let i=P.getTemplate(this.id);const n=P.getOwnedTemplates(this.id);i?n&&(this.ownedChildren=n):(this.extractOwnedTemplates(),i=this.el.innerHTML,P.saveTemplate(this.id,i),P.saveOwnedTemplates(this.id,this.ownedChildren)),this.initialChildrenHtml=i,this.props.children=this.initialChildrenHtml,this.hooksSystem=new Gt(()=>{this.isRendering||this.render()});const r=P.getState(this.id);r&&this.hooksSystem.loadState(r);const a=document.createElement("template");a.innerHTML=this.initialChildrenHtml;const o=this.findOwnScript(a.content),h=(null==o?void 0:o.textContent)||"";o&&o.remove(),this.rawTemplate=a.innerHTML,this.renderFunction=this.createRenderFunction(h),this.eventManager=new Xt(this.el,()=>this.latestScope),this.render()}static setPerfEnabled(t){this.perfEnabled=t}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){const t={};return Bi.forEach(e=>{t[e]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:t}}recordPerfPhase(e,s){if(!t.perfEnabled)return;let i=t.perfStats.get(this.id);i||(i=t.createEmptyPerfEntry(),t.perfStats.set(this.id,i));const n=i.phases[e];n.count++,n.totalMs+=s,n.maxMs=Math.max(n.maxMs,s)}startPerfTimer(){return t.perfEnabled?ot():0}endPerfTimer(e,s){t.perfEnabled&&this.recordPerfPhase(e,ot()-s)}findOwnScript(t){const e=Array.from(t.children);for(const t of e){if("script"===t.tagName.toLowerCase()&&"text/pp"===t.getAttribute("type"))return t;if(t.hasAttribute("pp-component"))continue;const e=this.findOwnScript(t);if(e)return e}return null}interpolateAttrString(t,e){const s=Object.keys(e),i=s.map(t=>e[t]),n=s.join("\0");return t.replace(/\{([\s\S]*?)\}/g,(t,e)=>{const r=Y(String(e).trim());try{const t=this.getCachedFunction(this._interpolationFnCache,r,s,n,300)(...i);return"boolean"==typeof t||null==t?"":Array.isArray(t)?t.join(""):String(t)}catch(t){return console.warn(`[PP-WARN] Failed attribute interpolation for {${r}}`,t),""}})}applyAttributeInterpolations(t,e){const s=Object.keys(e),i=s.map(t=>e[t]),n=s.join("\0");for(const r of Array.from(t.attributes)){const a=r.name;if("pp-component"===a||a.startsWith("on"))continue;const o=r.value;if(!o.includes("{"))continue;if(!/^\s*\{[\s\S]*\}\s*$/.test(o)){const s=this.interpolateAttrString(o,e);s!==o&&t.setAttribute(a,s);continue}const h=o.match(/^\s*\{([\s\S]*)\}\s*$/);if(!h)continue;const c=Y(h[1].trim());if(!H.isValidExpression(c))continue;let l;try{l=this.getCachedFunction(this._scopeEvalFnCache,c,s,n,300)(...i)}catch(t){console.error(`[PP-ERROR] Failed to eval "${c}"`,t);continue}if(Wt.has(a.toLowerCase())){l?t.setAttribute(a,""):t.removeAttribute(a);continue}const p=typeof l;null==l?t.removeAttribute(a):("string"===p||"number"===p||"boolean"===p||"bigint"===p)&&t.setAttribute(a,String(l))}}computePropsFromAttributes(){const t=this.parentId?P.getScope(this.parentId):void 0,e=t?Object.keys(t):[],s=t?e.map(e=>t[e]):[],i=this.el.__ppRawBindings,n=new Set([...Array.from(this.el.attributes).map(t=>t.name),...i?Object.keys(i):[]]),r=e.join("\0"),a=i=>{if(t)try{const t=i+"|"+r;let n=this._propFnCache.get(t);if(!n){if(n=new Function(...e,`"use strict"; return (${i});`),this._propFnCache.size>200){const t=this._propFnCache.keys().next().value;void 0!==t&&this._propFnCache.delete(t)}this._propFnCache.set(t,n)}return n(...s)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${i}}" for component "${this.id}"`,t)}};return Array.from(n).reduce((e,s)=>{if(s.startsWith("on")&&!s.includes("-")||"pp-component"===s)return e;const n=nt(s);if(rt.has(n))return e;const r=this.el.attributes.getNamedItem(s),o=(null==i?void 0:i[s])??(null==r?void 0:r.value);if(void 0===o)return e;if(""===o)return e[n]=!0,e;if(t){const s=o.match(/^\s*\{([\s\S]*)\}\s*$/);if(s){const t=Y(s[1].trim());if(H.isValidExpression(t))return e[n]=a(t),e}if(o.includes("{"))return e[n]=this.interpolateAttrString(o,t),e}return e[n]=o,e},{})}refreshPropsFromParent(){const t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,(!Di(this.props,t)||0!==this.ownedChildren.size)&&(this.props=t,this.isRendering||this.render())}extractOwnedTemplates(){const t=this.el.querySelectorAll("template[pp-owner]");let e=0;t.forEach(t=>{var s;if((null==(s=t.parentElement)?void 0:s.closest("[pp-component]"))!==this.el)return;const i=t.getAttribute("pp-owner");if(i&&i!==this.id){const s=`__PP_OWNED_${this.id}_${e++}__`;this.ownedChildren.set(s,{ownerId:i,content:t.innerHTML});const n=document.createTextNode(s);t.replaceWith(n)}})}maskNestedOwnedTemplates(t){const e=new Map,s=document.createElement("template");s.innerHTML=t;let i=0;const n=s.content.querySelectorAll("[pp-component] > template[pp-owner]");for(const t of Array.from(n)){const s=`__PP_NESTED_TPL_${i++}__`;e.set(s,t.outerHTML),t.replaceWith(document.createTextNode(s))}return{content:s.innerHTML,placeholders:e}}resolveOwnedChildren(t){if(!t.includes("__PP_OWNED_"))return t;this.ownedChildren.forEach((e,s)=>{const i=P.getScope(e.ownerId);if(i){const{content:n,placeholders:r}=this.maskNestedOwnedTemplates(e.content),a=Object.keys(i),o=a.map(t=>i[t]);let h=le.compile(n,a)(...o);for(const[t,e]of r)h=h.replace(t,e);h=this.markOwnedEventHandlers(h,e.ownerId),t=t.replace(s,h)}else t=t.replace(s,e.content)});const e=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;let s;for(;null!==(s=e.exec(t));){const i=s[0],n=s[1],r=P.getOwnedTemplates(n);if(r&&r.has(i)){const s=r.get(i),n=P.getScope(s.ownerId);if(n){const{content:e,placeholders:r}=this.maskNestedOwnedTemplates(s.content),a=Object.keys(n),o=a.map(t=>n[t]);let h=le.compile(e,a)(...o);for(const[t,e]of r)h=h.replace(t,e);h=this.markOwnedEventHandlers(h,s.ownerId),t=t.replace(i,h)}else t=t.replace(i,s.content);e.lastIndex=0}}return t}markOwnedEventHandlers(t,e){const s=document.createElement("template");s.innerHTML=t;const i=document.createTreeWalker(s.content,NodeFilter.SHOW_ELEMENT);let n=i.nextNode();for(;n;){const t=n;Array.from(t.attributes).some(t=>t.name.startsWith("on"))&&t.setAttribute("pp-event-owner",e),n=i.nextNode()}return s.innerHTML}getCachedFunction(t,e,s,i,n){const r=e+"|"+i;let a=t.get(r);if(!a){if(a=new Function(...s,`"use strict"; return (${e});`),t.size>n){const e=t.keys().next().value;void 0!==e&&t.delete(e)}t.set(r,a)}return a}createRenderFunction(t){const e=H.extractStateBindings(t);return new Function("pp",`\n "use strict";\n ${t}\n return { ${e.join(", ")} };\n `)}unmountPreviousRefs(){if(this.__ppPrevRefStore){for(const t of this.__ppPrevRefStore.values())try{"function"==typeof t?t(null):t&&"object"==typeof t&&"current"in t&&(t.current=null)}catch(t){console.warn("[PP-WARN] Ref cleanup failed",t)}this.__ppPrevRefStore=null}}createRefCaptureFunction(){return this.__ppRefStore=new Map,this.__ppRefSeq=0,t=>{const e=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(e,t),e}}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:t=>this.hooksSystem.useState(t),effect:(t,e)=>this.hooksSystem.useEffect(t,e),layoutEffect:(t,e)=>this.hooksSystem.useLayoutEffect(t,e),ref:(t=null)=>this.hooksSystem.useRef(t),memo:(t,e)=>this.hooksSystem.useMemo(t,e),callback:(t,e)=>this.hooksSystem.useCallback(t,e),reducer:(t,e)=>this.hooksSystem.useReducer(t,e),portal:(t,e)=>this.hooksSystem.usePortal(t,e),props:this.props},this._cachedHooksAPI}restorePortaledElements(){for(const[,t]of this.trackedPortals){const{element:e,placeholder:s}=t;s.parentNode&&(s.parentNode.insertBefore(e,s),s.parentNode.removeChild(s))}}applyPortals(){const t=this.hooksSystem.getPortalRegistrations(),e=new Set;let s=!1;for(const i of t){const t=i.ref.current;if(!t)continue;const n=i.target??document.body;e.add(t);const r=this.trackedPortals.get(t);if(null!=r&&r.placeholder.parentNode){r.target!==n&&(n.appendChild(t),r.target=n,s=!0);continue}null===i.info.sourceParent&&t.parentNode instanceof Element&&(i.info.sourceParent=t.parentNode);const a=document.createComment(`pp-portal:${this.id}`);t.parentNode&&t.parentNode.insertBefore(a,t),n.appendChild(t),s=!0,this.trackedPortals.set(t,{element:t,placeholder:a,target:n})}for(const[t,i]of this.trackedPortals)e.has(t)||(i.placeholder.parentNode&&(i.placeholder.parentNode.insertBefore(t,i.placeholder),i.placeholder.remove()),this.trackedPortals.delete(t),s=!0);s&&this.invalidateTraversalCache()}render(){var e;if(this.isRendering)return;this.isRendering=!0,this.renderCount++;const s=this.startPerfTimer();if(t.perfEnabled){let e=t.perfStats.get(this.id);e||(e=t.createEmptyPerfEntry(),t.perfStats.set(this.id,e)),e.renderCount++}try{this.unmountPreviousRefs();const t=this.saveFocusState();this.hooksSystem.prepareRender();const s=this.makeHooksAPI(),i=globalThis.pp,n=(null==(e=null==i?void 0:i.createComponentRuntime)?void 0:e.call(i,s))??s,r=this.startPerfTimer(),a=this.renderFunction(n);this.endPerfTimer("script",r),P.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...this.props,...a},this.latestScope.__pp_ref=this.createRefCaptureFunction(),P.saveScope(this.id,this.latestScope);const o=Object.keys(this.latestScope),h=o.join("\0");let c;h===this._lastScopeKeySig?c=this._lastSortedKeys:(c=o.sort(),this._lastScopeKeySig=h,this._lastSortedKeys=c);const l=c.map(t=>this.latestScope[t]),p=c.join("\0");this.templateFn||(this.templateFn=le.compile(this.rawTemplate,c));let u=this.templateFn(...l);if(u=this.resolveOwnedChildren(u),this.lastRenderedHtml!==u){this.trackedPortals.size>0&&this.restorePortaledElements();const t=this.startPerfTimer();this.applyDomDiff(u),this.endPerfTimer("domDiff",t),this.lastRenderedHtml=u}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){const t=this.pendingEventElements;this.pendingEventElements=new Set;const e=this.startPerfTimer();this.eventManager.bindEvents(t),this.endPerfTimer("bindEvents",e)}const d=this.startPerfTimer();this.bindRefs(c,l,p),this.endPerfTimer("bindRefs",d),this.__ppPrevRefStore=new Map(this.__ppRefStore);const f=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",f);const m=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",m);const g=this.startPerfTimer();this.restoreFocusState(t),this.endPerfTimer("restoreFocus",g);const v=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",v)}catch(t){console.error("[PP-ERROR] Render Cycle Failed",t)}finally{this.endPerfTimer("total",s),this.isRendering=!1}}applyDomDiff(t){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){const e=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"image/svg+xml").documentElement,s=document.createDocumentFragment();return Array.from(e.childNodes).forEach(t=>{s.appendChild(document.importNode(t,!0))}),this.morphChildren(this.el,s),void this.invalidateTraversalCache()}const e=document.createElement("template");e.innerHTML=t;const s=e.content;this.morphChildren(this.el,s),this.invalidateTraversalCache()}isInsideTrackedPortal(t){for(const[e]of this.trackedPortals)if(e===t||e.contains(t))return!0;return!1}morphChildren(t,e){if(this.hasKeyedDirectChildren(t)||this.hasKeyedDirectChildren(e))return void this.morphKeyedChildren(t,e);let s=t.firstChild,i=e.firstChild;for(;s||i;){const e=(null==s?void 0:s.nextSibling)??null,n=(null==i?void 0:i.nextSibling)??null;if(i){if(!s){const e=i.cloneNode(!0);t.appendChild(e),e.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(e),i=n;continue}if(s.nodeType!==i.nodeType){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(s.nodeType!==Node.TEXT_NODE){if(s.nodeType===Node.ELEMENT_NODE){const r=s,a=i;if(r.tagName!==a.tagName){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(r.hasAttribute("pp-component")&&r!==this.el){this.syncAttributes(r,a),this.hasEventAttributes(r)&&this.pendingEventElements.add(r),s=e,i=n;continue}const o=this.isInsideTrackedPortal(r);this.syncAttributes(r,a,o),this.hasEventAttributes(r)&&this.pendingEventElements.add(r),this.morphChildren(r,a)}s=e,i=n}else s.textContent!==i.textContent&&(s.textContent=i.textContent),s=e,i=n}else s&&t.removeChild(s),s=e}}hasKeyedDirectChildren(t){const e=t.childNodes;for(let t=0;t<e.length;t++){const s=e[t];if(s.nodeType===Node.ELEMENT_NODE&&s.hasAttribute("pp-key"))return!0}return!1}getNodeKey(t){if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t.getAttribute("pp-key");return e&&e.length>0?e:null}areNodesCompatible(t,e){if(t.nodeType!==e.nodeType)return!1;if(t.nodeType!==Node.ELEMENT_NODE)return!0;const s=e;if(t.tagName!==s.tagName)return!1;const i=this.getNodeKey(t),n=this.getNodeKey(e);return null===i&&null===n||null!==i&&i===n}morphKeyedChildren(t,e){const s=Array.from(t.childNodes),i=Array.from(e.childNodes),n=this.collectDuplicateKeys(i),r=new Map,a=[];n.length>0&&console.warn(`[PP-WARN] Duplicate pp-key values detected: ${n.join(", ")}`),s.forEach(t=>{const e=this.getNodeKey(t);if(null===e)return void a.push(t);const s=r.get(e);s?s.push(t):r.set(e,[t])});let o=t.firstChild;i.forEach(e=>{const s=this.getNodeKey(e);let i;if(null!==s){const t=r.get(s);for(;t&&t.length>0;){const s=t.shift();if(this.areNodesCompatible(s,e)){i=s;break}a.push(s)}}else{const t=a.findIndex(t=>this.areNodesCompatible(t,e));-1!==t&&(i=a.splice(t,1)[0])}if(i)i!==o&&t.insertBefore(i,o);else{const s=e.cloneNode(!0);t.insertBefore(s,o),s.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(s),i=s}this.morphNode(i,e),o=i.nextSibling}),a.forEach(e=>{e.parentNode===t&&t.removeChild(e)}),r.forEach(e=>{e.forEach(e=>{e.parentNode===t&&t.removeChild(e)})})}collectDuplicateKeys(t){const e=new Set,s=new Set;return t.forEach(t=>{const i=this.getNodeKey(t);if(null!==i){if(e.has(i))return void s.add(i);e.add(i)}}),Array.from(s.values())}morphNode(t,e){if(t.nodeType!==e.nodeType){const s=t.parentNode;if(!s)return;const i=e.cloneNode(!0);return s.replaceChild(i,t),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(t.nodeType===Node.TEXT_NODE)return void(t.textContent!==e.textContent&&(t.textContent=e.textContent));if(t.nodeType!==Node.ELEMENT_NODE)return;const s=t,i=e;if(s.tagName!==i.tagName){const t=s.parentNode;if(!t)return;const i=e.cloneNode(!0);return t.replaceChild(i,s),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(s.hasAttribute("pp-component")&&s!==this.el)return this.syncAttributes(s,i),void(this.hasEventAttributes(s)&&this.pendingEventElements.add(s));const n=this.isInsideTrackedPortal(s);this.syncAttributes(s,i,n),this.hasEventAttributes(s)&&this.pendingEventElements.add(s),this.morphChildren(s,i)}collectEventElements(t){this.hasEventAttributes(t)&&this.pendingEventElements.add(t);for(let e=0;e<t.children.length;e++)this.collectEventElements(t.children[e])}hasEventAttributes(t){const e=t.attributes;for(let t=0;t<e.length;t++)if(e[t].name.startsWith("on")&&!e[t].name.includes("-"))return!0;return!1}walkOwnedBoundaryElements(t){const e=this.getTraversalCache();for(let s=0;s<e.ownedElements.length;s++){const i=e.ownedElements[s];t(i,e.childBoundaryLookup.has(i))}}invalidateTraversalCache(){this.traversalCache=null}getTraversalCache(){if(this.traversalCache)return this.traversalCache;const t=[],e=[],s=new Set,i=[],n=new Set,r=[],a=(t,e)=>{if(e)r.push(t);else for(let e=t.children.length-1;e>=0;e--)r.push(t.children[e])};a(this.el,!1);for(const[t]of this.trackedPortals)a(t,!0);for(;r.length>0;){const a=r.pop();if(n.has(a))continue;n.add(a);const o=a,h=a.hasAttribute("pp-component");if(t.push(o),(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)&&i.push(o),h)e.push(o),s.add(a);else for(let t=a.children.length-1;t>=0;t--)r.push(a.children[t])}return this.traversalCache={ownedElements:t,childBoundaries:e,childBoundaryLookup:s,managedInputs:i},this.traversalCache}collectManagedInputs(){return this.getTraversalCache().managedInputs}syncAttributes(t,e,s=!1){const i=t.attributes;for(let n=i.length-1;n>=0;n--){const r=i[n].name;if(!e.hasAttribute(r)){if(s&&at.has(r))continue;t.removeAttribute(r)}}const n=e.attributes;for(let e=0;e<n.length;e++){const i=n[e];s&&at.has(i.name)||(t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value),"value"===i.name&&(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&t.value!=i.value&&(t.value=i.value))}}bindRefs(t,e,s){const i=this.getTraversalCache();for(let n=0;n<i.ownedElements.length;n++){const r=i.ownedElements[n],a=r,o=r.getAttribute("data-pp-ref");let h=null;if(o?(r.removeAttribute("data-pp-ref"),a.__ppRefCaptureId=o,h=o):a.__ppRefCaptureId&&this.__ppRefStore.has(a.__ppRefCaptureId)?h=a.__ppRefCaptureId:a.__ppRefCaptureId&&delete a.__ppRefCaptureId,h){const t=this.__ppRefStore.get(h);if("function"==typeof t)try{t(r)}catch(t){console.warn(`[PP-WARN] Ref callback threw for id="${h}"`,t)}else t&&"object"==typeof t&&"current"in t?t.current=r:o&&console.warn(`[PP-WARN] Missing captured ref for id="${h}"`)}const c=r.getAttribute("pp-ref");if(!c)continue;r.removeAttribute("pp-ref");const l=this.latestScope[c];if(l&&"object"==typeof l&&"current"in l)l.current=r;else if("function"!=typeof l)try{const i=this.getCachedFunction(this._refEvalFnCache,c,t,s,200)(...e);"function"==typeof i?i(r):i&&"object"==typeof i&&"current"in i&&(i.current=r)}catch(t){console.warn(`[PP-WARN] Could not resolve pp-ref="${c}"`,t)}else try{l(r)}catch(t){console.warn(`[PP-WARN] pp-ref function threw for "${c}"`,t)}}}bootstrapNestedComponents(){this.walkOwnedBoundaryElements((e,s)=>{if(!s)return;if(e.__ppRawBindings){const t=e.__ppRawBindings;for(const[s,i]of Object.entries(t))e.setAttribute(s,i)}else{const t={};for(const s of Array.from(e.attributes))s.value.includes("{")&&"pp-component"!==s.name&&!s.name.startsWith("on")&&(t[s.name]=s.value);e.__ppRawBindings=t}this.applyAttributeInterpolations(e,this.latestScope);const i=e.getAttribute("pp-component")||"",n=P.getInstance(i);if(null!=n&&n.refreshPropsFromParent)return n.el!==e&&(!e.__ppRawBindings&&n.el.__ppRawBindings&&(e.__ppRawBindings=n.el.__ppRawBindings),n.el=e),void n.refreshPropsFromParent();P.getState(i)||new t(e)})}saveFocusState(){const t=document.activeElement;if(!t)return null;const e=this.el.contains(t),s=!e&&Array.from(this.trackedPortals.values()).some(e=>e.element.contains(t));if(!e&&!s)return null;const i=this.collectManagedInputs().indexOf(t);return-1===i?null:{element:t,index:i,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}restoreFocusState(t){if(!t)return;const e=t.element,s=e&&e.isConnected&&(this.el.contains(e)||Array.from(this.trackedPortals.values()).some(t=>t.element.contains(e)))?e:this.collectManagedInputs()[t.index];if(s&&(s.focus(),"function"==typeof s.setSelectionRange))try{s.setSelectionRange(t.selectionStart,t.selectionEnd)}catch(t){console.warn("Could not restore cursor position",t)}}forceUpdate(){this.lastRenderedHtml="",this.render()}destroy(){for(const[,t]of this.trackedPortals)t.element.parentNode&&t.element.remove(),t.placeholder.parentNode&&t.placeholder.remove();this.trackedPortals.clear(),this.hooksSystem.dispose(),this.eventManager.clearCache(),P.removeState(this.id),P.removeScope(this.id),P.removeInstance(this.id)}};x(O,"perfEnabled",!1),x(O,"perfStats",new Map);let ae=O;const ut={bootstrap:()=>{document.querySelectorAll("[pp-component]").forEach(t=>{new ae(t)})}},he=class t{constructor(){x(this,"activeAbortController",null),x(this,"navigationEnabled",!1),x(this,"boundHandleLinkClick",null),x(this,"boundHandlePopState",null),x(this,"isNavigating",!1),x(this,"RESET_SCROLL_ATTR","pp-reset-scroll"),x(this,"mounted",!1)}mount(){this.mounted||(this.mounted=!0,this.disableTransitions(),ut.bootstrap(),this.restoreBodyAccessibility(),this.enableTransitions(),this.enableSPANavigation())}createComponentRuntime(e){const s={};for(const e of t.PUBLIC_METHODS){const t=this[e];"function"==typeof t?s[e]=t.bind(this):void 0!==t&&(s[e]=t)}return Object.assign({},s,e)}enablePerf(){ae.setPerfEnabled(!0)}disablePerf(){ae.setPerfEnabled(!1)}getPerfStats(){return ae.getPerfStats()}resetPerfStats(){ae.resetPerfStats()}getCsrfToken(){const t=document.cookie.match(/(?:^|;\s*)pp_csrf=([^;]*)/);return t?decodeURIComponent(t[1]):""}disableTransitions(){const t=document.createElement("style");t.id="pp-disable-transitions",t.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(t,document.head.firstChild)}enableTransitions(){const t=document.getElementById("pp-disable-transitions");t&&t.remove()}restoreBodyAccessibility(){document.body.style.transition="",document.body.style.opacity="1",document.body.style.pointerEvents="auto",document.body.style.userSelect="auto",document.body.removeAttribute("inert"),document.body.setAttribute("aria-busy","false")}static resetInstance(){this.instance&&(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),this.instance=null)}static getInstance(){return this.instance||(this.instance=new t),this.instance}enableSPANavigation(){this.navigationEnabled||"true"!==document.body.getAttribute("pp-spa")||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState))}disableSPANavigation(){this.navigationEnabled=!1,this.boundHandleLinkClick&&(document.removeEventListener("click",this.boundHandleLinkClick),this.boundHandleLinkClick=null),this.boundHandlePopState&&(window.removeEventListener("popstate",this.boundHandlePopState),this.boundHandlePopState=null)}handleLinkClick(t){if(!this.navigationEnabled)return;const e=t.target.closest("a");if(e&&e.href)try{const s=new URL(e.href),i=s.origin!==window.location.origin,n=s.pathname===window.location.pathname&&s.search===window.location.search,r="false"===e.getAttribute("pp-spa");if(i||"_blank"===e.target||e.hasAttribute("download")||r||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;if(t.preventDefault(),n){const e=s.hash;if(e){t.preventDefault(),history.pushState(null,"",s.pathname+s.search+e);const i=document.querySelector(e);return void(i&&i.scrollIntoView({behavior:"smooth"}))}}this.navigateTo(s.pathname+s.search+s.hash)}catch(t){console.error("Link click navigation error:",t)}}async handlePopState(){const t=window.location.pathname+window.location.search+window.location.hash;await this.navigateTo(t,!1)}async navigateTo(t,e=!0){this.isNavigating=!0;const s=this.saveScrollPositions();try{this.dispatchNavigationEvent("start",t),await this.showLoadingTransition();const i=await this.fetchPageContent(t);if("hardReload"in i)return void(window.location.href=i.hardReload);if("redirect"in i)return void await this.navigateTo(i.redirect,e);const n=i;this.updateBrowserHistory(t,e);const r=document.getElementById("loading-file-1B87E"),a="startViewTransition"in document,o=this.getResetScrollConfig(n);!r&&a?await this.updatePageContentWithViewTransition(n):await this.updatePageContent(n),this.resetGlobalCaches(),ut.bootstrap(),this.handleScrollRestoration(s,o),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",t)}catch(e){this.handleNavigationError(t,e)}finally{this.isNavigating=!1}}resetGlobalCaches(){P.clear(),H.clearCaches(),le.clearCache()}getResetScrollConfig(t){if("true"===t.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};const e=t.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),s=new Set;let i=!1;if(e.length>0)for(const t of Array.from(e))if("true"===t.getAttribute(this.RESET_SCROLL_ATTR)){const e=this.getElementKeyFromElement(t);s.add(e),i=!0}return i||s.size>0?{mode:"none",resetElementKeys:s,resetWindow:i}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(t){return t.id?t.id:t.className?t.className:t.tagName}handleScrollRestoration(t,e){requestAnimationFrame(()=>{if("global"===e.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void document.querySelectorAll("*").forEach(t=>{(t.scrollTop||t.scrollLeft)&&(t.scrollTop=0,t.scrollLeft=0)});if(e.resetWindow)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{const e=t.window;e&&window.scrollTo(e.scrollLeft,e.scrollTop)}document.querySelectorAll("*").forEach(s=>{const i=s.tagName.toLowerCase();if(e.resetWindow&&("html"===i||"body"===i))return;const n=this.getElementKey(s);e.resetElementKeys.has(n)?(s.scrollTop=0,s.scrollLeft=0):t[n]&&(s.scrollTop=t[n].scrollTop,s.scrollLeft=t[n].scrollLeft)})})}saveScrollPositions(){const t={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft)&&(t[this.getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})}),t}getElementKey(t){return t.id||t.className||t.tagName}async updatePageContentWithViewTransition(t){t.title&&(document.title=t.title);const e=t.body.innerHTML;if(this.syncBodyAttributes(t.body),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=e);const s=document.startViewTransition(()=>{document.body.innerHTML=e});try{await s.finished}catch(t){console.warn("View transition failed, continuing anyway:",t)}}dispatchNavigationEvent(t,e,s){const i=`pp:navigation:${t}`,n=s?{url:e,error:s}:{url:e};document.dispatchEvent(new CustomEvent(i,{detail:n}))}async showLoadingTransition(){const t=document.getElementById("loading-file-1B87E");if(t){const e=this.findLoadingElement(t,window.location.pathname);if(e)return void await this.updateContentWithTransition(e)}const e=document.querySelector("[pp-loading-content='true']")||document.body;e&&!("startViewTransition"in document)&&await this.fadeOut(e,250)}async fetchPageContent(t){const e=new URL(t,window.location.origin).hash,s=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}});if(!s.ok)throw new Error(`Navigation failed: ${s.status} ${s.statusText}`);const i=s.headers.get("X-PP-Root-Layout"),n=document.querySelector('meta[name="pp-root-layout"]'),r=n?n.getAttribute("content"):null;if(i&&r&&i!==r)return{hardReload:t};if(s.redirected){const t=new URL(s.url);if(e&&t.searchParams.has("next")){const s=t.searchParams.get("next");s&&!s.includes("#")&&t.searchParams.set("next",s+e)}return{redirect:t.pathname+t.search+t.hash}}const a=this.getRedirectUrlFromResponse(s);if(a)return{redirect:a};const o=await s.text();return(new DOMParser).parseFromString(o,"text/html")}getRedirectUrlFromResponse(t){const e=t.headers.get("X-PP-Redirect");if(e)return e;const s=t.headers.get("Location"),i=t.status;return s&&i>=300&&i<400?s:null}updateBrowserHistory(t,e){e&&history.pushState(null,"",t)}async updatePageContent(t){t.title&&(document.title=t.title);const e=t.body;this.syncBodyAttributes(e),document.body.innerHTML=e.innerHTML}syncBodyAttributes(t){t&&(Array.from(document.body.attributes).forEach(t=>{"style"!==t.name&&document.body.removeAttribute(t.name)}),Array.from(t.attributes).forEach(t=>{"style"!==t.name&&document.body.setAttribute(t.name,t.value)}))}async handleNavigationCompletion(){const t=document.querySelector("[pp-loading-content='true']")||document.body;this.fadeIn(t,150),setTimeout(()=>{this.restoreBodyAccessibility()},50);const e=window.location.hash;e&&requestAnimationFrame(()=>{const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})})}handleNavigationError(t,e){console.error("Navigation error:",e),this.restoreBodyAccessibility(),this.dispatchNavigationEvent("error",t,e),window.location.href=t}findLoadingElement(t,e){let s=e;for(;;){const e=t.querySelector(`div[pp-loading-url='${s}']`);if(e)return e;if("/"===s)break;const i=s.lastIndexOf("/");s=i<=0?"/":s.substring(0,i)}return t.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(t){const e=document.querySelector("[pp-loading-content='true']")||document.body;if(!e)return;const{fadeIn:s,fadeOut:i}=this.parseTransition(t);await this.fadeOut(e,i),e.innerHTML=t.innerHTML,this.fadeIn(e,s)}parseTransition(t){let e=250,s=250;const i=t.querySelector("[pp-loading-transition]"),n=null==i?void 0:i.getAttribute("pp-loading-transition");if(n){let t=JSON.parse(n);t&&"object"==typeof t?(e=this.parseTime(t.fadeIn??e),s=this.parseTime(t.fadeOut??s)):console.warn("pp-loading-transition is not valid JSON → default values (250 ms) will be used. String:",n)}return{fadeIn:e,fadeOut:s}}fadeOut(t,e){return new Promise(s=>{t.style.transition=`opacity ${e}ms ease-out`,setTimeout(()=>{t.style.transition="",s()},e)})}fadeIn(t,e){t.style.transition=`opacity ${e}ms ease-in`,setTimeout(()=>{t.style.transition=""},e)}parseTime(t){if("number"==typeof t)return t;const e=t.match(/^(\d+)(ms|s|m)?$/);if(e){const t=parseInt(e[1],10);switch(e[2]||"ms"){case"ms":default:return t;case"s":return 1e3*t;case"m":return 60*t*1e3}}return 0}async redirect(t){if(t)try{const e=new URL(t,window.location.origin);e.origin!==window.location.origin?window.location.href=t:this.navigationEnabled?await this.navigateTo(e.pathname+e.search+e.hash):window.location.href=t}catch(t){console.error("Redirect error:",t)}}async rpc(t,e={},s=!1){let i=null;const n="boolean"==typeof s?{abortPrevious:s}:s;try{n.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),i=new AbortController,n.abortPrevious&&(this.activeAbortController=i);const s=window.location.pathname.replace(/\/+$/,"")||"/",r={"X-CSRF-Token":this.getCsrfToken(),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":t,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"};let a;if(Object.values(e).some(t=>t instanceof File||t instanceof FileList&&t.length>0)){const t=new FormData;for(const[s,i]of Object.entries(e))i instanceof File?t.append(s,i):i instanceof FileList?Array.from(i).forEach(e=>t.append(s,e)):null!=i&&t.append(s,"object"==typeof i?JSON.stringify(i):String(i));if(n.onUploadProgress)return await this.xhrFunction({url:s,headers:r,body:t,controller:i,options:n});a={method:"POST",headers:r,body:t,signal:i.signal}}else a={method:"POST",headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),signal:i.signal};const o=await fetch(s,a);if(401===o.status)throw new Error("Authentication required");if(403===o.status)throw new Error("Permission denied");if(!o.ok){const t=await o.json().catch(()=>null);throw t||415!==o.status?new Error((null==t?void 0:t.error)||`Request failed: ${o.status} ${o.statusText}`):new Error("Server rejected data format (415).")}const h=this.getRedirectUrlFromResponse(o);return h?(await this.redirect(h),{redirected:!0,to:h}):(this.activeAbortController===i&&(this.activeAbortController=null),(o.headers.get("Content-Type")||"").includes("text/event-stream")&&o.body?(n.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(o.body,n)):await o.json())}catch(t){if(this.activeAbortController===i&&(this.activeAbortController=null),t instanceof Error&&"AbortError"===t.name)return console.log("Request was cancelled"),{cancelled:!0};if(n.onStreamError)return void n.onStreamError(t);throw console.error("RPC error:",t),t}}xhrFunction(t){const{url:e,headers:s,body:i,controller:n,options:r}=t;return new Promise((t,a)=>{const o=new XMLHttpRequest;o.open("POST",e,!0);for(const[t,e]of Object.entries(s))o.setRequestHeader(t,e);const h=()=>{try{o.abort()}catch{}};n.signal.addEventListener("abort",h,{once:!0}),o.upload&&r.onUploadProgress&&(o.upload.onprogress=t=>{var e;const s=t.lengthComputable?t.total:null,i=t.lengthComputable&&t.total>0?Math.min(100,Math.max(0,t.loaded/t.total*100)):null;null==(e=r.onUploadProgress)||e.call(r,{loaded:t.loaded,total:s,percent:i})}),o.onerror=()=>{n.signal.removeEventListener("abort",h),a(new Error("Network error (XHR upload)."))},o.onload=async()=>{var e,s;if(n.signal.removeEventListener("abort",h),401===o.status)return a(new Error("Authentication required"));if(403===o.status)return a(new Error("Permission denied"));if(o.status<200||o.status>=300){let t=`Request failed: ${o.status} ${o.statusText}`;try{const e=JSON.parse(o.responseText||"{}");t=(null==e?void 0:e.error)||(null==e?void 0:e.message)||t}catch{}return a(new Error(t))}const i=o.getResponseHeader("X-PP-Redirect")||(o.status>=300&&o.status<400?o.getResponseHeader("Location"):null);if(i)try{return await this.redirect(i),null==(e=r.onUploadComplete)||e.call(r),t({redirected:!0,to:i})}catch(t){return a(t)}const c=o.responseText??"";let l=c;try{l=JSON.parse(c)}catch{}null==(s=r.onUploadComplete)||s.call(r),t(l)};try{o.send(i)}catch(t){n.signal.removeEventListener("abort",h),a(t)}})}async handleStream(t,e){const s=t.getReader(),i=new TextDecoder;let n="";try{for(;;){const{done:t,value:r}=await s.read();if(t){e.onStreamComplete&&e.onStreamComplete();break}n+=i.decode(r,{stream:!0});const a=n.split("\n");n=a.pop()||"";for(const t of a)if(""!==t.trim()&&t.startsWith("data: ")){const s=t.slice(6);let i=s;try{("true"===s||"false"===s||"null"===s||!isNaN(Number(s))||s.startsWith("{")||s.startsWith("[")||s.startsWith('"'))&&(i=JSON.parse(s))}catch{}e.onStream&&e.onStream(i)}}}catch(t){if(!e.onStreamError)throw t;e.onStreamError(t)}finally{s.releaseLock()}}};x(he,"instance",null),x(he,"PUBLIC_METHODS",["mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"]);let qe=he;const ne=class t{constructor(){x(this,"listeners",[])}static getInstance(){return t.instance||(t.instance=new t),t.instance}get params(){return new URLSearchParams(window.location.search)}get(t){return this.params.get(t)}set(t,e){const s=this.params;s.set(t,e),this.updateURL(s)}delete(t){const e=this.params;e.delete(t),this.updateURL(e)}replace(t){const e=new URLSearchParams;for(const s in t){const i=t[s];null!==i&&e.set(s,i)}this.updateURL(e,!0)}updateURL(t,e=!1){const s=`${window.location.pathname}?${t.toString()}`;e?history.replaceState(null,"",s):history.pushState(null,"",s),this.notifyListeners(t)}listen(t){this.listeners.push(t)}notifyListeners(t){for(const e of this.listeners)e(t)}enablePopStateListener(){window.addEventListener("popstate",()=>{this.notifyListeners(this.params)})}};x(ne,"instance",null);let We=ne;function Kt(t,e,s=window,i=!0){let n=null;if(Object.defineProperty(s,t,{get(){if(null!==n)return n;if(e&&"object"==typeof e&&!Array.isArray(e)&&"getInstance"in e&&"function"==typeof e.getInstance)return n=e.getInstance(),n;if("function"!=typeof e)return n=e,n;try{return n=e.getInstance(),n}catch{return n=e,n}},set(e){null===e?n=null:console.warn(`Cannot override global ${t}`)},configurable:!0,enumerable:!0}),i)try{s[t]}catch(e){console.error(`Failed to initialize ${t}:`,e)}}Kt("pp",{getInstance:()=>{var t;const e=qe.getInstance();return"loading"!==document.readyState?null==(t=e.mount)||t.call(e):document.addEventListener("DOMContentLoaded",()=>{var t;return null==(t=e.mount)?void 0:t.call(e)},{once:!0}),e}}),Kt("searchParams",We);export{ut as ComponentInit,qe as PPUtilities,We as SearchParamsManager};
1
+ var $t=Object.defineProperty,zt=(t,e,s)=>e in t?$t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,x=(t,e,s)=>zt(t,"symbol"!=typeof e?e+"":e,s);class Gt{constructor(t){x(this,"hooks",[]),x(this,"currentIndex",0),x(this,"onStateChange"),x(this,"pendingEffects",[]),x(this,"pendingUpdate",!1),x(this,"hasScheduledRender",!1),x(this,"batchedUpdates",new Set),x(this,"portalRegistrations",[]),x(this,"disposed",!1),this.onStateChange=t}loadState(t){this.hooks=[...t]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.pendingEffects=[],this.portalRegistrations=[])}runEffects(){this.disposed||this.pendingEffects.forEach(t=>t()),this.pendingEffects=[]}dispose(){this.disposed||(this.disposed=!0,this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[],this.hooks.forEach(t=>{if(!t||"object"!=typeof t)return;const e=t.cleanup;if("function"==typeof e)try{e()}finally{t.cleanup=void 0}}),this.hooks=[],this.currentIndex=0)}usePortal(t,e){const s=this.currentIndex++;void 0===this.hooks[s]&&(this.hooks[s]={sourceParent:null});const i=this.hooks[s];return this.portalRegistrations.push({ref:t,target:e??null,info:i}),i}getPortalRegistrations(){return this.portalRegistrations}useState(t){const e=this.currentIndex++;if(void 0===this.hooks[e]){const s=this.hooks,i=e,n=this.batchedUpdates,r=()=>this.scheduleUpdate(),a=t=>{let e=t;"function"==typeof t&&(e=t(s[i].__state)),s[i].__state!==e&&(s[i].__state=e,n.add(i),r())};this.hooks[e]={__state:t,__setter:a}}const s=this.hooks[e];if("object"!=typeof s||null===s||!("__state"in s)){const t=s,i=this.hooks,n=e,r=this.batchedUpdates,a=()=>this.scheduleUpdate(),o=t=>{let e=t;"function"==typeof t&&(e=t(i[n].__state)),i[n].__state!==e&&(i[n].__state=e,r.add(n),a())};this.hooks[e]={__state:t,__setter:o}}return[this.hooks[e].__state,this.hooks[e].__setter]}scheduleUpdate(){this.disposed||(this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,queueMicrotask(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())})))}useRef(t=null){const e=this.currentIndex++;return void 0===this.hooks[e]&&(this.hooks[e]={current:t}),this.hooks[e]}useMemo(t,e){const s=this.currentIndex++,i=this.hooks[s];if(!i||this.areDepsDifferent(i.deps,e)){const i=t();return this.hooks[s]={value:i,deps:e},i}return i.value}useCallback(t,e){const s=this.currentIndex++,i=this.hooks[s];return!i||this.areDepsDifferent(i.deps,e)?(this.hooks[s]={callback:t,deps:e},t):i.callback}useReducer(t,e){const s=this.currentIndex++;if(void 0===this.hooks[s]){const i={state:e,reducer:t,dispatch:null};i.dispatch=t=>{const e=i.reducer(i.state,t);i.state!==e&&(i.state=e,this.scheduleUpdate())},this.hooks[s]=i}const i=this.hooks[s];return[i.state,i.dispatch]}useEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e))&&this.pendingEffects.push(()=>{null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}})}useLayoutEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];if(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e)){null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}}}areDepsDifferent(t,e){return t.length!==e.length||e.some((e,s)=>!Object.is(e,t[s]))}}class P{static saveState(t,e){t&&this.states.set(t,e)}static getState(t){return this.states.get(t)}static removeState(t){this.states.delete(t)}static saveScope(t,e){this.scopes.set(t,e)}static getScope(t){return this.scopes.get(t)}static removeScope(t){this.scopes.delete(t)}static registerInstance(t,e){var s;const i=this.instances.get(t);i&&i!==e&&(null==(s=i.destroy)||s.call(i)),this.instances.set(t,e)}static getInstance(t){return this.instances.get(t)}static removeInstance(t){this.instances.delete(t)}static saveTemplate(t,e){this.templates.has(t)||this.templates.set(t,e)}static getTemplate(t){return this.templates.get(t)}static saveOwnedTemplates(t,e){this.ownedTemplateData.has(t)||this.ownedTemplateData.set(t,e)}static getOwnedTemplates(t){return this.ownedTemplateData.get(t)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.templates.clear(),this.ownedTemplateData.clear()}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size}}}x(P,"states",new Map),x(P,"scopes",new Map),x(P,"instances",new Map),x(P,"templates",new Map),x(P,"ownedTemplateData",new Map);class Xt{constructor(t,e){x(this,"root"),x(this,"getScope"),x(this,"handlerCache",new Map),this.root=t,this.getScope=e}clearCache(){this.handlerCache.clear()}bindEvents(t){(t||this.fallbackCollectEventElements()).forEach(t=>{var e;if(t===this.root)return void this.bindElementEvents(t);let s=t.closest("[pp-component]");t===s&&(s=(null==(e=t.parentElement)?void 0:e.closest("[pp-component]"))??null),s===this.root&&this.bindElementEvents(t)})}bindElementEvents(t){const e=t.getAttribute("pp-event-owner");e&&t.removeAttribute("pp-event-owner");const s=[];Array.from(t.attributes).forEach(i=>{if(i.name.startsWith("on")&&!i.name.includes("-")){const n=i.name.slice(2).toLowerCase();let r=i.value.trim();const a=r.match(/^\{([\s\S]*)\}$/);a&&(r=a[1].trim()),s.push(i.name);const o=`__pp_bound_${n}`;if(t[o]===r)return;t[o]=r;const h=t[`__pp_handler_${n}`];h&&t.removeEventListener(n,h);const c=s=>{var i;if(e){const i=P.getScope(e);if(i)return void this.executeHandlerWithScope(r,s,i,t)}let n=t.closest("[pp-component]");n===t&&(n=(null==(i=t.parentElement)?void 0:i.closest("[pp-component]"))??null);const a=(null==n?void 0:n.getAttribute("pp-component"))||null;if(a){const e=P.getScope(a);if(e)return void this.executeHandlerWithScope(r,s,e,t)}this.executeHandler(r,s,t)};t[`__pp_handler_${n}`]=c,t.addEventListener(n,c)}}),s.forEach(e=>{t.removeAttribute(e)})}fallbackCollectEventElements(){const t=new Set,e=this.root.attributes;for(let s=0;s<e.length;s++)if(e[s].name.startsWith("on")&&!e[s].name.includes("-")){t.add(this.root);break}const s=this.root.querySelectorAll("*");for(let e=0;e<s.length;e++){const i=s[e],n=i.attributes;for(let e=0;e<n.length;e++)if(n[e].name.startsWith("on")&&!n[e].name.includes("-")){t.add(i);break}}return t}executeHandler(t,e,s){this.executeHandlerWithScope(t,e,this.getScope(),s)}executeHandlerWithScope(t,e,s,i){const n=Object.keys(s),r=Object.values(s);try{const s=this.getCompiledHandler(t,n).call(i??e.currentTarget??null,...r,e);"function"==typeof s&&s(e)}catch(e){console.error("[PP-ERROR] Handler failed:",e),console.error("Code:",t)}}getCompiledHandler(t,e){const s=t+"|"+e.join(",");if(!this.handlerCache.has(s)){if(this.handlerCache.size>500){const t=this.handlerCache.keys().next().value;t&&this.handlerCache.delete(t)}const i="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";let n;try{n=new Function(...e,"event",`"use strict";${i} return (${t})`)}catch{n=new Function(...e,"event",`"use strict";${i} ${t}`)}this.handlerCache.set(s,n)}return this.handlerCache.get(s)}}var Qt=[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,80,3,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,343,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,330,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,726,6,110,6,6,9,4759,9,787719,239],ct=[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,71,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,2,60,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,328,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,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,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,496,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,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Zt="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",ht="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Le={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"},Ve="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",Yt={5:Ve,"5module":Ve+" export import",6:Ve+" const class extends export import super"},Jt=/^in(stanceof)?$/,ei=new RegExp("["+ht+"]"),ti=new RegExp("["+ht+Zt+"]");function Be(t,e){for(var s=65536,i=0;i<e.length;i+=2){if((s+=e[i])>t)return!1;if((s+=e[i+1])>=t)return!0}return!1}function G(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&ei.test(String.fromCharCode(t)):!1!==e&&Be(t,ct)))}function se(t,e){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&ti.test(String.fromCharCode(t)):!1!==e&&(Be(t,ct)||Be(t,Qt)))))}var _=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function U(t,e){return new _(t,{beforeExpr:!0,binop:e})}var j={beforeExpr:!0},D={startsExpr:!0},Ke={};function w(t,e){return void 0===e&&(e={}),e.keyword=t,Ke[t]=new _(t,e)}var o={num:new _("num",D),regexp:new _("regexp",D),string:new _("string",D),name:new _("name",D),privateId:new _("privateId",D),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 _(",",j),semi:new _(";",j),colon:new _(":",j),dot:new _("."),question:new _("?",j),questionDot:new _("?."),arrow:new _("=>",j),template:new _("template"),invalidTemplate:new _("invalidTemplate"),ellipsis:new _("...",j),backQuote:new _("`",D),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:U("||",1),logicalAND:U("&&",2),bitwiseOR:U("|",3),bitwiseXOR:U("^",4),bitwiseAND:U("&",5),equality:U("==/!=/===/!==",6),relational:U("</>/<=/>=",7),bitShift:U("<</>>/>>>",8),plusMin:new _("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:U("%",10),star:U("*",10),slash:U("/",10),starstar:new _("**",{beforeExpr:!0}),coalesce:U("??",1),_break:w("break"),_case:w("case",j),_catch:w("catch"),_continue:w("continue"),_debugger:w("debugger"),_default:w("default",j),_do:w("do",{isLoop:!0,beforeExpr:!0}),_else:w("else",j),_finally:w("finally"),_for:w("for",{isLoop:!0}),_function:w("function",D),_if:w("if"),_return:w("return",j),_switch:w("switch"),_throw:w("throw",j),_try:w("try"),_var:w("var"),_const:w("const"),_while:w("while",{isLoop:!0}),_with:w("with"),_new:w("new",{beforeExpr:!0,startsExpr:!0}),_this:w("this",D),_super:w("super",D),_class:w("class",D),_extends:w("extends",j),_export:w("export"),_import:w("import",D),_null:w("null",D),_true:w("true",D),_false:w("false",D),_in:w("in",{beforeExpr:!0,binop:7}),_instanceof:w("instanceof",{beforeExpr:!0,binop:7}),_typeof:w("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:w("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:w("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},B=/\r\n?|\n|\u2028|\u2029/,ii=new RegExp(B.source,"g");function pe(t){return 10===t||13===t||8232===t||8233===t}function lt(t,e,s){void 0===s&&(s=t.length);for(var i=e;i<s;i++){var n=t.charCodeAt(i);if(pe(n))return i<s-1&&13===n&&10===t.charCodeAt(i+1)?i+2:i+1}return-1}var pt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,L=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ft=Object.prototype,si=ft.hasOwnProperty,ri=ft.toString,fe=Object.hasOwn||function(t,e){return si.call(t,e)},Je=Array.isArray||function(t){return"[object Array]"===ri.call(t)},et=Object.create(null);function ie(t){return et[t]||(et[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function J(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}var ni=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ve=function(t,e){this.line=t,this.column=e};ve.prototype.offset=function(t){return new ve(this.line,this.column+t)};var Ae=function(t,e,s){this.start=e,this.end=s,null!==t.sourceFile&&(this.source=t.sourceFile)};function dt(t,e){for(var s=1,i=0;;){var n=lt(t,i,e);if(n<0)return new ve(s,e-i);++s,i=n}}var He={ecmaVersion:null,sourceType:"script",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},tt=!1;function ai(t){var e={};for(var s in He)e[s]=t&&fe(t,s)?t[s]:He[s];if("latest"===e.ecmaVersion?e.ecmaVersion=1e8:null==e.ecmaVersion?(!tt&&"object"==typeof console&&console.warn&&(tt=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),(!t||null==t.allowHashBang)&&(e.allowHashBang=e.ecmaVersion>=14),Je(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return Je(e.onComment)&&(e.onComment=oi(e,e.onComment)),e}function oi(t,e){return function(s,i,n,r,a,o){var h={type:s?"Block":"Line",value:i,start:n,end:r};t.locations&&(h.loc=new Ae(this,a,o)),t.ranges&&(h.range=[n,r]),e.push(h)}}var be=1,de=2,$e=4,mt=8,ze=16,gt=32,Pe=64,xt=128,oe=256,ye=512,Ie=be|de|oe;function Ge(t,e){return de|(t?$e:0)|(e?mt:0)}var Ce=0,Xe=1,te=2,vt=3,bt=4,yt=5,R=function(t,e,s){this.options=t=ai(t),this.sourceFile=t.sourceFile,this.keywords=ie(Yt[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";!0!==t.allowReserved&&(i=Le[t.ecmaVersion>=6?6:5===t.ecmaVersion?5:3],"module"===t.sourceType&&(i+=" await")),this.reservedWords=ie(i);var n=(i?i+" ":"")+Le.strict;this.reservedWordsStrict=ie(n),this.reservedWordsStrictBind=ie(n+" "+Le.strictBind),this.input=String(e),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(B).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.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="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(be),this.regexpState=null,this.privateNameStack=[]},X={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};R.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},X.inFunction.get=function(){return(this.currentVarScope().flags&de)>0},X.inGenerator.get=function(){return(this.currentVarScope().flags&mt)>0},X.inAsync.get=function(){return(this.currentVarScope().flags&$e)>0},X.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(oe|ye))return!1;if(e&de)return(e&$e)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},X.allowSuper.get=function(){return(this.currentThisScope().flags&Pe)>0||this.options.allowSuperOutsideMethod},X.allowDirectSuper.get=function(){return(this.currentThisScope().flags&xt)>0},X.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},X.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(oe|ye)||e&de&&!(e&ze))return!0}return!1},X.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&oe)>0},R.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var s=this,i=0;i<t.length;i++)s=t[i](s);return s},R.parse=function(t,e){return new this(e,t).parse()},R.parseExpressionAt=function(t,e,s){var i=new this(s,t,e);return i.nextToken(),i.parseExpression()},R.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(R.prototype,X);var M=R.prototype,ui=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;M.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){L.lastIndex=t,t+=L.exec(this.input)[0].length;var e=ui.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){L.lastIndex=t+e[0].length;var s=L.exec(this.input),i=s.index+s[0].length,n=this.input.charAt(i);return";"===n||"}"===n||B.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||"!"===n&&"="===this.input.charAt(i+1))}t+=e[0].length,L.lastIndex=t,t+=L.exec(this.input)[0].length,";"===this.input[t]&&t++}},M.eat=function(t){return this.type===t&&(this.next(),!0)},M.isContextual=function(t){return this.type===o.name&&this.value===t&&!this.containsEsc},M.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},M.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},M.canInsertSemicolon=function(){return this.type===o.eof||this.type===o.braceR||B.test(this.input.slice(this.lastTokEnd,this.start))},M.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},M.semicolon=function(){!this.eat(o.semi)&&!this.insertSemicolon()&&this.unexpected()},M.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},M.expect=function(t){this.eat(t)||this.unexpected()},M.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Te=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};M.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,e?"Assigning to rvalue":"Parenthesized pattern")}},M.checkExpressionErrors=function(t,e){if(!t)return!1;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},M.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")},M.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var b=R.prototype;b.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==o.eof;){var s=this.parseStatement(null,!0,e);t.body.push(s)}if(this.inModule)for(var i=0,n=Object.keys(this.undefinedExports);i<n.length;i+=1){var r=n[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var Qe={kind:"loop"},ci={kind:"switch"};b.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;L.lastIndex=this.pos;var e=L.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(91===i||92===i)return!0;if(t)return!1;if(123===i||i>55295&&i<56320)return!0;if(G(i,!0)){for(var n=s+1;se(i=this.input.charCodeAt(n),!0);)++n;if(92===i||i>55295&&i<56320)return!0;var r=this.input.slice(s,n);if(!Jt.test(r))return!0}return!1},b.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;L.lastIndex=this.pos;var t,e=L.exec(this.input),s=this.pos+e[0].length;return!(B.test(this.input.slice(this.pos,s))||"function"!==this.input.slice(s,s+8)||s+8!==this.input.length&&(se(t=this.input.charCodeAt(s+8))||t>55295&&t<56320))},b.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;L.lastIndex=this.pos;var s=L.exec(this.input),i=this.pos+s[0].length;if(B.test(this.input.slice(this.pos,i)))return!1;if(t){var n,r=i+5;if("using"!==this.input.slice(i,r)||r===this.input.length||se(n=this.input.charCodeAt(r))||n>55295&&n<56320)return!1;L.lastIndex=r;var a=L.exec(this.input);if(a&&B.test(this.input.slice(r,r+a[0].length)))return!1}if(e){var o,h=i+2;if(!("of"!==this.input.slice(i,h)||h!==this.input.length&&(se(o=this.input.charCodeAt(h))||o>55295&&o<56320)))return!1}var c=this.input.charCodeAt(i);return G(c,!0)||92===c},b.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)},b.isUsing=function(t){return this.isUsingKeyword(!1,t)},b.parseStatement=function(t,e,s){var i,n=this.type,r=this.startNode();switch(this.isLet(t)&&(n=o._var,i="let"),n){case o._break:case o._continue:return this.parseBreakContinueStatement(r,n.keyword);case o._debugger:return this.parseDebuggerStatement(r);case o._do:return this.parseDoStatement(r);case o._for:return this.parseForStatement(r);case o._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case o._class:return t&&this.unexpected(),this.parseClass(r,!0);case o._if:return this.parseIfStatement(r);case o._return:return this.parseReturnStatement(r);case o._switch:return this.parseSwitchStatement(r);case o._throw:return this.parseThrowStatement(r);case o._try:return this.parseTryStatement(r);case o._const:case o._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(r,i);case o._while:return this.parseWhileStatement(r);case o._with:return this.parseWithStatement(r);case o.braceL:return this.parseBlock(!0,r);case o.semi:return this.parseEmptyStatement(r);case o._export:case o._import:if(this.options.ecmaVersion>10&&n===o._import){L.lastIndex=this.pos;var a=L.exec(this.input),h=this.pos+a[0].length,c=this.input.charCodeAt(h);if(40===c||46===c)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||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===o._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var l=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(l)return e&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===l&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,l),this.semicolon(),this.finishNode(r,"VariableDeclaration");var p=this.value,u=this.parseExpression();return n===o.name&&"Identifier"===u.type&&this.eat(o.colon)?this.parseLabeledStatement(r,p,u,t):this.parseExpressionStatement(r,u)}},b.parseBreakContinueStatement=function(t,e){var s="break"===e;this.next(),this.eat(o.semi)||this.insertSemicolon()?t.label=null:this.type!==o.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var n=this.labels[i];if((null==t.label||n.name===t.label.name)&&(null!=n.kind&&(s||"loop"===n.kind)||t.label&&s))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")},b.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},b.parseDoStatement=function(t){return this.next(),this.labels.push(Qe),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(o._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(o.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},b.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Qe),this.enterScope(0),this.expect(o.parenL),this.type===o.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===o._var||this.type===o._const||s){var i=this.startNode(),n=s?"let":this.value;return this.next(),this.parseVar(i,!0,n),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var r=this.isContextual("let"),a=!1,h=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(h){var c=this.startNode();return this.next(),"await using"===h&&this.next(),this.parseVar(c,!0,h),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var l=this.containsEsc,p=new Te,u=this.start,d=e>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===o._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===o._in&&this.unexpected(e),t.await=!0):a&&this.options.ecmaVersion>=8&&(d.start!==u||l||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(t.await=!1):this.unexpected()),r&&a&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,p),this.checkLValPattern(d),this.parseForIn(t,d)):(this.checkExpressionErrors(p,!0),e>-1&&this.unexpected(e),this.parseFor(t,d))},b.parseForAfterInit=function(t,e,s){return(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===e.declarations.length?(this.options.ecmaVersion>=9&&(this.type===o._in?s>-1&&this.unexpected(s):t.await=s>-1),this.parseForIn(t,e)):(s>-1&&this.unexpected(s),this.parseFor(t,e))},b.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,xe|(s?0:Ue),!1,e)},b.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(o._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},b.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(o.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},b.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(o.braceL),this.labels.push(ci),this.enterScope(0);for(var e,s=!1;this.type!==o.braceR;)if(this.type===o._case||this.type===o._default){var i=this.type===o._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!0,e.test=null),this.expect(o.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},b.parseThrowStatement=function(t){return this.next(),B.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var hi=[];b.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e="Identifier"===t.type;return this.enterScope(e?gt:0),this.checkLValPattern(t,e?bt:te),this.expect(o.parenR),t},b.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===o._catch){var e=this.startNode();this.next(),this.eat(o.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(o._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},b.parseVarStatement=function(t,e,s){return this.next(),this.parseVar(t,!1,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")},b.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(Qe),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},b.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},b.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},b.parseLabeledStatement=function(t,e,s,i){for(var n=0,r=this.labels;n<r.length;n+=1){r[n].name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===o._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var c=this.labels[h];if(c.statementStart!==t.start)break;c.statementStart=this.start,c.kind=a}return this.labels.push({name:e,kind:a,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")},b.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},b.parseBlock=function(t,e,s){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect(o.braceL),t&&this.enterScope(0);this.type!==o.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},b.parseFor=function(t,e){return t.init=e,this.expect(o.semi),t.test=this.type===o.semi?null:this.parseExpression(),this.expect(o.semi),t.update=this.type===o.parenR?null:this.parseExpression(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},b.parseForIn=function(t,e){var s=this.type===o._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)&&this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")},b.parseVar=function(t,e,s,i){for(t.declarations=[],t.kind=s;;){var n=this.startNode();if(this.parseVarId(n,s),this.eat(o.eq)?n.init=this.parseMaybeAssign(e):i||"const"!==s||this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"using"!==s&&"await using"!==s||!(this.options.ecmaVersion>=17)||this.type===o._in||this.isContextual("of")?i||"Identifier"===n.id.type||e&&(this.type===o._in||this.isContextual("of"))?n.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+s+" declaration"):this.unexpected(),t.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(o.comma))break}return t},b.parseVarId=function(t,e){t.id="using"===e||"await using"===e?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,"var"===e?Xe:te,!1)};var xe=1,Ue=2,St=4;function li(t,e){var s=e.key.name,i=t[s],n="true";return"MethodDefinition"===e.type&&("get"===e.kind||"set"===e.kind)&&(n=(e.static?"s":"i")+e.kind),"iget"===i&&"iset"===n||"iset"===i&&"iget"===n||"sget"===i&&"sset"===n||"sset"===i&&"sget"===n?(t[s]="true",!1):!!i||(t[s]=n,!1)}function we(t,e){var s=t.computed,i=t.key;return!s&&("Identifier"===i.type&&i.name===e||"Literal"===i.type&&i.value===e)}b.parseFunction=function(t,e,s,i,n){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===o.star&&e&Ue&&this.unexpected(),t.generator=this.eat(o.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&xe&&(t.id=e&St&&this.type!==o.name?null:this.parseIdent(),t.id&&!(e&Ue)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?Xe:te:vt));var r=this.yieldPos,a=this.awaitPos,h=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ge(t.async,t.generator)),e&xe||(t.id=this.type===o.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,!1,n),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=h,this.finishNode(t,e&xe?"FunctionDeclaration":"FunctionExpression")},b.parseFunctionParams=function(t){this.expect(o.parenL),t.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},b.parseClass=function(t,e){this.next();var s=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),n=this.startNode(),r=!1;for(n.body=[],this.expect(o.braceL);this.type!==o.braceR;){var a=this.parseClassElement(null!==t.superClass);a&&(n.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&"PrivateIdentifier"===a.key.type&&li(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=s,this.next(),t.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},b.parseClassElement=function(t){if(this.eat(o.semi))return null;var e=this.options.ecmaVersion,s=this.startNode(),i="",n=!1,r=!1,a="method",h=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(o.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===o.star?h=!0:i="static"}if(s.static=h,!i&&e>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==o.star||this.canInsertSemicolon()?i="async":r=!0),!i&&(e>=9||!r)&&this.eat(o.star)&&(n=!0),!i&&!r&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:i=c)}if(i?(s.computed=!1,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=i,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),e<13||this.type===o.parenL||"method"!==a||n||r){var l=!s.static&&we(s,"constructor"),p=l&&t;l&&"method"!==a&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=l?"constructor":a,this.parseClassMethod(s,n,r,p)}else this.parseClassField(s);return s},b.isClassElementNameStart=function(){return this.type===o.name||this.type===o.privateId||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword},b.parseClassElementName=function(t){this.type===o.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)},b.parseClassMethod=function(t,e,s,i){var n=t.key;"constructor"===t.kind?(e&&this.raise(n.start,"Constructor can't be a generator"),s&&this.raise(n.start,"Constructor can't be an async method")):t.static&&we(t,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var r=t.value=this.parseMethod(e,s,i);return"get"===t.kind&&0!==r.params.length&&this.raiseRecoverable(r.start,"getter should have no params"),"set"===t.kind&&1!==r.params.length&&this.raiseRecoverable(r.start,"setter should have exactly one param"),"set"===t.kind&&"RestElement"===r.params[0].type&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")},b.parseClassField=function(t){return we(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&we(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(o.eq)?(this.enterScope(ye|Pe),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")},b.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(oe|Pe);this.type!==o.braceR;){var s=this.parseStatement(null);t.body.push(s)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")},b.parseClassId=function(t,e){this.type===o.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,te,!1)):(!0===e&&this.unexpected(),t.id=null)},b.parseClassSuper=function(t){t.superClass=this.eat(o._extends)?this.parseExprSubscripts(null,!1):null},b.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared},b.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,s=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,n=0===i?null:this.privateNameStack[i-1],r=0;r<s.length;++r){var a=s[r];fe(e,a.name)||(n?n.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},b.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")},b.parseExport=function(t,e){if(this.next(),this.eat(o.star))return this.parseExportAllDeclaration(t,e);if(this.eat(o._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var s=0,i=t.specifiers;s<i.length;s+=1){var n=i[s];this.checkUnreserved(n.local),this.checkLocalExport(n.local),"Literal"===n.local.type&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},b.parseExportDeclaration=function(t){return this.parseStatement(null)},b.parseExportDefaultDeclaration=function(){var t;if(this.type===o._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,xe|St,!1,t)}if(this.type===o._class){var s=this.startNode();return this.parseClass(s,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},b.checkExport=function(t,e,s){t&&("string"!=typeof e&&(e="Identifier"===e.type?e.name:e.value),fe(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=!0)},b.checkPatternExport=function(t,e){var s=e.type;if("Identifier"===s)this.checkExport(t,e,e.start);else if("ObjectPattern"===s)for(var i=0,n=e.properties;i<n.length;i+=1){var r=n[i];this.checkPatternExport(t,r)}else if("ArrayPattern"===s)for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(t,h)}else"Property"===s?this.checkPatternExport(t,e.value):"AssignmentPattern"===s?this.checkPatternExport(t,e.left):"RestElement"===s&&this.checkPatternExport(t,e.argument)},b.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var n=i[s];this.checkPatternExport(t,n.id)}},b.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},b.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")},b.parseExportSpecifiers=function(t){var e=[],s=!0;for(this.expect(o.braceL);!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;e.push(this.parseExportSpecifier(t))}return e},b.parseImport=function(t){return this.next(),this.type===o.string?(t.specifiers=hi,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===o.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},b.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,te),this.finishNode(t,"ImportSpecifier")},b.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,te),this.finishNode(t,"ImportDefaultSpecifier")},b.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,te),this.finishNode(t,"ImportNamespaceSpecifier")},b.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===o.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(o.comma)))return t;if(this.type===o.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(o.braceL);!this.eat(o.braceR);){if(e)e=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;t.push(this.parseImportSpecifier())}return t},b.parseWithClause=function(){var t=[];if(!this.eat(o._with))return t;this.expect(o.braceL);for(var e={},s=!0;!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var i=this.parseImportAttribute(),n="Identifier"===i.key.type?i.key.name:i.key.value;fe(e,n)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+n+"'"),e[n]=!0,t.push(i)}return t},b.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(o.colon),this.type!==o.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")},b.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===o.string){var t=this.parseLiteral(this.value);return ni.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)},b.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},b.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var W=R.prototype;W.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,!0);for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.toAssignable(r,e),"RestElement"===r.type&&("ArrayPattern"===r.argument.type||"ObjectPattern"===r.argument.type)&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,!0);return t},W.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var n=t[i];n&&this.toAssignable(n,e)}if(s){var r=t[s-1];6===this.options.ecmaVersion&&e&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return t},W.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},W.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==o.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},W.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case o.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(o.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case o.braceL:return this.parseObj(!0)}return this.parseIdent()},W.parseBindingList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(o.comma),e&&this.type===o.comma)n.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===o.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}n.push(this.parseAssignableListItem(i))}return n},W.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e},W.parseBindingListItem=function(t){return t},W.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(o.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},W.checkLValSimple=function(t,e,s){void 0===e&&(e=Ce);var i=e!==Ce;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===te&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),s&&(fe(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=!0),e!==yt&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,s);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}},W.checkLValPattern=function(t,e,s){switch(void 0===e&&(e=Ce),t.type){case"ObjectPattern":for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,e,s)}break;case"ArrayPattern":for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,e,s)}break;default:this.checkLValSimple(t,e,s)}},W.checkLValInnerPattern=function(t,e,s){switch(void 0===e&&(e=Ce),t.type){case"Property":this.checkLValInnerPattern(t.value,e,s);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,s);break;case"RestElement":this.checkLValPattern(t.argument,e,s);break;default:this.checkLValPattern(t,e,s)}};var K=function(t,e,s,i,n){this.token=t,this.isExpr=!!e,this.preserveSpace=!!s,this.override=i,this.generator=!!n},I={b_stat:new K("{",!1),b_expr:new K("{",!0),b_tmpl:new K("${",!1),p_stat:new K("(",!1),p_expr:new K("(",!0),q_tmpl:new K("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new K("function",!1),f_expr:new K("function",!0),f_expr_gen:new K("function",!0,!1,null,!0),f_gen:new K("function",!1,!1,null,!0)},me=R.prototype;me.initialContext=function(){return[I.b_stat]},me.curContext=function(){return this.context[this.context.length-1]},me.braceIsBlock=function(t){var e=this.curContext();return e===I.f_expr||e===I.f_stat||(t!==o.colon||e!==I.b_stat&&e!==I.b_expr?t===o._return||t===o.name&&this.exprAllowed?B.test(this.input.slice(this.lastTokEnd,this.start)):t===o._else||t===o.semi||t===o.eof||t===o.parenR||t===o.arrow||(t===o.braceL?e===I.b_stat:t!==o._var&&t!==o._const&&t!==o.name&&!this.exprAllowed):!e.isExpr)},me.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if("function"===e.token)return e.generator}return!1},me.updateContext=function(t){var e,s=this.type;s.keyword&&t===o.dot?this.exprAllowed=!1:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr},me.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)},o.parenR.updateContext=o.braceR.updateContext=function(){if(1!==this.context.length){var t=this.context.pop();t===I.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr}else this.exprAllowed=!0},o.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?I.b_stat:I.b_expr),this.exprAllowed=!0},o.dollarBraceL.updateContext=function(){this.context.push(I.b_tmpl),this.exprAllowed=!0},o.parenL.updateContext=function(t){var e=t===o._if||t===o._for||t===o._with||t===o._while;this.context.push(e?I.p_stat:I.p_expr),this.exprAllowed=!0},o.incDec.updateContext=function(){},o._function.updateContext=o._class.updateContext=function(t){!t.beforeExpr||t===o._else||t===o.semi&&this.curContext()!==I.p_stat||t===o._return&&B.test(this.input.slice(this.lastTokEnd,this.start))||(t===o.colon||t===o.braceL)&&this.curContext()===I.b_stat?this.context.push(I.f_stat):this.context.push(I.f_expr),this.exprAllowed=!1},o.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},o.backQuote.updateContext=function(){this.curContext()===I.q_tmpl?this.context.pop():this.context.push(I.q_tmpl),this.exprAllowed=!1},o.star.updateContext=function(t){if(t===o._function){var e=this.context.length-1;this.context[e]===I.f_expr?this.context[e]=I.f_expr_gen:this.context[e]=I.f_gen}this.exprAllowed=!0},o.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==o.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var y=R.prototype;function Et(t){return"Identifier"===t.type||"ParenthesizedExpression"===t.type&&Et(t.expression)}function je(t){return"MemberExpression"===t.type&&"PrivateIdentifier"===t.property.type||"ChainExpression"===t.type&&je(t.expression)||"ParenthesizedExpression"===t.type&&je(t.expression)}y.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,n=t.key;switch(n.type){case"Identifier":i=n.name;break;case"Literal":i=String(n.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===i&&"init"===r&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),e.proto=!0));var a=e[i="$"+i];if(a)("init"===r?this.strict&&a.init||a.get||a.set:a.init||a[r])&&this.raiseRecoverable(n.start,"Redefinition of property");else a=e[i]={init:!1,get:!1,set:!1};a[r]=!0}},y.parseExpression=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeAssign(t,e);if(this.type===o.comma){var r=this.startNodeAt(s,i);for(r.expressions=[n];this.eat(o.comma);)r.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(r,"SequenceExpression")}return n},y.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,n=-1,r=-1,a=-1;e?(n=e.parenthesizedAssign,r=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Te,i=!0);var h=this.start,c=this.startLoc;(this.type===o.parenL||this.type===o.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===t);var l=this.parseMaybeConditional(t,e);if(s&&(l=s.call(this,l,h,c)),this.type.isAssign){var p=this.startNodeAt(h,c);return p.operator=this.value,this.type===o.eq&&(l=this.toAssignable(l,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=l.start&&(e.shorthandAssign=-1),this.type===o.eq?this.checkLValPattern(l):this.checkLValSimple(l),p.left=l,this.next(),p.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(p,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),n>-1&&(e.parenthesizedAssign=n),r>-1&&(e.trailingComma=r),l},y.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return n;if(this.eat(o.question)){var r=this.startNodeAt(s,i);return r.test=n,r.consequent=this.parseMaybeAssign(),this.expect(o.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return n},y.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||n.start===s&&"ArrowFunctionExpression"===n.type?n:this.parseExprOp(n,s,i,-1,t)},y.parseExprOp=function(t,e,s,i,n){var r=this.type.binop;if(null!=r&&(!n||this.type!==o._in)&&r>i){var a=this.type===o.logicalOR||this.type===o.logicalAND,h=this.type===o.coalesce;h&&(r=o.logicalAND.binop);var c=this.value;this.next();var l=this.start,p=this.startLoc,u=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),l,p,r,n),d=this.buildBinary(e,s,t,u,c,a||h);return(a&&this.type===o.coalesce||h&&(this.type===o.logicalOR||this.type===o.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,e,s,i,n)}return t},y.buildBinary=function(t,e,s,i,n,r){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(t,e);return a.left=s,a.operator=n,a.right=i,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},y.parseMaybeUnary=function(t,e,s,i){var n,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(i),e=!0;else if(this.type.prefix){var h=this.startNode(),c=this.type===o.incDec;h.operator=this.value,h.prefix=!0,this.next(),h.argument=this.parseMaybeUnary(null,!0,c,i),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(h.argument):this.strict&&"delete"===h.operator&&Et(h.argument)?this.raiseRecoverable(h.start,"Deleting local variable in strict mode"):"delete"===h.operator&&je(h.argument)?this.raiseRecoverable(h.start,"Private fields can not be deleted"):e=!0,n=this.finishNode(h,c?"UpdateExpression":"UnaryExpression")}else if(e||this.type!==o.privateId){if(n=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,a);l.operator=this.value,l.prefix=!1,l.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(l,"UpdateExpression")}}else(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==o._in&&this.unexpected();return s||!this.eat(o.starstar)?n:e?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,n,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},y.parseExprSubscripts=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprAtom(t,e);if("ArrowFunctionExpression"===n.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return n;var r=this.parseSubscripts(n,s,i,!1,e);return t&&"MemberExpression"===r.type&&(t.parenthesizedAssign>=r.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=r.start&&(t.parenthesizedBind=-1),t.trailingComma>=r.start&&(t.trailingComma=-1)),r},y.parseSubscripts=function(t,e,s,i,n){for(var r=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,a=!1;;){var o=this.parseSubscript(t,e,s,i,r,a,n);if(o.optional&&(a=!0),o===t||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(e,s);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}t=o}},y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(o.arrow)},y.parseSubscriptAsyncArrow=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!0,i)},y.parseSubscript=function(t,e,s,i,n,r,a){var h=this.options.ecmaVersion>=11,c=h&&this.eat(o.questionDot);i&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(o.bracketL);if(l||c&&this.type!==o.parenL&&this.type!==o.backQuote||this.eat(o.dot)){var p=this.startNodeAt(e,s);p.object=t,l?(p.property=this.parseExpression(),this.expect(o.bracketR)):this.type===o.privateId&&"Super"!==t.type?p.property=this.parsePrivateIdent():p.property=this.parseIdent("never"!==this.options.allowReserved),p.computed=!!l,h&&(p.optional=c),t=this.finishNode(p,"MemberExpression")}else if(!i&&this.eat(o.parenL)){var u=new Te,d=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1,u);if(n&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(e,s,g,a);this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var v=this.startNodeAt(e,s);v.callee=t,v.arguments=g,h&&(v.optional=c),t=this.finishNode(v,"CallExpression")}else if(this.type===o.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var x=this.startNodeAt(e,s);x.tag=t,x.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(x,"TaggedTemplateExpression")}return t},y.parseExprAtom=function(t,e,s){this.type===o.slash&&this.readRegexp();var i,n=this.potentialArrowAt===this.start;switch(this.type){case o._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===o.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==o.dot&&this.type!==o.bracketL&&this.type!==o.parenL&&this.unexpected(),this.finishNode(i,"Super");case o._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case o.name:var r=this.start,a=this.startLoc,h=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!h&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(o._function))return this.overrideContext(I.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,e);if(n&&!this.canInsertSemicolon()){if(this.eat(o.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[c],!1,e);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===o.name&&!h&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(o.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,e)}return c;case o.regexp:var l=this.value;return(i=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},i;case o.num:case o.string:return this.parseLiteral(this.value);case o._null:case o._true:case o._false:return(i=this.startNode()).value=this.type===o._null?null:this.type===o._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case o.parenL:var p=this.start,u=this.parseParenAndDistinguishExpression(n,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(t.parenthesizedAssign=p),t.parenthesizedBind<0&&(t.parenthesizedBind=p)),u;case o.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(o.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case o.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,t);case o._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case o._class:return this.parseClass(this.startNode(),!1);case o._new:return this.parseNew();case o.backQuote:return this.parseTemplate();case o._import:return this.options.ecmaVersion>=11?this.parseExprImport(s):this.unexpected();default:return this.parseExprAtomDefault()}},y.parseExprAtomDefault=function(){this.unexpected()},y.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===o.parenL&&!t)return this.parseDynamicImport(e);if(this.type===o.dot){var s=this.startNodeAt(e.start,e.loc&&e.loc.start);return s.name="import",e.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(e)}this.unexpected()},y.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(o.parenR)?t.options=null:(this.expect(o.comma),this.afterTrailingComma(o.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(o.parenR)||(this.expect(o.comma),this.afterTrailingComma(o.parenR)||this.unexpected())));else if(!this.eat(o.parenR)){var e=this.start;this.eat(o.comma)&&this.eat(o.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},y.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},y.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=null!=e.value?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},y.parseParenExpression=function(){this.expect(o.parenL);var t=this.parseExpression();return this.expect(o.parenR),t},y.shouldParseArrow=function(t){return!this.canInsertSemicolon()},y.parseParenAndDistinguishExpression=function(t,e){var s,i=this.start,n=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,h=this.start,c=this.startLoc,l=[],p=!0,u=!1,d=new Te,f=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==o.parenR;){if(p?p=!1:this.expect(o.comma),r&&this.afterTrailingComma(o.parenR,!0)){u=!0;break}if(this.type===o.ellipsis){a=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}l.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(o.parenR),t&&this.shouldParseArrow(l)&&this.eat(o.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=m,this.parseParenArrowList(i,n,l,e);(!l.length||u)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=m||this.awaitPos,l.length>1?((s=this.startNodeAt(h,c)).expressions=l,this.finishNodeAt(s,"SequenceExpression",g,v)):s=l[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var x=this.startNodeAt(i,n);return x.expression=s,this.finishNode(x,"ParenthesizedExpression")}return s},y.parseParenItem=function(t){return t},y.parseParenArrowList=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!1,i)};var pi=[];y.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===o.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var s=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,n=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,n,!0,!1),this.eat(o.parenL)?t.arguments=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1):t.arguments=pi,this.finishNode(t,"NewExpression")},y.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===o.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===o.backQuote,this.finishNode(s,"TemplateElement")},y.parseTemplate=function(t){void 0===t&&(t={});var e=t.isTagged;void 0===e&&(e=!1);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===o.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(o.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(o.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")},y.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===o.name||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===o.star)&&!B.test(this.input.slice(this.lastTokEnd,this.start))},y.parseObj=function(t,e){var s=this.startNode(),i=!0,n={};for(s.properties=[],this.next();!this.eat(o.braceR);){if(i)i=!1;else if(this.expect(o.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(o.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,n,e),s.properties.push(r)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")},y.parseProperty=function(t,e){var s,i,n,r,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(o.ellipsis))return t?(a.argument=this.parseIdent(!1),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,e),this.type===o.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(t||e)&&(n=this.start,r=this.startLoc),t||(s=this.eat(o.star)));var h=this.containsEsc;return this.parsePropertyName(a),!t&&!h&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(a)?(i=!0,s=this.options.ecmaVersion>=9&&this.eat(o.star),this.parsePropertyName(a)):i=!1,this.parsePropertyValue(a,t,s,i,n,r,e,h),this.finishNode(a,"Property")},y.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var s="get"===t.kind?0:1;if(t.value.params.length!==s){var i=t.value.start;"get"===t.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")},y.parsePropertyValue=function(t,e,s,i,n,r,a,h){(s||i)&&this.type===o.colon&&this.unexpected(),this.eat(o.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===o.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(s,i),t.kind="init"):e||h||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type===o.comma||this.type===o.braceR||this.type===o.eq?this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),"await"===t.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=n),e?t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key)):this.type===o.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected():((s||i)&&this.unexpected(),this.parseGetterSetter(t))},y.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(o.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(o.bracketR),t.key;t.computed=!1}return t.key=this.type===o.num||this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},y.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},y.parseMethod=function(t,e,s){var i=this.startNode(),n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ge(e,i.generator)|Pe|(s?xt:0)),this.expect(o.parenL),i.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")},y.parseArrowExpression=function(t,e,s,i){var n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Ge(s,!1)|ze),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(t,"ArrowFunctionExpression")},y.parseFunctionBody=function(t,e,s,i){var n=e&&this.type!==o.braceL,r=this.strict,a=!1;if(n)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var h=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||h)&&((a=this.strictDirective(this.end))&&h&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(t,!r&&!a&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,yt),t.body=this.parseBlock(!1,void 0,a&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()},y.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){if("Identifier"!==s[e].type)return!1}return!0},y.checkParams=function(t,e){for(var s=Object.create(null),i=0,n=t.params;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,Xe,e?null:s)}},y.parseExprList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect(o.comma),e&&this.afterTrailingComma(t))break;var a=void 0;s&&this.type===o.comma?a=null:this.type===o.ellipsis?(a=this.parseSpread(i),i&&this.type===o.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),n.push(a)}return n},y.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Ie)&&"arguments"===i&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===i||"await"===i)&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(e,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(!this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))},y.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),"await"===e.name&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e},y.parseIdentNode=function(){var t=this.startNode();return this.type===o.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,("class"===t.name||"function"===t.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=o.name):this.unexpected(),t},y.parsePrivateIdent=function(){var t=this.startNode();return this.type===o.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t},y.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===o.semi||this.canInsertSemicolon()||this.type!==o.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(o.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")},y.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var _e=R.prototype;_e.raise=function(t,e){var s=dt(this.input,t);e+=" ("+s.line+":"+s.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i},_e.raiseRecoverable=_e.raise,_e.curPosition=function(){if(this.options.locations)return new ve(this.curLine,this.pos-this.lineStart)};var re=R.prototype,fi=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};re.enterScope=function(t){this.scopeStack.push(new fi(t))},re.exitScope=function(){this.scopeStack.pop()},re.treatFunctionsAsVarInScope=function(t){return t.flags&de||!this.inModule&&t.flags&be},re.declareName=function(t,e,s){var i=!1;if(e===te){var n=this.currentScope();i=n.lexical.indexOf(t)>-1||n.functions.indexOf(t)>-1||n.var.indexOf(t)>-1,n.lexical.push(t),this.inModule&&n.flags&be&&delete this.undefinedExports[t]}else if(e===bt){this.currentScope().lexical.push(t)}else if(e===vt){var r=this.currentScope();i=this.treatFunctionsAsVar?r.lexical.indexOf(t)>-1:r.lexical.indexOf(t)>-1||r.var.indexOf(t)>-1,r.functions.push(t)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(t)>-1&&!(o.flags&gt&&o.lexical[0]===t)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(t)>-1){i=!0;break}if(o.var.push(t),this.inModule&&o.flags&be&&delete this.undefinedExports[t],o.flags&Ie)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")},re.checkLocalExport=function(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&(this.undefinedExports[t.name]=t)},re.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},re.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Ie|ye|oe))return e}},re.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Ie|ye|oe)&&!(e.flags&ze))return e}};var Ne=function(t,e,s){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new Ae(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},Se=R.prototype;function Ct(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}Se.startNode=function(){return new Ne(this,this.start,this.startLoc)},Se.startNodeAt=function(t,e){return new Ne(this,t,e)},Se.finishNode=function(t,e){return Ct.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},Se.finishNodeAt=function(t,e,s,i){return Ct.call(this,t,e,s,i)},Se.copyNode=function(t){var e=new Ne(this,t.start,this.startLoc);for(var s in t)e[s]=t[s];return e};var di="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",wt="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",_t=wt+" Extended_Pictographic",kt=_t,At=_t+" EBase EComp EMod EPres ExtPict",Pt=At,mi=At,gi={9:wt,10:_t,11:_t,12:At,13:At,14:mi},xi="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",vi={9:"",10:"",11:"",12:"",13:"",14:xi},it="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",It="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",Tt=It+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Nt=Tt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Rt=Nt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Lt=Rt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",bi=Lt+" "+di,yi={9:It,10:Tt,11:Nt,12:Rt,13:Lt,14:bi},Vt={};function Si(t){var e=Vt[t]={binary:ie(gi[t]+" "+it),binaryOfStrings:ie(vi[t]),nonBinary:{General_Category:ie(it),Script:ie(yi[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var Oe=0,st=[9,10,11,12,13,14];Oe<st.length;Oe+=1){var Ei=st[Oe];Si(Ei)}var v=R.prototype,ke=function(t,e){this.parent=t,this.base=e||this};ke.prototype.separatedFrom=function(t){for(var e=this;e;e=e.parent)for(var s=t;s;s=s.parent)if(e.base===s.base&&e!==s)return!0;return!1},ke.prototype.sibling=function(){return new ke(this.parent,this.base)};var Q=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=Vt[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};function Ci(t){for(var e in t)return!0;return!1}function wi(t){return 105===t||109===t||115===t}function Ot(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function _i(t){return G(t,!0)||36===t||95===t}function ki(t){return se(t,!0)||36===t||95===t||8204===t||8205===t}function Mt(t){return t>=65&&t<=90||t>=97&&t<=122}function Ai(t){return t>=0&&t<=1114111}Q.prototype.reset=function(t,e,s){var i=-1!==s.indexOf("v"),n=-1!==s.indexOf("u");this.start=0|t,this.source=e+"",this.flags=s,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},Q.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Q.prototype.at=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return-1;var n=s.charCodeAt(t);if(!e&&!this.switchU||n<=55295||n>=57344||t+1>=i)return n;var r=s.charCodeAt(t+1);return r>=56320&&r<=57343?(n<<10)+r-56613888:n},Q.prototype.nextIndex=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return i;var n,r=s.charCodeAt(t);return!e&&!this.switchU||r<=55295||r>=57344||t+1>=i||(n=s.charCodeAt(t+1))<56320||n>57343?t+1:t+2},Q.prototype.current=function(t){return void 0===t&&(t=!1),this.at(this.pos,t)},Q.prototype.lookahead=function(t){return void 0===t&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Q.prototype.advance=function(t){void 0===t&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Q.prototype.eat=function(t,e){return void 0===e&&(e=!1),this.current(e)===t&&(this.advance(e),!0)},Q.prototype.eatChars=function(t,e){void 0===e&&(e=!1);for(var s=this.pos,i=0,n=t;i<n.length;i+=1){var r=n[i],a=this.at(s,e);if(-1===a||a!==r)return!1;s=this.nextIndex(s,e)}return this.pos=s,!0},v.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=!1,n=!1,r=0;r<s.length;r++){var a=s.charAt(r);-1===e.indexOf(a)&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(a,r+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),"u"===a&&(i=!0),"v"===a&&(n=!0)}this.options.ecmaVersion>=15&&i&&n&&this.raise(t.start,"Invalid regular expression flag")},v.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Ci(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))},v.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}},v.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new ke(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},v.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},v.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!!(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},v.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=!1;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,!0}return t.pos=e,!1},v.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},v.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},v.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,n=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(n=t.lastIntValue),t.eat(125)))return-1!==n&&n<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return!1},v.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},v.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},v.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(t),i=t.eat(45);if(s||i){for(var n=0;n<s.length;n++){var r=s.charAt(n);s.indexOf(r,n+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(t);!s&&!a&&58===t.current()&&t.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||s.indexOf(h)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1},v.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},v.regexp_eatModifiers=function(t){for(var e="",s=0;-1!==(s=t.current())&&wi(s);)e+=J(s),t.advance();return e},v.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},v.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},v.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!Ot(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;-1!==(s=t.current())&&!Ot(s);)t.advance();return t.pos!==e},v.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(-1===e||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e)&&(t.advance(),!0)},v.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,s=t.groupNames[t.lastStringValue];if(s)if(e)for(var i=0,n=s;i<n.length;i+=1){n[i].separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(s||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}},v.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},v.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=J(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=J(t.lastIntValue);return!0}return!1},v.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),_i(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),ki(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},v.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),!0;if(s<=t.numCapturingParens)return!0;t.pos=e}return!1},v.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},v.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},v.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},v.regexp_eatZero=function(t){return 48===t.current()&&!Re(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},v.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},v.regexp_eatControlLetter=function(t){var e=t.current();return!!Mt(e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){void 0===e&&(e=!1);var s=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var n=t.lastIntValue;if(i&&n>=55296&&n<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=1024*(n-55296)+(a-56320)+65536,!0}t.pos=r,t.lastIntValue=n}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Ai(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=s}return!1},v.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do{t.lastIntValue=10*t.lastIntValue+(e-48),t.advance()}while((e=t.current())>=48&&e<=57);return!0}return!1};var Ft=0,ee=1,q=2;function Pi(t){return 100===t||68===t||115===t||83===t||119===t||87===t}function Dt(t){return Mt(t)||95===t}function Ii(t){return Dt(t)||Re(t)}function Ti(t){return 33===t||t>=35&&t<=38||t>=42&&t<=44||46===t||t>=58&&t<=64||94===t||96===t||126===t}function Ni(t){return 40===t||41===t||45===t||47===t||t>=91&&t<=93||t>=123&&t<=125}function Ri(t){return 33===t||35===t||37===t||38===t||44===t||45===t||t>=58&&t<=62||64===t||96===t||126===t}function Re(t){return t>=48&&t<=57}function Bt(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function Ht(t){return t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:t-48}function Ut(t){return t>=48&&t<=55}v.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Pi(e))return t.lastIntValue=-1,t.advance(),ee;var s=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((s=80===e)||112===e)){var i;if(t.lastIntValue=-1,t.advance(),t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return s&&i===q&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return Ft},v.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),ee}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var n=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,n)}return Ft},v.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){fe(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")},v.regexp_validateUnicodePropertyNameOrValue=function(t,e){return t.unicodeProperties.binary.test(e)?ee:t.switchV&&t.unicodeProperties.binaryOfStrings.test(e)?q:void t.raise("Invalid property name")},v.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Dt(e=t.current());)t.lastStringValue+=J(e),t.advance();return""!==t.lastStringValue},v.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Ii(e=t.current());)t.lastStringValue+=J(e),t.advance();return""!==t.lastStringValue},v.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},v.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),s=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&s===q&&t.raise("Negated character class may contain strings"),!0}return!1},v.regexp_classContents=function(t){return 93===t.current()?ee:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),ee)},v.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;t.switchU&&(-1===e||-1===s)&&t.raise("Invalid character class"),-1!==e&&-1!==s&&e>s&&t.raise("Range out of order in character class")}}},v.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var s=t.current();(99===s||Ut(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return 93!==i&&(t.lastIntValue=i,t.advance(),!0)},v.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},v.regexp_classSetExpression=function(t){var e,s=ee;if(!this.regexp_eatClassSetRange(t))if(e=this.regexp_eatClassSetOperand(t)){e===q&&(s=q);for(var i=t.pos;t.eatChars([38,38]);)38!==t.current()&&(e=this.regexp_eatClassSetOperand(t))?e!==q&&(s=ee):t.raise("Invalid character in character class");if(i!==t.pos)return s;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return s}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(!(e=this.regexp_eatClassSetOperand(t)))return s;e===q&&(s=q)}},v.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var s=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return-1!==s&&-1!==i&&s>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1},v.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?ee:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)},v.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var s=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return s&&i===q&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var n=this.regexp_eatCharacterClassEscape(t);if(n)return n;t.pos=e}return null},v.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var s=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return s}else t.raise("Invalid escape");t.pos=e}return null},v.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===q&&(e=q);return e},v.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return 1===e?ee:q},v.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return!(!this.regexp_eatCharacterEscape(t)&&!this.regexp_eatClassSetReservedPunctuator(t))||(t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1));var s=t.current();return!(s<0||s===t.lookahead()&&Ti(s)||Ni(s))&&(t.advance(),t.lastIntValue=s,!0)},v.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return!!Ri(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!Re(e)&&95!==e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},v.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Re(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e},v.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Bt(s=t.current());)t.lastIntValue=16*t.lastIntValue+Ht(s),t.advance();return t.pos!==e},v.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*s+t.lastIntValue:t.lastIntValue=8*e+s}else t.lastIntValue=e;return!0}return!1},v.regexp_eatOctalDigit=function(t){var e=t.current();return Ut(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},v.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var n=t.current();if(!Bt(n))return t.pos=s,!1;t.lastIntValue=16*t.lastIntValue+Ht(n),t.advance()}return!0};var Ze=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new Ae(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},E=R.prototype;function Li(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function jt(t){return"function"!=typeof BigInt?null:BigInt(t.replace(/_/g,""))}E.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ze(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},E.getToken=function(){return this.next(),new Ze(this)},typeof Symbol<"u"&&(E[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===o.eof,value:e}}}}),E.nextToken=function(){var t=this.curContext();return(!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(o.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},E.readToken=function(t){return G(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},E.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888},E.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i=void 0,n=e;(i=lt(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())},E.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!pe(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())},E.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++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 t}break;default:if(!(t>8&&t<14||t>=5760&&pt.test(String.fromCharCode(t))))break t;++this.pos}}},E.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)},E.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken(o.ellipsis)):(++this.pos,this.finishToken(o.dot))},E.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp(o.assign,2):this.finishOp(o.slash,1)},E.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=42===t?o.star:o.modulo;return this.options.ecmaVersion>=7&&42===t&&42===e&&(++s,i=o.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp(o.assign,s+1):this.finishOp(i,s)},E.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(124===t?o.logicalOR:o.logicalAND,2)}return 61===e?this.finishOp(o.assign,2):this.finishOp(124===t?o.bitwiseOR:o.bitwiseAND,1)},E.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(o.assign,2):this.finishOp(o.bitwiseXOR,1)},E.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!==e||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!B.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(o.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp(o.assign,2):this.finishOp(o.plusMin,1)},E.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp(o.assign,s+1):this.finishOp(o.bitShift,s)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===e&&(s=2),this.finishOp(o.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},E.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(o.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(o.arrow)):this.finishOp(61===t?o.eq:o.prefix,1)},E.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(46===e){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(o.questionDot,2)}if(63===e){if(t>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(o.coalesce,2)}}return this.finishOp(o.question,1)},E.readToken_numberSign=function(){var t=35;if(this.options.ecmaVersion>=13&&(++this.pos,G(t=this.fullCharCodeAtPos(),!0)||92===t))return this.finishToken(o.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+J(t)+"'")},E.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(o.parenL);case 41:return++this.pos,this.finishToken(o.parenR);case 59:return++this.pos,this.finishToken(o.semi);case 44:return++this.pos,this.finishToken(o.comma);case 91:return++this.pos,this.finishToken(o.bracketL);case 93:return++this.pos,this.finishToken(o.bracketR);case 123:return++this.pos,this.finishToken(o.braceL);case 125:return++this.pos,this.finishToken(o.braceR);case 58:return++this.pos,this.finishToken(o.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(o.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)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(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(o.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+J(t)+"'")},E.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)},E.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(B.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++this.pos}var n=this.input.slice(s,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var h=this.regexpState||(this.regexpState=new Q(this));h.reset(s,n,a),this.validateRegExpFlags(h),this.validateRegExpPattern(h);var c=null;try{c=new RegExp(n,a)}catch{}return this.finishToken(o.regexp,{pattern:n,flags:a,value:c})},E.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&void 0===e,n=s&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,h=0,c=e??1/0;h<c;++h,++this.pos){var l=this.input.charCodeAt(this.pos),p=void 0;if(i&&95===l)n&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;else{if((p=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=t)break;o=l,a=a*t+p}}return i&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=e&&this.pos-r!==e?null:a},E.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return null==s&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=jt(this.input.slice(e,this.pos)),++this.pos):G(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,s)},E.readNumber=function(t){var e=this.pos;!t&&null===this.readInt(10,void 0,!0)&&this.raise(e,"Invalid number");var s=this.pos-e>=2&&48===this.input.charCodeAt(e);s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&110===i){var n=jt(this.input.slice(e,this.pos));return++this.pos,G(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,n)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=!1),46===i&&!s&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(69===i||101===i)&&!s&&((43===(i=this.input.charCodeAt(++this.pos))||45===i)&&++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),G(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=Li(this.input.slice(e,this.pos),s);return this.finishToken(o.num,r)},E.readCodePoint=function(){var t;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var e=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(e,"Code point out of bounds")}else t=this.readHexChar(4);return t},E.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;92===i?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(!1),s=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(pe(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken(o.string,e)};var qt={};E.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==qt)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},E.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw qt;this.raise(t,e)},E.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==o.template&&this.type!==o.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken(o.template,t)):36===s?(this.pos+=2,this.finishToken(o.dollarBraceL)):(++this.pos,this.finishToken(o.backQuote));if(92===s)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(pe(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},E.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(o.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},E.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return J(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++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"),t){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(i,8);return n>255&&(i=i.slice(0,-1),n=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),("0"!==i||56===e||57===e)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return pe(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},E.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return null===s&&this.invalidStringToken(e,"Bad character escape sequence"),s},E.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(se(n,i))this.pos+=n<=65535?1:2;else{if(92!==n)break;this.containsEsc=!0,t+=this.input.slice(s,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(e?G:se)(a,i)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=J(a),s=this.pos}e=!1}return t+this.input.slice(s,this.pos)},E.readWord=function(){var t=this.readWord1(),e=o.name;return this.keywords.test(t)&&(e=Ke[t]),this.finishToken(e,t)};var Vi="8.15.0";function Me(t,e){return R.parse(t,e)}function Oi(t,e,s){return R.parseExpressionAt(t,e,s)}function Fe(t,e,s,i,n){var r=[];s||(s=g),function t(i,n,a){var o=a||i.type,h=i!==r[r.length-1];h&&r.push(i),s[o](i,n,t),e[o]&&e[o](i,n||r,r),h&&r.pop()}(t,i,n)}function Ye(t,e,s){s(t,e)}function ue(t,e,s){}R.acorn={Parser:R,version:Vi,defaultOptions:He,Position:ve,SourceLocation:Ae,getLineInfo:dt,Node:Ne,TokenType:_,tokTypes:o,keywordTypes:Ke,TokContext:K,tokContexts:I,isIdentifierChar:se,isIdentifierStart:G,Token:Ze,isNewLine:pe,lineBreak:B,lineBreakG:ii,nonASCIIwhitespace:pt};var g={};g.Program=g.BlockStatement=g.StaticBlock=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e,"Statement")}},g.Statement=Ye,g.EmptyStatement=ue,g.ExpressionStatement=g.ParenthesizedExpression=g.ChainExpression=function(t,e,s){return s(t.expression,e,"Expression")},g.IfStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Statement"),t.alternate&&s(t.alternate,e,"Statement")},g.LabeledStatement=function(t,e,s){return s(t.body,e,"Statement")},g.BreakStatement=g.ContinueStatement=ue,g.WithStatement=function(t,e,s){s(t.object,e,"Expression"),s(t.body,e,"Statement")},g.SwitchStatement=function(t,e,s){s(t.discriminant,e,"Expression");for(var i=0,n=t.cases;i<n.length;i+=1){s(n[i],e)}},g.SwitchCase=function(t,e,s){t.test&&s(t.test,e,"Expression");for(var i=0,n=t.consequent;i<n.length;i+=1){s(n[i],e,"Statement")}},g.ReturnStatement=g.YieldExpression=g.AwaitExpression=function(t,e,s){t.argument&&s(t.argument,e,"Expression")},g.ThrowStatement=g.SpreadElement=function(t,e,s){return s(t.argument,e,"Expression")},g.TryStatement=function(t,e,s){s(t.block,e,"Statement"),t.handler&&s(t.handler,e),t.finalizer&&s(t.finalizer,e,"Statement")},g.CatchClause=function(t,e,s){t.param&&s(t.param,e,"Pattern"),s(t.body,e,"Statement")},g.WhileStatement=g.DoWhileStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.body,e,"Statement")},g.ForStatement=function(t,e,s){t.init&&s(t.init,e,"ForInit"),t.test&&s(t.test,e,"Expression"),t.update&&s(t.update,e,"Expression"),s(t.body,e,"Statement")},g.ForInStatement=g.ForOfStatement=function(t,e,s){s(t.left,e,"ForInit"),s(t.right,e,"Expression"),s(t.body,e,"Statement")},g.ForInit=function(t,e,s){"VariableDeclaration"===t.type?s(t,e):s(t,e,"Expression")},g.DebuggerStatement=ue,g.FunctionDeclaration=function(t,e,s){return s(t,e,"Function")},g.VariableDeclaration=function(t,e,s){for(var i=0,n=t.declarations;i<n.length;i+=1){s(n[i],e)}},g.VariableDeclarator=function(t,e,s){s(t.id,e,"Pattern"),t.init&&s(t.init,e,"Expression")},g.Function=function(t,e,s){t.id&&s(t.id,e,"Pattern");for(var i=0,n=t.params;i<n.length;i+=1){s(n[i],e,"Pattern")}s(t.body,e,t.expression?"Expression":"Statement")},g.Pattern=function(t,e,s){"Identifier"===t.type?s(t,e,"VariablePattern"):"MemberExpression"===t.type?s(t,e,"MemberPattern"):s(t,e)},g.VariablePattern=ue,g.MemberPattern=Ye,g.RestElement=function(t,e,s){return s(t.argument,e,"Pattern")},g.ArrayPattern=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Pattern")}},g.ObjectPattern=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];"Property"===r.type?(r.computed&&s(r.key,e,"Expression"),s(r.value,e,"Pattern")):"RestElement"===r.type&&s(r.argument,e,"Pattern")}},g.Expression=Ye,g.ThisExpression=g.Super=g.MetaProperty=ue,g.ArrayExpression=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Expression")}},g.ObjectExpression=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){s(n[i],e)}},g.FunctionExpression=g.ArrowFunctionExpression=g.FunctionDeclaration,g.SequenceExpression=function(t,e,s){for(var i=0,n=t.expressions;i<n.length;i+=1){s(n[i],e,"Expression")}},g.TemplateLiteral=function(t,e,s){for(var i=0,n=t.quasis;i<n.length;i+=1){s(n[i],e)}for(var r=0,a=t.expressions;r<a.length;r+=1){s(a[r],e,"Expression")}},g.TemplateElement=ue,g.UnaryExpression=g.UpdateExpression=function(t,e,s){s(t.argument,e,"Expression")},g.BinaryExpression=g.LogicalExpression=function(t,e,s){s(t.left,e,"Expression"),s(t.right,e,"Expression")},g.AssignmentExpression=g.AssignmentPattern=function(t,e,s){s(t.left,e,"Pattern"),s(t.right,e,"Expression")},g.ConditionalExpression=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Expression"),s(t.alternate,e,"Expression")},g.NewExpression=g.CallExpression=function(t,e,s){if(s(t.callee,e,"Expression"),t.arguments)for(var i=0,n=t.arguments;i<n.length;i+=1){s(n[i],e,"Expression")}},g.MemberExpression=function(t,e,s){s(t.object,e,"Expression"),t.computed&&s(t.property,e,"Expression")},g.ExportNamedDeclaration=g.ExportDefaultDeclaration=function(t,e,s){t.declaration&&s(t.declaration,e,"ExportNamedDeclaration"===t.type||t.declaration.id?"Statement":"Expression"),t.source&&s(t.source,e,"Expression")},g.ExportAllDeclaration=function(t,e,s){t.exported&&s(t.exported,e),s(t.source,e,"Expression")},g.ImportDeclaration=function(t,e,s){for(var i=0,n=t.specifiers;i<n.length;i+=1){s(n[i],e)}s(t.source,e,"Expression")},g.ImportExpression=function(t,e,s){s(t.source,e,"Expression")},g.ImportSpecifier=g.ImportDefaultSpecifier=g.ImportNamespaceSpecifier=g.Identifier=g.PrivateIdentifier=g.Literal=ue,g.TaggedTemplateExpression=function(t,e,s){s(t.tag,e,"Expression"),s(t.quasi,e,"Expression")},g.ClassDeclaration=g.ClassExpression=function(t,e,s){return s(t,e,"Class")},g.Class=function(t,e,s){t.id&&s(t.id,e,"Pattern"),t.superClass&&s(t.superClass,e,"Expression"),s(t.body,e)},g.ClassBody=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e)}},g.MethodDefinition=g.PropertyDefinition=g.Property=function(t,e,s){t.computed&&s(t.key,e,"Expression"),t.value&&s(t.value,e,"Expression")};class H{static pruneCache(t){t.size>this.MAX_CACHE_SIZE&&Array.from(t.keys()).slice(0,t.size-this.MAX_CACHE_SIZE/2).forEach(e=>t.delete(e))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];const e=new Set;try{Fe(Me(t,{ecmaVersion:2020}),{FunctionDeclaration(t,s){s.length<=2&&t.id&&t.id.name&&e.add(t.id.name)},VariableDeclaration(t,s){s.length>2||t.declarations.forEach(t=>{var s,i,n,r,a;"CallExpression"!==(null==(s=t.init)?void 0:s.type)||"pp"!==(null==(n=null==(i=t.init.callee)?void 0:i.object)?void 0:n.name)||"state"!==(null==(a=null==(r=t.init.callee)?void 0:r.property)?void 0:a.name)?("Identifier"===t.id.type&&e.add(t.id.name),"ObjectPattern"===t.id.type&&t.id.properties.forEach(t=>{var s,i;"Property"===t.type&&"Identifier"===(null==(s=t.value)?void 0:s.type)&&e.add(t.value.name),"RestElement"===t.type&&"Identifier"===(null==(i=t.argument)?void 0:i.type)&&e.add(t.argument.name)})):"ArrayPattern"===t.id.type&&t.id.elements.forEach(t=>{"Identifier"===(null==t?void 0:t.type)&&e.add(t.name)})})}})}catch(t){console.error("[PP-ERROR] AstParser Failed",t)}const s=Array.from(e);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,s),s}static extractUsedVariables(t,e){const s=t+"|"+Array.from(e).sort().join(",");if(this.variableCache.has(s))return new Set(this.variableCache.get(s));const i=new Set;try{Fe(Me(`(${t})`,{ecmaVersion:2020}),{Identifier(t,s){if(!e.has(t.name)){if(s.length>1){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return}i.add(t.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(s,i),new Set(i)}static isValidExpression(t){if(!t.trim())return!1;if(this.expressionCache.has(t))return this.expressionCache.get(t);let e=!1;try{Oi(`(${t})`,0,{ecmaVersion:2020}),e=!0}catch{e=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(t,e),e}static analyzeLoopVariableUsage(t,e){const s=t+"|"+e;if(this.loopVariableCache.has(s))return[...this.loopVariableCache.get(s)];const i=[];try{Fe(Me(t,{ecmaVersion:2020}),{Identifier(t,s){if(t.name!==e)return;let n=!1,r=!1,a=t.start,o=t.end;if(s.length>=2){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return;if("Property"===e.type&&e.shorthand&&(n=!0,s.length>=3)){const t=s[s.length-3];"ObjectExpression"===t.type&&1===t.properties.length&&(r=!0,a=t.start,o=t.end)}}i.push({start:a,end:o,isShorthand:n,isUnwrap:r})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(s,i),[...i]}}x(H,"expressionCache",new Map),x(H,"variableCache",new Map),x(H,"bindingsCache",new Map),x(H,"loopVariableCache",new Map),x(H,"MAX_CACHE_SIZE",1e3);const rt=new Set(["class","for","while","if","else","return","function","var","let","const","import","export","this","debugger","delete","typeof","void","new","in","instanceof","do","try","catch","finally","switch","case","default","break","continue","yield","await","with","super","enum","extends","implements","interface","package","private","protected","public","static"]),Mi=new Set(["Array","Object","String","Number","Boolean","Math","JSON","Date","RegExp","Error","Map","Set","WeakMap","WeakSet","Promise","Symbol","BigInt","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","console","window","document","undefined","null","NaN","Infinity","pp","true","false","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","alert","confirm","prompt"]),Wt=new Set(["hidden","disabled","checked","selected","readonly","required","open","autofocus","multiple","ismap","noValidate","defer","async","autoplay","controls","loop","muted","default","reversed","scoped","seamless","sortable","translate","draggable","contenteditable","spellcheck"]);function nt(t){return t.includes("-")?t.replace(/-([a-z])/g,t=>t[1].toUpperCase()):t}const ce=new Map,Fi=500;let De=null;function Y(t){if(!t.includes("&"))return t;if(ce.has(t))return ce.get(t);De||(De=document.createElement("textarea"));const e=De;e.innerHTML=t;let s=e.value,i=0;for(;s.includes("&")&&i++<10;){e.innerHTML=s;const t=e.value;if(t===s)break;s=t}if(ce.size>=Fi){const t=ce.keys().next().value;void 0!==t&&ce.delete(t)}return ce.set(t,s),s}function Di(t,e){if(t===e)return!0;if(!t||!e||"object"!=typeof t||"object"!=typeof e)return!1;const s=Object.keys(t),i=s.length;let n=0;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(n++,n>i))return!1;if(n!==i)return!1;for(let n=0;n<i;n++){const i=s[n];if(t[i]!==e[i])return!1}return!0}class le{static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){const t=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2);let e=0;for(const s of this.cache.keys()){if(e>=t)break;this.cache.delete(s),e++}}}static transformSpreadAttributes(t){const e=new Map;let s=0;const i=document.createElement("template");i.innerHTML=t;const n=t=>{if(t.nodeType===Node.ELEMENT_NODE){const i=t;if(Array.from(i.childNodes).forEach(n),i.hasAttribute("pp-spread")){const t=i.getAttribute("pp-spread")||"";i.removeAttribute("pp-spread");const n=t.match(/^\s*\{\s*\.\.\.(.+?)\s*\}\s*$/);if(n){const t=Y(n[1].trim()),r=`___pp_spread_${s++}___`,a=`\${ (() => {\n const __obj = ${t};\n if (!__obj || typeof __obj !== 'object') return '';\n return Object.entries(__obj)\n .map(([k, v]) => v == null ? '' : k + '="' + String(v).replace(/"/g, '&quot;') + '"')\n .filter(Boolean)\n .join(' ');\n })() }`;e.set(r,a),i.setAttribute(r,"")}}}};Array.from(i.content.childNodes).forEach(n);let r=i.innerHTML;return e.forEach((t,e)=>{r=r.replace(new RegExp(`${e}=""`,"g"),t),r=r.replace(new RegExp(`${e}`,"g"),t)}),{html:r,spreadReplacements:e}}static transformRefAttributes(t){if(!t.includes("pp-ref"))return t;const e=document.createElement("template");e.innerHTML=t;const s=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT);let i=s.nextNode();for(;i;){const t=i;if(t.hasAttribute("pp-ref")){const e=(t.getAttribute("pp-ref")||"").match(/^\s*\{([\s\S]+)\}\s*$/);if(e){const s=Y(e[1].trim());t.removeAttribute("pp-ref"),t.setAttribute("data-pp-ref",`{ __pp_ref(${s}) }`)}}i=s.nextNode()}return e.innerHTML}static transformComponentTags(t){const e=document.createElement("template");e.innerHTML=t;const s=t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const e=t,i=e.tagName.toLowerCase();if(Array.from(e.childNodes).forEach(s),i.includes(".")){const t=document.createDocumentFragment();for(t.appendChild(document.createTextNode(`{${i}}`));e.firstChild;)t.appendChild(e.firstChild);e.replaceWith(t)}};return Array.from(e.content.childNodes).forEach(s),e.innerHTML}static compile(t,e){const s=(t||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),i=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16).padStart(8,"0")},n=e.join("\0"),r=`t${i(s)}|k${i(n)}|n${e.length}`;if(this.cache.has(r))return this.cache.get(r);const{maskedTemplate:a,placeholders:o}=this.maskComplexComponents(s),h=this.transformComponentTags(a),{html:c}=this.transformSpreadAttributes(h),l=this.transformRefAttributes(c),{html:p,loopReplacements:u}=this.processStructuralDirectives(l);let d=this.transformBooleanAttributes(p);(()=>{let t=!0;for(;t;)t=!1,u.forEach((e,s)=>{const i=d;d=d.split("${"+s+"}").join("${"+e+"}"),d=d.split(s).join("{ "+e+" }"),d!==i&&(t=!0)})})();const f=new Set;let m="return `",g=0,v="";for(;g<d.length;){const t=d[g];if("`"!==t){if("o"===t||"O"===t){const t=d.slice(g,g+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(t){const e=d.slice(g,g+t[0].length),s=e[e.length-1];let i=g+t[0].length;for(;i<d.length&&(d[i]!==s||"\\"===d[i-1]);)i++;v+=d.slice(g,i+1),g=i+1;continue}}if("{"===t){const t=this.findClosingBrace(d,g);if(-1!==t){const e=d.slice(g+1,t),s=Y(e);if(H.isValidExpression(s)){m+=v,v="";const e=H.extractUsedVariables(s,Mi);for(const t of e)/^___PP_LOOP_\d+___$/.test(t)||f.add(t);const i=s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");m+=`\${ (() => {\n try {\n const __res = (${s});\n // React pattern: ignore booleans, null, and undefined\n if (typeof __res === 'boolean' || __res == null) return '';\n // React pattern: join arrays without commas\n if (Array.isArray(__res)) return __res.join('');\n return __res;\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${i}\\"", e);\n return '';\n }\n })() }`,g=t+1;continue}e.trim().length>0&&console.warn(`[PP-WARN] Interpolation skipped. Invalid Syntax in: "{${s}}"`)}}v+=t,g++}else v+="\\`",g++}m+=v,m+="`;";const x=Array.from(new Set([...e,...f]));try{const t=new Function(...x,m),e=(...e)=>{let s=t(...e);return o.forEach((t,e)=>{s=s.replace(e,t)}),s};return this.pruneCache(),this.cache.set(r,e),e}catch(t){return console.error("[PP-ERROR] Compilation Failed",t),()=>"Error in Template"}}static transformBooleanAttributes(t){let e="",s=0;for(;s<t.length;){let i=!1;for(const n of Wt){const r=`${n}="{`,a=`${n}='{`;if(t.startsWith(r,s)){i=!0;const a=s+r.length-1,o=this.findClosingBrace(t,a);if(-1!==o&&'"'===t[o+1]){e+=`{ (${Y(t.slice(a+1,o))}) ? '${n}' : '' }`,s=o+2;break}}else if(t.startsWith(a,s)){i=!0;const r=s+a.length-1,o=this.findClosingBrace(t,r);if(-1!==o&&"'"===t[o+1]){e+=`{ (${Y(t.slice(r+1,o))}) ? '${n}' : '' }`,s=o+2;break}}}i||(e+=t[s],s++)}return e}static captureLoopVariablesInEventHandlers(t,e,s,i,n=!1){let r="",a=0;for(;a<t.length;){const o=t.slice(a,a+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(o){const h=o[0].length,c=t.slice(a,a+h),l=c[c.length-1],p=a+h;let u=p;for(;u<t.length&&(t[u]!==l||"\\"===t[u-1]);)u++;const d=c.slice(0,-2).trim();let f=t.slice(p,u);f=this.rewriteLoopEventHandlerCode(f,e,s,i,n),r+=`${d}=${l}${f}${l}`,a=u+1;continue}r+=t[a],a++}return r}static rewriteLoopEventHandlerCode(t,e,s,i,n){const r=t.match(/^\{([\s\S]*)\}$/),a=`__PP_LOOP_IDX_${i}__`;let o=r?r[1]:t;return n&&(o=this.replaceLoopIdentifierUsages(o,i,a)),o=this.replaceLoopIdentifierUsages(o,e,`(${s})[${a}]`),o=o.split(a).join(`\${${i}}`),r?`{${o}}`:o}static replaceLoopIdentifierUsages(t,e,s){const i=H.analyzeLoopVariableUsage(t,e).slice().sort((t,e)=>e.start-t.start);if(0===i.length)return t;let n=t;return i.forEach(t=>{const i=t.isShorthand?this.buildShorthandReplacement(e,s,t.isUnwrap):s;n=n.slice(0,t.start)+i+n.slice(t.end)}),n}static buildShorthandReplacement(t,e,s){return s?`{ ${t}: ${e} }`:`${t}: ${e}`}static processStructuralDirectives(t){if(!t.includes("pp-for"))return{html:t,loopReplacements:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0;const n=t=>{const e=Array.from(t.childNodes);for(const t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;const e=t;if("TEMPLATE"===e.tagName){const t=e;if(n(t.content),t.hasAttribute("pp-for")){const e=t.getAttribute("pp-for")||"",n=e.match(/^\s*\(\s*(.+?)\s*,\s*(.+?)\s*\)\s+in\s+(.+?)\s*$/),r=e.match(/^\s*(.+?)\s+in\s+(.+?)\s*$/);let a,o,h,c=!1;if(n)a=n[1].trim(),o=n[2].trim(),h=n[3].trim(),c=!0;else{if(!r)continue;a=r[1].trim(),h=r[2].trim(),o=`__pp_idx_${i}`}let l=t.innerHTML;l=this.transformComponentTags(l),l=this.transformRefAttributes(l),l=this.captureLoopVariablesInEventHandlers(l,a,h,o,c),l=l.replace(/___PP_LOOP_\d+___/g,t=>"${"+t+"}"),l=l.replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,""),l=this.transformBooleanAttributes(l),l=this.transformInterpolations(l);const p=`(Array.isArray(${h}) ? ${h} : []).map(${`(${a}, ${o})`} => \`${l}\`).join('')`,u=`___PP_LOOP_${i++}___`;s.set(u,p),t.replaceWith(document.createTextNode(u));continue}continue}n(e)}};return n(e.content),{html:e.innerHTML,loopReplacements:s}}static transformInterpolations(t){let e="",s=0;for(;s<t.length;){if("o"===t[s]||"O"===t[s]){const i=t.slice(s,s+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(i){const n=t.slice(s,s+i[0].length),r=n[n.length-1];let a=s+i[0].length;for(;a<t.length&&(t[a]!==r||"\\"===t[a-1]);)a++;e+=t.slice(s,a+1),s=a+1;continue}}if("{"===t[s]){if(s>0&&"$"===t[s-1]){e+="{",s++;continue}const i=this.findClosingBrace(t,s);if(-1!==i){const n=Y(t.slice(s+1,i));if(H.isValidExpression(n)){e+="${"+n+"}",s=i+1;continue}}}e+=t[s],s++}return e}static maskComplexComponents(t){if(!t.includes("pp-component="))return{maskedTemplate:t,placeholders:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0;const n=t=>{if(t instanceof Element&&t.hasAttribute("pp-component")&&t.querySelector('script[type="text/pp"]')){const e=`__PP_CHILD_${i++}__`;return s.set(e,t.outerHTML),void t.replaceWith(document.createTextNode(e))}Array.from(t.children).forEach(t=>n(t))};return n(e.content),{maskedTemplate:e.innerHTML,placeholders:s}}static findClosingBrace(t,e){let s=0,i=null;for(let n=e;n<t.length;n++){const e=t[n];let r=!1;if(n>0&&"\\"===t[n-1]){let e=0,s=n-1;for(;s>=0&&"\\"===t[s];)e++,s--;e%2!=0&&(r=!0)}if(i)e===i&&!r&&(i=null);else if(r||'"'!==e&&"'"!==e&&"`"!==e)if("{"!==e||r){if("}"===e&&!r&&(s--,0===s))return n}else s++;else i=e}return-1}}x(le,"cache",new Map),x(le,"MAX_CACHE_SIZE",200);const at=new Set(["data-state","style"]),Bi=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","effects","total"];function ot(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}const O=class t{constructor(t){var e;x(this,"el"),x(this,"id"),x(this,"rawTemplate"),x(this,"renderFunction"),x(this,"templateFn",null),x(this,"hooksSystem"),x(this,"eventManager"),x(this,"latestScope",{}),x(this,"__ppRefStore",new Map),x(this,"__ppPrevRefStore",null),x(this,"__ppRefSeq",0),x(this,"isRendering",!1),x(this,"props",{}),x(this,"ownedChildren",new Map),x(this,"lastRenderedHtml",""),x(this,"renderCount",0),x(this,"trackedPortals",new Map),x(this,"parentId",null),x(this,"initialChildrenHtml",""),x(this,"pendingEventElements",new Set),x(this,"traversalCache",null),x(this,"_lastScopeKeySig",""),x(this,"_lastSortedKeys",[]),x(this,"_cachedHooksAPI",null),x(this,"_propFnCache",new Map),x(this,"_interpolationFnCache",new Map),x(this,"_scopeEvalFnCache",new Map),x(this,"_refEvalFnCache",new Map),this.el=t,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),this.props=Array.from(this.el.attributes).reduce((t,e)=>{const s=e.name;if(s.startsWith("on")||"pp-component"===s)return t;const i=nt(s);return rt.has(i)||(t[i]=e.value),t},{}),P.registerInstance(this.id,this);const s=null==(e=this.el.parentElement)?void 0:e.closest("[pp-component]");this.parentId=s?s.getAttribute("pp-component"):null,this.props=this.computePropsFromAttributes();let i=P.getTemplate(this.id);const n=P.getOwnedTemplates(this.id);i?n&&(this.ownedChildren=n):(this.extractOwnedTemplates(),i=this.el.innerHTML,P.saveTemplate(this.id,i),P.saveOwnedTemplates(this.id,this.ownedChildren)),this.initialChildrenHtml=i,this.props.children=this.initialChildrenHtml,this.hooksSystem=new Gt(()=>{this.isRendering||this.render()});const r=P.getState(this.id);r&&this.hooksSystem.loadState(r);const a=document.createElement("template");a.innerHTML=this.initialChildrenHtml;const o=this.findOwnScript(a.content),h=(null==o?void 0:o.textContent)||"";o&&o.remove(),this.rawTemplate=a.innerHTML,this.renderFunction=this.createRenderFunction(h),this.eventManager=new Xt(this.el,()=>this.latestScope),this.render()}static setPerfEnabled(t){this.perfEnabled=t}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){const t={};return Bi.forEach(e=>{t[e]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:t}}recordPerfPhase(e,s){if(!t.perfEnabled)return;let i=t.perfStats.get(this.id);i||(i=t.createEmptyPerfEntry(),t.perfStats.set(this.id,i));const n=i.phases[e];n.count++,n.totalMs+=s,n.maxMs=Math.max(n.maxMs,s)}startPerfTimer(){return t.perfEnabled?ot():0}endPerfTimer(e,s){t.perfEnabled&&this.recordPerfPhase(e,ot()-s)}findOwnScript(t){const e=Array.from(t.children);for(const t of e){if("script"===t.tagName.toLowerCase()&&"text/pp"===t.getAttribute("type"))return t;if(t.hasAttribute("pp-component"))continue;const e=this.findOwnScript(t);if(e)return e}return null}interpolateAttrString(t,e){const s=Object.keys(e),i=s.map(t=>e[t]),n=s.join("\0");return t.replace(/\{([\s\S]*?)\}/g,(t,e)=>{const r=Y(String(e).trim());try{const t=this.getCachedFunction(this._interpolationFnCache,r,s,n,300)(...i);return"boolean"==typeof t||null==t?"":Array.isArray(t)?t.join(""):String(t)}catch(t){return console.warn(`[PP-WARN] Failed attribute interpolation for {${r}}`,t),""}})}applyAttributeInterpolations(t,e){const s=Object.keys(e),i=s.map(t=>e[t]),n=s.join("\0");for(const r of Array.from(t.attributes)){const a=r.name;if("pp-component"===a||a.startsWith("on"))continue;const o=r.value;if(!o.includes("{"))continue;if(!/^\s*\{[\s\S]*\}\s*$/.test(o)){const s=this.interpolateAttrString(o,e);s!==o&&t.setAttribute(a,s);continue}const h=o.match(/^\s*\{([\s\S]*)\}\s*$/);if(!h)continue;const c=Y(h[1].trim());if(!H.isValidExpression(c))continue;let l;try{l=this.getCachedFunction(this._scopeEvalFnCache,c,s,n,300)(...i)}catch(t){console.error(`[PP-ERROR] Failed to eval "${c}"`,t);continue}if(Wt.has(a.toLowerCase())){l?t.setAttribute(a,""):t.removeAttribute(a);continue}const p=typeof l;null==l?t.removeAttribute(a):("string"===p||"number"===p||"boolean"===p||"bigint"===p)&&t.setAttribute(a,String(l))}}computePropsFromAttributes(){const t=this.parentId?P.getScope(this.parentId):void 0,e=t?Object.keys(t):[],s=t?e.map(e=>t[e]):[],i=this.el.__ppRawBindings,n=new Set([...Array.from(this.el.attributes).map(t=>t.name),...i?Object.keys(i):[]]),r=e.join("\0"),a=i=>{if(t)try{const t=i+"|"+r;let n=this._propFnCache.get(t);if(!n){if(n=new Function(...e,`"use strict"; return (${i});`),this._propFnCache.size>200){const t=this._propFnCache.keys().next().value;void 0!==t&&this._propFnCache.delete(t)}this._propFnCache.set(t,n)}return n(...s)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${i}}" for component "${this.id}"`,t)}};return Array.from(n).reduce((e,s)=>{if(s.startsWith("on")&&!s.includes("-")||"pp-component"===s)return e;const n=nt(s);if(rt.has(n))return e;const r=this.el.attributes.getNamedItem(s),o=(null==i?void 0:i[s])??(null==r?void 0:r.value);if(void 0===o)return e;if(""===o)return e[n]=!0,e;if(t){const s=o.match(/^\s*\{([\s\S]*)\}\s*$/);if(s){const t=Y(s[1].trim());if(H.isValidExpression(t))return e[n]=a(t),e}if(o.includes("{"))return e[n]=this.interpolateAttrString(o,t),e}return e[n]=o,e},{})}refreshPropsFromParent(){const t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,(!Di(this.props,t)||0!==this.ownedChildren.size)&&(this.props=t,this.isRendering||this.render())}extractOwnedTemplates(){const t=this.el.querySelectorAll("template[pp-owner]");let e=0;t.forEach(t=>{var s;if((null==(s=t.parentElement)?void 0:s.closest("[pp-component]"))!==this.el)return;const i=t.getAttribute("pp-owner");if(i&&i!==this.id){const s=`__PP_OWNED_${this.id}_${e++}__`;this.ownedChildren.set(s,{ownerId:i,content:t.innerHTML});const n=document.createTextNode(s);t.replaceWith(n)}})}maskNestedOwnedTemplates(t){const e=new Map,s=document.createElement("template");s.innerHTML=t;let i=0;const n=s.content.querySelectorAll("[pp-component] > template[pp-owner]");for(const t of Array.from(n)){const s=`__PP_NESTED_TPL_${i++}__`;e.set(s,t.outerHTML),t.replaceWith(document.createTextNode(s))}return{content:s.innerHTML,placeholders:e}}resolveOwnedChildren(t){if(!t.includes("__PP_OWNED_"))return t;this.ownedChildren.forEach((e,s)=>{const i=P.getScope(e.ownerId);if(i){const{content:n,placeholders:r}=this.maskNestedOwnedTemplates(e.content),a=Object.keys(i),o=a.map(t=>i[t]);let h=le.compile(n,a)(...o);for(const[t,e]of r)h=h.replace(t,e);h=this.markOwnedEventHandlers(h,e.ownerId),t=t.replace(s,h)}else t=t.replace(s,e.content)});const e=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;let s;for(;null!==(s=e.exec(t));){const i=s[0],n=s[1],r=P.getOwnedTemplates(n);if(r&&r.has(i)){const s=r.get(i),n=P.getScope(s.ownerId);if(n){const{content:e,placeholders:r}=this.maskNestedOwnedTemplates(s.content),a=Object.keys(n),o=a.map(t=>n[t]);let h=le.compile(e,a)(...o);for(const[t,e]of r)h=h.replace(t,e);h=this.markOwnedEventHandlers(h,s.ownerId),t=t.replace(i,h)}else t=t.replace(i,s.content);e.lastIndex=0}}return t}markOwnedEventHandlers(t,e){const s=document.createElement("template");s.innerHTML=t;const i=document.createTreeWalker(s.content,NodeFilter.SHOW_ELEMENT);let n=i.nextNode();for(;n;){const t=n;Array.from(t.attributes).some(t=>t.name.startsWith("on"))&&t.setAttribute("pp-event-owner",e),n=i.nextNode()}return s.innerHTML}getCachedFunction(t,e,s,i,n){const r=e+"|"+i;let a=t.get(r);if(!a){if(a=new Function(...s,`"use strict"; return (${e});`),t.size>n){const e=t.keys().next().value;void 0!==e&&t.delete(e)}t.set(r,a)}return a}createRenderFunction(t){const e=H.extractStateBindings(t);return new Function("pp",`\n "use strict";\n ${t}\n return { ${e.join(", ")} };\n `)}unmountPreviousRefs(){if(this.__ppPrevRefStore){for(const t of this.__ppPrevRefStore.values())try{"function"==typeof t?t(null):t&&"object"==typeof t&&"current"in t&&(t.current=null)}catch(t){console.warn("[PP-WARN] Ref cleanup failed",t)}this.__ppPrevRefStore=null}}createRefCaptureFunction(){return this.__ppRefStore=new Map,this.__ppRefSeq=0,t=>{const e=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(e,t),e}}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:t=>this.hooksSystem.useState(t),effect:(t,e)=>this.hooksSystem.useEffect(t,e),layoutEffect:(t,e)=>this.hooksSystem.useLayoutEffect(t,e),ref:(t=null)=>this.hooksSystem.useRef(t),memo:(t,e)=>this.hooksSystem.useMemo(t,e),callback:(t,e)=>this.hooksSystem.useCallback(t,e),reducer:(t,e)=>this.hooksSystem.useReducer(t,e),portal:(t,e)=>this.hooksSystem.usePortal(t,e),props:this.props},this._cachedHooksAPI}restorePortaledElements(){for(const[,t]of this.trackedPortals){const{element:e,placeholder:s}=t;s.parentNode&&(s.parentNode.insertBefore(e,s),s.parentNode.removeChild(s))}}applyPortals(){const t=this.hooksSystem.getPortalRegistrations(),e=new Set;let s=!1;for(const i of t){const t=i.ref.current;if(!t)continue;const n=i.target??document.body;e.add(t);const r=this.trackedPortals.get(t);if(null!=r&&r.placeholder.parentNode){r.target!==n&&(n.appendChild(t),r.target=n,s=!0);continue}null===i.info.sourceParent&&t.parentNode instanceof Element&&(i.info.sourceParent=t.parentNode);const a=document.createComment(`pp-portal:${this.id}`);t.parentNode&&t.parentNode.insertBefore(a,t),n.appendChild(t),s=!0,this.trackedPortals.set(t,{element:t,placeholder:a,target:n})}for(const[t,i]of this.trackedPortals)e.has(t)||(i.placeholder.parentNode&&(i.placeholder.parentNode.insertBefore(t,i.placeholder),i.placeholder.remove()),this.trackedPortals.delete(t),s=!0);s&&this.invalidateTraversalCache()}render(){var e;if(this.isRendering)return;this.isRendering=!0,this.renderCount++;const s=this.startPerfTimer();if(t.perfEnabled){let e=t.perfStats.get(this.id);e||(e=t.createEmptyPerfEntry(),t.perfStats.set(this.id,e)),e.renderCount++}try{this.unmountPreviousRefs();const t=this.saveFocusState();this.hooksSystem.prepareRender();const s=this.makeHooksAPI(),i=globalThis.pp,n=(null==(e=null==i?void 0:i.createComponentRuntime)?void 0:e.call(i,s))??s,r=this.startPerfTimer(),a=this.renderFunction(n);this.endPerfTimer("script",r),P.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...this.props,...a},this.latestScope.__pp_ref=this.createRefCaptureFunction(),P.saveScope(this.id,this.latestScope);const o=Object.keys(this.latestScope),h=o.join("\0");let c;h===this._lastScopeKeySig?c=this._lastSortedKeys:(c=o.sort(),this._lastScopeKeySig=h,this._lastSortedKeys=c);const l=c.map(t=>this.latestScope[t]),p=c.join("\0");this.templateFn||(this.templateFn=le.compile(this.rawTemplate,c));let u=this.templateFn(...l);if(u=this.resolveOwnedChildren(u),this.lastRenderedHtml!==u){this.trackedPortals.size>0&&this.restorePortaledElements();const t=this.startPerfTimer();this.applyDomDiff(u),this.endPerfTimer("domDiff",t),this.lastRenderedHtml=u}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){const t=this.pendingEventElements;this.pendingEventElements=new Set;const e=this.startPerfTimer();this.eventManager.bindEvents(t),this.endPerfTimer("bindEvents",e)}const d=this.startPerfTimer();this.bindRefs(c,l,p),this.endPerfTimer("bindRefs",d),this.__ppPrevRefStore=new Map(this.__ppRefStore);const f=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",f);const m=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",m);const g=this.startPerfTimer();this.restoreFocusState(t),this.endPerfTimer("restoreFocus",g);const v=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",v)}catch(t){console.error("[PP-ERROR] Render Cycle Failed",t)}finally{this.endPerfTimer("total",s),this.isRendering=!1}}applyDomDiff(t){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){const e=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"image/svg+xml").documentElement,s=document.createDocumentFragment();return Array.from(e.childNodes).forEach(t=>{s.appendChild(document.importNode(t,!0))}),this.morphChildren(this.el,s),void this.invalidateTraversalCache()}const e=document.createElement("template");e.innerHTML=t;const s=e.content;this.morphChildren(this.el,s),this.invalidateTraversalCache()}isInsideTrackedPortal(t){for(const[e]of this.trackedPortals)if(e===t||e.contains(t))return!0;return!1}morphChildren(t,e){if(this.hasKeyedDirectChildren(t)||this.hasKeyedDirectChildren(e))return void this.morphKeyedChildren(t,e);let s=t.firstChild,i=e.firstChild;for(;s||i;){const e=(null==s?void 0:s.nextSibling)??null,n=(null==i?void 0:i.nextSibling)??null;if(i){if(!s){const e=i.cloneNode(!0);t.appendChild(e),e.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(e),i=n;continue}if(s.nodeType!==i.nodeType){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(s.nodeType!==Node.TEXT_NODE){if(s.nodeType===Node.ELEMENT_NODE){const r=s,a=i;if(r.tagName!==a.tagName){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(r.hasAttribute("pp-component")&&r!==this.el){this.syncAttributes(r,a),this.hasEventAttributes(r)&&this.pendingEventElements.add(r),s=e,i=n;continue}const o=this.isInsideTrackedPortal(r);this.syncAttributes(r,a,o),this.hasEventAttributes(r)&&this.pendingEventElements.add(r),this.morphChildren(r,a)}s=e,i=n}else s.textContent!==i.textContent&&(s.textContent=i.textContent),s=e,i=n}else s&&t.removeChild(s),s=e}}hasKeyedDirectChildren(t){const e=t.childNodes;for(let t=0;t<e.length;t++){const s=e[t];if(null!==this.getNodeKey(s))return!0}return!1}getNodeKey(t){if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t,s=e.getAttribute("pp-key")??e.getAttribute("key");return s&&s.length>0?s:null}areNodesCompatible(t,e){if(t.nodeType!==e.nodeType)return!1;if(t.nodeType!==Node.ELEMENT_NODE)return!0;const s=e;if(t.tagName!==s.tagName)return!1;const i=this.getNodeKey(t),n=this.getNodeKey(e);return null===i&&null===n||null!==i&&i===n}morphKeyedChildren(t,e){const s=Array.from(t.childNodes),i=Array.from(e.childNodes),n=this.collectDuplicateKeys(i),r=new Map,a=[];n.length>0&&console.warn(`[PP-WARN] Duplicate pp-key values detected: ${n.join(", ")}`),s.forEach(t=>{const e=this.getNodeKey(t);if(null===e)return void a.push(t);const s=r.get(e);s?s.push(t):r.set(e,[t])});let o=t.firstChild;i.forEach(e=>{const s=this.getNodeKey(e);let i;if(null!==s){const t=r.get(s);for(;t&&t.length>0;){const s=t.shift();if(this.areNodesCompatible(s,e)){i=s;break}a.push(s)}}else{const t=a.findIndex(t=>this.areNodesCompatible(t,e));-1!==t&&(i=a.splice(t,1)[0])}if(i)i!==o&&t.insertBefore(i,o);else{const s=e.cloneNode(!0);t.insertBefore(s,o),s.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(s),i=s}this.morphNode(i,e),o=i.nextSibling}),a.forEach(e=>{e.parentNode===t&&t.removeChild(e)}),r.forEach(e=>{e.forEach(e=>{e.parentNode===t&&t.removeChild(e)})})}collectDuplicateKeys(t){const e=new Set,s=new Set;return t.forEach(t=>{const i=this.getNodeKey(t);if(null!==i){if(e.has(i))return void s.add(i);e.add(i)}}),Array.from(s.values())}morphNode(t,e){if(t.nodeType!==e.nodeType){const s=t.parentNode;if(!s)return;const i=e.cloneNode(!0);return s.replaceChild(i,t),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(t.nodeType===Node.TEXT_NODE)return void(t.textContent!==e.textContent&&(t.textContent=e.textContent));if(t.nodeType!==Node.ELEMENT_NODE)return;const s=t,i=e;if(s.tagName!==i.tagName){const t=s.parentNode;if(!t)return;const i=e.cloneNode(!0);return t.replaceChild(i,s),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(s.hasAttribute("pp-component")&&s!==this.el)return this.syncAttributes(s,i),void(this.hasEventAttributes(s)&&this.pendingEventElements.add(s));const n=this.isInsideTrackedPortal(s);this.syncAttributes(s,i,n),this.hasEventAttributes(s)&&this.pendingEventElements.add(s),this.morphChildren(s,i)}collectEventElements(t){this.hasEventAttributes(t)&&this.pendingEventElements.add(t);for(let e=0;e<t.children.length;e++)this.collectEventElements(t.children[e])}hasEventAttributes(t){const e=t.attributes;for(let t=0;t<e.length;t++)if(e[t].name.startsWith("on")&&!e[t].name.includes("-"))return!0;return!1}walkOwnedBoundaryElements(t){const e=this.getTraversalCache();for(let s=0;s<e.ownedElements.length;s++){const i=e.ownedElements[s];t(i,e.childBoundaryLookup.has(i))}}invalidateTraversalCache(){this.traversalCache=null}getTraversalCache(){if(this.traversalCache)return this.traversalCache;const t=[],e=[],s=new Set,i=[],n=new Set,r=[],a=(t,e)=>{if(e)r.push(t);else for(let e=t.children.length-1;e>=0;e--)r.push(t.children[e])};a(this.el,!1);for(const[t]of this.trackedPortals)a(t,!0);for(;r.length>0;){const a=r.pop();if(n.has(a))continue;n.add(a);const o=a,h=a.hasAttribute("pp-component");if(t.push(o),(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)&&i.push(o),h)e.push(o),s.add(a);else for(let t=a.children.length-1;t>=0;t--)r.push(a.children[t])}return this.traversalCache={ownedElements:t,childBoundaries:e,childBoundaryLookup:s,managedInputs:i},this.traversalCache}collectManagedInputs(){return this.getTraversalCache().managedInputs}syncAttributes(t,e,s=!1){const i=t.attributes;for(let n=i.length-1;n>=0;n--){const r=i[n].name;if(!e.hasAttribute(r)){if(s&&at.has(r))continue;t.removeAttribute(r)}}const n=e.attributes;for(let e=0;e<n.length;e++){const i=n[e];s&&at.has(i.name)||(t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value),"value"===i.name&&(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&t.value!=i.value&&(t.value=i.value))}}bindRefs(t,e,s){const i=this.getTraversalCache();for(let n=0;n<i.ownedElements.length;n++){const r=i.ownedElements[n],a=r,o=r.getAttribute("data-pp-ref");let h=null;if(o?(r.removeAttribute("data-pp-ref"),a.__ppRefCaptureId=o,h=o):a.__ppRefCaptureId&&this.__ppRefStore.has(a.__ppRefCaptureId)?h=a.__ppRefCaptureId:a.__ppRefCaptureId&&delete a.__ppRefCaptureId,h){const t=this.__ppRefStore.get(h);if("function"==typeof t)try{t(r)}catch(t){console.warn(`[PP-WARN] Ref callback threw for id="${h}"`,t)}else t&&"object"==typeof t&&"current"in t?t.current=r:o&&console.warn(`[PP-WARN] Missing captured ref for id="${h}"`)}const c=r.getAttribute("pp-ref");if(!c)continue;r.removeAttribute("pp-ref");const l=this.latestScope[c];if(l&&"object"==typeof l&&"current"in l)l.current=r;else if("function"!=typeof l)try{const i=this.getCachedFunction(this._refEvalFnCache,c,t,s,200)(...e);"function"==typeof i?i(r):i&&"object"==typeof i&&"current"in i&&(i.current=r)}catch(t){console.warn(`[PP-WARN] Could not resolve pp-ref="${c}"`,t)}else try{l(r)}catch(t){console.warn(`[PP-WARN] pp-ref function threw for "${c}"`,t)}}}bootstrapNestedComponents(){this.walkOwnedBoundaryElements((e,s)=>{if(!s)return;if(e.__ppRawBindings){const t=e.__ppRawBindings;for(const[s,i]of Object.entries(t))e.setAttribute(s,i)}else{const t={};for(const s of Array.from(e.attributes))s.value.includes("{")&&"pp-component"!==s.name&&!s.name.startsWith("on")&&(t[s.name]=s.value);e.__ppRawBindings=t}this.applyAttributeInterpolations(e,this.latestScope);const i=e.getAttribute("pp-component")||"",n=P.getInstance(i);if(null!=n&&n.refreshPropsFromParent)return n.el!==e&&(!e.__ppRawBindings&&n.el.__ppRawBindings&&(e.__ppRawBindings=n.el.__ppRawBindings),n.el=e),void n.refreshPropsFromParent();P.getState(i)||new t(e)})}saveFocusState(){const t=document.activeElement;if(!t)return null;const e=this.el.contains(t),s=!e&&Array.from(this.trackedPortals.values()).some(e=>e.element.contains(t));if(!e&&!s)return null;const i=this.collectManagedInputs().indexOf(t);if(-1===i)return null;const n=this.getTextSelectionState(t);return{element:t,index:i,selectionStart:n.selectionStart,selectionEnd:n.selectionEnd}}isTextSelectionControl(t){return t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&["text","search","url","tel","password"].includes(t.type)}getTextSelectionState(t){if(!this.isTextSelectionControl(t))return{selectionStart:null,selectionEnd:null};try{return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}catch{return{selectionStart:null,selectionEnd:null}}}restoreFocusState(t){if(!t)return;const e=t.element,s=e&&e.isConnected&&(this.el.contains(e)||Array.from(this.trackedPortals.values()).some(t=>t.element.contains(e)))?e:this.collectManagedInputs()[t.index];if(s&&(s.focus(),null!==t.selectionStart&&null!==t.selectionEnd&&this.isTextSelectionControl(s)))try{s.setSelectionRange(t.selectionStart,t.selectionEnd)}catch(t){console.warn("Could not restore cursor position",t)}}forceUpdate(){this.lastRenderedHtml="",this.render()}destroy(){for(const[,t]of this.trackedPortals)t.element.parentNode&&t.element.remove(),t.placeholder.parentNode&&t.placeholder.remove();this.trackedPortals.clear(),this.hooksSystem.dispose(),this.eventManager.clearCache(),P.removeState(this.id),P.removeScope(this.id),P.removeInstance(this.id)}};x(O,"perfEnabled",!1),x(O,"perfStats",new Map);let ae=O;const ut={bootstrap:()=>{document.querySelectorAll("[pp-component]").forEach(t=>{new ae(t)})}},he=class t{constructor(){x(this,"activeAbortController",null),x(this,"navigationEnabled",!1),x(this,"boundHandleLinkClick",null),x(this,"boundHandlePopState",null),x(this,"isNavigating",!1),x(this,"RESET_SCROLL_ATTR","pp-reset-scroll"),x(this,"mounted",!1)}mount(){this.mounted||(this.mounted=!0,this.disableTransitions(),ut.bootstrap(),this.restoreBodyAccessibility(),this.enableTransitions(),this.enableSPANavigation())}createComponentRuntime(e){const s={};for(const e of t.PUBLIC_METHODS){const t=this[e];"function"==typeof t?s[e]=t.bind(this):void 0!==t&&(s[e]=t)}return Object.assign({},s,e)}enablePerf(){ae.setPerfEnabled(!0)}disablePerf(){ae.setPerfEnabled(!1)}getPerfStats(){return ae.getPerfStats()}resetPerfStats(){ae.resetPerfStats()}getCsrfToken(){const t=document.cookie.match(/(?:^|;\s*)pp_csrf=([^;]*)/);return t?decodeURIComponent(t[1]):""}disableTransitions(){const t=document.createElement("style");t.id="pp-disable-transitions",t.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(t,document.head.firstChild)}enableTransitions(){const t=document.getElementById("pp-disable-transitions");t&&t.remove()}restoreBodyAccessibility(){document.body.style.transition="",document.body.style.opacity="1",document.body.style.pointerEvents="auto",document.body.style.userSelect="auto",document.body.removeAttribute("inert"),document.body.setAttribute("aria-busy","false")}static resetInstance(){this.instance&&(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),this.instance=null)}static getInstance(){return this.instance||(this.instance=new t),this.instance}enableSPANavigation(){this.navigationEnabled||"true"!==document.body.getAttribute("pp-spa")||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState))}disableSPANavigation(){this.navigationEnabled=!1,this.boundHandleLinkClick&&(document.removeEventListener("click",this.boundHandleLinkClick),this.boundHandleLinkClick=null),this.boundHandlePopState&&(window.removeEventListener("popstate",this.boundHandlePopState),this.boundHandlePopState=null)}handleLinkClick(t){if(!this.navigationEnabled)return;const e=t.target.closest("a");if(e&&e.href)try{const s=new URL(e.href),i=s.origin!==window.location.origin,n=s.pathname===window.location.pathname&&s.search===window.location.search,r="false"===e.getAttribute("pp-spa");if(i||"_blank"===e.target||e.hasAttribute("download")||r||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;if(t.preventDefault(),n){const e=s.hash;if(e){t.preventDefault(),history.pushState(null,"",s.pathname+s.search+e);const i=document.querySelector(e);return void(i&&i.scrollIntoView({behavior:"smooth"}))}}this.navigateTo(s.pathname+s.search+s.hash)}catch(t){console.error("Link click navigation error:",t)}}async handlePopState(){const t=window.location.pathname+window.location.search+window.location.hash;await this.navigateTo(t,!1)}async navigateTo(t,e=!0){this.isNavigating=!0;const s=this.saveScrollPositions();try{this.dispatchNavigationEvent("start",t),await this.showLoadingTransition();const i=await this.fetchPageContent(t);if("hardReload"in i)return void(window.location.href=i.hardReload);if("redirect"in i)return void await this.navigateTo(i.redirect,e);const n=i;this.updateBrowserHistory(t,e);const r=document.getElementById("loading-file-1B87E"),a="startViewTransition"in document,o=this.getResetScrollConfig(n);!r&&a?await this.updatePageContentWithViewTransition(n):await this.updatePageContent(n),this.resetGlobalCaches(),ut.bootstrap(),this.handleScrollRestoration(s,o),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",t)}catch(e){this.handleNavigationError(t,e)}finally{this.isNavigating=!1}}resetGlobalCaches(){P.clear(),H.clearCaches(),le.clearCache()}getResetScrollConfig(t){if("true"===t.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};const e=t.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),s=new Set;let i=!1;if(e.length>0)for(const t of Array.from(e))if("true"===t.getAttribute(this.RESET_SCROLL_ATTR)){const e=this.getElementKeyFromElement(t);s.add(e),i=!0}return i||s.size>0?{mode:"none",resetElementKeys:s,resetWindow:i}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(t){return t.id?t.id:t.className?t.className:t.tagName}handleScrollRestoration(t,e){requestAnimationFrame(()=>{if("global"===e.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void document.querySelectorAll("*").forEach(t=>{(t.scrollTop||t.scrollLeft)&&(t.scrollTop=0,t.scrollLeft=0)});if(e.resetWindow)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{const e=t.window;e&&window.scrollTo(e.scrollLeft,e.scrollTop)}document.querySelectorAll("*").forEach(s=>{const i=s.tagName.toLowerCase();if(e.resetWindow&&("html"===i||"body"===i))return;const n=this.getElementKey(s);e.resetElementKeys.has(n)?(s.scrollTop=0,s.scrollLeft=0):t[n]&&(s.scrollTop=t[n].scrollTop,s.scrollLeft=t[n].scrollLeft)})})}saveScrollPositions(){const t={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft)&&(t[this.getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})}),t}getElementKey(t){return t.id||t.className||t.tagName}async updatePageContentWithViewTransition(t){t.title&&(document.title=t.title);const e=t.body.innerHTML;if(this.syncBodyAttributes(t.body),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=e);const s=document.startViewTransition(()=>{document.body.innerHTML=e});try{await s.finished}catch(t){console.warn("View transition failed, continuing anyway:",t)}}dispatchNavigationEvent(t,e,s){const i=`pp:navigation:${t}`,n=s?{url:e,error:s}:{url:e};document.dispatchEvent(new CustomEvent(i,{detail:n}))}async showLoadingTransition(){const t=document.getElementById("loading-file-1B87E");if(t){const e=this.findLoadingElement(t,window.location.pathname);if(e)return void await this.updateContentWithTransition(e)}const e=document.querySelector("[pp-loading-content='true']")||document.body;e&&!("startViewTransition"in document)&&await this.fadeOut(e,250)}async fetchPageContent(t){const e=new URL(t,window.location.origin).hash,s=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}});if(!s.ok)throw new Error(`Navigation failed: ${s.status} ${s.statusText}`);const i=s.headers.get("X-PP-Root-Layout"),n=document.querySelector('meta[name="pp-root-layout"]'),r=n?n.getAttribute("content"):null;if(i&&r&&i!==r)return{hardReload:t};if(s.redirected){const t=new URL(s.url);if(e&&t.searchParams.has("next")){const s=t.searchParams.get("next");s&&!s.includes("#")&&t.searchParams.set("next",s+e)}return{redirect:t.pathname+t.search+t.hash}}const a=this.getRedirectUrlFromResponse(s);if(a)return{redirect:a};const o=await s.text();return(new DOMParser).parseFromString(o,"text/html")}getRedirectUrlFromResponse(t){const e=t.headers.get("X-PP-Redirect");if(e)return e;const s=t.headers.get("Location"),i=t.status;return s&&i>=300&&i<400?s:null}updateBrowserHistory(t,e){e&&history.pushState(null,"",t)}async updatePageContent(t){t.title&&(document.title=t.title);const e=t.body;this.syncBodyAttributes(e),document.body.innerHTML=e.innerHTML}syncBodyAttributes(t){t&&(Array.from(document.body.attributes).forEach(t=>{"style"!==t.name&&document.body.removeAttribute(t.name)}),Array.from(t.attributes).forEach(t=>{"style"!==t.name&&document.body.setAttribute(t.name,t.value)}))}async handleNavigationCompletion(){const t=document.querySelector("[pp-loading-content='true']")||document.body;this.fadeIn(t,150),setTimeout(()=>{this.restoreBodyAccessibility()},50);const e=window.location.hash;e&&requestAnimationFrame(()=>{const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})})}handleNavigationError(t,e){console.error("Navigation error:",e),this.restoreBodyAccessibility(),this.dispatchNavigationEvent("error",t,e),window.location.href=t}findLoadingElement(t,e){let s=e;for(;;){const e=t.querySelector(`div[pp-loading-url='${s}']`);if(e)return e;if("/"===s)break;const i=s.lastIndexOf("/");s=i<=0?"/":s.substring(0,i)}return t.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(t){const e=document.querySelector("[pp-loading-content='true']")||document.body;if(!e)return;const{fadeIn:s,fadeOut:i}=this.parseTransition(t);await this.fadeOut(e,i),e.innerHTML=t.innerHTML,this.fadeIn(e,s)}parseTransition(t){let e=250,s=250;const i=t.querySelector("[pp-loading-transition]"),n=null==i?void 0:i.getAttribute("pp-loading-transition");if(n){let t=JSON.parse(n);t&&"object"==typeof t?(e=this.parseTime(t.fadeIn??e),s=this.parseTime(t.fadeOut??s)):console.warn("pp-loading-transition is not valid JSON → default values (250 ms) will be used. String:",n)}return{fadeIn:e,fadeOut:s}}fadeOut(t,e){return new Promise(s=>{t.style.transition=`opacity ${e}ms ease-out`,setTimeout(()=>{t.style.transition="",s()},e)})}fadeIn(t,e){t.style.transition=`opacity ${e}ms ease-in`,setTimeout(()=>{t.style.transition=""},e)}parseTime(t){if("number"==typeof t)return t;const e=t.match(/^(\d+)(ms|s|m)?$/);if(e){const t=parseInt(e[1],10);switch(e[2]||"ms"){case"ms":default:return t;case"s":return 1e3*t;case"m":return 60*t*1e3}}return 0}async redirect(t){if(t)try{const e=new URL(t,window.location.origin);e.origin!==window.location.origin?window.location.href=t:this.navigationEnabled?await this.navigateTo(e.pathname+e.search+e.hash):window.location.href=t}catch(t){console.error("Redirect error:",t)}}async rpc(t,e={},s=!1){let i=null;const n="boolean"==typeof s?{abortPrevious:s}:s;try{n.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),i=new AbortController,n.abortPrevious&&(this.activeAbortController=i);const s=window.location.pathname.replace(/\/+$/,"")||"/",r={"X-CSRF-Token":this.getCsrfToken(),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":t,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"};let a;if(Object.values(e).some(t=>t instanceof File||t instanceof FileList&&t.length>0)){const t=new FormData;for(const[s,i]of Object.entries(e))i instanceof File?t.append(s,i):i instanceof FileList?Array.from(i).forEach(e=>t.append(s,e)):null!=i&&t.append(s,"object"==typeof i?JSON.stringify(i):String(i));if(n.onUploadProgress)return await this.xhrFunction({url:s,headers:r,body:t,controller:i,options:n});a={method:"POST",headers:r,body:t,signal:i.signal}}else a={method:"POST",headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),signal:i.signal};const o=await fetch(s,a);if(401===o.status)throw new Error("Authentication required");if(403===o.status)throw new Error("Permission denied");if(!o.ok){const t=await o.json().catch(()=>null);throw t||415!==o.status?new Error((null==t?void 0:t.error)||`Request failed: ${o.status} ${o.statusText}`):new Error("Server rejected data format (415).")}const h=this.getRedirectUrlFromResponse(o);return h?(await this.redirect(h),{redirected:!0,to:h}):(this.activeAbortController===i&&(this.activeAbortController=null),(o.headers.get("Content-Type")||"").includes("text/event-stream")&&o.body?(n.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(o.body,n)):await o.json())}catch(t){if(this.activeAbortController===i&&(this.activeAbortController=null),t instanceof Error&&"AbortError"===t.name)return console.log("Request was cancelled"),{cancelled:!0};if(n.onStreamError)return void n.onStreamError(t);throw console.error("RPC error:",t),t}}xhrFunction(t){const{url:e,headers:s,body:i,controller:n,options:r}=t;return new Promise((t,a)=>{const o=new XMLHttpRequest;o.open("POST",e,!0);for(const[t,e]of Object.entries(s))o.setRequestHeader(t,e);const h=()=>{try{o.abort()}catch{}};n.signal.addEventListener("abort",h,{once:!0}),o.upload&&r.onUploadProgress&&(o.upload.onprogress=t=>{var e;const s=t.lengthComputable?t.total:null,i=t.lengthComputable&&t.total>0?Math.min(100,Math.max(0,t.loaded/t.total*100)):null;null==(e=r.onUploadProgress)||e.call(r,{loaded:t.loaded,total:s,percent:i})}),o.onerror=()=>{n.signal.removeEventListener("abort",h),a(new Error("Network error (XHR upload)."))},o.onload=async()=>{var e,s;if(n.signal.removeEventListener("abort",h),401===o.status)return a(new Error("Authentication required"));if(403===o.status)return a(new Error("Permission denied"));if(o.status<200||o.status>=300){let t=`Request failed: ${o.status} ${o.statusText}`;try{const e=JSON.parse(o.responseText||"{}");t=(null==e?void 0:e.error)||(null==e?void 0:e.message)||t}catch{}return a(new Error(t))}const i=o.getResponseHeader("X-PP-Redirect")||(o.status>=300&&o.status<400?o.getResponseHeader("Location"):null);if(i)try{return await this.redirect(i),null==(e=r.onUploadComplete)||e.call(r),t({redirected:!0,to:i})}catch(t){return a(t)}const c=o.responseText??"";let l=c;try{l=JSON.parse(c)}catch{}null==(s=r.onUploadComplete)||s.call(r),t(l)};try{o.send(i)}catch(t){n.signal.removeEventListener("abort",h),a(t)}})}async handleStream(t,e){const s=t.getReader(),i=new TextDecoder;let n="";try{for(;;){const{done:t,value:r}=await s.read();if(t){e.onStreamComplete&&e.onStreamComplete();break}n+=i.decode(r,{stream:!0});const a=n.split("\n");n=a.pop()||"";for(const t of a)if(""!==t.trim()&&t.startsWith("data: ")){const s=t.slice(6);let i=s;try{("true"===s||"false"===s||"null"===s||!isNaN(Number(s))||s.startsWith("{")||s.startsWith("[")||s.startsWith('"'))&&(i=JSON.parse(s))}catch{}e.onStream&&e.onStream(i)}}}catch(t){if(!e.onStreamError)throw t;e.onStreamError(t)}finally{s.releaseLock()}}};x(he,"instance",null),x(he,"PUBLIC_METHODS",["mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"]);let qe=he;const ne=class t{constructor(){x(this,"listeners",[])}static getInstance(){return t.instance||(t.instance=new t),t.instance}get params(){return new URLSearchParams(window.location.search)}get(t){return this.params.get(t)}set(t,e){const s=this.params;s.set(t,e),this.updateURL(s)}delete(t){const e=this.params;e.delete(t),this.updateURL(e)}replace(t){const e=new URLSearchParams;for(const s in t){const i=t[s];null!==i&&e.set(s,i)}this.updateURL(e,!0)}updateURL(t,e=!1){const s=`${window.location.pathname}?${t.toString()}`;e?history.replaceState(null,"",s):history.pushState(null,"",s),this.notifyListeners(t)}listen(t){this.listeners.push(t)}notifyListeners(t){for(const e of this.listeners)e(t)}enablePopStateListener(){window.addEventListener("popstate",()=>{this.notifyListeners(this.params)})}};x(ne,"instance",null);let We=ne;function Kt(t,e,s=window,i=!0){let n=null;if(Object.defineProperty(s,t,{get(){if(null!==n)return n;if(e&&"object"==typeof e&&!Array.isArray(e)&&"getInstance"in e&&"function"==typeof e.getInstance)return n=e.getInstance(),n;if("function"!=typeof e)return n=e,n;try{return n=e.getInstance(),n}catch{return n=e,n}},set(e){null===e?n=null:console.warn(`Cannot override global ${t}`)},configurable:!0,enumerable:!0}),i)try{s[t]}catch(e){console.error(`Failed to initialize ${t}:`,e)}}Kt("pp",{getInstance:()=>{var t;const e=qe.getInstance();return"loading"!==document.readyState?null==(t=e.mount)||t.call(e):document.addEventListener("DOMContentLoaded",()=>{var t;return null==(t=e.mount)?void 0:t.call(e)},{once:!0}),e}}),Kt("searchParams",We);export{ut as ComponentInit,qe as PPUtilities,We as SearchParamsManager};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-alpha.2",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",