@shopify/create-hydrogen 5.0.34 → 5.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/hydrogen/routes/locale-check.ts +3 -3
- package/dist/assets/hydrogen/starter/CHANGELOG.md +22 -0
- package/dist/assets/hydrogen/starter/package.json +8 -9
- package/dist/assets/hydrogen/starter/vite.config.ts +9 -3
- package/dist/assets/hydrogen/vite/package.json +1 -2
- package/dist/assets/hydrogen/vite/vite.config.js +3 -2
- package/dist/create-app.js +2 -2
- package/dist/{morph-XDL3KZUY.js → morph-IMCMGX2W.js} +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {LoaderFunctionArgs} from '
|
|
1
|
+
import type {LoaderFunctionArgs} from 'react-router';
|
|
2
2
|
|
|
3
3
|
export async function loader({params, context}: LoaderFunctionArgs) {
|
|
4
4
|
const {language, country} = context.storefront.i18n;
|
|
@@ -7,8 +7,8 @@ export async function loader({params, context}: LoaderFunctionArgs) {
|
|
|
7
7
|
params.locale &&
|
|
8
8
|
params.locale.toLowerCase() !== `${language}-${country}`.toLowerCase()
|
|
9
9
|
) {
|
|
10
|
-
// If the locale URL param is defined, yet we
|
|
11
|
-
// then the
|
|
10
|
+
// If the locale URL param is defined, yet we are still at the default locale
|
|
11
|
+
// then the locale param must be invalid, send to the 404 page
|
|
12
12
|
throw new Response(null, {status: 404});
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# skeleton
|
|
2
2
|
|
|
3
|
+
## 2026.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add support for Vite 7 and Vite 8. Hydrogen remains backwards-compatible with Vite 5+. ([#3617](https://github.com/Shopify/hydrogen/pull/3617)) by [@frandiox](https://github.com/frandiox)
|
|
8
|
+
|
|
9
|
+
Mini Oxygen's dev server has been refactored to use the [Vite Environment API](https://vite.dev/guide/api-environment), which is the standard way to run non-browser runtimes in Vite. This replaces the previous custom middleware approach with a first-class `FetchableDevEnvironment`, improving compatibility with Vite's built-in HMR and module invalidation.
|
|
10
|
+
|
|
11
|
+
New Hydrogen projects created with `npm create @shopify/hydrogen` will default to Vite 8. The `vite-tsconfig-paths` plugin is no longer needed in the skeleton template since Vite 8 supports `resolve.tsconfigPaths` natively.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`dc49699c799997d5893bc06e444f888e86a3bc29`](https://github.com/Shopify/hydrogen/commit/dc49699c799997d5893bc06e444f888e86a3bc29), [`50df825c57159757529f5f9f62c258d4de2a4b97`](https://github.com/Shopify/hydrogen/commit/50df825c57159757529f5f9f62c258d4de2a4b97), [`51f1e77fe63be5e5ded4ef0c91942bc304f1abc4`](https://github.com/Shopify/hydrogen/commit/51f1e77fe63be5e5ded4ef0c91942bc304f1abc4)]:
|
|
14
|
+
- @shopify/hydrogen@2026.4.2
|
|
15
|
+
|
|
16
|
+
## 2026.4.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Fix `set-cookie-parser` and `cookie` resolution warnings during `dev` by using Vite's nested dependency syntax (`react-router > dep`). These are CJS transitive dependencies of `react-router` that weren't resolvable by bare name with strict package managers like pnpm. ([#3698](https://github.com/Shopify/hydrogen/pull/3698)) by [@fredericoo](https://github.com/fredericoo)
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`f84ab400c62d89827574d0fa65ba310a2e75f36f`](https://github.com/Shopify/hydrogen/commit/f84ab400c62d89827574d0fa65ba310a2e75f36f)]:
|
|
23
|
+
- @shopify/hydrogen@2026.4.1
|
|
24
|
+
|
|
3
25
|
## 2026.4.0
|
|
4
26
|
|
|
5
27
|
### Major Changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "skeleton",
|
|
3
3
|
"private": true,
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "2026.4.
|
|
5
|
+
"version": "2026.4.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "shopify hydrogen build --codegen",
|
|
@@ -14,25 +14,25 @@
|
|
|
14
14
|
},
|
|
15
15
|
"prettier": "@shopify/prettier-config",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@shopify/hydrogen": "2026.4.
|
|
17
|
+
"@shopify/hydrogen": "2026.4.2",
|
|
18
18
|
"graphql": "^16.10.0",
|
|
19
19
|
"graphql-tag": "^2.12.6",
|
|
20
20
|
"isbot": "^5.1.22",
|
|
21
21
|
"react": "^18.3.1",
|
|
22
22
|
"react-dom": "^18.3.1",
|
|
23
|
-
"react-router": "7.
|
|
24
|
-
"react-router-dom": "7.
|
|
23
|
+
"react-router": "7.14.0",
|
|
24
|
+
"react-router-dom": "7.14.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@eslint/compat": "^1.2.5",
|
|
28
28
|
"@eslint/eslintrc": "^3.2.0",
|
|
29
29
|
"@eslint/js": "^9.18.0",
|
|
30
30
|
"@graphql-codegen/cli": "5.0.2",
|
|
31
|
-
"@react-router/dev": "7.
|
|
32
|
-
"@react-router/fs-routes": "7.
|
|
31
|
+
"@react-router/dev": "7.14.0",
|
|
32
|
+
"@react-router/fs-routes": "7.14.0",
|
|
33
33
|
"@shopify/cli": "3.93.2",
|
|
34
34
|
"@shopify/hydrogen-codegen": "0.3.3",
|
|
35
|
-
"@shopify/mini-oxygen": "4.0
|
|
35
|
+
"@shopify/mini-oxygen": "4.1.0",
|
|
36
36
|
"@shopify/oxygen-workers-types": "^4.1.6",
|
|
37
37
|
"@shopify/prettier-config": "^1.1.2",
|
|
38
38
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
@@ -54,8 +54,7 @@
|
|
|
54
54
|
"graphql-config": "^5.0.3",
|
|
55
55
|
"prettier": "^3.4.2",
|
|
56
56
|
"typescript": "^5.9.2",
|
|
57
|
-
"vite": "^
|
|
58
|
-
"vite-tsconfig-paths": "^4.3.1"
|
|
57
|
+
"vite": "^8.0.1"
|
|
59
58
|
},
|
|
60
59
|
"engines": {
|
|
61
60
|
"node": "^22 || ^24"
|
|
@@ -2,10 +2,12 @@ import {defineConfig} from 'vite';
|
|
|
2
2
|
import {hydrogen} from '@shopify/hydrogen/vite';
|
|
3
3
|
import {oxygen} from '@shopify/mini-oxygen/vite';
|
|
4
4
|
import {reactRouter} from '@react-router/dev/vite';
|
|
5
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
6
5
|
|
|
7
6
|
export default defineConfig({
|
|
8
|
-
plugins: [hydrogen(), oxygen(), reactRouter()
|
|
7
|
+
plugins: [hydrogen(), oxygen(), reactRouter()],
|
|
8
|
+
resolve: {
|
|
9
|
+
tsconfigPaths: true,
|
|
10
|
+
},
|
|
9
11
|
build: {
|
|
10
12
|
// Allow a strict Content-Security-Policy
|
|
11
13
|
// without inlining assets as base64:
|
|
@@ -23,7 +25,11 @@ export default defineConfig({
|
|
|
23
25
|
* Include 'example-dep' in the array below.
|
|
24
26
|
* @see https://vitejs.dev/config/dep-optimization-options
|
|
25
27
|
*/
|
|
26
|
-
include: [
|
|
28
|
+
include: [
|
|
29
|
+
'react-router > set-cookie-parser',
|
|
30
|
+
'react-router > cookie',
|
|
31
|
+
'react-router',
|
|
32
|
+
],
|
|
27
33
|
},
|
|
28
34
|
},
|
|
29
35
|
server: {
|
|
@@ -2,9 +2,11 @@ import {defineConfig} from 'vite';
|
|
|
2
2
|
import {hydrogen} from '@shopify/hydrogen/vite';
|
|
3
3
|
import {oxygen} from '@shopify/mini-oxygen/vite';
|
|
4
4
|
import {vitePlugin as remix} from '@remix-run/dev';
|
|
5
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
6
5
|
|
|
7
6
|
export default defineConfig({
|
|
7
|
+
resolve: {
|
|
8
|
+
tsconfigPaths: true,
|
|
9
|
+
},
|
|
8
10
|
plugins: [
|
|
9
11
|
hydrogen(),
|
|
10
12
|
oxygen(),
|
|
@@ -17,7 +19,6 @@ export default defineConfig({
|
|
|
17
19
|
v3_routeConfig: false,
|
|
18
20
|
},
|
|
19
21
|
}),
|
|
20
|
-
tsconfigPaths(),
|
|
21
22
|
],
|
|
22
23
|
build: {
|
|
23
24
|
// Allow a strict Content-Security-Policy
|
package/dist/create-app.js
CHANGED
|
@@ -689,7 +689,7 @@ node_modules`),!r)return;let n=(0,_P.default)({allowRelativePaths:!0}).add(r);re
|
|
|
689
689
|
`)return!0;return!1}var YP=VP;function zP(e,t,r={}){return Ir(e,r.backwards?t-1:t,r)!==t}var KP=zP;function JP(e,t,r){return Hl(e,r(t))}function XP(e,t){return arguments.length===2||typeof t=="number"?Hl(e,t):JP(...arguments)}function QP(e,t,r){return Ol(e,r(t))}function ZP(e,t){return arguments.length===2||typeof t=="number"?Ol(e,t):QP(...arguments)}function eO(e,t,r){return ql(e,r(t))}function tO(e,t,r){let n=t==='"'?"'":'"',s=bu(0,e,/\\(.)|(["'])/gsu,(u,a,o)=>a===n?a:o===t?"\\"+o:o||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(a)?a:"\\"+a));return t+s+t}function rO(e,t){return arguments.length===2||typeof t=="number"?ql(e,t):eO(...arguments)}function xr(e,t=1){return async(...r)=>{let n=r[t]??{},{plugins:i=[]}=n;return r[t]={...n,plugins:(await Promise.all([og(),lg(i)])).flat()},e(...r)}}var Dg=xr(sg);async function xu(e,t){let{formatted:r}=await Dg(e,{...t,cursorOffset:-1});return r}async function nO(e,t){return await xu(e,t)===e}async function iO(){hB(),mP()}var sO=xr(Il,0),uO=xr((e,t)=>Tu(t,{physicalFile:e})),aO={errors:UD,optionCategories:ug,createIsIgnoredFunction:cg,formatOptionsHiddenDefaults:sl,normalizeOptions:Vm,getSupportInfoWithoutPlugins:Il,normalizeOptionSettings:Gm,inferParser:(e,t)=>Promise.resolve(t?.parser??uO(e,t)),vnopts:{ChoiceSchema:qD,apiDescriptor:ln},fastGlob:XS.default,createTwoFilesPatch:KS,picocolors:QS.default,closetLevenshteinMatch:LD,utilities:{omit:wP,createMockable:GD}},oO={parse:xr(wk),formatAST:xr(bk),formatDoc:xr(Sk),printToDoc:xr(Rk),printDocToString:xr(Tk),mockable:WD};import*as mg from"fs/promises";import*as gg from"path";var Ul={arrowParens:"always",singleQuote:!0,bracketSpacing:!1,trailingComma:"all"};async function Wt(e=process.cwd()){let t=(await mg.lstat(e)).isFile()?e:gg.resolve(e,"prettier.file");try{return await wu(t)||Ul}catch{return Ul}}async function Mr(e,t=Ul,r=""){let n=Ss(r);return xu(e,{parser:n===".tsx"||n===".ts"?"typescript":"babel",...t})}async function jr(e,t,r){let n=await r(await Pe(e));if(typeof n=="string")return t&&(n=await Mr(n,t,e)),Oe(e,n)}var cO=["tsx","ts","jsx","js","mjs","cjs"];async function _t(e,t,r=cO){let n=await lO(e);if(n.includes(t)){let i=Ue(e,t);if(!await Ls(i))return{filepath:i};for(let s of["ts","js"]){let u=Ue(e,`${t}/index.${s}`);if(await ge(Ue(e,u)))return{filepath:u,extension:s,astType:s}}}else for(let i of r){let s=`${t}.${i}`;if(n.includes(s)){let u=i==="mjs"||i==="cjs"?"js":i;return{filepath:Ue(e,s),extension:i,astType:u}}}return{}}var _g=Object.freeze(["dependencies","devDependencies","peerDependencies"]);async function ku(e,t,r){let n=await Do(te(t,"package.json")),i=await Do(te(e,"package.json")),s=new Set(["comment",...r?.ignoredKeys??[]]),u=Object.keys(i).filter(o=>!_g.includes(o));for(let o of u){if(s.has(o))continue;let l=i[o],c=n[o],f=Array.isArray(l)&&Array.isArray(c)?[...c,...l]:typeof l=="object"&&typeof c=="object"?{...c,...l}:l;n[o]=f}let a=Object.entries(n.dependencies||{}).find(([o])=>o.startsWith("@remix-run/"))?.[1];for(let o of _g)s.has(o)||i[o]&&(n[o]=[...new Set([...Object.keys(n[o]??{}),...Object.keys(i[o]??{})])].sort().reduce((l,c)=>{let f=i[o]?.[c]??n[o]?.[c];return c.startsWith("@remix-run/")&&a&&(f=a),l[c]=f,l},{}));await dd(t,r?.onResult?.(n)??n)}_();_();async function Mi(e){let t=await import("@ast-grep/napi");if(!(e in t))throw new Error(`Wrong language for AST: ${e}`);return t[e]}async function yg(e,t,r){let{filepath:n,astType:i}=await _t(e,"root");if(!n||!i)throw new ne(`Could not find root file in ${e}`);await jr(n,t,async s=>{let u=`import ${r.isDefault?r.name:`{${r.name}}`} from '${(r.isAbsolute?"":"./")+r.path}';`;if(s.includes(u.split("from")[0]))return;let o=(await Mi(i)).parse(s).root(),l=o.findAll({rule:{kind:"import_statement"}}).reverse(),c=l.find(D=>D.text().includes(".css"))||l.shift(),f=o.find({rule:{kind:"jsx_element",regex:"resetStyles",has:{kind:"jsx_opening_element",has:{kind:"identifier",pattern:"link"}}}});if(!c||!f)throw new ne('Could not find a "links" export in root file. Please add one and try again.');let h=c.text(),d=f.text(),p=r.isConditional?`{${r.name} && <link rel="stylesheet" href={${r.name}}></link>}`:`<link rel="stylesheet" href={${r.name}}></link>`;return s.replace(h,h+`
|
|
690
690
|
`+u).replace(d,p+`
|
|
691
691
|
`+d)})}async function Pu(e,t,r,n){let{filepath:i,astType:s}=await _t(e,"vite.config");if(!i||!s)throw new ne(`Could not find vite.config file in ${e}`);await jr(i,t,async u=>{let a=`import ${r.isDefault?r.name:`{${r.name}}`} from '${r.path}';`;if(new RegExp(`['"]${r.path.replace("/","\\/")}['"]`).test(u))return;let l=(await Mi(s)).parse(u).root(),c=l.findAll({rule:{kind:"import_statement"}}).pop(),f=l.find(fO);if(!c||!f)throw new ne('Could not find a "plugins" key in Vite config file. Please add one and try again.');let h=c.text(),d=f.text(),p=`${r.name}(${n?JSON.stringify(n):""})`;return u.replace(h,h+`
|
|
692
|
-
`+a).replace(d,d.replace("[",`[${p},`))})}var fO={rule:{pattern:"[$$$]",inside:{kind:"pair",stopBy:"neighbor",has:{field:"key",regex:"^plugins$",stopBy:"neighbor"},inside:{kind:"object",stopBy:"neighbor",all:[{inside:{kind:"export_statement",regex:"export default",stopBy:"end"}},{not:{inside:{kind:"object",stopBy:"end"}}}]}}}};var Eg="styles/tailwind.css";async function vg({rootDirectory:e,appDirectory:t},r=!1){let n=Mt(e,t),i={"tailwind.css":te(n,Eg)};if(!await op(i,t,r)){Os("Skipping CSS setup as some files already exist. You may use `--force` or `-f` to override it.");return}return{workPromise:Promise.all([ku(await Dt("tailwind"),e),ap("tailwind",i,e),Wt(e).then(u=>Promise.all([yg(t,u,{name:"tailwindCss",path:`${Eg}?url`,isDefault:!0}),Pu(e,u,{name:"tailwindcss",path:"@tailwindcss/vite",isDefault:!0})]))]),generatedAssets:Object.values(i),needsInstallDeps:!0}}_();async function Fg({rootDirectory:e}){return{workPromise:Promise.all([ku(await Dt("vanilla-extract"),e),Wt(e).then(r=>Pu(e,r,{path:"@vanilla-extract/vite-plugin",name:"vanillaExtractPlugin",isDefault:!1}))]),generatedAssets:[],needsInstallDeps:!0}}var Gn=[...up,"none"],ji={tailwind:"Tailwind v4","vanilla-extract":"Vanilla Extract","css-modules":"CSS Modules",postcss:"PostCSS"};function Cg(e,t,r){switch(e){case"tailwind":return vg(t,r);case"vanilla-extract":return Fg(t);case"postcss":case"css-modules":return{workPromise:Promise.resolve(),generatedAssets:[],needsInstallDeps:!1};default:throw new Error("Unknown strategy")}}async function Ag(e){let t=Object.entries({...ji,...e?.extraChoices});return St({message:"Select a styling library",...e,choices:t.map(([r,n])=>({value:r,label:n})),defaultValue:"tailwind"})}_();_();_();_();async function $r(e,t,r=!0){let{transpileTs:n}=await import("./morph-
|
|
692
|
+
`+a).replace(d,d.replace("[",`[${p},`))})}var fO={rule:{pattern:"[$$$]",inside:{kind:"pair",stopBy:"neighbor",has:{field:"key",regex:"^plugins$",stopBy:"neighbor"},inside:{kind:"object",stopBy:"neighbor",all:[{inside:{kind:"export_statement",regex:"export default",stopBy:"end"}},{not:{inside:{kind:"object",stopBy:"end"}}}]}}}};var Eg="styles/tailwind.css";async function vg({rootDirectory:e,appDirectory:t},r=!1){let n=Mt(e,t),i={"tailwind.css":te(n,Eg)};if(!await op(i,t,r)){Os("Skipping CSS setup as some files already exist. You may use `--force` or `-f` to override it.");return}return{workPromise:Promise.all([ku(await Dt("tailwind"),e),ap("tailwind",i,e),Wt(e).then(u=>Promise.all([yg(t,u,{name:"tailwindCss",path:`${Eg}?url`,isDefault:!0}),Pu(e,u,{name:"tailwindcss",path:"@tailwindcss/vite",isDefault:!0})]))]),generatedAssets:Object.values(i),needsInstallDeps:!0}}_();async function Fg({rootDirectory:e}){return{workPromise:Promise.all([ku(await Dt("vanilla-extract"),e),Wt(e).then(r=>Pu(e,r,{path:"@vanilla-extract/vite-plugin",name:"vanillaExtractPlugin",isDefault:!1}))]),generatedAssets:[],needsInstallDeps:!0}}var Gn=[...up,"none"],ji={tailwind:"Tailwind v4","vanilla-extract":"Vanilla Extract","css-modules":"CSS Modules",postcss:"PostCSS"};function Cg(e,t,r){switch(e){case"tailwind":return vg(t,r);case"vanilla-extract":return Fg(t);case"postcss":case"css-modules":return{workPromise:Promise.resolve(),generatedAssets:[],needsInstallDeps:!1};default:throw new Error("Unknown strategy")}}async function Ag(e){let t=Object.entries({...ji,...e?.extraChoices});return St({message:"Select a styling library",...e,choices:t.map(([r,n])=>({value:r,label:n})),defaultValue:"tailwind"})}_();_();_();_();async function $r(e,t,r=!0){let{transpileTs:n}=await import("./morph-IMCMGX2W.js");return n(e,t,r)}_();var wg={checkJs:!1,target:"ES2022",module:"ES2022",moduleResolution:"bundler",baseUrl:".",paths:{"~/*":["app/*"]}},hO=new Set(["noLib","target","module","moduleResolution","checkJs","experimentalDecorators","allowSyntheticDefaultImports","baseUrl","paths",...Object.keys(wg)]);function dO(e,t=!1){let r={compilerOptions:{...wg}};if(e.include&&(r.include=e.include.filter(n=>t||!n.endsWith(".d.ts")).map(n=>n.replace(/(?<!\.d)\.ts(x?)$/,".js$1"))),e.compilerOptions)for(let n of hO)e.compilerOptions[n]!==void 0&&(r.compilerOptions[n]=e.compilerOptions[n]);return r}async function Gl(e,t=!0){let r=te(e,"app/routes.ts");if(await ge(r)){let u=(await Pe(r)).replace("./layout.tsx","./layout.jsx");await Oe(r,u)}let n=await Gh("**/*.+(ts|tsx)",{absolute:!0,cwd:e,dot:!0,ignore:["**/node_modules/**"]}),i=await Wt();for(let s of n){if(s.endsWith(".d.ts")){t||await Is(s);continue}let u=await Pe(s),a=await Mr(await $r(u,s,t),i);await Is(s),await Oe(s.replace(/\.ts(x?)$/,".js$1"),a)}try{let s=te(e,"remix.config.js"),u=await Pe(s);u=u.replace(/\/server\.ts/gim,"/server.js"),await Oe(s,u)}catch(s){Te(`Could not change TS extensions in remix.config.js:
|
|
693
693
|
`+s.stack)}try{let s=te(e,"tsconfig.json"),u=await Pe(s),a=dO(JSON.parse(u.replace(/^\s*\/\/.*$/gm,"")),t);await Is(s),await Oe(te(e,"jsconfig.json"),JSON.stringify(a,null,2))}catch(s){Te(`Could not transpile tsconfig.json:
|
|
694
694
|
`+s.stack)}try{let s=JSON.parse(await Pe(te(e,"package.json")));delete s.scripts.typecheck;let u=/react-router typegen\s*&&\s*/g;for(let[a,o]of Object.entries(s.scripts||{}))typeof o=="string"&&o.includes("react-router typegen")&&(s.scripts[a]=o.replace(u,""));if(!t){delete s.devDependencies.typescript,delete s.devDependencies["@shopify/oxygen-workers-types"];for(let o of Object.keys(s.devDependencies))o.startsWith("@types/")&&delete s.devDependencies[o];let a=/\s*--codegen/;s.scripts?.dev&&(s.scripts.dev=s.scripts.dev.replace(a,"")),s.scripts?.build&&(s.scripts.build=s.scripts.build.replace(a,""))}await Oe(te(e,"package.json"),JSON.stringify(s,null,2))}catch(s){Te(`Could not remove TS dependencies from package.json:
|
|
695
695
|
`+s.stack)}try{let{filepath:s=te(e,".eslintrc.cjs")}=await _t(e,".eslintrc",["cjs","js"]),u=await Pe(s);t||(u=u.replace(/\/\*\*[\s*]+@type.+\s+\*\/\s?/gim,"")),u=u.replace(/\s*,?\s*['"`]plugin:hydrogen\/typescript['"`]/gim,"").replace(/\s+['"`]@typescript-eslint\/.+,/gim,""),await Oe(s,await Mr(u,i))}catch(s){Te(`Could not remove TS rules from .eslintrc:
|
|
@@ -792,7 +792,7 @@ $profileContent = Get-Content -Path $PROFILE
|
|
|
792
792
|
if (!$profileContent -or $profileContent -NotLike '*Invoke-Local-H2*') {
|
|
793
793
|
Add-Content -Path $PROFILE -Value '${IL}'
|
|
794
794
|
}
|
|
795
|
-
`;async function LL(){let e=[];return await fv(dv,"powershell.exe")&&e.push("PowerShell"),await fv(dv,"pwsh.exe")&&e.push("PowerShell 7+"),e}async function es(e=process.cwd(),t){if(await kL())return nt;let r="npx",n=t??await ho(e).catch(()=>null);return(n==="bun"||n==="pnpm"||n==="yarn")&&(r=n),`${r} shopify hydrogen`}_();import{readdir as wv}from"fs/promises";_();function _v(e){return e.replace(/(^|\.)_index$/,"$1index").replace(/\.(?!\w+\])/g,"/")}_();import{createRequire as cV}from"module";import hV from"path";import{readdir as pV}from"fs/promises";_();import{createRequire as KW}from"module";_();var yv="Classic Remix Compiler projects are no longer supported, please upgrade to Vite by running 'npx shopify hydrogen setup vite'";async function NL(e){return!!(await _t(e,"vite.config")).filepath}async function Ev(e){let t=await NL(e);return t&&await Fv(e)&&ft({headline:"Both Vite and Remix config files found.",body:"The remix.config.js file is not used in Vite projects. Please remove it to avoid conflicts."}),t}async function vv(e,t){let r=await nv(e),n="build",i=process.env.NODE_ENV||"production",s=await r.loadConfigFromFile({command:n,mode:i,isSsrBuild:!0},void 0,e);if(!s||!s.path)throw new Error("No Vite config found");let u=await r.resolveConfig({root:e,build:{ssr:!0}},n,i,i),{appDirectory:a,serverBuildFile:o,routes:l}=ML(u),c=u.build.outDir,f=c.replace(/server$/,"client"),h=u.build.rollupOptions.output,{entryFileNames:d}=(Array.isArray(h)?h[0]:h)??{},p=te(c,typeof d=="string"?d:o??"index.js"),D=t??u.build.ssr,w=Ue(u.root,typeof D=="string"?D:"server");return{clientOutDir:f,serverOutDir:c,serverOutFile:p,resolvedViteConfig:u,userViteConfig:s.config,remixConfig:{routes:l??{},appDirectory:a??te(u.root,"app"),rootDirectory:u.root,serverEntryPoint:(await _t(ze(w),Sn(w))).filepath||w}}}function ML(e){try{return jL(e)}catch{return $L(e)}}function jL(e){if(!e.__reactRouterPluginContext)throw new Error("Could not resolve React Router config");let{appDirectory:t,serverBuildFile:r,routes:n}=e.__reactRouterPluginContext.reactRouterConfig;return{appDirectory:t,serverBuildFile:r,routes:n}}function $L(e){let{remixConfig:t}=qL(e)?.api?.getPluginOptions()??{};return t?{appDirectory:t.appDirectory,serverBuildFile:t.serverBuildFile,routes:t.routes}:{}}function HL(e,t){return e.plugins.find(r=>r.name===t)}function qL(e){return HL(e,"hydrogen:main")}async function Fv(e){return!!(await _t(e,"remix.config")).filepath}async function Cv(e,t=process.env.NODE_ENV){if(!await Ev(e))throw new ne(yv);return(await vv(e)).remixConfig}var UL=[/robots\.txt/],cf={home:["_index","$"],page:"pages*",cart:["cart","cart.$lines","discount.$code"],products:"products*",collections:"collections*",policies:"policies*",blogs:"blogs*",account:"account*",search:["search","api.predictive-search"],robots:"[robots.txt]",sitemap:["[sitemap.xml]","sitemap.$type.$page[.xml]"]},lf=[];async function Av(e=Object.keys(cf)){lf.length===0&&(lf=(await wv(await Fi(vr))).map(n=>n.replace(/\.tsx?$/,"")));let t={},r=[];for(let n of e){t[n]=[];let i=cf[n];if(!i)throw new ne(`No route found for ${n}. Try one of ${GL.join()}.`);let s=Array.isArray(i)?i:[i];for(let u of s){let a=u.replace("*","");t[n].push(...lf.filter(o=>o.startsWith(a)))}r.push(...t[n])}return{routeGroups:t,resolvedRouteFiles:r}}var GL=[...Object.keys(cf),"all"];async function bv(e,t){let{routeGroups:r,resolvedRouteFiles:n}=e.routeName==="all"?await Av():await Av([e.routeName]),{rootDirectory:i,appDirectory:s}=t||await Cv(e.directory),u=n.flatMap(h=>vr+"/"+h),a=await Wt(i),o=te(s,vr),l=await WL(o,e),c=!!(e.typescript??await ge(te(i,"tsconfig.json"))),f=[];for(let h of u)f.push(await ff(h,{...e,typescript:c,localePrefix:l,rootDirectory:i,appDirectory:s,formatOptions:a}));return l&&await zL({typescript:c,localePrefix:l,routesDirectory:o,formatOptions:a,adapter:e.adapter}),{routes:f,routeGroups:r,isTypescript:c,formatOptions:a}}async function WL(e,{localePrefix:t,routeName:r,v1RouteConvention:n}){if(t)return t;if(t!==void 0||r==="all")return;let i=await wv(e).catch(()=>[]),s=n?/^\(\$(\w+)\)$/:/^\(\$(\w+)\)\.(_index|\$|cart).[jt]sx?$/,u=i.find(a=>s.test(a));if(u)return u.match(s)?.[1]}async function ff(e,{rootDirectory:t,appDirectory:r,typescript:n,force:i,adapter:s,templatesRoot:u,formatOptions:a,localePrefix:o,v1RouteConvention:l=!1,signal:c,overwriteFileDeps:f=!0}){u??=await Ci();let h=(e.match(/(\.[jt]sx?)$/)??[])[1]??".tsx";e=e.replace(h,"");let d=te(r,VL(e,o,{v1RouteConvention:l})+(n?h:h.replace(".ts",".js"))),p={operation:"created",sourceRoute:e,destinationRoute:Bh(d,t)};if(!i&&await ge(d)){if(!await gr({message:`The file ${p.destinationRoute} already exists. Do you want to replace it?`,defaultValue:!1,confirmationMessage:"Yes",cancellationMessage:"No",abortSignal:c}))return{...p,operation:"skipped"};p.operation="replaced"}let D=await Fi(e+h,u),w=await YL(D,await Fi("",u));for(let y of w){let g=y.startsWith(vr+"/")?d:te(r,y.replace(/\.ts(x?)$/,`.${n?"ts$1":"js$1"}`));if(!f&&await ge(g))continue;await ge(ze(g))||await yr(ze(g));let C=await Fi(y,u);if(!/\.[jt]sx?$/.test(y)){await _r(C,g);continue}let E=await Pe(C);n||(E=await $r(E,C)),s&&(E=Sv(E,s)),E=await Mr(E,a,g),await Oe(g,E)}return p}function Sv(e,t){return e.replace(
|
|
795
|
+
`;async function LL(){let e=[];return await fv(dv,"powershell.exe")&&e.push("PowerShell"),await fv(dv,"pwsh.exe")&&e.push("PowerShell 7+"),e}async function es(e=process.cwd(),t){if(await kL())return nt;let r="npx",n=t??await ho(e).catch(()=>null);return(n==="bun"||n==="pnpm"||n==="yarn")&&(r=n),`${r} shopify hydrogen`}_();import{readdir as wv}from"fs/promises";_();function _v(e){return e.replace(/(^|\.)_index$/,"$1index").replace(/\.(?!\w+\])/g,"/")}_();import{createRequire as cV}from"module";import hV from"path";import{readdir as pV}from"fs/promises";_();import{createRequire as KW}from"module";_();var yv="Classic Remix Compiler projects are no longer supported, please upgrade to Vite by running 'npx shopify hydrogen setup vite'";async function NL(e){return!!(await _t(e,"vite.config")).filepath}async function Ev(e){let t=await NL(e);return t&&await Fv(e)&&ft({headline:"Both Vite and Remix config files found.",body:"The remix.config.js file is not used in Vite projects. Please remove it to avoid conflicts."}),t}async function vv(e,t){let r=await nv(e),n="build",i=process.env.NODE_ENV||"production",s=await r.loadConfigFromFile({command:n,mode:i,isSsrBuild:!0},void 0,e);if(!s||!s.path)throw new Error("No Vite config found");let u=await r.resolveConfig({root:e,build:{ssr:!0}},n,i,i),{appDirectory:a,serverBuildFile:o,routes:l}=ML(u),c=u.build.outDir,f=c.replace(/server$/,"client"),h=u.build.rollupOptions.output,{entryFileNames:d}=(Array.isArray(h)?h[0]:h)??{},p=te(c,typeof d=="string"?d:o??"index.js"),D=t??u.build.ssr,w=Ue(u.root,typeof D=="string"?D:"server");return{clientOutDir:f,serverOutDir:c,serverOutFile:p,resolvedViteConfig:u,userViteConfig:s.config,remixConfig:{routes:l??{},appDirectory:a??te(u.root,"app"),rootDirectory:u.root,serverEntryPoint:(await _t(ze(w),Sn(w))).filepath||w}}}function ML(e){try{return jL(e)}catch{return $L(e)}}function jL(e){if(!e.__reactRouterPluginContext)throw new Error("Could not resolve React Router config");let{appDirectory:t,serverBuildFile:r,routes:n}=e.__reactRouterPluginContext.reactRouterConfig;return{appDirectory:t,serverBuildFile:r,routes:n}}function $L(e){let{remixConfig:t}=qL(e)?.api?.getPluginOptions()??{};return t?{appDirectory:t.appDirectory,serverBuildFile:t.serverBuildFile,routes:t.routes}:{}}function HL(e,t){return e.plugins.find(r=>r.name===t)}function qL(e){return HL(e,"hydrogen:main")}async function Fv(e){return!!(await _t(e,"remix.config")).filepath}async function Cv(e,t=process.env.NODE_ENV){if(!await Ev(e))throw new ne(yv);return(await vv(e)).remixConfig}var UL=[/robots\.txt/],cf={home:["_index","$"],page:"pages*",cart:["cart","cart.$lines","discount.$code"],products:"products*",collections:"collections*",policies:"policies*",blogs:"blogs*",account:"account*",search:["search","api.predictive-search"],robots:"[robots.txt]",sitemap:["[sitemap.xml]","sitemap.$type.$page[.xml]"]},lf=[];async function Av(e=Object.keys(cf)){lf.length===0&&(lf=(await wv(await Fi(vr))).map(n=>n.replace(/\.tsx?$/,"")));let t={},r=[];for(let n of e){t[n]=[];let i=cf[n];if(!i)throw new ne(`No route found for ${n}. Try one of ${GL.join()}.`);let s=Array.isArray(i)?i:[i];for(let u of s){let a=u.replace("*","");t[n].push(...lf.filter(o=>o.startsWith(a)))}r.push(...t[n])}return{routeGroups:t,resolvedRouteFiles:r}}var GL=[...Object.keys(cf),"all"];async function bv(e,t){let{routeGroups:r,resolvedRouteFiles:n}=e.routeName==="all"?await Av():await Av([e.routeName]),{rootDirectory:i,appDirectory:s}=t||await Cv(e.directory),u=n.flatMap(h=>vr+"/"+h),a=await Wt(i),o=te(s,vr),l=await WL(o,e),c=!!(e.typescript??await ge(te(i,"tsconfig.json"))),f=[];for(let h of u)f.push(await ff(h,{...e,typescript:c,localePrefix:l,rootDirectory:i,appDirectory:s,formatOptions:a}));return l&&await zL({typescript:c,localePrefix:l,routesDirectory:o,formatOptions:a,adapter:e.adapter}),{routes:f,routeGroups:r,isTypescript:c,formatOptions:a}}async function WL(e,{localePrefix:t,routeName:r,v1RouteConvention:n}){if(t)return t;if(t!==void 0||r==="all")return;let i=await wv(e).catch(()=>[]),s=n?/^\(\$(\w+)\)$/:/^\(\$(\w+)\)\.(_index|\$|cart).[jt]sx?$/,u=i.find(a=>s.test(a));if(u)return u.match(s)?.[1]}async function ff(e,{rootDirectory:t,appDirectory:r,typescript:n,force:i,adapter:s,templatesRoot:u,formatOptions:a,localePrefix:o,v1RouteConvention:l=!1,signal:c,overwriteFileDeps:f=!0}){u??=await Ci();let h=(e.match(/(\.[jt]sx?)$/)??[])[1]??".tsx";e=e.replace(h,"");let d=te(r,VL(e,o,{v1RouteConvention:l})+(n?h:h.replace(".ts",".js"))),p={operation:"created",sourceRoute:e,destinationRoute:Bh(d,t)};if(!i&&await ge(d)){if(!await gr({message:`The file ${p.destinationRoute} already exists. Do you want to replace it?`,defaultValue:!1,confirmationMessage:"Yes",cancellationMessage:"No",abortSignal:c}))return{...p,operation:"skipped"};p.operation="replaced"}let D=await Fi(e+h,u),w=await YL(D,await Fi("",u));for(let y of w){let g=y.startsWith(vr+"/")?d:te(r,y.replace(/\.ts(x?)$/,`.${n?"ts$1":"js$1"}`));if(!f&&await ge(g))continue;await ge(ze(g))||await yr(ze(g));let C=await Fi(y,u);if(!/\.[jt]sx?$/.test(y)){await _r(C,g);continue}let E=await Pe(C);n||(E=await $r(E,C)),s&&(E=Sv(E,s)),E=await Mr(E,a,g),await Oe(g,E)}return p}function Sv(e,t){return e.replace(/(from\s+['"])react-router(['"])/g,`$1${t}$2`)}function VL(e,t,r){let n=e.replace(vr+"/",""),i=t&&!UL.some(s=>s.test(n))?`($${t})`+(r.v1RouteConvention?"/":"."):"";return vr+"/"+i+(r.v1RouteConvention?_v(n):n)}async function YL(e,t){let r=new Set([e]),n=new Set([Mt(t,e)]);for(let i of r){let s=(await Pe(i,{encoding:"utf8"})).matchAll(/^(import|export)\s+.*?\s+from\s+['"](.*?)['"];?$/gims);for(let[,,u]of s){if(!u||!/^(\.|~)/.test(u)||(u=u.replace(/\?[a-z.]+$/,""),u=u.replace("~",Mt(ze(i),t)||"."),u.includes("/+types/")))continue;let a=Ue(ze(i),u),o=(await _t(ze(a),Sn(a))).filepath||a;o.includes(`/${vr}/`)||(n.add(Mt(t,o)),/\.[jt]sx?$/.test(o)&&r.add(o))}}return[...n]}function zL({typescript:e,localePrefix:t,...r}){return KL({...r,typescript:e,templateName:"locale-check.ts",routeName:`($${t})${e?".tsx":".jsx"}`})}async function KL({templateName:e,routeName:t,routesDirectory:r,formatOptions:n,typescript:i,adapter:s}){let u=te(r,t);if(await ge(u))return;let a=await Dt("routes",e);if(!await ge(a))throw new Error("Unknown strategy");let o=await Pe(a);s&&(o=Sv(o,s)),i||(o=await $r(o,a)),o=await Mr(o,n,u),await Oe(u,o)}_();_();var JL=[{pattern:"app is not installed",abort:["Hydrogen sales channel isn't installed","Install the Hydrogen sales channel on your store to start creating and linking Hydrogen storefronts: https://apps.shopify.com/hydrogen"]},{pattern:"Access denied for hydrogenStorefrontCreate field",abort:["Couldn't connect storefront to Shopify",["Common reasons for this error include:",{list:{items:["The Hydrogen sales channel isn't installed on the store.","You don't have the required account permission to manage apps or channels.","You're trying to connect to an ineligible store type (Trial, Development store)"]}}]]},{pattern:"Access denied for hydrogenStorefronts field",abort:["Couldn't access Hydrogen storefronts",["Common reasons for this error include:",{list:{items:["You don't have full access to apps or access to the Hydrogen channel.","The Hydrogen sales channel isn't installed on the store."]}}]]}];async function Zn(e,t,r){let n="Admin",i=`https://${t.storeFqdn}/admin/api/unstable/graphql.json`;try{return await Zi({query:e,api:n,url:i,token:t.token,variables:r})}catch(s){let u=s.errors;for(let{pattern:a,abort:o}of JL)if(u?.some?.(l=>l.message.includes(a)))throw new ne(...o);throw s}}_();var XL=/gid:\/\/shopify\/\w*\/(\d+)/;function Rv(e){let t=XL.exec(e);if(t&&t[1]!==void 0)return t[1];throw new ne(`Invalid Global ID: ${e}`)}var QL=`#graphql
|
|
796
796
|
query LinkStorefront {
|
|
797
797
|
hydrogenStorefronts {
|
|
798
798
|
id
|
|
@@ -30457,9 +30457,9 @@ Node text: ${this._forgottenText}`),new E.errors.InvalidOperationError(i)}return
|
|
|
30457
30457
|
`)}}function re(Ie){let at=E.ArrayUtils.groupBy(Ie,Ue=>Ue.getSpan().getStart()),We=0;for(let Ue of at){let Yt=Ue[0].getSpan().getStart()+We,Cn=Ue.map(Wn=>Wn.getNewText()).join("");r1t({sourceFile:P,insertPos:Yt,newText:Cn}),We+=Cn.length}}}applyTextChanges(i){return i.length===0?this:(this.forgetDescendants(),HI({sourceFile:this._sourceFile,start:0,replacingLength:this.getFullWidth(),newText:_ye(this,i)}),this)}set(i){return va(XH.prototype,this,i),this}getStructure(){return Ra(XH.prototype,this,{kind:$.StructureKind.SourceFile})}_refreshFromFileSystemInternal(i){if(i===!1)return this.forget(),$.FileSystemRefreshResult.Deleted;let u=i;return u===this.getFullText()?$.FileSystemRefreshResult.NoChange:(this.replaceText([0,this.getEnd()],u),this._setIsSaved(!0),$.FileSystemRefreshResult.Updated)}_isLibFileInMemory(){return this.compilerNode.fileName.startsWith(E.libFolderInMemoryPath)}_throwIfIsInMemoryLibFile(){if(this._isLibFileInMemory())throw new E.errors.InvalidOperationError("This operation is not permitted on an in memory lib folder file.")}_isInProject(){return this._context.inProjectCoordinator.isSourceFileInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markSourceFileAsInProject(this)}};xa([E.Memoize],iA.prototype,"isFromExternalLibrary",null);function Cge(y){for(let[i,u]of y)YT.isModuleSpecifierRelative(i.getLiteralText())&&i.setLiteralValue(i._sourceFile.getRelativePathAsModuleSpecifierTo(u))}function qBe(y){let i=y.getParentOrThrow(),u=i.getParent();return u!=null&&Ae.isImportEqualsDeclaration(u)?u:i}var AAt=y=>qI(ep(tx(nx(h_(y))))),$H=AAt(au),eq=class extends $H{getDeclarationList(){return this._getNodeFromCompilerNode(this.compilerNode.declarationList)}getDeclarations(){return this.getDeclarationList().getDeclarations()}getDeclarationKind(){return this.getDeclarationList().getDeclarationKind()}getDeclarationKindKeywords(){return this.getDeclarationList().getDeclarationKindKeywords()}setDeclarationKind(i){return this.getDeclarationList().setDeclarationKind(i)}addDeclaration(i){return this.getDeclarationList().addDeclaration(i)}addDeclarations(i){return this.getDeclarationList().addDeclarations(i)}insertDeclaration(i,u){return this.getDeclarationList().insertDeclaration(i,u)}insertDeclarations(i,u){return this.getDeclarationList().insertDeclarations(i,u)}set(i){if(va($H.prototype,this,i),i.declarationKind!=null&&this.setDeclarationKind(i.declarationKind),i.declarations!=null){let u=this.getDeclarations();this.addDeclarations(i.declarations),u.forEach(S=>S.remove())}return this}getStructure(){return Ra($H.prototype,this,{kind:$.StructureKind.VariableStatement,declarationKind:this.getDeclarationKind(),declarations:this.getDeclarations().map(i=>i.getStructure())})}},tze=Ef(UI),tq=class extends tze{},nze=Ef(au),nq=class extends nze{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}};function qR(y){return ep(rb(sS(lx(h_(y)))))}var DAt=y=>zf(k$(zR(qR(y)))),rze=DAt(Zd),rq=class extends rze{getEqualsGreaterThan(){return this._getNodeFromCompilerNode(this.compilerNode.equalsGreaterThanToken)}};function U$(y){return class extends y{getOverloads(){return XBe(this).filter(i=>i.isOverload())}getImplementation(){return this.isImplementation()?this:XBe(this).find(i=>i.isImplementation())}getImplementationOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getImplementation(),i??"Expected to find a corresponding implementation for the overload.",this)}isOverload(){return!this.isImplementation()}isImplementation(){return this.getBody()!=null}}}function XBe(y){let i=y.getParentOrThrow(),u=$Be(y),S=YBe(y),P=y.getKind();return i.forEachChildAsArray().filter(z=>$Be(z)===u&&z.getKind()===P&&YBe(z)===S)}function $Be(y){let i=y;if(i.getName instanceof Function)return i.getName()}function YBe(y){let i=y;return i.isStatic instanceof Function?i.isStatic():!1}function K$(y){if(y.structures.length===0)return[];let i=y.node.getParentSyntaxListOrThrow(),u=y.node.getImplementation()||y.node,S=y.node.getOverloads(),P=S.length,z=S.length>0?S[0].getChildIndex():u.getChildIndex(),re=Fd(y.index,P),Ie=z+re,at=y.getThisStructure(u),We=y.structures.map(Yt=>Object.assign(Object.assign({},at),Yt)),Ue=u._getWriterWithQueuedIndentation();for(let Yt of We)Ue.getLength()>0&&Ue.newLine(),y.printStructure(Ue,Yt);return Ue.newLine(),Ue.write(""),$o({parent:i,insertPos:(S[re]||u).getNonWhitespaceStart(),newText:Ue.toString()}),x5e(i.getChildren(),Ie,We.length,y.expectedSyntaxKind)}var IAt=y=>V$(zf(U$(VR(zR(HR(tx(nx(qR(qI(B$(y))))))))))),YH=IAt(au),CAt=y=>V$(zf(zR(HR(sS(tx(qI(ep(rb(nx(h_(y))))))))))),ize=CAt(au),iq=class extends YH{addOverload(i){return this.addOverloads([i])[0]}addOverloads(i){return this.insertOverloads(this.getOverloads().length,i)}insertOverload(i,u){return this.insertOverloads(i,[u])[0]}insertOverloads(i,u){let S=this.getName(),P=this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:this.isAmbient()});return K$({node:this,index:i,structures:u,printStructure:(z,re)=>{P.printOverload(z,S,re)},getThisStructure:Xxt,expectedSyntaxKind:E.SyntaxKind.FunctionDeclaration})}remove(){c1t(this)}set(i){return va(YH.prototype,this,i),i.overloads!=null&&(this.getOverloads().forEach(u=>u.remove()),this.addOverloads(i.overloads)),this}getStructure(){let i=this.isOverload(),u=this.getImplementation(),S=i&&u?ize.prototype:YH.prototype;return Ra(S,this,P(this));function P(z){if(u&&i)return re();return Ie();function re(){return{kind:$.StructureKind.FunctionOverload}}function Ie(){return u?{kind:$.StructureKind.Function,overloads:z.getOverloads().map(at=>at.getStructure())}:{kind:$.StructureKind.Function}}}}},NAt=y=>ep(zf(k$(zR(HR(lx(rb(sS(h_(B$(y)))))))))),oze=NAt(Gf),oq=class extends oze{},RAt=y=>C3(ax(UR(K5e(N3(h_(D3(sx(jR(W$(y)))))))))),QH=RAt(Ae),aq=class extends QH{isRestParameter(){return this.compilerNode.dotDotDotToken!=null}isParameterProperty(){return this.getScope()!=null||this.isReadonly()||this.hasOverrideKeyword()}setIsRestParameter(i){return this.isRestParameter()===i?this:(i?(GH(this),$o({insertPos:this.getNameNode().getStart(),parent:this,newText:"..."})):Xl({children:[this.getDotDotDotTokenOrThrow()]}),this)}isOptional(){return this.compilerNode.questionToken!=null||this.isRestParameter()||this.hasInitializer()}remove(){oS(this)}set(i){return va(QH.prototype,this,i),i.isRestParameter!=null&&this.setIsRestParameter(i.isRestParameter),this}getStructure(){return Ra(QH.prototype,this,{kind:$.StructureKind.Parameter,isRestParameter:this.isRestParameter()})}setHasQuestionToken(i){return i&&GH(this),super.setHasQuestionToken(i),this}setInitializer(i){return GH(this),super.setInitializer(i),this}setType(i){return GH(this),super.setType.call(this,i),this}};function GH(y){let i=y.getParentOrThrow();u()&&S();function u(){return Ae.isArrowFunction(i)&&i.compilerNode.parameters.length===1&&y.getParentSyntaxListOrThrow().getPreviousSiblingIfKind(E.SyntaxKind.OpenParenToken)==null}function S(){let P=y.getText();$o({parent:i,insertPos:y.getStart(),newText:`(${P})`,replacing:{textLength:P.length},customMappings:z=>[{currentNode:y,newNode:z.parameters[0]}]})}}var E0=class extends Ae{remove(){let i=this.getParentOrThrow();Ae.isClassDeclaration(i)||Ae.isClassExpression(i)?a1t(this):Ae.isObjectLiteralExpression(i)?oS(this):E.errors.throwNotImplementedForSyntaxKindError(i.getKind())}},PAt=y=>Kh(zf(C3(U$(VR(UR(JI(jI(ax(gk(zR(HR(qR(cA(y)))))))))))))),ZH=PAt(E0),MAt=y=>ep(Kh(zf(C3(jI(rb(JI(ax(gk(zR(h_(HR(sS(y))))))))))))),aze=MAt(E0),ck=class extends ZH{set(i){return va(ZH.prototype,this,i),i.overloads!=null&&(this.getOverloads().forEach(u=>u.remove()),this.addOverloads(i.overloads)),this}addOverload(i){return this.addOverloads([i])[0]}addOverloads(i){return this.insertOverloads(this.getOverloads().length,i)}insertOverload(i,u){return this.insertOverloads(i,[u])[0]}insertOverloads(i,u){let S=this.getName(),P=this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:Uy(this)});return K$({node:this,index:i,structures:u,printStructure:(z,re)=>{P.printOverload(z,S,re)},getThisStructure:$xt,expectedSyntaxKind:E.SyntaxKind.MethodDeclaration})}getStructure(){let i=this.getImplementation()!=null,u=this.isOverload(),S=u&&i?aze.prototype:ZH.prototype;return Ra(S,this,P(this));function P(z){if(i&&u)return re();return Ie();function re(){return{kind:$.StructureKind.MethodOverload}}function Ie(){return i?{kind:$.StructureKind.Method,overloads:z.getOverloads().map(at=>at.getStructure())}:{kind:$.StructureKind.Method}}}}};function Cye(y){return sze(B$(zf(G5e(Sye(JI(ep(rb(UR(h_(y))))))))))}function sze(y){return class extends y{setExtends(i){if(i=this._getTextWithQueuedChildIndentation(i),E.StringUtils.isNullOrWhitespace(i))return this.removeExtends();let u=this.getHeritageClauseByKind(E.SyntaxKind.ExtendsKeyword);if(u!=null){let S=u.getFirstChildByKindOrThrow(E.SyntaxKind.SyntaxList),P=S.getStart();$o({parent:u,newText:i,insertPos:P,replacing:{textLength:S.getEnd()-P}})}else{let S=this.getHeritageClauseByKind(E.SyntaxKind.ImplementsKeyword),P;S!=null?P=S.getStart():P=this.getFirstChildByKindOrThrow(E.SyntaxKind.OpenBraceToken).getStart();let z=/\s/.test(this.getSourceFile().getFullText()[P-1]),re=`extends ${i} `;z||(re=" "+re),$o({parent:S==null?this:S.getParentSyntaxListOrThrow(),insertPos:P,newText:re})}return this}removeExtends(){let i=this.getHeritageClauseByKind(E.SyntaxKind.ExtendsKeyword);return i==null?this:(i.removeExpression(0),this)}getExtendsOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getExtends(),i??`Expected to find the extends expression for the class ${this.getName()}.`,this)}getExtends(){let i=this.getHeritageClauseByKind(E.SyntaxKind.ExtendsKeyword);if(i==null)return;let u=i.getTypeNodes();return u.length===0?void 0:u[0]}addMembers(i){return this.insertMembers(Bf(this.getMembersWithComments()),i)}addMember(i){return this.insertMember(Bf(this.getMembersWithComments()),i)}insertMember(i,u){return this.insertMembers(i,[u])[0]}insertMembers(i,u){let S=Uy(this);return I5e({getIndexedChildren:()=>this.getMembersWithComments(),index:i,parent:this,write:(z,re)=>{let Ie=!S&&re.previousMember!=null&&Ae.isBodyable(re.previousMember)&&re.previousMember.hasBody(),at=!S&&u instanceof Array&&P(u[0]);Ie||re.previousMember!=null&&at?z.blankLineIfLastNot():z.newLineIfLastNot();let We=this._getWriter();this._context.structurePrinterFactory.forClassMember({isAmbient:S}).printTexts(We,u),z.write(We.toString());let Yt=!S&&u instanceof Array&&P(u[u.length-1]),Cn=!S&&re.nextMember!=null&&Ae.isBodyable(re.nextMember)&&re.nextMember.hasBody();re.nextMember!=null&&Yt||Cn?z.blankLineIfLastNot():z.newLineIfLastNot()}});function P(z){if(S||z==null||typeof z.kind!="number")return!1;let re=z;return i3.isMethod(re)||i3.isGetAccessor(re)||i3.isSetAccessor(re)||i3.isConstructor(re)}}addConstructor(i={}){return this.insertConstructor(Bf(this.getMembersWithComments()),i)}addConstructors(i){return this.insertConstructors(Bf(this.getMembersWithComments()),i)}insertConstructor(i,u={}){return this.insertConstructors(i,[u])[0]}insertConstructors(i,u){let S=Uy(this);return rk(this,{index:i,structures:u,expectedKind:E.SyntaxKind.Constructor,write:(P,z)=>{!S&&z.previousMember!=null&&!Ae.isCommentNode(z.previousMember)?P.blankLineIfLastNot():P.newLineIfLastNot(),this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:S}).printTexts(P,u),!S&&z.nextMember!=null?P.blankLineIfLastNot():P.newLineIfLastNot()}})}getConstructors(){return this.getMembers().filter(i=>Ae.isConstructorDeclaration(i))}addStaticBlock(i={}){return this.insertStaticBlock(Bf(this.getMembersWithComments()),i)}addStaticBlocks(i){return this.insertStaticBlocks(Bf(this.getMembersWithComments()),i)}insertStaticBlock(i,u={}){return this.insertStaticBlocks(i,[u])[0]}insertStaticBlocks(i,u){let S=Uy(this);return rk(this,{index:i,structures:u,expectedKind:E.SyntaxKind.ClassStaticBlockDeclaration,write:(P,z)=>{!S&&z.previousMember!=null&&!Ae.isCommentNode(z.previousMember)?P.blankLineIfLastNot():P.newLineIfLastNot(),this._context.structurePrinterFactory.forClassStaticBlockDeclaration().printTexts(P,u),!S&&z.nextMember!=null?P.blankLineIfLastNot():P.newLineIfLastNot()}})}getStaticBlocks(){return this.getMembers().filter(i=>Ae.isClassStaticBlockDeclaration(i))}addGetAccessor(i){return this.addGetAccessors([i])[0]}addGetAccessors(i){return this.insertGetAccessors(Bf(this.getMembersWithComments()),i)}insertGetAccessor(i,u){return this.insertGetAccessors(i,[u])[0]}insertGetAccessors(i,u){return rk(this,{index:i,structures:u,expectedKind:E.SyntaxKind.GetAccessor,write:(S,P)=>{P.previousMember!=null&&!Ae.isCommentNode(P.previousMember)?S.blankLineIfLastNot():S.newLineIfLastNot(),this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:Uy(this)}).printTexts(S,u),P.nextMember!=null?S.blankLineIfLastNot():S.newLineIfLastNot()}})}addSetAccessor(i){return this.addSetAccessors([i])[0]}addSetAccessors(i){return this.insertSetAccessors(Bf(this.getMembersWithComments()),i)}insertSetAccessor(i,u){return this.insertSetAccessors(i,[u])[0]}insertSetAccessors(i,u){return rk(this,{index:i,structures:u,expectedKind:E.SyntaxKind.SetAccessor,write:(S,P)=>{P.previousMember!=null&&!Ae.isCommentNode(P.previousMember)?S.blankLineIfLastNot():S.newLineIfLastNot(),this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:Uy(this)}).printTexts(S,u),P.nextMember!=null?S.blankLineIfLastNot():S.newLineIfLastNot()}})}addProperty(i){return this.addProperties([i])[0]}addProperties(i){return this.insertProperties(Bf(this.getMembersWithComments()),i)}insertProperty(i,u){return this.insertProperties(i,[u])[0]}insertProperties(i,u){return rk(this,{index:i,structures:u,expectedKind:E.SyntaxKind.PropertyDeclaration,write:(S,P)=>{P.previousMember!=null&&Ae.hasBody(P.previousMember)?S.blankLineIfLastNot():S.newLineIfLastNot(),this._context.structurePrinterFactory.forPropertyDeclaration().printTexts(S,u),P.nextMember!=null&&Ae.hasBody(P.nextMember)?S.blankLineIfLastNot():S.newLineIfLastNot()}})}addMethod(i){return this.addMethods([i])[0]}addMethods(i){return this.insertMethods(Bf(this.getMembersWithComments()),i)}insertMethod(i,u){return this.insertMethods(i,[u])[0]}insertMethods(i,u){let S=Uy(this);return u=u.map(P=>({...P})),rk(this,{index:i,write:(P,z)=>{!S&&z.previousMember!=null&&!Ae.isCommentNode(z.previousMember)?P.blankLineIfLastNot():P.newLineIfLastNot(),this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:S}).printTexts(P,u),!S&&z.nextMember!=null?P.blankLineIfLastNot():P.newLineIfLastNot()},structures:u,expectedKind:E.SyntaxKind.MethodDeclaration})}getInstanceProperty(i){return _p(this.getInstanceProperties(),i)}getInstancePropertyOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getInstanceProperty(i),()=>Od("class instance property",i))}getInstanceProperties(){return this.getInstanceMembers().filter(i=>e5e(i))}getStaticProperty(i){return _p(this.getStaticProperties(),i)}getStaticPropertyOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getStaticProperty(i),()=>Od("class static property",i))}getStaticProperties(){return this.getStaticMembers().filter(i=>e5e(i))}getProperty(i){return _p(this.getProperties(),i)}getPropertyOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getProperty(i),()=>Od("class property declaration",i))}getProperties(){return this.getMembers().filter(i=>Ae.isPropertyDeclaration(i))}getGetAccessor(i){return _p(this.getGetAccessors(),i)}getGetAccessorOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getGetAccessor(i),()=>Od("class getAccessor declaration",i))}getGetAccessors(){return this.getMembers().filter(i=>Ae.isGetAccessorDeclaration(i))}getSetAccessor(i){return _p(this.getSetAccessors(),i)}getSetAccessorOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getSetAccessor(i),()=>Od("class setAccessor declaration",i))}getSetAccessors(){return this.getMembers().filter(i=>Ae.isSetAccessorDeclaration(i))}getMethod(i){return _p(this.getMethods(),i)}getMethodOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getMethod(i),()=>Od("class method declaration",i))}getMethods(){return this.getMembers().filter(i=>Ae.isMethodDeclaration(i))}getInstanceMethod(i){return _p(this.getInstanceMethods(),i)}getInstanceMethodOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getInstanceMethod(i),()=>Od("class instance method",i))}getInstanceMethods(){return this.getInstanceMembers().filter(i=>i instanceof ck)}getStaticMethod(i){return _p(this.getStaticMethods(),i)}getStaticMethodOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getStaticMethod(i),()=>Od("class static method",i))}getStaticMethods(){return this.getStaticMembers().filter(i=>i instanceof ck)}getInstanceMember(i){return _p(this.getInstanceMembers(),i)}getInstanceMemberOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getInstanceMember(i),()=>Od("class instance member",i))}getInstanceMembers(){return this.getMembersWithParameterProperties().filter(i=>Ae.isConstructorDeclaration(i)?!1:Ae.isParameterDeclaration(i)||!i.isStatic())}getStaticMember(i){return _p(this.getStaticMembers(),i)}getStaticMemberOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getStaticMember(i),()=>Od("class static member",i))}getStaticMembers(){return this.getMembers().filter(i=>Ae.isConstructorDeclaration(i)?!1:!Ae.isParameterDeclaration(i)&&i.isStatic())}getMembersWithParameterProperties(){let i=this.getMembers(),u=i.filter(S=>Ae.isConstructorDeclaration(S)&&S.isImplementation());for(let S of u){let P=i.indexOf(S)+1;for(let z of S.getParameters())z.isParameterProperty()&&(i.splice(P,0,z),P++)}return i}getMembers(){return QBe(this,this.compilerNode.members).filter(i=>t5e(i))}getMembersWithComments(){let i=this.compilerNode,u=Am.getContainerArray(i,this.getSourceFile().compilerNode);return QBe(this,u).filter(S=>t5e(S)||Ae.isCommentClassElement(S))}getMember(i){return _p(this.getMembers(),i)}getMemberOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getMember(i),()=>Od("class member",i))}getBaseTypes(){return this.getType().getBaseTypes()}getBaseClassOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getBaseClass(),i??`Expected to find the base class of ${this.getName()}.`,this)}getBaseClass(){let u=this.getBaseTypes().map(S=>S.isIntersection()?S.getIntersectionTypes():[S]).flat().map(S=>S.getSymbol()).filter(S=>S!=null).map(S=>S.getDeclarations()).reduce((S,P)=>S.concat(P),[]).filter(S=>S.getKind()===E.SyntaxKind.ClassDeclaration);if(u.length===1)return u[0]}getDerivedClasses(){let i=ZBe(this);for(let u=0;u<i.length;u++){let S=ZBe(i[u]);for(let P of S)P!==this&&i.indexOf(P)===-1&&i.push(P)}return i}}}function QBe(y,i){let u=Uy(y),S=i.map(P=>y._getNodeFromCompilerNode(P));return u?S:S.filter(P=>!(Ae.isConstructorDeclaration(P)||Ae.isMethodDeclaration(P))||Ae.isMethodDeclaration(P)&&P.isAbstract()?!0:P.isImplementation())}function ZBe(y){let i=[],u=y.getNameNode();if(u==null)return i;for(let S of u.findReferencesAsNodes()){let P=S.getParentIfKind(E.SyntaxKind.ExpressionWithTypeArguments);if(P==null)continue;let z=P.getParentIfKind(E.SyntaxKind.HeritageClause);if(z==null||z.getToken()!==E.SyntaxKind.ExtendsKeyword)continue;let re=z.getParentIfKind(E.SyntaxKind.ClassDeclaration);re!=null&&i.push(re)}return i}function e5e(y){return Ae.isPropertyDeclaration(y)||Ae.isSetAccessorDeclaration(y)||Ae.isGetAccessorDeclaration(y)||Ae.isParameterDeclaration(y)}function t5e(y){return Ae.isMethodDeclaration(y)||Ae.isPropertyDeclaration(y)||Ae.isGetAccessorDeclaration(y)||Ae.isSetAccessorDeclaration(y)||Ae.isConstructorDeclaration(y)||Ae.isClassStaticBlockDeclaration(y)}function rk(y,i){return gye({getIndexedChildren:()=>y.getMembersWithComments(),parent:y,...i})}var LAt=y=>qI(tx(nx(Cye(y)))),ej=LAt(au),sq=class extends ej{set(i){return va(ej.prototype,this,i),i.extends!=null?this.setExtends(i.extends):i.hasOwnProperty(E.nameof(i,"extends"))&&this.removeExtends(),i.ctors!=null&&(this.getConstructors().forEach(u=>u.remove()),this.addConstructors(i.ctors)),i.properties!=null&&(this.getProperties().forEach(u=>u.remove()),this.addProperties(i.properties)),i.getAccessors!=null&&(this.getGetAccessors().forEach(u=>u.remove()),this.addGetAccessors(i.getAccessors)),i.setAccessors!=null&&(this.getSetAccessors().forEach(u=>u.remove()),this.addSetAccessors(i.setAccessors)),i.methods!=null&&(this.getMethods().forEach(u=>u.remove()),this.addMethods(i.methods)),this}getStructure(){let i=this.getExtends(),u=this.isAmbient();return Ra(ej.prototype,this,{kind:$.StructureKind.Class,ctors:this.getConstructors().filter(S=>u||!S.isOverload()).map(S=>S.getStructure()),methods:this.getMethods().filter(S=>u||!S.isOverload()).map(S=>S.getStructure()),properties:this.getProperties().map(S=>S.getStructure()),extends:i?i.getText():void 0,getAccessors:this.getGetAccessors().map(S=>S.getStructure()),setAccessors:this.getSetAccessors().map(S=>S.getStructure())})}extractInterface(i){let{constructors:u,properties:S,methods:P,accessors:z}=n5e(this,!1),re=u.map(Ie=>Ie.getParameters().filter(at=>at.isParameterProperty())).flat().filter(Ie=>Ie.getName()!=null&&Ie.getScope()===$.Scope.Public);return{kind:$.StructureKind.Interface,name:r5e(i,this),docs:this.getJsDocs().map(Ie=>Ie.getStructure()),typeParameters:this.getTypeParameters().map(Ie=>Ie.getStructure()),properties:[...re.map(Ie=>{let at=Ie.getParentOrThrow().getJsDocs().map(We=>We.getTags()).flat().filter(Ae.isJSDocParameterTag).filter(We=>We.getTagName()==="param"&&We.getName()===Ie.getName()&&We.getComment()!=null).map(We=>We.getCommentText().trim())[0];return{kind:$.StructureKind.PropertySignature,docs:at==null?[]:[{kind:$.StructureKind.JSDoc,description:at}],name:Ie.getName(),type:Ie.getType().getText(Ie),hasQuestionToken:Ie.hasQuestionToken(),isReadonly:Ie.isReadonly()}}),...S.map(i5e),...z.map(o5e)],methods:P.map(a5e)}}extractStaticInterface(i){let{constructors:u,properties:S,methods:P,accessors:z}=n5e(this,!0),re=r5e(void 0,this);return{kind:$.StructureKind.Interface,name:i,properties:[...S.map(i5e),...z.map(o5e)],methods:P.map(a5e),constructSignatures:u.map(Ie=>({kind:$.StructureKind.ConstructSignature,docs:Ie.getJsDocs().map(at=>at.getStructure()),parameters:Ie.getParameters().map(at=>({...lze(at),scope:void 0,isReadonly:!1})),returnType:re}))}}};function n5e(y,i){let u=y.getConstructors().map(re=>re.getOverloads().length>0?re.getOverloads():[re]).flat(),S=y.getProperties().filter(re=>re.isStatic()===i&&re.getScope()===$.Scope.Public),P=y.getMethods().filter(re=>re.isStatic()===i&&re.getScope()===$.Scope.Public).map(re=>re.getOverloads().length>0?re.getOverloads():[re]).flat();return{constructors:u,properties:S,methods:P,accessors:z()};function z(){let re=new E.KeyValueCache;for(let Ie of[...y.getGetAccessors(),...y.getSetAccessors()])Ie.isStatic()===i&&Ie.getScope()===$.Scope.Public&&re.getOrCreate(Ie.getName(),()=>[]).push(Ie);return re.getValuesAsArray()}}function r5e(y,i){return y=E.StringUtils.isNullOrWhitespace(y)?void 0:y,y||i.getName()||i.getSourceFile().getBaseNameWithoutExtension().replace(/[^a-zA-Z0-9_$]/g,"")}function i5e(y){return{kind:$.StructureKind.PropertySignature,docs:y.getJsDocs().map(i=>i.getStructure()),name:y.getName(),type:y.getType().getText(y),hasQuestionToken:y.hasQuestionToken(),isReadonly:y.isReadonly()}}function o5e(y){return{kind:$.StructureKind.PropertySignature,docs:y[0].getJsDocs().map(i=>i.getStructure()),name:y[0].getName(),type:y[0].getType().getText(y[0]),hasQuestionToken:!1,isReadonly:y.every(Ae.isGetAccessorDeclaration)}}function a5e(y){return{kind:$.StructureKind.MethodSignature,docs:y.getJsDocs().map(i=>i.getStructure()),name:y.getName(),hasQuestionToken:y.hasQuestionToken(),returnType:y.getReturnType().getText(y),parameters:y.getParameters().map(lze),typeParameters:y.getTypeParameters().map(i=>i.getStructure())}}function lze(y){return{...y.getStructure(),decorators:[]}}var cze=Cye(Gf),lq=class extends cze{},kAt=y=>Kh(zf(lx(ep(k$(y))))),tj=kAt(E0),cq=class extends tj{getName(){return"static"}isStatic(){return!0}set(i){return va(tj.prototype,this,i),this}getStructure(){return Ra(tj.prototype,this,{kind:$.StructureKind.ClassStaticBlock})}},uq=class extends E0{},wAt=y=>ix(Kh(zf(U$(jI(qR(VR(y))))))),nj=wAt(E0),OAt=y=>rb(ep(Kh(zf(jI(h_(sS(y))))))),uze=OAt(E0),dq=class extends nj{set(i){return va(nj.prototype,this,i),i.overloads!=null&&(this.getOverloads().forEach(u=>u.remove()),this.addOverloads(i.overloads)),this}addOverload(i){return this.addOverloads([i])[0]}addOverloads(i){return this.insertOverloads(this.getOverloads().length,i)}insertOverload(i,u){return this.insertOverloads(i,[u])[0]}insertOverloads(i,u){let S=this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:Uy(this)});return K$({node:this,index:i,structures:u,printStructure:(P,z)=>{S.printOverload(P,z)},getThisStructure:qxt,expectedSyntaxKind:E.SyntaxKind.Constructor})}getStructure(){let i=this.getImplementation()!=null,u=this.isOverload(),S=u&&i?uze.prototype:nj.prototype;return Ra(S,this,P(this));function P(z){if(i&&u)return re();return Ie();function re(){return{kind:$.StructureKind.ConstructorOverload}}function Ie(){return i?{kind:$.StructureKind.Constructor,overloads:z.getOverloads().map(at=>at.getStructure())}:{kind:$.StructureKind.Constructor}}}}},FAt=y=>Kh(zf(UR(JI(jI(gk(qR(VR(cA(y))))))))),rj=FAt(E0),pq=class extends rj{set(i){return va(rj.prototype,this,i),this}getSetAccessor(){let i=this.getName(),u=this.isStatic();return this.getParentOrThrow().forEachChild(S=>{if(Ae.isSetAccessorDeclaration(S)&&S.getName()===i&&S.isStatic()===u)return S})}getSetAccessorOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getSetAccessor(),i??(()=>`Expected to find a corresponding set accessor for ${this.getName()}.`),this)}getStructure(){return Ra(rj.prototype,this,{kind:$.StructureKind.GetAccessor})}},WAt=y=>Kh(C3(tx(UR(JI(jI(gk(ep(N3(vye(ax(jR(sx(cA(h_(y))))))))))))))),ij=WAt(E0),fq=class extends ij{hasAccessorKeyword(){return this.hasModifier(E.SyntaxKind.AccessorKeyword)}setHasAccessorKeyword(i){return this.toggleModifier("accessor",i)}set(i){return va(ij.prototype,this,i),i.hasAccessorKeyword!=null&&this.setHasAccessorKeyword(i.hasAccessorKeyword),this}remove(){let i=this.getParentOrThrow();if(i.getKind()===E.SyntaxKind.ClassDeclaration)super.remove();else throw new E.errors.NotImplementedError(`Not implemented parent syntax kind: ${i.getKindName()}`)}getStructure(){return Ra(ij.prototype,this,{kind:$.StructureKind.Property,hasAccessorKeyword:this.hasAccessorKeyword()})}},BAt=y=>Kh(zf(UR(JI(jI(gk(qR(VR(cA(y))))))))),oj=BAt(E0),_q=class extends oj{set(i){return va(oj.prototype,this,i),this}getGetAccessor(){let i=this.getName(),u=this.isStatic();return this.getParentOrThrow().forEachChild(S=>{if(Ae.isGetAccessorDeclaration(S)&&S.getName()===i&&S.isStatic()===u)return S})}getGetAccessorOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getGetAccessor(),i??(()=>`Expected to find a corresponding get accessor for ${this.getName()}.`),this)}getStructure(){return Ra(oj.prototype,this,{kind:$.StructureKind.SetAccessor})}},aj=JR(Ae),mq=class extends aj{getName(){return this.getNameNode().getText()}getNameNode(){let i=this.getCallExpression();if(i)return u(i.getExpression());return u(this._getInnerExpression());function u(P){let z=S(P);if(!Ae.isIdentifier(z))throw new E.errors.NotImplementedError(`Expected the decorator expression '${z.getText()}' to be an identifier. Please deal directly with 'getExpression()' on the decorator to handle more complex scenarios.`);return z}function S(P){return Ae.isPropertyAccessExpression(P)?P.getNameNode():P}}getFullName(){let i=this.getSourceFile();return this.isDecoratorFactory()?this.getCallExpression().getExpression().getText():this.compilerNode.expression.getText(i.compilerNode)}isDecoratorFactory(){return Ae.isCallExpression(this._getInnerExpression())}setIsDecoratorFactory(i){if(this.isDecoratorFactory()===i)return this;if(i){let u=this._getInnerExpression(),S=u.getText();$o({parent:this,insertPos:u.getStart(),newText:`${S}()`,replacing:{textLength:S.length},customMappings:P=>[{currentNode:u,newNode:P.expression.expression}]})}else{let u=this.getCallExpressionOrThrow(),S=u.getExpression(),P=S.getText();$o({parent:this,insertPos:u.getStart(),newText:`${P}`,replacing:{textLength:u.getWidth()},customMappings:z=>[{currentNode:S,newNode:z.expression}]})}return this}getCallExpressionOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getCallExpression(),i??"Expected to find a call expression.",this)}getCallExpression(){let i=this._getInnerExpression();return Ae.isCallExpression(i)?i:void 0}getArguments(){var i,u;return(u=(i=this.getCallExpression())===null||i===void 0?void 0:i.getArguments())!==null&&u!==void 0?u:[]}getTypeArguments(){var i,u;return(u=(i=this.getCallExpression())===null||i===void 0?void 0:i.getTypeArguments())!==null&&u!==void 0?u:[]}addTypeArgument(i){return this.getCallExpressionOrThrow().addTypeArgument(i)}addTypeArguments(i){return this.getCallExpressionOrThrow().addTypeArguments(i)}insertTypeArgument(i,u){return this.getCallExpressionOrThrow().insertTypeArgument(i,u)}insertTypeArguments(i,u){return this.getCallExpressionOrThrow().insertTypeArguments(i,u)}removeTypeArgument(i){let u=this.getCallExpression();if(u==null)throw new E.errors.InvalidOperationError("Cannot remove a type argument from a decorator that has no type arguments.");return u.removeTypeArgument(i),this}addArgument(i){return this.addArguments([i])[0]}addArguments(i){return this.insertArguments(this.getArguments().length,i)}insertArgument(i,u){return this.insertArguments(i,[u])[0]}insertArguments(i,u){return this.setIsDecoratorFactory(!0),this.getCallExpressionOrThrow().insertArguments(i,u)}removeArgument(i){let u=this.getCallExpression();if(u==null)throw new E.errors.InvalidOperationError("Cannot remove an argument from a decorator that has no arguments.");return u.removeArgument(i),this}remove(){let i=this.getStartLinePos(),u=this.getPreviousSiblingIfKind(E.SyntaxKind.Decorator);u!=null&&u.getStartLinePos()===i?Xl({children:[this],removePrecedingSpaces:!0}):o1t({children:[this],getSiblingFormatting:(S,P)=>P.getStartLinePos()===i?$c.Space:$c.Newline})}_getInnerExpression(){let i=this.getExpression();for(;Ae.isParenthesizedExpression(i);)i=i.getExpression();return i}set(i){return va(aj.prototype,this,i),i.name!=null&&this.getNameNode().replaceWithText(i.name),i.arguments!=null&&(this.setIsDecoratorFactory(!0),this.getArguments().map(u=>this.removeArgument(u)),this.addArguments(i.arguments)),i.typeArguments!=null&&i.typeArguments.length>0&&(this.setIsDecoratorFactory(!0),this.getTypeArguments().map(u=>this.removeTypeArgument(u)),this.addTypeArguments(i.typeArguments)),this}getStructure(){let i=this.isDecoratorFactory();return Ra(aj.prototype,this,{kind:$.StructureKind.Decorator,name:this.getName(),arguments:i?this.getArguments().map(u=>u.getText()):void 0,typeArguments:i?this.getTypeArguments().map(u=>u.getText()):void 0})}};function Nye(y){return class extends y{getTypeExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}getTypeExpressionOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getTypeExpression(),i??"Expected to find a JS doc type expression.",this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}isBracketed(){return this.compilerNode.isBracketed}}}function XR(y){return class extends y{getTypeExpression(){let i=this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression);if(!(i!=null&&i.getWidth()===0))return i}getTypeExpressionOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getTypeExpression(),i??"Expected to find the JS doc tag's type expression.",this)}}}function dze(y){return class extends y{getTypeParameters(){return this.compilerNode.typeParameters.map(i=>this._getNodeFromCompilerNode(i)).filter(i=>i.getWidth()>0)}}}function iye(y){return y.replace(/^\/\*\*[^\S\n]*\n?/,"").replace(/(\r?\n)?[^\S\n]*\*\/$/,"").split(/\n/).map(S=>{let P=u(S);if(P===-1)return S;let z=S[P+1]===" "?P+2:P+1;return S.substring(z)}).join(`
|
|
30458
30458
|
`);function u(S){for(let P=0;P<S.length;P++){let z=S.charCodeAt(P);if(z===mp.ASTERISK)return P;if(!E.StringUtils.isWhitespaceCharCode(z))break}return-1}}var sj=Ae,gq=class extends sj{isMultiLine(){return this.getText().includes(`
|
|
30459
30459
|
`)}getTags(){var i,u;return(u=(i=this.compilerNode.tags)===null||i===void 0?void 0:i.map(S=>this._getNodeFromCompilerNode(S)))!==null&&u!==void 0?u:[]}getInnerText(){return iye(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(i=>this._getNodeFromCompilerNodeIfExists(i))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:E.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){var i,u;let S=this.getSourceFile().getFullText(),P=(u=(i=this.getTags()[0])===null||i===void 0?void 0:i.getStart())!==null&&u!==void 0?u:this.getEnd()-2,z=re(this);return iye(S.substring(z,Math.max(z,Ie())));function re(at){let We=at.getStart()+3;return S.charCodeAt(We)===mp.SPACE?We+1:We}function Ie(){let at=nS(S,P,We=>We===mp.NEWLINE||!E.StringUtils.isWhitespaceCharCode(We)&&We!==mp.ASTERISK);return nS(S,at,We=>We!==mp.NEWLINE&&We!==mp.CARRIAGE_RETURN)}}setDescription(i){let u=this.getTags(),S=this.getStart()+3,P=u.length>0?nS(this._sourceFile.getFullText(),u[0].getStart(),re=>re===mp.ASTERISK)-1:this.getEnd()-2;return f1t({parent:this,newText:z.call(this),replacePos:S,replacingLength:P-S}),this;function z(){var re,Ie;let at=this.getIndentationText(),We=this._context.manipulationSettings.getNewLineKindAsString(),Ue=S0(this._getWriter(),i).split(/\r?\n/),Yt=Ue[0].length===0,Cn=Ue.length===1&&((Ie=(re=this.compilerNode.tags)===null||re===void 0?void 0:re.length)!==null&&Ie!==void 0?Ie:0)===0,Wn=Cn?Ue[0]:Ue.map(zr=>zr.length===0?`${at} *`:`${at} * ${zr}`).slice(Yt?1:0).join(We);return Cn?" "+Wn+" ":We+Wn+We+at+" "}}addTag(i){return this.addTags([i])[0]}addTags(i){var u,S;return this.insertTags((S=(u=this.compilerNode.tags)===null||u===void 0?void 0:u.length)!==null&&S!==void 0?S:0,i)}insertTag(i,u){return this.insertTags(i,[u])[0]}insertTags(i,u){if(E.ArrayUtils.isNullOrEmpty(u))return[];let S=this._getWriterWithQueuedIndentation(),P=this.getTags();if(i=Fd(i,P.length),P.length===0&&!this.isMultiLine()){let Ie=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(at=>{Ie.printText(at,{description:this.getDescription(),tags:u})})}else{let Ie=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});S.newLine().write(" * "),Ie.printTexts(S,u),S.newLine().write(" *"),S.conditionalWrite(i<P.length," ");let at=z.call(this),We=re.call(this);$o({parent:this,insertPos:at,replacing:{textLength:We-at},newText:S.toString()})}return X_(P,this.getTags(),i,!1);function z(){let Ie=i<P.length?P[i].getStart():this.getEnd()-2,at=this.getStart()+3;return Math.max(at,nS(this.getSourceFile().getFullText(),Ie,We=>!E.StringUtils.isWhitespaceCharCode(We)&&We!==mp.ASTERISK))}function re(){return i<P.length?P[i].getStart():this.getEnd()-1}}remove(){Xl({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(i){return va(sj.prototype,this,i),i.tags!=null?this.replaceWithText(u=>{var S;this._context.structurePrinterFactory.forJSDoc().printText(u,{description:(S=i.description)!==null&&S!==void 0?S:this.getDescription(),tags:i.tags})}):(i.description!=null&&this.setDescription(i.description),this)}getStructure(){return Ra(sj.prototype,this,{kind:$.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(i=>i.getStructure())})}},Op=class extends Ae{},pze=z$(Op),WR=class extends pze{},hq=class extends Op{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},yq=class extends Op{getCheckType(){return this._getNodeFromCompilerNode(this.compilerNode.checkType)}getExtendsType(){return this._getNodeFromCompilerNode(this.compilerNode.extendsType)}getTrueType(){return this._getNodeFromCompilerNode(this.compilerNode.trueType)}getFalseType(){return this._getNodeFromCompilerNode(this.compilerNode.falseType)}},fze=sS(Op),p3=class extends fze{},_ze=JI(h_(p3)),vq=class extends _ze{},mze=JR(WR),bq=class extends mze{},gze=rb(p3),Eq=class extends gze{},Sq=class extends Ae{getAssertClause(){return this._getNodeFromCompilerNode(this.compilerNode.assertClause)}isMultiline(){var i;return(i=this.compilerNode.multiLine)!==null&&i!==void 0?i:!1}},Tq=class extends WR{setArgument(i){let u=this.getArgument();if(Ae.isLiteralTypeNode(u)){let S=u.getLiteral();if(Ae.isStringLiteral(S))return S.setLiteralValue(i),this}return u.replaceWithText(S=>S.quote(i),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(i){let u=this.getQualifier();if(u!=null)u.replaceWithText(i,this._getWriterWithQueuedChildIndentation());else{let S=this.getFirstChildByKindOrThrow(E.SyntaxKind.CloseParenToken);$o({insertPos:S.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(i).toString()})}return this}getQualifierOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getQualifier(),i??(()=>`Expected to find a qualifier for the import type: ${this.getText()}`),this)}getQualifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.qualifier)}getAssertions(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions)}getAssertionsOrThrow(i){return E.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions),i??"Could not find import type assertion container.",this)}},xq=class extends Op{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Aq=class extends Op{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Dq=class extends Op{getTypeNodes(){return this.compilerNode.types.map(i=>this._getNodeFromCompilerNode(i))}},Iq=class extends Op{getLiteral(){let i=this.compilerNode.literal;return this._getNodeFromCompilerNode(i)}},Cq=class extends Op{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getNameTypeNode(),i??"Type did not exist.",this)}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getReadonlyToken(),i??"Readonly token did not exist.",this)}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getQuestionToken(),i??"Question token did not exist.",this)}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getTypeNode(),i??"Type did not exist, but was expected to exist.",this)}},GAt=y=>sx(ax(D3(ep(ox(y))))),hze=GAt(Op),Nq=class extends hze{getTypeNode(){return super.getTypeNode()}removeType(){throw new E.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},Rq=class extends Op{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(i){return this.getTypeNode().replaceWithText(i),this}},Pq=class extends Op{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},Mq=class extends Op{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(i=>this._getNodeFromCompilerNode(i))}setLiteralValue(i){var u;let S=this.getChildIndex(),P=(u=this.getParentSyntaxList())!==null&&u!==void 0?u:this.getParentOrThrow();return HI({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:i}),P.getChildAtIndex(S)}},Lq=class extends Op{},kq=class extends Op{getElements(){return this.compilerNode.elements.map(i=>this._getNodeFromCompilerNode(i))}},zAt=y=>rb(sx(ep(tx(nx(h_(ox(y))))))),lj=zAt(au),wq=class extends lj{set(i){return va(lj.prototype,this,i),this}getStructure(){return Ra(lj.prototype,this,{kind:$.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},yze=Dye(Op),Oq=class extends yze{},Fq=class extends Op{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};$.TypeParameterVariance=void 0;(function(y){y[y.None=0]="None",y[y.In=1]="In",y[y.Out=2]="Out",y[y.InOut=3]="InOut"})($.TypeParameterVariance||($.TypeParameterVariance={}));var VAt=y=>h_(ox(y)),cj=VAt(Ae),Wq=class extends cj{isConst(){return this.hasModifier(E.SyntaxKind.ConstKeyword)}setIsConst(i){return this.toggleModifier("const",i)}getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getConstraint(),i??"Expected to find the type parameter's constraint.",this)}setConstraint(i){if(i=this.getParentOrThrow()._getTextWithQueuedChildIndentation(i),E.StringUtils.isNullOrWhitespace(i))return this.removeConstraint(),this;let u=this.getConstraint();if(u!=null)return u.replaceWithText(i),this;let S=this.getNameNode();return $o({parent:this,insertPos:S.getEnd(),newText:` extends ${i}`}),this}removeConstraint(){return s5e(this.getConstraint(),E.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getDefault(),i??"Expected to find the type parameter's default.",this)}setDefault(i){if(i=this.getParentOrThrow()._getTextWithQueuedChildIndentation(i),E.StringUtils.isNullOrWhitespace(i))return this.removeDefault(),this;let u=this.getDefault();if(u!=null)return u.replaceWithText(i),this;let S=this.getConstraint()||this.getNameNode();return $o({parent:this,insertPos:S.getEnd(),newText:` = ${i}`}),this}removeDefault(){return s5e(this.getDefault(),E.SyntaxKind.EqualsToken),this}setVariance(i){return this.toggleModifier("in",(i&$.TypeParameterVariance.In)!==0),this.toggleModifier("out",(i&$.TypeParameterVariance.Out)!==0),this}getVariance(){let i=$.TypeParameterVariance.None;return this.hasModifier(E.SyntaxKind.InKeyword)&&(i|=$.TypeParameterVariance.In),this.hasModifier(E.SyntaxKind.OutKeyword)&&(i|=$.TypeParameterVariance.Out),i}remove(){let i=this.getParentSyntaxListOrThrow();i.getChildrenOfKind(E.SyntaxKind.TypeParameter).length===1?S():oS(this);function S(){let P=[i.getPreviousSiblingIfKindOrThrow(E.SyntaxKind.LessThanToken),i,i.getNextSiblingIfKindOrThrow(E.SyntaxKind.GreaterThanToken)];Xl({children:P})}}set(i){return va(cj.prototype,this,i),i.isConst!=null&&this.setIsConst(i.isConst),i.constraint!=null?this.setConstraint(i.constraint):i.hasOwnProperty(E.nameof(i,"constraint"))&&this.removeConstraint(),i.default!=null?this.setDefault(i.default):i.hasOwnProperty(E.nameof(i,"default"))&&this.removeDefault(),i.variance!=null&&this.setVariance(i.variance),this}getStructure(){let i=this.getConstraint(),u=this.getDefault();return Ra(cj.prototype,this,{kind:$.StructureKind.TypeParameter,isConst:this.isConst(),constraint:i?.getText({trimLeadingIndentation:!0}),default:u?u.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function s5e(y,i){y!=null&&Xl({children:[y.getPreviousSiblingIfKindOrThrow(i),y],removePrecedingSpaces:!0})}var Bq=class extends Op{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getAssertsModifier(),i??"Expected to find an asserts modifier.",this)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getTypeNode(),i??"Expected to find a type node.",this)}},Gq=class extends WR{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},zq=class extends WR{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},Vq=class extends Op{getTypeNodes(){return this.compilerNode.types.map(i=>this._getNodeFromCompilerNode(i))}},nb=class extends Op{},Uq=class extends nb{},uj=Ae,Wd=class extends uj{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(i){return this.set({tagName:i})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(i=>this._getNodeFromCompilerNodeIfExists(i))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:E.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let i=this.getParentOrThrow().getStart()+3,u=Eze(this),S=u==null,P=z.call(this);Xl({children:[this],customRemovalPos:P,customRemovalEnd:bze(this,u),replaceTrivia:re.call(this)});function z(){return Math.max(i,Sze(this,this.getStart()))}function re(){if(P===i&&S)return"";let Ie=this._context.manipulationSettings.getNewLineKindAsString(),at=this.getParentOrThrow().getIndentationText();return`${Ie}${at} `+(S?"":"* ")}}set(i){return va(uj.prototype,this,i),i.text!=null||i.tagName!=null?this.replaceWithText(u=>{var S;this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(u,{tagName:(S=i.tagName)!==null&&S!==void 0?S:this.getTagName(),text:i.text!=null?i.text:l5e(this)})}):this}replaceWithText(i){let u=S0(this._getWriterWithQueuedIndentation(),i),S=this.getParentOrThrow(),P=this.getChildIndex(),z=this.getStart();return $o({parent:S,insertPos:z,newText:u,replacing:{textLength:vze(this)-z}}),S.getChildren()[P]}getStructure(){let i=l5e(this);return Ra(uj.prototype,this,{kind:$.StructureKind.JSDocTag,tagName:this.getTagName(),text:i.length===0?void 0:i})}};function l5e(y){let i=y.getSourceFile().getFullText(),u=y.getTagNameNode().getEnd(),S=vze(y),P=Math.min(i.charCodeAt(u)===mp.SPACE?u+1:u,S);return iye(i.substring(P,S))}function vze(y){return Sze(y,bze(y))}function bze(y,i){return i=i??Eze(y),i!=null?i.getStart():y.getParentOrThrow().getEnd()-2}function Eze(y){let u=y.getParentIfKindOrThrow(E.SyntaxKind.JSDoc).getTags(),S=u.indexOf(y);return u[S+1]}function Sze(y,i){let u=y.getSourceFile().getFullText();return nS(u,i,S=>S!==mp.ASTERISK&&!E.StringUtils.isWhitespaceCharCode(S))}var Kq=class extends Wd{},Hq=class extends Wd{},jq=class extends Wd{},Jq=class extends Wd{},qq=class extends Wd{},Xq=class extends Wd{},Tze=sS(nb),$q=class extends Tze{},Yq=class extends Wd{},Qq=class extends Ae{},Zq=class extends Ae{},eX=class extends Ae{},tX=class extends Ae{},nX=class extends nb{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},rX=class extends Ae{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},iX=class extends nb{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},oX=class extends nb{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},aX=class extends nb{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},xze=XR(Wd),sX=class extends xze{},lX=class extends Wd{},Aze=Nye(Wd),cX=class extends Aze{},uX=class extends Wd{},Dze=Nye(Wd),dX=class extends Dze{},pX=class extends Wd{},fX=class extends Wd{},_X=class extends Wd{},Ize=XR(Wd),mX=class extends Ize{},Cze=XR(Wd),gX=class extends Cze{},Nze=XR(Wd),hX=class extends Nze{},yX=class extends nb{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},f3=class{constructor(i){this._compilerObject=i}get compilerObject(){return this._compilerObject}getName(){return this.compilerObject.name}getText(){var i;return(i=this.compilerObject.text)!==null&&i!==void 0?i:[]}},Rze=dze(Wd),vX=class extends Rze{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getConstraint(),i??"Expected to find the JS doc template tag's constraint.",this)}},bX=class extends Ae{},Pze=XR(Wd),EX=class extends Pze{},Mze=XR(Wd),SX=class extends Mze{},TX=class extends Wd{},xX=class extends Op{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},AX=class extends nb{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(i=>this._getNodeFromCompilerNode(i)):void 0}},DX=class extends Wd{getTypeExpression(){let i=this.compilerNode.typeExpression;if(!(i!=null&&i.pos===i.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},IX=class extends Wd{},CX=class extends nb{},NX=class extends nb{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},RX=class extends Ae{remove(){ZT({children:[this],getSiblingFormatting:()=>$c.Newline})}},UAt=y=>zf(qI(ep(tx(nx(h_(ox(y))))))),dj=UAt(au),PX=class extends dj{set(i){return va(dj.prototype,this,i),i.isConst!=null&&this.setIsConstEnum(i.isConst),i.members!=null&&(this.getMembers().forEach(u=>u.remove()),this.addMembers(i.members)),this}addMember(i){return this.addMembers([i])[0]}addMembers(i){return this.insertMembers(this.getMembers().length,i)}insertMember(i,u){return this.insertMembers(i,[u])[0]}insertMembers(i,u){if(u.length===0)return[];let S=this.getMembersWithComments();i=Fd(i,S.length);let P=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(P,u),eb({parent:this.getChildSyntaxListOrThrow(),currentNodes:S,insertIndex:i,newText:P.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),X_(S,this.getMembersWithComments(),i,!re());function re(){return u instanceof Array?u.every(Ie=>typeof Ie=="object"):!1}}getMember(i){return _p(this.getMembers(),i)}getMemberOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getMember(i),()=>Od("enum member",i))}getMembers(){return this.compilerNode.members.map(i=>this._getNodeFromCompilerNode(i))}getMembersWithComments(){let i=this.compilerNode;return Am.getContainerArray(i,this.getSourceFile().compilerNode).map(u=>this._getNodeFromCompilerNode(u))}setIsConstEnum(i){return this.toggleModifier("const",i)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(E.SyntaxKind.ConstKeyword)}getStructure(){return Ra(dj.prototype,this,{kind:$.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(i=>i.getStructure())})}},KAt=y=>ep(jR(cA(y))),pj=KAt(Ae),MX=class extends pj{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(i){let u;if(typeof i=="string"){let S=this._context.manipulationSettings.getQuoteKind();u=S+E.StringUtils.escapeForWithinString(i,S)+S}else u=i.toString();return this.setInitializer(u),this}remove(){let i=[this],u=this.getNextSiblingIfKind(E.SyntaxKind.CommaToken);u!=null&&i.push(u),ZT({children:i,getSiblingFormatting:()=>$c.Newline})}set(i){return va(pj.prototype,this,i),i.value!=null?this.setValue(i.value):i.hasOwnProperty(E.nameof(i,"value"))&&i.initializer==null&&this.removeInitializer(),this}getStructure(){return Ra(pj.prototype,this,{kind:$.StructureKind.EnumMember,value:void 0})}},LX=class extends Ae{getTypeNodes(){var i,u;return(u=(i=this.compilerNode.types)===null||i===void 0?void 0:i.map(S=>this._getNodeFromCompilerNode(S)))!==null&&u!==void 0?u:[]}getToken(){return this.compilerNode.token}removeExpression(i){let u=this.getTypeNodes(),S=typeof i=="number"?P(i):i;if(u.length===1){let z=this.getParentSyntaxListOrThrow().getChildren();z.length===1?Xl({children:[z[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):Xl({children:[this],removePrecedingSpaces:!0})}else oS(S);return this;function P(z){return u[Fd(z,u.length-1)]}}},aA=class extends Ae{remove(){s1t(this)}},HAt=y=>rb(Kh(ep(sS(y)))),fj=HAt(aA),kX=class extends fj{set(i){return va(fj.prototype,this,i),this}getStructure(){return Ra(fj.prototype,this,{kind:$.StructureKind.CallSignature})}},wX=class extends aA{},jAt=y=>rb(Kh(ep(sS(y)))),_j=jAt(aA),OX=class extends _j{set(i){return va(_j.prototype,this,i),this}getStructure(){return Ra(_j.prototype,this,{kind:$.StructureKind.ConstructSignature})}},JAt=y=>xye(Kh(ep(N3(h_(y))))),mj=JAt(aA),FX=class extends mj{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(i){E.errors.throwIfWhitespaceOrNotString(i,"name"),this.getKeyName()!==i&&this.getKeyNameNode().replaceWithText(i,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let i=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(i.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(i){E.errors.throwIfWhitespaceOrNotString(i,"type");let u=this.getKeyTypeNode();return u.getText()===i?this:(u.replaceWithText(i,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let i=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(i.type)}set(i){return va(mj.prototype,this,i),i.keyName!=null&&this.setKeyName(i.keyName),i.keyType!=null&&this.setKeyType(i.keyType),this}getStructure(){let i=this.getKeyTypeNode();return Ra(mj.prototype,this,{kind:$.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:i.getText()})}},qAt=y=>Dye(zf(B5e(Sye(rb(ep(tx(qI(nx(h_(ox(y))))))))))),gj=qAt(au),WX=class extends gj{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return this.getType().getBaseTypes().map(i=>{var u,S;return(S=(u=i.getSymbol())===null||u===void 0?void 0:u.getDeclarations())!==null&&S!==void 0?S:[]}).flat()}getImplementations(){return this.getNameNode().getImplementations()}set(i){return va(gj.prototype,this,i),this}getStructure(){return Ra(gj.prototype,this,{kind:$.StructureKind.Interface})}},XAt=y=>Kh(ep(ax(rb(sS(cA(y)))))),hj=XAt(aA),BX=class extends hj{set(i){return va(hj.prototype,this,i),this}getStructure(){return Ra(hj.prototype,this,{kind:$.StructureKind.MethodSignature})}},$At=y=>Kh(ep(N3(ax(jR(sx(cA(h_(y)))))))),yj=$At(aA),GX=class extends yj{set(i){return va(yj.prototype,this,i),this}getStructure(){return Ra(yj.prototype,this,{kind:$.StructureKind.PropertySignature})}};function Rye(y){return class extends y{getAttributes(){return this.compilerNode.attributes.properties.map(i=>this._getNodeFromCompilerNode(i))}getAttributeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getAttribute(i),()=>Od("attribute",i))}getAttribute(i){return _p(this.getAttributes(),i)}addAttribute(i){return this.addAttributes([i])[0]}addAttributes(i){return this.insertAttributes(this.compilerNode.attributes.properties.length,i)}insertAttribute(i,u){return this.insertAttributes(i,[u])[0]}insertAttributes(i,u){if(u.length===0)return[];let S=this.compilerNode.attributes.properties.length;i=Fd(i,S);let P=i===0?this.getTagNameNode().getEnd():this.getAttributes()[i-1].getEnd(),z=this._getWriterWithQueuedChildIndentation();return new ihe(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(z,u),$o({insertPos:P,newText:" "+z.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(E.SyntaxKind.SyntaxList)}),X_(S,this.getAttributes(),i,!1)}set(i){return va(y.prototype,this,i),i.attributes!=null&&(this.getAttributes().forEach(u=>u.remove()),this.addAttributes(i.attributes)),this}getStructure(){return Ra(y.prototype,this,{attributes:this.getAttributes().map(i=>i.getStructure())})}}}function H$(y){return class extends y{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(i){return va(y.prototype,this,i),i.name!=null&&this.getTagNameNode().replaceWithText(i.name),this}getStructure(){return Ra(y.prototype,this,{name:this.getTagNameNode().getText()})}}}function Pye(y){return class extends y{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(i=>i.getDeclarationNode()).filter(i=>i!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var Lze=Ef(Ae),zX=class extends Lze{},kze=Pye(ix(aS(Gf))),_3=class extends kze{getImplementations(){return this._context.languageService.getImplementations(this)}},wze=Pye(ix(aS(Ae))),VX=class extends wze{},UX=class extends Ae{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},vj=Ae,KX=class extends vj{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}setName(i){return this.getNameNode().replaceWithText(u=>{typeof i=="object"?this._context.structurePrinterFactory.forJsxNamespacedName().printText(u,i):u.write(i)}),this}getInitializerOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getInitializer(),i??`Expected to find an initializer for the JSX attribute '${this.getNameNode().getText()}'`,this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(i){let u=S0(this._getWriterWithQueuedIndentation(),i);if(E.StringUtils.isNullOrWhitespace(u))return this.removeInitializer(),this;let S=this.getInitializer();return S!=null?(S.replaceWithText(u),this):($o({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${u}`}),this)}removeInitializer(){let i=this.getInitializer();return i==null?this:(Xl({children:[i.getPreviousSiblingIfKindOrThrow(E.SyntaxKind.EqualsToken),i],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){Xl({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(i){return va(vj.prototype,this,i),i.name!=null&&this.setName(i.name),i.initializer!=null?this.setInitializer(i.initializer):i.hasOwnProperty(E.nameof(i,"initializer"))&&this.removeInitializer(),this}getStructure(){let i=this.getInitializer(),u=this.getNameNode();return Ra(vj.prototype,this,{name:u instanceof _3?u.getText():u.getStructure(),kind:$.StructureKind.JsxAttribute,initializer:i?.getText()})}},YAt=y=>H$(y),Oze=YAt(Ae),HX=class extends Oze{},jX=class extends Zd{},bj=Gf,JX=class extends bj{getJsxChildren(){return this.compilerNode.children.map(i=>this._getNodeFromCompilerNode(i))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(i){let u=L5e(this._getWriterWithIndentation(),i);return c5e(this,u),this}setBodyTextInline(i){let u=this._getWriterWithQueuedChildIndentation();return lA(u,i),u.isLastNewLine()&&(u.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),u.write("")),c5e(this,u.toString()),this}set(i){if(va(bj.prototype,this,i),i.attributes!=null){let u=this.getOpeningElement();u.getAttributes().forEach(S=>S.remove()),u.addAttributes(i.attributes)}if(i.children!=null)throw new E.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return i.bodyText!=null?this.setBodyText(i.bodyText):i.hasOwnProperty(E.nameof(i,"bodyText"))&&this.setBodyTextInline(""),i.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(i.name),this.getClosingElement().getTagNameNode().replaceWithText(i.name)),this}getStructure(){let i=this.getOpeningElement(),u=Ra(bj.prototype,this,{kind:$.StructureKind.JsxElement,name:i.getTagNameNode().getText(),attributes:i.getAttributes().map(S=>S.getStructure()),children:void 0,bodyText:yye(this)});return delete u.children,u}};function c5e(y,i){let u=y.getOpeningElement(),S=y.getClosingElement();$o({insertPos:u.getEnd(),newText:i,parent:y.getChildSyntaxListOrThrow(),replacing:{textLength:S.getStart()-u.getEnd()}})}var Fze=R3(D3(Zd)),qX=class extends Fze{},XX=class extends Gf{getJsxChildren(){return this.compilerNode.children.map(i=>this._getNodeFromCompilerNode(i))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},Wze=Ae,$X=class extends Wze{getNamespaceNode(){return this._getNodeFromCompilerNode(this.compilerNode.namespace)}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}set(i){return this.getNamespaceNode().replaceWithText(i.namespace),this.getNameNode().replaceWithText(i.name),this}getStructure(){return{namespace:this.getNamespaceNode().getText(),name:this.getNameNode().getText()}}},QAt=y=>Rye(H$(y)),Bze=QAt(Zd),YX=class extends Bze{},QX=class extends Zd{},ZAt=y=>Rye(H$(y)),Ej=ZAt(Gf),ZX=class extends Ej{set(i){return va(Ej.prototype,this,i),this}getStructure(){return Ra(Ej.prototype,this,{kind:$.StructureKind.JsxSelfClosingElement})}},Sj=Ef(Ae),e$=class extends Sj{remove(){Xl({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(i){return va(Sj.prototype,this,i),i.expression!=null&&this.setExpression(i.expression),this}getStructure(){return Ra(Sj.prototype,this,{kind:$.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},Gze=_k(Ae),t$=class extends Gze{containsOnlyTriviaWhiteSpaces(){let i=this.compilerNode;return typeof i.containsOnlyWhiteSpaces=="boolean"?i.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},zze=VI,n$=class extends zze{getLiteralValue(){let i=this.compilerNode.text;if(typeof BigInt>"u")throw new E.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let u=i.substring(0,i.length-1);return BigInt(u)}setLiteralValue(i){if(typeof i!="bigint")throw new E.errors.ArgumentTypeError("value","bigint",typeof i);return HI({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:i.toString()+"n"}),this}},Vze=Gf,r$=class extends Vze{getLiteralValue(){return Mye(this)}setLiteralValue(i){return Kze(this,i)}},Uze=Gf,i$=class extends Uze{getLiteralValue(){return Mye(this)}setLiteralValue(i){return Kze(this,i)}};function Kze(y,i){if(Mye(y)===i)return y;let u=y.getParentSyntaxList()||y.getParentOrThrow(),S=y.getChildIndex();return y.replaceWithText(i?"true":"false"),u.getChildAtIndex(S)}function Mye(y){return y.getKind()===E.SyntaxKind.TrueKeyword}var Hze=Gf,o$=class extends Hze{},jze=VI,a$=class extends jze{getLiteralValue(){let i=this.compilerNode.text;return i.indexOf(".")>=0?parseFloat(i):parseInt(i,10)}setLiteralValue(i){return HI({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:i.toString(10)}),this}};$.QuoteKind=void 0;(function(y){y.Single="'",y.Double='"'})($.QuoteKind||($.QuoteKind={}));var Jze=VI,s$=class extends Jze{getLiteralValue(){let i=/^\/(.*)\/([^\/]*)$/,u=this.compilerNode.text,S=i.exec(u);return new RegExp(S[1],S[2])}setLiteralValue(i,u){let S;return typeof i=="string"?S=i:(S=i.source,u=i.flags),HI({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${S}/${u||""}`}),this}},qze=VI,l$=class extends qze{getLiteralValue(){return this.compilerNode.text}setLiteralValue(i){return HI({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:E.StringUtils.escapeForWithinString(i,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?$.QuoteKind.Single:$.QuoteKind.Double}},Xze=VI,c$=class extends Xze{getLiteralValue(){return this.compilerNode.text}setLiteralValue(i){let u=this.getChildIndex(),S=this.getParentSyntaxList()||this.getParentOrThrow();return HI({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:i}),S.getChildAtIndex(u)}},u$=class extends OR{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){var i;let u=(i=this.getParentSyntaxList())!==null&&i!==void 0?i:this.getParentOrThrow(),S=this.getChildIndex(),P=this.getTemplate();return $o({customMappings:(z,re)=>[{currentNode:P,newNode:z.getChildren(re)[S]}],parent:u,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),u.getChildAtIndex(S)}},$ze=Gf,d$=class extends $ze{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(i=>this._getNodeFromCompilerNode(i))}setLiteralValue(i){var u;let S=this.getChildIndex(),P=(u=this.getParentSyntaxList())!==null&&u!==void 0?u:this.getParentOrThrow();return HI({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:i}),P.getChildAtIndex(S)}},Yze=_k(Ae),p$=class extends Yze{},Qze=_k(Ae),f$=class extends Qze{},Zze=Ef(Ae),_$=class extends Zze{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},e9e=_k(Ae),m$=class extends e9e{},eDt=y=>bye(vye(sx(jR(W$(y))))),Tj=eDt(Ae),g$=class extends Tj{remove(){let i=this.getParentOrThrow();switch(i.getKind()){case E.SyntaxKind.VariableDeclarationList:u(this);break;case E.SyntaxKind.CatchClause:S(this);break;default:throw new E.errors.NotImplementedError(`Not implemented for syntax kind: ${i.getKindName()}`)}function u(P){let z=i.getParentIfKindOrThrow(E.SyntaxKind.VariableStatement);z.getDeclarations().length===1?z.remove():oS(P)}function S(P){Xl({children:[P.getPreviousSiblingIfKindOrThrow(E.SyntaxKind.OpenParenToken),P,P.getNextSiblingIfKindOrThrow(E.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getVariableStatement(),i??"Expected the grandparent to be a variable statement.",this)}getVariableStatement(){let i=this.getParentOrThrow().getParentOrThrow();return Ae.isVariableStatement(i)?i:void 0}set(i){return va(Tj.prototype,this,i),this}getStructure(){return Ra(Tj.prototype,this,{kind:$.StructureKind.VariableDeclaration})}},t9e=h_(Ae),h$=class extends t9e{getDeclarations(){return this.compilerNode.declarations.map(i=>this._getNodeFromCompilerNode(i))}getDeclarationKind(){let i=this.compilerNode.flags;return i&E.ts.NodeFlags.Let?$.VariableDeclarationKind.Let:(i&E.ts.NodeFlags.AwaitUsing)===E.ts.NodeFlags.AwaitUsing?$.VariableDeclarationKind.AwaitUsing:(i&E.ts.NodeFlags.Using)===E.ts.NodeFlags.Using?$.VariableDeclarationKind.Using:i&E.ts.NodeFlags.Const?$.VariableDeclarationKind.Const:$.VariableDeclarationKind.Var}getDeclarationKindKeywords(){let i=this.getDeclarationKind();switch(i){case $.VariableDeclarationKind.Const:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.ConstKeyword)];case $.VariableDeclarationKind.Let:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.LetKeyword)];case $.VariableDeclarationKind.Var:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.VarKeyword)];case $.VariableDeclarationKind.Using:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.UsingKeyword)];case $.VariableDeclarationKind.AwaitUsing:let u=this.getFirstChildByKindOrThrow(E.SyntaxKind.AwaitKeyword),S=u.getNextSiblingIfKindOrThrow(E.SyntaxKind.UsingKeyword);return[u,S];default:return E.errors.throwNotImplementedForNeverValueError(i)}}setDeclarationKind(i){if(this.getDeclarationKind()===i)return this;let u=this.getDeclarationKindKeywords(),S=u[0].getStart(),P=u[u.length-1].getEnd();return $o({insertPos:S,newText:i,parent:this,replacing:{textLength:P-S}}),this}addDeclaration(i){return this.addDeclarations([i])[0]}addDeclarations(i){return this.insertDeclarations(this.getDeclarations().length,i)}insertDeclaration(i,u){return this.insertDeclarations(i,[u])[0]}insertDeclarations(i,u){let S=this._getWriterWithQueuedChildIndentation(),P=new ex(this._context.structurePrinterFactory.forVariableDeclaration()),z=this.compilerNode.declarations.length;return i=Fd(i,z),P.printText(S,u),eb({parent:this.getFirstChildByKindOrThrow(E.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:i,newText:S.toString(),useTrailingCommas:!1}),X_(z,this.getDeclarations(),i,!1)}},y$=class{constructor(i,u){this._context=i,this._compilerSignature=u}get compilerSignature(){return this._compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(u=>this._context.compilerFactory.getTypeParameter(u))}getParameters(){return this.compilerSignature.parameters.map(i=>this._context.compilerFactory.getSymbol(i))}getReturnType(){return this._context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this._context.typeChecker.compilerObject).map(u=>this._context.compilerFactory.getSymbolDisplayPart(u))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(u=>this._context.compilerFactory.getJSDocTagInfo(u))}getDeclaration(){let{compilerFactory:i}=this._context,u=this.compilerSignature.getDeclaration();return i.getNodeFromCompilerNode(u,i.getSourceFileForNode(u))}},v$=class{get compilerSymbol(){return this._compilerSymbol}constructor(i,u){this._context=i,this._compilerSymbol=u,this.getValueDeclaration(),this.getDeclarations()}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),i??"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this._context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),i??"Expected to find an immediately aliased symbol.")}getAliasedSymbol(){return this._context.typeChecker.getAliasedSymbol(this)}getExportSymbol(){return this._context.typeChecker.getExportSymbolOfSymbol(this)}isAlias(){return(this.getFlags()&E.SymbolFlags.Alias)===E.SymbolFlags.Alias}isOptional(){return(this.getFlags()&E.SymbolFlags.Optional)===E.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(i){return(this.compilerSymbol.flags&i)===i}getValueDeclarationOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getValueDeclaration(),i??(()=>`Expected to find the value declaration of symbol '${this.getName()}'.`))}getValueDeclaration(){let i=this.compilerSymbol.valueDeclaration;if(i!=null)return this._context.compilerFactory.getNodeFromCompilerNode(i,this._context.compilerFactory.getSourceFileForNode(i))}getDeclarations(){var i;return((i=this.compilerSymbol.declarations)!==null&&i!==void 0?i:[]).map(u=>this._context.compilerFactory.getNodeFromCompilerNode(u,this._context.compilerFactory.getSourceFileForNode(u)))}getExportOrThrow(i,u){return E.errors.throwIfNullOrUndefined(this.getExport(i),u??(()=>`Expected to find export with name: ${i}`))}getExport(i){if(this.compilerSymbol.exports==null)return;let u=this.compilerSymbol.exports.get(E.ts.escapeLeadingUnderscores(i));return u==null?void 0:this._context.compilerFactory.getSymbol(u)}getExports(){return this.compilerSymbol.exports==null?[]:Array.from(this.compilerSymbol.exports.values()).map(i=>this._context.compilerFactory.getSymbol(i))}getGlobalExportOrThrow(i,u){return E.errors.throwIfNullOrUndefined(this.getGlobalExport(i),u??(()=>`Expected to find global export with name: ${i}`))}getGlobalExport(i){if(this.compilerSymbol.globalExports==null)return;let u=this.compilerSymbol.globalExports.get(E.ts.escapeLeadingUnderscores(i));return u==null?void 0:this._context.compilerFactory.getSymbol(u)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:Array.from(this.compilerSymbol.globalExports.values()).map(i=>this._context.compilerFactory.getSymbol(i))}getMemberOrThrow(i,u){return E.errors.throwIfNullOrUndefined(this.getMember(i),u??`Expected to find member with name: ${i}`)}getMember(i){if(this.compilerSymbol.members==null)return;let u=this.compilerSymbol.members.get(E.ts.escapeLeadingUnderscores(i));return u==null?void 0:this._context.compilerFactory.getSymbol(u)}getMembers(){return this.compilerSymbol.members==null?[]:Array.from(this.compilerSymbol.members.values()).map(i=>this._context.compilerFactory.getSymbol(i))}getDeclaredType(){return this._context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(i){return this._context.typeChecker.getTypeOfSymbolAtLocation(this,i)}getFullyQualifiedName(){return this._context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this._context.typeChecker.compilerObject).map(i=>new f3(i))}},uk=class{constructor(i){this._compilerObject=i}get compilerObject(){return this._compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},sA=class{constructor(i){this._compilerObject=i}get compilerObject(){return this._compilerObject}getSpan(){return new uk(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};xa([E.Memoize],sA.prototype,"getSpan",null);var KI=class{constructor(i,u){this._context=i,this._compilerObject=u;let S=i.compilerFactory.addOrGetSourceFileFromFilePath(i.fileSystemWrapper.getStandardizedAbsolutePath(u.fileName),{markInProject:!1,scriptKind:void 0});this._existingFileExists=S!=null,u.isNewFile||(this._sourceFile=S)}getFilePath(){return this._compilerObject.fileName}getSourceFile(){return this._sourceFile}getTextChanges(){return this._compilerObject.textChanges.map(i=>new sA(i))}applyChanges(i={}){if(this._isApplied)return;if(this.isNewFile()&&this._existingFileExists&&!i.overwrite)throw new E.errors.InvalidOperationError(`Cannot apply file text change for creating a new file when the file exists at path ${this.getFilePath()}. Did you mean to provide the overwrite option?`);let u;if(this.isNewFile()?u=this._context.project.createSourceFile(this.getFilePath(),"",{overwrite:i.overwrite}):u=this.getSourceFile(),u==null)throw new E.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return u.applyTextChanges(this.getTextChanges()),u._markAsInProject(),this._isApplied=!0,this}isNewFile(){return!!this._compilerObject.isNewFile}};xa([E.Memoize],KI.prototype,"getTextChanges",null);var b$=class{constructor(i,u){this._context=i,this._compilerObject=u}get compilerObject(){return this._compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(i=>new KI(this._context,i))}},E$=class extends b${getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},m3=class{constructor(i,u){this._context=i,this._compilerObject=u}get compilerObject(){return this._compilerObject}getChanges(){return this.compilerObject.changes.map(i=>new KI(this._context,i))}applyChanges(i){for(let u of this.getChanges())u.applyChanges(i);return this}};xa([E.Memoize],m3.prototype,"getChanges",null);var iS=class{constructor(i,u){this._context=i,this._compilerObject=u,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(i.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.fileName),{markInProject:!1,scriptKind:void 0}),this._sourceFile._doActionPreNextModification(()=>this.getNode())}get compilerObject(){return this._compilerObject}getSourceFile(){return this._sourceFile}getTextSpan(){return new uk(this.compilerObject.textSpan)}getNode(){let i=this.getTextSpan(),u=this.getSourceFile(),S=i.getStart(),P=i.getEnd();return z();function z(){let re;return u._context.compilerFactory.forgetNodesCreatedInBlock(Ie=>{let at,We=u;for(;We!=null;){if(at==null&&(re=We),We.getStart()===S&&We.getWidth()===P)re=at=We;else if(at!=null)break;We=We.getChildAtPos(S)}re!=null&&Ie(re)}),re}}getOriginalTextSpan(){let{originalTextSpan:i}=this.compilerObject;return i==null?void 0:new uk(i)}getOriginalFileName(){return this.compilerObject.originalFileName}};xa([E.Memoize],iS.prototype,"getTextSpan",null);xa([E.Memoize],iS.prototype,"getNode",null);xa([E.Memoize],iS.prototype,"getOriginalTextSpan",null);var dk=class extends iS{constructor(i,u){super(i,u),this.getSourceFile()._doActionPreNextModification(()=>this.getDeclarationNode())}getKind(){return this.compilerObject.kind}getName(){return this.compilerObject.name}getContainerKind(){return this.compilerObject.containerKind}getContainerName(){return this.compilerObject.containerName}getDeclarationNode(){if(this.getKind()==="module"&&this.getTextSpan().getLength()===this.getSourceFile().getFullWidth())return this.getSourceFile();let i=this.getTextSpan().getStart(),u=S(this.getSourceFile());return u?.getParentOrThrow();function S(P){if(P.getKind()===E.SyntaxKind.Identifier&&P.getStart()===i)return P;for(let z of P._getChildrenIterator())if(z.getPos()<=i&&z.getEnd()>i)return S(z)}}};xa([E.Memoize],dk.prototype,"getDeclarationNode",null);var g3=class y{constructor(i){this._compilerObject=i}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let i=this.compilerObject.next;if(i!=null)return i instanceof Array?i.map(u=>new y(u)):[new y(i)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},BR=class{constructor(i,u){this._context=i,this._compilerObject=u,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let i=this.compilerObject.file;return i==null?void 0:this._context.compilerFactory.getSourceFile(i,{markInProject:!1})}getMessageText(){let i=this._compilerObject.messageText;return typeof i=="string"?i:this._context==null?new g3(i):this._context.compilerFactory.getDiagnosticMessageChain(i)}getLineNumber(){let i=this.getSourceFile(),u=this.getStart();if(!(i==null||u==null))return E.StringUtils.getLineNumberAtPos(i.getFullText(),u)}getStart(){return this.compilerObject.start}getLength(){return this.compilerObject.length}getCategory(){return this.compilerObject.category}getCode(){return this.compilerObject.code}getSource(){return this.compilerObject.source}};xa([E.Memoize],BR.prototype,"getSourceFile",null);var h3=class extends BR{constructor(i,u){super(i,u)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},S$=class{constructor(i,u){this._compilerObject=u,this._context=i}get compilerObject(){return this._compilerObject}getFilePath(){return this._context.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name)}getWriteByteOrderMark(){return this.compilerObject.writeByteOrderMark||!1}getText(){return this.compilerObject.text}},y3=class{constructor(i,u){this._context=i,this._compilerObject=u}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(i=>new S$(this._context,i))}};xa([E.Memoize],y3.prototype,"getOutputFiles",null);var GR=class{constructor(i,u){this._context=i,this._compilerObject=u,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(i=>this._context.compilerFactory.getDiagnostic(i))}};xa([E.Memoize],GR.prototype,"getDiagnostics",null);var v3=class extends iS{constructor(i,u){super(i,u)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(i=>this._context.compilerFactory.getSymbolDisplayPart(i))}};xa([E.Memoize],v3.prototype,"getDisplayParts",null);var T$=class extends GR{constructor(i,u,S){super(i,u),this._files=S}getFiles(){return this._files}saveFiles(){let i=this._context.fileSystemWrapper,u=this._files.map(S=>i.writeFile(S.filePath,S.writeByteOrderMark?"\uFEFF"+S.text:S.text));return Promise.all(u)}saveFilesSync(){let i=this._context.fileSystemWrapper;for(let u of this._files)i.writeFileSync(u.filePath,u.writeByteOrderMark?"\uFEFF"+u.text:u.text)}},b3=class{constructor(i,u){this._context=i,this._compilerObject=u}get compilerObject(){return this._compilerObject}getEdits(){return this.compilerObject.edits.map(i=>new KI(this._context,i))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(i){for(let u of this.getEdits())u.applyChanges(i);return this}};xa([E.Memoize],b3.prototype,"getEdits",null);var E3=class{constructor(i,u){this._context=i,this._compilerObject=u,this._references=this.compilerObject.references.map(S=>i.compilerFactory.getReferencedSymbolEntry(S))}get compilerObject(){return this._compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this._references}};xa([E.Memoize],E3.prototype,"getDefinition",null);var S3=class extends dk{constructor(i,u){super(i,u)}getDisplayParts(){return this.compilerObject.displayParts.map(i=>this._context.compilerFactory.getSymbolDisplayPart(i))}};xa([E.Memoize],S3.prototype,"getDisplayParts",null);var x$=class extends iS{constructor(i,u){super(i,u)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},A$=class extends x${constructor(i,u){super(i,u)}isDefinition(){return this.compilerObject.isDefinition}},D$=class extends iS{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},I$=class{constructor(i){this._compilerObject=i}get compilerObject(){return this._compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},T3=class{constructor(i){this._context=i}get compilerObject(){return this._getCompilerObject()}_reset(i){this._getCompilerObject=i}getAmbientModules(){return this.compilerObject.getAmbientModules().map(i=>this._context.compilerFactory.getSymbol(i))}getApparentType(i){return this._context.compilerFactory.getType(this.compilerObject.getApparentType(i.compilerType))}getConstantValue(i){return this.compilerObject.getConstantValue(i.compilerNode)}getFullyQualifiedName(i){return this.compilerObject.getFullyQualifiedName(i.compilerSymbol)}getTypeAtLocation(i){return this._context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(i.compilerNode))}getContextualType(i){let u=this.compilerObject.getContextualType(i.compilerNode);return u==null?void 0:this._context.compilerFactory.getType(u)}getTypeOfSymbolAtLocation(i,u){return this._context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(i.compilerSymbol,u.compilerNode))}getDeclaredTypeOfSymbol(i){return this._context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(i.compilerSymbol))}getSymbolAtLocation(i){let u=this.compilerObject.getSymbolAtLocation(i.compilerNode);return u==null?void 0:this._context.compilerFactory.getSymbol(u)}getAliasedSymbol(i){if(!i.hasFlags(E.SymbolFlags.Alias))return;let u=this.compilerObject.getAliasedSymbol(i.compilerSymbol);return u==null?void 0:this._context.compilerFactory.getSymbol(u)}getImmediatelyAliasedSymbol(i){let u=this.compilerObject.getImmediateAliasedSymbol(i.compilerSymbol);return u==null?void 0:this._context.compilerFactory.getSymbol(u)}getExportSymbolOfSymbol(i){return this._context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(i.compilerSymbol))}getPropertiesOfType(i){return this.compilerObject.getPropertiesOfType(i.compilerType).map(u=>this._context.compilerFactory.getSymbol(u))}getTypeText(i,u,S){return S==null&&(S=this._getDefaultTypeFormatFlags(u)),this.compilerObject.typeToString(i.compilerType,u?.compilerNode,S)}getReturnTypeOfSignature(i){return this._context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(i.compilerSignature))}getSignatureFromNode(i){let u=this.compilerObject.getSignatureFromDeclaration(i.compilerNode);return u==null?void 0:this._context.compilerFactory.getSignature(u)}getExportsOfModule(i){return(this.compilerObject.getExportsOfModule(i.compilerSymbol)||[]).map(S=>this._context.compilerFactory.getSymbol(S))}getExportSpecifierLocalTargetSymbol(i){let u=this.compilerObject.getExportSpecifierLocalTargetSymbol(i.compilerNode);return u==null?void 0:this._context.compilerFactory.getSymbol(u)}getResolvedSignature(i){let u=this.compilerObject.getResolvedSignature(i.compilerNode);if(!(!u||!u.declaration))return this._context.compilerFactory.getSignature(u)}getResolvedSignatureOrThrow(i,u){return E.errors.throwIfNullOrUndefined(this.getResolvedSignature(i),u??"Signature could not be resolved.",i)}getBaseTypeOfLiteralType(i){return this._context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(i.compilerType))}getSymbolsInScope(i,u){return this.compilerObject.getSymbolsInScope(i.compilerNode,u).map(S=>this._context.compilerFactory.getSymbol(S))}getTypeArguments(i){return this.compilerObject.getTypeArguments(i.compilerType).map(u=>this._context.compilerFactory.getType(u))}_getDefaultTypeFormatFlags(i){let u=E.TypeFormatFlags.UseTypeOfFunction|E.TypeFormatFlags.NoTruncation|E.TypeFormatFlags.UseFullyQualifiedType|E.TypeFormatFlags.WriteTypeArgumentsOfSignature;return i!=null&&i.getKind()===E.SyntaxKind.TypeAliasDeclaration&&(u|=E.TypeFormatFlags.InTypeAlias),u}},C$=class{constructor(i){this._context=i.context,this._configFileParsingDiagnostics=i.configFileParsingDiagnostics,this._typeChecker=new T3(this._context),this._reset(i.rootNames,i.host)}get compilerObject(){return this._getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this._createdCompilerObject!=null}_reset(i,u){let S=this._context.compilerOptions.get();this._getOrCreateCompilerObject=()=>(this._createdCompilerObject==null&&(this._createdCompilerObject=E.ts.createProgram(i,S,u,this._oldProgram,this._configFileParsingDiagnostics),delete this._oldProgram),this._createdCompilerObject),this._createdCompilerObject!=null&&(this._oldProgram=this._createdCompilerObject,delete this._createdCompilerObject),this._typeChecker._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this._typeChecker}async emit(i={}){if(i.writeFile){let z=`Cannot specify a ${E.nameof(i,"writeFile")} option when emitting asynchrously. Use ${E.nameof(this,"emitSync")}() instead.`;throw new E.errors.InvalidOperationError(z)}let{fileSystemWrapper:u}=this._context,S=[],P=this._emit({writeFile:(z,re,Ie)=>{S.push(u.writeFile(u.getStandardizedAbsolutePath(z),Ie?"\uFEFF"+re:re))},...i});return await Promise.all(S),new GR(this._context,P)}emitSync(i={}){return new GR(this._context,this._emit(i))}emitToMemory(i={}){let u=[],{fileSystemWrapper:S}=this._context,P=this._emit({writeFile:(z,re,Ie)=>{u.push({filePath:S.getStandardizedAbsolutePath(z),text:re,writeByteOrderMark:Ie||!1})},...i});return new T$(this._context,P,u)}_emit(i={}){let u=i.targetSourceFile!=null?i.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:S,customTransformers:P,writeFile:z}=i;return this.compilerObject.emit(u,z,void 0,S,P)}getSyntacticDiagnostics(i){return this.compilerObject.getSyntacticDiagnostics(i?.compilerNode).map(S=>this._context.compilerFactory.getDiagnosticWithLocation(S))}getSemanticDiagnostics(i){return this.compilerObject.getSemanticDiagnostics(i?.compilerNode).map(S=>this._context.compilerFactory.getDiagnostic(S))}getDeclarationDiagnostics(i){return this.compilerObject.getDeclarationDiagnostics(i?.compilerNode).map(S=>this._context.compilerFactory.getDiagnosticWithLocation(S))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(u=>this._context.compilerFactory.getDiagnostic(u))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(u=>this._context.compilerFactory.getDiagnostic(u))}getEmitModuleResolutionKind(){return E.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(i){return i.isFromExternalLibrary()}},N$=class{get compilerObject(){return this._compilerObject}constructor(i){var u;this._projectVersion=0,this._context=i.context;let{languageServiceHost:S,compilerHost:P}=E.createHosts({transactionalFileSystem:this._context.fileSystemWrapper,sourceFileContainer:this._context.getSourceFileContainer(),compilerOptions:this._context.compilerOptions,getNewLine:()=>this._context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this._projectVersion}`,resolutionHost:(u=i.resolutionHost)!==null&&u!==void 0?u:{},libFolderPath:i.libFolderPath,skipLoadingLibFiles:i.skipLoadingLibFiles});this._compilerHost=P,this._compilerObject=E.ts.createLanguageService(S,this._context.compilerFactory.documentRegistry),this._program=new C$({context:this._context,rootNames:Array.from(this._context.compilerFactory.getSourceFilePaths()),host:this._compilerHost,configFileParsingDiagnostics:i.configFileParsingDiagnostics}),this._context.compilerFactory.onSourceFileAdded(z=>{z._isInProject()&&this._reset()}),this._context.compilerFactory.onSourceFileRemoved(()=>this._reset())}_reset(){this._projectVersion+=1,this._program._reset(Array.from(this._context.compilerFactory.getSourceFilePaths()),this._compilerHost)}getProgram(){return this._program}getDefinitions(i){return this.getDefinitionsAtPosition(i._sourceFile,i.getStart())}getDefinitionsAtPosition(i,u){return(this.compilerObject.getDefinitionAtPosition(i.getFilePath(),u)||[]).map(P=>this._context.compilerFactory.getDefinitionInfo(P))}getImplementations(i){return this.getImplementationsAtPosition(i._sourceFile,i.getStart())}getImplementationsAtPosition(i,u){return(this.compilerObject.getImplementationAtPosition(i.getFilePath(),u)||[]).map(P=>new v3(this._context,P))}findReferences(i){return this.findReferencesAtPosition(i._sourceFile,i.getStart())}findReferencesAsNodes(i){let u=this.findReferences(i);return Array.from(S());function*S(){for(let P of u){let z=P.getDefinition().getKind()===E.ts.ScriptElementKind.alias,re=P.getReferences();for(let Ie=0;Ie<re.length;Ie++){let at=re[Ie];(z||!at.isDefinition()||Ie>0)&&(yield at.getNode())}}}}findReferencesAtPosition(i,u){return(this.compilerObject.findReferences(i.getFilePath(),u)||[]).map(P=>this._context.compilerFactory.getReferencedSymbol(P))}findRenameLocations(i,u={}){let S=u.usePrefixAndSuffixText==null?this._context.manipulationSettings.getUsePrefixAndSuffixTextForRename():u.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(i._sourceFile.getFilePath(),i.getStart(),u.renameInStrings||!1,u.renameInComments||!1,S)||[]).map(z=>new D$(this._context,z))}getSuggestionDiagnostics(i){let u=this._getFilePathFromFilePathOrSourceFile(i);return this.compilerObject.getSuggestionDiagnostics(u).map(P=>this._context.compilerFactory.getDiagnosticWithLocation(P))}getFormattingEditsForRange(i,u,S){return(this.compilerObject.getFormattingEditsForRange(i,u[0],u[1],this._getFilledSettings(S))||[]).map(P=>new sA(P))}getFormattingEditsForDocument(i,u){let S=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i);return(this.compilerObject.getFormattingEditsForDocument(S,this._getFilledSettings(u))||[]).map(P=>new sA(P))}getFormattedDocumentText(i,u){let S=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),P=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(S);if(P==null)throw new E.errors.FileNotFoundError(S);u=this._getFilledSettings(u);let z=this.getFormattingEditsForDocument(S,u),re=_ye(P,z),Ie=u.newLineCharacter;return u.ensureNewLineAtEndOfFile&&!re.endsWith(Ie)&&(re+=Ie),re.replace(/\r?\n/g,Ie)}getEmitOutput(i,u){let S=this._getFilePathFromFilePathOrSourceFile(i),P=this.compilerObject;return new y3(this._context,z());function z(){let re=P.getProgram();return re==null||re.getSourceFile(S)==null?{emitSkipped:!0,outputFiles:[]}:P.getEmitOutput(S,u)}}getIdentationAtPosition(i,u,S){let P=this._getFilePathFromFilePathOrSourceFile(i);return S==null?S=this._context.manipulationSettings.getEditorSettings():fye(S,this._context.manipulationSettings),this.compilerObject.getIndentationAtPosition(P,u,S)}organizeImports(i,u={},S={}){let P={type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(i)};return this.compilerObject.organizeImports(P,this._getFilledSettings(u),this._getFilledUserPreferences(S)).map(z=>new KI(this._context,z))}getEditsForRefactor(i,u,S,P,z,re={}){let Ie=this._getFilePathFromFilePathOrSourceFile(i),at=typeof S=="number"?S:{pos:S.getPos(),end:S.getEnd()},We=this.compilerObject.getEditsForRefactor(Ie,this._getFilledSettings(u),at,P,z,this._getFilledUserPreferences(re));return We!=null?new b3(this._context,We):void 0}getCombinedCodeFix(i,u,S={},P={}){let z=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(i)},u,this._getFilledSettings(S),this._getFilledUserPreferences(P||{}));return new m3(this._context,z)}getCodeFixesAtPosition(i,u,S,P,z={},re={}){let Ie=this._getFilePathFromFilePathOrSourceFile(i);return this.compilerObject.getCodeFixesAtPosition(Ie,u,S,P,this._getFilledSettings(z),this._getFilledUserPreferences(re||{})).map(We=>new E$(this._context,We))}_getFilePathFromFilePathOrSourceFile(i){let u=typeof i=="string"?this._context.fileSystemWrapper.getStandardizedAbsolutePath(i):i.getFilePath();if(!this._context.compilerFactory.containsSourceFileAtPath(u))throw new E.errors.FileNotFoundError(u);return u}_getFilledSettings(i){return i._filled||(i=Object.assign(this._context.getFormatCodeSettings(),i),Axt(i,this._context.manipulationSettings),i._filled=!0),i}_getFilledUserPreferences(i){return Object.assign(this._context.getUserPreferences(),i)}},x3=class{get compilerType(){return this._compilerType}constructor(i,u){this._context=i,this._compilerType=u}getText(i,u){return this._context.typeChecker.getTypeText(this,i,u)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(u=>this._context.compilerFactory.getType(u))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getArrayElementType(),i??"Expected to find an array element type.")}getArrayElementType(){if(this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(u=>this._context.compilerFactory.getType(u))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(i=>this._context.compilerFactory.getSignature(i))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(i=>this._context.compilerFactory.getSignature(i))}getConstraintOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getConstraint(),i??"Expected to find a constraint.")}getConstraint(){let i=this.compilerType.getConstraint();return i==null?void 0:this._context.compilerFactory.getType(i)}getDefaultOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getDefault(),i??"Expected to find a default type.")}getDefault(){let i=this.compilerType.getDefault();return i==null?void 0:this._context.compilerFactory.getType(i)}getProperties(){return this.compilerType.getProperties().map(i=>this._context.compilerFactory.getSymbol(i))}getPropertyOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getProperty(i),()=>Od("symbol property",i))}getProperty(i){return MBe(this.getProperties(),i)}getApparentProperties(){return this.compilerType.getApparentProperties().map(i=>this._context.compilerFactory.getSymbol(i))}getApparentProperty(i){return MBe(this.getApparentProperties(),i)}isNullable(){return this.getUnionTypes().some(i=>i.isNull()||i.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let i=this.compilerType.getNumberIndexType();return i==null?void 0:this._context.compilerFactory.getType(i)}getStringIndexType(){let i=this.compilerType.getStringIndexType();return i==null?void 0:this._context.compilerFactory.getType(i)}getTargetType(){let i=this.compilerType.target||void 0;return i==null?void 0:this._context.compilerFactory.getType(i)}getTargetTypeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getTargetType(),i??"Expected to find the target type.")}getTypeArguments(){return this._context.typeChecker.getTypeArguments(this)}getTupleElements(){return this.isTuple()?this.getTypeArguments():[]}getUnionTypes(){return this.isUnion()?this.compilerType.types.map(i=>this._context.compilerFactory.getType(i)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(i=>this._context.compilerFactory.getType(i)):[]}getLiteralValue(){var i;return(i=this.compilerType)===null||i===void 0?void 0:i.value}getLiteralValueOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getLiteralValue(),i??"Type was not a literal type.")}getLiteralFreshType(){var i;let u=(i=this.compilerType)===null||i===void 0?void 0:i.freshType;return u==null?void 0:this._context.compilerFactory.getType(u)}getLiteralFreshTypeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),i??"Type was not a literal type.")}getLiteralRegularType(){var i;let u=(i=this.compilerType)===null||i===void 0?void 0:i.regularType;return u==null?void 0:this._context.compilerFactory.getType(u)}getLiteralRegularTypeOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),i??"Type was not a literal type.")}getSymbol(){let i=this.compilerType.getSymbol();return i==null?void 0:this._context.compilerFactory.getSymbol(i)}getSymbolOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getSymbol(),i??"Expected to find a symbol.")}isAnonymous(){return this._hasObjectFlag(E.ObjectFlags.Anonymous)}isAny(){return this._hasTypeFlag(E.TypeFlags.Any)}isNever(){return this._hasTypeFlag(E.TypeFlags.Never)}isArray(){let i=this.getSymbol();return i==null?!1:(i.getName()==="Array"||i.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let i=this.getSymbol();return i==null?!1:i.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this._hasTypeFlag(E.TypeFlags.TemplateLiteral)}isBoolean(){return this._hasTypeFlag(E.TypeFlags.Boolean)}isString(){return this._hasTypeFlag(E.TypeFlags.String)}isNumber(){return this._hasTypeFlag(E.TypeFlags.Number)}isLiteral(){let i=this.isBooleanLiteral();return this.compilerType.isLiteral()||i}isBooleanLiteral(){return this._hasTypeFlag(E.TypeFlags.BooleanLiteral)}isEnumLiteral(){return this._hasTypeFlag(E.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this._hasTypeFlag(E.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this._hasTypeFlag(E.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let u=this.getSymbol();if(u==null)return!1;let S=u.getValueDeclaration();return S!=null&&Ae.isEnumDeclaration(S)}isInterface(){return this._hasObjectFlag(E.ObjectFlags.Interface)}isObject(){return this._hasTypeFlag(E.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let i=this.getTargetType();return i==null?!1:i._hasObjectFlag(E.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this._hasTypeFlag(E.TypeFlags.Unknown)}isNull(){return this._hasTypeFlag(E.TypeFlags.Null)}isUndefined(){return this._hasTypeFlag(E.TypeFlags.Undefined)}isVoid(){return this._hasTypeFlag(E.TypeFlags.Void)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}_hasTypeFlag(i){return(this.compilerType.flags&i)===i}_hasObjectFlag(i){return(this.getObjectFlags()&i)===i}},R$=class extends x3{getConstraintOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getConstraint(),i??"Expected type parameter to have a constraint.")}getConstraint(){let i=this._getTypeParameterDeclaration();if(i==null)return;let u=i.getConstraint();if(u!=null)return this._context.typeChecker.getTypeAtLocation(u)}getDefaultOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getDefault(),i??"Expected type parameter to have a default type.")}getDefault(){let i=this._getTypeParameterDeclaration();if(i==null)return;let u=i.getDefault();if(u!=null)return this._context.typeChecker.getTypeAtLocation(u)}_getTypeParameterDeclaration(){let i=this.getSymbol();if(i==null)return;let u=i.getDeclarations()[0];if(u!=null&&Ae.isTypeParameterDeclaration(u))return u}},A3=class{constructor(i,u){this._skippedFilePaths=i,this._outputFilePaths=u}getSkippedFilePaths(){return this._skippedFilePaths}getOutputFilePaths(){return this._outputFilePaths}},P$=class y{constructor(i,u){this.__context=i,this._setPathInternal(u)}_setPathInternal(i){this._path=i,this._pathParts=i.split("/").filter(u=>u.length>0)}get _context(){return this._throwIfDeletedOrRemoved(),this.__context}isAncestorOf(i){return y._isAncestorOfDir(this,i)}isDescendantOf(i){return y._isAncestorOfDir(i,this)}_getDepth(){return this._pathParts.length}getPath(){return this._throwIfDeletedOrRemoved(),this._path}getBaseName(){return this._pathParts[this._pathParts.length-1]}getParentOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getParent(),i??(()=>`Parent directory of ${this.getPath()} does not exist or was never added.`))}getParent(){if(!E.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(E.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getDirectory(i),()=>typeof i=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(i){if(typeof i=="string"){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(u)}return this.getDirectories().find(i)}getSourceFileOrThrow(i){return E.errors.throwIfNullOrUndefined(this.getSourceFile(i),()=>typeof i=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(i){if(typeof i=="string"){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(u)}for(let u of this._getSourceFilesIterator())if(i(u))return u}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(i){let{compilerFactory:u,fileSystemWrapper:S}=this._context,P=this;if(typeof i=="string"||i instanceof Array)return Array.from(z(typeof i=="string"?[i]:i));return Array.from(this._getSourceFilesIterator());function*z(re){let Ie=Array.from(We()),at=E.matchGlobs(Ie,re,P.getPath());for(let Ue of at)yield u.getSourceFileFromCacheFromFilePath(S.getStandardizedAbsolutePath(Ue));function*We(){for(let Ue of P._getDescendantSourceFilesIterator())yield Ue.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let i of this._getSourceFilesIterator())yield i;for(let i of this._getDirectoriesIterator())yield*i._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let i of this.getDirectories())yield i,yield*i._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(i){return i=typeof i=="string"?[i]:i,i=i.map(u=>E.FileUtils.pathIsAbsolute(u)?u:E.FileUtils.pathJoin(this.getPath(),u)),this._context.directoryCoordinator.addSourceFilesAtPaths(i,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(i,u={}){let S=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(S,{...u,markInProject:this._isInProject()})}addDirectoryAtPath(i,u={}){let S=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(S,{...u,markInProject:this._isInProject()})}createDirectory(i){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(u,{markInProject:this._isInProject()})}createSourceFile(i,u,S){let P=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.compilerFactory.createSourceFile(P,u||"",{...S||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(i){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(u,{markInProject:this._isInProject()})}addSourceFileAtPath(i){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(u,{markInProject:this._isInProject()})}async emit(i={}){let{fileSystemWrapper:u}=this._context,S=[],P=[],z=[];for(let re of this._emitInternal(i))u5e(re)?z.push(re):(S.push(u.writeFile(re.filePath,re.fileText)),P.push(re.filePath));return await Promise.all(S),new A3(z,P)}emitSync(i={}){let{fileSystemWrapper:u}=this._context,S=[],P=[];for(let z of this._emitInternal(i))u5e(z)?P.push(z):(u.writeFileSync(z.filePath,z.fileText),S.push(z.filePath));return new A3(P,S)}_emitInternal(i={}){let{emitOnlyDtsFiles:u=!1}=i,S=i.outDir==null?void 0:/\.js$/i,P=i.outDir==null?void 0:/\.js\.map$/i,z=i.declarationDir==null&&i.outDir==null?void 0:/\.d\.ts$/i,re=Ue=>Ue==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(Ue,this.getPath()),Ie=(Ue,Yt)=>Ue==null?void 0:E.FileUtils.pathJoin(Ue,Yt.getBaseName()),at=this._context.compilerOptions.get().declarationDir!=null||i.declarationDir!=null;return We(this,re(i.outDir),re(i.declarationDir));function*We(Ue,Yt,Cn){for(let Wn of Ue.getSourceFiles()){let zr=Wn.getEmitOutput({emitOnlyDtsFiles:u});if(zr.getEmitSkipped()){yield Wn.getFilePath();continue}for(let Ji of zr.getOutputFiles()){let Wo=Ji.getFilePath(),Kr=Ji.getWriteByteOrderMark()?E.FileUtils.getTextWithByteOrderMark(Ji.getText()):Ji.getText();Yt!=null&&(S.test(Wo)||P.test(Wo)||!at&&z.test(Wo))?Wo=E.FileUtils.pathJoin(Yt,E.FileUtils.getBaseName(Wo)):Cn!=null&&z.test(Wo)&&(Wo=E.FileUtils.pathJoin(Cn,E.FileUtils.getBaseName(Wo))),yield{filePath:Wo,fileText:Kr}}}for(let Wn of Ue.getDirectories())yield*We(Wn,Ie(Yt,Wn),Ie(Cn,Wn))}}copyToDirectory(i,u){let S=typeof i=="string"?i:i.getPath();return this.copy(E.FileUtils.pathJoin(S,this.getBaseName()),u)}copy(i,u){let S=this.getPath(),P=this._context.fileSystemWrapper,z=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i,this.getPath());return S===z?this:(u=Nge(u),u.includeUntrackedFiles&&P.queueCopyDirectory(S,z),this._copyInternal(z,u))}async copyImmediately(i,u){let S=this._context.fileSystemWrapper,P=this.getPath(),z=S.getStandardizedAbsolutePath(i,P);if(P===z)return await this.save(),this;u=Nge(u);let re=this._copyInternal(z,u);return u.includeUntrackedFiles&&await S.copyDirectoryImmediately(P,z),await re.save(),re}copyImmediatelySync(i,u){let S=this._context.fileSystemWrapper,P=this.getPath(),z=S.getStandardizedAbsolutePath(i,P);if(P===z)return this.saveSync(),this;u=Nge(u);let re=this._copyInternal(z,u);return u.includeUntrackedFiles&&S.copyDirectoryImmediatelySync(P,z),re.saveSync(),re}_copyInternal(i,u){if(this.getPath()===i)return this;let{fileSystemWrapper:P,compilerFactory:z}=this._context,re=[this,...this.getDescendantDirectories()].map(at=>({newDirPath:at===this?i:P.getStandardizedAbsolutePath(this.getRelativePathTo(at),i)})),Ie=this.getDescendantSourceFiles().map(at=>({sourceFile:at,newFilePath:P.getStandardizedAbsolutePath(this.getRelativePathTo(at),i),references:this._getReferencesForCopy(at)}));for(let{newDirPath:at}of re)this._context.compilerFactory.createDirectoryOrAddIfExists(at,{markInProject:this._isInProject()});for(let{sourceFile:at,newFilePath:We}of Ie)at._copyInternal(We,u);for(let{references:at,newFilePath:We}of Ie)this.getSourceFileOrThrow(We)._updateReferencesForCopyInternal(at);return z.getDirectoryFromCache(i)}moveToDirectory(i,u){let S=typeof i=="string"?i:i.getPath();return this.move(E.FileUtils.pathJoin(S,this.getBaseName()),u)}move(i,u){let S=this._context.fileSystemWrapper,P=this.getPath(),z=S.getStandardizedAbsolutePath(i,P);return P===z?this:this._moveInternal(z,u,()=>S.queueMoveDirectory(P,z))}async moveImmediately(i,u){let S=this._context.fileSystemWrapper,P=this.getPath(),z=S.getStandardizedAbsolutePath(i,P);return P===z?(await this.save(),this):(this._moveInternal(z,u),await S.moveDirectoryImmediately(P,z),await this.save(),this)}moveImmediatelySync(i,u){let S=this._context.fileSystemWrapper,P=this.getPath(),z=S.getStandardizedAbsolutePath(i,P);return P===z?(this.saveSync(),this):(this._moveInternal(z,u),S.moveDirectoryImmediatelySync(P,z),this.saveSync(),this)}_moveInternal(i,u,S){let P=this.getPath();if(P===i)return this;let z=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(i),re=z!=null&&z._isInProject();S&&S();let Ie=this._context.fileSystemWrapper,at=this._context.compilerFactory,We=[this,...this.getDescendantDirectories()].map(Yt=>({directory:Yt,oldPath:Yt.getPath(),newDirPath:Yt===this?i:Ie.getStandardizedAbsolutePath(this.getRelativePathTo(Yt),i)})),Ue=this.getDescendantSourceFiles().map(Yt=>({sourceFile:Yt,newFilePath:Ie.getStandardizedAbsolutePath(this.getRelativePathTo(Yt),i),references:this._getReferencesForMove(Yt)}));for(let{directory:Yt,oldPath:Cn,newDirPath:Wn}of We){at.removeDirectoryFromCache(Cn);let zr=at.getDirectoryFromCache(Wn);zr?._forgetOnlyThis(),Yt._setPathInternal(Wn),at.addDirectoryToCache(Yt)}for(let{sourceFile:Yt,newFilePath:Cn}of Ue)Yt._moveInternal(Cn,u);for(let{sourceFile:Yt,references:Cn}of Ue)Yt._updateReferencesForMoveInternal(Cn,P);return re&&this._markAsInProject(),this}clear(){let i=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(i),this._context.fileSystemWrapper.queueMkdir(i)}async clearImmediately(){let i=this.getPath();this._deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(i)}clearImmediatelySync(){let i=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(i)}delete(){let i=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(i),this.forget()}_deleteDescendants(){for(let i of this.getSourceFiles())i.delete();for(let i of this.getDirectories())i.delete()}async deleteImmediately(){let{fileSystemWrapper:i}=this._context,u=this.getPath();this.forget(),await i.deleteDirectoryImmediately(u)}deleteImmediatelySync(){let{fileSystemWrapper:i}=this._context,u=this.getPath();this.forget(),i.deleteDirectoryImmediatelySync(u)}forget(){if(!this.wasForgotten()){for(let i of this.getSourceFiles())i.forget();for(let i of this.getDirectories())i.forget();this._forgetOnlyThis()}}_forgetOnlyThis(){this.wasForgotten()||(this._context.compilerFactory.removeDirectoryFromCache(this.getPath()),this.__context=void 0)}async save(){await this._context.fileSystemWrapper.saveForDirectory(this.getPath());let i=this.getDescendantSourceFiles().filter(u=>!u.isSaved());await Promise.all(i.map(u=>u.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(u=>!u.isSaved()).forEach(u=>u.saveSync())}getRelativePathTo(i){let u=this;return E.FileUtils.getRelativePathTo(this.getPath(),S());function S(){return i instanceof iA?i.getFilePath():i instanceof y?i.getPath():u._context.fileSystemWrapper.getStandardizedAbsolutePath(i,u.getPath())}}getRelativePathAsModuleSpecifierTo(i){let u=this._context.program.getEmitModuleResolutionKind(),S=this,P=E.FileUtils.getRelativePathTo(this.getPath(),z()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return P.startsWith("../")?P:"./"+P;function z(){return i instanceof iA?re(i):i instanceof y?Ie(i):at(S._context.fileSystemWrapper.getStandardizedAbsolutePath(i,S.getPath()));function re(We){return at(We.getFilePath())}function Ie(We){switch(u){case E.ModuleResolutionKind.Node10:return We===S?E.FileUtils.pathJoin(We.getPath(),"index.ts"):We.getPath();case E.ModuleResolutionKind.Classic:case E.ModuleResolutionKind.Node16:case E.ModuleResolutionKind.NodeNext:case E.ModuleResolutionKind.Bundler:return E.FileUtils.pathJoin(We.getPath(),"index.ts");default:return E.errors.throwNotImplementedForNeverValueError(u)}}function at(We){let Ue=E.FileUtils.getDirPath(We);switch(u){case E.ModuleResolutionKind.Node10:return Ue===S.getPath()?We:We.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case E.ModuleResolutionKind.Classic:case E.ModuleResolutionKind.Node16:case E.ModuleResolutionKind.NodeNext:case E.ModuleResolutionKind.Bundler:return We;default:return E.errors.throwNotImplementedForNeverValueError(u)}}}}getProject(){return this._context.project}wasForgotten(){return this.__context==null}_isInProject(){return this._context.inProjectCoordinator.isDirectoryInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markDirectoryAsInProject(this)}_hasLoadedParent(){return this._context.compilerFactory.containsDirectoryAtPath(E.FileUtils.getDirPath(this.getPath()))}_throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new E.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}_getReferencesForCopy(i){return i._getReferencesForCopyInternal().filter(S=>!this.isAncestorOf(S[1]))}_getReferencesForMove(i){let{literalReferences:u,referencingLiterals:S}=i._getReferencesForMoveInternal();return{literalReferences:u.filter(P=>!this.isAncestorOf(P[1])),referencingLiterals:S.filter(P=>!this.isAncestorOf(P._sourceFile))}}static _isAncestorOfDir(i,u){if(u instanceof iA&&(u=u.getDirectory(),i===u))return!0;if(i._pathParts.length>=u._pathParts.length)return!1;for(let S=i._pathParts.length-1;S>=0;S--)if(i._pathParts[S]!==u._pathParts[S])return!1;return!0}};function Nge(y){return y=E.ObjectUtils.clone(y||{}),ad(y,"includeUntrackedFiles",!0),y}function u5e(y){return typeof y=="string"}var oye=class{constructor(i,u){this.compilerFactory=i,this.fileSystemWrapper=u}addDirectoryAtPathIfExists(i,u){let S=this.compilerFactory.getDirectoryFromPath(i,u);if(S!=null){if(u.recursive)for(let P of E.FileUtils.getDescendantDirectories(this.fileSystemWrapper,i))this.compilerFactory.createDirectoryOrAddIfExists(P,u);return S}}addDirectoryAtPath(i,u){let S=this.addDirectoryAtPathIfExists(i,u);if(S==null)throw new E.errors.DirectoryNotFoundError(i);return S}createDirectoryOrAddIfExists(i,u){return this.compilerFactory.createDirectoryOrAddIfExists(i,u)}addSourceFileAtPathIfExists(i,u){return this.compilerFactory.addOrGetSourceFileFromFilePath(i,{markInProject:u.markInProject,scriptKind:void 0})}addSourceFileAtPath(i,u){let S=this.addSourceFileAtPathIfExists(i,u);if(S==null)throw new E.errors.FileNotFoundError(this.fileSystemWrapper.getStandardizedAbsolutePath(i));return S}addSourceFilesAtPaths(i,u){typeof i=="string"&&(i=[i]);let S=[],P=new Set;for(let z of this.fileSystemWrapper.globSync(i)){let re=this.addSourceFileAtPathIfExists(z,u);re!=null&&S.push(re),P.add(E.FileUtils.getDirPath(z))}for(let z of E.FileUtils.getParentMostPaths(Array.from(P)))this.addDirectoryAtPathIfExists(z,{recursive:!0,markInProject:u.markInProject});return S}},aye=class{constructor(i){this.context=i,this.directoriesByPath=new E.KeyValueCache,this.sourceFilesByDirPath=new E.KeyValueCache,this.directoriesByDirPath=new E.KeyValueCache,this.orphanDirs=new E.KeyValueCache}has(i){return this.directoriesByPath.has(i)}get(i){if(!this.directoriesByPath.has(i)){for(let u of this.orphanDirs.getValues())if(E.FileUtils.pathStartsWith(u.getPath(),i))return this.createOrAddIfExists(i);return}return this.directoriesByPath.get(i)}getOrphans(){return this.orphanDirs.getValues()}getAll(){return this.directoriesByPath.getValuesAsArray()}*getAllByDepth(){let i=new E.KeyValueCache,u=0;for(let P of this.getOrphans())S(P);for(u=Math.min(...Array.from(i.getKeys()));i.getSize()>0;){for(let P of i.get(u)||[])yield P,P.getDirectories().forEach(S);i.removeByKey(u),u++}function S(P){let z=P._getDepth();if(u>z)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${P.getPath()}`);i.getOrCreate(z,()=>[]).push(P)}}remove(i){this.removeFromDirectoriesByDirPath(i),this.directoriesByPath.removeByKey(i),this.orphanDirs.removeByKey(i)}*getChildDirectoriesOfDirectory(i){var u;let S=(u=this.directoriesByDirPath.get(i))===null||u===void 0?void 0:u.entries();if(S!=null)for(let P of S)yield P}*getChildSourceFilesOfDirectory(i){var u;let S=(u=this.sourceFilesByDirPath.get(i))===null||u===void 0?void 0:u.entries();if(S!=null)for(let P of S)yield P}addSourceFile(i){let u=i.getDirectoryPath();this.createOrAddIfExists(u),this.sourceFilesByDirPath.getOrCreate(u,()=>new E.SortedKeyValueArray(P=>P.getBaseName(),E.LocaleStringComparer.instance)).set(i)}removeSourceFile(i){let u=E.FileUtils.getDirPath(i),S=this.sourceFilesByDirPath.get(u);S!=null&&(S.removeByKey(E.FileUtils.getBaseName(i)),S.hasItems()||this.sourceFilesByDirPath.removeByKey(u))}createOrAddIfExists(i){return this.has(i)?this.get(i):(this.fillParentsOfDirPath(i),this.createDirectory(i))}createDirectory(i){let u=new P$(this.context,i);return this.addDirectory(u),u}addDirectory(i){let u=i.getPath(),S=E.FileUtils.getDirPath(u),P=S===u;for(let z of this.orphanDirs.getValues()){let re=z.getPath(),Ie=E.FileUtils.getDirPath(re);!(Ie===re)&&Ie===u&&this.orphanDirs.removeByKey(re)}P||this.addToDirectoriesByDirPath(i),this.has(S)||this.orphanDirs.set(u,i),this.directoriesByPath.set(u,i),this.context.fileSystemWrapper.directoryExistsSync(u)||this.context.fileSystemWrapper.queueMkdir(u);for(let z of this.orphanDirs.getValues())i.isAncestorOf(z)&&this.fillParentsOfDirPath(z.getPath())}addToDirectoriesByDirPath(i){if(E.FileUtils.isRootDirPath(i.getPath()))return;let u=E.FileUtils.getDirPath(i.getPath());this.directoriesByDirPath.getOrCreate(u,()=>new E.SortedKeyValueArray(P=>P.getBaseName(),E.LocaleStringComparer.instance)).set(i)}removeFromDirectoriesByDirPath(i){if(E.FileUtils.isRootDirPath(i))return;let u=E.FileUtils.getDirPath(i),S=this.directoriesByDirPath.get(u);S!=null&&(S.removeByKey(E.FileUtils.getBaseName(i)),S.hasItems()||this.directoriesByDirPath.removeByKey(u))}fillParentsOfDirPath(i){let u=[],S=E.FileUtils.getDirPath(i);for(;i!==S;){if(i=S,S=E.FileUtils.getDirPath(i),this.directoriesByPath.has(i)){for(let P of u)this.createDirectory(P);break}u.unshift(i)}}},sye=class extends E.KeyValueCache{constructor(){super(...arguments),this.forgetStack=[]}getOrCreate(i,u){return super.getOrCreate(i,()=>{let S=u();return this.forgetStack.length>0&&this.forgetStack[this.forgetStack.length-1].add(S),S})}setForgetPoint(){this.forgetStack.push(new Set)}forgetLastPoint(){let i=this.forgetStack.pop();i!=null&&this.forgetNodes(i.values())}rememberNode(i){if(i.wasForgotten())throw new E.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let u=!1;for(let S of this.forgetStack)if(S.delete(i)){u=!0;break}return u&&this.rememberParentOfNode(i),u}rememberParentOfNode(i){let u=i.getParentSyntaxList()||i.getParent();u!=null&&this.rememberNode(u)}forgetNodes(i){for(let u of i)u.wasForgotten()||u.getKind()===E.SyntaxKind.SourceFile||u._forgetOnlyThis()}},tDt={[E.SyntaxKind.SourceFile]:iA,[E.SyntaxKind.ArrayBindingPattern]:Fj,[E.SyntaxKind.ArrayLiteralExpression]:zj,[E.SyntaxKind.ArrayType]:hq,[E.SyntaxKind.ArrowFunction]:rq,[E.SyntaxKind.AsExpression]:Vj,[E.SyntaxKind.AssertClause]:WJ,[E.SyntaxKind.AssertEntry]:BJ,[E.SyntaxKind.AwaitExpression]:Uj,[E.SyntaxKind.BigIntLiteral]:n$,[E.SyntaxKind.BindingElement]:Wj,[E.SyntaxKind.BinaryExpression]:l3,[E.SyntaxKind.Block]:gJ,[E.SyntaxKind.BreakStatement]:hJ,[E.SyntaxKind.CallExpression]:Kj,[E.SyntaxKind.CallSignature]:kX,[E.SyntaxKind.CaseBlock]:yJ,[E.SyntaxKind.CaseClause]:vJ,[E.SyntaxKind.CatchClause]:bJ,[E.SyntaxKind.ClassDeclaration]:sq,[E.SyntaxKind.ClassExpression]:lq,[E.SyntaxKind.ClassStaticBlockDeclaration]:cq,[E.SyntaxKind.ConditionalType]:yq,[E.SyntaxKind.Constructor]:dq,[E.SyntaxKind.ConstructorType]:vq,[E.SyntaxKind.ConstructSignature]:OX,[E.SyntaxKind.ContinueStatement]:SJ,[E.SyntaxKind.CommaListExpression]:Hj,[E.SyntaxKind.ComputedPropertyName]:zX,[E.SyntaxKind.ConditionalExpression]:jj,[E.SyntaxKind.DebuggerStatement]:TJ,[E.SyntaxKind.Decorator]:mq,[E.SyntaxKind.DefaultClause]:xJ,[E.SyntaxKind.DeleteExpression]:Jj,[E.SyntaxKind.DoStatement]:AJ,[E.SyntaxKind.ElementAccessExpression]:u3,[E.SyntaxKind.EmptyStatement]:DJ,[E.SyntaxKind.EnumDeclaration]:PX,[E.SyntaxKind.EnumMember]:MX,[E.SyntaxKind.ExportAssignment]:GJ,[E.SyntaxKind.ExportDeclaration]:zJ,[E.SyntaxKind.ExportSpecifier]:VJ,[E.SyntaxKind.ExpressionWithTypeArguments]:bq,[E.SyntaxKind.ExpressionStatement]:IJ,[E.SyntaxKind.ExternalModuleReference]:UJ,[E.SyntaxKind.QualifiedName]:UX,[E.SyntaxKind.ForInStatement]:CJ,[E.SyntaxKind.ForOfStatement]:NJ,[E.SyntaxKind.ForStatement]:RJ,[E.SyntaxKind.FunctionDeclaration]:iq,[E.SyntaxKind.FunctionExpression]:oq,[E.SyntaxKind.FunctionType]:Eq,[E.SyntaxKind.GetAccessor]:pq,[E.SyntaxKind.HeritageClause]:LX,[E.SyntaxKind.Identifier]:_3,[E.SyntaxKind.IfStatement]:PJ,[E.SyntaxKind.ImportClause]:KJ,[E.SyntaxKind.ImportDeclaration]:HJ,[E.SyntaxKind.ImportEqualsDeclaration]:jJ,[E.SyntaxKind.ImportSpecifier]:JJ,[E.SyntaxKind.ImportType]:Tq,[E.SyntaxKind.ImportTypeAssertionContainer]:Sq,[E.SyntaxKind.IndexedAccessType]:xq,[E.SyntaxKind.IndexSignature]:FX,[E.SyntaxKind.InferType]:Aq,[E.SyntaxKind.InterfaceDeclaration]:WX,[E.SyntaxKind.IntersectionType]:Dq,[E.SyntaxKind.JSDocAllType]:Uq,[E.SyntaxKind.JSDocAugmentsTag]:Kq,[E.SyntaxKind.JSDocAuthorTag]:Hq,[E.SyntaxKind.JSDocCallbackTag]:jq,[E.SyntaxKind.JSDocClassTag]:Jq,[E.SyntaxKind.JSDocDeprecatedTag]:qq,[E.SyntaxKind.JSDocEnumTag]:Xq,[E.SyntaxKind.JSDocFunctionType]:$q,[E.SyntaxKind.JSDocImplementsTag]:Yq,[E.SyntaxKind.JSDocLink]:Qq,[E.SyntaxKind.JSDocLinkCode]:Zq,[E.SyntaxKind.JSDocLinkPlain]:eX,[E.SyntaxKind.JSDocMemberName]:tX,[E.SyntaxKind.JSDocNamepathType]:nX,[E.SyntaxKind.JSDocNameReference]:rX,[E.SyntaxKind.JSDocNonNullableType]:iX,[E.SyntaxKind.JSDocNullableType]:oX,[E.SyntaxKind.JSDocOptionalType]:aX,[E.SyntaxKind.JSDocOverrideTag]:lX,[E.SyntaxKind.JSDocParameterTag]:cX,[E.SyntaxKind.JSDocPrivateTag]:uX,[E.SyntaxKind.JSDocPropertyTag]:dX,[E.SyntaxKind.JSDocProtectedTag]:pX,[E.SyntaxKind.JSDocPublicTag]:fX,[E.SyntaxKind.JSDocReturnTag]:mX,[E.SyntaxKind.JSDocReadonlyTag]:_X,[E.SyntaxKind.JSDocThrowsTag]:SX,[E.SyntaxKind.JSDocOverloadTag]:sX,[E.SyntaxKind.JSDocSatisfiesTag]:gX,[E.SyntaxKind.JSDocSeeTag]:hX,[E.SyntaxKind.JSDocSignature]:yX,[E.SyntaxKind.JSDocTag]:IX,[E.SyntaxKind.JSDocTemplateTag]:vX,[E.SyntaxKind.JSDocText]:bX,[E.SyntaxKind.JSDocThisTag]:EX,[E.SyntaxKind.JSDocTypeExpression]:xX,[E.SyntaxKind.JSDocTypeLiteral]:AX,[E.SyntaxKind.JSDocTypeTag]:DX,[E.SyntaxKind.JSDocTypedefTag]:TX,[E.SyntaxKind.JSDocUnknownType]:CX,[E.SyntaxKind.JSDocVariadicType]:NX,[E.SyntaxKind.JsxAttribute]:KX,[E.SyntaxKind.JsxClosingElement]:HX,[E.SyntaxKind.JsxClosingFragment]:jX,[E.SyntaxKind.JsxElement]:JX,[E.SyntaxKind.JsxExpression]:qX,[E.SyntaxKind.JsxFragment]:XX,[E.SyntaxKind.JsxNamespacedName]:$X,[E.SyntaxKind.JsxOpeningElement]:YX,[E.SyntaxKind.JsxOpeningFragment]:QX,[E.SyntaxKind.JsxSelfClosingElement]:ZX,[E.SyntaxKind.JsxSpreadAttribute]:e$,[E.SyntaxKind.JsxText]:t$,[E.SyntaxKind.LabeledStatement]:MJ,[E.SyntaxKind.LiteralType]:Iq,[E.SyntaxKind.MappedType]:Cq,[E.SyntaxKind.MetaProperty]:Xj,[E.SyntaxKind.MethodDeclaration]:ck,[E.SyntaxKind.MethodSignature]:BX,[E.SyntaxKind.ModuleBlock]:qJ,[E.SyntaxKind.ModuleDeclaration]:XJ,[E.SyntaxKind.NamedExports]:$J,[E.SyntaxKind.NamedImports]:YJ,[E.SyntaxKind.NamedTupleMember]:Nq,[E.SyntaxKind.NamespaceExport]:QJ,[E.SyntaxKind.NamespaceImport]:ZJ,[E.SyntaxKind.NewExpression]:$j,[E.SyntaxKind.NonNullExpression]:Yj,[E.SyntaxKind.NotEmittedStatement]:LJ,[E.SyntaxKind.NoSubstitutionTemplateLiteral]:c$,[E.SyntaxKind.NumericLiteral]:a$,[E.SyntaxKind.ObjectBindingPattern]:Bj,[E.SyntaxKind.ObjectLiteralExpression]:Zj,[E.SyntaxKind.OmittedExpression]:rJ,[E.SyntaxKind.Parameter]:aq,[E.SyntaxKind.ParenthesizedExpression]:iJ,[E.SyntaxKind.ParenthesizedType]:Rq,[E.SyntaxKind.PartiallyEmittedExpression]:oJ,[E.SyntaxKind.PostfixUnaryExpression]:aJ,[E.SyntaxKind.PrefixUnaryExpression]:sJ,[E.SyntaxKind.PrivateIdentifier]:VX,[E.SyntaxKind.PropertyAccessExpression]:d3,[E.SyntaxKind.PropertyAssignment]:eJ,[E.SyntaxKind.PropertyDeclaration]:fq,[E.SyntaxKind.PropertySignature]:GX,[E.SyntaxKind.RegularExpressionLiteral]:s$,[E.SyntaxKind.RestType]:Pq,[E.SyntaxKind.ReturnStatement]:kJ,[E.SyntaxKind.SatisfiesExpression]:lJ,[E.SyntaxKind.SetAccessor]:_q,[E.SyntaxKind.ShorthandPropertyAssignment]:tJ,[E.SyntaxKind.SpreadAssignment]:nJ,[E.SyntaxKind.SpreadElement]:cJ,[E.SyntaxKind.StringLiteral]:l$,[E.SyntaxKind.SwitchStatement]:wJ,[E.SyntaxKind.SyntaxList]:kj,[E.SyntaxKind.TaggedTemplateExpression]:u$,[E.SyntaxKind.TemplateExpression]:d$,[E.SyntaxKind.TemplateHead]:p$,[E.SyntaxKind.TemplateLiteralType]:Mq,[E.SyntaxKind.TemplateMiddle]:f$,[E.SyntaxKind.TemplateSpan]:_$,[E.SyntaxKind.TemplateTail]:m$,[E.SyntaxKind.ThisType]:Lq,[E.SyntaxKind.ThrowStatement]:OJ,[E.SyntaxKind.TryStatement]:FJ,[E.SyntaxKind.TupleType]:kq,[E.SyntaxKind.TypeAliasDeclaration]:wq,[E.SyntaxKind.TypeAssertionExpression]:pJ,[E.SyntaxKind.TypeLiteral]:Oq,[E.SyntaxKind.TypeOperator]:Fq,[E.SyntaxKind.TypeParameter]:Wq,[E.SyntaxKind.TypePredicate]:Bq,[E.SyntaxKind.TypeQuery]:Gq,[E.SyntaxKind.TypeReference]:zq,[E.SyntaxKind.UnionType]:Vq,[E.SyntaxKind.VariableDeclaration]:g$,[E.SyntaxKind.VariableDeclarationList]:h$,[E.SyntaxKind.VariableStatement]:eq,[E.SyntaxKind.JSDoc]:gq,[E.SyntaxKind.TypeOfExpression]:fJ,[E.SyntaxKind.WhileStatement]:tq,[E.SyntaxKind.WithStatement]:nq,[E.SyntaxKind.YieldExpression]:mJ,[E.SyntaxKind.SemicolonToken]:Ae,[E.SyntaxKind.AnyKeyword]:Zd,[E.SyntaxKind.BooleanKeyword]:Zd,[E.SyntaxKind.FalseKeyword]:i$,[E.SyntaxKind.ImportKeyword]:qj,[E.SyntaxKind.InferKeyword]:Ae,[E.SyntaxKind.NeverKeyword]:Ae,[E.SyntaxKind.NullKeyword]:o$,[E.SyntaxKind.NumberKeyword]:Zd,[E.SyntaxKind.ObjectKeyword]:Zd,[E.SyntaxKind.StringKeyword]:Zd,[E.SyntaxKind.SymbolKeyword]:Zd,[E.SyntaxKind.SuperKeyword]:uJ,[E.SyntaxKind.ThisKeyword]:dJ,[E.SyntaxKind.TrueKeyword]:r$,[E.SyntaxKind.UndefinedKeyword]:Zd,[E.SyntaxKind.VoidExpression]:_J},lye=class{constructor(i){this.context=i,this.sourceFileCacheByFilePath=new Map,this.diagnosticCache=new E.WeakCache,this.definitionInfoCache=new E.WeakCache,this.documentSpanCache=new E.WeakCache,this.diagnosticMessageChainCache=new E.WeakCache,this.jsDocTagInfoCache=new E.WeakCache,this.signatureCache=new E.WeakCache,this.symbolCache=new E.WeakCache,this.symbolDisplayPartCache=new E.WeakCache,this.referencedSymbolEntryCache=new E.WeakCache,this.referencedSymbolCache=new E.WeakCache,this.referencedSymbolDefinitionInfoCache=new E.WeakCache,this.typeCache=new E.WeakCache,this.typeParameterCache=new E.WeakCache,this.nodeCache=new sye,this.sourceFileAddedEventContainer=new E.EventContainer,this.sourceFileRemovedEventContainer=new E.EventContainer,this.documentRegistry=new E.DocumentRegistry(i.fileSystemWrapper),this.directoryCache=new aye(i),this.context.compilerOptions.onModified(()=>{let u=Array.from(this.sourceFileCacheByFilePath.values());for(let S of u)_1t(S)})}*getSourceFilesByDirectoryDepth(){for(let i of this.getDirectoriesByDepth())yield*i.getSourceFiles()}getSourceFilePaths(){return this.sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(i){return this.directoryCache.getChildDirectoriesOfDirectory(i)}getChildSourceFilesOfDirectory(i){return this.directoryCache.getChildSourceFilesOfDirectory(i)}onSourceFileAdded(i,u=!0){u?this.sourceFileAddedEventContainer.subscribe(i):this.sourceFileAddedEventContainer.unsubscribe(i)}onSourceFileRemoved(i){this.sourceFileRemovedEventContainer.subscribe(i)}createSourceFile(i,u,S){if(u=u instanceof Function?S0(this.context.createWriter(),u):u||"",typeof u=="string")return this.createSourceFileFromText(i,u,S);let P=this.context.createWriter();return this.context.structurePrinterFactory.forSourceFile({isAmbient:E.FileUtils.getExtension(i)===".d.ts"}).printText(P,u),this.createSourceFileFromText(i,P.toString(),S)}createSourceFileFromText(i,u,S){return i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(i),S.overwrite===!0?this.createOrOverwriteSourceFileFromText(i,u,S):(this.throwIfFileExists(i,"Did you mean to provide the overwrite option?"),this.createSourceFileFromTextInternal(i,u,S))}throwIfFileExists(i,u){if(!(!this.containsSourceFileAtPath(i)&&!this.context.fileSystemWrapper.fileExistsSync(i)))throw u=u==null?"":u+" ",new E.errors.InvalidOperationError(`${u}A source file already exists at the provided file path: ${i}`)}createOrOverwriteSourceFileFromText(i,u,S){i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(i);let P=this.addOrGetSourceFileFromFilePath(i,S);return P!=null?(P.getChildren().forEach(z=>z.forget()),this.replaceCompilerNode(P,this.createCompilerSourceFileFromText(i,u,S.scriptKind)),P):this.createSourceFileFromTextInternal(i,u,S)}getSourceFileFromCacheFromFilePath(i){return i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(i),this.sourceFileCacheByFilePath.get(i)}addOrGetSourceFileFromFilePath(i,u){i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(i);let S=this.sourceFileCacheByFilePath.get(i);if(S==null){let P=this.context.fileSystemWrapper.readFileIfExistsSync(i,this.context.getEncoding());P!=null&&(this.context.logger.log(`Loaded file: ${i}`),S=this.createSourceFileFromTextInternal(i,P,u),S._setIsSaved(!0))}return S!=null&&u.markInProject&&S._markAsInProject(),S}containsSourceFileAtPath(i){return i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(i),this.sourceFileCacheByFilePath.has(i)}containsDirectoryAtPath(i){return i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(i),this.directoryCache.has(i)}getSourceFileForNode(i){let u=i;for(;u.kind!==E.SyntaxKind.SourceFile;){if(u.parent==null)return;u=u.parent}return this.getSourceFile(u,{markInProject:!1})}hasCompilerNode(i){return this.nodeCache.has(i)}getExistingNodeFromCompilerNode(i){return this.nodeCache.get(i)}getNodeFromCompilerNode(i,u){if(i.kind===E.SyntaxKind.SourceFile)return this.getSourceFile(i,{markInProject:!1});return this.nodeCache.getOrCreate(i,()=>{let re=S.call(this);return z.call(this,re),re});function S(){if(P(i))return Ky.isCommentStatement(i)?new EJ(this.context,i,u):Ky.isCommentClassElement(i)?new uq(this.context,i,u):Ky.isCommentTypeElement(i)?new wX(this.context,i,u):Ky.isCommentObjectLiteralElement(i)?new Qj(this.context,i,u):Ky.isCommentEnumMember(i)?new RX(this.context,i,u):E.errors.throwNotImplementedForNeverValueError(i);let re=tDt[i.kind]||Ae;return new re(this.context,i,u)}function P(re){return re._commentKind!=null}function z(re){if(i.parent!=null){let at=this.getNodeFromCompilerNode(i.parent,u);at._wrappedChildCount++}let Ie=re._getParentSyntaxListIfWrapped();if(Ie!=null&&Ie._wrappedChildCount++,i.kind===E.SyntaxKind.SyntaxList){let at=0;for(let We of re._getChildrenInCacheIterator())at++;re._wrappedChildCount=at}}}createSourceFileFromTextInternal(i,u,S){let P=E.StringUtils.hasBom(u);P&&(u=E.StringUtils.stripBom(u));let z=this.getSourceFile(this.createCompilerSourceFileFromText(i,u,S.scriptKind),S);return P&&(z._hasBom=!0),z}createCompilerSourceFileFromText(i,u,S){return this.documentRegistry.createOrUpdateSourceFile(i,this.context.compilerOptions.get(),E.ts.ScriptSnapshot.fromString(u),S)}getSourceFile(i,u){var S;let P=!1,z=(S=this.sourceFileCacheByFilePath.get(i.fileName))!==null&&S!==void 0?S:this.nodeCache.getOrCreate(i,()=>{let re=new iA(this.context,i);return u.markInProject||this.context.inProjectCoordinator.setSourceFileNotInProject(re),this.addSourceFileToCache(re),P=!0,re});return u.markInProject&&z._markAsInProject(),P&&this.sourceFileAddedEventContainer.fire(z),z}addSourceFileToCache(i){this.sourceFileCacheByFilePath.set(i.getFilePath(),i),this.context.fileSystemWrapper.removeFileDelete(i.getFilePath()),this.directoryCache.addSourceFile(i)}getDirectoryFromPath(i,u){i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(i);let S=this.directoryCache.get(i);return S==null&&this.context.fileSystemWrapper.directoryExistsSync(i)&&(S=this.directoryCache.createOrAddIfExists(i)),S!=null&&u.markInProject&&S._markAsInProject(),S}createDirectoryOrAddIfExists(i,u){let S=this.directoryCache.createOrAddIfExists(i);return S!=null&&u.markInProject&&S._markAsInProject(),S}getDirectoryFromCache(i){return this.directoryCache.get(i)}getDirectoryFromCacheOnlyIfInCache(i){return this.directoryCache.has(i)?this.directoryCache.get(i):void 0}getDirectoriesByDepth(){return this.directoryCache.getAllByDepth()}getOrphanDirectories(){return this.directoryCache.getOrphans()}getSymbolDisplayPart(i){return this.symbolDisplayPartCache.getOrCreate(i,()=>new I$(i))}getType(i){return(i.flags&E.TypeFlags.TypeParameter)===E.TypeFlags.TypeParameter?this.getTypeParameter(i):this.typeCache.getOrCreate(i,()=>new x3(this.context,i))}getTypeParameter(i){return this.typeParameterCache.getOrCreate(i,()=>new R$(this.context,i))}getSignature(i){return this.signatureCache.getOrCreate(i,()=>new y$(this.context,i))}getSymbol(i){return this.symbolCache.getOrCreate(i,()=>new v$(this.context,i))}getDefinitionInfo(i){return this.definitionInfoCache.getOrCreate(i,()=>new dk(this.context,i))}getDocumentSpan(i){return this.documentSpanCache.getOrCreate(i,()=>new iS(this.context,i))}getReferencedSymbolEntry(i){return this.referencedSymbolEntryCache.getOrCreate(i,()=>new A$(this.context,i))}getReferencedSymbol(i){return this.referencedSymbolCache.getOrCreate(i,()=>new E3(this.context,i))}getReferencedSymbolDefinitionInfo(i){return this.referencedSymbolDefinitionInfoCache.getOrCreate(i,()=>new S3(this.context,i))}getDiagnostic(i){return this.diagnosticCache.getOrCreate(i,()=>i.start!=null?new h3(this.context,i):new BR(this.context,i))}getDiagnosticWithLocation(i){return this.diagnosticCache.getOrCreate(i,()=>new h3(this.context,i))}getDiagnosticMessageChain(i){return this.diagnosticMessageChainCache.getOrCreate(i,()=>new g3(i))}getJSDocTagInfo(i){return this.jsDocTagInfoCache.getOrCreate(i,()=>new f3(i))}replaceCompilerNode(i,u){let S=i instanceof Ae?i.compilerNode:i,P=i instanceof Ae?i:this.nodeCache.get(i);if(S.kind===E.SyntaxKind.SourceFile&&S.fileName!==u.fileName){let z=P;this.removeCompilerNodeFromCache(S),z._replaceCompilerNodeFromFactory(u),this.nodeCache.set(u,z),this.addSourceFileToCache(z),this.sourceFileAddedEventContainer.fire(z)}else this.nodeCache.replaceKey(S,u),P?._replaceCompilerNodeFromFactory(u)}removeNodeFromCache(i){this.removeCompilerNodeFromCache(i.compilerNode)}removeCompilerNodeFromCache(i){if(this.nodeCache.removeByKey(i),i.kind===E.SyntaxKind.SourceFile){let u=i,S=this.context.fileSystemWrapper.getStandardizedAbsolutePath(u.fileName);this.directoryCache.removeSourceFile(S);let P=this.sourceFileCacheByFilePath.get(S);this.sourceFileCacheByFilePath.delete(S),this.documentRegistry.removeSourceFile(S),P!=null&&this.sourceFileRemovedEventContainer.fire(P)}}addDirectoryToCache(i){this.directoryCache.addDirectory(i)}removeDirectoryFromCache(i){this.directoryCache.remove(i)}forgetNodesCreatedInBlock(i){this.nodeCache.setForgetPoint();let u=!1,S;try{if(S=i((...z)=>{for(let re of z)this.nodeCache.rememberNode(re)}),Ae.isNode(S)&&this.nodeCache.rememberNode(S),P(S))return u=!0,S.then(z=>(Ae.isNode(z)&&this.nodeCache.rememberNode(z),this.nodeCache.forgetLastPoint(),z))}finally{u||this.nodeCache.forgetLastPoint()}return S;function P(z){return z!=null&&typeof z.then=="function"}}},cye=class{constructor(i){this.compilerFactory=i,this.notInProjectFiles=new Set,i.onSourceFileRemoved(u=>{this.notInProjectFiles.delete(u)})}setSourceFileNotInProject(i){this.notInProjectFiles.add(i),i._inProject=!1}markSourceFileAsInProject(i){this.isSourceFileInProject(i)||(this._internalMarkSourceFileAsInProject(i),this.notInProjectFiles.delete(i))}markSourceFilesAsInProjectForResolution(){let i="/node_modules/",u=this.compilerFactory,S=[],P=[];for(let re of[...this.notInProjectFiles.values()])z(re)?(this._internalMarkSourceFileAsInProject(re),this.notInProjectFiles.delete(re),S.push(re)):P.push(re);return{changedSourceFiles:S,unchangedSourceFiles:P};function z(re){let Ie=re.getFilePath(),at=Ie.toLowerCase().lastIndexOf(i);if(at===-1)return!0;let We=Ie.substring(0,at+i.length-1),Ue=u.getDirectoryFromCacheOnlyIfInCache(We);if(Ue!=null&&Ue._isInProject())return!0;let Yt=re.getDirectory();for(;Yt!=null&&Yt.getPath()!==We;){if(Yt._isInProject())return!0;Yt=u.getDirectoryFromCacheOnlyIfInCache(E.FileUtils.getDirPath(Yt.getPath()))}return!1}}_internalMarkSourceFileAsInProject(i){i._inProject=!0,this.markDirectoryAsInProject(i.getDirectory())}isSourceFileInProject(i){return i._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(i){for(let u of i.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(u);for(let u of i.getSourceFiles())delete u._inProject,this.notInProjectFiles.add(u);delete i._inProject}markDirectoryAsInProject(i){if(this.isDirectoryInProject(i))return;let u=this,S=this.compilerFactory;i._inProject=!0,P(i);function P(re){let Ie=Array.from(z(re)),at=Ie[Ie.length-1];if(!(at==null||!u.isDirectoryInProject(at)))for(let We of Ie)We._inProject=!0}function*z(re){if(E.FileUtils.isRootDirPath(re.getPath()))return;let Ie=E.FileUtils.getDirPath(re.getPath()),at=S.getDirectoryFromCacheOnlyIfInCache(Ie);at!=null&&(yield at,u.isDirectoryInProject(at)||(yield*z(at)))}}isDirectoryInProject(i){return i._inProject===!0}},Ss=class{constructor(i){this._getFormatCodeSettings=i}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new ehe}forModifierableNode(){return new the}forReturnTypedNode(i){return new nhe(i)}forTypedNode(i,u){return new rhe(i,u)}forClassDeclaration(i){return new ohe(this,i)}forClassMember(i){return new ahe(this,i)}forClassStaticBlockDeclaration(){return new she(this)}forConstructorDeclaration(i){return new lhe(this,i)}forGetAccessorDeclaration(i){return new che(this,i)}forMethodDeclaration(i){return new uhe(this,i)}forPropertyDeclaration(){return new dhe(this)}forSetAccessorDeclaration(i){return new phe(this,i)}forDecorator(){return new fhe(this)}forJSDoc(){return new _he(this)}forJSDocTag(i){return new mhe(this,i)}forEnumDeclaration(){return new ghe(this)}forEnumMember(){return new hhe(this)}forObjectLiteralExpressionProperty(){return new yhe(this)}forPropertyAssignment(){return new vhe(this)}forShorthandPropertyAssignment(){return new bhe(this)}forSpreadAssignment(){return new Ehe(this)}forFunctionDeclaration(i){return new She(this,i)}forParameterDeclaration(){return new The(this)}forCallSignatureDeclaration(){return new xhe(this)}forConstructSignatureDeclaration(){return new Ahe(this)}forIndexSignatureDeclaration(){return new Dhe(this)}forInterfaceDeclaration(){return new Ihe(this)}forMethodSignature(){return new Che(this)}forPropertySignature(){return new Nhe(this)}forTypeElementMemberedNode(){return new Rhe(this)}forTypeElementMember(){return new Phe(this)}forJsxAttributeDecider(){return new Mhe(this)}forJsxAttribute(){return new Lhe(this)}forJsxChildDecider(){return new khe(this)}forJsxElement(){return new whe(this)}forJsxNamespacedName(){return new Ohe(this)}forJsxSelfClosingElement(){return new Fhe(this)}forJsxSpreadAttribute(){return new Whe(this)}forAssertEntry(){return new Bhe(this)}forExportAssignment(){return new Ghe(this)}forExportDeclaration(){return new zhe(this)}forImportDeclaration(){return new Vhe(this)}forModuleDeclaration(i){return new Uhe(this,i)}forNamedImportExportSpecifier(){return new Khe(this)}forSourceFile(i){return new Hhe(this,i)}forStatementedNode(i){return new jhe(this,i)}forStatement(i){return new Jhe(this,i)}forVariableStatement(){return new qhe(this)}forTypeAliasDeclaration(){return new Xhe(this)}forTypeParameterDeclaration(){return new $he(this)}forVariableDeclaration(){return new Yhe(this)}};xa([E.Memoize],Ss.prototype,"forInitializerExpressionableNode",null);xa([E.Memoize],Ss.prototype,"forModifierableNode",null);xa([E.Memoize],Ss.prototype,"forReturnTypedNode",null);xa([E.Memoize],Ss.prototype,"forTypedNode",null);xa([E.Memoize],Ss.prototype,"forClassDeclaration",null);xa([E.Memoize],Ss.prototype,"forClassMember",null);xa([E.Memoize],Ss.prototype,"forClassStaticBlockDeclaration",null);xa([E.Memoize],Ss.prototype,"forConstructorDeclaration",null);xa([E.Memoize],Ss.prototype,"forGetAccessorDeclaration",null);xa([E.Memoize],Ss.prototype,"forMethodDeclaration",null);xa([E.Memoize],Ss.prototype,"forPropertyDeclaration",null);xa([E.Memoize],Ss.prototype,"forSetAccessorDeclaration",null);xa([E.Memoize],Ss.prototype,"forDecorator",null);xa([E.Memoize],Ss.prototype,"forJSDoc",null);xa([E.Memoize],Ss.prototype,"forJSDocTag",null);xa([E.Memoize],Ss.prototype,"forEnumDeclaration",null);xa([E.Memoize],Ss.prototype,"forEnumMember",null);xa([E.Memoize],Ss.prototype,"forObjectLiteralExpressionProperty",null);xa([E.Memoize],Ss.prototype,"forPropertyAssignment",null);xa([E.Memoize],Ss.prototype,"forShorthandPropertyAssignment",null);xa([E.Memoize],Ss.prototype,"forSpreadAssignment",null);xa([E.Memoize],Ss.prototype,"forFunctionDeclaration",null);xa([E.Memoize],Ss.prototype,"forParameterDeclaration",null);xa([E.Memoize],Ss.prototype,"forCallSignatureDeclaration",null);xa([E.Memoize],Ss.prototype,"forConstructSignatureDeclaration",null);xa([E.Memoize],Ss.prototype,"forIndexSignatureDeclaration",null);xa([E.Memoize],Ss.prototype,"forInterfaceDeclaration",null);xa([E.Memoize],Ss.prototype,"forMethodSignature",null);xa([E.Memoize],Ss.prototype,"forPropertySignature",null);xa([E.Memoize],Ss.prototype,"forTypeElementMemberedNode",null);xa([E.Memoize],Ss.prototype,"forTypeElementMember",null);xa([E.Memoize],Ss.prototype,"forJsxAttributeDecider",null);xa([E.Memoize],Ss.prototype,"forJsxAttribute",null);xa([E.Memoize],Ss.prototype,"forJsxChildDecider",null);xa([E.Memoize],Ss.prototype,"forJsxElement",null);xa([E.Memoize],Ss.prototype,"forJsxNamespacedName",null);xa([E.Memoize],Ss.prototype,"forJsxSelfClosingElement",null);xa([E.Memoize],Ss.prototype,"forJsxSpreadAttribute",null);xa([E.Memoize],Ss.prototype,"forAssertEntry",null);xa([E.Memoize],Ss.prototype,"forExportAssignment",null);xa([E.Memoize],Ss.prototype,"forExportDeclaration",null);xa([E.Memoize],Ss.prototype,"forImportDeclaration",null);xa([E.Memoize],Ss.prototype,"forModuleDeclaration",null);xa([E.Memoize],Ss.prototype,"forNamedImportExportSpecifier",null);xa([E.Memoize],Ss.prototype,"forSourceFile",null);xa([E.Memoize],Ss.prototype,"forStatementedNode",null);xa([E.Memoize],Ss.prototype,"forStatement",null);xa([E.Memoize],Ss.prototype,"forVariableStatement",null);xa([E.Memoize],Ss.prototype,"forTypeAliasDeclaration",null);xa([E.Memoize],Ss.prototype,"forTypeParameterDeclaration",null);xa([E.Memoize],Ss.prototype,"forVariableDeclaration",null);var pk=class{get project(){if(this._project==null)throw new E.errors.InvalidOperationError("This operation is not permitted in this context.");return this._project}constructor(i){this.logger=new Mge,this.manipulationSettings=new Aj,this._project=i.project,this.fileSystemWrapper=i.fileSystemWrapper,this._compilerOptions=i.compilerOptionsContainer,this.compilerFactory=new lye(this),this.inProjectCoordinator=new cye(this.compilerFactory),this.structurePrinterFactory=new Ss(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new Lge(this.compilerFactory),this.directoryCoordinator=new oye(this.compilerFactory,i.fileSystemWrapper),this._languageService=i.createLanguageService?new N$({context:this,configFileParsingDiagnostics:i.configFileParsingDiagnostics,resolutionHost:i.resolutionHost&&i.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:i.skipLoadingLibFiles,libFolderPath:i.libFolderPath}):void 0,i.typeChecker!=null&&(E.errors.throwIfTrue(i.createLanguageService,"Cannot specify a type checker and create a language service."),this._customTypeChecker=new T3(this),this._customTypeChecker._reset(()=>i.typeChecker))}get compilerOptions(){return this._compilerOptions}get languageService(){if(this._languageService==null)throw this.getToolRequiredError("language service");return this._languageService}get program(){if(this._languageService==null)throw this.getToolRequiredError("program");return this.languageService.getProgram()}get typeChecker(){if(this._customTypeChecker!=null)return this._customTypeChecker;if(this._languageService==null)throw this.getToolRequiredError("type checker");return this.program.getTypeChecker()}hasLanguageService(){return this._languageService!=null}getEncoding(){return this.compilerOptions.getEncoding()}getFormatCodeSettings(){return this.manipulationSettings.getFormatCodeSettings()}getUserPreferences(){return this.manipulationSettings.getUserPreferences()}resetProgram(){this.languageService._reset()}createWriter(){let i=this.manipulationSettings.getIndentationText();return new xj.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:i===$.IndentationText.Tab?void 0:i.length,useTabs:i===$.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===$.QuoteKind.Single})}getPreEmitDiagnostics(i){return E.ts.getPreEmitDiagnostics(this.program.compilerObject,i?.compilerNode).map(S=>this.compilerFactory.getDiagnostic(S))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(i,u)=>{var S;return Promise.resolve((S=this.compilerFactory.addOrGetSourceFileFromFilePath(i,u))===null||S===void 0?void 0:S.compilerNode)},addOrGetSourceFileFromFilePathSync:(i,u)=>{var S;return(S=this.compilerFactory.addOrGetSourceFileFromFilePath(i,u))===null||S===void 0?void 0:S.compilerNode},containsDirectoryAtPath:i=>this.compilerFactory.containsDirectoryAtPath(i),containsSourceFileAtPath:i=>this.compilerFactory.containsSourceFileAtPath(i),getSourceFileFromCacheFromFilePath:i=>{let u=this.compilerFactory.getSourceFileFromCacheFromFilePath(i);return u?.compilerNode},getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:i=>this.compilerFactory.documentRegistry.getSourceFileVersion(i),getChildDirectoriesOfDirectory:i=>{let u=[];for(let S of this.compilerFactory.getChildDirectoriesOfDirectory(i))u.push(S.getPath());return u}}}getModuleResolutionHost(){return E.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}getToolRequiredError(i){return new E.errors.InvalidOperationError(`A ${i} is required for this operation. This might occur when manipulating or getting type information from a node that was not added to a Project object and created via createWrappedNode. Please submit a bug report if you don't believe a ${i} should be required for this operation.`)}};xa([E.Memoize],pk.prototype,"getSourceFileContainer",null);xa([E.Memoize],pk.prototype,"getModuleResolutionHost",null);var uye=class{constructor(i={}){var u;at();let S=We(),P=new E.TransactionalFileSystem({fileSystem:S,skipLoadingLibFiles:i.skipLoadingLibFiles,libFolderPath:i.libFolderPath}),z=i.tsConfigFilePath==null?void 0:new E.TsConfigResolver(P,P.getStandardizedAbsolutePath(i.tsConfigFilePath),Cn()),re=Ue(),Ie=new E.CompilerOptionsContainer;Ie.set(re),this._context=new pk({project:this,compilerOptionsContainer:Ie,fileSystemWrapper:P,createLanguageService:!0,resolutionHost:i.resolutionHost,configFileParsingDiagnostics:(u=z?.getErrors())!==null&&u!==void 0?u:[],skipLoadingLibFiles:i.skipLoadingLibFiles,libFolderPath:i.libFolderPath}),i.manipulationSettings!=null&&this._context.manipulationSettings.set(i.manipulationSettings),z!=null&&i.skipAddingFilesFromTsConfig!==!0&&(this._addSourceFilesForTsConfigResolver(z,re),i.skipFileDependencyResolution||this.resolveSourceFileDependencies());function at(){if(i.fileSystem!=null&&i.useInMemoryFileSystem)throw new E.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function We(){var Wn;return i.useInMemoryFileSystem?new E.InMemoryFileSystemHost:(Wn=i.fileSystem)!==null&&Wn!==void 0?Wn:new E.RealFileSystemHost}function Ue(){var Wn;return{...Yt(),...(Wn=i.compilerOptions)!==null&&Wn!==void 0?Wn:{}}}function Yt(){var Wn;return(Wn=z?.getCompilerOptions())!==null&&Wn!==void 0?Wn:{}}function Cn(){var Wn;let zr="utf-8";return i.compilerOptions!=null&&(Wn=i.compilerOptions.charset)!==null&&Wn!==void 0?Wn:zr}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let i=new Set,u=re=>i.add(re),{compilerFactory:S,inProjectCoordinator:P}=this._context;S.onSourceFileAdded(u);try{this.getProgram().compilerObject}finally{S.onSourceFileAdded(u,!1)}let z=P.markSourceFilesAsInProjectForResolution();for(let re of z.changedSourceFiles)i.add(re);for(let re of z.unchangedSourceFiles)i.delete(re);return Array.from(i.values())}addDirectoryAtPathIfExists(i,u={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),{...u,markInProject:!0})}addDirectoryAtPath(i,u={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),{...u,markInProject:!0})}createDirectory(i){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),{markInProject:!0})}getDirectoryOrThrow(i,u){return E.errors.throwIfNullOrUndefined(this.getDirectory(i),u??(()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(i)}`))}getDirectory(i){let{compilerFactory:u}=this._context;return u.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(i))}getDirectories(){return Array.from(this._getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator:i}=this._context,u=[];for(let P of this._context.compilerFactory.getOrphanDirectories())for(let z of S(P))u.push(z);return u;function*S(P){if(i.isDirectoryInProject(P)){yield P;return}for(let z of P._getDirectoriesIterator())yield*S(z)}}addSourceFilesAtPaths(i){return this._context.directoryCoordinator.addSourceFilesAtPaths(i,{markInProject:!0})}addSourceFileAtPathIfExists(i){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),{markInProject:!0})}addSourceFileAtPath(i){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),{markInProject:!0})}addSourceFilesFromTsConfig(i){let u=new E.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),this._context.getEncoding());return this._addSourceFilesForTsConfigResolver(u,u.getCompilerOptions())}_addSourceFilesForTsConfigResolver(i,u){let S=i.getPaths(u),P=S.filePaths.map(z=>this.addSourceFileAtPath(z));for(let z of S.directoryPaths)this.addDirectoryAtPathIfExists(z);return P}createSourceFile(i,u,S){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(i),u??"",{...S??{},markInProject:!0})}removeSourceFile(i){let u=i.wasForgotten();return i.forget(),!u}getSourceFileOrThrow(i){let u=this.getSourceFile(i);if(u!=null)return u;if(typeof i=="string"){let S=E.FileUtils.standardizeSlashes(i);if(E.FileUtils.pathIsAbsolute(S)||S.indexOf("/")>=0){let P=this._context.fileSystemWrapper.getStandardizedAbsolutePath(S);throw new E.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${P}`)}else throw new E.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${i}`)}else throw new E.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(i){let u=S(this._context.fileSystemWrapper);if(P(u))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(u);return E.IterableUtils.find(this._getProjectSourceFilesByDirectoryDepth(),u);function S(z){if(i instanceof Function)return i;let re=E.FileUtils.standardizeSlashes(i);return E.FileUtils.pathIsAbsolute(re)||re.indexOf("/")>=0?z.getStandardizedAbsolutePath(re):Ie=>E.FileUtils.pathEndsWith(Ie.getFilePath(),re)}function P(z){return typeof z=="string"}}getSourceFiles(i){let{compilerFactory:u,fileSystemWrapper:S}=this._context,P=this._getProjectSourceFilesByDirectoryDepth();if(typeof i=="string"||i instanceof Array)return Array.from(z());return Array.from(P);function*z(){let re=Array.from(at()),Ie=E.matchGlobs(re,i,S.getCurrentDirectory());for(let We of Ie)yield u.getSourceFileFromCacheFromFilePath(S.getStandardizedAbsolutePath(We));function*at(){for(let We of P)yield We.getFilePath()}}}*_getProjectSourceFilesByDirectoryDepth(){let{compilerFactory:i,inProjectCoordinator:u}=this._context;for(let S of i.getSourceFilesByDirectoryDepth())u.isSourceFileInProject(S)&&(yield S)}*_getProjectDirectoriesByDirectoryDepth(){let{compilerFactory:i,inProjectCoordinator:u}=this._context;for(let S of i.getDirectoriesByDepth())u.isDirectoryInProject(S)&&(yield S)}getAmbientModule(i){return i=d5e(i),this.getAmbientModules().find(u=>u.getName()===i)}getAmbientModuleOrThrow(i,u){return E.errors.throwIfNullOrUndefined(this.getAmbientModule(i),u??(()=>`Could not find ambient module with name: ${d5e(i)}`))}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this._getUnsavedSourceFiles().map(i=>i.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let i of this._getUnsavedSourceFiles())i.saveSync()}enableLogging(i=!0){this._context.logger.setEnabled(i)}_getUnsavedSourceFiles(){return Array.from(i(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*i(u){for(let S of u)S.isSaved()||(yield S)}}getPreEmitDiagnostics(){return this._context.getPreEmitDiagnostics()}getLanguageService(){return this._context.languageService}getProgram(){return this._context.program}getTypeChecker(){return this._context.typeChecker}getFileSystem(){return this._context.fileSystemWrapper.getFileSystem()}emit(i={}){return this._context.program.emit(i)}emitSync(i={}){return this._context.program.emitSync(i)}emitToMemory(i={}){return this._context.program.emitToMemory(i)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(i){return this._context.compilerFactory.forgetNodesCreatedInBlock(i)}formatDiagnosticsWithColorAndContext(i,u={}){return E.ts.formatDiagnosticsWithColorAndContext(i.map(S=>S.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:S=>S,getNewLine:()=>{var S;return(S=u.newLineChar)!==null&&S!==void 0?S:E.runtime.getEndOfLine()}})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function d5e(y){return i(y[0])&&i(y[y.length-1])&&(y=y.substring(1,y.length-1)),`"${y}"`;function i(u){return u==='"'||u==="'"}}function nDt(y,i={}){let{compilerOptions:u={},sourceFile:S,typeChecker:P}=i,z=new E.CompilerOptionsContainer;z.set(u);let re=new pk({project:void 0,fileSystemWrapper:new E.TransactionalFileSystem({fileSystem:new E.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer:z,createLanguageService:!1,typeChecker:P,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),Ie=re.compilerFactory.getSourceFile(at(),{markInProject:!0});return re.compilerFactory.getNodeFromCompilerNode(y,Ie);function at(){return S??We(y)}function We(Ue){if(Ue.kind===E.SyntaxKind.SourceFile)return Ue;if(Ue.parent==null)throw new E.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let Yt=Ue;for(;Yt.parent!=null;)Yt=Yt.parent;if(Yt.kind!==E.SyntaxKind.SourceFile)throw new E.errors.NotImplementedError("For some reason the top parent was not a source file.");return Yt}}var rDt=new Ss(()=>{throw new E.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),dye=class{constructor(){}static object(i){return u=>{let S=Object.keys(i);u.write("{"),S.length>0&&u.indent(()=>{P()}),u.write("}");function P(){for(let z=0;z<S.length;z++){z>0&&u.write(",").newLine();let re=S[z],Ie=i[re];u.write(re),Ie!=null&&(u.write(": "),o3(u,Ie))}u.newLine()}}}static objectType(i){return u=>{u.write("{"),iDt(i)&&u.indent(()=>{rDt.forTypeElementMemberedNode().printText(u,i)}),u.write("}")}}static unionType(i,u,...S){return p5e("|",[i,u,...S])}static intersectionType(i,u,...S){return p5e("&",[i,u,...S])}static assertion(i,u){return S=>{o3(S,i),S.spaceIfLastNot().write("as "),o3(S,u)}}static returnStatement(i){return u=>{u.write("return "),u.hangingIndentUnlessBlock(()=>{o3(u,i),u.write(";")})}}};function p5e(y,i){return u=>{oDt(u,` ${y} `,i)}}function iDt(y){for(let i of Object.keys(y))if(y[i]!=null&&!(y[i]instanceof Array&&y[i].length===0))return!0;return!1}function oDt(y,i,u){for(let S=0;S<u.length;S++)y.conditionalWrite(S>0,i),o3(y,u[S])}function o3(y,i){i instanceof Function?i(y):y.write(i.toString())}var{InvalidOperationError:aDt,FileNotFoundError:sDt,ArgumentError:lDt,ArgumentNullOrWhitespaceError:cDt,ArgumentOutOfRangeError:uDt,ArgumentTypeError:dDt,BaseError:pDt,DirectoryNotFoundError:fDt,NotImplementedError:_Dt,NotSupportedError:mDt,PathNotFoundError:gDt}=E.errors;Object.defineProperty($,"CompilerOptionsContainer",{enumerable:!0,get:function(){return E.CompilerOptionsContainer}});Object.defineProperty($,"DiagnosticCategory",{enumerable:!0,get:function(){return E.DiagnosticCategory}});Object.defineProperty($,"EmitHint",{enumerable:!0,get:function(){return E.EmitHint}});Object.defineProperty($,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return E.InMemoryFileSystemHost}});Object.defineProperty($,"LanguageVariant",{enumerable:!0,get:function(){return E.LanguageVariant}});Object.defineProperty($,"ModuleKind",{enumerable:!0,get:function(){return E.ModuleKind}});Object.defineProperty($,"ModuleResolutionKind",{enumerable:!0,get:function(){return E.ModuleResolutionKind}});Object.defineProperty($,"NewLineKind",{enumerable:!0,get:function(){return E.NewLineKind}});Object.defineProperty($,"NodeFlags",{enumerable:!0,get:function(){return E.NodeFlags}});Object.defineProperty($,"ObjectFlags",{enumerable:!0,get:function(){return E.ObjectFlags}});Object.defineProperty($,"ResolutionHosts",{enumerable:!0,get:function(){return E.ResolutionHosts}});Object.defineProperty($,"ScriptKind",{enumerable:!0,get:function(){return E.ScriptKind}});Object.defineProperty($,"ScriptTarget",{enumerable:!0,get:function(){return E.ScriptTarget}});Object.defineProperty($,"SettingsContainer",{enumerable:!0,get:function(){return E.SettingsContainer}});Object.defineProperty($,"SymbolFlags",{enumerable:!0,get:function(){return E.SymbolFlags}});Object.defineProperty($,"SyntaxKind",{enumerable:!0,get:function(){return E.SyntaxKind}});Object.defineProperty($,"TypeFlags",{enumerable:!0,get:function(){return E.TypeFlags}});Object.defineProperty($,"TypeFormatFlags",{enumerable:!0,get:function(){return E.TypeFormatFlags}});Object.defineProperty($,"ts",{enumerable:!0,get:function(){return E.ts}});Object.defineProperty($,"CodeBlockWriter",{enumerable:!0,get:function(){return xj.default}});$.AbstractableNode=JI;$.AmbientableNode=tx;$.ArgumentError=lDt;$.ArgumentNullOrWhitespaceError=cDt;$.ArgumentOutOfRangeError=uDt;$.ArgumentTypeError=dDt;$.ArgumentedNode=hye;$.ArrayBindingPattern=Fj;$.ArrayDestructuringAssignment=Qhe;$.ArrayDestructuringAssignmentBase=q5e;$.ArrayLiteralExpression=zj;$.ArrayTypeNode=hq;$.ArrowFunction=rq;$.ArrowFunctionBase=rze;$.AsExpression=Vj;$.AsExpressionBase=X5e;$.AssertClause=WJ;$.AssertClauseBase=HGe;$.AssertEntry=BJ;$.AssertEntryBase=KH;$.AssertionKeyNamedNode=z5e;$.AssignmentExpression=c3;$.AssignmentExpressionBase=J5e;$.AsyncableNode=zR;$.AwaitExpression=Uj;$.AwaitExpressionBase=$5e;$.AwaitableNode=M5e;$.BaseError=pDt;$.BaseExpressionedNode=hk;$.BigIntLiteral=n$;$.BigIntLiteralBase=zze;$.BinaryExpression=l3;$.BinaryExpressionBase=j5e;$.BindingElement=Wj;$.BindingElementBase=H5e;$.BindingNamedNode=W$;$.Block=gJ;$.BlockBase=DGe;$.BodiedNode=k$;$.BodyableNode=VR;$.BreakStatement=hJ;$.CallExpression=Kj;$.CallExpressionBase=Y5e;$.CallSignatureDeclaration=kX;$.CallSignatureDeclarationBase=fj;$.CaseBlock=yJ;$.CaseBlockBase=IGe;$.CaseClause=vJ;$.CaseClauseBase=CGe;$.CatchClause=bJ;$.CatchClauseBase=NGe;$.ChildOrderableNode=Kh;$.ClassDeclaration=sq;$.ClassDeclarationBase=ej;$.ClassElement=E0;$.ClassExpression=lq;$.ClassExpressionBase=cze;$.ClassLikeDeclarationBase=Cye;$.ClassLikeDeclarationBaseSpecific=sze;$.ClassStaticBlockDeclaration=cq;$.ClassStaticBlockDeclarationBase=tj;$.CodeAction=b$;$.CodeFixAction=E$;$.CombinedCodeActions=m3;$.CommaListExpression=Hj;$.CommaListExpressionBase=Q5e;$.CommentClassElement=uq;$.CommentEnumMember=RX;$.CommentObjectLiteralElement=Qj;$.CommentRange=Lj;$.CommentStatement=EJ;$.CommentTypeElement=wX;$.CommonIdentifierBase=Pye;$.CompilerCommentClassElement=Ij;$.CompilerCommentEnumMember=Rj;$.CompilerCommentNode=BI;$.CompilerCommentObjectLiteralElement=Nj;$.CompilerCommentStatement=Dj;$.CompilerCommentTypeElement=Cj;$.ComputedPropertyName=zX;$.ComputedPropertyNameBase=Lze;$.ConditionalExpression=jj;$.ConditionalExpressionBase=Z5e;$.ConditionalTypeNode=yq;$.ConstructSignatureDeclaration=OX;$.ConstructSignatureDeclarationBase=_j;$.ConstructorDeclaration=dq;$.ConstructorDeclarationBase=nj;$.ConstructorDeclarationOverloadBase=uze;$.ConstructorTypeNode=vq;$.ConstructorTypeNodeBase=_ze;$.ContinueStatement=SJ;$.DebuggerStatement=TJ;$.DebuggerStatementBase=RGe;$.DecoratableNode=UR;$.Decorator=mq;$.DecoratorBase=aj;$.DefaultClause=xJ;$.DefaultClauseBase=PGe;$.DefinitionInfo=dk;$.DeleteExpression=Jj;$.DeleteExpressionBase=eGe;$.Diagnostic=BR;$.DiagnosticMessageChain=g3;$.DiagnosticWithLocation=h3;$.Directory=P$;$.DirectoryEmitResult=A3;$.DirectoryNotFoundError=fDt;$.DoStatement=AJ;$.DoStatementBase=MGe;$.DocumentSpan=iS;$.DotDotDotTokenableNode=D3;$.ElementAccessExpression=u3;$.ElementAccessExpressionBase=tGe;$.EmitOutput=y3;$.EmitResult=GR;$.EmptyStatement=DJ;$.EmptyStatementBase=LGe;$.EnumDeclaration=PX;$.EnumDeclarationBase=dj;$.EnumMember=MX;$.EnumMemberBase=pj;$.ExclamationTokenableNode=vye;$.ExportAssignment=GJ;$.ExportAssignmentBase=nye;$.ExportDeclaration=zJ;$.ExportDeclarationBase=HH;$.ExportGetableNode=bye;$.ExportSpecifier=VJ;$.ExportSpecifierBase=rye;$.ExportableNode=nx;$.Expression=Zd;$.ExpressionStatement=IJ;$.ExpressionStatementBase=kGe;$.ExpressionWithTypeArguments=bq;$.ExpressionWithTypeArgumentsBase=mze;$.ExpressionableNode=R3;$.ExpressionedNode=Ef;$.ExtendsClauseableNode=B5e;$.ExternalModuleReference=UJ;$.ExternalModuleReferenceBase=jGe;$.FalseLiteral=i$;$.FalseLiteralBase=Uze;$.FileNotFoundError=sDt;$.FileReference=ak;$.FileTextChanges=KI;$.ForInStatement=CJ;$.ForInStatementBase=wGe;$.ForOfStatement=NJ;$.ForOfStatementBase=OGe;$.ForStatement=RJ;$.ForStatementBase=FGe;$.FunctionDeclaration=iq;$.FunctionDeclarationBase=YH;$.FunctionDeclarationOverloadBase=ize;$.FunctionExpression=oq;$.FunctionExpressionBase=oze;$.FunctionLikeDeclaration=qR;$.FunctionOrConstructorTypeNodeBase=p3;$.FunctionOrConstructorTypeNodeBaseBase=fze;$.FunctionTypeNode=Eq;$.FunctionTypeNodeBase=gze;$.GeneratorableNode=HR;$.GetAccessorDeclaration=pq;$.GetAccessorDeclarationBase=rj;$.HeritageClause=LX;$.HeritageClauseableNode=Sye;$.Identifier=_3;$.IdentifierBase=kze;$.IfStatement=PJ;$.IfStatementBase=WGe;$.ImplementationLocation=v3;$.ImplementsClauseableNode=G5e;$.ImportClause=KJ;$.ImportClauseBase=JGe;$.ImportDeclaration=HJ;$.ImportDeclarationBase=jH;$.ImportEqualsDeclaration=jJ;$.ImportEqualsDeclarationBase=XGe;$.ImportExpression=qj;$.ImportExpressionBase=nGe;$.ImportExpressionedNode=sAt;$.ImportSpecifier=JJ;$.ImportSpecifierBase=JH;$.ImportTypeAssertionContainer=Sq;$.ImportTypeNode=Tq;$.IndexSignatureDeclaration=FX;$.IndexSignatureDeclarationBase=mj;$.IndexedAccessTypeNode=xq;$.InferTypeNode=Aq;$.InitializerExpressionGetableNode=F$;$.InitializerExpressionableNode=jR;$.InterfaceDeclaration=WX;$.InterfaceDeclarationBase=gj;$.IntersectionTypeNode=Dq;$.InvalidOperationError=aDt;$.IterationStatement=UI;$.JSDoc=gq;$.JSDocAllType=Uq;$.JSDocAugmentsTag=Kq;$.JSDocAuthorTag=Hq;$.JSDocBase=sj;$.JSDocCallbackTag=jq;$.JSDocClassTag=Jq;$.JSDocDeprecatedTag=qq;$.JSDocEnumTag=Xq;$.JSDocFunctionType=$q;$.JSDocFunctionTypeBase=Tze;$.JSDocImplementsTag=Yq;$.JSDocLink=Qq;$.JSDocLinkCode=Zq;$.JSDocLinkPlain=eX;$.JSDocMemberName=tX;$.JSDocNameReference=rX;$.JSDocNamepathType=nX;$.JSDocNonNullableType=iX;$.JSDocNullableType=oX;$.JSDocOptionalType=aX;$.JSDocOverloadTag=sX;$.JSDocOverloadTagBase=xze;$.JSDocOverrideTag=lX;$.JSDocParameterTag=cX;$.JSDocParameterTagBase=Aze;$.JSDocPrivateTag=uX;$.JSDocPropertyLikeTag=Nye;$.JSDocPropertyTag=dX;$.JSDocPropertyTagBase=Dze;$.JSDocProtectedTag=pX;$.JSDocPublicTag=fX;$.JSDocReadonlyTag=_X;$.JSDocReturnTag=mX;$.JSDocReturnTagBase=Ize;$.JSDocSatisfiesTag=gX;$.JSDocSatisfiesTagBase=Cze;$.JSDocSeeTag=hX;$.JSDocSeeTagBase=Nze;$.JSDocSignature=yX;$.JSDocTag=Wd;$.JSDocTagBase=uj;$.JSDocTagInfo=f3;$.JSDocTemplateTag=vX;$.JSDocTemplateTagBase=Rze;$.JSDocText=bX;$.JSDocThisTag=EX;$.JSDocThisTagBase=Pze;$.JSDocThrowsTag=SX;$.JSDocThrowsTagBase=Mze;$.JSDocType=nb;$.JSDocTypeExpression=xX;$.JSDocTypeExpressionableTag=XR;$.JSDocTypeLiteral=AX;$.JSDocTypeParameteredTag=dze;$.JSDocTypeTag=DX;$.JSDocTypedefTag=TX;$.JSDocUnknownTag=IX;$.JSDocUnknownType=CX;$.JSDocVariadicType=NX;$.JSDocableNode=ep;$.JsxAttribute=KX;$.JsxAttributeBase=vj;$.JsxAttributedNode=Rye;$.JsxClosingElement=HX;$.JsxClosingElementBase=Oze;$.JsxClosingFragment=jX;$.JsxElement=JX;$.JsxElementBase=bj;$.JsxExpression=qX;$.JsxExpressionBase=Fze;$.JsxFragment=XX;$.JsxNamespacedName=$X;$.JsxNamespacedNameBase=Wze;$.JsxOpeningElement=YX;$.JsxOpeningElementBase=Bze;$.JsxOpeningFragment=QX;$.JsxSelfClosingElement=ZX;$.JsxSelfClosingElementBase=Ej;$.JsxSpreadAttribute=e$;$.JsxSpreadAttributeBase=Sj;$.JsxTagNamedNode=H$;$.JsxText=t$;$.JsxTextBase=Gze;$.LabeledStatement=MJ;$.LabeledStatementBase=BGe;$.LanguageService=N$;$.LeftHandSideExpression=lk;$.LeftHandSideExpressionedNode=JR;$.LiteralExpression=VI;$.LiteralExpressionBase=rGe;$.LiteralLikeNode=_k;$.LiteralTypeNode=Iq;$.ManipulationError=Mj;$.ManipulationSettingsContainer=Aj;$.MappedTypeNode=Cq;$.MemberExpression=OR;$.MemoryEmitResult=T$;$.MetaProperty=Xj;$.MetaPropertyBase=iGe;$.MethodDeclaration=ck;$.MethodDeclarationBase=ZH;$.MethodDeclarationOverloadBase=aze;$.MethodSignature=BX;$.MethodSignatureBase=hj;$.ModifierableNode=h_;$.ModuleBlock=qJ;$.ModuleBlockBase=$Ge;$.ModuleChildableNode=qI;$.ModuleDeclaration=XJ;$.ModuleDeclarationBase=qH;$.ModuleNamedNode=V5e;$.ModuledNode=Tye;$.NameableNode=B$;$.NamedExports=$J;$.NamedExportsBase=YGe;$.NamedImports=YJ;$.NamedImportsBase=QGe;$.NamedNode=ox;$.NamedNodeBase=mk;$.NamedTupleMember=Nq;$.NamedTupleMemberBase=hze;$.NamespaceExport=QJ;$.NamespaceExportBase=ZGe;$.NamespaceImport=ZJ;$.NamespaceImportBase=eze;$.NewExpression=$j;$.NewExpressionBase=oGe;$.NoSubstitutionTemplateLiteral=c$;$.NoSubstitutionTemplateLiteralBase=Xze;$.Node=Ae;$.NodeWithTypeArguments=WR;$.NodeWithTypeArgumentsBase=pze;$.NonNullExpression=Yj;$.NonNullExpressionBase=aGe;$.NotEmittedStatement=LJ;$.NotEmittedStatementBase=GGe;$.NotImplementedError=_Dt;$.NotSupportedError=mDt;$.NullLiteral=o$;$.NullLiteralBase=Hze;$.NumericLiteral=a$;$.NumericLiteralBase=jze;$.ObjectBindingPattern=Bj;$.ObjectDestructuringAssignment=Zhe;$.ObjectDestructuringAssignmentBase=sGe;$.ObjectLiteralElement=FR;$.ObjectLiteralExpression=Zj;$.ObjectLiteralExpressionBase=lGe;$.OmittedExpression=rJ;$.OmittedExpressionBase=cGe;$.OutputFile=S$;$.OverloadableNode=U$;$.OverrideableNode=C3;$.ParameterDeclaration=aq;$.ParameterDeclarationBase=QH;$.ParameteredNode=U5e;$.ParenthesizedExpression=iJ;$.ParenthesizedExpressionBase=uGe;$.ParenthesizedTypeNode=Rq;$.PartiallyEmittedExpression=oJ;$.PartiallyEmittedExpressionBase=dGe;$.PathNotFoundError=gDt;$.PostfixUnaryExpression=aJ;$.PostfixUnaryExpressionBase=pGe;$.PrefixUnaryExpression=sJ;$.PrefixUnaryExpressionBase=fGe;$.PrimaryExpression=Gf;$.PrivateIdentifier=VX;$.PrivateIdentifierBase=wze;$.Program=C$;$.Project=uye;$.PropertyAccessExpression=d3;$.PropertyAccessExpressionBase=_Ge;$.PropertyAssignment=eJ;$.PropertyAssignmentBase=zH;$.PropertyDeclaration=fq;$.PropertyDeclarationBase=ij;$.PropertyNamedNode=cA;$.PropertySignature=GX;$.PropertySignatureBase=yj;$.QualifiedName=UX;$.QuestionDotTokenableNode=G$;$.QuestionTokenableNode=ax;$.ReadonlyableNode=N3;$.RefactorEditInfo=b3;$.ReferenceEntry=x$;$.ReferenceFindableNode=ix;$.ReferencedSymbol=E3;$.ReferencedSymbolDefinitionInfo=S3;$.ReferencedSymbolEntry=A$;$.RegularExpressionLiteral=s$;$.RegularExpressionLiteralBase=Jze;$.RenameLocation=D$;$.RenameableNode=aS;$.RestTypeNode=Pq;$.ReturnStatement=kJ;$.ReturnStatementBase=zGe;$.ReturnTypedNode=xye;$.SatisfiesExpression=lJ;$.SatisfiesExpressionBase=mGe;$.ScopeableNode=K5e;$.ScopedNode=jI;$.SetAccessorDeclaration=_q;$.SetAccessorDeclarationBase=oj;$.ShorthandPropertyAssignment=tJ;$.ShorthandPropertyAssignmentBase=VH;$.Signature=y$;$.SignaturedDeclaration=sS;$.SourceFile=iA;$.SourceFileBase=XH;$.SpreadAssignment=nJ;$.SpreadAssignmentBase=UH;$.SpreadElement=cJ;$.SpreadElementBase=gGe;$.Statement=au;$.StatementBase=AGe;$.StatementedNode=lx;$.StaticableNode=gk;$.StringLiteral=l$;$.StringLiteralBase=qze;$.Structure=i3;$.SuperElementAccessExpression=eye;$.SuperElementAccessExpressionBase=hGe;$.SuperExpression=uJ;$.SuperExpressionBase=yGe;$.SuperExpressionedNode=Iye;$.SuperPropertyAccessExpression=tye;$.SuperPropertyAccessExpressionBase=vGe;$.SwitchStatement=wJ;$.SwitchStatementBase=VGe;$.Symbol=v$;$.SymbolDisplayPart=I$;$.SyntaxList=kj;$.TaggedTemplateExpression=u$;$.TemplateExpression=d$;$.TemplateExpressionBase=$ze;$.TemplateHead=p$;$.TemplateHeadBase=Yze;$.TemplateLiteralTypeNode=Mq;$.TemplateMiddle=f$;$.TemplateMiddleBase=Qze;$.TemplateSpan=_$;$.TemplateSpanBase=Zze;$.TemplateTail=m$;$.TemplateTailBase=e9e;$.TextChange=sA;$.TextInsertableNode=zf;$.TextRange=a3;$.TextSpan=uk;$.ThisExpression=dJ;$.ThisExpressionBase=bGe;$.ThisTypeNode=Lq;$.ThrowStatement=OJ;$.ThrowStatementBase=UGe;$.TrueLiteral=r$;$.TrueLiteralBase=Vze;$.TryStatement=FJ;$.TryStatementBase=KGe;$.TupleTypeNode=kq;$.Type=x3;$.TypeAliasDeclaration=wq;$.TypeAliasDeclarationBase=lj;$.TypeArgumentedNode=z$;$.TypeAssertion=pJ;$.TypeAssertionBase=EGe;$.TypeChecker=T3;$.TypeElement=aA;$.TypeElementMemberedNode=Dye;$.TypeLiteralNode=Oq;$.TypeLiteralNodeBase=yze;$.TypeNode=Op;$.TypeOfExpression=fJ;$.TypeOfExpressionBase=SGe;$.TypeOperatorTypeNode=Fq;$.TypeParameter=R$;$.TypeParameterDeclaration=Wq;$.TypeParameterDeclarationBase=cj;$.TypeParameteredNode=rb;$.TypePredicateNode=Bq;$.TypeQueryNode=Gq;$.TypeReferenceNode=zq;$.TypedNode=sx;$.UnaryExpression=rS;$.UnaryExpressionedNode=yk;$.UnionTypeNode=Vq;$.UnwrappableNode=V$;$.UpdateExpression=Gj;$.VariableDeclaration=g$;$.VariableDeclarationBase=Tj;$.VariableDeclarationList=h$;$.VariableDeclarationListBase=t9e;$.VariableStatement=eq;$.VariableStatementBase=$H;$.VoidExpression=_J;$.VoidExpressionBase=TGe;$.WhileStatement=tq;$.WhileStatementBase=tze;$.WithStatement=nq;$.WithStatementBase=nze;$.Writers=dye;$.YieldExpression=mJ;$.YieldExpressionBase=xGe;$.createWrappedNode=nDt;$.forEachStructureChild=b1t;$.getCompilerOptionsFromTsConfig=Pxt;$.getScopeForNode=Oj;$.insertOverloads=K$;$.printNode=Rge;$.setScopeForNode=Aye});Zs();var ib=I7e(Lye(),1);Zs();var bk=I7e(Lye(),1);Zs();Zs();function cx(y){return y.getJsDocs().at(-1)||y.addJsDoc({description:`
|
|
30460
|
-
`})}function P3(y){if(!y)return y;let i=/{*typeof\s+([^(?:}|\s);]*)/gm.exec(y)?.[1];return i?`Class<${i}>`:y}function vk(y,i){let u=vDt(y,i);if(yDt(y,u),i){let S=i?.getDeclarations()[0],P=i?.getJsDocs()[0];if(P?.getTags().length===0){let z=S?.getType().getText();hDt(z)&&P.addTag({tagName:z.startsWith("() =>")?"return":"type",text:n9e(z)})}}else{let S=y,P=S.getJsDocs()[0];if(P&&!P.getTags().find(z=>z.getTagName()==="return")){let z=S.getReturnType().getText();S.getSignature().compilerSignature.getReturnType().aliasSymbol&&P.addTag({tagName:"return",text:n9e(z)})}}}function hDt(y){return!!(y&&y!=="any"&&y!=="unknown"&&y!=="{}"&&y!=="boolean")}function n9e(y){let i=y.replace(/^\(\)\s+=>\s+/,"").replace(/typeof import\("[^"]+"\)\./,"typeof ");return i==="SerializeFrom<any>"?"{
|
|
30461
|
-
$&`)),/(function loader\(|const loader =)/.test(Ie)&&(u.push("/** @typedef {
|
|
30462
|
-
$&`),/(function Layout\(|const Layout =)/.test(Ie)&&re.includes("root."))){let at="/** @typedef {LoaderReturnData} RootLoader */",We=u.findIndex(Ue=>/RootLoader/.test(Ue));We>=0?u.splice(We,1,at):u.push(at)}/(function action\(|const action =)/.test(Ie)&&(u.push("/** @typedef {
|
|
30460
|
+
`})}function P3(y){if(!y)return y;let i=/{*typeof\s+([^(?:}|\s);]*)/gm.exec(y)?.[1];return i?`Class<${i}>`:y}function vk(y,i){let u=vDt(y,i);if(yDt(y,u),i){let S=i?.getDeclarations()[0],P=i?.getJsDocs()[0];if(P?.getTags().length===0){let z=S?.getType().getText();hDt(z)&&P.addTag({tagName:z.startsWith("() =>")?"return":"type",text:n9e(z)})}}else{let S=y,P=S.getJsDocs()[0];if(P&&!P.getTags().find(z=>z.getTagName()==="return")){let z=S.getReturnType().getText();S.getSignature().compilerSignature.getReturnType().aliasSymbol&&P.addTag({tagName:"return",text:n9e(z)})}}}function hDt(y){return!!(y&&y!=="any"&&y!=="unknown"&&y!=="{}"&&y!=="boolean")}function n9e(y){let i=y.replace(/^\(\)\s+=>\s+/,"").replace(/typeof import\("[^"]+"\)\./,"typeof ");return i==="SerializeFrom<any>"?"{ReturnType<typeof useLoaderData<typeof loader>>}":`{${i}}`}function yDt(y,i){let u=y.getParameters(),S=cx(i),P=(S.getTags()||[]).filter(Ie=>["param","parameter"].includes(Ie.getTagName())),z=Object.fromEntries(P.map(Ie=>[Ie.compilerNode.name?.getText().replace(/\[|\]|(=.*)/g,"").trim(),(Ie.getComment()||"").toString().trim()])),re=P[0]?.getTagName();P.forEach(Ie=>Ie.remove());for(let Ie of u){let at=P3(Ie.getTypeNode()?.getText());if(!at)continue;let We=Ie.compilerNode.name?.getText(),Ue=Ie.isOptional(),Cn=Ie.isRestParameter()?`...${at.replace(/\[\]\s*$/,"")}`:at,Wn;Ue&&(Wn=Ie.getInitializer()?.getText().replaceAll(/(\s|\t)*\n(\s|\t)*/g," "));let zr=We;if(zr.match(/[{},]/)&&(zr=""),zr&&Ue){let Wo=Wn!==void 0?`=${Wn}`:"";zr=`[${zr}${Wo}]`}zr=zr?` ${zr}`:"";let Ji=z[We.trim()];S.addTag({tagName:re||"param",text:`{${Cn}}${zr}${Ji?` ${Ji}`:""}`})}}function vDt(y,i){return i?y.getJsDocs().length?y:(cx(i),i):(cx(y),y)}function r9e(y){EDt(y),y.getMembers().forEach(bDt)}function bDt(y){TDt(y),(bk.Node.isPropertyDeclaration(y)||bk.Node.isPropertyAssignment(y)||bk.Node.isPropertySignature(y))&&SDt(y),(bk.Node.isMethodDeclaration(y)||bk.Node.isConstructorDeclaration(y))&&vk(y)}function EDt(y){let i=cx(y),u=y.getExtends();u&&i.addTag({tagName:"extends",text:u.getText()})}function SDt(y){let i=y.getStructure();if(i&&"initializer"in i){let u=i.initializer;u&&u!=="undefined"&&cx(y).addTag({tagName:"default",text:u})}}function TDt(y){if("getModifiers"in y){let i=y.getModifiers()||[];for(let u of i){let S=u?.getText();["public","private","protected","readonly","static"].includes(S)&&cx(y).addTag({tagName:S})}}}Zs();function i9e(y,i){let u=y.getTypeAliases().map(Ie=>ADt(Ie,y).trim()).concat(y.getInterfaces().map(Ie=>xDt(Ie).trim())),S=y.getImportDeclarations().filter(Ie=>/({|\s|\n)type\s/.test(Ie.getText())),P=new Map;for(let Ie of S){let at=[],We=Ie.isTypeOnly();for(let Ue of Ie.getNamedImports())(We||Ue.isTypeOnly())&&at.push(Ue.getName());at.length>0&&P.set(Ie.getModuleSpecifierValue(),at)}u.push("");let z={MetaFunction:"T",Fetcher:"T",PartialPredictiveSearchResult:"ItemType, ExtraProps",PartialSearchResult:"ItemType"};P.forEach((Ie,at)=>{for(let We of Ie){let Ue=!!z[We];u.push(`/** ${Ue?`@template ${z[We]} `:""}@typedef {import('${at}').${We}${Ue?`<${z[We]}>`:""}} ${We} */`)}});let re=y.getFilePath();if(re.includes("routes")||re.includes("root.")){let Ie=y.getText();if(/RootLoader/.test(Ie)&&(i=i.replace(/^\s+?const\s+([\w\d]+|\{[\w\d\s,.]+\})\s+?=\s+?useRouteLoaderData\(['"]root['"]\)/gms,`/** @type {RootLoader} */
|
|
30461
|
+
$&`)),/(function loader\(|const loader =)/.test(Ie)&&(u.push("/** @typedef {ReturnType<typeof useLoaderData<typeof loader>>} LoaderReturnData */"),i=i.replace(/^\s+?const\s+([\w\d]+|\{[\w\d\s,.]+\})\s+?=\s+?useLoaderData\(\)/gms,`/** @type {LoaderReturnData} */
|
|
30462
|
+
$&`),/(function Layout\(|const Layout =)/.test(Ie)&&re.includes("root."))){let at="/** @typedef {LoaderReturnData} RootLoader */",We=u.findIndex(Ue=>/RootLoader/.test(Ue));We>=0?u.splice(We,1,at):u.push(at)}/(function action\(|const action =)/.test(Ie)&&(u.push("/** @typedef {ReturnType<typeof useActionData<typeof action>>} ActionReturnData */"),i=i.replace(/^\s+?const\s+([\w\d]+|\{[\w\d\s,.]+\})\s+?=\s+?useActionData\(\)/gms,`/** @type {ActionReturnData} */
|
|
30463
30463
|
$&`))}return i+`
|
|
30464
30464
|
|
|
30465
30465
|
${u.join(`
|