diff --git a/.vscode/settings.json b/.vscode/settings.json index 3e320c8..de6120a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,5 +30,6 @@ "**/.git": true, "**/node_modules": true }, - "commentTranslate.source": "Bing" + "commentTranslate.source": "Bing", + "commentTranslate.hover.enabled": true } diff --git a/CHANGELOG.md b/CHANGELOG.md index 985759e..882043f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ -# Changelog +# + +## 2024/2/10 日本語版更新中です + +## [v3.4.5](https://github.com/Pete9xi/Paradox_AntiCheat/tree/v3.4.6) (2023-12-10) + +[Full Changelog](https://github.com/Pete9xi/Paradox_AntiCheat/compare/v3.4.5...v3.4.6) ## [v3.4.5](https://github.com/Pete9xi/Paradox_AntiCheat/tree/v3.4.5) (2023-12-05) diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/Commands_Features/chatcommands.md b/docs/Commands_Features/chatcommands.md new file mode 100644 index 0000000..fa2ae2d --- /dev/null +++ b/docs/Commands_Features/chatcommands.md @@ -0,0 +1,827 @@ +![Paradox](../Media/Paradox_Title.png) + +## !afk + +The AFK command kicks people from the world after the specified time in config.js if they are not paradox opped. The command acts as a toggle to enable and disable the module. + +> ```Toggle +> !afk +> ``` + + +## !allowgma + +!> Note one mode has to stay enabled by default if all modes are not allowed, and this is Adventure. + +This modules allows players to be in game mode adventure. All paradox Opped players are excluded from checks. To enabled it use the command below. + +> ```Toggle +> !allowgma +> ``` + + +## !allowgmc + +!> Note one mode has to stay enabled by default if all modes are not allowed, and this is Adventure. + +This modules allows players to be in game mode creative. All paradox Opped players are excluded from checks. + +> ```Toggle +> !allowgmc +> ``` + + + +## !allowgms + +!> Note one mode has to stay enabled by default if all modes are not allowed, and this is Adventure. + +This modules allows players to be in game mode survival. All paradox Opped players are excluded from checks. + +> ```Toggle +> !allowgms +> ``` + + +## !antikb + +This module monitors players for using possible hacks to prevent taking knockback it can be enabled and disabled via the command in chat. + +> ```Toggle +> !antikb +> ``` + +## !antifalla + +This module detects players using NoFall damage hacks if a player is detected they are flagged, this can be enabled or disabled by using the following command. + +> ```Toggle +> !antifalla +> ``` + +## !antikillaura + +This module monitors players and checks for attacks outside a 90 degree angle. This module can be enabled or disabled via the command below. + +> ```Toggle +> !antikb +> ``` + +## !antinukera + +This module prevents players from nuking the world, when detecting that a vast amount of blocks are being removed at an extreme rate it will flag the offending player and ban them. + +> ```Toggle +> !antinukera +> ``` + +## !antiphasea + +This modules checks for players using phase hacks, players who phasing through blocks, will be teleported back to the last valid location this acts as a deterrent to using the hack, players who are paradox opped will be alerted providing they have cheat notifications on. + +> ```Toggle +> !antiphasea +> ``` + +## !antispam + +This module checks players for spamming in chat, there is a 2 second cool down. If they are flagged more than five times they will be banned. + +> ```Toggle +> !antispam +> ``` + +## !autoban + +This module monitors all players current violations across every module in paradox if they have a violation count above 50, they will be banned, this runs every 5 minutes. + +> ```Toggle +> !autoban +> ``` + +## !badpackets1 + +This module checks for message lengths with each broadcast. If a message is detected they are banned. + +> ```Toggle +> !badpackets1 +> ``` + +## !badpackets2 + +This module checks for invalid selected slots by player. If flagged the player is banned. + +> ```Toggle +> !badpackets2 +> ``` + +## !ban + +This command allows you to ban a player, below is an example. + +> ```Command +> !ban Pete9xi Was using hacks. +> ``` + +If a player has a space in their name you can wrap this in quotation marks + +> ```Command +> !ban "Tin Man22" using fly hacks. +> ``` + +## !bedrockvalidate + +This module checks for bedrock being removed at the bottom of the world, if missing it replaces the bedrock layer this module can be toggled via the command. + +> ```Toggle +> !bedrockvalidate +> ``` + +## !biome + +This command is usable by all players, when ran in chat it will print the current biome and the direction they are facing in chat, only the player that ran the command can see this. + +> ```Command +> !biome +> ``` + +## !chatranks + +Chat ranks are fully customizable and can be enabled or disabled using the command. When disabled chat will go back to the vanilla style. + +> ```Command +> !chatranks +> ``` + +## !channel + +?> The channel command can be used by all players. + +The channel command has a few parameters that you can use, channels are private chat groups these can be protected by a password or left open so others can join, Players can also be invited to a chat channel when all members leave the chat channel or the server gets restarted the channels are deleted. + +Example of creating a channel without a password. + +> ```Command +> !channel create Test +> ``` + +Example of creating a chat channel with a password. + +> ```Command +> !channel create Test Password123 +> ``` + +Example of deleting an existing channel without a password. + +> ```Command +> !channel delete Test +> ``` + +Example of deleting an existing channel with a password. + +> ```Command +> !channel delete Test Password123 +> ``` + +Example of inviting a player to the channel + +> ```Command +> !channel invite Visual1mpact +> ``` + +Example of joining a channel without a password + +> ```Command +> !channel join Test +> ``` + +Example of joining a password protected channel. + +> ```Command +> !channel join Test Password123 +> ``` + +You can also transfer ownership of a channel providing you are the one who created it, an example below. + +> ```Command +> !channel handover Test Visual1mpact +> ``` + +## !clearchat + +This command clears the chat window for all players, this can only be ran by paradox opped players + +> ```Command +> !clearchat +> ``` + +## !clearlag + +This module removes lag from the server, this can be configured in config.js as to the time intervals that it checks by default this is set to every 10 minutes. The module removes all entity that are considered lag ie dropped items etc. + +> ```Toggle +> !clearlag +> ``` + +File: `scripts/data/config.js` + +> ```js +> clearLag: { +> ``` + + enabled: false, + seconds: 0, + minutes: 10, + hours: 0, + days: 0, + }, + +> ``` +> +> ``` + +File: `scripts/data/clearlag.js` + +This contains all items/entitys that are cleared from the world when the module is active. + +## !credits + +This command shows the credits which contains all members who have worked on paradox in the past as well as the current devlopers. + +> ```Command +> !credits +> ``` + +## !deop + +The deop command is used to Revokes Op from a player in Paradox AntiCheat features. + +> ```Example +> !deop Pete9xi +> ``` + +## !delhome + +?> The delhome command can be used by all players. + +This command allows a player to delete one of their saved locations. + +> ```Command +> !delhome MineTown +> ``` + +## !despawn + +This command allows you to despawn multiple entitys in the loaded chuncks around you, below is an example of removing all zombies from around the player. + +> ```Command +> !despawn zombie +> ``` + +If you want to remove all entites around you in the current loaded chunks you can run the following command. + +> ```Command +> !despawn all +> ``` + +## !ecwipe + +This command allows you to wipe a players enderchest inventory, you can run the following command. + +> ```Command +> !ecwipe Pete9xi +> ``` + +## !enchantedarmor + +This module when enabled prevents players from wearing enchanted armor. + +> ```Toggle +> !enchantedarmor +> ``` + +## !fly + +!> The EDU flag must be enabled on the world for this command to be used. + +This command grants a player fly abilities. + +> ```Command +> !fly Pete9xi +> ``` + +## !flya + +This module checks for players using Fly hacks, when a player is detected using fly hacks it flaggs them and telports them back to the last known location when they were on the ground. + +> ```Toggle +> !flya +> ``` + +## !freeze + +The freeze command allows you to freeze a player, they wont be able to see but will see an image saying they are frozen. The same command acts as a toggle to freeze and unfreeze a player. + +> ```Toggle +> !freeze Pete9xi +> ``` + +## !fullreport + +This command prints in chat to the paradox opped player that ran the command a full list of every player with thier current gamemode coordinates as well as any violations they may have. + +> ```Command +> !fullreport +> ``` + +## !gohome + +?> The gohome command can be used by all players + +This command allows a player to teleport to a saved location. There is a cool down timer that can be configured in config.js + +> ```Command +> !gohome Base +> ``` + +File: `scripts/data/config.js` + +> ```js +> goHome: { +> ``` + + seconds: 0, + minutes: 5, + hours: 0, + days: 0, + }, + +> ``` +> +> ``` + +## !help + +The help command is self explanitory however both paradox oppped and no paradox opped players can use this command, for paradox oppped players you will see a list of all commands, non paradox oppped players will see a list of commands that the player can use. + +> ```Command +> !help +> ``` + +## !hotbar + +The hotbar command can be used to set a message above every players hotbar. running the command below will enable the hotbar message that is currently set in config.js + +> ```Command +> !hotbar +> ``` + +Running the command below will enable the hotbar and set a new message. + +> ```Command +> !hotbar Anarchy Server | Realm Code: 34fhf843 +> ``` + +To disable the hotbar if enable you can run the following command. + +> ```Command +> !hotbar disable +> ``` + +## !illegalenchant + +This module when enabled will check all players who are not paradox opped for illegal enchantments on items that cannot be enchanted as well as items that can be, if an enchatment is detected above the vanllia values the player is banned and their inventory will be wiped clean. + +> ```Toggle +> !illegalenchant +> ``` + +## !illegalitemsa + +This module checks for items within the players inventory that are classed as illegal, there is a list by deafult that can be edited. If a player has an illegal item in their inventory they will be banned and their inventory will be wiped. + +File: `scripts/data/itemban.js` + +> ```Toggle +> !illegalitemsa +> ``` + +## !illegalitemsb + +This module checks for players placing illegal items within the world, if detected they are also banned. for example if a player placed an end portal frame. + +> ```Toggle +> !illegalitemsb +> ``` + +## !illegalitemsc + +This module checks for players dropping illegal items within the world, if detected they are also banned. for example if a player dropped an end portal frame. + +> ```Toggle +> !illegalitemsc +> ``` + +## !illegallores + +This module checks for illegal lores on items. + +> ```Toggle +> !illegallores +> ``` + +## !invsee + +This command allows you to view the invetory of another player it will print all items to chat as well as there enchantment status, this is only shown to the paradox opped player who ran the command + +> ```Command +> !invsee Pete9xi +> ``` + +## !invalidsprinta + +This module checks for illegal sprinting with blindness effect applied. + +> ```Toggle +> !invalidsprinta +> ``` + +## !jesusa + +This module checks for players who are using movement hacks that allow them to run on water and lava. + +> ```Toggle +> !jesusa +> ``` + +## !listhome + +?> This command can be used by all players. + +This command allows a player to list thier saved locations. + +> ```Command +> !listhome +> ``` + +## !listitems + +!> This is a debug command used by the developers. + +## !lockdown + +This command locks down the server preventing any player who is not paradox oppped from joing when enabled if there are players who are not paradox opped but are connected will be kicked from the server. + +> ```Toggle +> !lockdown +> ``` + +## !mute + +This command allows you to mute the specified user and optionally gives reason as to why they were muted, this will prevent that player talking in chat. + +> ```Command +> !mute Pete9xi Spamming offensive words in chat. +> ``` + +## !namespoofa + +This module checks for player's name exceeding character limitations. + +> ```Toggle +> !namespoofa +> ``` + +## !namespoofb + +This module checks for player's name that has Non ASCII characters + +> ```Toggle +> !namespoofb +> ``` + +## !notify + +This module enables notifcations, when paradox flags a player for example if a paradox opped member of staff has notifctions enabled they will be sent an alert. + +Enable notifcations for yourself. + +> ```Toggle +> !notify +> ``` + +Enable notifications for another paradox opped player. + +> ```Toggle +> !notify Pete9xi +> ``` + +To disable notifcations re run the command. + +## !op + +The op command is used to add Op to a player for Paradox AntiCheat features. + +> ```Example without a password +> !op Pete9xi +> ``` + +> ```Example with a password +> !op MyPassword123$ +> ``` + +> ```Example Opping another player. +> !op MyPassword123$ Visual1mpact +> ``` + +## !ops + +!> This module is subjected to change due to new devlopments in the scripting API. + +This module when enabled only requires one player to sleep in order for the night to be skipped. + +> ```Toggle +> !ops +> ``` + +## !overridecbe + +This command forces the commandblocksenabled gamerule to be enabled or disabled at all times. + +> ```Toggle +> !overridecbe +> ``` + +## !paradoxui + +?> This command can be used by all players. + +This command triggers the UI version of paradox to open. You must close chat afterwards as only one UI element can be open at any one time. + +> ```Command +> !paradoxui +> ``` + +## !prefix + +This command allows you to change the default prefix which is `!` You can use up to two characters. + +> ```Command +> !prefix $ +> ``` + +## !pvp + +?> This command can be used by all players. + +This command allows all players to enable or disable PVP this is per player based so for example if player a has pvp enabled but player b has pvp disable, when player a attacks player b, no damage will be delt and player a will be warned that player b has PVP disabled. + +> ```Command +> !pvp enable +> ``` + +> ```Command +> !pvp disable +> ``` + +## !rank + +This command allows you to add edit or remove a rank from a player this is full customizable you are able to use colour codes. + +This example uses the classic paradox member chat rank. + +> ```Command +> !rank Pete9xi §4[§6Member§4] +> ``` + +## !reacha + +This module checks for player's placing blocks beyond reach if detected its possible that they are using a reach hack, we only flag people for reach. As further investigation is need by staff to confirm if they player is indeed using reach hacks. + +> ```Toggle +> !reacha +> ``` + +## !reachb + +This module checks for player's attacking beyond reach, again a player will be flagged if they are attacking beyond the normal reach values if you get notified of this its up to staff to investigate what is happening and complete the appropriate action + +> ```Toggle +> !reachb +> ``` + +## !removecb + +When this module is enabled all command blocks will be cleared from the world this includes placed ones if you use command blocks in your world as part of shops or spawn protection you may want to keep this disabled. + +> ```Toggle +> !removecb +> ``` + +## !report + +This is a command to be used by normal players it allows them to report people who maybe using hacks. + +> ```Command +> !report Pete9xi possible reach hacks. +> ``` + +## !salvage + +This allows you to enable or disable the salvage system, what this does is when an block is placed paradox removes the placed block encase it contains NBT data that could be used as an exploit, what it will do is replace a vanilla copy of this block in the same place the previous one was placed. + +> ```Toggle +> !salvage +> ``` + +## !sethome + +?> This command can be used by all players. + +This command allows a player to set the current location as a new saved location. Providing they have not set more than 5 homes which is the default limit this can be changed in config.js. + +> ```Command +> !sethome TheBarn +> ``` + +File: `scripts/data/config.js` + +> ```js +> setHome: { +> ``` + + enabled: true, + max: 5, + }, + +> ``` +> +> ``` + +## !showrules + +This allows you to enable or disable the module to display server rules when a player joins the server. the rules can be edited in config.js + +> ```Toggle +> !showrules +> ``` + +File: `scripts/data/config.js` + +> ```js +> showrules: { +> ``` + + enabled: true, + rule1: "Rule1: No hacking allowed.", + rule2: "Rule2: Don't grief other players' builds.", + rule3: "Rule3: Be kind to everyone on the server.", + rule4: "Rule4: Follow the staff's instructions.", + rule5: "Rule5: No spamming or advertising.", + }, + +> ``` +> +> ``` + +## !spammera + +This module when enabled checks for messages sent while moving. + +> ```Toggle +> !spammera +> ``` + +## !spammerb + +This module when enabled checks for messages sent while swinging. + +> ```Toggle +> !spammerb +> ``` + +## !spammerc + +This module when enabled checks for messages sent while using items. + +> ```Toggle +> !spammerc +> ``` + +## !spawnprotection + +This module allows you to set a center coordinate, once set you can then specify the radius to check within, once enabled any player who is not paradox opped will be placed into adventure mode preventing them from mining and building within the spawn area. When they are out side of the radius they will be put into survival mode allowing them to mine and build. + +In this example configuration i have set a radius of 90 this means within 90 blocks around the center coordinate. + +> ```Command +> !spawnprotection 54 69 -16 90 +> ``` + +To disable it you would run the following command + +> ```Command +> !spawnprotection +> ``` + +## !stackban + +This module checks for items in the players inventory that have a stack value above the vanilla value if so they are then flagged. + +> ```Toggle +> !stackban +> ``` + +## !stats + +This command allows you to pull the stats for a player. + +> ```Command +> !stats Pete9xi +> ``` + +## !tpr + +?> This command can be used by all players. + +Paradox has a teleport request system. you can make a request but only one request to a player can be made at any one time. Request expire after 2 minutes. When sent a request the player can type approve or denie. + +> ```Command +> !tpr Pete9xi +> ``` + +## !tpa + +This command allows paradox op staff to telport to players its the same as /tp but they dont need server operator status. + +> ```Command +> !tpa Pete9xi Visual1mpact +> ``` + +## !unban + +This command allows you to unban a player when the command is executed the player is then added to a queue which means when they next go to logon to the server they will be unbanned. + +> ```Command +> !unban Pete9xi +> ``` + +## !unmute + +This command allows you to unmute a player who has been muted. + +> ```Command +> !unmute Pete9xi +> ``` + +## !vanish + +This command when ran makes you invisable to the world you are able to move around freely and spectate players, this is useful to see if a player is using hacks or could be cheating. The command is a toggle meaning that you use the same command to enable and disable. + +> ```Toggle +> !vanish +> ``` + +## !version + +This command will print the current version of paradox that is installed and running. + +> ```Command +> !version +> ``` + +## !worldborder + +This module when enable prevents player going past a set of coordinate if they attempt to they are then telported back inside the wall. + +When enabling you can set a worldborder for each dimension the the command below sets a boarder of 10k in the overworld. + +> ```Command +> !worldborder -o 10000 +> ``` + +This example enables a border of 5k in the nether. + +> ```Command +> !worldborder -n 5000 +> ``` + +This example enables a border of 100k in the end. + +> ```Command +> !worldborder -e 100000 +> ``` + +To disable the worldborder run the following command. + +> ```Command +> !worldborder disable +> ``` + +## !xraya + +This module monitors for players mining ore, it flags the player and the coordinates as to where they are mining this allows you to determine if they are using xray hacks + +> ```Toggle +> !xraya +> ``` diff --git a/docs/Commands_Features/overview.md b/docs/Commands_Features/overview.md new file mode 100644 index 0000000..a0e7dff --- /dev/null +++ b/docs/Commands_Features/overview.md @@ -0,0 +1,11 @@ +![Paradox](../Media/Paradox_Title.png) + +## Command System Via Chat + +Paradox utilizes chat commands; all commands are executed in chat. If you are unsure what a command does, you can run the command with the help parameter. For example: `!spawnprotection help`. + +## Paradox UI + +Paradox also has a GUI. This can be accessed by running `!paradoxui` and then closing chat, allowing the menu to load. You will be prompted by a response in the chat UI to close it. Once loaded, you can then browse all the modules, features, and other options available in Paradox. Some features are exclusive to the GUI, such as InventoryUI and Item Editor. + +![Paradox](../Media/gui.png) diff --git a/docs/Commands_Features/paradoxui.md b/docs/Commands_Features/paradoxui.md new file mode 100644 index 0000000..b5869a7 --- /dev/null +++ b/docs/Commands_Features/paradoxui.md @@ -0,0 +1,27 @@ +![ParadoxUI](../Media/Paradox_Title.png) + +## Overview + +ParadoxUI allows you to manage Paradox through a menu system, with some features exclusively available via the UI. All features are accessible using the GUI system. We are actively working on the GUI, so it may change in future updates. + +To get started, simply type `!paradoxui` in chat and then close the window. You will be presented with the main menu, where all options are explained. + +![ParadoxUI](../Media/gui.png) + +## InventoryUI + +Paradox offers an inventory system where you can manage and edit a player's inventory. + +?> Note: We don't use a chest GUI due to performance reasons. + +Once you've selected a player, you'll see their inventory. If the selected slot contains an item, you have the option to edit it using the Item Editor. + +## Item Editor + +Paradox provides an item editor that allows you to edit various aspects of an item, such as enchantments, lores, name, item replacement, and duplicating the item. + +You can also view the stats for an item, which includes enchantments, lores, name, and current durability. + +> In this video, we will cover applying enchantments to an item, replacing the item, and removing the item from the player's inventory. When renaming and editing lores, you can use color modifiers. + +[Watch Video](../Media/ItemEditor.mp4 ":include :type=video controls width=100%") diff --git a/docs/Configuration/why.md b/docs/Configuration/why.md new file mode 100644 index 0000000..4d632cd --- /dev/null +++ b/docs/Configuration/why.md @@ -0,0 +1,9 @@ +## Introduction + +Paradox boasts a plethora of advanced features. However, due to the limitations imposed by Mojang, we are unable to write to the servers'/realms' storage. Consequently, certain settings within Paradox must be configured by editing a configuration file known as `config.js`. + +To mitigate this issue, the Scripting API introduced a feature called dynamic properties. Paradox extensively employs this feature throughout its codebase. However, until the last release, the size of dynamic properties was highly restricted, rendering it insufficient for migrating advanced settings. + +?> What does this mean? + +Presently, Paradox still relies on `config.js`. However, we are actively working towards moving away from this dependency. We acknowledge that this can pose challenges for some of our user base. We are continuously exploring ways to enhance this experience and encourage you to reach out to us for assistance when needed. \ No newline at end of file diff --git a/docs/Contributing/gettinginvolved.md b/docs/Contributing/gettinginvolved.md new file mode 100644 index 0000000..437a431 --- /dev/null +++ b/docs/Contributing/gettinginvolved.md @@ -0,0 +1,129 @@ +![Paradox](../Media/Paradox_Title.png) + +## How + +Paradox is an open-source project maintained and developed by multiple members over the years. We welcome anyone wishing to be part of the project. Once you've set up your development environment, feel free to send a PR request or have a chat with either Pete9xi or Visual1mpact via the Discord support server. + +## TypeScript + +Paradox is written in TypeScript, which is an extension of JavaScript that allows for stricter and more structured coding. JavaScript, on the other hand, is more flexible and forgiving. TypeScript is designed to help developers write more reliable and maintainable code, but it requires stricter adherence to coding standards. JavaScript is often used for rapid prototyping and quick development, while TypeScript is better suited for larger, more complex projects where the benefits of type checking and strict coding outweigh the added complexity. + +JavaScript is a dynamic, interpreted language used to create interactive elements. TypeScript, a superset of JavaScript, adds features like static typing, which can help catch errors before the code is run. This is extremely useful in a Minecraft environment, as it saves a developer a lot of time having to load a world to debug blocks of code that TypeScript can catch right away before even getting that far. + +## Development Environment Setup + +The following guide will help you set up a local development environment. Once completed, you will be able to edit Paradox, make changes, and submit pull requests. + +## Installing Visual Studio Code (VSC) + +
(Alternatively, use git add
to stage specific files.)
(This ensures your fork is up to date with the original repository.)
+ +Congratulations! You have successfully set up the development environment, cloned the project, built it for development, made changes, committed those changes, pushed them upstream, and created a pull request to contribute your changes back to the original repository.
+ +?> Please note that the project maintainers will review your pull request, and if they find it suitable, they will merge it into the main project. Keep an eye on your pull request for any feedback or updates from the maintainers. + +Happy contributing to the Paradox AntiCheat project! If you have any further questions or need additional assistance, feel free to ask.
\ No newline at end of file diff --git a/docs/Media/BetaAPI_Setting.png b/docs/Media/BetaAPI_Setting.png new file mode 100644 index 0000000..961dc32 Binary files /dev/null and b/docs/Media/BetaAPI_Setting.png differ diff --git a/docs/Media/Discord-logo.png b/docs/Media/Discord-logo.png new file mode 100644 index 0000000..3f302aa Binary files /dev/null and b/docs/Media/Discord-logo.png differ diff --git a/docs/Media/EDU_Setting.png b/docs/Media/EDU_Setting.png new file mode 100644 index 0000000..97e0ee3 Binary files /dev/null and b/docs/Media/EDU_Setting.png differ diff --git a/docs/Media/ItemEditor.mp4 b/docs/Media/ItemEditor.mp4 new file mode 100644 index 0000000..79d62cf Binary files /dev/null and b/docs/Media/ItemEditor.mp4 differ diff --git a/docs/Media/OPpassword.mp4 b/docs/Media/OPpassword.mp4 new file mode 100644 index 0000000..92bd745 Binary files /dev/null and b/docs/Media/OPpassword.mp4 differ diff --git a/docs/Media/Paradox.gif b/docs/Media/Paradox.gif new file mode 100644 index 0000000..a4f613f Binary files /dev/null and b/docs/Media/Paradox.gif differ diff --git a/docs/Media/ParadoxConfig.mp4 b/docs/Media/ParadoxConfig.mp4 new file mode 100644 index 0000000..944ab5c Binary files /dev/null and b/docs/Media/ParadoxConfig.mp4 differ diff --git a/docs/Media/Paradox_Title.png b/docs/Media/Paradox_Title.png new file mode 100644 index 0000000..0724d7f Binary files /dev/null and b/docs/Media/Paradox_Title.png differ diff --git a/docs/Media/gui.png b/docs/Media/gui.png new file mode 100644 index 0000000..9cfd452 Binary files /dev/null and b/docs/Media/gui.png differ diff --git a/docs/Media/pack_icon.png b/docs/Media/pack_icon.png new file mode 100644 index 0000000..def3a5a Binary files /dev/null and b/docs/Media/pack_icon.png differ diff --git a/docs/Media/paradox_wiki.png b/docs/Media/paradox_wiki.png new file mode 100644 index 0000000..7a08595 Binary files /dev/null and b/docs/Media/paradox_wiki.png differ diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..cb08062 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,208 @@ +Paradox AntiCheat is a powerful tool designed to combat cheating in Minecraft Bedrock worlds. The name "Paradox" was chosen because the concept of paradox perfectly represents the essence of what we do.
+Paradox AntiCheat is a statement that contradicts itself. It is a tool that fights cheating by using advanced algorithms and techniques that are themselves paradoxical in nature.
+++Paradox: A statement or situation that contradicts itself, opposed to common sense and yet perhaps true.
+
Paradox AntiCheat offers a comprehensive solution for detecting and preventing cheating in Minecraft Bedrock. It uses detection methods to ensure that cheaters are caught and punished. In addition, Paradox AntiCheat is highly customizable, allowing game developers to tailor the tool to their specific needs and requirements.
+If you're looking for a reliable and effective anti-cheat solution for your Minecraft Bedrock experience, look no further than Paradox AntiCheat. For more information, check out the wiki.
+Join the Paradox AntiCheat community on Discord for support. Our community is active and dedicated to providing help and assistance to game developers who use Paradox AntiCheat in their projects. We also welcome feedback and suggestions on how we can improve the tool.
+When applying the pack to your world make sure the addon is at the top of the behavior pack list and Beta APIs is enabled. This is to ensure all checks and systems work properly. The versioning system for Paradox goes as follows:
+To install this anticheat to your realm/world you need to:
+Once you have done this the anticheat should be fully up and running. Education Edition is required for the command !fly <username>
to work.
Follow these steps to grant yourself permission to use Paradox in your world:
+config.js
file located at /scripts/data/config.js
.encryption
section.encryption
, find password
.encryption: {
+ password: "mypassword",
+}
+ <prefix>op
. Replace <prefix>
with your server's command prefix, e.g., !
.<prefix>op <player>
.<prefix>op help
.server.properties
file:
+ op-permission-level=2
+#min=2
+#max=4
+ Note: If you're using a password (Realm owners), use <prefix>op <password>
for permission.
Remember, keep your password secure and share it cautiously.
+ +git clone https://github.com/<your-github-username>/Paradox_AntiCheat.git
+
+
+cd Paradox_AntiCheat
+
+
+npm i
+
+
+
+npm run build
+
+
+npm run build_win
+
+
+
+git add .
+
+
+(Alternatively, use git add <filename>
to stage specific files.)
git commit -m "Your commit message here"
+
+
+
+git pull origin main
+
+
+(This ensures your fork is up to date with the original repository.)
+ +git push origin main
+
+
+
+Congratulations! You have successfully set up the development environment, cloned the project, built it for development, made changes, committed those changes, pushed them upstream, and created a pull request to contribute your changes back to the original repository.
+ +Please note that the project maintainers will review your pull request, and if they find it suitable, they will merge it into the main project. Keep an eye on your pull request for any feedback or updates from the maintainers.
+ +Happy contributing to the Paradox AntiCheat project! If you have any further questions or need additional assistance, feel free to ask.
diff --git a/docs/Support/support.md b/docs/Support/support.md new file mode 100644 index 0000000..db783f0 --- /dev/null +++ b/docs/Support/support.md @@ -0,0 +1,41 @@ +![Paradox](../Media/Paradox_Title.png) + +Join the Paradox AntiCheat community on Discord for support. Our community is active and dedicated to providing help and assistance to game developers who use Paradox AntiCheat in their projects. We also welcome feedback and suggestions on how we can improve the tool.
+Paradox AntiCheat is a robust tool designed to combat cheating in Minecraft Bedrock worlds. The name "Paradox" was chosen because it perfectly represents the essence of what we do.
+Paradox AntiCheat is a statement that contradicts itself. It is a tool that fights cheating using advanced algorithms and techniques that are paradoxical in nature.
+++Paradox: A statement or situation that contradicts itself, opposed to common sense and yet perhaps true.
+
Paradox AntiCheat offers a comprehensive solution for detecting and preventing cheating in Minecraft Bedrock. It utilizes various detection methods to ensure that cheaters are caught and appropriately dealt with. Additionally, Paradox AntiCheat is highly customizable, allowing game developers to tailor the tool to their specific needs and requirements.
+If you're seeking a reliable and effective anti-cheat solution for your Minecraft Bedrock experience, look no further than Paradox AntiCheat. For more information, please refer to Getting Started.
+ばいばい!
- - + + + + +')?(.)\k/, + (_, _quote, token2) => `"${token2}"(${getCodePoint(token2)})` +); +function parseJson(string, reviver, fileName) { + if (typeof reviver === "string") { + fileName = reviver; + reviver = void 0; + } + let message; + try { + return JSON.parse(string, reviver); + } catch (error) { + message = error.message; + } + let location; + if (string) { + location = getErrorLocation(string, message); + message = addCodePointToUnexpectedToken(message); + } else { + message += " while parsing empty string"; + } + const jsonError = new JSONError(message); + jsonError.fileName = fileName; + if (location) { + jsonError.codeFrame = generateCodeFrame(string, location); + jsonError.rawCodeFrame = generateCodeFrame( + string, + location, + /* highlightCode */ + false + ); + } + throw jsonError; +} + +// src/utils/read-file.js +import fs4 from "fs/promises"; +async function readFile(file) { + if (isUrlString(file)) { + file = new URL(file); + } + try { + return await fs4.readFile(file, "utf8"); + } catch (error) { + if (error.code === "ENOENT") { + return; } - resetLast(); - } - function resetLast() { - lastTabs = 0; - lastSpaces = 0; + throw new Error(`Unable to read '${file}': ${error.message}`); } } -function trim(out) { - let trimCount = 0; - let cursorCount = 0; - let outIndex = out.length; - outer: - while (outIndex--) { - const last = out[outIndex]; - if (last === CURSOR_PLACEHOLDER) { - cursorCount++; - continue; - } - if (false) { - throw new Error(`Unexpected value in trim: '${typeof last}'`); - } - for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) { - const char = last[charIndex]; - if (char === " " || char === " ") { - trimCount++; - } else { - out[outIndex] = last.slice(0, charIndex + 1); - break outer; - } - } - } - if (trimCount > 0 || cursorCount > 0) { - out.length = outIndex + 1; - while (cursorCount-- > 0) { - out.push(CURSOR_PLACEHOLDER); - } +var read_file_default = readFile; + +// src/config/prettier-config/loaders.js +async function readJson(file) { + const content = await read_file_default(file); + try { + return parseJson(content); + } catch (error) { + error.message = `JSON Error in ${file}: +${error.message}`; + throw error; } - return trimCount; } -function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) { - if (width === Number.POSITIVE_INFINITY) { - return true; +async function loadJs(file) { + const module = await import(pathToFileURL2(file).href); + return module.default; +} +async function loadConfigFromPackageJson(file) { + const { prettier } = await readJson(file); + return prettier; +} +async function loadYaml(file) { + const content = await read_file_default(file); + try { + return load(content); + } catch (error) { + error.message = `YAML Error in ${file}: +${error.message}`; + throw error; } - let restIdx = restCommands.length; - const cmds = [next]; - const out = []; - while (width >= 0) { - if (cmds.length === 0) { - if (restIdx === 0) { - return true; - } - cmds.push(restCommands[--restIdx]); - continue; +} +var loaders = { + async ".toml"(file) { + const content = await read_file_default(file); + try { + return await (0, import_parse_async.default)(content); + } catch (error) { + error.message = `TOML Error in ${file}: +${error.message}`; + throw error; } - const { - mode, - doc: doc2 - } = cmds.pop(); - switch (get_doc_type_default(doc2)) { - case DOC_TYPE_STRING: - out.push(doc2); - width -= get_string_width_default(doc2); - break; - case DOC_TYPE_ARRAY: - case DOC_TYPE_FILL: { - const parts = getDocParts(doc2); - for (let i = parts.length - 1; i >= 0; i--) { - cmds.push({ - mode, - doc: parts[i] - }); - } - break; - } - case DOC_TYPE_INDENT: - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LABEL: - cmds.push({ - mode, - doc: doc2.contents - }); - break; - case DOC_TYPE_TRIM: - width += trim(out); - break; - case DOC_TYPE_GROUP: { - if (mustBeFlat && doc2.break) { - return false; - } - const groupMode = doc2.break ? MODE_BREAK : mode; - const contents = doc2.expandedStates && groupMode === MODE_BREAK ? at_default( - /* isOptionalObject*/ - false, - doc2.expandedStates, - -1 - ) : doc2.contents; - cmds.push({ - mode: groupMode, - doc: contents - }); - break; - } - case DOC_TYPE_IF_BREAK: { - const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] || MODE_FLAT : mode; - const contents = groupMode === MODE_BREAK ? doc2.breakContents : doc2.flatContents; - if (contents) { - cmds.push({ - mode, - doc: contents - }); - } - break; - } - case DOC_TYPE_LINE: - if (mode === MODE_BREAK || doc2.hard) { - return true; - } - if (!doc2.soft) { - out.push(" "); - width--; - } - break; - case DOC_TYPE_LINE_SUFFIX: - hasLineSuffix = true; - break; - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - if (hasLineSuffix) { - return false; - } - break; + }, + async ".json5"(file) { + const content = await read_file_default(file); + try { + return dist_default.parse(content); + } catch (error) { + error.message = `JSON5 Error in ${file}: +${error.message}`; + throw error; + } + }, + ".json": readJson, + ".js": loadJs, + ".mjs": loadJs, + ".cjs": loadJs, + ".yaml": loadYaml, + ".yml": loadYaml, + // No extension + "": loadYaml +}; +var loaders_default = loaders; + +// src/config/prettier-config/config-searcher.js +var CONFIG_FILE_NAMES = [ + "package.json", + ".prettierrc", + ".prettierrc.json", + ".prettierrc.yaml", + ".prettierrc.yml", + ".prettierrc.json5", + ".prettierrc.js", + ".prettierrc.mjs", + ".prettierrc.cjs", + "prettier.config.js", + "prettier.config.mjs", + "prettier.config.cjs", + ".prettierrc.toml" +]; +async function filter({ name, path: file }) { + if (!await is_file_default(file)) { + return false; + } + if (name === "package.json") { + try { + return Boolean(await loadConfigFromPackageJson(file)); + } catch { + return false; } } - return false; + return true; } -function printDocToString(doc2, options8) { - const groupModeMap = {}; - const width = options8.printWidth; - const newLine = convertEndOfLineToChars(options8.endOfLine); - let pos = 0; - const cmds = [{ - ind: rootIndent(), - mode: MODE_BREAK, - doc: doc2 - }]; - const out = []; - let shouldRemeasure = false; - const lineSuffix2 = []; - let printedCursorCount = 0; - propagateBreaks(doc2); - while (cmds.length > 0) { - const { - ind, - mode, - doc: doc3 - } = cmds.pop(); - switch (get_doc_type_default(doc3)) { - case DOC_TYPE_STRING: { - const formatted = newLine !== "\n" ? string_replace_all_default( - /* isOptionalObject*/ - false, - doc3, - "\n", - newLine - ) : doc3; - out.push(formatted); - if (cmds.length > 0) { - pos += get_string_width_default(formatted); - } - break; +function getSearcher(stopDirectory) { + return new searcher_default({ names: CONFIG_FILE_NAMES, filter, stopDirectory }); +} +var config_searcher_default = getSearcher; + +// src/config/prettier-config/load-config.js +import path7 from "path"; + +// src/utils/import-from-file.js +import { pathToFileURL as pathToFileURL4 } from "url"; + +// node_modules/import-meta-resolve/lib/resolve.js +import assert3 from "assert"; +import { Stats, statSync, realpathSync } from "fs"; +import process3 from "process"; +import { URL as URL3, fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL3 } from "url"; +import path6 from "path"; +import { builtinModules } from "module"; + +// node_modules/import-meta-resolve/lib/get-format.js +import { fileURLToPath as fileURLToPath4 } from "url"; + +// node_modules/import-meta-resolve/lib/package-config.js +import { URL as URL2, fileURLToPath as fileURLToPath3 } from "url"; + +// node_modules/import-meta-resolve/lib/package-json-reader.js +import fs5 from "fs"; +import path5 from "path"; +import { fileURLToPath as fileURLToPath2 } from "url"; + +// node_modules/import-meta-resolve/lib/errors.js +import v8 from "v8"; +import assert2 from "assert"; +import { format, inspect } from "util"; +var own = {}.hasOwnProperty; +var classRegExp = /^([A-Z][a-z\d]*)+$/; +var kTypes = /* @__PURE__ */ new Set([ + "string", + "function", + "number", + "object", + // Accept 'Function' and 'Object' as alternative to the lower cased version. + "Function", + "Object", + "boolean", + "bigint", + "symbol" +]); +var codes = {}; +function formatList(array2, type2 = "and") { + return array2.length < 3 ? array2.join(` ${type2} `) : `${array2.slice(0, -1).join(", ")}, ${type2} ${array2[array2.length - 1]}`; +} +var messages = /* @__PURE__ */ new Map(); +var nodeInternalPrefix = "__node_internal_"; +var userStackTraceLimit; +codes.ERR_INVALID_ARG_TYPE = createError( + "ERR_INVALID_ARG_TYPE", + /** + * @param {string} name + * @param {Array| string} expected + * @param {unknown} actual + */ + (name, expected, actual) => { + assert2(typeof name === "string", "'name' must be a string"); + if (!Array.isArray(expected)) { + expected = [expected]; + } + let message = "The "; + if (name.endsWith(" argument")) { + message += `${name} `; + } else { + const type2 = name.includes(".") ? "property" : "argument"; + message += `"${name}" ${type2} `; + } + message += "must be "; + const types = []; + const instances = []; + const other = []; + for (const value of expected) { + assert2( + typeof value === "string", + "All expected entries have to be of type string" + ); + if (kTypes.has(value)) { + types.push(value.toLowerCase()); + } else if (classRegExp.exec(value) === null) { + assert2( + value !== "object", + 'The value "object" should be written as "Object"' + ); + other.push(value); + } else { + instances.push(value); } - case DOC_TYPE_ARRAY: - for (let i = doc3.length - 1; i >= 0; i--) { - cmds.push({ - ind, - mode, - doc: doc3[i] - }); - } - break; - case DOC_TYPE_CURSOR: - if (printedCursorCount >= 2) { - throw new Error("There are too many 'cursor' in doc."); - } - out.push(CURSOR_PLACEHOLDER); - printedCursorCount++; - break; - case DOC_TYPE_INDENT: - cmds.push({ - ind: makeIndent(ind, options8), - mode, - doc: doc3.contents - }); - break; - case DOC_TYPE_ALIGN: - cmds.push({ - ind: makeAlign(ind, doc3.n, options8), - mode, - doc: doc3.contents - }); - break; - case DOC_TYPE_TRIM: - pos -= trim(out); - break; - case DOC_TYPE_GROUP: - switch (mode) { - case MODE_FLAT: - if (!shouldRemeasure) { - cmds.push({ - ind, - mode: doc3.break ? MODE_BREAK : MODE_FLAT, - doc: doc3.contents - }); - break; - } - case MODE_BREAK: { - shouldRemeasure = false; - const next = { - ind, - mode: MODE_FLAT, - doc: doc3.contents - }; - const rem = width - pos; - const hasLineSuffix = lineSuffix2.length > 0; - if (!doc3.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) { - cmds.push(next); - } else { - if (doc3.expandedStates) { - const mostExpanded = at_default( - /* isOptionalObject*/ - false, - doc3.expandedStates, - -1 - ); - if (doc3.break) { - cmds.push({ - ind, - mode: MODE_BREAK, - doc: mostExpanded - }); - break; - } else { - for (let i = 1; i < doc3.expandedStates.length + 1; i++) { - if (i >= doc3.expandedStates.length) { - cmds.push({ - ind, - mode: MODE_BREAK, - doc: mostExpanded - }); - break; - } else { - const state = doc3.expandedStates[i]; - const cmd = { - ind, - mode: MODE_FLAT, - doc: state - }; - if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) { - cmds.push(cmd); - break; - } - } - } - } - } else { - cmds.push({ - ind, - mode: MODE_BREAK, - doc: doc3.contents - }); - } - } - break; - } - } - if (doc3.id) { - groupModeMap[doc3.id] = at_default( - /* isOptionalObject*/ - false, - cmds, - -1 - ).mode; - } - break; - case DOC_TYPE_FILL: { - const rem = width - pos; - const { - parts - } = doc3; - if (parts.length === 0) { - break; - } - const [content, whitespace] = parts; - const contentFlatCmd = { - ind, - mode: MODE_FLAT, - doc: content - }; - const contentBreakCmd = { - ind, - mode: MODE_BREAK, - doc: content - }; - const contentFits = fits(contentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true); - if (parts.length === 1) { - if (contentFits) { - cmds.push(contentFlatCmd); - } else { - cmds.push(contentBreakCmd); - } - break; - } - const whitespaceFlatCmd = { - ind, - mode: MODE_FLAT, - doc: whitespace - }; - const whitespaceBreakCmd = { - ind, - mode: MODE_BREAK, - doc: whitespace - }; - if (parts.length === 2) { - if (contentFits) { - cmds.push(whitespaceFlatCmd, contentFlatCmd); - } else { - cmds.push(whitespaceBreakCmd, contentBreakCmd); - } - break; - } - parts.splice(0, 2); - const remainingCmd = { - ind, - mode, - doc: fill(parts) - }; - const secondContent = parts[0]; - const firstAndSecondContentFlatCmd = { - ind, - mode: MODE_FLAT, - doc: [content, whitespace, secondContent] - }; - const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true); - if (firstAndSecondContentFits) { - cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd); - } else if (contentFits) { - cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd); - } else { - cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd); - } - break; + } + if (instances.length > 0) { + const pos2 = types.indexOf("object"); + if (pos2 !== -1) { + types.slice(pos2, 1); + instances.push("Object"); } - case DOC_TYPE_IF_BREAK: - case DOC_TYPE_INDENT_IF_BREAK: { - const groupMode = doc3.groupId ? groupModeMap[doc3.groupId] : mode; - if (groupMode === MODE_BREAK) { - const breakContents = doc3.type === DOC_TYPE_IF_BREAK ? doc3.breakContents : doc3.negate ? doc3.contents : indent(doc3.contents); - if (breakContents) { - cmds.push({ - ind, - mode, - doc: breakContents - }); - } - } - if (groupMode === MODE_FLAT) { - const flatContents = doc3.type === DOC_TYPE_IF_BREAK ? doc3.flatContents : doc3.negate ? indent(doc3.contents) : doc3.contents; - if (flatContents) { - cmds.push({ - ind, - mode, - doc: flatContents - }); - } - } - break; + } + if (types.length > 0) { + message += `${types.length > 1 ? "one of type" : "of type"} ${formatList( + types, + "or" + )}`; + if (instances.length > 0 || other.length > 0) + message += " or "; + } + if (instances.length > 0) { + message += `an instance of ${formatList(instances, "or")}`; + if (other.length > 0) + message += " or "; + } + if (other.length > 0) { + if (other.length > 1) { + message += `one of ${formatList(other, "or")}`; + } else { + if (other[0].toLowerCase() !== other[0]) + message += "an "; + message += `${other[0]}`; } - case DOC_TYPE_LINE_SUFFIX: - lineSuffix2.push({ - ind, - mode, - doc: doc3.contents - }); - break; - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - if (lineSuffix2.length > 0) { - cmds.push({ - ind, - mode, - doc: hardlineWithoutBreakParent - }); - } - break; - case DOC_TYPE_LINE: - switch (mode) { - case MODE_FLAT: - if (!doc3.hard) { - if (!doc3.soft) { - out.push(" "); - pos += 1; - } - break; - } else { - shouldRemeasure = true; - } - case MODE_BREAK: - if (lineSuffix2.length > 0) { - cmds.push({ - ind, - mode, - doc: doc3 - }, ...lineSuffix2.reverse()); - lineSuffix2.length = 0; - break; - } - if (doc3.literal) { - if (ind.root) { - out.push(newLine, ind.root.value); - pos = ind.root.length; - } else { - out.push(newLine); - pos = 0; - } - } else { - pos -= trim(out); - out.push(newLine + ind.value); - pos = ind.length; - } - break; - } - break; - case DOC_TYPE_LABEL: - cmds.push({ - ind, - mode, - doc: doc3.contents - }); - break; - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc3); } - if (cmds.length === 0 && lineSuffix2.length > 0) { - cmds.push(...lineSuffix2.reverse()); - lineSuffix2.length = 0; + message += `. Received ${determineSpecificType(actual)}`; + return message; + }, + TypeError +); +codes.ERR_INVALID_MODULE_SPECIFIER = createError( + "ERR_INVALID_MODULE_SPECIFIER", + /** + * @param {string} request + * @param {string} reason + * @param {string} [base] + */ + (request, reason, base = void 0) => { + return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`; + }, + TypeError +); +codes.ERR_INVALID_PACKAGE_CONFIG = createError( + "ERR_INVALID_PACKAGE_CONFIG", + /** + * @param {string} path + * @param {string} [base] + * @param {string} [message] + */ + (path13, base, message) => { + return `Invalid package config ${path13}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`; + }, + Error +); +codes.ERR_INVALID_PACKAGE_TARGET = createError( + "ERR_INVALID_PACKAGE_TARGET", + /** + * @param {string} pkgPath + * @param {string} key + * @param {unknown} target + * @param {boolean} [isImport=false] + * @param {string} [base] + */ + (pkgPath, key2, target, isImport = false, base = void 0) => { + const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./"); + if (key2 === ".") { + assert2(isImport === false); + return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`; } + return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify( + target + )} defined for '${key2}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`; + }, + Error +); +codes.ERR_MODULE_NOT_FOUND = createError( + "ERR_MODULE_NOT_FOUND", + /** + * @param {string} path + * @param {string} base + * @param {boolean} [exactUrl] + */ + (path13, base, exactUrl = false) => { + return `Cannot find ${exactUrl ? "module" : "package"} '${path13}' imported from ${base}`; + }, + Error +); +codes.ERR_NETWORK_IMPORT_DISALLOWED = createError( + "ERR_NETWORK_IMPORT_DISALLOWED", + "import of '%s' by %s is not supported: %s", + Error +); +codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError( + "ERR_PACKAGE_IMPORT_NOT_DEFINED", + /** + * @param {string} specifier + * @param {string} packagePath + * @param {string} base + */ + (specifier, packagePath, base) => { + return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`; + }, + TypeError +); +codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError( + "ERR_PACKAGE_PATH_NOT_EXPORTED", + /** + * @param {string} pkgPath + * @param {string} subpath + * @param {string} [base] + */ + (pkgPath, subpath, base = void 0) => { + if (subpath === ".") + return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`; + return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`; + }, + Error +); +codes.ERR_UNSUPPORTED_DIR_IMPORT = createError( + "ERR_UNSUPPORTED_DIR_IMPORT", + "Directory import '%s' is not supported resolving ES modules imported from %s", + Error +); +codes.ERR_UNKNOWN_FILE_EXTENSION = createError( + "ERR_UNKNOWN_FILE_EXTENSION", + /** + * @param {string} ext + * @param {string} path + */ + (ext, path13) => { + return `Unknown file extension "${ext}" for ${path13}`; + }, + TypeError +); +codes.ERR_INVALID_ARG_VALUE = createError( + "ERR_INVALID_ARG_VALUE", + /** + * @param {string} name + * @param {unknown} value + * @param {string} [reason='is invalid'] + */ + (name, value, reason = "is invalid") => { + let inspected = inspect(value); + if (inspected.length > 128) { + inspected = `${inspected.slice(0, 128)}...`; + } + const type2 = name.includes(".") ? "property" : "argument"; + return `The ${type2} '${name}' ${reason}. Received ${inspected}`; + }, + TypeError + // Note: extra classes have been shaken out. + // , RangeError +); +function createError(sym, value, def) { + messages.set(sym, value); + return makeNodeErrorWithCode(def, sym); +} +function makeNodeErrorWithCode(Base, key2) { + return NodeError; + function NodeError(...args) { + const limit = Error.stackTraceLimit; + if (isErrorStackTraceLimitWritable()) + Error.stackTraceLimit = 0; + const error = new Base(); + if (isErrorStackTraceLimitWritable()) + Error.stackTraceLimit = limit; + const message = getMessage(key2, args, error); + Object.defineProperties(error, { + // Note: no need to implement `kIsNodeError` symbol, would be hard, + // probably. + message: { + value: message, + enumerable: false, + writable: true, + configurable: true + }, + toString: { + /** @this {Error} */ + value() { + return `${this.name} [${key2}]: ${this.message}`; + }, + enumerable: false, + writable: true, + configurable: true + } + }); + captureLargerStackTrace(error); + error.code = key2; + return error; } - const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER); - if (cursorPlaceholderIndex !== -1) { - const otherCursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER, cursorPlaceholderIndex + 1); - const beforeCursor = out.slice(0, cursorPlaceholderIndex).join(""); - const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join(""); - const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join(""); - return { - formatted: beforeCursor + aroundCursor + afterCursor, - cursorNodeStart: beforeCursor.length, - cursorNodeText: aroundCursor - }; - } - return { - formatted: out.join("") - }; } - -// src/document/debug.js -function flattenDoc(doc2) { - var _a; - if (!doc2) { - return ""; +function isErrorStackTraceLimitWritable() { + try { + if (v8.startupSnapshot.isBuildingSnapshot()) { + return false; + } + } catch { } - if (Array.isArray(doc2)) { - const res = []; - for (const part of doc2) { - if (Array.isArray(part)) { - res.push(...flattenDoc(part)); - } else { - const flattened = flattenDoc(part); - if (flattened !== "") { - res.push(flattened); - } - } + const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit"); + if (desc === void 0) { + return Object.isExtensible(Error); + } + return own.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0; +} +function hideStackFrames(fn) { + const hidden = nodeInternalPrefix + fn.name; + Object.defineProperty(fn, "name", { value: hidden }); + return fn; +} +var captureLargerStackTrace = hideStackFrames( + /** + * @param {Error} error + * @returns {Error} + */ + // @ts-expect-error: fine + function(error) { + const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable(); + if (stackTraceLimitIsWritable) { + userStackTraceLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Number.POSITIVE_INFINITY; } - return res; + Error.captureStackTrace(error); + if (stackTraceLimitIsWritable) + Error.stackTraceLimit = userStackTraceLimit; + return error; } - if (doc2.type === DOC_TYPE_IF_BREAK) { - return { - ...doc2, - breakContents: flattenDoc(doc2.breakContents), - flatContents: flattenDoc(doc2.flatContents) - }; +); +function getMessage(key2, args, self) { + const message = messages.get(key2); + assert2(message !== void 0, "expected `message` to be found"); + if (typeof message === "function") { + assert2( + message.length <= args.length, + // Default options do not count. + `Code: ${key2}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).` + ); + return Reflect.apply(message, self, args); } - if (doc2.type === DOC_TYPE_GROUP) { - return { - ...doc2, - contents: flattenDoc(doc2.contents), - expandedStates: (_a = doc2.expandedStates) == null ? void 0 : _a.map(flattenDoc) - }; + const regex = /%[dfijoOs]/g; + let expectedLength = 0; + while (regex.exec(message) !== null) + expectedLength++; + assert2( + expectedLength === args.length, + `Code: ${key2}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` + ); + if (args.length === 0) + return message; + args.unshift(message); + return Reflect.apply(format, null, args); +} +function determineSpecificType(value) { + if (value === null || value === void 0) { + return String(value); } - if (doc2.type === DOC_TYPE_FILL) { - return { type: "fill", parts: doc2.parts.map(flattenDoc) }; + if (typeof value === "function" && value.name) { + return `function ${value.name}`; } - if (doc2.contents) { - return { ...doc2, contents: flattenDoc(doc2.contents) }; + if (typeof value === "object") { + if (value.constructor && value.constructor.name) { + return `an instance of ${value.constructor.name}`; + } + return `${inspect(value, { depth: -1 })}`; } - return doc2; + let inspected = inspect(value, { colors: false }); + if (inspected.length > 28) { + inspected = `${inspected.slice(0, 25)}...`; + } + return `type ${typeof value} (${inspected})`; } -function printDocToDebug(doc2) { - const printedSymbols = /* @__PURE__ */ Object.create(null); - const usedKeysForSymbols = /* @__PURE__ */ new Set(); - return printDoc(flattenDoc(doc2)); - function printDoc(doc3, index, parentParts) { - var _a, _b; - if (typeof doc3 === "string") { - return JSON.stringify(doc3); - } - if (Array.isArray(doc3)) { - const printed = doc3.map(printDoc).filter(Boolean); - return printed.length === 1 ? printed[0] : `[${printed.join(", ")}]`; - } - if (doc3.type === DOC_TYPE_LINE) { - const withBreakParent = ((_a = parentParts == null ? void 0 : parentParts[index + 1]) == null ? void 0 : _a.type) === DOC_TYPE_BREAK_PARENT; - if (doc3.literal) { - return withBreakParent ? "literalline" : "literallineWithoutBreakParent"; - } - if (doc3.hard) { - return withBreakParent ? "hardline" : "hardlineWithoutBreakParent"; - } - if (doc3.soft) { - return "softline"; - } - return "line"; - } - if (doc3.type === DOC_TYPE_BREAK_PARENT) { - const afterHardline = ((_b = parentParts == null ? void 0 : parentParts[index - 1]) == null ? void 0 : _b.type) === DOC_TYPE_LINE && parentParts[index - 1].hard; - return afterHardline ? void 0 : "breakParent"; - } - if (doc3.type === DOC_TYPE_TRIM) { - return "trim"; + +// node_modules/import-meta-resolve/lib/package-json-reader.js +var hasOwnProperty = {}.hasOwnProperty; +var { ERR_INVALID_PACKAGE_CONFIG } = codes; +var cache = /* @__PURE__ */ new Map(); +var reader = { read: read2 }; +var package_json_reader_default = reader; +function read2(jsonPath, { base, specifier }) { + const existing = cache.get(jsonPath); + if (existing) { + return existing; + } + let string; + try { + string = fs5.readFileSync(path5.toNamespacedPath(jsonPath), "utf8"); + } catch (error) { + const exception2 = ( + /** @type {ErrnoException} */ + error + ); + if (exception2.code !== "ENOENT") { + throw exception2; } - if (doc3.type === DOC_TYPE_INDENT) { - return "indent(" + printDoc(doc3.contents) + ")"; + } + const result = { + exists: false, + pjsonPath: jsonPath, + main: void 0, + name: void 0, + type: "none", + // Ignore unknown types for forwards compatibility + exports: void 0, + imports: void 0 + }; + if (string !== void 0) { + let parsed; + try { + parsed = JSON.parse(string); + } catch (error_) { + const cause = ( + /** @type {ErrnoException} */ + error_ + ); + const error = new ERR_INVALID_PACKAGE_CONFIG( + jsonPath, + (base ? `"${specifier}" from ` : "") + fileURLToPath2(base || specifier), + cause.message + ); + error.cause = cause; + throw error; } - if (doc3.type === DOC_TYPE_ALIGN) { - return doc3.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + printDoc(doc3.contents) + ")" : doc3.n < 0 ? "dedent(" + printDoc(doc3.contents) + ")" : doc3.n.type === "root" ? "markAsRoot(" + printDoc(doc3.contents) + ")" : "align(" + JSON.stringify(doc3.n) + ", " + printDoc(doc3.contents) + ")"; + result.exists = true; + if (hasOwnProperty.call(parsed, "name") && typeof parsed.name === "string") { + result.name = parsed.name; } - if (doc3.type === DOC_TYPE_IF_BREAK) { - return "ifBreak(" + printDoc(doc3.breakContents) + (doc3.flatContents ? ", " + printDoc(doc3.flatContents) : "") + (doc3.groupId ? (!doc3.flatContents ? ', ""' : "") + `, { groupId: ${printGroupId(doc3.groupId)} }` : "") + ")"; + if (hasOwnProperty.call(parsed, "main") && typeof parsed.main === "string") { + result.main = parsed.main; } - if (doc3.type === DOC_TYPE_INDENT_IF_BREAK) { - const optionsParts = []; - if (doc3.negate) { - optionsParts.push("negate: true"); - } - if (doc3.groupId) { - optionsParts.push(`groupId: ${printGroupId(doc3.groupId)}`); - } - const options8 = optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : ""; - return `indentIfBreak(${printDoc(doc3.contents)}${options8})`; + if (hasOwnProperty.call(parsed, "exports")) { + result.exports = parsed.exports; } - if (doc3.type === DOC_TYPE_GROUP) { - const optionsParts = []; - if (doc3.break && doc3.break !== "propagated") { - optionsParts.push("shouldBreak: true"); - } - if (doc3.id) { - optionsParts.push(`id: ${printGroupId(doc3.id)}`); - } - const options8 = optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : ""; - if (doc3.expandedStates) { - return `conditionalGroup([${doc3.expandedStates.map((part) => printDoc(part)).join(",")}]${options8})`; - } - return `group(${printDoc(doc3.contents)}${options8})`; + if (hasOwnProperty.call(parsed, "imports")) { + result.imports = parsed.imports; } - if (doc3.type === DOC_TYPE_FILL) { - return `fill([${doc3.parts.map((part) => printDoc(part)).join(", ")}])`; + if (hasOwnProperty.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module")) { + result.type = parsed.type; } - if (doc3.type === DOC_TYPE_LINE_SUFFIX) { - return "lineSuffix(" + printDoc(doc3.contents) + ")"; + } + cache.set(jsonPath, result); + return result; +} + +// node_modules/import-meta-resolve/lib/package-config.js +function getPackageScopeConfig(resolved) { + let packageJSONUrl = new URL2("package.json", resolved); + while (true) { + const packageJSONPath2 = packageJSONUrl.pathname; + if (packageJSONPath2.endsWith("node_modules/package.json")) { + break; } - if (doc3.type === DOC_TYPE_LINE_SUFFIX_BOUNDARY) { - return "lineSuffixBoundary"; + const packageConfig = package_json_reader_default.read( + fileURLToPath3(packageJSONUrl), + { specifier: resolved } + ); + if (packageConfig.exists) { + return packageConfig; } - if (doc3.type === DOC_TYPE_LABEL) { - return `label(${JSON.stringify(doc3.label)}, ${printDoc(doc3.contents)})`; + const lastPackageJSONUrl = packageJSONUrl; + packageJSONUrl = new URL2("../package.json", packageJSONUrl); + if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) { + break; } - throw new Error("Unknown doc type " + doc3.type); } - function printGroupId(id) { - if (typeof id !== "symbol") { - return JSON.stringify(String(id)); - } - if (id in printedSymbols) { - return printedSymbols[id]; + const packageJSONPath = fileURLToPath3(packageJSONUrl); + return { + pjsonPath: packageJSONPath, + exists: false, + main: void 0, + name: void 0, + type: "none", + exports: void 0, + imports: void 0 + }; +} + +// node_modules/import-meta-resolve/lib/resolve-get-package-type.js +function getPackageType(url2) { + const packageConfig = getPackageScopeConfig(url2); + return packageConfig.type; +} + +// node_modules/import-meta-resolve/lib/get-format.js +var { ERR_UNKNOWN_FILE_EXTENSION } = codes; +var hasOwnProperty2 = {}.hasOwnProperty; +var extensionFormatMap = { + // @ts-expect-error: hush. + __proto__: null, + ".cjs": "commonjs", + ".js": "module", + ".json": "json", + ".mjs": "module" +}; +function mimeToFormat(mime) { + if (mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime)) + return "module"; + if (mime === "application/json") + return "json"; + return null; +} +var protocolHandlers = { + // @ts-expect-error: hush. + __proto__: null, + "data:": getDataProtocolModuleFormat, + "file:": getFileProtocolModuleFormat, + "http:": getHttpProtocolModuleFormat, + "https:": getHttpProtocolModuleFormat, + "node:"() { + return "builtin"; + } +}; +function getDataProtocolModuleFormat(parsed) { + const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec( + parsed.pathname + ) || [null, null, null]; + return mimeToFormat(mime); +} +function extname(url2) { + const pathname = url2.pathname; + let index = pathname.length; + while (index--) { + const code = pathname.codePointAt(index); + if (code === 47) { + return ""; } - const prefix = id.description || "symbol"; - for (let counter = 0; ; counter++) { - const key = prefix + (counter > 0 ? ` #${counter}` : ""); - if (!usedKeysForSymbols.has(key)) { - usedKeysForSymbols.add(key); - return printedSymbols[id] = `Symbol.for(${JSON.stringify(key)})`; - } + if (code === 46) { + return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index); } } + return ""; } - -// src/utils/get-alignment-size.js -function getAlignmentSize(text, tabWidth, startIndex = 0) { - let size = 0; - for (let i = startIndex; i < text.length; ++i) { - if (text[i] === " ") { - size = size + tabWidth - size % tabWidth; - } else { - size++; +function getFileProtocolModuleFormat(url2, _context, ignoreErrors) { + const ext = extname(url2); + if (ext === ".js") { + const packageType = getPackageType(url2); + if (packageType !== "none") { + return packageType; } + return "commonjs"; } - return size; -} -var get_alignment_size_default = getAlignmentSize; - -// src/common/errors.js -var errors_exports = {}; -__export(errors_exports, { - ArgExpansionBailout: () => ArgExpansionBailout, - ConfigError: () => ConfigError, - UndefinedParserError: () => UndefinedParserError -}); -var ConfigError = class extends Error { - name = "ConfigError"; -}; -var UndefinedParserError = class extends Error { - name = "UndefinedParserError"; -}; -var ArgExpansionBailout = class extends Error { - name = "ArgExpansionBailout"; -}; - -// src/main/core-options.evaluate.js -var core_options_evaluate_default = { - "cursorOffset": { - "category": "Special", - "type": "int", - "default": -1, - "range": { - "start": -1, - "end": Infinity, - "step": 1 - }, - "description": "Print (to stderr) where a cursor at the given position would move to after formatting.\nThis option cannot be used with --range-start and --range-end.", - "cliCategory": "Editor" - }, - "endOfLine": { - "category": "Global", - "type": "choice", - "default": "lf", - "description": "Which end of line characters to apply.", - "choices": [ - { - "value": "lf", - "description": "Line Feed only (\\n), common on Linux and macOS as well as inside git repos" - }, - { - "value": "crlf", - "description": "Carriage Return + Line Feed characters (\\r\\n), common on Windows" - }, - { - "value": "cr", - "description": "Carriage Return character only (\\r), used very rarely" - }, - { - "value": "auto", - "description": "Maintain existing\n(mixed values within one file are normalised by looking at what's used after the first line)" - } - ] - }, - "filepath": { - "category": "Special", - "type": "path", - "description": "Specify the input filepath. This will be used to do parser inference.", - "cliName": "stdin-filepath", - "cliCategory": "Other", - "cliDescription": "Path to the file to pretend that stdin comes from." - }, - "insertPragma": { - "category": "Special", - "type": "boolean", - "default": false, - "description": "Insert @format pragma into file's first docblock comment.", - "cliCategory": "Other" - }, - "parser": { - "category": "Global", - "type": "choice", - "default": void 0, - "description": "Which parser to use.", - "exception": (value) => typeof value === "string" || typeof value === "function", - "choices": [ - { - "value": "flow", - "description": "Flow" - }, - { - "value": "babel", - "description": "JavaScript" - }, - { - "value": "babel-flow", - "description": "Flow" - }, - { - "value": "babel-ts", - "description": "TypeScript" - }, - { - "value": "typescript", - "description": "TypeScript" - }, - { - "value": "acorn", - "description": "JavaScript" - }, - { - "value": "espree", - "description": "JavaScript" - }, - { - "value": "meriyah", - "description": "JavaScript" - }, - { - "value": "css", - "description": "CSS" - }, - { - "value": "less", - "description": "Less" - }, - { - "value": "scss", - "description": "SCSS" - }, - { - "value": "json", - "description": "JSON" - }, - { - "value": "json5", - "description": "JSON5" - }, - { - "value": "json-stringify", - "description": "JSON.stringify" - }, - { - "value": "graphql", - "description": "GraphQL" - }, - { - "value": "markdown", - "description": "Markdown" - }, - { - "value": "mdx", - "description": "MDX" - }, - { - "value": "vue", - "description": "Vue" - }, - { - "value": "yaml", - "description": "YAML" - }, - { - "value": "glimmer", - "description": "Ember / Handlebars" - }, - { - "value": "html", - "description": "HTML" - }, - { - "value": "angular", - "description": "Angular" - }, - { - "value": "lwc", - "description": "Lightning Web Components" - } - ] - }, - "plugins": { - "type": "path", - "array": true, - "default": [ - { - "value": [] - } - ], - "category": "Global", - "description": "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", - "exception": (value) => typeof value === "string" || typeof value === "object", - "cliName": "plugin", - "cliCategory": "Config" - }, - "printWidth": { - "category": "Global", - "type": "int", - "default": 80, - "description": "The line length where Prettier will try wrap.", - "range": { - "start": 0, - "end": Infinity, - "step": 1 + if (ext === "") { + const packageType = getPackageType(url2); + if (packageType === "none" || packageType === "commonjs") { + return "commonjs"; + } + return "module"; + } + const format3 = extensionFormatMap[ext]; + if (format3) + return format3; + if (ignoreErrors) { + return void 0; + } + const filepath = fileURLToPath4(url2); + throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath); +} +function getHttpProtocolModuleFormat() { +} +function defaultGetFormatWithoutErrors(url2, context) { + const protocol = url2.protocol; + if (!hasOwnProperty2.call(protocolHandlers, protocol)) { + return null; + } + return protocolHandlers[protocol](url2, context, true) || null; +} + +// node_modules/import-meta-resolve/lib/utils.js +var { ERR_INVALID_ARG_VALUE } = codes; +var DEFAULT_CONDITIONS = Object.freeze(["node", "import"]); +var DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS); +function getDefaultConditions() { + return DEFAULT_CONDITIONS; +} +function getDefaultConditionsSet() { + return DEFAULT_CONDITIONS_SET; +} +function getConditionsSet(conditions) { + if (conditions !== void 0 && conditions !== getDefaultConditions()) { + if (!Array.isArray(conditions)) { + throw new ERR_INVALID_ARG_VALUE( + "conditions", + conditions, + "expected an array" + ); } - }, - "rangeEnd": { - "category": "Special", - "type": "int", - "default": Infinity, - "range": { - "start": 0, - "end": Infinity, - "step": 1 - }, - "description": "Format code ending at a given character offset (exclusive).\nThe range will extend forwards to the end of the selected statement.\nThis option cannot be used with --cursor-offset.", - "cliCategory": "Editor" - }, - "rangeStart": { - "category": "Special", - "type": "int", - "default": 0, - "range": { - "start": 0, - "end": Infinity, - "step": 1 - }, - "description": "Format code starting at a given character offset.\nThe range will extend backwards to the start of the first line containing the selected statement.\nThis option cannot be used with --cursor-offset.", - "cliCategory": "Editor" - }, - "requirePragma": { - "category": "Special", - "type": "boolean", - "default": false, - "description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment\nin order for it to be formatted.", - "cliCategory": "Other" - }, - "tabWidth": { - "type": "int", - "category": "Global", - "default": 2, - "description": "Number of spaces per indentation level.", - "range": { - "start": 0, - "end": Infinity, - "step": 1 + return new Set(conditions); + } + return getDefaultConditionsSet(); +} + +// node_modules/import-meta-resolve/lib/resolve.js +var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace]; +var { + ERR_NETWORK_IMPORT_DISALLOWED, + ERR_INVALID_MODULE_SPECIFIER, + ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG2, + ERR_INVALID_PACKAGE_TARGET, + ERR_MODULE_NOT_FOUND, + ERR_PACKAGE_IMPORT_NOT_DEFINED, + ERR_PACKAGE_PATH_NOT_EXPORTED, + ERR_UNSUPPORTED_DIR_IMPORT +} = codes; +var own2 = {}.hasOwnProperty; +var invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i; +var deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i; +var invalidPackageNameRegEx = /^\.|%|\\/; +var patternRegEx = /\*/g; +var encodedSepRegEx = /%2f|%5c/i; +var emittedPackageWarnings = /* @__PURE__ */ new Set(); +var doubleSlashRegEx = /[/\\]{2}/; +function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) { + if (process3.noDeprecation) { + return; + } + const pjsonPath = fileURLToPath5(packageJsonUrl); + const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null; + process3.emitWarning( + `Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath5(base)}` : ""}.`, + "DeprecationWarning", + "DEP0166" + ); +} +function emitLegacyIndexDeprecation(url2, packageJsonUrl, base, main) { + if (process3.noDeprecation) { + return; + } + const format3 = defaultGetFormatWithoutErrors(url2, { parentURL: base.href }); + if (format3 !== "module") + return; + const urlPath = fileURLToPath5(url2.href); + const pkgPath = fileURLToPath5(new URL3(".", packageJsonUrl)); + const basePath = fileURLToPath5(base); + if (!main) { + process3.emitWarning( + `No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${urlPath.slice( + pkgPath.length + )}", imported from ${basePath}. +Default "index" lookups for the main are deprecated for ES modules.`, + "DeprecationWarning", + "DEP0151" + ); + } else if (path6.resolve(pkgPath, main) !== urlPath) { + process3.emitWarning( + `Package ${pkgPath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice( + pkgPath.length + )}", imported from ${basePath}. + Automatic extension resolution of the "main" field is deprecated for ES modules.`, + "DeprecationWarning", + "DEP0151" + ); + } +} +function tryStatSync(path13) { + try { + return statSync(path13); + } catch { + return new Stats(); + } +} +function fileExists(url2) { + const stats = statSync(url2, { throwIfNoEntry: false }); + const isFile2 = stats ? stats.isFile() : void 0; + return isFile2 === null || isFile2 === void 0 ? false : isFile2; +} +function legacyMainResolve(packageJsonUrl, packageConfig, base) { + let guess; + if (packageConfig.main !== void 0) { + guess = new URL3(packageConfig.main, packageJsonUrl); + if (fileExists(guess)) + return guess; + const tries2 = [ + `./${packageConfig.main}.js`, + `./${packageConfig.main}.json`, + `./${packageConfig.main}.node`, + `./${packageConfig.main}/index.js`, + `./${packageConfig.main}/index.json`, + `./${packageConfig.main}/index.node` + ]; + let i2 = -1; + while (++i2 < tries2.length) { + guess = new URL3(tries2[i2], packageJsonUrl); + if (fileExists(guess)) + break; + guess = void 0; } - }, - "useTabs": { - "category": "Global", - "type": "boolean", - "default": false, - "description": "Indent with tabs instead of spaces." - }, - "embeddedLanguageFormatting": { - "category": "Global", - "type": "choice", - "default": "auto", - "description": "Control how Prettier formats quoted code embedded in the file.", - "choices": [ - { - "value": "auto", - "description": "Format embedded code if Prettier can automatically identify it." - }, - { - "value": "off", - "description": "Never automatically format embedded code." - } - ] + if (guess) { + emitLegacyIndexDeprecation( + guess, + packageJsonUrl, + base, + packageConfig.main + ); + return guess; + } + } + const tries = ["./index.js", "./index.json", "./index.node"]; + let i = -1; + while (++i < tries.length) { + guess = new URL3(tries[i], packageJsonUrl); + if (fileExists(guess)) + break; + guess = void 0; + } + if (guess) { + emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); + return guess; + } + throw new ERR_MODULE_NOT_FOUND( + fileURLToPath5(new URL3(".", packageJsonUrl)), + fileURLToPath5(base) + ); +} +function finalizeResolution(resolved, base, preserveSymlinks) { + if (encodedSepRegEx.exec(resolved.pathname) !== null) { + throw new ERR_INVALID_MODULE_SPECIFIER( + resolved.pathname, + 'must not include encoded "/" or "\\" characters', + fileURLToPath5(base) + ); + } + let filePath; + try { + filePath = fileURLToPath5(resolved); + } catch (error) { + const cause = ( + /** @type {ErrnoException} */ + error + ); + Object.defineProperty(cause, "input", { value: String(resolved) }); + Object.defineProperty(cause, "module", { value: String(base) }); + throw cause; + } + const stats = tryStatSync( + filePath.endsWith("/") ? filePath.slice(-1) : filePath + ); + if (stats.isDirectory()) { + const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath5(base)); + error.url = String(resolved); + throw error; + } + if (!stats.isFile()) { + const error = new ERR_MODULE_NOT_FOUND( + filePath || resolved.pathname, + base && fileURLToPath5(base), + true + ); + error.url = String(resolved); + throw error; + } + if (!preserveSymlinks) { + const real = realpathSync(filePath); + const { search, hash } = resolved; + resolved = pathToFileURL3(real + (filePath.endsWith(path6.sep) ? "/" : "")); + resolved.search = search; + resolved.hash = hash; } -}; - -// src/main/support.js -function getSupportInfo({ - plugins = [], - showDeprecated = false -} = {}) { - const languages2 = plugins.flatMap((plugin) => plugin.languages ?? []); - const options8 = []; - for (const option of normalizeOptionSettings(Object.assign({}, ...plugins.map(({ - options: options9 - }) => options9), core_options_evaluate_default))) { - if (!showDeprecated && option.deprecated) { - continue; - } - if (Array.isArray(option.choices)) { - if (!showDeprecated) { - option.choices = option.choices.filter((choice) => !choice.deprecated); + return resolved; +} +function importNotDefined(specifier, packageJsonUrl, base) { + return new ERR_PACKAGE_IMPORT_NOT_DEFINED( + specifier, + packageJsonUrl && fileURLToPath5(new URL3(".", packageJsonUrl)), + fileURLToPath5(base) + ); +} +function exportsNotFound(subpath, packageJsonUrl, base) { + return new ERR_PACKAGE_PATH_NOT_EXPORTED( + fileURLToPath5(new URL3(".", packageJsonUrl)), + subpath, + base && fileURLToPath5(base) + ); +} +function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) { + const reason = `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath5(packageJsonUrl)}`; + throw new ERR_INVALID_MODULE_SPECIFIER( + request, + reason, + base && fileURLToPath5(base) + ); +} +function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) { + target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`; + return new ERR_INVALID_PACKAGE_TARGET( + fileURLToPath5(new URL3(".", packageJsonUrl)), + subpath, + target, + internal, + base && fileURLToPath5(base) + ); +} +function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) { + if (subpath !== "" && !pattern && target[target.length - 1] !== "/") + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); + if (!target.startsWith("./")) { + if (internal && !target.startsWith("../") && !target.startsWith("/")) { + let isURL2 = false; + try { + new URL3(target); + isURL2 = true; + } catch { } - if (option.name === "parser") { - option.choices = [...option.choices, ...collectParsersFromLanguages(option.choices, languages2, plugins)]; + if (!isURL2) { + const exportTarget = pattern ? RegExpPrototypeSymbolReplace.call( + patternRegEx, + target, + () => subpath + ) : target + subpath; + return packageResolve(exportTarget, packageJsonUrl, conditions); } } - option.pluginDefaults = Object.fromEntries(plugins.filter((plugin) => { - var _a; - return ((_a = plugin.defaultOptions) == null ? void 0 : _a[option.name]) !== void 0; - }).map((plugin) => [plugin.name, plugin.defaultOptions[option.name]])); - options8.push(option); + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); } - return { - languages: languages2, - options: options8 - }; -} -function* collectParsersFromLanguages(parserChoices, languages2, plugins) { - const existingParsers = new Set(parserChoices.map((choice) => choice.value)); - for (const language of languages2) { - if (language.parsers) { - for (const parserName of language.parsers) { - if (!existingParsers.has(parserName)) { - existingParsers.add(parserName); - const plugin = plugins.find((plugin2) => plugin2.parsers && Object.prototype.hasOwnProperty.call(plugin2.parsers, parserName)); - let description = language.name; - if (plugin == null ? void 0 : plugin.name) { - description += ` (plugin: ${plugin.name})`; - } - yield { - value: parserName, - description - }; - } + if (invalidSegmentRegEx.exec(target.slice(2)) !== null) { + if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) { + if (!isPathMap) { + const request = pattern ? match.replace("*", () => subpath) : match + subpath; + const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call( + patternRegEx, + target, + () => subpath + ) : target; + emitInvalidSegmentDeprecation( + resolvedTarget, + request, + match, + packageJsonUrl, + internal, + base, + true + ); } + } else { + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); } } -} -function normalizeOptionSettings(settings) { - const options8 = []; - for (const [name, originalOption] of Object.entries(settings)) { - const option = { - name, - ...originalOption - }; - if (Array.isArray(option.default)) { - option.default = at_default( - /* isOptionalObject*/ - false, - option.default, - -1 - ).value; + const resolved = new URL3(target, packageJsonUrl); + const resolvedPath = resolved.pathname; + const packagePath = new URL3(".", packageJsonUrl).pathname; + if (!resolvedPath.startsWith(packagePath)) + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); + if (subpath === "") + return resolved; + if (invalidSegmentRegEx.exec(subpath) !== null) { + const request = pattern ? match.replace("*", () => subpath) : match + subpath; + if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) { + if (!isPathMap) { + const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call( + patternRegEx, + target, + () => subpath + ) : target; + emitInvalidSegmentDeprecation( + resolvedTarget, + request, + match, + packageJsonUrl, + internal, + base, + false + ); + } + } else { + throwInvalidSubpath(request, match, packageJsonUrl, internal, base); } - options8.push(option); } - return options8; + if (pattern) { + return new URL3( + RegExpPrototypeSymbolReplace.call( + patternRegEx, + resolved.href, + () => subpath + ) + ); + } + return new URL3(subpath, resolved); } - -// src/utils/get-interpreter.js -var import_n_readlines = __toESM(require_readlines(), 1); -import fs from "fs"; -function getInterpreter(file) { - let fd; - try { - fd = fs.openSync(file, "r"); - } catch { - return; +function isArrayIndex(key2) { + const keyNumber = Number(key2); + if (`${keyNumber}` !== key2) + return false; + return keyNumber >= 0 && keyNumber < 4294967295; +} +function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) { + if (typeof target === "string") { + return resolvePackageTargetString( + target, + subpath, + packageSubpath, + packageJsonUrl, + base, + pattern, + internal, + isPathMap, + conditions + ); } - try { - const liner = new import_n_readlines.default(fd); - const firstLine = liner.next().toString("utf8"); - const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/); - if (m1) { - return m1[1]; + if (Array.isArray(target)) { + const targetList = target; + if (targetList.length === 0) + return null; + let lastException; + let i = -1; + while (++i < targetList.length) { + const targetItem = targetList[i]; + let resolveResult; + try { + resolveResult = resolvePackageTarget( + packageJsonUrl, + targetItem, + subpath, + packageSubpath, + base, + pattern, + internal, + isPathMap, + conditions + ); + } catch (error) { + const exception2 = ( + /** @type {ErrnoException} */ + error + ); + lastException = exception2; + if (exception2.code === "ERR_INVALID_PACKAGE_TARGET") + continue; + throw error; + } + if (resolveResult === void 0) + continue; + if (resolveResult === null) { + lastException = null; + continue; + } + return resolveResult; } - const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/); - if (m2) { - return m2[1]; + if (lastException === void 0 || lastException === null) { + return null; + } + throw lastException; + } + if (typeof target === "object" && target !== null) { + const keys = Object.getOwnPropertyNames(target); + let i = -1; + while (++i < keys.length) { + const key2 = keys[i]; + if (isArrayIndex(key2)) { + throw new ERR_INVALID_PACKAGE_CONFIG2( + fileURLToPath5(packageJsonUrl), + base, + '"exports" cannot contain numeric property keys.' + ); + } } - } finally { - try { - fs.closeSync(fd); - } catch { + i = -1; + while (++i < keys.length) { + const key2 = keys[i]; + if (key2 === "default" || conditions && conditions.has(key2)) { + const conditionalTarget = ( + /** @type {unknown} */ + target[key2] + ); + const resolveResult = resolvePackageTarget( + packageJsonUrl, + conditionalTarget, + subpath, + packageSubpath, + base, + pattern, + internal, + isPathMap, + conditions + ); + if (resolveResult === void 0) + continue; + return resolveResult; + } } + return null; } -} -var get_interpreter_default = getInterpreter; - -// src/utils/infer-parser.js -var getFileBasename = (file) => String(file).split(/[/\\]/).pop(); -function getLanguageByFileName(languages2, file) { - if (!file) { - return; + if (target === null) { + return null; } - const basename = getFileBasename(file).toLowerCase(); - return languages2.find( - (language) => { - var _a, _b; - return ((_a = language.extensions) == null ? void 0 : _a.some((extension) => basename.endsWith(extension))) || ((_b = language.filenames) == null ? void 0 : _b.some((name) => name.toLowerCase() === basename)); - } + throw invalidPackageTarget( + packageSubpath, + target, + packageJsonUrl, + internal, + base ); } -function getLanguageByName(languages2, languageName) { - if (!languageName) { - return; +function isConditionalExportsMainSugar(exports, packageJsonUrl, base) { + if (typeof exports === "string" || Array.isArray(exports)) + return true; + if (typeof exports !== "object" || exports === null) + return false; + const keys = Object.getOwnPropertyNames(exports); + let isConditionalSugar = false; + let i = 0; + let j = -1; + while (++j < keys.length) { + const key2 = keys[j]; + const curIsConditionalSugar = key2 === "" || key2[0] !== "."; + if (i++ === 0) { + isConditionalSugar = curIsConditionalSugar; + } else if (isConditionalSugar !== curIsConditionalSugar) { + throw new ERR_INVALID_PACKAGE_CONFIG2( + fileURLToPath5(packageJsonUrl), + base, + `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.` + ); + } } - return languages2.find(({ name }) => name.toLowerCase() === languageName) ?? languages2.find(({ aliases }) => aliases == null ? void 0 : aliases.includes(languageName)) ?? languages2.find(({ extensions }) => extensions == null ? void 0 : extensions.includes(`.${languageName}`)); + return isConditionalSugar; } -function getLanguageByInterpreter(languages2, file) { - if (!file || getFileBasename(file).includes(".")) { +function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) { + if (process3.noDeprecation) { return; } - const interpreter = get_interpreter_default(file); - if (!interpreter) { + const pjsonPath = fileURLToPath5(pjsonUrl); + if (emittedPackageWarnings.has(pjsonPath + "|" + match)) return; - } - return languages2.find( - (language) => { - var _a; - return (_a = language.interpreters) == null ? void 0 : _a.includes(interpreter); - } - ); -} -function inferParser(options8, fileInfo) { - const languages2 = options8.plugins.flatMap( - (plugin) => ( - // @ts-expect-error -- Safe - plugin.languages ?? [] - ) + emittedPackageWarnings.add(pjsonPath + "|" + match); + process3.emitWarning( + `Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath5(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, + "DeprecationWarning", + "DEP0155" ); - const language = getLanguageByName(languages2, fileInfo.language) ?? getLanguageByFileName(languages2, fileInfo.physicalFile) ?? getLanguageByFileName(languages2, fileInfo.file) ?? getLanguageByInterpreter(languages2, fileInfo.physicalFile); - return language == null ? void 0 : language.parsers[0]; -} -var infer_parser_default = inferParser; - -// src/main/normalize-options.js -var hasDeprecationWarned; -function normalizeOptions(options8, optionInfos, { - logger = false, - isCLI = false, - passThrough = false, - FlagSchema, - descriptor -} = {}) { - if (isCLI) { - if (!FlagSchema) { - throw new Error("'FlagSchema' option is required."); - } - if (!descriptor) { - throw new Error("'descriptor' option is required."); - } - } else { - descriptor = apiDescriptor; - } - const unknown = !passThrough ? (key, value, options9) => { - const { - _, - ...schemas2 - } = options9.schemas; - return levenUnknownHandler(key, value, { - ...options9, - schemas: schemas2 - }); - } : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? void 0 : { - [key]: value - } : (key, value) => ({ - [key]: value - }); - const schemas = optionInfosToSchemas(optionInfos, { - isCLI, - FlagSchema - }); - const normalizer = new Normalizer(schemas, { - logger, - unknown, - descriptor - }); - const shouldSuppressDuplicateDeprecationWarnings = logger !== false; - if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) { - normalizer._hasDeprecationWarned = hasDeprecationWarned; - } - const normalized = normalizer.normalize(options8); - if (shouldSuppressDuplicateDeprecationWarnings) { - hasDeprecationWarned = normalizer._hasDeprecationWarned; - } - return normalized; } -function optionInfosToSchemas(optionInfos, { - isCLI, - FlagSchema -}) { - const schemas = []; - if (isCLI) { - schemas.push(AnySchema.create({ - name: "_" - })); +function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) { + let exports = packageConfig.exports; + if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) { + exports = { ".": exports }; } - for (const optionInfo of optionInfos) { - schemas.push(optionInfoToSchema(optionInfo, { - isCLI, - optionInfos, - FlagSchema - })); - if (optionInfo.alias && isCLI) { - schemas.push(AliasSchema.create({ - // @ts-expect-error - name: optionInfo.alias, - sourceName: optionInfo.name - })); + if (own2.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) { + const target = exports[packageSubpath]; + const resolveResult = resolvePackageTarget( + packageJsonUrl, + target, + "", + packageSubpath, + base, + false, + false, + false, + conditions + ); + if (resolveResult === null || resolveResult === void 0) { + throw exportsNotFound(packageSubpath, packageJsonUrl, base); } + return resolveResult; } - return schemas; -} -function optionInfoToSchema(optionInfo, { - isCLI, - optionInfos, - FlagSchema -}) { - const { - name - } = optionInfo; - const parameters = { - name - }; - let SchemaConstructor; - const handlers = {}; - switch (optionInfo.type) { - case "int": - SchemaConstructor = IntegerSchema; - if (isCLI) { - parameters.preprocess = Number; + let bestMatch = ""; + let bestMatchSubpath = ""; + const keys = Object.getOwnPropertyNames(exports); + let i = -1; + while (++i < keys.length) { + const key2 = keys[i]; + const patternIndex = key2.indexOf("*"); + if (patternIndex !== -1 && packageSubpath.startsWith(key2.slice(0, patternIndex))) { + if (packageSubpath.endsWith("/")) { + emitTrailingSlashPatternDeprecation( + packageSubpath, + packageJsonUrl, + base + ); } - break; - case "string": - SchemaConstructor = StringSchema; - break; - case "choice": - SchemaConstructor = ChoiceSchema; - parameters.choices = optionInfo.choices.map((choiceInfo) => (choiceInfo == null ? void 0 : choiceInfo.redirect) ? { - ...choiceInfo, - redirect: { - to: { - key: optionInfo.name, - value: choiceInfo.redirect - } - } - } : choiceInfo); - break; - case "boolean": - SchemaConstructor = BooleanSchema; - break; - case "flag": - SchemaConstructor = FlagSchema; - parameters.flags = optionInfos.flatMap((optionInfo2) => [optionInfo2.alias, optionInfo2.description && optionInfo2.name, optionInfo2.oppositeDescription && `no-${optionInfo2.name}`].filter(Boolean)); - break; - case "path": - SchemaConstructor = StringSchema; - break; - default: - throw new Error(`Unexpected type ${optionInfo.type}`); - } - if (optionInfo.exception) { - parameters.validate = (value, schema, utils) => optionInfo.exception(value) || schema.validate(value, utils); - } else { - parameters.validate = (value, schema, utils) => value === void 0 || schema.validate(value, utils); - } - if (optionInfo.redirect) { - handlers.redirect = (value) => !value ? void 0 : { - to: { - key: optionInfo.redirect.option, - value: optionInfo.redirect.value + const patternTrailer = key2.slice(patternIndex + 1); + if (packageSubpath.length >= key2.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key2) === 1 && key2.lastIndexOf("*") === patternIndex) { + bestMatch = key2; + bestMatchSubpath = packageSubpath.slice( + patternIndex, + packageSubpath.length - patternTrailer.length + ); } - }; - } - if (optionInfo.deprecated) { - handlers.deprecated = true; + } } - if (isCLI && !optionInfo.array) { - const originalPreprocess = parameters.preprocess || ((x) => x); - parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? at_default( - /* isOptionalObject*/ + if (bestMatch) { + const target = ( + /** @type {unknown} */ + exports[bestMatch] + ); + const resolveResult = resolvePackageTarget( + packageJsonUrl, + target, + bestMatchSubpath, + bestMatch, + base, + true, false, - value, - -1 - ) : value), utils); + packageSubpath.endsWith("/"), + conditions + ); + if (resolveResult === null || resolveResult === void 0) { + throw exportsNotFound(packageSubpath, packageJsonUrl, base); + } + return resolveResult; } - return optionInfo.array ? ArraySchema.create({ - ...isCLI ? { - preprocess: (v) => Array.isArray(v) ? v : [v] - } : {}, - ...handlers, - // @ts-expect-error - valueSchema: SchemaConstructor.create(parameters) - }) : SchemaConstructor.create({ - ...parameters, - ...handlers - }); + throw exportsNotFound(packageSubpath, packageJsonUrl, base); } -var normalize_options_default = normalizeOptions; - -// src/main/parser-and-printer.js -function getParserPluginByParserName(plugins, parserName) { - if (!parserName) { - throw new Error("parserName is required."); +function patternKeyCompare(a, b) { + const aPatternIndex = a.indexOf("*"); + const bPatternIndex = b.indexOf("*"); + const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1; + const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1; + if (baseLengthA > baseLengthB) + return -1; + if (baseLengthB > baseLengthA) + return 1; + if (aPatternIndex === -1) + return 1; + if (bPatternIndex === -1) + return -1; + if (a.length > b.length) + return -1; + if (b.length > a.length) + return 1; + return 0; +} +function packageImportsResolve(name, base, conditions) { + if (name === "#" || name.startsWith("#/") || name.endsWith("/")) { + const reason = "is not a valid internal imports specifier name"; + throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath5(base)); } - for (let index = plugins.length - 1; index >= 0; index--) { - const plugin = plugins[index]; - if (plugin.parsers && Object.prototype.hasOwnProperty.call(plugin.parsers, parserName)) { - return plugin; + let packageJsonUrl; + const packageConfig = getPackageScopeConfig(base); + if (packageConfig.exists) { + packageJsonUrl = pathToFileURL3(packageConfig.pjsonPath); + const imports = packageConfig.imports; + if (imports) { + if (own2.call(imports, name) && !name.includes("*")) { + const resolveResult = resolvePackageTarget( + packageJsonUrl, + imports[name], + "", + name, + base, + false, + true, + false, + conditions + ); + if (resolveResult !== null && resolveResult !== void 0) { + return resolveResult; + } + } else { + let bestMatch = ""; + let bestMatchSubpath = ""; + const keys = Object.getOwnPropertyNames(imports); + let i = -1; + while (++i < keys.length) { + const key2 = keys[i]; + const patternIndex = key2.indexOf("*"); + if (patternIndex !== -1 && name.startsWith(key2.slice(0, -1))) { + const patternTrailer = key2.slice(patternIndex + 1); + if (name.length >= key2.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key2) === 1 && key2.lastIndexOf("*") === patternIndex) { + bestMatch = key2; + bestMatchSubpath = name.slice( + patternIndex, + name.length - patternTrailer.length + ); + } + } + } + if (bestMatch) { + const target = imports[bestMatch]; + const resolveResult = resolvePackageTarget( + packageJsonUrl, + target, + bestMatchSubpath, + bestMatch, + base, + true, + true, + false, + conditions + ); + if (resolveResult !== null && resolveResult !== void 0) { + return resolveResult; + } + } + } } } - let message = `Couldn't resolve parser "${parserName}".`; - if (false) { - message += " Plugins must be explicitly added to the standalone bundle."; + throw importNotDefined(name, packageJsonUrl, base); +} +function parsePackageName(specifier, base) { + let separatorIndex = specifier.indexOf("/"); + let validPackageName = true; + let isScoped = false; + if (specifier[0] === "@") { + isScoped = true; + if (separatorIndex === -1 || specifier.length === 0) { + validPackageName = false; + } else { + separatorIndex = specifier.indexOf("/", separatorIndex + 1); + } } - throw new ConfigError(message); + const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex); + if (invalidPackageNameRegEx.exec(packageName) !== null) { + validPackageName = false; + } + if (!validPackageName) { + throw new ERR_INVALID_MODULE_SPECIFIER( + specifier, + "is not a valid package name", + fileURLToPath5(base) + ); + } + const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex)); + return { packageName, packageSubpath, isScoped }; } -function getPrinterPluginByAstFormat(plugins, astFormat) { - if (!astFormat) { - throw new Error("astFormat is required."); +function packageResolve(specifier, base, conditions) { + if (builtinModules.includes(specifier)) { + return new URL3("node:" + specifier); } - for (let index = plugins.length - 1; index >= 0; index--) { - const plugin = plugins[index]; - if (plugin.printers && Object.prototype.hasOwnProperty.call(plugin.printers, astFormat)) { - return plugin; + const { packageName, packageSubpath, isScoped } = parsePackageName( + specifier, + base + ); + const packageConfig = getPackageScopeConfig(base); + if (packageConfig.exists) { + const packageJsonUrl2 = pathToFileURL3(packageConfig.pjsonPath); + if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) { + return packageExportsResolve( + packageJsonUrl2, + packageSubpath, + packageConfig, + base, + conditions + ); } } - let message = `Couldn't find plugin for AST format "${astFormat}".`; - if (false) { - message += " Plugins must be explicitly added to the standalone bundle."; - } - throw new ConfigError(message); + let packageJsonUrl = new URL3( + "./node_modules/" + packageName + "/package.json", + base + ); + let packageJsonPath = fileURLToPath5(packageJsonUrl); + let lastPath; + do { + const stat = tryStatSync(packageJsonPath.slice(0, -13)); + if (!stat.isDirectory()) { + lastPath = packageJsonPath; + packageJsonUrl = new URL3( + (isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", + packageJsonUrl + ); + packageJsonPath = fileURLToPath5(packageJsonUrl); + continue; + } + const packageConfig2 = package_json_reader_default.read(packageJsonPath, { + base, + specifier + }); + if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) { + return packageExportsResolve( + packageJsonUrl, + packageSubpath, + packageConfig2, + base, + conditions + ); + } + if (packageSubpath === ".") { + return legacyMainResolve(packageJsonUrl, packageConfig2, base); + } + return new URL3(packageSubpath, packageJsonUrl); + } while (packageJsonPath.length !== lastPath.length); + throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath5(base), false); } -function resolveParser({ - plugins, - parser -}) { - const plugin = getParserPluginByParserName(plugins, parser); - return initParser(plugin, parser); +function isRelativeSpecifier(specifier) { + if (specifier[0] === ".") { + if (specifier.length === 1 || specifier[1] === "/") + return true; + if (specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/")) { + return true; + } + } + return false; } -function initParser(plugin, parserName) { - const parserOrParserInitFunction = plugin.parsers[parserName]; - return typeof parserOrParserInitFunction === "function" ? parserOrParserInitFunction() : parserOrParserInitFunction; +function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { + if (specifier === "") + return false; + if (specifier[0] === "/") + return true; + return isRelativeSpecifier(specifier); } -function initPrinter(plugin, astFormat) { - const printerOrPrinterInitFunction = plugin.printers[astFormat]; - return typeof printerOrPrinterInitFunction === "function" ? printerOrPrinterInitFunction() : printerOrPrinterInitFunction; +function moduleResolve(specifier, base, conditions, preserveSymlinks) { + const protocol = base.protocol; + const isRemote = protocol === "http:" || protocol === "https:"; + let resolved; + if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { + resolved = new URL3(specifier, base); + } else if (!isRemote && specifier[0] === "#") { + resolved = packageImportsResolve(specifier, base, conditions); + } else { + try { + resolved = new URL3(specifier); + } catch { + if (!isRemote) { + resolved = packageResolve(specifier, base, conditions); + } + } + } + assert3(resolved !== void 0, "expected to be defined"); + if (resolved.protocol !== "file:") { + return resolved; + } + return finalizeResolution(resolved, base, preserveSymlinks); } - -// src/main/normalize-format-options.js -var formatOptionsHiddenDefaults = { - astFormat: "estree", - printer: {}, - originalText: void 0, - locStart: null, - locEnd: null -}; -async function normalizeFormatOptions(options8, opts = {}) { - var _a; - const rawOptions = { ...options8 }; - if (!rawOptions.parser) { - if (!rawOptions.filepath) { - throw new UndefinedParserError( - "No parser and no file path given, couldn't infer a parser." - ); - } else { - rawOptions.parser = infer_parser_default(rawOptions, { - physicalFile: rawOptions.filepath - }); - if (!rawOptions.parser) { - throw new UndefinedParserError( - `No parser could be inferred for file "${rawOptions.filepath}".` +function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { + if (parsedParentURL) { + const parentProtocol = parsedParentURL.protocol; + if (parentProtocol === "http:" || parentProtocol === "https:") { + if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { + const parsedProtocol = parsed == null ? void 0 : parsed.protocol; + if (parsedProtocol && parsedProtocol !== "https:" && parsedProtocol !== "http:") { + throw new ERR_NETWORK_IMPORT_DISALLOWED( + specifier, + parsedParentURL, + "remote imports cannot import from a local location." + ); + } + return { url: (parsed == null ? void 0 : parsed.href) || "" }; + } + if (builtinModules.includes(specifier)) { + throw new ERR_NETWORK_IMPORT_DISALLOWED( + specifier, + parsedParentURL, + "remote imports cannot import from a local location." ); } + throw new ERR_NETWORK_IMPORT_DISALLOWED( + specifier, + parsedParentURL, + "only relative and absolute specifiers are supported." + ); } } - const supportOptions = getSupportInfo({ - plugins: options8.plugins, - showDeprecated: true - }).options; - const defaults = { - ...formatOptionsHiddenDefaults, - ...Object.fromEntries( - supportOptions.filter((optionInfo) => optionInfo.default !== void 0).map((option) => [option.name, option.default]) - ) - }; - const parserPlugin = getParserPluginByParserName( - rawOptions.plugins, - rawOptions.parser +} +function isURL(self) { + return Boolean( + self && typeof self === "object" && "href" in self && typeof self.href === "string" && "protocol" in self && typeof self.protocol === "string" && self.href && self.protocol ); - const parser = await initParser(parserPlugin, rawOptions.parser); - rawOptions.astFormat = parser.astFormat; - rawOptions.locEnd = parser.locEnd; - rawOptions.locStart = parser.locStart; - const printerPlugin = ((_a = parserPlugin.printers) == null ? void 0 : _a[parser.astFormat]) ? parserPlugin : getPrinterPluginByAstFormat(rawOptions.plugins, parser.astFormat); - const printer = await initPrinter(printerPlugin, parser.astFormat); - rawOptions.printer = printer; - const pluginDefaults = printerPlugin.defaultOptions ? Object.fromEntries( - Object.entries(printerPlugin.defaultOptions).filter( - ([, value]) => value !== void 0 - ) - ) : {}; - const mixedDefaults = { ...defaults, ...pluginDefaults }; - for (const [k, value] of Object.entries(mixedDefaults)) { - if (rawOptions[k] === null || rawOptions[k] === void 0) { - rawOptions[k] = value; - } +} +function throwIfInvalidParentURL(parentURL) { + if (parentURL === void 0) { + return; } - if (rawOptions.parser === "json") { - rawOptions.trailingComma = "none"; + if (typeof parentURL !== "string" && !isURL(parentURL)) { + throw new codes.ERR_INVALID_ARG_TYPE( + "parentURL", + ["string", "URL"], + parentURL + ); } - return normalize_options_default(rawOptions, supportOptions, { - passThrough: Object.keys(formatOptionsHiddenDefaults), - ...opts - }); -} -var normalize_format_options_default = normalizeFormatOptions; - -// src/main/create-get-visitor-keys-function.js -var nonTraversableKeys = /* @__PURE__ */ new Set([ - "tokens", - "comments", - "parent", - "enclosingNode", - "precedingNode", - "followingNode" -]); -var defaultGetVisitorKeys = (node) => Object.keys(node).filter((key) => !nonTraversableKeys.has(key)); -function createGetVisitorKeysFunction(printerGetVisitorKeys) { - return printerGetVisitorKeys ? (node) => printerGetVisitorKeys(node, nonTraversableKeys) : defaultGetVisitorKeys; } -var create_get_visitor_keys_function_default = createGetVisitorKeysFunction; - -// src/main/massage-ast.js -function massageAst(ast, options8) { - const { - printer: { - massageAstNode: cleanFunction, - getVisitorKeys: printerGetVisitorKeys +function defaultResolve(specifier, context = {}) { + const { parentURL } = context; + assert3(parentURL !== void 0, "expected `parentURL` to be defined"); + throwIfInvalidParentURL(parentURL); + let parsedParentURL; + if (parentURL) { + try { + parsedParentURL = new URL3(parentURL); + } catch { } - } = options8; - if (!cleanFunction) { - return ast; } - const getVisitorKeys = create_get_visitor_keys_function_default(printerGetVisitorKeys); - const ignoredProperties = cleanFunction.ignoredProperties ?? /* @__PURE__ */ new Set(); - return recurse(ast); - function recurse(node, parent) { - if (!(node !== null && typeof node === "object")) { - return node; - } - if (Array.isArray(node)) { - return node.map((child) => recurse(child, parent)).filter(Boolean); - } - const newObj = {}; - const childrenKeys = new Set(getVisitorKeys(node)); - for (const key in node) { - if (!Object.prototype.hasOwnProperty.call(node, key) || ignoredProperties.has(key)) { - continue; - } - if (childrenKeys.has(key)) { - newObj[key] = recurse(node[key], node); - } else { - newObj[key] = node[key]; - } - } - const result = cleanFunction(node, newObj, parent); - if (result === null) { - return; + let parsed; + try { + parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier) ? new URL3(specifier, parsedParentURL) : new URL3(specifier); + const protocol = parsed.protocol; + if (protocol === "data:") { + return { url: parsed.href, format: null }; } - return result ?? newObj; + } catch { } + const maybeReturn = checkIfDisallowedImport( + specifier, + parsed, + parsedParentURL + ); + if (maybeReturn) + return maybeReturn; + if (parsed && parsed.protocol === "node:") + return { url: specifier }; + const conditions = getConditionsSet(context.conditions); + const url2 = moduleResolve(specifier, new URL3(parentURL), conditions, false); + return { + // Do NOT cast `url` to a string: that will work even when there are real + // problems, silencing them + url: url2.href, + format: defaultGetFormatWithoutErrors(url2, { parentURL }) + }; } -var massage_ast_default = massageAst; -// src/main/parse.js -var import_code_frame = __toESM(require_lib3(), 1); -async function parse(originalText, options8) { - const parser = await resolveParser(options8); - const text = parser.preprocess ? parser.preprocess(originalText, options8) : originalText; - options8.originalText = text; - let ast; - try { - ast = await parser.parse( - text, - options8, - // TODO: remove the third argument in v4 - // The duplicated argument is passed as intended, see #10156 - options8 +// node_modules/import-meta-resolve/index.js +function resolve2(specifier, parent) { + if (!parent) { + throw new Error( + "Please pass `parent`: `import-meta-resolve` cannot ponyfill that" ); - } catch (error) { - handleParseError(error, originalText); } - return { text, ast }; -} -function handleParseError(error, text) { - const { loc } = error; - if (loc) { - const codeFrame = (0, import_code_frame.codeFrameColumns)(text, loc, { highlightCode: true }); - error.message += "\n" + codeFrame; - error.codeFrame = codeFrame; + try { + return defaultResolve(specifier, { parentURL: parent }).url; + } catch (error) { + const exception2 = ( + /** @type {ErrnoException} */ + error + ); + if ((exception2.code === "ERR_UNSUPPORTED_DIR_IMPORT" || exception2.code === "ERR_MODULE_NOT_FOUND") && typeof exception2.url === "string") { + return exception2.url; + } throw error; } - throw error; } -var parse_default = parse; -// src/common/ast-path.js -var _getNodeStackIndex, getNodeStackIndex_fn, _getAncestors, getAncestors_fn; -var AstPath = class { - constructor(value) { - __privateAdd(this, _getNodeStackIndex); - __privateAdd(this, _getAncestors); - this.stack = [value]; - } - /** @type {string | null} */ - get key() { - const { - stack, - siblings - } = this; - return at_default( - /* isOptionalObject*/ - false, - stack, - siblings === null ? -2 : -4 - ) ?? null; +// src/utils/import-from-file.js +function importFromFile(specifier, parent) { + const url2 = resolve2(specifier, pathToFileURL4(parent).href); + return import(url2); +} +var import_from_file_default = importFromFile; + +// src/utils/require-from-file.js +import { createRequire } from "module"; +function requireFromFile(id, parent) { + const require2 = createRequire(parent); + return require2(id); +} +var require_from_file_default = requireFromFile; + +// src/config/prettier-config/load-external-config.js +var requireErrorCodesShouldBeIgnored = /* @__PURE__ */ new Set([ + "MODULE_NOT_FOUND", + "ERR_REQUIRE_ESM", + "ERR_PACKAGE_PATH_NOT_EXPORTED" +]); +async function loadExternalConfig(externalConfig, configFile) { + try { + return require_from_file_default(externalConfig, configFile); + } catch (error) { + if (!requireErrorCodesShouldBeIgnored.has(error == null ? void 0 : error.code)) { + throw error; + } } - /** @type {number | null} */ - get index() { - return this.siblings === null ? null : at_default( - /* isOptionalObject*/ - false, - this.stack, - -2 + const module = await import_from_file_default(externalConfig, configFile); + return module.default; +} +var load_external_config_default = loadExternalConfig; + +// src/config/prettier-config/load-config.js +async function loadConfig(configFile) { + const { base: fileName, ext: extension } = path7.parse(configFile); + const load2 = fileName === "package.json" ? loadConfigFromPackageJson : loaders_default[extension]; + if (!load2) { + throw new Error( + `No loader specified for extension "${extension || "noExt"}"` ); } - /** @type {object} */ - get node() { - return at_default( - /* isOptionalObject*/ - false, - this.stack, - -1 - ); + let config = await load2(configFile); + if (!config) { + return; } - /** @type {object | null} */ - get parent() { - return this.getNode(1); + if (typeof config === "string") { + config = await load_external_config_default(config, configFile); } - /** @type {object | null} */ - get grandparent() { - return this.getNode(2); + if (typeof config !== "object") { + throw new TypeError( + `Config is only allowed to be an object, but received ${typeof config} in "${configFile}"` + ); } - /** @type {boolean} */ - get isInArray() { - return this.siblings !== null; + delete config.$schema; + return config; +} +var load_config_default = loadConfig; + +// src/config/prettier-config/index.js +var loadCache = /* @__PURE__ */ new Map(); +var searchCache = /* @__PURE__ */ new Map(); +function clearPrettierConfigCache() { + loadCache.clear(); + searchCache.clear(); +} +function loadPrettierConfig(configFile, { shouldCache }) { + configFile = path8.resolve(configFile); + if (!shouldCache || !loadCache.has(configFile)) { + loadCache.set(configFile, load_config_default(configFile)); } - /** @type {object[] | null} */ - get siblings() { - const { - stack - } = this; - const maybeArray = at_default( - /* isOptionalObject*/ - false, - stack, - -3 - ); - return Array.isArray(maybeArray) ? maybeArray : null; + return loadCache.get(configFile); +} +function getSearchFunction(stopDirectory) { + stopDirectory = stopDirectory ? path8.resolve(stopDirectory) : void 0; + if (!searchCache.has(stopDirectory)) { + const searcher2 = config_searcher_default(stopDirectory); + const searchFunction = searcher2.search.bind(searcher2); + searchCache.set(stopDirectory, searchFunction); + } + return searchCache.get(stopDirectory); +} +function searchPrettierConfig(startDirectory, options8 = {}) { + startDirectory = startDirectory ? path8.resolve(startDirectory) : process.cwd(); + const stopDirectory = mockable_default.getPrettierConfigSearchStopDirectory(); + const search = getSearchFunction(stopDirectory); + return search(startDirectory, { shouldCache: options8.shouldCache }); +} + +// src/config/resolve-config.js +function clearCache() { + clearPrettierConfigCache(); + clearEditorconfigCache(); +} +function loadEditorconfig2(file, options8) { + if (!file || !options8.editorconfig) { + return; } - /** @type {object | null} */ - get next() { - const { - siblings - } = this; - return siblings === null ? null : siblings[this.index + 1]; + const shouldCache = options8.useCache; + return loadEditorconfig(file, { shouldCache }); +} +async function loadPrettierConfig2(file, options8) { + const shouldCache = options8.useCache; + let configFile = options8.config; + if (!configFile) { + const directory = file ? path9.dirname(path9.resolve(file)) : void 0; + configFile = await searchPrettierConfig(directory, { shouldCache }); + } + if (!configFile) { + return; } - /** @type {object | null} */ - get previous() { - const { - siblings - } = this; - return siblings === null ? null : siblings[this.index - 1]; + const config = await loadPrettierConfig(configFile, { shouldCache }); + return { config, configFile }; +} +async function resolveConfig(fileUrlOrPath, options8) { + options8 = { useCache: true, ...options8 }; + const filePath = toPath(fileUrlOrPath); + const [result, editorConfigured] = await Promise.all([ + loadPrettierConfig2(filePath, options8), + loadEditorconfig2(filePath, options8) + ]); + if (!result && !editorConfigured) { + return null; } - /** @type {boolean} */ - get isFirst() { - return this.index === 0; + const merged = { + ...editorConfigured, + ...mergeOverrides(result, filePath) + }; + if (Array.isArray(merged.plugins)) { + merged.plugins = merged.plugins.map( + (value) => typeof value === "string" && value.startsWith(".") ? path9.resolve(path9.dirname(result.configFile), value) : value + ); } - /** @type {boolean} */ - get isLast() { - const { - siblings, - index - } = this; - return siblings !== null && index === siblings.length - 1; + return merged; +} +async function resolveConfigFile(fileUrlOrPath) { + const directory = fileUrlOrPath ? path9.dirname(path9.resolve(toPath(fileUrlOrPath))) : void 0; + const result = await searchPrettierConfig(directory, { shouldCache: false }); + return result ?? null; +} +function mergeOverrides(configResult, filePath) { + const { config, configFile } = configResult || {}; + const { overrides, ...options8 } = config || {}; + if (filePath && overrides) { + const relativeFilePath = path9.relative(path9.dirname(configFile), filePath); + for (const override of overrides) { + if (pathMatchesGlobs( + relativeFilePath, + override.files, + override.excludeFiles + )) { + Object.assign(options8, override.options); + } + } } - /** @type {boolean} */ - get isRoot() { - return this.stack.length === 1; + return options8; +} +function pathMatchesGlobs(filePath, patterns, excludedPatterns) { + const patternList = Array.isArray(patterns) ? patterns : [patterns]; + const [withSlashes, withoutSlashes] = partition_default( + patternList, + (pattern) => pattern.includes("/") + ); + return import_micromatch.default.isMatch(filePath, withoutSlashes, { + ignore: excludedPatterns, + basename: true, + dot: true + }) || import_micromatch.default.isMatch(filePath, withSlashes, { + ignore: excludedPatterns, + basename: false, + dot: true + }); +} + +// scripts/build/shims/string-replace-all.js +var stringReplaceAll2 = (isOptionalObject, original, pattern, replacement) => { + if (isOptionalObject && (original === void 0 || original === null)) { + return; } - /** @type {object} */ - get root() { - return this.stack[0]; + if (original.replaceAll) { + return original.replaceAll(pattern, replacement); } - /** @type {object[]} */ - get ancestors() { - return [...__privateMethod(this, _getAncestors, getAncestors_fn).call(this)]; + if (pattern.global) { + return original.replace(pattern, replacement); } - // The name of the current property is always the penultimate element of - // this.stack, and always a string/number/symbol. - getName() { - const { - stack - } = this; - const { - length - } = stack; - if (length > 1) { - return at_default( - /* isOptionalObject*/ - false, - stack, - -2 - ); - } - return null; + return original.split(pattern).join(replacement); +}; +var string_replace_all_default = stringReplaceAll2; + +// src/utils/ignore.js +var import_ignore = __toESM(require_ignore(), 1); +import path10 from "path"; +import url from "url"; +var createIgnore = import_ignore.default.default; +var slash = path10.sep === "\\" ? (filePath) => string_replace_all_default( + /* isOptionalObject*/ + false, + filePath, + "\\", + "/" +) : (filePath) => filePath; +function getRelativePath(file, ignoreFile) { + const ignoreFilePath = toPath(ignoreFile); + const filePath = isUrl(file) ? url.fileURLToPath(file) : path10.resolve(file); + return path10.relative( + // If there's an ignore-path set, the filename must be relative to the + // ignore path, not the current working directory. + ignoreFilePath ? path10.dirname(ignoreFilePath) : process.cwd(), + filePath + ); +} +async function createSingleIsIgnoredFunction(ignoreFile, withNodeModules) { + let content = ""; + if (ignoreFile) { + content += await read_file_default(ignoreFile) ?? ""; } - // The value of the current property is always the final element of - // this.stack. - getValue() { - return at_default( - /* isOptionalObject*/ - false, - this.stack, - -1 - ); + if (!withNodeModules) { + content += "\nnode_modules"; } - getNode(count = 0) { - const stackIndex = __privateMethod(this, _getNodeStackIndex, getNodeStackIndex_fn).call(this, count); - return stackIndex === -1 ? null : this.stack[stackIndex]; + if (!content) { + return; } - getParentNode(count = 0) { - return this.getNode(count + 1); + const ignore = createIgnore({ + allowRelativePaths: true + }).add(content); + return (file) => ignore.ignores(slash(getRelativePath(file, ignoreFile))); +} +async function createIsIgnoredFunction(ignoreFiles, withNodeModules) { + if (ignoreFiles.length === 0 && !withNodeModules) { + ignoreFiles = [void 0]; } - // Temporarily push properties named by string arguments given after the - // callback function onto this.stack, then call the callback with a - // reference to this (modified) AstPath object. Note that the stack will - // be restored to its original state after the callback is finished, so it - // is probably a mistake to retain a reference to the path. - call(callback, ...names) { - const { - stack - } = this; - const { - length - } = stack; - let value = at_default( - /* isOptionalObject*/ - false, - stack, - -1 - ); - for (const name of names) { - value = value[name]; - stack.push(name, value); - } - try { - return callback(this); - } finally { - stack.length = length; - } + const isIgnoredFunctions = (await Promise.all(ignoreFiles.map((ignoreFile) => createSingleIsIgnoredFunction(ignoreFile, withNodeModules)))).filter(Boolean); + return (file) => isIgnoredFunctions.some((isIgnored2) => isIgnored2(file)); +} +async function isIgnored(file, options8) { + const { + ignorePath: ignoreFiles, + withNodeModules + } = options8; + const isIgnored2 = await createIsIgnoredFunction(ignoreFiles, withNodeModules); + return isIgnored2(file); +} + +// src/utils/get-interpreter.js +var import_n_readlines = __toESM(require_readlines(), 1); +import fs6 from "fs"; +function getInterpreter(file) { + let fd; + try { + fd = fs6.openSync(file, "r"); + } catch { + return; } - callParent(callback, count = 0) { - const stackIndex = __privateMethod(this, _getNodeStackIndex, getNodeStackIndex_fn).call(this, count + 1); - const parentValues = this.stack.splice(stackIndex + 1); - try { - return callback(this); - } finally { - this.stack.push(...parentValues); + try { + const liner = new import_n_readlines.default(fd); + const firstLine = liner.next().toString("utf8"); + const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/); + if (m1) { + return m1[1]; } - } - // Similar to AstPath.prototype.call, except that the value obtained by - // accessing this.getValue()[name1][name2]... should be array. The - // callback will be called with a reference to this path object for each - // element of the array. - each(callback, ...names) { - const { - stack - } = this; - const { - length - } = stack; - let value = at_default( - /* isOptionalObject*/ - false, - stack, - -1 - ); - for (const name of names) { - value = value[name]; - stack.push(name, value); + const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/); + if (m2) { + return m2[1]; } + } finally { try { - for (let i = 0; i < value.length; ++i) { - stack.push(i, value[i]); - callback(this, i, value); - stack.length -= 2; - } - } finally { - stack.length = length; + fs6.closeSync(fd); + } catch { } } - // Similar to AstPath.prototype.each, except that the results of the - // callback function invocations are stored in an array and returned at - // the end of the iteration. - map(callback, ...names) { - const result = []; - this.each((path9, index, value) => { - result[index] = callback(path9, index, value); - }, ...names); - return result; +} +var get_interpreter_default = getInterpreter; + +// src/utils/infer-parser.js +var getFileBasename = (file) => String(file).split(/[/\\]/).pop(); +function getLanguageByFileName(languages2, file) { + if (!file) { + return; } - /** - * @param {...( - * | ((node: any, name: string | null, number: number | null) => boolean) - * | undefined - * )} predicates - */ - match(...predicates) { - let stackPointer = this.stack.length - 1; - let name = null; - let node = this.stack[stackPointer--]; - for (const predicate of predicates) { - if (node === void 0) { - return false; - } - let number = null; - if (typeof name === "number") { - number = name; - name = this.stack[stackPointer--]; - node = this.stack[stackPointer--]; - } - if (predicate && !predicate(node, name, number)) { - return false; - } - name = this.stack[stackPointer--]; - node = this.stack[stackPointer--]; - } - return true; + const basename = getFileBasename(file).toLowerCase(); + return languages2.find( + ({ filenames }) => filenames == null ? void 0 : filenames.some((name) => name.toLowerCase() === basename) + ) ?? languages2.find( + ({ extensions }) => extensions == null ? void 0 : extensions.some((extension) => basename.endsWith(extension)) + ); +} +function getLanguageByLanguageName(languages2, languageName) { + if (!languageName) { + return; } - /** - * Traverses the ancestors of the current node heading toward the tree root - * until it finds a node that matches the provided predicate function. Will - * return the first matching ancestor. If no such node exists, returns undefined. - * @param {(node: any) => boolean} predicate - * @internal Unstable API. Don't use in plugins for now. - */ - findAncestor(predicate) { - for (const node of __privateMethod(this, _getAncestors, getAncestors_fn).call(this)) { - if (predicate(node)) { - return node; - } - } + return languages2.find(({ name }) => name.toLowerCase() === languageName) ?? languages2.find(({ aliases }) => aliases == null ? void 0 : aliases.includes(languageName)) ?? languages2.find(({ extensions }) => extensions == null ? void 0 : extensions.includes(`.${languageName}`)); +} +function getLanguageByInterpreter(languages2, file) { + if (!file || getFileBasename(file).includes(".")) { + return; } - /** - * Traverses the ancestors of the current node heading toward the tree root - * until it finds a node that matches the provided predicate function. - * returns true if matched node found. - * @param {(node: any) => boolean} predicate - * @returns {boolean} - * @internal Unstable API. Don't use in plugins for now. - */ - hasAncestor(predicate) { - for (const node of __privateMethod(this, _getAncestors, getAncestors_fn).call(this)) { - if (predicate(node)) { - return true; - } - } - return false; + const interpreter = get_interpreter_default(file); + if (!interpreter) { + return; } -}; -_getNodeStackIndex = new WeakSet(); -getNodeStackIndex_fn = function(count) { - const { - stack - } = this; - for (let i = stack.length - 1; i >= 0; i -= 2) { - if (!Array.isArray(stack[i]) && --count < 0) { - return i; - } + return languages2.find( + ({ interpreters }) => interpreters == null ? void 0 : interpreters.includes(interpreter) + ); +} +function inferParser(options8, fileInfo) { + const languages2 = options8.plugins.flatMap( + (plugin) => ( + // @ts-expect-error -- Safe + plugin.languages ?? [] + ) + ); + const language = getLanguageByLanguageName(languages2, fileInfo.language) ?? getLanguageByFileName(languages2, fileInfo.physicalFile) ?? getLanguageByFileName(languages2, fileInfo.file) ?? getLanguageByInterpreter(languages2, fileInfo.physicalFile); + return language == null ? void 0 : language.parsers[0]; +} +var infer_parser_default = inferParser; + +// src/common/get-file-info.js +async function getFileInfo(file, options8) { + if (typeof file !== "string" && !(file instanceof URL)) { + throw new TypeError( + `expect \`file\` to be a string or URL, got \`${typeof file}\`` + ); } - return -1; -}; -_getAncestors = new WeakSet(); -getAncestors_fn = function* () { - const { - stack - } = this; - for (let index = stack.length - 3; index >= 0; index -= 2) { - const value = stack[index]; - if (!Array.isArray(value)) { - yield value; - } + let { ignorePath, withNodeModules } = options8; + if (!Array.isArray(ignorePath)) { + ignorePath = [ignorePath]; } -}; -var ast_path_default = AstPath; - -// src/main/comments/attach.js -import assert2 from "assert"; - -// src/utils/skip.js -function skip(characters) { - return (text, startIndex, options8) => { - const backwards = Boolean(options8 == null ? void 0 : options8.backwards); - if (startIndex === false) { - return false; - } - const { length } = text; - let cursor2 = startIndex; - while (cursor2 >= 0 && cursor2 < length) { - const character = text.charAt(cursor2); - if (characters instanceof RegExp) { - if (!characters.test(character)) { - return cursor2; - } - } else if (!characters.includes(character)) { - return cursor2; - } - backwards ? cursor2-- : cursor2++; - } - if (cursor2 === -1 || cursor2 === length) { - return cursor2; - } - return false; + const ignored = await isIgnored(file, { ignorePath, withNodeModules }); + let inferredParser; + if (!ignored) { + inferredParser = await getParser(file, options8); + } + return { + ignored, + inferredParser: inferredParser ?? null }; } -var skipWhitespace = skip(/\s/); -var skipSpaces = skip(" "); -var skipToLineEnd = skip(",; "); -var skipEverythingButNewLine = skip(/[^\n\r]/); +async function getParser(file, options8) { + let config; + if (options8.resolveConfig !== false) { + config = await resolveConfig(file); + } + return (config == null ? void 0 : config.parser) ?? infer_parser_default(options8, { physicalFile: file }); +} +var get_file_info_default = getFileInfo; -// src/utils/skip-newline.js -function skipNewline(text, startIndex, options8) { - const backwards = Boolean(options8 == null ? void 0 : options8.backwards); - if (startIndex === false) { - return false; +// src/main/core.js +var import_diff = __toESM(require_array2(), 1); + +// src/common/end-of-line.js +function guessEndOfLine(text) { + const index = text.indexOf("\r"); + if (index >= 0) { + return text.charAt(index + 1) === "\n" ? "crlf" : "cr"; } - const character = text.charAt(startIndex); - if (backwards) { - if (text.charAt(startIndex - 1) === "\r" && character === "\n") { - return startIndex - 2; - } - if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") { - return startIndex - 1; - } - } else { - if (character === "\r" && text.charAt(startIndex + 1) === "\n") { - return startIndex + 2; - } - if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") { - return startIndex + 1; - } + return "lf"; +} +function convertEndOfLineToChars(value) { + switch (value) { + case "cr": + return "\r"; + case "crlf": + return "\r\n"; + default: + return "\n"; } - return startIndex; } -var skip_newline_default = skipNewline; - -// src/utils/has-newline.js -function hasNewline(text, startIndex, options8 = {}) { - const idx = skipSpaces( +function countEndOfLineChars(text, eol) { + let regex; + switch (eol) { + case "\n": + regex = /\n/g; + break; + case "\r": + regex = /\r/g; + break; + case "\r\n": + regex = /\r\n/g; + break; + default: + throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`); + } + const endOfLines = text.match(regex); + return endOfLines ? endOfLines.length : 0; +} +function normalizeEndOfLine(text) { + return string_replace_all_default( + /* isOptionalObject*/ + false, text, - options8.backwards ? startIndex - 1 : startIndex, - options8 + /\r\n?/g, + "\n" ); - const idx2 = skip_newline_default(text, idx, options8); - return idx !== idx2; } -var has_newline_default = hasNewline; -// src/utils/is-non-empty-array.js -function isNonEmptyArray(object) { - return Array.isArray(object) && object.length > 0; +// src/document/constants.js +var DOC_TYPE_STRING = "string"; +var DOC_TYPE_ARRAY = "array"; +var DOC_TYPE_CURSOR = "cursor"; +var DOC_TYPE_INDENT = "indent"; +var DOC_TYPE_ALIGN = "align"; +var DOC_TYPE_TRIM = "trim"; +var DOC_TYPE_GROUP = "group"; +var DOC_TYPE_FILL = "fill"; +var DOC_TYPE_IF_BREAK = "if-break"; +var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break"; +var DOC_TYPE_LINE_SUFFIX = "line-suffix"; +var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary"; +var DOC_TYPE_LINE = "line"; +var DOC_TYPE_LABEL = "label"; +var DOC_TYPE_BREAK_PARENT = "break-parent"; +var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([ + DOC_TYPE_CURSOR, + DOC_TYPE_INDENT, + DOC_TYPE_ALIGN, + DOC_TYPE_TRIM, + DOC_TYPE_GROUP, + DOC_TYPE_FILL, + DOC_TYPE_IF_BREAK, + DOC_TYPE_INDENT_IF_BREAK, + DOC_TYPE_LINE_SUFFIX, + DOC_TYPE_LINE_SUFFIX_BOUNDARY, + DOC_TYPE_LINE, + DOC_TYPE_LABEL, + DOC_TYPE_BREAK_PARENT +]); + +// src/document/utils/get-doc-type.js +function getDocType(doc2) { + if (typeof doc2 === "string") { + return DOC_TYPE_STRING; + } + if (Array.isArray(doc2)) { + return DOC_TYPE_ARRAY; + } + if (!doc2) { + return; + } + const { type: type2 } = doc2; + if (VALID_OBJECT_DOC_TYPES.has(type2)) { + return type2; + } } -var is_non_empty_array_default = isNonEmptyArray; +var get_doc_type_default = getDocType; -// src/utils/is-object.js -function isObject(object) { - return object !== null && typeof object === "object"; +// src/document/invalid-doc-error.js +var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list); +function getDocErrorMessage(doc2) { + const type2 = doc2 === null ? "null" : typeof doc2; + if (type2 !== "string" && type2 !== "object") { + return `Unexpected doc '${type2}', +Expected it to be 'string' or 'object'.`; + } + if (get_doc_type_default(doc2)) { + throw new Error("doc is valid."); + } + const objectType = Object.prototype.toString.call(doc2); + if (objectType !== "[object Object]") { + return `Unexpected doc '${objectType}'.`; + } + const EXPECTED_TYPE_VALUES = disjunctionListFormat( + [...VALID_OBJECT_DOC_TYPES].map((type3) => `'${type3}'`) + ); + return `Unexpected doc.type '${doc2.type}'. +Expected it to be ${EXPECTED_TYPE_VALUES}.`; } -var is_object_default = isObject; +var InvalidDocError = class extends Error { + name = "InvalidDocError"; + constructor(doc2) { + super(getDocErrorMessage(doc2)); + this.doc = doc2; + } +}; +var invalid_doc_error_default = InvalidDocError; -// src/utils/ast-utils.js -function* getChildren(node, options8) { - const { getVisitorKeys, filter = () => true } = options8; - const isMatchedNode = (node2) => is_object_default(node2) && filter(node2); - for (const key of getVisitorKeys(node)) { - const value = node[key]; - if (Array.isArray(value)) { - for (const child of value) { - if (isMatchedNode(child)) { - yield child; +// src/document/utils/traverse-doc.js +var traverseDocOnExitStackMarker = {}; +function traverseDoc(doc2, onEnter, onExit, shouldTraverseConditionalGroups) { + const docsStack = [doc2]; + while (docsStack.length > 0) { + const doc3 = docsStack.pop(); + if (doc3 === traverseDocOnExitStackMarker) { + onExit(docsStack.pop()); + continue; + } + if (onExit) { + docsStack.push(doc3, traverseDocOnExitStackMarker); + } + const docType = get_doc_type_default(doc3); + if (!docType) { + throw new invalid_doc_error_default(doc3); + } + if ((onEnter == null ? void 0 : onEnter(doc3)) === false) { + continue; + } + switch (docType) { + case DOC_TYPE_ARRAY: + case DOC_TYPE_FILL: { + const parts = docType === DOC_TYPE_ARRAY ? doc3 : doc3.parts; + for (let ic = parts.length, i = ic - 1; i >= 0; --i) { + docsStack.push(parts[i]); } + break; } - } else if (isMatchedNode(value)) { - yield value; + case DOC_TYPE_IF_BREAK: + docsStack.push(doc3.flatContents, doc3.breakContents); + break; + case DOC_TYPE_GROUP: + if (shouldTraverseConditionalGroups && doc3.expandedStates) { + for (let ic = doc3.expandedStates.length, i = ic - 1; i >= 0; --i) { + docsStack.push(doc3.expandedStates[i]); + } + } else { + docsStack.push(doc3.contents); + } + break; + case DOC_TYPE_ALIGN: + case DOC_TYPE_INDENT: + case DOC_TYPE_INDENT_IF_BREAK: + case DOC_TYPE_LABEL: + case DOC_TYPE_LINE_SUFFIX: + docsStack.push(doc3.contents); + break; + case DOC_TYPE_STRING: + case DOC_TYPE_CURSOR: + case DOC_TYPE_TRIM: + case DOC_TYPE_LINE_SUFFIX_BOUNDARY: + case DOC_TYPE_LINE: + case DOC_TYPE_BREAK_PARENT: + break; + default: + throw new invalid_doc_error_default(doc3); } } } -function* getDescendants(node, options8) { - const queue = [node]; - for (let index = 0; index < queue.length; index++) { - const node2 = queue[index]; - for (const child of getChildren(node2, options8)) { - yield child; - queue.push(child); +var traverse_doc_default = traverseDoc; + +// src/document/utils/assert-doc.js +var noop = () => { +}; +var assertDoc = true ? noop : function(doc2) { + traverse_doc_default(doc2, (doc3) => { + if (checked.has(doc3)) { + return false; + } + if (typeof doc3 !== "string") { + checked.add(doc3); } + }); +}; +var assertDocArray = true ? noop : function(docs, optional = false) { + if (optional && !docs) { + return; } -} - -// src/main/comments/utils.js -function describeNodeForDebugging(node) { - const nodeType = node.type || node.kind || "(unknown type)"; - let nodeName = String( - node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || "" - ); - if (nodeName.length > 20) { - nodeName = nodeName.slice(0, 19) + "\u2026"; + if (!Array.isArray(docs)) { + throw new TypeError("Unexpected doc array."); } - return nodeType + (nodeName ? " " + nodeName : ""); + for (const doc2 of docs) { + assertDoc(doc2); + } +}; + +// src/document/builders.js +function indent(contents) { + assertDoc(contents); + return { type: DOC_TYPE_INDENT, contents }; } -function addCommentHelper(node, comment) { - const comments = node.comments ?? (node.comments = []); - comments.push(comment); - comment.printed = false; - comment.nodeDescription = describeNodeForDebugging(node); +function align(widthOrString, contents) { + assertDoc(contents); + return { type: DOC_TYPE_ALIGN, contents, n: widthOrString }; } -function addLeadingComment(node, comment) { - comment.leading = true; - comment.trailing = false; - addCommentHelper(node, comment); +function fill(parts) { + assertDocArray(parts); + return { type: DOC_TYPE_FILL, parts }; } -function addDanglingComment(node, comment, marker) { - comment.leading = false; - comment.trailing = false; - if (marker) { - comment.marker = marker; +function lineSuffix(contents) { + assertDoc(contents); + return { type: DOC_TYPE_LINE_SUFFIX, contents }; +} +var breakParent = { type: DOC_TYPE_BREAK_PARENT }; +var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true }; +var line2 = { type: DOC_TYPE_LINE }; +var hardline = [hardlineWithoutBreakParent, breakParent]; +var cursor = { type: DOC_TYPE_CURSOR }; +function addAlignmentToDoc(doc2, size, tabWidth) { + assertDoc(doc2); + let aligned = doc2; + if (size > 0) { + for (let i = 0; i < Math.floor(size / tabWidth); ++i) { + aligned = indent(aligned); + } + aligned = align(size % tabWidth, aligned); + aligned = align(Number.NEGATIVE_INFINITY, aligned); } - addCommentHelper(node, comment); -} -function addTrailingComment(node, comment) { - comment.leading = false; - comment.trailing = true; - addCommentHelper(node, comment); + return aligned; } -// src/main/comments/attach.js -var childNodesCache = /* @__PURE__ */ new WeakMap(); -function getSortedChildNodes(node, options8) { - if (childNodesCache.has(node)) { - return childNodesCache.get(node); +// src/document/debug.js +function flattenDoc(doc2) { + var _a; + if (!doc2) { + return ""; } - const { - printer: { - getCommentChildNodes, - canAttachComment, - getVisitorKeys: printerGetVisitorKeys - }, - locStart, - locEnd - } = options8; - if (!canAttachComment) { - return []; + if (Array.isArray(doc2)) { + const res = []; + for (const part of doc2) { + if (Array.isArray(part)) { + res.push(...flattenDoc(part)); + } else { + const flattened = flattenDoc(part); + if (flattened !== "") { + res.push(flattened); + } + } + } + return res; } - const childNodes = ((getCommentChildNodes == null ? void 0 : getCommentChildNodes(node, options8)) ?? [ - ...getChildren(node, { - getVisitorKeys: create_get_visitor_keys_function_default(printerGetVisitorKeys) - }) - ]).flatMap( - (node2) => canAttachComment(node2) ? [node2] : getSortedChildNodes(node2, options8) - ); - childNodes.sort( - (nodeA, nodeB) => locStart(nodeA) - locStart(nodeB) || locEnd(nodeA) - locEnd(nodeB) - ); - childNodesCache.set(node, childNodes); - return childNodes; + if (doc2.type === DOC_TYPE_IF_BREAK) { + return { + ...doc2, + breakContents: flattenDoc(doc2.breakContents), + flatContents: flattenDoc(doc2.flatContents) + }; + } + if (doc2.type === DOC_TYPE_GROUP) { + return { + ...doc2, + contents: flattenDoc(doc2.contents), + expandedStates: (_a = doc2.expandedStates) == null ? void 0 : _a.map(flattenDoc) + }; + } + if (doc2.type === DOC_TYPE_FILL) { + return { type: "fill", parts: doc2.parts.map(flattenDoc) }; + } + if (doc2.contents) { + return { ...doc2, contents: flattenDoc(doc2.contents) }; + } + return doc2; } -function decorateComment(node, comment, options8, enclosingNode) { - const { locStart, locEnd } = options8; - const commentStart = locStart(comment); - const commentEnd = locEnd(comment); - const childNodes = getSortedChildNodes(node, options8); - let precedingNode; - let followingNode; - let left = 0; - let right = childNodes.length; - while (left < right) { - const middle = left + right >> 1; - const child = childNodes[middle]; - const start = locStart(child); - const end = locEnd(child); - if (start <= commentStart && commentEnd <= end) { - return decorateComment(child, comment, options8, child); +function printDocToDebug(doc2) { + const printedSymbols = /* @__PURE__ */ Object.create(null); + const usedKeysForSymbols = /* @__PURE__ */ new Set(); + return printDoc(flattenDoc(doc2)); + function printDoc(doc3, index, parentParts) { + var _a, _b; + if (typeof doc3 === "string") { + return JSON.stringify(doc3); } - if (end <= commentStart) { - precedingNode = child; - left = middle + 1; - continue; + if (Array.isArray(doc3)) { + const printed = doc3.map(printDoc).filter(Boolean); + return printed.length === 1 ? printed[0] : `[${printed.join(", ")}]`; } - if (commentEnd <= start) { - followingNode = child; - right = middle; - continue; + if (doc3.type === DOC_TYPE_LINE) { + const withBreakParent = ((_a = parentParts == null ? void 0 : parentParts[index + 1]) == null ? void 0 : _a.type) === DOC_TYPE_BREAK_PARENT; + if (doc3.literal) { + return withBreakParent ? "literalline" : "literallineWithoutBreakParent"; + } + if (doc3.hard) { + return withBreakParent ? "hardline" : "hardlineWithoutBreakParent"; + } + if (doc3.soft) { + return "softline"; + } + return "line"; } - throw new Error("Comment location overlaps with node location"); - } - if ((enclosingNode == null ? void 0 : enclosingNode.type) === "TemplateLiteral") { - const { quasis } = enclosingNode; - const commentIndex = findExpressionIndexForComment( - quasis, - comment, - options8 - ); - if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options8) !== commentIndex) { - precedingNode = null; + if (doc3.type === DOC_TYPE_BREAK_PARENT) { + const afterHardline = ((_b = parentParts == null ? void 0 : parentParts[index - 1]) == null ? void 0 : _b.type) === DOC_TYPE_LINE && parentParts[index - 1].hard; + return afterHardline ? void 0 : "breakParent"; } - if (followingNode && findExpressionIndexForComment(quasis, followingNode, options8) !== commentIndex) { - followingNode = null; + if (doc3.type === DOC_TYPE_TRIM) { + return "trim"; } - } - return { enclosingNode, precedingNode, followingNode }; -} -var returnFalse = () => false; -function attachComments(ast, options8) { - const { comments } = ast; - delete ast.comments; - if (!is_non_empty_array_default(comments) || !options8.printer.canAttachComment) { - return; - } - const tiesToBreak = []; - const { - locStart, - locEnd, - printer: { - experimentalFeatures: { - // TODO: Make this as default behavior - avoidAstMutation = false - } = {}, - handleComments = {} - }, - originalText: text - } = options8; - const { - ownLine: handleOwnLineComment = returnFalse, - endOfLine: handleEndOfLineComment = returnFalse, - remaining: handleRemainingComment = returnFalse - } = handleComments; - const decoratedComments = comments.map((comment, index) => ({ - ...decorateComment(ast, comment, options8), - comment, - text, - options: options8, - ast, - isLastComment: comments.length - 1 === index - })); - for (const [index, context] of decoratedComments.entries()) { - const { - comment, - precedingNode, - enclosingNode, - followingNode, - text: text2, - options: options9, - ast: ast2, - isLastComment - } = context; - if (options9.parser === "json" || options9.parser === "json5" || options9.parser === "__js_expression" || options9.parser === "__ts_expression" || options9.parser === "__vue_expression" || options9.parser === "__vue_ts_expression") { - if (locStart(comment) - locStart(ast2) <= 0) { - addLeadingComment(ast2, comment); - continue; - } - if (locEnd(comment) - locEnd(ast2) >= 0) { - addTrailingComment(ast2, comment); - continue; - } + if (doc3.type === DOC_TYPE_INDENT) { + return "indent(" + printDoc(doc3.contents) + ")"; } - let args; - if (avoidAstMutation) { - args = [context]; - } else { - comment.enclosingNode = enclosingNode; - comment.precedingNode = precedingNode; - comment.followingNode = followingNode; - args = [comment, text2, options9, ast2, isLastComment]; + if (doc3.type === DOC_TYPE_ALIGN) { + return doc3.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + printDoc(doc3.contents) + ")" : doc3.n < 0 ? "dedent(" + printDoc(doc3.contents) + ")" : doc3.n.type === "root" ? "markAsRoot(" + printDoc(doc3.contents) + ")" : "align(" + JSON.stringify(doc3.n) + ", " + printDoc(doc3.contents) + ")"; } - if (isOwnLineComment(text2, options9, decoratedComments, index)) { - comment.placement = "ownLine"; - if (handleOwnLineComment(...args)) { - } else if (followingNode) { - addLeadingComment(followingNode, comment); - } else if (precedingNode) { - addTrailingComment(precedingNode, comment); - } else if (enclosingNode) { - addDanglingComment(enclosingNode, comment); - } else { - addDanglingComment(ast2, comment); - } - } else if (isEndOfLineComment(text2, options9, decoratedComments, index)) { - comment.placement = "endOfLine"; - if (handleEndOfLineComment(...args)) { - } else if (precedingNode) { - addTrailingComment(precedingNode, comment); - } else if (followingNode) { - addLeadingComment(followingNode, comment); - } else if (enclosingNode) { - addDanglingComment(enclosingNode, comment); - } else { - addDanglingComment(ast2, comment); - } - } else { - comment.placement = "remaining"; - if (handleRemainingComment(...args)) { - } else if (precedingNode && followingNode) { - const tieCount = tiesToBreak.length; - if (tieCount > 0) { - const lastTie = tiesToBreak[tieCount - 1]; - if (lastTie.followingNode !== followingNode) { - breakTies(tiesToBreak, options9); - } - } - tiesToBreak.push(context); - } else if (precedingNode) { - addTrailingComment(precedingNode, comment); - } else if (followingNode) { - addLeadingComment(followingNode, comment); - } else if (enclosingNode) { - addDanglingComment(enclosingNode, comment); - } else { - addDanglingComment(ast2, comment); + if (doc3.type === DOC_TYPE_IF_BREAK) { + return "ifBreak(" + printDoc(doc3.breakContents) + (doc3.flatContents ? ", " + printDoc(doc3.flatContents) : "") + (doc3.groupId ? (!doc3.flatContents ? ', ""' : "") + `, { groupId: ${printGroupId(doc3.groupId)} }` : "") + ")"; + } + if (doc3.type === DOC_TYPE_INDENT_IF_BREAK) { + const optionsParts = []; + if (doc3.negate) { + optionsParts.push("negate: true"); } + if (doc3.groupId) { + optionsParts.push(`groupId: ${printGroupId(doc3.groupId)}`); + } + const options8 = optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : ""; + return `indentIfBreak(${printDoc(doc3.contents)}${options8})`; } - } - breakTies(tiesToBreak, options8); - if (!avoidAstMutation) { - for (const comment of comments) { - delete comment.precedingNode; - delete comment.enclosingNode; - delete comment.followingNode; - } - } -} -var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/.test(text); -function isOwnLineComment(text, options8, decoratedComments, commentIndex) { - const { comment, precedingNode } = decoratedComments[commentIndex]; - const { locStart, locEnd } = options8; - let start = locStart(comment); - if (precedingNode) { - for (let index = commentIndex - 1; index >= 0; index--) { - const { comment: comment2, precedingNode: currentCommentPrecedingNode } = decoratedComments[index]; - if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment2), start))) { - break; + if (doc3.type === DOC_TYPE_GROUP) { + const optionsParts = []; + if (doc3.break && doc3.break !== "propagated") { + optionsParts.push("shouldBreak: true"); } - start = locStart(comment2); + if (doc3.id) { + optionsParts.push(`id: ${printGroupId(doc3.id)}`); + } + const options8 = optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : ""; + if (doc3.expandedStates) { + return `conditionalGroup([${doc3.expandedStates.map((part) => printDoc(part)).join(",")}]${options8})`; + } + return `group(${printDoc(doc3.contents)}${options8})`; + } + if (doc3.type === DOC_TYPE_FILL) { + return `fill([${doc3.parts.map((part) => printDoc(part)).join(", ")}])`; + } + if (doc3.type === DOC_TYPE_LINE_SUFFIX) { + return "lineSuffix(" + printDoc(doc3.contents) + ")"; + } + if (doc3.type === DOC_TYPE_LINE_SUFFIX_BOUNDARY) { + return "lineSuffixBoundary"; } + if (doc3.type === DOC_TYPE_LABEL) { + return `label(${JSON.stringify(doc3.label)}, ${printDoc(doc3.contents)})`; + } + throw new Error("Unknown doc type " + doc3.type); } - return has_newline_default(text, start, { backwards: true }); -} -function isEndOfLineComment(text, options8, decoratedComments, commentIndex) { - const { comment, followingNode } = decoratedComments[commentIndex]; - const { locStart, locEnd } = options8; - let end = locEnd(comment); - if (followingNode) { - for (let index = commentIndex + 1; index < decoratedComments.length; index++) { - const { comment: comment2, followingNode: currentCommentFollowingNode } = decoratedComments[index]; - if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment2)))) { - break; + function printGroupId(id) { + if (typeof id !== "symbol") { + return JSON.stringify(String(id)); + } + if (id in printedSymbols) { + return printedSymbols[id]; + } + const prefix = id.description || "symbol"; + for (let counter = 0; ; counter++) { + const key2 = prefix + (counter > 0 ? ` #${counter}` : ""); + if (!usedKeysForSymbols.has(key2)) { + usedKeysForSymbols.add(key2); + return printedSymbols[id] = `Symbol.for(${JSON.stringify(key2)})`; } - end = locEnd(comment2); } } - return has_newline_default(text, end); } -function breakTies(tiesToBreak, options8) { - var _a, _b; - const tieCount = tiesToBreak.length; - if (tieCount === 0) { + +// scripts/build/shims/at.js +var at = (isOptionalObject, object, index) => { + if (isOptionalObject && (object === void 0 || object === null)) { return; } - const { precedingNode, followingNode } = tiesToBreak[0]; - let gapEndPos = options8.locStart(followingNode); - let indexOfFirstLeadingComment; - for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) { - const { - comment, - precedingNode: currentCommentPrecedingNode, - followingNode: currentCommentFollowingNode - } = tiesToBreak[indexOfFirstLeadingComment - 1]; - assert2.strictEqual(currentCommentPrecedingNode, precedingNode); - assert2.strictEqual(currentCommentFollowingNode, followingNode); - const gap = options8.originalText.slice(options8.locEnd(comment), gapEndPos); - if (((_b = (_a = options8.printer).isGap) == null ? void 0 : _b.call(_a, gap, options8)) ?? /^[\s(]*$/.test(gap)) { - gapEndPos = options8.locStart(comment); - } else { - break; - } + if (Array.isArray(object) || typeof object === "string") { + return object[index < 0 ? object.length + index : index]; } - for (const [i, { comment }] of tiesToBreak.entries()) { - if (i < indexOfFirstLeadingComment) { - addTrailingComment(precedingNode, comment); - } else { - addLeadingComment(followingNode, comment); - } + return object.at(index); +}; +var at_default = at; + +// node_modules/emoji-regex/index.mjs +var emoji_regex_default = () => { + return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; +}; + +// node_modules/get-east-asian-width/lookup.js +function isFullWidth(x) { + return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510; +} +function isWide(x) { + return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141; +} + +// node_modules/get-east-asian-width/index.js +var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint)); + +// src/utils/get-string-width.js +var notAsciiRegex = /[^\x20-\x7F]/; +function getStringWidth(text) { + if (!text) { + return 0; } - for (const node of [precedingNode, followingNode]) { - if (node.comments && node.comments.length > 1) { - node.comments.sort((a, b) => options8.locStart(a) - options8.locStart(b)); - } + if (!notAsciiRegex.test(text)) { + return text.length; } - tiesToBreak.length = 0; -} -function findExpressionIndexForComment(quasis, comment, options8) { - const startPos = options8.locStart(comment) - 1; - for (let i = 1; i < quasis.length; ++i) { - if (startPos < options8.locStart(quasis[i])) { - return i - 1; + text = text.replace(emoji_regex_default(), " "); + let width = 0; + for (const character of text) { + const codePoint = character.codePointAt(0); + if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) { + continue; + } + if (codePoint >= 768 && codePoint <= 879) { + continue; } + width += _isNarrowWidth(codePoint) ? 1 : 2; } - return 0; -} - -// src/utils/is-previous-line-empty.js -function isPreviousLineEmpty(text, startIndex) { - let idx = startIndex - 1; - idx = skipSpaces(text, idx, { backwards: true }); - idx = skip_newline_default(text, idx, { backwards: true }); - idx = skipSpaces(text, idx, { backwards: true }); - const idx2 = skip_newline_default(text, idx, { backwards: true }); - return idx !== idx2; + return width; } -var is_previous_line_empty_default = isPreviousLineEmpty; +var get_string_width_default = getStringWidth; -// src/main/comments/print.js -function printComment(path9, options8) { - const comment = path9.node; - comment.printed = true; - return options8.printer.printComment(path9, options8); -} -function printLeadingComment(path9, options8) { - var _a; - const comment = path9.node; - const parts = [printComment(path9, options8)]; - const { printer, originalText, locStart, locEnd } = options8; - const isBlock = (_a = printer.isBlockComment) == null ? void 0 : _a.call(printer, comment); - if (isBlock) { - const lineBreak = has_newline_default(originalText, locEnd(comment)) ? has_newline_default(originalText, locStart(comment), { - backwards: true - }) ? hardline : line : " "; - parts.push(lineBreak); - } else { - parts.push(hardline); +// src/document/utils.js +var getDocParts = (doc2) => { + if (Array.isArray(doc2)) { + return doc2; } - const index = skip_newline_default( - originalText, - skipSpaces(originalText, locEnd(comment)) - ); - if (index !== false && has_newline_default(originalText, index)) { - parts.push(hardline); + if (doc2.type !== DOC_TYPE_FILL) { + throw new Error(`Expect doc to be 'array' or '${DOC_TYPE_FILL}'.`); + } + return doc2.parts; +}; +function mapDoc(doc2, cb) { + if (typeof doc2 === "string") { + return cb(doc2); + } + const mapped = /* @__PURE__ */ new Map(); + return rec(doc2); + function rec(doc3) { + if (mapped.has(doc3)) { + return mapped.get(doc3); + } + const result = process4(doc3); + mapped.set(doc3, result); + return result; + } + function process4(doc3) { + switch (get_doc_type_default(doc3)) { + case DOC_TYPE_ARRAY: + return cb(doc3.map(rec)); + case DOC_TYPE_FILL: + return cb({ + ...doc3, + parts: doc3.parts.map(rec) + }); + case DOC_TYPE_IF_BREAK: + return cb({ + ...doc3, + breakContents: rec(doc3.breakContents), + flatContents: rec(doc3.flatContents) + }); + case DOC_TYPE_GROUP: { + let { + expandedStates, + contents + } = doc3; + if (expandedStates) { + expandedStates = expandedStates.map(rec); + contents = expandedStates[0]; + } else { + contents = rec(contents); + } + return cb({ + ...doc3, + contents, + expandedStates + }); + } + case DOC_TYPE_ALIGN: + case DOC_TYPE_INDENT: + case DOC_TYPE_INDENT_IF_BREAK: + case DOC_TYPE_LABEL: + case DOC_TYPE_LINE_SUFFIX: + return cb({ + ...doc3, + contents: rec(doc3.contents) + }); + case DOC_TYPE_STRING: + case DOC_TYPE_CURSOR: + case DOC_TYPE_TRIM: + case DOC_TYPE_LINE_SUFFIX_BOUNDARY: + case DOC_TYPE_LINE: + case DOC_TYPE_BREAK_PARENT: + return cb(doc3); + default: + throw new invalid_doc_error_default(doc3); + } } - return parts; } -function printTrailingComment(path9, options8, previousComment) { - var _a; - const comment = path9.node; - const printed = printComment(path9, options8); - const { printer, originalText, locStart } = options8; - const isBlock = (_a = printer.isBlockComment) == null ? void 0 : _a.call(printer, comment); - if ((previousComment == null ? void 0 : previousComment.hasLineSuffix) && !(previousComment == null ? void 0 : previousComment.isBlock) || has_newline_default(originalText, locStart(comment), { backwards: true })) { - const isLineBeforeEmpty = is_previous_line_empty_default( - originalText, - locStart(comment) +function breakParentGroup(groupStack) { + if (groupStack.length > 0) { + const parentGroup = at_default( + /* isOptionalObject*/ + false, + groupStack, + -1 ); - return { - doc: lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", printed]), - isBlock, - hasLineSuffix: true - }; - } - if (!isBlock || (previousComment == null ? void 0 : previousComment.hasLineSuffix)) { - return { - doc: [lineSuffix([" ", printed]), breakParent], - isBlock, - hasLineSuffix: true - }; + if (!parentGroup.expandedStates && !parentGroup.break) { + parentGroup.break = "propagated"; + } } - return { doc: [" ", printed], isBlock, hasLineSuffix: false }; + return null; } -function printCommentsSeparately(path9, options8) { - const value = path9.node; - if (!value) { - return {}; - } - const ignored = options8[Symbol.for("printedComments")]; - const comments = (value.comments || []).filter( - (comment) => !ignored.has(comment) - ); - if (comments.length === 0) { - return { leading: "", trailing: "" }; - } - const leadingParts = []; - const trailingParts = []; - let printedTrailingComment; - path9.each(() => { - const comment = path9.node; - if (ignored == null ? void 0 : ignored.has(comment)) { - return; +function propagateBreaks(doc2) { + const alreadyVisitedSet = /* @__PURE__ */ new Set(); + const groupStack = []; + function propagateBreaksOnEnterFn(doc3) { + if (doc3.type === DOC_TYPE_BREAK_PARENT) { + breakParentGroup(groupStack); } - const { leading, trailing } = comment; - if (leading) { - leadingParts.push(printLeadingComment(path9, options8)); - } else if (trailing) { - printedTrailingComment = printTrailingComment( - path9, - options8, - printedTrailingComment - ); - trailingParts.push(printedTrailingComment.doc); + if (doc3.type === DOC_TYPE_GROUP) { + groupStack.push(doc3); + if (alreadyVisitedSet.has(doc3)) { + return false; + } + alreadyVisitedSet.add(doc3); } - }, "comments"); - return { leading: leadingParts, trailing: trailingParts }; -} -function printComments(path9, doc2, options8) { - const { leading, trailing } = printCommentsSeparately(path9, options8); - if (!leading && !trailing) { - return doc2; } - return inheritLabel(doc2, (doc3) => [leading, doc3, trailing]); -} -function ensureAllCommentsPrinted(options8) { - const { - [Symbol.for("comments")]: comments, - [Symbol.for("printedComments")]: printedComments - } = options8; - for (const comment of comments) { - if (!comment.printed && !printedComments.has(comment)) { - throw new Error( - 'Comment "' + comment.value.trim() + '" was not printed. Please report this error!' - ); + function propagateBreaksOnExitFn(doc3) { + if (doc3.type === DOC_TYPE_GROUP) { + const group = groupStack.pop(); + if (group.break) { + breakParentGroup(groupStack); + } } - delete comment.printed; } + traverse_doc_default( + doc2, + propagateBreaksOnEnterFn, + propagateBreaksOnExitFn, + /* shouldTraverseConditionalGroups */ + true + ); } - -// src/main/multiparser.js -async function printEmbeddedLanguages(path9, genericPrint, options8, printAstToDoc2, embeds) { - const { - embeddedLanguageFormatting, - printer: { - embed, - hasPrettierIgnore = () => false, - getVisitorKeys: printerGetVisitorKeys - } - } = options8; - if (!embed || embeddedLanguageFormatting !== "auto") { - return; +function stripTrailingHardlineFromParts(parts) { + parts = [...parts]; + while (parts.length >= 2 && at_default( + /* isOptionalObject*/ + false, + parts, + -2 + ).type === DOC_TYPE_LINE && at_default( + /* isOptionalObject*/ + false, + parts, + -1 + ).type === DOC_TYPE_BREAK_PARENT) { + parts.length -= 2; } - if (embed.length > 2) { - throw new Error( - "printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed" - ); + if (parts.length > 0) { + const lastPart = stripTrailingHardlineFromDoc(at_default( + /* isOptionalObject*/ + false, + parts, + -1 + )); + parts[parts.length - 1] = lastPart; } - const getVisitorKeys = create_get_visitor_keys_function_default( - embed.getVisitorKeys ?? printerGetVisitorKeys - ); - const embedCallResults = []; - recurse(); - const originalPathStack = path9.stack; - for (const { print, node, pathStack } of embedCallResults) { - try { - path9.stack = pathStack; - const doc2 = await print(textToDocForEmbed, genericPrint, path9, options8); - if (doc2) { - embeds.set(node, doc2); - } - } catch (error) { - if (process.env.PRETTIER_DEBUG) { - throw error; - } + return parts; +} +function stripTrailingHardlineFromDoc(doc2) { + switch (get_doc_type_default(doc2)) { + case DOC_TYPE_ALIGN: + case DOC_TYPE_INDENT: + case DOC_TYPE_INDENT_IF_BREAK: + case DOC_TYPE_GROUP: + case DOC_TYPE_LINE_SUFFIX: + case DOC_TYPE_LABEL: { + const contents = stripTrailingHardlineFromDoc(doc2.contents); + return { + ...doc2, + contents + }; } + case DOC_TYPE_IF_BREAK: + return { + ...doc2, + breakContents: stripTrailingHardlineFromDoc(doc2.breakContents), + flatContents: stripTrailingHardlineFromDoc(doc2.flatContents) + }; + case DOC_TYPE_FILL: + return { + ...doc2, + parts: stripTrailingHardlineFromParts(doc2.parts) + }; + case DOC_TYPE_ARRAY: + return stripTrailingHardlineFromParts(doc2); + case DOC_TYPE_STRING: + return doc2.replace(/[\n\r]*$/, ""); + case DOC_TYPE_CURSOR: + case DOC_TYPE_TRIM: + case DOC_TYPE_LINE_SUFFIX_BOUNDARY: + case DOC_TYPE_LINE: + case DOC_TYPE_BREAK_PARENT: + break; + default: + throw new invalid_doc_error_default(doc2); } - path9.stack = originalPathStack; - function textToDocForEmbed(text, partialNextOptions) { - return textToDoc(text, partialNextOptions, options8, printAstToDoc2); - } - function recurse() { - const { node } = path9; - if (node === null || typeof node !== "object" || hasPrettierIgnore(path9)) { - return; - } - for (const key of getVisitorKeys(node)) { - if (Array.isArray(node[key])) { - path9.each(recurse, key); - } else { - path9.call(recurse, key); + return doc2; +} +function stripTrailingHardline(doc2) { + return stripTrailingHardlineFromDoc(cleanDoc(doc2)); +} +function cleanDocFn(doc2) { + switch (get_doc_type_default(doc2)) { + case DOC_TYPE_FILL: + if (doc2.parts.every((part) => part === "")) { + return ""; } + break; + case DOC_TYPE_GROUP: + if (!doc2.contents && !doc2.id && !doc2.break && !doc2.expandedStates) { + return ""; + } + if (doc2.contents.type === DOC_TYPE_GROUP && doc2.contents.id === doc2.id && doc2.contents.break === doc2.break && doc2.contents.expandedStates === doc2.expandedStates) { + return doc2.contents; + } + break; + case DOC_TYPE_ALIGN: + case DOC_TYPE_INDENT: + case DOC_TYPE_INDENT_IF_BREAK: + case DOC_TYPE_LINE_SUFFIX: + if (!doc2.contents) { + return ""; + } + break; + case DOC_TYPE_IF_BREAK: + if (!doc2.flatContents && !doc2.breakContents) { + return ""; + } + break; + case DOC_TYPE_ARRAY: { + const parts = []; + for (const part of doc2) { + if (!part) { + continue; + } + const [currentPart, ...restParts] = Array.isArray(part) ? part : [part]; + if (typeof currentPart === "string" && typeof at_default( + /* isOptionalObject*/ + false, + parts, + -1 + ) === "string") { + parts[parts.length - 1] += currentPart; + } else { + parts.push(currentPart); + } + parts.push(...restParts); + } + if (parts.length === 0) { + return ""; + } + if (parts.length === 1) { + return parts[0]; + } + return parts; } - const result = embed(path9, options8); - if (!result) { - return; - } - if (typeof result === "function") { - embedCallResults.push({ - print: result, - node, - pathStack: [...path9.stack] - }); - return; - } - if (false) { - throw new Error( - "`embed` should return an async function instead of Promise." - ); - } - embeds.set(node, result); + case DOC_TYPE_STRING: + case DOC_TYPE_CURSOR: + case DOC_TYPE_TRIM: + case DOC_TYPE_LINE_SUFFIX_BOUNDARY: + case DOC_TYPE_LINE: + case DOC_TYPE_LABEL: + case DOC_TYPE_BREAK_PARENT: + break; + default: + throw new invalid_doc_error_default(doc2); } + return doc2; } -async function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc2) { - const options8 = await normalize_format_options_default( - { - ...parentOptions, - ...partialNextOptions, - parentParser: parentOptions.parser, - originalText: text - }, - { passThrough: true } - ); - const { ast } = await parse_default(text, options8); - const doc2 = await printAstToDoc2(ast, options8); - return stripTrailingHardline(doc2); +function cleanDoc(doc2) { + return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc)); +} +function inheritLabel(doc2, fn) { + return doc2.type === DOC_TYPE_LABEL ? { + ...doc2, + contents: fn(doc2.contents) + } : fn(doc2); } -// src/main/create-print-pre-check-function.js -function createPrintPreCheckFunction(options8) { - if (true) { - return () => { - }; - } - const getVisitorKeys = create_get_visitor_keys_function_default( - options8.printer.getVisitorKeys - ); - return function(path9) { - if (path9.isRoot) { - return; - } - const { key, parent } = path9; - const visitorKeys = getVisitorKeys(parent); - if (visitorKeys.includes(key)) { - return; - } - throw Object.assign(new Error("Calling `print()` on non-node object."), { - parentNode: parent, - allowedProperties: visitorKeys, - printingProperty: key, - printingValue: path9.node, - pathStack: path9.stack.length > 5 ? ["...", ...path9.stack.slice(-5)] : [...path9.stack] - }); +// src/document/printer.js +var MODE_BREAK = Symbol("MODE_BREAK"); +var MODE_FLAT = Symbol("MODE_FLAT"); +var CURSOR_PLACEHOLDER = Symbol("cursor"); +function rootIndent() { + return { + value: "", + length: 0, + queue: [] }; } -var create_print_pre_check_function_default = createPrintPreCheckFunction; - -// src/main/print-ignored.js -function printIgnored(path9, options8) { - const { - originalText, - [Symbol.for("comments")]: comments, - locStart, - locEnd, - [Symbol.for("printedComments")]: printedComments - } = options8; - const { node } = path9; - const start = locStart(node); - const end = locEnd(node); - for (const comment of comments) { - if (locStart(comment) >= start && locEnd(comment) <= end) { - printedComments.add(comment); - } - } - return originalText.slice(start, end); +function makeIndent(ind, options8) { + return generateInd(ind, { + type: "indent" + }, options8); } -var print_ignored_default = printIgnored; - -// src/main/ast-to-doc.js -async function printAstToDoc(ast, options8) { - ({ ast } = await prepareToPrint(ast, options8)); - const cache2 = /* @__PURE__ */ new Map(); - const path9 = new ast_path_default(ast); - const ensurePrintingNode = create_print_pre_check_function_default(options8); - const embeds = /* @__PURE__ */ new Map(); - await printEmbeddedLanguages(path9, mainPrint, options8, printAstToDoc, embeds); - const doc2 = await callPluginPrintFunction( - path9, - options8, - mainPrint, - void 0, - embeds - ); - ensureAllCommentsPrinted(options8); - return doc2; - function mainPrint(selector, args) { - if (selector === void 0 || selector === path9) { - return mainPrintInternal(args); - } - if (Array.isArray(selector)) { - return path9.call(() => mainPrintInternal(args), ...selector); - } - return path9.call(() => mainPrintInternal(args), selector); - } - function mainPrintInternal(args) { - ensurePrintingNode(path9); - const value = path9.node; - if (value === void 0 || value === null) { - return ""; - } - const shouldCache = value && typeof value === "object" && args === void 0; - if (shouldCache && cache2.has(value)) { - return cache2.get(value); - } - const doc3 = callPluginPrintFunction(path9, options8, mainPrint, args, embeds); - if (shouldCache) { - cache2.set(value, doc3); - } - return doc3; +function makeAlign(indent2, widthOrDoc, options8) { + if (widthOrDoc === Number.NEGATIVE_INFINITY) { + return indent2.root || rootIndent(); } -} -function callPluginPrintFunction(path9, options8, printPath, args, embeds) { - var _a; - const { node } = path9; - const { printer } = options8; - let doc2; - if ((_a = printer.hasPrettierIgnore) == null ? void 0 : _a.call(printer, path9)) { - doc2 = print_ignored_default(path9, options8); - } else if (embeds.has(node)) { - doc2 = embeds.get(node); - } else { - doc2 = printer.print(path9, options8, printPath, args); + if (widthOrDoc < 0) { + return generateInd(indent2, { + type: "dedent" + }, options8); } - if (node === options8.cursorNode) { - doc2 = inheritLabel(doc2, (doc3) => [cursor, doc3, cursor]); + if (!widthOrDoc) { + return indent2; } - if (printer.printComment && (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path9, options8))) { - doc2 = printComments(path9, doc2, options8); + if (widthOrDoc.type === "root") { + return { + ...indent2, + root: indent2 + }; } - return doc2; -} -async function prepareToPrint(ast, options8) { - const comments = ast.comments ?? []; - options8[Symbol.for("comments")] = comments; - options8[Symbol.for("tokens")] = ast.tokens ?? []; - options8[Symbol.for("printedComments")] = /* @__PURE__ */ new Set(); - attachComments(ast, options8); - const { - printer: { preprocess } - } = options8; - ast = preprocess ? await preprocess(ast, options8) : ast; - return { ast, comments }; -} - -// src/main/range-util.js -import assert3 from "assert"; -var isJsonParser = ({ parser }) => parser === "json" || parser === "json5" || parser === "json-stringify"; -function findCommonAncestor(startNodeAndParents, endNodeAndParents) { - const startNodeAndAncestors = [ - startNodeAndParents.node, - ...startNodeAndParents.parentNodes - ]; - const endNodeAndAncestors = /* @__PURE__ */ new Set([ - endNodeAndParents.node, - ...endNodeAndParents.parentNodes - ]); - return startNodeAndAncestors.find( - (node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node) - ); + const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign"; + return generateInd(indent2, { + type: alignType, + n: widthOrDoc + }, options8); } -function dropRootParents(parents) { - let lastParentIndex = parents.length - 1; - for (; ; ) { - const parent = parents[lastParentIndex]; - if ((parent == null ? void 0 : parent.type) === "Program" || (parent == null ? void 0 : parent.type) === "File") { - lastParentIndex--; - } else { - break; +function generateInd(ind, newPart, options8) { + const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart]; + let value = ""; + let length = 0; + let lastTabs = 0; + let lastSpaces = 0; + for (const part of queue) { + switch (part.type) { + case "indent": + flush(); + if (options8.useTabs) { + addTabs(1); + } else { + addSpaces(options8.tabWidth); + } + break; + case "stringAlign": + flush(); + value += part.n; + length += part.n.length; + break; + case "numberAlign": + lastTabs += 1; + lastSpaces += part.n; + break; + default: + throw new Error(`Unexpected type '${part.type}'`); } } - return parents.slice(0, lastParentIndex + 1); -} -function findSiblingAncestors(startNodeAndParents, endNodeAndParents, { locStart, locEnd }) { - let resultStartNode = startNodeAndParents.node; - let resultEndNode = endNodeAndParents.node; - if (resultStartNode === resultEndNode) { - return { - startNode: resultStartNode, - endNode: resultEndNode - }; + flushSpaces(); + return { + ...ind, + value, + length, + queue + }; + function addTabs(count) { + value += " ".repeat(count); + length += options8.tabWidth * count; } - const startNodeStart = locStart(startNodeAndParents.node); - for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) { - if (locStart(endParent) >= startNodeStart) { - resultEndNode = endParent; - } else { - break; - } + function addSpaces(count) { + value += " ".repeat(count); + length += count; } - const endNodeEnd = locEnd(endNodeAndParents.node); - for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) { - if (locEnd(startParent) <= endNodeEnd) { - resultStartNode = startParent; + function flush() { + if (options8.useTabs) { + flushTabs(); } else { - break; - } - if (resultStartNode === resultEndNode) { - break; + flushSpaces(); } } - return { - startNode: resultStartNode, - endNode: resultEndNode - }; -} -function findNodeAtOffset(node, offset, options8, predicate, parentNodes = [], type) { - const { locStart, locEnd } = options8; - const start = locStart(node); - const end = locEnd(node); - if (offset > end || offset < start || type === "rangeEnd" && offset === start || type === "rangeStart" && offset === end) { - return; + function flushTabs() { + if (lastTabs > 0) { + addTabs(lastTabs); + } + resetLast(); } - for (const childNode of getSortedChildNodes(node, options8)) { - const childResult = findNodeAtOffset( - childNode, - offset, - options8, - predicate, - [node, ...parentNodes], - type - ); - if (childResult) { - return childResult; + function flushSpaces() { + if (lastSpaces > 0) { + addSpaces(lastSpaces); } + resetLast(); } - if (!predicate || predicate(node, parentNodes[0])) { - return { - node, - parentNodes - }; + function resetLast() { + lastTabs = 0; + lastSpaces = 0; } } -function isJsSourceElement(type, parentType) { - return parentType !== "DeclareExportDeclaration" && type !== "TypeParameterDeclaration" && (type === "Directive" || type === "TypeAlias" || type === "TSExportAssignment" || type.startsWith("Declare") || type.startsWith("TSDeclare") || type.endsWith("Statement") || type.endsWith("Declaration")); +function trim(out) { + let trimCount = 0; + let cursorCount = 0; + let outIndex = out.length; + outer: + while (outIndex--) { + const last = out[outIndex]; + if (last === CURSOR_PLACEHOLDER) { + cursorCount++; + continue; + } + if (false) { + throw new Error(`Unexpected value in trim: '${typeof last}'`); + } + for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) { + const char = last[charIndex]; + if (char === " " || char === " ") { + trimCount++; + } else { + out[outIndex] = last.slice(0, charIndex + 1); + break outer; + } + } + } + if (trimCount > 0 || cursorCount > 0) { + out.length = outIndex + 1; + while (cursorCount-- > 0) { + out.push(CURSOR_PLACEHOLDER); + } + } + return trimCount; } -var jsonSourceElements = /* @__PURE__ */ new Set([ - "JsonRoot", - "ObjectExpression", - "ArrayExpression", - "StringLiteral", - "NumericLiteral", - "BooleanLiteral", - "NullLiteral", - "UnaryExpression", - "TemplateLiteral" -]); -var graphqlSourceElements = /* @__PURE__ */ new Set([ - "OperationDefinition", - "FragmentDefinition", - "VariableDefinition", - "TypeExtensionDefinition", - "ObjectTypeDefinition", - "FieldDefinition", - "DirectiveDefinition", - "EnumTypeDefinition", - "EnumValueDefinition", - "InputValueDefinition", - "InputObjectTypeDefinition", - "SchemaDefinition", - "OperationTypeDefinition", - "InterfaceTypeDefinition", - "UnionTypeDefinition", - "ScalarTypeDefinition" -]); -function isSourceElement(opts, node, parentNode) { - if (!node) { - return false; +function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) { + if (width === Number.POSITIVE_INFINITY) { + return true; } - switch (opts.parser) { - case "flow": - case "babel": - case "babel-flow": - case "babel-ts": - case "typescript": - case "acorn": - case "espree": - case "meriyah": - case "__babel_estree": - return isJsSourceElement(node.type, parentNode == null ? void 0 : parentNode.type); - case "json": - case "json5": - case "json-stringify": - return jsonSourceElements.has(node.type); - case "graphql": - return graphqlSourceElements.has(node.kind); - case "vue": - return node.tag !== "root"; + let restIdx = restCommands.length; + const cmds = [next]; + const out = []; + while (width >= 0) { + if (cmds.length === 0) { + if (restIdx === 0) { + return true; + } + cmds.push(restCommands[--restIdx]); + continue; + } + const { + mode, + doc: doc2 + } = cmds.pop(); + switch (get_doc_type_default(doc2)) { + case DOC_TYPE_STRING: + out.push(doc2); + width -= get_string_width_default(doc2); + break; + case DOC_TYPE_ARRAY: + case DOC_TYPE_FILL: { + const parts = getDocParts(doc2); + for (let i = parts.length - 1; i >= 0; i--) { + cmds.push({ + mode, + doc: parts[i] + }); + } + break; + } + case DOC_TYPE_INDENT: + case DOC_TYPE_ALIGN: + case DOC_TYPE_INDENT_IF_BREAK: + case DOC_TYPE_LABEL: + cmds.push({ + mode, + doc: doc2.contents + }); + break; + case DOC_TYPE_TRIM: + width += trim(out); + break; + case DOC_TYPE_GROUP: { + if (mustBeFlat && doc2.break) { + return false; + } + const groupMode = doc2.break ? MODE_BREAK : mode; + const contents = doc2.expandedStates && groupMode === MODE_BREAK ? at_default( + /* isOptionalObject*/ + false, + doc2.expandedStates, + -1 + ) : doc2.contents; + cmds.push({ + mode: groupMode, + doc: contents + }); + break; + } + case DOC_TYPE_IF_BREAK: { + const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] || MODE_FLAT : mode; + const contents = groupMode === MODE_BREAK ? doc2.breakContents : doc2.flatContents; + if (contents) { + cmds.push({ + mode, + doc: contents + }); + } + break; + } + case DOC_TYPE_LINE: + if (mode === MODE_BREAK || doc2.hard) { + return true; + } + if (!doc2.soft) { + out.push(" "); + width--; + } + break; + case DOC_TYPE_LINE_SUFFIX: + hasLineSuffix = true; + break; + case DOC_TYPE_LINE_SUFFIX_BOUNDARY: + if (hasLineSuffix) { + return false; + } + break; + } } return false; } -function calculateRange(text, opts, ast) { - let { rangeStart: start, rangeEnd: end, locStart, locEnd } = opts; - assert3.ok(end > start); - const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/); - const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1; - if (!isAllWhitespace) { - start += firstNonWhitespaceCharacterIndex; - for (; end > start; --end) { - if (/\S/.test(text[end - 1])) { +function printDocToString(doc2, options8) { + const groupModeMap = {}; + const width = options8.printWidth; + const newLine = convertEndOfLineToChars(options8.endOfLine); + let pos2 = 0; + const cmds = [{ + ind: rootIndent(), + mode: MODE_BREAK, + doc: doc2 + }]; + const out = []; + let shouldRemeasure = false; + const lineSuffix2 = []; + let printedCursorCount = 0; + propagateBreaks(doc2); + while (cmds.length > 0) { + const { + ind, + mode, + doc: doc3 + } = cmds.pop(); + switch (get_doc_type_default(doc3)) { + case DOC_TYPE_STRING: { + const formatted = newLine !== "\n" ? string_replace_all_default( + /* isOptionalObject*/ + false, + doc3, + "\n", + newLine + ) : doc3; + out.push(formatted); + if (cmds.length > 0) { + pos2 += get_string_width_default(formatted); + } + break; + } + case DOC_TYPE_ARRAY: + for (let i = doc3.length - 1; i >= 0; i--) { + cmds.push({ + ind, + mode, + doc: doc3[i] + }); + } + break; + case DOC_TYPE_CURSOR: + if (printedCursorCount >= 2) { + throw new Error("There are too many 'cursor' in doc."); + } + out.push(CURSOR_PLACEHOLDER); + printedCursorCount++; + break; + case DOC_TYPE_INDENT: + cmds.push({ + ind: makeIndent(ind, options8), + mode, + doc: doc3.contents + }); + break; + case DOC_TYPE_ALIGN: + cmds.push({ + ind: makeAlign(ind, doc3.n, options8), + mode, + doc: doc3.contents + }); + break; + case DOC_TYPE_TRIM: + pos2 -= trim(out); + break; + case DOC_TYPE_GROUP: + switch (mode) { + case MODE_FLAT: + if (!shouldRemeasure) { + cmds.push({ + ind, + mode: doc3.break ? MODE_BREAK : MODE_FLAT, + doc: doc3.contents + }); + break; + } + case MODE_BREAK: { + shouldRemeasure = false; + const next = { + ind, + mode: MODE_FLAT, + doc: doc3.contents + }; + const rem = width - pos2; + const hasLineSuffix = lineSuffix2.length > 0; + if (!doc3.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) { + cmds.push(next); + } else { + if (doc3.expandedStates) { + const mostExpanded = at_default( + /* isOptionalObject*/ + false, + doc3.expandedStates, + -1 + ); + if (doc3.break) { + cmds.push({ + ind, + mode: MODE_BREAK, + doc: mostExpanded + }); + break; + } else { + for (let i = 1; i < doc3.expandedStates.length + 1; i++) { + if (i >= doc3.expandedStates.length) { + cmds.push({ + ind, + mode: MODE_BREAK, + doc: mostExpanded + }); + break; + } else { + const state = doc3.expandedStates[i]; + const cmd = { + ind, + mode: MODE_FLAT, + doc: state + }; + if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) { + cmds.push(cmd); + break; + } + } + } + } + } else { + cmds.push({ + ind, + mode: MODE_BREAK, + doc: doc3.contents + }); + } + } + break; + } + } + if (doc3.id) { + groupModeMap[doc3.id] = at_default( + /* isOptionalObject*/ + false, + cmds, + -1 + ).mode; + } + break; + case DOC_TYPE_FILL: { + const rem = width - pos2; + const { + parts + } = doc3; + if (parts.length === 0) { + break; + } + const [content, whitespace] = parts; + const contentFlatCmd = { + ind, + mode: MODE_FLAT, + doc: content + }; + const contentBreakCmd = { + ind, + mode: MODE_BREAK, + doc: content + }; + const contentFits = fits(contentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true); + if (parts.length === 1) { + if (contentFits) { + cmds.push(contentFlatCmd); + } else { + cmds.push(contentBreakCmd); + } + break; + } + const whitespaceFlatCmd = { + ind, + mode: MODE_FLAT, + doc: whitespace + }; + const whitespaceBreakCmd = { + ind, + mode: MODE_BREAK, + doc: whitespace + }; + if (parts.length === 2) { + if (contentFits) { + cmds.push(whitespaceFlatCmd, contentFlatCmd); + } else { + cmds.push(whitespaceBreakCmd, contentBreakCmd); + } + break; + } + parts.splice(0, 2); + const remainingCmd = { + ind, + mode, + doc: fill(parts) + }; + const secondContent = parts[0]; + const firstAndSecondContentFlatCmd = { + ind, + mode: MODE_FLAT, + doc: [content, whitespace, secondContent] + }; + const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true); + if (firstAndSecondContentFits) { + cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd); + } else if (contentFits) { + cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd); + } else { + cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd); + } + break; + } + case DOC_TYPE_IF_BREAK: + case DOC_TYPE_INDENT_IF_BREAK: { + const groupMode = doc3.groupId ? groupModeMap[doc3.groupId] : mode; + if (groupMode === MODE_BREAK) { + const breakContents = doc3.type === DOC_TYPE_IF_BREAK ? doc3.breakContents : doc3.negate ? doc3.contents : indent(doc3.contents); + if (breakContents) { + cmds.push({ + ind, + mode, + doc: breakContents + }); + } + } + if (groupMode === MODE_FLAT) { + const flatContents = doc3.type === DOC_TYPE_IF_BREAK ? doc3.flatContents : doc3.negate ? indent(doc3.contents) : doc3.contents; + if (flatContents) { + cmds.push({ + ind, + mode, + doc: flatContents + }); + } + } + break; + } + case DOC_TYPE_LINE_SUFFIX: + lineSuffix2.push({ + ind, + mode, + doc: doc3.contents + }); + break; + case DOC_TYPE_LINE_SUFFIX_BOUNDARY: + if (lineSuffix2.length > 0) { + cmds.push({ + ind, + mode, + doc: hardlineWithoutBreakParent + }); + } + break; + case DOC_TYPE_LINE: + switch (mode) { + case MODE_FLAT: + if (!doc3.hard) { + if (!doc3.soft) { + out.push(" "); + pos2 += 1; + } + break; + } else { + shouldRemeasure = true; + } + case MODE_BREAK: + if (lineSuffix2.length > 0) { + cmds.push({ + ind, + mode, + doc: doc3 + }, ...lineSuffix2.reverse()); + lineSuffix2.length = 0; + break; + } + if (doc3.literal) { + if (ind.root) { + out.push(newLine, ind.root.value); + pos2 = ind.root.length; + } else { + out.push(newLine); + pos2 = 0; + } + } else { + pos2 -= trim(out); + out.push(newLine + ind.value); + pos2 = ind.length; + } + break; + } + break; + case DOC_TYPE_LABEL: + cmds.push({ + ind, + mode, + doc: doc3.contents + }); break; - } + case DOC_TYPE_BREAK_PARENT: + break; + default: + throw new invalid_doc_error_default(doc3); + } + if (cmds.length === 0 && lineSuffix2.length > 0) { + cmds.push(...lineSuffix2.reverse()); + lineSuffix2.length = 0; } } - const startNodeAndParents = findNodeAtOffset( - ast, - start, - opts, - (node, parentNode) => isSourceElement(opts, node, parentNode), - [], - "rangeStart" - ); - const endNodeAndParents = ( - // No need find Node at `end`, it will be the same as `startNodeAndParents` - isAllWhitespace ? startNodeAndParents : findNodeAtOffset( - ast, - end, - opts, - (node) => isSourceElement(opts, node), - [], - "rangeEnd" - ) - ); - if (!startNodeAndParents || !endNodeAndParents) { + const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER); + if (cursorPlaceholderIndex !== -1) { + const otherCursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER, cursorPlaceholderIndex + 1); + const beforeCursor = out.slice(0, cursorPlaceholderIndex).join(""); + const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join(""); + const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join(""); return { - rangeStart: 0, - rangeEnd: 0 + formatted: beforeCursor + aroundCursor + afterCursor, + cursorNodeStart: beforeCursor.length, + cursorNodeText: aroundCursor }; } - let startNode; - let endNode; - if (isJsonParser(opts)) { - const commonAncestor = findCommonAncestor( - startNodeAndParents, - endNodeAndParents - ); - startNode = commonAncestor; - endNode = commonAncestor; - } else { - ({ startNode, endNode } = findSiblingAncestors( - startNodeAndParents, - endNodeAndParents, - opts - )); - } return { - rangeStart: Math.min(locStart(startNode), locStart(endNode)), - rangeEnd: Math.max(locEnd(startNode), locEnd(endNode)) + formatted: out.join("") }; } -// src/main/get-cursor-node.js -function getCursorNode(ast, options8) { - const { cursorOffset, locStart, locEnd } = options8; - const getVisitorKeys = create_get_visitor_keys_function_default( - options8.printer.getVisitorKeys - ); - const nodeContainsCursor = (node) => locStart(node) <= cursorOffset && locEnd(node) >= cursorOffset; - let cursorNode = ast; - for (const node of getDescendants(ast, { - getVisitorKeys, - filter: nodeContainsCursor - })) { - cursorNode = node; +// src/utils/get-alignment-size.js +function getAlignmentSize(text, tabWidth, startIndex = 0) { + let size = 0; + for (let i = startIndex; i < text.length; ++i) { + if (text[i] === " ") { + size = size + tabWidth - size % tabWidth; + } else { + size++; + } } - return cursorNode; + return size; } -var get_cursor_node_default = getCursorNode; +var get_alignment_size_default = getAlignmentSize; -// src/main/core.js -var BOM = "\uFEFF"; -var CURSOR = Symbol("cursor"); -async function coreFormat(originalText, opts, addAlignmentSize = 0) { - if (!originalText || originalText.trim().length === 0) { - return { - formatted: "", - cursorOffset: -1, - comments: [] - }; +// src/common/ast-path.js +var _getNodeStackIndex, getNodeStackIndex_fn, _getAncestors, getAncestors_fn; +var AstPath = class { + constructor(value) { + __privateAdd(this, _getNodeStackIndex); + __privateAdd(this, _getAncestors); + this.stack = [value]; } - const { - ast, - text - } = await parse_default(originalText, opts); - if (opts.cursorOffset >= 0) { - opts.cursorNode = get_cursor_node_default(ast, opts); + /** @type {string | null} */ + get key() { + const { + stack: stack2, + siblings + } = this; + return at_default( + /* isOptionalObject*/ + false, + stack2, + siblings === null ? -2 : -4 + ) ?? null; } - let doc2 = await printAstToDoc(ast, opts, addAlignmentSize); - if (addAlignmentSize > 0) { - doc2 = addAlignmentToDoc([hardline, doc2], addAlignmentSize, opts.tabWidth); + /** @type {number | null} */ + get index() { + return this.siblings === null ? null : at_default( + /* isOptionalObject*/ + false, + this.stack, + -2 + ); } - const result = printDocToString(doc2, opts); - if (addAlignmentSize > 0) { - const trimmed = result.formatted.trim(); - if (result.cursorNodeStart !== void 0) { - result.cursorNodeStart -= result.formatted.indexOf(trimmed); - } - result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine); + /** @type {object} */ + get node() { + return at_default( + /* isOptionalObject*/ + false, + this.stack, + -1 + ); } - const comments = opts[Symbol.for("comments")]; - if (opts.cursorOffset >= 0) { - let oldCursorNodeStart; - let oldCursorNodeText; - let cursorOffsetRelativeToOldCursorNode; - let newCursorNodeStart; - let newCursorNodeText; - if (opts.cursorNode && result.cursorNodeText) { - oldCursorNodeStart = opts.locStart(opts.cursorNode); - oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode)); - cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart; - newCursorNodeStart = result.cursorNodeStart; - newCursorNodeText = result.cursorNodeText; - } else { - oldCursorNodeStart = 0; - oldCursorNodeText = text; - cursorOffsetRelativeToOldCursorNode = opts.cursorOffset; - newCursorNodeStart = 0; - newCursorNodeText = result.formatted; - } - if (oldCursorNodeText === newCursorNodeText) { - return { - formatted: result.formatted, - cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode, - comments - }; - } - const oldCursorNodeCharArray = oldCursorNodeText.split(""); - oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR); - const newCursorNodeCharArray = newCursorNodeText.split(""); - const cursorNodeDiff = (0, import_diff.diffArrays)(oldCursorNodeCharArray, newCursorNodeCharArray); - let cursorOffset = newCursorNodeStart; - for (const entry of cursorNodeDiff) { - if (entry.removed) { - if (entry.value.includes(CURSOR)) { - break; - } - } else { - cursorOffset += entry.count; - } + /** @type {object | null} */ + get parent() { + return this.getNode(1); + } + /** @type {object | null} */ + get grandparent() { + return this.getNode(2); + } + /** @type {boolean} */ + get isInArray() { + return this.siblings !== null; + } + /** @type {object[] | null} */ + get siblings() { + const { + stack: stack2 + } = this; + const maybeArray = at_default( + /* isOptionalObject*/ + false, + stack2, + -3 + ); + return Array.isArray(maybeArray) ? maybeArray : null; + } + /** @type {object | null} */ + get next() { + const { + siblings + } = this; + return siblings === null ? null : siblings[this.index + 1]; + } + /** @type {object | null} */ + get previous() { + const { + siblings + } = this; + return siblings === null ? null : siblings[this.index - 1]; + } + /** @type {boolean} */ + get isFirst() { + return this.index === 0; + } + /** @type {boolean} */ + get isLast() { + const { + siblings, + index + } = this; + return siblings !== null && index === siblings.length - 1; + } + /** @type {boolean} */ + get isRoot() { + return this.stack.length === 1; + } + /** @type {object} */ + get root() { + return this.stack[0]; + } + /** @type {object[]} */ + get ancestors() { + return [...__privateMethod(this, _getAncestors, getAncestors_fn).call(this)]; + } + // The name of the current property is always the penultimate element of + // this.stack, and always a string/number/symbol. + getName() { + const { + stack: stack2 + } = this; + const { + length + } = stack2; + if (length > 1) { + return at_default( + /* isOptionalObject*/ + false, + stack2, + -2 + ); } - return { - formatted: result.formatted, - cursorOffset, - comments - }; + return null; } - return { - formatted: result.formatted, - cursorOffset: -1, - comments - }; -} -async function formatRange(originalText, opts) { - const { - ast, - text - } = await parse_default(originalText, opts); - const { - rangeStart, - rangeEnd - } = calculateRange(text, opts, ast); - const rangeString = text.slice(rangeStart, rangeEnd); - const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1); - const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0]; - const alignmentSize = get_alignment_size_default(indentString, opts.tabWidth); - const rangeResult = await coreFormat(rangeString, { - ...opts, - rangeStart: 0, - rangeEnd: Number.POSITIVE_INFINITY, - // Track the cursor offset only if it's within our range - cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1, - // Always use `lf` to format, we'll replace it later - endOfLine: "lf" - }, alignmentSize); - const rangeTrimmed = rangeResult.formatted.trimEnd(); - let { - cursorOffset - } = opts; - if (cursorOffset > rangeEnd) { - cursorOffset += rangeTrimmed.length - rangeString.length; - } else if (rangeResult.cursorOffset >= 0) { - cursorOffset = rangeResult.cursorOffset + rangeStart; + // The value of the current property is always the final element of + // this.stack. + getValue() { + return at_default( + /* isOptionalObject*/ + false, + this.stack, + -1 + ); } - let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd); - if (opts.endOfLine !== "lf") { - const eol = convertEndOfLineToChars(opts.endOfLine); - if (cursorOffset >= 0 && eol === "\r\n") { - cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n"); - } - formatted = string_replace_all_default( + getNode(count = 0) { + const stackIndex = __privateMethod(this, _getNodeStackIndex, getNodeStackIndex_fn).call(this, count); + return stackIndex === -1 ? null : this.stack[stackIndex]; + } + getParentNode(count = 0) { + return this.getNode(count + 1); + } + // Temporarily push properties named by string arguments given after the + // callback function onto this.stack, then call the callback with a + // reference to this (modified) AstPath object. Note that the stack will + // be restored to its original state after the callback is finished, so it + // is probably a mistake to retain a reference to the path. + call(callback, ...names) { + const { + stack: stack2 + } = this; + const { + length + } = stack2; + let value = at_default( /* isOptionalObject*/ false, - formatted, - "\n", - eol + stack2, + -1 ); + for (const name of names) { + value = value[name]; + stack2.push(name, value); + } + try { + return callback(this); + } finally { + stack2.length = length; + } } - return { - formatted, - cursorOffset, - comments: rangeResult.comments - }; -} -function ensureIndexInText(text, index, defaultValue) { - if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) { - return defaultValue; + callParent(callback, count = 0) { + const stackIndex = __privateMethod(this, _getNodeStackIndex, getNodeStackIndex_fn).call(this, count + 1); + const parentValues = this.stack.splice(stackIndex + 1); + try { + return callback(this); + } finally { + this.stack.push(...parentValues); + } } - return index; -} -function normalizeIndexes(text, options8) { - let { - cursorOffset, - rangeStart, - rangeEnd - } = options8; - cursorOffset = ensureIndexInText(text, cursorOffset, -1); - rangeStart = ensureIndexInText(text, rangeStart, 0); - rangeEnd = ensureIndexInText(text, rangeEnd, text.length); - return { - ...options8, - cursorOffset, - rangeStart, - rangeEnd - }; -} -function normalizeInputAndOptions(text, options8) { - let { - cursorOffset, - rangeStart, - rangeEnd, - endOfLine - } = normalizeIndexes(text, options8); - const hasBOM = text.charAt(0) === BOM; - if (hasBOM) { - text = text.slice(1); - cursorOffset--; - rangeStart--; - rangeEnd--; + // Similar to AstPath.prototype.call, except that the value obtained by + // accessing this.getValue()[name1][name2]... should be array. The + // callback will be called with a reference to this path object for each + // element of the array. + each(callback, ...names) { + const { + stack: stack2 + } = this; + const { + length + } = stack2; + let value = at_default( + /* isOptionalObject*/ + false, + stack2, + -1 + ); + for (const name of names) { + value = value[name]; + stack2.push(name, value); + } + try { + for (let i = 0; i < value.length; ++i) { + stack2.push(i, value[i]); + callback(this, i, value); + stack2.length -= 2; + } + } finally { + stack2.length = length; + } } - if (endOfLine === "auto") { - endOfLine = guessEndOfLine(text); + // Similar to AstPath.prototype.each, except that the results of the + // callback function invocations are stored in an array and returned at + // the end of the iteration. + map(callback, ...names) { + const result = []; + this.each((path13, index, value) => { + result[index] = callback(path13, index, value); + }, ...names); + return result; } - if (text.includes("\r")) { - const countCrlfBefore = (index) => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n"); - cursorOffset -= countCrlfBefore(cursorOffset); - rangeStart -= countCrlfBefore(rangeStart); - rangeEnd -= countCrlfBefore(rangeEnd); - text = normalizeEndOfLine(text); + /** + * @param {...( + * | ((node: any, name: string | null, number: number | null) => boolean) + * | undefined + * )} predicates + */ + match(...predicates) { + let stackPointer = this.stack.length - 1; + let name = null; + let node = this.stack[stackPointer--]; + for (const predicate of predicates) { + if (node === void 0) { + return false; + } + let number = null; + if (typeof name === "number") { + number = name; + name = this.stack[stackPointer--]; + node = this.stack[stackPointer--]; + } + if (predicate && !predicate(node, name, number)) { + return false; + } + name = this.stack[stackPointer--]; + node = this.stack[stackPointer--]; + } + return true; } - return { - hasBOM, - text, - options: normalizeIndexes(text, { - ...options8, - cursorOffset, - rangeStart, - rangeEnd, - endOfLine - }) - }; -} -async function hasPragma(text, options8) { - const selectedParser = await resolveParser(options8); - return !selectedParser.hasPragma || selectedParser.hasPragma(text); -} -async function formatWithCursor(originalText, originalOptions) { - let { - hasBOM, - text, - options: options8 - } = normalizeInputAndOptions(originalText, await normalize_format_options_default(originalOptions)); - if (options8.rangeStart >= options8.rangeEnd && text !== "" || options8.requirePragma && !await hasPragma(text, options8)) { - return { - formatted: originalText, - cursorOffset: originalOptions.cursorOffset, - comments: [] - }; + /** + * Traverses the ancestors of the current node heading toward the tree root + * until it finds a node that matches the provided predicate function. Will + * return the first matching ancestor. If no such node exists, returns undefined. + * @param {(node: any) => boolean} predicate + * @internal Unstable API. Don't use in plugins for now. + */ + findAncestor(predicate) { + for (const node of __privateMethod(this, _getAncestors, getAncestors_fn).call(this)) { + if (predicate(node)) { + return node; + } + } } - let result; - if (options8.rangeStart > 0 || options8.rangeEnd < text.length) { - result = await formatRange(text, options8); - } else { - if (!options8.requirePragma && options8.insertPragma && options8.printer.insertPragma && !await hasPragma(text, options8)) { - text = options8.printer.insertPragma(text); + /** + * Traverses the ancestors of the current node heading toward the tree root + * until it finds a node that matches the provided predicate function. + * returns true if matched node found. + * @param {(node: any) => boolean} predicate + * @returns {boolean} + * @internal Unstable API. Don't use in plugins for now. + */ + hasAncestor(predicate) { + for (const node of __privateMethod(this, _getAncestors, getAncestors_fn).call(this)) { + if (predicate(node)) { + return true; + } } - result = await coreFormat(text, options8); + return false; } - if (hasBOM) { - result.formatted = BOM + result.formatted; - if (result.cursorOffset >= 0) { - result.cursorOffset++; +}; +_getNodeStackIndex = new WeakSet(); +getNodeStackIndex_fn = function(count) { + const { + stack: stack2 + } = this; + for (let i = stack2.length - 1; i >= 0; i -= 2) { + if (!Array.isArray(stack2[i]) && --count < 0) { + return i; } } - return result; -} -async function parse2(originalText, originalOptions, devOptions) { + return -1; +}; +_getAncestors = new WeakSet(); +getAncestors_fn = function* () { const { - text, - options: options8 - } = normalizeInputAndOptions(originalText, await normalize_format_options_default(originalOptions)); - const parsed = await parse_default(text, options8); - if (devOptions) { - if (devOptions.preprocessForPrint) { - parsed.ast = await prepareToPrint(parsed.ast, options8); - } - if (devOptions.massage) { - parsed.ast = massage_ast_default(parsed.ast, options8); + stack: stack2 + } = this; + for (let index = stack2.length - 3; index >= 0; index -= 2) { + const value = stack2[index]; + if (!Array.isArray(value)) { + yield value; } } - return parsed; -} -async function formatAst(ast, options8) { - options8 = await normalize_format_options_default(options8); - const doc2 = await printAstToDoc(ast, options8); - return printDocToString(doc2, options8); -} -async function formatDoc(doc2, options8) { - const text = printDocToDebug(doc2); - const { - formatted - } = await formatWithCursor(text, { - ...options8, - parser: "__js_expression" - }); - return formatted; -} -async function printToDoc(originalText, options8) { - options8 = await normalize_format_options_default(options8); - const { - ast - } = await parse_default(originalText, options8); - return printAstToDoc(ast, options8); -} -async function printDocToString2(doc2, options8) { - return printDocToString(doc2, await normalize_format_options_default(options8)); -} +}; +var ast_path_default = AstPath; -// src/config/resolve-config.js -var import_micromatch = __toESM(require_micromatch(), 1); -import path5 from "path"; +// src/main/comments/attach.js +import assert4 from "assert"; -// node_modules/mimic-fn/index.js -var copyProperty = (to, from, property, ignoreNonConfigurable) => { - if (property === "length" || property === "prototype") { - return; - } - if (property === "arguments" || property === "caller") { - return; - } - const toDescriptor = Object.getOwnPropertyDescriptor(to, property); - const fromDescriptor = Object.getOwnPropertyDescriptor(from, property); - if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) { - return; - } - Object.defineProperty(to, property, fromDescriptor); -}; -var canCopyProperty = function(toDescriptor, fromDescriptor) { - return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value); -}; -var changePrototype = (to, from) => { - const fromPrototype = Object.getPrototypeOf(from); - if (fromPrototype === Object.getPrototypeOf(to)) { - return; +// src/utils/is-object.js +function isObject2(object) { + return object !== null && typeof object === "object"; +} +var is_object_default = isObject2; + +// src/utils/ast-utils.js +function* getChildren(node, options8) { + const { getVisitorKeys, filter: filter2 = () => true } = options8; + const isMatchedNode = (node2) => is_object_default(node2) && filter2(node2); + for (const key2 of getVisitorKeys(node)) { + const value = node[key2]; + if (Array.isArray(value)) { + for (const child of value) { + if (isMatchedNode(child)) { + yield child; + } + } + } else if (isMatchedNode(value)) { + yield value; + } } - Object.setPrototypeOf(to, fromPrototype); -}; -var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/ -${fromBody}`; -var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString"); -var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name"); -var changeToString = (to, from, name) => { - const withName = name === "" ? "" : `with ${name.trim()}() `; - const newToString = wrappedToString.bind(null, withName, from.toString()); - Object.defineProperty(newToString, "name", toStringName); - Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString }); -}; -function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) { - const { name } = to; - for (const property of Reflect.ownKeys(from)) { - copyProperty(to, from, property, ignoreNonConfigurable); +} +function* getDescendants(node, options8) { + const queue = [node]; + for (let index = 0; index < queue.length; index++) { + const node2 = queue[index]; + for (const child of getChildren(node2, options8)) { + yield child; + queue.push(child); + } } - changePrototype(to, from); - changeToString(to, from, name); - return to; } -// node_modules/mem/dist/index.js -var import_map_age_cleaner = __toESM(require_dist(), 1); -var cacheStore = /* @__PURE__ */ new WeakMap(); -function mem(fn, { cacheKey, cache: cache2 = /* @__PURE__ */ new Map(), maxAge } = {}) { - if (typeof maxAge === "number") { - (0, import_map_age_cleaner.default)(cache2); - } - const memoized = function(...arguments_) { - const key = cacheKey ? cacheKey(arguments_) : arguments_[0]; - const cacheItem = cache2.get(key); - if (cacheItem) { - return cacheItem.data; +// src/utils/skip.js +function skip(characters) { + return (text, startIndex, options8) => { + const backwards = Boolean(options8 == null ? void 0 : options8.backwards); + if (startIndex === false) { + return false; } - const result = fn.apply(this, arguments_); - cache2.set(key, { - data: result, - maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY - }); - return result; + const { length } = text; + let cursor2 = startIndex; + while (cursor2 >= 0 && cursor2 < length) { + const character = text.charAt(cursor2); + if (characters instanceof RegExp) { + if (!characters.test(character)) { + return cursor2; + } + } else if (!characters.includes(character)) { + return cursor2; + } + backwards ? cursor2-- : cursor2++; + } + if (cursor2 === -1 || cursor2 === length) { + return cursor2; + } + return false; }; - mimicFunction(memoized, fn, { - ignoreNonConfigurable: true - }); - cacheStore.set(memoized, cache2); - return memoized; } -function memClear(fn) { - const cache2 = cacheStore.get(fn); - if (!cache2) { - throw new TypeError("Can't clear a function that was not memoized!"); +var skipWhitespace = skip(/\s/); +var skipSpaces = skip(" "); +var skipToLineEnd = skip(",; "); +var skipEverythingButNewLine = skip(/[^\n\r]/); + +// src/utils/skip-newline.js +function skipNewline(text, startIndex, options8) { + const backwards = Boolean(options8 == null ? void 0 : options8.backwards); + if (startIndex === false) { + return false; } - if (typeof cache2.clear !== "function") { - throw new TypeError("The cache Map can't be cleared!"); + const character = text.charAt(startIndex); + if (backwards) { + if (text.charAt(startIndex - 1) === "\r" && character === "\n") { + return startIndex - 2; + } + if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") { + return startIndex - 1; + } + } else { + if (character === "\r" && text.charAt(startIndex + 1) === "\n") { + return startIndex + 2; + } + if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") { + return startIndex + 1; + } } - cache2.clear(); + return startIndex; } +var skip_newline_default = skipNewline; -// node_modules/url-or-path/index.js -import { fileURLToPath, pathToFileURL } from "url"; -var isUrlInstance = (urlOrPath) => urlOrPath instanceof URL; -var isUrlString = (urlOrPath) => typeof urlOrPath === "string" && urlOrPath.startsWith("file://"); -var isUrl = (urlOrPath) => isUrlInstance(urlOrPath) || isUrlString(urlOrPath); -var toPath = (urlOrPath) => isUrl(urlOrPath) ? fileURLToPath(urlOrPath) : urlOrPath; - -// src/utils/partition.js -function partition2(array2, predicate) { - const result = [[], []]; - for (const value of array2) { - result[predicate(value) ? 0 : 1].push(value); - } - return result; +// src/utils/has-newline.js +function hasNewline(text, startIndex, options8 = {}) { + const idx = skipSpaces( + text, + options8.backwards ? startIndex - 1 : startIndex, + options8 + ); + const idx2 = skip_newline_default(text, idx, options8); + return idx !== idx2; } -var partition_default = partition2; +var has_newline_default = hasNewline; -// src/config/resolve-editorconfig.js -var import_editorconfig = __toESM(require_src(), 1); -import path2 from "path"; +// src/utils/is-non-empty-array.js +function isNonEmptyArray(object) { + return Array.isArray(object) && object.length > 0; +} +var is_non_empty_array_default = isNonEmptyArray; -// src/config/editorconfig-to-prettier.js -function removeUnset(editorConfig) { - const result = {}; - const keys = Object.keys(editorConfig); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - if (editorConfig[key] === "unset") { - continue; - } - result[key] = editorConfig[key]; - } - return result; +// src/main/create-get-visitor-keys-function.js +var nonTraversableKeys = /* @__PURE__ */ new Set([ + "tokens", + "comments", + "parent", + "enclosingNode", + "precedingNode", + "followingNode" +]); +var defaultGetVisitorKeys = (node) => Object.keys(node).filter((key2) => !nonTraversableKeys.has(key2)); +function createGetVisitorKeysFunction(printerGetVisitorKeys) { + return printerGetVisitorKeys ? (node) => printerGetVisitorKeys(node, nonTraversableKeys) : defaultGetVisitorKeys; } -function editorConfigToPrettier(editorConfig) { - if (!editorConfig) { - return null; - } - editorConfig = removeUnset(editorConfig); - if (Object.keys(editorConfig).length === 0) { - return null; - } - const result = {}; - if (editorConfig.indent_style) { - result.useTabs = editorConfig.indent_style === "tab"; - } - if (editorConfig.indent_size === "tab") { - result.useTabs = true; - } - if (result.useTabs && editorConfig.tab_width) { - result.tabWidth = editorConfig.tab_width; - } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") { - result.tabWidth = editorConfig.indent_size; - } else if (editorConfig.tab_width !== void 0) { - result.tabWidth = editorConfig.tab_width; - } - if (editorConfig.max_line_length) { - if (editorConfig.max_line_length === "off") { - result.printWidth = Number.POSITIVE_INFINITY; - } else { - result.printWidth = editorConfig.max_line_length; - } - } - if (editorConfig.quote_type === "single") { - result.singleQuote = true; - } else if (editorConfig.quote_type === "double") { - result.singleQuote = false; - } - if (["cr", "crlf", "lf"].includes(editorConfig.end_of_line)) { - result.endOfLine = editorConfig.end_of_line; +var create_get_visitor_keys_function_default = createGetVisitorKeysFunction; + +// src/main/comments/utils.js +function describeNodeForDebugging(node) { + const nodeType = node.type || node.kind || "(unknown type)"; + let nodeName = String( + node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || "" + ); + if (nodeName.length > 20) { + nodeName = nodeName.slice(0, 19) + "\u2026"; } - return result; + return nodeType + (nodeName ? " " + nodeName : ""); } -var editorconfig_to_prettier_default = editorConfigToPrettier; - -// src/config/find-project-root.js -import fs2 from "fs"; -import path from "path"; -var MARKERS = [".git", ".hg"]; -var markerExists = (directory) => MARKERS.some((mark) => fs2.existsSync(path.join(directory, mark))); -function findProjectRoot(directory) { - while (!markerExists(directory)) { - const parentDirectory = path.resolve(directory, ".."); - if (parentDirectory === directory) { - break; - } - directory = parentDirectory; - } - return directory; +function addCommentHelper(node, comment) { + const comments = node.comments ?? (node.comments = []); + comments.push(comment); + comment.printed = false; + comment.nodeDescription = describeNodeForDebugging(node); } -var find_project_root_default = findProjectRoot; - -// src/config/resolve-editorconfig.js -async function loadEditorConfig(filePath) { - const editorConfig = await import_editorconfig.default.parse(filePath, { - root: find_project_root_default(path2.dirname(path2.resolve(filePath))) - }); - const config = editorconfig_to_prettier_default(editorConfig); - return config; +function addLeadingComment(node, comment) { + comment.leading = true; + comment.trailing = false; + addCommentHelper(node, comment); } -var resolve_editorconfig_default = loadEditorConfig; - -// src/config/get-prettier-config-explorer.js -var import_parse_async = __toESM(require_parse_async(), 1); -var import_parse3 = __toESM(require_parse3(), 1); -var import_js_yaml = __toESM(require_loader(), 1); -import { pathToFileURL as pathToFileURL4 } from "url"; - -// node_modules/parse-json/index.js -var import_json_parse_even_better_errors = __toESM(require_lib4(), 1); -var import_code_frame2 = __toESM(require_lib3(), 1); - -// node_modules/index-to-position/index.js -var safeLastIndexOf = (string, searchString, index) => index < 0 ? -1 : string.lastIndexOf(searchString, index); -function getPosition(text, textIndex) { - const lineBreakBefore = safeLastIndexOf(text, "\n", textIndex - 1); - const column = textIndex - lineBreakBefore - 1; - let line2 = 0; - for (let index = lineBreakBefore; index >= 0; index = safeLastIndexOf(text, "\n", index - 1)) { - line2++; +function addDanglingComment(node, comment, marker) { + comment.leading = false; + comment.trailing = false; + if (marker) { + comment.marker = marker; } - return { line: line2, column }; + addCommentHelper(node, comment); } -function indexToLineColumn(text, textIndex, { oneBased = false } = {}) { - if (textIndex < 0 || textIndex >= text.length && text.length > 0) { - throw new RangeError("Index out of bounds"); - } - const position = getPosition(text, textIndex); - return oneBased ? { line: position.line + 1, column: position.column + 1 } : position; +function addTrailingComment(node, comment) { + comment.leading = false; + comment.trailing = true; + addCommentHelper(node, comment); } -// node_modules/parse-json/index.js -var _message; -var _JSONError = class _JSONError extends Error { - constructor(message) { - var _a; - super(); - __publicField(this, "name", "JSONError"); - __publicField(this, "fileName"); - __publicField(this, "codeFrame"); - __publicField(this, "rawCodeFrame"); - __privateAdd(this, _message, void 0); - __privateSet(this, _message, message); - (_a = Error.captureStackTrace) == null ? void 0 : _a.call(Error, this, _JSONError); - } - get message() { - const { fileName, codeFrame } = this; - return `${__privateGet(this, _message)}${fileName ? ` in ${fileName}` : ""}${codeFrame ? ` - -${codeFrame} -` : ""}`; - } - set message(message) { - __privateSet(this, _message, message); - } -}; -_message = new WeakMap(); -var JSONError = _JSONError; -var generateCodeFrame = (string, location, highlightCode = true) => (0, import_code_frame2.codeFrameColumns)(string, { start: location }, { highlightCode }); -var getErrorLocation = (string, message) => { - const match = message.match(/in JSON at position (? \d+)(?: \(line (? \d+) column (? \d+)\))? while parsing/); - if (!match) { - return; - } - let { index, line: line2, column } = match.groups; - if (line2 && column) { - return { line: Number(line2), column: Number(column) }; - } - index = Number(index); - if (index === string.length) { - const { line: line3, column: column2 } = indexToLineColumn(string, string.length - 1, { oneBased: true }); - return { line: line3, column: column2 + 1 }; - } - return indexToLineColumn(string, index, { oneBased: true }); -}; -function parseJson(string, reviver, filename) { - if (typeof reviver === "string") { - filename = reviver; - reviver = void 0; - } - let message; - try { - return JSON.parse(string, reviver); - } catch (error) { - message = error.message; +// src/main/comments/attach.js +var childNodesCache = /* @__PURE__ */ new WeakMap(); +function getSortedChildNodes(node, options8) { + if (childNodesCache.has(node)) { + return childNodesCache.get(node); } - try { - (0, import_json_parse_even_better_errors.default)(string, reviver); - } catch (error) { - message = error.message; + const { + printer: { + getCommentChildNodes, + canAttachComment, + getVisitorKeys: printerGetVisitorKeys + }, + locStart, + locEnd + } = options8; + if (!canAttachComment) { + return []; } - message = message.replaceAll("\n", ""); - const jsonError = new JSONError(message); - if (filename) { - jsonError.fileName = filename; + const childNodes = ((getCommentChildNodes == null ? void 0 : getCommentChildNodes(node, options8)) ?? [ + ...getChildren(node, { + getVisitorKeys: create_get_visitor_keys_function_default(printerGetVisitorKeys) + }) + ]).flatMap( + (node2) => canAttachComment(node2) ? [node2] : getSortedChildNodes(node2, options8) + ); + childNodes.sort( + (nodeA, nodeB) => locStart(nodeA) - locStart(nodeB) || locEnd(nodeA) - locEnd(nodeB) + ); + childNodesCache.set(node, childNodes); + return childNodes; +} +function decorateComment(node, comment, options8, enclosingNode) { + const { locStart, locEnd } = options8; + const commentStart = locStart(comment); + const commentEnd = locEnd(comment); + const childNodes = getSortedChildNodes(node, options8); + let precedingNode; + let followingNode; + let left = 0; + let right = childNodes.length; + while (left < right) { + const middle = left + right >> 1; + const child = childNodes[middle]; + const start = locStart(child); + const end = locEnd(child); + if (start <= commentStart && commentEnd <= end) { + return decorateComment(child, comment, options8, child); + } + if (end <= commentStart) { + precedingNode = child; + left = middle + 1; + continue; + } + if (commentEnd <= start) { + followingNode = child; + right = middle; + continue; + } + throw new Error("Comment location overlaps with node location"); } - const location = getErrorLocation(string, message); - if (location) { - jsonError.codeFrame = generateCodeFrame(string, location); - jsonError.rawCodeFrame = generateCodeFrame( - string, - location, - /* highlightCode */ - false + if ((enclosingNode == null ? void 0 : enclosingNode.type) === "TemplateLiteral") { + const { quasis } = enclosingNode; + const commentIndex = findExpressionIndexForComment( + quasis, + comment, + options8 ); + if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options8) !== commentIndex) { + precedingNode = null; + } + if (followingNode && findExpressionIndexForComment(quasis, followingNode, options8) !== commentIndex) { + followingNode = null; + } } - throw jsonError; -} - -// src/config/get-prettier-config-explorer.js -import mockable from "./internal/internal.mjs"; - -// src/utils/require-from-file.js -import { createRequire } from "module"; -function requireFromFile(id, parent) { - const require2 = createRequire(parent); - return require2(id); -} -var require_from_file_default = requireFromFile; - -// src/utils/import-from-file.js -import { pathToFileURL as pathToFileURL3 } from "url"; - -// node_modules/import-meta-resolve/lib/resolve.js -import assert5 from "assert"; -import { Stats, statSync, realpathSync } from "fs"; -import process3 from "process"; -import { URL as URL3, fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "url"; -import path4 from "path"; -import { builtinModules } from "module"; - -// node_modules/import-meta-resolve/lib/get-format.js -import { fileURLToPath as fileURLToPath4 } from "url"; - -// node_modules/import-meta-resolve/lib/package-config.js -import { URL as URL2, fileURLToPath as fileURLToPath3 } from "url"; - -// node_modules/import-meta-resolve/lib/package-json-reader.js -import fs3 from "fs"; -import path3 from "path"; -import { fileURLToPath as fileURLToPath2 } from "url"; - -// node_modules/import-meta-resolve/lib/errors.js -import v8 from "v8"; -import assert4 from "assert"; -import { format, inspect } from "util"; -var own = {}.hasOwnProperty; -var classRegExp = /^([A-Z][a-z\d]*)+$/; -var kTypes = /* @__PURE__ */ new Set([ - "string", - "function", - "number", - "object", - // Accept 'Function' and 'Object' as alternative to the lower cased version. - "Function", - "Object", - "boolean", - "bigint", - "symbol" -]); -var codes = {}; -function formatList(array2, type = "and") { - return array2.length < 3 ? array2.join(` ${type} `) : `${array2.slice(0, -1).join(", ")}, ${type} ${array2[array2.length - 1]}`; + return { enclosingNode, precedingNode, followingNode }; } -var messages = /* @__PURE__ */ new Map(); -var nodeInternalPrefix = "__node_internal_"; -var userStackTraceLimit; -codes.ERR_INVALID_ARG_TYPE = createError( - "ERR_INVALID_ARG_TYPE", - /** - * @param {string} name - * @param {Array | string} expected - * @param {unknown} actual - */ - (name, expected, actual) => { - assert4(typeof name === "string", "'name' must be a string"); - if (!Array.isArray(expected)) { - expected = [expected]; +var returnFalse = () => false; +function attachComments(ast, options8) { + const { comments } = ast; + delete ast.comments; + if (!is_non_empty_array_default(comments) || !options8.printer.canAttachComment) { + return; + } + const tiesToBreak = []; + const { + locStart, + locEnd, + printer: { + experimentalFeatures: { + // TODO: Make this as default behavior + avoidAstMutation = false + } = {}, + handleComments = {} + }, + originalText: text + } = options8; + const { + ownLine: handleOwnLineComment = returnFalse, + endOfLine: handleEndOfLineComment = returnFalse, + remaining: handleRemainingComment = returnFalse + } = handleComments; + const decoratedComments = comments.map((comment, index) => ({ + ...decorateComment(ast, comment, options8), + comment, + text, + options: options8, + ast, + isLastComment: comments.length - 1 === index + })); + for (const [index, context] of decoratedComments.entries()) { + const { + comment, + precedingNode, + enclosingNode, + followingNode, + text: text2, + options: options9, + ast: ast2, + isLastComment + } = context; + if (options9.parser === "json" || options9.parser === "json5" || options9.parser === "jsonc" || options9.parser === "__js_expression" || options9.parser === "__ts_expression" || options9.parser === "__vue_expression" || options9.parser === "__vue_ts_expression") { + if (locStart(comment) - locStart(ast2) <= 0) { + addLeadingComment(ast2, comment); + continue; + } + if (locEnd(comment) - locEnd(ast2) >= 0) { + addTrailingComment(ast2, comment); + continue; + } } - let message = "The "; - if (name.endsWith(" argument")) { - message += `${name} `; + let args; + if (avoidAstMutation) { + args = [context]; } else { - const type = name.includes(".") ? "property" : "argument"; - message += `"${name}" ${type} `; + comment.enclosingNode = enclosingNode; + comment.precedingNode = precedingNode; + comment.followingNode = followingNode; + args = [comment, text2, options9, ast2, isLastComment]; } - message += "must be "; - const types = []; - const instances = []; - const other = []; - for (const value of expected) { - assert4( - typeof value === "string", - "All expected entries have to be of type string" - ); - if (kTypes.has(value)) { - types.push(value.toLowerCase()); - } else if (classRegExp.exec(value) === null) { - assert4( - value !== "object", - 'The value "object" should be written as "Object"' - ); - other.push(value); + if (isOwnLineComment(text2, options9, decoratedComments, index)) { + comment.placement = "ownLine"; + if (handleOwnLineComment(...args)) { + } else if (followingNode) { + addLeadingComment(followingNode, comment); + } else if (precedingNode) { + addTrailingComment(precedingNode, comment); + } else if (enclosingNode) { + addDanglingComment(enclosingNode, comment); } else { - instances.push(value); - } - } - if (instances.length > 0) { - const pos = types.indexOf("object"); - if (pos !== -1) { - types.slice(pos, 1); - instances.push("Object"); + addDanglingComment(ast2, comment); } - } - if (types.length > 0) { - message += `${types.length > 1 ? "one of type" : "of type"} ${formatList( - types, - "or" - )}`; - if (instances.length > 0 || other.length > 0) - message += " or "; - } - if (instances.length > 0) { - message += `an instance of ${formatList(instances, "or")}`; - if (other.length > 0) - message += " or "; - } - if (other.length > 0) { - if (other.length > 1) { - message += `one of ${formatList(other, "or")}`; + } else if (isEndOfLineComment(text2, options9, decoratedComments, index)) { + comment.placement = "endOfLine"; + if (handleEndOfLineComment(...args)) { + } else if (precedingNode) { + addTrailingComment(precedingNode, comment); + } else if (followingNode) { + addLeadingComment(followingNode, comment); + } else if (enclosingNode) { + addDanglingComment(enclosingNode, comment); } else { - if (other[0].toLowerCase() !== other[0]) - message += "an "; - message += `${other[0]}`; + addDanglingComment(ast2, comment); } - } - message += `. Received ${determineSpecificType(actual)}`; - return message; - }, - TypeError -); -codes.ERR_INVALID_MODULE_SPECIFIER = createError( - "ERR_INVALID_MODULE_SPECIFIER", - /** - * @param {string} request - * @param {string} reason - * @param {string} [base] - */ - (request, reason, base = void 0) => { - return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`; - }, - TypeError -); -codes.ERR_INVALID_PACKAGE_CONFIG = createError( - "ERR_INVALID_PACKAGE_CONFIG", - /** - * @param {string} path - * @param {string} [base] - * @param {string} [message] - */ - (path9, base, message) => { - return `Invalid package config ${path9}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`; - }, - Error -); -codes.ERR_INVALID_PACKAGE_TARGET = createError( - "ERR_INVALID_PACKAGE_TARGET", - /** - * @param {string} pkgPath - * @param {string} key - * @param {unknown} target - * @param {boolean} [isImport=false] - * @param {string} [base] - */ - (pkgPath, key, target, isImport = false, base = void 0) => { - const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./"); - if (key === ".") { - assert4(isImport === false); - return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`; - } - return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify( - target - )} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`; - }, - Error -); -codes.ERR_MODULE_NOT_FOUND = createError( - "ERR_MODULE_NOT_FOUND", - /** - * @param {string} path - * @param {string} base - * @param {boolean} [exactUrl] - */ - (path9, base, exactUrl = false) => { - return `Cannot find ${exactUrl ? "module" : "package"} '${path9}' imported from ${base}`; - }, - Error -); -codes.ERR_NETWORK_IMPORT_DISALLOWED = createError( - "ERR_NETWORK_IMPORT_DISALLOWED", - "import of '%s' by %s is not supported: %s", - Error -); -codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError( - "ERR_PACKAGE_IMPORT_NOT_DEFINED", - /** - * @param {string} specifier - * @param {string} packagePath - * @param {string} base - */ - (specifier, packagePath, base) => { - return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`; - }, - TypeError -); -codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError( - "ERR_PACKAGE_PATH_NOT_EXPORTED", - /** - * @param {string} pkgPath - * @param {string} subpath - * @param {string} [base] - */ - (pkgPath, subpath, base = void 0) => { - if (subpath === ".") - return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`; - return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`; - }, - Error -); -codes.ERR_UNSUPPORTED_DIR_IMPORT = createError( - "ERR_UNSUPPORTED_DIR_IMPORT", - "Directory import '%s' is not supported resolving ES modules imported from %s", - Error -); -codes.ERR_UNKNOWN_FILE_EXTENSION = createError( - "ERR_UNKNOWN_FILE_EXTENSION", - /** - * @param {string} ext - * @param {string} path - */ - (ext, path9) => { - return `Unknown file extension "${ext}" for ${path9}`; - }, - TypeError -); -codes.ERR_INVALID_ARG_VALUE = createError( - "ERR_INVALID_ARG_VALUE", - /** - * @param {string} name - * @param {unknown} value - * @param {string} [reason='is invalid'] - */ - (name, value, reason = "is invalid") => { - let inspected = inspect(value); - if (inspected.length > 128) { - inspected = `${inspected.slice(0, 128)}...`; - } - const type = name.includes(".") ? "property" : "argument"; - return `The ${type} '${name}' ${reason}. Received ${inspected}`; - }, - TypeError - // Note: extra classes have been shaken out. - // , RangeError -); -function createError(sym, value, def) { - messages.set(sym, value); - return makeNodeErrorWithCode(def, sym); -} -function makeNodeErrorWithCode(Base, key) { - return NodeError; - function NodeError(...args) { - const limit = Error.stackTraceLimit; - if (isErrorStackTraceLimitWritable()) - Error.stackTraceLimit = 0; - const error = new Base(); - if (isErrorStackTraceLimitWritable()) - Error.stackTraceLimit = limit; - const message = getMessage(key, args, error); - Object.defineProperties(error, { - // Note: no need to implement `kIsNodeError` symbol, would be hard, - // probably. - message: { - value: message, - enumerable: false, - writable: true, - configurable: true - }, - toString: { - /** @this {Error} */ - value() { - return `${this.name} [${key}]: ${this.message}`; - }, - enumerable: false, - writable: true, - configurable: true + } else { + comment.placement = "remaining"; + if (handleRemainingComment(...args)) { + } else if (precedingNode && followingNode) { + const tieCount = tiesToBreak.length; + if (tieCount > 0) { + const lastTie = tiesToBreak[tieCount - 1]; + if (lastTie.followingNode !== followingNode) { + breakTies(tiesToBreak, options9); + } + } + tiesToBreak.push(context); + } else if (precedingNode) { + addTrailingComment(precedingNode, comment); + } else if (followingNode) { + addLeadingComment(followingNode, comment); + } else if (enclosingNode) { + addDanglingComment(enclosingNode, comment); + } else { + addDanglingComment(ast2, comment); } - }); - captureLargerStackTrace(error); - error.code = key; - return error; - } -} -function isErrorStackTraceLimitWritable() { - try { - if (v8.startupSnapshot.isBuildingSnapshot()) { - return false; } - } catch { } - const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit"); - if (desc === void 0) { - return Object.isExtensible(Error); + breakTies(tiesToBreak, options8); + if (!avoidAstMutation) { + for (const comment of comments) { + delete comment.precedingNode; + delete comment.enclosingNode; + delete comment.followingNode; + } } - return own.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0; -} -function hideStackFrames(fn) { - const hidden = nodeInternalPrefix + fn.name; - Object.defineProperty(fn, "name", { value: hidden }); - return fn; } -var captureLargerStackTrace = hideStackFrames( - /** - * @param {Error} error - * @returns {Error} - */ - // @ts-expect-error: fine - function(error) { - const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable(); - if (stackTraceLimitIsWritable) { - userStackTraceLimit = Error.stackTraceLimit; - Error.stackTraceLimit = Number.POSITIVE_INFINITY; +var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/.test(text); +function isOwnLineComment(text, options8, decoratedComments, commentIndex) { + const { comment, precedingNode } = decoratedComments[commentIndex]; + const { locStart, locEnd } = options8; + let start = locStart(comment); + if (precedingNode) { + for (let index = commentIndex - 1; index >= 0; index--) { + const { comment: comment2, precedingNode: currentCommentPrecedingNode } = decoratedComments[index]; + if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment2), start))) { + break; + } + start = locStart(comment2); } - Error.captureStackTrace(error); - if (stackTraceLimitIsWritable) - Error.stackTraceLimit = userStackTraceLimit; - return error; } -); -function getMessage(key, args, self) { - const message = messages.get(key); - assert4(message !== void 0, "expected `message` to be found"); - if (typeof message === "function") { - assert4( - message.length <= args.length, - // Default options do not count. - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).` - ); - return Reflect.apply(message, self, args); + return has_newline_default(text, start, { backwards: true }); +} +function isEndOfLineComment(text, options8, decoratedComments, commentIndex) { + const { comment, followingNode } = decoratedComments[commentIndex]; + const { locStart, locEnd } = options8; + let end = locEnd(comment); + if (followingNode) { + for (let index = commentIndex + 1; index < decoratedComments.length; index++) { + const { comment: comment2, followingNode: currentCommentFollowingNode } = decoratedComments[index]; + if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment2)))) { + break; + } + end = locEnd(comment2); + } } - const regex = /%[dfijoOs]/g; - let expectedLength = 0; - while (regex.exec(message) !== null) - expectedLength++; - assert4( - expectedLength === args.length, - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` - ); - if (args.length === 0) - return message; - args.unshift(message); - return Reflect.apply(format, null, args); + return has_newline_default(text, end); } -function determineSpecificType(value) { - if (value === null || value === void 0) { - return String(value); +function breakTies(tiesToBreak, options8) { + var _a, _b; + const tieCount = tiesToBreak.length; + if (tieCount === 0) { + return; } - if (typeof value === "function" && value.name) { - return `function ${value.name}`; + const { precedingNode, followingNode } = tiesToBreak[0]; + let gapEndPos = options8.locStart(followingNode); + let indexOfFirstLeadingComment; + for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) { + const { + comment, + precedingNode: currentCommentPrecedingNode, + followingNode: currentCommentFollowingNode + } = tiesToBreak[indexOfFirstLeadingComment - 1]; + assert4.strictEqual(currentCommentPrecedingNode, precedingNode); + assert4.strictEqual(currentCommentFollowingNode, followingNode); + const gap = options8.originalText.slice(options8.locEnd(comment), gapEndPos); + if (((_b = (_a = options8.printer).isGap) == null ? void 0 : _b.call(_a, gap, options8)) ?? /^[\s(]*$/.test(gap)) { + gapEndPos = options8.locStart(comment); + } else { + break; + } } - if (typeof value === "object") { - if (value.constructor && value.constructor.name) { - return `an instance of ${value.constructor.name}`; + for (const [i, { comment }] of tiesToBreak.entries()) { + if (i < indexOfFirstLeadingComment) { + addTrailingComment(precedingNode, comment); + } else { + addLeadingComment(followingNode, comment); } - return `${inspect(value, { depth: -1 })}`; } - let inspected = inspect(value, { colors: false }); - if (inspected.length > 28) { - inspected = `${inspected.slice(0, 25)}...`; + for (const node of [precedingNode, followingNode]) { + if (node.comments && node.comments.length > 1) { + node.comments.sort((a, b) => options8.locStart(a) - options8.locStart(b)); + } } - return `type ${typeof value} (${inspected})`; + tiesToBreak.length = 0; +} +function findExpressionIndexForComment(quasis, comment, options8) { + const startPos = options8.locStart(comment) - 1; + for (let i = 1; i < quasis.length; ++i) { + if (startPos < options8.locStart(quasis[i])) { + return i - 1; + } + } + return 0; } -// node_modules/import-meta-resolve/lib/package-json-reader.js -var hasOwnProperty = {}.hasOwnProperty; -var { ERR_INVALID_PACKAGE_CONFIG } = codes; -var cache = /* @__PURE__ */ new Map(); -var reader = { read }; -var package_json_reader_default = reader; -function read(jsonPath, { base, specifier }) { - const existing = cache.get(jsonPath); - if (existing) { - return existing; +// src/utils/is-previous-line-empty.js +function isPreviousLineEmpty(text, startIndex) { + let idx = startIndex - 1; + idx = skipSpaces(text, idx, { backwards: true }); + idx = skip_newline_default(text, idx, { backwards: true }); + idx = skipSpaces(text, idx, { backwards: true }); + const idx2 = skip_newline_default(text, idx, { backwards: true }); + return idx !== idx2; +} +var is_previous_line_empty_default = isPreviousLineEmpty; + +// src/main/comments/print.js +function printComment(path13, options8) { + const comment = path13.node; + comment.printed = true; + return options8.printer.printComment(path13, options8); +} +function printLeadingComment(path13, options8) { + var _a; + const comment = path13.node; + const parts = [printComment(path13, options8)]; + const { printer, originalText, locStart, locEnd } = options8; + const isBlock = (_a = printer.isBlockComment) == null ? void 0 : _a.call(printer, comment); + if (isBlock) { + const lineBreak = has_newline_default(originalText, locEnd(comment)) ? has_newline_default(originalText, locStart(comment), { + backwards: true + }) ? hardline : line2 : " "; + parts.push(lineBreak); + } else { + parts.push(hardline); } - let string; - try { - string = fs3.readFileSync(path3.toNamespacedPath(jsonPath), "utf8"); - } catch (error) { - const exception = ( - /** @type {ErrnoException} */ - error + const index = skip_newline_default( + originalText, + skipSpaces(originalText, locEnd(comment)) + ); + if (index !== false && has_newline_default(originalText, index)) { + parts.push(hardline); + } + return parts; +} +function printTrailingComment(path13, options8, previousComment) { + var _a; + const comment = path13.node; + const printed = printComment(path13, options8); + const { printer, originalText, locStart } = options8; + const isBlock = (_a = printer.isBlockComment) == null ? void 0 : _a.call(printer, comment); + if ((previousComment == null ? void 0 : previousComment.hasLineSuffix) && !(previousComment == null ? void 0 : previousComment.isBlock) || has_newline_default(originalText, locStart(comment), { backwards: true })) { + const isLineBeforeEmpty = is_previous_line_empty_default( + originalText, + locStart(comment) ); - if (exception.code !== "ENOENT") { - throw exception; - } + return { + doc: lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", printed]), + isBlock, + hasLineSuffix: true + }; } - const result = { - exists: false, - pjsonPath: jsonPath, - main: void 0, - name: void 0, - type: "none", - // Ignore unknown types for forwards compatibility - exports: void 0, - imports: void 0 - }; - if (string !== void 0) { - let parsed; - try { - parsed = JSON.parse(string); - } catch (error_) { - const cause = ( - /** @type {ErrnoException} */ - error_ - ); - const error = new ERR_INVALID_PACKAGE_CONFIG( - jsonPath, - (base ? `"${specifier}" from ` : "") + fileURLToPath2(base || specifier), - cause.message - ); - error.cause = cause; - throw error; - } - result.exists = true; - if (hasOwnProperty.call(parsed, "name") && typeof parsed.name === "string") { - result.name = parsed.name; - } - if (hasOwnProperty.call(parsed, "main") && typeof parsed.main === "string") { - result.main = parsed.main; - } - if (hasOwnProperty.call(parsed, "exports")) { - result.exports = parsed.exports; - } - if (hasOwnProperty.call(parsed, "imports")) { - result.imports = parsed.imports; - } - if (hasOwnProperty.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module")) { - result.type = parsed.type; - } + if (!isBlock || (previousComment == null ? void 0 : previousComment.hasLineSuffix)) { + return { + doc: [lineSuffix([" ", printed]), breakParent], + isBlock, + hasLineSuffix: true + }; } - cache.set(jsonPath, result); - return result; + return { doc: [" ", printed], isBlock, hasLineSuffix: false }; } - -// node_modules/import-meta-resolve/lib/package-config.js -function getPackageScopeConfig(resolved) { - let packageJSONUrl = new URL2("package.json", resolved); - while (true) { - const packageJSONPath2 = packageJSONUrl.pathname; - if (packageJSONPath2.endsWith("node_modules/package.json")) { - break; - } - const packageConfig = package_json_reader_default.read( - fileURLToPath3(packageJSONUrl), - { specifier: resolved } - ); - if (packageConfig.exists) { - return packageConfig; +function printCommentsSeparately(path13, options8) { + const value = path13.node; + if (!value) { + return {}; + } + const ignored = options8[Symbol.for("printedComments")]; + const comments = (value.comments || []).filter( + (comment) => !ignored.has(comment) + ); + if (comments.length === 0) { + return { leading: "", trailing: "" }; + } + const leadingParts = []; + const trailingParts = []; + let printedTrailingComment; + path13.each(() => { + const comment = path13.node; + if (ignored == null ? void 0 : ignored.has(comment)) { + return; } - const lastPackageJSONUrl = packageJSONUrl; - packageJSONUrl = new URL2("../package.json", packageJSONUrl); - if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) { - break; + const { leading, trailing } = comment; + if (leading) { + leadingParts.push(printLeadingComment(path13, options8)); + } else if (trailing) { + printedTrailingComment = printTrailingComment( + path13, + options8, + printedTrailingComment + ); + trailingParts.push(printedTrailingComment.doc); } + }, "comments"); + return { leading: leadingParts, trailing: trailingParts }; +} +function printComments(path13, doc2, options8) { + const { leading, trailing } = printCommentsSeparately(path13, options8); + if (!leading && !trailing) { + return doc2; } - const packageJSONPath = fileURLToPath3(packageJSONUrl); - return { - pjsonPath: packageJSONPath, - exists: false, - main: void 0, - name: void 0, - type: "none", - exports: void 0, - imports: void 0 - }; + return inheritLabel(doc2, (doc3) => [leading, doc3, trailing]); } - -// node_modules/import-meta-resolve/lib/resolve-get-package-type.js -function getPackageType(url2) { - const packageConfig = getPackageScopeConfig(url2); - return packageConfig.type; +function ensureAllCommentsPrinted(options8) { + const { + [Symbol.for("comments")]: comments, + [Symbol.for("printedComments")]: printedComments + } = options8; + for (const comment of comments) { + if (!comment.printed && !printedComments.has(comment)) { + throw new Error( + 'Comment "' + comment.value.trim() + '" was not printed. Please report this error!' + ); + } + delete comment.printed; + } } -// node_modules/import-meta-resolve/lib/get-format.js -var { ERR_UNKNOWN_FILE_EXTENSION } = codes; -var hasOwnProperty2 = {}.hasOwnProperty; -var extensionFormatMap = { - // @ts-expect-error: hush. - __proto__: null, - ".cjs": "commonjs", - ".js": "module", - ".json": "json", - ".mjs": "module" -}; -function mimeToFormat(mime) { - if (mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime)) - return "module"; - if (mime === "application/json") - return "json"; - return null; -} -var protocolHandlers = { - // @ts-expect-error: hush. - __proto__: null, - "data:": getDataProtocolModuleFormat, - "file:": getFileProtocolModuleFormat, - "http:": getHttpProtocolModuleFormat, - "https:": getHttpProtocolModuleFormat, - "node:"() { - return "builtin"; +// src/main/create-print-pre-check-function.js +function createPrintPreCheckFunction(options8) { + if (true) { + return () => { + }; } -}; -function getDataProtocolModuleFormat(parsed) { - const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec( - parsed.pathname - ) || [null, null, null]; - return mimeToFormat(mime); -} -function extname(url2) { - const pathname = url2.pathname; - let index = pathname.length; - while (index--) { - const code = pathname.codePointAt(index); - if (code === 47) { - return ""; + const getVisitorKeys = create_get_visitor_keys_function_default( + options8.printer.getVisitorKeys + ); + return function(path13) { + if (path13.isRoot) { + return; } - if (code === 46) { - return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index); + const { key: key2, parent } = path13; + const visitorKeys = getVisitorKeys(parent); + if (visitorKeys.includes(key2)) { + return; } - } - return ""; + throw Object.assign(new Error("Calling `print()` on non-node object."), { + parentNode: parent, + allowedProperties: visitorKeys, + printingProperty: key2, + printingValue: path13.node, + pathStack: path13.stack.length > 5 ? ["...", ...path13.stack.slice(-5)] : [...path13.stack] + }); + }; } -function getFileProtocolModuleFormat(url2, _context, ignoreErrors) { - const ext = extname(url2); - if (ext === ".js") { - const packageType = getPackageType(url2); - if (packageType !== "none") { - return packageType; - } - return "commonjs"; - } - if (ext === "") { - const packageType = getPackageType(url2); - if (packageType === "none" || packageType === "commonjs") { - return "commonjs"; +var create_print_pre_check_function_default = createPrintPreCheckFunction; + +// src/main/core-options.evaluate.js +var core_options_evaluate_default = { + "cursorOffset": { + "category": "Special", + "type": "int", + "default": -1, + "range": { + "start": -1, + "end": Infinity, + "step": 1 + }, + "description": "Print (to stderr) where a cursor at the given position would move to after formatting.", + "cliCategory": "Editor" + }, + "endOfLine": { + "category": "Global", + "type": "choice", + "default": "lf", + "description": "Which end of line characters to apply.", + "choices": [ + { + "value": "lf", + "description": "Line Feed only (\\n), common on Linux and macOS as well as inside git repos" + }, + { + "value": "crlf", + "description": "Carriage Return + Line Feed characters (\\r\\n), common on Windows" + }, + { + "value": "cr", + "description": "Carriage Return character only (\\r), used very rarely" + }, + { + "value": "auto", + "description": "Maintain existing\n(mixed values within one file are normalised by looking at what's used after the first line)" + } + ] + }, + "filepath": { + "category": "Special", + "type": "path", + "description": "Specify the input filepath. This will be used to do parser inference.", + "cliName": "stdin-filepath", + "cliCategory": "Other", + "cliDescription": "Path to the file to pretend that stdin comes from." + }, + "insertPragma": { + "category": "Special", + "type": "boolean", + "default": false, + "description": "Insert @format pragma into file's first docblock comment.", + "cliCategory": "Other" + }, + "parser": { + "category": "Global", + "type": "choice", + "default": void 0, + "description": "Which parser to use.", + "exception": (value) => typeof value === "string" || typeof value === "function", + "choices": [ + { + "value": "flow", + "description": "Flow" + }, + { + "value": "babel", + "description": "JavaScript" + }, + { + "value": "babel-flow", + "description": "Flow" + }, + { + "value": "babel-ts", + "description": "TypeScript" + }, + { + "value": "typescript", + "description": "TypeScript" + }, + { + "value": "acorn", + "description": "JavaScript" + }, + { + "value": "espree", + "description": "JavaScript" + }, + { + "value": "meriyah", + "description": "JavaScript" + }, + { + "value": "css", + "description": "CSS" + }, + { + "value": "less", + "description": "Less" + }, + { + "value": "scss", + "description": "SCSS" + }, + { + "value": "json", + "description": "JSON" + }, + { + "value": "json5", + "description": "JSON5" + }, + { + "value": "jsonc", + "description": "JSON with Comments" + }, + { + "value": "json-stringify", + "description": "JSON.stringify" + }, + { + "value": "graphql", + "description": "GraphQL" + }, + { + "value": "markdown", + "description": "Markdown" + }, + { + "value": "mdx", + "description": "MDX" + }, + { + "value": "vue", + "description": "Vue" + }, + { + "value": "yaml", + "description": "YAML" + }, + { + "value": "glimmer", + "description": "Ember / Handlebars" + }, + { + "value": "html", + "description": "HTML" + }, + { + "value": "angular", + "description": "Angular" + }, + { + "value": "lwc", + "description": "Lightning Web Components" + } + ] + }, + "plugins": { + "type": "path", + "array": true, + "default": [ + { + "value": [] + } + ], + "category": "Global", + "description": "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", + "exception": (value) => typeof value === "string" || typeof value === "object", + "cliName": "plugin", + "cliCategory": "Config" + }, + "printWidth": { + "category": "Global", + "type": "int", + "default": 80, + "description": "The line length where Prettier will try wrap.", + "range": { + "start": 0, + "end": Infinity, + "step": 1 } - return "module"; - } - const format3 = extensionFormatMap[ext]; - if (format3) - return format3; - if (ignoreErrors) { - return void 0; - } - const filepath = fileURLToPath4(url2); - throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath); -} -function getHttpProtocolModuleFormat() { -} -function defaultGetFormatWithoutErrors(url2, context) { - const protocol = url2.protocol; - if (!hasOwnProperty2.call(protocolHandlers, protocol)) { - return null; - } - return protocolHandlers[protocol](url2, context, true) || null; -} - -// node_modules/import-meta-resolve/lib/utils.js -var { ERR_INVALID_ARG_VALUE } = codes; -var DEFAULT_CONDITIONS = Object.freeze(["node", "import"]); -var DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS); -function getDefaultConditions() { - return DEFAULT_CONDITIONS; -} -function getDefaultConditionsSet() { - return DEFAULT_CONDITIONS_SET; -} -function getConditionsSet(conditions) { - if (conditions !== void 0 && conditions !== getDefaultConditions()) { - if (!Array.isArray(conditions)) { - throw new ERR_INVALID_ARG_VALUE( - "conditions", - conditions, - "expected an array" - ); + }, + "rangeEnd": { + "category": "Special", + "type": "int", + "default": Infinity, + "range": { + "start": 0, + "end": Infinity, + "step": 1 + }, + "description": "Format code ending at a given character offset (exclusive).\nThe range will extend forwards to the end of the selected statement.", + "cliCategory": "Editor" + }, + "rangeStart": { + "category": "Special", + "type": "int", + "default": 0, + "range": { + "start": 0, + "end": Infinity, + "step": 1 + }, + "description": "Format code starting at a given character offset.\nThe range will extend backwards to the start of the first line containing the selected statement.", + "cliCategory": "Editor" + }, + "requirePragma": { + "category": "Special", + "type": "boolean", + "default": false, + "description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment\nin order for it to be formatted.", + "cliCategory": "Other" + }, + "tabWidth": { + "type": "int", + "category": "Global", + "default": 2, + "description": "Number of spaces per indentation level.", + "range": { + "start": 0, + "end": Infinity, + "step": 1 } - return new Set(conditions); + }, + "useTabs": { + "category": "Global", + "type": "boolean", + "default": false, + "description": "Indent with tabs instead of spaces." + }, + "embeddedLanguageFormatting": { + "category": "Global", + "type": "choice", + "default": "auto", + "description": "Control how Prettier formats quoted code embedded in the file.", + "choices": [ + { + "value": "auto", + "description": "Format embedded code if Prettier can automatically identify it." + }, + { + "value": "off", + "description": "Never automatically format embedded code." + } + ] } - return getDefaultConditionsSet(); -} +}; -// node_modules/import-meta-resolve/lib/resolve.js -var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace]; -var { - ERR_NETWORK_IMPORT_DISALLOWED, - ERR_INVALID_MODULE_SPECIFIER, - ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG2, - ERR_INVALID_PACKAGE_TARGET, - ERR_MODULE_NOT_FOUND, - ERR_PACKAGE_IMPORT_NOT_DEFINED, - ERR_PACKAGE_PATH_NOT_EXPORTED, - ERR_UNSUPPORTED_DIR_IMPORT -} = codes; -var own2 = {}.hasOwnProperty; -var invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i; -var deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i; -var invalidPackageNameRegEx = /^\.|%|\\/; -var patternRegEx = /\*/g; -var encodedSepRegEx = /%2f|%5c/i; -var emittedPackageWarnings = /* @__PURE__ */ new Set(); -var doubleSlashRegEx = /[/\\]{2}/; -function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) { - if (process3.noDeprecation) { - return; - } - const pjsonPath = fileURLToPath5(packageJsonUrl); - const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null; - process3.emitWarning( - `Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath5(base)}` : ""}.`, - "DeprecationWarning", - "DEP0166" - ); -} -function emitLegacyIndexDeprecation(url2, packageJsonUrl, base, main) { - if (process3.noDeprecation) { - return; - } - const format3 = defaultGetFormatWithoutErrors(url2, { parentURL: base.href }); - if (format3 !== "module") - return; - const urlPath = fileURLToPath5(url2.href); - const pkgPath = fileURLToPath5(new URL3(".", packageJsonUrl)); - const basePath = fileURLToPath5(base); - if (!main) { - process3.emitWarning( - `No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${urlPath.slice( - pkgPath.length - )}", imported from ${basePath}. -Default "index" lookups for the main are deprecated for ES modules.`, - "DeprecationWarning", - "DEP0151" - ); - } else if (path4.resolve(pkgPath, main) !== urlPath) { - process3.emitWarning( - `Package ${pkgPath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice( - pkgPath.length - )}", imported from ${basePath}. - Automatic extension resolution of the "main" field is deprecated for ES modules.`, - "DeprecationWarning", - "DEP0151" - ); +// src/main/support.js +function getSupportInfo({ + plugins = [], + showDeprecated = false +} = {}) { + const languages2 = plugins.flatMap((plugin) => plugin.languages ?? []); + const options8 = []; + for (const option of normalizeOptionSettings(Object.assign({}, ...plugins.map(({ + options: options9 + }) => options9), core_options_evaluate_default))) { + if (!showDeprecated && option.deprecated) { + continue; + } + if (Array.isArray(option.choices)) { + if (!showDeprecated) { + option.choices = option.choices.filter((choice) => !choice.deprecated); + } + if (option.name === "parser") { + option.choices = [...option.choices, ...collectParsersFromLanguages(option.choices, languages2, plugins)]; + } + } + option.pluginDefaults = Object.fromEntries(plugins.filter((plugin) => { + var _a; + return ((_a = plugin.defaultOptions) == null ? void 0 : _a[option.name]) !== void 0; + }).map((plugin) => [plugin.name, plugin.defaultOptions[option.name]])); + options8.push(option); } + return { + languages: languages2, + options: options8 + }; } -function tryStatSync(path9) { - try { - return statSync(path9); - } catch { - return new Stats(); +function* collectParsersFromLanguages(parserChoices, languages2, plugins) { + const existingParsers = new Set(parserChoices.map((choice) => choice.value)); + for (const language of languages2) { + if (language.parsers) { + for (const parserName of language.parsers) { + if (!existingParsers.has(parserName)) { + existingParsers.add(parserName); + const plugin = plugins.find((plugin2) => plugin2.parsers && Object.prototype.hasOwnProperty.call(plugin2.parsers, parserName)); + let description = language.name; + if (plugin == null ? void 0 : plugin.name) { + description += ` (plugin: ${plugin.name})`; + } + yield { + value: parserName, + description + }; + } + } + } } } -function fileExists(url2) { - const stats = statSync(url2, { throwIfNoEntry: false }); - const isFile = stats ? stats.isFile() : void 0; - return isFile === null || isFile === void 0 ? false : isFile; +function normalizeOptionSettings(settings) { + const options8 = []; + for (const [name, originalOption] of Object.entries(settings)) { + const option = { + name, + ...originalOption + }; + if (Array.isArray(option.default)) { + option.default = at_default( + /* isOptionalObject*/ + false, + option.default, + -1 + ).value; + } + options8.push(option); + } + return options8; } -function legacyMainResolve(packageJsonUrl, packageConfig, base) { - let guess; - if (packageConfig.main !== void 0) { - guess = new URL3(packageConfig.main, packageJsonUrl); - if (fileExists(guess)) - return guess; - const tries2 = [ - `./${packageConfig.main}.js`, - `./${packageConfig.main}.json`, - `./${packageConfig.main}.node`, - `./${packageConfig.main}/index.js`, - `./${packageConfig.main}/index.json`, - `./${packageConfig.main}/index.node` - ]; - let i2 = -1; - while (++i2 < tries2.length) { - guess = new URL3(tries2[i2], packageJsonUrl); - if (fileExists(guess)) - break; - guess = void 0; + +// src/main/normalize-options.js +var hasDeprecationWarned; +function normalizeOptions(options8, optionInfos, { + logger = false, + isCLI = false, + passThrough = false, + FlagSchema, + descriptor +} = {}) { + if (isCLI) { + if (!FlagSchema) { + throw new Error("'FlagSchema' option is required."); } - if (guess) { - emitLegacyIndexDeprecation( - guess, - packageJsonUrl, - base, - packageConfig.main - ); - return guess; + if (!descriptor) { + throw new Error("'descriptor' option is required."); } + } else { + descriptor = apiDescriptor; } - const tries = ["./index.js", "./index.json", "./index.node"]; - let i = -1; - while (++i < tries.length) { - guess = new URL3(tries[i], packageJsonUrl); - if (fileExists(guess)) - break; - guess = void 0; + const unknown = !passThrough ? (key2, value, options9) => { + const { + _, + ...schemas2 + } = options9.schemas; + return levenUnknownHandler(key2, value, { + ...options9, + schemas: schemas2 + }); + } : Array.isArray(passThrough) ? (key2, value) => !passThrough.includes(key2) ? void 0 : { + [key2]: value + } : (key2, value) => ({ + [key2]: value + }); + const schemas = optionInfosToSchemas(optionInfos, { + isCLI, + FlagSchema + }); + const normalizer = new Normalizer(schemas, { + logger, + unknown, + descriptor + }); + const shouldSuppressDuplicateDeprecationWarnings = logger !== false; + if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) { + normalizer._hasDeprecationWarned = hasDeprecationWarned; } - if (guess) { - emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); - return guess; + const normalized = normalizer.normalize(options8); + if (shouldSuppressDuplicateDeprecationWarnings) { + hasDeprecationWarned = normalizer._hasDeprecationWarned; } - throw new ERR_MODULE_NOT_FOUND( - fileURLToPath5(new URL3(".", packageJsonUrl)), - fileURLToPath5(base) - ); + return normalized; } -function finalizeResolution(resolved, base, preserveSymlinks) { - if (encodedSepRegEx.exec(resolved.pathname) !== null) { - throw new ERR_INVALID_MODULE_SPECIFIER( - resolved.pathname, - 'must not include encoded "/" or "\\" characters', - fileURLToPath5(base) - ); - } - let filePath; - try { - filePath = fileURLToPath5(resolved); - } catch (error) { - const cause = ( - /** @type {ErrnoException} */ - error - ); - Object.defineProperty(cause, "input", { value: String(resolved) }); - Object.defineProperty(cause, "module", { value: String(base) }); - throw cause; - } - const stats = tryStatSync( - filePath.endsWith("/") ? filePath.slice(-1) : filePath - ); - if (stats.isDirectory()) { - const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath5(base)); - error.url = String(resolved); - throw error; - } - if (!stats.isFile()) { - const error = new ERR_MODULE_NOT_FOUND( - filePath || resolved.pathname, - base && fileURLToPath5(base), - true - ); - error.url = String(resolved); - throw error; - } - if (!preserveSymlinks) { - const real = realpathSync(filePath); - const { search, hash } = resolved; - resolved = pathToFileURL2(real + (filePath.endsWith(path4.sep) ? "/" : "")); - resolved.search = search; - resolved.hash = hash; +function optionInfosToSchemas(optionInfos, { + isCLI, + FlagSchema +}) { + const schemas = []; + if (isCLI) { + schemas.push(AnySchema.create({ + name: "_" + })); } - return resolved; -} -function importNotDefined(specifier, packageJsonUrl, base) { - return new ERR_PACKAGE_IMPORT_NOT_DEFINED( - specifier, - packageJsonUrl && fileURLToPath5(new URL3(".", packageJsonUrl)), - fileURLToPath5(base) - ); -} -function exportsNotFound(subpath, packageJsonUrl, base) { - return new ERR_PACKAGE_PATH_NOT_EXPORTED( - fileURLToPath5(new URL3(".", packageJsonUrl)), - subpath, - base && fileURLToPath5(base) - ); -} -function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) { - const reason = `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath5(packageJsonUrl)}`; - throw new ERR_INVALID_MODULE_SPECIFIER( - request, - reason, - base && fileURLToPath5(base) - ); -} -function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) { - target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`; - return new ERR_INVALID_PACKAGE_TARGET( - fileURLToPath5(new URL3(".", packageJsonUrl)), - subpath, - target, - internal, - base && fileURLToPath5(base) - ); -} -function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) { - if (subpath !== "" && !pattern && target[target.length - 1] !== "/") - throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); - if (!target.startsWith("./")) { - if (internal && !target.startsWith("../") && !target.startsWith("/")) { - let isURL2 = false; - try { - new URL3(target); - isURL2 = true; - } catch { - } - if (!isURL2) { - const exportTarget = pattern ? RegExpPrototypeSymbolReplace.call( - patternRegEx, - target, - () => subpath - ) : target + subpath; - return packageResolve(exportTarget, packageJsonUrl, conditions); - } + for (const optionInfo of optionInfos) { + schemas.push(optionInfoToSchema(optionInfo, { + isCLI, + optionInfos, + FlagSchema + })); + if (optionInfo.alias && isCLI) { + schemas.push(AliasSchema.create({ + // @ts-expect-error + name: optionInfo.alias, + sourceName: optionInfo.name + })); } - throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); } - if (invalidSegmentRegEx.exec(target.slice(2)) !== null) { - if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) { - if (!isPathMap) { - const request = pattern ? match.replace("*", () => subpath) : match + subpath; - const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call( - patternRegEx, - target, - () => subpath - ) : target; - emitInvalidSegmentDeprecation( - resolvedTarget, - request, - match, - packageJsonUrl, - internal, - base, - true - ); + return schemas; +} +function optionInfoToSchema(optionInfo, { + isCLI, + optionInfos, + FlagSchema +}) { + const { + name + } = optionInfo; + const parameters = { + name + }; + let SchemaConstructor; + const handlers = {}; + switch (optionInfo.type) { + case "int": + SchemaConstructor = IntegerSchema; + if (isCLI) { + parameters.preprocess = Number; } - } else { - throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); - } + break; + case "string": + SchemaConstructor = StringSchema; + break; + case "choice": + SchemaConstructor = ChoiceSchema; + parameters.choices = optionInfo.choices.map((choiceInfo) => (choiceInfo == null ? void 0 : choiceInfo.redirect) ? { + ...choiceInfo, + redirect: { + to: { + key: optionInfo.name, + value: choiceInfo.redirect + } + } + } : choiceInfo); + break; + case "boolean": + SchemaConstructor = BooleanSchema; + break; + case "flag": + SchemaConstructor = FlagSchema; + parameters.flags = optionInfos.flatMap((optionInfo2) => [optionInfo2.alias, optionInfo2.description && optionInfo2.name, optionInfo2.oppositeDescription && `no-${optionInfo2.name}`].filter(Boolean)); + break; + case "path": + SchemaConstructor = StringSchema; + break; + default: + throw new Error(`Unexpected type ${optionInfo.type}`); } - const resolved = new URL3(target, packageJsonUrl); - const resolvedPath = resolved.pathname; - const packagePath = new URL3(".", packageJsonUrl).pathname; - if (!resolvedPath.startsWith(packagePath)) - throw invalidPackageTarget(match, target, packageJsonUrl, internal, base); - if (subpath === "") - return resolved; - if (invalidSegmentRegEx.exec(subpath) !== null) { - const request = pattern ? match.replace("*", () => subpath) : match + subpath; - if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) { - if (!isPathMap) { - const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call( - patternRegEx, - target, - () => subpath - ) : target; - emitInvalidSegmentDeprecation( - resolvedTarget, - request, - match, - packageJsonUrl, - internal, - base, - false - ); + if (optionInfo.exception) { + parameters.validate = (value, schema2, utils) => optionInfo.exception(value) || schema2.validate(value, utils); + } else { + parameters.validate = (value, schema2, utils) => value === void 0 || schema2.validate(value, utils); + } + if (optionInfo.redirect) { + handlers.redirect = (value) => !value ? void 0 : { + to: { + key: optionInfo.redirect.option, + value: optionInfo.redirect.value } - } else { - throwInvalidSubpath(request, match, packageJsonUrl, internal, base); - } + }; } - if (pattern) { - return new URL3( - RegExpPrototypeSymbolReplace.call( - patternRegEx, - resolved.href, - () => subpath - ) - ); + if (optionInfo.deprecated) { + handlers.deprecated = true; } - return new URL3(subpath, resolved); -} -function isArrayIndex(key) { - const keyNumber = Number(key); - if (`${keyNumber}` !== key) - return false; - return keyNumber >= 0 && keyNumber < 4294967295; + if (isCLI && !optionInfo.array) { + const originalPreprocess = parameters.preprocess || ((x) => x); + parameters.preprocess = (value, schema2, utils) => schema2.preprocess(originalPreprocess(Array.isArray(value) ? at_default( + /* isOptionalObject*/ + false, + value, + -1 + ) : value), utils); + } + return optionInfo.array ? ArraySchema.create({ + ...isCLI ? { + preprocess: (v) => Array.isArray(v) ? v : [v] + } : {}, + ...handlers, + // @ts-expect-error + valueSchema: SchemaConstructor.create(parameters) + }) : SchemaConstructor.create({ + ...parameters, + ...handlers + }); } -function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) { - if (typeof target === "string") { - return resolvePackageTargetString( - target, - subpath, - packageSubpath, - packageJsonUrl, - base, - pattern, - internal, - isPathMap, - conditions - ); +var normalize_options_default = normalizeOptions; + +// scripts/build/shims/array-find-last.js +var arrayFindLast = (isOptionalObject, array2, callback) => { + if (isOptionalObject && (array2 === void 0 || array2 === null)) { + return; } - if (Array.isArray(target)) { - const targetList = target; - if (targetList.length === 0) - return null; - let lastException; - let i = -1; - while (++i < targetList.length) { - const targetItem = targetList[i]; - let resolveResult; - try { - resolveResult = resolvePackageTarget( - packageJsonUrl, - targetItem, - subpath, - packageSubpath, - base, - pattern, - internal, - isPathMap, - conditions - ); - } catch (error) { - const exception = ( - /** @type {ErrnoException} */ - error - ); - lastException = exception; - if (exception.code === "ERR_INVALID_PACKAGE_TARGET") - continue; - throw error; - } - if (resolveResult === void 0) - continue; - if (resolveResult === null) { - lastException = null; - continue; - } - return resolveResult; - } - if (lastException === void 0 || lastException === null) { - return null; + if (array2.findLast) { + return array2.findLast(callback); + } + for (let index = array2.length - 1; index >= 0; index--) { + const element = array2[index]; + if (callback(element, index, array2)) { + return element; } - throw lastException; } - if (typeof target === "object" && target !== null) { - const keys = Object.getOwnPropertyNames(target); - let i = -1; - while (++i < keys.length) { - const key = keys[i]; - if (isArrayIndex(key)) { - throw new ERR_INVALID_PACKAGE_CONFIG2( - fileURLToPath5(packageJsonUrl), - base, - '"exports" cannot contain numeric property keys.' +}; +var array_find_last_default = arrayFindLast; + +// src/main/parser-and-printer.js +function getParserPluginByParserName(plugins, parserName) { + if (!parserName) { + throw new Error("parserName is required."); + } + const plugin = array_find_last_default( + /* isOptionalObject*/ + false, + plugins, + (plugin2) => plugin2.parsers && Object.prototype.hasOwnProperty.call(plugin2.parsers, parserName) + ); + if (plugin) { + return plugin; + } + let message = `Couldn't resolve parser "${parserName}".`; + if (false) { + message += " Plugins must be explicitly added to the standalone bundle."; + } + throw new ConfigError(message); +} +function getPrinterPluginByAstFormat(plugins, astFormat) { + if (!astFormat) { + throw new Error("astFormat is required."); + } + const plugin = array_find_last_default( + /* isOptionalObject*/ + false, + plugins, + (plugin2) => plugin2.printers && Object.prototype.hasOwnProperty.call(plugin2.printers, astFormat) + ); + if (plugin) { + return plugin; + } + let message = `Couldn't find plugin for AST format "${astFormat}".`; + if (false) { + message += " Plugins must be explicitly added to the standalone bundle."; + } + throw new ConfigError(message); +} +function resolveParser({ + plugins, + parser +}) { + const plugin = getParserPluginByParserName(plugins, parser); + return initParser(plugin, parser); +} +function initParser(plugin, parserName) { + const parserOrParserInitFunction = plugin.parsers[parserName]; + return typeof parserOrParserInitFunction === "function" ? parserOrParserInitFunction() : parserOrParserInitFunction; +} +function initPrinter(plugin, astFormat) { + const printerOrPrinterInitFunction = plugin.printers[astFormat]; + return typeof printerOrPrinterInitFunction === "function" ? printerOrPrinterInitFunction() : printerOrPrinterInitFunction; +} + +// src/main/normalize-format-options.js +var formatOptionsHiddenDefaults = { + astFormat: "estree", + printer: {}, + originalText: void 0, + locStart: null, + locEnd: null +}; +async function normalizeFormatOptions(options8, opts = {}) { + var _a; + const rawOptions = { ...options8 }; + if (!rawOptions.parser) { + if (!rawOptions.filepath) { + throw new UndefinedParserError( + "No parser and no file path given, couldn't infer a parser." + ); + } else { + rawOptions.parser = infer_parser_default(rawOptions, { + physicalFile: rawOptions.filepath + }); + if (!rawOptions.parser) { + throw new UndefinedParserError( + `No parser could be inferred for file "${rawOptions.filepath}".` ); } } - i = -1; - while (++i < keys.length) { - const key = keys[i]; - if (key === "default" || conditions && conditions.has(key)) { - const conditionalTarget = ( - /** @type {unknown} */ - target[key] - ); - const resolveResult = resolvePackageTarget( - packageJsonUrl, - conditionalTarget, - subpath, - packageSubpath, - base, - pattern, - internal, - isPathMap, - conditions - ); - if (resolveResult === void 0) - continue; - return resolveResult; - } + } + const supportOptions = getSupportInfo({ + plugins: options8.plugins, + showDeprecated: true + }).options; + const defaults = { + ...formatOptionsHiddenDefaults, + ...Object.fromEntries( + supportOptions.filter((optionInfo) => optionInfo.default !== void 0).map((option) => [option.name, option.default]) + ) + }; + const parserPlugin = getParserPluginByParserName( + rawOptions.plugins, + rawOptions.parser + ); + const parser = await initParser(parserPlugin, rawOptions.parser); + rawOptions.astFormat = parser.astFormat; + rawOptions.locEnd = parser.locEnd; + rawOptions.locStart = parser.locStart; + const printerPlugin = ((_a = parserPlugin.printers) == null ? void 0 : _a[parser.astFormat]) ? parserPlugin : getPrinterPluginByAstFormat(rawOptions.plugins, parser.astFormat); + const printer = await initPrinter(printerPlugin, parser.astFormat); + rawOptions.printer = printer; + const pluginDefaults = printerPlugin.defaultOptions ? Object.fromEntries( + Object.entries(printerPlugin.defaultOptions).filter( + ([, value]) => value !== void 0 + ) + ) : {}; + const mixedDefaults = { ...defaults, ...pluginDefaults }; + for (const [k, value] of Object.entries(mixedDefaults)) { + if (rawOptions[k] === null || rawOptions[k] === void 0) { + rawOptions[k] = value; } - return null; } - if (target === null) { - return null; + if (rawOptions.parser === "json") { + rawOptions.trailingComma = "none"; } - throw invalidPackageTarget( - packageSubpath, - target, - packageJsonUrl, - internal, - base - ); + return normalize_options_default(rawOptions, supportOptions, { + passThrough: Object.keys(formatOptionsHiddenDefaults), + ...opts + }); } -function isConditionalExportsMainSugar(exports, packageJsonUrl, base) { - if (typeof exports === "string" || Array.isArray(exports)) - return true; - if (typeof exports !== "object" || exports === null) - return false; - const keys = Object.getOwnPropertyNames(exports); - let isConditionalSugar = false; - let i = 0; - let j = -1; - while (++j < keys.length) { - const key = keys[j]; - const curIsConditionalSugar = key === "" || key[0] !== "."; - if (i++ === 0) { - isConditionalSugar = curIsConditionalSugar; - } else if (isConditionalSugar !== curIsConditionalSugar) { - throw new ERR_INVALID_PACKAGE_CONFIG2( - fileURLToPath5(packageJsonUrl), - base, - `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.` - ); - } +var normalize_format_options_default = normalizeFormatOptions; + +// src/main/parse.js +var import_code_frame2 = __toESM(require_lib3(), 1); +async function parse4(originalText, options8) { + const parser = await resolveParser(options8); + const text = parser.preprocess ? parser.preprocess(originalText, options8) : originalText; + options8.originalText = text; + let ast; + try { + ast = await parser.parse( + text, + options8, + // TODO: remove the third argument in v4 + // The duplicated argument is passed as intended, see #10156 + options8 + ); + } catch (error) { + handleParseError(error, originalText); } - return isConditionalSugar; + return { text, ast }; } -function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) { - if (process3.noDeprecation) { - return; +function handleParseError(error, text) { + const { loc } = error; + if (loc) { + const codeFrame = (0, import_code_frame2.codeFrameColumns)(text, loc, { highlightCode: true }); + error.message += "\n" + codeFrame; + error.codeFrame = codeFrame; + throw error; } - const pjsonPath = fileURLToPath5(pjsonUrl); - if (emittedPackageWarnings.has(pjsonPath + "|" + match)) - return; - emittedPackageWarnings.add(pjsonPath + "|" + match); - process3.emitWarning( - `Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath5(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, - "DeprecationWarning", - "DEP0155" - ); + throw error; } -function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) { - let exports = packageConfig.exports; - if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) { - exports = { ".": exports }; +var parse_default = parse4; + +// src/main/multiparser.js +async function printEmbeddedLanguages(path13, genericPrint, options8, printAstToDoc2, embeds) { + const { + embeddedLanguageFormatting, + printer: { + embed, + hasPrettierIgnore = () => false, + getVisitorKeys: printerGetVisitorKeys + } + } = options8; + if (!embed || embeddedLanguageFormatting !== "auto") { + return; } - if (own2.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) { - const target = exports[packageSubpath]; - const resolveResult = resolvePackageTarget( - packageJsonUrl, - target, - "", - packageSubpath, - base, - false, - false, - false, - conditions + if (embed.length > 2) { + throw new Error( + "printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed" ); - if (resolveResult === null || resolveResult === void 0) { - throw exportsNotFound(packageSubpath, packageJsonUrl, base); - } - return resolveResult; } - let bestMatch = ""; - let bestMatchSubpath = ""; - const keys = Object.getOwnPropertyNames(exports); - let i = -1; - while (++i < keys.length) { - const key = keys[i]; - const patternIndex = key.indexOf("*"); - if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) { - if (packageSubpath.endsWith("/")) { - emitTrailingSlashPatternDeprecation( - packageSubpath, - packageJsonUrl, - base - ); + const getVisitorKeys = create_get_visitor_keys_function_default( + embed.getVisitorKeys ?? printerGetVisitorKeys + ); + const embedCallResults = []; + recurse(); + const originalPathStack = path13.stack; + for (const { print, node, pathStack } of embedCallResults) { + try { + path13.stack = pathStack; + const doc2 = await print(textToDocForEmbed, genericPrint, path13, options8); + if (doc2) { + embeds.set(node, doc2); } - const patternTrailer = key.slice(patternIndex + 1); - if (packageSubpath.length >= key.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) { - bestMatch = key; - bestMatchSubpath = packageSubpath.slice( - patternIndex, - packageSubpath.length - patternTrailer.length - ); + } catch (error) { + if (process.env.PRETTIER_DEBUG) { + throw error; } } } - if (bestMatch) { - const target = ( - /** @type {unknown} */ - exports[bestMatch] - ); - const resolveResult = resolvePackageTarget( - packageJsonUrl, - target, - bestMatchSubpath, - bestMatch, - base, - true, - false, - packageSubpath.endsWith("/"), - conditions - ); - if (resolveResult === null || resolveResult === void 0) { - throw exportsNotFound(packageSubpath, packageJsonUrl, base); - } - return resolveResult; - } - throw exportsNotFound(packageSubpath, packageJsonUrl, base); -} -function patternKeyCompare(a, b) { - const aPatternIndex = a.indexOf("*"); - const bPatternIndex = b.indexOf("*"); - const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1; - const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1; - if (baseLengthA > baseLengthB) - return -1; - if (baseLengthB > baseLengthA) - return 1; - if (aPatternIndex === -1) - return 1; - if (bPatternIndex === -1) - return -1; - if (a.length > b.length) - return -1; - if (b.length > a.length) - return 1; - return 0; -} -function packageImportsResolve(name, base, conditions) { - if (name === "#" || name.startsWith("#/") || name.endsWith("/")) { - const reason = "is not a valid internal imports specifier name"; - throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath5(base)); + path13.stack = originalPathStack; + function textToDocForEmbed(text, partialNextOptions) { + return textToDoc(text, partialNextOptions, options8, printAstToDoc2); } - let packageJsonUrl; - const packageConfig = getPackageScopeConfig(base); - if (packageConfig.exists) { - packageJsonUrl = pathToFileURL2(packageConfig.pjsonPath); - const imports = packageConfig.imports; - if (imports) { - if (own2.call(imports, name) && !name.includes("*")) { - const resolveResult = resolvePackageTarget( - packageJsonUrl, - imports[name], - "", - name, - base, - false, - true, - false, - conditions - ); - if (resolveResult !== null && resolveResult !== void 0) { - return resolveResult; - } + function recurse() { + const { node } = path13; + if (node === null || typeof node !== "object" || hasPrettierIgnore(path13)) { + return; + } + for (const key2 of getVisitorKeys(node)) { + if (Array.isArray(node[key2])) { + path13.each(recurse, key2); } else { - let bestMatch = ""; - let bestMatchSubpath = ""; - const keys = Object.getOwnPropertyNames(imports); - let i = -1; - while (++i < keys.length) { - const key = keys[i]; - const patternIndex = key.indexOf("*"); - if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) { - const patternTrailer = key.slice(patternIndex + 1); - if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) { - bestMatch = key; - bestMatchSubpath = name.slice( - patternIndex, - name.length - patternTrailer.length - ); - } - } - } - if (bestMatch) { - const target = imports[bestMatch]; - const resolveResult = resolvePackageTarget( - packageJsonUrl, - target, - bestMatchSubpath, - bestMatch, - base, - true, - true, - false, - conditions - ); - if (resolveResult !== null && resolveResult !== void 0) { - return resolveResult; - } - } + path13.call(recurse, key2); } } + const result = embed(path13, options8); + if (!result) { + return; + } + if (typeof result === "function") { + embedCallResults.push({ + print: result, + node, + pathStack: [...path13.stack] + }); + return; + } + if (false) { + throw new Error( + "`embed` should return an async function instead of Promise." + ); + } + embeds.set(node, result); } - throw importNotDefined(name, packageJsonUrl, base); } -function parsePackageName(specifier, base) { - let separatorIndex = specifier.indexOf("/"); - let validPackageName = true; - let isScoped = false; - if (specifier[0] === "@") { - isScoped = true; - if (separatorIndex === -1 || specifier.length === 0) { - validPackageName = false; - } else { - separatorIndex = specifier.indexOf("/", separatorIndex + 1); +async function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc2) { + const options8 = await normalize_format_options_default( + { + ...parentOptions, + ...partialNextOptions, + parentParser: parentOptions.parser, + originalText: text + }, + { passThrough: true } + ); + const { ast } = await parse_default(text, options8); + const doc2 = await printAstToDoc2(ast, options8); + return stripTrailingHardline(doc2); +} + +// src/main/print-ignored.js +function printIgnored(path13, options8) { + const { + originalText, + [Symbol.for("comments")]: comments, + locStart, + locEnd, + [Symbol.for("printedComments")]: printedComments + } = options8; + const { node } = path13; + const start = locStart(node); + const end = locEnd(node); + for (const comment of comments) { + if (locStart(comment) >= start && locEnd(comment) <= end) { + printedComments.add(comment); } } - const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex); - if (invalidPackageNameRegEx.exec(packageName) !== null) { - validPackageName = false; + return originalText.slice(start, end); +} +var print_ignored_default = printIgnored; + +// src/main/ast-to-doc.js +async function printAstToDoc(ast, options8) { + ({ ast } = await prepareToPrint(ast, options8)); + const cache3 = /* @__PURE__ */ new Map(); + const path13 = new ast_path_default(ast); + const ensurePrintingNode = create_print_pre_check_function_default(options8); + const embeds = /* @__PURE__ */ new Map(); + await printEmbeddedLanguages(path13, mainPrint, options8, printAstToDoc, embeds); + const doc2 = await callPluginPrintFunction( + path13, + options8, + mainPrint, + void 0, + embeds + ); + ensureAllCommentsPrinted(options8); + return doc2; + function mainPrint(selector, args) { + if (selector === void 0 || selector === path13) { + return mainPrintInternal(args); + } + if (Array.isArray(selector)) { + return path13.call(() => mainPrintInternal(args), ...selector); + } + return path13.call(() => mainPrintInternal(args), selector); } - if (!validPackageName) { - throw new ERR_INVALID_MODULE_SPECIFIER( - specifier, - "is not a valid package name", - fileURLToPath5(base) - ); + function mainPrintInternal(args) { + ensurePrintingNode(path13); + const value = path13.node; + if (value === void 0 || value === null) { + return ""; + } + const shouldCache = value && typeof value === "object" && args === void 0; + if (shouldCache && cache3.has(value)) { + return cache3.get(value); + } + const doc3 = callPluginPrintFunction(path13, options8, mainPrint, args, embeds); + if (shouldCache) { + cache3.set(value, doc3); + } + return doc3; } - const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex)); - return { packageName, packageSubpath, isScoped }; } -function packageResolve(specifier, base, conditions) { - if (builtinModules.includes(specifier)) { - return new URL3("node:" + specifier); +function callPluginPrintFunction(path13, options8, printPath, args, embeds) { + var _a; + const { node } = path13; + const { printer } = options8; + let doc2; + if ((_a = printer.hasPrettierIgnore) == null ? void 0 : _a.call(printer, path13)) { + doc2 = print_ignored_default(path13, options8); + } else if (embeds.has(node)) { + doc2 = embeds.get(node); + } else { + doc2 = printer.print(path13, options8, printPath, args); } - const { packageName, packageSubpath, isScoped } = parsePackageName( - specifier, - base + if (node === options8.cursorNode) { + doc2 = inheritLabel(doc2, (doc3) => [cursor, doc3, cursor]); + } + if (printer.printComment && (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path13, options8))) { + doc2 = printComments(path13, doc2, options8); + } + return doc2; +} +async function prepareToPrint(ast, options8) { + const comments = ast.comments ?? []; + options8[Symbol.for("comments")] = comments; + options8[Symbol.for("tokens")] = ast.tokens ?? []; + options8[Symbol.for("printedComments")] = /* @__PURE__ */ new Set(); + attachComments(ast, options8); + const { + printer: { preprocess } + } = options8; + ast = preprocess ? await preprocess(ast, options8) : ast; + return { ast, comments }; +} + +// src/main/get-cursor-node.js +function getCursorNode(ast, options8) { + const { cursorOffset, locStart, locEnd } = options8; + const getVisitorKeys = create_get_visitor_keys_function_default( + options8.printer.getVisitorKeys ); - const packageConfig = getPackageScopeConfig(base); - if (packageConfig.exists) { - const packageJsonUrl2 = pathToFileURL2(packageConfig.pjsonPath); - if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) { - return packageExportsResolve( - packageJsonUrl2, - packageSubpath, - packageConfig, - base, - conditions - ); + const nodeContainsCursor = (node) => locStart(node) <= cursorOffset && locEnd(node) >= cursorOffset; + let cursorNode = ast; + for (const node of getDescendants(ast, { + getVisitorKeys, + filter: nodeContainsCursor + })) { + cursorNode = node; + } + return cursorNode; +} +var get_cursor_node_default = getCursorNode; + +// src/main/massage-ast.js +function massageAst(ast, options8) { + const { + printer: { + massageAstNode: cleanFunction, + getVisitorKeys: printerGetVisitorKeys } + } = options8; + if (!cleanFunction) { + return ast; } - let packageJsonUrl = new URL3( - "./node_modules/" + packageName + "/package.json", - base - ); - let packageJsonPath = fileURLToPath5(packageJsonUrl); - let lastPath; - do { - const stat = tryStatSync(packageJsonPath.slice(0, -13)); - if (!stat.isDirectory()) { - lastPath = packageJsonPath; - packageJsonUrl = new URL3( - (isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", - packageJsonUrl - ); - packageJsonPath = fileURLToPath5(packageJsonUrl); - continue; + const getVisitorKeys = create_get_visitor_keys_function_default(printerGetVisitorKeys); + const ignoredProperties = cleanFunction.ignoredProperties ?? /* @__PURE__ */ new Set(); + return recurse(ast); + function recurse(node, parent) { + if (!(node !== null && typeof node === "object")) { + return node; } - const packageConfig2 = package_json_reader_default.read(packageJsonPath, { - base, - specifier - }); - if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) { - return packageExportsResolve( - packageJsonUrl, - packageSubpath, - packageConfig2, - base, - conditions - ); + if (Array.isArray(node)) { + return node.map((child) => recurse(child, parent)).filter(Boolean); + } + const newObj = {}; + const childrenKeys = new Set(getVisitorKeys(node)); + for (const key2 in node) { + if (!Object.prototype.hasOwnProperty.call(node, key2) || ignoredProperties.has(key2)) { + continue; + } + if (childrenKeys.has(key2)) { + newObj[key2] = recurse(node[key2], node); + } else { + newObj[key2] = node[key2]; + } } - if (packageSubpath === ".") { - return legacyMainResolve(packageJsonUrl, packageConfig2, base); + const result = cleanFunction(node, newObj, parent); + if (result === null) { + return; } - return new URL3(packageSubpath, packageJsonUrl); - } while (packageJsonPath.length !== lastPath.length); - throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath5(base), false); + return result ?? newObj; + } } -function isRelativeSpecifier(specifier) { - if (specifier[0] === ".") { - if (specifier.length === 1 || specifier[1] === "/") - return true; - if (specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/")) { - return true; +var massage_ast_default = massageAst; + +// src/main/range-util.js +import assert5 from "assert"; +var isJsonParser = ({ parser }) => parser === "json" || parser === "json5" || parser === "jsonc" || parser === "json-stringify"; +function findCommonAncestor(startNodeAndParents, endNodeAndParents) { + const startNodeAndAncestors = [ + startNodeAndParents.node, + ...startNodeAndParents.parentNodes + ]; + const endNodeAndAncestors = /* @__PURE__ */ new Set([ + endNodeAndParents.node, + ...endNodeAndParents.parentNodes + ]); + return startNodeAndAncestors.find( + (node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node) + ); +} +function dropRootParents(parents) { + let lastParentIndex = parents.length - 1; + for (; ; ) { + const parent = parents[lastParentIndex]; + if ((parent == null ? void 0 : parent.type) === "Program" || (parent == null ? void 0 : parent.type) === "File") { + lastParentIndex--; + } else { + break; } } - return false; -} -function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { - if (specifier === "") - return false; - if (specifier[0] === "/") - return true; - return isRelativeSpecifier(specifier); + return parents.slice(0, lastParentIndex + 1); } -function moduleResolve(specifier, base, conditions, preserveSymlinks) { - const protocol = base.protocol; - const isRemote = protocol === "http:" || protocol === "https:"; - let resolved; - if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { - resolved = new URL3(specifier, base); - } else if (!isRemote && specifier[0] === "#") { - resolved = packageImportsResolve(specifier, base, conditions); - } else { - try { - resolved = new URL3(specifier); - } catch { - if (!isRemote) { - resolved = packageResolve(specifier, base, conditions); - } +function findSiblingAncestors(startNodeAndParents, endNodeAndParents, { locStart, locEnd }) { + let resultStartNode = startNodeAndParents.node; + let resultEndNode = endNodeAndParents.node; + if (resultStartNode === resultEndNode) { + return { + startNode: resultStartNode, + endNode: resultEndNode + }; + } + const startNodeStart = locStart(startNodeAndParents.node); + for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) { + if (locStart(endParent) >= startNodeStart) { + resultEndNode = endParent; + } else { + break; } } - assert5(resolved !== void 0, "expected to be defined"); - if (resolved.protocol !== "file:") { - return resolved; + const endNodeEnd = locEnd(endNodeAndParents.node); + for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) { + if (locEnd(startParent) <= endNodeEnd) { + resultStartNode = startParent; + } else { + break; + } + if (resultStartNode === resultEndNode) { + break; + } } - return finalizeResolution(resolved, base, preserveSymlinks); + return { + startNode: resultStartNode, + endNode: resultEndNode + }; } -function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { - if (parsedParentURL) { - const parentProtocol = parsedParentURL.protocol; - if (parentProtocol === "http:" || parentProtocol === "https:") { - if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { - const parsedProtocol = parsed == null ? void 0 : parsed.protocol; - if (parsedProtocol && parsedProtocol !== "https:" && parsedProtocol !== "http:") { - throw new ERR_NETWORK_IMPORT_DISALLOWED( - specifier, - parsedParentURL, - "remote imports cannot import from a local location." - ); - } - return { url: (parsed == null ? void 0 : parsed.href) || "" }; - } - if (builtinModules.includes(specifier)) { - throw new ERR_NETWORK_IMPORT_DISALLOWED( - specifier, - parsedParentURL, - "remote imports cannot import from a local location." - ); - } - throw new ERR_NETWORK_IMPORT_DISALLOWED( - specifier, - parsedParentURL, - "only relative and absolute specifiers are supported." - ); +function findNodeAtOffset(node, offset, options8, predicate, parentNodes = [], type2) { + const { locStart, locEnd } = options8; + const start = locStart(node); + const end = locEnd(node); + if (offset > end || offset < start || type2 === "rangeEnd" && offset === start || type2 === "rangeStart" && offset === end) { + return; + } + for (const childNode of getSortedChildNodes(node, options8)) { + const childResult = findNodeAtOffset( + childNode, + offset, + options8, + predicate, + [node, ...parentNodes], + type2 + ); + if (childResult) { + return childResult; } } + if (!predicate || predicate(node, parentNodes[0])) { + return { + node, + parentNodes + }; + } } -function isURL(self) { - return Boolean( - self && typeof self === "object" && "href" in self && typeof self.href === "string" && "protocol" in self && typeof self.protocol === "string" && self.href && self.protocol - ); +function isJsSourceElement(type2, parentType) { + return parentType !== "DeclareExportDeclaration" && type2 !== "TypeParameterDeclaration" && (type2 === "Directive" || type2 === "TypeAlias" || type2 === "TSExportAssignment" || type2.startsWith("Declare") || type2.startsWith("TSDeclare") || type2.endsWith("Statement") || type2.endsWith("Declaration")); } -function throwIfInvalidParentURL(parentURL) { - if (parentURL === void 0) { - return; +var jsonSourceElements = /* @__PURE__ */ new Set([ + "JsonRoot", + "ObjectExpression", + "ArrayExpression", + "StringLiteral", + "NumericLiteral", + "BooleanLiteral", + "NullLiteral", + "UnaryExpression", + "TemplateLiteral" +]); +var graphqlSourceElements = /* @__PURE__ */ new Set([ + "OperationDefinition", + "FragmentDefinition", + "VariableDefinition", + "TypeExtensionDefinition", + "ObjectTypeDefinition", + "FieldDefinition", + "DirectiveDefinition", + "EnumTypeDefinition", + "EnumValueDefinition", + "InputValueDefinition", + "InputObjectTypeDefinition", + "SchemaDefinition", + "OperationTypeDefinition", + "InterfaceTypeDefinition", + "UnionTypeDefinition", + "ScalarTypeDefinition" +]); +function isSourceElement(opts, node, parentNode) { + if (!node) { + return false; } - if (typeof parentURL !== "string" && !isURL(parentURL)) { - throw new codes.ERR_INVALID_ARG_TYPE( - "parentURL", - ["string", "URL"], - parentURL - ); + switch (opts.parser) { + case "flow": + case "babel": + case "babel-flow": + case "babel-ts": + case "typescript": + case "acorn": + case "espree": + case "meriyah": + case "__babel_estree": + return isJsSourceElement(node.type, parentNode == null ? void 0 : parentNode.type); + case "json": + case "json5": + case "jsonc": + case "json-stringify": + return jsonSourceElements.has(node.type); + case "graphql": + return graphqlSourceElements.has(node.kind); + case "vue": + return node.tag !== "root"; } + return false; } -function defaultResolve(specifier, context = {}) { - const { parentURL } = context; - assert5(parentURL !== void 0, "expected `parentURL` to be defined"); - throwIfInvalidParentURL(parentURL); - let parsedParentURL; - if (parentURL) { - try { - parsedParentURL = new URL3(parentURL); - } catch { +function calculateRange(text, opts, ast) { + let { rangeStart: start, rangeEnd: end, locStart, locEnd } = opts; + assert5.ok(end > start); + const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/); + const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1; + if (!isAllWhitespace) { + start += firstNonWhitespaceCharacterIndex; + for (; end > start; --end) { + if (/\S/.test(text[end - 1])) { + break; + } } } - let parsed; - try { - parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier) ? new URL3(specifier, parsedParentURL) : new URL3(specifier); - const protocol = parsed.protocol; - if (protocol === "data:") { - return { url: parsed.href, format: null }; - } - } catch { + const startNodeAndParents = findNodeAtOffset( + ast, + start, + opts, + (node, parentNode) => isSourceElement(opts, node, parentNode), + [], + "rangeStart" + ); + const endNodeAndParents = ( + // No need find Node at `end`, it will be the same as `startNodeAndParents` + isAllWhitespace ? startNodeAndParents : findNodeAtOffset( + ast, + end, + opts, + (node) => isSourceElement(opts, node), + [], + "rangeEnd" + ) + ); + if (!startNodeAndParents || !endNodeAndParents) { + return { + rangeStart: 0, + rangeEnd: 0 + }; + } + let startNode; + let endNode; + if (isJsonParser(opts)) { + const commonAncestor = findCommonAncestor( + startNodeAndParents, + endNodeAndParents + ); + startNode = commonAncestor; + endNode = commonAncestor; + } else { + ({ startNode, endNode } = findSiblingAncestors( + startNodeAndParents, + endNodeAndParents, + opts + )); } - const maybeReturn = checkIfDisallowedImport( - specifier, - parsed, - parsedParentURL - ); - if (maybeReturn) - return maybeReturn; - if (parsed && parsed.protocol === "node:") - return { url: specifier }; - const conditions = getConditionsSet(context.conditions); - const url2 = moduleResolve(specifier, new URL3(parentURL), conditions, false); return { - // Do NOT cast `url` to a string: that will work even when there are real - // problems, silencing them - url: url2.href, - format: defaultGetFormatWithoutErrors(url2, { parentURL }) + rangeStart: Math.min(locStart(startNode), locStart(endNode)), + rangeEnd: Math.max(locEnd(startNode), locEnd(endNode)) }; } -// node_modules/import-meta-resolve/index.js -function resolve(specifier, parent) { - if (!parent) { - throw new Error( - "Please pass `parent`: `import-meta-resolve` cannot ponyfill that" - ); +// src/main/core.js +var BOM = "\uFEFF"; +var CURSOR = Symbol("cursor"); +async function coreFormat(originalText, opts, addAlignmentSize = 0) { + if (!originalText || originalText.trim().length === 0) { + return { + formatted: "", + cursorOffset: -1, + comments: [] + }; } - try { - return defaultResolve(specifier, { parentURL: parent }).url; - } catch (error) { - const exception = ( - /** @type {ErrnoException} */ - error - ); - if ((exception.code === "ERR_UNSUPPORTED_DIR_IMPORT" || exception.code === "ERR_MODULE_NOT_FOUND") && typeof exception.url === "string") { - return exception.url; - } - throw error; + const { + ast, + text + } = await parse_default(originalText, opts); + if (opts.cursorOffset >= 0) { + opts.cursorNode = get_cursor_node_default(ast, opts); } -} - -// src/utils/import-from-file.js -function importFromFile(specifier, parent) { - const url2 = resolve(specifier, pathToFileURL3(parent).href); - return import(url2); -} -var import_from_file_default = importFromFile; - -// src/config/load-external-config.js -var requireErrorCodesShouldBeIgnored = /* @__PURE__ */ new Set([ - "MODULE_NOT_FOUND", - "ERR_REQUIRE_ESM", - "ERR_PACKAGE_PATH_NOT_EXPORTED" -]); -async function loadExternalConfig(config, filepath) { - try { - return require_from_file_default(config, filepath); - } catch (error) { - if (!requireErrorCodesShouldBeIgnored.has(error == null ? void 0 : error.code)) { - throw error; - } + let doc2 = await printAstToDoc(ast, opts, addAlignmentSize); + if (addAlignmentSize > 0) { + doc2 = addAlignmentToDoc([hardline, doc2], addAlignmentSize, opts.tabWidth); } - const module = await import_from_file_default(config, filepath); - return module.default; -} -var load_external_config_default = loadExternalConfig; - -// src/config/get-prettier-config-explorer.js -var { lilconfig } = mockable; -var searchPlaces = [ - "package.json", - ".prettierrc", - ".prettierrc.json", - ".prettierrc.yaml", - ".prettierrc.yml", - ".prettierrc.json5", - ".prettierrc.js", - ".prettierrc.mjs", - ".prettierrc.cjs", - "prettier.config.js", - "prettier.config.mjs", - "prettier.config.cjs", - ".prettierrc.toml" -]; -async function loadJs(filepath) { - const module = await import(pathToFileURL4(filepath).href); - return module.default; -} -function loadYaml(filepath, content) { - try { - return import_js_yaml.default.load(content); - } catch (error) { - error.message = `YAML Error in ${filepath}: -${error.message}`; - throw error; + const result = printDocToString(doc2, opts); + if (addAlignmentSize > 0) { + const trimmed = result.formatted.trim(); + if (result.cursorNodeStart !== void 0) { + result.cursorNodeStart -= result.formatted.indexOf(trimmed); + } + result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine); } -} -var loaders = { - async ".toml"(filePath, content) { - try { - return await (0, import_parse_async.default)(content); - } catch (error) { - error.message = `TOML Error in ${filePath}: -${error.message}`; - throw error; + const comments = opts[Symbol.for("comments")]; + if (opts.cursorOffset >= 0) { + let oldCursorNodeStart; + let oldCursorNodeText; + let cursorOffsetRelativeToOldCursorNode; + let newCursorNodeStart; + let newCursorNodeText; + if (opts.cursorNode && result.cursorNodeText) { + oldCursorNodeStart = opts.locStart(opts.cursorNode); + oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode)); + cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart; + newCursorNodeStart = result.cursorNodeStart; + newCursorNodeText = result.cursorNodeText; + } else { + oldCursorNodeStart = 0; + oldCursorNodeText = text; + cursorOffsetRelativeToOldCursorNode = opts.cursorOffset; + newCursorNodeStart = 0; + newCursorNodeText = result.formatted; } - }, - ".json5"(filePath, content) { - try { - return (0, import_parse3.default)(content); - } catch (error) { - error.message = `JSON5 Error in ${filePath}: -${error.message}`; - throw error; + if (oldCursorNodeText === newCursorNodeText) { + return { + formatted: result.formatted, + cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode, + comments + }; } - }, - ".json"(filePath, content) { - try { - return parseJson(content); - } catch (error) { - error.message = `JSON Error in ${filePath}: -${error.message}`; - throw error; + const oldCursorNodeCharArray = oldCursorNodeText.split(""); + oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR); + const newCursorNodeCharArray = newCursorNodeText.split(""); + const cursorNodeDiff = (0, import_diff.diffArrays)(oldCursorNodeCharArray, newCursorNodeCharArray); + let cursorOffset = newCursorNodeStart; + for (const entry of cursorNodeDiff) { + if (entry.removed) { + if (entry.value.includes(CURSOR)) { + break; + } + } else { + cursorOffset += entry.count; + } } - }, - ".js": loadJs, - ".mjs": loadJs, - ".yaml": loadYaml, - ".yml": loadYaml, - noExt: loadYaml -}; -async function transform(result) { - if (!(result == null ? void 0 : result.config)) { - return result; - } - let { config, filepath } = result; - if (typeof config === "string") { - config = await load_external_config_default(config, filepath); - result.config = config; - } - if (typeof config !== "object") { - throw new TypeError( - `Config is only allowed to be an object, but received ${typeof config} in "${filepath}"` - ); - } - delete config.$schema; - return result; -} -function getExplorer() { - return lilconfig("prettier", { searchPlaces, loaders, transform }); -} -var get_prettier_config_explorer_default = getExplorer; - -// src/config/resolve-config.js -var getPrettierConfigExplorer = mem(get_prettier_config_explorer_default, { - cacheKey: ([options8]) => options8.cache -}); -var memoizedLoadEditorConfig = mem(resolve_editorconfig_default); -function clearCache() { - memClear(getPrettierConfigExplorer); - memClear(memoizedLoadEditorConfig); -} -function loadEditorConfig2(filePath, options8) { - if (!filePath || !options8.editorconfig) { - return; + return { + formatted: result.formatted, + cursorOffset, + comments + }; } - return (options8.useCache ? memoizedLoadEditorConfig : resolve_editorconfig_default)(filePath); -} -function loadPrettierConfig(filePath, options8) { - const { useCache, config: configPath } = options8; - const { load, search } = getPrettierConfigExplorer({ - cache: Boolean(useCache) - }); - return configPath ? load(configPath) : search(filePath ? path5.resolve(filePath) : void 0); + return { + formatted: result.formatted, + cursorOffset: -1, + comments + }; } -async function resolveConfig(fileUrlOrPath, options8) { - options8 = { useCache: true, ...options8 }; - const filePath = toPath(fileUrlOrPath); - const [result, editorConfigured] = await Promise.all([ - loadPrettierConfig(filePath, options8), - loadEditorConfig2(filePath, options8) - ]); - if (!result && !editorConfigured) { - return null; +async function formatRange(originalText, opts) { + const { + ast, + text + } = await parse_default(originalText, opts); + const { + rangeStart, + rangeEnd + } = calculateRange(text, opts, ast); + const rangeString = text.slice(rangeStart, rangeEnd); + const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1); + const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0]; + const alignmentSize = get_alignment_size_default(indentString, opts.tabWidth); + const rangeResult = await coreFormat(rangeString, { + ...opts, + rangeStart: 0, + rangeEnd: Number.POSITIVE_INFINITY, + // Track the cursor offset only if it's within our range + cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1, + // Always use `lf` to format, we'll replace it later + endOfLine: "lf" + }, alignmentSize); + const rangeTrimmed = rangeResult.formatted.trimEnd(); + let { + cursorOffset + } = opts; + if (cursorOffset > rangeEnd) { + cursorOffset += rangeTrimmed.length - rangeString.length; + } else if (rangeResult.cursorOffset >= 0) { + cursorOffset = rangeResult.cursorOffset + rangeStart; } - const merged = { - ...editorConfigured, - ...mergeOverrides(result, filePath) - }; - if (Array.isArray(merged.plugins)) { - merged.plugins = merged.plugins.map( - (value) => typeof value === "string" && value.startsWith(".") ? path5.resolve(path5.dirname(result.filepath), value) : value + let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd); + if (opts.endOfLine !== "lf") { + const eol = convertEndOfLineToChars(opts.endOfLine); + if (cursorOffset >= 0 && eol === "\r\n") { + cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n"); + } + formatted = string_replace_all_default( + /* isOptionalObject*/ + false, + formatted, + "\n", + eol ); } - return merged; -} -async function resolveConfigFile(fileUrlOrPath) { - const { search } = getPrettierConfigExplorer({ cache: false }); - const result = await search( - fileUrlOrPath ? path5.resolve(toPath(fileUrlOrPath)) : void 0 - ); - return (result == null ? void 0 : result.filepath) ?? null; + return { + formatted, + cursorOffset, + comments: rangeResult.comments + }; } -function mergeOverrides(configResult, filePath) { - const { config, filepath: configPath } = configResult || {}; - const { overrides, ...options8 } = config || {}; - if (filePath && overrides) { - const relativeFilePath = path5.relative(path5.dirname(configPath), filePath); - for (const override of overrides) { - if (pathMatchesGlobs( - relativeFilePath, - override.files, - override.excludeFiles - )) { - Object.assign(options8, override.options); - } - } +function ensureIndexInText(text, index, defaultValue) { + if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) { + return defaultValue; } - return options8; + return index; } -function pathMatchesGlobs(filePath, patterns, excludedPatterns) { - const patternList = Array.isArray(patterns) ? patterns : [patterns]; - const [withSlashes, withoutSlashes] = partition_default( - patternList, - (pattern) => pattern.includes("/") - ); - return import_micromatch.default.isMatch(filePath, withoutSlashes, { - ignore: excludedPatterns, - basename: true, - dot: true - }) || import_micromatch.default.isMatch(filePath, withSlashes, { - ignore: excludedPatterns, - basename: false, - dot: true - }); +function normalizeIndexes(text, options8) { + let { + cursorOffset, + rangeStart, + rangeEnd + } = options8; + cursorOffset = ensureIndexInText(text, cursorOffset, -1); + rangeStart = ensureIndexInText(text, rangeStart, 0); + rangeEnd = ensureIndexInText(text, rangeEnd, text.length); + return { + ...options8, + cursorOffset, + rangeStart, + rangeEnd + }; } - -// src/utils/ignore.js -import path6 from "path"; -import url from "url"; -var import_ignore = __toESM(require_ignore(), 1); - -// src/utils/read-file.js -import fs4 from "fs/promises"; -async function readFile(file) { - if (isUrlString(file)) { - file = new URL(file); +function normalizeInputAndOptions(text, options8) { + let { + cursorOffset, + rangeStart, + rangeEnd, + endOfLine + } = normalizeIndexes(text, options8); + const hasBOM = text.charAt(0) === BOM; + if (hasBOM) { + text = text.slice(1); + cursorOffset--; + rangeStart--; + rangeEnd--; } - try { - return await fs4.readFile(file, "utf8"); - } catch (error) { - if (error.code === "ENOENT") { - return; - } - throw new Error(`Unable to read '${file}': ${error.message}`); + if (endOfLine === "auto") { + endOfLine = guessEndOfLine(text); + } + if (text.includes("\r")) { + const countCrlfBefore = (index) => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n"); + cursorOffset -= countCrlfBefore(cursorOffset); + rangeStart -= countCrlfBefore(rangeStart); + rangeEnd -= countCrlfBefore(rangeEnd); + text = normalizeEndOfLine(text); } + return { + hasBOM, + text, + options: normalizeIndexes(text, { + ...options8, + cursorOffset, + rangeStart, + rangeEnd, + endOfLine + }) + }; } -var read_file_default = readFile; - -// src/utils/ignore.js -var createIgnore = import_ignore.default.default; -var slash = path6.sep === "\\" ? (filePath) => string_replace_all_default( - /* isOptionalObject*/ - false, - filePath, - "\\", - "/" -) : (filePath) => filePath; -function getRelativePath(file, ignoreFile) { - const ignoreFilePath = toPath(ignoreFile); - const filePath = isUrl(file) ? url.fileURLToPath(file) : ( - // @ts-expect-error -- URLs handled by `isUrl` - path6.resolve(file) - ); - return path6.relative( - // If there's an ignore-path set, the filename must be relative to the - // ignore path, not the current working directory. - ignoreFilePath ? path6.dirname(ignoreFilePath) : process.cwd(), - filePath - ); +async function hasPragma(text, options8) { + const selectedParser = await resolveParser(options8); + return !selectedParser.hasPragma || selectedParser.hasPragma(text); } -async function createSingleIsIgnoredFunction(ignoreFile, withNodeModules) { - let content = ""; - if (ignoreFile) { - content += await read_file_default(ignoreFile) ?? ""; +async function formatWithCursor(originalText, originalOptions) { + let { + hasBOM, + text, + options: options8 + } = normalizeInputAndOptions(originalText, await normalize_format_options_default(originalOptions)); + if (options8.rangeStart >= options8.rangeEnd && text !== "" || options8.requirePragma && !await hasPragma(text, options8)) { + return { + formatted: originalText, + cursorOffset: originalOptions.cursorOffset, + comments: [] + }; } - if (!withNodeModules) { - content += "\nnode_modules"; + let result; + if (options8.rangeStart > 0 || options8.rangeEnd < text.length) { + result = await formatRange(text, options8); + } else { + if (!options8.requirePragma && options8.insertPragma && options8.printer.insertPragma && !await hasPragma(text, options8)) { + text = options8.printer.insertPragma(text); + } + result = await coreFormat(text, options8); } - if (!content) { - return; + if (hasBOM) { + result.formatted = BOM + result.formatted; + if (result.cursorOffset >= 0) { + result.cursorOffset++; + } } - const ignore = createIgnore({ - allowRelativePaths: true - }).add(content); - return (file) => ignore.ignores(slash(getRelativePath(file, ignoreFile))); + return result; } -async function createIsIgnoredFunction(ignoreFiles, withNodeModules) { - if (ignoreFiles.length === 0 && !withNodeModules) { - ignoreFiles = [void 0]; +async function parse5(originalText, originalOptions, devOptions) { + const { + text, + options: options8 + } = normalizeInputAndOptions(originalText, await normalize_format_options_default(originalOptions)); + const parsed = await parse_default(text, options8); + if (devOptions) { + if (devOptions.preprocessForPrint) { + parsed.ast = await prepareToPrint(parsed.ast, options8); + } + if (devOptions.massage) { + parsed.ast = massage_ast_default(parsed.ast, options8); + } } - const isIgnoredFunctions = (await Promise.all(ignoreFiles.map((ignoreFile) => createSingleIsIgnoredFunction(ignoreFile, withNodeModules)))).filter(Boolean); - return (file) => isIgnoredFunctions.some((isIgnored2) => isIgnored2(file)); + return parsed; } -async function isIgnored(file, options8) { - const { - ignorePath: ignoreFiles, - withNodeModules - } = options8; - const isIgnored2 = await createIsIgnoredFunction(ignoreFiles, withNodeModules); - return isIgnored2(file); +async function formatAst(ast, options8) { + options8 = await normalize_format_options_default(options8); + const doc2 = await printAstToDoc(ast, options8); + return printDocToString(doc2, options8); } - -// src/common/get-file-info.js -async function getFileInfo(file, options8) { - if (typeof file !== "string" && !(file instanceof URL)) { - throw new TypeError( - `expect \`file\` to be a string or URL, got \`${typeof file}\`` - ); - } - let { ignorePath, withNodeModules } = options8; - if (!Array.isArray(ignorePath)) { - ignorePath = [ignorePath]; - } - const ignored = await isIgnored(file, { ignorePath, withNodeModules }); - let inferredParser; - if (!ignored) { - inferredParser = await getParser(file, options8); - } - return { - ignored, - inferredParser: inferredParser ?? null - }; +async function formatDoc(doc2, options8) { + const text = printDocToDebug(doc2); + const { + formatted + } = await formatWithCursor(text, { + ...options8, + parser: "__js_expression" + }); + return formatted; } -async function getParser(file, options8) { - let config; - if (options8.resolveConfig !== false) { - config = await resolveConfig(file); - } - return (config == null ? void 0 : config.parser) ?? infer_parser_default(options8, { physicalFile: file }); +async function printToDoc(originalText, options8) { + options8 = await normalize_format_options_default(options8); + const { + ast + } = await parse_default(originalText, options8); + return printAstToDoc(ast, options8); } -var get_file_info_default = getFileInfo; - -// src/main/plugins/load-plugin.js -import { pathToFileURL as pathToFileURL5 } from "url"; -import path8 from "path"; - -// src/utils/import-from-directory.js -import path7 from "path"; -function importFromDirectory(specifier, directory) { - return import_from_file_default(specifier, path7.join(directory, "noop.js")); +async function printDocToString2(doc2, options8) { + return printDocToString(doc2, await normalize_format_options_default(options8)); } -var import_from_directory_default = importFromDirectory; -// src/main/plugins/load-plugin.js -function normalizePlugin(pluginInstanceOfPluginModule, name) { - const plugin = pluginInstanceOfPluginModule.default ?? pluginInstanceOfPluginModule; - return { name, ...plugin }; -} -var loadPluginFromDirectory = mem( - async (name, directory) => normalizePlugin(await import_from_directory_default(name, directory), name), - { cacheKey: JSON.stringify } -); -var importPlugin = mem(async (name) => { - try { - return await import(pathToFileURL5(path8.resolve(name)).href); - } catch { - return import_from_directory_default(name, process.cwd()); - } +// src/main/option-categories.js +var option_categories_exports = {}; +__export(option_categories_exports, { + CATEGORY_CONFIG: () => CATEGORY_CONFIG, + CATEGORY_EDITOR: () => CATEGORY_EDITOR, + CATEGORY_FORMAT: () => CATEGORY_FORMAT, + CATEGORY_GLOBAL: () => CATEGORY_GLOBAL, + CATEGORY_OTHER: () => CATEGORY_OTHER, + CATEGORY_OUTPUT: () => CATEGORY_OUTPUT, + CATEGORY_SPECIAL: () => CATEGORY_SPECIAL }); -async function loadPlugin(plugin) { - if (typeof plugin === "string") { - return normalizePlugin(await importPlugin(plugin), plugin); - } - return plugin; -} -function clearCache2() { - memClear(loadPluginFromDirectory); - memClear(importPlugin); -} +var CATEGORY_CONFIG = "Config"; +var CATEGORY_EDITOR = "Editor"; +var CATEGORY_FORMAT = "Format"; +var CATEGORY_OTHER = "Other"; +var CATEGORY_OUTPUT = "Output"; +var CATEGORY_GLOBAL = "Global"; +var CATEGORY_SPECIAL = "Special"; // src/plugins/builtin-plugins-proxy.js var builtin_plugins_proxy_exports = {}; @@ -22705,61 +22886,6 @@ __export(builtin_plugins_proxy_exports, { printers: () => printers }); -// src/common/common-options.evaluate.js -var common_options_evaluate_default = { - "bracketSpacing": { - "category": "Common", - "type": "boolean", - "default": true, - "description": "Print spaces between brackets.", - "oppositeDescription": "Do not print spaces between brackets." - }, - "singleQuote": { - "category": "Common", - "type": "boolean", - "default": false, - "description": "Use single quotes instead of double quotes." - }, - "proseWrap": { - "category": "Common", - "type": "choice", - "default": "preserve", - "description": "How to wrap prose.", - "choices": [ - { - "value": "always", - "description": "Wrap prose if it exceeds the print width." - }, - { - "value": "never", - "description": "Do not wrap prose." - }, - { - "value": "preserve", - "description": "Wrap prose as-is." - } - ] - }, - "bracketSameLine": { - "category": "Common", - "type": "boolean", - "default": false, - "description": "Put > of opening tags on the last line instead of on a new line." - }, - "singleAttributePerLine": { - "category": "Common", - "type": "boolean", - "default": false, - "description": "Enforce single attribute per line in HTML, Vue and JSX." - } -}; - -// src/language-css/options.js -var options = { - singleQuote: common_options_evaluate_default.singleQuote -}; -var options_default = options; - // src/language-css/languages.evaluate.js var languages_evaluate_default = [ { @@ -22844,11 +22970,60 @@ var languages_evaluate_default = [ } ]; -// src/language-graphql/options.js -var options2 = { - bracketSpacing: common_options_evaluate_default.bracketSpacing +// src/common/common-options.evaluate.js +var common_options_evaluate_default = { + "bracketSpacing": { + "category": "Common", + "type": "boolean", + "default": true, + "description": "Print spaces between brackets.", + "oppositeDescription": "Do not print spaces between brackets." + }, + "singleQuote": { + "category": "Common", + "type": "boolean", + "default": false, + "description": "Use single quotes instead of double quotes." + }, + "proseWrap": { + "category": "Common", + "type": "choice", + "default": "preserve", + "description": "How to wrap prose.", + "choices": [ + { + "value": "always", + "description": "Wrap prose if it exceeds the print width." + }, + { + "value": "never", + "description": "Do not wrap prose." + }, + { + "value": "preserve", + "description": "Wrap prose as-is." + } + ] + }, + "bracketSameLine": { + "category": "Common", + "type": "boolean", + "default": false, + "description": "Put > of opening tags on the last line instead of on a new line." + }, + "singleAttributePerLine": { + "category": "Common", + "type": "boolean", + "default": false, + "description": "Enforce single attribute per line in HTML, Vue and JSX." + } }; -var options_default2 = options2; + +// src/language-css/options.js +var options = { + singleQuote: common_options_evaluate_default.singleQuote +}; +var options_default = options; // src/language-graphql/languages.evaluate.js var languages_evaluate_default2 = [ @@ -22873,6 +23048,12 @@ var languages_evaluate_default2 = [ } ]; +// src/language-graphql/options.js +var options2 = { + bracketSpacing: common_options_evaluate_default.bracketSpacing +}; +var options_default2 = options2; + // src/language-handlebars/languages.evaluate.js var languages_evaluate_default3 = [ { @@ -22899,40 +23080,6 @@ var languages_evaluate_default3 = [ } ]; -// src/language-html/options.js -var CATEGORY_HTML = "HTML"; -var options3 = { - bracketSameLine: common_options_evaluate_default.bracketSameLine, - htmlWhitespaceSensitivity: { - category: CATEGORY_HTML, - type: "choice", - default: "css", - description: "How to handle whitespaces in HTML.", - choices: [ - { - value: "css", - description: "Respect the default value of CSS display property." - }, - { - value: "strict", - description: "Whitespaces are considered sensitive." - }, - { - value: "ignore", - description: "Whitespaces are considered insensitive." - } - ] - }, - singleAttributePerLine: common_options_evaluate_default.singleAttributePerLine, - vueIndentScriptAndStyle: { - category: CATEGORY_HTML, - type: "boolean", - default: false, - description: "Indent script and style tags in Vue files." - } -}; -var options_default3 = options3; - // src/language-html/languages.evaluate.js var languages_evaluate_default4 = [ { @@ -23023,98 +23170,43 @@ var languages_evaluate_default4 = [ ], "vscodeLanguageIds": [ "vue" - ] - } -]; - -// src/language-js/options.js -var CATEGORY_JAVASCRIPT = "JavaScript"; -var options4 = { - arrowParens: { - category: CATEGORY_JAVASCRIPT, - type: "choice", - default: "always", - description: "Include parentheses around a sole arrow function parameter.", - choices: [ - { - value: "always", - description: "Always include parens. Example: `(x) => x`" - }, - { - value: "avoid", - description: "Omit parens when possible. Example: `x => x`" - } - ] - }, - bracketSameLine: common_options_evaluate_default.bracketSameLine, - bracketSpacing: common_options_evaluate_default.bracketSpacing, - jsxBracketSameLine: { - category: CATEGORY_JAVASCRIPT, - type: "boolean", - description: "Put > on the last line instead of at a new line.", - deprecated: "2.4.0" - }, - semi: { - category: CATEGORY_JAVASCRIPT, - type: "boolean", - default: true, - description: "Print semicolons.", - oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." - }, - experimentalTernaries: { - category: CATEGORY_JAVASCRIPT, - type: "boolean", - default: false, - description: "Use curious ternaries, with the question mark after the condition.", - oppositeDescription: "Default behavior of ternaries; keep question marks on the same line as the consequent." - }, - singleQuote: common_options_evaluate_default.singleQuote, - jsxSingleQuote: { - category: CATEGORY_JAVASCRIPT, - type: "boolean", - default: false, - description: "Use single quotes in JSX." - }, - quoteProps: { - category: CATEGORY_JAVASCRIPT, - type: "choice", - default: "as-needed", - description: "Change when properties in objects are quoted.", - choices: [ - { - value: "as-needed", - description: "Only add quotes around object properties where required." - }, - { - value: "consistent", - description: "If at least one property in an object requires quotes, quote all properties." - }, - { - value: "preserve", - description: "Respect the input use of quotes in object properties." - } - ] - }, - trailingComma: { - category: CATEGORY_JAVASCRIPT, + ] + } +]; + +// src/language-html/options.js +var CATEGORY_HTML = "HTML"; +var options3 = { + bracketSameLine: common_options_evaluate_default.bracketSameLine, + htmlWhitespaceSensitivity: { + category: CATEGORY_HTML, type: "choice", - default: "all", - description: "Print trailing commas wherever possible when multi-line.", + default: "css", + description: "How to handle whitespaces in HTML.", choices: [ { - value: "all", - description: "Trailing commas wherever possible (including function arguments)." + value: "css", + description: "Respect the default value of CSS display property." }, { - value: "es5", - description: "Trailing commas where valid in ES5 (objects, arrays, etc.)" + value: "strict", + description: "Whitespaces are considered sensitive." }, - { value: "none", description: "No trailing commas." } + { + value: "ignore", + description: "Whitespaces are considered insensitive." + } ] }, - singleAttributePerLine: common_options_evaluate_default.singleAttributePerLine + singleAttributePerLine: common_options_evaluate_default.singleAttributePerLine, + vueIndentScriptAndStyle: { + category: CATEGORY_HTML, + type: "boolean", + default: false, + description: "Indent script and style tags in Vue files." + } }; -var options_default4 = options4; +var options_default3 = options3; // src/language-js/languages.evaluate.js var languages_evaluate_default5 = [ @@ -23304,6 +23396,95 @@ var languages_evaluate_default5 = [ } ]; +// src/language-js/options.js +var CATEGORY_JAVASCRIPT = "JavaScript"; +var options4 = { + arrowParens: { + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: "always", + description: "Include parentheses around a sole arrow function parameter.", + choices: [ + { + value: "always", + description: "Always include parens. Example: `(x) => x`" + }, + { + value: "avoid", + description: "Omit parens when possible. Example: `x => x`" + } + ] + }, + bracketSameLine: common_options_evaluate_default.bracketSameLine, + bracketSpacing: common_options_evaluate_default.bracketSpacing, + jsxBracketSameLine: { + category: CATEGORY_JAVASCRIPT, + type: "boolean", + description: "Put > on the last line instead of at a new line.", + deprecated: "2.4.0" + }, + semi: { + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: true, + description: "Print semicolons.", + oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." + }, + experimentalTernaries: { + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: false, + description: "Use curious ternaries, with the question mark after the condition.", + oppositeDescription: "Default behavior of ternaries; keep question marks on the same line as the consequent." + }, + singleQuote: common_options_evaluate_default.singleQuote, + jsxSingleQuote: { + category: CATEGORY_JAVASCRIPT, + type: "boolean", + default: false, + description: "Use single quotes in JSX." + }, + quoteProps: { + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: "as-needed", + description: "Change when properties in objects are quoted.", + choices: [ + { + value: "as-needed", + description: "Only add quotes around object properties where required." + }, + { + value: "consistent", + description: "If at least one property in an object requires quotes, quote all properties." + }, + { + value: "preserve", + description: "Respect the input use of quotes in object properties." + } + ] + }, + trailingComma: { + category: CATEGORY_JAVASCRIPT, + type: "choice", + default: "all", + description: "Print trailing commas wherever possible when multi-line.", + choices: [ + { + value: "all", + description: "Trailing commas wherever possible (including function arguments)." + }, + { + value: "es5", + description: "Trailing commas where valid in ES5 (objects, arrays, etc.)" + }, + { value: "none", description: "No trailing commas." } + ] + }, + singleAttributePerLine: common_options_evaluate_default.singleAttributePerLine +}; +var options_default4 = options4; + // src/language-json/languages.evaluate.js var languages_evaluate_default6 = [ { @@ -23382,7 +23563,12 @@ var languages_evaluate_default6 = [ "Pipfile.lock", "composer.lock", "flake.lock", - "mcmod.info" + "mcmod.info", + ".babelrc", + ".jscsrc", + ".jshintrc", + ".jslintrc", + ".swcrc" ], "parsers": [ "json" @@ -23422,24 +23608,9 @@ var languages_evaluate_default6 = [ ".sublime_metrics", ".sublime_session" ], - "filenames": [ - ".babelrc", - ".devcontainer.json", - ".eslintrc.json", - ".jscsrc", - ".jshintrc", - ".jslintrc", - ".swcrc", - "api-extractor.json", - "devcontainer.json", - "jsconfig.json", - "language-configuration.json", - "tsconfig.json", - "tslint.json", - ".eslintrc" - ], + "filenames": [], "parsers": [ - "json" + "jsonc" ], "vscodeLanguageIds": [ "jsonc" @@ -23466,13 +23637,6 @@ var languages_evaluate_default6 = [ } ]; -// src/language-markdown/options.js -var options5 = { - proseWrap: common_options_evaluate_default.proseWrap, - singleQuote: common_options_evaluate_default.singleQuote -}; -var options_default5 = options5; - // src/language-markdown/languages.evaluate.js var languages_evaluate_default7 = [ { @@ -23540,13 +23704,12 @@ var languages_evaluate_default7 = [ } ]; -// src/language-yaml/options.js -var options6 = { - bracketSpacing: common_options_evaluate_default.bracketSpacing, - singleQuote: common_options_evaluate_default.singleQuote, - proseWrap: common_options_evaluate_default.proseWrap +// src/language-markdown/options.js +var options5 = { + proseWrap: common_options_evaluate_default.proseWrap, + singleQuote: common_options_evaluate_default.singleQuote }; -var options_default6 = options6; +var options_default5 = options5; // src/language-yaml/languages.evaluate.js var languages_evaluate_default8 = [ @@ -23595,6 +23758,14 @@ var languages_evaluate_default8 = [ } ]; +// src/language-yaml/options.js +var options6 = { + bracketSpacing: common_options_evaluate_default.bracketSpacing, + singleQuote: common_options_evaluate_default.singleQuote, + proseWrap: common_options_evaluate_default.proseWrap +}; +var options_default6 = options6; + // src/plugins/builtin-plugins-proxy.js function createParsersAndPrinters(modules) { const parsers2 = /* @__PURE__ */ Object.create(null); @@ -23666,6 +23837,7 @@ var { parsers, printers } = createParsersAndPrinters([ "__babel_estree", "json", "json5", + "jsonc", "json-stringify" ] }, @@ -23723,40 +23895,69 @@ function loadBuiltinPlugins() { } var load_builtin_plugins_default = loadBuiltinPlugins; +// src/main/plugins/load-plugin.js +import path12 from "path"; +import { pathToFileURL as pathToFileURL5 } from "url"; + +// src/utils/import-from-directory.js +import path11 from "path"; +function importFromDirectory(specifier, directory) { + return import_from_file_default(specifier, path11.join(directory, "noop.js")); +} +var import_from_directory_default = importFromDirectory; + +// src/main/plugins/load-plugin.js +async function importPlugin(name, cwd) { + if (path12.isAbsolute(name)) { + return import(pathToFileURL5(name).href); + } + try { + return await import(pathToFileURL5(path12.resolve(name)).href); + } catch { + return import_from_directory_default(name, cwd); + } +} +async function loadPluginWithoutCache(plugin, cwd) { + const module = await importPlugin(plugin, cwd); + return { name: plugin, ...module.default ?? module }; +} +var cache2 = /* @__PURE__ */ new Map(); +function loadPlugin(plugin) { + if (typeof plugin !== "string") { + return plugin; + } + const cwd = process.cwd(); + const cacheKey = JSON.stringify({ name: plugin, cwd }); + if (!cache2.has(cacheKey)) { + cache2.set(cacheKey, loadPluginWithoutCache(plugin, cwd)); + } + return cache2.get(cacheKey); +} +function clearCache2() { + cache2.clear(); +} + // src/main/plugins/load-plugins.js function loadPlugins(plugins = []) { return Promise.all(plugins.map((plugin) => loadPlugin(plugin))); } var load_plugins_default = loadPlugins; -// src/main/option-categories.js -var option_categories_exports = {}; -__export(option_categories_exports, { - CATEGORY_CONFIG: () => CATEGORY_CONFIG, - CATEGORY_EDITOR: () => CATEGORY_EDITOR, - CATEGORY_FORMAT: () => CATEGORY_FORMAT, - CATEGORY_GLOBAL: () => CATEGORY_GLOBAL, - CATEGORY_OTHER: () => CATEGORY_OTHER, - CATEGORY_OUTPUT: () => CATEGORY_OUTPUT, - CATEGORY_SPECIAL: () => CATEGORY_SPECIAL -}); -var CATEGORY_CONFIG = "Config"; -var CATEGORY_EDITOR = "Editor"; -var CATEGORY_FORMAT = "Format"; -var CATEGORY_OTHER = "Other"; -var CATEGORY_OUTPUT = "Output"; -var CATEGORY_GLOBAL = "Global"; -var CATEGORY_SPECIAL = "Special"; - // src/utils/object-omit.js function omit(object, keys) { keys = new Set(keys); return Object.fromEntries( - Object.entries(object).filter(([key]) => !keys.has(key)) + Object.entries(object).filter(([key2]) => !keys.has(key2)) ); } var object_omit_default = omit; +// src/index.js +import * as doc from "./doc.mjs"; + +// src/main/version.evaluate.cjs +var version_evaluate_default = "3.2.5"; + // src/utils/public.js var public_exports = {}; __export(public_exports, { @@ -23845,6 +24046,20 @@ function isNextLineEmpty(text, startIndex) { } var is_next_line_empty_default = isNextLineEmpty; +// src/utils/get-indent-size.js +function getIndentSize(value, tabWidth) { + const lastNewlineIndex = value.lastIndexOf("\n"); + if (lastNewlineIndex === -1) { + return 0; + } + return get_alignment_size_default( + // All the leading whitespaces + value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], + tabWidth + ); +} +var get_indent_size_default = getIndentSize; + // node_modules/escape-string-regexp/index.js function escapeStringRegexp(string) { if (typeof string !== "string") { @@ -23868,19 +24083,12 @@ function getMaxContinuousCount(text, searchString) { } var get_max_continuous_count_default = getMaxContinuousCount; -// src/utils/get-indent-size.js -function getIndentSize(value, tabWidth) { - const lastNewlineIndex = value.lastIndexOf("\n"); - if (lastNewlineIndex === -1) { - return 0; - } - return get_alignment_size_default( - // All the leading whitespaces - value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], - tabWidth - ); +// src/utils/get-next-non-space-non-comment-character.js +function getNextNonSpaceNonCommentCharacter(text, startIndex) { + const index = get_next_non_space_non_comment_character_index_default(text, startIndex); + return index === false ? "" : text.charAt(index); } -var get_indent_size_default = getIndentSize; +var get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter; // src/utils/has-newline-in-range.js function hasNewlineInRange(text, startIndex, endIndex) { @@ -23904,13 +24112,6 @@ function hasSpaces(text, startIndex, options8 = {}) { } var has_spaces_default = hasSpaces; -// src/utils/get-next-non-space-non-comment-character.js -function getNextNonSpaceNonCommentCharacter(text, startIndex) { - const index = get_next_non_space_non_comment_character_index_default(text, startIndex); - return index === false ? "" : text.charAt(index); -} -var get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter; - // src/utils/make-string.js function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) { const otherQuote = enclosingQuote === '"' ? "'" : '"'; @@ -23972,12 +24173,6 @@ function isNextLineEmpty2(text, startIndex) { ); } -// src/index.js -import * as doc from "./doc.mjs"; - -// src/main/version.evaluate.cjs -var version_evaluate_default = "3.1.0"; - // src/index.js function withPlugins(fn, optionsArgumentIndex = 1) { return async (...args) => { @@ -24028,14 +24223,16 @@ var sharedWithCli = { isNonEmptyArray: is_non_empty_array_default, partition: partition_default, omit: object_omit_default - } + }, + mockable: mockable_default }; var debugApis = { - parse: withPlugins(parse2), + parse: withPlugins(parse5), formatAST: withPlugins(formatAst), formatDoc: withPlugins(formatDoc), printToDoc: withPlugins(printToDoc), - printDocToString: withPlugins(printDocToString2) + printDocToString: withPlugins(printDocToString2), + mockable: mockable_default }; // with-default-export:src/index.js diff --git a/node_modules/prettier/internal/cli.mjs b/node_modules/prettier/internal/cli.mjs index 1722e94..4f031e2 100644 --- a/node_modules/prettier/internal/cli.mjs +++ b/node_modules/prettier/internal/cli.mjs @@ -55,372 +55,6 @@ var __privateSet = (obj, member, value, setter) => { setter ? setter.call(obj, value) : member.set(obj, value); return value; }; -var __privateWrapper = (obj, member, setter, getter) => ({ - set _(value) { - __privateSet(obj, member, value, setter); - }, - get _() { - return __privateGet(obj, member, getter); - } -}); - -// node_modules/clone/clone.js -var require_clone = __commonJS({ - "node_modules/clone/clone.js"(exports, module) { - var clone = function() { - "use strict"; - function clone2(parent, circular, depth, prototype) { - var filter; - if (typeof circular === "object") { - depth = circular.depth; - prototype = circular.prototype; - filter = circular.filter; - circular = circular.circular; - } - var allParents = []; - var allChildren = []; - var useBuffer = typeof Buffer != "undefined"; - if (typeof circular == "undefined") - circular = true; - if (typeof depth == "undefined") - depth = Infinity; - function _clone(parent2, depth2) { - if (parent2 === null) - return null; - if (depth2 == 0) - return parent2; - var child; - var proto2; - if (typeof parent2 != "object") { - return parent2; - } - if (clone2.__isArray(parent2)) { - child = []; - } else if (clone2.__isRegExp(parent2)) { - child = new RegExp(parent2.source, __getRegExpFlags(parent2)); - if (parent2.lastIndex) - child.lastIndex = parent2.lastIndex; - } else if (clone2.__isDate(parent2)) { - child = new Date(parent2.getTime()); - } else if (useBuffer && Buffer.isBuffer(parent2)) { - if (Buffer.allocUnsafe) { - child = Buffer.allocUnsafe(parent2.length); - } else { - child = new Buffer(parent2.length); - } - parent2.copy(child); - return child; - } else { - if (typeof prototype == "undefined") { - proto2 = Object.getPrototypeOf(parent2); - child = Object.create(proto2); - } else { - child = Object.create(prototype); - proto2 = prototype; - } - } - if (circular) { - var index = allParents.indexOf(parent2); - if (index != -1) { - return allChildren[index]; - } - allParents.push(parent2); - allChildren.push(child); - } - for (var i in parent2) { - var attrs; - if (proto2) { - attrs = Object.getOwnPropertyDescriptor(proto2, i); - } - if (attrs && attrs.set == null) { - continue; - } - child[i] = _clone(parent2[i], depth2 - 1); - } - return child; - } - return _clone(parent, depth); - } - clone2.clonePrototype = function clonePrototype(parent) { - if (parent === null) - return null; - var c = function() { - }; - c.prototype = parent; - return new c(); - }; - function __objToStr(o) { - return Object.prototype.toString.call(o); - } - ; - clone2.__objToStr = __objToStr; - function __isDate(o) { - return typeof o === "object" && __objToStr(o) === "[object Date]"; - } - ; - clone2.__isDate = __isDate; - function __isArray(o) { - return typeof o === "object" && __objToStr(o) === "[object Array]"; - } - ; - clone2.__isArray = __isArray; - function __isRegExp(o) { - return typeof o === "object" && __objToStr(o) === "[object RegExp]"; - } - ; - clone2.__isRegExp = __isRegExp; - function __getRegExpFlags(re) { - var flags = ""; - if (re.global) - flags += "g"; - if (re.ignoreCase) - flags += "i"; - if (re.multiline) - flags += "m"; - return flags; - } - ; - clone2.__getRegExpFlags = __getRegExpFlags; - return clone2; - }(); - if (typeof module === "object" && module.exports) { - module.exports = clone; - } - } -}); - -// node_modules/defaults/index.js -var require_defaults = __commonJS({ - "node_modules/defaults/index.js"(exports, module) { - var clone = require_clone(); - module.exports = function(options, defaults) { - options = options || {}; - Object.keys(defaults).forEach(function(key) { - if (typeof options[key] === "undefined") { - options[key] = clone(defaults[key]); - } - }); - return options; - }; - } -}); - -// node_modules/wcwidth/combining.js -var require_combining = __commonJS({ - "node_modules/wcwidth/combining.js"(exports, module) { - module.exports = [ - [768, 879], - [1155, 1158], - [1160, 1161], - [1425, 1469], - [1471, 1471], - [1473, 1474], - [1476, 1477], - [1479, 1479], - [1536, 1539], - [1552, 1557], - [1611, 1630], - [1648, 1648], - [1750, 1764], - [1767, 1768], - [1770, 1773], - [1807, 1807], - [1809, 1809], - [1840, 1866], - [1958, 1968], - [2027, 2035], - [2305, 2306], - [2364, 2364], - [2369, 2376], - [2381, 2381], - [2385, 2388], - [2402, 2403], - [2433, 2433], - [2492, 2492], - [2497, 2500], - [2509, 2509], - [2530, 2531], - [2561, 2562], - [2620, 2620], - [2625, 2626], - [2631, 2632], - [2635, 2637], - [2672, 2673], - [2689, 2690], - [2748, 2748], - [2753, 2757], - [2759, 2760], - [2765, 2765], - [2786, 2787], - [2817, 2817], - [2876, 2876], - [2879, 2879], - [2881, 2883], - [2893, 2893], - [2902, 2902], - [2946, 2946], - [3008, 3008], - [3021, 3021], - [3134, 3136], - [3142, 3144], - [3146, 3149], - [3157, 3158], - [3260, 3260], - [3263, 3263], - [3270, 3270], - [3276, 3277], - [3298, 3299], - [3393, 3395], - [3405, 3405], - [3530, 3530], - [3538, 3540], - [3542, 3542], - [3633, 3633], - [3636, 3642], - [3655, 3662], - [3761, 3761], - [3764, 3769], - [3771, 3772], - [3784, 3789], - [3864, 3865], - [3893, 3893], - [3895, 3895], - [3897, 3897], - [3953, 3966], - [3968, 3972], - [3974, 3975], - [3984, 3991], - [3993, 4028], - [4038, 4038], - [4141, 4144], - [4146, 4146], - [4150, 4151], - [4153, 4153], - [4184, 4185], - [4448, 4607], - [4959, 4959], - [5906, 5908], - [5938, 5940], - [5970, 5971], - [6002, 6003], - [6068, 6069], - [6071, 6077], - [6086, 6086], - [6089, 6099], - [6109, 6109], - [6155, 6157], - [6313, 6313], - [6432, 6434], - [6439, 6440], - [6450, 6450], - [6457, 6459], - [6679, 6680], - [6912, 6915], - [6964, 6964], - [6966, 6970], - [6972, 6972], - [6978, 6978], - [7019, 7027], - [7616, 7626], - [7678, 7679], - [8203, 8207], - [8234, 8238], - [8288, 8291], - [8298, 8303], - [8400, 8431], - [12330, 12335], - [12441, 12442], - [43014, 43014], - [43019, 43019], - [43045, 43046], - [64286, 64286], - [65024, 65039], - [65056, 65059], - [65279, 65279], - [65529, 65531], - [68097, 68099], - [68101, 68102], - [68108, 68111], - [68152, 68154], - [68159, 68159], - [119143, 119145], - [119155, 119170], - [119173, 119179], - [119210, 119213], - [119362, 119364], - [917505, 917505], - [917536, 917631], - [917760, 917999] - ]; - } -}); - -// node_modules/wcwidth/index.js -var require_wcwidth = __commonJS({ - "node_modules/wcwidth/index.js"(exports, module) { - "use strict"; - var defaults = require_defaults(); - var combining = require_combining(); - var DEFAULTS = { - nul: 0, - control: 0 - }; - module.exports = function wcwidth3(str) { - return wcswidth(str, DEFAULTS); - }; - module.exports.config = function(opts) { - opts = defaults(opts || {}, DEFAULTS); - return function wcwidth3(str) { - return wcswidth(str, opts); - }; - }; - function wcswidth(str, opts) { - if (typeof str !== "string") - return wcwidth2(str, opts); - var s = 0; - for (var i = 0; i < str.length; i++) { - var n = wcwidth2(str.charCodeAt(i), opts); - if (n < 0) - return -1; - s += n; - } - return s; - } - function wcwidth2(ucs, opts) { - if (ucs === 0) - return opts.nul; - if (ucs < 32 || ucs >= 127 && ucs < 160) - return opts.control; - if (bisearch(ucs)) - return 0; - return 1 + (ucs >= 4352 && (ucs <= 4447 || // Hangul Jamo init. consonants - ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || // CJK ... Yi - ucs >= 44032 && ucs <= 55203 || // Hangul Syllables - ucs >= 63744 && ucs <= 64255 || // CJK Compatibility Ideographs - ucs >= 65040 && ucs <= 65049 || // Vertical forms - ucs >= 65072 && ucs <= 65135 || // CJK Compatibility Forms - ucs >= 65280 && ucs <= 65376 || // Fullwidth Forms - ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141)); - } - function bisearch(ucs) { - var min = 0; - var max = combining.length - 1; - var mid; - if (ucs < combining[0][0] || ucs > combining[max][1]) - return false; - while (max >= min) { - mid = Math.floor((min + max) / 2); - if (ucs > combining[mid][1]) - min = mid + 1; - else if (ucs < combining[mid][0]) - max = mid - 1; - else - return true; - } - return false; - } - } -}); // node_modules/dashify/index.js var require_dashify = __commonJS({ @@ -656,27 +290,93 @@ var require_minimist = __commonJS({ } }); -// node_modules/diff/lib/diff/base.js -var require_base = __commonJS({ - "node_modules/diff/lib/diff/base.js"(exports) { +// node_modules/fast-json-stable-stringify/index.js +var require_fast_json_stable_stringify = __commonJS({ + "node_modules/fast-json-stable-stringify/index.js"(exports, module) { "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports["default"] = Diff; - function Diff() { - } - Diff.prototype = { - /*istanbul ignore start*/ - /*istanbul ignore end*/ - diff: function diff2(oldString, newString) { - var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - var callback = options.callback; - if (typeof options === "function") { - callback = options; - options = {}; - } - this.options = options; + module.exports = function(data, opts) { + if (!opts) + opts = {}; + if (typeof opts === "function") + opts = { cmp: opts }; + var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false; + var cmp = opts.cmp && /* @__PURE__ */ function(f) { + return function(node) { + return function(a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + }(opts.cmp); + var seen = []; + return function stringify4(node) { + if (node && node.toJSON && typeof node.toJSON === "function") { + node = node.toJSON(); + } + if (node === void 0) + return; + if (typeof node == "number") + return isFinite(node) ? "" + node : "null"; + if (typeof node !== "object") + return JSON.stringify(node); + var i, out; + if (Array.isArray(node)) { + out = "["; + for (i = 0; i < node.length; i++) { + if (i) + out += ","; + out += stringify4(node[i]) || "null"; + } + return out + "]"; + } + if (node === null) + return "null"; + if (seen.indexOf(node) !== -1) { + if (cycles) + return JSON.stringify("__cycle__"); + throw new TypeError("Converting circular structure to JSON"); + } + var seenIndex = seen.push(node) - 1; + var keys = Object.keys(node).sort(cmp && cmp(node)); + out = ""; + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify4(node[key]); + if (!value) + continue; + if (out) + out += ","; + out += JSON.stringify(key) + ":" + value; + } + seen.splice(seenIndex, 1); + return "{" + out + "}"; + }(data); + }; + } +}); + +// node_modules/diff/lib/diff/base.js +var require_base = __commonJS({ + "node_modules/diff/lib/diff/base.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports["default"] = Diff; + function Diff() { + } + Diff.prototype = { + /*istanbul ignore start*/ + /*istanbul ignore end*/ + diff: function diff2(oldString, newString) { + var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; + var callback = options.callback; + if (typeof options === "function") { + callback = options; + options = {}; + } + this.options = options; var self = this; function done(value) { if (callback) { @@ -1371,23 +1071,19 @@ var require_src = __commonJS({ return void 0; } if (isArray) { - const result = []; - for (let row of data) { + return data.map((row, index) => { if (typeof row === "string") { row = this.opts.deserialize(row); } if (row === void 0 || row === null) { - result.push(void 0); - continue; + return void 0; } if (typeof row.expires === "number" && Date.now() > row.expires) { - this.delete(key).then(() => void 0); - result.push(void 0); - } else { - result.push(options && options.raw ? row : row.value); + this.delete(key[index]).then(() => void 0); + return void 0; } - } - return result; + return options && options.raw ? row : row.value; + }); } if (typeof data.expires === "number" && Date.now() > data.expires) { return this.delete(key).then(() => void 0); @@ -3963,9 +3659,9 @@ var require_glob = __commonJS({ } }); -// node_modules/rimraf/rimraf.js +// node_modules/flat-cache/node_modules/rimraf/rimraf.js var require_rimraf = __commonJS({ - "node_modules/rimraf/rimraf.js"(exports, module) { + "node_modules/flat-cache/node_modules/rimraf/rimraf.js"(exports, module) { var assert = __require("assert"); var path10 = __require("path"); var fs6 = __require("fs"); @@ -4704,682 +4400,234 @@ var require_cache2 = __commonJS({ } }); -// node_modules/fast-json-stable-stringify/index.js -var require_fast_json_stable_stringify = __commonJS({ - "node_modules/fast-json-stable-stringify/index.js"(exports, module) { - "use strict"; - module.exports = function(data, opts) { - if (!opts) - opts = {}; - if (typeof opts === "function") - opts = { cmp: opts }; - var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false; - var cmp = opts.cmp && function(f) { - return function(node) { - return function(a, b) { - var aobj = { key: a, value: node[a] }; - var bobj = { key: b, value: node[b] }; - return f(aobj, bobj); - }; - }; - }(opts.cmp); - var seen = []; - return function stringify4(node) { - if (node && node.toJSON && typeof node.toJSON === "function") { - node = node.toJSON(); - } - if (node === void 0) - return; - if (typeof node == "number") - return isFinite(node) ? "" + node : "null"; - if (typeof node !== "object") - return JSON.stringify(node); - var i, out; - if (Array.isArray(node)) { - out = "["; - for (i = 0; i < node.length; i++) { - if (i) - out += ","; - out += stringify4(node[i]) || "null"; - } - return out + "]"; - } - if (node === null) - return "null"; - if (seen.indexOf(node) !== -1) { - if (cycles) - return JSON.stringify("__cycle__"); - throw new TypeError("Converting circular structure to JSON"); - } - var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); - out = ""; - for (i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify4(node[key]); - if (!value) - continue; - if (out) - out += ","; - out += JSON.stringify(key) + ":" + value; - } - seen.splice(seenIndex, 1); - return "{" + out + "}"; - }(data); - }; - } -}); - -// src/cli/index.js -import * as prettier2 from "../index.mjs"; - -// scripts/build/shims/string-replace-all.js -var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => { - if (isOptionalObject && (original === void 0 || original === null)) { - return; - } - if (original.replaceAll) { - return original.replaceAll(pattern, replacement); - } - if (pattern.global) { - return original.replace(pattern, replacement); - } - return original.split(pattern).join(replacement); -}; -var string_replace_all_default = stringReplaceAll; - -// src/cli/logger.js -import readline from "readline"; - -// node_modules/chalk/source/vendor/ansi-styles/index.js -var ANSI_BACKGROUND_OFFSET = 10; -var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`; -var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`; -var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`; -var styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - overline: [53, 55], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - // Bright color - blackBright: [90, 39], - gray: [90, 39], - // Alias of `blackBright` - grey: [90, 39], - // Alias of `blackBright` - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - // Bright color - bgBlackBright: [100, 49], - bgGray: [100, 49], - // Alias of `bgBlackBright` - bgGrey: [100, 49], - // Alias of `bgBlackBright` - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } -}; -var modifierNames = Object.keys(styles.modifier); -var foregroundColorNames = Object.keys(styles.color); -var backgroundColorNames = Object.keys(styles.bgColor); -var colorNames = [...foregroundColorNames, ...backgroundColorNames]; -function assembleStyles() { - const codes = /* @__PURE__ */ new Map(); - for (const [groupName, group] of Object.entries(styles)) { - for (const [styleName, style] of Object.entries(group)) { - styles[styleName] = { - open: `\x1B[${style[0]}m`, - close: `\x1B[${style[1]}m` - }; - group[styleName] = styles[styleName]; - codes.set(style[0], style[1]); - } - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); - } - Object.defineProperty(styles, "codes", { - value: codes, - enumerable: false - }); - styles.color.close = "\x1B[39m"; - styles.bgColor.close = "\x1B[49m"; - styles.color.ansi = wrapAnsi16(); - styles.color.ansi256 = wrapAnsi256(); - styles.color.ansi16m = wrapAnsi16m(); - styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); - styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); - styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); - Object.defineProperties(styles, { - rgbToAnsi256: { - value(red, green, blue) { - if (red === green && green === blue) { - if (red < 8) { - return 16; - } - if (red > 248) { - return 231; - } - return Math.round((red - 8) / 247 * 24) + 232; - } - return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5); - }, - enumerable: false - }, - hexToRgb: { - value(hex) { - const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); - if (!matches) { - return [0, 0, 0]; - } - let [colorString] = matches; - if (colorString.length === 3) { - colorString = [...colorString].map((character) => character + character).join(""); - } - const integer = Number.parseInt(colorString, 16); - return [ - /* eslint-disable no-bitwise */ - integer >> 16 & 255, - integer >> 8 & 255, - integer & 255 - /* eslint-enable no-bitwise */ - ]; - }, - enumerable: false - }, - hexToAnsi256: { - value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)), - enumerable: false - }, - ansi256ToAnsi: { - value(code) { - if (code < 8) { - return 30 + code; - } - if (code < 16) { - return 90 + (code - 8); - } - let red; - let green; - let blue; - if (code >= 232) { - red = ((code - 232) * 10 + 8) / 255; - green = red; - blue = red; - } else { - code -= 16; - const remainder = code % 36; - red = Math.floor(code / 36) / 5; - green = Math.floor(remainder / 6) / 5; - blue = remainder % 6 / 5; - } - const value = Math.max(red, green, blue) * 2; - if (value === 0) { - return 30; - } - let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red)); - if (value === 2) { - result += 60; - } - return result; - }, - enumerable: false - }, - rgbToAnsi: { - value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), - enumerable: false - }, - hexToAnsi: { - value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), - enumerable: false - } - }); - return styles; -} -var ansiStyles = assembleStyles(); -var ansi_styles_default = ansiStyles; - -// node_modules/chalk/source/vendor/supports-color/index.js -import process2 from "process"; -import os from "os"; -import tty from "tty"; -function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) { - const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; - const position = argv.indexOf(prefix + flag); - const terminatorPosition = argv.indexOf("--"); - return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); -} -var { env } = process2; -var flagForceColor; -if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) { - flagForceColor = 0; -} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) { - flagForceColor = 1; -} -function envForceColor() { - if ("FORCE_COLOR" in env) { - if (env.FORCE_COLOR === "true") { - return 1; - } - if (env.FORCE_COLOR === "false") { - return 0; - } - return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); - } -} -function translateLevel(level) { - if (level === 0) { - return false; - } - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} -function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) { - const noFlagForceColor = envForceColor(); - if (noFlagForceColor !== void 0) { - flagForceColor = noFlagForceColor; - } - const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; - if (forceColor === 0) { - return 0; - } - if (sniffFlags) { - if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) { - return 3; - } - if (hasFlag("color=256")) { - return 2; - } - } - if ("TF_BUILD" in env && "AGENT_NAME" in env) { - return 1; - } - if (haveStream && !streamIsTTY && forceColor === void 0) { - return 0; - } - const min = forceColor || 0; - if (env.TERM === "dumb") { - return min; - } - if (process2.platform === "win32") { - const osRelease = os.release().split("."); - if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - return 1; - } - if ("CI" in env) { - if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) { - return 3; - } - if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") { - return 1; - } - return min; - } - if ("TEAMCITY_VERSION" in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - if (env.COLORTERM === "truecolor") { - return 3; - } - if (env.TERM === "xterm-kitty") { - return 3; - } - if ("TERM_PROGRAM" in env) { - const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10); - switch (env.TERM_PROGRAM) { - case "iTerm.app": { - return version2 >= 3 ? 3 : 2; - } - case "Apple_Terminal": { - return 2; - } - } - } - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - if ("COLORTERM" in env) { - return 1; - } - return min; -} -function createSupportsColor(stream, options = {}) { - const level = _supportsColor(stream, { - streamIsTTY: stream && stream.isTTY, - ...options - }); - return translateLevel(level); -} -var supportsColor = { - stdout: createSupportsColor({ isTTY: tty.isatty(1) }), - stderr: createSupportsColor({ isTTY: tty.isatty(2) }) -}; -var supports_color_default = supportsColor; - -// node_modules/chalk/source/utilities.js -function stringReplaceAll2(string, substring, replacer) { - let index = string.indexOf(substring); - if (index === -1) { - return string; - } - const substringLength = substring.length; - let endIndex = 0; - let returnValue = ""; - do { - returnValue += string.slice(endIndex, index) + substring + replacer; - endIndex = index + substringLength; - index = string.indexOf(substring, endIndex); - } while (index !== -1); - returnValue += string.slice(endIndex); - return returnValue; -} -function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) { - let endIndex = 0; - let returnValue = ""; - do { - const gotCR = string[index - 1] === "\r"; - returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix; - endIndex = index + 1; - index = string.indexOf("\n", endIndex); - } while (index !== -1); - returnValue += string.slice(endIndex); - return returnValue; -} - -// node_modules/chalk/source/index.js -var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default; -var GENERATOR = Symbol("GENERATOR"); -var STYLER = Symbol("STYLER"); -var IS_EMPTY = Symbol("IS_EMPTY"); -var levelMapping = [ - "ansi", - "ansi", - "ansi256", - "ansi16m" -]; -var styles2 = /* @__PURE__ */ Object.create(null); -var applyOptions = (object, options = {}) => { - if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { - throw new Error("The `level` option should be an integer from 0 to 3"); - } - const colorLevel = stdoutColor ? stdoutColor.level : 0; - object.level = options.level === void 0 ? colorLevel : options.level; -}; -var chalkFactory = (options) => { - const chalk2 = (...strings) => strings.join(" "); - applyOptions(chalk2, options); - Object.setPrototypeOf(chalk2, createChalk.prototype); - return chalk2; -}; -function createChalk(options) { - return chalkFactory(options); -} -Object.setPrototypeOf(createChalk.prototype, Function.prototype); -for (const [styleName, style] of Object.entries(ansi_styles_default)) { - styles2[styleName] = { - get() { - const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]); - Object.defineProperty(this, styleName, { value: builder }); - return builder; - } - }; -} -styles2.visible = { - get() { - const builder = createBuilder(this, this[STYLER], true); - Object.defineProperty(this, "visible", { value: builder }); - return builder; - } -}; -var getModelAnsi = (model, level, type, ...arguments_) => { - if (model === "rgb") { - if (level === "ansi16m") { - return ansi_styles_default[type].ansi16m(...arguments_); - } - if (level === "ansi256") { - return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_)); - } - return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_)); - } - if (model === "hex") { - return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_)); - } - return ansi_styles_default[type][model](...arguments_); -}; -var usedModels = ["rgb", "hex", "ansi256"]; -for (const model of usedModels) { - styles2[model] = { - get() { - const { level } = this; - return function(...arguments_) { - const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]); - return createBuilder(this, styler, this[IS_EMPTY]); - }; - } - }; - const bgModel = "bg" + model[0].toUpperCase() + model.slice(1); - styles2[bgModel] = { - get() { - const { level } = this; - return function(...arguments_) { - const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]); - return createBuilder(this, styler, this[IS_EMPTY]); - }; - } - }; -} -var proto = Object.defineProperties(() => { -}, { - ...styles2, - level: { - enumerable: true, - get() { - return this[GENERATOR].level; - }, - set(level) { - this[GENERATOR].level = level; - } +// node_modules/wcwidth.js/combining.js +var require_combining = __commonJS({ + "node_modules/wcwidth.js/combining.js"(exports, module) { + module.exports = [ + [768, 879], + [1155, 1158], + [1160, 1161], + [1425, 1469], + [1471, 1471], + [1473, 1474], + [1476, 1477], + [1479, 1479], + [1536, 1539], + [1552, 1557], + [1611, 1630], + [1648, 1648], + [1750, 1764], + [1767, 1768], + [1770, 1773], + [1807, 1807], + [1809, 1809], + [1840, 1866], + [1958, 1968], + [2027, 2035], + [2305, 2306], + [2364, 2364], + [2369, 2376], + [2381, 2381], + [2385, 2388], + [2402, 2403], + [2433, 2433], + [2492, 2492], + [2497, 2500], + [2509, 2509], + [2530, 2531], + [2561, 2562], + [2620, 2620], + [2625, 2626], + [2631, 2632], + [2635, 2637], + [2672, 2673], + [2689, 2690], + [2748, 2748], + [2753, 2757], + [2759, 2760], + [2765, 2765], + [2786, 2787], + [2817, 2817], + [2876, 2876], + [2879, 2879], + [2881, 2883], + [2893, 2893], + [2902, 2902], + [2946, 2946], + [3008, 3008], + [3021, 3021], + [3134, 3136], + [3142, 3144], + [3146, 3149], + [3157, 3158], + [3260, 3260], + [3263, 3263], + [3270, 3270], + [3276, 3277], + [3298, 3299], + [3393, 3395], + [3405, 3405], + [3530, 3530], + [3538, 3540], + [3542, 3542], + [3633, 3633], + [3636, 3642], + [3655, 3662], + [3761, 3761], + [3764, 3769], + [3771, 3772], + [3784, 3789], + [3864, 3865], + [3893, 3893], + [3895, 3895], + [3897, 3897], + [3953, 3966], + [3968, 3972], + [3974, 3975], + [3984, 3991], + [3993, 4028], + [4038, 4038], + [4141, 4144], + [4146, 4146], + [4150, 4151], + [4153, 4153], + [4184, 4185], + [4448, 4607], + [4959, 4959], + [5906, 5908], + [5938, 5940], + [5970, 5971], + [6002, 6003], + [6068, 6069], + [6071, 6077], + [6086, 6086], + [6089, 6099], + [6109, 6109], + [6155, 6157], + [6313, 6313], + [6432, 6434], + [6439, 6440], + [6450, 6450], + [6457, 6459], + [6679, 6680], + [6912, 6915], + [6964, 6964], + [6966, 6970], + [6972, 6972], + [6978, 6978], + [7019, 7027], + [7616, 7626], + [7678, 7679], + [8203, 8207], + [8234, 8238], + [8288, 8291], + [8298, 8303], + [8400, 8431], + [12330, 12335], + [12441, 12442], + [43014, 43014], + [43019, 43019], + [43045, 43046], + [64286, 64286], + [65024, 65039], + [65056, 65059], + [65279, 65279], + [65529, 65531], + [68097, 68099], + [68101, 68102], + [68108, 68111], + [68152, 68154], + [68159, 68159], + [119143, 119145], + [119155, 119170], + [119173, 119179], + [119210, 119213], + [119362, 119364], + [917505, 917505], + [917536, 917631], + [917760, 917999] + ]; } }); -var createStyler = (open, close, parent) => { - let openAll; - let closeAll; - if (parent === void 0) { - openAll = open; - closeAll = close; - } else { - openAll = parent.openAll + open; - closeAll = close + parent.closeAll; - } - return { - open, - close, - openAll, - closeAll, - parent - }; -}; -var createBuilder = (self, _styler, _isEmpty) => { - const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" ")); - Object.setPrototypeOf(builder, proto); - builder[GENERATOR] = self; - builder[STYLER] = _styler; - builder[IS_EMPTY] = _isEmpty; - return builder; -}; -var applyStyle = (self, string) => { - if (self.level <= 0 || !string) { - return self[IS_EMPTY] ? "" : string; - } - let styler = self[STYLER]; - if (styler === void 0) { - return string; - } - const { openAll, closeAll } = styler; - if (string.includes("\x1B")) { - while (styler !== void 0) { - string = stringReplaceAll2(string, styler.close, styler.open); - styler = styler.parent; - } - } - const lfIndex = string.indexOf("\n"); - if (lfIndex !== -1) { - string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); - } - return openAll + string + closeAll; -}; -Object.defineProperties(createChalk.prototype, styles2); -var chalk = createChalk(); -var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 }); -var source_default = chalk; - -// node_modules/ansi-regex/index.js -function ansiRegex({ onlyFirst = false } = {}) { - const pattern = [ - "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", - "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))" - ].join("|"); - return new RegExp(pattern, onlyFirst ? void 0 : "g"); -} - -// node_modules/strip-ansi/index.js -var regex = ansiRegex(); -function stripAnsi(string) { - if (typeof string !== "string") { - throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); - } - return string.replace(regex, ""); -} -// src/cli/logger.js -var import_wcwidth = __toESM(require_wcwidth(), 1); -var countLines = (stream, text) => { - const columns = stream.columns || 80; - let lineCount = 0; - for (const line of stripAnsi(text).split("\n")) { - lineCount += Math.max(1, Math.ceil((0, import_wcwidth.default)(line) / columns)); - } - return lineCount; -}; -var clear = (stream, text) => () => { - const lineCount = countLines(stream, text); - for (let line = 0; line < lineCount; line++) { - if (line > 0) { - readline.moveCursor(stream, 0, -1); - } - readline.clearLine(stream, 0); - readline.cursorTo(stream, 0); - } -}; -var emptyLogResult = { - clear() { - } -}; -function createLogger(logLevel = "log") { - return { - logLevel, - warn: createLogFunc("warn", "yellow"), - error: createLogFunc("error", "red"), - debug: createLogFunc("debug", "blue"), - log: createLogFunc("log") - }; - function createLogFunc(loggerName, color) { - if (!shouldLog(loggerName)) { - return () => emptyLogResult; - } - const stream = process[loggerName === "log" ? "stdout" : "stderr"]; - const chalkInstance = loggerName === "log" ? source_default : chalkStderr; - const prefix = color ? `[${chalkInstance[color](loggerName)}] ` : ""; - return (message, options) => { - options = { - newline: true, - clearable: false, - ...options - }; - message = string_replace_all_default( - /* isOptionalObject*/ - false, - message, - /^/gm, - prefix - ) + (options.newline ? "\n" : ""); - stream.write(message); - if (options.clearable) { - return { - clear: clear(stream, message) - }; - } - }; - } - function shouldLog(loggerName) { - switch (logLevel) { - case "silent": - return false; - case "debug": - if (loggerName === "debug") { - return true; - } - case "log": - if (loggerName === "log") { - return true; - } - case "warn": - if (loggerName === "warn") { +// node_modules/wcwidth.js/index.js +var require_wcwidth = __commonJS({ + "node_modules/wcwidth.js/index.js"(exports, module) { + var combining = require_combining(); + var DEFAULTS = { + nul: 0, + control: 0 + }; + function bisearch(ucs) { + let min = 0; + let max = combining.length - 1; + let mid; + if (ucs < combining[0][0] || ucs > combining[max][1]) + return false; + while (max >= min) { + mid = Math.floor((min + max) / 2); + if (ucs > combining[mid][1]) + min = mid + 1; + else if (ucs < combining[mid][0]) + max = mid - 1; + else return true; + } + return false; + } + function wcwidth2(ucs, opts) { + if (ucs === 0) + return opts.nul; + if (ucs < 32 || ucs >= 127 && ucs < 160) + return opts.control; + if (bisearch(ucs)) + return 0; + return 1 + (ucs >= 4352 && (ucs <= 4447 || // Hangul Jamo init. consonants + ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || // CJK ... Yi + ucs >= 44032 && ucs <= 55203 || // Hangul Syllables + ucs >= 63744 && ucs <= 64255 || // CJK Compatibility Ideographs + ucs >= 65040 && ucs <= 65049 || // Vertical forms + ucs >= 65072 && ucs <= 65135 || // CJK Compatibility Forms + ucs >= 65280 && ucs <= 65376 || // Fullwidth Forms + ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141)); + } + function wcswidth(str, opts) { + let h; + let l; + let s = 0; + let n; + if (typeof str !== "string") + return wcwidth2(str, opts); + for (let i = 0; i < str.length; i++) { + h = str.charCodeAt(i); + if (h >= 55296 && h <= 56319) { + l = str.charCodeAt(++i); + if (l >= 56320 && l <= 57343) { + h = (h - 55296) * 1024 + (l - 56320) + 65536; + } else { + i--; + } } - case "error": - return loggerName === "error"; + n = wcwidth2(h, opts); + if (n < 0) + return -1; + s += n; + } + return s; } + module.exports = (str) => wcswidth(str, DEFAULTS); + module.exports.config = (opts = {}) => { + opts = { + ...DEFAULTS, + ...opts + }; + return (str) => wcswidth(str, opts); + }; } -} -var logger_default = createLogger; +}); + +// src/cli/index.js +import * as prettier2 from "../index.mjs"; // scripts/build/shims/at.js var at = (isOptionalObject, object, index) => { @@ -5397,20 +4645,6 @@ var at_default = at; var import_dashify = __toESM(require_dashify(), 1); import { getSupportInfo } from "../index.mjs"; -// src/cli/prettier-internal.js -import { __internal as sharedWithCli } from "../index.mjs"; -var { - errors, - optionCategories, - createIsIgnoredFunction, - formatOptionsHiddenDefaults, - normalizeOptions, - getSupportInfoWithoutPlugins, - normalizeOptionSettings, - vnopts, - fastGlob -} = sharedWithCli; - // src/cli/cli-options.evaluate.js var cli_options_evaluate_default = { "cache": { @@ -5566,297 +4800,816 @@ var cli_options_evaluate_default = { "description": "Print Prettier version.", "type": "boolean" }, - "withNodeModules": { - "category": "Config", - "description": "Process files inside 'node_modules' directory.", - "type": "boolean" + "withNodeModules": { + "category": "Config", + "description": "Process files inside 'node_modules' directory.", + "type": "boolean" + }, + "write": { + "alias": "w", + "category": "Output", + "description": "Edit files in-place. (Beware!)", + "type": "boolean" + } +}; + +// src/cli/prettier-internal.js +import { __internal as sharedWithCli } from "../index.mjs"; +var { + errors, + optionCategories, + createIsIgnoredFunction, + formatOptionsHiddenDefaults, + normalizeOptions, + getSupportInfoWithoutPlugins, + normalizeOptionSettings, + vnopts, + fastGlob, + mockable +} = sharedWithCli; + +// src/cli/options/get-context-options.js +var detailedCliOptions = normalizeOptionSettings(cli_options_evaluate_default).map( + (option) => normalizeDetailedOption(option) +); +function apiOptionToCliOption(apiOption) { + const cliOption = { + ...apiOption, + description: apiOption.cliDescription ?? apiOption.description, + category: apiOption.cliCategory ?? optionCategories.CATEGORY_FORMAT, + forwardToApi: apiOption.name + }; + if (apiOption.deprecated) { + delete cliOption.forwardToApi; + delete cliOption.description; + delete cliOption.oppositeDescription; + cliOption.deprecated = true; + } + return normalizeDetailedOption(cliOption); +} +function normalizeDetailedOption(option) { + var _a; + return { + category: optionCategories.CATEGORY_OTHER, + ...option, + name: option.cliName ?? (0, import_dashify.default)(option.name), + choices: (_a = option.choices) == null ? void 0 : _a.map((choice) => { + const newChoice = { + description: "", + deprecated: false, + ...typeof choice === "object" ? choice : { value: choice } + }; + if (newChoice.value === true) { + newChoice.value = ""; + } + return newChoice; + }) + }; +} +function supportInfoToContextOptions({ options: supportOptions, languages }) { + const detailedOptions = [ + ...detailedCliOptions, + ...supportOptions.map((apiOption) => apiOptionToCliOption(apiOption)) + ]; + return { + supportOptions, + languages, + detailedOptions + }; +} +async function getContextOptions(plugins) { + const supportInfo = await getSupportInfo({ + showDeprecated: true, + plugins + }); + return supportInfoToContextOptions(supportInfo); +} +function getContextOptionsWithoutPlugins() { + const supportInfo = getSupportInfoWithoutPlugins(); + return supportInfoToContextOptions(supportInfo); +} + +// scripts/build/shims/string-replace-all.js +var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => { + if (isOptionalObject && (original === void 0 || original === null)) { + return; + } + if (original.replaceAll) { + return original.replaceAll(pattern, replacement); + } + if (pattern.global) { + return original.replace(pattern, replacement); + } + return original.split(pattern).join(replacement); +}; +var string_replace_all_default = stringReplaceAll; + +// node_modules/camelcase/index.js +var UPPERCASE = /[\p{Lu}]/u; +var LOWERCASE = /[\p{Ll}]/u; +var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu; +var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u; +var SEPARATORS = /[_.\- ]+/; +var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source); +var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu"); +var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu"); +var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + let isLastLastCharPreserved = false; + for (let index = 0; index < string.length; index++) { + const character = string[index]; + isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true; + if (isLastCharLower && UPPERCASE.test(character)) { + string = string.slice(0, index) + "-" + string.slice(index); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + index++; + } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) { + string = string.slice(0, index - 1) + "-" + string.slice(index - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character; + } + } + return string; +}; +var preserveConsecutiveUppercase = (input, toLowerCase) => { + LEADING_CAPITAL.lastIndex = 0; + return string_replace_all_default( + /* isOptionalObject*/ + false, + input, + LEADING_CAPITAL, + (match) => toLowerCase(match) + ); +}; +var postProcess = (input, toUpperCase) => { + SEPARATORS_AND_IDENTIFIER.lastIndex = 0; + NUMBERS_AND_IDENTIFIER.lastIndex = 0; + return string_replace_all_default( + /* isOptionalObject*/ + false, + string_replace_all_default( + /* isOptionalObject*/ + false, + input, + NUMBERS_AND_IDENTIFIER, + (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match) + ), + SEPARATORS_AND_IDENTIFIER, + (_, identifier) => toUpperCase(identifier) + ); +}; +function camelCase(input, options) { + if (!(typeof input === "string" || Array.isArray(input))) { + throw new TypeError("Expected the input to be `string | string[]`"); + } + options = { + pascalCase: false, + preserveConsecutiveUppercase: false, + ...options + }; + if (Array.isArray(input)) { + input = input.map((x) => x.trim()).filter((x) => x.length).join("-"); + } else { + input = input.trim(); + } + if (input.length === 0) { + return ""; + } + const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale); + const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale); + if (input.length === 1) { + if (SEPARATORS.test(input)) { + return ""; + } + return options.pascalCase ? toUpperCase(input) : toLowerCase(input); + } + const hasUpperCase = input !== toLowerCase(input); + if (hasUpperCase) { + input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase); + } + input = input.replace(LEADING_SEPARATORS, ""); + input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input); + if (options.pascalCase) { + input = toUpperCase(input.charAt(0)) + input.slice(1); + } + return postProcess(input, toUpperCase); +} + +// src/cli/utils.js +import fs from "fs/promises"; +import path from "path"; + +// node_modules/sdbm/index.js +function sdbm(string) { + let hash = 0; + for (let i = 0; i < string.length; i++) { + hash = string.charCodeAt(i) + (hash << 6) + (hash << 16) - hash; + } + return hash >>> 0; +} + +// src/cli/utils.js +import { __internal as sharedWithCli2 } from "../index.mjs"; +var printToScreen = console.log.bind(console); +function groupBy(array2, iteratee) { + const result = /* @__PURE__ */ Object.create(null); + for (const value of array2) { + const key = iteratee(value); + if (Array.isArray(result[key])) { + result[key].push(value); + } else { + result[key] = [value]; + } + } + return result; +} +function pick(object, keys) { + const entries = keys.map((key) => [key, object[key]]); + return Object.fromEntries(entries); +} +function createHash(source) { + return String(sdbm(source)); +} +async function statSafe(filePath) { + try { + return await fs.stat(filePath); + } catch (error) { + if (error.code !== "ENOENT") { + throw error; + } + } +} +async function lstatSafe(filePath) { + try { + return await fs.lstat(filePath); + } catch (error) { + if (error.code !== "ENOENT") { + throw error; + } + } +} +function isJson(value) { + try { + JSON.parse(value); + return true; + } catch { + return false; + } +} +var normalizeToPosix = path.sep === "\\" ? (filepath) => string_replace_all_default( + /* isOptionalObject*/ + false, + filepath, + "\\", + "/" +) : (filepath) => filepath; +var { + isNonEmptyArray, + partition, + omit +} = sharedWithCli2.utils; + +// src/cli/options/create-minimist-options.js +function createMinimistOptions(detailedOptions) { + const booleanNames = []; + const stringNames = []; + const defaultValues = {}; + for (const option of detailedOptions) { + const { name, alias, type } = option; + const names = type === "boolean" ? booleanNames : stringNames; + names.push(name); + if (alias) { + names.push(alias); + } + if (!option.deprecated && (!option.forwardToApi || name === "plugin") && option.default !== void 0) { + defaultValues[option.name] = option.default; + } + } + return { + // we use vnopts' AliasSchema to handle aliases for better error messages + alias: {}, + boolean: booleanNames, + string: stringNames, + default: defaultValues + }; +} + +// src/cli/options/minimist.js +var import_minimist = __toESM(require_minimist(), 1); +var PLACEHOLDER = null; +function minimistParse(args, options) { + const boolean = options.boolean ?? []; + const defaults = options.default ?? {}; + const booleanWithoutDefault = boolean.filter((key) => !(key in defaults)); + const newDefaults = { + ...defaults, + ...Object.fromEntries( + booleanWithoutDefault.map((key) => [key, PLACEHOLDER]) + ) + }; + const parsed = (0, import_minimist.default)(args, { ...options, default: newDefaults }); + return Object.fromEntries( + Object.entries(parsed).filter(([, value]) => value !== PLACEHOLDER) + ); +} + +// node_modules/chalk/source/vendor/ansi-styles/index.js +var ANSI_BACKGROUND_OFFSET = 10; +var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`; +var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`; +var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`; +var styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + // Bright color + blackBright: [90, 39], + gray: [90, 39], + // Alias of `blackBright` + grey: [90, 39], + // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] }, - "write": { - "alias": "w", - "category": "Output", - "description": "Edit files in-place. (Beware!)", - "type": "boolean" + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], + // Alias of `bgBlackBright` + bgGrey: [100, 49], + // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] } }; +var modifierNames = Object.keys(styles.modifier); +var foregroundColorNames = Object.keys(styles.color); +var backgroundColorNames = Object.keys(styles.bgColor); +var colorNames = [...foregroundColorNames, ...backgroundColorNames]; +function assembleStyles() { + const codes = /* @__PURE__ */ new Map(); + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\x1B[${style[0]}m`, + close: `\x1B[${style[1]}m` + }; + group[styleName] = styles[styleName]; + codes.set(style[0], style[1]); + } + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + Object.defineProperty(styles, "codes", { + value: codes, + enumerable: false + }); + styles.color.close = "\x1B[39m"; + styles.bgColor.close = "\x1B[49m"; + styles.color.ansi = wrapAnsi16(); + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + Object.defineProperties(styles, { + rgbToAnsi256: { + value(red, green, blue) { + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + if (red > 248) { + return 231; + } + return Math.round((red - 8) / 247 * 24) + 232; + } + return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5); + }, + enumerable: false + }, + hexToRgb: { + value(hex) { + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + let [colorString] = matches; + if (colorString.length === 3) { + colorString = [...colorString].map((character) => character + character).join(""); + } + const integer = Number.parseInt(colorString, 16); + return [ + /* eslint-disable no-bitwise */ + integer >> 16 & 255, + integer >> 8 & 255, + integer & 255 + /* eslint-enable no-bitwise */ + ]; + }, + enumerable: false + }, + hexToAnsi256: { + value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false + }, + ansi256ToAnsi: { + value(code) { + if (code < 8) { + return 30 + code; + } + if (code < 16) { + return 90 + (code - 8); + } + let red; + let green; + let blue; + if (code >= 232) { + red = ((code - 232) * 10 + 8) / 255; + green = red; + blue = red; + } else { + code -= 16; + const remainder = code % 36; + red = Math.floor(code / 36) / 5; + green = Math.floor(remainder / 6) / 5; + blue = remainder % 6 / 5; + } + const value = Math.max(red, green, blue) * 2; + if (value === 0) { + return 30; + } + let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red)); + if (value === 2) { + result += 60; + } + return result; + }, + enumerable: false + }, + rgbToAnsi: { + value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), + enumerable: false + }, + hexToAnsi: { + value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), + enumerable: false + } + }); + return styles; +} +var ansiStyles = assembleStyles(); +var ansi_styles_default = ansiStyles; -// src/cli/options/get-context-options.js -var detailedCliOptions = normalizeOptionSettings(cli_options_evaluate_default).map( - (option) => normalizeDetailedOption(option) -); -function apiOptionToCliOption(apiOption) { - const cliOption = { - ...apiOption, - description: apiOption.cliDescription ?? apiOption.description, - category: apiOption.cliCategory ?? optionCategories.CATEGORY_FORMAT, - forwardToApi: apiOption.name - }; - if (apiOption.deprecated) { - delete cliOption.forwardToApi; - delete cliOption.description; - delete cliOption.oppositeDescription; - cliOption.deprecated = true; - } - return normalizeDetailedOption(cliOption); +// node_modules/chalk/source/vendor/supports-color/index.js +import process2 from "process"; +import os from "os"; +import tty from "tty"; +function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) { + const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf("--"); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); } -function normalizeDetailedOption(option) { - var _a; - return { - category: optionCategories.CATEGORY_OTHER, - ...option, - name: option.cliName ?? (0, import_dashify.default)(option.name), - choices: (_a = option.choices) == null ? void 0 : _a.map((choice) => { - const newChoice = { - description: "", - deprecated: false, - ...typeof choice === "object" ? choice : { value: choice } - }; - if (newChoice.value === true) { - newChoice.value = ""; - } - return newChoice; - }) - }; +var { env } = process2; +var flagForceColor; +if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) { + flagForceColor = 0; +} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) { + flagForceColor = 1; } -function supportInfoToContextOptions({ options: supportOptions, languages }) { - const detailedOptions = [ - ...detailedCliOptions, - ...supportOptions.map((apiOption) => apiOptionToCliOption(apiOption)) - ]; +function envForceColor() { + if ("FORCE_COLOR" in env) { + if (env.FORCE_COLOR === "true") { + return 1; + } + if (env.FORCE_COLOR === "false") { + return 0; + } + return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); + } +} +function translateLevel(level) { + if (level === 0) { + return false; + } return { - supportOptions, - languages, - detailedOptions + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 }; } -async function getContextOptions(plugins) { - const supportInfo = await getSupportInfo({ - showDeprecated: true, - plugins - }); - return supportInfoToContextOptions(supportInfo); -} -function getContextOptionsWithoutPlugins() { - const supportInfo = getSupportInfoWithoutPlugins(); - return supportInfoToContextOptions(supportInfo); -} - -// node_modules/camelcase/index.js -var UPPERCASE = /[\p{Lu}]/u; -var LOWERCASE = /[\p{Ll}]/u; -var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu; -var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u; -var SEPARATORS = /[_.\- ]+/; -var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source); -var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu"); -var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu"); -var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - let isLastLastCharPreserved = false; - for (let index = 0; index < string.length; index++) { - const character = string[index]; - isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true; - if (isLastCharLower && UPPERCASE.test(character)) { - string = string.slice(0, index) + "-" + string.slice(index); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - index++; - } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) { - string = string.slice(0, index - 1) + "-" + string.slice(index - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character; +function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) { + const noFlagForceColor = envForceColor(); + if (noFlagForceColor !== void 0) { + flagForceColor = noFlagForceColor; + } + const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; + if (forceColor === 0) { + return 0; + } + if (sniffFlags) { + if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) { + return 3; + } + if (hasFlag("color=256")) { + return 2; } } - return string; -}; -var preserveConsecutiveUppercase = (input, toLowerCase) => { - LEADING_CAPITAL.lastIndex = 0; - return string_replace_all_default( - /* isOptionalObject*/ - false, - input, - LEADING_CAPITAL, - (match) => toLowerCase(match) - ); -}; -var postProcess = (input, toUpperCase) => { - SEPARATORS_AND_IDENTIFIER.lastIndex = 0; - NUMBERS_AND_IDENTIFIER.lastIndex = 0; - return string_replace_all_default( - /* isOptionalObject*/ - false, - string_replace_all_default( - /* isOptionalObject*/ - false, - input, - NUMBERS_AND_IDENTIFIER, - (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match) - ), - SEPARATORS_AND_IDENTIFIER, - (_, identifier) => toUpperCase(identifier) - ); -}; -function camelCase(input, options) { - if (!(typeof input === "string" || Array.isArray(input))) { - throw new TypeError("Expected the input to be `string | string[]`"); + if ("TF_BUILD" in env && "AGENT_NAME" in env) { + return 1; + } + if (haveStream && !streamIsTTY && forceColor === void 0) { + return 0; + } + const min = forceColor || 0; + if (env.TERM === "dumb") { + return min; + } + if (process2.platform === "win32") { + const osRelease = os.release().split("."); + if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + return 1; + } + if ("CI" in env) { + if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) { + return 3; + } + if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") { + return 1; + } + return min; } - options = { - pascalCase: false, - preserveConsecutiveUppercase: false, - ...options - }; - if (Array.isArray(input)) { - input = input.map((x) => x.trim()).filter((x) => x.length).join("-"); - } else { - input = input.trim(); + if ("TEAMCITY_VERSION" in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } - if (input.length === 0) { - return ""; + if (env.COLORTERM === "truecolor") { + return 3; } - const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale); - const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale); - if (input.length === 1) { - if (SEPARATORS.test(input)) { - return ""; + if (env.TERM === "xterm-kitty") { + return 3; + } + if ("TERM_PROGRAM" in env) { + const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10); + switch (env.TERM_PROGRAM) { + case "iTerm.app": { + return version2 >= 3 ? 3 : 2; + } + case "Apple_Terminal": { + return 2; + } } - return options.pascalCase ? toUpperCase(input) : toLowerCase(input); } - const hasUpperCase = input !== toLowerCase(input); - if (hasUpperCase) { - input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase); + if (/-256(color)?$/i.test(env.TERM)) { + return 2; } - input = input.replace(LEADING_SEPARATORS, ""); - input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input); - if (options.pascalCase) { - input = toUpperCase(input.charAt(0)) + input.slice(1); + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; } - return postProcess(input, toUpperCase); -} - -// src/cli/utils.js -import fs from "fs/promises"; -import path from "path"; - -// node_modules/sdbm/index.js -function sdbm(string) { - let hash = 0; - for (let i = 0; i < string.length; i++) { - hash = string.charCodeAt(i) + (hash << 6) + (hash << 16) - hash; + if ("COLORTERM" in env) { + return 1; } - return hash >>> 0; + return min; +} +function createSupportsColor(stream, options = {}) { + const level = _supportsColor(stream, { + streamIsTTY: stream && stream.isTTY, + ...options + }); + return translateLevel(level); } +var supportsColor = { + stdout: createSupportsColor({ isTTY: tty.isatty(1) }), + stderr: createSupportsColor({ isTTY: tty.isatty(2) }) +}; +var supports_color_default = supportsColor; -// src/cli/utils.js -import { __internal as sharedWithCli2 } from "../index.mjs"; -var printToScreen = console.log.bind(console); -function groupBy(array2, iteratee) { - const result = /* @__PURE__ */ Object.create(null); - for (const value of array2) { - const key = iteratee(value); - if (Array.isArray(result[key])) { - result[key].push(value); - } else { - result[key] = [value]; - } +// node_modules/chalk/source/utilities.js +function stringReplaceAll2(string, substring, replacer) { + let index = string.indexOf(substring); + if (index === -1) { + return string; } - return result; + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ""; + do { + returnValue += string.slice(endIndex, index) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + returnValue += string.slice(endIndex); + return returnValue; } -function pick(object, keys) { - const entries = keys.map((key) => [key, object[key]]); - return Object.fromEntries(entries); +function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) { + let endIndex = 0; + let returnValue = ""; + do { + const gotCR = string[index - 1] === "\r"; + returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix; + endIndex = index + 1; + index = string.indexOf("\n", endIndex); + } while (index !== -1); + returnValue += string.slice(endIndex); + return returnValue; } -function createHash(source) { - return String(sdbm(source)); + +// node_modules/chalk/source/index.js +var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default; +var GENERATOR = Symbol("GENERATOR"); +var STYLER = Symbol("STYLER"); +var IS_EMPTY = Symbol("IS_EMPTY"); +var levelMapping = [ + "ansi", + "ansi", + "ansi256", + "ansi16m" +]; +var styles2 = /* @__PURE__ */ Object.create(null); +var applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error("The `level` option should be an integer from 0 to 3"); + } + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === void 0 ? colorLevel : options.level; +}; +var chalkFactory = (options) => { + const chalk2 = (...strings) => strings.join(" "); + applyOptions(chalk2, options); + Object.setPrototypeOf(chalk2, createChalk.prototype); + return chalk2; +}; +function createChalk(options) { + return chalkFactory(options); } -async function statSafe(filePath) { - try { - return await fs.stat(filePath); - } catch (error) { - if (error.code !== "ENOENT") { - throw error; +Object.setPrototypeOf(createChalk.prototype, Function.prototype); +for (const [styleName, style] of Object.entries(ansi_styles_default)) { + styles2[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]); + Object.defineProperty(this, styleName, { value: builder }); + return builder; } - } + }; } -async function lstatSafe(filePath) { - try { - return await fs.lstat(filePath); - } catch (error) { - if (error.code !== "ENOENT") { - throw error; +styles2.visible = { + get() { + const builder = createBuilder(this, this[STYLER], true); + Object.defineProperty(this, "visible", { value: builder }); + return builder; + } +}; +var getModelAnsi = (model, level, type, ...arguments_) => { + if (model === "rgb") { + if (level === "ansi16m") { + return ansi_styles_default[type].ansi16m(...arguments_); } + if (level === "ansi256") { + return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_)); + } + return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_)); } -} -function isJson(value) { - try { - JSON.parse(value); - return true; - } catch { - return false; + if (model === "hex") { + return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_)); } -} -var normalizeToPosix = path.sep === "\\" ? (filepath) => string_replace_all_default( - /* isOptionalObject*/ - false, - filepath, - "\\", - "/" -) : (filepath) => filepath; -var { - isNonEmptyArray, - partition, - omit -} = sharedWithCli2.utils; - -// src/cli/options/minimist.js -var import_minimist = __toESM(require_minimist(), 1); -var PLACEHOLDER = null; -function minimistParse(args, options) { - const boolean = options.boolean ?? []; - const defaults = options.default ?? {}; - const booleanWithoutDefault = boolean.filter((key) => !(key in defaults)); - const newDefaults = { - ...defaults, - ...Object.fromEntries( - booleanWithoutDefault.map((key) => [key, PLACEHOLDER]) - ) + return ansi_styles_default[type][model](...arguments_); +}; +var usedModels = ["rgb", "hex", "ansi256"]; +for (const model of usedModels) { + styles2[model] = { + get() { + const { level } = this; + return function(...arguments_) { + const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]); + return createBuilder(this, styler, this[IS_EMPTY]); + }; + } }; - const parsed = (0, import_minimist.default)(args, { ...options, default: newDefaults }); - return Object.fromEntries( - Object.entries(parsed).filter(([, value]) => value !== PLACEHOLDER) - ); -} - -// src/cli/options/create-minimist-options.js -function createMinimistOptions(detailedOptions) { - const booleanNames = []; - const stringNames = []; - const defaultValues = {}; - for (const option of detailedOptions) { - const { name, alias, type } = option; - const names = type === "boolean" ? booleanNames : stringNames; - names.push(name); - if (alias) { - names.push(alias); + const bgModel = "bg" + model[0].toUpperCase() + model.slice(1); + styles2[bgModel] = { + get() { + const { level } = this; + return function(...arguments_) { + const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]); + return createBuilder(this, styler, this[IS_EMPTY]); + }; } - if (!option.deprecated && (!option.forwardToApi || name === "plugin") && option.default !== void 0) { - defaultValues[option.name] = option.default; + }; +} +var proto = Object.defineProperties(() => { +}, { + ...styles2, + level: { + enumerable: true, + get() { + return this[GENERATOR].level; + }, + set(level) { + this[GENERATOR].level = level; } } +}); +var createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === void 0) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } return { - // we use vnopts' AliasSchema to handle aliases for better error messages - alias: {}, - boolean: booleanNames, - string: stringNames, - default: defaultValues + open, + close, + openAll, + closeAll, + parent }; -} +}; +var createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" ")); + Object.setPrototypeOf(builder, proto); + builder[GENERATOR] = self; + builder[STYLER] = _styler; + builder[IS_EMPTY] = _isEmpty; + return builder; +}; +var applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self[IS_EMPTY] ? "" : string; + } + let styler = self[STYLER]; + if (styler === void 0) { + return string; + } + const { openAll, closeAll } = styler; + if (string.includes("\x1B")) { + while (styler !== void 0) { + string = stringReplaceAll2(string, styler.close, styler.open); + styler = styler.parent; + } + } + const lfIndex = string.indexOf("\n"); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } + return openAll + string + closeAll; +}; +Object.defineProperties(createChalk.prototype, styles2); +var chalk = createChalk(); +var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 }); +var source_default = chalk; // node_modules/leven/index.js var array = []; @@ -5973,234 +5726,135 @@ function parseArgv(rawArguments, detailedOptions, logger, keys) { _: (_a = normalized._) == null ? void 0 : _a.map(String), get __raw() { return argv; - } - }; -} -var { detailedOptions: detailedOptionsWithoutPlugins } = getContextOptionsWithoutPlugins(); -function parseArgvWithoutPlugins(rawArguments, logger, keys) { - return parseArgv( - rawArguments, - detailedOptionsWithoutPlugins, - logger, - typeof keys === "string" ? [keys] : keys - ); -} - -// src/cli/context.js -var _stack; -var Context = class { - constructor({ - rawArguments, - logger - }) { - __privateAdd(this, _stack, []); - this.rawArguments = rawArguments; - this.logger = logger; - } - async init() { - const { - rawArguments, - logger - } = this; - const { - plugins - } = parseArgvWithoutPlugins(rawArguments, logger, ["plugin"]); - await this.pushContextPlugins(plugins); - const argv = parseArgv(rawArguments, this.detailedOptions, logger); - this.argv = argv; - this.filePatterns = argv._; - } - /** - * @param {string[]} plugins - */ - async pushContextPlugins(plugins) { - const options = await getContextOptions(plugins); - __privateGet(this, _stack).push(options); - Object.assign(this, options); - } - popContextPlugins() { - __privateGet(this, _stack).pop(); - Object.assign(this, at_default( - /* isOptionalObject*/ - false, - __privateGet(this, _stack), - -1 - )); - } - // eslint-disable-next-line getter-return - get performanceTestFlag() { - const { - debugBenchmark, - debugRepeat - } = this.argv; - if (debugBenchmark) { - return { - name: "--debug-benchmark", - debugBenchmark: true - }; - } - if (debugRepeat > 0) { - return { - name: "--debug-repeat", - debugRepeat - }; - } - const { - PRETTIER_PERF_REPEAT - } = process.env; - if (PRETTIER_PERF_REPEAT && /^\d+$/.test(PRETTIER_PERF_REPEAT)) { - return { - name: "PRETTIER_PERF_REPEAT (environment variable)", - debugRepeat: Number(PRETTIER_PERF_REPEAT) - }; - } - } -}; -_stack = new WeakMap(); -var context_default = Context; - -// src/cli/constants.evaluate.js -var categoryOrder = [ - "Output", - "Format", - "Config", - "Editor", - "Other" -]; -var usageSummary = "Usage: prettier [options] [file/dir/glob ...]\n\nBy default, output is written to stdout.\nStdin is read if it is piped to Prettier and no files are given."; - -// src/cli/usage.js -var OPTION_USAGE_THRESHOLD = 25; -var CHOICE_USAGE_MARGIN = 3; -var CHOICE_USAGE_INDENTATION = 2; -function indent(str, spaces) { - return string_replace_all_default( - /* isOptionalObject*/ - false, - str, - /^/gm, - " ".repeat(spaces) - ); -} -function createDefaultValueDisplay(value) { - return Array.isArray(value) ? `[${value.map(createDefaultValueDisplay).join(", ")}]` : value; -} -function getOptionDefaultValue(context, optionName) { - var _a; - const option = context.detailedOptions.find(({ - name - }) => name === optionName); - if ((option == null ? void 0 : option.default) !== void 0) { - return option.default; - } - const optionCamelName = camelCase(optionName); - return formatOptionsHiddenDefaults[optionCamelName] ?? ((_a = context.supportOptions.find((option2) => !option2.deprecated && option2.name === optionCamelName)) == null ? void 0 : _a.default); -} -function createOptionUsageHeader(option) { - const name = `--${option.name}`; - const alias = option.alias ? `-${option.alias},` : null; - const type = createOptionUsageType(option); - return [alias, name, type].filter(Boolean).join(" "); -} -function createOptionUsageRow(header, content, threshold) { - const separator = header.length >= threshold ? ` -${" ".repeat(threshold)}` : " ".repeat(threshold - header.length); - const description = string_replace_all_default( - /* isOptionalObject*/ - false, - content, - "\n", - ` -${" ".repeat(threshold)}` - ); - return `${header}${separator}${description}`; -} -function createOptionUsageType(option) { - switch (option.type) { - case "boolean": - return null; - case "choice": - return `<${option.choices.filter((choice) => !choice.deprecated).map((choice) => choice.value).join("|")}>`; - default: - return `<${option.type}>`; - } -} -function createChoiceUsages(choices, margin, indentation) { - const activeChoices = choices.filter((choice) => !choice.deprecated); - const threshold = Math.max(0, ...activeChoices.map((choice) => choice.value.length)) + margin; - return activeChoices.map((choice) => indent(createOptionUsageRow(choice.value, choice.description, threshold), indentation)); -} -function createOptionUsage(context, option, threshold) { - const header = createOptionUsageHeader(option); - const optionDefaultValue = getOptionDefaultValue(context, option.name); - return createOptionUsageRow(header, `${option.description}${optionDefaultValue === void 0 ? "" : ` -Defaults to ${createDefaultValueDisplay(optionDefaultValue)}.`}`, threshold); -} -function getOptionsWithOpposites(options) { - const optionsWithOpposites = options.map((option) => [option.description ? option : null, option.oppositeDescription ? { - ...option, - name: `no-${option.name}`, - type: "boolean", - description: option.oppositeDescription - } : null]); - return optionsWithOpposites.flat().filter(Boolean); -} -function createUsage(context) { - const sortedOptions = context.detailedOptions.sort((optionA, optionB) => optionA.name.localeCompare(optionB.name)); - const options = getOptionsWithOpposites(sortedOptions).filter( - // remove unnecessary option (e.g. `semi`, `color`, etc.), which is only used for --help - (option) => !(option.type === "boolean" && option.oppositeDescription && !option.name.startsWith("no-")) - ); - const groupedOptions = groupBy(options, (option) => option.category); - const firstCategories = categoryOrder.slice(0, -1); - const lastCategories = categoryOrder.slice(-1); - const restCategories = Object.keys(groupedOptions).filter((category) => !categoryOrder.includes(category)); - const allCategories = [...firstCategories, ...restCategories, ...lastCategories]; - const optionsUsage = allCategories.map((category) => { - const categoryOptions = groupedOptions[category].map((option) => createOptionUsage(context, option, OPTION_USAGE_THRESHOLD)).join("\n"); - return `${category} options: - -${indent(categoryOptions, 2)}`; - }); - return [usageSummary, ...optionsUsage, ""].join("\n\n"); + } + }; } -function createPluginDefaults(pluginDefaults) { - if (!pluginDefaults || Object.keys(pluginDefaults).length === 0) { - return ""; - } - const defaults = Object.entries(pluginDefaults).sort(([pluginNameA], [pluginNameB]) => pluginNameA.localeCompare(pluginNameB)).map(([plugin, value]) => `* ${plugin}: ${createDefaultValueDisplay(value)}`).join("\n"); - return ` -Plugin defaults: -${defaults}`; +var { detailedOptions: detailedOptionsWithoutPlugins } = getContextOptionsWithoutPlugins(); +function parseArgvWithoutPlugins(rawArguments, logger, keys) { + return parseArgv( + rawArguments, + detailedOptionsWithoutPlugins, + logger, + typeof keys === "string" ? [keys] : keys + ); } -function createDetailedUsage(context, flag) { - const option = getOptionsWithOpposites(context.detailedOptions).find((option2) => option2.name === flag || option2.alias === flag); - const header = createOptionUsageHeader(option); - const description = ` - -${indent(option.description, 2)}`; - const choices = option.type !== "choice" ? "" : ` -Valid options: +// src/cli/context.js +var _stack; +var Context = class { + constructor({ + rawArguments, + logger + }) { + __privateAdd(this, _stack, []); + this.rawArguments = rawArguments; + this.logger = logger; + } + async init() { + const { + rawArguments, + logger + } = this; + const { + plugins + } = parseArgvWithoutPlugins(rawArguments, logger, ["plugin"]); + await this.pushContextPlugins(plugins); + const argv = parseArgv(rawArguments, this.detailedOptions, logger); + this.argv = argv; + this.filePatterns = argv._; + } + /** + * @param {string[]} plugins + */ + async pushContextPlugins(plugins) { + const options = await getContextOptions(plugins); + __privateGet(this, _stack).push(options); + Object.assign(this, options); + } + popContextPlugins() { + __privateGet(this, _stack).pop(); + Object.assign(this, at_default( + /* isOptionalObject*/ + false, + __privateGet(this, _stack), + -1 + )); + } + // eslint-disable-next-line getter-return + get performanceTestFlag() { + const { + debugBenchmark, + debugRepeat + } = this.argv; + if (debugBenchmark) { + return { + name: "--debug-benchmark", + debugBenchmark: true + }; + } + if (debugRepeat > 0) { + return { + name: "--debug-repeat", + debugRepeat + }; + } + const { + PRETTIER_PERF_REPEAT + } = process.env; + if (PRETTIER_PERF_REPEAT && /^\d+$/.test(PRETTIER_PERF_REPEAT)) { + return { + name: "PRETTIER_PERF_REPEAT (environment variable)", + debugRepeat: Number(PRETTIER_PERF_REPEAT) + }; + } + } +}; +_stack = new WeakMap(); +var context_default = Context; -${createChoiceUsages(option.choices, CHOICE_USAGE_MARGIN, CHOICE_USAGE_INDENTATION).join("\n")}`; - const optionDefaultValue = getOptionDefaultValue(context, option.name); - const defaults = optionDefaultValue !== void 0 ? ` +// src/cli/file-info.js +var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify(), 1); +import { format, getFileInfo } from "../index.mjs"; +async function logFileInfoOrDie(context) { + const { + fileInfo: file, + ignorePath, + withNodeModules, + plugins, + config + } = context.argv; + const fileInfo = await getFileInfo(file, { + ignorePath, + withNodeModules, + plugins, + resolveConfig: config !== false + }); + printToScreen(await format((0, import_fast_json_stable_stringify.default)(fileInfo), { parser: "json" })); +} +var file_info_default = logFileInfoOrDie; -Default: ${createDefaultValueDisplay(optionDefaultValue)}` : ""; - const pluginDefaults = createPluginDefaults(option.pluginDefaults); - return `${header}${description}${choices}${defaults}${pluginDefaults}`; +// src/cli/find-config-path.js +import path2 from "path"; +import { resolveConfigFile } from "../index.mjs"; +async function logResolvedConfigPathOrDie(context) { + const file = context.argv.findConfigPath; + const configFile = await resolveConfigFile(file); + if (configFile) { + printToScreen(normalizeToPosix(path2.relative(process.cwd(), configFile))); + } else { + throw new Error(`Can not find configure file for "${file}".`); + } } +var find_config_path_default = logResolvedConfigPathOrDie; // src/cli/format.js import fs5 from "fs/promises"; -import path8 from "path"; +import path9 from "path"; var import_diff = __toESM(require_create(), 1); import * as prettier from "../index.mjs"; -import mockable2 from "./internal.mjs"; // src/cli/expand-patterns.js -import path2 from "path"; +import path3 from "path"; async function* expandPatterns(context) { const seen = /* @__PURE__ */ new Set(); let noResults = true; @@ -6216,7 +5870,7 @@ async function* expandPatterns(context) { }; continue; } - const filename = path2.resolve(filePath); + const filename = path3.resolve(filePath); if (seen.has(filename)) { continue; } @@ -6245,16 +5899,20 @@ async function* expandPatternsInternal(context) { const cwd2 = process.cwd(); const entries = []; for (const pattern of context.filePatterns) { - const absolutePath = path2.resolve(cwd2, pattern); + const absolutePath = path3.resolve(cwd2, pattern); if (containsIgnoredPathSegment(absolutePath, cwd2, silentlyIgnoredDirs)) { continue; } const stat = await lstatSafe(absolutePath); if (stat) { if (stat.isSymbolicLink()) { - yield { - error: `Explicitly specified pattern "${pattern}" is a symbolic link.` - }; + if (context.argv.errorOnUnmatchedPattern !== false) { + yield { + error: `Explicitly specified pattern "${pattern}" is a symbolic link.` + }; + } else { + context.logger.debug(`Skipping pattern "${pattern}", as it is a symbolic link.`); + } } else if (stat.isFile()) { entries.push({ type: "file", @@ -6262,7 +5920,7 @@ async function* expandPatternsInternal(context) { input: pattern }); } else if (stat.isDirectory()) { - const relativePath = path2.relative(cwd2, absolutePath) || "."; + const relativePath = path3.relative(cwd2, absolutePath) || "."; const prefix = escapePathForGlob(fixWindowsSlashes(relativePath)); entries.push({ type: "dir", @@ -6321,236 +5979,65 @@ var errorMessages = { }, emptyResults: { file: "Explicitly specified file was ignored due to negative glob patterns", - dir: "No supported files were found in the directory", - glob: "No files matching the pattern were found" - } -}; -function containsIgnoredPathSegment(absolutePath, cwd2, ignoredDirectories) { - return path2.relative(cwd2, absolutePath).split(path2.sep).some((dir) => ignoredDirectories.includes(dir)); -} -function sortPaths(paths) { - return paths.sort((a, b) => a.localeCompare(b)); -} -function escapePathForGlob(path10) { - return string_replace_all_default( - /* isOptionalObject*/ - false, - string_replace_all_default( - /* isOptionalObject*/ - false, - fastGlob.escapePath( - string_replace_all_default( - /* isOptionalObject*/ - false, - path10, - "\\", - "\0" - ) - // Workaround for fast-glob#262 (part 1) - ), - "\\!", - "@(!)" - ), - "\0", - "@(\\\\)" - ); -} -var fixWindowsSlashes = normalizeToPosix; - -// src/cli/options/get-options-for-file.js -var import_dashify2 = __toESM(require_dashify(), 1); -import { resolveConfig } from "../index.mjs"; -function getOptions(argv, detailedOptions) { - return Object.fromEntries( - detailedOptions.filter(({ forwardToApi }) => forwardToApi).map(({ forwardToApi, name }) => [forwardToApi, argv[name]]) - ); -} -function cliifyOptions(object, apiDetailedOptionMap) { - return Object.fromEntries( - Object.entries(object || {}).map(([key, value]) => { - const apiOption = apiDetailedOptionMap[key]; - const cliKey = apiOption ? apiOption.name : key; - return [(0, import_dashify2.default)(cliKey), value]; - }) - ); -} -function createApiDetailedOptionMap(detailedOptions) { - return Object.fromEntries( - detailedOptions.filter( - (option) => option.forwardToApi && option.forwardToApi !== option.name - ).map((option) => [option.forwardToApi, option]) - ); -} -function parseArgsToOptions(context, overrideDefaults) { - const minimistOptions = createMinimistOptions(context.detailedOptions); - const apiDetailedOptionMap = createApiDetailedOptionMap( - context.detailedOptions - ); - return getOptions( - normalize_cli_options_default( - minimistParse(context.rawArguments, { - string: minimistOptions.string, - boolean: minimistOptions.boolean, - default: cliifyOptions(overrideDefaults, apiDetailedOptionMap) - }), - context.detailedOptions, - { logger: false } - ), - context.detailedOptions - ); -} -async function getOptionsOrDie(context, filePath) { - try { - if (context.argv.config === false) { - context.logger.debug( - "'--no-config' option found, skip loading config file." - ); - return null; - } - context.logger.debug( - context.argv.config ? `load config file from '${context.argv.config}'` : `resolve config from '${filePath}'` - ); - const options = await resolveConfig(filePath, { - editorconfig: context.argv.editorconfig, - config: context.argv.config - }); - context.logger.debug("loaded options `" + JSON.stringify(options) + "`"); - return options; - } catch (error) { - context.logger.error( - `Invalid configuration for file "${filePath}": -` + error.message - ); - process.exit(2); - } -} -function applyConfigPrecedence(context, options) { - try { - switch (context.argv.configPrecedence) { - case "cli-override": - return parseArgsToOptions(context, options); - case "file-override": - return { ...parseArgsToOptions(context), ...options }; - case "prefer-file": - return options || parseArgsToOptions(context); - } - } catch (error) { - context.logger.error(error.toString()); - process.exit(2); + dir: "No supported files were found in the directory", + glob: "No files matching the pattern were found" } +}; +function containsIgnoredPathSegment(absolutePath, cwd2, ignoredDirectories) { + return path3.relative(cwd2, absolutePath).split(path3.sep).some((dir) => ignoredDirectories.includes(dir)); } -async function getOptionsForFile(context, filepath) { - const options = await getOptionsOrDie(context, filepath); - const hasPlugins = options == null ? void 0 : options.plugins; - if (hasPlugins) { - await context.pushContextPlugins(options.plugins); - } - const appliedOptions = { - filepath, - ...applyConfigPrecedence( - context, - options && normalizeOptions(options, context.supportOptions, { - logger: context.logger - }) - ) - }; - context.logger.debug( - `applied config-precedence (${context.argv.configPrecedence}): ${JSON.stringify(appliedOptions)}` - ); - if (hasPlugins) { - context.popContextPlugins(); - } - return appliedOptions; +function sortPaths(paths) { + return paths.sort((a, b) => a.localeCompare(b)); } -var get_options_for_file_default = getOptionsForFile; - -// src/cli/is-tty.js -import mockable from "./internal.mjs"; -function isTTY() { - return process.stdout.isTTY && !mockable.isCI(); +function escapePathForGlob(path10) { + return string_replace_all_default( + /* isOptionalObject*/ + false, + string_replace_all_default( + /* isOptionalObject*/ + false, + fastGlob.escapePath( + string_replace_all_default( + /* isOptionalObject*/ + false, + path10, + "\\", + "\0" + ) + // Workaround for fast-glob#262 (part 1) + ), + "\\!", + "@(!)" + ), + "\0", + "@(\\\\)" + ); } +var fixWindowsSlashes = normalizeToPosix; // src/cli/find-cache-file.js import fs4 from "fs/promises"; import os2 from "os"; -import path7 from "path"; +import path8 from "path"; // node_modules/find-cache-dir/index.js var import_common_path_prefix = __toESM(require_common_path_prefix(), 1); import process4 from "process"; -import path6 from "path"; +import path7 from "path"; import fs3 from "fs"; // node_modules/pkg-dir/index.js -import path5 from "path"; +import path6 from "path"; // node_modules/pkg-dir/node_modules/find-up/index.js -import path4 from "path"; +import path5 from "path"; import { fileURLToPath as fileURLToPath2 } from "url"; // node_modules/pkg-dir/node_modules/locate-path/index.js import process3 from "process"; -import path3 from "path"; +import path4 from "path"; import fs2, { promises as fsPromises } from "fs"; import { fileURLToPath } from "url"; - -// node_modules/pkg-dir/node_modules/yocto-queue/index.js -var Node = class { - value; - next; - constructor(value) { - this.value = value; - } -}; -var _head, _tail, _size; -var Queue = class { - constructor() { - __privateAdd(this, _head, void 0); - __privateAdd(this, _tail, void 0); - __privateAdd(this, _size, void 0); - this.clear(); - } - enqueue(value) { - const node = new Node(value); - if (__privateGet(this, _head)) { - __privateGet(this, _tail).next = node; - __privateSet(this, _tail, node); - } else { - __privateSet(this, _head, node); - __privateSet(this, _tail, node); - } - __privateWrapper(this, _size)._++; - } - dequeue() { - const current = __privateGet(this, _head); - if (!current) { - return; - } - __privateSet(this, _head, __privateGet(this, _head).next); - __privateWrapper(this, _size)._--; - return current.value; - } - clear() { - __privateSet(this, _head, void 0); - __privateSet(this, _tail, void 0); - __privateSet(this, _size, 0); - } - get size() { - return __privateGet(this, _size); - } - *[Symbol.iterator]() { - let current = __privateGet(this, _head); - while (current) { - yield current.value; - current = current.next; - } - } -}; -_head = new WeakMap(); -_tail = new WeakMap(); -_size = new WeakMap(); - -// node_modules/pkg-dir/node_modules/locate-path/index.js var typeMappings = { directory: "isDirectory", file: "isFile" @@ -6573,7 +6060,7 @@ function locatePathSync(paths, { const statFunction = allowSymlinks ? fs2.statSync : fs2.lstatSync; for (const path_ of paths) { try { - const stat = statFunction(path3.resolve(cwd2, path_), { + const stat = statFunction(path4.resolve(cwd2, path_), { throwIfNoEntry: false }); if (!stat) { @@ -6591,8 +6078,8 @@ function locatePathSync(paths, { var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath; var findUpStop = Symbol("findUpStop"); function findUpMultipleSync(name, options = {}) { - let directory = path4.resolve(toPath2(options.cwd) || ""); - const { root } = path4.parse(directory); + let directory = path5.resolve(toPath2(options.cwd) || ""); + const { root } = path5.parse(directory); const stopAt = options.stopAt || root; const limit = options.limit || Number.POSITIVE_INFINITY; const paths = [name].flat(); @@ -6613,12 +6100,12 @@ function findUpMultipleSync(name, options = {}) { break; } if (foundPath) { - matches.push(path4.resolve(directory, foundPath)); + matches.push(path5.resolve(directory, foundPath)); } if (directory === stopAt || matches.length >= limit) { break; } - directory = path4.dirname(directory); + directory = path5.dirname(directory); } return matches; } @@ -6630,7 +6117,7 @@ function findUpSync(name, options = {}) { // node_modules/pkg-dir/index.js function packageDirectorySync({ cwd: cwd2 } = {}) { const filePath = findUpSync("package.json", { cwd: cwd2 }); - return filePath && path5.dirname(filePath); + return filePath && path6.dirname(filePath); } // node_modules/find-cache-dir/index.js @@ -6650,22 +6137,22 @@ function useDirectory(directory, options) { return directory; } function getNodeModuleDirectory(directory) { - const nodeModules = path6.join(directory, "node_modules"); - if (!isWritable(nodeModules) && (fs3.existsSync(nodeModules) || !isWritable(path6.join(directory)))) { + const nodeModules = path7.join(directory, "node_modules"); + if (!isWritable(nodeModules) && (fs3.existsSync(nodeModules) || !isWritable(path7.join(directory)))) { return; } return nodeModules; } function findCacheDirectory(options = {}) { if (env2.CACHE_DIR && !["true", "false", "1", "0"].includes(env2.CACHE_DIR)) { - return useDirectory(path6.join(env2.CACHE_DIR, options.name), options); + return useDirectory(path7.join(env2.CACHE_DIR, options.name), options); } let { cwd: directory = cwd(), files } = options; if (files) { if (!Array.isArray(files)) { throw new TypeError(`Expected \`files\` option to be an array, got \`${typeof files}\`.`); } - directory = (0, import_common_path_prefix.default)(files.map((file) => path6.resolve(directory, file))); + directory = (0, import_common_path_prefix.default)(files.map((file) => path7.resolve(directory, file))); } directory = packageDirectorySync({ cwd: directory }); if (!directory) { @@ -6675,17 +6162,17 @@ function findCacheDirectory(options = {}) { if (!nodeModules) { return; } - return useDirectory(path6.join(directory, "node_modules", ".cache", options.name), options); + return useDirectory(path7.join(directory, "node_modules", ".cache", options.name), options); } // src/cli/find-cache-file.js function findDefaultCacheFile() { const cacheDir = findCacheDirectory({ name: "prettier", create: true }) || os2.tmpdir(); - const cacheFilePath = path7.join(cacheDir, ".prettier-cache"); + const cacheFilePath = path8.join(cacheDir, ".prettier-cache"); return cacheFilePath; } async function findCacheFileFromOption(cacheLocation) { - const cacheFile = path7.resolve(cacheLocation); + const cacheFile = path8.resolve(cacheLocation); const stat = await statSafe(cacheFile); if (stat) { if (stat.isDirectory()) { @@ -6710,8 +6197,8 @@ async function findCacheFile(cacheLocation) { var find_cache_file_default = findCacheFile; // src/cli/format-results-cache.js +var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify(), 1); var import_file_entry_cache = __toESM(require_cache2(), 1); -var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify(), 1); import { version as prettierVersion } from "../index.mjs"; var optionsHashCache = /* @__PURE__ */ new WeakMap(); var nodeVersion = process.version; @@ -6720,7 +6207,7 @@ function getHashOfOptions(options) { return optionsHashCache.get(options); } const hash = createHash( - `${prettierVersion}_${nodeVersion}_${(0, import_fast_json_stable_stringify.default)(options)}` + `${prettierVersion}_${nodeVersion}_${(0, import_fast_json_stable_stringify2.default)(options)}` ); optionsHashCache.set(options, hash); return hash; @@ -6783,8 +6270,120 @@ var FormatResultsCache = class { _fileEntryCache = new WeakMap(); var format_results_cache_default = FormatResultsCache; +// src/cli/is-tty.js +function isTTY() { + return process.stdout.isTTY && !mockable.isCI(); +} + +// src/cli/options/get-options-for-file.js +var import_dashify2 = __toESM(require_dashify(), 1); +import { resolveConfig } from "../index.mjs"; +function getOptions(argv, detailedOptions) { + return Object.fromEntries( + detailedOptions.filter(({ forwardToApi }) => forwardToApi).map(({ forwardToApi, name }) => [forwardToApi, argv[name]]) + ); +} +function cliifyOptions(object, apiDetailedOptionMap) { + return Object.fromEntries( + Object.entries(object || {}).map(([key, value]) => { + const apiOption = apiDetailedOptionMap[key]; + const cliKey = apiOption ? apiOption.name : key; + return [(0, import_dashify2.default)(cliKey), value]; + }) + ); +} +function createApiDetailedOptionMap(detailedOptions) { + return Object.fromEntries( + detailedOptions.filter( + (option) => option.forwardToApi && option.forwardToApi !== option.name + ).map((option) => [option.forwardToApi, option]) + ); +} +function parseArgsToOptions(context, overrideDefaults) { + const minimistOptions = createMinimistOptions(context.detailedOptions); + const apiDetailedOptionMap = createApiDetailedOptionMap( + context.detailedOptions + ); + return getOptions( + normalize_cli_options_default( + minimistParse(context.rawArguments, { + string: minimistOptions.string, + boolean: minimistOptions.boolean, + default: cliifyOptions(overrideDefaults, apiDetailedOptionMap) + }), + context.detailedOptions, + { logger: false } + ), + context.detailedOptions + ); +} +async function getOptionsOrDie(context, filePath) { + try { + if (context.argv.config === false) { + context.logger.debug( + "'--no-config' option found, skip loading config file." + ); + return null; + } + context.logger.debug( + context.argv.config ? `load config file from '${context.argv.config}'` : `resolve config from '${filePath}'` + ); + const options = await resolveConfig(filePath, { + editorconfig: context.argv.editorconfig, + config: context.argv.config + }); + context.logger.debug("loaded options `" + JSON.stringify(options) + "`"); + return options; + } catch (error) { + context.logger.error( + `Invalid configuration${filePath ? ` for file "${filePath}"` : ""}: +` + error.message + ); + process.exit(2); + } +} +function applyConfigPrecedence(context, options) { + try { + switch (context.argv.configPrecedence) { + case "cli-override": + return parseArgsToOptions(context, options); + case "file-override": + return { ...parseArgsToOptions(context), ...options }; + case "prefer-file": + return options || parseArgsToOptions(context); + } + } catch (error) { + context.logger.error(error.toString()); + process.exit(2); + } +} +async function getOptionsForFile(context, filepath) { + const options = await getOptionsOrDie(context, filepath); + const hasPlugins = options == null ? void 0 : options.plugins; + if (hasPlugins) { + await context.pushContextPlugins(options.plugins); + } + const appliedOptions = { + filepath, + ...applyConfigPrecedence( + context, + options && normalizeOptions(options, context.supportOptions, { + logger: context.logger + }) + ) + }; + context.logger.debug( + `applied config-precedence (${context.argv.configPrecedence}): ${JSON.stringify(appliedOptions)}` + ); + if (hasPlugins) { + context.popContextPlugins(); + } + return appliedOptions; +} +var get_options_for_file_default = getOptionsForFile; + // src/cli/format.js -var { getStdin, writeFormattedFile } = mockable2; +var { getStdin, writeFormattedFile } = mockable; function diff(a, b) { return (0, import_diff.createTwoFilesPatch)("", "", a, b, "", "", { context: 2 }); } @@ -6847,7 +6446,7 @@ async function listDifferent(context, input, options, filename) { } return true; } -async function format2(context, input, opt) { +async function format3(context, input, opt) { if (context.argv.debugPrintDoc) { const doc = await prettier.__debug.printToDoc(input, opt); return { formatted: await prettier.__debug.formatDoc(doc) + "\n" }; @@ -6980,12 +6579,12 @@ async function formatStdin(context) { } const options = await get_options_for_file_default( context, - filepath ? path8.resolve(process.cwd(), filepath) : process.cwd() + filepath ? path9.resolve(filepath) : void 0 ); if (await listDifferent(context, input, options, "(stdin)")) { return; } - const formatted = await format2(context, input, options); + const formatted = await format3(context, input, options); const { performanceTestFlag } = context; if (performanceTestFlag) { context.logger.log( @@ -7035,7 +6634,7 @@ async function formatFiles(context) { ...await get_options_for_file_default(context, filename), filepath: filename }; - const fileNameToDisplay = normalizeToPosix(path8.relative(cwd2, filename)); + const fileNameToDisplay = normalizeToPosix(path9.relative(cwd2, filename)); let printedFilename; if (isTTY()) { printedFilename = context.logger.log(fileNameToDisplay, { @@ -7071,7 +6670,7 @@ ${error2.message}` if (isCacheExists) { result = { formatted: input }; } else { - result = await format2(context, input, options); + result = await format3(context, input, options); } output = result.formatted; } catch (error2) { @@ -7125,74 +6724,143 @@ ${error2.message}` } else if (!context.argv.check && !context.argv.listDifferent) { writeOutput(context, result, options); } - if (shouldSetCache) { - formatResultsCache == null ? void 0 : formatResultsCache.setFormatResultsCache(filename, options); - } else { - formatResultsCache == null ? void 0 : formatResultsCache.removeFormatResultsCache(filename); + if (shouldSetCache) { + formatResultsCache == null ? void 0 : formatResultsCache.setFormatResultsCache(filename, options); + } else { + formatResultsCache == null ? void 0 : formatResultsCache.removeFormatResultsCache(filename); + } + if (isDifferent) { + if (context.argv.check) { + context.logger.warn(fileNameToDisplay); + } else if (context.argv.listDifferent) { + context.logger.log(fileNameToDisplay); + } + numberOfUnformattedFilesFound += 1; + } + } + formatResultsCache == null ? void 0 : formatResultsCache.reconcile(); + if (context.argv.check) { + if (numberOfUnformattedFilesFound === 0) { + context.logger.log("All matched files use Prettier code style!"); + } else { + const files = numberOfUnformattedFilesFound === 1 ? "the above file" : `${numberOfUnformattedFilesFound} files`; + context.logger.warn( + context.argv.write ? `Code style issues fixed in ${files}.` : `Code style issues found in ${files}. Run Prettier to fix.` + ); + } + } + if ((context.argv.check || context.argv.listDifferent) && numberOfUnformattedFilesFound > 0 && !process.exitCode && !context.argv.write) { + process.exitCode = 1; + } +} + +// src/cli/logger.js +import readline from "readline"; + +// node_modules/ansi-regex/index.js +function ansiRegex({ onlyFirst = false } = {}) { + const pattern = [ + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", + "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))" + ].join("|"); + return new RegExp(pattern, onlyFirst ? void 0 : "g"); +} + +// node_modules/strip-ansi/index.js +var regex = ansiRegex(); +function stripAnsi(string) { + if (typeof string !== "string") { + throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); + } + return string.replace(regex, ""); +} + +// src/cli/logger.js +var import_wcwidth = __toESM(require_wcwidth(), 1); +var countLines = (stream, text) => { + const columns = stream.columns || 80; + let lineCount = 0; + for (const line of stripAnsi(text).split("\n")) { + lineCount += Math.max(1, Math.ceil((0, import_wcwidth.default)(line) / columns)); + } + return lineCount; +}; +var clear = (stream, text) => () => { + const lineCount = countLines(stream, text); + for (let line = 0; line < lineCount; line++) { + if (line > 0) { + readline.moveCursor(stream, 0, -1); + } + readline.clearLine(stream, 0); + readline.cursorTo(stream, 0); + } +}; +var emptyLogResult = { + clear() { + } +}; +function createLogger(logLevel = "log") { + return { + logLevel, + warn: createLogFunc("warn", "yellow"), + error: createLogFunc("error", "red"), + debug: createLogFunc("debug", "blue"), + log: createLogFunc("log") + }; + function createLogFunc(loggerName, color) { + if (!shouldLog(loggerName)) { + return () => emptyLogResult; } - if (isDifferent) { - if (context.argv.check) { - context.logger.warn(fileNameToDisplay); - } else if (context.argv.listDifferent) { - context.logger.log(fileNameToDisplay); + const stream = process[loggerName === "log" ? "stdout" : "stderr"]; + const chalkInstance = loggerName === "log" ? source_default : chalkStderr; + const prefix = color ? `[${chalkInstance[color](loggerName)}] ` : ""; + return (message, options) => { + options = { + newline: true, + clearable: false, + ...options + }; + message = string_replace_all_default( + /* isOptionalObject*/ + false, + message, + /^/gm, + prefix + ) + (options.newline ? "\n" : ""); + stream.write(message); + if (options.clearable) { + return { + clear: clear(stream, message) + }; } - numberOfUnformattedFilesFound += 1; - } + }; } - formatResultsCache == null ? void 0 : formatResultsCache.reconcile(); - if (context.argv.check) { - if (numberOfUnformattedFilesFound === 0) { - context.logger.log("All matched files use Prettier code style!"); - } else { - const files = numberOfUnformattedFilesFound === 1 ? "the above file" : `${numberOfUnformattedFilesFound} files`; - context.logger.warn( - context.argv.write ? `Code style issues fixed in ${files}.` : `Code style issues found in ${files}. Run Prettier to fix.` - ); + function shouldLog(loggerName) { + switch (logLevel) { + case "silent": + return false; + case "debug": + if (loggerName === "debug") { + return true; + } + case "log": + if (loggerName === "log") { + return true; + } + case "warn": + if (loggerName === "warn") { + return true; + } + case "error": + return loggerName === "error"; } } - if ((context.argv.check || context.argv.listDifferent) && numberOfUnformattedFilesFound > 0 && !process.exitCode && !context.argv.write) { - process.exitCode = 1; - } -} - -// src/cli/file-info.js -var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify(), 1); -import { format as format3, getFileInfo } from "../index.mjs"; -async function logFileInfoOrDie(context) { - const { - fileInfo: file, - ignorePath, - withNodeModules, - plugins, - config - } = context.argv; - const fileInfo = await getFileInfo(file, { - ignorePath, - withNodeModules, - plugins, - resolveConfig: config !== false - }); - printToScreen(await format3((0, import_fast_json_stable_stringify2.default)(fileInfo), { parser: "json" })); -} -var file_info_default = logFileInfoOrDie; - -// src/cli/find-config-path.js -import path9 from "path"; -import { resolveConfigFile } from "../index.mjs"; -async function logResolvedConfigPathOrDie(context) { - const file = context.argv.findConfigPath; - const configFile = await resolveConfigFile(file); - if (configFile) { - printToScreen(normalizeToPosix(path9.relative(process.cwd(), configFile))); - } else { - throw new Error(`Can not find configure file for "${file}".`); - } } -var find_config_path_default = logResolvedConfigPathOrDie; +var logger_default = createLogger; // src/cli/print-support-info.js var import_fast_json_stable_stringify3 = __toESM(require_fast_json_stable_stringify(), 1); -import { getSupportInfo as getSupportInfo2, format as format4 } from "../index.mjs"; +import { format as format4, getSupportInfo as getSupportInfo2 } from "../index.mjs"; var sortByName = (array2) => array2.sort((a, b) => a.name.localeCompare(b.name)); async function printSupportInfo() { const { languages, options } = await getSupportInfo2(); @@ -7206,6 +6874,139 @@ async function printSupportInfo() { } var print_support_info_default = printSupportInfo; +// src/cli/constants.evaluate.js +var categoryOrder = [ + "Output", + "Format", + "Config", + "Editor", + "Other" +]; +var usageSummary = "Usage: prettier [options] [file/dir/glob ...]\n\nBy default, output is written to stdout.\nStdin is read if it is piped to Prettier and no files are given."; + +// src/cli/usage.js +var OPTION_USAGE_THRESHOLD = 25; +var CHOICE_USAGE_MARGIN = 3; +var CHOICE_USAGE_INDENTATION = 2; +function indent(str, spaces) { + return string_replace_all_default( + /* isOptionalObject*/ + false, + str, + /^/gm, + " ".repeat(spaces) + ); +} +function createDefaultValueDisplay(value) { + return Array.isArray(value) ? `[${value.map(createDefaultValueDisplay).join(", ")}]` : value; +} +function getOptionDefaultValue(context, optionName) { + var _a; + const option = context.detailedOptions.find(({ + name + }) => name === optionName); + if ((option == null ? void 0 : option.default) !== void 0) { + return option.default; + } + const optionCamelName = camelCase(optionName); + return formatOptionsHiddenDefaults[optionCamelName] ?? ((_a = context.supportOptions.find((option2) => !option2.deprecated && option2.name === optionCamelName)) == null ? void 0 : _a.default); +} +function createOptionUsageHeader(option) { + const name = `--${option.name}`; + const alias = option.alias ? `-${option.alias},` : null; + const type = createOptionUsageType(option); + return [alias, name, type].filter(Boolean).join(" "); +} +function createOptionUsageRow(header, content, threshold) { + const separator = header.length >= threshold ? ` +${" ".repeat(threshold)}` : " ".repeat(threshold - header.length); + const description = string_replace_all_default( + /* isOptionalObject*/ + false, + content, + "\n", + ` +${" ".repeat(threshold)}` + ); + return `${header}${separator}${description}`; +} +function createOptionUsageType(option) { + switch (option.type) { + case "boolean": + return null; + case "choice": + return `<${option.choices.filter((choice) => !choice.deprecated).map((choice) => choice.value).join("|")}>`; + default: + return `<${option.type}>`; + } +} +function createChoiceUsages(choices, margin, indentation) { + const activeChoices = choices.filter((choice) => !choice.deprecated); + const threshold = Math.max(0, ...activeChoices.map((choice) => choice.value.length)) + margin; + return activeChoices.map((choice) => indent(createOptionUsageRow(choice.value, choice.description, threshold), indentation)); +} +function createOptionUsage(context, option, threshold) { + const header = createOptionUsageHeader(option); + const optionDefaultValue = getOptionDefaultValue(context, option.name); + return createOptionUsageRow(header, `${option.description}${optionDefaultValue === void 0 ? "" : ` +Defaults to ${createDefaultValueDisplay(optionDefaultValue)}.`}`, threshold); +} +function getOptionsWithOpposites(options) { + const optionsWithOpposites = options.map((option) => [option.description ? option : null, option.oppositeDescription ? { + ...option, + name: `no-${option.name}`, + type: "boolean", + description: option.oppositeDescription + } : null]); + return optionsWithOpposites.flat().filter(Boolean); +} +function createUsage(context) { + const sortedOptions = context.detailedOptions.sort((optionA, optionB) => optionA.name.localeCompare(optionB.name)); + const options = getOptionsWithOpposites(sortedOptions).filter( + // remove unnecessary option (e.g. `semi`, `color`, etc.), which is only used for --help + (option) => !(option.type === "boolean" && option.oppositeDescription && !option.name.startsWith("no-")) + ); + const groupedOptions = groupBy(options, (option) => option.category); + const firstCategories = categoryOrder.slice(0, -1); + const lastCategories = categoryOrder.slice(-1); + const restCategories = Object.keys(groupedOptions).filter((category) => !categoryOrder.includes(category)); + const allCategories = [...firstCategories, ...restCategories, ...lastCategories]; + const optionsUsage = allCategories.map((category) => { + const categoryOptions = groupedOptions[category].map((option) => createOptionUsage(context, option, OPTION_USAGE_THRESHOLD)).join("\n"); + return `${category} options: + +${indent(categoryOptions, 2)}`; + }); + return [usageSummary, ...optionsUsage, ""].join("\n\n"); +} +function createPluginDefaults(pluginDefaults) { + if (!pluginDefaults || Object.keys(pluginDefaults).length === 0) { + return ""; + } + const defaults = Object.entries(pluginDefaults).sort(([pluginNameA], [pluginNameB]) => pluginNameA.localeCompare(pluginNameB)).map(([plugin, value]) => `* ${plugin}: ${createDefaultValueDisplay(value)}`).join("\n"); + return ` +Plugin defaults: +${defaults}`; +} +function createDetailedUsage(context, flag) { + const option = getOptionsWithOpposites(context.detailedOptions).find((option2) => option2.name === flag || option2.alias === flag); + const header = createOptionUsageHeader(option); + const description = ` + +${indent(option.description, 2)}`; + const choices = option.type !== "choice" ? "" : ` + +Valid options: + +${createChoiceUsages(option.choices, CHOICE_USAGE_MARGIN, CHOICE_USAGE_INDENTATION).join("\n")}`; + const optionDefaultValue = getOptionDefaultValue(context, option.name); + const defaults = optionDefaultValue !== void 0 ? ` + +Default: ${createDefaultValueDisplay(optionDefaultValue)}` : ""; + const pluginDefaults = createPluginDefaults(option.pluginDefaults); + return `${header}${description}${choices}${defaults}${pluginDefaults}`; +} + // src/cli/index.js async function run(rawArguments = process.argv.slice(2)) { let logger = logger_default(); diff --git a/node_modules/prettier/internal/internal.mjs b/node_modules/prettier/internal/internal.mjs deleted file mode 100644 index d3f8c1e..0000000 --- a/node_modules/prettier/internal/internal.mjs +++ /dev/null @@ -1,712 +0,0 @@ -import { createRequire as __prettierCreateRequire } from "module"; -import { fileURLToPath as __prettierFileUrlToPath } from "url"; -import { dirname as __prettierDirname } from "path"; -const require = __prettierCreateRequire(import.meta.url); -const __filename = __prettierFileUrlToPath(import.meta.url); -const __dirname = __prettierDirname(__filename); - -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] -}) : x)(function(x) { - if (typeof require !== "undefined") - return require.apply(this, arguments); - throw Error('Dynamic require of "' + x + '" is not supported'); -}); -var __commonJS = (cb, mod) => function __require2() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); - -// node_modules/lilconfig/dist/index.js -var require_dist = __commonJS({ - "node_modules/lilconfig/dist/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.lilconfigSync = exports.lilconfig = exports.defaultLoaders = void 0; - var path = __require("path"); - var fs2 = __require("fs"); - var os = __require("os"); - var fsReadFileAsync = fs2.promises.readFile; - function getDefaultSearchPlaces(name) { - return [ - "package.json", - `.${name}rc.json`, - `.${name}rc.js`, - `.${name}rc.cjs`, - `.config/${name}rc`, - `.config/${name}rc.json`, - `.config/${name}rc.js`, - `.config/${name}rc.cjs`, - `${name}.config.js`, - `${name}.config.cjs` - ]; - } - function getSearchPaths(startDir, stopDir) { - return startDir.split(path.sep).reduceRight((acc, _, ind, arr) => { - const currentPath = arr.slice(0, ind + 1).join(path.sep); - if (!acc.passedStopDir) - acc.searchPlaces.push(currentPath || path.sep); - if (currentPath === stopDir) - acc.passedStopDir = true; - return acc; - }, { searchPlaces: [], passedStopDir: false }).searchPlaces; - } - exports.defaultLoaders = Object.freeze({ - ".js": __require, - ".json": __require, - ".cjs": __require, - noExt(_, content) { - return JSON.parse(content); - } - }); - function getExtDesc(ext) { - return ext === "noExt" ? "files without extensions" : `extension "${ext}"`; - } - function getOptions(name, options = {}) { - const conf = { - stopDir: os.homedir(), - searchPlaces: getDefaultSearchPlaces(name), - ignoreEmptySearchPlaces: true, - transform: (x) => x, - packageProp: [name], - ...options, - loaders: { ...exports.defaultLoaders, ...options.loaders } - }; - conf.searchPlaces.forEach((place) => { - const key = path.extname(place) || "noExt"; - const loader = conf.loaders[key]; - if (!loader) { - throw new Error(`No loader specified for ${getExtDesc(key)}, so searchPlaces item "${place}" is invalid`); - } - if (typeof loader !== "function") { - throw new Error(`loader for ${getExtDesc(key)} is not a function (type provided: "${typeof loader}"), so searchPlaces item "${place}" is invalid`); - } - }); - return conf; - } - function getPackageProp(props, obj) { - if (typeof props === "string" && props in obj) - return obj[props]; - return (Array.isArray(props) ? props : props.split(".")).reduce((acc, prop) => acc === void 0 ? acc : acc[prop], obj) || null; - } - function getSearchItems(searchPlaces, searchPaths) { - return searchPaths.reduce((acc, searchPath) => { - searchPlaces.forEach((sp) => acc.push({ - searchPlace: sp, - filepath: path.join(searchPath, sp), - loaderKey: path.extname(sp) || "noExt" - })); - return acc; - }, []); - } - function validateFilePath(filepath) { - if (!filepath) - throw new Error("load must pass a non-empty string"); - } - function validateLoader(loader, ext) { - if (!loader) - throw new Error(`No loader specified for extension "${ext}"`); - if (typeof loader !== "function") - throw new Error("loader is not a function"); - } - function lilconfig2(name, options) { - const { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform } = getOptions(name, options); - return { - async search(searchFrom = process.cwd()) { - const searchPaths = getSearchPaths(searchFrom, stopDir); - const result = { - config: null, - filepath: "" - }; - const searchItems = getSearchItems(searchPlaces, searchPaths); - for (const { searchPlace, filepath, loaderKey } of searchItems) { - try { - await fs2.promises.access(filepath); - } catch (_a) { - continue; - } - const content = String(await fsReadFileAsync(filepath)); - const loader = loaders[loaderKey]; - if (searchPlace === "package.json") { - const pkg = await loader(filepath, content); - const maybeConfig = getPackageProp(packageProp, pkg); - if (maybeConfig != null) { - result.config = maybeConfig; - result.filepath = filepath; - break; - } - continue; - } - const isEmpty = content.trim() === ""; - if (isEmpty && ignoreEmptySearchPlaces) - continue; - if (isEmpty) { - result.isEmpty = true; - result.config = void 0; - } else { - validateLoader(loader, loaderKey); - result.config = await loader(filepath, content); - } - result.filepath = filepath; - break; - } - if (result.filepath === "" && result.config === null) - return transform(null); - return transform(result); - }, - async load(filepath) { - validateFilePath(filepath); - const absPath = path.resolve(process.cwd(), filepath); - const { base, ext } = path.parse(absPath); - const loaderKey = ext || "noExt"; - const loader = loaders[loaderKey]; - validateLoader(loader, loaderKey); - const content = String(await fsReadFileAsync(absPath)); - if (base === "package.json") { - const pkg = await loader(absPath, content); - return transform({ - config: getPackageProp(packageProp, pkg), - filepath: absPath - }); - } - const result = { - config: null, - filepath: absPath - }; - const isEmpty = content.trim() === ""; - if (isEmpty && ignoreEmptySearchPlaces) - return transform({ - config: void 0, - filepath: absPath, - isEmpty: true - }); - result.config = isEmpty ? void 0 : await loader(absPath, content); - return transform(isEmpty ? { ...result, isEmpty, config: void 0 } : result); - } - }; - } - exports.lilconfig = lilconfig2; - } -}); - -// node_modules/find-parent-dir/index.js -var require_find_parent_dir = __commonJS({ - "node_modules/find-parent-dir/index.js"(exports, module) { - "use strict"; - var path = __require("path"); - var fs2 = __require("fs"); - var exists = fs2.exists || path.exists; - var existsSync = fs2.existsSync || path.existsSync; - function splitPath(path2) { - var parts = path2.split(/(\/|\\)/); - if (!parts.length) - return parts; - return !parts[0].length ? parts.slice(1) : parts; - } - exports = module.exports = function(currentFullPath, clue, cb) { - function testDir(parts) { - if (parts.length === 0) - return cb(null, null); - var p = parts.join(""); - exists(path.join(p, clue), function(itdoes) { - if (itdoes) - return cb(null, p); - testDir(parts.slice(0, -1)); - }); - } - testDir(splitPath(currentFullPath)); - }; - exports.sync = function(currentFullPath, clue) { - function testDir(parts) { - if (parts.length === 0) - return null; - var p = parts.join(""); - var itdoes = existsSync(path.join(p, clue)); - return itdoes ? p : testDir(parts.slice(0, -1)); - } - return testDir(splitPath(currentFullPath)); - }; - } -}); - -// node_modules/ci-info/vendors.json -var require_vendors = __commonJS({ - "node_modules/ci-info/vendors.json"(exports, module) { - module.exports = [ - { - name: "Agola CI", - constant: "AGOLA", - env: "AGOLA_GIT_REF", - pr: "AGOLA_PULL_REQUEST_ID" - }, - { - name: "Appcircle", - constant: "APPCIRCLE", - env: "AC_APPCIRCLE" - }, - { - name: "AppVeyor", - constant: "APPVEYOR", - env: "APPVEYOR", - pr: "APPVEYOR_PULL_REQUEST_NUMBER" - }, - { - name: "AWS CodeBuild", - constant: "CODEBUILD", - env: "CODEBUILD_BUILD_ARN" - }, - { - name: "Azure Pipelines", - constant: "AZURE_PIPELINES", - env: "TF_BUILD", - pr: { - BUILD_REASON: "PullRequest" - } - }, - { - name: "Bamboo", - constant: "BAMBOO", - env: "bamboo_planKey" - }, - { - name: "Bitbucket Pipelines", - constant: "BITBUCKET", - env: "BITBUCKET_COMMIT", - pr: "BITBUCKET_PR_ID" - }, - { - name: "Bitrise", - constant: "BITRISE", - env: "BITRISE_IO", - pr: "BITRISE_PULL_REQUEST" - }, - { - name: "Buddy", - constant: "BUDDY", - env: "BUDDY_WORKSPACE_ID", - pr: "BUDDY_EXECUTION_PULL_REQUEST_ID" - }, - { - name: "Buildkite", - constant: "BUILDKITE", - env: "BUILDKITE", - pr: { - env: "BUILDKITE_PULL_REQUEST", - ne: "false" - } - }, - { - name: "CircleCI", - constant: "CIRCLE", - env: "CIRCLECI", - pr: "CIRCLE_PULL_REQUEST" - }, - { - name: "Cirrus CI", - constant: "CIRRUS", - env: "CIRRUS_CI", - pr: "CIRRUS_PR" - }, - { - name: "Codefresh", - constant: "CODEFRESH", - env: "CF_BUILD_ID", - pr: { - any: [ - "CF_PULL_REQUEST_NUMBER", - "CF_PULL_REQUEST_ID" - ] - } - }, - { - name: "Codemagic", - constant: "CODEMAGIC", - env: "CM_BUILD_ID", - pr: "CM_PULL_REQUEST" - }, - { - name: "Codeship", - constant: "CODESHIP", - env: { - CI_NAME: "codeship" - } - }, - { - name: "Drone", - constant: "DRONE", - env: "DRONE", - pr: { - DRONE_BUILD_EVENT: "pull_request" - } - }, - { - name: "dsari", - constant: "DSARI", - env: "DSARI" - }, - { - name: "Earthly", - constant: "EARTHLY", - env: "EARTHLY_CI" - }, - { - name: "Expo Application Services", - constant: "EAS", - env: "EAS_BUILD" - }, - { - name: "Gerrit", - constant: "GERRIT", - env: "GERRIT_PROJECT" - }, - { - name: "Gitea Actions", - constant: "GITEA_ACTIONS", - env: "GITEA_ACTIONS" - }, - { - name: "GitHub Actions", - constant: "GITHUB_ACTIONS", - env: "GITHUB_ACTIONS", - pr: { - GITHUB_EVENT_NAME: "pull_request" - } - }, - { - name: "GitLab CI", - constant: "GITLAB", - env: "GITLAB_CI", - pr: "CI_MERGE_REQUEST_ID" - }, - { - name: "GoCD", - constant: "GOCD", - env: "GO_PIPELINE_LABEL" - }, - { - name: "Google Cloud Build", - constant: "GOOGLE_CLOUD_BUILD", - env: "BUILDER_OUTPUT" - }, - { - name: "Harness CI", - constant: "HARNESS", - env: "HARNESS_BUILD_ID" - }, - { - name: "Heroku", - constant: "HEROKU", - env: { - env: "NODE", - includes: "/app/.heroku/node/bin/node" - } - }, - { - name: "Hudson", - constant: "HUDSON", - env: "HUDSON_URL" - }, - { - name: "Jenkins", - constant: "JENKINS", - env: [ - "JENKINS_URL", - "BUILD_ID" - ], - pr: { - any: [ - "ghprbPullId", - "CHANGE_ID" - ] - } - }, - { - name: "LayerCI", - constant: "LAYERCI", - env: "LAYERCI", - pr: "LAYERCI_PULL_REQUEST" - }, - { - name: "Magnum CI", - constant: "MAGNUM", - env: "MAGNUM" - }, - { - name: "Netlify CI", - constant: "NETLIFY", - env: "NETLIFY", - pr: { - env: "PULL_REQUEST", - ne: "false" - } - }, - { - name: "Nevercode", - constant: "NEVERCODE", - env: "NEVERCODE", - pr: { - env: "NEVERCODE_PULL_REQUEST", - ne: "false" - } - }, - { - name: "Prow", - constant: "PROW", - env: "PROW_JOB_ID" - }, - { - name: "ReleaseHub", - constant: "RELEASEHUB", - env: "RELEASE_BUILD_ID" - }, - { - name: "Render", - constant: "RENDER", - env: "RENDER", - pr: { - IS_PULL_REQUEST: "true" - } - }, - { - name: "Sail CI", - constant: "SAIL", - env: "SAILCI", - pr: "SAIL_PULL_REQUEST_NUMBER" - }, - { - name: "Screwdriver", - constant: "SCREWDRIVER", - env: "SCREWDRIVER", - pr: { - env: "SD_PULL_REQUEST", - ne: "false" - } - }, - { - name: "Semaphore", - constant: "SEMAPHORE", - env: "SEMAPHORE", - pr: "PULL_REQUEST_NUMBER" - }, - { - name: "Sourcehut", - constant: "SOURCEHUT", - env: { - CI_NAME: "sourcehut" - } - }, - { - name: "Strider CD", - constant: "STRIDER", - env: "STRIDER" - }, - { - name: "TaskCluster", - constant: "TASKCLUSTER", - env: [ - "TASK_ID", - "RUN_ID" - ] - }, - { - name: "TeamCity", - constant: "TEAMCITY", - env: "TEAMCITY_VERSION" - }, - { - name: "Travis CI", - constant: "TRAVIS", - env: "TRAVIS", - pr: { - env: "TRAVIS_PULL_REQUEST", - ne: "false" - } - }, - { - name: "Vela", - constant: "VELA", - env: "VELA", - pr: { - VELA_PULL_REQUEST: "1" - } - }, - { - name: "Vercel", - constant: "VERCEL", - env: { - any: [ - "NOW_BUILDER", - "VERCEL" - ] - }, - pr: "VERCEL_GIT_PULL_REQUEST_ID" - }, - { - name: "Visual Studio App Center", - constant: "APPCENTER", - env: "APPCENTER_BUILD_ID" - }, - { - name: "Woodpecker", - constant: "WOODPECKER", - env: { - CI: "woodpecker" - }, - pr: { - CI_BUILD_EVENT: "pull_request" - } - }, - { - name: "Xcode Cloud", - constant: "XCODE_CLOUD", - env: "CI_XCODE_PROJECT", - pr: "CI_PULL_REQUEST_NUMBER" - }, - { - name: "Xcode Server", - constant: "XCODE_SERVER", - env: "XCS" - } - ]; - } -}); - -// node_modules/ci-info/index.js -var require_ci_info = __commonJS({ - "node_modules/ci-info/index.js"(exports) { - "use strict"; - var vendors = require_vendors(); - var env = process.env; - Object.defineProperty(exports, "_vendors", { - value: vendors.map(function(v) { - return v.constant; - }) - }); - exports.name = null; - exports.isPR = null; - vendors.forEach(function(vendor) { - const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env]; - const isCI2 = envs.every(function(obj) { - return checkEnv(obj); - }); - exports[vendor.constant] = isCI2; - if (!isCI2) { - return; - } - exports.name = vendor.name; - switch (typeof vendor.pr) { - case "string": - exports.isPR = !!env[vendor.pr]; - break; - case "object": - if ("env" in vendor.pr) { - exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne; - } else if ("any" in vendor.pr) { - exports.isPR = vendor.pr.any.some(function(key) { - return !!env[key]; - }); - } else { - exports.isPR = checkEnv(vendor.pr); - } - break; - default: - exports.isPR = null; - } - }); - exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false' - (env.BUILD_ID || // Jenkins, Cloudbees - env.BUILD_NUMBER || // Jenkins, TeamCity - env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari - env.CI_APP_ID || // Appflow - env.CI_BUILD_ID || // Appflow - env.CI_BUILD_NUMBER || // Appflow - env.CI_NAME || // Codeship and others - env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI - env.RUN_ID || // TaskCluster, dsari - exports.name || false)); - function checkEnv(obj) { - if (typeof obj === "string") - return !!env[obj]; - if ("env" in obj) { - return env[obj.env] && env[obj.env].includes(obj.includes); - } - if ("any" in obj) { - return obj.any.some(function(k) { - return !!env[k]; - }); - } - return Object.keys(obj).every(function(k) { - return env[k] === obj[k]; - }); - } - } -}); - -// src/common/mockable.js -var import_lilconfig = __toESM(require_dist(), 1); -var import_find_parent_dir = __toESM(require_find_parent_dir(), 1); -import fs from "fs/promises"; - -// node_modules/get-stdin/index.js -var { stdin } = process; -async function getStdin() { - let result = ""; - if (stdin.isTTY) { - return result; - } - stdin.setEncoding("utf8"); - for await (const chunk of stdin) { - result += chunk; - } - return result; -} -getStdin.buffer = async () => { - const result = []; - let length = 0; - if (stdin.isTTY) { - return Buffer.concat([]); - } - for await (const chunk of stdin) { - result.push(chunk); - length += chunk.length; - } - return Buffer.concat(result, length); -}; - -// src/common/mockable.js -var import_ci_info = __toESM(require_ci_info(), 1); -function writeFormattedFile(file, data) { - return fs.writeFile(file, data); -} -var mockable = { - lilconfig: import_lilconfig.lilconfig, - findParentDir: import_find_parent_dir.sync, - getStdin, - isCI: () => import_ci_info.isCI, - writeFormattedFile -}; -var mockable_default = mockable; -export { - mockable_default as default -}; diff --git a/node_modules/prettier/package.json b/node_modules/prettier/package.json index 897fae4..1b27ec7 100644 --- a/node_modules/prettier/package.json +++ b/node_modules/prettier/package.json @@ -1,6 +1,6 @@ { "name": "prettier", - "version": "3.1.0", + "version": "3.2.5", "description": "Prettier is an opinionated code formatter", "bin": "./bin/prettier.cjs", "repository": "prettier/prettier", @@ -150,7 +150,6 @@ "index.d.ts", "index.mjs", "internal/cli.mjs", - "internal/internal.mjs", "package.json", "plugins/acorn.d.ts", "plugins/acorn.js", diff --git a/node_modules/prettier/plugins/acorn.js b/node_modules/prettier/plugins/acorn.js index 81a163e..a7c5ab8 100644 --- a/node_modules/prettier/plugins/acorn.js +++ b/node_modules/prettier/plugins/acorn.js @@ -1,13 +1,13 @@ -(function(n){function e(){var i=n();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.acorn=e()}})(function(){"use strict";var xi=Object.create;var ce=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var gi=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty;var Ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Si=(e,t)=>{for(var i in t)ce(e,i,{get:t[i],enumerable:!0})},tt=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gi(t))!bi.call(e,r)&&r!==i&&ce(e,r,{get:()=>t[r],enumerable:!(s=yi(t,r))||s.enumerable});return e};var Pe=(e,t,i)=>(i=e!=null?xi(vi(e)):{},tt(t||!e||!e.__esModule?ce(i,"default",{value:e,enumerable:!0}):i,e)),_i=e=>tt(ce({},"__esModule",{value:!0}),e);var Gt=Ae((Ys,Jt)=>{Jt.exports={}});var Ke=Ae(($s,Ge)=>{"use strict";var as=Gt(),ns=/^[\da-fA-F]+$/,os=/^\d+$/,Kt=new WeakMap;function Wt(e){e=e.Parser.acorn||e;let t=Kt.get(e);if(!t){let i=e.tokTypes,s=e.TokContext,r=e.TokenType,n=new s(" ... ",!0,!0),h={tc_oTag:n,tc_cTag:o,tc_expr:u},l={jsxName:new r("jsxName"),jsxText:new r("jsxText",{beforeExpr:!0}),jsxTagStart:new r("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new r("jsxTagEnd")};l.jsxTagStart.updateContext=function(){this.context.push(u),this.context.push(n),this.exprAllowed=!1},l.jsxTagEnd.updateContext=function(x){let _=this.context.pop();_===n&&x===i.slash||_===o?(this.context.pop(),this.exprAllowed=this.curContext()===u):this.exprAllowed=!0},t={tokContexts:h,tokTypes:l},Kt.set(e,t)}return t}function ne(e){if(!e)return e;if(e.type==="JSXIdentifier")return e.name;if(e.type==="JSXNamespacedName")return e.namespace.name+":"+e.name.name;if(e.type==="JSXMemberExpression")return ne(e.object)+"."+ne(e.property)}Ge.exports=function(e){return e=e||{},function(t){return us({allowNamespaces:e.allowNamespaces!==!1,allowNamespacedObjects:!!e.allowNamespacedObjects},t)}};Object.defineProperty(Ge.exports,"tokTypes",{get:function(){return Wt(void 0).tokTypes},configurable:!0,enumerable:!0});function us(e,t){let i=t.acorn||void 0,s=Wt(i),r=i.tokTypes,n=s.tokTypes,o=i.tokContexts,u=s.tokContexts.tc_oTag,h=s.tokContexts.tc_cTag,l=s.tokContexts.tc_expr,x=i.isNewLine,_=i.isIdentifierStart,B=i.isIdentifierChar;return class extends t{static get acornJsx(){return s}jsx_readToken(){let p="",d=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let m=this.input.charCodeAt(this.pos);switch(m){case 60:case 123:return this.pos===this.start?m===60&&this.exprAllowed?(++this.pos,this.finishToken(n.jsxTagStart)):this.getTokenFromCode(m):(p+=this.input.slice(d,this.pos),this.finishToken(n.jsxText,p));case 38:p+=this.input.slice(d,this.pos),p+=this.jsx_readEntity(),d=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(m===62?">":"}")+'` or `{"'+this.input[this.pos]+'"}`?');default:x(m)?(p+=this.input.slice(d,this.pos),p+=this.jsx_readNewLine(!0),d=this.pos):++this.pos}}}jsx_readNewLine(p){let d=this.input.charCodeAt(this.pos),m;return++this.pos,d===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,m=p?` +(function(n){function e(){var i=n();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.acorn=e()}})(function(){"use strict";var xi=Object.create;var ce=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var gi=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty;var Ee=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Si=(e,t)=>{for(var i in t)ce(e,i,{get:t[i],enumerable:!0})},et=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gi(t))!bi.call(e,r)&&r!==i&&ce(e,r,{get:()=>t[r],enumerable:!(s=yi(t,r))||s.enumerable});return e};var Ae=(e,t,i)=>(i=e!=null?xi(vi(e)):{},et(t||!e||!e.__esModule?ce(i,"default",{value:e,enumerable:!0}):i,e)),_i=e=>et(ce({},"__esModule",{value:!0}),e);var Jt=Ee((Ys,qt)=>{qt.exports={}});var Ge=Ee(($s,Je)=>{"use strict";var as=Jt(),ns=/^[\da-fA-F]+$/,os=/^\d+$/,Gt=new WeakMap;function Kt(e){e=e.Parser.acorn||e;let t=Gt.get(e);if(!t){let i=e.tokTypes,s=e.TokContext,r=e.TokenType,n=new s("... ",!0,!0),h={tc_oTag:n,tc_cTag:o,tc_expr:u},l={jsxName:new r("jsxName"),jsxText:new r("jsxText",{beforeExpr:!0}),jsxTagStart:new r("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new r("jsxTagEnd")};l.jsxTagStart.updateContext=function(){this.context.push(u),this.context.push(n),this.exprAllowed=!1},l.jsxTagEnd.updateContext=function(x){let _=this.context.pop();_===n&&x===i.slash||_===o?(this.context.pop(),this.exprAllowed=this.curContext()===u):this.exprAllowed=!0},t={tokContexts:h,tokTypes:l},Gt.set(e,t)}return t}function ne(e){if(!e)return e;if(e.type==="JSXIdentifier")return e.name;if(e.type==="JSXNamespacedName")return e.namespace.name+":"+e.name.name;if(e.type==="JSXMemberExpression")return ne(e.object)+"."+ne(e.property)}Je.exports=function(e){return e=e||{},function(t){return us({allowNamespaces:e.allowNamespaces!==!1,allowNamespacedObjects:!!e.allowNamespacedObjects},t)}};Object.defineProperty(Je.exports,"tokTypes",{get:function(){return Kt(void 0).tokTypes},configurable:!0,enumerable:!0});function us(e,t){let i=t.acorn||void 0,s=Kt(i),r=i.tokTypes,n=s.tokTypes,o=i.tokContexts,u=s.tokContexts.tc_oTag,h=s.tokContexts.tc_cTag,l=s.tokContexts.tc_expr,x=i.isNewLine,_=i.isIdentifierStart,B=i.isIdentifierChar;return class extends t{static get acornJsx(){return s}jsx_readToken(){let p="",d=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let m=this.input.charCodeAt(this.pos);switch(m){case 60:case 123:return this.pos===this.start?m===60&&this.exprAllowed?(++this.pos,this.finishToken(n.jsxTagStart)):this.getTokenFromCode(m):(p+=this.input.slice(d,this.pos),this.finishToken(n.jsxText,p));case 38:p+=this.input.slice(d,this.pos),p+=this.jsx_readEntity(),d=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(m===62?">":"}")+'` or `{"'+this.input[this.pos]+'"}`?');default:x(m)?(p+=this.input.slice(d,this.pos),p+=this.jsx_readNewLine(!0),d=this.pos):++this.pos}}}jsx_readNewLine(p){let d=this.input.charCodeAt(this.pos),m;return++this.pos,d===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,m=p?` `:`\r -`):m=String.fromCharCode(d),this.options.locations&&(++this.curLine,this.lineStart=this.pos),m}jsx_readString(p){let d="",m=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let g=this.input.charCodeAt(this.pos);if(g===p)break;g===38?(d+=this.input.slice(m,this.pos),d+=this.jsx_readEntity(),m=this.pos):x(g)?(d+=this.input.slice(m,this.pos),d+=this.jsx_readNewLine(!1),m=this.pos):++this.pos}return d+=this.input.slice(m,this.pos++),this.finishToken(r.string,d)}jsx_readEntity(){let p="",d=0,m,g=this.input[this.pos];g!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let E=++this.pos;for(;this.pos")}let Ee=E.name?"Element":"Fragment";return m["opening"+Ee]=E,m["closing"+Ee]=pe,m.children=g,this.type===r.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(m,"JSX"+Ee)}jsx_parseText(){let p=this.parseLiteral(this.value);return p.type="JSXText",p}jsx_parseElement(){let p=this.start,d=this.startLoc;return this.next(),this.jsx_parseElementAt(p,d)}parseExprAtom(p){return this.type===n.jsxText?this.jsx_parseText():this.type===n.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(p)}readToken(p){let d=this.curContext();if(d===l)return this.jsx_readToken();if(d===u||d===h){if(_(p))return this.jsx_readWord();if(p==62)return++this.pos,this.finishToken(n.jsxTagEnd);if((p===34||p===39)&&d==u)return this.jsx_readString(p)}return p===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(n.jsxTagStart)):super.readToken(p)}updateContext(p){if(this.type==r.braceL){var d=this.curContext();d==u?this.context.push(o.b_expr):d==l?this.context.push(o.b_tmpl):super.updateContext(p),this.exprAllowed=!0}else if(this.type===r.slash&&p===n.jsxTagStart)this.context.length-=2,this.context.push(h),this.exprAllowed=!1;else return super.updateContext(p)}}}});var Zt=Ae(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.extract=xs;X.parse=gs;X.parseWithComments=$t;X.print=vs;X.strip=ys;var cs=/\*\/$/,ls=/^\/\*\*?/,Qt=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,fs=/(^|\s+)\/\/([^\r\n]*)/g,Xt=/^(\r?\n)+/,ds=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,zt=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,ms=/(\r?\n|^) *\* ?/g,Yt=[];function xs(e){let t=e.match(Qt);return t?t[0].trimLeft():""}function ys(e){let t=e.match(Qt);return t&&t[0]?e.substring(t[0].length):e}function gs(e){return $t(e).pragmas}function $t(e){let t=` -`;e=e.replace(ls,"").replace(cs,"").replace(ms,"$1");let i="";for(;i!==e;)i=e,e=e.replace(ds,`${t}$1 $2${t}`);e=e.replace(Xt,"").trimRight();let s=Object.create(null),r=e.replace(zt,"").replace(Xt,"").trimRight(),n;for(;n=zt.exec(e);){let o=n[2].replace(fs,"");typeof s[n[1]]=="string"||Array.isArray(s[n[1]])?s[n[1]]=Yt.concat(s[n[1]],o):s[n[1]]=o}return{comments:r,pragmas:s}}function vs({comments:e="",pragmas:t={}}){let i=` -`,s="/**",r=" *",n=" */",o=Object.keys(t),u=o.flatMap(l=>Ht(l,t[l])).map(l=>`${r} ${l}${i}`).join("");if(!e){if(o.length===0)return"";if(o.length===1&&!Array.isArray(t[o[0]])){let l=t[o[0]];return`${s} ${Ht(o[0],l)[0]}${n}`}}let h=e.split(i).map(l=>`${r} ${l}`).join(i)+i;return s+i+(e?h:"")+(e&&o.length?r+i:"")+u+n}function Ht(e,t){return Yt.concat(t).map(i=>`@${e} ${i}`.trim())}});var Hs={};Si(Hs,{parsers:()=>zs});var Ci=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,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,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,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,406,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,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,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,983,6,110,6,6,9,4759,9,787719,239],ot=[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,68,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,349,41,7,1,79,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,159,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,264,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,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,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,757,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],Ti="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",ut="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Ie={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"},Ne="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",ki={5:Ne,"5module":Ne+" export import",6:Ne+" const class extends export import super"},wi=/^in(stanceof)?$/,Ei=new RegExp("["+ut+"]"),Ai=new RegExp("["+ut+Ti+"]");function Le(e,t){for(var i=65536,s=0;s e)return!1;if(i+=t[s+1],i>=e)return!0}return!1}function U(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ei.test(String.fromCharCode(e)):t===!1?!1:Le(e,ot)}function H(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ai.test(String.fromCharCode(e)):t===!1?!1:Le(e,ot)||Le(e,Ci)}var S=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function I(e,t){return new S(e,{beforeExpr:!0,binop:t})}var N={beforeExpr:!0},A={startsExpr:!0},Be={};function b(e,t){return t===void 0&&(t={}),t.keyword=e,Be[e]=new S(e,t)}var a={num:new S("num",A),regexp:new S("regexp",A),string:new S("string",A),name:new S("name",A),privateId:new S("privateId",A),eof:new S("eof"),bracketL:new S("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new S("]"),braceL:new S("{",{beforeExpr:!0,startsExpr:!0}),braceR:new S("}"),parenL:new S("(",{beforeExpr:!0,startsExpr:!0}),parenR:new S(")"),comma:new S(",",N),semi:new S(";",N),colon:new S(":",N),dot:new S("."),question:new S("?",N),questionDot:new S("?."),arrow:new S("=>",N),template:new S("template"),invalidTemplate:new S("invalidTemplate"),ellipsis:new S("...",N),backQuote:new S("`",A),dollarBraceL:new S("${",{beforeExpr:!0,startsExpr:!0}),eq:new S("=",{beforeExpr:!0,isAssign:!0}),assign:new S("_=",{beforeExpr:!0,isAssign:!0}),incDec:new S("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new S("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:I("||",1),logicalAND:I("&&",2),bitwiseOR:I("|",3),bitwiseXOR:I("^",4),bitwiseAND:I("&",5),equality:I("==/!=/===/!==",6),relational:I(">/<=/>=",7),bitShift:I("<>>/>>>",8),plusMin:new S("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:I("%",10),star:I("*",10),slash:I("/",10),starstar:new S("**",{beforeExpr:!0}),coalesce:I("??",1),_break:b("break"),_case:b("case",N),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",N),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",N),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",A),_if:b("if"),_return:b("return",N),_switch:b("switch"),_throw:b("throw",N),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",A),_super:b("super",A),_class:b("class",A),_extends:b("extends",N),_export:b("export"),_import:b("import",A),_null:b("null",A),_true:b("true",A),_false:b("false",A),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},R=/\r\n?|\n|\u2028|\u2029/,Pi=new RegExp(R.source,"g");function Q(e){return e===10||e===13||e===8232||e===8233}function ht(e,t,i){i===void 0&&(i=e.length);for(var s=t;s>10)+55296,(e&1023)+56320))}var Vi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,te=function(t,i){this.line=t,this.column=i};te.prototype.offset=function(t){return new te(this.line,this.column+t)};var xe=function(t,i,s){this.start=i,this.end=s,t.sourceFile!==null&&(this.source=t.sourceFile)};function lt(e,t){for(var i=1,s=0;;){var r=ht(e,s,t);if(r<0)return new te(i,t-s);++i,s=r}}var Re={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},rt=!1;function Li(e){var t={};for(var i in Re)t[i]=e&&se(e,i)?e[i]:Re[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!rt&&typeof console=="object"&&console.warn&&(rt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required. -Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),it(t.onToken)){var s=t.onToken;t.onToken=function(r){return s.push(r)}}return it(t.onComment)&&(t.onComment=Ri(t,t.onComment)),t}function Ri(e,t){return function(i,s,r,n,o,u){var h={type:i?"Block":"Line",value:s,start:r,end:n};e.locations&&(h.loc=new xe(this,o,u)),e.ranges&&(h.range=[r,n]),t.push(h)}}var ie=1,Y=2,De=4,ft=8,dt=16,mt=32,Fe=64,xt=128,re=256,Me=ie|Y|re;function je(e,t){return Y|(e?De:0)|(t?ft:0)}var fe=0,Ue=1,J=2,yt=3,gt=4,vt=5,T=function(t,i,s){this.options=t=Li(t),this.sourceFile=t.sourceFile,this.keywords=G(ki[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var r="";t.allowReserved!==!0&&(r=Ie[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(r+=" await")),this.reservedWords=G(r);var n=(r?r+" ":"")+Ie.strict;this.reservedWordsStrict=G(n),this.reservedWordsStrictBind=G(n+" "+Ie.strictBind),this.input=String(i),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf(` -`,s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(R).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ie),this.regexpState=null,this.privateNameStack=[]},F={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}};T.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};F.inFunction.get=function(){return(this.currentVarScope().flags&Y)>0};F.inGenerator.get=function(){return(this.currentVarScope().flags&ft)>0&&!this.currentVarScope().inClassFieldInit};F.inAsync.get=function(){return(this.currentVarScope().flags&De)>0&&!this.currentVarScope().inClassFieldInit};F.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&re)return!1;if(t.flags&Y)return(t.flags&De)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};F.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Fe)>0||i||this.options.allowSuperOutsideMethod};F.allowDirectSuper.get=function(){return(this.currentThisScope().flags&xt)>0};F.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};F.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Y|re))>0||i};F.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&re)>0};T.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var s=this,r=0;r =,?^&]/.test(r)||r==="!"&&this.input.charAt(s+1)==="=")}e+=t[0].length,V.lastIndex=e,e+=V.exec(this.input)[0].length,this.input[e]===";"&&e++}};k.eat=function(e){return this.type===e?(this.next(),!0):!1};k.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc};k.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};k.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};k.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||R.test(this.input.slice(this.lastTokEnd,this.start))};k.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};k.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()};k.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};k.expect=function(e){this.eat(e)||this.unexpected()};k.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var ye=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};k.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};k.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,s=e.doubleProto;if(!t)return i>=0||s>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")};k.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos 55295&&s<56320)return!0;if(U(s,!0)){for(var r=i+1;H(s=this.input.charCodeAt(r),!0);)++r;if(s===92||s>55295&&s<56320)return!0;var n=this.input.slice(i,r);if(!wi.test(n))return!0}return!1};f.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;V.lastIndex=this.pos;var e=V.exec(this.input),t=this.pos+e[0].length,i;return!R.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(H(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};f.parseStatement=function(e,t,i){var s=this.type,r=this.startNode(),n;switch(this.isLet(e)&&(s=a._var,n="let"),s){case a._break:case a._continue:return this.parseBreakContinueStatement(r,s.keyword);case a._debugger:return this.parseDebuggerStatement(r);case a._do:return this.parseDoStatement(r);case a._for:return this.parseForStatement(r);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(r,!0);case a._if:return this.parseIfStatement(r);case a._return:return this.parseReturnStatement(r);case a._switch:return this.parseSwitchStatement(r);case a._throw:return this.parseThrowStatement(r);case a._try:return this.parseTryStatement(r);case a._const:case a._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(r,n);case a._while:return this.parseWhileStatement(r);case a._with:return this.parseWithStatement(r);case a.braceL:return this.parseBlock(!0,r);case a.semi:return this.parseEmptyStatement(r);case a._export:case a._import:if(this.options.ecmaVersion>10&&s===a._import){V.lastIndex=this.pos;var o=V.exec(this.input),u=this.pos+o[0].length,h=this.input.charCodeAt(u);if(h===40||h===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===a._import?this.parseImport(r):this.parseExport(r,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var l=this.value,x=this.parseExpression();return s===a.name&&x.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(r,l,x,e):this.parseExpressionStatement(r,x)}};f.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var s=0;s =6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};f.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(qe),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var s=this.startNode(),r=i?"let":this.value;return this.next(),this.parseVar(s,!0,r),this.finishNode(s,"VariableDeclaration"),(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&s.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,s)):(t>-1&&this.unexpected(t),this.parseFor(e,s))}var n=this.isContextual("let"),o=!1,u=new ye,h=this.parseExpression(t>-1?"await":!0,u);return this.type===a._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),n&&o&&this.raise(h.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(h,!1,u),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))};f.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,ee|(i?0:Oe),!1,t)};f.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};f.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};f.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(Bi),this.enterScope(0);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var s=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),s?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};f.parseThrowStatement=function(e){return this.next(),R.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Di=[];f.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?mt:0),this.checkLValPattern(e,t?gt:J),this.expect(a.parenR),e};f.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};f.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};f.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(qe),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};f.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};f.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};f.parseLabeledStatement=function(e,t,i,s){for(var r=0,n=this.labels;r =0;h--){var l=this.labels[h];if(l.statementStart===e.start)l.statementStart=this.start,l.kind=u;else break}return this.labels.push({name:t,kind:u,statementStart:this.start}),e.body=this.parseStatement(s?s.indexOf("label")===-1?s+"label":s:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};f.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};f.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var s=this.parseStatement(null);t.body.push(s)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};f.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};f.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};f.parseVar=function(e,t,i,s){for(e.declarations=[],e.kind=i;;){var r=this.startNode();if(this.parseVarId(r,i),this.eat(a.eq)?r.init=this.parseMaybeAssign(t):!s&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!s&&r.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(a.comma))break}return e};f.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Ue:J,!1)};var ee=1,Oe=2,bt=4;f.parseFunction=function(e,t,i,s,r){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===a.star&&t&Oe&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!s),t&ee&&(e.id=t&bt&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Oe)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ue:J:yt));var n=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(e.async,e.generator)),t&ee||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,r),this.yieldPos=n,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(e,t&ee?"FunctionDeclaration":"FunctionExpression")};f.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};f.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var s=this.enterClassBody(),r=this.startNode(),n=!1;for(r.body=[],this.expect(a.braceL);this.type!==a.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(r.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(n&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),n=!0):o.key&&o.key.type==="PrivateIdentifier"&&Fi(s,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};f.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),s="",r=!1,n=!1,o="method",u=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?u=!0:s="static"}if(i.static=u,!s&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?n=!0:s="async"),!s&&(t>=9||!n)&&this.eat(a.star)&&(r=!0),!s&&!n&&!r){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=h:s=h)}if(s?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=s,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||o!=="method"||r||n){var l=!i.static&&de(i,"constructor"),x=l&&e;l&&o!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=l?"constructor":o,this.parseClassMethod(i,r,n,x)}else this.parseClassField(i);return i};f.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword};f.parseClassElementName=function(e){this.type===a.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};f.parseClassMethod=function(e,t,i,s){var r=e.key;e.kind==="constructor"?(t&&this.raise(r.start,"Constructor can't be a generator"),i&&this.raise(r.start,"Constructor can't be an async method")):e.static&&de(e,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,s);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};f.parseClassField=function(e){if(de(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&de(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};f.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(re|Fe);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};f.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,J,!1)):(t===!0&&this.unexpected(),e.id=null)};f.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null};f.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};f.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var s=this.privateNameStack.length,r=s===0?null:this.privateNameStack[s-1],n=0;n =11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};f.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var i=0,s=e.specifiers;i =13&&this.type===a.string){var e=this.parseLiteral(this.value);return Vi.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};f.adaptDirectivePrologue=function(e){for(var t=0;t =5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var O=T.prototype;O.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var s=0,r=e.properties;s =6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()};O.parseBindingList=function(e,t,i,s){for(var r=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(a.comma),t&&this.type===a.comma)r.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),r.push(o),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else r.push(this.parseAssignableListItem(s))}return r};O.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};O.parseBindingListItem=function(e){return e};O.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var s=this.startNodeAt(e,t);return s.left=i,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")};O.checkLValSimple=function(e,t,i){t===void 0&&(t=fe);var s=t!==fe;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(s?"Binding ":"Assigning to ")+e.name+" in strict mode"),s&&(t===J&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(se(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==vt&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":s&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return s&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(s?"Binding":"Assigning to")+" rvalue")}};O.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=fe),e.type){case"ObjectPattern":for(var s=0,r=e.properties;s =1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};$.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};$.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===C.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?C.b_stat:C.b_expr),this.exprAllowed=!0};a.dollarBraceL.updateContext=function(){this.context.push(C.b_tmpl),this.exprAllowed=!0};a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?C.p_stat:C.p_expr),this.exprAllowed=!0};a.incDec.updateContext=function(){};a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==C.p_stat)&&!(e===a._return&&R.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===C.b_stat)?this.context.push(C.f_expr):this.context.push(C.f_stat),this.exprAllowed=!1};a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};a.backQuote.updateContext=function(){this.curContext()===C.q_tmpl?this.context.pop():this.context.push(C.q_tmpl),this.exprAllowed=!1};a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===C.f_expr?this.context[t]=C.f_expr_gen:this.context[t]=C.f_gen}this.exprAllowed=!0};a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var y=T.prototype;y.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var s=e.key,r;switch(s.type){case"Identifier":r=s.name;break;case"Literal":r=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);return}r="$"+r;var o=t[r];if(o){var u;n==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[n],u&&this.raiseRecoverable(s.start,"Redefinition of property")}else o=t[r]={init:!1,get:!1,set:!1};o[n]=!0}};y.parseExpression=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeAssign(e,t);if(this.type===a.comma){var n=this.startNodeAt(i,s);for(n.expressions=[r];this.eat(a.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return r};y.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var s=!1,r=-1,n=-1,o=-1;t?(r=t.parenthesizedAssign,n=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ye,s=!0);var u=this.start,h=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var l=this.parseMaybeConditional(e,t);if(i&&(l=i.call(this,l,u,h)),this.type.isAssign){var x=this.startNodeAt(u,h);return x.operator=this.value,this.type===a.eq&&(l=this.toAssignable(l,!1,t)),s||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(l):this.checkLValSimple(l),x.left=l,this.next(),x.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(x,"AssignmentExpression")}else s&&this.checkExpressionErrors(t,!0);return r>-1&&(t.parenthesizedAssign=r),n>-1&&(t.trailingComma=n),l};y.parseMaybeConditional=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return r;if(this.eat(a.question)){var n=this.startNodeAt(i,s);return n.test=r,n.consequent=this.parseMaybeAssign(),this.expect(a.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return r};y.parseExprOps=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||r.start===i&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,i,s,-1,e)};y.parseExprOp=function(e,t,i,s,r){var n=this.type.binop;if(n!=null&&(!r||this.type!==a._in)&&n>s){var o=this.type===a.logicalOR||this.type===a.logicalAND,u=this.type===a.coalesce;u&&(n=a.logicalAND.binop);var h=this.value;this.next();var l=this.start,x=this.startLoc,_=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,r),l,x,n,r),B=this.buildBinary(t,i,e,_,h,o||u);return(o&&this.type===a.coalesce||u&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(B,t,i,s,r)}return e};y.buildBinary=function(e,t,i,s,r,n){s.type==="PrivateIdentifier"&&this.raise(s.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=i,o.operator=r,o.right=s,this.finishNode(o,n?"LogicalExpression":"BinaryExpression")};y.parseMaybeUnary=function(e,t,i,s){var r=this.start,n=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(s),t=!0;else if(this.type.prefix){var u=this.startNode(),h=this.type===a.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,h,s),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&u.argument.type==="Identifier"?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&St(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=!0,o=this.finishNode(u,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(s||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,s),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,n);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(r,n,o,this.parseMaybeUnary(null,!1,!1,s),"**",!1);else return o};function St(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&St(e.expression)}y.parseExprSubscripts=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprAtom(e,t);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var n=this.parseSubscripts(r,i,s,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};y.parseSubscripts=function(e,t,i,s,r){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var u=this.parseSubscript(e,t,i,s,n,o,r);if(u.optional&&(o=!0),u===e||u.type==="ArrowFunctionExpression"){if(o){var h=this.startNodeAt(t,i);h.expression=u,u=this.finishNode(h,"ChainExpression")}return u}e=u}};y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)};y.parseSubscriptAsyncArrow=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,s)};y.parseSubscript=function(e,t,i,s,r,n,o){var u=this.options.ecmaVersion>=11,h=u&&this.eat(a.questionDot);s&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(a.bracketL);if(l||h&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var x=this.startNodeAt(t,i);x.object=e,l?(x.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?x.property=this.parsePrivateIdent():x.property=this.parseIdent(this.options.allowReserved!=="never"),x.computed=!!l,u&&(x.optional=h),e=this.finishNode(x,"MemberExpression")}else if(!s&&this.eat(a.parenL)){var _=new ye,B=this.yieldPos,p=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,_);if(r&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=B,this.awaitPos=p,this.awaitIdentPos=d,this.parseSubscriptAsyncArrow(t,i,m,o);this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var g=this.startNodeAt(t,i);g.callee=e,g.arguments=m,u&&(g.optional=h),e=this.finishNode(g,"CallExpression")}else if(this.type===a.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e};y.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var s,r=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),s=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(s.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(s,"Super");case a._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case a.name:var n=this.start,o=this.startLoc,u=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(C.f_expr),this.parseFunction(this.startNodeAt(n,o),0,!1,!0,t);if(r&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(n,o),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===a.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,o),[h],!0,t)}return h;case a.regexp:var l=this.value;return s=this.parseLiteral(l.value),s.regex={pattern:l.pattern,flags:l.flags},s;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return s=this.startNode(),s.value=this.type===a._null?null:this.type===a._true,s.raw=this.type.keyword,this.next(),this.finishNode(s,"Literal");case a.parenL:var x=this.start,_=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(_)&&(e.parenthesizedAssign=x),e.parenthesizedBind<0&&(e.parenthesizedBind=x)),_;case a.bracketL:return s=this.startNode(),this.next(),s.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(s,"ArrayExpression");case a.braceL:return this.overrideContext(C.b_expr),this.parseObj(!1,e);case a._function:return s=this.startNode(),this.next(),this.parseFunction(s,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};y.parseExprAtomDefault=function(){this.unexpected()};y.parseExprImport=function(e){var t=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var i=this.parseIdent(!0);if(this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot)return t.meta=i,this.parseImportMeta(t);this.unexpected()};y.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};y.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};y.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};y.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e};y.shouldParseArrow=function(e){return!this.canInsertSemicolon()};y.parseParenAndDistinguishExpression=function(e,t){var i=this.start,s=this.startLoc,r,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,h=[],l=!0,x=!1,_=new ye,B=this.yieldPos,p=this.awaitPos,d;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(l?l=!1:this.expect(a.comma),n&&this.afterTrailingComma(a.parenR,!0)){x=!0;break}else if(this.type===a.ellipsis){d=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,_,this.parseParenItem));var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(h)&&this.eat(a.arrow))return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=B,this.awaitPos=p,this.parseParenArrowList(i,s,h,t);(!h.length||x)&&this.unexpected(this.lastTokStart),d&&this.unexpected(d),this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(r=this.startNodeAt(o,u),r.expressions=h,this.finishNodeAt(r,"SequenceExpression",m,g)):r=h[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,s);return E.expression=r,this.finishNode(E,"ParenthesizedExpression")}else return r};y.parseParenItem=function(e){return e};y.parseParenArrowList=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,s)};var Mi=[];y.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===a.dot){var t=this.startNodeAt(e.start,e.startLoc);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var s=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),s,r,!0,!1),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Mi,this.finishNode(e,"NewExpression")};y.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value,cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,` -`),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")};y.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var s=this.parseTemplateElement({isTagged:t});for(i.quasis=[s];!s.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(s=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};y.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!R.test(this.input.slice(this.lastTokEnd,this.start))};y.parseObj=function(e,t){var i=this.startNode(),s=!0,r={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(s)s=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,r,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};y.parseProperty=function(e,t){var i=this.startNode(),s,r,n,o;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,o=this.startLoc),e||(s=this.eat(a.star)));var u=this.containsEsc;return this.parsePropertyName(i),!e&&!u&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(i)?(r=!0,s=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):r=!1,this.parsePropertyValue(i,e,s,r,n,o,t,u),this.finishNode(i,"Property")};y.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};y.parsePropertyValue=function(e,t,i,s,r,n,o,u){(i||s)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,s)):!t&&!u&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||s)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||s)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),e.kind="init",t?e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key)):this.type===a.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};y.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};y.parseMethod=function(e,t,i){var s=this.startNode(),r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=e),this.options.ecmaVersion>=8&&(s.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(t,s.generator)|Fe|(i?xt:0)),this.expect(a.parenL),s.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0,!1),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(s,"FunctionExpression")};y.parseArrowExpression=function(e,t,i,s){var r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(je(i,!1)|dt),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,s),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};y.parseFunctionBody=function(e,t,i,s){var r=t&&this.type!==a.braceL,n=this.strict,o=!1;if(r)e.body=this.parseMaybeAssign(s),e.expression=!0,this.checkParams(e,!1);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!n&&!o&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,vt),e.body=this.parseBlock(!1,void 0,o&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()};y.isSimpleParamList=function(e){for(var t=0,i=e;t -1||r.functions.indexOf(e)>-1||r.var.indexOf(e)>-1,r.lexical.push(e),this.inModule&&r.flags&ie&&delete this.undefinedExports[e]}else if(t===gt){var n=this.currentScope();n.lexical.push(e)}else if(t===yt){var o=this.currentScope();this.treatFunctionsAsVar?s=o.lexical.indexOf(e)>-1:s=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var u=this.scopeStack.length-1;u>=0;--u){var h=this.scopeStack[u];if(h.lexical.indexOf(e)>-1&&!(h.flags&mt&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){s=!0;break}if(h.var.push(e),this.inModule&&h.flags&ie&&delete this.undefinedExports[e],h.flags&Me)break}s&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};W.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};W.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};W.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Me)return t}};W.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Me&&!(t.flags&dt))return t}};var ge=function(t,i,s){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new xe(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ae=T.prototype;ae.startNode=function(){return new ge(this,this.start,this.startLoc)};ae.startNodeAt=function(e,t){return new ge(this,e,t)};function _t(e,t,i,s){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=s),this.options.ranges&&(e.range[1]=i),e}ae.finishNode=function(e,t){return _t.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};ae.finishNodeAt=function(e,t,i,s){return _t.call(this,e,t,i,s)};ae.copyNode=function(e){var t=new ge(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var 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",Tt=Ct+" Extended_Pictographic",kt=Tt,wt=kt+" EBase EComp EMod EPres ExtPict",Et=wt,Ui=Et,qi={9:Ct,10:Tt,11:kt,12:wt,13:Et,14:Ui},Ji="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Gi={9:"",10:"",11:"",12:"",13:"",14:Ji},at="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",At="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",Pt=At+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",It=Pt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Nt=It+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Vt=Nt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ki=Vt+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",Wi={9:At,10:Pt,11:It,12:Nt,13:Vt,14:Ki},Lt={};function Xi(e){var t=Lt[e]={binary:G(qi[e]+" "+at),binaryOfStrings:G(Gi[e]),nonBinary:{General_Category:G(at),Script:G(Wi[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(le=0,Ve=[9,10,11,12,13,14];le =6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Lt[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=[],this.backReferenceNames=[]};M.prototype.reset=function(t,i,s){var r=s.indexOf("v")!==-1,n=s.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=s,r&&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)};M.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};M.prototype.at=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return-1;var n=s.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=r)return n;var o=s.charCodeAt(t+1);return o>=56320&&o<=57343?(n<<10)+o-56613888:n};M.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return r;var n=s.charCodeAt(t),o;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=r||(o=s.charCodeAt(t+1))<56320||o>57343?t+1:t+2};M.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};M.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};M.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};M.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};M.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var s=this.pos,r=0,n=t;r -1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(s=!0),o==="v"&&(r=!0)}this.options.ecmaVersion>=15&&s&&r&&this.raise(e.start,"Invalid regular expression flag")};c.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};c.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t =9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};c.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};c.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};c.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var s=0,r=-1;if(this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue),e.eat(125)))return r!==-1&&r =9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};c.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};c.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};c.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Rt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Rt(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}c.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Rt(i);)e.advance();return e.pos!==t};c.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};c.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};c.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};c.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=K(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=K(e.lastIntValue);return!0}return!1};c.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),zi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function zi(e){return U(e,!0)||e===36||e===95}c.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),Hi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function Hi(e){return H(e,!0)||e===36||e===95||e===8204||e===8205}c.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};c.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};c.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};c.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};c.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};c.regexp_eatZero=function(e){return e.current()===48&&!ve(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};c.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};c.regexp_eatControlLetter=function(e){var t=e.current();return Ot(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ot(e){return e>=65&&e<=90||e>=97&&e<=122}c.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var r=e.lastIntValue;if(s&&r>=55296&&r<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(r-55296)*1024+(o-56320)+65536,!0}e.pos=n,e.lastIntValue=r}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Qi(e.lastIntValue))return!0;s&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Qi(e){return e>=0&&e<=1114111}c.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};c.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Bt=0,q=1,L=2;c.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Yi(t))return e.lastIntValue=-1,e.advance(),q;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var s;if(e.eat(123)&&(s=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&s===L&&e.raise("Invalid property name"),s;e.raise("Invalid property name")}return Bt};function Yi(e){return e===100||e===68||e===115||e===83||e===119||e===87}c.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,s),q}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,r)}return Bt};c.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){se(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};c.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return q;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return L;e.raise("Invalid property name")};c.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Dt(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function Dt(e){return Ot(e)||e===95}c.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";$i(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function $i(e){return Dt(e)||ve(e)}c.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};c.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===L&&e.raise("Negated character class may contain strings"),!0}return!1};c.regexp_classContents=function(e){return e.current()===93?q:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),q)};c.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};c.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||jt(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var s=e.current();return s!==93?(e.lastIntValue=s,e.advance(),!0):!1};c.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};c.regexp_classSetExpression=function(e){var t=q,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===L&&(t=L);for(var s=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==L&&(t=q);continue}e.raise("Invalid character in character class")}if(s!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(s!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===L&&(t=L)}};c.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;return i!==-1&&s!==-1&&i>s&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};c.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?q:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};c.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),s=this.regexp_classContents(e);if(e.eat(93))return i&&s===L&&e.raise("Negated character class may contain strings"),s;e.pos=t}if(e.eat(92)){var r=this.regexp_eatCharacterClassEscape(e);if(r)return r;e.pos=t}return null};c.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null};c.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===L&&(t=L);return t};c.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?q:L};c.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Zi(i)||es(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Zi(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function es(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}c.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ts(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ts(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}c.regexp_eatClassControlLetter=function(e){var t=e.current();return ve(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};c.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};c.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ve(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ve(e){return e>=48&&e<=57}c.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Ft(i=e.current());)e.lastIntValue=16*e.lastIntValue+Mt(i),e.advance();return e.pos!==t};function Ft(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Mt(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}c.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};c.regexp_eatOctalDigit=function(e){var t=e.current();return jt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function jt(e){return e>=48&&e<=55}c.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var s=0;s=this.input.length)return this.finishToken(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};v.readToken=function(e){return U(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};v.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};v.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var s=void 0,r=t;(s=ht(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=s;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};v.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=e);this.pos 8&&e<14||e>=5760&&pt.test(String.fromCharCode(e)))++this.pos;else break e}}};v.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};v.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(a.ellipsis)):(++this.pos,this.finishToken(a.dot))};v.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)};v.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,s=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,s=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(s,i)};v.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)};v.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)};v.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||R.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)};v.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(a.relational,i))};v.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)};v.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)};v.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),U(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+K(t)+"'")};v.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+K(e)+"'")};v.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};v.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(R.test(s)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(s==="[")t=!0;else if(s==="]"&&t)t=!1;else if(s==="/"&&!t)break;e=s==="\\"}++this.pos}var r=this.input.slice(i,this.pos);++this.pos;var n=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(n);var u=this.regexpState||(this.regexpState=new M(this));u.reset(i,r,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var h=null;try{h=new RegExp(r,o)}catch{}return this.finishToken(a.regexp,{pattern:r,flags:o,value:h})};v.readInt=function(e,t,i){for(var s=this.options.ecmaVersion>=12&&t===void 0,r=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,o=0,u=0,h=0,l=t??1/0;h =97?_=x-97+10:x>=65?_=x-65+10:x>=48&&x<=57?_=x-48:_=1/0,_>=e)break;u=x,o=o*e+_}return s&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:o};function is(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ut(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}v.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Ut(this.input.slice(t,this.pos)),++this.pos):U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)};v.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&s===110){var r=Ut(this.input.slice(t,this.pos));return++this.pos,U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,r)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),s===46&&!i&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(s===69||s===101)&&!i&&(s=this.input.charCodeAt(++this.pos),(s===43||s===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=is(this.input.slice(t,this.pos),i);return this.finishToken(a.num,n)};v.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};v.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===e)break;s===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):s===8232||s===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Q(s)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var qt={};v.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===qt)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};v.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw qt;this.raise(e,t)};v.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Q(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=` +`):m=String.fromCharCode(d),this.options.locations&&(++this.curLine,this.lineStart=this.pos),m}jsx_readString(p){let d="",m=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let g=this.input.charCodeAt(this.pos);if(g===p)break;g===38?(d+=this.input.slice(m,this.pos),d+=this.jsx_readEntity(),m=this.pos):x(g)?(d+=this.input.slice(m,this.pos),d+=this.jsx_readNewLine(!1),m=this.pos):++this.pos}return d+=this.input.slice(m,this.pos++),this.finishToken(r.string,d)}jsx_readEntity(){let p="",d=0,m,g=this.input[this.pos];g!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let E=++this.pos;for(;this.pos ")}let we=E.name?"Element":"Fragment";return m["opening"+we]=E,m["closing"+we]=pe,m.children=g,this.type===r.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(m,"JSX"+we)}jsx_parseText(){let p=this.parseLiteral(this.value);return p.type="JSXText",p}jsx_parseElement(){let p=this.start,d=this.startLoc;return this.next(),this.jsx_parseElementAt(p,d)}parseExprAtom(p){return this.type===n.jsxText?this.jsx_parseText():this.type===n.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(p)}readToken(p){let d=this.curContext();if(d===l)return this.jsx_readToken();if(d===u||d===h){if(_(p))return this.jsx_readWord();if(p==62)return++this.pos,this.finishToken(n.jsxTagEnd);if((p===34||p===39)&&d==u)return this.jsx_readString(p)}return p===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(n.jsxTagStart)):super.readToken(p)}updateContext(p){if(this.type==r.braceL){var d=this.curContext();d==u?this.context.push(o.b_expr):d==l?this.context.push(o.b_tmpl):super.updateContext(p),this.exprAllowed=!0}else if(this.type===r.slash&&p===n.jsxTagStart)this.context.length-=2,this.context.push(h),this.exprAllowed=!1;else return super.updateContext(p)}}}});var ai=Ee(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.extract=ws;X.parse=As;X.parseWithComments=ri;X.print=Ps;X.strip=Es;var Ss=/\*\/$/,_s=/^\/\*\*?/,ii=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,Cs=/(^|\s+)\/\/([^\r\n]*)/g,Zt=/^(\r?\n)+/,Ts=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,ei=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,ks=/(\r?\n|^) *\* ?/g,si=[];function ws(e){let t=e.match(ii);return t?t[0].trimLeft():""}function Es(e){let t=e.match(ii);return t&&t[0]?e.substring(t[0].length):e}function As(e){return ri(e).pragmas}function ri(e){let t=` +`;e=e.replace(_s,"").replace(Ss,"").replace(ks,"$1");let i="";for(;i!==e;)i=e,e=e.replace(Ts,`${t}$1 $2${t}`);e=e.replace(Zt,"").trimRight();let s=Object.create(null),r=e.replace(ei,"").replace(Zt,"").trimRight(),n;for(;n=ei.exec(e);){let o=n[2].replace(Cs,"");typeof s[n[1]]=="string"||Array.isArray(s[n[1]])?s[n[1]]=si.concat(s[n[1]],o):s[n[1]]=o}return{comments:r,pragmas:s}}function Ps({comments:e="",pragmas:t={}}){let i=` +`,s="/**",r=" *",n=" */",o=Object.keys(t),u=o.flatMap(l=>ti(l,t[l])).map(l=>`${r} ${l}${i}`).join("");if(!e){if(o.length===0)return"";if(o.length===1&&!Array.isArray(t[o[0]])){let l=t[o[0]];return`${s} ${ti(o[0],l)[0]}${n}`}}let h=e.split(i).map(l=>`${r} ${l}`).join(i)+i;return s+i+(e?h:"")+(e&&o.length?r+i:"")+u+n}function ti(e,t){return si.concat(t).map(i=>`@${e} ${i}`.trim())}});var Hs={};Si(Hs,{parsers:()=>zs});var Ci=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,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,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,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,406,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,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,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,983,6,110,6,6,9,4759,9,787719,239],nt=[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,68,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,349,41,7,1,79,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,159,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,264,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,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,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,757,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],Ti="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",ot="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Pe={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"},Ie="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",ki={5:Ie,"5module":Ie+" export import",6:Ie+" const class extends export import super"},wi=/^in(stanceof)?$/,Ei=new RegExp("["+ot+"]"),Ai=new RegExp("["+ot+Ti+"]");function Ve(e,t){for(var i=65536,s=0;s e)return!1;if(i+=t[s+1],i>=e)return!0}return!1}function U(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ei.test(String.fromCharCode(e)):t===!1?!1:Ve(e,nt)}function H(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ai.test(String.fromCharCode(e)):t===!1?!1:Ve(e,nt)||Ve(e,Ci)}var S=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function I(e,t){return new S(e,{beforeExpr:!0,binop:t})}var N={beforeExpr:!0},A={startsExpr:!0},Oe={};function b(e,t){return t===void 0&&(t={}),t.keyword=e,Oe[e]=new S(e,t)}var a={num:new S("num",A),regexp:new S("regexp",A),string:new S("string",A),name:new S("name",A),privateId:new S("privateId",A),eof:new S("eof"),bracketL:new S("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new S("]"),braceL:new S("{",{beforeExpr:!0,startsExpr:!0}),braceR:new S("}"),parenL:new S("(",{beforeExpr:!0,startsExpr:!0}),parenR:new S(")"),comma:new S(",",N),semi:new S(";",N),colon:new S(":",N),dot:new S("."),question:new S("?",N),questionDot:new S("?."),arrow:new S("=>",N),template:new S("template"),invalidTemplate:new S("invalidTemplate"),ellipsis:new S("...",N),backQuote:new S("`",A),dollarBraceL:new S("${",{beforeExpr:!0,startsExpr:!0}),eq:new S("=",{beforeExpr:!0,isAssign:!0}),assign:new S("_=",{beforeExpr:!0,isAssign:!0}),incDec:new S("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new S("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:I("||",1),logicalAND:I("&&",2),bitwiseOR:I("|",3),bitwiseXOR:I("^",4),bitwiseAND:I("&",5),equality:I("==/!=/===/!==",6),relational:I(">/<=/>=",7),bitShift:I("<>>/>>>",8),plusMin:new S("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:I("%",10),star:I("*",10),slash:I("/",10),starstar:new S("**",{beforeExpr:!0}),coalesce:I("??",1),_break:b("break"),_case:b("case",N),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",N),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",N),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",A),_if:b("if"),_return:b("return",N),_switch:b("switch"),_throw:b("throw",N),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",A),_super:b("super",A),_class:b("class",A),_extends:b("extends",N),_export:b("export"),_import:b("import",A),_null:b("null",A),_true:b("true",A),_false:b("false",A),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},R=/\r\n?|\n|\u2028|\u2029/,Pi=new RegExp(R.source,"g");function Q(e){return e===10||e===13||e===8232||e===8233}function ut(e,t,i){i===void 0&&(i=e.length);for(var s=t;s>10)+55296,(e&1023)+56320))}var Vi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,te=function(t,i){this.line=t,this.column=i};te.prototype.offset=function(t){return new te(this.line,this.column+t)};var xe=function(t,i,s){this.start=i,this.end=s,t.sourceFile!==null&&(this.source=t.sourceFile)};function ct(e,t){for(var i=1,s=0;;){var r=ut(e,s,t);if(r<0)return new te(i,t-s);++i,s=r}}var Le={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},st=!1;function Li(e){var t={};for(var i in Le)t[i]=e&&se(e,i)?e[i]:Le[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!st&&typeof console=="object"&&console.warn&&(st=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required. +Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),tt(t.onToken)){var s=t.onToken;t.onToken=function(r){return s.push(r)}}return tt(t.onComment)&&(t.onComment=Ri(t,t.onComment)),t}function Ri(e,t){return function(i,s,r,n,o,u){var h={type:i?"Block":"Line",value:s,start:r,end:n};e.locations&&(h.loc=new xe(this,o,u)),e.ranges&&(h.range=[r,n]),t.push(h)}}var ie=1,Y=2,Be=4,lt=8,ft=16,dt=32,De=64,mt=128,re=256,Fe=ie|Y|re;function Me(e,t){return Y|(e?Be:0)|(t?lt:0)}var fe=0,je=1,J=2,xt=3,yt=4,gt=5,T=function(t,i,s){this.options=t=Li(t),this.sourceFile=t.sourceFile,this.keywords=G(ki[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var r="";t.allowReserved!==!0&&(r=Pe[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(r+=" await")),this.reservedWords=G(r);var n=(r?r+" ":"")+Pe.strict;this.reservedWordsStrict=G(n),this.reservedWordsStrictBind=G(n+" "+Pe.strictBind),this.input=String(i),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf(` +`,s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(R).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ie),this.regexpState=null,this.privateNameStack=[]},F={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}};T.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};F.inFunction.get=function(){return(this.currentVarScope().flags&Y)>0};F.inGenerator.get=function(){return(this.currentVarScope().flags<)>0&&!this.currentVarScope().inClassFieldInit};F.inAsync.get=function(){return(this.currentVarScope().flags&Be)>0&&!this.currentVarScope().inClassFieldInit};F.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&re)return!1;if(t.flags&Y)return(t.flags&Be)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};F.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&De)>0||i||this.options.allowSuperOutsideMethod};F.allowDirectSuper.get=function(){return(this.currentThisScope().flags&mt)>0};F.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};F.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Y|re))>0||i};F.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&re)>0};T.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var s=this,r=0;r =,?^&]/.test(r)||r==="!"&&this.input.charAt(s+1)==="=")}e+=t[0].length,V.lastIndex=e,e+=V.exec(this.input)[0].length,this.input[e]===";"&&e++}};k.eat=function(e){return this.type===e?(this.next(),!0):!1};k.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc};k.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};k.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};k.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||R.test(this.input.slice(this.lastTokEnd,this.start))};k.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};k.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()};k.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};k.expect=function(e){this.eat(e)||this.unexpected()};k.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var ye=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};k.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};k.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,s=e.doubleProto;if(!t)return i>=0||s>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")};k.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos 55295&&s<56320)return!0;if(U(s,!0)){for(var r=i+1;H(s=this.input.charCodeAt(r),!0);)++r;if(s===92||s>55295&&s<56320)return!0;var n=this.input.slice(i,r);if(!wi.test(n))return!0}return!1};f.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;V.lastIndex=this.pos;var e=V.exec(this.input),t=this.pos+e[0].length,i;return!R.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(H(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};f.parseStatement=function(e,t,i){var s=this.type,r=this.startNode(),n;switch(this.isLet(e)&&(s=a._var,n="let"),s){case a._break:case a._continue:return this.parseBreakContinueStatement(r,s.keyword);case a._debugger:return this.parseDebuggerStatement(r);case a._do:return this.parseDoStatement(r);case a._for:return this.parseForStatement(r);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(r,!0);case a._if:return this.parseIfStatement(r);case a._return:return this.parseReturnStatement(r);case a._switch:return this.parseSwitchStatement(r);case a._throw:return this.parseThrowStatement(r);case a._try:return this.parseTryStatement(r);case a._const:case a._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(r,n);case a._while:return this.parseWhileStatement(r);case a._with:return this.parseWithStatement(r);case a.braceL:return this.parseBlock(!0,r);case a.semi:return this.parseEmptyStatement(r);case a._export:case a._import:if(this.options.ecmaVersion>10&&s===a._import){V.lastIndex=this.pos;var o=V.exec(this.input),u=this.pos+o[0].length,h=this.input.charCodeAt(u);if(h===40||h===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===a._import?this.parseImport(r):this.parseExport(r,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var l=this.value,x=this.parseExpression();return s===a.name&&x.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(r,l,x,e):this.parseExpressionStatement(r,x)}};f.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var s=0;s =6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};f.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ue),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var s=this.startNode(),r=i?"let":this.value;return this.next(),this.parseVar(s,!0,r),this.finishNode(s,"VariableDeclaration"),(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&s.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,s)):(t>-1&&this.unexpected(t),this.parseFor(e,s))}var n=this.isContextual("let"),o=!1,u=new ye,h=this.parseExpression(t>-1?"await":!0,u);return this.type===a._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),n&&o&&this.raise(h.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(h,!1,u),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))};f.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,ee|(i?0:Re),!1,t)};f.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};f.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};f.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(Bi),this.enterScope(0);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var s=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),s?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};f.parseThrowStatement=function(e){return this.next(),R.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Di=[];f.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?dt:0),this.checkLValPattern(e,t?yt:J),this.expect(a.parenR),e};f.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};f.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};f.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ue),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};f.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};f.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};f.parseLabeledStatement=function(e,t,i,s){for(var r=0,n=this.labels;r =0;h--){var l=this.labels[h];if(l.statementStart===e.start)l.statementStart=this.start,l.kind=u;else break}return this.labels.push({name:t,kind:u,statementStart:this.start}),e.body=this.parseStatement(s?s.indexOf("label")===-1?s+"label":s:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};f.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};f.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var s=this.parseStatement(null);t.body.push(s)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};f.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};f.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};f.parseVar=function(e,t,i,s){for(e.declarations=[],e.kind=i;;){var r=this.startNode();if(this.parseVarId(r,i),this.eat(a.eq)?r.init=this.parseMaybeAssign(t):!s&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!s&&r.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(a.comma))break}return e};f.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?je:J,!1)};var ee=1,Re=2,vt=4;f.parseFunction=function(e,t,i,s,r){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===a.star&&t&Re&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!s),t&ee&&(e.id=t&vt&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Re)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?je:J:xt));var n=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Me(e.async,e.generator)),t&ee||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,r),this.yieldPos=n,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(e,t&ee?"FunctionDeclaration":"FunctionExpression")};f.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};f.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var s=this.enterClassBody(),r=this.startNode(),n=!1;for(r.body=[],this.expect(a.braceL);this.type!==a.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(r.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(n&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),n=!0):o.key&&o.key.type==="PrivateIdentifier"&&Fi(s,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};f.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),s="",r=!1,n=!1,o="method",u=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?u=!0:s="static"}if(i.static=u,!s&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?n=!0:s="async"),!s&&(t>=9||!n)&&this.eat(a.star)&&(r=!0),!s&&!n&&!r){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=h:s=h)}if(s?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=s,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||o!=="method"||r||n){var l=!i.static&&de(i,"constructor"),x=l&&e;l&&o!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=l?"constructor":o,this.parseClassMethod(i,r,n,x)}else this.parseClassField(i);return i};f.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword};f.parseClassElementName=function(e){this.type===a.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};f.parseClassMethod=function(e,t,i,s){var r=e.key;e.kind==="constructor"?(t&&this.raise(r.start,"Constructor can't be a generator"),i&&this.raise(r.start,"Constructor can't be an async method")):e.static&&de(e,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,s);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};f.parseClassField=function(e){if(de(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&de(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};f.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(re|De);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};f.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,J,!1)):(t===!0&&this.unexpected(),e.id=null)};f.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null};f.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};f.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var s=this.privateNameStack.length,r=s===0?null:this.privateNameStack[s-1],n=0;n =11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};f.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var i=0,s=e.specifiers;i =13&&this.type===a.string){var e=this.parseLiteral(this.value);return Vi.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};f.adaptDirectivePrologue=function(e){for(var t=0;t =5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var O=T.prototype;O.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var s=0,r=e.properties;s =6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()};O.parseBindingList=function(e,t,i,s){for(var r=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(a.comma),t&&this.type===a.comma)r.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),r.push(o),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else r.push(this.parseAssignableListItem(s))}return r};O.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};O.parseBindingListItem=function(e){return e};O.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var s=this.startNodeAt(e,t);return s.left=i,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")};O.checkLValSimple=function(e,t,i){t===void 0&&(t=fe);var s=t!==fe;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(s?"Binding ":"Assigning to ")+e.name+" in strict mode"),s&&(t===J&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(se(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==gt&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":s&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return s&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(s?"Binding":"Assigning to")+" rvalue")}};O.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=fe),e.type){case"ObjectPattern":for(var s=0,r=e.properties;s =1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};$.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};$.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===C.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?C.b_stat:C.b_expr),this.exprAllowed=!0};a.dollarBraceL.updateContext=function(){this.context.push(C.b_tmpl),this.exprAllowed=!0};a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?C.p_stat:C.p_expr),this.exprAllowed=!0};a.incDec.updateContext=function(){};a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==C.p_stat)&&!(e===a._return&&R.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===C.b_stat)?this.context.push(C.f_expr):this.context.push(C.f_stat),this.exprAllowed=!1};a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};a.backQuote.updateContext=function(){this.curContext()===C.q_tmpl?this.context.pop():this.context.push(C.q_tmpl),this.exprAllowed=!1};a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===C.f_expr?this.context[t]=C.f_expr_gen:this.context[t]=C.f_gen}this.exprAllowed=!0};a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var y=T.prototype;y.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var s=e.key,r;switch(s.type){case"Identifier":r=s.name;break;case"Literal":r=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);return}r="$"+r;var o=t[r];if(o){var u;n==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[n],u&&this.raiseRecoverable(s.start,"Redefinition of property")}else o=t[r]={init:!1,get:!1,set:!1};o[n]=!0}};y.parseExpression=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeAssign(e,t);if(this.type===a.comma){var n=this.startNodeAt(i,s);for(n.expressions=[r];this.eat(a.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return r};y.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var s=!1,r=-1,n=-1,o=-1;t?(r=t.parenthesizedAssign,n=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ye,s=!0);var u=this.start,h=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var l=this.parseMaybeConditional(e,t);if(i&&(l=i.call(this,l,u,h)),this.type.isAssign){var x=this.startNodeAt(u,h);return x.operator=this.value,this.type===a.eq&&(l=this.toAssignable(l,!1,t)),s||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(l):this.checkLValSimple(l),x.left=l,this.next(),x.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(x,"AssignmentExpression")}else s&&this.checkExpressionErrors(t,!0);return r>-1&&(t.parenthesizedAssign=r),n>-1&&(t.trailingComma=n),l};y.parseMaybeConditional=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return r;if(this.eat(a.question)){var n=this.startNodeAt(i,s);return n.test=r,n.consequent=this.parseMaybeAssign(),this.expect(a.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return r};y.parseExprOps=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||r.start===i&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,i,s,-1,e)};y.parseExprOp=function(e,t,i,s,r){var n=this.type.binop;if(n!=null&&(!r||this.type!==a._in)&&n>s){var o=this.type===a.logicalOR||this.type===a.logicalAND,u=this.type===a.coalesce;u&&(n=a.logicalAND.binop);var h=this.value;this.next();var l=this.start,x=this.startLoc,_=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,r),l,x,n,r),B=this.buildBinary(t,i,e,_,h,o||u);return(o&&this.type===a.coalesce||u&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(B,t,i,s,r)}return e};y.buildBinary=function(e,t,i,s,r,n){s.type==="PrivateIdentifier"&&this.raise(s.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=i,o.operator=r,o.right=s,this.finishNode(o,n?"LogicalExpression":"BinaryExpression")};y.parseMaybeUnary=function(e,t,i,s){var r=this.start,n=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(s),t=!0;else if(this.type.prefix){var u=this.startNode(),h=this.type===a.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,h,s),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&u.argument.type==="Identifier"?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&bt(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=!0,o=this.finishNode(u,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(s||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,s),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,n);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(r,n,o,this.parseMaybeUnary(null,!1,!1,s),"**",!1);else return o};function bt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&bt(e.expression)}y.parseExprSubscripts=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprAtom(e,t);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var n=this.parseSubscripts(r,i,s,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};y.parseSubscripts=function(e,t,i,s,r){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var u=this.parseSubscript(e,t,i,s,n,o,r);if(u.optional&&(o=!0),u===e||u.type==="ArrowFunctionExpression"){if(o){var h=this.startNodeAt(t,i);h.expression=u,u=this.finishNode(h,"ChainExpression")}return u}e=u}};y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)};y.parseSubscriptAsyncArrow=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,s)};y.parseSubscript=function(e,t,i,s,r,n,o){var u=this.options.ecmaVersion>=11,h=u&&this.eat(a.questionDot);s&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(a.bracketL);if(l||h&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var x=this.startNodeAt(t,i);x.object=e,l?(x.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?x.property=this.parsePrivateIdent():x.property=this.parseIdent(this.options.allowReserved!=="never"),x.computed=!!l,u&&(x.optional=h),e=this.finishNode(x,"MemberExpression")}else if(!s&&this.eat(a.parenL)){var _=new ye,B=this.yieldPos,p=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,_);if(r&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=B,this.awaitPos=p,this.awaitIdentPos=d,this.parseSubscriptAsyncArrow(t,i,m,o);this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var g=this.startNodeAt(t,i);g.callee=e,g.arguments=m,u&&(g.optional=h),e=this.finishNode(g,"CallExpression")}else if(this.type===a.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e};y.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var s,r=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),s=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(s.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(s,"Super");case a._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case a.name:var n=this.start,o=this.startLoc,u=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(C.f_expr),this.parseFunction(this.startNodeAt(n,o),0,!1,!0,t);if(r&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(n,o),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===a.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,o),[h],!0,t)}return h;case a.regexp:var l=this.value;return s=this.parseLiteral(l.value),s.regex={pattern:l.pattern,flags:l.flags},s;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return s=this.startNode(),s.value=this.type===a._null?null:this.type===a._true,s.raw=this.type.keyword,this.next(),this.finishNode(s,"Literal");case a.parenL:var x=this.start,_=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(_)&&(e.parenthesizedAssign=x),e.parenthesizedBind<0&&(e.parenthesizedBind=x)),_;case a.bracketL:return s=this.startNode(),this.next(),s.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(s,"ArrayExpression");case a.braceL:return this.overrideContext(C.b_expr),this.parseObj(!1,e);case a._function:return s=this.startNode(),this.next(),this.parseFunction(s,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};y.parseExprAtomDefault=function(){this.unexpected()};y.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};y.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};y.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};y.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};y.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e};y.shouldParseArrow=function(e){return!this.canInsertSemicolon()};y.parseParenAndDistinguishExpression=function(e,t){var i=this.start,s=this.startLoc,r,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,h=[],l=!0,x=!1,_=new ye,B=this.yieldPos,p=this.awaitPos,d;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(l?l=!1:this.expect(a.comma),n&&this.afterTrailingComma(a.parenR,!0)){x=!0;break}else if(this.type===a.ellipsis){d=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,_,this.parseParenItem));var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(h)&&this.eat(a.arrow))return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=B,this.awaitPos=p,this.parseParenArrowList(i,s,h,t);(!h.length||x)&&this.unexpected(this.lastTokStart),d&&this.unexpected(d),this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(r=this.startNodeAt(o,u),r.expressions=h,this.finishNodeAt(r,"SequenceExpression",m,g)):r=h[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,s);return E.expression=r,this.finishNode(E,"ParenthesizedExpression")}else return r};y.parseParenItem=function(e){return e};y.parseParenArrowList=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,s)};var Mi=[];y.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===a.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var s=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),s,r,!0,!1),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Mi,this.finishNode(e,"NewExpression")};y.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value,cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,` +`),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")};y.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var s=this.parseTemplateElement({isTagged:t});for(i.quasis=[s];!s.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(s=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};y.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!R.test(this.input.slice(this.lastTokEnd,this.start))};y.parseObj=function(e,t){var i=this.startNode(),s=!0,r={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(s)s=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,r,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};y.parseProperty=function(e,t){var i=this.startNode(),s,r,n,o;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,o=this.startLoc),e||(s=this.eat(a.star)));var u=this.containsEsc;return this.parsePropertyName(i),!e&&!u&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(i)?(r=!0,s=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):r=!1,this.parsePropertyValue(i,e,s,r,n,o,t,u),this.finishNode(i,"Property")};y.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};y.parsePropertyValue=function(e,t,i,s,r,n,o,u){(i||s)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,s)):!t&&!u&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||s)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||s)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),e.kind="init",t?e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key)):this.type===a.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};y.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};y.parseMethod=function(e,t,i){var s=this.startNode(),r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=e),this.options.ecmaVersion>=8&&(s.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Me(t,s.generator)|De|(i?mt:0)),this.expect(a.parenL),s.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0,!1),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(s,"FunctionExpression")};y.parseArrowExpression=function(e,t,i,s){var r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Me(i,!1)|ft),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,s),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};y.parseFunctionBody=function(e,t,i,s){var r=t&&this.type!==a.braceL,n=this.strict,o=!1;if(r)e.body=this.parseMaybeAssign(s),e.expression=!0,this.checkParams(e,!1);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!n&&!o&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,gt),e.body=this.parseBlock(!1,void 0,o&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()};y.isSimpleParamList=function(e){for(var t=0,i=e;t -1||r.functions.indexOf(e)>-1||r.var.indexOf(e)>-1,r.lexical.push(e),this.inModule&&r.flags&ie&&delete this.undefinedExports[e]}else if(t===yt){var n=this.currentScope();n.lexical.push(e)}else if(t===xt){var o=this.currentScope();this.treatFunctionsAsVar?s=o.lexical.indexOf(e)>-1:s=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var u=this.scopeStack.length-1;u>=0;--u){var h=this.scopeStack[u];if(h.lexical.indexOf(e)>-1&&!(h.flags&dt&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){s=!0;break}if(h.var.push(e),this.inModule&&h.flags&ie&&delete this.undefinedExports[e],h.flags&Fe)break}s&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};W.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};W.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};W.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Fe)return t}};W.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Fe&&!(t.flags&ft))return t}};var ge=function(t,i,s){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new xe(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ae=T.prototype;ae.startNode=function(){return new ge(this,this.start,this.startLoc)};ae.startNodeAt=function(e,t){return new ge(this,e,t)};function St(e,t,i,s){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=s),this.options.ranges&&(e.range[1]=i),e}ae.finishNode=function(e,t){return St.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};ae.finishNodeAt=function(e,t,i,s){return St.call(this,e,t,i,s)};ae.copyNode=function(e){var t=new ge(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var _t="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",Ct=_t+" Extended_Pictographic",Tt=Ct,kt=Tt+" EBase EComp EMod EPres ExtPict",wt=kt,Ui=wt,qi={9:_t,10:Ct,11:Tt,12:kt,13:wt,14:Ui},Ji="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Gi={9:"",10:"",11:"",12:"",13:"",14:Ji},rt="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",Et="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",At=Et+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Pt=At+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",It=Pt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Nt=It+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ki=Nt+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",Wi={9:Et,10:At,11:Pt,12:It,13:Nt,14:Ki},Vt={};function Xi(e){var t=Vt[e]={binary:G(qi[e]+" "+rt),binaryOfStrings:G(Gi[e]),nonBinary:{General_Category:G(rt),Script:G(Wi[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(le=0,Ne=[9,10,11,12,13,14];le =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=[],this.backReferenceNames=[]};M.prototype.reset=function(t,i,s){var r=s.indexOf("v")!==-1,n=s.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=s,r&&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)};M.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};M.prototype.at=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return-1;var n=s.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=r)return n;var o=s.charCodeAt(t+1);return o>=56320&&o<=57343?(n<<10)+o-56613888:n};M.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return r;var n=s.charCodeAt(t),o;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=r||(o=s.charCodeAt(t+1))<56320||o>57343?t+1:t+2};M.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};M.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};M.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};M.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};M.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var s=this.pos,r=0,n=t;r -1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(s=!0),o==="v"&&(r=!0)}this.options.ecmaVersion>=15&&s&&r&&this.raise(e.start,"Invalid regular expression flag")};c.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};c.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t =9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};c.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};c.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};c.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var s=0,r=-1;if(this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue),e.eat(125)))return r!==-1&&r =9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};c.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};c.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};c.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Lt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Lt(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}c.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Lt(i);)e.advance();return e.pos!==t};c.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};c.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};c.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};c.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=K(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=K(e.lastIntValue);return!0}return!1};c.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),zi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function zi(e){return U(e,!0)||e===36||e===95}c.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),Hi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function Hi(e){return H(e,!0)||e===36||e===95||e===8204||e===8205}c.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};c.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};c.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};c.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};c.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};c.regexp_eatZero=function(e){return e.current()===48&&!ve(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};c.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};c.regexp_eatControlLetter=function(e){var t=e.current();return Rt(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Rt(e){return e>=65&&e<=90||e>=97&&e<=122}c.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var r=e.lastIntValue;if(s&&r>=55296&&r<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(r-55296)*1024+(o-56320)+65536,!0}e.pos=n,e.lastIntValue=r}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Qi(e.lastIntValue))return!0;s&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Qi(e){return e>=0&&e<=1114111}c.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};c.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Ot=0,q=1,L=2;c.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Yi(t))return e.lastIntValue=-1,e.advance(),q;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var s;if(e.eat(123)&&(s=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&s===L&&e.raise("Invalid property name"),s;e.raise("Invalid property name")}return Ot};function Yi(e){return e===100||e===68||e===115||e===83||e===119||e===87}c.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,s),q}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,r)}return Ot};c.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){se(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};c.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return q;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return L;e.raise("Invalid property name")};c.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Bt(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function Bt(e){return Rt(e)||e===95}c.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";$i(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function $i(e){return Bt(e)||ve(e)}c.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};c.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===L&&e.raise("Negated character class may contain strings"),!0}return!1};c.regexp_classContents=function(e){return e.current()===93?q:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),q)};c.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};c.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Mt(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var s=e.current();return s!==93?(e.lastIntValue=s,e.advance(),!0):!1};c.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};c.regexp_classSetExpression=function(e){var t=q,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===L&&(t=L);for(var s=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==L&&(t=q);continue}e.raise("Invalid character in character class")}if(s!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(s!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===L&&(t=L)}};c.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;return i!==-1&&s!==-1&&i>s&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};c.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?q:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};c.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),s=this.regexp_classContents(e);if(e.eat(93))return i&&s===L&&e.raise("Negated character class may contain strings"),s;e.pos=t}if(e.eat(92)){var r=this.regexp_eatCharacterClassEscape(e);if(r)return r;e.pos=t}return null};c.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null};c.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===L&&(t=L);return t};c.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?q:L};c.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Zi(i)||es(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Zi(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function es(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}c.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ts(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ts(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}c.regexp_eatClassControlLetter=function(e){var t=e.current();return ve(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};c.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};c.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ve(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ve(e){return e>=48&&e<=57}c.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Dt(i=e.current());)e.lastIntValue=16*e.lastIntValue+Ft(i),e.advance();return e.pos!==t};function Dt(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ft(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}c.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};c.regexp_eatOctalDigit=function(e){var t=e.current();return Mt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Mt(e){return e>=48&&e<=55}c.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var s=0;s=this.input.length)return this.finishToken(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};v.readToken=function(e){return U(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};v.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};v.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var s=void 0,r=t;(s=ut(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=s;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};v.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=e);this.pos 8&&e<14||e>=5760&&ht.test(String.fromCharCode(e)))++this.pos;else break e}}};v.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};v.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(a.ellipsis)):(++this.pos,this.finishToken(a.dot))};v.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)};v.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,s=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,s=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(s,i)};v.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)};v.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)};v.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||R.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)};v.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(a.relational,i))};v.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)};v.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)};v.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),U(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+K(t)+"'")};v.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+K(e)+"'")};v.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};v.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(R.test(s)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(s==="[")t=!0;else if(s==="]"&&t)t=!1;else if(s==="/"&&!t)break;e=s==="\\"}++this.pos}var r=this.input.slice(i,this.pos);++this.pos;var n=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(n);var u=this.regexpState||(this.regexpState=new M(this));u.reset(i,r,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var h=null;try{h=new RegExp(r,o)}catch{}return this.finishToken(a.regexp,{pattern:r,flags:o,value:h})};v.readInt=function(e,t,i){for(var s=this.options.ecmaVersion>=12&&t===void 0,r=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,o=0,u=0,h=0,l=t??1/0;h =97?_=x-97+10:x>=65?_=x-65+10:x>=48&&x<=57?_=x-48:_=1/0,_>=e)break;u=x,o=o*e+_}return s&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:o};function is(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function jt(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}v.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=jt(this.input.slice(t,this.pos)),++this.pos):U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)};v.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&s===110){var r=jt(this.input.slice(t,this.pos));return++this.pos,U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,r)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),s===46&&!i&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(s===69||s===101)&&!i&&(s=this.input.charCodeAt(++this.pos),(s===43||s===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=is(this.input.slice(t,this.pos),i);return this.finishToken(a.num,n)};v.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};v.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===e)break;s===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):s===8232||s===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Q(s)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var Ut={};v.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ut)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};v.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ut;this.raise(e,t)};v.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Q(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=` `;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};v.readInvalidTemplateToken=function(){for(;this.pos =48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(s,8);return r>255&&(s=s.slice(0,-1),r=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),(s!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Q(t)?"":String.fromCharCode(t)}};v.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};v.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,s=this.options.ecmaVersion>=6;this.pos 0}var _e=_s;function P(e){var s;let t=e.range?e.range[0]:e.start,i=((s=e.declaration)==null?void 0:s.decorators)??e.decorators;return _e(i)?Math.min(P(i[0]),t):t}function j(e){return e.range?e.range[1]:e.end}function Cs(e){return e=typeof e=="function"?{parse:e}:e,{astFormat:"estree",hasPragma:ti,locStart:P,locEnd:j,...e}}var Ce=Cs;var Ts=(e,t,i)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[i<0?t.length+i:i]:t.at(i)},We=Ts;function ks(e){return e=new Set(e),t=>e.has(t==null?void 0:t.type)}var ii=ks;var ws=ii(["Block","CommentBlock","MultiLine"]),oe=ws;function Es(e){return oe(e)&&e.value[0]==="*"&&/@(?:type|satisfies)\b/.test(e.value)}var si=Es;function As(e){let t=`*${e.value}*`.split(` -`);return t.length>1&&t.every(i=>i.trimStart()[0]==="*")}var Xe=As;var ue=null;function he(e){if(ue!==null&&typeof ue.property){let t=ue;return ue=he.prototype=null,t}return ue=he.prototype=e??Object.create(null),new he}var Ps=10;for(let e=0;e<=Ps;e++)he();function ze(e){return he(e)}function Is(e,t="type"){ze(e);function i(s){let r=s[t],n=e[r];if(!Array.isArray(n))throw Object.assign(new Error(`Missing visitor keys for '${r}'.`),{node:s});return n}return i}var ri=Is;var ai={ArrayExpression:["elements"],AssignmentExpression:["left","right"],BinaryExpression:["left","right"],InterpreterDirective:[],Directive:["value"],DirectiveLiteral:[],BlockStatement:["directives","body"],BreakStatement:["label"],CallExpression:["callee","arguments","typeParameters","typeArguments"],CatchClause:["param","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["test","body"],EmptyStatement:[],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body","returnType","typeParameters","predicate"],FunctionExpression:["id","params","body","returnType","typeParameters"],Identifier:["typeAnnotation","decorators"],IfStatement:["test","consequent","alternate"],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],NewExpression:["callee","arguments","typeParameters","typeArguments"],Program:["directives","body"],ObjectExpression:["properties"],ObjectMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectProperty:["key","value","decorators"],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ParenthesizedExpression:["expression"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["params","body","returnType","typeParameters","predicate"],ClassBody:["body"],ClassExpression:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ClassDeclaration:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ExportAllDeclaration:["source","attributes","assertions","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source","attributes","assertions"],ExportSpecifier:["local","exported"],ForOfStatement:["left","right","body"],ImportDeclaration:["specifiers","source","attributes","assertions"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["local","imported"],ImportExpression:["source","options","attributes"],MetaProperty:["meta","property"],ClassMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectPattern:["properties","typeAnnotation","decorators"],SpreadElement:["argument"],Super:[],TaggedTemplateExpression:["tag","quasi","typeParameters","typeArguments"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:["argument"],AwaitExpression:["argument"],Import:[],BigIntLiteral:[],ExportNamespaceSpecifier:["exported"],OptionalMemberExpression:["object","property"],OptionalCallExpression:["callee","arguments","typeParameters","typeArguments"],ClassProperty:["key","value","typeAnnotation","decorators","variance"],ClassAccessorProperty:["key","value","typeAnnotation","decorators"],ClassPrivateProperty:["key","value","decorators","typeAnnotation","variance"],ClassPrivateMethod:["key","params","body","decorators","returnType","typeParameters"],PrivateName:["id"],StaticBlock:["body"],AnyTypeAnnotation:[],ArrayTypeAnnotation:["elementType"],BooleanTypeAnnotation:[],BooleanLiteralTypeAnnotation:[],NullLiteralTypeAnnotation:[],ClassImplements:["id","typeParameters"],DeclareClass:["id","typeParameters","extends","mixins","implements","body"],DeclareFunction:["id","predicate"],DeclareInterface:["id","typeParameters","extends","body"],DeclareModule:["id","body"],DeclareModuleExports:["typeAnnotation"],DeclareTypeAlias:["id","typeParameters","right"],DeclareOpaqueType:["id","typeParameters","supertype"],DeclareVariable:["id"],DeclareExportDeclaration:["declaration","specifiers","source"],DeclareExportAllDeclaration:["source"],DeclaredPredicate:["value"],ExistsTypeAnnotation:[],FunctionTypeAnnotation:["typeParameters","params","rest","returnType","this"],FunctionTypeParam:["name","typeAnnotation"],GenericTypeAnnotation:["id","typeParameters"],InferredPredicate:[],InterfaceExtends:["id","typeParameters"],InterfaceDeclaration:["id","typeParameters","extends","body"],InterfaceTypeAnnotation:["extends","body"],IntersectionTypeAnnotation:["types"],MixedTypeAnnotation:[],EmptyTypeAnnotation:[],NullableTypeAnnotation:["typeAnnotation"],NumberLiteralTypeAnnotation:[],NumberTypeAnnotation:[],ObjectTypeAnnotation:["properties","indexers","callProperties","internalSlots"],ObjectTypeInternalSlot:["id","value","optional","static","method"],ObjectTypeCallProperty:["value"],ObjectTypeIndexer:["id","key","value","variance"],ObjectTypeProperty:["key","value","variance"],ObjectTypeSpreadProperty:["argument"],OpaqueType:["id","typeParameters","supertype","impltype"],QualifiedTypeIdentifier:["id","qualification"],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],SymbolTypeAnnotation:[],ThisTypeAnnotation:[],TupleTypeAnnotation:["types","elementTypes"],TypeofTypeAnnotation:["argument","typeArguments"],TypeAlias:["id","typeParameters","right"],TypeAnnotation:["typeAnnotation"],TypeCastExpression:["expression","typeAnnotation"],TypeParameter:["bound","default","variance"],TypeParameterDeclaration:["params"],TypeParameterInstantiation:["params"],UnionTypeAnnotation:["types"],Variance:[],VoidTypeAnnotation:[],EnumDeclaration:["id","body"],EnumBooleanBody:["members"],EnumNumberBody:["members"],EnumStringBody:["members"],EnumSymbolBody:["members"],EnumBooleanMember:["id","init"],EnumNumberMember:["id","init"],EnumStringMember:["id","init"],EnumDefaultedMember:["id"],IndexedAccessType:["objectType","indexType"],OptionalIndexedAccessType:["objectType","indexType"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXSpreadChild:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes","typeArguments","typeParameters"],JSXSpreadAttribute:["argument"],JSXText:[],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningFragment:[],JSXClosingFragment:[],Noop:[],Placeholder:[],V8IntrinsicIdentifier:[],ArgumentPlaceholder:[],BindExpression:["object","callee"],ImportAttribute:["key","value"],Decorator:["expression"],DoExpression:["body"],ExportDefaultSpecifier:["exported"],RecordExpression:["properties"],TupleExpression:["elements"],DecimalLiteral:[],ModuleExpression:["body"],TopicReference:[],PipelineTopicExpression:["expression"],PipelineBareFunction:["callee"],PipelinePrimaryTopicReference:[],TSParameterProperty:["parameter","decorators"],TSDeclareFunction:["id","typeParameters","params","returnType","body"],TSDeclareMethod:["decorators","key","typeParameters","params","returnType"],TSQualifiedName:["left","right"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation","params","returnType"],TSIndexSignature:["parameters","typeAnnotation"],TSAnyKeyword:[],TSBooleanKeyword:[],TSBigIntKeyword:[],TSIntrinsicKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSFunctionType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructorType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSTypeReference:["typeName","typeParameters","typeArguments"],TSTypePredicate:["parameterName","typeAnnotation"],TSTypeQuery:["exprName","typeParameters","typeArguments"],TSTypeLiteral:["members"],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSNamedTupleMember:["label","elementType"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","typeAnnotation","nameType"],TSLiteralType:["literal"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSInstantiationExpression:["expression","typeParameters","typeArguments"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportType:["argument","qualifier","typeParameters","typeArguments"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSNonNullExpression:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterInstantiation:["params"],TSTypeParameterDeclaration:["params"],TSTypeParameter:["constraint","default","name"],ChainExpression:["expression"],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],Literal:[],MethodDefinition:["decorators","key","value"],PrivateIdentifier:[],Property:["key","value"],PropertyDefinition:["decorators","key","typeAnnotation","value","variance"],AccessorProperty:["decorators","key","typeAnnotation","value"],TSAbstractAccessorProperty:["decorators","key","typeAnnotation"],TSAbstractKeyword:[],TSAbstractMethodDefinition:["key","value"],TSAbstractPropertyDefinition:["decorators","key","typeAnnotation"],TSAsyncKeyword:[],TSClassImplements:["expression","typeArguments","typeParameters"],TSDeclareKeyword:[],TSEmptyBodyFunctionExpression:["id","typeParameters","params","returnType"],TSExportKeyword:[],TSInterfaceHeritage:["expression","typeArguments","typeParameters"],TSPrivateKeyword:[],TSProtectedKeyword:[],TSPublicKeyword:[],TSReadonlyKeyword:[],TSStaticKeyword:[],TSTemplateLiteralType:["quasis","types"],AsExpression:["expression","typeAnnotation"],BigIntLiteralTypeAnnotation:[],BigIntTypeAnnotation:[],ConditionalTypeAnnotation:["checkType","extendsType","trueType","falseType"],DeclareEnum:["id","body"],InferTypeAnnotation:["typeParameter"],KeyofTypeAnnotation:["argument"],ObjectTypeMappedTypeProperty:["keyTparam","propType","sourceType","variance"],QualifiedTypeofIdentifier:["qualification","id"],TupleTypeLabeledElement:["label","elementType","variance"],TupleTypeSpreadElement:["label","typeAnnotation"],TypeOperator:["typeAnnotation"],TypePredicate:["parameterName","typeAnnotation","asserts"],NGRoot:["node"],NGPipeExpression:["left","right","arguments"],NGChainedExpression:["expressions"],NGEmptyExpression:[],NGMicrosyntax:["body"],NGMicrosyntaxKey:[],NGMicrosyntaxExpression:["expression","alias"],NGMicrosyntaxKeyedExpression:["key","expression"],NGMicrosyntaxLet:["key","value"],NGMicrosyntaxAs:["key","alias"],JsExpressionRoot:["node"],JsonRoot:["node"],TSJSDocAllType:[],TSJSDocUnknownType:[],TSJSDocNullableType:["typeAnnotation"],TSJSDocNonNullableType:["typeAnnotation"],NeverTypeAnnotation:[],UndefinedTypeAnnotation:[],UnknownTypeAnnotation:[],AsConstExpression:["expression"],SatisfiesExpression:["expression","typeAnnotation"]};var Ns=ri(ai),ni=Ns;function He(e,t){if(!(e!==null&&typeof e=="object"))return e;if(Array.isArray(e)){for(let s=0;s {var u;(u=o.leadingComments)!=null&&u.some(si)&&n.add(P(o))}),e=Te(e,o=>{if(o.type==="ParenthesizedExpression"){let{expression:u}=o;if(u.type==="TypeCastExpression")return u.range=o.range,u;let h=P(o);if(!n.has(h))return u.extra={...u.extra,parenthesized:!0},u}})}if(e=Te(e,n=>{switch(n.type){case"LogicalExpression":if(oi(n))return Qe(n);break;case"VariableDeclaration":{let o=We(!1,n.declarations,-1);o!=null&&o.init&&r(n,o);break}case"TSParenthesizedType":return n.typeAnnotation;case"TSTypeParameter":if(typeof n.name=="string"){let o=P(n);n.name={type:"Identifier",name:n.name,range:[o,o+n.name.length]}}break;case"TopicReference":e.extra={...e.extra,__isUsingHackPipeline:!0};break;case"ExportAllDeclaration":{let{exported:o}=n;if(i==="meriyah"&&(o==null?void 0:o.type)==="Identifier"){let u=s.slice(P(o),j(o));(u.startsWith('"')||u.startsWith("'"))&&(n.exported={...n.exported,type:"Literal",value:n.exported.name,raw:u})}break}case"TSUnionType":case"TSIntersectionType":if(n.types.length===1)return n.types[0];break}}),_e(e.comments)){let n=We(!1,e.comments,-1);for(let o=e.comments.length-2;o>=0;o--){let u=e.comments[o];j(u)===P(n)&&oe(u)&&oe(n)&&Xe(u)&&Xe(n)&&(e.comments.splice(o+1,1),u.value+="*//*"+n.value,u.range=[P(u),j(n)]),n=u}}return e.type==="Program"&&(e.range=[0,s.length]),e;function r(n,o){s[j(o)]!==";"&&(n.range=[P(n),j(o)])}}function oi(e){return e.type==="LogicalExpression"&&e.right.type==="LogicalExpression"&&e.operator===e.right.operator}function Qe(e){return oi(e)?Qe({type:"LogicalExpression",operator:e.operator,left:Qe({type:"LogicalExpression",operator:e.operator,left:e.left,right:e.right.left,range:[P(e.left),j(e.right.left)]}),right:e.right.right,range:[P(e),j(e)]}):e}var ke=Vs;function Ls(e){let{filepath:t}=e;if(t){if(t=t.toLowerCase(),t.endsWith(".cjs"))return"script";if(t.endsWith(".mjs"))return"module"}}var we=Ls;var Rs={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,locations:!0,ranges:!0};function Os(e){let{message:t,loc:i}=e;if(!i)return e;let{line:s,column:r}=i;return be(t.replace(/ \(\d+:\d+\)$/,""),{loc:{start:{line:s,column:r+1}},cause:e})}var ui,Bs=()=>(ui??(ui=T.extend((0,hi.default)())),ui);function Ds(e,t){let i=Bs(),s=[],r=[],n=i.parse(e,{...Rs,sourceType:t,allowImportExportEverywhere:t==="module",onComment:s,onToken:r});return n.comments=s,n.tokens=r,n}function Fs(e,t={}){let i=we(t),s=(i?[i]:["module","script"]).map(n=>()=>Ds(e,n)),r;try{r=Se(s)}catch({errors:[n]}){throw Os(n)}return ke(r,{text:e})}var pi=Ce(Fs);var fi=Pe(Ke(),1);var w={Boolean:"Boolean",EOF:" ",Identifier:"Identifier",PrivateIdentifier:"PrivateIdentifier",Keyword:"Keyword",Null:"Null",Numeric:"Numeric",Punctuator:"Punctuator",String:"String",RegularExpression:"RegularExpression",Template:"Template",JSXIdentifier:"JSXIdentifier",JSXText:"JSXText"};function Ms(e,t){let i=e[0],s=e[e.length-1],r={type:w.Template,value:t.slice(i.start,s.end)};return i.loc&&(r.loc={start:i.loc.start,end:s.loc.end}),i.range&&(r.start=i.range[0],r.end=s.range[1],r.range=[r.start,r.end]),r}function Ye(e,t){this._acornTokTypes=e,this._tokens=[],this._curlyBrace=null,this._code=t}Ye.prototype={constructor:Ye,translate(e,t){let i=e.type,s=this._acornTokTypes;if(i===s.name)e.type=w.Identifier,e.value==="static"&&(e.type=w.Keyword),t.ecmaVersion>5&&(e.value==="yield"||e.value==="let")&&(e.type=w.Keyword);else if(i===s.privateId)e.type=w.PrivateIdentifier;else if(i===s.semi||i===s.comma||i===s.parenL||i===s.parenR||i===s.braceL||i===s.braceR||i===s.dot||i===s.bracketL||i===s.colon||i===s.question||i===s.bracketR||i===s.ellipsis||i===s.arrow||i===s.jsxTagStart||i===s.incDec||i===s.starstar||i===s.jsxTagEnd||i===s.prefix||i===s.questionDot||i.binop&&!i.keyword||i.isAssign)e.type=w.Punctuator,e.value=this._code.slice(e.start,e.end);else if(i===s.jsxName)e.type=w.JSXIdentifier;else if(i.label==="jsxText"||i===s.jsxAttrValueToken)e.type=w.JSXText;else if(i.keyword)i.keyword==="true"||i.keyword==="false"?e.type=w.Boolean:i.keyword==="null"?e.type=w.Null:e.type=w.Keyword;else if(i===s.num)e.type=w.Numeric,e.value=this._code.slice(e.start,e.end);else if(i===s.string)t.jsxAttrValueToken?(t.jsxAttrValueToken=!1,e.type=w.JSXText):e.type=w.String,e.value=this._code.slice(e.start,e.end);else if(i===s.regexp){e.type=w.RegularExpression;let r=e.value;e.regex={flags:r.flags,pattern:r.pattern},e.value=`/${r.pattern}/${r.flags}`}return e},onToken(e,t){let i=this._acornTokTypes,s=t.tokens,r=this._tokens,n=()=>{s.push(Ms(this._tokens,this._code)),this._tokens=[]};if(e.type===i.eof){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t));return}if(e.type===i.backQuote){this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),r.push(e),r.length>1&&n();return}if(e.type===i.dollarBraceL){r.push(e),n();return}if(e.type===i.braceR){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=e;return}if(e.type===i.template||e.type===i.invalidTemplate){this._curlyBrace&&(r.push(this._curlyBrace),this._curlyBrace=null),r.push(e);return}this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),s.push(this.translate(e,t))}};var ci=Ye;var $e=[3,5,6,7,8,9,10,11,12,13,14,15];function js(){return $e[$e.length-1]}function Us(e=5){let t=e==="latest"?js():e;if(typeof t!="number")throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof e} instead.`);if(t>=2015&&(t-=2009),!$e.includes(t))throw new Error("Invalid ecmaVersion.");return t}function qs(e="script"){if(e==="script"||e==="module")return e;if(e==="commonjs")return"script";throw new Error("Invalid sourceType.")}function li(e){let t=Us(e.ecmaVersion),i=qs(e.sourceType),s=e.range===!0,r=e.loc===!0;if(t!==3&&e.allowReserved)throw new Error("`allowReserved` is only supported when ecmaVersion is 3");if(typeof e.allowReserved<"u"&&typeof e.allowReserved!="boolean")throw new Error("`allowReserved`, when present, must be `true` or `false`");let n=t===3?e.allowReserved||"never":!1,o=e.ecmaFeatures||{},u=e.sourceType==="commonjs"||!!o.globalReturn;if(i==="module"&&t<6)throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");return Object.assign({},e,{ecmaVersion:t,sourceType:i,ranges:s,locations:r,allowReserved:n,allowReturnOutsideFunction:u})}var z=Symbol("espree's internal state"),Ze=Symbol("espree's esprimaFinishNode");function Js(e,t,i,s,r,n,o){let u;e?u="Block":o.slice(i,i+2)==="#!"?u="Hashbang":u="Line";let h={type:u,value:t};return typeof i=="number"&&(h.start=i,h.end=s,h.range=[i,s]),typeof r=="object"&&(h.loc={start:r,end:n}),h}var et=()=>e=>{let t=Object.assign({},e.acorn.tokTypes);return e.acornJsx&&Object.assign(t,e.acornJsx.tokTypes),class extends e{constructor(s,r){(typeof s!="object"||s===null)&&(s={}),typeof r!="string"&&!(r instanceof String)&&(r=String(r));let n=s.sourceType,o=li(s),u=o.ecmaFeatures||{},h=o.tokens===!0?new ci(t,r):null,l={originalSourceType:n||o.sourceType,tokens:h?[]:null,comments:o.comment===!0?[]:null,impliedStrict:u.impliedStrict===!0&&o.ecmaVersion>=5,ecmaVersion:o.ecmaVersion,jsxAttrValueToken:!1,lastToken:null,templateElements:[]};super({ecmaVersion:o.ecmaVersion,sourceType:o.sourceType,ranges:o.ranges,locations:o.locations,allowReserved:o.allowReserved,allowReturnOutsideFunction:o.allowReturnOutsideFunction,onToken(x){h&&h.onToken(x,l),x.type!==t.eof&&(l.lastToken=x)},onComment(x,_,B,p,d,m){if(l.comments){let g=Js(x,_,B,p,d,m,r);l.comments.push(g)}}},r),this[z]=l}tokenize(){do this.next();while(this.type!==t.eof);this.next();let s=this[z],r=s.tokens;return s.comments&&(r.comments=s.comments),r}finishNode(...s){let r=super.finishNode(...s);return this[Ze](r)}finishNodeAt(...s){let r=super.finishNodeAt(...s);return this[Ze](r)}parse(){let s=this[z],r=super.parse();if(r.sourceType=s.originalSourceType,s.comments&&(r.comments=s.comments),s.tokens&&(r.tokens=s.tokens),r.body.length){let[n]=r.body;r.range&&(r.range[0]=n.range[0]),r.loc&&(r.loc.start=n.loc.start),r.start=n.start}return s.lastToken&&(r.range&&(r.range[1]=s.lastToken.range[1]),r.loc&&(r.loc.end=s.lastToken.loc.end),r.end=s.lastToken.end),this[z].templateElements.forEach(n=>{let u=n.tail?1:2;n.start+=-1,n.end+=u,n.range&&(n.range[0]+=-1,n.range[1]+=u),n.loc&&(n.loc.start.column+=-1,n.loc.end.column+=u)}),r}parseTopLevel(s){return this[z].impliedStrict&&(this.strict=!0),super.parseTopLevel(s)}raise(s,r){let n=e.acorn.getLineInfo(this.input,s),o=new SyntaxError(r);throw o.index=s,o.lineNumber=n.line,o.column=n.column+1,o}raiseRecoverable(s,r){this.raise(s,r)}unexpected(s){let r="Unexpected token";if(s!=null){if(this.pos=s,this.options.locations)for(;this.pos this.start&&(r+=` ${this.input.slice(this.start,this.end)}`),this.raise(this.start,r)}jsx_readString(s){let r=super.jsx_readString(s);return this.type===t.string&&(this[z].jsxAttrValueToken=!0),r}[Ze](s){return s.type==="TemplateElement"&&this[z].templateElements.push(s),s.type.includes("Function")&&!s.generator&&(s.generator=!1),s}}};var Gs={_regular:null,_jsx:null,get regular(){return this._regular===null&&(this._regular=T.extend(et())),this._regular},get jsx(){return this._jsx===null&&(this._jsx=T.extend((0,fi.default)(),et())),this._jsx},get(e){return!!(e&&e.ecmaFeatures&&e.ecmaFeatures.jsx)?this.jsx:this.regular}};function di(e,t){let i=Gs.get(t);return new i(t,e).parse()}var Ks={ecmaVersion:"latest",range:!0,loc:!0,comment:!0,tokens:!0,sourceType:"module",ecmaFeatures:{jsx:!0,globalReturn:!0,impliedStrict:!1}};function Ws(e){let{message:t,lineNumber:i,column:s}=e;return typeof i!="number"?e:be(t,{loc:{start:{line:i,column:s}},cause:e})}function Xs(e,t={}){let i=we(t),s=(i?[i]:["module","script"]).map(n=>()=>di(e,{...Ks,sourceType:n})),r;try{r=Se(s)}catch({errors:[n]}){throw Ws(n)}return ke(r,{text:e})}var mi=Ce(Xs);var zs={acorn:pi,espree:mi};return _i(Hs);}); \ No newline at end of file +`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return K(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(s,8);return r>255&&(s=s.slice(0,-1),r=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),(s!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Q(t)?"":String.fromCharCode(t)}};v.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};v.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,s=this.options.ecmaVersion>=6;this.pos {if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[i<0?t.length+i:i]:t.at(i)},Ke=cs;function ls(e){return Array.isArray(e)&&e.length>0}var Wt=ls;function P(e){var s,r,n;let t=((s=e.range)==null?void 0:s[0])??e.start,i=(n=((r=e.declaration)==null?void 0:r.decorators)??e.decorators)==null?void 0:n[0];return i?Math.min(P(i),t):t}function j(e){var t;return((t=e.range)==null?void 0:t[1])??e.end}function fs(e){let t=new Set(e);return i=>t.has(i==null?void 0:i.type)}var Xt=fs;var ds=Xt(["Block","CommentBlock","MultiLine"]),oe=ds;function ms(e){let t=`*${e.value}*`.split(` +`);return t.length>1&&t.every(i=>i.trimStart()[0]==="*")}var We=ms;function xs(e){return oe(e)&&e.value[0]==="*"&&/@(?:type|satisfies)\b/.test(e.value)}var zt=xs;var ue=null;function he(e){if(ue!==null&&typeof ue.property){let t=ue;return ue=he.prototype=null,t}return ue=he.prototype=e??Object.create(null),new he}var ys=10;for(let e=0;e<=ys;e++)he();function Xe(e){return he(e)}function gs(e,t="type"){Xe(e);function i(s){let r=s[t],n=e[r];if(!Array.isArray(n))throw Object.assign(new Error(`Missing visitor keys for '${r}'.`),{node:s});return n}return i}var Ht=gs;var Qt={ArrayExpression:["elements"],AssignmentExpression:["left","right"],BinaryExpression:["left","right"],InterpreterDirective:[],Directive:["value"],DirectiveLiteral:[],BlockStatement:["directives","body"],BreakStatement:["label"],CallExpression:["callee","arguments","typeParameters","typeArguments"],CatchClause:["param","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["test","body"],EmptyStatement:[],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body","returnType","typeParameters","predicate"],FunctionExpression:["id","params","body","returnType","typeParameters"],Identifier:["typeAnnotation","decorators"],IfStatement:["test","consequent","alternate"],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],NewExpression:["callee","arguments","typeParameters","typeArguments"],Program:["directives","body"],ObjectExpression:["properties"],ObjectMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectProperty:["key","value","decorators"],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ParenthesizedExpression:["expression"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["params","body","returnType","typeParameters","predicate"],ClassBody:["body"],ClassExpression:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ClassDeclaration:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ExportAllDeclaration:["source","attributes","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ForOfStatement:["left","right","body"],ImportDeclaration:["specifiers","source","attributes"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["local","imported"],ImportExpression:["source","options","attributes"],MetaProperty:["meta","property"],ClassMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectPattern:["properties","typeAnnotation","decorators"],SpreadElement:["argument"],Super:[],TaggedTemplateExpression:["tag","quasi","typeParameters","typeArguments"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:["argument"],AwaitExpression:["argument"],Import:[],BigIntLiteral:[],ExportNamespaceSpecifier:["exported"],OptionalMemberExpression:["object","property"],OptionalCallExpression:["callee","arguments","typeParameters","typeArguments"],ClassProperty:["key","value","typeAnnotation","decorators","variance"],ClassAccessorProperty:["key","value","typeAnnotation","decorators"],ClassPrivateProperty:["key","value","decorators","typeAnnotation","variance"],ClassPrivateMethod:["key","params","body","decorators","returnType","typeParameters"],PrivateName:["id"],StaticBlock:["body"],AnyTypeAnnotation:[],ArrayTypeAnnotation:["elementType"],BooleanTypeAnnotation:[],BooleanLiteralTypeAnnotation:[],NullLiteralTypeAnnotation:[],ClassImplements:["id","typeParameters"],DeclareClass:["id","typeParameters","extends","mixins","implements","body"],DeclareFunction:["id","predicate"],DeclareInterface:["id","typeParameters","extends","body"],DeclareModule:["id","body"],DeclareModuleExports:["typeAnnotation"],DeclareTypeAlias:["id","typeParameters","right"],DeclareOpaqueType:["id","typeParameters","supertype"],DeclareVariable:["id"],DeclareExportDeclaration:["declaration","specifiers","source"],DeclareExportAllDeclaration:["source"],DeclaredPredicate:["value"],ExistsTypeAnnotation:[],FunctionTypeAnnotation:["typeParameters","params","rest","returnType","this"],FunctionTypeParam:["name","typeAnnotation"],GenericTypeAnnotation:["id","typeParameters"],InferredPredicate:[],InterfaceExtends:["id","typeParameters"],InterfaceDeclaration:["id","typeParameters","extends","body"],InterfaceTypeAnnotation:["extends","body"],IntersectionTypeAnnotation:["types"],MixedTypeAnnotation:[],EmptyTypeAnnotation:[],NullableTypeAnnotation:["typeAnnotation"],NumberLiteralTypeAnnotation:[],NumberTypeAnnotation:[],ObjectTypeAnnotation:["properties","indexers","callProperties","internalSlots"],ObjectTypeInternalSlot:["id","value","optional","static","method"],ObjectTypeCallProperty:["value"],ObjectTypeIndexer:["id","key","value","variance"],ObjectTypeProperty:["key","value","variance"],ObjectTypeSpreadProperty:["argument"],OpaqueType:["id","typeParameters","supertype","impltype"],QualifiedTypeIdentifier:["id","qualification"],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],SymbolTypeAnnotation:[],ThisTypeAnnotation:[],TupleTypeAnnotation:["types","elementTypes"],TypeofTypeAnnotation:["argument","typeArguments"],TypeAlias:["id","typeParameters","right"],TypeAnnotation:["typeAnnotation"],TypeCastExpression:["expression","typeAnnotation"],TypeParameter:["bound","default","variance"],TypeParameterDeclaration:["params"],TypeParameterInstantiation:["params"],UnionTypeAnnotation:["types"],Variance:[],VoidTypeAnnotation:[],EnumDeclaration:["id","body"],EnumBooleanBody:["members"],EnumNumberBody:["members"],EnumStringBody:["members"],EnumSymbolBody:["members"],EnumBooleanMember:["id","init"],EnumNumberMember:["id","init"],EnumStringMember:["id","init"],EnumDefaultedMember:["id"],IndexedAccessType:["objectType","indexType"],OptionalIndexedAccessType:["objectType","indexType"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXSpreadChild:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes","typeArguments","typeParameters"],JSXSpreadAttribute:["argument"],JSXText:[],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningFragment:[],JSXClosingFragment:[],Noop:[],Placeholder:[],V8IntrinsicIdentifier:[],ArgumentPlaceholder:[],BindExpression:["object","callee"],ImportAttribute:["key","value"],Decorator:["expression"],DoExpression:["body"],ExportDefaultSpecifier:["exported"],RecordExpression:["properties"],TupleExpression:["elements"],DecimalLiteral:[],ModuleExpression:["body"],TopicReference:[],PipelineTopicExpression:["expression"],PipelineBareFunction:["callee"],PipelinePrimaryTopicReference:[],TSParameterProperty:["parameter","decorators"],TSDeclareFunction:["id","typeParameters","params","returnType","body"],TSDeclareMethod:["decorators","key","typeParameters","params","returnType"],TSQualifiedName:["left","right"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation","params","returnType"],TSIndexSignature:["parameters","typeAnnotation"],TSAnyKeyword:[],TSBooleanKeyword:[],TSBigIntKeyword:[],TSIntrinsicKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSFunctionType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructorType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSTypeReference:["typeName","typeParameters","typeArguments"],TSTypePredicate:["parameterName","typeAnnotation"],TSTypeQuery:["exprName","typeParameters","typeArguments"],TSTypeLiteral:["members"],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSNamedTupleMember:["label","elementType"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","typeAnnotation","nameType"],TSLiteralType:["literal"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSInstantiationExpression:["expression","typeParameters","typeArguments"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportType:["argument","qualifier","typeParameters","typeArguments"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSNonNullExpression:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterInstantiation:["params"],TSTypeParameterDeclaration:["params"],TSTypeParameter:["constraint","default","name"],ChainExpression:["expression"],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],Literal:[],MethodDefinition:["decorators","key","value"],PrivateIdentifier:[],Property:["key","value"],PropertyDefinition:["decorators","key","typeAnnotation","value","variance"],AccessorProperty:["decorators","key","typeAnnotation","value"],TSAbstractAccessorProperty:["decorators","key","typeAnnotation"],TSAbstractKeyword:[],TSAbstractMethodDefinition:["key","value"],TSAbstractPropertyDefinition:["decorators","key","typeAnnotation"],TSAsyncKeyword:[],TSClassImplements:["expression","typeArguments","typeParameters"],TSDeclareKeyword:[],TSEmptyBodyFunctionExpression:["id","typeParameters","params","returnType"],TSExportKeyword:[],TSInterfaceHeritage:["expression","typeArguments","typeParameters"],TSPrivateKeyword:[],TSProtectedKeyword:[],TSPublicKeyword:[],TSReadonlyKeyword:[],TSStaticKeyword:[],TSTemplateLiteralType:["quasis","types"],AsExpression:["expression","typeAnnotation"],BigIntLiteralTypeAnnotation:[],BigIntTypeAnnotation:[],ConditionalTypeAnnotation:["checkType","extendsType","trueType","falseType"],DeclareEnum:["id","body"],InferTypeAnnotation:["typeParameter"],KeyofTypeAnnotation:["argument"],ObjectTypeMappedTypeProperty:["keyTparam","propType","sourceType","variance"],QualifiedTypeofIdentifier:["qualification","id"],TupleTypeLabeledElement:["label","elementType","variance"],TupleTypeSpreadElement:["label","typeAnnotation"],TypeOperator:["typeAnnotation"],TypePredicate:["parameterName","typeAnnotation","asserts"],NGRoot:["node"],NGPipeExpression:["left","right","arguments"],NGChainedExpression:["expressions"],NGEmptyExpression:[],NGMicrosyntax:["body"],NGMicrosyntaxKey:[],NGMicrosyntaxExpression:["expression","alias"],NGMicrosyntaxKeyedExpression:["key","expression"],NGMicrosyntaxLet:["key","value"],NGMicrosyntaxAs:["key","alias"],JsExpressionRoot:["node"],JsonRoot:["node"],TSJSDocAllType:[],TSJSDocUnknownType:[],TSJSDocNullableType:["typeAnnotation"],TSJSDocNonNullableType:["typeAnnotation"],NeverTypeAnnotation:[],UndefinedTypeAnnotation:[],UnknownTypeAnnotation:[],AsConstExpression:["expression"],SatisfiesExpression:["expression","typeAnnotation"]};var vs=Ht(Qt),Yt=vs;function ze(e,t){if(!(e!==null&&typeof e=="object"))return e;if(Array.isArray(e)){for(let s=0;s {var o;(o=n.leadingComments)!=null&&o.some(zt)&&r.add(P(n))}),e=_e(e,n=>{if(n.type==="ParenthesizedExpression"){let{expression:o}=n;if(o.type==="TypeCastExpression")return o.range=[...n.range],o;let u=P(n);if(!r.has(u))return o.extra={...o.extra,parenthesized:!0},o}})}if(e=_e(e,r=>{var n;switch(r.type){case"LogicalExpression":if($t(r))return He(r);break;case"VariableDeclaration":{let o=Ke(!1,r.declarations,-1);o!=null&&o.init&&s[j(o)]!==";"&&(r.range=[P(r),j(o)]);break}case"TSParenthesizedType":return r.typeAnnotation;case"TSTypeParameter":if(typeof r.name=="string"){let o=P(r);r.name={type:"Identifier",name:r.name,range:[o,o+r.name.length]}}break;case"TopicReference":e.extra={...e.extra,__isUsingHackPipeline:!0};break;case"ExportAllDeclaration":if(i==="meriyah"&&((n=r.exported)==null?void 0:n.type)==="Identifier"){let{exported:o}=r,u=s.slice(P(o),j(o));(u.startsWith('"')||u.startsWith("'"))&&(r.exported={...r.exported,type:"Literal",value:r.exported.name,raw:u})}break;case"TSUnionType":case"TSIntersectionType":if(r.types.length===1)return r.types[0];break}}),Wt(e.comments)){let r=Ke(!1,e.comments,-1);for(let n=e.comments.length-2;n>=0;n--){let o=e.comments[n];j(o)===P(r)&&oe(o)&&oe(r)&&We(o)&&We(r)&&(e.comments.splice(n+1,1),o.value+="*//*"+r.value,o.range=[P(o),j(r)]),r=o}}return e.type==="Program"&&(e.range=[0,s.length]),e}function $t(e){return e.type==="LogicalExpression"&&e.right.type==="LogicalExpression"&&e.operator===e.right.operator}function He(e){return $t(e)?He({type:"LogicalExpression",operator:e.operator,left:He({type:"LogicalExpression",operator:e.operator,left:e.left,right:e.right.left,range:[P(e.left),j(e.right.left)]}),right:e.right.right,range:[P(e),j(e)]}):e}var Ce=bs;var Z=Ae(ai(),1);function Is(e){if(!e.startsWith("#!"))return"";let t=e.indexOf(` +`);return t===-1?e:e.slice(0,t)}var ni=Is;function Ns(e){let t=ni(e);t&&(e=e.slice(t.length+1));let i=(0,Z.extract)(e),{pragmas:s,comments:r}=(0,Z.parseWithComments)(i);return{shebang:t,text:e,pragmas:s,comments:r}}function oi(e){let{pragmas:t}=Ns(e);return Object.prototype.hasOwnProperty.call(t,"prettier")||Object.prototype.hasOwnProperty.call(t,"format")}function Vs(e){return e=typeof e=="function"?{parse:e}:e,{astFormat:"estree",hasPragma:oi,locStart:P,locEnd:j,...e}}var Te=Vs;function Ls(e){let{filepath:t}=e;if(t){if(t=t.toLowerCase(),t.endsWith(".cjs"))return"script";if(t.endsWith(".mjs"))return"module"}}var ke=Ls;var Rs={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,locations:!0,ranges:!0};function Os(e){let{message:t,loc:i}=e;if(!i)return e;let{line:s,column:r}=i;return be(t.replace(/ \(\d+:\d+\)$/,""),{loc:{start:{line:s,column:r+1}},cause:e})}var ui,Bs=()=>(ui??(ui=T.extend((0,hi.default)())),ui);function Ds(e,t){let i=Bs(),s=[],r=[],n=i.parse(e,{...Rs,sourceType:t,allowImportExportEverywhere:t==="module",onComment:s,onToken:r});return n.comments=s,n.tokens=r,n}function Fs(e,t={}){let i=ke(t),s=(i?[i]:["module","script"]).map(n=>()=>Ds(e,n)),r;try{r=Se(s)}catch({errors:[n]}){throw Os(n)}return Ce(r,{text:e})}var pi=Te(Fs);var fi=Ae(Ge(),1);var w={Boolean:"Boolean",EOF:" ",Identifier:"Identifier",PrivateIdentifier:"PrivateIdentifier",Keyword:"Keyword",Null:"Null",Numeric:"Numeric",Punctuator:"Punctuator",String:"String",RegularExpression:"RegularExpression",Template:"Template",JSXIdentifier:"JSXIdentifier",JSXText:"JSXText"};function Ms(e,t){let i=e[0],s=e[e.length-1],r={type:w.Template,value:t.slice(i.start,s.end)};return i.loc&&(r.loc={start:i.loc.start,end:s.loc.end}),i.range&&(r.start=i.range[0],r.end=s.range[1],r.range=[r.start,r.end]),r}function Qe(e,t){this._acornTokTypes=e,this._tokens=[],this._curlyBrace=null,this._code=t}Qe.prototype={constructor:Qe,translate(e,t){let i=e.type,s=this._acornTokTypes;if(i===s.name)e.type=w.Identifier,e.value==="static"&&(e.type=w.Keyword),t.ecmaVersion>5&&(e.value==="yield"||e.value==="let")&&(e.type=w.Keyword);else if(i===s.privateId)e.type=w.PrivateIdentifier;else if(i===s.semi||i===s.comma||i===s.parenL||i===s.parenR||i===s.braceL||i===s.braceR||i===s.dot||i===s.bracketL||i===s.colon||i===s.question||i===s.bracketR||i===s.ellipsis||i===s.arrow||i===s.jsxTagStart||i===s.incDec||i===s.starstar||i===s.jsxTagEnd||i===s.prefix||i===s.questionDot||i.binop&&!i.keyword||i.isAssign)e.type=w.Punctuator,e.value=this._code.slice(e.start,e.end);else if(i===s.jsxName)e.type=w.JSXIdentifier;else if(i.label==="jsxText"||i===s.jsxAttrValueToken)e.type=w.JSXText;else if(i.keyword)i.keyword==="true"||i.keyword==="false"?e.type=w.Boolean:i.keyword==="null"?e.type=w.Null:e.type=w.Keyword;else if(i===s.num)e.type=w.Numeric,e.value=this._code.slice(e.start,e.end);else if(i===s.string)t.jsxAttrValueToken?(t.jsxAttrValueToken=!1,e.type=w.JSXText):e.type=w.String,e.value=this._code.slice(e.start,e.end);else if(i===s.regexp){e.type=w.RegularExpression;let r=e.value;e.regex={flags:r.flags,pattern:r.pattern},e.value=`/${r.pattern}/${r.flags}`}return e},onToken(e,t){let i=this._acornTokTypes,s=t.tokens,r=this._tokens,n=()=>{s.push(Ms(this._tokens,this._code)),this._tokens=[]};if(e.type===i.eof){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t));return}if(e.type===i.backQuote){this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),r.push(e),r.length>1&&n();return}if(e.type===i.dollarBraceL){r.push(e),n();return}if(e.type===i.braceR){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=e;return}if(e.type===i.template||e.type===i.invalidTemplate){this._curlyBrace&&(r.push(this._curlyBrace),this._curlyBrace=null),r.push(e);return}this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),s.push(this.translate(e,t))}};var ci=Qe;var Ye=[3,5,6,7,8,9,10,11,12,13,14,15];function js(){return Ye[Ye.length-1]}function Us(e=5){let t=e==="latest"?js():e;if(typeof t!="number")throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof e} instead.`);if(t>=2015&&(t-=2009),!Ye.includes(t))throw new Error("Invalid ecmaVersion.");return t}function qs(e="script"){if(e==="script"||e==="module")return e;if(e==="commonjs")return"script";throw new Error("Invalid sourceType.")}function li(e){let t=Us(e.ecmaVersion),i=qs(e.sourceType),s=e.range===!0,r=e.loc===!0;if(t!==3&&e.allowReserved)throw new Error("`allowReserved` is only supported when ecmaVersion is 3");if(typeof e.allowReserved<"u"&&typeof e.allowReserved!="boolean")throw new Error("`allowReserved`, when present, must be `true` or `false`");let n=t===3?e.allowReserved||"never":!1,o=e.ecmaFeatures||{},u=e.sourceType==="commonjs"||!!o.globalReturn;if(i==="module"&&t<6)throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");return Object.assign({},e,{ecmaVersion:t,sourceType:i,ranges:s,locations:r,allowReserved:n,allowReturnOutsideFunction:u})}var z=Symbol("espree's internal state"),$e=Symbol("espree's esprimaFinishNode");function Js(e,t,i,s,r,n,o){let u;e?u="Block":o.slice(i,i+2)==="#!"?u="Hashbang":u="Line";let h={type:u,value:t};return typeof i=="number"&&(h.start=i,h.end=s,h.range=[i,s]),typeof r=="object"&&(h.loc={start:r,end:n}),h}var Ze=()=>e=>{let t=Object.assign({},e.acorn.tokTypes);return e.acornJsx&&Object.assign(t,e.acornJsx.tokTypes),class extends e{constructor(s,r){(typeof s!="object"||s===null)&&(s={}),typeof r!="string"&&!(r instanceof String)&&(r=String(r));let n=s.sourceType,o=li(s),u=o.ecmaFeatures||{},h=o.tokens===!0?new ci(t,r):null,l={originalSourceType:n||o.sourceType,tokens:h?[]:null,comments:o.comment===!0?[]:null,impliedStrict:u.impliedStrict===!0&&o.ecmaVersion>=5,ecmaVersion:o.ecmaVersion,jsxAttrValueToken:!1,lastToken:null,templateElements:[]};super({ecmaVersion:o.ecmaVersion,sourceType:o.sourceType,ranges:o.ranges,locations:o.locations,allowReserved:o.allowReserved,allowReturnOutsideFunction:o.allowReturnOutsideFunction,onToken(x){h&&h.onToken(x,l),x.type!==t.eof&&(l.lastToken=x)},onComment(x,_,B,p,d,m){if(l.comments){let g=Js(x,_,B,p,d,m,r);l.comments.push(g)}}},r),this[z]=l}tokenize(){do this.next();while(this.type!==t.eof);this.next();let s=this[z],r=s.tokens;return s.comments&&(r.comments=s.comments),r}finishNode(...s){let r=super.finishNode(...s);return this[$e](r)}finishNodeAt(...s){let r=super.finishNodeAt(...s);return this[$e](r)}parse(){let s=this[z],r=super.parse();if(r.sourceType=s.originalSourceType,s.comments&&(r.comments=s.comments),s.tokens&&(r.tokens=s.tokens),r.body.length){let[n]=r.body;r.range&&(r.range[0]=n.range[0]),r.loc&&(r.loc.start=n.loc.start),r.start=n.start}return s.lastToken&&(r.range&&(r.range[1]=s.lastToken.range[1]),r.loc&&(r.loc.end=s.lastToken.loc.end),r.end=s.lastToken.end),this[z].templateElements.forEach(n=>{let u=n.tail?1:2;n.start+=-1,n.end+=u,n.range&&(n.range[0]+=-1,n.range[1]+=u),n.loc&&(n.loc.start.column+=-1,n.loc.end.column+=u)}),r}parseTopLevel(s){return this[z].impliedStrict&&(this.strict=!0),super.parseTopLevel(s)}raise(s,r){let n=e.acorn.getLineInfo(this.input,s),o=new SyntaxError(r);throw o.index=s,o.lineNumber=n.line,o.column=n.column+1,o}raiseRecoverable(s,r){this.raise(s,r)}unexpected(s){let r="Unexpected token";if(s!=null){if(this.pos=s,this.options.locations)for(;this.pos this.start&&(r+=` ${this.input.slice(this.start,this.end)}`),this.raise(this.start,r)}jsx_readString(s){let r=super.jsx_readString(s);return this.type===t.string&&(this[z].jsxAttrValueToken=!0),r}[$e](s){return s.type==="TemplateElement"&&this[z].templateElements.push(s),s.type.includes("Function")&&!s.generator&&(s.generator=!1),s}}};var Gs={_regular:null,_jsx:null,get regular(){return this._regular===null&&(this._regular=T.extend(Ze())),this._regular},get jsx(){return this._jsx===null&&(this._jsx=T.extend((0,fi.default)(),Ze())),this._jsx},get(e){return!!(e&&e.ecmaFeatures&&e.ecmaFeatures.jsx)?this.jsx:this.regular}};function di(e,t){let i=Gs.get(t);return new i(t,e).parse()}var Ks={ecmaVersion:"latest",range:!0,loc:!0,comment:!0,tokens:!0,sourceType:"module",ecmaFeatures:{jsx:!0,globalReturn:!0,impliedStrict:!1}};function Ws(e){let{message:t,lineNumber:i,column:s}=e;return typeof i!="number"?e:be(t,{loc:{start:{line:i,column:s}},cause:e})}function Xs(e,t={}){let i=ke(t),s=(i?[i]:["module","script"]).map(n=>()=>di(e,{...Ks,sourceType:n})),r;try{r=Se(s)}catch({errors:[n]}){throw Ws(n)}return Ce(r,{text:e})}var mi=Te(Xs);var zs={acorn:pi,espree:mi};return _i(Hs);}); \ No newline at end of file diff --git a/node_modules/prettier/plugins/acorn.mjs b/node_modules/prettier/plugins/acorn.mjs index 296c74d..2fec4d1 100644 --- a/node_modules/prettier/plugins/acorn.mjs +++ b/node_modules/prettier/plugins/acorn.mjs @@ -1,13 +1,13 @@ -var xi=Object.create;var Ee=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var gi=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty;var Ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Si=(e,t)=>{for(var i in t)Ee(e,i,{get:t[i],enumerable:!0})},_i=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gi(t))!bi.call(e,r)&&r!==i&&Ee(e,r,{get:()=>t[r],enumerable:!(s=yi(t,r))||s.enumerable});return e};var Pe=(e,t,i)=>(i=e!=null?xi(vi(e)):{},_i(t||!e||!e.__esModule?Ee(i,"default",{value:e,enumerable:!0}):i,e));var Gt=Ae((Qs,Jt)=>{Jt.exports={}});var Ke=Ae((Ys,Ge)=>{"use strict";var as=Gt(),ns=/^[\da-fA-F]+$/,os=/^\d+$/,Kt=new WeakMap;function Wt(e){e=e.Parser.acorn||e;let t=Kt.get(e);if(!t){let i=e.tokTypes,s=e.TokContext,r=e.TokenType,n=new s(" ... ",!0,!0),h={tc_oTag:n,tc_cTag:o,tc_expr:u},l={jsxName:new r("jsxName"),jsxText:new r("jsxText",{beforeExpr:!0}),jsxTagStart:new r("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new r("jsxTagEnd")};l.jsxTagStart.updateContext=function(){this.context.push(u),this.context.push(n),this.exprAllowed=!1},l.jsxTagEnd.updateContext=function(x){let _=this.context.pop();_===n&&x===i.slash||_===o?(this.context.pop(),this.exprAllowed=this.curContext()===u):this.exprAllowed=!0},t={tokContexts:h,tokTypes:l},Kt.set(e,t)}return t}function ne(e){if(!e)return e;if(e.type==="JSXIdentifier")return e.name;if(e.type==="JSXNamespacedName")return e.namespace.name+":"+e.name.name;if(e.type==="JSXMemberExpression")return ne(e.object)+"."+ne(e.property)}Ge.exports=function(e){return e=e||{},function(t){return us({allowNamespaces:e.allowNamespaces!==!1,allowNamespacedObjects:!!e.allowNamespacedObjects},t)}};Object.defineProperty(Ge.exports,"tokTypes",{get:function(){return Wt(void 0).tokTypes},configurable:!0,enumerable:!0});function us(e,t){let i=t.acorn||void 0,s=Wt(i),r=i.tokTypes,n=s.tokTypes,o=i.tokContexts,u=s.tokContexts.tc_oTag,h=s.tokContexts.tc_cTag,l=s.tokContexts.tc_expr,x=i.isNewLine,_=i.isIdentifierStart,B=i.isIdentifierChar;return class extends t{static get acornJsx(){return s}jsx_readToken(){let p="",d=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let m=this.input.charCodeAt(this.pos);switch(m){case 60:case 123:return this.pos===this.start?m===60&&this.exprAllowed?(++this.pos,this.finishToken(n.jsxTagStart)):this.getTokenFromCode(m):(p+=this.input.slice(d,this.pos),this.finishToken(n.jsxText,p));case 38:p+=this.input.slice(d,this.pos),p+=this.jsx_readEntity(),d=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(m===62?">":"}")+'` or `{"'+this.input[this.pos]+'"}`?');default:x(m)?(p+=this.input.slice(d,this.pos),p+=this.jsx_readNewLine(!0),d=this.pos):++this.pos}}}jsx_readNewLine(p){let d=this.input.charCodeAt(this.pos),m;return++this.pos,d===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,m=p?` +var xi=Object.create;var we=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var gi=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty;var Ee=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Si=(e,t)=>{for(var i in t)we(e,i,{get:t[i],enumerable:!0})},_i=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of gi(t))!bi.call(e,r)&&r!==i&&we(e,r,{get:()=>t[r],enumerable:!(s=yi(t,r))||s.enumerable});return e};var Ae=(e,t,i)=>(i=e!=null?xi(vi(e)):{},_i(t||!e||!e.__esModule?we(i,"default",{value:e,enumerable:!0}):i,e));var Jt=Ee((Qs,qt)=>{qt.exports={}});var Ge=Ee((Ys,Je)=>{"use strict";var as=Jt(),ns=/^[\da-fA-F]+$/,os=/^\d+$/,Gt=new WeakMap;function Kt(e){e=e.Parser.acorn||e;let t=Gt.get(e);if(!t){let i=e.tokTypes,s=e.TokContext,r=e.TokenType,n=new s("... ",!0,!0),h={tc_oTag:n,tc_cTag:o,tc_expr:u},l={jsxName:new r("jsxName"),jsxText:new r("jsxText",{beforeExpr:!0}),jsxTagStart:new r("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new r("jsxTagEnd")};l.jsxTagStart.updateContext=function(){this.context.push(u),this.context.push(n),this.exprAllowed=!1},l.jsxTagEnd.updateContext=function(x){let _=this.context.pop();_===n&&x===i.slash||_===o?(this.context.pop(),this.exprAllowed=this.curContext()===u):this.exprAllowed=!0},t={tokContexts:h,tokTypes:l},Gt.set(e,t)}return t}function ne(e){if(!e)return e;if(e.type==="JSXIdentifier")return e.name;if(e.type==="JSXNamespacedName")return e.namespace.name+":"+e.name.name;if(e.type==="JSXMemberExpression")return ne(e.object)+"."+ne(e.property)}Je.exports=function(e){return e=e||{},function(t){return us({allowNamespaces:e.allowNamespaces!==!1,allowNamespacedObjects:!!e.allowNamespacedObjects},t)}};Object.defineProperty(Je.exports,"tokTypes",{get:function(){return Kt(void 0).tokTypes},configurable:!0,enumerable:!0});function us(e,t){let i=t.acorn||void 0,s=Kt(i),r=i.tokTypes,n=s.tokTypes,o=i.tokContexts,u=s.tokContexts.tc_oTag,h=s.tokContexts.tc_cTag,l=s.tokContexts.tc_expr,x=i.isNewLine,_=i.isIdentifierStart,B=i.isIdentifierChar;return class extends t{static get acornJsx(){return s}jsx_readToken(){let p="",d=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let m=this.input.charCodeAt(this.pos);switch(m){case 60:case 123:return this.pos===this.start?m===60&&this.exprAllowed?(++this.pos,this.finishToken(n.jsxTagStart)):this.getTokenFromCode(m):(p+=this.input.slice(d,this.pos),this.finishToken(n.jsxText,p));case 38:p+=this.input.slice(d,this.pos),p+=this.jsx_readEntity(),d=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(m===62?">":"}")+'` or `{"'+this.input[this.pos]+'"}`?');default:x(m)?(p+=this.input.slice(d,this.pos),p+=this.jsx_readNewLine(!0),d=this.pos):++this.pos}}}jsx_readNewLine(p){let d=this.input.charCodeAt(this.pos),m;return++this.pos,d===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,m=p?` `:`\r -`):m=String.fromCharCode(d),this.options.locations&&(++this.curLine,this.lineStart=this.pos),m}jsx_readString(p){let d="",m=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let g=this.input.charCodeAt(this.pos);if(g===p)break;g===38?(d+=this.input.slice(m,this.pos),d+=this.jsx_readEntity(),m=this.pos):x(g)?(d+=this.input.slice(m,this.pos),d+=this.jsx_readNewLine(!1),m=this.pos):++this.pos}return d+=this.input.slice(m,this.pos++),this.finishToken(r.string,d)}jsx_readEntity(){let p="",d=0,m,g=this.input[this.pos];g!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let E=++this.pos;for(;this.pos")}let we=E.name?"Element":"Fragment";return m["opening"+we]=E,m["closing"+we]=pe,m.children=g,this.type===r.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(m,"JSX"+we)}jsx_parseText(){let p=this.parseLiteral(this.value);return p.type="JSXText",p}jsx_parseElement(){let p=this.start,d=this.startLoc;return this.next(),this.jsx_parseElementAt(p,d)}parseExprAtom(p){return this.type===n.jsxText?this.jsx_parseText():this.type===n.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(p)}readToken(p){let d=this.curContext();if(d===l)return this.jsx_readToken();if(d===u||d===h){if(_(p))return this.jsx_readWord();if(p==62)return++this.pos,this.finishToken(n.jsxTagEnd);if((p===34||p===39)&&d==u)return this.jsx_readString(p)}return p===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(n.jsxTagStart)):super.readToken(p)}updateContext(p){if(this.type==r.braceL){var d=this.curContext();d==u?this.context.push(o.b_expr):d==l?this.context.push(o.b_tmpl):super.updateContext(p),this.exprAllowed=!0}else if(this.type===r.slash&&p===n.jsxTagStart)this.context.length-=2,this.context.push(h),this.exprAllowed=!1;else return super.updateContext(p)}}}});var Zt=Ae(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.extract=xs;X.parse=gs;X.parseWithComments=$t;X.print=vs;X.strip=ys;var cs=/\*\/$/,ls=/^\/\*\*?/,Qt=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,fs=/(^|\s+)\/\/([^\r\n]*)/g,Xt=/^(\r?\n)+/,ds=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,zt=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,ms=/(\r?\n|^) *\* ?/g,Yt=[];function xs(e){let t=e.match(Qt);return t?t[0].trimLeft():""}function ys(e){let t=e.match(Qt);return t&&t[0]?e.substring(t[0].length):e}function gs(e){return $t(e).pragmas}function $t(e){let t=` -`;e=e.replace(ls,"").replace(cs,"").replace(ms,"$1");let i="";for(;i!==e;)i=e,e=e.replace(ds,`${t}$1 $2${t}`);e=e.replace(Xt,"").trimRight();let s=Object.create(null),r=e.replace(zt,"").replace(Xt,"").trimRight(),n;for(;n=zt.exec(e);){let o=n[2].replace(fs,"");typeof s[n[1]]=="string"||Array.isArray(s[n[1]])?s[n[1]]=Yt.concat(s[n[1]],o):s[n[1]]=o}return{comments:r,pragmas:s}}function vs({comments:e="",pragmas:t={}}){let i=` -`,s="/**",r=" *",n=" */",o=Object.keys(t),u=o.flatMap(l=>Ht(l,t[l])).map(l=>`${r} ${l}${i}`).join("");if(!e){if(o.length===0)return"";if(o.length===1&&!Array.isArray(t[o[0]])){let l=t[o[0]];return`${s} ${Ht(o[0],l)[0]}${n}`}}let h=e.split(i).map(l=>`${r} ${l}`).join(i)+i;return s+i+(e?h:"")+(e&&o.length?r+i:"")+u+n}function Ht(e,t){return Yt.concat(t).map(i=>`@${e} ${i}`.trim())}});var tt={};Si(tt,{parsers:()=>zs});var Ci=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,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,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,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,406,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,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,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,983,6,110,6,6,9,4759,9,787719,239],ot=[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,68,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,349,41,7,1,79,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,159,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,264,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,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,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,757,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],Ti="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",ut="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Ie={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"},Ne="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",ki={5:Ne,"5module":Ne+" export import",6:Ne+" const class extends export import super"},wi=/^in(stanceof)?$/,Ei=new RegExp("["+ut+"]"),Ai=new RegExp("["+ut+Ti+"]");function Le(e,t){for(var i=65536,s=0;s e)return!1;if(i+=t[s+1],i>=e)return!0}return!1}function U(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ei.test(String.fromCharCode(e)):t===!1?!1:Le(e,ot)}function H(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ai.test(String.fromCharCode(e)):t===!1?!1:Le(e,ot)||Le(e,Ci)}var S=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function I(e,t){return new S(e,{beforeExpr:!0,binop:t})}var N={beforeExpr:!0},A={startsExpr:!0},Be={};function b(e,t){return t===void 0&&(t={}),t.keyword=e,Be[e]=new S(e,t)}var a={num:new S("num",A),regexp:new S("regexp",A),string:new S("string",A),name:new S("name",A),privateId:new S("privateId",A),eof:new S("eof"),bracketL:new S("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new S("]"),braceL:new S("{",{beforeExpr:!0,startsExpr:!0}),braceR:new S("}"),parenL:new S("(",{beforeExpr:!0,startsExpr:!0}),parenR:new S(")"),comma:new S(",",N),semi:new S(";",N),colon:new S(":",N),dot:new S("."),question:new S("?",N),questionDot:new S("?."),arrow:new S("=>",N),template:new S("template"),invalidTemplate:new S("invalidTemplate"),ellipsis:new S("...",N),backQuote:new S("`",A),dollarBraceL:new S("${",{beforeExpr:!0,startsExpr:!0}),eq:new S("=",{beforeExpr:!0,isAssign:!0}),assign:new S("_=",{beforeExpr:!0,isAssign:!0}),incDec:new S("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new S("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:I("||",1),logicalAND:I("&&",2),bitwiseOR:I("|",3),bitwiseXOR:I("^",4),bitwiseAND:I("&",5),equality:I("==/!=/===/!==",6),relational:I(">/<=/>=",7),bitShift:I("<>>/>>>",8),plusMin:new S("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:I("%",10),star:I("*",10),slash:I("/",10),starstar:new S("**",{beforeExpr:!0}),coalesce:I("??",1),_break:b("break"),_case:b("case",N),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",N),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",N),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",A),_if:b("if"),_return:b("return",N),_switch:b("switch"),_throw:b("throw",N),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",A),_super:b("super",A),_class:b("class",A),_extends:b("extends",N),_export:b("export"),_import:b("import",A),_null:b("null",A),_true:b("true",A),_false:b("false",A),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},R=/\r\n?|\n|\u2028|\u2029/,Pi=new RegExp(R.source,"g");function Q(e){return e===10||e===13||e===8232||e===8233}function ht(e,t,i){i===void 0&&(i=e.length);for(var s=t;s>10)+55296,(e&1023)+56320))}var Vi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,te=function(t,i){this.line=t,this.column=i};te.prototype.offset=function(t){return new te(this.line,this.column+t)};var me=function(t,i,s){this.start=i,this.end=s,t.sourceFile!==null&&(this.source=t.sourceFile)};function lt(e,t){for(var i=1,s=0;;){var r=ht(e,s,t);if(r<0)return new te(i,t-s);++i,s=r}}var Re={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},rt=!1;function Li(e){var t={};for(var i in Re)t[i]=e&&se(e,i)?e[i]:Re[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!rt&&typeof console=="object"&&console.warn&&(rt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required. -Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),it(t.onToken)){var s=t.onToken;t.onToken=function(r){return s.push(r)}}return it(t.onComment)&&(t.onComment=Ri(t,t.onComment)),t}function Ri(e,t){return function(i,s,r,n,o,u){var h={type:i?"Block":"Line",value:s,start:r,end:n};e.locations&&(h.loc=new me(this,o,u)),e.ranges&&(h.range=[r,n]),t.push(h)}}var ie=1,Y=2,De=4,ft=8,dt=16,mt=32,Fe=64,xt=128,re=256,Me=ie|Y|re;function je(e,t){return Y|(e?De:0)|(t?ft:0)}var le=0,Ue=1,J=2,yt=3,gt=4,vt=5,T=function(t,i,s){this.options=t=Li(t),this.sourceFile=t.sourceFile,this.keywords=G(ki[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var r="";t.allowReserved!==!0&&(r=Ie[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(r+=" await")),this.reservedWords=G(r);var n=(r?r+" ":"")+Ie.strict;this.reservedWordsStrict=G(n),this.reservedWordsStrictBind=G(n+" "+Ie.strictBind),this.input=String(i),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf(` -`,s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(R).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ie),this.regexpState=null,this.privateNameStack=[]},F={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}};T.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};F.inFunction.get=function(){return(this.currentVarScope().flags&Y)>0};F.inGenerator.get=function(){return(this.currentVarScope().flags&ft)>0&&!this.currentVarScope().inClassFieldInit};F.inAsync.get=function(){return(this.currentVarScope().flags&De)>0&&!this.currentVarScope().inClassFieldInit};F.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&re)return!1;if(t.flags&Y)return(t.flags&De)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};F.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Fe)>0||i||this.options.allowSuperOutsideMethod};F.allowDirectSuper.get=function(){return(this.currentThisScope().flags&xt)>0};F.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};F.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Y|re))>0||i};F.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&re)>0};T.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var s=this,r=0;r =,?^&]/.test(r)||r==="!"&&this.input.charAt(s+1)==="=")}e+=t[0].length,V.lastIndex=e,e+=V.exec(this.input)[0].length,this.input[e]===";"&&e++}};k.eat=function(e){return this.type===e?(this.next(),!0):!1};k.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc};k.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};k.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};k.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||R.test(this.input.slice(this.lastTokEnd,this.start))};k.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};k.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()};k.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};k.expect=function(e){this.eat(e)||this.unexpected()};k.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var xe=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};k.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};k.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,s=e.doubleProto;if(!t)return i>=0||s>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")};k.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos 55295&&s<56320)return!0;if(U(s,!0)){for(var r=i+1;H(s=this.input.charCodeAt(r),!0);)++r;if(s===92||s>55295&&s<56320)return!0;var n=this.input.slice(i,r);if(!wi.test(n))return!0}return!1};f.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;V.lastIndex=this.pos;var e=V.exec(this.input),t=this.pos+e[0].length,i;return!R.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(H(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};f.parseStatement=function(e,t,i){var s=this.type,r=this.startNode(),n;switch(this.isLet(e)&&(s=a._var,n="let"),s){case a._break:case a._continue:return this.parseBreakContinueStatement(r,s.keyword);case a._debugger:return this.parseDebuggerStatement(r);case a._do:return this.parseDoStatement(r);case a._for:return this.parseForStatement(r);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(r,!0);case a._if:return this.parseIfStatement(r);case a._return:return this.parseReturnStatement(r);case a._switch:return this.parseSwitchStatement(r);case a._throw:return this.parseThrowStatement(r);case a._try:return this.parseTryStatement(r);case a._const:case a._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(r,n);case a._while:return this.parseWhileStatement(r);case a._with:return this.parseWithStatement(r);case a.braceL:return this.parseBlock(!0,r);case a.semi:return this.parseEmptyStatement(r);case a._export:case a._import:if(this.options.ecmaVersion>10&&s===a._import){V.lastIndex=this.pos;var o=V.exec(this.input),u=this.pos+o[0].length,h=this.input.charCodeAt(u);if(h===40||h===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===a._import?this.parseImport(r):this.parseExport(r,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var l=this.value,x=this.parseExpression();return s===a.name&&x.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(r,l,x,e):this.parseExpressionStatement(r,x)}};f.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var s=0;s =6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};f.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(qe),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var s=this.startNode(),r=i?"let":this.value;return this.next(),this.parseVar(s,!0,r),this.finishNode(s,"VariableDeclaration"),(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&s.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,s)):(t>-1&&this.unexpected(t),this.parseFor(e,s))}var n=this.isContextual("let"),o=!1,u=new xe,h=this.parseExpression(t>-1?"await":!0,u);return this.type===a._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),n&&o&&this.raise(h.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(h,!1,u),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))};f.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,ee|(i?0:Oe),!1,t)};f.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};f.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};f.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(Bi),this.enterScope(0);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var s=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),s?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};f.parseThrowStatement=function(e){return this.next(),R.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Di=[];f.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?mt:0),this.checkLValPattern(e,t?gt:J),this.expect(a.parenR),e};f.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};f.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};f.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(qe),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};f.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};f.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};f.parseLabeledStatement=function(e,t,i,s){for(var r=0,n=this.labels;r =0;h--){var l=this.labels[h];if(l.statementStart===e.start)l.statementStart=this.start,l.kind=u;else break}return this.labels.push({name:t,kind:u,statementStart:this.start}),e.body=this.parseStatement(s?s.indexOf("label")===-1?s+"label":s:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};f.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};f.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var s=this.parseStatement(null);t.body.push(s)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};f.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};f.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};f.parseVar=function(e,t,i,s){for(e.declarations=[],e.kind=i;;){var r=this.startNode();if(this.parseVarId(r,i),this.eat(a.eq)?r.init=this.parseMaybeAssign(t):!s&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!s&&r.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(a.comma))break}return e};f.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Ue:J,!1)};var ee=1,Oe=2,bt=4;f.parseFunction=function(e,t,i,s,r){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===a.star&&t&Oe&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!s),t&ee&&(e.id=t&bt&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Oe)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ue:J:yt));var n=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(e.async,e.generator)),t&ee||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,r),this.yieldPos=n,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(e,t&ee?"FunctionDeclaration":"FunctionExpression")};f.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};f.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var s=this.enterClassBody(),r=this.startNode(),n=!1;for(r.body=[],this.expect(a.braceL);this.type!==a.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(r.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(n&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),n=!0):o.key&&o.key.type==="PrivateIdentifier"&&Fi(s,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};f.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),s="",r=!1,n=!1,o="method",u=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?u=!0:s="static"}if(i.static=u,!s&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?n=!0:s="async"),!s&&(t>=9||!n)&&this.eat(a.star)&&(r=!0),!s&&!n&&!r){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=h:s=h)}if(s?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=s,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||o!=="method"||r||n){var l=!i.static&&fe(i,"constructor"),x=l&&e;l&&o!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=l?"constructor":o,this.parseClassMethod(i,r,n,x)}else this.parseClassField(i);return i};f.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword};f.parseClassElementName=function(e){this.type===a.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};f.parseClassMethod=function(e,t,i,s){var r=e.key;e.kind==="constructor"?(t&&this.raise(r.start,"Constructor can't be a generator"),i&&this.raise(r.start,"Constructor can't be an async method")):e.static&&fe(e,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,s);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};f.parseClassField=function(e){if(fe(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&fe(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};f.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(re|Fe);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};f.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,J,!1)):(t===!0&&this.unexpected(),e.id=null)};f.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null};f.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};f.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var s=this.privateNameStack.length,r=s===0?null:this.privateNameStack[s-1],n=0;n =11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};f.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var i=0,s=e.specifiers;i =13&&this.type===a.string){var e=this.parseLiteral(this.value);return Vi.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};f.adaptDirectivePrologue=function(e){for(var t=0;t =5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var O=T.prototype;O.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var s=0,r=e.properties;s =6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()};O.parseBindingList=function(e,t,i,s){for(var r=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(a.comma),t&&this.type===a.comma)r.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),r.push(o),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else r.push(this.parseAssignableListItem(s))}return r};O.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};O.parseBindingListItem=function(e){return e};O.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var s=this.startNodeAt(e,t);return s.left=i,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")};O.checkLValSimple=function(e,t,i){t===void 0&&(t=le);var s=t!==le;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(s?"Binding ":"Assigning to ")+e.name+" in strict mode"),s&&(t===J&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(se(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==vt&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":s&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return s&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(s?"Binding":"Assigning to")+" rvalue")}};O.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=le),e.type){case"ObjectPattern":for(var s=0,r=e.properties;s =1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};$.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};$.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===C.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?C.b_stat:C.b_expr),this.exprAllowed=!0};a.dollarBraceL.updateContext=function(){this.context.push(C.b_tmpl),this.exprAllowed=!0};a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?C.p_stat:C.p_expr),this.exprAllowed=!0};a.incDec.updateContext=function(){};a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==C.p_stat)&&!(e===a._return&&R.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===C.b_stat)?this.context.push(C.f_expr):this.context.push(C.f_stat),this.exprAllowed=!1};a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};a.backQuote.updateContext=function(){this.curContext()===C.q_tmpl?this.context.pop():this.context.push(C.q_tmpl),this.exprAllowed=!1};a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===C.f_expr?this.context[t]=C.f_expr_gen:this.context[t]=C.f_gen}this.exprAllowed=!0};a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var y=T.prototype;y.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var s=e.key,r;switch(s.type){case"Identifier":r=s.name;break;case"Literal":r=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);return}r="$"+r;var o=t[r];if(o){var u;n==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[n],u&&this.raiseRecoverable(s.start,"Redefinition of property")}else o=t[r]={init:!1,get:!1,set:!1};o[n]=!0}};y.parseExpression=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeAssign(e,t);if(this.type===a.comma){var n=this.startNodeAt(i,s);for(n.expressions=[r];this.eat(a.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return r};y.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var s=!1,r=-1,n=-1,o=-1;t?(r=t.parenthesizedAssign,n=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new xe,s=!0);var u=this.start,h=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var l=this.parseMaybeConditional(e,t);if(i&&(l=i.call(this,l,u,h)),this.type.isAssign){var x=this.startNodeAt(u,h);return x.operator=this.value,this.type===a.eq&&(l=this.toAssignable(l,!1,t)),s||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(l):this.checkLValSimple(l),x.left=l,this.next(),x.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(x,"AssignmentExpression")}else s&&this.checkExpressionErrors(t,!0);return r>-1&&(t.parenthesizedAssign=r),n>-1&&(t.trailingComma=n),l};y.parseMaybeConditional=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return r;if(this.eat(a.question)){var n=this.startNodeAt(i,s);return n.test=r,n.consequent=this.parseMaybeAssign(),this.expect(a.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return r};y.parseExprOps=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||r.start===i&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,i,s,-1,e)};y.parseExprOp=function(e,t,i,s,r){var n=this.type.binop;if(n!=null&&(!r||this.type!==a._in)&&n>s){var o=this.type===a.logicalOR||this.type===a.logicalAND,u=this.type===a.coalesce;u&&(n=a.logicalAND.binop);var h=this.value;this.next();var l=this.start,x=this.startLoc,_=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,r),l,x,n,r),B=this.buildBinary(t,i,e,_,h,o||u);return(o&&this.type===a.coalesce||u&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(B,t,i,s,r)}return e};y.buildBinary=function(e,t,i,s,r,n){s.type==="PrivateIdentifier"&&this.raise(s.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=i,o.operator=r,o.right=s,this.finishNode(o,n?"LogicalExpression":"BinaryExpression")};y.parseMaybeUnary=function(e,t,i,s){var r=this.start,n=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(s),t=!0;else if(this.type.prefix){var u=this.startNode(),h=this.type===a.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,h,s),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&u.argument.type==="Identifier"?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&St(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=!0,o=this.finishNode(u,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(s||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,s),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,n);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(r,n,o,this.parseMaybeUnary(null,!1,!1,s),"**",!1);else return o};function St(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&St(e.expression)}y.parseExprSubscripts=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprAtom(e,t);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var n=this.parseSubscripts(r,i,s,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};y.parseSubscripts=function(e,t,i,s,r){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var u=this.parseSubscript(e,t,i,s,n,o,r);if(u.optional&&(o=!0),u===e||u.type==="ArrowFunctionExpression"){if(o){var h=this.startNodeAt(t,i);h.expression=u,u=this.finishNode(h,"ChainExpression")}return u}e=u}};y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)};y.parseSubscriptAsyncArrow=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,s)};y.parseSubscript=function(e,t,i,s,r,n,o){var u=this.options.ecmaVersion>=11,h=u&&this.eat(a.questionDot);s&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(a.bracketL);if(l||h&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var x=this.startNodeAt(t,i);x.object=e,l?(x.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?x.property=this.parsePrivateIdent():x.property=this.parseIdent(this.options.allowReserved!=="never"),x.computed=!!l,u&&(x.optional=h),e=this.finishNode(x,"MemberExpression")}else if(!s&&this.eat(a.parenL)){var _=new xe,B=this.yieldPos,p=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,_);if(r&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=B,this.awaitPos=p,this.awaitIdentPos=d,this.parseSubscriptAsyncArrow(t,i,m,o);this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var g=this.startNodeAt(t,i);g.callee=e,g.arguments=m,u&&(g.optional=h),e=this.finishNode(g,"CallExpression")}else if(this.type===a.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e};y.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var s,r=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),s=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(s.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(s,"Super");case a._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case a.name:var n=this.start,o=this.startLoc,u=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(C.f_expr),this.parseFunction(this.startNodeAt(n,o),0,!1,!0,t);if(r&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(n,o),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===a.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,o),[h],!0,t)}return h;case a.regexp:var l=this.value;return s=this.parseLiteral(l.value),s.regex={pattern:l.pattern,flags:l.flags},s;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return s=this.startNode(),s.value=this.type===a._null?null:this.type===a._true,s.raw=this.type.keyword,this.next(),this.finishNode(s,"Literal");case a.parenL:var x=this.start,_=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(_)&&(e.parenthesizedAssign=x),e.parenthesizedBind<0&&(e.parenthesizedBind=x)),_;case a.bracketL:return s=this.startNode(),this.next(),s.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(s,"ArrayExpression");case a.braceL:return this.overrideContext(C.b_expr),this.parseObj(!1,e);case a._function:return s=this.startNode(),this.next(),this.parseFunction(s,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};y.parseExprAtomDefault=function(){this.unexpected()};y.parseExprImport=function(e){var t=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var i=this.parseIdent(!0);if(this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot)return t.meta=i,this.parseImportMeta(t);this.unexpected()};y.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};y.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};y.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};y.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e};y.shouldParseArrow=function(e){return!this.canInsertSemicolon()};y.parseParenAndDistinguishExpression=function(e,t){var i=this.start,s=this.startLoc,r,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,h=[],l=!0,x=!1,_=new xe,B=this.yieldPos,p=this.awaitPos,d;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(l?l=!1:this.expect(a.comma),n&&this.afterTrailingComma(a.parenR,!0)){x=!0;break}else if(this.type===a.ellipsis){d=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,_,this.parseParenItem));var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(h)&&this.eat(a.arrow))return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=B,this.awaitPos=p,this.parseParenArrowList(i,s,h,t);(!h.length||x)&&this.unexpected(this.lastTokStart),d&&this.unexpected(d),this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(r=this.startNodeAt(o,u),r.expressions=h,this.finishNodeAt(r,"SequenceExpression",m,g)):r=h[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,s);return E.expression=r,this.finishNode(E,"ParenthesizedExpression")}else return r};y.parseParenItem=function(e){return e};y.parseParenArrowList=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,s)};var Mi=[];y.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===a.dot){var t=this.startNodeAt(e.start,e.startLoc);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var s=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),s,r,!0,!1),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Mi,this.finishNode(e,"NewExpression")};y.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value,cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,` -`),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")};y.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var s=this.parseTemplateElement({isTagged:t});for(i.quasis=[s];!s.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(s=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};y.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!R.test(this.input.slice(this.lastTokEnd,this.start))};y.parseObj=function(e,t){var i=this.startNode(),s=!0,r={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(s)s=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,r,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};y.parseProperty=function(e,t){var i=this.startNode(),s,r,n,o;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,o=this.startLoc),e||(s=this.eat(a.star)));var u=this.containsEsc;return this.parsePropertyName(i),!e&&!u&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(i)?(r=!0,s=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):r=!1,this.parsePropertyValue(i,e,s,r,n,o,t,u),this.finishNode(i,"Property")};y.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};y.parsePropertyValue=function(e,t,i,s,r,n,o,u){(i||s)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,s)):!t&&!u&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||s)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||s)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),e.kind="init",t?e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key)):this.type===a.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};y.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};y.parseMethod=function(e,t,i){var s=this.startNode(),r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=e),this.options.ecmaVersion>=8&&(s.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(je(t,s.generator)|Fe|(i?xt:0)),this.expect(a.parenL),s.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0,!1),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(s,"FunctionExpression")};y.parseArrowExpression=function(e,t,i,s){var r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(je(i,!1)|dt),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,s),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};y.parseFunctionBody=function(e,t,i,s){var r=t&&this.type!==a.braceL,n=this.strict,o=!1;if(r)e.body=this.parseMaybeAssign(s),e.expression=!0,this.checkParams(e,!1);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!n&&!o&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,vt),e.body=this.parseBlock(!1,void 0,o&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()};y.isSimpleParamList=function(e){for(var t=0,i=e;t -1||r.functions.indexOf(e)>-1||r.var.indexOf(e)>-1,r.lexical.push(e),this.inModule&&r.flags&ie&&delete this.undefinedExports[e]}else if(t===gt){var n=this.currentScope();n.lexical.push(e)}else if(t===yt){var o=this.currentScope();this.treatFunctionsAsVar?s=o.lexical.indexOf(e)>-1:s=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var u=this.scopeStack.length-1;u>=0;--u){var h=this.scopeStack[u];if(h.lexical.indexOf(e)>-1&&!(h.flags&mt&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){s=!0;break}if(h.var.push(e),this.inModule&&h.flags&ie&&delete this.undefinedExports[e],h.flags&Me)break}s&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};W.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};W.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};W.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Me)return t}};W.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Me&&!(t.flags&dt))return t}};var ye=function(t,i,s){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new me(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ae=T.prototype;ae.startNode=function(){return new ye(this,this.start,this.startLoc)};ae.startNodeAt=function(e,t){return new ye(this,e,t)};function _t(e,t,i,s){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=s),this.options.ranges&&(e.range[1]=i),e}ae.finishNode=function(e,t){return _t.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};ae.finishNodeAt=function(e,t,i,s){return _t.call(this,e,t,i,s)};ae.copyNode=function(e){var t=new ye(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var 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",Tt=Ct+" Extended_Pictographic",kt=Tt,wt=kt+" EBase EComp EMod EPres ExtPict",Et=wt,Ui=Et,qi={9:Ct,10:Tt,11:kt,12:wt,13:Et,14:Ui},Ji="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Gi={9:"",10:"",11:"",12:"",13:"",14:Ji},at="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",At="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",Pt=At+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",It=Pt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Nt=It+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Vt=Nt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ki=Vt+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",Wi={9:At,10:Pt,11:It,12:Nt,13:Vt,14:Ki},Lt={};function Xi(e){var t=Lt[e]={binary:G(qi[e]+" "+at),binaryOfStrings:G(Gi[e]),nonBinary:{General_Category:G(at),Script:G(Wi[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(ce=0,Ve=[9,10,11,12,13,14];ce =6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Lt[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=[],this.backReferenceNames=[]};M.prototype.reset=function(t,i,s){var r=s.indexOf("v")!==-1,n=s.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=s,r&&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)};M.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};M.prototype.at=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return-1;var n=s.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=r)return n;var o=s.charCodeAt(t+1);return o>=56320&&o<=57343?(n<<10)+o-56613888:n};M.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return r;var n=s.charCodeAt(t),o;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=r||(o=s.charCodeAt(t+1))<56320||o>57343?t+1:t+2};M.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};M.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};M.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};M.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};M.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var s=this.pos,r=0,n=t;r -1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(s=!0),o==="v"&&(r=!0)}this.options.ecmaVersion>=15&&s&&r&&this.raise(e.start,"Invalid regular expression flag")};c.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};c.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t =9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};c.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};c.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};c.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var s=0,r=-1;if(this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue),e.eat(125)))return r!==-1&&r =9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};c.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};c.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};c.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Rt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Rt(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}c.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Rt(i);)e.advance();return e.pos!==t};c.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};c.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};c.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};c.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=K(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=K(e.lastIntValue);return!0}return!1};c.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),zi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function zi(e){return U(e,!0)||e===36||e===95}c.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),Hi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function Hi(e){return H(e,!0)||e===36||e===95||e===8204||e===8205}c.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};c.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};c.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};c.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};c.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};c.regexp_eatZero=function(e){return e.current()===48&&!ge(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};c.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};c.regexp_eatControlLetter=function(e){var t=e.current();return Ot(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ot(e){return e>=65&&e<=90||e>=97&&e<=122}c.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var r=e.lastIntValue;if(s&&r>=55296&&r<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(r-55296)*1024+(o-56320)+65536,!0}e.pos=n,e.lastIntValue=r}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Qi(e.lastIntValue))return!0;s&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Qi(e){return e>=0&&e<=1114111}c.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};c.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Bt=0,q=1,L=2;c.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Yi(t))return e.lastIntValue=-1,e.advance(),q;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var s;if(e.eat(123)&&(s=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&s===L&&e.raise("Invalid property name"),s;e.raise("Invalid property name")}return Bt};function Yi(e){return e===100||e===68||e===115||e===83||e===119||e===87}c.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,s),q}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,r)}return Bt};c.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){se(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};c.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return q;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return L;e.raise("Invalid property name")};c.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Dt(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function Dt(e){return Ot(e)||e===95}c.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";$i(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function $i(e){return Dt(e)||ge(e)}c.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};c.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===L&&e.raise("Negated character class may contain strings"),!0}return!1};c.regexp_classContents=function(e){return e.current()===93?q:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),q)};c.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};c.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||jt(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var s=e.current();return s!==93?(e.lastIntValue=s,e.advance(),!0):!1};c.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};c.regexp_classSetExpression=function(e){var t=q,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===L&&(t=L);for(var s=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==L&&(t=q);continue}e.raise("Invalid character in character class")}if(s!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(s!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===L&&(t=L)}};c.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;return i!==-1&&s!==-1&&i>s&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};c.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?q:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};c.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),s=this.regexp_classContents(e);if(e.eat(93))return i&&s===L&&e.raise("Negated character class may contain strings"),s;e.pos=t}if(e.eat(92)){var r=this.regexp_eatCharacterClassEscape(e);if(r)return r;e.pos=t}return null};c.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null};c.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===L&&(t=L);return t};c.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?q:L};c.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Zi(i)||es(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Zi(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function es(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}c.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ts(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ts(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}c.regexp_eatClassControlLetter=function(e){var t=e.current();return ge(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};c.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};c.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ge(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ge(e){return e>=48&&e<=57}c.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Ft(i=e.current());)e.lastIntValue=16*e.lastIntValue+Mt(i),e.advance();return e.pos!==t};function Ft(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Mt(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}c.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};c.regexp_eatOctalDigit=function(e){var t=e.current();return jt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function jt(e){return e>=48&&e<=55}c.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var s=0;s=this.input.length)return this.finishToken(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};v.readToken=function(e){return U(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};v.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};v.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var s=void 0,r=t;(s=ht(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=s;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};v.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=e);this.pos 8&&e<14||e>=5760&&pt.test(String.fromCharCode(e)))++this.pos;else break e}}};v.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};v.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(a.ellipsis)):(++this.pos,this.finishToken(a.dot))};v.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)};v.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,s=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,s=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(s,i)};v.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)};v.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)};v.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||R.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)};v.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(a.relational,i))};v.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)};v.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)};v.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),U(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+K(t)+"'")};v.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+K(e)+"'")};v.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};v.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(R.test(s)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(s==="[")t=!0;else if(s==="]"&&t)t=!1;else if(s==="/"&&!t)break;e=s==="\\"}++this.pos}var r=this.input.slice(i,this.pos);++this.pos;var n=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(n);var u=this.regexpState||(this.regexpState=new M(this));u.reset(i,r,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var h=null;try{h=new RegExp(r,o)}catch{}return this.finishToken(a.regexp,{pattern:r,flags:o,value:h})};v.readInt=function(e,t,i){for(var s=this.options.ecmaVersion>=12&&t===void 0,r=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,o=0,u=0,h=0,l=t??1/0;h =97?_=x-97+10:x>=65?_=x-65+10:x>=48&&x<=57?_=x-48:_=1/0,_>=e)break;u=x,o=o*e+_}return s&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:o};function is(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ut(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}v.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Ut(this.input.slice(t,this.pos)),++this.pos):U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)};v.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&s===110){var r=Ut(this.input.slice(t,this.pos));return++this.pos,U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,r)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),s===46&&!i&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(s===69||s===101)&&!i&&(s=this.input.charCodeAt(++this.pos),(s===43||s===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=is(this.input.slice(t,this.pos),i);return this.finishToken(a.num,n)};v.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};v.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===e)break;s===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):s===8232||s===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Q(s)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var qt={};v.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===qt)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};v.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw qt;this.raise(e,t)};v.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Q(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=` +`):m=String.fromCharCode(d),this.options.locations&&(++this.curLine,this.lineStart=this.pos),m}jsx_readString(p){let d="",m=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let g=this.input.charCodeAt(this.pos);if(g===p)break;g===38?(d+=this.input.slice(m,this.pos),d+=this.jsx_readEntity(),m=this.pos):x(g)?(d+=this.input.slice(m,this.pos),d+=this.jsx_readNewLine(!1),m=this.pos):++this.pos}return d+=this.input.slice(m,this.pos++),this.finishToken(r.string,d)}jsx_readEntity(){let p="",d=0,m,g=this.input[this.pos];g!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let E=++this.pos;for(;this.pos ")}let ke=E.name?"Element":"Fragment";return m["opening"+ke]=E,m["closing"+ke]=pe,m.children=g,this.type===r.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(m,"JSX"+ke)}jsx_parseText(){let p=this.parseLiteral(this.value);return p.type="JSXText",p}jsx_parseElement(){let p=this.start,d=this.startLoc;return this.next(),this.jsx_parseElementAt(p,d)}parseExprAtom(p){return this.type===n.jsxText?this.jsx_parseText():this.type===n.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(p)}readToken(p){let d=this.curContext();if(d===l)return this.jsx_readToken();if(d===u||d===h){if(_(p))return this.jsx_readWord();if(p==62)return++this.pos,this.finishToken(n.jsxTagEnd);if((p===34||p===39)&&d==u)return this.jsx_readString(p)}return p===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(n.jsxTagStart)):super.readToken(p)}updateContext(p){if(this.type==r.braceL){var d=this.curContext();d==u?this.context.push(o.b_expr):d==l?this.context.push(o.b_tmpl):super.updateContext(p),this.exprAllowed=!0}else if(this.type===r.slash&&p===n.jsxTagStart)this.context.length-=2,this.context.push(h),this.exprAllowed=!1;else return super.updateContext(p)}}}});var ai=Ee(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.extract=ws;X.parse=As;X.parseWithComments=ri;X.print=Ps;X.strip=Es;var Ss=/\*\/$/,_s=/^\/\*\*?/,ii=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,Cs=/(^|\s+)\/\/([^\r\n]*)/g,Zt=/^(\r?\n)+/,Ts=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,ei=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,ks=/(\r?\n|^) *\* ?/g,si=[];function ws(e){let t=e.match(ii);return t?t[0].trimLeft():""}function Es(e){let t=e.match(ii);return t&&t[0]?e.substring(t[0].length):e}function As(e){return ri(e).pragmas}function ri(e){let t=` +`;e=e.replace(_s,"").replace(Ss,"").replace(ks,"$1");let i="";for(;i!==e;)i=e,e=e.replace(Ts,`${t}$1 $2${t}`);e=e.replace(Zt,"").trimRight();let s=Object.create(null),r=e.replace(ei,"").replace(Zt,"").trimRight(),n;for(;n=ei.exec(e);){let o=n[2].replace(Cs,"");typeof s[n[1]]=="string"||Array.isArray(s[n[1]])?s[n[1]]=si.concat(s[n[1]],o):s[n[1]]=o}return{comments:r,pragmas:s}}function Ps({comments:e="",pragmas:t={}}){let i=` +`,s="/**",r=" *",n=" */",o=Object.keys(t),u=o.flatMap(l=>ti(l,t[l])).map(l=>`${r} ${l}${i}`).join("");if(!e){if(o.length===0)return"";if(o.length===1&&!Array.isArray(t[o[0]])){let l=t[o[0]];return`${s} ${ti(o[0],l)[0]}${n}`}}let h=e.split(i).map(l=>`${r} ${l}`).join(i)+i;return s+i+(e?h:"")+(e&&o.length?r+i:"")+u+n}function ti(e,t){return si.concat(t).map(i=>`@${e} ${i}`.trim())}});var et={};Si(et,{parsers:()=>zs});var Ci=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,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,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,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,406,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,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,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,983,6,110,6,6,9,4759,9,787719,239],nt=[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,68,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,349,41,7,1,79,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,159,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,264,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,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,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,757,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],Ti="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",ot="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Pe={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"},Ie="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",ki={5:Ie,"5module":Ie+" export import",6:Ie+" const class extends export import super"},wi=/^in(stanceof)?$/,Ei=new RegExp("["+ot+"]"),Ai=new RegExp("["+ot+Ti+"]");function Ve(e,t){for(var i=65536,s=0;s e)return!1;if(i+=t[s+1],i>=e)return!0}return!1}function U(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ei.test(String.fromCharCode(e)):t===!1?!1:Ve(e,nt)}function H(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ai.test(String.fromCharCode(e)):t===!1?!1:Ve(e,nt)||Ve(e,Ci)}var S=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function I(e,t){return new S(e,{beforeExpr:!0,binop:t})}var N={beforeExpr:!0},A={startsExpr:!0},Oe={};function b(e,t){return t===void 0&&(t={}),t.keyword=e,Oe[e]=new S(e,t)}var a={num:new S("num",A),regexp:new S("regexp",A),string:new S("string",A),name:new S("name",A),privateId:new S("privateId",A),eof:new S("eof"),bracketL:new S("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new S("]"),braceL:new S("{",{beforeExpr:!0,startsExpr:!0}),braceR:new S("}"),parenL:new S("(",{beforeExpr:!0,startsExpr:!0}),parenR:new S(")"),comma:new S(",",N),semi:new S(";",N),colon:new S(":",N),dot:new S("."),question:new S("?",N),questionDot:new S("?."),arrow:new S("=>",N),template:new S("template"),invalidTemplate:new S("invalidTemplate"),ellipsis:new S("...",N),backQuote:new S("`",A),dollarBraceL:new S("${",{beforeExpr:!0,startsExpr:!0}),eq:new S("=",{beforeExpr:!0,isAssign:!0}),assign:new S("_=",{beforeExpr:!0,isAssign:!0}),incDec:new S("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new S("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:I("||",1),logicalAND:I("&&",2),bitwiseOR:I("|",3),bitwiseXOR:I("^",4),bitwiseAND:I("&",5),equality:I("==/!=/===/!==",6),relational:I(">/<=/>=",7),bitShift:I("<>>/>>>",8),plusMin:new S("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:I("%",10),star:I("*",10),slash:I("/",10),starstar:new S("**",{beforeExpr:!0}),coalesce:I("??",1),_break:b("break"),_case:b("case",N),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",N),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",N),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",A),_if:b("if"),_return:b("return",N),_switch:b("switch"),_throw:b("throw",N),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",A),_super:b("super",A),_class:b("class",A),_extends:b("extends",N),_export:b("export"),_import:b("import",A),_null:b("null",A),_true:b("true",A),_false:b("false",A),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},R=/\r\n?|\n|\u2028|\u2029/,Pi=new RegExp(R.source,"g");function Q(e){return e===10||e===13||e===8232||e===8233}function ut(e,t,i){i===void 0&&(i=e.length);for(var s=t;s>10)+55296,(e&1023)+56320))}var Vi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,te=function(t,i){this.line=t,this.column=i};te.prototype.offset=function(t){return new te(this.line,this.column+t)};var me=function(t,i,s){this.start=i,this.end=s,t.sourceFile!==null&&(this.source=t.sourceFile)};function ct(e,t){for(var i=1,s=0;;){var r=ut(e,s,t);if(r<0)return new te(i,t-s);++i,s=r}}var Le={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},st=!1;function Li(e){var t={};for(var i in Le)t[i]=e&&se(e,i)?e[i]:Le[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!st&&typeof console=="object"&&console.warn&&(st=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required. +Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),tt(t.onToken)){var s=t.onToken;t.onToken=function(r){return s.push(r)}}return tt(t.onComment)&&(t.onComment=Ri(t,t.onComment)),t}function Ri(e,t){return function(i,s,r,n,o,u){var h={type:i?"Block":"Line",value:s,start:r,end:n};e.locations&&(h.loc=new me(this,o,u)),e.ranges&&(h.range=[r,n]),t.push(h)}}var ie=1,Y=2,Be=4,lt=8,ft=16,dt=32,De=64,mt=128,re=256,Fe=ie|Y|re;function Me(e,t){return Y|(e?Be:0)|(t?lt:0)}var le=0,je=1,J=2,xt=3,yt=4,gt=5,T=function(t,i,s){this.options=t=Li(t),this.sourceFile=t.sourceFile,this.keywords=G(ki[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var r="";t.allowReserved!==!0&&(r=Pe[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(r+=" await")),this.reservedWords=G(r);var n=(r?r+" ":"")+Pe.strict;this.reservedWordsStrict=G(n),this.reservedWordsStrictBind=G(n+" "+Pe.strictBind),this.input=String(i),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf(` +`,s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(R).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=a.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ie),this.regexpState=null,this.privateNameStack=[]},F={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}};T.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};F.inFunction.get=function(){return(this.currentVarScope().flags&Y)>0};F.inGenerator.get=function(){return(this.currentVarScope().flags<)>0&&!this.currentVarScope().inClassFieldInit};F.inAsync.get=function(){return(this.currentVarScope().flags&Be)>0&&!this.currentVarScope().inClassFieldInit};F.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&re)return!1;if(t.flags&Y)return(t.flags&Be)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};F.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&De)>0||i||this.options.allowSuperOutsideMethod};F.allowDirectSuper.get=function(){return(this.currentThisScope().flags&mt)>0};F.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};F.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Y|re))>0||i};F.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&re)>0};T.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var s=this,r=0;r =,?^&]/.test(r)||r==="!"&&this.input.charAt(s+1)==="=")}e+=t[0].length,V.lastIndex=e,e+=V.exec(this.input)[0].length,this.input[e]===";"&&e++}};k.eat=function(e){return this.type===e?(this.next(),!0):!1};k.isContextual=function(e){return this.type===a.name&&this.value===e&&!this.containsEsc};k.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};k.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};k.canInsertSemicolon=function(){return this.type===a.eof||this.type===a.braceR||R.test(this.input.slice(this.lastTokEnd,this.start))};k.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};k.semicolon=function(){!this.eat(a.semi)&&!this.insertSemicolon()&&this.unexpected()};k.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};k.expect=function(e){this.eat(e)||this.unexpected()};k.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var xe=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};k.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};k.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,s=e.doubleProto;if(!t)return i>=0||s>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")};k.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos 55295&&s<56320)return!0;if(U(s,!0)){for(var r=i+1;H(s=this.input.charCodeAt(r),!0);)++r;if(s===92||s>55295&&s<56320)return!0;var n=this.input.slice(i,r);if(!wi.test(n))return!0}return!1};f.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;V.lastIndex=this.pos;var e=V.exec(this.input),t=this.pos+e[0].length,i;return!R.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(H(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};f.parseStatement=function(e,t,i){var s=this.type,r=this.startNode(),n;switch(this.isLet(e)&&(s=a._var,n="let"),s){case a._break:case a._continue:return this.parseBreakContinueStatement(r,s.keyword);case a._debugger:return this.parseDebuggerStatement(r);case a._do:return this.parseDoStatement(r);case a._for:return this.parseForStatement(r);case a._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!e);case a._class:return e&&this.unexpected(),this.parseClass(r,!0);case a._if:return this.parseIfStatement(r);case a._return:return this.parseReturnStatement(r);case a._switch:return this.parseSwitchStatement(r);case a._throw:return this.parseThrowStatement(r);case a._try:return this.parseTryStatement(r);case a._const:case a._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(r,n);case a._while:return this.parseWhileStatement(r);case a._with:return this.parseWithStatement(r);case a.braceL:return this.parseBlock(!0,r);case a.semi:return this.parseEmptyStatement(r);case a._export:case a._import:if(this.options.ecmaVersion>10&&s===a._import){V.lastIndex=this.pos;var o=V.exec(this.input),u=this.pos+o[0].length,h=this.input.charCodeAt(u);if(h===40||h===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===a._import?this.parseImport(r):this.parseExport(r,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!e);var l=this.value,x=this.parseExpression();return s===a.name&&x.type==="Identifier"&&this.eat(a.colon)?this.parseLabeledStatement(r,l,x,e):this.parseExpressionStatement(r,x)}};f.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(a.semi)||this.insertSemicolon()?e.label=null:this.type!==a.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var s=0;s =6?this.eat(a.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};f.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ue),this.enterScope(0),this.expect(a.parenL),this.type===a.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===a._var||this.type===a._const||i){var s=this.startNode(),r=i?"let":this.value;return this.next(),this.parseVar(s,!0,r),this.finishNode(s,"VariableDeclaration"),(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&s.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,s)):(t>-1&&this.unexpected(t),this.parseFor(e,s))}var n=this.isContextual("let"),o=!1,u=new xe,h=this.parseExpression(t>-1?"await":!0,u);return this.type===a._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===a._in?t>-1&&this.unexpected(t):e.await=t>-1),n&&o&&this.raise(h.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(h,!1,u),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))};f.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,ee|(i?0:Re),!1,t)};f.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};f.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(a.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};f.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(a.braceL),this.labels.push(Bi),this.enterScope(0);for(var t,i=!1;this.type!==a.braceR;)if(this.type===a._case||this.type===a._default){var s=this.type===a._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),s?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(a.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};f.parseThrowStatement=function(e){return this.next(),R.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Di=[];f.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?dt:0),this.checkLValPattern(e,t?yt:J),this.expect(a.parenR),e};f.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===a._catch){var t=this.startNode();this.next(),this.eat(a.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(a._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};f.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};f.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ue),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};f.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};f.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};f.parseLabeledStatement=function(e,t,i,s){for(var r=0,n=this.labels;r =0;h--){var l=this.labels[h];if(l.statementStart===e.start)l.statementStart=this.start,l.kind=u;else break}return this.labels.push({name:t,kind:u,statementStart:this.start}),e.body=this.parseStatement(s?s.indexOf("label")===-1?s+"label":s:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};f.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};f.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(a.braceL),e&&this.enterScope(0);this.type!==a.braceR;){var s=this.parseStatement(null);t.body.push(s)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};f.parseFor=function(e,t){return e.init=t,this.expect(a.semi),e.test=this.type===a.semi?null:this.parseExpression(),this.expect(a.semi),e.update=this.type===a.parenR?null:this.parseExpression(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};f.parseForIn=function(e,t){var i=this.type===a._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};f.parseVar=function(e,t,i,s){for(e.declarations=[],e.kind=i;;){var r=this.startNode();if(this.parseVarId(r,i),this.eat(a.eq)?r.init=this.parseMaybeAssign(t):!s&&i==="const"&&!(this.type===a._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!s&&r.id.type!=="Identifier"&&!(t&&(this.type===a._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(a.comma))break}return e};f.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?je:J,!1)};var ee=1,Re=2,vt=4;f.parseFunction=function(e,t,i,s,r){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===a.star&&t&Re&&this.unexpected(),e.generator=this.eat(a.star)),this.options.ecmaVersion>=8&&(e.async=!!s),t&ee&&(e.id=t&vt&&this.type!==a.name?null:this.parseIdent(),e.id&&!(t&Re)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?je:J:xt));var n=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Me(e.async,e.generator)),t&ee||(e.id=this.type===a.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,r),this.yieldPos=n,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(e,t&ee?"FunctionDeclaration":"FunctionExpression")};f.parseFunctionParams=function(e){this.expect(a.parenL),e.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};f.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var s=this.enterClassBody(),r=this.startNode(),n=!1;for(r.body=[],this.expect(a.braceL);this.type!==a.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(r.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(n&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),n=!0):o.key&&o.key.type==="PrivateIdentifier"&&Fi(s,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};f.parseClassElement=function(e){if(this.eat(a.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),s="",r=!1,n=!1,o="method",u=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(a.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===a.star?u=!0:s="static"}if(i.static=u,!s&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===a.star)&&!this.canInsertSemicolon()?n=!0:s="async"),!s&&(t>=9||!n)&&this.eat(a.star)&&(r=!0),!s&&!n&&!r){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=h:s=h)}if(s?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=s,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===a.parenL||o!=="method"||r||n){var l=!i.static&&fe(i,"constructor"),x=l&&e;l&&o!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=l?"constructor":o,this.parseClassMethod(i,r,n,x)}else this.parseClassField(i);return i};f.isClassElementNameStart=function(){return this.type===a.name||this.type===a.privateId||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword};f.parseClassElementName=function(e){this.type===a.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};f.parseClassMethod=function(e,t,i,s){var r=e.key;e.kind==="constructor"?(t&&this.raise(r.start,"Constructor can't be a generator"),i&&this.raise(r.start,"Constructor can't be an async method")):e.static&&fe(e,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,s);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};f.parseClassField=function(e){if(fe(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&fe(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(a.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};f.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(re|De);this.type!==a.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};f.parseClassId=function(e,t){this.type===a.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,J,!1)):(t===!0&&this.unexpected(),e.id=null)};f.parseClassSuper=function(e){e.superClass=this.eat(a._extends)?this.parseExprSubscripts(null,!1):null};f.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};f.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var s=this.privateNameStack.length,r=s===0?null:this.privateNameStack[s-1],n=0;n =11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};f.parseExport=function(e,t){if(this.next(),this.eat(a.star))return this.parseExportAllDeclaration(e,t);if(this.eat(a._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==a.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var i=0,s=e.specifiers;i =13&&this.type===a.string){var e=this.parseLiteral(this.value);return Vi.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};f.adaptDirectivePrologue=function(e){for(var t=0;t =5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var O=T.prototype;O.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var s=0,r=e.properties;s =6)switch(this.type){case a.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(a.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case a.braceL:return this.parseObj(!0)}return this.parseIdent()};O.parseBindingList=function(e,t,i,s){for(var r=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(a.comma),t&&this.type===a.comma)r.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===a.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),r.push(o),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else r.push(this.parseAssignableListItem(s))}return r};O.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};O.parseBindingListItem=function(e){return e};O.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(a.eq))return i;var s=this.startNodeAt(e,t);return s.left=i,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")};O.checkLValSimple=function(e,t,i){t===void 0&&(t=le);var s=t!==le;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(s?"Binding ":"Assigning to ")+e.name+" in strict mode"),s&&(t===J&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(se(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==gt&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":s&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return s&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(s?"Binding":"Assigning to")+" rvalue")}};O.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=le),e.type){case"ObjectPattern":for(var s=0,r=e.properties;s =1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};$.updateContext=function(e){var t,i=this.type;i.keyword&&e===a.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};$.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};a.parenR.updateContext=a.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===C.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};a.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?C.b_stat:C.b_expr),this.exprAllowed=!0};a.dollarBraceL.updateContext=function(){this.context.push(C.b_tmpl),this.exprAllowed=!0};a.parenL.updateContext=function(e){var t=e===a._if||e===a._for||e===a._with||e===a._while;this.context.push(t?C.p_stat:C.p_expr),this.exprAllowed=!0};a.incDec.updateContext=function(){};a._function.updateContext=a._class.updateContext=function(e){e.beforeExpr&&e!==a._else&&!(e===a.semi&&this.curContext()!==C.p_stat)&&!(e===a._return&&R.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===a.colon||e===a.braceL)&&this.curContext()===C.b_stat)?this.context.push(C.f_expr):this.context.push(C.f_stat),this.exprAllowed=!1};a.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};a.backQuote.updateContext=function(){this.curContext()===C.q_tmpl?this.context.pop():this.context.push(C.q_tmpl),this.exprAllowed=!1};a.star.updateContext=function(e){if(e===a._function){var t=this.context.length-1;this.context[t]===C.f_expr?this.context[t]=C.f_expr_gen:this.context[t]=C.f_gen}this.exprAllowed=!0};a.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==a.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var y=T.prototype;y.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var s=e.key,r;switch(s.type){case"Identifier":r=s.name;break;case"Literal":r=String(s.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),t.proto=!0);return}r="$"+r;var o=t[r];if(o){var u;n==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[n],u&&this.raiseRecoverable(s.start,"Redefinition of property")}else o=t[r]={init:!1,get:!1,set:!1};o[n]=!0}};y.parseExpression=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeAssign(e,t);if(this.type===a.comma){var n=this.startNodeAt(i,s);for(n.expressions=[r];this.eat(a.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return r};y.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var s=!1,r=-1,n=-1,o=-1;t?(r=t.parenthesizedAssign,n=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new xe,s=!0);var u=this.start,h=this.startLoc;(this.type===a.parenL||this.type===a.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var l=this.parseMaybeConditional(e,t);if(i&&(l=i.call(this,l,u,h)),this.type.isAssign){var x=this.startNodeAt(u,h);return x.operator=this.value,this.type===a.eq&&(l=this.toAssignable(l,!1,t)),s||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===a.eq?this.checkLValPattern(l):this.checkLValSimple(l),x.left=l,this.next(),x.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(x,"AssignmentExpression")}else s&&this.checkExpressionErrors(t,!0);return r>-1&&(t.parenthesizedAssign=r),n>-1&&(t.trailingComma=n),l};y.parseMaybeConditional=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return r;if(this.eat(a.question)){var n=this.startNodeAt(i,s);return n.test=r,n.consequent=this.parseMaybeAssign(),this.expect(a.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return r};y.parseExprOps=function(e,t){var i=this.start,s=this.startLoc,r=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||r.start===i&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,i,s,-1,e)};y.parseExprOp=function(e,t,i,s,r){var n=this.type.binop;if(n!=null&&(!r||this.type!==a._in)&&n>s){var o=this.type===a.logicalOR||this.type===a.logicalAND,u=this.type===a.coalesce;u&&(n=a.logicalAND.binop);var h=this.value;this.next();var l=this.start,x=this.startLoc,_=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,r),l,x,n,r),B=this.buildBinary(t,i,e,_,h,o||u);return(o&&this.type===a.coalesce||u&&(this.type===a.logicalOR||this.type===a.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(B,t,i,s,r)}return e};y.buildBinary=function(e,t,i,s,r,n){s.type==="PrivateIdentifier"&&this.raise(s.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=i,o.operator=r,o.right=s,this.finishNode(o,n?"LogicalExpression":"BinaryExpression")};y.parseMaybeUnary=function(e,t,i,s){var r=this.start,n=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(s),t=!0;else if(this.type.prefix){var u=this.startNode(),h=this.type===a.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,h,s),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&u.argument.type==="Identifier"?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&bt(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=!0,o=this.finishNode(u,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===a.privateId)(s||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==a._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,s),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,n);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,"UpdateExpression")}}if(!i&&this.eat(a.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(r,n,o,this.parseMaybeUnary(null,!1,!1,s),"**",!1);else return o};function bt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&bt(e.expression)}y.parseExprSubscripts=function(e,t){var i=this.start,s=this.startLoc,r=this.parseExprAtom(e,t);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var n=this.parseSubscripts(r,i,s,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n};y.parseSubscripts=function(e,t,i,s,r){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var u=this.parseSubscript(e,t,i,s,n,o,r);if(u.optional&&(o=!0),u===e||u.type==="ArrowFunctionExpression"){if(o){var h=this.startNodeAt(t,i);h.expression=u,u=this.finishNode(h,"ChainExpression")}return u}e=u}};y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(a.arrow)};y.parseSubscriptAsyncArrow=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,s)};y.parseSubscript=function(e,t,i,s,r,n,o){var u=this.options.ecmaVersion>=11,h=u&&this.eat(a.questionDot);s&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(a.bracketL);if(l||h&&this.type!==a.parenL&&this.type!==a.backQuote||this.eat(a.dot)){var x=this.startNodeAt(t,i);x.object=e,l?(x.property=this.parseExpression(),this.expect(a.bracketR)):this.type===a.privateId&&e.type!=="Super"?x.property=this.parsePrivateIdent():x.property=this.parseIdent(this.options.allowReserved!=="never"),x.computed=!!l,u&&(x.optional=h),e=this.finishNode(x,"MemberExpression")}else if(!s&&this.eat(a.parenL)){var _=new xe,B=this.yieldPos,p=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1,_);if(r&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=B,this.awaitPos=p,this.awaitIdentPos=d,this.parseSubscriptAsyncArrow(t,i,m,o);this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var g=this.startNodeAt(t,i);g.callee=e,g.arguments=m,u&&(g.optional=h),e=this.finishNode(g,"CallExpression")}else if(this.type===a.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e};y.parseExprAtom=function(e,t,i){this.type===a.slash&&this.readRegexp();var s,r=this.potentialArrowAt===this.start;switch(this.type){case a._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),s=this.startNode(),this.next(),this.type===a.parenL&&!this.allowDirectSuper&&this.raise(s.start,"super() call outside constructor of a subclass"),this.type!==a.dot&&this.type!==a.bracketL&&this.type!==a.parenL&&this.unexpected(),this.finishNode(s,"Super");case a._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case a.name:var n=this.start,o=this.startLoc,u=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(a._function))return this.overrideContext(C.f_expr),this.parseFunction(this.startNodeAt(n,o),0,!1,!0,t);if(r&&!this.canInsertSemicolon()){if(this.eat(a.arrow))return this.parseArrowExpression(this.startNodeAt(n,o),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===a.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(a.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,o),[h],!0,t)}return h;case a.regexp:var l=this.value;return s=this.parseLiteral(l.value),s.regex={pattern:l.pattern,flags:l.flags},s;case a.num:case a.string:return this.parseLiteral(this.value);case a._null:case a._true:case a._false:return s=this.startNode(),s.value=this.type===a._null?null:this.type===a._true,s.raw=this.type.keyword,this.next(),this.finishNode(s,"Literal");case a.parenL:var x=this.start,_=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(_)&&(e.parenthesizedAssign=x),e.parenthesizedBind<0&&(e.parenthesizedBind=x)),_;case a.bracketL:return s=this.startNode(),this.next(),s.elements=this.parseExprList(a.bracketR,!0,!0,e),this.finishNode(s,"ArrayExpression");case a.braceL:return this.overrideContext(C.b_expr),this.parseObj(!1,e);case a._function:return s=this.startNode(),this.next(),this.parseFunction(s,0);case a._class:return this.parseClass(this.startNode(),!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate();case a._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};y.parseExprAtomDefault=function(){this.unexpected()};y.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===a.parenL&&!e)return this.parseDynamicImport(t);if(this.type===a.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};y.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(a.parenR)){var t=this.start;this.eat(a.comma)&&this.eat(a.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};y.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};y.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};y.parseParenExpression=function(){this.expect(a.parenL);var e=this.parseExpression();return this.expect(a.parenR),e};y.shouldParseArrow=function(e){return!this.canInsertSemicolon()};y.parseParenAndDistinguishExpression=function(e,t){var i=this.start,s=this.startLoc,r,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,h=[],l=!0,x=!1,_=new xe,B=this.yieldPos,p=this.awaitPos,d;for(this.yieldPos=0,this.awaitPos=0;this.type!==a.parenR;)if(l?l=!1:this.expect(a.comma),n&&this.afterTrailingComma(a.parenR,!0)){x=!0;break}else if(this.type===a.ellipsis){d=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,_,this.parseParenItem));var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(a.parenR),e&&this.shouldParseArrow(h)&&this.eat(a.arrow))return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=B,this.awaitPos=p,this.parseParenArrowList(i,s,h,t);(!h.length||x)&&this.unexpected(this.lastTokStart),d&&this.unexpected(d),this.checkExpressionErrors(_,!0),this.yieldPos=B||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(r=this.startNodeAt(o,u),r.expressions=h,this.finishNodeAt(r,"SequenceExpression",m,g)):r=h[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,s);return E.expression=r,this.finishNode(E,"ParenthesizedExpression")}else return r};y.parseParenItem=function(e){return e};y.parseParenArrowList=function(e,t,i,s){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,s)};var Mi=[];y.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===a.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var s=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),s,r,!0,!1),this.eat(a.parenL)?e.arguments=this.parseExprList(a.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Mi,this.finishNode(e,"NewExpression")};y.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===a.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value,cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,` +`),cooked:this.value},this.next(),i.tail=this.type===a.backQuote,this.finishNode(i,"TemplateElement")};y.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var s=this.parseTemplateElement({isTagged:t});for(i.quasis=[s];!s.tail;)this.type===a.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(a.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(a.braceR),i.quasis.push(s=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};y.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===a.name||this.type===a.num||this.type===a.string||this.type===a.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===a.star)&&!R.test(this.input.slice(this.lastTokEnd,this.start))};y.parseObj=function(e,t){var i=this.startNode(),s=!0,r={};for(i.properties=[],this.next();!this.eat(a.braceR);){if(s)s=!1;else if(this.expect(a.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(a.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,r,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};y.parseProperty=function(e,t){var i=this.startNode(),s,r,n,o;if(this.options.ecmaVersion>=9&&this.eat(a.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===a.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===a.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,o=this.startLoc),e||(s=this.eat(a.star)));var u=this.containsEsc;return this.parsePropertyName(i),!e&&!u&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(i)?(r=!0,s=this.options.ecmaVersion>=9&&this.eat(a.star),this.parsePropertyName(i)):r=!1,this.parsePropertyValue(i,e,s,r,n,o,t,u),this.finishNode(i,"Property")};y.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};y.parsePropertyValue=function(e,t,i,s,r,n,o,u){(i||s)&&this.type===a.colon&&this.unexpected(),this.eat(a.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===a.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,s)):!t&&!u&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==a.comma&&this.type!==a.braceR&&this.type!==a.eq?((i||s)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||s)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),e.kind="init",t?e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key)):this.type===a.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(r,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};y.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(a.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(a.bracketR),e.key;e.computed=!1}return e.key=this.type===a.num||this.type===a.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};y.parseMethod=function(e,t,i){var s=this.startNode(),r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=e),this.options.ecmaVersion>=8&&(s.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Me(t,s.generator)|De|(i?mt:0)),this.expect(a.parenL),s.params=this.parseBindingList(a.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0,!1),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(s,"FunctionExpression")};y.parseArrowExpression=function(e,t,i,s){var r=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Me(i,!1)|ft),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,s),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};y.parseFunctionBody=function(e,t,i,s){var r=t&&this.type!==a.braceL,n=this.strict,o=!1;if(r)e.body=this.parseMaybeAssign(s),e.expression=!0,this.checkParams(e,!1);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!n&&!o&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,gt),e.body=this.parseBlock(!1,void 0,o&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()};y.isSimpleParamList=function(e){for(var t=0,i=e;t -1||r.functions.indexOf(e)>-1||r.var.indexOf(e)>-1,r.lexical.push(e),this.inModule&&r.flags&ie&&delete this.undefinedExports[e]}else if(t===yt){var n=this.currentScope();n.lexical.push(e)}else if(t===xt){var o=this.currentScope();this.treatFunctionsAsVar?s=o.lexical.indexOf(e)>-1:s=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var u=this.scopeStack.length-1;u>=0;--u){var h=this.scopeStack[u];if(h.lexical.indexOf(e)>-1&&!(h.flags&dt&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){s=!0;break}if(h.var.push(e),this.inModule&&h.flags&ie&&delete this.undefinedExports[e],h.flags&Fe)break}s&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};W.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};W.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};W.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Fe)return t}};W.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&Fe&&!(t.flags&ft))return t}};var ye=function(t,i,s){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new me(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ae=T.prototype;ae.startNode=function(){return new ye(this,this.start,this.startLoc)};ae.startNodeAt=function(e,t){return new ye(this,e,t)};function St(e,t,i,s){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=s),this.options.ranges&&(e.range[1]=i),e}ae.finishNode=function(e,t){return St.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};ae.finishNodeAt=function(e,t,i,s){return St.call(this,e,t,i,s)};ae.copyNode=function(e){var t=new ye(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var _t="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",Ct=_t+" Extended_Pictographic",Tt=Ct,kt=Tt+" EBase EComp EMod EPres ExtPict",wt=kt,Ui=wt,qi={9:_t,10:Ct,11:Tt,12:kt,13:wt,14:Ui},Ji="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Gi={9:"",10:"",11:"",12:"",13:"",14:Ji},rt="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",Et="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",At=Et+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Pt=At+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",It=Pt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Nt=It+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ki=Nt+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",Wi={9:Et,10:At,11:Pt,12:It,13:Nt,14:Ki},Vt={};function Xi(e){var t=Vt[e]={binary:G(qi[e]+" "+rt),binaryOfStrings:G(Gi[e]),nonBinary:{General_Category:G(rt),Script:G(Wi[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(ce=0,Ne=[9,10,11,12,13,14];ce =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=[],this.backReferenceNames=[]};M.prototype.reset=function(t,i,s){var r=s.indexOf("v")!==-1,n=s.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=s,r&&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)};M.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};M.prototype.at=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return-1;var n=s.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=r)return n;var o=s.charCodeAt(t+1);return o>=56320&&o<=57343?(n<<10)+o-56613888:n};M.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(t>=r)return r;var n=s.charCodeAt(t),o;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=r||(o=s.charCodeAt(t+1))<56320||o>57343?t+1:t+2};M.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};M.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};M.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};M.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};M.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var s=this.pos,r=0,n=t;r -1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(s=!0),o==="v"&&(r=!0)}this.options.ecmaVersion>=15&&s&&r&&this.raise(e.start,"Invalid regular expression flag")};c.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};c.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t =9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};c.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};c.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};c.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var s=0,r=-1;if(this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue),e.eat(125)))return r!==-1&&r =9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};c.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};c.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};c.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Lt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Lt(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}c.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Lt(i);)e.advance();return e.pos!==t};c.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};c.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};c.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};c.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=K(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=K(e.lastIntValue);return!0}return!1};c.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),zi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function zi(e){return U(e,!0)||e===36||e===95}c.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,s=e.current(i);return e.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(s=e.lastIntValue),Hi(s)?(e.lastIntValue=s,!0):(e.pos=t,!1)};function Hi(e){return H(e,!0)||e===36||e===95||e===8204||e===8205}c.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};c.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};c.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};c.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};c.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};c.regexp_eatZero=function(e){return e.current()===48&&!ge(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};c.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};c.regexp_eatControlLetter=function(e){var t=e.current();return Rt(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Rt(e){return e>=65&&e<=90||e>=97&&e<=122}c.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,s=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var r=e.lastIntValue;if(s&&r>=55296&&r<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(r-55296)*1024+(o-56320)+65536,!0}e.pos=n,e.lastIntValue=r}return!0}if(s&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Qi(e.lastIntValue))return!0;s&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Qi(e){return e>=0&&e<=1114111}c.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};c.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Ot=0,q=1,L=2;c.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Yi(t))return e.lastIntValue=-1,e.advance(),q;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var s;if(e.eat(123)&&(s=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&s===L&&e.raise("Invalid property name"),s;e.raise("Invalid property name")}return Ot};function Yi(e){return e===100||e===68||e===115||e===83||e===119||e===87}c.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,s),q}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,r)}return Ot};c.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){se(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};c.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return q;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return L;e.raise("Invalid property name")};c.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Bt(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function Bt(e){return Rt(e)||e===95}c.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";$i(t=e.current());)e.lastStringValue+=K(t),e.advance();return e.lastStringValue!==""};function $i(e){return Bt(e)||ge(e)}c.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};c.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===L&&e.raise("Negated character class may contain strings"),!0}return!1};c.regexp_classContents=function(e){return e.current()===93?q:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),q)};c.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};c.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Mt(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var s=e.current();return s!==93?(e.lastIntValue=s,e.advance(),!0):!1};c.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};c.regexp_classSetExpression=function(e){var t=q,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===L&&(t=L);for(var s=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==L&&(t=q);continue}e.raise("Invalid character in character class")}if(s!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(s!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===L&&(t=L)}};c.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;return i!==-1&&s!==-1&&i>s&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};c.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?q:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};c.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),s=this.regexp_classContents(e);if(e.eat(93))return i&&s===L&&e.raise("Negated character class may contain strings"),s;e.pos=t}if(e.eat(92)){var r=this.regexp_eatCharacterClassEscape(e);if(r)return r;e.pos=t}return null};c.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null};c.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===L&&(t=L);return t};c.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?q:L};c.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Zi(i)||es(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Zi(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function es(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}c.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ts(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ts(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}c.regexp_eatClassControlLetter=function(e){var t=e.current();return ge(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};c.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};c.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ge(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ge(e){return e>=48&&e<=57}c.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Dt(i=e.current());)e.lastIntValue=16*e.lastIntValue+Ft(i),e.advance();return e.pos!==t};function Dt(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ft(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}c.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};c.regexp_eatOctalDigit=function(e){var t=e.current();return Mt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Mt(e){return e>=48&&e<=55}c.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var s=0;s=this.input.length)return this.finishToken(a.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};v.readToken=function(e){return U(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};v.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};v.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var s=void 0,r=t;(s=ut(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=s;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};v.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=e);this.pos 8&&e<14||e>=5760&&ht.test(String.fromCharCode(e)))++this.pos;else break e}}};v.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};v.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(a.ellipsis)):(++this.pos,this.finishToken(a.dot))};v.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(a.assign,2):this.finishOp(a.slash,1)};v.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,s=e===42?a.star:a.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,s=a.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(a.assign,i+1):this.finishOp(s,i)};v.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(a.assign,3)}return this.finishOp(e===124?a.logicalOR:a.logicalAND,2)}return t===61?this.finishOp(a.assign,2):this.finishOp(e===124?a.bitwiseOR:a.bitwiseAND,1)};v.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)};v.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||R.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(a.incDec,2):t===61?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)};v.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(a.assign,i+1):this.finishOp(a.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(a.relational,i))};v.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(a.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(a.arrow)):this.finishOp(e===61?a.eq:a.prefix,1)};v.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(a.questionDot,2)}if(t===63){if(e>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(a.assign,3)}return this.finishOp(a.coalesce,2)}}return this.finishOp(a.question,1)};v.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),U(t,!0)||t===92))return this.finishToken(a.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+K(t)+"'")};v.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(a.parenL);case 41:return++this.pos,this.finishToken(a.parenR);case 59:return++this.pos,this.finishToken(a.semi);case 44:return++this.pos,this.finishToken(a.comma);case 91:return++this.pos,this.finishToken(a.bracketL);case 93:return++this.pos,this.finishToken(a.bracketR);case 123:return++this.pos,this.finishToken(a.braceL);case 125:return++this.pos,this.finishToken(a.braceR);case 58:return++this.pos,this.finishToken(a.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(a.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(a.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+K(e)+"'")};v.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};v.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(R.test(s)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(s==="[")t=!0;else if(s==="]"&&t)t=!1;else if(s==="/"&&!t)break;e=s==="\\"}++this.pos}var r=this.input.slice(i,this.pos);++this.pos;var n=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(n);var u=this.regexpState||(this.regexpState=new M(this));u.reset(i,r,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var h=null;try{h=new RegExp(r,o)}catch{}return this.finishToken(a.regexp,{pattern:r,flags:o,value:h})};v.readInt=function(e,t,i){for(var s=this.options.ecmaVersion>=12&&t===void 0,r=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,o=0,u=0,h=0,l=t??1/0;h =97?_=x-97+10:x>=65?_=x-65+10:x>=48&&x<=57?_=x-48:_=1/0,_>=e)break;u=x,o=o*e+_}return s&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:o};function is(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function jt(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}v.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=jt(this.input.slice(t,this.pos)),++this.pos):U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,i)};v.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&s===110){var r=jt(this.input.slice(t,this.pos));return++this.pos,U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(a.num,r)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),s===46&&!i&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(s===69||s===101)&&!i&&(s=this.input.charCodeAt(++this.pos),(s===43||s===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),U(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=is(this.input.slice(t,this.pos),i);return this.finishToken(a.num,n)};v.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};v.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===e)break;s===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):s===8232||s===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Q(s)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(a.string,t)};var Ut={};v.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ut)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};v.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ut;this.raise(e,t)};v.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===a.template||this.type===a.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(a.dollarBraceL)):(++this.pos,this.finishToken(a.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(a.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Q(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=` `;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};v.readInvalidTemplateToken=function(){for(;this.pos =48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(s,8);return r>255&&(s=s.slice(0,-1),r=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),(s!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Q(t)?"":String.fromCharCode(t)}};v.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};v.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,s=this.options.ecmaVersion>=6;this.pos 0}var Se=_s;function P(e){var s;let t=e.range?e.range[0]:e.start,i=((s=e.declaration)==null?void 0:s.decorators)??e.decorators;return Se(i)?Math.min(P(i[0]),t):t}function j(e){return e.range?e.range[1]:e.end}function Cs(e){return e=typeof e=="function"?{parse:e}:e,{astFormat:"estree",hasPragma:ti,locStart:P,locEnd:j,...e}}var _e=Cs;var Ts=(e,t,i)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[i<0?t.length+i:i]:t.at(i)},We=Ts;function ks(e){return e=new Set(e),t=>e.has(t==null?void 0:t.type)}var ii=ks;var ws=ii(["Block","CommentBlock","MultiLine"]),oe=ws;function Es(e){return oe(e)&&e.value[0]==="*"&&/@(?:type|satisfies)\b/.test(e.value)}var si=Es;function As(e){let t=`*${e.value}*`.split(` -`);return t.length>1&&t.every(i=>i.trimStart()[0]==="*")}var Xe=As;var ue=null;function he(e){if(ue!==null&&typeof ue.property){let t=ue;return ue=he.prototype=null,t}return ue=he.prototype=e??Object.create(null),new he}var Ps=10;for(let e=0;e<=Ps;e++)he();function ze(e){return he(e)}function Is(e,t="type"){ze(e);function i(s){let r=s[t],n=e[r];if(!Array.isArray(n))throw Object.assign(new Error(`Missing visitor keys for '${r}'.`),{node:s});return n}return i}var ri=Is;var ai={ArrayExpression:["elements"],AssignmentExpression:["left","right"],BinaryExpression:["left","right"],InterpreterDirective:[],Directive:["value"],DirectiveLiteral:[],BlockStatement:["directives","body"],BreakStatement:["label"],CallExpression:["callee","arguments","typeParameters","typeArguments"],CatchClause:["param","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["test","body"],EmptyStatement:[],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body","returnType","typeParameters","predicate"],FunctionExpression:["id","params","body","returnType","typeParameters"],Identifier:["typeAnnotation","decorators"],IfStatement:["test","consequent","alternate"],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],NewExpression:["callee","arguments","typeParameters","typeArguments"],Program:["directives","body"],ObjectExpression:["properties"],ObjectMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectProperty:["key","value","decorators"],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ParenthesizedExpression:["expression"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["params","body","returnType","typeParameters","predicate"],ClassBody:["body"],ClassExpression:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ClassDeclaration:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ExportAllDeclaration:["source","attributes","assertions","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source","attributes","assertions"],ExportSpecifier:["local","exported"],ForOfStatement:["left","right","body"],ImportDeclaration:["specifiers","source","attributes","assertions"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["local","imported"],ImportExpression:["source","options","attributes"],MetaProperty:["meta","property"],ClassMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectPattern:["properties","typeAnnotation","decorators"],SpreadElement:["argument"],Super:[],TaggedTemplateExpression:["tag","quasi","typeParameters","typeArguments"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:["argument"],AwaitExpression:["argument"],Import:[],BigIntLiteral:[],ExportNamespaceSpecifier:["exported"],OptionalMemberExpression:["object","property"],OptionalCallExpression:["callee","arguments","typeParameters","typeArguments"],ClassProperty:["key","value","typeAnnotation","decorators","variance"],ClassAccessorProperty:["key","value","typeAnnotation","decorators"],ClassPrivateProperty:["key","value","decorators","typeAnnotation","variance"],ClassPrivateMethod:["key","params","body","decorators","returnType","typeParameters"],PrivateName:["id"],StaticBlock:["body"],AnyTypeAnnotation:[],ArrayTypeAnnotation:["elementType"],BooleanTypeAnnotation:[],BooleanLiteralTypeAnnotation:[],NullLiteralTypeAnnotation:[],ClassImplements:["id","typeParameters"],DeclareClass:["id","typeParameters","extends","mixins","implements","body"],DeclareFunction:["id","predicate"],DeclareInterface:["id","typeParameters","extends","body"],DeclareModule:["id","body"],DeclareModuleExports:["typeAnnotation"],DeclareTypeAlias:["id","typeParameters","right"],DeclareOpaqueType:["id","typeParameters","supertype"],DeclareVariable:["id"],DeclareExportDeclaration:["declaration","specifiers","source"],DeclareExportAllDeclaration:["source"],DeclaredPredicate:["value"],ExistsTypeAnnotation:[],FunctionTypeAnnotation:["typeParameters","params","rest","returnType","this"],FunctionTypeParam:["name","typeAnnotation"],GenericTypeAnnotation:["id","typeParameters"],InferredPredicate:[],InterfaceExtends:["id","typeParameters"],InterfaceDeclaration:["id","typeParameters","extends","body"],InterfaceTypeAnnotation:["extends","body"],IntersectionTypeAnnotation:["types"],MixedTypeAnnotation:[],EmptyTypeAnnotation:[],NullableTypeAnnotation:["typeAnnotation"],NumberLiteralTypeAnnotation:[],NumberTypeAnnotation:[],ObjectTypeAnnotation:["properties","indexers","callProperties","internalSlots"],ObjectTypeInternalSlot:["id","value","optional","static","method"],ObjectTypeCallProperty:["value"],ObjectTypeIndexer:["id","key","value","variance"],ObjectTypeProperty:["key","value","variance"],ObjectTypeSpreadProperty:["argument"],OpaqueType:["id","typeParameters","supertype","impltype"],QualifiedTypeIdentifier:["id","qualification"],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],SymbolTypeAnnotation:[],ThisTypeAnnotation:[],TupleTypeAnnotation:["types","elementTypes"],TypeofTypeAnnotation:["argument","typeArguments"],TypeAlias:["id","typeParameters","right"],TypeAnnotation:["typeAnnotation"],TypeCastExpression:["expression","typeAnnotation"],TypeParameter:["bound","default","variance"],TypeParameterDeclaration:["params"],TypeParameterInstantiation:["params"],UnionTypeAnnotation:["types"],Variance:[],VoidTypeAnnotation:[],EnumDeclaration:["id","body"],EnumBooleanBody:["members"],EnumNumberBody:["members"],EnumStringBody:["members"],EnumSymbolBody:["members"],EnumBooleanMember:["id","init"],EnumNumberMember:["id","init"],EnumStringMember:["id","init"],EnumDefaultedMember:["id"],IndexedAccessType:["objectType","indexType"],OptionalIndexedAccessType:["objectType","indexType"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXSpreadChild:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes","typeArguments","typeParameters"],JSXSpreadAttribute:["argument"],JSXText:[],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningFragment:[],JSXClosingFragment:[],Noop:[],Placeholder:[],V8IntrinsicIdentifier:[],ArgumentPlaceholder:[],BindExpression:["object","callee"],ImportAttribute:["key","value"],Decorator:["expression"],DoExpression:["body"],ExportDefaultSpecifier:["exported"],RecordExpression:["properties"],TupleExpression:["elements"],DecimalLiteral:[],ModuleExpression:["body"],TopicReference:[],PipelineTopicExpression:["expression"],PipelineBareFunction:["callee"],PipelinePrimaryTopicReference:[],TSParameterProperty:["parameter","decorators"],TSDeclareFunction:["id","typeParameters","params","returnType","body"],TSDeclareMethod:["decorators","key","typeParameters","params","returnType"],TSQualifiedName:["left","right"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation","params","returnType"],TSIndexSignature:["parameters","typeAnnotation"],TSAnyKeyword:[],TSBooleanKeyword:[],TSBigIntKeyword:[],TSIntrinsicKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSFunctionType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructorType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSTypeReference:["typeName","typeParameters","typeArguments"],TSTypePredicate:["parameterName","typeAnnotation"],TSTypeQuery:["exprName","typeParameters","typeArguments"],TSTypeLiteral:["members"],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSNamedTupleMember:["label","elementType"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","typeAnnotation","nameType"],TSLiteralType:["literal"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSInstantiationExpression:["expression","typeParameters","typeArguments"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportType:["argument","qualifier","typeParameters","typeArguments"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSNonNullExpression:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterInstantiation:["params"],TSTypeParameterDeclaration:["params"],TSTypeParameter:["constraint","default","name"],ChainExpression:["expression"],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],Literal:[],MethodDefinition:["decorators","key","value"],PrivateIdentifier:[],Property:["key","value"],PropertyDefinition:["decorators","key","typeAnnotation","value","variance"],AccessorProperty:["decorators","key","typeAnnotation","value"],TSAbstractAccessorProperty:["decorators","key","typeAnnotation"],TSAbstractKeyword:[],TSAbstractMethodDefinition:["key","value"],TSAbstractPropertyDefinition:["decorators","key","typeAnnotation"],TSAsyncKeyword:[],TSClassImplements:["expression","typeArguments","typeParameters"],TSDeclareKeyword:[],TSEmptyBodyFunctionExpression:["id","typeParameters","params","returnType"],TSExportKeyword:[],TSInterfaceHeritage:["expression","typeArguments","typeParameters"],TSPrivateKeyword:[],TSProtectedKeyword:[],TSPublicKeyword:[],TSReadonlyKeyword:[],TSStaticKeyword:[],TSTemplateLiteralType:["quasis","types"],AsExpression:["expression","typeAnnotation"],BigIntLiteralTypeAnnotation:[],BigIntTypeAnnotation:[],ConditionalTypeAnnotation:["checkType","extendsType","trueType","falseType"],DeclareEnum:["id","body"],InferTypeAnnotation:["typeParameter"],KeyofTypeAnnotation:["argument"],ObjectTypeMappedTypeProperty:["keyTparam","propType","sourceType","variance"],QualifiedTypeofIdentifier:["qualification","id"],TupleTypeLabeledElement:["label","elementType","variance"],TupleTypeSpreadElement:["label","typeAnnotation"],TypeOperator:["typeAnnotation"],TypePredicate:["parameterName","typeAnnotation","asserts"],NGRoot:["node"],NGPipeExpression:["left","right","arguments"],NGChainedExpression:["expressions"],NGEmptyExpression:[],NGMicrosyntax:["body"],NGMicrosyntaxKey:[],NGMicrosyntaxExpression:["expression","alias"],NGMicrosyntaxKeyedExpression:["key","expression"],NGMicrosyntaxLet:["key","value"],NGMicrosyntaxAs:["key","alias"],JsExpressionRoot:["node"],JsonRoot:["node"],TSJSDocAllType:[],TSJSDocUnknownType:[],TSJSDocNullableType:["typeAnnotation"],TSJSDocNonNullableType:["typeAnnotation"],NeverTypeAnnotation:[],UndefinedTypeAnnotation:[],UnknownTypeAnnotation:[],AsConstExpression:["expression"],SatisfiesExpression:["expression","typeAnnotation"]};var Ns=ri(ai),ni=Ns;function He(e,t){if(!(e!==null&&typeof e=="object"))return e;if(Array.isArray(e)){for(let s=0;s {var u;(u=o.leadingComments)!=null&&u.some(si)&&n.add(P(o))}),e=Ce(e,o=>{if(o.type==="ParenthesizedExpression"){let{expression:u}=o;if(u.type==="TypeCastExpression")return u.range=o.range,u;let h=P(o);if(!n.has(h))return u.extra={...u.extra,parenthesized:!0},u}})}if(e=Ce(e,n=>{switch(n.type){case"LogicalExpression":if(oi(n))return Qe(n);break;case"VariableDeclaration":{let o=We(!1,n.declarations,-1);o!=null&&o.init&&r(n,o);break}case"TSParenthesizedType":return n.typeAnnotation;case"TSTypeParameter":if(typeof n.name=="string"){let o=P(n);n.name={type:"Identifier",name:n.name,range:[o,o+n.name.length]}}break;case"TopicReference":e.extra={...e.extra,__isUsingHackPipeline:!0};break;case"ExportAllDeclaration":{let{exported:o}=n;if(i==="meriyah"&&(o==null?void 0:o.type)==="Identifier"){let u=s.slice(P(o),j(o));(u.startsWith('"')||u.startsWith("'"))&&(n.exported={...n.exported,type:"Literal",value:n.exported.name,raw:u})}break}case"TSUnionType":case"TSIntersectionType":if(n.types.length===1)return n.types[0];break}}),Se(e.comments)){let n=We(!1,e.comments,-1);for(let o=e.comments.length-2;o>=0;o--){let u=e.comments[o];j(u)===P(n)&&oe(u)&&oe(n)&&Xe(u)&&Xe(n)&&(e.comments.splice(o+1,1),u.value+="*//*"+n.value,u.range=[P(u),j(n)]),n=u}}return e.type==="Program"&&(e.range=[0,s.length]),e;function r(n,o){s[j(o)]!==";"&&(n.range=[P(n),j(o)])}}function oi(e){return e.type==="LogicalExpression"&&e.right.type==="LogicalExpression"&&e.operator===e.right.operator}function Qe(e){return oi(e)?Qe({type:"LogicalExpression",operator:e.operator,left:Qe({type:"LogicalExpression",operator:e.operator,left:e.left,right:e.right.left,range:[P(e.left),j(e.right.left)]}),right:e.right.right,range:[P(e),j(e)]}):e}var Te=Vs;function Ls(e){let{filepath:t}=e;if(t){if(t=t.toLowerCase(),t.endsWith(".cjs"))return"script";if(t.endsWith(".mjs"))return"module"}}var ke=Ls;var Rs={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,locations:!0,ranges:!0};function Os(e){let{message:t,loc:i}=e;if(!i)return e;let{line:s,column:r}=i;return ve(t.replace(/ \(\d+:\d+\)$/,""),{loc:{start:{line:s,column:r+1}},cause:e})}var ui,Bs=()=>(ui??(ui=T.extend((0,hi.default)())),ui);function Ds(e,t){let i=Bs(),s=[],r=[],n=i.parse(e,{...Rs,sourceType:t,allowImportExportEverywhere:t==="module",onComment:s,onToken:r});return n.comments=s,n.tokens=r,n}function Fs(e,t={}){let i=ke(t),s=(i?[i]:["module","script"]).map(n=>()=>Ds(e,n)),r;try{r=be(s)}catch({errors:[n]}){throw Os(n)}return Te(r,{text:e})}var pi=_e(Fs);var fi=Pe(Ke(),1);var w={Boolean:"Boolean",EOF:" ",Identifier:"Identifier",PrivateIdentifier:"PrivateIdentifier",Keyword:"Keyword",Null:"Null",Numeric:"Numeric",Punctuator:"Punctuator",String:"String",RegularExpression:"RegularExpression",Template:"Template",JSXIdentifier:"JSXIdentifier",JSXText:"JSXText"};function Ms(e,t){let i=e[0],s=e[e.length-1],r={type:w.Template,value:t.slice(i.start,s.end)};return i.loc&&(r.loc={start:i.loc.start,end:s.loc.end}),i.range&&(r.start=i.range[0],r.end=s.range[1],r.range=[r.start,r.end]),r}function Ye(e,t){this._acornTokTypes=e,this._tokens=[],this._curlyBrace=null,this._code=t}Ye.prototype={constructor:Ye,translate(e,t){let i=e.type,s=this._acornTokTypes;if(i===s.name)e.type=w.Identifier,e.value==="static"&&(e.type=w.Keyword),t.ecmaVersion>5&&(e.value==="yield"||e.value==="let")&&(e.type=w.Keyword);else if(i===s.privateId)e.type=w.PrivateIdentifier;else if(i===s.semi||i===s.comma||i===s.parenL||i===s.parenR||i===s.braceL||i===s.braceR||i===s.dot||i===s.bracketL||i===s.colon||i===s.question||i===s.bracketR||i===s.ellipsis||i===s.arrow||i===s.jsxTagStart||i===s.incDec||i===s.starstar||i===s.jsxTagEnd||i===s.prefix||i===s.questionDot||i.binop&&!i.keyword||i.isAssign)e.type=w.Punctuator,e.value=this._code.slice(e.start,e.end);else if(i===s.jsxName)e.type=w.JSXIdentifier;else if(i.label==="jsxText"||i===s.jsxAttrValueToken)e.type=w.JSXText;else if(i.keyword)i.keyword==="true"||i.keyword==="false"?e.type=w.Boolean:i.keyword==="null"?e.type=w.Null:e.type=w.Keyword;else if(i===s.num)e.type=w.Numeric,e.value=this._code.slice(e.start,e.end);else if(i===s.string)t.jsxAttrValueToken?(t.jsxAttrValueToken=!1,e.type=w.JSXText):e.type=w.String,e.value=this._code.slice(e.start,e.end);else if(i===s.regexp){e.type=w.RegularExpression;let r=e.value;e.regex={flags:r.flags,pattern:r.pattern},e.value=`/${r.pattern}/${r.flags}`}return e},onToken(e,t){let i=this._acornTokTypes,s=t.tokens,r=this._tokens,n=()=>{s.push(Ms(this._tokens,this._code)),this._tokens=[]};if(e.type===i.eof){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t));return}if(e.type===i.backQuote){this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),r.push(e),r.length>1&&n();return}if(e.type===i.dollarBraceL){r.push(e),n();return}if(e.type===i.braceR){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=e;return}if(e.type===i.template||e.type===i.invalidTemplate){this._curlyBrace&&(r.push(this._curlyBrace),this._curlyBrace=null),r.push(e);return}this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),s.push(this.translate(e,t))}};var ci=Ye;var $e=[3,5,6,7,8,9,10,11,12,13,14,15];function js(){return $e[$e.length-1]}function Us(e=5){let t=e==="latest"?js():e;if(typeof t!="number")throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof e} instead.`);if(t>=2015&&(t-=2009),!$e.includes(t))throw new Error("Invalid ecmaVersion.");return t}function qs(e="script"){if(e==="script"||e==="module")return e;if(e==="commonjs")return"script";throw new Error("Invalid sourceType.")}function li(e){let t=Us(e.ecmaVersion),i=qs(e.sourceType),s=e.range===!0,r=e.loc===!0;if(t!==3&&e.allowReserved)throw new Error("`allowReserved` is only supported when ecmaVersion is 3");if(typeof e.allowReserved<"u"&&typeof e.allowReserved!="boolean")throw new Error("`allowReserved`, when present, must be `true` or `false`");let n=t===3?e.allowReserved||"never":!1,o=e.ecmaFeatures||{},u=e.sourceType==="commonjs"||!!o.globalReturn;if(i==="module"&&t<6)throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");return Object.assign({},e,{ecmaVersion:t,sourceType:i,ranges:s,locations:r,allowReserved:n,allowReturnOutsideFunction:u})}var z=Symbol("espree's internal state"),Ze=Symbol("espree's esprimaFinishNode");function Js(e,t,i,s,r,n,o){let u;e?u="Block":o.slice(i,i+2)==="#!"?u="Hashbang":u="Line";let h={type:u,value:t};return typeof i=="number"&&(h.start=i,h.end=s,h.range=[i,s]),typeof r=="object"&&(h.loc={start:r,end:n}),h}var et=()=>e=>{let t=Object.assign({},e.acorn.tokTypes);return e.acornJsx&&Object.assign(t,e.acornJsx.tokTypes),class extends e{constructor(s,r){(typeof s!="object"||s===null)&&(s={}),typeof r!="string"&&!(r instanceof String)&&(r=String(r));let n=s.sourceType,o=li(s),u=o.ecmaFeatures||{},h=o.tokens===!0?new ci(t,r):null,l={originalSourceType:n||o.sourceType,tokens:h?[]:null,comments:o.comment===!0?[]:null,impliedStrict:u.impliedStrict===!0&&o.ecmaVersion>=5,ecmaVersion:o.ecmaVersion,jsxAttrValueToken:!1,lastToken:null,templateElements:[]};super({ecmaVersion:o.ecmaVersion,sourceType:o.sourceType,ranges:o.ranges,locations:o.locations,allowReserved:o.allowReserved,allowReturnOutsideFunction:o.allowReturnOutsideFunction,onToken(x){h&&h.onToken(x,l),x.type!==t.eof&&(l.lastToken=x)},onComment(x,_,B,p,d,m){if(l.comments){let g=Js(x,_,B,p,d,m,r);l.comments.push(g)}}},r),this[z]=l}tokenize(){do this.next();while(this.type!==t.eof);this.next();let s=this[z],r=s.tokens;return s.comments&&(r.comments=s.comments),r}finishNode(...s){let r=super.finishNode(...s);return this[Ze](r)}finishNodeAt(...s){let r=super.finishNodeAt(...s);return this[Ze](r)}parse(){let s=this[z],r=super.parse();if(r.sourceType=s.originalSourceType,s.comments&&(r.comments=s.comments),s.tokens&&(r.tokens=s.tokens),r.body.length){let[n]=r.body;r.range&&(r.range[0]=n.range[0]),r.loc&&(r.loc.start=n.loc.start),r.start=n.start}return s.lastToken&&(r.range&&(r.range[1]=s.lastToken.range[1]),r.loc&&(r.loc.end=s.lastToken.loc.end),r.end=s.lastToken.end),this[z].templateElements.forEach(n=>{let u=n.tail?1:2;n.start+=-1,n.end+=u,n.range&&(n.range[0]+=-1,n.range[1]+=u),n.loc&&(n.loc.start.column+=-1,n.loc.end.column+=u)}),r}parseTopLevel(s){return this[z].impliedStrict&&(this.strict=!0),super.parseTopLevel(s)}raise(s,r){let n=e.acorn.getLineInfo(this.input,s),o=new SyntaxError(r);throw o.index=s,o.lineNumber=n.line,o.column=n.column+1,o}raiseRecoverable(s,r){this.raise(s,r)}unexpected(s){let r="Unexpected token";if(s!=null){if(this.pos=s,this.options.locations)for(;this.pos this.start&&(r+=` ${this.input.slice(this.start,this.end)}`),this.raise(this.start,r)}jsx_readString(s){let r=super.jsx_readString(s);return this.type===t.string&&(this[z].jsxAttrValueToken=!0),r}[Ze](s){return s.type==="TemplateElement"&&this[z].templateElements.push(s),s.type.includes("Function")&&!s.generator&&(s.generator=!1),s}}};var Gs={_regular:null,_jsx:null,get regular(){return this._regular===null&&(this._regular=T.extend(et())),this._regular},get jsx(){return this._jsx===null&&(this._jsx=T.extend((0,fi.default)(),et())),this._jsx},get(e){return!!(e&&e.ecmaFeatures&&e.ecmaFeatures.jsx)?this.jsx:this.regular}};function di(e,t){let i=Gs.get(t);return new i(t,e).parse()}var Ks={ecmaVersion:"latest",range:!0,loc:!0,comment:!0,tokens:!0,sourceType:"module",ecmaFeatures:{jsx:!0,globalReturn:!0,impliedStrict:!1}};function Ws(e){let{message:t,lineNumber:i,column:s}=e;return typeof i!="number"?e:ve(t,{loc:{start:{line:i,column:s}},cause:e})}function Xs(e,t={}){let i=ke(t),s=(i?[i]:["module","script"]).map(n=>()=>di(e,{...Ks,sourceType:n})),r;try{r=be(s)}catch({errors:[n]}){throw Ws(n)}return Te(r,{text:e})}var mi=_e(Xs);var zs={acorn:pi,espree:mi};var ga=tt;export{ga as default,zs as parsers}; +`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return K(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(s,8);return r>255&&(s=s.slice(0,-1),r=parseInt(s,8)),this.pos+=s.length-1,t=this.input.charCodeAt(this.pos),(s!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-s.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Q(t)?"":String.fromCharCode(t)}};v.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};v.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,s=this.options.ecmaVersion>=6;this.pos {if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[i<0?t.length+i:i]:t.at(i)},Ke=cs;function ls(e){return Array.isArray(e)&&e.length>0}var Wt=ls;function P(e){var s,r,n;let t=((s=e.range)==null?void 0:s[0])??e.start,i=(n=((r=e.declaration)==null?void 0:r.decorators)??e.decorators)==null?void 0:n[0];return i?Math.min(P(i),t):t}function j(e){var t;return((t=e.range)==null?void 0:t[1])??e.end}function fs(e){let t=new Set(e);return i=>t.has(i==null?void 0:i.type)}var Xt=fs;var ds=Xt(["Block","CommentBlock","MultiLine"]),oe=ds;function ms(e){let t=`*${e.value}*`.split(` +`);return t.length>1&&t.every(i=>i.trimStart()[0]==="*")}var We=ms;function xs(e){return oe(e)&&e.value[0]==="*"&&/@(?:type|satisfies)\b/.test(e.value)}var zt=xs;var ue=null;function he(e){if(ue!==null&&typeof ue.property){let t=ue;return ue=he.prototype=null,t}return ue=he.prototype=e??Object.create(null),new he}var ys=10;for(let e=0;e<=ys;e++)he();function Xe(e){return he(e)}function gs(e,t="type"){Xe(e);function i(s){let r=s[t],n=e[r];if(!Array.isArray(n))throw Object.assign(new Error(`Missing visitor keys for '${r}'.`),{node:s});return n}return i}var Ht=gs;var Qt={ArrayExpression:["elements"],AssignmentExpression:["left","right"],BinaryExpression:["left","right"],InterpreterDirective:[],Directive:["value"],DirectiveLiteral:[],BlockStatement:["directives","body"],BreakStatement:["label"],CallExpression:["callee","arguments","typeParameters","typeArguments"],CatchClause:["param","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["test","body"],EmptyStatement:[],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body","returnType","typeParameters","predicate"],FunctionExpression:["id","params","body","returnType","typeParameters"],Identifier:["typeAnnotation","decorators"],IfStatement:["test","consequent","alternate"],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],NewExpression:["callee","arguments","typeParameters","typeArguments"],Program:["directives","body"],ObjectExpression:["properties"],ObjectMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectProperty:["key","value","decorators"],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ParenthesizedExpression:["expression"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["params","body","returnType","typeParameters","predicate"],ClassBody:["body"],ClassExpression:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ClassDeclaration:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ExportAllDeclaration:["source","attributes","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ForOfStatement:["left","right","body"],ImportDeclaration:["specifiers","source","attributes"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["local","imported"],ImportExpression:["source","options","attributes"],MetaProperty:["meta","property"],ClassMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectPattern:["properties","typeAnnotation","decorators"],SpreadElement:["argument"],Super:[],TaggedTemplateExpression:["tag","quasi","typeParameters","typeArguments"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:["argument"],AwaitExpression:["argument"],Import:[],BigIntLiteral:[],ExportNamespaceSpecifier:["exported"],OptionalMemberExpression:["object","property"],OptionalCallExpression:["callee","arguments","typeParameters","typeArguments"],ClassProperty:["key","value","typeAnnotation","decorators","variance"],ClassAccessorProperty:["key","value","typeAnnotation","decorators"],ClassPrivateProperty:["key","value","decorators","typeAnnotation","variance"],ClassPrivateMethod:["key","params","body","decorators","returnType","typeParameters"],PrivateName:["id"],StaticBlock:["body"],AnyTypeAnnotation:[],ArrayTypeAnnotation:["elementType"],BooleanTypeAnnotation:[],BooleanLiteralTypeAnnotation:[],NullLiteralTypeAnnotation:[],ClassImplements:["id","typeParameters"],DeclareClass:["id","typeParameters","extends","mixins","implements","body"],DeclareFunction:["id","predicate"],DeclareInterface:["id","typeParameters","extends","body"],DeclareModule:["id","body"],DeclareModuleExports:["typeAnnotation"],DeclareTypeAlias:["id","typeParameters","right"],DeclareOpaqueType:["id","typeParameters","supertype"],DeclareVariable:["id"],DeclareExportDeclaration:["declaration","specifiers","source"],DeclareExportAllDeclaration:["source"],DeclaredPredicate:["value"],ExistsTypeAnnotation:[],FunctionTypeAnnotation:["typeParameters","params","rest","returnType","this"],FunctionTypeParam:["name","typeAnnotation"],GenericTypeAnnotation:["id","typeParameters"],InferredPredicate:[],InterfaceExtends:["id","typeParameters"],InterfaceDeclaration:["id","typeParameters","extends","body"],InterfaceTypeAnnotation:["extends","body"],IntersectionTypeAnnotation:["types"],MixedTypeAnnotation:[],EmptyTypeAnnotation:[],NullableTypeAnnotation:["typeAnnotation"],NumberLiteralTypeAnnotation:[],NumberTypeAnnotation:[],ObjectTypeAnnotation:["properties","indexers","callProperties","internalSlots"],ObjectTypeInternalSlot:["id","value","optional","static","method"],ObjectTypeCallProperty:["value"],ObjectTypeIndexer:["id","key","value","variance"],ObjectTypeProperty:["key","value","variance"],ObjectTypeSpreadProperty:["argument"],OpaqueType:["id","typeParameters","supertype","impltype"],QualifiedTypeIdentifier:["id","qualification"],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],SymbolTypeAnnotation:[],ThisTypeAnnotation:[],TupleTypeAnnotation:["types","elementTypes"],TypeofTypeAnnotation:["argument","typeArguments"],TypeAlias:["id","typeParameters","right"],TypeAnnotation:["typeAnnotation"],TypeCastExpression:["expression","typeAnnotation"],TypeParameter:["bound","default","variance"],TypeParameterDeclaration:["params"],TypeParameterInstantiation:["params"],UnionTypeAnnotation:["types"],Variance:[],VoidTypeAnnotation:[],EnumDeclaration:["id","body"],EnumBooleanBody:["members"],EnumNumberBody:["members"],EnumStringBody:["members"],EnumSymbolBody:["members"],EnumBooleanMember:["id","init"],EnumNumberMember:["id","init"],EnumStringMember:["id","init"],EnumDefaultedMember:["id"],IndexedAccessType:["objectType","indexType"],OptionalIndexedAccessType:["objectType","indexType"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXSpreadChild:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes","typeArguments","typeParameters"],JSXSpreadAttribute:["argument"],JSXText:[],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningFragment:[],JSXClosingFragment:[],Noop:[],Placeholder:[],V8IntrinsicIdentifier:[],ArgumentPlaceholder:[],BindExpression:["object","callee"],ImportAttribute:["key","value"],Decorator:["expression"],DoExpression:["body"],ExportDefaultSpecifier:["exported"],RecordExpression:["properties"],TupleExpression:["elements"],DecimalLiteral:[],ModuleExpression:["body"],TopicReference:[],PipelineTopicExpression:["expression"],PipelineBareFunction:["callee"],PipelinePrimaryTopicReference:[],TSParameterProperty:["parameter","decorators"],TSDeclareFunction:["id","typeParameters","params","returnType","body"],TSDeclareMethod:["decorators","key","typeParameters","params","returnType"],TSQualifiedName:["left","right"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation","params","returnType"],TSIndexSignature:["parameters","typeAnnotation"],TSAnyKeyword:[],TSBooleanKeyword:[],TSBigIntKeyword:[],TSIntrinsicKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSFunctionType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructorType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSTypeReference:["typeName","typeParameters","typeArguments"],TSTypePredicate:["parameterName","typeAnnotation"],TSTypeQuery:["exprName","typeParameters","typeArguments"],TSTypeLiteral:["members"],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSNamedTupleMember:["label","elementType"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","typeAnnotation","nameType"],TSLiteralType:["literal"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSInstantiationExpression:["expression","typeParameters","typeArguments"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportType:["argument","qualifier","typeParameters","typeArguments"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSNonNullExpression:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterInstantiation:["params"],TSTypeParameterDeclaration:["params"],TSTypeParameter:["constraint","default","name"],ChainExpression:["expression"],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],Literal:[],MethodDefinition:["decorators","key","value"],PrivateIdentifier:[],Property:["key","value"],PropertyDefinition:["decorators","key","typeAnnotation","value","variance"],AccessorProperty:["decorators","key","typeAnnotation","value"],TSAbstractAccessorProperty:["decorators","key","typeAnnotation"],TSAbstractKeyword:[],TSAbstractMethodDefinition:["key","value"],TSAbstractPropertyDefinition:["decorators","key","typeAnnotation"],TSAsyncKeyword:[],TSClassImplements:["expression","typeArguments","typeParameters"],TSDeclareKeyword:[],TSEmptyBodyFunctionExpression:["id","typeParameters","params","returnType"],TSExportKeyword:[],TSInterfaceHeritage:["expression","typeArguments","typeParameters"],TSPrivateKeyword:[],TSProtectedKeyword:[],TSPublicKeyword:[],TSReadonlyKeyword:[],TSStaticKeyword:[],TSTemplateLiteralType:["quasis","types"],AsExpression:["expression","typeAnnotation"],BigIntLiteralTypeAnnotation:[],BigIntTypeAnnotation:[],ConditionalTypeAnnotation:["checkType","extendsType","trueType","falseType"],DeclareEnum:["id","body"],InferTypeAnnotation:["typeParameter"],KeyofTypeAnnotation:["argument"],ObjectTypeMappedTypeProperty:["keyTparam","propType","sourceType","variance"],QualifiedTypeofIdentifier:["qualification","id"],TupleTypeLabeledElement:["label","elementType","variance"],TupleTypeSpreadElement:["label","typeAnnotation"],TypeOperator:["typeAnnotation"],TypePredicate:["parameterName","typeAnnotation","asserts"],NGRoot:["node"],NGPipeExpression:["left","right","arguments"],NGChainedExpression:["expressions"],NGEmptyExpression:[],NGMicrosyntax:["body"],NGMicrosyntaxKey:[],NGMicrosyntaxExpression:["expression","alias"],NGMicrosyntaxKeyedExpression:["key","expression"],NGMicrosyntaxLet:["key","value"],NGMicrosyntaxAs:["key","alias"],JsExpressionRoot:["node"],JsonRoot:["node"],TSJSDocAllType:[],TSJSDocUnknownType:[],TSJSDocNullableType:["typeAnnotation"],TSJSDocNonNullableType:["typeAnnotation"],NeverTypeAnnotation:[],UndefinedTypeAnnotation:[],UnknownTypeAnnotation:[],AsConstExpression:["expression"],SatisfiesExpression:["expression","typeAnnotation"]};var vs=Ht(Qt),Yt=vs;function ze(e,t){if(!(e!==null&&typeof e=="object"))return e;if(Array.isArray(e)){for(let s=0;s {var o;(o=n.leadingComments)!=null&&o.some(zt)&&r.add(P(n))}),e=Se(e,n=>{if(n.type==="ParenthesizedExpression"){let{expression:o}=n;if(o.type==="TypeCastExpression")return o.range=[...n.range],o;let u=P(n);if(!r.has(u))return o.extra={...o.extra,parenthesized:!0},o}})}if(e=Se(e,r=>{var n;switch(r.type){case"LogicalExpression":if($t(r))return He(r);break;case"VariableDeclaration":{let o=Ke(!1,r.declarations,-1);o!=null&&o.init&&s[j(o)]!==";"&&(r.range=[P(r),j(o)]);break}case"TSParenthesizedType":return r.typeAnnotation;case"TSTypeParameter":if(typeof r.name=="string"){let o=P(r);r.name={type:"Identifier",name:r.name,range:[o,o+r.name.length]}}break;case"TopicReference":e.extra={...e.extra,__isUsingHackPipeline:!0};break;case"ExportAllDeclaration":if(i==="meriyah"&&((n=r.exported)==null?void 0:n.type)==="Identifier"){let{exported:o}=r,u=s.slice(P(o),j(o));(u.startsWith('"')||u.startsWith("'"))&&(r.exported={...r.exported,type:"Literal",value:r.exported.name,raw:u})}break;case"TSUnionType":case"TSIntersectionType":if(r.types.length===1)return r.types[0];break}}),Wt(e.comments)){let r=Ke(!1,e.comments,-1);for(let n=e.comments.length-2;n>=0;n--){let o=e.comments[n];j(o)===P(r)&&oe(o)&&oe(r)&&We(o)&&We(r)&&(e.comments.splice(n+1,1),o.value+="*//*"+r.value,o.range=[P(o),j(r)]),r=o}}return e.type==="Program"&&(e.range=[0,s.length]),e}function $t(e){return e.type==="LogicalExpression"&&e.right.type==="LogicalExpression"&&e.operator===e.right.operator}function He(e){return $t(e)?He({type:"LogicalExpression",operator:e.operator,left:He({type:"LogicalExpression",operator:e.operator,left:e.left,right:e.right.left,range:[P(e.left),j(e.right.left)]}),right:e.right.right,range:[P(e),j(e)]}):e}var _e=bs;var Z=Ae(ai(),1);function Is(e){if(!e.startsWith("#!"))return"";let t=e.indexOf(` +`);return t===-1?e:e.slice(0,t)}var ni=Is;function Ns(e){let t=ni(e);t&&(e=e.slice(t.length+1));let i=(0,Z.extract)(e),{pragmas:s,comments:r}=(0,Z.parseWithComments)(i);return{shebang:t,text:e,pragmas:s,comments:r}}function oi(e){let{pragmas:t}=Ns(e);return Object.prototype.hasOwnProperty.call(t,"prettier")||Object.prototype.hasOwnProperty.call(t,"format")}function Vs(e){return e=typeof e=="function"?{parse:e}:e,{astFormat:"estree",hasPragma:oi,locStart:P,locEnd:j,...e}}var Ce=Vs;function Ls(e){let{filepath:t}=e;if(t){if(t=t.toLowerCase(),t.endsWith(".cjs"))return"script";if(t.endsWith(".mjs"))return"module"}}var Te=Ls;var Rs={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,locations:!0,ranges:!0};function Os(e){let{message:t,loc:i}=e;if(!i)return e;let{line:s,column:r}=i;return ve(t.replace(/ \(\d+:\d+\)$/,""),{loc:{start:{line:s,column:r+1}},cause:e})}var ui,Bs=()=>(ui??(ui=T.extend((0,hi.default)())),ui);function Ds(e,t){let i=Bs(),s=[],r=[],n=i.parse(e,{...Rs,sourceType:t,allowImportExportEverywhere:t==="module",onComment:s,onToken:r});return n.comments=s,n.tokens=r,n}function Fs(e,t={}){let i=Te(t),s=(i?[i]:["module","script"]).map(n=>()=>Ds(e,n)),r;try{r=be(s)}catch({errors:[n]}){throw Os(n)}return _e(r,{text:e})}var pi=Ce(Fs);var fi=Ae(Ge(),1);var w={Boolean:"Boolean",EOF:" ",Identifier:"Identifier",PrivateIdentifier:"PrivateIdentifier",Keyword:"Keyword",Null:"Null",Numeric:"Numeric",Punctuator:"Punctuator",String:"String",RegularExpression:"RegularExpression",Template:"Template",JSXIdentifier:"JSXIdentifier",JSXText:"JSXText"};function Ms(e,t){let i=e[0],s=e[e.length-1],r={type:w.Template,value:t.slice(i.start,s.end)};return i.loc&&(r.loc={start:i.loc.start,end:s.loc.end}),i.range&&(r.start=i.range[0],r.end=s.range[1],r.range=[r.start,r.end]),r}function Qe(e,t){this._acornTokTypes=e,this._tokens=[],this._curlyBrace=null,this._code=t}Qe.prototype={constructor:Qe,translate(e,t){let i=e.type,s=this._acornTokTypes;if(i===s.name)e.type=w.Identifier,e.value==="static"&&(e.type=w.Keyword),t.ecmaVersion>5&&(e.value==="yield"||e.value==="let")&&(e.type=w.Keyword);else if(i===s.privateId)e.type=w.PrivateIdentifier;else if(i===s.semi||i===s.comma||i===s.parenL||i===s.parenR||i===s.braceL||i===s.braceR||i===s.dot||i===s.bracketL||i===s.colon||i===s.question||i===s.bracketR||i===s.ellipsis||i===s.arrow||i===s.jsxTagStart||i===s.incDec||i===s.starstar||i===s.jsxTagEnd||i===s.prefix||i===s.questionDot||i.binop&&!i.keyword||i.isAssign)e.type=w.Punctuator,e.value=this._code.slice(e.start,e.end);else if(i===s.jsxName)e.type=w.JSXIdentifier;else if(i.label==="jsxText"||i===s.jsxAttrValueToken)e.type=w.JSXText;else if(i.keyword)i.keyword==="true"||i.keyword==="false"?e.type=w.Boolean:i.keyword==="null"?e.type=w.Null:e.type=w.Keyword;else if(i===s.num)e.type=w.Numeric,e.value=this._code.slice(e.start,e.end);else if(i===s.string)t.jsxAttrValueToken?(t.jsxAttrValueToken=!1,e.type=w.JSXText):e.type=w.String,e.value=this._code.slice(e.start,e.end);else if(i===s.regexp){e.type=w.RegularExpression;let r=e.value;e.regex={flags:r.flags,pattern:r.pattern},e.value=`/${r.pattern}/${r.flags}`}return e},onToken(e,t){let i=this._acornTokTypes,s=t.tokens,r=this._tokens,n=()=>{s.push(Ms(this._tokens,this._code)),this._tokens=[]};if(e.type===i.eof){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t));return}if(e.type===i.backQuote){this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),r.push(e),r.length>1&&n();return}if(e.type===i.dollarBraceL){r.push(e),n();return}if(e.type===i.braceR){this._curlyBrace&&s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=e;return}if(e.type===i.template||e.type===i.invalidTemplate){this._curlyBrace&&(r.push(this._curlyBrace),this._curlyBrace=null),r.push(e);return}this._curlyBrace&&(s.push(this.translate(this._curlyBrace,t)),this._curlyBrace=null),s.push(this.translate(e,t))}};var ci=Qe;var Ye=[3,5,6,7,8,9,10,11,12,13,14,15];function js(){return Ye[Ye.length-1]}function Us(e=5){let t=e==="latest"?js():e;if(typeof t!="number")throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof e} instead.`);if(t>=2015&&(t-=2009),!Ye.includes(t))throw new Error("Invalid ecmaVersion.");return t}function qs(e="script"){if(e==="script"||e==="module")return e;if(e==="commonjs")return"script";throw new Error("Invalid sourceType.")}function li(e){let t=Us(e.ecmaVersion),i=qs(e.sourceType),s=e.range===!0,r=e.loc===!0;if(t!==3&&e.allowReserved)throw new Error("`allowReserved` is only supported when ecmaVersion is 3");if(typeof e.allowReserved<"u"&&typeof e.allowReserved!="boolean")throw new Error("`allowReserved`, when present, must be `true` or `false`");let n=t===3?e.allowReserved||"never":!1,o=e.ecmaFeatures||{},u=e.sourceType==="commonjs"||!!o.globalReturn;if(i==="module"&&t<6)throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");return Object.assign({},e,{ecmaVersion:t,sourceType:i,ranges:s,locations:r,allowReserved:n,allowReturnOutsideFunction:u})}var z=Symbol("espree's internal state"),$e=Symbol("espree's esprimaFinishNode");function Js(e,t,i,s,r,n,o){let u;e?u="Block":o.slice(i,i+2)==="#!"?u="Hashbang":u="Line";let h={type:u,value:t};return typeof i=="number"&&(h.start=i,h.end=s,h.range=[i,s]),typeof r=="object"&&(h.loc={start:r,end:n}),h}var Ze=()=>e=>{let t=Object.assign({},e.acorn.tokTypes);return e.acornJsx&&Object.assign(t,e.acornJsx.tokTypes),class extends e{constructor(s,r){(typeof s!="object"||s===null)&&(s={}),typeof r!="string"&&!(r instanceof String)&&(r=String(r));let n=s.sourceType,o=li(s),u=o.ecmaFeatures||{},h=o.tokens===!0?new ci(t,r):null,l={originalSourceType:n||o.sourceType,tokens:h?[]:null,comments:o.comment===!0?[]:null,impliedStrict:u.impliedStrict===!0&&o.ecmaVersion>=5,ecmaVersion:o.ecmaVersion,jsxAttrValueToken:!1,lastToken:null,templateElements:[]};super({ecmaVersion:o.ecmaVersion,sourceType:o.sourceType,ranges:o.ranges,locations:o.locations,allowReserved:o.allowReserved,allowReturnOutsideFunction:o.allowReturnOutsideFunction,onToken(x){h&&h.onToken(x,l),x.type!==t.eof&&(l.lastToken=x)},onComment(x,_,B,p,d,m){if(l.comments){let g=Js(x,_,B,p,d,m,r);l.comments.push(g)}}},r),this[z]=l}tokenize(){do this.next();while(this.type!==t.eof);this.next();let s=this[z],r=s.tokens;return s.comments&&(r.comments=s.comments),r}finishNode(...s){let r=super.finishNode(...s);return this[$e](r)}finishNodeAt(...s){let r=super.finishNodeAt(...s);return this[$e](r)}parse(){let s=this[z],r=super.parse();if(r.sourceType=s.originalSourceType,s.comments&&(r.comments=s.comments),s.tokens&&(r.tokens=s.tokens),r.body.length){let[n]=r.body;r.range&&(r.range[0]=n.range[0]),r.loc&&(r.loc.start=n.loc.start),r.start=n.start}return s.lastToken&&(r.range&&(r.range[1]=s.lastToken.range[1]),r.loc&&(r.loc.end=s.lastToken.loc.end),r.end=s.lastToken.end),this[z].templateElements.forEach(n=>{let u=n.tail?1:2;n.start+=-1,n.end+=u,n.range&&(n.range[0]+=-1,n.range[1]+=u),n.loc&&(n.loc.start.column+=-1,n.loc.end.column+=u)}),r}parseTopLevel(s){return this[z].impliedStrict&&(this.strict=!0),super.parseTopLevel(s)}raise(s,r){let n=e.acorn.getLineInfo(this.input,s),o=new SyntaxError(r);throw o.index=s,o.lineNumber=n.line,o.column=n.column+1,o}raiseRecoverable(s,r){this.raise(s,r)}unexpected(s){let r="Unexpected token";if(s!=null){if(this.pos=s,this.options.locations)for(;this.pos this.start&&(r+=` ${this.input.slice(this.start,this.end)}`),this.raise(this.start,r)}jsx_readString(s){let r=super.jsx_readString(s);return this.type===t.string&&(this[z].jsxAttrValueToken=!0),r}[$e](s){return s.type==="TemplateElement"&&this[z].templateElements.push(s),s.type.includes("Function")&&!s.generator&&(s.generator=!1),s}}};var Gs={_regular:null,_jsx:null,get regular(){return this._regular===null&&(this._regular=T.extend(Ze())),this._regular},get jsx(){return this._jsx===null&&(this._jsx=T.extend((0,fi.default)(),Ze())),this._jsx},get(e){return!!(e&&e.ecmaFeatures&&e.ecmaFeatures.jsx)?this.jsx:this.regular}};function di(e,t){let i=Gs.get(t);return new i(t,e).parse()}var Ks={ecmaVersion:"latest",range:!0,loc:!0,comment:!0,tokens:!0,sourceType:"module",ecmaFeatures:{jsx:!0,globalReturn:!0,impliedStrict:!1}};function Ws(e){let{message:t,lineNumber:i,column:s}=e;return typeof i!="number"?e:ve(t,{loc:{start:{line:i,column:s}},cause:e})}function Xs(e,t={}){let i=Te(t),s=(i?[i]:["module","script"]).map(n=>()=>di(e,{...Ks,sourceType:n})),r;try{r=be(s)}catch({errors:[n]}){throw Ws(n)}return _e(r,{text:e})}var mi=Ce(Xs);var zs={acorn:pi,espree:mi};var ya=et;export{ya as default,zs as parsers}; diff --git a/node_modules/prettier/plugins/angular.js b/node_modules/prettier/plugins/angular.js index c9a63fe..228d294 100644 --- a/node_modules/prettier/plugins/angular.js +++ b/node_modules/prettier/plugins/angular.js @@ -1,2 +1 @@ -(function(n){function e(){var i=n();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.angular=e()}})(function(){"use strict";var Se=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Dt=Object.prototype.hasOwnProperty;var Vt=(r,e,t)=>e in r?Se(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Xe=(r,e)=>{for(var t in e)Se(r,t,{get:e[t],enumerable:!0})},Wt=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Gt(e))!Dt.call(r,n)&&n!==t&&Se(r,n,{get:()=>e[n],enumerable:!(s=Ut(e,n))||s.enumerable});return r};var Qt=r=>Wt(Se({},"__esModule",{value:!0}),r);var Ze=(r,e,t)=>(Vt(r,typeof e!="symbol"?e+"":e,t),t),Je=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var Ke=(r,e,t)=>(Je(r,e,"read from private field"),t?t.call(r):e.get(r)),Ye=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},et=(r,e,t,s)=>(Je(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);var Wr={};Xe(Wr,{parsers:()=>qe});var qe={};Xe(qe,{__ng_action:()=>Ur,__ng_binding:()=>Gr,__ng_directive:()=>Vr,__ng_interpolation:()=>Dr});var we=` -`,tt="\r",rt=function(){function r(e){this.length=e.length;for(var t=[0],s=0;s this.length)return null;for(var t=0,s=this.offsets;s[t+1]<=e;)t++;var n=e-s[t];return{line:t,column:n}},r.prototype.indexForLocation=function(e){var t=e.line,s=e.column;return t<0||t>=this.offsets.length||s<0||s>this.lengthOfLine(t)?null:this.offsets[t]+s},r.prototype.lengthOfLine=function(e){var t=this.offsets[e],s=e===this.offsets.length-1?this.length:this.offsets[e+1];return s-t},r}();var D=class{constructor(e,t,s,n){this.input=t,this.errLocation=s,this.ctxLocation=n,this.message=`Parser Error: ${e} ${s} [${t}] in ${n}`}},R=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new N(e+this.start,e+this.end)}},w=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},V=class extends w{constructor(e,t,s){super(e,t),this.nameSpan=s}},C=class extends w{visit(e,t=null){}},L=class extends w{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},ye=class extends L{visit(e,t=null){var s;return(s=e.visitThisReceiver)==null?void 0:s.call(e,this,t)}},W=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitChain(this,t)}},Q=class extends w{constructor(e,t,s,n,i){super(e,t),this.condition=s,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},K=class extends V{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},H=class extends V{constructor(e,t,s,n,i,a){super(e,t,s),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},z=class extends V{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},q=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},j=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},X=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},Z=class extends V{constructor(e,t,s,n,i,a){super(e,t,a),this.exp=s,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},A=class extends w{constructor(e,t,s){super(e,t),this.value=s}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},J=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitLiteralArray(this,t)}},Y=class extends w{constructor(e,t,s,n){super(e,t),this.keys=s,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},Ee=class extends w{constructor(e,t,s,n){super(e,t),this.strings=s,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},$=class extends w{constructor(e,t,s,n,i){super(e,t),this.operation=s,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},B=class r extends ${static createMinus(e,t,s){return new r(e,t,"-",s,"-",new A(e,t,0),s)}static createPlus(e,t,s){return new r(e,t,"+",s,"-",s,new A(e,t,0))}constructor(e,t,s,n,i,a,h){super(e,t,i,a,h),this.operator=s,this.expr=n,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},ee=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitPrefixNot(this,t)}},te=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitNonNullAssert(this,t)}},re=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},se=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},N=class{constructor(e,t){this.start=e,this.end=t}},P=class extends w{constructor(e,t,s,n,i){super(new R(0,t===null?0:t.length),new N(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=s,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},T=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},ne=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},Ce=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let s of e)this.visit(s,t)}};var st;(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.LITERAL_ATTR=1]="LITERAL_ATTR",r[r.ANIMATION=2]="ANIMATION"})(st||(st={}));function nt(r){return r>=9&&r<=32||r==160}function b(r){return 48<=r&&r<=57}function it(r){return r>=97&&r<=122||r>=65&&r<=90}function Be(r){return r===39||r===34||r===96}var d;(function(r){r[r.Character=0]="Character",r[r.Identifier=1]="Identifier",r[r.PrivateIdentifier=2]="PrivateIdentifier",r[r.Keyword=3]="Keyword",r[r.String=4]="String",r[r.Operator=5]="Operator",r[r.Number=6]="Number",r[r.Error=7]="Error"})(d||(d={}));var yr=["var","let","as","null","undefined","true","false","if","else","this"],le=class{tokenize(e){let t=new Me(e),s=[],n=t.scanToken();for(;n!=null;)s.push(n),n=t.scanToken();return s}},O=class{constructor(e,t,s,n,i){this.index=e,this.end=t,this.type=s,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==d.Character&&this.numValue==e}isNumber(){return this.type==d.Number}isString(){return this.type==d.String}isOperator(e){return this.type==d.Operator&&this.strValue==e}isIdentifier(){return this.type==d.Identifier}isPrivateIdentifier(){return this.type==d.PrivateIdentifier}isKeyword(){return this.type==d.Keyword}isKeywordLet(){return this.type==d.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==d.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==d.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==d.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==d.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==d.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==d.Keyword&&this.strValue=="this"}isError(){return this.type==d.Error}toNumber(){return this.type==d.Number?this.numValue:-1}toString(){switch(this.type){case d.Character:case d.Identifier:case d.Keyword:case d.Operator:case d.PrivateIdentifier:case d.String:case d.Error:return this.strValue;case d.Number:return this.numValue.toString();default:return null}}};function pt(r,e,t){return new O(r,e,d.Character,t,String.fromCharCode(t))}function Er(r,e,t){return new O(r,e,d.Identifier,0,t)}function Cr(r,e,t){return new O(r,e,d.PrivateIdentifier,0,t)}function Ar(r,e,t){return new O(r,e,d.Keyword,0,t)}function _e(r,e,t){return new O(r,e,d.Operator,0,t)}function $r(r,e,t){return new O(r,e,d.String,0,t)}function Or(r,e,t){return new O(r,e,d.Number,t,"")}function Ir(r,e,t){return new O(r,e,d.Error,0,t)}var Ie=new O(-1,-1,d.Character,0,""),Me=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,s=this.peek,n=this.index;for(;s<=32;)if(++n>=t){s=0;break}else s=e.charCodeAt(n);if(this.peek=s,this.index=n,n>=t)return null;if(ut(s))return this.scanIdentifier();if(b(s))return this.scanNumber(n);let i=n;switch(s){case 46:return this.advance(),b(this.peek)?this.scanNumber(i):pt(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,s);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(s));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;nt(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(s)}]`,0)}scanCharacter(e,t){return this.advance(),pt(e,this.index,t)}scanOperator(e,t){return this.advance(),_e(e,this.index,t)}scanComplexOperator(e,t,s,n,i,a){this.advance();let h=t;return this.peek==s&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),_e(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();lt(this.peek);)this.advance();let t=this.input.substring(e,this.index);return yr.indexOf(t)>-1?Ar(e,this.index,t):Er(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!ut(this.peek))return this.error("Invalid character [#]",-1);for(;lt(this.peek);)this.advance();let t=this.input.substring(e,this.index);return Cr(e,this.index,t)}scanNumber(e){let t=this.index===e,s=!1;for(this.advance();;){if(!b(this.peek))if(this.peek===95){if(!b(this.input.charCodeAt(this.index-1))||!b(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);s=!0}else if(this.peek===46)t=!1;else if(Nr(this.peek)){if(this.advance(),kr(this.peek)&&this.advance(),!b(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);s&&(n=n.replace(/_/g,""));let i=t?Rr(n):parseFloat(n);return Or(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let s="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){s+=i.substring(n,this.index);let h;if(this.advance(),this.peek==117){let g=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(g))h=parseInt(g,16);else return this.error(`Invalid unicode escape [\\u${g}]`,0);for(let f=0;f<5;f++)this.advance()}else h=Pr(this.peek),this.advance();s+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),$r(e,this.index,s+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),_e(e,this.index,t)}error(e,t){let s=this.index+t;return Ir(s,this.index,`Lexer Error: ${e} at column ${s} in expression [${this.input}]`)}};function ut(r){return 97<=r&&r<=122||65<=r&&r<=90||r==95||r==36}function lt(r){return it(r)||b(r)||r==95||r==36}function Nr(r){return r==101||r==69}function kr(r){return r==45||r==43}function Pr(r){switch(r){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return r}}function Rr(r){let e=parseInt(r);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+r);return e}var Lr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function vt(r,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${r}' to be an array, [start, end].`);if(e!=null){let t=e[0],s=e[1];Lr.forEach(n=>{if(n.test(t)||n.test(s))throw new Error(`['${t}', '${s}'] contains unusable interpolation symbol.`)})}}var Ue=class r{static fromArray(e){return e?(vt("interpolation",e),new r(e[0],e[1])):F}constructor(e,t){this.start=e,this.end=t}},F=new Ue("{{","}}");var Ge=class{constructor(e,t,s){this.strings=e,this.expressions=t,this.offsets=s}},De=class{constructor(e,t,s){this.templateBindings=e,this.warnings=t,this.errors=s}},fe=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,s,n,i=F){this._checkNoInterpolation(e,s,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),g=1;t&&(g|=2);let f=new U(e,s,n,h,g,this.errors,0).parseChain();return new P(f,e,s,n,this.errors)}parseBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n);return new P(i,e,t,s,this.errors)}checkSimpleExpression(e){let t=new Ve;return e.visit(t),t.errors}parseSimpleBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new P(i,e,t,s,this.errors)}_reportError(e,t,s,n){this.errors.push(new D(e,t,s,n))}_parseBindingAst(e,t,s,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new U(e,t,s,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,s,n,i){let a=this._lexer.tokenize(t);return new U(t,s,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new N(n,n+e.length)})}parseInterpolation(e,t,s,n,i=F){let{strings:a,expressions:h,offsets:g}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let f=[];for(let y=0;y y.text),f,e,t,s)}parseInterpolationExpression(e,t,s){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new U(e,t,s,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,s)}createInterpolationAst(e,t,s,n,i){let a=new R(0,s.length),h=new Ee(a,a.toAbsolute(i),e,t);return new P(h,s,n,i,this.errors)}splitInterpolation(e,t,s,n=F){let i=[],a=[],h=[],g=s?br(s):null,f=0,y=!1,E=!1,{start:m,end:o}=n;for(;f -1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${s}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,s){for(let n of this._forEachUnquotedChar(e,s)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let s=null,n=0;for(let i=t;i =this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let s=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(s=t),e>s){let n=s;s=e,e=n}return new R(e,s)}sourceSpan(e,t){let s=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(s)||this.sourceSpanCache.set(s,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(s)}advance(){this.index++}withContext(e,t){this.context|=e;let s=t();return this.context^=e,s}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Ie?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index ":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new $(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==d.Operator;){let s=this.next.strValue;switch(s){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new $(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==d.Operator;){let s=this.next.strValue;switch(s){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new $(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parsePrefix(){if(this.next.type==d.Operator){let e=this.inputIndex,t=this.next.strValue,s;switch(t){case"+":return this.advance(),s=this.parsePrefix(),B.createPlus(this.span(e),this.sourceSpan(e),s);case"-":return this.advance(),s=this.parsePrefix(),B.createMinus(this.span(e),this.sourceSpan(e),s);case"!":return this.advance(),s=this.parsePrefix(),new ee(this.span(e),this.sourceSpan(e),s)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new te(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new A(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new A(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new A(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new A(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new ye(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new J(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new L(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new C(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new C(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new C(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),g=this.sourceSpan(n);t.push(new K(h,g,g,new L(h,g),a))}}while(this.consumeOptionalCharacter(44)&&!this.next.isCharacter(125));this.rbracesExpected--,this.expectCharacter(125)}return new Y(this.span(s),this.sourceSpan(s),e,t)}parseAccessMember(e,t,s){let n=this.inputIndex,i=this.withContext(pe.Writable,()=>{let g=this.expectIdentifierOrKeyword()??"";return g.length===0&&this.error("Expected identifier for property access",e.span.end),g}),a=this.sourceSpan(n),h;if(s)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new C(this.span(t),this.sourceSpan(t))):h=new z(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new C(this.span(t),this.sourceSpan(t));let g=this.parseConditional();h=new H(this.span(t),this.sourceSpan(t),a,e,i,g)}else h=new K(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,s){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),g=this.sourceSpan(t);return s?new se(h,g,e,i,a):new re(h,g,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,s=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new N(s,s+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index {this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof C&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(s)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new X(this.span(t),this.sourceSpan(t),e,n,i)}else return s?new j(this.span(t),this.sourceSpan(t),e,n):new q(this.span(t),this.sourceSpan(t),e,n);return new C(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let s=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new N(e.span.start,n);return t.push(new ne(a,e,s)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Ie||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:s}=e.span,n=this.input.substring(t,s);return new P(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let s=new N(e.span.start,this.currentAbsoluteOffset);return new T(s,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new N(e,this.currentAbsoluteOffset);return new T(n,t,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new D(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e h+g.length,0);s+=a,t+=a}e.set(s,t),n++}return e}var mt="angular-estree-parser",Qe="NgEstreeParser",We=0,Ne=[mt,We];function St(){return new fe(new le)}function ke(r,e){let t=St(),{astInput:s,comments:n}=Br(r,t),{ast:i,errors:a}=e(s,t);return $t(a),{ast:i,comments:n}}function wt(r){return ke(r,(e,t)=>t.parseBinding(e,...Ne))}function yt(r){return ke(r,(e,t)=>t.parseSimpleBinding(e,...Ne))}function Et(r){return ke(r,(e,t)=>t.parseAction(e,!1,...Ne))}function Ct(r){return ke(r,(e,t)=>{let s=t.parseInterpolationExpression(e,...Ne);return s.ast=s.ast.expressions[0],s})}function At(r){let e=St(),{templateBindings:t,errors:s}=e.parseTemplateBindings(Qe,r,mt,We,We);return $t(s),t}function $t(r){if(r.length!==0){let[{message:e}]=r;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function Br(r,e){let t=e._commentStart(r);return t===null?{astInput:r,comments:[]}:{astInput:r.slice(0,t),comments:[{type:"Comment",value:r.slice(t+2),sourceSpan:{start:t,end:r.length}}]}}function Ot(r){return r instanceof B?"Unary":r instanceof $?"Binary":r instanceof Z?"BindingPipe":r instanceof re?"Call":r instanceof W?"Chain":r instanceof Q?"Conditional":r instanceof C?"EmptyExpr":r instanceof L?"ImplicitReceiver":r instanceof q?"KeyedRead":r instanceof j?"SafeKeyedRead":r instanceof X?"KeyedWrite":r instanceof J?"LiteralArray":r instanceof Y?"LiteralMap":r instanceof A?"LiteralPrimitive":r instanceof te?"NonNullAssert":r instanceof ee?"PrefixNot":r instanceof K?"PropertyRead":r instanceof H?"PropertyWrite":r instanceof se?"SafeCall":r instanceof z?"SafePropertyRead":r.type}function gt({start:r,end:e},t){let s=r,n=e;for(;n!==s&&/\s/.test(t[n-1]);)n--;for(;s!==n&&/\s/.test(t[s]);)s++;return{start:s,end:n}}function Tr({start:r,end:e},t){let s=r,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;s!==0&&/\s/.test(t[s-1]);)s--;return{start:s,end:n}}function _r(r,e){return e[r.start-1]==="("&&e[r.end]===")"?{start:r.start-1,end:r.end+1}:r}function It(r,e,t){let s=0,n={start:r.start,end:r.end};for(;;){let i=Tr(n,e),a=_r(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,s++}return{hasParens:(t?s-1:s)!==0,outerSpan:gt(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:gt(r,e)}}function Nt(r){return typeof r=="string"?e=>e===r:e=>r.test(e)}function kt(r,e,t){let s=Nt(e);for(let n=t;n>=0;n--){let i=r[n];if(s(i))return n}throw new Error(`Cannot find front char ${e} from index ${t} in ${JSON.stringify(r)}`)}function Pt(r,e,t){let s=Nt(e);for(let n=t;n {if(!(r&&e==null))return Array.isArray(e)||typeof e=="string"?e[t<0?e.length+t:t]:e.at(t)},Pe=Mr;var G=(r,e,t=!1)=>{let s=Ot(r);switch(s){case"Unary":{let{operator:o,expr:u}=r,v=n(u);return a("UnaryExpression",{prefix:!0,argument:v,operator:o},r.sourceSpan,{hasParentParens:t})}case"Binary":{let{left:o,operation:u,right:v}=r,c=n(o),x=n(v);return a(u==="&&"||u==="||"||u==="??"?"LogicalExpression":"BinaryExpression",{left:c,right:x,operator:u},{start:E(c),end:m(x)},{hasParentParens:t})}case"BindingPipe":{let{exp:o,name:u,args:v}=r,c=n(o),x=e.getCharacterIndex(/\S/,e.getCharacterIndex("|",m(c))+1),l=a("Identifier",{name:u},{start:x,end:x+u.length}),p=v.map(n);return a("NGPipeExpression",{left:c,right:l,arguments:p},{start:E(c),end:m(p.length===0?l:Pe(!1,p,-1))},{hasParentParens:t})}case"Chain":{let{expressions:o}=r;return a("NGChainedExpression",{expressions:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"Comment":{let{value:o}=r;return a("CommentLine",{value:o},r.sourceSpan,{processSpan:!1})}case"Conditional":{let{condition:o,trueExp:u,falseExp:v}=r,c=n(o),x=n(u),l=n(v);return a("ConditionalExpression",{test:c,consequent:x,alternate:l},{start:E(c),end:m(l)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},r.sourceSpan,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},r.sourceSpan,{hasParentParens:t});case"KeyedRead":case"SafeKeyedRead":{let o=s==="SafeKeyedRead",{key:u}=r,v=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,c=n(u);return h(v,c,{computed:!0,optional:o},{end:r.sourceSpan.end,hasParentParens:t})}case"LiteralArray":{let{expressions:o}=r;return a("ArrayExpression",{elements:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"LiteralMap":{let{keys:o,values:u}=r,v=u.map(x=>n(x)),c=o.map(({key:x,quoted:l},p)=>{let k=v[p],S=E(k),I=m(k),ue=e.getCharacterIndex(/\S/,p===0?r.sourceSpan.start+1:e.getCharacterIndex(",",m(v[p-1]))+1),Mt=S===ue?I:e.getCharacterLastIndex(/\S/,e.getCharacterLastIndex(":",S-1)-1)+1,je={start:ue,end:Mt},me=l?a("StringLiteral",{value:x},je):a("Identifier",{name:x},je),Ft=me.end =o.sourceSpan.end||/^\s+$/.test(e.text.slice(o.sourceSpan.start,o.sourceSpan.end))}function f(o){return(o.type==="OptionalCallExpression"||o.type==="OptionalMemberExpression")&&!y(o)}function y(o){return o.extra&&o.extra.parenthesized}function E(o){return y(o)?o.extra.parenStart:o.start}function m(o){return y(o)?o.extra.parenEnd:o.end}};function Re(r,e,t=!1,s=!1){if(!t){let{start:h,end:g}=r;return{start:h,end:g,loc:{filename:"",identifierName:"",start:e.locationForIndex(h),end:e.locationForIndex(g)}}}let{outerSpan:n,innerSpan:i,hasParens:a}=It(r,e.text,s);return{start:i.start,end:i.end,loc:{filename:"",identifierName:"",start:e.locationForIndex(i.start),end:e.locationForIndex(i.end)},...a&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}function Lt(r,e){r.forEach(o);let[t]=r,{key:s}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?r.slice(1):r,i=[],a=null;for(let c=0;c ({...I,...Re({start:I.start,end:ue},e)}),k=I=>({...p(I,l.end),alias:l}),S=i.pop();if(S.type==="NGMicrosyntaxExpression")i.push(k(S));else if(S.type==="NGMicrosyntaxKeyedExpression"){let I=k(S.expression);i.push(p({...S,expression:I},I.end))}else throw new Error(`Unexpected type ${S.type}`)}else i.push(h(x,c));a=x}return f("NGMicrosyntax",{body:i},i.length===0?r[0].sourceSpan:{start:i[0].start,end:Pe(!1,i,-1).end});function h(c,x){if(E(c)){let{key:l,value:p}=c;return p?x===0?f("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan):f("NGMicrosyntaxKeyedExpression",{key:f("NGMicrosyntaxKey",{name:y(l.source)},l.span),expression:f("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan)},{start:l.span.start,end:p.sourceSpan.end}):f("NGMicrosyntaxKey",{name:y(l.source)},l.span)}else{let{key:l,sourceSpan:p}=c;if(/^let\s$/.test(e.text.slice(p.start,p.start+4))){let{value:S}=c;return f("NGMicrosyntaxLet",{key:f("NGMicrosyntaxKey",{name:l.source},l.span),value:S?f("NGMicrosyntaxKey",{name:S.source},S.span):null},{start:p.start,end:S?S.span.end:l.span.end})}else{let S=v(c);return f("NGMicrosyntaxAs",{key:f("NGMicrosyntaxKey",{name:S.source},S.span),alias:f("NGMicrosyntaxKey",{name:l.source},l.span)},{start:S.span.start,end:l.span.end})}}}function g(c){return G(c,e)}function f(c,x,l,p=!0){return{type:c,...Re(l,e,p),...x}}function y(c){return Rt(c.slice(s.source.length))}function E(c){return c instanceof ne}function m(c){return c instanceof T}function o(c){u(c.key.span),m(c)&&c.value&&u(c.value.span)}function u(c){if(e.text[c.start]!=='"'&&e.text[c.start]!=="'")return;let x=e.text[c.start],l=!1;for(let p=c.start+1;p {let{ast:t,comments:s}=r(e),n=new ve(e),i=G(t,n);return i.comments=s.map(a=>G(a,n)),i}}var bt=Le(wt),As=Le(yt),Kt=Le(Ct),He=Le(Et),Bt=r=>Lt(At(r),new ve(r));function Fr(r){return Array.isArray(r)&&r.length>0}var Tt=Fr;function ze(r){var s;let e=r.range?r.range[0]:r.start,t=((s=r.declaration)==null?void 0:s.decorators)??r.decorators;return Tt(t)?Math.min(ze(t[0]),e):e}function _t(r){return r.range?r.range[1]:r.end}function be(r){return{astFormat:"estree",parse(e){let t=r(e);return{type:"NGRoot",node:r===He&&t.type!=="NGChainedExpression"?{...t,type:"NGChainedExpression",expressions:[t]}:t}},locStart:ze,locEnd:_t}}var Ur=be(He),Gr=be(bt),Dr=be(Kt),Vr=be(Bt);return Qt(Wr);}); \ No newline at end of file +(function(n){function e(){var i=n();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.angular=e()}})(function(){"use strict";var Pe=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Lt=Object.prototype.hasOwnProperty;var ze=(r,e)=>{for(var t in e)Pe(r,t,{get:e[t],enumerable:!0})},Kt=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Pt(e))!Lt.call(r,n)&&n!==t&&Pe(r,n,{get:()=>e[n],enumerable:!(s=Rt(e,n))||s.enumerable});return r};var bt=r=>Kt(Pe({},"__esModule",{value:!0}),r);var Lr={};ze(Lr,{parsers:()=>Qe});var Qe={};ze(Qe,{__ng_action:()=>Ir,__ng_binding:()=>kr,__ng_directive:()=>Pr,__ng_interpolation:()=>Rr});var G=class{constructor(e,t,s,n){this.input=t,this.errLocation=s,this.ctxLocation=n,this.message=`Parser Error: ${e} ${s} [${t}] in ${n}`}},P=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new I(e+this.start,e+this.end)}},w=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},W=class extends w{constructor(e,t,s){super(e,t),this.nameSpan=s}},$=class extends w{visit(e,t=null){}},L=class extends w{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},Se=class extends L{visit(e,t=null){var s;return(s=e.visitThisReceiver)==null?void 0:s.call(e,this,t)}},V=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitChain(this,t)}},Q=class extends w{constructor(e,t,s,n,i){super(e,t),this.condition=s,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},b=class extends W{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},H=class extends W{constructor(e,t,s,n,i,a){super(e,t,s),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},z=class extends W{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},q=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},j=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},X=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},Y=class extends W{constructor(e,t,s,n,i,a){super(e,t,a),this.exp=s,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},C=class extends w{constructor(e,t,s){super(e,t),this.value=s}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},Z=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitLiteralArray(this,t)}},J=class extends w{constructor(e,t,s,n){super(e,t),this.keys=s,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},me=class extends w{constructor(e,t,s,n){super(e,t),this.strings=s,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},A=class extends w{constructor(e,t,s,n,i){super(e,t),this.operation=s,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},B=class r extends A{static createMinus(e,t,s){return new r(e,t,"-",s,"-",new C(e,t,0),s)}static createPlus(e,t,s){return new r(e,t,"+",s,"-",s,new C(e,t,0))}constructor(e,t,s,n,i,a,h){super(e,t,i,a,h),this.operator=s,this.expr=n,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},ee=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitPrefixNot(this,t)}},te=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitNonNullAssert(this,t)}},re=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},se=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},I=class{constructor(e,t){this.start=e,this.end=t}},R=class extends w{constructor(e,t,s,n,i){super(new P(0,t===null?0:t.length),new I(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=s,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},T=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},ne=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},we=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let s of e)this.visit(s,t)}};var qe;(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.LITERAL_ATTR=1]="LITERAL_ATTR",r[r.ANIMATION=2]="ANIMATION",r[r.TWO_WAY=3]="TWO_WAY"})(qe||(qe={}));function je(r){return r>=9&&r<=32||r==160}function K(r){return 48<=r&&r<=57}function Xe(r){return r>=97&&r<=122||r>=65&&r<=90}function Le(r){return r===39||r===34||r===96}var f;(function(r){r[r.Character=0]="Character",r[r.Identifier=1]="Identifier",r[r.PrivateIdentifier=2]="PrivateIdentifier",r[r.Keyword=3]="Keyword",r[r.String=4]="String",r[r.Operator=5]="Operator",r[r.Number=6]="Number",r[r.Error=7]="Error"})(f||(f={}));var pr=["var","let","as","null","undefined","true","false","if","else","this"],le=class{tokenize(e){let t=new Be(e),s=[],n=t.scanToken();for(;n!=null;)s.push(n),n=t.scanToken();return s}},O=class{constructor(e,t,s,n,i){this.index=e,this.end=t,this.type=s,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==f.Character&&this.numValue==e}isNumber(){return this.type==f.Number}isString(){return this.type==f.String}isOperator(e){return this.type==f.Operator&&this.strValue==e}isIdentifier(){return this.type==f.Identifier}isPrivateIdentifier(){return this.type==f.PrivateIdentifier}isKeyword(){return this.type==f.Keyword}isKeywordLet(){return this.type==f.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==f.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==f.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==f.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==f.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==f.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==f.Keyword&&this.strValue=="this"}isError(){return this.type==f.Error}toNumber(){return this.type==f.Number?this.numValue:-1}toString(){switch(this.type){case f.Character:case f.Identifier:case f.Keyword:case f.Operator:case f.PrivateIdentifier:case f.String:case f.Error:return this.strValue;case f.Number:return this.numValue.toString();default:return null}}};function tt(r,e,t){return new O(r,e,f.Character,t,String.fromCharCode(t))}function ur(r,e,t){return new O(r,e,f.Identifier,0,t)}function lr(r,e,t){return new O(r,e,f.PrivateIdentifier,0,t)}function xr(r,e,t){return new O(r,e,f.Keyword,0,t)}function be(r,e,t){return new O(r,e,f.Operator,0,t)}function dr(r,e,t){return new O(r,e,f.String,0,t)}function fr(r,e,t){return new O(r,e,f.Number,t,"")}function vr(r,e,t){return new O(r,e,f.Error,0,t)}var Ce=new O(-1,-1,f.Character,0,""),Be=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,s=this.peek,n=this.index;for(;s<=32;)if(++n>=t){s=0;break}else s=e.charCodeAt(n);if(this.peek=s,this.index=n,n>=t)return null;if(rt(s))return this.scanIdentifier();if(K(s))return this.scanNumber(n);let i=n;switch(s){case 46:return this.advance(),K(this.peek)?this.scanNumber(i):tt(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,s);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(s));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;je(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(s)}]`,0)}scanCharacter(e,t){return this.advance(),tt(e,this.index,t)}scanOperator(e,t){return this.advance(),be(e,this.index,t)}scanComplexOperator(e,t,s,n,i,a){this.advance();let h=t;return this.peek==s&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),be(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();st(this.peek);)this.advance();let t=this.input.substring(e,this.index);return pr.indexOf(t)>-1?xr(e,this.index,t):ur(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!rt(this.peek))return this.error("Invalid character [#]",-1);for(;st(this.peek);)this.advance();let t=this.input.substring(e,this.index);return lr(e,this.index,t)}scanNumber(e){let t=this.index===e,s=!1;for(this.advance();;){if(!K(this.peek))if(this.peek===95){if(!K(this.input.charCodeAt(this.index-1))||!K(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);s=!0}else if(this.peek===46)t=!1;else if(gr(this.peek)){if(this.advance(),Sr(this.peek)&&this.advance(),!K(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);s&&(n=n.replace(/_/g,""));let i=t?wr(n):parseFloat(n);return fr(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let s="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){s+=i.substring(n,this.index);let h;if(this.advance(),this.peek==117){let g=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(g))h=parseInt(g,16);else return this.error(`Invalid unicode escape [\\u${g}]`,0);for(let d=0;d<5;d++)this.advance()}else h=mr(this.peek),this.advance();s+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),dr(e,this.index,s+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),be(e,this.index,t)}error(e,t){let s=this.index+t;return vr(s,this.index,`Lexer Error: ${e} at column ${s} in expression [${this.input}]`)}};function rt(r){return 97<=r&&r<=122||65<=r&&r<=90||r==95||r==36}function st(r){return Xe(r)||K(r)||r==95||r==36}function gr(r){return r==101||r==69}function Sr(r){return r==45||r==43}function mr(r){switch(r){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return r}}function wr(r){let e=parseInt(r);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+r);return e}var yr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function ot(r,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${r}' to be an array, [start, end].`);if(e!=null){let t=e[0],s=e[1];yr.forEach(n=>{if(n.test(t)||n.test(s))throw new Error(`['${t}', '${s}'] contains unusable interpolation symbol.`)})}}var _e=class r{static fromArray(e){return e?(ot("interpolation",e),new r(e[0],e[1])):F}constructor(e,t){this.start=e,this.end=t}},F=new _e("{{","}}");var Me=class{constructor(e,t,s){this.strings=e,this.expressions=t,this.offsets=s}},Fe=class{constructor(e,t,s){this.templateBindings=e,this.warnings=t,this.errors=s}},fe=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,s,n,i=F){this._checkNoInterpolation(e,s,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),g=1;t&&(g|=2);let d=new U(e,s,n,h,g,this.errors,0).parseChain();return new R(d,e,s,n,this.errors)}parseBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n);return new R(i,e,t,s,this.errors)}checkSimpleExpression(e){let t=new Ue;return e.visit(t),t.errors}parseSimpleBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new R(i,e,t,s,this.errors)}_reportError(e,t,s,n){this.errors.push(new G(e,t,s,n))}_parseBindingAst(e,t,s,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new U(e,t,s,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,s,n,i){let a=this._lexer.tokenize(t);return new U(t,s,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new I(n,n+e.length)})}parseInterpolation(e,t,s,n,i=F){let{strings:a,expressions:h,offsets:g}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let d=[];for(let y=0;y y.text),d,e,t,s)}parseInterpolationExpression(e,t,s){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new U(e,t,s,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,s)}createInterpolationAst(e,t,s,n,i){let a=new P(0,s.length),h=new me(a,a.toAbsolute(i),e,t);return new R(h,s,n,i,this.errors)}splitInterpolation(e,t,s,n=F){let i=[],a=[],h=[],g=s?Er(s):null,d=0,y=!1,E=!1,{start:S,end:o}=n;for(;d -1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${s}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,s){for(let n of this._forEachUnquotedChar(e,s)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let s=null,n=0;for(let i=t;i =this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let s=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(s=t),e>s){let n=s;s=e,e=n}return new P(e,s)}sourceSpan(e,t){let s=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(s)||this.sourceSpanCache.set(s,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(s)}advance(){this.index++}withContext(e,t){this.context|=e;let s=t();return this.context^=e,s}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Ce?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index ":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new A(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==f.Operator;){let s=this.next.strValue;switch(s){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new A(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==f.Operator;){let s=this.next.strValue;switch(s){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new A(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parsePrefix(){if(this.next.type==f.Operator){let e=this.inputIndex,t=this.next.strValue,s;switch(t){case"+":return this.advance(),s=this.parsePrefix(),B.createPlus(this.span(e),this.sourceSpan(e),s);case"-":return this.advance(),s=this.parsePrefix(),B.createMinus(this.span(e),this.sourceSpan(e),s);case"!":return this.advance(),s=this.parsePrefix(),new ee(this.span(e),this.sourceSpan(e),s)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new te(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new C(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new C(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new C(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new C(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Se(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new Z(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new L(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new C(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new C(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new $(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new $(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new $(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),g=this.sourceSpan(n);t.push(new b(h,g,g,new L(h,g),a))}}while(this.consumeOptionalCharacter(44)&&!this.next.isCharacter(125));this.rbracesExpected--,this.expectCharacter(125)}return new J(this.span(s),this.sourceSpan(s),e,t)}parseAccessMember(e,t,s){let n=this.inputIndex,i=this.withContext(pe.Writable,()=>{let g=this.expectIdentifierOrKeyword()??"";return g.length===0&&this.error("Expected identifier for property access",e.span.end),g}),a=this.sourceSpan(n),h;if(s)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new $(this.span(t),this.sourceSpan(t))):h=new z(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new $(this.span(t),this.sourceSpan(t));let g=this.parseConditional();h=new H(this.span(t),this.sourceSpan(t),a,e,i,g)}else h=new b(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,s){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),g=this.sourceSpan(t);return s?new se(h,g,e,i,a):new re(h,g,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,s=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new I(s,s+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index {this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof $&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(s)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new X(this.span(t),this.sourceSpan(t),e,n,i)}else return s?new j(this.span(t),this.sourceSpan(t),e,n):new q(this.span(t),this.sourceSpan(t),e,n);return new $(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let s=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new I(e.span.start,n);return t.push(new ne(a,e,s)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Ce||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:s}=e.span,n=this.input.substring(t,s);return new R(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let s=new I(e.span.start,this.currentAbsoluteOffset);return new T(s,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new I(e,this.currentAbsoluteOffset);return new T(n,t,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new G(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e h+g.length,0);s+=a,t+=a}e.set(s,t),n++}return e}var ht="angular-estree-parser",Ge="NgEstreeParser",De=0,Ae=[ht,De];function pt(){return new fe(new le)}function Oe(r,e){let t=pt(),{astInput:s,comments:n}=Cr(r,t),{ast:i,errors:a}=e(s,t);return vt(a),{ast:i,comments:n}}function ut(r){return Oe(r,(e,t)=>t.parseBinding(e,...Ae))}function lt(r){return Oe(r,(e,t)=>t.parseSimpleBinding(e,...Ae))}function xt(r){return Oe(r,(e,t)=>t.parseAction(e,!1,...Ae))}function dt(r){return Oe(r,(e,t)=>{let s=t.parseInterpolationExpression(e,...Ae);return s.ast=s.ast.expressions[0],s})}function ft(r){let e=pt(),{templateBindings:t,errors:s}=e.parseTemplateBindings(Ge,r,ht,De,De);return vt(s),t}function vt(r){if(r.length!==0){let[{message:e}]=r;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function Cr(r,e){let t=e._commentStart(r);return t===null?{astInput:r,comments:[]}:{astInput:r.slice(0,t),comments:[{type:"Comment",value:r.slice(t+2),sourceSpan:{start:t,end:r.length}}]}}function gt(r){return r instanceof B?"Unary":r instanceof A?"Binary":r instanceof Y?"BindingPipe":r instanceof re?"Call":r instanceof V?"Chain":r instanceof Q?"Conditional":r instanceof $?"EmptyExpr":r instanceof L?"ImplicitReceiver":r instanceof q?"KeyedRead":r instanceof j?"SafeKeyedRead":r instanceof X?"KeyedWrite":r instanceof Z?"LiteralArray":r instanceof J?"LiteralMap":r instanceof C?"LiteralPrimitive":r instanceof te?"NonNullAssert":r instanceof ee?"PrefixNot":r instanceof b?"PropertyRead":r instanceof H?"PropertyWrite":r instanceof se?"SafeCall":r instanceof z?"SafePropertyRead":r.type}function ct({start:r,end:e},t){let s=r,n=e;for(;n!==s&&/\s/.test(t[n-1]);)n--;for(;s!==n&&/\s/.test(t[s]);)s++;return{start:s,end:n}}function Ar({start:r,end:e},t){let s=r,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;s!==0&&/\s/.test(t[s-1]);)s--;return{start:s,end:n}}function Or(r,e){return e[r.start-1]==="("&&e[r.end]===")"?{start:r.start-1,end:r.end+1}:r}function St(r,e,t){let s=0,n={start:r.start,end:r.end};for(;;){let i=Ar(n,e),a=Or(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,s++}return{hasParens:(t?s-1:s)!==0,outerSpan:ct(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:ct(r,e)}}function mt(r){return typeof r=="string"?e=>e===r:e=>r.test(e)}function wt(r,e,t){let s=mt(e);for(let n=t;n>=0;n--){let i=r[n];if(s(i))return n}throw new Error(`Cannot find front char ${e} from index ${t} in ${JSON.stringify(r)}`)}function yt(r,e,t){let s=mt(e);for(let n=t;n {if(!(r&&e==null))return Array.isArray(e)||typeof e=="string"?e[t<0?e.length+t:t]:e.at(t)},Ne=Nr;var D=(r,e,t=!1)=>{let s=gt(r);switch(s){case"Unary":{let{operator:o,expr:u}=r,v=n(u);return a("UnaryExpression",{prefix:!0,argument:v,operator:o},r.sourceSpan,{hasParentParens:t})}case"Binary":{let{left:o,operation:u,right:v}=r,c=n(o),x=n(v);return a(u==="&&"||u==="||"||u==="??"?"LogicalExpression":"BinaryExpression",{left:c,right:x,operator:u},{start:E(c),end:S(x)},{hasParentParens:t})}case"BindingPipe":{let{exp:o,name:u,args:v}=r,c=n(o),x=e.getCharacterIndex(/\S/,e.getCharacterIndex("|",S(c))+1),l=a("Identifier",{name:u},{start:x,end:x+u.length}),p=v.map(n);return a("NGPipeExpression",{left:c,right:l,arguments:p},{start:E(c),end:S(p.length===0?l:Ne(!1,p,-1))},{hasParentParens:t})}case"Chain":{let{expressions:o}=r;return a("NGChainedExpression",{expressions:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"Comment":{let{value:o}=r;return a("CommentLine",{value:o},r.sourceSpan,{processSpan:!1})}case"Conditional":{let{condition:o,trueExp:u,falseExp:v}=r,c=n(o),x=n(u),l=n(v);return a("ConditionalExpression",{test:c,consequent:x,alternate:l},{start:E(c),end:S(l)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},r.sourceSpan,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},r.sourceSpan,{hasParentParens:t});case"KeyedRead":case"SafeKeyedRead":{let o=s==="SafeKeyedRead",{key:u}=r,v=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,c=n(u);return h(v,c,{computed:!0,optional:o},{end:r.sourceSpan.end,hasParentParens:t})}case"LiteralArray":{let{expressions:o}=r;return a("ArrayExpression",{elements:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"LiteralMap":{let{keys:o,values:u}=r,v=u.map(x=>n(x)),c=o.map(({key:x,quoted:l},p)=>{let k=v[p],m=E(k),N=S(k),ue=e.getCharacterIndex(/\S/,p===0?r.sourceSpan.start+1:e.getCharacterIndex(",",S(v[p-1]))+1),It=m===ue?N:e.getCharacterLastIndex(/\S/,e.getCharacterLastIndex(":",m-1)-1)+1,He={start:ue,end:It},ge=l?a("StringLiteral",{value:x},He):a("Identifier",{name:x},He),kt=ge.end =o.sourceSpan.end||/^\s+$/.test(e.text.slice(o.sourceSpan.start,o.sourceSpan.end))}function d(o){return(o.type==="OptionalCallExpression"||o.type==="OptionalMemberExpression")&&!y(o)}function y(o){return o.extra&&o.extra.parenthesized}function E(o){return y(o)?o.extra.parenStart:o.start}function S(o){return y(o)?o.extra.parenEnd:o.end}};function Ie(r,e,t=!1,s=!1){if(!t){let{start:g,end:d}=r;return{start:g,end:d,range:[g,d]}}let{outerSpan:n,innerSpan:{start:i,end:a},hasParens:h}=St(r,e.text,s);return{start:i,end:a,range:[i,a],...h&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}function $t(r,e){r.forEach(o);let[t]=r,{key:s}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?r.slice(1):r,i=[],a=null;for(let c=0;c ({...N,...Ie({start:N.start,end:ue},e)}),k=N=>({...p(N,l.end),alias:l}),m=i.pop();if(m.type==="NGMicrosyntaxExpression")i.push(k(m));else if(m.type==="NGMicrosyntaxKeyedExpression"){let N=k(m.expression);i.push(p({...m,expression:N},N.end))}else throw new Error(`Unexpected type ${m.type}`)}else i.push(h(x,c));a=x}return d("NGMicrosyntax",{body:i},i.length===0?r[0].sourceSpan:{start:i[0].start,end:Ne(!1,i,-1).end});function h(c,x){if(E(c)){let{key:l,value:p}=c;return p?x===0?d("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan):d("NGMicrosyntaxKeyedExpression",{key:d("NGMicrosyntaxKey",{name:y(l.source)},l.span),expression:d("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan)},{start:l.span.start,end:p.sourceSpan.end}):d("NGMicrosyntaxKey",{name:y(l.source)},l.span)}else{let{key:l,sourceSpan:p}=c;if(/^let\s$/.test(e.text.slice(p.start,p.start+4))){let{value:m}=c;return d("NGMicrosyntaxLet",{key:d("NGMicrosyntaxKey",{name:l.source},l.span),value:m?d("NGMicrosyntaxKey",{name:m.source},m.span):null},{start:p.start,end:m?m.span.end:l.span.end})}else{let m=v(c);return d("NGMicrosyntaxAs",{key:d("NGMicrosyntaxKey",{name:m.source},m.span),alias:d("NGMicrosyntaxKey",{name:l.source},l.span)},{start:m.span.start,end:l.span.end})}}}function g(c){return D(c,e)}function d(c,x,l,p=!0){return{type:c,...Ie(l,e,p),...x}}function y(c){return Et(c.slice(s.source.length))}function E(c){return c instanceof ne}function S(c){return c instanceof T}function o(c){u(c.key.span),S(c)&&c.value&&u(c.value.span)}function u(c){if(e.text[c.start]!=='"'&&e.text[c.start]!=="'")return;let x=e.text[c.start],l=!1;for(let p=c.start+1;p {let{ast:t,comments:s}=r(e),n=new ve(e),i=D(t,n);return i.comments=s.map(a=>D(a,n)),i}}var Ct=ke(ut),hs=ke(lt),At=ke(dt),We=ke(xt),Ot=r=>$t(ft(r),new ve(r));function Ve(r){var s,n,i;let e=((s=r.range)==null?void 0:s[0])??r.start,t=(i=((n=r.declaration)==null?void 0:n.decorators)??r.decorators)==null?void 0:i[0];return t?Math.min(Ve(t),e):e}function Nt(r){var e;return((e=r.range)==null?void 0:e[1])??r.end}function Re(r){return{astFormat:"estree",parse(e){let t=r(e);return{type:"NGRoot",node:r===We&&t.type!=="NGChainedExpression"?{...t,type:"NGChainedExpression",expressions:[t]}:t}},locStart:Ve,locEnd:Nt}}var Ir=Re(We),kr=Re(Ct),Rr=Re(At),Pr=Re(Ot);return bt(Lr);}); \ No newline at end of file diff --git a/node_modules/prettier/plugins/angular.mjs b/node_modules/prettier/plugins/angular.mjs index 80e1481..b143c2f 100644 --- a/node_modules/prettier/plugins/angular.mjs +++ b/node_modules/prettier/plugins/angular.mjs @@ -1,2 +1 @@ -var Xe=Object.defineProperty;var Gt=(r,e,t)=>e in r?Xe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ze=(r,e)=>{for(var t in e)Xe(r,t,{get:e[t],enumerable:!0})};var Je=(r,e,t)=>(Gt(r,typeof e!="symbol"?e+"":e,t),t),Ye=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var be=(r,e,t)=>(Ye(r,e,"read from private field"),t?t.call(r):e.get(r)),et=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},tt=(r,e,t,s)=>(Ye(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);var qe={};Ze(qe,{parsers:()=>ze});var ze={};Ze(ze,{__ng_action:()=>Tr,__ng_binding:()=>_r,__ng_directive:()=>Fr,__ng_interpolation:()=>Mr});var Se=` -`,rt="\r",st=function(){function r(e){this.length=e.length;for(var t=[0],s=0;s this.length)return null;for(var t=0,s=this.offsets;s[t+1]<=e;)t++;var n=e-s[t];return{line:t,column:n}},r.prototype.indexForLocation=function(e){var t=e.line,s=e.column;return t<0||t>=this.offsets.length||s<0||s>this.lengthOfLine(t)?null:this.offsets[t]+s},r.prototype.lengthOfLine=function(e){var t=this.offsets[e],s=e===this.offsets.length-1?this.length:this.offsets[e+1];return s-t},r}();var D=class{constructor(e,t,s,n){this.input=t,this.errLocation=s,this.ctxLocation=n,this.message=`Parser Error: ${e} ${s} [${t}] in ${n}`}},R=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new N(e+this.start,e+this.end)}},w=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},V=class extends w{constructor(e,t,s){super(e,t),this.nameSpan=s}},C=class extends w{visit(e,t=null){}},L=class extends w{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},we=class extends L{visit(e,t=null){var s;return(s=e.visitThisReceiver)==null?void 0:s.call(e,this,t)}},W=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitChain(this,t)}},Q=class extends w{constructor(e,t,s,n,i){super(e,t),this.condition=s,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},K=class extends V{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},H=class extends V{constructor(e,t,s,n,i,a){super(e,t,s),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},z=class extends V{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},q=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},j=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},X=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},Z=class extends V{constructor(e,t,s,n,i,a){super(e,t,a),this.exp=s,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},A=class extends w{constructor(e,t,s){super(e,t),this.value=s}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},J=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitLiteralArray(this,t)}},Y=class extends w{constructor(e,t,s,n){super(e,t),this.keys=s,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},ye=class extends w{constructor(e,t,s,n){super(e,t),this.strings=s,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},$=class extends w{constructor(e,t,s,n,i){super(e,t),this.operation=s,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},B=class r extends ${static createMinus(e,t,s){return new r(e,t,"-",s,"-",new A(e,t,0),s)}static createPlus(e,t,s){return new r(e,t,"+",s,"-",s,new A(e,t,0))}constructor(e,t,s,n,i,a,h){super(e,t,i,a,h),this.operator=s,this.expr=n,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},ee=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitPrefixNot(this,t)}},te=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitNonNullAssert(this,t)}},re=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},se=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},N=class{constructor(e,t){this.start=e,this.end=t}},P=class extends w{constructor(e,t,s,n,i){super(new R(0,t===null?0:t.length),new N(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=s,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},T=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},ne=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},Ee=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let s of e)this.visit(s,t)}};var nt;(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.LITERAL_ATTR=1]="LITERAL_ATTR",r[r.ANIMATION=2]="ANIMATION"})(nt||(nt={}));function it(r){return r>=9&&r<=32||r==160}function b(r){return 48<=r&&r<=57}function at(r){return r>=97&&r<=122||r>=65&&r<=90}function Ke(r){return r===39||r===34||r===96}var d;(function(r){r[r.Character=0]="Character",r[r.Identifier=1]="Identifier",r[r.PrivateIdentifier=2]="PrivateIdentifier",r[r.Keyword=3]="Keyword",r[r.String=4]="String",r[r.Operator=5]="Operator",r[r.Number=6]="Number",r[r.Error=7]="Error"})(d||(d={}));var gr=["var","let","as","null","undefined","true","false","if","else","this"],le=class{tokenize(e){let t=new _e(e),s=[],n=t.scanToken();for(;n!=null;)s.push(n),n=t.scanToken();return s}},O=class{constructor(e,t,s,n,i){this.index=e,this.end=t,this.type=s,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==d.Character&&this.numValue==e}isNumber(){return this.type==d.Number}isString(){return this.type==d.String}isOperator(e){return this.type==d.Operator&&this.strValue==e}isIdentifier(){return this.type==d.Identifier}isPrivateIdentifier(){return this.type==d.PrivateIdentifier}isKeyword(){return this.type==d.Keyword}isKeywordLet(){return this.type==d.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==d.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==d.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==d.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==d.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==d.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==d.Keyword&&this.strValue=="this"}isError(){return this.type==d.Error}toNumber(){return this.type==d.Number?this.numValue:-1}toString(){switch(this.type){case d.Character:case d.Identifier:case d.Keyword:case d.Operator:case d.PrivateIdentifier:case d.String:case d.Error:return this.strValue;case d.Number:return this.numValue.toString();default:return null}}};function ut(r,e,t){return new O(r,e,d.Character,t,String.fromCharCode(t))}function mr(r,e,t){return new O(r,e,d.Identifier,0,t)}function Sr(r,e,t){return new O(r,e,d.PrivateIdentifier,0,t)}function wr(r,e,t){return new O(r,e,d.Keyword,0,t)}function Te(r,e,t){return new O(r,e,d.Operator,0,t)}function yr(r,e,t){return new O(r,e,d.String,0,t)}function Er(r,e,t){return new O(r,e,d.Number,t,"")}function Cr(r,e,t){return new O(r,e,d.Error,0,t)}var Oe=new O(-1,-1,d.Character,0,""),_e=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,s=this.peek,n=this.index;for(;s<=32;)if(++n>=t){s=0;break}else s=e.charCodeAt(n);if(this.peek=s,this.index=n,n>=t)return null;if(lt(s))return this.scanIdentifier();if(b(s))return this.scanNumber(n);let i=n;switch(s){case 46:return this.advance(),b(this.peek)?this.scanNumber(i):ut(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,s);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(s));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;it(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(s)}]`,0)}scanCharacter(e,t){return this.advance(),ut(e,this.index,t)}scanOperator(e,t){return this.advance(),Te(e,this.index,t)}scanComplexOperator(e,t,s,n,i,a){this.advance();let h=t;return this.peek==s&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),Te(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();xt(this.peek);)this.advance();let t=this.input.substring(e,this.index);return gr.indexOf(t)>-1?wr(e,this.index,t):mr(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!lt(this.peek))return this.error("Invalid character [#]",-1);for(;xt(this.peek);)this.advance();let t=this.input.substring(e,this.index);return Sr(e,this.index,t)}scanNumber(e){let t=this.index===e,s=!1;for(this.advance();;){if(!b(this.peek))if(this.peek===95){if(!b(this.input.charCodeAt(this.index-1))||!b(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);s=!0}else if(this.peek===46)t=!1;else if(Ar(this.peek)){if(this.advance(),$r(this.peek)&&this.advance(),!b(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);s&&(n=n.replace(/_/g,""));let i=t?Ir(n):parseFloat(n);return Er(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let s="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){s+=i.substring(n,this.index);let h;if(this.advance(),this.peek==117){let g=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(g))h=parseInt(g,16);else return this.error(`Invalid unicode escape [\\u${g}]`,0);for(let f=0;f<5;f++)this.advance()}else h=Or(this.peek),this.advance();s+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),yr(e,this.index,s+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),Te(e,this.index,t)}error(e,t){let s=this.index+t;return Cr(s,this.index,`Lexer Error: ${e} at column ${s} in expression [${this.input}]`)}};function lt(r){return 97<=r&&r<=122||65<=r&&r<=90||r==95||r==36}function xt(r){return at(r)||b(r)||r==95||r==36}function Ar(r){return r==101||r==69}function $r(r){return r==45||r==43}function Or(r){switch(r){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return r}}function Ir(r){let e=parseInt(r);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+r);return e}var Nr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function gt(r,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${r}' to be an array, [start, end].`);if(e!=null){let t=e[0],s=e[1];Nr.forEach(n=>{if(n.test(t)||n.test(s))throw new Error(`['${t}', '${s}'] contains unusable interpolation symbol.`)})}}var Fe=class r{static fromArray(e){return e?(gt("interpolation",e),new r(e[0],e[1])):F}constructor(e,t){this.start=e,this.end=t}},F=new Fe("{{","}}");var Ue=class{constructor(e,t,s){this.strings=e,this.expressions=t,this.offsets=s}},Ge=class{constructor(e,t,s){this.templateBindings=e,this.warnings=t,this.errors=s}},fe=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,s,n,i=F){this._checkNoInterpolation(e,s,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),g=1;t&&(g|=2);let f=new U(e,s,n,h,g,this.errors,0).parseChain();return new P(f,e,s,n,this.errors)}parseBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n);return new P(i,e,t,s,this.errors)}checkSimpleExpression(e){let t=new De;return e.visit(t),t.errors}parseSimpleBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new P(i,e,t,s,this.errors)}_reportError(e,t,s,n){this.errors.push(new D(e,t,s,n))}_parseBindingAst(e,t,s,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new U(e,t,s,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,s,n,i){let a=this._lexer.tokenize(t);return new U(t,s,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new N(n,n+e.length)})}parseInterpolation(e,t,s,n,i=F){let{strings:a,expressions:h,offsets:g}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let f=[];for(let y=0;y y.text),f,e,t,s)}parseInterpolationExpression(e,t,s){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new U(e,t,s,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,s)}createInterpolationAst(e,t,s,n,i){let a=new R(0,s.length),h=new ye(a,a.toAbsolute(i),e,t);return new P(h,s,n,i,this.errors)}splitInterpolation(e,t,s,n=F){let i=[],a=[],h=[],g=s?kr(s):null,f=0,y=!1,E=!1,{start:m,end:o}=n;for(;f -1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${s}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,s){for(let n of this._forEachUnquotedChar(e,s)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let s=null,n=0;for(let i=t;i =this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let s=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(s=t),e>s){let n=s;s=e,e=n}return new R(e,s)}sourceSpan(e,t){let s=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(s)||this.sourceSpanCache.set(s,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(s)}advance(){this.index++}withContext(e,t){this.context|=e;let s=t();return this.context^=e,s}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Oe?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index ":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new $(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==d.Operator;){let s=this.next.strValue;switch(s){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new $(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==d.Operator;){let s=this.next.strValue;switch(s){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new $(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parsePrefix(){if(this.next.type==d.Operator){let e=this.inputIndex,t=this.next.strValue,s;switch(t){case"+":return this.advance(),s=this.parsePrefix(),B.createPlus(this.span(e),this.sourceSpan(e),s);case"-":return this.advance(),s=this.parsePrefix(),B.createMinus(this.span(e),this.sourceSpan(e),s);case"!":return this.advance(),s=this.parsePrefix(),new ee(this.span(e),this.sourceSpan(e),s)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new te(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new A(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new A(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new A(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new A(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new we(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new J(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new L(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new C(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new C(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new C(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),g=this.sourceSpan(n);t.push(new K(h,g,g,new L(h,g),a))}}while(this.consumeOptionalCharacter(44)&&!this.next.isCharacter(125));this.rbracesExpected--,this.expectCharacter(125)}return new Y(this.span(s),this.sourceSpan(s),e,t)}parseAccessMember(e,t,s){let n=this.inputIndex,i=this.withContext(pe.Writable,()=>{let g=this.expectIdentifierOrKeyword()??"";return g.length===0&&this.error("Expected identifier for property access",e.span.end),g}),a=this.sourceSpan(n),h;if(s)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new C(this.span(t),this.sourceSpan(t))):h=new z(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new C(this.span(t),this.sourceSpan(t));let g=this.parseConditional();h=new H(this.span(t),this.sourceSpan(t),a,e,i,g)}else h=new K(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,s){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),g=this.sourceSpan(t);return s?new se(h,g,e,i,a):new re(h,g,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,s=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new N(s,s+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index {this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof C&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(s)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new X(this.span(t),this.sourceSpan(t),e,n,i)}else return s?new j(this.span(t),this.sourceSpan(t),e,n):new q(this.span(t),this.sourceSpan(t),e,n);return new C(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let s=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new N(e.span.start,n);return t.push(new ne(a,e,s)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Oe||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:s}=e.span,n=this.input.substring(t,s);return new P(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let s=new N(e.span.start,this.currentAbsoluteOffset);return new T(s,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new N(e,this.currentAbsoluteOffset);return new T(n,t,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new D(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e h+g.length,0);s+=a,t+=a}e.set(s,t),n++}return e}var St="angular-estree-parser",We="NgEstreeParser",Ve=0,Ie=[St,Ve];function wt(){return new fe(new le)}function Ne(r,e){let t=wt(),{astInput:s,comments:n}=Rr(r,t),{ast:i,errors:a}=e(s,t);return Ot(a),{ast:i,comments:n}}function yt(r){return Ne(r,(e,t)=>t.parseBinding(e,...Ie))}function Et(r){return Ne(r,(e,t)=>t.parseSimpleBinding(e,...Ie))}function Ct(r){return Ne(r,(e,t)=>t.parseAction(e,!1,...Ie))}function At(r){return Ne(r,(e,t)=>{let s=t.parseInterpolationExpression(e,...Ie);return s.ast=s.ast.expressions[0],s})}function $t(r){let e=wt(),{templateBindings:t,errors:s}=e.parseTemplateBindings(We,r,St,Ve,Ve);return Ot(s),t}function Ot(r){if(r.length!==0){let[{message:e}]=r;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function Rr(r,e){let t=e._commentStart(r);return t===null?{astInput:r,comments:[]}:{astInput:r.slice(0,t),comments:[{type:"Comment",value:r.slice(t+2),sourceSpan:{start:t,end:r.length}}]}}function It(r){return r instanceof B?"Unary":r instanceof $?"Binary":r instanceof Z?"BindingPipe":r instanceof re?"Call":r instanceof W?"Chain":r instanceof Q?"Conditional":r instanceof C?"EmptyExpr":r instanceof L?"ImplicitReceiver":r instanceof q?"KeyedRead":r instanceof j?"SafeKeyedRead":r instanceof X?"KeyedWrite":r instanceof J?"LiteralArray":r instanceof Y?"LiteralMap":r instanceof A?"LiteralPrimitive":r instanceof te?"NonNullAssert":r instanceof ee?"PrefixNot":r instanceof K?"PropertyRead":r instanceof H?"PropertyWrite":r instanceof se?"SafeCall":r instanceof z?"SafePropertyRead":r.type}function mt({start:r,end:e},t){let s=r,n=e;for(;n!==s&&/\s/.test(t[n-1]);)n--;for(;s!==n&&/\s/.test(t[s]);)s++;return{start:s,end:n}}function Lr({start:r,end:e},t){let s=r,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;s!==0&&/\s/.test(t[s-1]);)s--;return{start:s,end:n}}function br(r,e){return e[r.start-1]==="("&&e[r.end]===")"?{start:r.start-1,end:r.end+1}:r}function Nt(r,e,t){let s=0,n={start:r.start,end:r.end};for(;;){let i=Lr(n,e),a=br(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,s++}return{hasParens:(t?s-1:s)!==0,outerSpan:mt(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:mt(r,e)}}function kt(r){return typeof r=="string"?e=>e===r:e=>r.test(e)}function Pt(r,e,t){let s=kt(e);for(let n=t;n>=0;n--){let i=r[n];if(s(i))return n}throw new Error(`Cannot find front char ${e} from index ${t} in ${JSON.stringify(r)}`)}function Rt(r,e,t){let s=kt(e);for(let n=t;n {if(!(r&&e==null))return Array.isArray(e)||typeof e=="string"?e[t<0?e.length+t:t]:e.at(t)},ke=Kr;var G=(r,e,t=!1)=>{let s=It(r);switch(s){case"Unary":{let{operator:o,expr:u}=r,v=n(u);return a("UnaryExpression",{prefix:!0,argument:v,operator:o},r.sourceSpan,{hasParentParens:t})}case"Binary":{let{left:o,operation:u,right:v}=r,c=n(o),x=n(v);return a(u==="&&"||u==="||"||u==="??"?"LogicalExpression":"BinaryExpression",{left:c,right:x,operator:u},{start:E(c),end:m(x)},{hasParentParens:t})}case"BindingPipe":{let{exp:o,name:u,args:v}=r,c=n(o),x=e.getCharacterIndex(/\S/,e.getCharacterIndex("|",m(c))+1),l=a("Identifier",{name:u},{start:x,end:x+u.length}),p=v.map(n);return a("NGPipeExpression",{left:c,right:l,arguments:p},{start:E(c),end:m(p.length===0?l:ke(!1,p,-1))},{hasParentParens:t})}case"Chain":{let{expressions:o}=r;return a("NGChainedExpression",{expressions:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"Comment":{let{value:o}=r;return a("CommentLine",{value:o},r.sourceSpan,{processSpan:!1})}case"Conditional":{let{condition:o,trueExp:u,falseExp:v}=r,c=n(o),x=n(u),l=n(v);return a("ConditionalExpression",{test:c,consequent:x,alternate:l},{start:E(c),end:m(l)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},r.sourceSpan,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},r.sourceSpan,{hasParentParens:t});case"KeyedRead":case"SafeKeyedRead":{let o=s==="SafeKeyedRead",{key:u}=r,v=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,c=n(u);return h(v,c,{computed:!0,optional:o},{end:r.sourceSpan.end,hasParentParens:t})}case"LiteralArray":{let{expressions:o}=r;return a("ArrayExpression",{elements:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"LiteralMap":{let{keys:o,values:u}=r,v=u.map(x=>n(x)),c=o.map(({key:x,quoted:l},p)=>{let k=v[p],S=E(k),I=m(k),ue=e.getCharacterIndex(/\S/,p===0?r.sourceSpan.start+1:e.getCharacterIndex(",",m(v[p-1]))+1),Ft=S===ue?I:e.getCharacterLastIndex(/\S/,e.getCharacterLastIndex(":",S-1)-1)+1,je={start:ue,end:Ft},me=l?a("StringLiteral",{value:x},je):a("Identifier",{name:x},je),Ut=me.end =o.sourceSpan.end||/^\s+$/.test(e.text.slice(o.sourceSpan.start,o.sourceSpan.end))}function f(o){return(o.type==="OptionalCallExpression"||o.type==="OptionalMemberExpression")&&!y(o)}function y(o){return o.extra&&o.extra.parenthesized}function E(o){return y(o)?o.extra.parenStart:o.start}function m(o){return y(o)?o.extra.parenEnd:o.end}};function Pe(r,e,t=!1,s=!1){if(!t){let{start:h,end:g}=r;return{start:h,end:g,loc:{filename:"",identifierName:"",start:e.locationForIndex(h),end:e.locationForIndex(g)}}}let{outerSpan:n,innerSpan:i,hasParens:a}=Nt(r,e.text,s);return{start:i.start,end:i.end,loc:{filename:"",identifierName:"",start:e.locationForIndex(i.start),end:e.locationForIndex(i.end)},...a&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}function bt(r,e){r.forEach(o);let[t]=r,{key:s}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?r.slice(1):r,i=[],a=null;for(let c=0;c ({...I,...Pe({start:I.start,end:ue},e)}),k=I=>({...p(I,l.end),alias:l}),S=i.pop();if(S.type==="NGMicrosyntaxExpression")i.push(k(S));else if(S.type==="NGMicrosyntaxKeyedExpression"){let I=k(S.expression);i.push(p({...S,expression:I},I.end))}else throw new Error(`Unexpected type ${S.type}`)}else i.push(h(x,c));a=x}return f("NGMicrosyntax",{body:i},i.length===0?r[0].sourceSpan:{start:i[0].start,end:ke(!1,i,-1).end});function h(c,x){if(E(c)){let{key:l,value:p}=c;return p?x===0?f("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan):f("NGMicrosyntaxKeyedExpression",{key:f("NGMicrosyntaxKey",{name:y(l.source)},l.span),expression:f("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan)},{start:l.span.start,end:p.sourceSpan.end}):f("NGMicrosyntaxKey",{name:y(l.source)},l.span)}else{let{key:l,sourceSpan:p}=c;if(/^let\s$/.test(e.text.slice(p.start,p.start+4))){let{value:S}=c;return f("NGMicrosyntaxLet",{key:f("NGMicrosyntaxKey",{name:l.source},l.span),value:S?f("NGMicrosyntaxKey",{name:S.source},S.span):null},{start:p.start,end:S?S.span.end:l.span.end})}else{let S=v(c);return f("NGMicrosyntaxAs",{key:f("NGMicrosyntaxKey",{name:S.source},S.span),alias:f("NGMicrosyntaxKey",{name:l.source},l.span)},{start:S.span.start,end:l.span.end})}}}function g(c){return G(c,e)}function f(c,x,l,p=!0){return{type:c,...Pe(l,e,p),...x}}function y(c){return Lt(c.slice(s.source.length))}function E(c){return c instanceof ne}function m(c){return c instanceof T}function o(c){u(c.key.span),m(c)&&c.value&&u(c.value.span)}function u(c){if(e.text[c.start]!=='"'&&e.text[c.start]!=="'")return;let x=e.text[c.start],l=!1;for(let p=c.start+1;p {let{ast:t,comments:s}=r(e),n=new ve(e),i=G(t,n);return i.comments=s.map(a=>G(a,n)),i}}var Kt=Re(yt),Ss=Re(Et),Bt=Re(At),Qe=Re(Ct),Tt=r=>bt($t(r),new ve(r));function Br(r){return Array.isArray(r)&&r.length>0}var _t=Br;function He(r){var s;let e=r.range?r.range[0]:r.start,t=((s=r.declaration)==null?void 0:s.decorators)??r.decorators;return _t(t)?Math.min(He(t[0]),e):e}function Mt(r){return r.range?r.range[1]:r.end}function Le(r){return{astFormat:"estree",parse(e){let t=r(e);return{type:"NGRoot",node:r===Qe&&t.type!=="NGChainedExpression"?{...t,type:"NGChainedExpression",expressions:[t]}:t}},locStart:He,locEnd:Mt}}var Tr=Le(Qe),_r=Le(Kt),Mr=Le(Bt),Fr=Le(Tt);var Os=qe;export{Os as default,ze as parsers}; +var Rt=Object.defineProperty;var ze=(r,e)=>{for(var t in e)Rt(r,t,{get:e[t],enumerable:!0})};var Qe={};ze(Qe,{parsers:()=>Ve});var Ve={};ze(Ve,{__ng_action:()=>Cr,__ng_binding:()=>Ar,__ng_directive:()=>Nr,__ng_interpolation:()=>Or});var G=class{constructor(e,t,s,n){this.input=t,this.errLocation=s,this.ctxLocation=n,this.message=`Parser Error: ${e} ${s} [${t}] in ${n}`}},P=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new I(e+this.start,e+this.end)}},w=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},W=class extends w{constructor(e,t,s){super(e,t),this.nameSpan=s}},$=class extends w{visit(e,t=null){}},L=class extends w{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},Se=class extends L{visit(e,t=null){var s;return(s=e.visitThisReceiver)==null?void 0:s.call(e,this,t)}},V=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitChain(this,t)}},Q=class extends w{constructor(e,t,s,n,i){super(e,t),this.condition=s,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},b=class extends W{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},H=class extends W{constructor(e,t,s,n,i,a){super(e,t,s),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},z=class extends W{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},q=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},j=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},X=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},Y=class extends W{constructor(e,t,s,n,i,a){super(e,t,a),this.exp=s,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},C=class extends w{constructor(e,t,s){super(e,t),this.value=s}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},Z=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitLiteralArray(this,t)}},J=class extends w{constructor(e,t,s,n){super(e,t),this.keys=s,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},me=class extends w{constructor(e,t,s,n){super(e,t),this.strings=s,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},A=class extends w{constructor(e,t,s,n,i){super(e,t),this.operation=s,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},B=class r extends A{static createMinus(e,t,s){return new r(e,t,"-",s,"-",new C(e,t,0),s)}static createPlus(e,t,s){return new r(e,t,"+",s,"-",s,new C(e,t,0))}constructor(e,t,s,n,i,a,h){super(e,t,i,a,h),this.operator=s,this.expr=n,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},ee=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitPrefixNot(this,t)}},te=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitNonNullAssert(this,t)}},re=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},se=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},I=class{constructor(e,t){this.start=e,this.end=t}},R=class extends w{constructor(e,t,s,n,i){super(new P(0,t===null?0:t.length),new I(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=s,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},T=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},ne=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},we=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let s of e)this.visit(s,t)}};var qe;(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.LITERAL_ATTR=1]="LITERAL_ATTR",r[r.ANIMATION=2]="ANIMATION",r[r.TWO_WAY=3]="TWO_WAY"})(qe||(qe={}));function je(r){return r>=9&&r<=32||r==160}function K(r){return 48<=r&&r<=57}function Xe(r){return r>=97&&r<=122||r>=65&&r<=90}function Pe(r){return r===39||r===34||r===96}var f;(function(r){r[r.Character=0]="Character",r[r.Identifier=1]="Identifier",r[r.PrivateIdentifier=2]="PrivateIdentifier",r[r.Keyword=3]="Keyword",r[r.String=4]="String",r[r.Operator=5]="Operator",r[r.Number=6]="Number",r[r.Error=7]="Error"})(f||(f={}));var ar=["var","let","as","null","undefined","true","false","if","else","this"],le=class{tokenize(e){let t=new be(e),s=[],n=t.scanToken();for(;n!=null;)s.push(n),n=t.scanToken();return s}},O=class{constructor(e,t,s,n,i){this.index=e,this.end=t,this.type=s,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==f.Character&&this.numValue==e}isNumber(){return this.type==f.Number}isString(){return this.type==f.String}isOperator(e){return this.type==f.Operator&&this.strValue==e}isIdentifier(){return this.type==f.Identifier}isPrivateIdentifier(){return this.type==f.PrivateIdentifier}isKeyword(){return this.type==f.Keyword}isKeywordLet(){return this.type==f.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==f.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==f.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==f.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==f.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==f.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==f.Keyword&&this.strValue=="this"}isError(){return this.type==f.Error}toNumber(){return this.type==f.Number?this.numValue:-1}toString(){switch(this.type){case f.Character:case f.Identifier:case f.Keyword:case f.Operator:case f.PrivateIdentifier:case f.String:case f.Error:return this.strValue;case f.Number:return this.numValue.toString();default:return null}}};function tt(r,e,t){return new O(r,e,f.Character,t,String.fromCharCode(t))}function or(r,e,t){return new O(r,e,f.Identifier,0,t)}function cr(r,e,t){return new O(r,e,f.PrivateIdentifier,0,t)}function hr(r,e,t){return new O(r,e,f.Keyword,0,t)}function Ke(r,e,t){return new O(r,e,f.Operator,0,t)}function pr(r,e,t){return new O(r,e,f.String,0,t)}function ur(r,e,t){return new O(r,e,f.Number,t,"")}function lr(r,e,t){return new O(r,e,f.Error,0,t)}var Ce=new O(-1,-1,f.Character,0,""),be=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,s=this.peek,n=this.index;for(;s<=32;)if(++n>=t){s=0;break}else s=e.charCodeAt(n);if(this.peek=s,this.index=n,n>=t)return null;if(rt(s))return this.scanIdentifier();if(K(s))return this.scanNumber(n);let i=n;switch(s){case 46:return this.advance(),K(this.peek)?this.scanNumber(i):tt(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,s);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(s));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;je(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(s)}]`,0)}scanCharacter(e,t){return this.advance(),tt(e,this.index,t)}scanOperator(e,t){return this.advance(),Ke(e,this.index,t)}scanComplexOperator(e,t,s,n,i,a){this.advance();let h=t;return this.peek==s&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),Ke(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();st(this.peek);)this.advance();let t=this.input.substring(e,this.index);return ar.indexOf(t)>-1?hr(e,this.index,t):or(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!rt(this.peek))return this.error("Invalid character [#]",-1);for(;st(this.peek);)this.advance();let t=this.input.substring(e,this.index);return cr(e,this.index,t)}scanNumber(e){let t=this.index===e,s=!1;for(this.advance();;){if(!K(this.peek))if(this.peek===95){if(!K(this.input.charCodeAt(this.index-1))||!K(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);s=!0}else if(this.peek===46)t=!1;else if(xr(this.peek)){if(this.advance(),dr(this.peek)&&this.advance(),!K(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);s&&(n=n.replace(/_/g,""));let i=t?vr(n):parseFloat(n);return ur(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let s="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){s+=i.substring(n,this.index);let h;if(this.advance(),this.peek==117){let g=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(g))h=parseInt(g,16);else return this.error(`Invalid unicode escape [\\u${g}]`,0);for(let d=0;d<5;d++)this.advance()}else h=fr(this.peek),this.advance();s+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),pr(e,this.index,s+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),Ke(e,this.index,t)}error(e,t){let s=this.index+t;return lr(s,this.index,`Lexer Error: ${e} at column ${s} in expression [${this.input}]`)}};function rt(r){return 97<=r&&r<=122||65<=r&&r<=90||r==95||r==36}function st(r){return Xe(r)||K(r)||r==95||r==36}function xr(r){return r==101||r==69}function dr(r){return r==45||r==43}function fr(r){switch(r){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return r}}function vr(r){let e=parseInt(r);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+r);return e}var gr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function ot(r,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${r}' to be an array, [start, end].`);if(e!=null){let t=e[0],s=e[1];gr.forEach(n=>{if(n.test(t)||n.test(s))throw new Error(`['${t}', '${s}'] contains unusable interpolation symbol.`)})}}var Te=class r{static fromArray(e){return e?(ot("interpolation",e),new r(e[0],e[1])):F}constructor(e,t){this.start=e,this.end=t}},F=new Te("{{","}}");var _e=class{constructor(e,t,s){this.strings=e,this.expressions=t,this.offsets=s}},Me=class{constructor(e,t,s){this.templateBindings=e,this.warnings=t,this.errors=s}},fe=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,s,n,i=F){this._checkNoInterpolation(e,s,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),g=1;t&&(g|=2);let d=new U(e,s,n,h,g,this.errors,0).parseChain();return new R(d,e,s,n,this.errors)}parseBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n);return new R(i,e,t,s,this.errors)}checkSimpleExpression(e){let t=new Fe;return e.visit(t),t.errors}parseSimpleBinding(e,t,s,n=F){let i=this._parseBindingAst(e,t,s,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new R(i,e,t,s,this.errors)}_reportError(e,t,s,n){this.errors.push(new G(e,t,s,n))}_parseBindingAst(e,t,s,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new U(e,t,s,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,s,n,i){let a=this._lexer.tokenize(t);return new U(t,s,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new I(n,n+e.length)})}parseInterpolation(e,t,s,n,i=F){let{strings:a,expressions:h,offsets:g}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let d=[];for(let y=0;y y.text),d,e,t,s)}parseInterpolationExpression(e,t,s){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new U(e,t,s,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,s)}createInterpolationAst(e,t,s,n,i){let a=new P(0,s.length),h=new me(a,a.toAbsolute(i),e,t);return new R(h,s,n,i,this.errors)}splitInterpolation(e,t,s,n=F){let i=[],a=[],h=[],g=s?Sr(s):null,d=0,y=!1,E=!1,{start:S,end:o}=n;for(;d -1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${s}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,s){for(let n of this._forEachUnquotedChar(e,s)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let s=null,n=0;for(let i=t;i =this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let s=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(s=t),e>s){let n=s;s=e,e=n}return new P(e,s)}sourceSpan(e,t){let s=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(s)||this.sourceSpanCache.set(s,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(s)}advance(){this.index++}withContext(e,t){this.context|=e;let s=t();return this.context^=e,s}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Ce?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index ":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new A(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==f.Operator;){let s=this.next.strValue;switch(s){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new A(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==f.Operator;){let s=this.next.strValue;switch(s){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new A(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parsePrefix(){if(this.next.type==f.Operator){let e=this.inputIndex,t=this.next.strValue,s;switch(t){case"+":return this.advance(),s=this.parsePrefix(),B.createPlus(this.span(e),this.sourceSpan(e),s);case"-":return this.advance(),s=this.parsePrefix(),B.createMinus(this.span(e),this.sourceSpan(e),s);case"!":return this.advance(),s=this.parsePrefix(),new ee(this.span(e),this.sourceSpan(e),s)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new te(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new C(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new C(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new C(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new C(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Se(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new Z(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new L(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new C(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new C(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new $(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new $(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new $(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),g=this.sourceSpan(n);t.push(new b(h,g,g,new L(h,g),a))}}while(this.consumeOptionalCharacter(44)&&!this.next.isCharacter(125));this.rbracesExpected--,this.expectCharacter(125)}return new J(this.span(s),this.sourceSpan(s),e,t)}parseAccessMember(e,t,s){let n=this.inputIndex,i=this.withContext(pe.Writable,()=>{let g=this.expectIdentifierOrKeyword()??"";return g.length===0&&this.error("Expected identifier for property access",e.span.end),g}),a=this.sourceSpan(n),h;if(s)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new $(this.span(t),this.sourceSpan(t))):h=new z(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new $(this.span(t),this.sourceSpan(t));let g=this.parseConditional();h=new H(this.span(t),this.sourceSpan(t),a,e,i,g)}else h=new b(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,s){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),g=this.sourceSpan(t);return s?new se(h,g,e,i,a):new re(h,g,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,s=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new I(s,s+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index {this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof $&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(s)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new X(this.span(t),this.sourceSpan(t),e,n,i)}else return s?new j(this.span(t),this.sourceSpan(t),e,n):new q(this.span(t),this.sourceSpan(t),e,n);return new $(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let s=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new I(e.span.start,n);return t.push(new ne(a,e,s)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Ce||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:s}=e.span,n=this.input.substring(t,s);return new R(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let s=new I(e.span.start,this.currentAbsoluteOffset);return new T(s,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new I(e,this.currentAbsoluteOffset);return new T(n,t,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new G(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e h+g.length,0);s+=a,t+=a}e.set(s,t),n++}return e}var ht="angular-estree-parser",De="NgEstreeParser",Ue=0,Ae=[ht,Ue];function pt(){return new fe(new le)}function Oe(r,e){let t=pt(),{astInput:s,comments:n}=wr(r,t),{ast:i,errors:a}=e(s,t);return vt(a),{ast:i,comments:n}}function ut(r){return Oe(r,(e,t)=>t.parseBinding(e,...Ae))}function lt(r){return Oe(r,(e,t)=>t.parseSimpleBinding(e,...Ae))}function xt(r){return Oe(r,(e,t)=>t.parseAction(e,!1,...Ae))}function dt(r){return Oe(r,(e,t)=>{let s=t.parseInterpolationExpression(e,...Ae);return s.ast=s.ast.expressions[0],s})}function ft(r){let e=pt(),{templateBindings:t,errors:s}=e.parseTemplateBindings(De,r,ht,Ue,Ue);return vt(s),t}function vt(r){if(r.length!==0){let[{message:e}]=r;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function wr(r,e){let t=e._commentStart(r);return t===null?{astInput:r,comments:[]}:{astInput:r.slice(0,t),comments:[{type:"Comment",value:r.slice(t+2),sourceSpan:{start:t,end:r.length}}]}}function gt(r){return r instanceof B?"Unary":r instanceof A?"Binary":r instanceof Y?"BindingPipe":r instanceof re?"Call":r instanceof V?"Chain":r instanceof Q?"Conditional":r instanceof $?"EmptyExpr":r instanceof L?"ImplicitReceiver":r instanceof q?"KeyedRead":r instanceof j?"SafeKeyedRead":r instanceof X?"KeyedWrite":r instanceof Z?"LiteralArray":r instanceof J?"LiteralMap":r instanceof C?"LiteralPrimitive":r instanceof te?"NonNullAssert":r instanceof ee?"PrefixNot":r instanceof b?"PropertyRead":r instanceof H?"PropertyWrite":r instanceof se?"SafeCall":r instanceof z?"SafePropertyRead":r.type}function ct({start:r,end:e},t){let s=r,n=e;for(;n!==s&&/\s/.test(t[n-1]);)n--;for(;s!==n&&/\s/.test(t[s]);)s++;return{start:s,end:n}}function yr({start:r,end:e},t){let s=r,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;s!==0&&/\s/.test(t[s-1]);)s--;return{start:s,end:n}}function Er(r,e){return e[r.start-1]==="("&&e[r.end]===")"?{start:r.start-1,end:r.end+1}:r}function St(r,e,t){let s=0,n={start:r.start,end:r.end};for(;;){let i=yr(n,e),a=Er(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,s++}return{hasParens:(t?s-1:s)!==0,outerSpan:ct(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:ct(r,e)}}function mt(r){return typeof r=="string"?e=>e===r:e=>r.test(e)}function wt(r,e,t){let s=mt(e);for(let n=t;n>=0;n--){let i=r[n];if(s(i))return n}throw new Error(`Cannot find front char ${e} from index ${t} in ${JSON.stringify(r)}`)}function yt(r,e,t){let s=mt(e);for(let n=t;n {if(!(r&&e==null))return Array.isArray(e)||typeof e=="string"?e[t<0?e.length+t:t]:e.at(t)},Ne=$r;var D=(r,e,t=!1)=>{let s=gt(r);switch(s){case"Unary":{let{operator:o,expr:u}=r,v=n(u);return a("UnaryExpression",{prefix:!0,argument:v,operator:o},r.sourceSpan,{hasParentParens:t})}case"Binary":{let{left:o,operation:u,right:v}=r,c=n(o),x=n(v);return a(u==="&&"||u==="||"||u==="??"?"LogicalExpression":"BinaryExpression",{left:c,right:x,operator:u},{start:E(c),end:S(x)},{hasParentParens:t})}case"BindingPipe":{let{exp:o,name:u,args:v}=r,c=n(o),x=e.getCharacterIndex(/\S/,e.getCharacterIndex("|",S(c))+1),l=a("Identifier",{name:u},{start:x,end:x+u.length}),p=v.map(n);return a("NGPipeExpression",{left:c,right:l,arguments:p},{start:E(c),end:S(p.length===0?l:Ne(!1,p,-1))},{hasParentParens:t})}case"Chain":{let{expressions:o}=r;return a("NGChainedExpression",{expressions:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"Comment":{let{value:o}=r;return a("CommentLine",{value:o},r.sourceSpan,{processSpan:!1})}case"Conditional":{let{condition:o,trueExp:u,falseExp:v}=r,c=n(o),x=n(u),l=n(v);return a("ConditionalExpression",{test:c,consequent:x,alternate:l},{start:E(c),end:S(l)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},r.sourceSpan,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},r.sourceSpan,{hasParentParens:t});case"KeyedRead":case"SafeKeyedRead":{let o=s==="SafeKeyedRead",{key:u}=r,v=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,c=n(u);return h(v,c,{computed:!0,optional:o},{end:r.sourceSpan.end,hasParentParens:t})}case"LiteralArray":{let{expressions:o}=r;return a("ArrayExpression",{elements:o.map(n)},r.sourceSpan,{hasParentParens:t})}case"LiteralMap":{let{keys:o,values:u}=r,v=u.map(x=>n(x)),c=o.map(({key:x,quoted:l},p)=>{let k=v[p],m=E(k),N=S(k),ue=e.getCharacterIndex(/\S/,p===0?r.sourceSpan.start+1:e.getCharacterIndex(",",S(v[p-1]))+1),It=m===ue?N:e.getCharacterLastIndex(/\S/,e.getCharacterLastIndex(":",m-1)-1)+1,He={start:ue,end:It},ge=l?a("StringLiteral",{value:x},He):a("Identifier",{name:x},He),kt=ge.end =o.sourceSpan.end||/^\s+$/.test(e.text.slice(o.sourceSpan.start,o.sourceSpan.end))}function d(o){return(o.type==="OptionalCallExpression"||o.type==="OptionalMemberExpression")&&!y(o)}function y(o){return o.extra&&o.extra.parenthesized}function E(o){return y(o)?o.extra.parenStart:o.start}function S(o){return y(o)?o.extra.parenEnd:o.end}};function Ie(r,e,t=!1,s=!1){if(!t){let{start:g,end:d}=r;return{start:g,end:d,range:[g,d]}}let{outerSpan:n,innerSpan:{start:i,end:a},hasParens:h}=St(r,e.text,s);return{start:i,end:a,range:[i,a],...h&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}function $t(r,e){r.forEach(o);let[t]=r,{key:s}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?r.slice(1):r,i=[],a=null;for(let c=0;c ({...N,...Ie({start:N.start,end:ue},e)}),k=N=>({...p(N,l.end),alias:l}),m=i.pop();if(m.type==="NGMicrosyntaxExpression")i.push(k(m));else if(m.type==="NGMicrosyntaxKeyedExpression"){let N=k(m.expression);i.push(p({...m,expression:N},N.end))}else throw new Error(`Unexpected type ${m.type}`)}else i.push(h(x,c));a=x}return d("NGMicrosyntax",{body:i},i.length===0?r[0].sourceSpan:{start:i[0].start,end:Ne(!1,i,-1).end});function h(c,x){if(E(c)){let{key:l,value:p}=c;return p?x===0?d("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan):d("NGMicrosyntaxKeyedExpression",{key:d("NGMicrosyntaxKey",{name:y(l.source)},l.span),expression:d("NGMicrosyntaxExpression",{expression:g(p.ast),alias:null},p.sourceSpan)},{start:l.span.start,end:p.sourceSpan.end}):d("NGMicrosyntaxKey",{name:y(l.source)},l.span)}else{let{key:l,sourceSpan:p}=c;if(/^let\s$/.test(e.text.slice(p.start,p.start+4))){let{value:m}=c;return d("NGMicrosyntaxLet",{key:d("NGMicrosyntaxKey",{name:l.source},l.span),value:m?d("NGMicrosyntaxKey",{name:m.source},m.span):null},{start:p.start,end:m?m.span.end:l.span.end})}else{let m=v(c);return d("NGMicrosyntaxAs",{key:d("NGMicrosyntaxKey",{name:m.source},m.span),alias:d("NGMicrosyntaxKey",{name:l.source},l.span)},{start:m.span.start,end:l.span.end})}}}function g(c){return D(c,e)}function d(c,x,l,p=!0){return{type:c,...Ie(l,e,p),...x}}function y(c){return Et(c.slice(s.source.length))}function E(c){return c instanceof ne}function S(c){return c instanceof T}function o(c){u(c.key.span),S(c)&&c.value&&u(c.value.span)}function u(c){if(e.text[c.start]!=='"'&&e.text[c.start]!=="'")return;let x=e.text[c.start],l=!1;for(let p=c.start+1;p